@stacksjs/stx 0.2.765 → 0.2.770

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 (228) hide show
  1. package/dist/{chunk-3mf27gj6.js → chunk-07thf07b.js} +2 -2
  2. package/dist/chunk-0cvpkj9g.js +2 -0
  3. package/dist/{chunk-8zgvr0fw.js → chunk-0h3sf5tp.js} +5 -5
  4. package/dist/chunk-0qgdex7z.js +2 -0
  5. package/dist/{chunk-p42kp93g.js → chunk-1925kbjc.js} +1 -1
  6. package/dist/chunk-1hb8q271.js +2 -0
  7. package/dist/chunk-1se5y83a.js +2 -0
  8. package/dist/{chunk-nr3pepv1.js → chunk-2bm97z09.js} +3 -3
  9. package/dist/chunk-2p301rsb.js +2 -0
  10. package/dist/{chunk-scq0h2cs.js → chunk-2vbgm9t4.js} +6 -6
  11. package/dist/chunk-33gccrx0.js +2 -0
  12. package/dist/chunk-3754her2.js +2 -0
  13. package/dist/{chunk-t8cgxk8w.js → chunk-392rrp28.js} +2 -2
  14. package/dist/chunk-3jkbs3fc.js +2 -0
  15. package/dist/{chunk-vy1weqvj.js → chunk-3png7zhs.js} +4 -4
  16. package/dist/chunk-3vankrf5.js +2 -0
  17. package/dist/{chunk-8prk7e1z.js → chunk-3y26rjq6.js} +10 -10
  18. package/dist/{chunk-ysfeg3cn.js → chunk-477gjb2b.js} +2 -2
  19. package/dist/chunk-4jzyd8k0.js +2 -0
  20. package/dist/{chunk-wp4nqnn7.js → chunk-4qng287p.js} +1 -1
  21. package/dist/chunk-4tvty67c.js +2 -0
  22. package/dist/chunk-4xaz5jbs.js +2 -0
  23. package/dist/{chunk-s2py8kg7.js → chunk-4xzk9529.js} +2 -2
  24. package/dist/chunk-53md2scd.js +2 -0
  25. package/dist/chunk-56sek7x7.js +2 -0
  26. package/dist/chunk-5g5v7yns.js +2 -0
  27. package/dist/chunk-5gg5jc76.js +2 -0
  28. package/dist/{chunk-1w4a0xya.js → chunk-5s2dwh5z.js} +11 -11
  29. package/dist/{chunk-qv99gqee.js → chunk-5t33zwwg.js} +1 -1
  30. package/dist/{chunk-dphhs29v.js → chunk-618d3ng3.js} +6 -6
  31. package/dist/chunk-68j6zb7n.js +2 -0
  32. package/dist/{chunk-fz717vpc.js → chunk-6b32wt31.js} +30 -30
  33. package/dist/{chunk-4yk7zngj.js → chunk-6cd5dyje.js} +22 -22
  34. package/dist/{chunk-49w4cbqb.js → chunk-6k4tbms6.js} +6 -6
  35. package/dist/{chunk-q22hwm64.js → chunk-6nf4xhv0.js} +5 -5
  36. package/dist/{chunk-n5dd6rpt.js → chunk-6sa5adg6.js} +2 -2
  37. package/dist/chunk-6wf0ter4.js +2 -0
  38. package/dist/{chunk-rv0yth27.js → chunk-70nwqsf6.js} +4 -4
  39. package/dist/chunk-75st1ttq.js +2 -0
  40. package/dist/{chunk-c1b481my.js → chunk-79x0812m.js} +2 -2
  41. package/dist/chunk-7ctvfad1.js +2 -0
  42. package/dist/{chunk-ftt3r7wh.js → chunk-7g29avcd.js} +5 -5
  43. package/dist/{chunk-2mckhfet.js → chunk-7h0mjwkq.js} +5 -5
  44. package/dist/{chunk-ay5g5cbk.js → chunk-7t1medmh.js} +2 -2
  45. package/dist/{chunk-cswar3zs.js → chunk-7wwfaj6b.js} +3 -3
  46. package/dist/{chunk-ccedry39.js → chunk-7y0v5dry.js} +2 -2
  47. package/dist/chunk-83aq0n9s.js +2 -0
  48. package/dist/{chunk-jb1c4e49.js → chunk-83fh7j8g.js} +2 -2
  49. package/dist/{chunk-as4s0nf5.js → chunk-91q55gjp.js} +3 -3
  50. package/dist/{chunk-xcstrdhp.js → chunk-9ewhnwcg.js} +4 -4
  51. package/dist/chunk-9vgkp3nj.js +2 -0
  52. package/dist/chunk-9vqj5jzp.js +2 -0
  53. package/dist/chunk-a50kn0hn.js +2 -0
  54. package/dist/{chunk-4m3666pm.js → chunk-amnydj3d.js} +1 -1
  55. package/dist/chunk-bpbhjn4w.js +2 -0
  56. package/dist/chunk-bqyj88qr.js +2 -0
  57. package/dist/{chunk-ztbk9yqv.js → chunk-bwzjjxnj.js} +4 -4
  58. package/dist/{chunk-ay02q27h.js → chunk-cak9fp9b.js} +7 -7
  59. package/dist/chunk-cgv3r6q9.js +2 -0
  60. package/dist/{chunk-stww901w.js → chunk-cn7zpm1x.js} +5 -5
  61. package/dist/{chunk-4tppbw4r.js → chunk-cqfyby1t.js} +2 -2
  62. package/dist/{chunk-m3dr63n0.js → chunk-ddhazq2g.js} +3 -3
  63. package/dist/{chunk-m15nbvck.js → chunk-ddjkt87h.js} +1 -1
  64. package/dist/{chunk-t70s45hc.js → chunk-dmj9gk6d.js} +2 -2
  65. package/dist/chunk-e6zv6p3x.js +2 -0
  66. package/dist/chunk-e96jbmkj.js +3 -0
  67. package/dist/{chunk-51dxp9w9.js → chunk-eb8dv03t.js} +3 -3
  68. package/dist/{chunk-c5mbhfff.js → chunk-edetp97r.js} +5 -5
  69. package/dist/chunk-ej4wf9m5.js +2 -0
  70. package/dist/{chunk-zs8yjtaz.js → chunk-erjp2w63.js} +5 -5
  71. package/dist/chunk-exfgfjf6.js +2 -0
  72. package/dist/chunk-fvg2p9z0.js +2 -0
  73. package/dist/chunk-fxvhkz72.js +2 -0
  74. package/dist/chunk-g6m3q9n4.js +2 -0
  75. package/dist/{chunk-2hbwpm36.js → chunk-gn5v004x.js} +14 -14
  76. package/dist/{chunk-bnwkytme.js → chunk-gzcg563a.js} +3 -3
  77. package/dist/{chunk-s9m2gfns.js → chunk-gzxjayvp.js} +6 -6
  78. package/dist/chunk-h2ymq7fa.js +2 -0
  79. package/dist/{chunk-kc3kt59e.js → chunk-hgm6f2t2.js} +2 -2
  80. package/dist/chunk-j1nyasyk.js +2 -0
  81. package/dist/chunk-j46nvncc.js +2 -0
  82. package/dist/chunk-jjvrm2j8.js +2 -0
  83. package/dist/chunk-kh0szwf3.js +2 -0
  84. package/dist/chunk-krdc3c87.js +7 -0
  85. package/dist/chunk-krw4m6j1.js +2 -0
  86. package/dist/{chunk-6h6teyxp.js → chunk-m207mdpy.js} +2 -2
  87. package/dist/{chunk-dxk5r71v.js → chunk-mcct58gb.js} +5 -5
  88. package/dist/{chunk-mmcqgwk7.js → chunk-mdw5sbbt.js} +2 -2
  89. package/dist/chunk-mvfj17fr.js +2 -0
  90. package/dist/{chunk-wb2ej5by.js → chunk-ngzdcvry.js} +1 -1
  91. package/dist/{chunk-pqgk9mxp.js → chunk-nj2q40p8.js} +2 -2
  92. package/dist/chunk-nmjgcw4g.js +2 -0
  93. package/dist/{chunk-ev4zxhpd.js → chunk-nnzmbfjq.js} +2 -2
  94. package/dist/{chunk-6jnrpnxb.js → chunk-nwhv1889.js} +3 -3
  95. package/dist/{chunk-1g5fg1ys.js → chunk-p1mbbdwj.js} +2 -2
  96. package/dist/chunk-p454tj1h.js +2 -0
  97. package/dist/{chunk-n8gfetjx.js → chunk-pgkcbm6g.js} +2 -2
  98. package/dist/{chunk-b8hsvzqb.js → chunk-pkyb284z.js} +2 -2
  99. package/dist/{chunk-7aw9qm74.js → chunk-prxe37hj.js} +41 -41
  100. package/dist/{chunk-e1e5xf8z.js → chunk-q3c130w6.js} +13 -13
  101. package/dist/chunk-q4m5p4wx.js +2 -0
  102. package/dist/chunk-q85s8ne0.js +2 -0
  103. package/dist/chunk-qe3hrbge.js +2 -0
  104. package/dist/{chunk-mpaepc7n.js → chunk-qk61pv1v.js} +79 -9
  105. package/dist/chunk-qq4ee7px.js +2 -0
  106. package/dist/chunk-qr5ddqbf.js +3 -0
  107. package/dist/{chunk-vvm38ysm.js → chunk-qsc5nse5.js} +1 -1
  108. package/dist/{chunk-et831a4y.js → chunk-qtja7fpr.js} +2 -2
  109. package/dist/{chunk-a2yptg7r.js → chunk-rc4zsymn.js} +2 -2
  110. package/dist/chunk-rfp5f55f.js +2 -0
  111. package/dist/{chunk-fjbhtakz.js → chunk-rjh7ptw5.js} +1 -1
  112. package/dist/{chunk-7yx2ztt5.js → chunk-rkz3k2td.js} +3 -3
  113. package/dist/{chunk-zfaa5xn5.js → chunk-s3m1ggsn.js} +6 -6
  114. package/dist/{chunk-qv2k0qb1.js → chunk-s8p958da.js} +65 -64
  115. package/dist/{chunk-a627f39k.js → chunk-ssd9g1wz.js} +1 -1
  116. package/dist/{chunk-0nzeqc13.js → chunk-tahdfsp4.js} +2 -2
  117. package/dist/chunk-th7amyq4.js +2 -0
  118. package/dist/chunk-v95kersm.js +2 -0
  119. package/dist/{chunk-0d29b573.js → chunk-vht2rhrj.js} +4 -4
  120. package/dist/{chunk-mdtjjzqc.js → chunk-vke28xq8.js} +2 -2
  121. package/dist/{chunk-vkpmemb1.js → chunk-w07n2ddj.js} +2 -2
  122. package/dist/chunk-w1sjp421.js +2 -0
  123. package/dist/chunk-w5d936jr.js +2 -0
  124. package/dist/{chunk-zjar9jdd.js → chunk-wabahwkj.js} +2 -2
  125. package/dist/{chunk-1day2nbr.js → chunk-x0qtgyqr.js} +5 -5
  126. package/dist/{chunk-dvh63p75.js → chunk-x148cxrj.js} +4 -4
  127. package/dist/chunk-x3xtyr95.js +2 -0
  128. package/dist/{chunk-h8yk9qm7.js → chunk-xaqtk05e.js} +2 -2
  129. package/dist/chunk-xb16yy2x.js +2 -0
  130. package/dist/{chunk-74y29xxs.js → chunk-xr28hjkp.js} +6 -6
  131. package/dist/{chunk-t6d7m4tf.js → chunk-y6hyndrt.js} +9 -9
  132. package/dist/chunk-yavspk55.js +2 -0
  133. package/dist/{chunk-tqf8a258.js → chunk-yjzczm2s.js} +10 -10
  134. package/dist/chunk-yrh9yfnv.js +2 -0
  135. package/dist/chunk-ysm6gaq9.js +2 -0
  136. package/dist/{chunk-knzp4c6m.js → chunk-ytjhb81r.js} +3 -3
  137. package/dist/{chunk-07c8rk93.js → chunk-yzbdm457.js} +2 -2
  138. package/dist/{chunk-8hanmv49.js → chunk-z1br7qeb.js} +31 -4
  139. package/dist/chunk-z515xymr.js +2 -0
  140. package/dist/{chunk-nj5azxxj.js → chunk-z5vkzbct.js} +4 -4
  141. package/dist/chunk-z6xfmrtc.js +2 -0
  142. package/dist/{chunk-kwy0spcd.js → chunk-z846tgfe.js} +3 -3
  143. package/dist/chunk-za7v4w04.js +2 -0
  144. package/dist/chunk-zb8wv7sc.js +2 -0
  145. package/dist/{chunk-z6sg0dq3.js → chunk-zsfr4dv9.js} +4 -4
  146. package/dist/cli.js +19 -19
  147. package/dist/client/signals-for-runtime.js +2 -0
  148. package/dist/client/signals-if-runtime.js +2 -0
  149. package/dist/client/signals-loop-conditional-runtime.js +66 -0
  150. package/dist/component-contract-checks.js +3 -2
  151. package/dist/craft-entry.js +2 -2
  152. package/dist/craft.js +2 -2
  153. package/dist/expressions.js +15 -0
  154. package/dist/message-catalogs.d.ts +6 -0
  155. package/dist/message-catalogs.js +12 -8
  156. package/dist/native/event-names.js +2 -0
  157. package/dist/native/prop-names.js +2 -0
  158. package/dist/process.js +18 -4
  159. package/dist/pwa.js +3 -3
  160. package/dist/signal-processing.d.ts +12 -0
  161. package/dist/signal-processing.js +12 -1
  162. package/dist/ssg.js +4 -4
  163. package/dist/types/config-types.d.ts +1 -0
  164. package/dist/web-modules.d.ts +9 -0
  165. package/dist/web-modules.js +47 -0
  166. package/package.json +5 -5
  167. package/dist/chunk-01484snf.js +0 -2
  168. package/dist/chunk-09cera09.js +0 -2
  169. package/dist/chunk-0f5276fm.js +0 -2
  170. package/dist/chunk-16n128gh.js +0 -2
  171. package/dist/chunk-171bbyqv.js +0 -2
  172. package/dist/chunk-1g0g498y.js +0 -2
  173. package/dist/chunk-1qppvj48.js +0 -2
  174. package/dist/chunk-1z77g0j6.js +0 -2
  175. package/dist/chunk-31e7xkrt.js +0 -2
  176. package/dist/chunk-3ffz7pd4.js +0 -2
  177. package/dist/chunk-4bhbtvtm.js +0 -2
  178. package/dist/chunk-59r38w60.js +0 -2
  179. package/dist/chunk-5ttj2c0h.js +0 -2
  180. package/dist/chunk-5x312c05.js +0 -2
  181. package/dist/chunk-65h2h51z.js +0 -2
  182. package/dist/chunk-6ch8t3d9.js +0 -3
  183. package/dist/chunk-6rd0zz6k.js +0 -2
  184. package/dist/chunk-7bvhpdqv.js +0 -2
  185. package/dist/chunk-axxd53tn.js +0 -2
  186. package/dist/chunk-b8ar6431.js +0 -2
  187. package/dist/chunk-bnm7ym0g.js +0 -2
  188. package/dist/chunk-brg2ydrk.js +0 -2
  189. package/dist/chunk-bwkw2dw3.js +0 -2
  190. package/dist/chunk-c0fwppzc.js +0 -2
  191. package/dist/chunk-c5kpc7rn.js +0 -2
  192. package/dist/chunk-c8256r1a.js +0 -2
  193. package/dist/chunk-cap6exxx.js +0 -2
  194. package/dist/chunk-cft1sprt.js +0 -2
  195. package/dist/chunk-dt0deg4z.js +0 -2
  196. package/dist/chunk-ejqr5cva.js +0 -2
  197. package/dist/chunk-evbxyw80.js +0 -2
  198. package/dist/chunk-f66n66c8.js +0 -2
  199. package/dist/chunk-f6h8yagj.js +0 -2
  200. package/dist/chunk-fpsm2qed.js +0 -2
  201. package/dist/chunk-fta169tc.js +0 -7
  202. package/dist/chunk-fzf7yfpn.js +0 -2
  203. package/dist/chunk-gaatje2g.js +0 -2
  204. package/dist/chunk-hfcmbbkq.js +0 -2
  205. package/dist/chunk-jhz0dvqz.js +0 -2
  206. package/dist/chunk-k54pgbzm.js +0 -2
  207. package/dist/chunk-kkx2gqk8.js +0 -2
  208. package/dist/chunk-n9zka6dg.js +0 -2
  209. package/dist/chunk-pvx57vpw.js +0 -2
  210. package/dist/chunk-qcz104h3.js +0 -2
  211. package/dist/chunk-qgvez75f.js +0 -2
  212. package/dist/chunk-r0j6jkxc.js +0 -2
  213. package/dist/chunk-rzh4xgb4.js +0 -2
  214. package/dist/chunk-rzv9xcyp.js +0 -2
  215. package/dist/chunk-s922mx0k.js +0 -2
  216. package/dist/chunk-sy4wqxta.js +0 -2
  217. package/dist/chunk-szdm8wfn.js +0 -2
  218. package/dist/chunk-t424gvwc.js +0 -2
  219. package/dist/chunk-vtvaa8y9.js +0 -2
  220. package/dist/chunk-vvj09a7b.js +0 -2
  221. package/dist/chunk-vwjy6491.js +0 -2
  222. package/dist/chunk-w2nzevn0.js +0 -2
  223. package/dist/chunk-wadp2rmj.js +0 -2
  224. package/dist/chunk-wbkcwj27.js +0 -2
  225. package/dist/chunk-wzp8y0a4.js +0 -2
  226. package/dist/chunk-xc1he6hs.js +0 -2
  227. package/dist/chunk-ytzzth34.js +0 -2
  228. package/dist/chunk-zhxg6b64.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Yr}from"./chunk-fz717vpc.js";import{S}from"./chunk-qv2k0qb1.js";import{a}from"./chunk-tqf8a258.js";import{qe,re}from"./chunk-kc3kt59e.js";import{Wa}from"./chunk-xcstrdhp.js";import{L}from"./chunk-0wj31pqy.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var lu=`
