@stacksjs/stx 0.2.838 → 0.2.840

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 (241) hide show
  1. package/dist/builtins/image-delivery.js +7 -3
  2. package/dist/chunk-02cntwd8.js +2 -0
  3. package/dist/chunk-03v59965.js +2 -0
  4. package/dist/chunk-07hvjvj1.js +2 -0
  5. package/dist/{chunk-gh62p9mx.js → chunk-11y84h2d.js} +2 -2
  6. package/dist/{chunk-3bjnrmha.js → chunk-1b1ntgt7.js} +2 -2
  7. package/dist/{chunk-z25w7kmr.js → chunk-1m16mvt4.js} +4 -4
  8. package/dist/{chunk-4ntm3dtk.js → chunk-23r3rby6.js} +2 -2
  9. package/dist/{chunk-ya6bp08c.js → chunk-2fj5zev7.js} +1 -1
  10. package/dist/{chunk-29f6vmyz.js → chunk-2j5yane9.js} +4 -4
  11. package/dist/chunk-2knr61g3.js +2 -0
  12. package/dist/chunk-2pgc087j.js +2 -0
  13. package/dist/chunk-2vprq4x0.js +54 -0
  14. package/dist/{chunk-ac9ncbfw.js → chunk-321e41ck.js} +3 -3
  15. package/dist/chunk-3gzhh69y.js +2 -0
  16. package/dist/chunk-40bkdswh.js +2 -0
  17. package/dist/chunk-41sh9y5w.js +2 -0
  18. package/dist/chunk-4654xm1h.js +2 -0
  19. package/dist/{chunk-amg6kr1p.js → chunk-4657mnht.js} +4 -4
  20. package/dist/{chunk-s33andzg.js → chunk-4dxq7ft1.js} +2 -2
  21. package/dist/chunk-4eagsz5d.js +2 -0
  22. package/dist/{chunk-f7jgda7x.js → chunk-4j08cbjd.js} +5 -5
  23. package/dist/chunk-4rswqcfc.js +2 -0
  24. package/dist/{chunk-tx8wk6h7.js → chunk-4y6hes3h.js} +2 -2
  25. package/dist/{chunk-6s3hgq9z.js → chunk-57x8wxdf.js} +32 -32
  26. package/dist/chunk-5khpy4na.js +2 -0
  27. package/dist/{chunk-5w0cf32p.js → chunk-5pbxjx8s.js} +1 -1
  28. package/dist/chunk-5t93dqft.js +2 -0
  29. package/dist/chunk-66eba1h4.js +2 -0
  30. package/dist/chunk-6efz68j8.js +2 -0
  31. package/dist/chunk-6n5kew7a.js +3 -0
  32. package/dist/chunk-6nb07mdj.js +2 -0
  33. package/dist/{chunk-2x9zhezb.js → chunk-6wrf6302.js} +2 -2
  34. package/dist/{chunk-1zxahmnh.js → chunk-7cg2f588.js} +1 -1
  35. package/dist/{chunk-nm26vnzd.js → chunk-7dnp8evg.js} +6 -6
  36. package/dist/chunk-7m0r7mq9.js +2 -0
  37. package/dist/{chunk-jstrmqna.js → chunk-7m53tpxn.js} +2 -2
  38. package/dist/{chunk-ckg6q98b.js → chunk-7t57cnz9.js} +5 -5
  39. package/dist/{chunk-jr0r5pzw.js → chunk-7vhm0jj5.js} +2 -2
  40. package/dist/{chunk-mvehmtap.js → chunk-7y5gz0cs.js} +14 -14
  41. package/dist/{chunk-vfj9wp11.js → chunk-8370x30n.js} +2 -2
  42. package/dist/{chunk-65tptp4x.js → chunk-88rwr1w2.js} +2 -2
  43. package/dist/{chunk-txd2js5v.js → chunk-89d3h8mp.js} +14 -14
  44. package/dist/chunk-8c363c2r.js +2 -0
  45. package/dist/{chunk-wfsa28e7.js → chunk-8d4br2j5.js} +9 -9
  46. package/dist/chunk-8gdtys3s.js +2 -0
  47. package/dist/{chunk-em8tv6nz.js → chunk-8pj4v1eh.js} +2 -2
  48. package/dist/{chunk-z0ynyz62.js → chunk-8qbp5skx.js} +7 -7
  49. package/dist/chunk-8w0n2rae.js +2 -0
  50. package/dist/{chunk-c3dg8qdn.js → chunk-97k72dfh.js} +2 -2
  51. package/dist/{chunk-d689fbv1.js → chunk-9razzga7.js} +6 -6
  52. package/dist/{chunk-s53wjw7y.js → chunk-9xps62ek.js} +2 -2
  53. package/dist/{chunk-52g026sc.js → chunk-a1s5wqw4.js} +2 -2
  54. package/dist/chunk-a2p42cxf.js +2 -0
  55. package/dist/{chunk-myje6fhm.js → chunk-a9tzjqny.js} +5 -5
  56. package/dist/{chunk-ax624h16.js → chunk-azderqyk.js} +7 -7
  57. package/dist/chunk-b0fkvrat.js +2 -0
  58. package/dist/chunk-b3fx75th.js +2 -0
  59. package/dist/{chunk-20mmryy5.js → chunk-b685aqy4.js} +3 -3
  60. package/dist/chunk-b6w3457c.js +2 -0
  61. package/dist/{chunk-j59js1nh.js → chunk-b90xw7v4.js} +3 -3
  62. package/dist/{chunk-fvgk1w9s.js → chunk-bp918end.js} +2 -2
  63. package/dist/chunk-bq7qcndg.js +3 -0
  64. package/dist/chunk-c18pafmf.js +3 -0
  65. package/dist/chunk-c87zgwzn.js +2 -0
  66. package/dist/{chunk-c9vxm8yq.js → chunk-ca3c5qx2.js} +31 -31
  67. package/dist/{chunk-3yggtch5.js → chunk-chjdnmqv.js} +10 -10
  68. package/dist/{chunk-bky02g7k.js → chunk-d0dzzpfx.js} +2 -2
  69. package/dist/chunk-d44g9sek.js +2 -0
  70. package/dist/chunk-d5vr9g4b.js +2 -0
  71. package/dist/{chunk-yw1s8kyj.js → chunk-dgn87554.js} +4 -4
  72. package/dist/{chunk-fzdgevxr.js → chunk-ebxz30e5.js} +56 -56
  73. package/dist/{chunk-11fn3hgv.js → chunk-ecjx9z8a.js} +2 -2
  74. package/dist/{chunk-33czswpt.js → chunk-f1hkagxk.js} +3 -3
  75. package/dist/chunk-fpn5txnm.js +2 -0
  76. package/dist/chunk-g6r2313a.js +2 -0
  77. package/dist/{chunk-55e46spy.js → chunk-g7rsd8st.js} +5 -5
  78. package/dist/chunk-g957a2m3.js +2 -0
  79. package/dist/chunk-ga8waz0a.js +2 -0
  80. package/dist/chunk-gaxx0z19.js +2 -0
  81. package/dist/chunk-gbcwna5q.js +2 -0
  82. package/dist/chunk-gft9pg9n.js +2 -0
  83. package/dist/chunk-h8h79939.js +2 -0
  84. package/dist/{chunk-q5pwvr98.js → chunk-jc5y35b7.js} +1 -1
  85. package/dist/chunk-jgx0ex9p.js +3 -0
  86. package/dist/{chunk-vfxkn1pe.js → chunk-kd6r7z27.js} +3 -3
  87. package/dist/chunk-ksc83y9t.js +2 -0
  88. package/dist/{chunk-gw83680k.js → chunk-kvpzxnww.js} +5 -5
  89. package/dist/{chunk-rnm8ejpz.js → chunk-m5bj2jnb.js} +2 -2
  90. package/dist/{chunk-ckasfph2.js → chunk-m7acbayx.js} +5 -5
  91. package/dist/chunk-mh4kpnjr.js +2 -0
  92. package/dist/{chunk-b7tb00nz.js → chunk-mhyd24bg.js} +2 -2
  93. package/dist/chunk-n7pvz99f.js +2 -0
  94. package/dist/chunk-ndah5rvs.js +2 -0
  95. package/dist/{chunk-n4qznmkm.js → chunk-ngnr831a.js} +5 -5
  96. package/dist/chunk-nhk0aat9.js +2 -0
  97. package/dist/{chunk-t2vmk8tf.js → chunk-ns0171xk.js} +3 -3
  98. package/dist/chunk-p2e02hh7.js +2 -0
  99. package/dist/{chunk-cwfavkk0.js → chunk-p65ax8s0.js} +2 -2
  100. package/dist/{chunk-dv11h4f0.js → chunk-p9d2txcg.js} +1 -1
  101. package/dist/chunk-pjkdn8zf.js +2 -0
  102. package/dist/{chunk-pft65534.js → chunk-pqn7r8fw.js} +1 -1
  103. package/dist/{chunk-29bt1fbn.js → chunk-px5kda00.js} +5 -5
  104. package/dist/{chunk-xtqapjz3.js → chunk-q0s0kc66.js} +2 -2
  105. package/dist/{chunk-b1m41fwr.js → chunk-q1nj47gn.js} +3 -3
  106. package/dist/chunk-q88w2rv9.js +2 -0
  107. package/dist/chunk-qb3c05qq.js +2 -0
  108. package/dist/chunk-qcars8ar.js +2 -0
  109. package/dist/{chunk-v3xyb3ws.js → chunk-qfvddpcg.js} +2 -2
  110. package/dist/{chunk-e75dntfb.js → chunk-qk079ca7.js} +2 -2
  111. package/dist/{chunk-zj4s3rnw.js → chunk-qzms4d8s.js} +5 -5
  112. package/dist/chunk-r5bhgyes.js +2 -0
  113. package/dist/{chunk-64eeb5p5.js → chunk-rb17ssxh.js} +2 -2
  114. package/dist/{chunk-7bvvv74e.js → chunk-rk2ex6qx.js} +3 -3
  115. package/dist/chunk-rmc6dfj4.js +2 -0
  116. package/dist/chunk-rzfbffnv.js +2 -0
  117. package/dist/{chunk-r32q8mjw.js → chunk-s2k1x2rn.js} +3 -3
  118. package/dist/chunk-spdh99jy.js +2 -0
  119. package/dist/chunk-st75663x.js +2 -0
  120. package/dist/chunk-sv2d6nfe.js +2 -0
  121. package/dist/{chunk-7k9yahng.js → chunk-t0jed809.js} +6 -6
  122. package/dist/{chunk-s5dhvnnd.js → chunk-t3p0jy0s.js} +6 -6
  123. package/dist/{chunk-f49x34sr.js → chunk-v3q126ys.js} +2 -2
  124. package/dist/{chunk-kw5gra2z.js → chunk-v4ybemgb.js} +2 -2
  125. package/dist/{chunk-trwe0mfa.js → chunk-vbw9jhz2.js} +103 -103
  126. package/dist/chunk-vcx6dy59.js +2 -0
  127. package/dist/chunk-vv7b8p5z.js +2 -0
  128. package/dist/{chunk-wzjdq7d6.js → chunk-vwddsdk5.js} +9 -9
  129. package/dist/{chunk-vyv76w55.js → chunk-wbgc2n04.js} +2 -2
  130. package/dist/chunk-x0ygwk9x.js +2 -0
  131. package/dist/{chunk-nyg0nbjj.js → chunk-x110ssw2.js} +3 -3
  132. package/dist/chunk-x42tsdbx.js +2 -0
  133. package/dist/{chunk-sfsek961.js → chunk-x4f7efgp.js} +3 -3
  134. package/dist/chunk-x5wkbcsf.js +2 -0
  135. package/dist/{chunk-w0a6yz73.js → chunk-xbcnnk8x.js} +5 -5
  136. package/dist/{chunk-38ncpvww.js → chunk-xdzy4pm0.js} +2 -2
  137. package/dist/{chunk-84nw3921.js → chunk-xmsf1bnx.js} +3 -3
  138. package/dist/{chunk-4sv740a5.js → chunk-xqtt5t6d.js} +6 -6
  139. package/dist/{chunk-nmvhktsg.js → chunk-xz2569ra.js} +6 -6
  140. package/dist/chunk-y64qhgv1.js +2 -0
  141. package/dist/{chunk-52t0qpx6.js → chunk-y68xstqy.js} +1 -1
  142. package/dist/{chunk-evgghnjc.js → chunk-y8zzvzww.js} +4 -4
  143. package/dist/chunk-yg5a54pj.js +2 -0
  144. package/dist/chunk-yjskeqaj.js +2 -0
  145. package/dist/chunk-ywpan1k5.js +2 -0
  146. package/dist/chunk-yxqzarzh.js +2 -0
  147. package/dist/chunk-z4g64re8.js +3 -0
  148. package/dist/chunk-z9xjhc5m.js +42 -0
  149. package/dist/{chunk-ms3v5nat.js → chunk-zg44cf8a.js} +7 -7
  150. package/dist/{chunk-s6r54dyf.js → chunk-zjqvbcwa.js} +2 -2
  151. package/dist/chunk-znwc8gta.js +2 -0
  152. package/dist/{chunk-917v0bar.js → chunk-zrp4159x.js} +12 -12
  153. package/dist/{chunk-0rvntfhj.js → chunk-zvy88beh.js} +3 -3
  154. package/dist/cli.js +20 -20
  155. package/dist/compression.js +3 -3
  156. package/dist/craft-entry.js +2 -2
  157. package/dist/craft.js +2 -2
  158. package/dist/dev-server/port-utils.js +2 -1
  159. package/dist/expressions.js +1 -1
  160. package/dist/html-masking.d.ts +2 -0
  161. package/dist/html-masking.js +23 -0
  162. package/dist/image-optimization/processor.js +2 -2
  163. package/dist/includes.js +5 -4
  164. package/dist/misc-directives.js +2 -2
  165. package/dist/native/runtime/craft-bridge.js +2 -10
  166. package/dist/native/runtime/craft.d.ts +11 -0
  167. package/dist/native/runtime/navigation-chrome.d.ts +2 -0
  168. package/dist/native/runtime/navigation-chrome.js +25 -3
  169. package/dist/pwa.js +3 -3
  170. package/dist/ssg.js +8 -11
  171. package/dist/utils.js +16 -13
  172. package/package.json +5 -5
  173. package/dist/chunk-0a36jnq4.js +0 -2
  174. package/dist/chunk-0c02182b.js +0 -42
  175. package/dist/chunk-0rnfywsx.js +0 -2
  176. package/dist/chunk-1bpx9b0m.js +0 -2
  177. package/dist/chunk-1g6xxftp.js +0 -2
  178. package/dist/chunk-2fcg7aws.js +0 -2
  179. package/dist/chunk-2nxxhcyy.js +0 -2
  180. package/dist/chunk-4wgfqa56.js +0 -2
  181. package/dist/chunk-5p6x0ztt.js +0 -2
  182. package/dist/chunk-6aak0b7c.js +0 -2
  183. package/dist/chunk-6c6m6p9t.js +0 -3
  184. package/dist/chunk-6g8byhwn.js +0 -2
  185. package/dist/chunk-70akxpk5.js +0 -2
  186. package/dist/chunk-72gq0ywg.js +0 -2
  187. package/dist/chunk-72n804gy.js +0 -2
  188. package/dist/chunk-7efkc3gk.js +0 -2
  189. package/dist/chunk-88zc5chj.js +0 -2
  190. package/dist/chunk-8gg8gn87.js +0 -2
  191. package/dist/chunk-8wv2p899.js +0 -2
  192. package/dist/chunk-9w3r1ch2.js +0 -3
  193. package/dist/chunk-a1hxz8q4.js +0 -2
  194. package/dist/chunk-a579jdwb.js +0 -2
  195. package/dist/chunk-ahd8jdzx.js +0 -2
  196. package/dist/chunk-aqrx322x.js +0 -2
  197. package/dist/chunk-ay7ggc4k.js +0 -2
  198. package/dist/chunk-bc4x45vx.js +0 -2
  199. package/dist/chunk-c77vxvp3.js +0 -2
  200. package/dist/chunk-c7hw37ww.js +0 -2
  201. package/dist/chunk-cfrgrnej.js +0 -2
  202. package/dist/chunk-cw8vpk41.js +0 -2
  203. package/dist/chunk-d96b9qgj.js +0 -2
  204. package/dist/chunk-db1c0c3c.js +0 -2
  205. package/dist/chunk-f6vzn90z.js +0 -2
  206. package/dist/chunk-fd3815fe.js +0 -2
  207. package/dist/chunk-gtj8wy95.js +0 -2
  208. package/dist/chunk-h4tbpr7p.js +0 -2
  209. package/dist/chunk-h5aaq0j8.js +0 -2
  210. package/dist/chunk-j0j4p9t1.js +0 -2
  211. package/dist/chunk-j0w048sj.js +0 -2
  212. package/dist/chunk-jvg9e6t6.js +0 -2
  213. package/dist/chunk-k761q7s7.js +0 -2
  214. package/dist/chunk-m3tnxk01.js +0 -2
  215. package/dist/chunk-mdtysd2d.js +0 -2
  216. package/dist/chunk-nmtya57z.js +0 -3
  217. package/dist/chunk-nxfyjw59.js +0 -2
  218. package/dist/chunk-pe5qqem0.js +0 -2
  219. package/dist/chunk-pwv77cyb.js +0 -2
  220. package/dist/chunk-qs0vtav5.js +0 -2
  221. package/dist/chunk-qv21bsa1.js +0 -2
  222. package/dist/chunk-rrba4t7k.js +0 -2
  223. package/dist/chunk-s3j5vxy9.js +0 -3
  224. package/dist/chunk-ssrxqj55.js +0 -2
  225. package/dist/chunk-t612xpa4.js +0 -2
  226. package/dist/chunk-tesbhpbp.js +0 -2
  227. package/dist/chunk-tkgkdf93.js +0 -2
  228. package/dist/chunk-tvw571ab.js +0 -2
  229. package/dist/chunk-txzap6yn.js +0 -2
  230. package/dist/chunk-vhrq4xjf.js +0 -2
  231. package/dist/chunk-vqpypnys.js +0 -2
  232. package/dist/chunk-vv3w8z4v.js +0 -2
  233. package/dist/chunk-vypnjn9g.js +0 -3
  234. package/dist/chunk-w39cfxa6.js +0 -2
  235. package/dist/chunk-wj937ceq.js +0 -2
  236. package/dist/chunk-xbavxkm5.js +0 -2
  237. package/dist/chunk-xrspzeqx.js +0 -2
  238. package/dist/chunk-y41hhypj.js +0 -2
  239. package/dist/chunk-yv9589qr.js +0 -54
  240. package/dist/chunk-z0yq548d.js +0 -2
  241. package/dist/chunk-zfjbwp54.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{He,kn,qs,ki,M}from"./chunk-vfj9wp11.js";import{Sn}from"./chunk-cwfavkk0.js";import{Nr,k,pl,ct,Pi,fl}from"./chunk-4ntm3dtk.js";import{I}from"./chunk-s6r54dyf.js";import{T,Ks,u,f,Bt,d,K,z,x,Ys,Ce,Ue,Zs}from"./chunk-txd2js5v.js";import{s,me}from"./chunk-sfsek961.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-jr0r5pzw.js";import ot from"path";import Lt from"process";import{AsyncLocalStorage as Qo}from"async_hooks";var Rr=new Qo;function yn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function Ar(e,t){return Rr.run(yn(e),t)}async function Tr(e,t){let i=Rr.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function Cr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let i=s(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let O=E[2];if(!a.has(O))n.push(O),a.add(O);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((O)=>{let B=O.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let j=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(t&&i.slice(c).startsWith("const"))return;j[1].split(",").forEach((O)=>{let B=O.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let F=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let O=F[1];if(!a.has(O))n.push(O),a.add(O);return}let P=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(P){let O=P[1];if(!a.has(O))n.push(O),a.add(O)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ea(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Os(e,t){let i=`{ ${ea(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import Ct from"fs";import $e from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Ir=new Map;function br(e,t=!0){let i=Ir.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=Ct.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let j=E.name.slice(0,-4);if(!n.has(j))n.set(j,A);let F=j.toLowerCase();if(!n.has(F))n.set(F,A);let P=U(j);if(!n.has(P))n.set(P,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Ir.set(e,n);return n}function Ns(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(Ct.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ms(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Or(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ai(e,t){let[i,n,a]=Or(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ta(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(Ct.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var na=["src/ui","src/components","components","dist"];function jn(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=ta(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(Ct.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:na;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*ci(e,t,i={},n){let a=Or(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...jn(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of Ct.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function Pr(e,t,i={},n){let a=ai(e,n);if(a!==void 0)return a;for(let l of ci(e,t,i,n))try{if(Ct.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ds(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")&&!n.has("source")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(n.has("resizemode")&&(n.has("fit")||n.has("objectfit")))return!1;if(n.has("src")&&n.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import ts from"fs";import ae from"path";import wt from"path";import Yt from"fs";var sa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function gs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return sa.has(e.toLowerCase())}var Mr=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"]),jr={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"},ra=new Set(["ctrl","alt","shift","meta"]),zr={left:0,middle:1,right:2};function Dr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(ra.has(n))t.systemKeys.push(n);else if(n in zr)t.mouse=n;else if(n in jr||/^[a-z]$/.test(n))t.keys.push(jr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Br(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,j=`__stx_evt_${t}${n++}`,F=[],P=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,O;while((O=P.exec(v))!==null){let[,L,H]=O,G=L.split("."),D=G[0];if(!Mr.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Dr(G.slice(1)),elementId:j})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((O=B.exec(v))!==null){let[,L,H]=O,G=L.split("."),D=G[0];if(!Mr.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Dr(G.slice(1)),elementId:j})}if(F.length>0)i.push({originalTag:c,elementId:j,events:F,startIndex:E,endIndex:A})}return i}function ia(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=zr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function oa(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function ms(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function aa(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=ia(e),a=oa(ms(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(gs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2
+ import{He,_n,Ks,_i,M}from"./chunk-8370x30n.js";import{kn}from"./chunk-p65ax8s0.js";import{Mr,k,fl,ct,Ii,gl}from"./chunk-23r3rby6.js";import{I}from"./chunk-zjqvbcwa.js";import{T,Xs,u,f,Ft,d,K,z,x,Zs,Ce,Ue,Qs}from"./chunk-89d3h8mp.js";import{s,me}from"./chunk-x4f7efgp.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-7vhm0jj5.js";import it from"path";import Bt from"process";import{AsyncLocalStorage as sa}from"async_hooks";var Or=new sa;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function jr(e,t){return Or.run(bn(e),t)}async function Dr(e,t){let i=Or.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).then((l)=>{let c=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function Er(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let i=s(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let P=E[2];if(!a.has(P))n.push(P),a.add(P);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((P)=>{let B=P.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let j=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(t&&i.slice(c).startsWith("const"))return;j[1].split(",").forEach((P)=>{let B=P.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let F=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let P=F[1];if(!a.has(P))n.push(P),a.add(P);return}let O=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let P=O[1];if(!a.has(P))n.push(P),a.add(P)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ra(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Ns(e,t){let i=`{ ${ra(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import Tt from"fs";import $e from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function wr(e,t=!0){let i=Nr.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=Tt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let j=E.name.slice(0,-4);if(!n.has(j))n.set(j,A);let F=j.toLowerCase();if(!n.has(F))n.set(F,A);let O=U(j);if(!n.has(O))n.set(O,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Nr.set(e,n);return n}function Ms(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(Tt.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ds(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ci(e,t){let[i,n,a]=Lr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ia(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(Tt.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var oa=["src/ui","src/components","components","dist"];function Dn(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=ia(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(Tt.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:oa;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*li(e,t,i={},n){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...Dn(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of Tt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function zr(e,t,i={},n){let a=ci(e,n);if(a!==void 0)return a;for(let l of li(e,t,i,n))try{if(Tt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ls(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")&&!n.has("source")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(n.has("resizemode")&&(n.has("fit")||n.has("objectfit")))return!1;if(n.has("src")&&n.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import ns from"fs";import ae from"path";import wt from"path";import en from"fs";var aa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function hs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return aa.has(e.toLowerCase())}var Br=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"]),Wr={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"},ca=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(ca.has(n))t.systemKeys.push(n);else if(n in Ur)t.mouse=n;else if(n in Wr||/^[a-z]$/.test(n))t.keys.push(Wr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,j=`__stx_evt_${t}${n++}`,F=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=O.exec(v))!==null){let[,L,H]=P,G=L.split("."),D=G[0];if(!Br.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Fr(G.slice(1)),elementId:j})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=B.exec(v))!==null){let[,L,H]=P,G=L.split("."),D=G[0];if(!Br.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Fr(G.slice(1)),elementId:j})}if(F.length>0)i.push({originalTag:c,elementId:j,events:F,startIndex:E,endIndex:A})}return i}function la(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=Ur[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ua(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function xs(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function fa(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=la(e),a=ua(xs(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(hs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${i}');
5
5
  if (!$el) return;
@@ -53,7 +53,7 @@ else {
53
53
  __stx_runHandler('${b}', $event, $el);
54
54
  }
55
55
  }${c});
56
- })();`}function li(e){if(e.length===0)return"";return`
56
+ })();`}function ui(e){if(e.length===0)return"";return`
57
57
  <script data-stx-events>
58
58
  (function() {
59
59
  'use strict';
@@ -108,22 +108,22 @@ else {
108
108
  }
109
109
 
110
110
  // Event listeners
111
- ${e.map(aa).join(`
111
+ ${e.map(fa).join(`
112
112
  `)}
113
113
  })();
114
- </script>`}function ca(e,t=""){let i=Br(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");b=b.replace(A,""),b=b.replace(j,"")}n=n.slice(0,c.startIndex)+b+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Lr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Ac(e,t,i){if(fl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=ca(e,Lr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],b}let n=Br(e,Lr(t));if(n.length===0)return e;let a=e;for(let b=n.length-1;b>=0;b--){let v=n[b],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let j of v.events)j.elementId=A[1]}for(let A of v.events){let j=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),P=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");E=E.replace(F,""),E=E.replace(P,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=li(n.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
- `+a.slice(c);else a+=l;return a}function Wr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function At(e,t){let i=s(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&Wr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&Wr(b[1],!1).has(t))return!0;return!1}var Fr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),xt=/^[A-Za-z_$][\w$]*$/,la=new Set(["if","for","while","switch","with"]),Vr=["(","[","{"],Ur=[")","]","}"],ua=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function fa(e){let t=s(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function hs(e){let t=Fr.get(e);if(t)return t;let{code:i,tokens:n}=fa(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let H=n[L].text;if(["(","[","{"].includes(H))l.push(L);else if([")","]","}"].includes(H)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+H))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,H){let G=[],D=L;for(let ee=L;ee<H;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??H)<H){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,H]),G}let b=[];function v(L,H,G,D=!1){if(n[L]?.text==="...")L++;if(L>=H)return;let ee=n[L].text;if(xt.test(ee)){if(G.add(ee),G===j)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=H)return;for(let[te,le]of c(L+1,ne)){let he=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){he=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(he,le,G,D)}}function E(L,H){let G=new Set;for(let[D,ee]of c(L,H))v(D,ee,G);return G}function A(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(["(","[","{"].includes(G)&&a.has(H)){H=a.get(H);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,H-1)]?.end??i.length}let j=new Set,F=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let H=L-1,G=H,D;if(n[H]?.text===")"&&a.has(H))G=a.get(H),D=E(G+1,H);else if(n[H]&&xt.test(n[H].text))D=new Set([n[H].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);F.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let H=n[L-1]?.text;if(!H||la.has(H)||!xt.test(H)&&H!=="*"&&H!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;F.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:H!=="catch",names:E(L+1,G)})}function P(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(Vr.includes(G)&&a.has(H)){H=a.get(H);continue}if(G===";"||Ur.includes(G))break;let D=n[H-1];if(H>L&&ua.has(G)&&D.text!==".")break;if(H>L&&/[\n\r]/.test(i.slice(D.end,n[H].start))&&(/^[\w$]+$/.test(D.text)||Ur.includes(D.text)||['"',"'","`"].includes(D.text))&&xt.test(G)&&!["in","of","instanceof"].includes(G))break}return H}let O=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let H=n[L+1]?.text==="await"?L+2:L+1;if(n[H]?.text!=="("||!a.has(H))continue;let G=a.get(H),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):P(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;O.push({headStart:H,headEnd:G,start:n[H].start,end:ne})}for(let L=0;L<n.length;L++){let H=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(H==="const"||H==="let"||H==="var"){let D=P(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let he=L+1;he<=D;he++){let ue=n[he]?.text;if(he<D&&Vr.includes(ue)&&a.has(he)&&a.get(he)<D){he=a.get(he);continue}if(he<D&&ue===":"&&!te)ne=!0;else if(he<D&&ue==="="&&le===0)ne=!1,te=!0;else if(he<D&&ne&&ue==="<")le++;else if(he<D&&ne&&ue===">"&&le>0)le--;else if(he===D||ue===","&&le===0)v(ee,he,j,H==="var"),ee=he+1,ne=!1,te=!1}}else if(H==="function"||H==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&xt.test(n[D].text)&&n[D].text!=="extends")j.add(n[D].text),b.push({name:n[D].text,token:D})}else if(H==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&xt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")j.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,he]of c(ne+1,te)){let ue=he-1;while(ue>=le&&!xt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:F,loops:O,declarations:j,sites:b,tokens:n,pairs:a};return Fr.set(e,B),B}function Gt(e){let t=hs(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function Dn(e){return new Set(hs(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=hs(e),b=Array.from({length:l.length},()=>-1),v=[];for(let P=0;P<l.length;P++){b[P]=v.length?v[v.length-1]:-1;let O=l[P].text;if(O==="{"&&c.has(P))v.push(P);else if(O==="}"&&v.length&&c.get(P)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let P of a){if(!t.has(P.name))continue;E.add(P.token);let O=P.file?-1:b[P.token],B=O===-1?[0,Number.POSITIVE_INFINITY]:[l[O].start,l[c.get(O)].end];if(P.functionScoped){let H=l[P.token].start,G=i.filter((D)=>D.functionBody&&H>=D.bodyStart&&H<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!P.file){let H=n.filter((G)=>P.token>G.headStart&&P.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(H)B=[H.start,H.end]}let L=A.get(P.name);if(L)L.push(B);else A.set(P.name,[B])}let j=new Set;for(let P=0;P<l.length;P++){if(l[P].text!=="import"||l[P-1]?.text===".")continue;let O=P+1;if(l[O]?.text==="type")O++;if(l[O]&&xt.test(l[O].text)&&l[O+1]?.text===",")O+=2;if(l[O]?.text==="{"&&c.has(O))for(let B=O+1;B<c.get(O);B++)j.add(B)}let F=new Set;for(let P=0;P<l.length;P++){let O=l[P].text;if(!t.has(O)||F.has(O)||E.has(P)||j.has(P))continue;let B=l[P-1]?.text;if(B==="#"||B==="."&&l[P-2]?.text!=="..")continue;if(l[P+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[P].start;if(A.get(O)?.some(([H,G])=>L>=H&&L<G))continue;if(i.some((H)=>L>=H.start&&L<H.end&&H.names.has(O)))continue;F.add(O)}return F}var Ie="0.2.838";var Hr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function da(){let e=globalThis;return e[Hr]??=new Map,e[Hr]}function o(e,t){let i=da(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var ga=/<\/(script)/gi;function pn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ga,"<\\/$1")}import qr from"fs";var Zr=[];function w(e){let t=new T(e);return Zr.push(t),t}function Pc(){for(let e of Zr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function wr(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:qr.statSync(i).mtimeMs})}catch{}return t}function Ls(e){for(let t of e)try{if(qr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var ma=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ha(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function xa(e,t){let i=t;while(!0){let n=wt.join(i,"node_modules",e,"package.json");if(Yt.existsSync(n))return wt.dirname(n);let a=wt.dirname(i);if(a===i)return null;i=a}}function ba(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function ya(e,t){let i=ha(e);if(!i||!i.subpath)return null;let n=xa(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(Yt.readFileSync(wt.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=ba(a.exports,l);if(!c)return null;let b=wt.resolve(n,c);return Yt.existsSync(b)?b:null}function yi(e,t){let i=t.filePath?wt.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ma,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:wt.resolve(i,E),!Yt.existsSync(A))throw Error(`file not found: ${A}`)}else{let j=null;try{j=Bun.resolveSync(E,n)}catch{j=ya(E,n)}if(!j)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${j?.message||j}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let j=Yt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${A}: ${j?.message||j}`),c.push(E)}return""}),styles:l,unresolved:c}}function _a(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${_a(t.source)}" data-stx-layer="vendor">
114
+ </script>`}function pa(e,t=""){let i=Hr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");b=b.replace(A,""),b=b.replace(j,"")}n=n.slice(0,c.startIndex)+b+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Vr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Pc(e,t,i){if(gl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=pa(e,Vr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],b}let n=Hr(e,Vr(t));if(n.length===0)return e;let a=e;for(let b=n.length-1;b>=0;b--){let v=n[b],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let j of v.events)j.elementId=A[1]}for(let A of v.events){let j=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");E=E.replace(F,""),E=E.replace(O,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ui(n.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
115
+ `+a.slice(c);else a+=l;return a}function qr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))i.add(a)}return i}function At(e,t){let i=s(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),xt=/^[A-Za-z_$][\w$]*$/,da=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],ga=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ma(e){let t=s(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function bs(e){let t=Zr.get(e);if(t)return t;let{code:i,tokens:n}=ma(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let H=n[L].text;if(["(","[","{"].includes(H))l.push(L);else if([")","]","}"].includes(H)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+H))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,H){let G=[],D=L;for(let ee=L;ee<H;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??H)<H){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,H]),G}let b=[];function v(L,H,G,D=!1){if(n[L]?.text==="...")L++;if(L>=H)return;let ee=n[L].text;if(xt.test(ee)){if(G.add(ee),G===j)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=H)return;for(let[te,le]of c(L+1,ne)){let be=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){be=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(be,le,G,D)}}function E(L,H){let G=new Set;for(let[D,ee]of c(L,H))v(D,ee,G);return G}function A(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(["(","[","{"].includes(G)&&a.has(H)){H=a.get(H);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,H-1)]?.end??i.length}let j=new Set,F=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let H=L-1,G=H,D;if(n[H]?.text===")"&&a.has(H))G=a.get(H),D=E(G+1,H);else if(n[H]&&xt.test(n[H].text))D=new Set([n[H].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);F.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let H=n[L-1]?.text;if(!H||da.has(H)||!xt.test(H)&&H!=="*"&&H!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;F.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:H!=="catch",names:E(L+1,G)})}function O(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(Kr.includes(G)&&a.has(H)){H=a.get(H);continue}if(G===";"||Xr.includes(G))break;let D=n[H-1];if(H>L&&ga.has(G)&&D.text!==".")break;if(H>L&&/[\n\r]/.test(i.slice(D.end,n[H].start))&&(/^[\w$]+$/.test(D.text)||Xr.includes(D.text)||['"',"'","`"].includes(D.text))&&xt.test(G)&&!["in","of","instanceof"].includes(G))break}return H}let P=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let H=n[L+1]?.text==="await"?L+2:L+1;if(n[H]?.text!=="("||!a.has(H))continue;let G=a.get(H),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):O(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;P.push({headStart:H,headEnd:G,start:n[H].start,end:ne})}for(let L=0;L<n.length;L++){let H=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(H==="const"||H==="let"||H==="var"){let D=O(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let be=L+1;be<=D;be++){let ue=n[be]?.text;if(be<D&&Kr.includes(ue)&&a.has(be)&&a.get(be)<D){be=a.get(be);continue}if(be<D&&ue===":"&&!te)ne=!0;else if(be<D&&ue==="="&&le===0)ne=!1,te=!0;else if(be<D&&ne&&ue==="<")le++;else if(be<D&&ne&&ue===">"&&le>0)le--;else if(be===D||ue===","&&le===0)v(ee,be,j,H==="var"),ee=be+1,ne=!1,te=!1}}else if(H==="function"||H==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&xt.test(n[D].text)&&n[D].text!=="extends")j.add(n[D].text),b.push({name:n[D].text,token:D})}else if(H==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&xt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")j.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,be]of c(ne+1,te)){let ue=be-1;while(ue>=le&&!xt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:F,loops:P,declarations:j,sites:b,tokens:n,pairs:a};return Zr.set(e,B),B}function Qt(e){let t=bs(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function Nn(e){return new Set(bs(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=bs(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let P=l[O].text;if(P==="{"&&c.has(O))v.push(O);else if(P==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;E.add(O.token);let P=O.file?-1:b[O.token],B=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(O.functionScoped){let H=l[O.token].start,G=i.filter((D)=>D.functionBody&&H>=D.bodyStart&&H<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let H=n.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(H)B=[H.start,H.end]}let L=A.get(O.name);if(L)L.push(B);else A.set(O.name,[B])}let j=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let P=O+1;if(l[P]?.text==="type")P++;if(l[P]&&xt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let B=P+1;B<c.get(P);B++)j.add(B)}let F=new Set;for(let O=0;O<l.length;O++){let P=l[O].text;if(!t.has(P)||F.has(P)||E.has(O)||j.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[O].start;if(A.get(P)?.some(([H,G])=>L>=H&&L<G))continue;if(i.some((H)=>L>=H.start&&L<H.end&&H.names.has(P)))continue;F.add(P)}return F}var Ie="0.2.840";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function xa(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let i=xa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var ba=/<\/(script)/gi;function fn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ba,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new T(e);return Yr.push(t),t}function Ic(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function vr(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Gr.statSync(i).mtimeMs})}catch{}return t}function js(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var ya=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function _a(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function wa(e,t){let i=t;while(!0){let n=wt.join(i,"node_modules",e,"package.json");if(en.existsSync(n))return wt.dirname(n);let a=wt.dirname(i);if(a===i)return null;i=a}}function Sa(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function $a(e,t){let i=_a(e);if(!i||!i.subpath)return null;let n=wa(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(en.readFileSync(wt.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=Sa(a.exports,l);if(!c)return null;let b=wt.resolve(n,c);return en.existsSync(b)?b:null}function bi(e,t){let i=t.filePath?wt.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ya,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:wt.resolve(i,E),!en.existsSync(A))throw Error(`file not found: ${A}`)}else{let j=null;try{j=Bun.resolveSync(E,n)}catch{j=$a(E,n)}if(!j)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${j?.message||j}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let j=en.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${A}: ${j?.message||j}`),c.push(E)}return""}),styles:l,unresolved:c}}function va(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${va(t.source)}" data-stx-layer="vendor">
116
116
  @layer vendor {
117
117
  ${t.contents}
118
118
  }
119
119
  </style>`).join(`
120
120
  `)}
121
- `}var cg=k,Kr=w(256);function Mt(e){let t=S(e),i=Kr.get(t);if(!i)i=wa(e),Kr.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function wa(e){let t=s(e),i=new Set;for(let b of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of b[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)i.add(E)}let n=Dn(t),a=Se.filter((b)=>{if(i.has(b)||n.has(b))return!1;return lg(t,b,!0)}),l=Yr(t).filter((b)=>!i.has(b)&&!n.has(b));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
121
+ `}var lg=k,Qr=w(256);function Dt(e){let t=S(e),i=Qr.get(t);if(!i)i=Ea(e),Qr.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function Ea(e){let t=s(e),i=new Set;for(let b of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of b[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)i.add(E)}let n=Nn(t),a=Se.filter((b)=>{if(i.has(b)||n.has(b))return!1;return ug(t,b,!0)}),l=si(t).filter((b)=>!i.has(b)&&!n.has(b));if(a.length===0&&l.length===0)return{code:e,imports:a,models:l};return{code:`${[a.length>0?`import { ${a.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
122
122
  `)}
123
- ${e}`,imports:a,models:l}}var Sa=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 Yr(e,t=Gt(e)){let i=new Set,n=Dn(e),a=/(?<![\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 l of t.code.matchAll(a)){let c=l[1];if(Sa.has(c)||n.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;i.add(c)}return Array.from(i)}function $a(e){return Dn(e)}var Xr=w(128);function Gc(e){let t=S(e),i=Xr.get(t);if(!i)i=va(e),Xr.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function va(e){let t=new Set,i=new Set,n=e;n=n.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let P=c[1],O=c[2];if(c[0].includes("import type"))continue;let B=[];for(let H of P.split(",")){let G=H.trim();if(!G||G.startsWith("type "))continue;let D=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!D)continue;let ee=D[1],ne=D[2]||ee;if(a.add(ee),a.add(ne),O==="stx"||O==="@stacksjs/stx")t.add(ee);else i.add(ee);if(ne!==ee)B.push(`${ne} = ${ee}`)}let L=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(c[0],L)}let b=$a(n),v=Gt(n);for(let P of cg){if(a.has(P)||b.has(P))continue;if(xs(v,P,!0))t.add(P)}let E=s(n),A=Gt(E),j=new Set;for(let P of n.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let O of P[1].split(",")){let B=O.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let L of B){let H=L.trim();if(H)j.add(H)}}for(let P of Se){if(a.has(P)||b.has(P)||j.has(P))continue;if(xs(A,P))i.add(P)}let F=Yr(E,A);for(let P of F)if(!a.has(P)&&!b.has(P))i.add(P);return{code:n,stxImports:Array.from(t),browserImports:Array.from(i)}}function lg(e,t,i=!1){return xs(Gt(e),t,i)}function xs(e,t,i=!1){let n=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of n.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let b=c+t.length,v=c-1;while(v>=0&&/\s/.test(n[v]))v--;if(n[v]==="."&&n.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=b;while(E<n.length&&/\s/.test(n[E]))E++;if(n[E]===":"&&n[E+1]!==":"&&(n[v]==="{"||n[v]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(n.slice(b)))continue;if(Ea(n,b))continue;return!0}return!1}function Ea(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let n=0;for(;i<e.length;i++){let a=e[i];if(a==="(")n++;else if(a===")"){if(n--,n===0)break}}if(n!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function Jc(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
123
+ ${e}`,imports:a,models:l}}var ka=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 si(e,t=Qt(e)){let i=new Set,n=Nn(e),a=/(?<![\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 l of t.code.matchAll(a)){let c=l[1];if(ka.has(c)||n.has(c)||c.length<3)continue;if(t.shadows(c,l.index??0))continue;i.add(c)}return Array.from(i)}function Ra(e){return Nn(e)}var ei=w(128);function Jc(e){let t=S(e),i=ei.get(t);if(!i)i=Ca(e),ei.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function Ca(e){let t=new Set,i=new Set,n=e;n=n.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let a=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,c;while((c=l.exec(e))!==null){let O=c[1],P=c[2];if(c[0].includes("import type"))continue;let B=[];for(let H of O.split(",")){let G=H.trim();if(!G||G.startsWith("type "))continue;let D=G.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!D)continue;let ee=D[1],ne=D[2]||ee;if(a.add(ee),a.add(ne),P==="stx"||P==="@stacksjs/stx")t.add(ee);else i.add(ee);if(ne!==ee)B.push(`${ne} = ${ee}`)}let L=B.length>0?`var ${B.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(c[0],L)}let b=Ra(n),v=Qt(n);for(let O of lg){if(a.has(O)||b.has(O))continue;if(ys(v,O,!0))t.add(O)}let E=s(n),A=Qt(E),j=new Set;for(let O of n.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let P of O[1].split(",")){let B=P.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let L of B){let H=L.trim();if(H)j.add(H)}}for(let O of Se){if(a.has(O)||b.has(O)||j.has(O))continue;if(ys(A,O))i.add(O)}let F=si(E,A);for(let O of F)if(!a.has(O)&&!b.has(O))i.add(O);return{code:n,stxImports:Array.from(t),browserImports:Array.from(i)}}function ug(e,t,i=!1){return ys(Qt(e),t,i)}function ys(e,t,i=!1){let n=e.code,a=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of n.matchAll(a)){let c=l.index??0;if(e.shadows(t,c))continue;let b=c+t.length,v=c-1;while(v>=0&&/\s/.test(n[v]))v--;if(n[v]==="."&&n.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=b;while(E<n.length&&/\s/.test(n[E]))E++;if(n[E]===":"&&n[E+1]!==":"&&(n[v]==="{"||n[v]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(n.slice(b)))continue;if(Aa(n,b))continue;return!0}return!1}function Aa(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let n=0;for(;i<e.length;i++){let a=e[i];if(a==="(")n++;else if(a===")"){if(n--,n===0)break}}if(n!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function Yc(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
124
124
  ${i.join(`
125
125
  `)}
126
- ${ka(e,t)}`;return""}function Yh(e,t=[]){let{browserImports:i}=Gc(e),n=new Set(t);return Jc([],i.filter((a)=>!n.has(a)))}function ka(e,t){let i=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
126
+ ${Ta(e,t)}`;return""}function Zh(e,t=[]){let{browserImports:i}=Jc(e),n=new Set(t);return Yc([],i.filter((a)=>!n.has(a)))}function Ta(e,t){let i=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
127
127
  [${i.join(", ")}].forEach(function (e) {
128
128
  if (e[1] !== 'undefined') return;
129
129
  console.error(
@@ -132,18 +132,18 @@ ${ka(e,t)}`;return""}function Yh(e,t=[]){let{browserImports:i}=Gc(e),n=new Set(t
132
132
  + 'or it should be imported from a relative path so the bundler includes it.'
133
133
  );
134
134
  });
135
- `}function Le(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let a in t){let l=t[a];if(typeof l==="function")continue;n[a]=l}return n.__stxDeclaredPayload=!0,n}let i={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let a=e[n];if(typeof a==="function")continue;i[n]=a}return i}var Ra=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Jr=new Set;function Ca(e,t){let i=Ra.test(e),n=t.length>32768;if(!i&&!n)return;if(Jr.has(e))return;if(Jr.add(e),i)console.warn(`[stx] server\u2192client bridge is publishing "${e}" 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(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function wn(e,t){if(!t)return"";let i=Oe(e,new Set(Object.keys(t))),n=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[b])=>c<b?-1:c>b?1:0);for(let[c,b]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!n&&!i.has(c))continue;if(At(e,c)){if(n)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(b)}catch{continue}if(v===void 0)continue;Ca(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
135
+ `}function Le(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let a in t){let l=t[a];if(typeof l==="function")continue;n[a]=l}return n.__stxDeclaredPayload=!0,n}let i={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let a=e[n];if(typeof a==="function")continue;i[n]=a}return i}var Ia=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,ti=new Set;function Pa(e,t){let i=Ia.test(e),n=t.length>32768;if(!i&&!n)return;if(ti.has(e))return;if(ti.add(e),i)console.warn(`[stx] server\u2192client bridge is publishing "${e}" 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(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function vn(e,t){if(!t)return"";let i=Oe(e,new Set(Object.keys(t))),n=t.__stxDeclaredPayload===!0,a=[],l=Object.entries(t).sort(([c],[b])=>c<b?-1:c>b?1:0);for(let[c,b]of l){if(!/^[A-Za-z_$][\w$]*$/.test(c))continue;if(c.startsWith("__")||c.startsWith("$"))continue;if(!n&&!i.has(c))continue;if(At(e,c)){if(n)console.warn(`[stx] defineClientPayload declares "${c}", but this client block also declares "${c}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${c}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(b)}catch{continue}if(v===void 0)continue;Pa(c,v),a.push(` var ${c} = ${v.replace(/</g,"\\u003c")};`)}if(a.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
136
136
  ${a.join(`
137
137
  `)}
138
- `}var Aa={left:0,middle:1,right:2};function Ta(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=Aa[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Ia(e,t){let{elementId:i,event:n,modifiers:a}=e,l=ms(e.handler),c=Ta(a),b=[];if(a.once)b.push("once: true");if(a.capture)b.push("capture: true");if(gs(n,a))b.push("passive: true");let v=b.length>0?`, { ${b.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),j=`var $emit = function(name, detail) {
138
+ `}var Oa={left:0,middle:1,right:2};function Ma(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=Oa[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ja(e,t){let{elementId:i,event:n,modifiers:a}=e,l=xs(e.handler),c=Ma(a),b=[];if(a.once)b.push("once: true");if(a.capture)b.push("capture: true");if(hs(n,a))b.push("passive: true");let v=b.length>0?`, { ${b.join(", ")} }`:"",E="";if(c)E+=`${c}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),j=`var $emit = function(name, detail) {
139
139
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
140
- };`;function F(P){if(/\$emit\s*\(/.test(P))return`${j}
141
- ${P}`;return`var scope = $el.closest('[data-stx-scope]');
140
+ };`;function F(O){if(/\$emit\s*\(/.test(O))return`${j}
141
+ ${O}`;return`var scope = $el.closest('[data-stx-scope]');
142
142
  if (scope && scope.__stx_execute) {
143
143
  scope.__stx_execute('${A}', $event, $el);
144
144
  }
145
145
  else {
146
- ${P}
146
+ ${O}
147
147
  }`}if(a.debounce!==null)return` ;(function() {
148
148
  // eslint-disable-next-line pickier/no-unused-vars
149
149
  var $el = document.getElementById('${i}')
@@ -178,34 +178,34 @@ else {
178
178
  else {
179
179
  ${l}
180
180
  }
181
- }${v})`}function Oa(e){if(e.length===0)return"";return`
181
+ }${v})`}function Da(e){if(e.length===0)return"";return`
182
182
  // STX: auto-generated event bindings
183
- ${e.map((i,n)=>Ia(i,n)).join(`
184
- `)}`}function Gr(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let b=n[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(b==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
185
- `)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let F=E[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let P=F.trim(),O=P.indexOf(":"),B=O>=0?P.slice(O+1).trim().split(/[\s=]/)[0]:P.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let F=j[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=j[0].length;continue}}c++}return t}var Pa=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 Ma(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(F){let P;while((P=i.exec(F))!==null){let O=P[0];if(!Pa.has(O))t.add(O)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=yi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=bi(c.styles),v=Mt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-qs0vtav5.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Gc(i);i=D.code,n=Jc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${wn(i,t.serverData)}${n}`,i=I(i),!a&&Be(t.attrs||""))i=Fe(i);let j=Oa(t.eventBindings||[]),F=(t.attrs||"").trim(),P=/\btype\s*=\s*["']module["']/i.test(F),O=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(P){let D=F.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${O}${D?` ${D}`:""}`;return`${b}<script ${ee}>
186
- ${pn(`${n}${i}
183
+ ${e.map((i,n)=>ja(i,n)).join(`
184
+ `)}`}function ni(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let b=n[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(b==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
185
+ `)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let F=E[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let O=F.trim(),P=O.indexOf(":"),B=P>=0?O.slice(P+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let F=j[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=j[0].length;continue}}c++}return t}var Na=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 La(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(F){let O;while((O=i.exec(F))!==null){let P=O[0];if(!Na.has(P))t.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=bi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=wi(c.styles),v=Dt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-mh4kpnjr.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Jc(i);i=D.code,n=Yc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${vn(i,t.serverData)}${n}`,i=I(i),!a&&Be(t.attrs||""))i=Fe(i);let j=Da(t.eventBindings||[]),F=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(F),P=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let D=F.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${P}${D?` ${D}`:""}`;return`${b}<script ${ee}>
186
+ ${fn(`${n}${i}
187
187
  ${j}`)}
188
- </script>`}let B=Pi(e),L=/function __stx_setup_/.test(i),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(D){let ee=D.length>0?`
189
- return ${Os(i,D)};`:"",ne=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${O}>
188
+ </script>`}let B=Ii(e),L=/function __stx_setup_/.test(i),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(D){let ee=D.length>0?`
189
+ return ${Ns(i,D)};`:"",ne=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${b}<script data-stx-scoped data-stx-run="always"${P}>
190
190
  window.stx.mount(function() {
191
191
  'use strict';
192
192
  try {
193
- ${pn(`${n}${i}
193
+ ${fn(`${n}${i}
194
194
  ${j}${ee}`)}
195
195
  } catch (error) {
196
196
  console.error(${ne}, error);
197
197
  return {};
198
198
  }
199
- })</script>`}if(!H&&!L){if(B)return G(Gr(e));if(t.templateContent){let D=Gr(e);if(D.length>0){let ee=Ma(t.templateContent);if(D.some((te)=>ee.has(te)))return G(D)}}}return`${b}<script data-stx-scoped data-stx-run="always"${O}>
199
+ })</script>`}if(!H&&!L){if(B)return G(ni(e));if(t.templateContent){let D=ni(e);if(D.length>0){let ee=La(t.templateContent);if(D.some((te)=>ee.has(te)))return G(D)}}}return`${b}<script data-stx-scoped data-stx-run="always"${P}>
200
200
  ;(function() {
201
201
  'use strict';
202
202
  try {
203
- ${pn(`${n}${i}
203
+ ${fn(`${n}${i}
204
204
  ${j}`)}
205
205
  } catch (error) {
206
206
  console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
207
207
  }
208
- })()</script>`}import{createHash as Fa}from"crypto";var bs=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,ja=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function fn(e){let t=[],i=0;while(i<e.length){let n=e.indexOf("<",i);if(n===-1)break;if(e.startsWith("<!--",n)){let F=e.indexOf("-->",n+4);if(F===-1)break;i=F+3;continue}bs.lastIndex=n;let a=bs.exec(e);if(!a){i=n+1;continue}let l=bs.lastIndex,c=l,b=null;for(;c<e.length;c++){let F=e[c];if(b){if(F===b)b=null}else if(F==='"'||F==="'")b=F;else if(F===">")break}if(c===e.length)break;let v=a[1]==="/",E=e[c-1]==="/";t.push({start:n,end:c+1,name:a[2],attributes:e.slice(l,E?c-1:c),closing:v,selfClosing:E}),i=c+1;let A=a[2].toLowerCase();if(!v&&A==="plaintext")break;let j=ja.get(A);if(!v&&(A==="script"||A==="style"||j)){let F=j??(A==="script"?zn:Bn);F.lastIndex=i;let P=F.exec(e);if(!P)break;i=P.index}}return t}var Nn=/<script\b[^>]*>/iy,zn=/<\/script\s*>/ig,Ln=/<style\b[^>]*>/iy,Bn=/<\/style\s*>/ig;function Qr(e,t,i,n){i.lastIndex=t;let a=i.exec(e);if(!a||a.index!==t)return-1;n.lastIndex=i.lastIndex;let l=n.exec(e);if(!l)return-1;return l.index+l[0].length}function q(e,t){return Qr(e,t,Nn,zn)}function gn(e,t){return Qr(e,t,Ln,Bn)}function Me(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function ei(e,t){if(e.startsWith("<!--",t)){let a=Me(e,t);return a===-1?e.length:a}if(Nn.lastIndex=t,Nn.exec(e)?.index===t){zn.lastIndex=Nn.lastIndex;let a=zn.exec(e);return a?a.index+a[0].length:e.length}if(Ln.lastIndex=t,Ln.exec(e)?.index===t){Bn.lastIndex=Ln.lastIndex;let a=Bn.exec(e);return a?a.index+a[0].length:e.length}return-1}function y(e,t){let i=[],n=0,a=e.length,l=!1,c=null;while(n<a){let b=e[n];if(l){if(c){if(b===c)c=null}else if(b==='"'||b==="'")c=b;else if(b===">")l=!1;n++;continue}if(b!=="<"){let j=e.indexOf("<",n+1);if(j===-1)break;n=j;continue}let v=t(e,n);if(v>n){i.push({start:n,end:v,token:e.slice(n,v)}),n=v;continue}let E=ei(e,n);if(E>n){n=E;continue}let A=e.charCodeAt(n+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;n++}return i}function ti(e){let t=0,i=0,n=0,a=!1,l=null;while(n<e.length){if(a){let j=e[n];if(l){if(j===l)l=null}else if(j==='"'||j==="'")l=j;else if(j===">")a=!1;n++;continue}let c=e.indexOf("<",n),b=c===-1?e.length:c;while(n<b){let j=e[n++];if(j==="{")t++;else if(j==="}")i++;if(t>=2&&i>=2)return!0}if(c===-1)break;let v=ei(e,c);if(v>c){n=v;continue}let E=e.charCodeAt(c+1),A=E===47?e.charCodeAt(c+2):E;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;n=c+1}return!1}function Ic(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var Da=1024,Na=16777216,Tt=new Map,ys=0;function La(e,t){Tt.set(e,t),ys+=e.length+t.output.length;for(let[i,n]of Tt){if(ys<=Na)break;Tt.delete(i),ys-=i.length+n.output.length}}function fe(e,t,i,n){let a=n!==void 0&&e.length>=Da,l=a?`${n}\x00${e}`:"";if(a){let A=Tt.get(l);if(A)return Tt.delete(l),Tt.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let c=y(e,t);if(c.length===0)return{output:e,tokens:[]};let b=c.map((A)=>A.token),v="",E=0;for(let A=0;A<c.length;A++){let j=c[A];v+=e.slice(E,j.start),v+=i(j.token,A),E=j.end}if(v+=e.slice(E),a)return La(l,{output:v,tokens:b}),{output:v,tokens:b.slice()};return{output:v,tokens:b}}var za=1024,Ba=16777216,jt=new Map,_s=0;function Wa(e,t){jt.set(e,t),_s+=e.length+t.output.length;for(let[i,n]of jt){if(_s<=Ba)break;jt.delete(i),_s-=i.length+n.output.length}}function ws(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:xr(n,i)}}function J(e){let t=e.length>=za;if(t){let a=jt.get(e);if(a)return jt.delete(e),jt.set(e,a),ws(e,a.output,a.scripts.slice())}let{output:i,tokens:n}=fe(e,q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return Wa(e,{output:i,scripts:n}),ws(e,i,n.slice());return ws(e,i,n)}function xr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,n)=>t[+n]??"")}var Wn="__stx_component_client_factories";function Fn(e){let t=e[Wn];return t instanceof Map?t:null}function Wc(e){e[Wn]=new Map}function Ss(e,t){let i=Fn(e);if(!i)return null;let n=Fa("sha256").update(t).digest("hex").slice(0,16),a=i.get(n);if(a)a.instances++;else i.set(n,{body:t,instances:1});return n}function qc(e,t){let i=Fn(t);if(!i?.size)return e;let n=new Map;for(let[A,j]of i)if(j.instances===1)n.set(A,j.body);let a=[];if(n.size>0){let A=[...n.keys()].map((P)=>JSON.stringify(P).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),j=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),F=j.exec(e);while(F!==null){let P=n.get(JSON.parse(F[1]));if(P!==void 0)a.push({start:F.index,end:F.index+F[0].length,replacement:`(${P})(${F[2]});`});F=j.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return ni(e,a);let b=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
208
+ })()</script>`}import{createHash as qa}from"crypto";var _s=/\s*/y,ws=/\x00STX_HTML_COMMENT_\d+\x00/y;function Pt(e){let t=0;while(t<e.length){if(_s.lastIndex=t,_s.exec(e),t=_s.lastIndex,e.startsWith("<!--",t)){let i=e.indexOf("-->",t+4);if(i===-1)return t;t=i+3;continue}if(ws.lastIndex=t,ws.test(e)){t=ws.lastIndex;continue}return t}return t}var Ss=/<(\/?)([a-zA-Z][a-zA-Z0-9-]*)\b/y,za=new Map(["textarea","title","xmp","iframe","noembed","noframes"].map((e)=>[e,new RegExp(`</${e}\\s*>`,"ig")]));function gn(e){let t=[],i=0;while(i<e.length){let n=e.indexOf("<",i);if(n===-1)break;if(e.startsWith("<!--",n)){let F=e.indexOf("-->",n+4);if(F===-1)break;i=F+3;continue}Ss.lastIndex=n;let a=Ss.exec(e);if(!a){i=n+1;continue}let l=Ss.lastIndex,c=l,b=null;for(;c<e.length;c++){let F=e[c];if(b){if(F===b)b=null}else if(F==='"'||F==="'")b=F;else if(F===">")break}if(c===e.length)break;let v=a[1]==="/",E=e[c-1]==="/";t.push({start:n,end:c+1,name:a[2],attributes:e.slice(l,E?c-1:c),closing:v,selfClosing:E}),i=c+1;let A=a[2].toLowerCase();if(!v&&A==="plaintext")break;let j=za.get(A);if(!v&&(A==="script"||A==="style"||j)){let F=j??(A==="script"?Bn:Wn);F.lastIndex=i;let O=F.exec(e);if(!O)break;i=O.index}}return t}var Ln=/<script\b[^>]*>/iy,Bn=/<\/script\s*>/ig,zn=/<style\b[^>]*>/iy,Wn=/<\/style\s*>/ig;function ri(e,t,i,n){i.lastIndex=t;let a=i.exec(e);if(!a||a.index!==t)return-1;n.lastIndex=i.lastIndex;let l=n.exec(e);if(!l)return-1;return l.index+l[0].length}function q(e,t){return ri(e,t,Ln,Bn)}function mn(e,t){return ri(e,t,zn,Wn)}function Me(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function ii(e,t){if(e.startsWith("<!--",t)){let a=Me(e,t);return a===-1?e.length:a}if(Ln.lastIndex=t,Ln.exec(e)?.index===t){Bn.lastIndex=Ln.lastIndex;let a=Bn.exec(e);return a?a.index+a[0].length:e.length}if(zn.lastIndex=t,zn.exec(e)?.index===t){Wn.lastIndex=zn.lastIndex;let a=Wn.exec(e);return a?a.index+a[0].length:e.length}return-1}function y(e,t){let i=[],n=0,a=e.length,l=!1,c=null;while(n<a){let b=e[n];if(l){if(c){if(b===c)c=null}else if(b==='"'||b==="'")c=b;else if(b===">")l=!1;n++;continue}if(b!=="<"){let j=e.indexOf("<",n+1);if(j===-1)break;n=j;continue}let v=t(e,n);if(v>n){i.push({start:n,end:v,token:e.slice(n,v)}),n=v;continue}let E=ii(e,n);if(E>n){n=E;continue}let A=e.charCodeAt(n+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;n++}return i}function oi(e){let t=0,i=0,n=0,a=!1,l=null;while(n<e.length){if(a){let j=e[n];if(l){if(j===l)l=null}else if(j==='"'||j==="'")l=j;else if(j===">")a=!1;n++;continue}let c=e.indexOf("<",n),b=c===-1?e.length:c;while(n<b){let j=e[n++];if(j==="{")t++;else if(j==="}")i++;if(t>=2&&i>=2)return!0}if(c===-1)break;let v=ii(e,c);if(v>c){n=v;continue}let E=e.charCodeAt(c+1),A=E===47?e.charCodeAt(c+2):E;if(A>=65&&A<=90||A>=97&&A<=122)a=!0;n=c+1}return!1}function Oc(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var Ba=1024,Wa=16777216,jt=new Map,$s=0;function Fa(e,t){jt.set(e,t),$s+=e.length+t.output.length;for(let[i,n]of jt){if($s<=Wa)break;jt.delete(i),$s-=i.length+n.output.length}}function fe(e,t,i,n){let a=n!==void 0&&e.length>=Ba,l=a?`${n}\x00${e}`:"";if(a){let A=jt.get(l);if(A)return jt.delete(l),jt.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let c=y(e,t);if(c.length===0)return{output:e,tokens:[]};let b=c.map((A)=>A.token),v="",E=0;for(let A=0;A<c.length;A++){let j=c[A];v+=e.slice(E,j.start),v+=i(j.token,A),E=j.end}if(v+=e.slice(E),a)return Fa(l,{output:v,tokens:b}),{output:v,tokens:b.slice()};return{output:v,tokens:b}}var Va=1024,Ua=16777216,zt=new Map,vs=0;function Ha(e,t){zt.set(e,t),vs+=e.length+t.output.length;for(let[i,n]of zt){if(vs<=Ua)break;zt.delete(i),vs-=i.length+n.output.length}}function Es(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:xr(n,i)}}function J(e){let t=e.length>=Va;if(t){let a=zt.get(e);if(a)return zt.delete(e),zt.set(e,a),Es(e,a.output,a.scripts.slice())}let{output:i,tokens:n}=fe(e,q,(a,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return Ha(e,{output:i,scripts:n}),Es(e,i,n.slice());return Es(e,i,n)}function xr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,n)=>t[+n]??"")}var Fn="__stx_component_client_factories";function Vn(e){let t=e[Fn];return t instanceof Map?t:null}function qc(e){e[Fn]=new Map}function ks(e,t){let i=Vn(e);if(!i)return null;let n=qa("sha256").update(t).digest("hex").slice(0,16),a=i.get(n);if(a)a.instances++;else i.set(n,{body:t,instances:1});return n}function Kc(e,t){let i=Vn(t);if(!i?.size)return e;let n=new Map;for(let[A,j]of i)if(j.instances===1)n.set(A,j.body);let a=[];if(n.size>0){let A=[...n.keys()].map((O)=>JSON.stringify(O).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),j=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),F=j.exec(e);while(F!==null){let O=n.get(JSON.parse(F[1]));if(O!==void 0)a.push({start:F.index,end:F.index+F[0].length,replacement:`(${O})(${F[2]});`});F=j.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return ai(e,a);let b=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
209
209
  (function() {
210
210
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
211
211
  ${l.map(([A,j])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${j.body}; }
@@ -213,15 +213,15 @@ ${l.map(([A,j])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.str
213
213
  `)}
214
214
  })();
215
215
  </script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return y(e,(A,j)=>{if(v===void 0){if(E.lastIndex=j,E.test(A))v=j}return-1}),a.push({start:v??0,end:v??0,replacement:`${b}
216
- `}),ni(e,a)}function ni(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let i=Array(t.length*2+1),n=0,a=0;for(let l of t)i[a++]=e.slice(n,l.start),i[a++]=l.replacement,n=l.end;return i[a]=e.slice(n),i.join("")}function si(e){let t=Fn(e),i=new Map;if(t)for(let[n,a]of t)i.set(n,a.instances);return i}function ri(e,t){let i=Fn(e);if(!i)return[];let n=[];for(let[a,l]of i){let c=l.instances-(t.get(a)??0);if(c>0)n.push({body:l.body,count:c})}return n}function ii(e,t){for(let{body:i,count:n}of t)for(let a=0;a<n;a++)Ss(e,i)}function xe(e,t,i=2){let n=0,a=null;for(let l=t+i;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){n++;continue}if(c==="}"){if(n>0){n--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=i)return l}}return-1}import Ai from"fs";var oi=0,$s=new Map;function el(){oi=0,$s.clear()}function Vn(e,t){let i=oi++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return $s.set(n,{type:e,expression:t}),n}function tl(){let e={};for(let[t,i]of $s)e[t]={type:i.type,expression:i.expression};return e}function nl(e,t){let i=e;for(let[n,a]of t)i=i.split(n).join(a);return i}function vi(e){return e.includes("<!--__STX_")}var Va=/@(?=[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 Ua(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function _i(e){return e.replace(/\{{2,}/g,(t)=>Ua(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Va,"&#64;")}function Sr(e,t,i=!1){let{openTag:n,tail:a}=i?Ha(e,t):qa(e).at(t);return Ka(a,n,i)}function Ha(e,t){let i="",n=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;i+=e.slice(n,c)+"x",c=b+1,n=b+2}i+=e.slice(n,t);let a=-1,l=null;for(let c=0;c<i.length;c++){let b=i[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?i.slice(a+1):i}}var Un=null;function qa(e){if(Un&&Un.source===e)return Un.scanner;let t=Za(e);return Un={source:e,scanner:t},t}function Za(e){let t=0,i=-1,n=null,a=-1,l=(b,v)=>{let E=e[b];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let E=e.indexOf("-->",b+4);return E<0?e.length:E+3};return{at(b){if(b<t)t=0,i=-1,n=null,a=-1;let v={openTag:i,quote:n},E=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let B=xe(e,t);if(B<0)a=t;else if(B+2<=b){t=B+2;continue}else break}let O=c(t,v);if(O>=0){if(O>b){E=!0;break}t=O;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=a>=0?a:t,j={openTag:i,quote:n};for(let O=t;O<b;O++){let B=c(O,j);if(B>=0){if(B>b)return{openTag:-1,tail:""};O=B-1;continue}l(O,j)}if(j.openTag<0)return{openTag:-1,tail:""};let F="",P=j.openTag+1;for(let O=P;O<Math.min(b,A);O++){if(!e.startsWith("{{",O))continue;let B=xe(e,O);F+=e.slice(P,O)+"x",O=B+1,P=B+2}return F+=e.slice(P,b),{openTag:j.openTag,tail:F}}}}function Ka(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let a=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(a,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let c=e[n];if(c==='"'||c==="'"){let b=++n,v=e.indexOf(c,n);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};n=v+1}else{let b=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Si="unsafe:";var Xa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,Ja=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,Ga=/^data:(?:text\/html|application\/xhtml\+xml)/,Ya=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function Qa(e){return e.replace(Ya,"").toLowerCase()}function vs(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function Hn(e,t="navigable"){let i=Qa(e);if(Xa.test(i))return!0;return t==="navigable"?Ja.test(i):Ga.test(i)}function vr(e,t="navigable"){return Hn(e,t)?"unsafe:"+e:e}function ec(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return vs(t[1])}function $i(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),a=n.search(/[\s"'`/]/);return a===-1?"":n.slice(a)}function Ei(e,t,i=t){let n=ec(e);return n&&Hn(t,n)?"unsafe:"+i:i}function Pt(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=i[2].trim();return n&&a?{arrayExpr:a,itemVar:n}:null}function qn(e){let t=[],i=0,n="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c==="\\")l++;else if(c===n)n="";continue}if(c==="'"||c==='"'||c==="`")n=c;else if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Ri(e,t){let i=0;for(let n=0;n<e.length;n++){let a=e[n];if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===t&&i===0)return n}return-1}function Ci(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function St(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=Ri(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let a of qn(i.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){St(l,t);continue}let c=Ri(l,":");St(c===-1?l:l.slice(c+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let a of qn(i.slice(1,-1)))St(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function Y(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(n===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&Ci(v)===v.length-1)v=v.slice(1,-1);for(let E of qn(v))St(E,i);if(i.length>0)return i;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&Ci(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)St(c[2],i),St(c[1],i);else for(let b of qn(l))St(b,i)}return i}function N(e,t){let i=t instanceof Set?t:new Set(t);if(i.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(b))return!0;return!1}var Zn="__stx_client_loop_names";function st(e){let t=e?.[Zn];return Array.isArray(t)?t:[]}function Kn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(n)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=i.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var en={},Ti=new Map;function tc(e){let t=Ti.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),Ti.set(e,t)}return t.lastIndex=0,t}var Ws={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=n;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(i).forEach(([v,E])=>{b=b.replace(tc(v),()=>String(E))}),b},t:(e,t,i={})=>Ws.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=i)return a;if(i<=n.length)return n.substring(0,i);return a.substring(0,i-n.length)+n},date:(e,t,i="short",n="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return a.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(a)}catch{return String(e)}},currency:(e,t,i="USD",n="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(n,{style:"currency",currency:i}).format(a)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let a=Number(e);if(Number.isNaN(a))return i;let l=n||`${i}s`;return a===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let a=10**i;return Math.round(n*a)/a}};function bg(e,t){if(e in Ws)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);en[e]=t}function Qh(e){for(let[t,i]of Object.entries(e))bg(t,i)}function wg(){return{...Ws,...en}}function ey(){for(let e of Object.keys(en))delete en[e]}function Dt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let a="",l=0;for(;;){let c=e.indexOf(n,l);if(c===-1)break;let b=xe(e,c,i);if(b===-1)break;a+=e.slice(l,c)+t(e.slice(c,b+i),e.slice(c+i,b),c),l=b+i}return l===0?e:a+e.slice(l)}function nc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=Sr(e,t);if(!a||a.kind!=="attribute"||a.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===n)l++;return l%2===1}function p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W(e){return _i(p(e))}function sc(e){return e.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 rc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function ic(e,t){let i=rc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new ie(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,a;while((a=n.exec(i))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ie(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,i,n=!1,a=0){try{return oc(e,t,i,n,a)}catch(l){if(l instanceof ie)l.locate(e,t);throw l}}function oc(e,t,i,n,a){let l=Sr(e,t,n),c=W(i);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+a).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(A)))return A;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")ic(i,l.name);if(l.quote===null)c=sc(c);let v=vs(b);if(v&&l.valuePrefix.trim()===""&&Hn(i,v))return Si+c;return Ei($i(e,t),i,c)}function xn(e,t){let i=` ${e}="`;return Q(i,i.length,t,!0)}function Ni(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function ke(e,t){let{scripts:i}=J(e);for(let n of Ni(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Zc.test(n))return!0;if(Nr(n,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function vg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let a=n[1].toLowerCase(),l=new Set(Y(n[3]));if(l.size===0)continue;let c=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,E=e.length;for(let A=b.exec(e);A;A=b.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function Ii(e,t,i){let n=s(i);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function Oi(e,t){let i=["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"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,c=0;continue}if(l){if(A==="`"&&c===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){c++,E++,a+=" ";continue}if(A==="}"&&c>0){c--;continue}if(c>0){a+=A;continue}continue}a+=A}n=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function ac(e,t){let i=s(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function cc(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=s(e);for(let a of i)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(n))return!0;return!1}var Mi=new Set;function ji(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function lc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
- `,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)a++;return a%2===1}function Di(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!Mi.has(i))Mi.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<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 xi(e,t,i){let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=R(l,t);if(c===void 0)return ji(l)?Di(l.trim(),i):a;return c===null?"":String(c)}catch{return a}}),n=Dt(n,(a,l,c)=>{let b=l.trim();if(lc(n,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=R(l,t);if(v===void 0)return ji(b)?Di(b,i):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),n}function xg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(n,a)=>{try{let l=R(a,t);if(l===void 0)return n;return l===null?"":String(l)}catch{return n}}),i=Dt(i,(n,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return n;try{let b=R(a,t);if(b===void 0)return n;if(b===null)return"";let v=String(b);return Q(i,l,v,!0,n.length)}catch(b){if(b instanceof ie)throw b;return n}}),i}function ty(e,t,i={}){let{output:n,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let E=b[1],A=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(E))return c;if(i.skipServer&&/\bserver\b/.test(E))return c;let F=`<script${xg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return F+A+c.slice(v);return F+xi(A,t)+c.slice(v)});return xr(n,l)}function _(e,t,i){let n=e,a=(O,B)=>{let L=gn(O,B);if(L===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(O.slice(B,L))?-1:L},l=(O,B,L,H)=>{let G=L.length,{output:D,tokens:ee}=fe(O,B,(ne,te)=>H(G+te));return L.push(...ee),D},c=[];n=l(n,a,c,(O)=>`<!--__STX_STYLE_${O}__-->`);let b=[];n=l(n,q,b,(O)=>`<!--__STX_SCRIPT_EXPR_${O}__-->`);let v=t?.__stx_signals_gate===!0||ke(e),E=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...wi(Ni(b))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Dt(n,(O,B,L)=>{if(N(B,E))return O;try{let H=R(B,t,!1,(G)=>Es(G,O,i,e));return H!==void 0&&H!==null?String(H):""}catch(H){let G=H instanceof Error?H.message:String(H);return h("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${G}`,i,e,L,O)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(O,B,L)=>{if(N(B,E))return O;try{let H=R(B,t,!1,(G)=>Es(G,O,i,e));if(H===void 0&&t.__stx_buildMode==="compile")return Vn("raw",B.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(t.__stx_buildMode==="compile")return Vn("raw",B.trim());let G=H instanceof Error?H.message:String(H);return h("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${G}`,i,e,L,O)}}),n=l(n,q,b,(O)=>`<!--__STX_SCRIPT_EXPR_${O}__-->`),n=l(n,a,c,(O)=>`<!--__STX_STYLE_${O}__-->`);let j=v?vg(n):[],F=Kn(n).map((O)=>({...O,names:new Set(Y(`${O.binding} in __slot`))})),P=new Set(st(t));if(n=Dt(n,(O,B,L)=>{let H=B.trim();if(nc(n,L,B))return O;if(Ii(F,L,H))return O;if(N(H,P))return O;if(j.length>0&&Ii(j,L,H))return O;if(A.has(H))return O;let G=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=H.match(D)?.[1],te=ne&&((ne in t)||G.includes(ne)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,he=H.match(le),ue=he&&!G.includes(he[1])&&!(he[1]in t);if(/^__[A-Z_]+__$/.test(H))return"";if(N(H,E))return O;if(t.__stx_native_screen===!0&&ac(H,t))return O;let Ee;try{let Te=R(B,t,!1,(Ke)=>{Ee=Ke});if(v&&!Oi(H,t))return O;if(Ee)Es(Ee,O,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Te===void 0||cc(H,t)))return Vn("expr",H);if(Te===void 0||Te===null)return"";let We=String(Te);return Q(n,L,We,!1,O.length)}catch(Te){if(Te instanceof ie)throw Te;if(v&&!Oi(H,t))return O;if(ue)return O;let We=Te instanceof Error?Te.message:String(Te);return h("Expression",`Error evaluating: {{ ${H} }}: ${We}`,i,e,L,O)}}),b.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(O,B)=>b[Number(B)]??O);if(c.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(O,B)=>c[Number(B)]??O);return n}function Sg(e,t,i){if(!t.trim())return e;let n=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=en[c]||Ws[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(wg()).join(", ")}`);let v=[];if(a.startsWith(":")){let E=a.match(/^:([^|\s]+)/);if(E){let A=E[1].trim();try{let j=Number(A);v=[Number.isNaN(j)?A:j]}catch{v=[A]}a=a.substring(E[0].length).trim()}}else if(a.startsWith("(")){let E=1,A=1;while(E>0&&A<a.length){if(a[A]==="(")E++;if(a[A]===")")E--;A++}if(E===0){let j=a.substring(1,A-1).trim();if(j)try{if(j.startsWith("{")&&j.endsWith("}"))v=[R(`(${j})`,i,!0)];else{let F=[],P="",O=null,B=0,L=0,H=0,G=!1;for(let D=0;D<j.length;D++){let ee=j[D];if(G){P+=ee,G=!1;continue}if(ee==="\\"){P+=ee,G=!0;continue}if(O){if(P+=ee,ee===O)O=null;continue}if(ee==='"'||ee==="'"||ee==="`"){O=ee,P+=ee;continue}if(ee==="(")B++;else if(ee===")")B--;else if(ee==="[")L++;else if(ee==="]")L--;else if(ee==="{")H++;else if(ee==="}")H--;if(ee===","&&B===0&&L===0&&H===0){F.push(P),P="";continue}P+=ee}if(P)F.push(P);v=F.map((D)=>{let ee=D.trim();return R(ee,i,!0)})}}catch{v=[j]}a=a.substring(A).trim()}}try{n=b(n,i,...v)}catch(E){let A=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${c}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return n}function uc(e){let t=!1,i="",n=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],E=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,i=v;else if(v===i)t=!1,i="";continue}if(t&&i==="`"&&v==="$"&&E==="{"){let A=1;b+=2;while(b<e.length&&A>0){if(e[b]==="{")A++;else if(e[b]==="}")A--;if(A>0)b++}continue}if(t)continue;if(v==="(")n++;else if(v===")")n--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&n===0&&a===0&&l===0){if(E==="|"){b++;continue}if(E==="="){b++;continue}return b}}return-1}var Qt=new Set,fc=1000;function ny(){Qt.clear()}function Es(e,t,i,n){if(!X())return;let a=`${i}\x00${e.expression}`;if(Qt.has(a))return;if(Qt.size>=fc)Qt.clear();Qt.add(a);let l=i,c=n;try{if(i&&Ai.existsSync(i))c=Ai.readFileSync(i,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${i}:${c.slice(0,b).split(`
218
- `).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function R(e,t,i=!1,n){try{let a=e.trim(),l=uc(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=R(b,t,!0,n);return Sg(E,v,t)}let c=Ks(a);if(c!==null){n?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=pc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,a);throw a}}function pc(e,t){let i=null;for(let a of t){if(a===e)continue;let l=dc(e,a);if(i===null||l<i.dist)i={key:a,dist:l}}if(!i)return null;let n=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/n<=0.35)return i.key;return null}function dc(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,n]=e.length<t.length?[e,t]:[t,e],a=Array(i.length+1),l=Array(i.length+1);for(let c=0;c<=i.length;c++)a[c]=c;for(let c=1;c<=n.length;c++){l[0]=c;for(let b=1;b<=i.length;b++){let v=i[b-1]===n[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=i.length;b++)a[b]=l[b]}return a[i.length]}function ry(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import gc from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,a]of Object.entries(gc.env)){if(!n.startsWith(e)||a===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(a),i[n]=a}return t["import.meta.env"]=JSON.stringify(i),t}function Li(e,t=""){let i=`${e}${t}`,n=0;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);n=(n<<5)-n+l,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function zi(e,t,i={}){let{prefix:n="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=i;if(!e.trim())return"";let b=ks(e),v=[],E=new Map;if(l)for(let A of b){let j=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(j){let F=j[1],P=`${t}_${F}`;E.set(F,P)}}for(let A of b){let j=Bi(A,t,n,a,E,c);v.push(j)}return v.join(`
216
+ `}),ai(e,a)}function ai(e,t){if(t.length===0)return e;t.sort((l,c)=>l.start-c.start||l.end-c.end);let i=Array(t.length*2+1),n=0,a=0;for(let l of t)i[a++]=e.slice(n,l.start),i[a++]=l.replacement,n=l.end;return i[a]=e.slice(n),i.join("")}function $i(e){let t=Vn(e),i=new Map;if(t)for(let[n,a]of t)i.set(n,a.instances);return i}function Ei(e,t){let i=Vn(e);if(!i)return[];let n=[];for(let[a,l]of i){let c=l.instances-(t.get(a)??0);if(c>0)n.push({body:l.body,count:c})}return n}function ki(e,t){for(let{body:i,count:n}of t)for(let a=0;a<n;a++)ks(e,i)}function xe(e,t,i=2){let n=0,a=null;for(let l=t+i;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="{"){n++;continue}if(c==="}"){if(n>0){n--;continue}let b=0;while(e[l+b]==="}")b++;if(b>=i)return l}}return-1}import ji from"fs";var Ri=0,Rs=new Map;function tl(){Ri=0,Rs.clear()}function Un(e,t){let i=Ri++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return Rs.set(n,{type:e,expression:t}),n}function nl(){let e={};for(let[t,i]of Rs)e[t]={type:i.type,expression:i.expression};return e}function rl(e,t){let i=e;for(let[n,a]of t)i=i.split(n).join(a);return i}function xi(e){return e.includes("<!--__STX_")}var Za=/@(?=[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 Ka(e){return Array.from({length:e},()=>"&#123;").join("&#8288;")}function Ci(e){return e.replace(/\{{2,}/g,(t)=>Ka(t.length)).replace(/\{(?=!)/g,"&#123;&#8288;").replace(Za,"&#64;")}function kr(e,t,i=!1){let{openTag:n,tail:a}=i?Xa(e,t):Ja(e).at(t);return Ya(a,n,i)}function Xa(e,t){let i="",n=0;for(let c=0;c<t;c++){if(!e.startsWith("{{",c))continue;let b=xe(e,c);if(b<0||b+2>t)break;i+=e.slice(n,c)+"x",c=b+1,n=b+2}i+=e.slice(n,t);let a=-1,l=null;for(let c=0;c<i.length;c++){let b=i[c];if(l){if(b===l)l=null;continue}if(b==='"'||b==="'"){l=b;continue}if(b===">"){a=-1;continue}if(b==="<")a=c}return{openTag:a,tail:a>=0?i.slice(a+1):i}}var Hn=null;function Ja(e){if(Hn&&Hn.source===e)return Hn.scanner;let t=Ga(e);return Hn={source:e,scanner:t},t}function Ga(e){let t=0,i=-1,n=null,a=-1,l=(b,v)=>{let E=e[b];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=b},c=(b,v)=>{if(v.openTag>=0||!e.startsWith("<!--",b))return-1;let E=e.indexOf("-->",b+4);return E<0?e.length:E+3};return{at(b){if(b<t)t=0,i=-1,n=null,a=-1;let v={openTag:i,quote:n},E=!1;while(t<b){if(a<0&&e.startsWith("{{",t)){let B=xe(e,t);if(B<0)a=t;else if(B+2<=b){t=B+2;continue}else break}let P=c(t,v);if(P>=0){if(P>b){E=!0;break}t=P;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=a>=0?a:t,j={openTag:i,quote:n};for(let P=t;P<b;P++){let B=c(P,j);if(B>=0){if(B>b)return{openTag:-1,tail:""};P=B-1;continue}l(P,j)}if(j.openTag<0)return{openTag:-1,tail:""};let F="",O=j.openTag+1;for(let P=O;P<Math.min(b,A);P++){if(!e.startsWith("{{",P))continue;let B=xe(e,P);F+=e.slice(O,P)+"x",P=B+1,O=B+2}return F+=e.slice(O,b),{openTag:j.openTag,tail:F}}}}function Ya(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let a=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(a,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let c=e[n];if(c==='"'||c==="'"){let b=++n,v=e.indexOf(c,n);if(v===-1)return{kind:"attribute",name:l,quote:c,valuePrefix:e.slice(b)};n=v+1}else{let b=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(b)}}}return{kind:"tag"}}class ie extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Ai="unsafe:";var Qa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ec=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,tc=/^data:(?:text\/html|application\/xhtml\+xml)/,nc=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function sc(e){return e.replace(nc,"").toLowerCase()}function Cs(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function qn(e,t="navigable"){let i=sc(e);if(Qa.test(i))return!0;return t==="navigable"?ec.test(i):tc.test(i)}function Sr(e,t="navigable"){return qn(e,t)?"unsafe:"+e:e}function rc(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return Cs(t[1])}function Ti(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),a=n.search(/[\s"'`/]/);return a===-1?"":n.slice(a)}function Pi(e,t,i=t){let n=rc(e);return n&&qn(t,n)?"unsafe:"+i:i}function It(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),c=e.slice(t+4).trim();return l&&c?{arrayExpr:l,itemVar:c}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),a=i[2].trim();return n&&a?{arrayExpr:a,itemVar:n}:null}function Zn(e){let t=[],i=0,n="",a=0;for(let l=0;l<e.length;l++){let c=e[l];if(n){if(c==="\\")l++;else if(c===n)n="";continue}if(c==="'"||c==='"'||c==="`")n=c;else if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(a,l)),a=l+1}return t.push(e.slice(a)),t}function Oi(e,t){let i=0;for(let n=0;n<e.length;n++){let a=e[n];if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===t&&i===0)return n}return-1}function Mi(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function St(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=Oi(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let a of Zn(i.slice(1,-1))){let l=a.trim();if(!l)continue;if(l.startsWith("...")){St(l,t);continue}let c=Oi(l,":");St(c===-1?l:l.slice(c+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let a of Zn(i.slice(1,-1)))St(a,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function Y(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let c=t[l];if(c==="("||c==="["||c==="{")n++;else if(c===")"||c==="]"||c==="}")n--;else if(n===0&&/\s/.test(c)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&Mi(v)===v.length-1)v=v.slice(1,-1);for(let E of Zn(v))St(E,i);if(i.length>0)return i;break}}let a=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(a){let l=a[1].trim();if(l.startsWith("(")&&Mi(l)===l.length-1)l=l.slice(1,-1);let c=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(c)St(c[2],i),St(c[1],i);else for(let b of Zn(l))St(b,i)}return i}function N(e,t){let i=t instanceof Set?t:new Set(t);if(i.size===0)return!1;let c=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let b of c.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(b))return!0;return!1}var Kn="__stx_client_loop_names";function st(e){let t=e?.[Kn];return Array.isArray(t)?t:[]}function Xn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let a of e.matchAll(n)){let l=a[0];if(/^<\/template\s*>$/i.test(l)){let c=i.pop();if(c)c.end=a.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let b=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(b?.[2]??b?.[3])?.trim();if(v&&b?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:a.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var nn={},Di=new Map;function ic(e){let t=Di.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),Di.set(e,t)}return t.lastIndex=0,t}var qs={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return W(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,a=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),c=n;for(let v of l){if(c===void 0||c===null)break;c=c[v]}if(c===void 0||c===null)return a?e:"";let b=String(c);return Object.entries(i).forEach(([v,E])=>{b=b.replace(ic(v),()=>String(E))}),b},t:(e,t,i={})=>qs.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let a=String(e);if(a.length<=i)return a;if(i<=n.length)return n.substring(0,i);return a.substring(0,i-n.length)+n},date:(e,t,i="short",n="en-US")=>{if(e===void 0||e===null)return"";try{let a=e instanceof Date?e:new Date(e);if(Number.isNaN(a.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return a.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(a)}catch{return String(e)}},currency:(e,t,i="USD",n="en-US")=>{if(e===void 0||e===null)return"";try{let a=Number(e);if(Number.isNaN(a))return String(e);return new Intl.NumberFormat(n,{style:"currency",currency:i}).format(a)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let a=Number(e);if(Number.isNaN(a))return i;let l=n||`${i}s`;return a===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let a=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(a,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let a=10**i;return Math.round(n*a)/a}};function wg(e,t){if(e in qs)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);nn[e]=t}function ey(e){for(let[t,i]of Object.entries(e))wg(t,i)}function vg(){return{...qs,...nn}}function ty(){for(let e of Object.keys(nn))delete nn[e]}function Lt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let a="",l=0;for(;;){let c=e.indexOf(n,l);if(c===-1)break;let b=xe(e,c,i);if(b===-1)break;a+=e.slice(l,c)+t(e.slice(c,b+i),e.slice(c+i,b),c),l=b+i}return l===0?e:a+e.slice(l)}function oc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=kr(e,t);if(!a||a.kind!=="attribute"||a.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(a.name))return!1;let l=0;for(let c=0;c<a.valuePrefix.length;c++)if(a.valuePrefix[c]==="\\")c++;else if(a.valuePrefix[c]===n)l++;return l%2===1}function p(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W(e){return Ci(p(e))}function ac(e){return e.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 cc(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function lc(e,t){let i=cc(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new ie(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,a;while((a=n.exec(i))!==null){let l=a[1].replace(/^["']|["']$/g,""),c=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),b=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!c&&!b)throw new ie(t,"CSS URLs must be local paths or base64 raster images")}}function Q(e,t,i,n=!1,a=0){try{return uc(e,t,i,n,a)}catch(l){if(l instanceof ie)l.locate(e,t);throw l}}function uc(e,t,i,n,a){let l=kr(e,t,n),c=W(i);if(!l)return c;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new ie("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+a).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||A.split(/\s+/).every((j)=>/^(?!on)[A-Za-z_:][\w:.-]*$/.test(j))))return A;throw new ie("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let b=l.name.toLowerCase();if(/^on[a-z]/.test(b))throw new ie(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(b==="srcdoc")c=W(c);if(b==="style")lc(i,l.name);if(l.quote===null)c=ac(c);let v=Cs(b);if(v&&l.valuePrefix.trim()===""&&qn(i,v))return Ai+c;return Pi(Ti(e,t),i,c)}function Sn(e,t){let i=` ${e}="`;return Q(i,i.length,t,!0)}function Fi(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function ke(e,t){let{scripts:i}=J(e);for(let n of Fi(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Qc.test(n))return!0;if(Mr(n,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function xg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let a=n[1].toLowerCase(),l=new Set(Y(n[3]));if(l.size===0)continue;let c=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:c,names:l});continue}let b=new RegExp(`<(/?)${a}\\b[^>]*?(/?)>`,"gi");b.lastIndex=c;let v=1,E=e.length;for(let A=b.exec(e);A;A=b.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function Ni(e,t,i){let n=s(i);for(let a of e){if(t<a.start||t>=a.end)continue;for(let l of a.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function Li(e,t){let i=["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"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),a="",l=!1,c=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,c=0;continue}if(l){if(A==="`"&&c===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){c++,E++,a+=" ";continue}if(A==="}"&&c>0){c--;continue}if(c>0){a+=A;continue}continue}a+=A}n=a;let b=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=b.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function fc(e,t){let i=s(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function pc(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=s(e);for(let a of i)if(new RegExp(`(?<![.#\\w$])${a}(?![\\w$])`).test(n))return!0;return!1}var zi=new Set;function Bi(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function dc(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let a=0;for(let l=e.lastIndexOf(`
217
+ `,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)a++;return a%2===1}function Wi(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!zi.has(i))zi.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<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 Si(e,t,i){let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>{try{let c=R(l,t);if(c===void 0)return Bi(l)?Wi(l.trim(),i):a;return c===null?"":String(c)}catch{return a}}),n=Lt(n,(a,l,c)=>{let b=l.trim();if(dc(n,c,l))return a;if(/^__[A-Z_]+__$/.test(b))return a;try{let v=R(l,t);if(v===void 0)return Bi(b)?Wi(b,i):a;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return a}}),n}function Sg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(n,a)=>{try{let l=R(a,t);if(l===void 0)return n;return l===null?"":String(l)}catch{return n}}),i=Lt(i,(n,a,l)=>{let c=a.trim();if(/^__[A-Z_]+__$/.test(c))return n;try{let b=R(a,t);if(b===void 0)return n;if(b===null)return"";let v=String(b);return Q(i,l,v,!0,n.length)}catch(b){if(b instanceof ie)throw b;return n}}),i}function ny(e,t,i={}){let{output:n,scripts:a}=J(e),l=a.map((c)=>{let b=c.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=c.search(/<\/script\s*>$/i);if(!b||v===-1)return c;let E=b[1],A=c.slice(b[0].length,v);if(/\bdata-raw\b/.test(E))return c;if(i.skipServer&&/\bserver\b/.test(E))return c;let F=`<script${Sg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return F+A+c.slice(v);return F+Si(A,t)+c.slice(v)});return xr(n,l)}function _(e,t,i){let n=e,a=(P,B)=>{let L=mn(P,B);if(L===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(P.slice(B,L))?-1:L},l=(P,B,L,H)=>{let G=L.length,{output:D,tokens:ee}=fe(P,B,(ne,te)=>H(G+te));return L.push(...ee),D},c=[];n=l(n,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let b=[];n=l(n,q,b,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`);let v=t?.__stx_signals_gate===!0||ke(e),E=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...vi(Fi(b))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Lt(n,(P,B,L)=>{if(N(B,E))return P;try{let H=R(B,t,!1,(G)=>As(G,P,i,e));return H!==void 0&&H!==null?String(H):""}catch(H){let G=H instanceof Error?H.message:String(H);return h("Expression",`Error evaluating: {{{ ${B.trim()}}}}: ${G}`,i,e,L,P)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(P,B,L)=>{if(N(B,E))return P;try{let H=R(B,t,!1,(G)=>As(G,P,i,e));if(H===void 0&&t.__stx_buildMode==="compile")return Un("raw",B.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(t.__stx_buildMode==="compile")return Un("raw",B.trim());let G=H instanceof Error?H.message:String(H);return h("Expression",`Error evaluating: {!! ${B.trim()} !!}: ${G}`,i,e,L,P)}}),n=l(n,q,b,(P)=>`<!--__STX_SCRIPT_EXPR_${P}__-->`),n=l(n,a,c,(P)=>`<!--__STX_STYLE_${P}__-->`);let j=v?xg(n):[],F=Xn(n).map((P)=>({...P,names:new Set(Y(`${P.binding} in __slot`))})),O=new Set(st(t));if(n=Lt(n,(P,B,L)=>{let H=B.trim();if(oc(n,L,B))return P;if(Ni(F,L,H))return P;if(N(H,O))return P;if(j.length>0&&Ni(j,L,H))return P;if(A.has(H))return P;let G=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],D=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,ne=H.match(D)?.[1],te=ne&&((ne in t)||G.includes(ne)),le=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,be=H.match(le),ue=be&&!G.includes(be[1])&&!(be[1]in t);if(/^__[A-Z_]+__$/.test(H))return"";if(N(H,E))return P;if(t.__stx_native_screen===!0&&fc(H,t))return P;let Ee;try{let Te=R(B,t,!1,(Ke)=>{Ee=Ke});if(v&&!Li(H,t))return P;if(Ee)As(Ee,P,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Te===void 0||pc(H,t)))return Un("expr",H);if(Te===void 0||Te===null)return"";let We=String(Te);return Q(n,L,We,!1,P.length)}catch(Te){if(Te instanceof ie)throw Te;if(v&&!Li(H,t))return P;if(ue)return P;let We=Te instanceof Error?Te.message:String(Te);return h("Expression",`Error evaluating: {{ ${H} }}: ${We}`,i,e,L,P)}}),b.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(P,B)=>b[Number(B)]??P);if(c.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(P,B)=>c[Number(B)]??P);return n}function kg(e,t,i){if(!t.trim())return e;let n=e,a=t.trim();while(a.length>0){let l=a.match(/^(\w+)/);if(!l)break;let c=l[1];a=a.substring(c.length).trim();let b=nn[c]||qs[c];if(!b)throw Error(`Filter not found: ${c}. Available filters: ${Object.keys(vg()).join(", ")}`);let v=[];if(a.startsWith(":")){let E=a.match(/^:([^|\s]+)/);if(E){let A=E[1].trim();try{let j=Number(A);v=[Number.isNaN(j)?A:j]}catch{v=[A]}a=a.substring(E[0].length).trim()}}else if(a.startsWith("(")){let E=1,A=1;while(E>0&&A<a.length){if(a[A]==="(")E++;if(a[A]===")")E--;A++}if(E===0){let j=a.substring(1,A-1).trim();if(j)try{if(j.startsWith("{")&&j.endsWith("}"))v=[R(`(${j})`,i,!0)];else{let F=[],O="",P=null,B=0,L=0,H=0,G=!1;for(let D=0;D<j.length;D++){let ee=j[D];if(G){O+=ee,G=!1;continue}if(ee==="\\"){O+=ee,G=!0;continue}if(P){if(O+=ee,ee===P)P=null;continue}if(ee==='"'||ee==="'"||ee==="`"){P=ee,O+=ee;continue}if(ee==="(")B++;else if(ee===")")B--;else if(ee==="[")L++;else if(ee==="]")L--;else if(ee==="{")H++;else if(ee==="}")H--;if(ee===","&&B===0&&L===0&&H===0){F.push(O),O="";continue}O+=ee}if(O)F.push(O);v=F.map((D)=>{let ee=D.trim();return R(ee,i,!0)})}}catch{v=[j]}a=a.substring(A).trim()}}try{n=b(n,i,...v)}catch(E){let A=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${c}': ${A}`)}if(a.startsWith("|"))a=a.substring(1).trim();else break}return n}function gc(e){let t=!1,i="",n=0,a=0,l=0,c=!1;for(let b=0;b<e.length;b++){let v=e[b],E=e[b+1];if(t&&c){c=!1;continue}if(t&&v==="\\"){c=!0;continue}if(c=!1,(v==='"'||v==="'"||v==="`")&&!c){if(!t)t=!0,i=v;else if(v===i)t=!1,i="";continue}if(t&&i==="`"&&v==="$"&&E==="{"){let A=1;b+=2;while(b<e.length&&A>0){if(e[b]==="{")A++;else if(e[b]==="}")A--;if(A>0)b++}continue}if(t)continue;if(v==="(")n++;else if(v===")")n--;else if(v==="[")a++;else if(v==="]")a--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&n===0&&a===0&&l===0){if(E==="|"){b++;continue}if(E==="="){b++;continue}return b}}return-1}var tn=new Set,mc=1000;function ry(){tn.clear()}function As(e,t,i,n){if(!X())return;let a=`${i}\x00${e.expression}`;if(tn.has(a))return;if(tn.size>=mc)tn.clear();tn.add(a);let l=i,c=n;try{if(i&&ji.existsSync(i))c=ji.readFileSync(i,"utf8")}catch{}let b=c.indexOf(t);if(b>=0)l=`${i}:${c.slice(0,b).split(`
218
+ `).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function R(e,t,i=!1,n){try{let a=e.trim(),l=gc(a);if(l>0){let b=a.substring(0,l).trim(),v=a.substring(l+1).trim(),E=R(b,t,!0,n);return kg(E,v,t)}let c=Xs(a);if(c!==null){n?.({expression:a,rule:c});return}try{let b=Object.keys(t),v=Object.values(t);return d(a,b)(...v)}catch{return u(a,t)}}catch(a){if(a instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(a.message);if(l){let c=l[1],b=hc(c,Object.keys(t));if(b&&b!==c)a.message=`${a.message} \u2014 did you mean '${b}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,a);throw a}}function hc(e,t){let i=null;for(let a of t){if(a===e)continue;let l=xc(e,a);if(i===null||l<i.dist)i={key:a,dist:l}}if(!i)return null;let n=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/n<=0.35)return i.key;return null}function xc(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,n]=e.length<t.length?[e,t]:[t,e],a=Array(i.length+1),l=Array(i.length+1);for(let c=0;c<=i.length;c++)a[c]=c;for(let c=1;c<=n.length;c++){l[0]=c;for(let b=1;b<=i.length;b++){let v=i[b-1]===n[c-1]?0:1;l[b]=Math.min(l[b-1]+1,a[b]+1,a[b-1]+v)}for(let b=0;b<=i.length;b++)a[b]=l[b]}return a[i.length]}function sy(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import bc from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,a]of Object.entries(bc.env)){if(!n.startsWith(e)||a===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(a),i[n]=a}return t["import.meta.env"]=JSON.stringify(i),t}function Vi(e,t=""){let i=`${e}${t}`,n=0;for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);n=(n<<5)-n+l,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Ui(e,t,i={}){let{prefix:n="",preserveHost:a=!0,scopeKeyframes:l=!0,scopeCustomProperties:c=!1}=i;if(!e.trim())return"";let b=Ts(e),v=[],E=new Map;if(l)for(let A of b){let j=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(j){let F=j[1],O=`${t}_${F}`;E.set(F,O)}}for(let A of b){let j=Hi(A,t,n,a,E,c);v.push(j)}return v.join(`
219
219
 
220
- `)}function ks(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,a="",l=!1,c="";for(let b=0;b<i.length;b++){let v=i[b];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,j,F]=E;if(A==="keyframes")t.push({selector:`@keyframes ${j.trim()}`,declarations:F.trim()});else if(A==="media"||A==="supports"||A==="container"){let P=ks(F);t.push({selector:`@${A} ${j.trim()}`,declarations:P.map((O)=>`${O.selector} { ${O.declarations} }`).join(`
221
- `)})}else t.push({selector:`@${A} ${j.trim()}`,declarations:F.trim()})}c="",l=!1}else if(a.trim()){a+=v;let E=a.match(/([^{]+)\{([^}]*)\}/);if(E)t.push({selector:E[1].trim(),declarations:E[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Bi(e,t,i,n,a,l){let{selector:c,declarations:b}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let A=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${b} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let j=ks(`x { ${b} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((F)=>Bi(F,t,i,n,a,l)).join(`
220
+ `)}function Ts(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,a="",l=!1,c="";for(let b=0;b<i.length;b++){let v=i[b];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){c+=v;let E=c.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,j,F]=E;if(A==="keyframes")t.push({selector:`@keyframes ${j.trim()}`,declarations:F.trim()});else if(A==="media"||A==="supports"||A==="container"){let O=Ts(F);t.push({selector:`@${A} ${j.trim()}`,declarations:O.map((P)=>`${P.selector} { ${P.declarations} }`).join(`
221
+ `)})}else t.push({selector:`@${A} ${j.trim()}`,declarations:F.trim()})}c="",l=!1}else if(a.trim()){a+=v;let E=a.match(/([^{]+)\{([^}]*)\}/);if(E)t.push({selector:E[1].trim(),declarations:E[2].trim()});a=""}continue}}if(l)c+=v;else a+=v}return t}function Hi(e,t,i,n,a,l){let{selector:c,declarations:b}=e;if(c.startsWith("@")){if(c.startsWith("@keyframes")){let A=c.replace("@keyframes ","").trim();return`@keyframes ${a.get(A)||A} { ${b} }`}if(c.startsWith("@media")||c.startsWith("@supports")||c.startsWith("@container")){let j=Ts(`x { ${b} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((F)=>Hi(F,t,i,n,a,l)).join(`
222
222
  `);return`${c} {
223
223
  ${j}
224
- }`}return`${c} { ${b} }`}let v=mc(c,t,i,n),E=b;for(let[A,j]of a)E=E.replace(new RegExp(`\\b${A}\\b`,"g"),j);if(l)E=E.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${E} }`}function mc(e,t,i,n){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(n)l.push(c);else{let E=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(E)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let b=i?`${i} .${t}`:`.${t}`;l.push(`${b} ${c}`);let v=hc(c,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function hc(e,t){let i=0,n=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")i++;else if(E==="]"||E===")")i--;else if(i===0&&(E===" "||E===">"||E==="+"||E==="~")){n=v;break}}let a=e.slice(0,n),l=e.slice(n);if(!a)return"";let c=a.length,b=0;for(let v=0;v<a.length;v++){let E=a[v];if(E==="["||E==="(")b++;else if(E==="]"||E===")")b--;else if(i===0&&b===0&&E===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var Vi=String.raw`(?<![\w-])scoped(?![\w-])`,Rs=/<style\s+([^>]*)>/gi,Wi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Ui=new RegExp(Vi,"i"),xc=new RegExp(Vi,"gi"),Cs=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function bc(e){Rs.lastIndex=0;let t=Rs.exec(e);while(t!==null){if(Ui.test(t[1]))return!0;t=Rs.exec(e)}return!1}function gi(e){let t=new Set,i=[];Cs.lastIndex=0;let n=Cs.exec(e);while(n!==null){let a=n[0].trim();if(t.has(a))i.push({start:n.index,end:n.index+n[0].length});else t.add(a);n=Cs.exec(e)}return i}function mn(e){let t=gi(e);if(t.length===0)return e;let i=Array(t.length+1),n=0;for(let a=0;a<t.length;a++){let l=t[a];i[a]=e.slice(n,l.start),n=l.end}return i[t.length]=e.slice(n),i.join("")}function Fs(e,t){if(!bc(e))return{html:e,hasScoped:!1};let i=Li(t),n=`data-v-${i}`,a=e,l=!1;if(Wi.lastIndex=0,a=a.replace(Wi,(c,b,v)=>{if(!Ui.test(b))return c;l=!0;let E=yc(v,n),A=b.replace(xc,"").trim(),j=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${j}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return a=wc(a,n),{html:a,hasScoped:!0}}function yc(e,t){return zi(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var _c=(e)=>`\x00stx-scope-mask-${e}\x00`,Fi=/\u0000stx-scope-mask-(\d+)\u0000/g;function wc(e,t){let i=fe(e,(a,l)=>{let c=q(a,l);return c>l?c:gn(a,l)},(a,l)=>_c(l)),n=Sc(i.output,t);return Fi.lastIndex=0,n.replace(Fi,(a,l)=>i.tokens[Number(l)])}function Sc(e,t){let i=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(n,a,l)=>{if(i.has(a.toLowerCase()))return n;if(n.includes(t))return n;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return n;if(l)return n.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(n.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var tn=/<\/?template\b[^>]*>/gi,$c=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function vc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return $c.test(t)}function pe(e){tn.lastIndex=0;let t;while((t=tn.exec(e))!==null){if(t[0].startsWith("</")||vc(t[0]))continue;let i=t.index,n=tn.lastIndex,a=1,l;while((l=tn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:i,openEnd:n,closeStart:c,end:tn.lastIndex,content:e.slice(n,c)}}}else a++;return null}return null}var Ec=0,kc=0;function Xn(e,t){let i=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let n of e.matchAll(i))if(n[1].toLowerCase()===t.toLowerCase())return n[2]??n[3]??n[4]??null;return null}function qi(e){let t=[],i=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return y(e,(n,a)=>{i.lastIndex=a;let l=i.exec(n);if(!l||!Xn(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:i.lastIndex}),i.lastIndex}),t}function Rc(e){let t=[];for(let{fullMatch:i,tagName:n,attributes:a,startIndex:l}of qi(e)){let c=Xn(a,"x-data");if(!c)continue;let b=`__stx_scope_${Ec++}`,v=Xn(a,"x-init"),E=Cc(e,n,l+i.length),A=e.slice(l,E.endIndex),j=Tc(A);t.push({id:b,selector:`[data-stx-scope="${b}"]`,stateExpr:c,initExpr:v,bindings:[],refs:j})}return t}function Cc(e,t,i){let n=1,a=i,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),b=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(n>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,b.lastIndex=a;let v=l.exec(e),E=c.exec(e),A=b.exec(e);if(A&&A.index<(v?.index??1/0)){a=A.index+A[0].length;continue}if(!E)return{endIndex:e.length};if(v&&v.index<E.index)n++,a=v.index+v[0].length;else{if(n--,n===0)return{endIndex:E.index+E[0].length};a=E.index+E[0].length}}return{endIndex:e.length}}function Tc(e){let t=new Map,i=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),n=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=n.exec(i))!==null){let[,l,c]=a,b=sl(l);t.set(c,b)}return t}function sl(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${kc++}`}function rl(){return`
224
+ }`}return`${c} { ${b} }`}let v=yc(c,t,i,n),E=b;for(let[A,j]of a)E=E.replace(new RegExp(`\\b${A}\\b`,"g"),j);if(l)E=E.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${E} }`}function yc(e,t,i,n){let a=e.split(",").map((c)=>c.trim()),l=[];for(let c of a){if(c.startsWith(":host")){if(n)l.push(c);else{let E=c.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(E)}continue}if(c.includes("::slotted")){l.push(c);continue}if(c===":root"){l.push(`:root .${t}`);continue}let b=i?`${i} .${t}`:`.${t}`;l.push(`${b} ${c}`);let v=_c(c,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function _c(e,t){let i=0,n=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")i++;else if(E==="]"||E===")")i--;else if(i===0&&(E===" "||E===">"||E==="+"||E==="~")){n=v;break}}let a=e.slice(0,n),l=e.slice(n);if(!a)return"";let c=a.length,b=0;for(let v=0;v<a.length;v++){let E=a[v];if(E==="["||E==="(")b++;else if(E==="]"||E===")")b--;else if(i===0&&b===0&&E===":"){c=v;break}}return`${a.slice(0,c)}.${t}${a.slice(c)}${l}`}var Ki=String.raw`(?<![\w-])scoped(?![\w-])`,Is=/<style\s+([^>]*)>/gi,qi=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Xi=new RegExp(Ki,"i"),wc=new RegExp(Ki,"gi"),Ps=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function Sc(e){Is.lastIndex=0;let t=Is.exec(e);while(t!==null){if(Xi.test(t[1]))return!0;t=Is.exec(e)}return!1}function mi(e){let t=new Set,i=[];Ps.lastIndex=0;let n=Ps.exec(e);while(n!==null){let a=n[0].trim();if(t.has(a))i.push({start:n.index,end:n.index+n[0].length});else t.add(a);n=Ps.exec(e)}return i}function hn(e){let t=mi(e);if(t.length===0)return e;let i=Array(t.length+1),n=0;for(let a=0;a<t.length;a++){let l=t[a];i[a]=e.slice(n,l.start),n=l.end}return i[t.length]=e.slice(n),i.join("")}function zs(e,t){if(!Sc(e))return{html:e,hasScoped:!1};let i=Vi(t),n=`data-v-${i}`,a=e,l=!1;if(qi.lastIndex=0,a=a.replace(qi,(c,b,v)=>{if(!Xi.test(b))return c;l=!0;let E=$c(v,n),A=b.replace(wc,"").trim(),j=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${j}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return a=Ec(a,n),{html:a,hasScoped:!0}}function $c(e,t){return Ui(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var vc=(e)=>`\x00stx-scope-mask-${e}\x00`,Zi=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ec(e,t){let i=fe(e,(a,l)=>{let c=q(a,l);return c>l?c:mn(a,l)},(a,l)=>vc(l)),n=kc(i.output,t);return Zi.lastIndex=0,n.replace(Zi,(a,l)=>i.tokens[Number(l)])}function kc(e,t){let i=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(n,a,l)=>{if(i.has(a.toLowerCase()))return n;if(n.includes(t))return n;if(a.toLowerCase()==="style"||a.toLowerCase()==="script")return n;if(l)return n.replace(`<${a}${l}`,`<${a} ${t}${l}`);if(n.endsWith("/>"))return`<${a} ${t} />`;return`<${a} ${t}>`})}var sn=/<\/?template\b[^>]*>/gi,Rc=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Cc(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return Rc.test(t)}function pe(e){sn.lastIndex=0;let t;while((t=sn.exec(e))!==null){if(t[0].startsWith("</")||Cc(t[0]))continue;let i=t.index,n=sn.lastIndex,a=1,l;while((l=sn.exec(e))!==null)if(l[0].startsWith("</")){if(a--,a===0){let c=l.index;return{start:i,openEnd:n,closeStart:c,end:sn.lastIndex,content:e.slice(n,c)}}}else a++;return null}return null}var Ac=0,Tc=0;function Jn(e,t){let i=/(?:^|\s)([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g;for(let n of e.matchAll(i))if(n[1].toLowerCase()===t.toLowerCase())return n[2]??n[3]??n[4]??null;return null}function Gi(e){let t=[],i=/<([a-z][a-z0-9-]*)\b((?:"[^"]*"|'[^']*'|[^>"'])*)>/iy;return y(e,(n,a)=>{i.lastIndex=a;let l=i.exec(n);if(!l||!Jn(l[2],"x-data"))return-1;return t.push({fullMatch:l[0],tagName:l[1],attributes:l[2],startIndex:a,endIndex:i.lastIndex}),i.lastIndex}),t}function sl(e){let t=[];for(let{fullMatch:i,tagName:n,attributes:a,startIndex:l}of Gi(e)){let c=Jn(a,"x-data");if(!c)continue;let b=`__stx_scope_${Ac++}`,v=Jn(a,"x-init"),E=il(e,n,l+i.length),A=e.slice(l,E.endIndex),j=ol(A);t.push({id:b,selector:`[data-stx-scope="${b}"]`,stateExpr:c,initExpr:v,bindings:[],refs:j})}return t}function il(e,t,i){let n=1,a=i,l=new RegExp(`<${t}(?:\\s|>)`,"gi"),c=new RegExp(`</${t}>`,"gi"),b=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(n>0&&a<e.length){l.lastIndex=a,c.lastIndex=a,b.lastIndex=a;let v=l.exec(e),E=c.exec(e),A=b.exec(e);if(A&&A.index<(v?.index??1/0)){a=A.index+A[0].length;continue}if(!E)return{endIndex:e.length};if(v&&v.index<E.index)n++,a=v.index+v[0].length;else{if(n--,n===0)return{endIndex:E.index+E[0].length};a=E.index+E[0].length}}return{endIndex:e.length}}function ol(e){let t=new Map,i=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),n=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,a;while((a=n.exec(i))!==null){let[,l,c]=a,b=al(l);t.set(c,b)}return t}function al(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${Tc++}`}function cl(){return`
225
225
  // STX Reactive Runtime - x-cloak and transition CSS
226
226
  (function() {
227
227
  var style = document.createElement('style');
@@ -493,7 +493,7 @@ window.__stx_reactive = (function() {
493
493
 
494
494
  return { initScope: initScope, reactive: reactive };
495
495
  })();
496
- `}function Hi(e,t){let i=e.replace(/\{!!([\s\S]*?)!!\}/g,(b,v)=>{try{let E=R(v,t,!0);if(E===void 0)return b;return String(E)}catch{return b}}),n="",a=0,l=null;while(a<i.length){let b=i[a];if(l&&b==="\\"){n+=b+(i[a+1]??""),a+=2;continue}if(b==="{"&&i[a+1]==="{"){let v=i.indexOf("}}",a+2);if(v!==-1){let E=i.slice(a,v+2);n+=c(i.slice(a+2,v),E,l),a=v+2;continue}}if(l){if(b===l)l=null}else if(b==="'"||b==='"'||b==="`")l=b;n+=b,a++}return n;function c(b,v,E){let A;try{A=R(b,t,!0)}catch{return v}if(A===void 0)return v;if(E){let j=String(A).replace(/\\/g,"\\\\").replace(new RegExp(E==="`"?"`":E,"g"),`\\${E}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return E==="`"?j.replace(/\$\{/g,"\\${"):j}if(typeof A==="string"){let j=A.trim();if(j.startsWith("{")&&j.endsWith("}")||j.startsWith("[")&&j.endsWith("]"))try{return JSON.parse(j),j}catch{}}return JSON.stringify(A)}}function il(e,t,i){if(e.length===0)return"";let n=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),c=Hi(a.stateExpr,t),b=a.initExpr?Hi(a.initExpr,t):null,v=JSON.stringify(c),E=b?JSON.stringify(b):"null";return`
496
+ `}function Ji(e,t){let i=e.replace(/\{!!([\s\S]*?)!!\}/g,(b,v)=>{try{let E=R(v,t,!0);if(E===void 0)return b;return String(E)}catch{return b}}),n="",a=0,l=null;while(a<i.length){let b=i[a];if(l&&b==="\\"){n+=b+(i[a+1]??""),a+=2;continue}if(b==="{"&&i[a+1]==="{"){let v=i.indexOf("}}",a+2);if(v!==-1){let E=i.slice(a,v+2);n+=c(i.slice(a+2,v),E,l),a=v+2;continue}}if(l){if(b===l)l=null}else if(b==="'"||b==='"'||b==="`")l=b;n+=b,a++}return n;function c(b,v,E){let A;try{A=R(b,t,!0)}catch{return v}if(A===void 0)return v;if(E){let j=String(A).replace(/\\/g,"\\\\").replace(new RegExp(E==="`"?"`":E,"g"),`\\${E}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return E==="`"?j.replace(/\$\{/g,"\\${"):j}if(typeof A==="string"){let j=A.trim();if(j.startsWith("{")&&j.endsWith("}")||j.startsWith("[")&&j.endsWith("]"))try{return JSON.parse(j),j}catch{}}return JSON.stringify(A)}}function ll(e,t,i){if(e.length===0)return"";let n=e.map((a)=>{let l=JSON.stringify(Object.fromEntries(a.refs)),c=Ji(a.stateExpr,t),b=a.initExpr?Ji(a.initExpr,t):null,v=JSON.stringify(c),E=b?JSON.stringify(b):"null";return`
497
497
  (function() {
498
498
  var scopeEl = document.querySelector('${a.selector}');
499
499
  if (!scopeEl) return;
@@ -502,10 +502,10 @@ window.__stx_reactive = (function() {
502
502
  })();`}).join(`
503
503
  `);return`
504
504
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
505
- ${rl()}
505
+ ${cl()}
506
506
  ${n}
507
- </script>`}function zc(e,t,i,n=!1){if(!As(e))return e;let a=Rc(e);if(a.length===0)return e;let l=ol(e,a),c=il(a,t,n),b=l.lastIndexOf("</body>");if(b!==-1)l=l.slice(0,b)+c+`
508
- `+l.slice(b);else l+=c;return l}function ol(e,t){let i=[],n=0;for(let[l,c]of qi(e).entries()){let b=t[l];if(!b)break;i.push(e.slice(n,c.startIndex));let v=Xn(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,i.push(c.fullMatch);else i.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);n=c.endIndex}i.push(e.slice(n));let a=i.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function As(e){return/x-data\s*=\s*["']/.test(e)}function Hs(e,t){let i=e,n=/@json\s*\(/g,a;while((a=n.exec(i))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,E=null,A=!1;while(v<i.length&&b>0){let D=i[v];if(A){A=!1,v++;continue}if(D==="\\"&&E){A=!0,v++;continue}if(E){if(D===E)E=null;v++;continue}if(D==='"'||D==="'"||D==="`"){E=D,v++;continue}if(D==="(")b++;else if(D===")"){if(b--,b===0)break}v++}if(b!==0)break;let j=i.substring(c+1,v).trim(),F=i.substring(l,v+1),P=-1,O=0,B=null,L=!1;for(let D=0;D<j.length;D++){let ee=j[D];if(L){L=!1;continue}if(ee==="\\"&&B){L=!0;continue}if(B){if(ee===B)B=null;continue}if(ee==='"'||ee==="'"||ee==="`"){B=ee;continue}if(ee==="("||ee==="["||ee==="{")O++;else if(ee===")"||ee==="]"||ee==="}")O--;if(ee===","&&O===0){P=D;break}}let H=P>=0?j.substring(0,P).trim():j,G=P>=0?j.substring(P+1).trim():void 0;try{let D=H.trim(),ee;if(f(D))ee=d(D,Object.keys(t))(...Object.values(t));else ee=void 0;let ne;if(G==="true")ne=JSON.stringify(ee,null,2);else ne=JSON.stringify(ee);let te=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+te+i.substring(v+1),n.lastIndex=l+te.length}catch(D){z.log(D instanceof Error?D:Error(String(D)),{directive:"@json"},"error"),n.lastIndex=l+F.length}}return i}function Vs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Hc(e){let t=e,i=/@memo\s*\(/g,n,a=[];while((n=i.exec(t))!==null){let l=n.index,c=l+n[0].length,b=1,v=c;while(v<t.length&&b>0){if(t[v]==="(")b++;else if(t[v]===")")b--;v++}if(b!==0)continue;let E=t.slice(c,v-1).trim(),A=v,j=t.slice(A),F=j.indexOf("@endmemo");if(F===-1)continue;let P=j.slice(0,F),O=A+F+8,B=P.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=B?B[0].length:0,H=P.slice(L),G=P.match(/(\s*)$/),D=G?G[0].length:0,ee=H.slice(0,H.length-D),ne=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),te;if(ne){let[le,he,ue="",Ee]=ne,Te=`<${he}${ue} data-stx-memo="${E}"${Ee}>`;te=P.slice(0,L)+Te+ee.slice(le.length)+P.slice(L+ee.length)}else te=`${P.slice(0,L)}<div data-stx-memo="${E}">${ee}</div>${P.slice(L+ee.length)}`;a.push({start:l,end:O,replacement:te}),i.lastIndex=O}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function mi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function Ji(e,t){let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=y(e,(b,v)=>{i.lastIndex=v;let E=i.exec(b);if(!E||/^(?:script|style)$/i.test(E[1]))return-1;return i.lastIndex}),a=[],l=0,c=[];for(let{start:b,end:v,token:E}of n){let A=/^<\/?([\w-]+)/.exec(E)[1].toLowerCase();if(E.startsWith("</")){while(a.length&&a.pop()!==A);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(E))c.push(e.slice(l,b),E.replace(/\s*\/?>$/,(j)=>` data-stx-slot-owner="${t}"${j}`)),l=v;if(!Ts.has(A)&&!/\/>$/.test(E))a.push(A)}return c.push(e.slice(l)),c.join("")}function Gi(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=y(e,(v,E)=>{i.lastIndex=E;let A=i.exec(v);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),a=[],l=0,c=0,b=[];for(let{start:v,end:E,token:A}of n){let j=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let B;while(B=a.pop()){if(B.scoped)l--;if(B.name===j)break}continue}let F=/\sdata-stx-scope\s*=/.test(A),P=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),O=a.find((B)=>B.scoped)?.scopeId;if(P&&O&&P[2]===O)b.push(e.slice(c,v),A.replace(P[0],` data-stx-ref-caller="${t}"`)),c=E;else if(!l&&!F&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))b.push(e.slice(c,v),A.replace(/\s*\/?>$/,(B)=>` data-stx-ref-caller="${t}"${B}`)),c=E;if(!Ts.has(j)&&!/\/>$/.test(A)){let B=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:j,scoped:F,scopeId:B?.[1]??B?.[2]}),F)l++}}return b.push(e.slice(c)),b.join("")}var Ts=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Yi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Zi=/<\/?\s*([a-z][\w-]*)/iy,al=/\s/;function cl(e,t){let i=t-1;while(i>=0&&al.test(e[i]))i--;return i>=0&&e[i]==="/"}function ll(e,t){let i=!1,n=!1;for(let a=t;a<e.length;a++){let l=e[a];if(i){if(l==="'")i=!1}else if(n){if(l==='"')n=!1}else if(l==="'")i=!0;else if(l==='"')n=!0;else if(l===">")return a}return-1}function ul(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,n=t,a=!1,l=!1,c=!1;while(n<e.length){let b=e.indexOf("<",n),v=b===-1?e.length:b;if(v>n){if(i===0)while(n<v){let j=e.indexOf(l?"}":"{",n);if(j===-1||j>=v){if(l)c=!1;else a=!1;break}if(j>n)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;n=j+1}n=v;continue}if(e.startsWith("<!--",n)){let j=e.indexOf("-->",n);n=j===-1?e.length:j+3;continue}let E=ll(e,n);if(E===-1)break;Zi.lastIndex=n;let A=Zi.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!cl(e,E)&&!Ts.has(A))i++;n=E+1}return!1}var Ki=w(256);function Vc(e){if(e.length<1024)return Xi(e);let t=S(e),i=Ki.get(t);if(i!==void 0)return i;let n=Xi(e);return Ki.set(t,n),n}function Xi(e){if(e.length>=32768&&!ti(e))return e;let i=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"),n="",a=0,l;while((l=i.exec(e))!==null){let c=l.index,b=c+l[0].length,v=!1,E=!1,A=-1;while(b<e.length){let F=e[b];if(v){if(F==="'")v=!1}else if(E){if(F==='"')E=!1}else if(F==="'")v=!0;else if(F==='"')E=!0;else if(F===">"){A=b;break}b++}if(A===-1)continue;let j=e.slice(c,A+1);if(Yi.test(j))continue;if(j.includes("x-cloak"))continue;if(ul(e,A+1))n+=e.slice(a,A)+" x-cloak>",a=A+1}return n+=e.slice(a),n}var dl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,gl=/<\/script>/gi,ml=/<\/style>/gi;function Uc(e){let t=/<[a-z][\w-]*/gi,i="",n=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let O=c==="script"?gl:ml;O.lastIndex=l;let B=O.exec(e);if(B!==null)t.lastIndex=B.index+B[0].length;continue}let b=l+a[0].length,v=!1,E=!1,A=-1;while(b<e.length){let O=e[b];if(v){if(O==="'")v=!1}else if(E){if(O==='"')E=!1}else if(O==="'")v=!0;else if(O==='"')E=!0;else if(O===">"){A=b;break}b++}if(A===-1)continue;let j=e.slice(l+a[0].length,A);if(Yi.test(j))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(j))continue;if(!dl.test(j))continue;let F=e[A-1]==="/",P=F?A-1:A;i+=`${e.slice(n,P)} x-cloak${F?" ":""}`,n=P}return i+=e.slice(n),i}import go from"path";import Xs from"fs";import nn from"path";function Qi(e,t,i,n){let a=0;for(let l=t;l<e.length;l++)if(e[l]===i)a++;else if(e[l]===n&&!(n===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function hl(e){let t=s(e),i=0,n=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)a.push(e.slice(n,l).trim()),n=l+1;return a.push(e.slice(n).trim()),a}function Ps(e,t){let i=s(e),n=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of i.matchAll(n)){let l=a.index+a[0].length,c="";if(i[l]==="<"){let v=Qi(i,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let b=Qi(i,l,"(",")");if(b>=0)return{type:c,args:hl(e.slice(l+1,b))}}return null}var eo=`
507
+ </script>`}function Hc(e,t,i,n=!1){if(!Js(e))return e;let a=sl(e);if(a.length===0)return e;let l=ul(e,a),c=ll(a,t,n),b=l.lastIndexOf("</body>");if(b!==-1)l=l.slice(0,b)+c+`
508
+ `+l.slice(b);else l+=c;return l}function ul(e,t){let i=[],n=0;for(let[l,c]of Gi(e).entries()){let b=t[l];if(!b)break;i.push(e.slice(n,c.startIndex));let v=Jn(c.attributes,"data-stx-scope");if(v)b.id=v,b.selector=`[data-stx-scope="${b.id}"]`,i.push(c.fullMatch);else i.push(`<${c.tagName} data-stx-scope="${b.id}"${c.attributes}>`);n=c.endIndex}i.push(e.slice(n));let a=i.join("");return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a=a.replace(/\s*x-destroy\s*=\s*"([^"]*)"/g,' data-stx-xdestroy="$1"'),a=a.replace(/\s*x-destroy\s*=\s*'([^']*)'/g," data-stx-xdestroy='$1'"),a}function Js(e){return/x-data\s*=\s*["']/.test(e)}function Vs(e,t){let i=e,n=/@json\s*\(/g,a;while((a=n.exec(i))!==null){let l=a.index,c=l+a[0].length-1,b=1,v=c+1,E=null,A=!1;while(v<i.length&&b>0){let D=i[v];if(A){A=!1,v++;continue}if(D==="\\"&&E){A=!0,v++;continue}if(E){if(D===E)E=null;v++;continue}if(D==='"'||D==="'"||D==="`"){E=D,v++;continue}if(D==="(")b++;else if(D===")"){if(b--,b===0)break}v++}if(b!==0)break;let j=i.substring(c+1,v).trim(),F=i.substring(l,v+1),O=-1,P=0,B=null,L=!1;for(let D=0;D<j.length;D++){let ee=j[D];if(L){L=!1;continue}if(ee==="\\"&&B){L=!0;continue}if(B){if(ee===B)B=null;continue}if(ee==='"'||ee==="'"||ee==="`"){B=ee;continue}if(ee==="("||ee==="["||ee==="{")P++;else if(ee===")"||ee==="]"||ee==="}")P--;if(ee===","&&P===0){O=D;break}}let H=O>=0?j.substring(0,O).trim():j,G=O>=0?j.substring(O+1).trim():void 0;try{let D=H.trim(),ee;if(f(D))ee=d(D,Object.keys(t))(...Object.values(t));else ee=void 0;let ne;if(G==="true")ne=JSON.stringify(ee,null,2);else ne=JSON.stringify(ee);let te=ne.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+te+i.substring(v+1),n.lastIndex=l+te.length}catch(D){z.log(D instanceof Error?D:Error(String(D)),{directive:"@json"},"error"),n.lastIndex=l+F.length}}return i}function Us(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Vc(e){let t=e,i=/@memo\s*\(/g,n,a=[];while((n=i.exec(t))!==null){let l=n.index,c=l+n[0].length,b=1,v=c;while(v<t.length&&b>0){if(t[v]==="(")b++;else if(t[v]===")")b--;v++}if(b!==0)continue;let E=t.slice(c,v-1).trim(),A=v,j=t.slice(A),F=j.indexOf("@endmemo");if(F===-1)continue;let O=j.slice(0,F),P=A+F+8,B=Pt(O),L=O.slice(B),H=O.match(/(\s*)$/),G=H?H[0].length:0,D=L.slice(0,L.length-G),ee=D.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),ne;if(ee){let[te,le,be="",ue]=ee,Ee=`<${le}${be} data-stx-memo="${E}"${ue}>`;ne=O.slice(0,B)+Ee+D.slice(te.length)+O.slice(B+D.length)}else ne=`${O.slice(0,B)}<div data-stx-memo="${E}">${D}</div>${O.slice(B+D.length)}`;a.push({start:l,end:P,replacement:ne}),i.lastIndex=P}for(let l=a.length-1;l>=0;l--){let c=a[l];t=t.slice(0,c.start)+c.replacement+t.slice(c.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function hi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function to(e,t){let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=y(e,(b,v)=>{i.lastIndex=v;let E=i.exec(b);if(!E||/^(?:script|style)$/i.test(E[1]))return-1;return i.lastIndex}),a=[],l=0,c=[];for(let{start:b,end:v,token:E}of n){let A=/^<\/?([\w-]+)/.exec(E)[1].toLowerCase();if(E.startsWith("</")){while(a.length&&a.pop()!==A);continue}if(!a.length&&!/\sdata-stx-slot-owner\s*=/.test(E))c.push(e.slice(l,b),E.replace(/\s*\/?>$/,(j)=>` data-stx-slot-owner="${t}"${j}`)),l=v;if(!Gs.has(A)&&!/\/>$/.test(E))a.push(A)}return c.push(e.slice(l)),c.join("")}function no(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=y(e,(v,E)=>{i.lastIndex=E;let A=i.exec(v);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),a=[],l=0,c=0,b=[];for(let{start:v,end:E,token:A}of n){let j=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let B;while(B=a.pop()){if(B.scoped)l--;if(B.name===j)break}continue}let F=/\sdata-stx-scope\s*=/.test(A),O=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),P=a.find((B)=>B.scoped)?.scopeId;if(O&&P&&O[2]===P)b.push(e.slice(c,v),A.replace(O[0],` data-stx-ref-caller="${t}"`)),c=E;else if(!l&&!F&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))b.push(e.slice(c,v),A.replace(/\s*\/?>$/,(B)=>` data-stx-ref-caller="${t}"${B}`)),c=E;if(!Gs.has(j)&&!/\/>$/.test(A)){let B=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(a.push({name:j,scoped:F,scopeId:B?.[1]??B?.[2]}),F)l++}}return b.push(e.slice(c)),b.join("")}var Gs=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),so=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Yi=/<\/?\s*([a-z][\w-]*)/iy,pl=/\s/;function dl(e,t){let i=t-1;while(i>=0&&pl.test(e[i]))i--;return i>=0&&e[i]==="/"}function ml(e,t){let i=!1,n=!1;for(let a=t;a<e.length;a++){let l=e[a];if(i){if(l==="'")i=!1}else if(n){if(l==='"')n=!1}else if(l==="'")i=!0;else if(l==='"')n=!0;else if(l===">")return a}return-1}function hl(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,n=t,a=!1,l=!1,c=!1;while(n<e.length){let b=e.indexOf("<",n),v=b===-1?e.length:b;if(v>n){if(i===0)while(n<v){let j=e.indexOf(l?"}":"{",n);if(j===-1||j>=v){if(l)c=!1;else a=!1;break}if(j>n)if(l)c=!1;else a=!1;if(l){if(c)return!0;c=!0}else if(a)l=!0,c=!1;else a=!0;n=j+1}n=v;continue}if(e.startsWith("<!--",n)){let j=e.indexOf("-->",n);n=j===-1?e.length:j+3;continue}let E=ml(e,n);if(E===-1)break;Yi.lastIndex=n;let A=Yi.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!dl(e,E)&&!Gs.has(A))i++;n=E+1}return!1}var Qi=w(256);function Uc(e){if(e.length<1024)return eo(e);let t=S(e),i=Qi.get(t);if(i!==void 0)return i;let n=eo(e);return Qi.set(t,n),n}function eo(e){if(e.length>=32768&&!oi(e))return e;let i=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"),n="",a=0,l;while((l=i.exec(e))!==null){let c=l.index,b=c+l[0].length,v=!1,E=!1,A=-1;while(b<e.length){let F=e[b];if(v){if(F==="'")v=!1}else if(E){if(F==='"')E=!1}else if(F==="'")v=!0;else if(F==='"')E=!0;else if(F===">"){A=b;break}b++}if(A===-1)continue;let j=e.slice(c,A+1);if(so.test(j))continue;if(j.includes("x-cloak"))continue;if(hl(e,A+1))n+=e.slice(a,A)+" x-cloak>",a=A+1}return n+=e.slice(a),n}var xl=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,bl=/<\/script>/gi,yl=/<\/style>/gi;function Wc(e){let t=/<[a-z][\w-]*/gi,i="",n=0,a;while((a=t.exec(e))!==null){let l=a.index,c=a[0].slice(1).toLowerCase();if(c==="script"||c==="style"){let P=c==="script"?bl:yl;P.lastIndex=l;let B=P.exec(e);if(B!==null)t.lastIndex=B.index+B[0].length;continue}let b=l+a[0].length,v=!1,E=!1,A=-1;while(b<e.length){let P=e[b];if(v){if(P==="'")v=!1}else if(E){if(P==='"')E=!1}else if(P==="'")v=!0;else if(P==='"')E=!0;else if(P===">"){A=b;break}b++}if(A===-1)continue;let j=e.slice(l+a[0].length,A);if(so.test(j))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(j))continue;if(!xl.test(j))continue;let F=e[A-1]==="/",O=F?A-1:A;i+=`${e.slice(n,O)} x-cloak${F?" ":""}`,n=O}return i+=e.slice(n),i}import yo from"path";import er from"fs";import rn from"path";function ro(e,t,i,n){let a=0;for(let l=t;l<e.length;l++)if(e[l]===i)a++;else if(e[l]===n&&!(n===">"&&e[l-1]==="=")){if(--a===0)return l}return-1}function _l(e){let t=s(e),i=0,n=0,a=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)a.push(e.slice(n,l).trim()),n=l+1;return a.push(e.slice(n).trim()),a}function Ys(e,t){let i=s(e),n=new RegExp(`\\b(?:${t.map((a)=>a.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let a of i.matchAll(n)){let l=a.index+a[0].length,c="";if(i[l]==="<"){let v=ro(i,l,"<",">");if(v<0)continue;c=e.slice(l+1,v),l=v+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let b=ro(i,l,"(",")");if(b>=0)return{type:c,args:_l(e.slice(l+1,b))}}return null}var io=`
509
509
  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;
510
510
  type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
511
511
  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>;
@@ -513,78 +513,78 @@ type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K
513
513
  type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
514
514
  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]> };
515
515
  type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
516
- `;function to(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=s(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(F,P,O,B,L)=>{if(a.slice(L,L+6)!=="import")return F;if(B.endsWith(".stx"))return"";let H=`${t}Import${i.length}`;if(i.push(`import * as ${H} from ${JSON.stringify(B)};`),P.startsWith("*"))return`import ${P.replace(/^\*\s+as\s+/,"")} = ${H};`;if(!P.startsWith("{"))return`import ${P} = ${H}.default;`;return P.slice(1,-1).split(",").map((G)=>{let[D,ee=D]=G.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!D)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&D in n)n[D].push(ee);return`import ${ee} = ${H}.${D};`}).join(`
517
- `)}),c=Ps(e,n.defineProps),b=Ps(e,n.defineEmits),v=Ps(e,n.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let E=[],A=null,j=null;if(c){E.push(`const __options = (${c.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let F=c.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${F}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(b)E.push(`const __events = (${b.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${b.type||"Record<(typeof __events)[number], any[]>"};`),j=`${t}.__StxEvents`;return{declarations:`${i.join(`
516
+ `;function oo(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},a=s(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(F,O,P,B,L)=>{if(a.slice(L,L+6)!=="import")return F;if(B.endsWith(".stx"))return"";let H=`${t}Import${i.length}`;if(i.push(`import * as ${H} from ${JSON.stringify(B)};`),O.startsWith("*"))return`import ${O.replace(/^\*\s+as\s+/,"")} = ${H};`;if(!O.startsWith("{"))return`import ${O} = ${H}.default;`;return O.slice(1,-1).split(",").map((G)=>{let[D,ee=D]=G.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!D)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(B)&&D in n)n[D].push(ee);return`import ${ee} = ${H}.${D};`}).join(`
517
+ `)}),c=Ys(e,n.defineProps),b=Ys(e,n.defineEmits),v=Ys(e,n.withDefaults);if(!c&&!b)return{declarations:"",props:null,events:null};let E=[],A=null,j=null;if(c){E.push(`const __options = (${c.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let F=c.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${F}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(b)E.push(`const __events = (${b.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${b.type||"Record<(typeof __events)[number], any[]>"};`),j=`${t}.__StxEvents`;return{declarations:`${i.join(`
518
518
  `)}
519
519
  namespace ${t} {
520
520
  ${l}
521
521
  ${E.join(`
522
522
  `)}
523
- }`,props:A,events:j}}var kr=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 _r(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...kr].some((t)=>t.toLowerCase()===e.toLowerCase());return kr.has(e)||/[A-Z]/.test(e)}function*xl(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let n=t.lastIndex,a=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!l){n++;continue}let c=n;n+=l.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let b=e[n],v=b==="{",E=b==='"'||b==="'";if(E||v)n++;let A=n;if(v){let j=s(e.slice(n)),F=1,P=0;for(;P<j.length;P++){if(j[P]==="{")F++;if(j[P]==="}"&&--F===0)break}n+=P}else if(E)while(n<e.length&&e[n]!==b)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(a.push({name:l,value:e.slice(A,n),offset:A,braced:v}),E||v)n++}t.lastIndex=n,yield{name:i[1],offset:i.index,attributes:a}}}function no(e,t,i){let n=[],a=[eo,"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 __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,b=new Map,v=i.scriptCode(e,i.filePath),E=s(v);for(let O of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(O.index,O.index+6)!=="import")continue;let B=O[2],L=nn.isAbsolute(B)||B.startsWith(".")?nn.resolve(nn.dirname(i.filePath),B):Ns(B,nn.dirname(i.filePath));if(!L)continue;let H=L.endsWith(".stx")?L:Xs.existsSync(`${L}.stx`)?`${L}.stx`:void 0,G=H?null:br(L,!1),D=O[1].startsWith("{")?O[1].slice(1,-1).split(","):[O[1]];for(let ee of D){let[ne,te=ne]=ee.trim().split(/\s+as\s+/),le=H||G?.get(ne)||G?.get(ne.toLowerCase());if(le)b.set(te,le),b.set(te.toLowerCase(),le),b.set(te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),le)}}for(let O of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of O[1].matchAll(/['"]([^'"]+)['"]/g)){let L=Ms(B[1],i.filePath,i).find((H)=>Xs.statSync(H,{throwIfNoEntry:!1})?.isFile());if(L)b.set(nn.basename(B[1]).replace(/\.stx$/,""),L)}let A={__importedComponents:b},j=new Map,F=(O,B,L)=>{let H=e.slice(0,O);return{code:B,offset:O,attribute:L,anchor:!0,kind:"directive",line:H.split(`
524
- `).length,column:O-H.lastIndexOf(`
525
- `)}},P=(O,B,L)=>n.push({expression:O,statement:{text:B+O.code+L,prefixLength:B.length}});for(let O of xl(t)){if(_r(O.name)||O.name==="component")continue;let B=Pr(O.name,i.filePath,i,A);if(!B)continue;let L=j.get(B);if(!L){let G;try{G=i.readComponent?i.readComponent(B):Xs.readFileSync(B,"utf8")}catch{continue}if(G===void 0)continue;c.set(B,G),L=to(i.scriptCode(G,B),`__StxComponent${j.size}`),j.set(B,L),a.push(L.declarations)}let H=[];for(let G of O.attributes){let{name:D,offset:ee}=G,ne=G.value===!0?"true":G.value;if(D.startsWith("@")||D.startsWith("v-on:")){if(L.events&&G.value!==!0)l.set(ee,`__StxEvent<${L.events}, ${JSON.stringify(D.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let te=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(D);if(D.startsWith("v-")&&!D.startsWith("v-bind:")&&!te)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(D))continue;let le=(te?te[1]||"modelValue":D.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,We)=>We.toUpperCase());if(H.push(le),!L.props)continue;let he=D.startsWith(":")||D.startsWith("v-bind:")||!!te||G.braced,ue=he?ne:G.value!==!0?JSON.stringify(ne):"true",Ee=!he&&G.value!==!0&&(ne==="true"||ne==="false");P(F(ee,ue,D),";void ((",`) satisfies ${Ee?"__StxStaticProp":"__StxProp"}<${L.props}, ${JSON.stringify(le)}>);`)}if(L.props){let G=[...new Set(H)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),D=F(O.offset,`<${O.name}>`);n.push({expression:D,statement:{text:`;void ({ ${G} } satisfies ${L.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:j.size?a.join(`
526
- `):"",checks:n,events:l,dependencies:c}}var so=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function bl(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function It(e){let t=[],i=bl(e);so.lastIndex=0;let n;while((n=so.exec(i))!==null){let a=(n[1]||"").trim(),l=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,b=n.index+l,v=n.index+n[0].length-c,E=e.slice(b,v);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let j=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",F=sn(e,b);t.push({kind:j,code:E,startLine:F,startColumn:rn(e,b),offset:b,attrs:a})}return t}function sn(e,t){let i=1;for(let n=0;n<t&&n<e.length;n++)if(e.charCodeAt(n)===10)i++;return i}function rn(e,t){let i=e.lastIndexOf(`
527
- `,t-1)+1;return t-i+1}function Jn(e){let t=e.split(""),i=(a,l)=>{for(let c=a;c<l&&c<t.length;c++)if(t[c]!==`
528
- `)t[c]=" "},n=[/<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 a of n){a.lastIndex=0;let l;while((l=a.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function mo(e){let t=0,i="";for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i="";continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var ho=new Set([":for","x-for","v-for"]),Gn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,Js="__stx_interpolated",ro="__StxElement",xo="__StxTemplateValue",yl=`type ${xo}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function io(e){return e.replace(/\{\{[\s\S]*?\}\}/g,Js).replace(/\{!![\s\S]*?!!\}/g,Js)}function _l(e,t,i){let n=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){n++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,a)&&n===0)return a;if(l==="}"&&n>0)n--}return-1}function ui(e,t,i="0"){let n=`__stxScript${i}`;while((e+t).includes(n))n+="_";let a=new Map,l=[],c=[],b=s(e),v=So(e),E=[],A=0;for(let L=0;L<b.length;L++){let H=b.startsWith("{{",L);if(!H&&!b.startsWith("{!!",L))continue;let G=H?2:3,D=H?"}}":"!!}",ee=_l(b,L+G,D);if(ee<0)continue;let ne=L,te=e.slice(ne,ee+D.length),le=te.slice(G,-D.length);L=ee+D.length-1;let he=c.length,ue=Qs(v,ne),Ee=Qs(v,ne+(H?2:3));c.push({code:mo(le),...Ee});let Te=`${n}_${he}`,We=te.split(`
529
- `),Ke=We[0].length;We[0]=Te+" ".repeat(Math.max(0,Ke-Te.length));for(let Je=1;Je<We.length;Je++)We[Je]=We[Je].replace(/[^\r]/g," ");let Qe=a.get(ue.line)??[],Xe=Qe.at(-1),tt=ue.column+(Xe?Xe.generatedEnd-Xe.sourceEnd:0);Qe.push({sourceStart:ue.column,sourceEnd:ue.column+Ke,generatedStart:tt,generatedEnd:tt+We[0].length}),a.set(ue.line,Qe),E.push(e.slice(A,ne),We.join(`
530
- `)),A=ne+te.length}E.push(e.slice(A));let j=E.join("");if(!c.length)return{code:j,columns:a,declarations:l};let{imports:F,body:P}=yo(t),O=[],B=0;for(let L of F.split(/\n(?=import\b)/)){if(!L.trim())continue;let H=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(L);if(!H){l.push({text:L});continue}let G=`${n}Module${B++}`;l.push({text:`import * as ${G} from ${H[2]}`});let D=H[1],ee=/\{([\s\S]*?)\}/.exec(D);for(let he of ee?.[1].split(",")??[]){let[ue,Ee=ue]=he.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(ue==="default")O.push(`const ${Ee} = ${G}.default; type ${Ee} = import(${H[2]}).default`);else if(ue)O.push(`import ${Ee} = ${G}.${ue}`)}let ne=D.replace(/\{[\s\S]*?\}/,""),te=/\*\s+as\s+(\w+)/.exec(ne);if(te)O.push(`import ${te[1]} = ${G}`);let le=/^\s*([\w$]+)/.exec(ne)?.[1];if(le)O.push(`const ${le} = ${G}.default; type ${le} = import(${H[2]}).default`)}l.push({text:`namespace ${n}Scope {
531
- ${O.join(`
523
+ }`,props:A,events:j}}var _r=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 Cr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[..._r].some((t)=>t.toLowerCase()===e.toLowerCase());return _r.has(e)||/[A-Z]/.test(e)}function*wl(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let n=t.lastIndex,a=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!l){n++;continue}let c=n;n+=l.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){a.push({name:l,value:!0,offset:c,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let b=e[n],v=b==="{",E=b==='"'||b==="'";if(E||v)n++;let A=n;if(v){let j=s(e.slice(n)),F=1,O=0;for(;O<j.length;O++){if(j[O]==="{")F++;if(j[O]==="}"&&--F===0)break}n+=O}else if(E)while(n<e.length&&e[n]!==b)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(a.push({name:l,value:e.slice(A,n),offset:A,braced:v}),E||v)n++}t.lastIndex=n,yield{name:i[1],offset:i.index,attributes:a}}}function ao(e,t,i){let n=[],a=[io,"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 __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,c=new Map,b=new Map,v=i.scriptCode(e,i.filePath),E=s(v);for(let P of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(P.index,P.index+6)!=="import")continue;let B=P[2],L=rn.isAbsolute(B)||B.startsWith(".")?rn.resolve(rn.dirname(i.filePath),B):Ms(B,rn.dirname(i.filePath));if(!L)continue;let H=L.endsWith(".stx")?L:er.existsSync(`${L}.stx`)?`${L}.stx`:void 0,G=H?null:wr(L,!1),D=P[1].startsWith("{")?P[1].slice(1,-1).split(","):[P[1]];for(let ee of D){let[ne,te=ne]=ee.trim().split(/\s+as\s+/),le=H||G?.get(ne)||G?.get(ne.toLowerCase());if(le)b.set(te,le),b.set(te.toLowerCase(),le),b.set(te.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),le)}}for(let P of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let B of P[1].matchAll(/['"]([^'"]+)['"]/g)){let L=Ds(B[1],i.filePath,i).find((H)=>er.statSync(H,{throwIfNoEntry:!1})?.isFile());if(L)b.set(rn.basename(B[1]).replace(/\.stx$/,""),L)}let A={__importedComponents:b},j=new Map,F=(P,B,L)=>{let H=e.slice(0,P);return{code:B,offset:P,attribute:L,anchor:!0,kind:"directive",line:H.split(`
524
+ `).length,column:P-H.lastIndexOf(`
525
+ `)}},O=(P,B,L)=>n.push({expression:P,statement:{text:B+P.code+L,prefixLength:B.length}});for(let P of wl(t)){if(Cr(P.name)||P.name==="component")continue;let B=zr(P.name,i.filePath,i,A);if(!B)continue;let L=j.get(B);if(!L){let G;try{G=i.readComponent?i.readComponent(B):er.readFileSync(B,"utf8")}catch{continue}if(G===void 0)continue;c.set(B,G),L=oo(i.scriptCode(G,B),`__StxComponent${j.size}`),j.set(B,L),a.push(L.declarations)}let H=[];for(let G of P.attributes){let{name:D,offset:ee}=G,ne=G.value===!0?"true":G.value;if(D.startsWith("@")||D.startsWith("v-on:")){if(L.events&&G.value!==!0)l.set(ee,`__StxEvent<${L.events}, ${JSON.stringify(D.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let te=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(D);if(D.startsWith("v-")&&!D.startsWith("v-bind:")&&!te)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(D))continue;let le=(te?te[1]||"modelValue":D.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Te,We)=>We.toUpperCase());if(H.push(le),!L.props)continue;let be=D.startsWith(":")||D.startsWith("v-bind:")||!!te||G.braced,ue=be?ne:G.value!==!0?JSON.stringify(ne):"true",Ee=!be&&G.value!==!0&&(ne==="true"||ne==="false");O(F(ee,ue,D),";void ((",`) satisfies ${Ee?"__StxStaticProp":"__StxProp"}<${L.props}, ${JSON.stringify(le)}>);`)}if(L.props){let G=[...new Set(H)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),D=F(P.offset,`<${P.name}>`);n.push({expression:D,statement:{text:`;void ({ ${G} } satisfies ${L.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:j.size?a.join(`
526
+ `):"",checks:n,events:l,dependencies:c}}var co=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Sl(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function Ot(e){let t=[],i=Sl(e);co.lastIndex=0;let n;while((n=co.exec(i))!==null){let a=(n[1]||"").trim(),l=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,b=n.index+l,v=n.index+n[0].length-c,E=e.slice(b,v);if(/\bsrc\s*=/.test(a))continue;let A=a.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let j=/\bserver\b/.test(a)?"server":/\bclient\b/.test(a)?"client":"plain",F=on(e,b);t.push({kind:j,code:E,startLine:F,startColumn:an(e,b),offset:b,attrs:a})}return t}function on(e,t){let i=1;for(let n=0;n<t&&n<e.length;n++)if(e.charCodeAt(n)===10)i++;return i}function an(e,t){let i=e.lastIndexOf(`
527
+ `,t-1)+1;return t-i+1}function Gn(e){let t=e.split(""),i=(a,l)=>{for(let c=a;c<l&&c<t.length;c++)if(t[c]!==`
528
+ `)t[c]=" "},n=[/<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 a of n){a.lastIndex=0;let l;while((l=a.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function _o(e){let t=0,i="";for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i="";continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{"){t++;continue}if(a===")"||a==="]"||a==="}"){t--;continue}if(a==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var wo=new Set([":for","x-for","v-for"]),Yn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,tr="__stx_interpolated",lo="__StxElement",So="__StxTemplateValue",$l=`type ${So}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function uo(e){return e.replace(/\{\{[\s\S]*?\}\}/g,tr).replace(/\{!![\s\S]*?!!\}/g,tr)}function vl(e,t,i){let n=0;for(let a=t;a<e.length;a++){let l=e[a];if(l==="{"){n++;continue}if(l!=="}"&&l!=="!")continue;if(e.startsWith(i,a)&&n===0)return a;if(l==="}"&&n>0)n--}return-1}function di(e,t,i="0"){let n=`__stxScript${i}`;while((e+t).includes(n))n+="_";let a=new Map,l=[],c=[],b=s(e),v=Ro(e),E=[],A=0;for(let L=0;L<b.length;L++){let H=b.startsWith("{{",L);if(!H&&!b.startsWith("{!!",L))continue;let G=H?2:3,D=H?"}}":"!!}",ee=vl(b,L+G,D);if(ee<0)continue;let ne=L,te=e.slice(ne,ee+D.length),le=te.slice(G,-D.length);L=ee+D.length-1;let be=c.length,ue=sr(v,ne),Ee=sr(v,ne+(H?2:3));c.push({code:_o(le),...Ee});let Te=`${n}_${be}`,We=te.split(`
529
+ `),Ke=We[0].length;We[0]=Te+" ".repeat(Math.max(0,Ke-Te.length));for(let Ge=1;Ge<We.length;Ge++)We[Ge]=We[Ge].replace(/[^\r]/g," ");let Qe=a.get(ue.line)??[],Xe=Qe.at(-1),tt=ue.column+(Xe?Xe.generatedEnd-Xe.sourceEnd:0);Qe.push({sourceStart:ue.column,sourceEnd:ue.column+Ke,generatedStart:tt,generatedEnd:tt+We[0].length}),a.set(ue.line,Qe),E.push(e.slice(A,ne),We.join(`
530
+ `)),A=ne+te.length}E.push(e.slice(A));let j=E.join("");if(!c.length)return{code:j,columns:a,declarations:l};let{imports:F,body:O}=vo(t),P=[],B=0;for(let L of F.split(/\n(?=import\b)/)){if(!L.trim())continue;let H=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(L);if(!H){l.push({text:L});continue}let G=`${n}Module${B++}`;l.push({text:`import * as ${G} from ${H[2]}`});let D=H[1],ee=/\{([\s\S]*?)\}/.exec(D);for(let be of ee?.[1].split(",")??[]){let[ue,Ee=ue]=be.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(ue==="default")P.push(`const ${Ee} = ${G}.default; type ${Ee} = import(${H[2]}).default`);else if(ue)P.push(`import ${Ee} = ${G}.${ue}`)}let ne=D.replace(/\{[\s\S]*?\}/,""),te=/\*\s+as\s+(\w+)/.exec(ne);if(te)P.push(`import ${te[1]} = ${G}`);let le=/^\s*([\w$]+)/.exec(ne)?.[1];if(le)P.push(`const ${le} = ${G}.default; type ${le} = import(${H[2]}).default`)}l.push({text:`namespace ${n}Scope {
531
+ ${P.join(`
532
532
  `)}
533
533
  export async function read() {
534
- ${js(P).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
534
+ ${Bs(O).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
535
535
  return {`});for(let[L,H]of c.entries())l.push({text:`value${L}: (`}),l.push({text:H.code,origin:{line:H.line,column:H.column}}),l.push({text:"),"});l.push({text:`}
536
536
  }
537
- }`});for(let L=0;L<c.length;L++)l.push({text:`declare var ${n}_${L}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${L}']`});return{code:j,columns:a,declarations:l}}function oo(e,t){let i=0;for(let n of e){if(t<n.generatedStart)break;if(t<n.generatedEnd)return n.sourceStart+Math.min(t-n.generatedStart,n.sourceEnd-n.sourceStart);i=n.sourceEnd-n.generatedEnd}return t+i}var wl=["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"],Sl=new RegExp(String.raw`^[ \t]*@(?:${wl.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function js(e){return e.replace(Sl,(t)=>t.replace(/[^\n]/g," "))}var ao=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function eg(e){let t=Jn(e),i=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=n.exec(t))!==null){if(a[1]||a[3])continue;let b=a[2]??a[4]??"",v=a[2]!==void 0?2:3,E=mo(b);if(!E.trim())continue;let A=a.index+v+(E.length-E.trimStart().length);i.push({code:E.trim(),line:sn(t,A),column:rn(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,b=0,v=c;for(;v<t.length;v++){let F=t[v];if(F==="(")b++;else if(F===")"){if(b--,b===0)break}}if(b!==0)continue;let E=t.slice(c+1,v),A=E.trim();if(l.lastIndex=v+1,!A)continue;let j=c+1+(E.length-E.trimStart().length);i.push({code:A,line:sn(t,j),column:rn(t,j),offset:a.index,kind:"condition"})}Gn.lastIndex=0;while((a=Gn.exec(t))!==null){let c=a[1],b=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(ao.has(v)||ao.has(c))continue;if(!b.trim())continue;let E=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(ho.has(v)){let j=b.match(/\s+(?:in|of)\s+/);if(!j||j.index===void 0)continue;let F=b.slice(j.index+j[0].length),P=j.index+j[0].length+(F.length-F.trimStart().length);i.push({code:io(F.trim()),line:sn(t,E+P),column:rn(t,E+P),offset:E+P,kind:"directive",attribute:v});continue}let A=b.length-b.trimStart().length;i.push({code:io(b.trim()),line:sn(t,E+A),column:rn(t,E+A),offset:E+A,kind:"directive",attribute:v})}return i.sort((c,b)=>c.line-b.line||c.column-b.column),i}var $l=2000;function vl(e,t){let i=0,n=Math.min(e.length,t+$l);for(let a=t;a<n;a++){let l=e[a];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,a)}}return null}function El(e){let t=new Map,i=(b,v)=>{let E=b.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of E){let j=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(j))continue;let F=E.length===1?v:void 0,P=t.get(j);if(!P)t.set(j,{name:j,iterable:F});else if(P.iterable!==F)P.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,a=(b)=>{let v=b.trim();return n.test(v)?v:void 0};for(let b of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=vl(e,b.index+b[0].length-1);if(v===null)continue;let E=Pt(v);if(!E)continue;i(E.itemVar.replace(/=>/g," "),a(E.arrayExpr))}for(let b of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(b[1],b[2]==="of"?a(b[3]):void 0);for(let b of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))i(b[1]);let l=Jn(e);Gn.lastIndex=0;let c;while((c=Gn.exec(l))!==null){let b=c[1].replace(/\..*$/,"");if(!ho.has(b))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;i(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let b of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of b[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(v[1]);return[...t.values()].sort((b,v)=>b.name.localeCompare(v.name))}function De(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of i[1].split(",")){let a=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var Gs=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],kl={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Oc(e=new Set){return[...Gs.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(kl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
538
- `)}function Nc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function bo(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,n=!1,a=new Set,l=s(e);while((i=t.exec(l))!==null){n=!0;for(let c of Rl(i[1])){let b=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(b))a.add(b)}}return n?[...a]:null}function Rl(e){let t=[],i=0,n="";for(let a of e){if(a===","&&i===0){t.push(n),n="";continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;n+=a}return t.push(n),t.filter((a)=>a.trim().length>0)}function yo(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],n=e.replace(t,(a)=>(i.push(a.trim()),a.split(`
537
+ }`});for(let L=0;L<c.length;L++)l.push({text:`declare var ${n}_${L}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${L}']`});return{code:j,columns:a,declarations:l}}function fo(e,t){let i=0;for(let n of e){if(t<n.generatedStart)break;if(t<n.generatedEnd)return n.sourceStart+Math.min(t-n.generatedStart,n.sourceEnd-n.sourceStart);i=n.sourceEnd-n.generatedEnd}return t+i}var El=["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"],kl=new RegExp(String.raw`^[ \t]*@(?:${El.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function Bs(e){return e.replace(kl,(t)=>t.replace(/[^\n]/g," "))}var po=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function tg(e){let t=Gn(e),i=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,a;while((a=n.exec(t))!==null){if(a[1]||a[3])continue;let b=a[2]??a[4]??"",v=a[2]!==void 0?2:3,E=_o(b);if(!E.trim())continue;let A=a.index+v+(E.length-E.trimStart().length);i.push({code:E.trim(),line:on(t,A),column:an(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((a=l.exec(t))!==null){let c=a.index+a[0].length-1,b=0,v=c;for(;v<t.length;v++){let F=t[v];if(F==="(")b++;else if(F===")"){if(b--,b===0)break}}if(b!==0)continue;let E=t.slice(c+1,v),A=E.trim();if(l.lastIndex=v+1,!A)continue;let j=c+1+(E.length-E.trimStart().length);i.push({code:A,line:on(t,j),column:an(t,j),offset:a.index,kind:"condition"})}Yn.lastIndex=0;while((a=Yn.exec(t))!==null){let c=a[1],b=a[3]??"",v=c.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(po.has(v)||po.has(c))continue;if(!b.trim())continue;let E=a.index+a[0].indexOf(a[2],a[0].indexOf(c)+c.length)+1;if(wo.has(v)){let j=b.match(/\s+(?:in|of)\s+/);if(!j||j.index===void 0)continue;let F=b.slice(j.index+j[0].length),O=j.index+j[0].length+(F.length-F.trimStart().length);i.push({code:uo(F.trim()),line:on(t,E+O),column:an(t,E+O),offset:E+O,kind:"directive",attribute:v});continue}let A=b.length-b.trimStart().length;i.push({code:uo(b.trim()),line:on(t,E+A),column:an(t,E+A),offset:E+A,kind:"directive",attribute:v})}return i.sort((c,b)=>c.line-b.line||c.column-b.column),i}var Rl=2000;function Cl(e,t){let i=0,n=Math.min(e.length,t+Rl);for(let a=t;a<n;a++){let l=e[a];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,a)}}return null}function Al(e){let t=new Map,i=(b,v)=>{let E=b.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of E){let j=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(j))continue;let F=E.length===1?v:void 0,O=t.get(j);if(!O)t.set(j,{name:j,iterable:F});else if(O.iterable!==F)O.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,a=(b)=>{let v=b.trim();return n.test(v)?v:void 0};for(let b of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=Cl(e,b.index+b[0].length-1);if(v===null)continue;let E=It(v);if(!E)continue;i(E.itemVar.replace(/=>/g," "),a(E.arrayExpr))}for(let b of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(b[1],b[2]==="of"?a(b[3]):void 0);for(let b of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))i(b[1]);let l=Gn(e);Yn.lastIndex=0;let c;while((c=Yn.exec(l))!==null){let b=c[1].replace(/\..*$/,"");if(!wo.has(b))continue;let v=c[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;i(c[3].slice(0,v.index),a(c[3].slice(v.index+v[0].length)))}for(let b of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of b[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(v[1]);return[...t.values()].sort((b,v)=>b.name.localeCompare(v.name))}function De(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of i[1].split(",")){let a=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(a))t.add(a)}return[...t].sort()}var nr=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Tl={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Nc(e=new Set){return[...nr.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Tl).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
538
+ `)}function Mc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function $o(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,n=!1,a=new Set,l=s(e);while((i=t.exec(l))!==null){n=!0;for(let c of Il(i[1])){let b=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(b))a.add(b)}}return n?[...a]:null}function Il(e){let t=[],i=0,n="";for(let a of e){if(a===","&&i===0){t.push(n),n="";continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;n+=a}return t.push(n),t.filter((a)=>a.trim().length>0)}function vo(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],n=e.replace(t,(a)=>(i.push(a.trim()),a.split(`
539
539
  `).map(()=>"").join(`
540
540
  `)));return{imports:i.join(`
541
- `),body:n}}function _o(e){let t=s(e),i=Array(t.length),n=0;for(let b=0;b<t.length;b++){let v=t[b];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[b]=n,v==="{"||v==="("||v==="[")n++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(i[c.index]!==0)continue;let b=c[1],v=c[2],E;if(b==="interface"){let A=t.indexOf("{",c.index);if(A===-1)continue;let j=0;E=-1;for(let F=A;F<t.length;F++)if(t[F]==="{")j++;else if(t[F]==="}"&&--j===0){E=F+1;break}if(E===-1)continue}else{let A=0;E=t.length;for(let j=t.indexOf("=",c.index)+1;j<t.length;j++){let F=t[j];if(F==="{"||F==="["||F==="("||F==="<")A++;else if(F==="}"||F==="]"||F===")"||F===">")A--;else if(A<=0&&(F===";"||F===`
542
- `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,j-40),j)))){E=F===";"?j+1:j;break}}}a.push({name:v,text:e.slice(c.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return a}function Cl(e){return new Set(_o(e).map((t)=>t.name))}function Mc(e,t=""){let i=bo(e),n=Cl(t),a=_o(e).filter((E)=>!n.has(E.name)).map((E)=>E.text);if(!i){let E=De(e).filter((A)=>!At(t,A));if(E.length===0&&a.length===0)return"";return["",`// ${Al}`,...a,...E.map((A)=>`declare var ${A}: any`)].join(`
543
- `)}if(i.length===0)return a.length>0?["",`// ${co}`,...a].join(`
544
- `):"";let{imports:l,body:c}=yo(e),b=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${co}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${lo}() {`,b,` return { ${i.join(", ")} }`,"}",`type ${uo} = Awaited<ReturnType<typeof ${lo}>>`,...i.map((E)=>`declare var ${E}: ${uo}[${JSON.stringify(E)}]`)),v.join(`
545
- `)}function di(e){let i=s(e).split(""),n=0;for(let a=0;a<i.length;a++){let l=i[a];if(l==="{"||l==="("||l==="["){n++;continue}if(l==="}"||l===")"||l==="]"){n=Math.max(0,n-1);continue}if(n>0&&l!==`
546
- `)i[a]=" "}return De(i.join(""))}function Dc(e,t){if(bo(e)!==null)return[];let i=di(e),n=Oe(t,new Set(i)),a=new Set(k);return i.filter((l)=>{if(a.has(l))return!1;if(At(t,l))return!1;return n.has(l)})}var co="stx: types for the declared client payload (#1868)",Al="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",lo="__stxServerScope",uo="__StxClientPayload";var fo=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Tl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function Il(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let a=s(n),{depths:l,balanced:c}=me(a);if(!c)continue;let b=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(b)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let A=v[2],j=E+v[0].length-v[3].length,F=n.slice(j,E+v[0].length).trim().replace(/;$/,"").trim(),P=v[3],O=i.test(P)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(P)&&!/[,+\-*/%&|?:=]$/.test(F)&&me(P).balanced;t.set(A,t.has(A)||!O?null:F)}}return new Map([...t].filter((n)=>n[1]!==null))}function wo(e,t,i=0,n=new Set){if(t.size===0||i>=5)return e;let a=s(e),l="",c=0;for(let b of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=b.index??0,E=b[0],A=t.get(E);if(!A||n.has(E))continue;let j=a.slice(0,v).trimEnd(),F=a.slice(v+E.length).trimStart();if(j.endsWith(".")||/^:(?!:)/.test(F)&&/[{,]$/.test(j))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${wo(A,t,i+1,new Set([...n,E]))})`,c=v+E.length}return l+e.slice(c)}function Ol(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],a;while((a=i.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let b=n[n.length-1];if(b?.current)b.seen.push(b.current);if(b)b.current=null}break}if(l==="endif"||l==="endunless"){n.pop();continue}let c="";if(a[2]==="("){let b=0,v=a.index+a[0].length-1,E=v+1;for(;v<e.length;v++){let A=e[v];if(A==="(")b++;else if(A===")"){if(b--,b===0)break}}c=e.slice(E,v).trim(),i.lastIndex=v+1}if(l==="if")n.push({seen:[],current:c});else if(l==="unless")n.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let b=n[n.length-1];if(!b)continue;if(b.current)b.seen.push(b.current);b.current=l==="elseif"?c:null}}return n.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Pl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Tl.test(t))return null;let n=";(($event: any): void => { ";return{text:`${n}${t} });`,prefixLength:n.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var Ml=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function po(e,t){return Bs(e,t).code}function Bs(e,t){let i=new Map;if(!t)return{code:e,columns:i};let n=So(e),a=[],l=0;for(let c of e.matchAll(Ml)){let b=c.index,[v,E,A,j]=c,F=go.resolve(t,j).replace(/\\/g,"/"),P=`${E}${A}${F}${A}`;if(a.push(e.slice(l,b),P),l=b+v.length,v.includes(`
547
- `))continue;let O=Qs(n,b),B=i.get(O.line)??[],L=B.at(-1),H=O.column+(L?L.generatedEnd-L.sourceEnd:0);B.push({sourceStart:O.column,sourceEnd:O.column+v.length,generatedStart:H,generatedEnd:H+P.length}),i.set(O.line,B)}return a.push(e.slice(l)),{code:a.join(""),columns:i}}function jl(e,t,i){let n=oo(e.importColumns?.get(t)??[],i);return oo(e.scriptColumns?.get(t)??[],n)}function pi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Dl(e){let t=new Set,i=s(e);for(let n of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=n[1],l=/\{([^}]*)\}/.exec(a);for(let E of l?.[1].split(",")??[]){let A=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let c=a.replace(/\{[^}]*\}/,""),b=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(b)t.add(b[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Lc(e,t={}){let i=It(e),n=e.split(`
541
+ `),body:n}}function Eo(e){let t=s(e),i=Array(t.length),n=0;for(let b=0;b<t.length;b++){let v=t[b];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[b]=n,v==="{"||v==="("||v==="[")n++}let a=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,c;while((c=l.exec(t))!==null){if(i[c.index]!==0)continue;let b=c[1],v=c[2],E;if(b==="interface"){let A=t.indexOf("{",c.index);if(A===-1)continue;let j=0;E=-1;for(let F=A;F<t.length;F++)if(t[F]==="{")j++;else if(t[F]==="}"&&--j===0){E=F+1;break}if(E===-1)continue}else{let A=0;E=t.length;for(let j=t.indexOf("=",c.index)+1;j<t.length;j++){let F=t[j];if(F==="{"||F==="["||F==="("||F==="<")A++;else if(F==="}"||F==="]"||F===")"||F===">")A--;else if(A<=0&&(F===";"||F===`
542
+ `&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,j-40),j)))){E=F===";"?j+1:j;break}}}a.push({name:v,text:e.slice(c.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return a}function Pl(e){return new Set(Eo(e).map((t)=>t.name))}function Dc(e,t=""){let i=$o(e),n=Pl(t),a=Eo(e).filter((E)=>!n.has(E.name)).map((E)=>E.text);if(!i){let E=De(e).filter((A)=>!At(t,A));if(E.length===0&&a.length===0)return"";return["",`// ${Ol}`,...a,...E.map((A)=>`declare var ${A}: any`)].join(`
543
+ `)}if(i.length===0)return a.length>0?["",`// ${go}`,...a].join(`
544
+ `):"";let{imports:l,body:c}=vo(e),b=c.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${go}`];if(l)v.push(l);return v.push(...a),v.push(`async function ${mo}() {`,b,` return { ${i.join(", ")} }`,"}",`type ${ho} = Awaited<ReturnType<typeof ${mo}>>`,...i.map((E)=>`declare var ${E}: ${ho}[${JSON.stringify(E)}]`)),v.join(`
545
+ `)}function pi(e){let i=s(e).split(""),n=0;for(let a=0;a<i.length;a++){let l=i[a];if(l==="{"||l==="("||l==="["){n++;continue}if(l==="}"||l===")"||l==="]"){n=Math.max(0,n-1);continue}if(n>0&&l!==`
546
+ `)i[a]=" "}return De(i.join(""))}function Lc(e,t){if($o(e)!==null)return[];let i=pi(e),n=Oe(t,new Set(i)),a=new Set(k);return i.filter((l)=>{if(a.has(l))return!1;if(At(t,l))return!1;return n.has(l)})}var go="stx: types for the declared client payload (#1868)",Ol="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",mo="__stxServerScope",ho="__StxClientPayload";var xo=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var Ml=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function jl(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let a=s(n),{depths:l,balanced:c}=me(a);if(!c)continue;let b=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of a.matchAll(b)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let A=v[2],j=E+v[0].length-v[3].length,F=n.slice(j,E+v[0].length).trim().replace(/;$/,"").trim(),O=v[3],P=i.test(O)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(O)&&!/[,+\-*/%&|?:=]$/.test(F)&&me(O).balanced;t.set(A,t.has(A)||!P?null:F)}}return new Map([...t].filter((n)=>n[1]!==null))}function ko(e,t,i=0,n=new Set){if(t.size===0||i>=5)return e;let a=s(e),l="",c=0;for(let b of a.matchAll(/[A-Za-z_$][\w$]*/g)){let v=b.index??0,E=b[0],A=t.get(E);if(!A||n.has(E))continue;let j=a.slice(0,v).trimEnd(),F=a.slice(v+E.length).trimStart();if(j.endsWith(".")||/^:(?!:)/.test(F)&&/[{,]$/.test(j))continue;if(v>0&&/[\w$]/.test(a[v-1]))continue;l+=`${e.slice(c,v)}(${ko(A,t,i+1,new Set([...n,E]))})`,c=v+E.length}return l+e.slice(c)}function Dl(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],a;while((a=i.exec(e))!==null){if(a.index>t)break;let l=a[1];if(a.index===t){if(l==="elseif"){let b=n[n.length-1];if(b?.current)b.seen.push(b.current);if(b)b.current=null}break}if(l==="endif"||l==="endunless"){n.pop();continue}let c="";if(a[2]==="("){let b=0,v=a.index+a[0].length-1,E=v+1;for(;v<e.length;v++){let A=e[v];if(A==="(")b++;else if(A===")"){if(b--,b===0)break}}c=e.slice(E,v).trim(),i.lastIndex=v+1}if(l==="if")n.push({seen:[],current:c});else if(l==="unless")n.push({seen:[],current:`!(${c})`});else if(l==="elseif"||l==="else"){let b=n[n.length-1];if(!b)continue;if(b.current)b.seen.push(b.current);b.current=l==="elseif"?c:null}}return n.flatMap((l)=>[...l.seen.map((c)=>`!(${c})`),...l.current?[l.current]:[]]).filter(Boolean)}function Nl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(Ml.test(t))return null;let n=";(($event: any): void => { ";return{text:`${n}${t} });`,prefixLength:n.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var Ll=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function bo(e,t){return Fs(e,t).code}function Fs(e,t){let i=new Map;if(!t)return{code:e,columns:i};let n=Ro(e),a=[],l=0;for(let c of e.matchAll(Ll)){let b=c.index,[v,E,A,j]=c,F=yo.resolve(t,j).replace(/\\/g,"/"),O=`${E}${A}${F}${A}`;if(a.push(e.slice(l,b),O),l=b+v.length,v.includes(`
547
+ `))continue;let P=sr(n,b),B=i.get(P.line)??[],L=B.at(-1),H=P.column+(L?L.generatedEnd-L.sourceEnd:0);B.push({sourceStart:P.column,sourceEnd:P.column+v.length,generatedStart:H,generatedEnd:H+O.length}),i.set(P.line,B)}return a.push(e.slice(l)),{code:a.join(""),columns:i}}function zl(e,t,i){let n=fo(e.importColumns?.get(t)??[],i);return fo(e.scriptColumns?.get(t)??[],n)}function fi(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function Bl(e){let t=new Set,i=s(e);for(let n of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let a=n[1],l=/\{([^}]*)\}/.exec(a);for(let E of l?.[1].split(",")??[]){let A=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let c=a.replace(/\{[^}]*\}/,""),b=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(c);if(b)t.add(b[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(c);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function jc(e,t={}){let i=Ot(e),n=e.split(`
548
548
  `),a=Array.from({length:n.length},()=>""),l=new Map,c=new Map,b=new Map,v=[],E=i.filter((B)=>B.kind==="server").map((B)=>B.code).join(`
549
- `),A=t.filePath&&t.templateExpressions!==!1?no(e,Jn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(B,L)=>It(B).map((H)=>po(H.code,go.dirname(L))).join(`
550
- `)}):void 0,j=new Set,F=[];for(let[B,L]of i.entries()){let H=ui(pi(L)+L.code,E,String(B));for(let[ne,te]of H.columns)c.set(L.startLine+ne-1,te);for(let ne of H.declarations)v.push({text:po(ne.text,t.originDir??""),origin:ne.origin?{...ne.origin,line:ne.origin.line+L.startLine-1}:void 0});let G=js(H.code),D=Bs(G,t.originDir??"");for(let[ne,te]of D.columns)b.set(L.startLine+ne-1,te);let ee=D.code.split(`
551
- `);ee.forEach((ne,te)=>{let le=L.startLine-1+te;if(le<a.length)a[le]=ne,j.add(le)}),F.push(L.startLine-1+ee.length-1)}for(let B of F){let L=a[B]?.trim()===""?B:B+1;if(L<a.length&&a[L].trim()===""&&(L===B||!j.has(L)))a[L]=";"}let P=(B,L)=>{for(let[H,G]of B.split(`
552
- `).entries())if(a.push(G),L)l.set(a.length,H===0?L:{...L,line:L.line+H,column:1,prefixLength:0})};for(let B of v)P(B.text,B.origin);if(t.globals!==!1){P("");let B=new Set([...i.flatMap((D)=>De(D.code)),...i.flatMap((D)=>Dl(D.code))]),L=(D)=>{if(!B.has(D))P(`declare var ${D}: any`)};if(t.runtimeGlobals!==!1){if(!B.has("window"))P("declare var window: any");for(let D of k)L(D)}let H=[...new Set([...Gs,...Se,...fo])].filter((D)=>t.runtimeGlobals!==!1||!k.includes(D));if(t.contextScope==="global"){P("declare global {");for(let D of H)P(` var ${D}: any`);P("}")}else{for(let D of Gs)L(D);for(let D of Se)L(D);for(let D of fo)L(D)}P(`declare var ${Js}: any`);let G=new Set(i.flatMap((D)=>De(D.code)));P(`type ${ro}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let D of El(e)){if(G.has(D.name))continue;let ee=D.iterable&&G.has(D.iterable)?`${ro}<typeof ${D.iterable}>`:"any";P(`declare var ${D.name}: ${ee}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let L of A.declarations.split(`
553
- `))P(L);let B=eg(e).map((L)=>{let H=A?.events.get(L.offset??-1);if(H){L.anchor=!0;let G=L.code.trim(),D=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(G),ee=D?`void ((${D[2]}) satisfies __StxAssignedValue<typeof ${D[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(G)?`${G} satisfies (($event: ${H}) => unknown)`:G,ne=`;(($event: ${H}): void => { `;return{expression:L,statement:{text:`${ne}${ee} });`,prefixLength:ne.length}}}return{expression:L,statement:Pl(L)}}).filter((L)=>L.statement!==null);if(B.push(...A?.checks||[]),B.length>0){let L=Jn(e),H=Kn(L),G=Il(i.map((te)=>te.code)),ee=[...new Set(i.flatMap((te)=>De(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ne=0;if(ee.length>0){P(yl);for(let te of ee)P(`function __StxRead_${te}() { return ${te} }`),P(`type __StxT_${te} = ${xo}<ReturnType<typeof __StxRead_${te}>>`);P(`;((${ee.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ne=1}for(let{expression:te,statement:le}of B){let he=" ".repeat(ne),ue=te.offset===void 0?[]:H.filter((Xe)=>te.offset>=Xe.start&&te.offset<Xe.end),Ee=ue.map((Xe)=>`;((${Xe.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Te=" });".repeat(ue.length),We=te.offset===void 0?[]:Ol(L,te.offset),Ke=We.length>0?`${We.map((Xe)=>`if (${wo(Xe,G)}) `).join("")}{ `:"",Qe=We.length>0?" }":"";P(he+Ee+Ke+le.text+Qe+Te,{line:te.line,column:te.column,expression:te,prefixLength:le.prefixLength+he.length+Ee.length+Ke.length,guardPrefixLength:he.length+Ee.length+Ke.length})}if(ne>0)P("});")}}let O=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,O=!0;return P("export {}"),{text:a.join(`
554
- `),lineMap:l,sourceLineCount:n.length,componentDependencies:A?.dependencies,referenced:O,scriptColumns:c,importColumns:b}}function So(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Qs(e,t){let i=0,n=e.length-1;while(i<n){let a=Math.ceil((i+n)/2);if(e[a]<=t)i=a;else n=a-1}return{line:i+1,column:t-e[i]+1}}function jc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function fi(e,t,i){let n=e.lineMap.get(t);if(!n)return t<=e.sourceLineCount?{line:t,column:jl(e,t,i)}:null;let a=n.expression?.anchor?0:Math.max(0,i-1-(n.prefixLength??0));return{line:n.line,column:n.column+a,expression:n.expression,inGuard:i<=(n.guardPrefixLength??0)}}var er=w(256),Nl=[{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"}],$o=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Ll(e){let t=Array.from(e,(a)=>a===`
549
+ `),A=t.filePath&&t.templateExpressions!==!1?ao(e,Gn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(B,L)=>Ot(B).map((H)=>bo(H.code,yo.dirname(L))).join(`
550
+ `)}):void 0,j=new Set,F=[];for(let[B,L]of i.entries()){let H=di(fi(L)+L.code,E,String(B));for(let[ne,te]of H.columns)c.set(L.startLine+ne-1,te);for(let ne of H.declarations)v.push({text:bo(ne.text,t.originDir??""),origin:ne.origin?{...ne.origin,line:ne.origin.line+L.startLine-1}:void 0});let G=Bs(H.code),D=Fs(G,t.originDir??"");for(let[ne,te]of D.columns)b.set(L.startLine+ne-1,te);let ee=D.code.split(`
551
+ `);ee.forEach((ne,te)=>{let le=L.startLine-1+te;if(le<a.length)a[le]=ne,j.add(le)}),F.push(L.startLine-1+ee.length-1)}for(let B of F){let L=a[B]?.trim()===""?B:B+1;if(L<a.length&&a[L].trim()===""&&(L===B||!j.has(L)))a[L]=";"}let O=(B,L)=>{for(let[H,G]of B.split(`
552
+ `).entries())if(a.push(G),L)l.set(a.length,H===0?L:{...L,line:L.line+H,column:1,prefixLength:0})};for(let B of v)O(B.text,B.origin);if(t.globals!==!1){O("");let B=new Set([...i.flatMap((D)=>De(D.code)),...i.flatMap((D)=>Bl(D.code))]),L=(D)=>{if(!B.has(D))O(`declare var ${D}: any`)};if(t.runtimeGlobals!==!1){if(!B.has("window"))O("declare var window: any");for(let D of k)L(D)}let H=[...new Set([...nr,...Se,...xo])].filter((D)=>t.runtimeGlobals!==!1||!k.includes(D));if(t.contextScope==="global"){O("declare global {");for(let D of H)O(` var ${D}: any`);O("}")}else{for(let D of nr)L(D);for(let D of Se)L(D);for(let D of xo)L(D)}O(`declare var ${tr}: any`);let G=new Set(i.flatMap((D)=>De(D.code)));O(`type ${lo}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let D of Al(e)){if(G.has(D.name))continue;let ee=D.iterable&&G.has(D.iterable)?`${lo}<typeof ${D.iterable}>`:"any";O(`declare var ${D.name}: ${ee}`)}}if(t.templateExpressions!==!1){if(A?.declarations)for(let L of A.declarations.split(`
553
+ `))O(L);let B=tg(e).map((L)=>{let H=A?.events.get(L.offset??-1);if(H){L.anchor=!0;let G=L.code.trim(),D=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(G),ee=D?`void ((${D[2]}) satisfies __StxAssignedValue<typeof ${D[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(G)?`${G} satisfies (($event: ${H}) => unknown)`:G,ne=`;(($event: ${H}): void => { `;return{expression:L,statement:{text:`${ne}${ee} });`,prefixLength:ne.length}}}return{expression:L,statement:Nl(L)}}).filter((L)=>L.statement!==null);if(B.push(...A?.checks||[]),B.length>0){let L=Gn(e),H=Xn(L),G=jl(i.map((te)=>te.code)),ee=[...new Set(i.flatMap((te)=>De(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ne=0;if(ee.length>0){O($l);for(let te of ee)O(`function __StxRead_${te}() { return ${te} }`),O(`type __StxT_${te} = ${So}<ReturnType<typeof __StxRead_${te}>>`);O(`;((${ee.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ne=1}for(let{expression:te,statement:le}of B){let be=" ".repeat(ne),ue=te.offset===void 0?[]:H.filter((Xe)=>te.offset>=Xe.start&&te.offset<Xe.end),Ee=ue.map((Xe)=>`;((${Xe.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),Te=" });".repeat(ue.length),We=te.offset===void 0?[]:Dl(L,te.offset),Ke=We.length>0?`${We.map((Xe)=>`if (${ko(Xe,G)}) `).join("")}{ `:"",Qe=We.length>0?" }":"";O(be+Ee+Ke+le.text+Qe+Te,{line:te.line,column:te.column,expression:te,prefixLength:le.prefixLength+be.length+Ee.length+Ke.length,guardPrefixLength:be.length+Ee.length+Ke.length})}if(ne>0)O("});")}}let P=!1;if(t.reference&&a[0]!==void 0&&a[0].trim()==="")a[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,P=!0;return O("export {}"),{text:a.join(`
554
+ `),lineMap:l,sourceLineCount:n.length,componentDependencies:A?.dependencies,referenced:P,scriptColumns:c,importColumns:b}}function Ro(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function sr(e,t){let i=0,n=e.length-1;while(i<n){let a=Math.ceil((i+n)/2);if(e[a]<=t)i=a;else n=a-1}return{line:i+1,column:t-e[i]+1}}function Bc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function gi(e,t,i){let n=e.lineMap.get(t);if(!n)return t<=e.sourceLineCount?{line:t,column:zl(e,t,i)}:null;let a=n.expression?.anchor?0:Math.max(0,i-1-(n.prefixLength??0));return{line:n.line,column:n.column+a,expression:n.expression,inGuard:i<=(n.guardPrefixLength??0)}}var rr=w(256),Wl=[{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"}],Co=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function Fl(e){let t=Array.from(e,(a)=>a===`
555
555
  `?`
556
556
  `:" "),i=0,n="";while(i<e.length){let a=e[i],l=e[i+1];if(n){if(a==="\\"){i+=2;continue}if(a===n)n="";i++;continue}if(a==='"'||a==="'"||a==="`"){n=a,i++;continue}if(a==="/"&&l==="/"){while(i<e.length&&e[i]!==`
557
- `)t[i]=e[i],i++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",i+2),b=c===-1?e.length:c+2;for(;i<b;i++)t[i]=e[i];continue}if(a==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let c=e.indexOf("--}}",i+4),b=c===-1?e.length:c+4;for(;i<b;i++)t[i]=e[i];continue}i++}return t.join("")}function zl(e){let t=new Map,i=Ll(e).split(`
557
+ `)t[i]=e[i],i++;continue}if(a==="/"&&l==="*"){let c=e.indexOf("*/",i+2),b=c===-1?e.length:c+2;for(;i<b;i++)t[i]=e[i];continue}if(a==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let c=e.indexOf("--}}",i+4),b=c===-1?e.length:c+4;for(;i<b;i++)t[i]=e[i];continue}i++}return t.join("")}function Vl(e){let t=new Map,i=Fl(e).split(`
558
558
  `),n=e.split(`
559
- `);return i.forEach((a,l)=>{$o.lastIndex=0;for(let c of a.matchAll($o)){let b=c[1]==="-next-line",v=(n[l]??"").slice(0,c.index).trim(),E=b||v===""?l+2:l+1,j=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),F=j.filter((O)=>/\w/.test(O));if(j.length>0&&F.length===0)continue;let P=t.get(E);if(P&&P.size===0)continue;if(F.length===0){t.set(E,new Set);continue}if(P)F.forEach((O)=>P.add(O));else t.set(E,new Set(F))}}),t}function Bl(e,t,i){let n=e.get(t);if(!n)return!1;if(n.size===0)return!0;return[...n].some((a)=>i.includes(a))}function Ne(e,t,i,n){let a=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!a.enabled)return;let l=S(e,t,n,JSON.stringify(a)),c=er.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new K(c,n??t);return}let b=a.allowPatterns??[],v=zl(e),E=[],A=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(O)=>O.replace(/[^\n]/g," ")));for(let{pattern:O,message:B,suggestion:L}of Nl){if(b.some((G)=>/\w/.test(G)&&B.includes(G)))continue;O.lastIndex=0;let H=A.match(O);if(H&&H.length>0){let G=A.split(`
559
+ `);return i.forEach((a,l)=>{Co.lastIndex=0;for(let c of a.matchAll(Co)){let b=c[1]==="-next-line",v=(n[l]??"").slice(0,c.index).trim(),E=b||v===""?l+2:l+1,j=(c[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),F=j.filter((P)=>/\w/.test(P));if(j.length>0&&F.length===0)continue;let O=t.get(E);if(O&&O.size===0)continue;if(F.length===0){t.set(E,new Set);continue}if(O)F.forEach((P)=>O.add(P));else t.set(E,new Set(F))}}),t}function Ul(e,t,i){let n=e.get(t);if(!n)return!1;if(n.size===0)return!0;return[...n].some((a)=>i.includes(a))}function Ne(e,t,i,n){let a=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!a.enabled)return;let l=S(e,t,n,JSON.stringify(a)),c=rr.get(l);if(c!==void 0){if(c&&a.failOnViolation)throw new K(c,n??t);return}let b=a.allowPatterns??[],v=Vl(e),E=[],A=s(e.replace(/\{\{--[\s\S]*?--\}\}/g,(P)=>P.replace(/[^\n]/g," ")));for(let{pattern:P,message:B,suggestion:L}of Wl){if(b.some((G)=>/\w/.test(G)&&B.includes(G)))continue;P.lastIndex=0;let H=A.match(P);if(H&&H.length>0){let G=A.split(`
560
560
  `),D=e.split(`
561
- `),ee=[];if(G.forEach((he,ue)=>{if(O.lastIndex=0,O.test(he)&&!Bl(v,ue+1,B))ee.push(ue+1)}),ee.length===0&&G.some((he)=>(O.lastIndex=0,O.test(he))))continue;let ne=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",te=ee.slice(0,3).map((he)=>` ${he} | ${(D[he-1]??"").trim().slice(0,100)}`).join(`
561
+ `),ee=[];if(G.forEach((be,ue)=>{if(P.lastIndex=0,P.test(be)&&!Ul(v,ue+1,B))ee.push(ue+1)}),ee.length===0&&G.some((be)=>(P.lastIndex=0,P.test(be))))continue;let ne=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",te=ee.slice(0,3).map((be)=>` ${be} | ${(D[be-1]??"").trim().slice(0,100)}`).join(`
562
562
  `),le=te?`
563
563
  ${te}`:"";E.push(` \u2717 ${B}${ne}
564
- \u2192 ${L}${le}`)}}if(E.length===0){er.set(l,"");return}let j=(O)=>{let B=`${process.cwd()}/`;return O.startsWith(B)?O.slice(B.length):O},P=`[STX] DOM API violation in ${n&&n!==t?`${j(n)} (composed into ${j(t)})`:j(t)}:
564
+ \u2192 ${L}${le}`)}}if(E.length===0){rr.set(l,"");return}let j=(P)=>{let B=`${process.cwd()}/`;return P.startsWith(B)?P.slice(B.length):P},O=`[STX] DOM API violation in ${n&&n!==t?`${j(n)} (composed into ${j(t)})`:j(t)}:
565
565
  ${E.join(`
566
566
  `)}
567
- Tip: prefer useRef(), navigate(), and composables for component code`;if(er.set(l,P),console.warn(P),a.failOnViolation)throw new K(P,n??t)}var Wl=[{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"}],Fl=[{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')"}],Vl=[{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 ug(e){let t=[],i=[];return Ul(e,t),Hl(e,t,i),ql(e,i),Zl(e,t),{valid:t.length===0,errors:t,warnings:i}}function Ul(e,t){let i=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(i!==n)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${n} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Hl(e,t,i){for(let n of Wl){let a=new RegExp(`${n.open}(?:\\s|\\()`,"g"),l=new RegExp(n.close,"g"),c=(e.match(a)||[]).length,b=(e.match(l)||[]).length;if(n.altClose){let v=new RegExp(n.altClose,"g");b+=(e.match(v)||[]).length}if(c>b)t.push({type:"directive",message:`Unclosed @${n.name} directive: found ${c} opening and ${b} closing`,suggestion:`Add ${c-b} missing ${n.close} tag(s)`});else if(b>c)i.push({type:"directive",message:`Extra ${n.close} found: ${b-c} more closing than opening`,suggestion:`Check for orphaned ${n.close} tags`})}}function ql(e,t){for(let i of Fl)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function Zl(e,t){for(let i of Vl)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function dg(e,t){let i=e.slice(0,t).split(`
568
- `);return{line:i.length,column:i[i.length-1].length+1}}function pg(e,t,i){let n=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))n.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(i.length===0)n.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)n.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)n.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return n}function fg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function gg(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let n of t){let a=n[1].toLowerCase();if(!a.startsWith("end"))i.add(a)}return Array.from(i)}function vo(e,t,i){let n=/^<script\b([^>]*)>/i.exec(e);if(!n||!/(?:^|\s)src\s*=/i.test(n[1]??""))return null;return _(n[0],t,i)+e.slice(n[0].length)}var on=new T(500),sr=new Map;function Eo(e){try{let t=ts.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var Qn=new T(1000),rr=new Map,ir=new T(2000),or=new T(500),Mo=33554432,ar=Mo;function Kl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===ar)return;ar=t,es.setMaxBytes(t)}var es=new T(2000,{maxBytes:Mo,sizeOf:(e)=>e.output.length});function Xl(e){let t=new WeakSet;try{let i=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");t.add(n);try{if(n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(i);let a=Object.getPrototypeOf(n);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(n).sort())l[c]=i(n[c]);return l}finally{t.delete(n)}};return JSON.stringify(i(e))}catch{return null}}function Jl(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function tr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Us(e){let t=process.cwd(),i=`${t}\x00${e}`,n=ko.get(i);if(n===void 0)n=Bun.hash(jo(e,t).split(ae.sep).join("/")).toString(36).slice(0,6),ko.set(i,n);return n}var ko=new Map;function jo(e,t){if(!ae.isAbsolute(e))return e;let i=(n)=>{try{return ts.realpathSync(n)}catch{return n}};return ae.relative(i(t),i(e))}function mg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Be(e){return!mg(e)}var Yn=new Map;function Z(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=Yn.get(t);if(i)return i;if(Yn.size>=16)Yn.clear();let n=new Bun.Transpiler(e);return Yn.set(t,n),n}var Ro=new WeakMap,Gl=256;function Fe(e){try{let t=Z({loader:"ts",target:"browser",define:C()}),i=Ro.get(t);if(!i)i=new Map,Ro.set(t,i);let n=i.get(e);if(n!==void 0)return n;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`});let c=t.transformSync(a);for(let b=0;b<l.length;b++)c=c.replace(`"__STX_EXPR_${b}__"`,l[b]),c=c.replace(`'__STX_EXPR_${b}__'`,l[b]);if(i.size>=Gl){let b=i.keys().next();if(!b.done)i.delete(b.value)}return i.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function Yl(e){let t=[],i=new Set,n=0,a=0,l=e.length,c=(P)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===P){a++;return}a++}},b=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let P=1;while(a<l&&P>0)if(e[a]==="{")P++,a++;else if(e[a]==="}")P--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")b();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
569
- `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let P=a-1;while(P>=0&&/\s/.test(e[P]))P--;if(P<0)return!0;let O=e[P];if("(,=:[!&|?{};+-*%<>~^".includes(O))return!0;if(!/[\w$]/.test(O))return!1;let B=P;while(B>0&&/[\w$]/.test(e[B-1]))B--;return E.has(e.slice(B,P+1))},j=()=>{a++;let P=!1;while(a<l&&e[a]!==`
570
- `){let O=e[a];if(O==="\\"){a+=2;continue}if(O==="[")P=!0;else if(O==="]")P=!1;else if(O==="/"&&!P){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},F=()=>{if(n!==0)return;let P=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(P){let H=P[2].split(",").map((G)=>{let D=G.trim().split(":");return D[D.length-1].trim()});for(let G of H)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!i.has(G))t.push(G),i.add(G);return}let O=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(O){let H=O[2];if(!i.has(H))t.push(H),i.add(H);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let H=B[1];if(!i.has(H))t.push(H),i.add(H);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let H=L[1];if(!i.has(H))t.push(H),i.add(H)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&A()){j();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))F();a++}return t}function Ql(e){let t=[],i=0,n=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function eu(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function tu(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of Ql(b)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=eu(E);if(A===-1)continue;let j=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(j))continue;if(t[j]!==void 0)continue;let F=E.slice(A+1).trim();if(!F)continue;try{let P=Object.keys(t).filter(Bt),O=Function(...P,`"use strict"; return (${F});`);t[j]=O(...P.map((B)=>t[B]))}catch{}}}catch{}}var nu=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function hg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!nu.has(n))return null;let a=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=y(e,(E,A)=>(a.lastIndex=A,a.exec(E)?.index===A?a.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,b=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;b=!0;break}}if(!b)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function Do(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Er(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),b=i.__importedComponents;if(b){for(let te of[l,l.toLowerCase(),c(l),U(l)])if(b.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),j=[],F=(te)=>{if(te&&!j.includes(te))j.push(te)};for(let te of jn(n,E))F(te);let P=i.__originalFilePath;if(P)F(ae.join(ae.dirname(P),"components"));if(Do(t,a))F(a._rootComponentsDir);F(t),F(a._rootComponentsDir),F(ae.join(ae.dirname(n),"components")),F(a.componentsDir);for(let te of a.additionalComponentsDirs??[])F(te);let O=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!O)for(let te of a._targetComponentDirs??[])F(te);if(E)F(ae.resolve(E,"resources/views/components")),F(ae.resolve(E,"resources/components")),F(ae.resolve(E,"src/components")),F(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])F(te);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let te of B)F(typeof te==="string"?te:null);if(F(a.fallbackComponentsDir),O)for(let te of a._targetComponentDirs??[])F(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))F(L.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ae.resolve(ae.dirname(n),`${l}.stx`));let H=Co(ae.resolve(import.meta.dir,"components")),G=j.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,ee=ir.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of G){if(Co(te)===H)continue;for(let le of v)if(await r(ae.join(te,le))){ne=!0;break e}}return ir.set(D,ne),ne}function Co(e){let t=or.get(e);if(t!==void 0)return t;let i=e;try{i=ts.realpathSync(e)}catch{}return or.set(e,i),i}function yg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Yc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function su(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var Ao=new Set;function To(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&Ao.has(a))return;Ao.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",b=i.length>0?`
567
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(rr.set(l,O),console.warn(O),a.failOnViolation)throw new K(O,n??t)}var Hl=[{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"}],ql=[{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')"}],Zl=[{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 dg(e){let t=[],i=[];return Kl(e,t),Xl(e,t,i),Jl(e,i),Gl(e,t),{valid:t.length===0,errors:t,warnings:i}}function Kl(e,t){let i=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(i!==n)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${n} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function Xl(e,t,i){for(let n of Hl){let a=new RegExp(`${n.open}(?:\\s|\\()`,"g"),l=new RegExp(n.close,"g"),c=(e.match(a)||[]).length,b=(e.match(l)||[]).length;if(n.altClose){let v=new RegExp(n.altClose,"g");b+=(e.match(v)||[]).length}if(c>b)t.push({type:"directive",message:`Unclosed @${n.name} directive: found ${c} opening and ${b} closing`,suggestion:`Add ${c-b} missing ${n.close} tag(s)`});else if(b>c)i.push({type:"directive",message:`Extra ${n.close} found: ${b-c} more closing than opening`,suggestion:`Check for orphaned ${n.close} tags`})}}function Jl(e,t){for(let i of ql)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function Gl(e,t){for(let i of Zl)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function pg(e,t){let i=e.slice(0,t).split(`
568
+ `);return{line:i.length,column:i[i.length-1].length+1}}function fg(e,t,i){let n=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))n.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(i.length===0)n.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)n.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)n.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return n}function gg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function mg(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let n of t){let a=n[1].toLowerCase();if(!a.startsWith("end"))i.add(a)}return Array.from(i)}function Ao(e,t,i){let n=/^<script\b([^>]*)>/i.exec(e);if(!n||!/(?:^|\s)src\s*=/i.test(n[1]??""))return null;return _(n[0],t,i)+e.slice(n[0].length)}var cn=new T(500),ar=new Map;function To(e){try{let t=ns.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var es=new T(1000),cr=new Map,lr=new T(2000),ur=new T(500),zo=33554432,fr=zo;function Yl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===fr)return;fr=t,ts.setMaxBytes(t)}var ts=new T(2000,{maxBytes:zo,sizeOf:(e)=>e.output.length});function Ql(e){let t=new WeakSet;try{let i=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");t.add(n);try{if(n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(i);let a=Object.getPrototypeOf(n);if(a!==Object.prototype&&a!==null)throw TypeError("Non-plain component input");let l={};for(let c of Object.keys(n).sort())l[c]=i(n[c]);return l}finally{t.delete(n)}};return JSON.stringify(i(e))}catch{return null}}function eu(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function ir(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ws(e){let t=process.cwd(),i=`${t}\x00${e}`,n=Io.get(i);if(n===void 0)n=Bun.hash(Bo(e,t).split(ae.sep).join("/")).toString(36).slice(0,6),Io.set(i,n);return n}var Io=new Map;function Bo(e,t){if(!ae.isAbsolute(e))return e;let i=(n)=>{try{return ns.realpathSync(n)}catch{return n}};return ae.relative(i(t),i(e))}function hg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Be(e){return!hg(e)}var Qn=new Map;function Z(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=Qn.get(t);if(i)return i;if(Qn.size>=16)Qn.clear();let n=new Bun.Transpiler(e);return Qn.set(t,n),n}var Po=new WeakMap,tu=256;function Fe(e){try{let t=Z({loader:"ts",target:"browser",define:C()}),i=Po.get(t);if(!i)i=new Map,Po.set(t,i);let n=i.get(e);if(n!==void 0)return n;let a=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");a=a.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];a=a.replace(/\{!![\s\S]*?!!\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{\{[\s\S]*?\}\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`}),a=a.replace(/\{\{[\s\S]*?\}\}/g,(b)=>{let v=l.length;return l.push(b),`"__STX_EXPR_${v}__"`});let c=t.transformSync(a);for(let b=0;b<l.length;b++)c=c.replace(`"__STX_EXPR_${b}__"`,l[b]),c=c.replace(`'__STX_EXPR_${b}__'`,l[b]);if(i.size>=tu){let b=i.keys().next();if(!b.done)i.delete(b.value)}return i.set(e,c),c}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function nu(e){let t=[],i=new Set,n=0,a=0,l=e.length,c=(O)=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]===O){a++;return}a++}},b=()=>{a++;while(a<l){if(e[a]==="\\"){a+=2;continue}if(e[a]==="`"){a++;return}if(e[a]==="$"&&e[a+1]==="{"){a+=2;let O=1;while(a<l&&O>0)if(e[a]==="{")O++,a++;else if(e[a]==="}")O--,a++;else if(e[a]==="'"||e[a]==='"')c(e[a]);else if(e[a]==="`")b();else a++;continue}a++}},v=()=>{if(e[a]==="/"&&e[a+1]==="/"){while(a<l&&e[a]!==`
569
+ `)a++;return!0}if(e[a]==="/"&&e[a+1]==="*"){a+=2;while(a<l-1&&!(e[a]==="*"&&e[a+1]==="/"))a++;return a+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let O=a-1;while(O>=0&&/\s/.test(e[O]))O--;if(O<0)return!0;let P=e[O];if("(,=:[!&|?{};+-*%<>~^".includes(P))return!0;if(!/[\w$]/.test(P))return!1;let B=O;while(B>0&&/[\w$]/.test(e[B-1]))B--;return E.has(e.slice(B,O+1))},j=()=>{a++;let O=!1;while(a<l&&e[a]!==`
570
+ `){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")O=!0;else if(P==="]")O=!1;else if(P==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},F=()=>{if(n!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let H=O[2].split(",").map((G)=>{let D=G.trim().split(":");return D[D.length-1].trim()});for(let G of H)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!i.has(G))t.push(G),i.add(G);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let H=P[2];if(!i.has(H))t.push(H),i.add(H);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let H=B[1];if(!i.has(H))t.push(H),i.add(H);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let H=L[1];if(!i.has(H))t.push(H),i.add(H)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&A()){j();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))F();a++}return t}function su(e){let t=[],i=0,n=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function ru(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function iu(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of su(b)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=ru(E);if(A===-1)continue;let j=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(j))continue;if(t[j]!==void 0)continue;let F=E.slice(A+1).trim();if(!F)continue;try{let O=Object.keys(t).filter(Ft),P=Function(...O,`"use strict"; return (${F});`);t[j]=P(...O.map((B)=>t[B]))}catch{}}}catch{}}var ou=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function yg(e,t){let i=Pt(e),n=e.slice(i).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!n)return null;let a=n[1].toLowerCase();if(!ou.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(A,j)=>(l.lastIndex=j,l.exec(A)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let A of c){if(b+=A.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(A.end).trim())return null;v=!0;break}}if(!v)return null;let E=i+n[0].length;return e.slice(0,E)+t+e.slice(E)}function Wo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Tr(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),b=i.__importedComponents;if(b){for(let te of[l,l.toLowerCase(),c(l),U(l)])if(b.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),j=[],F=(te)=>{if(te&&!j.includes(te))j.push(te)};for(let te of Dn(n,E))F(te);let O=i.__originalFilePath;if(O)F(ae.join(ae.dirname(O),"components"));if(Wo(t,a))F(a._rootComponentsDir);F(t),F(a._rootComponentsDir),F(ae.join(ae.dirname(n),"components")),F(a.componentsDir);for(let te of a.additionalComponentsDirs??[])F(te);let P=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!P)for(let te of a._targetComponentDirs??[])F(te);if(E)F(ae.resolve(E,"resources/views/components")),F(ae.resolve(E,"resources/components")),F(ae.resolve(E,"src/components")),F(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])F(te);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let te of B)F(typeof te==="string"?te:null);if(F(a.fallbackComponentsDir),P)for(let te of a._targetComponentDirs??[])F(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))F(L.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ae.resolve(ae.dirname(n),`${l}.stx`));let H=Oo(ae.resolve(import.meta.dir,"components")),G=j.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,ee=lr.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of G){if(Oo(te)===H)continue;for(let le of v)if(await r(ae.join(te,le))){ne=!0;break e}}return lr.set(D,ne),ne}function Oo(e){let t=ur.get(e);if(t!==void 0)return t;let i=e;try{i=ns.realpathSync(e)}catch{}return ur.set(e,i),i}function bg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Zc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function au(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var Mo=new Set;function jo(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&Mo.has(a))return;Mo.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",b=i.length>0?`
571
571
  searched:
572
572
  ${i.map((v)=>` - ${v}`).join(`
573
- `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Io(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var ru=new Set(["for","if","show","key","ref","class","className","style"]),Oo=new Set,No="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Zc=new RegExp(`\\b(?:${No})\\s*(?:<[^>]*>)?\\s*\\(`);function wi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${No})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,j=e){let{extractVariables:F}=await o("stx/variable-extractor",()=>import("./chunk-88zc5chj.js")),P=b??new Set;if(P.has(e))return`[Circular component reference: ${e}]`;let O=new Set(P);O.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&yg(B)?B:"";try{let H=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),H(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${H(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,be=[];for(let ye of jn(l))if(!be.includes(ye))be.push(ye);let Ze=be.length;for(let ye of c._layerComponentDirs??[])if(!be.includes(ye))be.push(ye);if(_e){let ye=ae.join(ae.dirname(_e),"components");be.push(ye)}let Re=c._rootComponentsDir;if(typeof Re==="string"&&Do(n,c)&&!be.includes(Re))be.push(Re);if(n&&!be.includes(n))be.push(n);if(typeof Re==="string"&&!be.includes(Re))be.push(Re);let pt=ae.join(ae.dirname(l),"components");if(!be.includes(pt))be.push(pt);if(c.componentsDir&&c.componentsDir!==n&&!be.includes(c.componentsDir))be.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let Jt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),dt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),cs=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ls=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),yt=!dt.includes("valuechange")&&(cs||dt.includes("change")&&!ls),vt=c._nativeHostAttrs&&/^textinput$/i.test(G),$n=dt.includes("update:value")&&!dt.includes("input"),En=c._nativeHostAttrs&&/^video$/i.test(G),Rn=c._nativeHostAttrs&&/^image$/i.test(G),Et=Ds([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),Cn=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Tn=En&&(Cn||An)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),In=new Set(["","primary","secondary","outline","ghost","danger"]),On=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",Go=c._nativeHostAttrs&&/^button$/i.test(G)&&!In.has(On),us=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&(!Jt||yt)&&(!vt||$n)&&(!En||Tn)&&(!Rn||Et)&&!Go;for(let ye of us?[]:c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let kt=typeof c.root==="string"?ae.resolve(c.root):void 0,gr=kt??ae.dirname(l),Rt=[];if(kt)Rt.push(ae.resolve(kt,"resources/views/components")),Rt.push(ae.resolve(kt,"resources/components")),Rt.push(ae.resolve(kt,"src/components")),Rt.push(ae.resolve(kt,"components"));Rt.push(ae.resolve(import.meta.dir,"components"));for(let ye of Rt)if(!be.includes(ye))be.push(ye);if(us){let ye=(c._pluginComponentDirs??[]).filter((it)=>typeof it==="string"&&it.length>0);if(ye.length){let it=be.slice(Ze).map((Ye)=>ae.isAbsolute(Ye)?Ye:ae.resolve(gr,Ye)),_t=`${G}\x00${it.join("\x00")}`,mt=rr.get(_t);if(mt===void 0){mt=!1;for(let Ye of it){for(let ht of ce)if(await r(ae.join(Ye,ht))){mt=!0;break}if(mt)break}rr.set(_t,mt)}if(!mt){let Ye=ye.filter((ht)=>!be.includes(ht));if(Ye.length)be.splice(Ze,0,...Ye)}}}let mr=c._pluginComponentDirs;if(Array.isArray(mr)){for(let ye of mr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(c.fallbackComponentsDir&&!be.includes(c.fallbackComponentsDir))be.push(c.fallbackComponentsDir);if(us){for(let ye of c._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let Pn=c._nativePrimitivesFallback;if(Pn&&!Pn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!be.includes(Pn.dir))be.push(Pn.dir);let hr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve(gr,ye)}))];be.length=0,be.push(...hr);let fs=`${G}\x00${l}\x00${hr.join("\x00")}`,ps=Qn.get(fs);if(ps)if(await r(ps))D=ps;else Qn.delete(fs);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of be){if(!ye)continue;for(let it of ce){let _t=ae.join(ye,it);if(ne.push(_t),await r(_t)){D=_t;break}}if(D)break;if(!D)try{let it=await import("fs");if(!it.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let mt=8,Ye=[{path:ye,depth:0}];while(Ye.length>0&&!D){let ht=Ye.pop();if(ht.depth>=mt)continue;let yr;try{yr=it.readdirSync(ht.path,{withFileTypes:!0})}catch{continue}for(let Mn of yr){if(!Mn.isDirectory())continue;if(Mn.name==="node_modules"||Mn.name.startsWith("."))continue;let $r=ae.join(ht.path,Mn.name);for(let Yo of ce){let ds=ae.join($r,Yo);if(ne.push(ds),await r(ds)){D=ds;break}}if(D)break;Ye.push({path:$r,depth:ht.depth+1})}}}catch{}if(D)break}if(D)Qn.set(fs,D)}if(!D||!await r(D))return To(e,l,ne),Io(e);v.add(D);let te;if(on.has(D)&&sr.get(D)===Eo(D))te=on.get(D);else try{let re=Eo(D);te=await Bun.file(D).text(),on.set(D,te),sr.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return To(e,l,[D],ce),Io(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(ru.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(Oo.has(ce))continue;Oo.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Wn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))he[re]=ce;let ue=E.length>0?{[Zn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-h5aaq0j8.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-vv3w8z4v.js")),ce={...a,__processedComponents:P,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Te=[];if(Yc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-5p6x0ztt.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(_e[1].trim())}let We=J(Ee),Ke=[],Qe=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",be=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ze=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Re=!Ze||["module","text/javascript","application/javascript"].includes(Ze),pt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Re&&!pt)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-4wgfqa56.js")),tt=Xe(Qe),Je={};if(tt.defaultSlot?.trim())Je.default=tt.defaultSlot;for(let[re,ce]of tt.namedSlots)Je[re]=ce.content;let bt=a.__stx_scope_seq??={n:0,key:Us(String(a.__filename??l))},zt=jo(e,process.cwd()),at=`stx_${(zt.endsWith(".stx")?zt.slice(0,-4):zt).replace(/[^a-zA-Z0-9]/g,"_")}_${++bt.n}_${bt.key}`,Pe={...he,$uid:at,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Qe,$slots:Je,__processedComponents:O,__sections:{},__stx_signals_gate:ke(te)||Yc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-vv3w8z4v.js"));te=await re(te,Pe,D,c,v)}tu(te,Pe);let Wt=te,cn=pe(Wt);if(cn)Wt=cn.content.trim();let ss=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ft=[...te.matchAll(ss)];for(let[,re,ce]of Ft)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ge=[],Vt=null,rs=Ft.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),$t=null,lt=null,Ut=null,ln=0,Ht=null;if(Kl(c),rs&&ar>0){let re=Xl({props:t,slot:Ee,slotContext:i.trim()?Jl(he):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:at});if(re!==null){$t=`${D}\x00${S(te)}\x00${re}`;let ce=es.get($t);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ii(a,ce.clientFactories),bt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let be of ce.preservedClientExpressions)_e.add(be);a.__stx_preserved_client_expressions=[..._e]}return ce.output}lt=new Set(v),Ut=si(a),ln=bt.n,Ht=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let qt=new Set;for(let re of Ft){let ce=re[1]||"",_e=re[2]||"",be=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(be&&_e){for(let Re of De(_e))qt.add(Re);try{await F(_e,Pe,D,{onFailure:(Re)=>{if(Re.kind!=="unknown")Vt=Re.kind}})}catch(Re){}}if(!be){let Re=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),pt=Re.includes("{{")&&Re.includes("}}"),Jt=Re.includes("{!!")&&Re.includes("!!}");if(pt||Jt)Re=xi(Re,Pe,D);let dt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ge.push(`<script${dt}>${Re}</script>`)}}let et=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Zt=et?et[1]:"",is=et?et[2]:"",ut="",se=Zt&&/\bscoped\b/i.test(Zt);if(et)ut=`<style${Zt}>${su(is,Pe,D)}</style>`;let oe=Wt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),et)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,be)=>{let Ze=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ze)ce.push(`<style${Ze[1]}>${Ze[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)ut=`${ut}${ce.join(`
574
- `)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-4wgfqa56.js")),{defaultSlot:we,namedSlots:Ae}=tt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Qe),nt=Ge.length>0&&As(oe)||c._nativeHostAttrs===!0&&Ge.length>0||Ve&&Ge.length>0||Ge.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),os=(re)=>nt?Gi(re,at):re,as=new Map([...Ae].map(([re,ce])=>[re,{...ce,content:os(ce.content)}]));oe=await de(oe,nt?Ji(os(we),at):we,as,Pe,nt?at:"");let un=wi(Ge),Kt=(Array.isArray(Pe.__stx_client_signal_names)?Pe.__stx_client_signal_names:[]).filter((re)=>!qt.has(re));if(un.length>0||Kt.length>0)Pe.__stx_client_signal_names=[...new Set([...Kt,...un])];else delete Pe.__stx_client_signal_names;let Xt=E.filter((re)=>!qt.has(re)&&!(re in t));if(Xt.length>0)Pe[Zn]=Xt;let dn={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||nt||Ge.length===0,defaultLayout:void 0};Pe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:_n}=await o("stx/process",()=>import("./chunk-xbavxkm5.js")),rt=await _n(oe,Pe,D,dn,v),gt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of rt.matchAll(/\{\{([\s\S]*?)\}\}/g))gt.add(re[1].trim());if(gt.size>0)a.__stx_preserved_client_expressions=[...gt];let ft=at,qe=rt;if(nt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${tr(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${tr(L)}"`:"",_e=Object.fromEntries(Object.entries(Je).map(([yt,vt])=>[yt,Boolean(vt)])),be=Object.keys(_e).length>0?` data-stx-slots="${tr(JSON.stringify(_e))}"`:"",Ze=` data-stx-scope="${ft}"${re}${be}${ce}`,Re=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(rt),pt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(rt),Jt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(rt),dt=Re?"span":"div",cs=pt&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Jt&&c._nativeHostAttrs?' style="width:100%;height:100%"':Re||pt?' style="display:contents"':"";qe=hg(rt,Ze)??`<${dt}${Ze} data-stx-component-wrapper${cs}>${rt}</${dt}>`;let ls=await Promise.all(Ge.map(async(yt)=>{let vt=yt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!vt)return yt;let[,$n,En]=vt,Rn=vo(yt,Pe,D);if(Rn!==null)return Rn;let Et=await ou(En,D,c.buildMode==="compile"),Cn=wn(Et.clientCode,Le(Pe)),{vendorStyleTags:An}=Et,Tn=Cn?`function(__scopeId) {
575
- ${Cn}
576
- return (${Et.factoryBody})(__scopeId);
577
- }`:Et.factoryBody,In=L?null:Ss(a,Tn),On=In?`window.__stxComponentFactories[${JSON.stringify(In)}](${JSON.stringify(ft)});`:`(${Tn})(${JSON.stringify(ft)});`;if(L)return`${An}<script type="stx/island" data-stx-island="${ft}" data-stx-scoped data-stx-owner="${ft}"${$n}>${On}</script>`;return`${An}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ft}"${$n}>${On}</script>`}));if(qe=qe+`
578
- `+ls.join(`
579
- `),ut)qe+=`
580
- `+ut}else{if(ut)qe+=`
581
- `+ut;if(Ge.length>0){let re=Pe.__stx_event_bindings||[],ce=Le(Pe),_e=await Promise.all(Ge.map(async(be)=>{let Ze=vo(be,Pe,D);if(Ze!==null)return Ze;let Re=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Re)return be;return await je(Re[1],{eventBindings:re,templateContent:qe,filePath:D,projectRoot:process.cwd(),serverData:ce,instanceId:at})}));qe+=`
573
+ `)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Do(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var cu=new Set(["for","if","show","key","ref","class","className","style"]),No=new Set,Fo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Qc=new RegExp(`\\b(?:${Fo})\\s*(?:<[^>]*>)?\\s*\\(`);function vi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Fo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,j=e){let{extractVariables:F}=await o("stx/variable-extractor",()=>import("./chunk-3gzhh69y.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let P=new Set(O);P.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&bg(B)?B:"";try{let H=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),H(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${H(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,he=[];for(let ye of Dn(l))if(!he.includes(ye))he.push(ye);let Ze=he.length;for(let ye of c._layerComponentDirs??[])if(!he.includes(ye))he.push(ye);if(_e){let ye=ae.join(ae.dirname(_e),"components");he.push(ye)}let Re=c._rootComponentsDir;if(typeof Re==="string"&&Wo(n,c)&&!he.includes(Re))he.push(Re);if(n&&!he.includes(n))he.push(n);if(typeof Re==="string"&&!he.includes(Re))he.push(Re);let pt=ae.join(ae.dirname(l),"components");if(!he.includes(pt))he.push(pt);if(c.componentsDir&&c.componentsDir!==n&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!he.includes(ye))he.push(ye);let vt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),mt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ls=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),us=!mt.includes("valuechange")&&(Rn||mt.includes("change")&&!ls),yt=c._nativeHostAttrs&&/^textinput$/i.test(G),Et=mt.includes("update:value")&&!mt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),fs=c._nativeHostAttrs&&/^image$/i.test(G),Cn=Ls([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),kt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Tn=Yt&&(kt||An)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),In=new Set(["","primary","secondary","outline","ghost","danger"]),Pn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",On=c._nativeHostAttrs&&/^button$/i.test(G)&&!In.has(Pn),yr=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())??!1,ps=yr&&(!vt||us)&&(!yt||Et)&&(!Yt||Tn)&&(!fs||Cn)&&!On;for(let ye of ps?[]:c._targetComponentDirs??[])if(ye&&!he.includes(ye))he.push(ye);let Rt=typeof c.root==="string"?ae.resolve(c.root):void 0,$r=Rt??ae.dirname(l),Ct=[];if(Rt)Ct.push(ae.resolve(Rt,"resources/views/components")),Ct.push(ae.resolve(Rt,"resources/components")),Ct.push(ae.resolve(Rt,"src/components")),Ct.push(ae.resolve(Rt,"components"));Ct.push(ae.resolve(import.meta.dir,"components"));for(let ye of Ct)if(!he.includes(ye))he.push(ye);if(yr){let ye=(ps?c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((rt)=>typeof rt==="string"&&rt.length>0);if(ye.length){let rt=he.slice(Ze).map((Je)=>ae.isAbsolute(Je)?Je:ae.resolve($r,Je)).filter((Je)=>!ye.includes(Je)),_t=`${G}\x00${rt.join("\x00")}`,ht=cr.get(_t);if(ht===void 0){ht=!1;for(let Je of rt){for(let dt of ce)if(await r(ae.join(Je,dt))){ht=!0;break}if(ht)break}cr.set(_t,ht)}if(!ht){for(let Je of ye){let dt=he.indexOf(Je);if(dt>=0)he.splice(dt,1)}he.splice(Ze,0,...ye)}}}let Rr=c._pluginComponentDirs;if(Array.isArray(Rr)){for(let ye of Rr)if(typeof ye==="string"&&!he.includes(ye))he.push(ye)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(ps){for(let ye of c._targetComponentDirs??[])if(ye&&!he.includes(ye))he.push(ye)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!he.includes(Mn.dir))he.push(Mn.dir);let Ar=[...new Set(he.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve($r,ye)}))];he.length=0,he.push(...Ar);let ds=`${G}\x00${l}\x00${Ar.join("\x00")}`,gs=es.get(ds);if(gs)if(await r(gs))D=gs;else es.delete(ds);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of he){if(!ye)continue;for(let rt of ce){let _t=ae.join(ye,rt);if(ne.push(_t),await r(_t)){D=_t;break}}if(D)break;if(!D)try{let rt=await import("fs");if(!rt.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let ht=8,Je=[{path:ye,depth:0}];while(Je.length>0&&!D){let dt=Je.pop();if(dt.depth>=ht)continue;let Ir;try{Ir=rt.readdirSync(dt.path,{withFileTypes:!0})}catch{continue}for(let jn of Ir){if(!jn.isDirectory())continue;if(jn.name==="node_modules"||jn.name.startsWith("."))continue;let Pr=ae.join(dt.path,jn.name);for(let na of ce){let ms=ae.join(Pr,na);if(ne.push(ms),await r(ms)){D=ms;break}}if(D)break;Je.push({path:Pr,depth:dt.depth+1})}}}catch{}if(D)break}if(D)es.set(ds,D)}if(!D||!await r(D))return jo(e,l,ne),Do(e);v.add(D);let te;if(cn.has(D)&&ar.get(D)===To(D))te=cn.get(D);else try{let re=To(D);te=await Bun.file(D).text(),cn.set(D,te),ar.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return jo(e,l,[D],ce),Do(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(cu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(No.has(ce))continue;No.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Fn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),be={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))be[re]=ce;let ue=E.length>0?{[Kn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-40bkdswh.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-b3fx75th.js")),ce={...a,__processedComponents:O,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Te=[];if(Zc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-8gdtys3s.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(_e[1].trim())}let We=J(Ee),Ke=[],Qe=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",he=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ze=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Re=!Ze||["module","text/javascript","application/javascript"].includes(Ze),pt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Re&&!pt)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-6nb07mdj.js")),tt=Xe(Qe),Ge={};if(tt.defaultSlot?.trim())Ge.default=tt.defaultSlot;for(let[re,ce]of tt.namedSlots)Ge[re]=ce.content;let bt=a.__stx_scope_seq??={n:0,key:Ws(String(a.__filename??l))},Wt=Bo(e,process.cwd()),ot=`stx_${(Wt.endsWith(".stx")?Wt.slice(0,-4):Wt).replace(/[^a-zA-Z0-9]/g,"_")}_${++bt.n}_${bt.key}`,Pe={...be,$uid:ot,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Qe,$slots:Ge,__processedComponents:P,__sections:{},__stx_signals_gate:ke(te)||Zc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-b3fx75th.js"));te=await re(te,Pe,D,c,v)}iu(te,Pe);let Vt=te,un=pe(Vt);if(un)Vt=un.content.trim();let rs=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...te.matchAll(rs)];for(let[,re,ce]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ye=[],Ht=null,is=Ut.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),$t=null,at=null,qt=null,pn=0,Zt=null;if(Yl(c),is&&fr>0){let re=Ql({props:t,slot:Ee,slotContext:i.trim()?eu(be):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:ot});if(re!==null){$t=`${D}\x00${S(te)}\x00${re}`;let ce=ts.get($t);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ki(a,ce.clientFactories),bt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ce.preservedClientExpressions)_e.add(he);a.__stx_preserved_client_expressions=[..._e]}return ce.output}at=new Set(v),qt=$i(a),pn=bt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let re of Ut){let ce=re[1]||"",_e=re[2]||"",he=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(he&&_e){for(let Re of De(_e))Kt.add(Re);try{await F(_e,Pe,D,{onFailure:(Re)=>{if(Re.kind!=="unknown")Ht=Re.kind}})}catch(Re){}}if(!he){let Re=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),pt=Re.includes("{{")&&Re.includes("}}"),vt=Re.includes("{!!")&&Re.includes("!!}");if(pt||vt)Re=Si(Re,Pe,D);let mt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ye.push(`<script${mt}>${Re}</script>`)}}let et=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=et?et[1]:"",os=et?et[2]:"",lt="",se=Xt&&/\bscoped\b/i.test(Xt);if(et)lt=`<style${Xt}>${au(os,Pe,D)}</style>`;let oe=Vt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),et)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,he)=>{let Ze=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ze)ce.push(`<style${Ze[1]}>${Ze[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)lt=`${lt}${ce.join(`
574
+ `)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-6nb07mdj.js")),{defaultSlot:we,namedSlots:Ae}=tt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Qe),nt=Ye.length>0&&Js(oe)||c._nativeHostAttrs===!0&&Ye.length>0||Ve&&Ye.length>0||Ye.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),as=(re)=>nt?no(re,ot):re,cs=new Map([...Ae].map(([re,ce])=>[re,{...ce,content:as(ce.content)}]));oe=await de(oe,nt?to(as(we),ot):we,cs,Pe,nt?ot:"");let dn=vi(Ye),Jt=(Array.isArray(Pe.__stx_client_signal_names)?Pe.__stx_client_signal_names:[]).filter((re)=>!Kt.has(re));if(dn.length>0||Jt.length>0)Pe.__stx_client_signal_names=[...new Set([...Jt,...dn])];else delete Pe.__stx_client_signal_names;let Gt=E.filter((re)=>!Kt.has(re)&&!(re in t));if(Gt.length>0)Pe[Kn]=Gt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||nt||Ye.length===0,defaultLayout:void 0};Pe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-ndah5rvs.js")),ut=await En(oe,Pe,D,$n,v),gt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of ut.matchAll(/\{\{([\s\S]*?)\}\}/g))gt.add(re[1].trim());if(gt.size>0)a.__stx_preserved_client_expressions=[...gt];let ft=ot,qe=ut;if(nt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${ir(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${ir(L)}"`:"",_e=Object.fromEntries(Object.entries(Ge).map(([yt,Et])=>[yt,Boolean(Et)])),he=Object.keys(_e).length>0?` data-stx-slots="${ir(JSON.stringify(_e))}"`:"",Ze=` data-stx-scope="${ft}"${re}${he}${ce}`,Re=ut.slice(Pt(ut)),pt=/^<span(?=[\s/>])/i.test(Re),vt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Re),mt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Re),Rn=pt?"span":"div",ls=vt&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':mt&&c._nativeHostAttrs?' style="width:100%;height:100%"':pt||vt?' style="display:contents"':"";qe=yg(ut,Ze)??`<${Rn}${Ze} data-stx-component-wrapper${ls}>${ut}</${Rn}>`;let us=await Promise.all(Ye.map(async(yt)=>{let Et=yt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Et)return yt;let[,Yt,fs]=Et,Cn=Ao(yt,Pe,D);if(Cn!==null)return Cn;let kt=await uu(fs,D,c.buildMode==="compile"),An=vn(kt.clientCode,Le(Pe)),{vendorStyleTags:Tn}=kt,In=An?`function(__scopeId) {
575
+ ${An}
576
+ return (${kt.factoryBody})(__scopeId);
577
+ }`:kt.factoryBody,Pn=L?null:ks(a,In),On=Pn?`window.__stxComponentFactories[${JSON.stringify(Pn)}](${JSON.stringify(ft)});`:`(${In})(${JSON.stringify(ft)});`;if(L)return`${Tn}<script type="stx/island" data-stx-island="${ft}" data-stx-scoped data-stx-owner="${ft}"${Yt}>${On}</script>`;return`${Tn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ft}"${Yt}>${On}</script>`}));if(qe=qe+`
578
+ `+us.join(`
579
+ `),lt)qe+=`
580
+ `+lt}else{if(lt)qe+=`
581
+ `+lt;if(Ye.length>0){let re=Pe.__stx_event_bindings||[],ce=Le(Pe),_e=await Promise.all(Ye.map(async(he)=>{let Ze=Ao(he,Pe,D);if(Ze!==null)return Ze;let Re=he.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Re)return he;return await je(Re[1],{eventBindings:re,templateContent:qe,filePath:D,projectRoot:process.cwd(),serverData:ce,instanceId:ot})}));qe+=`
582
582
  `+_e.join(`
583
- `),Pe.__stx_event_bindings=[]}}if(se){let re=Fs(qe,D);if(re.hasScoped)qe=re.html}if($t&&lt){let re=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];es.set($t,{output:qe,dependencies:[...v].filter((ce)=>!lt.has(ce)),clientFactories:Ut?ri(a,Ut):[],uidsConsumed:bt.n-ln,preservedClientExpressions:Ht?re.filter((ce)=>!Ht.has(ce)):[]})}if(Vt)qe=`<!--stx-render-failed:${Vt}-->${qe}`;return Ke.length>0?`${qe}
583
+ `),Pe.__stx_event_bindings=[]}}if(se){let re=zs(qe,D);if(re.hasScoped)qe=re.html}if($t&&at){let re=Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[];ts.set($t,{output:qe,dependencies:[...v].filter((ce)=>!at.has(ce)),clientFactories:qt?Ei(a,qt):[],uidsConsumed:bt.n-pn,preservedClientExpressions:Zt?re.filter((ce)=>!Zt.has(ce)):[]})}if(Ht)qe=`<!--stx-render-failed:${Ht}-->${qe}`;return Ke.length>0?`${qe}
584
584
  ${Ke.join(`
585
- `)}`:qe}catch(H){if(H instanceof K)throw H;return`[Error processing component: ${H instanceof Error?H.message:String(H)}]`}finally{P.delete(e)}}async function r(e){return Bun.file(e).exists()}function cr(e,t){let i=ae.resolve(t),n=ae.resolve(e),a=i.endsWith(ae.sep)?i:i+ae.sep;if(n===i||n.startsWith(a))return n;return null}async function Po(e,t,i,n){let a=t.startsWith("layouts/")?t.slice(8):t,l=ae.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await r(c)){if(n)console.log(`Found layout in ${e}: ${c}`);return i?.add(c),c}return null}async function vn(e,t,i,n){let a=await iu(e,t,i,n);if(a===null)return null;let l=cr(a,process.cwd());if(l)return l;let c=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=ae.isAbsolute(b)?b:ae.resolve(process.cwd(),b);if(cr(a,v))return ae.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function iu(e,t,i,n){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ae.dirname(t),l=process.cwd();if(e.startsWith("/")){let P=ae.join(l,e),O=cr(P,l);if(!O)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${O}`);if(await r(O)&&n)n.add(O);return O}let c=async(P)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return P;let O=ae.relative(ae.resolve(l,i.fallbackLayoutsDir),P);if(O.startsWith("..")||ae.isAbsolute(O))return P;return await Po(ae.resolve(l,i.layoutsDir),e,n,i.debug)??P},b=ae.join(a,e);if(await r(b)){if(i.debug)console.log(`Found direct path: ${b}`);let P=await c(b);if(n)n.add(P);return P}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let P of[".stx",".tsx",".jsx"]){let O=`${b}${P}`;if(await r(O)){if(i.debug)console.log(`Found direct path with extension: ${O}`);let B=await c(O);if(n)n.add(B);return B}}let v=[];if(v.push(...i._layerLayoutDirs??[]),i.layoutsDir)v.push(ae.isAbsolute(i.layoutsDir)?i.layoutsDir:ae.resolve(process.cwd(),i.layoutsDir));let E=ae.resolve(a),A=process.cwd();for(let P=0;P<10;P++){let O=ae.join(E,"layouts"),B=!1;try{B=ts.statSync(O,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){v.push(O);break}let L=ae.dirname(E);if(L===E||L.length<A.length)break;E=L}for(let P of v){let O=await Po(P,e,n,i.debug);if(O)return O}if(i.fallbackLayoutsDir){let P=ae.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:ae.resolve(process.cwd(),i.fallbackLayoutsDir),O=e.startsWith("layouts/")?e.slice(8):e,B=[ae.join(P,O)];if(!e.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let L of B)if(await r(L)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${L}`);if(n)n.add(L);return L}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let P=e.split("layouts/"),O=ae.join(i.partialsDir||a,"layouts",P[1]);if(await r(O)){if(i.debug)console.log(`Found in layouts path: ${O}`);if(n)n.add(O);return O}if(!O.endsWith(".stx")){let B=`${O}.stx`;if(await r(B)){if(i.debug)console.log(`Found in layouts path with extension: ${B}`);if(n)n.add(B);return B}}}if(i.partialsDir){let P=ae.join(i.partialsDir,"layouts");if(await r(P)){let O=ae.join(P,e);if(await r(O)){if(i.debug)console.log(`Found in partials layouts dir: ${O}`);if(n)n.add(O);return O}if(!e.endsWith(".stx")){let B=`${O}.stx`;if(await r(B)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(n)n.add(B);return B}}}}let j=i.partialsDir||ae.join(process.cwd(),"views"),F=ae.join(j,e);if(await r(F)){if(i.debug)console.log(`Found in views path: ${F}`);if(n)n.add(F);return F}if(!e.endsWith(".stx")){let P=`${F}.stx`;if(await r(P)){if(i.debug)console.log(`Found in views path with extension: ${P}`);if(n)n.add(P);return P}}if(a.includes("temp")){let P=ae.join(ae.dirname(a),"layouts",e);if(await r(P)){if(i.debug)console.log(`Found in temp layouts dir: ${P}`);if(n)n.add(P);return P}if(!e.endsWith(".stx")){let O=`${P}.stx`;if(await r(O)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${O}`);if(n)n.add(O);return O}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function Qc(e,t,i){let n=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
586
- `),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){n=v+1,a=c[v].trim();let E=Math.max(0,v-2),A=Math.min(c.length,v+3);l=c.slice(E,A).map((j,F)=>{let P=E+F+1;return`${P===n?"> ":" "}${P}: ${j}`}).join(`
587
- `);break}}else if(i){let c=e.indexOf(i);if(c>=0)return Qc(e,c)}}catch{}return{lineNumber:n,lineContent:a,context:l}}var ve={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 h(e,t,i,n,a,l){let{lineNumber:c,context:b}=Qc(n,a,l),v=i.split("/").pop(),E=0;if(typeof a==="number"&&a>=0&&n){let j=n.lastIndexOf(`
585
+ `)}`:qe}catch(H){if(H instanceof K)throw H;return`[Error processing component: ${H instanceof Error?H.message:String(H)}]`}finally{O.delete(e)}}async function r(e){return Bun.file(e).exists()}function pr(e,t){let i=ae.resolve(t),n=ae.resolve(e),a=i.endsWith(ae.sep)?i:i+ae.sep;if(n===i||n.startsWith(a))return n;return null}async function Lo(e,t,i,n){let a=t.startsWith("layouts/")?t.slice(8):t,l=ae.join(e,a);for(let c of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await r(c)){if(n)console.log(`Found layout in ${e}: ${c}`);return i?.add(c),c}return null}async function xn(e,t,i,n){let a=await lu(e,t,i,n);if(a===null)return null;let l=pr(a,process.cwd());if(l)return l;let c=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((b)=>typeof b==="string"&&b.length>0);for(let b of c){let v=ae.isAbsolute(b)?b:ae.resolve(process.cwd(),b);if(pr(a,v))return ae.resolve(a)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${a} (template: ${e}, from: ${t})`),null}async function lu(e,t,i,n){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let a=ae.dirname(t),l=process.cwd();if(e.startsWith("/")){let O=ae.join(l,e),P=pr(O,l);if(!P)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${P}`);if(await r(P)&&n)n.add(P);return P}let c=async(O)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return O;let P=ae.relative(ae.resolve(l,i.fallbackLayoutsDir),O);if(P.startsWith("..")||ae.isAbsolute(P))return O;return await Lo(ae.resolve(l,i.layoutsDir),e,n,i.debug)??O},b=ae.join(a,e);if(await r(b)){if(i.debug)console.log(`Found direct path: ${b}`);let O=await c(b);if(n)n.add(O);return O}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let O of[".stx",".tsx",".jsx"]){let P=`${b}${O}`;if(await r(P)){if(i.debug)console.log(`Found direct path with extension: ${P}`);let B=await c(P);if(n)n.add(B);return B}}let v=[];if(v.push(...i._layerLayoutDirs??[]),i.layoutsDir)v.push(ae.isAbsolute(i.layoutsDir)?i.layoutsDir:ae.resolve(process.cwd(),i.layoutsDir));let E=ae.resolve(a),A=process.cwd();for(let O=0;O<10;O++){let P=ae.join(E,"layouts"),B=!1;try{B=ns.statSync(P,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){v.push(P);break}let L=ae.dirname(E);if(L===E||L.length<A.length)break;E=L}for(let O of v){let P=await Lo(O,e,n,i.debug);if(P)return P}if(i.fallbackLayoutsDir){let O=ae.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:ae.resolve(process.cwd(),i.fallbackLayoutsDir),P=e.startsWith("layouts/")?e.slice(8):e,B=[ae.join(O,P)];if(!e.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let L of B)if(await r(L)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${L}`);if(n)n.add(L);return L}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let O=e.split("layouts/"),P=ae.join(i.partialsDir||a,"layouts",O[1]);if(await r(P)){if(i.debug)console.log(`Found in layouts path: ${P}`);if(n)n.add(P);return P}if(!P.endsWith(".stx")){let B=`${P}.stx`;if(await r(B)){if(i.debug)console.log(`Found in layouts path with extension: ${B}`);if(n)n.add(B);return B}}}if(i.partialsDir){let O=ae.join(i.partialsDir,"layouts");if(await r(O)){let P=ae.join(O,e);if(await r(P)){if(i.debug)console.log(`Found in partials layouts dir: ${P}`);if(n)n.add(P);return P}if(!e.endsWith(".stx")){let B=`${P}.stx`;if(await r(B)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(n)n.add(B);return B}}}}let j=i.partialsDir||ae.join(process.cwd(),"views"),F=ae.join(j,e);if(await r(F)){if(i.debug)console.log(`Found in views path: ${F}`);if(n)n.add(F);return F}if(!e.endsWith(".stx")){let O=`${F}.stx`;if(await r(O)){if(i.debug)console.log(`Found in views path with extension: ${O}`);if(n)n.add(O);return O}}if(a.includes("temp")){let O=ae.join(ae.dirname(a),"layouts",e);if(await r(O)){if(i.debug)console.log(`Found in temp layouts dir: ${O}`);if(n)n.add(O);return O}if(!e.endsWith(".stx")){let P=`${O}.stx`;if(await r(P)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${P}`);if(n)n.add(P);return P}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function el(e,t,i){let n=0,a="",l="";try{if(typeof t==="number"&&t>=0){let c=e.split(`
586
+ `),b=0;for(let v=0;v<c.length;v++)if(b+=c[v].length+1,b>=t){n=v+1,a=c[v].trim();let E=Math.max(0,v-2),A=Math.min(c.length,v+3);l=c.slice(E,A).map((j,F)=>{let O=E+F+1;return`${O===n?"> ":" "}${O}: ${j}`}).join(`
587
+ `);break}}else if(i){let c=e.indexOf(i);if(c>=0)return el(e,c)}}catch{}return{lineNumber:n,lineContent:a,context:l}}var ve={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 h(e,t,i,n,a,l){let{lineNumber:c,context:b}=el(n,a,l),v=i.split("/").pop(),E=0;if(typeof a==="number"&&a>=0&&n){let j=n.lastIndexOf(`
588
588
  `,Math.max(0,a-1));E=a-(j+1)+1}let A="";if(c>0)A+=`
589
589
  ${i}:${c}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${t}
590
590
  `;if(A+=`
@@ -597,8 +597,8 @@ ${ve.yellow}${ve.bold}Message:${ve.reset} ${t}
597
597
  `,b)A+=`
598
598
  ${ve.blue}${ve.bold}Context:${ve.reset}
599
599
  ${ve.dim}${b}${ve.reset}
600
- `;return A}function ge(){on.clear(),sr.clear(),Qn.clear(),rr.clear(),ir.clear(),or.clear(),es.clear()}function Zh(){return{size:on.size,maxSize:500}}var nr=w(128);async function ou(e,t,i){let n=S(e,t,i),a=nr.get(n);if(a){if(Ls(a.deps))return a;nr.delete(n)}let l=yi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=bi(l.styles);c=Mt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-qs0vtav5.js")),A=[],j=!1;if(v(c)){let G=c;c=await E(G,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),j=c===G}let{stripStxRuntimeImports:F}=await o("stx/signal-processing",()=>import("./chunk-d96b9qgj.js"));c=F(c);let P=I(c),O=Yl(P),B=new Set(V(P,!0).split(",").map((G)=>G.trim())),L=`function(__scopeId) {
601
- ${ct("const",[...pl,...O],P)}
600
+ `;return A}function ge(){cn.clear(),ar.clear(),es.clear(),cr.clear(),lr.clear(),ur.clear(),ts.clear()}function Qh(){return{size:cn.size,maxSize:500}}var or=w(128);async function uu(e,t,i){let n=S(e,t,i),a=or.get(n);if(a){if(js(a.deps))return a;or.delete(n)}let l=bi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=wi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-mh4kpnjr.js")),A=[],j=!1;if(v(c)){let G=c;c=await E(G,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),j=c===G}let{stripStxRuntimeImports:F}=await o("stx/signal-processing",()=>import("./chunk-qcars8ar.js"));c=F(c);let O=I(c),P=nu(O),B=new Set(V(O,!0).split(",").map((G)=>G.trim())),L=`function(__scopeId) {
601
+ ${ct("const",[...fl,...P],O)}
602
602
  const __scope = window.stx._scopes = window.stx._scopes || {};
603
603
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
604
604
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -662,12 +662,12 @@ ${ve.dim}${b}${ve.reset}
662
662
  const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
663
663
 
664
664
  try {
665
- ${P}
665
+ ${O}
666
666
 
667
667
  // Register all defined signals and functions in this scope
668
668
  const __localVars = {};
669
669
  try {
670
- ${O.map((G)=>B.has(G)?`Object.defineProperty(__localVars, '${G}', ${Is(G)});`:`if (typeof ${G} !== 'undefined') __localVars['${G}'] = ${G};`).join(`
670
+ ${P.map((G)=>B.has(G)?`Object.defineProperty(__localVars, '${G}', ${Os(G)});`:`if (typeof ${G} !== 'undefined') __localVars['${G}'] = ${G};`).join(`
671
671
  `)}
672
672
  }
673
673
  catch (e) {}
@@ -686,24 +686,24 @@ finally {
686
686
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
687
687
  window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
688
688
  }
689
- }`,H={vendorStyleTags:b,factoryBody:L,clientCode:P,deps:wr([...A,...l.styles.map((G)=>G.resolvedPath)])};if(!j&&l.unresolved.length===0)nr.set(n,H);return H}var bn=["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 au=100,cu=599,ur="__stxResponseStatus",an="__stxResponseHeaders";function ns(e){return typeof e==="number"&&Number.isInteger(e)&&e>=au&&e<=cu}function hn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let n=Number(i[1]);if(ns(n))return n}return}function lr(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!ns(i))return!1;return e[ur]=i,!0}function lu(e,t,i){if(!e||typeof e!=="object")return;let n=String(t??"").trim();if(!n)return;e[an]={...e[an],[n]:String(i)}}function Ot(e){let t=e?.[ur];return ns(t)?t:void 0}function Nt(e){let t=e?.[an];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([n,a])=>[n,String(a)]);return i.length>0?Object.fromEntries(i):void 0}function Bc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=Ot(e);if(i!==void 0)t[ur]=i;let n=Nt(e);if(n)t[an]={...t[an],...n}}function zs(e){return{setResponseStatus:(t)=>{lr(e,t)},notFound:(t=404)=>{let i=ns(t)&&t>=400?t:404;lr(e,i)},setResponseHeader:(t,i)=>{lu(e,t,i)}}}function Fc(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:n,buildMode:a}=i,l=a==="compile",c="",b=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let A=uu(e,E.index+E[0].length-1);if(A<0)break;let j=e.slice(E.index+E[0].length,A).trim(),F=/^\d+$/.test(j)?Number(j):u(j,t),P=n?` in ${n}`:"";if(l)console.warn(`[stx] @status(${j})${P} 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(${j}) from <script server> instead \u2014 that runs per request.`);else if(!lr(t,F))console.warn(`[stx] @status(${j})${P} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,E.index),b=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function uu(e,t){let i=1,n=null,a=!1;for(let l=t+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(n){if(c==="\\")a=!0;else if(c===n)n=null;continue}if(c==='"'||c==="'"||c==="`"){n=c;continue}if(c==="(")i++;else if(c===")"&&--i===0)return l}return-1}var Lo=new Set(bn),fu=new Set(["props","$props","defineProps"]),pu=new Set(["stx","@stacksjs/stx"]),zo=w(128),Bo=w(64);function du(e){let t=[],i=0,n=e.split(`
690
- `);for(let a of n){let l=i,c=null,b=!1;for(let v=0;v<a.length;v++){let E=a[v];if(b){b=!1;continue}if(E==="\\"){b=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let j=E[1].slice(1,-1).split(",").map((F)=>{let P=F.split(":");return(P.length>1?P[1]:P[0]).trim()}).filter((F)=>/^\w+$/.test(F));t.push(...j)}}}}return[...new Set(t)]}function tg(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(n){if(!n.includes(":"))return n;let a=[],l="",c=0,b=0,v=null;for(let E=0;E<n.length;E++){let A=n[E];if(v){if(l+=A,A===v)v=null;continue}if(A==='"'||A==="'"||A==="`"){v=A,l+=A;continue}if(A==="<")c++;else if(A===">"&&c>0)c--;else if(A==="(")b++;else if(A===")")b--;if(A===","&&c===0&&b===0){a.push(l),l="";continue}l+=A}if(l)a.push(l);return a.map((E)=>{let A=E.trim(),j=A.startsWith("..."),F=j?A.slice(3):A,P=-1,O=0;for(let ne=0;ne<F.length;ne++)if(F[ne]==="<")O++;else if(F[ne]===">")O--;else if(F[ne]===":"&&O===0){P=ne;break}if(P===-1)return E;let L=F.substring(0,P).trim().replace(/\?$/,""),H=F.substring(P+1),G=-1,D=0;for(let ne=0;ne<H.length;ne++)if(H[ne]==="<")D++;else if(H[ne]===">")D--;else if(H[ne]==="="&&D===0){G=ne;break}let ee=j?"...":"";if(G!==-1)return`${ee}${L} = ${H.substring(G+1).trim()}`;return`${ee}${L}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,a,l)=>{if(!l.includes(":"))return n;return`${a}(${i(l)})`});{let n=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=n.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,E=0,A=null;while(v<t.length&&b>0){let P=t[v];if(A){if(P===A)A=null;v++;continue}if(P==='"'||P==="'"||P==="`"){A=P,v++;continue}if(P==="<")E++;else if(P===">"&&E>0)E--;else if(E===0){if(P==="(")b++;else if(P===")")b--}if(b>0)v++}if(b!==0)continue;let j=t.substring(c+1,v);if(!j.includes(":"))continue;let F=i(j);l.push({start:c+1,end:v,replacement:F})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:E}=l[c];t=t.substring(0,b)+E+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,a)=>{if(!a.includes(":"))return n;if(a.includes("{")||a.includes("}"))return n;return`(${a.split(",").map((c)=>{let[b,...v]=c.split("="),E=b.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),t=t.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"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
689
+ }`,H={vendorStyleTags:b,factoryBody:L,clientCode:O,deps:vr([...A,...l.styles.map((G)=>G.resolvedPath)])};if(!j&&l.unresolved.length===0)or.set(n,H);return H}var wn=["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 fu=100,pu=599,gr="__stxResponseStatus",ln="__stxResponseHeaders";function ss(e){return typeof e==="number"&&Number.isInteger(e)&&e>=fu&&e<=pu}function yn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let n=Number(i[1]);if(ss(n))return n}return}function dr(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!ss(i))return!1;return e[gr]=i,!0}function du(e,t,i){if(!e||typeof e!=="object")return;let n=String(t??"").trim();if(!n)return;e[ln]={...e[ln],[n]:String(i)}}function Nt(e){let t=e?.[gr];return ss(t)?t:void 0}function Mt(e){let t=e?.[ln];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([n,a])=>[n,String(a)]);return i.length>0?Object.fromEntries(i):void 0}function Fc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=Nt(e);if(i!==void 0)t[gr]=i;let n=Mt(e);if(n)t[ln]={...t[ln],...n}}function Hs(e){return{setResponseStatus:(t)=>{dr(e,t)},notFound:(t=404)=>{let i=ss(t)&&t>=400?t:404;dr(e,i)},setResponseHeader:(t,i)=>{du(e,t,i)}}}function zc(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:n,buildMode:a}=i,l=a==="compile",c="",b=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let A=gu(e,E.index+E[0].length-1);if(A<0)break;let j=e.slice(E.index+E[0].length,A).trim(),F=/^\d+$/.test(j)?Number(j):u(j,t),O=n?` in ${n}`:"";if(l)console.warn(`[stx] @status(${j})${O} 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(${j}) from <script server> instead \u2014 that runs per request.`);else if(!dr(t,F))console.warn(`[stx] @status(${j})${O} is not an HTTP status (100-599) \u2014 ignoring it.`);c+=e.slice(b,E.index),b=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=b}return b===0?e:c+e.slice(b)}function gu(e,t){let i=1,n=null,a=!1;for(let l=t+1;l<e.length;l++){let c=e[l];if(a){a=!1;continue}if(n){if(c==="\\")a=!0;else if(c===n)n=null;continue}if(c==='"'||c==="'"||c==="`"){n=c;continue}if(c==="(")i++;else if(c===")"&&--i===0)return l}return-1}var Vo=new Set(wn),mu=new Set(["props","$props","defineProps"]),hu=new Set(["stx","@stacksjs/stx"]),Uo=w(128),Ho=w(64);function xu(e){let t=[],i=0,n=e.split(`
690
+ `);for(let a of n){let l=i,c=null,b=!1;for(let v=0;v<a.length;v++){let E=a[v];if(b){b=!1;continue}if(E==="\\"){b=!0;continue}if(c){if(E===c)c=null;continue}if(E==="'"||E==='"'||E==="`"){c=E;continue}if(E==="/"&&v+1<a.length&&a[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=a.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(a)){let E=a.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=a.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let j=E[1].slice(1,-1).split(",").map((F)=>{let O=F.split(":");return(O.length>1?O[1]:O[0]).trim()}).filter((F)=>/^\w+$/.test(F));t.push(...j)}}}}return[...new Set(t)]}function ng(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(n){if(!n.includes(":"))return n;let a=[],l="",c=0,b=0,v=null;for(let E=0;E<n.length;E++){let A=n[E];if(v){if(l+=A,A===v)v=null;continue}if(A==='"'||A==="'"||A==="`"){v=A,l+=A;continue}if(A==="<")c++;else if(A===">"&&c>0)c--;else if(A==="(")b++;else if(A===")")b--;if(A===","&&c===0&&b===0){a.push(l),l="";continue}l+=A}if(l)a.push(l);return a.map((E)=>{let A=E.trim(),j=A.startsWith("..."),F=j?A.slice(3):A,O=-1,P=0;for(let ne=0;ne<F.length;ne++)if(F[ne]==="<")P++;else if(F[ne]===">")P--;else if(F[ne]===":"&&P===0){O=ne;break}if(O===-1)return E;let L=F.substring(0,O).trim().replace(/\?$/,""),H=F.substring(O+1),G=-1,D=0;for(let ne=0;ne<H.length;ne++)if(H[ne]==="<")D++;else if(H[ne]===">")D--;else if(H[ne]==="="&&D===0){G=ne;break}let ee=j?"...":"";if(G!==-1)return`${ee}${L} = ${H.substring(G+1).trim()}`;return`${ee}${L}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,a,l)=>{if(!l.includes(":"))return n;return`${a}(${i(l)})`});{let n=/\b(function\s+\w*\s*)\(/g,a,l=[];while((a=n.exec(t))!==null){let c=a.index+a[0].length-1,b=1,v=c+1,E=0,A=null;while(v<t.length&&b>0){let O=t[v];if(A){if(O===A)A=null;v++;continue}if(O==='"'||O==="'"||O==="`"){A=O,v++;continue}if(O==="<")E++;else if(O===">"&&E>0)E--;else if(E===0){if(O==="(")b++;else if(O===")")b--}if(b>0)v++}if(b!==0)continue;let j=t.substring(c+1,v);if(!j.includes(":"))continue;let F=i(j);l.push({start:c+1,end:v,replacement:F})}for(let c=l.length-1;c>=0;c--){let{start:b,end:v,replacement:E}=l[c];t=t.substring(0,b)+E+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,a)=>{if(!a.includes(":"))return n;if(a.includes("{")||a.includes("}"))return n;return`(${a.split(",").map((c)=>{let[b,...v]=c.split("="),E=b.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),t=t.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"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
691
691
 
692
- `),t}function ng(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,n,a]=i,l=n??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function rg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function sg(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function og(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var Wo=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=zo.get(l);if(c===void 0){try{let se=Z({loader:"ts",target:"browser",define:a}),oe=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");oe=oe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=se.transformSync(oe)}catch{c=tg(e)}zo.set(l,c)}let b={exports:{}},v=b.exports,E=Lt.cwd(),A={},j=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((se)=>se[1]).filter((se)=>!se.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(se)),F=new Map;for(let se of j)try{if(se.startsWith(".")){A[se]=await import(ot.resolve(ot.dirname(i),se));continue}let oe=ot.resolve(E,"node_modules",se),de=ot.join(oe,"package.json"),we=JSON.parse(g("fs").readFileSync(de,"utf8")),Ae=we.main||"index.js";if(we.exports){let Ve=typeof we.exports==="string"?we.exports:we.exports["."];if(typeof Ve==="string")Ae=Ve;else if(Ve?.bun)Ae=Ve.bun;else if(Ve?.import)Ae=Ve.import;else if(Ve?.default)Ae=Ve.default}A[se]=await import(ot.resolve(oe,Ae))}catch(oe){if(se.startsWith("."))F.set(se,oe instanceof Error?oe.message:String(oe))}let P=(se)=>{if(A[se])return A[se];let oe=F.get(se);if(oe!==void 0)throw Error(`Cannot require '${se}' from ${i}: ${oe}`);return g(se)},O=t.props||{},B=(se)=>{if(!se)return O;let oe={};for(let[de,we]of Object.entries(se)){let Ae=O[de];if(Ae!==void 0)oe[de]=Ae;else if(typeof we==="function")oe[de]=we();else oe[de]=we}return oe};for(let[se,oe]of Object.entries(O))Object.defineProperty(B,se,{value:oe,enumerable:!0,configurable:!0,writable:!0});let L=(se,oe=!1)=>{if(se===void 0||se===null)return oe;if(typeof se==="string"){let de=se.trim().toLowerCase();if(de===""||de==="true"||de==="1"||de==="on"||de==="yes")return!0;if(de==="false"||de==="0"||de==="off"||de==="no")return!1;return!0}return Boolean(se)},H=(se,oe=0)=>{if(se===void 0||se===null)return oe;if(typeof se==="string"){let we=se.trim();if(we==="")return oe;let Ae=Number(we);return Number.isFinite(Ae)?Ae:oe}let de=Number(se);return Number.isFinite(de)?de:oe};for(let se of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(O,se))continue;try{Object.defineProperty(B,se,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let G=(se)=>{if(!se)return O;let oe={...O};for(let[de,we]of Object.entries(se)){let Ae=we&&typeof we==="object"&&!Array.isArray(we)?we:{type:we};if(oe[de]===void 0&&Ae.default!==void 0)oe[de]=typeof Ae.default==="function"?Ae.default():Ae.default}return oe},D=()=>t.slots||{},ee=(se,oe)=>{let de={...se};for(let[we,Ae]of Object.entries(oe))if(de[we]===void 0)if(typeof Ae==="function")de[we]=Ae();else de[we]=Ae;return de},ne=(se)=>{let oe=()=>se;return oe.set=(de)=>{},oe.update=(de)=>{},oe},te=(se)=>{let oe,de=!1;return()=>{if(!de)try{oe=se(),de=!0}catch{oe=void 0}return oe}},le=(se)=>{},he=(se)=>se(),ue=(se)=>{},Ee=(se)=>{},Te=zs(t);function We(se){let oe=se||{};if(oe.title!==void 0||oe.description!==void 0)Je({title:oe.title,description:oe.description})}function Ke(se){if(!se||typeof se!=="object")return;let oe=t.__stxClientPayload??{};Object.assign(oe,se),t.__stxClientPayload=oe}let Qe=()=>{let se=t.__stxServeContext,oe=t.__stxServeSearch??se?.search??"",de=se?.path??"",we=Object.fromEntries(new URLSearchParams(oe)),Ae=t.query,Ve=Object.keys(we).length>0?we:Ae??{},nt=oe||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:t.params??{},query:Ve,path:de,name:"",fullPath:de+nt,hash:"",matched:[]}},Xe=()=>({push:(se)=>{},replace:(se)=>{},back:()=>{},forward:()=>{},go:(se)=>{}}),tt=(se)=>{let oe=t.__stx_runtime_head||{};t.__stx_runtime_head=Ue(oe,Ce(se||{},{known:Ys,source:"useHead()"}))},Je=(se)=>{tt(Zs(se||{}))},bt=(se)=>({value:se}),zt=(se)=>se,pr=(se)=>({value:typeof se==="function"?se():se}),at=(se,oe)=>{},Pe=(se)=>{},Wt=(se)=>{},cn=(se)=>se?se():Promise.resolve(),ss=(se)=>(oe,...de)=>{},Ft=(se)=>{},Ge=(se,oe)=>{},Vt=(se,oe)=>oe,rs=()=>({value:"light"}),$t=()=>ne(!1),lt=(se)=>ne(!1),Ut=()=>ne(!1),ln=()=>lt("(prefers-color-scheme: dark)"),Ht=()=>lt("(prefers-color-scheme: light)"),qt=()=>lt("(prefers-reduced-motion: reduce)"),dr=()=>lt("(prefers-contrast: more)"),et={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:{}},Zt=new Proxy(et,{get(se,oe){if(oe in se)return se[oe];return},set(se,oe,de){return se[oe]=de,!0}}),is={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},ut=console;try{let se=hi(c,i),oe=new Set(Object.keys(O)),de=Object.keys(t).filter((re)=>!oe.has(re)&&!fu.has(re)&&Bt(re)),we=de.map((re)=>t[re]);if(!de.includes("__stxServeContext"))de.push("__stxServeContext"),we.push(void 0);if(!oe.has("cookies")){let re=t.cookies??t.__stxServeContext?.cookies??{},ce=de.indexOf("cookies");if(ce<0)de.push("cookies"),we.push(re);else we[ce]=re}let Ae=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],nt=[];for(let[re,ce]of Object.entries(O)){if(!Bt(re))continue;if(Ae.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(se))continue;Ve.push(re),nt.push(ce)}let as=du(se).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
693
- `),un=t.params??{},Kt=[],Xt=[];for(let re=0;re<de.length;re++){if(de[re]==="params")continue;Kt.push(de[re]),Xt.push(we[re])}let dn=[...bn,...Ve,...Kt],_n=`return (async () => {
692
+ `),t}function rg(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,n,a]=i,l=n??a;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function sg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function og(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function ig(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var qo=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let a=C(),l=S(e,JSON.stringify(a)),c=Uo.get(l);if(c===void 0){try{let se=Z({loader:"ts",target:"browser",define:a}),oe=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");oe=oe.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),c=se.transformSync(oe)}catch{c=ng(e)}Uo.set(l,c)}let b={exports:{}},v=b.exports,E=Bt.cwd(),A={},j=[...c.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((se)=>se[1]).filter((se)=>!se.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(se)),F=new Map;for(let se of j)try{if(se.startsWith(".")){A[se]=await import(it.resolve(it.dirname(i),se));continue}let oe=it.resolve(E,"node_modules",se),de=it.join(oe,"package.json"),we=JSON.parse(g("fs").readFileSync(de,"utf8")),Ae=we.main||"index.js";if(we.exports){let Ve=typeof we.exports==="string"?we.exports:we.exports["."];if(typeof Ve==="string")Ae=Ve;else if(Ve?.bun)Ae=Ve.bun;else if(Ve?.import)Ae=Ve.import;else if(Ve?.default)Ae=Ve.default}A[se]=await import(it.resolve(oe,Ae))}catch(oe){if(se.startsWith("."))F.set(se,oe instanceof Error?oe.message:String(oe))}let O=(se)=>{if(A[se])return A[se];let oe=F.get(se);if(oe!==void 0)throw Error(`Cannot require '${se}' from ${i}: ${oe}`);return g(se)},P=t.props||{},B=(se)=>{if(!se)return P;let oe={};for(let[de,we]of Object.entries(se)){let Ae=P[de];if(Ae!==void 0)oe[de]=Ae;else if(typeof we==="function")oe[de]=we();else oe[de]=we}return oe};for(let[se,oe]of Object.entries(P))Object.defineProperty(B,se,{value:oe,enumerable:!0,configurable:!0,writable:!0});let L=(se,oe=!1)=>{if(se===void 0||se===null)return oe;if(typeof se==="string"){let de=se.trim().toLowerCase();if(de===""||de==="true"||de==="1"||de==="on"||de==="yes")return!0;if(de==="false"||de==="0"||de==="off"||de==="no")return!1;return!0}return Boolean(se)},H=(se,oe=0)=>{if(se===void 0||se===null)return oe;if(typeof se==="string"){let we=se.trim();if(we==="")return oe;let Ae=Number(we);return Number.isFinite(Ae)?Ae:oe}let de=Number(se);return Number.isFinite(de)?de:oe};for(let se of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(P,se))continue;try{Object.defineProperty(B,se,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let G=(se)=>{if(!se)return P;let oe={...P};for(let[de,we]of Object.entries(se)){let Ae=we&&typeof we==="object"&&!Array.isArray(we)?we:{type:we};if(oe[de]===void 0&&Ae.default!==void 0)oe[de]=typeof Ae.default==="function"?Ae.default():Ae.default}return oe},D=()=>t.slots||{},ee=(se,oe)=>{let de={...se};for(let[we,Ae]of Object.entries(oe))if(de[we]===void 0)if(typeof Ae==="function")de[we]=Ae();else de[we]=Ae;return de},ne=(se)=>{let oe=()=>se;return oe.set=(de)=>{},oe.update=(de)=>{},oe},te=(se)=>{let oe,de=!1;return()=>{if(!de)try{oe=se(),de=!0}catch{oe=void 0}return oe}},le=(se)=>{},be=(se)=>se(),ue=(se)=>{},Ee=(se)=>{},Te=Hs(t);function We(se){let oe=se||{};if(oe.title!==void 0||oe.description!==void 0)Ge({title:oe.title,description:oe.description})}function Ke(se){if(!se||typeof se!=="object")return;let oe=t.__stxClientPayload??{};Object.assign(oe,se),t.__stxClientPayload=oe}let Qe=()=>{let se=t.__stxServeContext,oe=t.__stxServeSearch??se?.search??"",de=se?.path??"",we=Object.fromEntries(new URLSearchParams(oe)),Ae=t.query,Ve=Object.keys(we).length>0?we:Ae??{},nt=oe||(Object.keys(Ve).length>0?`?${new URLSearchParams(Ve).toString()}`:"");return{params:t.params??{},query:Ve,path:de,name:"",fullPath:de+nt,hash:"",matched:[]}},Xe=()=>({push:(se)=>{},replace:(se)=>{},back:()=>{},forward:()=>{},go:(se)=>{}}),tt=(se)=>{let oe=t.__stx_runtime_head||{};t.__stx_runtime_head=Ue(oe,Ce(se||{},{known:Zs,source:"useHead()"}))},Ge=(se)=>{tt(Qs(se||{}))},bt=(se)=>({value:se}),Wt=(se)=>se,hr=(se)=>({value:typeof se==="function"?se():se}),ot=(se,oe)=>{},Pe=(se)=>{},Vt=(se)=>{},un=(se)=>se?se():Promise.resolve(),rs=(se)=>(oe,...de)=>{},Ut=(se)=>{},Ye=(se,oe)=>{},Ht=(se,oe)=>oe,is=()=>({value:"light"}),$t=()=>ne(!1),at=(se)=>ne(!1),qt=()=>ne(!1),pn=()=>at("(prefers-color-scheme: dark)"),Zt=()=>at("(prefers-color-scheme: light)"),Kt=()=>at("(prefers-reduced-motion: reduce)"),br=()=>at("(prefers-contrast: more)"),et={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:{}},Xt=new Proxy(et,{get(se,oe){if(oe in se)return se[oe];return},set(se,oe,de){return se[oe]=de,!0}}),os={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},lt=console;try{let se=yi(c,i),oe=new Set(Object.keys(P)),de=Object.keys(t).filter((re)=>!oe.has(re)&&!mu.has(re)&&Ft(re)),we=de.map((re)=>t[re]);if(!de.includes("__stxServeContext"))de.push("__stxServeContext"),we.push(void 0);if(!oe.has("cookies")){let re=t.cookies??t.__stxServeContext?.cookies??{},ce=de.indexOf("cookies");if(ce<0)de.push("cookies"),we.push(re);else we[ce]=re}let Ae=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Ve=[],nt=[];for(let[re,ce]of Object.entries(P)){if(!Ft(re))continue;if(Ae.has(re))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${re}\\b`).test(se))continue;Ve.push(re),nt.push(ce)}let cs=xu(se).map((re)=>`module.exports.${re} = typeof ${re} !== 'undefined' ? ${re} : module.exports.${re};`).join(`
693
+ `),dn=t.params??{},Jt=[],Gt=[];for(let re=0;re<de.length;re++){if(de[re]==="params")continue;Jt.push(de[re]),Gt.push(we[re])}let $n=[...wn,...Ve,...Jt],En=`return (async () => {
694
694
  ${se}
695
- ${as}
695
+ ${cs}
696
696
  return module.exports
697
- })()`,rt=S(_n,dn.join("\x00")),gt=Bo.get(rt);if(!gt)gt=Function(...dn,_n),Bo.set(rt,gt);let ft=t.__stx_options?.runtimeConfig;if(ft||/\buse(?:Server)?RuntimeConfig\b/.test(c))await Sn(t,i,ft);let qe=await He(t.__stx_runtime_config??kn()??M(),()=>Ar(t,()=>gt(b,v,P,O,B,L,H,G,ee,Ke,Tr,ki,qs,ne,te,le,he,ue,Ee,We,Qe,Xe,tt,Je,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,bt,zt,pr,at,Pe,Wt,cn,ss,Ft,D,Ge,Vt,rs,$t,lt,Ut,ln,Ht,qt,dr,Zt,is,ut,et.confirm,et.alert,et.fetch,un,...nt,...Xt)));if(n.preserveExisting){for(let[re,ce]of Object.entries(qe))if(!(re in t)||t[re]===void 0)t[re]=ce}else Object.assign(t,qe);for(let[re,ce]of Object.entries(O))if(!(re in t))t[re]=ce}catch(se){if(t.__stx_strict_hydration)throw se;let oe=ng(se instanceof Error?se.message:String(se));if(rg(oe))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${oe}`),n.onFailure?.({kind:"module-resolution",message:oe,error:se});else if(sg(se))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${oe}`),n.onFailure?.({kind:"syntax",message:oe,error:se});else if(og(oe))console.warn(`[stx] server <script> in ${i??"<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: ${oe}`),n.onFailure?.({kind:"missing-binding",message:oe,error:se});else{let de=`${i??"<unknown>"}\x00${oe}`;if(Lt.env.STX_DEBUG||!Wo.has(de))Wo.add(de),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${oe}`);n.onFailure?.({kind:"unknown",message:oe,error:se})}try{await yu(c,t,i)}catch(de){if(Lt.env.STX_DEBUG){let we=de instanceof Error?de.message:String(de);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${we}`)}}}}function ig(e){let t=0,i=null,n=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c===i){if(i=null,n||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){i=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)n=!0}return i===null&&t===0&&a}var gu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function hi(e,t){let i=t?ot.dirname(t):Lt.cwd(),n=Lt.cwd(),a=e.split(`
698
- `),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,E=!1,A=c;for(let P=c;P<a.length&&!E;P++){let O=null,B=!1,L=a[P];for(let H=0;H<L.length;H++){let G=L[H];if(B){B=!1;continue}if(G==="\\"){B=!0;continue}if(O){if(G===O)O=null;continue}if(G==='"'||G==="'"||G==="`"){O=G;continue}if(G==="(")v++;else if(G===")"){if(v--,v===0){c=P+1,E=!0;break}}}}if(!E)c=a.length;let j=a.slice(A,c).join(`
699
- `),F=[];for(let P of["title","description"]){let O=new RegExp(`\\b${P}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(j);if(O)F.push(`${P}: ${JSON.stringify(O[2])}`)}if(F.length>0)l.push(`useSeoMeta({ ${F.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,E=0;while(!ig(v)&&c+E+1<a.length)E++,v=`${v} ${a[c+E].trim()}`;c+=E;let A=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),j=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),F=v.match(/^import\s*['"](.+?)['"]/),P=v,O=(B)=>{if(B.startsWith("."))return ot.resolve(i,B);if(B.startsWith("~/")||B.startsWith("@/"))return ot.resolve(n,B.slice(2));try{return Bun.resolveSync(B,i)}catch{return B}};if(A){let[,B,L]=A,H=O(L);l.push(`const ${B} = (await import('${H}')).default`),l.push(`module.exports.${B} = ${B};`)}else if(j){let[,B,L]=j,H=O(L),G=[],D=[],ee=pu.has(L);for(let ne of B.split(",")){let te=ne.trim();if(!te)continue;let le=te.split(/\s+as\s+/);if(le.length===2){let[he,ue]=[le[0].trim(),le[1].trim()];if(ee&&Lo.has(he)){l.push(`const ${ue} = ${he};`);continue}G.push(`${he}: ${ue}`),D.push(ue)}else{if(ee&&Lo.has(te))continue;G.push(te),D.push(te)}}if(G.length>0)l.push(`const { ${G.join(", ")} } = await import('${H}')`);for(let ne of D)l.push(`module.exports.${ne} = ${ne};`)}else if(F){let B=O(F[1]);l.push(`await import('${B}')`)}else l.push(P);c++;continue}if(gu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=Vo(a,c),{type:E,name:A,value:j}=v;l.push(`${E} ${A} = ${j};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=fr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=Vo(a,c),{type:E,name:A,value:j}=v;l.push(`${E} ${A} = ${j};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=fr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...a];E[c]=v;let A=fr(E,c);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);c=A.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],A=a[c].replace(/^export\s+/,""),j=0,F=c;for(;F<a.length;F++){let P=a[F];for(let O of P)if(O==="{")j++;else if(O==="}")j--;if(F>c)A+=`
700
- `+P;if(j<=0&&F>=c)break}l.push(A),l.push(`module.exports.${E} = ${E};`),c=F+1}else l.push(b),c++}else if(b.includes("module.exports"))l.push(b),c++;else if(b.trim()&&!b.startsWith("//"))l.push(b),c++;else c++}return mu(l.join(`
701
- `),i,n)}function mu(e,t,i){let n=e.length,a="",l=0,c=null,b=!1,v=!1,E=0;while(l<n){let A=e[l],j=e[l+1];if(b){if(a+=A,A===`
702
- `)b=!1;l++;continue}if(v){if(a+=A,A==="*"&&j==="/"){a+=j,l+=2,v=!1;continue}l++;continue}if(!c&&A==="/"&&j==="/"){b=!0,a+=A,l++;continue}if(!c&&A==="/"&&j==="*"){v=!0,a+=A,l++;continue}if(c){if(a+=A,A==="\\"){a+=j,l+=2;continue}if(A===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(A==="$"&&j==="{"){E++,a+=j,l+=2;continue}if(A==="`"){c=null,l++;continue}}l++;continue}if(E>0){if(A==="{")E++;else if(A==="}")E--}if(A==='"'||A==="'"||A==="`"){c=A,a+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let F=hu(e,l);if(F){let{quote:P,path:O,end:B}=F;if(O.startsWith(".")||O.startsWith("~/")||O.startsWith("@/")){let L=O.startsWith(".")?ot.resolve(t,O):ot.resolve(i,O.slice(2));a+=`await import(${P}${L}${P})`,l=B;continue}}}a+=A,l++}return a}function hu(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let n=e[i];if(n!=="'"&&n!=='"')return null;i++;let a=i;while(i<e.length&&e[i]!==n)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(a,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:n,path:l,end:i+1}}function Zo(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let a=x(e,i,i==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function Ko(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let n=0,a=0,l="";while(n<i.length){let c=i[n];if(c==="{"||c==="["){let b=a===0?Zo(i,n):null;if(b){t.push(...Ko(b.pattern)),n=b.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){n++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",n++;continue}if(c===":"){l="",n++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",n++;while(n<i.length&&i[n]!==","&&a===0){if(i[n]==="{"||i[n]==="[")a++;else if(i[n]==="}"||i[n]==="]")a--;n++}continue}if(/[\w$]/.test(c))l+=c;n++}if(l.trim())t.push(l.trim());return t}function ag(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,n=(a)=>a===" "||a==="\t";while(i<e.length&&n(e[i]))i++;if(e[i]===":"){let a=0,l=null;i++;for(;i<e.length;i++){let c=e[i];if(l){if(c==="\\"){i++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let b=e[i+1],v=e[i-1];if(b!=="="&&b!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&n(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function Fo(e,t,i,n){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===t)n++;else if(c===i)n--}return n}function Vo(e,t){let i=e[t].trim(),n=ag(i),a=n?[i,n.type,n.name,n.value]:null;if(!a){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let j=i.slice(A[0].length),F=t;if(j.startsWith("{")||j.startsWith("[")){let O=j[0],B=O==="{"?"}":"]",L=Fo(j,O,B,0),H=j;for(let G=t+1;G<e.length&&L>0;G++)H+=` ${e[G].trim()}`,F=G,L=Fo(e[G],O,B,L);if(L>0)H=j,F=t;j=H}let P=Zo(j,0);if(P){let O=A[1],B=P.pattern,L=j.slice(P.endPos).trim();if(L.startsWith("=")){let H=L.slice(1).trim(),G=H,D=Math.max(F,t);if(Uo(H)){let le=Ho(e,D,H);G=le.value,D=le.nextIndex}else D=D+1;G=G.trim().replace(/;$/,"");let ee=Ko(B),ne=`__stx_src_${t}`,te=ee.map((le)=>`module.exports.${le} = ${le};`).join(`
703
- `);return{type:O,name:ne,value:`${G}; ${O} ${B} = ${ne};
704
- ${te}`,nextIndex:D}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,c,b]=a,v=b,E=t;if(Uo(b)){let A=Ho(e,t,b);v=A.value,E=A.nextIndex}else E=t+1;while(E<e.length){let A=e[E].trim();if(A.startsWith(".")||A.startsWith("?."))v+=`
705
- ${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:E}}function fr(e,t){let i=e[t].trim(),n=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${i}`);let[,a]=n,l=i.replace(/^export\s+/,""),c=t;if(xu(i)){let b=bu(e,t,l);l=b.functionCode,c=b.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function Uo(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!Xo(t)}function Xo(e){let t={paren:0,bracket:0,brace:0},i=null,n=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&n===0){i=null;continue}if(i==="`"&&l==="$"&&e[a+1]==="{"){n++,a++;continue}if(n>0&&l==="{"){n++;continue}if(n>0&&l==="}"){n--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function Jo(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=x(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function xu(e){let t=Jo(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function Ho(e,t,i){let n=i,a=t+1;while(a<e.length&&!Xo(n)){let l=e[a];n+=`
697
+ })()`,ut=S(En,$n.join("\x00")),gt=Ho.get(ut);if(!gt)gt=Function(...$n,En),Ho.set(ut,gt);let ft=t.__stx_options?.runtimeConfig;if(ft||/\buse(?:Server)?RuntimeConfig\b/.test(c))await kn(t,i,ft);let qe=await He(t.__stx_runtime_config??_n()??M(),()=>jr(t,()=>gt(b,v,O,P,B,L,H,G,ee,Ke,Dr,_i,Ks,ne,te,le,be,ue,Ee,We,Qe,Xe,tt,Ge,Te.setResponseStatus,Te.setResponseHeader,Te.notFound,bt,Wt,hr,ot,Pe,Vt,un,rs,Ut,D,Ye,Ht,is,$t,at,qt,pn,Zt,Kt,br,Xt,os,lt,et.confirm,et.alert,et.fetch,dn,...nt,...Gt)));if(n.preserveExisting){for(let[re,ce]of Object.entries(qe))if(!(re in t)||t[re]===void 0)t[re]=ce}else Object.assign(t,qe);for(let[re,ce]of Object.entries(P))if(!(re in t))t[re]=ce}catch(se){if(t.__stx_strict_hydration)throw se;let oe=rg(se instanceof Error?se.message:String(se));if(sg(oe))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${oe}`),n.onFailure?.({kind:"module-resolution",message:oe,error:se});else if(og(se))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${oe}`),n.onFailure?.({kind:"syntax",message:oe,error:se});else if(ig(oe))console.warn(`[stx] server <script> in ${i??"<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: ${oe}`),n.onFailure?.({kind:"missing-binding",message:oe,error:se});else{let de=`${i??"<unknown>"}\x00${oe}`;if(Bt.env.STX_DEBUG||!qo.has(de))qo.add(de),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${oe}`);n.onFailure?.({kind:"unknown",message:oe,error:se})}try{await $u(c,t,i)}catch(de){if(Bt.env.STX_DEBUG){let we=de instanceof Error?de.message:String(de);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${we}`)}}}}function ag(e){let t=0,i=null,n=!1,a=!1;for(let l=0;l<e.length;l++){let c=e[l];if(i){if(c===i){if(i=null,n||t===0)a=!0}continue}if(c==="'"||c==='"'||c==="`"){i=c;continue}if(c==="{")t++;else if(c==="}")t--;else if(e.startsWith("from",l)&&t===0)n=!0}return i===null&&t===0&&a}var bu=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function yi(e,t){let i=t?it.dirname(t):Bt.cwd(),n=Bt.cwd(),a=e.split(`
698
+ `),l=[],c=0;while(c<a.length){let b=a[c].trim();if(b.startsWith("interface ")||b.startsWith("export interface ")||b.startsWith("type ")||b.startsWith("export type ")){if(b.includes("{")&&!b.includes("}")){let v=0;for(;c<a.length;c++){for(let E of a[c])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}c++;continue}if(b.startsWith("definePageMeta(")){let v=0,E=!1,A=c;for(let O=c;O<a.length&&!E;O++){let P=null,B=!1,L=a[O];for(let H=0;H<L.length;H++){let G=L[H];if(B){B=!1;continue}if(G==="\\"){B=!0;continue}if(P){if(G===P)P=null;continue}if(G==='"'||G==="'"||G==="`"){P=G;continue}if(G==="(")v++;else if(G===")"){if(v--,v===0){c=O+1,E=!0;break}}}}if(!E)c=a.length;let j=a.slice(A,c).join(`
699
+ `),F=[];for(let O of["title","description"]){let P=new RegExp(`\\b${O}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(j);if(P)F.push(`${O}: ${JSON.stringify(P[2])}`)}if(F.length>0)l.push(`useSeoMeta({ ${F.join(", ")} });`);continue}if(b.startsWith("import ")||b==="import"||b.startsWith("import{")||/^import['"]/.test(b)){let v=b,E=0;while(!ag(v)&&c+E+1<a.length)E++,v=`${v} ${a[c+E].trim()}`;c+=E;let A=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),j=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),F=v.match(/^import\s*['"](.+?)['"]/),O=v,P=(B)=>{if(B.startsWith("."))return it.resolve(i,B);if(B.startsWith("~/")||B.startsWith("@/"))return it.resolve(n,B.slice(2));try{return Bun.resolveSync(B,i)}catch{return B}};if(A){let[,B,L]=A,H=P(L);l.push(`const ${B} = (await import('${H}')).default`),l.push(`module.exports.${B} = ${B};`)}else if(j){let[,B,L]=j,H=P(L),G=[],D=[],ee=hu.has(L);for(let ne of B.split(",")){let te=ne.trim();if(!te)continue;let le=te.split(/\s+as\s+/);if(le.length===2){let[be,ue]=[le[0].trim(),le[1].trim()];if(ee&&Vo.has(be)){l.push(`const ${ue} = ${be};`);continue}G.push(`${be}: ${ue}`),D.push(ue)}else{if(ee&&Vo.has(te))continue;G.push(te),D.push(te)}}if(G.length>0)l.push(`const { ${G.join(", ")} } = await import('${H}')`);for(let ne of D)l.push(`module.exports.${ne} = ${ne};`)}else if(F){let B=P(F[1]);l.push(`await import('${B}')`)}else l.push(O);c++;continue}if(bu.test(b))l.push(a[c]),c++;else if(b.startsWith("export const ")||b.startsWith("export let ")||b.startsWith("export var ")){let v=Ko(a,c),{type:E,name:A,value:j}=v;l.push(`${E} ${A} = ${j};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(b.startsWith("export function ")||b.startsWith("export async function ")){let v=mr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("const ")||b.startsWith("let ")||b.startsWith("var ")){let v=Ko(a,c),{type:E,name:A,value:j}=v;l.push(`${E} ${A} = ${j};`),l.push(`module.exports.${A} = ${A};`),c=v.nextIndex}else if(b.startsWith("function ")||b.startsWith("async function ")){let v=mr(a,c);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),c=v.nextIndex}else if(b.startsWith("export default function ")||b.startsWith("export default async function ")){let v=a[c].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...a];E[c]=v;let A=mr(E,c);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);c=A.nextIndex}else if(b.startsWith("export default ")){let v=b.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),c++}else if(b.startsWith("class ")||b.startsWith("export class ")){let v=b.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],A=a[c].replace(/^export\s+/,""),j=0,F=c;for(;F<a.length;F++){let O=a[F];for(let P of O)if(P==="{")j++;else if(P==="}")j--;if(F>c)A+=`
700
+ `+O;if(j<=0&&F>=c)break}l.push(A),l.push(`module.exports.${E} = ${E};`),c=F+1}else l.push(b),c++}else if(b.includes("module.exports"))l.push(b),c++;else if(b.trim()&&!b.startsWith("//"))l.push(b),c++;else c++}return yu(l.join(`
701
+ `),i,n)}function yu(e,t,i){let n=e.length,a="",l=0,c=null,b=!1,v=!1,E=0;while(l<n){let A=e[l],j=e[l+1];if(b){if(a+=A,A===`
702
+ `)b=!1;l++;continue}if(v){if(a+=A,A==="*"&&j==="/"){a+=j,l+=2,v=!1;continue}l++;continue}if(!c&&A==="/"&&j==="/"){b=!0,a+=A,l++;continue}if(!c&&A==="/"&&j==="*"){v=!0,a+=A,l++;continue}if(c){if(a+=A,A==="\\"){a+=j,l+=2;continue}if(A===c&&c!=="`"){c=null,l++;continue}if(c==="`"){if(A==="$"&&j==="{"){E++,a+=j,l+=2;continue}if(A==="`"){c=null,l++;continue}}l++;continue}if(E>0){if(A==="{")E++;else if(A==="}")E--}if(A==='"'||A==="'"||A==="`"){c=A,a+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let F=_u(e,l);if(F){let{quote:O,path:P,end:B}=F;if(P.startsWith(".")||P.startsWith("~/")||P.startsWith("@/")){let L=P.startsWith(".")?it.resolve(t,P):it.resolve(i,P.slice(2));a+=`await import(${O}${L}${O})`,l=B;continue}}}a+=A,l++}return a}function _u(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let n=e[i];if(n!=="'"&&n!=='"')return null;i++;let a=i;while(i<e.length&&e[i]!==n)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(a,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:n,path:l,end:i+1}}function Yo(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let a=x(e,i,i==="{"?"}":"]",t);if(a===-1)return null;return{pattern:e.slice(t,a+1),endPos:a+1}}function Qo(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let n=0,a=0,l="";while(n<i.length){let c=i[n];if(c==="{"||c==="["){let b=a===0?Yo(i,n):null;if(b){t.push(...Qo(b.pattern)),n=b.endPos,l="";continue}a++}else if(c==="}"||c==="]")a--;if(a>0){n++;continue}if(c===","){if(l.trim())t.push(l.trim());l="",n++;continue}if(c===":"){l="",n++;continue}if(c==="="){if(l.trim())t.push(l.trim());l="",n++;while(n<i.length&&i[n]!==","&&a===0){if(i[n]==="{"||i[n]==="[")a++;else if(i[n]==="}"||i[n]==="]")a--;n++}continue}if(/[\w$]/.test(c))l+=c;n++}if(l.trim())t.push(l.trim());return t}function cg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,n=(a)=>a===" "||a==="\t";while(i<e.length&&n(e[i]))i++;if(e[i]===":"){let a=0,l=null;i++;for(;i<e.length;i++){let c=e[i];if(l){if(c==="\\"){i++;continue}if(c===l)l=null;continue}if(c==="'"||c==='"'||c==="`"){l=c;continue}if(c==="("||c==="["||c==="{"||c==="<"){a++;continue}if(c===")"||c==="]"||c==="}"||c===">"){a--;continue}if(c==="="&&a<=0){let b=e[i+1],v=e[i-1];if(b!=="="&&b!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&n(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function Zo(e,t,i,n){let a=null,l=!1;for(let c of e){if(l){l=!1;continue}if(c==="\\"){l=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c===t)n++;else if(c===i)n--}return n}function Ko(e,t){let i=e[t].trim(),n=cg(i),a=n?[i,n.type,n.name,n.value]:null;if(!a){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let j=i.slice(A[0].length),F=t;if(j.startsWith("{")||j.startsWith("[")){let P=j[0],B=P==="{"?"}":"]",L=Zo(j,P,B,0),H=j;for(let G=t+1;G<e.length&&L>0;G++)H+=` ${e[G].trim()}`,F=G,L=Zo(e[G],P,B,L);if(L>0)H=j,F=t;j=H}let O=Yo(j,0);if(O){let P=A[1],B=O.pattern,L=j.slice(O.endPos).trim();if(L.startsWith("=")){let H=L.slice(1).trim(),G=H,D=Math.max(F,t);if(Xo(H)){let le=Jo(e,D,H);G=le.value,D=le.nextIndex}else D=D+1;G=G.trim().replace(/;$/,"");let ee=Qo(B),ne=`__stx_src_${t}`,te=ee.map((le)=>`module.exports.${le} = ${le};`).join(`
703
+ `);return{type:P,name:ne,value:`${G}; ${P} ${B} = ${ne};
704
+ ${te}`,nextIndex:D}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,c,b]=a,v=b,E=t;if(Xo(b)){let A=Jo(e,t,b);v=A.value,E=A.nextIndex}else E=t+1;while(E<e.length){let A=e[E].trim();if(A.startsWith(".")||A.startsWith("?."))v+=`
705
+ ${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:c,value:v,nextIndex:E}}function mr(e,t){let i=e[t].trim(),n=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${i}`);let[,a]=n,l=i.replace(/^export\s+/,""),c=t;if(wu(i)){let b=Su(e,t,l);l=b.functionCode,c=b.nextIndex}else c=t+1;return{name:a,functionCode:l,nextIndex:c}}function Xo(e){let t=e.trim();if(t.startsWith("{"))return x(t,"{","}",0)===-1;if(t.startsWith("["))return x(t,"[","]",0)===-1;return!ea(t)}function ea(e){let t={paren:0,bracket:0,brace:0},i=null,n=0;for(let a=0;a<e.length;a++){let l=e[a];if((a>0?e[a-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&n===0){i=null;continue}if(i==="`"&&l==="$"&&e[a+1]==="{"){n++,a++;continue}if(n>0&&l==="{"){n++;continue}if(n>0&&l==="}"){n--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function ta(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=x(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function wu(e){let t=ta(e);if(t===-1)return!0;return x(e,"{","}",t)===-1}function Jo(e,t,i){let n=i,a=t+1;while(a<e.length&&!ea(n)){let l=e[a];n+=`
706
706
  ${l}`,a++}while(a<e.length){let l=e[a].trim();if(l.startsWith(".")||l.startsWith("?."))n+=`
707
- ${e[a]}`,a++;else break}return{value:n,nextIndex:a}}function bu(e,t,i){let n=i,a=t+1;while(a<e.length){let l=Jo(n);if(l!==-1){if(x(n,"{","}",l)!==-1)break}let c=e[a];n+=`
708
- ${c}`,a++}return{functionCode:n,nextIndex:a}}function qo(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...Lt.env}})},a=Object.keys(n).filter(Bt),l=a.map((c)=>n[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function yu(e,t,i){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of n){let[,,c,b]=l;try{let v=b.trim().replace(/;$/,""),E=qo(v,t);if(E!==void 0)t[c]=E}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),E=qo(v,t);if(E!==void 0)t[c]=E}catch{}}}function Kc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:n}}function Xc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
709
- export{Ie,xe,V,Is,Os,U,br,Ns,Ms,ai,ci,Ds,li,Ac,At,Oe,o,pn,w,Pc,S,wr,Ls,Se,C,Ne,pe,vr,fn,q,gn,Me,y,Ic,fe,J,xr,Sr,ie,Pt,Y,N,st,kr,_r,It,ui,js,eg,De,Oc,Nc,Mc,di,Dc,Bs,pi,Lc,jc,fi,gi,mn,Fs,hn,Ot,Nt,Bc,zs,Fc,zc,yn,Cr,Hs,Vs,Hc,mi,Vc,Uc,Wc,qc,bn,tg,ng,rg,sg,og,m,ig,hi,ag,Kc,Xc,yi,bi,cg,Mt,Gc,lg,Jc,Yh,Le,wn,je,ug,dg,pg,fg,gg,Us,mg,Be,Z,Fe,hg,Er,yg,Yc,Zc,wi,ze,r,vn,Qc,h,ge,Zh,el,tl,nl,vi,Ws,bg,Qh,wg,ey,Dt,p,W,Q,xn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry};
707
+ ${e[a]}`,a++;else break}return{value:n,nextIndex:a}}function Su(e,t,i){let n=i,a=t+1;while(a<e.length){let l=ta(n);if(l!==-1){if(x(n,"{","}",l)!==-1)break}let c=e[a];n+=`
708
+ ${c}`,a++}return{functionCode:n,nextIndex:a}}function Go(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...Bt.env}})},a=Object.keys(n).filter(Ft),l=a.map((c)=>n[c]);try{return Function(...a,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...a,`'use strict'; return ${e};`)(...l)}catch{return}}}async function $u(e,t,i){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of n){let[,,c,b]=l;try{let v=b.trim().replace(/;$/,""),E=Go(v,t);if(E!==void 0)t[c]=E}catch(v){console.warn(`Failed to parse export ${c} in fallback:`,v)}}let a=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of a){let[,,c,b]=l;if(!(c in t))try{let v=b.trim().replace(/;$/,""),E=Go(v,t);if(E!==void 0)t[c]=E}catch{}}}function Xc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:n}}function Gc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
709
+ export{Ie,xe,V,Os,Ns,U,wr,Ms,Ds,ci,li,Ls,ui,Pc,At,Oe,o,fn,w,Ic,S,vr,js,Se,C,Ne,pe,Pt,gn,q,mn,Me,y,Oc,fe,J,xr,Sr,kr,ie,It,Y,N,st,_r,Cr,Ot,di,Bs,tg,De,Nc,Mc,Dc,pi,Lc,Fs,fi,jc,Bc,gi,mi,hn,zs,yn,Nt,Mt,Fc,Hs,zc,Hc,bn,Er,Vs,Us,Vc,hi,Uc,Wc,qc,Kc,wn,ng,rg,sg,og,ig,m,ag,yi,cg,Xc,Gc,bi,wi,lg,Dt,Jc,ug,Yc,Zh,Le,vn,je,dg,pg,fg,gg,mg,Ws,hg,Be,Z,Fe,yg,Tr,bg,Zc,Qc,vi,ze,r,xn,el,h,ge,Qh,tl,nl,rl,xi,qs,wg,ey,vg,ty,Lt,p,W,Q,Sn,ke,xg,Si,Sg,ny,_,kg,ry,R,sy};