@stacksjs/stx 0.2.785 → 0.2.788

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 (205) hide show
  1. package/dist/{chunk-kk7seavb.js → chunk-05taafth.js} +3 -3
  2. package/dist/{chunk-cfpw4c6b.js → chunk-0r61tkfe.js} +2 -2
  3. package/dist/{chunk-m4mpyq3d.js → chunk-14ft0zc7.js} +3 -3
  4. package/dist/chunk-1brkqd5f.js +2 -0
  5. package/dist/{chunk-9tec9eap.js → chunk-1y9ez7nz.js} +2 -2
  6. package/dist/{chunk-rzb6bdby.js → chunk-2hm4nmt9.js} +6 -6
  7. package/dist/{chunk-k0aejzg9.js → chunk-2p4yad7w.js} +4 -4
  8. package/dist/chunk-2vxh8b8g.js +2 -0
  9. package/dist/{chunk-05xa75nb.js → chunk-2yexd919.js} +5 -5
  10. package/dist/chunk-33na85q2.js +2 -0
  11. package/dist/{chunk-2z69cw5m.js → chunk-3772atqp.js} +5 -5
  12. package/dist/{chunk-qby3e5nm.js → chunk-3gn1t0pa.js} +29 -29
  13. package/dist/chunk-3n03m9w0.js +2 -0
  14. package/dist/chunk-3t4t655h.js +2 -0
  15. package/dist/chunk-43ynckvh.js +2 -0
  16. package/dist/{chunk-3ywnsdha.js → chunk-4dd0yecs.js} +4 -4
  17. package/dist/{chunk-e1gxykm8.js → chunk-4s5q1aea.js} +4 -4
  18. package/dist/chunk-4v22nj67.js +2 -0
  19. package/dist/chunk-4vxz57e1.js +2 -0
  20. package/dist/{chunk-bj1dmqa1.js → chunk-4yhsmwcc.js} +1 -1
  21. package/dist/{chunk-ra8f8sm2.js → chunk-59tbk9qj.js} +4 -4
  22. package/dist/{chunk-w9d18r1t.js → chunk-5a92srn2.js} +1 -1
  23. package/dist/chunk-5d2dnhsf.js +2 -0
  24. package/dist/{chunk-cz8mka1b.js → chunk-5j619xgb.js} +2 -2
  25. package/dist/chunk-5jqcs1fz.js +2 -0
  26. package/dist/{chunk-5behs1dk.js → chunk-67ezpess.js} +1 -1
  27. package/dist/chunk-699t603m.js +2 -0
  28. package/dist/chunk-6f6xqzhb.js +2 -0
  29. package/dist/{chunk-yazy1vk7.js → chunk-6sgqa52q.js} +5 -5
  30. package/dist/{chunk-r1jzbqr3.js → chunk-6v4b0xc1.js} +5 -5
  31. package/dist/{chunk-dt4435zf.js → chunk-6vqz4qqy.js} +2 -2
  32. package/dist/{chunk-bgc2fm73.js → chunk-74rf78w8.js} +2 -2
  33. package/dist/{chunk-et1vz3wd.js → chunk-7pk3t82j.js} +2 -2
  34. package/dist/chunk-7w3p07yp.js +2 -0
  35. package/dist/{chunk-tk08pr4b.js → chunk-8p65gzw0.js} +2 -2
  36. package/dist/chunk-8pphy0p1.js +2 -0
  37. package/dist/chunk-8qex68bk.js +2 -0
  38. package/dist/{chunk-bq9xf8nq.js → chunk-94gyfwpz.js} +8 -8
  39. package/dist/chunk-9cyfq8mn.js +2 -0
  40. package/dist/chunk-9dzgkt5x.js +2 -0
  41. package/dist/{chunk-8yjmf3gv.js → chunk-9h532cqf.js} +5 -5
  42. package/dist/chunk-9pkazxn1.js +2 -0
  43. package/dist/{chunk-gm9cag4s.js → chunk-9pkx13hy.js} +3 -3
  44. package/dist/{chunk-7d7aj7rh.js → chunk-9ppsnerc.js} +2 -2
  45. package/dist/{chunk-y5f04xtb.js → chunk-9tqa8xvf.js} +2 -2
  46. package/dist/chunk-9wmjmas8.js +2 -0
  47. package/dist/chunk-a1kvc52k.js +2 -0
  48. package/dist/{chunk-x8anspa5.js → chunk-agtvdtx4.js} +2 -2
  49. package/dist/{chunk-yzs2afn7.js → chunk-b4r7d6me.js} +3 -3
  50. package/dist/{chunk-4wc5pc19.js → chunk-bwcj9z19.js} +2 -2
  51. package/dist/{chunk-ghfw9cgr.js → chunk-bwvnstrd.js} +3 -3
  52. package/dist/chunk-c7e78z00.js +2 -0
  53. package/dist/chunk-cdsv4yrv.js +2 -0
  54. package/dist/chunk-d5e47gr4.js +2 -0
  55. package/dist/chunk-d910ytt2.js +2 -0
  56. package/dist/chunk-d9p7xaj7.js +2 -0
  57. package/dist/{chunk-y38swh5t.js → chunk-dhqp3z4w.js} +2 -2
  58. package/dist/chunk-dk53ytvr.js +3 -0
  59. package/dist/{chunk-7w1373q6.js → chunk-dwrjs05v.js} +5 -5
  60. package/dist/{chunk-kf8hzvb7.js → chunk-e3wmnjz8.js} +3 -3
  61. package/dist/{chunk-hpt354jm.js → chunk-ebxmj4q2.js} +5 -5
  62. package/dist/chunk-ee2jz9xp.js +2 -0
  63. package/dist/{chunk-0q2v7k1m.js → chunk-epg3gkc6.js} +2 -2
  64. package/dist/{chunk-z2m9p8xe.js → chunk-es006emk.js} +2 -2
  65. package/dist/chunk-fd572s2h.js +2 -0
  66. package/dist/{chunk-dyn8hwy1.js → chunk-fgz2kbwb.js} +4 -4
  67. package/dist/chunk-fkkdt6sj.js +2 -0
  68. package/dist/chunk-fpvhmwqj.js +2 -0
  69. package/dist/chunk-fxy0cq7h.js +2 -0
  70. package/dist/chunk-g6smtcc0.js +2 -0
  71. package/dist/{chunk-9f6qx8b9.js → chunk-gb65t4n1.js} +2 -2
  72. package/dist/chunk-gkqx3p8n.js +2 -0
  73. package/dist/{chunk-e0ze9x4e.js → chunk-gp5japjb.js} +2 -2
  74. package/dist/{chunk-eapt899m.js → chunk-gv3bfkdm.js} +5 -5
  75. package/dist/{chunk-ya150593.js → chunk-gwzp463h.js} +2 -2
  76. package/dist/{chunk-ady8cnpb.js → chunk-h0c6jtrj.js} +4 -4
  77. package/dist/{chunk-zxfptbac.js → chunk-h0jnatd4.js} +2 -2
  78. package/dist/chunk-h88p9w9x.js +2 -0
  79. package/dist/chunk-hb7phtn2.js +2 -0
  80. package/dist/chunk-hexa0j1j.js +2 -0
  81. package/dist/{chunk-7rtcmxhd.js → chunk-j10mdh4g.js} +4 -4
  82. package/dist/{chunk-x27rzb5w.js → chunk-jf4kesf8.js} +1 -1
  83. package/dist/{chunk-rhpn4s5s.js → chunk-kb2xxmxp.js} +1 -1
  84. package/dist/chunk-kbaay11r.js +2 -0
  85. package/dist/{chunk-20afyff6.js → chunk-kce6pzmj.js} +2 -2
  86. package/dist/{chunk-2b34ce4g.js → chunk-khndcwxy.js} +1 -1
  87. package/dist/chunk-kn38mjpp.js +2 -0
  88. package/dist/chunk-kvmpc0sg.js +2 -0
  89. package/dist/chunk-mymnmr1m.js +2 -0
  90. package/dist/{chunk-t3wfrb5x.js → chunk-nb8czvz1.js} +16 -16
  91. package/dist/chunk-nf2bzqaw.js +2 -0
  92. package/dist/chunk-npm22znd.js +2 -0
  93. package/dist/{chunk-9ba2z5fe.js → chunk-ns1hpm7x.js} +4 -4
  94. package/dist/chunk-p2r6rbs4.js +2 -0
  95. package/dist/chunk-p45s8mwh.js +2 -0
  96. package/dist/{chunk-9ct3gbyv.js → chunk-pa9zfbh6.js} +6 -6
  97. package/dist/{chunk-j2qv5ra2.js → chunk-q14d714d.js} +2 -2
  98. package/dist/{chunk-mjpv9r5m.js → chunk-qadv0nrt.js} +10 -10
  99. package/dist/chunk-qbmy60z0.js +2 -0
  100. package/dist/{chunk-tyjzye2d.js → chunk-qp3xd98j.js} +1 -1
  101. package/dist/{chunk-he85ksa7.js → chunk-qv85c3qy.js} +1 -1
  102. package/dist/chunk-qzb0v08n.js +2 -0
  103. package/dist/{chunk-gbx5vw81.js → chunk-rrb9m2q2.js} +5 -5
  104. package/dist/{chunk-yzapw5rk.js → chunk-s14v17b5.js} +13 -13
  105. package/dist/chunk-s1wdzttg.js +2 -0
  106. package/dist/{chunk-w6gfpxz3.js → chunk-se44k8bp.js} +1 -1
  107. package/dist/chunk-shmm7135.js +2 -0
  108. package/dist/{chunk-3vzee3z9.js → chunk-t271s8p9.js} +3 -3
  109. package/dist/chunk-th5afzmv.js +2 -0
  110. package/dist/chunk-tktkj2dc.js +2 -0
  111. package/dist/{chunk-5mng4x26.js → chunk-tnkxww7b.js} +5 -5
  112. package/dist/{chunk-td3qp5my.js → chunk-tnn0br4w.js} +3 -3
  113. package/dist/{chunk-qfcn4btf.js → chunk-v1z6n7wz.js} +1 -1
  114. package/dist/{chunk-vct6dec8.js → chunk-v8rfeev5.js} +2 -2
  115. package/dist/chunk-vgzfsh1z.js +2 -0
  116. package/dist/{chunk-416jy1m5.js → chunk-vkn133cs.js} +2 -2
  117. package/dist/{chunk-sxwgq49z.js → chunk-vrbcdds3.js} +1 -1
  118. package/dist/{chunk-ss2mk7zm.js → chunk-vrw1qs1j.js} +9 -9
  119. package/dist/chunk-w1xzkkk3.js +2 -0
  120. package/dist/{chunk-wj78td69.js → chunk-w5hhqjwr.js} +1 -1
  121. package/dist/{chunk-x8js27hd.js → chunk-w9nwb8r3.js} +6 -6
  122. package/dist/chunk-wjcph0yf.js +2 -0
  123. package/dist/chunk-wr3adhd8.js +2 -0
  124. package/dist/{chunk-mhkftysj.js → chunk-y38rxnrr.js} +3 -3
  125. package/dist/{chunk-tmd1qwx7.js → chunk-y8wer7e1.js} +61 -61
  126. package/dist/chunk-yehq3z73.js +2 -0
  127. package/dist/{chunk-tx628jpx.js → chunk-yrqy4vka.js} +2 -2
  128. package/dist/{chunk-6mj7fx2x.js → chunk-z9h2s292.js} +3 -3
  129. package/dist/chunk-zd6cygn3.js +2 -0
  130. package/dist/chunk-zdwnzq78.js +2 -0
  131. package/dist/chunk-zyf6737j.js +2 -0
  132. package/dist/cli.js +12 -12
  133. package/dist/craft-entry.js +2 -2
  134. package/dist/craft.js +2 -2
  135. package/dist/expressions.js +2 -2
  136. package/dist/native/bridge/protocol.d.ts +2 -0
  137. package/dist/native/runtime/jsc-globals.js +16 -0
  138. package/dist/native/runtime/native-host.js +41 -6
  139. package/dist/native/runtime/native-media.d.ts +39 -0
  140. package/dist/native/runtime/native-media.js +144 -0
  141. package/dist/native/runtime/shared-screen.js +3 -0
  142. package/dist/native/testing.js +7 -2
  143. package/dist/pwa.js +3 -3
  144. package/dist/ssg.js +3 -3
  145. package/dist/utils.d.ts +1 -8
  146. package/dist/utils.js +11 -3
  147. package/package.json +5 -5
  148. package/dist/chunk-0vm1ys7q.js +0 -2
  149. package/dist/chunk-2vnhyter.js +0 -2
  150. package/dist/chunk-462dyzmx.js +0 -2
  151. package/dist/chunk-47qestfz.js +0 -2
  152. package/dist/chunk-4kx7pw6x.js +0 -2
  153. package/dist/chunk-4te06cpw.js +0 -2
  154. package/dist/chunk-4wsdx9vy.js +0 -2
  155. package/dist/chunk-4yr14p2w.js +0 -2
  156. package/dist/chunk-65s4mjxb.js +0 -2
  157. package/dist/chunk-713az4kg.js +0 -2
  158. package/dist/chunk-7y2h7nfd.js +0 -2
  159. package/dist/chunk-7y6ad89y.js +0 -2
  160. package/dist/chunk-8ds59ttd.js +0 -2
  161. package/dist/chunk-8pyyqev1.js +0 -2
  162. package/dist/chunk-9896204h.js +0 -2
  163. package/dist/chunk-9fh3h9p3.js +0 -2
  164. package/dist/chunk-9qwkyt81.js +0 -2
  165. package/dist/chunk-bancsgvx.js +0 -2
  166. package/dist/chunk-c91y14ae.js +0 -2
  167. package/dist/chunk-cpq9b0fx.js +0 -2
  168. package/dist/chunk-cqv28wmk.js +0 -2
  169. package/dist/chunk-d1ngw481.js +0 -2
  170. package/dist/chunk-dcnjpjc1.js +0 -2
  171. package/dist/chunk-dxp022r0.js +0 -2
  172. package/dist/chunk-e3y78men.js +0 -2
  173. package/dist/chunk-evshahyj.js +0 -2
  174. package/dist/chunk-gbgbhpms.js +0 -2
  175. package/dist/chunk-gd6hxe85.js +0 -2
  176. package/dist/chunk-hef2dr38.js +0 -2
  177. package/dist/chunk-jazkazdy.js +0 -2
  178. package/dist/chunk-k8srkymx.js +0 -2
  179. package/dist/chunk-k9dg3nyy.js +0 -2
  180. package/dist/chunk-m627y6xq.js +0 -2
  181. package/dist/chunk-m90wyzhd.js +0 -2
  182. package/dist/chunk-mcevnfnx.js +0 -2
  183. package/dist/chunk-mxbzqyvp.js +0 -2
  184. package/dist/chunk-nx20kccb.js +0 -2
  185. package/dist/chunk-p43hw6ef.js +0 -2
  186. package/dist/chunk-pxfrshr6.js +0 -2
  187. package/dist/chunk-q0v6y356.js +0 -2
  188. package/dist/chunk-q71qqjy7.js +0 -2
  189. package/dist/chunk-qe9dqhpr.js +0 -2
  190. package/dist/chunk-s53psb1j.js +0 -2
  191. package/dist/chunk-t482tgm6.js +0 -2
  192. package/dist/chunk-t619ap22.js +0 -2
  193. package/dist/chunk-t61m22mj.js +0 -2
  194. package/dist/chunk-thajeb3z.js +0 -2
  195. package/dist/chunk-wm8wz183.js +0 -2
  196. package/dist/chunk-x0e0pcn0.js +0 -2
  197. package/dist/chunk-x756yzrc.js +0 -2
  198. package/dist/chunk-xgvsaj4e.js +0 -2
  199. package/dist/chunk-xq2tfg4v.js +0 -2
  200. package/dist/chunk-ycyn0jrr.js +0 -2
  201. package/dist/chunk-yehbnf0t.js +0 -2
  202. package/dist/chunk-yrdxvphr.js +0 -2
  203. package/dist/chunk-z9678kfn.js +0 -2
  204. package/dist/chunk-zh8w0nb6.js +0 -2
  205. package/dist/chunk-zj3dz854.js +0 -3
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function M(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return M(e.replace(/^\//,""))}function ei(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
3
3
  `),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function ti(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
4
- `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function St(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ue(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function pr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Es(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ue(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class fr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:X,params:P}=ue(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:X,params:P,filePath:h,isDynamic:P.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");ei(this.routes,s),ti(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ts(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function $s(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Bf(e){k=e.replace(/\/$/,"")}function Ff(e,t,a={}){f[e]={path:t,name:e,params:a}}function zf(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function gr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Hf(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import q from"path";function Vf(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Uf(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Wf(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function xc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Sc(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function kc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ni(e,t){v.set(e,t)}function _c(e){return v.get(e)}function qf(e){return v.has(e)}function kt(){v.clear()}function _t(){return Array.from(v.keys())}async function Ct(e,t="middleware"){let a=q.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ni(o,s);else if(typeof s==="function")ni(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Et(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Tt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?xc(a,i):Sc(),storage:kc(),state:{},request:a,responseHeaders:i}}async function $t(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=_c(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Rs(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function et(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Rs(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
4
+ `))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function St(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function ue(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function pr(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function Es(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ue(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function F(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...F(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class fr{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=F(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:X,params:P}=ue(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:X,params:P,filePath:h,isDynamic:P.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");ei(this.routes,s),ti(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function Ts(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function $s(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Ff(e){k=e.replace(/\/$/,"")}function zf(e,t,a={}){f[e]={path:t,name:e,params:a}}function Hf(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function gr(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Vf(){for(let e of Object.keys(f))delete f[e];k=""}import B from"fs";import q from"path";function Uf(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Wf(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function qf(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function xc(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Sc(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function kc(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function ni(e,t){v.set(e,t)}function _c(e){return v.get(e)}function Kf(e){return v.has(e)}function kt(){v.clear()}function _t(){return Array.from(v.keys())}async function Ct(e,t="middleware"){let a=q.resolve(e,t);if(!B.existsSync(a))return;let r=B.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=q.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")ni(o,s);else if(typeof s==="function")ni(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function Et(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function Tt(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?xc(a,i):Sc(),storage:kc(),state:{},request:a,responseHeaders:i}}async function $t(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=_c(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function Rs(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function et(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||Rs(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function U(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function H(){return`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=8;
@@ -4060,4 +4060,4 @@ else {
4060
4060
 
4061
4061
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
4062
4062
  })();
4063
- `}function tt(){if(A)return A;return A=U(W(H()),!0),A}function Kf(){if(T)return T;return T=U(H()),T}export{ei,ti,St,ue,pr,Es,fr,Ts,$s,Bf,Ff,zf,gr,Hf,Vf,Uf,Wf,xc,Sc,kc,ni,_c,qf,kt,_t,Ct,Et,Tt,$t,Rs,et,tt,Kf};
4063
+ `}function tt(){if(A)return A;return A=U(W(H()),!0),A}function Xf(){if(T)return T;return T=U(H()),T}export{ei,ti,St,ue,pr,Es,fr,Ts,$s,Ff,zf,Hf,gr,Vf,Uf,Wf,qf,xc,Sc,kc,ni,_c,Kf,kt,_t,Ct,Et,Tt,$t,Rs,et,tt,Xf};