@stacksjs/stx 0.2.886 → 0.2.888

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 (211) hide show
  1. package/dist/chunk-000mwmfq.js +1203 -0
  2. package/dist/chunk-043d0en0.js +2 -0
  3. package/dist/{chunk-3cq4a4x7.js → chunk-0d7ypcjb.js} +2 -2
  4. package/dist/{chunk-02qmvcmv.js → chunk-0dq9svfb.js} +2 -2
  5. package/dist/{chunk-cb0c6959.js → chunk-0hj5apb9.js} +1 -1
  6. package/dist/chunk-0w66z6eq.js +2 -0
  7. package/dist/{chunk-n22xtagg.js → chunk-11fxbd71.js} +2 -2
  8. package/dist/chunk-13wd9gf0.js +3 -0
  9. package/dist/{chunk-zch65qrd.js → chunk-1kc0jyhj.js} +1 -1
  10. package/dist/{chunk-ram5944w.js → chunk-1wkp3pks.js} +2 -2
  11. package/dist/{chunk-69ezjc8k.js → chunk-1xpq83mc.js} +4 -4
  12. package/dist/chunk-1znqedae.js +2 -0
  13. package/dist/{chunk-38xckpr9.js → chunk-2assyczz.js} +1 -1
  14. package/dist/{chunk-8kx666yb.js → chunk-2drzzjcm.js} +1 -1
  15. package/dist/{chunk-cd5kgd3s.js → chunk-2rmqmajd.js} +3 -3
  16. package/dist/{chunk-59er0fc7.js → chunk-303vzq80.js} +3 -3
  17. package/dist/{chunk-y9p3b2w0.js → chunk-372xh1g1.js} +4 -4
  18. package/dist/chunk-3c7nt5qp.js +2 -0
  19. package/dist/{chunk-zpj6ggee.js → chunk-3ed2erm6.js} +3 -3
  20. package/dist/{chunk-gbncp2gp.js → chunk-3fbgpv1d.js} +2 -2
  21. package/dist/chunk-3zyzhcd9.js +2 -0
  22. package/dist/chunk-44rb9fk0.js +2 -0
  23. package/dist/chunk-472j3bhp.js +2 -0
  24. package/dist/chunk-4acce1m8.js +2 -0
  25. package/dist/{chunk-2r0nrvqe.js → chunk-4c9p434g.js} +2 -2
  26. package/dist/chunk-4kasmp98.js +2 -0
  27. package/dist/{chunk-e41pgmgk.js → chunk-4nnmrp7w.js} +2 -2
  28. package/dist/{chunk-c47stwqj.js → chunk-52mhrbps.js} +1 -1
  29. package/dist/chunk-53kkjn23.js +2 -0
  30. package/dist/{chunk-7fhtvgqc.js → chunk-55kwxxm5.js} +2 -2
  31. package/dist/chunk-5gwvy612.js +2 -0
  32. package/dist/{chunk-0rdh8bw3.js → chunk-5ymf5c8m.js} +6 -6
  33. package/dist/{chunk-wf09a2z6.js → chunk-5ysv0499.js} +1 -1
  34. package/dist/{chunk-4n45qa0b.js → chunk-605g9qhp.js} +4 -4
  35. package/dist/chunk-61vbqrde.js +2 -0
  36. package/dist/chunk-6fpzwryt.js +2 -0
  37. package/dist/{chunk-0a3qft0p.js → chunk-6fsnnj5v.js} +5 -5
  38. package/dist/{chunk-q74affc4.js → chunk-6qq3wy3m.js} +2 -2
  39. package/dist/{chunk-h63ma36g.js → chunk-6zq3eh7d.js} +2 -2
  40. package/dist/chunk-7195598h.js +2 -0
  41. package/dist/{chunk-czcx3nbx.js → chunk-7hm1tpw0.js} +4 -4
  42. package/dist/{chunk-a7ryj8z8.js → chunk-7nhgpjjw.js} +6 -6
  43. package/dist/{chunk-rvcce9zt.js → chunk-7s3j8pqq.js} +3 -3
  44. package/dist/chunk-7zvf79vb.js +2 -0
  45. package/dist/chunk-88a735jw.js +2 -0
  46. package/dist/chunk-8v7yjq3b.js +2 -0
  47. package/dist/{chunk-463weehv.js → chunk-98mj0es1.js} +1 -1
  48. package/dist/{chunk-6n9y8faw.js → chunk-9qrgdekg.js} +11 -11
  49. package/dist/{chunk-fg67643b.js → chunk-9tecekzq.js} +4 -4
  50. package/dist/chunk-a8c9j9cj.js +2 -0
  51. package/dist/chunk-acw851e8.js +2 -0
  52. package/dist/{chunk-d2pexm3z.js → chunk-ah6nc29h.js} +1 -1
  53. package/dist/chunk-andfvr3g.js +2 -0
  54. package/dist/chunk-ay5zkfdg.js +2 -0
  55. package/dist/{chunk-xpbakn6t.js → chunk-b0jekg4c.js} +2 -2
  56. package/dist/chunk-b4gptdtc.js +2 -0
  57. package/dist/{chunk-agd2b928.js → chunk-b8528fra.js} +2 -2
  58. package/dist/chunk-baaw9w7y.js +2 -0
  59. package/dist/{chunk-d1xx1jy5.js → chunk-btsgt6w3.js} +2 -2
  60. package/dist/chunk-bw2p9h2g.js +2 -0
  61. package/dist/{chunk-jkg6ns57.js → chunk-c1b0fy70.js} +4 -4
  62. package/dist/{chunk-qt39mb2a.js → chunk-c3ca056p.js} +1 -1
  63. package/dist/chunk-ce0vv7kz.js +2 -0
  64. package/dist/chunk-d1yj29g2.js +2 -0
  65. package/dist/{chunk-ftsv4h6f.js → chunk-dbhmbef1.js} +4 -4
  66. package/dist/chunk-dfsykk1r.js +2 -0
  67. package/dist/{chunk-satrf398.js → chunk-dj9ztcth.js} +1 -1
  68. package/dist/{chunk-8cyg4602.js → chunk-e1qcfesw.js} +5 -5
  69. package/dist/{chunk-5fjs602p.js → chunk-e2ws79vt.js} +4 -4
  70. package/dist/chunk-e9p596bp.js +2 -0
  71. package/dist/{chunk-agqj0z54.js → chunk-e9tjxnhn.js} +4 -4
  72. package/dist/{chunk-xma57d6t.js → chunk-edysherg.js} +3 -3
  73. package/dist/{chunk-g2xy0z0e.js → chunk-em6fqvjy.js} +2 -2
  74. package/dist/{chunk-a4e4xbpd.js → chunk-fce8wj3t.js} +1 -1
  75. package/dist/{chunk-q396f1wc.js → chunk-fepezvdq.js} +5 -5
  76. package/dist/chunk-ftecsa8e.js +2 -0
  77. package/dist/{chunk-50cnypys.js → chunk-gdtj5rfa.js} +5 -5
  78. package/dist/chunk-ge2h5v46.js +2 -0
  79. package/dist/chunk-gqvnz8a7.js +2 -0
  80. package/dist/chunk-j41gp8p3.js +2 -0
  81. package/dist/{chunk-12wjs7bn.js → chunk-j51wss7s.js} +1 -1
  82. package/dist/chunk-jxvccj30.js +2 -0
  83. package/dist/chunk-k5bbre7d.js +2 -0
  84. package/dist/chunk-kd47vgs8.js +2 -0
  85. package/dist/chunk-keqjafdz.js +2 -0
  86. package/dist/{chunk-kwf3kfr0.js → chunk-kvxdyg7e.js} +2 -2
  87. package/dist/chunk-kz3mejc4.js +2 -0
  88. package/dist/{chunk-ezna4dhj.js → chunk-mbm3ma63.js} +2 -2
  89. package/dist/{chunk-nmf70gbp.js → chunk-mk6thhwf.js} +2 -2
  90. package/dist/{chunk-6b17yg7a.js → chunk-mm1eg2pg.js} +7 -7
  91. package/dist/chunk-ngkh0t5b.js +2 -0
  92. package/dist/chunk-nx9895m6.js +2 -0
  93. package/dist/chunk-nxgtt1t1.js +2 -0
  94. package/dist/chunk-nyw2ztar.js +2 -0
  95. package/dist/{chunk-vhkq715p.js → chunk-p33npqjt.js} +11 -11
  96. package/dist/chunk-p5q27adr.js +2 -0
  97. package/dist/chunk-pczb7xav.js +2 -0
  98. package/dist/{chunk-rs84k601.js → chunk-pm4kn9h2.js} +6 -6
  99. package/dist/chunk-ps37r6hj.js +2 -0
  100. package/dist/chunk-pvbhk17r.js +2 -0
  101. package/dist/chunk-q252qvsy.js +2 -0
  102. package/dist/{chunk-37dj6p9d.js → chunk-q3bkxg2n.js} +4 -4
  103. package/dist/chunk-q5b0vpmm.js +2 -0
  104. package/dist/{chunk-56kd82yp.js → chunk-qjy5yq25.js} +9 -9
  105. package/dist/{chunk-pdprhg5k.js → chunk-qsnpqa8q.js} +1 -1
  106. package/dist/{chunk-z83pyccp.js → chunk-r561zt9v.js} +3 -3
  107. package/dist/{chunk-ybjgnnyf.js → chunk-r57jz09p.js} +5 -5
  108. package/dist/{chunk-dwyhpbpx.js → chunk-r8xper92.js} +2 -2
  109. package/dist/{chunk-sv7fdqmc.js → chunk-ry6w43p6.js} +6 -6
  110. package/dist/{chunk-e362e615.js → chunk-s7wp7a2x.js} +30 -30
  111. package/dist/chunk-sbr85vda.js +2 -0
  112. package/dist/{chunk-57q4nvs9.js → chunk-sbwvvjkc.js} +3 -3
  113. package/dist/chunk-tkab24xr.js +2 -0
  114. package/dist/{chunk-zpe4zz7r.js → chunk-v47xc2fr.js} +5 -5
  115. package/dist/{chunk-q1mb0fbt.js → chunk-v8e2c2r1.js} +2 -2
  116. package/dist/{chunk-aaea157p.js → chunk-vazk5qbh.js} +2 -2
  117. package/dist/{chunk-6df3j3qq.js → chunk-vgr7gd8k.js} +1 -1
  118. package/dist/{chunk-kee5a3ce.js → chunk-vgsasnwm.js} +2 -2
  119. package/dist/{chunk-vpztm6vk.js → chunk-vjfp8n6p.js} +3 -3
  120. package/dist/chunk-vn59yrjh.js +2 -0
  121. package/dist/{chunk-shcnt6aa.js → chunk-w1q86c89.js} +3 -3
  122. package/dist/{chunk-ws2h92mm.js → chunk-w50yggy3.js} +2 -2
  123. package/dist/{chunk-8e1cv1hh.js → chunk-w624s5jf.js} +3 -3
  124. package/dist/chunk-wa9q1gyv.js +2 -0
  125. package/dist/{chunk-a0q0kb0s.js → chunk-wbxmn5gk.js} +5 -5
  126. package/dist/{chunk-pc8dt8xs.js → chunk-wf8pdjq5.js} +1 -1
  127. package/dist/{chunk-1ey78497.js → chunk-whsdyf4t.js} +6 -6
  128. package/dist/{chunk-wmd952xa.js → chunk-wm287dz2.js} +2 -2
  129. package/dist/{chunk-rsxxajv6.js → chunk-wpa3r3b9.js} +2 -2
  130. package/dist/chunk-wpgxhrd7.js +2 -0
  131. package/dist/{chunk-vkswqg3s.js → chunk-wscry63p.js} +2 -2
  132. package/dist/chunk-x3azrbpr.js +2 -0
  133. package/dist/chunk-x50hk1hq.js +2 -0
  134. package/dist/{chunk-8va3fs07.js → chunk-xavx271y.js} +5 -5
  135. package/dist/chunk-xbkbvfcg.js +2 -0
  136. package/dist/{chunk-295bykzd.js → chunk-xw291tn7.js} +13 -11
  137. package/dist/{chunk-94ctmp0j.js → chunk-xy4j8t7w.js} +2 -2
  138. package/dist/{chunk-zzpg1bg5.js → chunk-y76znqmh.js} +17 -17
  139. package/dist/{chunk-yp4tn4zn.js → chunk-y8p59h6c.js} +4 -4
  140. package/dist/{chunk-s7xywsqd.js → chunk-z55rpt3s.js} +2 -2
  141. package/dist/{chunk-ssg6ne5b.js → chunk-zf29ahhd.js} +4 -4
  142. package/dist/{chunk-6g6pxww1.js → chunk-zje94z0k.js} +9 -9
  143. package/dist/{chunk-3hwdg5mf.js → chunk-znnvq1jp.js} +26 -26
  144. package/dist/{chunk-08cb7cyw.js → chunk-zwde52kw.js} +1 -1
  145. package/dist/chunk-zxff7kq9.js +2 -0
  146. package/dist/cli.js +19 -19
  147. package/dist/component-library.js +118 -21
  148. package/dist/component-renderer.js +1 -1
  149. package/dist/craft-entry.js +2 -2
  150. package/dist/craft.js +2 -2
  151. package/dist/pwa.js +3 -3
  152. package/dist/ssg.js +6 -6
  153. package/package.json +5 -5
  154. package/dist/chunk-0gkxqcpj.js +0 -2
  155. package/dist/chunk-0h1dyd38.js +0 -2
  156. package/dist/chunk-1z6rrqvm.js +0 -2
  157. package/dist/chunk-22sa2r8a.js +0 -2
  158. package/dist/chunk-2b4ds30m.js +0 -2
  159. package/dist/chunk-2m6rf0f8.js +0 -2
  160. package/dist/chunk-3t6cxcys.js +0 -2
  161. package/dist/chunk-4pjqj54a.js +0 -2
  162. package/dist/chunk-53cc06w7.js +0 -2
  163. package/dist/chunk-5519xwrm.js +0 -2
  164. package/dist/chunk-5rd0an89.js +0 -2
  165. package/dist/chunk-6nhm9bep.js +0 -2
  166. package/dist/chunk-7dzhar6y.js +0 -1199
  167. package/dist/chunk-85c2vh7f.js +0 -2
  168. package/dist/chunk-8h5nje66.js +0 -2
  169. package/dist/chunk-9kza7gxd.js +0 -2
  170. package/dist/chunk-a5kr9s4x.js +0 -2
  171. package/dist/chunk-aedm101q.js +0 -2
  172. package/dist/chunk-arf21n16.js +0 -3
  173. package/dist/chunk-asnabfnj.js +0 -2
  174. package/dist/chunk-axra1yas.js +0 -2
  175. package/dist/chunk-bcxwe3e3.js +0 -2
  176. package/dist/chunk-bv415td7.js +0 -2
  177. package/dist/chunk-cv1vm1w0.js +0 -2
  178. package/dist/chunk-d59ywxag.js +0 -2
  179. package/dist/chunk-d7b30bg6.js +0 -2
  180. package/dist/chunk-dyccssdv.js +0 -2
  181. package/dist/chunk-ef01vj6j.js +0 -2
  182. package/dist/chunk-f3j1h3ch.js +0 -2
  183. package/dist/chunk-f4k8bqse.js +0 -2
  184. package/dist/chunk-fz4c5e9m.js +0 -2
  185. package/dist/chunk-gmp10259.js +0 -2
  186. package/dist/chunk-h3fv0q25.js +0 -2
  187. package/dist/chunk-jghpzx5m.js +0 -2
  188. package/dist/chunk-jkgdm99m.js +0 -2
  189. package/dist/chunk-jq97q0f7.js +0 -2
  190. package/dist/chunk-keg5fej5.js +0 -2
  191. package/dist/chunk-kqgspa3s.js +0 -2
  192. package/dist/chunk-n4bwmjj7.js +0 -2
  193. package/dist/chunk-ngzyzcrp.js +0 -2
  194. package/dist/chunk-p5qac909.js +0 -2
  195. package/dist/chunk-pa6kgbmw.js +0 -2
  196. package/dist/chunk-pjjrx9pk.js +0 -2
  197. package/dist/chunk-pt3rp3zg.js +0 -2
  198. package/dist/chunk-ptmvcmd0.js +0 -2
  199. package/dist/chunk-rnyrdpbg.js +0 -2
  200. package/dist/chunk-s7z4at02.js +0 -2
  201. package/dist/chunk-t8r40wgf.js +0 -2
  202. package/dist/chunk-v23x8f5d.js +0 -2
  203. package/dist/chunk-wjafpvjv.js +0 -2
  204. package/dist/chunk-xhr35ctb.js +0 -2
  205. package/dist/chunk-xmmr0916.js +0 -2
  206. package/dist/chunk-ynrjg03j.js +0 -2
  207. package/dist/chunk-ywnqjqns.js +0 -2
  208. package/dist/chunk-z7k1xn6k.js +0 -2
  209. package/dist/chunk-z9x5pn5j.js +0 -2
  210. package/dist/chunk-zfwanbre.js +0 -2
  211. package/dist/chunk-zfx54b65.js +0 -2
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{pt}from"./chunk-agd2b928.js";import{$t,tr}from"./chunk-fg67643b.js";import{he,Tn,kl,_l}from"./chunk-7dzhar6y.js";import{zr,Hr,Vr,Wr,Me}from"./chunk-295bykzd.js";import{F}from"./chunk-6t04tqvh.js";import{Vi}from"./chunk-a4e4xbpd.js";import{x}from"./chunk-rs84k601.js";import{i}from"./chunk-3hwdg5mf.js";import{W,a}from"./chunk-6g6pxww1.js";import{Kc}from"./chunk-ssg6ne5b.js";import{Vn,Un,nt,je,Ia,Oa,Wn}from"./chunk-zpe4zz7r.js";import{wn,Xo}from"./chunk-agqj0z54.js";import{qn}from"./chunk-c73c0wf9.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{ne}from"./chunk-q396f1wc.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?tr():$t(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=pt(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as Q}from"crypto";function ee(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 q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=Q("sha256").update(e).digest("hex").slice(0,16);kl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>he(R))),{context:D}=ee({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...W,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Vn(f)+Un(f)+nt(f),j=_l();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:Tn(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(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 y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(te.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 Pm(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"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Me(e.app?.head,{known:Wr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=qn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)wn(o,w);if(e.runtimeConfig)F(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=ne(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));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=J(n.debug),b=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(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 q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,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,b.filename),t.html=Vr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=zr(t.html,u);if(g.htmlAttrs)t.html=Hr(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 G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await x(t.html),M){let p=await Wn(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=je(t.html,D,!0);let K=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),L=c.join("server","pages",`${K}.compiled.json`),z=c.join("server","fragments",`${K}.html`);await Bun.write(c.join(r,L),JSON.stringify(t,null,2)),await Bun.write(c.join(r,z),t.fragment),O.push({pattern:s.pattern,compiledPath:L,fragmentPath:z,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=dr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",ur));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${pn}/`)}let E={runtime:v.filename,router:b.filename},C=Ia(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Xo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Vi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Kc(e._layerGraph),null,2));Oa(C,r);let N=Date.now()-l;return console.log(`
2
+ import{pt}from"./chunk-b8528fra.js";import{$t,tr}from"./chunk-9tecekzq.js";import{he,Tn,_l,Cl}from"./chunk-000mwmfq.js";import{zr,Hr,Vr,Wr,Me}from"./chunk-xw291tn7.js";import{F}from"./chunk-6t04tqvh.js";import{Vi}from"./chunk-fce8wj3t.js";import{x}from"./chunk-pm4kn9h2.js";import{i}from"./chunk-znnvq1jp.js";import{W,a}from"./chunk-zje94z0k.js";import{Gc}from"./chunk-zf29ahhd.js";import{Vn,Un,nt,je,Oa,Na,Wn}from"./chunk-v47xc2fr.js";import{wn,Xo}from"./chunk-e9tjxnhn.js";import{qn}from"./chunk-c73c0wf9.js";import{pn,ur,dr}from"./chunk-p6hcrg3r.js";import{ne}from"./chunk-fepezvdq.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function J(n=!1){let l=n?tr():$t(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function U(){let n=pt(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import V from"path";import{createHash as Q}from"crypto";function ee(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 q(n,l,o={}){let r=V.resolve(n),e=await Bun.file(r).text(),S=Q("sha256").update(e).digest("hex").slice(0,16);_l();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>he(R))),{context:D}=ee({__filename:r,__dirname:V.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...W,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Vn(f)+Un(f)+nt(f),j=Cl();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:S,status:Tn(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(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 y=m.readdirSync(S,{withFileTypes:!0});for(let d of y){if(te.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 Im(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"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Me(e.app?.head,{known:Wr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=qn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)wn(o,w);if(e.runtimeConfig)F(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=ne(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));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=J(n.debug),b=U();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(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 q(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:y,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,b.filename),t.html=Vr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=zr(t.html,u);if(g.htmlAttrs)t.html=Hr(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 G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await x(t.html),M){let p=await Wn(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=je(t.html,D,!0);let K=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),L=c.join("server","pages",`${K}.compiled.json`),z=c.join("server","fragments",`${K}.html`);await Bun.write(c.join(r,L),JSON.stringify(t,null,2)),await Bun.write(c.join(r,z),t.fragment),O.push({pattern:s.pattern,compiledPath:L,fragmentPath:z,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=dr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",ur));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${pn}/`)}let E={runtime:v.filename,router:b.filename},C=Oa(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Xo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Vi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Gc(e._layerGraph),null,2));Na(C,r);let N=Date.now()-l;return console.log(`
3
3
  [stx build] Done in ${N}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:N}}
4
- export{Pm};
4
+ export{Im};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function we(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function nr(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function zh(e,n=Object.is){return nr(e,{equals:n})}function rr(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function jo(e){C(e)}function ls(e){k.push(e)}function us(e){T.push(e)}function Hh(){O(k,"onMount",T)}function Vh(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Uh(){return{mount:k.length,destroy:T.length}}function sr(e){return typeof e==="function"&&e._isSignal===!0}function or(e){return typeof e==="function"&&e._isDerived===!0}function Bo(e){if(sr(e)||or(e))return m(()=>e());return e}function ds(e){return m(e)}function Wh(e,n){let r=typeof e==="function"?e:()=>e,i=we([]),o=nr(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return rr(()=>{if(r(),!t){t=!0;return}if(ds(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
- export{we,nr,zh,rr,jo,ls,us,Hh,Vh,Uh,sr,or,Bo,ds,Wh};
2
+ var f=null,D=[],v=0,g=new Set;function x(){return f}function S(e){let n=f;return D.push(e),f=e,n}function h(e){D.pop(),f=e}var A=new WeakMap;function w(e,n){A.set(e,n)}function p(e,n){for(let r of e){let i=A.get(r);if(i)i(n);else n.add(r)}}function b(e){if(v>0){p(e,g);return}let n=new Set;p(e,n);for(let r of n)r()}function C(e){v++;try{e()}finally{if(v--,v===0){let n=[...g];g.clear();for(let r of n)r()}}}function m(e){let n=f;f=null;try{return e()}finally{f=n}}var k=[],T=[];function we(e){let n=e,r=new Set,i=new Set,o=()=>{let t=x();if(t)i.add(t);return n};return o.set=(t)=>{if(!Object.is(t,n)){let c=n;n=t,r.forEach((u)=>{try{u(n,c)}catch(l){console.error("[stx] subscriber error:",l)}}),b(i)}},o.update=(t)=>{o.set(t(n))},o.subscribe=(t)=>(r.add(t),()=>r.delete(t)),Object.defineProperty(o,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(o,"value",{get:()=>o(),set:(t)=>o.set(t),configurable:!0}),o}function nr(e,n={}){let r,i=!0,o=!1,t=new Set,c=typeof n.equals==="function"?n.equals:null,u=()=>{let s=S(d);try{r=e(),o=!0}finally{h(s)}i=!1},l=()=>{let s=r,y=o;try{u()}catch{return i=!0,!0}return!y||!c(s,r)},d=()=>{if(i)return;if(c&&t.size){if(l())b(t);return}i=!0,b(t)};w(d,(s)=>{if(i)return;if(c&&t.size){if(l())p(t,s);return}i=!0,p(t,s)});let a=()=>{let s=x();if(s)t.add(s);if(i)u();return r};return Object.defineProperty(a,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(a,"value",{get:()=>a(),configurable:!0}),a}function Hh(e,n=Object.is){return nr(e,{equals:n})}function rr(e,n={}){let r,i=!1,o=()=>{if(i)return;if(r){let c=r;r=void 0;try{c()}catch(u){console.error("[stx] effect cleanup error:",u)}}let t=S(o);try{let c=e();r=typeof c==="function"?c:void 0}catch(c){i=!0,console.error("[stx] effect error (the effect is disposed):",c)}finally{h(t)}};if(n.immediate!==!1)o();return()=>{if(i=!0,r){let t=r;r=void 0,t()}}}function jo(e){C(e)}function ls(e){k.push(e)}function us(e){T.push(e)}function Vh(){O(k,"onMount",T)}function Uh(){O(T,"onDestroy")}function O(e,n,r){let i=e.splice(0,e.length);for(let o of i)try{let t=o();if(r&&typeof t==="function")r.push(t)}catch(t){console.error(`[stx] ${n} callback threw:`,t)}}function Wh(){return{mount:k.length,destroy:T.length}}function sr(e){return typeof e==="function"&&e._isSignal===!0}function or(e){return typeof e==="function"&&e._isDerived===!0}function Bo(e){if(sr(e)||or(e))return m(()=>e());return e}function ds(e){return m(e)}function qh(e,n){let r=typeof e==="function"?e:()=>e,i=we([]),o=nr(()=>i().reduce((u,l)=>n(u,l.action),r())),t=!1;return rr(()=>{if(r(),!t){t=!0;return}if(ds(()=>i().length))i.set([])}),[o,(u,l)=>{let d={action:u};i.set([...i(),d]);let a=()=>{let s=i().filter((y)=>y!==d);if(s.length!==i().length)i.set(s)};if(l&&typeof l.then==="function")Promise.resolve(l).then(a,a);return a}]}
3
+ export{we,nr,Hh,rr,jo,ls,us,Vh,Uh,Wh,sr,or,Bo,ds,qh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Sm}from"./chunk-vjfp8n6p.js";import"./chunk-znnvq1jp.js";import"./chunk-pm4kn9h2.js";import"./chunk-qjy5yq25.js";import"./chunk-c0g30cjs.js";import"./chunk-e1qcfesw.js";import"./chunk-13wd9gf0.js";import"./chunk-edysherg.js";import"./chunk-ah6nc29h.js";import"./chunk-mm1eg2pg.js";import"./chunk-fepezvdq.js";import"./chunk-0hj5apb9.js";import"./chunk-55kwxxm5.js";import"./chunk-52mhrbps.js";import"./chunk-zje94z0k.js";import"./chunk-7s3j8pqq.js";import"./chunk-6zq3eh7d.js";import"./chunk-zf29ahhd.js";import"./chunk-5ymf5c8m.js";import"./chunk-b8528fra.js";import"./chunk-000mwmfq.js";import"./chunk-fce8wj3t.js";import"./chunk-6t04tqvh.js";import"./chunk-xw291tn7.js";import"./chunk-hxhmhw23.js";import"./chunk-kvxdyg7e.js";import"./chunk-s29hp1qw.js";import"./chunk-11fxbd71.js";export{Sm as startInteractive};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ye,F,Gt}from"./chunk-6t04tqvh.js";import{T}from"./chunk-s29hp1qw.js";import{Ct,Le,V,rt,je,Na,No,Ma,Wn}from"./chunk-zpe4zz7r.js";import{Nt,ve,dt}from"./chunk-agd2b928.js";import{Jo}from"./chunk-agqj0z54.js";import{qn}from"./chunk-c73c0wf9.js";import{Te}from"./chunk-q396f1wc.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,z=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),z+=e.length;for(let[a,r]of H){if(z<=J)break;H.delete(a),z-=r.length}}async function zn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",V(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Le(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",V(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function km(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Na(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=qn(r.routeRules),f=new G,h=Jo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?F(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Gt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,dt(c.html)),M.set(n.pattern,Te(c.html));let j=P.join(e,n.fragmentPath);if(rt(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Gt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=ve(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return zn(n,await Ye(m??F(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Le(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Nt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...V(),...N.cache?{}:{"Cache-Control":Ct}}})}}let d=No(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:I,headers:D}=await Wn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return Ma(B,X,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-3t6cxcys.js"),L=new Headers({...V(),...D,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&rt(o,r.routerContainer||"main")){let k=dt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",Te(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return U(S(A&&!d&&rt(o,r.routerContainer||"main")?je(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...V(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",V(w.get("Vary")).Vary),A&&!d&&rt(o,r.routerContainer||"main")){let S=dt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",Te(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(je(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
- export{zn,km};
2
+ import{Ye,F,Gt}from"./chunk-6t04tqvh.js";import{T}from"./chunk-s29hp1qw.js";import{Ct,Le,V,rt,je,Ma,No,Da,Wn}from"./chunk-v47xc2fr.js";import{Nt,ve,dt}from"./chunk-b8528fra.js";import{Jo}from"./chunk-e9tjxnhn.js";import{qn}from"./chunk-c73c0wf9.js";import{$e}from"./chunk-fepezvdq.js";import Z from"fs";import P from"path";var{serve:ae}=globalThis.Bun;import O from"zlib";import{promisify as Y}from"util";var K=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ee=["text/event-stream","multipart/x-mixed-replace"],te=1024;function ne(t){if(!t)return!1;let e=t.toLowerCase();if(ee.some((a)=>e.startsWith(a)))return!1;return K.some((a)=>e.startsWith(a))}function re(t){let e=new Map;for(let a of t.split(",")){let[r,...i]=a.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of i){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function se(t){if(!t)return null;let e=re(t),a=e.get("*"),r=(i)=>e.get(i)??a??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var J=33554432,H=new Map,z=0;function oe(t,e){if(e.length>J/8)return;H.set(t,e),z+=e.length;for(let[a,r]of H){if(z<=J)break;H.delete(a),z-=r.length}}async function zn(t,e,a={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!ne(e.headers.get("content-type")))return e;let r=se(t.headers.get("accept-encoding"));if(!r)return e;let i;try{i=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(i,{status:e.status,statusText:e.statusText,headers:Q(e.headers)});if(i.length<(a.threshold??te))return f();try{let h=a.quality??5,g=`${r}:${h}:${i.length}:${Bun.hash(i)}`,l=H.get(g);if(!l)l=r==="br"?await Y(O.brotliCompress)(i,{params:{[O.constants.BROTLI_PARAM_QUALITY]:h,[O.constants.BROTLI_PARAM_SIZE_HINT]:i.length}}):await Y(O.gzip)(i),oe(g,l);if(l.length>=i.length)return f();let m=Q(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function Q(t){let e=new Headers(t),a=e.get("Vary");if(!a)return e.set("Vary","Accept-Encoding"),e;if(!a.split(",").some((i)=>i.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${a}, Accept-Encoding`);return e}class G{now;entries=new T(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,a){let r,i=async()=>{let s=r??await a();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",V(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return i();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${Le(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,_=async()=>{let s=await a();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",V(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return i();x=_().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):i()}}var ie={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function _m(t={}){let e=P.resolve(t.outputDir||".output"),a=t.port??3000,r=Ma(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let i=qn(r.routeRules),f=new G,h=Jo(e,r.apiRoutes??[]),g=Bun.file(P.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?F(l):void 0,v=new Map,_=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=P.join(e,n.compiledPath),c=JSON.parse(await Bun.file(y).text());if(m)c.html=Gt(c.html,m);v.set(n.pattern,c),x.set(n.pattern,dt(c.html)),M.set(n.pattern,$e(c.html));let j=P.join(e,n.fragmentPath);if(rt(c.html,r.routerContainer||"main")&&await Bun.file(j).exists()){let A=await Bun.file(j).text();_.set(n.pattern,m?Gt(A,m):A)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:c}=ve(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:c})}else s.set(n.pattern,n);let E=ae({port:a,async fetch(n){return zn(n,await Ye(m??F(),async()=>{let c=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[c])return t.apiRoutes[c](n);let j=await h(n);if(j)return j;if((n.method==="GET"||n.method==="HEAD")&&c!=="/"){let p=P.resolve(e,"public"),d;try{d=decodeURIComponent(c)}catch{d=c}if(!d.includes("\x00")){let u=P.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${P.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=P.extname(u).toLowerCase(),B=ie[R]||"application/octet-stream",X=c.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(c);return new Response(Bun.file(u),{headers:{"Content-Type":B,"Cache-Control":X?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let A=Le(n),C=null,q={};if(C=s.get(c)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let o=c.match(p);if(o){C=d,u.forEach((R,B)=>{q[R]=o[B+1]});break}}if(!C){let p=Nt(c)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let N=i(c),W=Object.keys(N).length>0;return f.respond(n,N.cache,async()=>{let p=v.get(C.pattern);if(A&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let o=_.get(C.pattern);if(o){let R=x.get(C.pattern);return new Response(o,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...V(),...N.cache?{}:{"Cache-Control":Ct}}})}}let d=No(n.method),u=v.get(C.pattern);if(!u){let o=s.get("/500")||null;if(o){let R=v.get(o.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...V(),"Cache-Control":"public, max-age=60"}});try{let{html:o,boundaries:R,redirect:B,cookies:X,status:I,headers:D}=await Wn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(B)return Da(B,X,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:U}=await import("./chunk-a8c9j9cj.js"),L=new Headers({...V(),...D,"Cache-Control":"private, no-store"});for(let k of X??[])L.append("Set-Cookie",k);if(A&&!d&&rt(o,r.routerContainer||"main")){let k=dt(o);L.set("X-STX-Fragment","true"),L.set("X-STX-Runtime",$e(o)?"true":"false"),L.set("X-STX-Layout",k.layout),L.set("X-STX-Layout-Group",k.group)}return U(S(A&&!d&&rt(o,r.routerContainer||"main")?je(o,r.routerContainer||"main",!0):o,R,{timeoutMs:30000}),{status:I??u.status??200,headers:L})}let w=new Headers({"Content-Type":"text/html",...V(),...N.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of X??[])w.append("Set-Cookie",S);for(let[S,U]of Object.entries(D??{}))w.set(S,U);if(w.set("Vary",V(w.get("Vary")).Vary),A&&!d&&rt(o,r.routerContainer||"main")){let S=dt(o);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",$e(o)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(je(o,r.routerContainer||"main",!0),{status:I??u.status??200,headers:w})}return new Response(o,{status:I??u.status??200,headers:w})}catch(o){if(console.error(`[stx] Hydration error for ${c}:`,o),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
+ export{zn,_m};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Lo,Bh,Fh}from"./chunk-r561zt9v.js";import"./chunk-dbhmbef1.js";import"./chunk-e9tjxnhn.js";import"./chunk-9f31gs4m.js";import"./chunk-mm1eg2pg.js";import"./chunk-fepezvdq.js";import"./chunk-0hj5apb9.js";import"./chunk-52mhrbps.js";import"./chunk-zje94z0k.js";import"./chunk-7s3j8pqq.js";import"./chunk-6zq3eh7d.js";import"./chunk-zf29ahhd.js";import"./chunk-5ymf5c8m.js";import"./chunk-b8528fra.js";import"./chunk-000mwmfq.js";import"./chunk-fce8wj3t.js";import"./chunk-6t04tqvh.js";import"./chunk-xw291tn7.js";import"./chunk-hxhmhw23.js";import"./chunk-kvxdyg7e.js";import"./chunk-s29hp1qw.js";import"./chunk-11fxbd71.js";export{Fh as clearComposableCache,Bh as getComposableScript,Lo as listComposableModules};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{To,Ca,rs,$o,Ro,Hn,on,Ea,ss,os,Ao,Po,Cm,Em,_t}from"./chunk-605g9qhp.js";export{_t as DeployError,Ca as calculateSha1,rs as collectDeployFiles,os as createDefaultNetlifyConfig,$o as createFileManifest,To as createNetlifyClient,Cm as deploy,ss as detectProjectConfig,Ro as filterRequiredFiles,Hn as formatSize,Ea as generateNetlifyToml,on as getTotalSize,Po as hasNetlifyConfig,Em as initNetlify,Ao as writeNetlifyConfig};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Zm(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
2
+ var d=0;function l(){return`keep-alive-${++d}-${Date.now().toString(36)}`}function Qm(e,t={},n){let i=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(i,(a,c,o)=>{let s=l(),r=u(c||"");return p(s,o.trim(),r)})}function u(e){let t={max:10},n=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,i;while((i=n.exec(e))!==null){let a=i[1],c=i[2]||i[3],o=i[4];switch(a){case"max":t.max=o?parseInt(o,10):10;break;case"include":t.include=c;break;case"exclude":t.exclude=c;break;case"id":t.id=c;break}}return t}function p(e,t,n){let{max:i,include:a,exclude:c}=n,o=n.id||e;return`
3
3
  <div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${o}">
4
4
  <div class="stx-keep-alive-content" data-keep-alive-content="${e}">
5
5
  ${t}
@@ -286,7 +286,7 @@ else {
286
286
  });
287
287
  })();
288
288
  </script>
289
- `}function Qm(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function eh(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function th(){return`
289
+ `}function eh(e={}){return{id:e.id||l(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((n)=>n.trim()):null,exclude:e.exclude?e.exclude.split(",").map((n)=>n.trim()):null}}function th(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function nh(){return`
290
290
  /* STX Keep-Alive Styles */
291
291
  .stx-keep-alive {
292
292
  position: relative;
@@ -311,7 +311,7 @@ else {
311
311
  .stx-keep-alive-content > [data-activated] {
312
312
  opacity: 1;
313
313
  }
314
- `}function nh(){return`
314
+ `}function rh(){return`
315
315
  // STX Keep-Alive Runtime
316
316
  (function() {
317
317
  if (typeof window === 'undefined') return;
@@ -347,5 +347,5 @@ else {
347
347
 
348
348
  console.log('[stx] Keep-alive runtime initialized');
349
349
  })();
350
- `}function rh(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function sh(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
- export{Zm,Qm,eh,th,nh,rh,sh};
350
+ `}function sh(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function oh(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}
351
+ export{Qm,eh,th,nh,rh,sh,oh};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Kl,Gl,Xl,Yg,Zg}from"./chunk-4nnmrp7w.js";export{Gl as auditBuildOutput,Kl as auditConfig,Xl as calculateAuditResult,Zg as formatAuditResult,Yg as runPwaAudit};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{T}from"./chunk-s29hp1qw.js";import{te}from"./chunk-ws2h92mm.js";import{D}from"./chunk-xpbakn6t.js";import De from"path";var n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function J(e){for(let[t,r]of Object.entries(n))if(r===e)return t;return}import lt from"path";var ut={showRelativePaths:!1,enableAutoRecovery:te(),logRecoveryWarnings:!0},Z={...ut};function P(){return{...Z}}function M(e){if(!Z.showRelativePaths||!e)return e;let t=Z.baseDir||process.cwd();try{let r=lt.relative(t,e);return r.startsWith("..")?e:r}catch{return e}}class L extends Error{code;filePath;line;column;context;numericCode;constructor(e,t,r,i,s,o,a){super(e);this.code=t;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||n.EVALUATION_ERROR,this.filePath)this.filePath=M(this.filePath)}}class ae extends L{constructor(e,t,r,i,s,o){super(e,"stx_RUNTIME_ERROR",t,r,i,s,o||n.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Br extends L{constructor(e,t,r,i,s,o){super(e,"stx_FILE_ERROR",t,r,i,s,o||n.FILE_NOT_FOUND);this.name="StxFileError"}}class ee extends L{isFatal=!0;constructor(e,t,r,i,s,o){super(e,"stx_VALIDATION_ERROR",t,r,i,s,o||n.DOM_API_VIOLATION);this.name="StxValidationError"}}function be(e){let{type:t,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,b=a;if(!y&&c&&g!==void 0){let Y=Et(c,g);y=Y.line,b=Y.column}let w=s?M(s):void 0,x=i?J(i):void 0,R={type:t,code:i,codeName:x,message:r,filePath:w,line:y,column:b,snippet:l,suggestion:h,timestamp:new Date().toISOString()},A;switch(f){case"html":A=pt(R);break;case"json":A=JSON.stringify(R,null,2);break;case"console":A=ft(R,c,g);break;case"text":default:A=gt(R,c,g);break}return{formatted:A,data:R}}function gt(e,t,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
2
+ import{T}from"./chunk-s29hp1qw.js";import{te}from"./chunk-w50yggy3.js";import{D}from"./chunk-b0jekg4c.js";import De from"path";var n={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function J(e){for(let[t,r]of Object.entries(n))if(r===e)return t;return}import lt from"path";var ut={showRelativePaths:!1,enableAutoRecovery:te(),logRecoveryWarnings:!0},Z={...ut};function P(){return{...Z}}function M(e){if(!Z.showRelativePaths||!e)return e;let t=Z.baseDir||process.cwd();try{let r=lt.relative(t,e);return r.startsWith("..")?e:r}catch{return e}}class L extends Error{code;filePath;line;column;context;numericCode;constructor(e,t,r,i,s,o,a){super(e);this.code=t;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||n.EVALUATION_ERROR,this.filePath)this.filePath=M(this.filePath)}}class ae extends L{constructor(e,t,r,i,s,o){super(e,"stx_RUNTIME_ERROR",t,r,i,s,o||n.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Br extends L{constructor(e,t,r,i,s,o){super(e,"stx_FILE_ERROR",t,r,i,s,o||n.FILE_NOT_FOUND);this.name="StxFileError"}}class ee extends L{isFatal=!0;constructor(e,t,r,i,s,o){super(e,"stx_VALIDATION_ERROR",t,r,i,s,o||n.DOM_API_VIOLATION);this.name="StxValidationError"}}function be(e){let{type:t,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,b=a;if(!y&&c&&g!==void 0){let Y=Et(c,g);y=Y.line,b=Y.column}let w=s?M(s):void 0,x=i?J(i):void 0,R={type:t,code:i,codeName:x,message:r,filePath:w,line:y,column:b,snippet:l,suggestion:h,timestamp:new Date().toISOString()},A;switch(f){case"html":A=pt(R);break;case"json":A=JSON.stringify(R,null,2);break;case"console":A=ft(R,c,g);break;case"text":default:A=gt(R,c,g);break}return{formatted:A,data:R}}function gt(e,t,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
3
3
  ${e.message}`),t&&e.line){let o=dt(t,e.line,2);if(o)i.push(`
4
4
  ${o}`)}if(e.snippet)i.push(`
5
5
  Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
@@ -24,8 +24,10 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
24
24
  `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let t=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!t.existsSync(i))t.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(t);let s=`${this.formatEntry(e)}
25
25
  `;t.appendFileSync(this.logFilePath,s,"utf-8")}catch(t){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",t)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(t){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",t)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((t)=>t.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((t)=>t.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},t={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";t[s]=(t[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:t}}async exportToFile(e,t="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(t==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
26
26
 
27
- `),"utf-8")}}async flush(){await this.writeQueue}}var q=new Q,Mn={isDevelopment(){return te()},logDetailedError(e,t){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),t)console.error("Context:",t);console.error("========================")},createErrorReport(e,t){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(t)r.push(`Context: ${JSON.stringify(t,null,2)}`);return r.push("========================"),r.join(`
28
- `)}};function k(e,t,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===t)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function Tl(e,t){let r=t,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(t,r),endPos:r}}var xt={maxSanitizeDepth:10,allowBracketNotation:!1},Ce={...xt};var H=/\bnew\s+/,U="__stx_safe_ctors",Te=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],ne=[...Te,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],xe=ne.map(()=>{return}),re=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),se=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,H,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],oe=new Set([...Te,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",U]),ce=new Set(["__proto__","constructor","prototype"]);function Ae(e){let t="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)t+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}t+=a,r.push(o)}return{text:t,map:r}}function _e(e){return Ae(e).text}var Ie=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Oe=(()=>{let e={Date,URL,URLSearchParams},t=Intl;for(let r of Ie)if(typeof t[r]==="function")e[`Intl_${r}`]=t[r];return Object.freeze(Object.assign(Object.create(null),e))})(),wt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,we=/(?<![\w$])new(?![\w$])/g,Se=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ie.join(",")}}() are allowed`;function St(e){let{text:t,map:r}=Ae(e),i=[];we.lastIndex=0;let s;while((s=we.exec(t))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(t.slice(0,a)))continue;let c=wt.exec(t.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in Oe))throw new S(`matched /${H.source}/; ${Se}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==t.slice(a,h))throw new S(`matched /${H.source}/; ${Se}`,e);let b=f+3+c[1].length;i.push({start:b,end:b+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${U}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,t,r){super(r??`Potentially unsafe expression (${e}): ${t}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=t}}function co(e){try{return le(e),null}catch(t){return t instanceof S?t.rule:t instanceof Error?t.message:String(t)}}function Le(e,t){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(oe.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,t);if(o==="."&&ce.has(s))throw new S(`matched /.${s}/; property ${s}`,t)}}function Pe(e,t=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ce.has(f))throw new S(`bracket key ${f}`,e);if(!Ce.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(t&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function le(e){let t=e.trim(),r=_e(t);Le(r,t);let i=Pe(t);for(let s of se){if(s===H)continue;if(s.test(r))throw new S(`matched /${s.source}/`,t)}return{...St(t),dynamicKeys:i}}function Wi(e){return le(e),e.trim()}var lo=Symbol("stx.sanitizeCache"),kt=4000,F=new Map;function vt(e){let t=F.get(e);if(t===void 0){if(t=se.some((r)=>r.test(e)),F.size>=kt)F.clear();F.set(e,t)}return t}function V(e){let t={},r=e[lo];t.Math=Math,t.JSON=JSON,t.Date=Date,t.String=String,t.Number=Number,t.Boolean=Boolean,t.Array=Array,t.Object=re,t.parseInt=Number.parseInt,t.parseFloat=Number.parseFloat,t.isNaN=Number.isNaN,t.isFinite=Number.isFinite,t.encodeURIComponent=encodeURIComponent,t.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||vt(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ie(s),r?.set(s,o);t[i]=o}else t[i]=s}return t}function ie(e,t=0){if(t>=Ce.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ie(i,t+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ie(s,t+1);else r[i]=s}return r}function d(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Wi(e),!0}catch{return!1}}var j=new Set;function $t(e,t,r){if(!t.startsWith("__")||!(t in r))return;let i=`${t}\x00${e}`;if(j.has(i))return;if(j.add(i),j.size>500)j.clear();console.warn(`[stx] a condition reads \`${t}\`, which conditions cannot see, so \`${e.trim()}\` is false and nothing it guards is rendered. Names starting with \`__\` are withheld from @if, @elseif and @unless. Derive a plain value in the server script (for example \`const hasRows = ${t}.length > 0\`) and test that instead.`)}function El(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,(g)=>{o=!0,$t(e,g,t)})(...s);return!o&&Boolean(c)}catch{return!1}}function N(e,t){try{let r=d(e,t);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Fe=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ke=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Rt=0,Ct=0;function Tt(e,t){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=ke;for(let s=0;s<16;s++){let o=`c${++Rt}`,a=`'use strict';if(${r}===${JSON.stringify(ke)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+t);if(c(...i)===o)return c;Ct++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var At=2000,B=new Map;function ve(e,t){let r=`${e.join(",")}\x00${t}`,i=B.get(r);if(i)return i;let s=Tt(e,t);if(B.size>=At)B.clear();return B.set(r,s),s}function ht(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var _t=/^[A-Za-z_$][\w$]*$/;function Xt(e){return _t.test(e)&&!Fe.has(e)}var $e=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,t,r){let i=JSON.stringify([e,t]),s=$e.get(i);if(!s)s=It(e,[...t]),s.sourceBytes+=i.length*2,$e.set(i,s);return Ot(Nt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function It(e,t){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=le(e),o=[];for(let f=0;f<t.length;f++){if(!Xt(t[f]))continue;if(t[f]===U||t[f]==="Object"||oe.has(t[f]))continue;o.push({key:t[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
27
+ `),"utf-8")}}async flush(){await this.writeQueue}}var K=new Q,Mn={isDevelopment(){return te()},logDetailedError(e,t){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),t)console.error("Context:",t);console.error("========================")},createErrorReport(e,t){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(t)r.push(`Context: ${JSON.stringify(t,null,2)}`);return r.push("========================"),r.join(`
28
+ `)}};class Ki{source;pos=0;line=1;column=0;tokens=[];constructor(e){this.source=e}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let e=this.nextToken();if(e)this.tokens.push(e)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let e=this.pos,t=this.line,r=this.column,i=this.source[this.pos];if(/\s/.test(i))return this.readWhitespace(e,t,r);if(i==="/"&&this.peek(1)==="/")return this.readLineComment(e,t,r);if(i==="/"&&this.peek(1)==="*")return this.readBlockComment(e,t,r);if(i==='"'||i==="'")return this.readString(i,e,t,r);if(i==="`")return this.readTemplateString(e,t,r);if(/\d/.test(i)||i==="."&&/\d/.test(this.peek(1)||""))return this.readNumber(e,t,r);if(/[a-z_$]/i.test(i))return this.readIdentifier(e,t,r);if(i==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:e,end:this.pos,line:t,column:r}}if(i==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:e,end:this.pos,line:t,column:r};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:e,end:this.pos,line:t,column:r}}if(i==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:e,end:this.pos,line:t,column:r};if(i==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective(e,t,r);let s=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let o of s)if(this.source.slice(this.pos,this.pos+o.length)===o)return this.advance(o.length),{type:"OPERATOR",value:o,start:e,end:this.pos,line:t,column:r};if(/[+\-*/%<>=!&|^~?:]/.test(i))return this.advance(),{type:"OPERATOR",value:i,start:e,end:this.pos,line:t,column:r};if(/[()[\]{},;.]/.test(i))return this.advance(),{type:"PUNCTUATION",value:i,start:e,end:this.pos,line:t,column:r};return this.advance(),{type:"PUNCTUATION",value:i,start:e,end:this.pos,line:t,column:r}}readWhitespace(e,t,r){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readLineComment(e,t,r){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
29
+ `)this.advance();return{type:"COMMENT",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readBlockComment(e,t,r){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readString(e,t,r,i){this.advance();while(this.pos<this.source.length){let s=this.source[this.pos];if(s==="\\"){this.advance(2);continue}if(s===e){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(t,this.pos),start:t,end:this.pos,line:r,column:i}}readTemplateString(e,t,r){this.advance();let i=0,s=256;while(this.pos<this.source.length){let o=this.source[this.pos];if(o==="\\"){this.advance(2);continue}if(o==="$"&&this.peek(1)==="{"){if(i>=s){this.pos=this.source.length;break}this.advance(2),i++;continue}if(o==="{"&&i>0){i++,this.advance();continue}if(o==="}"&&i>0){i--,this.advance();continue}if(o==="`"&&i===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readNumber(e,t,r){if(this.source[this.pos]==="0"){let i=this.peek(1)?.toLowerCase();if(i==="x"||i==="o"||i==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readIdentifier(e,t,r){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}readDirective(e,t,r){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice(e,this.pos),start:e,end:this.pos,line:t,column:r}}advance(e=1){for(let t=0;t<e&&this.pos<this.source.length;t++){if(this.source[this.pos]===`
30
+ `)this.line++,this.column=0;else this.column++;this.pos++}}peek(e){return this.source[this.pos+e]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState(e){this.pos=e.pos,this.line=e.line,this.column=e.column}}function k(e,t,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===t)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function $l(e,t){let r=t,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(t,r),endPos:r}}var xt={maxSanitizeDepth:10,allowBracketNotation:!1},Ce={...xt};var H=/\bnew\s+/,U="__stx_safe_ctors",Te=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],ne=[...Te,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],xe=ne.map(()=>{return}),re=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),se=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,H,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],oe=new Set([...Te,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",U]),ce=new Set(["__proto__","constructor","prototype"]);function Ae(e){let t="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)t+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}t+=a,r.push(o)}return{text:t,map:r}}function _e(e){return Ae(e).text}var Ie=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],Oe=(()=>{let e={Date,URL,URLSearchParams},t=Intl;for(let r of Ie)if(typeof t[r]==="function")e[`Intl_${r}`]=t[r];return Object.freeze(Object.assign(Object.create(null),e))})(),wt=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,we=/(?<![\w$])new(?![\w$])/g,Se=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Ie.join(",")}}() are allowed`;function St(e){let{text:t,map:r}=Ae(e),i=[];we.lastIndex=0;let s;while((s=we.exec(t))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(t.slice(0,a)))continue;let c=wt.exec(t.slice(a)),g=c?.[3],l=!c?null:g?`Intl_${g}`:c[2];if(!c||!l||!(l in Oe))throw new S(`matched /${H.source}/; ${Se}`,e);let h=a+c[0].length,f=r[a],y=r[h-1]+1;if(e.slice(f,y)!==t.slice(a,h))throw new S(`matched /${H.source}/; ${Se}`,e);let b=f+3+c[1].length;i.push({start:b,end:b+c[2].length,key:l})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${U}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,t,r){super(r??`Potentially unsafe expression (${e}): ${t}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=t}}function co(e){try{return le(e),null}catch(t){return t instanceof S?t.rule:t instanceof Error?t.message:String(t)}}function Le(e,t){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(oe.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,t);if(o==="."&&ce.has(s))throw new S(`matched /.${s}/; property ${s}`,t)}}function Pe(e,t=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),g=/^'(?:[^'\\]|\\.)*'$/.test(c),l=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(g||l){let f=c.slice(1,-1);if(ce.has(f))throw new S(`bracket key ${f}`,e);if(!Ce.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(t&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function le(e){let t=e.trim(),r=_e(t);Le(r,t);let i=Pe(t);for(let s of se){if(s===H)continue;if(s.test(r))throw new S(`matched /${s.source}/`,t)}return{...St(t),dynamicKeys:i}}function Wi(e){return le(e),e.trim()}var lo=Symbol("stx.sanitizeCache"),kt=4000,F=new Map;function vt(e){let t=F.get(e);if(t===void 0){if(t=se.some((r)=>r.test(e)),F.size>=kt)F.clear();F.set(e,t)}return t}function V(e){let t={},r=e[lo];t.Math=Math,t.JSON=JSON,t.Date=Date,t.String=String,t.Number=Number,t.Boolean=Boolean,t.Array=Array,t.Object=re,t.parseInt=Number.parseInt,t.parseFloat=Number.parseFloat,t.isNaN=Number.isNaN,t.isFinite=Number.isFinite,t.encodeURIComponent=encodeURIComponent,t.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||vt(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=ie(s),r?.set(s,o);t[i]=o}else t[i]=s}return t}function ie(e,t=0){if(t>=Ce.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>ie(i,t+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=ie(s,t+1);else r[i]=s}return r}function d(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r);return p(e,i)(...s)}catch{return}}function m(e){try{return Wi(e),!0}catch{return!1}}var j=new Set;function $t(e,t,r){if(!t.startsWith("__")||!(t in r))return;let i=`${t}\x00${e}`;if(j.has(i))return;if(j.add(i),j.size>500)j.clear();console.warn(`[stx] a condition reads \`${t}\`, which conditions cannot see, so \`${e.trim()}\` is false and nothing it guards is rendered. Names starting with \`__\` are withheld from @if, @elseif and @unless. Derive a plain value in the server script (for example \`const hasRows = ${t}.length > 0\`) and test that instead.`)}function Tl(e,t){try{let r=V(t),i=Object.keys(r),s=Object.values(r),o=!1,c=p(e,i,(g)=>{o=!0,$t(e,g,t)})(...s);return!o&&Boolean(c)}catch{return!1}}function N(e,t){try{let r=d(e,t);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Fe=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),ke=`stx-compile-probe:${globalThis.crypto.randomUUID()}`,Rt=0,Ct=0;function Tt(e,t){let r="__stx_compile_probe";while(e.includes(r))r+="_";let i=Array.from({length:e.length+1});i[e.length]=ke;for(let s=0;s<16;s++){let o=`c${++Rt}`,a=`'use strict';if(${r}===${JSON.stringify(ke)})return ${JSON.stringify(o)};`,c=Function(...e,r,a+t);if(c(...i)===o)return c;Ct++}throw Error("[stx] the JavaScript runtime repeatedly returned code compiled from a different source; refusing to evaluate with it.")}var At=2000,B=new Map;function ve(e,t){let r=`${e.join(",")}\x00${t}`,i=B.get(r);if(i)return i;let s=Tt(e,t);if(B.size>=At)B.clear();return B.set(r,s),s}function ht(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var _t=/^[A-Za-z_$][\w$]*$/;function Xt(e){return _t.test(e)&&!Fe.has(e)}var $e=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function p(e,t,r){let i=JSON.stringify([e,t]),s=$e.get(i);if(!s)s=It(e,[...t]),s.sourceBytes+=i.length*2,$e.set(i,s);return Ot(Nt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function It(e,t){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=le(e),o=[];for(let f=0;f<t.length;f++){if(!Xt(t[f]))continue;if(t[f]===U||t[f]==="Object"||oe.has(t[f]))continue;o.push({key:t[f],index:f})}o.sort((f,y)=>f.key<y.key?-1:1);let a=o.map((f)=>f.key),c=o.map((f)=>f.index),g=`
29
31
  'use strict';
30
32
  try {
31
33
  return ${r};
@@ -36,11 +38,11 @@ catch (e) {
36
38
  }
37
39
  throw e;
38
40
  }
39
- `,l=i?(f)=>{let y=ve([U,"Object",...ne,...a,...f],g);return(...b)=>y(Oe,re,...xe,...b)}:(f)=>{let y=ve(["Object",...ne,...a,...f],g);return(...b)=>y(re,...xe,...b)},h=l([]);return{sourceBytes:e.length*2+t.reduce((f,y)=>f+y.length*2,0),contextKeys:t,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function Ot(e,t,r){if(r.length===0)return e;let i=r.map((s)=>t.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ce.has(a))return}return e(...s)}}function Nt(e,t,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(t.length===r.length&&c)return Re(a,t,e,void 0,o);return Re((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},t,e,(l)=>{a=e(l)},o)}function Re(e,t,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(t);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let b=y instanceof Error?y.message:"",w=a.exec(b);if(!(y instanceof ReferenceError)||!w)return;let x=w[1];if(l.has(x)||Fe.has(x)||oe.has(x))return;if(s?.(x),l.add(x),g.push(x),i)i(g);else c=r(g)}return}}function uo(e){let t=e.trim();try{let r=_e(t);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Le(r,t),Pe(t);for(let i of se)if(i.test(r))return!1}catch{return!1}return!0}function Ki(e,t){let r=[];t.lastIndex=0;let i;while((i=t.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=k(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),t.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),t.lastIndex=a+1}return r}function Jt(e,t,r,i){let s="",o=0;for(let a of Ki(e,t)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function Yt(e){let t=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){t.push(s.trim()),s="";continue}s+=a}if(s.trim())t.push(s.trim());return t}function ge(e){let t=e.trim(),r=t[0];if(r!=="'"&&r!=='"'&&r!=="`"||t.length<2||t.at(-1)!==r)return null;let i="";for(let s=1;s<t.length-1;s++){let o=t[s];if(o==="\\"&&s+1<t.length-1){let a=t[++s];i+=a==="n"?`
40
- `:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&t[s+1]==="{")return null;i+=o}return i}var Lt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Zt(e,t){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:n.INVALID_DIRECTIVE_SYNTAX};let i=co(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:n.UNSAFE_EXPRESSION};let s=V(t),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:n.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ht(r))].filter((c)=>!Lt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:n.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:n.EVALUATION_ERROR};return{ok:!0,value:o}}function Ze(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function yt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function je(e){if(!e)return"";return De.isAbsolute(e)?De.relative(process.cwd(),e)||e:e}function ue(e){let t=e.replace(/\s+/g," ").trim();return t.length>80?`${t.slice(0,77)}...`:t}function z(e,t,r,i,s=n.EVALUATION_ERROR){let o=i?` in ${je(i)}`:"";return console.warn(`[stx] ${ue(t)}${o}: ${r}`),u(e,`${ue(t)}: ${r}`,s)}function po(e,t,r){let i=r?` in ${je(r)}`:"";console.warn(`[stx] ${ue(e)}${i}: ${t}`)}function Gi(){return{afterOpen:[],beforeClose:[]}}function Pt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function $l(e,t){if(!Pt(t))return e;let r=t.afterOpen.join(""),i=t.beforeClose.join(""),s=D(e),o=r?Fr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Be=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Fr(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return null;let r=t.index+t[0].length;Be.lastIndex=r;let i=Be.exec(e);return i?r+i[0].length:r}var fe="data-stx-color-mode-boot",ze="__STX_COLOR_MODE__",Mt=new Set(["light","dark","auto","system"]),Ft=new Set(["auto","system"]),Dt=/^[a-z][\w:-]*$/i,jt=/^[\w-]+$/;function Bt(e){let t=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof t!=="string"||t.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Mt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!jt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Dt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Ft.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:t,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function zt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function de(e={}){let t=Bt(e),r=zt(t),i=`(function(){"use strict";var o=window.${ze};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${ze}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${fe}>${i}</script>`}function zr(e,t={}){if(e.includes(fe))return e;let r=pe(e);if(r===null)return e;let i=de(t);return`${e.slice(0,r)}
41
+ `,l=i?(f)=>{let y=ve([U,"Object",...ne,...a,...f],g);return(...b)=>y(Oe,re,...xe,...b)}:(f)=>{let y=ve(["Object",...ne,...a,...f],g);return(...b)=>y(re,...xe,...b)},h=l([]);return{sourceBytes:e.length*2+t.reduce((f,y)=>f+y.length*2,0),contextKeys:t,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function Ot(e,t,r){if(r.length===0)return e;let i=r.map((s)=>t.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ce.has(a))return}return e(...s)}}function Nt(e,t,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(t.length===r.length&&c)return Re(a,t,e,void 0,o);return Re((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},t,e,(l)=>{a=e(l)},o)}function Re(e,t,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(t);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let b=y instanceof Error?y.message:"",w=a.exec(b);if(!(y instanceof ReferenceError)||!w)return;let x=w[1];if(l.has(x)||Fe.has(x)||oe.has(x))return;if(s?.(x),l.add(x),g.push(x),i)i(g);else c=r(g)}return}}function uo(e){let t=e.trim();try{let r=_e(t);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Le(r,t),Pe(t);for(let i of se)if(i.test(r))return!1}catch{return!1}return!0}function Gi(e,t){let r=[];t.lastIndex=0;let i;while((i=t.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=k(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),t.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),t.lastIndex=a+1}return r}function Jt(e,t,r,i){let s="",o=0;for(let a of Gi(e,t)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function Yt(e){let t=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){t.push(s.trim()),s="";continue}s+=a}if(s.trim())t.push(s.trim());return t}function ge(e){let t=e.trim(),r=t[0];if(r!=="'"&&r!=='"'&&r!=="`"||t.length<2||t.at(-1)!==r)return null;let i="";for(let s=1;s<t.length-1;s++){let o=t[s];if(o==="\\"&&s+1<t.length-1){let a=t[++s];i+=a==="n"?`
42
+ `:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&t[s+1]==="{")return null;i+=o}return i}var Lt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Zt(e,t){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:n.INVALID_DIRECTIVE_SYNTAX};let i=co(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:n.UNSAFE_EXPRESSION};let s=V(t),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:n.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ht(r))].filter((c)=>!Lt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:n.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:n.EVALUATION_ERROR};return{ok:!0,value:o}}function Ze(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function yt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function je(e){if(!e)return"";return De.isAbsolute(e)?De.relative(process.cwd(),e)||e:e}function ue(e){let t=e.replace(/\s+/g," ").trim();return t.length>80?`${t.slice(0,77)}...`:t}function z(e,t,r,i,s=n.EVALUATION_ERROR){let o=i?` in ${je(i)}`:"";return console.warn(`[stx] ${ue(t)}${o}: ${r}`),u(e,`${ue(t)}: ${r}`,s)}function po(e,t,r){let i=r?` in ${je(r)}`:"";console.warn(`[stx] ${ue(e)}${i}: ${t}`)}function Xi(){return{afterOpen:[],beforeClose:[]}}function Pt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function Rl(e,t){if(!Pt(t))return e;let r=t.afterOpen.join(""),i=t.beforeClose.join(""),s=D(e),o=r?Fr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Be=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Fr(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return null;let r=t.index+t[0].length;Be.lastIndex=r;let i=Be.exec(e);return i?r+i[0].length:r}var fe="data-stx-color-mode-boot",ze="__STX_COLOR_MODE__",Mt=new Set(["light","dark","auto","system"]),Ft=new Set(["auto","system"]),Dt=/^[a-z][\w:-]*$/i,jt=/^[\w-]+$/;function Bt(e){let t=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof t!=="string"||t.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Mt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!jt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Dt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Ft.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:t,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function zt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function de(e={}){let t=Bt(e),r=zt(t),i=`(function(){"use strict";var o=window.${ze};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${ze}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${fe}>${i}</script>`}function zr(e,t={}){if(e.includes(fe))return e;let r=pe(e);if(r===null)return e;let i=de(t);return`${e.slice(0,r)}
41
43
  ${i}${e.slice(r)}`}var pe=Fr,Ht=new RegExp(`<script\\b[^>]*\\b${fe}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),He=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Ue=/<\/head>/gi;function Ut(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return e;let r=t.index+t[0].length;Ue.lastIndex=r;let i=Ue.exec(e),s=i?i.index:e.length;He.lastIndex=r;let o=He.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
42
- ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function Rl(e){return Vt(Ut(e))}function Vt(e){let t=Ht.exec(e);if(!t)return e;let r=pe(e);if(r===null)return e;if(t.index<=r||e.slice(r,t.index).trim()==="")return e;let i=e.slice(0,t.index)+e.slice(t.index+t[0].length),s=pe(i);if(s===null)return e;return`${i.slice(0,s)}
43
- ${t[0]}${i.slice(s)}`}var Wt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ke=`<style data-stx-cloak>[x-cloak]{display:none !important}${Wt}</style>`,W="data-stx-html-attrs",K="data-stx-html-class",Xe=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function qt(e){let t=/^\s*<meta\b([^>]*)>/i.exec(e);if(!t)return null;let r={};for(let i of t[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,t){return Object.entries(e).filter(([r])=>!t?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function X(e){let t=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?t.replace(/<\//g,"<\\/"):t}function qe(e){let t=_(e,(r)=>r==="content");return`<script${t?` ${t}`:""}>${X(e)}</script>`}function Gt(e={},t="en"){let r=[],i=[],s="",o=t;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!Xe.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${v(String(g))}"`),i.push(l)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${K}="${v(s)}"`;if(i.length)a+=` ${W}="${v(i.join(" "))}"`;return a}function Al(e={},t={}){let r={...e,...t};if(e.class&&t.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of t.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Hr(e,t={}){if(!t||Object.keys(t).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(t)){if(f==null)continue;let y=h.trim();if(!Xe.test(y))continue;let b=y.toLowerCase();if(b==="class"){let w=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(f).split(/\s+/).filter(Boolean))if(!w.includes(x))w.push(x),c.push(x);if(!("class"in i))s.push("class");i.class=w.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),b!=="lang")g.push(y)}if(c.length){if(!(K in i))s.push(K);i[K]=c.join(" ")}if(g.length){if(!(W in i))s.push(W);i[W]=g.join(" ")}let l=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function Pl(e){if(e.includes("data-stx-cloak"))return null;if(D(e)===-1)return null;return`${Ke}
44
+ ${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function Al(e){return Vt(Ut(e))}function Vt(e){let t=Ht.exec(e);if(!t)return e;let r=pe(e);if(r===null)return e;if(t.index<=r||e.slice(r,t.index).trim()==="")return e;let i=e.slice(0,t.index)+e.slice(t.index+t[0].length),s=pe(i);if(s===null)return e;return`${i.slice(0,s)}
45
+ ${t[0]}${i.slice(s)}`}var Wt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ke=`<style data-stx-cloak>[x-cloak]{display:none !important}${Wt}</style>`,W="data-stx-html-attrs",X="data-stx-html-class",Xe=/^[A-Za-z_:][\w:.-]*$/;function v(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Kt(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function qt(e){let t=/^\s*<meta\b([^>]*)>/i.exec(e);if(!t)return null;let r={};for(let i of t[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,t){return Object.entries(e).filter(([r])=>!t?.(r)).map(([r,i])=>`${r}="${v(String(i))}"`).join(" ")}function q(e){let t=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?t.replace(/<\//g,"<\\/"):t}function qe(e){let t=_(e,(r)=>r==="content");return`<script${t?` ${t}`:""}>${q(e)}</script>`}function Gt(e={},t="en"){let r=[],i=[],s="",o=t;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!Xe.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${v(String(g))}"`),i.push(l)}let a=` lang="${v(o)}"`;if(s)a+=` class="${v(s)}"`;if(a+=r.join(""),s)a+=` ${X}="${v(s)}"`;if(i.length)a+=` ${W}="${v(i.join(" "))}"`;return a}function Pl(e={},t={}){let r={...e,...t};if(e.class&&t.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of t.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Hr(e,t={}){if(!t||Object.keys(t).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(t)){if(f==null)continue;let y=h.trim();if(!Xe.test(y))continue;let b=y.toLowerCase();if(b==="class"){let w=(i.class||"").split(/\s+/).filter(Boolean);for(let x of String(f).split(/\s+/).filter(Boolean))if(!w.includes(x))w.push(x),c.push(x);if(!("class"in i))s.push("class");i.class=w.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),b!=="lang")g.push(y)}if(c.length){if(!(X in i))s.push(X);i[X]=c.join(" ")}if(g.length){if(!(W in i))s.push(W);i[W]=g.join(" ")}let l=s.map((h)=>` ${h}="${v(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function Il(e){if(e.includes("data-stx-cloak"))return null;if(D(e)===-1)return null;return`${Ke}
44
46
  `}function Qt(e){let t=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let f=e.indexOf("-->",r);if(f===-1)break;r=f+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let f=e.toLowerCase().indexOf("</script>",r+c[0].length);if(f===-1)break;r=f+9;continue}let g=o.match(/^<link\b[^>]*>/i);if(g){t.push(g[0]),r+=g[0].length;continue}let l=o.match(/^<meta\b[^>]*>/i);if(l){t.push(l[0]),r+=l[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){t.push(h[0]),r+=h[0].length;continue}break}if(t.length===0)return{body:e,hoisted:t};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&t.includes(a[0])){s+=a[0].length;continue}let c=o.match(/^<meta\b[^>]*>/i);if(c&&t.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(g&&t.includes(g[0])){s+=g[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:t}}function en(e,t={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:g="",htmlAttrs:l={},bodyClass:h="",bodyAttrs:f={}}=t,y=r.title||i,b=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],w=new Set(o.map(bt).filter(Boolean)),{body:x,hoisted:R}=Qt(e),A=new Set(R.flatMap((E)=>{let O=qt(E);return O?[bt(O)].filter(Boolean):[]})),tt=[...b.filter((E)=>!w.has(bt(E))),...o].filter((E)=>!A.has(bt(E))).map((E)=>` <meta ${_(E)}>`).join(`
45
47
  `),nt=a.map((E)=>` <link ${_(E)}>`).join(`
46
48
  `),rt=c.map((E)=>{if(E.src)return` <script ${_(E,(O)=>O==="content")}></script>`;if(E.content)return` ${qe(E)}`;return""}).filter(Boolean).join(`
@@ -54,8 +56,8 @@ ${at.join(`
54
56
  ${ct.join(`
55
57
  `)}
56
58
  </body>
57
- </html>`}var me=/\s+/y,he=/<(script|style)\b[^>]*>/iy,tn=/<\/script>/gi,nn=/<\/style>/gi,Ve=/<!DOCTYPE\b/iy,We=/<html[\s>]/iy;function Dn(e){let t=0;while(t<e.length){if(me.lastIndex=t,me.exec(e)){t=me.lastIndex;continue}if(e.startsWith("<!--",t)){let s=e.indexOf("-->",t);if(s===-1)return!1;t=s+3;continue}he.lastIndex=t;let i=he.exec(e);if(i){let s=i[1].toLowerCase()==="script"?tn:nn;s.lastIndex=he.lastIndex;let o=s.exec(e);if(o===null)return!1;t=o.index+o[0].length;continue}if(Ve.lastIndex=t,Ve.test(e))return!0;return We.lastIndex=t,We.test(e)}return!1}function Xi(e){return Dn(e)}function Il(e,t={}){let r=D(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=t,c=e.slice(0,r),g=[];for(let l of i){let h=bt(l);if(h&&c.includes(h))continue;g.push(` <meta ${_(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${_(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${_(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(X(l)))continue;g.push(` ${qe(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
59
+ </html>`}var me=/\s+/y,he=/<(script|style)\b[^>]*>/iy,tn=/<\/script>/gi,nn=/<\/style>/gi,Ve=/<!DOCTYPE\b/iy,We=/<html[\s>]/iy;function Dn(e){let t=0;while(t<e.length){if(me.lastIndex=t,me.exec(e)){t=me.lastIndex;continue}if(e.startsWith("<!--",t)){let s=e.indexOf("-->",t);if(s===-1)return!1;t=s+3;continue}he.lastIndex=t;let i=he.exec(e);if(i){let s=i[1].toLowerCase()==="script"?tn:nn;s.lastIndex=he.lastIndex;let o=s.exec(e);if(o===null)return!1;t=o.index+o[0].length;continue}if(Ve.lastIndex=t,Ve.test(e))return!0;return We.lastIndex=t,We.test(e)}return!1}function Ji(e){return Dn(e)}function Ol(e,t={}){let r=D(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=t,c=e.slice(0,r),g=[];for(let l of i){let h=bt(l);if(h&&c.includes(h))continue;g.push(` <meta ${_(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${_(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${_(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(q(l)))continue;g.push(` ${qe(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
58
60
  `)}
59
- ${e.slice(r)}`}function Vr(e,t={},r={},i){if(i??Xi(e))return e;return en(e,t,r)}var rn=["og:","article:","book:","profile:","fb:","music:","video:"],sn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ur(e,t){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:n.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:n.INVALID_DIRECTIVE_SYNTAX};let r=on(e[0],t);if(typeof r!=="string")return r;let i;if(e.length===2){let o=an(e[1],t);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=t.openGraph,c=t[o]??(yt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:rn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function on(e,t){let r=ge(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:n.INVALID_DIRECTIVE_SYNTAX};if(sn.test(e.trim()))return e.trim();let i=Zt(e,t);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ze(i.value)}`,code:n.TYPE_ERROR};return i.value}function an(e,t){let r=ge(e);if(r!==null)return r;let i=Zt(e,t);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ze(s)}`,code:n.TYPE_ERROR};return String(s)}var Wr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],fo=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],Je={links:"link",metas:"meta",scripts:"script",styles:"style"},Ge=new Set,Ye=new WeakMap;function ye(e){if(Ge.has(e))return;Ge.add(e),console.warn(e)}function cn(e,t){let r=Array.from({length:t.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=t.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===t[o-1]?0:1)),s=a}}return r[t.length]}function ln(e,t){let r=e.toLowerCase(),i=t.find((g)=>g.toLowerCase()===r);if(i)return i;let s=Je[r];if(s&&t.includes(s))return s;let o,a=1/0;for(let g of t){let l=cn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Me(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ye.get(e);if(r)return r;let{known:i,source:s}=t,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=Je[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],ye(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){ye(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=ln(a,i);ye(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ye.set(e,o),o}var C={},un=[],G={};function Ji(){return C}function Iy(){return G}function Oy(){C={},un.length=0,G={}}function Ol(e){C=Qe(C,Me(e,{known:fo,source:"useHead()"}))}function et(e,t,r){let i=[...e||[]];for(let s of t||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Qe(e,t){return{title:t.title??e.title,titleTemplate:t.titleTemplate??e.titleTemplate,base:t.base??e.base,meta:et(e.meta,t.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:et(e.link,t.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...t.script||[]],style:[...e.style||[],...t.style||[]],htmlAttrs:{...e.htmlAttrs,...t.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...t.bodyAttrs}}}function Xg(e){Ol(go(e))}function go(e){let t=[];if(e.description)t.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;t.push({name:"keywords",content:g})}if(e.author)t.push({name:"author",content:e.author});if(e.robots)t.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)t.push({property:"og:title",content:r});if(i)t.push({property:"og:description",content:i});if(e.ogImage){if(t.push({property:"og:image",content:e.ogImage}),e.ogImageType)t.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)t.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)t.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)t.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)t.push({property:"og:url",content:e.ogUrl});if(e.ogType)t.push({property:"og:type",content:e.ogType});if(e.ogSiteName)t.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)t.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)t.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)t.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)t.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)t.push({name:"twitter:card",content:e.twitterCard});if(s)t.push({name:"twitter:title",content:s});if(o)t.push({name:"twitter:description",content:o});if(a){t.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)t.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)t.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)t.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)t.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)t.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)t.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)t.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)t.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:t,link:c}}function Ny(e){if(G={...G,...e},e.title||e.description)Xg({title:e.title,description:e.description})}function My(e){let t=typeof e==="function"?e():e;Ol({title:t})}function Dy(e=C){let t=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);t.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");t.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");t.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");t.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)t.push(`<script ${o}>${X(r)}</script>`);else t.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";t.push(`<style${i}>${r.content}</style>`)}return t.join(`
60
- `)}function Ly(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function jy(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function By(e=C){if(typeof document>"u")return;if(e.title){let t=e.title;if(e.titleTemplate)t=typeof e.titleTemplate==="function"?e.titleTemplate(t):e.titleTemplate.replace("%s",t);document.title=t}for(let t of e.meta||[]){let r=t.name?`meta[name="${t.name}"]`:t.property?`meta[property="${t.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),t.name)i.setAttribute("name",t.name);if(t.property)i.setAttribute("property",t.property);document.head.appendChild(i)}i.setAttribute("content",t.content)}}for(let t of e.link||[]){let r=`link[rel="${t.rel}"]${t.href?`[href="${t.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(t))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[t,r]of Object.entries(e.htmlAttrs))if(t==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(t,r);if(e.bodyAttrs)for(let[t,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(t,r)}function Fy(e){let t="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(t+=s.trim()+`
61
- `,"")),headContent:t.trim()}}function zy(e,t){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:t[(o||"").trim()]??o,c=t.__stx_runtime_head??{};return t.__stx_runtime_head=Qe(c,{title:a}),""})}function Hy(e,t,r=""){if(!e.includes("@meta"))return e;return Jt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ur(Yt(i),t);if(o.kind==="error")return z("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=t.__stx_runtime_head??{};t.__stx_runtime_head=Qe(a,{meta:[o.tag]})}return""},(i)=>z("Meta",i,"the call has no closing parenthesis",r,n.INVALID_DIRECTIVE_SYNTAX))}export{co,Wi,lo,d,m,El,N,ht,Xt,p,uo,n,ae,Br,ee,u,Ne,qi,q,Mn,k,Tl,Ki,Jt,Yt,Zt,Ze,yt,z,po,Gi,$l,Fr,zr,Rl,bt,Al,Hr,Pl,Dn,Xi,Il,Vr,Ur,Wr,fo,Me,Ji,Iy,Oy,Ol,Qe,Xg,go,Ny,My,Dy,Ly,jy,By,Fy,zy,Hy};
61
+ ${e.slice(r)}`}function Vr(e,t={},r={},i){if(i??Ji(e))return e;return en(e,t,r)}var rn=["og:","article:","book:","profile:","fb:","music:","video:"],sn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ur(e,t){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:n.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:n.INVALID_DIRECTIVE_SYNTAX};let r=on(e[0],t);if(typeof r!=="string")return r;let i;if(e.length===2){let o=an(e[1],t);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=t.openGraph,c=t[o]??(yt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:rn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function on(e,t){let r=ge(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:n.INVALID_DIRECTIVE_SYNTAX};if(sn.test(e.trim()))return e.trim();let i=Zt(e,t);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ze(i.value)}`,code:n.TYPE_ERROR};return i.value}function an(e,t){let r=ge(e);if(r!==null)return r;let i=Zt(e,t);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ze(s)}`,code:n.TYPE_ERROR};return String(s)}var Wr=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],fo=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],Je={links:"link",metas:"meta",scripts:"script",styles:"style"},Ge=new Set,Ye=new WeakMap;function ye(e){if(Ge.has(e))return;Ge.add(e),console.warn(e)}function cn(e,t){let r=Array.from({length:t.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=t.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===t[o-1]?0:1)),s=a}}return r[t.length]}function ln(e,t){let r=e.toLowerCase(),i=t.find((g)=>g.toLowerCase()===r);if(i)return i;let s=Je[r];if(s&&t.includes(s))return s;let o,a=1/0;for(let g of t){let l=cn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Me(e,t){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Ye.get(e);if(r)return r;let{known:i,source:s}=t,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=Je[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],ye(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){ye(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=ln(a,i);ye(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return Ye.set(e,o),o}var C={},un=[],G={};function Yi(){return C}function Oy(){return G}function Ny(){C={},un.length=0,G={}}function Nl(e){C=Qe(C,Me(e,{known:fo,source:"useHead()"}))}function et(e,t,r){let i=[...e||[]];for(let s of t||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Qe(e,t){return{title:t.title??e.title,titleTemplate:t.titleTemplate??e.titleTemplate,base:t.base??e.base,meta:et(e.meta,t.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:et(e.link,t.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...t.script||[]],style:[...e.style||[],...t.style||[]],htmlAttrs:{...e.htmlAttrs,...t.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...t.bodyAttrs}}}function Jg(e){Nl(go(e))}function go(e){let t=[];if(e.description)t.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;t.push({name:"keywords",content:g})}if(e.author)t.push({name:"author",content:e.author});if(e.robots)t.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)t.push({property:"og:title",content:r});if(i)t.push({property:"og:description",content:i});if(e.ogImage){if(t.push({property:"og:image",content:e.ogImage}),e.ogImageType)t.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)t.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)t.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)t.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)t.push({property:"og:url",content:e.ogUrl});if(e.ogType)t.push({property:"og:type",content:e.ogType});if(e.ogSiteName)t.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)t.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)t.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)t.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)t.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)t.push({name:"twitter:card",content:e.twitterCard});if(s)t.push({name:"twitter:title",content:s});if(o)t.push({name:"twitter:description",content:o});if(a){t.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)t.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)t.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)t.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)t.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)t.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)t.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)t.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)t.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:t,link:c}}function My(e){if(G={...G,...e},e.title||e.description)Jg({title:e.title,description:e.description})}function Dy(e){let t=typeof e==="function"?e():e;Nl({title:t})}function Ly(e=C){let t=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);t.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");t.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");t.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");t.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)t.push(`<script ${o}>${q(r)}</script>`);else t.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";t.push(`<style${i}>${r.content}</style>`)}return t.join(`
62
+ `)}function jy(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function By(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([t,r])=>`${t}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Fy(e=C){if(typeof document>"u")return;if(e.title){let t=e.title;if(e.titleTemplate)t=typeof e.titleTemplate==="function"?e.titleTemplate(t):e.titleTemplate.replace("%s",t);document.title=t}for(let t of e.meta||[]){let r=t.name?`meta[name="${t.name}"]`:t.property?`meta[property="${t.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),t.name)i.setAttribute("name",t.name);if(t.property)i.setAttribute("property",t.property);document.head.appendChild(i)}i.setAttribute("content",t.content)}}for(let t of e.link||[]){let r=`link[rel="${t.rel}"]${t.href?`[href="${t.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(t))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[t,r]of Object.entries(e.htmlAttrs))if(t==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(t,r);if(e.bodyAttrs)for(let[t,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(t,r)}function zy(e){let t="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(t+=s.trim()+`
63
+ `,"")),headContent:t.trim()}}function Hy(e,t){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:t[(o||"").trim()]??o,c=t.__stx_runtime_head??{};return t.__stx_runtime_head=Qe(c,{title:a}),""})}function Vy(e,t,r=""){if(!e.includes("@meta"))return e;return Jt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ur(Yt(i),t);if(o.kind==="error")return z("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=t.__stx_runtime_head??{};t.__stx_runtime_head=Qe(a,{meta:[o.tag]})}return""},(i)=>z("Meta",i,"the call has no closing parenthesis",r,n.INVALID_DIRECTIVE_SYNTAX))}export{co,Wi,lo,d,m,Tl,N,ht,Xt,p,uo,n,ae,Br,ee,u,Ne,qi,K,Mn,Ki,k,$l,Gi,Jt,Yt,Zt,Ze,yt,z,po,Xi,Rl,Fr,zr,Al,bt,Pl,Hr,Il,Dn,Ji,Ol,Vr,Ur,Wr,fo,Me,Yi,Oy,Ny,Nl,Qe,Jg,go,My,Dy,Ly,jy,By,Fy,zy,Hy,Vy};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function tu(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function vm(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await tu(r,l.join(n,`${m}.${s}`),t))}return i}
3
- export{tu,vm};
2
+ var{WebView:p}=globalThis.Bun;import{existsSync as y,mkdirSync as b,readdirSync as v,statSync as S}from"fs";import l from"path";var h=16384;function M(e){if(/^https?:\/\//.test(e)||e.startsWith("file://"))return e;return`file://${l.resolve(e)}`}function g(e,n,t,o){return new Promise((s)=>{let i=!1,r,m,c=()=>{if(!i){if(i=!0,clearTimeout(m),r)clearTimeout(r);e.onNavigated=void 0,s()}};m=setTimeout(c,o),e.onNavigated=()=>{if(!i)r=setTimeout(c,t)};try{let u=e.navigate(n);if(u&&typeof u.catch==="function")u.catch(c)}catch{c()}})}async function w(e,n,t){let o=`!!document.querySelector(${JSON.stringify(n)})`,s=Date.now()+t;while(Date.now()<s){try{if(await e.evaluate(o))return}catch{}await new Promise((i)=>setTimeout(i,100))}}async function T(e){try{let n=await e.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof n==="number"&&Number.isFinite(n)&&n>0?Math.min(n,h):0}catch{return 0}}async function nu(e,n,t={}){let o=Math.min(t.width??1440,h),s=Math.min(t.height??2200,h),i=t.waitMs??800,r=t.timeoutMs??15000,m=t.format??"png",c=M(e),u=(f)=>new p({width:o,height:f,headless:!0,...t.backend?{backend:t.backend}:{}}),a=u(s);try{if(await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r);if(t.fullPage){let d=await T(a);if(d>s){if(a.close(),a=u(d),await g(a,c,i,r),t.waitSelector)await w(a,t.waitSelector,r)}}let f=await a.screenshot({encoding:"buffer",format:m});b(l.dirname(l.resolve(n)),{recursive:!0}),await Bun.write(n,f)}finally{a.close()}if(!y(n))throw Error(`Screenshot was not produced for ${e}`);return{input:e,output:n,bytes:S(n).size}}async function xm(e,n,t={}){b(n,{recursive:!0});let o;if(!/^https?:\/\//.test(e)&&y(e)&&S(e).isDirectory())o=v(e).filter((r)=>r.endsWith(".html")).map((r)=>l.join(e,r));else o=[e];let s=t.format??"png",i=[];for(let r of o){let m=/^https?:\/\//.test(r)?new URL(r).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":l.basename(r).replace(/\.html?$/,"");i.push(await nu(r,l.join(n,`${m}.${s}`),t))}return i}
3
+ export{nu,xm};