@stacksjs/stx 0.2.833 → 0.2.834

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 (172) hide show
  1. package/dist/builtins/image-worker.js +6 -1
  2. package/dist/{chunk-vb4xzz5c.js → chunk-0a36jnq4.js} +1 -1
  3. package/dist/chunk-0c8fqfan.js +3 -0
  4. package/dist/{chunk-3sqay5jm.js → chunk-0mb3jch4.js} +3 -3
  5. package/dist/{chunk-qym44qqd.js → chunk-0mrzdsh5.js} +4 -4
  6. package/dist/chunk-0rnfywsx.js +2 -0
  7. package/dist/chunk-0z7w8e0s.js +2 -0
  8. package/dist/{chunk-y34ayg61.js → chunk-1qgzexkc.js} +42 -40
  9. package/dist/{chunk-mxvevxb8.js → chunk-29f6vmyz.js} +4 -4
  10. package/dist/{chunk-jp6sbk05.js → chunk-2nxxhcyy.js} +1 -1
  11. package/dist/{chunk-xdwnbr9b.js → chunk-33czswpt.js} +2 -2
  12. package/dist/{chunk-ekh3mxyp.js → chunk-3bjnrmha.js} +2 -2
  13. package/dist/chunk-3f1ks1ah.js +2 -0
  14. package/dist/{chunk-6qbatp72.js → chunk-3tn9tb9w.js} +5 -5
  15. package/dist/{chunk-g0vz0ch5.js → chunk-3w8kt53x.js} +7 -7
  16. package/dist/chunk-4f2zy3y6.js +2 -0
  17. package/dist/{chunk-fby81k5g.js → chunk-4g6v5qsp.js} +2 -2
  18. package/dist/{chunk-04z1xyrb.js → chunk-4ntm3dtk.js} +2 -2
  19. package/dist/chunk-523s4p08.js +2 -0
  20. package/dist/{chunk-mypygxdm.js → chunk-52g026sc.js} +2 -2
  21. package/dist/{chunk-716jrdcg.js → chunk-52t0qpx6.js} +1 -1
  22. package/dist/{chunk-z58dr234.js → chunk-5379q74v.js} +1 -1
  23. package/dist/{chunk-4a3r1kh1.js → chunk-55e46spy.js} +2 -2
  24. package/dist/{chunk-gy59sm92.js → chunk-55k7m9cp.js} +2 -2
  25. package/dist/chunk-5gqjhq31.js +2 -0
  26. package/dist/chunk-6j2aea05.js +2 -0
  27. package/dist/{chunk-yrw5ensv.js → chunk-7bvvv74e.js} +2 -2
  28. package/dist/chunk-7efkc3gk.js +2 -0
  29. package/dist/{chunk-m6q2vedz.js → chunk-7h5rt22w.js} +4 -4
  30. package/dist/{chunk-5201w0f1.js → chunk-84nw3921.js} +3 -3
  31. package/dist/chunk-913grzaj.js +2 -0
  32. package/dist/chunk-99ddfv0b.js +2 -0
  33. package/dist/{chunk-7nnep25t.js → chunk-9n14m2gn.js} +5 -5
  34. package/dist/chunk-9w3r1ch2.js +3 -0
  35. package/dist/chunk-a1hxz8q4.js +2 -0
  36. package/dist/{chunk-wt7qhv5b.js → chunk-a579jdwb.js} +1 -1
  37. package/dist/{chunk-7p8m82pj.js → chunk-amg6kr1p.js} +2 -2
  38. package/dist/{chunk-cfqz4bd6.js → chunk-b0z85f8h.js} +1 -1
  39. package/dist/chunk-b3s8tb18.js +2 -0
  40. package/dist/{chunk-67nq6csk.js → chunk-bc4x45vx.js} +1 -1
  41. package/dist/{chunk-3p7r3ajd.js → chunk-bky02g7k.js} +2 -2
  42. package/dist/chunk-brk1pk8w.js +2 -0
  43. package/dist/{chunk-hd378dgy.js → chunk-c3dg8qdn.js} +2 -2
  44. package/dist/{chunk-cca18z35.js → chunk-c9vxm8yq.js} +8 -8
  45. package/dist/{chunk-g00nhj1d.js → chunk-cddzcckm.js} +7 -7
  46. package/dist/chunk-cy3c4yxg.js +2 -0
  47. package/dist/chunk-db7p6bc4.js +2 -0
  48. package/dist/{chunk-1b1crd5a.js → chunk-ddtk57fy.js} +4 -4
  49. package/dist/{chunk-95d5qy7d.js → chunk-dgqp0pjn.js} +2 -2
  50. package/dist/{chunk-gcf97wgx.js → chunk-dv11h4f0.js} +1 -1
  51. package/dist/{chunk-yd1j88kp.js → chunk-dvyysszs.js} +6 -6
  52. package/dist/chunk-e7ssdryq.js +2 -0
  53. package/dist/{chunk-a395a3dt.js → chunk-ecmvq302.js} +8 -8
  54. package/dist/chunk-ee147ezb.js +2 -0
  55. package/dist/chunk-f6vzn90z.js +2 -0
  56. package/dist/chunk-fc5zj6qg.js +2 -0
  57. package/dist/{chunk-wr7bmkne.js → chunk-fvgk1w9s.js} +2 -2
  58. package/dist/{chunk-hfktzsat.js → chunk-g3xbwz51.js} +1 -1
  59. package/dist/chunk-g5jfb1ms.js +2 -0
  60. package/dist/{chunk-6b1g5a6a.js → chunk-ga2k1rga.js} +11 -11
  61. package/dist/{chunk-cv1zc9dg.js → chunk-gh62p9mx.js} +2 -2
  62. package/dist/{chunk-4xw22xqd.js → chunk-gnt1v0kc.js} +6 -6
  63. package/dist/chunk-gtj8wy95.js +2 -0
  64. package/dist/{chunk-wb6w807m.js → chunk-h4tbpr7p.js} +1 -1
  65. package/dist/chunk-j0w048sj.js +2 -0
  66. package/dist/chunk-jmk1ze6r.js +2 -0
  67. package/dist/{chunk-t59bc7na.js → chunk-jr0r5pzw.js} +2 -2
  68. package/dist/{chunk-r2fwxtke.js → chunk-k46pfdmn.js} +1 -1
  69. package/dist/chunk-k4hjqfx1.js +2 -0
  70. package/dist/chunk-k761q7s7.js +2 -0
  71. package/dist/{chunk-1vzncfka.js → chunk-kw5gra2z.js} +2 -2
  72. package/dist/chunk-kzvt88tk.js +2 -0
  73. package/dist/chunk-mdtysd2d.js +2 -0
  74. package/dist/{chunk-rkdsgfhd.js → chunk-ms3v5nat.js} +6 -6
  75. package/dist/{chunk-ba499a3p.js → chunk-mya2g8sn.js} +1 -1
  76. package/dist/{chunk-f6b7av6b.js → chunk-n4qznmkm.js} +5 -5
  77. package/dist/{chunk-m9bbhg46.js → chunk-nmtya57z.js} +2 -2
  78. package/dist/chunk-npn692c4.js +42 -0
  79. package/dist/{chunk-02zvytqx.js → chunk-nxfyjw59.js} +1 -1
  80. package/dist/{chunk-xn9jg1q5.js → chunk-nyg0nbjj.js} +1 -1
  81. package/dist/chunk-pt8nft3k.js +2 -0
  82. package/dist/chunk-pwv77cyb.js +2 -0
  83. package/dist/chunk-q1cfc2fp.js +2 -0
  84. package/dist/{chunk-qy6dtm1a.js → chunk-q46ay7aq.js} +4 -4
  85. package/dist/{chunk-38wq4ttd.js → chunk-qbvy23qa.js} +95 -95
  86. package/dist/{chunk-xdqv5yq4.js → chunk-qdagsy5b.js} +2 -2
  87. package/dist/{chunk-s67pnfvz.js → chunk-qfcabz87.js} +4 -4
  88. package/dist/{chunk-qws72sn9.js → chunk-rfdwn0k3.js} +32 -32
  89. package/dist/{chunk-wvds0s9m.js → chunk-rnm8ejpz.js} +2 -2
  90. package/dist/{chunk-a9d14beh.js → chunk-rtj900pa.js} +1 -1
  91. package/dist/{chunk-c84pxd2k.js → chunk-s33andzg.js} +2 -2
  92. package/dist/{chunk-4z0jpzdq.js → chunk-s3j5vxy9.js} +2 -2
  93. package/dist/{chunk-8y8kgw9s.js → chunk-s6r54dyf.js} +2 -2
  94. package/dist/{chunk-c6gr71fg.js → chunk-srb0qmgx.js} +1 -1
  95. package/dist/{chunk-a7j451hn.js → chunk-srqk1nxc.js} +2 -2
  96. package/dist/{chunk-vhehb6eh.js → chunk-t33fttx9.js} +1 -1
  97. package/dist/chunk-t612xpa4.js +2 -0
  98. package/dist/{chunk-g4qzy5hv.js → chunk-tesbhpbp.js} +1 -1
  99. package/dist/{chunk-m9dj8pgb.js → chunk-tvw571ab.js} +1 -1
  100. package/dist/{chunk-6k26n0sj.js → chunk-tx8wk6h7.js} +2 -2
  101. package/dist/{chunk-c9mdvpf5.js → chunk-txd2js5v.js} +10 -10
  102. package/dist/chunk-v1wgp7ep.js +2 -0
  103. package/dist/{chunk-qnrgfm9v.js → chunk-v3xyb3ws.js} +2 -2
  104. package/dist/{chunk-w7m9pecb.js → chunk-v4kenb7z.js} +5 -5
  105. package/dist/chunk-v53kdjz6.js +2 -0
  106. package/dist/{chunk-2qngyyaz.js → chunk-vfj9wp11.js} +2 -2
  107. package/dist/{chunk-nfpsaaqm.js → chunk-vfxkn1pe.js} +3 -3
  108. package/dist/{chunk-tchz2m2v.js → chunk-vnk6gt0t.js} +1 -1
  109. package/dist/chunk-vqpypnys.js +2 -0
  110. package/dist/{chunk-1c62mrad.js → chunk-x57x0yq7.js} +5 -5
  111. package/dist/{chunk-3grrmmrg.js → chunk-xd9t20sx.js} +1 -1
  112. package/dist/{chunk-dzm9g76x.js → chunk-xqy8y5dc.js} +1 -1
  113. package/dist/{chunk-6tjm38e4.js → chunk-xtqapjz3.js} +1 -1
  114. package/dist/{chunk-6kk8p766.js → chunk-xvmn976f.js} +1 -1
  115. package/dist/chunk-xxyhzsqx.js +2 -0
  116. package/dist/{chunk-bgqbvf1w.js → chunk-y47n1j5x.js} +6 -6
  117. package/dist/{chunk-qadce16v.js → chunk-ya6bp08c.js} +1 -1
  118. package/dist/{chunk-zvvv6x8c.js → chunk-yw1s8kyj.js} +3 -3
  119. package/dist/{chunk-rmygv0n0.js → chunk-z0ynyz62.js} +4 -4
  120. package/dist/chunk-z2e06633.js +2 -0
  121. package/dist/{chunk-kn3pknzt.js → chunk-zb7kfwac.js} +3 -3
  122. package/dist/chunk-zsdqsky6.js +2 -0
  123. package/dist/cli.js +13 -13
  124. package/dist/craft-entry.js +2 -2
  125. package/dist/craft.js +2 -2
  126. package/dist/document-styles.d.ts +7 -0
  127. package/dist/document-styles.js +40 -0
  128. package/dist/html-masking.js +6 -3
  129. package/dist/process.js +3 -0
  130. package/dist/pwa.js +3 -3
  131. package/dist/ssg.js +4 -4
  132. package/package.json +1 -1
  133. package/dist/chunk-09fbj9b4.js +0 -2
  134. package/dist/chunk-17h13201.js +0 -2
  135. package/dist/chunk-17zrprh0.js +0 -2
  136. package/dist/chunk-28z6pq6w.js +0 -42
  137. package/dist/chunk-293fnyc2.js +0 -2
  138. package/dist/chunk-42c92rp3.js +0 -2
  139. package/dist/chunk-437wgphe.js +0 -2
  140. package/dist/chunk-46yyc2sf.js +0 -2
  141. package/dist/chunk-503ppv77.js +0 -2
  142. package/dist/chunk-5e7abvtz.js +0 -2
  143. package/dist/chunk-6r4teng3.js +0 -2
  144. package/dist/chunk-7b105hww.js +0 -2
  145. package/dist/chunk-83hwrh5n.js +0 -2
  146. package/dist/chunk-8n8vj099.js +0 -2
  147. package/dist/chunk-9jvpyq5h.js +0 -2
  148. package/dist/chunk-abh791bh.js +0 -2
  149. package/dist/chunk-aqjcqnex.js +0 -2
  150. package/dist/chunk-awd0dvjb.js +0 -2
  151. package/dist/chunk-b39g02k9.js +0 -2
  152. package/dist/chunk-e7yejx6x.js +0 -2
  153. package/dist/chunk-f8g0sgs0.js +0 -2
  154. package/dist/chunk-fb90n0by.js +0 -2
  155. package/dist/chunk-ggnzezrn.js +0 -2
  156. package/dist/chunk-jny0vbmt.js +0 -2
  157. package/dist/chunk-k6ye0159.js +0 -3
  158. package/dist/chunk-kgn911k7.js +0 -2
  159. package/dist/chunk-kr6x19z0.js +0 -2
  160. package/dist/chunk-kshem79d.js +0 -2
  161. package/dist/chunk-ns23fv15.js +0 -3
  162. package/dist/chunk-pc4xah5j.js +0 -2
  163. package/dist/chunk-q2tbbtqn.js +0 -2
  164. package/dist/chunk-qg2tpvdw.js +0 -2
  165. package/dist/chunk-shzkz2az.js +0 -2
  166. package/dist/chunk-v1mwhvf8.js +0 -2
  167. package/dist/chunk-vce1js6z.js +0 -2
  168. package/dist/chunk-vhmzkhy4.js +0 -2
  169. package/dist/chunk-wpyhavjy.js +0 -2
  170. package/dist/chunk-zt74q4c8.js +0 -2
  171. package/dist/chunk-zty254tw.js +0 -2
  172. package/dist/chunk-zy41xhc4.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function yo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Nn(i={}){yo(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
- export{yo,Nn};
2
+ function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function bo(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Mn(i={}){bo(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
3
+ export{bo,Mn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import"./chunk-c9mdvpf5.js";import"./chunk-04z1xyrb.js";import"./chunk-8y8kgw9s.js";import"./chunk-38wq4ttd.js";import"./chunk-2qngyyaz.js";import"./chunk-xdqv5yq4.js";import"./chunk-cv1zc9dg.js";import"./chunk-a7j451hn.js";import{c}from"./chunk-k6ye0159.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
2
+ import"./chunk-txd2js5v.js";import"./chunk-4ntm3dtk.js";import"./chunk-s6r54dyf.js";import"./chunk-qbvy23qa.js";import"./chunk-vfj9wp11.js";import"./chunk-qdagsy5b.js";import"./chunk-gh62p9mx.js";import"./chunk-srqk1nxc.js";import{c}from"./chunk-9w3r1ch2.js";import u from"fs";import l from"path";async function d(e,t={}){let s=Date.now(),n={total:0,passed:0,failed:0,new:0,failures:[],duration:0},i=t.snapshotDir||c(e.root,"story","snapshots");await u.promises.mkdir(i,{recursive:!0});let r=e.storyFiles;if(t.filter&&t.filter.length>0)r=r.filter((a)=>t.filter.some((o)=>a.fileName.toLowerCase().includes(o.toLowerCase())));for(let a of r)await h(a,i,t,n);return n.duration=Date.now()-s,n}async function h(e,t,s,n){let i=e.story;if(!i)return;for(let r of i.variants){n.total++;let a=l.join(t,`${e.id}-${r.id}.snap`),o=g(r.source||""),f=await w(a);if(s.update||!f){let p={storyId:e.id,variantId:r.id,component:e.fileName,timestamp:Date.now(),hash:o};if(await u.promises.writeFile(a,JSON.stringify(p,null,2)),!f)n.new++;n.passed++}else try{let p=await u.promises.readFile(a,"utf-8"),m=JSON.parse(p);if(m.hash===o)n.passed++;else n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:"Snapshot mismatch",difference:y(m.hash,o)})}catch(p){n.failed++,n.failures.push({storyId:e.id,variantId:r.id,component:e.fileName,message:`Error reading snapshot: ${p}`})}}}async function x(e,t={}){return(await d(e,{...t,update:!0})).total}function g(e){let t=0;for(let s=0;s<e.length;s++){let n=e.charCodeAt(s);t=(t<<5)-t+n,t=t&t}return t.toString(16)}function y(e,t){if(e===t)return 0;let s=Math.abs(Number.parseInt(e,16)-Number.parseInt(t,16));return Math.min(s/1e6,1)}async function w(e){try{return await u.promises.access(e),!0}catch{return!1}}function F(e){let t=[];if(t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(" STX Story Visual Regression Tests"),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),e.failures.length>0){t.push(" \u274C Failures:"),t.push("");for(let s of e.failures){if(t.push(` \u2022 ${s.component} / ${s.variantId}`),t.push(` ${s.message}`),s.difference!==void 0)t.push(` Difference: ${(s.difference*100).toFixed(2)}%`);t.push("")}}if(t.push(" Summary:"),t.push(` Total: ${e.total}`),t.push(` Passed: ${e.passed} \u2713`),t.push(` Failed: ${e.failed} \u2717`),e.new>0)t.push(` New: ${e.new} \u26A1`);return t.push(` Time: ${e.duration}ms`),t.push(""),t.push("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"),t.push(""),t.join(`
3
3
  `)}export{F as formatTestResults,d as runVisualTests,x as updateSnapshots};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ta,$a,Ra,Aa,Ch}from"./chunk-ga2k1rga.js";import"./chunk-c9vxm8yq.js";import"./chunk-7h5rt22w.js";import"./chunk-s53wjw7y.js";import"./chunk-1qgzexkc.js";import"./chunk-y47n1j5x.js";import"./chunk-cddzcckm.js";import"./chunk-s33andzg.js";import"./chunk-npn692c4.js";import"./chunk-0c8fqfan.js";import"./chunk-zb7kfwac.js";import"./chunk-3bjnrmha.js";import"./chunk-3w8kt53x.js";import"./chunk-dvyysszs.js";import"./chunk-ya6bp08c.js";import"./chunk-4g6v5qsp.js";import"./chunk-ecmvq302.js";import"./chunk-srqk1nxc.js";import"./chunk-gh62p9mx.js";import"./chunk-amg6kr1p.js";import"./chunk-ms3v5nat.js";import"./chunk-29f6vmyz.js";import"./chunk-qbvy23qa.js";import"./chunk-qdagsy5b.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Ta as buildNative,Ch as default,$a as findCraftBinary,Aa as getAvailableFormats,Ra as getAvailableTargets};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Qr,es}from"./chunk-cca18z35.js";import{y}from"./chunk-38wq4ttd.js";import{a}from"./chunk-a395a3dt.js";import{Xe,se}from"./chunk-s53wjw7y.js";import{Ya}from"./chunk-m6q2vedz.js";import{B}from"./chunk-ybq56wam.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(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 mu=`
2
+ import{es,ts}from"./chunk-c9vxm8yq.js";import{y}from"./chunk-qbvy23qa.js";import{a}from"./chunk-ecmvq302.js";import{Xe,se}from"./chunk-s53wjw7y.js";import{Ya}from"./chunk-7h5rt22w.js";import{B}from"./chunk-ybq56wam.js";import{g}from"./chunk-0dve54ne.js";import{existsSync as z,mkdirSync as S,copyFileSync as P,chmodSync as I,rmSync as ve}from"fs";import{join as c,basename as xe,resolve as X}from"path";import{spawn as _}from"child_process";import{platform as ye}from"os";function O(e,r,i){let n=new RegExp(`</${r}\\s*>`,"iy"),s=y(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 mu=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -470,7 +470,7 @@ else if (data.type === 'event' && data.method) {
470
470
  </script>
471
471
  `;function ka(e={}){let{debug:r=!1,timeout:i=30000}=e;return mu.replace("debug: false,",`debug: ${r},`).replace("timeout: 30000",`timeout: ${i}`)}function xh(){return!1}function Sh(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 ka(t)})}function _a(e,r={}){if(e.includes("__craftBridgeInitialized"))return e;let i=ka(r),n=O(e,"head",`${i}
472
472
  `);if(n!==null)return n;let s=B(e);if(s){let t=s.index+s.tag.length;return e.slice(0,t)+`
473
- ${i}`+e.slice(t)}return i+e}var ko={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 _o={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 ko={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:te},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:re},"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||""}">`}},Zr=`
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:te},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:re},"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||""}">`}},Qr=`
488
488
  <style id="craft-component-styles">
