@stacksjs/bun-router 0.1.0 → 0.1.2

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 (150) hide show
  1. package/dist/chunk-03m2j6h7.js +2 -0
  2. package/dist/chunk-08cw7ejr.js +3 -0
  3. package/dist/chunk-0e4g0fyv.js +62 -0
  4. package/dist/chunk-0mmn02yw.js +2 -0
  5. package/dist/chunk-126c9qm3.js +2 -0
  6. package/dist/chunk-12p13817.js +2 -0
  7. package/dist/chunk-14v65c37.js +4 -0
  8. package/dist/{chunk-s3dn1kwx.js → chunk-1b6a7t3v.js} +2 -2
  9. package/dist/chunk-1wenkmk0.js +2 -0
  10. package/dist/chunk-2152npfd.js +2 -0
  11. package/dist/chunk-26w23krx.js +2 -0
  12. package/dist/chunk-2g8m379z.js +10 -0
  13. package/dist/{chunk-5mxby3fd.js → chunk-2rr178et.js} +2 -2
  14. package/dist/chunk-2w8f3swz.js +29 -0
  15. package/dist/chunk-3y4gaz7v.js +82 -0
  16. package/dist/chunk-4r1x4afz.js +12 -0
  17. package/dist/chunk-4wyw66zk.js +2 -0
  18. package/dist/chunk-4z5sf8ag.js +2 -0
  19. package/dist/{chunk-krkchy8v.js → chunk-58tfvayh.js} +3 -3
  20. package/dist/{chunk-ex5fkjah.js → chunk-5dp83qcx.js} +43 -43
  21. package/dist/chunk-5f0d9j9a.js +2 -0
  22. package/dist/{chunk-zhx0hxdd.js → chunk-5z52b0fc.js} +7 -7
  23. package/dist/{chunk-kc659vhx.js → chunk-5zrnk2kq.js} +3 -3
  24. package/dist/chunk-6dmqtdnq.js +2 -0
  25. package/dist/{chunk-5s1pr62n.js → chunk-6e91956t.js} +2 -2
  26. package/dist/{chunk-jrf5a2ap.js → chunk-6rv8w5jk.js} +1 -1
  27. package/dist/{chunk-5n0ckcmc.js → chunk-6x1feysm.js} +2 -2
  28. package/dist/chunk-7y72hm1x.js +2 -0
  29. package/dist/{chunk-zetqzgf3.js → chunk-8hbhfh6b.js} +6 -6
  30. package/dist/{chunk-5ncn73tp.js → chunk-8kfzygg5.js} +2 -2
  31. package/dist/chunk-8wydx2we.js +2 -0
  32. package/dist/chunk-8zjnjvv7.js +2 -0
  33. package/dist/chunk-988h4bzr.js +2 -0
  34. package/dist/chunk-9b6a58ac.js +2 -0
  35. package/dist/chunk-a8fcaywb.js +2 -0
  36. package/dist/chunk-bfjwn7yg.js +2 -0
  37. package/dist/chunk-bp2522mm.js +2 -0
  38. package/dist/chunk-bswe62q4.js +48 -0
  39. package/dist/chunk-c3v796c8.js +943 -0
  40. package/dist/chunk-ccqmwdry.js +2 -0
  41. package/dist/chunk-ck0crwnx.js +2 -0
  42. package/dist/chunk-cqgkxcb4.js +2 -0
  43. package/dist/chunk-dntnakjy.js +2 -0
  44. package/dist/{chunk-67wgad4f.js → chunk-ettdpnrw.js} +2 -2
  45. package/dist/{chunk-csfrpsp7.js → chunk-ezqwq17j.js} +10 -10
  46. package/dist/chunk-ezx3qsez.js +2 -0
  47. package/dist/{chunk-73k79n7q.js → chunk-f72nnjy4.js} +360 -360
  48. package/dist/chunk-fna5n0ey.js +246 -0
  49. package/dist/chunk-fqhckdt8.js +2 -0
  50. package/dist/chunk-fr6hbx25.js +2 -0
  51. package/dist/{chunk-vr10sbbh.js → chunk-g9cwng6w.js} +1 -1
  52. package/dist/chunk-gd3za5x0.js +2 -0
  53. package/dist/chunk-gf28608k.js +2 -0
  54. package/dist/chunk-h1dj6v8q.js +3 -0
  55. package/dist/chunk-hjxe7k2g.js +2 -0
  56. package/dist/chunk-hrkgznbn.js +2 -0
  57. package/dist/chunk-j6h5v0br.js +2 -0
  58. package/dist/{chunk-0gjq8ttx.js → chunk-mgb01qdv.js} +2 -2
  59. package/dist/chunk-n24c9whp.js +2 -0
  60. package/dist/{chunk-kxp888dn.js → chunk-n2j24b0h.js} +244 -244
  61. package/dist/{chunk-vv3gb1m5.js → chunk-nhmtg01n.js} +2 -2
  62. package/dist/chunk-p0qhpnqh.js +70 -0
  63. package/dist/chunk-p0w1x8y2.js +3 -0
  64. package/dist/{chunk-9ght4n4r.js → chunk-p3dk1w2w.js} +11 -11
  65. package/dist/{chunk-6sjvhy5f.js → chunk-q4e9pxs7.js} +2 -2
  66. package/dist/chunk-q5dv1kyy.js +2 -0
  67. package/dist/chunk-qnqgf9tq.js +2 -0
  68. package/dist/chunk-qvwy1808.js +898 -0
  69. package/dist/{chunk-5s0pnsd6.js → chunk-r18f77vc.js} +4 -4
  70. package/dist/chunk-r63za1mr.js +2 -0
  71. package/dist/{chunk-6s1kbajm.js → chunk-rft8gw92.js} +1 -1
  72. package/dist/chunk-ryvmyskt.js +4211 -0
  73. package/dist/chunk-sa6mx308.js +2 -0
  74. package/dist/chunk-va0pc7hx.js +2 -0
  75. package/dist/chunk-vcp8dnjq.js +412 -0
  76. package/dist/chunk-vg1erq1q.js +2 -0
  77. package/dist/{chunk-hmgedrmr.js → chunk-w0jv49ch.js} +3 -3
  78. package/dist/{chunk-0t5vz87j.js → chunk-wm805tte.js} +19 -19
  79. package/dist/chunk-xj9h6mc9.js +2 -0
  80. package/dist/chunk-ytvzwrq3.js +51 -0
  81. package/dist/{chunk-w4r464v5.js → chunk-zde7ebc4.js} +2 -2
  82. package/dist/chunk-zmqsv2xy.js +2 -0
  83. package/dist/cli.js +57 -66
  84. package/dist/container/index.js +1 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.js +29 -29
  87. package/dist/typed/client.d.ts +89 -0
  88. package/dist/typed/contract.d.ts +34 -0
  89. package/dist/typed/endpoint.d.ts +90 -0
  90. package/dist/typed/index.d.ts +14 -0
  91. package/dist/typed/router.d.ts +141 -0
  92. package/package.json +1 -1
  93. package/dist/chunk-30rkn2ym.js +0 -2
  94. package/dist/chunk-38cmrard.js +0 -2
  95. package/dist/chunk-3qna6dwd.js +0 -2
  96. package/dist/chunk-4d5fmta0.js +0 -2
  97. package/dist/chunk-4x3b4b4q.js +0 -2
  98. package/dist/chunk-6xed4va1.js +0 -2
  99. package/dist/chunk-748n6ydj.js +0 -2
  100. package/dist/chunk-7rsf8tes.js +0 -898
  101. package/dist/chunk-8aspmtf1.js +0 -2
  102. package/dist/chunk-8yfdg595.js +0 -2
  103. package/dist/chunk-90eze7av.js +0 -3
  104. package/dist/chunk-9dvwyej7.js +0 -2
  105. package/dist/chunk-a2w45krb.js +0 -2
  106. package/dist/chunk-a547f2ab.js +0 -48
  107. package/dist/chunk-bqdycvtc.js +0 -2
  108. package/dist/chunk-cd03rk3x.js +0 -2
  109. package/dist/chunk-ct0m17q5.js +0 -2
  110. package/dist/chunk-dhbvvr5h.js +0 -2
  111. package/dist/chunk-dhptcsya.js +0 -943
  112. package/dist/chunk-dq93zag9.js +0 -2
  113. package/dist/chunk-edrtesh7.js +0 -2
  114. package/dist/chunk-ejcws37w.js +0 -2
  115. package/dist/chunk-ex890p45.js +0 -51
  116. package/dist/chunk-f69cpnhw.js +0 -2
  117. package/dist/chunk-fjf53b44.js +0 -2
  118. package/dist/chunk-fjzye4qj.js +0 -2
  119. package/dist/chunk-gfd23b6t.js +0 -2
  120. package/dist/chunk-habv0vef.js +0 -12
  121. package/dist/chunk-hz6fc788.js +0 -2
  122. package/dist/chunk-jff6j9y3.js +0 -10
  123. package/dist/chunk-jmeb7n8k.js +0 -70
  124. package/dist/chunk-jy2jhcpy.js +0 -246
  125. package/dist/chunk-m249t3je.js +0 -3
  126. package/dist/chunk-m9yabnjx.js +0 -2
  127. package/dist/chunk-mekrq9wd.js +0 -2
  128. package/dist/chunk-mmxv535f.js +0 -82
  129. package/dist/chunk-mypn7jss.js +0 -2
  130. package/dist/chunk-n18x1k3c.js +0 -2
  131. package/dist/chunk-nkddjzsa.js +0 -2
  132. package/dist/chunk-pjmhqmr9.js +0 -2
  133. package/dist/chunk-qyrnsaq1.js +0 -2
  134. package/dist/chunk-r19ff2qm.js +0 -62
  135. package/dist/chunk-r338fssq.js +0 -2
  136. package/dist/chunk-s36z58x2.js +0 -29
  137. package/dist/chunk-s79dd325.js +0 -471
  138. package/dist/chunk-ta38j9em.js +0 -2
  139. package/dist/chunk-tpfgntwj.js +0 -4211
  140. package/dist/chunk-vw8rwv6e.js +0 -2
  141. package/dist/chunk-wcrqs5z9.js +0 -2
  142. package/dist/chunk-x6d1rmwa.js +0 -2
  143. package/dist/chunk-x7ft15zz.js +0 -2
  144. package/dist/chunk-x8trwn7j.js +0 -3
  145. package/dist/chunk-xhepdj1f.js +0 -2
  146. package/dist/chunk-xv2em0q4.js +0 -4
  147. package/dist/chunk-ypw6g0te.js +0 -2
  148. package/dist/chunk-z8szsm21.js +0 -2
  149. package/dist/chunk-zfbh14qe.js +0 -2
  150. /package/dist/{chunk-a3wahyg7.js → chunk-nf3kv7kv.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function i(){return`<script data-stx-hydration-runtime>
2
+ function b(){return`<script data-stx-hydration-runtime>
3
3
  (function() {
4
4
  'use strict';
5
5
 
@@ -159,16 +159,16 @@ else {
159
159
  stxIslands.initIslands();
160
160
  }
161
161
  })();
162
- </script>`}function J(r){if(r.size===0)return"";return`<script data-stx-island-manifest>
162
+ </script>`}function D(t){if(t.size===0)return"";return`<script data-stx-island-manifest>
163
163
  (function() {
164
164
  if (!window.__stxIslands) return;
165
- ${Array.from(r.entries()).map(([e,t])=>` window.__stxIslands.register('${e}', function() { return import('${t}'); });`).join(`
165
+ ${Array.from(t.entries()).map(([e,n])=>` window.__stxIslands.register('${e}', function() { return import('${n}'); });`).join(`
166
166
  `)}
167
167
  })();
168
- </script>`}function E(r){let e=r.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(e)return e[1];let t=r.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(t)return t[1];return null}function L(r,e){let t={},a=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,u;while((u=a.exec(r))!==null){let c=u[1],n=u[2];if(n in e)t[c]=e[n];else t[c]=n}return t}function q(){let r=new Map;return{islands:r,register(e){r.set(e.id,e)},get(e){return r.get(e)},async hydrate(e){let t=r.get(e);if(!t||t.hydrated)return;if(t.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:e,component:t.component}}))},async hydrateAll(){let e=Array.from(r.values()).filter((t)=>!t.hydrated).map((t)=>this.hydrate(t.id));await Promise.all(e)}}}function k(r){return`
169
- <script data-hydrate="${r}">
168
+ </script>`}function g(t){let e=t.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(e)return e[1];let n=t.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(t,e){let n={},a=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=a.exec(t))!==null){let d=i[1],o=i[2];if(o in e)n[d]=e[o];else n[d]=o}return n}function L(){let t=new Map;return{islands:t,register(e){t.set(e.id,e)},get(e){return t.get(e)},async hydrate(e){let n=t.get(e);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:e,component:n.component}}))},async hydrateAll(){let e=Array.from(t.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(e)}}}function I(t){return`
169
+ <script data-hydrate="${t}">
170
170
  (function() {
171
- const island = document.querySelector('[data-island="${r}"]');
171
+ const island = document.querySelector('[data-island="${t}"]');
172
172
  if (!island) return;
173
173
 
174
174
  // Immediately hydrate
@@ -176,10 +176,10 @@ ${Array.from(r.entries()).map(([e,t])=>` window.__stxIslands.register('${e}', f
176
176
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
177
177
  })();