2
+ import{Zr}from"./chunk-6b32wt31.js";import{S}from"./chunk-s8p958da.js";import{a}from"./chunk-yjzczm2s.js";import{qe,re}from"./chunk-hgm6f2t2.js";import{qa}from"./chunk-9ewhnwcg.js";import{L}from"./chunk-0wj31pqy.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as F,mkdirSync as y,copyFileSync as P,chmodSync as I,rmSync as he}from"fs";import{join as c,basename as ve,resolve as G}from"path";import{spawn as z}from"child_process";import{platform as xe}from"os";function E(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=S(e,(t,o)=>(n.lastIndex=o,n.exec(t)?n.lastIndex:-1))[0];return s?e.slice(0,s.start)+i+e.slice(s.start):null}var uu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -468,9 +468,9 @@ else if (data.type === 'event' && data.method) {
468
468
  }
469
469
  })();
470
470
  </script>
471
- `;function ya(e={}){let{debug:r=!1,timeout:i=30000}=e;return lu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function uh(){return!1}function dh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return ya(t)})}function ba(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=ya(r),n=E(e,"head",`${i}
471
+ `;function ba(e={}){let{debug:r=!1,timeout:i=30000}=e;return uu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function ph(){return!1}function fh(e,r={}){let i=/@craft(?:\(([\s\S]*?)\))?/g;return e.replace(i,(n,s)=>{let t={};if(s)try{t=JSON.parse(s.replace(/'/g,'"'))}catch{try{t=Function(`return ${s}`)()}catch{console.warn(`[stx] Invalid @craft config: ${s}`)}}return ba(t)})}function wa(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=ba(r),n=E(e,"head",`${i}
472
472
  `);if(n!==null)return n;let s=L(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
473
- ${i}`+e.slice(t)}return i+e}var wo={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
473
+ ${i}`+e.slice(t)}return i+e}var vo={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(e,r)=>{let i=e.checked?"checked":"",n=e.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
474
474
  <input type="checkbox" class="craft-checkbox" ${i} ${n}>
475
475
  <span class="craft-checkbox-label">${r||e.label||""}</span>
476
476
  </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(e,r)=>{let i=e.min??0,n=e.max??100,s=e.step??1,t=e.value??50,o=e.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${i}" max="${n}" step="${s}" value="${t}" ${o}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(e,r)=>{let i=e.size||40,n=e.src,s=String(e.alt||""),t=e.fallback||(s?s.charAt(0).toUpperCase():"?");if(n)return`<img class="craft-avatar" src="${n}" alt="${s}" style="width:${i}px;height:${i}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${i}px;height:${i}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${t}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(e,r)=>{let i=Number(e.value)||0,n=Number(e.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,i/n*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(e,r)=>{let i=e.size||24;return`<div class="craft-spinner" style="width:${i}px;height:${i}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(e,r)=>{let i=e.open?"open":"",n=e.title||"";return`<dialog class="craft-modal" ${i}>
@@ -484,7 +484,7 @@ ${i}`+e.slice(t)}return i+e}var wo={button:{nativeType:"craft-button",fallbackTa
484
484
  </details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(e,r)=>{let i=e.variant||"info",n=e.title||"";return`<div class="craft-alert craft-alert-${i}" role="alert">
485
485
  ${n?`<div class="craft-alert-title">${n}</div>`:""}
486
486
  <div class="craft-alert-content">${r}</div>
487
- </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:ee},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:te},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ae},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ie},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},Jr=`
487
+ </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(e,r)=>{let i=e.content||"",n=e.position||"top";return`<span class="craft-tooltip" data-tooltip="${i}" data-position="${n}">${r}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:ee},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:te},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:ae},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:ie},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(e,r)=>`<input type="color" class="craft-color-picker" value="${e.value||"#000000"}">`},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(e,r)=>{let i=e.value||"",n=e.min||"",s=e.max||"";return`<input type="date" class="craft-date-picker" value="${i}" min="${n}" max="${s}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(e,r)=>`<input type="time" class="craft-time-picker" value="${e.value||""}">`}},Yr=`
488
488
  <style id="craft-component-styles">
489
489
  /* Craft Component Base Styles */
490
490
  .craft-button {
@@ -902,7 +902,7 @@ ${i}`+e.slice(t)}return i+e}var wo={button:{nativeType:"craft-button",fallbackTa
902
902
  }
903
903
  }
904
904
  </style>
905
- `,wa=`
905
+ `,va=`
906
906
  <script id="craft-component-runtime">
907
907
  (function() {
908
908
  if (window.__stxCraftComponentRuntime) return;
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var wo={button:{nativeType:"craft-button",fallbackTa
1006
1006
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
1007
1007
  })();
1008
1008
  </script>
1009
- `;function va(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=E(e,"head",`${Jr}
1010
- `)??Jr+e;if(!e.includes("craft-component-runtime"))e=E(e,"body",`${wa}
1011
- `)??e+wa;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>A("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>A("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>A(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>A(s,t,o.trim(),r,i)),e}function A(e,r,i,n,s){let t=n.components?.[e]||wo[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=N(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=fe(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function N(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function ee(e,r){let i=B(String(e.id||`craft-sidebar-${le(r||JSON.stringify(e))}`)),n=oe(e.spaces)||se(r),s=n.length?[]:de(e.sections)||U(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),p=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=ce(n,t,d);else if(s.length)m=s.map((v)=>j(v,d)).join("");else m=r;return`<aside class="${x(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${p}" style="--craft-sidebar-width:${l}px">
1009
+ `;function xa(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=E(e,"head",`${Yr}
1010
+ `)??Yr+e;if(!e.includes("craft-component-runtime"))e=E(e,"body",`${va}
1011
+ `)??e+va;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>A("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>A("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>A(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>A(s,t,o.trim(),r,i)),e}function A(e,r,i,n,s){let t=n.components?.[e]||vo[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=N(r),d=[t.fallbackClasses||`${s}-${e}`];if(o.class)d.push(o.class),delete o.class;if(t.render)return o.__fallbackClasses=d.join(" "),t.render(o,i);let f=fe(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function N(e){let r={},i=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,n;while((n=i.exec(e))!==null){let[s,t,o,d]=n,f=o??d;if(s.startsWith(":"))r[t]=f;else if(s.startsWith("@"))r[`on${t.charAt(0).toUpperCase()}${t.slice(1)}`]=f;else if(f===void 0)r[t]=!0;else r[t]=f}return r}function ee(e,r){let i=B(String(e.id||`craft-sidebar-${le(r||JSON.stringify(e))}`)),n=oe(e.spaces)||se(r),s=n.length?[]:de(e.sections)||U(r),t=String(e.selectedSpace||n[0]?.id||""),o=n.find((v)=>v.id===t)||n[0],d=String(e.selectedItem||e.selected||(n.length?o?.sections[0]?.items[0]?.id:s[0]?.items[0]?.id)||""),f={id:i,variant:String(e.variant||"desktop"),material:String(e.material||"sidebar"),backgroundEffect:String(e.backgroundEffect||"shimmer"),allowsVibrancy:e.allowsVibrancy!==!1&&e.allowsVibrancy!=="false",materialOpacity:Number(e.materialOpacity??0.68),materialDarkOpacity:e.materialDarkOpacity===void 0?void 0:Number(e.materialDarkOpacity),minWidth:e.minWidth===void 0?240:Number(e.minWidth),maxWidth:e.maxWidth===void 0?340:Number(e.maxWidth),canCollapse:e.canCollapse!==!1&&e.canCollapse!=="false",searchPlaceholder:e.searchPlaceholder?String(e.searchPlaceholder):void 0,selectedItem:d,sections:s,spaces:n,selectedSpace:t||void 0},u=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),p=e.native===!1||e.native==="false"?"false":"true",b=f.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${T(f.searchPlaceholder)}"></div>`:"",m;if(n.length)m=ce(n,t,d);else if(s.length)m=s.map((v)=>j(v,d)).join("");else m=r;return`<aside class="${x(u)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${p}" style="--craft-sidebar-width:${l}px">
1012
1012
  ${b}
1013
1013
  ${m}
1014
1014
  </aside>
@@ -1029,8 +1029,8 @@ ${i}`+e.slice(t)}return i+e}var wo={button:{nativeType:"craft-button",fallbackTa
1029
1029
  ${e.icon?`<span class="craft-sidebar-item-icon" data-icon="${x(e.icon)}"${i}></span>`:""}
1030
1030
  <span class="craft-sidebar-item-label">${T(e.label)}</span>
1031
1031
  ${e.badge?`<span class="craft-sidebar-item-badge">${T(e.badge)}</span>`:""}
1032
- </button>`}function B(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function le(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x(e){return T(e).replace(/`/g,"&#96;")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function fe(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");n.push(`${s}="${o}"`)}return n.join(" ")}function ph(e,r){wo[e]=r}function fh(){return{...wo}}import{chmodSync as pe,copyFileSync as be,mkdtempSync as V,rmSync as ge,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as O}from"path";function me(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function we(e,r){let i=O(r,"Contents","embedded.provisionprofile");be(e,i),pe(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=me(u.stdout),p={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");p=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])p[b]=l[b];if(s=V(O(W(),"stx-entitlements-")),n=O(s,"entitlements.plist"),J(n,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");we(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(O(W(),"stx-entitlements-")),t=O(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let p=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",p,...l,u],{stdout:"pipe",stderr:"pipe"}),[m,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${u}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)ge(s,{recursive:!0,force:!0})}}async function xa(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||D(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||D(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!F(G(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!F(s))y(s,{recursive:!0});let t=await a(process.cwd()),o=await Wa(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=ba(o,{debug:e.verbose}),o=va(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Jr}
1033
- </head>`)}let d=e.name||ve(e.input,".stx"),f=e.version||"1.0.0",u=e.craftPath||Sa(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let p=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(p.exitCode!==0||p.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=Yr(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await ye(o,d,f,s,n,e,u);break;case"windows":l=await $e(o,d,f,s,n,e,u);break;case"linux":l=await Te(o,d,f,s,n,e,u);break;case"ios":l=await Pe(o,d,f,s,e,u);break;case"android":l=await Ie(o,d,f,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||D(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function ye(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),u=c(f,"Contents"),l=c(u,"MacOS"),p=c(u,"Resources");he(f,{recursive:!0,force:!0}),y(l,{recursive:!0}),y(p,{recursive:!0});let b=c(p,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(p,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await Ce(o)?"executable":"launcher");if(t.backend){if(!await Se(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=qe("native-backend");try{let w=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(M)}
1032
+ </button>`}function B(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function le(e){let r=5381;for(let i=0;i<e.length;i++)r=r*33^e.charCodeAt(i);return(r>>>0).toString(36)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x(e){return T(e).replace(/`/g,"&#96;")}function ue(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function fe(e,r,i){let n=[];n.push(`class="${i.join(" ")}"`),n.push(`data-craft="${r.nativeType}"`);for(let[s,t]of Object.entries(e))if(t===!0)n.push(s);else if(t!==!1&&t!==void 0&&t!==null){let o=String(t).replace(/"/g,"&quot;");n.push(`${s}="${o}"`)}return n.join(" ")}function gh(e,r){vo[e]=r}function mh(){return{...vo}}import{chmodSync as pe,copyFileSync as be,mkdtempSync as V,rmSync as ge,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as O}from"path";function me(e){let r=Bun.spawnSync(["/usr/bin/plutil","-extract","Entitlements","xml1","-o","-","-"],{stdin:e});if(r.exitCode!==0)throw Error(`Could not extract the macOS profile entitlements: ${r.stderr.toString().trim()||r.stdout.toString().trim()}`);let i=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-","-"],{stdin:r.stdout});if(i.exitCode!==0)throw Error(`Could not convert the macOS profile entitlements: ${i.stderr.toString().trim()||i.stdout.toString().trim()}`);let n=JSON.parse(i.stdout.toString());if(!n||typeof n!=="object"||Array.isArray(n))throw Error("The macOS profile entitlements must be a dictionary.");return n}function we(e,r){let i=O(r,"Contents","embedded.provisionprofile");be(e,i),pe(i,420)}async function Q(e,r=[],i={}){if(process.platform!=="darwin")return;let n=i.entitlements,s;try{if(i.provisioningProfile){if(!i.identity||i.identity==="-")throw Error("A provisioning profile requires a signing identity.");let u=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(u.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=me(u.stdout),p={};if(i.entitlements){let b=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",i.entitlements]);if(b.exitCode!==0)throw Error("Could not read the app entitlements plist.");p=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])p[b]=l[b];if(s=V(O(W(),"stx-entitlements-")),n=O(s,"entitlements.plist"),J(n,JSON.stringify(p)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");we(i.provisioningProfile,e)}let t;if(r.length){let u=!1;if(n){let l=Bun.spawnSync(["/usr/bin/plutil","-convert","json","-o","-",n]);if(l.exitCode!==0)throw Error("Could not read native parent entitlements.");u=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(O(W(),"stx-entitlements-")),t=O(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...u?{"com.apple.security.app-sandbox":!0,"com.apple.security.inherit":!0}:{}})),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",t]).exitCode!==0)throw Error("Could not generate native helper entitlements.")}for(let u of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(u===e&&n)l.push("--entitlements",n);if(u!==e&&t)l.push("--entitlements",t);let p=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",p,...l,u],{stdout:"pipe",stderr:"pipe"}),[m,v]=await Promise.all([new Response(b.stderr).text(),b.exited]);if(v!==0)throw Error(`Could not sign native bundle ${u}: ${m.trim()}`)}let o=Bun.spawn(["/usr/bin/codesign","--verify","--strict",e],{stdout:"pipe",stderr:"pipe"}),[d,f]=await Promise.all([new Response(o.stderr).text(),o.exited]);if(f!==0)throw Error(`Invalid native bundle signature: ${d.trim()}`)}finally{if(s)ge(s,{recursive:!0,force:!0})}}async function Sa(e){if(e.window?.cornerRadius!==void 0&&(!Number.isFinite(e.window.cornerRadius)||e.window.cornerRadius<0||e.window.cornerRadius>128))throw Error("Native window cornerRadius must be between 0 and 128");let r=Date.now();try{if(!await Bun.file(e.input).exists())return{success:!1,target:e.target||D(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||D(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!F(G(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!F(s))y(s,{recursive:!0});let t=await a(process.cwd()),o=await qa(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=wa(o,{debug:e.verbose}),o=xa(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Yr}
1033
+ </head>`)}let d=e.name||ve(e.input,".stx"),f=e.version||"1.0.0",u=e.craftPath||ka(e.runtimeProfile);if(!u)return{success:!1,target:i,format:n,error:"Craft native binary not found on PATH. Run pantry install craft, or specify craftPath for framework development."};if(e.runtimeProfile==="webview"){if(i!=="macos")throw Error("The webview runtime profile is currently available on macOS only.");let p=Bun.spawnSync([u,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(p.exitCode!==0||p.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(u=Zr(e.craftPath,e.runtimeProfile),e.verbose)console.log(`\uD83D\uDCE6 Building native app for ${i}...`),console.log(` Input: ${e.input}`),console.log(` Output: ${s}`),console.log(` Craft: ${u}`);let l;switch(i){case"macos":l=await ye(o,d,f,s,n,e,u);break;case"windows":l=await $e(o,d,f,s,n,e,u);break;case"linux":l=await Te(o,d,f,s,n,e,u);break;case"ios":l=await Pe(o,d,f,s,e,u);break;case"android":l=await Ie(o,d,f,s,e,u);break;default:l={success:!1,target:i,format:n,error:`Unsupported target: ${i}`}}return l.duration=Date.now()-r,l}catch(i){return{success:!1,target:e.target||D(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function ye(e,r,i,n,s,t,o){let d=t.bundleId||`com.stx.${r.toLowerCase().replace(/[^a-z0-9]/g,"")}`,f=c(n,`${r}.app`),u=c(f,"Contents"),l=c(u,"MacOS"),p=c(u,"Resources");he(f,{recursive:!0,force:!0}),y(l,{recursive:!0}),y(p,{recursive:!0});let b=c(p,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(p,"sidebar-config.json"),await Bun.write(m,JSON.stringify(t.sidebar.config));let v=t.sidebar?.enabled?`--native-sidebar --sidebar-width ${t.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",k=t.menubarOnly??t.systemTray,h=t.bundleStyle||(await Ce(o)?"executable":"launcher");if(t.backend){if(!await Se(o))throw Error("This Craft runtime does not support bundled backends. Upgrade Craft before building this app.");P(o,c(l,r)),I(c(l,r),493);let C=qe("native-backend");try{let w=c(C,"launcher.ts"),M=c(import.meta.dir,"native-backend"+(import.meta.path.endsWith(".ts")?".ts":".js"));await Bun.write(w,`import { runNativeBackend } from ${JSON.stringify(M)}
1034
1034
  import * as backend from ${JSON.stringify(G(t.backend.entry))}
1035
1035
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
1036
1036
  maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
@@ -1076,7 +1076,7 @@ Name=${r}
1076
1076
  Exec=${p}
1077
1077
  Terminal=false
1078
1078
  Categories=Utility;
1079
- `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function Sa(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!F(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function D(){switch(xe()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return new Promise((n)=>{let s=z("hdiutil",["create","-volname",i,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)n({success:!0});else n({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{n({success:!1,error:t.message})})})}async function Ee(e,r){return new Promise((i)=>{let n=z("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=qe("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),p=c(d,"usr","share",i.toLowerCase());y(f,{recursive:!0}),y(u,{recursive:!0}),y(l,{recursive:!0}),y(p,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(p,h));let m=`#!/bin/bash
1079
+ `;if(await Bun.write(c(d,`${r.toLowerCase()}.desktop`),b),s==="deb"){let m=c(n,`${r.toLowerCase()}_${i}_amd64.deb`),v=await Oe(d,m,r,i,t);if(!v.success)return{success:!1,target:"linux",format:"deb",error:v.error};return{success:!0,target:"linux",format:"deb",outputPath:m}}if(s==="appimage"){let m=c(n,`${r}-${i}-x86_64.AppImage`),v=await De(d,m,r,t);if(!v.success)return{success:!1,target:"linux",format:"appimage",error:v.error};return{success:!0,target:"linux",format:"appimage",outputPath:m}}return{success:!0,target:"linux",format:"app",outputPath:d}}async function Pe(e,r,i,n,s,t){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${r}' to create an iOS project.`}}async function Ie(e,r,i,n,s,t){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${r}' to create an Android project.`}}function ka(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!F(r))throw Error(`CRAFT_BIN points to a missing file: ${r}`);return r}return Bun.which(e==="webview"?"craft-webview":"craft",{PATH:process.env.PATH??"",cwd:process.cwd()})}function D(){switch(xe()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function Be(e){switch(e){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function Re(e,r,i){return new Promise((n)=>{let s=z("hdiutil",["create","-volname",i,"-srcfolder",e,"-ov","-format","UDZO",r]);s.on("close",(t)=>{if(t===0)n({success:!0});else n({success:!1,error:`hdiutil exited with code ${t}`})}),s.on("error",(t)=>{n({success:!1,error:t.message})})})}async function Ee(e,r){return new Promise((i)=>{let n=z("zip",["-r",r,"."],{cwd:e});n.on("close",(s)=>{if(s===0)i({success:!0});else i({success:!1,error:`zip exited with code ${s}`})}),n.on("error",(s)=>{i({success:!1,error:s.message})})})}async function Oe(e,r,i,n,s){return new Promise((t)=>{let o=qe("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),u=c(d,"usr","bin"),l=c(d,"usr","share","applications"),p=c(d,"usr","share",i.toLowerCase());y(f,{recursive:!0}),y(u,{recursive:!0}),y(l,{recursive:!0}),y(p,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(p,h));let m=`#!/bin/bash
1080
1080
  exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;g("fs").writeFileSync(c(u,i.toLowerCase()),m),I(c(u,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
1081
1081
  Version: ${n}
1082
1082
  Section: utils
@@ -1097,5 +1097,5 @@ Exec=${i.toLowerCase()}
1097
1097
  Terminal=false
1098
1098
  Categories=Utility;
1099
1099
  Icon=${i.toLowerCase()}
1100
- `;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&F(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=z("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(re(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{re(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){re(t),s({success:!1,error:o.message})}})}function ka(){return[D()]}function _a(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Ae={buildNative:xa,getAvailableTargets:ka,getAvailableFormats:_a,detectPlatform:D},gh=Ae;
1101
- export{lu,ya,uh,dh,ba,wo,Jr,wa,va,ph,fh,xa,Sa,ka,_a,gh};
1100
+ `;g("fs").writeFileSync(c(o,`${i.toLowerCase()}.desktop`),m);let v=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(g("fs").writeFileSync(c(o,`${i.toLowerCase()}.png`),v),n.icon&&F(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=z("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(re(t),h===0)I(r,493),s({success:!0});else s({success:!1,error:`appimagetool exited with code ${h}. Install from https://appimage.github.io/appimagetool/`})}),k.on("error",(h)=>{re(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){re(t),s({success:!1,error:o.message})}})}function _a(){return[D()]}function Ca(e){switch(e){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Ae={buildNative:Sa,getAvailableTargets:_a,getAvailableFormats:Ca,detectPlatform:D},hh=Ae;
1101
+ export{uu,ba,ph,fh,wa,vo,Yr,va,xa,gh,mh,Sa,ka,_a,Ca,hh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kl,Xl,Gl,Jl,Yl,Zl,Ql,eu,tu,nu,Cm}from"./chunk-2vbgm9t4.js";export{Kl as createIslandRegistry,Cm as default,nu as generateIslandManifest,Gl as generatePartialHydrationCSS,Zl as hydrateAll,Yl as hydrateByStrategy,Jl as hydrateIsland,Ql as isHydrated,eu as onHydrated,Xl as processPartialHydrationDirectives,tu as processStaticDirectives};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{da,cm}from"./chunk-ddjkt87h.js";export{da as definePlugin,cm as pluginManager};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Sl,kl}from"./chunk-6cd5dyje.js";import"./chunk-tahdfsp4.js";import"./chunk-gzcg563a.js";import"./chunk-cqfyby1t.js";import"./chunk-7y0v5dry.js";import"./chunk-x0qtgyqr.js";import"./chunk-vht2rhrj.js";import"./chunk-3y26rjq6.js";import"./chunk-mdw5sbbt.js";import"./chunk-6nf4xhv0.js";import"./chunk-m207mdpy.js";import"./chunk-nj2q40p8.js";import"./chunk-ddjkt87h.js";import"./chunk-7t1medmh.js";import"./chunk-dmj9gk6d.js";import"./chunk-477gjb2b.js";import"./chunk-z5vkzbct.js";import"./chunk-cn7zpm1x.js";import"./chunk-618d3ng3.js";import"./chunk-2vbgm9t4.js";import"./chunk-eb8dv03t.js";import"./chunk-s3m1ggsn.js";import"./chunk-07thf07b.js";import"./chunk-91q55gjp.js";import"./chunk-7h0mjwkq.js";import"./chunk-erjp2w63.js";import"./chunk-3png7zhs.js";import"./chunk-7wwfaj6b.js";import"./chunk-qk61pv1v.js";import"./chunk-9ewhnwcg.js";import"./chunk-hgm6f2t2.js";import"./chunk-rkz3k2td.js";import{Zt}from"./chunk-qsc5nse5.js";import"./chunk-70nwqsf6.js";import"./chunk-edetp97r.js";import"./chunk-wmnzapn8.js";import{Re,i}from"./chunk-prxe37hj.js";import"./chunk-gzxjayvp.js";import"./chunk-6k4tbms6.js";import"./chunk-xaqtk05e.js";import"./chunk-zsfr4dv9.js";import"./chunk-e96jbmkj.js";import"./chunk-z846tgfe.js";import"./chunk-w07n2ddj.js";import"./chunk-y6hyndrt.js";import{we}from"./chunk-mcct58gb.js";import"./chunk-5t33zwwg.js";import{cr,lr}from"./chunk-pkyb284z.js";import{ws,j,a}from"./chunk-yjzczm2s.js";import"./chunk-ytjhb81r.js";import"./chunk-79x0812m.js";import"./chunk-bwzjjxnj.js";import"./chunk-cak9fp9b.js";import"./chunk-z1br7qeb.js";import{m,Le}from"./chunk-s8p958da.js";import"./chunk-392rrp28.js";import"./chunk-p1mbbdwj.js";import"./chunk-5s2dwh5z.js";import"./chunk-4833k99b.js";import"./chunk-yzbdm457.js";import"./chunk-1925kbjc.js";import"./chunk-ddhazq2g.js";export{ws as buildWebComponents,lr as cacheTemplate,cr as checkCache,Zt as classifyAllScripts,Sl as createMiddleware,kl as createRoute,j as defaultConfig,m as extractVariables,we as injectRouterScript,a as loadStxConfig,Le as processClientScript,i as processDirectives,Re as readMarkdownFile};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ul,dl,pl}from"./chunk-07c8rk93.js";import{le,Hn,Vn,ho,Kr,Xr,Un,Wn,yo,Gr}from"./chunk-n8gfetjx.js";function z(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},M=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=M(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,M=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(M(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(M(),n))},W=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)W(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)W(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((D,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let D=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=D(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:M,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(M(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
2
+ import{dl,pl,fl}from"./chunk-yzbdm457.js";import{le,Hn,Vn,yo,Xr,Gr,Un,Wn,bo,Jr}from"./chunk-pgkcbm6g.js";function W(e,s,i,a,d,y){let r=!0,u=new Set,f=(p)=>a.get?a.get(p):p,o=()=>f(e());return Object.defineProperty(o,"_isSignal",{value:!0}),Object.defineProperty(o,"modifiers",{get:s}),o.set=(p)=>{if(!r)return;let h=s(),t=a.set?a.set(p,h):p;if(h.trim&&typeof t==="string")t=t.trim();if(h.number&&typeof t==="string"&&t!==""){let l=Number(t);if(!Number.isNaN(l))t=l}if(Object.is(e(),t))return;e.set(t),i(t)},o.update=(p)=>o.set(p(o())),o.input=(p)=>{if(!s().lazy)o.set(p)},o.change=(p)=>{if(s().lazy)o.set(p)},o.subscribe=(p)=>{if(!r)return()=>{};let h=e.subscribe((t,l)=>p(f(t),f(l)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(o,"value",{get:o,set:o.set}),d(()=>{r=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{r=!0}),o}function X(e,s=!0,i){if(!s||!e||typeof window>"u")return;let a=window;if(!a.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let r=JSON.parse(y?.textContent||"{}");a.__STX_DATA__=r&&typeof r==="object"&&!Array.isArray(r)?r:{}}catch{a.__STX_DATA__={}}}let d=a.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:i?i(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let s=window;if(e===void 0)s.__STX_DATA__={};else{if(!s.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");s.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{s.__STX_DATA__={}}if(s.__STX_DATA__)delete s.__STX_DATA__[e]}}function Y(e){let s=null;try{s=typeof indexedDB<"u"?indexedDB:null}catch{s=null}if(!s)return null;let i=s,a=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let o=i.open(a,1);o.onupgradeneeded=()=>{o.result.createObjectStore("kv")},o.onsuccess=()=>u(o.result),o.onerror=()=>f(o.error),o.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},r=(u,f)=>y().then((o)=>new Promise((p,h)=>{let t=o.transaction("kv",u),l=f(t.objectStore("kv"));t.oncomplete=()=>p(l?l.result:void 0),t.onerror=()=>h(t.error),t.onabort=()=>h(t.error)}));return{get:(u)=>r("readonly",(f)=>f.get(u)),set:(u,f)=>r("readwrite",(o)=>{o.put(f,u)}),remove:(u)=>r("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>r("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,s){let i=e||{},a=null;if(i.storage!==void 0)a=i.storage;else try{a=typeof localStorage<"u"?localStorage:null}catch{a=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let r=()=>{if(y)return d;y=!0;try{d=s?s():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),o=new Map,p=new Set,h=new Map,t=!1,l=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!a)return!1;try{return a.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(a)a.removeItem(n)}catch{}},k=()=>{if(t=!1,!h.size)return l;let n=Array.from(h.entries());return h.clear(),l=l.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),l},N=(n,c)=>{if(h.set(n,c),p.add(n),t)return;t=!0,f(()=>{k()})},M=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(o.has(n))return{value:o.get(n)};let c=null;try{c=a?a.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return o.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:r();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(o.has(n))return{value:o.get(n)};let S=M(x);if(S)o.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(o.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!r()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(o.keys()))if(v.indexOf(n)===0)o.delete(v);for(let v of Array.from(h.keys()))if(v.indexOf(n)===0)h.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(a)for(let v=a.length-1;v>=0;v--){let x=a.key(v);if(x&&x.indexOf(n)===0)a.removeItem(x)}}catch{}let c=r();if(!c)return l;return l=l.then(()=>c.removePrefix(n)).catch(()=>{}),l},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,s){if(!e)return!1;if(e===s.key)return!0;if(!s.url)return!1;if(e===s.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",a=new URL(e,i),d=new URL(s.url,i);if(a.origin!==d.origin||a.pathname!==d.pathname)return!1;return!a.search||a.search===d.search}catch{return!1}}function ee(e){let s=e.prefix||"stx:kept:",i=e.matches||((t,l)=>t===l.key||t===l.url),a=new Set,d=new Map,y,r=(t)=>t===void 0?y:t,u=(t,l)=>{let g=r(l);if(g===!1||g===null||g==="")return null;return`${s}${g===void 0?"":`${g}:`}query:${t}`},f=(t)=>{let l=t&&t.value;if(!l||typeof l!=="object"||!("d"in l))return;return{data:l.d,at:Number(l.at)||0}},o=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,l){let g=u(t,l);return g?f(e.kept.peek(g)):void 0},restore(t,l){let g=u(t,l);return g?e.kept.load(g).then(f):Promise.resolve(void 0)},persist(t,l,g){let m=u(t,g);if(m)e.kept.set(m,{d:l,at:Date.now()})},overlay(t,l,g){let m=o();if(!m||!m.size)return l;let _=l;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return a.add(t),()=>{a.delete(t)}},cachedQuery(t,l){let g=d.get(t);if(g){if(l&&g.__options)g.__options(l);return g}let m=l||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,M=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let I=e.state(p.overlay(M(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),P=e.state(S?S.at:0),R=0,F=()=>{I.set(p.overlay(M(),n))},z=(b)=>{let w=R;p.restore(t,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!S)z(E);let _t=()=>{let b=k();if(b===E)return;E=b,R++,x=0,q.set(!1),U.set(!1),c=0;let w=p.seed(t,E);if(n=w?w.data:_,P.set(w?w.at:0),F(),!w)z(E)},xt=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,V=new Promise((D,j)=>{O=setTimeout(()=>{if(C)C.abort();j(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let D=m.fetch||((L,H)=>fetch(L,H)),j={method:"GET",headers:{Accept:"application/json"}};if(b)j.cache="no-cache";if(C)j.signal=C.signal;A=D(w,j).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,V]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(x++,q.set(!0),c===0&&!P())U.set(!0);let V=()=>{if(w!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return xt(b,T).then((A)=>{if(w!==R||T!==N())return V(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(t,A,E),F(),V(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return V(),I()})},O=`${w} ${T||""}`;return b?v.fresh(O,C):v.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return t},load(b){if(_t(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(t,n,E),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(a.add({target:M,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(M(),n,b.id),c=0,G(!0);F()}}),d.set(t,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(t)=>{let l=t.detail||{};if(l.kind!=="api"||typeof l.url!=="string")return;a.forEach((g)=>{if(i(l.url,g.target()))g.updated()})}),h.addEventListener("stx:outbox",(t)=>{let l=t.detail||{},g=l.sent&&typeof l.sent.id==="string"?l.sent:null;a.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>i(N,k)))return}m.outbox(g)})});return p}function te(e){let s=e&&e.covers||((r,u)=>Object.is(r,u)),i=[],a=[],d=0,y=(r,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let o={key:r,promise:f};i.push(o);let p=()=>{let h=i.indexOf(o);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(r,u){for(let f of i)if(s(f.key,r))return f.promise;for(let f of a)if(s(f.key,r))return f.promise;return y(r,u)},fresh(r,u){for(let h of a)if(s(h.key,r))return h.promise;let f=i.filter((h)=>s(h.key,r)).map((h)=>h.promise);if(!f.length)return y(r,u);let o={key:r,promise:null},p=()=>{};return o.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=a.indexOf(o);if(h!==-1)a.splice(h,1);return y(r,u)}),a.push(o),o.promise},latest(){let r=++d;return()=>r===d},get busy(){return i.length>0||a.length>0}}}function ne(e){let s=!1,i=null,a=null,d=0;async function y(){if(s)return;i=new AbortController;try{let r=await e.request(e.endpoint,{signal:i.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!r.ok||!r.body||!r.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(s){await r.body.cancel();return}let u=r.body.getReader(),f=new TextDecoder,o="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!s){let{done:p,value:h}=await u.read();if(p)break;if(o+=f.decode(h,{stream:!0}).replace(/\r\n/g,`
3
3
  `),o.length>1048576)throw Error("Broadcast frame too large");let t;while((t=o.indexOf(`
4
4
 
5
5
  `))!==-1){let l=o.slice(0,t);o=o.slice(t+2);let g=l.split(`
@@ -3263,11 +3263,13 @@ else if (immediate) {
3263
3263
  if (isTemplate) {
3264
3264
  templateContent = el.content;
3265
3265
  deferRowConditionals(templateContent);
3266
+ shareHeavyRowBranches(templateContent);
3266
3267
  }
3267
3268
  else {
3268
3269
  // Before the source is cloned into the row template, so that clone does
3269
3270
  // not build the conditional elements either.
3270
3271
  deferRowConditionals(el);
3272
+ shareHeavyRowBranches(el);
3271
3273
  const wrapper = stxHost.clone(el);
3272
3274
  wrapper.removeAttribute('@for');
3273
3275
  wrapper.removeAttribute(':for');
@@ -5316,6 +5318,8 @@ else if (!value && isInserted) {
5316
5318
  detachedBranches.add(resume);
5317
5319
  return;
5318
5320
  }
5321
+ // A row's heavy branch is an empty element until it is first shown.
5322
+ materializeLazyBranch(el);
5319
5323
  var childScope = layerTemplateScopes(globalHelpers, capturedComponentScope, (capturedElementScope || {}));
5320
5324
  // A false single-element conditional is detached before the
5321
5325
  // DOMContentLoaded component-scope pass. When it becomes visible,
@@ -5796,6 +5800,72 @@ else if (!value && isInserted) {
5796
5800
  holder.content.appendChild(el);
5797
5801
  }
5798
5802
  }
5803
+
5804
+ // A conditional branch that holds a COMPONENT is the heaviest thing a row can
5805
+ // carry and the one a row almost never shows: an inline editor for the one
5806
+ // row that is open. Cloned into every row only to be parked by :if, a 200-line
5807
+ // editor was a third of the time it took to draw a list, twice over (the
5808
+ // clone, then the walk that gives each cloned component its own scope id).
5809
+ // deferRowConditionals cannot take it (it holds a setup script, and a
5810
+ // <template> in a row is cloned with its content all the same), so the row
5811
+ // template keeps an EMPTY element with the same condition and the branch
5812
+ // lives once, here. bindIf fills the element from it the first time the
5813
+ // condition holds (materializeLazyBranch), as it would have been cloned.
5814
+ var __stxLazyBranches = new Map();
5815
+ var __stxLazyCounter = 0;
5816
+ function shareHeavyRowBranches(root) {
5817
+ if (stxHost.isNative || !root || !root.querySelectorAll || typeof document === 'undefined' || !document.createDocumentFragment) return;
5818
+ var candidates = Array.prototype.slice.call(root.querySelectorAll('[data-stx-scope]'));
5819
+ if (!candidates.length) return;
5820
+ var branches = [];
5821
+ candidates.forEach(function(component) {
5822
+ for (var el = component.parentElement; el; el = el.parentElement) {
5823
+ if (el.tagName === 'TEMPLATE') return;
5824
+ var attr = null;
5825
+ for (var a = 0; a < IF_ATTRS.length; a++) {
5826
+ if (el.hasAttribute(IF_ATTRS[a])) { attr = IF_ATTRS[a]; break; }
5827
+ }
5828
+ if (attr) {
5829
+ if (branches.indexOf(el) === -1 && eligibleHeavyBranch(el)) branches.push(el);
5830
+ return;
5831
+ }
5832
+ if (!root.contains(el)) return;
5833
+ }
5834
+ });
5835
+ branches.forEach(function(el) {
5836
+ // An outer candidate already took this one's children with it.
5837
+ if (!root.contains(el)) return;
5838
+ var holder = document.createDocumentFragment();
5839
+ while (el.firstChild) holder.appendChild(el.firstChild);
5840
+ var id = 'lz' + (++__stxLazyCounter);
5841
+ __stxLazyBranches.set(id, Array.prototype.slice.call(holder.childNodes));
5842
+ el.__stx_lazy_holder = holder;
5843
+ el.setAttribute('data-stx-lazy', id);
5844
+ });
5845
+ }
5846
+ function eligibleHeavyBranch(el) {
5847
+ for (var f = 0; f < FOR_ATTRS.length; f++) {
5848
+ if (el.hasAttribute(FOR_ATTRS[f])) return false;
5849
+ }
5850
+ if (getElseAttrInfo(el)) return false;
5851
+ var next = el.nextElementSibling;
5852
+ if (next && (getElseAttrInfo(next) || next.tagName === 'SCRIPT')) return false;
5853
+ if (el.hasAttribute('data-stx-scope') || el.hasAttribute('x-data')) return false;
5854
+ return true;
5855
+ }
5856
+ // Fill a row's empty conditional element with a copy of its branch, with the
5857
+ // component ids of THIS copy, before the branch is hydrated and bound.
5858
+ function materializeLazyBranch(el) {
5859
+ var id = el.getAttribute && el.getAttribute('data-stx-lazy');
5860
+ if (!id) return;
5861
+ el.removeAttribute('data-stx-lazy');
5862
+ var source = __stxLazyBranches.get(id);
5863
+ if (!source) return;
5864
+ var fragment = document.createDocumentFragment();
5865
+ source.forEach(function(node) { fragment.appendChild(stxHost.clone(node)); });
5866
+ el.appendChild(fragment);
5867
+ remapForComponentScopes([el]);
5868
+ }
5799
5869
  `;var Be=` // A loop row binds in its own iteration scope, and only its loop puts it
5800
5870
  // there. A walk from further out (an enclosing :if hydrating the branch it
5801
5871
  // shows) carries no item, so it used to bind whatever in the row was still
@@ -6351,7 +6421,7 @@ else {
6351
6421
  else {
6352
6422
  doMount();
6353
6423
  }
6354
- }`;var We=` // ==========================================================================
6424
+ }`;var ze=` // ==========================================================================
6355
6425
  // Navigation API
6356
6426
  // ==========================================================================
6357
6427
 
@@ -6551,7 +6621,7 @@ else {
6551
6621
  }
6552
6622
  };
6553
6623
  }
6554
- `;var ze=` // ==========================================================================
6624
+ `;var We=` // ==========================================================================
6555
6625
  // Optimistic State (useOptimistic) \u2014 stacksjs/stx#1742
6556
6626
  // ==========================================================================
6557
6627
  // Mirrors signals-api.ts useOptimistic. Shows base + pending actions while an
@@ -10765,9 +10835,9 @@ ${He}
10765
10835
  ${wt}
10766
10836
  ${Ae(X.toString(),Q.toString())}
10767
10837
  ${ot}
10768
- ${We}
10769
- ${Qe}
10770
10838
  ${ze}
10839
+ ${Qe}
10840
+ ${We}
10771
10841
  // ==========================================================================
10772
10842
  // Template Binding
10773
10843
  // ==========================================================================
@@ -10780,7 +10850,7 @@ ${se}
10780
10850
  ${ue}
10781
10851
  ${me}
10782
10852
  ${Ke}
10783
- ${tt(dl(),pl(),ul())}
10853
+ ${tt(pl(),fl(),dl())}
10784
10854
 
10785
10855
  ${ft}
10786
10856
  ${it}
@@ -10807,7 +10877,7 @@ var useBroadcastStream = ${ne.toString()};
10807
10877
 
10808
10878
  ${Ve(J.toString(),Y.toString(),ee.toString(),Z.toString(),te.toString())}
10809
10879
  ${ve}
10810
- ${oe(z.toString())}
10880
+ ${oe(W.toString())}
10811
10881
  ${Re}
10812
10882
  ${yt}
10813
10883
 
@@ -10833,5 +10903,5 @@ ${lt}
10833
10903
  ${ct}
10834
10904
  ${at}
10835
10905
  })();
10836
- `}var rh={state:le,derived:Hn,effect:Vn,batch:ho,onMount:Kr,onDestroy:Xr,isSignal:Un,isDerived:Wn,untrack:yo,peek:Gr,generateSignalsRuntime:mt,generateSignalsRuntimeDev:zn};
10837
- export{mt,zn,rh};
10906
+ `}var oh={state:le,derived:Hn,effect:Vn,batch:yo,onMount:Xr,onDestroy:Gr,isSignal:Un,isDerived:Wn,untrack:bo,peek:Jr,generateSignalsRuntime:mt,generateSignalsRuntimeDev:zn};
10907
+ export{mt,zn,oh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{sn,To,$o,Ro,wh,Ao}from"./chunk-edetp97r.js";import"./chunk-bwzjjxnj.js";import"./chunk-z1br7qeb.js";import"./chunk-p1mbbdwj.js";export{$o as buildServerApi,wh as createServerApi,sn as discoverServerApi,To as generateApiTypes,Ao as isServerApiSource,Ro as productionApiDispatcher};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{jr}from"./chunk-krdc3c87.js";import{existsSync as m,statSync as x}from"fs";import s from"path";var g=new Map;function M(r){let n=s.extname(r);if(n===".tsx")return"tsx";if(n===".jsx")return"jsx";if(n===".ts"||n===".mts"||n===".cts")return"ts";return"js"}async function j(r,n){let l=Object.entries(n).map(([e,t])=>[s.resolve(r,e),s.resolve(r,t)]),d=l.map(([e,t])=>{try{return`${e}\x00${t}\x00${x(t).mtimeMs}`}catch{return`${e}\x00${t}\x00-`}}).join(`
3
+ `),f=`${r}\x00${JSON.stringify(n)}`,o=g.get(f);if(o&&o.signature===d)return o.standIns;let a=new Map;for(let[e,t]of l){let c=s.relative(r,e);if(!m(e))throw Error(`webModules: ${c} does not exist`);if(!m(t))throw Error(`webModules: ${s.relative(r,t)}, the stand-in for ${c}, does not exist`);if(e===t)throw Error(`webModules: ${c} stands in for itself`);let p=await Bun.file(t).text(),u=new Bun.Transpiler({loader:M(t),target:"browser"});if(s.dirname(t)!==s.dirname(e)){let i=u.scanImports(p).find((h)=>/^\.\.?\//.test(h.path));if(i)throw Error(`webModules: ${s.relative(r,t)} imports ${i.path}, which would resolve from ${s.relative(r,s.dirname(e))||"."}; a stand-in imports relatively only from the directory of the module it replaces`)}let w=u.transformSync(p);for(let i of jr(e))a.set(i,w)}return g.set(f,{signature:d,standIns:a}),a}export{j as loadWebModules};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{W,Ne}from"./chunk-qv2k0qb1.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Zt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
2
+ import{W,Ne}from"./chunk-s8p958da.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function Zt(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Ne(t,s);if(p>s){c=p;continue}let a=W(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
3
3
  export{Zt};
@@ -298,5 +298,5 @@ catch (error) {
298
298
  init();
299
299
  }
300
300
  })();
301
- </script>`}var vg={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},xg={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Sg={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},kg={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},Ys=[vg,xg,Sg,kg];function oy(t){return[...t,...Ys]}
302
- export{vg,xg,Sg,kg,Ys,oy};
301
+ </script>`}var Sg={name:"pwa.installButton",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return r(t,n)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},kg={name:"pwa.updatePrompt",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return p(t,n)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},_g={name:"pwa.offlineIndicator",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return d(t,n)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Cg={name:"pwa.pushSubscribe",handler:(t,i,e,a)=>{let n=e.__stx_options||{};return l(t,n)},hasEndTag:!0,description:"Renders a push notification subscription button"},Zs=[Sg,kg,_g,Cg];function ay(t){return[...t,...Zs]}
302
+ export{Sg,kg,_g,Cg,Zs,ay};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- function ac(){return`
2
+ function cc(){return`
3
3
  (function(){
4
4
  var tip=null,hideTimer=null,currentEl=null;
5
5
 
@@ -103,4 +103,4 @@ document.addEventListener("focusout",function(e){
103
103
  });
104
104
  })();
105
105
  `}
106
- export{ac};
106
+ export{cc};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ys,zt,bl,xg}from"./chunk-x148cxrj.js";export{Ys as generateServiceWorker,xg as generateServiceWorkerAuto,zt as getServiceWorkerFileName,bl as isWorkboxEnabled};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-07c8rk93.js";import"./chunk-4833k99b.js";import{b,x,C,Y}from"./chunk-qv2k0qb1.js";import"./chunk-1w4a0xya.js";import"./chunk-1g5fg1ys.js";import"./chunk-t8cgxk8w.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-yzbdm457.js";import"./chunk-4833k99b.js";import{b,x,C,Y}from"./chunk-s8p958da.js";import"./chunk-5s2dwh5z.js";import"./chunk-p1mbbdwj.js";import"./chunk-392rrp28.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,S=b(64),w=new Set,k=0,R=new Set(h);function T(){l.clear(),S.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=x(n,k),r=S.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(w.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),S.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Y({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function Ka(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function Xa(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
2
+ import y from"fs";import R from"path";var S="_stx";function F(e){return Bun.hash(e).toString(16).slice(0,8)}function k(e){let t=[],n=(i)=>{for(let s of y.readdirSync(i,{withFileTypes:!0})){let r=R.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(y.existsSync(e))n(e);return t}var z=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-css=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"css",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-css="generated" rel="stylesheet" href="${e}">`}];function I(e,t=`/${S}`){let n=[],i=new Set,s=0,r=e;for(let o of z)r=r.replace(o.pattern,(g,u,c)=>{if(/\b(?:src|href)\s*=/.test(u)||!c.trim())return g;let a=`${o.prefix}.${F(c)}.${o.extension}`;if(!i.has(a))i.add(a),n.push({filename:a,contents:c,contentType:o.contentType});return s+=c.length,o.replace(`${t}/${a}`)});return{html:r,assets:n,bytesInlined:s}}function Xa(e){let t={pages:0,assets:0,bytesInlined:0},n=R.join(e,S),i=new Set;for(let s of k(e)){let r=y.readFileSync(s,"utf8"),{html:o,assets:g,bytesInlined:u}=I(r);if(o===r)continue;for(let c of g){if(i.has(c.filename))continue;i.add(c.filename),y.mkdirSync(n,{recursive:!0}),y.writeFileSync(R.join(n,c.filename),c.contents),t.assets++}y.writeFileSync(s,o),t.bytesInlined+=u,t.pages++}return t}import h from"fs";import T from"path";var L=1024,N=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,_=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function B(e){return Bun.hash(e).toString(16).slice(0,8)}function C(e){let t=[],n=(i)=>{for(let s of h.readdirSync(i,{withFileTypes:!0})){let r=T.join(i,s.name);if(s.isDirectory())n(r);else if(s.isFile()&&r.endsWith(".html"))t.push(r)}};if(h.existsSync(e))n(e);return t}function O(e,t){let n=e.match(new RegExp(`\\b${t}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!n)return;return n[2]??n[3]??n[4]??""}function H(e,t,n){if(n.length<L)return!1;if(/\b(?:src|href)\s*=/i.test(t))return!1;if(e.toLowerCase()==="script"){if(!_.has((O(t,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function D(e){let t=[];for(let n of e.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))t.push([n.index,n.index+n[0].length]);return t}function Ga(e){let t={pages:0,assets:0,bytesInlined:0},n=C(e);if(n.length<2)return t;let i=new Map,s=new Map;for(let a of n){let f=h.readFileSync(a,"utf8");i.set(a,f);let M=D(f);for(let d of f.matchAll(N)){let[x,p,l,m]=d;if(!H(p,l,m))continue;if(M.some(([j,A])=>d.index>=j&&d.index<A))continue;let w=`${p.toLowerCase()}\x00${m}`,b=s.get(w);if(b)b.push({file:a,whole:x,tag:p,attrs:l,body:m});else s.set(w,[{file:a,whole:x,tag:p,attrs:l,body:m}])}}let r=[...s.values()].filter((a)=>new Set(a.map((f)=>f.file)).size>1);if(r.length===0)return t;let o=T.join(e,S),g=new Map(i),u=new Map,c=[];for(let a of r){let{tag:f,body:M}=a[0],d=f.toLowerCase()==="script",x=`${d?"chunk":"style"}.${B(M)}.${d?"js":"css"}`;c.push({filename:x,contents:M,contentType:d?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let p=`/${S}/${x}`;for(let l of a){let m=d?`<script${l.attrs} src="${p}"></script>`:`<link${l.attrs} rel="stylesheet" href="${p}">`,w=g.get(l.file),b=w.replace(l.whole,()=>m);if(b===w)continue;g.set(l.file,b),u.set(l.file,(u.get(l.file)??0)+l.body.length)}}h.mkdirSync(o,{recursive:!0});for(let a of c)h.writeFileSync(T.join(o,a.filename),a.contents),t.assets++;for(let[a,f]of g){if(f===i.get(a))continue;h.writeFileSync(a,f),t.pages++,t.bytesInlined+=u.get(a)??0}return t}import E from"fs";import v from"path";var K="layout-types.d.ts";function P(e){let t=[],n=(i,s)=>{let r;try{r=E.readdirSync(i,{withFileTypes:!0})}catch{return}for(let o of r){if(o.name.startsWith("."))continue;let g=v.join(i,o.name);if(o.isDirectory())n(g,s?`${s}/${o.name}`:o.name);else if(o.isFile()&&o.name.endsWith(".stx")&&o.name!=="_layout.stx"){let u=o.name.slice(0,-4);t.push(s?`${s}/${u}`:u)}}};return n(e,""),t.sort()}function W(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
3
3
  `);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((n)=>` '${n}': true`)," }","}","","export {}",""),t.join(`
4
- `)}function Ga(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
5
- export{Ka,Xa,Ga};
4
+ `)}function Ja(e,t){if(!e)return[];let n=v.isAbsolute(e)?e:v.resolve(process.cwd(),e),i=P(n),s=W(i),r=v.join(t,K);try{if(E.existsSync(r)&&E.readFileSync(r,"utf8")===s)return i;E.mkdirSync(t,{recursive:!0}),E.writeFileSync(r,s)}catch{}return i}
5
+ export{Xa,Ga,Ja};