489
489
  /* Craft Component Base Styles */
490
490
  .craft-button {
@@ -1006,9 +1006,9 @@ ${i}`+e.slice(t)}return i+e}var ko={button:{nativeType:"craft-button",fallbackTa
1006
1006
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
1007
1007
  })();
1008
1008
  </script>
1009
- `;function Ea(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${Zr}
1010
- `)??Zr+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Ca}
1011
- `)??e+Ca;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||ko[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(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=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function F(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 te(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(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},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=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=de(n,t,d);else if(s.length)m=s.map((v)=>L(v,d)).join("");else m=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
1009
+ `;function Ea(e,r={}){let{classPrefix:i="craft"}=r;if(!e.includes("craft-component-styles"))e=O(e,"head",`${Qr}
1010
+ `)??Qr+e;if(!e.includes("craft-component-runtime"))e=O(e,"body",`${Ca}
1011
+ `)??e+Ca;return e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(n,s,t)=>N("sidebar",s,t.trim(),r,i)),e=e.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(n,s)=>N("sidebar",s,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(n,s,t)=>N(s,t,"",r,i)),e=e.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(n,s,t,o)=>N(s,t,o.trim(),r,i)),e}function N(e,r,i,n,s){let t=n.components?.[e]||_o[e];if(!t)return console.warn(`[stx] Unknown Craft component: @craft-${e}`),`<div class="${s}-unknown" data-component="${e}">${i}</div>`;let o=F(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=ue(o,t,d);if(["input","hr","br","img"].includes(t.fallbackTag))return`<${t.fallbackTag} ${f}>`;return`<${t.fallbackTag} ${f}>${i}</${t.fallbackTag}>`}function F(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 te(e,r){let i=R(String(e.id||`craft-sidebar-${fe(r||JSON.stringify(e))}`)),n=ce(e.spaces)||oe(r),s=n.length?[]:le(e.sections)||j(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},p=String(e.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),l=Number(e.width||e.sidebarWidth||286),u=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=de(n,t,d);else if(s.length)m=s.map((v)=>L(v,d)).join("");else m=r;return`<aside class="${x(p)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${x(i)}" data-native="${u}" style="--craft-sidebar-width:${l}px">
1012
1012
  ${b}
1013
1013
  ${m}
1014
1014
  </aside>
@@ -1029,7 +1029,7 @@ ${i}`+e.slice(t)}return i+e}var ko={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 R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(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 pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(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 kh(e,r){ko[e]=r}function _h(){return{...ko}}import{chmodSync as be,copyFileSync as ge,mkdtempSync as V,rmSync as me,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as D}from"path";function we(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 he(e,r){let i=D(r,"Contents","embedded.provisionprofile");ge(e,i),be(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 p=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(p.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=we(p.stdout),u={};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.");u=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])u[b]=l[b];if(s=V(D(W(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");he(i.provisioningProfile,e)}let t;if(r.length){let p=!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.");p=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(W(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...p?{"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 p of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(p===e&&n)l.push("--entitlements",n);if(p!==e&&t)l.push("--entitlements",t);let u=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",u,...l,p],{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 ${p}: ${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)me(s,{recursive:!0,force:!0})}}var Y=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function G(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${Y(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",f=`${s} `,p=o?Array.from(n,(l,u)=>i(l,f,`${t}[${u}]`)):Object.entries(n).map(([l,u])=>`${f}<key>${Y(l)}</key>
1032
+ </button>`}function R(e){return e.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function fe(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 pe(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function ue(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 kh(e,r){_o[e]=r}function _h(){return{..._o}}import{chmodSync as be,copyFileSync as ge,mkdtempSync as V,rmSync as me,writeFileSync as J}from"fs";import{tmpdir as W}from"os";import{join as D}from"path";function we(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 he(e,r){let i=D(r,"Contents","embedded.provisionprofile");ge(e,i),be(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 p=Bun.spawnSync(["/usr/bin/security","cms","-D","-i",i.provisioningProfile]);if(p.exitCode!==0)throw Error("Could not decode the macOS provisioning profile.");let l=we(p.stdout),u={};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.");u=JSON.parse(b.stdout.toString())}for(let b of["com.apple.application-identifier","com.apple.developer.team-identifier"])if(l[b])u[b]=l[b];if(s=V(D(W(),"stx-entitlements-")),n=D(s,"entitlements.plist"),J(n,JSON.stringify(u)),Bun.spawnSync(["/usr/bin/plutil","-convert","xml1",n]).exitCode!==0)throw Error("Could not generate the provisioned app entitlements.");he(i.provisioningProfile,e)}let t;if(r.length){let p=!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.");p=JSON.parse(l.stdout.toString())["com.apple.security.app-sandbox"]===!0}if(s??=V(D(W(),"stx-entitlements-")),t=D(s,"helper.entitlements.plist"),J(t,JSON.stringify({"com.apple.security.cs.allow-jit":!0,...p?{"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 p of[...r,e]){let l=i.hardenedRuntime?["--options","runtime"]:[];if(p===e&&n)l.push("--entitlements",n);if(p!==e&&t)l.push("--entitlements",t);let u=i.identity&&i.identity!=="-"?"--timestamp":"--timestamp=none",b=Bun.spawn(["/usr/bin/codesign","--force","--sign",i.identity||"-",u,...l,p],{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 ${p}: ${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)me(s,{recursive:!0,force:!0})}}var Y=(e)=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function G(e){let r=new Set,i=(n,s,t)=>{if(typeof n==="string")return`${s}<string>${Y(n)}</string>`;if(typeof n==="boolean")return`${s}<${n}/>`;if(typeof n==="number"){if(!Number.isFinite(n))throw TypeError(`Non-finite Info.plist number at ${t}`);let o=Number.isSafeInteger(n)?"integer":"real";return`${s}<${o}>${n}</${o}>`}if(n!==null&&typeof n==="object"){let o=Array.isArray(n);if(!o&&Object.getPrototypeOf(n)!==Object.prototype&&Object.getPrototypeOf(n)!==null)throw TypeError(`Unsupported Info.plist value at ${t}`);if(r.has(n))throw TypeError(`Cyclic Info.plist value at ${t}`);r.add(n);try{let d=o?"array":"dict",f=`${s} `,p=o?Array.from(n,(l,u)=>i(l,f,`${t}[${u}]`)):Object.entries(n).map(([l,u])=>`${f}<key>${Y(l)}</key>
1033
1033
  ${i(u,f,`${t}.${l}`)}`);return p.length?`${s}<${d}>
1034
1034
  ${p.join(`
1035
1035
  `)}
@@ -1038,8 +1038,8 @@ ${s}</${d}>`:`${s}<${d}/>`}finally{r.delete(n)}}throw TypeError(`Unsupported Inf
1038
1038
  <plist version="1.0">
1039
1039
  ${i(e,"","infoPlist")}
1040
1040
  </plist>
1041
- `}async function Ta(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||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))S(s,{recursive:!0});let t=await a(process.cwd()),o=await Ya(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=_a(o,{debug:e.verbose}),o=Ea(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Zr}
1042
- </head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||$a(e.runtimeProfile);if(!p)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 u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=Qr(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: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);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||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(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`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(u,"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 ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(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=Xe("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)}
1041
+ `}async function Ta(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||q(),format:e.format||"app",error:`Input file not found: ${e.input}`};let i=e.target||q(),n=e.format||Be(i);if(e.backend&&i!=="macos")throw Error("Native backend bundles currently support macOS only.");if(e.backend&&!z(X(e.backend.entry)))throw Error(`Native backend not found: ${e.backend.entry}`);let s=e.output||c(process.cwd(),"dist","native");if(!z(s))S(s,{recursive:!0});let t=await a(process.cwd()),o=await Ya(e.input,{context:e.context,options:{...t,isDev:!1},injectCSS:!0});if(o=_a(o,{debug:e.verbose}),o=Ea(o),!o.includes("craft-component-styles")){if(o.includes("</head>"))o=o.replace("</head>",`${Qr}
1042
+ </head>`)}let d=e.name||xe(e.input,".stx"),f=e.version||"1.0.0",p=e.craftPath||$a(e.runtimeProfile);if(!p)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 u=Bun.spawnSync([p,"--runtime-profile"],{stdout:"pipe",stderr:"pipe",timeout:1e4});if(u.exitCode!==0||u.stdout.toString().trim()!=="webview")throw Error("The requested Craft webview runtime is unavailable. Upgrade Craft with Pantry before building.")}if(p=es(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: ${p}`);let l;switch(i){case"macos":l=await Se(o,d,f,s,n,e,p);break;case"windows":l=await $e(o,d,f,s,n,e,p);break;case"linux":l=await Te(o,d,f,s,n,e,p);break;case"ios":l=await Pe(o,d,f,s,e,p);break;case"android":l=await Ie(o,d,f,s,e,p);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||q(),format:e.format||"app",error:i.message,duration:Date.now()-r}}}async function Se(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`),p=c(f,"Contents"),l=c(p,"MacOS"),u=c(p,"Resources");ve(f,{recursive:!0,force:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=c(u,"index.html");await Bun.write(b,e);let m="";if(t.sidebar?.enabled&&t.sidebar?.config)m=c(u,"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 ke(o)?"executable":"launcher");if(t.backend){if(!await Ce(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=Xe("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)}
1043
1043
  import * as backend from ${JSON.stringify(X(t.backend.entry))}
1044
1044
  await runNativeBackend({ html: ${JSON.stringify(e)}, fetch: backend.default, shutdown: Reflect.get(backend, "shutdown"),
1045
1045
  maxRequestBodySize: ${t.backend.maxRequestBodySize??33554432} })
@@ -1076,7 +1076,7 @@ Name=${r}
1076
1076
  Exec=${u}
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 $a(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(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 q(){switch(ye()){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 es({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=_("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=Xe("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());S(f,{recursive:!0}),S(p,{recursive:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(u,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 $a(e="full"){let r=process.env.CRAFT_BIN;if(r){if(!z(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 q(){switch(ye()){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 ts({appBundlePath:e,outputPath:r,volumeName:i})}async function Ee(e,r){return new Promise((i)=>{let n=_("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=Xe("deb");try{let d=c(o,"pkg"),f=c(d,"DEBIAN"),p=c(d,"usr","bin"),l=c(d,"usr","share","applications"),u=c(d,"usr","share",i.toLowerCase());S(f,{recursive:!0}),S(p,{recursive:!0}),S(l,{recursive:!0}),S(u,{recursive:!0});let b=g("fs").readdirSync(e);for(let h of b)P(c(e,h),c(u,h));let m=`#!/bin/bash
1080
1080
  exec /usr/share/${i.toLowerCase()}/${i.toLowerCase()} "$@"`;g("fs").writeFileSync(c(p,i.toLowerCase()),m),I(c(p,i.toLowerCase()),493);let v=`Package: ${i.toLowerCase()}
1081
1081
  Version: ${n}
1082
1082
  Section: utils
@@ -1098,4 +1098,4 @@ Terminal=false
1098
1098
  Categories=Utility;
1099
1099
  Icon=${i.toLowerCase()}
1100
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&&z(n.icon))P(n.icon,c(o,`${i.toLowerCase()}.png`));let k=_("appimagetool",[o,r],{env:{...process.env,ARCH:"x86_64"}});k.on("close",(h)=>{if(se(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)=>{se(t),s({success:!1,error:`appimagetool not found: ${h.message}`})})}catch(o){se(t),s({success:!1,error:o.message})}})}function Ra(){return[q()]}function Aa(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 qe={buildNative:Ta,getAvailableTargets:Ra,getAvailableFormats:Aa,detectPlatform:q},Ch=qe;
1101
- export{mu,ka,xh,Sh,_a,ko,Zr,Ca,Ea,kh,_h,Ta,$a,Ra,Aa,Ch};
1101
+ export{mu,ka,xh,Sh,_a,_o,Qr,Ca,Ea,kh,_h,Ta,$a,Ra,Aa,Ch};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Uf(o){return w.test(o)}async function Yo(o,n={}){let i=n.cwd??process.cwd(),u=n.recursive!==!1,l=n.ignorePaths??[],c=globalThis.Bun.Glob,a=new Set,r=(t)=>{if(t.includes(`${e.sep}node_modules${e.sep}`)||t.includes(`${e.sep}dist${e.sep}`))return;if(l.some((s)=>s&&t.includes(e.normalize(s))))return;a.add(t)},d=async(t)=>{try{for await(let s of new c(t).scan({cwd:i,absolute:!0}))r(s)}catch{}};for(let t of o){if(!t)continue;if(Uf(t)){await d(t);continue}let s=e.resolve(i,t);if(!g(s))continue;if(p(s).isDirectory()){for await(let f of new c(u?"**/*.stx":"*.stx").scan({cwd:s,absolute:!0}))r(f);continue}r(s)}return[...a].sort()}
3
- export{Uf,Yo};
2
+ import{existsSync as g,statSync as p}from"fs";import e from"path";var w=/[*?[\]{}]/;function Uf(o){return w.test(o)}async function Zo(o,n={}){let i=n.cwd??process.cwd(),u=n.recursive!==!1,l=n.ignorePaths??[],c=globalThis.Bun.Glob,a=new Set,r=(t)=>{if(t.includes(`${e.sep}node_modules${e.sep}`)||t.includes(`${e.sep}dist${e.sep}`))return;if(l.some((s)=>s&&t.includes(e.normalize(s))))return;a.add(t)},d=async(t)=>{try{for await(let s of new c(t).scan({cwd:i,absolute:!0}))r(s)}catch{}};for(let t of o){if(!t)continue;if(Uf(t)){await d(t);continue}let s=e.resolve(i,t);if(!g(s))continue;if(p(s).isDirectory()){for await(let f of new c(u?"**/*.stx":"*.stx").scan({cwd:s,absolute:!0}))r(f);continue}r(s)}return[...a].sort()}
3
+ export{Uf,Zo};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{_n}from"./chunk-c9mdvpf5.js";import{q,y,Ot,Nt,_r,m,nl,vi,W,R}from"./chunk-38wq4ttd.js";import{en}from"./chunk-tchz2m2v.js";import{n}from"./chunk-ns23fv15.js";import{X}from"./chunk-t59bc7na.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function N(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function J(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function P(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(N(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!J(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(N(h.index,a))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=S?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var gt="private, no-store";function Pn(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function K(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function j(t){return{Vary:K(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function In(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=y(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=Pn(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=Pn(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
- `}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-8n8vj099.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function la(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function mo(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=en(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-awd0dvjb.js"),E=await b(),d={__filename:t,__dirname:O.dirname(t)};for(let g of o){let A=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!g.includes("client")&&!g.includes('type="module"'))await S(A[1],d,t)}let x=await h(f,d,t,{...w,...E,...r},new Set),C=x.indexOf(p);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,C),afterSlot:x.substring(C+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function qr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
2
+ import{Cn}from"./chunk-txd2js5v.js";import{q,y,Ot,Nt,Cr,m,nl,vi,W,R}from"./chunk-qbvy23qa.js";import{en}from"./chunk-vnk6gt0t.js";import{n}from"./chunk-0c8fqfan.js";import{X}from"./chunk-jr0r5pzw.js";var z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function U(t){let r=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,s;while((s=e.exec(t))!==null)r.push({start:s.index,end:s.index+s[0].length});return r}function N(t,r){return r.some((e)=>t>=e.start&&t<e.end)}function G(t){let r=(t||"").trim();if(!r)return null;if(/[\s>+~,:]/.test(r))return null;let e={},s=r,a=s.match(/^[a-z][\w-]*/i);if(a)e.tag=a[0].toLowerCase(),s=s.slice(a[0].length);while(s.length>0){let i=s.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(i){if(e.attr=i[1],i[3]!==void 0&&i[3]!=="")e.attrValue=i[3];s=s.slice(i[0].length);continue}let o=s.match(/^#([\w-]+)/);if(o){e.id=o[1],s=s.slice(o[0].length);continue}let c=s.match(/^\.([\w-]+)/);if(c){e.className=c[1],s=s.slice(c[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function J(t,r){if(r.attr){if(!(r.attrValue===void 0?new RegExp(`\\b${r.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${r.attr}\\s*=\\s*(["'])\\s*${r.attrValue}\\s*\\1`,"i")).test(t))return!1}if(r.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${r.id}\\s*\\1`,"i").test(t))return!1}if(r.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(r.className))return!1}return!0}function P(t,r="main"){let e=G(r);if(!e)return null;let s=/<([a-z][\w-]*)\b([^>]*)>/gi,a=U(t),i;while((i=s.exec(t))!==null){if(N(i.index,a))continue;let o=i[1].toLowerCase(),c=i[2]||"";if(c.trimEnd().endsWith("/")||z.has(o))continue;if(e.tag&&e.tag!==o)continue;if(!J(c,e))continue;let l=i[0],u=i.index+l.length,f=new RegExp(`<(/?)${o}\\b([^>]*)>`,"gi");f.lastIndex=u;let p=1,h;while((h=f.exec(t))!==null){if(N(h.index,a))continue;let S=h[1]==="/";if(!S&&(h[2]||"").trimEnd().endsWith("/"))continue;if(p+=S?-1:1,p===0)return{openTag:l,openIndex:i.index,start:u,end:h.index,tagName:o}}return null}return null}var gt="private, no-store";function In(t){return t.replace(/&#(\d+);/g,(r,e)=>D(Number(e),r)).replace(/&#x([0-9a-f]+);/gi,(r,e)=>D(Number.parseInt(e,16),r)).replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&")}function D(t,r){if(!Number.isInteger(t)||t<0||t>1114111)return r;try{return String.fromCodePoint(t)}catch{return r}}function Ee(t){return t.headers.get("X-STX-Router")==="true"}function K(t,r){if(!t)return r;return t.split(",").some((s)=>s.trim().toLowerCase()===r.toLowerCase())?t:`${t}, ${r}`}function j(t){return{Vary:K(t,"X-STX-Router")}}function k(t){return t.replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function On(t){let r=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy,s=y(r,(i,o)=>(e.lastIndex=o,e.exec(i)?e.lastIndex:-1)),a=[];for(let{token:i}of s){if(/^<title\b/i.test(i)){a.push(`<title>${k(i.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let o=Object.create(null),c=i.replace(/^<\w+\b|>$/g,"");for(let l of c.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let u=l[1].toLowerCase();if(!(u in o))o[u]=l[2]??l[3]??l[4]??""}if(/^<meta\b/i.test(i)){let l=o.property?"property":"name",u=In(o[l]??"").toLowerCase();if(u==="description"||/^(?:og|twitter):[\w:]+$/.test(u))a.push(`<meta ${l}="${n(u)}" content="${k(o.content??"")}">`)}else{let l=In(o.rel??"").toLowerCase();if(l==="canonical"||l==="alternate"&&o.hreflang)a.push(`<link rel="${l}" href="${k(o.href??"")}"${l==="alternate"?` hreflang="${k(o.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${a.join("")}</template>
3
+ `}import O from"path";var Y="stx-page-head:",Z=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,v={dev:null,prod:null};function Q(){let t=X()?"dev":"prod",r=v[t];if(r!==null)return r;try{let e=import.meta.require("./chunk-a1hxz8q4.js"),s=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;v[t]=`<script>${s()}</script>`}catch{v[t]=""}return v[t]}async function la(t,r){if(r===!1)return null;if(r&&typeof r==="string"){let s=O.resolve(t,r);if(await Bun.file(s).exists())return s;return null}let e=O.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function ho(t,r){try{let e=await Bun.file(t).text(),s=e,a=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(a)s=a[1].trim();let i=en(e),o=[...i.client.map((g)=>g.fullTag),...i.signals.map((g)=>g.fullTag)],c=[],l=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=l.exec(e))!==null)c.push(u[0]);let f=s;for(let g of i.server)f=f.replace(g.fullTag,"");for(let g of i.client)f=f.replace(g.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let p="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,p).replace(/<slot\s*>\s*<\/slot>/gi,p),!f.includes(p))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:S,defaultConfig:w,loadStxConfig:b}=await import("./chunk-k4hjqfx1.js"),E=await b(),d={__filename:t,__dirname:O.dirname(t)};for(let g of o){let A=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(A&&!g.includes("client")&&!g.includes('type="module"'))await S(A[1],d,t)}let x=await h(f,d,t,{...w,...E,...r},new Set),C=x.indexOf(p);if(C===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:x.substring(0,C),afterSlot:x.substring(C+p.length),filePath:t,shellScripts:o,shellStyles:c}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function Kr(t,r,e){let s,a="",i=r.match(Z);if(i){r=r.replace(i[0],"");try{let f=Buffer.from(i[1],"base64").toString("utf8"),p=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(p)s=p[1].trim();a=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let o=e||s||"stx App",c=Q(),l="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
4
4
  <html lang="en">
5
5
  <head>
6
6
  <meta charset="UTF-8">
@@ -19,14 +19,14 @@ ${t.shellScripts.filter((f)=>!f.includes("server")).join(`
19
19
  ${l}
20
20
  ${c}
21
21
  </body>
22
- </html>`}function qe(t,r={}){let e=t.trim();if(!_n(e))return t;let s=[],a=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(a){let l=a[1],u=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=u.exec(l))!==null)s.push(f[0]);let p=l.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(p)s.push(p[0]);let h=l.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(h)s.push(h[0])}if(r.preserveHead&&a){let l=[],u=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=u.exec(a[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;l.push(f[0])}if(l.length>0)s.unshift(`<!--${Y}${Buffer.from(l.join(`
22
+ </html>`}function qe(t,r={}){let e=t.trim();if(!Cn(e))return t;let s=[],a=e.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(a){let l=a[1],u=/<style\b[^>]*>[\s\S]*?<\/style>/gi,f;while((f=u.exec(l))!==null)s.push(f[0]);let p=l.match(/<script\b[^>]*data-stx-server-data[^>]*>[\s\S]*?<\/script>/i);if(p)s.push(p[0]);let h=l.match(/<script\b[^>]*data-stx-runtime-config[^>]*>[\s\S]*?<\/script>/i);if(h)s.push(h[0])}if(r.preserveHead&&a){let l=[],u=/<title\b[^>]*>[\s\S]*?<\/title>|<meta\b[^>]*>|<link\b[^>]*>/gi,f;while((f=u.exec(a[1]))!==null){if(/<meta\b[^>]*(?:\bcharset|name="viewport")/i.test(f[0]))continue;l.push(f[0])}if(l.length>0)s.unshift(`<!--${Y}${Buffer.from(l.join(`
23
23
  `),"utf8").toString("base64")}-->`)}let i=e.match(/<body\b[^>]*>/i),o=e.lastIndexOf("</body>");if(i&&o!==-1){let l=i.index+i[0].length,u=e.slice(l,o).trim();if(s.length>0)return s.join(`
24
24
  `)+`
25
25
  `+u;return u}let c=e;if(c=c.replace(/<!DOCTYPE\b[^>]*>/i,""),c=c.replace(/<html\b[^>]*>/i,""),c=c.replace(/<\/html\s*>/i,""),a)c=c.replace(/<head\b[^>]*>[\s\S]*?<\/head>/i,s.join(`
26
- `));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function ua(t){return Ee(t)}function tt(t,r){let e=[],s=new Set;for(let a of y(t,q)){if(a.start>=r.start&&a.start<r.end)continue;let i=a.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",o=new Map;for(let u of i.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))o.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let c=o.get("src")?.trim(),l=o.get("type")?.trim().toLowerCase();if(!c||o.has("server")||l&&!["module","text/javascript","application/javascript"].includes(l))continue;if(o.has("data-stx-runtime")||o.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(c))continue;if(L(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function Ke(t,r="main"){return!!P(t.trim(),r)}function Te(t,r="main",e=!1){let s=t.trim(),a=[],i=[],o=s.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let x=o[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=C.exec(x))!==null)a.push(g[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=A.exec(x))!==null){if(F.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;i.push(g[0])}}let c=P(s,r);if(!c)return(e?In(t):"")+qe(t);let l=tt(s,c),u=new Set(l),{tagName:f,start:p,end:h}=c,S=s.slice(p,h).trim(),w=[],b=s.match(/<body\b[^>]*>/i),E=s.lastIndexOf("</body>");if(b&&b.index!==void 0&&E!==-1){let C=[[b.index+b[0].length,c.openIndex],[h+`</${f}>`.length,E]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,I]of C){if(A>=I)continue;let B=s.slice(A,I),_;g.lastIndex=0;while((_=g.exec(B))!==null){if(L(s,_[0],p,h))continue;w.push(_[0])}}}let d=[];if(e)d.push(In(t));if(a.length>0)d.push(a.join(`
26
+ `));return c=c.replace(/<body\b[^>]*>/i,""),c=c.replace(/<\/body\s*>/i,""),c.trim()}var F=/^<script\b[^>]*\sdata-stx-(?:owner|instance)(?=[\s=/>])/i;function L(t,r,e,s){if(!F.test(r))return!1;let a=r.slice(0,r.indexOf(">")+1),i=/\sdata-stx-owner="([^"]+)"/i.exec(a)?.[1];if(!i)return!0;let o=`data-stx-scope="${i}"`;for(let c=t.indexOf(o);c!==-1;c=t.indexOf(o,c+o.length))if(c>=e&&c<s)return!1;return!0}function ua(t){return Ee(t)}function tt(t,r){let e=[],s=new Set;for(let a of y(t,q)){if(a.start>=r.start&&a.start<r.end)continue;let i=a.token.match(/^<script\b((?:"[^"]*"|'[^']*'|[^'">])*)>/i)?.[1]??"",o=new Map;for(let u of i.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g))o.set(u[1].toLowerCase(),u[2]??u[3]??u[4]??"");let c=o.get("src")?.trim(),l=o.get("type")?.trim().toLowerCase();if(!c||o.has("server")||l&&!["module","text/javascript","application/javascript"].includes(l))continue;if(o.has("data-stx-runtime")||o.has("data-stx-router")||/^\/_stx\/(?:runtime|router)(?:\.[a-f0-9]{16})?\.js(?:[?#]|$)/i.test(c))continue;if(L(t,a.token,r.start,r.end)||s.has(a.token))continue;s.add(a.token),e.push(a.token)}return e}function Ke(t,r="main"){return!!P(t.trim(),r)}function Te(t,r="main",e=!1){let s=t.trim(),a=[],i=[],o=s.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(o){let x=o[1],C=/<style\b[^>]*>[\s\S]*?<\/style>/gi,g;while((g=C.exec(x))!==null)a.push(g[0]);let A=/<script\b[^>]*data-stx-(?:route-params|server-data|scoped|component-factories)[^>]*>[\s\S]*?<\/script>/gi;while((g=A.exec(x))!==null){if(F.test(g[0])||g[0].includes("__stx_early_mounts")||/^<script\b[^>]*\bdata-stx-runtime(?=[\s=>])/i.test(g[0]))continue;i.push(g[0])}}let c=P(s,r);if(!c)return(e?On(t):"")+qe(t);let l=tt(s,c),u=new Set(l),{tagName:f,start:p,end:h}=c,S=s.slice(p,h).trim(),w=[],b=s.match(/<body\b[^>]*>/i),E=s.lastIndexOf("</body>");if(b&&b.index!==void 0&&E!==-1){let C=[[b.index+b[0].length,c.openIndex],[h+`</${f}>`.length,E]],g=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,I]of C){if(A>=I)continue;let B=s.slice(A,I),_;g.lastIndex=0;while((_=g.exec(B))!==null){if(L(s,_[0],p,h))continue;w.push(_[0])}}}let d=[];if(e)d.push(On(t));if(a.length>0)d.push(a.join(`
27
27
  `));if(l.length>0)d.push(l.join(`
28
28
  `));if(i.length>0)d.push(i.filter((x)=>!u.has(x)).join(`
29
29
  `));if(w.length>0)d.push(w.filter((x)=>!u.has(x)).join(`
30
30
  `));return d.push(S),d.join(`
31
- `)}import T from"fs";import H from"path";function da(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function pa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function fa(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function ho(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!ho(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ga(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function On(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-vce1js6z.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-09fbj9b4.js"),{defaultConfig:h}=await import("./chunk-7b105hww.js"),S=s.streamBoundaries||{},w={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof S[d]==="function"?await S[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,w,new Set)}})),E=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!E.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!vi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=_r(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!vi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=R(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(nl(t.html,i)),context:e,cookies:s.cookies}}
32
- export{gt,Pn,Ee,j,In,la,mo,qr,qe,ua,Ke,Te,da,pa,fa,ho,ga,On};
31
+ `)}import T from"fs";import H from"path";function da(t,r,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:r,outputDir:e}}function pa(t,r){let e=H.join(r,"manifest.json");T.writeFileSync(e,JSON.stringify(t,null,2))}function fa(t){let r=H.join(t,"manifest.json");if(!T.existsSync(r))return null;try{let e=T.readFileSync(r,"utf-8"),s=JSON.parse(e);if(s.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${s.version}`),null;return s}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,r,e={}){let s=`${encodeURIComponent(t)}=${encodeURIComponent(r)}`;if(e.maxAge!==void 0)s+=`; Max-Age=${e.maxAge}`;if(e.expires)s+=`; Expires=${e.expires.toUTCString()}`;if(e.path)s+=`; Path=${e.path}`;if(e.domain)s+=`; Domain=${e.domain}`;if(e.secure)s+="; Secure";if(e.httpOnly)s+="; HttpOnly";if(e.sameSite)s+=`; SameSite=${e.sameSite}`;return s}async function et(t){let r=t.headers.get("content-type")||"",e={},s=(a,i)=>{let o=e[a];if(o===void 0)e[a]=i;else if(Array.isArray(o))o.push(i);else e[a]=[o,i]};if(r.includes("multipart/form-data")){let a=await t.formData();for(let[i,o]of a.entries())if(typeof o==="string")s(i,o);return e}if(r.includes("application/x-www-form-urlencoded")){for(let[a,i]of new URLSearchParams(await t.text()).entries())s(a,i);return e}return e}function yo(t){if(!t)return!1;let r=t.toUpperCase();return r!=="GET"&&r!=="HEAD"}async function V(t,r={}){let e=r.request,s=r.method??e?.method;if(!e||!yo(s))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let a={};try{a=await et(e)}catch{}let i=await t.action({request:e,form:a,params:r.params??{},query:t.query??{},cookies:r.cookies??{}});if(i&&typeof i==="object"){let o=i,c=nt(o.cookies),l=o.redirect;if(typeof l==="string"&&l)return{redirect:l,ran:!0,...c.length>0?{cookies:c}:{}};let{cookies:u,redirect:f,...p}=o;if(Object.assign(t,p),c.length>0)return{ran:!0,cookies:c}}return{ran:!0}}function nt(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let r=[];for(let[e,s]of Object.entries(t)){if(!e)continue;if(typeof s==="string"){r.push(M(e,s));continue}if(s&&typeof s==="object"){let a=s;if(typeof a.value!=="string")continue;r.push(M(e,a.value,a))}}return r}function ga(t,r=[],e){let s=new Headers({Location:t,"Cache-Control":"no-store"});for(let a of r)s.append("Set-Cookie",a);for(let[a,i]of Object.entries(e??{}))if(a.toLowerCase()!=="location")s.set(a,i);return new Response(null,{status:303,headers:s})}async function Nn(t,r={}){let{html:e,context:s,redirect:a,cookies:i}=await rt(t,r),o=Ot(s),c=Nt(s);if(a)return{html:e,redirect:a,cookies:i,status:o,headers:c};let{extractStreamBoundaries:l}=await import("./chunk-913grzaj.js"),u=l(s),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:p}=await import("./chunk-brk1pk8w.js"),{defaultConfig:h}=await import("./chunk-e7ssdryq.js"),S=s.streamBoundaries||{},w={...h,autoShell:!1},b=Object.keys(f).map((d)=>({id:d,render:async()=>{let x=typeof S[d]==="function"?await S[d]():void 0;return p(f[d],{...s,$boundary:x},t.sourceFile,w,new Set)}})),E=new Set(b.map((d)=>d.id));u=[...(u||[]).filter((d)=>!E.has(d.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:i,status:o,headers:c}}async function rt(t,r){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...r};if(!t.hasServerScripts&&!vi(t.html))return{html:t.html,context:e};for(let o of t.serverScriptContent)try{await m(o,e,t.sourceFile)}catch(c){if(r.__stx_strict_hydration)throw c;console.warn(`[stx] Server script error in ${t.sourceFile}:`,c)}let s=await V(e,{request:r.request,method:r.method,params:r.params??{},cookies:r.cookies??{}}),a=(o)=>{let c=o.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),l=Cr(e);if(!l)return c;let u=c.indexOf("</head>");return u<0?l+c:c.slice(0,u)+l+c.slice(u)};if(s.redirect)return{html:t.html,context:e,redirect:s.redirect,cookies:s.cookies};if(!vi(t.html))return{html:a(t.html),context:e,cookies:s.cookies};let i=new Map;for(let[o,c]of Object.entries(t.placeholders))if(c.expression)try{let l=R(c.expression,e);if(c.type==="raw")i.set(o,l!==void 0&&l!==null?String(l):"");else i.set(o,l!==void 0&&l!==null?W(String(l)):"")}catch(l){if(r.__stx_strict_hydration)throw l;i.set(o,"")}return{html:a(nl(t.html,i)),context:e,cookies:s.cookies}}
32
+ export{gt,In,Ee,j,On,la,ho,Kr,qe,ua,Ke,Te,da,pa,fa,yo,ga,Nn};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Uf,Zo}from"./chunk-gh62p9mx.js";export{Uf as looksLikeGlob,Zo as resolveStxTargets};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{eo,Vt,_l,Rg}from"./chunk-zvvv6x8c.js";export{eo as generateServiceWorker,Rg as generateServiceWorkerAuto,Vt as getServiceWorkerFileName,_l as isWorkboxEnabled};
2
+ import{to,Vt,_l,Rg}from"./chunk-yw1s8kyj.js";export{to as generateServiceWorker,Rg as generateServiceWorkerAuto,Vt as getServiceWorkerFileName,_l as isWorkboxEnabled};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ei,ti,ni,ri,Cs,Es,qh,Kh,Xh,Gh,Ts,Jh}from"./chunk-ms3v5nat.js";import"./chunk-txd2js5v.js";export{Jh as generateDefaultRobotsTxt,Ts as generateRobotsTxt,Kh as generateSitemap,Xh as generateSitemapIndex,ri as injectSeoTags,Cs as metaDirective,ei as processMetaDirectives,ni as processSeoDirective,ti as processStructuredData,qh as registerSeoDirectives,Gh as scanForSitemapEntries,Es as structuredDataDirective};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{jr,oo,Hg,Tl,io}from"./chunk-x57x0yq7.js";export{Hg as buildModuleRegistryScript,io as buildSharedModuleRegistries,Tl as exportsMutableBinding,jr as registeredModuleIdsIn,oo as registeredModuleNamesIn};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- function E(){let{NODE_ENV:n}=process.env;return n==="production"}function X(){let{STX_DEBUG:n}=process.env;return!E()||n==="true"}function Cn(){let{NODE_ENV:n}=process.env;return n==="test"}function Ai(n,t){return t??(n==="compile"||E())}function En(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
3
- export{E,X,Cn,Ai,En};
2
+ function E(){let{NODE_ENV:n}=process.env;return n==="production"}function X(){let{STX_DEBUG:n}=process.env;return!E()||n==="true"}function En(){let{NODE_ENV:n}=process.env;return n==="test"}function Ai(n,t){return t??(n==="compile"||E())}function Tn(n){if(!n)return n;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(n).trim()}catch{return n}}
3
+ export{E,X,En,Ai,Tn};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{xe,Us,bg,Qh,wg,ey,Dt,p,W,Q,vn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry}from"./chunk-38wq4ttd.js";import"./chunk-xdqv5yq4.js";import"./chunk-2qngyyaz.js";import"./chunk-c9mdvpf5.js";import"./chunk-8y8kgw9s.js";import"./chunk-04z1xyrb.js";export{Sg as applyFilters,ey as clearCustomFilters,vg as clientLoopScopes,Us as defaultFilters,vn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,R as evaluateExpression,xe as findMustacheEnd,wg as getAllFilters,xg as interpolateScriptAttributes,xi as interpolateScriptExpressions,ty as interpolateScriptsInTemplate,_ as processExpressions,bg as registerFilter,Qh as registerFilters,Dt as replaceInterpolations,ny as resetRejectedExpressionWarnings,ry as unescapeHtml,ke as usesSignalsInScript};
2
+ import{xe,Ws,bg,Qh,wg,ey,Dt,p,W,Q,xn,ke,vg,xi,xg,ty,_,Sg,ny,R,ry}from"./chunk-qbvy23qa.js";import"./chunk-qdagsy5b.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Sg as applyFilters,ey as clearCustomFilters,vg as clientLoopScopes,Ws as defaultFilters,xn as escapeAttributeValue,p as escapeHtml,W as escapeHtmlValue,Q as escapeInterpolatedHtmlValue,R as evaluateExpression,xe as findMustacheEnd,wg as getAllFilters,xg as interpolateScriptAttributes,xi as interpolateScriptExpressions,ty as interpolateScriptsInTemplate,_ as processExpressions,bg as registerFilter,Qh as registerFilters,Dt as replaceInterpolations,ny as resetRejectedExpressionWarnings,ry as unescapeHtml,ke as usesSignalsInScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$l,Rl}from"./chunk-rfdwn0k3.js";import"./chunk-e75dntfb.js";import"./chunk-xvmn976f.js";import"./chunk-t33fttx9.js";import"./chunk-55k7m9cp.js";import"./chunk-n4qznmkm.js";import"./chunk-55e46spy.js";import"./chunk-0mrzdsh5.js";import"./chunk-mya2g8sn.js";import"./chunk-gnt1v0kc.js";import"./chunk-f49x34sr.js";import"./chunk-xtqapjz3.js";import"./chunk-q5pwvr98.js";import"./chunk-srb0qmgx.js";import"./chunk-nmtya57z.js";import"./chunk-vyv76w55.js";import"./chunk-z25w7kmr.js";import"./chunk-ckg6q98b.js";import"./chunk-s5dhvnnd.js";import"./chunk-7k9yahng.js";import"./chunk-dgqp0pjn.js";import"./chunk-xqy8y5dc.js";import"./chunk-b7tb00nz.js";import"./chunk-0rvntfhj.js";import"./chunk-myje6fhm.js";import"./chunk-f7jgda7x.js";import"./chunk-9n14m2gn.js";import"./chunk-0mb3jch4.js";import"./chunk-q46ay7aq.js";import"./chunk-7h5rt22w.js";import"./chunk-s53wjw7y.js";import"./chunk-ac9ncbfw.js";import{en}from"./chunk-vnk6gt0t.js";import"./chunk-ddtk57fy.js";import"./chunk-v4kenb7z.js";import"./chunk-tx8wk6h7.js";import{Ae,i}from"./chunk-1qgzexkc.js";import"./chunk-y47n1j5x.js";import"./chunk-cddzcckm.js";import"./chunk-s33andzg.js";import"./chunk-npn692c4.js";import"./chunk-0c8fqfan.js";import"./chunk-zb7kfwac.js";import"./chunk-3bjnrmha.js";import"./chunk-3w8kt53x.js";import{ve}from"./chunk-dvyysszs.js";import"./chunk-ya6bp08c.js";import{ur,dr}from"./chunk-4g6v5qsp.js";import{Ss,F,a}from"./chunk-ecmvq302.js";import"./chunk-srqk1nxc.js";import"./chunk-gh62p9mx.js";import"./chunk-amg6kr1p.js";import"./chunk-ms3v5nat.js";import"./chunk-29f6vmyz.js";import{m,je}from"./chunk-qbvy23qa.js";import"./chunk-qdagsy5b.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";import"./chunk-dv11h4f0.js";import"./chunk-nyg0nbjj.js";export{Ss as buildWebComponents,dr as cacheTemplate,ur as checkCache,en as classifyAllScripts,$l as createMiddleware,Rl as createRoute,F as defaultConfig,m as extractVariables,ve as injectRouterScript,a as loadStxConfig,je as processClientScript,i as processDirectives,Ae as readMarkdownFile};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Pl,sa,Il,Ol,oa,Nl,Ml,Dl,Ll,ia,jl,em}from"./chunk-55e46spy.js";import{ma,Hl}from"./chunk-xtqapjz3.js";import{ee,te,ne,Dn,he,$e,Xr,mt,Gt,Ln,jn,Bn,re,Fn,zn,Gr}from"./chunk-nmtya57z.js";import{Kl}from"./chunk-vyv76w55.js";import"./chunk-s53wjw7y.js";export{te as DEFAULT_FORMATS,ne as DEFAULT_QUALITY,ee as DEFAULT_WIDTHS,Gr as ImageProcessingError,Ol as clearImageCache,oa as createImageDirective,Hl as createImageHandler,Ml as createImagePlugin,em as defaultImageConfig,zn as formatSize,ia as generateImageManifest,Gt as generateSizes,mt as generateSrcSet,Ln as getFallbackVariant,Xr as getImageMetadata,re as getMimeType,Fn as getTotalSize,jn as groupVariantsByFormat,ma as handleImageRequest,Nl as imageDirective,he as isImageBackendAvailable,Bn as isImageFile,Dn as isSharpAvailable,Ll as optimizeDirectory,Dl as optimizeImage,sa as parseImageComponent,$e as processImage,Il as processImageComponents,Pl as renderImageComponent,Kl as rewriteImagesWithSiblings,jl as writeImageManifest};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{E}from"./chunk-t59bc7na.js";import{We,$n}from"./chunk-yrw5ensv.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
2
+ import{E}from"./chunk-jr0r5pzw.js";import{We,Rn}from"./chunk-7bvvv74e.js";function m(e){let t={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return t[e]||t["network-first"]}function g(e){return m(e).className}function d(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.routes||[],n=t.cacheStorage,c=[];for(let a of r){let i=g(a.strategy),s=[];if(a.maxAgeSeconds||a.maxEntries||n?.maxEntries){let o=a.maxEntries||n?.maxEntries||100,u=a.maxAgeSeconds||(n?.maxAge?n.maxAge*24*60*60:void 0);s.push(`new ExpirationPlugin({
3
3
  maxEntries: ${o},
4
4
  ${u?`maxAgeSeconds: ${u},`:""}
5
5
  purgeOnQuotaError: true,
@@ -17,7 +17,7 @@ registerRoute(
17
17
  ],`:""}
18
18
  })
19
19
  );`)}return c.join(`
20
- `)}function p(e){if(e.startsWith("*.")){let t=e.slice(2);return`({ request }) => request.destination === '${f(t)}'`}if(e.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${e.slice(0,-3)}')`;if(e.endsWith("/*")){let t=e.slice(0,-2);return`({ url }) => url.pathname.startsWith('${t}') && !url.pathname.slice(${t.length+1}).includes('/')`}if(e.includes("*")&&!e.startsWith("*")){let[t,r]=e.split("*");return`({ url }) => url.pathname.startsWith('${t}') && url.pathname.endsWith('${r}')`}if(e==="/"||!e.includes("*"))return`({ url }) => url.pathname === '${e}'`;return`new RegExp('${x(e).replace(/\\\*/g,".*")}')`}function f(e){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[e.toLowerCase()]||"empty"}function h(e){return"stx-"+e.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(e,t){let r=e.pwa;if(!r?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let n=r.serviceWorker||{},c=r.routes||[],a=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],i=new Set;for(let o of c)i.add(g(o.strategy));if(i.size>0)a.push({name:"workbox-strategies",exports:Array.from(i)});if(c.some((o)=>o.maxAgeSeconds||o.maxEntries)||r.cacheStorage)a.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(c.some((o)=>o.strategy==="network-first"||o.strategy==="stale-while-revalidate"))a.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(r.backgroundSync?.enabled)a.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(n.navigationPreload)a.push({name:"workbox-navigation-preload",exports:["enable"]});let l=t?We(t,e):void 0;return{mode:"generate",modules:a,precacheManifest:l?.entries,skipWaiting:n.skipWaiting??!0,clientsClaim:n.clientsClaim??!0,offlineFallback:r.offline?.enabled?"/offline.html":void 0,navigationPreload:n.navigationPreload??!1,cacheVersion:n.cacheVersion||"1.0.0"}}function R(e,t){let r=e.pwa;if(!r?.enabled)return"";let n=b(e,t),c=r.serviceWorker||{},{push:a,backgroundSync:i}=r,s=t?We(t,e):null,l=s?$n(s):"[]",o=k(n.modules),u=d(e);return`/**
20
+ `)}function p(e){if(e.startsWith("*.")){let t=e.slice(2);return`({ request }) => request.destination === '${f(t)}'`}if(e.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${e.slice(0,-3)}')`;if(e.endsWith("/*")){let t=e.slice(0,-2);return`({ url }) => url.pathname.startsWith('${t}') && !url.pathname.slice(${t.length+1}).includes('/')`}if(e.includes("*")&&!e.startsWith("*")){let[t,r]=e.split("*");return`({ url }) => url.pathname.startsWith('${t}') && url.pathname.endsWith('${r}')`}if(e==="/"||!e.includes("*"))return`({ url }) => url.pathname === '${e}'`;return`new RegExp('${x(e).replace(/\\\*/g,".*")}')`}function f(e){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[e.toLowerCase()]||"empty"}function h(e){return"stx-"+e.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function x(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function b(e,t){let r=e.pwa;if(!r?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let n=r.serviceWorker||{},c=r.routes||[],a=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],i=new Set;for(let o of c)i.add(g(o.strategy));if(i.size>0)a.push({name:"workbox-strategies",exports:Array.from(i)});if(c.some((o)=>o.maxAgeSeconds||o.maxEntries)||r.cacheStorage)a.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(c.some((o)=>o.strategy==="network-first"||o.strategy==="stale-while-revalidate"))a.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(r.backgroundSync?.enabled)a.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(n.navigationPreload)a.push({name:"workbox-navigation-preload",exports:["enable"]});let l=t?We(t,e):void 0;return{mode:"generate",modules:a,precacheManifest:l?.entries,skipWaiting:n.skipWaiting??!0,clientsClaim:n.clientsClaim??!0,offlineFallback:r.offline?.enabled?"/offline.html":void 0,navigationPreload:n.navigationPreload??!1,cacheVersion:n.cacheVersion||"1.0.0"}}function R(e,t){let r=e.pwa;if(!r?.enabled)return"";let n=b(e,t),c=r.serviceWorker||{},{push:a,backgroundSync:i}=r,s=t?We(t,e):null,l=s?Rn(s):"[]",o=k(n.modules),u=d(e);return`/**
21
21
  * Service Worker - Generated by stx with Workbox
22
22
  * Cache Version: ${n.cacheVersion}
23
23
  *
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ff,Lh,jh,Bh,Fh,zf,Hf,zh,Hh,Jo,Vh,ur,dr,vs}from"./chunk-4g6v5qsp.js";import{rt}from"./chunk-car6nhfe.js";import"./chunk-qbvy23qa.js";import"./chunk-qdagsy5b.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{Fh as __setSignalsGeneratorsForTest,rt as cacheEngineFingerprint,dr as cacheTemplate,ur as checkCache,Vh as clearDevCaches,Hf as getCachedRouterScript,zf as getCachedSignalsRuntime,zh as getServeClientAsset,Jo as getServeModuleBundle,vs as hashFilePath,jh as invalidateFileCache,Bh as invalidateFileCacheByDir,Lh as readFileCached,Hh as registerServeModuleBundle,Ff as templateCache};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{eo,Oi,Eg,Tg,$g}from"./chunk-z0ynyz62.js";import"./chunk-yw1s8kyj.js";export{Tg as generateManifestLink,eo as generatePwaTags,Eg as generateSwRegistrationScript,$g as generateThemeColorMeta,Oi as injectPwaTags};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{t,l,Ft,zt,Ht,Ve,it,D,Gs,Pr,Ue}from"./chunk-c9mdvpf5.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>D(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function Qo(e,r,n,g){if(!e.includes("@meta"))return e;let i=Ft(e,I,(a,o)=>{let s=Pr(zt(a),r);if(s.kind==="tag")return j(s.tag);if(s.kind==="empty")return"";return D("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Ft(i,C,(a,o)=>{let s=Ht(a,r);if(!s.ok)return D("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!it(s.value))return D("MetaTag",o,`expected an object such as { name, content }, got ${Ve(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return D("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${c(u.name)}"`;if(u.property)p+=` property="${c(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${c(u.httpEquiv)}"`;return p+=` content="${c(u.content)}">`,p},_("MetaTag",n)),i}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(it(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(it))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ei(e,r,n){if(!e.includes("@structuredData"))return e;return Ft(e,k,(g,i)=>{let a=Ht(g,r);if(!a.ok)return D("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=v(a.value);if(!o)return D("StructuredData",i,`expected an object or an array of objects, got ${Ve(a.value)}`,n,t.TYPE_ERROR);try{return A(o)}catch(s){let u=s instanceof Error?s.message:String(s);return D("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ti(e,r,n,g){if(!e.includes("@seo"))return e;return Ft(e,N,(i,a)=>{if(!i.trim())return D("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Ht(i,r);if(!o.ok)return D("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!it(o.value))return D("SEO",a,`expected an object such as { title, description }, got ${Ve(o.value)}`,n,t.TYPE_ERROR);try{return q(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return D("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function b(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(it(i))return i;Gs(n,`${r} must be an object, got ${Ve(i)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((s)=>!L.has(s));if(g.length>0){let s=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");Gs(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
2
+ import{t,l,Ft,zt,Ht,Ve,it,D,Js,Ir,Ue}from"./chunk-txd2js5v.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>D(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${c(e.property)}" content="${c(e.content)}">`:`<meta name="${c(e.name)}" content="${c(e.content)}">`}function ei(e,r,n,g){if(!e.includes("@meta"))return e;let i=Ft(e,I,(a,o)=>{let s=Ir(zt(a),r);if(s.kind==="tag")return j(s.tag);if(s.kind==="empty")return"";return D("Meta",o,s.message,n,s.code)},_("Meta",n));return i=Ft(i,C,(a,o)=>{let s=Ht(a,r);if(!s.ok)return D("MetaTag",o,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";if(!it(s.value))return D("MetaTag",o,`expected an object such as { name, content }, got ${Ve(s.value)}`,n,t.TYPE_ERROR);let u=s.value;if(!u.name&&!u.property&&!u.httpEquiv)return D("MetaTag",o,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${c(u.name)}"`;if(u.property)p+=` property="${c(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${c(u.httpEquiv)}"`;return p+=` content="${c(u.content)}">`,p},_("MetaTag",n)),i}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(it(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(it))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function ti(e,r,n){if(!e.includes("@structuredData"))return e;return Ft(e,k,(g,i)=>{let a=Ht(g,r);if(!a.ok)return D("StructuredData",i,a.message,n,a.code);if(a.value===void 0||a.value===null)return"";let o=v(a.value);if(!o)return D("StructuredData",i,`expected an object or an array of objects, got ${Ve(a.value)}`,n,t.TYPE_ERROR);try{return A(o)}catch(s){let u=s instanceof Error?s.message:String(s);return D("StructuredData",i,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function ni(e,r,n,g){if(!e.includes("@seo"))return e;return Ft(e,N,(i,a)=>{if(!i.trim())return D("SEO",a,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let o=Ht(i,r);if(!o.ok)return D("SEO",a,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!it(o.value))return D("SEO",a,`expected an object such as { title, description }, got ${Ve(o.value)}`,n,t.TYPE_ERROR);try{return q(o.value,a,n)}catch(s){let u=s instanceof Error?s.message:String(s);return D("SEO",a,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function b(e,r,n,g){let i=e[r];if(i===void 0||i===null||i===!1)return;if(it(i))return i;Js(n,`${r} must be an object, got ${Ve(i)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((s)=>!L.has(s));if(g.length>0){let s=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");Js(r,`@seo does not read ${s}; ${g.length===1?"it was":"they were"} ignored`,n)}let i="";if(e.title)i+=`<title>${c(e.title)}</title>
3
3
  `,i+=`<meta name="title" content="${c(e.title)}">
4
4
  `;if(e.description)i+=`<meta name="description" content="${c(e.description)}">
5
5
  `;if(e.keywords){let s=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;i+=`<meta name="keywords" content="${c(s)}">
@@ -25,7 +25,7 @@ import{t,l,Ft,zt,Ht,Ve,it,D,Gs,Pr,Ue}from"./chunk-c9mdvpf5.js";var I=/(?<![\w$@]
25
25
  `}if(o.site)i+=`<meta name="twitter:site" content="${c(o.site)}">
26
26
  `;if(o.creator)i+=`<meta name="twitter:creator" content="${c(o.creator)}">
27
27
  `}if(e.structuredData!==void 0&&e.structuredData!==null){let s=v(e.structuredData);if(s)i+=`${A(s)}
28
- `;else Gs(r,`structuredData must be an object or an array of objects, got ${Ve(e.structuredData)}; it was left out`,n)}return i.trim()}function ni(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let a=e.includes("<title>")||e.includes("</title>"),o=M(e),s=V(o),u=U(o),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(s)p=s;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=a?"":`
28
+ `;else Js(r,`structuredData must be an object or an array of objects, got ${Ve(e.structuredData)}; it was left out`,n)}return i.trim()}function ri(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let a=e.includes("<title>")||e.includes("</title>"),o=M(e),s=V(o),u=U(o),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(s)p=s;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=a?"":`
29
29
  <meta name="title" content="${c(p)}">`,E=G(o)?"":`
30
30
  <meta name="description" content="${c(m)}">`,y=`
31
31
  <!-- stx SEO Tags -->${f}${E}
@@ -43,7 +43,7 @@ import{t,l,Ft,zt,Ht,Ve,it,D,Gs,Pr,Ue}from"./chunk-c9mdvpf5.js";var I=/(?<![\w$@]
43
43
  ${y}
44
44
  `),h;return h.replace(/<head[^>]*>/,`$&
45
45
  ${y}
46
- `)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function c(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var _s={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Pr(r,n??{});if(i.kind==="error")return D("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ue(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Cs={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return l("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return l("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(i)}catch(i){let a=i instanceof Error?i.message:String(i);return l("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function qh(){return[_s,Cs]}function Kh(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),E=m.changefreq||g,y=m.priority??i,h=` <url>
46
+ `)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0*39;|&apos;/g,"'").replace(/&amp;/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function c(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Cs={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let i=Ir(r,n??{});if(i.kind==="error")return D("Meta",`@meta(${r.join(", ")})`,i.message,g,i.code);if(i.kind==="empty")return"";if(n)n.__stx_runtime_head=Ue(n.__stx_runtime_head??{},{meta:[i.tag]});return""},hasEndTag:!1},Es={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return l("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return l("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(i)}catch(i){let a=i instanceof Error?i.message:String(i);return l("StructuredData",a,t.EVALUATION_ERROR)}},hasEndTag:!0};function qh(){return[Cs,Es]}function Kh(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:i=0.5,includeLastmod:a=!0}=r,o=n.replace(/\/$/,""),s=(m)=>m.startsWith("http")?m:`${o}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=s(m.loc),f=m.lastmod||(a?new Date().toISOString().split("T")[0]:void 0),E=m.changefreq||g,y=m.priority??i,h=` <url>
47
47
  <loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
48
48
  <xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(s(w.href))}"/>`;if(f)h+=`
49
49
  <lastmod>${f}</lastmod>`;return h+=`
@@ -60,6 +60,6 @@ ${e.map((a)=>{let o=a.startsWith("http")?a:`${n}${a.startsWith("/")?"":"/"}${a}`
60
60
  <lastmod>${g}</lastmod>
61
61
  </sitemap>`}).join(`
62
62
  `)}
63
- </sitemapindex>`}async function Gh(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,u)=>s.loc.localeCompare(u.loc)),i}function Es(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
- `).trim()}function Jh(e){return Es({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
- export{Qo,ei,ti,ni,_s,Cs,qh,Kh,Xh,Gh,Es,Jh};
63
+ </sitemapindex>`}async function Gh(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,i=[],a=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,o=new Bun.Glob(`**/${a}`);for await(let s of o.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return s.includes(f.slice(1));return s.startsWith(f)||s.includes(`/${f}`)}))continue;let p=s.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${s}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}i.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return i.sort((s,u)=>s.loc.localeCompare(u.loc)),i}function Ts(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
64
+ `).trim()}function Jh(e){return Ts({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
65
+ export{ei,ti,ni,ri,Cs,Es,qh,Kh,Xh,Gh,Ts,Jh};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{nt}from"./chunk-mxvevxb8.js";import{yt,Vn}from"./chunk-qy6dtm1a.js";import{$r,Rr,Ar,Ir,Ce}from"./chunk-c9mdvpf5.js";import{De,mn,el,tl}from"./chunk-38wq4ttd.js";import{M}from"./chunk-2qngyyaz.js";import{Si}from"./chunk-xdqv5yq4.js";import{b}from"./chunk-bgqbvf1w.js";import{i}from"./chunk-y34ayg61.js";import{F,a}from"./chunk-a395a3dt.js";import{_c}from"./chunk-7p8m82pj.js";import{In,qe,Te,da,pa,On}from"./chunk-4xw22xqd.js";import{an,Po}from"./chunk-w7m9pecb.js";import{Nn}from"./chunk-wr7bmkne.js";import{Qt,Zn,Qn}from"./chunk-4z0jpzdq.js";import{G}from"./chunk-yd1j88kp.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Vn():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);el();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=In(y)+qe(y),j=tl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:mn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Ir,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Nn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)an(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Ar(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=$r(t.html,u);if(g.htmlAttrs)t.html=Rr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await On(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=Qn(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Zn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Qt}/`)}let N={runtime:v.filename,router:x.filename},C=da(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Po(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Si(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(_c(e._layerGraph),null,2));pa(C,r);let K=Date.now()-l;return console.log(`
2
+ import{nt}from"./chunk-29f6vmyz.js";import{yt,Un}from"./chunk-q46ay7aq.js";import{Rr,Ar,Pr,Or,Ce}from"./chunk-txd2js5v.js";import{De,hn,el,tl}from"./chunk-qbvy23qa.js";import{M}from"./chunk-vfj9wp11.js";import{Si}from"./chunk-qdagsy5b.js";import{b}from"./chunk-y47n1j5x.js";import{i}from"./chunk-1qgzexkc.js";import{F,a}from"./chunk-ecmvq302.js";import{_c}from"./chunk-amg6kr1p.js";import{On,qe,Te,da,pa,Nn}from"./chunk-gnt1v0kc.js";import{an,Io}from"./chunk-v4kenb7z.js";import{Mn}from"./chunk-fvgk1w9s.js";import{Qt,Qn,er}from"./chunk-s3j5vxy9.js";import{G}from"./chunk-dvyysszs.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Un():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);el();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=On(y)+qe(y),j=tl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:hn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Or,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Mn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)an(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Pr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Rr(t.html,u);if(g.htmlAttrs)t.html=Ar(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Nn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=er(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Qn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Qt}/`)}let N={runtime:v.filename,router:x.filename},C=da(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Io(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Si(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(_c(e._layerGraph),null,2));pa(C,r);let K=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
4
4
  export{om};