178
178
  </script>
179
- `}function s(r,e){let t=e.timeout||2000,a=e.priority||"low";return`
180
- <script data-hydrate="${r}">
179
+ `}function S(t,e){let n=e.timeout||2000,a=e.priority||"low";return`
180
+ <script data-hydrate="${t}">
181
181
  (function() {
182
- const island = document.querySelector('[data-island="${r}"]');
182
+ const island = document.querySelector('[data-island="${t}"]');
183
183
  if (!island) return;
184
184
 
185
185
  function hydrate() {
@@ -189,7 +189,7 @@ ${Array.from(r.entries()).map(([e,t])=>` window.__stxIslands.register('${e}', f
189
189
  }
190
190
 
191
191
  if ('requestIdleCallback' in window) {
192
- const idleOptions = { timeout: ${t} };
192
+ const idleOptions = { timeout: ${n} };
193
193
  ${a==="high"?"requestIdleCallback(hydrate, idleOptions);":`
194
194
  // Low priority: wait for multiple idle periods
195
195
  let idleCount = 0;
@@ -208,14 +208,14 @@ else {
208
208
  }
209
209
  else {
210
210
  // Fallback for browsers without requestIdleCallback
211
- setTimeout(hydrate, ${t});
211
+ setTimeout(hydrate, ${n});
212
212
  }
213
213
  })();
214
214
  </script>
215
- `}function x(r,e){let t=e.rootMargin||"0px",a=e.threshold||0;return`
216
- <script data-hydrate="${r}">
215
+ `}function C(t,e){let n=e.rootMargin||"0px",a=e.threshold||0;return`
216
+ <script data-hydrate="${t}">
217
217
  (function() {
218
- const island = document.querySelector('[data-island="${r}"]');
218
+ const island = document.querySelector('[data-island="${t}"]');
219
219
  if (!island) return;
220
220
 
221
221
  function hydrate() {
@@ -233,7 +233,7 @@ else {
233
233
  }
234
234
  });
235
235
  }, {
236
- rootMargin: '${t}',
236
+ rootMargin: '${n}',
237
237
  threshold: ${JSON.stringify(a)}
238
238
  });
239
239
 
@@ -245,10 +245,10 @@ else {
245
245
  }
246
246
  })();
247
247
  </script>
