@stacksjs/stx 0.2.765 → 0.2.769

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 (182) hide show
  1. package/dist/chunk-096g00ba.js +2 -0
  2. package/dist/chunk-0ga7sn1k.js +2 -0
  3. package/dist/{chunk-4tppbw4r.js → chunk-0hf0mtaf.js} +2 -2
  4. package/dist/{chunk-31e7xkrt.js → chunk-0nhk9p9r.js} +1 -1
  5. package/dist/{chunk-scq0h2cs.js → chunk-1a4vpk9x.js} +2 -2
  6. package/dist/{chunk-zfaa5xn5.js → chunk-1e67szzk.js} +4 -4
  7. package/dist/chunk-1nzg53pv.js +2 -0
  8. package/dist/chunk-1respkkp.js +2 -0
  9. package/dist/{chunk-w2nzevn0.js → chunk-20dsfgmq.js} +1 -1
  10. package/dist/{chunk-6h6teyxp.js → chunk-2bb4g9qr.js} +2 -2
  11. package/dist/{chunk-ftt3r7wh.js → chunk-2w16z2y1.js} +2 -2
  12. package/dist/{chunk-4yk7zngj.js → chunk-30kemrry.js} +5 -5
  13. package/dist/{chunk-51dxp9w9.js → chunk-33jagtss.js} +2 -2
  14. package/dist/{chunk-as4s0nf5.js → chunk-342e6mhn.js} +3 -3
  15. package/dist/{chunk-n8gfetjx.js → chunk-3g8cnsbk.js} +2 -2
  16. package/dist/chunk-3k6tem86.js +2 -0
  17. package/dist/chunk-3pma2q0h.js +2 -0
  18. package/dist/chunk-4cr8bep2.js +2 -0
  19. package/dist/chunk-4ew0291t.js +2 -0
  20. package/dist/{chunk-qv2k0qb1.js → chunk-4qrr2mdd.js} +50 -49
  21. package/dist/{chunk-et831a4y.js → chunk-4rtr07x9.js} +2 -2
  22. package/dist/{chunk-8zgvr0fw.js → chunk-528b302x.js} +3 -3
  23. package/dist/{chunk-6jnrpnxb.js → chunk-586xes7a.js} +2 -2
  24. package/dist/{chunk-rv0yth27.js → chunk-5fab5wt2.js} +2 -2
  25. package/dist/chunk-5ftthxab.js +2 -0
  26. package/dist/{chunk-7aw9qm74.js → chunk-5q97egpw.js} +5 -5
  27. package/dist/chunk-5wp7s24b.js +3 -0
  28. package/dist/{chunk-1w4a0xya.js → chunk-7s9wx19m.js} +3 -3
  29. package/dist/{chunk-mdtjjzqc.js → chunk-7vqq2w3x.js} +2 -2
  30. package/dist/{chunk-3mf27gj6.js → chunk-80gg1k0h.js} +2 -2
  31. package/dist/{chunk-49w4cbqb.js → chunk-8x4gmead.js} +5 -5
  32. package/dist/{chunk-bnwkytme.js → chunk-90n5kb78.js} +3 -3
  33. package/dist/chunk-9v21mwfs.js +2 -0
  34. package/dist/{chunk-vy1weqvj.js → chunk-9y6hbdfh.js} +4 -4
  35. package/dist/{chunk-ay5g5cbk.js → chunk-a81m2ewb.js} +2 -2
  36. package/dist/chunk-b6kfq08s.js +2 -0
  37. package/dist/chunk-b94xf9vs.js +2 -0
  38. package/dist/chunk-bjggcj45.js +2 -0
  39. package/dist/chunk-bk3b5jyw.js +2 -0
  40. package/dist/chunk-bntw35k0.js +2 -0
  41. package/dist/chunk-bt01gdaj.js +2 -0
  42. package/dist/chunk-ctmadzad.js +2 -0
  43. package/dist/chunk-cwmjqker.js +2 -0
  44. package/dist/{chunk-c5mbhfff.js → chunk-cyd10m6m.js} +3 -3
  45. package/dist/{chunk-ay02q27h.js → chunk-cz3trbvn.js} +6 -6
  46. package/dist/{chunk-p42kp93g.js → chunk-dbpzrkmj.js} +1 -1
  47. package/dist/chunk-dbx628ra.js +2 -0
  48. package/dist/{chunk-cswar3zs.js → chunk-ddpt7ejx.js} +3 -3
  49. package/dist/chunk-ddwsms1t.js +2 -0
  50. package/dist/chunk-dpjf62qw.js +2 -0
  51. package/dist/chunk-e4bsnxsj.js +2 -0
  52. package/dist/{chunk-t6d7m4tf.js → chunk-ecakhzkq.js} +7 -7
  53. package/dist/{chunk-z6sg0dq3.js → chunk-enzrpxsj.js} +2 -2
  54. package/dist/chunk-f8jwrvky.js +2 -0
  55. package/dist/{chunk-8hanmv49.js → chunk-fxy7jjnv.js} +29 -2
  56. package/dist/{chunk-xcstrdhp.js → chunk-ggvnmmv3.js} +2 -2
  57. package/dist/chunk-h8yy3y3p.js +2 -0
  58. package/dist/chunk-hddwx35m.js +2 -0
  59. package/dist/{chunk-mpaepc7n.js → chunk-hpdb8vkt.js} +78 -8
  60. package/dist/{chunk-kwy0spcd.js → chunk-hxyarbb6.js} +1 -1
  61. package/dist/chunk-hyqsvw1b.js +2 -0
  62. package/dist/{chunk-stww901w.js → chunk-j34wqxb1.js} +5 -5
  63. package/dist/{chunk-fta169tc.js → chunk-j5dd5ncz.js} +2 -2
  64. package/dist/chunk-j835421z.js +2 -0
  65. package/dist/{chunk-0d29b573.js → chunk-jd84zgn3.js} +2 -2
  66. package/dist/{chunk-dxk5r71v.js → chunk-jgmmg2fw.js} +4 -4
  67. package/dist/{chunk-74y29xxs.js → chunk-knvt4bap.js} +4 -4
  68. package/dist/{chunk-8prk7e1z.js → chunk-mg38q3jh.js} +5 -5
  69. package/dist/chunk-mhc72pp2.js +2 -0
  70. package/dist/{chunk-nj5azxxj.js → chunk-mkk8k3nd.js} +4 -4
  71. package/dist/{chunk-1day2nbr.js → chunk-msy46ges.js} +3 -3
  72. package/dist/{chunk-q22hwm64.js → chunk-napd81ht.js} +3 -3
  73. package/dist/{chunk-c1b481my.js → chunk-nrh8t8re.js} +2 -2
  74. package/dist/{chunk-k54pgbzm.js → chunk-nsxg0t06.js} +1 -1
  75. package/dist/{chunk-rzh4xgb4.js → chunk-p66fgjeb.js} +1 -1
  76. package/dist/{chunk-0nzeqc13.js → chunk-p7cvn8q9.js} +2 -2
  77. package/dist/{chunk-vkpmemb1.js → chunk-p7h4y7mk.js} +1 -1
  78. package/dist/chunk-phjfsm8d.js +2 -0
  79. package/dist/chunk-pts7jpqc.js +2 -0
  80. package/dist/{chunk-qv99gqee.js → chunk-py818vbj.js} +1 -1
  81. package/dist/{chunk-4m3666pm.js → chunk-pzt3g2m0.js} +1 -1
  82. package/dist/{chunk-vvm38ysm.js → chunk-q69dvpg1.js} +1 -1
  83. package/dist/chunk-qcjtfrzm.js +2 -0
  84. package/dist/{chunk-e1e5xf8z.js → chunk-qdysx0fd.js} +5 -5
  85. package/dist/{chunk-3ffz7pd4.js → chunk-qr6jyd08.js} +1 -1
  86. package/dist/{chunk-2hbwpm36.js → chunk-r3qez0ph.js} +14 -14
  87. package/dist/{chunk-tqf8a258.js → chunk-rfzfk8zd.js} +6 -6
  88. package/dist/{chunk-t8cgxk8w.js → chunk-rj9dcjeg.js} +1 -1
  89. package/dist/{chunk-s9m2gfns.js → chunk-rk2v0wzs.js} +3 -3
  90. package/dist/chunk-rqpktvkn.js +2 -0
  91. package/dist/chunk-s1a69a8q.js +2 -0
  92. package/dist/{chunk-b8hsvzqb.js → chunk-s5kfndxv.js} +2 -2
  93. package/dist/{chunk-dphhs29v.js → chunk-s6ss1qnq.js} +2 -2
  94. package/dist/chunk-spmbnchd.js +2 -0
  95. package/dist/{chunk-knzp4c6m.js → chunk-svrjbeyq.js} +1 -1
  96. package/dist/chunk-t1gk6y8z.js +2 -0
  97. package/dist/chunk-t3cdnbq1.js +2 -0
  98. package/dist/chunk-t96gj0ey.js +2 -0
  99. package/dist/{chunk-fjbhtakz.js → chunk-tykyhmyx.js} +1 -1
  100. package/dist/chunk-vcks4gwd.js +2 -0
  101. package/dist/chunk-vg6p0zst.js +2 -0
  102. package/dist/chunk-vjsyf8m1.js +2 -0
  103. package/dist/{chunk-2mckhfet.js → chunk-vp8sjx6w.js} +5 -5
  104. package/dist/chunk-vq88tjma.js +2 -0
  105. package/dist/chunk-vqa2s0v4.js +2 -0
  106. package/dist/chunk-wtqj99tg.js +2 -0
  107. package/dist/{chunk-ccedry39.js → chunk-xj1k9bx9.js} +2 -2
  108. package/dist/chunk-xqa8f03q.js +2 -0
  109. package/dist/chunk-y7a0y5jq.js +2 -0
  110. package/dist/chunk-ydj0r3kw.js +2 -0
  111. package/dist/chunk-ydq170j1.js +2 -0
  112. package/dist/chunk-yz30cgyx.js +2 -0
  113. package/dist/{chunk-cft1sprt.js → chunk-yz85drm8.js} +1 -1
  114. package/dist/{chunk-mmcqgwk7.js → chunk-zg43k117.js} +2 -2
  115. package/dist/{chunk-m3dr63n0.js → chunk-zj32s5na.js} +2 -2
  116. package/dist/{chunk-m15nbvck.js → chunk-zmesddf4.js} +1 -1
  117. package/dist/{chunk-dvh63p75.js → chunk-znhzrjbm.js} +2 -2
  118. package/dist/{chunk-zs8yjtaz.js → chunk-zv924m9g.js} +5 -5
  119. package/dist/cli.js +11 -11
  120. package/dist/client/signals-for-runtime.js +2 -0
  121. package/dist/client/signals-if-runtime.js +2 -0
  122. package/dist/client/signals-loop-conditional-runtime.js +66 -0
  123. package/dist/component-contract-checks.js +3 -2
  124. package/dist/craft-entry.js +2 -2
  125. package/dist/craft.js +2 -2
  126. package/dist/expressions.js +15 -0
  127. package/dist/native/event-names.js +2 -0
  128. package/dist/native/prop-names.js +2 -0
  129. package/dist/pwa.js +3 -3
  130. package/dist/signal-processing.d.ts +12 -0
  131. package/dist/signal-processing.js +12 -1
  132. package/dist/ssg.js +2 -2
  133. package/package.json +5 -5
  134. package/dist/chunk-09cera09.js +0 -2
  135. package/dist/chunk-0f5276fm.js +0 -2
  136. package/dist/chunk-16n128gh.js +0 -2
  137. package/dist/chunk-171bbyqv.js +0 -2
  138. package/dist/chunk-1g0g498y.js +0 -2
  139. package/dist/chunk-1qppvj48.js +0 -2
  140. package/dist/chunk-1z77g0j6.js +0 -2
  141. package/dist/chunk-4bhbtvtm.js +0 -2
  142. package/dist/chunk-59r38w60.js +0 -2
  143. package/dist/chunk-5x312c05.js +0 -2
  144. package/dist/chunk-65h2h51z.js +0 -2
  145. package/dist/chunk-6ch8t3d9.js +0 -3
  146. package/dist/chunk-6rd0zz6k.js +0 -2
  147. package/dist/chunk-7bvhpdqv.js +0 -2
  148. package/dist/chunk-axxd53tn.js +0 -2
  149. package/dist/chunk-b8ar6431.js +0 -2
  150. package/dist/chunk-bnm7ym0g.js +0 -2
  151. package/dist/chunk-brg2ydrk.js +0 -2
  152. package/dist/chunk-c0fwppzc.js +0 -2
  153. package/dist/chunk-c5kpc7rn.js +0 -2
  154. package/dist/chunk-c8256r1a.js +0 -2
  155. package/dist/chunk-cap6exxx.js +0 -2
  156. package/dist/chunk-dt0deg4z.js +0 -2
  157. package/dist/chunk-ejqr5cva.js +0 -2
  158. package/dist/chunk-evbxyw80.js +0 -2
  159. package/dist/chunk-f66n66c8.js +0 -2
  160. package/dist/chunk-f6h8yagj.js +0 -2
  161. package/dist/chunk-fpsm2qed.js +0 -2
  162. package/dist/chunk-fzf7yfpn.js +0 -2
  163. package/dist/chunk-gaatje2g.js +0 -2
  164. package/dist/chunk-jhz0dvqz.js +0 -2
  165. package/dist/chunk-kkx2gqk8.js +0 -2
  166. package/dist/chunk-n9zka6dg.js +0 -2
  167. package/dist/chunk-pvx57vpw.js +0 -2
  168. package/dist/chunk-qcz104h3.js +0 -2
  169. package/dist/chunk-qgvez75f.js +0 -2
  170. package/dist/chunk-r0j6jkxc.js +0 -2
  171. package/dist/chunk-rzv9xcyp.js +0 -2
  172. package/dist/chunk-sy4wqxta.js +0 -2
  173. package/dist/chunk-szdm8wfn.js +0 -2
  174. package/dist/chunk-t424gvwc.js +0 -2
  175. package/dist/chunk-vtvaa8y9.js +0 -2
  176. package/dist/chunk-vvj09a7b.js +0 -2
  177. package/dist/chunk-vwjy6491.js +0 -2
  178. package/dist/chunk-wadp2rmj.js +0 -2
  179. package/dist/chunk-wbkcwj27.js +0 -2
  180. package/dist/chunk-wzp8y0a4.js +0 -2
  181. package/dist/chunk-xc1he6hs.js +0 -2
  182. package/dist/chunk-zhxg6b64.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Xo,Go,Jo,Yo,xs,Ss,Lh,jh,Bh,Fh,ks,zh}from"./chunk-cz3trbvn.js";import"./chunk-7s9wx19m.js";export{zh as generateDefaultRobotsTxt,ks as generateRobotsTxt,jh as generateSitemap,Bh as generateSitemapIndex,Yo as injectSeoTags,xs as metaDirective,Xo as processMetaDirectives,Jo as processSeoDirective,Go as processStructuredData,Lh as registerSeoDirectives,Fh as scanForSitemapEntries,Ss as structuredDataDirective};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function um(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
2
+ var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function dm(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
3
3
  <div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${o}">
4
4
  <div class="stx-keep-alive-content" data-keep-alive-content="${e}">
5
5
  ${t}
@@ -286,7 +286,7 @@ else {
286
286
  });
287
287
  })();
