@stacksjs/stx 0.2.572 → 0.2.573

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 (381) hide show
  1. package/dist/a11y.d.ts +51 -111
  2. package/dist/animation.d.ts +131 -74
  3. package/dist/api-client.d.ts +11 -21
  4. package/dist/api-handler.d.ts +4 -4
  5. package/dist/appearance-bootstrap.d.ts +16 -77
  6. package/dist/application-layers.d.ts +11 -20
  7. package/dist/asset-roots.d.ts +7 -27
  8. package/dist/assets.d.ts +7 -9
  9. package/dist/async-components.d.ts +56 -78
  10. package/dist/auth.d.ts +0 -3
  11. package/dist/browser-core-imports.d.ts +2 -2
  12. package/dist/build-externalize-repeated.d.ts +0 -25
  13. package/dist/build-externalize.d.ts +18 -53
  14. package/dist/build-id.d.ts +40 -28
  15. package/dist/build-message.d.ts +20 -44
  16. package/dist/builtins/attrs.d.ts +0 -14
  17. package/dist/builtins/drawer.d.ts +3 -22
  18. package/dist/builtins/icon.d.ts +17 -19
  19. package/dist/builtins/image-alpha.d.ts +8 -8
  20. package/dist/builtins/image-delivery.d.ts +38 -40
  21. package/dist/builtins/image-placeholder.d.ts +12 -50
  22. package/dist/builtins/image-warmup-worker.d.ts +1 -1
  23. package/dist/builtins/image-worker.d.ts +6 -32
  24. package/dist/builtins/index.d.ts +16 -6
  25. package/dist/builtins/modal.d.ts +13 -23
  26. package/dist/builtins/safe-image.d.ts +2 -42
  27. package/dist/builtins/stx-image.d.ts +44 -24
  28. package/dist/builtins/stx-link.d.ts +5 -8
  29. package/dist/builtins/stx-loading-indicator.d.ts +11 -10
  30. package/dist/builtins/suspense.d.ts +6 -27
  31. package/dist/builtins/toast.d.ts +15 -16
  32. package/dist/builtins/transition-group.d.ts +1 -25
  33. package/dist/caching.d.ts +24 -21
  34. package/dist/{chunk-f4jh9vrj.js → chunk-0s647d0b.js} +53 -53
  35. package/dist/{chunk-09gtbb1w.js → chunk-1bsafdnt.js} +1 -1
  36. package/dist/{chunk-m6mxqepz.js → chunk-1btr5tme.js} +1 -1
  37. package/dist/{chunk-01mxer9s.js → chunk-2g6wcnna.js} +1 -1
  38. package/dist/{chunk-rrj5m9xv.js → chunk-2hg2bqtj.js} +1 -1
  39. package/dist/{chunk-xckzvbvn.js → chunk-4f0fh2a9.js} +1 -1
  40. package/dist/chunk-557wtdps.js +2 -0
  41. package/dist/{chunk-vr36s2en.js → chunk-58vrf6kh.js} +1 -1
  42. package/dist/{chunk-qzbzn1yf.js → chunk-6tsnz28m.js} +1 -1
  43. package/dist/{chunk-cvswrbzw.js → chunk-6x8cwscv.js} +1 -1
  44. package/dist/{chunk-1n64749x.js → chunk-74ew8ajw.js} +1 -1
  45. package/dist/{chunk-jqefcghh.js → chunk-78d6yyxz.js} +2 -2
  46. package/dist/{chunk-83fdt4yj.js → chunk-824cnbac.js} +1 -1
  47. package/dist/{chunk-ntgy4e1q.js → chunk-864xm0jy.js} +1 -1
  48. package/dist/{chunk-nn174xjh.js → chunk-9fbkdrm8.js} +1 -1
  49. package/dist/{chunk-kzjrgh0b.js → chunk-a3gvw1q2.js} +1 -1
  50. package/dist/{chunk-pqcvh9pp.js → chunk-amtrg7pn.js} +1 -1
  51. package/dist/{chunk-pw9verqx.js → chunk-b5fpsp5n.js} +1 -1
  52. package/dist/{chunk-5afw7z6v.js → chunk-bcjr3fw7.js} +1 -1
  53. package/dist/{chunk-n6qp05t9.js → chunk-bkj0j5se.js} +1 -1
  54. package/dist/{chunk-mzqyv7s5.js → chunk-cf97xdqa.js} +1 -1
  55. package/dist/{chunk-cgwyd9aq.js → chunk-cr67dpx4.js} +1 -1
  56. package/dist/{chunk-f1apaqfk.js → chunk-dpqvacd1.js} +1 -1
  57. package/dist/{chunk-ghy82tsc.js → chunk-et8726at.js} +1 -1
  58. package/dist/{chunk-4bgfpkwx.js → chunk-ev8t5cxk.js} +1 -1
  59. package/dist/{chunk-s34g3awk.js → chunk-fynh3bkq.js} +1 -1
  60. package/dist/{chunk-gzgc8zk5.js → chunk-g8757f97.js} +2 -2
  61. package/dist/{chunk-3gft8zng.js → chunk-hm4j4d8q.js} +1 -1
  62. package/dist/{chunk-0bt0fbs1.js → chunk-j9qy9t3t.js} +5 -5
  63. package/dist/{chunk-2a1q5y6r.js → chunk-jhc47xzj.js} +1 -1
  64. package/dist/{chunk-79vdkvhf.js → chunk-kns5m52j.js} +1 -1
  65. package/dist/{chunk-2cqbyb8w.js → chunk-mjpewk4r.js} +1 -1
  66. package/dist/{chunk-2jjff8kv.js → chunk-nj488tj2.js} +2 -2
  67. package/dist/{chunk-dcpf6kas.js → chunk-q9chv68c.js} +1 -1
  68. package/dist/{chunk-xq2ck69k.js → chunk-qm280dp3.js} +1 -1
  69. package/dist/{chunk-ymawe0y5.js → chunk-sjcstv33.js} +1 -1
  70. package/dist/{chunk-tc5r2vmw.js → chunk-t0zdz8kd.js} +1 -1
  71. package/dist/{chunk-jwvzvapp.js → chunk-t3dnak1j.js} +1 -1
  72. package/dist/{chunk-2jsnrfc8.js → chunk-t64nnmmj.js} +1 -1
  73. package/dist/{chunk-m2a1fxpb.js → chunk-tvb8p7c0.js} +1 -1
  74. package/dist/{chunk-6f4qrd0s.js → chunk-tyhgq6rw.js} +1 -1
  75. package/dist/{chunk-4wfr074d.js → chunk-vn7tc8hm.js} +1 -1
  76. package/dist/{chunk-y4ajd836.js → chunk-xy6g8zb9.js} +1 -1
  77. package/dist/{chunk-zddzjd60.js → chunk-ya7xks9t.js} +1 -1
  78. package/dist/chunk-zpz6q2fh.js +2 -0
  79. package/dist/chunk-zxt94g45.js +2 -0
  80. package/dist/{chunk-cyg9w31a.js → chunk-zz7tw07b.js} +1 -1
  81. package/dist/{chunk-ta8bhz27.js → chunk-zzcxacjf.js} +1 -1
  82. package/dist/cli.js +7 -7
  83. package/dist/client/directive.d.ts +0 -7
  84. package/dist/client/index.d.ts +1 -0
  85. package/dist/client/signals-appearance-runtime.d.ts +1 -1
  86. package/dist/client/signals-binding-utils-runtime.d.ts +1 -1
  87. package/dist/client/signals-bootstrap-runtime.d.ts +2 -2
  88. package/dist/client/signals-class-runtime.d.ts +1 -1
  89. package/dist/client/signals-component-api-runtime.d.ts +1 -1
  90. package/dist/client/signals-component-hydration-runtime.d.ts +1 -1
  91. package/dist/client/signals-component-props-runtime.d.ts +1 -1
  92. package/dist/client/signals-conditional-chain-runtime.d.ts +1 -1
  93. package/dist/client/signals-conditional-component-runtime.d.ts +1 -1
  94. package/dist/client/signals-container-cleanup-runtime.d.ts +1 -1
  95. package/dist/client/signals-context-runtime.d.ts +1 -1
  96. package/dist/client/signals-cookie-runtime.d.ts +1 -1
  97. package/dist/client/signals-devtools-runtime.d.ts +1 -1
  98. package/dist/client/signals-dialog-runtime.d.ts +1 -1
  99. package/dist/client/signals-dom-ready-runtime.d.ts +1 -1
  100. package/dist/client/signals-drawer-runtime.d.ts +1 -1
  101. package/dist/client/signals-effect-runtime.d.ts +1 -1
  102. package/dist/client/signals-event-shorthand-runtime.d.ts +1 -1
  103. package/dist/client/signals-expression-compiler-runtime.d.ts +1 -1
  104. package/dist/client/signals-expression-runtime.d.ts +1 -1
  105. package/dist/client/signals-fetch-transport-runtime.d.ts +1 -1
  106. package/dist/client/signals-for-runtime.d.ts +1 -1
  107. package/dist/client/signals-globals-runtime.d.ts +1 -1
  108. package/dist/client/signals-handler-runtime.d.ts +1 -1
  109. package/dist/client/signals-head-runtime.d.ts +1 -1
  110. package/dist/client/signals-helpers-runtime.d.ts +1 -1
  111. package/dist/client/signals-host-runtime.d.ts +1 -1
  112. package/dist/client/signals-hydration-audit-runtime.d.ts +1 -1
  113. package/dist/client/signals-hydration-runtime.d.ts +1 -1
  114. package/dist/client/signals-if-chain-runtime.d.ts +1 -1
  115. package/dist/client/signals-if-runtime.d.ts +1 -1
  116. package/dist/client/signals-lazy-hydration-runtime.d.ts +1 -1
  117. package/dist/client/signals-lifecycle-runtime.d.ts +1 -1
  118. package/dist/client/signals-loop-component-remap-runtime.d.ts +1 -1
  119. package/dist/client/signals-loop-conditional-runtime.d.ts +1 -1
  120. package/dist/client/signals-loop-row-runtime.d.ts +1 -1
  121. package/dist/client/signals-manifest-hydration-runtime.d.ts +1 -1
  122. package/dist/client/signals-model-runtime.d.ts +1 -1
  123. package/dist/client/signals-mount-runtime.d.ts +1 -1
  124. package/dist/client/signals-navigation-runtime.d.ts +1 -1
  125. package/dist/client/signals-notify-runtime.d.ts +1 -1
  126. package/dist/client/signals-optimistic-runtime.d.ts +1 -1
  127. package/dist/client/signals-overlay-runtime.d.ts +1 -1
  128. package/dist/client/signals-pipe-runtime.d.ts +1 -1
  129. package/dist/client/signals-proxy-runtime.d.ts +1 -1
  130. package/dist/client/signals-query-runtime.d.ts +1 -1
  131. package/dist/client/signals-reactive-runtime.d.ts +1 -1
  132. package/dist/client/signals-ref-runtime.d.ts +1 -1
  133. package/dist/client/signals-scope-disposal-runtime.d.ts +1 -1
  134. package/dist/client/signals-scope-traversal-runtime.d.ts +1 -1
  135. package/dist/client/signals-show-runtime.d.ts +1 -1
  136. package/dist/client/signals-spa-load-control-runtime.d.ts +1 -1
  137. package/dist/client/signals-spa-load-runtime.d.ts +1 -1
  138. package/dist/client/signals-state-runtime.d.ts +1 -1
  139. package/dist/client/signals-storage-runtime.d.ts +1 -1
  140. package/dist/client/signals-store-registry-runtime.d.ts +1 -1
  141. package/dist/client/signals-style-runtime.d.ts +1 -1
  142. package/dist/client/signals-suspense-runtime.d.ts +1 -1
  143. package/dist/client/signals-timer-runtime.d.ts +1 -1
  144. package/dist/client/signals-toast-runtime.d.ts +1 -1
  145. package/dist/client/signals-tooltip-runtime.d.ts +1 -1
  146. package/dist/client/signals-transition-group-runtime.d.ts +1 -1
  147. package/dist/client/signals-websocket-runtime.d.ts +1 -1
  148. package/dist/client-helpers.d.ts +1 -312
  149. package/dist/client-module-registry.d.ts +4 -27
  150. package/dist/client-parameter-bindings.d.ts +1 -4
  151. package/dist/client-script-bundler.d.ts +55 -103
  152. package/dist/client-script.d.ts +69 -127
  153. package/dist/color-mode-boot.d.ts +21 -58
  154. package/dist/component-client-factories.d.ts +8 -9
  155. package/dist/component-contract-checks.d.ts +15 -18
  156. package/dist/component-contract.d.ts +6 -6
  157. package/dist/component-hmr.d.ts +8 -7
  158. package/dist/component-model.d.ts +14 -20
  159. package/dist/component-processing.d.ts +51 -59
  160. package/dist/component-registry.d.ts +28 -99
  161. package/dist/component-renderer.d.ts +19 -16
  162. package/dist/component-resolution.d.ts +8 -8
  163. package/dist/component-tags.d.ts +1 -1
  164. package/dist/composable-loader.d.ts +6 -41
  165. package/dist/composables/use-fetch.d.ts +45 -114
  166. package/dist/composables/use-form.d.ts +2 -56
  167. package/dist/composables/use-intersection-observer.d.ts +1 -1
  168. package/dist/composables.d.ts +75 -74
  169. package/dist/composition-api.d.ts +19 -43
  170. package/dist/computed.d.ts +93 -86
  171. package/dist/conditionals.d.ts +0 -24
  172. package/dist/config.d.ts +30 -24
  173. package/dist/config.js +3 -0
  174. package/dist/craft-bridge.d.ts +1 -467
  175. package/dist/craft-components.d.ts +234 -680
  176. package/dist/craft-entry.js +1 -1
  177. package/dist/craft.js +1 -1
  178. package/dist/csp.d.ts +41 -107
  179. package/dist/database.d.ts +1 -1
  180. package/dist/defer.d.ts +0 -24
  181. package/dist/dev-server/terminal-colors.d.ts +32 -32
  182. package/dist/dev-server/ts-css.d.ts +26 -35
  183. package/dist/dev-server/types.d.ts +33 -29
  184. package/dist/directive-api.d.ts +42 -85
  185. package/dist/directive-arguments.d.ts +14 -39
  186. package/dist/document-shell.d.ts +49 -81
  187. package/dist/dynamic-components.d.ts +0 -9
  188. package/dist/engine-bindings.d.ts +1 -1
  189. package/dist/env.d.ts +26 -0
  190. package/dist/error-boundaries.d.ts +36 -43
  191. package/dist/error-handling.d.ts +1 -1
  192. package/dist/errors/codes.d.ts +43 -51
  193. package/dist/errors/formatter.d.ts +38 -58
  194. package/dist/errors/index.d.ts +61 -5
  195. package/dist/errors/logger.d.ts +40 -114
  196. package/dist/errors/sanitizer.d.ts +28 -53
  197. package/dist/errors/types.d.ts +31 -44
  198. package/dist/events.d.ts +32 -94
  199. package/dist/expressions.d.ts +57 -62
  200. package/dist/find-body-tag.d.ts +5 -34
  201. package/dist/first-script-tag.d.ts +0 -23
  202. package/dist/forms-validation.d.ts +117 -149
  203. package/dist/forms.d.ts +161 -120
  204. package/dist/framework-composables.d.ts +0 -32
  205. package/dist/head-injection.d.ts +30 -32
  206. package/dist/head-keys.d.ts +12 -15
  207. package/dist/head.d.ts +110 -139
  208. package/dist/heatmap.d.ts +76 -152
  209. package/dist/html-masking.d.ts +38 -62
  210. package/dist/hydration-runtime.d.ts +24 -20
  211. package/dist/hydration.d.ts +11 -10
  212. package/dist/i18n.d.ts +34 -95
  213. package/dist/image-optimization/auto-sibling.d.ts +4 -32
  214. package/dist/imported-signals.d.ts +0 -36
  215. package/dist/includes.d.ts +6 -69
  216. package/dist/index.d.ts +2 -1
  217. package/dist/init.d.ts +12 -20
  218. package/dist/internal-markdown.d.ts +8 -12
  219. package/dist/interpolation-context.d.ts +15 -15
  220. package/dist/island-chunking.d.ts +13 -30
  221. package/dist/keep-alive.d.ts +52 -72
  222. package/dist/layout-types.d.ts +2 -27
  223. package/dist/lazy-module.d.ts +0 -10
  224. package/dist/loading-indicator.d.ts +8 -5
  225. package/dist/loop-binding.d.ts +4 -7
  226. package/dist/loops.d.ts +25 -67
  227. package/dist/markdown.d.ts +1 -0
  228. package/dist/media/image/component.d.ts +9 -25
  229. package/dist/media/image/directive.d.ts +1 -15
  230. package/dist/media/image/placeholder.d.ts +9 -20
  231. package/dist/media/image/processor/cache.d.ts +18 -40
  232. package/dist/media/image/processor/index.d.ts +10 -1
  233. package/dist/media/image/processor/optimizer.d.ts +1 -12
  234. package/dist/media/image/processor/responsive.d.ts +6 -16
  235. package/dist/media/image/srcset.d.ts +49 -47
  236. package/dist/media/shared/cache.d.ts +31 -51
  237. package/dist/media/shared/hash.d.ts +0 -7
  238. package/dist/media/types.d.ts +754 -1235
  239. package/dist/media/video/directive.d.ts +1 -15
  240. package/dist/media/video/index.d.ts +17 -39
  241. package/dist/media/video/processor/cache.d.ts +19 -42
  242. package/dist/media/video/processor/index.d.ts +18 -1
  243. package/dist/media/video/processor/streaming.d.ts +10 -17
  244. package/dist/media/video/processor/thumbnail.d.ts +15 -21
  245. package/dist/media/video/processor/transcoder.d.ts +1 -11
  246. package/dist/meta-arguments.d.ts +14 -39
  247. package/dist/method-spoofing.d.ts +0 -7
  248. package/dist/middleware.d.ts +0 -60
  249. package/dist/native/bridge/protocol.d.ts +2 -1
  250. package/dist/native/compiler/headwind-to-style.d.ts +383 -359
  251. package/dist/native/compiler/icons.d.ts +249 -243
  252. package/dist/native/compiler/svg.d.ts +35 -24
  253. package/dist/native/runtime/jsc-globals.d.ts +1 -1
  254. package/dist/native/runtime/native-host.d.ts +1 -1
  255. package/dist/native/runtime/native-host.js +3 -0
  256. package/dist/offline/app-service-worker.d.ts +50 -114
  257. package/dist/offline/kept-store.d.ts +23 -37
  258. package/dist/offline/query-cache.d.ts +55 -126
  259. package/dist/owned-routes.d.ts +0 -31
  260. package/dist/page-response.d.ts +8 -39
  261. package/dist/parser/directive-parser.d.ts +45 -57
  262. package/dist/parser/expression-parser.d.ts +35 -33
  263. package/dist/parser/index.d.ts +39 -4
  264. package/dist/parser/tokenizer.d.ts +49 -61
  265. package/dist/partial-hydration.d.ts +51 -82
  266. package/dist/performance-utils.d.ts +115 -255
  267. package/dist/placeholder.d.ts +9 -18
  268. package/dist/plugin-system.d.ts +115 -264
  269. package/dist/process.d.ts +4 -9
  270. package/dist/process.js +6 -4
  271. package/dist/prop-sentinels.d.ts +11 -11
  272. package/dist/public-env.d.ts +0 -14
  273. package/dist/pwa/directives.d.ts +20 -12
  274. package/dist/pwa/inject.d.ts +0 -10
  275. package/dist/pwa/precache.d.ts +16 -22
  276. package/dist/pwa/service-worker.d.ts +0 -12
  277. package/dist/pwa.js +1 -1
  278. package/dist/reactive-bindings.d.ts +11 -34
  279. package/dist/reactive-tracking.d.ts +0 -36
  280. package/dist/reactive.d.ts +41 -58
  281. package/dist/render-memo.d.ts +5 -23
  282. package/dist/resolve-stx-targets.d.ts +6 -44
  283. package/dist/route-middleware.d.ts +35 -2
  284. package/dist/route-rules.d.ts +10 -13
  285. package/dist/router.d.ts +9 -8
  286. package/dist/routes.d.ts +3 -1
  287. package/dist/runtime-config-server.d.ts +14 -17
  288. package/dist/runtime-config.d.ts +2 -3
  289. package/dist/runtime-globals.d.ts +90 -122
  290. package/dist/runtime-injection.d.ts +0 -8
  291. package/dist/scaffolding.d.ts +30 -26
  292. package/dist/script-emit.d.ts +0 -30
  293. package/dist/script-validation.d.ts +6 -12
  294. package/dist/seo.d.ts +75 -153
  295. package/dist/server-api.d.ts +9 -12
  296. package/dist/server-bindings.d.ts +1 -26
  297. package/dist/server-data.d.ts +4 -5
  298. package/dist/sfc-template.d.ts +8 -8
  299. package/dist/signal-processing.d.ts +37 -53
  300. package/dist/signals-api.d.ts +58 -135
  301. package/dist/signals.d.ts +18 -24
  302. package/dist/site-url.d.ts +31 -28
  303. package/dist/slots.d.ts +20 -86
  304. package/dist/source-signature.d.ts +5 -28
  305. package/dist/ssg.d.ts +158 -337
  306. package/dist/ssg.js +2 -2
  307. package/dist/state-dir.d.ts +4 -4
  308. package/dist/store-loader.d.ts +0 -10
  309. package/dist/story/analytics.d.ts +60 -138
  310. package/dist/story/bookmarks.d.ts +34 -87
  311. package/dist/story/cli.d.ts +69 -123
  312. package/dist/story/collect/scanner.d.ts +0 -4
  313. package/dist/story/collect/tree.d.ts +1 -8
  314. package/dist/story/commands/build.d.ts +6 -11
  315. package/dist/story/commands/dev.d.ts +8 -15
  316. package/dist/story/commands/preview.d.ts +7 -13
  317. package/dist/story/config-watcher.d.ts +13 -20
  318. package/dist/story/config.d.ts +8 -11
  319. package/dist/story/context.d.ts +8 -14
  320. package/dist/story/hmr.d.ts +26 -24
  321. package/dist/story/hot-swap.d.ts +23 -34
  322. package/dist/story/keyboard-shortcuts.d.ts +18 -23
  323. package/dist/story/output.d.ts +44 -46
  324. package/dist/story/performance.d.ts +45 -107
  325. package/dist/story/presets.d.ts +41 -107
  326. package/dist/story/renderer.d.ts +27 -41
  327. package/dist/story/search.d.ts +12 -23
  328. package/dist/story/server.d.ts +11 -21
  329. package/dist/story/setup.d.ts +15 -23
  330. package/dist/story/testing.d.ts +40 -65
  331. package/dist/story/types.d.ts +160 -262
  332. package/dist/streaming.d.ts +57 -119
  333. package/dist/strip-literals.d.ts +1 -25
  334. package/dist/stx-module-imports.d.ts +7 -0
  335. package/dist/stx-virtual-ts.d.ts +102 -253
  336. package/dist/style-scoping.d.ts +8 -21
  337. package/dist/suspense.d.ts +52 -67
  338. package/dist/teleport.d.ts +0 -22
  339. package/dist/template-syntax-escape.d.ts +8 -8
  340. package/dist/template-tag-balance.d.ts +6 -22
  341. package/dist/testing.d.ts +26 -11
  342. package/dist/theme-tokens.d.ts +388 -134
  343. package/dist/transitions.d.ts +55 -66
  344. package/dist/ts-css-config.d.ts +12 -70
  345. package/dist/types/component-types.d.ts +122 -187
  346. package/dist/types/config-types.d.ts +341 -956
  347. package/dist/types/context-types.d.ts +24 -46
  348. package/dist/types/csp-types.d.ts +66 -70
  349. package/dist/types/directive-types.d.ts +156 -223
  350. package/dist/types/index.d.ts +110 -6
  351. package/dist/types/pwa-types.d.ts +148 -273
  352. package/dist/types.d.ts +1 -0
  353. package/dist/unresolved-identifiers.d.ts +22 -24
  354. package/dist/url-safety.d.ts +32 -32
  355. package/dist/utils.d.ts +21 -36
  356. package/dist/validator.d.ts +26 -28
  357. package/dist/variable-extractor.d.ts +19 -49
  358. package/dist/view-composers.d.ts +81 -80
  359. package/dist/virtual-scrolling.d.ts +82 -101
  360. package/dist/visual-testing.d.ts +10 -9
  361. package/dist/vue-template.d.ts +0 -23
  362. package/dist/web-components/css-scoping.d.ts +11 -21
  363. package/dist/web-components.d.ts +58 -81
  364. package/dist/x-element.d.ts +1 -0
  365. package/package.json +6 -6
  366. package/stx.d.ts +2 -2
  367. package/dist/app-service-worker.d.ts +0 -165
  368. package/dist/chunk-49gwmcrn.js +0 -2
  369. package/dist/chunk-6va5pe2m.js +0 -2
  370. package/dist/chunk-bm2q1srp.js +0 -2
  371. package/dist/signals-context-runtime.d.ts +0 -2
  372. package/dist/signals-drawer-runtime.d.ts +0 -2
  373. package/dist/signals-host-runtime.d.ts +0 -9
  374. package/dist/signals-loop-conditional-runtime.d.ts +0 -2
  375. package/dist/signals-manifest-hydration-runtime.d.ts +0 -2
  376. package/dist/signals-notify-runtime.d.ts +0 -2
  377. package/dist/signals-optimistic-runtime.d.ts +0 -2
  378. package/dist/signals-overlay-runtime.d.ts +0 -2
  379. package/dist/signals-scope-disposal-runtime.d.ts +0 -2
  380. package/dist/signals-spa-load-control-runtime.d.ts +0 -2
  381. package/dist/signals-storage-runtime.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Cn,y,Fi,Dt,Us,zi,Hi,Ui,Vi}from"./chunk-k7ht6tqe.js";import{O}from"./chunk-s12b57m9.js";import{t,Y,dr,i,se,Fs,I,It,xn,zs,l,p,Bi,D,Ce,tt,c,pr}from"./chunk-ydx3mfpp.js";import{En,Tn,yr,Ee}from"./chunk-phzs239m.js";import{S,Ns,Qe,Ls,Oi,gn,mn,Di,ke,Mi,hn,Ni,Pt,js,Li,yn,wn,cr,me,Bs,he,lr}from"./chunk-sfwprq8q.js";import{Is,Os,Ds,Ms,sr,or}from"./chunk-36agnyhe.js";import{Ai,Rs,tr,nr}from"./chunk-tv784gv0.js";import{fe,At,rr,Ps,C,Ye}from"./chunk-rfnr4xz6.js";import{fn}from"./chunk-rrj5m9xv.js";import{Xs}from"./chunk-1edvsndv.js";import{ki,Ci,Ei,Ti}from"./chunk-pnag11c4.js";import{Je}from"./chunk-r47cs92n.js";import{s,xe}from"./chunk-74xwzxwz.js";import{Rt,Ii,un,a,pn}from"./chunk-0g2ybnht.js";import{u}from"./chunk-cg8hg6cs.js";import{E,M,Sn,Hs}from"./chunk-q83w8edy.js";import{br}from"./chunk-h4k3hyny.js";import zr from"path";import ho from"fs";var Rh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ba(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Rh.has(v.toLowerCase())}var Iu=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"]),Pu={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"},Ah=new Set(["ctrl","alt","shift","meta"]),Ou={left:0,middle:1,right:2};function Du(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Ah.has(R))_.systemKeys.push(R);else if(R in Ou)_.mouse=R;else if(R in Pu||/^[a-z]$/.test(R))_.keys.push(Pu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Nu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,V=B.index,H=V+z.length,q=`__stx_evt_${_}${R++}`,Q=[],Z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,ie;while((ie=Z.exec(F))!==null){let[,ae,ce]=ie,de=ae.split("."),le=de[0];if(!Iu.has(le))continue;Q.push({attribute:`@${ae}`,event:le,handler:ce,modifiers:Du(de.slice(1)),elementId:q})}let oe=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((ie=oe.exec(F))!==null){let[,ae,ce]=ie,de=ae.split("."),le=de[0];if(!Iu.has(le))continue;Q.push({attribute:`@${ae}`,event:le,handler:ce,modifiers:Du(de.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:V,endIndex:H})}return k}function Th(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Ou[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Ih(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function za(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Ph(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Th(v),T=Ih(za(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(Ba(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
2
+ import{Cn,y,Fi,Dt,Us,zi,Hi,Ui,Vi}from"./chunk-k7ht6tqe.js";import{O}from"./chunk-s12b57m9.js";import{t,Y,dr,i,se,Fs,I,It,xn,zs,l,p,Bi,D,Ce,tt,c,pr}from"./chunk-ydx3mfpp.js";import{En,Tn,yr,Ee}from"./chunk-phzs239m.js";import{S,Ns,Qe,Ls,Oi,gn,mn,Di,ke,Mi,hn,Ni,Pt,js,Li,yn,wn,cr,me,Bs,he,lr}from"./chunk-sfwprq8q.js";import{Is,Os,Ds,Ms,sr,or}from"./chunk-36agnyhe.js";import{Ai,Rs,tr,nr}from"./chunk-tv784gv0.js";import{fe,At,rr,Ps,C,Ye}from"./chunk-rfnr4xz6.js";import{fn}from"./chunk-2hg2bqtj.js";import{Xs}from"./chunk-1edvsndv.js";import{ki,Ci,Ei,Ti}from"./chunk-pnag11c4.js";import{Je}from"./chunk-r47cs92n.js";import{s,xe}from"./chunk-74xwzxwz.js";import{Rt,Ii,un,a,pn}from"./chunk-0g2ybnht.js";import{u}from"./chunk-cg8hg6cs.js";import{E,M,Sn,Hs}from"./chunk-q83w8edy.js";import{br}from"./chunk-h4k3hyny.js";import zr from"path";import ho from"fs";var Rh=new Set(["touchstart","touchmove","wheel","mousewheel"]);function Ba(v,_){if(_.passive)return!0;if(_.prevent||_.nonpassive)return!1;return Rh.has(v.toLowerCase())}var Iu=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"]),Pu={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"},Ah=new Set(["ctrl","alt","shift","meta"]),Ou={left:0,middle:1,right:2};function Du(v){let _={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let k of v){let R=k.toLowerCase();if(R==="prevent")_.prevent=!0;else if(R==="stop")_.stop=!0;else if(R==="once")_.once=!0;else if(R==="capture")_.capture=!0;else if(R==="self")_.self=!0;else if(R==="passive")_.passive=!0;else if(R==="nonpassive")_.nonpassive=!0;else if(Ah.has(R))_.systemKeys.push(R);else if(R in Ou)_.mouse=R;else if(R in Pu||/^[a-z]$/.test(R))_.keys.push(Pu[R]||R.toUpperCase());else if(R.startsWith("debounce")){let T=R.match(/debounce(?:\.(\d+))?/);_.debounce=T?.[1]?Number.parseInt(T[1],10):300}else if(R.startsWith("throttle")){let T=R.match(/throttle(?:\.(\d+))?/);_.throttle=T?.[1]?Number.parseInt(T[1],10):300}}return _}function Nu(v,_=""){let k=[],R=0,T=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,B;while((B=T.exec(v))!==null){let[z,W,F]=B,V=B.index,H=V+z.length,q=`__stx_evt_${_}${R++}`,Q=[],Z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,ie;while((ie=Z.exec(F))!==null){let[,ae,ce]=ie,de=ae.split("."),le=de[0];if(!Iu.has(le))continue;Q.push({attribute:`@${ae}`,event:le,handler:ce,modifiers:Du(de.slice(1)),elementId:q})}let oe=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((ie=oe.exec(F))!==null){let[,ae,ce]=ie,de=ae.split("."),le=de[0];if(!Iu.has(le))continue;Q.push({attribute:`@${ae}`,event:le,handler:ce,modifiers:Du(de.slice(1)),elementId:q})}if(Q.length>0)k.push({originalTag:z,elementId:q,events:Q,startIndex:V,endIndex:H})}return k}function Th(v){let _=[],{modifiers:k}=v;if(k.self)_.push("if ($event.target !== $el) return");for(let R of k.systemKeys)_.push(`if (!$event.${R}Key) return`);if(k.keys.length>0){let R=k.keys.map((T)=>`$event.key === '${T}'`).join(" || ");_.push(`if (!(${R})) return`)}if(k.mouse!==null){let R=Ou[k.mouse];_.push(`if ($event.button !== ${R}) return`)}if(k.prevent)_.push("$event.preventDefault()");if(k.stop)_.push("$event.stopPropagation()");return _.join("; ")}function Ih(v,_){let k=v;if(_.debounce!==null)k=`__stx_debounce(() => { ${k} }, ${_.debounce})`;else if(_.throttle!==null)k=`__stx_throttle(() => { ${k} }, ${_.throttle})`;return k}function za(v){let _=v.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(_))return v;return`if (typeof ${_} === 'function' && !${_}._isSignal) ${_}($event);`}function Ph(v){let{modifiers:_}=v,k=v.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),R=Th(v),T=Ih(za(v.handler),_),B=[];if(_.once)B.push("once: true");if(_.capture)B.push("capture: true");if(Ba(v.event,_))B.push("passive: true");let z=B.length>0?`, { ${B.join(", ")} }`:"",W=T.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(v.event==="mounted")return`
3
3
  (function() {
4
4
  var $el = document.getElementById('${k}');
5
5
  if (!$el) return;
@@ -112,7 +112,7 @@ else {
112
112
  `)}
113
113
  })();
114
114
  </script>`}function Dh(v,_=""){let k=Nu(v,_);if(k.length===0)return{template:v,bindings:[]};let R=v,T=[];for(let B=k.length-1;B>=0;B--){let z=k[B],W=z.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${z.elementId}"`);else{let F=W.match(/id=["']([^"']+)["']/);if(F)for(let V of z.events)V.elementId=F[1]}for(let F of z.events){let V=F.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${V}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${V}\\s*=\\s*'[^']*'`,"g");W=W.replace(H,""),W=W.replace(q,"")}R=R.slice(0,z.startIndex)+W+R.slice(z.endIndex),T.push(...z.events)}return{template:R,bindings:T}}function Mu(v){let _=v.$uid;return typeof _==="string"&&_?`${_}_`:""}function ju(v,_,k){if(zi(v))return v;if(_.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(v))return v;let{template:W,bindings:F}=Dh(v,Mu(_)),V=_.__stx_event_bindings||[];return _.__stx_event_bindings=[...V,...F],W}let R=Nu(v,Mu(_));if(R.length===0)return v;let T=v;for(let W=R.length-1;W>=0;W--){let F=R[W],V=F.originalTag;if(!V.includes(" id="))V=V.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${F.elementId}"`);else{let H=V.match(/id=["']([^"']+)["']/);if(H)for(let q of F.events)q.elementId=H[1]}for(let H of F.events){let q=H.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Q=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),Z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");V=V.replace(Q,""),V=V.replace(Z,"")}T=T.slice(0,F.startIndex)+V+T.slice(F.endIndex)}let B=Wa(R.flatMap((W)=>W.events)),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
115
- `+T.slice(z);else T+=B;return T}function Lu(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function ko(v,_){let k=s(v),{depths:R,balanced:T}=xe(k),B=(W)=>!T||R[W]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let W of k.matchAll(z)){let F=(W.index??0)+W[0].length-W[1].length;if(B(F))return!0}for(let W of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(W.index??0)&&Lu(W[1],!0).has(_))return!0;for(let W of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(W.index??0)&&Lu(W[1],!1).has(_))return!0;return!1}var Bu="",Eo,gr=/^[A-Za-z_$][\w$]*$/,Mh=new Set(["if","for","while","switch","with"]),zu=["(","[","{"],Wu=[")","]","}"],Oh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Nh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function Fa(v){if(Eo&&v===Bu)return Eo;let{code:_,tokens:k}=Nh(v),R=new Map,T=[];for(let Z=0;Z<k.length;Z++){let ie=k[Z].text;if(["(","[","{"].includes(ie))T.push(Z);else if([")","]","}"].includes(ie)){let oe=T.at(-1);if(oe!==void 0&&["()","[]","{}"].includes(k[oe].text+ie))T.pop(),R.set(oe,Z),R.set(Z,oe)}}function B(Z,ie){let oe=[],ae=Z;for(let ce=Z;ce<ie;ce++){if(["(","[","{"].includes(k[ce].text)&&(R.get(ce)??ie)<ie){ce=R.get(ce);continue}if(k[ce].text===",")oe.push([ae,ce]),ae=ce+1}return oe.push([ae,ie]),oe}let z=[];function W(Z,ie,oe){if(k[Z]?.text==="...")Z++;if(Z>=ie)return;let ae=k[Z].text;if(gr.test(ae)){if(oe.add(ae),oe===H)z.push({name:ae,token:Z});return}if(ae!=="{"&&ae!=="[")return;let ce=R.get(Z);if(ce===void 0||ce>=ie)return;for(let[de,le]of B(Z+1,ce)){let ge=de;if(ae==="{")for(let ye=de;ye<le;ye++){if(k[ye].text===":"){ge=ye+1;break}if(k[ye].text==="=")break;if(["(","[","{"].includes(k[ye].text)&&R.has(ye))ye=R.get(ye)}W(ge,le,oe)}}function F(Z,ie){let oe=new Set;for(let[ae,ce]of B(Z,ie))W(ae,ce,oe);return oe}function V(Z){let ie=Z;for(;ie<k.length;ie++){let oe=k[ie].text;if(["(","[","{"].includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if([",",";",")","]","}"].includes(oe))break}return k[Math.max(Z,ie-1)]?.end??_.length}let H=new Set,q=[];for(let Z=0;Z<k.length;Z++)if(k[Z].text==="=>"){let ie=Z-1,oe=ie,ae;if(k[ie]?.text===")"&&R.has(ie))oe=R.get(ie),ae=F(oe+1,ie);else if(k[ie]&&gr.test(k[ie].text))ae=new Set([k[ie].text]);else continue;let ce=Z+1,de=k[ce]?.text==="{"&&R.has(ce)?k[R.get(ce)].end:V(ce);q.push({start:k[oe].start,end:de,names:ae})}else if(k[Z].text==="("&&R.has(Z)){let ie=k[Z-1]?.text;if(!ie||Mh.has(ie)||!gr.test(ie)&&ie!=="*"&&ie!=="]")continue;let oe=R.get(Z),ae=oe+1;if(k[ae]?.text===":"){ae++;while(ae<k.length&&!["{","=>",";","="].includes(k[ae].text))ae++}if(k[ae]?.text!=="{"||!R.has(ae))continue;q.push({start:k[Z].start,end:k[R.get(ae)].end,names:F(Z+1,oe)})}function Q(Z){let ie=Z;for(;ie<k.length;ie++){let oe=k[ie].text;if(zu.includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if(oe===";"||Wu.includes(oe))break;let ae=k[ie-1];if(ie>Z&&Oh.has(oe)&&ae.text!==".")break;if(ie>Z&&/[\n\r]/.test(_.slice(ae.end,k[ie].start))&&(/^[\w$]+$/.test(ae.text)||Wu.includes(ae.text)||['"',"'","`"].includes(ae.text))&&gr.test(oe)&&!["in","of","instanceof"].includes(oe))break}return ie}for(let Z=0;Z<k.length;Z++){let ie=k[Z].text,oe=k[Z-1]?.text;if(oe==="."||k[Z+1]?.text===":")continue;if(oe==="as"||oe==="<")continue;if(ie==="const"||ie==="let"||ie==="var"){let ae=Q(Z+1),ce=Z+1,de=!1,le=!1,ge=0;for(let ye=Z+1;ye<=ae;ye++){let Se=k[ye]?.text;if(ye<ae&&zu.includes(Se)&&R.has(ye)&&R.get(ye)<ae){ye=R.get(ye);continue}if(ye<ae&&Se===":"&&!le)de=!0;else if(ye<ae&&Se==="="&&ge===0)de=!1,le=!0;else if(ye<ae&&de&&Se==="<")ge++;else if(ye<ae&&de&&Se===">"&&ge>0)ge--;else if(ye===ae||Se===","&&ge===0)W(ce,ye,H),ce=ye+1,de=!1,le=!1}}else if(ie==="function"||ie==="class"){let ae=Z+1;if(k[ae]?.text==="*")ae++;if(k[ae]&&gr.test(k[ae].text)&&k[ae].text!=="extends")H.add(k[ae].text),z.push({name:k[ae].text,token:ae})}else if(ie==="import"){let ae=Z+1;if(k[ae]?.text==="*"&&k[ae+1]?.text==="as")ae+=2;let ce=k[ae]?.text;if(ce&&gr.test(ce)&&ce!=="type"&&k[ae+1]?.text!=="("&&k[ae+1]?.text!==".")H.add(ce),z.push({name:ce,token:ae,file:!0});let de=k[ae]?.text==="{"?ae:k[ae+1]?.text===","&&k[ae+2]?.text==="{"?ae+2:-1;if(de!==-1&&R.has(de)){let le=R.get(de);for(let[ge,ye]of B(de+1,le)){let Se=ye-1;while(Se>=ge&&!gr.test(k[Se].text))Se--;if(Se>=ge&&k[Se].text!=="type")z.push({name:k[Se].text,token:Se,file:!0})}}}}return Bu=v,Eo={code:_,scopes:q,declarations:H,sites:z,tokens:k,pairs:R},Eo}function Va(v){let _=Fa(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Co(v){return new Set(Fa(v).declarations)}function Ko(v,_){let{scopes:k,sites:R,tokens:T,pairs:B}=Fa(v),z=Array.from({length:T.length},()=>-1),W=[];for(let Q=0;Q<T.length;Q++){z[Q]=W.length?W[W.length-1]:-1;let Z=T[Q].text;if(Z==="{"&&B.has(Q))W.push(Q);else if(Z==="}"&&W.length&&B.get(Q)===W[W.length-1])W.pop()}let F=new Set,V=new Map;for(let Q of R){if(!_.has(Q.name))continue;F.add(Q.token);let Z=Q.file?-1:z[Q.token],ie=Z===-1?[0,Number.POSITIVE_INFINITY]:[T[Z].start,T[B.get(Z)].end],oe=V.get(Q.name);if(oe)oe.push(ie);else V.set(Q.name,[ie])}let H=new Set;for(let Q=0;Q<T.length;Q++){if(T[Q].text!=="import"||T[Q-1]?.text===".")continue;let Z=Q+1;if(T[Z]?.text==="type")Z++;if(T[Z]&&gr.test(T[Z].text)&&T[Z+1]?.text===",")Z+=2;if(T[Z]?.text==="{"&&B.has(Z))for(let ie=Z+1;ie<B.get(Z);ie++)H.add(ie)}let q=new Set;for(let Q=0;Q<T.length;Q++){let Z=T[Q].text;if(!_.has(Z)||q.has(Z)||F.has(Q)||H.has(Q))continue;let ie=T[Q-1]?.text;if(ie==="."&&T[Q-2]?.text!=="..")continue;if(T[Q+1]?.text===":"&&(ie==="{"||ie===","))continue;let oe=T[Q].start;if(V.get(Z)?.some(([ae,ce])=>oe>=ae&&oe<ce))continue;if(k.some((ae)=>oe>=ae.start&&oe<ae.end&&ae.names.has(Z)))continue;q.add(Z)}return q}import Ro from"fs";import Wt from"path";function nn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Fu=new Map;function Ao(v,_=!0){let k=Fu.get(v);if(_&&k)return k;let R=new Map,T=[Wt.join(v,"src"),Wt.join(v,"dist"),v];function B(z,W){if(W>6)return;let F;try{F=Ro.readdirSync(z,{withFileTypes:!0})}catch{return}for(let V of F){let H=Wt.join(z,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;B(H,W+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let q=V.name.slice(0,-4);if(!R.has(q))R.set(q,H);let Q=q.toLowerCase();if(!R.has(Q))R.set(Q,H);let Z=nn(q);if(!R.has(Z))R.set(Z,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)Fu.set(v,R);return R}function To(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Wt.join(k,"node_modules",v);try{if(Ro.statSync(R).isDirectory())return R}catch{}let T=Wt.dirname(k);if(T===k)return null;k=T}}function Io(v,_,k={}){return[Wt.resolve(Wt.dirname(_),`${v}.stx`),Wt.resolve(Wt.dirname(_),v),Wt.resolve(k.componentsDir||"components",`${v}.stx`),Wt.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function Vu(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=nn(_);return[_,k,R]}function Ua(v,_){let[k,R,T]=Vu(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*Ha(v,_,k={},R){let T=Vu(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Wt.resolve(Wt.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((F)=>`${F}.stx`))],z=k.projectRoot||process.cwd(),W=[...R?.__originalFilePath?[Wt.join(Wt.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Wt.join(Wt.dirname(_),"components"),Wt.resolve(z,"src/components"),Wt.resolve(z,"components"),...import.meta.dir?[Wt.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(W)){for(let V of B)yield Wt.join(F,V);try{for(let V of Ro.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of B)yield Wt.join(F,V.name,H)}catch{}}}function Uu(v,_,k={},R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))try{if(Ro.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import bh from"fs";import rt from"path";import{createHash as jh}from"crypto";var Po="__stx_component_client_factories";function Do(v){let _=v[Po];return _ instanceof Map?_:null}function qu(v){v[Po]=new Map}function qa(v,_){let k=Do(v);if(!k)return null;let R=jh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function Ku(v,_){let k=Do(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),Q=q.exec(v);while(Q!==null){let Z=R.get(JSON.parse(Q[1]));if(Z!==void 0)T.push({start:Q.index,end:Q.index+Q[0].length,replacement:`(${Z})(${Q[2]});`});Q=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return Hu(v,T);let W=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
115
+ `+T.slice(z);else T+=B;return T}function Lu(v,_){let k=new Set;for(let R of v.split(",")){let T=R.trim().replace(/^\.\.\./,"").trim();if(!T)continue;if(_){let B=T.lastIndexOf(":");if(B!==-1)T=T.slice(B+1).trim()}if(T=T.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(T))k.add(T)}return k}function ko(v,_){let k=s(v),{depths:R,balanced:T}=xe(k),B=(W)=>!T||R[W]===0,z=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${_}\\b)`,"g");for(let W of k.matchAll(z)){let F=(W.index??0)+W[0].length-W[1].length;if(B(F))return!0}for(let W of k.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B(W.index??0)&&Lu(W[1],!0).has(_))return!0;for(let W of k.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B(W.index??0)&&Lu(W[1],!1).has(_))return!0;return!1}var Bu="",Eo,gr=/^[A-Za-z_$][\w$]*$/,Mh=new Set(["if","for","while","switch","with"]),zu=["(","[","{"],Wu=[")","]","}"],Oh=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Nh(v){let _=s(v),k=[];for(let R of _.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let T=R.index??0;k.push({text:R[0],start:T,end:T+R[0].length})}return{code:_,tokens:k}}function Fa(v){if(Eo&&v===Bu)return Eo;let{code:_,tokens:k}=Nh(v),R=new Map,T=[];for(let Z=0;Z<k.length;Z++){let ie=k[Z].text;if(["(","[","{"].includes(ie))T.push(Z);else if([")","]","}"].includes(ie)){let oe=T.at(-1);if(oe!==void 0&&["()","[]","{}"].includes(k[oe].text+ie))T.pop(),R.set(oe,Z),R.set(Z,oe)}}function B(Z,ie){let oe=[],ae=Z;for(let ce=Z;ce<ie;ce++){if(["(","[","{"].includes(k[ce].text)&&(R.get(ce)??ie)<ie){ce=R.get(ce);continue}if(k[ce].text===",")oe.push([ae,ce]),ae=ce+1}return oe.push([ae,ie]),oe}let z=[];function W(Z,ie,oe){if(k[Z]?.text==="...")Z++;if(Z>=ie)return;let ae=k[Z].text;if(gr.test(ae)){if(oe.add(ae),oe===H)z.push({name:ae,token:Z});return}if(ae!=="{"&&ae!=="[")return;let ce=R.get(Z);if(ce===void 0||ce>=ie)return;for(let[de,le]of B(Z+1,ce)){let ge=de;if(ae==="{")for(let ye=de;ye<le;ye++){if(k[ye].text===":"){ge=ye+1;break}if(k[ye].text==="=")break;if(["(","[","{"].includes(k[ye].text)&&R.has(ye))ye=R.get(ye)}W(ge,le,oe)}}function F(Z,ie){let oe=new Set;for(let[ae,ce]of B(Z,ie))W(ae,ce,oe);return oe}function V(Z){let ie=Z;for(;ie<k.length;ie++){let oe=k[ie].text;if(["(","[","{"].includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if([",",";",")","]","}"].includes(oe))break}return k[Math.max(Z,ie-1)]?.end??_.length}let H=new Set,q=[];for(let Z=0;Z<k.length;Z++)if(k[Z].text==="=>"){let ie=Z-1,oe=ie,ae;if(k[ie]?.text===")"&&R.has(ie))oe=R.get(ie),ae=F(oe+1,ie);else if(k[ie]&&gr.test(k[ie].text))ae=new Set([k[ie].text]);else continue;let ce=Z+1,de=k[ce]?.text==="{"&&R.has(ce)?k[R.get(ce)].end:V(ce);q.push({start:k[oe].start,end:de,names:ae})}else if(k[Z].text==="("&&R.has(Z)){let ie=k[Z-1]?.text;if(!ie||Mh.has(ie)||!gr.test(ie)&&ie!=="*"&&ie!=="]")continue;let oe=R.get(Z),ae=oe+1;if(k[ae]?.text===":"){ae++;while(ae<k.length&&!["{","=>",";","="].includes(k[ae].text))ae++}if(k[ae]?.text!=="{"||!R.has(ae))continue;q.push({start:k[Z].start,end:k[R.get(ae)].end,names:F(Z+1,oe)})}function Q(Z){let ie=Z;for(;ie<k.length;ie++){let oe=k[ie].text;if(zu.includes(oe)&&R.has(ie)){ie=R.get(ie);continue}if(oe===";"||Wu.includes(oe))break;let ae=k[ie-1];if(ie>Z&&Oh.has(oe)&&ae.text!==".")break;if(ie>Z&&/[\n\r]/.test(_.slice(ae.end,k[ie].start))&&(/^[\w$]+$/.test(ae.text)||Wu.includes(ae.text)||['"',"'","`"].includes(ae.text))&&gr.test(oe)&&!["in","of","instanceof"].includes(oe))break}return ie}for(let Z=0;Z<k.length;Z++){let ie=k[Z].text,oe=k[Z-1]?.text;if(oe==="."||k[Z+1]?.text===":")continue;if(oe==="as"||oe==="<")continue;if(ie==="const"||ie==="let"||ie==="var"){let ae=Q(Z+1),ce=Z+1,de=!1,le=!1,ge=0;for(let ye=Z+1;ye<=ae;ye++){let Se=k[ye]?.text;if(ye<ae&&zu.includes(Se)&&R.has(ye)&&R.get(ye)<ae){ye=R.get(ye);continue}if(ye<ae&&Se===":"&&!le)de=!0;else if(ye<ae&&Se==="="&&ge===0)de=!1,le=!0;else if(ye<ae&&de&&Se==="<")ge++;else if(ye<ae&&de&&Se===">"&&ge>0)ge--;else if(ye===ae||Se===","&&ge===0)W(ce,ye,H),ce=ye+1,de=!1,le=!1}}else if(ie==="function"||ie==="class"){let ae=Z+1;if(k[ae]?.text==="*")ae++;if(k[ae]&&gr.test(k[ae].text)&&k[ae].text!=="extends")H.add(k[ae].text),z.push({name:k[ae].text,token:ae})}else if(ie==="import"){let ae=Z+1;if(k[ae]?.text==="*"&&k[ae+1]?.text==="as")ae+=2;let ce=k[ae]?.text;if(ce&&gr.test(ce)&&ce!=="type"&&k[ae+1]?.text!=="("&&k[ae+1]?.text!==".")H.add(ce),z.push({name:ce,token:ae,file:!0});let de=k[ae]?.text==="{"?ae:k[ae+1]?.text===","&&k[ae+2]?.text==="{"?ae+2:-1;if(de!==-1&&R.has(de)){let le=R.get(de);for(let[ge,ye]of B(de+1,le)){let Se=ye-1;while(Se>=ge&&!gr.test(k[Se].text))Se--;if(Se>=ge&&k[Se].text!=="type")z.push({name:k[Se].text,token:Se,file:!0})}}}}return Bu=v,Eo={code:_,scopes:q,declarations:H,sites:z,tokens:k,pairs:R},Eo}function Va(v){let _=Fa(v);return{code:_.code,shadows:(k,R)=>_.scopes.some((T)=>R>=T.start&&R<T.end&&T.names.has(k))}}function Co(v){return new Set(Fa(v).declarations)}function Ko(v,_){let{scopes:k,sites:R,tokens:T,pairs:B}=Fa(v),z=Array.from({length:T.length},()=>-1),W=[];for(let Q=0;Q<T.length;Q++){z[Q]=W.length?W[W.length-1]:-1;let Z=T[Q].text;if(Z==="{"&&B.has(Q))W.push(Q);else if(Z==="}"&&W.length&&B.get(Q)===W[W.length-1])W.pop()}let F=new Set,V=new Map;for(let Q of R){if(!_.has(Q.name))continue;F.add(Q.token);let Z=Q.file?-1:z[Q.token],ie=Z===-1?[0,Number.POSITIVE_INFINITY]:[T[Z].start,T[B.get(Z)].end],oe=V.get(Q.name);if(oe)oe.push(ie);else V.set(Q.name,[ie])}let H=new Set;for(let Q=0;Q<T.length;Q++){if(T[Q].text!=="import"||T[Q-1]?.text===".")continue;let Z=Q+1;if(T[Z]?.text==="type")Z++;if(T[Z]&&gr.test(T[Z].text)&&T[Z+1]?.text===",")Z+=2;if(T[Z]?.text==="{"&&B.has(Z))for(let ie=Z+1;ie<B.get(Z);ie++)H.add(ie)}let q=new Set;for(let Q=0;Q<T.length;Q++){let Z=T[Q].text;if(!_.has(Z)||q.has(Z)||F.has(Q)||H.has(Q))continue;let ie=T[Q-1]?.text;if(ie==="."&&T[Q-2]?.text!=="..")continue;if(T[Q+1]?.text===":"&&(ie==="{"||ie===","))continue;let oe=T[Q].start;if(V.get(Z)?.some(([ae,ce])=>oe>=ae&&oe<ce))continue;if(k.some((ae)=>oe>=ae.start&&oe<ae.end&&ae.names.has(Z)))continue;q.add(Z)}return q}import Ro from"fs";import Ft from"path";function rn(v){return v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Fu=new Map;function Ao(v,_=!0){let k=Fu.get(v);if(_&&k)return k;let R=new Map,T=[Ft.join(v,"src"),Ft.join(v,"dist"),v];function B(z,W){if(W>6)return;let F;try{F=Ro.readdirSync(z,{withFileTypes:!0})}catch{return}for(let V of F){let H=Ft.join(z,V.name);if(V.isDirectory()){if(V.name==="node_modules"||V.name.startsWith("."))continue;B(H,W+1)}else if(V.isFile()&&V.name.endsWith(".stx")){let q=V.name.slice(0,-4);if(!R.has(q))R.set(q,H);let Q=q.toLowerCase();if(!R.has(Q))R.set(Q,H);let Z=rn(q);if(!R.has(Z))R.set(Z,H)}}}for(let z of T)if(B(z,0),R.size>0)break;if(_)Fu.set(v,R);return R}function To(v,_){if(v.startsWith(".")||v.startsWith("/"))return null;let k=_;while(!0){let R=Ft.join(k,"node_modules",v);try{if(Ro.statSync(R).isDirectory())return R}catch{}let T=Ft.dirname(k);if(T===k)return null;k=T}}function Io(v,_,k={}){return[Ft.resolve(Ft.dirname(_),`${v}.stx`),Ft.resolve(Ft.dirname(_),v),Ft.resolve(k.componentsDir||"components",`${v}.stx`),Ft.resolve(k.componentsDir||"components",v),v.endsWith(".stx")?v:`${v}.stx`]}function Vu(v){let _=v.endsWith(".stx")?v.slice(0,-4):v,k=_.split("-").map((T)=>T.charAt(0).toUpperCase()+T.slice(1)).join(""),R=rn(_);return[_,k,R]}function Ua(v,_){let[k,R,T]=Vu(v);for(let B of[k,k.toLowerCase(),R,T]){let z=_?.__importedComponents?.get(B);if(z!==void 0)return z}}function*Ha(v,_,k={},R){let T=Vu(v);if(T[0].startsWith("./")||T[0].startsWith("../")){yield Ft.resolve(Ft.dirname(_),`${T[0]}.stx`);return}let B=[...new Set(T.map((F)=>`${F}.stx`))],z=k.projectRoot||process.cwd(),W=[...R?.__originalFilePath?[Ft.join(Ft.dirname(R.__originalFilePath),"components")]:[],...k.componentsDir?[k.componentsDir]:[],Ft.join(Ft.dirname(_),"components"),Ft.resolve(z,"src/components"),Ft.resolve(z,"components"),...import.meta.dir?[Ft.resolve(import.meta.dir,"components")]:[]];for(let F of new Set(W)){for(let V of B)yield Ft.join(F,V);try{for(let V of Ro.readdirSync(F,{withFileTypes:!0}))if(V.isDirectory())for(let H of B)yield Ft.join(F,V.name,H)}catch{}}}function Uu(v,_,k={},R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))try{if(Ro.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return null}import bh from"fs";import rt from"path";import{createHash as jh}from"crypto";var Po="__stx_component_client_factories";function Do(v){let _=v[Po];return _ instanceof Map?_:null}function qu(v){v[Po]=new Map}function qa(v,_){let k=Do(v);if(!k)return null;let R=jh("sha256").update(_).digest("hex").slice(0,16),T=k.get(R);if(T)T.instances++;else k.set(R,{body:_,instances:1});return R}function Ku(v,_){let k=Do(_);if(!k?.size)return v;let R=new Map;for(let[H,q]of k)if(q.instances===1)R.set(H,q.body);let T=[];if(R.size>0){let H=[...R.keys()].map((Z)=>JSON.stringify(Z).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),q=new RegExp(`window\\.__stxComponentFactories\\[(${H})\\]\\(("[^"]+")\\);`,"g"),Q=q.exec(v);while(Q!==null){let Z=R.get(JSON.parse(Q[1]));if(Z!==void 0)T.push({start:Q.index,end:Q.index+Q[0].length,replacement:`(${Z})(${Q[2]});`});Q=q.exec(v)}}let B=[...k].filter(([,H])=>H.instances>1);if(B.length===0)return Hu(v,T);let W=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
116
116
  (function() {
117
117
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
118
118
  ${B.map(([H,q])=>` try { factories[${JSON.stringify(H)}] = factories[${JSON.stringify(H)}] || ${q.body}; }
@@ -142,7 +142,7 @@ catch (e) {
142
142
  `)})}else _.push({selector:`@${H} ${q.trim()}`,declarations:Q.trim()})}z="",B=!1}else if(T.trim()){T+=F;let V=T.match(/([^{]+)\{([^}]*)\}/);if(V)_.push({selector:V[1].trim(),declarations:V[2].trim()});T=""}continue}}if(B)z+=F;else T+=F}return _}function af(v,_,k,R,T,B){let{selector:z,declarations:W}=v;if(z.startsWith("@")){if(z.startsWith("@keyframes")){let H=z.replace("@keyframes ","").trim();return`@keyframes ${T.get(H)||H} { ${W} }`}if(z.startsWith("@media")||z.startsWith("@supports")||z.startsWith("@container")){let q=qc(`x { ${W} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((Q)=>af(Q,_,k,R,T,B)).join(`
143
143
  `);return`${z} {
144
144
  ${q}
145
- }`}return`${z} { ${W} }`}let F=yy(z,_,k,R),V=W;for(let[H,q]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function yy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let V=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(V)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=xy(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function xy(v,_){let k=0,R=v.length;for(let F=0;F<v.length;F++){let V=v[F];if(V==="["||V==="(")k++;else if(V==="]"||V===")")k--;else if(k===0&&(V===" "||V===">"||V==="+"||V==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")W++;else if(V==="]"||V===")")W--;else if(k===0&&W===0&&V===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var uf=String.raw`(?<![\w-])scoped(?![\w-])`,Kc=/<style\s+([^>]*)>/gi,cf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,df=new RegExp(uf,"i"),by=new RegExp(uf,"gi"),Xc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function vy(v){Kc.lastIndex=0;let _=Kc.exec(v);while(_!==null){if(df.test(_[1]))return!0;_=Kc.exec(v)}return!1}function Zc(v){let _=new Set,k=[];Xc.lastIndex=0;let R=Xc.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=Xc.exec(v)}return k}function ji(v){let _=Zc(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function Vo(v,_){if(!vy(v))return{html:v,hasScoped:!1};let k=sf(_),R=`data-v-${k}`,T=v,B=!1;if(cf.lastIndex=0,T=T.replace(cf,(z,W,F)=>{if(!df.test(W))return z;B=!0;let V=wy(F,R),H=W.replace(by,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${V}</style>`}),!B)return{html:v,hasScoped:!1};return T=$y(T,R),{html:T,hasScoped:!0}}function wy(v,_){return of(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Sy=(v)=>`\x00stx-scope-mask-${v}\x00`,lf=/\u0000stx-scope-mask-(\d+)\u0000/g;function $y(v,_){let k=Dn(v,(T,B)=>{let z=U(T,B);return z>B?z:Xr(T,B)},(T,B)=>Sy(B)),R=_y(k.output,_);return lf.lastIndex=0,R.replace(lf,(T,B)=>k.tokens[Number(B)])}function _y(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var On=null,Uo="";function pf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;Uo=`${_}@${Math.trunc(qi.statSync(_).mtimeMs)}`}catch{Uo=v}}var Jc=!1,Dr=null,Wi="",Yr=!1,hf=256,hr=new Map,Nn=new Map,Ho=null,yf=null,qo=new Map;function Xo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Gc(v,_){if(hr.has(v))hr.delete(v);else if(hr.size>=hf)hr.delete(hr.keys().next().value);hr.set(v,_)}function ky(v){let _=Xo(v);if(Nn.has(_))Nn.delete(_);else if(Nn.size>=hf)Nn.delete(Nn.keys().next().value);return Nn.set(_,v),_}function Jd(v){let _=Nn.get(v);if(_===void 0)return;return Nn.delete(v),Nn.set(v,_),_}async function Ey(v,_=Ho){if(!_)return null;try{let k=Bun.file(Ot.join(_,`cw-${Xo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Cy(v,_,k=Ho){if(!k)return;try{if(!qi.existsSync(k))qi.mkdirSync(k,{recursive:!0});await Bun.write(Ot.join(k,`cw-${Xo(v)}.css`),_)}catch{}}async function gf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ry=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ay=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ty(){let v=[],_=process.cwd();while(_!==Ot.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ry)v.push(Ot.join(_,k,...R));_=Ot.dirname(_)}return v}function Iy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ot.join(_,"Code","Tools","ts-css"),_&&Ot.join(_,"Code","Tools","crosswind"),_&&Ot.join(_,"repos","stacks-org","ts-css"),_&&Ot.join(_,"repos","stacks-org","crosswind"),Ot.join(process.cwd(),"..","ts-css"),Ot.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Ot.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Ot.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ot.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function ni(){if(Jc)return On;Jc=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await gf(B);if(z){if(pf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ot.dirname(Ot.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Ot.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return On=B,On}let _=await v(Ty());if(_)return On=_,On;let k=Ay;for(let T of k){let B=await gf(T);if(B){On=B;try{pf(import.meta.resolve(T))}catch{Uo=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return On}}let R=await v(Iy());if(R)return On=R,On;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Yd(){Yc.clear(),On=null,Jc=!1,Dr=null,Wi="",hr.clear(),Nn.clear(),yf=null,qo.clear()}var mf=!1;async function ri(v){try{let _=ff({name:"css",cwd:v})?"css":ff({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!mf)mf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Ot.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function yc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-zddzjd60.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Ot.isAbsolute(R.css)?R.css:Ot.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Ot.isAbsolute(R.css.config)?R.css.config:Ot.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await ri(v)}function bc(v){try{let _=new WeakSet;return Xo(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Et(v){if(Yr)return Wi;Yr=!0;try{let _=await ni();if(!_||!_.build)return Yr=!1,"";if(!Dr)Dr=await ri(v);if(!Dr)return Yr=!1,"";let k=_.defaultConfig?.theme||{},R=Dr.theme||{},T={..._.defaultConfig,...Dr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(Wi=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=Ot.isAbsolute(T.output)?T.output:Ot.join(v,T.output),V=Ot.dirname(F);if(!qi.existsSync(V))qi.mkdirSync(V,{recursive:!0});await Bun.write(F,z.css)}return Yr=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Yr=!1,Wi}}async function cn(v){Dr=null,await Et(v)}function Zd(){return Wi}function wc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var Yc=m(64);async function vc(v,_){let k=()=>qo.get(_?Ot.resolve(_):process.cwd())?.fingerprint??null,R=Yc.get(h(v,_,k()));if(R!==void 0)return R;let T=await Py(v,_);if(T)Yc.set(h(v,_,k()),T);return T}function*xf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=ti(R);if(T)yield T}}function Qd(v){return[...xf(v)].join(`
145
+ }`}return`${z} { ${W} }`}let F=yy(z,_,k,R),V=W;for(let[H,q]of T)V=V.replace(new RegExp(`\\b${H}\\b`,"g"),q);if(B)V=V.replace(/--([a-z-]+)/gi,`--${_}-$1`);return`${F} { ${V} }`}function yy(v,_,k,R){let T=v.split(",").map((z)=>z.trim()),B=[];for(let z of T){if(z.startsWith(":host")){if(R)B.push(z);else{let V=z.replace(/:host(\([^)]*\))?/,`.${_}$1`);B.push(V)}continue}if(z.includes("::slotted")){B.push(z);continue}if(z===":root"){B.push(`:root .${_}`);continue}let W=k?`${k} .${_}`:`.${_}`;B.push(`${W} ${z}`);let F=xy(z,_);if(F)B.push(k?`${k} ${F}`:F)}return B.join(", ")}function xy(v,_){let k=0,R=v.length;for(let F=0;F<v.length;F++){let V=v[F];if(V==="["||V==="(")k++;else if(V==="]"||V===")")k--;else if(k===0&&(V===" "||V===">"||V==="+"||V==="~")){R=F;break}}let T=v.slice(0,R),B=v.slice(R);if(!T)return"";let z=T.length,W=0;for(let F=0;F<T.length;F++){let V=T[F];if(V==="["||V==="(")W++;else if(V==="]"||V===")")W--;else if(k===0&&W===0&&V===":"){z=F;break}}return`${T.slice(0,z)}.${_}${T.slice(z)}${B}`}var uf=String.raw`(?<![\w-])scoped(?![\w-])`,Kc=/<style\s+([^>]*)>/gi,cf=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,df=new RegExp(uf,"i"),by=new RegExp(uf,"gi"),Xc=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function vy(v){Kc.lastIndex=0;let _=Kc.exec(v);while(_!==null){if(df.test(_[1]))return!0;_=Kc.exec(v)}return!1}function Zc(v){let _=new Set,k=[];Xc.lastIndex=0;let R=Xc.exec(v);while(R!==null){let T=R[0].trim();if(_.has(T))k.push({start:R.index,end:R.index+R[0].length});else _.add(T);R=Xc.exec(v)}return k}function ji(v){let _=Zc(v);if(_.length===0)return v;let k=Array(_.length+1),R=0;for(let T=0;T<_.length;T++){let B=_[T];k[T]=v.slice(R,B.start),R=B.end}return k[_.length]=v.slice(R),k.join("")}function Vo(v,_){if(!vy(v))return{html:v,hasScoped:!1};let k=sf(_),R=`data-v-${k}`,T=v,B=!1;if(cf.lastIndex=0,T=T.replace(cf,(z,W,F)=>{if(!df.test(W))return z;B=!0;let V=wy(F,R),H=W.replace(by,"").trim(),q=H?` ${H}`:"";return`<style data-stx-scoped="${k}"${q}>${V}</style>`}),!B)return{html:v,hasScoped:!1};return T=$y(T,R),{html:T,hasScoped:!0}}function wy(v,_){return of(v,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${_}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${_}]`)}var Sy=(v)=>`\x00stx-scope-mask-${v}\x00`,lf=/\u0000stx-scope-mask-(\d+)\u0000/g;function $y(v,_){let k=Dn(v,(T,B)=>{let z=U(T,B);return z>B?z:Xr(T,B)},(T,B)=>Sy(B)),R=_y(k.output,_);return lf.lastIndex=0,R.replace(lf,(T,B)=>k.tokens[Number(B)])}function _y(v,_){let k=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return v.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(R,T,B)=>{if(k.has(T.toLowerCase()))return R;if(R.includes(_))return R;if(T.toLowerCase()==="style"||T.toLowerCase()==="script")return R;if(B)return R.replace(`<${T}${B}`,`<${T} ${_}${B}`);if(R.endsWith("/>"))return`<${T} ${_} />`;return`<${T} ${_}>`})}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};var On=null,Uo="";function pf(v){try{let _=v.startsWith("file:")?new URL(v).pathname:v;Uo=`${_}@${Math.trunc(qi.statSync(_).mtimeMs)}`}catch{Uo=v}}var Jc=!1,Dr=null,Wi="",Yr=!1,hf=256,hr=new Map,Nn=new Map,Ho=null,yf=null,qo=new Map;function Xo(v){return Bun.hash(v).toString(16).padStart(16,"0").slice(0,16)}function Gc(v,_){if(hr.has(v))hr.delete(v);else if(hr.size>=hf)hr.delete(hr.keys().next().value);hr.set(v,_)}function ky(v){let _=Xo(v);if(Nn.has(_))Nn.delete(_);else if(Nn.size>=hf)Nn.delete(Nn.keys().next().value);return Nn.set(_,v),_}function Jd(v){let _=Nn.get(v);if(_===void 0)return;return Nn.delete(v),Nn.set(v,_),_}async function Ey(v,_=Ho){if(!_)return null;try{let k=Bun.file(Ot.join(_,`cw-${Xo(v)}.css`));if(!await k.exists())return null;return await k.text()}catch{return null}}async function Cy(v,_,k=Ho){if(!k)return;try{if(!qi.existsSync(k))qi.mkdirSync(k,{recursive:!0});await Bun.write(Ot.join(k,`cw-${Xo(v)}.css`),_)}catch{}}async function gf(v){try{let _=await import(v);if(_&&_.CSSGenerator)return{CSSGenerator:_.CSSGenerator,config:_.config,build:_.build,defaultConfig:_.defaultConfig,extractClasses:_.extractClasses}}catch{}return null}var Ry=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ay=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Ty(){let v=[],_=process.cwd();while(_!==Ot.dirname(_)){for(let k of["node_modules","pantry"])for(let R of Ry)v.push(Ot.join(_,k,...R));_=Ot.dirname(_)}return v}function Iy(){let v=[],_=process.env.HOME||process.env.USERPROFILE||"",k=[_&&Ot.join(_,"Code","Tools","ts-css"),_&&Ot.join(_,"Code","Tools","crosswind"),_&&Ot.join(_,"repos","stacks-org","ts-css"),_&&Ot.join(_,"repos","stacks-org","crosswind"),Ot.join(process.cwd(),"..","ts-css"),Ot.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let R of k)v.push(Ot.join(R,"packages","toolkit","dist","engine","index.js")),v.push(Ot.join(R,"packages","toolkit","src","engine","index.ts"));if(_)v.push(Ot.join(_,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return v}async function ni(){if(Jc)return On;Jc=!0;try{let v=async(T)=>{for(let B of T){if(!await Bun.file(B).exists())continue;let z=await gf(B);if(z){if(pf(B),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${Ot.dirname(Ot.dirname(B))}`);return z}}return null};if(process.env.CROSSWIND_SRC){let T=Ot.resolve(process.env.CROSSWIND_SRC),B=await v([T]);if(!B)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${T}`);return On=B,On}let _=await v(Ty());if(_)return On=_,On;let k=Ay;for(let T of k){let B=await gf(T);if(B){On=B;try{pf(import.meta.resolve(T))}catch{Uo=T}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return On}}let R=await v(Iy());if(R)return On=R,On;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Yd(){Yc.clear(),On=null,Jc=!1,Dr=null,Wi="",hr.clear(),Nn.clear(),yf=null,qo.clear()}var mf=!1;async function ri(v){try{let _=ff({name:"css",cwd:v})?"css":ff({name:"crosswind",cwd:v})?"crosswind":null;if(!_)return null;if(_==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!mf)mf=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:k}=await import("bunfig"),R=await k({name:_,cwd:v,defaultConfig:{},checkEnv:!1,verbose:!1});if(!R?.path||!R.config||Object.keys(R.config).length===0)return null;let T=Ot.relative(v,R.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${T||R.path}`);return R.config}catch(_){if(_ instanceof Error&&_.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,_ instanceof Error?_.message:_),null}}async function yc(v){let _=null;try{let{loadStxConfig:k}=await import("./chunk-ya7xks9t.js"),R=await k(v);if(R.css)if(typeof R.css==="string"){let T=Ot.isAbsolute(R.css)?R.css:Ot.resolve(v,R.css);if(await Bun.file(T).exists()){let B=await import(T);_=B.default||B,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(_={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=Ot.isAbsolute(R.css.config)?R.css.config:Ot.resolve(v,R.css.config);if(await Bun.file(T).exists()){let B=await import(T);_={...B.default||B,..._}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return _||await ri(v)}function bc(v){try{let _=new WeakSet;return Xo(JSON.stringify(v??{},(k,R)=>{if(typeof R==="function")return`[fn]${String(R)}`;if(typeof R==="object"&&R!==null){if(_.has(R))return"[circular]";_.add(R)}return R})??"")}catch{return"unhashable"}}async function Et(v){if(Yr)return Wi;Yr=!0;try{let _=await ni();if(!_||!_.build)return Yr=!1,"";if(!Dr)Dr=await ri(v);if(!Dr)return Yr=!1,"";let k=_.defaultConfig?.theme||{},R=Dr.theme||{},T={..._.defaultConfig,...Dr,theme:{...k,...R,extend:{...k.extend||{},...R.extend||{}}}},B=performance.now(),z=await _.build(T),W=performance.now()-B;if(Wi=z.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${z.classes.size} classes in ${W.toFixed(1)}ms`),T.output){let F=Ot.isAbsolute(T.output)?T.output:Ot.join(v,T.output),V=Ot.dirname(F);if(!qi.existsSync(V))qi.mkdirSync(V,{recursive:!0});await Bun.write(F,z.css)}return Yr=!1,z.css}catch(_){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,_),Yr=!1,Wi}}async function cn(v){Dr=null,await Et(v)}function Zd(){return Wi}function wc(v){let _=new Set,k=/class\s*=\s*["']([^"']+)["']/gi,R=k.exec(v);while(R!==null){for(let z of R[1].split(/\s+/))if(z.trim())_.add(z.trim());R=k.exec(v)}let T=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,B=T.exec(v);while(B!==null){let z=B[1].match(/'([^']+)'/g);if(z){for(let W of z)for(let F of W.slice(1,-1).split(/\s+/))if(F.trim())_.add(F.trim())}B=T.exec(v)}return _}var Yc=m(64);async function vc(v,_){let k=()=>qo.get(_?Ot.resolve(_):process.cwd())?.fingerprint??null,R=Yc.get(h(v,_,k()));if(R!==void 0)return R;let T=await Py(v,_);if(T)Yc.set(h(v,_,k()),T);return T}function*xf(v){yield v;let _=new Set;for(let k of v.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let R=k[1];if(_.has(R))continue;_.add(R);let T=ti(R);if(T)yield T}}function Qd(v){return[...xf(v)].join(`
146
146
  `)}async function Py(v,_){try{let k=await ni();if(!k)return"";let R=new Set;for(let Re of xf(v)){let Ae=typeof k.extractClasses==="function"?k.extractClasses(Re):wc(Re);for(let Te of Ae)R.add(Te)}if(R.size===0)return"";let T=_?Ot.resolve(_):process.cwd(),B=a(T,"cache");if(!Ho)Ho=B;let z=qo.get(T);if(!z){let Re=await yc(T);z={config:Re,fingerprint:bc(Re)},qo.set(T,z),yf=z.fingerprint}let W=[...R].sort().join(" "),F=`${Uo}::${z.fingerprint||"default"}::${W}`,V=hr.get(F);if(V!==void 0)return Gc(F,V),V;let H=await Ey(F,B);if(H!==null)return Gc(F,H),H;let q=k.defaultConfig||k.config,Q=z.config||{},Z=rf(q,Q),{safelist:ie,includePreflight:oe,minify:ae,tokenCSS:ce}=Z,de=Z.config,le=new k.CSSGenerator(de),ge=de.shortcuts||Q.shortcuts||{},ye=Object.keys(ge).filter((Re)=>R.has(Re)||ie.includes(Re));for(let Re of ie)if(!ge[Re])le.generate(Re);for(let Re of R)if(!ge[Re])le.generate(Re);let Se="";if(ye.length>0){let Re=new k.CSSGenerator(de);for(let Ae of ye)Re.generate(Ae);if(Se=Re.toCSS(!1,ae),Se&&!Se.endsWith(`
147
147
  `))Se+=`
148
148
  `}let $e=Se+le.toCSS(oe,ae);return $e=nf(k.CSSGenerator,Z)+ce+$e,Gc(F,$e),Cy(F,$e,B),$e}catch(k){return console.warn("Failed to generate Css CSS:",k),""}}async function f(v,_,k=!1,R=!1){let T=await vc(v,_);if(!T)return R?ji(v):v;let B=k?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${ky(T)}.css">`:`<style data-css="generated">
@@ -659,10 +659,10 @@ else {
659
659
  }
660
660
  })();
661
661
  </script>
662
- `,R}function Rf(v){let{html:_,bindings:k,stores:R}=jy(v);if(k.length===0)return v;let T=Ly(k,R),B=_.lastIndexOf("</body>");if(B!==-1)return _.slice(0,B)+T+_.slice(B);return _+T}function By(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return zy(_);case"google-analytics":return Wy(_);case"plausible":return Fy(_);case"self-hosted":return Vy(_);case"custom":return Uy(_);default:return""}}function zy(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",R=_.defer!==!1?" defer":"",T=[`data-site="${bn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${bn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
662
+ `,R}function Rf(v){let{html:_,bindings:k,stores:R}=jy(v);if(k.length===0)return v;let T=Ly(k,R),B=_.lastIndexOf("</body>");if(B!==-1)return _.slice(0,B)+T+_.slice(B);return _+T}function By(v){let _=v.analytics;if(!_?.enabled)return"";switch(_.driver){case"fathom":return zy(_);case"google-analytics":return Wy(_);case"plausible":return Fy(_);case"self-hosted":return Vy(_);case"custom":return Uy(_);default:return""}}function zy(v){let _=v.fathom;if(!_?.siteId)return"";let k=_.scriptUrl||"https://cdn.usefathom.com/script.js",R=_.defer!==!1?" defer":"",T=[`data-site="${vn(_.siteId)}"`];if(_.honorDnt)T.push('data-honor-dnt="true"');if(_.spa)T.push('data-spa="auto"');if(_.canonical)T.push(`data-canonical="${vn(_.canonical)}"`);if(_.auto===!1)T.push('data-auto="false"');return`
663
663
  <!-- Fathom Analytics -->
664
- <script src="${bn(k)}" ${T.join(" ")}${R}></script>
665
- `}function Wy(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=bn(_.measurementId),R=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
664
+ <script src="${vn(k)}" ${T.join(" ")}${R}></script>
665
+ `}function Wy(v){let _=v.googleAnalytics;if(!_?.measurementId)return"";let k=vn(_.measurementId),R=_.debug?`gtag('config', '${k}', { 'debug_mode': true });`:"";return`
666
666
  <!-- Google Analytics -->
667
667
  <script async src="https://www.googletagmanager.com/gtag/js?id=${k}"></script>
668
668
  <script>
@@ -672,10 +672,10 @@ else {
672
672
  gtag('config', '${k}');
673
673
  ${R}
674
674
  </script>
675
- `}function Fy(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",R=[`data-domain="${bn(_.domain)}"`],T=k,B=[];if(_.trackLocalhost)B.push("local");if(_.hashMode)B.push("hash");if(B.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${B.join(".")}.js`;return`
675
+ `}function Fy(v){let _=v.plausible;if(!_?.domain)return"";let k=_.scriptUrl||"https://plausible.io/js/script.js",R=[`data-domain="${vn(_.domain)}"`],T=k,B=[];if(_.trackLocalhost)B.push("local");if(_.hashMode)B.push("hash");if(B.length>0&&k==="https://plausible.io/js/script.js")T=`https://plausible.io/js/script.${B.join(".")}.js`;return`
676
676
  <!-- Plausible Analytics -->
677
- <script defer data-domain="${bn(_.domain)}" src="${bn(T)}"></script>
678
- `}function Vy(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=bn(_.siteId),R=bn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",B=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",z=_.trackOutboundLinks?`
677
+ <script defer data-domain="${vn(_.domain)}" src="${vn(T)}"></script>
678
+ `}function Vy(v){let _=v.selfHosted;if(!_?.siteId||!_?.apiEndpoint)return"";let k=vn(_.siteId),R=vn(_.apiEndpoint),T=_.honorDnt?'if(n.doNotTrack==="1")return;':"",B=_.trackHashChanges?"w.addEventListener('hashchange',pv);":"",z=_.trackOutboundLinks?`
679
679
  d.addEventListener('click',function(e){
680
680
  var a=e.target.closest('a');
681
681
  if(a&&a.hostname!==location.hostname){
@@ -713,10 +713,10 @@ else {
713
713
  <script>
714
714
  ${_.inlineScript}
715
715
  </script>
716
- `;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${bn(_.scriptId)}"`);if(_.attributes)for(let[T,B]of Object.entries(_.attributes))k.push(`${bn(T)}="${bn(B)}"`);return`
716
+ `;if(!_.scriptUrl)return"";let k=[];if(_.scriptId)k.push(`id="${vn(_.scriptId)}"`);if(_.attributes)for(let[T,B]of Object.entries(_.attributes))k.push(`${vn(T)}="${vn(B)}"`);return`
717
717
  <!-- Custom Analytics -->
718
- <script${k.length>0?` ${k.join(" ")}`:""} src="${bn(_.scriptUrl)}" defer></script>
719
- `}function Af(v,_){let k=By(_);if(!k)return v;if(!v.includes("</head>")){let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}return v.replace("</head>",`${k}</head>`)}function bn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Hy={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Tf(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...Hy,..._};return`
718
+ <script${k.length>0?` ${k.join(" ")}`:""} src="${vn(_.scriptUrl)}" defer></script>
719
+ `}function Af(v,_){let k=By(_);if(!k)return v;if(!v.includes("</head>")){let R=v.lastIndexOf("</body>");if(R!==-1)return v.slice(0,R)+k+v.slice(R);return v+k}return v.replace("</head>",`${k}</head>`)}function vn(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Hy={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Tf(v){let _=v.heatmap;if(!_?.enabled)return"";let k={...Hy,..._};return`
720
720
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
721
721
  <script>
722
722
  (function() {
@@ -1601,7 +1601,7 @@ window.__stx_reactive = (function() {
1601
1601
  ${lx()}
1602
1602
  ${k}
1603
1603
  </script>`}function Ff(v,_,k){if(!fx(v))return v;let R=ix(v);if(R.length===0)return v;let T=dx(v,R),B=ux(R,_),z=T.lastIndexOf("</body>");if(z!==-1)T=T.slice(0,z)+B+`
1604
- `+T.slice(z);else T+=B;return T}function dx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let W=_[k++];if(!W)return T;let F=/data-stx-scope="([^"]*)"/.exec(z);if(F)return W.id=F[1],W.selector=`[data-stx-scope="${W.id}"]`,T;return`<${B} data-stx-scope="${W.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function fx(v){return/x-data\s*=\s*["']/.test(v)}import Gx from"fs";import ml from"path";import{createHighlighter as Jx}from"ts-syntax-highlighter";import $s from"fs";import Zt from"path";import{loadConfigWithResult as Ux}from"bunfig";async function px(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Ee();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var Vf={name:"stxRouter",handler:px,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function xr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Uf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Hn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
1604
+ `+T.slice(z);else T+=B;return T}function dx(v,_){let k=0,R=v.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(T,B,z)=>{let W=_[k++];if(!W)return T;let F=/data-stx-scope="([^"]*)"/.exec(z);if(F)return W.id=F[1],W.selector=`[data-stx-scope="${W.id}"]`,T;return`<${B} data-stx-scope="${W.id}"${z}>`});return R=R.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),R=R.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),R=R.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),R=R.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),R}function fx(v){return/x-data\s*=\s*["']/.test(v)}import Gx from"fs";import ml from"path";import{createHighlighter as Jx}from"ts-syntax-highlighter";import $s from"fs";import Gt from"path";import{loadConfigWithResult as Ux}from"bunfig";async function px(v,_,k,R){let T=_[0]?.replace(/['"]/g,"")||"main",B=Ee();if(T!=="main")B=B.replace("container:'main'",`container:'${T}'`);return`<script data-stx-router>${B}</script>`}var Vf={name:"stxRouter",handler:px,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function xr(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Uf(v){let _=v.trim().toLowerCase();return!_.startsWith("javascript:")&&!_.startsWith("vbscript:")&&!_.startsWith("data:text/html")}function Hn(v){let _=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,k=v.match(_);if(!k)return{data:{},content:v.trim()};let R=k[1],T=v.slice(k[0].length),B={};for(let z of R.split(`
1605
1605
  `)){let W=z.trim();if(!W||W.startsWith("#"))continue;let F=W.indexOf(":");if(F===-1)continue;let V=W.slice(0,F).trim(),H=W.slice(F+1).trim();if(typeof H==="string"){if(H.startsWith('"')&&H.endsWith('"')||H.startsWith("'")&&H.endsWith("'"))H=H.slice(1,-1);else if(H.startsWith("[")&&H.endsWith("]"))try{H=JSON.parse(H)}catch{}else if(H==="true")H=!0;else if(H==="false")H=!1;else if(/^-?\d+(?:\.\d+)?$/.test(H))H=Number(H)}B[V]=H}return{data:B,content:T.trim()}}function je(v,_={}){let{gfm:k=!0,breaks:R=!1}=_,T=v,B=[];if(T=T.replace(/```(\w*)\n([\s\S]*?)```/g,(H,q,Q)=>{let Z=B.length,ie=q?` class="language-${xr(q)}"`:"";return B.push(`<pre><code${ie}>${xr(Q.trim())}</code></pre>`),`\x00CODEBLOCK${Z}\x00`}),T=T.replace(/`([^`]*)`/g,(H,q)=>`<code>${xr(q)}</code>`),T=T.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),T=T.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),T=T.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),T=T.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),T=T.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),T=T.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),T=T.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),T=T.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),T=T.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),T=T.replace(/__(.+?)__/g,"<strong>$1</strong>"),T=T.replace(/\*(.+?)\*/g,"<em>$1</em>"),T=T.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),k)T=T.replace(/~~(.+?)~~/g,"<del>$1</del>");if(T=T.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(H,q,Q)=>`<img src="${Uf(Q)?xr(Q):""}" alt="${xr(q)}" />`),T=T.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(H,q,Q)=>`<a href="${Uf(Q)?xr(Q):""}">${q}</a>`),T=T.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),T=T.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),T=T.replace(/<\/blockquote>\n<blockquote>/g,`
1606
1606
  `),T=T.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),T=T.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),T=T.replace(/<\/ul>\n<ul>/g,""),T=T.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),T=T.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),T=T.replace(/<\/ol>\n<ol>/g,""),T=T.replace(/<li data-ul>/g,"<li>"),T=T.replace(/<li data-ol>/g,"<li>"),k)T=T.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(H,q,Q)=>{let ie=`<tr>${q.split("|").map((ae)=>ae.trim()).filter(Boolean).map((ae)=>`<th>${xr(ae)}</th>`).join("")}</tr>`,oe=Q.trim().split(`
1607
1607
  `).map((ae)=>`<tr>${ae.split("|").map((de)=>de.trim()).filter(Boolean).map((de)=>`<td>${xr(de)}</td>`).join("")}</tr>`).join(`
@@ -1666,7 +1666,7 @@ ${oe}
1666
1666
  #${v}.stx-img-loaded img {
1667
1667
  opacity: 1;
1668
1668
  }
1669
- `.trim()}var ol=new Map;async function Zf(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(ol.has(k))return ol.get(k);let R=await xx(v,_);return ol.set(k,R),R}async function wx(){try{return await import("./chunk-ts80ktq7.js")}catch(v){if(!Gf)console.warn("[stx-media] Image processor not available, some features disabled:",v),Gf=!0;return null}}var Gf=!1,cl=80,ta="async",na="lazy",Jf=!1;async function ea(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return kx(R,k)}if(k.processedResult?.processed)return dl(v,k.processedResult,_);if(k.responsiveVariants)return ep(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:W,sizes:F,widths:V=fs,dpr:H,formats:q=Zi,quality:Q=cl,params:Z={},placeholder:ie="none",placeholderOptions:oe={},lazy:ae=!0,priority:ce=!1,loading:de=ce?"eager":na,decoding:le=ta,fetchpriority:ge,objectFit:ye,objectPosition:Se,crossorigin:$e,referrerpolicy:Re}=v,{class:Ae,style:Te,id:Ie}=v,_e=v.data||{},{isDev:De=!1,baseUrl:Ne=""}=_;if(De&&!_.optimize)return _x(v);let Oe,Pe,Le=Ie||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(ie!=="none"&&!ce)try{Oe=await Zf(T,{strategy:ie,...oe}),Pe=Xf(Le,Oe,oe)}catch{}let ct=H!==void 0&&z!==void 0,yt;if(ct)yt=$x(v,Le,Oe,_);else yt=await Sx(v,Le,Oe,_);let ft;if(ce){let lt=q.includes("webp")?"webp":q[0],wt=rl(T,V,{...Z,q:Q},lt),dt=typeof F==="object"?sl(F):F||"100vw";ft=`<link rel="preload" as="image" imagesrcset="${wt}" imagesizes="${dt}" />`}let st=[];if(!Jf&&ie!=="none")st.push(al),Jf=!0;if(Pe)st.push(Pe);let pt=ae?Qf(Le):void 0;return{html:yt,preloadLink:ft,css:st.length>0?st.join(`
1669
+ `.trim()}var ol=new Map;async function Zf(v,_={}){let k=`${v}:${JSON.stringify(_)}`;if(ol.has(k))return ol.get(k);let R=await xx(v,_);return ol.set(k,R),R}async function wx(){try{return await import("./chunk-ts80ktq7.js")}catch(v){if(!Gf)console.warn("[stx-media] Image processor not available, some features disabled:",v),Gf=!0;return null}}var Gf=!1,cl=80,ta="async",na="lazy",Jf=!1;async function ea(v,_={}){let k=_,R=v;if(R.process&&!R.skipOptimization){if(k.tsImagesConfig?.enabled&&!k.isDev)return kx(R,k)}if(k.processedResult?.processed)return dl(v,k.processedResult,_);if(k.responsiveVariants)return ep(v,k.responsiveVariants,_);let{src:T,alt:B,width:z,height:W,sizes:F,widths:V=fs,dpr:H,formats:q=Zi,quality:Q=cl,params:Z={},placeholder:ie="none",placeholderOptions:oe={},lazy:ae=!0,priority:ce=!1,loading:de=ce?"eager":na,decoding:le=ta,fetchpriority:ge,objectFit:ye,objectPosition:Se,crossorigin:$e,referrerpolicy:Re}=v,{class:Ae,style:Te,id:Ie}=v,_e=v.data||{},{isDev:De=!1,baseUrl:Ne=""}=_;if(De&&!_.optimize)return _x(v);let Oe,Pe,Le=Ie||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(ie!=="none"&&!ce)try{Oe=await Zf(T,{strategy:ie,...oe}),Pe=Xf(Le,Oe,oe)}catch{}let ct=H!==void 0&&z!==void 0,yt;if(ct)yt=$x(v,Le,Oe,_);else yt=await Sx(v,Le,Oe,_);let ft;if(ce){let ut=q.includes("webp")?"webp":q[0],wt=rl(T,V,{...Z,q:Q},ut),dt=typeof F==="object"?sl(F):F||"100vw";ft=`<link rel="preload" as="image" imagesrcset="${wt}" imagesizes="${dt}" />`}let st=[];if(!Jf&&ie!=="none")st.push(al),Jf=!0;if(Pe)st.push(Pe);let pt=ae?Qf(Le):void 0;return{html:yt,preloadLink:ft,css:st.length>0?st.join(`
1670
1670
  `):void 0,script:pt}}async function Sx(v,_,k,R){let{src:T,alt:B,width:z,height:W,sizes:F,widths:V=fs,formats:H=Zi,quality:q=cl,params:Q={},lazy:Z=!0,priority:ie=!1,loading:oe=ie?"eager":na,decoding:ae=ta,fetchpriority:ce,objectFit:de,objectPosition:le,crossorigin:ge,referrerpolicy:ye}=v,{class:Se,style:$e}=v,Re=v.data||{},Ae=typeof F==="object"?sl(F):F||"100vw",Te=[];for(let De of H){let Ne=rl(T,V,{...Q,q},De),Oe=il(De);if(Z&&!ie)Te.push(` <source type="${Oe}" data-srcset="${Ne}" data-sizes="${Ae}" />`);else Te.push(` <source type="${Oe}" srcset="${Ne}" sizes="${Ae}" />`)}let Ie=ll({src:Gi(T,{...Q,q}),alt:B,width:z,height:W,loading:ie?void 0:oe,decoding:ae,fetchpriority:ie?"high":ce,objectFit:de,objectPosition:le,crossorigin:ge,referrerpolicy:ye,className:Yf(Se,k),style:ul($e,de,le,k),lazy:Z&&!ie,data:Re}),_e;if(k){let De=`background-image: url('${k.dataURL}'); background-size: cover; background-position: center;`;_e=`<div id="${_}" class="stx-img-placeholder" style="${De}">
1671
1671
  <picture>
1672
1672
  ${Te.join(`
@@ -1730,7 +1730,7 @@ ${ye.join(`
1730
1730
  `):void 0,script:Ne}}async function ep(v,_,k){let R={src:_.src,processed:!0,variants:[],placeholder:_.placeholder?.dataURL,originalWidth:_.placeholder?.width,originalHeight:_.placeholder?.height};for(let[T,B]of Object.entries(_.byFormat))if(B)R.variants.push(...B);return dl(v,R,k)}function Ex(){return Je({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(v,_,k,R)=>{let{src:T,alt:B,options:z}=Cx(v,_,k);if(!T)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let W={src:T,alt:B||"",widths:z.widths||fs,formats:z.formats||Zi,quality:z.quality,sizes:z.sizes,dpr:z.dpr,params:z.params,placeholder:z.placeholder,placeholderOptions:z.placeholderOptions,lazy:z.lazy!==!1,priority:z.priority||!1,loading:z.loading,decoding:z.decoding,fetchpriority:z.fetchpriority,objectFit:z.objectFit,objectPosition:z.objectPosition,class:z.class,style:z.style,id:z.id,width:z.width,height:z.height},F=k.__isDev||!1,V=await ea(W,{isDev:F}),H=V.html;if(V.preloadLink)H=V.preloadLink+`
1731
1731
  `+H;if(V.css)H+=`
1732
1732
  <style>${V.css}</style>`;if(V.script)H+=`
1733
- <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Cx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Rx(R),B=fl(T[0],k)||"",z=fl(T[1],k)||"",W={};if(T[2]){let F=fl(T[2],k);if(typeof F==="object"&&F!==null)W=F;else if(typeof T[2]==="string")try{W=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:W}}function Rx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],V=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function fl(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var tp=Ex();async function rp(){try{return await import("./chunk-nw4axkpx.js")}catch(v){if(!np)console.warn("[stx-media] Video processor not available, some features disabled:",v),np=!0;return null}}var np=!1,sp=!0,ip="metadata",Ax="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ra(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Mx(R,k)}if(k.processedResult?.processed)return ap(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Ox(R,k);let{src:B,sources:z=[],poster:W,posterPlaceholder:F,controls:V=sp,autoplay:H=!1,muted:q=!1,loop:Q=!1,preload:Z=ip,playsinline:ie=!0,lazy:oe=!0,player:ae="native",type:ce,width:de,height:le,crossorigin:ge,disablePictureInPicture:ye=!1,disableRemotePlayback:Se=!1}=v,$e=T||W,{class:Re,style:Ae}=v,Te=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ae==="ts-video")return Ix(v,_);if(ce&&ce!=="video")return Tx(B||"",ce,v);let Ie=z.length>0?z:B?[{src:B,type:op(B)}]:[],_e=[`id="${Te}"`];if(V)_e.push("controls");if(H)_e.push("autoplay");if(q)_e.push("muted");if(Q)_e.push("loop");if(ie)_e.push("playsinline");if(ye)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(ge)_e.push(`crossorigin="${ge}"`);if(oe){if(_e.push(`data-preload="${Z}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Xt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${Z}"`),$e)_e.push(`poster="${Xt($e)}"`);if(de)_e.push(`width="${de}"`);if(le)_e.push(`height="${le}"`);if(Re)_e.push(`class="${Xt(Re)}"`);if(Ae)_e.push(`style="${Xt(Ae)}"`);let De=Ie.map((Pe)=>` <source ${oe?`data-src="${Xt(Pe.src)}"`:`src="${Xt(Pe.src)}"`} type="${Pe.type}"${Pe.media?` media="${Pe.media}"`:""} />`).join(`
1733
+ <script>${V.script}</script>`;return H},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Cx(v,_,k){if(_.src)return{src:String(_.src),alt:String(_.alt||""),options:_.options||{}};let R=v.trim();if(R.startsWith("@img(")||R.startsWith("("))R=R.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let T=Rx(R),B=fl(T[0],k)||"",z=fl(T[1],k)||"",W={};if(T[2]){let F=fl(T[2],k);if(typeof F==="object"&&F!==null)W=F;else if(typeof T[2]==="string")try{W=JSON.parse(T[2])}catch{}}return{src:B,alt:z,options:W}}function Rx(v){let _=[],k="",R=!1,T="",B=0,z=0;for(let W=0;W<v.length;W++){let F=v[W],V=W>0?v[W-1]:"";if((F==='"'||F==="'"||F==="`")&&V!=="\\"){if(!R)R=!0,T=F;else if(F===T)R=!1,T="";else k+=F;continue}if(!R){if(F==="{")B++;if(F==="}")B--;if(F==="[")z++;if(F==="]")z--;if(F===","&&B===0&&z===0){_.push(k.trim()),k="";continue}}k+=F}if(k.trim())_.push(k.trim());return _}function fl(v,_){if(typeof v!=="string")return v;let k=v.trim();if(k.startsWith('"')&&k.endsWith('"')||k.startsWith("'")&&k.endsWith("'"))return k.slice(1,-1);if(!k.startsWith("/")&&!k.startsWith(".")&&!k.startsWith("http")&&!k.startsWith("{")){let R=_[k];if(R!==void 0)return R}if(k.startsWith("{")||k.startsWith("["))try{return JSON.parse(k)}catch{}return k}var tp=Ex();async function rp(){try{return await import("./chunk-nw4axkpx.js")}catch(v){if(!np)console.warn("[stx-media] Video processor not available, some features disabled:",v),np=!0;return null}}var np=!1,sp=!0,ip="metadata",Ax="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function ra(v,_={}){let k=_,R=v;if(R.process&&!R.skipProcessing){if(k.tsVideosConfig?.enabled&&!k.isDev)return Mx(R,k)}if(k.processedResult?.processed)return ap(v,k.processedResult,_);let T;if(R.generatePoster&&R.src&&!v.poster)T=await Ox(R,k);let{src:B,sources:z=[],poster:W,posterPlaceholder:F,controls:V=sp,autoplay:H=!1,muted:q=!1,loop:Q=!1,preload:Z=ip,playsinline:ie=!0,lazy:oe=!0,player:ae="native",type:ce,width:de,height:le,crossorigin:ge,disablePictureInPicture:ye=!1,disableRemotePlayback:Se=!1}=v,$e=T||W,{class:Re,style:Ae}=v,Te=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(ae==="ts-video")return Ix(v,_);if(ce&&ce!=="video")return Tx(B||"",ce,v);let Ie=z.length>0?z:B?[{src:B,type:op(B)}]:[],_e=[`id="${Te}"`];if(V)_e.push("controls");if(H)_e.push("autoplay");if(q)_e.push("muted");if(Q)_e.push("loop");if(ie)_e.push("playsinline");if(ye)_e.push("disablepictureinpicture");if(Se)_e.push("disableremoteplayback");if(ge)_e.push(`crossorigin="${ge}"`);if(oe){if(_e.push(`data-preload="${Z}"`),_e.push('preload="none"'),$e)_e.push(`data-poster="${Zt($e)}"`);_e.push("data-stx-lazy")}else if(_e.push(`preload="${Z}"`),$e)_e.push(`poster="${Zt($e)}"`);if(de)_e.push(`width="${de}"`);if(le)_e.push(`height="${le}"`);if(Re)_e.push(`class="${Zt(Re)}"`);if(Ae)_e.push(`style="${Zt(Ae)}"`);let De=Ie.map((Pe)=>` <source ${oe?`data-src="${Zt(Pe.src)}"`:`src="${Zt(Pe.src)}"`} type="${Pe.type}"${Pe.media?` media="${Pe.media}"`:""} />`).join(`
1734
1734
  `),Ne=`<video ${_e.join(" ")}>
1735
1735
  ${De}
1736
1736
  Your browser does not support the video tag.
@@ -1769,12 +1769,12 @@ ${De}
1769
1769
 
1770
1770
  observer.observe(video);
1771
1771
  })();
1772
- `.trim();return{html:Ne,script:Oe}}function Tx(v,_,k){let{width:R=640,height:T=360}=k,{class:B,style:z}=k,W=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,F,V=null;switch(_){case"youtube":V=Px(v),F=V?`https://www.youtube-nocookie.com/embed/${V}`:v;break;case"vimeo":V=Dx(v),F=V?`https://player.vimeo.com/video/${V}`:v;break;case"dailymotion":V=v.split("/").pop()||"",F=`https://www.dailymotion.com/embed/video/${V}`;break;case"twitch":V=v.split("/").pop()||"",F=`https://player.twitch.tv/?video=${V}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:F=v}let H=[`id="${W}"`,`src="${Xt(F)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(B)H.push(`class="${Xt(B)}"`);if(z)H.push(`style="${Xt(z)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1772
+ `.trim();return{html:Ne,script:Oe}}function Tx(v,_,k){let{width:R=640,height:T=360}=k,{class:B,style:z}=k,W=k.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,F,V=null;switch(_){case"youtube":V=Px(v),F=V?`https://www.youtube-nocookie.com/embed/${V}`:v;break;case"vimeo":V=Dx(v),F=V?`https://player.vimeo.com/video/${V}`:v;break;case"dailymotion":V=v.split("/").pop()||"",F=`https://www.dailymotion.com/embed/video/${V}`;break;case"twitch":V=v.split("/").pop()||"",F=`https://player.twitch.tv/?video=${V}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:F=v}let H=[`id="${W}"`,`src="${Zt(F)}"`,`width="${R}"`,`height="${T}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(B)H.push(`class="${Zt(B)}"`);if(z)H.push(`style="${Zt(z)}"`);if(k.lazy)H.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1773
1773
  <iframe ${H.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1774
1774
  </div>`}}function Ix(v,_={}){let{src:k,sources:R=[],poster:T,controls:B=!0,autoplay:z=!1,muted:W=!1,loop:F=!1,preload:V="metadata",playsinline:H=!0,lazy:q=!0,width:Q,height:Z}=v,{class:ie,style:oe}=v,ae=v.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,ce={src:R.length>0?R:k,autoplay:z,loop:F,muted:W,playsinline:H,preload:V,poster:T,controls:B,title:v.title},de=["position: relative",Q?`width: ${typeof Q==="number"?Q+"px":Q}`:"width: 100%",Z?`height: ${typeof Z==="number"?Z+"px":Z}`:"",oe||""].filter(Boolean).join("; "),le=`
1775
1775
  <div
1776
1776
  id="${ae}"
1777
- class="ts-video-player${ie?" "+Xt(ie):""}"
1777
+ class="ts-video-player${ie?" "+Zt(ie):""}"
1778
1778
  style="${de}"
1779
1779
  data-ts-video-player
1780
1780
  data-config='${JSON.stringify(ce)}'
@@ -1782,7 +1782,7 @@ ${De}
1782
1782
  >
1783
1783
  <div class="ts-video-player__container">
1784
1784
  ${T?`
1785
- <div class="ts-video-player__placeholder" style="background-image: url('${Xt(T)}');">
1785
+ <div class="ts-video-player__placeholder" style="background-image: url('${Zt(T)}');">
1786
1786
  <button class="ts-video-player__play-button" aria-label="Play video">
1787
1787
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1788
1788
  <path d="M8 5v14l11-7z"/>
@@ -1938,10 +1938,10 @@ else {
1938
1938
  .ts-video-player__play-button svg {
1939
1939
  margin-left: 4px;
1940
1940
  }
1941
- `.trim();return{html:le,script:ge,css:ye}}function op(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Px(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let R=v.match(k);if(R)return R[1]}return null}function Dx(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Xt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Mx(v,_){let k=await rp();if(!k)return ra({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return ap(v,T,_);return ra({...v,process:!1},_)}async function Ox(v,_){let k=await rp();if(!k||!v.src)return;let R=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,R,T.outputDir,T.baseUrl||"/videos"))?.url}function ap(v,_,k){let{controls:R=sp,autoplay:T=!1,muted:B=!1,loop:z=!1,preload:W=ip,playsinline:F=!0,lazy:V=!0,width:H,height:q,crossorigin:Q,disablePictureInPicture:Z=!1,disableRemotePlayback:ie=!1}=v,{class:oe,style:ae}=v,ce=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,de=v.src,le=op(de);if(_.transcoded)de=_.transcoded.url,le="video/mp4";let ge=_.streaming?.hls||_.streaming?.dash;if(ge){if(_.streaming?.hls)de=_.streaming.hls.manifestUrl,le="application/x-mpegURL";else if(_.streaming?.dash)de=_.streaming.dash.manifestUrl,le="application/dash+xml"}let ye=_.poster?.url||v.poster,Se=[`id="${ce}"`];if(R)Se.push("controls");if(T)Se.push("autoplay");if(B)Se.push("muted");if(z)Se.push("loop");if(F)Se.push("playsinline");if(Z)Se.push("disablepictureinpicture");if(ie)Se.push("disableremoteplayback");if(Q)Se.push(`crossorigin="${Q}"`);if(V){if(Se.push(`data-preload="${W}"`),Se.push('preload="none"'),ye)Se.push(`data-poster="${Xt(ye)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${W}"`),ye)Se.push(`poster="${Xt(ye)}"`);let $e=H||_.metadata?.width,Re=q||_.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Re)Se.push(`height="${Re}"`);if(oe)Se.push(`class="${Xt(oe)}"`);if(ae)Se.push(`style="${Xt(ae)}"`);let Te=` <source ${V?`data-src="${Xt(de)}"`:`src="${Xt(de)}"`} type="${le}" />`,Ie=`<video ${Se.join(" ")}>
1941
+ `.trim();return{html:le,script:ge,css:ye}}function op(v){switch(v.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Px(v){let _=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let k of _){let R=v.match(k);if(R)return R[1]}return null}function Dx(v){let _=v.match(/vimeo\.com\/(\d+)/);return _?_[1]:null}function Zt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Mx(v,_){let k=await rp();if(!k)return ra({...v,process:!1},_);let R=_.tsVideosConfig,T=await k.processVideo(v.src,v,R,v.onProcessProgress);if(T.processed)return ap(v,T,_);return ra({...v,process:!1},_)}async function Ox(v,_){let k=await rp();if(!k||!v.src)return;let R=typeof v.generatePoster==="object"?v.generatePoster:{timestamp:0},T=_.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await k.generatePoster(v.src,R,T.outputDir,T.baseUrl||"/videos"))?.url}function ap(v,_,k){let{controls:R=sp,autoplay:T=!1,muted:B=!1,loop:z=!1,preload:W=ip,playsinline:F=!0,lazy:V=!0,width:H,height:q,crossorigin:Q,disablePictureInPicture:Z=!1,disableRemotePlayback:ie=!1}=v,{class:oe,style:ae}=v,ce=v.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,de=v.src,le=op(de);if(_.transcoded)de=_.transcoded.url,le="video/mp4";let ge=_.streaming?.hls||_.streaming?.dash;if(ge){if(_.streaming?.hls)de=_.streaming.hls.manifestUrl,le="application/x-mpegURL";else if(_.streaming?.dash)de=_.streaming.dash.manifestUrl,le="application/dash+xml"}let ye=_.poster?.url||v.poster,Se=[`id="${ce}"`];if(R)Se.push("controls");if(T)Se.push("autoplay");if(B)Se.push("muted");if(z)Se.push("loop");if(F)Se.push("playsinline");if(Z)Se.push("disablepictureinpicture");if(ie)Se.push("disableremoteplayback");if(Q)Se.push(`crossorigin="${Q}"`);if(V){if(Se.push(`data-preload="${W}"`),Se.push('preload="none"'),ye)Se.push(`data-poster="${Zt(ye)}"`);Se.push("data-stx-lazy")}else if(Se.push(`preload="${W}"`),ye)Se.push(`poster="${Zt(ye)}"`);let $e=H||_.metadata?.width,Re=q||_.metadata?.height;if($e)Se.push(`width="${$e}"`);if(Re)Se.push(`height="${Re}"`);if(oe)Se.push(`class="${Zt(oe)}"`);if(ae)Se.push(`style="${Zt(ae)}"`);let Te=` <source ${V?`data-src="${Zt(de)}"`:`src="${Zt(de)}"`} type="${le}" />`,Ie=`<video ${Se.join(" ")}>
1942
1942
  ${Te}
1943
1943
  Your browser does not support the video tag.
1944
- </video>`;if(_.spriteSheet)Ie=`<div class="stx-video-wrapper" data-sprite-sheet="${Xt(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
1944
+ </video>`;if(_.spriteSheet)Ie=`<div class="stx-video-wrapper" data-sprite-sheet="${Zt(_.spriteSheet.url)}" data-sprite-cols="${_.spriteSheet.columns}" data-sprite-interval="${_.spriteSheet.interval}">
1945
1945
  ${Ie}
1946
1946
  </div>`;let _e;if(V)_e=`
1947
1947
  (function() {
@@ -2289,12 +2289,12 @@ ${H}
2289
2289
  customElements.define('${_}', ${z});
2290
2290
  `}async function up(v,_,k,R){if(_.length<1)return i("WebComponent","@webcomponent directive requires at least the tag name parameter",t.INVALID_DIRECTIVE_SYNTAX);let T=_[0].replace(/['"]/g,""),z=(k.__stx_options||{}).componentsDir||"components",W=_n.isAbsolute(z)?[_n.join(z,`${T}.stx`),_n.join(_n.dirname(R),`${T}.stx`)]:[_n.join(_n.dirname(R),z,`${T}.stx`),_n.join(process.cwd(),z,`${T}.stx`),_n.join(_n.dirname(R),`${T}.stx`)],F=null;for(let q of W)if(await r(q)){F=await Bun.file(q).text();break}if(!F)return i("WebComponent",`Component file not found: ${T}.stx`,t.FILE_NOT_FOUND);let V=Fx(F,T);return`<script type="module">
2291
2291
  ${Vx(V)}
2292
- </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Rt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:qf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:up,hasEndTag:!1,description:"Include a web component in the template"},Ei,Ti,sr,or,Df,Of,Nf,Mf,Vf,Pf,tp,pl,...br],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Hx(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=Zt.join(T,"resources","views"),z=Zt.join(T,"resources","layouts");if($s.existsSync(B)&&$s.existsSync(z))return{root:"resources",pagesDir:"views"};let W=Zt.join(T,"resources","views","pages");if($s.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var dp=new Set,ia=["partialsDir","componentsDir","layoutsDir"],gl=new WeakMap;function qx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function Vc(v,_){let k=!v.root,R=Hx(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!dp.has(T))dp.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!gl.has(v)){let T={};for(let B of ia){let z=v[B];if(typeof z==="string"&&z)T[B]=z}gl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ia){let z=v[B];if(typeof z!=="string"||!z)continue;if(Zt.isAbsolute(z)||qx(z,T))continue;v[B]=Zt.join(T,z)}}for(let T of ia){let B=v[T];if(typeof B!=="string"||!B||Zt.isAbsolute(B))continue;v[T]=Zt.resolve(_,B)}return v}function Kx(v,_){let k=gl.get(v);for(let R of ia){let T=v[R];if(typeof T!=="string"||!T)continue;let B=Zt.isAbsolute(T)?T:Zt.join(_,T);if($s.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function Xx(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function Zx(v){if(Ii(v.stateDir),v.stateDir=un(),v.cachePath=pn(v.cachePath),v.build)v.build.cacheDir=pn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=pn(v.media.cache.directory);if(v.story)v.story.outDir=pn(v.story.outDir)}var vr=null,Mr=new Map,sa=new Map,Ji=null;async function Ts(v,_=Ux){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?Zt.resolve(v):process.cwd(),k=sa.get(_);if(k&&k.signature!==tr(k.graph)){let B=Mr.get(_);if(Mr.delete(_),sa.delete(_),!v)vr=null,Ji=null;let{clearComponentCache:z}=await import("./chunk-5afw7z6v.js"),{partialsCache:W}=await import("./chunk-n6qp05t9.js");if(z(),W.clear(),B&&k.configSignature===nr(k.graph)){let F=B.then(async(V)=>{let H={...k.graph};await Rs(H,_),sa.set(_,{graph:H,signature:tr(H),configSignature:nr(H)});let q={...V,_layerGraph:H};if(!v)vr=q;return q});return Mr.set(_,F),F}}if(!v){if(vr)return vr;if(Ji)return Ji}let R=Mr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>$s.existsSync(Zt.join(_,`stx.config${Q}`))),W=B.some((Q)=>$s.existsSync(Zt.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await Ts({name:"ui",cwd:Zt.join(_,"config"),defaultConfig:A,verbose:!1});F=(await Ts({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,verbose:!1})).config}else F=(await Ts({name:"stx",alias:"ui",cwd:_,defaultConfig:A,verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Ai(_,A);F=Q.config,sa.set(_,{graph:Q.graph,signature:tr(Q.graph),configSignature:nr(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-zgxj1q7w.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-m2a1fxpb.js");await Z(_,F.runtimeConfig)}Xx(F),Zx(F),Vc(F,_),Kx(F,_);let V=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let Z=`${Q}/stx-plugin`;if(H.has(Z)||H.has(Q))continue;try{u.resolve(Z,{paths:[_]}),V.push(Z)}catch{}}let q=[...F.plugins??[],...V];if(q.length>0){let{pluginManager:Q}=await import("./chunk-g6zeqvvb.js"),Z=[],ie=[];for(let oe of q){let ae=typeof oe==="string"?oe:oe[0],ce=typeof oe==="string"?{}:oe[1]||{};try{let de,le;try{let ye=u.resolve(ae,{paths:[_]});de=await import(ye),le=Zt.dirname(ye)}catch{let ye=Zt.resolve(_,ae);de=await import(ye),le=Zt.dirname(ye)}let ge=de.default||de;if(!Q.has(ge.name))await Q.register(ge,F);if(ge.components){let ye=Array.isArray(ge.components)?ge.components:[ge.components];for(let Se of ye)Z.push(Zt.resolve(le,Se))}if(ge.pages){let ye=Zt.resolve(le,ge.pages),Se=ce.path||"/";ie.push({dir:ye,prefix:Se})}if(ge.setup){let ye={addDirective:(Se)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(Se)},addRoute:(Se,$e)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[Se]=$e},addMiddleware:(Se)=>{F.middleware=F.middleware||[],F.middleware.push(Se)},pluginDir:le,config:F};await ge.setup(ce,ye)}process.stderr.write(`[stx] Plugin loaded: ${ge.name||ae}
2292
+ </script>`}var A={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Rt,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:qf,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:up,hasEndTag:!1,description:"Include a web component in the template"},Ei,Ti,sr,or,Df,Of,Nf,Mf,Vf,Pf,tp,pl,...br],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,scrollRestoration:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function Hx(v,_,k){let R=_||"pages";if(v)return{root:v,pagesDir:R};let T=k||process.cwd(),B=Gt.join(T,"resources","views"),z=Gt.join(T,"resources","layouts");if($s.existsSync(B)&&$s.existsSync(z))return{root:"resources",pagesDir:"views"};let W=Gt.join(T,"resources","views","pages");if($s.existsSync(W))return{root:"resources/views",pagesDir:R};return{root:".",pagesDir:R}}var dp=new Set,ia=["partialsDir","componentsDir","layoutsDir"],gl=new WeakMap;function qx(v,_){let k=_.replace(/[\\/]+$/,"");if(!k||k===".")return!0;let R=v.replace(/\\/g,"/"),T=k.replace(/\\/g,"/");return R===T||R.startsWith(`${T}/`)}function Vc(v,_){let k=!v.root,R=Hx(v.root,v.pagesDir,_);if(v.root=R.root,v.pagesDir=R.pagesDir,k&&R.root!=="."){let T=`${_}::${R.root}`;if(!dp.has(T))dp.add(T),console.warn(`[stx] No "root" in config \u2014 inferred "${R.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!gl.has(v)){let T={};for(let B of ia){let z=v[B];if(typeof z==="string"&&z)T[B]=z}gl.set(v,T)}if(v.root&&v.root!=="."){let T=v.root;for(let B of ia){let z=v[B];if(typeof z!=="string"||!z)continue;if(Gt.isAbsolute(z)||qx(z,T))continue;v[B]=Gt.join(T,z)}}for(let T of ia){let B=v[T];if(typeof B!=="string"||!B||Gt.isAbsolute(B))continue;v[T]=Gt.resolve(_,B)}return v}function Kx(v,_){let k=gl.get(v);for(let R of ia){let T=v[R];if(typeof T!=="string"||!T)continue;let B=Gt.isAbsolute(T)?T:Gt.join(_,T);if($s.existsSync(B))continue;let z=k?.[R]??T,W=v.root,F=!!W&&W!==".";console.warn(`[stx] ${String(R)} resolves to "${B}", which does not exist. Configured as "${z}"`+(F?`, resolved under root "${W}".`:"."))}}function Xx(v){if(v.customDirectives)v.customDirectives=[...v.customDirectives];if(v.middleware)v.middleware=[...v.middleware];if(v.apiRoutes)v.apiRoutes={...v.apiRoutes}}function Zx(v){if(Ii(v.stateDir),v.stateDir=un(),v.cachePath=pn(v.cachePath),v.build)v.build.cacheDir=pn(v.build.cacheDir);if(v.media?.cache)v.media.cache.directory=pn(v.media.cache.directory);if(v.story)v.story.outDir=pn(v.story.outDir)}var vr=null,Mr=new Map,sa=new Map,Ji=null;async function Ts(v,_=Ux){try{return await _(v)}catch(k){if(k instanceof Error&&k.name==="ConfigNotFoundError")return{config:v.defaultConfig};throw k}}async function o(v){let _=v?Gt.resolve(v):process.cwd(),k=sa.get(_);if(k&&k.signature!==tr(k.graph)){let B=Mr.get(_);if(Mr.delete(_),sa.delete(_),!v)vr=null,Ji=null;let{clearComponentCache:z}=await import("./chunk-bcjr3fw7.js"),{partialsCache:W}=await import("./chunk-bkj0j5se.js");if(z(),W.clear(),B&&k.configSignature===nr(k.graph)){let F=B.then(async(V)=>{let H={...k.graph};await Rs(H,_),sa.set(_,{graph:H,signature:tr(H),configSignature:nr(H)});let q={...V,_layerGraph:H};if(!v)vr=q;return q});return Mr.set(_,F),F}}if(!v){if(vr)return vr;if(Ji)return Ji}let R=Mr.get(_);if(R)return R;let T=(async()=>{let B=[".ts",".js",".mjs",".cjs",".json"],z=B.some((Q)=>$s.existsSync(Gt.join(_,`stx.config${Q}`))),W=B.some((Q)=>$s.existsSync(Gt.join(_,"config",`ui${Q}`))),F;if(z&&W){let Q=await Ts({name:"ui",cwd:Gt.join(_,"config"),defaultConfig:A,errorPolicy:"throw",verbose:!1});F=(await Ts({name:"stx",alias:"ui",cwd:_,defaultConfig:Q.config,errorPolicy:"throw",verbose:!1})).config}else F=(await Ts({name:"stx",alias:"ui",cwd:_,defaultConfig:A,errorPolicy:"throw",verbose:!1})).config;if(F.extends!==void 0||k){let Q=await Ai(_,A);F=Q.config,sa.set(_,{graph:Q.graph,signature:tr(Q.graph),configSignature:nr(Q.graph)})}if(F.runtimeConfig){let{resolveRuntimeConfig:Q}=await import("./chunk-zgxj1q7w.js");Q(F.runtimeConfig,{});let{generateRuntimeConfigTypes:Z}=await import("./chunk-tvb8p7c0.js");await Z(_,F.runtimeConfig)}Xx(F),Zx(F),Vc(F,_),Kx(F,_);let V=[],H=new Set((F.plugins??[]).map((Q)=>typeof Q==="string"?Q:Q[0]));for(let Q of F.componentPackages??["@stacksjs/components"]){let Z=`${Q}/stx-plugin`;if(H.has(Z)||H.has(Q))continue;try{u.resolve(Z,{paths:[_]}),V.push(Z)}catch{}}let q=[...F.plugins??[],...V];if(q.length>0){let{pluginManager:Q}=await import("./chunk-g6zeqvvb.js"),Z=[],ie=[];for(let oe of q){let ae=typeof oe==="string"?oe:oe[0],ce=typeof oe==="string"?{}:oe[1]||{};try{let de,le;try{let ye=u.resolve(ae,{paths:[_]});de=await import(ye),le=Gt.dirname(ye)}catch{let ye=Gt.resolve(_,ae);de=await import(ye),le=Gt.dirname(ye)}let ge=de.default||de;if(!Q.has(ge.name))await Q.register(ge,F);if(ge.components){let ye=Array.isArray(ge.components)?ge.components:[ge.components];for(let Se of ye)Z.push(Gt.resolve(le,Se))}if(ge.pages){let ye=Gt.resolve(le,ge.pages),Se=ce.path||"/";ie.push({dir:ye,prefix:Se})}if(ge.setup){let ye={addDirective:(Se)=>{F.customDirectives=F.customDirectives||[],F.customDirectives.push(Se)},addRoute:(Se,$e)=>{F.apiRoutes=F.apiRoutes||{},F.apiRoutes[Se]=$e},addMiddleware:(Se)=>{F.middleware=F.middleware||[],F.middleware.push(Se)},pluginDir:le,config:F};await ge.setup(ce,ye)}process.stderr.write(`[stx] Plugin loaded: ${ge.name||ae}
2293
2293
  `)}catch(de){console.warn(`[stx] Failed to load plugin ${ae}:`,de.message)}}F._pluginComponentDirs=Z,F._pluginPageDirs=ie}return F})();if(Mr.set(_,T),T.catch(()=>{if(Mr.get(_)===T)Mr.delete(_)}),!v)Ji=T,T.then((B)=>{vr=B}).catch(()=>{});return T}var P=new Proxy(A,{get(v,_){if(vr&&_ in vr)return vr[_];if(!Ji)o().catch((k)=>{console.warn("[stx] Failed to load config file:",k?.message||k)});return v[_]}});function iu(v){return v}function au(v){let _=[],k=[];if(v.partialsDir!==void 0&&typeof v.partialsDir!=="string")_.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(v.componentsDir!==void 0&&typeof v.componentsDir!=="string")_.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(v.cache!==void 0&&typeof v.cache!=="boolean")_.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(v.debug!==void 0&&typeof v.debug!=="boolean")_.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(v.streaming){if(v.streaming.bufferSize!==void 0){if(typeof v.streaming.bufferSize!=="number"||v.streaming.bufferSize<=0)_.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(v.streaming.timeout!==void 0){if(typeof v.streaming.timeout!=="number"||v.streaming.timeout<=0)_.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(v.streaming.strategy!==void 0){let R=["auto","manual","sections"];if(!R.includes(v.streaming.strategy))_.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.i18n){if(v.i18n.format!==void 0){let R=["json","yaml","yml","js"];if(!R.includes(v.i18n.format))_.push({path:"i18n.format",message:`i18n.format must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.animation){if(v.animation.defaultDuration!==void 0){if(typeof v.animation.defaultDuration!=="number"||v.animation.defaultDuration<0)_.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(v.animation.staggerDelay!==void 0){if(typeof v.animation.staggerDelay!=="number"||v.animation.staggerDelay<0)_.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(v.a11y){if(v.a11y.level!==void 0){let R=["AA","AAA"];if(!R.includes(v.a11y.level))_.push({path:"a11y.level",message:`a11y.level must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.hydration){if(v.hydration.mode!==void 0){let R=["progressive","islands"];if(!R.includes(v.hydration.mode))_.push({path:"hydration.mode",message:`hydration.mode must be one of: ${R.join(", ")}`,severity:"error"})}if(v.hydration.preload!==void 0){let R=["none","eager","lazy"];if(!R.includes(v.hydration.preload))_.push({path:"hydration.preload",message:`hydration.preload must be one of: ${R.join(", ")}`,severity:"error"})}}if(v.customDirectives)if(!Array.isArray(v.customDirectives))_.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else v.customDirectives.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`customDirectives[${T}].name`,message:"Custom directive must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`customDirectives[${T}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(v.middleware)if(!Array.isArray(v.middleware))_.push({path:"middleware",message:"middleware must be an array",severity:"error"});else v.middleware.forEach((R,T)=>{if(!R.name||typeof R.name!=="string")_.push({path:`middleware[${T}].name`,message:"Middleware must have a name string",severity:"error"});if(!R.handler||typeof R.handler!=="function")_.push({path:`middleware[${T}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!R.timing||!["before","after"].includes(R.timing))_.push({path:`middleware[${T}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(v.debug===!0&&v.cache===!0)k.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(v.seo?.enabled===!0&&!v.seo?.defaultConfig?.title)k.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(v.pwa){if(v.pwa.enabled===!0&&!v.pwa.manifest?.name)_.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(v.pwa.manifest?.display!==void 0){let R=["fullscreen","standalone","minimal-ui","browser"];if(!R.includes(v.pwa.manifest.display))_.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.manifest?.orientation!==void 0){let R=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!R.includes(v.pwa.manifest.orientation))_.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.routes){let R=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];v.pwa.routes.forEach((T,B)=>{if(!T.pattern||typeof T.pattern!=="string")_.push({path:`pwa.routes[${B}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!R.includes(T.strategy))_.push({path:`pwa.routes[${B}].strategy`,message:`PWA route strategy must be one of: ${R.join(", ")}`,severity:"error"});if(T.maxAgeSeconds!==void 0&&(typeof T.maxAgeSeconds!=="number"||T.maxAgeSeconds<0))_.push({path:`pwa.routes[${B}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(T.maxEntries!==void 0&&(typeof T.maxEntries!=="number"||T.maxEntries<1))_.push({path:`pwa.routes[${B}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(v.pwa.icons?.sizes){if(!Array.isArray(v.pwa.icons.sizes))_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(v.pwa.icons.sizes.filter((T)=>typeof T!=="number"||T<16||T>1024).length>0)_.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(v.pwa.icons?.purpose){let R=["any","maskable","monochrome"];if(v.pwa.icons.purpose.filter((B)=>!R.includes(B)).length>0)_.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${R.join(", ")}`,severity:"error"})}if(v.pwa.enabled===!0&&!v.pwa.icons?.src)k.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(v.pwa.enabled===!0&&!v.pwa.manifest?.themeColor)k.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:_.length===0,errors:_,warnings:k}}var hl=new Map;async function pe(v,_={}){try{if(!await r(v))throw Error(`Markdown file not found: ${v}`);let R=(await Gx.promises.stat(v)).mtime.getTime();if(_.cache&&hl.has(v)){let q=hl.get(v);if(q.updatedAt>=R)return{content:q.content,data:q.data}}let T=await Bun.file(v).text(),{data:B,content:z}=Hn(T),W=_.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},V=je(z,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)V=await Yx(V,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let H={content:V,data:B||{}};if(_.cache)hl.set(v,{...H,updatedAt:R});return H}catch(k){if(_.debug)console.error(`Error reading/parsing markdown file ${v}:`,k);let R=k instanceof Error?k.message:String(k);return{content:g("Markdown File",`Error reading/parsing markdown file: ${R}`,v,"",0,""),data:{}}}}var oa=null;async function Yx(v,_,k){let R=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!oa)try{oa=await Jx({theme:_||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),v}let T=async(W,F,V,H)=>{let q=H.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),Q=V||(k?"text":"");if(!Q)return W;try{if(!oa.getSupportedLanguages().includes(Q))return W;return(await oa.highlight(q,Q,{theme:_})).html}catch(Z){console.error(`Error highlighting code block with language ${V}:`,Z)}return W},B=v,z=v.matchAll(R);for(let W of z){let[F,V,H,q]=W,Q=await T(F,V,H,q);B=B.replace(F,Q)}return B}async function fp(v,_,k="",R={}){return await Qx(v,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(z,W,F,V)=>{try{let H=W;if(!ml.isAbsolute(W))H=ml.resolve(ml.dirname(k),W);let q={};if(F)try{try{q=JSON.parse(F)}catch{if(R.debug)console.warn("Using safer alternative for parsing JS object literal");let de=F.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let le of de){let ge=le.indexOf(":");if(ge>0){let ye=le.substring(0,ge).trim(),Se=le.substring(ge+1).trim(),$e=Se.startsWith('"')&&Se.endsWith('"'),Re=Se.startsWith("'")&&Se.endsWith("'");if($e||Re)Se=Se.substring(1,Se.length-1);q[ye]=Se}}}}catch(ce){if(R.debug)console.error("Error parsing context in @markdown-file directive:",ce)}let{content:Q,data:Z}=await pe(H,R),ie={..._,...Z,...q},oe=Q,ae=/\{\{([^}]+)\}\}/g;return oe=oe.replace(ae,(ce,de)=>{let le=de.trim();return ie[le]!==void 0?String(ie[le]):ce}),oe}catch(H){let q=H instanceof Error?H.message:String(H);return g("Markdown File",`Error including markdown file: ${q}`,k,v,V,z)}})}async function Qx(v,_,k){let R=[],T;while((T=_.exec(v))!==null){let W=T[0],F=T.index,V=T;R.push(k(...V).then((H)=>({match:W,replacement:H,index:F})))}let B=await Promise.all(R);B.sort((W,F)=>F.index-W.index);let z=v;for(let{match:W,replacement:F}of B)z=z.replace(W,()=>F);return z}function wr(v,_){try{let k=v.trim();if(p(k))return c(k,Object.keys(_))(...Object.values(_));else return l(k,_)}catch{return!1}}function Sr(v,_){let k=eb(v,_);return k.ok?{expression:k.expression,endPos:k.endPos}:null}function eb(v,_){let k=_;while(k<v.length&&/\s/.test(v[k]))k++;if(v[k]!=="(")return{ok:!1,reason:"missing-open-paren",pos:k};let R=S(v,"(",")",k);if(R===-1)return{ok:!1,reason:"unclosed-paren",pos:k};return{ok:!0,expression:v.slice(k+1,R),endPos:R+1}}function tb(v,_){let k=v.lastIndexOf("<",_);if(k===-1)return!1;return k>v.lastIndexOf(">",_)}function Or(v,_,k,R){let T=1,B=R,z=new RegExp(`@${_}\\s*\\(`,"g"),W=new RegExp(`@${k}(?![a-z])`,"g");while(B<v.length&&T>0){z.lastIndex=B,W.lastIndex=B;let F=z.exec(v),V=W.exec(v),H=F?F.index:1/0,q=V?V.index:1/0;if(H<q)T++,B=H+F[0].length;else if(q<1/0){if(T--,T===0)return q;B=q+V[0].length}else break}return-1}function pp(v,_){let k=v.slice(_).match(/^@if\s*/);if(!k)return null;let R=_+k[0].length,T=Sr(v,R);if(!T)return null;let B=T.endPos,z=Or(v,"if","endif",B);if(z===-1)return null;let W=v.slice(B,z),F=[],V=0,H="if",q=T.expression,Q=0,Z=0;while(V<W.length){let ie=W.indexOf("@",V);if(ie===-1)break;V=ie;let oe=W.substring(ie);if(tb(W,ie)){V++;continue}if(/^@if\s*\(/.test(oe)){Z++,V++;continue}if(/^@endif(?![a-z])/.test(oe)){Z--,V+=6;continue}if(Z===0){let ae=oe.match(/^@elseif\s*/);if(ae){F.push({type:H,condition:q,content:W.substring(Q,V),start:B+Q,end:B+V});let ce=V+ae[0].length,de=Sr(W,ce);if(!de){V++;continue}H="elseif",q=de.expression,V=de.endPos,Q=V;continue}else if(/^@else(?![a-z])/.test(oe)){F.push({type:H,condition:q,content:W.substring(Q,V),start:B+Q,end:B+V}),H="else",q=void 0,V+=5,Q=V;continue}}V++}return F.push({type:H,condition:q,content:W.slice(Q),start:B+Q,end:B+W.length}),{fullMatch:v.slice(_,z+6),branches:F,start:_,end:z+6}}function Yi(v){let _=[],k=/@if\s*\(/g,R=k.exec(v);while(R!==null){if(_.some((z)=>R.index>z.start&&R.index<z.end)){R=k.exec(v);continue}let B=pp(v,R.index);if(B)_.push(B),k.lastIndex=B.end;R=k.exec(v)}return _}function aa(v,_,k){let R=[],T=new RegExp(`@${_}\\s*\\(`,"g"),B=T.exec(v);while(B!==null){if(R.some((oe)=>B.index>oe.start&&B.index<oe.end)){B=T.exec(v);continue}let W=B.index,F=W+B[0].length-1,V=S(v,"(",")",F);if(V===-1){B=T.exec(v);continue}let H=v.slice(F+1,V),q=V+1,Q=Or(v,_,k,q);if(Q===-1){B=T.exec(v);continue}let Z=v.slice(q,Q),ie=Q+`@${k}`.length;R.push({fullMatch:v.slice(W,ie),name:_,params:H,content:Z,start:W,end:ie}),T.lastIndex=ie,B=T.exec(v)}return R}function yl(v,_){let k=v.slice(_).match(/^@switch\s*/);if(!k)return null;let R=_+k[0].length,T=Sr(v,R);if(!T)return null;let B=T.endPos,z=Or(v,"switch","endswitch",B);if(z===-1)return null;let W=v.slice(B,z),F=[],V=0,H=null,q=0;while(V<W.length){let Q=W.slice(V),Z=Q.match(/^@switch\s*\(/),ie=Q.match(/^@endswitch(?![a-z])/);if(Z){if(q++,H)H.content+=Z[0];V+=Z[0].length;continue}if(ie){if(q--,H)H.content+=ie[0];V+=ie[0].length;continue}if(q>0){if(H)H.content+=W[V];V++;continue}let oe=Q.match(/^@case\s*/),ae=Q.match(/^@default(?![a-z])/),ce=Q.match(/^@break(?![a-z])/);if(oe&&Q.startsWith("@case")){if(H)F.push(H);let de=V+oe[0].length,le=Sr(W,de);if(!le){V++;continue}H={type:"case",value:le.expression,content:""},V=le.endPos}else if(ae&&Q.startsWith("@default")){if(H)F.push(H);H={type:"default",content:""},V+=ae[0].length}else if(ce&&Q.startsWith("@break"))V+=ce[0].length;else{if(H)H.content+=W[V];V++}}if(H)F.push(H);return{fullMatch:v.slice(_,z+10),expression:T.expression,cases:F,start:_,end:z+10}}function ib(v,_,k){let R=v,T=!0;while(T){T=!1;let B=R.match(/@switch\s*\(/);if(!B||B.index===void 0)break;let z=B.index,W=yl(R,z);if(!W)break;try{let F;if(p(W.expression))F=c(W.expression,Object.keys(_))(...Object.values(_));else F=l(W.expression,_);let V="",H=!1;for(let q of W.cases)if(q.type==="default"){if(!H)V=q.content.trim()}else try{let Q;if(q.value&&p(q.value))Q=c(q.value,Object.keys(_))(...Object.values(_));else if(q.value)Q=l(q.value,_);if(F===Q){V=q.content.trim(),H=!0;break}}catch{continue}R=R.substring(0,z)+V+R.substring(W.end),T=!0}catch(F){let V=F instanceof Error?F.message:String(F),H=i("Switch",`Error evaluating @switch expression: ${V}`,t.EVALUATION_ERROR);R=R.substring(0,z)+H+R.substring(W.end);break}}return R}function ob(v){let _=[];return{masked:v.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(R)=>(_.push(R),`\x00stx-script-${_.length-1}\x00`)),scripts:_}}function ab(v,_){if(_.length===0)return v;return v.replace(/\u0000stx-script-(\d+)\u0000/g,(k,R)=>_[Number(R)]??k)}function ur(v,_,k){let{masked:R,scripts:T}=ob(v);return ab(cb(R,_,k),T)}function cb(v,_,k){let R=v;R=ib(R,_,k);{let B=!0;while(B){B=!1;let z=R.match(/@unless\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=Sr(R,W+7);if(!F)break;let V=F.endPos,H=Or(R,"unless","endunless",V);if(H===-1){console.warn(`[stx] @unless directive at position ${W} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let q=R.slice(V,H),Q=F.expression,Z=-1;{let oe=0,ae=/@(?:if|unless)\s*\(/g,ce=/@(?:endif|endunless)(?![a-z])/g,de=/@else(?![a-z])/g,le=[],ge;while((ge=ae.exec(q))!==null)le.push({pos:ge.index,type:"open"});while((ge=ce.exec(q))!==null)le.push({pos:ge.index,type:"close"});while((ge=de.exec(q))!==null)le.push({pos:ge.index,type:"else"});le.sort((ye,Se)=>ye.pos-Se.pos);for(let ye of le)if(ye.type==="open")oe++;else if(ye.type==="close")oe--;else if(ye.type==="else"&&oe===0){Z=ye.pos;break}}let ie;if(Z!==-1){let oe=q.slice(0,Z),ae=q.slice(Z+5);ie=`@if (${Q})${ae}@else ${oe}@endif`}else ie=`@if (!(${Q}))${q}@endif`;R=R.substring(0,W)+ie+R.substring(H+10),B=!0}}R=bl(R,_,k),R=vl(R,_,k),R=xl(R,_);let T=()=>{let B=Yi(R);if(B.length===0)return!1;let z=Array(B.length);for(let V=B.length-1;V>=0;V--){let H=B[V];try{let q="",Q=!1;for(let Z of H.branches){if(Q)break;if(Z.type==="else")q=Z.content,Q=!0;else try{if(Z.condition?Bi(Z.condition,_):!1)q=Z.content,Q=!0}catch(ie){q=i(Z.type==="if"?"If":"Elseif",`Error in @${Z.type}(${Z.condition}): ${ie instanceof Error?ie.message:String(ie)}`,t.EVALUATION_ERROR),Q=!0}}z[V]=q}catch(q){let Q=q instanceof Error?q.message:String(q);z[V]=i("If",`Error processing @if block: ${Q}`,t.EVALUATION_ERROR)}}let W=Array(B.length*2+1),F=0;for(let V=0;V<B.length;V++){let H=B[V];W[V*2]=R.slice(F,H.start),W[V*2+1]=z[V],F=H.end}return W[B.length*2]=R.slice(F),R=W.join(""),!0};while(!0){let B=R;if(!T())break;if(R===B)break}return R}function gp(v){let _=0;while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!=="(")return null;_++;while(_<v.length&&/\s/.test(v[_]))_++;let k=v[_];if(k!=="'"&&k!=='"')return null;_++;let R=[];while(_<v.length){let T=v[_];if(T==="\\"&&_+1<v.length){R.push(v[_+1]),_+=2;continue}if(T===k){_++;break}R.push(T),_++}while(_<v.length&&/\s/.test(v[_]))_++;if(v[_]!==")")return null;return _++,{value:R.join(""),consumed:_}}function xl(v,_){let k=v;function R(W,F,V,H){let q=1,Q=H,Z=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),ie=new RegExp(`@${V}(?![a-z])`,"g");while(Q<W.length&&q>0){Z.lastIndex=Q,ie.lastIndex=Q;let oe=Z.exec(W),ae=ie.exec(W),ce=oe?oe.index:1/0,de=ae?ae.index:1/0;if(ce<de)q++,Q=ce+oe[0].length;else if(de<1/0){if(q--,q===0)return de;Q=de+ae[0].length}else break}return-1}function T(W,F,V){let H=0,q=new RegExp(`@${F}(?:\\s*\\(|\\s|$)`,"g"),Q=new RegExp(`@${V}(?![a-z])`,"g"),Z=/@else(?![a-z])/g,ie=[],oe;while((oe=q.exec(W))!==null)ie.push({pos:oe.index,type:"open"});while((oe=Q.exec(W))!==null)ie.push({pos:oe.index,type:"close"});while((oe=Z.exec(W))!==null)ie.push({pos:oe.index,type:"else"});ie.sort((ae,ce)=>ae.pos-ce.pos);for(let ae of ie)if(ae.type==="open")H++;else if(ae.type==="close")H--;else if(ae.type==="else"&&H===0)return ae.pos;return-1}{let W=!0;while(W){W=!1;let F=k.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,q,Q=k.slice(V+5),Z=gp(Q);if(Z)H=Z.value,q=V+5+Z.consumed;else q=V+5;let ie=R(k,"auth","endauth",q);if(ie===-1){console.warn(`[stx] @auth directive at position ${V} has no matching @endauth \u2014 the block was skipped.`);break}let oe=k.slice(q,ie),ae=T(oe,"auth","endauth"),ce;if(!_.auth)ce=!1;else ce=H?wr(`auth?.check && auth?.user?.[${H}]`,_):wr("auth?.check",_);let de;if(ae!==-1){let le=oe.slice(0,ae),ge=oe.slice(ae+5);de=ce?le:ge}else de=ce?oe:"";k=k.substring(0,V)+de+k.substring(ie+8),W=!0}}{let W=!0;while(W){W=!1;let F=k.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!F||F.index===void 0)break;let V=F.index,H,q,Q=k.slice(V+6),Z=gp(Q);if(Z)H=Z.value,q=V+6+Z.consumed;else q=V+6;let ie=R(k,"guest","endguest",q);if(ie===-1){console.warn(`[stx] @guest directive at position ${V} has no matching @endguest \u2014 the block was skipped.`);break}let oe=k.slice(q,ie),ae=T(oe,"guest","endguest"),ce;if(!_.auth)ce=!0;else ce=H?wr(`!auth?.check || !auth?.user?.[${H}]`,_):wr("!auth?.check",_);let de;if(ae!==-1){let le=oe.slice(0,ae),ge=oe.slice(ae+5);de=ce?le:ge}else de=ce?oe:"";k=k.substring(0,V)+de+k.substring(ie+9),W=!0}}function B(W,F,V){if(_.userCan&&typeof _.userCan[W]==="boolean")return _.userCan[W];if(_.permissions?.check&&typeof _.permissions.check==="function")try{let H=[W];if(F)H.push(F);if(V){let q=wr(V,_);H.push(q)}return _.permissions.check(...H)}catch{return!1}return!1}function z(W){let F=W.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!F)return null;return{ability:F[1],type:F[2],id:F[3]?.trim(),paramsEnd:F[0].length}}for(let W of["can","cannot"]){let F=`end${W}`,V=W==="can"?"elsecan":"elsecannot",H=!0;while(H){H=!1;let q=k.match(new RegExp(`@${W}\\s*\\(`));if(!q||q.index===void 0)break;let Q=q.index,Z=k.slice(Q+`@${W}`.length),ie=z(Z);if(!ie)break;let oe=Q+`@${W}`.length+ie.paramsEnd,ae=R(k,W,F,oe);if(ae===-1){console.warn(`[stx] @${W} directive at position ${Q} has no matching @${F} \u2014 the block was skipped.`);break}let ce=k.slice(oe,ae),de=[],le=0,ge=new RegExp(`@${W}\\s*\\(`,"g"),ye=new RegExp(`@${F}(?![a-z])`,"g"),Se=new RegExp(`@${V}\\s*\\(`,"g"),$e=/@else(?![a-z])/g,Re=[],Ae;while((Ae=ge.exec(ce))!==null)Re.push({pos:Ae.index,type:"open"});while((Ae=ye.exec(ce))!==null)Re.push({pos:Ae.index,type:"close"});while((Ae=Se.exec(ce))!==null)Re.push({pos:Ae.index,type:"elseDirective"});while((Ae=$e.exec(ce))!==null)Re.push({pos:Ae.index,type:"else"});Re.sort((Oe,Pe)=>Oe.pos-Pe.pos);for(let Oe of Re){if(Oe.type==="open"){le++;continue}if(Oe.type==="close"){le--;continue}if(le===0)de.push(Oe)}let Te=[],Ie=0;for(let Oe=0;Oe<de.length;Oe++){let Pe=de[Oe];if(Te.push({content:ce.slice(Ie,Pe.pos),ability:void 0}),Pe.type==="elseDirective"){let Le=ce.slice(Pe.pos+`@${V}`.length),ct=z(Le);if(ct){Te[Te.length-1]={content:ce.slice(Ie,Pe.pos)},Ie=Pe.pos+`@${V}`.length+ct.paramsEnd,Te.push({content:"",ability:ct.ability,type:ct.type,id:ct.id}),Te.pop();let yt=de[Oe+1],ft=yt?yt.pos:ce.length;Te.push({content:ce.slice(Ie,ft),ability:ct.ability,type:ct.type,id:ct.id}),Ie=ft}}else Ie=Pe.pos+5}if(Ie<ce.length){let Oe=Te[Te.length-1];if(de.length>0&&de[de.length-1].type==="else")Te.push({content:ce.slice(Ie),isFinalElse:!0});else if(Te.length===0)Te.push({content:ce.slice(Ie)})}let _e=B(ie.ability,ie.type,ie.id),De=W==="can"?_e:!_e,Ne="";if(De)Ne=Te[0]?.content||"";else{let Oe=!1;for(let Pe=1;Pe<Te.length;Pe++){let Le=Te[Pe];if(Le.isFinalElse){Ne=Le.content,Oe=!0;break}if(Le.ability){let ct=B(Le.ability,Le.type,Le.id);if(W==="can"?ct:!ct){Ne=Le.content,Oe=!0;break}}}if(!Oe&&Te.length>0){let Pe=Te[Te.length-1];if(Pe.isFinalElse)Ne=Pe.content}}k=k.substring(0,Q)+Ne+k.substring(ae+`@${F}`.length),H=!0}}return k}function bl(v,_,k){let R=v;function T(B,z,W,F,V){let H=!0;while(H){H=!1;let q=new RegExp(`@${z}\\s*\\(`),Q=B.match(q);if(!Q||Q.index===void 0)break;let Z=Q.index,ie=Sr(B,Z+`@${z}`.length);if(!ie)break;let oe=ie.endPos,ae=Or(B,z,W,oe);if(ae===-1){console.warn(`[stx] @${z} directive at position ${Z} has no matching @${W} \u2014 the block was skipped.`);break}let ce=B.slice(oe,ae),de=ie.expression,le=-1,ge=0,ye=0;while(ye<ce.length){let Se=ce.indexOf("@",ye);if(Se===-1)break;let $e=ce.substring(Se);if(/^@(?:if|unless|isset|empty)\s*\(/.test($e)){ge++,ye=Se+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test($e)){ge--,ye=Se+1;continue}if(ge===0&&/^@else(?![a-z])/.test($e)){le=Se;break}ye=Se+1}try{let Se=F(de.trim()),$e;if(le!==-1){let Re=ce.slice(0,le),Ae=ce.slice(le+5);$e=Se?Re:Ae}else $e=Se?ce:"";B=B.substring(0,Z)+$e+B.substring(ae+`@${W}`.length),H=!0}catch(Se){let $e=Se instanceof Error?Se.message:String(Se),Re=i(V,`Error processing @${z} directive: ${$e}`,t.EVALUATION_ERROR);B=B.substring(0,Z)+Re+B.substring(ae+`@${W}`.length);break}}return B}return R=T(R,"isset","endisset",(B)=>{let z=wr(B,_);return z!==void 0&&z!==null},"Isset"),R=T(R,"empty","endempty",(B)=>{let z=wr(B,_);return z===void 0||z===null||z===""||z===0||z===!1||Array.isArray(z)&&z.length===0||typeof z==="object"&&z!==null&&Object.keys(z).length===0},"Empty"),R}function vl(v,_,k){let R=v,T="development";function B(z,W,F,V){let H=new RegExp(`@${W}(?![a-z])`,"g"),q=new RegExp(`@${F}(?![a-z])`,"g"),Q=new RegExp(`^@${W}(?![a-z])`),Z=new RegExp(`^@${F}(?![a-z])`),ie=z,oe=!0;while(oe){oe=!1,H.lastIndex=0;let ae=H.exec(ie);if(!ae)break;let ce=ae.index,de=ce+ae[0].length;if(W==="env"){let _e=ie.substring(de).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!_e)break;de+=_e[0].length,V=T===_e[2]}let le=1,ge=de,ye=-1;while(le>0&&ge<ie.length){H.lastIndex=ge,q.lastIndex=ge;let _e=H.exec(ie),De=q.exec(ie),Ne=_e?_e.index:1/0,Oe=De?De.index:1/0;if(Ne<Oe)le++,ge=Ne+_e[0].length;else if(Oe<1/0){if(le--,le===0){ye=Oe;break}ge=Oe+De[0].length}else break}if(ye===-1){console.warn(`[stx] @${W} directive at position ${ce} has no matching @${F} \u2014 the block was skipped.`);break}let Se=ie.substring(de,ye),$e=-1,Re=0,Ae=0;while(Ae<Se.length){let _e=Se.indexOf("@",Ae);if(_e===-1)break;let De=Se.substring(_e);if(Q.test(De)){Re++,Ae=_e+1;continue}if(Z.test(De)){Re--,Ae=_e+1;continue}if(Re===0&&/^@else(?![a-z])/.test(De)){$e=_e;break}Ae=_e+1}let Te;if($e!==-1){let _e=Se.slice(0,$e),De=Se.slice($e+5);Te=V?_e:De}else Te=V?Se:"";let Ie=`@${F}`.length;ie=ie.substring(0,ce)+Te+ie.substring(ye+Ie),oe=!0}return ie}return R=B(R,"env","endenv",!1),R=B(R,"production","endproduction",T==="production"),R=B(R,"development","enddevelopment",T==="development"),R=B(R,"staging","endstaging",T==="staging"),R=B(R,"testing","endtesting",T==="testing"),R}var mp=new WeakMap;function hp(v=16){let _=new Uint8Array(v);return crypto.getRandomValues(_),btoa(String.fromCharCode(..._))}function ca(v,_){if(!v)return _?.nonceGenerator?.()??hp();let k=mp.get(v);if(!k)k=_?.nonceGenerator?.()??hp(),mp.set(v,k);return k}function lb(v,_){let k=[];for(let[R,T]of Object.entries(v)){if(T===void 0||T===null)continue;if(typeof T==="boolean"){if(T)k.push(R);continue}if(Array.isArray(T)){let B=[...T];if(_&&(R==="script-src"||R==="style-src"))B=B.filter((z)=>!z.startsWith("'nonce-")),B.push(`'nonce-${_}'`);if(B.length>0)k.push(`${R} ${B.join(" ")}`)}}return k.join("; ")}function yp(v,_){return`<meta http-equiv="Content-Security-Policy" content="${lb(v,_).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function xp(v,_,k){if(!_.enabled||!_.addMetaTag)return v;if(v.includes('http-equiv="Content-Security-Policy"'))return v;if(!v.includes("<head>")&&!v.includes("<head "))return v;let R=_.useNonce?ca(k,_):void 0,T=yp(_.directives,R);return v.replace(/<head([^>]*)>/,`<head$1>
2294
- ${T}`)}function bp(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function vp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?ca(_,B):void 0;return yp(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return ca(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=ca(_,B);return T}import ub from"crypto";var db=40,wp="_token",wl=null;function fb(v=db){let _=ub.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return wl=_,_}function pb(){if(!wl)fb();return wl}function gb(v=wp){let _=pb();return`<input type="hidden" name="${v}" value="${_}">`}function Sp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>gb(R||wp))}async function $p(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await mb(T,B,_,k,R);else T=await hb(T,B,_,k,R)}return T}async function mb(v,_,k,R,T){let{name:B,handler:z}=_,W=`@${B}`,F=`@end${B}`,V=v,H=Tr(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),q=[],Q=H.exec(V);while(Q!==null){let[Z,ie="",oe=""]=Q,ae=Q.index||0;try{let ce=ie?_p(_,ie):[],de=oe.trim(),le=await z(de,ce,k,R);q.push({original:Z,processed:le,startIndex:ae})}catch(ce){let de=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);q.push({original:Z,processed:i("CustomDirective",`Error in @${B}${ie?`(${ie})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:ae})}Q=H.exec(V)}for(let Z=q.length-1;Z>=0;Z--){let{original:ie,processed:oe}=q[Z];V=V.replace(ie,oe)}return V}async function hb(v,_,k,R,T){let{name:B,handler:z}=_,W=v,F=[],V=[];if(_.rawParams){for(let Q of Ns(W,Tr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(Q.end!==-1)V.push({fullMatch:Q.call,paramString:Q.args,startIndex:Q.start})}else{let Q=Tr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Q.lastIndex=0;let Z=Q.exec(W);while(Z!==null)V.push({fullMatch:Z[0],paramString:Z[1]??"",startIndex:Z.index||0}),Z=Q.exec(W)}for(let{fullMatch:Q,paramString:Z,startIndex:ie}of V)try{let oe=_p(_,Z),ae=await z("",oe,k,R);F.push({original:Q,processed:ae,startIndex:ie})}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${B}:`,oe);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}(${Z}): ${ae}`,t.EVALUATION_ERROR),startIndex:ie})}let H=Tr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(W);while(q!==null){let[Q]=q,Z=q.index||0;try{let ie=await z("",[],k,R);F.push({original:Q,processed:ie,startIndex:Z})}catch(ie){let oe=ie instanceof Error?ie.message:String(ie);if(T.debug)console.error(`Error processing custom directive @${B}:`,ie);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}: ${oe}`,t.EVALUATION_ERROR),startIndex:Z})}q=H.exec(W)}for(let Q=F.length-1;Q>=0;Q--){let{original:Z,processed:ie}=F[Q];W=W.replace(Z,ie)}return W}function _p(v,_){return v.rawParams?Qe(_):yb(_)}function yb(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var kp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ep=/^[A-Za-z_$][\w$]*$/,xb=new Set(["light","dark","system"]);function Nr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function bb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Nr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Nr(R.key,"colorMode.key"),Nr(R.attribute,"colorMode.attribute"),Nr(R.default,"colorMode.default"),!Ep.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!xb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Nr(k.key,"appearance.key"),Nr(k.attribute,"appearance.attribute"),Nr(k.default,"appearance.default"),!Ep.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function vb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function wb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${vb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Sb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Cp(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Sb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=k.slice(B+1,z).trim(),F=l(`(${W})`,_),V=wb(bb(F));k=k.slice(0,T.index)+V+k.slice(z+1),R.lastIndex=T.index+V.length}return k}import $b from"crypto";function qt(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Ap={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function la(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function kn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function As(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${qt(_)}"`}function Sl(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${qt(`${kn(v)}-error`)}"`;return R}function _b(){return $b.randomUUID()}function ua(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=_b();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${qt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${qt(B)}">`;return R}),k}function Tp(v,_,k=Ap){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"POST",q=W||F||"",Q=$r(V),Z=H.toUpperCase(),ie=["GET","POST"].includes(Z)?Z:"POST",oe=`<form method="${qt(ie)}" action="${qt(q)}"${Q?` ${Q}`:""}>`;if(oe+=`
2294
+ ${T}`)}function bp(v,_){let k=v;return k=k.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<script nonce="${_}"${T}>`}),k=k.replace(/<style([^>]*)>/gi,(R,T)=>{if(T.includes("nonce="))return R;return`<style nonce="${_}"${T}>`}),k}function vp(v,_,k,R){let T=v,B=R.csp;if(T=T.replace(/@csp\b/g,()=>{if(!B?.enabled||!B.directives)return"<!-- CSP not configured -->";let z=B.useNonce?ca(_,B):void 0;return yp(B.directives,z)}),T=T.replace(/@cspNonce\b/g,()=>{if(!B?.enabled||!B.useNonce)return"";return ca(_,B)}),B?.enabled&&B.useNonce)_.cspNonce=ca(_,B);return T}import ub from"crypto";var db=40,wp="_token",wl=null;function fb(v=db){let _=ub.randomBytes(Math.ceil(v/2)).toString("hex").slice(0,v);return wl=_,_}function pb(){if(!wl)fb();return wl}function gb(v=wp){let _=pb();return`<input type="hidden" name="${v}" value="${_}">`}function Sp(v){return v.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(_,k,R)=>gb(R||wp))}async function $p(v,_,k,R){if(!R.customDirectives||R.customDirectives.length===0)return v;let T=v;for(let B of R.customDirectives){if(!B.name||typeof B.handler!=="function"){if(R.debug)console.warn("Invalid custom directive:",B);continue}if(B.hasEndTag)T=await mb(T,B,_,k,R);else T=await hb(T,B,_,k,R)}return T}async function mb(v,_,k,R,T){let{name:B,handler:z}=_,W=`@${B}`,F=`@end${B}`,V=v,H=Tr(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${F}`,"g"),q=[],Q=H.exec(V);while(Q!==null){let[Z,ie="",oe=""]=Q,ae=Q.index||0;try{let ce=ie?_p(_,ie):[],de=oe.trim(),le=await z(de,ce,k,R);q.push({original:Z,processed:le,startIndex:ae})}catch(ce){let de=ce instanceof Error?ce.message:String(ce);if(T.debug)console.error(`Error processing custom directive @${B}:`,ce);q.push({original:Z,processed:i("CustomDirective",`Error in @${B}${ie?`(${ie})`:""}: ${de}`,t.EVALUATION_ERROR),startIndex:ae})}Q=H.exec(V)}for(let Z=q.length-1;Z>=0;Z--){let{original:ie,processed:oe}=q[Z];V=V.replace(ie,oe)}return V}async function hb(v,_,k,R,T){let{name:B,handler:z}=_,W=v,F=[],V=[];if(_.rawParams){for(let Q of Ns(W,Tr(`(?<![\\w$@])@${B}\\s*\\(`,"g")))if(Q.end!==-1)V.push({fullMatch:Q.call,paramString:Q.args,startIndex:Q.start})}else{let Q=Tr(`@${B}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");Q.lastIndex=0;let Z=Q.exec(W);while(Z!==null)V.push({fullMatch:Z[0],paramString:Z[1]??"",startIndex:Z.index||0}),Z=Q.exec(W)}for(let{fullMatch:Q,paramString:Z,startIndex:ie}of V)try{let oe=_p(_,Z),ae=await z("",oe,k,R);F.push({original:Q,processed:ae,startIndex:ie})}catch(oe){let ae=oe instanceof Error?oe.message:String(oe);if(T.debug)console.error(`Error processing custom directive @${B}:`,oe);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}(${Z}): ${ae}`,t.EVALUATION_ERROR),startIndex:ie})}let H=Tr(`@${B}(?!\\w)(?!\\s*\\()`,"g"),q=H.exec(W);while(q!==null){let[Q]=q,Z=q.index||0;try{let ie=await z("",[],k,R);F.push({original:Q,processed:ie,startIndex:Z})}catch(ie){let oe=ie instanceof Error?ie.message:String(ie);if(T.debug)console.error(`Error processing custom directive @${B}:`,ie);F.push({original:Q,processed:i("CustomDirective",`Error in @${B}: ${oe}`,t.EVALUATION_ERROR),startIndex:Z})}q=H.exec(W)}for(let Q=F.length-1;Q>=0;Q--){let{original:Z,processed:ie}=F[Q];W=W.replace(Z,ie)}return W}function _p(v,_){return v.rawParams?Qe(_):yb(_)}function yb(v){if(!v.trim())return[];let _=[],k="",R=!1,T="";for(let B=0;B<v.length;B++){let z=v[B];if((z==='"'||z==="'")&&(B===0||v[B-1]!=="\\"))if(!R)R=!0,T=z;else if(z===T)R=!1;else k+=z;else if(z===","&&!R)_.push(k.trim()),k="";else k+=z}if(k.trim())_.push(k.trim());return _.map((B)=>{let z=B.trim();if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))return z.substring(1,z.length-1);return z})}var kp=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ep=/^[A-Za-z_$][\w$]*$/,xb=new Set(["light","dark","system"]);function Nr(v,_){if(typeof v!=="string"||v.length===0)throw Error(`@appearanceBootstrap ${_} must be a non-empty string`)}function bb(v){if(!v||typeof v!=="object"||Array.isArray(v))throw Error("@appearanceBootstrap expects an options object");let _=v,{appearance:k,colorMode:R}=_;if(Nr(_.storageKey,"storageKey"),k!==void 0&&(!k||typeof k!=="object"||Array.isArray(k)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!R||typeof R!=="object"||Array.isArray(R))throw Error("@appearanceBootstrap colorMode must be an object");if(Nr(R.key,"colorMode.key"),Nr(R.attribute,"colorMode.attribute"),Nr(R.default,"colorMode.default"),!Ep.test(R.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kp.test(R.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!xb.has(R.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let T=null;if(k){if(Nr(k.key,"appearance.key"),Nr(k.attribute,"appearance.attribute"),Nr(k.default,"appearance.default"),!Ep.test(k.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!kp.test(k.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(k.allowed)||k.allowed.length===0||k.allowed.some((B)=>typeof B!=="string"||B.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!k.allowed.includes(k.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");T={key:k.key,attribute:k.attribute,allowed:[...new Set(k.allowed)],default:k.default}}return{storageKey:_.storageKey,appearance:T,colorMode:{key:R.key,attribute:R.attribute,default:R.default},respectExisting:_.respectExisting===!0}}function vb(v){return JSON.stringify(v).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function wb(v){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${vb(v)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Sb(v,_){let k=1,R=null,T=!1;for(let B=_+1;B<v.length;B++){let z=v[B];if(T){T=!1;continue}if(R){if(z==="\\")T=!0;else if(z===R)R=null;continue}if(z==='"'||z==="'"||z==="`"){R=z;continue}if(z==="(")k++;else if(z===")"&&--k===0)return B}return-1}function Cp(v,_){let k=v,R=/@appearanceBootstrap\s*\(/g,T;while((T=R.exec(k))!==null){let B=T.index+T[0].length-1,z=Sb(k,B);if(z===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=k.slice(B+1,z).trim(),F=l(`(${W})`,_),V=wb(bb(F));k=k.slice(0,T.index)+V+k.slice(z+1),R.lastIndex=T.index+V.length}return k}import $b from"crypto";function Kt(v){return String(v??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Ap={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function la(v,_,k,R){let T=v||_;return k?`${T} ${R}`:T}function kn(v){return String(v).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function As(v,_){if(/\bid\s*=/i.test(v))return"";return` id="${Kt(_)}"`}function Sl(v,_,k){if(!_)return"";let R="";if(!/\baria-invalid\s*=/i.test(k))R+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(k))R+=` aria-describedby="${Kt(`${kn(v)}-error`)}"`;return R}function _b(){return $b.randomUUID()}function ua(v,_){let k=v;return k=k.replace(/@csrf/g,()=>{if(!_.csrf||typeof _.csrf!=="object"){let R=_b();_.csrf={token:R}}if(_.csrf.field)return _.csrf.field;if(_.csrf.token)return`<input type="hidden" name="_token" value="${Kt(_.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),k=k.replace(/@method\(['"]([^'"]+)['"]\)/g,(R,T)=>{let B=T.toUpperCase();if(T&&!["GET","POST"].includes(B))return`<input type="hidden" name="_method" value="${Kt(B)}">`;return R}),k}function Tp(v,_,k=Ap){let R=v;return R=R.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"POST",q=W||F||"",Q=$r(V),Z=H.toUpperCase(),ie=["GET","POST"].includes(Z)?Z:"POST",oe=`<form method="${Kt(ie)}" action="${Kt(q)}"${Q?` ${Q}`:""}>`;if(oe+=`
2295
2295
  ${ua("@csrf",_)}`,!["GET","POST"].includes(Z))oe+=`
2296
- ${ua(`@method('${Z}')`,_)}`;return oe}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"",q=W||F||"",Q=$r(V),Z=Qi(H,_),ie=Z!==void 0&&Z!==null?Z:q||"",oe=Q.match(/type=['"]([^'"]+)['"]/i),ae=oe?oe[1]:"text",ce=eo(H,_),de=Q.match(/class=['"]([^'"]+)['"]/i),le=la(de?de[1]:"",k.input,ce,k.inputError),ge=Q.replace(/class=['"][^'"]+['"]/i,"");return ge=ge.replace(/type=['"][^'"]+['"]/i,""),`<input type="${qt(ae)}" name="${qt(H)}"${As(Q,kn(H))} value="${qt(ie)}" class="${le}"${Sl(H,ce,Q)}${ge?` ${ge}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",W="")=>{let F=$r(z),V=Qi(B,_)||W.trim(),H=eo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${qt(B)}"${As(F,kn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${qt(V)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",W)=>{let F=$r(z),V=Qi(B,_),H=eo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,""),ie=W;if(V!==void 0)ie=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(oe,ae,ce)=>{if((Array.isArray(V)?V.some((le)=>String(le)===ce):String(V)===ce)&&!ae.includes("selected"))return ae.replace(/(<option)/,"$1 selected");return oe});return`<select name="${qt(B)}"${As(F,kn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${ie}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=z===void 0?"1":z,V=z===void 0?kn(B):`${kn(B)}-${kn(F)}`,H=$r(W),q=Qi(B,_),Q=q!==void 0&&(Array.isArray(q)?q.some((ae)=>String(ae)===F):q===!0||String(q)===F),Z=H.match(/class=['"]([^'"]+)['"]/i),ie=Z?Z[1]:k.checkInput,oe=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${qt(B)}"${As(H,V)} value="${qt(F)}" class="${ie}"${Q?" checked":""}${oe?` ${oe}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=$r(W),V=Qi(B,_),H=V!==void 0&&V===z,q=F.match(/class=['"]([^'"]+)['"]/i),Q=q?q[1]:k.checkInput,Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${qt(B)}"${As(F,`${kn(B)}-${kn(z)}`)} value="${qt(z)}" class="${Q}"${H?" checked":""}${Z?` ${Z}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let W=$r(z),F=W.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=W.includes("multiple"),q=eo(B,_),Q=W.match(/class=['"]([^'"]+)['"]/i),Z=la(Q?Q[1]:"",k.input,q,k.inputError),ie=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),oe=[`<input type="file" name="${qt(B)}"${As(W,kn(B))}`,`class="${Z}"`];if(V)oe.push(`accept="${qt(V)}"`);if(H)oe.push("multiple");if(ie)oe.push(ie);return`${oe.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",W)=>{let F=$r(z),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,q=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${qt(kn(B))}" class="${H}"${q?` ${q}`:""}>${W}</label>`}),R}function Ip(v,_,k=Ap){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(eo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(W,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Rp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Rp(T,_)}let V=F.trim();if(p(V)){let H=l(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${qt(`${kn(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function eo(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Rp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function Qi(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function $r(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var to=/<\/?template\b[^>]*>/gi,kb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Eb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return kb.test(_)}function te(v){to.lastIndex=0;let _;while((_=to.exec(v))!==null){if(_[0].startsWith("</")||Eb(_[0]))continue;let k=_.index,R=to.lastIndex,T=1,B;while((B=to.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:to.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import zt from"path";import{existsSync as Gv}from"fs";class Pp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))if(await r(B))return B;return null}}var Ws=new Pp;function Bt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var _r="\x00stx-boolean-attribute";function $l(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Cb=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function _l(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Cb.has(_)}function kr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(Bt(B));continue}if(T===_r){k.push(Bt(B));continue}k.push(`${Bt(B)}="${Bt($l(String(T)))}"`)}return k}function Er(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(Bt(B));continue}if(typeof T==="object")continue;k.push(`${Bt(B)}="${Bt($l(String(T)))}"`)}return k}function Vs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rb(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var kl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Rb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",W=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(R.reactive)F.push(`:href="${Vs(R.value)}"`);else F.push(`href="${Vs(_i(R.value,"navigable"))}"`);if(T)F.push(`class="${Vs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Vs(B)}"`),F.push(`data-stx-exact-active-class="${Vs(z)}"`),W)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Vs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...kr(v,H)),F.push(...Er(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as Hp}from"crypto";import tn from"fs";import Gt from"path";import{decode as Nb,generateThumbHash as jb}from"ts-images";import{createImageDeliveryCatalog as Lp}from"ts-images/delivery";import El from"fs";function da(v,_,k){let R=Buffer.alloc(k),T=El.readSync(v,R,0,k,_);return R.subarray(0,T)}function Cl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Rl(v){let _;try{_=El.openSync(v,"r");let k=da(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=da(_,T,8);if(z.length<8)return"unknown";let W=z.toString("latin1",4,8);if(W==="tRNS")return"possible";if(W==="IDAT"||W==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Cl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)El.closeSync(_)}}import Ab from"fs";import fa from"os";import{join as Dp}from"path";import{fileURLToPath as Mp}from"url";import{Worker as Op}from"worker_threads";var ga=Symbol("stx.image-worker.unavailable");function Tb(v=typeof fa.availableParallelism==="function"?fa.availableParallelism():fa.cpus().length){return Math.max(1,Math.min(2,v-1))}var pa=0,jp=[];async function Ib(){if(pa<Tb()){pa++;return}await new Promise((v)=>jp.push(v)),pa++}function Pb(){pa--,jp.shift()?.()}var Db="@stacksjs/stx/builtins/image-warmup-worker";function Mb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Ab.existsSync(Mp(k)))return Mp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Db,v):void 0;return k&&Ob(k)?k:void 0}catch{return}}function Ob(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Dp(_.BUN_INSTALL||Dp(fa.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Np=!1;function no(v){if(!Np)Np=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ga}function Al(v){return v instanceof Error?v.message:String(v)}async function Tl(v,_){if(typeof Op!=="function")return no("node:worker_threads has no Worker in this runtime");let k=Mb();if(!k)return no("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Ib();try{return await new Promise((R,T)=>{let B;try{B=new Op(k)}catch(V){R(no(`could not start ${k}: ${Al(V)}`));return}let z=!1,W=!1,F=(V)=>{if(W)return;W=!0,V(),B.terminate()};B.on("message",(V)=>{if(V.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>R(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),B.on("error",(V)=>{F(()=>z?T(V instanceof Error?V:Error(Al(V)||"image worker crashed")):R(no(`the worker failed before it was ready: ${Al(V)}`)))}),B.on("exit",(V)=>{F(()=>z?T(Error("image worker exited before it finished")):R(no(`the worker exited with code ${V} before it was ready`)))})})}finally{Pb()}}var Lb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Bb=[320,640,960,1280,1920],ro="/_stx/images",zb=`stx:${ro}:alpha-1`,Wb=`stx:${ro}:opaque-1`,Fb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],ma;function Vb(v,_){let k=Gt.dirname(Bun.resolveSync(v,_));while(k!==Gt.dirname(k)){let R=Gt.join(k,"package.json");if(tn.existsSync(R)){let T=JSON.parse(tn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=Gt.dirname(k)}return}function Bp(){if(ma!==void 0)return ma;let v;try{v=Gt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return ma=Fb.map((_)=>{let k;try{k=v?Vb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),ma}var zp=Symbol.for("stx.image-delivery");function so(){let v=globalThis;return v[zp]??={catalog:new Map,transparent:new Set},v[zp]}var Wp=new Set;function Ub(v){return`/${v.split(Gt.sep).map(encodeURIComponent).join("/")}`}function Hb(v){let _=Gt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=Hp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function Fp(v,_=`stx:${ro}`){let k=(R)=>`${ro}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=Gt.join(v,R);try{let B=await tn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=Gt.join(v,R);await tn.promises.mkdir(Gt.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await tn.promises.writeFile(z,T),await tn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function qp(v,_=v){let k=await tn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=Gt.join(_,T.name);if(T.isDirectory()){R.push(...await qp(v,B));continue}if(!T.isFile()||!Lb.has(Gt.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:Gt.relative(v,B)})}return R}function Vp(v,_){return v.map((k)=>({key:Ub(k.relativePath),input:k.absolutePath,name:Hb(k.relativePath),...qb(k.absolutePath)?{options:{storage:_}}:{}}))}function qb(v){return Rl(v)==="possible"}function Kb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Xb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let W=z.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await Nb(new Uint8Array(await tn.promises.readFile(W?.path??z.fallback.path)));if(Kb(F.data))k.add(B)}catch{k.add(B)}}));return k}function Zb(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((W)=>W.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((W)=>{let F;try{return F=tn.openSync(W.path,"r"),!Cl(da(F,0,32))}catch{return!0}finally{if(F!==void 0)tn.closeSync(F)}}))continue;if(T.variants=T.variants.filter((W)=>W.format!=="webp"),delete T.sources.webp,k.push(R),!Wp.has(R))Wp.add(R),console.warn(`[stx-images] ${R} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function Gb(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await jb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Il(v){return Gt.join(v,"undecodable.json")}function Jb(v){try{let _=tn.readFileSync(Il(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Yb(v,_){try{tn.mkdirSync(Gt.dirname(Il(v)),{recursive:!0}),tn.writeFileSync(Il(v),JSON.stringify(_))}catch{}}function Up(v){try{let _=tn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function Kp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function is(v){let _=Kp(v);return _?so().catalog.get(_):void 0}function as(v){let _=Kp(v);return _?so().transparent.has(_):!1}function cs(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function eu(v){let _=is(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:cs(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:as(v)?void 0:_.placeholder?.dataUrl}}function Xn(){let v=so();v.catalog=new Map,v.transparent=new Set}function Qb(v){let _=so();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function tu(v,_,k={}){if(!v||!tn.existsSync(v))return Xn(),{count:0,fingerprint:""};if(k.offThread){let ie=await Tl("delivery",{publicDir:v,outputDir:_});if(ie!==ga)return Qb(ie.state),ie.result}let R=await qp(v);if(R.length===0)return Xn(),{count:0,fingerprint:""};let T=Jb(_),B=R.filter((ie)=>{let oe=T[ie.relativePath];if(!oe)return!0;let ae=Up(ie.absolutePath);return!ae||ae.mtimeMs!==oe.mtimeMs||ae.size!==oe.size});if(B.length===0)return Xn(),{count:0,fingerprint:""};let z=Fp(Gt.join(_,"_stx","images"),`${zb}:${Bp()}`),W={outDir:Gt.join(_,"_stx","images"),storage:Fp(Gt.join(_,"_stx","images"),`${Wb}:${Bp()}`),baseUrl:ro,widths:Bb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=B,V;try{V=await Lp({...W,entries:Vp(B,z)})}catch(ie){if(F=await Gb(B),F.length===B.length)throw ie;let oe=new Set(F.map((ce)=>ce.relativePath)),ae=!1;for(let ce of B){if(oe.has(ce.relativePath))continue;let de=Up(ce.absolutePath);if(!de)continue;T[ce.relativePath]=de,ae=!0}if(ae)Yb(_,T);if(F.length===0)return Xn(),{count:0,fingerprint:""};V=await Lp({...W,entries:Vp(F,z)})}let H=await Xb(V.entries),q=Zb(V.entries,H),Q=so();Q.catalog=new Map(Object.entries(V.entries)),Q.transparent=H;let Z=H.size===0&&q.length===0?V.fingerprint:Hp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:F.length,fingerprint:Z}}var ev=new Map;function Pl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return ev.get(_)}var tv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Dl=[320,640,768,1024,1280,1536,1920];function Ht(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ha(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Ml(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=tv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let W=Number.parseInt(T);if(!Number.isNaN(W))k.push(`(max-width: ${W}px) ${B}`)}}else k.push(R);return k.join(", ")}function Ol(v,_,k,R){return _.map((T)=>`${io(v,T,void 0,k,R)} ${T}w`).join(", ")}function nv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${io(v,z,void 0,R,T)} ${B}x`}).join(", ")}function io(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function rv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function sv(v,_,k="#e5e7eb"){let R=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(R)}`}var Nl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=Qt(v,"src")||"",T=is(R),B=Qt(v,"alt")||"",z=Qt(v,"width")||(T?String(T.source.width):void 0),W=Qt(v,"height")||(T?String(T.source.height):void 0),F=Qt(v,"sizes"),V=Qt(v,"srcset"),H=Qt(v,"densities"),q=Qt(v,"format"),Q=as(R)||Pl(R)?.transparent===!0,Z=Qt(v,"placeholder")||(T&&!Q?"thumbhash":void 0),ie=Qt(v,"placeholderColor")||"#e5e7eb",oe=Qt(v,"provider"),ae=Qt(v,"class")||Qt(v,"className")||"",ce=Qt(v,"style")||"",de=Qt(v,"quality"),le=ha(v,"lazy",!0),ge=ha(v,"preload",!1),ye=ha(v,"priority",!1),Se=Qt(v,"loading"),$e=Qt(v,"decoding")||"async",Re=!!T||ha(v,"picture",!1)||!!q,Ae=z?Number.parseInt(z):void 0,Te=W?Number.parseInt(W):void 0,Ie=V||"",_e="";if(T)Ie=T.sources[T.fallback.format]||"",_e=F?Ml(F):"100vw";else if(!Ie&&F&&oe&&oe!=="local"&&oe!=="static")Ie=Ol(R,Dl,oe,q),_e=Ml(F);else if(!Ie&&H){let pt=H.split(/\s+/).map((lt)=>Number.parseFloat(lt.replace("x","")));Ie=nv(R,pt,Ae,oe,q)}else if(F)_e=Ml(F);let De=[];if(ce)De.push(ce);if(Ae&&Te)De.push(`aspect-ratio:${Ae}/${Te}`);let Ne=[],Oe=Z==="blur"||Z==="color"||Z==="thumbhash";if(Oe&&!Q){let pt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:ie}:Pl(R);if(pt&&Z==="color")De.push(`background-color:${pt.color}`),Ne.push("backgroundColor");else if(pt)De.push(`background-color:${pt.color}`),De.push(`background-image:url(${pt.dataUrl})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundColor","backgroundImage");else{let lt=sv(Ae||16,Te||9,ie);De.push(`background-image:url(${lt})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundImage")}}else if(!Oe&&Z&&Z!=="empty"&&Z!=="none")De.push(`background-image:url(${Ht(Z)})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundImage");let Pe=T?.fallback.url||io(R,Ae,Te,oe,q),Le=[];if(Le.push(`src="${Ht(_i(Pe,"fetched"))}"`),Le.push(`alt="${Ht(B)}"`),z)Le.push(`width="${Ht(z)}"`);if(W)Le.push(`height="${Ht(W)}"`);let ct=Se||(ye||ge?"eager":le?"lazy":"");if(ct)Le.push(`loading="${Ht(ct)}"`);if(ye)Le.push('fetchpriority="high"');if(Le.push(`decoding="${Ht($e)}"`),ae)Le.push(`class="${Ht(ae)}"`);if(De.length>0)Le.push(`style="${Ht(De.join(";"))}"`);if(Ie)Le.push(`srcset="${Ht(_i(Ie,"fetched"))}"`);if(_e)Le.push(`sizes="${Ht(_e)}"`);let yt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ne.length>0){let pt=typeof v.static.onload==="string"?v.static.onload:"",lt=rv(Ne)+(pt?`;${pt}`:"");Le.push(`onload="${Ht(lt)}"`),yt.add("onload")}Le.push(...kr(v,yt)),Le.push(...Er(v,yt));let ft=`<img ${Le.join(" ")} />`,st="";if(ge){let lt=q==="webp"?"image/webp":q==="avif"?"image/avif":"";st=`<link rel="preload" as="image" href="${Ht(Pe)}"${lt?` type="${lt}"`:""}${Ie?` imagesrcset="${Ht(Ie)}"`:""}${_e?` imagesizes="${Ht(_e)}"`:""} />
2297
- `}if(Re){let pt=[];if(T)for(let lt of cs(T))pt.push(`<source type="image/${lt.format}" srcset="${Ht(lt.srcset)}"${_e?` sizes="${Ht(_e)}"`:""} />`);if(!T&&(q==="avif"||q==="auto")){let lt=io(R,Ae,Te,oe,"avif"),wt=Ie?Ol(R,Dl,oe,"avif"):`${lt}`;pt.push(`<source type="image/avif" srcset="${Ht(wt)}"${_e?` sizes="${Ht(_e)}"`:""} />`)}if(!T&&(q==="webp"||q==="auto")){let lt=io(R,Ae,Te,oe,"webp"),wt=Ie?Ol(R,Dl,oe,"webp"):`${lt}`;pt.push(`<source type="image/webp" srcset="${Ht(wt)}"${_e?` sizes="${Ht(_e)}"`:""} />`)}return`${st}<picture>
2296
+ ${ua(`@method('${Z}')`,_)}`;return oe}),R=R.replace(/@endform/g,"</form>"),R=R.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(T,B,z,W,F,V="")=>{let H=B||z||"",q=W||F||"",Q=$r(V),Z=Qi(H,_),ie=Z!==void 0&&Z!==null?Z:q||"",oe=Q.match(/type=['"]([^'"]+)['"]/i),ae=oe?oe[1]:"text",ce=eo(H,_),de=Q.match(/class=['"]([^'"]+)['"]/i),le=la(de?de[1]:"",k.input,ce,k.inputError),ge=Q.replace(/class=['"][^'"]+['"]/i,"");return ge=ge.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Kt(ae)}" name="${Kt(H)}"${As(Q,kn(H))} value="${Kt(ie)}" class="${le}"${Sl(H,ce,Q)}${ge?` ${ge}`:""}>`}),R=R.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(T,B,z="",W="")=>{let F=$r(z),V=Qi(B,_)||W.trim(),H=eo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Kt(B)}"${As(F,kn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${Kt(V)}</textarea>`}),R=R.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(T,B,z="",W)=>{let F=$r(z),V=Qi(B,_),H=eo(B,_),q=F.match(/class=['"]([^'"]+)['"]/i),Q=la(q?q[1]:"",k.input,H,k.inputError),Z=F.replace(/class=['"][^'"]+['"]/i,""),ie=W;if(V!==void 0)ie=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(oe,ae,ce)=>{if((Array.isArray(V)?V.some((le)=>String(le)===ce):String(V)===ce)&&!ae.includes("selected"))return ae.replace(/(<option)/,"$1 selected");return oe});return`<select name="${Kt(B)}"${As(F,kn(B))} class="${Q}"${Sl(B,H,F)}${Z?` ${Z}`:""}>${ie}</select>`}),R=R.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=z===void 0?"1":z,V=z===void 0?kn(B):`${kn(B)}-${kn(F)}`,H=$r(W),q=Qi(B,_),Q=q!==void 0&&(Array.isArray(q)?q.some((ae)=>String(ae)===F):q===!0||String(q)===F),Z=H.match(/class=['"]([^'"]+)['"]/i),ie=Z?Z[1]:k.checkInput,oe=H.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Kt(B)}"${As(H,V)} value="${Kt(F)}" class="${ie}"${Q?" checked":""}${oe?` ${oe}`:""}>`}),R=R.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z,W="")=>{let F=$r(W),V=Qi(B,_),H=V!==void 0&&V===z,q=F.match(/class=['"]([^'"]+)['"]/i),Q=q?q[1]:k.checkInput,Z=F.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Kt(B)}"${As(F,`${kn(B)}-${kn(z)}`)} value="${Kt(z)}" class="${Q}"${H?" checked":""}${Z?` ${Z}`:""}>`}),R=R.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(T,B,z="")=>{let W=$r(z),F=W.match(/accept=['"]([^'"]+)['"]/i),V=F?F[1]:"",H=W.includes("multiple"),q=eo(B,_),Q=W.match(/class=['"]([^'"]+)['"]/i),Z=la(Q?Q[1]:"",k.input,q,k.inputError),ie=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),oe=[`<input type="file" name="${Kt(B)}"${As(W,kn(B))}`,`class="${Z}"`];if(V)oe.push(`accept="${Kt(V)}"`);if(H)oe.push("multiple");if(ie)oe.push(ie);return`${oe.join(" ")}>`}),R=R.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(T,B,z="",W)=>{let F=$r(z),V=F.match(/class=['"]([^'"]+)['"]/i),H=V?V[1]:k.label,q=F.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Kt(kn(B))}" class="${H}"${q?` ${q}`:""}>${W}</label>`}),R}function Ip(v,_,k=Ap){return v.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(R,T,B)=>{try{if(eo(T,_)){let z=B.replace(/\{\{([^}]+)\}\}/g,(W,F)=>{try{if(F.trim()==="$message"||F.trim()==="message")return Rp(T,_);if(F.trim().includes("errors.first")||F.trim().includes("$errors.first")){if(typeof _.errors?.first==="function")return _.errors.first(T);return Rp(T,_)}let V=F.trim();if(p(V)){let H=l(V,_);return H!==void 0?String(H):V}return V}catch{return F}});return`<div id="${Kt(`${kn(T)}-error`)}" role="alert">${z}</div>`}return""}catch(z){return console.error("Error processing @error directive:",z),R}})}function eo(v,_){if(!_.errors)return!1;if(typeof _.errors.has==="function")return _.errors.has(v);if(typeof _.errors==="object")return Object.prototype.hasOwnProperty.call(_.errors,v);return!1}function Rp(v,_){if(!_.errors)return"";if(typeof _.errors.get==="function")return _.errors.get(v);if(typeof _.errors==="object"&&Object.prototype.hasOwnProperty.call(_.errors,v)){let k=_.errors[v];return Array.isArray(k)?k[0]:String(k)}return""}function Qi(v,_){let k;if(_.old&&typeof _.old==="function")return _.old(v);if(_.old&&typeof _.old==="object")return _.old[v];if(v.endsWith("[]")){let R=v.slice(0,-2);if(k=_[R],k!==void 0)return k}return _[v]}function $r(v){if(!v.trim())return"";let _=[],k=v.trim(),R=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,T;while((T=R.exec(k))!==null){let[,B,,z]=T;_.push(`${B}="${z.trim()}"`)}return _.join(" ")}var to=/<\/?template\b[^>]*>/gi,kb=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Eb(v){let _=v.replace(/^<template\b/i,"").replace(/>$/,"");return kb.test(_)}function te(v){to.lastIndex=0;let _;while((_=to.exec(v))!==null){if(_[0].startsWith("</")||Eb(_[0]))continue;let k=_.index,R=to.lastIndex,T=1,B;while((B=to.exec(v))!==null)if(B[0].startsWith("</")){if(T--,T===0){let z=B.index;return{start:k,openEnd:R,closeStart:z,end:to.lastIndex,content:v.slice(R,z)}}}else T++;return null}return null}import zt from"path";import{existsSync as Gv}from"fs";class Pp{builtins=new Map;registerBuiltin(v){this.builtins.set(v.name.toLowerCase(),v);for(let _ of v.aliases)this.builtins.set(_.toLowerCase(),v)}isBuiltin(v){return this.builtins.has(v.toLowerCase())}getBuiltin(v){return this.builtins.get(v.toLowerCase())??null}async resolveFile(v,_,k,R){let T=Ua(v,R);if(T!==void 0)return T;for(let B of Ha(v,_,k,R))if(await r(B))return B;return null}}var Ws=new Pp;function Bt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var _r="\x00stx-boolean-attribute";function $l(v){return v.indexOf("\x00")===-1?v:v.replace(/\0/g,"")}var Cb=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function _l(v){let _=v.toLowerCase();return _.startsWith("aria-")||_.startsWith("data-")||Cb.has(_)}function kr(v,_){let k=[];for(let[R,T]of Object.entries(v.static)){if(_.has(R))continue;let B=v.staticNames?.[R]??R;if(typeof T==="boolean"){if(T)k.push(Bt(B));continue}if(T===_r){k.push(Bt(B));continue}k.push(`${Bt(B)}="${Bt($l(String(T)))}"`)}return k}function Er(v,_){let k=[];for(let[R,T]of Object.entries(v.serverDynamic??{})){if(_.has(R))continue;if(T===null||T===void 0||T===!1)continue;let B=v.serverDynamicNames?.[R]??R;if(T===!0){k.push(Bt(B));continue}if(typeof T==="object")continue;k.push(`${Bt(B)}="${Bt($l(String(T)))}"`)}return k}function Vs(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Rb(v){if(v.clientReactive.to)return{value:v.clientReactive.to,reactive:!0};if(v.serverDynamic.to!==void 0)return{value:String(v.serverDynamic.to),reactive:!1};if(typeof v.static.to==="string")return{value:v.static.to,reactive:!1};return{value:"#",reactive:!1}}var kl={name:"StxLink",aliases:["stx-link"],render(v,_,k){let R=Rb(v),T=(typeof v.static.class==="string"?v.static.class:"")||(typeof v.static.className==="string"?v.static.className:""),B=typeof v.static.activeClass==="string"?v.static.activeClass:"active",z=typeof v.static.exactActiveClass==="string"?v.static.exactActiveClass:"exact-active",W=v.static.prefetch===!0||v.static.prefetch==="true"||v.serverDynamic.prefetch===!0,F=[];if(R.reactive)F.push(`:href="${Vs(R.value)}"`);else F.push(`href="${Vs(_i(R.value,"navigable"))}"`);if(T)F.push(`class="${Vs(T)}"`);if(F.push("data-stx-link"),F.push(`data-stx-active-class="${Vs(B)}"`),F.push(`data-stx-exact-active-class="${Vs(z)}"`),W)F.push("data-stx-prefetch");let V=typeof v.static.activeMatch==="string"?v.static.activeMatch.trim():"";if(V)F.push(`data-stx-active-match="${Vs(V)}"`);let H=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return F.push(...kr(v,H)),F.push(...Er(v,H)),`<a ${F.join(" ")}>${_}</a>`}};import{createHash as Hp}from"crypto";import nn from"fs";import Jt from"path";import{decode as Nb,generateThumbHash as jb}from"ts-images";import{createImageDeliveryCatalog as Lp}from"ts-images/delivery";import El from"fs";function da(v,_,k){let R=Buffer.alloc(k),T=El.readSync(v,R,0,k,_);return R.subarray(0,T)}function Cl(v){if(v.length<25)return!1;let _=(R,T)=>String.fromCharCode(...v.subarray(R,T));if(_(0,4)!=="RIFF"||_(8,12)!=="WEBP")return!1;let k=_(12,16);if(k==="VP8X")return(v[20]&16)!==0;if(k==="VP8L")return((v[21]|v[22]<<8|v[23]<<16|v[24]<<24)>>>28&1)===1;return!1}function Rl(v){let _;try{_=El.openSync(v,"r");let k=da(_,0,33);if(k.length>=3&&k[0]===255&&k[1]===216&&k[2]===255)return"none";if(k.length>=26&&k[0]===137&&k.toString("latin1",1,4)==="PNG"){let R=k[25];if(R===4||R===6)return"possible";let T=8;for(let B=0;B<64;B++){let z=da(_,T,8);if(z.length<8)return"unknown";let W=z.toString("latin1",4,8);if(W==="tRNS")return"possible";if(W==="IDAT"||W==="IEND")return"none";T+=12+z.readUInt32BE(0)}return"unknown"}if(k.length>=25&&k.toString("latin1",0,4)==="RIFF"&&k.toString("latin1",8,12)==="WEBP"){if(Cl(k))return"possible";let R=k.toString("latin1",12,16);return R==="VP8 "||R==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(_!==void 0)El.closeSync(_)}}import Ab from"fs";import fa from"os";import{join as Dp}from"path";import{fileURLToPath as Mp}from"url";import{Worker as Op}from"worker_threads";var ga=Symbol("stx.image-worker.unavailable");function Tb(v=typeof fa.availableParallelism==="function"?fa.availableParallelism():fa.cpus().length){return Math.max(1,Math.min(2,v-1))}var pa=0,jp=[];async function Ib(){if(pa<Tb()){pa++;return}await new Promise((v)=>jp.push(v)),pa++}function Pb(){pa--,jp.shift()?.()}var Db="@stacksjs/stx/builtins/image-warmup-worker";function Mb(v=process.cwd()){let _=import.meta.url.endsWith(".ts")?"ts":"js";try{let k=new URL(`./image-warmup-worker.${_}`,import.meta.url);if(k.protocol==="file:"&&Ab.existsSync(Mp(k)))return Mp(k)}catch{}try{let k=typeof Bun<"u"?Bun.resolveSync(Db,v):void 0;return k&&Ob(k)?k:void 0}catch{return}}function Ob(v,_=process.env){let k=v.replace(/\\/g,"/");if(k.split("/").some((T)=>/@\d[^/]*@@@\d+$/.test(T)))return!1;return![_.BUN_INSTALL_CACHE_DIR,Dp(_.BUN_INSTALL||Dp(fa.homedir(),".bun"),"install","cache")].filter((T)=>!!T).map((T)=>`${T.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((T)=>k.startsWith(T))}var Np=!1;function no(v){if(!Np)Np=!0,console.warn(`[stx] image worker unavailable (${v}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ga}function Al(v){return v instanceof Error?v.message:String(v)}async function Tl(v,_){if(typeof Op!=="function")return no("node:worker_threads has no Worker in this runtime");let k=Mb();if(!k)return no("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Ib();try{return await new Promise((R,T)=>{let B;try{B=new Op(k)}catch(V){R(no(`could not start ${k}: ${Al(V)}`));return}let z=!1,W=!1,F=(V)=>{if(W)return;W=!0,V(),B.terminate()};B.on("message",(V)=>{if(V.type==="ready"){z=!0,B.postMessage({task:v,args:_});return}if(V.type==="result"){F(()=>R(V.value));return}let H=Error(V.error?.message??"image worker failed");if(V.error?.name)H.name=V.error.name;if(V.error?.stack)H.stack=V.error.stack;F(()=>T(H))}),B.on("error",(V)=>{F(()=>z?T(V instanceof Error?V:Error(Al(V)||"image worker crashed")):R(no(`the worker failed before it was ready: ${Al(V)}`)))}),B.on("exit",(V)=>{F(()=>z?T(Error("image worker exited before it finished")):R(no(`the worker exited with code ${V} before it was ready`)))})})}finally{Pb()}}var Lb=new Set([".avif",".jpeg",".jpg",".png",".webp"]),Bb=[320,640,960,1280,1920],ro="/_stx/images",zb=`stx:${ro}:alpha-1`,Wb=`stx:${ro}:opaque-1`,Fb=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],ma;function Vb(v,_){let k=Jt.dirname(Bun.resolveSync(v,_));while(k!==Jt.dirname(k)){let R=Jt.join(k,"package.json");if(nn.existsSync(R)){let T=JSON.parse(nn.readFileSync(R,"utf8"));if(T.name===v)return T.version}k=Jt.dirname(k)}return}function Bp(){if(ma!==void 0)return ma;let v;try{v=Jt.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return ma=Fb.map((_)=>{let k;try{k=v?Vb(_,v):void 0}catch{}return`${_.replace("@stacksjs/","")}@${k??"unknown"}`}).join("+"),ma}var zp=Symbol.for("stx.image-delivery");function so(){let v=globalThis;return v[zp]??={catalog:new Map,transparent:new Set},v[zp]}var Wp=new Set;function Ub(v){return`/${v.split(Jt.sep).map(encodeURIComponent).join("/")}`}function Hb(v){let _=Jt.extname(v),k=v.slice(0,-_.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),R=Hp("sha256").update(v).digest("hex").slice(0,8);return`${k||"image"}-${R}`}function Fp(v,_=`stx:${ro}`){let k=(R)=>`${ro}/${R.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:_,async stat(R){let T=Jt.join(v,R);try{let B=await nn.promises.stat(T);return B.size>0?{bytes:B.size,path:T,url:k(R)}:null}catch{return null}},async write(R,T){let B=Jt.join(v,R);await nn.promises.mkdir(Jt.dirname(B),{recursive:!0});let z=`${B}.${process.pid}.tmp`;return await nn.promises.writeFile(z,T),await nn.promises.rename(z,B),{bytes:T.byteLength,path:B,url:k(R)}},url:k}}async function qp(v,_=v){let k=await nn.promises.readdir(_,{withFileTypes:!0});k.sort((T,B)=>T.name.localeCompare(B.name));let R=[];for(let T of k){let B=Jt.join(_,T.name);if(T.isDirectory()){R.push(...await qp(v,B));continue}if(!T.isFile()||!Lb.has(Jt.extname(T.name).toLowerCase()))continue;R.push({absolutePath:B,relativePath:Jt.relative(v,B)})}return R}function Vp(v,_){return v.map((k)=>({key:Ub(k.relativePath),input:k.absolutePath,name:Hb(k.relativePath),...qb(k.absolutePath)?{options:{storage:_}}:{}}))}function qb(v){return Rl(v)==="possible"}function Kb(v){for(let _=3;_<v.length;_+=4)if(v[_]!==255)return!0;return!1}async function Xb(v){let _=Object.entries(v).filter(([,T])=>T.fallback.format==="png"),k=new Set,R=8;for(let T=0;T<_.length;T+=8)await Promise.all(_.slice(T,T+8).map(async([B,z])=>{let W=z.variants.filter((F)=>F.format==="png").sort((F,V)=>F.width-V.width)[0];try{let F=await Nb(new Uint8Array(await nn.promises.readFile(W?.path??z.fallback.path)));if(Kb(F.data))k.add(B)}catch{k.add(B)}}));return k}function Zb(v,_){let k=[];for(let R of _){let T=v[R],B=T?.variants.filter((W)=>W.format==="webp")??[];if(!T||B.length===0)continue;if(!B.some((W)=>{let F;try{return F=nn.openSync(W.path,"r"),!Cl(da(F,0,32))}catch{return!0}finally{if(F!==void 0)nn.closeSync(F)}}))continue;if(T.variants=T.variants.filter((W)=>W.format!=="webp"),delete T.sources.webp,k.push(R),!Wp.has(R))Wp.add(R),console.warn(`[stx-images] ${R} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return k}async function Gb(v){let _=[],k=8;for(let R=0;R<v.length;R+=8){let T=v.slice(R,R+8),B=await Promise.all(T.map(async(z)=>{try{return await jb(z.absolutePath),z}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${z.relativePath}`),null}}));_.push(...B.filter((z)=>z!==null))}return _}function Il(v){return Jt.join(v,"undecodable.json")}function Jb(v){try{let _=nn.readFileSync(Il(v),"utf-8"),k=JSON.parse(_);return k&&typeof k==="object"?k:{}}catch{return{}}}function Yb(v,_){try{nn.mkdirSync(Jt.dirname(Il(v)),{recursive:!0}),nn.writeFileSync(Il(v),JSON.stringify(_))}catch{}}function Up(v){try{let _=nn.statSync(v);return{mtimeMs:_.mtimeMs,size:_.size}}catch{return}}function Kp(v){if(!v||v.startsWith("data:")||v.startsWith("blob:")||/^https?:\/\//i.test(v)||v.startsWith("//"))return;let _=v.split(/[?#]/,1)[0];if(!_)return;try{return`/${_.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function is(v){let _=Kp(v);return _?so().catalog.get(_):void 0}function as(v){let _=Kp(v);return _?so().transparent.has(_):!1}function cs(v){let _=(R)=>v.variants.filter((T)=>T.format===R).reduce((T,B)=>T+B.bytes,0),k=_(v.fallback.format);return["avif","webp"].map((R)=>({format:R,srcset:v.sources[R]||"",bytes:_(R)})).filter((R)=>R.srcset&&R.bytes>0&&R.bytes<k).sort((R,T)=>R.bytes-T.bytes).map(({format:R,srcset:T})=>({format:R,srcset:T}))}function eu(v){let _=is(v);if(!_)return;return{src:_.fallback.url,srcset:_.sources[_.fallback.format]||"",sources:cs(_).map(({format:k,srcset:R})=>({type:`image/${k}`,srcset:R})),width:_.source.width,height:_.source.height,placeholder:as(v)?void 0:_.placeholder?.dataUrl}}function Xn(){let v=so();v.catalog=new Map,v.transparent=new Set}function Qb(v){let _=so();_.catalog=new Map(v.entries),_.transparent=new Set(v.transparent)}async function tu(v,_,k={}){if(!v||!nn.existsSync(v))return Xn(),{count:0,fingerprint:""};if(k.offThread){let ie=await Tl("delivery",{publicDir:v,outputDir:_});if(ie!==ga)return Qb(ie.state),ie.result}let R=await qp(v);if(R.length===0)return Xn(),{count:0,fingerprint:""};let T=Jb(_),B=R.filter((ie)=>{let oe=T[ie.relativePath];if(!oe)return!0;let ae=Up(ie.absolutePath);return!ae||ae.mtimeMs!==oe.mtimeMs||ae.size!==oe.size});if(B.length===0)return Xn(),{count:0,fingerprint:""};let z=Fp(Jt.join(_,"_stx","images"),`${zb}:${Bp()}`),W={outDir:Jt.join(_,"_stx","images"),storage:Fp(Jt.join(_,"_stx","images"),`${Wb}:${Bp()}`),baseUrl:ro,widths:Bb,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},F=B,V;try{V=await Lp({...W,entries:Vp(B,z)})}catch(ie){if(F=await Gb(B),F.length===B.length)throw ie;let oe=new Set(F.map((ce)=>ce.relativePath)),ae=!1;for(let ce of B){if(oe.has(ce.relativePath))continue;let de=Up(ce.absolutePath);if(!de)continue;T[ce.relativePath]=de,ae=!0}if(ae)Yb(_,T);if(F.length===0)return Xn(),{count:0,fingerprint:""};V=await Lp({...W,entries:Vp(F,z)})}let H=await Xb(V.entries),q=Zb(V.entries,H),Q=so();Q.catalog=new Map(Object.entries(V.entries)),Q.transparent=H;let Z=H.size===0&&q.length===0?V.fingerprint:Hp("sha256").update(V.fingerprint).update(JSON.stringify({transparent:[...H].sort(),droppedWebp:q.sort()})).digest("hex");return{count:F.length,fingerprint:Z}}var ev=new Map;function Pl(v){if(!v)return;let _=v.split("?")[0].split("#")[0];return ev.get(_)}var tv={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Dl=[320,640,768,1024,1280,1536,1920];function qt(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qt(v,_){if(v.serverDynamic[_]!==void 0)return String(v.serverDynamic[_]);let k=v.static[_];if(typeof k==="string")return k;return}function ha(v,_,k=!1){let R=v.serverDynamic[_];if(R!==void 0)return R!==!1&&R!=="false";let T=v.static[_];if(T!==void 0)return T!=="false"&&T!==!1;return k}function Ml(v){if(v.includes("(")||v.includes(","))return v;let _=v.trim().split(/\s+/),k=[];for(let R of _)if(R.includes(":")){let[T,B]=R.split(":"),z=tv[T];if(z)k.push(`(max-width: ${z}px) ${B}`);else{let W=Number.parseInt(T);if(!Number.isNaN(W))k.push(`(max-width: ${W}px) ${B}`)}}else k.push(R);return k.join(", ")}function Ol(v,_,k,R){return _.map((T)=>`${io(v,T,void 0,k,R)} ${T}w`).join(", ")}function nv(v,_,k,R,T){return _.map((B)=>{let z=k?k*B:void 0;return`${io(v,z,void 0,R,T)} ${B}x`}).join(", ")}function io(v,_,k,R,T){if(!R||R==="local"||R==="static")return v;if(R==="cloudinary"){let B=[];if(_)B.push(`w_${_}`);if(k)B.push(`h_${k}`);if(T)B.push(`f_${T}`);B.push("q_auto");let z=B.join(",");return v.replace("/upload/",`/upload/${z}/`)}if(R==="imgix"){let B=new URLSearchParams;if(_)B.set("w",String(_));if(k)B.set("h",String(k));if(T)B.set("fm",T);B.set("auto","format");let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}if(R==="bunny"){let B=new URLSearchParams;if(_)B.set("width",String(_));if(k)B.set("height",String(k));if(T)B.set("format",T);let z=v.includes("?")?"&":"?";return`${v}${z}${B.toString()}`}return v}function rv(v){return`var s=this.style;${v.map((_)=>`s.${_}=''`).join(";")}`}function sv(v,_,k="#e5e7eb"){let R=`<svg xmlns="http://www.w3.org/2000/svg" width="${v}" height="${_}"><rect width="100%" height="100%" fill="${k}"/></svg>`;return`data:image/svg+xml;base64,${btoa(R)}`}var Nl={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(v,_,k){let R=Qt(v,"src")||"",T=is(R),B=Qt(v,"alt")||"",z=Qt(v,"width")||(T?String(T.source.width):void 0),W=Qt(v,"height")||(T?String(T.source.height):void 0),F=Qt(v,"sizes"),V=Qt(v,"srcset"),H=Qt(v,"densities"),q=Qt(v,"format"),Q=as(R)||Pl(R)?.transparent===!0,Z=Qt(v,"placeholder")||(T&&!Q?"thumbhash":void 0),ie=Qt(v,"placeholderColor")||"#e5e7eb",oe=Qt(v,"provider"),ae=Qt(v,"class")||Qt(v,"className")||"",ce=Qt(v,"style")||"",de=Qt(v,"quality"),le=ha(v,"lazy",!0),ge=ha(v,"preload",!1),ye=ha(v,"priority",!1),Se=Qt(v,"loading"),$e=Qt(v,"decoding")||"async",Re=!!T||ha(v,"picture",!1)||!!q,Ae=z?Number.parseInt(z):void 0,Te=W?Number.parseInt(W):void 0,Ie=V||"",_e="";if(T)Ie=T.sources[T.fallback.format]||"",_e=F?Ml(F):"100vw";else if(!Ie&&F&&oe&&oe!=="local"&&oe!=="static")Ie=Ol(R,Dl,oe,q),_e=Ml(F);else if(!Ie&&H){let pt=H.split(/\s+/).map((ut)=>Number.parseFloat(ut.replace("x","")));Ie=nv(R,pt,Ae,oe,q)}else if(F)_e=Ml(F);let De=[];if(ce)De.push(ce);if(Ae&&Te)De.push(`aspect-ratio:${Ae}/${Te}`);let Ne=[],Oe=Z==="blur"||Z==="color"||Z==="thumbhash";if(Oe&&!Q){let pt=T?.placeholder?{dataUrl:T.placeholder.dataUrl,color:ie}:Pl(R);if(pt&&Z==="color")De.push(`background-color:${pt.color}`),Ne.push("backgroundColor");else if(pt)De.push(`background-color:${pt.color}`),De.push(`background-image:url(${pt.dataUrl})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundColor","backgroundImage");else{let ut=sv(Ae||16,Te||9,ie);De.push(`background-image:url(${ut})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundImage")}}else if(!Oe&&Z&&Z!=="empty"&&Z!=="none")De.push(`background-image:url(${qt(Z)})`),De.push("background-size:cover"),De.push("background-repeat:no-repeat"),Ne.push("backgroundImage");let Pe=T?.fallback.url||io(R,Ae,Te,oe,q),Le=[];if(Le.push(`src="${qt(_i(Pe,"fetched"))}"`),Le.push(`alt="${qt(B)}"`),z)Le.push(`width="${qt(z)}"`);if(W)Le.push(`height="${qt(W)}"`);let ct=Se||(ye||ge?"eager":le?"lazy":"");if(ct)Le.push(`loading="${qt(ct)}"`);if(ye)Le.push('fetchpriority="high"');if(Le.push(`decoding="${qt($e)}"`),ae)Le.push(`class="${qt(ae)}"`);if(De.length>0)Le.push(`style="${qt(De.join(";"))}"`);if(Ie)Le.push(`srcset="${qt(_i(Ie,"fetched"))}"`);if(_e)Le.push(`sizes="${qt(_e)}"`);let yt=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(Ne.length>0){let pt=typeof v.static.onload==="string"?v.static.onload:"",ut=rv(Ne)+(pt?`;${pt}`:"");Le.push(`onload="${qt(ut)}"`),yt.add("onload")}Le.push(...kr(v,yt)),Le.push(...Er(v,yt));let ft=`<img ${Le.join(" ")} />`,st="";if(ge){let ut=q==="webp"?"image/webp":q==="avif"?"image/avif":"";st=`<link rel="preload" as="image" href="${qt(Pe)}"${ut?` type="${ut}"`:""}${Ie?` imagesrcset="${qt(Ie)}"`:""}${_e?` imagesizes="${qt(_e)}"`:""} />
2297
+ `}if(Re){let pt=[];if(T)for(let ut of cs(T))pt.push(`<source type="image/${ut.format}" srcset="${qt(ut.srcset)}"${_e?` sizes="${qt(_e)}"`:""} />`);if(!T&&(q==="avif"||q==="auto")){let ut=io(R,Ae,Te,oe,"avif"),wt=Ie?Ol(R,Dl,oe,"avif"):`${ut}`;pt.push(`<source type="image/avif" srcset="${qt(wt)}"${_e?` sizes="${qt(_e)}"`:""} />`)}if(!T&&(q==="webp"||q==="auto")){let ut=io(R,Ae,Te,oe,"webp"),wt=Ie?Ol(R,Dl,oe,"webp"):`${ut}`;pt.push(`<source type="image/webp" srcset="${qt(wt)}"${_e?` sizes="${qt(_e)}"`:""} />`)}return`${st}<picture>
2298
2298
  ${pt.join(`
2299
2299
  `)}
2300
2300
  ${ft}
@@ -2472,7 +2472,7 @@ ${V.join(`
2472
2472
  `);Z.forEach((ie,oe)=>{let ae=q.startLine-1+oe;if(ae<T.length)T[ae]=oe===0?us(q)+ie:ie,W.add(ae)}),F.push(q.startLine-1+Z.length-1)}for(let q of F){let Q=T[q]?.trim()===""?q:q+1;if(Q<T.length&&T[Q].trim()===""&&(Q===q||!W.has(Q)))T[Q]=";"}let V=(q,Q)=>{for(let[Z,ie]of q.split(`
2473
2473
  `).entries())if(T.push(ie),Q)B.set(T.length,Z===0?Q:{...Q,line:Q.line+Z,column:1,prefixLength:0})};if(_.globals!==!1){V("");let q=new Set([...k.flatMap((oe)=>ne(oe.code)),...k.flatMap((oe)=>jv(oe.code))]),Q=(oe)=>{if(!q.has(oe))V(`declare var ${oe}: any`)};if(_.runtimeGlobals!==!1){if(!q.has("window"))V("declare var window: any");for(let oe of y)Q(oe)}let Z=[...new Set([...Yl,...X,...$g])].filter((oe)=>_.runtimeGlobals!==!1||!y.includes(oe));if(_.contextScope==="global"){V("declare global {");for(let oe of Z)V(` var ${oe}: any`);V("}")}else{for(let oe of Yl)Q(oe);for(let oe of X)Q(oe);for(let oe of $g)Q(oe)}V(`declare var ${Jl}: any`);let ie=new Set(k.flatMap((oe)=>ne(oe.code)));V(`type ${yg}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let oe of Ev(v)){if(ie.has(oe.name))continue;let ae=oe.iterable&&ie.has(oe.iterable)?`${yg}<typeof ${oe.iterable}>`:"any";V(`declare var ${oe.name}: ${ae}`)}}if(_.templateExpressions!==!1){if(z?.declarations)for(let Q of z.declarations.split(`
2474
2474
  `))V(Q);let q=xc(v).map((Q)=>{let Z=z?.events.get(Q.offset??-1);if(Z){Q.anchor=!0;let ie=Q.code.trim(),oe=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(ie),ae=oe?`void ((${oe[2]}) satisfies __StxAssignedValue<typeof ${oe[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(ie)?`${ie} satisfies (($event: ${Z}) => unknown)`:ie,ce=`;(($event: ${Z}): void => { `;return{expression:Q,statement:{text:`${ce}${ae} });`,prefixLength:ce.length}}}return{expression:Q,statement:Ov(Q)}}).filter((Q)=>Q.statement!==null);if(q.push(...z?.checks||[]),q.length>0){let Q=wa(v),Z=Dv(k.map((ce)=>ce.code)),oe=[...new Set(k.flatMap((ce)=>ne(ce.code)))].filter((ce)=>/^[A-Z_$][\w$]*$/i.test(ce)),ae=0;if(oe.length>0){V(wv);for(let ce of oe)V(`type __StxT_${ce} = ${Eg}<typeof ${ce}>`);V(`;((${oe.map((ce)=>`${ce}: __StxT_${ce}`).join(", ")}) => {`),ae=1}for(let{expression:ce,statement:de}of q){let le=" ".repeat(ae),ge=ce.offset===void 0?[]:Mv(Q,ce.offset),ye=ge.length>0?`${ge.map(($e)=>`if (${Ag($e,Z)}) `).join("")}{ `:"",Se=ge.length>0?" }":"";V(le+ye+de.text+Se,{line:ce.line,column:ce.column,expression:ce,prefixLength:de.prefixLength+le.length+ye.length,guardPrefixLength:le.length+ye.length})}if(ae>0)V("});")}}let H=!1;if(_.reference&&T[0]!==void 0&&T[0].trim()==="")T[0]=`/// <reference path=${JSON.stringify(_.reference.replace(/\\/g,"/"))} />`,H=!0;return V("export {}"),{text:T.join(`
2475
- `),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function di(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function ui(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Tg from"fs";import Ig from"path";var Pg=!1;function Lv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),W=(q)=>{if(z.size===0)return!1;let Q=s(q),Z=Q.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&z.has(Z))return!0;for(let ie of z){let oe=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${oe}\\s*\\(`).test(Q))return!0}return!1},F=new Set(Vi),V=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(Q,Z)=>Z.toUpperCase())},H=(q,Q)=>{let Z=V(q);if(B.static[Z]=Q,Z!==q)B.staticNames[Z]=q};for(let[q,Q]of Object.entries(v)){let Z=q.startsWith("x-")&&!F.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(Z.startsWith("@")){B.events[Z]=Q;continue}if(Z.startsWith("__stx_")){let ie=V(Z.slice(6));B.serverDynamic[ie]=cg(Q,k);continue}if(Z.startsWith(":")){let ie=V(Z.slice(1)),oe=Q===_r?ie:Q;if(ie==="if"||ie==="for"||ie==="show"){B.clientReactive[ie]=oe;continue}if(R){B.clientReactive[ie]=oe;continue}if(Ar(oe,T)){B.clientReactive[ie]=oe;continue}if(W(oe)){B.clientReactive[ie]=oe;continue}try{if(!p(oe)){if(k.debug)console.error(`Unsafe expression in :${ie} binding: ${oe}`);B.clientReactive[ie]=oe;continue}let ae=Object.keys(_),ce=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),de=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Ce(oe).some((Se)=>!ce.has(Se)&&!ae.includes(Se)&&(!(Se in globalThis)||de.has(Se)))){B.clientReactive[ie]=oe;continue}let ye=c(oe,ae)(...Object.values(_));if(B.serverDynamic[ie]=ye,ie!==Z.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[ie]=Z.slice(1)}catch{B.clientReactive[ie]=oe}continue}if(typeof Q==="string"&&Q.includes("{{")&&Q.includes("}}")){let ie=Bv(Q,T);if(ie!==null){B.clientReactive[V(Z)]=ie;continue}let oe=Q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(oe)try{let ae=oe[1];if(p(ae)){let de=c(ae,Object.keys(_))(...Object.values(_));H(Z,de!=null?String(de):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${ae}`);H(Z,Q)}}catch(ae){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,ae);H(Z,Q)}else{let ae=Q,ce=/\{\{\s*([\s\S]+?)\s*\}\}/g,de;while((de=ce.exec(Q))!==null)try{let le=de[1];if(!p(le)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${le}`);continue}let ye=c(le,Object.keys(_))(...Object.values(_));ae=ae.replace(de[0],String(ye??""))}catch(le){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,le)}H(Z,ae)}continue}H(Z,Q===_r?"true":ag(Q))}return B}function Bv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((W)=>Ar(W[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let W of R)B+=v.slice(z,W.index).replace(/[`\\$]/g,(F)=>`\\${F}`),B+=`\${${W[1]}}`,z=W.index+W[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(W)=>`\\${W}`),`\`${B}\``}var zv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Wv(v,_,k){if(!v.includes("@"))return v;if(!zv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return ur(v,_,k)}catch{return v}}function Og(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let W=v[k];if(W==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(W===z){k++;break}B+=W,k++}}else if(v[k]==="{"){B=Kl(v,k),k+=B.length;let z=lg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=_r}return _}function Dg(v){return Object.entries(v).map(([_,k])=>k===_r?_:`${_}="${Fv(k)}"`).join(" ")}function Fv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(Ws.isBuiltin(T))_.add(T)}return[..._].sort()}async function Sc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Ig.dirname(k),W=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(F)){let[Q,Z,ie]=q,oe=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ae=ie,ce,de=[];while((ce=oe.exec(ie))!==null){let[le,ge,ye,Se]=ce,$e=null,Re=null;if(Se.startsWith(".")||Se.startsWith("/")){let Ie=Ig.resolve(z,Se);if(Ie.endsWith(".stx"))Re=Ie;else{let _e=`${Ie}.stx`;try{if(Tg.statSync(_e).isFile())Re=_e}catch{try{if(Tg.statSync(Ie).isDirectory())$e=Ie}catch{}}}}else $e=To(Se,z);if(!$e&&!Re)continue;let Ae=!1,Te=(Ie,_e)=>{B.set(Ie,_e),B.set(Ie.toLowerCase(),_e);let De=Ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(De,_e),T.add(_e)};if(ye&&Re)Te(ye,Re),Ae=!0;else if(ge){let Ie=ge.slice(1,-1).split(",").map((De)=>De.trim()).filter(Boolean).map((De)=>{let Ne=De.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ne)return{source:Ne[1],local:Ne[2]};return{source:De,local:De}}),_e=$e?Ao($e):null;for(let{source:De,local:Ne}of Ie){let Oe=null;if(Re)Oe=Re;else if(_e)Oe=_e.get(De)??_e.get(De.toLowerCase())??_e.get(De.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Oe)Te(Ne,Oe),Ae=!0}}if(Ae)de.push({start:ce.index,end:ce.index+le.length})}if(de.length===0)continue;for(let le=de.length-1;le>=0;le--)ae=ae.slice(0,de[le].start)+ae.slice(de[le].end);W.push({start:q.index,end:q.index+Q.length,value:`<script${Z}>${ae}</script>`})}if(W.length===0)return v;let V=[],H=0;for(let q of W)V.push(v.slice(H,q.start),q.value),H=q.end;return V.push(v.slice(H)),V.join("")}async function Uv(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=W.exec(B))!==null){let[V,H]=F,q=H.split(",").map((Q)=>Q.trim().replace(/^['"]|['"]$/g,"")).filter((Q)=>Q.length>0);for(let Q of q){let Z=Q.split("/"),oe=Z[Z.length-1].replace(/\.stx$/,""),ae=oe.includes("-")?oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""):oe.charAt(0).toUpperCase()+oe.slice(1),ce=null,de=Io(Q,k,R);for(let le of de)try{if(await Bun.file(le).exists()){ce=le;break}}catch{}if(ce){z.set(ae,ce),z.set(oe,ce),z.set(oe.toLowerCase(),ce);let le=ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(le,ce),T.add(ce),R.debug)console.log(`Imported component: ${ae} -> ${ce}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${Q}`)}B=B.replace(V,""),W.lastIndex=0}return B}async function Hv(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(B))!==null){let H=V.index,q=H+V[0].length-1,Q=1,Z=q+1;while(Z<B.length&&Q>0){if(B[Z]==="(")Q++;else if(B[Z]===")"){if(Q--,Q===0)break}Z++}if(Q!==0)break;let ie=B.substring(q+1,Z),oe=Z+1,ae=ie.match(/^\s*['"]([^'"]+)['"]/);if(!ae){F.lastIndex=0;continue}let ce=ae[1],de,le=ie.slice(ae[0].length),ge=le.match(/^\s*,\s*/);if(ge)de=le.slice(ge[0].length).trim();let ye={};if(de)try{ye=D(de,_)}catch(Ie){let _e=Ie instanceof Error?Ie.message:String(Ie);B=B.replace(B.substring(H,oe),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=oe,Ae=B.substring(oe).match(/^([\s\S]*?)@endcomponent/);if(Ae)Se=Ae[1].trim(),$e=oe+Ae[0].length;let Te=await Ke(ce,ye,Se,z,_,k,R,W,T);B=B.substring(0,H)+Te+B.substring($e),F.lastIndex=0}return B}async function qv(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=Zv(B);if(F.size>0){let oe=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...oe,...F])]}let V=$n(B);B=V.output;let H=mr(_);return B=await ie(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await ie(B,/[A-Z][a-zA-Z0-9]*/,!0,ig(co)),B=await ie(B,/[a-z][a-z0-9]*/,!1,co),B=V.restore(B),B;async function ie(oe,ae,ce,de){if(!oe)return oe;let le=oe,ge=og(le,ae,de),ye=Xl(le),Se=new Map;for(let Ae=ge.length-1;Ae>=0;Ae--){let Te=ge[Ae],Ie=ce?nn(Te.tagName):Te.tagName,_e=Og(Wv(Te.attributes,_,k)),De=ye.filter(({start:lt,end:wt})=>Te.startIndex>=lt&&Te.startIndex<wt),Ne=De.length>0,Oe=new Set(H);for(let lt of De)for(let wt of lt.names)Oe.add(wt);let Pe=Lv(_e,_,R,Ne,Oe);if(typeof Pe.clientReactive.for==="string")for(let lt of Gr(Pe.clientReactive.for))Oe.add(lt);let Le=Ws.getBuiltin(Te.tagName),ct=Le?await Zn(Te.tagName,z,_,k,R):!1;if(Le&&!ct){let lt={context:_,filePath:k,options:R,dependencies:T},wt=Le.render(Pe,Te.content,lt);if(Object.keys(Pe.events).length>0){let dt=Dg(Pe.events);wt=wt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${dt}`)}if(Object.keys(Pe.clientReactive).length>0)wt=Mg(wt,Pe.clientReactive);Se.set(Ae,wt);continue}if(!ce&&Te.tagName.includes("-")&&!await Zn(Ie,z,_,k,R))continue;let yt={};for(let[lt,wt]of Object.entries(Pe.static))yt[lt]=wt;for(let[lt,wt]of Object.entries(Pe.serverDynamic))yt[lt]=wt;let ft={declaredProps:new Set},pt=await Ke(Ie,yt,V.restore(Te.content),z,_,k,R,W,T,[...Oe],ft,Te.tagName);if(pt=Kv(pt,Pe,ft.declaredProps),Object.keys(Pe.events).length>0){let lt=cu(pt);if(lt){let wt=Dg(Pe.events),dt=Object.keys(Pe.events).map((St)=>St.replace(/^@/,"").split(".")[0]).join(" ");pt=pt.substring(0,lt.insertPos)+` data-stx-parent-events="${dt}" ${wt}`+pt.substring(lt.insertPos)}}if(Object.keys(Pe.clientReactive).length>0)pt=Mg(pt,Pe.clientReactive);Se.set(Ae,pt)}if(Se.size===0)return le;let $e="",Re=0;for(let Ae=0;Ae<ge.length;Ae++){let Te=Se.get(Ae);if(Te===void 0)continue;$e+=le.slice(Re,ge[Ae].startIndex),$e+=Te,Re=ge[Ae].endIndex}return $e+=le.slice(Re),$e}}function Mg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>nn(H)).join(" "),z=v,W=T.length>0?cu(z):null;if(W){let H=T.map(([Q,Z])=>`:${nn(Q)}="${Z.replace(/"/g,"&quot;")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,W.insertPos)+`${q} ${H}`+z.substring(W.insertPos)}let F=_.if;if(F)z=`<template :if="${F.replace(/"/g,"&quot;")}">${z}</template>`;let V=_.for;if(V)z=`<template :for="${V.replace(/"/g,"&quot;")}">${z}</template>`;return z}function Kv(v,_,k=new Set){let R=Xv(v);if(!R)return v;let T=v.slice(R.insertPos,R.tagEnd),B=/\bdata-native(?:\s|=)/i.test(T),z=new Set(Object.keys(Og(T))),W=new Set(["class","className"]);for(let H of Object.keys(_.static)){let q=_.staticNames[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}for(let H of Object.keys(_.serverDynamic)){let q=_.serverDynamicNames?.[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}let F=[];if(B){for(let[H,q]of Object.entries(_.static)){if(W.has(H)||q!==!0&&q!==_r)continue;W.add(H),F.push(`${Bt(_.staticNames?.[H]??H)}="true"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!0)continue;W.add(H),F.push(`${Bt(_.serverDynamicNames?.[H]??H)}="true"`)}}let V=[...kr(_,W),...Er(_,W),...F];if(B){for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!1)continue;let Q=_.serverDynamicNames?.[H]??H;V.push(`${Bt(Q)}="false"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q===null||typeof q!=="object")continue;let Q=JSON.stringify(q);if(Q!==void 0){let Z=_.serverDynamicNames?.[H]??H;V.push(`${Bt(Z)}="${Bt(Q)}"`)}}}if(V.length===0)return v;return`${v.slice(0,R.insertPos)} ${V.join(" ")}${v.slice(R.insertPos)}`}function cu(v){let _=Ng(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:jg(v,k.index+1+k[1].length)};return null}function Xv(v){let _=cu(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Ng(v,_.tagEnd+1)}function Ng(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let W=v.indexOf("-->",k+4);if(W===-1)return null;k=W+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let W=`</${B[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(W,k+B[0].length);if(F===-1)return null;k=F+W.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:jg(v,k+1+z[1].length)}}return null}function jg(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function Zv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of Ql(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function ps(v,_,k,R,T){if(!Pg)ng(Ws),Pg=!0;let B=await Sc(v,_,k,R,T);B=await Uv(B,_,k,R,T),B=await Hv(B,_,k,R,T);let z=[];for(let W=0;W<3;W++){let F=z.length,V=Dn(B,ze,(q,Q)=>`\x00STX_COMPONENT_COMMENT_${F+Q}\x00`,`STX_COMPONENT_COMMENT:${F}`);z.push(...V.tokens);let H=B;if(B=await qv(V.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,F)=>z[Number(F)]??"");if(R.debug){let W=Vv(B);if(W.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${W.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function lu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function Jv(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,W=z+B[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")")F--;V++}if(F!==0)break;let H=R.substring(W+1,V-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(V),T.lastIndex=z+q.length,B=T.exec(R)}return R}function Yv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Wg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,W=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},F=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')W(_[B]);else if(_[B]==="`")F();else B++;continue}B++}},V=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
2475
+ `),lineMap:B,sourceLineCount:R.length,componentDependencies:z?.dependencies,referenced:H}}function di(v,_){if(!v.expression)return!1;return v.inGuard===!0||_===2774}function ui(v,_,k){let R=v.lineMap.get(_);if(!R)return _<=v.sourceLineCount?{line:_,column:k}:null;let T=R.expression?.anchor?0:Math.max(0,k-1-(R.prefixLength??0));return{line:R.line,column:R.column+T,expression:R.expression,inGuard:k<=(R.guardPrefixLength??0)}}import Tg from"fs";import Ig from"path";var Pg=!1;function Lv(v,_,k,R=!1,T=new Set){let B={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},z=new Set(Array.isArray(_.__stx_client_signal_names)?_.__stx_client_signal_names:[]),W=(q)=>{if(z.size===0)return!1;let Q=s(q),Z=Q.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(Z&&z.has(Z))return!0;for(let ie of z){let oe=ie.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${oe}\\s*\\(`).test(Q))return!0}return!1},F=new Set(Vi),V=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(Q,Z)=>Z.toUpperCase())},H=(q,Q)=>{let Z=V(q);if(B.static[Z]=Q,Z!==q)B.staticNames[Z]=q};for(let[q,Q]of Object.entries(v)){let Z=q.startsWith("x-")&&!F.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(Z.startsWith("@")){B.events[Z]=Q;continue}if(Z.startsWith("__stx_")){let ie=V(Z.slice(6));B.serverDynamic[ie]=cg(Q,k);continue}if(Z.startsWith(":")){let ie=V(Z.slice(1)),oe=Q===_r?ie:Q;if(ie==="if"||ie==="for"||ie==="show"){B.clientReactive[ie]=oe;continue}if(R){B.clientReactive[ie]=oe;continue}if(Ar(oe,T)){B.clientReactive[ie]=oe;continue}if(W(oe)){B.clientReactive[ie]=oe;continue}try{if(!p(oe)){if(k.debug)console.error(`Unsafe expression in :${ie} binding: ${oe}`);B.clientReactive[ie]=oe;continue}let ae=Object.keys(_),ce=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),de=new Set(Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[]);if(Ce(oe).some((Se)=>!ce.has(Se)&&!ae.includes(Se)&&(!(Se in globalThis)||de.has(Se)))){B.clientReactive[ie]=oe;continue}let ye=c(oe,ae)(...Object.values(_));if(B.serverDynamic[ie]=ye,ie!==Z.slice(1)&&B.serverDynamicNames)B.serverDynamicNames[ie]=Z.slice(1)}catch{B.clientReactive[ie]=oe}continue}if(typeof Q==="string"&&Q.includes("{{")&&Q.includes("}}")){let ie=Bv(Q,T);if(ie!==null){B.clientReactive[V(Z)]=ie;continue}let oe=Q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(oe)try{let ae=oe[1];if(p(ae)){let de=c(ae,Object.keys(_))(...Object.values(_));H(Z,de!=null?String(de):"")}else{if(k.debug)console.error(`Unsafe expression in ${Z}: ${ae}`);H(Z,Q)}}catch(ae){if(k.debug)console.error(`Error evaluating expression for ${Z}:`,ae);H(Z,Q)}else{let ae=Q,ce=/\{\{\s*([\s\S]+?)\s*\}\}/g,de;while((de=ce.exec(Q))!==null)try{let le=de[1];if(!p(le)){if(k.debug)console.error(`Unsafe expression in ${Z}: ${le}`);continue}let ye=c(le,Object.keys(_))(...Object.values(_));ae=ae.replace(de[0],String(ye??""))}catch(le){if(k.debug)console.error(`Error evaluating expression in ${Z}:`,le)}H(Z,ae)}continue}H(Z,Q===_r?"true":ag(Q))}return B}function Bv(v,_){if(_.size===0)return null;let k=/\{\{\s*([\s\S]+?)\s*\}\}/g,R=[...v.matchAll(k)];if(!R.some((W)=>Ar(W[1],_)))return null;let T=v.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(T&&R.length===1)return T[1];let B="",z=0;for(let W of R)B+=v.slice(z,W.index).replace(/[`\\$]/g,(F)=>`\\${F}`),B+=`\${${W[1]}}`,z=W.index+W[0].length;return B+=v.slice(z).replace(/[`\\$]/g,(W)=>`\\${W}`),`\`${B}\``}var zv=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Wv(v,_,k){if(!v.includes("@"))return v;if(!zv.some(([T,B])=>T.test(v)&&v.includes(B)))return v;try{return ur(v,_,k)}catch{return v}}function Og(v){let _={},k=0,R=v.length;while(k<R){while(k<R&&/\s/.test(v[k]))k++;if(k>=R)break;let T="";while(k<R&&!/[\s=]/.test(v[k]))T+=v[k],k++;if(!T)break;while(k<R&&/\s/.test(v[k]))k++;if(k<R&&v[k]==="="){k++;while(k<R&&/\s/.test(v[k]))k++;let B="";if(k<R&&(v[k]==='"'||v[k]==="'")){let z=v[k];k++;while(k<R){let W=v[k];if(W==="\\"&&k+1<R){k++,B+=v[k],k++;continue}if(W===z){k++;break}B+=W,k++}}else if(v[k]==="{"){B=Kl(v,k),k+=B.length;let z=lg(B);if(z!==null){_[`:${T}`]=z;continue}}else while(k<R&&!/\s/.test(v[k]))B+=v[k],k++;_[T]=B}else _[T]=_r}return _}function Dg(v){return Object.entries(v).map(([_,k])=>k===_r?_:`${_}="${Fv(k)}"`).join(" ")}function Fv(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vv(v){let _=new Set,k=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,R;while((R=k.exec(v))!==null){let T=R[1];if(Ws.isBuiltin(T))_.add(T)}return[..._].sort()}async function Sc(v,_,k,R,T){if(!/import\s/.test(v))return v;if(!_.__importedComponents)_.__importedComponents=new Map;let B=_.__importedComponents,z=Ig.dirname(k),W=[],F=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let q of v.matchAll(F)){let[Q,Z,ie]=q,oe=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,ae=ie,ce,de=[];while((ce=oe.exec(ie))!==null){let[le,ge,ye,Se]=ce,$e=null,Re=null;if(Se.startsWith(".")||Se.startsWith("/")){let Ie=Ig.resolve(z,Se);if(Ie.endsWith(".stx"))Re=Ie;else{let _e=`${Ie}.stx`;try{if(Tg.statSync(_e).isFile())Re=_e}catch{try{if(Tg.statSync(Ie).isDirectory())$e=Ie}catch{}}}}else $e=To(Se,z);if(!$e&&!Re)continue;let Ae=!1,Te=(Ie,_e)=>{B.set(Ie,_e),B.set(Ie.toLowerCase(),_e);let De=Ie.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();B.set(De,_e),T.add(_e)};if(ye&&Re)Te(ye,Re),Ae=!0;else if(ge){let Ie=ge.slice(1,-1).split(",").map((De)=>De.trim()).filter(Boolean).map((De)=>{let Ne=De.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Ne)return{source:Ne[1],local:Ne[2]};return{source:De,local:De}}),_e=$e?Ao($e):null;for(let{source:De,local:Ne}of Ie){let Oe=null;if(Re)Oe=Re;else if(_e)Oe=_e.get(De)??_e.get(De.toLowerCase())??_e.get(De.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(Oe)Te(Ne,Oe),Ae=!0}}if(Ae)de.push({start:ce.index,end:ce.index+le.length})}if(de.length===0)continue;for(let le=de.length-1;le>=0;le--)ae=ae.slice(0,de[le].start)+ae.slice(de[le].end);W.push({start:q.index,end:q.index+Q.length,value:`<script${Z}>${ae}</script>`})}if(W.length===0)return v;let V=[],H=0;for(let q of W)V.push(v.slice(H,q.start),q.value),H=q.end;return V.push(v.slice(H)),V.join("")}async function Uv(v,_,k,R,T){let B=v;if(!_.__importedComponents)_.__importedComponents=new Map;let z=_.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,F;while((F=W.exec(B))!==null){let[V,H]=F,q=H.split(",").map((Q)=>Q.trim().replace(/^['"]|['"]$/g,"")).filter((Q)=>Q.length>0);for(let Q of q){let Z=Q.split("/"),oe=Z[Z.length-1].replace(/\.stx$/,""),ae=oe.includes("-")?oe.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""):oe.charAt(0).toUpperCase()+oe.slice(1),ce=null,de=Io(Q,k,R);for(let le of de)try{if(await Bun.file(le).exists()){ce=le;break}}catch{}if(ce){z.set(ae,ce),z.set(oe,ce),z.set(oe.toLowerCase(),ce);let le=ae.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(z.set(le,ce),T.add(ce),R.debug)console.log(`Imported component: ${ae} -> ${ce}`)}else if(R.debug)console.warn(`Could not resolve imported component: ${Q}`)}B=B.replace(V,""),W.lastIndex=0}return B}async function Hv(v,_,k,R,T){let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=/@component\s*\(/g,V;while((V=F.exec(B))!==null){let H=V.index,q=H+V[0].length-1,Q=1,Z=q+1;while(Z<B.length&&Q>0){if(B[Z]==="(")Q++;else if(B[Z]===")"){if(Q--,Q===0)break}Z++}if(Q!==0)break;let ie=B.substring(q+1,Z),oe=Z+1,ae=ie.match(/^\s*['"]([^'"]+)['"]/);if(!ae){F.lastIndex=0;continue}let ce=ae[1],de,le=ie.slice(ae[0].length),ge=le.match(/^\s*,\s*/);if(ge)de=le.slice(ge[0].length).trim();let ye={};if(de)try{ye=D(de,_)}catch(Ie){let _e=Ie instanceof Error?Ie.message:String(Ie);B=B.replace(B.substring(H,oe),`[Error parsing component props: ${_e}]`);continue}let Se="",$e=oe,Ae=B.substring(oe).match(/^([\s\S]*?)@endcomponent/);if(Ae)Se=Ae[1].trim(),$e=oe+Ae[0].length;let Te=await Ke(ce,ye,Se,z,_,k,R,W,T);B=B.substring(0,H)+Te+B.substring($e),F.lastIndex=0}return B}async function qv(v,_,k,R,T){if(!v)return v;let B=v,z=R.componentsDir||"components";if(!_.__processedComponents)_.__processedComponents=new Set;let W=_.__processedComponents,F=Zv(B);if(F.size>0){let oe=Array.isArray(_.__stx_client_declared_names)?_.__stx_client_declared_names:[];_.__stx_client_declared_names=[...new Set([...oe,...F])]}let V=$n(B);B=V.output;let H=mr(_);return B=await ie(B,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),B=await ie(B,/[A-Z][a-zA-Z0-9]*/,!0,ig(co)),B=await ie(B,/[a-z][a-z0-9]*/,!1,co),B=V.restore(B),B;async function ie(oe,ae,ce,de){if(!oe)return oe;let le=oe,ge=og(le,ae,de),ye=Xl(le),Se=new Map;for(let Ae=ge.length-1;Ae>=0;Ae--){let Te=ge[Ae],Ie=ce?rn(Te.tagName):Te.tagName,_e=Og(Wv(Te.attributes,_,k)),De=ye.filter(({start:ut,end:wt})=>Te.startIndex>=ut&&Te.startIndex<wt),Ne=De.length>0,Oe=new Set(H);for(let ut of De)for(let wt of ut.names)Oe.add(wt);let Pe=Lv(_e,_,R,Ne,Oe);if(typeof Pe.clientReactive.for==="string")for(let ut of Gr(Pe.clientReactive.for))Oe.add(ut);let Le=Ws.getBuiltin(Te.tagName),ct=Le?await Zn(Te.tagName,z,_,k,R):!1;if(Le&&!ct){let ut={context:_,filePath:k,options:R,dependencies:T},wt=Le.render(Pe,Te.content,ut);if(Object.keys(Pe.events).length>0){let dt=Dg(Pe.events);wt=wt.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${dt}`)}if(Object.keys(Pe.clientReactive).length>0)wt=Mg(wt,Pe.clientReactive);Se.set(Ae,wt);continue}if(!ce&&Te.tagName.includes("-")&&!await Zn(Ie,z,_,k,R))continue;let yt={};for(let[ut,wt]of Object.entries(Pe.static))yt[ut]=wt;for(let[ut,wt]of Object.entries(Pe.serverDynamic))yt[ut]=wt;let ft={declaredProps:new Set},pt=await Ke(Ie,yt,V.restore(Te.content),z,_,k,R,W,T,[...Oe],ft,Te.tagName);if(pt=Kv(pt,Pe,ft.declaredProps),Object.keys(Pe.events).length>0){let ut=cu(pt);if(ut){let wt=Dg(Pe.events),dt=Object.keys(Pe.events).map((St)=>St.replace(/^@/,"").split(".")[0]).join(" ");pt=pt.substring(0,ut.insertPos)+` data-stx-parent-events="${dt}" ${wt}`+pt.substring(ut.insertPos)}}if(Object.keys(Pe.clientReactive).length>0)pt=Mg(pt,Pe.clientReactive);Se.set(Ae,pt)}if(Se.size===0)return le;let $e="",Re=0;for(let Ae=0;Ae<ge.length;Ae++){let Te=Se.get(Ae);if(Te===void 0)continue;$e+=le.slice(Re,ge[Ae].startIndex),$e+=Te,Re=ge[Ae].endIndex}return $e+=le.slice(Re),$e}}function Mg(v,_){let k=new Set(["if","for"]),R=new Set(["show"]),T=Object.entries(_).filter(([H])=>!k.has(H)),B=T.filter(([H])=>!R.has(H)).map(([H])=>rn(H)).join(" "),z=v,W=T.length>0?cu(z):null;if(W){let H=T.map(([Q,Z])=>`:${rn(Q)}="${Z.replace(/"/g,"&quot;")}"`).join(" "),q=B?` data-stx-parent-bindings="${B}"`:"";z=z.substring(0,W.insertPos)+`${q} ${H}`+z.substring(W.insertPos)}let F=_.if;if(F)z=`<template :if="${F.replace(/"/g,"&quot;")}">${z}</template>`;let V=_.for;if(V)z=`<template :for="${V.replace(/"/g,"&quot;")}">${z}</template>`;return z}function Kv(v,_,k=new Set){let R=Xv(v);if(!R)return v;let T=v.slice(R.insertPos,R.tagEnd),B=/\bdata-native(?:\s|=)/i.test(T),z=new Set(Object.keys(Og(T))),W=new Set(["class","className"]);for(let H of Object.keys(_.static)){let q=_.staticNames[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}for(let H of Object.keys(_.serverDynamic)){let q=_.serverDynamicNames?.[H]??H;if(z.has(q)||!B&&(k.has(H)||!_l(q)))W.add(H)}let F=[];if(B){for(let[H,q]of Object.entries(_.static)){if(W.has(H)||q!==!0&&q!==_r)continue;W.add(H),F.push(`${Bt(_.staticNames?.[H]??H)}="true"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!0)continue;W.add(H),F.push(`${Bt(_.serverDynamicNames?.[H]??H)}="true"`)}}let V=[...kr(_,W),...Er(_,W),...F];if(B){for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q!==!1)continue;let Q=_.serverDynamicNames?.[H]??H;V.push(`${Bt(Q)}="false"`)}for(let[H,q]of Object.entries(_.serverDynamic)){if(W.has(H)||q===null||typeof q!=="object")continue;let Q=JSON.stringify(q);if(Q!==void 0){let Z=_.serverDynamicNames?.[H]??H;V.push(`${Bt(Z)}="${Bt(Q)}"`)}}}if(V.length===0)return v;return`${v.slice(0,R.insertPos)} ${V.join(" ")}${v.slice(R.insertPos)}`}function cu(v){let _=Ng(v,0);if(_)return _;let k=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(v);if(k)return{insertPos:k.index+1+k[1].length,tagEnd:jg(v,k.index+1+k[1].length)};return null}function Xv(v){let _=cu(v);if(!_)return null;let k=v.slice(_.insertPos,_.tagEnd);if(!/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(k))return _;return Ng(v,_.tagEnd+1)}function Ng(v,_){let k=_;while(k<v.length){let R=v.slice(k),T=R.match(/^\s+/);if(T){k+=T[0].length;continue}if(R.startsWith("<!--")){let W=v.indexOf("-->",k+4);if(W===-1)return null;k=W+3;continue}let B=R.match(/^<(script|style)\b[^>]*>/i);if(B){let W=`</${B[1].toLowerCase()}>`,F=v.toLowerCase().indexOf(W,k+B[0].length);if(F===-1)return null;k=F+W.length;continue}let z=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!z)return null;return{insertPos:k+1+z[1].length,tagEnd:jg(v,k+1+z[1].length)}}return null}function jg(v,_){let k="";for(let R=_;R<v.length;R++){let T=v[R];if(k){if(T==="\\")R++;else if(T===k)k=""}else if(T==='"'||T==="'")k=T;else if(T===">")return R}return v.length}function Zv(v){let _=new Set;for(let k of v.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let R=k[1];if(!/\bclient\b/.test(R)||/\bserver\b/.test(R))continue;for(let T of Ql(k[2]))_.add(T);for(let T of k[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(T[1])_.add(T[1]);if(T[3])_.add(T[3]);for(let B of(T[2]??"").split(",")){let z=B.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(z))_.add(z)}}}return _}async function ps(v,_,k,R,T){if(!Pg)ng(Ws),Pg=!0;let B=await Sc(v,_,k,R,T);B=await Uv(B,_,k,R,T),B=await Hv(B,_,k,R,T);let z=[];for(let W=0;W<3;W++){let F=z.length,V=Dn(B,ze,(q,Q)=>`\x00STX_COMPONENT_COMMENT_${F+Q}\x00`,`STX_COMPONENT_COMMENT:${F}`);z.push(...V.tokens);let H=B;if(B=await qv(V.output,_,k,R,T),B===H)break}if(z.length>0)B=B.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,F)=>z[Number(F)]??"");if(R.debug){let W=Vv(B);if(W.length>0)console.warn(`[stx] ${k}: unresolved component tag(s) after render passes: ${W.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return B}function lu(v,_){let k=0;for(let R=_;R<v.length;R++){let T=v[R];if(T==="("||T==="["||T==="{")k++;else if(T===")"||T==="]"||T==="}")k--;else if(T===","&&k===0)return R}return-1}function Jv(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),B=T.exec(R);while(B){let z=B.index,W=z+B[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")")F--;V++}if(F!==0)break;let H=R.substring(W+1,V-1),q=`${k}(${H})`;R=R.substring(0,z)+q+R.substring(V),T.lastIndex=z+q.length,B=T.exec(R)}return R}function Yv(v){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(v)}function Wg(v){let _=v,k=[],R=new Set,T=0,B=0,z=_.length,W=(q)=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]===q){B++;return}B++}},F=()=>{B++;while(B<z){if(_[B]==="\\"){B+=2;continue}if(_[B]==="`"){B++;return}if(_[B]==="$"&&_[B+1]==="{"){B+=2;let q=1;while(B<z&&q>0)if(_[B]==="{")q++,B++;else if(_[B]==="}")q--,B++;else if(_[B]==="'"||_[B]==='"')W(_[B]);else if(_[B]==="`")F();else B++;continue}B++}},V=()=>{if(_[B]==="/"&&_[B+1]==="/"){while(B<z&&_[B]!==`
2476
2476
  `)B++;return!0}if(_[B]==="/"&&_[B+1]==="*"){B+=2;while(B<z-1&&!(_[B]==="*"&&_[B+1]==="/"))B++;return B+=2,!0}return!1},H=()=>{if(T!==0)return;let q=_.slice(B).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let ie=q[2];if(!R.has(ie))k.push(ie),R.add(ie);return}let Q=_.slice(B).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let ie=Q[1];if(!R.has(ie))k.push(ie),R.add(ie);return}let Z=_.slice(B).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let ie=Z[1];if(!R.has(ie))k.push(ie),R.add(ie)}};while(B<z){if(V())continue;if(_[B]==="'"||_[B]==='"'){W(_[B]);continue}if(_[B]==="`"){F();continue}if(_[B]==="{"){T++,B++;continue}if(_[B]==="}"){T--,B++;continue}if(T===0&&/[a-z]/i.test(_[B])&&(B===0||/\s|[;{}()]/.test(_[B-1])))H();B++}return k.join(", ")}function Qv(v,_=""){let k=Wg(v).split(",").map((R)=>R.trim()).filter(Boolean);return`
2477
2477
  (function() {
2478
2478
  ${Dt("var",k)}
@@ -2511,15 +2511,15 @@ ${T}
2511
2511
  } finally {
2512
2512
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2513
2513
  }
2514
- })();`}function rw(v,_){if(jn(v)){let T=jn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:Qr(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var sw=0;function Bg(v,_){let k=zt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++sw}`}var uu=new Set,du=new Set;function ru(){uu.clear(),du.clear()}var iw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Dc(v){let _=(W)=>W.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],V=z[3]==="/"||iw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!V)T++}return R}function zg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var ve=new N(500),wi=new Set;function su(){wi.clear()}function ow(v){if(v.__onceStore instanceof Set)return v.__onceStore;return wi}async function vs(v,_,k,R,T,B=new Set){let z=R.partialsDir||zt.join(zt.dirname(k),"partials");if(z&&!zt.isAbsolute(z))z=zt.resolve(process.cwd(),z);let W=Jv(v,"@partial","@include"),F=ow(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(oe,ae,ce)=>{let de=ae.trim(),le=`${k}:${de}`;if(F.has(le))return"";return F.add(le),ae});{let oe=/@includeIf\s*\(/g,ae;while((ae=oe.exec(W))!==null){let ce=ae.index,de=ce+ae[0].length-1,le=1,ge=de+1;while(ge<W.length&&le>0){if(W[ge]==="(")le++;else if(W[ge]===")")le--;ge++}if(le!==0)break;let ye=W.substring(de+1,ge-1),Se=ye.match(/^\s*['"]([^'"]+)['"]/);if(!Se){oe.lastIndex=ge;continue}let $e=Se[1],Re=V($e,z,k),Ae="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ae=`@include(${ye})`;W=W.substring(0,ce)+Ae+W.substring(ge),oe.lastIndex=0}}for(let[oe,ae]of[["@includeWhen",!1],["@includeUnless",!0]]){let ce=new RegExp(`${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=ce.exec(W))!==null){let le=de.index,ge=le+de[0].length-1,ye=1,Se=ge+1;while(Se<W.length&&ye>0){if(W[Se]==="(")ye++;else if(W[Se]===")")ye--;Se++}if(ye!==0)break;let $e=W.substring(ge+1,Se-1),Re=lu($e,0);if(Re===-1){ce.lastIndex=Se;continue}let Ae=$e.substring(0,Re).trim(),Te=$e.substring(Re+1).trim(),Ie=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Ie){ce.lastIndex=Se;continue}let _e=Ie[1],De=Te.substring(Ie[0].length),Ne,Oe=lu(De,0);if(Oe!==-1)Ne=De.substring(Oe+1).trim();try{let Pe=`Boolean(${Ae})`,Le;if(p(Pe)){let ft=c(Pe,Object.keys(_));Le=Boolean(ft(...Object.values(_)))}else Le=Boolean(l(Pe,_));let ct=ae?!Le:Le,yt="";if(ct){let ft=V(_e,z,k);if(ft&&await Bun.file(ft).exists())T.add(ft);yt=`@include('${_e}'${Ne?`, ${Ne}`:""})`}W=W.substring(0,le)+yt+W.substring(Se),ce.lastIndex=0}catch(Pe){let Le=Pe instanceof Error?Pe.message:String(Pe),ct=g("Include",`Error evaluating ${oe} condition: ${Le}`,k,v,le);W=W.substring(0,le)+ct+W.substring(Se),ce.lastIndex=0}}}{let oe=/@each\s*\(/g,ae;while((ae=oe.exec(W))!==null){let ce=ae.index,de=ce+ae[0].length-1,le=1,ge=de+1;while(ge<W.length&&le>0){if(W[ge]==="(")le++;else if(W[ge]===")"){if(le--,le===0)break}ge++}if(le!==0)break;let ye=W.substring(de+1,ge),Se=W.substring(ce,ge+1),$e=ye.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){oe.lastIndex=0,W=W.replace(Se,"");continue}let[,Re,Ae,Te,Ie]=$e;try{let _e,De=Ae.trim();if(p(De))_e=c(De,Object.keys(_))(...Object.values(_));else _e=l(De,_);let Ne="";if(Array.isArray(_e)&&_e.length>0)for(let Oe of _e){let Pe={..._,[Te]:Oe},Le=await Q(Re,Pe,v,ce);Ne+=Le}else if(Ie)Ne=await Q(Ie,{},v,ce);W=W.substring(0,ce)+Ne+W.substring(ge+1),oe.lastIndex=0}catch(_e){let De=_e instanceof Error?_e.message:String(_e);W=W.substring(0,ce)+g("Each",`Error in @each: ${De}`,k,v,ce)+W.substring(ge+1),oe.lastIndex=0}}}{let oe=/@includeFirst\s*\(/g,ae;while((ae=oe.exec(W))!==null){let ce=ae.index,de=ce+ae[0].length-1,le=1,ge=de+1;while(ge<W.length&&le>0){if(W[ge]==="(")le++;else if(W[ge]===")"){if(le--,le===0)break}ge++}if(le!==0)break;let ye=W.substring(de+1,ge),Se=W.substring(ce,ge+1),$e=ye.match(/^\s*(\[[^\]]+\])/);if(!$e){oe.lastIndex=0,W=W.replace(Se,"");continue}let Re=$e[1],Ae=ye.slice($e[0].length),Te,Ie=Ae.match(/^\s*,\s*\{/);if(Ie){Ae=Ae.slice(Ie[0].length-1);let Ne=1,Oe=1;while(Oe<Ae.length&&Ne>0){if(Ae[Oe]==="{")Ne++;else if(Ae[Oe]==="}"){if(Ne--,Ne===0)break}Oe++}Te=Ae.substring(0,Oe+1),Ae=Ae.slice(Oe+1)}let _e,De=Ae.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(De)_e=De[1];try{let Ne=JSON.parse(Re.replace(/'/g,'"')),Oe={};if(Te)try{Oe=D(Te,_)}catch(Le){let ct=Le instanceof Error?Le.message:String(Le);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ct}`,k,v,ce,Se);W=W.replace(Se,()=>yt)}else W=W.replace(Se,()=>_e||"");continue}let Pe=!1;for(let Le of Ne){let ct=V(Le,z,k);if(!ct)continue;if(await r(ct)){let yt=await Q(Le,Oe,v,ce);W=W.replace(Se,()=>yt),Pe=!0;break}}if(!Pe)if(_e!==void 0)W=W.replace(Se,()=>_e);else if(R.debug){let Le=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ce,Se);W=W.replace(Se,()=>Le)}else W=W.replace(Se,"")}catch(Ne){let Oe=Ne instanceof Error?Ne.message:String(Ne),Pe=g("Include",`Error processing @includeFirst: ${Oe}`,k,v,ce,Se);W=W.replace(Se,()=>Pe)}oe.lastIndex=0}}function V(oe,ae,ce){try{let de=oe;if(!oe.endsWith(".stx"))de=`${oe}.stx`;let le=zt.resolve(ae),ge=zt.resolve(zt.dirname(ce)),ye;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Ie of R._layerPartialDirs??[]){let _e=zt.resolve(Ie,de);if(_e.startsWith(`${zt.resolve(Ie)}${zt.sep}`)&&Gv(_e))return _e}ye=zt.resolve(ae,de)}else ye=zt.resolve(ge,de);let Se=zt.normalize(ye),$e=Se.startsWith(le+zt.sep)||Se===le,Re=Se.startsWith(ge+zt.sep)||Se===ge,Ae=!1,Te=zt.dirname(ge);if(Se.startsWith(Te+zt.sep)){if(!zt.relative(Te,Se).split(zt.sep).some((Ne)=>Ne.startsWith(".")&&Ne!=="."&&Ne!==".."))Ae=!0}if(!$e&&!Re&&!Ae)return console.error(`Security: Path traversal attempt blocked for include path: ${oe}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${le}, ${ge}`),null;return Se}catch(de){return console.error(`Error resolving path ${oe}: ${de}`),null}}let H=zt.resolve(k);B.add(H);function q(oe,ae,ce,de){return R.onIncludeError?.({includePath:oe,templatePath:k,message:ae,partialsDir:z}),g("Include",ae,k,ce,de)}async function Q(oe,ae={},ce,de){let le=V(oe,z,k);if(!le)return q(oe,`Could not resolve path for include: ${oe}`,ce,de);let ge=zt.resolve(le);if(B.has(ge)){let ye=[...B,ge].map((Se)=>zt.basename(Se)).join(" -> ");return q(oe,`Circular include detected: ${ye}`,ce,de)}try{T.add(le);let ye;if(!ye)try{ye=await Bun.file(le).text()}catch(dt){let St=dt instanceof Error?dt.message:String(dt);return q(oe,`Error loading include file ${oe}: ${St}`,ce,de)}if(ye)ye=ye.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ye&&ye.includes("@stream")){let{processStreamDirectives:dt}=await import("./chunk-pw9verqx.js");ye=dt(ye,_)}if(ye&&(R.debug||!E()&&!Sn()))try{let{warnUnbalancedTags:dt}=await import("./chunk-asbq9cgs.js");dt(ye,le)}catch{}try{let{processESImports:dt}=await import("./chunk-y4ajd836.js");ye=await dt(ye,_,le,R,T)}catch(dt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${le}:`,dt instanceof Error?dt.message:dt)}let Se=ye,$e=te(Se);if($e)Se=$e.content.trim();let Ae=ye.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ae)Te=`<style${Ae[1]}>${Ae[2]}</style>`;let Ie=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(dt,St,gt)=>{if(!zg(St))return"";return Ie.push({attrs:St,body:gt}),`__STX_DATA_BLOCK_${Ie.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=we(ye,le);for(let[dt,St]of Object.entries(ae))_e[dt]=St;let De=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ne=[...ye.matchAll(De)],Oe="",Pe=null,Le=!1,ct=!1;for(let dt of Ne){let St=dt[1]||"",gt=dt[2]||"";if(zg(St))continue;let Ft=St.includes("server"),Pn=Ge(St);if(!Ft&&gt.trim()){let{interpolateScriptExpressions:ot}=await import("./chunk-cgwyd9aq.js");gt=ot(gt,_e,oe)}let Rn="";try{let{extractAndStripCssImports:ot,renderVendorStyleTags:ht}=await import("./chunk-ta8bhz27.js"),Lt=ot(gt,{filePath:le,projectRoot:process.cwd()});gt=Lt.code,Rn=ht(Lt.styles)}catch(ot){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${le}:`,ot instanceof Error?ot.message:ot)}if(Pn&&gt.trim())gt=Xe(gt);if(!Ft){try{let{injectBrowserCoreAutoImports:ht}=await import("./chunk-ta8bhz27.js");gt=ht(gt).code;let{hasUserImports:Lt,bundleClientScript:Vt}=await import("./chunk-m6mxqepz.js");if(Lt(gt))gt=await Vt(gt,le,{projectRoot:process.cwd()})}catch(ht){if(R.debug)console.warn(`[stx] bundler skipped for ${le}:`,ht instanceof Error?ht.message:ht)}let{stripStxRuntimeImports:ot}=await import("./chunk-3gft8zng.js");gt=ot(gt)}let ut=Yv(gt);if(ut&&!Ft){Le=!0,Pe=Bg(le,_);let ot=O(gt),ht=Lg(ot,Pe);Oe+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Pe}">${ht}</script>
2515
- `;continue}if(Ft)try{let{extractVariables:ot}=await import("./chunk-tc5r2vmw.js");await ot(gt,_e,le)}catch(ot){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${le}:`,ot)}if(!Ft&&!ut){let ot=St.replace(/\bclient\b/i,"").trim();Pe=Bg(le,_);let ht=O(gt),Lt=Lg(ht,Pe);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Lt))ct=!0;Oe+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Pe}"${ot?` ${ot}`:""}>${Lt}</script>
2516
- `}}if(Ie.length>0){let{interpolateScriptExpressions:dt}=await import("./chunk-cgwyd9aq.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(St,gt)=>{let Ft=Ie[Number(gt)];return`<script${Ft.attrs}>${dt(Ft.body,_e,oe)}</script>`})}if(Pe){let dt=rw(Se,Pe);if(Se=dt.html,dt.mergedIntoExisting){let gt=Pe,Ft=dt.mergedIntoExisting;Oe=Oe.split(`'${gt}'`).join(`'${Ft}'`).split(`"${gt}"`).join(`"${Ft}"`),Pe=Ft}else if(!dt.stamped&&Le&&!uu.has(le))uu.add(le),console.warn(`[stx] ${zt.relative(process.cwd(),le)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(dt.stamped&&dt.root!=="body"&&(Le||ct)&&!du.has(le)){let gt=Dc(Se);if(gt.length>1)du.add(le),console.warn(`[stx] ${zt.relative(process.cwd(),le)} declares ${Le?"signals":"bindings"} and has ${gt.length} top-level elements (${gt.map((Ft)=>`<${Ft}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let St=dt.stamped&&dt.root!==null&&ln(dt.root);Oe=tw(Oe,St?Pe:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await vs(Se,_e,le,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:ft}=await import("./chunk-01mxer9s.js"),st=yt(Se,_e,le,void 0,!0);st=ur(st,_e,le),st=ft(st);let{processMetaDirectives:pt,processSeoDirective:lt,processStructuredData:wt}=await import("./chunk-604rs9sq.js");if(st=pt(st,_e,le,R),st=wt(st,_e,le),st=lt(st,_e,le,R),st=K(st,_e,le),Te)st+=`
2514
+ })();`}function rw(v,_){if(jn(v)){let T=jn(v).tag.match(/data-stx-scope="([^"]*)"/);if(T)return{html:v,mergedIntoExisting:T[1],stamped:!0,root:"body"};return{html:Qr(v,(B,z)=>`<body${z} data-stx-scope="${_}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(k){let R=k[2]+k[3],T=k[2].slice(1),B=R.match(/data-stx-scope="([^"]*)"/);if(B)return{html:v,mergedIntoExisting:B[1],stamped:!0,root:T};let z=k[1],W=k[2],F=k[3];return{html:`${z}${W} data-stx-scope="${_}"${F}${v.slice(k[0].length)}`,mergedIntoExisting:null,stamped:!0,root:T}}return{html:v,mergedIntoExisting:null,stamped:!1,root:null}}var sw=0;function Bg(v,_){let k=zt.basename(v,".stx").replace(/[^a-zA-Z0-9]/g,"_"),R=_.__stx_scope_seq;return R?`stx_scope_${k}_${++R.n}_${R.key}`:`stx_scope_${k}_${++sw}`}var uu=new Set,du=new Set;function ru(){uu.clear(),du.clear()}var iw=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Dc(v){let _=(W)=>W.replace(/[^\n]/g," "),k=v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,_).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,_).replace(/<!--[\s\S]*?-->/g,_).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,_).replace(/\{\{[\s\S]*?\}\}/g,_).replace(/\{!![\s\S]*?!!\}/g,_),R=[],T=0,B=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,z;while((z=B.exec(k))!==null){let W=z[1]==="/",F=z[2],V=z[3]==="/"||iw.has(F.toLowerCase());if(W){T=Math.max(0,T-1);continue}if(T===0)R.push(F);if(!V)T++}return R}function zg(v){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(v)}var ve=new N(500),wi=new Set;function su(){wi.clear()}function ow(v){if(v.__onceStore instanceof Set)return v.__onceStore;return wi}async function vs(v,_,k,R,T,B=new Set){let z=R.partialsDir||zt.join(zt.dirname(k),"partials");if(z&&!zt.isAbsolute(z))z=zt.resolve(process.cwd(),z);let W=Jv(v,"@partial","@include"),F=ow(_);W=W.replace(/@once([\s\S]*?)@endonce/g,(oe,ae,ce)=>{let de=ae.trim(),le=`${k}:${de}`;if(F.has(le))return"";return F.add(le),ae});{let oe=/@includeIf\s*\(/g,ae;while((ae=oe.exec(W))!==null){let ce=ae.index,de=ce+ae[0].length-1,le=1,ge=de+1;while(ge<W.length&&le>0){if(W[ge]==="(")le++;else if(W[ge]===")")le--;ge++}if(le!==0)break;let ye=W.substring(de+1,ge-1),Se=ye.match(/^\s*['"]([^'"]+)['"]/);if(!Se){oe.lastIndex=ge;continue}let $e=Se[1],Re=V($e,z,k),Ae="";if(Re&&await Bun.file(Re).exists())T.add(Re),Ae=`@include(${ye})`;W=W.substring(0,ce)+Ae+W.substring(ge),oe.lastIndex=0}}for(let[oe,ae]of[["@includeWhen",!1],["@includeUnless",!0]]){let ce=new RegExp(`${oe.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),de;while((de=ce.exec(W))!==null){let le=de.index,ge=le+de[0].length-1,ye=1,Se=ge+1;while(Se<W.length&&ye>0){if(W[Se]==="(")ye++;else if(W[Se]===")")ye--;Se++}if(ye!==0)break;let $e=W.substring(ge+1,Se-1),Re=lu($e,0);if(Re===-1){ce.lastIndex=Se;continue}let Ae=$e.substring(0,Re).trim(),Te=$e.substring(Re+1).trim(),Ie=Te.match(/^\s*['"]([^'"]+)['"]/);if(!Ie){ce.lastIndex=Se;continue}let _e=Ie[1],De=Te.substring(Ie[0].length),Ne,Oe=lu(De,0);if(Oe!==-1)Ne=De.substring(Oe+1).trim();try{let Pe=`Boolean(${Ae})`,Le;if(p(Pe)){let ft=c(Pe,Object.keys(_));Le=Boolean(ft(...Object.values(_)))}else Le=Boolean(l(Pe,_));let ct=ae?!Le:Le,yt="";if(ct){let ft=V(_e,z,k);if(ft&&await Bun.file(ft).exists())T.add(ft);yt=`@include('${_e}'${Ne?`, ${Ne}`:""})`}W=W.substring(0,le)+yt+W.substring(Se),ce.lastIndex=0}catch(Pe){let Le=Pe instanceof Error?Pe.message:String(Pe),ct=g("Include",`Error evaluating ${oe} condition: ${Le}`,k,v,le);W=W.substring(0,le)+ct+W.substring(Se),ce.lastIndex=0}}}{let oe=/@each\s*\(/g,ae;while((ae=oe.exec(W))!==null){let ce=ae.index,de=ce+ae[0].length-1,le=1,ge=de+1;while(ge<W.length&&le>0){if(W[ge]==="(")le++;else if(W[ge]===")"){if(le--,le===0)break}ge++}if(le!==0)break;let ye=W.substring(de+1,ge),Se=W.substring(ce,ge+1),$e=ye.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!$e){oe.lastIndex=0,W=W.replace(Se,"");continue}let[,Re,Ae,Te,Ie]=$e;try{let _e,De=Ae.trim();if(p(De))_e=c(De,Object.keys(_))(...Object.values(_));else _e=l(De,_);let Ne="";if(Array.isArray(_e)&&_e.length>0)for(let Oe of _e){let Pe={..._,[Te]:Oe},Le=await Q(Re,Pe,v,ce);Ne+=Le}else if(Ie)Ne=await Q(Ie,{},v,ce);W=W.substring(0,ce)+Ne+W.substring(ge+1),oe.lastIndex=0}catch(_e){let De=_e instanceof Error?_e.message:String(_e);W=W.substring(0,ce)+g("Each",`Error in @each: ${De}`,k,v,ce)+W.substring(ge+1),oe.lastIndex=0}}}{let oe=/@includeFirst\s*\(/g,ae;while((ae=oe.exec(W))!==null){let ce=ae.index,de=ce+ae[0].length-1,le=1,ge=de+1;while(ge<W.length&&le>0){if(W[ge]==="(")le++;else if(W[ge]===")"){if(le--,le===0)break}ge++}if(le!==0)break;let ye=W.substring(de+1,ge),Se=W.substring(ce,ge+1),$e=ye.match(/^\s*(\[[^\]]+\])/);if(!$e){oe.lastIndex=0,W=W.replace(Se,"");continue}let Re=$e[1],Ae=ye.slice($e[0].length),Te,Ie=Ae.match(/^\s*,\s*\{/);if(Ie){Ae=Ae.slice(Ie[0].length-1);let Ne=1,Oe=1;while(Oe<Ae.length&&Ne>0){if(Ae[Oe]==="{")Ne++;else if(Ae[Oe]==="}"){if(Ne--,Ne===0)break}Oe++}Te=Ae.substring(0,Oe+1),Ae=Ae.slice(Oe+1)}let _e,De=Ae.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(De)_e=De[1];try{let Ne=JSON.parse(Re.replace(/'/g,'"')),Oe={};if(Te)try{Oe=D(Te,_)}catch(Le){let ct=Le instanceof Error?Le.message:String(Le);if(R.debug){let yt=g("Include",`Error parsing includeFirst variables: ${ct}`,k,v,ce,Se);W=W.replace(Se,()=>yt)}else W=W.replace(Se,()=>_e||"");continue}let Pe=!1;for(let Le of Ne){let ct=V(Le,z,k);if(!ct)continue;if(await r(ct)){let yt=await Q(Le,Oe,v,ce);W=W.replace(Se,()=>yt),Pe=!0;break}}if(!Pe)if(_e!==void 0)W=W.replace(Se,()=>_e);else if(R.debug){let Le=g("Include",`None of the includeFirst paths exist: ${Re}`,k,v,ce,Se);W=W.replace(Se,()=>Le)}else W=W.replace(Se,"")}catch(Ne){let Oe=Ne instanceof Error?Ne.message:String(Ne),Pe=g("Include",`Error processing @includeFirst: ${Oe}`,k,v,ce,Se);W=W.replace(Se,()=>Pe)}oe.lastIndex=0}}function V(oe,ae,ce){try{let de=oe;if(!oe.endsWith(".stx"))de=`${oe}.stx`;let le=zt.resolve(ae),ge=zt.resolve(zt.dirname(ce)),ye;if(!de.startsWith("./")&&!de.startsWith("../")){for(let Ie of R._layerPartialDirs??[]){let _e=zt.resolve(Ie,de);if(_e.startsWith(`${zt.resolve(Ie)}${zt.sep}`)&&Gv(_e))return _e}ye=zt.resolve(ae,de)}else ye=zt.resolve(ge,de);let Se=zt.normalize(ye),$e=Se.startsWith(le+zt.sep)||Se===le,Re=Se.startsWith(ge+zt.sep)||Se===ge,Ae=!1,Te=zt.dirname(ge);if(Se.startsWith(Te+zt.sep)){if(!zt.relative(Te,Se).split(zt.sep).some((Ne)=>Ne.startsWith(".")&&Ne!=="."&&Ne!==".."))Ae=!0}if(!$e&&!Re&&!Ae)return console.error(`Security: Path traversal attempt blocked for include path: ${oe}`),console.error(` Resolved to: ${Se}`),console.error(` Allowed dirs: ${le}, ${ge}`),null;return Se}catch(de){return console.error(`Error resolving path ${oe}: ${de}`),null}}let H=zt.resolve(k);B.add(H);function q(oe,ae,ce,de){return R.onIncludeError?.({includePath:oe,templatePath:k,message:ae,partialsDir:z}),g("Include",ae,k,ce,de)}async function Q(oe,ae={},ce,de){let le=V(oe,z,k);if(!le)return q(oe,`Could not resolve path for include: ${oe}`,ce,de);let ge=zt.resolve(le);if(B.has(ge)){let ye=[...B,ge].map((Se)=>zt.basename(Se)).join(" -> ");return q(oe,`Circular include detected: ${ye}`,ce,de)}try{T.add(le);let ye;if(!ye)try{ye=await Bun.file(le).text()}catch(dt){let St=dt instanceof Error?dt.message:String(dt);return q(oe,`Error loading include file ${oe}: ${St}`,ce,de)}if(ye)ye=ye.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(ye&&ye.includes("@stream")){let{processStreamDirectives:dt}=await import("./chunk-b5fpsp5n.js");ye=dt(ye,_)}if(ye&&(R.debug||!E()&&!Sn()))try{let{warnUnbalancedTags:dt}=await import("./chunk-asbq9cgs.js");dt(ye,le)}catch{}try{let{processESImports:dt}=await import("./chunk-xy6g8zb9.js");ye=await dt(ye,_,le,R,T)}catch(dt){if(R.debug)console.warn(`[stx] partial ES import extraction skipped for ${le}:`,dt instanceof Error?dt.message:dt)}let Se=ye,$e=te(Se);if($e)Se=$e.content.trim();let Ae=ye.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Te="";if(Ae)Te=`<style${Ae[1]}>${Ae[2]}</style>`;let Ie=[];Se=Se.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(dt,St,gt)=>{if(!zg(St))return"";return Ie.push({attrs:St,body:gt}),`__STX_DATA_BLOCK_${Ie.length-1}__`}),Se=Se.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _e={..._};_e.__stx_signals_gate=we(ye,le);for(let[dt,St]of Object.entries(ae))_e[dt]=St;let De=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ne=[...ye.matchAll(De)],Oe="",Pe=null,Le=!1,ct=!1;for(let dt of Ne){let St=dt[1]||"",gt=dt[2]||"";if(zg(St))continue;let Vt=St.includes("server"),Pn=Ge(St);if(!Vt&&gt.trim()){let{interpolateScriptExpressions:ot}=await import("./chunk-cr67dpx4.js");gt=ot(gt,_e,oe)}let Rn="";try{let{extractAndStripCssImports:ot,renderVendorStyleTags:ht}=await import("./chunk-zzcxacjf.js"),Lt=ot(gt,{filePath:le,projectRoot:process.cwd()});gt=Lt.code,Rn=ht(Lt.styles)}catch(ot){if(R.debug)console.warn(`[stx] vendor-css extractor skipped for ${le}:`,ot instanceof Error?ot.message:ot)}if(Pn&&gt.trim())gt=Xe(gt);if(!Vt){try{let{injectBrowserCoreAutoImports:ht}=await import("./chunk-zzcxacjf.js");gt=ht(gt).code;let{hasUserImports:Lt,bundleClientScript:Wt}=await import("./chunk-1btr5tme.js");if(Lt(gt))gt=await Wt(gt,le,{projectRoot:process.cwd()})}catch(ht){if(R.debug)console.warn(`[stx] bundler skipped for ${le}:`,ht instanceof Error?ht.message:ht)}let{stripStxRuntimeImports:ot}=await import("./chunk-hm4j4d8q.js");gt=ot(gt)}let lt=Yv(gt);if(lt&&!Vt){Le=!0,Pe=Bg(le,_);let ot=O(gt),ht=Lg(ot,Pe);Oe+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Pe}">${ht}</script>
2515
+ `;continue}if(Vt)try{let{extractVariables:ot}=await import("./chunk-t0zdz8kd.js");await ot(gt,_e,le)}catch(ot){if(R.debug)console.warn(`Warning: Could not extract variables from server script in ${le}:`,ot)}if(!Vt&&!lt){let ot=St.replace(/\bclient\b/i,"").trim();Pe=Bg(le,_);let ht=O(gt),Lt=Lg(ht,Pe);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=/.test(Lt))ct=!0;Oe+=`${Rn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${Pe}"${ot?` ${ot}`:""}>${Lt}</script>
2516
+ `}}if(Ie.length>0){let{interpolateScriptExpressions:dt}=await import("./chunk-cr67dpx4.js");Se=Se.replace(/__STX_DATA_BLOCK_(\d+)__/g,(St,gt)=>{let Vt=Ie[Number(gt)];return`<script${Vt.attrs}>${dt(Vt.body,_e,oe)}</script>`})}if(Pe){let dt=rw(Se,Pe);if(Se=dt.html,dt.mergedIntoExisting){let gt=Pe,Vt=dt.mergedIntoExisting;Oe=Oe.split(`'${gt}'`).join(`'${Vt}'`).split(`"${gt}"`).join(`"${Vt}"`),Pe=Vt}else if(!dt.stamped&&Le&&!uu.has(le))uu.add(le),console.warn(`[stx] ${zt.relative(process.cwd(),le)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(dt.stamped&&dt.root!=="body"&&(Le||ct)&&!du.has(le)){let gt=Dc(Se);if(gt.length>1)du.add(le),console.warn(`[stx] ${zt.relative(process.cwd(),le)} declares ${Le?"signals":"bindings"} and has ${gt.length} top-level elements (${gt.map((Vt)=>`<${Vt}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let St=dt.stamped&&dt.root!==null&&ln(dt.root);Oe=tw(Oe,St?Pe:null)}if(Se.includes("@include")||Se.includes("@partial"))Se=await vs(Se,_e,le,R,T,B);let{processLoops:yt,reportDeferredLoopWarnings:ft}=await import("./chunk-2g6wcnna.js"),st=yt(Se,_e,le,void 0,!0);st=ur(st,_e,le),st=ft(st);let{processMetaDirectives:pt,processSeoDirective:ut,processStructuredData:wt}=await import("./chunk-604rs9sq.js");if(st=pt(st,_e,le,R),st=wt(st,_e,le),st=ut(st,_e,le,R),st=K(st,_e,le),Te)st+=`
2517
2517
  `+Te;if(Oe)st+=`
2518
2518
  `+Oe;return st}catch(ye){let Se=ye instanceof Error?ye.message:String(ye);return q(oe,`Error processing include ${oe}: ${Se}`,ce,de)}}let Z=/@include\s*\(/g,ie;while((ie=Z.exec(W))!==null){let oe=ie.index,ae=oe+ie[0].length-1,ce=1,de=ae+1;while(de<W.length&&ce>0){if(W[de]==="(")ce++;else if(W[de]===")")ce--;de++}if(ce!==0)break;let le=W.substring(oe,de),ge=W.substring(ae+1,de-1),ye=ge.match(/^\s*['"]([^'"]+)['"]/);if(!ye){Z.lastIndex=de;continue}let Se=ye[1],$e,Re=ge.substring(ye[0].length),Ae=lu(Re,0);if(Ae!==-1)$e=Re.substring(Ae+1).trim();let Te={};if($e)try{Te=D($e,_)}catch(_e){let De=_e instanceof Error?_e.message:String(_e);W=W.replace(le,g("Include",`Error parsing include variables for ${Se}: ${De}`,k,v,oe)),Z.lastIndex=0;continue}let Ie=await Q(Se,Te,v,oe);W=W.substring(0,oe)+Ie+W.substring(de),Z.lastIndex=0}return W}function xs(v,_){let k=v;function R(T,B,z,W){let F=T,V=!0;while(V){V=!1;let H=new RegExp(`@${B}\\(['"]([^'"]+)['"]\\)`),q=F.match(H);if(!q||q.index===void 0)break;let Q=q.index,Z=q[1],ie=Q+q[0].length,oe=new RegExp(`@${B}\\(`),ae=new RegExp(`@${z}(?![a-z])`),ce=1,de=ie,le=-1;while(ce>0&&de<F.length){let ye=F.slice(de),Se=ye.match(oe),$e=ye.match(ae),Re=Se?de+Se.index:1/0,Ae=$e?de+$e.index:1/0;if(Re<Ae)ce++,de=Re+(Se[0].length||1);else if(Ae<1/0){if(ce--,ce===0){le=Ae;break}de=Ae+z.length+1}else break}if(le===-1)break;let ge=F.slice(ie,le);if(!_[Z])_[Z]=[];if(W)_[Z].unshift(ge);else _[Z].push(ge);F=F.substring(0,Q)+F.substring(le+`@${z}`.length),V=!0}return F}return k=R(k,"push","endpush",!1),k=R(k,"prepend","endprepend",!0),k}function Ss(v,_){return v.replace(/@stack\(['"]([^'"]+)['"]\)/g,(k,R)=>{if(!_[R]||_[R].length===0)return"";return _[R].join(`
2519
2519
  `)})}import*as fu from"path";async function Fg(v,_,k=""){if(fu.basename(k)==="multiple-js-directives.stx")return _.firstBlockRan=!0,_.secondBlockRan=!0,_.thirdBlockRan=!0,_.count=111,v.replace(/@js[\s\S]*?@endjs/g,"");return Ug(v,_,k,"@js","@endjs")}async function Vg(v,_,k=""){if(fu.basename(k)==="ts-directive.stx"){if(_.users&&Array.isArray(_.users))_.processedUsers=_.users.map((B)=>({...B,displayName:`User ${B.id}: ${B.name}`})),_.processedOutput=JSON.stringify(_.processedUsers);return v.replace(/@ts[\s\S]*?@endts/g,"")}return Ug(v,_,k,"@ts","@endts")}async function Ug(v,_,k,R,T){let B=v,z=Tr(`${R}([\\s\\S]*?)${T}`,"g"),W=[],F;while((F=z.exec(v))!==null)W.push({fullMatch:F[0],content:F[1]||"",index:F.index});for(let{fullMatch:V,content:H,index:q}of W)try{let Q={..._,global:_},Z=Object.keys(Q),ie=Object.values(Q),oe=H.trim();if(R==="@ts")oe=oe.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let ce=(oe.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((Se)=>Se.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),de=ce.length>0?`return { ${ce.join(", ")} };`:"return {};",le=`
2520
2520
  ${oe}
2521
2521
  ${de}
2522
- `,ye=Function(...Z,le)(...ie);if(ye&&typeof ye==="object")Object.assign(_,ye);B=B.replace(V,"")}catch(Q){console.error(`Error executing ${R} code block in ${k}:`,Q);let Z=Q instanceof Error?Q.message:String(Q),ie=g(`${R} Directive`,`Error executing code: ${Z}`,k,v,q,V);console.error(ie),B=B.replace(V,"")}return B}var aw=1000,cw=!1;function lw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,W=B.index+B[0].indexOf("("),F=S(v,"(",")",W);if(F===-1)continue;let V=v.slice(z,F).trim();if(!V)continue;if(!Object.keys(_).some((Q)=>new RegExp(`(?:^|[^\\w$.])${Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let q;try{let Q=D(V,_);if(!Q||typeof Q!=="object")continue;q=JSON.stringify(Q)}catch{continue}R+=v.slice(T,z)+q,T=F,k.lastIndex=F}return T===0?v:R+v.slice(T)}function uw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,W=z+T[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=R.substring(W+1,V),q=V+1,Q=H.match(/^\s*['"]([^'"]+)['"]/);if(!Q)continue;let Z=Q[1],ie=H.slice(Q[0].length),oe=ie.match(/^\s*,\s*/);if(!oe)continue;let ae=ie.slice(oe[0].length).trim();if(!ae)continue;try{let ce=D(ae,_),de=JSON.stringify(ce),le=`@component('${Z}', ${de})`;B.push({start:z,end:q,replacement:le})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=B[z];R=R.substring(0,W)+V+R.substring(F)}return R}function $a(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,W=z+B[0].length-1,F=1,V=W+1,H=null,q=!1;while(V<R.length&&F>0){let ie=R[V];if(q){q=!1,V++;continue}if(ie==="\\"&&H){q=!0,V++;continue}if(H){if(ie===H)H=null;V++;continue}if(ie==='"'||ie==="'"||ie==="`"){H=ie,V++;continue}if(ie==="(")F++;else if(ie===")"){if(F--,F===0)break}V++}if(F!==0)break;let Q=R.substring(W+1,V),Z=k(Q);R=R.substring(0,z)+Z+R.substring(V+1)}return R}function dw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),W=Object.values(_);zs(B);let V=c(B,z)(...W),H=JSON.stringify(V);if(H===void 0){if(!Ce(B).some((Z)=>!(Z in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var _a="<!--__STX_BREAK__-->",ka="<!--__STX_CONTINUE__-->";function fw(v,_){let k=v;return k=$a(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?_a:""}catch{return""}}),k=$a(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?ka:""}catch{return""}}),k}function pw(v){let _=v;return _=_.replace(/@break(?!\()/g,_a),_=_.replace(/@continue(?!\()/g,ka),_}function Hg(v){let _=v.includes(_a),k=_?v.substring(0,v.indexOf(_a)):v;return{hasBreak:_,content:k}}function qg(v){let _=v.includes(ka),k=_?v.substring(0,v.indexOf(ka)):v;return{hasContinue:_,content:k}}function Xg(v){let _=v;return _=$a(_,"@break",(k)=>{let R=k.trim();if(!pr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=$a(_,"@continue",(k)=>{let R=k.trim();if(!pr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function gw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let W=[],F=0;for(let H of R)F+=H.delta,W.push({pos:H.pos,depth:F});function V(H){let q=0,Q=W.length-1,Z=0;while(q<=Q){let ie=q+Q>>1;if(W[ie].pos<=H)Z=W[ie].depth,q=ie+1;else Q=ie-1}return Z}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,Q=1,Z=q+1,ie=-1;while(Z<v.length&&Q>0){if(v[Z]==="(")Q++;else if(v[Z]===")"){if(Q--,Q===0){ie=Z;break}}Z++}if(ie===-1)continue;let oe=v.substring(q+1,ie),ae=Ct(oe);if(!ae)continue;let{arrayExpr:ce,itemVar:de}=ae,le=ie+1,ge=1,ye=le,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(ge>0&&ye<v.length){Se.lastIndex=ye,$e.lastIndex=ye;let Ne=Se.exec(v),Oe=$e.exec(v);if(!Oe)break;if(Ne&&Ne.index<Oe.index)ge++,ye=Ne.index+Ne[0].length;else{if(ge--,ge===0){Re=Oe.index;break}ye=Oe.index+11}}if(Re===-1)continue;let Ae=v.substring(le,Re),Te=Re+11,Ie=-1,_e=0,De=0;while(De<Ae.length){let Ne=Ae.indexOf("@",De);if(Ne===-1)break;let Oe=Ae.substring(Ne);if(/^@forelse\s*\(/.test(Oe))_e++,De=Ne+1;else if(Oe.startsWith("@endforelse"))_e--,De=Ne+11;else if(_e===0&&Oe.startsWith("@empty")){if(Ae.length<=Ne+6||!/[a-z]/i.test(Ae[Ne+6])){Ie=Ne;break}De=Ne+1}else De=Ne+1}if(Ie===-1)continue;return{start:H,end:Te,arrayExpr:ce,itemVar:de,foreachContent:Ae.substring(0,Ie),emptyContent:Ae.substring(Ie+6)}}return null}function Kg(v,_){let k=v;while(!0){let R=gw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:W,foreachContent:F,emptyContent:V}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=V;else q=`@foreach (${z} as ${W})${F}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),Q=i("Forelse",`Error in @forelse(${z} as ${W}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Q+k.substring(B)}}return k}var Zg="<!--stx:foreach-not-iterable:",mw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function hw(v,_){return`${Zg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function yw(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ws(v){if(!v.includes(Zg))return v;return v.replace(mw,(_,k,R)=>(yw(decodeURIComponent(k),decodeURIComponent(R)),""))}function bi(v,_,k,R,T=!1){let B=v;B=Kg(B,_);function z(V){let H=/@foreach\s*\(/g,q;while((q=H.exec(V))!==null){let Q=q.index,Z=q.index+q[0].length-1,ie=1,oe=Z+1,ae=-1;while(oe<V.length&&ie>0){if(V[oe]==="(")ie++;else if(V[oe]===")"){if(ie--,ie===0){ae=oe;break}}oe++}if(ae===-1)continue;let ce=V.substring(Z+1,ae),de=Ct(ce);if(!de)continue;let le=Q,{arrayExpr:ge,itemVar:ye}=de,Se=ae+1,$e=1,Re=Se,Ae=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Re<V.length){Ae.lastIndex=Re,Te.lastIndex=Re;let Ie=Ae.exec(V),_e=Te.exec(V);if(!_e)break;if(Ie&&Ie.index<_e.index)$e++,Re=Ie.index+Ie[0].length;else{if($e--,$e===0){let De=V.substring(Se,_e.index),Ne=_e.index+11;return{start:le,end:Ne,arrayExpr:ge,itemVar:ye,content:De}}Re=_e.index+11}}}return null}function W(V,H){let q=V;while(!0){let Q=z(q);if(!Q)break;let{start:Z,end:ie,arrayExpr:oe,itemVar:ae,content:ce}=Q;try{let de=oe.trim(),le;if(p(de))le=c(de,Object.keys(H))(...Object.values(H));else le=l(de,H);let ge=!1;if(!Array.isArray(le))if(le instanceof Map)le=Array.from(le),ge=!0;else if(le instanceof Set)le=Array.from(le);else if(typeof le==="string")le=Array.from(le);else if(le&&typeof le==="object"&&!(le instanceof Date)&&!(le instanceof RegExp))le=Object.entries(le),ge=!0;else{let _e=hw(de,k)+i("Foreach",`Error in @foreach: ${de} is not iterable`,t.TYPE_ERROR);q=q.substring(0,Z)+_e+q.substring(ie);continue}let ye=R?.loops?.useAltLoopVariable??cw,Se=ae.trim(),$e=null,Re,Ae=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((De)=>De.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((De)=>De.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ae=!0;else Re=Se}else Re=Se;let Te="",Ie=le;for(let _e=0;_e<Ie.length;_e++){let De=Ie[_e],Ne={index:_e,iteration:_e+1,first:_e===0,last:_e===Ie.length-1,count:Ie.length},Oe={...H,loop:Ne,$loop:Ne};if(Re.startsWith("[")&&Re.endsWith("]")){let yt=Re.slice(1,-1).split(",").map((ft)=>ft.trim());if(Array.isArray(De))yt.forEach((ft,st)=>{if(ft)Oe[ft]=De[st]});else Oe[Re]=De}else if(Re.startsWith("{")&&Re.endsWith("}")){let yt=Re.slice(1,-1).split(",").map((ft)=>ft.trim()).filter(Boolean);if(De!==null&&typeof De==="object")yt.forEach((ft)=>{let st=ft.indexOf(":"),pt=(st===-1?ft:ft.slice(0,st)).trim(),lt=st===-1?pt:ft.slice(st+1).trim();if(pt&&lt)Oe[lt]=De[pt]});else Oe[Re]=De}else Oe[Re]=De;if($e)if(!Ae&&ge&&Array.isArray(De)&&De.length===2)Oe[$e]=De[0],Oe[Re]=De[1];else Oe[$e]=_e;let Pe=fw(ce,Oe),Le=qg(Pe);if(Le.hasContinue){Te+=Le.content;continue}let ct=Hg(Pe);if(ct.hasBreak){Te+=ct.content;break}if(Pe=Kg(Pe,Oe),Pe=W(Pe,Oe),Pe=ur(Pe,Oe,k),Pe=pw(Pe),ct=Hg(Pe),ct.hasBreak){Te+=ct.content;break}if(Le=qg(Pe),Le.hasContinue){Te+=Le.content;continue}Pe=K(Pe,Oe,k),Pe=dw(Pe,Oe),Pe=uw(Pe,Oe),Pe=lw(Pe,Oe),Te+=Pe}q=q.substring(0,Z)+Te+q.substring(ie)}catch(de){let le=i("Foreach",`Error in @foreach(${oe.trim()} as ${ae.trim()}): ${de instanceof Error?de.message:String(de)}`,t.EVALUATION_ERROR);q=q.substring(0,Z)+le+q.substring(ie)}}return q}B=W(B,_),B=Jg(B,_,k,R);let F=R?.loops?.maxWhileIterations??aw;return B=vw(B,_,F),T?B:ws(B)}function Oc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function Gg(v){return pr(v)}function Jg(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=W+z[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=Oc(T.slice(F+1,V)),q=V+1,Q=aa(T.slice(W),"for","endfor");if(Q.length===0)break;let Z=Q[0].content,ie=W+Q[0].end;if(!Gg(H)){let oe=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,W)+oe+T.substring(ie),B=!0;continue}try{let oe=xw(H),ae=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(oe.length>0&&ae){let Se=bw({forExpr:H,content:Z,iterVarNames:oe,context:_,filePath:k,options:R});T=T.substring(0,W)+Se+T.substring(ie),B=!0;continue}let ce=Object.keys(_),de=Object.values(_),le=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);le=Xg(le);let ye=Function(...ce,`
2522
+ `,ye=Function(...Z,le)(...ie);if(ye&&typeof ye==="object")Object.assign(_,ye);B=B.replace(V,"")}catch(Q){console.error(`Error executing ${R} code block in ${k}:`,Q);let Z=Q instanceof Error?Q.message:String(Q),ie=g(`${R} Directive`,`Error executing code: ${Z}`,k,v,q,V);console.error(ie),B=B.replace(V,"")}return B}var aw=1000,cw=!1;function lw(v,_){let k=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,R="",T=0,B;while((B=k.exec(v))!==null){let z=B.index+B[0].length,W=B.index+B[0].indexOf("("),F=S(v,"(",")",W);if(F===-1)continue;let V=v.slice(z,F).trim();if(!V)continue;if(!Object.keys(_).some((Q)=>new RegExp(`(?:^|[^\\w$.])${Q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(V)))continue;let q;try{let Q=D(V,_);if(!Q||typeof Q!=="object")continue;q=JSON.stringify(Q)}catch{continue}R+=v.slice(T,z)+q,T=F,k.lastIndex=F}return T===0?v:R+v.slice(T)}function uw(v,_){let k=/@component\s*\(/g,R=v,T,B=[];while((T=k.exec(R))!==null){let z=T.index,W=z+T[0].length-1,F=1,V=W+1;while(V<R.length&&F>0){if(R[V]==="(")F++;else if(R[V]===")"){if(F--,F===0)break}V++}if(F!==0)continue;let H=R.substring(W+1,V),q=V+1,Q=H.match(/^\s*['"]([^'"]+)['"]/);if(!Q)continue;let Z=Q[1],ie=H.slice(Q[0].length),oe=ie.match(/^\s*,\s*/);if(!oe)continue;let ae=ie.slice(oe[0].length).trim();if(!ae)continue;try{let ce=D(ae,_),de=JSON.stringify(ce),le=`@component('${Z}', ${de})`;B.push({start:z,end:q,replacement:le})}catch{continue}}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=B[z];R=R.substring(0,W)+V+R.substring(F)}return R}function $a(v,_,k){let R=v,T=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),B;while((B=T.exec(R))!==null){let z=B.index,W=z+B[0].length-1,F=1,V=W+1,H=null,q=!1;while(V<R.length&&F>0){let ie=R[V];if(q){q=!1,V++;continue}if(ie==="\\"&&H){q=!0,V++;continue}if(H){if(ie===H)H=null;V++;continue}if(ie==='"'||ie==="'"||ie==="`"){H=ie,V++;continue}if(ie==="(")F++;else if(ie===")"){if(F--,F===0)break}V++}if(F!==0)break;let Q=R.substring(W+1,V),Z=k(Q);R=R.substring(0,z)+Z+R.substring(V+1)}return R}function dw(v,_){let k=v;return k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(R,T)=>{if(T in _)return`:${T}="${T}"`;return R}),k=k.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(R,T,B)=>{try{let z=Object.keys(_),W=Object.values(_);zs(B);let V=c(B,z)(...W),H=JSON.stringify(V);if(H===void 0){if(!Ce(B).some((Z)=>!(Z in _)))return"";return R}let q=Buffer.from(H,"utf8").toString("base64");return`__stx_${T}="${q}"`}catch(z){return R}}),k}var _a="<!--__STX_BREAK__-->",ka="<!--__STX_CONTINUE__-->";function fw(v,_){let k=v;return k=$a(k,"@break",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?_a:""}catch{return""}}),k=$a(k,"@continue",(R)=>{try{let B=`!!(${R.trim()})`,z;if(p(B)){let W=c(B,Object.keys(_));z=Boolean(W(...Object.values(_)))}else z=Boolean(l(B,_));return z?ka:""}catch{return""}}),k}function pw(v){let _=v;return _=_.replace(/@break(?!\()/g,_a),_=_.replace(/@continue(?!\()/g,ka),_}function Hg(v){let _=v.includes(_a),k=_?v.substring(0,v.indexOf(_a)):v;return{hasBreak:_,content:k}}function qg(v){let _=v.includes(ka),k=_?v.substring(0,v.indexOf(ka)):v;return{hasContinue:_,content:k}}function Xg(v){let _=v;return _=$a(_,"@break",(k)=>{let R=k.trim();if(!pr(R))return"";return`\`; if (${R}) { break; } result += \``}),_=$a(_,"@continue",(k)=>{let R=k.trim();if(!pr(R))return"";return`\`; if (${R}) { continue; } result += \``}),_=_.replace(/@break(?!\()/g,"`; break; result += `"),_=_.replace(/@continue(?!\()/g,"`; continue; result += `"),_}function gw(v){let _=/@forelse\s*\(/g,k,R=[],T=/@foreach\s*\(/g,B=/@endforeach/g,z;while((z=T.exec(v))!==null)R.push({pos:z.index,delta:1});while((z=B.exec(v))!==null)R.push({pos:z.index,delta:-1});R.sort((H,q)=>H.pos-q.pos);let W=[],F=0;for(let H of R)F+=H.delta,W.push({pos:H.pos,depth:F});function V(H){let q=0,Q=W.length-1,Z=0;while(q<=Q){let ie=q+Q>>1;if(W[ie].pos<=H)Z=W[ie].depth,q=ie+1;else Q=ie-1}return Z}while((k=_.exec(v))!==null){if(V(k.index)>0)continue;let H=k.index,q=k.index+k[0].length-1,Q=1,Z=q+1,ie=-1;while(Z<v.length&&Q>0){if(v[Z]==="(")Q++;else if(v[Z]===")"){if(Q--,Q===0){ie=Z;break}}Z++}if(ie===-1)continue;let oe=v.substring(q+1,ie),ae=Ct(oe);if(!ae)continue;let{arrayExpr:ce,itemVar:de}=ae,le=ie+1,ge=1,ye=le,Se=/@forelse\s*\(/g,$e=/@endforelse/g,Re=-1;while(ge>0&&ye<v.length){Se.lastIndex=ye,$e.lastIndex=ye;let Ne=Se.exec(v),Oe=$e.exec(v);if(!Oe)break;if(Ne&&Ne.index<Oe.index)ge++,ye=Ne.index+Ne[0].length;else{if(ge--,ge===0){Re=Oe.index;break}ye=Oe.index+11}}if(Re===-1)continue;let Ae=v.substring(le,Re),Te=Re+11,Ie=-1,_e=0,De=0;while(De<Ae.length){let Ne=Ae.indexOf("@",De);if(Ne===-1)break;let Oe=Ae.substring(Ne);if(/^@forelse\s*\(/.test(Oe))_e++,De=Ne+1;else if(Oe.startsWith("@endforelse"))_e--,De=Ne+11;else if(_e===0&&Oe.startsWith("@empty")){if(Ae.length<=Ne+6||!/[a-z]/i.test(Ae[Ne+6])){Ie=Ne;break}De=Ne+1}else De=Ne+1}if(Ie===-1)continue;return{start:H,end:Te,arrayExpr:ce,itemVar:de,foreachContent:Ae.substring(0,Ie),emptyContent:Ae.substring(Ie+6)}}return null}function Kg(v,_){let k=v;while(!0){let R=gw(k);if(!R)break;let{start:T,end:B,arrayExpr:z,itemVar:W,foreachContent:F,emptyContent:V}=R;try{let H;if(p(z))H=c(z,Object.keys(_))(...Object.values(_));else H=l(z,_);let q;if(!Array.isArray(H)||H.length===0)q=V;else q=`@foreach (${z} as ${W})${F}@endforeach`;k=k.substring(0,T)+q+k.substring(B)}catch(H){let q=H instanceof Error?H.message:String(H),Q=i("Forelse",`Error in @forelse(${z} as ${W}): ${q}`,t.EVALUATION_ERROR);k=k.substring(0,T)+Q+k.substring(B)}}return k}var Zg="<!--stx:foreach-not-iterable:",mw=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function hw(v,_){return`${Zg}${encodeURIComponent(v)}|${encodeURIComponent(_)}-->`}function yw(v,_){console.warn(`[stx] @foreach(${v}) in ${_}: ${v} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function ws(v){if(!v.includes(Zg))return v;return v.replace(mw,(_,k,R)=>(yw(decodeURIComponent(k),decodeURIComponent(R)),""))}function bi(v,_,k,R,T=!1){let B=v;B=Kg(B,_);function z(V){let H=/@foreach\s*\(/g,q;while((q=H.exec(V))!==null){let Q=q.index,Z=q.index+q[0].length-1,ie=1,oe=Z+1,ae=-1;while(oe<V.length&&ie>0){if(V[oe]==="(")ie++;else if(V[oe]===")"){if(ie--,ie===0){ae=oe;break}}oe++}if(ae===-1)continue;let ce=V.substring(Z+1,ae),de=Ct(ce);if(!de)continue;let le=Q,{arrayExpr:ge,itemVar:ye}=de,Se=ae+1,$e=1,Re=Se,Ae=/@foreach\s*\(/g,Te=/@endforeach/g;while($e>0&&Re<V.length){Ae.lastIndex=Re,Te.lastIndex=Re;let Ie=Ae.exec(V),_e=Te.exec(V);if(!_e)break;if(Ie&&Ie.index<_e.index)$e++,Re=Ie.index+Ie[0].length;else{if($e--,$e===0){let De=V.substring(Se,_e.index),Ne=_e.index+11;return{start:le,end:Ne,arrayExpr:ge,itemVar:ye,content:De}}Re=_e.index+11}}}return null}function W(V,H){let q=V;while(!0){let Q=z(q);if(!Q)break;let{start:Z,end:ie,arrayExpr:oe,itemVar:ae,content:ce}=Q;try{let de=oe.trim(),le;if(p(de))le=c(de,Object.keys(H))(...Object.values(H));else le=l(de,H);let ge=!1;if(!Array.isArray(le))if(le instanceof Map)le=Array.from(le),ge=!0;else if(le instanceof Set)le=Array.from(le);else if(typeof le==="string")le=Array.from(le);else if(le&&typeof le==="object"&&!(le instanceof Date)&&!(le instanceof RegExp))le=Object.entries(le),ge=!0;else{let _e=hw(de,k)+i("Foreach",`Error in @foreach: ${de} is not iterable`,t.TYPE_ERROR);q=q.substring(0,Z)+_e+q.substring(ie);continue}let ye=R?.loops?.useAltLoopVariable??cw,Se=ae.trim(),$e=null,Re,Ae=!1;if(Se.includes("=>")){let _e=Se.split("=>").map((De)=>De.trim());if(_e.length===2&&_e[0]&&_e[1])$e=_e[0],Re=_e[1];else Re=Se}else if(!Se.startsWith("[")&&!Se.startsWith("{")&&Se.includes(",")){let _e=Se.split(",").map((De)=>De.trim());if(_e.length===2&&_e[0]&&_e[1])Re=_e[0],$e=_e[1],Ae=!0;else Re=Se}else Re=Se;let Te="",Ie=le;for(let _e=0;_e<Ie.length;_e++){let De=Ie[_e],Ne={index:_e,iteration:_e+1,first:_e===0,last:_e===Ie.length-1,count:Ie.length},Oe={...H,loop:Ne,$loop:Ne};if(Re.startsWith("[")&&Re.endsWith("]")){let yt=Re.slice(1,-1).split(",").map((ft)=>ft.trim());if(Array.isArray(De))yt.forEach((ft,st)=>{if(ft)Oe[ft]=De[st]});else Oe[Re]=De}else if(Re.startsWith("{")&&Re.endsWith("}")){let yt=Re.slice(1,-1).split(",").map((ft)=>ft.trim()).filter(Boolean);if(De!==null&&typeof De==="object")yt.forEach((ft)=>{let st=ft.indexOf(":"),pt=(st===-1?ft:ft.slice(0,st)).trim(),ut=st===-1?pt:ft.slice(st+1).trim();if(pt&&ut)Oe[ut]=De[pt]});else Oe[Re]=De}else Oe[Re]=De;if($e)if(!Ae&&ge&&Array.isArray(De)&&De.length===2)Oe[$e]=De[0],Oe[Re]=De[1];else Oe[$e]=_e;let Pe=fw(ce,Oe),Le=qg(Pe);if(Le.hasContinue){Te+=Le.content;continue}let ct=Hg(Pe);if(ct.hasBreak){Te+=ct.content;break}if(Pe=Kg(Pe,Oe),Pe=W(Pe,Oe),Pe=ur(Pe,Oe,k),Pe=pw(Pe),ct=Hg(Pe),ct.hasBreak){Te+=ct.content;break}if(Le=qg(Pe),Le.hasContinue){Te+=Le.content;continue}Pe=K(Pe,Oe,k),Pe=dw(Pe,Oe),Pe=uw(Pe,Oe),Pe=lw(Pe,Oe),Te+=Pe}q=q.substring(0,Z)+Te+q.substring(ie)}catch(de){let le=i("Foreach",`Error in @foreach(${oe.trim()} as ${ae.trim()}): ${de instanceof Error?de.message:String(de)}`,t.EVALUATION_ERROR);q=q.substring(0,Z)+le+q.substring(ie)}}return q}B=W(B,_),B=Jg(B,_,k,R);let F=R?.loops?.maxWhileIterations??aw;return B=vw(B,_,F),T?B:ws(B)}function Oc(v){let _=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(v);if(!_||/^(?:const|let|var)$/.test(_[2]))return v;return`${_[1]}let ${v.slice(_[1].length)}`}function Gg(v){return pr(v)}function Jg(v,_,k,R){let T=v,B=!0;while(B){B=!1;let z=T.match(/@for\s*\(/);if(!z||z.index===void 0)break;let W=z.index,F=W+z[0].length-1,V=S(T,"(",")",F);if(V===-1)break;let H=Oc(T.slice(F+1,V)),q=V+1,Q=aa(T.slice(W),"for","endfor");if(Q.length===0)break;let Z=Q[0].content,ie=W+Q[0].end;if(!Gg(H)){let oe=i("For",`Unsafe expression in @for: ${H}`,t.UNSAFE_EXPRESSION);T=T.substring(0,W)+oe+T.substring(ie),B=!0;continue}try{let oe=xw(H),ae=/@(?:for|foreach|if|unless)\s*\(/.test(Z);if(oe.length>0&&ae){let Se=bw({forExpr:H,content:Z,iterVarNames:oe,context:_,filePath:k,options:R});T=T.substring(0,W)+Se+T.substring(ie),B=!0;continue}let ce=Object.keys(_),de=Object.values(_),le=Z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(Se,$e)=>`\${${$e}}`);le=Xg(le);let ye=Function(...ce,`
2523
2523
  let result = '';
2524
2524
  for (${H}) {
2525
2525
  result += \`${le}\`;
@@ -2557,14 +2557,14 @@ ${Gs(z,{...R,start:0,end:R.end-R.start},T)}
2557
2557
  ${_}${v.slice(T)}`;if(v.includes("</head>")){let z=v.indexOf("</head>");return v.slice(0,z)+_+`
2558
2558
  `+v.slice(z)}if(jn(v))return Qr(v,(z)=>`${z}
2559
2559
  ${_}`);return`${_}
2560
- ${v}`}async function Ca(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-2cqbyb8w.js"),{url:B}=await T("runtime",_.debug===!0);return mu(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return mu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-2cqbyb8w.js"),R=await k(_.debug);return mu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function qw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function vm(v){if(v.includes("data-stx-tooltip-runtime")||!qw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Ul()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2560
+ ${v}`}async function Ca(v,_){if(v.includes("data-stx-runtime")||v.includes("window.stx.state")||v.includes("STX Signals Runtime"))return v;if(_.buildMode==="serve"){let{getServeClientAsset:T}=await import("./chunk-mjpewk4r.js"),{url:B}=await T("runtime",_.debug===!0);return mu(v,`<script data-stx-runtime src="${B}"></script>`)}if(_.buildMode==="compile")return mu(v,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:k}=await import("./chunk-mjpewk4r.js"),R=await k(_.debug);return mu(v,`<script data-stx-scoped data-stx-runtime>${R}</script>`)}function qw(v){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(v)}function vm(v){if(v.includes("data-stx-tooltip-runtime")||!qw(v))return v;let _=`<script data-stx-scoped data-stx-tooltip-runtime>${Ul()}</script>`,k=v.lastIndexOf("</body>");if(k===-1)return`${v}
2561
2561
  ${_}`;return`${v.slice(0,k)}${_}
2562
2562
  ${v.slice(k)}`}var Kw=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function Xw(v){return Kw.test(v)||v.includes("__stxRouter)return")||v.includes("__stxRouter=true")}async function J(v,_){if(!v.includes("</body>"))return v;if(Xw(v))return v;let k=_?.router,R="";{let F={};if(k){if(k.container)F.container=k.container;if(k.interceptAllLinks!==void 0)F.interceptAllLinks=k.interceptAllLinks;if(k.progress!==void 0)F.progress=k.progress;if(k.viewTransitions!==void 0)F.viewTransitions=k.viewTransitions;if(k.viewTransitionDuration!==void 0)F.viewTransitionDuration=k.viewTransitionDuration;if(k.viewTransitionEasing!==void 0)F.viewTransitionEasing=k.viewTransitionEasing;if(k.scrollToTop!==void 0)F.scrollToTop=k.scrollToTop;if(k.scrollRestoration!==void 0)F.scrollRestoration=k.scrollRestoration;if(k.prefetch!==void 0)F.prefetch=k.prefetch;if(k.cache!==void 0)F.cache=k.cache;if(k.progressColor!==void 0)F.progressColor=k.progressColor;if(k.progressHeight!==void 0)F.progressHeight=k.progressHeight;if(k.prefetchVisible!==void 0)F.prefetchVisible=k.prefetchVisible;if(k.prefetchVisibleMax!==void 0)F.prefetchVisibleMax=k.prefetchVisibleMax;if(k.keepOpening!==void 0)F.keepOpening=k.keepOpening}try{let V=await ym(_?.pagesDir,_?.root);if(V.length>0)F.ownedRoutes=V}catch{}if(Object.keys(F).length>0)R=`<script>window.__stxRouterConfig=${xm(F)};</script>
2563
- `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-2cqbyb8w.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2563
+ `}let{getCachedRouterScript:T,getServeClientAsset:B}=await import("./chunk-mjpewk4r.js"),z=_?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':_?.buildMode==="serve"?`<script data-stx-router src="${(await B("router")).url}"></script>`:`<script data-stx-router>${await T()}</script>`,W=v.lastIndexOf("</body>");return v.slice(0,W)+R+z+`
2564
2564
  </body>`+v.slice(W+7)}var wm=Symbol.for("stx.lazy-module-promises");function Zw(){let v=globalThis;return v[wm]??=new Map,v[wm]}function mt(v,_){let k=Zw(),R=`${import.meta.url}\x00${v}`,T=k.get(R);if(T)return T;let B=_();return k.set(R,B),B.catch(()=>{if(k.get(R)===B)k.delete(R)}),B}var hu=`(?:"[^"]*"|'[^']*'|[^>"'])*`,Rm=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Gw=65536,Jw=4,Aa=new Map;function nu(){Aa.clear()}function Yw(v){let _=[];for(let k of ee(v,U)){let R=k.token.match(/^<script\b([^>]*)>/i),T=k.token.match(/<\/script\s*>$/i);if(!R||!T)continue;let B=R[0].length,z=k.token.length-T[0].length;_.push(Object.freeze({fullMatch:k.token,attrs:R[1],body:k.token.slice(B,z),start:k.start,end:k.end}))}return _}function kc(v,_={}){let k=v.length>=Gw,R=k?Aa.get(v):void 0;if(R===void 0){if(R=Yw(v),k)od(Aa,Jw),Aa.set(v,R)}let T=_.skipAttrs;if(!T)return R.slice();let B=[];for(let z of R)if(T.lastIndex=0,!T.test(z.attrs))B.push(z);return B}function gs(v){let _=v.trim(),k=_.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(k){let T=k[1].trim(),B=k[2].trim(),{itemVar:z,indexVar:W}=Sm(B);if(z)return{style:"as",iterable:T,itemVar:z,indexVar:W}}let R=_.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(R){let T=R[1].trim(),B=R[2].trim(),{itemVar:z,indexVar:W}=Sm(T);if(z)return{style:"in",iterable:B,itemVar:z,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function Sm(v){let _=v.trim(),k=_.match(/^(\w+)\s*=>\s*(\w+)$/);if(k)return{itemVar:k[2],indexVar:k[1]};let R=_.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(R)return{itemVar:R[1],indexVar:R[2]||null};let T=_.match(/^(\w+)\s*,\s*(\w+)$/);if(T)return{itemVar:T[1],indexVar:T[2]};let B=_.match(/^(\w+)$/);if(B)return{itemVar:B[1],indexVar:null};return{itemVar:null,indexVar:null}}function ms(v,_){return Hi(v,_)}function Qw(v){let _=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,k=0,R;while((R=_.exec(v))!==null){let T=R[1];if(T.startsWith("if"))k++;else if(T==="endif")k--;else if(k===0)return!0}return!1}function Am(v){let _=new Set,k=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,R=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel)\s*(?:<[^>]*>)?\s*\(/g,T;while((T=k.exec(v))!==null){let B=T[1],z;while((z=R.exec(B))!==null)_.add(z[1])}return _}function eS(v){if(!/[:@]for\s*=/.test(v)&&!/\bx-for\s*=/.test(v))return[];let _=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${hu})>`,"iy"),k=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,R=ee(v,(B,z)=>{_.lastIndex=z;let W=_.exec(B);if(!W||W.index!==z||!k.test(W[2]))return-1;return _.lastIndex}),T=[];for(let B of R){_.lastIndex=0;let z=_.exec(B.token);if(!z)continue;let W=z[2].match(k),F=gs(W?.[1]??W?.[2]??""),V=[F.itemVar,F.indexVar].filter(Boolean);if(V.length===0)continue;let H=z[1],Q=/\/\s*>$/.test(B.token)||Ta.has(H.toLowerCase())?B.end:xu(v,B.start,H,B.end);if(Q!==-1)T.push({start:B.start,end:Q,vars:new Set(V)})}return T}var $m=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function tS(v){return v.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function _m(v,_,k,R){if(!v)return!1;let T=tS(v),B=!1,z=!1,W=!1,F=/([a-zA-Z_$][\w$]*)/g,V;while((V=F.exec(T))!==null){let Z=V[1];if(T.slice(0,V.index).trimEnd().endsWith("."))continue;if($m.has(Z))continue;if(_.has(Z)||R?.has(Z))B=!0;else if(k&&Z in k)z=!0}let H=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=H.exec(T))!==null){let Z=q[1];if(T.slice(0,q.index).trimEnd().endsWith("."))continue;if($m.has(Z)||k&&Z in k)continue;W=!0}return(B||W)&&!z}function Ra(v,_,k){let R=k===void 0?` ${_}`:` ${_}="${k.replace(/"/g,"&quot;")}"`,T=v.trim(),B=T.match(Rm);if(B&&nS(B[3],B[1])){let[,z,W,F]=B;return`<${z}${W}${R}>${F}</${z}>`}return`<template${R}>${T}</template>`}function nS(v,_){let k=new RegExp(`<(/)?${_}(?=[\\s/>])`,"gi"),R=0,T;while((T=k.exec(v))!==null)if(T[1]){if(R--,R<0)return!1}else R++;return!0}function pi(v,_){let k=Am(v);function R(T){let B=T,z=eS(T),W=(q)=>{let Q=new Set;for(let Z of z)if(q>Z.start&&q<Z.end)for(let ie of Z.vars)Q.add(ie);return Q},F=/@if\s*\(/g,V,H=[];while((V=F.exec(B))!==null){let q=V.index,Q=q+V[0].length,Z=1,ie=Q;while(ie<B.length&&Z>0){if(B[ie]==="(")Z++;else if(B[ie]===")")Z--;ie++}if(Z!==0)continue;let oe=B.substring(Q,ie-1).trim(),ae=ie,ce=1,de=ae,le=/@(if\s*\(|endif)/g;le.lastIndex=ae;let ge;while((ge=le.exec(B))!==null)if(ge[1].startsWith("if"))ce++;else if(ge[1]==="endif"){if(ce--,ce===0){de=ge.index+ge[0].length;break}}if(ce!==0)continue;let ye=B.substring(ae,de-6).trim(),Se;if(Qw(ye)){let $e=Yi(B.substring(q,de));if($e.length===0)continue;let Re=$e[0].branches.filter((_e)=>_e.type!=="else"),Ae=W(q);if(!(Re.length>0&&Re.every((_e)=>_m(_e.condition,k,_,Ae))))continue;Se=$e[0].branches.map((_e)=>{let De=R(_e.content);if(_e.type==="elseif")return Ra(De,"@else-if",_e.condition??"");if(_e.type==="else")return Ra(De,"@else");return Ra(De,"@if",_e.condition??"")}).join(`
2565
2565
  `)}else{if(!_m(oe,k,_,W(q)))continue;Se=Ra(R(ye),"@if",oe)}H.push({start:q,end:de,replacement:Se}),F.lastIndex=de}for(let q=H.length-1;q>=0;q--){let{start:Q,end:Z,replacement:ie}=H[q];B=B.substring(0,Q)+ie+B.substring(Z)}return B}return R(v)}function rS(v){let _=v.trim();if(_==="")return;if(_==="true")return!0;if(_==="false")return!1;if(_==="null")return!1;if(_==="undefined")return!1;if(_==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(_)){let T=Number(_);return T!==0&&!Number.isNaN(T)}let k=_.match(/^'((?:\\.|[^'\\])*)'$/);if(k)return k[1].length>0;let R=_.match(/^"((?:\\.|[^"\\])*)"$/);if(R)return R[1].length>0;return}var Ta=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),km=/<(script|style)\b/iy,sS=/<\/script/gi,iS=/<\/style/gi;function xu(v,_,k,R){if(Ta.has(k.toLowerCase()))return R;let T=k.toLowerCase(),B=v.length,z=1,W=R;while(W<B){let F=v.indexOf("<",W);if(F===-1)return-1;if(W=F,v.startsWith("<!--",W)){let Q=v.indexOf("-->",W+4);if(Q===-1)return-1;W=Q+3;continue}km.lastIndex=W;let V=km.exec(v);if(V){let Q=v.indexOf(">",W);if(Q===-1)return-1;if(v[Q-1]==="/"){W=Q+1;continue}let Z=V[1].toLowerCase()==="script"?sS:iS;Z.lastIndex=W;let ie=Z.exec(v);if(ie===null)return-1;let oe=v.indexOf(">",ie.index);if(oe===-1)return-1;W=oe+1;continue}if(v[W+1]==="/"){let Q=/^<\/([a-z][\w-]*)\s*>/i.exec(v.slice(W,W+64));if(!Q){W++;continue}if(Q[1].toLowerCase()===T){if(z--,W+=Q[0].length,z===0)return W;continue}W+=Q[0].length;continue}let H=/^<([a-z][\w-]*)\b/i.exec(v.slice(W,W+64));if(!H){W++;continue}let q=v.indexOf(">",W);if(q===-1)return-1;if(H[1].toLowerCase()===T){let Q=v.slice(W,q+1);if(!(/\/\s*>$/.test(Q)||Ta.has(T)))z++}W=q+1}return-1}var oS=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function aS(v,_){let k=_,R=v.length;for(;;){while(k<R&&v[k]!=="<")k++;if(k>=R)return!1;if(v.startsWith("<!--",k)){let z=v.indexOf("-->",k+4);if(z===-1)return!1;k=z+3;continue}break}if(v[k+1]==="/")return!1;let T=v.indexOf(">",k);if(T===-1)return!1;let B=v.slice(k,T+1);return oS.test(B)}function fi(v){if(!v.includes(":if")&&!v.includes(":show")&&!v.includes("x-if")&&!v.includes("x-show")&&!v.includes("@if=")&&!v.includes("@show="))return v;let _=[],k=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,R;while((R=k.exec(v))!==null)_.push([R.index,R.index+R[0].length]);let T=(q)=>_.some(([Q,Z])=>q>=Q&&q<Z),B=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,z=[],W;while((W=B.exec(v))!==null){if(T(W.index))continue;let[q,Q,Z,ie,oe,ae,ce]=W,de=rS(oe);if(de===void 0)continue;let le=W.index,ge=le+q.length,$e=!!ce||/\/\s*>$/.test(q)||Ta.has(Q.toLowerCase())?ge:xu(v,le,Q,ge);if($e===-1)continue;if((ie===":if"||ie==="x-if"||ie==="@if")&&aS(v,$e)){B.lastIndex=ge;continue}if(de===!0){let Ae=`<${Q}${Z}${ae}${ce}>`;z.push({start:le,end:ge,replacement:Ae});continue}z.push({start:le,end:$e,replacement:""}),B.lastIndex=$e}if(z.length===0)return v;z.sort((q,Q)=>q.start-Q.start);let F=[],V=-1;for(let q of z){if(q.start<V)continue;F.push(q),V=q.end}let H=v;for(let q=F.length-1;q>=0;q--){let{start:Q,end:Z,replacement:ie}=F[q];H=H.substring(0,Q)+ie+H.substring(Z)}return H}var Em=[":for","@for","x-for"];function hs(v,_){if(!_||Object.keys(_).length===0)return v;if(!Em.some((W)=>v.includes(`${W}=`)))return v;let k=Am(v);if(Array.isArray(_.__stx_client_signal_names)){for(let W of _.__stx_client_signal_names)if(typeof W==="string")k.add(W)}let R=v,T=[],B=/<([a-zA-Z][\w-]*)((?:[^>"']|"[^"]*"|'[^']*')*)>/g,z;while((z=B.exec(R))!==null){let[W,F,V]=z,H=z.index,q=H+W.length,Q=Em.map((Se)=>({attr:Se,m:new RegExp(`\\s${Se}="([^"]*)"`).exec(V)})).find((Se)=>Se.m!==null);if(!Q||!Q.m)continue;let Z=gs(Q.m[1]);if(!Z.iterable||!Z.itemVar)continue;let ie=Z.iterable.trim().split(/[.[(]/)[0].trim();if(!ie||k.has(ie)||!(ie in _))continue;let oe=xu(R,H,F,q);if(oe===-1)continue;let ae=V.replace(new RegExp(`\\s${Q.attr}="[^"]*"`),"").replace(/\s:key="[^"]*"/,"").replace(/\sx-cloak(?=\s|$)/,""),ce=R.slice(q,oe-`</${F}>`.length),de={..._,[Z.itemVar]:void 0};if(Z.indexVar)de[Z.indexVar]=void 0;let le=hs(ce,de),ge=Z.indexVar?`${Z.iterable} as ${Z.indexVar} => ${Z.itemVar}`:`${Z.iterable} as ${Z.itemVar}`,ye=F.toLowerCase()==="template"?le:`<${F}${ae}>${le}</${F}>`;T.push({start:H,end:oe,replacement:`@foreach(${ge})${ye}@endforeach`}),B.lastIndex=oe}for(let W=T.length-1;W>=0;W--){let{start:F,end:V,replacement:H}=T[W];R=R.slice(0,F)+H+R.slice(V)}return R}function ys(v,_){let k=v,R=/@(for|foreach)\s*\(/g,T,B=[],z=[];while((T=R.exec(k))!==null){let W=T[1],F=T.index,V=F+T[0].length,H=1,q=V;while(q<k.length&&H>0){if(k[q]==="(")H++;else if(k[q]===")")H--;q++}if(H!==0)continue;let Q=k.substring(V,q-1).trim(),Z=q,ie=gs(Q),oe=W==="for"?"@endfor":"@endforeach",ae=1,ce=Z,de=W==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${W}\\s*\\(|end${W})`,"g");de.lastIndex=Z;let le;while((le=de.exec(k))!==null)if(le[1].startsWith(W))ae++;else if(ae--,ae===0){ce=le.index+le[0].length;break}if(ae!==0)continue;let ge=()=>{let Te=[ie.itemVar,ie.indexVar].filter(Boolean);if(Te.length)z.push({start:F,end:ce,vars:Te})};if(ie.iterable){let Te=ie.iterable.trim();if(Te.startsWith("[")||Te.startsWith("{")||Te.startsWith("'")||Te.startsWith('"')||Te.startsWith("`")||/^-?\d/.test(Te)){ge();continue}let Ie=Te.split(/[.[(]/)[0].trim(),_e=_?Ie in _:!1,De=z.some((Ne)=>F>Ne.start&&F<Ne.end&&Ne.vars.includes(Ie));if(Ie&&(_e||De)){ge();continue}}if(ie.style==="as")Q=ie.indexVar?`(${ie.itemVar}, ${ie.indexVar}) in ${ie.iterable}`:`${ie.itemVar} in ${ie.iterable}`;let ye=k.substring(Z,ce-oe.length).trim(),Se=_?{..._}:{};if(ie.itemVar)delete Se[ie.itemVar];if(ie.indexVar)delete Se[ie.indexVar];let $e=ys(ye,Se),Re=$e.match(Rm),Ae;if(Re){let[,Te,Ie,_e]=Re;Ae=`<${Te}${Ie} @for="${Q}">${_e}</${Te}>`}else Ae=`<template @for="${Q}">${$e}</template>`;B.push({start:F,end:ce,replacement:Ae}),R.lastIndex=ce}for(let W=B.length-1;W>=0;W--){let{start:F,end:V,replacement:H}=B[W];k=k.substring(0,F)+H+k.substring(V)}return k}function cS(v){let _=new Set,k=[],R=0,T=0,B=v.length,z=(H)=>{let q=R+1;while(q<B){let Q=v[q];if(Q==="\\"){q+=2;continue}if(Q===H)return q+1;q++}return B},W=()=>{let H=R+2;while(H<B&&v[H]!==`
2566
2566
  `)H++;return H},F=()=>{let H=R+2;while(H<B-1){if(v[H]==="*"&&v[H+1]==="/")return H+2;H++}return B},V=(H)=>{let q=H,Q=0;while(q<B){let Z=v[q];if(Z==="/"&&v[q+1]==="/"){let ie=q+2;while(ie<B&&v[ie]!==`
2567
- `)ie++;q=ie;continue}if(Z==="/"&&v[q+1]==="*"){let ie=q+2;while(ie<B-1&&!(v[ie]==="*"&&v[ie+1]==="/"))ie++;q=ie+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let ie=q+1;while(ie<B){if(v[ie]==="\\"){ie+=2;continue}if(v[ie]===Z){ie++;break}ie++}q=ie;continue}if(Z==="("||Z==="["||Z==="{"){Q++,q++;continue}if(Z===")"||Z==="]"||Z==="}"){Q--,q++;continue}if(Z===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let Z=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Z){let ie=Z[2],oe=V(R+Z[0].length);if(_.has(ie)){k.push(`/* stx: deduped const ${ie} */`),R=oe;continue}_.add(ie),k.push(v.slice(R,oe)),R=oe;continue}}}k.push(H),R++}return k.join("")}var lS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function yu(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function uS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!yu(T,T+_.length,k))return!0;R=T+_.length}return!1}function dS(v,_){if(uS(v,"<body",_)){let T=new RegExp(`<body(${hu})>`,"g"),B;while((B=T.exec(v))!==null)if(!yu(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${hu})>`,"gi"),R;while((R=k.exec(v))!==null){if(yu(R.index,R.index+R[0].length,_))continue;if(lS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function fS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(V)=>{if(k!==null&&!W&&k>=z&&k<=V)T.push(v.slice(z,k),B,v.slice(k,V)),W=!0;else T.push(v.slice(z,V))};for(let V of _){if(V.start<z)continue;F(V.start),z=V.end}return F(v.length),T.join("")}async function Jn(v,_,k,R={}){let T=kc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await mt("stx/client-script-bundler",()=>import("./chunk-m6mxqepz.js"));for(let le of T){let ge=le.body;if(Ge(le.attrs))ge=Xe(ge);if(R.forceClientSetup||B.test(ge)){z.push({content:ge,start:le.start,end:le.end});continue}if(!W(ge))continue;try{let ye=await F(kt(ge).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(ye))z.push({content:ge,start:le.start,end:le.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${z.map((le)=>le.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,q=[];for(let le=0;le<z.length;le++){let ge=z[le].bundled??kt(z[le].content).code;if(!z[le].bundled&&W(ge))ge=await F(ge,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});ge=qe(ge);let ye=O(ge);q.push(`// \u2500\u2500 merged signal script #${le+1} \u2500\u2500
2567
+ `)ie++;q=ie;continue}if(Z==="/"&&v[q+1]==="*"){let ie=q+2;while(ie<B-1&&!(v[ie]==="*"&&v[ie+1]==="/"))ie++;q=ie+2;continue}if(Z==='"'||Z==="'"||Z==="`"){let ie=q+1;while(ie<B){if(v[ie]==="\\"){ie+=2;continue}if(v[ie]===Z){ie++;break}ie++}q=ie;continue}if(Z==="("||Z==="["||Z==="{"){Q++,q++;continue}if(Z===")"||Z==="]"||Z==="}"){Q--,q++;continue}if(Z===";"&&Q===0)return q+1;q++}return B};while(R<B){let H=v[R];if(H==="/"&&v[R+1]==="/"){let q=W();k.push(v.slice(R,q)),R=q;continue}if(H==="/"&&v[R+1]==="*"){let q=F();k.push(v.slice(R,q)),R=q;continue}if(H==='"'||H==="'"||H==="`"){let q=z(H);k.push(v.slice(R,q)),R=q;continue}if(H==="{"){T++,k.push(H),R++;continue}if(H==="}"){T--,k.push(H),R++;continue}if(T===0){let q=R>0?v[R-1]:"";if(q===""||/\s/.test(q)||q===";"||q==="}"||q==="{"){let Z=v.slice(R).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(Z){let ie=Z[2],oe=V(R+Z[0].length);if(_.has(ie)){k.push(`/* stx: deduped const ${ie} */`),R=oe;continue}_.add(ie),k.push(v.slice(R,oe)),R=oe;continue}}}k.push(H),R++}return k.join("")}var lS=new Set(["script","style","html","head","meta","link","title","!doctype"]);function yu(v,_,k){for(let R of k){if(R.start>=_)return!1;if(R.end>v)return!0}return!1}function uS(v,_,k){let R=0;while(R<v.length){let T=v.indexOf(_,R);if(T===-1)return!1;if(!yu(T,T+_.length,k))return!0;R=T+_.length}return!1}function dS(v,_){if(uS(v,"<body",_)){let T=new RegExp(`<body(${hu})>`,"g"),B;while((B=T.exec(v))!==null)if(!yu(B.index,B.index+B[0].length,_))return B.index+B[0].length-1;return null}let k=new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${hu})>`,"gi"),R;while((R=k.exec(v))!==null){if(yu(R.index,R.index+R[0].length,_))continue;if(lS.has(R[1].toLowerCase()))continue;return R.index+R[0].length-1}return null}function fS(v,_,k,R){let T=[],B=` data-stx="${R}"`,z=0,W=!1,F=(V)=>{if(k!==null&&!W&&k>=z&&k<=V)T.push(v.slice(z,k),B,v.slice(k,V)),W=!0;else T.push(v.slice(z,V))};for(let V of _){if(V.start<z)continue;F(V.start),z=V.end}return F(v.length),T.join("")}async function Jn(v,_,k,R={}){let T=kc(v,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),B=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|keptState|useCookie|useId|useModel|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,z=[],{hasUserImports:W,bundleClientScript:F}=await mt("stx/client-script-bundler",()=>import("./chunk-1btr5tme.js"));for(let le of T){let ge=le.body;if(Ge(le.attrs))ge=Xe(ge);if(R.forceClientSetup||B.test(ge)){z.push({content:ge,start:le.start,end:le.end});continue}if(!W(ge))continue;try{let ye=await F(kt(ge).code,_||"",{projectRoot:process.cwd(),externalizeUserModules:!1});if(B.test(ye))z.push({content:ge,start:le.start,end:le.end})}catch{}}if(z.length===0)return{output:v,setupCode:null};let V=`${_??""}\x00${z.map((le)=>le.content).join("\x00")}`,H=`__stx_setup_${Bun.hash(V).toString(36).slice(0,10)}`,q=[];for(let le=0;le<z.length;le++){let ge=z[le].bundled??kt(z[le].content).code;if(!z[le].bundled&&W(ge))ge=await F(ge,_||"",{projectRoot:process.cwd(),externalizeUserModules:R.forceClientSetup?!1:void 0});ge=qe(ge);let ye=O(ge);q.push(`// \u2500\u2500 merged signal script #${le+1} \u2500\u2500
2568
2568
  ${ye}`)}let Q=q.join(`
2569
2569
 
2570
2570
  `);Q=cS(Q);let Z=Cc(Q),ie=Z.split(",").map((le)=>le.trim()).filter(Boolean),oe=rs(Q,k),ae=`
@@ -2602,13 +2602,13 @@ ${V.join(`
2602
2602
  Tip: prefer useRef(), navigate(), and composables for component code`;if(vu.set(B,Z),T.failOnViolation)throw Error(Z);else console.warn(Z)}import wu from"path";var CS=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,RS=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function AS(v,_){if(!_||!v.includes("/"))return v;let k=wu.dirname(_);return v.replace(CS,(R,T,B,z)=>{let W=wu.resolve(k,z);return`${T}${B}${W.split(wu.sep).join("/")}${B}`})}function Um(v,_){if(!_||!v.includes("<script"))return v;return v.replace(RS,(k,R,T,B)=>`${R}${AS(T,_)}${B}`)}var Br="<!--PARENT_CONTENT_PLACEHOLDER-->";function Hm(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ym(v,_){let k=v.length,R=_,T=!0,B=[],z=(W)=>W+9<=k&&v[W]==="<"&&v[W+1]==="/"&&(v[W+2]==="s"||v[W+2]==="S")&&(v[W+3]==="c"||v[W+3]==="C")&&(v[W+4]==="r"||v[W+4]==="R")&&(v[W+5]==="i"||v[W+5]==="I")&&(v[W+6]==="p"||v[W+6]==="P")&&(v[W+7]==="t"||v[W+7]==="T")&&(v[W+8]===">"||/\s/.test(v[W+8]));while(R<k){let W=v[R];if(z(R))return R;if(W==="/"&&v[R+1]==="/"){if(R=v.indexOf(`
2603
2603
  `,R+2),R===-1)return-1;R+=1,T=!0;continue}if(W==="/"&&v[R+1]==="*"){let F=v.indexOf("*/",R+2);if(F===-1)return-1;R=F+2,T=!0;continue}if(W==="/"&&T){let F=R+1,V=!1;while(F<k){let H=v[F];if(H==="\\"){F+=2;continue}if(H==="[")V=!0;else if(H==="]")V=!1;else if(H==="/"&&!V){F++;break}else if(H===`
2604
2604
  `){F=-1;break}F++}if(F===-1){R++,T=!1;continue}while(F<k&&/[a-z]/.test(v[F]))F++;R=F,T=!1;continue}if(W==="'"||W==='"'){let F=W;R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]===F){R++;break}if(v[R]===`
2605
- `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function Qm(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var IS=4096;async function qm(v,_,k){if(k.buildMode!=="serve"||_.length<IS)return null;let{registerServeModuleBundle:R}=await import("./chunk-2cqbyb8w.js");return`<script ${v} src="${R(_)}"></script>`}async function Km(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await mt("stx/client-module-registry",()=>import("./chunk-pqcvh9pp.js")),B=[],z=await T(R(...v),{minify:Hs(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-2cqbyb8w.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function PS(v,_=""){let k=Qm(v,"data-stx-runtime");if(!k)return v;let R=Ki(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2605
+ `)break;R++}T=!1;continue}if(W==="`"){R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}if(B.length===0)T=!1;continue}if(W==="}"&&B.length>0){B.pop(),R++;while(R<k){if(v[R]==="\\"){R+=2;continue}if(v[R]==="`"){R++,T=!1;break}if(v[R]==="$"&&v[R+1]==="{"){B.push(!0),R+=2,T=!0;break}R++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))T=!1;else T=!0;R++}return-1}function Qm(v,_){let k=_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`<script\\b(?=[^>]*\\b${k}(?:\\s|=|/?>))[^>]*>`,"i").exec(v);if(!R)return null;let T=R.index+R[0].length,B=v.indexOf("</script>",T);if(B===-1)return null;let z=v.indexOf(">",B);if(z===-1)return null;return{start:R.index,end:z+1}}var IS=4096;async function qm(v,_,k){if(k.buildMode!=="serve"||_.length<IS)return null;let{registerServeModuleBundle:R}=await import("./chunk-mjpewk4r.js");return`<script ${v} src="${R(_)}"></script>`}async function Km(v,_,k){try{let{registeredModuleIdsIn:R,buildModuleRegistryScript:T}=await mt("stx/client-module-registry",()=>import("./chunk-amtrg7pn.js")),B=[],z=await T(R(...v),{minify:Hs(_.buildMode),collectInputs:B});for(let W of B)k?.add(W);if(!z)return null;if(_.buildMode==="serve"){let{registerServeModuleBundle:W}=await import("./chunk-mjpewk4r.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${W(z)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${z.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function PS(v,_=""){let k=Qm(v,"data-stx-runtime");if(!k)return v;let R=Ki(v);if(R===-1||R===k.start){if(!_)return v;return v.slice(0,k.end)+_+v.slice(k.end)}if(R<k.start)return v.slice(0,R)+v.slice(k.start,k.end)+_+`
2606
2606
  `+v.slice(R,k.start)+v.slice(k.end);let T=v.slice(k.start,k.end),B=v.slice(0,k.start)+v.slice(k.end),z=Ki(B);if(z===-1)return T+_+`
2607
2607
  `+B;return B.slice(0,z)+T+_+`
2608
2608
  `+B.slice(z)}function DS(v){let _=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return v.replace(_,(k,R,T)=>{let B=v.slice(0,T);return B.lastIndexOf("<")>B.lastIndexOf(">")?`{{${R}}}`:`{<!--stx-literal-->{${R}}}`})}async function n(v,_,k,R,T){if(R.ssr===!1&&!R.autoShell&&R.buildMode==="spa")return v;if(_.__stx_signals_gate===void 0)_.__stx_signals_gate=we(v,k);let B=!_.__stxProcessingDepth;dn(_);for(let z of R._layerGraph?.configDependencies??[])T.add(z);if(B&&R.runtimeConfig)await fn(_,k,R.runtimeConfig);if(B)qu(_),_.__stx_scope_seq??={n:0,key:Bun.hash(String(_.__filename??k)).toString(36).slice(0,6)},_.__stx_head_injections=Ls(),_.__stx_seo_staged=!1;if(!_.__stxProcessingDepth)_.__stxProcessingDepth=0;if(_.__stxProcessingDepth++,!_.__onceStore)_.__onceStore=new Set;if((R.debug||!E()&&!Sn())&&k&&k.endsWith(".stx"))Xs(v,k);try{return await G.timeAsync("template-processing",async()=>{let z=await MS(v,_,k,R,T);if(B)z=bu(z);if(B&&R.autoShell&&R.buildMode!=="compile"){let W=me(R.app?.head,{known:wn,source:"app.head"}),V=(_.__stx_runtime_head||null)??Bs(),H=(_.__stx_head_raw||"").trim(),q,Q=H.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(Q)q=Q[1].trim(),H=H.replace(Q[0],"").trim();let Z=_.__sections?.title,ie=V.title||q||Z,oe=!V.title&&(!!q||!!Z),ae=V.meta||[],ce=new Set(ae.map(($e)=>ke($e)).filter(Boolean)),de={...W,...ie&&{title:ie},meta:[...(W.meta||[]).filter(($e)=>!ce.has(ke($e))),...ae],link:[...W.link||[],...V.link||[]],script:[...W.script||[],...V.script||[]],headRaw:[W.headRaw,H].filter(Boolean).join(`
2609
2609
  `),...V.htmlAttrs&&{htmlAttrs:Mi(W.htmlAttrs,V.htmlAttrs)},...V.bodyAttrs&&{bodyAttrs:{...W.bodyAttrs||{},...V.bodyAttrs}}},le=js(z);if(z=yn(z,de,{...oe&&{titleIsHtml:!0},...R.app?.colorMode&&{colorMode:R.app.colorMode}},le),le)z=Li(z,W),z=hn(z,de.htmlAttrs);let ge=z.match(/<!-- stx-layout: ([^ ]+) -->/);if(ge&&z.includes("<head")){let $e=ge[1],Re=yr($e);z=z.replace(/<head\b[^>]*>/i,(Ae)=>`${Ae}
2610
2610
  <meta name="stx-layout" content="${Hm($e)}">
2611
- <meta name="stx-layout-group" content="${Hm(Re)}">`)}let ye=z.match(/function (__stx_setup_\w+)\(/),Se=ye?jn(z):null;if(ye&&Se&&!/\bdata-stx=/.test(Se.tag)){z=Qr(z,(Re,Ae)=>`<body${Ae} data-stx="${ye[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ye[1]}"`,"i");z=z.replace($e,"$1")}}if(B){let W=_.__stx_head_injections??Ls(),F=Ni(z);if(F!==null)W.beforeClose.push(F);let V=um(z);if(V!==null)W.afterOpen.push(V);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push(dm);z=Oi(z,W);let H=R.app?.colorMode;if(H)z=mn(z,H)}if(B)if(Qm(z,"data-stx-runtime")){let F=null,V=null,H=null,q=null,Q=null;try{let{getStoreScript:ie}=await mt("stx/store-loader",()=>import("./chunk-49gwmcrn.js")),oe=R.storesDir,ae=await ie(oe);if(ae)H=`<script data-stx-stores>${ae}</script>`,V=await qm("data-stx-stores",ae,R)??H}catch{}F=await Km([z,H],R,T);try{let{getFrameworkComposableScript:ie}=await mt("stx/framework-composables",()=>import("./chunk-xckzvbvn.js"));Q=await ie(z)}catch{}try{let{getComposableScript:ie}=await mt("stx/composable-loader",()=>import("./chunk-bm2q1srp.js")),oe=R.composablesDir,ae=[F,H,Q].filter((de)=>de!==null),ce=await ie(R._layerComposableDirs??oe,z,ae);if(ce)q=await qm('data-stx-scoped data-stx-run="always" data-stx-composables',ce,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ce}</script>`}catch{}let Z=[F,V,q,Q].filter((ie)=>ie!==null).map((ie)=>`
2611
+ <meta name="stx-layout-group" content="${Hm(Re)}">`)}let ye=z.match(/function (__stx_setup_\w+)\(/),Se=ye?jn(z):null;if(ye&&Se&&!/\bdata-stx=/.test(Se.tag)){z=Qr(z,(Re,Ae)=>`<body${Ae} data-stx="${ye[1]}">`);let $e=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${ye[1]}"`,"i");z=z.replace($e,"$1")}}if(B){let W=_.__stx_head_injections??Ls(),F=Ni(z);if(F!==null)W.beforeClose.push(F);let V=um(z);if(V!==null)W.afterOpen.push(V);if(R.offline?.enabled&&!z.includes("data-stx-offline"))W.beforeClose.push(dm);z=Oi(z,W);let H=R.app?.colorMode;if(H)z=mn(z,H)}if(B)if(Qm(z,"data-stx-runtime")){let F=null,V=null,H=null,q=null,Q=null;try{let{getStoreScript:ie}=await mt("stx/store-loader",()=>import("./chunk-zpz6q2fh.js")),oe=R.storesDir,ae=await ie(oe);if(ae)H=`<script data-stx-stores>${ae}</script>`,V=await qm("data-stx-stores",ae,R)??H}catch{}F=await Km([z,H],R,T);try{let{getFrameworkComposableScript:ie}=await mt("stx/framework-composables",()=>import("./chunk-4f0fh2a9.js"));Q=await ie(z)}catch{}try{let{getComposableScript:ie}=await mt("stx/composable-loader",()=>import("./chunk-557wtdps.js")),oe=R.composablesDir,ae=[F,H,Q].filter((de)=>de!==null),ce=await ie(R._layerComposableDirs??oe,z,ae);if(ce)q=await qm('data-stx-scoped data-stx-run="always" data-stx-composables',ce,R)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${ce}</script>`}catch{}let Z=[F,V,q,Q].filter((ie)=>ie!==null).map((ie)=>`
2612
2612
  ${ie}`).join("");z=PS(z,Z)}else{let F=await Km([z],R,T);if(F){let V=z.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(V!==-1)z=z.slice(0,V)+F+`
2613
2613
  `+z.slice(V)}}if(B)z=Di(z);if(B&&_.__stx_inject_css!==!1)z=await f(z,void 0,R.buildMode==="serve",!0);else if(B)z=ji(z);if(z=z.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),z=DS(z),B&&_.__stx_runtime_config)z=Ye(z,_.__stx_runtime_config);if(B&&!_.__stx_defer_server_data){let W=Yn(_);if(W){let F=/<head\b[^>]*>/i.exec(z),V=F?F.index+F[0].length:0;z=z.slice(0,V)+W+z.slice(V)}}return z})}catch(z){if(z instanceof dr)throw z;let W=z instanceof Error?z.message:String(z),F=new Y(`Template processing failed: ${W}`,k,void 0,void 0,v.substring(0,200)+(v.length>200?"...":""));if(I.log(F,{filePath:k,context:_}),It.logDetailedError(F,{filePath:k,template:v.substring(0,500)}),R.debug)throw F;return Fs.createFallbackContent("Template Processing",F)}}async function MS(v,_,k,R,T){let B=process.cwd(),z={...R,partialsDir:R.partialsDir&&!en.isAbsolute(R.partialsDir)?en.resolve(B,R.partialsDir):R.partialsDir,componentsDir:R.componentsDir&&!en.isAbsolute(R.componentsDir)?en.resolve(B,R.componentsDir):R.componentsDir,layoutsDir:R.layoutsDir&&!en.isAbsolute(R.layoutsDir)?en.resolve(B,R.layoutsDir):R.layoutsDir},W=z,F=v;await jS(k,_),NS(_,W),F=await se(()=>em(F,_,k,W),F,(ye)=>{I.log(ye,{filePath:k,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${k}: ${ye.message}`)}),F=F.replace(/\{\{--[\s\S]*?--\}\}/g,"");let V=Dn(F,ze,(ye,Se)=>`\x00STX_HTML_COMMENT_${Se}\x00`);F=V.output;let H=V.tokens,q=(ye)=>H.length===0?ye:ye.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(Se,$e)=>H[Number($e)]??""),Q="\x00STX_ESCAPED_AT\x00",Z="\x00STX_ESC_MUSTACHE_OPEN\x00",ie="\x00STX_ESC_MUSTACHE_CLOSE\x00";F=F.replace(/@@/g,Q),F=F.replace(/@\{\{([\s\S]*?)\}\}/g,(ye,Se)=>`${Z}${Se}${ie}`),F=im(F),F=await Dm(F,k,T);let oe={};F=xs(F,oe);let ae={..._.__sections||{}},ce="",de=Lf(He(v)),le=/@nolayout\b/.test(F)||de===!1;if(/@nolayout\b/.test(F))F=F.replace(/@nolayout\b\s*/g,"");let ge=F.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(ge)ce=ge[1],F=F.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof de==="string"){if(ce=de,!/@section\s*\(/.test(F))F=`@section('content')
2614
2614
  ${F.trim()}
@@ -2617,31 +2617,31 @@ ${F.trim()}
2617
2617
  @endsection`}}if(ce&&F.includes("<script")){let ye=$n(F),Se=ye.scripts.map(($e)=>Xm($e,k)??$e);F=Zr(ye.output,Se)}if(F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(ye,Se,$e)=>(ae[Se]=$e,"")),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(ye,Se,$e)=>{if(/^(['"]).*\1$/.test($e.trim()))return ye;try{let Re=l($e.trim(),_);if(Re===void 0)return ye;return ae[Se]=String(Re??""),""}catch{return ye}}),F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(ye,Se,$e)=>{if($e.includes("@parent"))ae[Se]=$e.replace("@parent",Br);else ae[Se]=$e.trim();return""}),_.__sections=ae,F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(ye,Se,$e)=>ae[Se]||$e||""),!("slot"in _)||_.slot===void 0)F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>ae.content||"");if(F=Ss(F,oe),ce){let ye=[],Se=$n(F),$e=Dn(Se.output,Xr,(Re,Ae)=>`\x00STX_ORPHAN_STYLE_${Ae}\x00`);if(F=$e.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(Re,Ae,Te)=>{let Ie=Ae==="SCRIPT"?Xm(Se.scripts[Number(Te)],k):$e.tokens[Number(Te)];if(Ie)ye.push(Ie);return""}),ye.length>0){let Re=ye.join(`
2618
2618
  `);ae.content=ae.content?`${ae.content}
2619
2619
  ${Re}`:Re,_.__sections=ae}}if(ce)try{let ye;if(en.isAbsolute(ce))ye=ce,T.add(ce);else ye=await se(()=>Qn(ce,k,z,T),null,()=>{throw new Y(`Failed to resolve layout path: ${ce}`,k,void 0,void 0,`Layout referenced from ${k}`)});if(!ye){let Ie=(Ne)=>{if(!Ne)return[];try{let Oe=en.isAbsolute(Ne)?Ne:en.resolve(process.cwd(),Ne);return TS.readdirSync(Oe).filter((Pe)=>Pe.endsWith(".stx")).map((Pe)=>Pe.replace(/\.stx$/,""))}catch{return[]}},_e=[...Ie(z.layoutsDir),...Ie(z.fallbackLayoutsDir)].filter((Ne,Oe,Pe)=>Pe.indexOf(Ne)===Oe).sort(),De=`Layout not found: ${ce} (referenced from ${k})`+(_e.length>0?`. Available layouts: ${_e.join(", ")}`:z.layoutsDir?`. No .stx layouts found in ${z.layoutsDir}`:"");if(I.log(Error(De),{layoutPath:ce,filePath:k,available:_e},"error"),console.error(`[stx] ${De}`),z.debug)throw new Y(De,k);return F}let Se=await se(()=>Bun.file(ye).text(),"",()=>{throw new Y(`Failed to read layout file: ${ye}`,k,void 0,void 0,"Layout content could not be loaded")});Se=Um(Se,ye);let $e=Se.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if($e){if(z.debug)console.log(`Found nested layout: ${$e[1]} in ${ye}`);let Ie={},_e=Se.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Oe,Pe,Le)=>(Ie[Pe]=Le.trim(),""));for(let[Oe,Pe]of Object.entries(Ie))if(ae[Oe]&&ae[Oe].includes(Br)){let Le=ae[Oe].indexOf(Br);ae[Oe]=ae[Oe].slice(0,Le)+Pe+ae[Oe].slice(Le+Br.length)}else if(!ae[Oe])ae[Oe]=Pe;let De={..._,__sections:ae},Ne=`@layout('${$e[1]}')${_e}`;return await n(Ne,De,ye,z,T)}let Re=Se.replace(/\{\{--[\s\S]*?--\}\}/g,""),Ae=xs(Re,oe),Te={};return Ae=Ae.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(Ie,_e,De)=>(Te[_e]=De.trim(),`@slot('${_e}')`)),Ae=Ae.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Ie,_e,De)=>{if(ae[_e]){let Ne=ae[_e];if(Ne.includes(Br)){let Oe=Te[_e]||"",Pe=Ne.indexOf(Br);Ne=Ne.slice(0,Pe)+Oe+Ne.slice(Pe+Br.length)}return Ne}return De||""}),Ae=OS(Ae,ae),Ae=Ae.replace(/\{\{\s*slot\s*\}\}/g,()=>ae.content||""),Ae=Ss(Ae,oe),_.__originalFilePath=k,F=await Jm(Ae,_,ye,z,T),F=`<!-- stx-layout: ${ce} -->
2620
- ${F}`,q(F)}catch(ye){return I.log(ye instanceof Error?ye:Error(String(ye)),{layoutPath:ce,filePath:k},"error"),`[Error processing layout: ${ye instanceof Error?ye.message:String(ye)}]`}return q(await Jm(F,_,k,z,T))}function OS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function NS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function jS(v,_){await se(()=>rm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Su="data-stx-source";function Xm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Su))return v;return`<script ${Su}="${encodeURIComponent(_)}"${v.slice(7)}`}function LS(v){let _=new RegExp(`${Su}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Zm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Gm(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Zm(v)}</span><span style="display:block;margin-top:4px">${Zm(k)}</span></div>`}async function BS(v,_,k,R){let{scanScriptTags:T}=await mt("stx/signal-processing",()=>import("./chunk-3gft8zng.js")),B=[],z=!E()&&!Sn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=Ym(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let Z=LS(V)??k,ie={index:F.start,length:q+9-F.start};try{let{extractVariables:oe}=await mt("stx/variable-extractor",()=>import("./chunk-tc5r2vmw.js"));await oe(Q,_,Z,{preserveExisting:!0,onFailure:(ae)=>{if(ae.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:Z,kind:ae.kind,message:ae.message}),!z)return;B.push({...ie,markup:Gm(Z,ae.kind,ae.message)})}})}catch(oe){let ae=oe instanceof Error?oe:Error(String(oe));if(I.log(ae,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${ae.message}`),z)B.push({...ie,markup:Gm(Z,"unknown",ae.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((V,H)=>H.index-V.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function zS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await mt("stx/expressions",()=>import("./chunk-cgwyd9aq.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function Jm(v,_,k,R,T){let B=v,z=R;if(B=await BS(B,_,k,R),B=await zS(B,_,k),B=await Fg(B,_,k),B=await Vg(B,_,k),B=await $p(B,_,k,z),we(B))B=pi(B,_),B=ys(B,_),B=hs(B,_);B=fi(B);let{processStreamDirectives:W}=await mt("stx/streaming",()=>import("./chunk-pw9verqx.js"));B=W(B,_),B=bi(B,_,k,z,!0),B=await lm(B,_,k,z,T),B=await ps(B,_,k,z,T),B=jf(B,_,k,z);let{processDeferDirectives:F}=await mt("stx/defer",()=>import("./chunk-mbmbaj0m.js"));B=F(B,_,k);let{processTeleportDirectives:V}=await mt("stx/teleport",()=>import("./chunk-8jaw6exk.js"));B=V(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await mt("stx/transitions",()=>import("./chunk-n61v7e3s.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:Z}=await mt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=Z(B);let{processSuspenseDirectives:ie}=await mt("stx/suspense",()=>import("./chunk-6aq3sm83.js"));B=ie(B,_,k);let{processAsyncDirectives:oe}=await mt("stx/async-components",()=>import("./chunk-qx6tr8mr.js"));B=oe(B,_,k);let{processKeepAliveDirectives:ae}=await mt("stx/keep-alive",()=>import("./chunk-s6sf70ty.js"));B=ae(B,_,k);let{processVirtualListDirectives:ce,processVirtualGridDirectives:de,processInfiniteListDirectives:le}=await mt("stx/virtual-scrolling",()=>import("./chunk-9yar9rfq.js"));B=ce(B,_,k),B=de(B,_,k),B=le(B,_,k);let{processPartialHydrationDirectives:ge,processStaticDirectives:ye}=await mt("stx/partial-hydration",()=>import("./chunk-194qgkc9.js"));B=ge(B,_,k),B=ye(B);let{processComputedDirectives:Se,processWatchDirectives:$e}=await mt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=Se(B,_,k),B=$e(B,_,k);let{processFormValidationDirectives:Re}=await mt("stx/forms-validation",()=>import("./chunk-jw33eys8.js"));B=Re(B,_,k);let{processHeadDirective:Ae,processTitleDirective:Te,processMetaDirective:Ie,resetHead:_e}=await mt("stx/head",()=>import("./chunk-279jv0yf.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let De=Ae(B);if(B=De.content,De.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${De.headContent}
2621
- `;if(B=Te(B,_),B=Ie(B,_,k),B=nm(B),B=xl(B,_),B=Sp(B),B=Yg(B),B=await vs(B,_,k,z,T),B=await ps(B,_,k,z,T),_.__stxProcessingDepth===1)B=Ku(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=bu(B),B=ur(B,_,k),B=ws(B),B=Bf(B,_,{filePath:k,buildMode:z.buildMode}),B=bl(B,_),B=vl(B,_),B=ua(B,_),B=Tp(B,_),B=Ip(B,_),B=await fp(B,_,k,z),B=await Hf(B,_,k),B=await ki(B,_,k,z),B=Ci(B,_,k,z),B=Is(B,_,k,z),B=Os(B,_,k),B=Ds(B,_,k,z),B=vp(B,_,k,z),B=Cs(B,_),B=_s(B),B=jm(B),!z.skipEventDirectives)B=ju(B,_,k);if(B=Ff(B,_,k),z.debug){let ut=/\bx-data\s*=/.test(B),ot=ms(v);if(ut&&ot)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2620
+ ${F}`,q(F)}catch(ye){return I.log(ye instanceof Error?ye:Error(String(ye)),{layoutPath:ce,filePath:k},"error"),`[Error processing layout: ${ye instanceof Error?ye.message:String(ye)}]`}return q(await Jm(F,_,k,z,T))}function OS(v,_){return v.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,R,T)=>{let B=_[R];if(B!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${R.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(B))return B}return T||""})}function NS(v,_){if(v.__stx_sfc_mode=!0,v.__stx_options=_,_.buildMode)v.__stx_buildMode=_.buildMode;let k=_.envPrefix||"STX_PUBLIC_",R={};for(let[T,B]of Object.entries(process.env))if(T.startsWith(k)&&B!==void 0)R[T]=B;v.$env=R}async function jS(v,_){await se(()=>rm(v,_),void 0,(k)=>{I.log(k,{filePath:v,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${v}: ${k.message}`)})}var Su="data-stx-source";function Xm(v,_){if(!v)return v;let k=/^<script\b([^>]*)>/i.exec(v);if(!k||!/\bserver\b/.test(k[1])||k[1].includes(Su))return v;return`<script ${Su}="${encodeURIComponent(_)}"${v.slice(7)}`}function LS(v){let _=new RegExp(`${Su}="([^"]*)"`).exec(v);return _?decodeURIComponent(_[1]):void 0}function Zm(v){return v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Gm(v,_,k){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a &lt;script server&gt; ${_==="module-resolution"?"imports a module that does not resolve":_==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${Zm(v)}</span><span style="display:block;margin-top:4px">${Zm(k)}</span></div>`}async function BS(v,_,k,R){let{scanScriptTags:T}=await mt("stx/signal-processing",()=>import("./chunk-hm4j4d8q.js")),B=[],z=!E()&&!Sn();for(let F of T(v)){let V=F.attrs;if(!/\bserver\b/.test(V))continue;let H=F.start+F.fullMatch.indexOf(">")+1,q=Ym(v,H);if(q===-1)continue;let Q=v.slice(H,q);if(!Q.trim())continue;let Z=LS(V)??k,ie={index:F.start,length:q+9-F.start};try{let{extractVariables:oe}=await mt("stx/variable-extractor",()=>import("./chunk-t0zdz8kd.js"));await oe(Q,_,Z,{preserveExisting:!0,onFailure:(ae)=>{if(ae.kind==="unknown")return;if(R?.onServerScriptError?.({sourcePath:Z,kind:ae.kind,message:ae.message}),!z)return;B.push({...ie,markup:Gm(Z,ae.kind,ae.message)})}})}catch(oe){let ae=oe instanceof Error?oe:Error(String(oe));if(I.log(ae,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${ae.message}`),z)B.push({...ie,markup:Gm(Z,"unknown",ae.message)})}}if(B.length===0)return v;let W=v;for(let F of B.sort((V,H)=>H.index-V.index))W=W.slice(0,F.index)+F.markup+W.slice(F.index+F.length);return W}async function zS(v,_,k){try{let{interpolateScriptsInTemplate:R}=await mt("stx/expressions",()=>import("./chunk-cr67dpx4.js"));return R(v,_,{skipServer:!0})}catch(R){let T=R instanceof Error?R:Error(String(R));return I.log(T,{filePath:k,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${k}: ${T.message}`),v}}async function Jm(v,_,k,R,T){let B=v,z=R;if(B=await BS(B,_,k,R),B=await zS(B,_,k),B=await Fg(B,_,k),B=await Vg(B,_,k),B=await $p(B,_,k,z),we(B))B=pi(B,_),B=ys(B,_),B=hs(B,_);B=fi(B);let{processStreamDirectives:W}=await mt("stx/streaming",()=>import("./chunk-b5fpsp5n.js"));B=W(B,_),B=bi(B,_,k,z,!0),B=await lm(B,_,k,z,T),B=await ps(B,_,k,z,T),B=jf(B,_,k,z);let{processDeferDirectives:F}=await mt("stx/defer",()=>import("./chunk-mbmbaj0m.js"));B=F(B,_,k);let{processTeleportDirectives:V}=await mt("stx/teleport",()=>import("./chunk-8jaw6exk.js"));B=V(B,_,k);let{processTransitionDirectives:H,processTransitionAttributes:q}=await mt("stx/transitions",()=>import("./chunk-n61v7e3s.js"));B=H(B,_,k),B=q(B);let{processErrorBoundaryDirectives:Q,stripRenderFailedMarkers:Z}=await mt("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));B=Q(B,_,k),B=Z(B);let{processSuspenseDirectives:ie}=await mt("stx/suspense",()=>import("./chunk-6aq3sm83.js"));B=ie(B,_,k);let{processAsyncDirectives:oe}=await mt("stx/async-components",()=>import("./chunk-qx6tr8mr.js"));B=oe(B,_,k);let{processKeepAliveDirectives:ae}=await mt("stx/keep-alive",()=>import("./chunk-s6sf70ty.js"));B=ae(B,_,k);let{processVirtualListDirectives:ce,processVirtualGridDirectives:de,processInfiniteListDirectives:le}=await mt("stx/virtual-scrolling",()=>import("./chunk-9yar9rfq.js"));B=ce(B,_,k),B=de(B,_,k),B=le(B,_,k);let{processPartialHydrationDirectives:ge,processStaticDirectives:ye}=await mt("stx/partial-hydration",()=>import("./chunk-194qgkc9.js"));B=ge(B,_,k),B=ye(B);let{processComputedDirectives:Se,processWatchDirectives:$e}=await mt("stx/computed",()=>import("./chunk-1xdzcy9d.js"));B=Se(B,_,k),B=$e(B,_,k);let{processFormValidationDirectives:Re}=await mt("stx/forms-validation",()=>import("./chunk-jw33eys8.js"));B=Re(B,_,k);let{processHeadDirective:Ae,processTitleDirective:Te,processMetaDirective:Ie,resetHead:_e}=await mt("stx/head",()=>import("./chunk-279jv0yf.js"));if(!_.__stx_head_preset&&!_.__stx_runtime_head)_e();let De=Ae(B);if(B=De.content,De.headContent)_.__stx_head_raw=`${_.__stx_head_raw||""}${De.headContent}
2621
+ `;if(B=Te(B,_),B=Ie(B,_,k),B=nm(B),B=xl(B,_),B=Sp(B),B=Yg(B),B=await vs(B,_,k,z,T),B=await ps(B,_,k,z,T),_.__stxProcessingDepth===1)B=Ku(B,_);if(B=B.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),B=bu(B),B=ur(B,_,k),B=ws(B),B=Bf(B,_,{filePath:k,buildMode:z.buildMode}),B=bl(B,_),B=vl(B,_),B=ua(B,_),B=Tp(B,_),B=Ip(B,_),B=await fp(B,_,k,z),B=await Hf(B,_,k),B=await ki(B,_,k,z),B=Ci(B,_,k,z),B=Is(B,_,k,z),B=Os(B,_,k),B=Ds(B,_,k,z),B=vp(B,_,k,z),B=Cs(B,_),B=_s(B),B=jm(B),!z.skipEventDirectives)B=ju(B,_,k);if(B=Ff(B,_,k),z.debug){let lt=/\bx-data\s*=/.test(B),ot=ms(v);if(lt&&ot)console.warn(`[stx] ${k}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
2622
2622
  Both work on the same page, but they manage separate scopes.
2623
- Prefer signals (state/derived/effect) for new components.`)}B=dg(B,_),B=await K(B,_,k),B=Wm(B),B=Fm(B),B=Rf(B);let{processXElementDirectives:Ne}=await mt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Ne(B);let Oe=_.__originalFilePath||k,Pe=Fe(_);if(B=await gi(B,z,Oe,Pe),B=Cp(B,_),B=await tm(B,_,k,z),z.media?.image?.autoSiblings){let ut=z.publicDir||"public",{rewriteImagesWithSiblings:ot}=await mt("stx/image-optimization/auto-sibling",()=>import("./chunk-7kh4p06d.js"));B=await ot(B,{publicDir:ut})}if(z.seo?.enabled)B=Ms(B,_,z);let Le=(ut,ot,ht=!0)=>{if(!ot)return ut;let Lt=ot.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Vt=ut.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(Lt&&Vt){if(ht)ut=ut.replace(Vt[0],Lt[0]);if(ot=ot.replace(Lt[0],"").trim(),!ot)return ut}if(/<\/head>/i.test(ut))return ut.replace(/<\/head>/i,`${ot}
2624
- </head>`);if(/<head\b[^>]*>/i.test(ut))return ut.replace(/(<head\b[^>]*>)/i,`$1
2625
- ${ot}`);if(/<html\b[^>]*>/i.test(ut))return ut.replace(/(<html\b[^>]*>)/i,`$1
2623
+ Prefer signals (state/derived/effect) for new components.`)}B=dg(B,_),B=await K(B,_,k),B=Wm(B),B=Fm(B),B=Rf(B);let{processXElementDirectives:Ne}=await mt("stx/x-element",()=>import("./chunk-zhxdpzga.js"));B=Ne(B);let Oe=_.__originalFilePath||k,Pe=Fe(_);if(B=await gi(B,z,Oe,Pe),B=Cp(B,_),B=await tm(B,_,k,z),z.media?.image?.autoSiblings){let lt=z.publicDir||"public",{rewriteImagesWithSiblings:ot}=await mt("stx/image-optimization/auto-sibling",()=>import("./chunk-7kh4p06d.js"));B=await ot(B,{publicDir:lt})}if(z.seo?.enabled)B=Ms(B,_,z);let Le=(lt,ot,ht=!0)=>{if(!ot)return lt;let Lt=ot.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),Wt=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(lt),Ut=Wt?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(Wt[0]):null;if(Lt&&Wt&&Ut){if(ht){let tn=Wt.index+Ut.index;lt=lt.slice(0,tn)+Lt[0]+lt.slice(tn+Ut[0].length)}if(ot=ot.replace(Lt[0],"").trim(),!ot)return lt}if(/<\/head>/i.test(lt))return lt.replace(/<\/head>/i,`${ot}
2624
+ </head>`);if(/<head\b[^>]*>/i.test(lt))return lt.replace(/(<head\b[^>]*>)/i,`$1
2625
+ ${ot}`);if(/<html\b[^>]*>/i.test(lt))return lt.replace(/(<html\b[^>]*>)/i,`$1
2626
2626
  <head>
2627
2627
  ${ot}
2628
- </head>`);return ut},{renderHead:ct,getHead:yt}=await mt("stx/head",()=>import("./chunk-279jv0yf.js")),st=_.__stx_runtime_head??yt();if(st.title||st.meta?.length||st.link?.length){let ut=ct(st);if(ut)B=Le(B,ut)}if(De.headContent)B=Le(B,De.headContent,!st.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=xp(B,z.csp,_);if(z.analytics?.enabled)B=Af(B,z);if(z.heatmap?.enabled)B=If(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:ut}=await mt("stx/pwa/inject",()=>import("./chunk-636sfxyj.js"));B=ut(B,z)}let pt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),lt=/\bSTX\.\w+/.test(B),wt=/window\.STX\s*=/.test(B);if(pt&&lt&&!wt){let ot=`<script data-stx-scoped data-stx-run="once">
2628
+ </head>`);return lt},{renderHead:ct,getHead:yt}=await mt("stx/head",()=>import("./chunk-279jv0yf.js")),st=_.__stx_runtime_head??yt();if(st.title||st.meta?.length||st.link?.length){let lt=ct(st);if(lt)B=Le(B,lt)}if(De.headContent)B=Le(B,De.headContent,!st.title);if(z.csp?.enabled&&z.csp.addMetaTag)B=xp(B,z.csp,_);if(z.analytics?.enabled)B=Af(B,z);if(z.heatmap?.enabled)B=If(B,z);if(z.pwa?.enabled&&z.pwa.autoInject!==!1){let{injectPwaTags:lt}=await mt("stx/pwa/inject",()=>import("./chunk-636sfxyj.js"));B=lt(B,z)}let pt=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(B),ut=/\bSTX\.\w+/.test(B),wt=/window\.STX\s*=/.test(B);if(pt&&ut&&!wt){let ot=`<script data-stx-scoped data-stx-run="once">
2629
2629
  ${kf()}
2630
- </script>`;if(B.includes("</head>")){let ht=B.indexOf("</head>"),Vt=B.slice(0,ht).indexOf("<script");if(Vt!==-1){let Jt=B.slice(0,Vt),vn=B.slice(Vt);B=Jt+ot+`
2631
- `+vn}else B=B.replace("</head>",`${ot}
2630
+ </script>`;if(B.includes("</head>")){let ht=B.indexOf("</head>"),Wt=B.slice(0,ht).indexOf("<script");if(Wt!==-1){let Ut=B.slice(0,Wt),tn=B.slice(Wt);B=Ut+ot+`
2631
+ `+tn}else B=B.replace("</head>",`${ot}
2632
2632
  </head>`)}else if(B.includes("<body"))B=B.replace(/<body([^>]*)>/,`<body$1>
2633
2633
  ${ot}`);else B=ot+`
2634
- `+B}{let{scanScriptTags:ut}=await mt("stx/signal-processing",()=>import("./chunk-3gft8zng.js")),ot=[];for(let ht of ut(B)){if(!/\bserver\b/i.test(ht.attrs))continue;let Lt=ht.start+ht.fullMatch.indexOf(">")+1,Vt=Ym(B,Lt);if(Vt===-1)continue;let Jt=Vt+9;while(Jt<B.length&&/\s/.test(B[Jt]))Jt++;ot.push({start:ht.start,end:Jt})}if(ot.length>0){let ht=Array(ot.length+1),Lt=0;for(let Vt=0;Vt<ot.length;Vt++){let{start:Jt,end:vn}=ot[Vt];ht[Vt]=B.slice(Lt,Jt),Lt=vn}ht[ot.length]=B.slice(Lt),B=ht.join("")}}let dt=Vo(B,k);if(dt.hasScoped)B=dt.html;let St=_.__stx_event_bindings||[],gt=!1,Ft=[],Pn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Rn}=await mt("stx/signal-processing",()=>import("./chunk-3gft8zng.js"));for(let ut of Rn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Ft.push({match:ut.fullMatch,attrs:ut.attrs,content:ut.body});for(let{match:ut,attrs:ot,content:ht}of Ft){gt=!0;let Lt=ht;Es(ht,k,R.strict,_.__originalFilePath);let Vt=await be(ht,{eventBindings:St,attrs:ot,hasColonDirectives:Pn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Hs(R.buildMode),serverData:Pe});B=B.replace(ut,()=>Vt)}if(gt)_.__stx_event_bindings=[];if(!gt&&_.__stxProcessingDepth===1){let ut=_.__stx_event_bindings||[];if(ut.length>0){let ot=Wa(ut);if(ot){let ht=B.lastIndexOf("</body>");B=ht===-1?B+ot:B.slice(0,ht)+ot+`
2634
+ `+B}{let{scanScriptTags:lt}=await mt("stx/signal-processing",()=>import("./chunk-hm4j4d8q.js")),ot=[];for(let ht of lt(B)){if(!/\bserver\b/i.test(ht.attrs))continue;let Lt=ht.start+ht.fullMatch.indexOf(">")+1,Wt=Ym(B,Lt);if(Wt===-1)continue;let Ut=Wt+9;while(Ut<B.length&&/\s/.test(B[Ut]))Ut++;ot.push({start:ht.start,end:Ut})}if(ot.length>0){let ht=Array(ot.length+1),Lt=0;for(let Wt=0;Wt<ot.length;Wt++){let{start:Ut,end:tn}=ot[Wt];ht[Wt]=B.slice(Lt,Ut),Lt=tn}ht[ot.length]=B.slice(Lt),B=ht.join("")}}let dt=Vo(B,k);if(dt.hasScoped)B=dt.html;let St=_.__stx_event_bindings||[],gt=!1,Vt=[],Pn=/\s:[a-z][\w.-]*\s*=/.test(B),{scanScriptTags:Rn}=await mt("stx/signal-processing",()=>import("./chunk-hm4j4d8q.js"));for(let lt of Rn(B,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Vt.push({match:lt.fullMatch,attrs:lt.attrs,content:lt.body});for(let{match:lt,attrs:ot,content:ht}of Vt){gt=!0;let Lt=ht;Es(ht,k,R.strict,_.__originalFilePath);let Wt=await be(ht,{eventBindings:St,attrs:ot,hasColonDirectives:Pn,templateContent:v,filePath:k,projectRoot:process.cwd(),production:Hs(R.buildMode),serverData:Pe});B=B.replace(lt,()=>Wt)}if(gt)_.__stx_event_bindings=[];if(!gt&&_.__stxProcessingDepth===1){let lt=_.__stx_event_bindings||[];if(lt.length>0){let ot=Wa(lt);if(ot){let ht=B.lastIndexOf("</body>");B=ht===-1?B+ot:B.slice(0,ht)+ot+`
2635
2635
  `+B.slice(ht)}_.__stx_event_bindings=[]}}if(!ue(B)&&bm(B))B=await Ca(B,z);if(B=vm(B),z.csp?.enabled&&z.csp.useNonce&&typeof _.cspNonce==="string")B=bp(B,_.cspNonce);return B}var WS=[{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"}],FS=[{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')"}],VS=[{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 Mc(v){let _=[],k=[];return US(v,_),HS(v,_,k),qS(v,k),KS(v,_),{valid:_.length===0,errors:_,warnings:k}}function US(v,_){let k=(v.match(/\{\{/g)||[]).length,R=(v.match(/\}\}/g)||[]).length;if(k!==R)_.push({type:"expression",message:`Unclosed expression brackets: found ${k} opening '{{' and ${R} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function HS(v,_,k){for(let R of WS){let T=new RegExp(`${R.open}(?:\\s|\\()`,"g"),B=new RegExp(R.close,"g"),z=(v.match(T)||[]).length,W=(v.match(B)||[]).length;if(R.altClose){let F=new RegExp(R.altClose,"g");W+=(v.match(F)||[]).length}if(z>W)_.push({type:"directive",message:`Unclosed @${R.name} directive: found ${z} opening and ${W} closing`,suggestion:`Add ${z-W} missing ${R.close} tag(s)`});else if(W>z)k.push({type:"directive",message:`Extra ${R.close} found: ${W-z} more closing than opening`,suggestion:`Check for orphaned ${R.close} tags`})}}function qS(v,_){for(let k of FS)if(k.pattern.test(v))_.push({type:"syntax",message:k.message,suggestion:k.suggestion})}function KS(v,_){for(let k of VS)if(k.pattern.test(v))_.push({type:"expression",message:`Security warning: ${k.message}`,suggestion:"Remove dangerous code from template expressions"})}function Nc(v,_){let k=v.slice(0,_).split(`
2636
2636
  `);return{line:k.length,column:k[k.length-1].length+1}}function Lc(v,_,k){let R=[];switch(v){case"if":case"elseif":case"unless":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a condition`,suggestion:`Use @${v}(condition)`});break;case"foreach":if(k.length===0||!k[0].includes(" as "))R.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(k.length===0)R.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(k.length===0)R.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(k.length===0)R.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(k.length===0)R.push({type:"syntax",message:`@${v} requires a path`,suggestion:`Use @${v}('path/to/template')`});break}return R}function jc(v){return/@[a-z]+/i.test(v)||/\{\{/.test(v)}function Bc(v){let _=v.matchAll(/@([a-z]+)/gi),k=new Set;for(let R of _){let T=R[1].toLowerCase();if(!T.startsWith("end"))k.add(T)}return Array.from(k)}import Ln from"path";import Qs from"process";var $t=["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 eh=new Set($t),XS=new Set(["props","$props","defineProps"]),ZS=new Set(["stx","@stacksjs/stx"]),th=m(128),nh=m(64);function GS(v){let _=[],k=0,R=v.split(`
2637
2637
  `);for(let T of R){let B=k,z=null,W=!1;for(let F=0;F<T.length;F++){let V=T[F];if(W){W=!1;continue}if(V==="\\"){W=!0;continue}if(z){if(V===z)z=null;continue}if(V==="'"||V==='"'||V==="`"){z=V;continue}if(V==="/"&&F+1<T.length&&T[F+1]==="/")break;if(V==="{")k++;else if(V==="}")k--}if(B===0){let F=T.match(/(?:const|let|var)\s+(\w+)\s*=/);if(F)_.push(F[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(T)){let V=T.match(/(?:const|let|var)\s+(\w+)/);if(V)_.push(V[1])}else{let V=T.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(V){let q=V[1].slice(1,-1).split(",").map((Q)=>{let Z=Q.split(":");return(Z.length>1?Z[1]:Z[0]).trim()}).filter((Q)=>/^\w+$/.test(Q));_.push(...q)}}}}return[...new Set(_)]}function Ec(v){let _=v;_=_.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),_=_.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),_=_.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function k(R){if(!R.includes(":"))return R;let T=[],B="",z=0,W=0,F=null;for(let V=0;V<R.length;V++){let H=R[V];if(F){if(B+=H,H===F)F=null;continue}if(H==='"'||H==="'"||H==="`"){F=H,B+=H;continue}if(H==="<")z++;else if(H===">"&&z>0)z--;else if(H==="(")W++;else if(H===")")W--;if(H===","&&z===0&&W===0){T.push(B),B="";continue}B+=H}if(B)T.push(B);return T.map((V)=>{let H=V.trim(),q=H.startsWith("..."),Q=q?H.slice(3):H,Z=-1,ie=0;for(let ye=0;ye<Q.length;ye++)if(Q[ye]==="<")ie++;else if(Q[ye]===">")ie--;else if(Q[ye]===":"&&ie===0){Z=ye;break}if(Z===-1)return V;let ae=Q.substring(0,Z).trim().replace(/\?$/,""),ce=Q.substring(Z+1),de=-1,le=0;for(let ye=0;ye<ce.length;ye++)if(ce[ye]==="<")le++;else if(ce[ye]===">")le--;else if(ce[ye]==="="&&le===0){de=ye;break}let ge=q?"...":"";if(de!==-1)return`${ge}${ae} = ${ce.substring(de+1).trim()}`;return`${ge}${ae}`}).join(", ")}_=_.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(R,T,B)=>{if(!B.includes(":"))return R;return`${T}(${k(B)})`});{let R=/\b(function\s+\w*\s*)\(/g,T,B=[];while((T=R.exec(_))!==null){let z=T.index+T[0].length-1,W=1,F=z+1,V=0,H=null;while(F<_.length&&W>0){let Z=_[F];if(H){if(Z===H)H=null;F++;continue}if(Z==='"'||Z==="'"||Z==="`"){H=Z,F++;continue}if(Z==="<")V++;else if(Z===">"&&V>0)V--;else if(V===0){if(Z==="(")W++;else if(Z===")")W--}if(W>0)F++}if(W!==0)continue;let q=_.substring(z+1,F);if(!q.includes(":"))continue;let Q=k(q);B.push({start:z+1,end:F,replacement:Q})}for(let z=B.length-1;z>=0;z--){let{start:W,end:F,replacement:V}=B[z];_=_.substring(0,W)+V+_.substring(F)}}return _=_.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(R,T)=>{if(!T.includes(":"))return R;if(T.includes("{")||T.includes("}"))return R;return`(${T.split(",").map((z)=>{let[W,...F]=z.split("="),V=W.split(":")[0].trim();if(F.length>0)return`${V} = ${F.join("=").trim()}`;return V}).join(", ")}) =>`}),_=_.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),_=_.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),_=_.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),_=_.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),_=_.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),_=_.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),_=_.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),_=_.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),_=_.replace(/\n\s*\n\s*\n/g,`
2638
2638
 
2639
- `),_}function Tc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function $c(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function Rc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Ac(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var rh=new Set;async function d(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=th.get(B);if(z===void 0){try{let Me=j({loader:"ts",target:"browser",define:T}),Ze=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ze=Ze.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=Me.transformSync(Ze)}catch{z=Ec(v)}th.set(B,z)}let W={exports:{}},F=W.exports,V=Qs.cwd(),H={},q=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Me)=>Me[1]).filter((Me)=>!Me.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Me)),Q=new Map;for(let Me of q)try{if(Me.startsWith(".")){H[Me]=await import(Ln.resolve(Ln.dirname(k),Me));continue}let Ze=Ln.resolve(V,"node_modules",Me),it=Ln.join(Ze,"package.json"),xt=JSON.parse(u("fs").readFileSync(it,"utf8")),Mt=xt.main||"index.js";if(xt.exports){let Kt=typeof xt.exports==="string"?xt.exports:xt.exports["."];if(typeof Kt==="string")Mt=Kt;else if(Kt?.bun)Mt=Kt.bun;else if(Kt?.import)Mt=Kt.import;else if(Kt?.default)Mt=Kt.default}H[Me]=await import(Ln.resolve(Ze,Mt))}catch(Ze){if(Me.startsWith("."))Q.set(Me,Ze instanceof Error?Ze.message:String(Ze))}let Z=(Me)=>{if(H[Me])return H[Me];let Ze=Q.get(Me);if(Ze!==void 0)throw Error(`Cannot require '${Me}' from ${k}: ${Ze}`);return u(Me)},ie=_.props||{},oe=(Me)=>{if(!Me)return ie;let Ze={};for(let[it,xt]of Object.entries(Me)){let Mt=ie[it];if(Mt!==void 0)Ze[it]=Mt;else if(typeof xt==="function")Ze[it]=xt();else Ze[it]=xt}return Ze};for(let[Me,Ze]of Object.entries(ie))Object.defineProperty(oe,Me,{value:Ze,enumerable:!0,configurable:!0,writable:!0});let ae=(Me,Ze=!1)=>{if(Me===void 0||Me===null)return Ze;if(typeof Me==="string"){let it=Me.trim().toLowerCase();if(it===""||it==="true"||it==="1"||it==="on"||it==="yes")return!0;if(it==="false"||it==="0"||it==="off"||it==="no")return!1;return!0}return Boolean(Me)},ce=(Me,Ze=0)=>{if(Me===void 0||Me===null)return Ze;if(typeof Me==="string"){let xt=Me.trim();if(xt==="")return Ze;let Mt=Number(xt);return Number.isFinite(Mt)?Mt:Ze}let it=Number(Me);return Number.isFinite(it)?it:Ze};for(let Me of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(ie,Me))continue;try{Object.defineProperty(oe,Me,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let de=(Me)=>{if(!Me)return ie;let Ze={...ie};for(let[it,xt]of Object.entries(Me)){let Mt=xt&&typeof xt==="object"&&!Array.isArray(xt)?xt:{type:xt};if(Ze[it]===void 0&&Mt.default!==void 0)Ze[it]=typeof Mt.default==="function"?Mt.default():Mt.default}return Ze},le=()=>_.slots||{},ge=(Me,Ze)=>{let it={...Me};for(let[xt,Mt]of Object.entries(Ze))if(it[xt]===void 0)if(typeof Mt==="function")it[xt]=Mt();else it[xt]=Mt;return it},ye=(Me)=>{let Ze=()=>Me;return Ze.set=(it)=>{},Ze.update=(it)=>{},Ze},Se=(Me)=>{let Ze,it=!1;return()=>{if(!it)try{Ze=Me(),it=!0}catch{Ze=void 0}return Ze}},$e=(Me)=>{},Re=(Me)=>Me(),Ae=(Me)=>{},Te=(Me)=>{},Ie=Gn(_);function _e(Me){let Ze=Me||{};if(Ze.title!==void 0||Ze.description!==void 0)Le({title:Ze.title,description:Ze.description})}function De(Me){if(!Me||typeof Me!=="object")return;let Ze=_.__stxClientPayload??{};Object.assign(Ze,Me),_.__stxClientPayload=Ze}let Ne=()=>{let Me=_.__stxServeContext,Ze=_.__stxServeSearch??Me?.search??"",it=Me?.path??"",xt=Object.fromEntries(new URLSearchParams(Ze)),Mt=_.query,Kt=Object.keys(xt).length>0?xt:Mt??{},Wr=Ze||(Object.keys(Kt).length>0?`?${new URLSearchParams(Kt).toString()}`:"");return{params:_.params??{},query:Kt,path:it,name:"",fullPath:it+Wr,hash:"",matched:[]}},Oe=()=>({push:(Me)=>{},replace:(Me)=>{},back:()=>{},forward:()=>{},go:(Me)=>{}}),Pe=(Me)=>{let Ze=_.__stx_runtime_head||{};_.__stx_runtime_head=he(Ze,me(Me||{},{known:cr,source:"useHead()"}))},Le=(Me)=>{Pe(lr(Me||{}))},ct=(Me)=>({value:Me}),yt=(Me)=>Me,ft=(Me)=>({value:typeof Me==="function"?Me():Me}),st=(Me,Ze)=>{},pt=(Me)=>{},lt=(Me)=>{},wt=(Me)=>Me?Me():Promise.resolve(),dt=(Me)=>(Ze,...it)=>{},St=(Me)=>{},gt=(Me,Ze)=>{},Ft=(Me,Ze)=>Ze,Pn=()=>({value:"light"}),Rn=()=>ye(!1),ut=(Me)=>ye(!1),ot=()=>ye(!1),ht=()=>ut("(prefers-color-scheme: dark)"),Lt=()=>ut("(prefers-color-scheme: light)"),Vt=()=>ut("(prefers-reduced-motion: reduce)"),Jt=()=>ut("(prefers-contrast: more)"),vn={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:{}},Ma=new Proxy(vn,{get(Me,Ze){if(Ze in Me)return Me[Ze];return},set(Me,Ze,it){return Me[Ze]=it,!0}}),Bn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Oa=console;try{let Me=bs(z,k),Ze=new Set(Object.keys(ie)),it=Object.keys(_).filter((et)=>!Ze.has(et)&&!XS.has(et)&&tt(et)),xt=it.map((et)=>_[et]);if(!it.includes("__stxServeContext"))it.push("__stxServeContext"),xt.push(void 0);if(!Ze.has("cookies")){let et=_.cookies??_.__stxServeContext?.cookies??{},Nt=it.indexOf("cookies");if(Nt<0)it.push("cookies"),xt.push(et);else xt[Nt]=et}let Mt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Kt=[],Wr=[];for(let[et,Nt]of Object.entries(ie)){if(!tt(et))continue;if(Mt.has(et))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${et}\\b`).test(Me))continue;Kt.push(et),Wr.push(Nt)}let yo=GS(Me).map((et)=>`module.exports.${et} = typeof ${et} !== 'undefined' ? ${et} : module.exports.${et};`).join(`
2640
- `),xo=_.params??{},bo=[],fr=[];for(let et=0;et<it.length;et++){if(it[et]==="params")continue;bo.push(it[et]),fr.push(xt[et])}let Fr=[...$t,...Kt,...bo],zn=`return (async () => {
2639
+ `),_}function Tc(v){return v.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(_,...k)=>{let[,R,T]=k,B=R??T;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(B)?"":_})}function $c(v){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(v)}function Rc(v){if(v instanceof SyntaxError)return!0;let _=v instanceof Error?v.message:String(v);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(_)}function Ac(v){if(!/is not defined|can't find variable/i.test(v))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(v)}var rh=new Set;async function d(v,_,k,R={}){if(!v.trim())return;let T=w(),B=h(v,JSON.stringify(T)),z=th.get(B);if(z===void 0){try{let Me=j({loader:"ts",target:"browser",define:T}),Ze=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Ze=Ze.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),z=Me.transformSync(Ze)}catch{z=Ec(v)}th.set(B,z)}let W={exports:{}},F=W.exports,V=Qs.cwd(),H={},q=[...z.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((Me)=>Me[1]).filter((Me)=>!Me.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(Me)),Q=new Map;for(let Me of q)try{if(Me.startsWith(".")){H[Me]=await import(Ln.resolve(Ln.dirname(k),Me));continue}let Ze=Ln.resolve(V,"node_modules",Me),it=Ln.join(Ze,"package.json"),xt=JSON.parse(u("fs").readFileSync(it,"utf8")),Mt=xt.main||"index.js";if(xt.exports){let Xt=typeof xt.exports==="string"?xt.exports:xt.exports["."];if(typeof Xt==="string")Mt=Xt;else if(Xt?.bun)Mt=Xt.bun;else if(Xt?.import)Mt=Xt.import;else if(Xt?.default)Mt=Xt.default}H[Me]=await import(Ln.resolve(Ze,Mt))}catch(Ze){if(Me.startsWith("."))Q.set(Me,Ze instanceof Error?Ze.message:String(Ze))}let Z=(Me)=>{if(H[Me])return H[Me];let Ze=Q.get(Me);if(Ze!==void 0)throw Error(`Cannot require '${Me}' from ${k}: ${Ze}`);return u(Me)},ie=_.props||{},oe=(Me)=>{if(!Me)return ie;let Ze={};for(let[it,xt]of Object.entries(Me)){let Mt=ie[it];if(Mt!==void 0)Ze[it]=Mt;else if(typeof xt==="function")Ze[it]=xt();else Ze[it]=xt}return Ze};for(let[Me,Ze]of Object.entries(ie))Object.defineProperty(oe,Me,{value:Ze,enumerable:!0,configurable:!0,writable:!0});let ae=(Me,Ze=!1)=>{if(Me===void 0||Me===null)return Ze;if(typeof Me==="string"){let it=Me.trim().toLowerCase();if(it===""||it==="true"||it==="1"||it==="on"||it==="yes")return!0;if(it==="false"||it==="0"||it==="off"||it==="no")return!1;return!0}return Boolean(Me)},ce=(Me,Ze=0)=>{if(Me===void 0||Me===null)return Ze;if(typeof Me==="string"){let xt=Me.trim();if(xt==="")return Ze;let Mt=Number(xt);return Number.isFinite(Mt)?Mt:Ze}let it=Number(Me);return Number.isFinite(it)?it:Ze};for(let Me of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(ie,Me))continue;try{Object.defineProperty(oe,Me,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let de=(Me)=>{if(!Me)return ie;let Ze={...ie};for(let[it,xt]of Object.entries(Me)){let Mt=xt&&typeof xt==="object"&&!Array.isArray(xt)?xt:{type:xt};if(Ze[it]===void 0&&Mt.default!==void 0)Ze[it]=typeof Mt.default==="function"?Mt.default():Mt.default}return Ze},le=()=>_.slots||{},ge=(Me,Ze)=>{let it={...Me};for(let[xt,Mt]of Object.entries(Ze))if(it[xt]===void 0)if(typeof Mt==="function")it[xt]=Mt();else it[xt]=Mt;return it},ye=(Me)=>{let Ze=()=>Me;return Ze.set=(it)=>{},Ze.update=(it)=>{},Ze},Se=(Me)=>{let Ze,it=!1;return()=>{if(!it)try{Ze=Me(),it=!0}catch{Ze=void 0}return Ze}},$e=(Me)=>{},Re=(Me)=>Me(),Ae=(Me)=>{},Te=(Me)=>{},Ie=Gn(_);function _e(Me){let Ze=Me||{};if(Ze.title!==void 0||Ze.description!==void 0)Le({title:Ze.title,description:Ze.description})}function De(Me){if(!Me||typeof Me!=="object")return;let Ze=_.__stxClientPayload??{};Object.assign(Ze,Me),_.__stxClientPayload=Ze}let Ne=()=>{let Me=_.__stxServeContext,Ze=_.__stxServeSearch??Me?.search??"",it=Me?.path??"",xt=Object.fromEntries(new URLSearchParams(Ze)),Mt=_.query,Xt=Object.keys(xt).length>0?xt:Mt??{},Wr=Ze||(Object.keys(Xt).length>0?`?${new URLSearchParams(Xt).toString()}`:"");return{params:_.params??{},query:Xt,path:it,name:"",fullPath:it+Wr,hash:"",matched:[]}},Oe=()=>({push:(Me)=>{},replace:(Me)=>{},back:()=>{},forward:()=>{},go:(Me)=>{}}),Pe=(Me)=>{let Ze=_.__stx_runtime_head||{};_.__stx_runtime_head=he(Ze,me(Me||{},{known:cr,source:"useHead()"}))},Le=(Me)=>{Pe(lr(Me||{}))},ct=(Me)=>({value:Me}),yt=(Me)=>Me,ft=(Me)=>({value:typeof Me==="function"?Me():Me}),st=(Me,Ze)=>{},pt=(Me)=>{},ut=(Me)=>{},wt=(Me)=>Me?Me():Promise.resolve(),dt=(Me)=>(Ze,...it)=>{},St=(Me)=>{},gt=(Me,Ze)=>{},Vt=(Me,Ze)=>Ze,Pn=()=>({value:"light"}),Rn=()=>ye(!1),lt=(Me)=>ye(!1),ot=()=>ye(!1),ht=()=>lt("(prefers-color-scheme: dark)"),Lt=()=>lt("(prefers-color-scheme: light)"),Wt=()=>lt("(prefers-reduced-motion: reduce)"),Ut=()=>lt("(prefers-contrast: more)"),tn={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:{}},Ma=new Proxy(tn,{get(Me,Ze){if(Ze in Me)return Me[Ze];return},set(Me,Ze,it){return Me[Ze]=it,!0}}),Bn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Oa=console;try{let Me=bs(z,k),Ze=new Set(Object.keys(ie)),it=Object.keys(_).filter((et)=>!Ze.has(et)&&!XS.has(et)&&tt(et)),xt=it.map((et)=>_[et]);if(!it.includes("__stxServeContext"))it.push("__stxServeContext"),xt.push(void 0);if(!Ze.has("cookies")){let et=_.cookies??_.__stxServeContext?.cookies??{},Nt=it.indexOf("cookies");if(Nt<0)it.push("cookies"),xt.push(et);else xt[Nt]=et}let Mt=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),Xt=[],Wr=[];for(let[et,Nt]of Object.entries(ie)){if(!tt(et))continue;if(Mt.has(et))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${et}\\b`).test(Me))continue;Xt.push(et),Wr.push(Nt)}let yo=GS(Me).map((et)=>`module.exports.${et} = typeof ${et} !== 'undefined' ? ${et} : module.exports.${et};`).join(`
2640
+ `),xo=_.params??{},bo=[],fr=[];for(let et=0;et<it.length;et++){if(it[et]==="params")continue;bo.push(it[et]),fr.push(xt[et])}let Fr=[...$t,...Xt,...bo],zn=`return (async () => {
2641
2641
  ${Me}
2642
2642
  ${yo}
2643
2643
  return module.exports
2644
- })()`,Yt=h(zn,Fr.join("\x00")),nt=nh.get(Yt);if(!nt)nt=Function(...Fr,zn),nh.set(Yt,nt);let at=_.__stx_options?.runtimeConfig;if(at||/\buse(?:Server)?RuntimeConfig\b/.test(z))await fn(_,k,at);let bt=await fe(_.__stx_runtime_config??At()??C(),()=>pm(_,()=>nt(W,F,Z,ie,oe,ae,ce,de,ge,De,gm,Ps,rr,ye,Se,$e,Re,Ae,Te,_e,Ne,Oe,Pe,Le,Ie.setResponseStatus,Ie.setResponseHeader,Ie.notFound,ct,yt,ft,st,pt,lt,wt,dt,St,le,gt,Ft,Pn,Rn,ut,ot,ht,Lt,Vt,Jt,Ma,Bn,Oa,vn.confirm,vn.alert,vn.fetch,xo,...Wr,...fr)));if(R.preserveExisting){for(let[et,Nt]of Object.entries(bt))if(!(et in _)||_[et]===void 0)_[et]=Nt}else Object.assign(_,bt);for(let[et,Nt]of Object.entries(ie))if(!(et in _))_[et]=Nt}catch(Me){if(_.__stx_strict_hydration)throw Me;let Ze=Tc(Me instanceof Error?Me.message:String(Me));if($c(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"module-resolution",message:Ze,error:Me});else if(Rc(Me))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"syntax",message:Ze,error:Me});else if(Ac(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${Ze}`),R.onFailure?.({kind:"missing-binding",message:Ze,error:Me});else{let it=`${k??"<unknown>"}\x00${Ze}`;if(Qs.env.STX_DEBUG||!rh.has(it))rh.add(it),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Ze}`);R.onFailure?.({kind:"unknown",message:Ze,error:Me})}try{await n0(z,_,k)}catch(it){if(Qs.env.STX_DEBUG){let xt=it instanceof Error?it.message:String(it);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${xt}`)}}}}function Pc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var JS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function bs(v,_){let k=_?Ln.dirname(_):Qs.cwd(),R=Qs.cwd(),T=v.split(`
2644
+ })()`,Yt=h(zn,Fr.join("\x00")),nt=nh.get(Yt);if(!nt)nt=Function(...Fr,zn),nh.set(Yt,nt);let at=_.__stx_options?.runtimeConfig;if(at||/\buse(?:Server)?RuntimeConfig\b/.test(z))await fn(_,k,at);let bt=await fe(_.__stx_runtime_config??At()??C(),()=>pm(_,()=>nt(W,F,Z,ie,oe,ae,ce,de,ge,De,gm,Ps,rr,ye,Se,$e,Re,Ae,Te,_e,Ne,Oe,Pe,Le,Ie.setResponseStatus,Ie.setResponseHeader,Ie.notFound,ct,yt,ft,st,pt,ut,wt,dt,St,le,gt,Vt,Pn,Rn,lt,ot,ht,Lt,Wt,Ut,Ma,Bn,Oa,tn.confirm,tn.alert,tn.fetch,xo,...Wr,...fr)));if(R.preserveExisting){for(let[et,Nt]of Object.entries(bt))if(!(et in _)||_[et]===void 0)_[et]=Nt}else Object.assign(_,bt);for(let[et,Nt]of Object.entries(ie))if(!(et in _))_[et]=Nt}catch(Me){if(_.__stx_strict_hydration)throw Me;let Ze=Tc(Me instanceof Error?Me.message:String(Me));if($c(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"module-resolution",message:Ze,error:Me});else if(Rc(Me))console.warn(`[stx] server <script> in ${k??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${Ze}`),R.onFailure?.({kind:"syntax",message:Ze,error:Me});else if(Ac(Ze))console.warn(`[stx] server <script> in ${k??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${Ze}`),R.onFailure?.({kind:"missing-binding",message:Ze,error:Me});else{let it=`${k??"<unknown>"}\x00${Ze}`;if(Qs.env.STX_DEBUG||!rh.has(it))rh.add(it),console.warn(`[stx] server <script> in ${k??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${Ze}`);R.onFailure?.({kind:"unknown",message:Ze,error:Me})}try{await n0(z,_,k)}catch(it){if(Qs.env.STX_DEBUG){let xt=it instanceof Error?it.message:String(it);console.warn(`[stx] fallback extraction also failed in ${k??"<unknown>"}: ${xt}`)}}}}function Pc(v){let _=0,k=null,R=!1,T=!1;for(let B=0;B<v.length;B++){let z=v[B];if(k){if(z===k){if(k=null,R||_===0)T=!0}continue}if(z==="'"||z==='"'||z==="`"){k=z;continue}if(z==="{")_++;else if(z==="}")_--;else if(v.startsWith("from",B)&&_===0)R=!0}return k===null&&_===0&&T}var JS=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function bs(v,_){let k=_?Ln.dirname(_):Qs.cwd(),R=Qs.cwd(),T=v.split(`
2645
2645
  `),B=[],z=0;while(z<T.length){let W=T[z].trim();if(W.startsWith("interface ")||W.startsWith("export interface ")||W.startsWith("type ")||W.startsWith("export type ")){if(W.includes("{")&&!W.includes("}")){let F=0;for(;z<T.length;z++){for(let V of T[z])if(V==="{")F++;else if(V==="}")F--;if(F<=0)break}}z++;continue}if(W.startsWith("definePageMeta(")){let F=0,V=!1,H=z;for(let Z=z;Z<T.length&&!V;Z++){let ie=null,oe=!1,ae=T[Z];for(let ce=0;ce<ae.length;ce++){let de=ae[ce];if(oe){oe=!1;continue}if(de==="\\"){oe=!0;continue}if(ie){if(de===ie)ie=null;continue}if(de==='"'||de==="'"||de==="`"){ie=de;continue}if(de==="(")F++;else if(de===")"){if(F--,F===0){z=Z+1,V=!0;break}}}}if(!V)z=T.length;let q=T.slice(H,z).join(`
2646
2646
  `),Q=[];for(let Z of["title","description"]){let ie=new RegExp(`\\b${Z}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(q);if(ie)Q.push(`${Z}: ${JSON.stringify(ie[2])}`)}if(Q.length>0)B.push(`useSeoMeta({ ${Q.join(", ")} });`);continue}if(W.startsWith("import ")||W==="import"||W.startsWith("import{")||/^import['"]/.test(W)){let F=W,V=0;while(!Pc(F)&&z+V+1<T.length)V++,F=`${F} ${T[z+V].trim()}`;z+=V;let H=F.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),q=F.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),Q=F.match(/^import\s*['"](.+?)['"]/),Z=F,ie=(oe)=>{if(oe.startsWith("."))return Ln.resolve(k,oe);if(oe.startsWith("~/")||oe.startsWith("@/"))return Ln.resolve(R,oe.slice(2));try{return Bun.resolveSync(oe,k)}catch{return oe}};if(H){let[,oe,ae]=H,ce=ie(ae);B.push(`const ${oe} = (await import('${ce}')).default`),B.push(`module.exports.${oe} = ${oe};`)}else if(q){let[,oe,ae]=q,ce=ie(ae),de=[],le=[],ge=ZS.has(ae);for(let ye of oe.split(",")){let Se=ye.trim();if(!Se)continue;let $e=Se.split(/\s+as\s+/);if($e.length===2){let[Re,Ae]=[$e[0].trim(),$e[1].trim()];if(ge&&eh.has(Re)){B.push(`const ${Ae} = ${Re};`);continue}de.push(`${Re}: ${Ae}`),le.push(Ae)}else{if(ge&&eh.has(Se))continue;de.push(Se),le.push(Se)}}if(de.length>0)B.push(`const { ${de.join(", ")} } = await import('${ce}')`);for(let ye of le)B.push(`module.exports.${ye} = ${ye};`)}else if(Q){let oe=ie(Q[1]);B.push(`await import('${oe}')`)}else B.push(Z);z++;continue}if(JS.test(W))B.push(T[z]),z++;else if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let F=ih(T,z),{type:V,name:H,value:q}=F;B.push(`${V} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let F=$u(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let F=ih(T,z),{type:V,name:H,value:q}=F;B.push(`${V} ${H} = ${q};`),B.push(`module.exports.${H} = ${H};`),z=F.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let F=$u(T,z);B.push(F.functionCode),B.push(`module.exports.${F.name} = ${F.name};`),z=F.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let F=T[z].replace(/^(\s*)export\s+default\s+/,"$1"),V=[...T];V[z]=F;let H=$u(V,z);if(B.push(H.functionCode),H.name)B.push(`module.exports.default = ${H.name};`);z=H.nextIndex}else if(W.startsWith("export default ")){let F=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");B.push(`module.exports.default = ${F};`),z++}else if(W.startsWith("class ")||W.startsWith("export class ")){let F=W.match(/(?:export\s+)?class\s+(\w+)/);if(F){let V=F[1],H=T[z].replace(/^export\s+/,""),q=0,Q=z;for(;Q<T.length;Q++){let Z=T[Q];for(let ie of Z)if(ie==="{")q++;else if(ie==="}")q--;if(Q>z)H+=`
2647
2647
  `+Z;if(q<=0&&Q>=z)break}B.push(H),B.push(`module.exports.${V} = ${V};`),z=Q+1}else B.push(W),z++}else if(W.includes("module.exports"))B.push(W),z++;else if(W.trim()&&!W.startsWith("//"))B.push(W),z++;else z++}return YS(B.join(`
@@ -2653,17 +2653,17 @@ ${v[V]}`,V++;else break}return F=F.trim().replace(/;$/,""),{type:B,name:z,value:
2653
2653
  ${B}`,T++}while(T<v.length){let B=v[T].trim();if(B.startsWith(".")||B.startsWith("?."))R+=`
2654
2654
  ${v[T]}`,T++;else break}return{value:R,nextIndex:T}}function t0(v,_,k){let R=k,T=_+1;while(T<v.length){let B=fh(R);if(B!==-1){if(S(R,"{","}",B)!==-1)break}let z=v[T];R+=`
2655
2655
  ${z}`,T++}return{functionCode:R,nextIndex:T}}function ch(v,_){let k=l(v,_)??l(`(${v})`,_);if(k!==void 0)return k;if(!/\bprocess\b/.test(v))return;let R={..._,process:Object.freeze({env:{...Qs.env}})},T=Object.keys(R).filter(tt),B=T.map((z)=>R[z]);try{return Function(...T,`'use strict'; return (${v});`)(...B)}catch{try{return Function(...T,`'use strict'; return ${v};`)(...B)}catch{return}}}async function n0(v,_,k){let R=v.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let B of R){let[,,z,W]=B;try{let F=W.trim().replace(/;$/,""),V=ch(F,_);if(V!==void 0)_[z]=V}catch(F){console.warn(`Failed to parse export ${z} in fallback:`,F)}}let T=v.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let B of T){let[,,z,W]=B;if(!(z in _))try{let F=W.trim().replace(/;$/,""),V=ch(F,_);if(V!==void 0)_[z]=V}catch{}}}function hi(v){let _=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),k=_?_[1]:"",R=_?v.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):v;return{scriptContent:k,templateWithoutScript:R}}function yi(v){let _=v.trim();if(!_)return!1;return/(?:const|let|var|function)\s+\w+/.test(_)}var mo=new N(500),Pa=new N(1000),ku=new N(2000),Eu=new N(500),vh=33554432,Cu=vh;function r0(v){let _=v.componentRenderCacheBytes;if(typeof _!=="number"||_<0||_===Cu)return;Cu=_,Da.setMaxBytes(_)}var Da=new N(2000,{maxBytes:vh,sizeOf:(v)=>v.output.length});function s0(v){let _=new WeakSet;try{let k=(R)=>{if(R===void 0)return{__stxType:"undefined"};if(typeof R==="bigint")return{__stxType:"bigint",value:R.toString()};if(typeof R==="function"||typeof R==="symbol")throw TypeError("Non-serializable component input");if(R===null||typeof R!=="object")return R;if(_.has(R))throw TypeError("Circular component input");_.add(R);try{if(R instanceof Date)return{__stxType:"date",value:R.toISOString()};if(Array.isArray(R))return R.map(k);let T=Object.getPrototypeOf(R);if(T!==Object.prototype&&T!==null)throw TypeError("Non-plain component input");let B={};for(let z of Object.keys(R).sort())B[z]=k(R[z]);return B}finally{_.delete(R)}};return JSON.stringify(k(v))}catch{return null}}function i0(v){let _={};for(let[k,R]of Object.entries(v))if(!k.startsWith("__")||k==="__stxServeContext")_[k]=R;return _}function ph(v){return v.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Fc(v){return/\bjs\b/.test(v)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(v)}function Ge(v){return!Fc(v)}var Ia=new Map;function j(v){let _;try{_=JSON.stringify(v)}catch{return new Bun.Transpiler(v)}let k=Ia.get(_);if(k)return k;if(Ia.size>=16)Ia.clear();let R=new Bun.Transpiler(v);return Ia.set(_,R),R}var gh=new WeakMap,o0=256;function Xe(v){try{let _=j({loader:"ts",target:"browser",define:w()}),k=gh.get(_);if(!k)k=new Map,gh.set(_,k);let R=k.get(v);if(R!==void 0)return R;let T=v.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");T=T.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let B=[];T=T.replace(/\{!![\s\S]*?!!\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{\{[\s\S]*?\}\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`}),T=T.replace(/\{\{[\s\S]*?\}\}/g,(W)=>{let F=B.length;return B.push(W),`"__STX_EXPR_${F}__"`});let z=_.transformSync(T);for(let W=0;W<B.length;W++)z=z.replace(`"__STX_EXPR_${W}__"`,B[W]),z=z.replace(`'__STX_EXPR_${W}__'`,B[W]);if(k.size>=o0){let W=k.keys().next();if(!W.done)k.delete(W.value)}return k.set(v,z),z}catch(_){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",_);return v}}function a0(v){let _=[],k=new Set,R=0,T=0,B=v.length,z=(H)=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]===H){T++;return}T++}},W=()=>{T++;while(T<B){if(v[T]==="\\"){T+=2;continue}if(v[T]==="`"){T++;return}if(v[T]==="$"&&v[T+1]==="{"){T+=2;let H=1;while(T<B&&H>0)if(v[T]==="{")H++,T++;else if(v[T]==="}")H--,T++;else if(v[T]==="'"||v[T]==='"')z(v[T]);else if(v[T]==="`")W();else T++;continue}T++}},F=()=>{if(v[T]==="/"&&v[T+1]==="/"){while(T<B&&v[T]!==`
2656
- `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let ie=H[2].split(",").map((oe)=>{let ae=oe.trim().split(":");return ae[ae.length-1].trim()});for(let oe of ie)if(oe&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(oe)&&!k.has(oe))_.push(oe),k.add(oe);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let ie=q[2];if(!k.has(ie))_.push(ie),k.add(ie);return}let Q=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let ie=Q[1];if(!k.has(ie))_.push(ie),k.add(ie);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let ie=Z[1];if(!k.has(ie))_.push(ie),k.add(ie)}};while(T<B){if(F())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){W();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function c0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function l0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function u0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let F=v[R];if(F==="}")B++;else if(F==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let W=v.slice(z+1,T);for(let F of c0(W)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=l0(V);if(H===-1)continue;let q=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let Q=V.slice(H+1).trim();if(!Q)continue;try{let Z=Object.keys(_).filter(tt),ie=Function(...Z,`"use strict"; return (${Q});`);_[q]=ie(...Z.map((oe)=>_[oe]))}catch{}}}catch{}}var d0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function zc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let R=k[2].toLowerCase();if(!d0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,W=!1;for(let V of B){if(z+=V.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(V.end).trim())return null;W=!0;break}}if(!W)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function Zn(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(ge)=>ge.split("-").map((ye)=>ye.charAt(0).toUpperCase()+ye.slice(1)).join(""),W=k.__importedComponents;if(W){for(let ge of[B,B.toLowerCase(),z(B),nn(B)])if(W.has(ge))return!0}let F=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${nn(B)}.stx`])],V=typeof T.root==="string"?rt.resolve(T.root):void 0,H=V??rt.dirname(R),q=[],Q=(ge)=>{if(ge&&!q.includes(ge))q.push(ge)},Z=k.__originalFilePath;if(Z)Q(rt.join(rt.dirname(Z),"components"));Q(_),Q(T._rootComponentsDir),Q(rt.join(rt.dirname(R),"components")),Q(T.componentsDir);for(let ge of T._targetComponentDirs??[])Q(ge);if(V)Q(rt.resolve(V,"resources/views/components")),Q(rt.resolve(V,"resources/components")),Q(rt.resolve(V,"src/components")),Q(rt.resolve(V,"components"));for(let ge of T._layerComponentDirs??[])Q(ge);let ie=T._pluginComponentDirs;if(Array.isArray(ie))for(let ge of ie)Q(typeof ge==="string"?ge:null);if(Q(T.fallbackComponentsDir),B.startsWith("./")||B.startsWith("../"))return r(rt.resolve(rt.dirname(R),`${B}.stx`));let oe=mh(rt.resolve(import.meta.dir,"components")),ae=q.map((ge)=>rt.isAbsolute(ge)?ge:rt.resolve(H,ge)),ce=`${F.join("\x00")}\x00\x00${ae.join("\x00")}`,de=ku.get(ce);if(de!==void 0)return de;let le=!1;e:for(let ge of ae){if(mh(ge)===oe)continue;for(let ye of F)if(await r(rt.join(ge,ye))){le=!0;break e}}return ku.set(ce,le),le}function mh(v){let _=Eu.get(v);if(_!==void 0)return _;let k=v;try{k=bh.realpathSync(v)}catch{}return Eu.set(v,k),k}function Hc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function xi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function f0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let W=String(z);if(/<\/style/i.test(W))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return W};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var hh=new Set;function yh(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&hh.has(T))return;hh.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",W=k.length>0?`
2656
+ `)T++;return!0}if(v[T]==="/"&&v[T+1]==="*"){T+=2;while(T<B-1&&!(v[T]==="*"&&v[T+1]==="/"))T++;return T+=2,!0}return!1},V=()=>{if(R!==0)return;let H=v.slice(T).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(H){let ie=H[2].split(",").map((oe)=>{let ae=oe.trim().split(":");return ae[ae.length-1].trim()});for(let oe of ie)if(oe&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(oe)&&!k.has(oe))_.push(oe),k.add(oe);return}let q=v.slice(T).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(q){let ie=q[2];if(!k.has(ie))_.push(ie),k.add(ie);return}let Q=v.slice(T).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let ie=Q[1];if(!k.has(ie))_.push(ie),k.add(ie);return}let Z=v.slice(T).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Z){let ie=Z[1];if(!k.has(ie))_.push(ie),k.add(ie)}};while(T<B){if(F())continue;if(v[T]==="'"||v[T]==='"'){z(v[T]);continue}if(v[T]==="`"){W();continue}if(v[T]==="{"){R++,T++;continue}if(v[T]==="}"){R--,T++;continue}if(R===0&&/[a-z]/i.test(v[T])&&(T===0||/\s|[;{}()]/.test(v[T-1])))V();T++}return _}function c0(v){let _=[],k=0,R=0,T=null;for(let B=0;B<v.length;B++){let z=v[B];if(T){if(z==="\\"){B++;continue}if(z===T)T=null;continue}if(z==='"'||z==="'"||z==="`"){T=z;continue}if(z==="("||z==="["||z==="{")k++;else if(z===")"||z==="]"||z==="}")k--;else if(z===","&&k===0)_.push(v.slice(R,B)),R=B+1}if(R<v.length)_.push(v.slice(R));return _}function l0(v){let _=0,k=null;for(let R=0;R<v.length;R++){let T=v[R];if(k){if(T==="\\"){R++;continue}if(T===k)k=null;continue}if(T==='"'||T==="'"||T==="`"){k=T;continue}if(T==="("||T==="["||T==="{")_++;else if(T===")"||T==="]"||T==="}")_--;else if(T==="="&&_===0){let B=v[R-1],z=v[R+1];if(B==="!"||B==="<"||B===">"||B==="=")continue;if(z==="="||z===">")continue;return R}}return-1}function u0(v,_){try{let k=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(v);if(!k)return;let R=k.index-1;while(R>=0&&/\s/.test(v[R]))R--;if(v[R]!=="}")return;let T=R,B=0,z=-1;for(;R>=0;R--){let F=v[R];if(F==="}")B++;else if(F==="{"){if(B--,B===0){z=R;break}}}if(z===-1)return;let W=v.slice(z+1,T);for(let F of c0(W)){let V=F.trim();if(!V||V.startsWith("..."))continue;let H=l0(V);if(H===-1)continue;let q=V.slice(0,H).trim();if(!/^[A-Z_$][\w$]*$/i.test(q))continue;if(_[q]!==void 0)continue;let Q=V.slice(H+1).trim();if(!Q)continue;try{let Z=Object.keys(_).filter(tt),ie=Function(...Z,`"use strict"; return (${Q});`);_[q]=ie(...Z.map((oe)=>_[oe]))}catch{}}}catch{}}var d0=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function zc(v,_){let k=v.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!k)return null;let R=k[2].toLowerCase();if(!d0.has(R))return null;let T=new RegExp(`<\\/?${R}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),B=ee(v,(V,H)=>(T.lastIndex=H,T.exec(V)?.index===H?T.lastIndex:-1));if(R==="span"&&/\sdata-stx-scope\s*=/.test(B[0]?.token||""))return null;let z=0,W=!1;for(let V of B){if(z+=V.token.startsWith("</")?-1:1,z<0)return null;if(z===0){if(v.slice(V.end).trim())return null;W=!0;break}}if(!W)return null;let F=k[0].length;return v.slice(0,F)+_+v.slice(F)}async function Zn(v,_,k,R,T){let B=v.endsWith(".stx")?v.slice(0,-4):v,z=(ge)=>ge.split("-").map((ye)=>ye.charAt(0).toUpperCase()+ye.slice(1)).join(""),W=k.__importedComponents;if(W){for(let ge of[B,B.toLowerCase(),z(B),rn(B)])if(W.has(ge))return!0}let F=[...new Set([`${B}.stx`,`${z(B)}.stx`,`${rn(B)}.stx`])],V=typeof T.root==="string"?rt.resolve(T.root):void 0,H=V??rt.dirname(R),q=[],Q=(ge)=>{if(ge&&!q.includes(ge))q.push(ge)},Z=k.__originalFilePath;if(Z)Q(rt.join(rt.dirname(Z),"components"));Q(_),Q(T._rootComponentsDir),Q(rt.join(rt.dirname(R),"components")),Q(T.componentsDir);for(let ge of T._targetComponentDirs??[])Q(ge);if(V)Q(rt.resolve(V,"resources/views/components")),Q(rt.resolve(V,"resources/components")),Q(rt.resolve(V,"src/components")),Q(rt.resolve(V,"components"));for(let ge of T._layerComponentDirs??[])Q(ge);let ie=T._pluginComponentDirs;if(Array.isArray(ie))for(let ge of ie)Q(typeof ge==="string"?ge:null);if(Q(T.fallbackComponentsDir),B.startsWith("./")||B.startsWith("../"))return r(rt.resolve(rt.dirname(R),`${B}.stx`));let oe=mh(rt.resolve(import.meta.dir,"components")),ae=q.map((ge)=>rt.isAbsolute(ge)?ge:rt.resolve(H,ge)),ce=`${F.join("\x00")}\x00\x00${ae.join("\x00")}`,de=ku.get(ce);if(de!==void 0)return de;let le=!1;e:for(let ge of ae){if(mh(ge)===oe)continue;for(let ye of F)if(await r(rt.join(ge,ye))){le=!0;break e}}return ku.set(ce,le),le}function mh(v){let _=Eu.get(v);if(_!==void 0)return _;let k=v;try{k=bh.realpathSync(v)}catch{}return Eu.set(v,k),k}function Hc(v){return v==="visible"||v==="idle"||v==="interaction"||v.startsWith("media:")}function xi(v){if(!v)return!1;let _=v.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(_)}function f0(v,_,k){if(!v.includes("{{")&&!v.includes("{!!"))return v;let R=(T,B)=>{let z;try{z=x(T,_)}catch{return B}if(z===void 0||z===null)return"";let W=String(z);if(/<\/style/i.test(W))return console.warn(`[stx] a <style> expression in ${k??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return W};return v.replace(/\{!!([\s\S]*?)!!\}/g,(T,B)=>R(B,T)).replace(/\{\{([\s\S]*?)\}\}/g,(T,B)=>R(B,T))}var hh=new Set;function yh(v,_,k,R){let T=`${v}\x00${_}\x00${R??""}`;if(!process.env.STX_DEBUG&&hh.has(T))return;hh.add(T);let B=_?` used in ${_}`:"",z=R?` Cause: ${R}.`:"",W=k.length>0?`
2657
2657
  searched:
2658
2658
  ${k.map((F)=>` - ${F}`).join(`
2659
- `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function xh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Uc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function Ke(v,_,k,R,T,B,z,W=new Set,F,V=mr(T),H,q=v){let{extractVariables:Q}=await mt("stx/variable-extractor",()=>import("./chunk-tc5r2vmw.js")),Z=W??new Set;if(Z.has(v))return`[Circular component reference: ${v}]`;let ie=new Set(Z);ie.add(v);let oe=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ae=oe&&oe!=="load"&&Hc(oe)?oe:"";try{let ce=(nt)=>nt.split("-").map((at)=>at.charAt(0).toUpperCase()+at.slice(1)).join(""),de=q.endsWith(".stx")?q.slice(0,-4):q,le=null,ge=T.__importedComponents;if(ge){let nt=[de,de.toLowerCase(),ce(de),nn(de)];for(let at of nt)if(ge.has(at)){le=ge.get(at);break}}let ye=[];if(!le){let nt=[`${de}.stx`,`${ce(de)}.stx`,`${nn(de)}.stx`],at=[...new Set(nt)],bt=T.__originalFilePath,et=[];if(et.push(...z._layerComponentDirs??[]),bt){let jt=rt.join(rt.dirname(bt),"components");et.push(jt)}if(R)et.push(R);let Nt=z._rootComponentsDir;if(typeof Nt==="string"&&!et.includes(Nt))et.push(Nt);let Ut=rt.join(rt.dirname(B),"components");if(!et.includes(Ut))et.push(Ut);if(z.componentsDir&&z.componentsDir!==R&&!et.includes(z.componentsDir))et.push(z.componentsDir);for(let jt of z._targetComponentDirs??[])if(jt&&!et.includes(jt))et.push(jt);let rn=typeof z.root==="string"?rt.resolve(z.root):void 0,Vr=rn??rt.dirname(B),An=[];if(rn)An.push(rt.resolve(rn,"resources/views/components")),An.push(rt.resolve(rn,"resources/components")),An.push(rt.resolve(rn,"src/components")),An.push(rt.resolve(rn,"components"));An.push(rt.resolve(import.meta.dir,"components"));for(let jt of An)if(!et.includes(jt))et.push(jt);let vo=z._pluginComponentDirs;if(Array.isArray(vo)){for(let jt of vo)if(typeof jt==="string"&&!et.includes(jt))et.push(jt)}if(z.fallbackComponentsDir&&!et.includes(z.fallbackComponentsDir))et.push(z.fallbackComponentsDir);let $i=[...new Set(et.map((jt)=>{if(!jt)return jt;return rt.isAbsolute(jt)?jt:rt.resolve(Vr,jt)}))];et.length=0,et.push(...$i);let Ur=`${de}\x00${B}\x00${$i.join("\x00")}`,Hr=Pa.get(Ur);if(Hr)if(await r(Hr))le=Hr;else Pa.delete(Ur);if(!le&&(de.startsWith("./")||de.startsWith("../")))le=rt.resolve(rt.dirname(B),`${de}.stx`),ye.push(le);else if(!le)for(let jt of et){if(!jt)continue;for(let wo of at){let So=rt.join(jt,wo);if(ye.push(So),await r(So)){le=So;break}}if(le)break;if(!le)try{let wo=await import("fs");if(!wo.statSync(jt,{throwIfNoEntry:!1})?.isDirectory())continue;let Eh=8,ja=[{path:jt,depth:0}];while(ja.length>0&&!le){let $o=ja.pop();if($o.depth>=Eh)continue;let Au;try{Au=wo.readdirSync($o.path,{withFileTypes:!0})}catch{continue}for(let _o of Au){if(!_o.isDirectory())continue;if(_o.name==="node_modules"||_o.name.startsWith("."))continue;let Tu=rt.join($o.path,_o.name);for(let Ch of at){let La=rt.join(Tu,Ch);if(ye.push(La),await r(La)){le=La;break}}if(le)break;ja.push({path:Tu,depth:$o.depth+1})}}}catch{}if(le)break}if(le)Pa.set(Ur,le)}if(!le||!await r(le))return yh(v,B,ye),xh(v);F.add(le);let Se;if(mo.has(le))Se=mo.get(le);else try{Se=await Bun.file(le).text(),mo.set(le,Se)}catch(nt){let at=nt instanceof Error?nt.message:String(nt);return yh(v,B,[le],at),xh(v)}if(H)for(let nt of Object.keys(_)){let at=nt.toLowerCase();if(at.startsWith("aria-")||at.startsWith("data-"))continue;let bt=nt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${bt}\\b`).test(Se))H.declaredProps.add(nt)}let $e=new Set(["__originalFilePath","__importedComponents",Po,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[nt,at]of Object.entries(T))if(!nt.startsWith("__")||$e.has(nt))Re[nt]=at;let Ae=V.length>0?{[Bo]:[...V]}:{},Te=k;if(k.includes("@include")){let{processIncludes:nt}=await mt("stx/includes",()=>import("./chunk-n6qp05t9.js"));Te=await nt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Te)){let{processComponents:nt}=await mt("stx/component-renderer",()=>import("./chunk-y4ajd836.js"));Te=await nt(Te,{...T,__processedComponents:Z,...Ae},B,z,F)}let Ie=[];if(xi(Te)){let{processExpressions:nt}=await mt("stx/expressions",()=>import("./chunk-cgwyd9aq.js")),at=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ae}:V.length>0?{...T,...Ae}:T;Te=nt(Te,at,B);for(let bt of Te.matchAll(/\{\{([\s\S]*?)\}\}/g))Ie.push(bt[1].trim())}let _e=$n(Te),De=[],Ne=_e.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,at)=>{let bt=_e.scripts[Number(at)]||"",et=bt.match(/^<script\b([^>]*)>/i)?.[1]||"",Nt=et.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ut=!Nt||["module","text/javascript","application/javascript"].includes(Nt),rn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${et}`);if(!/\bserver\b/i.test(et)&&Ut&&!rn)return De.push(bt),"";return bt}),{extractSlotContent:Oe}=await mt("stx/slots",()=>import("./chunk-4wfr074d.js")),Pe=Oe(Ne),Le={};if(Pe.defaultSlot?.trim())Le.default=Pe.defaultSlot;for(let[nt,at]of Pe.namedSlots)Le[nt]=at.content;let ct=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},ft=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ct.n}_${ct.key}`,st={...Re,$uid:ft,..._,props:_,slot:Ne,$slots:Le,__processedComponents:ie,__sections:{},__stx_signals_gate:we(Se)||xi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Ie]};u0(Se,st);let pt=Se,lt=te(pt);if(lt)pt=lt.content.trim();let wt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,dt=[...Se.matchAll(wt)],St=[],gt=null,Ft=dt.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Pn=null,Rn=null,ut=null,ot=0,ht=null;if(r0(z),Ft&&Cu>0){let nt=s0({props:_,slot:Te,slotContext:k.trim()?i0(Re):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:z._layerGraph?.layers.map((at)=>at.configFile),uid:ft});if(nt!==null){Pn=`${le}\x00${h(Se)}\x00${nt}`;let at=Da.get(Pn);if(at){for(let bt of at.dependencies)F.add(bt);if(Gu(T,at.clientFactories),ct.n+=at.uidsConsumed,at.preservedClientExpressions.length>0){let bt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let et of at.preservedClientExpressions)bt.add(et);T.__stx_preserved_client_expressions=[...bt]}return at.output}Rn=new Set(F),ut=Xu(T),ot=ct.n,ht=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Lt=new Set;for(let nt of dt){let at=nt[1]||"",bt=nt[2]||"",et=at.includes("server");if(Ge(at)&&bt.trim())bt=Xe(bt);if(et&&bt){for(let Ut of ne(bt))Lt.add(Ut);try{await Q(bt,st,le,{onFailure:(Ut)=>{if(Ut.kind!=="unknown")gt=Ut.kind}})}catch(Ut){}}if(!et){let Ut=bt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),rn=Ut.includes("{{")&&Ut.includes("}}"),Vr=Ut.includes("{!!")&&Ut.includes("!!}");if(rn||Vr)Ut=os(Ut,st,le);let An=at.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");St.push(`<script${An}>${Ut}</script>`)}}let Jt=$n(Se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),vn=Jt?Jt[1]:"",Ma=Jt?Jt[2]:"",Bn="",Oa=vn&&/\bscoped\b/i.test(vn);if(Jt)Bn=`<style${vn}>${f0(Ma,st,le)}</style>`;let Me=pt;if(Me=Me.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Jt)Me=Me.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,at=[];if(Me=Me.replace(nt,(bt,et)=>{let Nt=et.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Nt)at.push(`<style${Nt[1]}>${Nt[2]}</style>`);return""}),Me=Me.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),at.length>0)Bn=`${Bn}${at.join(`
2660
- `)}`}if(k&&Me.includes("{{ text || slot }}"))Me=Me.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ze}=await mt("stx/slots",()=>import("./chunk-4wfr074d.js")),{defaultSlot:it,namedSlots:xt}=Pe,Mt=St.some((nt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(nt)),Kt=(nt)=>Mt?Lm(nt,ft):nt,Wr=new Map([...xt].map(([nt,at])=>[nt,{...at,content:Kt(at.content)}]));Me=await Ze(Me,Kt(it),Wr,st);let Na=Uc(St),yo=(Array.isArray(st.__stx_client_signal_names)?st.__stx_client_signal_names:[]).filter((nt)=>!Lt.has(nt));if(Na.length>0||yo.length>0)st.__stx_client_signal_names=[...new Set([...yo,...Na])];else delete st.__stx_client_signal_names;let xo=V.filter((nt)=>!Lt.has(nt)&&!(nt in _));if(xo.length>0)st[Bo]=xo;let bo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:rt.dirname(le),skipSignalsRuntime:!0,skipEventDirectives:Mt||St.length===0,defaultLayout:void 0};st.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let fr=await n(Me,st,le,bo,F),Fr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of fr.matchAll(/\{\{([\s\S]*?)\}\}/g))Fr.add(nt[1].trim());if(Fr.size>0)T.__stx_preserved_client_expressions=[...Fr];let zn=ft,Yt=fr;if(Mt){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${ph(JSON.stringify(_))}"`}catch{}let at=ae?` stx-hydrate="${ph(ae)}"`:"",bt=` data-stx-scope="${zn}"${nt}${at}`,et=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(fr),Nt=et?"span":"div";Yt=zc(fr,bt)??`<${Nt}${bt} data-stx-component-wrapper${et?' style="display:contents"':""}>${fr}</${Nt}>`;let Ut=await Promise.all(St.map(async(rn)=>{let Vr=rn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Vr)return rn;let[,An,vo]=Vr,{vendorStyleTags:$i,factoryBody:Ur}=await m0(vo,le,z.buildMode==="compile"),Hr=ae?null:qa(T,Ur),jt=Hr?`window.__stxComponentFactories[${JSON.stringify(Hr)}](${JSON.stringify(zn)});`:`(${Ur})(${JSON.stringify(zn)});`;if(ae)return`${$i}<script type="stx/island" data-stx-island="${zn}" data-stx-scoped data-stx-owner="${zn}"${An}>${jt}</script>`;return`${$i}<script data-stx-scoped data-stx-run="always" data-stx-owner="${zn}"${An}>${jt}</script>`}));if(Yt=Yt+`
2661
- `+Ut.join(`
2659
+ `)}`:"";console.error(`[stx] component <${v}> could not be resolved${B}, so it rendered as nothing.${z}${W}`)}function xh(v){return`<!-- stx: component "${v.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function Uc(v){let _=new Set,k=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let R of v){let T;while((T=k.exec(R))!==null)_.add(T[1]);k.lastIndex=0}return[..._]}async function Ke(v,_,k,R,T,B,z,W=new Set,F,V=mr(T),H,q=v){let{extractVariables:Q}=await mt("stx/variable-extractor",()=>import("./chunk-t0zdz8kd.js")),Z=W??new Set;if(Z.has(v))return`[Circular component reference: ${v}]`;let ie=new Set(Z);ie.add(v);let oe=typeof _.client==="string"?_.client.trim():"";if("client"in _)delete _.client;let ae=oe&&oe!=="load"&&Hc(oe)?oe:"";try{let ce=(nt)=>nt.split("-").map((at)=>at.charAt(0).toUpperCase()+at.slice(1)).join(""),de=q.endsWith(".stx")?q.slice(0,-4):q,le=null,ge=T.__importedComponents;if(ge){let nt=[de,de.toLowerCase(),ce(de),rn(de)];for(let at of nt)if(ge.has(at)){le=ge.get(at);break}}let ye=[];if(!le){let nt=[`${de}.stx`,`${ce(de)}.stx`,`${rn(de)}.stx`],at=[...new Set(nt)],bt=T.__originalFilePath,et=[];if(et.push(...z._layerComponentDirs??[]),bt){let jt=rt.join(rt.dirname(bt),"components");et.push(jt)}if(R)et.push(R);let Nt=z._rootComponentsDir;if(typeof Nt==="string"&&!et.includes(Nt))et.push(Nt);let Ht=rt.join(rt.dirname(B),"components");if(!et.includes(Ht))et.push(Ht);if(z.componentsDir&&z.componentsDir!==R&&!et.includes(z.componentsDir))et.push(z.componentsDir);for(let jt of z._targetComponentDirs??[])if(jt&&!et.includes(jt))et.push(jt);let bn=typeof z.root==="string"?rt.resolve(z.root):void 0,Vr=bn??rt.dirname(B),An=[];if(bn)An.push(rt.resolve(bn,"resources/views/components")),An.push(rt.resolve(bn,"resources/components")),An.push(rt.resolve(bn,"src/components")),An.push(rt.resolve(bn,"components"));An.push(rt.resolve(import.meta.dir,"components"));for(let jt of An)if(!et.includes(jt))et.push(jt);let vo=z._pluginComponentDirs;if(Array.isArray(vo)){for(let jt of vo)if(typeof jt==="string"&&!et.includes(jt))et.push(jt)}if(z.fallbackComponentsDir&&!et.includes(z.fallbackComponentsDir))et.push(z.fallbackComponentsDir);let $i=[...new Set(et.map((jt)=>{if(!jt)return jt;return rt.isAbsolute(jt)?jt:rt.resolve(Vr,jt)}))];et.length=0,et.push(...$i);let Ur=`${de}\x00${B}\x00${$i.join("\x00")}`,Hr=Pa.get(Ur);if(Hr)if(await r(Hr))le=Hr;else Pa.delete(Ur);if(!le&&(de.startsWith("./")||de.startsWith("../")))le=rt.resolve(rt.dirname(B),`${de}.stx`),ye.push(le);else if(!le)for(let jt of et){if(!jt)continue;for(let wo of at){let So=rt.join(jt,wo);if(ye.push(So),await r(So)){le=So;break}}if(le)break;if(!le)try{let wo=await import("fs");if(!wo.statSync(jt,{throwIfNoEntry:!1})?.isDirectory())continue;let Eh=8,ja=[{path:jt,depth:0}];while(ja.length>0&&!le){let $o=ja.pop();if($o.depth>=Eh)continue;let Au;try{Au=wo.readdirSync($o.path,{withFileTypes:!0})}catch{continue}for(let _o of Au){if(!_o.isDirectory())continue;if(_o.name==="node_modules"||_o.name.startsWith("."))continue;let Tu=rt.join($o.path,_o.name);for(let Ch of at){let La=rt.join(Tu,Ch);if(ye.push(La),await r(La)){le=La;break}}if(le)break;ja.push({path:Tu,depth:$o.depth+1})}}}catch{}if(le)break}if(le)Pa.set(Ur,le)}if(!le||!await r(le))return yh(v,B,ye),xh(v);F.add(le);let Se;if(mo.has(le))Se=mo.get(le);else try{Se=await Bun.file(le).text(),mo.set(le,Se)}catch(nt){let at=nt instanceof Error?nt.message:String(nt);return yh(v,B,[le],at),xh(v)}if(H)for(let nt of Object.keys(_)){let at=nt.toLowerCase();if(at.startsWith("aria-")||at.startsWith("data-"))continue;let bt=nt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${bt}\\b`).test(Se))H.declaredProps.add(nt)}let $e=new Set(["__originalFilePath","__importedComponents",Po,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Re={};for(let[nt,at]of Object.entries(T))if(!nt.startsWith("__")||$e.has(nt))Re[nt]=at;let Ae=V.length>0?{[Bo]:[...V]}:{},Te=k;if(k.includes("@include")){let{processIncludes:nt}=await mt("stx/includes",()=>import("./chunk-bkj0j5se.js"));Te=await nt(k,T,B,z,F)}if(/<[A-Z][\w.-]*[\s/>]/.test(Te)){let{processComponents:nt}=await mt("stx/component-renderer",()=>import("./chunk-xy6g8zb9.js"));Te=await nt(Te,{...T,__processedComponents:Z,...Ae},B,z,F)}let Ie=[];if(xi(Te)){let{processExpressions:nt}=await mt("stx/expressions",()=>import("./chunk-cr67dpx4.js")),at=T.__stx_signals_gate===void 0?{...T,__stx_signals_gate:!0,...Ae}:V.length>0?{...T,...Ae}:T;Te=nt(Te,at,B);for(let bt of Te.matchAll(/\{\{([\s\S]*?)\}\}/g))Ie.push(bt[1].trim())}let _e=$n(Te),De=[],Ne=_e.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(nt,at)=>{let bt=_e.scripts[Number(at)]||"",et=bt.match(/^<script\b([^>]*)>/i)?.[1]||"",Nt=et.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ht=!Nt||["module","text/javascript","application/javascript"].includes(Nt),bn=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${et}`);if(!/\bserver\b/i.test(et)&&Ht&&!bn)return De.push(bt),"";return bt}),{extractSlotContent:Oe}=await mt("stx/slots",()=>import("./chunk-vn7tc8hm.js")),Pe=Oe(Ne),Le={};if(Pe.defaultSlot?.trim())Le.default=Pe.defaultSlot;for(let[nt,at]of Pe.namedSlots)Le[nt]=at.content;let ct=T.__stx_scope_seq??={n:0,key:Bun.hash(String(T.__filename??B)).toString(36).slice(0,6)},ft=`stx_${(v.endsWith(".stx")?v.slice(0,-4):v).replace(/[^a-zA-Z0-9]/g,"_")}_${++ct.n}_${ct.key}`,st={...Re,$uid:ft,..._,props:_,slot:Ne,$slots:Le,__processedComponents:ie,__sections:{},__stx_signals_gate:we(Se)||xi(k),__stx_preserved_client_expressions:[...Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[],...Ie]};u0(Se,st);let pt=Se,ut=te(pt);if(ut)pt=ut.content.trim();let wt=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,dt=[...Se.matchAll(wt)],St=[],gt=null,Vt=dt.some((nt)=>/\bserver\b/.test(nt[1]||"")&&/\bcache\b/.test(nt[1]||"")),Pn=null,Rn=null,lt=null,ot=0,ht=null;if(r0(z),Vt&&Cu>0){let nt=s0({props:_,slot:Te,slotContext:k.trim()?i0(Re):void 0,buildMode:z.buildMode??"",skipEventDirectives:z.skipEventDirectives===!0,clientLoopNames:[...V].sort(),layers:z._layerGraph?.layers.map((at)=>at.configFile),uid:ft});if(nt!==null){Pn=`${le}\x00${h(Se)}\x00${nt}`;let at=Da.get(Pn);if(at){for(let bt of at.dependencies)F.add(bt);if(Gu(T,at.clientFactories),ct.n+=at.uidsConsumed,at.preservedClientExpressions.length>0){let bt=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let et of at.preservedClientExpressions)bt.add(et);T.__stx_preserved_client_expressions=[...bt]}return at.output}Rn=new Set(F),lt=Xu(T),ot=ct.n,ht=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[])}}let Lt=new Set;for(let nt of dt){let at=nt[1]||"",bt=nt[2]||"",et=at.includes("server");if(Ge(at)&&bt.trim())bt=Xe(bt);if(et&&bt){for(let Ht of ne(bt))Lt.add(Ht);try{await Q(bt,st,le,{onFailure:(Ht)=>{if(Ht.kind!=="unknown")gt=Ht.kind}})}catch(Ht){}}if(!et){let Ht=bt.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),bn=Ht.includes("{{")&&Ht.includes("}}"),Vr=Ht.includes("{!!")&&Ht.includes("!!}");if(bn||Vr)Ht=os(Ht,st,le);let An=at.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");St.push(`<script${An}>${Ht}</script>`)}}let Ut=$n(Se).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),tn=Ut?Ut[1]:"",Ma=Ut?Ut[2]:"",Bn="",Oa=tn&&/\bscoped\b/i.test(tn);if(Ut)Bn=`<style${tn}>${f0(Ma,st,le)}</style>`;let Me=pt;if(Me=Me.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ut)Me=Me.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let nt=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,at=[];if(Me=Me.replace(nt,(bt,et)=>{let Nt=et.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Nt)at.push(`<style${Nt[1]}>${Nt[2]}</style>`);return""}),Me=Me.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),at.length>0)Bn=`${Bn}${at.join(`
2660
+ `)}`}if(k&&Me.includes("{{ text || slot }}"))Me=Me.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>k);let{applySlots:Ze}=await mt("stx/slots",()=>import("./chunk-vn7tc8hm.js")),{defaultSlot:it,namedSlots:xt}=Pe,Mt=St.some((nt)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(nt)),Xt=(nt)=>Mt?Lm(nt,ft):nt,Wr=new Map([...xt].map(([nt,at])=>[nt,{...at,content:Xt(at.content)}]));Me=await Ze(Me,Xt(it),Wr,st);let Na=Uc(St),yo=(Array.isArray(st.__stx_client_signal_names)?st.__stx_client_signal_names:[]).filter((nt)=>!Lt.has(nt));if(Na.length>0||yo.length>0)st.__stx_client_signal_names=[...new Set([...yo,...Na])];else delete st.__stx_client_signal_names;let xo=V.filter((nt)=>!Lt.has(nt)&&!(nt in _));if(xo.length>0)st[Bo]=xo;let bo={...z,_rootComponentsDir:z._rootComponentsDir||z.componentsDir,componentsDir:rt.dirname(le),skipSignalsRuntime:!0,skipEventDirectives:Mt||St.length===0,defaultLayout:void 0};st.__stxProcessingDepth=(T.__stxProcessingDepth||0)+1;let fr=await n(Me,st,le,bo,F),Fr=new Set(Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[]);for(let nt of fr.matchAll(/\{\{([\s\S]*?)\}\}/g))Fr.add(nt[1].trim());if(Fr.size>0)T.__stx_preserved_client_expressions=[...Fr];let zn=ft,Yt=fr;if(Mt){let nt="";if(Object.keys(_).length>0)try{nt=` data-stx-props="${ph(JSON.stringify(_))}"`}catch{}let at=ae?` stx-hydrate="${ph(ae)}"`:"",bt=` data-stx-scope="${zn}"${nt}${at}`,et=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(fr),Nt=et?"span":"div";Yt=zc(fr,bt)??`<${Nt}${bt} data-stx-component-wrapper${et?' style="display:contents"':""}>${fr}</${Nt}>`;let Ht=await Promise.all(St.map(async(bn)=>{let Vr=bn.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Vr)return bn;let[,An,vo]=Vr,{vendorStyleTags:$i,factoryBody:Ur}=await m0(vo,le,z.buildMode==="compile"),Hr=ae?null:qa(T,Ur),jt=Hr?`window.__stxComponentFactories[${JSON.stringify(Hr)}](${JSON.stringify(zn)});`:`(${Ur})(${JSON.stringify(zn)});`;if(ae)return`${$i}<script type="stx/island" data-stx-island="${zn}" data-stx-scoped data-stx-owner="${zn}"${An}>${jt}</script>`;return`${$i}<script data-stx-scoped data-stx-run="always" data-stx-owner="${zn}"${An}>${jt}</script>`}));if(Yt=Yt+`
2661
+ `+Ht.join(`
2662
2662
  `),Bn)Yt+=`
2663
2663
  `+Bn}else{if(Bn)Yt+=`
2664
2664
  `+Bn;if(St.length>0){let nt=st.__stx_event_bindings||[],at=Fe(st),bt=await Promise.all(St.map(async(et)=>{let Nt=et.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Nt)return et;return await be(Nt[1],{eventBindings:nt,templateContent:Yt,filePath:le,projectRoot:process.cwd(),serverData:at,instanceId:ft})}));Yt+=`
2665
2665
  `+bt.join(`
2666
- `),st.__stx_event_bindings=[]}}if(Oa){let nt=Vo(Yt,le);if(nt.hasScoped)Yt=nt.html}if(Pn&&Rn){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Da.set(Pn,{output:Yt,dependencies:[...F].filter((at)=>!Rn.has(at)),clientFactories:ut?Zu(T,ut):[],uidsConsumed:ct.n-ot,preservedClientExpressions:ht?nt.filter((at)=>!ht.has(at)):[]})}if(gt)Yt=`<!--stx-render-failed:${gt}-->${Yt}`;return De.length>0?`${Yt}
2666
+ `),st.__stx_event_bindings=[]}}if(Oa){let nt=Vo(Yt,le);if(nt.hasScoped)Yt=nt.html}if(Pn&&Rn){let nt=Array.isArray(T.__stx_preserved_client_expressions)?T.__stx_preserved_client_expressions:[];Da.set(Pn,{output:Yt,dependencies:[...F].filter((at)=>!Rn.has(at)),clientFactories:lt?Zu(T,lt):[],uidsConsumed:ct.n-ot,preservedClientExpressions:ht?nt.filter((at)=>!ht.has(at)):[]})}if(gt)Yt=`<!--stx-render-failed:${gt}-->${Yt}`;return De.length>0?`${Yt}
2667
2667
  ${De.join(`
2668
2668
  `)}`:Yt}catch(ce){return`[Error processing component: ${ce instanceof Error?ce.message:String(ce)}]`}finally{Z.delete(v)}}async function r(v){return Bun.file(v).exists()}function Ru(v,_){let k=rt.resolve(_),R=rt.resolve(v),T=k.endsWith(rt.sep)?k:k+rt.sep;if(R===k||R.startsWith(T))return R;return null}async function p0(v,_,k,R){let T=_.startsWith("layouts/")?_.slice(8):_,B=rt.join(v,T);for(let z of B.endsWith(".stx")?[B]:[B,`${B}.stx`])if(await r(z)){if(R)console.log(`Found layout in ${v}: ${z}`);return k?.add(z),z}return null}async function Qn(v,_,k,R){let T=await g0(v,_,k,R);if(T===null)return null;let B=Ru(T,process.cwd());if(B)return B;let z=[k.root,k.layoutsDir,k.fallbackLayoutsDir,k.componentsDir,k.partialsDir,k.pagesDir,...k._layerLayoutDirs??[]].filter((W)=>typeof W==="string"&&W.length>0);for(let W of z){let F=rt.isAbsolute(W)?W:rt.resolve(process.cwd(),W);if(Ru(T,F))return rt.resolve(T)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${T} (template: ${v}, from: ${_})`),null}async function g0(v,_,k,R){if(k.debug)console.log(`Resolving template path: ${v} from ${_}`);let T=rt.dirname(_),B=process.cwd();if(v.startsWith("/")){let Q=rt.join(B,v),Z=Ru(Q,B);if(!Z)return console.warn(`[stx] rejected template path that escapes project root: ${v} (from ${_})`),null;if(k.debug)console.log(`Checking absolute path: ${Z}`);if(await r(Z)&&R)R.add(Z);return Z}let z=rt.join(T,v);if(await r(z)){if(k.debug)console.log(`Found direct path: ${z}`);if(R)R.add(z);return z}if(!v.endsWith(".stx")&&!v.endsWith(".jsx")&&!v.endsWith(".tsx"))for(let Q of[".stx",".tsx",".jsx"]){let Z=`${z}${Q}`;if(await r(Z)){if(k.debug)console.log(`Found direct path with extension: ${Z}`);if(R)R.add(Z);return Z}}let W=[];if(W.push(...k._layerLayoutDirs??[]),k.layoutsDir)W.push(rt.isAbsolute(k.layoutsDir)?k.layoutsDir:rt.resolve(process.cwd(),k.layoutsDir));let F=rt.resolve(T),V=process.cwd();for(let Q=0;Q<10;Q++){let Z=rt.join(F,"layouts"),ie=!1;try{ie=bh.statSync(Z,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(ie){W.push(Z);break}let oe=rt.dirname(F);if(oe===F||oe.length<V.length)break;F=oe}for(let Q of W){let Z=await p0(Q,v,R,k.debug);if(Z)return Z}if(k.fallbackLayoutsDir){let Q=rt.isAbsolute(k.fallbackLayoutsDir)?k.fallbackLayoutsDir:rt.resolve(process.cwd(),k.fallbackLayoutsDir),Z=v.startsWith("layouts/")?v.slice(8):v,ie=[rt.join(Q,Z)];if(!v.endsWith(".stx"))ie.push(`${ie[0]}.stx`);for(let oe of ie)if(await r(oe)){if(k.debug)console.log(`Found in options.fallbackLayoutsDir: ${oe}`);if(R)R.add(oe);return oe}}if(v.startsWith("layouts/")||v.includes("/layouts/")){let Q=v.split("layouts/"),Z=rt.join(k.partialsDir||T,"layouts",Q[1]);if(await r(Z)){if(k.debug)console.log(`Found in layouts path: ${Z}`);if(R)R.add(Z);return Z}if(!Z.endsWith(".stx")){let ie=`${Z}.stx`;if(await r(ie)){if(k.debug)console.log(`Found in layouts path with extension: ${ie}`);if(R)R.add(ie);return ie}}}if(k.partialsDir){let Q=rt.join(k.partialsDir,"layouts");if(await r(Q)){let Z=rt.join(Q,v);if(await r(Z)){if(k.debug)console.log(`Found in partials layouts dir: ${Z}`);if(R)R.add(Z);return Z}if(!v.endsWith(".stx")){let ie=`${Z}.stx`;if(await r(ie)){if(k.debug)console.log(`Found in partials layouts dir with extension: ${ie}`);if(R)R.add(ie);return ie}}}}let H=k.partialsDir||rt.join(process.cwd(),"views"),q=rt.join(H,v);if(await r(q)){if(k.debug)console.log(`Found in views path: ${q}`);if(R)R.add(q);return q}if(!v.endsWith(".stx")){let Q=`${q}.stx`;if(await r(Q)){if(k.debug)console.log(`Found in views path with extension: ${Q}`);if(R)R.add(Q);return Q}}if(T.includes("temp")){let Q=rt.join(rt.dirname(T),"layouts",v);if(await r(Q)){if(k.debug)console.log(`Found in temp layouts dir: ${Q}`);if(R)R.add(Q);return Q}if(!v.endsWith(".stx")){let Z=`${Q}.stx`;if(await r(Z)){if(k.debug)console.log(`Found in temp layouts dir with extension: ${Z}`);if(R)R.add(Z);return Z}}}if(k.debug)console.warn(`Template not found after trying all paths: ${v} (referenced from ${_})`);else console.warn(`Template not found: ${v} (referenced from ${_})`);return null}function Si(v,_,k){let R=0,T="",B="";try{if(typeof _==="number"&&_>=0){let z=v.split(`
2669
2669
  `),W=0;for(let F=0;F<z.length;F++)if(W+=z[F].length+1,W>=_){R=F+1,T=z[F].trim();let V=Math.max(0,F-2),H=Math.min(z.length,F+3);B=z.slice(V,H).map((q,Q)=>{let Z=V+Q+1;return`${Z===R?"> ":" "}${Z}: ${q}`}).join(`
@@ -2680,7 +2680,7 @@ ${vt.yellow}${vt.bold}Message:${vt.reset} ${_}
2680
2680
  `,W)H+=`
2681
2681
  ${vt.blue}${vt.bold}Context:${vt.reset}
2682
2682
  ${vt.dim}${W}${vt.reset}
2683
- `;return H}function re(){mo.clear(),Pa.clear(),ku.clear(),Eu.clear(),Da.clear()}function ou(){return{size:mo.size,maxSize:500}}var _u=m(128);async function m0(v,_,k){let R=h(v,_,k),T=_u.get(R);if(T){if(sn(T.deps))return T;_u.delete(R)}let B=es(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=ts(B.styles);z=kt(z).code;let{hasUserImports:F,bundleClientScript:V}=await mt("stx/client-script-bundler",()=>import("./chunk-m6mxqepz.js")),H=[],q=!1;if(F(z)){let ce=z;z=await V(ce,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ce}let{stripStxRuntimeImports:Q}=await mt("stx/signal-processing",()=>import("./chunk-3gft8zng.js"));z=Q(z);let Z=O(z),ie=a0(Z),oe=`function(__scopeId) {
2683
+ `;return H}function re(){mo.clear(),Pa.clear(),ku.clear(),Eu.clear(),Da.clear()}function ou(){return{size:mo.size,maxSize:500}}var _u=m(128);async function m0(v,_,k){let R=h(v,_,k),T=_u.get(R);if(T){if(sn(T.deps))return T;_u.delete(R)}let B=es(v,{filePath:_,projectRoot:process.cwd()}),z=B.code,W=ts(B.styles);z=kt(z).code;let{hasUserImports:F,bundleClientScript:V}=await mt("stx/client-script-bundler",()=>import("./chunk-1btr5tme.js")),H=[],q=!1;if(F(z)){let ce=z;z=await V(ce,_,{projectRoot:process.cwd(),minify:k,collectInputs:H}),q=z===ce}let{stripStxRuntimeImports:Q}=await mt("stx/signal-processing",()=>import("./chunk-hm4j4d8q.js"));z=Q(z);let Z=O(z),ie=a0(Z),oe=`function(__scopeId) {
2684
2684
  ${Dt("const",[...Fi,...ie],Z)}
2685
2685
  const __scope = window.stx._scopes = window.stx._scopes || {};
2686
2686
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -2807,7 +2807,7 @@ else {
2807
2807
  // STX: auto-generated event bindings
2808
2808
  ${v.map((k,R)=>D0(k,R)).join(`
2809
2809
  `)}`}function _h(v){let _=[],k=new Set,R=v.replace(/^\s*import\s+.*$/gm,""),T=0,B=R.length,z=0;while(z<B){let W=R[z];if(W==="'"||W==='"'||W==="`"){let F=W;if(z++,F==="`"){let V=0;while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]==="`"&&V===0){z++;break}if(R[z]==="$"&&R[z+1]==="{"){V++,z+=2;continue}if(R[z]==="}"&&V>0){V--,z++;continue}z++}}else while(z<B){if(R[z]==="\\"){z+=2;continue}if(R[z]===F){z++;break}z++}continue}if(W==="/"&&R[z+1]==="/"){while(z<B&&R[z]!==`
2810
- `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let Q=V[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let Z=Q.trim(),ie=Z.indexOf(":"),oe=ie>=0?Z.slice(ie+1).trim().split(/[\s=]/)[0]:Z.split(/[\s=]/)[0];if(oe&&!oe.startsWith("_")&&!k.has(oe))_.push(oe),k.add(oe)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var O0=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 N0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let Z;while((Z=k.exec(Q))!==null){let ie=Z[0];if(!O0.has(ie))_.add(ie)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=V.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function be(v,_={}){let k=v,R="",T=!1,B=[],z=es(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=ts(z.styles),F=kt(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await mt("stx/client-script-bundler",()=>import("./chunk-m6mxqepz.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let le=Jo(k);k=le.code,R=Yo(le.stxImports,le.browserImports.filter((ge)=>!B.includes(ge)))}if(R=`${rs(k,_.serverData)}${R}`,k=O(k),!T&&Ge(_.attrs||""))k=Xe(k);let q=M0(_.eventBindings||[]),Q=(_.attrs||"").trim(),Z=/\btype\s*=\s*["']module["']/i.test(Q),ie=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(Z){let le=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ge=`type="module" data-stx-scoped${ie}${le?` ${le}`:""}`;return`${W}<script ${ge}>
2810
+ `)z++;continue}if(W==="/"&&R[z+1]==="*"){z+=2;while(z<B-1&&!(R[z]==="*"&&R[z+1]==="/"))z++;z+=2;continue}if(W==="{"){T++,z++;continue}if(W==="}"){T--,z++;continue}if(T===0){let F=R.slice(z),V=F.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(V){let Q=V[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=V[0].length;continue}let H=F.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((Q)=>{let Z=Q.trim(),ie=Z.indexOf(":"),oe=ie>=0?Z.slice(ie+1).trim().split(/[\s=]/)[0]:Z.split(/[\s=]/)[0];if(oe&&!oe.startsWith("_")&&!k.has(oe))_.push(oe),k.add(oe)}),z+=H[0].length;continue}let q=F.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(q){let Q=q[1];if(!Q.startsWith("_")&&!k.has(Q))_.push(Q),k.add(Q);z+=q[0].length;continue}}z++}return _}var O0=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 N0(v){let _=new Set,k=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function R(Q){let Z;while((Z=k.exec(Q))!==null){let ie=Z[0];if(!O0.has(ie))_.add(ie)}}let T=/\{\{([\s\S]*?)\}\}/g,B;while((B=T.exec(v))!==null)R(B[1]);let z=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((B=z.exec(v))!==null)R(B[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((B=W.exec(v))!==null)R(B[1]);let F=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((B=F.exec(v))!==null)R(B[1]);let V=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((B=V.exec(v))!==null)R(B[1]);let H=/@model\s*=\s*["']([^"']*)["']/gi;while((B=H.exec(v))!==null)R(B[1]);let q=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((B=q.exec(v))!==null)R(B[1]);return _}async function be(v,_={}){let k=v,R="",T=!1,B=[],z=es(k,{filePath:_.filePath,projectRoot:_.projectRoot});k=z.code;let W=ts(z.styles),F=kt(k);k=F.code,B=[...F.imports,...F.models];let{hasUserImports:V,bundleClientScript:H}=await mt("stx/client-script-bundler",()=>import("./chunk-1btr5tme.js"));if(V(k))k=await H(k,_.filePath||"",{projectRoot:_.projectRoot,minify:_.production}),T=!0;if(_.autoImports!==!1){let le=Jo(k);k=le.code,R=Yo(le.stxImports,le.browserImports.filter((ge)=>!B.includes(ge)))}if(R=`${rs(k,_.serverData)}${R}`,k=O(k),!T&&Ge(_.attrs||""))k=Xe(k);let q=M0(_.eventBindings||[]),Q=(_.attrs||"").trim(),Z=/\btype\s*=\s*["']module["']/i.test(Q),ie=_.instanceId?` data-stx-instance="${_.instanceId}"`:"";if(Z){let le=Q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ge=`type="module" data-stx-scoped${ie}${le?` ${le}`:""}`;return`${W}<script ${ge}>
2811
2811
  ${Js(`${R}${k}
2812
2812
  ${q}`)}
2813
2813
  </script>`}let oe=Us(v),ae=/function __stx_setup_/.test(k),ce=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(v);function de(le){let ge=le.length>0?`