248
- `}function A(r,e){let t=e.media||"(min-width: 768px)";return`
249
- <script data-hydrate="${r}">
248
+ `}function k(t,e){let n=e.media||"(min-width: 768px)";return`
249
+ <script data-hydrate="${t}">
250
250
  (function() {
251
- const island = document.querySelector('[data-island="${r}"]');
251
+ const island = document.querySelector('[data-island="${t}"]');
252
252
  if (!island) return;
253
253
 
254
254
  function hydrate() {
@@ -257,7 +257,7 @@ else {
257
257
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
258
258
  }
259
259
 
260
- const mediaQuery = window.matchMedia('${t}');
260
+ const mediaQuery = window.matchMedia('${n}');
261
261
 
262
262
  function handleMediaChange(e) {
263
263
  if (e.matches) {
@@ -274,10 +274,10 @@ else {
274
274
  }
275
275
  })();
276
276
  </script>
277
- `}function C(r){return`
278
- <script data-hydrate="${r}">
277
+ `}function M(t){return`
278
+ <script data-hydrate="${t}">
279
279
  (function() {
280
- const island = document.querySelector('[data-island="${r}"]');
280
+ const island = document.querySelector('[data-island="${t}"]');
281
281
  if (!island) return;
282
282
 
283
283
  function hydrate() {
@@ -296,10 +296,10 @@ else {
296
296
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
297
297
  })();
298
298
  </script>
299
- `}function H(r,e){let t=e.event||"stx:activate";return`
300
- <script data-hydrate="${r}">
299
+ `}function q(t,e){let n=e.event||"stx:activate";return`
300
+ <script data-hydrate="${t}">
301
301
  (function() {
302
- const island = document.querySelector('[data-island="${r}"]');
302
+ const island = document.querySelector('[data-island="${t}"]');
303
303
  if (!island) return;
304
304
 
305
305
  function hydrate() {
@@ -309,36 +309,36 @@ else {
309
309
  }
310
310
 
311
311
  // Listen for custom event
312
- window.addEventListener('${t}', function handler(e) {
313
- if (!e.detail || e.detail.id === '${r}' || e.detail.id === '*') {
314
- window.removeEventListener('${t}', handler);
312
+ window.addEventListener('${n}', function handler(e) {
313
+ if (!e.detail || e.detail.id === '${t}' || e.detail.id === '*') {
314
+ window.removeEventListener('${n}', handler);
315
315
  hydrate();
316
316
  }
317
317
  });
318
318
  })();
319
319
  </script>
320
- `}function z(r,e={},t){let a=r,u=!1,c=/@client:(load|idle|visible|media|only|hover|event)/i.test(r);if(a=o(a,"load",e),a=o(a,"idle",e),a=o(a,"visible",e),a=o(a,"media",e),a=N(a),a=o(a,"hover",e),a=o(a,"event",e),u=c&&a!==r,u)a+=`
321
- `+i();return a}function o(r,e,t){let a=new RegExp(`@client:${e}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return r.replace(a,(u,c,n)=>{let f={strategy:e};if(c)try{let M=c.split(",").map((b)=>b.trim());for(let b of M){let[d,g]=b.split(":").map((w)=>w.trim());if(d&&g){let w=g.replace(/^['"]|['"]$/g,"");f[d]=w}}}catch{}let h=`island-${Math.random().toString(36).substring(2,9)}`,y=E(n.trim()),l=L(n.trim(),t),v=[];if(f.rootMargin)v.push(`data-root-margin="${f.rootMargin}"`);if(f.threshold!==void 0)v.push(`data-threshold="${f.threshold}"`);if(f.media)v.push(`data-media="${f.media}"`);if(f.event)v.push(`data-event="${f.event}"`);if(y)v.push(`data-component="${y}"`);let _=Object.keys(l).length>0?`
322
- <script type="application/json" data-island-props="${h}">${JSON.stringify(l)}</script>`:"",m="";switch(e){case"load":m=k(h);break;case"idle":m=s(h,f);break;case"visible":m=x(h,f);break;case"media":m=A(h,f);break;case"hover":m=C(h);break;case"event":m=H(h,f);break}return`
323
- <div data-island="${h}"
320
+ `}function H(t,e={},n){let a=t,i=!1,d=/@client:(load|idle|visible|media|only|hover|event)/i.test(t);if(a=u(a,"load",e),a=u(a,"idle",e),a=u(a,"visible",e),a=u(a,"media",e),a=_(a),a=u(a,"hover",e),a=u(a,"event",e),i=d&&a!==t,i)a+=`
321
+ `+b();return a}function u(t,e,n){let a=new RegExp(`@client:${e}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return t.replace(a,(i,d,o)=>{let r={strategy:e};if(d)try{let E=d.split(",").map((h)=>h.trim());for(let h of E){let[m,v]=h.split(":").map((y)=>y.trim());if(m&&v){let y=v.replace(/^['"]|['"]$/g,"");r[m]=y}}}catch{}let s=`island-${Math.random().toString(36).substring(2,9)}`,p=g(o.trim()),f=w(o.trim(),n),c=[];if(r.rootMargin)c.push(`data-root-margin="${r.rootMargin}"`);if(r.threshold!==void 0)c.push(`data-threshold="${r.threshold}"`);if(r.media)c.push(`data-media="${r.media}"`);if(r.event)c.push(`data-event="${r.event}"`);if(p)c.push(`data-component="${p}"`);let x=Object.keys(f).length>0?`
322
+ <script type="application/json" data-island-props="${s}">${JSON.stringify(f)}</script>`:"",l="";switch(e){case"load":l=I(s);break;case"idle":l=S(s,r);break;case"visible":l=C(s,r);break;case"media":l=k(s,r);break;case"hover":l=M(s);break;case"event":l=q(s,r);break}return`
323
+ <div data-island="${s}"
324
324
  data-strategy="${e}"
325
- ${v.join(`
325
+ ${c.join(`
326
326
  `)}
327
327
  class="stx-island"
328
328
  style="contents;">
329
- ${n.trim()}${_}
329
+ ${o.trim()}${x}
330
330
  </div>
331
- ${m}
332
- `})}function N(r){let e=/@client:only\s*([\s\S]*?)@endclient/gi;return r.replace(e,(t,a)=>{let u=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
333
- <div data-island="${u}"
331
+ ${l}
332
+ `})}function _(t){let e=/@client:only\s*([\s\S]*?)@endclient/gi;return t.replace(e,(n,a)=>{let i=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
333
+ <div data-island="${i}"
334
334
  data-strategy="only"
335
335
  class="stx-island stx-client-only">
336
336
  <!-- Client-only content will be rendered here -->
337
337
  <template data-client-content>${a.trim()}</template>
338
338
  </div>
339
- <script data-hydrate="${u}">
339
+ <script data-hydrate="${i}">
340
340
  (function() {
341
- const island = document.querySelector('[data-island="${u}"]');
341
+ const island = document.querySelector('[data-island="${i}"]');
342
342
  if (!island) return;
343
343
 
344
344
  const template = island.querySelector('template[data-client-content]');
@@ -348,7 +348,7 @@ else {
348
348
  }
349
349
  })();
350
350
  </script>
351
- `})}function O(){return`
351
+ `})}function A(){return`
352
352
  /* Island base styles */
353
353
  .stx-island {
354
354
  display: contents;
@@ -389,9 +389,9 @@ else {
389
389
  .stx-island.hydrated {
390
390
  opacity: 1;
391
391
  }
392
- `}function p(r){if(typeof window>"u")return;let e=document.querySelector(`[data-island="${r}"]`);if(!e||e.classList.contains("hydrated"))return;e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function T(r){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${r}"]:not(.hydrated)`).forEach((e)=>{e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Z(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((r)=>{r.classList.add("hydrated"),r.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function $(r){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${r}"]`)?.classList.contains("hydrated")??!1}function j(r){return new Promise((e)=>{if(typeof window>"u"){e();return}let t=document.querySelector(`[data-island="${r}"]`);if(!t){e();return}if(t.classList.contains("hydrated")){e();return}t.addEventListener("stx:hydrated",()=>e(),{once:!0})})}function Q(r){return r.replace(/@static\s*([\s\S]*?)@endstatic/gi,(e,t)=>{return`<div class="stx-static">${t.trim()}</div>`})}function F(r){let e=r.map((t)=>({id:t.id,component:t.component,strategy:t.options.strategy,props:t.props}));return`
392
+ `}function N(t){if(typeof window>"u")return;let e=document.querySelector(`[data-island="${t}"]`);if(!e||e.classList.contains("hydrated"))return;e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function O(t){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${t}"]:not(.hydrated)`).forEach((e)=>{e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function P(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function z(t){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${t}"]`)?.classList.contains("hydrated")??!1}function T(t){return new Promise((e)=>{if(typeof window>"u"){e();return}let n=document.querySelector(`[data-island="${t}"]`);if(!n){e();return}if(n.classList.contains("hydrated")){e();return}n.addEventListener("stx:hydrated",()=>e(),{once:!0})})}function j(t){return t.replace(/@static\s*([\s\S]*?)@endstatic/gi,(e,n)=>`<div class="stx-static">${n.trim()}</div>`)}function B(t){let e=t.map((n)=>({id:n.id,component:n.component,strategy:n.options.strategy,props:n.props}));return`
393
393
  <script type="application/json" id="stx-island-manifest">
394
394
  ${JSON.stringify(e)}
395
395
  </script>
396
- `}var G={processPartialHydrationDirectives:z,processStaticDirectives:Q,generatePartialHydrationCSS:O,generateIslandManifest:F,createIslandRegistry:q,hydrateIsland:p,hydrateByStrategy:T,hydrateAll:Z,isHydrated:$,onHydrated:j};
397
- export{i as _d,J as $d,E as ae,L as be,q as ce,z as de,O as ee,p as fe,T as ge,Z as he,$ as ie,j as je,Q as ke,F as le,G as me};
396
+ `}var J={processPartialHydrationDirectives:H,processStaticDirectives:j,generatePartialHydrationCSS:A,generateIslandManifest:B,createIslandRegistry:L,hydrateIsland:N,hydrateByStrategy:O,hydrateAll:P,isHydrated:z,onHydrated:T};
397
+ export{b as _d,D as $d,g as ae,w as be,L as ce,H as de,A as ee,N as fe,O as ge,P as he,z as ie,T as je,j as ke,B as le,J as me};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kf as a,Lf as b,Mf as c,Nf as d,Of as e,Pf as f,Qf as g,Rf as h,Sf as i,Tf as j,Uf as k,Vf as l,Wf as m,Xf as n}from"./chunk-8hbhfh6b.js";import"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{c as SUSPENSE_RESOLVER_RUNTIME,b as buildSuspenseResolveScript,h as createStreamRenderer,f as extractStreamBoundaries,n as generateHydrationRuntime,j as islandDirective,l as processSectionDirectives,e as processStreamDirectives,k as registerStreamingDirectives,d as renderStreamingPage,a as streamTemplate,g as streamTemplateSimple,m as streamToResponse,i as streamingSuspenseDirective};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{Ff as S,Gf as $,Hf as f}from"./chunk-e3qej0jr.js";import{fj as x,og as g,pg as y}from"./chunk-tpfgntwj.js";import{Un as h}from"./chunk-brpgjyqg.js";import{Mo as v}from"./chunk-5be9x5cq.js";import _ from"path";var a=new Map,m=new Map,k=["composables","functions"];function B(r){let e=_.basename(r,".ts");return e==="index"||e==="types"||r.endsWith(".d.ts")}async function A(r){if(r)return _.resolve(r);let e=`<default>:${process.cwd()}`,n=m.get(e);if(n!==void 0)return n;let s=await E();if(s!==null)m.set(e,s);return s}async function E(){let r=await x(),e=r.root||process.cwd(),n=r.composablesDir;if(n)return _.resolve(e,n);for(let s of k){let i=_.resolve(e,s);try{let u=new Bun.Glob("**/*.ts");for await(let c of u.scan({cwd:i,absolute:!0}))if(!B(c))return i}catch{}}return null}async function G(r){let e=await A(r);if(!e)return null;let n=[];try{let t=new Bun.Glob("**/*.ts");for await(let o of t.scan({cwd:e,absolute:!0})){if(B(o))continue;n.push(o)}}catch{return f(a,e,"",""),null}let s=S(n),i=$(a,e,s);if(i!==void 0)return i||null;if(n.length===0)return f(a,e,s,""),null;n.sort();let u=new Bun.Transpiler({loader:"ts",target:"browser",define:v()}),c=[],d=new Set,p=new Set;for(let t of n)try{let o=await Bun.file(t).text(),N=_.basename(t,".ts");for(let l of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(l[1])p.add(l[1]);try{for(let l of u.scan(o).exports)if(l!=="default")d.add(l)}catch{}o=g(o),o=y(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=u.transformSync(o),c.push(`// Composable: ${N}
3
- ${o.trim()}`)}catch(o){console.warn(`[stx] Failed to load composable ${t}:`,o)}if(c.length===0||d.size===0)return f(a,e,s,""),null;let D=[...d].map((t)=>` try { __c[${JSON.stringify(t)}] = ${t}; } catch (e) {}`).join(`
4
- `),C=JSON.stringify([...d]),w=c.join(`
2
+ import{Ff as S,Gf as B,Hf as f}from"./chunk-e3qej0jr.js";import{fj as x,og as g,pg as y}from"./chunk-ryvmyskt.js";import{Un as h}from"./chunk-brpgjyqg.js";import{Mo as v}from"./chunk-5be9x5cq.js";import _ from"path";var a=new Map,m=new Map,A=["composables","functions"];function D(r){let e=_.basename(r,".ts");return e==="index"||e==="types"||r.endsWith(".d.ts")}async function E(r){if(r)return _.resolve(r);let e=`<default>:${process.cwd()}`,n=m.get(e);if(n!==void 0)return n;let s=await I();if(s!==null)m.set(e,s);return s}async function I(){let r=await x(),e=r.root||process.cwd(),n=r.composablesDir;if(n)return _.resolve(e,n);for(let s of A){let i=_.resolve(e,s);try{let u=new Bun.Glob("**/*.ts");for await(let c of u.scan({cwd:i,absolute:!0}))if(!D(c))return i}catch{}}return null}async function J(r){let e=await E(r);if(!e)return null;let n=[];try{let t=new Bun.Glob("**/*.ts");for await(let o of t.scan({cwd:e,absolute:!0})){if(D(o))continue;n.push(o)}}catch{return f(a,e,"",""),null}let s=S(n),i=B(a,e,s);if(i!==void 0)return i||null;if(n.length===0)return f(a,e,s,""),null;n.sort();let u=new Bun.Transpiler({loader:"ts",target:"browser",define:v()}),c=[],d=new Set,p=new Set;for(let t of n)try{let o=await Bun.file(t).text(),k=_.basename(t,".ts");for(let l of o.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(l[1])p.add(l[1]);try{for(let l of u.scan(o).exports)if(l!=="default")d.add(l)}catch{}o=g(o),o=y(o),o=o.replace(/^export\s+(default\s+)?/gm,""),o=u.transformSync(o),c.push(`// Composable: ${k}
3
+ ${o.trim()}`)}catch(o){console.warn(`[stx] Failed to load composable ${t}:`,o)}if(c.length===0||d.size===0)return f(a,e,s,""),null;let C=[...d].map((t)=>` try { __c[${JSON.stringify(t)}] = ${t}; } catch (e) {}`).join(`
4
+ `),N=JSON.stringify([...d]),w=c.join(`
5
5
 
6
6
  `),b=`;(function(){
7
7
  window.__composables = window.__composables || {};
@@ -10,8 +10,8 @@ var __stx = window.stx || {};
10
10
  ${h.filter((t)=>!p.has(t)&&new RegExp(`\\b${t}\\b`).test(w)).map((t)=>`var ${t} = __stx[${JSON.stringify(t)}];`).join(`
11
11
  `)}
12
12
  ${w}
13
- ${D}
14
- var __names = ${C};
13
+ ${C}
14
+ var __names = ${N};
15
15
  for (var __i = 0; __i < __names.length; __i++) {
16
16
  var __n = __names[__i];
17
17
  if (!(__n in __c)) continue;
@@ -24,5 +24,5 @@ ${D}
24
24
  }
25
25
  window[__n] = __c[__n];
26
26
  }
27
- })();`;return f(a,e,s,b),b}function J(){a.clear(),m.clear()}
28
- export{G as Df,J as Ef};
27
+ })();`;return f(a,e,s,b),b}function L(){a.clear(),m.clear()}
28
+ export{J as Df,L as Ef};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),w=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function $(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,c=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,n;while((n=p.exec(o))!==null){let e=n[1]==="/",t=n[2],a=n[3]==="/";if(f.has(t.toLowerCase()))continue;if(a)continue;if(e)c.set(t,(c.get(t)??0)+1);else{let d=s.get(t);if(d)d.count++;else{let u=o.slice(0,n.index).split(`
3
- `).length;s.set(t,{count:1,firstLine:u})}}}let r=[];for(let e of new Set([...s.keys(),...c.keys()])){if(w.has(e.toLowerCase()))continue;let t=s.get(e)?.count??0,a=c.get(e)??0;if(t!==a)r.push({tag:e,opened:t,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return r}var g=new Set;function h(i,o){let s;try{s=$(i)}catch{return}if(s.length===0)return;let c=`${o}:${i.length}`;if(g.has(c))return;g.add(c);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:n,opened:r,closed:e,firstOpenLine:t}of s)if(r>e){let a=t?` (first opened at line ${t})`:"";console.warn(`[stx] ${p}: <${n}> ${r} opened, ${e} closed \u2014 an unclosed <${n}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${n}> ${r} opened, ${e} closed \u2014 ${e-r} stray </${n}>.`)}
4
- export{$ as Gp,h as Hp};
2
+ var f=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),w=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);function l(i){return i.replace(/[^\n]/g," ")}function h(i){let o=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,l).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,l).replace(/<!--[\s\S]*?-->/g,l).replace(/\{\{\{[\s\S]*?\}\}\}/g,l).replace(/\{\{[\s\S]*?\}\}/g,l).replace(/\{!![\s\S]*?!!\}/g,l),s=new Map,c=new Map,p=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,n;while((n=p.exec(o))!==null){let e=n[1]==="/",t=n[2],a=n[3]==="/";if(f.has(t.toLowerCase()))continue;if(a)continue;if(e)c.set(t,(c.get(t)??0)+1);else{let d=s.get(t);if(d)d.count++;else{let u=o.slice(0,n.index).split(`
3
+ `).length;s.set(t,{count:1,firstLine:u})}}}let r=[];for(let e of new Set([...s.keys(),...c.keys()])){if(w.has(e.toLowerCase()))continue;let t=s.get(e)?.count??0,a=c.get(e)??0;if(t!==a)r.push({tag:e,opened:t,closed:a,firstOpenLine:s.get(e)?.firstLine??0})}return r}var g=new Set;function b(i,o){let s;try{s=h(i)}catch{return}if(s.length===0)return;let c=`${o}:${i.length}`;if(g.has(c))return;g.add(c);let p=o?o.split(/[/\\]/).pop()||o:"template";for(let{tag:n,opened:r,closed:e,firstOpenLine:t}of s)if(r>e){let a=t?` (first opened at line ${t})`:"";console.warn(`[stx] ${p}: <${n}> ${r} opened, ${e} closed \u2014 an unclosed <${n}>${a} may swallow the content that follows it.`)}else console.warn(`[stx] ${p}: <${n}> ${r} opened, ${e} closed \u2014 ${e-r} stray </${n}>.`)}
4
+ export{h as Oo,b as Po};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Df as a,Ef as b}from"./chunk-5z52b0fc.js";import"./chunk-e3qej0jr.js";import"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{b as clearComposableCache,a as getComposableScript};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import s from"path";var x=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function j(e,i){let a=i.formats??d;if(!i.publicDir)return e;let n=$(e),u=[],p=/<img\b[^>]*?>/gi,c=[],o;while((o=p.exec(e))!==null){let t=o[0],r=t.match(/\bsrc=["']([^"']+)["']/i);if(!r)continue;if(R(o.index,n))continue;c.push({idx:o.index,length:t.length,src:r[1],raw:t})}if(c.length===0)return e;let m=await Promise.all(c.map(async(t)=>{let r=await b(t.src,i.publicDir,a);return{match:t,sources:r}}));for(let{match:t,sources:r}of m){if(r.length===0)continue;let h=`<picture>${r.map((g)=>`<source type="${g.mime}" srcset="${S(g.url)}">`).join("")}${t.raw}</picture>`;u.push({start:t.idx,end:t.idx+t.length,replacement:h})}if(u.length===0)return e;let f="",l=0;for(let t of u)f+=e.slice(l,t.start),f+=t.replacement,l=t.end;return f+=e.slice(l),f}async function b(e,i,a){if(!w(e))return[];let n=s.extname(e).toLowerCase();if(!x.has(n))return[];if(!e.startsWith("/"))return[];let u=s.join(i,e.slice(1)),p=s.dirname(u),c=s.basename(u,n),o=s.resolve(p),m=s.resolve(i);if(!o.startsWith(m))return[];let f=s.posix.dirname(e),l=a.map(async(t)=>{let r=s.join(p,`${c}${t.ext}`);if(!await Bun.file(r).exists())return null;return{url:s.posix.join(f,`${c}${t.ext}`),mime:t.mime}});return(await Promise.all(l)).filter((t)=>t!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function $(e){let i=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,n;while((n=a.exec(e))!==null)i.push([n.index,n.index+n[0].length]);return i}function R(e,i){for(let[a,n]of i)if(e>=a&&e<n)return!0;return!1}function S(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
- export{j as ve};
2
+ import s from"path";var x=new Set([".jpg",".jpeg",".png",".gif"]),d=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}];async function v(e,i){let a=i.formats??d;if(!i.publicDir)return e;let n=R(e),u=[],p=/<img\b[^>]*?>/gi,c=[],o;while((o=p.exec(e))!==null){let t=o[0],r=t.match(/\bsrc=["']([^"']+)["']/i);if(!r)continue;if(S(o.index,n))continue;c.push({idx:o.index,length:t.length,src:r[1],raw:t})}if(c.length===0)return e;let m=await Promise.all(c.map(async(t)=>{let r=await b(t.src,i.publicDir,a);return{match:t,sources:r}}));for(let{match:t,sources:r}of m){if(r.length===0)continue;let h=`<picture>${r.map((g)=>`<source type="${g.mime}" srcset="${W(g.url)}">`).join("")}${t.raw}</picture>`;u.push({start:t.idx,end:t.idx+t.length,replacement:h})}if(u.length===0)return e;let f="",l=0;for(let t of u)f+=e.slice(l,t.start),f+=t.replacement,l=t.end;return f+=e.slice(l),f}async function b(e,i,a){if(!w(e))return[];let n=s.extname(e).toLowerCase();if(!x.has(n))return[];if(!e.startsWith("/"))return[];let u=s.join(i,e.slice(1)),p=s.dirname(u),c=s.basename(u,n),o=s.resolve(p),m=s.resolve(i);if(!o.startsWith(m))return[];let f=s.posix.dirname(e),l=a.map(async(t)=>{let r=s.join(p,`${c}${t.ext}`);if(!await Bun.file(r).exists())return null;return{url:s.posix.join(f,`${c}${t.ext}`),mime:t.mime}});return(await Promise.all(l)).filter((t)=>t!==null)}function w(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function R(e){let i=[],a=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,n;while((n=a.exec(e))!==null)i.push([n.index,n.index+n[0].length]);return i}function S(e,i){for(let[a,n]of i)if(e>=a&&e<n)return!0;return!1}function W(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}
3
+ export{v as ve};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{_ as r}from"./chunk-sw0chtw4.js";import"./chunk-xg9xscqz.js";import"./chunk-a3wahyg7.js";export{r as PrometheusExporter};
2
+ import{_ as r}from"./chunk-sw0chtw4.js";import"./chunk-xg9xscqz.js";import"./chunk-nf3kv7kv.js";export{r as PrometheusExporter};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{createHash as y}from"crypto";import{readFile as k,stat as x}from"fs/promises";async function g(t){try{let e=await k(t);return y("sha256").update(e).digest("hex").slice(0,16)}catch{return""}}function N(t){return y("sha256").update(t).digest("hex").slice(0,16)}function p(t){return y("sha256").update(t).digest("hex").slice(0,16)}function d(t,e){let a=JSON.stringify(e,Object.keys(e).sort());return`${p(t)}-${p(a)}`}async function m(t){try{return(await x(t)).mtimeMs}catch{return 0}}async function C(t){try{return await x(t),!0}catch{return!1}}import{mkdir as v,readFile as D,writeFile as E,readdir as S,rm as w,stat as z}from"fs/promises";import{join as h,dirname as O}from"path";var f=new Map,u={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function P(t){try{await v(t,{recursive:!0})}catch{}}function F(t,e,a){return h(t,a,`${e}.json`)}async function A(t,e,a){if((Date.now()-t.createdAt)/86400000>a)return!1;if(await m(e)!==t.srcMtime)return!1;return!0}async function K(t,e,a,c=u){if(!c.enabled)return null;let r=d(t,e),i=f.get(r);if(i){if(await A(i,t,c.maxAge))return i.lastAccessedAt=Date.now(),i.data;f.delete(r)}let s=F(c.directory,r,a);if(await C(s))try{let n=await D(s,"utf-8"),o=JSON.parse(n);if(await A(o,t,c.maxAge))return o.lastAccessedAt=Date.now(),f.set(r,o),o.data}catch{}return null}async function V(t,e,a,c,r=u){if(!r.enabled)return;let i=d(t,e),s=await g(t),n=await m(t),o={key:i,src:t,srcHash:s,srcMtime:n,optionsHash:d("",e),data:a,createdAt:Date.now(),lastAccessedAt:Date.now()};f.set(i,o);let l=F(r.directory,i,c);try{await P(O(l)),await E(l,JSON.stringify(o,null,2))}catch(M){console.warn(`[stx-media] Failed to write cache: ${M}`)}}async function q(t,e=u){if(t==="all")f.clear();else f.clear();let a=t==="all"?["image","video"]:[t];for(let c of a){let r=h(e.directory,c);try{await w(r,{recursive:!0,force:!0})}catch{}}}async function G(t=u){let e={memoryEntries:f.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let a of["image","video"]){let c=h(t.directory,a);try{let r=await S(c);e.diskEntries[a]=r.length;for(let i of r){let s=h(c,i),n=await z(s);e.totalSizeMB+=n.size/1048576}}catch{}}return e}async function I(t=u){let e=0,a=t.maxAge*24*60*60*1000;for(let c of["image","video"]){let r=h(t.directory,c);try{let i=await S(r);for(let s of i){let n=h(r,s);try{let o=await D(n,"utf-8"),l=JSON.parse(o);if(Date.now()-l.createdAt>a)await w(n),f.delete(l.key),e++}catch{await w(n).catch(()=>{}),e++}}}catch{}}return e}
3
- export{g as Fu,N as Gu,p as Hu,d as Iu,m as Ju,C as Ku,K as Lu,V as Mu,q as Nu,G as Ou,I as Pu};
2
+ import{createHash as y}from"crypto";import{readFile as k,stat as x}from"fs/promises";async function g(t){try{let e=await k(t);return y("sha256").update(e).digest("hex").slice(0,16)}catch{return""}}function N(t){return y("sha256").update(t).digest("hex").slice(0,16)}function p(t){return y("sha256").update(t).digest("hex").slice(0,16)}function d(t,e){let a=JSON.stringify(e,Object.keys(e).sort());return`${p(t)}-${p(a)}`}async function m(t){try{return(await x(t)).mtimeMs}catch{return 0}}async function C(t){try{return await x(t),!0}catch{return!1}}import{mkdir as v,readFile as D,writeFile as E,readdir as S,rm as w,stat as z}from"fs/promises";import{join as h,dirname as O}from"path";var f=new Map,u={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500};async function P(t){try{await v(t,{recursive:!0})}catch{}}function F(t,e,a){return h(t,a,`${e}.json`)}async function A(t,e,a){if((Date.now()-t.createdAt)/86400000>a)return!1;if(await m(e)!==t.srcMtime)return!1;return!0}async function V(t,e,a,c=u){if(!c.enabled)return null;let r=d(t,e),i=f.get(r);if(i){if(await A(i,t,c.maxAge))return i.lastAccessedAt=Date.now(),i.data;f.delete(r)}let s=F(c.directory,r,a);if(await C(s))try{let n=await D(s,"utf-8"),o=JSON.parse(n);if(await A(o,t,c.maxAge))return o.lastAccessedAt=Date.now(),f.set(r,o),o.data}catch{}return null}async function q(t,e,a,c,r=u){if(!r.enabled)return;let i=d(t,e),s=await g(t),n=await m(t),o={key:i,src:t,srcHash:s,srcMtime:n,optionsHash:d("",e),data:a,createdAt:Date.now(),lastAccessedAt:Date.now()};f.set(i,o);let l=F(r.directory,i,c);try{await P(O(l)),await E(l,JSON.stringify(o,null,2))}catch(M){console.warn(`[stx-media] Failed to write cache: ${M}`)}}async function G(t,e=u){if(t==="all")f.clear();else f.clear();let a=t==="all"?["image","video"]:[t];for(let c of a){let r=h(e.directory,c);try{await w(r,{recursive:!0,force:!0})}catch{}}}async function I(t=u){let e={memoryEntries:f.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let a of["image","video"]){let c=h(t.directory,a);try{let r=await S(c);e.diskEntries[a]=r.length;for(let i of r){let s=h(c,i),n=await z(s);e.totalSizeMB+=n.size/1048576}}catch{}}return e}async function L(t=u){let e=0,a=t.maxAge*24*60*60*1000;for(let c of["image","video"]){let r=h(t.directory,c);try{let i=await S(r);for(let s of i){let n=h(r,s);try{let o=await D(n,"utf-8"),l=JSON.parse(o);if(Date.now()-l.createdAt>a)await w(n),f.delete(l.key),e++}catch{await w(n).catch(()=>{}),e++}}}catch{}}return e}
3
+ export{g as Fu,N as Gu,p as Hu,d as Iu,m as Ju,C as Ku,V as Lu,q as Mu,G as Nu,I as Ou,L as Pu};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{En as a,Fn as b,Gn as c,Hn as d,In as e,Jn as f,Kn as g,Ln as h,Mn as i,Nn as j,On as k,Pn as l,Qn as m,Rn as n,Sn as o,Tn as p}from"./chunk-58tfvayh.js";import"./chunk-nf3kv7kv.js";export{m as applyHead,h as definePageMeta,a as getHead,b as getPageMeta,e as mergeHeadConfigs,n as processHeadDirective,p as processMetaDirective,o as processTitleDirective,l as renderBodyAttrs,j as renderHead,k as renderHtmlAttrs,c as resetHead,g as seoMetaToHeadConfig,d as useHead,i as usePageTitle,f as useSeoMeta,i as useTitle};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Fj as T,Om as M,dj as $,xm as x}from"./chunk-tpfgntwj.js";import{yn as E}from"./chunk-0t5vz87j.js";import C from"path";var R={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},_=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var I=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function z(e){let t=[],i=0,n;I.lastIndex=0;while((n=I.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function V(e,t={},i={}){let n={...$,...i,streaming:{...R,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),y=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=y?y[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:C.dirname(e)};if(l.trim())await E(l,u,e);let p=z(c),m=new Set;if(!p.some((f)=>f.type==="suspense")){let f=n.streaming?.strategy||"auto",g=new RegExp(_.source,"g");if(!(f!=="manual"&&g.test(c))){let o=await x(c,u,e,n,m);for(let d=0;d<o.length;d+=s)r.enqueue(o.slice(d,d+s)),await new Promise((h)=>setTimeout(h,0))}else{let o=[],d=new RegExp(_.source,"g"),h;while((h=d.exec(c))!==null)o.push({name:h[1],content:h[2],start:h.index,end:h.index+h[0].length});let w=0;for(let S of o){if(S.start>w){let v=c.slice(w,S.start);if(v.trim()){let k=await x(v,u,e,n,m);r.enqueue(k),await new Promise((O)=>setTimeout(O,0))}}let b=await x(S.content,u,e,n,m);r.enqueue(b),await new Promise((v)=>setTimeout(v,0)),w=S.end}if(w<c.length){let S=c.slice(w);if(S.trim()){let b=await x(S,u,e,n,m);r.enqueue(b)}}}}else{let f=new Map;for(let o of p)if(o.type==="shell"||o.type==="content"){let d=await x(o.content,u,e,n,m);r.enqueue(d)}else if(o.type==="suspense"&&o.name){let d=`stx-suspense-${o.name}`;r.enqueue(`<div id="${d}" data-suspense="${o.name}" style="display:contents;">
2
+ import{Fj as T,Om as k,dj as R,xm as x}from"./chunk-ryvmyskt.js";import{yn as E}from"./chunk-wm805tte.js";import C from"path";var I={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},_=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var q=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],i=0,n;q.lastIndex=0;while((n=q.exec(e))!==null){if(n.index>i){let a=e.slice(i,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),i=n.index+n[0].length}if(i<e.length){let s=e.slice(i);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function W(e,t={},i={}){let n={...R,...i,streaming:{...I,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),y=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=y?y[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:C.dirname(e)};if(l.trim())await E(l,u,e);let p=H(c),m=new Set;if(!p.some((f)=>f.type==="suspense")){let f=n.streaming?.strategy||"auto",g=new RegExp(_.source,"g");if(!(f!=="manual"&&g.test(c))){let o=await x(c,u,e,n,m);for(let d=0;d<o.length;d+=s)r.enqueue(o.slice(d,d+s)),await new Promise((h)=>setTimeout(h,0))}else{let o=[],d=new RegExp(_.source,"g"),h;while((h=d.exec(c))!==null)o.push({name:h[1],content:h[2],start:h.index,end:h.index+h[0].length});let w=0;for(let S of o){if(S.start>w){let v=c.slice(w,S.start);if(v.trim()){let O=await x(v,u,e,n,m);r.enqueue(O),await new Promise((z)=>setTimeout(z,0))}}let b=await x(S.content,u,e,n,m);r.enqueue(b),await new Promise((v)=>setTimeout(v,0)),w=S.end}if(w<c.length){let S=c.slice(w);if(S.trim()){let b=await x(S,u,e,n,m);r.enqueue(b)}}}}else{let f=new Map;for(let o of p)if(o.type==="shell"||o.type==="content"){let d=await x(o.content,u,e,n,m);r.enqueue(d)}else if(o.type==="suspense"&&o.name){let d=`stx-suspense-${o.name}`;r.enqueue(`<div id="${d}" data-suspense="${o.name}" style="display:contents;">
3
3
  <template data-suspense-fallback>Loading...</template>
4
4
  </div>`),f.set(o.name,x(o.content,u,e,n,m))}r.enqueue(`
5
5
  <script>
@@ -17,13 +17,13 @@ import{Fj as T,Om as M,dj as $,xm as x}from"./chunk-tpfgntwj.js";import{yn as E}
17
17
  }
18
18
  };
19
19
  })();
20
- </script>`);let g=Array.from(f.entries()).map(async([o,d])=>{r.enqueue(await q(o,d))});await Promise.all(g)}r.close()}catch(a){r.error(a)}}})}async function q(e,t){try{let i=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
20
+ </script>`);let g=Array.from(f.entries()).map(async([o,d])=>{r.enqueue(await M(o,d))});await Promise.all(g)}r.close()}catch(a){r.error(a)}}})}async function M(e,t){try{let i=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
21
21
  <script>
22
22
  window.__stxSuspense.resolve('${e}', \`${i}\`);
23
23
  </script>`}catch(i){let n=i instanceof Error?i.message:String(i);return`
24
24
  <script>
25
25
  window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${T(n)}</div>');
26
- </script>`}}var H=`
26
+ </script>`}}var A=`
27
27
  <script>
28
28
  (function(){
29
29
  window.__stxSuspense = window.__stxSuspense || {
@@ -43,12 +43,12 @@ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading conte
43
43
  }
44
44
  };
45
45
  })();
46
- </script>`;function A(e,t,i){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${i}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function W(e,t=[],i={}){let n=i.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(H),await Promise.all(t.map(async(r)=>{let a=A(r.render(),n,r.id);s.enqueue(await q(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var D=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function G(e,t){return e.replace(D,(i,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),y=a[0].trim(),l=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=y,`<div data-suspense="${r}">${l}</div>`})}function J(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let i=Object.entries(t).filter(([,n])=>typeof n==="function");return i.length>0?i.map(([n,s])=>({id:n,render:s})):void 0}async function K(e,t={},i={}){let n={...$,...i,streaming:{...R,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),y=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=y?y[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:C.dirname(e)};if(l.trim())await E(l,u,e);let p=new Set,m=n.streaming?.strategy||"auto",f=new RegExp(_.source,"g");if(!(m!=="manual"&&f.test(c))){let g=await x(c,u,e,n,p);for(let o=0;o<g.length;o+=s)r.enqueue(g.slice(o,o+s))}else{let g=[],o=new RegExp(_.source,"g"),d;while((d=o.exec(c))!==null)g.push({name:d[1],content:d[2],start:d.index,end:d.index+d[0].length});let h=0;for(let w of g){if(w.start>h){let b=c.slice(h,w.start);if(b.trim()){let v=await x(b,u,e,n,p);r.enqueue(v)}}let S=await x(w.content,u,e,n,p);r.enqueue(S),h=w.end}if(h<c.length){let w=c.slice(h);if(w.trim()){let S=await x(w,u,e,n,p);r.enqueue(S)}}}r.close()}catch(a){r.error(a)}}})}async function Q(e,t={}){let i={...$,...t,streaming:{...R,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y=a,l={},c;_.lastIndex=0;while((c=_.exec(a))!==null){let p=c[1],m=c[2];l[p]=m}let u=a.replace(_,"");return{renderShell:async(p={})=>{let m={...p,__filename:e,__dirname:C.dirname(e)};return await E(r,m,e),x(u,m,e,i,new Set)},renderSection:async(p,m={})=>{try{if(!l[p])return`<div class="error-message">Section "${T(p)}" not found in template "${T(e)}"</div>`;let f={...m,__filename:e,__dirname:C.dirname(e)};await E(r,f,e);let g=new Set;return await x(l[p],f,e,i,g)}catch(f){let g=f instanceof Error?f.message:String(f);return M("Expression",g,e,l[p]||"",0,l[p]||"")}},getSections:()=>{return Object.keys(l)},getTemplate:()=>{return y}}}var N={name:"suspense",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},L={name:"island",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,y=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),l=y?y[1].trim():"",c=y?e.replace(y[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
46
+ </script>`;function D(e,t,i){if(!t||t<=0)return e;let n,s=new Promise((r,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${i}" timed out after ${t}ms`)),t)});return Promise.race([e,s]).finally(()=>clearTimeout(n))}function G(e,t=[],i={}){let n=i.timeoutMs??0;return new ReadableStream({async start(s){try{if(s.enqueue(e),t.length>0)s.enqueue(A),await Promise.all(t.map(async(r)=>{let a=D(r.render(),n,r.id);s.enqueue(await M(r.id,a))}));s.close()}catch(r){s.error(r)}}})}var N=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;function J(e,t){return e.replace(N,(i,n,s)=>{let r=n.trim(),a=s.split(/@fallback/i),y=a[0].trim(),l=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[r]=y,`<div data-suspense="${r}">${l}</div>`})}function K(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let i=Object.entries(t).filter(([,n])=>typeof n==="function");return i.length>0?i.map(([n,s])=>({id:n,render:s})):void 0}async function Q(e,t={},i={}){let n={...R,...i,streaming:{...I,...i.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),y=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=y?y[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:C.dirname(e)};if(l.trim())await E(l,u,e);let p=new Set,m=n.streaming?.strategy||"auto",f=new RegExp(_.source,"g");if(!(m!=="manual"&&f.test(c))){let g=await x(c,u,e,n,p);for(let o=0;o<g.length;o+=s)r.enqueue(g.slice(o,o+s))}else{let g=[],o=new RegExp(_.source,"g"),d;while((d=o.exec(c))!==null)g.push({name:d[1],content:d[2],start:d.index,end:d.index+d[0].length});let h=0;for(let w of g){if(w.start>h){let b=c.slice(h,w.start);if(b.trim()){let v=await x(b,u,e,n,p);r.enqueue(v)}}let S=await x(w.content,u,e,n,p);r.enqueue(S),h=w.end}if(h<c.length){let w=c.slice(h);if(w.trim()){let S=await x(w,u,e,n,p);r.enqueue(S)}}}r.close()}catch(a){r.error(a)}}})}async function Y(e,t={}){let i={...R,...t,streaming:{...I,...t.streaming}},n=await Bun.file(e).text(),s=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),r=s?s[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y=a,l={},c;_.lastIndex=0;while((c=_.exec(a))!==null){let p=c[1],m=c[2];l[p]=m}let u=a.replace(_,"");return{renderShell:async(p={})=>{let m={...p,__filename:e,__dirname:C.dirname(e)};return await E(r,m,e),x(u,m,e,i,new Set)},renderSection:async(p,m={})=>{try{if(!l[p])return`<div class="error-message">Section "${T(p)}" not found in template "${T(e)}"</div>`;let f={...m,__filename:e,__dirname:C.dirname(e)};await E(r,f,e);let g=new Set;return await x(l[p],f,e,i,g)}catch(f){let g=f instanceof Error?f.message:String(f);return k("Expression",g,e,l[p]||"",0,l[p]||"")}},getSections:()=>Object.keys(l),getTemplate:()=>y}}var L={name:"suspense",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let s=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${s} -->${e}<!-- @endsuspense:${s} -->`}},j={name:"island",hasEndTag:!0,handler:(e,t,i,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let s=t[0].replace(/['"`]/g,""),r=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${s}-${Math.random().toString(36).substring(2,9)}`,y=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),l=y?y[1].trim():"",c=y?e.replace(y[0],""):e;return`<div data-island="${s}" data-island-id="${a}" data-priority="${r}">
47
47
  ${c}
48
48
  <script type="application/json" data-island-props="${a}">
49
49
  ${l?`{${l}}`:"{}"}
50
50
  </script>
51
- </div>`}};function Y(e={}){let t=[];if(e.streaming?.enabled)t.push(N);if(e.hydration?.enabled)t.push(L);return t}async function Z(e,t,i,n={}){return e}function P(e,t={}){let i=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(i.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function ee(e={mode:"full"}){let{mode:t,components:i={},dynamicImports:n=!0}=e,s=Object.entries(i).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
51
+ </div>`}};function Z(e={}){let t=[];if(e.streaming?.enabled)t.push(L);if(e.hydration?.enabled)t.push(j);return t}async function P(e,t,i,n={}){return e}function ee(e,t={}){let i=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(r,a){a.enqueue(i.encode(r))}})),s=new Headers(t.headers);if(!s.has("Content-Type"))s.set("Content-Type","text/html; charset=utf-8");if(!s.has("Transfer-Encoding"))s.set("Transfer-Encoding","chunked");if(!s.has("X-Content-Type-Options"))s.set("X-Content-Type-Options","nosniff");if(!s.has("X-Accel-Buffering"))s.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:s})}function te(e={mode:"full"}){let{mode:t,components:i={},dynamicImports:n=!0}=e,s=Object.entries(i).map(([r,a])=>`'${r}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
52
52
  `);if(t==="loader")return`
53
53
  (function() {
54
54
  window.__stx = window.__stx || {};
@@ -191,4 +191,4 @@ else {
191
191
  stx.hydrate();
192
192
  }
193
193
  })();`}
194
- export{V as Kf,q as Lf,H as Mf,W as Nf,G as Of,J as Pf,K as Qf,Q as Rf,N as Sf,L as Tf,Y as Uf,Z as Vf,P as Wf,ee as Xf};
194
+ export{W as Kf,M as Lf,A as Mf,G as Nf,J as Of,K as Pf,Q as Qf,Y as Rf,L as Sf,j as Tf,Z as Uf,P as Vf,ee as Wf,te as Xf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Fj as S}from"./chunk-tpfgntwj.js";import{mn as x,on as w}from"./chunk-0t5vz87j.js";function $(t,o){let r=1,n=o,e="<template",l="</template";while(n<t.length&&r>0){let s=t.indexOf("<",n);if(s===-1)break;if(n=s,t.startsWith(e,n)&&(n+e.length>=t.length||/[\s>\/]/.test(t[n+e.length]))){r++,n+=e.length;continue}if(t.startsWith(l,n)){let i=t.indexOf(">",n+l.length);if(i!==-1){if(r--,r===0)return i+1;n=i+1;continue}}n++}return r===0?n:-1}var E=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function y(t,o){let r=null;for(let n=o;n<t.length;n++){let e=t[n];if(r){if(e==="\\"){n++;continue}if(e===r)r=null;continue}if(e==='"'||e==="'"){r=e;continue}if(e===">")return n+1}return-1}function N(t){let o=[],r=[],n=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let l=t.indexOf("<",e);if(l===-1)break;if(t.startsWith("<!--",l)){let u=t.indexOf("-->",l+4);e=u===-1?t.length:u+3;continue}let s=y(t,l+1);if(s===-1)break;let i=t.slice(l,s),a=i.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!a){e=s;continue}let c=a[1]==="/",f=a[2].toLowerCase();if(c){let u=r.lastIndexOf(f);if(u!==-1)r.splice(u);e=s;continue}if(f==="template"&&r.length===0){let u=i.match(n);if(u){let m=$(t,s);if(m!==-1){let p=u[1]||u[2]||u[3];o.push({start:l,end:m,slotName:p,content:t.slice(s,m-11).trim(),propsBinding:u[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(i)&&!E.has(f)){if(r.push(f),f==="script"||f==="style"){let u=t.toLowerCase().indexOf(`</${f}>`,s);if(u!==-1){e=u;continue}}}e=s}return o}function z(t){let o={default:"",named:new Map},r=t,n=N(t);for(let a of n)o.named.set(a.slotName,{name:a.slotName,content:a.content,propsBinding:a.propsBinding});n.sort((a,c)=>c.start-a.start);for(let a of n)r=r.slice(0,a.start)+r.slice(a.end);let e=[],l=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,s;while((s=l.exec(r))!==null){let[a,c,f,u,m,p]=s,d=f.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),h=m.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),g=(d+h).trim(),A=`<${c}${g?" "+g:""}>${p}</${c}>`;e.push({start:s.index,end:s.index+a.length,slotName:u,element:A})}let i=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((s=i.exec(r))!==null){let[a,c,f,u,m]=s,p=f.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),d=m.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),h=(p+d).trim(),g=`<${c}${h?" "+h:""} />`;e.push({start:s.index,end:s.index+a.length,slotName:u,element:g})}e.sort((a,c)=>c.start-a.start);for(let a of e){let c=o.named.get(a.slotName);if(c)c.content+=a.element;else o.named.set(a.slotName,{name:a.slotName,content:a.element});r=r.slice(0,a.start)+r.slice(a.end)}return o.default=r.trim(),o}function C(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),r=o?o[1]:"",n={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,l;while((l=e.exec(t))!==null)n[l[1]]=l[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),i=s?s[1].trim():"";return{name:r,props:n,defaultContent:i}}async function M(t,o,r,n){if(!t)return r;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let l=t.propsBinding.trim(),s={...n};if(l.startsWith("{")&&l.endsWith("}")){let i=l.slice(1,-1).split(",").map((a)=>a.trim()).filter(Boolean);for(let a of i){let[c,f]=a.split(":").map((m)=>m.trim()),u=f||c;if(o[c]!==void 0)s[u]=o[c]}}else s[l]=o;e=Z(e,s)}return e}function Z(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(r,n)=>{try{let e=n.trim(),l=b(e,o);return S(String(l??""))}catch{return`{{ ${n} }}`}})}function b(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let n=t.split("."),e=o;for(let l of n)if(e&&typeof e==="object"&&l in e)e=e[l];else return;return e}let r=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(r){let[,n,e,l]=r,s=o[n],i=parseInt(l,10);if(typeof s==="number")switch(e){case"+":return s+i;case"-":return s-i;case"*":return s*i;case"/":return s/i}}try{if(!x(t))return;return w(t,Object.keys(o))(...Object.values(o))}catch{return}}async function k(t,o,r){let n=t;n=await O(n,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(l,s,i,a)=>{let c=o.named.get(s),f=a?.trim()||"",u=i||"",m={},p=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,d;while((d=p.exec(u))!==null){let h=d[1],g=d[2];m[h]=b(g,r)}return await M(c,m,f,r)});let e=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return n=n.replace(e,(l,s)=>{if(l.includes("name="))return l;let i=s?.trim()||"";return o.default||i}),n}async function O(t,o,r){let n=[],e=[];t.replace(o,(i,...a)=>{let c=a[a.length-2];return e.push({match:i,index:c}),n.push(r(i,...a.slice(0,-2))),i});let l=await Promise.all(n),s=t;for(let i=e.length-1;i>=0;i--){let{match:a,index:c}=e[i];s=s.slice(0,c)+l[i]+s.slice(c+a.length)}return s}function R(t){let o=z(t);return{defaultSlot:o.default,namedSlots:o.named}}async function _(t,o,r,n){return await k(t,{default:o,named:r},n)}
3
- export{z as o,C as p,M as q,k as r,R as s,_ as t};
2
+ import{Fj as S}from"./chunk-ryvmyskt.js";import{mn as x,on as w}from"./chunk-wm805tte.js";function E(t,o){let r=1,n=o,e="<template",l="</template";while(n<t.length&&r>0){let s=t.indexOf("<",n);if(s===-1)break;if(n=s,t.startsWith(e,n)&&(n+e.length>=t.length||/[\s>\/]/.test(t[n+e.length]))){r++,n+=e.length;continue}if(t.startsWith(l,n)){let i=t.indexOf(">",n+l.length);if(i!==-1){if(r--,r===0)return i+1;n=i+1;continue}}n++}return r===0?n:-1}var y=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function N(t,o){let r=null;for(let n=o;n<t.length;n++){let e=t[n];if(r){if(e==="\\"){n++;continue}if(e===r)r=null;continue}if(e==='"'||e==="'"){r=e;continue}if(e===">")return n+1}return-1}function z(t){let o=[],r=[],n=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let l=t.indexOf("<",e);if(l===-1)break;if(t.startsWith("<!--",l)){let u=t.indexOf("-->",l+4);e=u===-1?t.length:u+3;continue}let s=N(t,l+1);if(s===-1)break;let i=t.slice(l,s),a=i.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!a){e=s;continue}let c=a[1]==="/",f=a[2].toLowerCase();if(c){let u=r.lastIndexOf(f);if(u!==-1)r.splice(u);e=s;continue}if(f==="template"&&r.length===0){let u=i.match(n);if(u){let m=E(t,s);if(m!==-1){let p=u[1]||u[2]||u[3];o.push({start:l,end:m,slotName:p,content:t.slice(s,m-11).trim(),propsBinding:u[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(i)&&!y.has(f)){if(r.push(f),f==="script"||f==="style"){let u=t.toLowerCase().indexOf(`</${f}>`,s);if(u!==-1){e=u;continue}}}e=s}return o}function M(t){let o={default:"",named:new Map},r=t,n=z(t);for(let a of n)o.named.set(a.slotName,{name:a.slotName,content:a.content,propsBinding:a.propsBinding});n.sort((a,c)=>c.start-a.start);for(let a of n)r=r.slice(0,a.start)+r.slice(a.end);let e=[],l=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,s;while((s=l.exec(r))!==null){let[a,c,f,u,m,p]=s,d=f.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),h=m.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),g=(d+h).trim(),A=`<${c}${g?" "+g:""}>${p}</${c}>`;e.push({start:s.index,end:s.index+a.length,slotName:u,element:A})}let i=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((s=i.exec(r))!==null){let[a,c,f,u,m]=s,p=f.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),d=m.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),h=(p+d).trim(),g=`<${c}${h?" "+h:""} />`;e.push({start:s.index,end:s.index+a.length,slotName:u,element:g})}e.sort((a,c)=>c.start-a.start);for(let a of e){let c=o.named.get(a.slotName);if(c)c.content+=a.element;else o.named.set(a.slotName,{name:a.slotName,content:a.element});r=r.slice(0,a.start)+r.slice(a.end)}return o.default=r.trim(),o}function R(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),r=o?o[1]:"",n={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,l;while((l=e.exec(t))!==null)n[l[1]]=l[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),i=s?s[1].trim():"";return{name:r,props:n,defaultContent:i}}async function Z(t,o,r,n){if(!t)return r;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let l=t.propsBinding.trim(),s={...n};if(l.startsWith("{")&&l.endsWith("}")){let i=l.slice(1,-1).split(",").map((a)=>a.trim()).filter(Boolean);for(let a of i){let[c,f]=a.split(":").map((m)=>m.trim()),u=f||c;if(o[c]!==void 0)s[u]=o[c]}}else s[l]=o;e=k(e,s)}return e}function k(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(r,n)=>{try{let e=n.trim(),l=b(e,o);return S(String(l??""))}catch{return`{{ ${n} }}`}})}function b(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let n=t.split("."),e=o;for(let l of n)if(e&&typeof e==="object"&&l in e)e=e[l];else return;return e}let r=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(r){let[,n,e,l]=r,s=o[n],i=parseInt(l,10);if(typeof s==="number")switch(e){case"+":return s+i;case"-":return s-i;case"*":return s*i;case"/":return s/i}}try{if(!x(t))return;return w(t,Object.keys(o))(...Object.values(o))}catch{return}}async function O(t,o,r){let n=t;n=await v(n,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(l,s,i,a)=>{let c=o.named.get(s),f=a?.trim()||"",u=i||"",m={},p=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,d;while((d=p.exec(u))!==null){let h=d[1],g=d[2];m[h]=b(g,r)}return await Z(c,m,f,r)});let e=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return n=n.replace(e,(l,s)=>{if(l.includes("name="))return l;let i=s?.trim()||"";return o.default||i}),n}async function v(t,o,r){let n=[],e=[];t.replace(o,(i,...a)=>{let c=a[a.length-2];return e.push({match:i,index:c}),n.push(r(i,...a.slice(0,-2))),i});let l=await Promise.all(n),s=t;for(let i=e.length-1;i>=0;i--){let{match:a,index:c}=e[i];s=s.slice(0,c)+l[i]+s.slice(c+a.length)}return s}function _(t){let o=M(t);return{defaultSlot:o.default,namedSlots:o.named}}async function T(t,o,r,n){return await O(t,{default:o,named:r},n)}
3
+ export{M as o,R as p,Z as q,O as r,_ as s,T as t};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{V as a}from"./chunk-bswe62q4.js";import"./chunk-rft8gw92.js";import"./chunk-p0w1x8y2.js";import"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{a as buildForProduction};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ve as a}from"./chunk-6e91956t.js";import"./chunk-nf3kv7kv.js";export{a as rewriteImagesWithSiblings};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{lu as a,mu as b,nu as c,ou as d,pu as e,qu as f,ru as g,su as h,tu as i}from"./chunk-126c9qm3.js";import"./chunk-6x1feysm.js";import"./chunk-nf3kv7kv.js";export{a as ImageProcessorCache,g as applyTransformations,d as clearImageCache,h as generateResponsiveVariants,i as generateSrcset,b as getCachedImageResult,f as optimizeImage,e as processImage,c as setCachedImageResult};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$s as H,$t as Ia,As as g,At as ha,Bs as h,Bt as ia,Cs as i,Ct as ja,Ds as j,Dt as ka,Es as k,Et as la,Fs as l,Ft as ma,Gs as m,Gt as na,Hs as n,Ht as oa,Is as o,It as pa,Js as p,Jt as qa,Ks as q,Kt as ra,Ls as r,Lt as sa,Ms as s,Mt as ta,Ns as t,Nt as ua,Os as u,Ot as va,Ps as v,Pt as wa,Qs as w,Qt as xa,Rs as x,Rt as ya,Ss as y,St as za,Ts as z,Tt as Aa,Us as A,Ut as Ba,Vs as B,Vt as Ca,Ws as C,Wt as Da,Xs as D,Xt as Ea,Ys as E,Yt as Fa,Zs as F,Zt as Ga,_s as G,_t as Ha,at as I,au as Ja,bt as J,bu as Ka,ct as K,cu as La,dt as L,du as Ma,et as M,eu as Na,ft as N,fu as Oa,gt as O,gu as Pa,ht as P,hu as Qa,it as Q,iu as Ra,jt as R,ju as Sa,kt as S,ku as Ta,lt as T,mt as U,nt as V,ot as W,pt as X,qt as Y,rt as Z,st as _,tt as aa,us as a,ut as ba,vs as b,vt as ca,ws as c,wt as da,xs as d,xt as ea,ys as e,yt as fa,zs as f,zt as ga}from"./chunk-fna5n0ey.js";import"./chunk-nf3kv7kv.js";export{aa as KERNELS,Ma as SPLATHASH_TARGET_SIZE,Ia as _internals,w as analyzeImage,s as applyExifOrientation,P as applyWatermark,N as batchProcessImages,U as blur,V as boxBlur,b as cloneImageData,qa as composite,ra as compositeMultiple,y as config,ga as contrast,M as convertImageFormat,Y as convolve,a as createImageData,ta as createLinearGradient,sa as createSolidColor,n as crop,D as debugLog,t as decode,_ as emboss,u as encode,p as extend,o as extract,C as filterPaths,l as flip,m as flop,F as formatBytes,f as fromCodecData,ha as gamma,Fa as generateAppIcons,Ha as generateFavicons,Ea as generateIOSAppIcons,La as generateImageSet,Da as generateMacOSAppIcons,Ta as generatePictureSet,L as generatePlaceholder,x as generateReport,Ka as generateResponsiveImages,Ja as generateSocialImages,Ga as generateSprite,Ca as generateThumbHash,ka as getDominantColor,z as getFiles,v as getMetadata,c as getPixel,e as getPixelBilinear,ba as grayscale,ma as hslToRgb,Oa as imageToSplatHash,K as imageToSvg,ea as invert,B as isPathMatching,r as jpegExifOrientation,oa as linearToSrgb,da as modulate,ia as normalize,O as optimizeImage,J as optimizeSvg,E as parseFileSize,G as printSummary,ua as process,H as processImage,va as processMultiple,I as processSvg,T as resize,Q as resizeBicubic,R as resizeBilinear,S as resizeLanczos,la as rgbToHsl,Aa as rgbaToDataURL,Na as rgbaToSplatHash,wa as rgbaToThumbHash,h as rotate,j as rotate180,k as rotate270,i as rotate90,fa as sepia,d as setPixel,W as sharpen,X as sharpenConvolution,Z as sobelEdgeDetection,Ra as splatHashFromBase64,Qa as splatHashToBase64,Sa as splatHashToDataURL,Pa as splatHashToRgba,na as srgbToLinear,ca as threshold,za as thumbHashToApproximateAspectRatio,ya as thumbHashToAverageRGBA,Ba as thumbHashToDataURL,xa as thumbHashToRGBA,ja as tint,g as toCodecData,pa as toColorSpace,q as trim,A as watchFiles};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{We as o,Xe as p,Ye as q}from"./chunk-rft8gw92.js";import{cf as a,df as b,ef as c,ff as d,gf as e,hf as f,if as g,jf as h,kf as i,lf as j,mf as k,nf as l,of as m,pf as n}from"./chunk-p0w1x8y2.js";import"./chunk-brpgjyqg.js";import"./chunk-nf3kv7kv.js";export{d as batch,q as default,b as derived,c as effect,o as generateSignalsRuntime,p as generateSignalsRuntimeDev,k as isDerived,j as isSignal,f as onDestroy,e as onMount,m as peek,i as pendingLifecycleCounts,h as runDestroyCallbacks,g as runMountCallbacks,a as state,l as untrack,n as useOptimistic};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{dj as a,ej as b,fj as c,gj as d,hj as e,ij as f}from"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{d as config,a as defaultConfig,e as defineStxConfig,c as loadStxConfig,b as resolveStxDirectories,f as validateConfig};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{jj as c,kj as d,lj as e,mj as f,nj as g,oj as h,pj as i,qg as a,qj as j,rg as b,rj as k}from"./chunk-ryvmyskt.js";import"./chunk-2g8m379z.js";import"./chunk-ezqwq17j.js";import"./chunk-wm805tte.js";import"./chunk-58tfvayh.js";import"./chunk-brpgjyqg.js";import"./chunk-2rr178et.js";import"./chunk-5be9x5cq.js";import"./chunk-5zrnk2kq.js";import"./chunk-p0qhpnqh.js";import"./chunk-nf3kv7kv.js";export{e as STX_AUTO_IMPORTS,c as extractAndStripCssImports,i as extractBridgeData,a as findInterpolationEnd,g as generateAutoImportDestructuring,h as generateBrowserAutoImportDestructuring,j as generateServerDataBridge,f as injectBrowserCoreAutoImports,k as processClientScript,d as renderVendorStyleTags,b as stripCommentsAndLiterals};
@@ -0,0 +1,48 @@
1
+ // @bun
2
+ import{We as J,Xe as Q}from"./chunk-rft8gw92.js";import{Ll as Ct,Zl as Dt,bm as st,dj as bt,em as Pt,fj as I,fm as Mt,rg as j,sj as yt,uj as $t,xm as _t,yj as it,zj as rt}from"./chunk-ryvmyskt.js";import{in as Rt}from"./chunk-2g8m379z.js";import{Un as V}from"./chunk-brpgjyqg.js";import{Lo as q}from"./chunk-2rr178et.js";import{Zu as kt}from"./chunk-nf3kv7kv.js";import v from"fs";import g from"path";import Z from"fs";import Ot from"path";var k="resources/assets",K="assets";function z(t=process.cwd()){let n=Ot.resolve(t,k);return Z.existsSync(n)&&Z.statSync(n).isDirectory()?n:null}import{createHash as jt}from"crypto";function tt(t){return jt("sha256").update(t).digest("hex").slice(0,8)}function et(t=!1){let n=t?Q():J(),i=tt(n);return{content:n,filename:`runtime.${i}.js`,hash:i}}function nt(){let t=q(),n=tt(t);return{content:t,filename:`router.${n}.js`,hash:n}}function ge(t){return{runtimeTag:t.runtime?`<script src="/__stx/${t.runtime.filename}"></script>`:"",routerTag:t.router?`<script src="/__stx/${t.router.filename}"></script>`:"",cssTag:t.css?`<link rel="stylesheet" href="/__stx/${t.css.filename}">`:""}}import St from"path";import B from"path";var It=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function Lt(t,n,i){let e={fullTag:i,content:n,attrs:t};if(/\bserver\b/.test(t))return{...e,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...e,type:"client"};if(It.test(n))return{...e,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...e,type:"client"};return{...e,type:"server"}}var Nt=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function ot(t){let n=[],i=[],e=[],r=0;while(r<t.length){let a=t.indexOf("<",r);if(a===-1)break;let c=rt(t,a);if(c>a){r=c;continue}let s=it(t,a);if(s>a){let o=t.slice(a,s),p=Nt.exec(o);if(p){let l=Lt(p[1],p[2],o);switch(l.type){case"signals":n.push(l);break;case"client":i.push(l);break;case"server":e.push(l);break}}r=s;continue}r=a+(t.startsWith("<!--",a)?4:1)}return{signals:n,client:i,server:e}}var{require:Bt}=import.meta,Ft="stx-page-head:",Ht=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,D=null;function Vt(){if(D!==null)return D;try{let{getRouterScript:t}=Bt("stx-router");D=`<script>${t()}</script>`}catch{D=""}return D}async function ve(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let e=B.resolve(t,n);if(await Bun.file(e).exists())return e;return null}let i=B.join(t,"app.stx");if(await Bun.file(i).exists())return i;return null}async function Ee(t,n){try{let i=await Bun.file(t).text(),e=i,r=i.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(r)e=r[1].trim();let a=ot(i),c=[...a.client.map((d)=>d.fullTag),...a.signals.map((d)=>d.fullTag)],s=[],o=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,p;while((p=o.exec(i))!==null)s.push(p[0]);let l=e;for(let d of a.server)l=l.replace(d.fullTag,"");for(let d of a.client)l=l.replace(d.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:m,extractVariables:b,defaultConfig:E,loadStxConfig:T}=await import("./chunk-n2j24b0h.js"),y=await T(),x={__filename:t,__dirname:B.dirname(t)};for(let d of c){let w=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(w&&!d.includes("client")&&!d.includes('type="module"'))await b(w[1],x,t)}let _=await m(l,x,t,{...E,...y,...n},new Set),S=_.indexOf(f);if(S===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:_.substring(0,S),afterSlot:_.substring(S+f.length),filePath:t,shellScripts:c,shellStyles:s}}catch(i){return console.error(`[stx] Error processing shell ${t}:`,i),null}}function Ae(t,n,i){let e,r="",a=n.match(Ht);if(a){n=n.replace(a[0],"");try{let p=Buffer.from(a[1],"base64").toString("utf8"),l=p.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(l)e=l[1].trim();r=p.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let c=i||e||"stx App",s=Vt(),o="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>${c}</title>
8
+ ${r?` ${r}
9
+ `:""} ${t.shellStyles.join(`
10
+ `)}
11
+ </head>
12
+ <body>
13
+ ${t.beforeSlot}
14
+ <div data-stx-content>${n}</div>
15
+ ${t.afterSlot}
16
+ ${t.shellScripts.filter((p)=>!p.includes("server")).join(`
17
+ `)}
18
+ ${o}
19
+ ${s}
20
+ </body>
21
+ </html>`}function P(t,n={}){let i=t.trim();if(!st(i))return t;let e=[],r=i.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(r){let o=r[1],p=/<style\b[^>]*>[\s\S]*?<\/style>/gi,l;while((l=p.exec(o))!==null)e.push(l[0])}if(n.preserveHead&&r){let o=[],p=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,l;while((l=p.exec(r[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(l[0]))continue;o.push(l[0])}if(o.length>0)e.unshift(`<!--${Ft}${Buffer.from(o.join(`
22
+ `),"utf8").toString("base64")}-->`)}let a=i.match(/<body\b[^>]*>/i),c=i.lastIndexOf("</body>");if(a&&c!==-1){let o=a.index+a[0].length,p=i.slice(o,c).trim();if(e.length>0)return e.join(`
23
+ `)+`
24
+ `+p;return p}let s=i;if(s=s.replace(/<!DOCTYPE\b[^>]*>/i,""),s=s.replace(/<html\b[^>]*>/i,""),s=s.replace(/<\/html\s*>/i,""),r)s=s.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,e.join(`
25
+ `));return s=s.replace(/<body\b[^>]*>/i,""),s=s.replace(/<\/body\s*>/i,""),s.trim()}function Re(t){return t.headers.get("X-STX-Router")==="true"}function lt(t,n="main"){let i=t.trim(),e=[],r=[],a=i.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(a){let S=a[1],d=/<style\b[^>]*>[\s\S]*?<\/style>/gi,w;while((w=d.exec(S))!==null)e.push(w[0]);let A=/<script\b[^>]*data-stx-route-params[^>]*>[\s\S]*?<\/script>/gi;while((w=A.exec(S))!==null)r.push(w[0])}let c=n.replace(/^[.#]/,"").toLowerCase(),s=new RegExp(`<${c}\\b[^>]*>`,"i"),o=i.match(s);if(!o||o.index===void 0)return P(t);let p=o.index+o[0].length,l=new RegExp(`<${c}\\b[^>]*>`,"gi"),f=new RegExp(`</${c}\\s*>`,"gi");l.lastIndex=p,f.lastIndex=p;let m=1,b=-1;while(m>0){let S=l.exec(i),d=f.exec(i);if(!d)break;if(S&&S.index<d.index)m++,f.lastIndex=S.index+S[0].length;else if(m--,b=d.index,m>0)l.lastIndex=d.index+d[0].length}if(b===-1)return P(t);let E=i.slice(p,b).trim(),T=[],y=i.match(/<body\b[^>]*>/i),x=i.lastIndexOf("</body>");if(y&&y.index!==void 0&&x!==-1){let S=[[y.index+y[0].length,o.index],[b+`</${c}>`.length,x]],d=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[w,A]of S){if(w>=A)continue;let L=i.slice(w,A),C;d.lastIndex=0;while((C=d.exec(L))!==null)T.push(C[0])}}let _=[];if(e.length>0)_.push(e.join(`
26
+ `));if(r.length>0)_.push(r.join(`
27
+ `));if(T.length>0)_.push(T.join(`
28
+ `));return _.push(E),_.join(`
29
+ `)}import{createHash as ce}from"crypto";var ct=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Gt(t){let n=(i)=>i.replace(/[^\n]/g," ");return t.replace(/<!--[\s\S]*?-->/g,n).replace(/\{\{--[\s\S]*?--\}\}/g,n)}function Xt(t){let n=[],i=Gt(t);ct.lastIndex=0;let e;while((e=ct.exec(i))!==null){let r=(e[1]||"").trim(),a=(e[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,c=(e[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,s=e.index+a,o=e.index+e[0].length-c,p=t.slice(s,o);if(/\bsrc\s*=/.test(r))continue;let l=r.match(/\btype\s*=\s*["']([^"']+)["']/i);if(l&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(l[1]))continue;let f=/\bserver\b/.test(r)?"server":/\bclient\b/.test(r)?"client":"plain",m=M(t,s);n.push({kind:f,code:p,startLine:m,attrs:r})}return n}function M(t,n){let i=1;for(let e=0;e<n&&e<t.length;e++)if(t.charCodeAt(e)===10)i++;return i}function F(t,n){let i=t.lastIndexOf(`
30
+ `,n-1)+1;return n-i+1}function mt(t){let n=t.split(""),i=(r,a)=>{for(let c=r;c<a&&c<n.length;c++)if(n[c]!==`
31
+ `)n[c]=" "},e=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let r of e){r.lastIndex=0;let a;while((a=r.exec(t))!==null)i(a.index,a.index+a[0].length)}return n.join("")}function Wt(t){let n=0,i="";for(let e=0;e<t.length;e++){let r=t[e];if(i){if(r==="\\"){e++;continue}if(r===i)i="";continue}if(r==='"'||r==="'"||r==="`"){i=r;continue}if(r==="("||r==="["||r==="{"){n++;continue}if(r===")"||r==="]"||r==="}"){n--;continue}if(r==="|"&&n===0){if(t[e+1]==="|"){e++;continue}if(t[e-1]==="|")continue;return t.slice(0,e)}}return t}var ht=new Set([":for","x-for","v-for"]),O=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,H="__stx_interpolated",at="__StxElement",xt="__StxTemplateValue",Ut=`type ${xt}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function pt(t){return t.replace(/\{\{[\s\S]*?\}\}/g,H).replace(/\{!![\s\S]*?!!\}/g,H)}function Oe(t){return t.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(n)=>{let i=n.split(`
32
+ `).length-1,e=n.length-i;return`0${" ".repeat(Math.max(0,e-1))}${`
33
+ `.repeat(i)}`})}var Yt=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Zt=new RegExp(String.raw`^[ \t]*@(?:${Yt.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function je(t){return t.replace(Zt,(n)=>n.replace(/[^\n]/g," "))}var ut=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Kt(t){let n=mt(t),i=[],e=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,r;while((r=e.exec(n))!==null){if(r[1]||r[3])continue;let a=r[2]??r[4]??"",c=r[2]!==void 0?2:3,s=Wt(a);if(!s.trim())continue;let o=r.index+c+(s.length-s.trimStart().length);i.push({code:s.trim(),line:M(n,o),column:F(n,o),kind:"interpolation"})}O.lastIndex=0;while((r=O.exec(n))!==null){let a=r[1],c=r[3]??"",s=a.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(ut.has(s)||ut.has(a))continue;if(!c.trim())continue;let o=r.index+r[0].indexOf(r[2],r[0].indexOf(a)+a.length)+1;if(ht.has(s)){let l=c.match(/\s+(?:in|of)\s+/);if(!l||l.index===void 0)continue;let f=c.slice(l.index+l[0].length),m=l.index+l[0].length+(f.length-f.trimStart().length);i.push({code:pt(f.trim()),line:M(n,o+m),column:F(n,o+m),kind:"directive",attribute:s});continue}let p=c.length-c.trimStart().length;i.push({code:pt(c.trim()),line:M(n,o+p),column:F(n,o+p),kind:"directive",attribute:s})}return i.sort((a,c)=>a.line-c.line||a.column-c.column),i}function zt(t){let n=new Map,i=(s,o)=>{let p=s.split(/[,[\]{}()\s]+/).filter(Boolean);for(let l of p){let f=l.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(f))continue;let m=p.length===1?o:void 0,b=n.get(f);if(!b)n.set(f,{name:f,iterable:m});else if(b.iterable!==m)b.iterable=void 0}},e=/^\$?[A-Z_$][\w$]*$/i,r=(s)=>{let o=s.trim();return e.test(o)?o:void 0};for(let s of t.matchAll(/@for(?:each|else)\s*\(([\s\S]*?)\)/g)){let o=s[1].match(/^([\s\S]*?)\bas\b([\s\S]*)$/);if(!o)continue;i(o[2].replace(/=>/g," "),r(o[1]))}for(let s of t.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)/g))i(s[1]);let a=mt(t);O.lastIndex=0;let c;while((c=O.exec(a))!==null){let s=c[1].replace(/\..*$/,"");if(!ht.has(s))continue;let o=c[3].match(/\s+(?:in|of)\s+/);if(!o||o.index===void 0)continue;i(c[3].slice(0,o.index),r(c[3].slice(o.index+o[0].length)))}for(let s of t.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let o of s[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(o[1]);return[...n.values()].sort((s,o)=>s.name.localeCompare(o.name))}function R(t){let n=new Set;for(let i of t.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))n.add(i[1]);for(let i of t.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))n.add(i[1]);for(let i of t.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))n.add(i[1]);for(let i of t.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let e of i[1].split(",")){let r=e.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(r))n.add(r)}return[...n].sort()}function qt(){return["declare var window: any",...V.map((t)=>`declare var ${t}: any`)].join(`
34
+ `)}var Jt=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore"];function Qt(){return Jt.map((t)=>`declare var ${t}: any`).join(`
35
+ `)}function gt(t){let n=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,e=!1,r=new Set,a=j(t);while((i=n.exec(a))!==null){e=!0;for(let c of te(i[1])){let s=c.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(s))r.add(s)}}return e?[...r]:null}function te(t){let n=[],i=0,e="";for(let r of t){if(r===","&&i===0){n.push(e),e="";continue}if(r==="("||r==="["||r==="{")i++;else if(r===")"||r==="]"||r==="}")i--;e+=r}return n.push(e),n.filter((r)=>r.trim().length>0)}function ee(t){let n=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],e=t.replace(n,(r)=>(i.push(r.trim()),r.split(`
36
+ `).map(()=>"").join(`
37
+ `)));return{imports:i.join(`
38
+ `),body:e}}function Ie(t){let n=gt(t);if(!n){let c=R(t);if(c.length===0)return"";return["",`// ${re}`,...c.map((s)=>`declare var ${s}: any`)].join(`
39
+ `)}if(n.length===0)return"";let{imports:i,body:e}=ee(t),r=e.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),a=["",`// ${ie}`];if(i)a.push(i);return a.push(`async function ${ft}() {`,r,` return { ${n.join(", ")} }`,"}",`type ${dt} = Awaited<ReturnType<typeof ${ft}>>`,...n.map((c)=>`declare var ${c}: ${dt}[${JSON.stringify(c)}]`)),a.join(`
40
+ `)}function ne(t){let n=j(t).split(""),i=0;for(let e=0;e<n.length;e++){let r=n[e];if(r==="{"||r==="("||r==="["){i++;continue}if(r==="}"||r===")"||r==="]"){i=Math.max(0,i-1);continue}if(i>0&&r!==`
41
+ `)n[e]=" "}return R(n.join(""))}function Le(t,n){if(gt(t)!==null)return[];let i=j(n),e=new Set(V);return ne(t).filter((r)=>{if(e.has(r))return!1;if(R(n).includes(r))return!1;return new RegExp(`(?<![.#\\w$])${r}(?![\\w$])`).test(i)})}var ie="stx: types for the declared client payload (#1868)",re="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",ft="__stxServerScope",dt="__StxClientPayload";var oe=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","$errors","$csrf","props","slot"];var se=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function le(t){let n=t.code.trim();if(!n)return null;if(t.attribute?.startsWith("@")){if(se.test(n))return null;let e=";(($event: any): void => { ";return{text:`${e}${n} });`,prefixLength:e.length}}let i=";void ((";return{text:`${i}${n}));`,prefixLength:i.length}}function Ne(t,n={}){let i=Xt(t),e=t.split(`
42
+ `),r=Array.from({length:e.length},()=>""),a=new Map;for(let s of i)s.code.split(`
43
+ `).forEach((o,p)=>{let l=s.startLine-1+p;if(l<r.length)r[l]=o});let c=(s,o)=>{if(r.push(s),o)a.set(r.length,o)};if(n.globals!==!1){if(c(""),n.runtimeGlobals!==!1)for(let o of qt().split(`
44
+ `))c(o);for(let o of Qt().split(`
45
+ `))c(o);for(let o of oe)c(`declare var ${o}: any`);c(`declare var ${H}: any`);let s=new Set(i.flatMap((o)=>R(o.code)));c(`type ${at}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let o of zt(t)){if(s.has(o.name))continue;let p=o.iterable&&s.has(o.iterable)?`${at}<typeof ${o.iterable}>`:"any";c(`declare var ${o.name}: ${p}`)}}if(n.templateExpressions!==!1){let s=Kt(t).map((o)=>({expression:o,statement:le(o)})).filter((o)=>o.statement!==null);if(s.length>0){let o=[...new Set(i.flatMap((l)=>R(l.code)))].filter((l)=>/^[A-Z_$][\w$]*$/i.test(l)),p=0;if(o.length>0){c(Ut);for(let l of o)c(`type __StxT_${l} = ${xt}<typeof ${l}>`);c(`;((${o.map((l)=>`${l}: __StxT_${l}`).join(", ")}) => {`),p=1}for(let{expression:l,statement:f}of s){let m=" ".repeat(p);c(m+f.text,{line:l.line,column:l.column,expression:l,prefixLength:f.prefixLength+m.length})}if(p>0)c("});")}}return c("export {}"),{text:r.join(`
46
+ `),lineMap:a,sourceLineCount:e.length}}function ke(t,n,i){let e=t.lineMap.get(n);if(!e)return n<=t.sourceLineCount?{line:n,column:i}:null;let r=Math.max(0,i-1-(e.prefixLength??0));return{line:e.line,column:e.column+r,expression:e.expression}}function ae(t={}){let n=new Set;return{context:new Proxy(t,{get(i,e){if(e in i)return i[e];if(typeof e==="string"&&!e.startsWith("__"))n.add(e);return},has(i,e){if(e in i)return!0;if(typeof e==="string"&&!e.startsWith("__"))n.add(e);return!1}}),accessedKeys:n}}async function wt(t,n,i={}){let e=St.resolve(t),r=await Bun.file(e).text(),a=ce("sha256").update(r).digest("hex").slice(0,16);yt();let c={};try{c=await I()}catch{}let s=[],o=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,p;while((p=o.exec(r))!==null){let x=p[1];if(/\bserver\b/.test(x))s.push(p[2])}let l=new Set(s.flatMap((x)=>R(x))),{context:f}=ae({__filename:e,__dirname:St.dirname(e),__stx_serverDeclared:l}),m=new Set,b={...bt,...c,...i,buildMode:"compile",strict:!1},E=await _t(r,f,e,b,m),T=P(E),y=$t();return{route:n,sourceFile:t,html:E,fragment:T,placeholders:y,hasServerScripts:s.length>0,serverScriptContent:s,dependencies:Array.from(m),contentHash:a,streamTemplates:f.__streamTemplates}}import G from"fs";import Tt from"path";function vt(t,n,i){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:i}}function Et(t,n){let i=Tt.join(n,"manifest.json");G.writeFileSync(i,JSON.stringify(t,null,2))}function Qe(t){let n=Tt.join(t,"manifest.json");if(!G.existsSync(n))return null;try{let i=G.readFileSync(n,"utf-8"),e=JSON.parse(i);if(e.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${e.version}`),null;return e}catch(i){return console.warn("[stx] Failed to load manifest:",i),null}}var pe=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function At(t,n){let i=0,e=0;if(!v.existsSync(t))return{copied:i,bytes:e};v.mkdirSync(n,{recursive:!0});function r(a,c){let s=v.readdirSync(a,{withFileTypes:!0});for(let o of s){if(pe.has(o.name))continue;let p=g.join(a,o.name),l=g.join(c,o.name);if(o.isDirectory())v.mkdirSync(l,{recursive:!0}),r(p,l);else if(o.isFile()){if(v.existsSync(l))continue;v.copyFileSync(p,l),i++,e+=v.statSync(l).size}}}return r(t,n),{copied:i,bytes:e}}async function mn(t={}){let n=Date.now(),i=g.resolve(t.root||process.cwd()),e=g.resolve(i,t.outputDir||".output");console.log("[stx build] Starting production build...");let r={};try{r=await I()}catch{}let a=t.componentsDir??r.componentsDir??"components",c=t.partialsDir??r.partialsDir??"partials",s=t.layoutsDir??r.layoutsDir??"layouts",o=t.publicDir??r.publicDir??"public",p=r.app?.head||{},l=r.app?.colorMode,f=r.router?.container||"main";if(v.existsSync(e))v.rmSync(e,{recursive:!0});let m=[g.join(e,"public","__stx"),g.join(e,"public","assets"),g.join(e,"server","pages"),g.join(e,"server","fragments")];for(let h of m)v.mkdirSync(h,{recursive:!0});console.log("[stx build] Discovering routes...");let b=Mt(i),E=["components","layouts","partials"],T=b.filter((h)=>!E.some((u)=>h.pattern.startsWith(`/${u}/`)||h.pattern===`/${u}`));console.log(`[stx build] Found ${T.length} page routes (${b.length-T.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let y=et(t.debug),x=nt();await Bun.write(g.join(e,"public","__stx",y.filename),y.content),await Bun.write(g.join(e,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${y.filename} (${(y.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let _=[],S=[];for(let h of T)try{let u=await wt(h.filePath,h.pattern,{componentsDir:a,partialsDir:c,layoutsDir:s,debug:t.debug});if(_.push(u),u.html=u.html.replace(/runtime\.__STX_HASH__\.js/g,y.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),u.html=Pt(u.html,p,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...l&&{colorMode:l}}),l)u.html=Ct(u.html,l);if(p.htmlAttrs)u.html=Dt(u.html,p.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(u.html)){let N=u.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(N&&N[1]){let Y=N[1];u.html=u.html.replace(" "+Y,""),u.html=u.html.replace(/<body([^>]*)>/,`<body$1 ${Y}>`)}}u.html=u.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),u.html=await Rt(u.html),u.fragment=lt(u.html,f);let X=h.pattern==="/"?"index":h.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),W=g.join("server","pages",`${X}.compiled.json`),U=g.join("server","fragments",`${X}.html`);await Bun.write(g.join(e,W),JSON.stringify(u,null,2)),await Bun.write(g.join(e,U),u.fragment),S.push({pattern:h.pattern,compiledPath:W,fragmentPath:U,isDynamic:u.hasServerScripts,hasParams:h.pattern.includes(":")||h.pattern.includes("[")}),console.log(`[stx build] \u2713 ${h.pattern}`)}catch(u){console.error(`[stx build] \u2717 ${h.pattern}:`,u instanceof Error?u.message:u)}let d=g.resolve(i,o);if(v.existsSync(d)){let{copied:h,bytes:u}=At(d,g.join(e,"public"));if(h>0)console.log(`[stx build] Copied ${h} public asset${h===1?"":"s"} (${(u/1024).toFixed(1)}KB) from ${o}/`)}let w=z(i);if(w){let{copied:h,bytes:u}=At(w,g.join(e,"public",K));if(h>0)console.log(`[stx build] Copied ${h} asset${h===1?"":"s"} (${(u/1024).toFixed(1)}KB) from ${k}/`)}let A={runtime:y.filename,router:x.filename},L=vt(S,A,e);Et(L,e);let C=Date.now()-n;return console.log(`
47
+ [stx build] Done in ${C}ms \u2014 ${_.length} pages compiled`),{pageCount:_.length,assets:A,outputDir:e,duration:C}}
48
+ export{Lt as u,ot as v,ve as w,Ee as x,Ae as y,P as z,Re as A,lt as B,K as C,z as D,tt as E,et as F,nt as G,ge as H,Xt as I,Oe as J,je as K,Kt as L,Qt as M,Ie as N,Le as O,Ne as P,ke as Q,wt as R,vt as S,Et as T,Qe as U,mn as V};