288
288
  </script>
289
- `}function dm(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function pm(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function fm(){return`
289
+ `}function pm(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function fm(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function gm(){return`
290
290
  /* STX Keep-Alive Styles */
291
291
  .stx-keep-alive {
292
292
  position: relative;
@@ -311,7 +311,7 @@ else {
311
311
  .stx-keep-alive-content > [data-activated] {
312
312
  opacity: 1;
313
313
  }
314
- `}function gm(){return`
314
+ `}function mm(){return`
315
315
  // STX Keep-Alive Runtime
316
316
  (function() {
317
317
  if (typeof window === 'undefined') return;
@@ -347,5 +347,5 @@ else {
347
347
 
348
348
  console.log('[stx] Keep-alive runtime initialized');
349
349
  })();
350
- `}function mm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function hm(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
- export{um,dm,pm,fm,gm,mm,hm};
350
+ `}function hm(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function ym(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
+ export{dm,pm,fm,gm,mm,hm,ym};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import{existsSync as x,realpathSync as S,statSync as y}from"fs";import d from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function Lr(t,e){let a=d.resolve(t,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let n=new Map,r=new Map;for(let s of e.languages){if(!j.test(s))throw Error(`messages: "${s}" is not a language directory name`);let g=d.join(a,s);if(!x(g))throw Error(`messages: ${d.relative(t,g)} does not exist`);let o=new Map;for(let i of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:g})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(i))continue;let c=i.replace(/\.[^./]+$/,"").split(d.sep).join("/");if(!E.test(c))throw Error(`messages: ${s}/${i} is not an area name`);if(o.has(c))throw Error(`messages: ${s}/${c} is defined twice`);let l=d.join(g,i),m=await import(l),M=Object.keys(m).filter((p)=>p!=="default");if(M.length)throw Error(`messages: ${s}/${i} exports ${M.join(", ")}; a message module exports its messages as default, and nothing else`);let f=m.default,u=f!==null&&typeof f==="object"&&!Array.isArray(f)?JSON.stringify(f):void 0;if(u===void 0||!Bun.deepEquals(JSON.parse(u),f,!0))throw Error(`messages: ${s}/${i} must export plain data (an object JSON can hold) as default`);o.set(c,u),n.set(l,{language:s,area:c})}r.set(s,o)}return{files:n,data:r}}function b(t,e){return`stx-messages:${t}:${e}`}function _(t,e){let a=JSON.stringify(b(t,e));return`var kept = globalThis.__stxMessages || (globalThis.__stxMessages = {});
3
- export default kept[${a}] || (kept[${a}] = {});`}var w=new Map;function Og(t,e=k.env){if(!t.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function Ng(t,e){let a=d.resolve(t,e.dir),n=e.languages.map((l)=>{try{return`${l}:${y(d.join(a,l)).mtimeMs}`}catch{return`${l}:-`}}).join("|"),r=`${a}\x00${e.languages.join(",")}\x00${e.fallback??""}`,s=w.get(r);if(s&&s.signature===n)return s.messages;let g=await Lr(t,e),o=new Map;for(let[l,{language:m,area:M}]of g.files){let f=_(m,M),u=[l];try{u.push(S(l))}catch{}for(let p of[...u])if(p.startsWith("/private/"))u.push(p.slice(8));for(let p of u)o.set(p,f)}let i=e.fallback??e.languages[0];if(!e.languages.includes(i))throw Error(`messages.fallback "${i}" is not one of messages.languages`);let c={...g,stubs:o,languages:[...e.languages],fallback:i};return w.set(r,{signature:n,messages:c}),c}function Dg(...t){let e=new Set;for(let a of t){if(!a||!a.includes("stx-messages:"))continue;for(let n of a.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(n[1])}return e}function Mg(t,e){let a=/<html\b[^>]*>/i.exec(t)?.[0]??"",n=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(a),r=(n?n[1]??n[2]??n[3]??"":"").trim().toLowerCase(),s=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=s.get(r)??s.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback])]}var h=new WeakMap;function Lg(t,e,a){let n=[...a].sort(),r=h.get(t);if(!r)h.set(t,r=new Map);let s=`${e.join(",")}\x00${n.join(",")}`;if(r.has(s))return r.get(s);let g=P(t,e,n);return r.set(s,g),g}function P(t,e,a){let n=[];for(let r of e){let s=t.data.get(r);if(!s)continue;for(let g of a){let o=s.get(g);if(o!==void 0)n.push(`put(${JSON.stringify(b(r,g))},${JSON.stringify(o)})`)}}if(n.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
3
+ export default kept[${a}] || (kept[${a}] = {});`}var w=new Map;function Ng(t,e=k.env){if(!t.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function Dg(t,e){let a=d.resolve(t,e.dir),n=e.languages.map((l)=>{try{return`${l}:${y(d.join(a,l)).mtimeMs}`}catch{return`${l}:-`}}).join("|"),r=`${a}\x00${e.languages.join(",")}\x00${e.fallback??""}`,s=w.get(r);if(s&&s.signature===n)return s.messages;let g=await Lr(t,e),o=new Map;for(let[l,{language:m,area:M}]of g.files){let f=_(m,M),u=[l];try{u.push(S(l))}catch{}for(let p of[...u])if(p.startsWith("/private/"))u.push(p.slice(8));for(let p of u)o.set(p,f)}let i=e.fallback??e.languages[0];if(!e.languages.includes(i))throw Error(`messages.fallback "${i}" is not one of messages.languages`);let c={...g,stubs:o,languages:[...e.languages],fallback:i};return w.set(r,{signature:n,messages:c}),c}function Mg(...t){let e=new Set;for(let a of t){if(!a||!a.includes("stx-messages:"))continue;for(let n of a.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(n[1])}return e}function Lg(t,e){let a=/<html\b[^>]*>/i.exec(t)?.[0]??"",n=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(a),r=(n?n[1]??n[2]??n[3]??"":"").trim().toLowerCase(),s=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=s.get(r)??s.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback])]}var h=new WeakMap;function jg(t,e,a){let n=[...a].sort(),r=h.get(t);if(!r)h.set(t,r=new Map);let s=`${e.join(",")}\x00${n.join(",")}`;if(r.has(s))return r.get(s);let g=P(t,e,n);return r.set(s,g),g}function P(t,e,a){let n=[];for(let r of e){let s=t.data.get(r);if(!s)continue;for(let g of a){let o=s.get(g);if(o!==void 0)n.push(`put(${JSON.stringify(b(r,g))},${JSON.stringify(o)})`)}}if(n.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
4
4
  ${n.join(`;
5
5
  `)};
6
6
  })();`}
7
- export{Lr,Og,Ng,Dg,Mg,Lg};
7
+ export{Lr,Ng,Dg,Mg,Lg,jg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ll,cm,jl,Bl,lm,um}from"./chunk-a81m2ewb.js";import"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{um as applySlots,lm as extractSlotContent,cm as parseSlotElement,Ll as parseSlots,Bl as processSlots,jl as renderSlot};
@@ -39,5 +39,5 @@ ${d}
39
39
  </div>`}else if(e.placeholder==="color"){let p=n.replace(/[^a-zA-Z0-9#(),.\s%-]/g,"");d=`<div id="${g}" class="stx-image-placeholder" style="background-color: ${p};">
40
40
  ${d}
41
41
  </div>`}}if(e.priority&&y){let g=ne(y.format);d=`<link rel="preload" as="image" href="${x(y.url)}" type="${g}" />
42
- `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Tl=ea();import P from"fs";import j from"path";function $l(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=ee,widths:a=Q,quality:i=te,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await me()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await On();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await me())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Te(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Ln(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${jn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Mn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Rl(s,r,e={}){if(!await me())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Te(s,{...e,outputDir:r})}async function Al(s,r,e={}){let{formats:t=ee,widths:n=Q,quality:a=te,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await me())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Te(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function ta(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Pl(s,r){let e=ta(s);await Bun.write(r,JSON.stringify(e,null,2))}var Ug={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
- export{_l,Qi,Cl,El,ea,Tl,$l,Rl,Al,ta,Pl,Ug};
42
+ `+d}return d}function x(s){return s.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Tl=ea();import P from"fs";import j from"path";function $l(s={}){let{inputDirs:r=["public","src/assets","assets"],outputDir:e="dist/images",baseUrl:t="/images",formats:n=ee,widths:a=Q,quality:i=te,placeholder:m="none",concurrency:o=4,cache:u=!0,cacheDir:l=".stx/image-cache",referencedOnly:f=!1,verbose:y=!1}=s,c={imageReferences:new Set,processedImages:new Map,stats:{totalImages:0,optimizedImages:0,savedBytes:0,variants:0}};return{name:"stx-image-optimization",async setup(h){if(!await me()){console.warn("[stx-images] no image backend available, optimization disabled");return}if(u)await P.promises.mkdir(l,{recursive:!0});if(y){let g=await On();console.log("[stx-images] Plugin initialized"),console.log(` Backend: ${g?"sharp (native fast path) + ts-images":"ts-images (pure TS)"}`),console.log(` Input dirs: ${r.join(", ")}`),console.log(` Output dir: ${e}`),console.log(` Formats: ${n.join(", ")}`),console.log(` Widths: ${a.join(", ")}`)}},async buildStart(){c.imageReferences.clear(),c.processedImages.clear(),c.stats={totalImages:0,optimizedImages:0,savedBytes:0,variants:0}},async transform(h,d){if(d.endsWith(".html")||d.endsWith(".stx")){let g=ie(h);for(let p of g)c.imageReferences.add(p)}if(h.includes("<Image")||h.includes("@image"))return await ce(h,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t,processedImages:c.processedImages});return h},async buildEnd(h){if(!await me())return;await P.promises.mkdir(e,{recursive:!0});let g=[];for(let w of r){if(!P.existsSync(w))continue;let I=await N(w);g.push(...I)}let p=f?g.filter((w)=>oe(w,c.imageReferences)):g;if(c.stats.totalImages=p.length,y)console.log(`[stx-images] Processing ${p.length} images...`);let v=W(p,o);for(let w of v)await Promise.all(w.map(async(I)=>{try{let b=await Te(I,{formats:n,widths:a,quality:i,placeholder:m,outputDir:e,baseUrl:t});c.processedImages.set(I,b),c.stats.optimizedImages++,c.stats.variants+=b.variants.length;let A=P.statSync(I).size,S=Ln(b.variants);if(c.stats.savedBytes+=Math.max(0,A-S/b.variants.length),y)console.log(` \u2713 ${j.basename(I)} \u2192 ${b.variants.length} variants`)}catch(b){console.error(`[stx-images] Error processing ${I}:`,b)}}));if(console.log("[stx-images] Optimization complete:"),console.log(` Images: ${c.stats.optimizedImages}/${c.stats.totalImages}`),console.log(` Variants: ${c.stats.variants}`),c.stats.savedBytes>0)console.log(` Saved: ~${jn(c.stats.savedBytes)}`)}}}function ie(s){let r=[],e=/src=["']([^"']+\.(jpg|jpeg|png|webp|avif|gif))["']/gi,t;while((t=e.exec(s))!==null)r.push(t[1]);let n=/<Image[^>]+src=["']([^"']+)["']/gi;while((t=n.exec(s))!==null)r.push(t[1]);let a=/@image\s*\(\s*['"]([^'"]+)['"]/gi;while((t=a.exec(s))!==null)r.push(t[1]);let i=/background(?:-image)?:\s*url\(["']?([^"')]+\.(jpg|jpeg|png|webp|avif|gif))["']?\)/gi;while((t=i.exec(s))!==null)r.push(t[1]);return r}function oe(s,r){let e=j.basename(s);for(let t of r)if(t.endsWith(e)||t.includes(e))return!0;return!1}async function ce(s,r){return s}async function N(s){let r=[];async function e(t){let n=await P.promises.readdir(t,{withFileTypes:!0});for(let a of n){let i=j.join(t,a.name);if(a.isDirectory())await e(i);else if(a.isFile()&&Mn(i))r.push(i)}}return await e(s),r}function W(s,r){let e=[];for(let t=0;t<s.length;t+=r)e.push(s.slice(t,t+r));return e}async function Rl(s,r,e={}){if(!await me())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");return Te(s,{...e,outputDir:r})}async function Al(s,r,e={}){let{formats:t=ee,widths:n=Q,quality:a=te,placeholder:i="none",concurrency:m=4,verbose:o=!1}=e;if(!await me())throw Error("No image backend available \u2014 install sharp or ensure ts-images is bundled");await P.promises.mkdir(r,{recursive:!0});let l=await N(s),f=[],y={totalImages:l.length,optimizedImages:0,savedBytes:0,variants:0},c=W(l,m);for(let h of c){let d=await Promise.all(h.map(async(g)=>{try{let p=await Te(g,{formats:t,widths:n,quality:a,placeholder:i,outputDir:r,baseUrl:"/"});if(y.optimizedImages++,y.variants+=p.variants.length,o)console.log(` \u2713 ${j.basename(g)}`);return p}catch(p){return console.error(`Error processing ${g}:`,p),null}}));f.push(...d.filter((g)=>g!==null))}return{processed:f,stats:y}}function ta(s){let r={};for(let e of s)r[e.src]={variants:e.variants,placeholder:e.placeholder};return r}async function Pl(s,r){let e=ta(s);await Bun.write(r,JSON.stringify(e,null,2))}var Wg={enabled:!0,widths:[320,640,768,1024,1280,1536,1920],formats:["webp","jpeg"],quality:80,devOptimize:!1,cacheDir:".stx/image-cache",placeholder:"none",inputDirs:["public","src/assets","assets"],outputDir:"dist/images",baseUrl:"/images"};
43
+ export{_l,Qi,Cl,El,ea,Tl,$l,Rl,Al,ta,Pl,Wg};
@@ -1,14 +1,14 @@
1
1
  // @bun
2
- import{pr}from"./chunk-8hanmv49.js";import{Er}from"./chunk-1w4a0xya.js";import{a}from"./chunk-tqf8a258.js";import{L,Je}from"./chunk-0wj31pqy.js";import{ac}from"./chunk-a2yptg7r.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function ir(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new pr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function be(e){return e.includes("data-stx-runtime")}function oc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=ir(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
2
+ import{pr}from"./chunk-fxy7jjnv.js";import{Er}from"./chunk-7s9wx19m.js";import{a}from"./chunk-rfzfk8zd.js";import{L,Je}from"./chunk-0wj31pqy.js";import{ac}from"./chunk-a2yptg7r.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function ir(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new pr(e,r).routes}import w from"path";var T=new Map;async function y(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=T.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return T.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function l(e){return O(JSON.stringify(e))}function be(e){return e.includes("data-stx-runtime")}function oc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function f(e,r){let t=ir(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
3
3
  `+e.slice(t);let n=Er(e);if(n!==null)return`${e.slice(0,n)}
4
4
  ${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
5
5
  `+e.slice(o)}if(L(e))return Je(e,(o)=>`${o}
6
6
  ${r}`);return`${r}
7
- ${e}`}async function ar(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-c0fwppzc.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-c0fwppzc.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function ic(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${ac()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
7
+ ${e}`}async function ar(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-1nzg53pv.js"),{url:c}=await n("runtime",r.debug===!0);return f(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return f(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-1nzg53pv.js"),s=await t(r.debug);return f(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function ic(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${ac()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
8
8
  ${r}`;return`${e.slice(0,t)}${r}
9
- ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function we(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-c0fwppzc.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
9
+ ${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function we(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let g=await y(r?.pagesDir,r?.root);if(g.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:h}=await import("./chunk-1nzg53pv.js");n=`<script data-stx-owned-routes src="${h(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${l(g)};
10
10
  `)}"></script>
11
11
  `}else i.ownedRoutes=g}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${l(i)};</script>
12
- `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-c0fwppzc.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
12
+ `}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-1nzg53pv.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
13
13
  </body>`+e.slice(d+7)}
14
14
  export{ir,X,be,oc,ar,ic,we};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{zt}from"./chunk-dvh63p75.js";function Gs(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=zt(e),i=`
2
+ import{zt}from"./chunk-znhzrjbm.js";function Gs(e){let n=e.pwa;if(!n?.enabled)return"";let r=n.manifest,t=n.icons?.outputDir?`/${n.icons.outputDir}`:"/pwa-icons",o=zt(e),i=`
3
3
  <!-- stx PWA Meta Tags -->
4
4
  <link rel="manifest" href="/manifest.json">
5
5
  <meta name="theme-color" content="${a(r?.themeColor||"#000000")}">
@@ -45,7 +45,7 @@ if ('serviceWorker' in navigator) {
45
45
  </script>
46
46
  <!-- End stx PWA -->`,i}function $i(e,n){let r=n.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let o=e.lastIndexOf("</body>");if(o!==-1){let i=Gs(n);return e.slice(0,o)+i+`
47
47
  `+e.slice(o)}return e+Gs(n)}let t=Gs(n);return e.replace("</head>",`${t}
48
- </head>`)}function hg(e){if(!e.pwa?.enabled)return"";return`<script>
48
+ </head>`)}function yg(e){if(!e.pwa?.enabled)return"";return`<script>
49
49
  if ('serviceWorker' in navigator) {
50
50
  window.addEventListener('load', function() {
51
51
  navigator.serviceWorker.register('/${zt(e)}')
@@ -57,5 +57,5 @@ if ('serviceWorker' in navigator) {
57
57
  });
58
58
  });
59
59
  }
60
- </script>`}function yg(){return'<link rel="manifest" href="/manifest.json">'}function bg(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
61
- export{Gs,$i,hg,yg,bg};
60
+ </script>`}function bg(){return'<link rel="manifest" href="/manifest.json">'}function wg(e){return`<meta name="theme-color" content="${a(e)}">`}function a(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}
61
+ export{Gs,$i,yg,bg,wg};
@@ -1,20 +1,20 @@
1
1
  // @bun
2
- import{k}from"./chunk-07c8rk93.js";import{xe,Pt,si,oi,Tc,$c,Rc,Ac,Ns,ai,Pc,Ic,Oc,mn}from"./chunk-qv2k0qb1.js";import{a}from"./chunk-tqf8a258.js";import{mo}from"./chunk-cswar3zs.js";import{l}from"./chunk-s2py8kg7.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=mn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),w=p.split(`
2
+ import{k}from"./chunk-07c8rk93.js";import{xe,Pt,si,oi,Tc,$c,Rc,Ac,Ns,ai,Pc,Ic,Oc,mn}from"./chunk-4qrr2mdd.js";import{a}from"./chunk-rfzfk8zd.js";import{mo}from"./chunk-ddpt7ejx.js";import{l}from"./chunk-s2py8kg7.js";import{existsSync as M,readFileSync as K}from"fs";import h from"path";var ge=new Set(["module","exports","require","$bool","$num","window","document","console","confirm","alert","fetch"]),ee=mn.filter((e)=>!ge.has(e)).sort(),te=[...k].sort(),me=[...new Set([...ee,...te])].sort(),he=new Set(ee),be=new Set(te),ye=new Set(me),Y=/\bimport\s+(?!type[\s{])\{([^}]*)\}\s*from\s*(['"])stx\2/g;function Se(e,t){if(t==="server")return`'${e}' is not provided by 'stx' in a <script server> block. The engine binds only its own names there (defineProps, state, useHead, ...); any other name becomes \`await import('stx')\`, which does not resolve, so the whole script fails when the page renders. Import it from '@stacksjs/stx' instead.`;return`'${e}' is not provided by 'stx' in a client <script> block. The import is replaced by the window.stx runtime, which has no '${e}', so it is undefined in the browser.`}function ne(e,t){let s=[];for(let u of t){if(u.offset===void 0)continue;let i=u.kind==="server"?he:be;Y.lastIndex=0;for(let c of u.code.matchAll(Y)){let g=c.index+c[0].indexOf("{")+1;for(let m of c[1].matchAll(/[^,]+/g)){let x=m[0];if(/^\s*type\s/.test(x))continue;let y=/^\s*([A-Za-z_$][\w$]*)/.exec(x);if(!y)continue;let r=y[1];if(!ye.has(r)||i.has(r))continue;let f=u.offset+g+m.index+y[0].length-r.length,p=e.slice(0,f),w=p.split(`
3
3
  `).length;s.push({line:w,column:f-(p.lastIndexOf(`
4
4
  `)+1)+1,offset:f,length:r.length,name:r,kind:u.kind,message:Se(r,u.kind)})}}}return s}import T from"path";var ke="@stacksjs/stx-typescript-plugin";function we(e,t){let s=T.resolve(e);for(;;){let u=T.join(s,"tsconfig.json");if(t(u))return u;let i=T.dirname(s);if(i===s)return;s=i}}function ie(e,t,s){let u=we(e,s);if(!u)return;let i=new Set,c=(g)=>{if(i.has(g))return;i.add(g);let m=t(g);if(!m)return;let x=m.compilerOptions?.plugins;if(Array.isArray(x)){let r=x.find((p)=>p?.name===ke),f=Array.isArray(r?.libs)?r.libs.filter((p)=>typeof p==="string"):[];return r?{configPath:g,libs:f.map((p)=>T.resolve(T.dirname(g),p))}:null}let y=typeof m.extends==="string"?[m.extends]:Array.isArray(m.extends)?m.extends:[];for(let r of[...y].reverse()){if(typeof r!=="string"||!r.startsWith("."))continue;let f=T.resolve(T.dirname(g),r.endsWith(".json")?r:`${r}.json`),p=c(f);if(p!==void 0)return p}return};return c(u)??void 0}function Il(e,t="",s=""){let u=e.startLine>1?`
5
5
  `.repeat(e.startLine-1):"",i=ai(e)+oi(si(e.code)),c=e.kind==="client"||e.kind==="plain"?Rc(t,e.code):"";return Ns(`${u+i}
6
6
  ${c}
7
7
  export {}
8
8
  `,s)}var $e=new Set(["name","status","length","location","history","origin","closed","close","open","focus","blur","print","scroll","scrollTo","scrollBy","stop","top","parent","self","frames","event","external","menubar","toolbar"]);function ve(e){if(e.length===0)return"";let t=["// Generated \u2014 the composables the runtime publishes as bare globals."],s=new Set(k),u=[];for(let{file:i,names:c}of e){let g=JSON.stringify(i.replace(/\\/g,"/").replace(/\.ts$/,""));u.push(` export * from ${g}`);for(let m of c){if(s.has(m)||$e.has(m))continue;s.add(m),t.push(`declare const ${m}: typeof import(${g})[${JSON.stringify(m)}]`)}}return t.push("declare module '@composables' {",...u,"}"),t.join(`
9
- `)}function na(e,t,s){return`${e}.__stx_${t}${s}.ts`}function Wg(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Ol(){return se("stx.d.ts")}function Nl(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(M(t))return t;return null}var Te=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function De(e){return e>=1000&&e<2000}function re(e){let t="",s=!1,u=!1;for(let i=0;i<e.length;i++){let c=e[i];if(s){if(t+=c,u)u=!1;else if(c==="\\")u=!0;else if(c==='"')s=!1;continue}if(c==='"'){s=!0,t+=c;continue}if(c==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
9
+ `)}function na(e,t,s){return`${e}.__stx_${t}${s}.ts`}function qg(e){return e.replace(/\.__stx_(?:server|client|plain|template)\d+\.ts$/,"")}function Ol(){return se("stx.d.ts")}function Nl(){return se("stx-module.d.ts")}function se(e){for(let t of[h.resolve(import.meta.dir,"..",e),h.resolve(import.meta.dir,"..","..",e)])if(M(t))return t;return null}var Te=/^(.*?)\((\d+),(\d+)\):\s+(error|warning)\s+TS(\d+):\s+(.*)$/;function De(e){return e>=1000&&e<2000}function re(e){let t="",s=!1,u=!1;for(let i=0;i<e.length;i++){let c=e[i];if(s){if(t+=c,u)u=!1;else if(c==="\\")u=!0;else if(c==='"')s=!1;continue}if(c==='"'){s=!0,t+=c;continue}if(c==="/"&&e[i+1]==="/"){while(i<e.length&&e[i]!==`
10
10
  `)i++;t+=`
11
- `;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(re(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(M(r)){s=r;break}let f=h.dirname(t);if(f===t)break;t=f}if(!s)return{};let u=new Set,i=s,c,g,m=s;while(i&&!u.has(i)){u.add(i);let r;try{r=JSON.parse(re(K(i,"utf8")))}catch{break}let f=r?.compilerOptions??{};if(!c&&f.paths&&typeof f.paths==="object")c=f.paths,m=i;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(i),f.baseUrl);if(c&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!c)return{};let x=g??h.dirname(m),y={};for(let[r,f]of Object.entries(c)){if(!Array.isArray(f))continue;y[r]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(x,p):p)}return{paths:y}}async function qg(e,t={}){let s=t.client!==!1,u=t.server!==!1,i=t.templates!==!1,c=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,m=new Map,x=[],y=[],r=0,f=0,p=Ol();for(let n of e){let o=await Bun.file(n).text(),b=Pt(o).filter((d)=>{if(d.kind==="server")return u;return s}),S=Pt(o).filter((d)=>d.kind==="server").map((d)=>d.code).join(`
11
+ `;continue}if(c==="/"&&e[i+1]==="*"){i+=2;while(i<e.length&&!(e[i]==="*"&&e[i+1]==="/"))i++;i++;continue}t+=c}return t.replace(/,(\s*[}\]])/g,"$1")}function Ee(e){try{return JSON.parse(re(K(e,"utf8")))}catch{return}}function Oe(e){let t=h.resolve(e),s;for(;;){let r=h.join(t,"tsconfig.json");if(M(r)){s=r;break}let f=h.dirname(t);if(f===t)break;t=f}if(!s)return{};let u=new Set,i=s,c,g,m=s;while(i&&!u.has(i)){u.add(i);let r;try{r=JSON.parse(re(K(i,"utf8")))}catch{break}let f=r?.compilerOptions??{};if(!c&&f.paths&&typeof f.paths==="object")c=f.paths,m=i;if(!g&&typeof f.baseUrl==="string")g=h.resolve(h.dirname(i),f.baseUrl);if(c&&g)break;i=typeof r?.extends==="string"?h.resolve(h.dirname(i),r.extends.endsWith(".json")?r.extends:`${r.extends}.json`):void 0}if(!c)return{};let x=g??h.dirname(m),y={};for(let[r,f]of Object.entries(c)){if(!Array.isArray(f))continue;y[r]=f.map((p)=>typeof p==="string"&&!h.isAbsolute(p)?h.resolve(x,p):p)}return{paths:y}}async function Kg(e,t={}){let s=t.client!==!1,u=t.server!==!1,i=t.templates!==!1,c=t.componentsDir??(i?(await a()).componentsDir:void 0),g=new Map,m=new Map,x=[],y=[],r=0,f=0,p=Ol();for(let n of e){let o=await Bun.file(n).text(),b=Pt(o).filter((d)=>{if(d.kind==="server")return u;return s}),S=Pt(o).filter((d)=>d.kind==="server").map((d)=>d.code).join(`
12
12
  `);for(let d of ne(o,b))x.push({file:n,line:d.line,column:d.column,code:0,message:d.message,category:"error",blockKind:d.kind});if(s&&S){let d=b.filter((O)=>O.kind!=="server"),E=[...new Set(d.flatMap((O)=>Ac(S,O.code)))];if(E.length>0)m.set(n,{names:E,line:d[0].startLine,kind:d[0].kind})}let D=h.dirname(h.resolve(n)),v=i?Pc(o,{runtimeGlobals:!p,originDir:D,filePath:h.resolve(n),componentsDir:c}):null,R=v?[...v.lineMap.values()].filter((d)=>d.expression).length:0;if(b.length===0&&R===0)continue;if(y.push(n),r+=b.length,f+=R,b.forEach((d,E)=>{g.set(na(n,d.kind,E),{source:Il(d,S,D),origin:n,kind:d.kind})}),v&&R>0)g.set(na(n,"template",0),{source:v.text,origin:n,kind:"template",virtual:v})}if(g.size===0)return{diagnostics:x,checkedFiles:y,blockCount:0,expressionCount:0};let w=(t.extraLibs??[]).map((n)=>h.resolve(n)),oe=ie(e.length>0?h.dirname(h.resolve(e[0])):process.cwd(),Ee,M);for(let n of oe?.libs??[])if(!w.includes(n)&&M(n))w.push(n);if(p)w.push(p);let G=p?Nl():null;if(G)w.push(G);let X=`${l()}/typecheck/__stx_globals.d.ts`,ce=["// Generated \u2014 the context serve.ts injects into <script server> blocks.",Tc(p?$c(K(p,"utf8")):void 0),...p?[]:["declare const window: any",...k.map((n)=>`declare const ${n}: any`)],["// Generated \u2014 the names stx auto-imports from @stacksjs/browser.",...xe.map((n)=>`declare const ${n}: any`)].join(`
13
13
  `),ve(await mo())].filter(Boolean).join(`
14
14
  `),_=`${l()}/typecheck`;await Bun.$`rm -rf ${_}`.quiet().nothrow(),await Bun.$`mkdir -p ${_}`.quiet().nothrow(),await Bun.write(X,ce);let N=new Map,ae=0;for(let[n,o]of g){let b=`${ae++}_${n.replace(/[^\w.-]+/g,"_")}`;await Bun.write(`${_}/${b}`,o.source),N.set(b,o)}let le={target:"ESNext",module:"ESNext",moduleResolution:"bundler",strict:!0,noEmit:!0,skipLibCheck:!0,allowJs:!0,esModuleInterop:!0,resolveJsonModule:!0,lib:["ESNext","DOM","DOM.Iterable"],types:[],...Oe(e.length>0?h.dirname(h.resolve(e[0])):process.cwd()),...t.compilerOptions??{}},F=async(n,o)=>{let b=`${_}/tsconfig${o===1?"":`.${o}`}.json`;await Bun.write(b,JSON.stringify({compilerOptions:le,files:n.map((D)=>`${_}/${D}`).concat(X,...w)},null,2));let S=Bun.spawnSync(["bun","x","tsc","-p",b,"--pretty","false"],{stdout:"pipe",stderr:"pipe"});return{output:new TextDecoder().decode(S.stdout)+new TextDecoder().decode(S.stderr),exitCode:S.exitCode??0}},V=await F([...N.keys()],1),J=V.output,I=[],U=V.exitCode,W=0,ue=new Set(w.map((n)=>n.split("/").pop())),z=0,B=new Set,q=(n)=>{for(let o of n.replace(/\n[\t ]+([^\n]*)/g," $1").split(`
15
15
  `)){let b=o.match(Te);if(!b)continue;if(W++,ue.has(b[1].split("/").pop()))z++;let[,S,D,v,R,d,E]=b,O=S.split("/").pop(),C=N.get(O);if(!C)continue;if(De(Number(d)))B.add(O);let A=Number(D),L=Number(v),Q;if(C.virtual){let P=Oc(C.virtual,A,L);if(!P?.expression)continue;if(Ic(P,Number(d)))continue;A=P.line,L=P.column,Q=P.expression.code.trim()}I.push({file:C.origin,line:A,column:L,code:Number(d),message:E,category:R==="error"?"error":"warning",blockKind:C.kind,expression:Q})}};q(J);let pe=W,de=z;if(B.size>0&&B.size<N.size){let n=[...N.keys()].filter((o)=>!B.has(o));q((await F(n,2)).output)}if(s)for(let[n,o]of m){if(o.names.length===0)continue;I.push({file:n,line:o.line,column:1,code:0,message:`${o.names.length===1?"1 value reaches":`${o.names.length} values reach`} this block on the implicit bridge and ${o.names.length===1?"is":"are"} untyped: ${o.names.join(", ")}. Declare them with defineClientPayload({ ${o.names.join(", ")} }) in the server block to have them checked.`,category:"warning",blockKind:o.kind})}I.push(...x);let H=new Set,j=I.filter((n)=>{let o=`${n.file}:${n.line}:${n.column}:${n.code}:${n.message}`;if(H.has(o))return!1;return H.add(o),!0});j.sort((n,o)=>n.file.localeCompare(o.file)||n.line-o.line||n.column-o.column);let Z=de>0&&j.length===0,fe=Z||U!==0&&pe===0?`${Z?"a file passed with --lib has errors of its own, so nothing in your code was checked":`tsc exited ${U} without reporting any diagnostic, so nothing was checked`}. `+"A syntax error in an ambient declaration file does this \u2014 skipLibCheck suppresses "+`SEMANTIC diagnostics only. tsc said:
16
16
  ${J.trim().split(`
17
17
  `).slice(0,12).join(`
18
- `)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:r,expressionCount:f,failure:fe}}function Kg(e){return e.map((t)=>{let s=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${s}`}).join(`
18
+ `)||"(no output)"}`:void 0;return{diagnostics:j,checkedFiles:y,blockCount:r,expressionCount:f,failure:fe}}function Xg(e){return e.map((t)=>{let s=t.blockKind==="template"?`[template: ${t.expression??""}]`:`[${t.blockKind==="plain"?"<script>":`<script ${t.blockKind}>`}]`;return`${t.file}:${t.line}:${t.column} ${t.category} TS${t.code} ${t.message} ${s}`}).join(`
19
19
  `)}
20
- export{Il,na,Wg,Ol,Nl,qg,Kg};
20
+ export{Il,na,qg,Ol,Nl,Kg,Xg};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{wh,ec,vh,tc,kf,_f,an,rr,xh,Cf,Ef,Sh,y}from"./chunk-rk2v0wzs.js";import"./chunk-s5kfndxv.js";import"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{an as buildCss,Cf as extractClassNames,_f as fingerprintConfig,Ef as generateCss,xh as getCachedCSS,wh as getCssServeAsset,y as injectCss,ec as loadCssEngine,tc as loadCssEngineConfig,rr as rebuildCss,vh as resetCssCache,kf as resolveUserCssConfig,Sh as withLinkedModuleBundles};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function Wm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
2
+ var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function qm(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
3
3
  <div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
4
4
  <div class="stx-async-loading" data-async-loading="${e}">
5
5
  ${c}
@@ -226,7 +226,7 @@ catch (error) {
226
226
  loadComponent();
227
227
  })();
228
228
  </script>
229
- `}function qm(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Km(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function Xm(){return`
229
+ `}function Km(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function Xm(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function Gm(){return`
230
230
  /* STX Async Component Styles */
231
231
  .stx-async-component {
232
232
  position: relative;
@@ -300,7 +300,7 @@ catch (error) {
300
300
  background-size: 200% 100%;
301
301
  }
302
302
  }
303
- `}function Gm(){return`
303
+ `}function Jm(){return`
304
304
  // STX Async Component Runtime
305
305
  (function() {
306
306
  if (typeof window === 'undefined') return;
@@ -355,4 +355,4 @@ catch (error) {
355
355
  console.log('[stx] Async component runtime initialized');
356
356
  })();
357
357
  `}
358
- export{Wm,qm,Km,Xm,Gm};
358
+ export{qm,Km,Xm,Gm,Jm};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import S from"fs";import _ from"path";function oo(e){let{token:t,baseUrl:i="https://api.netlify.com/api/v1"}=e;async function s(n,r,l={}){let p=`${i}${r}`,f={Authorization:`Bearer ${t}`,"User-Agent":"stx-deploy/1.0"},u;if(l.rawBody)f["Content-Type"]=l.contentType||"application/octet-stream",u=l.rawBody;else if(l.body)f["Content-Type"]="application/json",u=JSON.stringify(l.body);let o=await fetch(p,{method:n,headers:f,body:u});if(!o.ok){let g=Error(`Netlify API error: ${o.status} ${o.statusText}`);g.status=o.status;try{let b=await o.json();g.message=b.message||g.message,g.code=b.code,g.details=b}catch{}throw g}let a=await o.text();if(!a)return{};return JSON.parse(a)}return{async getSite(n){return s("GET",`/sites/${n}`)},async listSites(){return s("GET","/sites")},async createSite(n){let r={};if(n)r.name=n;return s("POST","/sites",{body:r})},async createDeploy(n,r){let l={files:r.files,draft:r.draft??!0,async:r.async??!0};if(r.title)l.title=r.title;if(r.branch)l.branch=r.branch;if(r.functions)l.functions=r.functions;return s("POST",`/sites/${n}/deploys`,{body:l})},async uploadFile(n,r,l){let p=r.startsWith("/")?r.slice(1):r;await s("PUT",`/deploys/${n}/files/${p}`,{rawBody:l,contentType:"application/octet-stream"})},async uploadFiles(n,r){let p=[...r],f=async()=>{while(p.length>0){let o=p.shift();if(o)await this.uploadFile(n,o.path,o.content)}},u=Array.from({length:Math.min(5,r.length)},()=>f());await Promise.all(u)},async getDeploy(n){return s("GET",`/deploys/${n}`)},async waitForDeploy(n,r={}){let{timeout:l=300000,pollInterval:p=2000,onProgress:f}=r,u=Date.now();while(!0){let o=await this.getDeploy(n);if(f)f(o);if(o.state==="ready")return o;if(o.state==="error"){let a=Error(`Deploy failed: ${o.error_message||"Unknown error"}`);throw a.status=500,a.details=o,a}if(Date.now()-u>l){let a=Error(`Deploy timed out after ${l}ms`);throw a.status=408,a.details=o,a}await new Promise((a)=>setTimeout(a,p))}},async lockDeploy(n){return s("POST",`/deploys/${n}/lock`)},async unlockDeploy(n){return s("POST",`/deploys/${n}/unlock`)}}}async function Yi(e){let t=await crypto.subtle.digest("SHA-1",e);return Array.from(new Uint8Array(t)).map((s)=>s.toString(16).padStart(2,"0")).join("")}async function zr(e,t={}){let{ignore:i=["node_modules",".git",".env*","*.map"]}=t,s=[],n=new Bun.Glob("**/*");for await(let r of n.scan({cwd:e,onlyFiles:!0,dot:!1})){if(i.some((a)=>{if(a.includes("*"))return new RegExp(`^${a.replace(/\*/g,".*")}$`).test(r);return r.includes(a)}))continue;let p=`${e}/${r}`,u=await Bun.file(p).arrayBuffer(),o=await Yi(u);s.push({path:r,content:new Uint8Array(u),sha1:o})}return s}function io(e){let t={};for(let i of e)t[`/${i.path}`]=i.sha1;return t}function ao(e,t){let i=new Set(t.map((s)=>s.startsWith("/")?s.slice(1):s));return e.filter((s)=>i.has(s.path))}function $n(e){if(e<1024)return`${e} B`;if(e<1048576)return`${(e/1024).toFixed(1)} KB`;if(e<1073741824)return`${(e/1048576).toFixed(1)} MB`;return`${(e/1073741824).toFixed(1)} GB`}function qt(e){return e.reduce((t,i)=>t+i.content.byteLength,0)}import m from"fs";import y from"path";function Zi(e){let t=[];if(t.push("[build]"),t.push(` command = "${d(e.build.command)}"`),t.push(` publish = "${d(e.build.publish)}"`),e.build.functions)t.push(` functions = "${d(e.build.functions)}"`);if(e.build.edge_functions)t.push(` edge_functions = "${d(e.build.edge_functions)}"`);if(e.build.environment&&Object.keys(e.build.environment).length>0){t.push(""),t.push("[build.environment]");for(let[i,s]of Object.entries(e.build.environment))t.push(` ${i} = "${d(s)}"`)}if(e.functions){if(t.push(""),t.push("[functions]"),e.functions.directory)t.push(` directory = "${d(e.functions.directory)}"`);if(e.functions.node_bundler)t.push(` node_bundler = "${e.functions.node_bundler}"`);if(e.functions.external_node_modules&&e.functions.external_node_modules.length>0)t.push(` external_node_modules = [${e.functions.external_node_modules.map((i)=>`"${i}"`).join(", ")}]`)}if(e.edge_functions&&e.edge_functions.length>0){t.push("");for(let i of e.edge_functions)t.push("[[edge_functions]]"),t.push(` function = "${d(i.function)}"`),t.push(` path = "${d(i.path)}"`)}if(e.redirects&&e.redirects.length>0){t.push("");for(let i of e.redirects){if(t.push("[[redirects]]"),t.push(` from = "${d(i.from)}"`),t.push(` to = "${d(i.to)}"`),i.status!==void 0)t.push(` status = ${i.status}`);if(i.force!==void 0)t.push(` force = ${i.force}`);if(i.conditions&&Object.keys(i.conditions).length>0){t.push(" [redirects.conditions]");for(let[s,n]of Object.entries(i.conditions))t.push(` ${s} = "${d(n)}"`)}}}if(e.headers&&e.headers.length>0){t.push("");for(let i of e.headers){t.push("[[headers]]"),t.push(` for = "${d(i.for)}"`),t.push(" [headers.values]");for(let[s,n]of Object.entries(i.values))t.push(` ${s} = "${d(n)}"`)}}if(e.plugins&&e.plugins.length>0){t.push("");for(let i of e.plugins)if(t.push("[[plugins]]"),t.push(` package = "${d(i.package)}"`),i.inputs&&Object.keys(i.inputs).length>0){t.push(" [plugins.inputs]");for(let[s,n]of Object.entries(i.inputs))if(typeof n==="string")t.push(` ${s} = "${d(n)}"`);else if(typeof n==="boolean"||typeof n==="number")t.push(` ${s} = ${n}`)}}if(e.context&&Object.keys(e.context).length>0)for(let[i,s]of Object.entries(e.context)){if(t.push(""),t.push(`[context.${i}]`),s.command)t.push(` command = "${d(s.command)}"`);if(s.publish)t.push(` publish = "${d(s.publish)}"`);if(s.environment&&Object.keys(s.environment).length>0){t.push(` [context.${i}.environment]`);for(let[n,r]of Object.entries(s.environment))t.push(` ${n} = "${d(r)}"`)}}return t.join(`
3
3
  `)+`
4
- `}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function Hr(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Vr(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function co(e,t){let i=await Hr(e),s=t||Vr(i),n=Zi(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function lo(e){return m.existsSync(y.join(e,"netlify.toml"))}async function Hg(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new dt(`No Netlify auth token found.
4
+ `}function d(e){return e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function Hr(e){let t={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},i=y.join(e,"package.json");if(await Bun.file(i).exists())try{let u=JSON.parse(await Bun.file(i).text());if(u.scripts?.build)t.buildCommand="bun run build";let o={...u.dependencies,...u.devDependencies};if(o["@stacksjs/stx"]||o.stx)t.framework="stx"}catch{}let s=y.join(e,"stx.config.ts"),n=y.join(e,".config","stx.config.ts");if(await Bun.file(s).exists()||await Bun.file(n).exists())t.framework="stx";let r=["dist","build","out","public",".output"];for(let u of r){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.outputDir=u;break}}let l=["functions","netlify/functions","api"];for(let u of l){let o=y.join(e,u);if(m.existsSync(o)&&m.statSync(o).isDirectory()){t.functionsDir=u;break}}let p=y.join(e,"netlify","edge-functions");if(m.existsSync(p))t.edgeFunctionsDir="netlify/edge-functions";let f=y.join(e,t.outputDir||"dist");if(m.existsSync(f)){let u=m.existsSync(y.join(f,"index.html")),o=m.readdirSync(f).filter((a)=>a.endsWith(".html"));t.isSPA=u&&o.length===1}return t}function Vr(e={}){let t={build:{command:e.buildCommand||"bun run build",publish:e.outputDir||"dist"}};if(e.functionsDir)t.build.functions=e.functionsDir,t.functions={directory:e.functionsDir,node_bundler:"esbuild"};if(e.edgeFunctionsDir)t.build.edge_functions=e.edgeFunctionsDir;if(t.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],e.isSPA!==!1)t.redirects=[{from:"/*",to:"/index.html",status:200}];return t.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},t}async function co(e,t){let i=await Hr(e),s=t||Vr(i),n=Zi(s),r=y.join(e,"netlify.toml");return await Bun.write(r,n),r}function lo(e){return m.existsSync(y.join(e,"netlify.toml"))}async function Vg(e={}){let t=Date.now(),i=[],s=e.cwd||process.cwd(),n=(c)=>{i.push(c)},r=(c)=>{if(e.onProgress)e.onProgress(c)},l=_.resolve(s,e.directory||"dist"),p=e.token||process.env.NETLIFY_AUTH_TOKEN,f=e.siteId||process.env.NETLIFY_SITE_ID;if(!p)throw new dt(`No Netlify auth token found.
5
5
 
6
6
  To deploy to Netlify:
7
7
  1. Create account at https://app.netlify.com
@@ -21,10 +21,10 @@ Run \`stx build\` first or specify a different directory with --directory`,"NO_B
21
21
 
22
22
  Run \`stx build\` to generate files`,"EMPTY_BUILD_DIR");if(e.dryRun){r({stage:"collect",message:"Collecting files..."});let c=await zr(l),w=qt(c);return n(`Would deploy ${c.length} files (${$n(w)})`),n(`From: ${l}`),n(`To: Site ${f}`),n(`Mode: ${e.production?"production":"draft"}`),{success:!0,url:`https://${f}.netlify.app (dry-run)`,deployId:"dry-run",logs:i,duration:Date.now()-t,filesUploaded:c.length,totalSize:w}}let o=oo({token:p});r({stage:"collect",message:"Verifying site..."});try{let c=await o.getSite(f);n(`Deploying to: ${c.name} (${c.url})`)}catch(c){if(c.status===404)throw new dt(`Site not found: ${f}
23
23
 
24
- Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await zr(l),g=qt(a);if(n(`Found ${a.length} files (${$n(g)})`),a.length===0)throw new dt(`No files found in ${l}`,"NO_FILES");let b=io(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=ao(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=qt(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${$n(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:qt(h)}}async function Vg(e={}){let t=e.directory||process.cwd(),i;if(lo(t))i=_.join(t,"netlify.toml");else{let s=await Hr(t);i=await co(t,Vr(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
24
+ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FOUND");throw c}r({stage:"collect",message:"Collecting files..."});let a=await zr(l),g=qt(a);if(n(`Found ${a.length} files (${$n(g)})`),a.length===0)throw new dt(`No files found in ${l}`,"NO_FILES");let b=io(a);r({stage:"upload",message:"Creating deploy...",percent:0});let D=await o.createDeploy(f,{title:e.message||"Deploy from stx CLI",draft:!e.production,files:b});n(`Created deploy: ${D.id}`);let h=ao(a,D.required||[]);if(n(`Uploading ${h.length} files...`),h.length>0){let c=0,w=qt(h);for(let x of h){await o.uploadFile(D.id,x.path,x.content),c++;let C=Math.round(c/h.length*100);r({stage:"upload",message:`Uploading: ${x.path}`,percent:C,details:{uploaded:c,total:h.length}})}n(`Uploaded ${$n(w)}`)}else n("All files already on CDN (no upload needed)");r({stage:"process",message:"Processing deploy..."});let N=await o.waitForDeploy(D.id,{onProgress:(c)=>{r({stage:"process",message:`Status: ${c.state}`,details:c})}}),P=Date.now()-t;if(r({stage:"done",message:"Deploy complete!"}),n(`Deploy complete in ${(P/1000).toFixed(1)}s`),n(`URL: ${N.deploy_ssl_url}`),e.production)n(`Site: ${N.ssl_url}`);if(e.open){let c=e.production?N.ssl_url:N.deploy_ssl_url;I(c)}return{success:!0,url:N.deploy_ssl_url,siteUrl:e.production?N.ssl_url:void 0,deployId:N.id,logs:i,duration:P,filesUploaded:h.length,totalSize:qt(h)}}async function Ug(e={}){let t=e.directory||process.cwd(),i;if(lo(t))i=_.join(t,"netlify.toml");else{let s=await Hr(t);i=await co(t,Vr(s))}if(e.siteId){let s=_.join(t,".env.local"),n="";if(await Bun.file(s).exists()){if(n=await Bun.file(s).text(),n=n.split(`
25
25
  `).filter((r)=>!r.startsWith("NETLIFY_SITE_ID=")).join(`
26
26
  `),n&&!n.endsWith(`
27
27
  `))n+=`
28
28
  `}n+=`NETLIFY_SITE_ID=${e.siteId}
29
29
  `,await Bun.write(s,n)}return{configPath:i,siteId:e.siteId}}class dt extends Error{code;constructor(e,t){super(e);this.name="DeployError",this.code=t}}function I(e){let t=process.platform,i=t==="darwin"?"open":t==="win32"?"start":"xdg-open";Bun.spawn([i,e],{stdio:["ignore","ignore","ignore"]})}
30
- export{oo,Yi,zr,io,ao,$n,qt,Zi,Hr,Vr,co,lo,Hg,Vg,dt};
30
+ export{oo,Yi,zr,io,ao,$n,qt,Zi,Hr,Vr,co,lo,Vg,Ug,dt};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{Sn}from"./chunk-1w4a0xya.js";import{W,S,It,Ot,kr,m,Gc,mi,V,T}from"./chunk-qv2k0qb1.js";import{Zt}from"./chunk-vvm38ysm.js";import{n}from"./chunk-6ch8t3d9.js";import{K}from"./chunk-zjar9jdd.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function N(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var pt="private, no-store";function Rn(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function M(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function An(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${E(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=Rn(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=Rn(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
- `}import _ from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-wadp2rmj.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function ra(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=_.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=_.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function uo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Zt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-09cera09.js"),A=await b(),d={__filename:t,__dirname:_.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Ur(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Sn}from"./chunk-7s9wx19m.js";import{W,S,It,Ot,kr,m,Gc,mi,V,T}from"./chunk-4qrr2mdd.js";import{Zt}from"./chunk-q69dvpg1.js";import{n}from"./chunk-5wp7s24b.js";import{K}from"./chunk-zjar9jdd.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function I(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function X(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function N(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(I(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!X(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(I(h.index,a))continue;let y=h[1]==="/";if(!y&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=y?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var pt="private, no-store";function Rn(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ce(t){return t.headers.get("X-STX-Router")==="true"}function J(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function M(t){return{Vary:J(t,"X-STX-Router")}}function E(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function An(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=S(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${E(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=Rn(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${E(o.content??"")}">`)}else{let l=Rn(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${E(o.href??"")}"${l==="alternate"?` hreflang="${E(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
+ `}import _ from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,k={dev:null,prod:null};function Q(){let t=K()?"dev":"prod",r=k[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-bntw35k0.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;k[t]=`<script>${s()}</script>`}catch{k[t]=""}return k[t]}async function ra(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=_.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=_.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function uo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=Zt(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:y,defaultConfig:R,loadStxConfig:b}=await import("./chunk-t96gj0ey.js"),A=await b(),d={__filename:t,__dirname:_.dirname(t)};for(let g of o){let C=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!g.includes("client")&&!g.includes('type="module"'))await y(C[1],d,t)}let x=await h(f,d,t,{...R,...A,...r},new Set),w=x.indexOf(p);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,w),afterSlot:x.substring(w+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Ur(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -28,5 +28,5 @@ ${c}
28
28
  `));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
29
29
  `));if(R.length>0)d.push(R.filter((x)=>!u.has(x)).join(`
30
30
  `));return d.push(y),d.join(`
31
- `)}import P from"fs";import H from"path";function oa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ia(t,r){let e=H.join(r,"manifest.json");P.writeFileSync(e,JSON.stringify(t,null,2))}function aa(t){let r=H.join(t,"manifest.json");if(!P.existsSync(r))return null;try{let e=P.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function O(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function po(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!po(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(O(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(O(e,a.value,a))}}return r}function ca(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Pn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=It(s),c=Ot(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-fzf7yfpn.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-b8ar6431.js"),{defaultConfig:h}=await import("./chunk-wzp8y0a4.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!mi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=kr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!mi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=T(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Gc(t.html,i)),context:e,cookies:s.cookies}}
31
+ `)}import P from"fs";import H from"path";function oa(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function ia(t,r){let e=H.join(r,"manifest.json");P.writeFileSync(e,JSON.stringify(t,null,2))}function aa(t){let r=H.join(t,"manifest.json");if(!P.existsSync(r))return null;try{let e=P.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function O(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function po(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function B(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!po(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(O(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(O(e,a.value,a))}}return r}function ca(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Pn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=It(s),c=Ot(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-bjggcj45.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-pts7jpqc.js"),{defaultConfig:h}=await import("./chunk-dbx628ra.js"),y=s.streamBoundaries||{},R={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof y[d]==="function"?await y[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,R,new Set)}})),A=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!A.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!mi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await B(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=kr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!mi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=T(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?V(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(Gc(t.html,i)),context:e,cookies:s.cookies}}
32
32
  export{pt,Rn,Ce,M,An,ra,uo,Ur,We,sa,Ee,oa,ia,aa,po,ca,Pn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Df(o){return w.test(o)}async function qo(o,n={}){let i=n.cwd??process.cwd(),u=n.recursive!==!1,l=n.ignorePaths??[],c=globalThis.Bun.Glob,a=new Set,r=(t)=>{if(t.includes(`${e.sep}node_modules${e.sep}`)||t.includes(`${e.sep}dist${e.sep}`))return;if(l.some((s)=>s&&t.includes(e.normalize(s))))return;a.add(t)},d=async(t)=>{try{for await(let s of new c(t).scan({cwd:i,absolute:!0}))r(s)}catch{}};for(let t of o){if(!t)continue;if(Df(t)){await d(t);continue}let s=e.resolve(i,t);if(!g(s))continue;if(p(s).isDirectory()){for await(let f of new c(u?"**/*.stx":"*.stx").scan({cwd:s,absolute:!0}))r(f);continue}r(s)}return[...a].sort()}
3
- export{Df,qo};
2
+ import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Mf(o){return w.test(o)}async function qo(o,n={}){let i=n.cwd??process.cwd(),u=n.recursive!==!1,l=n.ignorePaths??[],c=globalThis.Bun.Glob,a=new Set,r=(t)=>{if(t.includes(`${e.sep}node_modules${e.sep}`)||t.includes(`${e.sep}dist${e.sep}`))return;if(l.some((s)=>s&&t.includes(e.normalize(s))))return;a.add(t)},d=async(t)=>{try{for await(let s of new c(t).scan({cwd:i,absolute:!0}))r(s)}catch{}};for(let t of o){if(!t)continue;if(Mf(t)){await d(t);continue}let s=e.resolve(i,t);if(!g(s))continue;if(p(s).isDirectory()){for await(let f of new c(u?"**/*.stx":"*.stx").scan({cwd:s,absolute:!0}))r(f);continue}r(s)}return[...a].sort()}
3
+ export{Mf,qo};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{xe,di,pi,Qf,Nt,Vc,fi,Uc,zh,Me,hn,Le}from"./chunk-qv2k0qb1.js";import{Jc,s}from"./chunk-nr3pepv1.js";import"./chunk-t8cgxk8w.js";import"./chunk-1g5fg1ys.js";import"./chunk-1w4a0xya.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{xe as BROWSER_CORE_IMPORTS,Qf as STX_AUTO_IMPORTS,di as extractAndStripCssImports,Me as extractBridgeData,Jc as findInterpolationEnd,Uc as generateAutoImportDestructuring,zh as generateBrowserAutoImportDestructuring,hn as generateServerDataBridge,Nt as injectBrowserCoreAutoImports,Le as processClientScript,fi as referencesName,pi as renderVendorStyleTags,s as stripCommentsAndLiterals,Vc as transformAutoImports};
2
+ import{xe,di,pi,eg,Nt,Vc,fi,Uc,Hh,Me,hn,Le}from"./chunk-4qrr2mdd.js";import{Jc,s}from"./chunk-nr3pepv1.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{xe as BROWSER_CORE_IMPORTS,eg as STX_AUTO_IMPORTS,di as extractAndStripCssImports,Me as extractBridgeData,Jc as findInterpolationEnd,Uc as generateAutoImportDestructuring,Hh as generateBrowserAutoImportDestructuring,hn as generateServerDataBridge,Nt as injectBrowserCoreAutoImports,Le as processClientScript,fi as referencesName,pi as renderVendorStyleTags,s as stripCommentsAndLiterals,Vc as transformAutoImports};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{wn,yi}from"./chunk-t8cgxk8w.js";import"./chunk-1g5fg1ys.js";export{yi as generateRuntimeConfigTypes,wn as prepareRuntimeConfig};
2
+ import{wn,yi}from"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";export{yi as generateRuntimeConfigTypes,wn as prepareRuntimeConfig};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function kl(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function jg(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await kl(r,l.join(n,`${m}.${s}`),t))}return i}
3
- export{kl,jg};
2
+ var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function kl(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function Bg(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await kl(r,l.join(n,`${m}.${s}`),t))}return i}
3
+ export{kl,Bg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{u,f,Yc,d,t,c}from"./chunk-1w4a0xya.js";import{Ye,wt,cn,Vo}from"./chunk-qv99gqee.js";function L(w,e){try{let p=w.trim();if(f(p))return d(p,Object.keys(e))(...Object.values(e));else return u(p,e)}catch{return!1}}function Q(w,e,p){let n=w,v=!0;while(v){v=!1;let g=n.match(/@switch\s*\(/);if(!g||g.index===void 0)break;let b=g.index,s=Vo(n,b);if(!s)break;try{let o;if(f(s.expression))o=d(s.expression,Object.keys(e))(...Object.values(e));else o=u(s.expression,e);let r="",a=!1;for(let i of s.cases)if(i.type==="default"){if(!a)r=i.content.trim()}else try{let y;if(i.value&&f(i.value))y=d(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=u(i.value,e);if(o===y){r=i.content.trim(),a=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),a=c("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+a+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(p,n)=>e[Number(n)]??p)}function se(w,e,p){let{masked:n,scripts:v}=H(w);return J(K(n,e,p),v)}function K(w,e,p){let n=w;n=Q(n,e,p);{let g=!0;while(g){g=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Ye(n,s+7);if(!o)break;let r=o.endPos,a=wt(n,"unless","endunless",r);if(a===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,a),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let l;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);l=`@if (${y})${k}@else ${x}@endif`}else l=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+l+n.substring(a+10),g=!0}}n=Lo(n,e,p),n=jo(n,e,p),n=Mo(n,e);let v=()=>{let g=cn(n);if(g.length===0)return!1;let b=Array(g.length);for(let r=g.length-1;r>=0;r--){let a=g[r];try{let i="",y=!1;for(let m of a.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Yc(m.condition,e):!1)i=m.content,y=!0}catch(l){i=c(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=c("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(g.length*2+1),o=0;for(let r=0;r<g.length;r++){let a=g[r];s[r*2]=n.slice(o,a.start),s[r*2+1]=b[r],o=a.end}return s[g.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let g=n;if(!v())break;if(n===g)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let p=w[e];if(p!=="'"&&p!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===p){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Mo(w,e){let p=w;function n(s,o,r,a){let i=1,y=a,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,l.lastIndex=y;let x=m.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,y=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let a=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")a++;else if(k.type==="close")a--;else if(k.type==="else"&&a===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=p.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+5),m=q(y);if(m)a=m.value,i=r+5+m.consumed;else i=r+5;let l=n(p,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=p.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=a?L(`auth?.check && auth?.user?.[${a}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=p.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+6),m=q(y);if(m)a=m.value,i=r+6+m.consumed;else i=r+6;let l=n(p,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=p.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=a?L(`!auth?.check || !auth?.user?.[${a}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(l+9),s=!0}}function g(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let a=[s];if(o)a.push(o);if(r){let i=L(r,e);a.push(i)}return e.permissions.check(...a)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",a=!0;while(a){a=!1;let i=p.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=p.slice(y+`@${s}`.length),l=b(m);if(!l)break;let x=y+`@${s}`.length+l.paramsEnd,k=n(p,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let h=p.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=g(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=g(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}p=p.substring(0,y)+V+p.substring(k+`@${o}`.length),a=!0}}return p}function Lo(w,e,p){let n=w;function v(g,b,s,o,r){let a=!0;while(a){a=!1;let i=new RegExp(`@${b}\\s*\\(`),y=g.match(i);if(!y||y.index===void 0)break;let m=y.index,l=Ye(g,m+`@${b}`.length);if(!l)break;let x=l.endPos,k=wt(g,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";g=g.substring(0,m)+T+g.substring(k+`@${s}`.length),a=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=c(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);g=g.substring(0,m)+_+g.substring(k+`@${s}`.length);break}}return g}return n=v(n,"isset","endisset",(g)=>{let b=L(g,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(g)=>{let b=L(g,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function jo(w,e,p){let n=w,v="development";function g(b,s,o,r){let a=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),l=b,x=!0;while(x){x=!1,a.lastIndex=0;let k=a.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){a.lastIndex=C,i.lastIndex=C;let O=a.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=g(n,"env","endenv",!1),n=g(n,"production","endproduction",v==="production"),n=g(n,"development","enddevelopment",v==="development"),n=g(n,"staging","endstaging",v==="staging"),n=g(n,"testing","endtesting",v==="testing"),n}
2
+ import{u,f,Yc,d,t,c}from"./chunk-7s9wx19m.js";import{Ye,wt,cn,Vo}from"./chunk-py818vbj.js";function L(w,e){try{let p=w.trim();if(f(p))return d(p,Object.keys(e))(...Object.values(e));else return u(p,e)}catch{return!1}}function Q(w,e,p){let n=w,v=!0;while(v){v=!1;let g=n.match(/@switch\s*\(/);if(!g||g.index===void 0)break;let b=g.index,s=Vo(n,b);if(!s)break;try{let o;if(f(s.expression))o=d(s.expression,Object.keys(e))(...Object.values(e));else o=u(s.expression,e);let r="",a=!1;for(let i of s.cases)if(i.type==="default"){if(!a)r=i.content.trim()}else try{let y;if(i.value&&f(i.value))y=d(i.value,Object.keys(e))(...Object.values(e));else if(i.value)y=u(i.value,e);if(o===y){r=i.content.trim(),a=!0;break}}catch{continue}n=n.substring(0,b)+r+n.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),a=c("Switch",`Error evaluating @switch expression: ${r}`,t.EVALUATION_ERROR);n=n.substring(0,b)+a+n.substring(s.end);break}}return n}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(n)=>(e.push(n),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(p,n)=>e[Number(n)]??p)}function se(w,e,p){let{masked:n,scripts:v}=H(w);return J(K(n,e,p),v)}function K(w,e,p){let n=w;n=Q(n,e,p);{let g=!0;while(g){g=!1;let b=n.match(/@unless\s*\(/);if(!b||b.index===void 0)break;let s=b.index,o=Ye(n,s+7);if(!o)break;let r=o.endPos,a=wt(n,"unless","endunless",r);if(a===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=n.slice(r,a),y=o.expression,m=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){m=P.pos;break}}let l;if(m!==-1){let x=i.slice(0,m),k=i.slice(m+5);l=`@if (${y})${k}@else ${x}@endif`}else l=`@if (!(${y}))${i}@endif`;n=n.substring(0,s)+l+n.substring(a+10),g=!0}}n=Lo(n,e,p),n=jo(n,e,p),n=Mo(n,e);let v=()=>{let g=cn(n);if(g.length===0)return!1;let b=Array(g.length);for(let r=g.length-1;r>=0;r--){let a=g[r];try{let i="",y=!1;for(let m of a.branches){if(y)break;if(m.type==="else")i=m.content,y=!0;else try{if(m.condition?Yc(m.condition,e):!1)i=m.content,y=!0}catch(l){i=c(m.type==="if"?"If":"Elseif",`Error in @${m.type}(${m.condition}): ${l instanceof Error?l.message:String(l)}`,t.EVALUATION_ERROR),y=!0}}b[r]=i}catch(i){let y=i instanceof Error?i.message:String(i);b[r]=c("If",`Error processing @if block: ${y}`,t.EVALUATION_ERROR)}}let s=Array(g.length*2+1),o=0;for(let r=0;r<g.length;r++){let a=g[r];s[r*2]=n.slice(o,a.start),s[r*2+1]=b[r],o=a.end}return s[g.length*2]=n.slice(o),n=s.join(""),!0};while(!0){let g=n;if(!v())break;if(n===g)break}return n}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let p=w[e];if(p!=="'"&&p!=='"')return null;e++;let n=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){n.push(w[e+1]),e+=2;continue}if(v===p){e++;break}n.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:n.join(""),consumed:e}}function Mo(w,e){let p=w;function n(s,o,r,a){let i=1,y=a,m=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(y<s.length&&i>0){m.lastIndex=y,l.lastIndex=y;let x=m.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,y=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;y=E+k[0].length}else break}return-1}function v(s,o,r){let a=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),y=new RegExp(`@${r}(?![a-z])`,"g"),m=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=m.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")a++;else if(k.type==="close")a--;else if(k.type==="else"&&a===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=p.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+5),m=q(y);if(m)a=m.value,i=r+5+m.consumed;else i=r+5;let l=n(p,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=p.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=a?L(`auth?.check && auth?.user?.[${a}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=p.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,a,i,y=p.slice(r+6),m=q(y);if(m)a=m.value,i=r+6+m.consumed;else i=r+6;let l=n(p,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=p.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=a?L(`!auth?.check || !auth?.user?.[${a}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";p=p.substring(0,r)+E+p.substring(l+9),s=!0}}function g(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let a=[s];if(o)a.push(o);if(r){let i=L(r,e);a.push(i)}return e.permissions.check(...a)}catch{return!1}return!1}function b(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",a=!0;while(a){a=!1;let i=p.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let y=i.index,m=p.slice(y+`@${s}`.length),l=b(m);if(!l)break;let x=y+`@${s}`.length+l.paramsEnd,k=n(p,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${y} has no matching @${o} \u2014 the block was skipped.`);break}let h=p.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=b(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=g(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=g(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}p=p.substring(0,y)+V+p.substring(k+`@${o}`.length),a=!0}}return p}function Lo(w,e,p){let n=w;function v(g,b,s,o,r){let a=!0;while(a){a=!1;let i=new RegExp(`@${b}\\s*\\(`),y=g.match(i);if(!y||y.index===void 0)break;let m=y.index,l=Ye(g,m+`@${b}`.length);if(!l)break;let x=l.endPos,k=wt(g,b,s,x);if(k===-1){console.warn(`[stx] @${b} directive at position ${m} has no matching @${s} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";g=g.substring(0,m)+T+g.substring(k+`@${s}`.length),a=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=c(r,`Error processing @${b} directive: ${T}`,t.EVALUATION_ERROR);g=g.substring(0,m)+_+g.substring(k+`@${s}`.length);break}}return g}return n=v(n,"isset","endisset",(g)=>{let b=L(g,e);return b!==void 0&&b!==null},"Isset"),n=v(n,"empty","endempty",(g)=>{let b=L(g,e);return b===void 0||b===null||b===""||b===0||b===!1||Array.isArray(b)&&b.length===0||typeof b==="object"&&b!==null&&Object.keys(b).length===0},"Empty"),n}function jo(w,e,p){let n=w,v="development";function g(b,s,o,r){let a=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),y=new RegExp(`^@${s}(?![a-z])`),m=new RegExp(`^@${o}(?![a-z])`),l=b,x=!0;while(x){x=!1,a.lastIndex=0;let k=a.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){a.lastIndex=C,i.lastIndex=C;let O=a.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(y.test(j)){_++,M=O+1;continue}if(m.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return n=g(n,"env","endenv",!1),n=g(n,"production","endproduction",v==="production"),n=g(n,"development","enddevelopment",v==="development"),n=g(n,"staging","endstaging",v==="staging"),n=g(n,"testing","endtesting",v==="testing"),n}
3
3
  export{se,Mo,Lo,jo};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sn,Eo,To,$o,bh,Ro}from"./chunk-cyd10m6m.js";import"./chunk-ztbk9yqv.js";import"./chunk-fxy7jjnv.js";import"./chunk-1g5fg1ys.js";export{To as buildServerApi,bh as createServerApi,sn as discoverServerApi,Eo as generateApiTypes,Ro as isServerApiSource,$o as productionApiDispatcher};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{er,i}from"./chunk-5q97egpw.js";import"./chunk-rk2v0wzs.js";import"./chunk-h8yk9qm7.js";import"./chunk-hxyarbb6.js";import"./chunk-8x4gmead.js";import"./chunk-enzrpxsj.js";import"./chunk-5wp7s24b.js";import"./chunk-p7h4y7mk.js";import"./chunk-ecakhzkq.js";import{we}from"./chunk-jgmmg2fw.js";import"./chunk-py818vbj.js";import"./chunk-s5kfndxv.js";import"./chunk-rfzfk8zd.js";import"./chunk-svrjbeyq.js";import"./chunk-nrh8t8re.js";import"./chunk-ztbk9yqv.js";import"./chunk-cz3trbvn.js";import"./chunk-fxy7jjnv.js";import{Oe,Ls,js}from"./chunk-4qrr2mdd.js";import"./chunk-rj9dcjeg.js";import"./chunk-1g5fg1ys.js";import"./chunk-7s9wx19m.js";import"./chunk-4833k99b.js";import"./chunk-07c8rk93.js";export{er as buildModulesTag,we as injectRouterScript,i as processDirectives,Ls as processJsonDirective,js as processOnceDirective,Oe as validateClientScript};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{w}from"./chunk-1w4a0xya.js";function Ye(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=w(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function wt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=Ye(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function cn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function ms(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=w(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=wt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Vo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=Ye(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Ye,wt,cn,ms,Vo};
2
+ import{w}from"./chunk-7s9wx19m.js";function Ye(e,r){let n=v(e,r);return n.ok?{expression:n.expression,endPos:n.endPos}:null}function v(e,r){let n=r;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="(")return{ok:!1,reason:"missing-open-paren",pos:n};let c=w(e,"(",")",n);if(c===-1)return{ok:!1,reason:"unclosed-paren",pos:n};return{ok:!0,expression:e.slice(n+1,c),endPos:c+1}}function y(e,r){let n=e.lastIndexOf("<",r);if(n===-1)return!1;return n>e.lastIndexOf(">",r)}function wt(e,r,n,c){let o=1,i=c,u=new RegExp(`@${r}\\s*\\(`,"g"),a=new RegExp(`@${n}(?![a-z])`,"g");while(i<e.length&&o>0){u.lastIndex=i,a.lastIndex=i;let p=u.exec(e),t=a.exec(e),s=p?p.index:1/0,f=t?t.index:1/0;if(s<f)o++,i=s+p[0].length;else if(f<1/0){if(o--,o===0)return f;i=f+t[0].length}else break}return-1}function P(e,r){let n=e.slice(r).match(/^@if\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"if","endif",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s="if",f=o.expression,l=0,x=0;while(t<a.length){let h=a.indexOf("@",t);if(h===-1)break;t=h;let d=a.substring(h);if(y(a,h)){t++;continue}if(/^@if\s*\(/.test(d)){x++,t++;continue}if(/^@endif(?![a-z])/.test(d)){x--,t+=6;continue}if(x===0){let g=d.match(/^@elseif\s*/);if(g){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t});let m=t+g[0].length,b=Ye(a,m);if(!b){t++;continue}s="elseif",f=b.expression,t=b.endPos,l=t;continue}else if(/^@else(?![a-z])/.test(d)){p.push({type:s,condition:f,content:a.substring(l,t),start:i+l,end:i+t}),s="else",f=void 0,t+=5,l=t;continue}}t++}return p.push({type:s,condition:f,content:a.slice(l),start:i+l,end:i+a.length}),{fullMatch:e.slice(r,u+6),branches:p,start:r,end:u+6}}function cn(e){let r=[],n=/@if\s*\(/g,c=n.exec(e);while(c!==null){if(r.some((u)=>c.index>u.start&&c.index<u.end)){c=n.exec(e);continue}let i=P(e,c.index);if(i)r.push(i),n.lastIndex=i.end;c=n.exec(e)}return r}function ms(e,r,n){let c=[],o=new RegExp(`@${r}\\s*\\(`,"g"),i=o.exec(e);while(i!==null){if(c.some((d)=>i.index>d.start&&i.index<d.end)){i=o.exec(e);continue}let a=i.index,p=a+i[0].length-1,t=w(e,"(",")",p);if(t===-1){i=o.exec(e);continue}let s=e.slice(p+1,t),f=t+1,l=wt(e,r,n,f);if(l===-1){i=o.exec(e);continue}let x=e.slice(f,l),h=l+`@${n}`.length;c.push({fullMatch:e.slice(a,h),name:r,params:s,content:x,start:a,end:h}),o.lastIndex=h,i=o.exec(e)}return c}function Vo(e,r){let n=e.slice(r).match(/^@switch\s*/);if(!n)return null;let c=r+n[0].length,o=Ye(e,c);if(!o)return null;let i=o.endPos,u=wt(e,"switch","endswitch",i);if(u===-1)return null;let a=e.slice(i,u),p=[],t=0,s=null,f=0;while(t<a.length){let l=a.slice(t),x=l.match(/^@switch\s*\(/),h=l.match(/^@endswitch(?![a-z])/);if(x){if(f++,s)s.content+=x[0];t+=x[0].length;continue}if(h){if(f--,s)s.content+=h[0];t+=h[0].length;continue}if(f>0){if(s)s.content+=a[t];t++;continue}let d=l.match(/^@case\s*/),g=l.match(/^@default(?![a-z])/),m=l.match(/^@break(?![a-z])/);if(d&&l.startsWith("@case")){if(s)p.push(s);let b=t+d[0].length,E=Ye(a,b);if(!E){t++;continue}s={type:"case",value:E.expression,content:""},t=E.endPos}else if(g&&l.startsWith("@default")){if(s)p.push(s);s={type:"default",content:""},t+=g[0].length}else if(m&&l.startsWith("@break"))t+=m[0].length;else{if(s)s.content+=a[t];t++}}if(s)p.push(s);return{fullMatch:e.slice(r,u+10),expression:o.expression,cases:p,start:r,end:u+10}}export{Ye,wt,cn,ms,Vo};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-1w4a0xya.js";import"./chunk-07c8rk93.js";import"./chunk-4833k99b.js";import"./chunk-qv2k0qb1.js";import"./chunk-1g5fg1ys.js";import"./chunk-t8cgxk8w.js";import"./chunk-c1b481my.js";import"./chunk-knzp4c6m.js";import{l}from"./chunk-s2py8kg7.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-7s9wx19m.js";import"./chunk-07c8rk93.js";import"./chunk-4833k99b.js";import"./chunk-4qrr2mdd.js";import"./chunk-1g5fg1ys.js";import"./chunk-rj9dcjeg.js";import"./chunk-nrh8t8re.js";import"./chunk-svrjbeyq.js";import{l}from"./chunk-s2py8kg7.js";import u from"fs";import m from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||l(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=m.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),c=JSON.parse(p);if(c.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(c.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{W,Ne}from"./chunk-qv2k0qb1.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Zt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{W,Ne}from"./chunk-4qrr2mdd.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Zt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{Zt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Om,Nm}from"./chunk-342e6mhn.js";export{Nm as ensureTeleportTargets,Om as processTeleportDirectives};