@stacksjs/bun-router 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/dist/chunk-03m2j6h7.js +2 -0
  2. package/dist/chunk-08cw7ejr.js +3 -0
  3. package/dist/chunk-0e4g0fyv.js +62 -0
  4. package/dist/chunk-0mmn02yw.js +2 -0
  5. package/dist/chunk-126c9qm3.js +2 -0
  6. package/dist/chunk-12p13817.js +2 -0
  7. package/dist/chunk-14v65c37.js +4 -0
  8. package/dist/{chunk-s3dn1kwx.js → chunk-1b6a7t3v.js} +2 -2
  9. package/dist/chunk-1wenkmk0.js +2 -0
  10. package/dist/chunk-2152npfd.js +2 -0
  11. package/dist/chunk-26w23krx.js +2 -0
  12. package/dist/chunk-2g8m379z.js +10 -0
  13. package/dist/{chunk-5mxby3fd.js → chunk-2rr178et.js} +2 -2
  14. package/dist/chunk-2w8f3swz.js +29 -0
  15. package/dist/chunk-3y4gaz7v.js +82 -0
  16. package/dist/chunk-4r1x4afz.js +12 -0
  17. package/dist/chunk-4wyw66zk.js +2 -0
  18. package/dist/chunk-4z5sf8ag.js +2 -0
  19. package/dist/{chunk-krkchy8v.js → chunk-58tfvayh.js} +3 -3
  20. package/dist/{chunk-ex5fkjah.js → chunk-5dp83qcx.js} +43 -43
  21. package/dist/chunk-5f0d9j9a.js +2 -0
  22. package/dist/{chunk-zhx0hxdd.js → chunk-5z52b0fc.js} +7 -7
  23. package/dist/{chunk-kc659vhx.js → chunk-5zrnk2kq.js} +3 -3
  24. package/dist/chunk-6dmqtdnq.js +2 -0
  25. package/dist/{chunk-5s1pr62n.js → chunk-6e91956t.js} +2 -2
  26. package/dist/{chunk-jrf5a2ap.js → chunk-6rv8w5jk.js} +1 -1
  27. package/dist/{chunk-5n0ckcmc.js → chunk-6x1feysm.js} +2 -2
  28. package/dist/chunk-7y72hm1x.js +2 -0
  29. package/dist/{chunk-zetqzgf3.js → chunk-8hbhfh6b.js} +6 -6
  30. package/dist/{chunk-5ncn73tp.js → chunk-8kfzygg5.js} +2 -2
  31. package/dist/chunk-8wydx2we.js +2 -0
  32. package/dist/chunk-8zjnjvv7.js +2 -0
  33. package/dist/chunk-988h4bzr.js +2 -0
  34. package/dist/chunk-9b6a58ac.js +2 -0
  35. package/dist/chunk-a8fcaywb.js +2 -0
  36. package/dist/chunk-bfjwn7yg.js +2 -0
  37. package/dist/chunk-bp2522mm.js +2 -0
  38. package/dist/chunk-bswe62q4.js +48 -0
  39. package/dist/chunk-c3v796c8.js +943 -0
  40. package/dist/chunk-ccqmwdry.js +2 -0
  41. package/dist/chunk-ck0crwnx.js +2 -0
  42. package/dist/chunk-cqgkxcb4.js +2 -0
  43. package/dist/chunk-dntnakjy.js +2 -0
  44. package/dist/{chunk-67wgad4f.js → chunk-ettdpnrw.js} +2 -2
  45. package/dist/{chunk-csfrpsp7.js → chunk-ezqwq17j.js} +10 -10
  46. package/dist/chunk-ezx3qsez.js +2 -0
  47. package/dist/{chunk-73k79n7q.js → chunk-f72nnjy4.js} +360 -360
  48. package/dist/chunk-fna5n0ey.js +246 -0
  49. package/dist/chunk-fqhckdt8.js +2 -0
  50. package/dist/chunk-fr6hbx25.js +2 -0
  51. package/dist/{chunk-vr10sbbh.js → chunk-g9cwng6w.js} +1 -1
  52. package/dist/chunk-gd3za5x0.js +2 -0
  53. package/dist/chunk-gf28608k.js +2 -0
  54. package/dist/chunk-h1dj6v8q.js +3 -0
  55. package/dist/chunk-hjxe7k2g.js +2 -0
  56. package/dist/chunk-hrkgznbn.js +2 -0
  57. package/dist/chunk-j6h5v0br.js +2 -0
  58. package/dist/{chunk-0gjq8ttx.js → chunk-mgb01qdv.js} +2 -2
  59. package/dist/chunk-n24c9whp.js +2 -0
  60. package/dist/{chunk-kxp888dn.js → chunk-n2j24b0h.js} +244 -244
  61. package/dist/{chunk-vv3gb1m5.js → chunk-nhmtg01n.js} +2 -2
  62. package/dist/chunk-p0qhpnqh.js +70 -0
  63. package/dist/chunk-p0w1x8y2.js +3 -0
  64. package/dist/{chunk-9ght4n4r.js → chunk-p3dk1w2w.js} +11 -11
  65. package/dist/{chunk-6sjvhy5f.js → chunk-q4e9pxs7.js} +2 -2
  66. package/dist/chunk-q5dv1kyy.js +2 -0
  67. package/dist/chunk-qnqgf9tq.js +2 -0
  68. package/dist/chunk-qvwy1808.js +898 -0
  69. package/dist/{chunk-5s0pnsd6.js → chunk-r18f77vc.js} +4 -4
  70. package/dist/chunk-r63za1mr.js +2 -0
  71. package/dist/{chunk-6s1kbajm.js → chunk-rft8gw92.js} +1 -1
  72. package/dist/chunk-ryvmyskt.js +4211 -0
  73. package/dist/chunk-sa6mx308.js +2 -0
  74. package/dist/chunk-va0pc7hx.js +2 -0
  75. package/dist/chunk-vcp8dnjq.js +412 -0
  76. package/dist/chunk-vg1erq1q.js +2 -0
  77. package/dist/{chunk-hmgedrmr.js → chunk-w0jv49ch.js} +3 -3
  78. package/dist/{chunk-0t5vz87j.js → chunk-wm805tte.js} +19 -19
  79. package/dist/chunk-xj9h6mc9.js +2 -0
  80. package/dist/chunk-ytvzwrq3.js +51 -0
  81. package/dist/{chunk-w4r464v5.js → chunk-zde7ebc4.js} +2 -2
  82. package/dist/chunk-zmqsv2xy.js +2 -0
  83. package/dist/cli.js +57 -66
  84. package/dist/container/index.js +1 -1
  85. package/dist/index.d.ts +1 -0
  86. package/dist/index.js +29 -29
  87. package/dist/typed/client.d.ts +89 -0
  88. package/dist/typed/contract.d.ts +34 -0
  89. package/dist/typed/endpoint.d.ts +90 -0
  90. package/dist/typed/index.d.ts +14 -0
  91. package/dist/typed/router.d.ts +141 -0
  92. package/package.json +1 -1
  93. package/dist/chunk-30rkn2ym.js +0 -2
  94. package/dist/chunk-38cmrard.js +0 -2
  95. package/dist/chunk-3qna6dwd.js +0 -2
  96. package/dist/chunk-4d5fmta0.js +0 -2
  97. package/dist/chunk-4x3b4b4q.js +0 -2
  98. package/dist/chunk-6xed4va1.js +0 -2
  99. package/dist/chunk-748n6ydj.js +0 -2
  100. package/dist/chunk-7rsf8tes.js +0 -898
  101. package/dist/chunk-8aspmtf1.js +0 -2
  102. package/dist/chunk-8yfdg595.js +0 -2
  103. package/dist/chunk-90eze7av.js +0 -3
  104. package/dist/chunk-9dvwyej7.js +0 -2
  105. package/dist/chunk-a2w45krb.js +0 -2
  106. package/dist/chunk-a547f2ab.js +0 -48
  107. package/dist/chunk-bqdycvtc.js +0 -2
  108. package/dist/chunk-cd03rk3x.js +0 -2
  109. package/dist/chunk-ct0m17q5.js +0 -2
  110. package/dist/chunk-dhbvvr5h.js +0 -2
  111. package/dist/chunk-dhptcsya.js +0 -943
  112. package/dist/chunk-dq93zag9.js +0 -2
  113. package/dist/chunk-edrtesh7.js +0 -2
  114. package/dist/chunk-ejcws37w.js +0 -2
  115. package/dist/chunk-ex890p45.js +0 -51
  116. package/dist/chunk-f69cpnhw.js +0 -2
  117. package/dist/chunk-fjf53b44.js +0 -2
  118. package/dist/chunk-fjzye4qj.js +0 -2
  119. package/dist/chunk-gfd23b6t.js +0 -2
  120. package/dist/chunk-habv0vef.js +0 -12
  121. package/dist/chunk-hz6fc788.js +0 -2
  122. package/dist/chunk-jff6j9y3.js +0 -10
  123. package/dist/chunk-jmeb7n8k.js +0 -70
  124. package/dist/chunk-jy2jhcpy.js +0 -246
  125. package/dist/chunk-m249t3je.js +0 -3
  126. package/dist/chunk-m9yabnjx.js +0 -2
  127. package/dist/chunk-mekrq9wd.js +0 -2
  128. package/dist/chunk-mmxv535f.js +0 -82
  129. package/dist/chunk-mypn7jss.js +0 -2
  130. package/dist/chunk-n18x1k3c.js +0 -2
  131. package/dist/chunk-nkddjzsa.js +0 -2
  132. package/dist/chunk-pjmhqmr9.js +0 -2
  133. package/dist/chunk-qyrnsaq1.js +0 -2
  134. package/dist/chunk-r19ff2qm.js +0 -62
  135. package/dist/chunk-r338fssq.js +0 -2
  136. package/dist/chunk-s36z58x2.js +0 -29
  137. package/dist/chunk-s79dd325.js +0 -471
  138. package/dist/chunk-ta38j9em.js +0 -2
  139. package/dist/chunk-tpfgntwj.js +0 -4211
  140. package/dist/chunk-vw8rwv6e.js +0 -2
  141. package/dist/chunk-wcrqs5z9.js +0 -2
  142. package/dist/chunk-x6d1rmwa.js +0 -2
  143. package/dist/chunk-x7ft15zz.js +0 -2
  144. package/dist/chunk-x8trwn7j.js +0 -3
  145. package/dist/chunk-xhepdj1f.js +0 -2
  146. package/dist/chunk-xv2em0q4.js +0 -4
  147. package/dist/chunk-ypw6g0te.js +0 -2
  148. package/dist/chunk-z8szsm21.js +0 -2
  149. package/dist/chunk-zfbh14qe.js +0 -2
  150. /package/dist/{chunk-a3wahyg7.js → chunk-nf3kv7kv.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{jn as Bc}from"./chunk-csfrpsp7.js";import{Zo as Pc,wp as Mc}from"./chunk-jmeb7n8k.js";import{Zu as be}from"./chunk-a3wahyg7.js";import mr from"fs";import Hr from"path";import nl from"path";import Lg from"fs";import Ki from"path";import ys from"fs";import kr from"path";import il from"fs";import sl from"path";import Jr from"path";import Ty from"process";import fe from"path";import De from"fs";import Bt from"path";import nn from"fs";import{createHash as tv}from"crypto";import vt from"path";import vr from"process";import Or from"fs";import wr from"path";import Qw from"fs";import M from"path";import{createHash as $p}from"crypto";import{readFile as k0,stat as Lp}from"fs/promises";import{mkdir as E0,readFile as A0,writeFile as C0,readdir as jC,rm as T0,stat as DC}from"fs/promises";import{join as Pp,dirname as R0}from"path";import{resolve as j0,basename as D0,extname as $0,join as L0}from"path";import{mkdir as N0}from"fs/promises";import{resolve as F0,basename as q0,extname as W0,join as H0}from"path";import{mkdir as U0}from"fs/promises";import{resolve as Eo,basename as Ao,extname as Co,join as ui}from"path";import{mkdir as To}from"fs/promises";import{resolve as lf,basename as cf,extname as uf,join as Mt}from"path";import{mkdir as di,writeFile as df}from"fs/promises";import{resolve as gf,basename as pb,extname as fb,join as hb}from"path";import{mkdir as mb}from"fs/promises";import Bb from"path";import Mr from"path";import zn from"fs";import $e from"path";import te from"path";import*as Vf from"crypto";import nS from"fs";import ss from"path";import wS from"crypto";import NS from"crypto";import ea from"path";import mi from"path";import Fe from"path";import Xl from"fs";import{existsSync as R_,readFileSync as I_}from"fs";import gi from"fs";import Le from"path";import le from"path";import*as Ko from"path";import fr from"path";import w1 from"fs";import In from"path";import Jn from"path";import un from"path";import st from"path";import dA from"fs";import Ee from"path";import de from"fs";import ee from"path";import Nc from"fs";import bA from"path";import yr from"fs";import ba from"path";import{createHash as TA}from"crypto";import Vr from"fs";import Kn from"path";var Ig=Object.defineProperty,Og=(e)=>e;function jg(e,t){this[e]=Og.bind(null,t)}var Y=(e,t)=>{for(var r in t)Ig(e,r,{get:t[r],enumerable:!0,configurable:!0,set:jg.bind(t,r)})},R=(e,t)=>()=>(e&&(t=e(e=0)),t),Zn=import.meta.require;function zc(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((t)=>_i.includes(t))}function Sa(e){return zc(e.replace(/^\//,""))}var _i,_a=R(()=>{_i=["components","layouts","partials","emails"]});function Fc(e,t){let r=e.filter((a)=>!Sa(a.pattern)),n=["// Auto-generated by STX - do not edit"];if(r.length===0)n.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{n.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let a of r){let o=[];for(let c of a.params){let u=a.pattern.includes(`:${c}?`)?"?":"";o.push(`${c}${u}: string`)}let l=o.join("; ");n.push(` '${a.pattern}': { ${l} }`)}n.push(" }","}","","export {}","")}let i=n.join(`
3
- `),s=Hr.join(t,"route-types.d.ts");try{if(mr.existsSync(s)&&mr.readFileSync(s,"utf8")===i)return;mr.mkdirSync(t,{recursive:!0}),mr.writeFileSync(s,i)}catch{}}function qc(e,t,r){let n=process.cwd(),i=Hr.relative(n,r),s=e.filter((o)=>!Sa(o.pattern)),a=["// Auto-generated by stx \u2014 do not edit",`// Source: ${i||"pages"}/`,"","export const routes = ["];for(let o of s){let l=Hr.relative(n,o.filePath).replace(/\\/g,"/"),c=JSON.stringify(o.params),u=o.layout?`, layout: '${Hr.relative(n,o.layout).replace(/\\/g,"/")}'`:"";a.push(` { pattern: '${o.pattern}', filePath: '${l}', isDynamic: ${o.isDynamic}, params: ${c}${u} },`)}a.push("] as const",""),a.push("export type RouteName = typeof routes[number]['pattern']",""),mr.mkdirSync(t,{recursive:!0}),mr.writeFileSync(Hr.join(t,"routes.ts"),a.join(`
4
- `))}var Wc=R(()=>{_a()});function Hc(e,t){let r=nl.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(nl.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 ka(e){let t=[],r="",n=0;while(n<e.length){let i=e.slice(n),s=/^\/:([^/?*]+)\?/.exec(i);if(s){t.push(s[1]),r+="(?:/([^/]+))?",n+=s[0].length;continue}let a=/^:([^/?*]+)\*/.exec(i);if(a){t.push(a[1]),r+="(.+)",n+=a[0].length;continue}let o=/^:([^/?*]+)/.exec(i);if(o){t.push(o[1]),r+="([^/]+)",n+=o[0].length;continue}r+=e[n].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),n+=1}return{regex:new RegExp(`^${r}$`),params:t}}function Dg(e,t){let r=e===""?"/":e;for(let n of t){let i=r.match(n.regex);if(i){let s={};return n.params.forEach((a,o)=>{s[a]=i[o+1]}),{route:n,params:s}}}return null}function $g(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return ka(t)}var Uc=()=>{};function Gc(e,t){let r=[],n=Ki.dirname(e);while(n.startsWith(t)||n===t){let i=Ki.join(n,"_layout.stx");if(Lg.existsSync(i))r.unshift(i);if(n===t)break;n=Ki.dirname(n)}return r}var Vc=()=>{};function Jc(e,t){let r=[];if(!ys.existsSync(e))return r;let n=ys.readdirSync(e,{withFileTypes:!0});for(let i of n){let s=kr.join(e,i.name);if(i.isDirectory()){if(i.name.startsWith("."))continue;if(_i.includes(i.name))continue;r.push(...Jc(s,t))}else if(i.isFile()){let a=kr.extname(i.name);if(t.includes(a)){if(i.name.startsWith("_")&&i.name!=="_layout.stx")continue;if(i.name==="_layout.stx")continue;r.push(s)}}}return r}class ki{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let r=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=r.map((a)=>kr.resolve(e,a)),this.pagesDir=this.pagesDirs[0];let n=t.extensions||[".stx"],i=new Set;this.routes=[];for(let a of this.pagesDirs){let o=Jc(a,n);for(let l of o){let c=Hc(l,a);if(i.has(c))continue;i.add(c);let{regex:u,params:d}=ka(c),h=t.layouts!==!1?Gc(l,a):[];this.routes.push({pattern:c,regex:u,params:d,filePath:l,isDynamic:d.length>0,layout:h.length>0?h[h.length-1]:void 0})}}this.routes.sort((a,o)=>{if(!a.isDynamic&&o.isDynamic)return-1;if(a.isDynamic&&!o.isDynamic)return 1;let l=a.pattern.split("/").length,c=o.pattern.split("/").length;if(l!==c)return c-l;return a.pattern.localeCompare(o.pattern)});let s=kr.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");Fc(this.routes,s),qc(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let r of this.routes){let n=t.match(r.regex);if(n){let i={};return r.params.forEach((s,a)=>{i[s]=n[a+1]}),{route:r,params:i}}}return null}resolve(e,t){let r=this.routes.find((i)=>i.pattern===e||i.filePath.includes(e));if(!r)return"#not-found";let n=r.pattern;if(t)for(let[i,s]of Object.entries(t))n=n.replace(`:${i}`,encodeURIComponent(s));return n}addRoute(e){this.routes.push(e),this.routes.sort((t,r)=>{if(!t.isDynamic&&r.isDynamic)return-1;if(t.isDynamic&&!r.isDynamic)return 1;return t.pattern.localeCompare(r.pattern)})}getLayout(e){return e.layout??null}}function Ng(e,t){return new ki(e,t)}function Pg(e,t){let r=[`${t}.stx`,"error.stx"];for(let n of r){let i=kr.join(e,n);if(ys.existsSync(i))return i}return null}function Mg(e,t){return e.map((r)=>{let n=kr.relative(t,r.filePath),i=r.isDynamic?" (dynamic)":"";return`${r.pattern} \u2192 ${n}${i}`})}var Bg=R(()=>{Wc(),Uc(),Vc(),_a()});function zg(e){Qn=e.replace(/\/$/,"")}function Fg(e,t,r={}){qt[e]={path:t,name:e,params:r}}function qg(e){for(let[t,r]of Object.entries(e))if(typeof r==="string")qt[t]={path:r,name:t};else qt[t]={...r,name:t}}function Yc(e,t={},r=!1){let n=qt[e];if(!n)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let i={...n.params,...t},s=n.path;s=s.replace(/:(\w+)/g,(o,l)=>{let c=i[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete i[l],encodeURIComponent(String(c))});let a=Object.entries(i);if(a.length>0){let o=a.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+o}return r&&Qn?`${Qn}${s}`:s}function Wg(){for(let e of Object.keys(qt))delete qt[e];Qn=""}var qt,Qn="",Hg=R(()=>{qt={}});function Ug(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Gg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Vg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function vs(e){let t={};if(!e)return t;let r=e.split(";");for(let n of r){let[i,...s]=n.split("=");if(i){let a=i.trim(),o=s.join("=").trim();if(a)t[a]=decodeURIComponent(o)}}return t}function Xn(e,t,r={}){let n=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(r.expires){let i=typeof r.expires==="number"?new Date(Date.now()+r.expires*1000):r.expires;n+=`; Expires=${i.toUTCString()}`}if(r.path)n+=`; Path=${r.path}`;if(r.domain)n+=`; Domain=${r.domain}`;if(r.secure)n+="; Secure";if(r.httpOnly)n+="; HttpOnly";if(r.sameSite)n+=`; SameSite=${r.sameSite}`;return n}function Kc(e,t){let r=e.headers.get("cookie")||"",n=vs(r);return{get(i){return n[i]},set(i,s,a={}){n[i]=s,t.append("Set-Cookie",Xn(i,s,a))},delete(i){delete n[i],t.append("Set-Cookie",Xn(i,"",{expires:new Date(0),path:"/"}))},getAll(){return{...n}}}}function Zc(){return{get(e){if(typeof document>"u")return;return vs(document.cookie)[e]},set(e,t,r={}){if(typeof document>"u")return;document.cookie=Xn(e,t,r)},delete(e){if(typeof document>"u")return;document.cookie=Xn(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return vs(document.cookie)}}}function Qc(){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,r){if(!e)return;try{window.localStorage.setItem(t,r)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function ws(e,t){$r.set(e,t)}function Xc(e){return $r.get(e)}function Jg(e){return $r.has(e)}function eu(){$r.clear()}function tu(){return Array.from($r.keys())}async function ru(e,t="middleware"){let r=sl.resolve(e,t);if(!il.existsSync(r))return;let n=il.readdirSync(r);for(let i of n){if(!i.endsWith(".ts")&&!i.endsWith(".js"))continue;if(i.includes(".test.")||i.includes(".spec."))continue;let s=i.replace(/\.(ts|js)$/,""),a=sl.join(r,i);try{let o=(await import(a)).default;if(o&&typeof o.handler==="function")ws(s,o);else if(typeof o==="function")ws(s,{handler:o,mode:"universal"})}catch(o){console.warn(`Failed to load middleware '${s}' from ${a}:`,o)}}}function Yg(e){let t={};if(!e)return t;let r=new URLSearchParams(e);for(let[n,i]of r)t[n]=i;return t}function nu(e,t,r,n=""){return{path:e,params:t,query:Yg(n),fullPath:n?`${e}?${n}`:e,meta:r}}function iu(e,t,r,n){let i=n?.isServer??typeof window>"u",s=!i,a=new Headers;return{to:e,from:t,isClient:s,isServer:i,cookies:i&&r?Kc(r,a):Zc(),storage:Qc(),state:{},request:r,responseHeaders:a}}async function su(e,t){let r=Array.isArray(e)?e:[e],n=t.isServer;for(let i of r){let s=Xc(i);if(!s)return console.error(`Route middleware '${i}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${i}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!n)continue;try{let a=await s.handler(t);if(a){if(a.type==="redirect")return{passed:!1,redirect:a,state:t.state,responseHeaders:t.responseHeaders};if(a.type==="abort")return{passed:!1,abort:a,state:t.state,responseHeaders:t.responseHeaders}}}catch(a){return console.error(`Error in middleware '${i}':`,a),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:a instanceof Error?a.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var $r,Kg=R(()=>{$r=new Map});function Ea(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean),r=t.lastIndexOf("layouts"),n=r>=0?t[r+1]:t.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Zg(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),n=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),i=t?.[1]||n?.[1]||"";return{layout:i,group:r?.[1]||Ea(i)}}function Qg(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function au(){if(wn)return wn;return wn=Qg(`
2
+ import{jn as zc}from"./chunk-ezqwq17j.js";import{Iq as Bc,jq as Mc}from"./chunk-p0qhpnqh.js";import{Zu as xe}from"./chunk-nf3kv7kv.js";import gr from"fs";import Ur from"path";import il from"path";import Ng from"fs";import Zi from"path";import vs from"fs";import Er from"path";import sl from"fs";import al from"path";import Yr from"path";import Ry from"process";import he from"path";import $e from"fs";import zt from"path";import sn from"fs";import{createHash as rv}from"crypto";import wt from"path";import wr from"process";import jr from"fs";import br from"path";import Xw from"fs";import B from"path";import{createHash as Lp}from"crypto";import{readFile as Eb,stat as Np}from"fs/promises";import{mkdir as Ab,readFile as Cb,writeFile as Tb,readdir as DC,rm as Rb,stat as $C}from"fs/promises";import{join as Mp,dirname as Ib}from"path";import{resolve as Db,basename as $b,extname as Lb,join as Nb}from"path";import{mkdir as Pb}from"fs/promises";import{resolve as qb,basename as Wb,extname as Hb,join as Ub}from"path";import{mkdir as Gb}from"fs/promises";import{resolve as Ao,basename as Co,extname as To,join as di}from"path";import{mkdir as Ro}from"fs/promises";import{resolve as cf,basename as uf,extname as df,join as Bt}from"path";import{mkdir as pi,writeFile as pf}from"fs/promises";import{resolve as yf,basename as fx,extname as hx,join as mx}from"path";import{mkdir as gx}from"fs/promises";import zx from"path";import Br from"path";import Fn from"fs";import Le from"path";import re from"path";import*as Jf from"crypto";import iS from"fs";import as from"path";import bS from"crypto";import PS from"crypto";import ta from"path";import gi from"path";import qe from"path";import ec from"fs";import{existsSync as I_,readFileSync as O_}from"fs";import yi from"fs";import Ne from"path";import ce from"path";import*as Zo from"path";import hr from"path";import b1 from"fs";import On from"path";import Yn from"path";import dn from"path";import at from"path";import pA from"fs";import Ae from"path";import pe from"fs";import te from"path";import Pc from"fs";import xA from"path";import vr from"fs";import xa from"path";import{createHash as RA}from"crypto";import Jr from"fs";import Zn from"path";var Og=Object.defineProperty,jg=(e)=>e;function Dg(e,t){this[e]=jg.bind(null,t)}var K=(e,t)=>{for(var r in t)Og(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Dg.bind(t,r)})},R=(e,t)=>()=>(e&&(t=e(e=0)),t),Qn=import.meta.require;function Fc(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((t)=>ki.includes(t))}function _a(e){return Fc(e.replace(/^\//,""))}var ki,ka=R(()=>{ki=["components","layouts","partials","emails"]});function qc(e,t){let r=e.filter((a)=>!_a(a.pattern)),n=["// Auto-generated by STX - do not edit"];if(r.length===0)n.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{n.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let a of r){let o=[];for(let c of a.params){let u=a.pattern.includes(`:${c}?`)?"?":"";o.push(`${c}${u}: string`)}let l=o.join("; ");n.push(` '${a.pattern}': { ${l} }`)}n.push(" }","}","","export {}","")}let i=n.join(`
3
+ `),s=Ur.join(t,"route-types.d.ts");try{if(gr.existsSync(s)&&gr.readFileSync(s,"utf8")===i)return;gr.mkdirSync(t,{recursive:!0}),gr.writeFileSync(s,i)}catch{}}function Wc(e,t,r){let n=process.cwd(),i=Ur.relative(n,r),s=e.filter((o)=>!_a(o.pattern)),a=["// Auto-generated by stx \u2014 do not edit",`// Source: ${i||"pages"}/`,"","export const routes = ["];for(let o of s){let l=Ur.relative(n,o.filePath).replace(/\\/g,"/"),c=JSON.stringify(o.params),u=o.layout?`, layout: '${Ur.relative(n,o.layout).replace(/\\/g,"/")}'`:"";a.push(` { pattern: '${o.pattern}', filePath: '${l}', isDynamic: ${o.isDynamic}, params: ${c}${u} },`)}a.push("] as const",""),a.push("export type RouteName = typeof routes[number]['pattern']",""),gr.mkdirSync(t,{recursive:!0}),gr.writeFileSync(Ur.join(t,"routes.ts"),a.join(`
4
+ `))}var Hc=R(()=>{ka()});function Uc(e,t){let r=il.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(il.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 Ea(e){let t=[],r="",n=0;while(n<e.length){let i=e.slice(n),s=/^\/:([^/?*]+)\?/.exec(i);if(s){t.push(s[1]),r+="(?:/([^/]+))?",n+=s[0].length;continue}let a=/^:([^/?*]+)\*/.exec(i);if(a){t.push(a[1]),r+="(.+)",n+=a[0].length;continue}let o=/^:([^/?*]+)/.exec(i);if(o){t.push(o[1]),r+="([^/]+)",n+=o[0].length;continue}r+=e[n].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),n+=1}return{regex:new RegExp(`^${r}$`),params:t}}function $g(e,t){let r=e===""?"/":e;for(let n of t){let i=r.match(n.regex);if(i){let s={};return n.params.forEach((a,o)=>{s[a]=i[o+1]}),{route:n,params:s}}}return null}function Lg(e){let t=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Ea(t)}var Gc=()=>{};function Vc(e,t){let r=[],n=Zi.dirname(e);while(n.startsWith(t)||n===t){let i=Zi.join(n,"_layout.stx");if(Ng.existsSync(i))r.unshift(i);if(n===t)break;n=Zi.dirname(n)}return r}var Jc=()=>{};function Yc(e,t){let r=[];if(!vs.existsSync(e))return r;let n=vs.readdirSync(e,{withFileTypes:!0});for(let i of n){let s=Er.join(e,i.name);if(i.isDirectory()){if(i.name.startsWith("."))continue;if(ki.includes(i.name))continue;r.push(...Yc(s,t))}else if(i.isFile()){let a=Er.extname(i.name);if(t.includes(a)){if(i.name.startsWith("_")&&i.name!=="_layout.stx")continue;if(i.name==="_layout.stx")continue;r.push(s)}}}return r}class Ei{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let r=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=r.map((a)=>Er.resolve(e,a)),this.pagesDir=this.pagesDirs[0];let n=t.extensions||[".stx"],i=new Set;this.routes=[];for(let a of this.pagesDirs){let o=Yc(a,n);for(let l of o){let c=Uc(l,a);if(i.has(c))continue;i.add(c);let{regex:u,params:d}=Ea(c),h=t.layouts!==!1?Vc(l,a):[];this.routes.push({pattern:c,regex:u,params:d,filePath:l,isDynamic:d.length>0,layout:h.length>0?h[h.length-1]:void 0})}}this.routes.sort((a,o)=>{if(!a.isDynamic&&o.isDynamic)return-1;if(a.isDynamic&&!o.isDynamic)return 1;let l=a.pattern.split("/").length,c=o.pattern.split("/").length;if(l!==c)return c-l;return a.pattern.localeCompare(o.pattern)});let s=Er.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");qc(this.routes,s),Wc(this.routes,s,this.pagesDir)}match(e){let t=e===""?"/":e;for(let r of this.routes){let n=t.match(r.regex);if(n){let i={};return r.params.forEach((s,a)=>{i[s]=n[a+1]}),{route:r,params:i}}}return null}resolve(e,t){let r=this.routes.find((i)=>i.pattern===e||i.filePath.includes(e));if(!r)return"#not-found";let n=r.pattern;if(t)for(let[i,s]of Object.entries(t))n=n.replace(`:${i}`,encodeURIComponent(s));return n}addRoute(e){this.routes.push(e),this.routes.sort((t,r)=>{if(!t.isDynamic&&r.isDynamic)return-1;if(t.isDynamic&&!r.isDynamic)return 1;return t.pattern.localeCompare(r.pattern)})}getLayout(e){return e.layout??null}}function Pg(e,t){return new Ei(e,t)}function Mg(e,t){let r=[`${t}.stx`,"error.stx"];for(let n of r){let i=Er.join(e,n);if(vs.existsSync(i))return i}return null}function Bg(e,t){return e.map((r)=>{let n=Er.relative(t,r.filePath),i=r.isDynamic?" (dynamic)":"";return`${r.pattern} \u2192 ${n}${i}`})}var zg=R(()=>{Hc(),Gc(),Jc(),ka()});function Fg(e){Xn=e.replace(/\/$/,"")}function qg(e,t,r={}){Wt[e]={path:t,name:e,params:r}}function Wg(e){for(let[t,r]of Object.entries(e))if(typeof r==="string")Wt[t]={path:r,name:t};else Wt[t]={...r,name:t}}function Kc(e,t={},r=!1){let n=Wt[e];if(!n)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let i={...n.params,...t},s=n.path;s=s.replace(/:(\w+)/g,(o,l)=>{let c=i[l];if(c===void 0)return console.warn(`Missing parameter [${l}] for route [${e}].`),`:${l}`;return delete i[l],encodeURIComponent(String(c))});let a=Object.entries(i);if(a.length>0){let o=a.map(([l,c])=>`${encodeURIComponent(l)}=${encodeURIComponent(String(c))}`).join("&");s+=(s.includes("?")?"&":"?")+o}return r&&Xn?`${Xn}${s}`:s}function Hg(){for(let e of Object.keys(Wt))delete Wt[e];Xn=""}var Wt,Xn="",Ug=R(()=>{Wt={}});function Gg(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Vg(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Jg(e,t={}){return{handler:e,mode:t.mode??"universal"}}function ws(e){let t={};if(!e)return t;let r=e.split(";");for(let n of r){let[i,...s]=n.split("=");if(i){let a=i.trim(),o=s.join("=").trim();if(a)t[a]=decodeURIComponent(o)}}return t}function ei(e,t,r={}){let n=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(r.expires){let i=typeof r.expires==="number"?new Date(Date.now()+r.expires*1000):r.expires;n+=`; Expires=${i.toUTCString()}`}if(r.path)n+=`; Path=${r.path}`;if(r.domain)n+=`; Domain=${r.domain}`;if(r.secure)n+="; Secure";if(r.httpOnly)n+="; HttpOnly";if(r.sameSite)n+=`; SameSite=${r.sameSite}`;return n}function Zc(e,t){let r=e.headers.get("cookie")||"",n=ws(r);return{get(i){return n[i]},set(i,s,a={}){n[i]=s,t.append("Set-Cookie",ei(i,s,a))},delete(i){delete n[i],t.append("Set-Cookie",ei(i,"",{expires:new Date(0),path:"/"}))},getAll(){return{...n}}}}function Qc(){return{get(e){if(typeof document>"u")return;return ws(document.cookie)[e]},set(e,t,r={}){if(typeof document>"u")return;document.cookie=ei(e,t,r)},delete(e){if(typeof document>"u")return;document.cookie=ei(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return ws(document.cookie)}}}function Xc(){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,r){if(!e)return;try{window.localStorage.setItem(t,r)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}function bs(e,t){Lr.set(e,t)}function eu(e){return Lr.get(e)}function Yg(e){return Lr.has(e)}function tu(){Lr.clear()}function ru(){return Array.from(Lr.keys())}async function nu(e,t="middleware"){let r=al.resolve(e,t);if(!sl.existsSync(r))return;let n=sl.readdirSync(r);for(let i of n){if(!i.endsWith(".ts")&&!i.endsWith(".js"))continue;if(i.includes(".test.")||i.includes(".spec."))continue;let s=i.replace(/\.(ts|js)$/,""),a=al.join(r,i);try{let o=(await import(a)).default;if(o&&typeof o.handler==="function")bs(s,o);else if(typeof o==="function")bs(s,{handler:o,mode:"universal"})}catch(o){console.warn(`Failed to load middleware '${s}' from ${a}:`,o)}}}function Kg(e){let t={};if(!e)return t;let r=new URLSearchParams(e);for(let[n,i]of r)t[n]=i;return t}function iu(e,t,r,n=""){return{path:e,params:t,query:Kg(n),fullPath:n?`${e}?${n}`:e,meta:r}}function su(e,t,r,n){let i=n?.isServer??typeof window>"u",s=!i,a=new Headers;return{to:e,from:t,isClient:s,isServer:i,cookies:i&&r?Zc(r,a):Qc(),storage:Xc(),state:{},request:r,responseHeaders:a}}async function au(e,t){let r=Array.isArray(e)?e:[e],n=t.isServer;for(let i of r){let s=eu(i);if(!s)return console.error(`Route middleware '${i}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${i}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(s.mode==="server"&&!n)continue;try{let a=await s.handler(t);if(a){if(a.type==="redirect")return{passed:!1,redirect:a,state:t.state,responseHeaders:t.responseHeaders};if(a.type==="abort")return{passed:!1,abort:a,state:t.state,responseHeaders:t.responseHeaders}}}catch(a){return console.error(`Error in middleware '${i}':`,a),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:a instanceof Error?a.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}var Lr,Zg=R(()=>{Lr=new Map});function Aa(e){let t=e.replace(/\\/g,"/").split("/").filter(Boolean),r=t.lastIndexOf("layouts"),n=r>=0?t[r+1]:t.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Qg(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),n=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),i=t?.[1]||n?.[1]||"";return{layout:i,group:r?.[1]||Aa(i)}}function Xg(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function ou(){if(bn)return bn;return bn=Xg(`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -1651,7 +1651,7 @@ else {
1651
1651
 
1652
1652
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1653
1653
  })();
1654
- `),wn}var wn,ou={};Y(ou,{setAppUrl:()=>zg,runMiddleware:()=>su,route:()=>Yc,resolveLayoutChain:()=>Gc,resetRoutes:()=>Wg,registerMiddleware:()=>ws,patternToRegex:()=>ka,navigateTo:()=>Ug,matchRoute:()=>Dg,loadMiddlewareFromDirectory:()=>ru,isNonPageRoutePattern:()=>Sa,isNonPageRoutePath:()=>zc,hasMiddleware:()=>Jg,getRouterScript:()=>au,getMiddlewareNames:()=>tu,getMiddleware:()=>Xc,generateRouteTypes:()=>Fc,generateRouteManifest:()=>qc,formatRoutes:()=>Mg,findErrorPage:()=>Pg,filePathToPattern:()=>Hc,extractLayoutMetadata:()=>Zg,deriveLayoutGroup:()=>Ea,defineRoutes:()=>qg,defineRoute:()=>Fg,defineMiddleware:()=>Vg,createStorageManager:()=>Qc,createServerCookieManager:()=>Kc,createRouter:()=>Ng,createRouteLocation:()=>nu,createMiddlewareContext:()=>iu,createClientCookieManager:()=>Zc,clearMiddleware:()=>eu,bracketPathToRegex:()=>$g,abortNavigation:()=>Gg,Router:()=>ki,NON_PAGE_DIRS:()=>_i});var Wt=R(()=>{Bg(),Uc(),Hg(),Kg(),Vc(),Wc(),_a()});function Aa(e,t={}){return new ki(e,t).routes}var lu=R(()=>{Wt(),Wt()});function al(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function bs(e,t){let r={...e};for(let[n,i]of Object.entries(t))r[n]=al(i)&&al(r[n])?bs(r[n],i):i;return r}function Xg(e={},t={}){let r=e.theme||{},n=t.theme||{},{extend:i,...s}=n,{extend:a,...o}=r,l=bs(o,s),c=bs(a||{},i||{});if(Object.keys(c).length>0)l.extend=c;let u=[...e.safelist||[],...t.safelist||[]],d={...e.shortcuts||{},...t.shortcuts||{}},h=[...e.preflights||[],...t.preflights||[]];return{config:{...e,...t,theme:l,safelist:u,shortcuts:d,...h.length>0?{preflights:h}:{},content:[],output:""},safelist:u,shortcuts:d,includePreflight:t.preflight!==!1,minify:t.minify===!0}}function ey(e){cu=e?.trim()||null}function ei(){return process.env[ty]?.trim()||cu||Yr}function Er(e=process.cwd(),...t){let r=ei();return Jr.isAbsolute(r)?Jr.join(r,...t):Jr.join(e,r,...t)}function bn(e){if(!e||Jr.isAbsolute(e))return e;let t=e.replace(/\\/g,"/");if(t!==Yr&&!t.startsWith(`${Yr}/`))return e;let r=t.slice(Yr.length+1);return r?Jr.join(ei(),r):ei()}var Yr=".stx",ty="STX_DIR",cu=null,Ei=()=>{},ce,ry=R(()=>{ce={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}}),ny=()=>{};function iy(e,t,r,n){let i=e;i=i.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(a,o,l)=>{let c={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[o]||"Make this element accessible";return`<!-- a11y-hint: ${l||c} -->`});let s=/@screenReader\(([^@]*)\)@endScreenReader/g;return i=i.replace(s,(a,o)=>{return`<span class="sr-only">${o.trim()}</span>`}),i=i.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(a,o,l)=>{return`<span id="${`desc-${o}`}" class="sr-only">${l}</span>`}),i}var uu,du,pu=R(()=>{ny(),uu={name:"a11y",handler:(e,t,r,n)=>{if(!t.length)return e;let i=t[0].replace(/['"]/g,""),s=t.length>1?t[1].replace(/['"]/g,""):"",a={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[i]||"Make this element accessible";return`<!-- a11y-hint: ${s||a} -->${e}`},hasEndTag:!1},du={name:"screenReader",handler:(e)=>{return`<span class="sr-only">${e}</span>`},hasEndTag:!0}});function sy(e,t={}){let{duration:r,delay:n,ease:i,direction:s,custom:a}={...Ze,...t};if(e==="custom"&&a)return a;switch(e){case"fade":return`${s==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":s==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1654
+ `),bn}var bn,lu={};K(lu,{setAppUrl:()=>Fg,runMiddleware:()=>au,route:()=>Kc,resolveLayoutChain:()=>Vc,resetRoutes:()=>Hg,registerMiddleware:()=>bs,patternToRegex:()=>Ea,navigateTo:()=>Gg,matchRoute:()=>$g,loadMiddlewareFromDirectory:()=>nu,isNonPageRoutePattern:()=>_a,isNonPageRoutePath:()=>Fc,hasMiddleware:()=>Yg,getRouterScript:()=>ou,getMiddlewareNames:()=>ru,getMiddleware:()=>eu,generateRouteTypes:()=>qc,generateRouteManifest:()=>Wc,formatRoutes:()=>Bg,findErrorPage:()=>Mg,filePathToPattern:()=>Uc,extractLayoutMetadata:()=>Qg,deriveLayoutGroup:()=>Aa,defineRoutes:()=>Wg,defineRoute:()=>qg,defineMiddleware:()=>Jg,createStorageManager:()=>Xc,createServerCookieManager:()=>Zc,createRouter:()=>Pg,createRouteLocation:()=>iu,createMiddlewareContext:()=>su,createClientCookieManager:()=>Qc,clearMiddleware:()=>tu,bracketPathToRegex:()=>Lg,abortNavigation:()=>Vg,Router:()=>Ei,NON_PAGE_DIRS:()=>ki});var Ht=R(()=>{zg(),Gc(),Ug(),Zg(),Jc(),Hc(),ka()});function Ca(e,t={}){return new Ei(e,t).routes}var cu=R(()=>{Ht(),Ht()});function ol(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function xs(e,t){let r={...e};for(let[n,i]of Object.entries(t))r[n]=ol(i)&&ol(r[n])?xs(r[n],i):i;return r}function ey(e={},t={}){let r=e.theme||{},n=t.theme||{},{extend:i,...s}=n,{extend:a,...o}=r,l=xs(o,s),c=xs(a||{},i||{});if(Object.keys(c).length>0)l.extend=c;let u=[...e.safelist||[],...t.safelist||[]],d={...e.shortcuts||{},...t.shortcuts||{}},h=[...e.preflights||[],...t.preflights||[]];return{config:{...e,...t,theme:l,safelist:u,shortcuts:d,...h.length>0?{preflights:h}:{},content:[],output:""},safelist:u,shortcuts:d,includePreflight:t.preflight!==!1,minify:t.minify===!0}}function ty(e){uu=e?.trim()||null}function ti(){return process.env[ry]?.trim()||uu||Kr}function Ar(e=process.cwd(),...t){let r=ti();return Yr.isAbsolute(r)?Yr.join(r,...t):Yr.join(e,r,...t)}function xn(e){if(!e||Yr.isAbsolute(e))return e;let t=e.replace(/\\/g,"/");if(t!==Kr&&!t.startsWith(`${Kr}/`))return e;let r=t.slice(Kr.length+1);return r?Yr.join(ti(),r):ti()}var Kr=".stx",ry="STX_DIR",uu=null,Ai=()=>{},ue,ny=R(()=>{ue={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}}),iy=()=>{};function sy(e,t,r,n){let i=e;i=i.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(a,o,l)=>{let c={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[o]||"Make this element accessible";return`<!-- a11y-hint: ${l||c} -->`});let s=/@screenReader\(([^@]*)\)@endScreenReader/g;return i=i.replace(s,(a,o)=>`<span class="sr-only">${o.trim()}</span>`),i=i.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(a,o,l)=>`<span id="${`desc-${o}`}" class="sr-only">${l}</span>`),i}var du,pu,fu=R(()=>{iy(),du={name:"a11y",handler:(e,t,r,n)=>{if(!t.length)return e;let i=t[0].replace(/['"]/g,""),s=t.length>1?t[1].replace(/['"]/g,""):"",a={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[i]||"Make this element accessible";return`<!-- a11y-hint: ${s||a} -->${e}`},hasEndTag:!1},pu={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0}});function ay(e,t={}){let{duration:r,delay:n,ease:i,direction:s,custom:a}={...Qe,...t};if(e==="custom"&&a)return a;switch(e){case"fade":return`${s==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":s==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1655
1655
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1656
1656
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${s==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":s==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1657
1657
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1661,7 +1661,7 @@ else {
1661
1661
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1662
1662
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${s==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":s==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1663
1663
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1664
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function ay(){return`
1664
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function oy(){return`
1665
1665
  <script data-stx-scoped data-stx-run="once">
1666
1666
  // Motion preferences handling
1667
1667
  (function() {
@@ -1689,7 +1689,7 @@ else {
1689
1689
  });
1690
1690
  })();
1691
1691
  </script>
1692
- `}function oy(e){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((t)=>t.test(e))}function ly(e=0.1,t="0px"){return`
1692
+ `}function ly(e){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((t)=>t.test(e))}function cy(e=0.1,t="0px"){return`
1693
1693
  <script data-stx-scoped data-stx-run="always">
1694
1694
  // Intersection Observer for scroll animations
1695
1695
  (function() {
@@ -1732,7 +1732,7 @@ else {
1732
1732
  }
1733
1733
  })();
1734
1734
  </script>
1735
- `}function cy(){return`
1735
+ `}function uy(){return`
1736
1736
  <style id="stx-animation-base">
1737
1737
  :root {
1738
1738
  --stx-transition-duration: 300ms;
@@ -1847,7 +1847,7 @@ else {
1847
1847
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1848
1848
  }
1849
1849
  </style>
1850
- `}function uy(e,t,r={}){let{staggerDelay:n=50,sequence:i=!1}=r;return`
1850
+ `}function dy(e,t,r={}){let{staggerDelay:n=50,sequence:i=!1}=r;return`
1851
1851
  <script data-stx-scoped data-stx-run="always">
1852
1852
  // Animation Group: ${e}
1853
1853
  (function() {
@@ -1884,11 +1884,11 @@ else {
1884
1884
  }
1885
1885
  })();
1886
1886
  </script>
1887
- `}function dy(e,t,r,n){let i=e;if(n.animation?.enabled===!1)return i;let s=r.includes("test")&&r.includes("animation");if(!oy(i)&&!s)return i;if(!i.includes('<style id="stx-animation-base">')){let a=cy();i=i.replace("</head>",`${a}
1888
- </head>`)}if(i.includes("stx-observe")){if(!i.includes("Intersection Observer for scroll animations")){let a=ly(),o=i.lastIndexOf("</body>");if(o!==-1)i=i.slice(0,o)+a+`
1889
- `+i.slice(o)}}return i}var Ze,fu,hu,mu,gu,yu=R(()=>{Ze={duration:300,delay:0,ease:"ease",direction:"both"},fu={name:"transition",handler:(e,t,r,n)=>{if(t.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${e}`;let i=t[0],s=t.length>1?Number.parseInt(t[1],10)||Ze.duration:Ze.duration,a=t.length>2?t[2]||Ze.ease:Ze.ease,o=t.length>3?Number.parseInt(t[3],10)||Ze.delay:Ze.delay,l=t.length>4?t[4]||Ze.direction:Ze.direction,c=`stx-transition-${Math.random().toString(36).substr(2,9)}`,u=sy(i,{duration:s,delay:o,ease:a,direction:l}),d="stx-transition",h="";if(i==="fade")h="stx-fade";else if(i==="slide")h="stx-slide";else if(i==="scale")h="stx-scale";else if(i==="flip")h="stx-flip";else if(i==="rotate")h="stx-rotate";return`<div id="${c}" class="${d} ${h} ${l==="out"?"stx-out":""}"
1890
- style="--stx-transition-duration: ${s}ms; --stx-transition-ease: ${a}; --stx-transition-delay: ${o}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},hu={name:"scrollAnimate",handler:(e,t,r,n)=>{if(t.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let i=t[0],s=t.length>1?Number.parseInt(t[1],10)||300:300,a=t.length>2?t[2]||"ease":"ease",o=t.length>3?Number.parseFloat(t[3])||0.2:0.2,l=t.length>4?Number.parseInt(t[4],10)||0:0,c=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,u=`--stx-transition-duration: ${s}ms; --stx-transition-ease: ${a}; --stx-transition-delay: ${l}ms; will-change: opacity, transform;`,d="stx-transition stx-observe stx-out";if(i==="fade")d+=" stx-fade";else if(i==="slide-up"||i==="slide")d+=" stx-from-bottom";else if(i==="slide-down")d+=" stx-from-top";else if(i==="slide-left")d+=" stx-from-right";else if(i==="slide-right")d+=" stx-from-left";else if(i==="scale")d+=" stx-scale";else if(i.includes("-"))d+=` stx-${i}`;else d+=` stx-${i}`;return`<div id="${c}" class="${d}" style="${u}" data-threshold="${o}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},mu={name:"animationGroup",handler:(e,t,r,n)=>{if(t.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let i=t[0],s=t.slice(1).map((c)=>c.startsWith("#")||c.startsWith(".")?c:`#${c}`),a=r.staggerDelay||50,o=r.sequence||!0,l=uy(i,s,{staggerDelay:a,sequence:o});return`${e}
1891
- ${l}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},gu={name:"motion",handler:(e,t,r,n)=>{let i=t.length>0?t[0].toLowerCase()==="true":!0,s=ay();return`<div data-animate="${i?"auto":"true"}">${e}</div>${s}`},hasEndTag:!0,description:"Controls motion and animation preferences"}}),py=R(()=>{Wt(),wu()});async function fy(e,t,r,n){let i=t[0]?.replace(/['"]/g,"")||"main",s=au();if(i!=="main")s=s.replace("container:'main'",`container:'${i}'`);return`<script data-stx-router>${s}</script>`}var vu,wu=R(()=>{py(),vu={name:"stxRouter",handler:fy,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function bu(e){let t=e.heatmap;if(!t?.enabled)return"";let r={...xu,...t};return`
1887
+ `}function py(e,t,r,n){let i=e;if(n.animation?.enabled===!1)return i;let s=r.includes("test")&&r.includes("animation");if(!ly(i)&&!s)return i;if(!i.includes('<style id="stx-animation-base">')){let a=uy();i=i.replace("</head>",`${a}
1888
+ </head>`)}if(i.includes("stx-observe")){if(!i.includes("Intersection Observer for scroll animations")){let a=cy(),o=i.lastIndexOf("</body>");if(o!==-1)i=i.slice(0,o)+a+`
1889
+ `+i.slice(o)}}return i}var Qe,hu,mu,gu,yu,vu=R(()=>{Qe={duration:300,delay:0,ease:"ease",direction:"both"},hu={name:"transition",handler:(e,t,r,n)=>{if(t.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${e}`;let i=t[0],s=t.length>1?Number.parseInt(t[1],10)||Qe.duration:Qe.duration,a=t.length>2?t[2]||Qe.ease:Qe.ease,o=t.length>3?Number.parseInt(t[3],10)||Qe.delay:Qe.delay,l=t.length>4?t[4]||Qe.direction:Qe.direction,c=`stx-transition-${Math.random().toString(36).substr(2,9)}`,u=ay(i,{duration:s,delay:o,ease:a,direction:l}),d="stx-transition",h="";if(i==="fade")h="stx-fade";else if(i==="slide")h="stx-slide";else if(i==="scale")h="stx-scale";else if(i==="flip")h="stx-flip";else if(i==="rotate")h="stx-rotate";return`<div id="${c}" class="${d} ${h} ${l==="out"?"stx-out":""}"
1890
+ style="--stx-transition-duration: ${s}ms; --stx-transition-ease: ${a}; --stx-transition-delay: ${o}ms;">${e}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},mu={name:"scrollAnimate",handler:(e,t,r,n)=>{if(t.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${e}`;let i=t[0],s=t.length>1?Number.parseInt(t[1],10)||300:300,a=t.length>2?t[2]||"ease":"ease",o=t.length>3?Number.parseFloat(t[3])||0.2:0.2,l=t.length>4?Number.parseInt(t[4],10)||0:0,c=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,u=`--stx-transition-duration: ${s}ms; --stx-transition-ease: ${a}; --stx-transition-delay: ${l}ms; will-change: opacity, transform;`,d="stx-transition stx-observe stx-out";if(i==="fade")d+=" stx-fade";else if(i==="slide-up"||i==="slide")d+=" stx-from-bottom";else if(i==="slide-down")d+=" stx-from-top";else if(i==="slide-left")d+=" stx-from-right";else if(i==="slide-right")d+=" stx-from-left";else if(i==="scale")d+=" stx-scale";else if(i.includes("-"))d+=` stx-${i}`;else d+=` stx-${i}`;return`<div id="${c}" class="${d}" style="${u}" data-threshold="${o}">${e}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},gu={name:"animationGroup",handler:(e,t,r,n)=>{if(t.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${e}`;let i=t[0],s=t.slice(1).map((c)=>c.startsWith("#")||c.startsWith(".")?c:`#${c}`),a=r.staggerDelay||50,o=r.sequence||!0,l=dy(i,s,{staggerDelay:a,sequence:o});return`${e}
1891
+ ${l}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},yu={name:"motion",handler:(e,t,r,n)=>{let i=t.length>0?t[0].toLowerCase()==="true":!0,s=oy();return`<div data-animate="${i?"auto":"true"}">${e}</div>${s}`},hasEndTag:!0,description:"Controls motion and animation preferences"}}),fy=R(()=>{Ht(),bu()});async function hy(e,t,r,n){let i=t[0]?.replace(/['"]/g,"")||"main",s=ou();if(i!=="main")s=s.replace("container:'main'",`container:'${i}'`);return`<script data-stx-router>${s}</script>`}var wu,bu=R(()=>{fy(),wu={name:"stxRouter",handler:hy,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function xu(e){let t=e.heatmap;if(!t?.enabled)return"";let r={...Su,...t};return`
1892
1892
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1893
1893
  <script>
1894
1894
  (function() {
@@ -2271,10 +2271,10 @@ else {
2271
2271
  };
2272
2272
  })();
2273
2273
  </script>
2274
- `}function hy(e,t){let r=bu(t);if(!r)return e;let n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+r+e.slice(n);return e+r}function my(e){let t={},r=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let n of r){let[i,s]=n.split("="),a=s?.replace(/["']/g,"");switch(i){case"endpoint":t.endpoint=a;break;case"samplingRate":t.samplingRate=Number.parseInt(a,10);break;case"batchSize":t.batchSize=Number.parseInt(a,10);break;case"trackMouse":t.trackMouse=a==="true";break;case"trackClicks":t.trackClicks=a==="true";break;case"trackScroll":t.trackScroll=a==="true";break;case"honorDnt":t.honorDnt=a==="true";break;case"debugOverlay":t.debugOverlay=a==="true";break}}return t}var xu,Su,_u=R(()=>{xu={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1},Su={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,t,r,n)=>{let i=r.__stx_config||{};if(t.length>0){let s=my(t.join(" "));i.heatmap={...i.heatmap,...s,enabled:!0}}return bu(i)}}});function ht(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ol(e){let t=e.trim().toLowerCase();return!t.startsWith("javascript:")&&!t.startsWith("vbscript:")&&!t.startsWith("data:text/html")}function gy(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,r=e.match(t);if(!r)return{data:{},content:e.trim()};let n=r[1],i=e.slice(r[0].length),s={};for(let a of n.split(`
2275
- `)){let o=a.trim();if(!o||o.startsWith("#"))continue;let l=o.indexOf(":");if(l===-1)continue;let c=o.slice(0,l).trim(),u=o.slice(l+1).trim();if(typeof u==="string"){if(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))u=u.slice(1,-1);else if(u.startsWith("[")&&u.endsWith("]"))try{u=JSON.parse(u)}catch{}else if(u==="true")u=!0;else if(u==="false")u=!1;else if(/^-?\d+(?:\.\d+)?$/.test(u))u=Number(u)}s[c]=u}return{data:s,content:i.trim()}}function Ca(e,t={}){let{gfm:r=!0,breaks:n=!1}=t,i=e,s=[];if(i=i.replace(/```(\w*)\n([\s\S]*?)```/g,(u,d,h)=>{let p=s.length,f=d?` class="language-${ht(d)}"`:"";return s.push(`<pre><code${f}>${ht(h.trim())}</code></pre>`),`\x00CODEBLOCK${p}\x00`}),i=i.replace(/`([^`]*)`/g,(u,d)=>`<code>${ht(d)}</code>`),i=i.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),i=i.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),i=i.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),i=i.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),i=i.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),i=i.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),i=i.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),i=i.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),i=i.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),i=i.replace(/__(.+?)__/g,"<strong>$1</strong>"),i=i.replace(/\*(.+?)\*/g,"<em>$1</em>"),i=i.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),r)i=i.replace(/~~(.+?)~~/g,"<del>$1</del>");if(i=i.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(u,d,h)=>{return`<img src="${ol(h)?ht(h):""}" alt="${ht(d)}" />`}),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(u,d,h)=>{return`<a href="${ol(h)?ht(h):""}">${d}</a>`}),i=i.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),i=i.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),i=i.replace(/<\/blockquote>\n<blockquote>/g,`
2276
- `),i=i.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),i=i.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),i=i.replace(/<\/ul>\n<ul>/g,""),i=i.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),i=i.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),i=i.replace(/<\/ol>\n<ol>/g,""),i=i.replace(/<li data-ul>/g,"<li>"),i=i.replace(/<li data-ol>/g,"<li>"),r)i=i.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(u,d,h)=>{let p=`<tr>${d.split("|").map((m)=>m.trim()).filter(Boolean).map((m)=>`<th>${ht(m)}</th>`).join("")}</tr>`,f=h.trim().split(`
2277
- `).map((m)=>{return`<tr>${m.split("|").map((y)=>y.trim()).filter(Boolean).map((y)=>`<td>${ht(y)}</td>`).join("")}</tr>`}).join(`
2274
+ `}function my(e,t){let r=xu(t);if(!r)return e;let n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+r+e.slice(n);return e+r}function gy(e){let t={},r=e.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let n of r){let[i,s]=n.split("="),a=s?.replace(/["']/g,"");switch(i){case"endpoint":t.endpoint=a;break;case"samplingRate":t.samplingRate=Number.parseInt(a,10);break;case"batchSize":t.batchSize=Number.parseInt(a,10);break;case"trackMouse":t.trackMouse=a==="true";break;case"trackClicks":t.trackClicks=a==="true";break;case"trackScroll":t.trackScroll=a==="true";break;case"honorDnt":t.honorDnt=a==="true";break;case"debugOverlay":t.debugOverlay=a==="true";break}}return t}var Su,_u,ku=R(()=>{Su={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1},_u={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(e,t,r,n)=>{let i=r.__stx_config||{};if(t.length>0){let s=gy(t.join(" "));i.heatmap={...i.heatmap,...s,enabled:!0}}return xu(i)}}});function mt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function ll(e){let t=e.trim().toLowerCase();return!t.startsWith("javascript:")&&!t.startsWith("vbscript:")&&!t.startsWith("data:text/html")}function yy(e){let t=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,r=e.match(t);if(!r)return{data:{},content:e.trim()};let n=r[1],i=e.slice(r[0].length),s={};for(let a of n.split(`
2275
+ `)){let o=a.trim();if(!o||o.startsWith("#"))continue;let l=o.indexOf(":");if(l===-1)continue;let c=o.slice(0,l).trim(),u=o.slice(l+1).trim();if(typeof u==="string"){if(u.startsWith('"')&&u.endsWith('"')||u.startsWith("'")&&u.endsWith("'"))u=u.slice(1,-1);else if(u.startsWith("[")&&u.endsWith("]"))try{u=JSON.parse(u)}catch{}else if(u==="true")u=!0;else if(u==="false")u=!1;else if(/^-?\d+(?:\.\d+)?$/.test(u))u=Number(u)}s[c]=u}return{data:s,content:i.trim()}}function Ta(e,t={}){let{gfm:r=!0,breaks:n=!1}=t,i=e,s=[];if(i=i.replace(/```(\w*)\n([\s\S]*?)```/g,(u,d,h)=>{let p=s.length,f=d?` class="language-${mt(d)}"`:"";return s.push(`<pre><code${f}>${mt(h.trim())}</code></pre>`),`\x00CODEBLOCK${p}\x00`}),i=i.replace(/`([^`]*)`/g,(u,d)=>`<code>${mt(d)}</code>`),i=i.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),i=i.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),i=i.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),i=i.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),i=i.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),i=i.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),i=i.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),i=i.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),i=i.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),i=i.replace(/__(.+?)__/g,"<strong>$1</strong>"),i=i.replace(/\*(.+?)\*/g,"<em>$1</em>"),i=i.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),r)i=i.replace(/~~(.+?)~~/g,"<del>$1</del>");if(i=i.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(u,d,h)=>`<img src="${ll(h)?mt(h):""}" alt="${mt(d)}" />`),i=i.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(u,d,h)=>`<a href="${ll(h)?mt(h):""}">${d}</a>`),i=i.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),i=i.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),i=i.replace(/<\/blockquote>\n<blockquote>/g,`
2276
+ `),i=i.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),i=i.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),i=i.replace(/<\/ul>\n<ul>/g,""),i=i.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),i=i.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),i=i.replace(/<\/ol>\n<ol>/g,""),i=i.replace(/<li data-ul>/g,"<li>"),i=i.replace(/<li data-ol>/g,"<li>"),r)i=i.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(u,d,h)=>{let p=`<tr>${d.split("|").map((m)=>m.trim()).filter(Boolean).map((m)=>`<th>${mt(m)}</th>`).join("")}</tr>`,f=h.trim().split(`
2277
+ `).map((m)=>`<tr>${m.split("|").map((y)=>y.trim()).filter(Boolean).map((y)=>`<td>${mt(y)}</td>`).join("")}</tr>`).join(`
2278
2278
  `);return`<table>
2279
2279
  <thead>
2280
2280
  ${p}
@@ -2289,7 +2289,7 @@ ${f}
2289
2289
  `:`
2290
2290
  `)}</p>`);if(i=o.join(`
2291
2291
  `),n)i=i.replace(/\n/g,`<br />
2292
- `);for(let u=0;u<s.length;u++)i=i.replace(`\x00CODEBLOCK${u}\x00`,s[u]);return i=i.replace(/<p>\s*<\/p>/g,""),i.trim()}function Ta(e="const",t=[],r){let n=t.length?Ht.filter((i)=>!t.includes(i)):Ht;if(r!==void 0)n=n.filter((i)=>{let s=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${s}(?![\\w$])`).test(r)});return`${e} { ${n.join(", ")} } = window.stx;`}function ku(e){if(!e)return!1;return Tu.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}function Eu(e){if(!e)return!1;let t=Au(e);if(Ru.some((r)=>r.test(t)))return!0;return ku(t)}function yy(e){if(!e)return!1;return Iu.test(Au(e))||Eu(e)}function vy(e){return Ou.includes(e.toLowerCase())}function wy(){return`{${xs.map((e)=>`'${e}':1`).join(",")}}`}function Au(e){if(!e)return e;let t=(r)=>r.replace(/(<[^>]*>)|([^<]+)/g,(n,i,s)=>i??" ".repeat(s.length));return e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(r,n,i,s)=>n+t(i)+s).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(r,n,i,s)=>n+t(i)+s).replace(/<!--[\s\S]*?-->/g,(r)=>" ".repeat(r.length))}var Ht,Cu,ll,Tu,Ru,Iu,Ou,xs,cl,ju,nt=R(()=>{Ht=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Cu=["onMount","onDestroy"],ll=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],Tu=Ht.filter((e)=>!ll.includes(e)),Ru=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],Iu=/\s@[a-z][\w.:-]*\s*=/i,Ou=["if","else-if","elseif","else","for","show","key","text","html","model","ref"],xs=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],cl=["x-init","x-transition","x-effect","x-on"],ju=[...xs,...cl]});function ul(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let n=r.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(Nu.has(n))t.systemKeys.push(n);else if(n in Ra)t.mouse=n;else if(n in _s||/^[a-z]$/.test(n))t.keys.push(_s[n]||n.toUpperCase());else if(n.startsWith("debounce")){let i=n.match(/debounce(?:\.(\d+))?/);t.debounce=i?.[1]?Number.parseInt(i[1],10):300}else if(n.startsWith("throttle")){let i=n.match(/throttle(?:\.(\d+))?/);t.throttle=i?.[1]?Number.parseInt(i[1],10):300}}return t}function Du(e){let t=[],r=0,n=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,i;while((i=n.exec(e))!==null){let[s,a,o]=i,l=i.index,c=l+s.length,u=`__stx_evt_${r++}`,d=[],h=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,p;while((p=h.exec(o))!==null){let[,m,y]=p,g=m.split("."),v=g[0];if(!Ss.has(v))continue;d.push({attribute:`@${m}`,event:v,handler:y,modifiers:ul(g.slice(1)),elementId:u})}let f=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((p=f.exec(o))!==null){let[,m,y]=p,g=m.split("."),v=g[0];if(!Ss.has(v))continue;d.push({attribute:`@${m}`,event:v,handler:y,modifiers:ul(g.slice(1)),elementId:u})}if(d.length>0)t.push({originalTag:s,elementId:u,events:d,startIndex:l,endIndex:c})}return t}function by(e){let t=[],{modifiers:r}=e;if(r.self)t.push("if ($event.target !== $el) return");for(let n of r.systemKeys)t.push(`if (!$event.${n}Key) return`);if(r.keys.length>0){let n=r.keys.map((i)=>`$event.key === '${i}'`).join(" || ");t.push(`if (!(${n})) return`)}if(r.mouse!==null){let n=Ra[r.mouse];t.push(`if ($event.button !== ${n}) return`)}if(r.prevent)t.push("$event.preventDefault()");if(r.stop)t.push("$event.stopPropagation()");return t.join("; ")}function xy(e,t){let r=e;if(t.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${t.debounce})`;else if(t.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${t.throttle})`;return r}function $u(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Sy(e){let{modifiers:t}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=by(e),i=xy($u(e.handler),t),s=[];if(t.once)s.push("once: true");if(t.capture)s.push("capture: true");if(t.passive)s.push("passive: true");let a=s.length>0?`, { ${s.join(", ")} }`:"",o=i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2292
+ `);for(let u=0;u<s.length;u++)i=i.replace(`\x00CODEBLOCK${u}\x00`,s[u]);return i=i.replace(/<p>\s*<\/p>/g,""),i.trim()}function Ra(e="const",t=[],r){let n=t.length?Ut.filter((i)=>!t.includes(i)):Ut;if(r!==void 0)n=n.filter((i)=>{let s=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${s}(?![\\w$])`).test(r)});return`${e} { ${n.join(", ")} } = window.stx;`}function Eu(e){if(!e)return!1;return Ru.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}function Au(e){if(!e)return!1;let t=Cu(e);if(Iu.some((r)=>r.test(t)))return!0;return Eu(t)}function vy(e){if(!e)return!1;return Ou.test(Cu(e))||Au(e)}function wy(e){return ju.includes(e.toLowerCase())}function by(){return`{${Ss.map((e)=>`'${e}':1`).join(",")}}`}function Cu(e){if(!e)return e;let t=(r)=>r.replace(/(<[^>]*>)|([^<]+)/g,(n,i,s)=>i??" ".repeat(s.length));return e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(r,n,i,s)=>n+t(i)+s).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(r,n,i,s)=>n+t(i)+s).replace(/<!--[\s\S]*?-->/g,(r)=>" ".repeat(r.length))}var Ut,Tu,cl,Ru,Iu,Ou,ju,Ss,ul,Du,it=R(()=>{Ut=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Tu=["onMount","onDestroy"],cl=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],Ru=Ut.filter((e)=>!cl.includes(e)),Iu=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],Ou=/\s@[a-z][\w.:-]*\s*=/i,ju=["if","else-if","elseif","else","for","show","key","text","html","model","ref"],Ss=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],ul=["x-init","x-transition","x-effect","x-on"],Du=[...Ss,...ul]});function dl(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let r of e){let n=r.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(Pu.has(n))t.systemKeys.push(n);else if(n in Ia)t.mouse=n;else if(n in ks||/^[a-z]$/.test(n))t.keys.push(ks[n]||n.toUpperCase());else if(n.startsWith("debounce")){let i=n.match(/debounce(?:\.(\d+))?/);t.debounce=i?.[1]?Number.parseInt(i[1],10):300}else if(n.startsWith("throttle")){let i=n.match(/throttle(?:\.(\d+))?/);t.throttle=i?.[1]?Number.parseInt(i[1],10):300}}return t}function $u(e){let t=[],r=0,n=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,i;while((i=n.exec(e))!==null){let[s,a,o]=i,l=i.index,c=l+s.length,u=`__stx_evt_${r++}`,d=[],h=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,p;while((p=h.exec(o))!==null){let[,m,y]=p,g=m.split("."),v=g[0];if(!_s.has(v))continue;d.push({attribute:`@${m}`,event:v,handler:y,modifiers:dl(g.slice(1)),elementId:u})}let f=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((p=f.exec(o))!==null){let[,m,y]=p,g=m.split("."),v=g[0];if(!_s.has(v))continue;d.push({attribute:`@${m}`,event:v,handler:y,modifiers:dl(g.slice(1)),elementId:u})}if(d.length>0)t.push({originalTag:s,elementId:u,events:d,startIndex:l,endIndex:c})}return t}function xy(e){let t=[],{modifiers:r}=e;if(r.self)t.push("if ($event.target !== $el) return");for(let n of r.systemKeys)t.push(`if (!$event.${n}Key) return`);if(r.keys.length>0){let n=r.keys.map((i)=>`$event.key === '${i}'`).join(" || ");t.push(`if (!(${n})) return`)}if(r.mouse!==null){let n=Ia[r.mouse];t.push(`if ($event.button !== ${n}) return`)}if(r.prevent)t.push("$event.preventDefault()");if(r.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Sy(e,t){let r=e;if(t.debounce!==null)r=`__stx_debounce(() => { ${r} }, ${t.debounce})`;else if(t.throttle!==null)r=`__stx_throttle(() => { ${r} }, ${t.throttle})`;return r}function Lu(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function _y(e){let{modifiers:t}=e,r=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=xy(e),i=Sy(Lu(e.handler),t),s=[];if(t.once)s.push("once: true");if(t.capture)s.push("capture: true");if(t.passive)s.push("passive: true");let a=s.length>0?`, { ${s.join(", ")} }`:"",o=i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
2293
2293
  (function() {
2294
2294
  var $el = document.getElementById('${r}');
2295
2295
  if (!$el) return;
@@ -2343,7 +2343,7 @@ else {
2343
2343
  __stx_runHandler('${o}', $event, $el);
2344
2344
  }
2345
2345
  }${a});
2346
- })();`}function Lu(e){if(e.length===0)return"";return`
2346
+ })();`}function Nu(e){if(e.length===0)return"";return`
2347
2347
  <script data-stx-events>
2348
2348
  (function() {
2349
2349
  'use strict';
@@ -2398,24 +2398,24 @@ else {
2398
2398
  }
2399
2399
 
2400
2400
  // Event listeners
2401
- ${e.map(Sy).join(`
2401
+ ${e.map(_y).join(`
2402
2402
  `)}
2403
2403
  })();
2404
- </script>`}function _y(e){let t=Du(e);if(t.length===0)return{template:e,bindings:[]};let r=e,n=[];for(let i=t.length-1;i>=0;i--){let s=t[i],a=s.originalTag;if(!a.includes(" id="))a=a.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${s.elementId}"`);else{let o=a.match(/id=["']([^"']+)["']/);if(o)for(let l of s.events)l.elementId=o[1]}for(let o of s.events){let l=o.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`\\s*${l}\\s*=\\s*"[^"]*"`,"g"),u=new RegExp(`\\s*${l}\\s*=\\s*'[^']*'`,"g");a=a.replace(c,""),a=a.replace(u,"")}r=r.slice(0,s.startIndex)+a+r.slice(s.endIndex),n.push(...s.events)}return{template:r,bindings:n}}function ky(e,t,r){if(Eu(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:o,bindings:l}=_y(e),c=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...c,...l],o}let n=Du(e);if(n.length===0)return e;let i=e;for(let o=n.length-1;o>=0;o--){let l=n[o],c=l.originalTag;if(!c.includes(" id="))c=c.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let u=c.match(/id=["']([^"']+)["']/);if(u)for(let d of l.events)d.elementId=u[1]}for(let u of l.events){let d=u.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\s*${d}\\s*=\\s*"[^"]*"`,"g"),p=new RegExp(`\\s*${d}\\s*=\\s*'[^']*'`,"g");c=c.replace(h,""),c=c.replace(p,"")}i=i.slice(0,l.startIndex)+c+i.slice(l.endIndex)}let s=Lu(n.flatMap((o)=>o.events)),a=i.lastIndexOf("</body>");if(a!==-1)i=i.slice(0,a)+s+`
2405
- `+i.slice(a);else i+=s;return i}var Ss,_s,Nu,Ra,Pu=R(()=>{nt(),Ss=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),_s={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Nu=new Set(["ctrl","alt","shift","meta"]),Ra={left:0,middle:1,right:2}});function Ut(e){let t=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;e=e.replace(t,(n,i)=>{return`const { ${i.split(",").map((s)=>s.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2406
- `});let r=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return e=e.replace(r,(n,i)=>{return`const { ${i.split(",").map((s)=>s.trim()).filter(Boolean).join(", ")} } = window.__composables
2407
- `}),e}function Mu(e){return e.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Ey(e,t){let r=e[t],n=t+1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]===r)return n+1;n++}return e.length}function Ay(e,t){let r=t+1;while(r<e.length){if(e[r]==="\\"){r+=2;continue}if(e[r]==="`")return r+1;if(e[r]==="$"&&e[r+1]==="{"){if(r=Ia(e,r+2),r<e.length)r++;continue}r++}return e.length}function Ia(e,t){let r=1,n=t;while(n<e.length){let i=e[n];if(i==="\\"){n+=2;continue}if(i==='"'||i==="'"){n=Ey(e,n);continue}if(i==="`"){n=Ay(e,n);continue}if(i==="/"&&e[n+1]==="/"){while(n<e.length&&e[n]!==`
2408
- `)n++;continue}if(i==="/"&&e[n+1]==="*"){n+=2;while(n<e.length&&e.slice(n,n+2)!=="*/")n++;n+=2;continue}if(i==="{"){r++,n++;continue}if(i==="}"){if(r--,r===0)return n;n++;continue}n++}return e.length}function Kt(e){let t="",r=0;while(r<e.length){let n=e.slice(r,r+2);if(n==="//"){while(r<e.length&&e[r]!==`
2404
+ </script>`}function ky(e){let t=$u(e);if(t.length===0)return{template:e,bindings:[]};let r=e,n=[];for(let i=t.length-1;i>=0;i--){let s=t[i],a=s.originalTag;if(!a.includes(" id="))a=a.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${s.elementId}"`);else{let o=a.match(/id=["']([^"']+)["']/);if(o)for(let l of s.events)l.elementId=o[1]}for(let o of s.events){let l=o.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`\\s*${l}\\s*=\\s*"[^"]*"`,"g"),u=new RegExp(`\\s*${l}\\s*=\\s*'[^']*'`,"g");a=a.replace(c,""),a=a.replace(u,"")}r=r.slice(0,s.startIndex)+a+r.slice(s.endIndex),n.push(...s.events)}return{template:r,bindings:n}}function Ey(e,t,r){if(Au(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:o,bindings:l}=ky(e),c=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...c,...l],o}let n=$u(e);if(n.length===0)return e;let i=e;for(let o=n.length-1;o>=0;o--){let l=n[o],c=l.originalTag;if(!c.includes(" id="))c=c.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${l.elementId}"`);else{let u=c.match(/id=["']([^"']+)["']/);if(u)for(let d of l.events)d.elementId=u[1]}for(let u of l.events){let d=u.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),h=new RegExp(`\\s*${d}\\s*=\\s*"[^"]*"`,"g"),p=new RegExp(`\\s*${d}\\s*=\\s*'[^']*'`,"g");c=c.replace(h,""),c=c.replace(p,"")}i=i.slice(0,l.startIndex)+c+i.slice(l.endIndex)}let s=Nu(n.flatMap((o)=>o.events)),a=i.lastIndexOf("</body>");if(a!==-1)i=i.slice(0,a)+s+`
2405
+ `+i.slice(a);else i+=s;return i}var _s,ks,Pu,Ia,Mu=R(()=>{it(),_s=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),ks={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Pu=new Set(["ctrl","alt","shift","meta"]),Ia={left:0,middle:1,right:2}});function Gt(e){let t=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;e=e.replace(t,(n,i)=>`const { ${i.split(",").map((s)=>s.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2406
+ `);let r=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return e=e.replace(r,(n,i)=>`const { ${i.split(",").map((s)=>s.trim()).filter(Boolean).join(", ")} } = window.__composables
2407
+ `),e}function Bu(e){return e.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Ay(e,t){let r=e[t],n=t+1;while(n<e.length){if(e[n]==="\\"){n+=2;continue}if(e[n]===r)return n+1;n++}return e.length}function Cy(e,t){let r=t+1;while(r<e.length){if(e[r]==="\\"){r+=2;continue}if(e[r]==="`")return r+1;if(e[r]==="$"&&e[r+1]==="{"){if(r=Oa(e,r+2),r<e.length)r++;continue}r++}return e.length}function Oa(e,t){let r=1,n=t;while(n<e.length){let i=e[n];if(i==="\\"){n+=2;continue}if(i==='"'||i==="'"){n=Ay(e,n);continue}if(i==="`"){n=Cy(e,n);continue}if(i==="/"&&e[n+1]==="/"){while(n<e.length&&e[n]!==`
2408
+ `)n++;continue}if(i==="/"&&e[n+1]==="*"){n+=2;while(n<e.length&&e.slice(n,n+2)!=="*/")n++;n+=2;continue}if(i==="{"){r++,n++;continue}if(i==="}"){if(r--,r===0)return n;n++;continue}n++}return e.length}function Zt(e){let t="",r=0;while(r<e.length){let n=e.slice(r,r+2);if(n==="//"){while(r<e.length&&e[r]!==`
2409
2409
  `)t+=" ",r++;continue}if(n==="/*"){while(r<e.length&&e.slice(r,r+2)!=="*/")t+=e[r]===`
2410
2410
  `?`
2411
2411
  `:" ",r++;t+=" ",r+=2;continue}let i=e[r];if(i==='"'||i==="'"){let s=i;t+=" ",r++;while(r<e.length&&e[r]!==s){if(e[r]==="\\"){t+=" ",r+=2;continue}t+=e[r]===`
2412
2412
  `?`
2413
- `:" ",r++}t+=" ",r++;continue}if(i==="`"){t+=" ",r++;while(r<e.length&&e[r]!=="`"){if(e[r]==="\\"){t+=" ",r+=2;continue}if(e[r]==="$"&&e[r+1]==="{"){let s=r+2,a=Ia(e,s);if(t+=" ",t+=Kt(e.slice(s,a)),a<e.length)t+=" ";r=a+1;continue}t+=e[r]===`
2413
+ `:" ",r++}t+=" ",r++;continue}if(i==="`"){t+=" ",r++;while(r<e.length&&e[r]!=="`"){if(e[r]==="\\"){t+=" ",r+=2;continue}if(e[r]==="$"&&e[r+1]==="{"){let s=r+2,a=Oa(e,s);if(t+=" ",t+=Zt(e.slice(s,a)),a<e.length)t+=" ";r=a+1;continue}t+=e[r]===`
2414
2414
  `?`
2415
- `:" ",r++}t+=" ",r++;continue}t+=i,r++}return t}function Cy(){let e=globalThis;return e[ks]??=new Map,e[ks]}function X(e,t){let r=Cy(),n=`${import.meta.url}\x00${e}`,i=r.get(n);if(i)return i;let s=t();return r.set(n,s),s.catch(()=>{if(r.get(n)===s)r.delete(n)}),s}var ks,Ai=R(()=>{ks=Symbol.for("stx.lazy-module-promises")});function On(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Bu,"<\\/$1")}var Bu,zu=R(()=>{Bu=/<\/(script)/gi});function Zt(e="STX_PUBLIC_"){let t={},r={};for(let[n,i]of Object.entries(Ty.env)){if(!n.startsWith(e)||i===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(i),r[n]=i}return t["import.meta.env"]=JSON.stringify(r),t}var Qt=()=>{};function Ry(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function Iy(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function Fu(e,t){let r=[];for(let n of Iy(e)){if(Ry(n)){let i=n.position||void 0;r.push({file:t||i?.file,line:i?.line,column:i?.column,message:n.message??"",lineText:i?.lineText});continue}r.push({file:t,message:n instanceof Error?n.message:String(n)})}return r}function Oy(e,t){return Fu(e,t).map((r)=>{let n=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",i=r.lineText?`
2415
+ `:" ",r++}t+=" ",r++;continue}t+=i,r++}return t}function Ty(){let e=globalThis;return e[Es]??=new Map,e[Es]}function ee(e,t){let r=Ty(),n=`${import.meta.url}\x00${e}`,i=r.get(n);if(i)return i;let s=t();return r.set(n,s),s.catch(()=>{if(r.get(n)===s)r.delete(n)}),s}var Es,Ci=R(()=>{Es=Symbol.for("stx.lazy-module-promises")});function jn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(zu,"<\\/$1")}var zu,Fu=R(()=>{zu=/<\/(script)/gi});function Qt(e="STX_PUBLIC_"){let t={},r={};for(let[n,i]of Object.entries(Ry.env)){if(!n.startsWith(e)||i===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(i),r[n]=i}return t["import.meta.env"]=JSON.stringify(r),t}var Xt=()=>{};function Iy(e){if(!e||typeof e!=="object")return!1;let t=e;return typeof t.message==="string"&&(t.name==="BuildMessage"||t.name==="ResolveMessage"||("position"in t))}function Oy(e){if(e&&typeof e==="object"&&Array.isArray(e.errors))return e.errors;return[e]}function qu(e,t){let r=[];for(let n of Oy(e)){if(Iy(n)){let i=n.position||void 0;r.push({file:t||i?.file,line:i?.line,column:i?.column,message:n.message??"",lineText:i?.lineText});continue}r.push({file:t,message:n instanceof Error?n.message:String(n)})}return r}function jy(e,t){return qu(e,t).map((r)=>{let n=r.file?`${r.file}${r.line?`:${r.line}${r.column?`:${r.column}`:""}`:""}`:"",i=r.lineText?`
2416
2416
  ${r.lineText.trim()}`:"";return n?`${n}: ${r.message}${i}`:`${r.message}${i}`}).join(`
2417
- `)}var pn={};Y(pn,{shouldLogBundlerDiagnostics:()=>qu,setBundlerFallbackMode:()=>$y,resolveBundlerFallback:()=>Hu,recordBundleFailure:()=>Wu,queueClientBundleBuild:()=>Uu,hasUserImports:()=>Ly,getBundleFailures:()=>jy,clearBundleFailures:()=>Dy,bundleClientScript:()=>Py});function qu(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function Gt(...e){if(qu())console.log("[stx:bundler]",...e)}function Wu(e,t,r){Ci.push({filePath:e||"<inline>",message:t,details:r})}function jy(){return Ci.slice()}function Dy(){Ci.length=0}function $y(e){Es=e}function Hu(){if(Es)return Es;try{let e=Wi.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}function Ly(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let i=r[1];if(!As.some((s)=>s.test(i)))return Gt("detected user import:",i),!0}let n=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=n.exec(e))!==null){let i=r[1];if(/\.css(?:\?.*)?$/.test(i))continue;if(!As.some((s)=>s.test(i)))return Gt("detected side-effect import:",i),!0}return!1}function Ny(e,t,r,n){let i=(s,a)=>{let o=s===r?t:fe.dirname(s),l=fe.resolve(o,a),c=[l,`${l}.ts`,`${l}.tsx`,`${l}.js`,`${l}.mjs`,`${l}.jsx`,fe.join(l,"index.ts"),fe.join(l,"index.tsx"),fe.join(l,"index.js"),fe.join(l,"index.mjs")];for(let u of c)try{if(De.existsSync(u)&&De.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return l};return{name:"stx-client-bundle",setup(s){s.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(a)=>({path:a.path,external:!0})),s.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(a)=>({path:a.path,external:!0})),s.onResolve({filter:/^\//},(a)=>{if(De.existsSync(a.path))return{path:a.path};return{path:a.path,external:!0}}),s.onResolve({filter:/^\.\.?\//},(a)=>{let o=i(a.importer,a.path);return n.add(o),{path:o}}),s.onResolve({filter:/^[@~]\//},(a)=>{let o=fe.resolve(e,a.path.slice(2)),l=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,fe.join(o,"index.ts"),fe.join(o,"index.tsx"),fe.join(o,"index.js"),fe.join(o,"index.mjs")];for(let c of l)if(De.existsSync(c)&&De.statSync(c,{throwIfNoEntry:!1})?.isFile())return Gt(`resolved ${a.path[0]}/ import:`,a.path,"\u2192",c),n.add(c),{path:c};return console.warn(`[stx:bundler] could not resolve ${a.path[0]}/ import:`,a.path),{path:o}}),s.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(a)=>{let o=fe.extname(a.path).toLowerCase(),l=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(a.path!==r)n.add(a.path);return{contents:De.readFileSync(a.path,"utf8"),loader:l}})}}}function Uu(e){let t=globalThis,r=(t[Cs]??Promise.resolve()).then(e,e);return t[Cs]=r.then(()=>{return},()=>{return}),r}async function Py(e,t,r={}){let n=r.projectRoot||process.cwd(),i=r.minify??!1,s=r.cacheDir||Er(n,"bundle-cache"),a=new Bun.CryptoHasher("md5");a.update(`${By}\x00${e}\x00${t}`);let o=a.digest("hex").slice(0,12),l=fe.join(s,`${o}.js`),c=fe.join(s,`${o}.deps.json`),u=Bun.file(l);if(await u.exists()){let p=Bun.file(c),f=!0;if(await p.exists())try{let m=JSON.parse(await p.text());if(m.metadataVersion!==Gu||!Array.isArray(m.files))f=!1;for(let y of Array.isArray(m.files)?m.files:[])try{if(De.statSync(y.path).mtimeMs!==y.mtimeMs){f=!1;break}}catch{f=!1;break}}catch{f=!1}if(f)return Gt("cache hit:",o),await u.text();Gt("cache invalidated by dep change:",o)}let d=jn.get(o);if(d)return await d;let h=Uu(()=>My(e,t,{projectRoot:n,minify:i,cacheDir:s,hash:o,cachePath:l,depsPath:c}));jn.set(o,h);try{return await h}finally{jn.delete(o)}}async function My(e,t,r){let{projectRoot:n,minify:i,cacheDir:s,hash:a,cachePath:o,depsPath:l}=r,c=Er(n,"bundle-tmp"),u=fe.join(c,`${a}.ts`),d=fe.join(c,"out",a);De.mkdirSync(c,{recursive:!0}),De.mkdirSync(d,{recursive:!0});let h=fe.dirname(t),p=[],f=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,m=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,y;while((y=f.exec(e))!==null){if(y[1])continue;if(y[2])y[2].split(",").forEach((w)=>{let b=w.split(":")[0].trim();if(b)p.push(b)});else if(y[3])p.push(y[3])}while((y=m.exec(e))!==null){if(y[1])continue;p.push(y[2])}let g=p.length>0?`
2418
- export { ${p.join(", ")} }`:"";await Bun.write(u,e+g),Gt("bundling:",a,"from:",fe.basename(t));let v=new Set;try{let w=await Bun.build({entrypoints:[u],outdir:d,target:"browser",format:"esm",minify:i,plugins:[Ny(n,h,u,v)],define:{"process.env.NODE_ENV":i?'"production"':'"development"',...Zt()},root:n});if(!w.success){let C=w.logs.filter((D)=>D.level==="error").map((D)=>D.message).join(", ");return console.warn("[stx:bundler] build failed:",C),e}let b="";for(let C of w.outputs){b=await C.text();break}let S=[];for(let C of b.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let D of C[1].split(",")){let I=D.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(I){S.push([I[2],I[1]]);continue}let O=D.trim();if(/^[A-Za-z_$][\w$]*$/.test(O))S.push([O,O])}let x=b.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];b=b.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let _=`__stxBundle_${a}`,E=S.map(([C,D])=>`${JSON.stringify(C)}: ${D}`).join(", "),k=S.map(([C])=>`var ${C} = undefined;`).join(`
2417
+ `)}var fn={};K(fn,{shouldLogBundlerDiagnostics:()=>Wu,setBundlerFallbackMode:()=>Ly,resolveBundlerFallback:()=>Uu,recordBundleFailure:()=>Hu,queueClientBundleBuild:()=>Gu,hasUserImports:()=>Ny,getBundleFailures:()=>Dy,clearBundleFailures:()=>$y,bundleClientScript:()=>My});function Wu(e=process.env){return e.STX_DEBUG==="true"||e.STX_DEBUG==="1"}function Vt(...e){if(Wu())console.log("[stx:bundler]",...e)}function Hu(e,t,r){Ti.push({filePath:e||"<inline>",message:t,details:r})}function Dy(){return Ti.slice()}function $y(){Ti.length=0}function Ly(e){As=e}function Uu(){if(As)return As;try{let e=Hi.strict;return typeof e==="object"&&e!==null?e.bundlerFallback??"warn":"warn"}catch{return"warn"}}function Ny(e){let t=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,r;while((r=t.exec(e))!==null){let i=r[1];if(!Cs.some((s)=>s.test(i)))return Vt("detected user import:",i),!0}let n=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((r=n.exec(e))!==null){let i=r[1];if(/\.css(?:\?.*)?$/.test(i))continue;if(!Cs.some((s)=>s.test(i)))return Vt("detected side-effect import:",i),!0}return!1}function Py(e,t,r,n){let i=(s,a)=>{let o=s===r?t:he.dirname(s),l=he.resolve(o,a),c=[l,`${l}.ts`,`${l}.tsx`,`${l}.js`,`${l}.mjs`,`${l}.jsx`,he.join(l,"index.ts"),he.join(l,"index.tsx"),he.join(l,"index.js"),he.join(l,"index.mjs")];for(let u of c)try{if($e.existsSync(u)&&$e.statSync(u,{throwIfNoEntry:!1})?.isFile())return u}catch{}return l};return{name:"stx-client-bundle",setup(s){s.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(a)=>({path:a.path,external:!0})),s.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(a)=>({path:a.path,external:!0})),s.onResolve({filter:/^\//},(a)=>{if($e.existsSync(a.path))return{path:a.path};return{path:a.path,external:!0}}),s.onResolve({filter:/^\.\.?\//},(a)=>{let o=i(a.importer,a.path);return n.add(o),{path:o}}),s.onResolve({filter:/^[@~]\//},(a)=>{let o=he.resolve(e,a.path.slice(2)),l=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,he.join(o,"index.ts"),he.join(o,"index.tsx"),he.join(o,"index.js"),he.join(o,"index.mjs")];for(let c of l)if($e.existsSync(c)&&$e.statSync(c,{throwIfNoEntry:!1})?.isFile())return Vt(`resolved ${a.path[0]}/ import:`,a.path,"\u2192",c),n.add(c),{path:c};return console.warn(`[stx:bundler] could not resolve ${a.path[0]}/ import:`,a.path),{path:o}}),s.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(a)=>{let o=he.extname(a.path).toLowerCase(),l=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(a.path!==r)n.add(a.path);return{contents:$e.readFileSync(a.path,"utf8"),loader:l}})}}}function Gu(e){let t=globalThis,r=(t[Ts]??Promise.resolve()).then(e,e);return t[Ts]=r.then(()=>{return},()=>{return}),r}async function My(e,t,r={}){let n=r.projectRoot||process.cwd(),i=r.minify??!1,s=r.cacheDir||Ar(n,"bundle-cache"),a=new Bun.CryptoHasher("md5");a.update(`${zy}\x00${e}\x00${t}`);let o=a.digest("hex").slice(0,12),l=he.join(s,`${o}.js`),c=he.join(s,`${o}.deps.json`),u=Bun.file(l);if(await u.exists()){let p=Bun.file(c),f=!0;if(await p.exists())try{let m=JSON.parse(await p.text());if(m.metadataVersion!==Vu||!Array.isArray(m.files))f=!1;for(let y of Array.isArray(m.files)?m.files:[])try{if($e.statSync(y.path).mtimeMs!==y.mtimeMs){f=!1;break}}catch{f=!1;break}}catch{f=!1}if(f)return Vt("cache hit:",o),await u.text();Vt("cache invalidated by dep change:",o)}let d=Dn.get(o);if(d)return await d;let h=Gu(()=>By(e,t,{projectRoot:n,minify:i,cacheDir:s,hash:o,cachePath:l,depsPath:c}));Dn.set(o,h);try{return await h}finally{Dn.delete(o)}}async function By(e,t,r){let{projectRoot:n,minify:i,cacheDir:s,hash:a,cachePath:o,depsPath:l}=r,c=Ar(n,"bundle-tmp"),u=he.join(c,`${a}.ts`),d=he.join(c,"out",a);$e.mkdirSync(c,{recursive:!0}),$e.mkdirSync(d,{recursive:!0});let h=he.dirname(t),p=[],f=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,m=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,y;while((y=f.exec(e))!==null){if(y[1])continue;if(y[2])y[2].split(",").forEach((w)=>{let b=w.split(":")[0].trim();if(b)p.push(b)});else if(y[3])p.push(y[3])}while((y=m.exec(e))!==null){if(y[1])continue;p.push(y[2])}let g=p.length>0?`
2418
+ export { ${p.join(", ")} }`:"";await Bun.write(u,e+g),Vt("bundling:",a,"from:",he.basename(t));let v=new Set;try{let w=await Bun.build({entrypoints:[u],outdir:d,target:"browser",format:"esm",minify:i,plugins:[Py(n,h,u,v)],define:{"process.env.NODE_ENV":i?'"production"':'"development"',...Qt()},root:n});if(!w.success){let C=w.logs.filter((D)=>D.level==="error").map((D)=>D.message).join(", ");return console.warn("[stx:bundler] build failed:",C),e}let b="";for(let C of w.outputs){b=await C.text();break}let S=[];for(let C of b.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let D of C[1].split(",")){let I=D.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(I){S.push([I[2],I[1]]);continue}let O=D.trim();if(/^[A-Za-z_$][\w$]*$/.test(O))S.push([O,O])}let x=b.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];b=b.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let _=`__stxBundle_${a}`,E=S.map(([C,D])=>`${JSON.stringify(C)}: ${D}`).join(", "),k=S.map(([C])=>`var ${C} = undefined;`).join(`
2419
2419
  `),A=S.map(([C])=>`${C} = ${_}[${JSON.stringify(C)}];`).join(`
2420
2420
  `);if(b=`${x.join(`
2421
2421
  `)}
@@ -2424,18 +2424,18 @@ var ${_} = (function() {
2424
2424
  ${b}
2425
2425
  return { ${E} };
2426
2426
  })();
2427
- ${A}`.trim(),Gt("bundled:",a,"output:",b.length,"bytes"),p.length>0&&S.length===0)return console.warn(`[stx:bundler] dropped every binding for ${fe.basename(t)} (${a}); serving the unbundled source and not caching this result`),e;De.mkdirSync(s,{recursive:!0}),await Bun.write(o,b);let T=Array.from(v).map((C)=>{try{return{path:C,mtimeMs:De.statSync(C).mtimeMs}}catch{return null}}).filter((C)=>C!==null);return await Bun.write(l,JSON.stringify({metadataVersion:Gu,files:T})),b}catch(w){let b=Fu(w,t||void 0),S=Oy(w,t||void 0);if(console.warn(`[stx:bundler] error: ${S}`),Wu(t||"",S,b),Hu()==="error")throw w;return e}finally{try{De.rmSync(u,{force:!0}),De.rmSync(d,{recursive:!0,force:!0})}catch{}}}var By=5,Gu=1,Ci,Es,As,jn,Cs,Ti=R(()=>{Qt(),Ei(),Et(),Ci=[],As=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/],jn=new Map,Cs=Symbol.for("stx.client-bundle-build-queue")}),Vu={};Y(Vu,{stripCommentsAndLiterals:()=>Kt,renderVendorStyleTags:()=>ja,processClientScript:()=>Na,injectBrowserCoreAutoImports:()=>Ri,generateServerDataBridge:()=>La,generateBrowserAutoImportDestructuring:()=>Gy,generateAutoImportDestructuring:()=>Da,findInterpolationEnd:()=>Ia,extractBridgeData:()=>$a,extractAndStripCssImports:()=>Oa,STX_AUTO_IMPORTS:()=>Pa});function zy(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function Fy(e,t){let r=t;while(!0){let n=Bt.join(r,"node_modules",e,"package.json");if(nn.existsSync(n))return Bt.dirname(n);let i=Bt.dirname(r);if(i===r)return null;r=i}}function qy(e,t){if(!e||typeof e!=="object")return null;let r=(i)=>{if(typeof i==="string")return i;if(i&&typeof i==="object"){if(typeof i.import==="string")return i.import;if(typeof i.default==="string")return i.default;if(typeof i.import==="object")return r(i.import);if(typeof i.default==="object")return r(i.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return r(e[t]);let n=null;for(let i of Object.keys(e)){let s=i.indexOf("*");if(s===-1)continue;let a=i.slice(0,s),o=i.slice(s+1);if(!t.startsWith(a)||!t.endsWith(o))continue;if(t.length<a.length+o.length)continue;if(!n||a.length>n.prefix.length)n={pattern:i,prefix:a,suffix:o}}if(n){let i=t.slice(n.prefix.length,t.length-n.suffix.length),s=r(e[n.pattern]);if(s)return s.replace("*",i)}return null}function Wy(e,t){let r=zy(e);if(!r||!r.subpath)return null;let n=Fy(r.pkg,t);if(!n)return null;let i;try{i=JSON.parse(nn.readFileSync(Bt.join(n,"package.json"),"utf8"))}catch{return null}let s=`.${r.subpath}`,a=qy(i.exports,s);if(!a)return null;let o=Bt.resolve(n,a);return nn.existsSync(o)?o:null}function Oa(e,t){let r=t.filePath?Bt.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),i=new Set,s=[];return{code:e.replace(Ku,(a,o)=>{let l;try{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")){if(l=o.startsWith("/")?o:Bt.resolve(r,o),!nn.existsSync(l))throw Error(`file not found: ${l}`)}else{let c=null;try{c=Bun.resolveSync(o,n)}catch{c=Wy(o,n)}if(!c)throw Error(`could not resolve ${o} (Bun.resolveSync + exports fallback both failed)`);l=c}}catch(c){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(o)} (from ${t.filePath||"<unknown>"}): ${c?.message||c}`),""}if(i.has(l))return"";i.add(l);try{let c=nn.readFileSync(l,"utf8");s.push({source:o,resolvedPath:l,contents:c})}catch(c){console.warn(`[stx:vendor-css] could not read ${l}: ${c?.message||c}`)}return""}),styles:s}}function Hy(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ja(e){if(e.length===0)return"";return`${e.map((t)=>{return`<style data-stx-vendor="${Hy(t.source)}" data-stx-layer="vendor">
2427
+ ${A}`.trim(),Vt("bundled:",a,"output:",b.length,"bytes"),p.length>0&&S.length===0)return console.warn(`[stx:bundler] dropped every binding for ${he.basename(t)} (${a}); serving the unbundled source and not caching this result`),e;$e.mkdirSync(s,{recursive:!0}),await Bun.write(o,b);let T=Array.from(v).map((C)=>{try{return{path:C,mtimeMs:$e.statSync(C).mtimeMs}}catch{return null}}).filter((C)=>C!==null);return await Bun.write(l,JSON.stringify({metadataVersion:Vu,files:T})),b}catch(w){let b=qu(w,t||void 0),S=jy(w,t||void 0);if(console.warn(`[stx:bundler] error: ${S}`),Hu(t||"",S,b),Uu()==="error")throw w;return e}finally{try{$e.rmSync(u,{force:!0}),$e.rmSync(d,{recursive:!0,force:!0})}catch{}}}var zy=5,Vu=1,Ti,As,Cs,Dn,Ts,Ri=R(()=>{Xt(),Ai(),At(),Ti=[],Cs=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/],Dn=new Map,Ts=Symbol.for("stx.client-bundle-build-queue")}),Ju={};K(Ju,{stripCommentsAndLiterals:()=>Zt,renderVendorStyleTags:()=>Da,processClientScript:()=>Pa,injectBrowserCoreAutoImports:()=>Ii,generateServerDataBridge:()=>Na,generateBrowserAutoImportDestructuring:()=>Vy,generateAutoImportDestructuring:()=>$a,findInterpolationEnd:()=>Oa,extractBridgeData:()=>La,extractAndStripCssImports:()=>ja,STX_AUTO_IMPORTS:()=>Ma});function Fy(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let r=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!r)return null;return{pkg:r[1],subpath:r[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function qy(e,t){let r=t;while(!0){let n=zt.join(r,"node_modules",e,"package.json");if(sn.existsSync(n))return zt.dirname(n);let i=zt.dirname(r);if(i===r)return null;r=i}}function Wy(e,t){if(!e||typeof e!=="object")return null;let r=(i)=>{if(typeof i==="string")return i;if(i&&typeof i==="object"){if(typeof i.import==="string")return i.import;if(typeof i.default==="string")return i.default;if(typeof i.import==="object")return r(i.import);if(typeof i.default==="object")return r(i.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return r(e[t]);let n=null;for(let i of Object.keys(e)){let s=i.indexOf("*");if(s===-1)continue;let a=i.slice(0,s),o=i.slice(s+1);if(!t.startsWith(a)||!t.endsWith(o))continue;if(t.length<a.length+o.length)continue;if(!n||a.length>n.prefix.length)n={pattern:i,prefix:a,suffix:o}}if(n){let i=t.slice(n.prefix.length,t.length-n.suffix.length),s=r(e[n.pattern]);if(s)return s.replace("*",i)}return null}function Hy(e,t){let r=Fy(e);if(!r||!r.subpath)return null;let n=qy(r.pkg,t);if(!n)return null;let i;try{i=JSON.parse(sn.readFileSync(zt.join(n,"package.json"),"utf8"))}catch{return null}let s=`.${r.subpath}`,a=Wy(i.exports,s);if(!a)return null;let o=zt.resolve(n,a);return sn.existsSync(o)?o:null}function ja(e,t){let r=t.filePath?zt.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),i=new Set,s=[];return{code:e.replace(Zu,(a,o)=>{let l;try{if(o.startsWith("./")||o.startsWith("../")||o.startsWith("/")){if(l=o.startsWith("/")?o:zt.resolve(r,o),!sn.existsSync(l))throw Error(`file not found: ${l}`)}else{let c=null;try{c=Bun.resolveSync(o,n)}catch{c=Hy(o,n)}if(!c)throw Error(`could not resolve ${o} (Bun.resolveSync + exports fallback both failed)`);l=c}}catch(c){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(o)} (from ${t.filePath||"<unknown>"}): ${c?.message||c}`),""}if(i.has(l))return"";i.add(l);try{let c=sn.readFileSync(l,"utf8");s.push({source:o,resolvedPath:l,contents:c})}catch(c){console.warn(`[stx:vendor-css] could not read ${l}: ${c?.message||c}`)}return""}),styles:s}}function Uy(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Da(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${Uy(t.source)}" data-stx-layer="vendor">
2428
2428
  @layer vendor {
2429
2429
  ${t.contents}
2430
2430
  }
2431
- </style>`}).join(`
2431
+ </style>`).join(`
2432
2432
  `)}
2433
- `}function Ri(e){let t=Kt(e),r=new Set;for(let a of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let o of a[1].split(",")){let l=o.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(l)r.add(l)}let n=new Set;for(let a of t.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))n.add(a[1]);for(let a of t.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let o of a[1].split(",")){let l=o.trim().split(/[:=]/).pop()?.trim();if(l)n.add(l)}let i=Ma.filter((a)=>{if(r.has(a)||n.has(a))return!1;return new RegExp(`\\b${a}\\s*\\(`).test(t)}),s=Ju(t).filter((a)=>!r.has(a)&&!n.has(a));if(i.length===0&&s.length===0)return{code:e,imports:i,models:s};return{code:`${[i.length>0?`import { ${i.join(", ")} } from '@stacksjs/browser'`:"",s.length>0?"import '@stacksjs/browser'":"",s.length>0?`const { ${s.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2433
+ `}function Ii(e){let t=Zt(e),r=new Set;for(let a of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let o of a[1].split(",")){let l=o.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(l)r.add(l)}let n=new Set;for(let a of t.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))n.add(a[1]);for(let a of t.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let o of a[1].split(",")){let l=o.trim().split(/[:=]/).pop()?.trim();if(l)n.add(l)}let i=Ba.filter((a)=>{if(r.has(a)||n.has(a))return!1;return new RegExp(`\\b${a}\\s*\\(`).test(t)}),s=Yu(t).filter((a)=>!r.has(a)&&!n.has(a));if(i.length===0&&s.length===0)return{code:e,imports:i,models:s};return{code:`${[i.length>0?`import { ${i.join(", ")} } from '@stacksjs/browser'`:"",s.length>0?"import '@stacksjs/browser'":"",s.length>0?`const { ${s.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2434
2434
  `)}
2435
- ${e}`,imports:i,models:s}}function Ju(e){let t=new Set,r=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,n;while((n=r.exec(e))!==null)if(!Zu.has(n[1]))t.add(n[1]);return Array.from(t)}function Uy(e){let t=new Set;for(let r of e.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))t.add(r[1]);for(let r of e.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let n of r[1].split(",")){let i=n.trim().split(/[:=]/).pop()?.trim();if(i&&/^[A-Za-z_$][\w$]*$/.test(i))t.add(i)}return t}function Yu(e){let t=new Set,r=new Set,n=e;n=n.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let i=new Set,s=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,a;while((a=s.exec(e))!==null){let c=a[1],u=a[2];if(a[0].includes("import type"))continue;let d=[];for(let p of c.split(",")){let f=p.trim();if(!f||f.startsWith("type "))continue;let m=f.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!m)continue;let y=m[1],g=m[2]||y;if(i.add(y),i.add(g),u==="stx"||u==="@stacksjs/stx")t.add(y);else r.add(y);if(g!==y)d.push(`${g} = ${y}`)}let h=d.length>0?`var ${d.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(a[0],h)}let o=Uy(n);for(let c of Pa){if(i.has(c)||o.has(c))continue;if(new RegExp(`\\b${c}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(n))t.add(c)}for(let c of Ma){if(i.has(c)||o.has(c))continue;if(new RegExp(`\\b${c}\\b`,"g").test(n))r.add(c)}let l=Ju(n);for(let c of l)if(!i.has(c)&&!o.has(c))r.add(c);return{code:n,stxImports:Array.from(t),browserImports:Array.from(r)}}function Da(e,t){let r=[];if(e.length>0)r.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)r.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(r.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2435
+ ${e}`,imports:i,models:s}}function Yu(e){let t=new Set,r=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,n;while((n=r.exec(e))!==null)if(!Qu.has(n[1]))t.add(n[1]);return Array.from(t)}function Gy(e){let t=new Set;for(let r of e.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))t.add(r[1]);for(let r of e.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let n of r[1].split(",")){let i=n.trim().split(/[:=]/).pop()?.trim();if(i&&/^[A-Za-z_$][\w$]*$/.test(i))t.add(i)}return t}function Ku(e){let t=new Set,r=new Set,n=e;n=n.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let i=new Set,s=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,a;while((a=s.exec(e))!==null){let c=a[1],u=a[2];if(a[0].includes("import type"))continue;let d=[];for(let p of c.split(",")){let f=p.trim();if(!f||f.startsWith("type "))continue;let m=f.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!m)continue;let y=m[1],g=m[2]||y;if(i.add(y),i.add(g),u==="stx"||u==="@stacksjs/stx")t.add(y);else r.add(y);if(g!==y)d.push(`${g} = ${y}`)}let h=d.length>0?`var ${d.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(a[0],h)}let o=Gy(n);for(let c of Ma){if(i.has(c)||o.has(c))continue;if(new RegExp(`\\b${c}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(n))t.add(c)}for(let c of Ba){if(i.has(c)||o.has(c))continue;if(new RegExp(`\\b${c}\\b`,"g").test(n))r.add(c)}let l=Yu(n);for(let c of l)if(!i.has(c)&&!o.has(c))r.add(c);return{code:n,stxImports:Array.from(t),browserImports:Array.from(r)}}function $a(e,t){let r=[];if(e.length>0)r.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)r.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(r.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2436
2436
  ${r.join(`
2437
2437
  `)}
2438
- ${Vy(e,t)}`;return""}function Gy(e,t=[]){let{browserImports:r}=Yu(e),n=new Set(t);return Da([],r.filter((i)=>!n.has(i)))}function Vy(e,t){let r=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(r.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2438
+ ${Jy(e,t)}`;return""}function Vy(e,t=[]){let{browserImports:r}=Ku(e),n=new Set(t);return $a([],r.filter((i)=>!n.has(i)))}function Jy(e,t){let r=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(r.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2439
2439
  [${r.join(", ")}].forEach(function (e) {
2440
2440
  if (e[1] !== 'undefined') return;
2441
2441
  console.error(
@@ -2444,10 +2444,10 @@ ${Vy(e,t)}`;return""}function Gy(e,t=[]){let{browserImports:r}=Yu(e),n=new Set(t
2444
2444
  + 'or it should be imported from a relative path so the bundler includes it.'
2445
2445
  );
2446
2446
  });
2447
- `}function $a(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let i in t){let s=t[i];if(typeof s==="function")continue;n[i]=s}return n.__stxDeclaredPayload=!0,n}let r={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let i=e[n];if(typeof i==="function")continue;r[n]=i}return r}function dl(e,t){let r=new Set;for(let n of e.split(",")){let i=n.trim().replace(/^\.\.\./,"").trim();if(!i)continue;if(t){let s=i.lastIndexOf(":");if(s!==-1)i=i.slice(s+1).trim()}if(i=i.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(i))r.add(i)}return r}function Jy(e,t){if(new RegExp(`(?:const|let|var|function|class)\\s+${t}\\b`).test(e))return!0;for(let r of e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(dl(r[1],!0).has(t))return!0;for(let r of e.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(dl(r[1],!1).has(t))return!0;return!1}function Yy(e,t){return new RegExp(`(?<![.#\\w$])${t}(?![\\w$])`).test(e)}function Ky(e,t){let r=Qu.test(e),n=t.length>32768;if(!r&&!n)return;if(Ts.has(e))return;if(Ts.add(e),r)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function La(e,t){if(!t)return"";let r=Kt(e),n=t.__stxDeclaredPayload===!0,i=[];for(let[s,a]of Object.entries(t)){if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;if(s.startsWith("__")||s.startsWith("$"))continue;if(!n&&!Yy(r,s))continue;if(Jy(e,s))continue;let o;try{o=JSON.stringify(a)}catch{continue}if(o===void 0)continue;Ky(s,o),i.push(` var ${s} = ${o.replace(/</g,"\\u003c")};`)}if(i.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2447
+ `}function La(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let i in t){let s=t[i];if(typeof s==="function")continue;n[i]=s}return n.__stxDeclaredPayload=!0,n}let r={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let i=e[n];if(typeof i==="function")continue;r[n]=i}return r}function pl(e,t){let r=new Set;for(let n of e.split(",")){let i=n.trim().replace(/^\.\.\./,"").trim();if(!i)continue;if(t){let s=i.lastIndexOf(":");if(s!==-1)i=i.slice(s+1).trim()}if(i=i.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(i))r.add(i)}return r}function Yy(e,t){if(new RegExp(`(?:const|let|var|function|class)\\s+${t}\\b`).test(e))return!0;for(let r of e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(pl(r[1],!0).has(t))return!0;for(let r of e.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(pl(r[1],!1).has(t))return!0;return!1}function Ky(e,t){return new RegExp(`(?<![.#\\w$])${t}(?![\\w$])`).test(e)}function Zy(e,t){let r=Xu.test(e),n=t.length>32768;if(!r&&!n)return;if(Rs.has(e))return;if(Rs.add(e),r)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function Na(e,t){if(!t)return"";let r=Zt(e),n=t.__stxDeclaredPayload===!0,i=[];for(let[s,a]of Object.entries(t)){if(!/^[A-Za-z_$][\w$]*$/.test(s))continue;if(s.startsWith("__")||s.startsWith("$"))continue;if(!n&&!Ky(r,s))continue;if(Yy(e,s))continue;let o;try{o=JSON.stringify(a)}catch{continue}if(o===void 0)continue;Zy(s,o),i.push(` var ${s} = ${o.replace(/</g,"\\u003c")};`)}if(i.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2448
2448
  ${i.join(`
2449
2449
  `)}
2450
- `}function Zy(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let r of e.systemKeys)t.push(`if (!$event.${r}Key) return`);if(e.keys.length>0){let r=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${r})) return`)}if(e.mouse!==null){let r=Xu[e.mouse];t.push(`if ($event.button !== ${r}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Qy(e,t){let{elementId:r,event:n,modifiers:i}=e,s=$u(e.handler),a=Zy(i),o=[];if(i.once)o.push("once: true");if(i.capture)o.push("capture: true");if(i.passive)o.push("passive: true");let l=o.length>0?`, { ${o.join(", ")} }`:"",c="";if(a)c+=`${a}; `;let u=s.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),d=`var $emit = function(name, detail) {
2450
+ `}function Qy(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let r of e.systemKeys)t.push(`if (!$event.${r}Key) return`);if(e.keys.length>0){let r=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${r})) return`)}if(e.mouse!==null){let r=ed[e.mouse];t.push(`if ($event.button !== ${r}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Xy(e,t){let{elementId:r,event:n,modifiers:i}=e,s=Lu(e.handler),a=Qy(i),o=[];if(i.once)o.push("once: true");if(i.capture)o.push("capture: true");if(i.passive)o.push("passive: true");let l=o.length>0?`, { ${o.join(", ")} }`:"",c="";if(a)c+=`${a}; `;let u=s.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),d=`var $emit = function(name, detail) {
2451
2451
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2452
2452
  };`;function h(p){if(/\$emit\s*\(/.test(p))return`${d}
2453
2453
  ${p}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -2490,25 +2490,25 @@ else {
2490
2490
  else {
2491
2491
  ${s}
2492
2492
  }
2493
- }${l})`}function Xy(e){if(e.length===0)return"";return`
2493
+ }${l})`}function ev(e){if(e.length===0)return"";return`
2494
2494
  // STX: auto-generated event bindings
2495
- ${e.map((t,r)=>Qy(t,r)).join(`
2496
- `)}`}function pl(e){let t=[],r=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),i=0,s=n.length,a=0;while(a<s){let o=n[a];if(o==="'"||o==='"'||o==="`"){let l=o;if(a++,l==="`"){let c=0;while(a<s){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"&&c===0){a++;break}if(n[a]==="$"&&n[a+1]==="{"){c++,a+=2;continue}if(n[a]==="}"&&c>0){c--,a++;continue}a++}}else while(a<s){if(n[a]==="\\"){a+=2;continue}if(n[a]===l){a++;break}a++}continue}if(o==="/"&&n[a+1]==="/"){while(a<s&&n[a]!==`
2497
- `)a++;continue}if(o==="/"&&n[a+1]==="*"){a+=2;while(a<s-1&&!(n[a]==="*"&&n[a+1]==="/"))a++;a+=2;continue}if(o==="{"){i++,a++;continue}if(o==="}"){i--,a++;continue}if(i===0){let l=n.slice(a),c=l.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(c){let h=c[1];if(!h.startsWith("_")&&!r.has(h))t.push(h),r.add(h);a+=c[0].length;continue}let u=l.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(u){u[1].split(",").forEach((h)=>{let p=h.trim(),f=p.indexOf(":"),m=f>=0?p.slice(f+1).trim().split(/[\s=]/)[0]:p.split(/[\s=]/)[0];if(m&&!m.startsWith("_")&&!r.has(m))t.push(m),r.add(m)}),a+=u[0].length;continue}let d=l.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(d){let h=d[1];if(!h.startsWith("_")&&!r.has(h))t.push(h),r.add(h);a+=d[0].length;continue}}a++}return t}function ev(e){let t=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(h){let p;while((p=r.exec(h))!==null){let f=p[0];if(!ed.has(f))t.add(f)}}let i=/\{\{([\s\S]*?)\}\}/g,s;while((s=i.exec(e))!==null)n(s[1]);let a=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((s=a.exec(e))!==null)n(s[1]);let o=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((s=o.exec(e))!==null)n(s[1]);let l=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((s=l.exec(e))!==null)n(s[1]);let c=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((s=c.exec(e))!==null)n(s[1]);let u=/@model\s*=\s*["']([^"']*)["']/gi;while((s=u.exec(e))!==null)n(s[1]);let d=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((s=d.exec(e))!==null)n(s[1]);return t}async function Na(e,t={}){let r=e,n="",i=!1,s=[],a=Oa(r,{filePath:t.filePath,projectRoot:t.projectRoot});r=a.code;let o=ja(a.styles),l=Ri(r);r=l.code,s=[...l.imports,...l.models];let{hasUserImports:c,bundleClientScript:u}=await X("stx/client-script-bundler",()=>Promise.resolve().then(()=>(Ti(),pn)));if(c(r))r=await u(r,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),i=!0;if(t.autoImports!==!1){let g=Yu(r);r=g.code,n=Da(g.stxImports,g.browserImports.filter((v)=>!s.includes(v)))}if(n=`${La(r,t.serverData)}${n}`,r=Ut(r),!i&&Li(t.attrs||""))r=Ni(r);let d=Xy(t.eventBindings||[]),h=(t.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(h)){let g=h.replace(/\btype\s*=\s*["']module["']/i,"").trim(),v=`type="module" data-stx-scoped${g?` ${g}`:""}`;return`${o}<script ${v}>
2498
- ${On(`${n}${r}
2495
+ ${e.map((t,r)=>Xy(t,r)).join(`
2496
+ `)}`}function fl(e){let t=[],r=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),i=0,s=n.length,a=0;while(a<s){let o=n[a];if(o==="'"||o==='"'||o==="`"){let l=o;if(a++,l==="`"){let c=0;while(a<s){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"&&c===0){a++;break}if(n[a]==="$"&&n[a+1]==="{"){c++,a+=2;continue}if(n[a]==="}"&&c>0){c--,a++;continue}a++}}else while(a<s){if(n[a]==="\\"){a+=2;continue}if(n[a]===l){a++;break}a++}continue}if(o==="/"&&n[a+1]==="/"){while(a<s&&n[a]!==`
2497
+ `)a++;continue}if(o==="/"&&n[a+1]==="*"){a+=2;while(a<s-1&&!(n[a]==="*"&&n[a+1]==="/"))a++;a+=2;continue}if(o==="{"){i++,a++;continue}if(o==="}"){i--,a++;continue}if(i===0){let l=n.slice(a),c=l.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(c){let h=c[1];if(!h.startsWith("_")&&!r.has(h))t.push(h),r.add(h);a+=c[0].length;continue}let u=l.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(u){u[1].split(",").forEach((h)=>{let p=h.trim(),f=p.indexOf(":"),m=f>=0?p.slice(f+1).trim().split(/[\s=]/)[0]:p.split(/[\s=]/)[0];if(m&&!m.startsWith("_")&&!r.has(m))t.push(m),r.add(m)}),a+=u[0].length;continue}let d=l.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(d){let h=d[1];if(!h.startsWith("_")&&!r.has(h))t.push(h),r.add(h);a+=d[0].length;continue}}a++}return t}function tv(e){let t=new Set,r=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(h){let p;while((p=r.exec(h))!==null){let f=p[0];if(!td.has(f))t.add(f)}}let i=/\{\{([\s\S]*?)\}\}/g,s;while((s=i.exec(e))!==null)n(s[1]);let a=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((s=a.exec(e))!==null)n(s[1]);let o=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((s=o.exec(e))!==null)n(s[1]);let l=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((s=l.exec(e))!==null)n(s[1]);let c=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((s=c.exec(e))!==null)n(s[1]);let u=/@model\s*=\s*["']([^"']*)["']/gi;while((s=u.exec(e))!==null)n(s[1]);let d=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((s=d.exec(e))!==null)n(s[1]);return t}async function Pa(e,t={}){let r=e,n="",i=!1,s=[],a=ja(r,{filePath:t.filePath,projectRoot:t.projectRoot});r=a.code;let o=Da(a.styles),l=Ii(r);r=l.code,s=[...l.imports,...l.models];let{hasUserImports:c,bundleClientScript:u}=await ee("stx/client-script-bundler",()=>Promise.resolve().then(()=>(Ri(),fn)));if(c(r))r=await u(r,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),i=!0;if(t.autoImports!==!1){let g=Ku(r);r=g.code,n=$a(g.stxImports,g.browserImports.filter((v)=>!s.includes(v)))}if(n=`${Na(r,t.serverData)}${n}`,r=Gt(r),!i&&Ni(t.attrs||""))r=Pi(r);let d=ev(t.eventBindings||[]),h=(t.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(h)){let g=h.replace(/\btype\s*=\s*["']module["']/i,"").trim(),v=`type="module" data-stx-scoped${g?` ${g}`:""}`;return`${o}<script ${v}>
2498
+ ${jn(`${n}${r}
2499
2499
  ${d}`)}
2500
- </script>`}let p=ku(e),f=/function __stx_setup_/.test(r),m=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function y(g){let v=g.length>0?`
2500
+ </script>`}let p=Eu(e),f=/function __stx_setup_/.test(r),m=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function y(g){let v=g.length>0?`
2501
2501
  return { ${g.join(", ")} };`:"";return`${o}<script data-stx-scoped data-stx-run="always">
2502
2502
  window.stx.mount(function() {
2503
2503
  'use strict';
2504
- ${On(`${n}${r}
2504
+ ${jn(`${n}${r}
2505
2505
  ${d}${v}`)}
2506
- })</script>`}if(!m&&!f){if(p)return y(pl(e));if(t.templateContent){let g=pl(e);if(g.length>0){let v=ev(t.templateContent);if(g.some((w)=>v.has(w)))return y(g)}}}return`${o}<script data-stx-scoped data-stx-run="always">
2506
+ })</script>`}if(!m&&!f){if(p)return y(fl(e));if(t.templateContent){let g=fl(e);if(g.length>0){let v=tv(t.templateContent);if(g.some((w)=>v.has(w)))return y(g)}}}return`${o}<script data-stx-scoped data-stx-run="always">
2507
2507
  ;(function() {
2508
2508
  'use strict';
2509
- ${On(`${n}${r}
2509
+ ${jn(`${n}${r}
2510
2510
  ${d}`)}
2511
- })()</script>`}var Ku,Pa,Ma,Zu,Qu,Ts,Xu,ed,Ii=R(()=>{Pu(),Ce(),Ai(),nt(),zu(),Ku=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm,Pa=Ht,Ma=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn"],Zu=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]),Qu=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Ts=new Set,Xu={left:0,middle:1,right:2},ed=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function td(e){let t=e[Ba];return t instanceof Map?t:null}function rv(e){e[Ba]=new Map}function nv(e,t){let r=td(e);if(!r)return null;let n=tv("sha256").update(t).digest("hex").slice(0,16),i=r.get(n);if(i)i.instances++;else r.set(n,{body:t,instances:1});return n}function iv(e,t){let r=td(t);if(!r?.size)return e;let n=e;for(let[o,l]of r){if(l.instances!==1)continue;let c=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(o)}\\]\\(("[^"]+")\\);`,"g");n=n.replace(c,(u,d)=>`(${l.body})(${d});`)}let i=[...r].filter(([,o])=>o.instances>1);if(i.length===0)return n;let s=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2511
+ })()</script>`}var Zu,Ma,Ba,Qu,Xu,Rs,ed,td,Oi=R(()=>{Mu(),Te(),Ci(),it(),Fu(),Zu=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm,Ma=Ut,Ba=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn"],Qu=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]),Xu=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Rs=new Set,ed={left:0,middle:1,right:2},td=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function rd(e){let t=e[za];return t instanceof Map?t:null}function nv(e){e[za]=new Map}function iv(e,t){let r=rd(e);if(!r)return null;let n=rv("sha256").update(t).digest("hex").slice(0,16),i=r.get(n);if(i)i.instances++;else r.set(n,{body:t,instances:1});return n}function sv(e,t){let r=rd(t);if(!r?.size)return e;let n=e;for(let[o,l]of r){if(l.instances!==1)continue;let c=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(o)}\\]\\(("[^"]+")\\);`,"g");n=n.replace(c,(u,d)=>`(${l.body})(${d});`)}let i=[...r].filter(([,o])=>o.instances>1);if(i.length===0)return n;let s=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2512
2512
  (function() {
2513
2513
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2514
2514
  ${i.map(([o,l])=>` try { factories[${JSON.stringify(o)}] = factories[${JSON.stringify(o)}] || ${l.body}; }
@@ -2517,7 +2517,7 @@ ${i.map(([o,l])=>` try { factories[${JSON.stringify(o)}] = factories[${JSON.str
2517
2517
  })();
2518
2518
  </script>`,a=n.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(a<0)return`${s}
2519
2519
  ${n}`;return`${n.slice(0,a)}${s}
2520
- ${n.slice(a)}`}var Ba="__stx_component_client_factories",rd=()=>{};function sv(e){let t="",r=null,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(n){n=!1;continue}if(s==="\\"&&r){n=!0;continue}if(r){if(r==="`"&&s==="$"&&i+1<e.length&&e[i+1]==="{"){let a=1;i+=2;while(i<e.length&&a>0){if(e[i]==="{")a++;else if(e[i]==="}")a--;if(a>0)t+=e[i],i++}continue}if(s===r)r=null;continue}if(s==='"'||s==="'"||s==="`"){r=s;continue}t+=s}return t}function av(e,t){let r=/[$A-Z_a-z][$\w]*/g,n;while((n=r.exec(e))!==null){let i=n[0],s=e[n.index-1];if(nd.has(i))throw Error(`Potentially unsafe expression (matched /\\b${i}\\b/; identifier ${i}): ${t}`);if(s==="."&&Wa.has(i))throw Error(`Potentially unsafe expression (matched /.${i}/; property ${i}): ${t}`)}}function ov(e){let t=/\[\s*(['"])(.*?)\1\s*\]/g,r;while((r=t.exec(e))!==null){let n=r[2];if(!Wa.has(n))continue;let i=e.slice(0,r.index).match(/\S(?=\s*$)/)?.[0],s=e.slice(r.index+r[0].length).match(/^\s*(\S)/)?.[1];if(!((i==="{"||i===",")&&s===":"))throw Error(`Potentially unsafe expression (bracket key ${r[2]}): ${e}`)}}function za(e){let t=e.trim(),r=sv(t);av(r,t),ov(t);for(let n of qa)if(n.test(r))throw Error(`Potentially unsafe expression (matched /${n.source}/): ${t}`);if(!Fa.allowBracketNotation&&id.test(t))throw Error(`Bracket notation with strings not allowed: ${t}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return t}function lv(e){let t={};t.Math=Math,t.JSON=JSON,t.Date=Date,t.String=String,t.Number=Number,t.Boolean=Boolean,t.Array=Array,t.parseInt=Number.parseInt,t.parseFloat=Number.parseFloat,t.isNaN=Number.isNaN,t.isFinite=Number.isFinite,t.encodeURIComponent=encodeURIComponent,t.decodeURIComponent=decodeURIComponent;for(let[r,n]of Object.entries(e)){if(r.startsWith("__")||qa.some((i)=>i.test(r)))continue;if(n&&typeof n==="object"&&!Array.isArray(n))t[r]=Rs(n);else t[r]=n}return t}function Rs(e,t=0){if(t>=Fa.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((n)=>Rs(n,t+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[n,i]of Object.entries(e)){if(n.startsWith("__")||n==="constructor"||n==="prototype")continue;if(i&&typeof i==="object")r[n]=Rs(i,t+1);else r[n]=i}return r}function pe(e,t){try{let r=lv(t),n=Object.keys(r),i=Object.values(r);return ge(e,n)(...i)}catch{return}}function xe(e){try{return za(e),!0}catch{return!1}}function Ye(e,t){try{let r=pe(e,t);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}function ge(e,t){let r=za(e),n=/^[A-Za-z_$][\w$]*$/,i=[],s=[];for(let l=0;l<t.length;l++){let c=t[l];if(!n.test(c))continue;if(Ha.has(c))continue;i.push(l),s.push(c)}let a=(l)=>Function(...s,...l,`
2520
+ ${n.slice(a)}`}var za="__stx_component_client_factories",nd=()=>{};function av(e){let t="",r=null,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(n){n=!1;continue}if(s==="\\"&&r){n=!0;continue}if(r){if(r==="`"&&s==="$"&&i+1<e.length&&e[i+1]==="{"){let a=1;i+=2;while(i<e.length&&a>0){if(e[i]==="{")a++;else if(e[i]==="}")a--;if(a>0)t+=e[i],i++}continue}if(s===r)r=null;continue}if(s==='"'||s==="'"||s==="`"){r=s;continue}t+=s}return t}function ov(e,t){let r=/[$A-Z_a-z][$\w]*/g,n;while((n=r.exec(e))!==null){let i=n[0],s=e[n.index-1];if(id.has(i))throw Error(`Potentially unsafe expression (matched /\\b${i}\\b/; identifier ${i}): ${t}`);if(s==="."&&Ha.has(i))throw Error(`Potentially unsafe expression (matched /.${i}/; property ${i}): ${t}`)}}function lv(e){let t=/\[\s*(['"])(.*?)\1\s*\]/g,r;while((r=t.exec(e))!==null){let n=r[2];if(!Ha.has(n))continue;let i=e.slice(0,r.index).match(/\S(?=\s*$)/)?.[0],s=e.slice(r.index+r[0].length).match(/^\s*(\S)/)?.[1];if(!((i==="{"||i===",")&&s===":"))throw Error(`Potentially unsafe expression (bracket key ${r[2]}): ${e}`)}}function Fa(e){let t=e.trim(),r=av(t);ov(r,t),lv(t);for(let n of Wa)if(n.test(r))throw Error(`Potentially unsafe expression (matched /${n.source}/): ${t}`);if(!qa.allowBracketNotation&&sd.test(t))throw Error(`Bracket notation with strings not allowed: ${t}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return t}function cv(e){let t={};t.Math=Math,t.JSON=JSON,t.Date=Date,t.String=String,t.Number=Number,t.Boolean=Boolean,t.Array=Array,t.parseInt=Number.parseInt,t.parseFloat=Number.parseFloat,t.isNaN=Number.isNaN,t.isFinite=Number.isFinite,t.encodeURIComponent=encodeURIComponent,t.decodeURIComponent=decodeURIComponent;for(let[r,n]of Object.entries(e)){if(r.startsWith("__")||Wa.some((i)=>i.test(r)))continue;if(n&&typeof n==="object"&&!Array.isArray(n))t[r]=Is(n);else t[r]=n}return t}function Is(e,t=0){if(t>=qa.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((n)=>Is(n,t+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[n,i]of Object.entries(e)){if(n.startsWith("__")||n==="constructor"||n==="prototype")continue;if(i&&typeof i==="object")r[n]=Is(i,t+1);else r[n]=i}return r}function fe(e,t){try{let r=cv(t),n=Object.keys(r),i=Object.values(r);return ye(e,n)(...i)}catch{return}}function Se(e){try{return Fa(e),!0}catch{return!1}}function Ke(e,t){try{let r=fe(e,t);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}function ye(e,t){let r=Fa(e),n=/^[A-Za-z_$][\w$]*$/,i=[],s=[];for(let l=0;l<t.length;l++){let c=t[l];if(!n.test(c))continue;if(Ua.has(c))continue;i.push(l),s.push(c)}let a=(l)=>Function(...s,...l,`
2521
2521
  'use strict';
2522
2522
  try {
2523
2523
  return ${r};
@@ -2528,7 +2528,7 @@ catch (e) {
2528
2528
  }
2529
2529
  throw e;
2530
2530
  }
2531
- `),o=a([]);if(s.length===t.length)return fl(o,s,a);return fl((...l)=>{let c=Array(i.length);for(let u=0;u<i.length;u++)c[u]=l[i[u]];return o(...c)},s,a,(l)=>{o=a(l)})}function fl(e,t,r,n){let i=/^(\w+) is not defined$/,s=e,a=[],o=new Set(t);return(...l)=>{for(let c=0;c<=8;c++)try{return s(...l)}catch(u){let d=u instanceof Error?u.message:"",h=i.exec(d);if(!(u instanceof ReferenceError)||!h)return;let p=h[1];if(o.has(p)||Ha.has(p))return;o.add(p),a.push(p),s=r(a),n?.(a)}return}}function Is(e){let t=e.trim(),r=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let n of r)if(n.test(t))return!1;return!0}var hl,Fa,qa,nd,Wa,id,Ha,Se=R(()=>{hl={maxSanitizeDepth:10,allowBracketNotation:!1},Fa={...hl},qa=[/\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*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],nd=new Set(["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"]),Wa=new Set(["__proto__","constructor","prototype"]),id=/[\w)\]]\s*\[\s*['"]/,Ha=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"])});function Zi(e,t){let r=cv++,n=`<!--__STX_${e.toUpperCase()}_${r}__-->`;return sd.set(n,{type:e,expression:t}),n}var cv=0,sd,uv=R(()=>{sd=new Map});function ad(e,t,r,n){r.lastIndex=t;let i=r.exec(e);if(!i||i.index!==t)return-1;n.lastIndex=r.lastIndex;let s=n.exec(e);if(!s)return-1;return s.index+s[0].length}function sn(e,t){return ad(e,t,Va,Ja)}function Ua(e,t){return ad(e,t,Ya,Ka)}function Ga(e,t){if(!e.startsWith("<!--",t))return-1;let r=e.indexOf("-->",t+4);if(r===-1)return-1;return r+3}function dv(e,t){if(e.startsWith("<!--",t)){let r=Ga(e,t);return r===-1?e.length:r}for(let[r,n]of[[Va,Ja],[Ya,Ka]]){r.lastIndex=t;let i=r.exec(e);if(!i||i.index!==t)continue;n.lastIndex=r.lastIndex;let s=n.exec(e);return s?s.index+s[0].length:e.length}return-1}function od(e,t){let r=[],n=0,i=e.length,s=!1,a=null;while(n<i){let o=e[n];if(s){if(a){if(o===a)a=null}else if(o==='"'||o==="'")a=o;else if(o===">")s=!1;n++;continue}if(o!=="<"){n++;continue}let l=t(e,n);if(l>n){r.push({start:n,end:l,token:e.slice(n,l)}),n=l;continue}let c=dv(e,n);if(c>n){n=c;continue}if(/^<\/?[a-zA-Z]/.test(e.slice(n,n+2)))s=!0;n++}return r}function Ar(e,t,r){let n=od(e,t);if(n.length===0)return{output:e,tokens:[]};let i=n.map((o)=>o.token),s="",a=0;for(let o=0;o<n.length;o++){let l=n[o];s+=e.slice(a,l.start),s+=r(l.token,o),a=l.end}return s+=e.slice(a),{output:s,tokens:i}}function Oi(e){let{output:t,tokens:r}=Ar(e,sn,(n,i)=>`\x00STX_SCRIPT_${i}\x00`);return{output:t,scripts:r}}function ld(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,n)=>t[+n]??"")}var Va,Ja,Ya,Ka,Lr=R(()=>{Va=/<script\b[^>]*>/iy,Ja=/<\/script\s*>/ig,Ya=/<style\b[^>]*>/iy,Ka=/<\/style\s*>/ig}),cd={};Y(cd,{usesSignalsInScript:()=>Nr,unescapeHtml:()=>bv,registerFilters:()=>fv,registerFilter:()=>ud,processExpressions:()=>fn,interpolateScriptsInTemplate:()=>gv,interpolateScriptExpressions:()=>Za,interpolateScriptAttributes:()=>pd,getAllFilters:()=>dd,evaluateExpression:()=>Pe,escapeHtml:()=>_t,defaultFilters:()=>Tr,clearCustomFilters:()=>hv,applyFilters:()=>fd});function pv(e){let t=Os.get(e);if(!t){let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${r}(?!\\w)`,"g"),Os.set(e,t)}return t.lastIndex=0,t}function ud(e,t){if(e in Tr)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Cr[e]=t}function fv(e){for(let[t,r]of Object.entries(e))ud(t,r)}function dd(){return{...Tr,...Cr}}function hv(){for(let e of Object.keys(Cr))delete Cr[e]}function _t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Nr(e){let{scripts:t}=Oi(e);for(let r of t){let n=r.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!n||/\bserver\b|\bsrc\s*=/.test(n[1]))continue;let i=n[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(i))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function ml(e,t){let r=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),i="",s=!1,a=0;for(let c=0;c<n.length;c++){let u=n[c];if(!s&&u==="`"){s=!0,a=0;continue}if(s){if(u==="`"&&a===0){s=!1;continue}if(u==="$"&&n[c+1]==="{"){a++,c++,i+=" ";continue}if(u==="}"&&a>0){a--;continue}if(a>0){i+=u;continue}continue}i+=u}n=i;let o=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,l;while((l=o.exec(n))!==null){let c=l[1];if(!n.substring(0,l.index).trimEnd().endsWith(".")){if(!r.includes(c)&&!(c in t))return!1}}return!0}function mv(e,t){let r=t.__stx_serverDeclared;if(!r||r.size===0)return!1;let n=Kt(e);for(let i of r)if(new RegExp(`(?<![.#\\w$])${i}(?![\\w$])`).test(n))return!0;return!1}function Za(e,t){let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(n,i)=>{try{let s=Pe(i,t);if(s===void 0)return n;return s===null?"":String(s)}catch{return n}}),r=r.replace(/\{\{([\s\S]*?)\}\}/g,(n,i)=>{let s=i.trim();if(/^__[A-Z_]+__$/.test(s))return n;try{let a=Pe(i,t);if(a===void 0)return n;return JSON.stringify(a).replace(/</g,"\\u003c")}catch{return n}}),r}function pd(e,t){if(!e.includes("{"))return e;let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(n,i)=>{try{let s=Pe(i,t);if(s===void 0)return n;return s===null?"":String(s)}catch{return n}}),r=r.replace(/\{\{([\s\S]*?)\}\}/g,(n,i)=>{let s=i.trim();if(/^__[A-Z_]+__$/.test(s))return n;try{let a=Pe(i,t);if(a===void 0)return n;if(a===null)return"";return String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return n}}),r}function gv(e,t,r={}){let{output:n,scripts:i}=Oi(e),s=i.map((a)=>{let o=a.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),l=a.match(/^<script\b[^>]*>/i),c=a.search(/<\/script\s*>$/i);if(!o||!l||c===-1)return a;let u=o[1],d=o[2];if(/\bdata-raw\b/.test(u))return a;if(r.skipServer&&/\bserver\b/.test(u))return a;let h=`<script${pd(u,t)}>`;if(/\bsrc\s*=/.test(u)||/\btype\s*=\s*["']application\/json["']/.test(u))return h+d+a.slice(c);return h+Za(d,t)+a.slice(c)});return ld(n,s)}function fn(e,t,r){let n=e,i=(d,h)=>{let p=Ua(d,h);if(p===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(d.slice(h,p))?-1:p},s=(d,h,p,f)=>{let m=p.length,{output:y,tokens:g}=Ar(d,h,(v,w)=>f(m+w));return p.push(...g),y},a=[];n=s(n,i,a,(d)=>`<!--__STX_STYLE_${d}__-->`);let o=[];n=s(n,sn,o,(d)=>`<!--__STX_SCRIPT_EXPR_${d}__-->`);let l=t?.__stx_signals_gate===!0||Nr(e),c=new Set(Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[]),u=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=n.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(d,h,p)=>{try{let f=Pe(h,t);return f!==void 0&&f!==null?String(f):""}catch(f){let m=f instanceof Error?f.message:String(f);return Ae("Expression",`Error evaluating: {{{ ${h.trim()}}}}: ${m}`,r,e,p,d)}}),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(d,h,p)=>{try{let f=Pe(h,t);if(f===void 0&&t.__stx_buildMode==="compile")return Zi("raw",h.trim());return f!==void 0&&f!==null?String(f):""}catch(f){if(t.__stx_buildMode==="compile")return Zi("raw",h.trim());let m=f instanceof Error?f.message:String(f);return Ae("Expression",`Error evaluating: {!! ${h.trim()} !!}: ${m}`,r,e,p,d)}}),n=s(n,sn,o,(d)=>`<!--__STX_SCRIPT_EXPR_${d}__-->`),n=s(n,i,a,(d)=>`<!--__STX_STYLE_${d}__-->`),n=n.replace(/\{\{([\s\S]*?)\}\}/g,(d,h,p)=>{let f=h.trim();if(u.has(f))return d;let m=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],y=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,g=f.match(y)?.[1],v=g&&((g in t)||m.includes(g)),w=Boolean(g&&c.has(g)),b=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,S=f.match(b),x=S&&!m.includes(S[1])&&!(S[1]in t);if(/^__[A-Z_]+__$/.test(f))return"";try{let _=Pe(h,t);if(w)return d;if(l&&!ml(f,t))return d;if(t.__stx_buildMode==="compile"&&!l&&(_===void 0||mv(f,t)))return Zi("expr",f);return _!==void 0&&_!==null?_t(String(_)):""}catch(_){if(w)return d;if(l&&!ml(f,t))return d;if(x)return d;let E=_ instanceof Error?_.message:String(_);return Ae("Expression",`Error evaluating: {{ ${f} }}: ${E}`,r,e,p,d)}});for(let d=0;d<o.length;d++)n=n.replace(`<!--__STX_SCRIPT_EXPR_${d}__-->`,()=>o[d]);for(let d=0;d<a.length;d++)n=n.replace(`<!--__STX_STYLE_${d}__-->`,()=>a[d]);return n}function fd(e,t,r){if(!t.trim())return e;let n=e,i=t.trim();while(i.length>0){let s=i.match(/^(\w+)/);if(!s)break;let a=s[1];i=i.substring(a.length).trim();let o=Cr[a]||Tr[a];if(!o)throw Error(`Filter not found: ${a}. Available filters: ${Object.keys(dd()).join(", ")}`);let l=[];if(i.startsWith(":")){let c=i.match(/^:([^|\s]+)/);if(c){let u=c[1].trim();try{let d=Number(u);l=[Number.isNaN(d)?u:d]}catch{l=[u]}i=i.substring(c[0].length).trim()}}else if(i.startsWith("(")){let c=1,u=1;while(c>0&&u<i.length){if(i[u]==="(")c++;if(i[u]===")")c--;u++}if(c===0){let d=i.substring(1,u-1).trim();if(d)try{if(d.startsWith("{")&&d.endsWith("}"))l=[Pe(`(${d})`,r,!0)];else{let h=[],p="",f=null,m=0,y=0,g=0,v=!1;for(let w=0;w<d.length;w++){let b=d[w];if(v){p+=b,v=!1;continue}if(b==="\\"){p+=b,v=!0;continue}if(f){if(p+=b,b===f)f=null;continue}if(b==='"'||b==="'"||b==="`"){f=b,p+=b;continue}if(b==="(")m++;else if(b===")")m--;else if(b==="[")y++;else if(b==="]")y--;else if(b==="{")g++;else if(b==="}")g--;if(b===","&&m===0&&y===0&&g===0){h.push(p),p="";continue}p+=b}if(p)h.push(p);l=h.map((w)=>{let b=w.trim();return Pe(b,r,!0)})}}catch{l=[d]}i=i.substring(u).trim()}}try{n=o(n,r,...l)}catch(c){let u=c instanceof Error?c.message:String(c);throw Error(`Error applying filter '${a}': ${u}`)}if(i.startsWith("|"))i=i.substring(1).trim();else break}return n}function yv(e){let t=!1,r="",n=0,i=0,s=0,a=!1;for(let o=0;o<e.length;o++){let l=e[o],c=e[o+1];if(t&&a){a=!1;continue}if(t&&l==="\\"){a=!0;continue}if(a=!1,(l==='"'||l==="'"||l==="`")&&!a){if(!t)t=!0,r=l;else if(l===r)t=!1,r="";continue}if(t&&r==="`"&&l==="$"&&c==="{"){let u=1;o+=2;while(o<e.length&&u>0){if(e[o]==="{")u++;else if(e[o]==="}")u--;if(u>0)o++}continue}if(t)continue;if(l==="(")n++;else if(l===")")n--;else if(l==="[")i++;else if(l==="]")i--;else if(l==="{")s++;else if(l==="}")s--;if(l==="|"&&n===0&&i===0&&s===0){if(c==="|"){o++;continue}if(c==="="){o++;continue}return o}}return-1}function Pe(e,t,r=!1){try{let n=e.trim(),i=yv(n);if(i>0){let s=n.substring(0,i).trim(),a=n.substring(i+1).trim(),o=Pe(s,t,!0);return fd(o,a,t)}if(!xe(n)){if(!r)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${n}`);return pe(n,t)}try{let s=Object.keys(t),a=Object.values(t);return ge(n,s)(...a)}catch{return pe(n,t)}}catch(n){if(n instanceof ReferenceError){let i=/(\b\w+)\s+is not defined/.exec(n.message);if(i){let s=i[1],a=vv(s,Object.keys(t));if(a&&a!==s)n.message=`${n.message} \u2014 did you mean '${a}'?`}}if(!r)console.error(`Error evaluating expression: ${e}`,n);throw n}}function vv(e,t){let r=null;for(let i of t){if(i===e)continue;let s=wv(e,i);if(r===null||s<r.dist)r={key:i,dist:s}}if(!r)return null;let n=Math.max(e.length,r.key.length);if(r.dist<=2||r.dist/n<=0.35)return r.key;return null}function wv(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[r,n]=e.length<t.length?[e,t]:[t,e],i=Array(r.length+1),s=Array(r.length+1);for(let a=0;a<=r.length;a++)i[a]=a;for(let a=1;a<=n.length;a++){s[0]=a;for(let o=1;o<=r.length;o++){let l=r[o-1]===n[a-1]?0:1;s[o]=Math.min(s[o-1]+1,i[o]+1,i[o-1]+l)}for(let o=0;o<=r.length;o++)i[o]=s[o]}return i[r.length]}function bv(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var Cr,Os,Tr,ut=R(()=>{Se(),Ce(),uv(),Lr(),Cr={},Os=new Map,Tr={uppercase:(e,t)=>{return e!==void 0&&e!==null?String(e).toUpperCase():""},lowercase:(e,t)=>{return e!==void 0&&e!==null?String(e).toLowerCase():""},capitalize:(e,t)=>{if(e===void 0||e===null)return"";let r=String(e);return r.charAt(0).toUpperCase()+r.slice(1)},number:(e,t,r=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(r),10))}catch{return""}},fmt:(e,t,r="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(r)}catch{return String(e)}},join:(e,t,r=",")=>{if(!Array.isArray(e))return"";return e.join(String(r))},escape:(e,t)=>{if(e===void 0||e===null)return"";return _t(String(e))},translate:(e,t,r={})=>{if(!t||!t.__translations)return e;let n=t.__translations,i=t.__i18nConfig?.fallbackToKey??!0,s=String(e).split("."),a=n;for(let l of s){if(a===void 0||a===null)break;a=a[l]}if(a===void 0||a===null)return i?e:"";let o=String(a);return Object.entries(r).forEach(([l,c])=>{o=o.replace(pv(l),String(c))}),o},t:(e,t,r={})=>{return Tr.translate(e,t,r)},truncate:(e,t,r=50,n="...")=>{if(e===void 0||e===null)return"";let i=String(e);if(i.length<=r)return i;if(r<=n.length)return n.substring(0,r);return i.substring(0,r-n.length)+n},date:(e,t,r="short",n="en-US")=>{if(e===void 0||e===null)return"";try{let i=e instanceof Date?e:new Date(e);if(Number.isNaN(i.getTime()))return String(e);let s={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(r==="iso")return i.toISOString();return new Intl.DateTimeFormat(n,s[r]||s.short).format(i)}catch{return String(e)}},currency:(e,t,r="USD",n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return new Intl.NumberFormat(n,{style:"currency",currency:r}).format(i)}catch{return String(e)}},pluralize:(e,t,r,n)=>{let i=Number(e);if(Number.isNaN(i))return r;let s=n||`${r}s`;return i===1?r:s},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let r=String(e);return r.charAt(r.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,r=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return r?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,r="")=>{return e===void 0||e===null||e===""?r:e},reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,r=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(r,n);return e},replace:(e,t,r,n="")=>{if(e===void 0||e===null)return"";let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(i,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let r=Number(e);return Number.isNaN(r)?0:Math.abs(r)},round:(e,t,r=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let i=10**r;return Math.round(n*i)/i}}});class Kr{cache=new Map;maxSize;constructor(e=100){this.maxSize=e}get(e){if(!this.cache.has(e))return;let t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;if(r!==void 0)this.cache.delete(r)}this.cache.set(e,t)}has(e){return this.cache.has(e)}delete(e){return this.cache.delete(e)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function ti(e,t){if(t?.includes("g"))return new RegExp(e,t);let r=`${e}:${t||""}`;if(!jt.has(r)){if(jt.size>=Sv){let n=jt.keys().next().value;if(n)jt.delete(n)}jt.set(r,new RegExp(e,t))}return jt.get(r)}class hd{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let t=Array.from(new Set(e)),r=t.sort().join(","),n=this.pool.find((o)=>o.context.join(",")===r);if(n)return n.func;let i=this.fnCache,s=this.fnCacheMaxSize,a=(...o)=>{return(l)=>{try{let c=`${r}:${l}`,u=i.get(c);if(!u){if(i.size>=s){let d=i.keys().next().value;if(d)i.delete(d)}u=Function(...t,`
2531
+ `),o=a([]);if(s.length===t.length)return hl(o,s,a);return hl((...l)=>{let c=Array(i.length);for(let u=0;u<i.length;u++)c[u]=l[i[u]];return o(...c)},s,a,(l)=>{o=a(l)})}function hl(e,t,r,n){let i=/^(\w+) is not defined$/,s=e,a=[],o=new Set(t);return(...l)=>{for(let c=0;c<=8;c++)try{return s(...l)}catch(u){let d=u instanceof Error?u.message:"",h=i.exec(d);if(!(u instanceof ReferenceError)||!h)return;let p=h[1];if(o.has(p)||Ua.has(p))return;o.add(p),a.push(p),s=r(a),n?.(a)}return}}function Os(e){let t=e.trim(),r=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let n of r)if(n.test(t))return!1;return!0}var ml,qa,Wa,id,Ha,sd,Ua,_e=R(()=>{ml={maxSanitizeDepth:10,allowBracketNotation:!1},qa={...ml},Wa=[/\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*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],id=new Set(["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"]),Ha=new Set(["__proto__","constructor","prototype"]),sd=/[\w)\]]\s*\[\s*['"]/,Ua=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"])});function Qi(e,t){let r=uv++,n=`<!--__STX_${e.toUpperCase()}_${r}__-->`;return ad.set(n,{type:e,expression:t}),n}var uv=0,ad,dv=R(()=>{ad=new Map});function od(e,t,r,n){r.lastIndex=t;let i=r.exec(e);if(!i||i.index!==t)return-1;n.lastIndex=r.lastIndex;let s=n.exec(e);if(!s)return-1;return s.index+s[0].length}function an(e,t){return od(e,t,Ja,Ya)}function Ga(e,t){return od(e,t,Ka,Za)}function Va(e,t){if(!e.startsWith("<!--",t))return-1;let r=e.indexOf("-->",t+4);if(r===-1)return-1;return r+3}function pv(e,t){if(e.startsWith("<!--",t)){let r=Va(e,t);return r===-1?e.length:r}for(let[r,n]of[[Ja,Ya],[Ka,Za]]){r.lastIndex=t;let i=r.exec(e);if(!i||i.index!==t)continue;n.lastIndex=r.lastIndex;let s=n.exec(e);return s?s.index+s[0].length:e.length}return-1}function ld(e,t){let r=[],n=0,i=e.length,s=!1,a=null;while(n<i){let o=e[n];if(s){if(a){if(o===a)a=null}else if(o==='"'||o==="'")a=o;else if(o===">")s=!1;n++;continue}if(o!=="<"){n++;continue}let l=t(e,n);if(l>n){r.push({start:n,end:l,token:e.slice(n,l)}),n=l;continue}let c=pv(e,n);if(c>n){n=c;continue}if(/^<\/?[a-zA-Z]/.test(e.slice(n,n+2)))s=!0;n++}return r}function Cr(e,t,r){let n=ld(e,t);if(n.length===0)return{output:e,tokens:[]};let i=n.map((o)=>o.token),s="",a=0;for(let o=0;o<n.length;o++){let l=n[o];s+=e.slice(a,l.start),s+=r(l.token,o),a=l.end}return s+=e.slice(a),{output:s,tokens:i}}function ji(e){let{output:t,tokens:r}=Cr(e,an,(n,i)=>`\x00STX_SCRIPT_${i}\x00`);return{output:t,scripts:r}}function cd(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(r,n)=>t[+n]??"")}var Ja,Ya,Ka,Za,Nr=R(()=>{Ja=/<script\b[^>]*>/iy,Ya=/<\/script\s*>/ig,Ka=/<style\b[^>]*>/iy,Za=/<\/style\s*>/ig}),ud={};K(ud,{usesSignalsInScript:()=>Pr,unescapeHtml:()=>xv,registerFilters:()=>hv,registerFilter:()=>dd,processExpressions:()=>hn,interpolateScriptsInTemplate:()=>yv,interpolateScriptExpressions:()=>Qa,interpolateScriptAttributes:()=>fd,getAllFilters:()=>pd,evaluateExpression:()=>Me,escapeHtml:()=>kt,defaultFilters:()=>Rr,clearCustomFilters:()=>mv,applyFilters:()=>hd});function fv(e){let t=js.get(e);if(!t){let r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${r}(?!\\w)`,"g"),js.set(e,t)}return t.lastIndex=0,t}function dd(e,t){if(e in Rr)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Tr[e]=t}function hv(e){for(let[t,r]of Object.entries(e))dd(t,r)}function pd(){return{...Rr,...Tr}}function mv(){for(let e of Object.keys(Tr))delete Tr[e]}function kt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Pr(e){let{scripts:t}=ji(e);for(let r of t){let n=r.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!n||/\bserver\b|\bsrc\s*=/.test(n[1]))continue;let i=n[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(i))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function gl(e,t){let r=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),i="",s=!1,a=0;for(let c=0;c<n.length;c++){let u=n[c];if(!s&&u==="`"){s=!0,a=0;continue}if(s){if(u==="`"&&a===0){s=!1;continue}if(u==="$"&&n[c+1]==="{"){a++,c++,i+=" ";continue}if(u==="}"&&a>0){a--;continue}if(a>0){i+=u;continue}continue}i+=u}n=i;let o=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,l;while((l=o.exec(n))!==null){let c=l[1];if(!n.substring(0,l.index).trimEnd().endsWith(".")){if(!r.includes(c)&&!(c in t))return!1}}return!0}function gv(e,t){let r=t.__stx_serverDeclared;if(!r||r.size===0)return!1;let n=Zt(e);for(let i of r)if(new RegExp(`(?<![.#\\w$])${i}(?![\\w$])`).test(n))return!0;return!1}function Qa(e,t){let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(n,i)=>{try{let s=Me(i,t);if(s===void 0)return n;return s===null?"":String(s)}catch{return n}}),r=r.replace(/\{\{([\s\S]*?)\}\}/g,(n,i)=>{let s=i.trim();if(/^__[A-Z_]+__$/.test(s))return n;try{let a=Me(i,t);if(a===void 0)return n;return JSON.stringify(a).replace(/</g,"\\u003c")}catch{return n}}),r}function fd(e,t){if(!e.includes("{"))return e;let r=e;return r=r.replace(/\{!!([\s\S]*?)!!\}/g,(n,i)=>{try{let s=Me(i,t);if(s===void 0)return n;return s===null?"":String(s)}catch{return n}}),r=r.replace(/\{\{([\s\S]*?)\}\}/g,(n,i)=>{let s=i.trim();if(/^__[A-Z_]+__$/.test(s))return n;try{let a=Me(i,t);if(a===void 0)return n;if(a===null)return"";return String(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return n}}),r}function yv(e,t,r={}){let{output:n,scripts:i}=ji(e),s=i.map((a)=>{let o=a.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),l=a.match(/^<script\b[^>]*>/i),c=a.search(/<\/script\s*>$/i);if(!o||!l||c===-1)return a;let u=o[1],d=o[2];if(/\bdata-raw\b/.test(u))return a;if(r.skipServer&&/\bserver\b/.test(u))return a;let h=`<script${fd(u,t)}>`;if(/\bsrc\s*=/.test(u)||/\btype\s*=\s*["']application\/json["']/.test(u))return h+d+a.slice(c);return h+Qa(d,t)+a.slice(c)});return cd(n,s)}function hn(e,t,r){let n=e,i=(d,h)=>{let p=Ga(d,h);if(p===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(d.slice(h,p))?-1:p},s=(d,h,p,f)=>{let m=p.length,{output:y,tokens:g}=Cr(d,h,(v,w)=>f(m+w));return p.push(...g),y},a=[];n=s(n,i,a,(d)=>`<!--__STX_STYLE_${d}__-->`);let o=[];n=s(n,an,o,(d)=>`<!--__STX_SCRIPT_EXPR_${d}__-->`);let l=t?.__stx_signals_gate===!0||Pr(e),c=new Set(Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[]),u=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=n.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(d,h,p)=>{try{let f=Me(h,t);return f!==void 0&&f!==null?String(f):""}catch(f){let m=f instanceof Error?f.message:String(f);return Ce("Expression",`Error evaluating: {{{ ${h.trim()}}}}: ${m}`,r,e,p,d)}}),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(d,h,p)=>{try{let f=Me(h,t);if(f===void 0&&t.__stx_buildMode==="compile")return Qi("raw",h.trim());return f!==void 0&&f!==null?String(f):""}catch(f){if(t.__stx_buildMode==="compile")return Qi("raw",h.trim());let m=f instanceof Error?f.message:String(f);return Ce("Expression",`Error evaluating: {!! ${h.trim()} !!}: ${m}`,r,e,p,d)}}),n=s(n,an,o,(d)=>`<!--__STX_SCRIPT_EXPR_${d}__-->`),n=s(n,i,a,(d)=>`<!--__STX_STYLE_${d}__-->`),n=n.replace(/\{\{([\s\S]*?)\}\}/g,(d,h,p)=>{let f=h.trim();if(u.has(f))return d;let m=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],y=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,g=f.match(y)?.[1],v=g&&((g in t)||m.includes(g)),w=Boolean(g&&c.has(g)),b=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,S=f.match(b),x=S&&!m.includes(S[1])&&!(S[1]in t);if(/^__[A-Z_]+__$/.test(f))return"";try{let _=Me(h,t);if(w)return d;if(l&&!gl(f,t))return d;if(t.__stx_buildMode==="compile"&&!l&&(_===void 0||gv(f,t)))return Qi("expr",f);return _!==void 0&&_!==null?kt(String(_)):""}catch(_){if(w)return d;if(l&&!gl(f,t))return d;if(x)return d;let E=_ instanceof Error?_.message:String(_);return Ce("Expression",`Error evaluating: {{ ${f} }}: ${E}`,r,e,p,d)}});for(let d=0;d<o.length;d++)n=n.replace(`<!--__STX_SCRIPT_EXPR_${d}__-->`,()=>o[d]);for(let d=0;d<a.length;d++)n=n.replace(`<!--__STX_STYLE_${d}__-->`,()=>a[d]);return n}function hd(e,t,r){if(!t.trim())return e;let n=e,i=t.trim();while(i.length>0){let s=i.match(/^(\w+)/);if(!s)break;let a=s[1];i=i.substring(a.length).trim();let o=Tr[a]||Rr[a];if(!o)throw Error(`Filter not found: ${a}. Available filters: ${Object.keys(pd()).join(", ")}`);let l=[];if(i.startsWith(":")){let c=i.match(/^:([^|\s]+)/);if(c){let u=c[1].trim();try{let d=Number(u);l=[Number.isNaN(d)?u:d]}catch{l=[u]}i=i.substring(c[0].length).trim()}}else if(i.startsWith("(")){let c=1,u=1;while(c>0&&u<i.length){if(i[u]==="(")c++;if(i[u]===")")c--;u++}if(c===0){let d=i.substring(1,u-1).trim();if(d)try{if(d.startsWith("{")&&d.endsWith("}"))l=[Me(`(${d})`,r,!0)];else{let h=[],p="",f=null,m=0,y=0,g=0,v=!1;for(let w=0;w<d.length;w++){let b=d[w];if(v){p+=b,v=!1;continue}if(b==="\\"){p+=b,v=!0;continue}if(f){if(p+=b,b===f)f=null;continue}if(b==='"'||b==="'"||b==="`"){f=b,p+=b;continue}if(b==="(")m++;else if(b===")")m--;else if(b==="[")y++;else if(b==="]")y--;else if(b==="{")g++;else if(b==="}")g--;if(b===","&&m===0&&y===0&&g===0){h.push(p),p="";continue}p+=b}if(p)h.push(p);l=h.map((w)=>{let b=w.trim();return Me(b,r,!0)})}}catch{l=[d]}i=i.substring(u).trim()}}try{n=o(n,r,...l)}catch(c){let u=c instanceof Error?c.message:String(c);throw Error(`Error applying filter '${a}': ${u}`)}if(i.startsWith("|"))i=i.substring(1).trim();else break}return n}function vv(e){let t=!1,r="",n=0,i=0,s=0,a=!1;for(let o=0;o<e.length;o++){let l=e[o],c=e[o+1];if(t&&a){a=!1;continue}if(t&&l==="\\"){a=!0;continue}if(a=!1,(l==='"'||l==="'"||l==="`")&&!a){if(!t)t=!0,r=l;else if(l===r)t=!1,r="";continue}if(t&&r==="`"&&l==="$"&&c==="{"){let u=1;o+=2;while(o<e.length&&u>0){if(e[o]==="{")u++;else if(e[o]==="}")u--;if(u>0)o++}continue}if(t)continue;if(l==="(")n++;else if(l===")")n--;else if(l==="[")i++;else if(l==="]")i--;else if(l==="{")s++;else if(l==="}")s--;if(l==="|"&&n===0&&i===0&&s===0){if(c==="|"){o++;continue}if(c==="="){o++;continue}return o}}return-1}function Me(e,t,r=!1){try{let n=e.trim(),i=vv(n);if(i>0){let s=n.substring(0,i).trim(),a=n.substring(i+1).trim(),o=Me(s,t,!0);return hd(o,a,t)}if(!Se(n)){if(!r)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${n}`);return fe(n,t)}try{let s=Object.keys(t),a=Object.values(t);return ye(n,s)(...a)}catch{return fe(n,t)}}catch(n){if(n instanceof ReferenceError){let i=/(\b\w+)\s+is not defined/.exec(n.message);if(i){let s=i[1],a=wv(s,Object.keys(t));if(a&&a!==s)n.message=`${n.message} \u2014 did you mean '${a}'?`}}if(!r)console.error(`Error evaluating expression: ${e}`,n);throw n}}function wv(e,t){let r=null;for(let i of t){if(i===e)continue;let s=bv(e,i);if(r===null||s<r.dist)r={key:i,dist:s}}if(!r)return null;let n=Math.max(e.length,r.key.length);if(r.dist<=2||r.dist/n<=0.35)return r.key;return null}function bv(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[r,n]=e.length<t.length?[e,t]:[t,e],i=Array(r.length+1),s=Array(r.length+1);for(let a=0;a<=r.length;a++)i[a]=a;for(let a=1;a<=n.length;a++){s[0]=a;for(let o=1;o<=r.length;o++){let l=r[o-1]===n[a-1]?0:1;s[o]=Math.min(s[o-1]+1,i[o]+1,i[o-1]+l)}for(let o=0;o<=r.length;o++)i[o]=s[o]}return i[r.length]}function xv(e){if(!e)return"";return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var Tr,js,Rr,dt=R(()=>{_e(),Te(),dv(),Nr(),Tr={},js=new Map,Rr={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let r=String(e);return r.charAt(0).toUpperCase()+r.slice(1)},number:(e,t,r=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(r),10))}catch{return""}},fmt:(e,t,r="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(r)}catch{return String(e)}},join:(e,t,r=",")=>{if(!Array.isArray(e))return"";return e.join(String(r))},escape:(e,t)=>{if(e===void 0||e===null)return"";return kt(String(e))},translate:(e,t,r={})=>{if(!t||!t.__translations)return e;let n=t.__translations,i=t.__i18nConfig?.fallbackToKey??!0,s=String(e).split("."),a=n;for(let l of s){if(a===void 0||a===null)break;a=a[l]}if(a===void 0||a===null)return i?e:"";let o=String(a);return Object.entries(r).forEach(([l,c])=>{o=o.replace(fv(l),String(c))}),o},t:(e,t,r={})=>Rr.translate(e,t,r),truncate:(e,t,r=50,n="...")=>{if(e===void 0||e===null)return"";let i=String(e);if(i.length<=r)return i;if(r<=n.length)return n.substring(0,r);return i.substring(0,r-n.length)+n},date:(e,t,r="short",n="en-US")=>{if(e===void 0||e===null)return"";try{let i=e instanceof Date?e:new Date(e);if(Number.isNaN(i.getTime()))return String(e);let s={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(r==="iso")return i.toISOString();return new Intl.DateTimeFormat(n,s[r]||s.short).format(i)}catch{return String(e)}},currency:(e,t,r="USD",n="en-US")=>{if(e===void 0||e===null)return"";try{let i=Number(e);if(Number.isNaN(i))return String(e);return new Intl.NumberFormat(n,{style:"currency",currency:r}).format(i)}catch{return String(e)}},pluralize:(e,t,r,n)=>{let i=Number(e);if(Number.isNaN(i))return r;let s=n||`${r}s`;return i===1?r:s},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let r=String(e);return r.charAt(r.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,r=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return r?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,r="")=>e===void 0||e===null||e===""?r:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,r=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(r,n);return e},replace:(e,t,r,n="")=>{if(e===void 0||e===null)return"";let i=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(i,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let r=Number(e);return Number.isNaN(r)?0:Math.abs(r)},round:(e,t,r=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let i=10**r;return Math.round(n*i)/i}}});class Zr{cache=new Map;maxSize;constructor(e=100){this.maxSize=e}get(e){if(!this.cache.has(e))return;let t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){let r=this.cache.keys().next().value;if(r!==void 0)this.cache.delete(r)}this.cache.set(e,t)}has(e){return this.cache.has(e)}delete(e){return this.cache.delete(e)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function ri(e,t){if(t?.includes("g"))return new RegExp(e,t);let r=`${e}:${t||""}`;if(!Dt.has(r)){if(Dt.size>=_v){let n=Dt.keys().next().value;if(n)Dt.delete(n)}Dt.set(r,new RegExp(e,t))}return Dt.get(r)}class md{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let t=Array.from(new Set(e)),r=t.sort().join(","),n=this.pool.find((o)=>o.context.join(",")===r);if(n)return n.func;let i=this.fnCache,s=this.fnCacheMaxSize,a=(...o)=>(l)=>{try{let c=`${r}:${l}`,u=i.get(c);if(!u){if(i.size>=s){let d=i.keys().next().value;if(d)i.delete(d)}u=Function(...t,`
2532
2532
  'use strict';
2533
2533
  try {
2534
2534
  return ${l};
@@ -2539,34 +2539,34 @@ catch (e) {
2539
2539
  }
2540
2540
  throw e;
2541
2541
  }
2542
- `),i.set(c,u)}return u(...o)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:t.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}class md{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,t){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...t})}setBudgets(e){for(let[t,r]of Object.entries(e))this.setBudget(t,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[t,r]of this.budgets.entries())e[t]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let t=this.violationHandlers.indexOf(e);if(t!==-1)this.violationHandlers.splice(t,1)}time(e,t){if(!this.enabled)return t();let r=performance.now(),n=t(),i=performance.now()-r;return this.recordTime(e,i),this.checkBudget(e,i),n}async timeAsync(e,t){if(!this.enabled)return t();let r=performance.now(),n=await t(),i=performance.now()-r;return this.recordTime(e,i),this.checkBudget(e,i),n}checkBudget(e,t){let r=this.budgets.get(e);if(!r)return;let n=t/r.maxTime*100,i=r.warnThreshold!==void 0?t>=r.maxTime*r.warnThreshold&&t<r.maxTime:!1,s=t>=r.maxTime;if(!i&&!s)return;let a={label:e,actualTime:t,budgetTime:r.maxTime,exceedancePercent:n,timestamp:new Date,isWarning:i};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let l of this.violationHandlers)try{l(a)}catch{}let o=i?`[Performance Warning] "${e}" took ${t.toFixed(2)}ms (${n.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${t.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(n-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(o);break;case"warn":console.warn(o);break;case"error":console.error(o);break;case"throw":if(s)throw Error(o);else console.warn(o);break}}recordTime(e,t){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=t,r.maxTime=Math.max(r.maxTime,t),r.minTime=Math.min(r.minTime,t);else this.metrics.set(e,{count:1,totalTime:t,maxTime:t,minTime:t})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let n=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:n?.maxTime,budgetUtilization:n?r.totalTime/r.count/n.maxTime*100:void 0}}let t={};for(let[r,n]of this.metrics.entries()){let i=this.budgets.get(r);t[r]={count:n.count,avgTime:n.totalTime/n.count,totalTime:n.totalTime,maxTime:n.maxTime,minTime:n.minTime,budget:i?.maxTime,budgetUtilization:i?n.totalTime/n.count/i.maxTime*100:void 0}}return t}getViolations(e){if(e)return this.violations.filter((t)=>t.label===e);return[...this.violations]}getViolationStats(){let e={},t=0,r=0;for(let n of this.violations)if(e[n.label]=(e[n.label]||0)+1,n.isWarning)t++;else r++;return{total:this.violations.length,byLabel:e,warnings:t,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function xv(){if(!Qi)Qi=new md;return Qi}var jt,Sv=500,_v,Qi=null,gd,hn=R(()=>{jt=new Map,_v=new hd,gd=new Proxy({},{get(e,t){return xv()[t]}})});function kv(e,t=""){let r=`${e}${t}`,n=0;for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);n=(n<<5)-n+s,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Ev(e,t,r={}){let{prefix:n="",preserveHost:i=!0,scopeKeyframes:s=!0,scopeCustomProperties:a=!1}=r;if(!e.trim())return"";let o=Qa(e),l=[],c=new Map;if(s)for(let u of o){let d=u.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(d){let h=d[1],p=`${t}_${h}`;c.set(h,p)}}for(let u of o){let d=yd(u,t,n,i,c,a);l.push(d)}return l.join(`
2542
+ `),i.set(c,u)}return u(...o)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:t.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}class gd{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,t){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...t})}setBudgets(e){for(let[t,r]of Object.entries(e))this.setBudget(t,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[t,r]of this.budgets.entries())e[t]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let t=this.violationHandlers.indexOf(e);if(t!==-1)this.violationHandlers.splice(t,1)}time(e,t){if(!this.enabled)return t();let r=performance.now(),n=t(),i=performance.now()-r;return this.recordTime(e,i),this.checkBudget(e,i),n}async timeAsync(e,t){if(!this.enabled)return t();let r=performance.now(),n=await t(),i=performance.now()-r;return this.recordTime(e,i),this.checkBudget(e,i),n}checkBudget(e,t){let r=this.budgets.get(e);if(!r)return;let n=t/r.maxTime*100,i=r.warnThreshold!==void 0?t>=r.maxTime*r.warnThreshold&&t<r.maxTime:!1,s=t>=r.maxTime;if(!i&&!s)return;let a={label:e,actualTime:t,budgetTime:r.maxTime,exceedancePercent:n,timestamp:new Date,isWarning:i};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let l of this.violationHandlers)try{l(a)}catch{}let o=i?`[Performance Warning] "${e}" took ${t.toFixed(2)}ms (${n.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${t.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(n-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(o);break;case"warn":console.warn(o);break;case"error":console.error(o);break;case"throw":if(s)throw Error(o);else console.warn(o);break}}recordTime(e,t){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=t,r.maxTime=Math.max(r.maxTime,t),r.minTime=Math.min(r.minTime,t);else this.metrics.set(e,{count:1,totalTime:t,maxTime:t,minTime:t})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let n=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:n?.maxTime,budgetUtilization:n?r.totalTime/r.count/n.maxTime*100:void 0}}let t={};for(let[r,n]of this.metrics.entries()){let i=this.budgets.get(r);t[r]={count:n.count,avgTime:n.totalTime/n.count,totalTime:n.totalTime,maxTime:n.maxTime,minTime:n.minTime,budget:i?.maxTime,budgetUtilization:i?n.totalTime/n.count/i.maxTime*100:void 0}}return t}getViolations(e){if(e)return this.violations.filter((t)=>t.label===e);return[...this.violations]}getViolationStats(){let e={},t=0,r=0;for(let n of this.violations)if(e[n.label]=(e[n.label]||0)+1,n.isWarning)t++;else r++;return{total:this.violations.length,byLabel:e,warnings:t,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Sv(){if(!Xi)Xi=new gd;return Xi}var Dt,_v=500,kv,Xi=null,yd,mn=R(()=>{Dt=new Map,kv=new md,yd=new Proxy({},{get(e,t){return Sv()[t]}})});function Ev(e,t=""){let r=`${e}${t}`,n=0;for(let i=0;i<r.length;i++){let s=r.charCodeAt(i);n=(n<<5)-n+s,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Av(e,t,r={}){let{prefix:n="",preserveHost:i=!0,scopeKeyframes:s=!0,scopeCustomProperties:a=!1}=r;if(!e.trim())return"";let o=Xa(e),l=[],c=new Map;if(s)for(let u of o){let d=u.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(d){let h=d[1],p=`${t}_${h}`;c.set(h,p)}}for(let u of o){let d=vd(u,t,n,i,c,a);l.push(d)}return l.join(`
2543
2543
 
2544
- `)}function Qa(e){let t=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,i="",s=!1,a="";for(let o=0;o<r.length;o++){let l=r[o];if(l==="@"&&n===0)s=!0;if(l==="{")n++;else if(l==="}"){if(n--,n===0){if(s){a+=l;let c=a.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(c){let[,u,d,h]=c;if(u==="keyframes")t.push({selector:`@keyframes ${d.trim()}`,declarations:h.trim()});else if(u==="media"||u==="supports"||u==="container"){let p=Qa(h);t.push({selector:`@${u} ${d.trim()}`,declarations:p.map((f)=>`${f.selector} { ${f.declarations} }`).join(`
2545
- `)})}else t.push({selector:`@${u} ${d.trim()}`,declarations:h.trim()})}a="",s=!1}else if(i.trim()){i+=l;let c=i.match(/([^{]+)\{([^}]*)\}/);if(c)t.push({selector:c[1].trim(),declarations:c[2].trim()});i=""}continue}}if(s)a+=l;else i+=l}return t}function yd(e,t,r,n,i,s){let{selector:a,declarations:o}=e;if(a.startsWith("@")){if(a.startsWith("@keyframes")){let u=a.replace("@keyframes ","").trim();return`@keyframes ${i.get(u)||u} { ${o} }`}if(a.startsWith("@media")||a.startsWith("@supports")||a.startsWith("@container")){let u=Qa(`x { ${o} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((d)=>yd(d,t,r,n,i,s)).join(`
2544
+ `)}function Xa(e){let t=[],r=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,i="",s=!1,a="";for(let o=0;o<r.length;o++){let l=r[o];if(l==="@"&&n===0)s=!0;if(l==="{")n++;else if(l==="}"){if(n--,n===0){if(s){a+=l;let c=a.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(c){let[,u,d,h]=c;if(u==="keyframes")t.push({selector:`@keyframes ${d.trim()}`,declarations:h.trim()});else if(u==="media"||u==="supports"||u==="container"){let p=Xa(h);t.push({selector:`@${u} ${d.trim()}`,declarations:p.map((f)=>`${f.selector} { ${f.declarations} }`).join(`
2545
+ `)})}else t.push({selector:`@${u} ${d.trim()}`,declarations:h.trim()})}a="",s=!1}else if(i.trim()){i+=l;let c=i.match(/([^{]+)\{([^}]*)\}/);if(c)t.push({selector:c[1].trim(),declarations:c[2].trim()});i=""}continue}}if(s)a+=l;else i+=l}return t}function vd(e,t,r,n,i,s){let{selector:a,declarations:o}=e;if(a.startsWith("@")){if(a.startsWith("@keyframes")){let u=a.replace("@keyframes ","").trim();return`@keyframes ${i.get(u)||u} { ${o} }`}if(a.startsWith("@media")||a.startsWith("@supports")||a.startsWith("@container")){let u=Xa(`x { ${o} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((d)=>vd(d,t,r,n,i,s)).join(`
2546
2546
  `);return`${a} {
2547
2547
  ${u}
2548
- }`}return`${a} { ${o} }`}let l=Av(a,t,r,n),c=o;for(let[u,d]of i)c=c.replace(new RegExp(`\\b${u}\\b`,"g"),d);if(s)c=c.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${l} { ${c} }`}function Av(e,t,r,n){let i=e.split(",").map((a)=>a.trim()),s=[];for(let a of i){if(a.startsWith(":host")){if(n)s.push(a);else{let c=a.replace(/:host(\([^)]*\))?/,`.${t}$1`);s.push(c)}continue}if(a.includes("::slotted")){s.push(a);continue}if(a===":root"){s.push(`:root .${t}`);continue}let o=r?`${r} .${t}`:`.${t}`;s.push(`${o} ${a}`);let l=Cv(a,t);if(l)s.push(r?`${r} ${l}`:l)}return s.join(", ")}function Cv(e,t){let r=0,n=e.length;for(let l=0;l<e.length;l++){let c=e[l];if(c==="["||c==="(")r++;else if(c==="]"||c===")")r--;else if(r===0&&(c===" "||c===">"||c==="+"||c==="~")){n=l;break}}let i=e.slice(0,n),s=e.slice(n);if(!i)return"";let a=i.length,o=0;for(let l=0;l<i.length;l++){let c=i[l];if(c==="["||c==="(")o++;else if(c==="]"||c===")")o--;else if(r===0&&o===0&&c===":"){a=l;break}}return`${i.slice(0,a)}.${t}${i.slice(a)}${s}`}function Tv(e){let t=new Set;return e.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(r)=>{let n=r.trim();if(t.has(n))return"";return t.add(n),r})}function vd(e,t){if(!wd.test(e))return{html:e,hasScoped:!1};let r=kv(t),n=`data-v-${r}`,i=e,s=new RegExp(`<style\\s+([^>]*${ri}[^>]*)>([\\s\\S]*?)</style>`,"gi"),a=!1;if(i=i.replace(s,(o,l,c)=>{a=!0;let u=Rv(c,n),d=l.replace(new RegExp(ri,"gi"),"").trim(),h=d?` ${d}`:"";return`<style data-stx-scoped="${r}"${h}>${u}</style>`}),!a)return{html:e,hasScoped:!1};return i=Iv(i,n),{html:i,hasScoped:!0}}function Rv(e,t){return Ev(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}function Iv(e,t){let r=Ar(e,(i,s)=>{let a=sn(i,s);return a>s?a:Ua(i,s)},(i,s)=>jv(s)),n=Ov(r.output,t);return js.lastIndex=0,n.replace(js,(i,s)=>r.tokens[Number(s)])}function Ov(e,t){let r=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(n,i,s)=>{if(r.has(i.toLowerCase()))return n;if(n.includes(t))return n;if(i.toLowerCase()==="style"||i.toLowerCase()==="script")return n;if(s)return n.replace(`<${i}${s}`,`<${i} ${t}${s}`);if(n.endsWith("/>"))return`<${i} ${t} />`;return`<${i} ${t}>`})}var ri,wd,jv=(e)=>`\x00stx-scope-mask-${e}\x00`,js,bd=R(()=>{Lr(),ri=String.raw`(?<![\w-])scoped(?![\w-])`,wd=new RegExp(`<style\\s+[^>]*${ri}`,"i"),js=/\u0000stx-scope-mask-(\d+)\u0000/g});function Dv(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return Sd.test(t)}function xd(e){ur.lastIndex=0;let t;while((t=ur.exec(e))!==null){if(t[0].startsWith("</")||Dv(t[0]))continue;let r=t.index,n=ur.lastIndex,i=1,s;while((s=ur.exec(e))!==null)if(s[0].startsWith("</")){if(i--,i===0){let a=s.index;return{start:r,openEnd:n,closeStart:a,end:ur.lastIndex,content:e.slice(n,a)}}}else i++;return null}return null}var ur,Sd,_d=R(()=>{ur=/<\/?template\b[^>]*>/gi,Sd=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i}),$v=()=>{};function Ke(e,t,r,n=0){let i=0,s=n,a=null,o=0,l=!1;while(s<e.length){let c=e[s];if(a&&l){l=!1,s++;continue}if(a&&c==="\\"){l=!0,s++;continue}if(l=!1,(c==='"'||c==="'"||c==="`")&&!a){a=c,s++;continue}if(c===a&&a!=="`"){a=null,s++;continue}if(a==="`"&&c==="$"&&e[s+1]==="{"){o++,s+=2;continue}if(o>0&&c==="}"){o--,s++;continue}if(c==="`"&&a==="`"&&o===0){a=null,s++;continue}if(a){s++;continue}if(c===t)i++;else if(c===r){if(i--,i===0)return s}s++}return-1}var Ds={};Y(Ds,{useTitle:()=>gl,useSeoMeta:()=>Ed,usePageTitle:()=>gl,useHead:()=>Xa,seoMetaToHeadConfig:()=>eo,resetHead:()=>Nv,renderHtmlAttrs:()=>Bv,renderHead:()=>Mv,renderBodyAttrs:()=>zv,processTitleDirective:()=>Wv,processMetaDirective:()=>Hv,processHeadDirective:()=>qv,mergeHeadConfigs:()=>mn,getPageMeta:()=>Lv,getHead:()=>kd,definePageMeta:()=>Pv,applyHead:()=>Fv});function kd(){return ct}function Lv(){return an}function Nv(){ct={},Ad.length=0,an={}}function Xa(e){ct=mn(ct,e)}function mn(e,t){return{title:t.title??e.title,titleTemplate:t.titleTemplate??e.titleTemplate,base:t.base??e.base,meta:[...e.meta||[],...t.meta||[]],link:[...e.link||[],...t.link||[]],script:[...e.script||[],...t.script||[]],style:[...e.style||[],...t.style||[]],htmlAttrs:{...e.htmlAttrs,...t.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...t.bodyAttrs}}}function Ed(e){Xa(eo(e))}function eo(e){let t=[];if(e.description)t.push({name:"description",content:e.description});if(e.keywords){let l=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;t.push({name:"keywords",content:l})}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,n=e.ogDescription??e.description;if(r)t.push({property:"og:title",content:r});if(n)t.push({property:"og:description",content:n});if(e.ogImage)t.push({property:"og:image",content:e.ogImage});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});let i=e.twitterTitle??e.title,s=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)t.push({name:"twitter:card",content:e.twitterCard});if(i)t.push({name:"twitter:title",content:i});if(s)t.push({name:"twitter:description",content:s});if(a)t.push({name:"twitter:image",content:a});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 l of e.articleTags)t.push({property:"article:tag",content:l});let o=[];if(e.canonical)o.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:t,link:o}}function Pv(e){if(an={...an,...e},e.title||e.description)Ed({title:e.title,description:e.description})}function gl(e){let t=typeof e==="function"?e():e;Xa({title:t})}function Mv(e=ct){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>${Dt(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([n,i])=>`${n}="${Dt(i)}"`).join(" ");t.push(`<base ${r}>`)}for(let r of e.meta||[]){let n=Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>{return`${i==="httpEquiv"?"http-equiv":i}="${Dt(String(s))}"`}).join(" ");t.push(`<meta ${n}>`)}for(let r of e.link||[]){let n=Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}="${Dt(String(s))}"`).join(" ");t.push(`<link ${n}>`)}for(let r of e.script||[]){let{content:n,...i}=r,s=Object.entries(i).filter(([a,o])=>o!==void 0).map(([a,o])=>{if(typeof o==="boolean")return o?a:"";return`${a}="${Dt(String(o))}"`}).filter(Boolean).join(" ");if(n)t.push(`<script ${s}>${n}</script>`);else t.push(`<script ${s}></script>`)}for(let r of e.style||[]){let n=r.type?` type="${r.type}"`:"";t.push(`<style${n}>${r.content}</style>`)}return t.join(`
2549
- `)}function Bv(e=ct){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([t,r])=>`${t}="${Dt(r)}"`).join(" ")}function zv(e=ct){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([t,r])=>`${t}="${Dt(r)}"`).join(" ")}function Dt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Fv(e=ct){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 n=document.querySelector(r);if(!n){if(n=document.createElement("meta"),t.name)n.setAttribute("name",t.name);if(t.property)n.setAttribute("property",t.property);document.head.appendChild(n)}n.setAttribute("content",t.content)}}for(let t of e.link||[]){let r=`link[rel="${t.rel}"]${t.href?`[href="${t.href}"]`:""}`,n=document.querySelector(r);if(!n)n=document.createElement("link"),document.head.appendChild(n);for(let[i,s]of Object.entries(t))if(s!==void 0)n.setAttribute(i,String(s))}if(e.htmlAttrs)for(let[t,r]of Object.entries(e.htmlAttrs))if(t==="class")for(let n of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(n);else document.documentElement.setAttribute(t,r);if(e.bodyAttrs)for(let[t,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(t,r)}function qv(e){let t="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(r,n)=>{return t+=n.trim()+`
2550
- `,""}),headContent:t.trim()}}function Wv(e,t){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,n,i,s)=>{let a=n?i:t[(s||"").trim()]??s,o=t.__stx_runtime_head??{};return t.__stx_runtime_head=mn(o,{title:a}),""})}function Hv(e,t){return e.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(r,n,i,s,a,o)=>{let l=s?a:o,c=s?l:t[(l||"").trim()]??l,u=i.includes(":")?{property:i,content:c}:{name:i,content:c},d=t.__stx_runtime_head??{};return t.__stx_runtime_head=mn(d,{meta:[u]}),""})}var ct,Ad,an,ni=R(()=>{ct={},Ad=[],an={}}),ji={};Y(ji,{stripTypeScript:()=>Cd,splitDeclaration:()=>$d,isModuleResolutionFailure:()=>Td,isMissingBindingFailure:()=>Rd,isCompleteImport:()=>Id,hasVariables:()=>Qv,extractVariables:()=>on,extractScriptFromTemplate:()=>Zv,convertToCommonJS:()=>Od,STX_ENGINE_BINDING_NAMES:()=>ii});function Uv(e){let t=[],r=0,n=e.split(`
2551
- `);for(let i of n){let s=r,a=null,o=!1;for(let l=0;l<i.length;l++){let c=i[l];if(o){o=!1;continue}if(c==="\\"){o=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c==="/"&&l+1<i.length&&i[l+1]==="/")break;if(c==="{")r++;else if(c==="}")r--}if(s===0){let l=i.match(/(?:const|let|var)\s+(\w+)\s*=/);if(l)t.push(l[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(i)){let c=i.match(/(?:const|let|var)\s+(\w+)/);if(c)t.push(c[1])}else{let c=i.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(c){let u=c[1].slice(1,-1).split(",").map((d)=>{let h=d.split(":");return(h.length>1?h[1]:h[0]).trim()}).filter((d)=>/^\w+$/.test(d));t.push(...u)}}}}return[...new Set(t)]}function Cd(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function r(n){if(!n.includes(":"))return n;let i=[],s="",a=0,o=0,l=null;for(let c=0;c<n.length;c++){let u=n[c];if(l){if(s+=u,u===l)l=null;continue}if(u==='"'||u==="'"||u==="`"){l=u,s+=u;continue}if(u==="<")a++;else if(u===">"&&a>0)a--;else if(u==="(")o++;else if(u===")")o--;if(u===","&&a===0&&o===0){i.push(s),s="";continue}s+=u}if(s)i.push(s);return i.map((c)=>{let u=c.trim(),d=u.startsWith("..."),h=d?u.slice(3):u,p=-1,f=0;for(let b=0;b<h.length;b++)if(h[b]==="<")f++;else if(h[b]===">")f--;else if(h[b]===":"&&f===0){p=b;break}if(p===-1)return c;let m=h.substring(0,p).trim().replace(/\?$/,""),y=h.substring(p+1),g=-1,v=0;for(let b=0;b<y.length;b++)if(y[b]==="<")v++;else if(y[b]===">")v--;else if(y[b]==="="&&v===0){g=b;break}let w=d?"...":"";if(g!==-1)return`${w}${m} = ${y.substring(g+1).trim()}`;return`${w}${m}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,i,s)=>{if(!s.includes(":"))return n;return`${i}(${r(s)})`});{let n=/\b(function\s+\w*\s*)\(/g,i,s=[];while((i=n.exec(t))!==null){let a=i.index+i[0].length-1,o=1,l=a+1,c=0,u=null;while(l<t.length&&o>0){let p=t[l];if(u){if(p===u)u=null;l++;continue}if(p==='"'||p==="'"||p==="`"){u=p,l++;continue}if(p==="<")c++;else if(p===">"&&c>0)c--;else if(c===0){if(p==="(")o++;else if(p===")")o--}if(o>0)l++}if(o!==0)continue;let d=t.substring(a+1,l);if(!d.includes(":"))continue;let h=r(d);s.push({start:a+1,end:l,replacement:h})}for(let a=s.length-1;a>=0;a--){let{start:o,end:l,replacement:c}=s[a];t=t.substring(0,o)+c+t.substring(l)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,i)=>{if(!i.includes(":"))return n;if(i.includes("{")||i.includes("}"))return n;return`(${i.split(",").map((s)=>{let[a,...o]=s.split("="),l=a.split(":")[0].trim();if(o.length>0)return`${l} = ${o.join("=").trim()}`;return l}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
2552
-
2553
- `),t}function Td(e){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(e)}function Rd(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}async function on(e,t,r,n={}){if(!e.trim())return;let i;try{let $=new Bun.Transpiler({loader:"ts",target:"browser",define:Zt()}),j=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");j=j.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),i=$.transformSync(j)}catch{i=Cd(e)}let s={exports:{}},a=s.exports,o=vr.cwd(),l={},c=[...i.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map(($)=>$[1]).filter(($)=>!$.startsWith("node:")&&!$.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes($));for(let $ of c)try{let j=vt.resolve(o,"node_modules",$),P=vt.join(j,"package.json"),W=JSON.parse(Zn("fs").readFileSync(P,"utf8")),q=W.main||"index.js";if(W.exports){let V=typeof W.exports==="string"?W.exports:W.exports["."];if(typeof V==="string")q=V;else if(V?.bun)q=V.bun;else if(V?.import)q=V.import;else if(V?.default)q=V.default}l[$]=await import(vt.resolve(j,q))}catch{}let u=($)=>{if(l[$])return l[$];return Zn($)},d=t.props||{},h=($)=>{if(!$)return d;let j={};for(let[P,W]of Object.entries($)){let q=d[P];if(q!==void 0)j[P]=q;else if(typeof W==="function")j[P]=W();else j[P]=W}return j};for(let[$,j]of Object.entries(d))Object.defineProperty(h,$,{value:j,enumerable:!0,configurable:!0,writable:!0});for(let $ of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(d,$))continue;try{Object.defineProperty(h,$,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let p=($)=>{if(!$)return d;let j={...d};for(let[P,W]of Object.entries($)){let q=W&&typeof W==="object"&&!Array.isArray(W)?W:{type:W};if(j[P]===void 0&&q.default!==void 0)j[P]=typeof q.default==="function"?q.default():q.default}return j},f=()=>t.slots||{},m=($,j)=>{let P={...$};for(let[W,q]of Object.entries(j))if(P[W]===void 0)if(typeof q==="function")P[W]=q();else P[W]=q;return P},y=($)=>{let j=()=>$;return j.set=(P)=>{},j.update=(P)=>{},j},g=($)=>{let j,P=!1;return()=>{if(!P)try{j=$(),P=!0}catch{j=void 0}return j}},v=($)=>{},w=($)=>$(),b=($)=>{},S=($)=>{};function x($){let j=$||{};if(j.title!==void 0||j.description!==void 0)T({title:j.title,description:j.description})}function _($){if(!$||typeof $!=="object")return;let j=t.__stxClientPayload??{};Object.assign(j,$),t.__stxClientPayload=j}let E=()=>{let $=t.__stxServeContext,j=t.__stxServeSearch??$?.search??"",P=$?.path??"",W=Object.fromEntries(new URLSearchParams(j)),q=t.query,V=Object.keys(W).length>0?W:q??{},Me=j||(Object.keys(V).length>0?`?${new URLSearchParams(V).toString()}`:"");return{params:t.params??{},query:V,path:P,name:"",fullPath:P+Me,hash:"",matched:[]}},k=()=>({push:($)=>{},replace:($)=>{},back:()=>{},forward:()=>{},go:($)=>{}}),A=($)=>{let j=t.__stx_runtime_head||{};t.__stx_runtime_head=mn(j,$||{})},T=($)=>{A(eo($||{}))},C=($)=>({value:$}),D=($)=>$,I=($)=>({value:typeof $==="function"?$():$}),O=($,j)=>{},L=($)=>{},N=($)=>{},B=($)=>$?$():Promise.resolve(),F=($)=>(j,...P)=>{},K=($)=>{},Te=($,j)=>{},ae=($,j)=>j,ye=()=>({value:"light"}),z=()=>y(!1),G=($)=>y(!1),ve=()=>y(!1),Ie=()=>G("(prefers-color-scheme: dark)"),er=()=>G("(prefers-color-scheme: light)"),H=()=>G("(prefers-reduced-motion: reduce)"),ne=()=>G("(prefers-contrast: more)"),ie={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},_e=new Proxy(ie,{get($,j){if(j in $)return $[j];return},set($,j,P){return $[j]=P,!0}}),we={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},He=console;try{let $=Od(i,r),j=new Set(Object.keys(d)),P=(J)=>/^[a-z_$][\w$]*$/i.test(J),W=Object.keys(t).filter((J)=>!j.has(J)&&J!=="props"&&P(J)),q=W.map((J)=>t[J]);if(!W.includes("__stxServeContext"))W.push("__stxServeContext"),q.push(void 0);let V=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),Me=[],it=[];for(let[J,se]of Object.entries(d)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(J))continue;if(V.has(J))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${J}\\b`).test($))continue;Me.push(J),it.push(se)}let Oe=Uv($).map((J)=>`module.exports.${J} = typeof ${J} !== 'undefined' ? ${J} : module.exports.${J};`).join(`
2554
- `),Be=t.params??{},ze=[],At=[];for(let J=0;J<W.length;J++){if(W[J]==="params")continue;ze.push(W[J]),At.push(q[J])}let pt=await Function(...ii,...Me,...ze,`return (async () => {
2555
- ${$}
2556
- ${Oe}
2548
+ }`}return`${a} { ${o} }`}let l=Cv(a,t,r,n),c=o;for(let[u,d]of i)c=c.replace(new RegExp(`\\b${u}\\b`,"g"),d);if(s)c=c.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${l} { ${c} }`}function Cv(e,t,r,n){let i=e.split(",").map((a)=>a.trim()),s=[];for(let a of i){if(a.startsWith(":host")){if(n)s.push(a);else{let c=a.replace(/:host(\([^)]*\))?/,`.${t}$1`);s.push(c)}continue}if(a.includes("::slotted")){s.push(a);continue}if(a===":root"){s.push(`:root .${t}`);continue}let o=r?`${r} .${t}`:`.${t}`;s.push(`${o} ${a}`);let l=Tv(a,t);if(l)s.push(r?`${r} ${l}`:l)}return s.join(", ")}function Tv(e,t){let r=0,n=e.length;for(let l=0;l<e.length;l++){let c=e[l];if(c==="["||c==="(")r++;else if(c==="]"||c===")")r--;else if(r===0&&(c===" "||c===">"||c==="+"||c==="~")){n=l;break}}let i=e.slice(0,n),s=e.slice(n);if(!i)return"";let a=i.length,o=0;for(let l=0;l<i.length;l++){let c=i[l];if(c==="["||c==="(")o++;else if(c==="]"||c===")")o--;else if(r===0&&o===0&&c===":"){a=l;break}}return`${i.slice(0,a)}.${t}${i.slice(a)}${s}`}function Rv(e){let t=new Set;return e.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(r)=>{let n=r.trim();if(t.has(n))return"";return t.add(n),r})}function wd(e,t){if(!bd.test(e))return{html:e,hasScoped:!1};let r=Ev(t),n=`data-v-${r}`,i=e,s=new RegExp(`<style\\s+([^>]*${ni}[^>]*)>([\\s\\S]*?)</style>`,"gi"),a=!1;if(i=i.replace(s,(o,l,c)=>{a=!0;let u=Iv(c,n),d=l.replace(new RegExp(ni,"gi"),"").trim(),h=d?` ${d}`:"";return`<style data-stx-scoped="${r}"${h}>${u}</style>`}),!a)return{html:e,hasScoped:!1};return i=Ov(i,n),{html:i,hasScoped:!0}}function Iv(e,t){return Av(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}function Ov(e,t){let r=Cr(e,(i,s)=>{let a=an(i,s);return a>s?a:Ga(i,s)},(i,s)=>Dv(s)),n=jv(r.output,t);return Ds.lastIndex=0,n.replace(Ds,(i,s)=>r.tokens[Number(s)])}function jv(e,t){let r=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(n,i,s)=>{if(r.has(i.toLowerCase()))return n;if(n.includes(t))return n;if(i.toLowerCase()==="style"||i.toLowerCase()==="script")return n;if(s)return n.replace(`<${i}${s}`,`<${i} ${t}${s}`);if(n.endsWith("/>"))return`<${i} ${t} />`;return`<${i} ${t}>`})}var ni,bd,Dv=(e)=>`\x00stx-scope-mask-${e}\x00`,Ds,xd=R(()=>{Nr(),ni=String.raw`(?<![\w-])scoped(?![\w-])`,bd=new RegExp(`<style\\s+[^>]*${ni}`,"i"),Ds=/\u0000stx-scope-mask-(\d+)\u0000/g});function $v(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return _d.test(t)}function Sd(e){dr.lastIndex=0;let t;while((t=dr.exec(e))!==null){if(t[0].startsWith("</")||$v(t[0]))continue;let r=t.index,n=dr.lastIndex,i=1,s;while((s=dr.exec(e))!==null)if(s[0].startsWith("</")){if(i--,i===0){let a=s.index;return{start:r,openEnd:n,closeStart:a,end:dr.lastIndex,content:e.slice(n,a)}}}else i++;return null}return null}var dr,_d,kd=R(()=>{dr=/<\/?template\b[^>]*>/gi,_d=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i}),Lv=()=>{};function Ze(e,t,r,n=0){let i=0,s=n,a=null,o=0,l=!1;while(s<e.length){let c=e[s];if(a&&l){l=!1,s++;continue}if(a&&c==="\\"){l=!0,s++;continue}if(l=!1,(c==='"'||c==="'"||c==="`")&&!a){a=c,s++;continue}if(c===a&&a!=="`"){a=null,s++;continue}if(a==="`"&&c==="$"&&e[s+1]==="{"){o++,s+=2;continue}if(o>0&&c==="}"){o--,s++;continue}if(c==="`"&&a==="`"&&o===0){a=null,s++;continue}if(a){s++;continue}if(c===t)i++;else if(c===r){if(i--,i===0)return s}s++}return-1}var $s={};K($s,{useTitle:()=>yl,useSeoMeta:()=>Ad,usePageTitle:()=>yl,useHead:()=>eo,seoMetaToHeadConfig:()=>to,resetHead:()=>Pv,renderHtmlAttrs:()=>zv,renderHead:()=>Bv,renderBodyAttrs:()=>Fv,processTitleDirective:()=>Hv,processMetaDirective:()=>Uv,processHeadDirective:()=>Wv,mergeHeadConfigs:()=>gn,getPageMeta:()=>Nv,getHead:()=>Ed,definePageMeta:()=>Mv,applyHead:()=>qv});function Ed(){return ut}function Nv(){return on}function Pv(){ut={},Cd.length=0,on={}}function eo(e){ut=gn(ut,e)}function gn(e,t){return{title:t.title??e.title,titleTemplate:t.titleTemplate??e.titleTemplate,base:t.base??e.base,meta:[...e.meta||[],...t.meta||[]],link:[...e.link||[],...t.link||[]],script:[...e.script||[],...t.script||[]],style:[...e.style||[],...t.style||[]],htmlAttrs:{...e.htmlAttrs,...t.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...t.bodyAttrs}}}function Ad(e){eo(to(e))}function to(e){let t=[];if(e.description)t.push({name:"description",content:e.description});if(e.keywords){let l=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;t.push({name:"keywords",content:l})}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,n=e.ogDescription??e.description;if(r)t.push({property:"og:title",content:r});if(n)t.push({property:"og:description",content:n});if(e.ogImage)t.push({property:"og:image",content:e.ogImage});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});let i=e.twitterTitle??e.title,s=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)t.push({name:"twitter:card",content:e.twitterCard});if(i)t.push({name:"twitter:title",content:i});if(s)t.push({name:"twitter:description",content:s});if(a)t.push({name:"twitter:image",content:a});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 l of e.articleTags)t.push({property:"article:tag",content:l});let o=[];if(e.canonical)o.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:t,link:o}}function Mv(e){if(on={...on,...e},e.title||e.description)Ad({title:e.title,description:e.description})}function yl(e){let t=typeof e==="function"?e():e;eo({title:t})}function Bv(e=ut){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>${$t(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([n,i])=>`${n}="${$t(i)}"`).join(" ");t.push(`<base ${r}>`)}for(let r of e.meta||[]){let n=Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i==="httpEquiv"?"http-equiv":i}="${$t(String(s))}"`).join(" ");t.push(`<meta ${n}>`)}for(let r of e.link||[]){let n=Object.entries(r).filter(([i,s])=>s!==void 0).map(([i,s])=>`${i}="${$t(String(s))}"`).join(" ");t.push(`<link ${n}>`)}for(let r of e.script||[]){let{content:n,...i}=r,s=Object.entries(i).filter(([a,o])=>o!==void 0).map(([a,o])=>{if(typeof o==="boolean")return o?a:"";return`${a}="${$t(String(o))}"`}).filter(Boolean).join(" ");if(n)t.push(`<script ${s}>${n}</script>`);else t.push(`<script ${s}></script>`)}for(let r of e.style||[]){let n=r.type?` type="${r.type}"`:"";t.push(`<style${n}>${r.content}</style>`)}return t.join(`
2549
+ `)}function zv(e=ut){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([t,r])=>`${t}="${$t(r)}"`).join(" ")}function Fv(e=ut){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([t,r])=>`${t}="${$t(r)}"`).join(" ")}function $t(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function qv(e=ut){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 n=document.querySelector(r);if(!n){if(n=document.createElement("meta"),t.name)n.setAttribute("name",t.name);if(t.property)n.setAttribute("property",t.property);document.head.appendChild(n)}n.setAttribute("content",t.content)}}for(let t of e.link||[]){let r=`link[rel="${t.rel}"]${t.href?`[href="${t.href}"]`:""}`,n=document.querySelector(r);if(!n)n=document.createElement("link"),document.head.appendChild(n);for(let[i,s]of Object.entries(t))if(s!==void 0)n.setAttribute(i,String(s))}if(e.htmlAttrs)for(let[t,r]of Object.entries(e.htmlAttrs))if(t==="class")for(let n of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(n);else document.documentElement.setAttribute(t,r);if(e.bodyAttrs)for(let[t,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(t,r)}function Wv(e){let t="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(r,n)=>(t+=n.trim()+`
2550
+ `,"")),headContent:t.trim()}}function Hv(e,t){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,n,i,s)=>{let a=n?i:t[(s||"").trim()]??s,o=t.__stx_runtime_head??{};return t.__stx_runtime_head=gn(o,{title:a}),""})}function Uv(e,t){return e.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(r,n,i,s,a,o)=>{let l=s?a:o,c=s?l:t[(l||"").trim()]??l,u=i.includes(":")?{property:i,content:c}:{name:i,content:c},d=t.__stx_runtime_head??{};return t.__stx_runtime_head=gn(d,{meta:[u]}),""})}var ut,Cd,on,ii=R(()=>{ut={},Cd=[],on={}}),Di={};K(Di,{stripTypeScript:()=>Td,splitDeclaration:()=>Ld,isModuleResolutionFailure:()=>Rd,isMissingBindingFailure:()=>Id,isCompleteImport:()=>Od,hasVariables:()=>Xv,extractVariables:()=>ln,extractScriptFromTemplate:()=>Qv,convertToCommonJS:()=>jd,STX_ENGINE_BINDING_NAMES:()=>si});function Gv(e){let t=[],r=0,n=e.split(`
2551
+ `);for(let i of n){let s=r,a=null,o=!1;for(let l=0;l<i.length;l++){let c=i[l];if(o){o=!1;continue}if(c==="\\"){o=!0;continue}if(a){if(c===a)a=null;continue}if(c==="'"||c==='"'||c==="`"){a=c;continue}if(c==="/"&&l+1<i.length&&i[l+1]==="/")break;if(c==="{")r++;else if(c==="}")r--}if(s===0){let l=i.match(/(?:const|let|var)\s+(\w+)\s*=/);if(l)t.push(l[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(i)){let c=i.match(/(?:const|let|var)\s+(\w+)/);if(c)t.push(c[1])}else{let c=i.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(c){let u=c[1].slice(1,-1).split(",").map((d)=>{let h=d.split(":");return(h.length>1?h[1]:h[0]).trim()}).filter((d)=>/^\w+$/.test(d));t.push(...u)}}}}return[...new Set(t)]}function Td(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function r(n){if(!n.includes(":"))return n;let i=[],s="",a=0,o=0,l=null;for(let c=0;c<n.length;c++){let u=n[c];if(l){if(s+=u,u===l)l=null;continue}if(u==='"'||u==="'"||u==="`"){l=u,s+=u;continue}if(u==="<")a++;else if(u===">"&&a>0)a--;else if(u==="(")o++;else if(u===")")o--;if(u===","&&a===0&&o===0){i.push(s),s="";continue}s+=u}if(s)i.push(s);return i.map((c)=>{let u=c.trim(),d=u.startsWith("..."),h=d?u.slice(3):u,p=-1,f=0;for(let b=0;b<h.length;b++)if(h[b]==="<")f++;else if(h[b]===">")f--;else if(h[b]===":"&&f===0){p=b;break}if(p===-1)return c;let m=h.substring(0,p).trim().replace(/\?$/,""),y=h.substring(p+1),g=-1,v=0;for(let b=0;b<y.length;b++)if(y[b]==="<")v++;else if(y[b]===">")v--;else if(y[b]==="="&&v===0){g=b;break}let w=d?"...":"";if(g!==-1)return`${w}${m} = ${y.substring(g+1).trim()}`;return`${w}${m}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,i,s)=>{if(!s.includes(":"))return n;return`${i}(${r(s)})`});{let n=/\b(function\s+\w*\s*)\(/g,i,s=[];while((i=n.exec(t))!==null){let a=i.index+i[0].length-1,o=1,l=a+1,c=0,u=null;while(l<t.length&&o>0){let p=t[l];if(u){if(p===u)u=null;l++;continue}if(p==='"'||p==="'"||p==="`"){u=p,l++;continue}if(p==="<")c++;else if(p===">"&&c>0)c--;else if(c===0){if(p==="(")o++;else if(p===")")o--}if(o>0)l++}if(o!==0)continue;let d=t.substring(a+1,l);if(!d.includes(":"))continue;let h=r(d);s.push({start:a+1,end:l,replacement:h})}for(let a=s.length-1;a>=0;a--){let{start:o,end:l,replacement:c}=s[a];t=t.substring(0,o)+c+t.substring(l)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,i)=>{if(!i.includes(":"))return n;if(i.includes("{")||i.includes("}"))return n;return`(${i.split(",").map((s)=>{let[a,...o]=s.split("="),l=a.split(":")[0].trim();if(o.length>0)return`${l} = ${o.join("=").trim()}`;return l}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
2552
+
2553
+ `),t}function Rd(e){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(e)}function Id(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}async function ln(e,t,r,n={}){if(!e.trim())return;let i;try{let L=new Bun.Transpiler({loader:"ts",target:"browser",define:Qt()}),j=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");j=j.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),i=L.transformSync(j)}catch{i=Td(e)}let s={exports:{}},a=s.exports,o=wr.cwd(),l={},c=[...i.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((L)=>L[1]).filter((L)=>!L.startsWith("node:")&&!L.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(L));for(let L of c)try{let j=wt.resolve(o,"node_modules",L),M=wt.join(j,"package.json"),H=JSON.parse(Qn("fs").readFileSync(M,"utf8")),W=H.main||"index.js";if(H.exports){let J=typeof H.exports==="string"?H.exports:H.exports["."];if(typeof J==="string")W=J;else if(J?.bun)W=J.bun;else if(J?.import)W=J.import;else if(J?.default)W=J.default}l[L]=await import(wt.resolve(j,W))}catch{}let u=(L)=>{if(l[L])return l[L];return Qn(L)},d=t.props||{},h=(L)=>{if(!L)return d;let j={};for(let[M,H]of Object.entries(L)){let W=d[M];if(W!==void 0)j[M]=W;else if(typeof H==="function")j[M]=H();else j[M]=H}return j};for(let[L,j]of Object.entries(d))Object.defineProperty(h,L,{value:j,enumerable:!0,configurable:!0,writable:!0});for(let L of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(d,L))continue;try{Object.defineProperty(h,L,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let p=(L)=>{if(!L)return d;let j={...d};for(let[M,H]of Object.entries(L)){let W=H&&typeof H==="object"&&!Array.isArray(H)?H:{type:H};if(j[M]===void 0&&W.default!==void 0)j[M]=typeof W.default==="function"?W.default():W.default}return j},f=()=>t.slots||{},m=(L,j)=>{let M={...L};for(let[H,W]of Object.entries(j))if(M[H]===void 0)if(typeof W==="function")M[H]=W();else M[H]=W;return M},y=(L)=>{let j=()=>L;return j.set=(M)=>{},j.update=(M)=>{},j},g=(L)=>{let j,M=!1;return()=>{if(!M)try{j=L(),M=!0}catch{j=void 0}return j}},v=(L)=>{},w=(L)=>L(),b=(L)=>{},S=(L)=>{};function x(L){let j=L||{};if(j.title!==void 0||j.description!==void 0)T({title:j.title,description:j.description})}function _(L){if(!L||typeof L!=="object")return;let j=t.__stxClientPayload??{};Object.assign(j,L),t.__stxClientPayload=j}let E=()=>{let L=t.__stxServeContext,j=t.__stxServeSearch??L?.search??"",M=L?.path??"",H=Object.fromEntries(new URLSearchParams(j)),W=t.query,J=Object.keys(H).length>0?H:W??{},Be=j||(Object.keys(J).length>0?`?${new URLSearchParams(J).toString()}`:"");return{params:t.params??{},query:J,path:M,name:"",fullPath:M+Be,hash:"",matched:[]}},k=()=>({push:(L)=>{},replace:(L)=>{},back:()=>{},forward:()=>{},go:(L)=>{}}),A=(L)=>{let j=t.__stx_runtime_head||{};t.__stx_runtime_head=gn(j,L||{})},T=(L)=>{A(to(L||{}))},C=(L)=>({value:L}),D=(L)=>L,I=(L)=>({value:typeof L==="function"?L():L}),O=(L,j)=>{},N=(L)=>{},P=(L)=>{},z=(L)=>L?L():Promise.resolve(),q=(L)=>(j,...M)=>{},Z=(L)=>{},Re=(L,j)=>{},oe=(L,j)=>j,ve=()=>({value:"light"}),F=()=>y(!1),V=(L)=>y(!1),we=()=>y(!1),Oe=()=>V("(prefers-color-scheme: dark)"),tr=()=>V("(prefers-color-scheme: light)"),U=()=>V("(prefers-reduced-motion: reduce)"),ie=()=>V("(prefers-contrast: more)"),se={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},ke=new Proxy(se,{get(L,j){if(j in L)return L[j];return},set(L,j,M){return L[j]=M,!0}}),be={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},Ue=console;try{let L=jd(i,r),j=new Set(Object.keys(d)),M=(Y)=>/^[a-z_$][\w$]*$/i.test(Y),H=Object.keys(t).filter((Y)=>!j.has(Y)&&Y!=="props"&&M(Y)),W=H.map((Y)=>t[Y]);if(!H.includes("__stxServeContext"))H.push("__stxServeContext"),W.push(void 0);let J=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),Be=[],st=[];for(let[Y,ae]of Object.entries(d)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(Y))continue;if(J.has(Y))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${Y}\\b`).test(L))continue;Be.push(Y),st.push(ae)}let je=Gv(L).map((Y)=>`module.exports.${Y} = typeof ${Y} !== 'undefined' ? ${Y} : module.exports.${Y};`).join(`
2554
+ `),ze=t.params??{},Fe=[],Ct=[];for(let Y=0;Y<H.length;Y++){if(H[Y]==="params")continue;Fe.push(H[Y]),Ct.push(W[Y])}let ft=await Function(...si,...Be,...Fe,`return (async () => {
2555
+ ${L}
2556
+ ${je}
2557
2557
  return module.exports
2558
- })()`)(s,a,u,d,h,p,m,_,y,g,v,w,b,S,x,E,k,A,T,C,D,I,O,L,N,B,F,K,f,Te,ae,ye,z,G,ve,Ie,er,H,ne,_e,we,He,ie.confirm,ie.alert,ie.fetch,Be,...it,...At);if(n.preserveExisting){for(let[J,se]of Object.entries(pt))if(!(J in t)||t[J]===void 0)t[J]=se}else Object.assign(t,pt);for(let[J,se]of Object.entries(d))if(!(J in t))t[J]=se}catch($){let j=$ instanceof Error?$.message:String($);if(Td(j))console.warn(`[stx] server <script> in ${r??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${j}`);else if(Rd(j))console.warn(`[stx] server <script> in ${r??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${j}`);else if(vr.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${r??"<unknown>"} \u2014 falling back to static extraction. Cause: ${j}`);try{await Kv(i,t,r)}catch(P){if(vr.env.STX_DEBUG){let W=P instanceof Error?P.message:String(P);console.warn(`[stx] fallback extraction also failed in ${r??"<unknown>"}: ${W}`)}}}}function Id(e){let t=0,r=null,n=!1,i=!1;for(let s=0;s<e.length;s++){let a=e[s];if(r){if(a===r){if(r=null,n||t===0)i=!0}continue}if(a==="'"||a==='"'||a==="`"){r=a;continue}if(a==="{")t++;else if(a==="}")t--;else if(e.startsWith("from",s)&&t===0)n=!0}return r===null&&t===0&&i}function Od(e,t){let r=t?vt.dirname(t):vr.cwd(),n=vr.cwd(),i=e.split(`
2558
+ })()`)(s,a,u,d,h,p,m,_,y,g,v,w,b,S,x,E,k,A,T,C,D,I,O,N,P,z,q,Z,f,Re,oe,ve,F,V,we,Oe,tr,U,ie,ke,be,Ue,se.confirm,se.alert,se.fetch,ze,...st,...Ct);if(n.preserveExisting){for(let[Y,ae]of Object.entries(ft))if(!(Y in t)||t[Y]===void 0)t[Y]=ae}else Object.assign(t,ft);for(let[Y,ae]of Object.entries(d))if(!(Y in t))t[Y]=ae}catch(L){let j=L instanceof Error?L.message:String(L);if(Rd(j))console.warn(`[stx] server <script> in ${r??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${j}`);else if(Id(j))console.warn(`[stx] server <script> in ${r??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${j}`);else if(wr.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${r??"<unknown>"} \u2014 falling back to static extraction. Cause: ${j}`);try{await Zv(i,t,r)}catch(M){if(wr.env.STX_DEBUG){let H=M instanceof Error?M.message:String(M);console.warn(`[stx] fallback extraction also failed in ${r??"<unknown>"}: ${H}`)}}}}function Od(e){let t=0,r=null,n=!1,i=!1;for(let s=0;s<e.length;s++){let a=e[s];if(r){if(a===r){if(r=null,n||t===0)i=!0}continue}if(a==="'"||a==='"'||a==="`"){r=a;continue}if(a==="{")t++;else if(a==="}")t--;else if(e.startsWith("from",s)&&t===0)n=!0}return r===null&&t===0&&i}function jd(e,t){let r=t?wt.dirname(t):wr.cwd(),n=wr.cwd(),i=e.split(`
2559
2559
  `),s=[],a=0;while(a<i.length){let o=i[a].trim();if(o.startsWith("interface ")||o.startsWith("export interface ")||o.startsWith("type ")||o.startsWith("export type ")){if(o.includes("{")&&!o.includes("}")){let l=0;for(;a<i.length;a++){for(let c of i[a])if(c==="{")l++;else if(c==="}")l--;if(l<=0)break}}a++;continue}if(o.startsWith("definePageMeta(")){let l=0,c=!1,u=a;for(let p=a;p<i.length&&!c;p++){let f=null,m=!1,y=i[p];for(let g=0;g<y.length;g++){let v=y[g];if(m){m=!1;continue}if(v==="\\"){m=!0;continue}if(f){if(v===f)f=null;continue}if(v==='"'||v==="'"||v==="`"){f=v;continue}if(v==="(")l++;else if(v===")"){if(l--,l===0){a=p+1,c=!0;break}}}}if(!c)a=i.length;let d=i.slice(u,a).join(`
2560
- `),h=[];for(let p of["title","description"]){let f=new RegExp(`\\b${p}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(d);if(f)h.push(`${p}: ${JSON.stringify(f[2])}`)}if(h.length>0)s.push(`useSeoMeta({ ${h.join(", ")} });`);continue}if(o.startsWith("import ")||o==="import"||o.startsWith("import{")){let l=o,c=0;while(!Id(l)&&a+c+1<i.length)c++,l=`${l} ${i[a+c].trim()}`;a+=c;let u=l.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),d=l.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),h=l.match(/^import\s+['"](.+?)['"]/),p=l,f=(m)=>{if(m.startsWith("."))return vt.resolve(r,m);if(m.startsWith("~/")||m.startsWith("@/"))return vt.resolve(n,m.slice(2));return m};if(u){let[,m,y]=u,g=f(y);s.push(`const ${m} = (await import('${g}')).default`),s.push(`module.exports.${m} = ${m};`)}else if(d){let[,m,y]=d,g=f(y),v=[],w=[],b=Pd.has(y);for(let S of m.split(",")){let x=S.trim();if(!x)continue;let _=x.split(/\s+as\s+/);if(_.length===2){let[E,k]=[_[0].trim(),_[1].trim()];if(b&&$s.has(E)){s.push(`const ${k} = ${E};`),w.push(k);continue}v.push(`${E}: ${k}`),w.push(k)}else{if(b&&$s.has(x)){w.push(x);continue}v.push(x),w.push(x)}}if(v.length>0)s.push(`const { ${v.join(", ")} } = await import('${g}')`);for(let S of w)s.push(`module.exports.${S} = ${S};`)}else if(h){let m=f(h[1]);s.push(`await import('${m}')`)}else s.push(p);a++;continue}if(Md.test(o))s.push(i[a]),a++;else if(o.startsWith("export const ")||o.startsWith("export let ")||o.startsWith("export var ")){let l=vl(i,a),{type:c,name:u,value:d}=l;s.push(`${c} ${u} = ${d};`),s.push(`module.exports.${u} = ${u};`),a=l.nextIndex}else if(o.startsWith("export function ")||o.startsWith("export async function ")){let l=Xi(i,a);s.push(l.functionCode),s.push(`module.exports.${l.name} = ${l.name};`),a=l.nextIndex}else if(o.startsWith("const ")||o.startsWith("let ")||o.startsWith("var ")){let l=vl(i,a),{type:c,name:u,value:d}=l;s.push(`${c} ${u} = ${d};`),s.push(`module.exports.${u} = ${u};`),a=l.nextIndex}else if(o.startsWith("function ")||o.startsWith("async function ")){let l=Xi(i,a);s.push(l.functionCode),s.push(`module.exports.${l.name} = ${l.name};`),a=l.nextIndex}else if(o.startsWith("export default function ")||o.startsWith("export default async function ")){let l=i[a].replace(/^(\s*)export\s+default\s+/,"$1"),c=[...i];c[a]=l;let u=Xi(c,a);if(s.push(u.functionCode),u.name)s.push(`module.exports.default = ${u.name};`);a=u.nextIndex}else if(o.startsWith("export default ")){let l=o.replace(/^export\s+default\s+/,"").replace(/;$/,"");s.push(`module.exports.default = ${l};`),a++}else if(o.startsWith("class ")||o.startsWith("export class ")){let l=o.match(/(?:export\s+)?class\s+(\w+)/);if(l){let c=l[1],u=i[a].replace(/^export\s+/,""),d=0,h=a;for(;h<i.length;h++){let p=i[h];for(let f of p)if(f==="{")d++;else if(f==="}")d--;if(h>a)u+=`
2561
- `+p;if(d<=0&&h>=a)break}s.push(u),s.push(`module.exports.${c} = ${c};`),a=h+1}else s.push(o),a++}else if(o.includes("module.exports"))s.push(o),a++;else if(o.trim()&&!o.startsWith("//"))s.push(o),a++;else a++}return Gv(s.join(`
2562
- `),r,n)}function Gv(e,t,r){let n=e.length,i="",s=0,a=null,o=!1,l=!1,c=0;while(s<n){let u=e[s],d=e[s+1];if(o){if(i+=u,u===`
2563
- `)o=!1;s++;continue}if(l){if(i+=u,u==="*"&&d==="/"){i+=d,s+=2,l=!1;continue}s++;continue}if(!a&&u==="/"&&d==="/"){o=!0,i+=u,s++;continue}if(!a&&u==="/"&&d==="*"){l=!0,i+=u,s++;continue}if(a){if(i+=u,u==="\\"){i+=d,s+=2;continue}if(u===a&&a!=="`"){a=null,s++;continue}if(a==="`"){if(u==="$"&&d==="{"){c++,i+=d,s+=2;continue}if(u==="`"){a=null,s++;continue}}s++;continue}if(c>0){if(u==="{")c++;else if(u==="}")c--}if(u==='"'||u==="'"||u==="`"){a=u,i+=u,s++;continue}if(u==="a"&&e.startsWith("await",s)){let h=Vv(e,s);if(h){let{quote:p,path:f,end:m}=h;if(f.startsWith(".")||f.startsWith("~/")||f.startsWith("@/")){let y=f.startsWith(".")?vt.resolve(t,f):vt.resolve(r,f.slice(2));i+=`await import(${p}${y}${p})`,s=m;continue}}}i+=u,s++}return i}function Vv(e,t){let r=t+5;if(r>=e.length)return null;if(!/\s/.test(e[r]))return null;while(r<e.length&&/\s/.test(e[r]))r++;if(!e.startsWith("import",r))return null;r+=6;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!=="(")return null;r++;while(r<e.length&&/\s/.test(e[r]))r++;let n=e[r];if(n!=="'"&&n!=='"')return null;r++;let i=r;while(r<e.length&&e[r]!==n)if(e[r]==="\\")r+=2;else r++;if(r>=e.length)return null;let s=e.slice(i,r);r++;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!==")")return null;return{quote:n,path:s,end:r+1}}function jd(e,t){let r=e[t];if(r!=="{"&&r!=="[")return null;let n=Ke(e,r,r==="{"?"}":"]",t);if(n===-1)return null;return{pattern:e.slice(t,n+1),endPos:n+1}}function Dd(e){let t=[],r=e.slice(1,-1).trim();if(!r)return t;let n=0,i=0,s="";while(n<r.length){let a=r[n];if(a==="{"||a==="["){let o=i===0?jd(r,n):null;if(o){t.push(...Dd(o.pattern)),n=o.endPos,s="";continue}i++}else if(a==="}"||a==="]")i--;if(i>0){n++;continue}if(a===","){if(s.trim())t.push(s.trim());s="",n++;continue}if(a===":"){s="",n++;continue}if(a==="="){if(s.trim())t.push(s.trim());s="",n++;while(n<r.length&&r[n]!==","&&i===0){if(r[n]==="{"||r[n]==="[")i++;else if(r[n]==="}"||r[n]==="]")i--;n++}continue}if(/[\w$]/.test(a))s+=a;n++}if(s.trim())t.push(s.trim());return t}function $d(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let r=t[0].length,n=(i)=>i===" "||i==="\t";while(r<e.length&&n(e[r]))r++;if(e[r]===":"){let i=0,s=null;r++;for(;r<e.length;r++){let a=e[r];if(s){if(a==="\\"){r++;continue}if(a===s)s=null;continue}if(a==="'"||a==='"'||a==="`"){s=a;continue}if(a==="("||a==="["||a==="{"||a==="<"){i++;continue}if(a===")"||a==="]"||a==="}"||a===">"){i--;continue}if(a==="="&&i<=0){let o=e[r+1],l=e[r-1];if(o!=="="&&o!==">"&&l!=="="&&l!=="!"&&l!=="<"&&l!==">")break}}if(e[r]!=="=")return null}while(r<e.length&&n(e[r]))r++;if(e[r]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(r+1).trim()}}function yl(e,t,r,n){let i=null,s=!1;for(let a of e){if(s){s=!1;continue}if(a==="\\"){s=!0;continue}if(i){if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`"){i=a;continue}if(a===t)n++;else if(a===r)n--}return n}function vl(e,t){let r=e[t].trim(),n=$d(r),i=n?[r,n.type,n.name,n.value]:null;if(!i){let u=r.match(/^(?:export\s+)?(const|let|var)\s+/);if(u){let d=r.slice(u[0].length),h=t;if(d.startsWith("{")||d.startsWith("[")){let f=d[0],m=f==="{"?"}":"]",y=yl(d,f,m,0),g=d;for(let v=t+1;v<e.length&&y>0;v++)g+=` ${e[v].trim()}`,h=v,y=yl(e[v],f,m,y);if(y>0)g=d,h=t;d=g}let p=jd(d,0);if(p){let f=u[1],m=p.pattern,y=d.slice(p.endPos).trim();if(y.startsWith("=")){let g=y.slice(1).trim(),v=g,w=Math.max(h,t);if(wl(g)){let _=bl(e,w,g);v=_.value,w=_.nextIndex}else w=w+1;v=v.trim().replace(/;$/,"");let b=Dd(m),S=`__stx_src_${t}`,x=b.map((_)=>`module.exports.${_} = ${_};`).join(`
2560
+ `),h=[];for(let p of["title","description"]){let f=new RegExp(`\\b${p}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(d);if(f)h.push(`${p}: ${JSON.stringify(f[2])}`)}if(h.length>0)s.push(`useSeoMeta({ ${h.join(", ")} });`);continue}if(o.startsWith("import ")||o==="import"||o.startsWith("import{")){let l=o,c=0;while(!Od(l)&&a+c+1<i.length)c++,l=`${l} ${i[a+c].trim()}`;a+=c;let u=l.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),d=l.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),h=l.match(/^import\s+['"](.+?)['"]/),p=l,f=(m)=>{if(m.startsWith("."))return wt.resolve(r,m);if(m.startsWith("~/")||m.startsWith("@/"))return wt.resolve(n,m.slice(2));return m};if(u){let[,m,y]=u,g=f(y);s.push(`const ${m} = (await import('${g}')).default`),s.push(`module.exports.${m} = ${m};`)}else if(d){let[,m,y]=d,g=f(y),v=[],w=[],b=Md.has(y);for(let S of m.split(",")){let x=S.trim();if(!x)continue;let _=x.split(/\s+as\s+/);if(_.length===2){let[E,k]=[_[0].trim(),_[1].trim()];if(b&&Ls.has(E)){s.push(`const ${k} = ${E};`),w.push(k);continue}v.push(`${E}: ${k}`),w.push(k)}else{if(b&&Ls.has(x)){w.push(x);continue}v.push(x),w.push(x)}}if(v.length>0)s.push(`const { ${v.join(", ")} } = await import('${g}')`);for(let S of w)s.push(`module.exports.${S} = ${S};`)}else if(h){let m=f(h[1]);s.push(`await import('${m}')`)}else s.push(p);a++;continue}if(Bd.test(o))s.push(i[a]),a++;else if(o.startsWith("export const ")||o.startsWith("export let ")||o.startsWith("export var ")){let l=wl(i,a),{type:c,name:u,value:d}=l;s.push(`${c} ${u} = ${d};`),s.push(`module.exports.${u} = ${u};`),a=l.nextIndex}else if(o.startsWith("export function ")||o.startsWith("export async function ")){let l=es(i,a);s.push(l.functionCode),s.push(`module.exports.${l.name} = ${l.name};`),a=l.nextIndex}else if(o.startsWith("const ")||o.startsWith("let ")||o.startsWith("var ")){let l=wl(i,a),{type:c,name:u,value:d}=l;s.push(`${c} ${u} = ${d};`),s.push(`module.exports.${u} = ${u};`),a=l.nextIndex}else if(o.startsWith("function ")||o.startsWith("async function ")){let l=es(i,a);s.push(l.functionCode),s.push(`module.exports.${l.name} = ${l.name};`),a=l.nextIndex}else if(o.startsWith("export default function ")||o.startsWith("export default async function ")){let l=i[a].replace(/^(\s*)export\s+default\s+/,"$1"),c=[...i];c[a]=l;let u=es(c,a);if(s.push(u.functionCode),u.name)s.push(`module.exports.default = ${u.name};`);a=u.nextIndex}else if(o.startsWith("export default ")){let l=o.replace(/^export\s+default\s+/,"").replace(/;$/,"");s.push(`module.exports.default = ${l};`),a++}else if(o.startsWith("class ")||o.startsWith("export class ")){let l=o.match(/(?:export\s+)?class\s+(\w+)/);if(l){let c=l[1],u=i[a].replace(/^export\s+/,""),d=0,h=a;for(;h<i.length;h++){let p=i[h];for(let f of p)if(f==="{")d++;else if(f==="}")d--;if(h>a)u+=`
2561
+ `+p;if(d<=0&&h>=a)break}s.push(u),s.push(`module.exports.${c} = ${c};`),a=h+1}else s.push(o),a++}else if(o.includes("module.exports"))s.push(o),a++;else if(o.trim()&&!o.startsWith("//"))s.push(o),a++;else a++}return Vv(s.join(`
2562
+ `),r,n)}function Vv(e,t,r){let n=e.length,i="",s=0,a=null,o=!1,l=!1,c=0;while(s<n){let u=e[s],d=e[s+1];if(o){if(i+=u,u===`
2563
+ `)o=!1;s++;continue}if(l){if(i+=u,u==="*"&&d==="/"){i+=d,s+=2,l=!1;continue}s++;continue}if(!a&&u==="/"&&d==="/"){o=!0,i+=u,s++;continue}if(!a&&u==="/"&&d==="*"){l=!0,i+=u,s++;continue}if(a){if(i+=u,u==="\\"){i+=d,s+=2;continue}if(u===a&&a!=="`"){a=null,s++;continue}if(a==="`"){if(u==="$"&&d==="{"){c++,i+=d,s+=2;continue}if(u==="`"){a=null,s++;continue}}s++;continue}if(c>0){if(u==="{")c++;else if(u==="}")c--}if(u==='"'||u==="'"||u==="`"){a=u,i+=u,s++;continue}if(u==="a"&&e.startsWith("await",s)){let h=Jv(e,s);if(h){let{quote:p,path:f,end:m}=h;if(f.startsWith(".")||f.startsWith("~/")||f.startsWith("@/")){let y=f.startsWith(".")?wt.resolve(t,f):wt.resolve(r,f.slice(2));i+=`await import(${p}${y}${p})`,s=m;continue}}}i+=u,s++}return i}function Jv(e,t){let r=t+5;if(r>=e.length)return null;if(!/\s/.test(e[r]))return null;while(r<e.length&&/\s/.test(e[r]))r++;if(!e.startsWith("import",r))return null;r+=6;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!=="(")return null;r++;while(r<e.length&&/\s/.test(e[r]))r++;let n=e[r];if(n!=="'"&&n!=='"')return null;r++;let i=r;while(r<e.length&&e[r]!==n)if(e[r]==="\\")r+=2;else r++;if(r>=e.length)return null;let s=e.slice(i,r);r++;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!==")")return null;return{quote:n,path:s,end:r+1}}function Dd(e,t){let r=e[t];if(r!=="{"&&r!=="[")return null;let n=Ze(e,r,r==="{"?"}":"]",t);if(n===-1)return null;return{pattern:e.slice(t,n+1),endPos:n+1}}function $d(e){let t=[],r=e.slice(1,-1).trim();if(!r)return t;let n=0,i=0,s="";while(n<r.length){let a=r[n];if(a==="{"||a==="["){let o=i===0?Dd(r,n):null;if(o){t.push(...$d(o.pattern)),n=o.endPos,s="";continue}i++}else if(a==="}"||a==="]")i--;if(i>0){n++;continue}if(a===","){if(s.trim())t.push(s.trim());s="",n++;continue}if(a===":"){s="",n++;continue}if(a==="="){if(s.trim())t.push(s.trim());s="",n++;while(n<r.length&&r[n]!==","&&i===0){if(r[n]==="{"||r[n]==="[")i++;else if(r[n]==="}"||r[n]==="]")i--;n++}continue}if(/[\w$]/.test(a))s+=a;n++}if(s.trim())t.push(s.trim());return t}function Ld(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let r=t[0].length,n=(i)=>i===" "||i==="\t";while(r<e.length&&n(e[r]))r++;if(e[r]===":"){let i=0,s=null;r++;for(;r<e.length;r++){let a=e[r];if(s){if(a==="\\"){r++;continue}if(a===s)s=null;continue}if(a==="'"||a==='"'||a==="`"){s=a;continue}if(a==="("||a==="["||a==="{"||a==="<"){i++;continue}if(a===")"||a==="]"||a==="}"||a===">"){i--;continue}if(a==="="&&i<=0){let o=e[r+1],l=e[r-1];if(o!=="="&&o!==">"&&l!=="="&&l!=="!"&&l!=="<"&&l!==">")break}}if(e[r]!=="=")return null}while(r<e.length&&n(e[r]))r++;if(e[r]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(r+1).trim()}}function vl(e,t,r,n){let i=null,s=!1;for(let a of e){if(s){s=!1;continue}if(a==="\\"){s=!0;continue}if(i){if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`"){i=a;continue}if(a===t)n++;else if(a===r)n--}return n}function wl(e,t){let r=e[t].trim(),n=Ld(r),i=n?[r,n.type,n.name,n.value]:null;if(!i){let u=r.match(/^(?:export\s+)?(const|let|var)\s+/);if(u){let d=r.slice(u[0].length),h=t;if(d.startsWith("{")||d.startsWith("[")){let f=d[0],m=f==="{"?"}":"]",y=vl(d,f,m,0),g=d;for(let v=t+1;v<e.length&&y>0;v++)g+=` ${e[v].trim()}`,h=v,y=vl(e[v],f,m,y);if(y>0)g=d,h=t;d=g}let p=Dd(d,0);if(p){let f=u[1],m=p.pattern,y=d.slice(p.endPos).trim();if(y.startsWith("=")){let g=y.slice(1).trim(),v=g,w=Math.max(h,t);if(bl(g)){let _=xl(e,w,g);v=_.value,w=_.nextIndex}else w=w+1;v=v.trim().replace(/;$/,"");let b=$d(m),S=`__stx_src_${t}`,x=b.map((_)=>`module.exports.${_} = ${_};`).join(`
2564
2564
  `);return{type:f,name:S,value:`${v}; ${f} ${m} = ${S};
2565
- ${x}`,nextIndex:w}}}}throw Error(`Failed to parse variable declaration: ${r}`)}let[,s,a,o]=i,l=o,c=t;if(wl(o)){let u=bl(e,t,o);l=u.value,c=u.nextIndex}else c=t+1;while(c<e.length){let u=e[c].trim();if(u.startsWith(".")||u.startsWith("?."))l+=`
2566
- ${e[c]}`,c++;else break}return l=l.trim().replace(/;$/,""),{type:s,name:a,value:l,nextIndex:c}}function Xi(e,t){let r=e[t].trim(),n=r.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${r}`);let[,i]=n,s=r.replace(/^export\s+/,""),a=t;if(Jv(r)){let o=Yv(e,t,s);s=o.functionCode,a=o.nextIndex}else a=t+1;return{name:i,functionCode:s,nextIndex:a}}function wl(e){let t=e.trim();if(t.startsWith("{"))return Ke(t,"{","}",0)===-1;if(t.startsWith("["))return Ke(t,"[","]",0)===-1;return!Ld(t)}function Ld(e){let t={paren:0,bracket:0,brace:0},r=null,n=0;for(let i=0;i<e.length;i++){let s=e[i];if((i>0?e[i-1]:"")==="\\"&&r)continue;if((s==='"'||s==="'")&&!r){r=s;continue}if(s===r&&r!=="`"){r=null;continue}if(s==="`"&&!r){r="`";continue}if(s==="`"&&r==="`"&&n===0){r=null;continue}if(r==="`"&&s==="$"&&e[i+1]==="{"){n++,i++;continue}if(n>0&&s==="{"){n++;continue}if(n>0&&s==="}"){n--;continue}if(r)continue;if(s==="(")t.paren++;else if(s===")")t.paren--;else if(s==="[")t.bracket++;else if(s==="]")t.bracket--;else if(s==="{")t.brace++;else if(s==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&r===null}function Nd(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let r=Ke(e,"(",")",t);if(r===-1)return-1;return e.indexOf("{",r)}function Jv(e){let t=Nd(e);if(t===-1)return!0;return Ke(e,"{","}",t)===-1}function bl(e,t,r){let n=r,i=t+1;while(i<e.length&&!Ld(n)){let s=e[i];n+=`
2565
+ ${x}`,nextIndex:w}}}}throw Error(`Failed to parse variable declaration: ${r}`)}let[,s,a,o]=i,l=o,c=t;if(bl(o)){let u=xl(e,t,o);l=u.value,c=u.nextIndex}else c=t+1;while(c<e.length){let u=e[c].trim();if(u.startsWith(".")||u.startsWith("?."))l+=`
2566
+ ${e[c]}`,c++;else break}return l=l.trim().replace(/;$/,""),{type:s,name:a,value:l,nextIndex:c}}function es(e,t){let r=e[t].trim(),n=r.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${r}`);let[,i]=n,s=r.replace(/^export\s+/,""),a=t;if(Yv(r)){let o=Kv(e,t,s);s=o.functionCode,a=o.nextIndex}else a=t+1;return{name:i,functionCode:s,nextIndex:a}}function bl(e){let t=e.trim();if(t.startsWith("{"))return Ze(t,"{","}",0)===-1;if(t.startsWith("["))return Ze(t,"[","]",0)===-1;return!Nd(t)}function Nd(e){let t={paren:0,bracket:0,brace:0},r=null,n=0;for(let i=0;i<e.length;i++){let s=e[i];if((i>0?e[i-1]:"")==="\\"&&r)continue;if((s==='"'||s==="'")&&!r){r=s;continue}if(s===r&&r!=="`"){r=null;continue}if(s==="`"&&!r){r="`";continue}if(s==="`"&&r==="`"&&n===0){r=null;continue}if(r==="`"&&s==="$"&&e[i+1]==="{"){n++,i++;continue}if(n>0&&s==="{"){n++;continue}if(n>0&&s==="}"){n--;continue}if(r)continue;if(s==="(")t.paren++;else if(s===")")t.paren--;else if(s==="[")t.bracket++;else if(s==="]")t.bracket--;else if(s==="{")t.brace++;else if(s==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&r===null}function Pd(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let r=Ze(e,"(",")",t);if(r===-1)return-1;return e.indexOf("{",r)}function Yv(e){let t=Pd(e);if(t===-1)return!0;return Ze(e,"{","}",t)===-1}function xl(e,t,r){let n=r,i=t+1;while(i<e.length&&!Nd(n)){let s=e[i];n+=`
2567
2567
  ${s}`,i++}while(i<e.length){let s=e[i].trim();if(s.startsWith(".")||s.startsWith("?."))n+=`
2568
- ${e[i]}`,i++;else break}return{value:n,nextIndex:i}}function Yv(e,t,r){let n=r,i=t+1;while(i<e.length){let s=Nd(n);if(s!==-1){if(Ke(n,"{","}",s)!==-1)break}let a=e[i];n+=`
2569
- ${a}`,i++}return{functionCode:n,nextIndex:i}}function xl(e,t){let r=pe(e,t)??pe(`(${e})`,t);if(r!==void 0)return r;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...vr.env}})};try{return Function(...Object.keys(n),`'use strict'; return (${e});`)(...Object.values(n))}catch{try{return Function(...Object.keys(n),`'use strict'; return ${e};`)(...Object.values(n))}catch{return}}}async function Kv(e,t,r){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let s of n){let[,,a,o]=s;try{let l=o.trim().replace(/;$/,""),c=xl(l,t);if(c!==void 0)t[a]=c}catch(l){console.warn(`Failed to parse export ${a} in fallback:`,l)}}let i=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let s of i){let[,,a,o]=s;if(!(a in t))try{let l=o.trim().replace(/;$/,""),c=xl(l,t);if(c!==void 0)t[a]=c}catch{}}}function Zv(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),r=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:r,templateWithoutScript:n}}function Qv(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}var ii,$s,Pd,Md,Di=R(()=>{ni(),Qt(),Se(),ii=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],$s=new Set(ii),Pd=new Set(["stx","@stacksjs/stx"]),Md=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/}),Ls={};Y(Ls,{renderSlot:()=>zd,processSlots:()=>qd,parseSlots:()=>Bd,parseSlotElement:()=>rw,extractSlotContent:()=>sw,applySlots:()=>aw});function Xv(e,t){let r=1,n=t,i="<template",s="</template";while(n<e.length&&r>0){let a=e.indexOf("<",n);if(a===-1)break;if(n=a,e.startsWith(i,n)&&(n+i.length>=e.length||/[\s>\/]/.test(e[n+i.length]))){r++,n+=i.length;continue}if(e.startsWith(s,n)){let o=e.indexOf(">",n+s.length);if(o!==-1){if(r--,r===0)return o+1;n=o+1;continue}}n++}return r===0?n:-1}function ew(e,t){let r=null;for(let n=t;n<e.length;n++){let i=e[n];if(r){if(i==="\\"){n++;continue}if(i===r)r=null;continue}if(i==='"'||i==="'"){r=i;continue}if(i===">")return n+1}return-1}function tw(e){let t=[],r=[],n=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,i=0;while(i<e.length){let s=e.indexOf("<",i);if(s===-1)break;if(e.startsWith("<!--",s)){let d=e.indexOf("-->",s+4);i=d===-1?e.length:d+3;continue}let a=ew(e,s+1);if(a===-1)break;let o=e.slice(s,a),l=o.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!l){i=a;continue}let c=l[1]==="/",u=l[2].toLowerCase();if(c){let d=r.lastIndexOf(u);if(d!==-1)r.splice(d);i=a;continue}if(u==="template"&&r.length===0){let d=o.match(n);if(d){let h=Xv(e,a);if(h!==-1){let p=d[1]||d[2]||d[3];t.push({start:s,end:h,slotName:p,content:e.slice(a,h-11).trim(),propsBinding:d[4]||void 0}),i=h;continue}}}if(!/\/\s*>$/.test(o)&&!Wd.has(u)){if(r.push(u),u==="script"||u==="style"){let d=e.toLowerCase().indexOf(`</${u}>`,a);if(d!==-1){i=d;continue}}}i=a}return t}function Bd(e){let t={default:"",named:new Map},r=e,n=tw(e);for(let l of n)t.named.set(l.slotName,{name:l.slotName,content:l.content,propsBinding:l.propsBinding});n.sort((l,c)=>c.start-l.start);for(let l of n)r=r.slice(0,l.start)+r.slice(l.end);let i=[],s=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,a;while((a=s.exec(r))!==null){let[l,c,u,d,h,p]=a,f=u.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),m=h.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),y=(f+m).trim(),g=`<${c}${y?" "+y:""}>${p}</${c}>`;i.push({start:a.index,end:a.index+l.length,slotName:d,element:g})}let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((a=o.exec(r))!==null){let[l,c,u,d,h]=a,p=u.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),f=h.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),m=(p+f).trim(),y=`<${c}${m?" "+m:""} />`;i.push({start:a.index,end:a.index+l.length,slotName:d,element:y})}i.sort((l,c)=>c.start-l.start);for(let l of i){let c=t.named.get(l.slotName);if(c)c.content+=l.element;else t.named.set(l.slotName,{name:l.slotName,content:l.element});r=r.slice(0,l.start)+r.slice(l.end)}return t.default=r.trim(),t}function rw(e){let t=e.match(/name\s*=\s*["']([^"']+)["']/),r=t?t[1]:"",n={},i=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,s;while((s=i.exec(e))!==null)n[s[1]]=s[2];let a=e.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),o=a?a[1].trim():"";return{name:r,props:n,defaultContent:o}}async function zd(e,t,r,n){if(!e)return r;let i=e.content;if(e.propsBinding&&Object.keys(t).length>0){let s=e.propsBinding.trim(),a={...n};if(s.startsWith("{")&&s.endsWith("}")){let o=s.slice(1,-1).split(",").map((l)=>l.trim()).filter(Boolean);for(let l of o){let[c,u]=l.split(":").map((h)=>h.trim()),d=u||c;if(t[c]!==void 0)a[d]=t[c]}}else a[s]=t;i=nw(i,a)}return i}function nw(e,t){return e.replace(/\{\{\s*([^}]+)\s*\}\}/g,(r,n)=>{try{let i=n.trim(),s=Fd(i,t);return _t(String(s??""))}catch{return`{{ ${n} }}`}})}function Fd(e,t){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(e)){let n=e.split("."),i=t;for(let s of n)if(i&&typeof i==="object"&&s in i)i=i[s];else return;return i}let r=e.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(r){let[,n,i,s]=r,a=t[n],o=parseInt(s,10);if(typeof a==="number")switch(i){case"+":return a+o;case"-":return a-o;case"*":return a*o;case"/":return a/o}}try{if(!xe(e))return;return ge(e,Object.keys(t))(...Object.values(t))}catch{return}}async function qd(e,t,r){let n=e;n=await iw(n,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,o,l)=>{let c=t.named.get(a),u=l?.trim()||"",d=o||"",h={},p=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,f;while((f=p.exec(d))!==null){let m=f[1],y=f[2];h[m]=Fd(y,r)}return await zd(c,h,u,r)});let i=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return n=n.replace(i,(s,a)=>{if(s.includes("name="))return s;let o=a?.trim()||"";return t.default||o}),n}async function iw(e,t,r){let n=[],i=[];e.replace(t,(o,...l)=>{let c=l[l.length-2];return i.push({match:o,index:c}),n.push(r(o,...l.slice(0,-2))),o});let s=await Promise.all(n),a=e;for(let o=i.length-1;o>=0;o--){let{match:l,index:c}=i[o];a=a.slice(0,c)+s[o]+a.slice(c+l.length)}return a}function sw(e){let t=Bd(e);return{defaultSlot:t.default,namedSlots:t.named}}async function aw(e,t,r,n){return await qd(e,{default:t,named:r},n)}var Wd,Sl=R(()=>{ut(),Se(),Wd=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function Rr(e,t){let r=ow(e,t);return r.ok?{expression:r.expression,endPos:r.endPos}:null}function ow(e,t){let r=t;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!=="(")return{ok:!1,reason:"missing-open-paren",pos:r};let n=Ke(e,"(",")",r);if(n===-1)return{ok:!1,reason:"unclosed-paren",pos:r};return{ok:!0,expression:e.slice(r+1,n),endPos:n+1}}function lw(e,t){let r=e.lastIndexOf("<",t);if(r===-1)return!1;return r>e.lastIndexOf(">",t)}function gn(e,t,r,n){let i=1,s=n,a=new RegExp(`@${t}\\s*\\(`,"g"),o=new RegExp(`@${r}(?![a-z])`,"g");while(s<e.length&&i>0){a.lastIndex=s,o.lastIndex=s;let l=a.exec(e),c=o.exec(e),u=l?l.index:1/0,d=c?c.index:1/0;if(u<d)i++,s=u+l[0].length;else if(d<1/0){if(i--,i===0)return d;s=d+c[0].length}else break}return-1}function cw(e,t){let r=e.slice(t).match(/^@if\s*/);if(!r)return null;let n=t+r[0].length,i=Rr(e,n);if(!i)return null;let s=i.endPos,a=gn(e,"if","endif",s);if(a===-1)return null;let o=e.slice(s,a),l=[],c=0,u="if",d=i.expression,h=0,p=0;while(c<o.length){let f=o.indexOf("@",c);if(f===-1)break;c=f;let m=o.substring(f);if(lw(o,f)){c++;continue}if(/^@if\s*\(/.test(m)){p++,c++;continue}if(/^@endif(?![a-z])/.test(m)){p--,c+=6;continue}if(p===0){let y=m.match(/^@elseif\s*/);if(y){l.push({type:u,condition:d,content:o.substring(h,c),start:s+h,end:s+c});let g=c+y[0].length,v=Rr(o,g);if(!v){c++;continue}u="elseif",d=v.expression,c=v.endPos,h=c;continue}else if(/^@else(?![a-z])/.test(m)){l.push({type:u,condition:d,content:o.substring(h,c),start:s+h,end:s+c}),u="else",d=void 0,c+=5,h=c;continue}}c++}return l.push({type:u,condition:d,content:o.slice(h),start:s+h,end:s+o.length}),{fullMatch:e.slice(t,a+6),branches:l,start:t,end:a+6}}function Hd(e){let t=[],r=/@if\s*\(/g,n=r.exec(e);while(n!==null){if(t.some((s)=>n.index>s.start&&n.index<s.end)){n=r.exec(e);continue}let i=cw(e,n.index);if(i)t.push(i),r.lastIndex=i.end;n=r.exec(e)}return t}function Ud(e,t,r){let n=[],i=new RegExp(`@${t}\\s*\\(`,"g"),s=i.exec(e);while(s!==null){if(n.some((f)=>s.index>f.start&&s.index<f.end)){s=i.exec(e);continue}let a=s.index,o=a+s[0].length-1,l=Ke(e,"(",")",o);if(l===-1){s=i.exec(e);continue}let c=e.slice(o+1,l),u=l+1,d=gn(e,t,r,u);if(d===-1){s=i.exec(e);continue}let h=e.slice(u,d),p=d+`@${r}`.length;n.push({fullMatch:e.slice(a,p),name:t,params:c,content:h,start:a,end:p}),i.lastIndex=p,s=i.exec(e)}return n}function uw(e,t){let r=e.slice(t).match(/^@switch\s*/);if(!r)return null;let n=t+r[0].length,i=Rr(e,n);if(!i)return null;let s=i.endPos,a=gn(e,"switch","endswitch",s);if(a===-1)return null;let o=e.slice(s,a),l=[],c=0,u=null,d=0;while(c<o.length){let h=o.slice(c),p=h.match(/^@switch\s*\(/),f=h.match(/^@endswitch(?![a-z])/);if(p){if(d++,u)u.content+=p[0];c+=p[0].length;continue}if(f){if(d--,u)u.content+=f[0];c+=f[0].length;continue}if(d>0){if(u)u.content+=o[c];c++;continue}let m=h.match(/^@case\s*/),y=h.match(/^@default(?![a-z])/),g=h.match(/^@break(?![a-z])/);if(m&&h.startsWith("@case")){if(u)l.push(u);let v=c+m[0].length,w=Rr(o,v);if(!w){c++;continue}u={type:"case",value:w.expression,content:""},c=w.endPos}else if(y&&h.startsWith("@default")){if(u)l.push(u);u={type:"default",content:""},c+=y[0].length}else if(g&&h.startsWith("@break"))c+=g[0].length;else{if(u)u.content+=o[c];c++}}if(u)l.push(u);return{fullMatch:e.slice(t,a+10),expression:i.expression,cases:l,start:t,end:a+10}}var dw=()=>{},pw=()=>{},to=R(()=>{dw(),pw()});async function fw(e){let t=e;if(!t)try{t=(await Xt())?.pagesDir||"pages"}catch{t="pages"}let r=t,n=Ns.get(r);if(n)return n;let i=[];try{i=Aa(".",{pagesDir:r}).map((s)=>s.regex.source).filter(Boolean)}catch{i=[]}return Ns.set(r,i),i}var Ns,hw=R(()=>{lu(),Et(),Ns=new Map});function mw(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gw(e){return mw(JSON.stringify(e))}function ro(e){let t=0,r,n=Dn.map(()=>{return});while(t<e.length){if(r===void 0||r!==null&&r.index<t)Ps.lastIndex=t,r=Ps.exec(e);if(!r)return null;let i=r.index,s=-1,a=null;for(let l=0;l<Dn.length;l++){let c=Dn[l],u=n[l];if(u===void 0||u!==null&&u.index<t)c.open.lastIndex=t,u=c.open.exec(e),n[l]=u;if(!u)continue;if(u.index<i&&(s===-1||u.index<s))s=u.index,a=c.close}if(s===-1||!a)return{index:i,tag:r[0],attrs:r[1]??""};a.lastIndex=s;let o=a.exec(e);if(!o)return null;t=o.index+o[0].length}return null}function Gd(e,t){let r=ro(e);if(!r)return e;return e.slice(0,r.index)+t(r.tag,r.attrs)+e.slice(r.index+r.tag.length)}var Dn,Ps,Vd=R(()=>{Dn=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Ps=/<body\b([^>]*)>/gi});function yw(){return`
2568
+ ${e[i]}`,i++;else break}return{value:n,nextIndex:i}}function Kv(e,t,r){let n=r,i=t+1;while(i<e.length){let s=Pd(n);if(s!==-1){if(Ze(n,"{","}",s)!==-1)break}let a=e[i];n+=`
2569
+ ${a}`,i++}return{functionCode:n,nextIndex:i}}function Sl(e,t){let r=fe(e,t)??fe(`(${e})`,t);if(r!==void 0)return r;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...wr.env}})};try{return Function(...Object.keys(n),`'use strict'; return (${e});`)(...Object.values(n))}catch{try{return Function(...Object.keys(n),`'use strict'; return ${e};`)(...Object.values(n))}catch{return}}}async function Zv(e,t,r){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let s of n){let[,,a,o]=s;try{let l=o.trim().replace(/;$/,""),c=Sl(l,t);if(c!==void 0)t[a]=c}catch(l){console.warn(`Failed to parse export ${a} in fallback:`,l)}}let i=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let s of i){let[,,a,o]=s;if(!(a in t))try{let l=o.trim().replace(/;$/,""),c=Sl(l,t);if(c!==void 0)t[a]=c}catch{}}}function Qv(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),r=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:r,templateWithoutScript:n}}function Xv(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}var si,Ls,Md,Bd,$i=R(()=>{ii(),Xt(),_e(),si=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],Ls=new Set(si),Md=new Set(["stx","@stacksjs/stx"]),Bd=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/}),Ns={};K(Ns,{renderSlot:()=>Fd,processSlots:()=>Wd,parseSlots:()=>zd,parseSlotElement:()=>nw,extractSlotContent:()=>aw,applySlots:()=>ow});function ew(e,t){let r=1,n=t,i="<template",s="</template";while(n<e.length&&r>0){let a=e.indexOf("<",n);if(a===-1)break;if(n=a,e.startsWith(i,n)&&(n+i.length>=e.length||/[\s>\/]/.test(e[n+i.length]))){r++,n+=i.length;continue}if(e.startsWith(s,n)){let o=e.indexOf(">",n+s.length);if(o!==-1){if(r--,r===0)return o+1;n=o+1;continue}}n++}return r===0?n:-1}function tw(e,t){let r=null;for(let n=t;n<e.length;n++){let i=e[n];if(r){if(i==="\\"){n++;continue}if(i===r)r=null;continue}if(i==='"'||i==="'"){r=i;continue}if(i===">")return n+1}return-1}function rw(e){let t=[],r=[],n=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,i=0;while(i<e.length){let s=e.indexOf("<",i);if(s===-1)break;if(e.startsWith("<!--",s)){let d=e.indexOf("-->",s+4);i=d===-1?e.length:d+3;continue}let a=tw(e,s+1);if(a===-1)break;let o=e.slice(s,a),l=o.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!l){i=a;continue}let c=l[1]==="/",u=l[2].toLowerCase();if(c){let d=r.lastIndexOf(u);if(d!==-1)r.splice(d);i=a;continue}if(u==="template"&&r.length===0){let d=o.match(n);if(d){let h=ew(e,a);if(h!==-1){let p=d[1]||d[2]||d[3];t.push({start:s,end:h,slotName:p,content:e.slice(a,h-11).trim(),propsBinding:d[4]||void 0}),i=h;continue}}}if(!/\/\s*>$/.test(o)&&!Hd.has(u)){if(r.push(u),u==="script"||u==="style"){let d=e.toLowerCase().indexOf(`</${u}>`,a);if(d!==-1){i=d;continue}}}i=a}return t}function zd(e){let t={default:"",named:new Map},r=e,n=rw(e);for(let l of n)t.named.set(l.slotName,{name:l.slotName,content:l.content,propsBinding:l.propsBinding});n.sort((l,c)=>c.start-l.start);for(let l of n)r=r.slice(0,l.start)+r.slice(l.end);let i=[],s=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,a;while((a=s.exec(r))!==null){let[l,c,u,d,h,p]=a,f=u.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),m=h.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),y=(f+m).trim(),g=`<${c}${y?" "+y:""}>${p}</${c}>`;i.push({start:a.index,end:a.index+l.length,slotName:d,element:g})}let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((a=o.exec(r))!==null){let[l,c,u,d,h]=a,p=u.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),f=h.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),m=(p+f).trim(),y=`<${c}${m?" "+m:""} />`;i.push({start:a.index,end:a.index+l.length,slotName:d,element:y})}i.sort((l,c)=>c.start-l.start);for(let l of i){let c=t.named.get(l.slotName);if(c)c.content+=l.element;else t.named.set(l.slotName,{name:l.slotName,content:l.element});r=r.slice(0,l.start)+r.slice(l.end)}return t.default=r.trim(),t}function nw(e){let t=e.match(/name\s*=\s*["']([^"']+)["']/),r=t?t[1]:"",n={},i=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,s;while((s=i.exec(e))!==null)n[s[1]]=s[2];let a=e.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),o=a?a[1].trim():"";return{name:r,props:n,defaultContent:o}}async function Fd(e,t,r,n){if(!e)return r;let i=e.content;if(e.propsBinding&&Object.keys(t).length>0){let s=e.propsBinding.trim(),a={...n};if(s.startsWith("{")&&s.endsWith("}")){let o=s.slice(1,-1).split(",").map((l)=>l.trim()).filter(Boolean);for(let l of o){let[c,u]=l.split(":").map((h)=>h.trim()),d=u||c;if(t[c]!==void 0)a[d]=t[c]}}else a[s]=t;i=iw(i,a)}return i}function iw(e,t){return e.replace(/\{\{\s*([^}]+)\s*\}\}/g,(r,n)=>{try{let i=n.trim(),s=qd(i,t);return kt(String(s??""))}catch{return`{{ ${n} }}`}})}function qd(e,t){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(e)){let n=e.split("."),i=t;for(let s of n)if(i&&typeof i==="object"&&s in i)i=i[s];else return;return i}let r=e.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(r){let[,n,i,s]=r,a=t[n],o=parseInt(s,10);if(typeof a==="number")switch(i){case"+":return a+o;case"-":return a-o;case"*":return a*o;case"/":return a/o}}try{if(!Se(e))return;return ye(e,Object.keys(t))(...Object.values(t))}catch{return}}async function Wd(e,t,r){let n=e;n=await sw(n,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,o,l)=>{let c=t.named.get(a),u=l?.trim()||"",d=o||"",h={},p=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,f;while((f=p.exec(d))!==null){let m=f[1],y=f[2];h[m]=qd(y,r)}return await Fd(c,h,u,r)});let i=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return n=n.replace(i,(s,a)=>{if(s.includes("name="))return s;let o=a?.trim()||"";return t.default||o}),n}async function sw(e,t,r){let n=[],i=[];e.replace(t,(o,...l)=>{let c=l[l.length-2];return i.push({match:o,index:c}),n.push(r(o,...l.slice(0,-2))),o});let s=await Promise.all(n),a=e;for(let o=i.length-1;o>=0;o--){let{match:l,index:c}=i[o];a=a.slice(0,c)+s[o]+a.slice(c+l.length)}return a}function aw(e){let t=zd(e);return{defaultSlot:t.default,namedSlots:t.named}}async function ow(e,t,r,n){return await Wd(e,{default:t,named:r},n)}var Hd,_l=R(()=>{dt(),_e(),Hd=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function Ir(e,t){let r=lw(e,t);return r.ok?{expression:r.expression,endPos:r.endPos}:null}function lw(e,t){let r=t;while(r<e.length&&/\s/.test(e[r]))r++;if(e[r]!=="(")return{ok:!1,reason:"missing-open-paren",pos:r};let n=Ze(e,"(",")",r);if(n===-1)return{ok:!1,reason:"unclosed-paren",pos:r};return{ok:!0,expression:e.slice(r+1,n),endPos:n+1}}function cw(e,t){let r=e.lastIndexOf("<",t);if(r===-1)return!1;return r>e.lastIndexOf(">",t)}function yn(e,t,r,n){let i=1,s=n,a=new RegExp(`@${t}\\s*\\(`,"g"),o=new RegExp(`@${r}(?![a-z])`,"g");while(s<e.length&&i>0){a.lastIndex=s,o.lastIndex=s;let l=a.exec(e),c=o.exec(e),u=l?l.index:1/0,d=c?c.index:1/0;if(u<d)i++,s=u+l[0].length;else if(d<1/0){if(i--,i===0)return d;s=d+c[0].length}else break}return-1}function uw(e,t){let r=e.slice(t).match(/^@if\s*/);if(!r)return null;let n=t+r[0].length,i=Ir(e,n);if(!i)return null;let s=i.endPos,a=yn(e,"if","endif",s);if(a===-1)return null;let o=e.slice(s,a),l=[],c=0,u="if",d=i.expression,h=0,p=0;while(c<o.length){let f=o.indexOf("@",c);if(f===-1)break;c=f;let m=o.substring(f);if(cw(o,f)){c++;continue}if(/^@if\s*\(/.test(m)){p++,c++;continue}if(/^@endif(?![a-z])/.test(m)){p--,c+=6;continue}if(p===0){let y=m.match(/^@elseif\s*/);if(y){l.push({type:u,condition:d,content:o.substring(h,c),start:s+h,end:s+c});let g=c+y[0].length,v=Ir(o,g);if(!v){c++;continue}u="elseif",d=v.expression,c=v.endPos,h=c;continue}else if(/^@else(?![a-z])/.test(m)){l.push({type:u,condition:d,content:o.substring(h,c),start:s+h,end:s+c}),u="else",d=void 0,c+=5,h=c;continue}}c++}return l.push({type:u,condition:d,content:o.slice(h),start:s+h,end:s+o.length}),{fullMatch:e.slice(t,a+6),branches:l,start:t,end:a+6}}function Ud(e){let t=[],r=/@if\s*\(/g,n=r.exec(e);while(n!==null){if(t.some((s)=>n.index>s.start&&n.index<s.end)){n=r.exec(e);continue}let i=uw(e,n.index);if(i)t.push(i),r.lastIndex=i.end;n=r.exec(e)}return t}function Gd(e,t,r){let n=[],i=new RegExp(`@${t}\\s*\\(`,"g"),s=i.exec(e);while(s!==null){if(n.some((f)=>s.index>f.start&&s.index<f.end)){s=i.exec(e);continue}let a=s.index,o=a+s[0].length-1,l=Ze(e,"(",")",o);if(l===-1){s=i.exec(e);continue}let c=e.slice(o+1,l),u=l+1,d=yn(e,t,r,u);if(d===-1){s=i.exec(e);continue}let h=e.slice(u,d),p=d+`@${r}`.length;n.push({fullMatch:e.slice(a,p),name:t,params:c,content:h,start:a,end:p}),i.lastIndex=p,s=i.exec(e)}return n}function dw(e,t){let r=e.slice(t).match(/^@switch\s*/);if(!r)return null;let n=t+r[0].length,i=Ir(e,n);if(!i)return null;let s=i.endPos,a=yn(e,"switch","endswitch",s);if(a===-1)return null;let o=e.slice(s,a),l=[],c=0,u=null,d=0;while(c<o.length){let h=o.slice(c),p=h.match(/^@switch\s*\(/),f=h.match(/^@endswitch(?![a-z])/);if(p){if(d++,u)u.content+=p[0];c+=p[0].length;continue}if(f){if(d--,u)u.content+=f[0];c+=f[0].length;continue}if(d>0){if(u)u.content+=o[c];c++;continue}let m=h.match(/^@case\s*/),y=h.match(/^@default(?![a-z])/),g=h.match(/^@break(?![a-z])/);if(m&&h.startsWith("@case")){if(u)l.push(u);let v=c+m[0].length,w=Ir(o,v);if(!w){c++;continue}u={type:"case",value:w.expression,content:""},c=w.endPos}else if(y&&h.startsWith("@default")){if(u)l.push(u);u={type:"default",content:""},c+=y[0].length}else if(g&&h.startsWith("@break"))c+=g[0].length;else{if(u)u.content+=o[c];c++}}if(u)l.push(u);return{fullMatch:e.slice(t,a+10),expression:i.expression,cases:l,start:t,end:a+10}}var pw=()=>{},fw=()=>{},ro=R(()=>{pw(),fw()});async function hw(e){let t=e;if(!t)try{t=(await er())?.pagesDir||"pages"}catch{t="pages"}let r=t,n=Ps.get(r);if(n)return n;let i=[];try{i=Ca(".",{pagesDir:r}).map((s)=>s.regex.source).filter(Boolean)}catch{i=[]}return Ps.set(r,i),i}var Ps,mw=R(()=>{cu(),At(),Ps=new Map});function gw(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function yw(e){return gw(JSON.stringify(e))}function no(e){let t=0,r,n=$n.map(()=>{return});while(t<e.length){if(r===void 0||r!==null&&r.index<t)Ms.lastIndex=t,r=Ms.exec(e);if(!r)return null;let i=r.index,s=-1,a=null;for(let l=0;l<$n.length;l++){let c=$n[l],u=n[l];if(u===void 0||u!==null&&u.index<t)c.open.lastIndex=t,u=c.open.exec(e),n[l]=u;if(!u)continue;if(u.index<i&&(s===-1||u.index<s))s=u.index,a=c.close}if(s===-1||!a)return{index:i,tag:r[0],attrs:r[1]??""};a.lastIndex=s;let o=a.exec(e);if(!o)return null;t=o.index+o[0].length}return null}function Vd(e,t){let r=no(e);if(!r)return e;return e.slice(0,r.index)+t(r.tag,r.attrs)+e.slice(r.index+r.tag.length)}var $n,Ms,Jd=R(()=>{$n=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],Ms=/<body\b([^>]*)>/gi});function vw(){return`
2570
2570
  (function(){
2571
2571
  var tip=null,hideTimer=null,currentEl=null;
2572
2572
 
@@ -2669,7 +2669,7 @@ document.addEventListener("focusout",function(e){
2669
2669
  if(el) hideTip();
2670
2670
  });
2671
2671
  })();
2672
- `}function Jd(){return zt}function Yd(e){let t=zt;return no.push(e),zt=e,t}function Kd(e){no.pop(),zt=e}function Zd(){return $n>0}function Qd(e){si.add(e)}function vw(e){$n++;try{e()}finally{if($n--,$n===0){let t=[...si];si.clear();for(let r of t)r()}}}function ww(e){let t=zt;zt=null;try{return e()}finally{zt=t}}var zt=null,no,$n=0,si,bw=R(()=>{no=[],si=new Set});function Ir(e){let t=e,r=new Set,n=new Set,i=()=>{let s=Jd();if(s)n.add(s);return t};return i.set=(s)=>{if(!Object.is(s,t)){let a=t;if(t=s,r.forEach((o)=>o(t,a)),Zd())n.forEach((o)=>Qd(o));else n.forEach((o)=>o())}},i.update=(s)=>{i.set(s(t))},i.subscribe=(s)=>{return r.add(s),()=>r.delete(s)},Object.defineProperty(i,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(i,"value",{get:()=>i(),set:(s)=>i.set(s),configurable:!0}),i}function io(e){let t,r=!0,n=new Set,i=()=>{if(!r)if(r=!0,Zd())n.forEach((a)=>Qd(a));else n.forEach((a)=>a())},s=()=>{let a=Jd();if(a)n.add(a);if(r){let o=Yd(i);try{t=e()}finally{Kd(o)}r=!1}return t};return Object.defineProperty(s,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(s,"value",{get:()=>s(),configurable:!0}),s}function so(e,t={}){let r,n=!1,i=()=>{if(n)return;if(r)r(),r=void 0;let s=Yd(i);try{let a=e();r=typeof a==="function"?a:void 0}finally{Kd(s)}};if(t.immediate!==!1)i();return()=>{if(n=!0,r)r()}}function Xd(e){vw(e)}function ep(e){$i.push(e)}function tp(e){yn.push(e)}function xw(){rp($i,"onMount",yn)}function Sw(){rp(yn,"onDestroy")}function rp(e,t,r){let n=e.splice(0,e.length);for(let i of n)try{let s=i();if(r&&typeof s==="function")r.push(s)}catch(s){console.error(`[stx] ${t} callback threw:`,s)}}function _w(){return{mount:$i.length,destroy:yn.length}}function ao(e){return typeof e==="function"&&e._isSignal===!0}function oo(e){return typeof e==="function"&&e._isDerived===!0}function np(e){if(ao(e)||oo(e))return e();return e}function lo(e){return ww(e)}function kw(e,t){let r=typeof e==="function"?e:()=>e,n=Ir([]),i=io(()=>n().reduce((a,o)=>t(a,o.action),r())),s=!1;return so(()=>{if(r(),!s){s=!0;return}if(lo(()=>n().length))n.set([])}),[i,(a,o)=>{let l={action:a};n.set([...n(),l]);let c=()=>{let u=n().filter((d)=>d!==l);if(u.length!==n().length)n.set(u)};if(o&&typeof o.then==="function")Promise.resolve(o).then(c,c);return c}]}var $i,yn,Ms=R(()=>{bw(),$i=[],yn=[]}),ip={};Y(ip,{useOptimistic:()=>kw,untrack:()=>np,state:()=>Ir,runMountCallbacks:()=>xw,runDestroyCallbacks:()=>Sw,pendingLifecycleCounts:()=>_w,peek:()=>lo,onMount:()=>ep,onDestroy:()=>tp,isSignal:()=>ao,isDerived:()=>oo,generateSignalsRuntimeDev:()=>co,generateSignalsRuntime:()=>sp,effect:()=>so,derived:()=>io,default:()=>ap,batch:()=>Xd});function sp(){let e=Ew(co());try{let t=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e);return t=t.replace(/\}(var |let |const |function )/g,"};$1"),t}catch{return e}}function Ew(e){let t=[],r=0,n="console.log(";while(r<e.length){let i=e.indexOf(n,r);if(i===-1){t.push(e.slice(r));break}t.push(e.slice(r,i));let s=1,a=i+n.length;while(a<e.length&&s>0){let o=e[a];if(o==='"'||o==="'"||o==="`"){let l=o;a++;while(a<e.length&&e[a]!==l){if(e[a]==="\\")a++;a++}a++;continue}if(o==="(")s++;else if(o===")")s--;a++}t.push("0"),r=a}return t.join("")}function co(){return`
2672
+ `}function Yd(){return Ft}function Kd(e){let t=Ft;return io.push(e),Ft=e,t}function Zd(e){io.pop(),Ft=e}function Qd(){return Ln>0}function Xd(e){ai.add(e)}function ww(e){Ln++;try{e()}finally{if(Ln--,Ln===0){let t=[...ai];ai.clear();for(let r of t)r()}}}function bw(e){let t=Ft;Ft=null;try{return e()}finally{Ft=t}}var Ft=null,io,Ln=0,ai,xw=R(()=>{io=[],ai=new Set});function Or(e){let t=e,r=new Set,n=new Set,i=()=>{let s=Yd();if(s)n.add(s);return t};return i.set=(s)=>{if(!Object.is(s,t)){let a=t;if(t=s,r.forEach((o)=>o(t,a)),Qd())n.forEach((o)=>Xd(o));else n.forEach((o)=>o())}},i.update=(s)=>{i.set(s(t))},i.subscribe=(s)=>(r.add(s),()=>r.delete(s)),Object.defineProperty(i,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(i,"value",{get:()=>i(),set:(s)=>i.set(s),configurable:!0}),i}function so(e){let t,r=!0,n=new Set,i=()=>{if(!r)if(r=!0,Qd())n.forEach((a)=>Xd(a));else n.forEach((a)=>a())},s=()=>{let a=Yd();if(a)n.add(a);if(r){let o=Kd(i);try{t=e()}finally{Zd(o)}r=!1}return t};return Object.defineProperty(s,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(s,"value",{get:()=>s(),configurable:!0}),s}function ao(e,t={}){let r,n=!1,i=()=>{if(n)return;if(r)r(),r=void 0;let s=Kd(i);try{let a=e();r=typeof a==="function"?a:void 0}finally{Zd(s)}};if(t.immediate!==!1)i();return()=>{if(n=!0,r)r()}}function ep(e){ww(e)}function tp(e){Li.push(e)}function rp(e){vn.push(e)}function Sw(){np(Li,"onMount",vn)}function _w(){np(vn,"onDestroy")}function np(e,t,r){let n=e.splice(0,e.length);for(let i of n)try{let s=i();if(r&&typeof s==="function")r.push(s)}catch(s){console.error(`[stx] ${t} callback threw:`,s)}}function kw(){return{mount:Li.length,destroy:vn.length}}function oo(e){return typeof e==="function"&&e._isSignal===!0}function lo(e){return typeof e==="function"&&e._isDerived===!0}function ip(e){if(oo(e)||lo(e))return e();return e}function co(e){return bw(e)}function Ew(e,t){let r=typeof e==="function"?e:()=>e,n=Or([]),i=so(()=>n().reduce((a,o)=>t(a,o.action),r())),s=!1;return ao(()=>{if(r(),!s){s=!0;return}if(co(()=>n().length))n.set([])}),[i,(a,o)=>{let l={action:a};n.set([...n(),l]);let c=()=>{let u=n().filter((d)=>d!==l);if(u.length!==n().length)n.set(u)};if(o&&typeof o.then==="function")Promise.resolve(o).then(c,c);return c}]}var Li,vn,Bs=R(()=>{xw(),Li=[],vn=[]}),sp={};K(sp,{useOptimistic:()=>Ew,untrack:()=>ip,state:()=>Or,runMountCallbacks:()=>Sw,runDestroyCallbacks:()=>_w,pendingLifecycleCounts:()=>kw,peek:()=>co,onMount:()=>tp,onDestroy:()=>rp,isSignal:()=>oo,isDerived:()=>lo,generateSignalsRuntimeDev:()=>uo,generateSignalsRuntime:()=>ap,effect:()=>ao,derived:()=>so,default:()=>op,batch:()=>ep});function ap(){let e=Aw(uo());try{let t=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e);return t=t.replace(/\}(var |let |const |function )/g,"};$1"),t}catch{return e}}function Aw(e){let t=[],r=0,n="console.log(";while(r<e.length){let i=e.indexOf(n,r);if(i===-1){t.push(e.slice(r));break}t.push(e.slice(r,i));let s=1,a=i+n.length;while(a<e.length&&s>0){let o=e[a];if(o==='"'||o==="'"||o==="`"){let l=o;a++;while(a<e.length&&e[a]!==l){if(e[a]==="\\")a++;a++}a++;continue}if(o==="(")s++;else if(o===")")s--;a++}t.push("0"),r=a}return t.join("")}function uo(){return`
2673
2673
  // STX Signals Runtime (Development Build)
2674
2674
  console.log('[stx] signals runtime loading');
2675
2675
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -5225,7 +5225,7 @@ catch (e2) {
5225
5225
  // :attr still works for backward compat but is reserved for structural directives.
5226
5226
  // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
5227
5227
  // handled by their own code paths below \u2014 exclude them here.
5228
- var X_HANDLED = ${wy()};
5228
+ var X_HANDLED = ${by()};
5229
5229
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
5230
5230
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
5231
5231
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
@@ -10517,42 +10517,42 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
10517
10517
  }
10518
10518
  }
10519
10519
  })();
10520
- `}var ap,Aw=R(()=>{Ms(),nt(),Ms(),ap={state:Ir,derived:io,effect:so,batch:Xd,onMount:ep,onDestroy:tp,isSignal:ao,isDerived:oo,untrack:np,peek:lo,generateSignalsRuntime:sp,generateSignalsRuntimeDev:co}}),uo={};Y(uo,{templateCache:()=>po,readFileCached:()=>Cw,invalidateFileCacheByDir:()=>Rw,invalidateFileCache:()=>Tw,hashFilePath:()=>ln,getCachedSignalsRuntime:()=>Ow,getCachedRouterScript:()=>jw,clearDevCaches:()=>Dw,checkCache:()=>$w,cacheTemplate:()=>Lw,__setSignalsGeneratorsForTest:()=>Iw});async function Cw(e){let t;for(let r=0;r<3;r++)try{let n=(await Or.promises.stat(e)).mtime.getTime(),i=wt.get(e);if(i&&i.mtime===n)return i.content;let s=await Bun.file(e).text(),a=(await Or.promises.stat(e)).mtime.getTime();if(a!==n)continue;return wt.set(e,{content:s,mtime:a}),s}catch(n){t=n;break}throw wt.delete(e),Error(`File not found: ${e}${t?` (${t.message})`:""}`)}function Tw(e){wt.delete(e)}function Rw(e){for(let t of wt.keys())if(t.startsWith(e))wt.delete(t)}function Iw(e){lp=e}async function Ow(e=!1){let t=lp??await Promise.resolve().then(()=>(Aw(),ip));if(e)return t.generateSignalsRuntimeDev();if(Ln===null)Ln=t.generateSignalsRuntime();return Ln}async function jw(){if(Nn===null){let{getRouterScript:e}=await Promise.resolve().then(()=>(Wt(),ou));Nn=e()}return Nn}function Dw(){wt.clear(),u0(),Ln=null,Nw=null,Nn=null}function op(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((r)=>({name:r.name,timing:r.timing,handler:String(r.handler)})),customDirectives:(e.customDirectives??[]).map((r)=>({name:r.name,hasEndTag:r.hasEndTag===!0,handler:String(r.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function $w(e,t){try{if(!t.cachePath)return null;let r=wr.resolve(t.cachePath),n=wr.join(r,`${ln(e)}.html`),i=wr.join(r,`${ln(e)}.meta.json`);if(!await Q(n)||!await Q(i))return null;let s=await Bun.file(i).text(),a=JSON.parse(s);if(a.cacheVersion!==t.cacheVersion)return null;if(a.optionsSignature!==op(t))return null;if((await Or.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let o of a.dependencies)if(await Q(o)){if((await Or.promises.stat(o)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(n).text()}catch(r){return console.warn(`Cache error for ${e}:`,r),null}}async function Lw(e,t,r,n){try{if(!n.cachePath)return;let i=wr.resolve(n.cachePath);await Or.promises.mkdir(i,{recursive:!0});let s=wr.join(i,`${ln(e)}.html`),a=wr.join(i,`${ln(e)}.meta.json`),o=await Or.promises.stat(e);await Bun.write(s,t);let l={sourcePath:e,mtime:o.mtime.getTime(),dependencies:Array.from(r),cacheVersion:n.cacheVersion,optionsSignature:op(n),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(l,null,2)),po.set(e,{output:t,mtime:o.mtime.getTime(),dependencies:r})}catch(i){console.warn(`Failed to cache template ${e}:`,i)}}function ln(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,Pw)}var po,wt,Ln=null,Nw=null,lp=null,Nn=null,Pw=16,cp=R(()=>{Ce(),po=new Map,wt=new Map});function Mw(e){return e.includes("data-stx-runtime")}function Bw(e){let t=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let r=t.exec(e);r!==null;r=t.exec(e)){let n=e.slice(Math.max(0,r.index-80),r.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(n))continue;return!0}return!1}function es(e,t){let r=e.indexOf("<script"),n=e.search(/<!doctype\b/i);if(r!==-1&&(n===-1||r>n))return e.slice(0,r)+t+`
10520
+ `}var op,Cw=R(()=>{Bs(),it(),Bs(),op={state:Or,derived:so,effect:ao,batch:ep,onMount:tp,onDestroy:rp,isSignal:oo,isDerived:lo,untrack:ip,peek:co,generateSignalsRuntime:ap,generateSignalsRuntimeDev:uo}}),po={};K(po,{templateCache:()=>fo,readFileCached:()=>Tw,invalidateFileCacheByDir:()=>Iw,invalidateFileCache:()=>Rw,hashFilePath:()=>cn,getCachedSignalsRuntime:()=>jw,getCachedRouterScript:()=>Dw,clearDevCaches:()=>$w,checkCache:()=>Lw,cacheTemplate:()=>Nw,__setSignalsGeneratorsForTest:()=>Ow});async function Tw(e){let t;for(let r=0;r<3;r++)try{let n=(await jr.promises.stat(e)).mtime.getTime(),i=bt.get(e);if(i&&i.mtime===n)return i.content;let s=await Bun.file(e).text(),a=(await jr.promises.stat(e)).mtime.getTime();if(a!==n)continue;return bt.set(e,{content:s,mtime:a}),s}catch(n){t=n;break}throw bt.delete(e),Error(`File not found: ${e}${t?` (${t.message})`:""}`)}function Rw(e){bt.delete(e)}function Iw(e){for(let t of bt.keys())if(t.startsWith(e))bt.delete(t)}function Ow(e){cp=e}async function jw(e=!1){let t=cp??await Promise.resolve().then(()=>(Cw(),sp));if(e)return t.generateSignalsRuntimeDev();if(Nn===null)Nn=t.generateSignalsRuntime();return Nn}async function Dw(){if(Pn===null){let{getRouterScript:e}=await Promise.resolve().then(()=>(Ht(),lu));Pn=e()}return Pn}function $w(){bt.clear(),db(),Nn=null,Pw=null,Pn=null}function lp(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((r)=>({name:r.name,timing:r.timing,handler:String(r.handler)})),customDirectives:(e.customDirectives??[]).map((r)=>({name:r.name,hasEndTag:r.hasEndTag===!0,handler:String(r.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Lw(e,t){try{if(!t.cachePath)return null;let r=br.resolve(t.cachePath),n=br.join(r,`${cn(e)}.html`),i=br.join(r,`${cn(e)}.meta.json`);if(!await X(n)||!await X(i))return null;let s=await Bun.file(i).text(),a=JSON.parse(s);if(a.cacheVersion!==t.cacheVersion)return null;if(a.optionsSignature!==lp(t))return null;if((await jr.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let o of a.dependencies)if(await X(o)){if((await jr.promises.stat(o)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(n).text()}catch(r){return console.warn(`Cache error for ${e}:`,r),null}}async function Nw(e,t,r,n){try{if(!n.cachePath)return;let i=br.resolve(n.cachePath);await jr.promises.mkdir(i,{recursive:!0});let s=br.join(i,`${cn(e)}.html`),a=br.join(i,`${cn(e)}.meta.json`),o=await jr.promises.stat(e);await Bun.write(s,t);let l={sourcePath:e,mtime:o.mtime.getTime(),dependencies:Array.from(r),cacheVersion:n.cacheVersion,optionsSignature:lp(n),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(l,null,2)),fo.set(e,{output:t,mtime:o.mtime.getTime(),dependencies:r})}catch(i){console.warn(`Failed to cache template ${e}:`,i)}}function cn(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,Mw)}var fo,bt,Nn=null,Pw=null,cp=null,Pn=null,Mw=16,up=R(()=>{Te(),fo=new Map,bt=new Map});function Bw(e){return e.includes("data-stx-runtime")}function zw(e){let t=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let r=t.exec(e);r!==null;r=t.exec(e)){let n=e.slice(Math.max(0,r.index-80),r.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(n))continue;return!0}return!1}function ts(e,t){let r=e.indexOf("<script"),n=e.search(/<!doctype\b/i);if(r!==-1&&(n===-1||r>n))return e.slice(0,r)+t+`
10521
10521
  `+e.slice(r);let i=/<head\b[^>]*>/i.exec(e);if(i){let s=i.index+i[0].length;return`${e.slice(0,s)}
10522
10522
  ${t}${e.slice(s)}`}if(e.includes("</head>")){let s=e.indexOf("</head>");return e.slice(0,s)+t+`
10523
- `+e.slice(s)}if(ro(e))return Gd(e,(s)=>`${s}
10523
+ `+e.slice(s)}if(no(e))return Vd(e,(s)=>`${s}
10524
10524
  ${t}`);return`${t}
10525
- ${e}`}async function up(e,t){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(t.buildMode==="serve")return es(e,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(t.buildMode==="compile")return es(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:r}=await Promise.resolve().then(()=>(cp(),uo)),n=await r(t.debug);return es(e,`<script data-stx-scoped data-stx-runtime>${n}</script>`)}function zw(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function Fw(e){if(e.includes("data-stx-tooltip-runtime")||!zw(e))return e;let t=`<script data-stx-scoped data-stx-tooltip-runtime>${yw()}</script>`,r=e.lastIndexOf("</body>");if(r===-1)return`${e}
10525
+ ${e}`}async function dp(e,t){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(t.buildMode==="serve")return ts(e,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(t.buildMode==="compile")return ts(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:r}=await Promise.resolve().then(()=>(up(),po)),n=await r(t.debug);return ts(e,`<script data-stx-scoped data-stx-runtime>${n}</script>`)}function Fw(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function qw(e){if(e.includes("data-stx-tooltip-runtime")||!Fw(e))return e;let t=`<script data-stx-scoped data-stx-tooltip-runtime>${vw()}</script>`,r=e.lastIndexOf("</body>");if(r===-1)return`${e}
10526
10526
  ${t}`;return`${e.slice(0,r)}${t}
10527
- ${e.slice(r)}`}async function qw(e,t){if(!e.includes("</body>"))return e;if(e.includes("data-stx-router")||e.includes("__stxRouter)return")||e.includes("__stxRouter=true"))return e;let r=t?.router,n="";{let o={};if(r){if(r.container)o.container=r.container;if(r.interceptAllLinks!==void 0)o.interceptAllLinks=r.interceptAllLinks;if(r.progress!==void 0)o.progress=r.progress;if(r.viewTransitions!==void 0)o.viewTransitions=r.viewTransitions;if(r.viewTransitionDuration!==void 0)o.viewTransitionDuration=r.viewTransitionDuration;if(r.viewTransitionEasing!==void 0)o.viewTransitionEasing=r.viewTransitionEasing;if(r.scrollToTop!==void 0)o.scrollToTop=r.scrollToTop;if(r.prefetch!==void 0)o.prefetch=r.prefetch;if(r.cache!==void 0)o.cache=r.cache;if(r.progressColor!==void 0)o.progressColor=r.progressColor;if(r.progressHeight!==void 0)o.progressHeight=r.progressHeight}try{let l=await fw(t?.pagesDir);if(l.length>0)o.ownedRoutes=l}catch{}if(Object.keys(o).length>0)n=`<script>window.__stxRouterConfig=${gw(o)};</script>
10528
- `}let{getCachedRouterScript:i}=await Promise.resolve().then(()=>(cp(),uo)),s=t?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':t?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await i()}</script>`,a=e.lastIndexOf("</body>");return e.slice(0,a)+n+s+`
10529
- </body>`+e.slice(a+7)}var Bs=R(()=>{hw(),Vd()}),ai={};Y(ai,{scanScriptTags:()=>dp,rewriteStxImportSpecifiers:()=>wp,processSignals:()=>vp,processScriptSetup:()=>gp,preEvalLiteralReactiveIfs:()=>hp,parseLoopExpression:()=>pp,hasSignalsSyntax:()=>fo,findMarkupIndexOutsideScripts:()=>Pn,extractExports:()=>yp,convertSignalLoopsToAttributes:()=>mp,convertSignalDirectivesToAttributes:()=>fp});function dp(e,t={}){let r=[];for(let n of od(e,sn)){let i=n.token.match(/^<script\b([^>]*)>/i),s=n.token.match(/<\/script\s*>$/i);if(!i||!s)continue;let a=i[1];if(t.skipAttrs){if(t.skipAttrs.lastIndex=0,t.skipAttrs.test(a))continue}let o=i[0].length,l=n.token.length-s[0].length;r.push({fullMatch:n.token,attrs:a,body:n.token.slice(o,l),start:n.start,end:n.end})}return r}function pp(e){let t=e.trim(),r=t.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(r){let i=r[1].trim(),s=r[2].trim(),{itemVar:a,indexVar:o}=_l(s);if(a)return{style:"as",iterable:i,itemVar:a,indexVar:o}}let n=t.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let i=n[1].trim(),s=n[2].trim(),{itemVar:a,indexVar:o}=_l(i);if(a)return{style:"in",iterable:s,itemVar:a,indexVar:o}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function _l(e){let t=e.trim(),r=t.match(/^(\w+)\s*=>\s*(\w+)$/);if(r)return{itemVar:r[2],indexVar:r[1]};let n=t.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let i=t.match(/^(\w+)\s*,\s*(\w+)$/);if(i)return{itemVar:i[1],indexVar:i[2]};let s=t.match(/^(\w+)$/);if(s)return{itemVar:s[1],indexVar:null};return{itemVar:null,indexVar:null}}function fo(e){return yy(e)}function Ww(e){let t=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,r=0,n;while((n=t.exec(e))!==null){let i=n[1];if(i.startsWith("if"))r++;else if(i==="endif")r--;else if(r===0)return!0}return!1}function Hw(e){let t=new Set,r=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,i;while((i=r.exec(e))!==null){let s=i[1],a;while((a=n.exec(s))!==null)t.add(a[1])}return t}function Uw(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function kl(e,t,r){if(!e)return!1;let n=Uw(e),i=!1,s=!1,a=!1,o=/([a-zA-Z_$][\w$]*)/g,l;while((l=o.exec(n))!==null){let d=l[1];if(n.slice(0,l.index).trimEnd().endsWith("."))continue;if(zs.has(d))continue;if(t.has(d))i=!0;else if(r&&d in r)s=!0}let c=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,u;while((u=c.exec(n))!==null){let d=u[1];if(n.slice(0,u.index).trimEnd().endsWith("."))continue;if(zs.has(d)||r&&d in r)continue;a=!0}return(i||a)&&!s}function xn(e,t,r){let n=r===void 0?` ${t}`:` ${t}="${r.replace(/"/g,"&quot;")}"`,i=e.trim(),s=i.match(ho);if(s&&Gw(s[3],s[1])){let[,a,o,l]=s;return`<${a}${o}${n}>${l}</${a}>`}return`<template${n}>${i}</template>`}function Gw(e,t){let r=new RegExp(`<(/)?${t}(?=[\\s/>])`,"gi"),n=0,i;while((i=r.exec(e))!==null)if(i[1]){if(n--,n<0)return!1}else n++;return!0}function fp(e,t){let r=Hw(e);function n(i){let s=i,a=/@if\s*\(/g,o,l=[];while((o=a.exec(s))!==null){let c=o.index,u=c+o[0].length,d=1,h=u;while(h<s.length&&d>0){if(s[h]==="(")d++;else if(s[h]===")")d--;h++}if(d!==0)continue;let p=s.substring(u,h-1).trim(),f=h,m=1,y=f,g=/@(if\s*\(|endif)/g;g.lastIndex=f;let v;while((v=g.exec(s))!==null)if(v[1].startsWith("if"))m++;else if(v[1]==="endif"){if(m--,m===0){y=v.index+v[0].length;break}}if(m!==0)continue;let w=s.substring(f,y-6).trim(),b;if(Ww(w)){let S=Hd(s.substring(c,y));if(S.length===0)continue;let x=S[0].branches.filter((_)=>_.type!=="else");if(!(x.length>0&&x.every((_)=>kl(_.condition,r,t))))continue;b=S[0].branches.map((_)=>{let E=n(_.content);if(_.type==="elseif")return xn(E,"@else-if",_.condition??"");if(_.type==="else")return xn(E,"@else");return xn(E,"@if",_.condition??"")}).join(`
10530
- `)}else{if(!kl(p,r,t))continue;b=xn(n(w),"@if",p)}l.push({start:c,end:y,replacement:b}),a.lastIndex=y}for(let c=l.length-1;c>=0;c--){let{start:u,end:d,replacement:h}=l[c];s=s.substring(0,u)+h+s.substring(d)}return s}return n(e)}function Vw(e){let t=e.trim();if(t==="")return;if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return!1;if(t==="undefined")return!1;if(t==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(t)){let i=Number(t);return i!==0&&!Number.isNaN(i)}let r=t.match(/^'((?:\\.|[^'\\])*)'$/);if(r)return r[1].length>0;let n=t.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}function Jw(e,t,r,n){if(oi.has(r.toLowerCase()))return n;let i=r.toLowerCase(),s=e.toLowerCase(),a=e.length,o=1,l=n;while(l<a){let c=e.indexOf("<",l);if(c===-1)return-1;if(l=c,e.startsWith("<!--",l)){let p=e.indexOf("-->",l+4);if(p===-1)return-1;l=p+3;continue}let u=/^<(script|style)\b/i.exec(e.slice(l,l+8));if(u){let p=e.indexOf(">",l);if(p===-1)return-1;if(e[p-1]==="/"){l=p+1;continue}let f=s.indexOf(`</${u[1].toLowerCase()}`,l);if(f===-1)return-1;let m=e.indexOf(">",f);if(m===-1)return-1;l=m+1;continue}if(e[l+1]==="/"){let p=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(l,l+64));if(!p){l++;continue}if(p[1].toLowerCase()===i){if(o--,l+=p[0].length,o===0)return l;continue}l+=p[0].length;continue}let d=/^<([a-z][\w-]*)\b/i.exec(e.slice(l,l+64));if(!d){l++;continue}let h=e.indexOf(">",l);if(h===-1)return-1;if(d[1].toLowerCase()===i){let p=e.slice(l,h+1);if(!(/\/\s*>$/.test(p)||oi.has(i)))o++}l=h+1}return-1}function Yw(e,t){let r=t,n=e.length;for(;;){while(r<n&&e[r]!=="<")r++;if(r>=n)return!1;if(e.startsWith("<!--",r)){let a=e.indexOf("-->",r+4);if(a===-1)return!1;r=a+3;continue}break}if(e[r+1]==="/")return!1;let i=e.indexOf(">",r);if(i===-1)return!1;let s=e.slice(r,i+1);return bp.test(s)}function hp(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let t=[],r=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=r.exec(e))!==null)t.push([n.index,n.index+n[0].length]);let i=(d)=>t.some(([h,p])=>d>=h&&d<p),s=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,a=[],o;while((o=s.exec(e))!==null){if(i(o.index))continue;let[d,h,p,f,m,y,g]=o,v=Vw(m);if(v===void 0)continue;let w=o.index,b=w+d.length,S=!!g||/\/\s*>$/.test(d)||oi.has(h.toLowerCase())?b:Jw(e,w,h,b);if(S===-1)continue;if((f===":if"||f==="x-if"||f==="@if")&&Yw(e,S)){s.lastIndex=b;continue}if(v===!0){let x=`<${h}${p}${y}${g}>`;a.push({start:w,end:b,replacement:x});continue}a.push({start:w,end:S,replacement:""}),s.lastIndex=S}if(a.length===0)return e;a.sort((d,h)=>d.start-h.start);let l=[],c=-1;for(let d of a){if(d.start<c)continue;l.push(d),c=d.end}let u=e;for(let d=l.length-1;d>=0;d--){let{start:h,end:p,replacement:f}=l[d];u=u.substring(0,h)+f+u.substring(p)}return u}function mp(e,t){let r=e,n=/@(for|foreach)\s*\(/g,i,s=[],a=[];while((i=n.exec(r))!==null){let o=i[1],l=i.index,c=l+i[0].length,u=1,d=c;while(d<r.length&&u>0){if(r[d]==="(")u++;else if(r[d]===")")u--;d++}if(u!==0)continue;let h=r.substring(c,d-1).trim(),p=d,f=pp(h),m=o==="for"?"@endfor":"@endforeach",y=1,g=p,v=o==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${o}\\s*\\(|end${o})`,"g");v.lastIndex=p;let w;while((w=v.exec(r))!==null)if(w[1].startsWith(o))y++;else if(y--,y===0){g=w.index+w[0].length;break}if(y!==0)continue;let b=()=>{let E=[f.itemVar,f.indexVar].filter(Boolean);if(E.length)a.push({start:l,end:g,vars:E})};if(f.iterable){let E=f.iterable.trim();if(E.startsWith("[")||E.startsWith("{")||E.startsWith("'")||E.startsWith('"')||E.startsWith("`")||/^-?\d/.test(E)){b();continue}let k=E.split(/[.[(]/)[0].trim(),A=t?k in t:!1,T=a.some((C)=>l>C.start&&l<C.end&&C.vars.includes(k));if(k&&(A||T)){b();continue}}if(f.style==="as")h=f.indexVar?`(${f.itemVar}, ${f.indexVar}) in ${f.iterable}`:`${f.itemVar} in ${f.iterable}`;let S=r.substring(p,g-m.length).trim(),x=S.match(ho),_;if(x){let[,E,k,A]=x;_=`<${E}${k} @for="${h}">${A}</${E}>`}else _=`<template @for="${h}">${S}</template>`;s.push({start:l,end:g,replacement:_})}for(let o=s.length-1;o>=0;o--){let{start:l,end:c,replacement:u}=s[o];r=r.substring(0,l)+u+r.substring(c)}return r}function Kw(e){let t=new Set,r=[],n=0,i=0,s=e.length,a=(u)=>{let d=n+1;while(d<s){let h=e[d];if(h==="\\"){d+=2;continue}if(h===u)return d+1;d++}return s},o=()=>{let u=n+2;while(u<s&&e[u]!==`
10527
+ ${e.slice(r)}`}async function Ww(e,t){if(!e.includes("</body>"))return e;if(e.includes("data-stx-router")||e.includes("__stxRouter)return")||e.includes("__stxRouter=true"))return e;let r=t?.router,n="";{let o={};if(r){if(r.container)o.container=r.container;if(r.interceptAllLinks!==void 0)o.interceptAllLinks=r.interceptAllLinks;if(r.progress!==void 0)o.progress=r.progress;if(r.viewTransitions!==void 0)o.viewTransitions=r.viewTransitions;if(r.viewTransitionDuration!==void 0)o.viewTransitionDuration=r.viewTransitionDuration;if(r.viewTransitionEasing!==void 0)o.viewTransitionEasing=r.viewTransitionEasing;if(r.scrollToTop!==void 0)o.scrollToTop=r.scrollToTop;if(r.prefetch!==void 0)o.prefetch=r.prefetch;if(r.cache!==void 0)o.cache=r.cache;if(r.progressColor!==void 0)o.progressColor=r.progressColor;if(r.progressHeight!==void 0)o.progressHeight=r.progressHeight}try{let l=await hw(t?.pagesDir);if(l.length>0)o.ownedRoutes=l}catch{}if(Object.keys(o).length>0)n=`<script>window.__stxRouterConfig=${yw(o)};</script>
10528
+ `}let{getCachedRouterScript:i}=await Promise.resolve().then(()=>(up(),po)),s=t?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':t?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await i()}</script>`,a=e.lastIndexOf("</body>");return e.slice(0,a)+n+s+`
10529
+ </body>`+e.slice(a+7)}var zs=R(()=>{mw(),Jd()}),oi={};K(oi,{scanScriptTags:()=>pp,rewriteStxImportSpecifiers:()=>bp,processSignals:()=>wp,processScriptSetup:()=>yp,preEvalLiteralReactiveIfs:()=>mp,parseLoopExpression:()=>fp,hasSignalsSyntax:()=>ho,findMarkupIndexOutsideScripts:()=>Mn,extractExports:()=>vp,convertSignalLoopsToAttributes:()=>gp,convertSignalDirectivesToAttributes:()=>hp});function pp(e,t={}){let r=[];for(let n of ld(e,an)){let i=n.token.match(/^<script\b([^>]*)>/i),s=n.token.match(/<\/script\s*>$/i);if(!i||!s)continue;let a=i[1];if(t.skipAttrs){if(t.skipAttrs.lastIndex=0,t.skipAttrs.test(a))continue}let o=i[0].length,l=n.token.length-s[0].length;r.push({fullMatch:n.token,attrs:a,body:n.token.slice(o,l),start:n.start,end:n.end})}return r}function fp(e){let t=e.trim(),r=t.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(r){let i=r[1].trim(),s=r[2].trim(),{itemVar:a,indexVar:o}=kl(s);if(a)return{style:"as",iterable:i,itemVar:a,indexVar:o}}let n=t.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(n){let i=n[1].trim(),s=n[2].trim(),{itemVar:a,indexVar:o}=kl(i);if(a)return{style:"in",iterable:s,itemVar:a,indexVar:o}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function kl(e){let t=e.trim(),r=t.match(/^(\w+)\s*=>\s*(\w+)$/);if(r)return{itemVar:r[2],indexVar:r[1]};let n=t.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(n)return{itemVar:n[1],indexVar:n[2]||null};let i=t.match(/^(\w+)\s*,\s*(\w+)$/);if(i)return{itemVar:i[1],indexVar:i[2]};let s=t.match(/^(\w+)$/);if(s)return{itemVar:s[1],indexVar:null};return{itemVar:null,indexVar:null}}function ho(e){return vy(e)}function Hw(e){let t=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,r=0,n;while((n=t.exec(e))!==null){let i=n[1];if(i.startsWith("if"))r++;else if(i==="endif")r--;else if(r===0)return!0}return!1}function Uw(e){let t=new Set,r=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,n=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,i;while((i=r.exec(e))!==null){let s=i[1],a;while((a=n.exec(s))!==null)t.add(a[1])}return t}function Gw(e){return e.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function El(e,t,r){if(!e)return!1;let n=Gw(e),i=!1,s=!1,a=!1,o=/([a-zA-Z_$][\w$]*)/g,l;while((l=o.exec(n))!==null){let d=l[1];if(n.slice(0,l.index).trimEnd().endsWith("."))continue;if(Fs.has(d))continue;if(t.has(d))i=!0;else if(r&&d in r)s=!0}let c=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,u;while((u=c.exec(n))!==null){let d=u[1];if(n.slice(0,u.index).trimEnd().endsWith("."))continue;if(Fs.has(d)||r&&d in r)continue;a=!0}return(i||a)&&!s}function Sn(e,t,r){let n=r===void 0?` ${t}`:` ${t}="${r.replace(/"/g,"&quot;")}"`,i=e.trim(),s=i.match(mo);if(s&&Vw(s[3],s[1])){let[,a,o,l]=s;return`<${a}${o}${n}>${l}</${a}>`}return`<template${n}>${i}</template>`}function Vw(e,t){let r=new RegExp(`<(/)?${t}(?=[\\s/>])`,"gi"),n=0,i;while((i=r.exec(e))!==null)if(i[1]){if(n--,n<0)return!1}else n++;return!0}function hp(e,t){let r=Uw(e);function n(i){let s=i,a=/@if\s*\(/g,o,l=[];while((o=a.exec(s))!==null){let c=o.index,u=c+o[0].length,d=1,h=u;while(h<s.length&&d>0){if(s[h]==="(")d++;else if(s[h]===")")d--;h++}if(d!==0)continue;let p=s.substring(u,h-1).trim(),f=h,m=1,y=f,g=/@(if\s*\(|endif)/g;g.lastIndex=f;let v;while((v=g.exec(s))!==null)if(v[1].startsWith("if"))m++;else if(v[1]==="endif"){if(m--,m===0){y=v.index+v[0].length;break}}if(m!==0)continue;let w=s.substring(f,y-6).trim(),b;if(Hw(w)){let S=Ud(s.substring(c,y));if(S.length===0)continue;let x=S[0].branches.filter((_)=>_.type!=="else");if(!(x.length>0&&x.every((_)=>El(_.condition,r,t))))continue;b=S[0].branches.map((_)=>{let E=n(_.content);if(_.type==="elseif")return Sn(E,"@else-if",_.condition??"");if(_.type==="else")return Sn(E,"@else");return Sn(E,"@if",_.condition??"")}).join(`
10530
+ `)}else{if(!El(p,r,t))continue;b=Sn(n(w),"@if",p)}l.push({start:c,end:y,replacement:b}),a.lastIndex=y}for(let c=l.length-1;c>=0;c--){let{start:u,end:d,replacement:h}=l[c];s=s.substring(0,u)+h+s.substring(d)}return s}return n(e)}function Jw(e){let t=e.trim();if(t==="")return;if(t==="true")return!0;if(t==="false")return!1;if(t==="null")return!1;if(t==="undefined")return!1;if(t==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(t)){let i=Number(t);return i!==0&&!Number.isNaN(i)}let r=t.match(/^'((?:\\.|[^'\\])*)'$/);if(r)return r[1].length>0;let n=t.match(/^"((?:\\.|[^"\\])*)"$/);if(n)return n[1].length>0;return}function Yw(e,t,r,n){if(li.has(r.toLowerCase()))return n;let i=r.toLowerCase(),s=e.toLowerCase(),a=e.length,o=1,l=n;while(l<a){let c=e.indexOf("<",l);if(c===-1)return-1;if(l=c,e.startsWith("<!--",l)){let p=e.indexOf("-->",l+4);if(p===-1)return-1;l=p+3;continue}let u=/^<(script|style)\b/i.exec(e.slice(l,l+8));if(u){let p=e.indexOf(">",l);if(p===-1)return-1;if(e[p-1]==="/"){l=p+1;continue}let f=s.indexOf(`</${u[1].toLowerCase()}`,l);if(f===-1)return-1;let m=e.indexOf(">",f);if(m===-1)return-1;l=m+1;continue}if(e[l+1]==="/"){let p=/^<\/([a-z][\w-]*)\s*>/i.exec(e.slice(l,l+64));if(!p){l++;continue}if(p[1].toLowerCase()===i){if(o--,l+=p[0].length,o===0)return l;continue}l+=p[0].length;continue}let d=/^<([a-z][\w-]*)\b/i.exec(e.slice(l,l+64));if(!d){l++;continue}let h=e.indexOf(">",l);if(h===-1)return-1;if(d[1].toLowerCase()===i){let p=e.slice(l,h+1);if(!(/\/\s*>$/.test(p)||li.has(i)))o++}l=h+1}return-1}function Kw(e,t){let r=t,n=e.length;for(;;){while(r<n&&e[r]!=="<")r++;if(r>=n)return!1;if(e.startsWith("<!--",r)){let a=e.indexOf("-->",r+4);if(a===-1)return!1;r=a+3;continue}break}if(e[r+1]==="/")return!1;let i=e.indexOf(">",r);if(i===-1)return!1;let s=e.slice(r,i+1);return xp.test(s)}function mp(e){if(!e.includes(":if")&&!e.includes(":show")&&!e.includes("x-if")&&!e.includes("x-show")&&!e.includes("@if=")&&!e.includes("@show="))return e;let t=[],r=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=r.exec(e))!==null)t.push([n.index,n.index+n[0].length]);let i=(d)=>t.some(([h,p])=>d>=h&&d<p),s=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,a=[],o;while((o=s.exec(e))!==null){if(i(o.index))continue;let[d,h,p,f,m,y,g]=o,v=Jw(m);if(v===void 0)continue;let w=o.index,b=w+d.length,S=!!g||/\/\s*>$/.test(d)||li.has(h.toLowerCase())?b:Yw(e,w,h,b);if(S===-1)continue;if((f===":if"||f==="x-if"||f==="@if")&&Kw(e,S)){s.lastIndex=b;continue}if(v===!0){let x=`<${h}${p}${y}${g}>`;a.push({start:w,end:b,replacement:x});continue}a.push({start:w,end:S,replacement:""}),s.lastIndex=S}if(a.length===0)return e;a.sort((d,h)=>d.start-h.start);let l=[],c=-1;for(let d of a){if(d.start<c)continue;l.push(d),c=d.end}let u=e;for(let d=l.length-1;d>=0;d--){let{start:h,end:p,replacement:f}=l[d];u=u.substring(0,h)+f+u.substring(p)}return u}function gp(e,t){let r=e,n=/@(for|foreach)\s*\(/g,i,s=[],a=[];while((i=n.exec(r))!==null){let o=i[1],l=i.index,c=l+i[0].length,u=1,d=c;while(d<r.length&&u>0){if(r[d]==="(")u++;else if(r[d]===")")u--;d++}if(u!==0)continue;let h=r.substring(c,d-1).trim(),p=d,f=fp(h),m=o==="for"?"@endfor":"@endforeach",y=1,g=p,v=o==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${o}\\s*\\(|end${o})`,"g");v.lastIndex=p;let w;while((w=v.exec(r))!==null)if(w[1].startsWith(o))y++;else if(y--,y===0){g=w.index+w[0].length;break}if(y!==0)continue;let b=()=>{let E=[f.itemVar,f.indexVar].filter(Boolean);if(E.length)a.push({start:l,end:g,vars:E})};if(f.iterable){let E=f.iterable.trim();if(E.startsWith("[")||E.startsWith("{")||E.startsWith("'")||E.startsWith('"')||E.startsWith("`")||/^-?\d/.test(E)){b();continue}let k=E.split(/[.[(]/)[0].trim(),A=t?k in t:!1,T=a.some((C)=>l>C.start&&l<C.end&&C.vars.includes(k));if(k&&(A||T)){b();continue}}if(f.style==="as")h=f.indexVar?`(${f.itemVar}, ${f.indexVar}) in ${f.iterable}`:`${f.itemVar} in ${f.iterable}`;let S=r.substring(p,g-m.length).trim(),x=S.match(mo),_;if(x){let[,E,k,A]=x;_=`<${E}${k} @for="${h}">${A}</${E}>`}else _=`<template @for="${h}">${S}</template>`;s.push({start:l,end:g,replacement:_})}for(let o=s.length-1;o>=0;o--){let{start:l,end:c,replacement:u}=s[o];r=r.substring(0,l)+u+r.substring(c)}return r}function Zw(e){let t=new Set,r=[],n=0,i=0,s=e.length,a=(u)=>{let d=n+1;while(d<s){let h=e[d];if(h==="\\"){d+=2;continue}if(h===u)return d+1;d++}return s},o=()=>{let u=n+2;while(u<s&&e[u]!==`
10531
10531
  `)u++;return u},l=()=>{let u=n+2;while(u<s-1){if(e[u]==="*"&&e[u+1]==="/")return u+2;u++}return s},c=(u)=>{let d=u,h=0;while(d<s){let p=e[d];if(p==="/"&&e[d+1]==="/"){let f=d+2;while(f<s&&e[f]!==`
10532
- `)f++;d=f;continue}if(p==="/"&&e[d+1]==="*"){let f=d+2;while(f<s-1&&!(e[f]==="*"&&e[f+1]==="/"))f++;d=f+2;continue}if(p==='"'||p==="'"||p==="`"){let f=d+1;while(f<s){if(e[f]==="\\"){f+=2;continue}if(e[f]===p){f++;break}f++}d=f;continue}if(p==="("||p==="["||p==="{"){h++,d++;continue}if(p===")"||p==="]"||p==="}"){h--,d++;continue}if(p===";"&&h===0)return d+1;d++}return s};while(n<s){let u=e[n];if(u==="/"&&e[n+1]==="/"){let d=o();r.push(e.slice(n,d)),n=d;continue}if(u==="/"&&e[n+1]==="*"){let d=l();r.push(e.slice(n,d)),n=d;continue}if(u==='"'||u==="'"||u==="`"){let d=a(u);r.push(e.slice(n,d)),n=d;continue}if(u==="{"){i++,r.push(u),n++;continue}if(u==="}"){i--,r.push(u),n++;continue}if(i===0){let d=n>0?e[n-1]:"";if(d===""||/\s/.test(d)||d===";"||d==="}"||d==="{"){let h=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(h){let p=h[2],f=c(n+h[0].length);if(t.has(p)){r.push(`/* stx: deduped const ${p} */`),n=f;continue}t.add(p),r.push(e.slice(n,f)),n=f;continue}}}r.push(u),n++}return r.join("")}async function gp(e,t,r){let n=dp(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),i=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,s=[];for(let y of n){let g=y.body;if(Li(y.attrs))g=Ni(g);if(i.test(g))s.push({fullMatch:y.fullMatch,attrs:y.attrs,content:g})}if(s.length===0)return{output:e,setupCode:null};let a=`__stx_setup_${Date.now()}_${Zw++}`,{hasUserImports:o,bundleClientScript:l}=await X("stx/client-script-bundler",()=>Promise.resolve().then(()=>(Ti(),pn))),c=[];for(let y=0;y<s.length;y++){let g=s[y].content;if(g=Ri(g).code,o(g))g=await l(g,t||"",{projectRoot:process.cwd()});g=g.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(w,b)=>wp(b));let v=Ut(g);c.push(`// \u2500\u2500 merged signal script #${y+1} \u2500\u2500
10532
+ `)f++;d=f;continue}if(p==="/"&&e[d+1]==="*"){let f=d+2;while(f<s-1&&!(e[f]==="*"&&e[f+1]==="/"))f++;d=f+2;continue}if(p==='"'||p==="'"||p==="`"){let f=d+1;while(f<s){if(e[f]==="\\"){f+=2;continue}if(e[f]===p){f++;break}f++}d=f;continue}if(p==="("||p==="["||p==="{"){h++,d++;continue}if(p===")"||p==="]"||p==="}"){h--,d++;continue}if(p===";"&&h===0)return d+1;d++}return s};while(n<s){let u=e[n];if(u==="/"&&e[n+1]==="/"){let d=o();r.push(e.slice(n,d)),n=d;continue}if(u==="/"&&e[n+1]==="*"){let d=l();r.push(e.slice(n,d)),n=d;continue}if(u==='"'||u==="'"||u==="`"){let d=a(u);r.push(e.slice(n,d)),n=d;continue}if(u==="{"){i++,r.push(u),n++;continue}if(u==="}"){i--,r.push(u),n++;continue}if(i===0){let d=n>0?e[n-1]:"";if(d===""||/\s/.test(d)||d===";"||d==="}"||d==="{"){let h=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(h){let p=h[2],f=c(n+h[0].length);if(t.has(p)){r.push(`/* stx: deduped const ${p} */`),n=f;continue}t.add(p),r.push(e.slice(n,f)),n=f;continue}}}r.push(u),n++}return r.join("")}async function yp(e,t,r){let n=pp(e,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),i=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,s=[];for(let y of n){let g=y.body;if(Ni(y.attrs))g=Pi(g);if(i.test(g))s.push({fullMatch:y.fullMatch,attrs:y.attrs,content:g})}if(s.length===0)return{output:e,setupCode:null};let a=`__stx_setup_${Date.now()}_${Qw++}`,{hasUserImports:o,bundleClientScript:l}=await ee("stx/client-script-bundler",()=>Promise.resolve().then(()=>(Ri(),fn))),c=[];for(let y=0;y<s.length;y++){let g=s[y].content;if(g=Ii(g).code,o(g))g=await l(g,t||"",{projectRoot:process.cwd()});g=g.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(w,b)=>bp(b));let v=Gt(g);c.push(`// \u2500\u2500 merged signal script #${y+1} \u2500\u2500
10533
10533
  ${v}`)}let u=c.join(`
10534
10534
 
10535
- `);u=Kw(u);let d=yp(u),h=d.split(",").map((y)=>y.trim()).filter(Boolean),p=La(u,r),f=`
10535
+ `);u=Zw(u);let d=vp(u),h=d.split(",").map((y)=>y.trim()).filter(Boolean),p=Na(u,r),f=`
10536
10536
  <script data-stx-scoped>
10537
10537
  function ${a}() {
10538
- ${Ta("const",h)}
10539
- ${On(`${p}${u}`)}
10538
+ ${Ra("const",h)}
10539
+ ${jn(`${p}${u}`)}
10540
10540
  return { ${d} };
10541
10541
  }
10542
10542
  window.__stx_latestSetup=${a};
10543
10543
  if(window.stx)window.stx._latestSetup=${a};
10544
- </script>`,m=e;for(let y of s)m=m.split(y.fullMatch).join("");if(m.includes("<body"))m=m.replace(new RegExp(`<body(${El})>`),`<body$1 data-stx="${a}">`);else{let y=["script","style","html","head","meta","link","title","!doctype"],g=!1;m=m.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${El})>`,"gi"),(v,w,b)=>{if(g||y.includes(w.toLowerCase()))return v;return g=!0,`<${w}${b} data-stx="${a}">`})}return{output:m,setupCode:f}}function yp(e){let t=e,r=[],n=new Set,i=0,s=0,a=t.length,o="",l=()=>{s++;let f=!1;while(s<a){let m=t[s];if(m==="\\"){s+=2;continue}if(m==="["&&!f){f=!0,s++;continue}if(m==="]"&&f){f=!1,s++;continue}if(m==="/"&&!f){s++;while(s<a&&/[gimsuyd]/.test(t[s]))s++;return}if(m===`
10544
+ </script>`,m=e;for(let y of s)m=m.split(y.fullMatch).join("");if(m.includes("<body"))m=m.replace(new RegExp(`<body(${Al})>`),`<body$1 data-stx="${a}">`);else{let y=["script","style","html","head","meta","link","title","!doctype"],g=!1;m=m.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${Al})>`,"gi"),(v,w,b)=>{if(g||y.includes(w.toLowerCase()))return v;return g=!0,`<${w}${b} data-stx="${a}">`})}return{output:m,setupCode:f}}function vp(e){let t=e,r=[],n=new Set,i=0,s=0,a=t.length,o="",l=()=>{s++;let f=!1;while(s<a){let m=t[s];if(m==="\\"){s+=2;continue}if(m==="["&&!f){f=!0,s++;continue}if(m==="]"&&f){f=!1,s++;continue}if(m==="/"&&!f){s++;while(s<a&&/[gimsuyd]/.test(t[s]))s++;return}if(m===`
10545
10545
  `)return;s++}},c=()=>{if(!o)return!0;if(/[\w)\]]/.test(o))return!1;return!0},u=(f)=>{s++;while(s<a){if(t[s]==="\\"){s+=2;continue}if(t[s]===f){s++;return}s++}},d=()=>{s++;while(s<a){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let f=1;while(s<a&&f>0)if(t[s]==="{")f++,s++;else if(t[s]==="}")f--,s++;else if(t[s]==="'"||t[s]==='"')u(t[s]);else if(t[s]==="`")d();else s++;continue}s++}},h=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<a&&t[s]!==`
10546
- `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<a-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},p=()=>{if(i!==0)return;let f=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(f){let w=f[2];if(!n.has(w))r.push(w),n.add(w);return}let m=t.slice(s).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(m){m[1].split(",").forEach((w)=>{let b=w.trim();if(!b)return;let S=b.indexOf(":"),x=(S>=0?b.slice(S+1).trim():b).split(/[\s=]/)[0];if(x&&!n.has(x))r.push(x),n.add(x)});return}let y=t.slice(s).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(y){y[1].split(",").forEach((w)=>{let b=w.trim().replace(/^\.\.\./,"");if(!b)return;let S=b.split(/[\s=]/)[0];if(S&&!n.has(S))r.push(S),n.add(S)});return}let g=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(g){let w=g[1];if(!n.has(w))r.push(w),n.add(w);return}let v=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(v){let w=v[1];if(!n.has(w))r.push(w),n.add(w)}};while(s<a){if(h())continue;if(t[s]==="'"||t[s]==='"'){u(t[s]),o=t[s-1];continue}if(t[s]==="`"){d(),o="`";continue}if(t[s]==="/"&&t[s+1]!=="/"&&t[s+1]!=="*"&&c()){l(),o="/";continue}if(t[s]==="{"){i++,o="{",s++;continue}if(t[s]==="}"){i--,o="}",s++;continue}if(i===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))p();if(!/\s/.test(t[s]))o=t[s];s++}return r.join(", ")}async function vp(e,t,r,n){if(!fo(e))return e;let i=e;if(t.skipSignalsRuntime)return i;let{output:s,setupCode:a}=await gp(i,r,n);if(i=s,i=await up(i,t),a){let c=Pn(i,/<\/head>/i),u=c===-1?Pn(i,/<body[^>]*>/i):-1;if(c!==-1)i=`${i.slice(0,c)}${a}
10546
+ `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<a-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},p=()=>{if(i!==0)return;let f=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(f){let w=f[2];if(!n.has(w))r.push(w),n.add(w);return}let m=t.slice(s).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(m){m[1].split(",").forEach((w)=>{let b=w.trim();if(!b)return;let S=b.indexOf(":"),x=(S>=0?b.slice(S+1).trim():b).split(/[\s=]/)[0];if(x&&!n.has(x))r.push(x),n.add(x)});return}let y=t.slice(s).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(y){y[1].split(",").forEach((w)=>{let b=w.trim().replace(/^\.\.\./,"");if(!b)return;let S=b.split(/[\s=]/)[0];if(S&&!n.has(S))r.push(S),n.add(S)});return}let g=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(g){let w=g[1];if(!n.has(w))r.push(w),n.add(w);return}let v=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(v){let w=v[1];if(!n.has(w))r.push(w),n.add(w)}};while(s<a){if(h())continue;if(t[s]==="'"||t[s]==='"'){u(t[s]),o=t[s-1];continue}if(t[s]==="`"){d(),o="`";continue}if(t[s]==="/"&&t[s+1]!=="/"&&t[s+1]!=="*"&&c()){l(),o="/";continue}if(t[s]==="{"){i++,o="{",s++;continue}if(t[s]==="}"){i--,o="}",s++;continue}if(i===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))p();if(!/\s/.test(t[s]))o=t[s];s++}return r.join(", ")}async function wp(e,t,r,n){if(!ho(e))return e;let i=e;if(t.skipSignalsRuntime)return i;let{output:s,setupCode:a}=await yp(i,r,n);if(i=s,i=await dp(i,t),a){let c=Mn(i,/<\/head>/i),u=c===-1?Mn(i,/<body[^>]*>/i):-1;if(c!==-1)i=`${i.slice(0,c)}${a}
10547
10547
  ${i.slice(c)}`;else if(u!==-1){let d=/<body[^>]*>/i.exec(i.slice(u))[0],h=u+d.length;i=`${i.slice(0,h)}
10548
10548
  ${a}${i.slice(h)}`}else i=`${i}
10549
- ${a}`}let o=i.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),l=o&&/data-stx/.test(o[1]);if(!a&&!l&&o&&!/data-stx-auto/.test(o[1])){let c=/<body[^>]*>/i,u=Pn(i,c);if(u!==-1){let d=i.slice(0,u),h=i.slice(u).replace(c,(p)=>p.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));i=d+h}}return i}function Pn(e,t){let r=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],i;while((i=r.exec(e))!==null)n.push([i.index,i.index+i[0].length]);let s=new RegExp(t.source,t.flags.replace(/[gy]/g,"")),a=0;while(a<e.length){let o=s.exec(e.slice(a));if(!o)return-1;let l=a+o.index;if(!n.some(([c,u])=>l>=c&&l<u))return l;a=l+Math.max(o[0].length,1)}return-1}function wp(e){let t=[];for(let r of e.split(",")){let n=r.trim();if(!n||n.startsWith("type "))continue;let i=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(i&&i[1]!==i[2])t.push(`${i[2]} = ${i[1]}`)}if(t.length===0)return Al;return`var ${t.join(", ")}; ${Al}`}var Zw=0,El=`(?:"[^"]*"|'[^']*'|[^>"'])*`,ho,zs,oi,bp,Al="/* [stx import stripped, resolved via window.stx in __stx_setup] */",li=R(()=>{Ii(),to(),nt(),zu(),Ce(),Bs(),Lr(),Ai(),ho=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,zs=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]),oi=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),bp=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});function Xw(e){let t=new WeakSet;try{let r=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");if(t.add(n),n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(r);let i={};for(let s of Object.keys(n).sort())i[s]=r(n[s]);return i};return JSON.stringify(r(e))}catch{return null}}function Cl(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e0(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Li(e){return!e0(e)}function Ni(e){try{let t=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");t=t.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let r=[];t=t.replace(/\{!![\s\S]*?!!\}/g,(i)=>{let s=r.length;return r.push(i),`"__STX_EXPR_${s}__"`}),t=t.replace(/\{\{\{[\s\S]*?\}\}\}/g,(i)=>{let s=r.length;return r.push(i),`"__STX_EXPR_${s}__"`}),t=t.replace(/\{\{[\s\S]*?\}\}/g,(i)=>{let s=r.length;return r.push(i),`"__STX_EXPR_${s}__"`});let n=new Bun.Transpiler({loader:"ts",target:"browser",define:Zt()}).transformSync(t);for(let i=0;i<r.length;i++)n=n.replace(`"__STX_EXPR_${i}__"`,r[i]),n=n.replace(`'__STX_EXPR_${i}__'`,r[i]);return n}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function t0(e){let t=[],r=new Set,n=0,i=0,s=e.length,a=(u)=>{i++;while(i<s){if(e[i]==="\\"){i+=2;continue}if(e[i]===u){i++;return}i++}},o=()=>{i++;while(i<s){if(e[i]==="\\"){i+=2;continue}if(e[i]==="`"){i++;return}if(e[i]==="$"&&e[i+1]==="{"){i+=2;let u=1;while(i<s&&u>0)if(e[i]==="{")u++,i++;else if(e[i]==="}")u--,i++;else if(e[i]==="'"||e[i]==='"')a(e[i]);else if(e[i]==="`")o();else i++;continue}i++}},l=()=>{if(e[i]==="/"&&e[i+1]==="/"){while(i<s&&e[i]!==`
10550
- `)i++;return!0}if(e[i]==="/"&&e[i+1]==="*"){i+=2;while(i<s-1&&!(e[i]==="*"&&e[i+1]==="/"))i++;return i+=2,!0}return!1},c=()=>{if(n!==0)return;let u=e.slice(i).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(u){let f=u[2].split(",").map((m)=>{let y=m.trim().split(":");return y[y.length-1].trim()});for(let m of f)if(m&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(m)&&!r.has(m))t.push(m),r.add(m);return}let d=e.slice(i).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(d){let f=d[2];if(!r.has(f))t.push(f),r.add(f);return}let h=e.slice(i).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(h){let f=h[1];if(!r.has(f))t.push(f),r.add(f);return}let p=e.slice(i).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(p){let f=p[1];if(!r.has(f))t.push(f),r.add(f)}};while(i<s){if(l())continue;if(e[i]==="'"||e[i]==='"'){a(e[i]);continue}if(e[i]==="`"){o();continue}if(e[i]==="{"){n++,i++;continue}if(e[i]==="}"){n--,i++;continue}if(n===0&&/[a-z]/i.test(e[i])&&(i===0||/\s|[;{}()]/.test(e[i-1])))c();i++}return t}function r0(e){let t=[],r=0,n=0,i=null;for(let s=0;s<e.length;s++){let a=e[s];if(i){if(a==="\\"){s++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0)t.push(e.slice(n,s)),n=s+1}if(n<e.length)t.push(e.slice(n));return t}function n0(e){let t=0,r=null;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(i==="\\"){n++;continue}if(i===r)r=null;continue}if(i==='"'||i==="'"||i==="`"){r=i;continue}if(i==="("||i==="["||i==="{")t++;else if(i===")"||i==="]"||i==="}")t--;else if(i==="="&&t===0){let s=e[n-1],a=e[n+1];if(s==="!"||s==="<"||s===">"||s==="=")continue;if(a==="="||a===">")continue;return n}}return-1}function i0(e,t){try{let r=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!r)return;let n=r.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let i=n,s=0,a=-1;for(;n>=0;n--){let l=e[n];if(l==="}")s++;else if(l==="{"){if(s--,s===0){a=n;break}}}if(a===-1)return;let o=e.slice(a+1,i);for(let l of r0(o)){let c=l.trim();if(!c||c.startsWith("..."))continue;let u=n0(c);if(u===-1)continue;let d=c.slice(0,u).trim();if(!/^[A-Z_$][\w$]*$/i.test(d))continue;if(t[d]!==void 0)continue;let h=c.slice(u+1).trim();if(!h)continue;try{let p=Object.keys(t),f=Function(...p,`"use strict"; return (${h});`);t[d]=f(...p.map((m)=>t[m]))}catch{}}}catch{}}async function Tl(e,t,r,n,i){let s=e.endsWith(".stx")?e.slice(0,-4):e,a=(y)=>y.split("-").map((g)=>g.charAt(0).toUpperCase()+g.slice(1)).join(""),o=(y)=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=r.__importedComponents;if(l){for(let y of[s,s.toLowerCase(),a(s),o(s)])if(l.has(y))return!0}let c=[...new Set([`${s}.stx`,`${a(s)}.stx`,`${o(s)}.stx`])],u=typeof i.root==="string"?M.resolve(i.root):void 0,d=u??M.dirname(n),h=[],p=(y)=>{if(y&&!h.includes(y))h.push(y)},f=r.__originalFilePath;if(f)p(M.join(M.dirname(f),"components"));p(t),p(i._rootComponentsDir),p(M.join(M.dirname(n),"components")),p(i.componentsDir);let m=i._pluginComponentDirs;if(Array.isArray(m))for(let y of m)p(typeof y==="string"?y:null);if(u)p(M.resolve(u,"resources/views/components")),p(M.resolve(u,"resources/components")),p(M.resolve(u,"src/components")),p(M.resolve(u,"components"));if(s.startsWith("./")||s.startsWith("../"))return Q(M.resolve(M.dirname(n),`${s}.stx`));for(let y of h){let g=M.isAbsolute(y)?y:M.resolve(d,y);for(let v of c)if(await Q(M.join(g,v)))return!0}return!1}function s0(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function a0(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function o0(e){let t=new Set,r=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let n of e){let i;while((i=r.exec(n))!==null)t.add(i[1]);r.lastIndex=0}return[...t]}async function Pi(e,t,r,n,i,s,a,o=new Set,l){let{extractVariables:c}=await X("stx/variable-extractor",()=>Promise.resolve().then(()=>(Di(),ji))),u=o??new Set;if(u.has(e))return`[Circular component reference: ${e}]`;let d=new Set(u);d.add(e);let h=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let p=h&&h!=="load"&&s0(h)?h:"";try{let f=(j)=>j.split("-").map((P)=>P.charAt(0).toUpperCase()+P.slice(1)).join(""),m=(j)=>j.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=e.endsWith(".stx")?e.slice(0,-4):e,g=null,v=i.__importedComponents;if(v){let j=[y,y.toLowerCase(),f(y),m(y)];for(let P of j)if(v.has(P)){g=v.get(P);break}}let w=[];if(!g){let j=[`${y}.stx`,`${f(y)}.stx`,`${m(y)}.stx`],P=[...new Set(j)],W=i.__originalFilePath,q=[];if(W){let se=M.join(M.dirname(W),"components");q.push(se)}if(n)q.push(n);let V=a._rootComponentsDir;if(typeof V==="string"&&!q.includes(V))q.push(V);let Me=M.join(M.dirname(s),"components");if(!q.includes(Me))q.push(Me);if(a.componentsDir&&a.componentsDir!==n&&!q.includes(a.componentsDir))q.push(a.componentsDir);let it=a._pluginComponentDirs;if(Array.isArray(it)){for(let se of it)if(typeof se==="string"&&!q.includes(se))q.push(se)}let Oe=typeof a.root==="string"?M.resolve(a.root):void 0,Be=Oe??M.dirname(s),ze=[];if(Oe)ze.push(M.resolve(Oe,"resources/views/components")),ze.push(M.resolve(Oe,"resources/components")),ze.push(M.resolve(Oe,"src/components")),ze.push(M.resolve(Oe,"components"));ze.push(M.resolve(import.meta.dir,"components"));for(let se of ze)if(!q.includes(se))q.push(se);let At=[...new Set(q.map((se)=>{if(!se)return se;return M.isAbsolute(se)?se:M.resolve(Be,se)}))];q.length=0,q.push(...At);let pt=`${y}\x00${s}\x00${At.join("\x00")}`,J=Qr.get(pt);if(J)if(await Q(J))g=J;else Qr.delete(pt);if(!g&&(y.startsWith("./")||y.startsWith("../")))g=M.resolve(M.dirname(s),`${y}.stx`),w.push(g);else if(!g)for(let se of q){if(!se)continue;for(let Ct of P){let ft=M.join(se,Ct);if(w.push(ft),await Q(ft)){g=ft;break}}if(g)break;if(!g)try{let Ct=await import("fs");if(!Ct.statSync(se,{throwIfNoEntry:!1})?.isDirectory())continue;let ft=8,tr=[{path:se,depth:0}];while(tr.length>0&&!g){let Tt=tr.pop();if(Tt.depth>=ft)continue;let Rt;try{Rt=Ct.readdirSync(Tt.path,{withFileTypes:!0})}catch{continue}for(let rr of Rt){if(!rr.isDirectory())continue;if(rr.name==="node_modules"||rr.name.startsWith("."))continue;let rl=M.join(Tt.path,rr.name);for(let Rg of P){let Yi=M.join(rl,Rg);if(w.push(Yi),await Q(Yi)){g=Yi;break}}if(g)break;tr.push({path:rl,depth:Tt.depth+1})}}}catch{}if(g)break}if(g)Qr.set(pt,g)}if(!g||!await Q(g)){let j=w.length>0?`
10549
+ ${a}`}let o=i.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),l=o&&/data-stx/.test(o[1]);if(!a&&!l&&o&&!/data-stx-auto/.test(o[1])){let c=/<body[^>]*>/i,u=Mn(i,c);if(u!==-1){let d=i.slice(0,u),h=i.slice(u).replace(c,(p)=>p.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));i=d+h}}return i}function Mn(e,t){let r=/<(script|style)\b[\s\S]*?<\/\1>/gi,n=[],i;while((i=r.exec(e))!==null)n.push([i.index,i.index+i[0].length]);let s=new RegExp(t.source,t.flags.replace(/[gy]/g,"")),a=0;while(a<e.length){let o=s.exec(e.slice(a));if(!o)return-1;let l=a+o.index;if(!n.some(([c,u])=>l>=c&&l<u))return l;a=l+Math.max(o[0].length,1)}return-1}function bp(e){let t=[];for(let r of e.split(",")){let n=r.trim();if(!n||n.startsWith("type "))continue;let i=n.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(i&&i[1]!==i[2])t.push(`${i[2]} = ${i[1]}`)}if(t.length===0)return Cl;return`var ${t.join(", ")}; ${Cl}`}var Qw=0,Al=`(?:"[^"]*"|'[^']*'|[^>"'])*`,mo,Fs,li,xp,Cl="/* [stx import stripped, resolved via window.stx in __stx_setup] */",ci=R(()=>{Oi(),ro(),it(),Fu(),Te(),zs(),Nr(),Ci(),mo=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s,Fs=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]),li=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),xp=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});function eb(e){let t=new WeakSet;try{let r=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");if(t.add(n),n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(r);let i={};for(let s of Object.keys(n).sort())i[s]=r(n[s]);return i};return JSON.stringify(r(e))}catch{return null}}function Tl(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function tb(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function Ni(e){return!tb(e)}function Pi(e){try{let t=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");t=t.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let r=[];t=t.replace(/\{!![\s\S]*?!!\}/g,(i)=>{let s=r.length;return r.push(i),`"__STX_EXPR_${s}__"`}),t=t.replace(/\{\{\{[\s\S]*?\}\}\}/g,(i)=>{let s=r.length;return r.push(i),`"__STX_EXPR_${s}__"`}),t=t.replace(/\{\{[\s\S]*?\}\}/g,(i)=>{let s=r.length;return r.push(i),`"__STX_EXPR_${s}__"`});let n=new Bun.Transpiler({loader:"ts",target:"browser",define:Qt()}).transformSync(t);for(let i=0;i<r.length;i++)n=n.replace(`"__STX_EXPR_${i}__"`,r[i]),n=n.replace(`'__STX_EXPR_${i}__'`,r[i]);return n}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function rb(e){let t=[],r=new Set,n=0,i=0,s=e.length,a=(u)=>{i++;while(i<s){if(e[i]==="\\"){i+=2;continue}if(e[i]===u){i++;return}i++}},o=()=>{i++;while(i<s){if(e[i]==="\\"){i+=2;continue}if(e[i]==="`"){i++;return}if(e[i]==="$"&&e[i+1]==="{"){i+=2;let u=1;while(i<s&&u>0)if(e[i]==="{")u++,i++;else if(e[i]==="}")u--,i++;else if(e[i]==="'"||e[i]==='"')a(e[i]);else if(e[i]==="`")o();else i++;continue}i++}},l=()=>{if(e[i]==="/"&&e[i+1]==="/"){while(i<s&&e[i]!==`
10550
+ `)i++;return!0}if(e[i]==="/"&&e[i+1]==="*"){i+=2;while(i<s-1&&!(e[i]==="*"&&e[i+1]==="/"))i++;return i+=2,!0}return!1},c=()=>{if(n!==0)return;let u=e.slice(i).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(u){let f=u[2].split(",").map((m)=>{let y=m.trim().split(":");return y[y.length-1].trim()});for(let m of f)if(m&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(m)&&!r.has(m))t.push(m),r.add(m);return}let d=e.slice(i).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(d){let f=d[2];if(!r.has(f))t.push(f),r.add(f);return}let h=e.slice(i).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(h){let f=h[1];if(!r.has(f))t.push(f),r.add(f);return}let p=e.slice(i).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(p){let f=p[1];if(!r.has(f))t.push(f),r.add(f)}};while(i<s){if(l())continue;if(e[i]==="'"||e[i]==='"'){a(e[i]);continue}if(e[i]==="`"){o();continue}if(e[i]==="{"){n++,i++;continue}if(e[i]==="}"){n--,i++;continue}if(n===0&&/[a-z]/i.test(e[i])&&(i===0||/\s|[;{}()]/.test(e[i-1])))c();i++}return t}function nb(e){let t=[],r=0,n=0,i=null;for(let s=0;s<e.length;s++){let a=e[s];if(i){if(a==="\\"){s++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0)t.push(e.slice(n,s)),n=s+1}if(n<e.length)t.push(e.slice(n));return t}function ib(e){let t=0,r=null;for(let n=0;n<e.length;n++){let i=e[n];if(r){if(i==="\\"){n++;continue}if(i===r)r=null;continue}if(i==='"'||i==="'"||i==="`"){r=i;continue}if(i==="("||i==="["||i==="{")t++;else if(i===")"||i==="]"||i==="}")t--;else if(i==="="&&t===0){let s=e[n-1],a=e[n+1];if(s==="!"||s==="<"||s===">"||s==="=")continue;if(a==="="||a===">")continue;return n}}return-1}function sb(e,t){try{let r=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!r)return;let n=r.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let i=n,s=0,a=-1;for(;n>=0;n--){let l=e[n];if(l==="}")s++;else if(l==="{"){if(s--,s===0){a=n;break}}}if(a===-1)return;let o=e.slice(a+1,i);for(let l of nb(o)){let c=l.trim();if(!c||c.startsWith("..."))continue;let u=ib(c);if(u===-1)continue;let d=c.slice(0,u).trim();if(!/^[A-Z_$][\w$]*$/i.test(d))continue;if(t[d]!==void 0)continue;let h=c.slice(u+1).trim();if(!h)continue;try{let p=Object.keys(t),f=Function(...p,`"use strict"; return (${h});`);t[d]=f(...p.map((m)=>t[m]))}catch{}}}catch{}}async function Rl(e,t,r,n,i){let s=e.endsWith(".stx")?e.slice(0,-4):e,a=(y)=>y.split("-").map((g)=>g.charAt(0).toUpperCase()+g.slice(1)).join(""),o=(y)=>y.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),l=r.__importedComponents;if(l){for(let y of[s,s.toLowerCase(),a(s),o(s)])if(l.has(y))return!0}let c=[...new Set([`${s}.stx`,`${a(s)}.stx`,`${o(s)}.stx`])],u=typeof i.root==="string"?B.resolve(i.root):void 0,d=u??B.dirname(n),h=[],p=(y)=>{if(y&&!h.includes(y))h.push(y)},f=r.__originalFilePath;if(f)p(B.join(B.dirname(f),"components"));p(t),p(i._rootComponentsDir),p(B.join(B.dirname(n),"components")),p(i.componentsDir);let m=i._pluginComponentDirs;if(Array.isArray(m))for(let y of m)p(typeof y==="string"?y:null);if(u)p(B.resolve(u,"resources/views/components")),p(B.resolve(u,"resources/components")),p(B.resolve(u,"src/components")),p(B.resolve(u,"components"));if(s.startsWith("./")||s.startsWith("../"))return X(B.resolve(B.dirname(n),`${s}.stx`));for(let y of h){let g=B.isAbsolute(y)?y:B.resolve(d,y);for(let v of c)if(await X(B.join(g,v)))return!0}return!1}function ab(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function ob(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function lb(e){let t=new Set,r=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let n of e){let i;while((i=r.exec(n))!==null)t.add(i[1]);r.lastIndex=0}return[...t]}async function Mi(e,t,r,n,i,s,a,o=new Set,l){let{extractVariables:c}=await ee("stx/variable-extractor",()=>Promise.resolve().then(()=>($i(),Di))),u=o??new Set;if(u.has(e))return`[Circular component reference: ${e}]`;let d=new Set(u);d.add(e);let h=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let p=h&&h!=="load"&&ab(h)?h:"";try{let f=(j)=>j.split("-").map((M)=>M.charAt(0).toUpperCase()+M.slice(1)).join(""),m=(j)=>j.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),y=e.endsWith(".stx")?e.slice(0,-4):e,g=null,v=i.__importedComponents;if(v){let j=[y,y.toLowerCase(),f(y),m(y)];for(let M of j)if(v.has(M)){g=v.get(M);break}}let w=[];if(!g){let j=[`${y}.stx`,`${f(y)}.stx`,`${m(y)}.stx`],M=[...new Set(j)],H=i.__originalFilePath,W=[];if(H){let ae=B.join(B.dirname(H),"components");W.push(ae)}if(n)W.push(n);let J=a._rootComponentsDir;if(typeof J==="string"&&!W.includes(J))W.push(J);let Be=B.join(B.dirname(s),"components");if(!W.includes(Be))W.push(Be);if(a.componentsDir&&a.componentsDir!==n&&!W.includes(a.componentsDir))W.push(a.componentsDir);let st=a._pluginComponentDirs;if(Array.isArray(st)){for(let ae of st)if(typeof ae==="string"&&!W.includes(ae))W.push(ae)}let je=typeof a.root==="string"?B.resolve(a.root):void 0,ze=je??B.dirname(s),Fe=[];if(je)Fe.push(B.resolve(je,"resources/views/components")),Fe.push(B.resolve(je,"resources/components")),Fe.push(B.resolve(je,"src/components")),Fe.push(B.resolve(je,"components"));Fe.push(B.resolve(import.meta.dir,"components"));for(let ae of Fe)if(!W.includes(ae))W.push(ae);let Ct=[...new Set(W.map((ae)=>{if(!ae)return ae;return B.isAbsolute(ae)?ae:B.resolve(ze,ae)}))];W.length=0,W.push(...Ct);let ft=`${y}\x00${s}\x00${Ct.join("\x00")}`,Y=Xr.get(ft);if(Y)if(await X(Y))g=Y;else Xr.delete(ft);if(!g&&(y.startsWith("./")||y.startsWith("../")))g=B.resolve(B.dirname(s),`${y}.stx`),w.push(g);else if(!g)for(let ae of W){if(!ae)continue;for(let Tt of M){let ht=B.join(ae,Tt);if(w.push(ht),await X(ht)){g=ht;break}}if(g)break;if(!g)try{let Tt=await import("fs");if(!Tt.statSync(ae,{throwIfNoEntry:!1})?.isDirectory())continue;let ht=8,rr=[{path:ae,depth:0}];while(rr.length>0&&!g){let Rt=rr.pop();if(Rt.depth>=ht)continue;let It;try{It=Tt.readdirSync(Rt.path,{withFileTypes:!0})}catch{continue}for(let nr of It){if(!nr.isDirectory())continue;if(nr.name==="node_modules"||nr.name.startsWith("."))continue;let nl=B.join(Rt.path,nr.name);for(let Ig of M){let Ki=B.join(nl,Ig);if(w.push(Ki),await X(Ki)){g=Ki;break}}if(g)break;rr.push({path:nl,depth:Rt.depth+1})}}}catch{}if(g)break}if(g)Xr.set(ft,g)}if(!g||!await X(g)){let j=w.length>0?`
10551
10551
  Searched paths:
10552
- ${w.map((P)=>` - ${P}`).join(`
10553
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${e}']${j}`}l.add(g);let b;if(Zr.has(g))b=Zr.get(g);else try{b=await Bun.file(g).text(),Zr.set(g,b)}catch(j){return`[Error loading component: ${j instanceof Error?j.message:String(j)}]`}let S=new Set(["__originalFilePath","__importedComponents",Ba,"__stx_client_signal_names"]),x={};for(let[j,P]of Object.entries(i))if(!j.startsWith("__")||S.has(j))x[j]=P;let{extractSlotContent:_}=await X("stx/slots",()=>Promise.resolve().then(()=>(Sl(),Ls))),E=_(r),k={};if(E.defaultSlot?.trim())k.default=E.defaultSlot;for(let[j,P]of E.namedSlots)k[j]=P.content;let A={...x,...t,props:t,slot:r,$slots:k,__processedComponents:d,__sections:{},__stx_signals_gate:Nr(b)||a0(r)};i0(b,A);let T=b,C=xd(T);if(C)T=C.content.trim();let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...b.matchAll(D)],O=[],L=I.some((j)=>/\bserver\b/.test(j[1]||"")&&/\bcache\b/.test(j[1]||""))&&I.every((j)=>/\bserver\b/.test(j[1]||"")),N=null,B=null;if(L){let j=Xw({props:t,slot:r,buildMode:a.buildMode??"",skipEventDirectives:a.skipEventDirectives===!0});if(j!==null){N=`${g}\x00${j}`;let P=ci.get(N);if(P){for(let W of P.dependencies)l.add(W);return P.output}B=new Set(l)}}for(let j of I){let P=j[1]||"",W=j[2]||"",q=P.includes("server");if(Li(P)&&W.trim())W=Ni(W);if(q&&W)try{await c(W,A,g)}catch(V){}if(!q){let V=W.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Me=V.includes("{{")&&V.includes("}}"),it=V.includes("{!!")&&V.includes("!!}");if(Me||it)V=Za(V,A);let Oe=P.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");O.push(`<script${Oe}>${V}</script>`)}}let F=b.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),K=F?F[1]:"",Te=F?F[2]:"",ae="",ye=K&&/\bscoped\b/i.test(K);if(F)ae=`<style${K}>${Te}</style>`;let z=T;if(z=z.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),F)z=z.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let j=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,P=[];if(z=z.replace(j,(W,q)=>{let V=q.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(V)P.push(`<style${V[1]}>${V[2]}</style>`);return""}),z=z.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),P.length>0)ae=`${ae}${P.join(`
10554
- `)}`}if(r&&z.includes("{{ text || slot }}"))z=z.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:G}=await X("stx/slots",()=>Promise.resolve().then(()=>(Sl(),Ls))),{defaultSlot:ve,namedSlots:Ie}=E;z=await G(z,ve,Ie,A);let er=O.some((j)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(j)),H=o0(O),ne=Array.isArray(A.__stx_client_signal_names)?A.__stx_client_signal_names:[];if(H.length>0||ne.length>0)A.__stx_client_signal_names=[...new Set([...ne,...H])];let ie={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:M.dirname(g),skipSignalsRuntime:!0,skipEventDirectives:er||O.length===0,defaultLayout:void 0};A.__stxProcessingDepth=(i.__stxProcessingDepth||0)+1;let _e=await me(z,A,g,ie,l),we=new Set(Array.isArray(i.__stx_preserved_client_expressions)?i.__stx_preserved_client_expressions:[]);for(let j of _e.matchAll(/\{\{([\s\S]*?)\}\}/g))we.add(j[1].trim());if(we.size>0)i.__stx_preserved_client_expressions=[...we];let He=`stx_${y.replace(/[^a-zA-Z0-9]/g,"_")}_${++d0}_${Math.random().toString(36).slice(2,8)}`,$=_e;if(er){let j="";if(Object.keys(t).length>0)try{j=` data-stx-props="${Cl(JSON.stringify(t))}"`}catch{}let P=p?` stx-hydrate="${Cl(p)}"`:"";$=`<div data-stx-scope="${He}"${j}${P}>${_e}</div>`;let W=await Promise.all(O.map(async(q)=>{let V=q.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!V)return q;let[,Me,it]=V,Oe=Oa(it,{filePath:g,projectRoot:process.cwd()}),Be=Oe.code,ze=ja(Oe.styles);Be=Ri(Be).code;let{hasUserImports:At,bundleClientScript:pt}=await X("stx/client-script-bundler",()=>Promise.resolve().then(()=>(Ti(),pn)));if(At(Be))Be=await pt(Be,g,{projectRoot:process.cwd(),minify:a.buildMode==="compile"});let{rewriteStxImportSpecifiers:J}=await X("stx/signal-processing",()=>Promise.resolve().then(()=>(li(),ai)));Be=Be.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(Rt,rr)=>J(rr));let se=Ut(Be),Ct=t0(se),ft=`function(__scopeId) {
10555
- ${Ta("const",[...Cu,...Ct],se)}
10552
+ ${w.map((M)=>` - ${M}`).join(`
10553
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${e}']${j}`}l.add(g);let b;if(Qr.has(g))b=Qr.get(g);else try{b=await Bun.file(g).text(),Qr.set(g,b)}catch(j){return`[Error loading component: ${j instanceof Error?j.message:String(j)}]`}let S=new Set(["__originalFilePath","__importedComponents",za,"__stx_client_signal_names"]),x={};for(let[j,M]of Object.entries(i))if(!j.startsWith("__")||S.has(j))x[j]=M;let{extractSlotContent:_}=await ee("stx/slots",()=>Promise.resolve().then(()=>(_l(),Ns))),E=_(r),k={};if(E.defaultSlot?.trim())k.default=E.defaultSlot;for(let[j,M]of E.namedSlots)k[j]=M.content;let A={...x,...t,props:t,slot:r,$slots:k,__processedComponents:d,__sections:{},__stx_signals_gate:Pr(b)||ob(r)};sb(b,A);let T=b,C=Sd(T);if(C)T=C.content.trim();let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...b.matchAll(D)],O=[],N=I.some((j)=>/\bserver\b/.test(j[1]||"")&&/\bcache\b/.test(j[1]||""))&&I.every((j)=>/\bserver\b/.test(j[1]||"")),P=null,z=null;if(N){let j=eb({props:t,slot:r,buildMode:a.buildMode??"",skipEventDirectives:a.skipEventDirectives===!0});if(j!==null){P=`${g}\x00${j}`;let M=ui.get(P);if(M){for(let H of M.dependencies)l.add(H);return M.output}z=new Set(l)}}for(let j of I){let M=j[1]||"",H=j[2]||"",W=M.includes("server");if(Ni(M)&&H.trim())H=Pi(H);if(W&&H)try{await c(H,A,g)}catch(J){}if(!W){let J=H.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),Be=J.includes("{{")&&J.includes("}}"),st=J.includes("{!!")&&J.includes("!!}");if(Be||st)J=Qa(J,A);let je=M.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");O.push(`<script${je}>${J}</script>`)}}let q=b.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Z=q?q[1]:"",Re=q?q[2]:"",oe="",ve=Z&&/\bscoped\b/i.test(Z);if(q)oe=`<style${Z}>${Re}</style>`;let F=T;if(F=F.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q)F=F.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let j=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,M=[];if(F=F.replace(j,(H,W)=>{let J=W.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(J)M.push(`<style${J[1]}>${J[2]}</style>`);return""}),F=F.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),M.length>0)oe=`${oe}${M.join(`
10554
+ `)}`}if(r&&F.includes("{{ text || slot }}"))F=F.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>r);let{applySlots:V}=await ee("stx/slots",()=>Promise.resolve().then(()=>(_l(),Ns))),{defaultSlot:we,namedSlots:Oe}=E;F=await V(F,we,Oe,A);let tr=O.some((j)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(j)),U=lb(O),ie=Array.isArray(A.__stx_client_signal_names)?A.__stx_client_signal_names:[];if(U.length>0||ie.length>0)A.__stx_client_signal_names=[...new Set([...ie,...U])];let se={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:B.dirname(g),skipSignalsRuntime:!0,skipEventDirectives:tr||O.length===0,defaultLayout:void 0};A.__stxProcessingDepth=(i.__stxProcessingDepth||0)+1;let ke=await ge(F,A,g,se,l),be=new Set(Array.isArray(i.__stx_preserved_client_expressions)?i.__stx_preserved_client_expressions:[]);for(let j of ke.matchAll(/\{\{([\s\S]*?)\}\}/g))be.add(j[1].trim());if(be.size>0)i.__stx_preserved_client_expressions=[...be];let Ue=`stx_${y.replace(/[^a-zA-Z0-9]/g,"_")}_${++pb}_${Math.random().toString(36).slice(2,8)}`,L=ke;if(tr){let j="";if(Object.keys(t).length>0)try{j=` data-stx-props="${Tl(JSON.stringify(t))}"`}catch{}let M=p?` stx-hydrate="${Tl(p)}"`:"";L=`<div data-stx-scope="${Ue}"${j}${M}>${ke}</div>`;let H=await Promise.all(O.map(async(W)=>{let J=W.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!J)return W;let[,Be,st]=J,je=ja(st,{filePath:g,projectRoot:process.cwd()}),ze=je.code,Fe=Da(je.styles);ze=Ii(ze).code;let{hasUserImports:Ct,bundleClientScript:ft}=await ee("stx/client-script-bundler",()=>Promise.resolve().then(()=>(Ri(),fn)));if(Ct(ze))ze=await ft(ze,g,{projectRoot:process.cwd(),minify:a.buildMode==="compile"});let{rewriteStxImportSpecifiers:Y}=await ee("stx/signal-processing",()=>Promise.resolve().then(()=>(ci(),oi)));ze=ze.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(It,nr)=>Y(nr));let ae=Gt(ze),Tt=rb(ae),ht=`function(__scopeId) {
10555
+ ${Ra("const",[...Tu,...Tt],ae)}
10556
10556
  const __scope = window.stx._scopes = window.stx._scopes || {};
10557
10557
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
10558
10558
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -10566,12 +10566,12 @@ ${w.map((P)=>` - ${P}`).join(`
10566
10566
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
10567
10567
 
10568
10568
  try {
10569
- ${se}
10569
+ ${ae}
10570
10570
 
10571
10571
  // Register all defined signals and functions in this scope
10572
10572
  const __localVars = {};
10573
10573
  try {
10574
- ${Ct.map((Rt)=>`if (typeof ${Rt} !== 'undefined') __localVars['${Rt}'] = ${Rt};`).join(`
10574
+ ${Tt.map((It)=>`if (typeof ${It} !== 'undefined') __localVars['${It}'] = ${It};`).join(`
10575
10575
  `)}
10576
10576
  }
10577
10577
  catch (e) {}
@@ -10580,29 +10580,29 @@ catch (e) {}
10580
10580
  finally {
10581
10581
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
10582
10582
  }
10583
- }`,tr=p?null:nv(i,ft),Tt=tr?`window.__stxComponentFactories[${JSON.stringify(tr)}](${JSON.stringify(He)});`:`(${ft})(${JSON.stringify(He)});`;if(p)return`${ze}<script type="stx/island" data-stx-island="${He}" data-stx-scoped${Me}>${Tt}</script>`;return`${ze}<script data-stx-scoped data-stx-run="always"${Me}>${Tt}</script>`}));if($=$+`
10584
- `+W.join(`
10585
- `),ae)$+=`
10586
- `+ae}else{if(ae)$+=`
10587
- `+ae;if(O.length>0){let j=A.__stx_event_bindings||[],P=$a(A),W=await Promise.all(O.map(async(q)=>{let V=q.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!V)return q;return await Na(V[1],{eventBindings:j,templateContent:$,filePath:g,projectRoot:process.cwd(),serverData:P})}));$+=`
10588
- `+W.join(`
10589
- `),A.__stx_event_bindings=[]}}if(ye){let j=vd($,g);if(j.hasScoped)$=j.html}if(N&&B)ci.set(N,{output:$,dependencies:[...l].filter((j)=>!B.has(j))});return $}catch(f){return`[Error processing component: ${f instanceof Error?f.message:String(f)}]`}finally{u.delete(e)}}async function Q(e){return Bun.file(e).exists()}function Fs(e,t){let r=M.resolve(t),n=M.resolve(e),i=r.endsWith(M.sep)?r:r+M.sep;if(n===r||n.startsWith(i))return n;return null}async function l0(e,t,r,n){let i=await c0(e,t,r,n);if(i===null)return null;let s=Fs(i,process.cwd());if(s)return s;let a=[r.root,r.layoutsDir,r.componentsDir,r.partialsDir,r.pagesDir].filter((o)=>typeof o==="string"&&o.length>0);for(let o of a){let l=M.isAbsolute(o)?o:M.resolve(process.cwd(),o);if(Fs(i,l))return M.resolve(i)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${i} (template: ${e}, from: ${t})`),null}async function c0(e,t,r,n){if(r.debug)console.log(`Resolving template path: ${e} from ${t}`);let i=M.dirname(t),s=process.cwd();if(e.startsWith("/")){let h=M.join(s,e),p=Fs(h,s);if(!p)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(r.debug)console.log(`Checking absolute path: ${p}`);if(await Q(p)&&n)n.add(p);return p}let a=M.join(i,e);if(await Q(a)){if(r.debug)console.log(`Found direct path: ${a}`);if(n)n.add(a);return a}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let h of[".stx",".tsx",".jsx"]){let p=`${a}${h}`;if(await Q(p)){if(r.debug)console.log(`Found direct path with extension: ${p}`);if(n)n.add(p);return p}}let o="",l=M.resolve(i),c=process.cwd();for(let h=0;h<10;h++){let p=M.join(l,"layouts"),f=!1;try{f=Qw.statSync(p,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(f){o=p;break}let m=M.dirname(l);if(m===l||m.length<c.length)break;l=m}if(o){let h=e.startsWith("layouts/")?e.slice(8):e,p=M.join(o,h);if(await Q(p)){if(r.debug)console.log(`Found in current layouts dir: ${p}`);if(n)n.add(p);return p}if(!h.endsWith(".stx")){let f=`${p}.stx`;if(await Q(f)){if(r.debug)console.log(`Found in current layouts dir with extension: ${f}`);if(n)n.add(f);return f}}}if(r.layoutsDir){let h=M.isAbsolute(r.layoutsDir)?r.layoutsDir:M.resolve(process.cwd(),r.layoutsDir),p=e.startsWith("layouts/")?e.slice(8):e,f=M.join(h,p);if(await Q(f)){if(r.debug)console.log(`Found in options.layoutsDir: ${f}`);if(n)n.add(f);return f}if(!e.endsWith(".stx")){let m=`${f}.stx`;if(await Q(m)){if(r.debug)console.log(`Found in options.layoutsDir with extension: ${m}`);if(n)n.add(m);return m}}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let h=e.split("layouts/"),p=M.join(r.partialsDir||i,"layouts",h[1]);if(await Q(p)){if(r.debug)console.log(`Found in layouts path: ${p}`);if(n)n.add(p);return p}if(!p.endsWith(".stx")){let f=`${p}.stx`;if(await Q(f)){if(r.debug)console.log(`Found in layouts path with extension: ${f}`);if(n)n.add(f);return f}}}if(r.partialsDir){if(o=M.join(r.partialsDir,"layouts"),await Q(o)){let h=M.join(o,e);if(await Q(h)){if(r.debug)console.log(`Found in partials layouts dir: ${h}`);if(n)n.add(h);return h}if(!e.endsWith(".stx")){let p=`${h}.stx`;if(await Q(p)){if(r.debug)console.log(`Found in partials layouts dir with extension: ${p}`);if(n)n.add(p);return p}}}}let u=r.partialsDir||M.join(process.cwd(),"views"),d=M.join(u,e);if(await Q(d)){if(r.debug)console.log(`Found in views path: ${d}`);if(n)n.add(d);return d}if(!e.endsWith(".stx")){let h=`${d}.stx`;if(await Q(h)){if(r.debug)console.log(`Found in views path with extension: ${h}`);if(n)n.add(h);return h}}if(i.includes("temp")){let h=M.join(M.dirname(i),"layouts",e);if(await Q(h)){if(r.debug)console.log(`Found in temp layouts dir: ${h}`);if(n)n.add(h);return h}if(!e.endsWith(".stx")){let p=`${h}.stx`;if(await Q(p)){if(r.debug)console.log(`Found in temp layouts dir with extension: ${p}`);if(n)n.add(p);return p}}}if(r.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function xp(e,t,r){let n=0,i="",s="";try{if(typeof t==="number"&&t>=0){let a=e.split(`
10583
+ }`,rr=p?null:iv(i,ht),Rt=rr?`window.__stxComponentFactories[${JSON.stringify(rr)}](${JSON.stringify(Ue)});`:`(${ht})(${JSON.stringify(Ue)});`;if(p)return`${Fe}<script type="stx/island" data-stx-island="${Ue}" data-stx-scoped${Be}>${Rt}</script>`;return`${Fe}<script data-stx-scoped data-stx-run="always"${Be}>${Rt}</script>`}));if(L=L+`
10584
+ `+H.join(`
10585
+ `),oe)L+=`
10586
+ `+oe}else{if(oe)L+=`
10587
+ `+oe;if(O.length>0){let j=A.__stx_event_bindings||[],M=La(A),H=await Promise.all(O.map(async(W)=>{let J=W.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!J)return W;return await Pa(J[1],{eventBindings:j,templateContent:L,filePath:g,projectRoot:process.cwd(),serverData:M})}));L+=`
10588
+ `+H.join(`
10589
+ `),A.__stx_event_bindings=[]}}if(ve){let j=wd(L,g);if(j.hasScoped)L=j.html}if(P&&z)ui.set(P,{output:L,dependencies:[...l].filter((j)=>!z.has(j))});return L}catch(f){return`[Error processing component: ${f instanceof Error?f.message:String(f)}]`}finally{u.delete(e)}}async function X(e){return Bun.file(e).exists()}function qs(e,t){let r=B.resolve(t),n=B.resolve(e),i=r.endsWith(B.sep)?r:r+B.sep;if(n===r||n.startsWith(i))return n;return null}async function cb(e,t,r,n){let i=await ub(e,t,r,n);if(i===null)return null;let s=qs(i,process.cwd());if(s)return s;let a=[r.root,r.layoutsDir,r.componentsDir,r.partialsDir,r.pagesDir].filter((o)=>typeof o==="string"&&o.length>0);for(let o of a){let l=B.isAbsolute(o)?o:B.resolve(process.cwd(),o);if(qs(i,l))return B.resolve(i)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${i} (template: ${e}, from: ${t})`),null}async function ub(e,t,r,n){if(r.debug)console.log(`Resolving template path: ${e} from ${t}`);let i=B.dirname(t),s=process.cwd();if(e.startsWith("/")){let h=B.join(s,e),p=qs(h,s);if(!p)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(r.debug)console.log(`Checking absolute path: ${p}`);if(await X(p)&&n)n.add(p);return p}let a=B.join(i,e);if(await X(a)){if(r.debug)console.log(`Found direct path: ${a}`);if(n)n.add(a);return a}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let h of[".stx",".tsx",".jsx"]){let p=`${a}${h}`;if(await X(p)){if(r.debug)console.log(`Found direct path with extension: ${p}`);if(n)n.add(p);return p}}let o="",l=B.resolve(i),c=process.cwd();for(let h=0;h<10;h++){let p=B.join(l,"layouts"),f=!1;try{f=Xw.statSync(p,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(f){o=p;break}let m=B.dirname(l);if(m===l||m.length<c.length)break;l=m}if(o){let h=e.startsWith("layouts/")?e.slice(8):e,p=B.join(o,h);if(await X(p)){if(r.debug)console.log(`Found in current layouts dir: ${p}`);if(n)n.add(p);return p}if(!h.endsWith(".stx")){let f=`${p}.stx`;if(await X(f)){if(r.debug)console.log(`Found in current layouts dir with extension: ${f}`);if(n)n.add(f);return f}}}if(r.layoutsDir){let h=B.isAbsolute(r.layoutsDir)?r.layoutsDir:B.resolve(process.cwd(),r.layoutsDir),p=e.startsWith("layouts/")?e.slice(8):e,f=B.join(h,p);if(await X(f)){if(r.debug)console.log(`Found in options.layoutsDir: ${f}`);if(n)n.add(f);return f}if(!e.endsWith(".stx")){let m=`${f}.stx`;if(await X(m)){if(r.debug)console.log(`Found in options.layoutsDir with extension: ${m}`);if(n)n.add(m);return m}}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let h=e.split("layouts/"),p=B.join(r.partialsDir||i,"layouts",h[1]);if(await X(p)){if(r.debug)console.log(`Found in layouts path: ${p}`);if(n)n.add(p);return p}if(!p.endsWith(".stx")){let f=`${p}.stx`;if(await X(f)){if(r.debug)console.log(`Found in layouts path with extension: ${f}`);if(n)n.add(f);return f}}}if(r.partialsDir){if(o=B.join(r.partialsDir,"layouts"),await X(o)){let h=B.join(o,e);if(await X(h)){if(r.debug)console.log(`Found in partials layouts dir: ${h}`);if(n)n.add(h);return h}if(!e.endsWith(".stx")){let p=`${h}.stx`;if(await X(p)){if(r.debug)console.log(`Found in partials layouts dir with extension: ${p}`);if(n)n.add(p);return p}}}}let u=r.partialsDir||B.join(process.cwd(),"views"),d=B.join(u,e);if(await X(d)){if(r.debug)console.log(`Found in views path: ${d}`);if(n)n.add(d);return d}if(!e.endsWith(".stx")){let h=`${d}.stx`;if(await X(h)){if(r.debug)console.log(`Found in views path with extension: ${h}`);if(n)n.add(h);return h}}if(i.includes("temp")){let h=B.join(B.dirname(i),"layouts",e);if(await X(h)){if(r.debug)console.log(`Found in temp layouts dir: ${h}`);if(n)n.add(h);return h}if(!e.endsWith(".stx")){let p=`${h}.stx`;if(await X(p)){if(r.debug)console.log(`Found in temp layouts dir with extension: ${p}`);if(n)n.add(p);return p}}}if(r.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function Sp(e,t,r){let n=0,i="",s="";try{if(typeof t==="number"&&t>=0){let a=e.split(`
10590
10590
  `),o=0;for(let l=0;l<a.length;l++)if(o+=a[l].length+1,o>=t){n=l+1,i=a[l].trim();let c=Math.max(0,l-2),u=Math.min(a.length,l+3);s=a.slice(c,u).map((d,h)=>{let p=c+h+1;return`${p===n?"> ":" "}${p}: ${d}`}).join(`
10591
- `);break}}else if(r){let a=e.indexOf(r);if(a>=0)return xp(e,a)}}catch{}return{lineNumber:n,lineContent:i,context:s}}function Ae(e,t,r,n,i,s){let{lineNumber:a,context:o}=xp(n,i,s),l=r.split("/").pop(),c=0;if(typeof i==="number"&&i>=0&&n){let d=n.lastIndexOf(`
10591
+ `);break}}else if(r){let a=e.indexOf(r);if(a>=0)return Sp(e,a)}}catch{}return{lineNumber:n,lineContent:i,context:s}}function Ce(e,t,r,n,i,s){let{lineNumber:a,context:o}=Sp(n,i,s),l=r.split("/").pop(),c=0;if(typeof i==="number"&&i>=0&&n){let d=n.lastIndexOf(`
10592
10592
  `,Math.max(0,i-1));c=i-(d+1)+1}let u="";if(a>0)u+=`
10593
10593
  ${r}:${a}${c>0?`:${c}`:""}: ${e.toLowerCase()} error: ${t}
10594
10594
  `;if(u+=`
10595
- ${Z.bold}${Z.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Z.reset}
10596
- `,u+=`${Z.bold}${Z.red}\u2502${Z.reset} ${Z.bold}${Z.bgRed} ERROR ${Z.reset} ${Z.red}${e} Error${Z.reset}${" ".repeat(Math.max(0,43-e.length))}${Z.bold}${Z.red}\u2502${Z.reset}
10597
- `,u+=`${Z.bold}${Z.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z.reset}
10595
+ ${Q.bold}${Q.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Q.reset}
10596
+ `,u+=`${Q.bold}${Q.red}\u2502${Q.reset} ${Q.bold}${Q.bgRed} ERROR ${Q.reset} ${Q.red}${e} Error${Q.reset}${" ".repeat(Math.max(0,43-e.length))}${Q.bold}${Q.red}\u2502${Q.reset}
10597
+ `,u+=`${Q.bold}${Q.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Q.reset}
10598
10598
  `,u+=`
10599
- ${Z.cyan}${Z.bold}File:${Z.reset} ${Z.dim}${l}${Z.reset}`,a>0)u+=` ${Z.gray}(line ${a}${c>0?`, col ${c}`:""})${Z.reset}`;if(u+=`
10600
- ${Z.yellow}${Z.bold}Message:${Z.reset} ${t}
10599
+ ${Q.cyan}${Q.bold}File:${Q.reset} ${Q.dim}${l}${Q.reset}`,a>0)u+=` ${Q.gray}(line ${a}${c>0?`, col ${c}`:""})${Q.reset}`;if(u+=`
10600
+ ${Q.yellow}${Q.bold}Message:${Q.reset} ${t}
10601
10601
  `,o)u+=`
10602
- ${Z.blue}${Z.bold}Context:${Z.reset}
10603
- ${Z.dim}${o}${Z.reset}
10604
- `;return u}function u0(){Zr.clear(),Qr.clear(),ci.clear()}var Zr,Qr,ci,d0=0,Z,Ce=R(()=>{Ii(),rd(),ut(),nt(),hn(),el(),Qt(),bd(),_d(),Ai(),$v(),Di(),Zr=new Kr(500),Qr=new Kr(1000),ci=new Kr(2000),Z={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function p0(e,t,r=""){let n=e,i=[],s=/@markdown(?:\([^)]*\))?/g,a;while((a=s.exec(e))!==null){let o=a.index,l=a[0].match(/@markdown\(([^)]*)\)/),c=l?l[1]:"",u=o+a[0].length,d=1,h=u,p=-1;while(d>0&&h<e.length){let y=e.indexOf("@markdown",h),g=e.indexOf("@endmarkdown",h);if(g===-1)break;if(y!==-1&&y<g&&y!==o){let v=e[y+9];if(v==="("||v===`
10605
- `||v==="\r"||v===" "||v===void 0)d++;h=y+9}else{if(d--,d===0){p=g;break}h=g+12}}if(p===-1)continue;let f=e.slice(u,p),m=e.slice(o,p+12);i.push({fullMatch:m,options:c,content:f,index:o}),s.lastIndex=p+12}for(let{fullMatch:o,options:l,content:c,index:u}of i)try{let d={};if(l)l.split(",").forEach((f)=>{let m=f.trim();if(m)d[m]=!0});let h={gfm:d.gfm??!0,breaks:d.breaks??!1},p=Ca(c.trim(),h);n=n.split(o).join(p)}catch(d){let h=d instanceof Error?d.message:String(d),p=Ae("Markdown Directive",`Error processing markdown: ${h}`,r,e,u,o);n=n.split(o).join(p)}return n}async function f0(e,t,r,n){let i={gfm:!0,breaks:!1};return t.forEach((s)=>{let a=s.trim().replace(/['"]/g,"");if(a==="breaks")i.breaks=!0;if(a==="no-gfm")i.gfm=!1}),Ca(e.trim(),i)}var Sp=R(()=>{Ce()});function h0(e){if(kp.set(e.name,e),e.client)Ep.set(e.name,e.client)}function _p(e){return h0(e),{name:e.name,hasEndTag:e.hasEndTag??!0,description:e.description,handler:async(t,r,n,i)=>{let s=m0(r,e.defaults);if(e.validate){let o=e.validate(s);if(o!==!0){let l=typeof o==="string"?o:`Invalid parameters for @${e.name}`;throw Error(l)}}let a=t;if(e.transform)a=await e.transform(t,s,n,i);if(e.clientScript){let o=e.clientScript(s);a+=`<script>${o}</script>`}if(e.css){let o=e.css(s);a+=`<style>${o}</style>`}return a}}}function m0(e,t){let r={...t};for(let n of e){let i=n.indexOf(":"),s=n.indexOf("="),a=i>=0&&(s<0||i<s)?i:s;if(a>=0){let o=n.slice(0,a).trim(),l=n.slice(a+1).trim();if(l==="true")l=!0;else if(l==="false")l=!1;else if(l==="null")l=null;else if(!Number.isNaN(Number(l)))l=Number(l);else if(typeof l==="string"&&l.startsWith("{"))try{l=JSON.parse(l)}catch{}r[o]=l}else{let o=Object.keys(r).filter((l)=>!t||!(l in t)).length;r[o===0?"value":`arg${o}`]=n}}return r}var kp,Ep,Ap=R(()=>{kp=new Map,Ep=new Map});function Cp(e,t=vn,r={},n){return t.sort((i,s)=>i-s).map((i)=>{return`${Mi(e,{...r,w:i,fm:n})} ${i}w`}).join(", ")}function g0(e,t,r=Ip,n={},i){return r.sort((s,a)=>s-a).map((s)=>{let a=Math.round(t*s);return`${Mi(e,{...n,w:a,dpr:s,fm:i})} ${s}x`}).join(", ")}function Tp(e,t="100vw"){if(!e||Object.keys(e).length===0)return t;let r=Object.entries(e).map(([n,i])=>{let s=/^\d+$/.test(n)?`${n}px`:n;return{bp:s,size:i,numericBp:Number.parseInt(s)||0}}).sort((n,i)=>n.numericBp-i.numericBp).map(({bp:n,size:i})=>`(max-width: ${n}) ${i}`);return r.push(t),r.join(", ")}function Mi(e,t={}){let r=Object.entries(t).filter(([,s])=>s!==void 0&&s!==null).map(([s,a])=>{if(Array.isArray(a))return[s,a.join(",")];return[s,String(a)]});if(r.length===0)return e;let n=r.map(([s,a])=>`${s}=${encodeURIComponent(a)}`).join("&"),i=e.includes("?")?"&":"?";return`${e}${i}${n}`}function Rp(e){return Op[e]||"application/octet-stream"}var vn,Ip,Bi,Op,jp=R(()=>{vn=[320,480,640,768,1024,1280,1536,1920,2560],Ip=[1,1.5,2,3],Bi=["avif","webp","jpeg"],Op={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function y0(){try{return await import("./chunk-gfd23b6t.js")}catch{return null}}async function v0(e,t={}){let r={...Dp,...t},n=await y0();if(n)try{return await w0(e,r,n)}catch(i){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${i}`)}return b0(e,r)}async function w0(e,t,r){let{generatePlaceholder:n,generateThumbHash:i}=r,s={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[t.strategy]||"blur";if(t.strategy==="thumbhash")return{dataURL:(await i(e)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let a=await n(e,{width:t.width,height:t.height,quality:t.quality,blurLevel:t.blurLevel,strategy:s,base64Encode:!0});return{dataURL:a.dataURL,width:a.width,height:a.height,aspectRatio:a.aspectRatio,originalWidth:a.originalWidth,originalHeight:a.originalHeight,strategy:t.strategy,dominantColor:a.dominantColor,css:a.css}}function b0(e,t){let r=t.width||20,n=t.height||r,i="#e5e7eb",s=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}" viewBox="0 0 ${r} ${n}"><rect fill="#e5e7eb" width="${r}" height="${n}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`,width:r,height:n,aspectRatio:r/n,originalWidth:0,originalHeight:0,strategy:t.strategy,dominantColor:"#e5e7eb"}}function x0(e,t,r={}){let n=r.transitionDuration||300,i=r.easing||"ease-out";return`
10602
+ ${Q.blue}${Q.bold}Context:${Q.reset}
10603
+ ${Q.dim}${o}${Q.reset}
10604
+ `;return u}function db(){Qr.clear(),Xr.clear(),ui.clear()}var Qr,Xr,ui,pb=0,Q,Te=R(()=>{Oi(),nd(),dt(),it(),mn(),tl(),Xt(),xd(),kd(),Ci(),Lv(),$i(),Qr=new Zr(500),Xr=new Zr(1000),ui=new Zr(2000),Q={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function fb(e,t,r=""){let n=e,i=[],s=/@markdown(?:\([^)]*\))?/g,a;while((a=s.exec(e))!==null){let o=a.index,l=a[0].match(/@markdown\(([^)]*)\)/),c=l?l[1]:"",u=o+a[0].length,d=1,h=u,p=-1;while(d>0&&h<e.length){let y=e.indexOf("@markdown",h),g=e.indexOf("@endmarkdown",h);if(g===-1)break;if(y!==-1&&y<g&&y!==o){let v=e[y+9];if(v==="("||v===`
10605
+ `||v==="\r"||v===" "||v===void 0)d++;h=y+9}else{if(d--,d===0){p=g;break}h=g+12}}if(p===-1)continue;let f=e.slice(u,p),m=e.slice(o,p+12);i.push({fullMatch:m,options:c,content:f,index:o}),s.lastIndex=p+12}for(let{fullMatch:o,options:l,content:c,index:u}of i)try{let d={};if(l)l.split(",").forEach((f)=>{let m=f.trim();if(m)d[m]=!0});let h={gfm:d.gfm??!0,breaks:d.breaks??!1},p=Ta(c.trim(),h);n=n.split(o).join(p)}catch(d){let h=d instanceof Error?d.message:String(d),p=Ce("Markdown Directive",`Error processing markdown: ${h}`,r,e,u,o);n=n.split(o).join(p)}return n}async function hb(e,t,r,n){let i={gfm:!0,breaks:!1};return t.forEach((s)=>{let a=s.trim().replace(/['"]/g,"");if(a==="breaks")i.breaks=!0;if(a==="no-gfm")i.gfm=!1}),Ta(e.trim(),i)}var _p=R(()=>{Te()});function mb(e){if(Ep.set(e.name,e),e.client)Ap.set(e.name,e.client)}function kp(e){return mb(e),{name:e.name,hasEndTag:e.hasEndTag??!0,description:e.description,handler:async(t,r,n,i)=>{let s=gb(r,e.defaults);if(e.validate){let o=e.validate(s);if(o!==!0){let l=typeof o==="string"?o:`Invalid parameters for @${e.name}`;throw Error(l)}}let a=t;if(e.transform)a=await e.transform(t,s,n,i);if(e.clientScript){let o=e.clientScript(s);a+=`<script>${o}</script>`}if(e.css){let o=e.css(s);a+=`<style>${o}</style>`}return a}}}function gb(e,t){let r={...t};for(let n of e){let i=n.indexOf(":"),s=n.indexOf("="),a=i>=0&&(s<0||i<s)?i:s;if(a>=0){let o=n.slice(0,a).trim(),l=n.slice(a+1).trim();if(l==="true")l=!0;else if(l==="false")l=!1;else if(l==="null")l=null;else if(!Number.isNaN(Number(l)))l=Number(l);else if(typeof l==="string"&&l.startsWith("{"))try{l=JSON.parse(l)}catch{}r[o]=l}else{let o=Object.keys(r).filter((l)=>!t||!(l in t)).length;r[o===0?"value":`arg${o}`]=n}}return r}var Ep,Ap,Cp=R(()=>{Ep=new Map,Ap=new Map});function Tp(e,t=wn,r={},n){return t.sort((i,s)=>i-s).map((i)=>`${Bi(e,{...r,w:i,fm:n})} ${i}w`).join(", ")}function yb(e,t,r=Op,n={},i){return r.sort((s,a)=>s-a).map((s)=>{let a=Math.round(t*s);return`${Bi(e,{...n,w:a,dpr:s,fm:i})} ${s}x`}).join(", ")}function Rp(e,t="100vw"){if(!e||Object.keys(e).length===0)return t;let r=Object.entries(e).map(([n,i])=>{let s=/^\d+$/.test(n)?`${n}px`:n;return{bp:s,size:i,numericBp:Number.parseInt(s)||0}}).sort((n,i)=>n.numericBp-i.numericBp).map(({bp:n,size:i})=>`(max-width: ${n}) ${i}`);return r.push(t),r.join(", ")}function Bi(e,t={}){let r=Object.entries(t).filter(([,s])=>s!==void 0&&s!==null).map(([s,a])=>{if(Array.isArray(a))return[s,a.join(",")];return[s,String(a)]});if(r.length===0)return e;let n=r.map(([s,a])=>`${s}=${encodeURIComponent(a)}`).join("&"),i=e.includes("?")?"&":"?";return`${e}${i}${n}`}function Ip(e){return jp[e]||"application/octet-stream"}var wn,Op,zi,jp,Dp=R(()=>{wn=[320,480,640,768,1024,1280,1536,1920,2560],Op=[1,1.5,2,3],zi=["avif","webp","jpeg"],jp={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function vb(){try{return await import("./chunk-9b6a58ac.js")}catch{return null}}async function wb(e,t={}){let r={...$p,...t},n=await vb();if(n)try{return await bb(e,r,n)}catch(i){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${i}`)}return xb(e,r)}async function bb(e,t,r){let{generatePlaceholder:n,generateThumbHash:i}=r,s={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[t.strategy]||"blur";if(t.strategy==="thumbhash")return{dataURL:(await i(e)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let a=await n(e,{width:t.width,height:t.height,quality:t.quality,blurLevel:t.blurLevel,strategy:s,base64Encode:!0});return{dataURL:a.dataURL,width:a.width,height:a.height,aspectRatio:a.aspectRatio,originalWidth:a.originalWidth,originalHeight:a.originalHeight,strategy:t.strategy,dominantColor:a.dominantColor,css:a.css}}function xb(e,t){let r=t.width||20,n=t.height||r,i="#e5e7eb",s=`<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${n}" viewBox="0 0 ${r} ${n}"><rect fill="#e5e7eb" width="${r}" height="${n}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(s)}`,width:r,height:n,aspectRatio:r/n,originalWidth:0,originalHeight:0,strategy:t.strategy,dominantColor:"#e5e7eb"}}function Sb(e,t,r={}){let n=r.transitionDuration||300,i=r.easing||"ease-out";return`
10606
10606
  #${e} {
10607
10607
  --stx-img-transition-duration: ${n}ms;
10608
10608
  --stx-img-transition-easing: ${i};
@@ -10619,7 +10619,7 @@ ${Z.dim}${o}${Z.reset}
10619
10619
  #${e}.stx-img-loaded img {
10620
10620
  opacity: 1;
10621
10621
  }
10622
- `.trim()}async function S0(e,t={}){let r=`${e}:${JSON.stringify(t)}`;if(Mn.has(r))return Mn.get(r);let n=await v0(e,t);return Mn.set(r,n),n}var Dp,mo,Mn,_0=R(()=>{Dp={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},mo=`
10622
+ `.trim()}async function _b(e,t={}){let r=`${e}:${JSON.stringify(t)}`;if(Bn.has(r))return Bn.get(r);let n=await wb(e,t);return Bn.set(r,n),n}var $p,go,Bn,kb=R(()=>{$p={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},go=`
10623
10623
  .stx-img-placeholder {
10624
10624
  position: relative;
10625
10625
  overflow: hidden;
@@ -10648,8 +10648,8 @@ ${Z.dim}${o}${Z.reset}
10648
10648
  filter: blur(0);
10649
10649
  transform: scale(1);
10650
10650
  }
10651
- `.trim(),Mn=new Map});async function dt(e){try{let t=await k0(e);return $p("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function Rl(e){return $p("sha256").update(e).digest("hex").slice(0,16)}function qs(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${Rl(e)}-${Rl(r)}`}async function Np(e){try{return(await Lp(e)).mtimeMs}catch{return 0}}async function rt(e){try{return await Lp(e),!0}catch{return!1}}var Pr=()=>{};async function I0(e){try{await E0(e,{recursive:!0})}catch{}}function Mp(e,t,r){return Pp(e,r,`${t}.json`)}async function Il(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await Np(t)!==e.srcMtime)return!1;return!0}async function Bp(e,t,r,n=zi){if(!n.enabled)return null;let i=qs(e,t),s=Ft.get(i);if(s){if(await Il(s,e,n.maxAge))return s.lastAccessedAt=Date.now(),s.data;Ft.delete(i)}let a=Mp(n.directory,i,r);if(await rt(a))try{let o=await A0(a,"utf-8"),l=JSON.parse(o);if(await Il(l,e,n.maxAge))return l.lastAccessedAt=Date.now(),Ft.set(i,l),l.data}catch{}return null}async function zp(e,t,r,n,i=zi){if(!i.enabled)return;let s=qs(e,t),a=await dt(e),o=await Np(e),l={key:s,src:e,srcHash:a,srcMtime:o,optionsHash:qs("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};Ft.set(s,l);let c=Mp(i.directory,s,n);try{await I0(R0(c)),await C0(c,JSON.stringify(l,null,2))}catch(u){console.warn(`[stx-media] Failed to write cache: ${u}`)}}async function Fp(e,t=zi){if(e==="all")Ft.clear();else Ft.clear();let r=e==="all"?["image","video"]:[e];for(let n of r){let i=Pp(t.directory,n);try{await T0(i,{recursive:!0,force:!0})}catch{}}}var Ft,zi,qp=R(()=>{Pr(),Ft=new Map,zi={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class go{config;constructor(e={}){this.config={...Up,...e}}async get(e,t){return Bp(e,t,"image",this.config)}async set(e,t,r){return zp(e,t,r,"image",this.config)}async clear(){return Fp("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}function yo(e){if(!Sn)Sn=new go(e);else if(e)Sn.updateConfig(e);return Sn}async function Wp(e,t,r){let n=r?{directory:`${r.outputDir}/../.cache`}:{};return yo(n).get(e,t)}async function Hp(e,t,r,n){let i=n?{directory:`${n.outputDir}/../.cache`}:{};return yo(i).set(e,t,r)}async function O0(){return yo().clear()}var Up,Sn=null,Gp=R(()=>{qp(),Up={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});async function vo(){try{return await import("./chunk-gfd23b6t.js")}catch{return null}}function Ol(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function P0(e,t){let r=t?Ol(t):Ol("web"),n=e.formatQuality||{};return{jpeg:{...r.jpeg,...n.jpeg},png:{...r.png,...n.png},webp:{...r.webp,...n.webp},avif:{...r.avif,...n.avif}}}async function M0(e,t,r){let n=await vo();if(!n)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let i=await Wp(e,t,r);if(i)return i;try{let s=j0(e);if(!await rt(s))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let a=P0(r,t.preset),o=r.outputDir||"dist/images",l=r.baseUrl||"/images";await N0(o,{recursive:!0});let c=await dt(s),u=D0(e,$0(e)),d=t.outputFormat?[t.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],h={src:e,processed:!0,variants:[],hash:c},p=null;if(t.transformations&&t.transformations.length>0)p=await Vp(s,t.transformations,n);for(let f of d){let m=a[f]||{},y=`${u}-${c}.${f}`,g=L0(o,y);try{let v=await n.optimizeImage({input:p||s,output:g,format:f,quality:m.quality,progressive:m.progressive});if(v){if(h.variants.push({path:g,url:`${l}/${y}`,width:v.width||0,height:v.height||0,format:f,size:v.outputSize||0}),!h.originalWidth&&v.width)h.originalWidth=v.width,h.originalHeight=v.height}}catch(v){h.errors=h.errors||[],h.errors.push(`Failed to optimize ${f}: ${v}`)}}if(t.embedThumbhash||t.placeholder==="thumbhash")try{let f=await n.generateThumbHash(s);h.placeholder=f.dataUrl}catch(f){h.errors=h.errors||[],h.errors.push(`Failed to generate thumbhash: ${f}`)}if(t.useDominantColor)try{let f=await n.generatePlaceholder(s,{strategy:"dominant-color"});h.dominantColor=f.dominantColor}catch(f){h.errors=h.errors||[],h.errors.push(`Failed to extract dominant color: ${f}`)}return await Hp(e,t,h,r),h}catch(s){return{src:e,processed:!1,errors:[`Processing failed: ${s}`]}}}async function B0(e,t,r,n){let i=await vo();if(!i)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await i.optimizeImage({input:e,output:n,format:t,quality:r}))?.outputSize}}catch(s){return{success:!1,error:String(s)}}}async function Vp(e,t,r){let n=r||await vo();if(!n)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let i=await n.decode(e);for(let s of t){let a=s.options||{};switch(s.type){case"resize":if(a.width||a.height)i=await n.resize(i,{width:a.width,height:a.height,fit:a.fit});break;case"blur":if(a.sigma!==void 0)i=await n.blur(i,a.sigma);break;case"sharpen":if(a.amount!==void 0)i=await n.sharpen(i,a.amount);break;case"grayscale":i=await n.grayscale(i);break;case"rotate":if(a.angle!==void 0)i=await n.rotate(i,a.angle);break;case"flip":i=await n.flip(i);break;case"flop":i=await n.flop(i);break;case"brightness":if(a.value!==void 0)i=await n.brightness(i,a.value);break;case"contrast":if(a.value!==void 0)i=await n.contrast(i,a.value);break;case"saturation":if(a.value!==void 0)i=await n.saturation(i,a.value);break}}return await n.encode(i,"png")}catch(i){return console.error(`[stx-media] Transformation failed: ${i}`),null}}var z0=R(()=>{Pr(),Gp()});async function G0(){try{return await import("./chunk-gfd23b6t.js")}catch{return null}}async function V0(e,t,r){let n=await G0();if(!n)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let i=F0(e);if(!await rt(i))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let s=t.responsiveWidths||r.breakpoints||Jp,a=t.formats||r.defaultFormats||["avif","webp","jpeg"],o=r.outputDir||"dist/images",l=r.baseUrl||"/images";await U0(o,{recursive:!0});let c=await dt(i),u=q0(e,W0(e)),d=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},h={src:e,byFormat:{},srcsets:{}};for(let f of a){h.byFormat[f]=[];let m=[];for(let y of s){let g=`${u}-${y}w-${c}.${f}`,v=H0(o,g),w=`${l}/${g}`;try{let b=d[f]?.quality||80;if(await rt(v)){h.byFormat[f].push({path:v,url:w,width:y,height:0,format:f,size:0}),m.push(`${w} ${y}w`);continue}let S=await n.processImage({input:i,output:v,format:f,quality:b,resize:{width:y}});if(S)h.byFormat[f].push({path:v,url:w,width:y,height:S.height||Math.round(y*(S.height||1)/(S.width||1)),format:f,size:S.outputSize||0}),m.push(`${w} ${y}w`)}catch(b){console.warn(`[stx-media] Failed to generate ${f} at ${y}w: ${b}`)}}h.srcsets[f]=m.join(", ")}let p=t.placeholder||r.placeholderStrategy||"thumbhash";if(p!=="none")try{if(p==="thumbhash"){let f=await n.generateThumbHash(i);h.placeholder={dataURL:f.dataUrl,width:f.width||32,height:f.height||32,strategy:"thumbhash"}}else{let f=await n.generatePlaceholder(i,{strategy:p,width:20});h.placeholder={dataURL:f.dataURL,width:f.width,height:f.height,strategy:p}}}catch(f){console.warn(`[stx-media] Failed to generate placeholder: ${f}`)}return h.sizes=t.sizes||J0(s),h}catch(s){return console.error(`[stx-media] Responsive generation failed: ${s}`),null}}function J0(e){let t=[...e].sort((n,i)=>n-i),r=[];for(let n=0;n<t.length-1;n++){let i=t[n];r.push(`(max-width: ${i}px) ${i}px`)}return r.push(`${t[t.length-1]}px`),r.join(", ")}function Y0(e,t="width"){if(!e||e.length===0)return"";if(t==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}var Jp,K0=R(()=>{Pr(),Jp=[320,480,640,768,1024,1280,1536,1920]}),Yp={};Y(Yp,{setCachedImageResult:()=>Hp,processImage:()=>M0,optimizeImage:()=>B0,getCachedImageResult:()=>Wp,generateSrcset:()=>Y0,generateResponsiveVariants:()=>V0,clearImageCache:()=>O0,applyTransformations:()=>Vp,ImageProcessorCache:()=>go});var Z0=R(()=>{z0(),K0(),Gp()});async function Q0(){try{return await Promise.resolve().then(()=>(Z0(),Yp))}catch(e){if(!jl)console.warn("[stx-media] Image processor not available, some features disabled:",e),jl=!0;return null}}async function Ws(e,t={}){let r=t,n=e;if(n.process&&!n.skipOptimization){if(r.tsImagesConfig?.enabled&&!r.isDev)return rb(n,r)}if(r.processedResult?.processed)return xo(e,r.processedResult,t);if(r.responsiveVariants)return Qp(e,r.responsiveVariants,t);let{src:i,alt:s,width:a,height:o,sizes:l,widths:c=vn,dpr:u,formats:d=Bi,quality:h=So,params:p={},placeholder:f="none",placeholderOptions:m={},lazy:y=!0,priority:g=!1,loading:v=g?"eager":qi,decoding:w=Fi,fetchpriority:b,objectFit:S,objectPosition:x,crossorigin:_,referrerpolicy:E}=e,k=e.class,A=e.style,T=e.id,C=e.data||{},{isDev:D=!1,baseUrl:I=""}=t;if(D&&!t.optimize)return tb(e);let O,L,N=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(f!=="none"&&!g)try{O=await S0(i,{strategy:f,...m}),L=x0(N,O,m)}catch{}let B=u!==void 0&&a!==void 0,F;if(B)F=eb(e,N,O,t);else F=await X0(e,N,O,t);let K;if(g){let ye=d.includes("webp")?"webp":d[0],z=Cp(i,c,{...p,q:h},ye),G=typeof l==="object"?Tp(l):l||"100vw";K=`<link rel="preload" as="image" imagesrcset="${z}" imagesizes="${G}" />`}let Te=[];if(!Dl&&f!=="none")Te.push(mo),Dl=!0;if(L)Te.push(L);let ae=y?Zp(N):void 0;return{html:F,preloadLink:K,css:Te.length>0?Te.join(`
10652
- `):void 0,script:ae}}async function X0(e,t,r,n){let{src:i,alt:s,width:a,height:o,sizes:l,widths:c=vn,formats:u=Bi,quality:d=So,params:h={},lazy:p=!0,priority:f=!1,loading:m=f?"eager":qi,decoding:y=Fi,fetchpriority:g,objectFit:v,objectPosition:w,crossorigin:b,referrerpolicy:S}=e,x=e.class,_=e.style,E=e.data||{},k=typeof l==="object"?Tp(l):l||"100vw",A=[];for(let D of u){let I=Cp(i,c,{...h,q:d},D),O=Rp(D);if(p&&!f)A.push(` <source type="${O}" data-srcset="${I}" data-sizes="${k}" />`);else A.push(` <source type="${O}" srcset="${I}" sizes="${k}" />`)}let T=wo({src:Mi(i,{...h,q:d}),alt:s,width:a,height:o,loading:f?void 0:m,decoding:y,fetchpriority:f?"high":g,objectFit:v,objectPosition:w,crossorigin:b,referrerpolicy:S,className:Kp(x,r),style:bo(_,v,w,r),lazy:p&&!f,data:E}),C;if(r){let D=`background-image: url('${r.dataURL}'); background-size: cover; background-position: center;`;C=`<div id="${t}" class="stx-img-placeholder" style="${D}">
10651
+ `.trim(),Bn=new Map});async function pt(e){try{let t=await Eb(e);return Lp("sha256").update(t).digest("hex").slice(0,16)}catch{return""}}function Il(e){return Lp("sha256").update(e).digest("hex").slice(0,16)}function Ws(e,t){let r=JSON.stringify(t,Object.keys(t).sort());return`${Il(e)}-${Il(r)}`}async function Pp(e){try{return(await Np(e)).mtimeMs}catch{return 0}}async function nt(e){try{return await Np(e),!0}catch{return!1}}var Mr=()=>{};async function Ob(e){try{await Ab(e,{recursive:!0})}catch{}}function Bp(e,t,r){return Mp(e,r,`${t}.json`)}async function Ol(e,t,r){if((Date.now()-e.createdAt)/86400000>r)return!1;if(await Pp(t)!==e.srcMtime)return!1;return!0}async function zp(e,t,r,n=Fi){if(!n.enabled)return null;let i=Ws(e,t),s=qt.get(i);if(s){if(await Ol(s,e,n.maxAge))return s.lastAccessedAt=Date.now(),s.data;qt.delete(i)}let a=Bp(n.directory,i,r);if(await nt(a))try{let o=await Cb(a,"utf-8"),l=JSON.parse(o);if(await Ol(l,e,n.maxAge))return l.lastAccessedAt=Date.now(),qt.set(i,l),l.data}catch{}return null}async function Fp(e,t,r,n,i=Fi){if(!i.enabled)return;let s=Ws(e,t),a=await pt(e),o=await Pp(e),l={key:s,src:e,srcHash:a,srcMtime:o,optionsHash:Ws("",t),data:r,createdAt:Date.now(),lastAccessedAt:Date.now()};qt.set(s,l);let c=Bp(i.directory,s,n);try{await Ob(Ib(c)),await Tb(c,JSON.stringify(l,null,2))}catch(u){console.warn(`[stx-media] Failed to write cache: ${u}`)}}async function qp(e,t=Fi){if(e==="all")qt.clear();else qt.clear();let r=e==="all"?["image","video"]:[e];for(let n of r){let i=Mp(t.directory,n);try{await Rb(i,{recursive:!0,force:!0})}catch{}}}var qt,Fi,Wp=R(()=>{Mr(),qt=new Map,Fi={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class yo{config;constructor(e={}){this.config={...Gp,...e}}async get(e,t){return zp(e,t,"image",this.config)}async set(e,t,r){return Fp(e,t,r,"image",this.config)}async clear(){return qp("image",this.config)}updateConfig(e){this.config={...this.config,...e}}}function vo(e){if(!_n)_n=new yo(e);else if(e)_n.updateConfig(e);return _n}async function Hp(e,t,r){let n=r?{directory:`${r.outputDir}/../.cache`}:{};return vo(n).get(e,t)}async function Up(e,t,r,n){let i=n?{directory:`${n.outputDir}/../.cache`}:{};return vo(i).set(e,t,r)}async function jb(){return vo().clear()}var Gp,_n=null,Vp=R(()=>{Wp(),Gp={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});async function wo(){try{return await import("./chunk-9b6a58ac.js")}catch{return null}}function jl(e){switch(e){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function Mb(e,t){let r=t?jl(t):jl("web"),n=e.formatQuality||{};return{jpeg:{...r.jpeg,...n.jpeg},png:{...r.png,...n.png},webp:{...r.webp,...n.webp},avif:{...r.avif,...n.avif}}}async function Bb(e,t,r){let n=await wo();if(!n)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:e,processed:!1};let i=await Hp(e,t,r);if(i)return i;try{let s=Db(e);if(!await nt(s))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let a=Mb(r,t.preset),o=r.outputDir||"dist/images",l=r.baseUrl||"/images";await Pb(o,{recursive:!0});let c=await pt(s),u=$b(e,Lb(e)),d=t.outputFormat?[t.outputFormat]:r.defaultFormats||["avif","webp","jpeg"],h={src:e,processed:!0,variants:[],hash:c},p=null;if(t.transformations&&t.transformations.length>0)p=await Jp(s,t.transformations,n);for(let f of d){let m=a[f]||{},y=`${u}-${c}.${f}`,g=Nb(o,y);try{let v=await n.optimizeImage({input:p||s,output:g,format:f,quality:m.quality,progressive:m.progressive});if(v){if(h.variants.push({path:g,url:`${l}/${y}`,width:v.width||0,height:v.height||0,format:f,size:v.outputSize||0}),!h.originalWidth&&v.width)h.originalWidth=v.width,h.originalHeight=v.height}}catch(v){h.errors=h.errors||[],h.errors.push(`Failed to optimize ${f}: ${v}`)}}if(t.embedThumbhash||t.placeholder==="thumbhash")try{let f=await n.generateThumbHash(s);h.placeholder=f.dataUrl}catch(f){h.errors=h.errors||[],h.errors.push(`Failed to generate thumbhash: ${f}`)}if(t.useDominantColor)try{let f=await n.generatePlaceholder(s,{strategy:"dominant-color"});h.dominantColor=f.dominantColor}catch(f){h.errors=h.errors||[],h.errors.push(`Failed to extract dominant color: ${f}`)}return await Up(e,t,h,r),h}catch(s){return{src:e,processed:!1,errors:[`Processing failed: ${s}`]}}}async function zb(e,t,r,n){let i=await wo();if(!i)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await i.optimizeImage({input:e,output:n,format:t,quality:r}))?.outputSize}}catch(s){return{success:!1,error:String(s)}}}async function Jp(e,t,r){let n=r||await wo();if(!n)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let i=await n.decode(e);for(let s of t){let a=s.options||{};switch(s.type){case"resize":if(a.width||a.height)i=await n.resize(i,{width:a.width,height:a.height,fit:a.fit});break;case"blur":if(a.sigma!==void 0)i=await n.blur(i,a.sigma);break;case"sharpen":if(a.amount!==void 0)i=await n.sharpen(i,a.amount);break;case"grayscale":i=await n.grayscale(i);break;case"rotate":if(a.angle!==void 0)i=await n.rotate(i,a.angle);break;case"flip":i=await n.flip(i);break;case"flop":i=await n.flop(i);break;case"brightness":if(a.value!==void 0)i=await n.brightness(i,a.value);break;case"contrast":if(a.value!==void 0)i=await n.contrast(i,a.value);break;case"saturation":if(a.value!==void 0)i=await n.saturation(i,a.value);break}}return await n.encode(i,"png")}catch(i){return console.error(`[stx-media] Transformation failed: ${i}`),null}}var Fb=R(()=>{Mr(),Vp()});async function Vb(){try{return await import("./chunk-9b6a58ac.js")}catch{return null}}async function Jb(e,t,r){let n=await Vb();if(!n)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let i=qb(e);if(!await nt(i))return console.warn(`[stx-media] Source file not found: ${e}`),null;try{let s=t.responsiveWidths||r.breakpoints||Yp,a=t.formats||r.defaultFormats||["avif","webp","jpeg"],o=r.outputDir||"dist/images",l=r.baseUrl||"/images";await Gb(o,{recursive:!0});let c=await pt(i),u=Wb(e,Hb(e)),d=r.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},h={src:e,byFormat:{},srcsets:{}};for(let f of a){h.byFormat[f]=[];let m=[];for(let y of s){let g=`${u}-${y}w-${c}.${f}`,v=Ub(o,g),w=`${l}/${g}`;try{let b=d[f]?.quality||80;if(await nt(v)){h.byFormat[f].push({path:v,url:w,width:y,height:0,format:f,size:0}),m.push(`${w} ${y}w`);continue}let S=await n.processImage({input:i,output:v,format:f,quality:b,resize:{width:y}});if(S)h.byFormat[f].push({path:v,url:w,width:y,height:S.height||Math.round(y*(S.height||1)/(S.width||1)),format:f,size:S.outputSize||0}),m.push(`${w} ${y}w`)}catch(b){console.warn(`[stx-media] Failed to generate ${f} at ${y}w: ${b}`)}}h.srcsets[f]=m.join(", ")}let p=t.placeholder||r.placeholderStrategy||"thumbhash";if(p!=="none")try{if(p==="thumbhash"){let f=await n.generateThumbHash(i);h.placeholder={dataURL:f.dataUrl,width:f.width||32,height:f.height||32,strategy:"thumbhash"}}else{let f=await n.generatePlaceholder(i,{strategy:p,width:20});h.placeholder={dataURL:f.dataURL,width:f.width,height:f.height,strategy:p}}}catch(f){console.warn(`[stx-media] Failed to generate placeholder: ${f}`)}return h.sizes=t.sizes||Yb(s),h}catch(s){return console.error(`[stx-media] Responsive generation failed: ${s}`),null}}function Yb(e){let t=[...e].sort((n,i)=>n-i),r=[];for(let n=0;n<t.length-1;n++){let i=t[n];r.push(`(max-width: ${i}px) ${i}px`)}return r.push(`${t[t.length-1]}px`),r.join(", ")}function Kb(e,t="width"){if(!e||e.length===0)return"";if(t==="dpr")return e.filter((r)=>r.dpr).map((r)=>`${r.url} ${r.dpr}x`).join(", ");return e.map((r)=>`${r.url} ${r.width}w`).join(", ")}var Yp,Zb=R(()=>{Mr(),Yp=[320,480,640,768,1024,1280,1536,1920]}),Kp={};K(Kp,{setCachedImageResult:()=>Up,processImage:()=>Bb,optimizeImage:()=>zb,getCachedImageResult:()=>Hp,generateSrcset:()=>Kb,generateResponsiveVariants:()=>Jb,clearImageCache:()=>jb,applyTransformations:()=>Jp,ImageProcessorCache:()=>yo});var Qb=R(()=>{Fb(),Zb(),Vp()});async function Xb(){try{return await Promise.resolve().then(()=>(Qb(),Kp))}catch(e){if(!Dl)console.warn("[stx-media] Image processor not available, some features disabled:",e),Dl=!0;return null}}async function Hs(e,t={}){let r=t,n=e;if(n.process&&!n.skipOptimization){if(r.tsImagesConfig?.enabled&&!r.isDev)return nx(n,r)}if(r.processedResult?.processed)return So(e,r.processedResult,t);if(r.responsiveVariants)return Xp(e,r.responsiveVariants,t);let{src:i,alt:s,width:a,height:o,sizes:l,widths:c=wn,dpr:u,formats:d=zi,quality:h=_o,params:p={},placeholder:f="none",placeholderOptions:m={},lazy:y=!0,priority:g=!1,loading:v=g?"eager":Wi,decoding:w=qi,fetchpriority:b,objectFit:S,objectPosition:x,crossorigin:_,referrerpolicy:E}=e,k=e.class,A=e.style,T=e.id,C=e.data||{},{isDev:D=!1,baseUrl:I=""}=t;if(D&&!t.optimize)return rx(e);let O,N,P=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(f!=="none"&&!g)try{O=await _b(i,{strategy:f,...m}),N=Sb(P,O,m)}catch{}let z=u!==void 0&&a!==void 0,q;if(z)q=tx(e,P,O,t);else q=await ex(e,P,O,t);let Z;if(g){let ve=d.includes("webp")?"webp":d[0],F=Tp(i,c,{...p,q:h},ve),V=typeof l==="object"?Rp(l):l||"100vw";Z=`<link rel="preload" as="image" imagesrcset="${F}" imagesizes="${V}" />`}let Re=[];if(!$l&&f!=="none")Re.push(go),$l=!0;if(N)Re.push(N);let oe=y?Qp(P):void 0;return{html:q,preloadLink:Z,css:Re.length>0?Re.join(`
10652
+ `):void 0,script:oe}}async function ex(e,t,r,n){let{src:i,alt:s,width:a,height:o,sizes:l,widths:c=wn,formats:u=zi,quality:d=_o,params:h={},lazy:p=!0,priority:f=!1,loading:m=f?"eager":Wi,decoding:y=qi,fetchpriority:g,objectFit:v,objectPosition:w,crossorigin:b,referrerpolicy:S}=e,x=e.class,_=e.style,E=e.data||{},k=typeof l==="object"?Rp(l):l||"100vw",A=[];for(let D of u){let I=Tp(i,c,{...h,q:d},D),O=Ip(D);if(p&&!f)A.push(` <source type="${O}" data-srcset="${I}" data-sizes="${k}" />`);else A.push(` <source type="${O}" srcset="${I}" sizes="${k}" />`)}let T=bo({src:Bi(i,{...h,q:d}),alt:s,width:a,height:o,loading:f?void 0:m,decoding:y,fetchpriority:f?"high":g,objectFit:v,objectPosition:w,crossorigin:b,referrerpolicy:S,className:Zp(x,r),style:xo(_,v,w,r),lazy:p&&!f,data:E}),C;if(r){let D=`background-image: url('${r.dataURL}'); background-size: cover; background-position: center;`;C=`<div id="${t}" class="stx-img-placeholder" style="${D}">
10653
10653
  <picture>
10654
10654
  ${A.join(`
10655
10655
  `)}
@@ -10659,9 +10659,9 @@ ${A.join(`
10659
10659
  ${A.join(`
10660
10660
  `)}
10661
10661
  <img ${T} />
10662
- </picture>`;return C}function eb(e,t,r,n){let{src:i,alt:s,width:a,height:o,dpr:l=[1,2,3],quality:c=So,params:u={},lazy:d=!0,priority:h=!1,loading:p=h?"eager":qi,decoding:f=Fi,fetchpriority:m,objectFit:y,objectPosition:g,crossorigin:v,referrerpolicy:w}=e,b=e.class,S=e.style,x=e.data||{},_=typeof a==="number"?a:Number.parseInt(String(a),10),E=g0(i,_,l,{...u,q:c}),k=wo({src:Mi(i,{...u,w:_,q:c}),alt:s,width:a,height:o,loading:h?void 0:p,decoding:f,fetchpriority:h?"high":m,objectFit:y,objectPosition:g,crossorigin:v,referrerpolicy:w,className:Kp(b,r),style:bo(S,y,g,r),lazy:d&&!h,data:x}),A=d&&!h?`data-srcset="${E}"`:`srcset="${E}"`;if(r){let T=`background-image: url('${r.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${t}" class="stx-img-placeholder" style="${T}">
10662
+ </picture>`;return C}function tx(e,t,r,n){let{src:i,alt:s,width:a,height:o,dpr:l=[1,2,3],quality:c=_o,params:u={},lazy:d=!0,priority:h=!1,loading:p=h?"eager":Wi,decoding:f=qi,fetchpriority:m,objectFit:y,objectPosition:g,crossorigin:v,referrerpolicy:w}=e,b=e.class,S=e.style,x=e.data||{},_=typeof a==="number"?a:Number.parseInt(String(a),10),E=yb(i,_,l,{...u,q:c}),k=bo({src:Bi(i,{...u,w:_,q:c}),alt:s,width:a,height:o,loading:h?void 0:p,decoding:f,fetchpriority:h?"high":m,objectFit:y,objectPosition:g,crossorigin:v,referrerpolicy:w,className:Zp(b,r),style:xo(S,y,g,r),lazy:d&&!h,data:x}),A=d&&!h?`data-srcset="${E}"`:`srcset="${E}"`;if(r){let T=`background-image: url('${r.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${t}" class="stx-img-placeholder" style="${T}">
10663
10663
  <img ${k} ${A} />
10664
- </div>`}return`<img ${t?`id="${t}" `:""}${k} ${A} />`}function tb(e){let{src:t,alt:r,width:n,height:i,loading:s=qi,decoding:a=Fi,fetchpriority:o,objectFit:l,objectPosition:c,crossorigin:u,referrerpolicy:d,priority:h=!1}=e,p=e.class,f=e.style,m=e.id,y=e.data||{};return{html:`<img ${wo({src:t,alt:r,width:n,height:i,loading:h?"eager":s,decoding:a,fetchpriority:h?"high":o,objectFit:l,objectPosition:c,crossorigin:u,referrerpolicy:d,className:p,style:bo(f,l,c),id:m,data:y})} />`}}function wo(e){let t=[];if(e.lazy)t.push(`data-src="${Ge(e.src)}"`),t.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else t.push(`src="${Ge(e.src)}"`);if(t.push(`alt="${Ge(e.alt)}"`),e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.loading)t.push(`loading="${e.loading}"`);if(e.decoding)t.push(`decoding="${e.decoding}"`);if(e.fetchpriority)t.push(`fetchpriority="${e.fetchpriority}"`);if(e.crossorigin)t.push(`crossorigin="${e.crossorigin}"`);if(e.referrerpolicy)t.push(`referrerpolicy="${e.referrerpolicy}"`);if(e.className)t.push(`class="${Ge(e.className)}"`);if(e.style)t.push(`style="${Ge(e.style)}"`);if(e.id)t.push(`id="${Ge(e.id)}"`);if(e.data)for(let[r,n]of Object.entries(e.data))t.push(`data-${r}="${Ge(n)}"`);if(e.lazy)t.push("data-stx-lazy");return t.join(" ")}function Kp(e,t){let r=[];if(e)r.push(e);if(t)r.push("stx-img-blur");return r.join(" ")||""}function bo(e,t,r,n){let i=[];if(t)i.push(`object-fit: ${t}`);if(r)i.push(`object-position: ${r}`);if(n)i.push("opacity: 0; transition: opacity 300ms ease-out");if(e)i.push(e);return i.join("; ")}function Ge(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zp(e){return`
10664
+ </div>`}return`<img ${t?`id="${t}" `:""}${k} ${A} />`}function rx(e){let{src:t,alt:r,width:n,height:i,loading:s=Wi,decoding:a=qi,fetchpriority:o,objectFit:l,objectPosition:c,crossorigin:u,referrerpolicy:d,priority:h=!1}=e,p=e.class,f=e.style,m=e.id,y=e.data||{};return{html:`<img ${bo({src:t,alt:r,width:n,height:i,loading:h?"eager":s,decoding:a,fetchpriority:h?"high":o,objectFit:l,objectPosition:c,crossorigin:u,referrerpolicy:d,className:p,style:xo(f,l,c),id:m,data:y})} />`}}function bo(e){let t=[];if(e.lazy)t.push(`data-src="${Ve(e.src)}"`),t.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else t.push(`src="${Ve(e.src)}"`);if(t.push(`alt="${Ve(e.alt)}"`),e.width)t.push(`width="${e.width}"`);if(e.height)t.push(`height="${e.height}"`);if(e.loading)t.push(`loading="${e.loading}"`);if(e.decoding)t.push(`decoding="${e.decoding}"`);if(e.fetchpriority)t.push(`fetchpriority="${e.fetchpriority}"`);if(e.crossorigin)t.push(`crossorigin="${e.crossorigin}"`);if(e.referrerpolicy)t.push(`referrerpolicy="${e.referrerpolicy}"`);if(e.className)t.push(`class="${Ve(e.className)}"`);if(e.style)t.push(`style="${Ve(e.style)}"`);if(e.id)t.push(`id="${Ve(e.id)}"`);if(e.data)for(let[r,n]of Object.entries(e.data))t.push(`data-${r}="${Ve(n)}"`);if(e.lazy)t.push("data-stx-lazy");return t.join(" ")}function Zp(e,t){let r=[];if(e)r.push(e);if(t)r.push("stx-img-blur");return r.join(" ")||""}function xo(e,t,r,n){let i=[];if(t)i.push(`object-fit: ${t}`);if(r)i.push(`object-position: ${r}`);if(n)i.push("opacity: 0; transition: opacity 300ms ease-out");if(e)i.push(e);return i.join("; ")}function Ve(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qp(e){return`
10665
10665
  (function() {
10666
10666
  const container = document.getElementById('${e}');
10667
10667
  if (!container) return;
@@ -10698,7 +10698,7 @@ ${A.join(`
10698
10698
 
10699
10699
  observer.observe(container);
10700
10700
  })();
10701
- `.trim()}async function rb(e,t){let r=await Q0();if(!r)return Ws({...e,process:!1},t);let n=t.tsImagesConfig;if(e.responsiveWidths&&e.responsiveWidths.length>0||e.widths&&e.widths.length>0||!e.width&&!e.dpr){let i=await r.generateResponsiveVariants(e.src,e,n);if(i)return Qp(e,i,t)}else{let i=await r.processImage(e.src,e,n);if(i.processed)return xo(e,i,t)}return Ws({...e,process:!1},t)}async function xo(e,t,r){let{alt:n,width:i,height:s,lazy:a=!0,priority:o=!1,objectFit:l,objectPosition:c,crossorigin:u,referrerpolicy:d}=e,h=e.class,p=e.style,f=e.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,m=e.data||{},y=t.variants||[],g=y.find((L)=>L.format==="jpeg")||y.find((L)=>L.format==="webp")||y[0],v=g?.url||e.src,w=y.filter((L)=>L.format===(g?.format||"jpeg")).map((L)=>`${L.url} ${L.width}w`).join(", "),b=new Map;for(let L of y){if(!b.has(L.format))b.set(L.format,[]);b.get(L.format).push(L)}let S=[],x=["avif","webp","jpeg","png"];for(let L of x){let N=b.get(L);if(N&&N.length>0){let B=N.map((K)=>`${K.url} ${K.width}w`).join(", "),F=Rp(L);if(a&&!o)S.push(` <source type="${F}" data-srcset="${B}" />`);else S.push(` <source type="${F}" srcset="${B}" />`)}}let _=[];if(a&&!o){if(_.push(`data-src="${Ge(v)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),w)_.push(`data-srcset="${w}"`)}else if(_.push(`src="${Ge(v)}"`),w)_.push(`srcset="${w}"`);_.push(`alt="${Ge(n)}"`);let E=i||t.originalWidth,k=s||t.originalHeight;if(E)_.push(`width="${E}"`);if(k)_.push(`height="${k}"`);if(!o)_.push(`loading="${a?"lazy":"eager"}"`);if(_.push('decoding="async"'),o)_.push('fetchpriority="high"');if(u)_.push(`crossorigin="${u}"`);if(d)_.push(`referrerpolicy="${d}"`);let A=[];if(l)A.push(`object-fit: ${l}`);if(c)A.push(`object-position: ${c}`);if(t.placeholder&&a)A.push("opacity: 0; transition: opacity 300ms ease-out");if(p)A.push(p);if(A.length>0)_.push(`style="${A.join("; ")}"`);let T=[];if(h)T.push(h);if(t.placeholder)T.push("stx-img-blur");if(T.length>0)_.push(`class="${T.join(" ")}"`);if(a&&!o)_.push("data-stx-lazy");for(let[L,N]of Object.entries(m))_.push(`data-${L}="${Ge(N)}"`);let C;if(t.placeholder||t.dominantColor&&e.useDominantColor){let L=t.placeholder?`background-image: url('${t.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${t.dominantColor};`;C=`<div id="${f}" class="stx-img-placeholder" style="${L}">
10701
+ `.trim()}async function nx(e,t){let r=await Xb();if(!r)return Hs({...e,process:!1},t);let n=t.tsImagesConfig;if(e.responsiveWidths&&e.responsiveWidths.length>0||e.widths&&e.widths.length>0||!e.width&&!e.dpr){let i=await r.generateResponsiveVariants(e.src,e,n);if(i)return Xp(e,i,t)}else{let i=await r.processImage(e.src,e,n);if(i.processed)return So(e,i,t)}return Hs({...e,process:!1},t)}async function So(e,t,r){let{alt:n,width:i,height:s,lazy:a=!0,priority:o=!1,objectFit:l,objectPosition:c,crossorigin:u,referrerpolicy:d}=e,h=e.class,p=e.style,f=e.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,m=e.data||{},y=t.variants||[],g=y.find((N)=>N.format==="jpeg")||y.find((N)=>N.format==="webp")||y[0],v=g?.url||e.src,w=y.filter((N)=>N.format===(g?.format||"jpeg")).map((N)=>`${N.url} ${N.width}w`).join(", "),b=new Map;for(let N of y){if(!b.has(N.format))b.set(N.format,[]);b.get(N.format).push(N)}let S=[],x=["avif","webp","jpeg","png"];for(let N of x){let P=b.get(N);if(P&&P.length>0){let z=P.map((Z)=>`${Z.url} ${Z.width}w`).join(", "),q=Ip(N);if(a&&!o)S.push(` <source type="${q}" data-srcset="${z}" />`);else S.push(` <source type="${q}" srcset="${z}" />`)}}let _=[];if(a&&!o){if(_.push(`data-src="${Ve(v)}"`),_.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),w)_.push(`data-srcset="${w}"`)}else if(_.push(`src="${Ve(v)}"`),w)_.push(`srcset="${w}"`);_.push(`alt="${Ve(n)}"`);let E=i||t.originalWidth,k=s||t.originalHeight;if(E)_.push(`width="${E}"`);if(k)_.push(`height="${k}"`);if(!o)_.push(`loading="${a?"lazy":"eager"}"`);if(_.push('decoding="async"'),o)_.push('fetchpriority="high"');if(u)_.push(`crossorigin="${u}"`);if(d)_.push(`referrerpolicy="${d}"`);let A=[];if(l)A.push(`object-fit: ${l}`);if(c)A.push(`object-position: ${c}`);if(t.placeholder&&a)A.push("opacity: 0; transition: opacity 300ms ease-out");if(p)A.push(p);if(A.length>0)_.push(`style="${A.join("; ")}"`);let T=[];if(h)T.push(h);if(t.placeholder)T.push("stx-img-blur");if(T.length>0)_.push(`class="${T.join(" ")}"`);if(a&&!o)_.push("data-stx-lazy");for(let[N,P]of Object.entries(m))_.push(`data-${N}="${Ve(P)}"`);let C;if(t.placeholder||t.dominantColor&&e.useDominantColor){let N=t.placeholder?`background-image: url('${t.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${t.dominantColor};`;C=`<div id="${f}" class="stx-img-placeholder" style="${N}">
10702
10702
  <picture>
10703
10703
  ${S.join(`
10704
10704
  `)}
@@ -10708,12 +10708,12 @@ ${S.join(`
10708
10708
  ${S.join(`
10709
10709
  `)}
10710
10710
  <img ${_.join(" ")} />
10711
- </picture>`;let D=[];if(t.placeholder)D.push(mo);let I=a?Zp(f):void 0,O;if(o&&w)O=`<link rel="preload" as="image" imagesrcset="${w}" />`;return{html:C,preloadLink:O,css:D.length>0?D.join(`
10712
- `):void 0,script:I}}async function Qp(e,t,r){let n={src:t.src,processed:!0,variants:[],placeholder:t.placeholder?.dataURL,originalWidth:t.placeholder?.width,originalHeight:t.placeholder?.height};for(let[i,s]of Object.entries(t.byFormat))if(s)n.variants.push(...s);return xo(e,n,r)}var jl=!1,So=80,Fi="async",qi="lazy",Dl=!1,nb=R(()=>{jp(),_0()});function ib(){return _p({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,t,r,n)=>{let{src:i,alt:s,options:a}=sb(e,t,r);if(!i)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let o={src:i,alt:s||"",widths:a.widths||vn,formats:a.formats||Bi,quality:a.quality,sizes:a.sizes,dpr:a.dpr,params:a.params,placeholder:a.placeholder,placeholderOptions:a.placeholderOptions,lazy:a.lazy!==!1,priority:a.priority||!1,loading:a.loading,decoding:a.decoding,fetchpriority:a.fetchpriority,objectFit:a.objectFit,objectPosition:a.objectPosition,class:a.class,style:a.style,id:a.id,width:a.width,height:a.height},l=r.__isDev||!1,c=await Ws(o,{isDev:l}),u=c.html;if(c.preloadLink)u=c.preloadLink+`
10711
+ </picture>`;let D=[];if(t.placeholder)D.push(go);let I=a?Qp(f):void 0,O;if(o&&w)O=`<link rel="preload" as="image" imagesrcset="${w}" />`;return{html:C,preloadLink:O,css:D.length>0?D.join(`
10712
+ `):void 0,script:I}}async function Xp(e,t,r){let n={src:t.src,processed:!0,variants:[],placeholder:t.placeholder?.dataURL,originalWidth:t.placeholder?.width,originalHeight:t.placeholder?.height};for(let[i,s]of Object.entries(t.byFormat))if(s)n.variants.push(...s);return So(e,n,r)}var Dl=!1,_o=80,qi="async",Wi="lazy",$l=!1,ix=R(()=>{Dp(),kb()});function sx(){return kp({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(e,t,r,n)=>{let{src:i,alt:s,options:a}=ax(e,t,r);if(!i)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let o={src:i,alt:s||"",widths:a.widths||wn,formats:a.formats||zi,quality:a.quality,sizes:a.sizes,dpr:a.dpr,params:a.params,placeholder:a.placeholder,placeholderOptions:a.placeholderOptions,lazy:a.lazy!==!1,priority:a.priority||!1,loading:a.loading,decoding:a.decoding,fetchpriority:a.fetchpriority,objectFit:a.objectFit,objectPosition:a.objectPosition,class:a.class,style:a.style,id:a.id,width:a.width,height:a.height},l=r.__isDev||!1,c=await Hs(o,{isDev:l}),u=c.html;if(c.preloadLink)u=c.preloadLink+`
10713
10713
  `+u;if(c.css)u+=`
10714
10714
  <style>${c.css}</style>`;if(c.script)u+=`
10715
- <script>${c.script}</script>`;return u},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function sb(e,t,r){if(t.src)return{src:String(t.src),alt:String(t.alt||""),options:t.options||{}};let n=e.trim();if(n.startsWith("@img(")||n.startsWith("("))n=n.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let i=ab(n),s=ts(i[0],r)||"",a=ts(i[1],r)||"",o={};if(i[2]){let l=ts(i[2],r);if(typeof l==="object"&&l!==null)o=l;else if(typeof i[2]==="string")try{o=JSON.parse(i[2])}catch{}}return{src:s,alt:a,options:o}}function ab(e){let t=[],r="",n=!1,i="",s=0,a=0;for(let o=0;o<e.length;o++){let l=e[o],c=o>0?e[o-1]:"";if((l==='"'||l==="'"||l==="`")&&c!=="\\"){if(!n)n=!0,i=l;else if(l===i)n=!1,i="";else r+=l;continue}if(!n){if(l==="{")s++;if(l==="}")s--;if(l==="[")a++;if(l==="]")a--;if(l===","&&s===0&&a===0){t.push(r.trim()),r="";continue}}r+=l}if(r.trim())t.push(r.trim());return t}function ts(e,t){if(typeof e!=="string")return e;let r=e.trim();if(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))return r.slice(1,-1);if(!r.startsWith("/")&&!r.startsWith(".")&&!r.startsWith("http")&&!r.startsWith("{")){let n=t[r];if(n!==void 0)return n}if(r.startsWith("{")||r.startsWith("["))try{return JSON.parse(r)}catch{}return r}var Xp,ob=R(()=>{Ap(),nb(),jp(),Xp=ib()});class _o{config;constructor(e={}){this.config={...rf,...e}}async get(e,t){return Bp(e,t,"video",this.config)}async set(e,t,r){return zp(e,t,r,"video",this.config)}async clear(){return Fp("video",this.config)}updateConfig(e){this.config={...this.config,...e}}}function ko(e){if(!_n)_n=new _o(e);else if(e)_n.updateConfig(e);return _n}async function ef(e,t,r){let n=r?{directory:`${r.outputDir}/../.cache`}:{};return ko(n).get(e,t)}async function tf(e,t,r,n){let i=n?{directory:`${n.outputDir}/../.cache`}:{};return ko(i).set(e,t,r)}async function lb(){return ko().clear()}var rf,_n=null,nf=R(()=>{qp(),rf={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});async function Ro(){try{return await import("ts-videos")}catch{return null}}async function sf(e,t,r,n){let i=await Ro();if(!i)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let s=Eo(e);if(!await rt(s))return null;await To(r,{recursive:!0});let a=await dt(s),o=Ao(e,Co(e)),l=t.format||"webp",c=t.timestamp||0,u=`${o}-poster-${a}.${l}`,d=ui(r,u),h=await i.extractThumbnails(s,{timestamps:[c],width:t.width||1280,height:t.height,format:l,quality:t.quality||85,outputDir:r,outputPattern:u.replace(`.${l}`,"")});if(h&&h.length>0){let p=h[0];return{path:d,url:`${n}/${u}`,width:p.width||t.width||1280,height:p.height||720,timestamp:c,size:p.size||0}}return null}catch(s){return console.warn(`[stx-media] Failed to generate poster: ${s}`),null}}async function af(e,t,r,n){let i=await Ro();if(!i)return[];try{let s=Eo(e);if(!await rt(s))return[];await To(r,{recursive:!0});let a=await dt(s),o=Ao(e,Co(e)),l=t.format||"webp",c=(await new i.Input(s).getInfo()).duration||60,u=t.count||10,d=t.interval||c/u,h=[];for(let f=0;f<u&&f*d<c;f++)h.push(f*d);let p=await i.extractThumbnails(s,{timestamps:h,width:t.width||320,format:l,quality:t.quality||80,outputDir:r,outputPattern:`${o}-thumb-${a}`});if(p&&p.length>0)return p.map((f,m)=>({path:f.path||ui(r,`${o}-thumb-${a}-${m}.${l}`),url:`${n}/${o}-thumb-${a}-${m}.${l}`,width:f.width||t.width||320,height:f.height||180,timestamp:h[m],size:f.size||0}));return[]}catch(s){return console.warn(`[stx-media] Failed to generate thumbnails: ${s}`),[]}}async function cb(e,t,r,n){let i=await Ro();if(!i)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let s=Eo(e);if(!await rt(s))return null;await To(r,{recursive:!0});let a=await dt(s),o=Ao(e,Co(e)),l=(await new i.Input(s).getInfo()).duration||60,c=t.columns||10,u=t.interval||5,d=t.thumbnailWidth||160,h=t.thumbnailHeight||90,p=t.format||"jpeg",f=Math.ceil(l/u),m=Math.ceil(f/c),y=`${o}-sprite-${a}.${p}`,g=ui(r,y),v=[];for(let b=0;b<f;b++)v.push(b*u);let w=await i.extractThumbnails(s,{timestamps:v,width:d,height:h,format:p,quality:t.quality||70,outputDir:ui(r,".temp")});if(!w||w.length===0)return null;try{let b=await import("./chunk-gfd23b6t.js"),S=c*d,x=m*h,_=await b.createSprite({images:w.map((E)=>E.path),columns:c,padding:0,outputPath:g,format:p,quality:t.quality||70});return{url:`${n}/${y}`,path:g,columns:c,rows:m,thumbnailWidth:d,thumbnailHeight:h,interval:u,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(s){return console.warn(`[stx-media] Failed to generate sprite sheet: ${s}`),null}}var of=R(()=>{Pr()});async function pf(){try{return await import("ts-videos")}catch{return null}}async function ff(e,t,r,n,i){let s=await pf();if(!s)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let a=lf(e);if(!await rt(a))return null;let o=await dt(a),l=cf(e,uf(e)),c=Mt(r,`${l}-${o}-hls`);await di(c,{recursive:!0});let u=t.length>0?t:Io,d=i?.segmentDuration||6,h=(await new s.Input(a).getInfo()).duration||0,p=[],f=0;for(let g of u){let v=Mt(c,g.label);await di(v,{recursive:!0});let w=`${g.label}.m3u8`,b=Mt(v,w);try{let S=await s.generateHLS(a,{outputDir:v,segmentDuration:d,width:g.width,height:g.height,videoBitrate:g.bitrate,audioBitrate:g.audioBitrate,playlistName:g.label});if(S)p.push({quality:g,url:`${n}/${l}-${o}-hls/${g.label}/${w}`,path:b}),f+=S.segmentCount||Math.ceil(h/d)}catch(S){console.warn(`[stx-media] Failed to generate HLS for ${g.label}: ${S}`)}}if(p.length===0)return null;let m=Mt(c,"master.m3u8"),y=ub(p,n,l,o);return await df(m,y),{manifestUrl:`${n}/${l}-${o}-hls/master.m3u8`,manifestPath:m,playlists:p,segmentCount:f,duration:h}}catch(a){return console.warn(`[stx-media] Failed to generate HLS manifest: ${a}`),null}}function ub(e,t,r,n){let i=["#EXTM3U","#EXT-X-VERSION:3"];for(let s of e){let{quality:a}=s,o=a.bitrate+(a.audioBitrate||128000),l=`${a.width}x${a.height||Math.round(a.width*9/16)}`;i.push(`#EXT-X-STREAM-INF:BANDWIDTH=${o},RESOLUTION=${l},NAME="${a.label}"`,`${a.label}/${a.label}.m3u8`)}return i.join(`
10716
- `)}async function hf(e,t,r,n,i){let s=await pf();if(!s)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let a=lf(e);if(!await rt(a))return null;let o=await dt(a),l=cf(e,uf(e)),c=Mt(r,`${l}-${o}-dash`);await di(c,{recursive:!0});let u=t.length>0?t:Io,d=i?.segmentDuration||4,h=i?.minBufferTime||2,p=(await new s.Input(a).getInfo()).duration||0,f=[],m=[];for(let w of u){let b=Mt(c,w.label);await di(b,{recursive:!0});try{if(await s.generateDASH(a,{outputDir:b,segmentDuration:d,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(f.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${n}/${l}-${o}-dash/${w.label}/video`}),w.audioBitrate)m.push({bandwidth:w.audioBitrate,url:`${n}/${l}-${o}-dash/${w.label}/audio`})}}catch(S){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${S}`)}}if(f.length===0)return null;let y=Mt(c,"manifest.mpd"),g=db(f,m,p,d,h);await df(y,g);let v=[{type:"video",representations:f}];if(m.length>0)v.push({type:"audio",representations:m});return{manifestUrl:`${n}/${l}-${o}-dash/manifest.mpd`,manifestPath:y,adaptationSets:v,duration:p}}catch(a){return console.warn(`[stx-media] Failed to generate DASH manifest: ${a}`),null}}function db(e,t,r,n,i){let s=$l(r),a=$l(i),o=`<?xml version="1.0" encoding="UTF-8"?>
10715
+ <script>${c.script}</script>`;return u},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function ax(e,t,r){if(t.src)return{src:String(t.src),alt:String(t.alt||""),options:t.options||{}};let n=e.trim();if(n.startsWith("@img(")||n.startsWith("("))n=n.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let i=ox(n),s=rs(i[0],r)||"",a=rs(i[1],r)||"",o={};if(i[2]){let l=rs(i[2],r);if(typeof l==="object"&&l!==null)o=l;else if(typeof i[2]==="string")try{o=JSON.parse(i[2])}catch{}}return{src:s,alt:a,options:o}}function ox(e){let t=[],r="",n=!1,i="",s=0,a=0;for(let o=0;o<e.length;o++){let l=e[o],c=o>0?e[o-1]:"";if((l==='"'||l==="'"||l==="`")&&c!=="\\"){if(!n)n=!0,i=l;else if(l===i)n=!1,i="";else r+=l;continue}if(!n){if(l==="{")s++;if(l==="}")s--;if(l==="[")a++;if(l==="]")a--;if(l===","&&s===0&&a===0){t.push(r.trim()),r="";continue}}r+=l}if(r.trim())t.push(r.trim());return t}function rs(e,t){if(typeof e!=="string")return e;let r=e.trim();if(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))return r.slice(1,-1);if(!r.startsWith("/")&&!r.startsWith(".")&&!r.startsWith("http")&&!r.startsWith("{")){let n=t[r];if(n!==void 0)return n}if(r.startsWith("{")||r.startsWith("["))try{return JSON.parse(r)}catch{}return r}var ef,lx=R(()=>{Cp(),ix(),Dp(),ef=sx()});class ko{config;constructor(e={}){this.config={...nf,...e}}async get(e,t){return zp(e,t,"video",this.config)}async set(e,t,r){return Fp(e,t,r,"video",this.config)}async clear(){return qp("video",this.config)}updateConfig(e){this.config={...this.config,...e}}}function Eo(e){if(!kn)kn=new ko(e);else if(e)kn.updateConfig(e);return kn}async function tf(e,t,r){let n=r?{directory:`${r.outputDir}/../.cache`}:{};return Eo(n).get(e,t)}async function rf(e,t,r,n){let i=n?{directory:`${n.outputDir}/../.cache`}:{};return Eo(i).set(e,t,r)}async function cx(){return Eo().clear()}var nf,kn=null,sf=R(()=>{Wp(),nf={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});async function Io(){try{return await import("ts-videos")}catch{return null}}async function af(e,t,r,n){let i=await Io();if(!i)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let s=Ao(e);if(!await nt(s))return null;await Ro(r,{recursive:!0});let a=await pt(s),o=Co(e,To(e)),l=t.format||"webp",c=t.timestamp||0,u=`${o}-poster-${a}.${l}`,d=di(r,u),h=await i.extractThumbnails(s,{timestamps:[c],width:t.width||1280,height:t.height,format:l,quality:t.quality||85,outputDir:r,outputPattern:u.replace(`.${l}`,"")});if(h&&h.length>0){let p=h[0];return{path:d,url:`${n}/${u}`,width:p.width||t.width||1280,height:p.height||720,timestamp:c,size:p.size||0}}return null}catch(s){return console.warn(`[stx-media] Failed to generate poster: ${s}`),null}}async function of(e,t,r,n){let i=await Io();if(!i)return[];try{let s=Ao(e);if(!await nt(s))return[];await Ro(r,{recursive:!0});let a=await pt(s),o=Co(e,To(e)),l=t.format||"webp",c=(await new i.Input(s).getInfo()).duration||60,u=t.count||10,d=t.interval||c/u,h=[];for(let f=0;f<u&&f*d<c;f++)h.push(f*d);let p=await i.extractThumbnails(s,{timestamps:h,width:t.width||320,format:l,quality:t.quality||80,outputDir:r,outputPattern:`${o}-thumb-${a}`});if(p&&p.length>0)return p.map((f,m)=>({path:f.path||di(r,`${o}-thumb-${a}-${m}.${l}`),url:`${n}/${o}-thumb-${a}-${m}.${l}`,width:f.width||t.width||320,height:f.height||180,timestamp:h[m],size:f.size||0}));return[]}catch(s){return console.warn(`[stx-media] Failed to generate thumbnails: ${s}`),[]}}async function ux(e,t,r,n){let i=await Io();if(!i)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let s=Ao(e);if(!await nt(s))return null;await Ro(r,{recursive:!0});let a=await pt(s),o=Co(e,To(e)),l=(await new i.Input(s).getInfo()).duration||60,c=t.columns||10,u=t.interval||5,d=t.thumbnailWidth||160,h=t.thumbnailHeight||90,p=t.format||"jpeg",f=Math.ceil(l/u),m=Math.ceil(f/c),y=`${o}-sprite-${a}.${p}`,g=di(r,y),v=[];for(let b=0;b<f;b++)v.push(b*u);let w=await i.extractThumbnails(s,{timestamps:v,width:d,height:h,format:p,quality:t.quality||70,outputDir:di(r,".temp")});if(!w||w.length===0)return null;try{let b=await import("./chunk-9b6a58ac.js"),S=c*d,x=m*h,_=await b.createSprite({images:w.map((E)=>E.path),columns:c,padding:0,outputPath:g,format:p,quality:t.quality||70});return{url:`${n}/${y}`,path:g,columns:c,rows:m,thumbnailWidth:d,thumbnailHeight:h,interval:u,totalFrames:f}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(s){return console.warn(`[stx-media] Failed to generate sprite sheet: ${s}`),null}}var lf=R(()=>{Mr()});async function ff(){try{return await import("ts-videos")}catch{return null}}async function hf(e,t,r,n,i){let s=await ff();if(!s)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let a=cf(e);if(!await nt(a))return null;let o=await pt(a),l=uf(e,df(e)),c=Bt(r,`${l}-${o}-hls`);await pi(c,{recursive:!0});let u=t.length>0?t:Oo,d=i?.segmentDuration||6,h=(await new s.Input(a).getInfo()).duration||0,p=[],f=0;for(let g of u){let v=Bt(c,g.label);await pi(v,{recursive:!0});let w=`${g.label}.m3u8`,b=Bt(v,w);try{let S=await s.generateHLS(a,{outputDir:v,segmentDuration:d,width:g.width,height:g.height,videoBitrate:g.bitrate,audioBitrate:g.audioBitrate,playlistName:g.label});if(S)p.push({quality:g,url:`${n}/${l}-${o}-hls/${g.label}/${w}`,path:b}),f+=S.segmentCount||Math.ceil(h/d)}catch(S){console.warn(`[stx-media] Failed to generate HLS for ${g.label}: ${S}`)}}if(p.length===0)return null;let m=Bt(c,"master.m3u8"),y=dx(p,n,l,o);return await pf(m,y),{manifestUrl:`${n}/${l}-${o}-hls/master.m3u8`,manifestPath:m,playlists:p,segmentCount:f,duration:h}}catch(a){return console.warn(`[stx-media] Failed to generate HLS manifest: ${a}`),null}}function dx(e,t,r,n){let i=["#EXTM3U","#EXT-X-VERSION:3"];for(let s of e){let{quality:a}=s,o=a.bitrate+(a.audioBitrate||128000),l=`${a.width}x${a.height||Math.round(a.width*9/16)}`;i.push(`#EXT-X-STREAM-INF:BANDWIDTH=${o},RESOLUTION=${l},NAME="${a.label}"`,`${a.label}/${a.label}.m3u8`)}return i.join(`
10716
+ `)}async function mf(e,t,r,n,i){let s=await ff();if(!s)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let a=cf(e);if(!await nt(a))return null;let o=await pt(a),l=uf(e,df(e)),c=Bt(r,`${l}-${o}-dash`);await pi(c,{recursive:!0});let u=t.length>0?t:Oo,d=i?.segmentDuration||4,h=i?.minBufferTime||2,p=(await new s.Input(a).getInfo()).duration||0,f=[],m=[];for(let w of u){let b=Bt(c,w.label);await pi(b,{recursive:!0});try{if(await s.generateDASH(a,{outputDir:b,segmentDuration:d,width:w.width,height:w.height,videoBitrate:w.bitrate,audioBitrate:w.audioBitrate})){if(f.push({bandwidth:w.bitrate,width:w.width,height:w.height||Math.round(w.width*9/16),url:`${n}/${l}-${o}-dash/${w.label}/video`}),w.audioBitrate)m.push({bandwidth:w.audioBitrate,url:`${n}/${l}-${o}-dash/${w.label}/audio`})}}catch(S){console.warn(`[stx-media] Failed to generate DASH for ${w.label}: ${S}`)}}if(f.length===0)return null;let y=Bt(c,"manifest.mpd"),g=px(f,m,p,d,h);await pf(y,g);let v=[{type:"video",representations:f}];if(m.length>0)v.push({type:"audio",representations:m});return{manifestUrl:`${n}/${l}-${o}-dash/manifest.mpd`,manifestPath:y,adaptationSets:v,duration:p}}catch(a){return console.warn(`[stx-media] Failed to generate DASH manifest: ${a}`),null}}function px(e,t,r,n,i){let s=Ll(r),a=Ll(i),o=`<?xml version="1.0" encoding="UTF-8"?>
10717
10717
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
10718
10718
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10719
10719
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -10739,7 +10739,7 @@ ${S.join(`
10739
10739
  </Representation>
10740
10740
  `}o+=` </AdaptationSet>
10741
10741
  `}return o+=` </Period>
10742
- </MPD>`,o}function $l(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),i="PT";if(t>0)i+=`${t}H`;if(r>0)i+=`${r}M`;return i+=`${n}S`,i}var Io,mf=R(()=>{Pr(),Io=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});async function yf(){try{return await import("ts-videos")}catch{return null}}function gb(e){switch(e){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function yb(e){switch(e){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function vf(e){let t=await yf();if(!t)return null;try{let r=gf(e),n=await new t.Input(r).getInfo();return{duration:n.duration||0,width:n.width||0,height:n.height||0,frameRate:n.frameRate||0,bitrate:n.bitrate||0,codec:n.videoCodec||"",audioCodec:n.audioCodec}}catch(r){return console.warn(`[stx-media] Failed to analyze video: ${r}`),null}}async function vb(e,t,r,n){let i=await yf();if(!i)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:e,processed:!1};let s=await ef(e,t,r);if(s)return s;try{let a=gf(e);if(!await rt(a))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let o=r.outputDir||"dist/videos",l=r.baseUrl||"/videos";await mb(o,{recursive:!0});let c=await dt(a),u=pb(e,fb(e)),d={src:e,processed:!0,hash:c};n?.({percentage:5,stage:"analyzing"}),d.metadata=await vf(a)||void 0;let h={};if(t.quality)h.bitrate=gb(t.quality);if(t.platform)Object.assign(h,yb(t.platform));if(t.transcode)Object.assign(h,t.transcode);if(Object.keys(h).length>0||t.process){n?.({percentage:10,stage:"transcoding"});let p=`${u}-${c}.mp4`,f=hb(o,p);try{let m=await wb(a,f,h,i,(y)=>n?.({percentage:10+y*0.5,stage:"transcoding"}));if(m)d.transcoded={path:f,url:`${l}/${p}`,duration:m.duration,size:m.size,video:{codec:h.codec||"h264",width:m.width,height:m.height,bitrate:m.bitrate,frameRate:m.frameRate},audio:m.audioCodec?{codec:h.audioCodec||"aac",bitrate:h.audioBitrate||128000,sampleRate:h.sampleRate||48000,channels:h.channels||2}:void 0}}catch(m){d.errors=d.errors||[],d.errors.push(`Transcoding failed: ${m}`)}}if(t.generatePoster){n?.({percentage:65,stage:"generating-poster"});let p=typeof t.generatePoster==="object"?t.generatePoster:{timestamp:0},f=await sf(a,p,o,l);if(f)d.poster=f}if(r.thumbnails?.enabled){n?.({percentage:70,stage:"generating-thumbnails"});let p=await af(a,r.thumbnails,o,l);if(p.length>0)d.thumbnails=p}if(t.streaming){n?.({percentage:80,stage:"generating-manifests"});let p=typeof t.streaming==="object"?t.streaming:r.streaming||{format:"hls"};if(p.format==="hls"||p.format===void 0){let f=await ff(a,p.qualities||r.streaming?.defaultQualities||[],o,l);if(f)d.streaming={...d.streaming,hls:f}}if(p.format==="dash"){let f=await hf(a,p.qualities||r.streaming?.defaultQualities||[],o,l);if(f)d.streaming={...d.streaming,dash:f}}}if(t.spriteSheet)n?.({percentage:90,stage:"generating-sprite-sheet"});return n?.({percentage:100,stage:"complete"}),await tf(e,t,d,r),d}catch(a){return{src:e,processed:!1,errors:[`Processing failed: ${a}`]}}}async function wb(e,t,r,n,i){try{let s=await new n.Conversion(e,t,{videoCodec:r.codec,videoBitrate:r.bitrate,width:r.maxWidth,height:r.maxHeight,frameRate:r.frameRate,audioCodec:r.audioCodec,audioBitrate:r.audioBitrate,sampleRate:r.sampleRate,channels:r.channels}).run((a)=>{i?.(a.percentage/100)});return{duration:s.duration||0,size:s.size||0,width:s.width||r.maxWidth||0,height:s.height||r.maxHeight||0,bitrate:s.bitrate||r.bitrate||0,frameRate:s.frameRate||r.frameRate||30,audioCodec:s.audioCodec}}catch(s){return console.error(`[stx-media] Transcoding failed: ${s}`),null}}var bb=R(()=>{Pr(),nf(),of(),mf()}),wf={};Y(wf,{setCachedVideoResult:()=>tf,processVideo:()=>vb,getCachedVideoResult:()=>ef,generateThumbnails:()=>af,generateSpriteSheet:()=>cb,generatePoster:()=>sf,generateHLSManifest:()=>ff,generateDASHManifest:()=>hf,clearVideoCache:()=>lb,analyzeVideo:()=>vf,VideoProcessorCache:()=>_o});var xb=R(()=>{bb(),of(),mf(),nf()});async function bf(){try{return await Promise.resolve().then(()=>(xb(),wf))}catch(e){if(!Ll)console.warn("[stx-media] Video processor not available, some features disabled:",e),Ll=!0;return null}}async function Hs(e,t={}){let r=t,n=e;if(n.process&&!n.skipProcessing){if(r.tsVideosConfig?.enabled&&!r.isDev)return Ab(n,r)}if(r.processedResult?.processed)return Sf(e,r.processedResult,t);let i;if(n.generatePoster&&n.src&&!e.poster)i=await Cb(n,r);let{src:s,sources:a=[],poster:o,posterPlaceholder:l,controls:c=_f,autoplay:u=!1,muted:d=!1,loop:h=!1,preload:p=kf,playsinline:f=!0,lazy:m=!0,player:y="native",type:g,width:v,height:w,crossorigin:b,disablePictureInPicture:S=!1,disableRemotePlayback:x=!1}=e,_=i||o,E=e.class,k=e.style,A=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(y==="ts-video")return _b(e,t);if(g&&g!=="video")return Sb(s||"",g,e);let T=a.length>0?a:s?[{src:s,type:xf(s)}]:[],C=[`id="${A}"`];if(c)C.push("controls");if(u)C.push("autoplay");if(d)C.push("muted");if(h)C.push("loop");if(f)C.push("playsinline");if(S)C.push("disablepictureinpicture");if(x)C.push("disableremoteplayback");if(b)C.push(`crossorigin="${b}"`);if(m){if(C.push(`data-preload="${p}"`),C.push('preload="none"'),_)C.push(`data-poster="${he(_)}"`);C.push("data-stx-lazy")}else if(C.push(`preload="${p}"`),_)C.push(`poster="${he(_)}"`);if(v)C.push(`width="${v}"`);if(w)C.push(`height="${w}"`);if(E)C.push(`class="${he(E)}"`);if(k)C.push(`style="${he(k)}"`);let D=T.map((L)=>{return` <source ${m?`data-src="${he(L.src)}"`:`src="${he(L.src)}"`} type="${L.type}"${L.media?` media="${L.media}"`:""} />`}).join(`
10742
+ </MPD>`,o}function Ll(e){let t=Math.floor(e/3600),r=Math.floor(e%3600/60),n=Math.floor(e%60),i="PT";if(t>0)i+=`${t}H`;if(r>0)i+=`${r}M`;return i+=`${n}S`,i}var Oo,gf=R(()=>{Mr(),Oo=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});async function vf(){try{return await import("ts-videos")}catch{return null}}function yx(e){switch(e){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function vx(e){switch(e){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function wf(e){let t=await vf();if(!t)return null;try{let r=yf(e),n=await new t.Input(r).getInfo();return{duration:n.duration||0,width:n.width||0,height:n.height||0,frameRate:n.frameRate||0,bitrate:n.bitrate||0,codec:n.videoCodec||"",audioCodec:n.audioCodec}}catch(r){return console.warn(`[stx-media] Failed to analyze video: ${r}`),null}}async function wx(e,t,r,n){let i=await vf();if(!i)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:e,processed:!1};let s=await tf(e,t,r);if(s)return s;try{let a=yf(e);if(!await nt(a))return{src:e,processed:!1,errors:[`Source file not found: ${e}`]};let o=r.outputDir||"dist/videos",l=r.baseUrl||"/videos";await gx(o,{recursive:!0});let c=await pt(a),u=fx(e,hx(e)),d={src:e,processed:!0,hash:c};n?.({percentage:5,stage:"analyzing"}),d.metadata=await wf(a)||void 0;let h={};if(t.quality)h.bitrate=yx(t.quality);if(t.platform)Object.assign(h,vx(t.platform));if(t.transcode)Object.assign(h,t.transcode);if(Object.keys(h).length>0||t.process){n?.({percentage:10,stage:"transcoding"});let p=`${u}-${c}.mp4`,f=mx(o,p);try{let m=await bx(a,f,h,i,(y)=>n?.({percentage:10+y*0.5,stage:"transcoding"}));if(m)d.transcoded={path:f,url:`${l}/${p}`,duration:m.duration,size:m.size,video:{codec:h.codec||"h264",width:m.width,height:m.height,bitrate:m.bitrate,frameRate:m.frameRate},audio:m.audioCodec?{codec:h.audioCodec||"aac",bitrate:h.audioBitrate||128000,sampleRate:h.sampleRate||48000,channels:h.channels||2}:void 0}}catch(m){d.errors=d.errors||[],d.errors.push(`Transcoding failed: ${m}`)}}if(t.generatePoster){n?.({percentage:65,stage:"generating-poster"});let p=typeof t.generatePoster==="object"?t.generatePoster:{timestamp:0},f=await af(a,p,o,l);if(f)d.poster=f}if(r.thumbnails?.enabled){n?.({percentage:70,stage:"generating-thumbnails"});let p=await of(a,r.thumbnails,o,l);if(p.length>0)d.thumbnails=p}if(t.streaming){n?.({percentage:80,stage:"generating-manifests"});let p=typeof t.streaming==="object"?t.streaming:r.streaming||{format:"hls"};if(p.format==="hls"||p.format===void 0){let f=await hf(a,p.qualities||r.streaming?.defaultQualities||[],o,l);if(f)d.streaming={...d.streaming,hls:f}}if(p.format==="dash"){let f=await mf(a,p.qualities||r.streaming?.defaultQualities||[],o,l);if(f)d.streaming={...d.streaming,dash:f}}}if(t.spriteSheet)n?.({percentage:90,stage:"generating-sprite-sheet"});return n?.({percentage:100,stage:"complete"}),await rf(e,t,d,r),d}catch(a){return{src:e,processed:!1,errors:[`Processing failed: ${a}`]}}}async function bx(e,t,r,n,i){try{let s=await new n.Conversion(e,t,{videoCodec:r.codec,videoBitrate:r.bitrate,width:r.maxWidth,height:r.maxHeight,frameRate:r.frameRate,audioCodec:r.audioCodec,audioBitrate:r.audioBitrate,sampleRate:r.sampleRate,channels:r.channels}).run((a)=>{i?.(a.percentage/100)});return{duration:s.duration||0,size:s.size||0,width:s.width||r.maxWidth||0,height:s.height||r.maxHeight||0,bitrate:s.bitrate||r.bitrate||0,frameRate:s.frameRate||r.frameRate||30,audioCodec:s.audioCodec}}catch(s){return console.error(`[stx-media] Transcoding failed: ${s}`),null}}var xx=R(()=>{Mr(),sf(),lf(),gf()}),bf={};K(bf,{setCachedVideoResult:()=>rf,processVideo:()=>wx,getCachedVideoResult:()=>tf,generateThumbnails:()=>of,generateSpriteSheet:()=>ux,generatePoster:()=>af,generateHLSManifest:()=>hf,generateDASHManifest:()=>mf,clearVideoCache:()=>cx,analyzeVideo:()=>wf,VideoProcessorCache:()=>ko});var Sx=R(()=>{xx(),lf(),gf(),sf()});async function xf(){try{return await Promise.resolve().then(()=>(Sx(),bf))}catch(e){if(!Nl)console.warn("[stx-media] Video processor not available, some features disabled:",e),Nl=!0;return null}}async function Us(e,t={}){let r=t,n=e;if(n.process&&!n.skipProcessing){if(r.tsVideosConfig?.enabled&&!r.isDev)return Cx(n,r)}if(r.processedResult?.processed)return _f(e,r.processedResult,t);let i;if(n.generatePoster&&n.src&&!e.poster)i=await Tx(n,r);let{src:s,sources:a=[],poster:o,posterPlaceholder:l,controls:c=kf,autoplay:u=!1,muted:d=!1,loop:h=!1,preload:p=Ef,playsinline:f=!0,lazy:m=!0,player:y="native",type:g,width:v,height:w,crossorigin:b,disablePictureInPicture:S=!1,disableRemotePlayback:x=!1}=e,_=i||o,E=e.class,k=e.style,A=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(y==="ts-video")return kx(e,t);if(g&&g!=="video")return _x(s||"",g,e);let T=a.length>0?a:s?[{src:s,type:Sf(s)}]:[],C=[`id="${A}"`];if(c)C.push("controls");if(u)C.push("autoplay");if(d)C.push("muted");if(h)C.push("loop");if(f)C.push("playsinline");if(S)C.push("disablepictureinpicture");if(x)C.push("disableremoteplayback");if(b)C.push(`crossorigin="${b}"`);if(m){if(C.push(`data-preload="${p}"`),C.push('preload="none"'),_)C.push(`data-poster="${me(_)}"`);C.push("data-stx-lazy")}else if(C.push(`preload="${p}"`),_)C.push(`poster="${me(_)}"`);if(v)C.push(`width="${v}"`);if(w)C.push(`height="${w}"`);if(E)C.push(`class="${me(E)}"`);if(k)C.push(`style="${me(k)}"`);let D=T.map((N)=>` <source ${m?`data-src="${me(N.src)}"`:`src="${me(N.src)}"`} type="${N.type}"${N.media?` media="${N.media}"`:""} />`).join(`
10743
10743
  `),I=`<video ${C.join(" ")}>
10744
10744
  ${D}
10745
10745
  Your browser does not support the video tag.
@@ -10778,12 +10778,12 @@ ${D}
10778
10778
 
10779
10779
  observer.observe(video);
10780
10780
  })();
10781
- `.trim();return{html:I,script:O}}function Sb(e,t,r){let{width:n=640,height:i=360}=r,s=r.class,a=r.style,o=r.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,l,c=null;switch(t){case"youtube":c=kb(e),l=c?`https://www.youtube-nocookie.com/embed/${c}`:e;break;case"vimeo":c=Eb(e),l=c?`https://player.vimeo.com/video/${c}`:e;break;case"dailymotion":c=e.split("/").pop()||"",l=`https://www.dailymotion.com/embed/video/${c}`;break;case"twitch":c=e.split("/").pop()||"",l=`https://player.twitch.tv/?video=${c}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:l=e}let u=[`id="${o}"`,`src="${he(l)}"`,`width="${n}"`,`height="${i}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(s)u.push(`class="${he(s)}"`);if(a)u.push(`style="${he(a)}"`);if(r.lazy)u.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
10781
+ `.trim();return{html:I,script:O}}function _x(e,t,r){let{width:n=640,height:i=360}=r,s=r.class,a=r.style,o=r.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,l,c=null;switch(t){case"youtube":c=Ex(e),l=c?`https://www.youtube-nocookie.com/embed/${c}`:e;break;case"vimeo":c=Ax(e),l=c?`https://player.vimeo.com/video/${c}`:e;break;case"dailymotion":c=e.split("/").pop()||"",l=`https://www.dailymotion.com/embed/video/${c}`;break;case"twitch":c=e.split("/").pop()||"",l=`https://player.twitch.tv/?video=${c}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:l=e}let u=[`id="${o}"`,`src="${me(l)}"`,`width="${n}"`,`height="${i}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(s)u.push(`class="${me(s)}"`);if(a)u.push(`style="${me(a)}"`);if(r.lazy)u.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
10782
10782
  <iframe ${u.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
10783
- </div>`}}function _b(e,t={}){let{src:r,sources:n=[],poster:i,controls:s=!0,autoplay:a=!1,muted:o=!1,loop:l=!1,preload:c="metadata",playsinline:u=!0,lazy:d=!0,width:h,height:p}=e,f=e.class,m=e.style,y=e.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,g={src:n.length>0?n:r,autoplay:a,loop:l,muted:o,playsinline:u,preload:c,poster:i,controls:s,title:e.title},v=["position: relative",h?`width: ${typeof h==="number"?h+"px":h}`:"width: 100%",p?`height: ${typeof p==="number"?p+"px":p}`:"",m||""].filter(Boolean).join("; "),w=`
10783
+ </div>`}}function kx(e,t={}){let{src:r,sources:n=[],poster:i,controls:s=!0,autoplay:a=!1,muted:o=!1,loop:l=!1,preload:c="metadata",playsinline:u=!0,lazy:d=!0,width:h,height:p}=e,f=e.class,m=e.style,y=e.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,g={src:n.length>0?n:r,autoplay:a,loop:l,muted:o,playsinline:u,preload:c,poster:i,controls:s,title:e.title},v=["position: relative",h?`width: ${typeof h==="number"?h+"px":h}`:"width: 100%",p?`height: ${typeof p==="number"?p+"px":p}`:"",m||""].filter(Boolean).join("; "),w=`
10784
10784
  <div
10785
10785
  id="${y}"
10786
- class="ts-video-player${f?" "+he(f):""}"
10786
+ class="ts-video-player${f?" "+me(f):""}"
10787
10787
  style="${v}"
10788
10788
  data-ts-video-player
10789
10789
  data-config='${JSON.stringify(g)}'
@@ -10791,7 +10791,7 @@ ${D}
10791
10791
  >
10792
10792
  <div class="ts-video-player__container">
10793
10793
  ${i?`
10794
- <div class="ts-video-player__placeholder" style="background-image: url('${he(i)}');">
10794
+ <div class="ts-video-player__placeholder" style="background-image: url('${me(i)}');">
10795
10795
  <button class="ts-video-player__play-button" aria-label="Play video">
10796
10796
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
10797
10797
  <path d="M8 5v14l11-7z"/>
@@ -10817,7 +10817,7 @@ ${D}
10817
10817
 
10818
10818
  // Load ts-video-player from CDN
10819
10819
  var script = document.createElement('script');
10820
- script.src = '${Tb}';
10820
+ script.src = '${Rx}';
10821
10821
  script.onload = initPlayer;
10822
10822
  script.onerror = function() {
10823
10823
  console.error('[stx] Failed to load ts-video-player');
@@ -10947,10 +10947,10 @@ else {
10947
10947
  .ts-video-player__play-button svg {
10948
10948
  margin-left: 4px;
10949
10949
  }
10950
- `.trim();return{html:w,script:b,css:S}}function xf(e){switch(e.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function kb(e){let t=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let r of t){let n=e.match(r);if(n)return n[1]}return null}function Eb(e){let t=e.match(/vimeo\.com\/(\d+)/);return t?t[1]:null}function he(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Ab(e,t){let r=await bf();if(!r)return Hs({...e,process:!1},t);let n=t.tsVideosConfig,i=await r.processVideo(e.src,e,n,e.onProcessProgress);if(i.processed)return Sf(e,i,t);return Hs({...e,process:!1},t)}async function Cb(e,t){let r=await bf();if(!r||!e.src)return;let n=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},i=t.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await r.generatePoster(e.src,n,i.outputDir,i.baseUrl||"/videos"))?.url}function Sf(e,t,r){let{controls:n=_f,autoplay:i=!1,muted:s=!1,loop:a=!1,preload:o=kf,playsinline:l=!0,lazy:c=!0,width:u,height:d,crossorigin:h,disablePictureInPicture:p=!1,disableRemotePlayback:f=!1}=e,m=e.class,y=e.style,g=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,v=e.src,w=xf(v);if(t.transcoded)v=t.transcoded.url,w="video/mp4";let b=t.streaming?.hls||t.streaming?.dash;if(b){if(t.streaming?.hls)v=t.streaming.hls.manifestUrl,w="application/x-mpegURL";else if(t.streaming?.dash)v=t.streaming.dash.manifestUrl,w="application/dash+xml"}let S=t.poster?.url||e.poster,x=[`id="${g}"`];if(n)x.push("controls");if(i)x.push("autoplay");if(s)x.push("muted");if(a)x.push("loop");if(l)x.push("playsinline");if(p)x.push("disablepictureinpicture");if(f)x.push("disableremoteplayback");if(h)x.push(`crossorigin="${h}"`);if(c){if(x.push(`data-preload="${o}"`),x.push('preload="none"'),S)x.push(`data-poster="${he(S)}"`);x.push("data-stx-lazy")}else if(x.push(`preload="${o}"`),S)x.push(`poster="${he(S)}"`);let _=u||t.metadata?.width,E=d||t.metadata?.height;if(_)x.push(`width="${_}"`);if(E)x.push(`height="${E}"`);if(m)x.push(`class="${he(m)}"`);if(y)x.push(`style="${he(y)}"`);let k=` <source ${c?`data-src="${he(v)}"`:`src="${he(v)}"`} type="${w}" />`,A=`<video ${x.join(" ")}>
10950
+ `.trim();return{html:w,script:b,css:S}}function Sf(e){switch(e.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Ex(e){let t=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let r of t){let n=e.match(r);if(n)return n[1]}return null}function Ax(e){let t=e.match(/vimeo\.com\/(\d+)/);return t?t[1]:null}function me(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Cx(e,t){let r=await xf();if(!r)return Us({...e,process:!1},t);let n=t.tsVideosConfig,i=await r.processVideo(e.src,e,n,e.onProcessProgress);if(i.processed)return _f(e,i,t);return Us({...e,process:!1},t)}async function Tx(e,t){let r=await xf();if(!r||!e.src)return;let n=typeof e.generatePoster==="object"?e.generatePoster:{timestamp:0},i=t.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await r.generatePoster(e.src,n,i.outputDir,i.baseUrl||"/videos"))?.url}function _f(e,t,r){let{controls:n=kf,autoplay:i=!1,muted:s=!1,loop:a=!1,preload:o=Ef,playsinline:l=!0,lazy:c=!0,width:u,height:d,crossorigin:h,disablePictureInPicture:p=!1,disableRemotePlayback:f=!1}=e,m=e.class,y=e.style,g=e.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,v=e.src,w=Sf(v);if(t.transcoded)v=t.transcoded.url,w="video/mp4";let b=t.streaming?.hls||t.streaming?.dash;if(b){if(t.streaming?.hls)v=t.streaming.hls.manifestUrl,w="application/x-mpegURL";else if(t.streaming?.dash)v=t.streaming.dash.manifestUrl,w="application/dash+xml"}let S=t.poster?.url||e.poster,x=[`id="${g}"`];if(n)x.push("controls");if(i)x.push("autoplay");if(s)x.push("muted");if(a)x.push("loop");if(l)x.push("playsinline");if(p)x.push("disablepictureinpicture");if(f)x.push("disableremoteplayback");if(h)x.push(`crossorigin="${h}"`);if(c){if(x.push(`data-preload="${o}"`),x.push('preload="none"'),S)x.push(`data-poster="${me(S)}"`);x.push("data-stx-lazy")}else if(x.push(`preload="${o}"`),S)x.push(`poster="${me(S)}"`);let _=u||t.metadata?.width,E=d||t.metadata?.height;if(_)x.push(`width="${_}"`);if(E)x.push(`height="${E}"`);if(m)x.push(`class="${me(m)}"`);if(y)x.push(`style="${me(y)}"`);let k=` <source ${c?`data-src="${me(v)}"`:`src="${me(v)}"`} type="${w}" />`,A=`<video ${x.join(" ")}>
10951
10951
  ${k}
10952
10952
  Your browser does not support the video tag.
10953
- </video>`;if(t.spriteSheet)A=`<div class="stx-video-wrapper" data-sprite-sheet="${he(t.spriteSheet.url)}" data-sprite-cols="${t.spriteSheet.columns}" data-sprite-interval="${t.spriteSheet.interval}">
10953
+ </video>`;if(t.spriteSheet)A=`<div class="stx-video-wrapper" data-sprite-sheet="${me(t.spriteSheet.url)}" data-sprite-cols="${t.spriteSheet.columns}" data-sprite-interval="${t.spriteSheet.interval}">
10954
10954
  ${A}
10955
10955
  </div>`;let T;if(c)T=`
10956
10956
  (function() {
@@ -10996,9 +10996,9 @@ ${A}
10996
10996
  width: 100%;
10997
10997
  height: auto;
10998
10998
  }
10999
- `.trim();return{html:A,script:T,css:C}}var Ll=!1,_f=!0,kf="metadata",Tb="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js",Rb=R(()=>{Af()});function Ib(){return _p({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,t,r,n)=>{let{src:i,options:s}=Ob(e,t,r);if(!i)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let a={src:i,poster:s.poster,controls:s.controls!==!1,autoplay:s.autoplay||!1,muted:s.muted||!1,loop:s.loop||!1,preload:s.preload||"metadata",playsinline:s.playsinline!==!1,lazy:s.lazy!==!1,player:s.player||"native",type:s.type,width:s.width,height:s.height,class:s.class,style:s.style,id:s.id,crossorigin:s.crossorigin,disablePictureInPicture:s.disablePictureInPicture,disableRemotePlayback:s.disableRemotePlayback,title:s.title,quality:s.quality,platform:s.platform,process:s.process,generatePoster:s.generatePoster,streaming:s.streaming,transcode:s.transcode,spriteSheet:s.spriteSheet,waveform:s.waveform},o={isDev:r.__isDev||!1,tsVideosConfig:r.__tsVideosConfig},l=await Hs(a,o),c=l.html;if(l.css)c+=`
10999
+ `.trim();return{html:A,script:T,css:C}}var Nl=!1,kf=!0,Ef="metadata",Rx="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js",Ix=R(()=>{Cf()});function Ox(){return kp({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(e,t,r,n)=>{let{src:i,options:s}=jx(e,t,r);if(!i)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let a={src:i,poster:s.poster,controls:s.controls!==!1,autoplay:s.autoplay||!1,muted:s.muted||!1,loop:s.loop||!1,preload:s.preload||"metadata",playsinline:s.playsinline!==!1,lazy:s.lazy!==!1,player:s.player||"native",type:s.type,width:s.width,height:s.height,class:s.class,style:s.style,id:s.id,crossorigin:s.crossorigin,disablePictureInPicture:s.disablePictureInPicture,disableRemotePlayback:s.disableRemotePlayback,title:s.title,quality:s.quality,platform:s.platform,process:s.process,generatePoster:s.generatePoster,streaming:s.streaming,transcode:s.transcode,spriteSheet:s.spriteSheet,waveform:s.waveform},o={isDev:r.__isDev||!1,tsVideosConfig:r.__tsVideosConfig},l=await Us(a,o),c=l.html;if(l.css)c+=`
11000
11000
  <style>${l.css}</style>`;if(l.script)c+=`
11001
- <script>${l.script}</script>`;return c},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Ob(e,t,r){if(t.src)return{src:String(t.src),options:t.options||{}};let n=e.trim();if(n.startsWith("@video(")||n.startsWith("("))n=n.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let i=jb(n),s=Nl(i[0],r)||"",a={};if(i[1]){let o=Nl(i[1],r);if(typeof o==="object"&&o!==null)a=o;else if(typeof i[1]==="string")try{a=JSON.parse(i[1])}catch{}}return{src:s,options:a}}function jb(e){let t=[],r="",n=!1,i="",s=0,a=0;for(let o=0;o<e.length;o++){let l=e[o],c=o>0?e[o-1]:"";if((l==='"'||l==="'"||l==="`")&&c!=="\\"){if(!n)n=!0,i=l;else if(l===i)n=!1,i="";else r+=l;continue}if(!n){if(l==="{")s++;if(l==="}")s--;if(l==="[")a++;if(l==="]")a--;if(l===","&&s===0&&a===0){t.push(r.trim()),r="";continue}}r+=l}if(r.trim())t.push(r.trim());return t}function Nl(e,t){if(typeof e!=="string")return e;let r=e.trim();if(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))return r.slice(1,-1);if(!r.startsWith("/")&&!r.startsWith(".")&&!r.startsWith("http")&&!r.startsWith("{")){let n=t[r];if(n!==void 0)return n}if(r.startsWith("{")||r.startsWith("["))try{return JSON.parse(r)}catch{}return r}var Ef,Af=R(()=>{Ap(),Rb(),Ef=Ib()});function Db(e,t){let r=t.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11001
+ <script>${l.script}</script>`;return c},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function jx(e,t,r){if(t.src)return{src:String(t.src),options:t.options||{}};let n=e.trim();if(n.startsWith("@video(")||n.startsWith("("))n=n.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let i=Dx(n),s=Pl(i[0],r)||"",a={};if(i[1]){let o=Pl(i[1],r);if(typeof o==="object"&&o!==null)a=o;else if(typeof i[1]==="string")try{a=JSON.parse(i[1])}catch{}}return{src:s,options:a}}function Dx(e){let t=[],r="",n=!1,i="",s=0,a=0;for(let o=0;o<e.length;o++){let l=e[o],c=o>0?e[o-1]:"";if((l==='"'||l==="'"||l==="`")&&c!=="\\"){if(!n)n=!0,i=l;else if(l===i)n=!1,i="";else r+=l;continue}if(!n){if(l==="{")s++;if(l==="}")s--;if(l==="[")a++;if(l==="]")a--;if(l===","&&s===0&&a===0){t.push(r.trim()),r="";continue}}r+=l}if(r.trim())t.push(r.trim());return t}function Pl(e,t){if(typeof e!=="string")return e;let r=e.trim();if(r.startsWith('"')&&r.endsWith('"')||r.startsWith("'")&&r.endsWith("'"))return r.slice(1,-1);if(!r.startsWith("/")&&!r.startsWith(".")&&!r.startsWith("http")&&!r.startsWith("{")){let n=t[r];if(n!==void 0)return n}if(r.startsWith("{")||r.startsWith("["))try{return JSON.parse(r)}catch{}return r}var Af,Cf=R(()=>{Cp(),Ix(),Af=Ox()});function $x(e,t){let r=t.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11002
11002
  ${e}
11003
11003
  </div>
11004
11004
  <script>
@@ -11043,7 +11043,7 @@ ${A}
11043
11043
  }
11044
11044
  }
11045
11045
  })();
11046
- </script>`}function $b(e,t){let r=t.pwa?.updates,n=r?.message||"A new version is available. Reload to update?",i=r?.autoReload||!1,s=e.trim().length>0,a=`
11046
+ </script>`}function Lx(e,t){let r=t.pwa?.updates,n=r?.message||"A new version is available. Reload to update?",i=r?.autoReload||!1,s=e.trim().length>0,a=`
11047
11047
  <div class="stx-pwa-update-banner" style="
11048
11048
  position: fixed;
11049
11049
  bottom: 0;
@@ -11154,7 +11154,7 @@ else {
11154
11154
  // Also listen for custom event
11155
11155
  window.addEventListener('pwa-update-available', showUpdate);
11156
11156
  })();
11157
- </script>`}function Lb(e,t){let r=e.trim().length>0,n=`
11157
+ </script>`}function Nx(e,t){let r=e.trim().length>0,n=`
11158
11158
  <div class="stx-offline-indicator" style="
11159
11159
  position: fixed;
11160
11160
  top: 16px;
@@ -11215,7 +11215,7 @@ else {
11215
11215
  window.addEventListener('offline', updateStatus);
11216
11216
  updateStatus();
11217
11217
  })();
11218
- </script>`}function Nb(e,t){let r=t.pwa?.push,n=r?.vapidPublicKey||"",i=r?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
11218
+ </script>`}function Px(e,t){let r=t.pwa?.push,n=r?.vapidPublicKey||"",i=r?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
11219
11219
  ${e}
11220
11220
  </div>
11221
11221
  <script>
@@ -11297,72 +11297,72 @@ catch (error) {
11297
11297
  init();
11298
11298
  }
11299
11299
  })();
11300
- </script>`}var Pl,Ml,Bl,zl,Cf,Pb=R(()=>{Pl={name:"pwa.installButton",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return Db(e,i)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Ml={name:"pwa.updatePrompt",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return $b(e,i)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Bl={name:"pwa.offlineIndicator",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return Lb(e,i)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},zl={name:"pwa.pushSubscribe",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return Nb(e,i)},hasEndTag:!0,description:"Renders a push notification subscription button"},Cf=[Pl,Ml,Bl,zl]});function Mb(e){for(let[t,r]of Object.entries(re))if(r===e)return t;return}var re,Oo=R(()=>{re={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 jo(){return!1}function Us(){return!jo()||process.env.STX_DEBUG==="true"}function Tf(){return!1}function Fl(){return{...pi}}function Rf(e){if(!pi.showRelativePaths||!e)return e;let t=pi.baseDir||process.cwd();try{let r=Bb.relative(t,e);return r.startsWith("..")?e:r}catch{return e}}var ql,pi,rs,Xr,If,Do=R(()=>{Oo(),ql={showRelativePaths:!1,enableAutoRecovery:Us(),logRecoveryWarnings:!0},pi={...ql},rs=class extends Error{code;filePath;line;column;context;numericCode;constructor(t,r,n,i,s,a,o){super(t);if(this.code=r,this.filePath=n,this.line=i,this.column=s,this.context=a,this.name="StxError",this.numericCode=o||re.EVALUATION_ERROR,this.filePath)this.filePath=Rf(this.filePath)}},Xr=class extends rs{constructor(t,r,n,i,s,a){super(t,"stx_RUNTIME_ERROR",r,n,i,s,a||re.EVALUATION_ERROR);this.name="StxRuntimeError"}},If=class extends rs{isFatal=!0;constructor(t,r,n,i,s,a){super(t,"stx_VALIDATION_ERROR",r,n,i,s,a||re.DOM_API_VIOLATION);this.name="StxValidationError"}}});function zb(e){let{type:t,message:r,code:n,filePath:i,line:s,column:a,template:o,offset:l,snippet:c,suggestion:u,format:d="text"}=e,h=s,p=a;if(!h&&o&&l!==void 0){let v=Gb(o,l);h=v.line,p=v.column}let f=i?Rf(i):void 0,m=n?Mb(n):void 0,y={type:t,code:n,codeName:m,message:r,filePath:f,line:h,column:p,snippet:c,suggestion:u,timestamp:new Date().toISOString()},g;switch(d){case"html":g=qb(y);break;case"json":g=JSON.stringify(y,null,2);break;case"console":g=Wb(y,o,l);break;case"text":default:g=Fb(y,o,l);break}return{formatted:g,data:y}}function Fb(e,t,r){let n=[],i=e.code?` [${e.codeName||e.code}]`:"";if(n.push(`[${e.type} Error${i}]`),e.filePath){let s=e.filePath;if(e.line){if(s+=`:${e.line}`,e.column)s+=`:${e.column}`}n.push(`at ${s}`)}if(n.push(`
11301
- ${e.message}`),t&&e.line){let s=Hb(t,e.line,2);if(s)n.push(`
11300
+ </script>`}var Ml,Bl,zl,Fl,Tf,Mx=R(()=>{Ml={name:"pwa.installButton",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return $x(e,i)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Bl={name:"pwa.updatePrompt",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return Lx(e,i)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},zl={name:"pwa.offlineIndicator",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return Nx(e,i)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Fl={name:"pwa.pushSubscribe",handler:(e,t,r,n)=>{let i=r.__stx_options||{};return Px(e,i)},hasEndTag:!0,description:"Renders a push notification subscription button"},Tf=[Ml,Bl,zl,Fl]});function Bx(e){for(let[t,r]of Object.entries(ne))if(r===e)return t;return}var ne,jo=R(()=>{ne={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 Do(){return!1}function Gs(){return!Do()||process.env.STX_DEBUG==="true"}function Rf(){return!1}function ql(){return{...fi}}function If(e){if(!fi.showRelativePaths||!e)return e;let t=fi.baseDir||process.cwd();try{let r=zx.relative(t,e);return r.startsWith("..")?e:r}catch{return e}}var Wl,fi,ns,en,Of,$o=R(()=>{jo(),Wl={showRelativePaths:!1,enableAutoRecovery:Gs(),logRecoveryWarnings:!0},fi={...Wl},ns=class extends Error{code;filePath;line;column;context;numericCode;constructor(t,r,n,i,s,a,o){super(t);if(this.code=r,this.filePath=n,this.line=i,this.column=s,this.context=a,this.name="StxError",this.numericCode=o||ne.EVALUATION_ERROR,this.filePath)this.filePath=If(this.filePath)}},en=class extends ns{constructor(t,r,n,i,s,a){super(t,"stx_RUNTIME_ERROR",r,n,i,s,a||ne.EVALUATION_ERROR);this.name="StxRuntimeError"}},Of=class extends ns{isFatal=!0;constructor(t,r,n,i,s,a){super(t,"stx_VALIDATION_ERROR",r,n,i,s,a||ne.DOM_API_VIOLATION);this.name="StxValidationError"}}});function Fx(e){let{type:t,message:r,code:n,filePath:i,line:s,column:a,template:o,offset:l,snippet:c,suggestion:u,format:d="text"}=e,h=s,p=a;if(!h&&o&&l!==void 0){let v=Vx(o,l);h=v.line,p=v.column}let f=i?If(i):void 0,m=n?Bx(n):void 0,y={type:t,code:n,codeName:m,message:r,filePath:f,line:h,column:p,snippet:c,suggestion:u,timestamp:new Date().toISOString()},g;switch(d){case"html":g=Wx(y);break;case"json":g=JSON.stringify(y,null,2);break;case"console":g=Hx(y,o,l);break;case"text":default:g=qx(y,o,l);break}return{formatted:g,data:y}}function qx(e,t,r){let n=[],i=e.code?` [${e.codeName||e.code}]`:"";if(n.push(`[${e.type} Error${i}]`),e.filePath){let s=e.filePath;if(e.line){if(s+=`:${e.line}`,e.column)s+=`:${e.column}`}n.push(`at ${s}`)}if(n.push(`
11301
+ ${e.message}`),t&&e.line){let s=Ux(t,e.line,2);if(s)n.push(`
11302
11302
  ${s}`)}if(e.snippet)n.push(`
11303
11303
  Snippet: ${e.snippet}`);if(e.suggestion)n.push(`
11304
- Suggestion: ${e.suggestion}`);return n.join(" ")}function qb(e){let t=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",n=`<!-- [${e.type} Error${t}]${r}: ${Wl(e.message)}`;if(e.suggestion)n+=` | Suggestion: ${Wl(e.suggestion)}`;return n+=" -->",n}function Wb(e,t,r){let n=[],i=e.code?` [${e.codeName||e.code}]`:"";if(n.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${i} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let s=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(s+=`\x1B[90m:${e.line}\x1B[0m`,e.column)s+=`\x1B[90m:${e.column}\x1B[0m`}n.push(`
11304
+ Suggestion: ${e.suggestion}`);return n.join(" ")}function Wx(e){let t=e.code?` [${e.code}]`:"",r=e.filePath?` in ${e.filePath}${e.line?`:${e.line}`:""}`:"",n=`<!-- [${e.type} Error${t}]${r}: ${Hl(e.message)}`;if(e.suggestion)n+=` | Suggestion: ${Hl(e.suggestion)}`;return n+=" -->",n}function Hx(e,t,r){let n=[],i=e.code?` [${e.codeName||e.code}]`:"";if(n.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${e.type} Error${i} \u2501\u2501\u2501${"\x1B[0m"}`),e.filePath){let s=`\x1B[36m${e.filePath}\x1B[0m`;if(e.line){if(s+=`\x1B[90m:${e.line}\x1B[0m`,e.column)s+=`\x1B[90m:${e.column}\x1B[0m`}n.push(`
11305
11305
  \x1B[90mat\x1B[0m ${s}`)}if(n.push(`
11306
11306
 
11307
- ${e.message}`),t&&e.line){let s=Ub(t,e.line,2);if(s)n.push(`
11307
+ ${e.message}`),t&&e.line){let s=Gx(t,e.line,2);if(s)n.push(`
11308
11308
 
11309
11309
  \x1B[90mContext:\x1B[0m
11310
11310
  ${s}`)}if(e.suggestion)n.push(`
11311
11311
 
11312
11312
  \x1B[33mSuggestion:\x1B[0m ${e.suggestion}`);return n.push(`
11313
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),n.join("")}function Hb(e,t,r){let n=e.split(`
11313
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),n.join("")}function Ux(e,t,r){let n=e.split(`
11314
11314
  `),i=Math.max(0,t-r-1),s=Math.min(n.length-1,t+r-1),a=[];for(let o=i;o<=s;o++){let l=(o+1).toString().padStart(4),c=o===t-1?">":" ";a.push(`${c}${l} | ${n[o]}`)}return a.join(`
11315
- `)}function Ub(e,t,r){let n=e.split(`
11315
+ `)}function Gx(e,t,r){let n=e.split(`
11316
11316
  `),i=Math.max(0,t-r-1),s=Math.min(n.length-1,t+r-1),a="\x1B[90m",o="\x1B[31m",l="\x1B[0m",c=[];for(let u=i;u<=s;u++){let d=(u+1).toString().padStart(4),h=u===t-1,p=h?"\x1B[31m>\x1B[0m":" ",f=h?`\x1B[31m${n[u]}\x1B[0m`:`\x1B[90m${n[u]}\x1B[0m`;c.push(`${p}\x1B[90m${d}\x1B[0m | ${f}`)}return c.join(`
11317
- `)}function Wl(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Gb(e,t){let r=e.substring(0,t).split(`
11318
- `);return{line:r.length,column:r[r.length-1].length}}function oe(e,t,r){return zb({type:e,message:t,code:r,format:"html"}).formatted}async function Bn(e,t,r){try{return await e()}catch(n){if(r&&n instanceof Error)r(n);return t}}var Vb=R(()=>{Oo(),Do()});class Of{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,t,r="error"){let n={timestamp:new Date,error:e,context:t,level:r};if(this.errors.push(n),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(n)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let t=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)t.push(` Stack: ${e.error.stack.split(`
11317
+ `)}function Hl(e){return e.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Vx(e,t){let r=e.substring(0,t).split(`
11318
+ `);return{line:r.length,column:r[r.length-1].length}}function le(e,t,r){return Fx({type:e,message:t,code:r,format:"html"}).formatted}async function zn(e,t,r){try{return await e()}catch(n){if(r&&n instanceof Error)r(n);return t}}var Jx=R(()=>{jo(),$o()});class jf{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(e={}){this.maxErrors=e.maxErrors??1000,this.enableFileLogging=e.enableFileLogging??!1,this.logFilePath=e.logFilePath??".stx/errors.log",this.logFormat=e.logFormat??"json",this.maxFileSize=e.maxFileSize??10485760,this.maxLogFiles=e.maxLogFiles??5,this.minLevel=e.minLevel??"all"}configure(e){if(e.maxErrors!==void 0)this.maxErrors=e.maxErrors;if(e.enableFileLogging!==void 0)this.enableFileLogging=e.enableFileLogging;if(e.logFilePath!==void 0)this.logFilePath=e.logFilePath;if(e.logFormat!==void 0)this.logFormat=e.logFormat;if(e.maxFileSize!==void 0)this.maxFileSize=e.maxFileSize;if(e.maxLogFiles!==void 0)this.maxLogFiles=e.maxLogFiles;if(e.minLevel!==void 0)this.minLevel=e.minLevel}log(e,t,r="error"){let n={timestamp:new Date,error:e,context:t,level:r};if(this.errors.push(n),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(r))this.writeToFile(n)}shouldLog(e){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return e==="error"||e==="warning";if(this.minLevel==="error")return e==="error";return!0}formatEntry(e){if(this.logFormat==="json")return JSON.stringify({timestamp:e.timestamp.toISOString(),level:e.level||"error",type:e.error.constructor.name,message:e.error.message,stack:e.error.stack,context:e.context});let t=[`[${e.timestamp.toISOString()}] [${(e.level||"error").toUpperCase()}] ${e.error.constructor.name}: ${e.error.message}`];if(e.error.stack)t.push(` Stack: ${e.error.stack.split(`
11319
11319
  `).slice(1).join(`
11320
11320
  `)}`);if(e.context)t.push(` Context: ${JSON.stringify(e.context)}`);return t.join(`
11321
11321
  `)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let t=await import("fs"),r=(await import("path")).dirname(this.logFilePath);if(!t.existsSync(r))t.mkdirSync(r,{recursive:!0});await this.rotateIfNeeded(t);let n=`${this.formatEntry(e)}
11322
11322
  `;t.appendFileSync(this.logFilePath,n,"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 t=this.maxLogFiles-1;t>=1;t--){let r=`${this.logFilePath}.${t}`,n=`${this.logFilePath}.${t+1}`;if(e.existsSync(r))if(t>=this.maxLogFiles-1)e.unlinkSync(r);else e.renameSync(r,n)}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 n=r.error.constructor.name;e[n]=(e[n]||0)+1;let i=r.level||"error";t[i]=(t[i]||0)+1}return{total:this.errors.length,byType:e,byLevel:t}}async exportToFile(e,t="json"){let r=await import("fs"),n=(await import("path")).dirname(e);if(!r.existsSync(n))r.mkdirSync(n,{recursive:!0});if(t==="json"){let i=this.errors.map((s)=>({timestamp:s.timestamp.toISOString(),level:s.level||"error",type:s.error.constructor.name,message:s.error.message,stack:s.error.stack,context:s.context}));r.writeFileSync(e,JSON.stringify(i,null,2),"utf-8")}else{let i=this.errors.map((s)=>this.formatEntry(s));r.writeFileSync(e,i.join(`
11323
11323
 
11324
- `),"utf-8")}}async flush(){await this.writeQueue}}var jf,ot,Df,Jb=R(()=>{Do(),jf={isEnabled(){return Fl().enableAutoRecovery},fixCommonSyntaxErrors(e){let t=Fl();if(!t.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,n=[],i=(r.match(/\{\{/g)||[]).length,s=(r.match(/\}\}/g)||[]).length;if(i>s){let o=i-s;r+="}}".repeat(o),n.push(`Added ${o} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let o of a){let l=(r.match(new RegExp(`@${o}\\b`,"g"))||[]).length,c=(r.match(new RegExp(`@end${o}\\b`,"g"))||[]).length;if(l>c){let u=l-c;for(let d=0;d<u;d++)r+=`
11325
- @end${o}`;n.push(`Added ${u} missing @end${o}`)}}if(n.length>0&&t.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),n.forEach((o)=>console.warn(` - ${o}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:n}},createFallbackContent(e,t){if(Us())return`<!-- ${e} failed: ${t.message} -->`;return"<!-- stx rendering error -->"}},ot=new Of,Df={isDevelopment(){return Us()},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(`
11326
- `)}}}),Yb=()=>{},Kb=R(()=>{Oo(),Vb(),Jb(),Yb(),Do()}),kt=R(()=>{Kb()});function Zb(e,t,r,n){let i=e;i=i.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(o,l,c)=>{if(!c&&l.includes(":")){let u=l.split(":"),d=l,h=u.length>1?u[1]:"";if(h&&t[h])c=t[h];else if(d.startsWith("og:")&&t.openGraph&&t.openGraph[u[1]])c=t.openGraph[u[1]];else c="";return c?`<meta property="${U(d)}" content="${U(c)}">`:""}return c?`<meta name="${U(l)}" content="${U(c)}">`:""});let s=/@metaTag\s*\(/g,a;while((a=s.exec(i))!==null){let o=a.index,l=o+a[0].length-1,c=1,u=l+1;while(u<i.length&&c>0){if(i[u]==="(")c++;else if(i[u]===")"){if(c--,c===0)break}u++}if(c!==0)break;let d=i.substring(l+1,u).trim(),h=u+1,p=(()=>{try{let f=Ye(d,t);if(!f)return"";let m="<meta";if(f.name)m+=` name="${U(String(f.name))}"`;if(f.property)m+=` property="${U(String(f.property))}"`;if(f.httpEquiv)m+=` http-equiv="${U(String(f.httpEquiv))}"`;if(f.content)m+=` content="${U(String(f.content))}"`;return m+=">",m}catch(f){let m=f instanceof Error?f.message:String(f);return oe("MetaTag",m,re.EVALUATION_ERROR)}})();i=i.substring(0,o)+p+i.substring(h),s.lastIndex=0}return i}function Qb(e,t,r){let n=e,i=/@structuredData\s*\(/g,s;while((s=i.exec(n))!==null){let a=s.index,o=a+s[0].length-1,l=1,c=o+1;while(c<n.length&&l>0){if(n[c]==="(")l++;else if(n[c]===")"){if(l--,l===0)break}c++}if(l!==0)break;let u=n.substring(o+1,c).trim(),d=c+1,h=(()=>{try{let p=Ye(u,t);if(!p)return"";if(!p["@context"])p["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(p).replace(/<\//g,"<\\/")}</script>`}catch(p){let f=p instanceof Error?p.message:String(p);return oe("StructuredData",f,re.EVALUATION_ERROR)}})();n=n.substring(0,a)+h+n.substring(d),i.lastIndex=0}return n}function Xb(e,t,r,n){let i=e,s=/@seo\s*\(\s*\{/g,a;while((a=s.exec(i))!==null){let o=i.indexOf("{",a.index+4),l=1,c=o+1,u=null,d=!1;while(c<i.length&&l>0){let g=i[c];if(d){d=!1,c++;continue}if(g==="\\"&&u){d=!0,c++;continue}if(u){if(g===u)u=null;c++;continue}if(g==='"'||g==="'"||g==="`"){u=g,c++;continue}if(g==="{")l++;else if(g==="}")l--;c++}if(l!==0)break;let h=i.substring(c).match(/^\s*\)/);if(!h)break;let p=c+h[0].length,f=i.substring(o,c),m=i.substring(a.index,p),y=((g)=>{try{let v=Ye(g,t);if(!v)return"";let w="";if(v.title)w+=`<title>${U(v.title)}</title>
11327
- `,w+=`<meta name="title" content="${U(v.title)}">
11328
- `;if(v.description)w+=`<meta name="description" content="${U(v.description)}">
11329
- `;if(v.keywords){let b=Array.isArray(v.keywords)?v.keywords.join(", "):v.keywords;w+=`<meta name="keywords" content="${U(b)}">
11330
- `}if(v.robots)w+=`<meta name="robots" content="${U(v.robots)}">
11331
- `;if(v.canonical)w+=`<link rel="canonical" href="${U(v.canonical)}">
11332
- `;if(v.openGraph){let b=v.openGraph;if(w+=`<meta property="og:type" content="${U(b.type||"website")}">
11333
- `,b.title||v.title){let S=b.title||v.title||"";w+=`<meta property="og:title" content="${U(S)}">
11334
- `}if(b.description||v.description){let S=b.description||v.description||"";w+=`<meta property="og:description" content="${U(S)}">
11335
- `}if(b.url||v.canonical){let S=b.url||v.canonical||"";w+=`<meta property="og:url" content="${U(S)}">
11336
- `}if(b.image){if(w+=`<meta property="og:image" content="${U(b.image)}">
11337
- `,b.imageAlt)w+=`<meta property="og:image:alt" content="${U(b.imageAlt)}">
11338
- `;if(b.imageWidth)w+=`<meta property="og:image:width" content="${U(String(b.imageWidth))}">
11339
- `;if(b.imageHeight)w+=`<meta property="og:image:height" content="${U(String(b.imageHeight))}">
11340
- `}if(b.siteName)w+=`<meta property="og:site_name" content="${U(b.siteName)}">
11341
- `}if(v.twitter){let b=v.twitter;if(w+=`<meta name="twitter:card" content="${U(b.card||"summary_large_image")}">
11342
- `,b.title||v.title){let S=b.title||v.title||"";w+=`<meta name="twitter:title" content="${U(S)}">
11343
- `}if(b.description||v.description){let S=b.description||v.description||"";w+=`<meta name="twitter:description" content="${U(S)}">
11344
- `}if(b.image||v.openGraph&&v.openGraph.image){let S=b.image||(v.openGraph?v.openGraph.image:"")||"";w+=`<meta name="twitter:image" content="${U(S)}">
11345
- `}if(b.site)w+=`<meta name="twitter:site" content="${U(b.site)}">
11346
- `;if(b.creator)w+=`<meta name="twitter:creator" content="${U(b.creator)}">
11324
+ `),"utf-8")}}async flush(){await this.writeQueue}}var Df,lt,$f,Yx=R(()=>{$o(),Df={isEnabled(){return ql().enableAutoRecovery},fixCommonSyntaxErrors(e){let t=ql();if(!t.enableAutoRecovery)return{fixed:e,fixes:[]};let r=e,n=[],i=(r.match(/\{\{/g)||[]).length,s=(r.match(/\}\}/g)||[]).length;if(i>s){let o=i-s;r+="}}".repeat(o),n.push(`Added ${o} missing closing braces '}}'`)}let a=["if","foreach","for","switch","section"];for(let o of a){let l=(r.match(new RegExp(`@${o}\\b`,"g"))||[]).length,c=(r.match(new RegExp(`@end${o}\\b`,"g"))||[]).length;if(l>c){let u=l-c;for(let d=0;d<u;d++)r+=`
11325
+ @end${o}`;n.push(`Added ${u} missing @end${o}`)}}if(n.length>0&&t.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),n.forEach((o)=>console.warn(` - ${o}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:r,fixes:n}},createFallbackContent(e,t){if(Gs())return`<!-- ${e} failed: ${t.message} -->`;return"<!-- stx rendering error -->"}},lt=new jf,$f={isDevelopment(){return Gs()},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(`
11326
+ `)}}}),Kx=()=>{},Zx=R(()=>{jo(),Jx(),Yx(),Kx(),$o()}),Et=R(()=>{Zx()});function Qx(e,t,r,n){let i=e;i=i.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(o,l,c)=>{if(!c&&l.includes(":")){let u=l.split(":"),d=l,h=u.length>1?u[1]:"";if(h&&t[h])c=t[h];else if(d.startsWith("og:")&&t.openGraph&&t.openGraph[u[1]])c=t.openGraph[u[1]];else c="";return c?`<meta property="${G(d)}" content="${G(c)}">`:""}return c?`<meta name="${G(l)}" content="${G(c)}">`:""});let s=/@metaTag\s*\(/g,a;while((a=s.exec(i))!==null){let o=a.index,l=o+a[0].length-1,c=1,u=l+1;while(u<i.length&&c>0){if(i[u]==="(")c++;else if(i[u]===")"){if(c--,c===0)break}u++}if(c!==0)break;let d=i.substring(l+1,u).trim(),h=u+1,p=(()=>{try{let f=Ke(d,t);if(!f)return"";let m="<meta";if(f.name)m+=` name="${G(String(f.name))}"`;if(f.property)m+=` property="${G(String(f.property))}"`;if(f.httpEquiv)m+=` http-equiv="${G(String(f.httpEquiv))}"`;if(f.content)m+=` content="${G(String(f.content))}"`;return m+=">",m}catch(f){let m=f instanceof Error?f.message:String(f);return le("MetaTag",m,ne.EVALUATION_ERROR)}})();i=i.substring(0,o)+p+i.substring(h),s.lastIndex=0}return i}function Xx(e,t,r){let n=e,i=/@structuredData\s*\(/g,s;while((s=i.exec(n))!==null){let a=s.index,o=a+s[0].length-1,l=1,c=o+1;while(c<n.length&&l>0){if(n[c]==="(")l++;else if(n[c]===")"){if(l--,l===0)break}c++}if(l!==0)break;let u=n.substring(o+1,c).trim(),d=c+1,h=(()=>{try{let p=Ke(u,t);if(!p)return"";if(!p["@context"])p["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(p).replace(/<\//g,"<\\/")}</script>`}catch(p){let f=p instanceof Error?p.message:String(p);return le("StructuredData",f,ne.EVALUATION_ERROR)}})();n=n.substring(0,a)+h+n.substring(d),i.lastIndex=0}return n}function e0(e,t,r,n){let i=e,s=/@seo\s*\(\s*\{/g,a;while((a=s.exec(i))!==null){let o=i.indexOf("{",a.index+4),l=1,c=o+1,u=null,d=!1;while(c<i.length&&l>0){let g=i[c];if(d){d=!1,c++;continue}if(g==="\\"&&u){d=!0,c++;continue}if(u){if(g===u)u=null;c++;continue}if(g==='"'||g==="'"||g==="`"){u=g,c++;continue}if(g==="{")l++;else if(g==="}")l--;c++}if(l!==0)break;let h=i.substring(c).match(/^\s*\)/);if(!h)break;let p=c+h[0].length,f=i.substring(o,c),m=i.substring(a.index,p),y=((g)=>{try{let v=Ke(g,t);if(!v)return"";let w="";if(v.title)w+=`<title>${G(v.title)}</title>
11327
+ `,w+=`<meta name="title" content="${G(v.title)}">
11328
+ `;if(v.description)w+=`<meta name="description" content="${G(v.description)}">
11329
+ `;if(v.keywords){let b=Array.isArray(v.keywords)?v.keywords.join(", "):v.keywords;w+=`<meta name="keywords" content="${G(b)}">
11330
+ `}if(v.robots)w+=`<meta name="robots" content="${G(v.robots)}">
11331
+ `;if(v.canonical)w+=`<link rel="canonical" href="${G(v.canonical)}">
11332
+ `;if(v.openGraph){let b=v.openGraph;if(w+=`<meta property="og:type" content="${G(b.type||"website")}">
11333
+ `,b.title||v.title){let S=b.title||v.title||"";w+=`<meta property="og:title" content="${G(S)}">
11334
+ `}if(b.description||v.description){let S=b.description||v.description||"";w+=`<meta property="og:description" content="${G(S)}">
11335
+ `}if(b.url||v.canonical){let S=b.url||v.canonical||"";w+=`<meta property="og:url" content="${G(S)}">
11336
+ `}if(b.image){if(w+=`<meta property="og:image" content="${G(b.image)}">
11337
+ `,b.imageAlt)w+=`<meta property="og:image:alt" content="${G(b.imageAlt)}">
11338
+ `;if(b.imageWidth)w+=`<meta property="og:image:width" content="${G(String(b.imageWidth))}">
11339
+ `;if(b.imageHeight)w+=`<meta property="og:image:height" content="${G(String(b.imageHeight))}">
11340
+ `}if(b.siteName)w+=`<meta property="og:site_name" content="${G(b.siteName)}">
11341
+ `}if(v.twitter){let b=v.twitter;if(w+=`<meta name="twitter:card" content="${G(b.card||"summary_large_image")}">
11342
+ `,b.title||v.title){let S=b.title||v.title||"";w+=`<meta name="twitter:title" content="${G(S)}">
11343
+ `}if(b.description||v.description){let S=b.description||v.description||"";w+=`<meta name="twitter:description" content="${G(S)}">
11344
+ `}if(b.image||v.openGraph&&v.openGraph.image){let S=b.image||(v.openGraph?v.openGraph.image:"")||"";w+=`<meta name="twitter:image" content="${G(S)}">
11345
+ `}if(b.site)w+=`<meta name="twitter:site" content="${G(b.site)}">
11346
+ `;if(b.creator)w+=`<meta name="twitter:creator" content="${G(b.creator)}">
11347
11347
  `}if(v.structuredData){let b=JSON.stringify(v.structuredData).replace(/<\//g,"<\\/");w+=`<script type="application/ld+json">${b}</script>
11348
- `}return w.trim()}catch(v){let w=v instanceof Error?v.message:String(v);return oe("SEO",`Error processing @seo directive: ${w}`,re.EVALUATION_ERROR)}})(f);i=i.substring(0,a.index)+y+i.substring(p),s.lastIndex=a.index+y.length}return i}function ex(e,t,r){if(r.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.skipDefaultSeoTags===!0)return e;let n=t.__stx_runtime_head;if(n?.title||n?.meta?.some((u)=>u.property==="og:title"||u.name==="og:title"||u.name==="twitter:title"||u.name==="description"))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let i=e.includes("<title>")||e.includes("</title>"),s="";if(t.title)s=t.title;else if(t.meta&&t.meta.title)s=t.meta.title;else if(r.seo?.defaultConfig?.title)s=r.seo.defaultConfig.title;else s=r.defaultTitle||"stx Project";let a="";if(t.description)a=t.description;else if(t.meta&&t.meta.description)a=t.meta.description;else if(r.seo?.defaultConfig?.description)a=r.seo.defaultConfig.description;else a=r.defaultDescription||"A website built with stx templating engine";let o="";if(t.image)o=t.image;else if(t.meta&&t.meta.image)o=t.meta.image;else if(t.openGraph&&t.openGraph.image)o=t.openGraph.image;else if(r.seo?.defaultImage)o=r.seo.defaultImage;else if(r.defaultImage)o=r.defaultImage;let l=`
11348
+ `}return w.trim()}catch(v){let w=v instanceof Error?v.message:String(v);return le("SEO",`Error processing @seo directive: ${w}`,ne.EVALUATION_ERROR)}})(f);i=i.substring(0,a.index)+y+i.substring(p),s.lastIndex=a.index+y.length}return i}function t0(e,t,r){if(r.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.skipDefaultSeoTags===!0)return e;let n=t.__stx_runtime_head;if(n?.title||n?.meta?.some((u)=>u.property==="og:title"||u.name==="og:title"||u.name==="twitter:title"||u.name==="description"))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let i=e.includes("<title>")||e.includes("</title>"),s="";if(t.title)s=t.title;else if(t.meta&&t.meta.title)s=t.meta.title;else if(r.seo?.defaultConfig?.title)s=r.seo.defaultConfig.title;else s=r.defaultTitle||"stx Project";let a="";if(t.description)a=t.description;else if(t.meta&&t.meta.description)a=t.meta.description;else if(r.seo?.defaultConfig?.description)a=r.seo.defaultConfig.description;else a=r.defaultDescription||"A website built with stx templating engine";let o="";if(t.image)o=t.image;else if(t.meta&&t.meta.image)o=t.meta.image;else if(t.openGraph&&t.openGraph.image)o=t.openGraph.image;else if(r.seo?.defaultImage)o=r.seo.defaultImage;else if(r.defaultImage)o=r.defaultImage;let l=`
11349
11349
  <!-- stx SEO Tags -->
11350
- <meta name="title" content="${U(s)}">
11351
- <meta name="description" content="${U(a)}">
11352
- <meta property="og:title" content="${U(s)}">
11353
- <meta property="og:description" content="${U(a)}">
11350
+ <meta name="title" content="${G(s)}">
11351
+ <meta name="description" content="${G(a)}">
11352
+ <meta property="og:title" content="${G(s)}">
11353
+ <meta property="og:description" content="${G(a)}">
11354
11354
  <meta property="og:type" content="website">
11355
11355
  <meta name="twitter:card" content="summary_large_image">
11356
- <meta name="twitter:title" content="${U(s)}">
11357
- <meta name="twitter:description" content="${U(a)}">
11356
+ <meta name="twitter:title" content="${G(s)}">
11357
+ <meta name="twitter:description" content="${G(a)}">
11358
11358
  `;if(o)l+=`
11359
- <meta property="og:image" content="${U(o)}">
11360
- <meta name="twitter:image" content="${U(o)}">
11359
+ <meta property="og:image" content="${G(o)}">
11360
+ <meta name="twitter:image" content="${G(o)}">
11361
11361
  `;let c=e;if(!i)c=c.replace(/<head[^>]*>/,`$&
11362
- <title>${U(s)}</title>`);return c.replace(/<head[^>]*>/,`$&
11362
+ <title>${G(s)}</title>`);return c.replace(/<head[^>]*>/,`$&
11363
11363
  ${l}
11364
- `)}function U(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function tx(e){let t=[];for(let r of e.rules){if(t.push(`User-agent: ${r.userAgent}`),r.allow)for(let n of r.allow)t.push(`Allow: ${n}`);if(r.disallow)for(let n of r.disallow)t.push(`Disallow: ${n}`);if(r.crawlDelay!==void 0)t.push(`Crawl-delay: ${r.crawlDelay}`);t.push("")}if(e.sitemap){let r=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let n of r)t.push(`Sitemap: ${n}`)}if(e.host)t.push(`Host: ${e.host}`);return t.join(`
11365
- `).trim()}var $f,Lf,$o=R(()=>{kt(),Se(),$f={name:"meta",handler:(e,t,r,n)=>{if(t.length<1)return oe("Meta","meta directive requires at least the meta name",re.INVALID_DIRECTIVE_SYNTAX);let i=t[0].replace(/['"]/g,""),s=t.length>1?t[1].replace(/['"]/g,""):"";return`<meta name="${U(i)}" content="${U(s)}">`},hasEndTag:!1},Lf={name:"structuredData",handler:(e,t,r,n)=>{if(e.trim()==="")return oe("StructuredData","structuredData directive requires JSON-LD content",re.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return oe("StructuredData","structuredData requires @type property",re.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(i)}</script>`}catch(i){let s=i instanceof Error?i.message:String(i);return oe("StructuredData",s,re.EVALUATION_ERROR)}},hasEndTag:!0}});function rx(e,t){let r=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=r?r[1].trim():"",i=t,s=[],a=!0;if(n){let d=n.match(/export\s+default\s+({[\s\S]*})/);if(d)try{let h=d[1],p=h.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(p)i=p[1];let f=h.match(/props\s*:\s*\[([\s\S]*?)\]/);if(f)s=f[1].split(",").map((y)=>y.trim().replace(/['"`]/g,"")).filter((y)=>y.length>0);let m=h.match(/shadowDOM\s*:\s*(true|false)/);if(m)a=m[1]==="true"}catch{}}let o=e.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),l=o?o[1].trim():"",c=e.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),u=c?c[1].trim():"";return{tag:i,props:s,template:l,styles:u,script:n,shadowDOM:a}}function nx(e){let{tag:t,props:r,template:n,styles:i,shadowDOM:s}=e,a=t.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),o=n.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l=i.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),c=r.map((d)=>`'${d}'`).join(", "),u=r.map((d)=>`
11364
+ `)}function G(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r0(e){let t=[];for(let r of e.rules){if(t.push(`User-agent: ${r.userAgent}`),r.allow)for(let n of r.allow)t.push(`Allow: ${n}`);if(r.disallow)for(let n of r.disallow)t.push(`Disallow: ${n}`);if(r.crawlDelay!==void 0)t.push(`Crawl-delay: ${r.crawlDelay}`);t.push("")}if(e.sitemap){let r=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let n of r)t.push(`Sitemap: ${n}`)}if(e.host)t.push(`Host: ${e.host}`);return t.join(`
11365
+ `).trim()}var Lf,Nf,Lo=R(()=>{Et(),_e(),Lf={name:"meta",handler:(e,t,r,n)=>{if(t.length<1)return le("Meta","meta directive requires at least the meta name",ne.INVALID_DIRECTIVE_SYNTAX);let i=t[0].replace(/['"]/g,""),s=t.length>1?t[1].replace(/['"]/g,""):"";return`<meta name="${G(i)}" content="${G(s)}">`},hasEndTag:!1},Nf={name:"structuredData",handler:(e,t,r,n)=>{if(e.trim()==="")return le("StructuredData","structuredData directive requires JSON-LD content",ne.INVALID_DIRECTIVE_SYNTAX);try{let i=JSON.parse(e);if(!i["@context"])i["@context"]="https://schema.org";if(!i["@type"])return le("StructuredData","structuredData requires @type property",ne.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(i)}</script>`}catch(i){let s=i instanceof Error?i.message:String(i);return le("StructuredData",s,ne.EVALUATION_ERROR)}},hasEndTag:!0}});function n0(e,t){let r=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),n=r?r[1].trim():"",i=t,s=[],a=!0;if(n){let d=n.match(/export\s+default\s+({[\s\S]*})/);if(d)try{let h=d[1],p=h.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(p)i=p[1];let f=h.match(/props\s*:\s*\[([\s\S]*?)\]/);if(f)s=f[1].split(",").map((y)=>y.trim().replace(/['"`]/g,"")).filter((y)=>y.length>0);let m=h.match(/shadowDOM\s*:\s*(true|false)/);if(m)a=m[1]==="true"}catch{}}let o=e.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),l=o?o[1].trim():"",c=e.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),u=c?c[1].trim():"";return{tag:i,props:s,template:l,styles:u,script:n,shadowDOM:a}}function i0(e){let{tag:t,props:r,template:n,styles:i,shadowDOM:s}=e,a=t.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),o=n.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l=i.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),c=r.map((d)=>`'${d}'`).join(", "),u=r.map((d)=>`
11366
11366
  get ${d}() {
11367
11367
  return this.getAttribute('${d}') || '';
11368
11368
  }
@@ -11413,16 +11413,16 @@ ${u}
11413
11413
  }
11414
11414
 
11415
11415
  customElements.define('${t}', ${a});
11416
- `}async function ix(e,t,r,n){if(t.length<1)return oe("WebComponent","@webcomponent directive requires at least the tag name parameter",re.INVALID_DIRECTIVE_SYNTAX);let i=t[0].replace(/['"]/g,""),s=(r.__stx_options||{}).componentsDir||"components",a=[Mr.join(Mr.dirname(n),s,`${i}.stx`),Mr.join(process.cwd(),s,`${i}.stx`),Mr.join(Mr.dirname(n),`${i}.stx`)],o=null;for(let c of a)if(await Q(c)){o=await Bun.file(c).text();break}if(!o)return oe("WebComponent",`Component file not found: ${i}.stx`,re.FILE_NOT_FOUND);let l=rx(o,i);return`<script type="module">
11417
- ${nx(l)}
11418
- </script>`}var sx=R(()=>{kt(),Ce()}),Nf={};Y(Nf,{timingPlugin:()=>Bf,pluginManager:()=>Pf,definePlugin:()=>fi,debugPlugin:()=>Mf,createVariablesPlugin:()=>lx,createFilterPlugin:()=>ox,createDirectivePlugin:()=>ax,PluginManager:()=>Lo});function fi(e){return e}class Lo{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,n]of this.plugins)if(n.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let n of this.sortedPlugins){let i=n[e];if(i)try{let s=await i(r);if(s){if(s.template!==void 0)r.template=s.template;if(s.context)r.context={...r.context,...s.context};if(s.metadata)r.metadata={...r.metadata,...s.metadata};if(s.skip)break}}catch(s){console.error(`Error in plugin "${n.name}" ${e} hook:`,s)}}return r}async runDirectiveHooks(e,t,r){let n={...r};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let a=await s(t,n);if(a){if(a.template!==void 0)n.template=a.template;if(a.context)n.context={...n.context,...a.context};if(a.metadata)n.metadata={...n.metadata,...a.metadata};if(a.skip)break}}catch(a){console.error(`Error in plugin "${i.name}" ${e} hook:`,a)}}return n}}function ax(e,t,r={}){return{name:e,...r,registerDirectives:()=>t}}function ox(e,t,r={}){return{name:e,...r,registerFilters:()=>t}}function lx(e){return fi({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(t){return{context:{...t.context,...e}}}})}var Pf,Mf,Bf,cx=R(()=>{Pf=new Lo,Mf=fi({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),Bf=fi({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}})}),zf={};Y(zf,{validateConfig:()=>mx,resolveStxDirectories:()=>Ff,loadStxConfig:()=>Xt,defineStxConfig:()=>hx,defaultConfig:()=>Vt,config:()=>Wi});function ux(e,t,r){let n=t||"pages";if(e)return{root:e,pagesDir:n};let i=r||process.cwd(),s=$e.join(i,"resources","views"),a=$e.join(i,"resources","layouts");if(zn.existsSync(s)&&zn.existsSync(a))return{root:"resources",pagesDir:"views"};let o=$e.join(i,"resources","views","pages");if(zn.existsSync(o))return{root:"resources/views",pagesDir:n};return{root:".",pagesDir:n}}function dx(e,t){let r=t.replace(/[\\/]+$/,"");if(!r||r===".")return!0;let n=e.replace(/\\/g,"/"),i=r.replace(/\\/g,"/");return n===i||n.startsWith(`${i}/`)}function Ff(e,t){let r=!e.root,n=ux(e.root,e.pagesDir,t);if(e.root=n.root,e.pagesDir=n.pagesDir,r&&n.root!=="."){let i=`${t}::${n.root}`;if(!Gs.has(i))Gs.add(i),console.warn(`[stx] No "root" in config \u2014 inferred "${n.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(e.root&&e.root!=="."){let i=e.root;for(let s of["partialsDir","componentsDir","layoutsDir"]){let a=e[s];if(typeof a!=="string"||!a)continue;if($e.isAbsolute(a)||dx(a,i))continue;e[s]=$e.join(i,a)}}return e}function px(e,t){let r=["componentsDir","layoutsDir","partialsDir"];for(let n of r){let i=e[n];if(typeof i!=="string"||!i)continue;let s=$e.isAbsolute(i)?i:$e.join(t,i);if(zn.existsSync(s))continue;let a=e.root,o=!!a&&a!==".";console.warn(`[stx] ${String(n)} resolves to "${s}", which does not exist. Configured as "${i}"`+(o?`, resolved under root "${a}".`:"."))}}function fx(e){if(ey(e.stateDir),e.stateDir=ei(),e.cachePath=bn(e.cachePath),e.build)e.build.cacheDir=bn(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=bn(e.media.cache.directory);if(e.story)e.story.outDir=bn(e.story.outDir)}async function Xt(e){if(!e){if(br)return br;if(Fn)return Fn}let t=e?$e.resolve(e):process.cwd(),r=Vs.get(t);if(r)return r;let n=(async()=>{let i=(await Mc({name:"stx",alias:"ui",cwd:t,defaultConfig:Vt,verbose:!1})).config;if(fx(i),Ff(i,t),px(i,t),i.plugins&&i.plugins.length>0){let{pluginManager:s}=await Promise.resolve().then(()=>(cx(),Nf)),a=[],o=[];for(let l of i.plugins){let c=typeof l==="string"?l:l[0],u=typeof l==="string"?{}:l[1]||{};try{let d,h;try{d=await import(c),h=$e.dirname(Zn.resolve(c))}catch{let f=$e.resolve(process.cwd(),c);d=await import(f),h=$e.dirname(f)}let p=d.default||d;if(s.register(p,i),p.components){let f=Array.isArray(p.components)?p.components:[p.components];for(let m of f)a.push($e.resolve(h,m))}if(p.pages){let f=$e.resolve(h,p.pages),m=u.path||"/";o.push({dir:f,prefix:m})}if(p.setup){let f={addDirective:(m)=>{i.customDirectives=i.customDirectives||[],i.customDirectives.push(m)},addRoute:(m,y)=>{i.apiRoutes=i.apiRoutes||{},i.apiRoutes[m]=y},addMiddleware:(m)=>{i.middleware=i.middleware||[],i.middleware.push(m)},pluginDir:h,config:i};await p.setup(u,f)}console.log(`[stx] Plugin loaded: ${p.name||c}`)}catch(d){console.warn(`[stx] Failed to load plugin ${c}:`,d.message)}}i._pluginComponentDirs=a,i._pluginPageDirs=o}return i})();if(Vs.set(t,n),!e)Fn=n,n.then((i)=>{br=i}).catch(()=>{});return n}function hx(e){return e}function mx(e){let t=[],r=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")t.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")t.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")t.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")t.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)t.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)t.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let n=["auto","manual","sections"];if(!n.includes(e.streaming.strategy))t.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let n=["json","yaml","yml","js"];if(!n.includes(e.i18n.format))t.push({path:"i18n.format",message:`i18n.format must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)t.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)t.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let n=["AA","AAA"];if(!n.includes(e.a11y.level))t.push({path:"a11y.level",message:`a11y.level must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let n=["progressive","islands"];if(!n.includes(e.hydration.mode))t.push({path:"hydration.mode",message:`hydration.mode must be one of: ${n.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let n=["none","eager","lazy"];if(!n.includes(e.hydration.preload))t.push({path:"hydration.preload",message:`hydration.preload must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))t.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((n,i)=>{if(!n.name||typeof n.name!=="string")t.push({path:`customDirectives[${i}].name`,message:"Custom directive must have a name string",severity:"error"});if(!n.handler||typeof n.handler!=="function")t.push({path:`customDirectives[${i}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))t.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((n,i)=>{if(!n.name||typeof n.name!=="string")t.push({path:`middleware[${i}].name`,message:"Middleware must have a name string",severity:"error"});if(!n.handler||typeof n.handler!=="function")t.push({path:`middleware[${i}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!n.timing||!["before","after"].includes(n.timing))t.push({path:`middleware[${i}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)r.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)r.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)t.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let n=["fullscreen","standalone","minimal-ui","browser"];if(!n.includes(e.pwa.manifest.display))t.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${n.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let n=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!n.includes(e.pwa.manifest.orientation))t.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${n.join(", ")}`,severity:"error"})}if(e.pwa.routes){let n=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((i,s)=>{if(!i.pattern||typeof i.pattern!=="string")t.push({path:`pwa.routes[${s}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!n.includes(i.strategy))t.push({path:`pwa.routes[${s}].strategy`,message:`PWA route strategy must be one of: ${n.join(", ")}`,severity:"error"});if(i.maxAgeSeconds!==void 0&&(typeof i.maxAgeSeconds!=="number"||i.maxAgeSeconds<0))t.push({path:`pwa.routes[${s}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(i.maxEntries!==void 0&&(typeof i.maxEntries!=="number"||i.maxEntries<1))t.push({path:`pwa.routes[${s}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))t.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((n)=>typeof n!=="number"||n<16||n>1024).length>0)t.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let n=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((i)=>!n.includes(i)).length>0)t.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${n.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)r.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)r.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:t.length===0,errors:t,warnings:r}}var Vt,Gs,br=null,Vs,Fn=null,Wi,Et=R(()=>{pu(),yu(),wu(),_u(),Sp(),ob(),Af(),Pb(),$o(),Ei(),sx(),Vt={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Yr,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:f0,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:ix,hasEndTag:!1,description:"Include a web component in the template"},uu,du,$f,Lf,fu,mu,gu,hu,vu,Su,Xp,Ef,...Cf],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}},Gs=new Set,Vs=new Map,Wi=new Proxy(Vt,{get(e,t){if(br&&t in br)return br[t];if(!Fn)Xt().catch((r)=>{console.warn("[stx] Failed to load config file:",r?.message||r)});return e[t]}})}),qf={};Y(qf,{resetCssCache:()=>Sx,resetCrosswindCache:()=>_x,rebuildCrosswindCSS:()=>kx,loadCrosswindConfig:()=>Po,loadCrosswind:()=>No,injectCrosswindCSS:()=>Mo,getCrosswindServeAsset:()=>yx,getCachedCSS:()=>Ex,generateCrosswindCSS:()=>Uf,extractClassNames:()=>Hf,buildCrosswindCSS:()=>Wf});function Hi(e){return Bun.hash(e).toString(16).padStart(16,"0").slice(0,16)}function ns(e,t){if(Xe.has(e))Xe.delete(e);else if(Xe.size>=Gf)Xe.delete(Xe.keys().next().value);Xe.set(e,t)}function gx(e){let t=Hi(e);if(We.has(t))We.delete(t);else if(We.size>=Gf)We.delete(We.keys().next().value);return We.set(t,e),t}function yx(e){let t=We.get(e);if(t===void 0)return;return We.delete(e),We.set(e,t),t}async function vx(e){if(!gt)return null;try{let t=Bun.file(te.join(gt,`cw-${Hi(e)}.css`));if(!await t.exists())return null;return await t.text()}catch{return null}}async function wx(e,t){if(!gt)return;try{if(!fs.existsSync(gt))fs.mkdirSync(gt,{recursive:!0});await Bun.write(te.join(gt,`cw-${Hi(e)}.css`),t)}catch{}}async function Hl(e){try{let t=await import(e);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}function bx(){let e=[],t=process.cwd();while(t!==te.dirname(t))e.push(te.join(t,"node_modules","@cwcss","crosswind","dist","index.js")),e.push(te.join(t,"node_modules","@cwcss","crosswind","src","index.ts")),e.push(te.join(t,"pantry","@cwcss","crosswind","dist","index.js")),e.push(te.join(t,"pantry","@cwcss","crosswind","src","index.ts")),e.push(te.join(t,"node_modules","@stacksjs","crosswind","dist","index.js")),e.push(te.join(t,"pantry","@stacksjs","crosswind","dist","index.js")),t=te.dirname(t);return e}function xx(){let e=[],t=process.env.HOME||process.env.USERPROFILE||"";if(t){let r=[te.join(t,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),te.join(t,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),te.join(t,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),te.join(t,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),te.join(t,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),te.join(t,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];e.push(...r)}return e.push(te.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),e.push(te.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),e}async function No(){if(Js)return Qe;Js=!0;try{let e=async(i)=>{for(let s of i){if(!await Bun.file(s).exists())continue;let a=await Hl(s);if(a){if(!process.env.STACKS_DEV_QUIET)console.log(`${ce.green}[Crosswind]${ce.reset} CSS engine loaded from ${te.dirname(te.dirname(s))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=te.resolve(process.env.CROSSWIND_SRC),s=await e([i]);if(!s)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${i}`);return Qe=s,Qe}let t=await e(bx());if(t)return Qe=t,Qe;let r=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let i of r){let s=await Hl(i);if(s){if(Qe=s,!process.env.STACKS_DEV_QUIET)console.log(`${ce.green}[Crosswind]${ce.reset} CSS engine loaded`);return Qe}}let n=await e(xx());if(n)return Qe=n,Qe;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${ce.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${ce.reset}`),console.warn(`${ce.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${ce.reset}`),null}}function Sx(){Xe.clear(),We.clear()}function _x(){Qe=null,Js=!1,Ve=null,en="",Xe.clear(),We.clear(),qn=null}async function Po(e){try{if(!Pc({name:"crosswind",cwd:e}))return null;let{loadConfigWithResult:t}=await import("./chunk-z8szsm21.js"),r=await t({name:"crosswind",cwd:e,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let n=te.relative(e,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${ce.green}[Crosswind]${ce.reset} Loaded config from ${n||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${ce.yellow}[Crosswind]${ce.reset} Failed to load crosswind config:`,t instanceof Error?t.message:t),null}}async function Wf(e){if(nr)return en;nr=!0;try{let t=await No();if(!t||!t.build)return nr=!1,"";if(!Ve)Ve=await Po(e);if(!Ve)return nr=!1,"";let r=t.defaultConfig?.theme||{},n=Ve.theme||{},i={...t.defaultConfig,...Ve,theme:{...r,...n,extend:{...r.extend||{},...n.extend||{}}}},s=performance.now(),a=await t.build(i),o=performance.now()-s;if(en=a.css,console.log(`${ce.cyan}[Crosswind]${ce.reset} Built ${a.classes.size} classes in ${o.toFixed(1)}ms`),i.output){let l=te.isAbsolute(i.output)?i.output:te.join(e,i.output),c=te.dirname(l);if(!fs.existsSync(c))fs.mkdirSync(c,{recursive:!0});await Bun.write(l,a.css)}return nr=!1,a.css}catch(t){return console.error(`${ce.red}[Crosswind]${ce.reset} Build error:`,t),nr=!1,en}}async function kx(e){Ve=null,await Wf(e)}function Ex(){return en}function Hf(e){let t=new Set,r=/class\s*=\s*["']([^"']+)["']/gi,n=r.exec(e);while(n!==null){for(let a of n[1].split(/\s+/))if(a.trim())t.add(a.trim());n=r.exec(e)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,s=i.exec(e);while(s!==null){let a=s[1].match(/'([^']+)'/g);if(a){for(let o of a)for(let l of o.slice(1,-1).split(/\s+/))if(l.trim())t.add(l.trim())}s=i.exec(e)}return t}async function Uf(e,t){try{let r=await No();if(!r)return"";let n=typeof r.extractClasses==="function"?r.extractClasses(e):Hf(e);if(n.size===0)return"";let i=t?te.resolve(t):process.cwd();if(!gt)gt=Er(i,"cache");let s=[...n].sort().join(" "),a=`${qn||"default"}::${s}`,o=Xe.get(a);if(o!==void 0)return ns(a,o),o;let l=await vx(a);if(l!==null)return ns(a,l),l;if(!Ve){let b=null;try{let{loadStxConfig:S}=await Promise.resolve().then(()=>(Et(),zf)),x=await S(i);if(x.css)if(typeof x.css==="string"){let _=te.isAbsolute(x.css)?x.css:te.resolve(i,x.css);if(await Bun.file(_).exists()){let E=await import(_);b=E.default||E,console.log(`${ce.green}[Crosswind]${ce.reset} Loaded config from stx.config.ts \u2192 ${x.css}`)}}else{if(b={...x.css,content:x.css.content||[],preflight:x.css.preflight??!0,minify:x.css.minify??!1},x.css.config){let _=te.isAbsolute(x.css.config)?x.css.config:te.resolve(i,x.css.config);if(await Bun.file(_).exists()){let E=await import(_);b={...E.default||E,...b}}}console.log(`${ce.green}[Crosswind]${ce.reset} Using inline CSS config from stx.config.ts`)}}catch{}Ve=b||await Po(i);try{qn=Hi(JSON.stringify(Ve??{}))}catch{qn="unhashable"}}let c=r.defaultConfig||r.config,u=Ve||{},d=Xg(c,u),{safelist:h,includePreflight:p,minify:f}=d,m=d.config,y=new r.CSSGenerator(m);for(let b of h)y.generate(b);for(let b of n)y.generate(b);let g=y.toCSS(p,f),v=m.shortcuts||u.shortcuts||{};for(let[b,S]of Object.entries(v)){if(!n.has(b)&&!h.includes(b))continue;let x=S.split(/\s+/).filter(Boolean);for(let _ of x)y.generate(_)}g=y.toCSS(p,f);let w=g.split(`
11419
- `);for(let[b,S]of Object.entries(v)){if(!n.has(b)&&!h.includes(b))continue;let x=S.split(/\s+/).filter(Boolean),_=[],E=[];for(let k of x){let A=k.startsWith("dark:"),T=`.${(A?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let C=0;C<w.length;C++){let D=w[C].trim();if(D===`${T} {`||D.startsWith(`${T} {`)){let I=C,O="";while(I<w.length){if(O+=w[I],w[I].includes("}"))break;I++}let L=O.match(/\{([^}]+)\}/);if(L)if(A)E.push(L[1].trim());else _.push(L[1].trim());break}}}if(_.length)g+=`
11416
+ `}async function s0(e,t,r,n){if(t.length<1)return le("WebComponent","@webcomponent directive requires at least the tag name parameter",ne.INVALID_DIRECTIVE_SYNTAX);let i=t[0].replace(/['"]/g,""),s=(r.__stx_options||{}).componentsDir||"components",a=[Br.join(Br.dirname(n),s,`${i}.stx`),Br.join(process.cwd(),s,`${i}.stx`),Br.join(Br.dirname(n),`${i}.stx`)],o=null;for(let c of a)if(await X(c)){o=await Bun.file(c).text();break}if(!o)return le("WebComponent",`Component file not found: ${i}.stx`,ne.FILE_NOT_FOUND);let l=n0(o,i);return`<script type="module">
11417
+ ${i0(l)}
11418
+ </script>`}var a0=R(()=>{Et(),Te()}),Pf={};K(Pf,{timingPlugin:()=>zf,pluginManager:()=>Mf,definePlugin:()=>hi,debugPlugin:()=>Bf,createVariablesPlugin:()=>c0,createFilterPlugin:()=>l0,createDirectivePlugin:()=>o0,PluginManager:()=>No});function hi(e){return e}class No{plugins=new Map;sortedPlugins=[];initialized=!1;async register(e,t){if(this.plugins.has(e.name))throw Error(`Plugin "${e.name}" is already registered`);if(e.dependencies){for(let r of e.dependencies)if(!this.plugins.has(r))throw Error(`Plugin "${e.name}" depends on "${r}" which is not registered`)}if(this.plugins.set(e.name,e),e.onRegister)await e.onRegister(t);this.sortPlugins()}async unregister(e){let t=this.plugins.get(e);if(!t)return!1;for(let[r,n]of this.plugins)if(n.dependencies?.includes(e))throw Error(`Cannot unregister "${e}" because "${r}" depends on it`);if(t.onUnregister)await t.onUnregister();return this.plugins.delete(e),this.sortPlugins(),!0}get(e){return this.plugins.get(e)}has(e){return this.plugins.has(e)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let e=[];for(let t of this.sortedPlugins)if(t.registerDirectives)e.push(...t.registerDirectives());return e}getAllFilters(){let e={};for(let t of this.sortedPlugins)if(t.registerFilters)Object.assign(e,t.registerFilters());return e}async runBeforeProcess(e){return this.runHooks("beforeProcess",e)}async runAfterParse(e){return this.runHooks("afterParse",e)}async runBeforeDirective(e,t){return this.runDirectiveHooks("beforeDirective",e,t)}async runAfterDirective(e,t){return this.runDirectiveHooks("afterDirective",e,t)}async runBeforeRender(e){return this.runHooks("beforeRender",e)}async runAfterRender(e){return this.runHooks("afterRender",e)}async runOnError(e){for(let t of this.sortedPlugins)if(t.onError)try{let r=await t.onError(e);if(r){if(r.template!==void 0)e.template=r.template;if(r.context)e.context={...e.context,...r.context};if(r.metadata)e.metadata={...e.metadata,...r.metadata};if(r.skip)return e}}catch(r){console.error(`Error in plugin "${t.name}" onError hook:`,r)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((e,t)=>(e.priority??100)-(t.priority??100))}async runHooks(e,t){let r={...t};for(let n of this.sortedPlugins){let i=n[e];if(i)try{let s=await i(r);if(s){if(s.template!==void 0)r.template=s.template;if(s.context)r.context={...r.context,...s.context};if(s.metadata)r.metadata={...r.metadata,...s.metadata};if(s.skip)break}}catch(s){console.error(`Error in plugin "${n.name}" ${e} hook:`,s)}}return r}async runDirectiveHooks(e,t,r){let n={...r};for(let i of this.sortedPlugins){let s=i[e];if(s)try{let a=await s(t,n);if(a){if(a.template!==void 0)n.template=a.template;if(a.context)n.context={...n.context,...a.context};if(a.metadata)n.metadata={...n.metadata,...a.metadata};if(a.skip)break}}catch(a){console.error(`Error in plugin "${i.name}" ${e} hook:`,a)}}return n}}function o0(e,t,r={}){return{name:e,...r,registerDirectives:()=>t}}function l0(e,t,r={}){return{name:e,...r,registerFilters:()=>t}}function c0(e){return hi({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(t){return{context:{...t.context,...e}}}})}var Mf,Bf,zf,u0=R(()=>{Mf=new No,Bf=hi({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(e){console.log("[stx-debug] beforeProcess:",e.filePath)},afterParse(e){console.log("[stx-debug] afterParse:",e.template.length,"chars")},beforeDirective(e,t){console.log("[stx-debug] beforeDirective:",e)},afterDirective(e,t){console.log("[stx-debug] afterDirective:",e)},beforeRender(e){console.log("[stx-debug] beforeRender")},afterRender(e){console.log("[stx-debug] afterRender:",e.template.length,"chars")},onError(e){console.error("[stx-debug] onError:",e.error.message,"in phase:",e.phase)}}),zf=hi({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(e){e.metadata.startTime=performance.now()},afterRender(e){let t=e.metadata.startTime;if(t){let r=performance.now()-t;console.log(`[stx-timing] Processing took ${r.toFixed(2)}ms`)}}})}),Ff={};K(Ff,{validateConfig:()=>g0,resolveStxDirectories:()=>qf,loadStxConfig:()=>er,defineStxConfig:()=>m0,defaultConfig:()=>Jt,config:()=>Hi});function d0(e,t,r){let n=t||"pages";if(e)return{root:e,pagesDir:n};let i=r||process.cwd(),s=Le.join(i,"resources","views"),a=Le.join(i,"resources","layouts");if(Fn.existsSync(s)&&Fn.existsSync(a))return{root:"resources",pagesDir:"views"};let o=Le.join(i,"resources","views","pages");if(Fn.existsSync(o))return{root:"resources/views",pagesDir:n};return{root:".",pagesDir:n}}function p0(e,t){let r=t.replace(/[\\/]+$/,"");if(!r||r===".")return!0;let n=e.replace(/\\/g,"/"),i=r.replace(/\\/g,"/");return n===i||n.startsWith(`${i}/`)}function qf(e,t){let r=!e.root,n=d0(e.root,e.pagesDir,t);if(e.root=n.root,e.pagesDir=n.pagesDir,r&&n.root!=="."){let i=`${t}::${n.root}`;if(!Vs.has(i))Vs.add(i),console.warn(`[stx] No "root" in config \u2014 inferred "${n.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(e.root&&e.root!=="."){let i=e.root;for(let s of["partialsDir","componentsDir","layoutsDir"]){let a=e[s];if(typeof a!=="string"||!a)continue;if(Le.isAbsolute(a)||p0(a,i))continue;e[s]=Le.join(i,a)}}return e}function f0(e,t){let r=["componentsDir","layoutsDir","partialsDir"];for(let n of r){let i=e[n];if(typeof i!=="string"||!i)continue;let s=Le.isAbsolute(i)?i:Le.join(t,i);if(Fn.existsSync(s))continue;let a=e.root,o=!!a&&a!==".";console.warn(`[stx] ${String(n)} resolves to "${s}", which does not exist. Configured as "${i}"`+(o?`, resolved under root "${a}".`:"."))}}function h0(e){if(ty(e.stateDir),e.stateDir=ti(),e.cachePath=xn(e.cachePath),e.build)e.build.cacheDir=xn(e.build.cacheDir);if(e.media?.cache)e.media.cache.directory=xn(e.media.cache.directory);if(e.story)e.story.outDir=xn(e.story.outDir)}async function er(e){if(!e){if(xr)return xr;if(qn)return qn}let t=e?Le.resolve(e):process.cwd(),r=Js.get(t);if(r)return r;let n=(async()=>{let i=(await Bc({name:"stx",alias:"ui",cwd:t,defaultConfig:Jt,verbose:!1})).config;if(h0(i),qf(i,t),f0(i,t),i.plugins&&i.plugins.length>0){let{pluginManager:s}=await Promise.resolve().then(()=>(u0(),Pf)),a=[],o=[];for(let l of i.plugins){let c=typeof l==="string"?l:l[0],u=typeof l==="string"?{}:l[1]||{};try{let d,h;try{d=await import(c),h=Le.dirname(Qn.resolve(c))}catch{let f=Le.resolve(process.cwd(),c);d=await import(f),h=Le.dirname(f)}let p=d.default||d;if(s.register(p,i),p.components){let f=Array.isArray(p.components)?p.components:[p.components];for(let m of f)a.push(Le.resolve(h,m))}if(p.pages){let f=Le.resolve(h,p.pages),m=u.path||"/";o.push({dir:f,prefix:m})}if(p.setup){let f={addDirective:(m)=>{i.customDirectives=i.customDirectives||[],i.customDirectives.push(m)},addRoute:(m,y)=>{i.apiRoutes=i.apiRoutes||{},i.apiRoutes[m]=y},addMiddleware:(m)=>{i.middleware=i.middleware||[],i.middleware.push(m)},pluginDir:h,config:i};await p.setup(u,f)}console.log(`[stx] Plugin loaded: ${p.name||c}`)}catch(d){console.warn(`[stx] Failed to load plugin ${c}:`,d.message)}}i._pluginComponentDirs=a,i._pluginPageDirs=o}return i})();if(Js.set(t,n),!e)qn=n,n.then((i)=>{xr=i}).catch(()=>{});return n}function m0(e){return e}function g0(e){let t=[],r=[];if(e.partialsDir!==void 0&&typeof e.partialsDir!=="string")t.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(e.componentsDir!==void 0&&typeof e.componentsDir!=="string")t.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(e.cache!==void 0&&typeof e.cache!=="boolean")t.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(e.debug!==void 0&&typeof e.debug!=="boolean")t.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(e.streaming){if(e.streaming.bufferSize!==void 0){if(typeof e.streaming.bufferSize!=="number"||e.streaming.bufferSize<=0)t.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(e.streaming.timeout!==void 0){if(typeof e.streaming.timeout!=="number"||e.streaming.timeout<=0)t.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(e.streaming.strategy!==void 0){let n=["auto","manual","sections"];if(!n.includes(e.streaming.strategy))t.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.i18n){if(e.i18n.format!==void 0){let n=["json","yaml","yml","js"];if(!n.includes(e.i18n.format))t.push({path:"i18n.format",message:`i18n.format must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.animation){if(e.animation.defaultDuration!==void 0){if(typeof e.animation.defaultDuration!=="number"||e.animation.defaultDuration<0)t.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(e.animation.staggerDelay!==void 0){if(typeof e.animation.staggerDelay!=="number"||e.animation.staggerDelay<0)t.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(e.a11y){if(e.a11y.level!==void 0){let n=["AA","AAA"];if(!n.includes(e.a11y.level))t.push({path:"a11y.level",message:`a11y.level must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.hydration){if(e.hydration.mode!==void 0){let n=["progressive","islands"];if(!n.includes(e.hydration.mode))t.push({path:"hydration.mode",message:`hydration.mode must be one of: ${n.join(", ")}`,severity:"error"})}if(e.hydration.preload!==void 0){let n=["none","eager","lazy"];if(!n.includes(e.hydration.preload))t.push({path:"hydration.preload",message:`hydration.preload must be one of: ${n.join(", ")}`,severity:"error"})}}if(e.customDirectives)if(!Array.isArray(e.customDirectives))t.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else e.customDirectives.forEach((n,i)=>{if(!n.name||typeof n.name!=="string")t.push({path:`customDirectives[${i}].name`,message:"Custom directive must have a name string",severity:"error"});if(!n.handler||typeof n.handler!=="function")t.push({path:`customDirectives[${i}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(e.middleware)if(!Array.isArray(e.middleware))t.push({path:"middleware",message:"middleware must be an array",severity:"error"});else e.middleware.forEach((n,i)=>{if(!n.name||typeof n.name!=="string")t.push({path:`middleware[${i}].name`,message:"Middleware must have a name string",severity:"error"});if(!n.handler||typeof n.handler!=="function")t.push({path:`middleware[${i}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!n.timing||!["before","after"].includes(n.timing))t.push({path:`middleware[${i}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(e.debug===!0&&e.cache===!0)r.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(e.seo?.enabled===!0&&!e.seo?.defaultConfig?.title)r.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(e.pwa){if(e.pwa.enabled===!0&&!e.pwa.manifest?.name)t.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(e.pwa.manifest?.display!==void 0){let n=["fullscreen","standalone","minimal-ui","browser"];if(!n.includes(e.pwa.manifest.display))t.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${n.join(", ")}`,severity:"error"})}if(e.pwa.manifest?.orientation!==void 0){let n=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!n.includes(e.pwa.manifest.orientation))t.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${n.join(", ")}`,severity:"error"})}if(e.pwa.routes){let n=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];e.pwa.routes.forEach((i,s)=>{if(!i.pattern||typeof i.pattern!=="string")t.push({path:`pwa.routes[${s}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!n.includes(i.strategy))t.push({path:`pwa.routes[${s}].strategy`,message:`PWA route strategy must be one of: ${n.join(", ")}`,severity:"error"});if(i.maxAgeSeconds!==void 0&&(typeof i.maxAgeSeconds!=="number"||i.maxAgeSeconds<0))t.push({path:`pwa.routes[${s}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(i.maxEntries!==void 0&&(typeof i.maxEntries!=="number"||i.maxEntries<1))t.push({path:`pwa.routes[${s}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(e.pwa.icons?.sizes){if(!Array.isArray(e.pwa.icons.sizes))t.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(e.pwa.icons.sizes.filter((n)=>typeof n!=="number"||n<16||n>1024).length>0)t.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(e.pwa.icons?.purpose){let n=["any","maskable","monochrome"];if(e.pwa.icons.purpose.filter((i)=>!n.includes(i)).length>0)t.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${n.join(", ")}`,severity:"error"})}if(e.pwa.enabled===!0&&!e.pwa.icons?.src)r.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(e.pwa.enabled===!0&&!e.pwa.manifest?.themeColor)r.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:t.length===0,errors:t,warnings:r}}var Jt,Vs,xr=null,Js,qn=null,Hi,At=R(()=>{fu(),vu(),bu(),ku(),_p(),lx(),Cf(),Mx(),Lo(),Ai(),a0(),Jt={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:Kr,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:hb,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:s0,hasEndTag:!1,description:"Include a web component in the template"},du,pu,Lf,Nf,hu,gu,yu,mu,wu,_u,ef,Af,...Tf],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}},Vs=new Set,Js=new Map,Hi=new Proxy(Jt,{get(e,t){if(xr&&t in xr)return xr[t];if(!qn)er().catch((r)=>{console.warn("[stx] Failed to load config file:",r?.message||r)});return e[t]}})}),Wf={};K(Wf,{resetCssCache:()=>_0,resetCrosswindCache:()=>k0,rebuildCrosswindCSS:()=>E0,loadCrosswindConfig:()=>Mo,loadCrosswind:()=>Po,injectCrosswindCSS:()=>Bo,getCrosswindServeAsset:()=>v0,getCachedCSS:()=>A0,generateCrosswindCSS:()=>Gf,extractClassNames:()=>Uf,buildCrosswindCSS:()=>Hf});function Ui(e){return Bun.hash(e).toString(16).padStart(16,"0").slice(0,16)}function is(e,t){if(et.has(e))et.delete(e);else if(et.size>=Vf)et.delete(et.keys().next().value);et.set(e,t)}function y0(e){let t=Ui(e);if(He.has(t))He.delete(t);else if(He.size>=Vf)He.delete(He.keys().next().value);return He.set(t,e),t}function v0(e){let t=He.get(e);if(t===void 0)return;return He.delete(e),He.set(e,t),t}async function w0(e){if(!yt)return null;try{let t=Bun.file(re.join(yt,`cw-${Ui(e)}.css`));if(!await t.exists())return null;return await t.text()}catch{return null}}async function b0(e,t){if(!yt)return;try{if(!fs.existsSync(yt))fs.mkdirSync(yt,{recursive:!0});await Bun.write(re.join(yt,`cw-${Ui(e)}.css`),t)}catch{}}async function Ul(e){try{let t=await import(e);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}function x0(){let e=[],t=process.cwd();while(t!==re.dirname(t))e.push(re.join(t,"node_modules","@cwcss","crosswind","dist","index.js")),e.push(re.join(t,"node_modules","@cwcss","crosswind","src","index.ts")),e.push(re.join(t,"pantry","@cwcss","crosswind","dist","index.js")),e.push(re.join(t,"pantry","@cwcss","crosswind","src","index.ts")),e.push(re.join(t,"node_modules","@stacksjs","crosswind","dist","index.js")),e.push(re.join(t,"pantry","@stacksjs","crosswind","dist","index.js")),t=re.dirname(t);return e}function S0(){let e=[],t=process.env.HOME||process.env.USERPROFILE||"";if(t){let r=[re.join(t,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),re.join(t,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),re.join(t,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),re.join(t,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),re.join(t,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),re.join(t,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];e.push(...r)}return e.push(re.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),e.push(re.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),e}async function Po(){if(Ys)return Xe;Ys=!0;try{let e=async(i)=>{for(let s of i){if(!await Bun.file(s).exists())continue;let a=await Ul(s);if(a){if(!process.env.STACKS_DEV_QUIET)console.log(`${ue.green}[Crosswind]${ue.reset} CSS engine loaded from ${re.dirname(re.dirname(s))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=re.resolve(process.env.CROSSWIND_SRC),s=await e([i]);if(!s)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${i}`);return Xe=s,Xe}let t=await e(x0());if(t)return Xe=t,Xe;let r=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let i of r){let s=await Ul(i);if(s){if(Xe=s,!process.env.STACKS_DEV_QUIET)console.log(`${ue.green}[Crosswind]${ue.reset} CSS engine loaded`);return Xe}}let n=await e(S0());if(n)return Xe=n,Xe;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${ue.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${ue.reset}`),console.warn(`${ue.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${ue.reset}`),null}}function _0(){et.clear(),He.clear()}function k0(){Xe=null,Ys=!1,Je=null,tn="",et.clear(),He.clear(),Wn=null}async function Mo(e){try{if(!Mc({name:"crosswind",cwd:e}))return null;let{loadConfigWithResult:t}=await import("./chunk-ccqmwdry.js"),r=await t({name:"crosswind",cwd:e,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let n=re.relative(e,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${ue.green}[Crosswind]${ue.reset} Loaded config from ${n||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${ue.yellow}[Crosswind]${ue.reset} Failed to load crosswind config:`,t instanceof Error?t.message:t),null}}async function Hf(e){if(ir)return tn;ir=!0;try{let t=await Po();if(!t||!t.build)return ir=!1,"";if(!Je)Je=await Mo(e);if(!Je)return ir=!1,"";let r=t.defaultConfig?.theme||{},n=Je.theme||{},i={...t.defaultConfig,...Je,theme:{...r,...n,extend:{...r.extend||{},...n.extend||{}}}},s=performance.now(),a=await t.build(i),o=performance.now()-s;if(tn=a.css,console.log(`${ue.cyan}[Crosswind]${ue.reset} Built ${a.classes.size} classes in ${o.toFixed(1)}ms`),i.output){let l=re.isAbsolute(i.output)?i.output:re.join(e,i.output),c=re.dirname(l);if(!fs.existsSync(c))fs.mkdirSync(c,{recursive:!0});await Bun.write(l,a.css)}return ir=!1,a.css}catch(t){return console.error(`${ue.red}[Crosswind]${ue.reset} Build error:`,t),ir=!1,tn}}async function E0(e){Je=null,await Hf(e)}function A0(){return tn}function Uf(e){let t=new Set,r=/class\s*=\s*["']([^"']+)["']/gi,n=r.exec(e);while(n!==null){for(let a of n[1].split(/\s+/))if(a.trim())t.add(a.trim());n=r.exec(e)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,s=i.exec(e);while(s!==null){let a=s[1].match(/'([^']+)'/g);if(a){for(let o of a)for(let l of o.slice(1,-1).split(/\s+/))if(l.trim())t.add(l.trim())}s=i.exec(e)}return t}async function Gf(e,t){try{let r=await Po();if(!r)return"";let n=typeof r.extractClasses==="function"?r.extractClasses(e):Uf(e);if(n.size===0)return"";let i=t?re.resolve(t):process.cwd();if(!yt)yt=Ar(i,"cache");let s=[...n].sort().join(" "),a=`${Wn||"default"}::${s}`,o=et.get(a);if(o!==void 0)return is(a,o),o;let l=await w0(a);if(l!==null)return is(a,l),l;if(!Je){let b=null;try{let{loadStxConfig:S}=await Promise.resolve().then(()=>(At(),Ff)),x=await S(i);if(x.css)if(typeof x.css==="string"){let _=re.isAbsolute(x.css)?x.css:re.resolve(i,x.css);if(await Bun.file(_).exists()){let E=await import(_);b=E.default||E,console.log(`${ue.green}[Crosswind]${ue.reset} Loaded config from stx.config.ts \u2192 ${x.css}`)}}else{if(b={...x.css,content:x.css.content||[],preflight:x.css.preflight??!0,minify:x.css.minify??!1},x.css.config){let _=re.isAbsolute(x.css.config)?x.css.config:re.resolve(i,x.css.config);if(await Bun.file(_).exists()){let E=await import(_);b={...E.default||E,...b}}}console.log(`${ue.green}[Crosswind]${ue.reset} Using inline CSS config from stx.config.ts`)}}catch{}Je=b||await Mo(i);try{Wn=Ui(JSON.stringify(Je??{}))}catch{Wn="unhashable"}}let c=r.defaultConfig||r.config,u=Je||{},d=ey(c,u),{safelist:h,includePreflight:p,minify:f}=d,m=d.config,y=new r.CSSGenerator(m);for(let b of h)y.generate(b);for(let b of n)y.generate(b);let g=y.toCSS(p,f),v=m.shortcuts||u.shortcuts||{};for(let[b,S]of Object.entries(v)){if(!n.has(b)&&!h.includes(b))continue;let x=S.split(/\s+/).filter(Boolean);for(let _ of x)y.generate(_)}g=y.toCSS(p,f);let w=g.split(`
11419
+ `);for(let[b,S]of Object.entries(v)){if(!n.has(b)&&!h.includes(b))continue;let x=S.split(/\s+/).filter(Boolean),_=[],E=[];for(let k of x){let A=k.startsWith("dark:"),T=`.${(A?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let C=0;C<w.length;C++){let D=w[C].trim();if(D===`${T} {`||D.startsWith(`${T} {`)){let I=C,O="";while(I<w.length){if(O+=w[I],w[I].includes("}"))break;I++}let N=O.match(/\{([^}]+)\}/);if(N)if(A)E.push(N[1].trim());else _.push(N[1].trim());break}}}if(_.length)g+=`
11420
11420
  .${b} { ${_.join(" ")} }`;if(E.length)g+=`
11421
- @media (prefers-color-scheme: dark) { .dark .${b} { ${E.join(" ")} } }`}return ns(a,g),wx(a,g),g}catch(r){return console.warn("Failed to generate Crosswind CSS:",r),""}}async function Mo(e,t,r=!1){let n=await Uf(e,t);if(!n)return e;let i=r?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${gx(n)}.css">`:`<style data-crosswind="generated">
11421
+ @media (prefers-color-scheme: dark) { .dark .${b} { ${E.join(" ")} } }`}return is(a,g),b0(a,g),g}catch(r){return console.warn("Failed to generate Crosswind CSS:",r),""}}async function Bo(e,t,r=!1){let n=await Gf(e,t);if(!n)return e;let i=r?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${y0(n)}.css">`:`<style data-crosswind="generated">
11422
11422
  ${n}
11423
11423
  </style>`,s=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(s.test(e)){let a=!1;return e.replace(s,()=>{if(a)return"";return a=!0,i})}if(e.includes("</head>"))return e.replace("</head>",`${i}
11424
11424
  </head>`);if(e.includes("<body"))return e.replace(/<body([^>]*)>/,`<body$1>
11425
- ${i}`);return i+e}var Qe=null,Js=!1,Ve=null,en="",nr=!1,Gf=256,Xe,We,gt=null,qn=null,Bo=R(()=>{Ei(),ry(),Xe=new Map,We=new Map});function Ax(){return`
11425
+ ${i}`);return i+e}var Xe=null,Ys=!1,Je=null,tn="",ir=!1,Vf=256,et,He,yt=null,Wn=null,zo=R(()=>{Ai(),ny(),et=new Map,He=new Map});function C0(){return`
11426
11426
  // STX Lifecycle Runtime
11427
11427
  (function() {
11428
11428
  if (typeof window === 'undefined') return;
@@ -11767,7 +11767,7 @@ else {
11767
11767
 
11768
11768
  console.log('[stx] Lifecycle runtime initialized');
11769
11769
  })();
11770
- `}function is(e){return Symbol(e)}var Cx,Tx,Rx,Ix=R(()=>{Cx=is("theme"),Tx=is("router"),Rx=is("i18n")});function Ul(e){let t=/\$(\w+)\./g,r=[],n;while((n=t.exec(e))!==null)if(!r.includes(n[1]))r.push(n[1]);return r}function Ox(){return`stx-${Vf.randomBytes(4).toString("hex")}`}function jx(e){return/\$\w+\./.test(e)}function Dx(e){let t=[],r=new Set,n=/<(\w+)([^>]*?)(\s*\/?>)/g,i=e;return i=i.replace(n,(s,a,o,l)=>{if(["script","style","template"].includes(a.toLowerCase()))return s;let c=[],u=!1,d=o,h=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,p=[...o.matchAll(h)];for(let y of p){let g=y[0],v=y[1],w=y[2];if(jx(w)){u=!0;let b=w.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(b){let S=b[1];if(c.push({attr:v,expr:S,fullMatch:g,originalAttr:v}),Ul(S).forEach((x)=>r.add(x)),v==="text")d=d.replace(g,"");else if(v==="class")d=d.replace(g,'class=""');else if(v==="disabled"||v==="hidden")d=d.replace(g,"");else d=d.replace(g,`${v}=""`)}}}if(!u)return s;let f=d.match(/\bid\s*=\s*"([^"]+)"/),m;if(f)m=f[1];else m=Ox(),d=` id="${m}"${d}`;for(let y of c)t.push({elementId:m,attribute:y.attr,expression:y.expr,stores:Ul(y.expr)});return`<${a}${d}${l}`}),{html:i,bindings:t,stores:r}}function $x(e,t){if(e.length===0)return"";let r=Array.from(t),n=`
11770
+ `}function ss(e){return Symbol(e)}var T0,R0,I0,O0=R(()=>{T0=ss("theme"),R0=ss("router"),I0=ss("i18n")});function Gl(e){let t=/\$(\w+)\./g,r=[],n;while((n=t.exec(e))!==null)if(!r.includes(n[1]))r.push(n[1]);return r}function j0(){return`stx-${Jf.randomBytes(4).toString("hex")}`}function D0(e){return/\$\w+\./.test(e)}function $0(e){let t=[],r=new Set,n=/<(\w+)([^>]*?)(\s*\/?>)/g,i=e;return i=i.replace(n,(s,a,o,l)=>{if(["script","style","template"].includes(a.toLowerCase()))return s;let c=[],u=!1,d=o,h=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,p=[...o.matchAll(h)];for(let y of p){let g=y[0],v=y[1],w=y[2];if(D0(w)){u=!0;let b=w.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(b){let S=b[1];if(c.push({attr:v,expr:S,fullMatch:g,originalAttr:v}),Gl(S).forEach((x)=>r.add(x)),v==="text")d=d.replace(g,"");else if(v==="class")d=d.replace(g,'class=""');else if(v==="disabled"||v==="hidden")d=d.replace(g,"");else d=d.replace(g,`${v}=""`)}}}if(!u)return s;let f=d.match(/\bid\s*=\s*"([^"]+)"/),m;if(f)m=f[1];else m=j0(),d=` id="${m}"${d}`;for(let y of c)t.push({elementId:m,attribute:y.attr,expression:y.expr,stores:Gl(y.expr)});return`<${a}${d}${l}`}),{html:i,bindings:t,stores:r}}function L0(e,t){if(e.length===0)return"";let r=Array.from(t),n=`
11771
11771
  <script>
11772
11772
  (function() {
11773
11773
  'use strict';
@@ -11925,10 +11925,10 @@ else {
11925
11925
  }
11926
11926
  })();
11927
11927
  </script>
11928
- `,n}function Lx(e){let{html:t,bindings:r,stores:n}=Dx(e);if(r.length===0)return e;let i=$x(r,n),s=t.lastIndexOf("</body>");if(s!==-1)return t.slice(0,s)+i+t.slice(s);return t+i}var Nx=()=>{};function Px(e){let t=e.analytics;if(!t?.enabled)return"";switch(t.driver){case"fathom":return Mx(t);case"google-analytics":return Bx(t);case"plausible":return zx(t);case"self-hosted":return Fx(t);case"custom":return qx(t);default:return""}}function Mx(e){let t=e.fathom;if(!t?.siteId)return"";let r=t.scriptUrl||"https://cdn.usefathom.com/script.js",n=t.defer!==!1?" defer":"",i=[`data-site="${Ne(t.siteId)}"`];if(t.honorDnt)i.push('data-honor-dnt="true"');if(t.spa)i.push('data-spa="auto"');if(t.canonical)i.push(`data-canonical="${Ne(t.canonical)}"`);if(t.auto===!1)i.push('data-auto="false"');return`
11928
+ `,n}function N0(e){let{html:t,bindings:r,stores:n}=$0(e);if(r.length===0)return e;let i=L0(r,n),s=t.lastIndexOf("</body>");if(s!==-1)return t.slice(0,s)+i+t.slice(s);return t+i}var P0=()=>{};function M0(e){let t=e.analytics;if(!t?.enabled)return"";switch(t.driver){case"fathom":return B0(t);case"google-analytics":return z0(t);case"plausible":return F0(t);case"self-hosted":return q0(t);case"custom":return W0(t);default:return""}}function B0(e){let t=e.fathom;if(!t?.siteId)return"";let r=t.scriptUrl||"https://cdn.usefathom.com/script.js",n=t.defer!==!1?" defer":"",i=[`data-site="${Pe(t.siteId)}"`];if(t.honorDnt)i.push('data-honor-dnt="true"');if(t.spa)i.push('data-spa="auto"');if(t.canonical)i.push(`data-canonical="${Pe(t.canonical)}"`);if(t.auto===!1)i.push('data-auto="false"');return`
11929
11929
  <!-- Fathom Analytics -->
11930
- <script src="${Ne(r)}" ${i.join(" ")}${n}></script>
11931
- `}function Bx(e){let t=e.googleAnalytics;if(!t?.measurementId)return"";let r=Ne(t.measurementId),n=t.debug?`gtag('config', '${r}', { 'debug_mode': true });`:"";return`
11930
+ <script src="${Pe(r)}" ${i.join(" ")}${n}></script>
11931
+ `}function z0(e){let t=e.googleAnalytics;if(!t?.measurementId)return"";let r=Pe(t.measurementId),n=t.debug?`gtag('config', '${r}', { 'debug_mode': true });`:"";return`
11932
11932
  <!-- Google Analytics -->
11933
11933
  <script async src="https://www.googletagmanager.com/gtag/js?id=${r}"></script>
11934
11934
  <script>
@@ -11938,10 +11938,10 @@ else {
11938
11938
  gtag('config', '${r}');
11939
11939
  ${n}
11940
11940
  </script>
11941
- `}function zx(e){let t=e.plausible;if(!t?.domain)return"";let r=t.scriptUrl||"https://plausible.io/js/script.js",n=[`data-domain="${Ne(t.domain)}"`],i=r,s=[];if(t.trackLocalhost)s.push("local");if(t.hashMode)s.push("hash");if(s.length>0&&r==="https://plausible.io/js/script.js")i=`https://plausible.io/js/script.${s.join(".")}.js`;return`
11941
+ `}function F0(e){let t=e.plausible;if(!t?.domain)return"";let r=t.scriptUrl||"https://plausible.io/js/script.js",n=[`data-domain="${Pe(t.domain)}"`],i=r,s=[];if(t.trackLocalhost)s.push("local");if(t.hashMode)s.push("hash");if(s.length>0&&r==="https://plausible.io/js/script.js")i=`https://plausible.io/js/script.${s.join(".")}.js`;return`
11942
11942
  <!-- Plausible Analytics -->
11943
- <script defer data-domain="${Ne(t.domain)}" src="${Ne(i)}"></script>
11944
- `}function Fx(e){let t=e.selfHosted;if(!t?.siteId||!t?.apiEndpoint)return"";let r=Ne(t.siteId),n=Ne(t.apiEndpoint),i=t.honorDnt?'if(n.doNotTrack==="1")return;':"",s=t.trackHashChanges?"w.addEventListener('hashchange',pv);":"",a=t.trackOutboundLinks?`
11943
+ <script defer data-domain="${Pe(t.domain)}" src="${Pe(i)}"></script>
11944
+ `}function q0(e){let t=e.selfHosted;if(!t?.siteId||!t?.apiEndpoint)return"";let r=Pe(t.siteId),n=Pe(t.apiEndpoint),i=t.honorDnt?'if(n.doNotTrack==="1")return;':"",s=t.trackHashChanges?"w.addEventListener('hashchange',pv);":"",a=t.trackOutboundLinks?`
11945
11945
  d.addEventListener('click',function(e){
11946
11946
  var a=e.target.closest('a');
11947
11947
  if(a&&a.hostname!==location.hostname){
@@ -11974,15 +11974,15 @@ else {
11974
11974
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
11975
11975
  })();
11976
11976
  </script>
11977
- `}function qx(e){let t=e.custom;if(!t)return"";if(t.inlineScript)return`
11977
+ `}function W0(e){let t=e.custom;if(!t)return"";if(t.inlineScript)return`
11978
11978
  <!-- Custom Analytics -->
11979
11979
  <script>
11980
11980
  ${t.inlineScript}
11981
11981
  </script>
11982
- `;if(!t.scriptUrl)return"";let r=[];if(t.scriptId)r.push(`id="${Ne(t.scriptId)}"`);if(t.attributes)for(let[n,i]of Object.entries(t.attributes))r.push(`${Ne(n)}="${Ne(i)}"`);return`
11982
+ `;if(!t.scriptUrl)return"";let r=[];if(t.scriptId)r.push(`id="${Pe(t.scriptId)}"`);if(t.attributes)for(let[n,i]of Object.entries(t.attributes))r.push(`${Pe(n)}="${Pe(i)}"`);return`
11983
11983
  <!-- Custom Analytics -->
11984
- <script${r.length>0?` ${r.join(" ")}`:""} src="${Ne(t.scriptUrl)}" defer></script>
11985
- `}function Wx(e,t){let r=Px(t);if(!r)return e;if(!e.includes("</head>")){let n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+r+e.slice(n);return e+r}return e.replace("</head>",`${r}</head>`)}function Ne(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Hx=()=>{};function Jf(e){let t=e.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!t)return null;try{return Function(`return ${t[1]}`)()}catch{return null}}function Ux(e){let t=e?.layout;if(t===!1)return!1;return typeof t==="string"&&t.trim()?t.trim():void 0}function Gl(e,t){let r=e.match(new RegExp(`${t}\\s*=\\s*"([^"]*)"`,"i"));if(r)return r[1];let n=e.match(new RegExp(`${t}\\s*=\\s*'([^']*)'`,"i"));if(n)return n[1];return null}function Gx(e){let t=[],r=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,n;while((n=r.exec(e))!==null){let[i,s,a]=n,o=n.index,l=Gl(a,"x-data");if(!l)continue;let c=`__stx_scope_${Yf++}`,u=Gl(a,"x-init"),d=Vx(e,s,o+i.length),h=e.slice(o,d.endIndex),p=Jx(h);t.push({id:c,selector:`[data-stx-scope="${c}"]`,stateExpr:l,initExpr:u,bindings:[],refs:p})}return t}function Vx(e,t,r){let n=1,i=r,s=new RegExp(`<${t}(?:\\s|>)`,"gi"),a=new RegExp(`</${t}>`,"gi"),o=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(n>0&&i<e.length){s.lastIndex=i,a.lastIndex=i,o.lastIndex=i;let l=s.exec(e),c=a.exec(e),u=o.exec(e);if(u&&u.index<(l?.index??1/0)){i=u.index+u[0].length;continue}if(!c)return{endIndex:e.length};if(l&&l.index<c.index)n++,i=l.index+l[0].length;else{if(n--,n===0)return{endIndex:c.index+c[0].length};i=c.index+c[0].length}}return{endIndex:e.length}}function Jx(e){let t=new Map,r=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),n=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,i;while((i=n.exec(r))!==null){let[,s,a]=i,o=Yx(s);t.set(a,o)}return t}function Yx(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${tS++}`}function Kx(){return`
11984
+ <script${r.length>0?` ${r.join(" ")}`:""} src="${Pe(t.scriptUrl)}" defer></script>
11985
+ `}function H0(e,t){let r=M0(t);if(!r)return e;if(!e.includes("</head>")){let n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+r+e.slice(n);return e+r}return e.replace("</head>",`${r}</head>`)}function Pe(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var U0=()=>{};function Yf(e){let t=e.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!t)return null;try{return Function(`return ${t[1]}`)()}catch{return null}}function G0(e){let t=e?.layout;if(t===!1)return!1;return typeof t==="string"&&t.trim()?t.trim():void 0}function Vl(e,t){let r=e.match(new RegExp(`${t}\\s*=\\s*"([^"]*)"`,"i"));if(r)return r[1];let n=e.match(new RegExp(`${t}\\s*=\\s*'([^']*)'`,"i"));if(n)return n[1];return null}function V0(e){let t=[],r=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,n;while((n=r.exec(e))!==null){let[i,s,a]=n,o=n.index,l=Vl(a,"x-data");if(!l)continue;let c=`__stx_scope_${Kf++}`,u=Vl(a,"x-init"),d=J0(e,s,o+i.length),h=e.slice(o,d.endIndex),p=Y0(h);t.push({id:c,selector:`[data-stx-scope="${c}"]`,stateExpr:l,initExpr:u,bindings:[],refs:p})}return t}function J0(e,t,r){let n=1,i=r,s=new RegExp(`<${t}(?:\\s|>)`,"gi"),a=new RegExp(`</${t}>`,"gi"),o=new RegExp(`<${t}[^>]*/\\s*>`,"gi");while(n>0&&i<e.length){s.lastIndex=i,a.lastIndex=i,o.lastIndex=i;let l=s.exec(e),c=a.exec(e),u=o.exec(e);if(u&&u.index<(l?.index??1/0)){i=u.index+u[0].length;continue}if(!c)return{endIndex:e.length};if(l&&l.index<c.index)n++,i=l.index+l[0].length;else{if(n--,n===0)return{endIndex:c.index+c[0].length};i=c.index+c[0].length}}return{endIndex:e.length}}function Y0(e){let t=new Map,r=e.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),n=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,i;while((i=n.exec(r))!==null){let[,s,a]=i,o=K0(s);t.set(a,o)}return t}function K0(e){let t=e.match(/\bid\s*=\s*["']([^"']*)["']/);if(t)return t[1];return`__stx_el_${rS++}`}function Z0(){return`
11986
11986
  // STX Reactive Runtime - x-cloak and transition CSS
11987
11987
  (function() {
11988
11988
  var style = document.createElement('style');
@@ -12189,7 +12189,7 @@ window.__stx_reactive = (function() {
12189
12189
 
12190
12190
  return { initScope: initScope, reactive: reactive };
12191
12191
  })();
12192
- `}function Vl(e,t){let r=e.replace(/\{!!([\s\S]*?)!!\}/g,(o,l)=>{try{let c=Pe(l,t,!0);if(c===void 0)return o;return String(c)}catch{return o}}),n="",i=0,s=null;while(i<r.length){let o=r[i];if(s&&o==="\\"){n+=o+(r[i+1]??""),i+=2;continue}if(o==="{"&&r[i+1]==="{"){let l=r.indexOf("}}",i+2);if(l!==-1){let c=r.slice(i,l+2);n+=a(r.slice(i+2,l),c,s),i=l+2;continue}}if(s){if(o===s)s=null}else if(o==="'"||o==='"'||o==="`")s=o;n+=o,i++}return n;function a(o,l,c){let u;try{u=Pe(o,t,!0)}catch{return l}if(u===void 0)return l;if(c){let d=String(u).replace(/\\/g,"\\\\").replace(new RegExp(c==="`"?"`":c,"g"),`\\${c}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return c==="`"?d.replace(/\$\{/g,"\\${"):d}if(typeof u==="string"){let d=u.trim();if(d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]"))try{return JSON.parse(d),d}catch{}}return JSON.stringify(u)}}function Zx(e,t){if(e.length===0)return"";let r=e.map((n)=>{let i=JSON.stringify(Object.fromEntries(n.refs)),s=Vl(n.stateExpr,t),a=n.initExpr?Vl(n.initExpr,t):null,o=JSON.stringify(s),l=a?JSON.stringify(a):"null";return`
12192
+ `}function Jl(e,t){let r=e.replace(/\{!!([\s\S]*?)!!\}/g,(o,l)=>{try{let c=Me(l,t,!0);if(c===void 0)return o;return String(c)}catch{return o}}),n="",i=0,s=null;while(i<r.length){let o=r[i];if(s&&o==="\\"){n+=o+(r[i+1]??""),i+=2;continue}if(o==="{"&&r[i+1]==="{"){let l=r.indexOf("}}",i+2);if(l!==-1){let c=r.slice(i,l+2);n+=a(r.slice(i+2,l),c,s),i=l+2;continue}}if(s){if(o===s)s=null}else if(o==="'"||o==='"'||o==="`")s=o;n+=o,i++}return n;function a(o,l,c){let u;try{u=Me(o,t,!0)}catch{return l}if(u===void 0)return l;if(c){let d=String(u).replace(/\\/g,"\\\\").replace(new RegExp(c==="`"?"`":c,"g"),`\\${c}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return c==="`"?d.replace(/\$\{/g,"\\${"):d}if(typeof u==="string"){let d=u.trim();if(d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]"))try{return JSON.parse(d),d}catch{}}return JSON.stringify(u)}}function Q0(e,t){if(e.length===0)return"";let r=e.map((n)=>{let i=JSON.stringify(Object.fromEntries(n.refs)),s=Jl(n.stateExpr,t),a=n.initExpr?Jl(n.initExpr,t):null,o=JSON.stringify(s),l=a?JSON.stringify(a):"null";return`
12193
12193
  (function() {
12194
12194
  var scopeEl = document.querySelector('${n.selector}');
12195
12195
  if (!scopeEl) return;
@@ -12198,16 +12198,16 @@ window.__stx_reactive = (function() {
12198
12198
  })();`}).join(`
12199
12199
  `);return`
12200
12200
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
12201
- ${Kx()}
12201
+ ${Z0()}
12202
12202
  ${r}
12203
- </script>`}function Qx(e,t,r){if(Yf=0,!eS(e))return e;let n=Gx(e);if(n.length===0)return e;let i=Xx(e,n),s=Zx(n,t),a=i.lastIndexOf("</body>");if(a!==-1)i=i.slice(0,a)+s+`
12204
- `+i.slice(a);else i+=s;return i}function Xx(e,t){let r=0,n=e.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(i,s,a)=>{let o=t[r++];if(!o)return i;let l=/data-stx-scope="([^"]*)"/.exec(a);if(l)return o.id=l[1],o.selector=`[data-stx-scope="${o.id}"]`,i;return`<${s} data-stx-scope="${o.id}"${a}>`});return n=n.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),n=n.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),n=n.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),n=n.replace(/\s*x-init\s*=\s*'[^']*'/g,""),n}function eS(e){return/x-data\s*=\s*["']/.test(e)}var Yf=0,tS=0,rS=R(()=>{ut()});async function iS(e,t={}){try{if(!await Q(e))throw Error(`Markdown file not found: ${e}`);let r=(await nS.promises.stat(e)).mtime.getTime();if(t.cache&&Wn.has(e)){let c=Wn.get(e);if(c.updatedAt>=r)return{content:c.content,data:c.data}}let n=await Bun.file(e).text(),{data:i,content:s}=gy(n),a=t.markdown||Wi.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},o=Ca(s,{gfm:!0});if(a.syntaxHighlighting?.enabled&&a.syntaxHighlighting?.serverSide)o=await sS(o,a.syntaxHighlighting?.defaultTheme||"github-dark",a.syntaxHighlighting?.highlightUnknownLanguages||!1);let l={content:o,data:i||{}};if(t.cache)Wn.set(e,{...l,updatedAt:r});return l}catch(r){if(t.debug)console.error(`Error reading/parsing markdown file ${e}:`,r);let n=r instanceof Error?r.message:String(r);return{content:Ae("Markdown File",`Error reading/parsing markdown file: ${n}`,e,"",0,""),data:{}}}}async function sS(e,t,r){let n=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!kn)try{kn=await Bc({theme:t||"github-dark",cache:!0})}catch(o){return console.error("Failed to initialize ts-syntax-highlighter:",o),e}let i=async(o,l,c,u)=>{let d=u.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),h=c||(r?"text":"");if(!h)return o;try{if(!kn.getSupportedLanguages().includes(h))return o;return(await kn.highlight(d,h,{theme:t})).html}catch(p){console.error(`Error highlighting code block with language ${c}:`,p)}return o},s=e,a=e.matchAll(n);for(let o of a){let[l,c,u,d]=o,h=await i(l,c,u,d);s=s.replace(l,h)}return s}async function aS(e,t,r="",n={}){return await oS(e,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(i,s,a,o)=>{try{let l=s;if(!ss.isAbsolute(s))l=ss.resolve(ss.dirname(r),s);let c={};if(a)try{try{c=JSON.parse(a)}catch{if(n.debug)console.warn("Using safer alternative for parsing JS object literal");let m=a.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let y of m){let g=y.indexOf(":");if(g>0){let v=y.substring(0,g).trim(),w=y.substring(g+1).trim(),b=w.startsWith('"')&&w.endsWith('"'),S=w.startsWith("'")&&w.endsWith("'");if(b||S)w=w.substring(1,w.length-1);c[v]=w}}}}catch(m){if(n.debug)console.error("Error parsing context in @markdown-file directive:",m)}let{content:u,data:d}=await iS(l,n),h={...t,...d,...c},p=u,f=/\{\{([^}]+)\}\}/g;return p=p.replace(f,(m,y)=>{let g=y.trim();return h[g]!==void 0?String(h[g]):m}),p}catch(l){let c=l instanceof Error?l.message:String(l);return Ae("Markdown File",`Error including markdown file: ${c}`,r,e,o,i)}})}async function oS(e,t,r){let n=[],i;while((i=t.exec(e))!==null){let o=i[0],l=i.index,c=i;n.push(r(...c).then((u)=>({match:o,replacement:u,index:l})))}let s=await Promise.all(n);s.sort((o,l)=>l.index-o.index);let a=e;for(let{match:o,replacement:l}of s)a=a.replace(o,()=>l);return a}var Wn,kn=null,lS=R(()=>{Et(),Ce(),Wn=new Map});function $t(e,t){try{let r=e.trim();if(xe(r))return ge(r,Object.keys(t))(...Object.values(t));else return pe(r,t)}catch{return!1}}var cS=R(()=>{Se()});function uS(e,t,r){let n=e,i=!0;while(i){i=!1;let s=n.match(/@switch\s*\(/);if(!s||s.index===void 0)break;let a=s.index,o=uw(n,a);if(!o)break;try{let l;if(xe(o.expression))l=ge(o.expression,Object.keys(t))(...Object.values(t));else l=pe(o.expression,t);let c="",u=!1;for(let d of o.cases)if(d.type==="default"){if(!u)c=d.content.trim()}else try{let h;if(d.value&&xe(d.value))h=ge(d.value,Object.keys(t))(...Object.values(t));else if(d.value)h=pe(d.value,t);if(l===h){c=d.content.trim(),u=!0;break}}catch{continue}n=n.substring(0,a)+c+n.substring(o.end),i=!0}catch(l){let c=l instanceof Error?l.message:String(l),u=oe("Switch",`Error evaluating @switch expression: ${c}`,re.EVALUATION_ERROR);n=n.substring(0,a)+u+n.substring(o.end);break}}return n}function dS(e){let t=[];return{masked:e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(r)=>{return t.push(r),`\x00stx-script-${t.length-1}\x00`}),scripts:t}}function pS(e,t){if(t.length===0)return e;return e.replace(/\u0000stx-script-(\d+)\u0000/g,(r,n)=>t[Number(n)]??r)}function Ui(e,t,r){let{masked:n,scripts:i}=dS(e);return pS(fS(n,t,r),i)}function fS(e,t,r){let n=e;n=uS(n,t,r);{let s=!0;while(s){s=!1;let a=n.match(/@unless\s*\(/);if(!a||a.index===void 0)break;let o=a.index,l=Rr(n,o+7);if(!l)break;let c=l.endPos,u=gn(n,"unless","endunless",c);if(u===-1){console.warn(`[stx] @unless directive at position ${o} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let d=n.slice(c,u),h=l.expression,p=-1;{let m=0,y=/@(?:if|unless)\s*\(/g,g=/@(?:endif|endunless)(?![a-z])/g,v=/@else(?![a-z])/g,w=[],b;while((b=y.exec(d))!==null)w.push({pos:b.index,type:"open"});while((b=g.exec(d))!==null)w.push({pos:b.index,type:"close"});while((b=v.exec(d))!==null)w.push({pos:b.index,type:"else"});w.sort((S,x)=>S.pos-x.pos);for(let S of w)if(S.type==="open")m++;else if(S.type==="close")m--;else if(S.type==="else"&&m===0){p=S.pos;break}}let f;if(p!==-1){let m=d.slice(0,p),y=d.slice(p+5);f=`@if (${h})${y}@else ${m}@endif`}else f=`@if (!(${h}))${d}@endif`;n=n.substring(0,o)+f+n.substring(u+10),s=!0}}n=Zf(n,t,r),n=Qf(n,t,r),n=Kf(n,t);let i=()=>{let s=Hd(n);if(s.length===0)return!1;for(let a=s.length-1;a>=0;a--){let o=s[a];try{let l="",c=!1;for(let u of o.branches){if(c)break;if(u.type==="else")l=u.content,c=!0;else try{let d;if(u.condition&&xe(u.condition))d=ge(u.condition,Object.keys(t))(...Object.values(t));else if(u.condition)d=pe(u.condition,t);if(d)l=u.content,c=!0}catch(d){l=oe(u.type==="if"?"If":"Elseif",`Error in @${u.type}(${u.condition}): ${d instanceof Error?d.message:String(d)}`,re.EVALUATION_ERROR),c=!0}}n=n.substring(0,o.start)+l+n.substring(o.end)}catch(l){let c=l instanceof Error?l.message:String(l),u=oe("If",`Error processing @if block: ${c}`,re.EVALUATION_ERROR);n=n.substring(0,o.start)+u+n.substring(o.end)}}return!0};while(!0){let s=n;if(!i())break;if(n===s)break}return n}function Jl(e){let t=0;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let r=e[t];if(r!=="'"&&r!=='"')return null;t++;let n=[];while(t<e.length){let i=e[t];if(i==="\\"&&t+1<e.length){n.push(e[t+1]),t+=2;continue}if(i===r){t++;break}n.push(i),t++}while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return t++,{value:n.join(""),consumed:t}}function Kf(e,t){let r=e;function n(o,l,c,u){let d=1,h=u,p=new RegExp(`@${l}(?:\\s*\\(|\\s|$)`,"g"),f=new RegExp(`@${c}(?![a-z])`,"g");while(h<o.length&&d>0){p.lastIndex=h,f.lastIndex=h;let m=p.exec(o),y=f.exec(o),g=m?m.index:1/0,v=y?y.index:1/0;if(g<v)d++,h=g+m[0].length;else if(v<1/0){if(d--,d===0)return v;h=v+y[0].length}else break}return-1}function i(o,l,c){let u=0,d=new RegExp(`@${l}(?:\\s*\\(|\\s|$)`,"g"),h=new RegExp(`@${c}(?![a-z])`,"g"),p=/@else(?![a-z])/g,f=[],m;while((m=d.exec(o))!==null)f.push({pos:m.index,type:"open"});while((m=h.exec(o))!==null)f.push({pos:m.index,type:"close"});while((m=p.exec(o))!==null)f.push({pos:m.index,type:"else"});f.sort((y,g)=>y.pos-g.pos);for(let y of f)if(y.type==="open")u++;else if(y.type==="close")u--;else if(y.type==="else"&&u===0)return y.pos;return-1}{let o=!0;while(o){o=!1;let l=r.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!l||l.index===void 0)break;let c=l.index,u,d,h=r.slice(c+5),p=Jl(h);if(p)u=p.value,d=c+5+p.consumed;else d=c+5;let f=n(r,"auth","endauth",d);if(f===-1){console.warn(`[stx] @auth directive at position ${c} has no matching @endauth \u2014 the block was skipped.`);break}let m=r.slice(d,f),y=i(m,"auth","endauth"),g;if(!t.auth)g=!1;else g=u?$t(`auth?.check && auth?.user?.[${u}]`,t):$t("auth?.check",t);let v;if(y!==-1){let w=m.slice(0,y),b=m.slice(y+5);v=g?w:b}else v=g?m:"";r=r.substring(0,c)+v+r.substring(f+8),o=!0}}{let o=!0;while(o){o=!1;let l=r.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!l||l.index===void 0)break;let c=l.index,u,d,h=r.slice(c+6),p=Jl(h);if(p)u=p.value,d=c+6+p.consumed;else d=c+6;let f=n(r,"guest","endguest",d);if(f===-1){console.warn(`[stx] @guest directive at position ${c} has no matching @endguest \u2014 the block was skipped.`);break}let m=r.slice(d,f),y=i(m,"guest","endguest"),g;if(!t.auth)g=!0;else g=u?$t(`!auth?.check || !auth?.user?.[${u}]`,t):$t("!auth?.check",t);let v;if(y!==-1){let w=m.slice(0,y),b=m.slice(y+5);v=g?w:b}else v=g?m:"";r=r.substring(0,c)+v+r.substring(f+9),o=!0}}function s(o,l,c){if(t.userCan&&typeof t.userCan[o]==="boolean")return t.userCan[o];if(t.permissions?.check&&typeof t.permissions.check==="function")try{let u=[o];if(l)u.push(l);if(c){let d=$t(c,t);u.push(d)}return t.permissions.check(...u)}catch{return!1}return!1}function a(o){let l=o.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!l)return null;return{ability:l[1],type:l[2],id:l[3]?.trim(),paramsEnd:l[0].length}}for(let o of["can","cannot"]){let l=`end${o}`,c=o==="can"?"elsecan":"elsecannot",u=!0;while(u){u=!1;let d=r.match(new RegExp(`@${o}\\s*\\(`));if(!d||d.index===void 0)break;let h=d.index,p=r.slice(h+`@${o}`.length),f=a(p);if(!f)break;let m=h+`@${o}`.length+f.paramsEnd,y=n(r,o,l,m);if(y===-1){console.warn(`[stx] @${o} directive at position ${h} has no matching @${l} \u2014 the block was skipped.`);break}let g=r.slice(m,y),v=[],w=0,b=new RegExp(`@${o}\\s*\\(`,"g"),S=new RegExp(`@${l}(?![a-z])`,"g"),x=new RegExp(`@${c}\\s*\\(`,"g"),_=/@else(?![a-z])/g,E=[],k;while((k=b.exec(g))!==null)E.push({pos:k.index,type:"open"});while((k=S.exec(g))!==null)E.push({pos:k.index,type:"close"});while((k=x.exec(g))!==null)E.push({pos:k.index,type:"elseDirective"});while((k=_.exec(g))!==null)E.push({pos:k.index,type:"else"});E.sort((O,L)=>O.pos-L.pos);for(let O of E){if(O.type==="open"){w++;continue}if(O.type==="close"){w--;continue}if(w===0)v.push(O)}let A=[],T=0;for(let O=0;O<v.length;O++){let L=v[O];if(A.push({content:g.slice(T,L.pos),ability:void 0}),L.type==="elseDirective"){let N=g.slice(L.pos+`@${c}`.length),B=a(N);if(B){A[A.length-1]={content:g.slice(T,L.pos)},T=L.pos+`@${c}`.length+B.paramsEnd,A.push({content:"",ability:B.ability,type:B.type,id:B.id}),A.pop();let F=v[O+1],K=F?F.pos:g.length;A.push({content:g.slice(T,K),ability:B.ability,type:B.type,id:B.id}),T=K}}else T=L.pos+5}if(T<g.length){let O=A[A.length-1];if(v.length>0&&v[v.length-1].type==="else")A.push({content:g.slice(T),isFinalElse:!0});else if(A.length===0)A.push({content:g.slice(T)})}let C=s(f.ability,f.type,f.id),D=o==="can"?C:!C,I="";if(D)I=A[0]?.content||"";else{let O=!1;for(let L=1;L<A.length;L++){let N=A[L];if(N.isFinalElse){I=N.content,O=!0;break}if(N.ability){let B=s(N.ability,N.type,N.id);if(o==="can"?B:!B){I=N.content,O=!0;break}}}if(!O&&A.length>0){let L=A[A.length-1];if(L.isFinalElse)I=L.content}}r=r.substring(0,h)+I+r.substring(y+`@${l}`.length),u=!0}}return r}function Zf(e,t,r){let n=e;function i(s,a,o,l,c){let u=!0;while(u){u=!1;let d=new RegExp(`@${a}\\s*\\(`),h=s.match(d);if(!h||h.index===void 0)break;let p=h.index,f=Rr(s,p+`@${a}`.length);if(!f)break;let m=f.endPos,y=gn(s,a,o,m);if(y===-1){console.warn(`[stx] @${a} directive at position ${p} has no matching @${o} \u2014 the block was skipped.`);break}let g=s.slice(m,y),v=f.expression,w=-1,b=0,S=0;while(S<g.length){let x=g.indexOf("@",S);if(x===-1)break;let _=g.substring(x);if(/^@(?:if|unless|isset|empty)\s*\(/.test(_)){b++,S=x+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(_)){b--,S=x+1;continue}if(b===0&&/^@else(?![a-z])/.test(_)){w=x;break}S=x+1}try{let x=l(v.trim()),_;if(w!==-1){let E=g.slice(0,w),k=g.slice(w+5);_=x?E:k}else _=x?g:"";s=s.substring(0,p)+_+s.substring(y+`@${o}`.length),u=!0}catch(x){let _=x instanceof Error?x.message:String(x),E=oe(c,`Error processing @${a} directive: ${_}`,re.EVALUATION_ERROR);s=s.substring(0,p)+E+s.substring(y+`@${o}`.length);break}}return s}return n=i(n,"isset","endisset",(s)=>{let a=$t(s,t);return a!==void 0&&a!==null},"Isset"),n=i(n,"empty","endempty",(s)=>{let a=$t(s,t);return a===void 0||a===null||a===""||a===0||a===!1||Array.isArray(a)&&a.length===0||typeof a==="object"&&a!==null&&Object.keys(a).length===0},"Empty"),n}function Qf(e,t,r){let n=e,i="development";function s(a,o,l,c){let u=new RegExp(`@${o}(?![a-z])`,"g"),d=new RegExp(`@${l}(?![a-z])`,"g"),h=new RegExp(`^@${o}(?![a-z])`),p=new RegExp(`^@${l}(?![a-z])`),f=a,m=!0;while(m){m=!1,u.lastIndex=0;let y=u.exec(f);if(!y)break;let g=y.index,v=g+y[0].length;if(o==="env"){let C=f.substring(v).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!C)break;v+=C[0].length,c=i===C[2]}let w=1,b=v,S=-1;while(w>0&&b<f.length){u.lastIndex=b,d.lastIndex=b;let C=u.exec(f),D=d.exec(f),I=C?C.index:1/0,O=D?D.index:1/0;if(I<O)w++,b=I+C[0].length;else if(O<1/0){if(w--,w===0){S=O;break}b=O+D[0].length}else break}if(S===-1){console.warn(`[stx] @${o} directive at position ${g} has no matching @${l} \u2014 the block was skipped.`);break}let x=f.substring(v,S),_=-1,E=0,k=0;while(k<x.length){let C=x.indexOf("@",k);if(C===-1)break;let D=x.substring(C);if(h.test(D)){E++,k=C+1;continue}if(p.test(D)){E--,k=C+1;continue}if(E===0&&/^@else(?![a-z])/.test(D)){_=C;break}k=C+1}let A;if(_!==-1){let C=x.slice(0,_),D=x.slice(_+5);A=c?C:D}else A=c?x:"";let T=`@${l}`.length;f=f.substring(0,g)+A+f.substring(S+T),m=!0}return f}return n=s(n,"env","endenv",!1),n=s(n,"production","endproduction",i==="production"),n=s(n,"development","enddevelopment",i==="development"),n=s(n,"staging","endstaging",i==="staging"),n=s(n,"testing","endtesting",i==="testing"),n}var zo=R(()=>{cS(),kt(),to(),Se()});function Yl(e=16){let t=new Uint8Array(e);return crypto.getRandomValues(t),btoa(String.fromCharCode(...t))}function Hn(e,t){if(!e)return t?.nonceGenerator?.()??Yl();let r=Ys.get(e);if(!r)r=t?.nonceGenerator?.()??Yl(),Ys.set(e,r);return r}function hS(e,t){let r=[];for(let[n,i]of Object.entries(e)){if(i===void 0||i===null)continue;if(typeof i==="boolean"){if(i)r.push(n);continue}if(Array.isArray(i)){let s=[...i];if(t&&(n==="script-src"||n==="style-src"))s=s.filter((a)=>!a.startsWith("'nonce-")),s.push(`'nonce-${t}'`);if(s.length>0)r.push(`${n} ${s.join(" ")}`)}}return r.join("; ")}function Xf(e,t){return`<meta http-equiv="Content-Security-Policy" content="${hS(e,t).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function mS(e,t,r){if(!t.enabled||!t.addMetaTag)return e;if(e.includes('http-equiv="Content-Security-Policy"'))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let n=t.useNonce?Hn(r,t):void 0,i=Xf(t.directives,n);return e.replace(/<head([^>]*)>/,`<head$1>
12205
- ${i}`)}function gS(e,t){let r=e;return r=r.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(n,i)=>{if(i.includes("nonce="))return n;return`<script nonce="${t}"${i}>`}),r=r.replace(/<style([^>]*)>/gi,(n,i)=>{if(i.includes("nonce="))return n;return`<style nonce="${t}"${i}>`}),r}function yS(e,t,r,n){let i=e,s=n.csp;if(i=i.replace(/@csp\b/g,()=>{if(!s?.enabled||!s.directives)return"<!-- CSP not configured -->";let a=s.useNonce?Hn(t,s):void 0;return Xf(s.directives,a)}),i=i.replace(/@cspNonce\b/g,()=>{if(!s?.enabled||!s.useNonce)return"";return Hn(t,s)}),s?.enabled&&s.useNonce)t.cspNonce=Hn(t,s);return i}var Ys,vS=R(()=>{Ys=new WeakMap});function bS(e=kS){let t=wS.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e);return Ks=t,t}function xS(){if(!Ks)bS();return Ks}function SS(e=eh){let t=xS();return`<input type="hidden" name="${e}" value="${t}">`}function _S(e){return e.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(t,r,n)=>{return SS(n||eh)})}var kS=40,eh="_token",Ks=null,ES=()=>{};async function AS(e,t,r,n){if(!n.customDirectives||n.customDirectives.length===0)return e;let i=e;for(let s of n.customDirectives){if(!s.name||typeof s.handler!=="function"){if(n.debug)console.warn("Invalid custom directive:",s);continue}if(s.hasEndTag)i=await CS(i,s,t,r,n);else i=await TS(i,s,t,r,n)}return i}async function CS(e,t,r,n,i){let{name:s,handler:a}=t,o=`@${s}`,l=`@end${s}`,c=e,u=ti(`${o}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${l}`,"g"),d=[],h=u.exec(c);while(h!==null){let[p,f="",m=""]=h,y=h.index||0;try{let g=f?th(f):[],v=m.trim(),w=await a(v,g,r,n);d.push({original:p,processed:w,startIndex:y})}catch(g){let v=g instanceof Error?g.message:String(g);if(i.debug)console.error(`Error processing custom directive @${s}:`,g);d.push({original:p,processed:oe("CustomDirective",`Error in @${s}${f?`(${f})`:""}: ${v}`,re.EVALUATION_ERROR),startIndex:y})}h=u.exec(c)}for(let p=d.length-1;p>=0;p--){let{original:f,processed:m}=d[p];c=c.replace(f,m)}return c}async function TS(e,t,r,n,i){let{name:s,handler:a}=t,o=e,l=ti(`@${s}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),c=[],u=l.exec(o);while(u!==null){let[p,f=""]=u,m=u.index||0;try{let y=th(f),g=await a("",y,r,n);c.push({original:p,processed:g,startIndex:m})}catch(y){let g=y instanceof Error?y.message:String(y);if(i.debug)console.error(`Error processing custom directive @${s}:`,y);c.push({original:p,processed:oe("CustomDirective",`Error in @${s}(${f}): ${g}`,re.EVALUATION_ERROR),startIndex:m})}u=l.exec(o)}let d=ti(`@${s}(?!\\w)(?!\\s*\\()`,"g"),h=d.exec(o);while(h!==null){let[p]=h,f=h.index||0;try{let m=await a("",[],r,n);c.push({original:p,processed:m,startIndex:f})}catch(m){let y=m instanceof Error?m.message:String(m);if(i.debug)console.error(`Error processing custom directive @${s}:`,m);c.push({original:p,processed:oe("CustomDirective",`Error in @${s}: ${y}`,re.EVALUATION_ERROR),startIndex:f})}h=d.exec(o)}for(let p=c.length-1;p>=0;p--){let{original:f,processed:m}=c[p];o=o.replace(f,m)}return o}function th(e){if(!e.trim())return[];let t=[],r="",n=!1,i="";for(let s=0;s<e.length;s++){let a=e[s];if((a==='"'||a==="'")&&(s===0||e[s-1]!=="\\"))if(!n)n=!0,i=a;else if(a===i)n=!1;else r+=a;else if(a===","&&!n)t.push(r.trim()),r="";else r+=a}if(r.trim())t.push(r.trim());return t.map((s)=>{let a=s.trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))return a.substring(1,a.length-1);return a})}var RS=R(()=>{kt(),hn()});function It(e,t){if(typeof e!=="string"||e.length===0)throw Error(`@appearanceBootstrap ${t} must be a non-empty string`)}function IS(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("@appearanceBootstrap expects an options object");let t=e,r=t.appearance,n=t.colorMode;if(It(t.storageKey,"storageKey"),!r||typeof r!=="object"||Array.isArray(r))throw Error("@appearanceBootstrap appearance must be an object");if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap colorMode must be an object");if(It(r.key,"appearance.key"),It(r.attribute,"appearance.attribute"),It(r.default,"appearance.default"),It(n.key,"colorMode.key"),It(n.attribute,"colorMode.attribute"),It(n.default,"colorMode.default"),!Qs.test(r.key)||!Qs.test(n.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Zs.test(r.attribute)||!Zs.test(n.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(r.allowed)||r.allowed.length===0||r.allowed.some((i)=>typeof i!=="string"||i.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!r.allowed.includes(r.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!rh.has(n.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:t.storageKey,appearance:{key:r.key,attribute:r.attribute,allowed:[...new Set(r.allowed)],default:r.default},colorMode:{key:n.key,attribute:n.attribute,default:n.default}}}function OS(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function jS(e){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${OS(e)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function DS(e,t){let r=1,n=null,i=!1;for(let s=t+1;s<e.length;s++){let a=e[s];if(i){i=!1;continue}if(n){if(a==="\\")i=!0;else if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="(")r++;else if(a===")"&&--r===0)return s}return-1}function $S(e,t){let r=e,n=/@appearanceBootstrap\s*\(/g,i;while((i=n.exec(r))!==null){let s=i.index+i[0].length-1,a=DS(r,s);if(a===-1)throw Error("@appearanceBootstrap has an unclosed options object");let o=r.slice(s+1,a).trim(),l=pe(`(${o})`,t),c=jS(IS(l));r=r.slice(0,i.index)+c+r.slice(a+1),n.lastIndex=i.index+c.length}return r}var Zs,Qs,rh,LS=R(()=>{Se(),Zs=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Qs=/^[A-Za-z_$][\w$]*$/,rh=new Set(["light","dark","system"])});function ue(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function En(e,t,r,n){let i=e||t;return r?`${i} ${n}`:i}function qe(e){return String(e).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function ir(e,t){if(/\bid\s*=/i.test(e))return"";return` id="${ue(t)}"`}function as(e,t,r){if(!t)return"";let n="";if(!/\baria-invalid\s*=/i.test(r))n+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(r))n+=` aria-describedby="${ue(`${qe(e)}-error`)}"`;return n}function PS(){return NS.randomUUID()}function Xs(e,t){let r=e;return r=r.replace(/@csrf/g,()=>{if(!t.csrf||typeof t.csrf!=="object"){let n=PS();t.csrf={token:n}}if(t.csrf.field)return t.csrf.field;if(t.csrf.token)return`<input type="hidden" name="_token" value="${ue(t.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),r=r.replace(/@method\(['"]([^'"]+)['"]\)/g,(n,i)=>{let s=i.toUpperCase();if(i&&!["GET","POST"].includes(s))return`<input type="hidden" name="_method" value="${ue(s)}">`;return n}),r}function MS(e,t,r=Fo){let n=e;return n=n.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(i,s,a,o,l,c="")=>{let u=s||a||"POST",d=o||l||"",h=mt(c),p=u.toUpperCase(),f=["GET","POST"].includes(p)?p:"POST",m=`<form method="${ue(f)}" action="${ue(d)}"${h?` ${h}`:""}>`;if(m+=`
12206
- ${Xs("@csrf",t)}`,!["GET","POST"].includes(p))m+=`
12207
- ${Xs(`@method('${p}')`,t)}`;return m}),n=n.replace(/@endform/g,"</form>"),n=n.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(i,s,a,o,l,c="")=>{let u=s||a||"",d=o||l||"",h=mt(c),p=Br(u,t),f=p!==void 0&&p!==null?p:d||"",m=h.match(/type=['"]([^'"]+)['"]/i),y=m?m[1]:"text",g=Ur(u,t),v=h.match(/class=['"]([^'"]+)['"]/i),w=En(v?v[1]:"",r.input,g,r.inputError),b=h.replace(/class=['"][^'"]+['"]/i,"");return b=b.replace(/type=['"][^'"]+['"]/i,""),`<input type="${ue(y)}" name="${ue(u)}"${ir(h,qe(u))} value="${ue(f)}" class="${w}"${as(u,g,h)}${b?` ${b}`:""}>`}),n=n.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(i,s,a="",o="")=>{let l=mt(a),c=Br(s,t)||o.trim(),u=Ur(s,t),d=l.match(/class=['"]([^'"]+)['"]/i),h=En(d?d[1]:"",r.input,u,r.inputError),p=l.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${ue(s)}"${ir(l,qe(s))} class="${h}"${as(s,u,l)}${p?` ${p}`:""}>${ue(c)}</textarea>`}),n=n.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(i,s,a="",o)=>{let l=mt(a),c=Br(s,t),u=Ur(s,t),d=l.match(/class=['"]([^'"]+)['"]/i),h=En(d?d[1]:"",r.input,u,r.inputError),p=l.replace(/class=['"][^'"]+['"]/i,""),f=o;if(c!==void 0)f=o.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(m,y,g)=>{if((Array.isArray(c)?c.some((v)=>String(v)===g):String(c)===g)&&!y.includes("selected"))return y.replace(/(<option)/,"$1 selected");return m});return`<select name="${ue(s)}"${ir(l,qe(s))} class="${h}"${as(s,u,l)}${p?` ${p}`:""}>${f}</select>`}),n=n.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(i,s,a,o="")=>{let l=a===void 0?"1":a,c=a===void 0?qe(s):`${qe(s)}-${qe(l)}`,u=mt(o),d=Br(s,t),h=d!==void 0&&(Array.isArray(d)?d.some((y)=>String(y)===l):d===!0||String(d)===l),p=u.match(/class=['"]([^'"]+)['"]/i),f=p?p[1]:r.checkInput,m=u.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${ue(s)}"${ir(u,c)} value="${ue(l)}" class="${f}"${h?" checked":""}${m?` ${m}`:""}>`}),n=n.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(i,s,a,o="")=>{let l=mt(o),c=Br(s,t),u=c!==void 0&&c===a,d=l.match(/class=['"]([^'"]+)['"]/i),h=d?d[1]:r.checkInput,p=l.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${ue(s)}"${ir(l,`${qe(s)}-${qe(a)}`)} value="${ue(a)}" class="${h}"${u?" checked":""}${p?` ${p}`:""}>`}),n=n.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(i,s,a="")=>{let o=mt(a),l=o.match(/accept=['"]([^'"]+)['"]/i),c=l?l[1]:"",u=o.includes("multiple"),d=Ur(s,t),h=o.match(/class=['"]([^'"]+)['"]/i),p=En(h?h[1]:"",r.input,d,r.inputError),f=o.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),m=[`<input type="file" name="${ue(s)}"${ir(o,qe(s))}`,`class="${p}"`];if(c)m.push(`accept="${ue(c)}"`);if(u)m.push("multiple");if(f)m.push(f);return`${m.join(" ")}>`}),n=n.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(i,s,a="",o)=>{let l=mt(a),c=l.match(/class=['"]([^'"]+)['"]/i),u=c?c[1]:r.label,d=l.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${ue(qe(s))}" class="${u}"${d?` ${d}`:""}>${o}</label>`}),n}function BS(e,t,r=Fo){return e.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(n,i,s)=>{try{if(Ur(i,t)){let a=s.replace(/\{\{([^}]+)\}\}/g,(o,l)=>{try{if(l.trim()==="$message"||l.trim()==="message")return Kl(i,t);if(l.trim().includes("errors.first")||l.trim().includes("$errors.first")){if(typeof t.errors?.first==="function")return t.errors.first(i);return Kl(i,t)}let c=l.trim();if(xe(c)){let u=pe(c,t);return u!==void 0?String(u):c}return c}catch{return l}});return`<div id="${ue(`${qe(i)}-error`)}" role="alert">${a}</div>`}return""}catch(a){return console.error("Error processing @error directive:",a),n}})}function Ur(e,t){if(!t.errors)return!1;if(typeof t.errors.has==="function")return t.errors.has(e);if(typeof t.errors==="object")return Object.prototype.hasOwnProperty.call(t.errors,e);return!1}function Kl(e,t){if(!t.errors)return"";if(typeof t.errors.get==="function")return t.errors.get(e);if(typeof t.errors==="object"&&Object.prototype.hasOwnProperty.call(t.errors,e)){let r=t.errors[e];return Array.isArray(r)?r[0]:String(r)}return""}function Br(e,t){let r;if(t.old&&typeof t.old==="function")return t.old(e);if(t.old&&typeof t.old==="object")return t.old[e];if(e.endsWith("[]")){let n=e.slice(0,-2);if(r=t[n],r!==void 0)return r}return t[e]}function mt(e){if(!e.trim())return"";let t=[],r=e.trim(),n=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,i;while((i=n.exec(r))!==null){let[,s,,a]=i;t.push(`${s}="${a.trim()}"`)}return t.join(" ")}var Fo,zS=R(()=>{Se(),Fo={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});async function FS(){if(zr!==void 0)return zr;try{zr=(await import("./chunk-ex890p45.js")).loadLocale??null}catch{zr=null}return zr}function qS(e,t=0){if(t<=0)return!1;return Date.now()-e.loadedAt>t}async function WS(e,t){if({...Gi,...t.i18n}.cache&&hi[e]){let n=hi[e],i=t.i18n?.cacheMaxAge??0;if(!qS(n,i))return n.translations}if(dr[e]?.state==="loading")return dr[e].promise;Un[e]="loading";let r=ta(e,t).then((n)=>{return Un[e]="loaded",delete dr[e],n}).catch((n)=>{throw Un[e]="error",dr[e]={promise:r,state:"error",error:n instanceof Error?n:Error(String(n))},n});return dr[e]={promise:r,state:"loading"},r}async function ta(e,t){let r={...Gi,...t.i18n},n=ea.isAbsolute(r.translationsDir)?r.translationsDir:ea.resolve(t.root||process.cwd(),r.translationsDir);try{let i=await FS(),s=i?await i(e,{translationsDir:n,defaultLocale:r.defaultLocale,sources:JS(r.format)}):await HS(e,r,n);if(s===void 0){if(e!==r.defaultLocale)return ta(r.defaultLocale,t);return{}}let a=s;if(r.cache)hi[e]={translations:a,loadedAt:Date.now(),locale:e};return a}catch(i){if(t.debug)console.error(`Error loading translation file for locale "${e}":`,i);if(e!==r.defaultLocale)return ta(r.defaultLocale,t);return{}}}async function HS(e,t,r){let n=ea.join(r,`${e}${US(t.format)}`);try{let i=await import(n);return i.default||i}catch(i){try{let s=await Bun.file(n).text();if(t.format==="yaml"||t.format==="yml")return GS(s);if(t.format==="json")return JSON.parse(s);throw i}catch{return}}}function US(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function GS(e){let t={},r=e.split(`
12208
- `),n=[{obj:t,indent:-1}];for(let i of r){let s=i.replace(/#.*$/,"").trimEnd();if(!s.trim())continue;let a=s.search(/\S/);if(a===-1)continue;while(n.length>1&&n[n.length-1].indent>=a)n.pop();let o=n[n.length-1].obj,l=s.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(l){let[,,c,u]=l,d=c.trim(),h=u.trim();if(h==="")o[d]={},n.push({obj:o[d],indent:a});else o[d]=VS(h)}}return t}function VS(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let t=e.toLowerCase();if(t==="true"||t==="yes")return!0;if(t==="false"||t==="no")return!1;if(t==="null"||t==="~")return null;let r=Number(e);if(!Number.isNaN(r)&&e!=="")return r;return e}function JS(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function YS(e,t){return WS(e,t)}function KS(e,t){for(let r of e){let n=r.trim(),i=n.match(/^\{(\d+)\}\s*(.*)$/);if(i){let a=Number.parseInt(i[1],10);if(t===a)return i[2];continue}let s=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(s){let a=Number.parseInt(s[1],10),o=s[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(s[2],10);if(t>=a&&t<=o)return s[3];continue}}if(e.length===2)return t===1?e[0].trim():e[1].trim();if(t<e.length)return e[t].trim();return e[e.length-1].trim()}function ZS(e,t={}){return nh(e,t)}function nh(e,t){let r="",n=0;while(n<e.length)if(e[n]==="{"){let i=QS(e,n);if(i===-1){r+=e[n],n++;continue}let s=e.slice(n+1,i);r+=XS(s,t),n=i+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")r+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")r+=e[n+1],n+=2;else r+=e[n],n++;else r+=e[n],n++;return r}function QS(e,t){let r=0;for(let n=t;n<e.length;n++)if(e[n]==="{")r++;else if(e[n]==="}"){if(r--,r===0)return n}return-1}function XS(e,t){let r=e_(e);if(r.length===0)return`{${e}}`;let n=r[0].trim(),i=t[n];if(r.length===1)return i!==void 0?String(i):`{${n}}`;switch(r[1].trim().toLowerCase()){case"plural":return t_(i,r.slice(2).join(","),t);case"select":return n_(i,r.slice(2).join(","));case"selectordinal":return i_(i,r.slice(2).join(","));case"number":return a_(i,r[2]?.trim());case"date":return o_(i,r[2]?.trim());case"time":return l_(i,r[2]?.trim());default:return i!==void 0?String(i):`{${e}}`}}function e_(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let s=e[i];if(s==="{")n++,r+=s;else if(s==="}")n--,r+=s;else if(s===","&&n===0)t.push(r),r="";else r+=s}if(r)t.push(r);return t}function t_(e,t,r){let n=Number(e)||0,i=qo(t),s=`=${n}`;if(i[s])return os(i[s],n,r);let a=r_(n);if(i[a])return os(i[a],n,r);if(i.other)return os(i.other,n,r);return String(n)}function os(e,t,r){let n=e.replace(/#/g,String(t));return nh(n,r)}function r_(e){let t=Math.abs(e),r=Math.floor(t),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(r===1&&n===0)return"one";return"other"}function n_(e,t){let r=String(e||""),n=qo(t);if(n[r])return n[r];return n.other||String(e)}function i_(e,t){let r=Number(e)||0,n=qo(t),i=s_(r);if(n[i])return n[i].replace(/#/g,String(r));if(n.other)return n.other.replace(/#/g,String(r));return String(r)}function s_(e){let t=Math.abs(e),r=t%10,n=t%100;if(r===1&&n!==11)return"one";if(r===2&&n!==12)return"two";if(r===3&&n!==13)return"few";return"other"}function qo(e){let t={},r=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=r.exec(e);while(n!==null)t[n[1]]=n[2],n=r.exec(e);return t}function a_(e,t){let r=Number(e);if(Number.isNaN(r))return String(e);switch(t){case"integer":return Math.floor(r).toLocaleString();case"percent":return`${(r*100).toFixed(0)}%`;case"currency":return r.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return r.toLocaleString()}}function o_(e,t){let r=e instanceof Date?e:new Date(String(e));if(Number.isNaN(r.getTime()))return String(e);let n={};switch(t){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return r.toLocaleDateString(void 0,n)}function l_(e,t){let r=e instanceof Date?e:new Date(String(e));if(Number.isNaN(r.getTime()))return String(e);let n={};switch(t){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return r.toLocaleTimeString(void 0,n)}function c_(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function Zl(e,t,r=!0,n={}){let i=e.split("."),s=t;for(let o of i){if(s===void 0||s===null)break;s=s[o]}if(s===void 0||s===null)return r?e:"";let a=String(s);if(c_(a))return ZS(a,n);if(a.includes("|")&&"count"in n){let o=Number(n.count),l=a.split("|");a=KS(l,o)}for(let[o,l]of Object.entries(n)){let c=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp(`:${c}`,"g"),String(l))}return a}async function u_(e,t,r,n){let i=e,s=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,a={...Gi,...n.i18n},o=await YS(a.locale,n);t.__translations=o,t.__locale=a.locale,t.__i18nConfig=a,i=await Ql(i,s,async(c,u,d,h,p)=>{try{let f={};if(d)try{let m=[()=>JSON.parse(d),()=>{let y=`{"data":${d}}`,g=JSON.parse(y);return typeof g.data==="object"?g.data:{}},()=>{return Ye(d,t)}];for(let y of m)try{if(f=y(),Object.keys(f).length>0)break}catch{}}catch(m){if(n.debug)console.error("Error parsing parameters for @translate directive:",m)}return Zl(u,o,a.fallbackToKey,f)||h.trim()}catch(f){if(n.debug)console.error("Error processing @translate directive:",f);return oe("Translate",`Error in @translate('${u}'): ${f instanceof Error?f.message:String(f)}`,re.EVALUATION_ERROR)}});let l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${i.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let c=[...i.matchAll(l)];console.warn(`Found ${c.length} @translate matches`),c.forEach((u,d)=>console.warn(`Match ${d}: ${u[0]}, Key: ${u[1]}, Params: ${u[2]||"none"}`))}return i=await Ql(i,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(c,u,d,h)=>{try{let p={};if(d)try{let f=[()=>JSON.parse(d),()=>{let m=`{"data":${d}}`,y=JSON.parse(m);return typeof y.data==="object"?y.data:{}},()=>{return Ye(d,t)}];for(let m of f)try{if(p=m(),Object.keys(p).length>0)break}catch{}}catch(f){if(n.debug)console.error("Error parsing parameters for @translate directive:",f)}return Zl(u,o,a.fallbackToKey,p)}catch(p){if(n.debug)console.error("Error processing @translate directive:",p);return oe("Translate",`Error in @translate('${u}'): ${p instanceof Error?p.message:String(p)}`,re.EVALUATION_ERROR)}}),i}async function Ql(e,t,r){let n=[];return e.replace(t,(i,...s)=>{let a=r(i,...s).then((o)=>({match:i,replacement:o}));return n.push(a),i}),(await Promise.all(n)).reduce((i,{match:s,replacement:a})=>i.replace(s,a),e)}var zr,Gi,hi,dr,Un,d_=R(()=>{kt(),Se(),Gi={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},hi={},dr={},Un={}}),Wo={};Y(Wo,{streamingSuspenseDirective:()=>Uo,streamToResponse:()=>S_,streamTemplateSimple:()=>v_,streamTemplate:()=>f_,renderStreamingPage:()=>m_,registerStreamingDirectives:()=>b_,processStreamDirectives:()=>g_,processSectionDirectives:()=>x_,islandDirective:()=>Go,generateHydrationRuntime:()=>__,extractStreamBoundaries:()=>y_,createStreamRenderer:()=>w_,buildSuspenseResolveScript:()=>Ho,SUSPENSE_RESOLVER_RUNTIME:()=>ih});function p_(e){let t=[],r=0,n;ra.lastIndex=0;while((n=ra.exec(e))!==null){if(n.index>r){let a=e.slice(r,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let i=n[1],s=n[2];t.push({type:"suspense",name:i,content:s}),r=n.index+n[0].length}if(r<e.length){let i=e.slice(r);if(i.trim())t.push({type:t.length===0?"shell":"content",content:i})}if(t.length===0)t.push({type:"shell",content:e});return t}async function f_(e,t={},r={}){let n={...Vt,...r,streaming:{...Vi,...r.streaming}},i=n.streaming?.bufferSize||16384;return new ReadableStream({async start(s){try{let a=await Bun.file(e).text(),o=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=o?o[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:mi.dirname(e)};if(l.trim())await on(l,u,e);let d=p_(c),h=new Set;if(!d.some((p)=>p.type==="suspense")){let p=n.streaming?.strategy||"auto",f=new RegExp(bt.source,"g");if(!(p!=="manual"&&f.test(c))){let m=await me(c,u,e,n,h);for(let y=0;y<m.length;y+=i)s.enqueue(m.slice(y,y+i)),await new Promise((g)=>setTimeout(g,0))}else{let m=[],y=new RegExp(bt.source,"g"),g;while((g=y.exec(c))!==null)m.push({name:g[1],content:g[2],start:g.index,end:g.index+g[0].length});let v=0;for(let w of m){if(w.start>v){let S=c.slice(v,w.start);if(S.trim()){let x=await me(S,u,e,n,h);s.enqueue(x),await new Promise((_)=>setTimeout(_,0))}}let b=await me(w.content,u,e,n,h);s.enqueue(b),await new Promise((S)=>setTimeout(S,0)),v=w.end}if(v<c.length){let w=c.slice(v);if(w.trim()){let b=await me(w,u,e,n,h);s.enqueue(b)}}}}else{let p=new Map;for(let m of d)if(m.type==="shell"||m.type==="content"){let y=await me(m.content,u,e,n,h);s.enqueue(y)}else if(m.type==="suspense"&&m.name){let y=`stx-suspense-${m.name}`;s.enqueue(`<div id="${y}" data-suspense="${m.name}" style="display:contents;">
12203
+ </script>`}function X0(e,t,r){if(Kf=0,!tS(e))return e;let n=V0(e);if(n.length===0)return e;let i=eS(e,n),s=Q0(n,t),a=i.lastIndexOf("</body>");if(a!==-1)i=i.slice(0,a)+s+`
12204
+ `+i.slice(a);else i+=s;return i}function eS(e,t){let r=0,n=e.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(i,s,a)=>{let o=t[r++];if(!o)return i;let l=/data-stx-scope="([^"]*)"/.exec(a);if(l)return o.id=l[1],o.selector=`[data-stx-scope="${o.id}"]`,i;return`<${s} data-stx-scope="${o.id}"${a}>`});return n=n.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),n=n.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),n=n.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),n=n.replace(/\s*x-init\s*=\s*'[^']*'/g,""),n}function tS(e){return/x-data\s*=\s*["']/.test(e)}var Kf=0,rS=0,nS=R(()=>{dt()});async function sS(e,t={}){try{if(!await X(e))throw Error(`Markdown file not found: ${e}`);let r=(await iS.promises.stat(e)).mtime.getTime();if(t.cache&&Hn.has(e)){let c=Hn.get(e);if(c.updatedAt>=r)return{content:c.content,data:c.data}}let n=await Bun.file(e).text(),{data:i,content:s}=yy(n),a=t.markdown||Hi.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},o=Ta(s,{gfm:!0});if(a.syntaxHighlighting?.enabled&&a.syntaxHighlighting?.serverSide)o=await aS(o,a.syntaxHighlighting?.defaultTheme||"github-dark",a.syntaxHighlighting?.highlightUnknownLanguages||!1);let l={content:o,data:i||{}};if(t.cache)Hn.set(e,{...l,updatedAt:r});return l}catch(r){if(t.debug)console.error(`Error reading/parsing markdown file ${e}:`,r);let n=r instanceof Error?r.message:String(r);return{content:Ce("Markdown File",`Error reading/parsing markdown file: ${n}`,e,"",0,""),data:{}}}}async function aS(e,t,r){let n=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!En)try{En=await zc({theme:t||"github-dark",cache:!0})}catch(o){return console.error("Failed to initialize ts-syntax-highlighter:",o),e}let i=async(o,l,c,u)=>{let d=u.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),h=c||(r?"text":"");if(!h)return o;try{if(!En.getSupportedLanguages().includes(h))return o;return(await En.highlight(d,h,{theme:t})).html}catch(p){console.error(`Error highlighting code block with language ${c}:`,p)}return o},s=e,a=e.matchAll(n);for(let o of a){let[l,c,u,d]=o,h=await i(l,c,u,d);s=s.replace(l,h)}return s}async function oS(e,t,r="",n={}){return await lS(e,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(i,s,a,o)=>{try{let l=s;if(!as.isAbsolute(s))l=as.resolve(as.dirname(r),s);let c={};if(a)try{try{c=JSON.parse(a)}catch{if(n.debug)console.warn("Using safer alternative for parsing JS object literal");let m=a.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let y of m){let g=y.indexOf(":");if(g>0){let v=y.substring(0,g).trim(),w=y.substring(g+1).trim(),b=w.startsWith('"')&&w.endsWith('"'),S=w.startsWith("'")&&w.endsWith("'");if(b||S)w=w.substring(1,w.length-1);c[v]=w}}}}catch(m){if(n.debug)console.error("Error parsing context in @markdown-file directive:",m)}let{content:u,data:d}=await sS(l,n),h={...t,...d,...c},p=u,f=/\{\{([^}]+)\}\}/g;return p=p.replace(f,(m,y)=>{let g=y.trim();return h[g]!==void 0?String(h[g]):m}),p}catch(l){let c=l instanceof Error?l.message:String(l);return Ce("Markdown File",`Error including markdown file: ${c}`,r,e,o,i)}})}async function lS(e,t,r){let n=[],i;while((i=t.exec(e))!==null){let o=i[0],l=i.index,c=i;n.push(r(...c).then((u)=>({match:o,replacement:u,index:l})))}let s=await Promise.all(n);s.sort((o,l)=>l.index-o.index);let a=e;for(let{match:o,replacement:l}of s)a=a.replace(o,()=>l);return a}var Hn,En=null,cS=R(()=>{At(),Te(),Hn=new Map});function Lt(e,t){try{let r=e.trim();if(Se(r))return ye(r,Object.keys(t))(...Object.values(t));else return fe(r,t)}catch{return!1}}var uS=R(()=>{_e()});function dS(e,t,r){let n=e,i=!0;while(i){i=!1;let s=n.match(/@switch\s*\(/);if(!s||s.index===void 0)break;let a=s.index,o=dw(n,a);if(!o)break;try{let l;if(Se(o.expression))l=ye(o.expression,Object.keys(t))(...Object.values(t));else l=fe(o.expression,t);let c="",u=!1;for(let d of o.cases)if(d.type==="default"){if(!u)c=d.content.trim()}else try{let h;if(d.value&&Se(d.value))h=ye(d.value,Object.keys(t))(...Object.values(t));else if(d.value)h=fe(d.value,t);if(l===h){c=d.content.trim(),u=!0;break}}catch{continue}n=n.substring(0,a)+c+n.substring(o.end),i=!0}catch(l){let c=l instanceof Error?l.message:String(l),u=le("Switch",`Error evaluating @switch expression: ${c}`,ne.EVALUATION_ERROR);n=n.substring(0,a)+u+n.substring(o.end);break}}return n}function pS(e){let t=[];return{masked:e.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(r)=>(t.push(r),`\x00stx-script-${t.length-1}\x00`)),scripts:t}}function fS(e,t){if(t.length===0)return e;return e.replace(/\u0000stx-script-(\d+)\u0000/g,(r,n)=>t[Number(n)]??r)}function Gi(e,t,r){let{masked:n,scripts:i}=pS(e);return fS(hS(n,t,r),i)}function hS(e,t,r){let n=e;n=dS(n,t,r);{let s=!0;while(s){s=!1;let a=n.match(/@unless\s*\(/);if(!a||a.index===void 0)break;let o=a.index,l=Ir(n,o+7);if(!l)break;let c=l.endPos,u=yn(n,"unless","endunless",c);if(u===-1){console.warn(`[stx] @unless directive at position ${o} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let d=n.slice(c,u),h=l.expression,p=-1;{let m=0,y=/@(?:if|unless)\s*\(/g,g=/@(?:endif|endunless)(?![a-z])/g,v=/@else(?![a-z])/g,w=[],b;while((b=y.exec(d))!==null)w.push({pos:b.index,type:"open"});while((b=g.exec(d))!==null)w.push({pos:b.index,type:"close"});while((b=v.exec(d))!==null)w.push({pos:b.index,type:"else"});w.sort((S,x)=>S.pos-x.pos);for(let S of w)if(S.type==="open")m++;else if(S.type==="close")m--;else if(S.type==="else"&&m===0){p=S.pos;break}}let f;if(p!==-1){let m=d.slice(0,p),y=d.slice(p+5);f=`@if (${h})${y}@else ${m}@endif`}else f=`@if (!(${h}))${d}@endif`;n=n.substring(0,o)+f+n.substring(u+10),s=!0}}n=Qf(n,t,r),n=Xf(n,t,r),n=Zf(n,t);let i=()=>{let s=Ud(n);if(s.length===0)return!1;for(let a=s.length-1;a>=0;a--){let o=s[a];try{let l="",c=!1;for(let u of o.branches){if(c)break;if(u.type==="else")l=u.content,c=!0;else try{let d;if(u.condition&&Se(u.condition))d=ye(u.condition,Object.keys(t))(...Object.values(t));else if(u.condition)d=fe(u.condition,t);if(d)l=u.content,c=!0}catch(d){l=le(u.type==="if"?"If":"Elseif",`Error in @${u.type}(${u.condition}): ${d instanceof Error?d.message:String(d)}`,ne.EVALUATION_ERROR),c=!0}}n=n.substring(0,o.start)+l+n.substring(o.end)}catch(l){let c=l instanceof Error?l.message:String(l),u=le("If",`Error processing @if block: ${c}`,ne.EVALUATION_ERROR);n=n.substring(0,o.start)+u+n.substring(o.end)}}return!0};while(!0){let s=n;if(!i())break;if(n===s)break}return n}function Yl(e){let t=0;while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!=="(")return null;t++;while(t<e.length&&/\s/.test(e[t]))t++;let r=e[t];if(r!=="'"&&r!=='"')return null;t++;let n=[];while(t<e.length){let i=e[t];if(i==="\\"&&t+1<e.length){n.push(e[t+1]),t+=2;continue}if(i===r){t++;break}n.push(i),t++}while(t<e.length&&/\s/.test(e[t]))t++;if(e[t]!==")")return null;return t++,{value:n.join(""),consumed:t}}function Zf(e,t){let r=e;function n(o,l,c,u){let d=1,h=u,p=new RegExp(`@${l}(?:\\s*\\(|\\s|$)`,"g"),f=new RegExp(`@${c}(?![a-z])`,"g");while(h<o.length&&d>0){p.lastIndex=h,f.lastIndex=h;let m=p.exec(o),y=f.exec(o),g=m?m.index:1/0,v=y?y.index:1/0;if(g<v)d++,h=g+m[0].length;else if(v<1/0){if(d--,d===0)return v;h=v+y[0].length}else break}return-1}function i(o,l,c){let u=0,d=new RegExp(`@${l}(?:\\s*\\(|\\s|$)`,"g"),h=new RegExp(`@${c}(?![a-z])`,"g"),p=/@else(?![a-z])/g,f=[],m;while((m=d.exec(o))!==null)f.push({pos:m.index,type:"open"});while((m=h.exec(o))!==null)f.push({pos:m.index,type:"close"});while((m=p.exec(o))!==null)f.push({pos:m.index,type:"else"});f.sort((y,g)=>y.pos-g.pos);for(let y of f)if(y.type==="open")u++;else if(y.type==="close")u--;else if(y.type==="else"&&u===0)return y.pos;return-1}{let o=!0;while(o){o=!1;let l=r.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!l||l.index===void 0)break;let c=l.index,u,d,h=r.slice(c+5),p=Yl(h);if(p)u=p.value,d=c+5+p.consumed;else d=c+5;let f=n(r,"auth","endauth",d);if(f===-1){console.warn(`[stx] @auth directive at position ${c} has no matching @endauth \u2014 the block was skipped.`);break}let m=r.slice(d,f),y=i(m,"auth","endauth"),g;if(!t.auth)g=!1;else g=u?Lt(`auth?.check && auth?.user?.[${u}]`,t):Lt("auth?.check",t);let v;if(y!==-1){let w=m.slice(0,y),b=m.slice(y+5);v=g?w:b}else v=g?m:"";r=r.substring(0,c)+v+r.substring(f+8),o=!0}}{let o=!0;while(o){o=!1;let l=r.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!l||l.index===void 0)break;let c=l.index,u,d,h=r.slice(c+6),p=Yl(h);if(p)u=p.value,d=c+6+p.consumed;else d=c+6;let f=n(r,"guest","endguest",d);if(f===-1){console.warn(`[stx] @guest directive at position ${c} has no matching @endguest \u2014 the block was skipped.`);break}let m=r.slice(d,f),y=i(m,"guest","endguest"),g;if(!t.auth)g=!0;else g=u?Lt(`!auth?.check || !auth?.user?.[${u}]`,t):Lt("!auth?.check",t);let v;if(y!==-1){let w=m.slice(0,y),b=m.slice(y+5);v=g?w:b}else v=g?m:"";r=r.substring(0,c)+v+r.substring(f+9),o=!0}}function s(o,l,c){if(t.userCan&&typeof t.userCan[o]==="boolean")return t.userCan[o];if(t.permissions?.check&&typeof t.permissions.check==="function")try{let u=[o];if(l)u.push(l);if(c){let d=Lt(c,t);u.push(d)}return t.permissions.check(...u)}catch{return!1}return!1}function a(o){let l=o.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!l)return null;return{ability:l[1],type:l[2],id:l[3]?.trim(),paramsEnd:l[0].length}}for(let o of["can","cannot"]){let l=`end${o}`,c=o==="can"?"elsecan":"elsecannot",u=!0;while(u){u=!1;let d=r.match(new RegExp(`@${o}\\s*\\(`));if(!d||d.index===void 0)break;let h=d.index,p=r.slice(h+`@${o}`.length),f=a(p);if(!f)break;let m=h+`@${o}`.length+f.paramsEnd,y=n(r,o,l,m);if(y===-1){console.warn(`[stx] @${o} directive at position ${h} has no matching @${l} \u2014 the block was skipped.`);break}let g=r.slice(m,y),v=[],w=0,b=new RegExp(`@${o}\\s*\\(`,"g"),S=new RegExp(`@${l}(?![a-z])`,"g"),x=new RegExp(`@${c}\\s*\\(`,"g"),_=/@else(?![a-z])/g,E=[],k;while((k=b.exec(g))!==null)E.push({pos:k.index,type:"open"});while((k=S.exec(g))!==null)E.push({pos:k.index,type:"close"});while((k=x.exec(g))!==null)E.push({pos:k.index,type:"elseDirective"});while((k=_.exec(g))!==null)E.push({pos:k.index,type:"else"});E.sort((O,N)=>O.pos-N.pos);for(let O of E){if(O.type==="open"){w++;continue}if(O.type==="close"){w--;continue}if(w===0)v.push(O)}let A=[],T=0;for(let O=0;O<v.length;O++){let N=v[O];if(A.push({content:g.slice(T,N.pos),ability:void 0}),N.type==="elseDirective"){let P=g.slice(N.pos+`@${c}`.length),z=a(P);if(z){A[A.length-1]={content:g.slice(T,N.pos)},T=N.pos+`@${c}`.length+z.paramsEnd,A.push({content:"",ability:z.ability,type:z.type,id:z.id}),A.pop();let q=v[O+1],Z=q?q.pos:g.length;A.push({content:g.slice(T,Z),ability:z.ability,type:z.type,id:z.id}),T=Z}}else T=N.pos+5}if(T<g.length){let O=A[A.length-1];if(v.length>0&&v[v.length-1].type==="else")A.push({content:g.slice(T),isFinalElse:!0});else if(A.length===0)A.push({content:g.slice(T)})}let C=s(f.ability,f.type,f.id),D=o==="can"?C:!C,I="";if(D)I=A[0]?.content||"";else{let O=!1;for(let N=1;N<A.length;N++){let P=A[N];if(P.isFinalElse){I=P.content,O=!0;break}if(P.ability){let z=s(P.ability,P.type,P.id);if(o==="can"?z:!z){I=P.content,O=!0;break}}}if(!O&&A.length>0){let N=A[A.length-1];if(N.isFinalElse)I=N.content}}r=r.substring(0,h)+I+r.substring(y+`@${l}`.length),u=!0}}return r}function Qf(e,t,r){let n=e;function i(s,a,o,l,c){let u=!0;while(u){u=!1;let d=new RegExp(`@${a}\\s*\\(`),h=s.match(d);if(!h||h.index===void 0)break;let p=h.index,f=Ir(s,p+`@${a}`.length);if(!f)break;let m=f.endPos,y=yn(s,a,o,m);if(y===-1){console.warn(`[stx] @${a} directive at position ${p} has no matching @${o} \u2014 the block was skipped.`);break}let g=s.slice(m,y),v=f.expression,w=-1,b=0,S=0;while(S<g.length){let x=g.indexOf("@",S);if(x===-1)break;let _=g.substring(x);if(/^@(?:if|unless|isset|empty)\s*\(/.test(_)){b++,S=x+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(_)){b--,S=x+1;continue}if(b===0&&/^@else(?![a-z])/.test(_)){w=x;break}S=x+1}try{let x=l(v.trim()),_;if(w!==-1){let E=g.slice(0,w),k=g.slice(w+5);_=x?E:k}else _=x?g:"";s=s.substring(0,p)+_+s.substring(y+`@${o}`.length),u=!0}catch(x){let _=x instanceof Error?x.message:String(x),E=le(c,`Error processing @${a} directive: ${_}`,ne.EVALUATION_ERROR);s=s.substring(0,p)+E+s.substring(y+`@${o}`.length);break}}return s}return n=i(n,"isset","endisset",(s)=>{let a=Lt(s,t);return a!==void 0&&a!==null},"Isset"),n=i(n,"empty","endempty",(s)=>{let a=Lt(s,t);return a===void 0||a===null||a===""||a===0||a===!1||Array.isArray(a)&&a.length===0||typeof a==="object"&&a!==null&&Object.keys(a).length===0},"Empty"),n}function Xf(e,t,r){let n=e,i="development";function s(a,o,l,c){let u=new RegExp(`@${o}(?![a-z])`,"g"),d=new RegExp(`@${l}(?![a-z])`,"g"),h=new RegExp(`^@${o}(?![a-z])`),p=new RegExp(`^@${l}(?![a-z])`),f=a,m=!0;while(m){m=!1,u.lastIndex=0;let y=u.exec(f);if(!y)break;let g=y.index,v=g+y[0].length;if(o==="env"){let C=f.substring(v).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!C)break;v+=C[0].length,c=i===C[2]}let w=1,b=v,S=-1;while(w>0&&b<f.length){u.lastIndex=b,d.lastIndex=b;let C=u.exec(f),D=d.exec(f),I=C?C.index:1/0,O=D?D.index:1/0;if(I<O)w++,b=I+C[0].length;else if(O<1/0){if(w--,w===0){S=O;break}b=O+D[0].length}else break}if(S===-1){console.warn(`[stx] @${o} directive at position ${g} has no matching @${l} \u2014 the block was skipped.`);break}let x=f.substring(v,S),_=-1,E=0,k=0;while(k<x.length){let C=x.indexOf("@",k);if(C===-1)break;let D=x.substring(C);if(h.test(D)){E++,k=C+1;continue}if(p.test(D)){E--,k=C+1;continue}if(E===0&&/^@else(?![a-z])/.test(D)){_=C;break}k=C+1}let A;if(_!==-1){let C=x.slice(0,_),D=x.slice(_+5);A=c?C:D}else A=c?x:"";let T=`@${l}`.length;f=f.substring(0,g)+A+f.substring(S+T),m=!0}return f}return n=s(n,"env","endenv",!1),n=s(n,"production","endproduction",i==="production"),n=s(n,"development","enddevelopment",i==="development"),n=s(n,"staging","endstaging",i==="staging"),n=s(n,"testing","endtesting",i==="testing"),n}var Fo=R(()=>{uS(),Et(),ro(),_e()});function Kl(e=16){let t=new Uint8Array(e);return crypto.getRandomValues(t),btoa(String.fromCharCode(...t))}function Un(e,t){if(!e)return t?.nonceGenerator?.()??Kl();let r=Ks.get(e);if(!r)r=t?.nonceGenerator?.()??Kl(),Ks.set(e,r);return r}function mS(e,t){let r=[];for(let[n,i]of Object.entries(e)){if(i===void 0||i===null)continue;if(typeof i==="boolean"){if(i)r.push(n);continue}if(Array.isArray(i)){let s=[...i];if(t&&(n==="script-src"||n==="style-src"))s=s.filter((a)=>!a.startsWith("'nonce-")),s.push(`'nonce-${t}'`);if(s.length>0)r.push(`${n} ${s.join(" ")}`)}}return r.join("; ")}function eh(e,t){return`<meta http-equiv="Content-Security-Policy" content="${mS(e,t).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function gS(e,t,r){if(!t.enabled||!t.addMetaTag)return e;if(e.includes('http-equiv="Content-Security-Policy"'))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let n=t.useNonce?Un(r,t):void 0,i=eh(t.directives,n);return e.replace(/<head([^>]*)>/,`<head$1>
12205
+ ${i}`)}function yS(e,t){let r=e;return r=r.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(n,i)=>{if(i.includes("nonce="))return n;return`<script nonce="${t}"${i}>`}),r=r.replace(/<style([^>]*)>/gi,(n,i)=>{if(i.includes("nonce="))return n;return`<style nonce="${t}"${i}>`}),r}function vS(e,t,r,n){let i=e,s=n.csp;if(i=i.replace(/@csp\b/g,()=>{if(!s?.enabled||!s.directives)return"<!-- CSP not configured -->";let a=s.useNonce?Un(t,s):void 0;return eh(s.directives,a)}),i=i.replace(/@cspNonce\b/g,()=>{if(!s?.enabled||!s.useNonce)return"";return Un(t,s)}),s?.enabled&&s.useNonce)t.cspNonce=Un(t,s);return i}var Ks,wS=R(()=>{Ks=new WeakMap});function xS(e=ES){let t=bS.randomBytes(Math.ceil(e/2)).toString("hex").slice(0,e);return Zs=t,t}function SS(){if(!Zs)xS();return Zs}function _S(e=th){let t=SS();return`<input type="hidden" name="${e}" value="${t}">`}function kS(e){return e.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(t,r,n)=>_S(n||th))}var ES=40,th="_token",Zs=null,AS=()=>{};async function CS(e,t,r,n){if(!n.customDirectives||n.customDirectives.length===0)return e;let i=e;for(let s of n.customDirectives){if(!s.name||typeof s.handler!=="function"){if(n.debug)console.warn("Invalid custom directive:",s);continue}if(s.hasEndTag)i=await TS(i,s,t,r,n);else i=await RS(i,s,t,r,n)}return i}async function TS(e,t,r,n,i){let{name:s,handler:a}=t,o=`@${s}`,l=`@end${s}`,c=e,u=ri(`${o}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${l}`,"g"),d=[],h=u.exec(c);while(h!==null){let[p,f="",m=""]=h,y=h.index||0;try{let g=f?rh(f):[],v=m.trim(),w=await a(v,g,r,n);d.push({original:p,processed:w,startIndex:y})}catch(g){let v=g instanceof Error?g.message:String(g);if(i.debug)console.error(`Error processing custom directive @${s}:`,g);d.push({original:p,processed:le("CustomDirective",`Error in @${s}${f?`(${f})`:""}: ${v}`,ne.EVALUATION_ERROR),startIndex:y})}h=u.exec(c)}for(let p=d.length-1;p>=0;p--){let{original:f,processed:m}=d[p];c=c.replace(f,m)}return c}async function RS(e,t,r,n,i){let{name:s,handler:a}=t,o=e,l=ri(`@${s}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),c=[],u=l.exec(o);while(u!==null){let[p,f=""]=u,m=u.index||0;try{let y=rh(f),g=await a("",y,r,n);c.push({original:p,processed:g,startIndex:m})}catch(y){let g=y instanceof Error?y.message:String(y);if(i.debug)console.error(`Error processing custom directive @${s}:`,y);c.push({original:p,processed:le("CustomDirective",`Error in @${s}(${f}): ${g}`,ne.EVALUATION_ERROR),startIndex:m})}u=l.exec(o)}let d=ri(`@${s}(?!\\w)(?!\\s*\\()`,"g"),h=d.exec(o);while(h!==null){let[p]=h,f=h.index||0;try{let m=await a("",[],r,n);c.push({original:p,processed:m,startIndex:f})}catch(m){let y=m instanceof Error?m.message:String(m);if(i.debug)console.error(`Error processing custom directive @${s}:`,m);c.push({original:p,processed:le("CustomDirective",`Error in @${s}: ${y}`,ne.EVALUATION_ERROR),startIndex:f})}h=d.exec(o)}for(let p=c.length-1;p>=0;p--){let{original:f,processed:m}=c[p];o=o.replace(f,m)}return o}function rh(e){if(!e.trim())return[];let t=[],r="",n=!1,i="";for(let s=0;s<e.length;s++){let a=e[s];if((a==='"'||a==="'")&&(s===0||e[s-1]!=="\\"))if(!n)n=!0,i=a;else if(a===i)n=!1;else r+=a;else if(a===","&&!n)t.push(r.trim()),r="";else r+=a}if(r.trim())t.push(r.trim());return t.map((s)=>{let a=s.trim();if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))return a.substring(1,a.length-1);return a})}var IS=R(()=>{Et(),mn()});function Ot(e,t){if(typeof e!=="string"||e.length===0)throw Error(`@appearanceBootstrap ${t} must be a non-empty string`)}function OS(e){if(!e||typeof e!=="object"||Array.isArray(e))throw Error("@appearanceBootstrap expects an options object");let t=e,r=t.appearance,n=t.colorMode;if(Ot(t.storageKey,"storageKey"),!r||typeof r!=="object"||Array.isArray(r))throw Error("@appearanceBootstrap appearance must be an object");if(!n||typeof n!=="object"||Array.isArray(n))throw Error("@appearanceBootstrap colorMode must be an object");if(Ot(r.key,"appearance.key"),Ot(r.attribute,"appearance.attribute"),Ot(r.default,"appearance.default"),Ot(n.key,"colorMode.key"),Ot(n.attribute,"colorMode.attribute"),Ot(n.default,"colorMode.default"),!Xs.test(r.key)||!Xs.test(n.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Qs.test(r.attribute)||!Qs.test(n.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(r.allowed)||r.allowed.length===0||r.allowed.some((i)=>typeof i!=="string"||i.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!r.allowed.includes(r.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!nh.has(n.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:t.storageKey,appearance:{key:r.key,attribute:r.attribute,allowed:[...new Set(r.allowed)],default:r.default},colorMode:{key:n.key,attribute:n.attribute,default:n.default}}}function jS(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function DS(e){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${jS(e)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function $S(e,t){let r=1,n=null,i=!1;for(let s=t+1;s<e.length;s++){let a=e[s];if(i){i=!1;continue}if(n){if(a==="\\")i=!0;else if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="(")r++;else if(a===")"&&--r===0)return s}return-1}function LS(e,t){let r=e,n=/@appearanceBootstrap\s*\(/g,i;while((i=n.exec(r))!==null){let s=i.index+i[0].length-1,a=$S(r,s);if(a===-1)throw Error("@appearanceBootstrap has an unclosed options object");let o=r.slice(s+1,a).trim(),l=fe(`(${o})`,t),c=DS(OS(l));r=r.slice(0,i.index)+c+r.slice(a+1),n.lastIndex=i.index+c.length}return r}var Qs,Xs,nh,NS=R(()=>{_e(),Qs=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Xs=/^[A-Za-z_$][\w$]*$/,nh=new Set(["light","dark","system"])});function de(e){return String(e??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function An(e,t,r,n){let i=e||t;return r?`${i} ${n}`:i}function We(e){return String(e).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function sr(e,t){if(/\bid\s*=/i.test(e))return"";return` id="${de(t)}"`}function os(e,t,r){if(!t)return"";let n="";if(!/\baria-invalid\s*=/i.test(r))n+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(r))n+=` aria-describedby="${de(`${We(e)}-error`)}"`;return n}function MS(){return PS.randomUUID()}function ea(e,t){let r=e;return r=r.replace(/@csrf/g,()=>{if(!t.csrf||typeof t.csrf!=="object"){let n=MS();t.csrf={token:n}}if(t.csrf.field)return t.csrf.field;if(t.csrf.token)return`<input type="hidden" name="_token" value="${de(t.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),r=r.replace(/@method\(['"]([^'"]+)['"]\)/g,(n,i)=>{let s=i.toUpperCase();if(i&&!["GET","POST"].includes(s))return`<input type="hidden" name="_method" value="${de(s)}">`;return n}),r}function BS(e,t,r=qo){let n=e;return n=n.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(i,s,a,o,l,c="")=>{let u=s||a||"POST",d=o||l||"",h=gt(c),p=u.toUpperCase(),f=["GET","POST"].includes(p)?p:"POST",m=`<form method="${de(f)}" action="${de(d)}"${h?` ${h}`:""}>`;if(m+=`
12206
+ ${ea("@csrf",t)}`,!["GET","POST"].includes(p))m+=`
12207
+ ${ea(`@method('${p}')`,t)}`;return m}),n=n.replace(/@endform/g,"</form>"),n=n.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(i,s,a,o,l,c="")=>{let u=s||a||"",d=o||l||"",h=gt(c),p=zr(u,t),f=p!==void 0&&p!==null?p:d||"",m=h.match(/type=['"]([^'"]+)['"]/i),y=m?m[1]:"text",g=Gr(u,t),v=h.match(/class=['"]([^'"]+)['"]/i),w=An(v?v[1]:"",r.input,g,r.inputError),b=h.replace(/class=['"][^'"]+['"]/i,"");return b=b.replace(/type=['"][^'"]+['"]/i,""),`<input type="${de(y)}" name="${de(u)}"${sr(h,We(u))} value="${de(f)}" class="${w}"${os(u,g,h)}${b?` ${b}`:""}>`}),n=n.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(i,s,a="",o="")=>{let l=gt(a),c=zr(s,t)||o.trim(),u=Gr(s,t),d=l.match(/class=['"]([^'"]+)['"]/i),h=An(d?d[1]:"",r.input,u,r.inputError),p=l.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${de(s)}"${sr(l,We(s))} class="${h}"${os(s,u,l)}${p?` ${p}`:""}>${de(c)}</textarea>`}),n=n.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(i,s,a="",o)=>{let l=gt(a),c=zr(s,t),u=Gr(s,t),d=l.match(/class=['"]([^'"]+)['"]/i),h=An(d?d[1]:"",r.input,u,r.inputError),p=l.replace(/class=['"][^'"]+['"]/i,""),f=o;if(c!==void 0)f=o.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(m,y,g)=>{if((Array.isArray(c)?c.some((v)=>String(v)===g):String(c)===g)&&!y.includes("selected"))return y.replace(/(<option)/,"$1 selected");return m});return`<select name="${de(s)}"${sr(l,We(s))} class="${h}"${os(s,u,l)}${p?` ${p}`:""}>${f}</select>`}),n=n.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(i,s,a,o="")=>{let l=a===void 0?"1":a,c=a===void 0?We(s):`${We(s)}-${We(l)}`,u=gt(o),d=zr(s,t),h=d!==void 0&&(Array.isArray(d)?d.some((y)=>String(y)===l):d===!0||String(d)===l),p=u.match(/class=['"]([^'"]+)['"]/i),f=p?p[1]:r.checkInput,m=u.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${de(s)}"${sr(u,c)} value="${de(l)}" class="${f}"${h?" checked":""}${m?` ${m}`:""}>`}),n=n.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(i,s,a,o="")=>{let l=gt(o),c=zr(s,t),u=c!==void 0&&c===a,d=l.match(/class=['"]([^'"]+)['"]/i),h=d?d[1]:r.checkInput,p=l.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${de(s)}"${sr(l,`${We(s)}-${We(a)}`)} value="${de(a)}" class="${h}"${u?" checked":""}${p?` ${p}`:""}>`}),n=n.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(i,s,a="")=>{let o=gt(a),l=o.match(/accept=['"]([^'"]+)['"]/i),c=l?l[1]:"",u=o.includes("multiple"),d=Gr(s,t),h=o.match(/class=['"]([^'"]+)['"]/i),p=An(h?h[1]:"",r.input,d,r.inputError),f=o.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),m=[`<input type="file" name="${de(s)}"${sr(o,We(s))}`,`class="${p}"`];if(c)m.push(`accept="${de(c)}"`);if(u)m.push("multiple");if(f)m.push(f);return`${m.join(" ")}>`}),n=n.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(i,s,a="",o)=>{let l=gt(a),c=l.match(/class=['"]([^'"]+)['"]/i),u=c?c[1]:r.label,d=l.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${de(We(s))}" class="${u}"${d?` ${d}`:""}>${o}</label>`}),n}function zS(e,t,r=qo){return e.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(n,i,s)=>{try{if(Gr(i,t)){let a=s.replace(/\{\{([^}]+)\}\}/g,(o,l)=>{try{if(l.trim()==="$message"||l.trim()==="message")return Zl(i,t);if(l.trim().includes("errors.first")||l.trim().includes("$errors.first")){if(typeof t.errors?.first==="function")return t.errors.first(i);return Zl(i,t)}let c=l.trim();if(Se(c)){let u=fe(c,t);return u!==void 0?String(u):c}return c}catch{return l}});return`<div id="${de(`${We(i)}-error`)}" role="alert">${a}</div>`}return""}catch(a){return console.error("Error processing @error directive:",a),n}})}function Gr(e,t){if(!t.errors)return!1;if(typeof t.errors.has==="function")return t.errors.has(e);if(typeof t.errors==="object")return Object.prototype.hasOwnProperty.call(t.errors,e);return!1}function Zl(e,t){if(!t.errors)return"";if(typeof t.errors.get==="function")return t.errors.get(e);if(typeof t.errors==="object"&&Object.prototype.hasOwnProperty.call(t.errors,e)){let r=t.errors[e];return Array.isArray(r)?r[0]:String(r)}return""}function zr(e,t){let r;if(t.old&&typeof t.old==="function")return t.old(e);if(t.old&&typeof t.old==="object")return t.old[e];if(e.endsWith("[]")){let n=e.slice(0,-2);if(r=t[n],r!==void 0)return r}return t[e]}function gt(e){if(!e.trim())return"";let t=[],r=e.trim(),n=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,i;while((i=n.exec(r))!==null){let[,s,,a]=i;t.push(`${s}="${a.trim()}"`)}return t.join(" ")}var qo,FS=R(()=>{_e(),qo={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});async function qS(){if(Fr!==void 0)return Fr;try{Fr=(await import("./chunk-ytvzwrq3.js")).loadLocale??null}catch{Fr=null}return Fr}function WS(e,t=0){if(t<=0)return!1;return Date.now()-e.loadedAt>t}async function HS(e,t){if({...Vi,...t.i18n}.cache&&mi[e]){let n=mi[e],i=t.i18n?.cacheMaxAge??0;if(!WS(n,i))return n.translations}if(pr[e]?.state==="loading")return pr[e].promise;Gn[e]="loading";let r=ra(e,t).then((n)=>(Gn[e]="loaded",delete pr[e],n)).catch((n)=>{throw Gn[e]="error",pr[e]={promise:r,state:"error",error:n instanceof Error?n:Error(String(n))},n});return pr[e]={promise:r,state:"loading"},r}async function ra(e,t){let r={...Vi,...t.i18n},n=ta.isAbsolute(r.translationsDir)?r.translationsDir:ta.resolve(t.root||process.cwd(),r.translationsDir);try{let i=await qS(),s=i?await i(e,{translationsDir:n,defaultLocale:r.defaultLocale,sources:YS(r.format)}):await US(e,r,n);if(s===void 0){if(e!==r.defaultLocale)return ra(r.defaultLocale,t);return{}}let a=s;if(r.cache)mi[e]={translations:a,loadedAt:Date.now(),locale:e};return a}catch(i){if(t.debug)console.error(`Error loading translation file for locale "${e}":`,i);if(e!==r.defaultLocale)return ra(r.defaultLocale,t);return{}}}async function US(e,t,r){let n=ta.join(r,`${e}${GS(t.format)}`);try{let i=await import(n);return i.default||i}catch(i){try{let s=await Bun.file(n).text();if(t.format==="yaml"||t.format==="yml")return VS(s);if(t.format==="json")return JSON.parse(s);throw i}catch{return}}}function GS(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function VS(e){let t={},r=e.split(`
12208
+ `),n=[{obj:t,indent:-1}];for(let i of r){let s=i.replace(/#.*$/,"").trimEnd();if(!s.trim())continue;let a=s.search(/\S/);if(a===-1)continue;while(n.length>1&&n[n.length-1].indent>=a)n.pop();let o=n[n.length-1].obj,l=s.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(l){let[,,c,u]=l,d=c.trim(),h=u.trim();if(h==="")o[d]={},n.push({obj:o[d],indent:a});else o[d]=JS(h)}}return t}function JS(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let t=e.toLowerCase();if(t==="true"||t==="yes")return!0;if(t==="false"||t==="no")return!1;if(t==="null"||t==="~")return null;let r=Number(e);if(!Number.isNaN(r)&&e!=="")return r;return e}function YS(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function KS(e,t){return HS(e,t)}function ZS(e,t){for(let r of e){let n=r.trim(),i=n.match(/^\{(\d+)\}\s*(.*)$/);if(i){let a=Number.parseInt(i[1],10);if(t===a)return i[2];continue}let s=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(s){let a=Number.parseInt(s[1],10),o=s[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(s[2],10);if(t>=a&&t<=o)return s[3];continue}}if(e.length===2)return t===1?e[0].trim():e[1].trim();if(t<e.length)return e[t].trim();return e[e.length-1].trim()}function QS(e,t={}){return ih(e,t)}function ih(e,t){let r="",n=0;while(n<e.length)if(e[n]==="{"){let i=XS(e,n);if(i===-1){r+=e[n],n++;continue}let s=e.slice(n+1,i);r+=e_(s,t),n=i+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")r+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")r+=e[n+1],n+=2;else r+=e[n],n++;else r+=e[n],n++;return r}function XS(e,t){let r=0;for(let n=t;n<e.length;n++)if(e[n]==="{")r++;else if(e[n]==="}"){if(r--,r===0)return n}return-1}function e_(e,t){let r=t_(e);if(r.length===0)return`{${e}}`;let n=r[0].trim(),i=t[n];if(r.length===1)return i!==void 0?String(i):`{${n}}`;switch(r[1].trim().toLowerCase()){case"plural":return r_(i,r.slice(2).join(","),t);case"select":return i_(i,r.slice(2).join(","));case"selectordinal":return s_(i,r.slice(2).join(","));case"number":return o_(i,r[2]?.trim());case"date":return l_(i,r[2]?.trim());case"time":return c_(i,r[2]?.trim());default:return i!==void 0?String(i):`{${e}}`}}function t_(e){let t=[],r="",n=0;for(let i=0;i<e.length;i++){let s=e[i];if(s==="{")n++,r+=s;else if(s==="}")n--,r+=s;else if(s===","&&n===0)t.push(r),r="";else r+=s}if(r)t.push(r);return t}function r_(e,t,r){let n=Number(e)||0,i=Wo(t),s=`=${n}`;if(i[s])return ls(i[s],n,r);let a=n_(n);if(i[a])return ls(i[a],n,r);if(i.other)return ls(i.other,n,r);return String(n)}function ls(e,t,r){let n=e.replace(/#/g,String(t));return ih(n,r)}function n_(e){let t=Math.abs(e),r=Math.floor(t),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(r===1&&n===0)return"one";return"other"}function i_(e,t){let r=String(e||""),n=Wo(t);if(n[r])return n[r];return n.other||String(e)}function s_(e,t){let r=Number(e)||0,n=Wo(t),i=a_(r);if(n[i])return n[i].replace(/#/g,String(r));if(n.other)return n.other.replace(/#/g,String(r));return String(r)}function a_(e){let t=Math.abs(e),r=t%10,n=t%100;if(r===1&&n!==11)return"one";if(r===2&&n!==12)return"two";if(r===3&&n!==13)return"few";return"other"}function Wo(e){let t={},r=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=r.exec(e);while(n!==null)t[n[1]]=n[2],n=r.exec(e);return t}function o_(e,t){let r=Number(e);if(Number.isNaN(r))return String(e);switch(t){case"integer":return Math.floor(r).toLocaleString();case"percent":return`${(r*100).toFixed(0)}%`;case"currency":return r.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return r.toLocaleString()}}function l_(e,t){let r=e instanceof Date?e:new Date(String(e));if(Number.isNaN(r.getTime()))return String(e);let n={};switch(t){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return r.toLocaleDateString(void 0,n)}function c_(e,t){let r=e instanceof Date?e:new Date(String(e));if(Number.isNaN(r.getTime()))return String(e);let n={};switch(t){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return r.toLocaleTimeString(void 0,n)}function u_(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function Ql(e,t,r=!0,n={}){let i=e.split("."),s=t;for(let o of i){if(s===void 0||s===null)break;s=s[o]}if(s===void 0||s===null)return r?e:"";let a=String(s);if(u_(a))return QS(a,n);if(a.includes("|")&&"count"in n){let o=Number(n.count),l=a.split("|");a=ZS(l,o)}for(let[o,l]of Object.entries(n)){let c=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");a=a.replace(new RegExp(`:${c}`,"g"),String(l))}return a}async function d_(e,t,r,n){let i=e,s=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,a={...Vi,...n.i18n},o=await KS(a.locale,n);t.__translations=o,t.__locale=a.locale,t.__i18nConfig=a,i=await Xl(i,s,async(c,u,d,h,p)=>{try{let f={};if(d)try{let m=[()=>JSON.parse(d),()=>{let y=`{"data":${d}}`,g=JSON.parse(y);return typeof g.data==="object"?g.data:{}},()=>Ke(d,t)];for(let y of m)try{if(f=y(),Object.keys(f).length>0)break}catch{}}catch(m){if(n.debug)console.error("Error parsing parameters for @translate directive:",m)}return Ql(u,o,a.fallbackToKey,f)||h.trim()}catch(f){if(n.debug)console.error("Error processing @translate directive:",f);return le("Translate",`Error in @translate('${u}'): ${f instanceof Error?f.message:String(f)}`,ne.EVALUATION_ERROR)}});let l=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${i.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let c=[...i.matchAll(l)];console.warn(`Found ${c.length} @translate matches`),c.forEach((u,d)=>console.warn(`Match ${d}: ${u[0]}, Key: ${u[1]}, Params: ${u[2]||"none"}`))}return i=await Xl(i,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(c,u,d,h)=>{try{let p={};if(d)try{let f=[()=>JSON.parse(d),()=>{let m=`{"data":${d}}`,y=JSON.parse(m);return typeof y.data==="object"?y.data:{}},()=>Ke(d,t)];for(let m of f)try{if(p=m(),Object.keys(p).length>0)break}catch{}}catch(f){if(n.debug)console.error("Error parsing parameters for @translate directive:",f)}return Ql(u,o,a.fallbackToKey,p)}catch(p){if(n.debug)console.error("Error processing @translate directive:",p);return le("Translate",`Error in @translate('${u}'): ${p instanceof Error?p.message:String(p)}`,ne.EVALUATION_ERROR)}}),i}async function Xl(e,t,r){let n=[];return e.replace(t,(i,...s)=>{let a=r(i,...s).then((o)=>({match:i,replacement:o}));return n.push(a),i}),(await Promise.all(n)).reduce((i,{match:s,replacement:a})=>i.replace(s,a),e)}var Fr,Vi,mi,pr,Gn,p_=R(()=>{Et(),_e(),Vi={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},mi={},pr={},Gn={}}),Ho={};K(Ho,{streamingSuspenseDirective:()=>Go,streamToResponse:()=>__,streamTemplateSimple:()=>w_,streamTemplate:()=>h_,renderStreamingPage:()=>g_,registerStreamingDirectives:()=>x_,processStreamDirectives:()=>y_,processSectionDirectives:()=>S_,islandDirective:()=>Vo,generateHydrationRuntime:()=>k_,extractStreamBoundaries:()=>v_,createStreamRenderer:()=>b_,buildSuspenseResolveScript:()=>Uo,SUSPENSE_RESOLVER_RUNTIME:()=>sh});function f_(e){let t=[],r=0,n;na.lastIndex=0;while((n=na.exec(e))!==null){if(n.index>r){let a=e.slice(r,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let i=n[1],s=n[2];t.push({type:"suspense",name:i,content:s}),r=n.index+n[0].length}if(r<e.length){let i=e.slice(r);if(i.trim())t.push({type:t.length===0?"shell":"content",content:i})}if(t.length===0)t.push({type:"shell",content:e});return t}async function h_(e,t={},r={}){let n={...Jt,...r,streaming:{...Ji,...r.streaming}},i=n.streaming?.bufferSize||16384;return new ReadableStream({async start(s){try{let a=await Bun.file(e).text(),o=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=o?o[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:gi.dirname(e)};if(l.trim())await ln(l,u,e);let d=f_(c),h=new Set;if(!d.some((p)=>p.type==="suspense")){let p=n.streaming?.strategy||"auto",f=new RegExp(xt.source,"g");if(!(p!=="manual"&&f.test(c))){let m=await ge(c,u,e,n,h);for(let y=0;y<m.length;y+=i)s.enqueue(m.slice(y,y+i)),await new Promise((g)=>setTimeout(g,0))}else{let m=[],y=new RegExp(xt.source,"g"),g;while((g=y.exec(c))!==null)m.push({name:g[1],content:g[2],start:g.index,end:g.index+g[0].length});let v=0;for(let w of m){if(w.start>v){let S=c.slice(v,w.start);if(S.trim()){let x=await ge(S,u,e,n,h);s.enqueue(x),await new Promise((_)=>setTimeout(_,0))}}let b=await ge(w.content,u,e,n,h);s.enqueue(b),await new Promise((S)=>setTimeout(S,0)),v=w.end}if(v<c.length){let w=c.slice(v);if(w.trim()){let b=await ge(w,u,e,n,h);s.enqueue(b)}}}}else{let p=new Map;for(let m of d)if(m.type==="shell"||m.type==="content"){let y=await ge(m.content,u,e,n,h);s.enqueue(y)}else if(m.type==="suspense"&&m.name){let y=`stx-suspense-${m.name}`;s.enqueue(`<div id="${y}" data-suspense="${m.name}" style="display:contents;">
12209
12209
  <template data-suspense-fallback>Loading...</template>
12210
- </div>`),p.set(m.name,me(m.content,u,e,n,h))}s.enqueue(`
12210
+ </div>`),p.set(m.name,ge(m.content,u,e,n,h))}s.enqueue(`
12211
12211
  <script>
12212
12212
  (function() {
12213
12213
  window.__stxSuspense = window.__stxSuspense || {
@@ -12223,13 +12223,13 @@ ${i}`)}function gS(e,t){let r=e;return r=r.replace(/<script(?![^>]*\ssrc=)([^>]*
12223
12223
  }
12224
12224
  };
12225
12225
  })();
12226
- </script>`);let f=Array.from(p.entries()).map(async([m,y])=>{s.enqueue(await Ho(m,y))});await Promise.all(f)}s.close()}catch(a){s.error(a)}}})}async function Ho(e,t){try{let r=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
12226
+ </script>`);let f=Array.from(p.entries()).map(async([m,y])=>{s.enqueue(await Uo(m,y))});await Promise.all(f)}s.close()}catch(a){s.error(a)}}})}async function Uo(e,t){try{let r=(await t).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
12227
12227
  <script>
12228
12228
  window.__stxSuspense.resolve('${e}', \`${r}\`);
12229
12229
  </script>`}catch(r){let n=r instanceof Error?r.message:String(r);return`
12230
12230
  <script>
12231
- window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${_t(n)}</div>');
12232
- </script>`}}function h_(e,t,r){if(!t||t<=0)return e;let n,i=new Promise((s,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${r}" timed out after ${t}ms`)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(n))}function m_(e,t=[],r={}){let n=r.timeoutMs??0;return new ReadableStream({async start(i){try{if(i.enqueue(e),t.length>0)i.enqueue(ih),await Promise.all(t.map(async(s)=>{let a=h_(s.render(),n,s.id);i.enqueue(await Ho(s.id,a))}));i.close()}catch(s){i.error(s)}}})}function g_(e,t){return e.replace(sh,(r,n,i)=>{let s=n.trim(),a=i.split(/@fallback/i),o=a[0].trim(),l=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[s]=o,`<div data-suspense="${s}">${l}</div>`})}function y_(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let r=Object.entries(t).filter(([,n])=>typeof n==="function");return r.length>0?r.map(([n,i])=>({id:n,render:i})):void 0}async function v_(e,t={},r={}){let n={...Vt,...r,streaming:{...Vi,...r.streaming}},i=n.streaming?.bufferSize||16384;return new ReadableStream({async start(s){try{let a=await Bun.file(e).text(),o=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=o?o[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:mi.dirname(e)};if(l.trim())await on(l,u,e);let d=new Set,h=n.streaming?.strategy||"auto",p=new RegExp(bt.source,"g");if(!(h!=="manual"&&p.test(c))){let f=await me(c,u,e,n,d);for(let m=0;m<f.length;m+=i)s.enqueue(f.slice(m,m+i))}else{let f=[],m=new RegExp(bt.source,"g"),y;while((y=m.exec(c))!==null)f.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let g=0;for(let v of f){if(v.start>g){let b=c.slice(g,v.start);if(b.trim()){let S=await me(b,u,e,n,d);s.enqueue(S)}}let w=await me(v.content,u,e,n,d);s.enqueue(w),g=v.end}if(g<c.length){let v=c.slice(g);if(v.trim()){let w=await me(v,u,e,n,d);s.enqueue(w)}}}s.close()}catch(a){s.error(a)}}})}async function w_(e,t={}){let r={...Vt,...t,streaming:{...Vi,...t.streaming}},n=await Bun.file(e).text(),i=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),s=i?i[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),o=a,l={},c;bt.lastIndex=0;while((c=bt.exec(a))!==null){let d=c[1],h=c[2];l[d]=h}let u=a.replace(bt,"");return{renderShell:async(d={})=>{let h={...d,__filename:e,__dirname:mi.dirname(e)};return await on(s,h,e),me(u,h,e,r,new Set)},renderSection:async(d,h={})=>{try{if(!l[d])return`<div class="error-message">Section "${_t(d)}" not found in template "${_t(e)}"</div>`;let p={...h,__filename:e,__dirname:mi.dirname(e)};await on(s,p,e);let f=new Set;return await me(l[d],p,e,r,f)}catch(p){let f=p instanceof Error?p.message:String(p);return Ae("Expression",f,e,l[d]||"",0,l[d]||"")}},getSections:()=>{return Object.keys(l)},getTemplate:()=>{return o}}}function b_(e={}){let t=[];if(e.streaming?.enabled)t.push(Uo);if(e.hydration?.enabled)t.push(Go);return t}async function x_(e,t,r,n={}){return e}function S_(e,t={}){let r=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(s,a){a.enqueue(r.encode(s))}})),i=new Headers(t.headers);if(!i.has("Content-Type"))i.set("Content-Type","text/html; charset=utf-8");if(!i.has("Transfer-Encoding"))i.set("Transfer-Encoding","chunked");if(!i.has("X-Content-Type-Options"))i.set("X-Content-Type-Options","nosniff");if(!i.has("X-Accel-Buffering"))i.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:i})}function __(e={mode:"full"}){let{mode:t,components:r={},dynamicImports:n=!0}=e,i=Object.entries(r).map(([s,a])=>`'${s}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
12231
+ window.__stxSuspense.resolve('${e}', '<div class="stx-error">Error loading content: ${kt(n)}</div>');
12232
+ </script>`}}function m_(e,t,r){if(!t||t<=0)return e;let n,i=new Promise((s,a)=>{n=setTimeout(()=>a(Error(`streaming boundary "${r}" timed out after ${t}ms`)),t)});return Promise.race([e,i]).finally(()=>clearTimeout(n))}function g_(e,t=[],r={}){let n=r.timeoutMs??0;return new ReadableStream({async start(i){try{if(i.enqueue(e),t.length>0)i.enqueue(sh),await Promise.all(t.map(async(s)=>{let a=m_(s.render(),n,s.id);i.enqueue(await Uo(s.id,a))}));i.close()}catch(s){i.error(s)}}})}function y_(e,t){return e.replace(ah,(r,n,i)=>{let s=n.trim(),a=i.split(/@fallback/i),o=a[0].trim(),l=a.length>1?a.slice(1).join("@fallback").trim():"";if(!t.__streamTemplates)t.__streamTemplates={};return t.__streamTemplates[s]=o,`<div data-suspense="${s}">${l}</div>`})}function v_(e){let t=e?.streamBoundaries;if(!t||typeof t!=="object")return;let r=Object.entries(t).filter(([,n])=>typeof n==="function");return r.length>0?r.map(([n,i])=>({id:n,render:i})):void 0}async function w_(e,t={},r={}){let n={...Jt,...r,streaming:{...Ji,...r.streaming}},i=n.streaming?.bufferSize||16384;return new ReadableStream({async start(s){try{let a=await Bun.file(e).text(),o=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),l=o?o[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u={...t,__filename:e,__dirname:gi.dirname(e)};if(l.trim())await ln(l,u,e);let d=new Set,h=n.streaming?.strategy||"auto",p=new RegExp(xt.source,"g");if(!(h!=="manual"&&p.test(c))){let f=await ge(c,u,e,n,d);for(let m=0;m<f.length;m+=i)s.enqueue(f.slice(m,m+i))}else{let f=[],m=new RegExp(xt.source,"g"),y;while((y=m.exec(c))!==null)f.push({name:y[1],content:y[2],start:y.index,end:y.index+y[0].length});let g=0;for(let v of f){if(v.start>g){let b=c.slice(g,v.start);if(b.trim()){let S=await ge(b,u,e,n,d);s.enqueue(S)}}let w=await ge(v.content,u,e,n,d);s.enqueue(w),g=v.end}if(g<c.length){let v=c.slice(g);if(v.trim()){let w=await ge(v,u,e,n,d);s.enqueue(w)}}}s.close()}catch(a){s.error(a)}}})}async function b_(e,t={}){let r={...Jt,...t,streaming:{...Ji,...t.streaming}},n=await Bun.file(e).text(),i=n.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),s=i?i[1]:"",a=n.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),o=a,l={},c;xt.lastIndex=0;while((c=xt.exec(a))!==null){let d=c[1],h=c[2];l[d]=h}let u=a.replace(xt,"");return{renderShell:async(d={})=>{let h={...d,__filename:e,__dirname:gi.dirname(e)};return await ln(s,h,e),ge(u,h,e,r,new Set)},renderSection:async(d,h={})=>{try{if(!l[d])return`<div class="error-message">Section "${kt(d)}" not found in template "${kt(e)}"</div>`;let p={...h,__filename:e,__dirname:gi.dirname(e)};await ln(s,p,e);let f=new Set;return await ge(l[d],p,e,r,f)}catch(p){let f=p instanceof Error?p.message:String(p);return Ce("Expression",f,e,l[d]||"",0,l[d]||"")}},getSections:()=>Object.keys(l),getTemplate:()=>o}}function x_(e={}){let t=[];if(e.streaming?.enabled)t.push(Go);if(e.hydration?.enabled)t.push(Vo);return t}async function S_(e,t,r,n={}){return e}function __(e,t={}){let r=new TextEncoder,n=e.pipeThrough(new TransformStream({transform(s,a){a.enqueue(r.encode(s))}})),i=new Headers(t.headers);if(!i.has("Content-Type"))i.set("Content-Type","text/html; charset=utf-8");if(!i.has("Transfer-Encoding"))i.set("Transfer-Encoding","chunked");if(!i.has("X-Content-Type-Options"))i.set("X-Content-Type-Options","nosniff");if(!i.has("X-Accel-Buffering"))i.set("X-Accel-Buffering","no");return new Response(n,{...t,headers:i})}function k_(e={mode:"full"}){let{mode:t,components:r={},dynamicImports:n=!0}=e,i=Object.entries(r).map(([s,a])=>`'${s}': ${n?`() => import('${a}')`:`require('${a}')`}`).join(`,
12233
12233
  `);if(t==="loader")return`
12234
12234
  (function() {
12235
12235
  window.__stx = window.__stx || {};
@@ -12371,7 +12371,7 @@ else {
12371
12371
  else {
12372
12372
  stx.hydrate();
12373
12373
  }
12374
- })();`}var Vi,bt,ra,ih=`
12374
+ })();`}var Ji,xt,na,sh=`
12375
12375
  <script>
12376
12376
  (function(){
12377
12377
  window.__stxSuspense = window.__stxSuspense || {
@@ -12391,25 +12391,25 @@ else {
12391
12391
  }
12392
12392
  };
12393
12393
  })();
12394
- </script>`,sh,Uo,Go,ah=R(()=>{Et(),ut(),el(),Ce(),Vi={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},bt=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,ra=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g,sh=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi,Uo={name:"suspense",hasEndTag:!0,handler:(e,t,r,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let i=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${i} -->${e}<!-- @endsuspense:${i} -->`}},Go={name:"island",hasEndTag:!0,handler:(e,t,r,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let i=t[0].replace(/['"`]/g,""),s=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${i}-${Math.random().toString(36).substring(2,9)}`,o=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),l=o?o[1].trim():"",c=o?e.replace(o[0],""):e;return`<div data-island="${i}" data-island-id="${a}" data-priority="${s}">
12394
+ </script>`,ah,Go,Vo,oh=R(()=>{At(),dt(),tl(),Te(),Ji={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},xt=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,na=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g,ah=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi,Go={name:"suspense",hasEndTag:!0,handler:(e,t,r,n)=>{if(!t||t.length===0)throw Error("Suspense directive requires a name parameter");let i=t[0].replace(/['"`]/g,"");return`<!-- @suspense:${i} -->${e}<!-- @endsuspense:${i} -->`}},Vo={name:"island",hasEndTag:!0,handler:(e,t,r,n)=>{if(!t||t.length===0)throw Error("Island directive requires a name parameter");let i=t[0].replace(/['"`]/g,""),s=t[1]?t[1].replace(/['"`]/g,""):"lazy",a=`island-${i}-${Math.random().toString(36).substring(2,9)}`,o=e.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),l=o?o[1].trim():"",c=o?e.replace(o[0],""):e;return`<div data-island="${i}" data-island-id="${a}" data-priority="${s}">
12395
12395
  ${c}
12396
12396
  <script type="application/json" data-island-props="${a}">
12397
12397
  ${l?`{${l}}`:"{}"}
12398
12398
  </script>
12399
- </div>`}}}),oh={};Y(oh,{warnUnbalancedTags:()=>ch,findUnbalancedTags:()=>lh});function sr(e){return e.replace(/[^\n]/g," ")}function lh(e){let t=e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,sr).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,sr).replace(/<!--[\s\S]*?-->/g,sr).replace(/\{\{\{[\s\S]*?\}\}\}/g,sr).replace(/\{\{[\s\S]*?\}\}/g,sr).replace(/\{!![\s\S]*?!!\}/g,sr),r=new Map,n=new Map,i=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,s;while((s=i.exec(t))!==null){let o=s[1]==="/",l=s[2],c=s[3]==="/";if(uh.has(l.toLowerCase()))continue;if(c)continue;if(o)n.set(l,(n.get(l)??0)+1);else{let u=r.get(l);if(u)u.count++;else{let d=t.slice(0,s.index).split(`
12400
- `).length;r.set(l,{count:1,firstLine:d})}}}let a=[];for(let o of new Set([...r.keys(),...n.keys()])){if(dh.has(o.toLowerCase()))continue;let l=r.get(o)?.count??0,c=n.get(o)??0;if(l!==c)a.push({tag:o,opened:l,closed:c,firstOpenLine:r.get(o)?.firstLine??0})}return a}function ch(e,t){let r;try{r=lh(e)}catch{return}if(r.length===0)return;let n=`${t}:${e.length}`;if(na.has(n))return;na.add(n);let i=t?t.split(/[/\\]/).pop()||t:"template";for(let{tag:s,opened:a,closed:o,firstOpenLine:l}of r)if(a>o){let c=l?` (first opened at line ${l})`:"";console.warn(`[stx] ${i}: <${s}> ${a} opened, ${o} closed \u2014 an unclosed <${s}>${c} may swallow the content that follows it.`)}else console.warn(`[stx] ${i}: <${s}> ${a} opened, ${o} closed \u2014 ${o-a} stray </${s}>.`)}var uh,dh,na,ph=R(()=>{uh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),dh=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]),na=new Set});function ec(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function tc(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class fh{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,r,n){let i=e.endsWith(".stx")?e.slice(0,-4):e,s=n?.__importedComponents;if(s){let p=[i,i.toLowerCase(),ec(i),tc(i)];for(let f of p)if(s.has(f))return s.get(f)}let a=[...new Set([`${i}.stx`,`${ec(i)}.stx`,`${tc(i)}.stx`])];if(i.startsWith("./")||i.startsWith("../")){let p=Fe.resolve(Fe.dirname(t),`${i}.stx`);if(await Q(p))return p;return null}let o=[],l=r.componentsDir||"",c=n?.__originalFilePath;if(c)o.push(Fe.join(Fe.dirname(c),"components"));if(l)o.push(l);let u=Fe.join(Fe.dirname(t),"components");if(!o.includes(u))o.push(u);let d=process.cwd(),h=[Fe.resolve(d,"src/components"),Fe.resolve(d,"components"),Fe.resolve(import.meta.dir,"components")];for(let p of h)if(!o.includes(p))o.push(p);for(let p of o){if(!p)continue;for(let f of a){let m=Fe.join(p,f);if(await Q(m))return m}try{if(!Xl.statSync(p,{throwIfNoEntry:!1})?.isDirectory())continue;let f=Xl.readdirSync(p,{withFileTypes:!0});for(let m of f)if(m.isDirectory()){let y=Fe.join(p,m.name);for(let g of a){let v=Fe.join(y,g);if(await Q(v))return v}}}catch{}}return null}}var je,hh=R(()=>{Ce(),je=new fh});function Je(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k_(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var cn="\x00stx-boolean-attribute";function Vo(e,t){let r=[];for(let[n,i]of Object.entries(e.static)){if(t.has(n))continue;let s=e.staticNames?.[n]??n;if(typeof i==="boolean"){if(i)r.push(Je(s));continue}if(i===cn){r.push(Je(s));continue}r.push(`${Je(s)}="${Je(k_(String(i)))}"`)}return r}var Jo=()=>{};function Fr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E_(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var mh,rc=R(()=>{Jo(),mh={name:"StxLink",aliases:["stx-link"],render(e,t,r){let n=E_(e),i=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),s=typeof e.static.activeClass==="string"?e.static.activeClass:"active",a=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",o=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,l=[];if(n.reactive)l.push(`:href="${Fr(n.value)}"`);else l.push(`href="${Fr(n.value)}"`);if(i)l.push(`class="${Fr(i)}"`);if(l.push("data-stx-link"),l.push(`data-stx-active-class="${Fr(s)}"`),l.push(`data-stx-exact-active-class="${Fr(a)}"`),o)l.push("data-stx-prefetch");let c=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return l.push(...Vo(e,c)),`<a ${l.join(" ")}>${t}</a>`}}});function ke(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Re(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}function ls(e,t,r=!1){let n=e.serverDynamic[t];if(n!==void 0)return n!==!1&&n!=="false";let i=e.static[t];if(i!==void 0)return i!=="false"&&i!==!1;return r}function nc(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),r=[];for(let n of t)if(n.includes(":")){let[i,s]=n.split(":"),a=gh[i];if(a)r.push(`(max-width: ${a}px) ${s}`);else{let o=Number.parseInt(i);if(!Number.isNaN(o))r.push(`(max-width: ${o}px) ${s}`)}}else r.push(n);return r.join(", ")}function cs(e,t,r,n){return t.map((i)=>`${tn(e,i,void 0,r,n)} ${i}w`).join(", ")}function A_(e,t,r,n,i){return t.map((s)=>{let a=r?r*s:void 0;return`${tn(e,a,void 0,n,i)} ${s}x`}).join(", ")}function tn(e,t,r,n,i){if(!n||n==="local"||n==="static")return e;if(n==="cloudinary"){let s=[];if(t)s.push(`w_${t}`);if(r)s.push(`h_${r}`);if(i)s.push(`f_${i}`);s.push("q_auto");let a=s.join(",");return e.replace("/upload/",`/upload/${a}/`)}if(n==="imgix"){let s=new URLSearchParams;if(t)s.set("w",String(t));if(r)s.set("h",String(r));if(i)s.set("fm",i);s.set("auto","format");let a=e.includes("?")?"&":"?";return`${e}${a}${s.toString()}`}if(n==="bunny"){let s=new URLSearchParams;if(t)s.set("width",String(t));if(r)s.set("height",String(r));if(i)s.set("format",i);let a=e.includes("?")?"&":"?";return`${e}${a}${s.toString()}`}return e}function C_(e,t,r="#e5e7eb"){let n=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${r}"/></svg>`;return`data:image/svg+xml;base64,${btoa(n)}`}var gh,An,yh,ic=R(()=>{Jo(),gh={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},An=[320,640,768,1024,1280,1536,1920],yh={name:"StxImage",aliases:["stx-image","stx-img"],render(e,t,r){let n=Re(e,"src")||"",i=Re(e,"alt")||"",s=Re(e,"width"),a=Re(e,"height"),o=Re(e,"sizes"),l=Re(e,"srcset"),c=Re(e,"densities"),u=Re(e,"format"),d=Re(e,"placeholder"),h=Re(e,"placeholderColor")||"#e5e7eb",p=Re(e,"provider"),f=Re(e,"class")||Re(e,"className")||"",m=Re(e,"style")||"",y=Re(e,"quality"),g=ls(e,"lazy",!0),v=ls(e,"preload",!1),w=ls(e,"picture",!1)||!!u,b=s?Number.parseInt(s):void 0,S=a?Number.parseInt(a):void 0,x=l||"",_="";if(!x&&o)x=cs(n,An,p,u),_=nc(o);else if(!x&&c){let I=c.split(/\s+/).map((O)=>Number.parseFloat(O.replace("x","")));x=A_(n,I,b,p,u)}else if(o)_=nc(o);let E=[];if(m)E.push(m);if(b&&S)E.push(`aspect-ratio:${b}/${S}`);if(d==="blur"||d==="color"||d==="thumbhash"){let I=C_(b||16,S||9,h);E.push(`background-image:url(${I})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat")}else if(d&&d!=="empty"&&d!=="none")E.push(`background-image:url(${ke(d)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat");let k=tn(n,b,S,p,u),A=[];if(A.push(`src="${ke(k)}"`),A.push(`alt="${ke(i)}"`),s)A.push(`width="${ke(s)}"`);if(a)A.push(`height="${ke(a)}"`);if(g)A.push('loading="lazy"');if(A.push('decoding="async"'),f)A.push(`class="${ke(f)}"`);if(E.length>0)A.push(`style="${ke(E.join(";"))}"`);if(x)A.push(`srcset="${ke(x)}"`);if(_)A.push(`sizes="${ke(_)}"`);let T=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);A.push(...Vo(e,T));let C=`<img ${A.join(" ")} />`,D="";if(v){let I=u==="webp"?"image/webp":u==="avif"?"image/avif":"";D=`<link rel="preload" as="image" href="${ke(k)}"${I?` type="${I}"`:""}${x?` imagesrcset="${ke(x)}"`:""}${_?` imagesizes="${ke(_)}"`:""} />
12401
- `}if(w){let I=[];if(u==="avif"||u==="auto"){let O=tn(n,b,S,p,"avif"),L=x?cs(n,An,p,"avif"):`${O}`;I.push(`<source type="image/avif" srcset="${ke(L)}"${_?` sizes="${ke(_)}"`:""} />`)}if(u==="webp"||u==="auto"){let O=tn(n,b,S,p,"webp"),L=x?cs(n,An,p,"webp"):`${O}`;I.push(`<source type="image/webp" srcset="${ke(L)}"${_?` sizes="${ke(_)}"`:""} />`)}return`${D}<picture>
12399
+ </div>`}}}),lh={};K(lh,{warnUnbalancedTags:()=>uh,findUnbalancedTags:()=>ch});function ar(e){return e.replace(/[^\n]/g," ")}function ch(e){let t=e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,ar).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,ar).replace(/<!--[\s\S]*?-->/g,ar).replace(/\{\{\{[\s\S]*?\}\}\}/g,ar).replace(/\{\{[\s\S]*?\}\}/g,ar).replace(/\{!![\s\S]*?!!\}/g,ar),r=new Map,n=new Map,i=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,s;while((s=i.exec(t))!==null){let o=s[1]==="/",l=s[2],c=s[3]==="/";if(dh.has(l.toLowerCase()))continue;if(c)continue;if(o)n.set(l,(n.get(l)??0)+1);else{let u=r.get(l);if(u)u.count++;else{let d=t.slice(0,s.index).split(`
12400
+ `).length;r.set(l,{count:1,firstLine:d})}}}let a=[];for(let o of new Set([...r.keys(),...n.keys()])){if(ph.has(o.toLowerCase()))continue;let l=r.get(o)?.count??0,c=n.get(o)??0;if(l!==c)a.push({tag:o,opened:l,closed:c,firstOpenLine:r.get(o)?.firstLine??0})}return a}function uh(e,t){let r;try{r=ch(e)}catch{return}if(r.length===0)return;let n=`${t}:${e.length}`;if(ia.has(n))return;ia.add(n);let i=t?t.split(/[/\\]/).pop()||t:"template";for(let{tag:s,opened:a,closed:o,firstOpenLine:l}of r)if(a>o){let c=l?` (first opened at line ${l})`:"";console.warn(`[stx] ${i}: <${s}> ${a} opened, ${o} closed \u2014 an unclosed <${s}>${c} may swallow the content that follows it.`)}else console.warn(`[stx] ${i}: <${s}> ${a} opened, ${o} closed \u2014 ${o-a} stray </${s}>.`)}var dh,ph,ia,fh=R(()=>{dh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),ph=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]),ia=new Set});function tc(e){return e.split("-").map((t)=>t.charAt(0).toUpperCase()+t.slice(1)).join("")}function rc(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class hh{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,r,n){let i=e.endsWith(".stx")?e.slice(0,-4):e,s=n?.__importedComponents;if(s){let p=[i,i.toLowerCase(),tc(i),rc(i)];for(let f of p)if(s.has(f))return s.get(f)}let a=[...new Set([`${i}.stx`,`${tc(i)}.stx`,`${rc(i)}.stx`])];if(i.startsWith("./")||i.startsWith("../")){let p=qe.resolve(qe.dirname(t),`${i}.stx`);if(await X(p))return p;return null}let o=[],l=r.componentsDir||"",c=n?.__originalFilePath;if(c)o.push(qe.join(qe.dirname(c),"components"));if(l)o.push(l);let u=qe.join(qe.dirname(t),"components");if(!o.includes(u))o.push(u);let d=process.cwd(),h=[qe.resolve(d,"src/components"),qe.resolve(d,"components"),qe.resolve(import.meta.dir,"components")];for(let p of h)if(!o.includes(p))o.push(p);for(let p of o){if(!p)continue;for(let f of a){let m=qe.join(p,f);if(await X(m))return m}try{if(!ec.statSync(p,{throwIfNoEntry:!1})?.isDirectory())continue;let f=ec.readdirSync(p,{withFileTypes:!0});for(let m of f)if(m.isDirectory()){let y=qe.join(p,m.name);for(let g of a){let v=qe.join(y,g);if(await X(v))return v}}}catch{}}return null}}var De,mh=R(()=>{Te(),De=new hh});function Ye(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E_(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var un="\x00stx-boolean-attribute";function Jo(e,t){let r=[];for(let[n,i]of Object.entries(e.static)){if(t.has(n))continue;let s=e.staticNames?.[n]??n;if(typeof i==="boolean"){if(i)r.push(Ye(s));continue}if(i===un){r.push(Ye(s));continue}r.push(`${Ye(s)}="${Ye(E_(String(i)))}"`)}return r}var Yo=()=>{};function qr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A_(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var gh,nc=R(()=>{Yo(),gh={name:"StxLink",aliases:["stx-link"],render(e,t,r){let n=A_(e),i=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),s=typeof e.static.activeClass==="string"?e.static.activeClass:"active",a=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",o=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,l=[];if(n.reactive)l.push(`:href="${qr(n.value)}"`);else l.push(`href="${qr(n.value)}"`);if(i)l.push(`class="${qr(i)}"`);if(l.push("data-stx-link"),l.push(`data-stx-active-class="${qr(s)}"`),l.push(`data-stx-exact-active-class="${qr(a)}"`),o)l.push("data-stx-prefetch");let c=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return l.push(...Jo(e,c)),`<a ${l.join(" ")}>${t}</a>`}}});function Ee(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ie(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}function cs(e,t,r=!1){let n=e.serverDynamic[t];if(n!==void 0)return n!==!1&&n!=="false";let i=e.static[t];if(i!==void 0)return i!=="false"&&i!==!1;return r}function ic(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),r=[];for(let n of t)if(n.includes(":")){let[i,s]=n.split(":"),a=yh[i];if(a)r.push(`(max-width: ${a}px) ${s}`);else{let o=Number.parseInt(i);if(!Number.isNaN(o))r.push(`(max-width: ${o}px) ${s}`)}}else r.push(n);return r.join(", ")}function us(e,t,r,n){return t.map((i)=>`${rn(e,i,void 0,r,n)} ${i}w`).join(", ")}function C_(e,t,r,n,i){return t.map((s)=>{let a=r?r*s:void 0;return`${rn(e,a,void 0,n,i)} ${s}x`}).join(", ")}function rn(e,t,r,n,i){if(!n||n==="local"||n==="static")return e;if(n==="cloudinary"){let s=[];if(t)s.push(`w_${t}`);if(r)s.push(`h_${r}`);if(i)s.push(`f_${i}`);s.push("q_auto");let a=s.join(",");return e.replace("/upload/",`/upload/${a}/`)}if(n==="imgix"){let s=new URLSearchParams;if(t)s.set("w",String(t));if(r)s.set("h",String(r));if(i)s.set("fm",i);s.set("auto","format");let a=e.includes("?")?"&":"?";return`${e}${a}${s.toString()}`}if(n==="bunny"){let s=new URLSearchParams;if(t)s.set("width",String(t));if(r)s.set("height",String(r));if(i)s.set("format",i);let a=e.includes("?")?"&":"?";return`${e}${a}${s.toString()}`}return e}function T_(e,t,r="#e5e7eb"){let n=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${r}"/></svg>`;return`data:image/svg+xml;base64,${btoa(n)}`}var yh,Cn,vh,sc=R(()=>{Yo(),yh={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Cn=[320,640,768,1024,1280,1536,1920],vh={name:"StxImage",aliases:["stx-image","stx-img"],render(e,t,r){let n=Ie(e,"src")||"",i=Ie(e,"alt")||"",s=Ie(e,"width"),a=Ie(e,"height"),o=Ie(e,"sizes"),l=Ie(e,"srcset"),c=Ie(e,"densities"),u=Ie(e,"format"),d=Ie(e,"placeholder"),h=Ie(e,"placeholderColor")||"#e5e7eb",p=Ie(e,"provider"),f=Ie(e,"class")||Ie(e,"className")||"",m=Ie(e,"style")||"",y=Ie(e,"quality"),g=cs(e,"lazy",!0),v=cs(e,"preload",!1),w=cs(e,"picture",!1)||!!u,b=s?Number.parseInt(s):void 0,S=a?Number.parseInt(a):void 0,x=l||"",_="";if(!x&&o)x=us(n,Cn,p,u),_=ic(o);else if(!x&&c){let I=c.split(/\s+/).map((O)=>Number.parseFloat(O.replace("x","")));x=C_(n,I,b,p,u)}else if(o)_=ic(o);let E=[];if(m)E.push(m);if(b&&S)E.push(`aspect-ratio:${b}/${S}`);if(d==="blur"||d==="color"||d==="thumbhash"){let I=T_(b||16,S||9,h);E.push(`background-image:url(${I})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat")}else if(d&&d!=="empty"&&d!=="none")E.push(`background-image:url(${Ee(d)})`),E.push("background-size:cover"),E.push("background-repeat:no-repeat");let k=rn(n,b,S,p,u),A=[];if(A.push(`src="${Ee(k)}"`),A.push(`alt="${Ee(i)}"`),s)A.push(`width="${Ee(s)}"`);if(a)A.push(`height="${Ee(a)}"`);if(g)A.push('loading="lazy"');if(A.push('decoding="async"'),f)A.push(`class="${Ee(f)}"`);if(E.length>0)A.push(`style="${Ee(E.join(";"))}"`);if(x)A.push(`srcset="${Ee(x)}"`);if(_)A.push(`sizes="${Ee(_)}"`);let T=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);A.push(...Jo(e,T));let C=`<img ${A.join(" ")} />`,D="";if(v){let I=u==="webp"?"image/webp":u==="avif"?"image/avif":"";D=`<link rel="preload" as="image" href="${Ee(k)}"${I?` type="${I}"`:""}${x?` imagesrcset="${Ee(x)}"`:""}${_?` imagesizes="${Ee(_)}"`:""} />
12401
+ `}if(w){let I=[];if(u==="avif"||u==="auto"){let O=rn(n,b,S,p,"avif"),N=x?us(n,Cn,p,"avif"):`${O}`;I.push(`<source type="image/avif" srcset="${Ee(N)}"${_?` sizes="${Ee(_)}"`:""} />`)}if(u==="webp"||u==="auto"){let O=rn(n,b,S,p,"webp"),N=x?us(n,Cn,p,"webp"):`${O}`;I.push(`<source type="image/webp" srcset="${Ee(N)}"${_?` sizes="${Ee(_)}"`:""} />`)}return`${D}<picture>
12402
12402
  ${I.join(`
12403
12403
  `)}
12404
12404
  ${C}
12405
- </picture>`}return`${D}${C}`}}});function qr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ar(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}var sc="/images/safe-image-default.svg",ac,vh,oc=R(()=>{Jo(),ac=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${sc}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,vh={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,t,r){let n=ar(e,"src")||"",i=ar(e,"alt")||"",s=ar(e,"fallback")||sc,a=ar(e,"class")||ar(e,"className")||"",o=ar(e,"fallbackClassName")||"",l=[];if(l.push(`src="${qr(n)}"`),l.push(`alt="${qr(i)}"`),a)l.push(`class="${qr(a)}"`);if(l.push(`data-fallback="${qr(s)}"`),o)l.push(`data-fallback-class="${qr(o)}"`);l.push('onerror="window.__stxSafeImageHandler(this)"');let c=new Set(["src","alt","fallback","class","className","fallbackClassName"]);l.push(...Vo(e,c));let u=`<img ${l.join(" ")} />`,d=r.context;if(!d.__safeImageHandlerEmitted)return d.__safeImageHandlerEmitted=!0,`${ac}${u}`;return u}}});function us(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Gr(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}function Cn(e,t,r){let n=Gr(e,t);if(n!==void 0){let i=Number.parseInt(n,10);if(!Number.isNaN(i))return i}return r}var wh,lc=R(()=>{wh={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,t,r){let n=us(Gr(e,"color")||"#6366f1"),i=us(Gr(e,"initialColor")||Gr(e,"initial-color")||""),s=us(Gr(e,"height")||"3px"),a=Cn(e,"duration",2000),o=Cn(e,"throttle",200),l=Cn(e,"zIndex",999999)||Cn(e,"z-index",999999),c=i?`linear-gradient(to right, ${i}, ${n})`:n;return`
12405
+ </picture>`}return`${D}${C}`}}});function Wr(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function or(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}var ac="/images/safe-image-default.svg",oc,wh,lc=R(()=>{Yo(),oc=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${ac}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,wh={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,t,r){let n=or(e,"src")||"",i=or(e,"alt")||"",s=or(e,"fallback")||ac,a=or(e,"class")||or(e,"className")||"",o=or(e,"fallbackClassName")||"",l=[];if(l.push(`src="${Wr(n)}"`),l.push(`alt="${Wr(i)}"`),a)l.push(`class="${Wr(a)}"`);if(l.push(`data-fallback="${Wr(s)}"`),o)l.push(`data-fallback-class="${Wr(o)}"`);l.push('onerror="window.__stxSafeImageHandler(this)"');let c=new Set(["src","alt","fallback","class","className","fallbackClassName"]);l.push(...Jo(e,c));let u=`<img ${l.join(" ")} />`,d=r.context;if(!d.__safeImageHandlerEmitted)return d.__safeImageHandlerEmitted=!0,`${oc}${u}`;return u}}});function ds(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Vr(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}function Tn(e,t,r){let n=Vr(e,t);if(n!==void 0){let i=Number.parseInt(n,10);if(!Number.isNaN(i))return i}return r}var bh,cc=R(()=>{bh={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,t,r){let n=ds(Vr(e,"color")||"#6366f1"),i=ds(Vr(e,"initialColor")||Vr(e,"initial-color")||""),s=ds(Vr(e,"height")||"3px"),a=Tn(e,"duration",2000),o=Tn(e,"throttle",200),l=Tn(e,"zIndex",999999)||Tn(e,"z-index",999999),c=i?`linear-gradient(to right, ${i}, ${n})`:n;return`
12406
12406
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${s};background:${c};z-index:${l};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
12407
12407
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
12408
12408
  </div>
12409
12409
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
12410
12410
  <script>
12411
12411
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${o})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
12412
- </script>`}}});function bh(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}function T_(e,t,r){let n=bh(e,t);if(n!==void 0){let i=Number.parseInt(n,10);if(!Number.isNaN(i))return i}return r}var ds,xh,cc=R(()=>{ds={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},xh={name:"StxToast",aliases:["stx-toast"],render(e,t,r){let n=Je(bh(e,"position")||"top-right"),i=T_(e,"max",5),s=ds[n]||ds["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${n}" data-stx-toast-max="${i}" style="position:fixed;${s};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
12412
+ </script>`}}});function xh(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}function R_(e,t,r){let n=xh(e,t);if(n!==void 0){let i=Number.parseInt(n,10);if(!Number.isNaN(i))return i}return r}var ps,Sh,uc=R(()=>{ps={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},Sh={name:"StxToast",aliases:["stx-toast"],render(e,t,r){let n=Ye(xh(e,"position")||"top-right"),i=R_(e,"max",5),s=ps[n]||ps["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${n}" data-stx-toast-max="${i}" style="position:fixed;${s};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
12413
12413
  <style>
12414
12414
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
12415
12415
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -12417,7 +12417,7 @@ ${C}
12417
12417
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
12418
12418
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
12419
12419
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
12420
- </style>`}}});function Tn(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}var ps,Sh,uc=R(()=>{ps={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},Sh={name:"StxModal",aliases:["stx-modal"],render(e,t,r){let n=Tn(e,"id");if(!n)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let i=Je(n),s=Tn(e,"size")||"md",a=Tn(e,"closeOnBackdrop")!=="false",o=Tn(e,"closeOnEscape")!=="false",l=ps[s]||ps.md;return`<div id="stx-modal-${i}" class="stx-modal-backdrop" data-stx-modal="${i}" data-close-backdrop="${a}" data-close-escape="${o}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
12420
+ </style>`}}});function Rn(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}var hs,_h,dc=R(()=>{hs={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},_h={name:"StxModal",aliases:["stx-modal"],render(e,t,r){let n=Rn(e,"id");if(!n)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let i=Ye(n),s=Rn(e,"size")||"md",a=Rn(e,"closeOnBackdrop")!=="false",o=Rn(e,"closeOnEscape")!=="false",l=hs[s]||hs.md;return`<div id="stx-modal-${i}" class="stx-modal-backdrop" data-stx-modal="${i}" data-close-backdrop="${a}" data-close-escape="${o}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
12421
12421
  <div class="stx-modal-panel" style="${l};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
12422
12422
  <div style="padding:1.5rem">${t}</div>
12423
12423
  </div>
@@ -12426,7 +12426,7 @@ ${C}
12426
12426
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
12427
12427
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
12428
12428
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
12429
- </style>`}}});function or(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}var hs,_h,dc=R(()=>{hs={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},_h={name:"StxDrawer",aliases:["stx-drawer"],render(e,t,r){let n=or(e,"id");if(!n)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let i=Je(n),s=or(e,"side")||"right",a=or(e,"size")||"md",o=or(e,"closeOnBackdrop")!=="false",l=or(e,"closeOnEscape")!=="false",c=or(e,"overlay")!=="false",u=hs[a]||hs.md,d=s==="left",h=d?"left:0":"right:0",p=d?"translateX(-100%)":"translateX(100%)",f=d?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${i}" class="stx-drawer-backdrop" data-stx-drawer="${i}" data-close-backdrop="${o}" data-close-escape="${l}" style="display:none;position:fixed;inset:0;z-index:99999;${c?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
12429
+ </style>`}}});function lr(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let r=e.static[t];if(typeof r==="string")return r;return}var ms,kh,pc=R(()=>{ms={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},kh={name:"StxDrawer",aliases:["stx-drawer"],render(e,t,r){let n=lr(e,"id");if(!n)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let i=Ye(n),s=lr(e,"side")||"right",a=lr(e,"size")||"md",o=lr(e,"closeOnBackdrop")!=="false",l=lr(e,"closeOnEscape")!=="false",c=lr(e,"overlay")!=="false",u=ms[a]||ms.md,d=s==="left",h=d?"left:0":"right:0",p=d?"translateX(-100%)":"translateX(100%)",f=d?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${i}" class="stx-drawer-backdrop" data-stx-drawer="${i}" data-close-backdrop="${o}" data-close-escape="${l}" style="display:none;position:fixed;inset:0;z-index:99999;${c?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
12430
12430
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${h};width:${u};max-width:100vw;transform:${p};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
12431
12431
  <div style="padding:1.5rem">${t}</div>
12432
12432
  </div>
@@ -12435,18 +12435,18 @@ ${C}
12435
12435
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
12436
12436
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
12437
12437
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
12438
- </style>`}}});function O_(e){if(ia.has(e))return;ia.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function j_(e){let t=process.cwd();for(let r of[`${t}/node_modules/@iconify-json/${e}/icons.json`,`${t}/pantry/@iconify-json/${e}/icons.json`,`${t}/node_modules/@iconify/json/json/${e}.json`,`${t}/pantry/@iconify/json/json/${e}.json`])if(R_(r))return r;for(let r of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return Zn.resolve(r)}catch{}return null}function D_(e){if(rn.has(e))return rn.get(e);let t=j_(e);if(!t)return O_(e),null;try{let r=JSON.parse(I_(t,"utf8"));return rn.set(e,r.icons),r.icons}catch{return null}}function lr(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);if(e.static[t]!==void 0)return String(e.static[t]);if(e.clientReactive[t]!==void 0)return e.clientReactive[t];return}var rn,ia,kh,pc=R(()=>{rn=new Map,ia=new Set,kh={name:"Icon",aliases:["icon","stx-icon"],render(e,t,r){let n=lr(e,"name")??lr(e,"icon");if(!n)return"<!-- Icon: missing name/icon prop -->";let i="lucide",s=n;if(n.includes(":")){let v=n.split(":");i=v[0],s=v[1]}let a=Je(lr(e,"size")||"24"),o=Je(lr(e,"color")||"currentColor"),l=Je(lr(e,"class")||""),c=Je(lr(e,"style")||""),u=rn.get(i)??D_(i);if(!u)return`<!-- Icon: collection "${i}" not loaded -->`;let d=u[s];if(!d)return`<!-- Icon: "${s}" not found in ${i} -->`;let h=d.width||24,p=d.height||24,f=`0 0 ${h} ${p}`,m=d.body;if(o!=="currentColor")m=m.replace(/currentColor/g,o);let y=l?` class="${l}"`:"",g=c?` style="${c}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="${f}" fill="none"${y}${g}>${m}</svg>`}}});function fc(e,...t){for(let r of t){if(e.serverDynamic[r]!==void 0)return String(e.serverDynamic[r]);let n=e.static[r];if(typeof n==="string")return n}return}function hc(e,t){let r=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${t}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),n=e.match(r);if(!n)return{region:null,rest:e};return{region:n[2],rest:e.replace(n[0],"")}}var Eh,mc=R(()=>{Eh={name:"Suspense",aliases:["suspense"],render(e,t,r){let n=hc(t,"fallback"),i=n.rest,s=hc(i,"error"),a=s.rest,o=n.region??fc(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',l=s.region??fc(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${o}</div><div data-stx-suspense-error hidden>${l}</div><div data-stx-suspense-content hidden>${a}</div></div>`}}});function Rn(e,...t){for(let r of t){if(e.serverDynamic[r]!==void 0)return String(e.serverDynamic[r]);let n=e.static[r];if(typeof n==="string")return n}return}var Ah,gc=R(()=>{Ah={name:"TransitionGroup",aliases:["transition-group"],render(e,t,r){let n=(Rn(e,"name")||"v").replace(/["'<>]/g,""),i=(Rn(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",s=Rn(e,"class"),a=Rn(e,"id"),o=[`data-stx-transition-group="${n}"`,s?`class="${s}"`:"",a?`id="${a}"`:""].filter(Boolean).join(" ");return`<${i} ${o}>${t}</${i}>`}}});function $_(){je.registerBuiltin(mh),je.registerBuiltin(yh),je.registerBuiltin(vh),je.registerBuiltin(wh),je.registerBuiltin(xh),je.registerBuiltin(Sh),je.registerBuiltin(_h),je.registerBuiltin(kh),je.registerBuiltin(Eh),je.registerBuiltin(Ah)}var L_=R(()=>{rc(),ic(),oc(),lc(),cc(),uc(),dc(),pc(),mc(),gc(),hh(),rc(),ic(),oc(),lc(),cc(),uc(),dc(),pc(),mc(),gc()});function sa(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function N_(e,t,r){let n=[],i=0;while(i<e.length){let s=e.indexOf("<",i);if(s===-1)break;let a=e.slice(s+1).match(new RegExp(`^(${t.source})(?![\\w.:-])`));if(!a){i=s+1;continue}let o=a[1];if(r&&r.has(o.toLowerCase())){let f=s+1+o.length;while(f<e.length&&e[f]!==">")f++;i=f+1;continue}let l=s+1+o.length,c=null,u=l,d=-1,h=!1;while(l<e.length){let f=e[l];if(c){if(f==="\\"&&l+1<e.length){l+=2;continue}if(f===c)c=null;l++;continue}if(f==='"'||f==="'"){c=f,l++;continue}if(f==="/"&&l+1<e.length&&e[l+1]===">"){d=l+2,h=!0;break}if(f===">"){d=l+1;break}l++}if(d===-1){i=s+1;continue}let p=e.slice(u,h?d-2:d-1).trim();if(h)n.push({fullMatch:e.slice(s,d),tagName:o,attributes:p,content:"",startIndex:s,endIndex:d,isSelfClosing:!0}),i=d;else{let f=`<${o}`,m=`</${o}>`,y=1,g=d,v=-1;while(y>0&&g<e.length){let S=e.indexOf(f,g),x=e.indexOf(m,g);if(x===-1)break;if(S!==-1&&S<x){let _=e[S+f.length];if(_===" "||_===">"||_==="/"||_===`
12439
- `||_==="\t")y++;g=S+f.length}else{if(y--,y===0){v=x;break}g=x+m.length}}if(v===-1){i=d;continue}let w=e.slice(d,v),b=v+m.length;n.push({fullMatch:e.slice(s,b),tagName:o,attributes:p,content:w,startIndex:s,endIndex:b,isSelfClosing:!1}),i=b}}return n}function P_(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function M_(e,t){try{let r=Buffer.from(e,"base64").toString("utf8");return JSON.parse(r)}catch{}try{let r=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(r)}catch(r){if(t?.debug)console.error("Error decoding __stx_ prop:",r);return e}}var B_=R(()=>{Se(),Ce(),Lr()}),Ch={};Y(Ch,{processESImports:()=>Th,processComponents:()=>aa});function z_(e,t,r){let n={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},i=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),s=(c)=>{if(i.size===0)return!1;let u=Kt(c),d=u.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(d&&i.has(d))return!0;for(let h of i){let p=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${p}\\s*\\(`).test(u))return!0}return!1},a=new Set(ju),o=(c)=>{if(!c.includes("-")||c.startsWith("@")||c.startsWith(":")||c.startsWith("x-")||c.startsWith("__"))return c;if(c.startsWith("aria-")||c.startsWith("data-"))return c;return c.replace(/-([a-z0-9])/g,(u,d)=>d.toUpperCase())},l=(c,u)=>{let d=o(c);if(n.static[d]=u,d!==c)n.staticNames[d]=c};for(let[c,u]of Object.entries(e)){let d=c.startsWith("x-")&&!a.has(c)&&!c.startsWith("x-bind:")&&!c.startsWith("x-on:")?`:${c.slice(2)}`:c;if(d.startsWith("@")){n.events[d]=u;continue}if(d.startsWith("__stx_")){let h=o(d.slice(6));n.serverDynamic[h]=M_(u,r);continue}if(d.startsWith(":")){let h=o(d.slice(1)),p=u===cn?h:u;if(h==="if"||h==="for"||h==="show"){n.clientReactive[h]=p;continue}if(s(p)){n.clientReactive[h]=p;continue}try{if(!xe(p)){if(r.debug)console.error(`Unsafe expression in :${h} binding: ${p}`);n.clientReactive[h]=p;continue}let f=Object.keys(t),m=ge(p,f)(...Object.values(t));if(m===void 0){let y=p.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],g=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(y.some((v)=>!g.has(v)&&!f.includes(v))){n.clientReactive[h]=p;continue}}n.serverDynamic[h]=m}catch{n.clientReactive[h]=p}continue}if(typeof u==="string"&&u.includes("{{")&&u.includes("}}")){let h=u.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(h)try{let p=h[1];if(xe(p)){let f=ge(p,Object.keys(t))(...Object.values(t));l(d,f!=null?String(f):"")}else{if(r.debug)console.error(`Unsafe expression in ${d}: ${p}`);l(d,u)}}catch(p){if(r.debug)console.error(`Error evaluating expression for ${d}:`,p);l(d,u)}else{let p=u,f=/\{\{\s*([\s\S]+?)\s*\}\}/g,m;while((m=f.exec(u))!==null)try{let y=m[1];if(!xe(y)){if(r.debug)console.error(`Unsafe expression in ${d}: ${y}`);continue}let g=ge(y,Object.keys(t))(...Object.values(t));p=p.replace(m[0],String(g??""))}catch(y){if(r.debug)console.error(`Error evaluating expression in ${d}:`,y)}l(d,p)}continue}l(d,u===cn?"true":P_(u))}return n}function F_(e){let t={},r=0,n=e.length;while(r<n){while(r<n&&/\s/.test(e[r]))r++;if(r>=n)break;let i="";while(r<n&&!/[\s=]/.test(e[r]))i+=e[r],r++;if(!i)break;while(r<n&&/\s/.test(e[r]))r++;if(r<n&&e[r]==="="){r++;while(r<n&&/\s/.test(e[r]))r++;let s="";if(r<n&&(e[r]==='"'||e[r]==="'")){let a=e[r];r++;while(r<n){let o=e[r];if(o==="\\"&&r+1<n){r++,s+=e[r],r++;continue}if(o===a){r++;break}s+=o,r++}}else while(r<n&&!/\s/.test(e[r]))s+=e[r],r++;t[i]=s}else t[i]=cn}return t}function yc(e){return Object.entries(e).map(([t,r])=>r===cn?t:`${t}="${q_(r)}"`).join(" ")}function q_(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function W_(e){let t=new Set,r=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,n;while((n=r.exec(e))!==null){let i=n[1];if(je.isBuiltin(i))t.add(i)}return[...t].sort()}function H_(e){let t=oa.get(e);if(t)return t;let r=new Map,n=[Le.join(e,"src"),Le.join(e,"dist"),e];function i(s,a){if(a>6)return;let o;try{o=gi.readdirSync(s,{withFileTypes:!0})}catch{return}for(let l of o){let c=Le.join(s,l.name);if(l.isDirectory()){if(l.name==="node_modules"||l.name.startsWith("."))continue;i(c,a+1)}else if(l.isFile()&&l.name.endsWith(".stx")){let u=l.name.slice(0,-4);if(!r.has(u))r.set(u,c);let d=u.toLowerCase();if(!r.has(d))r.set(d,c);let h=u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!r.has(h))r.set(h,c)}}}for(let s of n)if(i(s,0),r.size>0)break;return oa.set(e,r),r}function U_(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let r=t;while(!0){let n=Le.join(r,"node_modules",e);try{if(gi.statSync(n).isDirectory())return n}catch{}let i=Le.dirname(r);if(i===r)return null;r=i}}async function Th(e,t,r,n,i){if(!e.includes("import"))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let s=t.__importedComponents,a=Le.dirname(r),o=e,l=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return o=o.replace(l,(c,u,d)=>{let h=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,p=d,f,m=[];while((f=h.exec(d))!==null){let[y,g,v,w]=f,b=null,S=null;if(w.startsWith(".")||w.startsWith("/")){let E=Le.resolve(a,w);if(E.endsWith(".stx"))S=E;else{let k=`${E}.stx`;try{if(gi.statSync(k).isFile())S=k}catch{try{if(gi.statSync(E).isDirectory())b=E}catch{}}}}else b=U_(w,a);if(!b&&!S)continue;let x=!1,_=(E,k)=>{s.set(E,k),s.set(E.toLowerCase(),k);let A=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();s.set(A,k),i.add(k)};if(v&&S)_(v,S),x=!0;else if(g){let E=g.slice(1,-1).split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>{let T=A.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:A,local:A}}),k=b?H_(b):null;for(let{source:A,local:T}of E){let C=null;if(S)C=S;else if(k)C=k.get(A)??k.get(A.toLowerCase())??k.get(A.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(C)_(T,C),x=!0}}if(x)m.push({start:f.index,end:f.index+y.length})}if(m.length===0)return c;for(let y=m.length-1;y>=0;y--)p=p.slice(0,m[y].start)+p.slice(m[y].end);return`<script${u}>${p}</script>`}),o}async function G_(e,t,r,n,i){let s=e;if(!t.__importedComponents)t.__importedComponents=new Map;let a=t.__importedComponents,o=/@import\s*\(\s*([^)]+)\s*\)/g,l;while((l=o.exec(s))!==null){let[c,u]=l,d=u.split(",").map((h)=>h.trim().replace(/^['"]|['"]$/g,"")).filter((h)=>h.length>0);for(let h of d){let p=h.split("/"),f=p[p.length-1].replace(/\.stx$/,""),m=f.includes("-")?f.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""):f.charAt(0).toUpperCase()+f.slice(1),y=null,g=[Le.resolve(Le.dirname(r),`${h}.stx`),Le.resolve(Le.dirname(r),h),Le.resolve(n.componentsDir||"components",`${h}.stx`),Le.resolve(n.componentsDir||"components",h),h.endsWith(".stx")?h:`${h}.stx`];for(let v of g)try{if(await Bun.file(v).exists()){y=v;break}}catch{}if(y){a.set(m,y),a.set(f,y),a.set(f.toLowerCase(),y);let v=m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(a.set(v,y),i.add(y),n.debug)console.log(`Imported component: ${m} -> ${y}`)}else if(n.debug)console.warn(`Could not resolve imported component: ${h}`)}s=s.replace(c,""),o.lastIndex=0}return s}async function V_(e,t,r,n,i){let s=e,a=n.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let o=t.__processedComponents,l=/@component\s*\(/g,c;while((c=l.exec(s))!==null){let u=c.index,d=u+c[0].length-1,h=1,p=d+1;while(p<s.length&&h>0){if(s[p]==="(")h++;else if(s[p]===")"){if(h--,h===0)break}p++}if(h!==0)break;let f=s.substring(d+1,p),m=p+1,y=f.match(/^\s*['"]([^'"]+)['"]/);if(!y){l.lastIndex=0;continue}let g=y[1],v,w=f.slice(y[0].length),b=w.match(/^\s*,\s*/);if(b)v=w.slice(b[0].length).trim();let S={};if(v)try{S=Ye(v,t)}catch(A){let T=A instanceof Error?A.message:String(A);s=s.replace(s.substring(u,m),`[Error parsing component props: ${T}]`);continue}let x="",_=m,E=s.substring(m).match(/^([\s\S]*?)@endcomponent/);if(E)x=E[1].trim(),_=m+E[0].length;let k=await Pi(g,S,x,a,t,r,n,o,i);s=s.substring(0,u)+k+s.substring(_),l.lastIndex=0}return s}async function J_(e,t,r,n,i){if(!e)return e;let s=e,a=n.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let o=t.__processedComponents,l=Oi(s);return s=l.output,s=await c(s,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),s=await c(s,/[A-Z][a-zA-Z0-9]*/,!0),s=await c(s,/[a-z][a-z0-9]*/,!1,Ih),s=ld(s,l.scripts),s;async function c(u,d,h,p){if(!u)return u;let f=u,m=N_(f,d,p);for(let y=m.length-1;y>=0;y--){let g=m[y],v=h?sa(g.tagName):g.tagName,w=F_(g.attributes),b=z_(w,t,n),S=je.getBuiltin(g.tagName),x=S?await Tl(v,a,t,r,n):!1;if(S&&!x){let k={context:t,filePath:r,options:n,dependencies:i},A=S.render(b,g.content,k);if(Object.keys(b.clientReactive).length>0)A=vc(A,b.clientReactive);if(Object.keys(b.events).length>0){let T=yc(b.events);A=A.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${T}`)}f=f.substring(0,g.startIndex)+A+f.substring(g.endIndex);continue}if(!h&&g.tagName.includes("-")&&!await Tl(v,a,t,r,n))continue;let _={};for(let[k,A]of Object.entries(b.static))_[k]=A;for(let[k,A]of Object.entries(b.serverDynamic))_[k]=A;let E=await Pi(v,_,g.content,a,t,r,n,o,i);if(Object.keys(b.clientReactive).length>0)E=vc(E,b.clientReactive);if(Object.keys(b.events).length>0){let k=Rh(E);if(k){let A=yc(b.events),T=Object.keys(b.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,k.insertPos)+` data-stx-parent-events="${T}" ${A}`+E.substring(k.insertPos)}}f=f.substring(0,g.startIndex)+E+f.substring(g.endIndex)}return f}}function vc(e,t){let r=new Set(["if","for"]),n=new Set(["show"]),i=Object.entries(t).filter(([u])=>!r.has(u)),s=i.filter(([u])=>!n.has(u)).map(([u])=>sa(u)).join(" "),a=e,o=i.length>0?Rh(a):null;if(o){let u=i.map(([h,p])=>`:${sa(h)}="${p.replace(/"/g,"&quot;")}"`).join(" "),d=s?` data-stx-parent-bindings="${s}"`:"";a=a.substring(0,o.insertPos)+`${d} ${u}`+a.substring(o.insertPos)}let l=t.if;if(l)a=`<template :if="${l.replace(/"/g,"&quot;")}">${a}</template>`;let c=t.for;if(c)a=`<template :for="${c.replace(/"/g,"&quot;")}">${a}</template>`;return a}function Rh(e){let t=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(t)return{insertPos:t.index+1+t[1].length};let r=0;while(r<e.length){let n=e.slice(r),i=n.match(/^\s+/);if(i){r+=i[0].length;continue}if(n.startsWith("<!--")){let o=e.indexOf("-->",r+4);if(o===-1)return null;r=o+3;continue}let s=n.match(/^<(script|style)\b[^>]*>/i);if(s){let o=`</${s[1].toLowerCase()}>`,l=e.toLowerCase().indexOf(o,r+s[0].length);if(l===-1)return null;r=l+o.length;continue}let a=n.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!a)return null;return{insertPos:r+1+a[1].length}}return null}async function aa(e,t,r,n,i){if(!wc)$_(),wc=!0;let s=await Th(e,t,r,n,i);s=await G_(s,t,r,n,i),s=await V_(s,t,r,n,i);let a=[];for(let o=0;o<3;o++){let l=Ar(s,Ga,(u,d)=>`\x00STX_COMPONENT_COMMENT_${a.length+d}\x00`);a.push(...l.tokens);let c=s;if(s=await J_(l.output,t,r,n,i),s===c)break}if(a.length>0)s=s.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(o,l)=>a[Number(l)]??"");if(n.debug){let o=W_(s);if(o.length>0)console.warn(`[stx] ${r}: unresolved component tag(s) after render passes: ${o.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return s}var wc=!1,Ih,oa,Oh=R(()=>{hh(),L_(),B_(),Lr(),Ce(),Se(),nt(),Ih=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]),oa=new Map}),jh={};Y(jh,{processLoops:()=>$h,parseLoopBinding:()=>Yo});function Y_(e,t){let r=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,n="",i=0,s;while((s=r.exec(e))!==null){let a=s.index+s[0].length,o=s.index+s[0].indexOf("("),l=Ke(e,"(",")",o);if(l===-1)continue;let c=e.slice(a,l).trim();if(!c)continue;if(!Object.keys(t).some((d)=>new RegExp(`(?:^|[^\\w$.])${d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(c)))continue;let u;try{let d=Ye(c,t);if(!d||typeof d!=="object")continue;u=JSON.stringify(d)}catch{continue}n+=e.slice(i,a)+u,i=l,r.lastIndex=l}return i===0?e:n+e.slice(i)}function K_(e,t){let r=/@component\s*\(/g,n=e,i,s=[];while((i=r.exec(n))!==null){let a=i.index,o=a+i[0].length-1,l=1,c=o+1;while(c<n.length&&l>0){if(n[c]==="(")l++;else if(n[c]===")"){if(l--,l===0)break}c++}if(l!==0)continue;let u=n.substring(o+1,c),d=c+1,h=u.match(/^\s*['"]([^'"]+)['"]/);if(!h)continue;let p=h[1],f=u.slice(h[0].length),m=f.match(/^\s*,\s*/);if(!m)continue;let y=f.slice(m[0].length).trim();if(!y)continue;try{let g=Ye(y,t),v=JSON.stringify(g),w=`@component('${p}', ${v})`;s.push({start:a,end:d,replacement:w})}catch{continue}}for(let a=s.length-1;a>=0;a--){let{start:o,end:l,replacement:c}=s[a];n=n.substring(0,o)+c+n.substring(l)}return n}function yi(e,t,r){let n=e,i=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=i.exec(n))!==null){let a=s.index,o=a+s[0].length-1,l=1,c=o+1,u=null,d=!1;while(c<n.length&&l>0){let f=n[c];if(d){d=!1,c++;continue}if(f==="\\"&&u){d=!0,c++;continue}if(u){if(f===u)u=null;c++;continue}if(f==='"'||f==="'"||f==="`"){u=f,c++;continue}if(f==="(")l++;else if(f===")"){if(l--,l===0)break}c++}if(l!==0)break;let h=n.substring(o+1,c),p=r(h);n=n.substring(0,a)+p+n.substring(c+1)}return n}function Z_(e,t){let r=e;return r=r.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(n,i)=>{if(i in t)return`:${i}="${i}"`;return n}),r=r.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(n,i,s)=>{try{let a=Object.keys(t),o=Object.values(t);za(s);let l=ge(s,a)(...o),c=JSON.stringify(l),u=Buffer.from(c,"utf8").toString("base64");return`__stx_${i}="${u}"`}catch(a){return n}}),r}function Q_(e,t){let r=e;return r=yi(r,"@break",(n)=>{try{let i=`!!(${n.trim()})`,s;if(xe(i)){let a=ge(i,Object.keys(t));s=Boolean(a(...Object.values(t)))}else s=Boolean(pe(i,t));return s?vi:""}catch{return""}}),r=yi(r,"@continue",(n)=>{try{let i=`!!(${n.trim()})`,s;if(xe(i)){let a=ge(i,Object.keys(t));s=Boolean(a(...Object.values(t)))}else s=Boolean(pe(i,t));return s?wi:""}catch{return""}}),r}function X_(e){let t=e;return t=t.replace(/@break(?!\()/g,vi),t=t.replace(/@continue(?!\()/g,wi),t}function bc(e){let t=e.includes(vi),r=t?e.substring(0,e.indexOf(vi)):e;return{hasBreak:t,content:r}}function xc(e){let t=e.includes(wi),r=t?e.substring(0,e.indexOf(wi)):e;return{hasContinue:t,content:r}}function Dh(e){let t=e;return t=yi(t,"@break",(r)=>{let n=r.trim();if(!Is(n))return"";return`\`; if (${n}) { break; } result += \``}),t=yi(t,"@continue",(r)=>{let n=r.trim();if(!Is(n))return"";return`\`; if (${n}) { continue; } result += \``}),t=t.replace(/@break(?!\()/g,"`; break; result += `"),t=t.replace(/@continue(?!\()/g,"`; continue; result += `"),t}function ek(e){let t=/@forelse\s*\(/g,r,n=[],i=/@foreach\s*\(/g,s=/@endforeach/g,a;while((a=i.exec(e))!==null)n.push({pos:a.index,delta:1});while((a=s.exec(e))!==null)n.push({pos:a.index,delta:-1});n.sort((u,d)=>u.pos-d.pos);let o=[],l=0;for(let u of n)l+=u.delta,o.push({pos:u.pos,depth:l});function c(u){let d=0,h=o.length-1,p=0;while(d<=h){let f=d+h>>1;if(o[f].pos<=u)p=o[f].depth,d=f+1;else h=f-1}return p}while((r=t.exec(e))!==null){if(c(r.index)>0)continue;let u=r.index,d=r.index+r[0].length-1,h=1,p=d+1,f=-1;while(p<e.length&&h>0){if(e[p]==="(")h++;else if(e[p]===")"){if(h--,h===0){f=p;break}}p++}if(f===-1)continue;let m=e.substring(d+1,f),y=Yo(m);if(!y)continue;let{arrayExpr:g,itemVar:v}=y,w=f+1,b=1,S=w,x=/@forelse\s*\(/g,_=/@endforelse/g,E=-1;while(b>0&&S<e.length){x.lastIndex=S,_.lastIndex=S;let I=x.exec(e),O=_.exec(e);if(!O)break;if(I&&I.index<O.index)b++,S=I.index+I[0].length;else{if(b--,b===0){E=O.index;break}S=O.index+11}}if(E===-1)continue;let k=e.substring(w,E),A=E+11,T=-1,C=0,D=0;while(D<k.length){let I=k.indexOf("@",D);if(I===-1)break;let O=k.substring(I);if(/^@forelse\s*\(/.test(O))C++,D=I+1;else if(O.startsWith("@endforelse"))C--,D=I+11;else if(C===0&&O.startsWith("@empty")){if(k.length<=I+6||!/[a-z]/i.test(k[I+6])){T=I;break}D=I+1}else D=I+1}if(T===-1)continue;return{start:u,end:A,arrayExpr:g,itemVar:v,foreachContent:k.substring(0,T),emptyContent:k.substring(T+6)}}return null}function Sc(e,t){let r=e;while(!0){let n=ek(r);if(!n)break;let{start:i,end:s,arrayExpr:a,itemVar:o,foreachContent:l,emptyContent:c}=n;try{let u;if(xe(a))u=ge(a,Object.keys(t))(...Object.values(t));else u=pe(a,t);let d;if(!Array.isArray(u)||u.length===0)d=c;else d=`@foreach (${a} as ${o})${l}@endforeach`;r=r.substring(0,i)+d+r.substring(s)}catch(u){let d=u instanceof Error?u.message:String(u),h=oe("Forelse",`Error in @forelse(${a} as ${o}): ${d}`,re.EVALUATION_ERROR);r=r.substring(0,i)+h+r.substring(s)}}return r}function Yo(e){let t=e.indexOf(" as ");if(t!==-1){let s=e.slice(0,t).trim(),a=e.slice(t+4).trim();return s&&a?{arrayExpr:s,itemVar:a}:null}let r=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!r)return null;let n=r[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),i=r[2].trim();return n&&i?{arrayExpr:i,itemVar:n}:null}function $h(e,t,r,n){let i=e;i=Sc(i,t);function s(l){let c=/@foreach\s*\(/g,u;while((u=c.exec(l))!==null){let d=u.index,h=u.index+u[0].length-1,p=1,f=h+1,m=-1;while(f<l.length&&p>0){if(l[f]==="(")p++;else if(l[f]===")"){if(p--,p===0){m=f;break}}f++}if(m===-1)continue;let y=l.substring(h+1,m),g=Yo(y);if(!g)continue;let v=d,{arrayExpr:w,itemVar:b}=g,S=m+1,x=1,_=S,E=/@foreach\s*\(/g,k=/@endforeach/g;while(x>0&&_<l.length){E.lastIndex=_,k.lastIndex=_;let A=E.exec(l),T=k.exec(l);if(!T)break;if(A&&A.index<T.index)x++,_=A.index+A[0].length;else{if(x--,x===0){let C=l.substring(S,T.index),D=T.index+11;return{start:v,end:D,arrayExpr:w,itemVar:b,content:C}}_=T.index+11}}}return null}function a(l,c){let u=l;while(!0){let d=s(u);if(!d)break;let{start:h,end:p,arrayExpr:f,itemVar:m,content:y}=d;try{let g=f.trim(),v;if(xe(g))v=ge(g,Object.keys(c))(...Object.values(c));else v=pe(g,c);let w=!1;if(!Array.isArray(v))if(v instanceof Map)v=Array.from(v),w=!0;else if(v instanceof Set)v=Array.from(v);else if(typeof v==="string")v=Array.from(v);else if(v&&typeof v==="object"&&!(v instanceof Date)&&!(v instanceof RegExp))v=Object.entries(v),w=!0;else{console.warn(`[stx] @foreach(${g}) in ${r}: ${g} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let T=oe("Foreach",`Error in @foreach: ${g} is not iterable`,re.TYPE_ERROR);u=u.substring(0,h)+T+u.substring(p);continue}let b=n?.loops?.useAltLoopVariable??sk,S=m.trim(),x=null,_,E=!1;if(S.includes("=>")){let T=S.split("=>").map((C)=>C.trim());if(T.length===2&&T[0]&&T[1])x=T[0],_=T[1];else _=S}else if(!S.startsWith("[")&&!S.startsWith("{")&&S.includes(",")){let T=S.split(",").map((C)=>C.trim());if(T.length===2&&T[0]&&T[1])_=T[0],x=T[1],E=!0;else _=S}else _=S;let k="",A=v;for(let T=0;T<A.length;T++){let C=A[T],D={index:T,iteration:T+1,first:T===0,last:T===A.length-1,count:A.length},I={...c,loop:D,$loop:D};if(_.startsWith("[")&&_.endsWith("]")){let B=_.slice(1,-1).split(",").map((F)=>F.trim());if(Array.isArray(C))B.forEach((F,K)=>{if(F)I[F]=C[K]});else I[_]=C}else I[_]=C;if(x)if(!E&&w&&Array.isArray(C)&&C.length===2)I[x]=C[0],I[_]=C[1];else I[x]=T;let O=Q_(y,I),L=xc(O);if(L.hasContinue){k+=L.content;continue}let N=bc(O);if(N.hasBreak){k+=N.content;break}if(O=Sc(O,I),O=a(O,I),O=Ui(O,I,r),O=X_(O),N=bc(O),N.hasBreak){k+=N.content;break}if(L=xc(O),L.hasContinue){k+=L.content;continue}O=fn(O,I,r),O=Z_(O,I),O=K_(O,I),O=Y_(O,I),k+=O}u=u.substring(0,h)+k+u.substring(p)}catch(g){let v=oe("Foreach",`Error in @foreach(${f.trim()} as ${m.trim()}): ${g instanceof Error?g.message:String(g)}`,re.EVALUATION_ERROR);u=u.substring(0,h)+v+u.substring(p)}}return u}i=a(i,t),i=Nh(i,t,r,n);let o=n?.loops?.maxWhileIterations??ik;return i=nk(i,t,o),i}function Lh(e){return Is(e)}function Nh(e,t,r,n){let i=e,s=!0;while(s){s=!1;let a=i.match(/@for\s*\(/);if(!a||a.index===void 0)break;let o=a.index,l=o+a[0].length-1,c=Ke(i,"(",")",l);if(c===-1)break;let u=i.slice(l+1,c),d=c+1,h=Ud(i.slice(o),"for","endfor");if(h.length===0)break;let p=h[0].content,f=o+h[0].end;if(!Lh(u)){let m=oe("For",`Unsafe expression in @for: ${u}`,re.UNSAFE_EXPRESSION);i=i.substring(0,o)+m+i.substring(f),s=!0;continue}try{let m=tk(u),y=/@(?:for|foreach|if|unless)\s*\(/.test(p);if(m.length>0&&y){let S=rk({forExpr:u,content:p,iterVarNames:m,context:t,filePath:r,options:n});i=i.substring(0,o)+S+i.substring(f),s=!0;continue}let g=Object.keys(t),v=Object.values(t),w=p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(S,x)=>{return`\${${x}}`});w=Dh(w);let b=Function(...g,`
12438
+ </style>`}}});function j_(e){if(sa.has(e))return;sa.add(e),console.warn(`[stx] icon collection "${e}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${e}\`.`)}function D_(e){let t=process.cwd();for(let r of[`${t}/node_modules/@iconify-json/${e}/icons.json`,`${t}/pantry/@iconify-json/${e}/icons.json`,`${t}/node_modules/@iconify/json/json/${e}.json`,`${t}/pantry/@iconify/json/json/${e}.json`])if(I_(r))return r;for(let r of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return Qn.resolve(r)}catch{}return null}function $_(e){if(nn.has(e))return nn.get(e);let t=D_(e);if(!t)return j_(e),null;try{let r=JSON.parse(O_(t,"utf8"));return nn.set(e,r.icons),r.icons}catch{return null}}function cr(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);if(e.static[t]!==void 0)return String(e.static[t]);if(e.clientReactive[t]!==void 0)return e.clientReactive[t];return}var nn,sa,Eh,fc=R(()=>{nn=new Map,sa=new Set,Eh={name:"Icon",aliases:["icon","stx-icon"],render(e,t,r){let n=cr(e,"name")??cr(e,"icon");if(!n)return"<!-- Icon: missing name/icon prop -->";let i="lucide",s=n;if(n.includes(":")){let v=n.split(":");i=v[0],s=v[1]}let a=Ye(cr(e,"size")||"24"),o=Ye(cr(e,"color")||"currentColor"),l=Ye(cr(e,"class")||""),c=Ye(cr(e,"style")||""),u=nn.get(i)??$_(i);if(!u)return`<!-- Icon: collection "${i}" not loaded -->`;let d=u[s];if(!d)return`<!-- Icon: "${s}" not found in ${i} -->`;let h=d.width||24,p=d.height||24,f=`0 0 ${h} ${p}`,m=d.body;if(o!=="currentColor")m=m.replace(/currentColor/g,o);let y=l?` class="${l}"`:"",g=c?` style="${c}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${a}" viewBox="${f}" fill="none"${y}${g}>${m}</svg>`}}});function hc(e,...t){for(let r of t){if(e.serverDynamic[r]!==void 0)return String(e.serverDynamic[r]);let n=e.static[r];if(typeof n==="string")return n}return}function mc(e,t){let r=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${t}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),n=e.match(r);if(!n)return{region:null,rest:e};return{region:n[2],rest:e.replace(n[0],"")}}var Ah,gc=R(()=>{Ah={name:"Suspense",aliases:["suspense"],render(e,t,r){let n=mc(t,"fallback"),i=n.rest,s=mc(i,"error"),a=s.rest,o=n.region??hc(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',l=s.region??hc(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${o}</div><div data-stx-suspense-error hidden>${l}</div><div data-stx-suspense-content hidden>${a}</div></div>`}}});function In(e,...t){for(let r of t){if(e.serverDynamic[r]!==void 0)return String(e.serverDynamic[r]);let n=e.static[r];if(typeof n==="string")return n}return}var Ch,yc=R(()=>{Ch={name:"TransitionGroup",aliases:["transition-group"],render(e,t,r){let n=(In(e,"name")||"v").replace(/["'<>]/g,""),i=(In(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",s=In(e,"class"),a=In(e,"id"),o=[`data-stx-transition-group="${n}"`,s?`class="${s}"`:"",a?`id="${a}"`:""].filter(Boolean).join(" ");return`<${i} ${o}>${t}</${i}>`}}});function L_(){De.registerBuiltin(gh),De.registerBuiltin(vh),De.registerBuiltin(wh),De.registerBuiltin(bh),De.registerBuiltin(Sh),De.registerBuiltin(_h),De.registerBuiltin(kh),De.registerBuiltin(Eh),De.registerBuiltin(Ah),De.registerBuiltin(Ch)}var N_=R(()=>{nc(),sc(),lc(),cc(),uc(),dc(),pc(),fc(),gc(),yc(),mh(),nc(),sc(),lc(),cc(),uc(),dc(),pc(),fc(),gc(),yc()});function aa(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function P_(e,t,r){let n=[],i=0;while(i<e.length){let s=e.indexOf("<",i);if(s===-1)break;let a=e.slice(s+1).match(new RegExp(`^(${t.source})(?![\\w.:-])`));if(!a){i=s+1;continue}let o=a[1];if(r&&r.has(o.toLowerCase())){let f=s+1+o.length;while(f<e.length&&e[f]!==">")f++;i=f+1;continue}let l=s+1+o.length,c=null,u=l,d=-1,h=!1;while(l<e.length){let f=e[l];if(c){if(f==="\\"&&l+1<e.length){l+=2;continue}if(f===c)c=null;l++;continue}if(f==='"'||f==="'"){c=f,l++;continue}if(f==="/"&&l+1<e.length&&e[l+1]===">"){d=l+2,h=!0;break}if(f===">"){d=l+1;break}l++}if(d===-1){i=s+1;continue}let p=e.slice(u,h?d-2:d-1).trim();if(h)n.push({fullMatch:e.slice(s,d),tagName:o,attributes:p,content:"",startIndex:s,endIndex:d,isSelfClosing:!0}),i=d;else{let f=`<${o}`,m=`</${o}>`,y=1,g=d,v=-1;while(y>0&&g<e.length){let S=e.indexOf(f,g),x=e.indexOf(m,g);if(x===-1)break;if(S!==-1&&S<x){let _=e[S+f.length];if(_===" "||_===">"||_==="/"||_===`
12439
+ `||_==="\t")y++;g=S+f.length}else{if(y--,y===0){v=x;break}g=x+m.length}}if(v===-1){i=d;continue}let w=e.slice(d,v),b=v+m.length;n.push({fullMatch:e.slice(s,b),tagName:o,attributes:p,content:w,startIndex:s,endIndex:b,isSelfClosing:!1}),i=b}}return n}function M_(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function B_(e,t){try{let r=Buffer.from(e,"base64").toString("utf8");return JSON.parse(r)}catch{}try{let r=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(r)}catch(r){if(t?.debug)console.error("Error decoding __stx_ prop:",r);return e}}var z_=R(()=>{_e(),Te(),Nr()}),Th={};K(Th,{processESImports:()=>Rh,processComponents:()=>oa});function F_(e,t,r){let n={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},i=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),s=(c)=>{if(i.size===0)return!1;let u=Zt(c),d=u.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(d&&i.has(d))return!0;for(let h of i){let p=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${p}\\s*\\(`).test(u))return!0}return!1},a=new Set(Du),o=(c)=>{if(!c.includes("-")||c.startsWith("@")||c.startsWith(":")||c.startsWith("x-")||c.startsWith("__"))return c;if(c.startsWith("aria-")||c.startsWith("data-"))return c;return c.replace(/-([a-z0-9])/g,(u,d)=>d.toUpperCase())},l=(c,u)=>{let d=o(c);if(n.static[d]=u,d!==c)n.staticNames[d]=c};for(let[c,u]of Object.entries(e)){let d=c.startsWith("x-")&&!a.has(c)&&!c.startsWith("x-bind:")&&!c.startsWith("x-on:")?`:${c.slice(2)}`:c;if(d.startsWith("@")){n.events[d]=u;continue}if(d.startsWith("__stx_")){let h=o(d.slice(6));n.serverDynamic[h]=B_(u,r);continue}if(d.startsWith(":")){let h=o(d.slice(1)),p=u===un?h:u;if(h==="if"||h==="for"||h==="show"){n.clientReactive[h]=p;continue}if(s(p)){n.clientReactive[h]=p;continue}try{if(!Se(p)){if(r.debug)console.error(`Unsafe expression in :${h} binding: ${p}`);n.clientReactive[h]=p;continue}let f=Object.keys(t),m=ye(p,f)(...Object.values(t));if(m===void 0){let y=p.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],g=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(y.some((v)=>!g.has(v)&&!f.includes(v))){n.clientReactive[h]=p;continue}}n.serverDynamic[h]=m}catch{n.clientReactive[h]=p}continue}if(typeof u==="string"&&u.includes("{{")&&u.includes("}}")){let h=u.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(h)try{let p=h[1];if(Se(p)){let f=ye(p,Object.keys(t))(...Object.values(t));l(d,f!=null?String(f):"")}else{if(r.debug)console.error(`Unsafe expression in ${d}: ${p}`);l(d,u)}}catch(p){if(r.debug)console.error(`Error evaluating expression for ${d}:`,p);l(d,u)}else{let p=u,f=/\{\{\s*([\s\S]+?)\s*\}\}/g,m;while((m=f.exec(u))!==null)try{let y=m[1];if(!Se(y)){if(r.debug)console.error(`Unsafe expression in ${d}: ${y}`);continue}let g=ye(y,Object.keys(t))(...Object.values(t));p=p.replace(m[0],String(g??""))}catch(y){if(r.debug)console.error(`Error evaluating expression in ${d}:`,y)}l(d,p)}continue}l(d,u===un?"true":M_(u))}return n}function q_(e){let t={},r=0,n=e.length;while(r<n){while(r<n&&/\s/.test(e[r]))r++;if(r>=n)break;let i="";while(r<n&&!/[\s=]/.test(e[r]))i+=e[r],r++;if(!i)break;while(r<n&&/\s/.test(e[r]))r++;if(r<n&&e[r]==="="){r++;while(r<n&&/\s/.test(e[r]))r++;let s="";if(r<n&&(e[r]==='"'||e[r]==="'")){let a=e[r];r++;while(r<n){let o=e[r];if(o==="\\"&&r+1<n){r++,s+=e[r],r++;continue}if(o===a){r++;break}s+=o,r++}}else while(r<n&&!/\s/.test(e[r]))s+=e[r],r++;t[i]=s}else t[i]=un}return t}function vc(e){return Object.entries(e).map(([t,r])=>r===un?t:`${t}="${W_(r)}"`).join(" ")}function W_(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H_(e){let t=new Set,r=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,n;while((n=r.exec(e))!==null){let i=n[1];if(De.isBuiltin(i))t.add(i)}return[...t].sort()}function U_(e){let t=la.get(e);if(t)return t;let r=new Map,n=[Ne.join(e,"src"),Ne.join(e,"dist"),e];function i(s,a){if(a>6)return;let o;try{o=yi.readdirSync(s,{withFileTypes:!0})}catch{return}for(let l of o){let c=Ne.join(s,l.name);if(l.isDirectory()){if(l.name==="node_modules"||l.name.startsWith("."))continue;i(c,a+1)}else if(l.isFile()&&l.name.endsWith(".stx")){let u=l.name.slice(0,-4);if(!r.has(u))r.set(u,c);let d=u.toLowerCase();if(!r.has(d))r.set(d,c);let h=u.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!r.has(h))r.set(h,c)}}}for(let s of n)if(i(s,0),r.size>0)break;return la.set(e,r),r}function G_(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let r=t;while(!0){let n=Ne.join(r,"node_modules",e);try{if(yi.statSync(n).isDirectory())return n}catch{}let i=Ne.dirname(r);if(i===r)return null;r=i}}async function Rh(e,t,r,n,i){if(!e.includes("import"))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let s=t.__importedComponents,a=Ne.dirname(r),o=e,l=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return o=o.replace(l,(c,u,d)=>{let h=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,p=d,f,m=[];while((f=h.exec(d))!==null){let[y,g,v,w]=f,b=null,S=null;if(w.startsWith(".")||w.startsWith("/")){let E=Ne.resolve(a,w);if(E.endsWith(".stx"))S=E;else{let k=`${E}.stx`;try{if(yi.statSync(k).isFile())S=k}catch{try{if(yi.statSync(E).isDirectory())b=E}catch{}}}}else b=G_(w,a);if(!b&&!S)continue;let x=!1,_=(E,k)=>{s.set(E,k),s.set(E.toLowerCase(),k);let A=E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();s.set(A,k),i.add(k)};if(v&&S)_(v,S),x=!0;else if(g){let E=g.slice(1,-1).split(",").map((A)=>A.trim()).filter(Boolean).map((A)=>{let T=A.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:A,local:A}}),k=b?U_(b):null;for(let{source:A,local:T}of E){let C=null;if(S)C=S;else if(k)C=k.get(A)??k.get(A.toLowerCase())??k.get(A.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(C)_(T,C),x=!0}}if(x)m.push({start:f.index,end:f.index+y.length})}if(m.length===0)return c;for(let y=m.length-1;y>=0;y--)p=p.slice(0,m[y].start)+p.slice(m[y].end);return`<script${u}>${p}</script>`}),o}async function V_(e,t,r,n,i){let s=e;if(!t.__importedComponents)t.__importedComponents=new Map;let a=t.__importedComponents,o=/@import\s*\(\s*([^)]+)\s*\)/g,l;while((l=o.exec(s))!==null){let[c,u]=l,d=u.split(",").map((h)=>h.trim().replace(/^['"]|['"]$/g,"")).filter((h)=>h.length>0);for(let h of d){let p=h.split("/"),f=p[p.length-1].replace(/\.stx$/,""),m=f.includes("-")?f.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""):f.charAt(0).toUpperCase()+f.slice(1),y=null,g=[Ne.resolve(Ne.dirname(r),`${h}.stx`),Ne.resolve(Ne.dirname(r),h),Ne.resolve(n.componentsDir||"components",`${h}.stx`),Ne.resolve(n.componentsDir||"components",h),h.endsWith(".stx")?h:`${h}.stx`];for(let v of g)try{if(await Bun.file(v).exists()){y=v;break}}catch{}if(y){a.set(m,y),a.set(f,y),a.set(f.toLowerCase(),y);let v=m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(a.set(v,y),i.add(y),n.debug)console.log(`Imported component: ${m} -> ${y}`)}else if(n.debug)console.warn(`Could not resolve imported component: ${h}`)}s=s.replace(c,""),o.lastIndex=0}return s}async function J_(e,t,r,n,i){let s=e,a=n.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let o=t.__processedComponents,l=/@component\s*\(/g,c;while((c=l.exec(s))!==null){let u=c.index,d=u+c[0].length-1,h=1,p=d+1;while(p<s.length&&h>0){if(s[p]==="(")h++;else if(s[p]===")"){if(h--,h===0)break}p++}if(h!==0)break;let f=s.substring(d+1,p),m=p+1,y=f.match(/^\s*['"]([^'"]+)['"]/);if(!y){l.lastIndex=0;continue}let g=y[1],v,w=f.slice(y[0].length),b=w.match(/^\s*,\s*/);if(b)v=w.slice(b[0].length).trim();let S={};if(v)try{S=Ke(v,t)}catch(A){let T=A instanceof Error?A.message:String(A);s=s.replace(s.substring(u,m),`[Error parsing component props: ${T}]`);continue}let x="",_=m,E=s.substring(m).match(/^([\s\S]*?)@endcomponent/);if(E)x=E[1].trim(),_=m+E[0].length;let k=await Mi(g,S,x,a,t,r,n,o,i);s=s.substring(0,u)+k+s.substring(_),l.lastIndex=0}return s}async function Y_(e,t,r,n,i){if(!e)return e;let s=e,a=n.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let o=t.__processedComponents,l=ji(s);return s=l.output,s=await c(s,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),s=await c(s,/[A-Z][a-zA-Z0-9]*/,!0),s=await c(s,/[a-z][a-z0-9]*/,!1,Oh),s=cd(s,l.scripts),s;async function c(u,d,h,p){if(!u)return u;let f=u,m=P_(f,d,p);for(let y=m.length-1;y>=0;y--){let g=m[y],v=h?aa(g.tagName):g.tagName,w=q_(g.attributes),b=F_(w,t,n),S=De.getBuiltin(g.tagName),x=S?await Rl(v,a,t,r,n):!1;if(S&&!x){let k={context:t,filePath:r,options:n,dependencies:i},A=S.render(b,g.content,k);if(Object.keys(b.clientReactive).length>0)A=wc(A,b.clientReactive);if(Object.keys(b.events).length>0){let T=vc(b.events);A=A.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${T}`)}f=f.substring(0,g.startIndex)+A+f.substring(g.endIndex);continue}if(!h&&g.tagName.includes("-")&&!await Rl(v,a,t,r,n))continue;let _={};for(let[k,A]of Object.entries(b.static))_[k]=A;for(let[k,A]of Object.entries(b.serverDynamic))_[k]=A;let E=await Mi(v,_,g.content,a,t,r,n,o,i);if(Object.keys(b.clientReactive).length>0)E=wc(E,b.clientReactive);if(Object.keys(b.events).length>0){let k=Ih(E);if(k){let A=vc(b.events),T=Object.keys(b.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");E=E.substring(0,k.insertPos)+` data-stx-parent-events="${T}" ${A}`+E.substring(k.insertPos)}}f=f.substring(0,g.startIndex)+E+f.substring(g.endIndex)}return f}}function wc(e,t){let r=new Set(["if","for"]),n=new Set(["show"]),i=Object.entries(t).filter(([u])=>!r.has(u)),s=i.filter(([u])=>!n.has(u)).map(([u])=>aa(u)).join(" "),a=e,o=i.length>0?Ih(a):null;if(o){let u=i.map(([h,p])=>`:${aa(h)}="${p.replace(/"/g,"&quot;")}"`).join(" "),d=s?` data-stx-parent-bindings="${s}"`:"";a=a.substring(0,o.insertPos)+`${d} ${u}`+a.substring(o.insertPos)}let l=t.if;if(l)a=`<template :if="${l.replace(/"/g,"&quot;")}">${a}</template>`;let c=t.for;if(c)a=`<template :for="${c.replace(/"/g,"&quot;")}">${a}</template>`;return a}function Ih(e){let t=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(t)return{insertPos:t.index+1+t[1].length};let r=0;while(r<e.length){let n=e.slice(r),i=n.match(/^\s+/);if(i){r+=i[0].length;continue}if(n.startsWith("<!--")){let o=e.indexOf("-->",r+4);if(o===-1)return null;r=o+3;continue}let s=n.match(/^<(script|style)\b[^>]*>/i);if(s){let o=`</${s[1].toLowerCase()}>`,l=e.toLowerCase().indexOf(o,r+s[0].length);if(l===-1)return null;r=l+o.length;continue}let a=n.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!a)return null;return{insertPos:r+1+a[1].length}}return null}async function oa(e,t,r,n,i){if(!bc)L_(),bc=!0;let s=await Rh(e,t,r,n,i);s=await V_(s,t,r,n,i),s=await J_(s,t,r,n,i);let a=[];for(let o=0;o<3;o++){let l=Cr(s,Va,(u,d)=>`\x00STX_COMPONENT_COMMENT_${a.length+d}\x00`);a.push(...l.tokens);let c=s;if(s=await Y_(l.output,t,r,n,i),s===c)break}if(a.length>0)s=s.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(o,l)=>a[Number(l)]??"");if(n.debug){let o=H_(s);if(o.length>0)console.warn(`[stx] ${r}: unresolved component tag(s) after render passes: ${o.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return s}var bc=!1,Oh,la,jh=R(()=>{mh(),N_(),z_(),Nr(),Te(),_e(),it(),Oh=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]),la=new Map}),Dh={};K(Dh,{processLoops:()=>Lh,parseLoopBinding:()=>Ko});function K_(e,t){let r=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,n="",i=0,s;while((s=r.exec(e))!==null){let a=s.index+s[0].length,o=s.index+s[0].indexOf("("),l=Ze(e,"(",")",o);if(l===-1)continue;let c=e.slice(a,l).trim();if(!c)continue;if(!Object.keys(t).some((d)=>new RegExp(`(?:^|[^\\w$.])${d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(c)))continue;let u;try{let d=Ke(c,t);if(!d||typeof d!=="object")continue;u=JSON.stringify(d)}catch{continue}n+=e.slice(i,a)+u,i=l,r.lastIndex=l}return i===0?e:n+e.slice(i)}function Z_(e,t){let r=/@component\s*\(/g,n=e,i,s=[];while((i=r.exec(n))!==null){let a=i.index,o=a+i[0].length-1,l=1,c=o+1;while(c<n.length&&l>0){if(n[c]==="(")l++;else if(n[c]===")"){if(l--,l===0)break}c++}if(l!==0)continue;let u=n.substring(o+1,c),d=c+1,h=u.match(/^\s*['"]([^'"]+)['"]/);if(!h)continue;let p=h[1],f=u.slice(h[0].length),m=f.match(/^\s*,\s*/);if(!m)continue;let y=f.slice(m[0].length).trim();if(!y)continue;try{let g=Ke(y,t),v=JSON.stringify(g),w=`@component('${p}', ${v})`;s.push({start:a,end:d,replacement:w})}catch{continue}}for(let a=s.length-1;a>=0;a--){let{start:o,end:l,replacement:c}=s[a];n=n.substring(0,o)+c+n.substring(l)}return n}function vi(e,t,r){let n=e,i=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=i.exec(n))!==null){let a=s.index,o=a+s[0].length-1,l=1,c=o+1,u=null,d=!1;while(c<n.length&&l>0){let f=n[c];if(d){d=!1,c++;continue}if(f==="\\"&&u){d=!0,c++;continue}if(u){if(f===u)u=null;c++;continue}if(f==='"'||f==="'"||f==="`"){u=f,c++;continue}if(f==="(")l++;else if(f===")"){if(l--,l===0)break}c++}if(l!==0)break;let h=n.substring(o+1,c),p=r(h);n=n.substring(0,a)+p+n.substring(c+1)}return n}function Q_(e,t){let r=e;return r=r.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(n,i)=>{if(i in t)return`:${i}="${i}"`;return n}),r=r.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(n,i,s)=>{try{let a=Object.keys(t),o=Object.values(t);Fa(s);let l=ye(s,a)(...o),c=JSON.stringify(l),u=Buffer.from(c,"utf8").toString("base64");return`__stx_${i}="${u}"`}catch(a){return n}}),r}function X_(e,t){let r=e;return r=vi(r,"@break",(n)=>{try{let i=`!!(${n.trim()})`,s;if(Se(i)){let a=ye(i,Object.keys(t));s=Boolean(a(...Object.values(t)))}else s=Boolean(fe(i,t));return s?wi:""}catch{return""}}),r=vi(r,"@continue",(n)=>{try{let i=`!!(${n.trim()})`,s;if(Se(i)){let a=ye(i,Object.keys(t));s=Boolean(a(...Object.values(t)))}else s=Boolean(fe(i,t));return s?bi:""}catch{return""}}),r}function ek(e){let t=e;return t=t.replace(/@break(?!\()/g,wi),t=t.replace(/@continue(?!\()/g,bi),t}function xc(e){let t=e.includes(wi),r=t?e.substring(0,e.indexOf(wi)):e;return{hasBreak:t,content:r}}function Sc(e){let t=e.includes(bi),r=t?e.substring(0,e.indexOf(bi)):e;return{hasContinue:t,content:r}}function $h(e){let t=e;return t=vi(t,"@break",(r)=>{let n=r.trim();if(!Os(n))return"";return`\`; if (${n}) { break; } result += \``}),t=vi(t,"@continue",(r)=>{let n=r.trim();if(!Os(n))return"";return`\`; if (${n}) { continue; } result += \``}),t=t.replace(/@break(?!\()/g,"`; break; result += `"),t=t.replace(/@continue(?!\()/g,"`; continue; result += `"),t}function tk(e){let t=/@forelse\s*\(/g,r,n=[],i=/@foreach\s*\(/g,s=/@endforeach/g,a;while((a=i.exec(e))!==null)n.push({pos:a.index,delta:1});while((a=s.exec(e))!==null)n.push({pos:a.index,delta:-1});n.sort((u,d)=>u.pos-d.pos);let o=[],l=0;for(let u of n)l+=u.delta,o.push({pos:u.pos,depth:l});function c(u){let d=0,h=o.length-1,p=0;while(d<=h){let f=d+h>>1;if(o[f].pos<=u)p=o[f].depth,d=f+1;else h=f-1}return p}while((r=t.exec(e))!==null){if(c(r.index)>0)continue;let u=r.index,d=r.index+r[0].length-1,h=1,p=d+1,f=-1;while(p<e.length&&h>0){if(e[p]==="(")h++;else if(e[p]===")"){if(h--,h===0){f=p;break}}p++}if(f===-1)continue;let m=e.substring(d+1,f),y=Ko(m);if(!y)continue;let{arrayExpr:g,itemVar:v}=y,w=f+1,b=1,S=w,x=/@forelse\s*\(/g,_=/@endforelse/g,E=-1;while(b>0&&S<e.length){x.lastIndex=S,_.lastIndex=S;let I=x.exec(e),O=_.exec(e);if(!O)break;if(I&&I.index<O.index)b++,S=I.index+I[0].length;else{if(b--,b===0){E=O.index;break}S=O.index+11}}if(E===-1)continue;let k=e.substring(w,E),A=E+11,T=-1,C=0,D=0;while(D<k.length){let I=k.indexOf("@",D);if(I===-1)break;let O=k.substring(I);if(/^@forelse\s*\(/.test(O))C++,D=I+1;else if(O.startsWith("@endforelse"))C--,D=I+11;else if(C===0&&O.startsWith("@empty")){if(k.length<=I+6||!/[a-z]/i.test(k[I+6])){T=I;break}D=I+1}else D=I+1}if(T===-1)continue;return{start:u,end:A,arrayExpr:g,itemVar:v,foreachContent:k.substring(0,T),emptyContent:k.substring(T+6)}}return null}function _c(e,t){let r=e;while(!0){let n=tk(r);if(!n)break;let{start:i,end:s,arrayExpr:a,itemVar:o,foreachContent:l,emptyContent:c}=n;try{let u;if(Se(a))u=ye(a,Object.keys(t))(...Object.values(t));else u=fe(a,t);let d;if(!Array.isArray(u)||u.length===0)d=c;else d=`@foreach (${a} as ${o})${l}@endforeach`;r=r.substring(0,i)+d+r.substring(s)}catch(u){let d=u instanceof Error?u.message:String(u),h=le("Forelse",`Error in @forelse(${a} as ${o}): ${d}`,ne.EVALUATION_ERROR);r=r.substring(0,i)+h+r.substring(s)}}return r}function Ko(e){let t=e.indexOf(" as ");if(t!==-1){let s=e.slice(0,t).trim(),a=e.slice(t+4).trim();return s&&a?{arrayExpr:s,itemVar:a}:null}let r=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!r)return null;let n=r[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),i=r[2].trim();return n&&i?{arrayExpr:i,itemVar:n}:null}function Lh(e,t,r,n){let i=e;i=_c(i,t);function s(l){let c=/@foreach\s*\(/g,u;while((u=c.exec(l))!==null){let d=u.index,h=u.index+u[0].length-1,p=1,f=h+1,m=-1;while(f<l.length&&p>0){if(l[f]==="(")p++;else if(l[f]===")"){if(p--,p===0){m=f;break}}f++}if(m===-1)continue;let y=l.substring(h+1,m),g=Ko(y);if(!g)continue;let v=d,{arrayExpr:w,itemVar:b}=g,S=m+1,x=1,_=S,E=/@foreach\s*\(/g,k=/@endforeach/g;while(x>0&&_<l.length){E.lastIndex=_,k.lastIndex=_;let A=E.exec(l),T=k.exec(l);if(!T)break;if(A&&A.index<T.index)x++,_=A.index+A[0].length;else{if(x--,x===0){let C=l.substring(S,T.index),D=T.index+11;return{start:v,end:D,arrayExpr:w,itemVar:b,content:C}}_=T.index+11}}}return null}function a(l,c){let u=l;while(!0){let d=s(u);if(!d)break;let{start:h,end:p,arrayExpr:f,itemVar:m,content:y}=d;try{let g=f.trim(),v;if(Se(g))v=ye(g,Object.keys(c))(...Object.values(c));else v=fe(g,c);let w=!1;if(!Array.isArray(v))if(v instanceof Map)v=Array.from(v),w=!0;else if(v instanceof Set)v=Array.from(v);else if(typeof v==="string")v=Array.from(v);else if(v&&typeof v==="object"&&!(v instanceof Date)&&!(v instanceof RegExp))v=Object.entries(v),w=!0;else{console.warn(`[stx] @foreach(${g}) in ${r}: ${g} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let T=le("Foreach",`Error in @foreach: ${g} is not iterable`,ne.TYPE_ERROR);u=u.substring(0,h)+T+u.substring(p);continue}let b=n?.loops?.useAltLoopVariable??ak,S=m.trim(),x=null,_,E=!1;if(S.includes("=>")){let T=S.split("=>").map((C)=>C.trim());if(T.length===2&&T[0]&&T[1])x=T[0],_=T[1];else _=S}else if(!S.startsWith("[")&&!S.startsWith("{")&&S.includes(",")){let T=S.split(",").map((C)=>C.trim());if(T.length===2&&T[0]&&T[1])_=T[0],x=T[1],E=!0;else _=S}else _=S;let k="",A=v;for(let T=0;T<A.length;T++){let C=A[T],D={index:T,iteration:T+1,first:T===0,last:T===A.length-1,count:A.length},I={...c,loop:D,$loop:D};if(_.startsWith("[")&&_.endsWith("]")){let z=_.slice(1,-1).split(",").map((q)=>q.trim());if(Array.isArray(C))z.forEach((q,Z)=>{if(q)I[q]=C[Z]});else I[_]=C}else I[_]=C;if(x)if(!E&&w&&Array.isArray(C)&&C.length===2)I[x]=C[0],I[_]=C[1];else I[x]=T;let O=X_(y,I),N=Sc(O);if(N.hasContinue){k+=N.content;continue}let P=xc(O);if(P.hasBreak){k+=P.content;break}if(O=_c(O,I),O=a(O,I),O=Gi(O,I,r),O=ek(O),P=xc(O),P.hasBreak){k+=P.content;break}if(N=Sc(O),N.hasContinue){k+=N.content;continue}O=hn(O,I,r),O=Q_(O,I),O=Z_(O,I),O=K_(O,I),k+=O}u=u.substring(0,h)+k+u.substring(p)}catch(g){let v=le("Foreach",`Error in @foreach(${f.trim()} as ${m.trim()}): ${g instanceof Error?g.message:String(g)}`,ne.EVALUATION_ERROR);u=u.substring(0,h)+v+u.substring(p)}}return u}i=a(i,t),i=Ph(i,t,r,n);let o=n?.loops?.maxWhileIterations??sk;return i=ik(i,t,o),i}function Nh(e){return Os(e)}function Ph(e,t,r,n){let i=e,s=!0;while(s){s=!1;let a=i.match(/@for\s*\(/);if(!a||a.index===void 0)break;let o=a.index,l=o+a[0].length-1,c=Ze(i,"(",")",l);if(c===-1)break;let u=i.slice(l+1,c),d=c+1,h=Gd(i.slice(o),"for","endfor");if(h.length===0)break;let p=h[0].content,f=o+h[0].end;if(!Nh(u)){let m=le("For",`Unsafe expression in @for: ${u}`,ne.UNSAFE_EXPRESSION);i=i.substring(0,o)+m+i.substring(f),s=!0;continue}try{let m=rk(u),y=/@(?:for|foreach|if|unless)\s*\(/.test(p);if(m.length>0&&y){let S=nk({forExpr:u,content:p,iterVarNames:m,context:t,filePath:r,options:n});i=i.substring(0,o)+S+i.substring(f),s=!0;continue}let g=Object.keys(t),v=Object.values(t),w=p.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(S,x)=>`\${${x}}`);w=$h(w);let b=Function(...g,`
12440
12440
  let result = '';
12441
12441
  for (${u}) {
12442
12442
  result += \`${w}\`;
12443
12443
  }
12444
12444
  return result;
12445
- `)(...v);i=i.substring(0,o)+b+i.substring(f),s=!0}catch(m){let y=oe("For",`Error in @for(${u}): ${m instanceof Error?m.message:String(m)}`,re.EVALUATION_ERROR);i=i.substring(0,o)+y+i.substring(f),s=!0}}return i}function tk(e){let t=e.trim(),r=t.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(r){let s=r[1];return s.slice(1,-1).split(",").map((a)=>{let o=a.trim();if(!o)return"";let l=o.indexOf(":");if(l>=0&&s.startsWith("{")){let d=o.slice(l+1).trim(),h=d.indexOf("=");return(h>=0?d.slice(0,h):d).trim()}let c=o.indexOf("="),u=(c>=0?o.slice(0,c):o).trim();return/^[A-Za-z_$][\w$]*$/.test(u)?u:""}).filter(Boolean)}let n=t.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(n)return[n[1]];let i=t.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(i)return[i[1]];return[]}function rk(e){let{forExpr:t,content:r,iterVarNames:n,context:i,filePath:s,options:a}=e,o=Object.keys(i),l=Object.values(i),c=Function(...o,"__pushIter",`
12445
+ `)(...v);i=i.substring(0,o)+b+i.substring(f),s=!0}catch(m){let y=le("For",`Error in @for(${u}): ${m instanceof Error?m.message:String(m)}`,ne.EVALUATION_ERROR);i=i.substring(0,o)+y+i.substring(f),s=!0}}return i}function rk(e){let t=e.trim(),r=t.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(r){let s=r[1];return s.slice(1,-1).split(",").map((a)=>{let o=a.trim();if(!o)return"";let l=o.indexOf(":");if(l>=0&&s.startsWith("{")){let d=o.slice(l+1).trim(),h=d.indexOf("=");return(h>=0?d.slice(0,h):d).trim()}let c=o.indexOf("="),u=(c>=0?o.slice(0,c):o).trim();return/^[A-Za-z_$][\w$]*$/.test(u)?u:""}).filter(Boolean)}let n=t.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(n)return[n[1]];let i=t.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(i)return[i[1]];return[]}function nk(e){let{forExpr:t,content:r,iterVarNames:n,context:i,filePath:s,options:a}=e,o=Object.keys(i),l=Object.values(i),c=Function(...o,"__pushIter",`
12446
12446
  for (${t}) {
12447
12447
  __pushIter([${n.join(", ")}])
12448
12448
  }
12449
- `),u=[];c(...l,(p)=>{u.push(p)});let d=s??"inline.stx",h="";for(let p of u){let f={...i};n.forEach((y,g)=>{f[y]=p[g]});let m=Nh(r,f,s,a);m=Ui(m,f,d),m=fn(m,f,d),h+=m}return h}function nk(e,t,r){let n=e,i=!0;while(i){i=!1;let s=n.match(/@while\s*\(/);if(!s||s.index===void 0)break;let a=s.index,o=a+s[0].length-1,l=Ke(n,"(",")",o);if(l===-1)break;let c=n.slice(o+1,l),u=Ud(n.slice(a),"while","endwhile");if(u.length===0)break;let d=u[0].content,h=a+u[0].end;if(!Lh(c)){let p=oe("While",`Unsafe expression in @while: ${c}`,re.UNSAFE_EXPRESSION);n=n.substring(0,a)+p+n.substring(h),i=!0;continue}try{let p=Object.keys(t),f=Object.values(t),m=d.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(g,v)=>{return`\${${v}}`});m=Dh(m);let y=Function(...p,`
12449
+ `),u=[];c(...l,(p)=>{u.push(p)});let d=s??"inline.stx",h="";for(let p of u){let f={...i};n.forEach((y,g)=>{f[y]=p[g]});let m=Ph(r,f,s,a);m=Gi(m,f,d),m=hn(m,f,d),h+=m}return h}function ik(e,t,r){let n=e,i=!0;while(i){i=!1;let s=n.match(/@while\s*\(/);if(!s||s.index===void 0)break;let a=s.index,o=a+s[0].length-1,l=Ze(n,"(",")",o);if(l===-1)break;let c=n.slice(o+1,l),u=Gd(n.slice(a),"while","endwhile");if(u.length===0)break;let d=u[0].content,h=a+u[0].end;if(!Nh(c)){let p=le("While",`Unsafe expression in @while: ${c}`,ne.UNSAFE_EXPRESSION);n=n.substring(0,a)+p+n.substring(h),i=!0;continue}try{let p=Object.keys(t),f=Object.values(t),m=d.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(g,v)=>`\${${v}}`);m=$h(m);let y=Function(...p,`
12450
12450
  let result = '';
12451
12451
  let maxIterations = ${r}; // Configurable safety limit
12452
12452
  let counter = 0;
@@ -12458,21 +12458,21 @@ ${C}
12458
12458
  result += '<!-- [While Error [1104]]: Maximum iterations (${r}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
12459
12459
  }
12460
12460
  return result;
12461
- `)(...f);n=n.substring(0,a)+y+n.substring(h),i=!0}catch(p){let f=oe("While",`Error in @while(${c}): ${p instanceof Error?p.message:String(p)}`,re.EVALUATION_ERROR);n=n.substring(0,a)+f+n.substring(h),i=!0}}return n}var ik=1000,sk=!1,vi="<!--__STX_BREAK__-->",wi="<!--__STX_CONTINUE__-->",Ph=R(()=>{zo(),kt(),ut(),to(),Se()});function ms(e,t){let r=0;for(let n=t;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")r++;else if(i===")"||i==="]"||i==="}")r--;else if(i===","&&r===0)return n}return-1}function ak(e,t,r){let n=e,i=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=i.exec(n);while(s){let a=s.index,o=a+s[0].length-1,l=1,c=o+1;while(c<n.length&&l>0){if(n[c]==="(")l++;else if(n[c]===")")l--;c++}if(l!==0)break;let u=n.substring(o+1,c-1),d=`${r}(${u})`;n=n.substring(0,a)+d+n.substring(c),i.lastIndex=a+d.length,s=i.exec(n)}return n}function ok(e){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(e)}function Mh(e){let t=e,r=[],n=new Set,i=0,s=0,a=t.length,o=(d)=>{s++;while(s<a){if(t[s]==="\\"){s+=2;continue}if(t[s]===d){s++;return}s++}},l=()=>{s++;while(s<a){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let d=1;while(s<a&&d>0)if(t[s]==="{")d++,s++;else if(t[s]==="}")d--,s++;else if(t[s]==="'"||t[s]==='"')o(t[s]);else if(t[s]==="`")l();else s++;continue}s++}},c=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<a&&t[s]!==`
12462
- `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<a-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},u=()=>{if(i!==0)return;let d=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(d){let f=d[2];if(!n.has(f))r.push(f),n.add(f);return}let h=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(h){let f=h[1];if(!n.has(f))r.push(f),n.add(f);return}let p=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(p){let f=p[1];if(!n.has(f))r.push(f),n.add(f)}};while(s<a){if(c())continue;if(t[s]==="'"||t[s]==='"'){o(t[s]);continue}if(t[s]==="`"){l();continue}if(t[s]==="{"){i++,s++;continue}if(t[s]==="}"){i--,s++;continue}if(i===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))u();s++}return r.join(", ")}function Bh(e,t=""){let r=Mh(e).split(",").map((n)=>n.trim()).filter(Boolean);return`
12461
+ `)(...f);n=n.substring(0,a)+y+n.substring(h),i=!0}catch(p){let f=le("While",`Error in @while(${c}): ${p instanceof Error?p.message:String(p)}`,ne.EVALUATION_ERROR);n=n.substring(0,a)+f+n.substring(h),i=!0}}return n}var sk=1000,ak=!1,wi="<!--__STX_BREAK__-->",bi="<!--__STX_CONTINUE__-->",Mh=R(()=>{Fo(),Et(),dt(),ro(),_e()});function gs(e,t){let r=0;for(let n=t;n<e.length;n++){let i=e[n];if(i==="("||i==="["||i==="{")r++;else if(i===")"||i==="]"||i==="}")r--;else if(i===","&&r===0)return n}return-1}function ok(e,t,r){let n=e,i=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=i.exec(n);while(s){let a=s.index,o=a+s[0].length-1,l=1,c=o+1;while(c<n.length&&l>0){if(n[c]==="(")l++;else if(n[c]===")")l--;c++}if(l!==0)break;let u=n.substring(o+1,c-1),d=`${r}(${u})`;n=n.substring(0,a)+d+n.substring(c),i.lastIndex=a+d.length,s=i.exec(n)}return n}function lk(e){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(e)}function Bh(e){let t=e,r=[],n=new Set,i=0,s=0,a=t.length,o=(d)=>{s++;while(s<a){if(t[s]==="\\"){s+=2;continue}if(t[s]===d){s++;return}s++}},l=()=>{s++;while(s<a){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let d=1;while(s<a&&d>0)if(t[s]==="{")d++,s++;else if(t[s]==="}")d--,s++;else if(t[s]==="'"||t[s]==='"')o(t[s]);else if(t[s]==="`")l();else s++;continue}s++}},c=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<a&&t[s]!==`
12462
+ `)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<a-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},u=()=>{if(i!==0)return;let d=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(d){let f=d[2];if(!n.has(f))r.push(f),n.add(f);return}let h=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(h){let f=h[1];if(!n.has(f))r.push(f),n.add(f);return}let p=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(p){let f=p[1];if(!n.has(f))r.push(f),n.add(f)}};while(s<a){if(c())continue;if(t[s]==="'"||t[s]==='"'){o(t[s]);continue}if(t[s]==="`"){l();continue}if(t[s]==="{"){i++,s++;continue}if(t[s]==="}"){i--,s++;continue}if(i===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))u();s++}return r.join(", ")}function zh(e,t=""){let r=Bh(e).split(",").map((n)=>n.trim()).filter(Boolean);return`
12463
12463
  (function() {
12464
- ${Ta("var",r)}
12464
+ ${Ra("var",r)}
12465
12465
  var __destroyHooks = [];
12466
12466
  var __origOnDestroy = onDestroy;
12467
12467
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
12468
12468
 
12469
12469
  ${e}
12470
12470
  ${t}})();
12471
- `}function zh(e,t){return`
12471
+ `}function Fh(e,t){return`
12472
12472
  // Register scope variables for STX runtime
12473
12473
  if (!window.stx._scopes) window.stx._scopes = {};
12474
12474
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
12475
- ${Mh(e).split(",").map((r)=>r.trim()).filter(Boolean).map((r)=>` try { __scopeRegistration[${JSON.stringify(r)}] = ${r}; } catch (e) { /* not actually top-level */ }`).join(`
12475
+ ${Bh(e).split(",").map((r)=>r.trim()).filter(Boolean).map((r)=>` try { __scopeRegistration[${JSON.stringify(r)}] = ${r}; } catch (e) { /* not actually top-level */ }`).join(`
12476
12476
  `)}
12477
12477
  // #1767: when the bundler renamed a component const that collided with an
12478
12478
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -12480,7 +12480,7 @@ ${Mh(e).split(",").map((r)=>r.trim()).filter(Boolean).map((r)=>` try { __scopeR
12480
12480
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
12481
12481
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
12482
12482
  window.stx._scopes['${t}'] = __scopeRegistration;
12483
- `}function lk(e,t){let r=zh(e,t),n=`
12483
+ `}function ck(e,t){let r=Fh(e,t),n=`
12484
12484
  (function() {
12485
12485
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${t}"]') : null;
12486
12486
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -12489,37 +12489,37 @@ ${Mh(e).split(",").map((r)=>r.trim()).filter(Boolean).map((r)=>` try { __scopeR
12489
12489
  } finally {
12490
12490
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12491
12491
  }
12492
- })();`;return n+Bh(e,r)+`
12492
+ })();`;return n+zh(e,r)+`
12493
12493
  } finally {
12494
12494
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12495
12495
  }
12496
- })();`}function ck(e,t){let r=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let n=(r[2]+r[3]).match(/data-stx-scope="([^"]*)"/);if(n)return{html:e,mergedIntoExisting:n[1]};let i=r[1],s=r[2],a=r[3];return{html:`${i}${s} data-stx-scope="${t}"${a}${e.slice(r[0].length)}`,mergedIntoExisting:null}}return{html:e,mergedIntoExisting:null}}function uk(e){if(e.__onceStore instanceof Set)return e.__onceStore;return qh}async function Fh(e,t,r,n,i,s=new Set){let a=n.partialsDir||le.join(le.dirname(r),"partials");if(a&&!le.isAbsolute(a))a=le.resolve(process.cwd(),a);let o=ak(e,"@partial","@include"),l=uk(t);o=o.replace(/@once([\s\S]*?)@endonce/g,(m,y,g)=>{let v=y.trim(),w=`${r}:${v}`;if(l.has(w))return"";return l.add(w),y});{let m=/@includeIf\s*\(/g,y;while((y=m.exec(o))!==null){let g=y.index,v=g+y[0].length-1,w=1,b=v+1;while(b<o.length&&w>0){if(o[b]==="(")w++;else if(o[b]===")")w--;b++}if(w!==0)break;let S=o.substring(v+1,b-1),x=S.match(/^\s*['"]([^'"]+)['"]/);if(!x){m.lastIndex=b;continue}let _=x[1],E=c(_,a,r),k="";if(E&&await Bun.file(E).exists())i.add(E),k=`@include(${S})`;o=o.substring(0,g)+k+o.substring(b),m.lastIndex=0}}for(let[m,y]of[["@includeWhen",!1],["@includeUnless",!0]]){let g=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),v;while((v=g.exec(o))!==null){let w=v.index,b=w+v[0].length-1,S=1,x=b+1;while(x<o.length&&S>0){if(o[x]==="(")S++;else if(o[x]===")")S--;x++}if(S!==0)break;let _=o.substring(b+1,x-1),E=ms(_,0);if(E===-1){g.lastIndex=x;continue}let k=_.substring(0,E).trim(),A=_.substring(E+1).trim(),T=A.match(/^\s*['"]([^'"]+)['"]/);if(!T){g.lastIndex=x;continue}let C=T[1],D=A.substring(T[0].length),I,O=ms(D,0);if(O!==-1)I=D.substring(O+1).trim();try{let L=`Boolean(${k})`,N;if(xe(L)){let K=ge(L,Object.keys(t));N=Boolean(K(...Object.values(t)))}else N=Boolean(pe(L,t));let B=y?!N:N,F="";if(B){let K=c(C,a,r);if(K&&await Bun.file(K).exists())i.add(K);F=`@include('${C}'${I?`, ${I}`:""})`}o=o.substring(0,w)+F+o.substring(x),g.lastIndex=0}catch(L){let N=L instanceof Error?L.message:String(L),B=Ae("Include",`Error evaluating ${m} condition: ${N}`,r,e,w);o=o.substring(0,w)+B+o.substring(x),g.lastIndex=0}}}{let m=/@each\s*\(/g,y;while((y=m.exec(o))!==null){let g=y.index,v=g+y[0].length-1,w=1,b=v+1;while(b<o.length&&w>0){if(o[b]==="(")w++;else if(o[b]===")"){if(w--,w===0)break}b++}if(w!==0)break;let S=o.substring(v+1,b),x=o.substring(g,b+1),_=S.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!_){m.lastIndex=0,o=o.replace(x,"");continue}let[,E,k,A,T]=_;try{let C,D=k.trim();if(xe(D))C=ge(D,Object.keys(t))(...Object.values(t));else C=pe(D,t);let I="";if(Array.isArray(C)&&C.length>0)for(let O of C){let L={...t,[A]:O},N=await h(E,L,e,g);I+=N}else if(T)I=await h(T,{},e,g);o=o.substring(0,g)+I+o.substring(b+1),m.lastIndex=0}catch(C){let D=C instanceof Error?C.message:String(C);o=o.substring(0,g)+Ae("Each",`Error in @each: ${D}`,r,e,g)+o.substring(b+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,y;while((y=m.exec(o))!==null){let g=y.index,v=g+y[0].length-1,w=1,b=v+1;while(b<o.length&&w>0){if(o[b]==="(")w++;else if(o[b]===")"){if(w--,w===0)break}b++}if(w!==0)break;let S=o.substring(v+1,b),x=o.substring(g,b+1),_=S.match(/^\s*(\[[^\]]+\])/);if(!_){m.lastIndex=0,o=o.replace(x,"");continue}let E=_[1],k=S.slice(_[0].length),A,T=k.match(/^\s*,\s*\{/);if(T){k=k.slice(T[0].length-1);let I=1,O=1;while(O<k.length&&I>0){if(k[O]==="{")I++;else if(k[O]==="}"){if(I--,I===0)break}O++}A=k.substring(0,O+1),k=k.slice(O+1)}let C,D=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)C=D[1];try{let I=JSON.parse(E.replace(/'/g,'"')),O={};if(A)try{O=Ye(A,t)}catch(N){let B=N instanceof Error?N.message:String(N);if(n.debug){let F=Ae("Include",`Error parsing includeFirst variables: ${B}`,r,e,g,x);o=o.replace(x,()=>F)}else o=o.replace(x,()=>C||"");continue}let L=!1;for(let N of I){let B=c(N,a,r);if(!B)continue;if(await Q(B)){let F=await h(N,O,e,g);o=o.replace(x,()=>F),L=!0;break}}if(!L)if(C!==void 0)o=o.replace(x,()=>C);else if(n.debug){let N=Ae("Include",`None of the includeFirst paths exist: ${E}`,r,e,g,x);o=o.replace(x,()=>N)}else o=o.replace(x,"")}catch(I){let O=I instanceof Error?I.message:String(I),L=Ae("Include",`Error processing @includeFirst: ${O}`,r,e,g,x);o=o.replace(x,()=>L)}m.lastIndex=0}}function c(m,y,g){try{let v=m;if(!m.endsWith(".stx"))v=`${m}.stx`;let w=le.resolve(y),b=le.resolve(le.dirname(g)),S;if(!v.startsWith("./")&&!v.startsWith("../"))S=le.resolve(y,v);else S=le.resolve(b,v);let x=le.normalize(S),_=x.startsWith(w+le.sep)||x===w,E=x.startsWith(b+le.sep)||x===b,k=!1,A=le.dirname(b);if(x.startsWith(A+le.sep)){if(!le.relative(A,x).split(le.sep).some((T)=>T.startsWith(".")&&T!=="."&&T!==".."))k=!0}if(!_&&!E&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${x}`),console.error(` Allowed dirs: ${w}, ${b}`),null;return x}catch(v){return console.error(`Error resolving path ${m}: ${v}`),null}}let u=le.resolve(r);s.add(u);function d(m,y,g,v){return n.onIncludeError?.({includePath:m,templatePath:r,message:y,partialsDir:a}),Ae("Include",y,r,g,v)}async function h(m,y={},g,v){let w=c(m,a,r);if(!w)return d(m,`Could not resolve path for include: ${m}`,g,v);let b=le.resolve(w);if(s.has(b)){let S=[...s,b].map((x)=>le.basename(x)).join(" -> ");return d(m,`Circular include detected: ${S}`,g,v)}try{i.add(w);let S;if(!S)try{S=await Bun.file(w).text()}catch(N){let B=N instanceof Error?N.message:String(N);return d(m,`Error loading include file ${m}: ${B}`,g,v)}if(S)S=S.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(S&&S.includes("@stream")){let{processStreamDirectives:N}=await Promise.resolve().then(()=>(ah(),Wo));S=N(S,t)}if(S&&(n.debug||!jo()&&!Tf()))try{let{warnUnbalancedTags:N}=await Promise.resolve().then(()=>(ph(),oh));N(S,w)}catch{}let x=S;try{let{processESImports:N}=await Promise.resolve().then(()=>(Oh(),Ch));await N(S,t,w,n,i)}catch(N){if(n.debug)console.warn(`[stx] partial ES import extraction skipped for ${w}:`,N instanceof Error?N.message:N)}let _=xd(x);if(_)x=_.content.trim();let E=S.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(E)k=`<style${E[1]}>${E[2]}</style>`;x=x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),x=x.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...t};A.__stx_signals_gate=Nr(S);for(let[N,B]of Object.entries(y))A[N]=B;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...S.matchAll(T)],D="",I=null;for(let N of C){let B=N[1]||"",F=N[2]||"",K=B.includes("server"),Te=Li(B),ae="";try{let{extractAndStripCssImports:z,renderVendorStyleTags:G}=await Promise.resolve().then(()=>(Ii(),Vu)),ve=z(F,{filePath:w,projectRoot:process.cwd()});F=ve.code,ae=G(ve.styles)}catch(z){if(n.debug)console.warn(`[stx] vendor-css extractor skipped for ${w}:`,z instanceof Error?z.message:z)}if(Te&&F.trim())F=Ni(F);if(!K)try{let{hasUserImports:z,bundleClientScript:G}=await Promise.resolve().then(()=>(Ti(),pn));if(z(F))F=await G(F,w,{projectRoot:process.cwd()})}catch(z){if(n.debug)console.warn(`[stx] bundler skipped for ${w}:`,z instanceof Error?z.message:z)}let ye=ok(F);if(ye&&!K){I=`stx_scope_${le.basename(w,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Ec}`;let z=Ut(F),G=lk(z,I);D+=`${ae}<script data-stx-scoped data-stx-run="always">${G}</script>
12497
- `;continue}if(K)try{let{extractVariables:z}=await Promise.resolve().then(()=>(Di(),ji));await z(F,A,w)}catch(z){if(n.debug)console.warn(`Warning: Could not extract variables from server script in ${w}:`,z)}if(!K&&!ye){let z=B.replace(/\bclient\b/i,"").trim();I=`stx_scope_${le.basename(w,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Ec}`;let G=Ut(F),ve=zh(G,I),Ie=Bh(G,ve);D+=`${ae}<script data-stx-scoped data-stx-run="always"${z?` ${z}`:""}>${Ie}</script>
12498
- `}}if(I){let N=ck(x,I);if(x=N.html,N.mergedIntoExisting)D=D.replace(`window.stx._scopes['${I}']`,`window.stx._scopes['${N.mergedIntoExisting}']`),I=N.mergedIntoExisting}if(x.includes("@include")||x.includes("@partial"))x=await Fh(x,A,w,n,i,s);let{processLoops:O}=await Promise.resolve().then(()=>(Ph(),jh)),L=O(x,A,w);if(L=Ui(L,A,w),L=fn(L,A,w),k)L+=`
12499
- `+k;if(D)L+=`
12500
- `+D;return L}catch(S){let x=S instanceof Error?S.message:String(S);return d(m,`Error processing include ${m}: ${x}`,g,v)}}let p=/@include\s*\(/g,f;while((f=p.exec(o))!==null){let m=f.index,y=m+f[0].length-1,g=1,v=y+1;while(v<o.length&&g>0){if(o[v]==="(")g++;else if(o[v]===")")g--;v++}if(g!==0)break;let w=o.substring(m,v),b=o.substring(y+1,v-1),S=b.match(/^\s*['"]([^'"]+)['"]/);if(!S){p.lastIndex=v;continue}let x=S[1],_,E=b.substring(S[0].length),k=ms(E,0);if(k!==-1)_=E.substring(k+1).trim();let A={};if(_)try{A=Ye(_,t)}catch(C){let D=C instanceof Error?C.message:String(C);o=o.replace(w,Ae("Include",`Error parsing include variables for ${x}: ${D}`,r,e,m)),p.lastIndex=0;continue}let T=await h(x,A,e,m);o=o.substring(0,m)+T+o.substring(v),p.lastIndex=0}return o}function _c(e,t){let r=e;function n(i,s,a,o){let l=i,c=!0;while(c){c=!1;let u=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),d=l.match(u);if(!d||d.index===void 0)break;let h=d.index,p=d[1],f=h+d[0].length,m=new RegExp(`@${s}\\(`),y=new RegExp(`@${a}(?![a-z])`),g=1,v=f,w=-1;while(g>0&&v<l.length){let S=l.slice(v),x=S.match(m),_=S.match(y),E=x?v+x.index:1/0,k=_?v+_.index:1/0;if(E<k)g++,v=E+(x[0].length||1);else if(k<1/0){if(g--,g===0){w=k;break}v=k+a.length+1}else break}if(w===-1)break;let b=l.slice(f,w);if(!t[p])t[p]=[];if(o)t[p].unshift(b);else t[p].push(b);l=l.substring(0,h)+l.substring(w+`@${a}`.length),c=!0}return l}return r=n(r,"push","endpush",!1),r=n(r,"prepend","endprepend",!0),r}function kc(e,t){return e.replace(/@stack\(['"]([^'"]+)['"]\)/g,(r,n)=>{if(!t[n]||t[n].length===0)return"";return t[n].join(`
12501
- `)})}var Ec=0,dk,qh,pk=R(()=>{_d(),zo(),ut(),nt(),hn(),Se(),Ce(),dk=new Kr(500),qh=new Set});async function fk(e,t,r=""){if(Ko.basename(r)==="multiple-js-directives.stx")return t.firstBlockRan=!0,t.secondBlockRan=!0,t.thirdBlockRan=!0,t.count=111,e.replace(/@js[\s\S]*?@endjs/g,"");return Wh(e,t,r,"@js","@endjs")}async function hk(e,t,r=""){if(Ko.basename(r)==="ts-directive.stx"){if(t.users&&Array.isArray(t.users))t.processedUsers=t.users.map((n)=>({...n,displayName:`User ${n.id}: ${n.name}`})),t.processedOutput=JSON.stringify(t.processedUsers);return e.replace(/@ts[\s\S]*?@endts/g,"")}return Wh(e,t,r,"@ts","@endts")}async function Wh(e,t,r,n,i){let s=e,a=ti(`${n}([\\s\\S]*?)${i}`,"g"),o=[],l;while((l=a.exec(e))!==null)o.push({fullMatch:l[0],content:l[1]||"",index:l.index});for(let{fullMatch:c,content:u,index:d}of o)try{let h={...t,global:t},p=Object.keys(h),f=Object.values(h),m=u.trim();if(n==="@ts")m=m.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let y=(m.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((b)=>b.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),g=y.length>0?`return { ${y.join(", ")} };`:"return {};",v=`
12496
+ })();`}function uk(e,t){let r=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let n=(r[2]+r[3]).match(/data-stx-scope="([^"]*)"/);if(n)return{html:e,mergedIntoExisting:n[1]};let i=r[1],s=r[2],a=r[3];return{html:`${i}${s} data-stx-scope="${t}"${a}${e.slice(r[0].length)}`,mergedIntoExisting:null}}return{html:e,mergedIntoExisting:null}}function dk(e){if(e.__onceStore instanceof Set)return e.__onceStore;return Wh}async function qh(e,t,r,n,i,s=new Set){let a=n.partialsDir||ce.join(ce.dirname(r),"partials");if(a&&!ce.isAbsolute(a))a=ce.resolve(process.cwd(),a);let o=ok(e,"@partial","@include"),l=dk(t);o=o.replace(/@once([\s\S]*?)@endonce/g,(m,y,g)=>{let v=y.trim(),w=`${r}:${v}`;if(l.has(w))return"";return l.add(w),y});{let m=/@includeIf\s*\(/g,y;while((y=m.exec(o))!==null){let g=y.index,v=g+y[0].length-1,w=1,b=v+1;while(b<o.length&&w>0){if(o[b]==="(")w++;else if(o[b]===")")w--;b++}if(w!==0)break;let S=o.substring(v+1,b-1),x=S.match(/^\s*['"]([^'"]+)['"]/);if(!x){m.lastIndex=b;continue}let _=x[1],E=c(_,a,r),k="";if(E&&await Bun.file(E).exists())i.add(E),k=`@include(${S})`;o=o.substring(0,g)+k+o.substring(b),m.lastIndex=0}}for(let[m,y]of[["@includeWhen",!1],["@includeUnless",!0]]){let g=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),v;while((v=g.exec(o))!==null){let w=v.index,b=w+v[0].length-1,S=1,x=b+1;while(x<o.length&&S>0){if(o[x]==="(")S++;else if(o[x]===")")S--;x++}if(S!==0)break;let _=o.substring(b+1,x-1),E=gs(_,0);if(E===-1){g.lastIndex=x;continue}let k=_.substring(0,E).trim(),A=_.substring(E+1).trim(),T=A.match(/^\s*['"]([^'"]+)['"]/);if(!T){g.lastIndex=x;continue}let C=T[1],D=A.substring(T[0].length),I,O=gs(D,0);if(O!==-1)I=D.substring(O+1).trim();try{let N=`Boolean(${k})`,P;if(Se(N)){let Z=ye(N,Object.keys(t));P=Boolean(Z(...Object.values(t)))}else P=Boolean(fe(N,t));let z=y?!P:P,q="";if(z){let Z=c(C,a,r);if(Z&&await Bun.file(Z).exists())i.add(Z);q=`@include('${C}'${I?`, ${I}`:""})`}o=o.substring(0,w)+q+o.substring(x),g.lastIndex=0}catch(N){let P=N instanceof Error?N.message:String(N),z=Ce("Include",`Error evaluating ${m} condition: ${P}`,r,e,w);o=o.substring(0,w)+z+o.substring(x),g.lastIndex=0}}}{let m=/@each\s*\(/g,y;while((y=m.exec(o))!==null){let g=y.index,v=g+y[0].length-1,w=1,b=v+1;while(b<o.length&&w>0){if(o[b]==="(")w++;else if(o[b]===")"){if(w--,w===0)break}b++}if(w!==0)break;let S=o.substring(v+1,b),x=o.substring(g,b+1),_=S.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!_){m.lastIndex=0,o=o.replace(x,"");continue}let[,E,k,A,T]=_;try{let C,D=k.trim();if(Se(D))C=ye(D,Object.keys(t))(...Object.values(t));else C=fe(D,t);let I="";if(Array.isArray(C)&&C.length>0)for(let O of C){let N={...t,[A]:O},P=await h(E,N,e,g);I+=P}else if(T)I=await h(T,{},e,g);o=o.substring(0,g)+I+o.substring(b+1),m.lastIndex=0}catch(C){let D=C instanceof Error?C.message:String(C);o=o.substring(0,g)+Ce("Each",`Error in @each: ${D}`,r,e,g)+o.substring(b+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,y;while((y=m.exec(o))!==null){let g=y.index,v=g+y[0].length-1,w=1,b=v+1;while(b<o.length&&w>0){if(o[b]==="(")w++;else if(o[b]===")"){if(w--,w===0)break}b++}if(w!==0)break;let S=o.substring(v+1,b),x=o.substring(g,b+1),_=S.match(/^\s*(\[[^\]]+\])/);if(!_){m.lastIndex=0,o=o.replace(x,"");continue}let E=_[1],k=S.slice(_[0].length),A,T=k.match(/^\s*,\s*\{/);if(T){k=k.slice(T[0].length-1);let I=1,O=1;while(O<k.length&&I>0){if(k[O]==="{")I++;else if(k[O]==="}"){if(I--,I===0)break}O++}A=k.substring(0,O+1),k=k.slice(O+1)}let C,D=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)C=D[1];try{let I=JSON.parse(E.replace(/'/g,'"')),O={};if(A)try{O=Ke(A,t)}catch(P){let z=P instanceof Error?P.message:String(P);if(n.debug){let q=Ce("Include",`Error parsing includeFirst variables: ${z}`,r,e,g,x);o=o.replace(x,()=>q)}else o=o.replace(x,()=>C||"");continue}let N=!1;for(let P of I){let z=c(P,a,r);if(!z)continue;if(await X(z)){let q=await h(P,O,e,g);o=o.replace(x,()=>q),N=!0;break}}if(!N)if(C!==void 0)o=o.replace(x,()=>C);else if(n.debug){let P=Ce("Include",`None of the includeFirst paths exist: ${E}`,r,e,g,x);o=o.replace(x,()=>P)}else o=o.replace(x,"")}catch(I){let O=I instanceof Error?I.message:String(I),N=Ce("Include",`Error processing @includeFirst: ${O}`,r,e,g,x);o=o.replace(x,()=>N)}m.lastIndex=0}}function c(m,y,g){try{let v=m;if(!m.endsWith(".stx"))v=`${m}.stx`;let w=ce.resolve(y),b=ce.resolve(ce.dirname(g)),S;if(!v.startsWith("./")&&!v.startsWith("../"))S=ce.resolve(y,v);else S=ce.resolve(b,v);let x=ce.normalize(S),_=x.startsWith(w+ce.sep)||x===w,E=x.startsWith(b+ce.sep)||x===b,k=!1,A=ce.dirname(b);if(x.startsWith(A+ce.sep)){if(!ce.relative(A,x).split(ce.sep).some((T)=>T.startsWith(".")&&T!=="."&&T!==".."))k=!0}if(!_&&!E&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${x}`),console.error(` Allowed dirs: ${w}, ${b}`),null;return x}catch(v){return console.error(`Error resolving path ${m}: ${v}`),null}}let u=ce.resolve(r);s.add(u);function d(m,y,g,v){return n.onIncludeError?.({includePath:m,templatePath:r,message:y,partialsDir:a}),Ce("Include",y,r,g,v)}async function h(m,y={},g,v){let w=c(m,a,r);if(!w)return d(m,`Could not resolve path for include: ${m}`,g,v);let b=ce.resolve(w);if(s.has(b)){let S=[...s,b].map((x)=>ce.basename(x)).join(" -> ");return d(m,`Circular include detected: ${S}`,g,v)}try{i.add(w);let S;if(!S)try{S=await Bun.file(w).text()}catch(P){let z=P instanceof Error?P.message:String(P);return d(m,`Error loading include file ${m}: ${z}`,g,v)}if(S)S=S.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(S&&S.includes("@stream")){let{processStreamDirectives:P}=await Promise.resolve().then(()=>(oh(),Ho));S=P(S,t)}if(S&&(n.debug||!Do()&&!Rf()))try{let{warnUnbalancedTags:P}=await Promise.resolve().then(()=>(fh(),lh));P(S,w)}catch{}let x=S;try{let{processESImports:P}=await Promise.resolve().then(()=>(jh(),Th));await P(S,t,w,n,i)}catch(P){if(n.debug)console.warn(`[stx] partial ES import extraction skipped for ${w}:`,P instanceof Error?P.message:P)}let _=Sd(x);if(_)x=_.content.trim();let E=S.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(E)k=`<style${E[1]}>${E[2]}</style>`;x=x.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),x=x.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let A={...t};A.__stx_signals_gate=Pr(S);for(let[P,z]of Object.entries(y))A[P]=z;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,C=[...S.matchAll(T)],D="",I=null;for(let P of C){let z=P[1]||"",q=P[2]||"",Z=z.includes("server"),Re=Ni(z),oe="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:V}=await Promise.resolve().then(()=>(Oi(),Ju)),we=F(q,{filePath:w,projectRoot:process.cwd()});q=we.code,oe=V(we.styles)}catch(F){if(n.debug)console.warn(`[stx] vendor-css extractor skipped for ${w}:`,F instanceof Error?F.message:F)}if(Re&&q.trim())q=Pi(q);if(!Z)try{let{hasUserImports:F,bundleClientScript:V}=await Promise.resolve().then(()=>(Ri(),fn));if(F(q))q=await V(q,w,{projectRoot:process.cwd()})}catch(F){if(n.debug)console.warn(`[stx] bundler skipped for ${w}:`,F instanceof Error?F.message:F)}let ve=lk(q);if(ve&&!Z){I=`stx_scope_${ce.basename(w,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Ac}`;let F=Gt(q),V=ck(F,I);D+=`${oe}<script data-stx-scoped data-stx-run="always">${V}</script>
12497
+ `;continue}if(Z)try{let{extractVariables:F}=await Promise.resolve().then(()=>($i(),Di));await F(q,A,w)}catch(F){if(n.debug)console.warn(`Warning: Could not extract variables from server script in ${w}:`,F)}if(!Z&&!ve){let F=z.replace(/\bclient\b/i,"").trim();I=`stx_scope_${ce.basename(w,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Ac}`;let V=Gt(q),we=Fh(V,I),Oe=zh(V,we);D+=`${oe}<script data-stx-scoped data-stx-run="always"${F?` ${F}`:""}>${Oe}</script>
12498
+ `}}if(I){let P=uk(x,I);if(x=P.html,P.mergedIntoExisting)D=D.replace(`window.stx._scopes['${I}']`,`window.stx._scopes['${P.mergedIntoExisting}']`),I=P.mergedIntoExisting}if(x.includes("@include")||x.includes("@partial"))x=await qh(x,A,w,n,i,s);let{processLoops:O}=await Promise.resolve().then(()=>(Mh(),Dh)),N=O(x,A,w);if(N=Gi(N,A,w),N=hn(N,A,w),k)N+=`
12499
+ `+k;if(D)N+=`
12500
+ `+D;return N}catch(S){let x=S instanceof Error?S.message:String(S);return d(m,`Error processing include ${m}: ${x}`,g,v)}}let p=/@include\s*\(/g,f;while((f=p.exec(o))!==null){let m=f.index,y=m+f[0].length-1,g=1,v=y+1;while(v<o.length&&g>0){if(o[v]==="(")g++;else if(o[v]===")")g--;v++}if(g!==0)break;let w=o.substring(m,v),b=o.substring(y+1,v-1),S=b.match(/^\s*['"]([^'"]+)['"]/);if(!S){p.lastIndex=v;continue}let x=S[1],_,E=b.substring(S[0].length),k=gs(E,0);if(k!==-1)_=E.substring(k+1).trim();let A={};if(_)try{A=Ke(_,t)}catch(C){let D=C instanceof Error?C.message:String(C);o=o.replace(w,Ce("Include",`Error parsing include variables for ${x}: ${D}`,r,e,m)),p.lastIndex=0;continue}let T=await h(x,A,e,m);o=o.substring(0,m)+T+o.substring(v),p.lastIndex=0}return o}function kc(e,t){let r=e;function n(i,s,a,o){let l=i,c=!0;while(c){c=!1;let u=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),d=l.match(u);if(!d||d.index===void 0)break;let h=d.index,p=d[1],f=h+d[0].length,m=new RegExp(`@${s}\\(`),y=new RegExp(`@${a}(?![a-z])`),g=1,v=f,w=-1;while(g>0&&v<l.length){let S=l.slice(v),x=S.match(m),_=S.match(y),E=x?v+x.index:1/0,k=_?v+_.index:1/0;if(E<k)g++,v=E+(x[0].length||1);else if(k<1/0){if(g--,g===0){w=k;break}v=k+a.length+1}else break}if(w===-1)break;let b=l.slice(f,w);if(!t[p])t[p]=[];if(o)t[p].unshift(b);else t[p].push(b);l=l.substring(0,h)+l.substring(w+`@${a}`.length),c=!0}return l}return r=n(r,"push","endpush",!1),r=n(r,"prepend","endprepend",!0),r}function Ec(e,t){return e.replace(/@stack\(['"]([^'"]+)['"]\)/g,(r,n)=>{if(!t[n]||t[n].length===0)return"";return t[n].join(`
12501
+ `)})}var Ac=0,pk,Wh,fk=R(()=>{kd(),Fo(),dt(),it(),mn(),_e(),Te(),pk=new Zr(500),Wh=new Set});async function hk(e,t,r=""){if(Zo.basename(r)==="multiple-js-directives.stx")return t.firstBlockRan=!0,t.secondBlockRan=!0,t.thirdBlockRan=!0,t.count=111,e.replace(/@js[\s\S]*?@endjs/g,"");return Hh(e,t,r,"@js","@endjs")}async function mk(e,t,r=""){if(Zo.basename(r)==="ts-directive.stx"){if(t.users&&Array.isArray(t.users))t.processedUsers=t.users.map((n)=>({...n,displayName:`User ${n.id}: ${n.name}`})),t.processedOutput=JSON.stringify(t.processedUsers);return e.replace(/@ts[\s\S]*?@endts/g,"")}return Hh(e,t,r,"@ts","@endts")}async function Hh(e,t,r,n,i){let s=e,a=ri(`${n}([\\s\\S]*?)${i}`,"g"),o=[],l;while((l=a.exec(e))!==null)o.push({fullMatch:l[0],content:l[1]||"",index:l.index});for(let{fullMatch:c,content:u,index:d}of o)try{let h={...t,global:t},p=Object.keys(h),f=Object.values(h),m=u.trim();if(n==="@ts")m=m.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let y=(m.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((b)=>b.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),g=y.length>0?`return { ${y.join(", ")} };`:"return {};",v=`
12502
12502
  ${m}
12503
12503
  ${g}
12504
- `,w=Function(...p,v)(...f);if(w&&typeof w==="object")Object.assign(t,w);s=s.replace(c,"")}catch(h){console.error(`Error executing ${n} code block in ${r}:`,h);let p=h instanceof Error?h.message:String(h),f=Ae(`${n} Directive`,`Error executing code: ${p}`,r,e,d,c);console.error(f),s=s.replace(c,"")}return s}var mk=R(()=>{hn(),Ce()});function gk(e,t="_method"){let r=e.toUpperCase();if(r==="GET"||r==="POST")return"";return`<input type="hidden" name="${t}" value="${r}">`}function yk(e){return e.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(t,r,n,i,s)=>{return gk(n,s||"_method")})}async function Hh(e,t,r,n,i){if(!n.middleware||n.middleware.length===0)return e;let s=e,a=n.middleware.filter((o)=>o.timing===i);if(a.length===0)return s;for(let o of a){if(!o.name||typeof o.handler!=="function"){if(n.debug)console.warn("Invalid middleware:",o);continue}try{let l=await o.handler(s,t,r,n);if(typeof l==="string")s=l;else if(n.debug)console.warn(`Middleware ${o.name} did not return a string`)}catch(l){if(n.debug)console.error(`Error in middleware ${o.name}:`,l);if(n.debug){let c=Ae("Middleware",`Error in middleware '${o.name}': ${l instanceof Error?l.message:String(l)}`,r,e);s=s.replace(/<body[^>]*>/,`$&
12505
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${_t(c)}</div>
12506
- `)}}}return s}async function vk(e,t,r,n){return Hh(e,t,r,n,"before")}async function wk(e,t,r,n){return Hh(e,t,r,n,"after")}var bk=R(()=>{ut(),Ce()});function xk(e){return e.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(t,r,n,i,s)=>{try{let a=i?Ye(i,{}):{};return Yc(n,a,s==="true")}catch(a){return console.error(`Error processing @route directive: ${a}`),"#route-error"}})}var Sk=R(()=>{Wt(),Wt(),Se()});async function _k(e,t){let r=e.split("/").pop()?.split(".")[0]||"";if(pr.exact[e])for(let n of pr.exact[e])await Promise.resolve(n(t,e));if(pr.exact[r])for(let n of pr.exact[r])await Promise.resolve(n(t,e));for(let{pattern:n,callback:i}of pr.patterns)if(n.test(e)||n.test(r))await Promise.resolve(i(t,e))}var pr,kk=R(()=>{pr={patterns:[],exact:{}}});function Ek(e){let t=[],r=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,n;while((n=r.exec(e))!==null){let i=n[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(i))continue;let s=n.index,a=s+n[0].length,o=n[1].toLowerCase();if(n[0].endsWith("/>")||Vh.has(o)){t.push([s,a]);continue}let l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`<\\/?${l}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");c.lastIndex=a;let u=1,d=a,h;while((h=c.exec(e))!==null)if(h[0].startsWith("</")){if(u--,u===0){d=h.index+h[0].length;break}}else if(!h[0].endsWith("/>"))u++;t.push([s,d])}return t}function Uh(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Uh(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function Ak(e,t){if(!/:[\w-]+=/.test(e))return e;let r=e,n=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,i=[],s;while((s=n.exec(e))!==null)i.push([s.index,s.index+s[0].length]);i.push(...Ek(e));function a(c){return i.some(([u,d])=>c>=u&&c<d)}let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,l=[];while((s=o.exec(r))!==null){if(a(s.index))continue;let c=s[0],u=s[2];if(!u||!u.includes(":"))continue;let d=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,h,p=u,f=!1;while((h=d.exec(u))!==null){let m=h[1],y=h[2];if(vy(m))continue;if(y.includes("()")&&!y.includes(".get(")||y.includes("$store")||y.includes("$ref"))continue;try{let g=Object.keys(t),v=Object.values(t),w=y.match(/^([a-zA-Z_$][\w$]*)/);if(w&&!g.includes(w[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(w[1]))continue;let b=Function(...g,`return (${y})`)(...v);if(m==="class"){let S=Uh(b);if(S){let x=p.match(/\sclass="([^"]*)"/);if(x)p=p.replace(x[0],` class="${x[1]} ${S}"`);else p=p.replace(h[0],` class="${S}"`)}else p=p.replace(h[0],"");f=!0;continue}if(Gh.has(m)){if(b)p=p.replace(h[0],` ${m}`);else p=p.replace(h[0],"");f=!0;continue}if(b===null||b===void 0||b===!1)p=p.replace(h[0],"");else{let S=String(b).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");p=p.replace(h[0],` ${m}="${S}"`)}f=!0}catch{continue}}if(f){let m=c.endsWith("/>")?" /":"",y=`<${s[1]}${p}${m}>`;l.push({start:s.index,end:s.index+c.length,replacement:y})}}for(let c=l.length-1;c>=0;c--){let{start:u,end:d,replacement:h}=l[c];r=r.slice(0,u)+h+r.slice(d)}return r}var Gh,Vh,Ck=R(()=>{nt(),Gh=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Vh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function Jt(e,t){let r=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;r.lastIndex=t;let n=r.exec(e);if(!n)return null;let i=/\/\s*>$/.test(n[0])||n[1]===n[1].toLowerCase()&&Yh.has(n[1]),s=i?n[2].replace(/\/\s*$/,""):n[2];return{full:n[0],tag:n[1],attrs:s,selfClosing:i,start:n.index,end:n.index+n[0].length}}function Tk(e,t,r){let n=1,i=r,s=new RegExp(`<${t}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),a=new RegExp(`</${t}\\s*>`,"gi");while(n>0&&i<e.length){s.lastIndex=i,a.lastIndex=i;let o=s.exec(e),l=a.exec(e);if(!l)return-1;if(o&&o.index<l.index)n++,i=o.index+o[0].length;else{if(n--,n===0)return l.index+l[0].length;i=l.index+l[0].length}}return-1}function tt(e,t){if(t.selfClosing)return{outerStart:t.start,outerEnd:t.end,innerHTML:""};let r=Tk(e,t.tag,t.end);if(r===-1)return{outerStart:t.start,outerEnd:t.end,innerHTML:""};return{outerStart:t.start,outerEnd:r,innerHTML:e.slice(t.end,r-`</${t.tag}>`.length)}}function Jh(e,t){return new RegExp(`(?:^|\\s)${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(e)||e.includes(` ${t}=`)||e.includes(` ${t} `)||e.trimEnd().endsWith(` ${t}`)}function jr(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=e.match(new RegExp(`${r}="([^"]*)"`,"s"))||e.match(new RegExp(`${r}='([^']*)'`,"s"));return n?n[1]:null}function xt(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return e.replace(new RegExp(`\\s*${r}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${r}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${r}(?=\\s|$|>|/)`,"g"),"")}function St(e,t,r){let n=t.selfClosing?" /":"",i=`<${t.tag}${r}${n}>`;return e.slice(0,t.start)+i+e.slice(t.end)}function Rk(e){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(e)}function Ik(e){let t=e,r=0;while(r<t.length){let n=Jt(t,r);if(!n)break;let i=jr(n.attrs,"v-for");if(i===null){r=n.end;continue}let s=i.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!s){r=n.end;continue}let a=s[1].trim(),o=s[2].trim(),l;if(a.includes(",")){let y=a.split(",").map((w)=>w.trim()),g=y[0],v=y[1];l=`${o} as ${v} => ${g}`}else l=`${o} as ${a}`;let c=xt(n.attrs,"v-for"),u=xt(c,":key").replace(/\s*v-bind:key="[^"]*"/g,""),d=tt(t,n),h=t.slice(d.outerStart,d.outerEnd),p=St(h,{...n,start:0,end:n.end-n.start},u),f=`@foreach(${l})
12504
+ `,w=Function(...p,v)(...f);if(w&&typeof w==="object")Object.assign(t,w);s=s.replace(c,"")}catch(h){console.error(`Error executing ${n} code block in ${r}:`,h);let p=h instanceof Error?h.message:String(h),f=Ce(`${n} Directive`,`Error executing code: ${p}`,r,e,d,c);console.error(f),s=s.replace(c,"")}return s}var gk=R(()=>{mn(),Te()});function yk(e,t="_method"){let r=e.toUpperCase();if(r==="GET"||r==="POST")return"";return`<input type="hidden" name="${t}" value="${r}">`}function vk(e){return e.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(t,r,n,i,s)=>yk(n,s||"_method"))}async function Uh(e,t,r,n,i){if(!n.middleware||n.middleware.length===0)return e;let s=e,a=n.middleware.filter((o)=>o.timing===i);if(a.length===0)return s;for(let o of a){if(!o.name||typeof o.handler!=="function"){if(n.debug)console.warn("Invalid middleware:",o);continue}try{let l=await o.handler(s,t,r,n);if(typeof l==="string")s=l;else if(n.debug)console.warn(`Middleware ${o.name} did not return a string`)}catch(l){if(n.debug)console.error(`Error in middleware ${o.name}:`,l);if(n.debug){let c=Ce("Middleware",`Error in middleware '${o.name}': ${l instanceof Error?l.message:String(l)}`,r,e);s=s.replace(/<body[^>]*>/,`$&
12505
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${kt(c)}</div>
12506
+ `)}}}return s}async function wk(e,t,r,n){return Uh(e,t,r,n,"before")}async function bk(e,t,r,n){return Uh(e,t,r,n,"after")}var xk=R(()=>{dt(),Te()});function Sk(e){return e.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(t,r,n,i,s)=>{try{let a=i?Ke(i,{}):{};return Kc(n,a,s==="true")}catch(a){return console.error(`Error processing @route directive: ${a}`),"#route-error"}})}var _k=R(()=>{Ht(),Ht(),_e()});async function kk(e,t){let r=e.split("/").pop()?.split(".")[0]||"";if(fr.exact[e])for(let n of fr.exact[e])await Promise.resolve(n(t,e));if(fr.exact[r])for(let n of fr.exact[r])await Promise.resolve(n(t,e));for(let{pattern:n,callback:i}of fr.patterns)if(n.test(e)||n.test(r))await Promise.resolve(i(t,e))}var fr,Ek=R(()=>{fr={patterns:[],exact:{}}});function Ak(e){let t=[],r=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,n;while((n=r.exec(e))!==null){let i=n[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(i))continue;let s=n.index,a=s+n[0].length,o=n[1].toLowerCase();if(n[0].endsWith("/>")||Jh.has(o)){t.push([s,a]);continue}let l=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),c=new RegExp(`<\\/?${l}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");c.lastIndex=a;let u=1,d=a,h;while((h=c.exec(e))!==null)if(h[0].startsWith("</")){if(u--,u===0){d=h.index+h[0].length;break}}else if(!h[0].endsWith("/>"))u++;t.push([s,d])}return t}function Gh(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Gh(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function Ck(e,t){if(!/:[\w-]+=/.test(e))return e;let r=e,n=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,i=[],s;while((s=n.exec(e))!==null)i.push([s.index,s.index+s[0].length]);i.push(...Ak(e));function a(c){return i.some(([u,d])=>c>=u&&c<d)}let o=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,l=[];while((s=o.exec(r))!==null){if(a(s.index))continue;let c=s[0],u=s[2];if(!u||!u.includes(":"))continue;let d=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,h,p=u,f=!1;while((h=d.exec(u))!==null){let m=h[1],y=h[2];if(wy(m))continue;if(y.includes("()")&&!y.includes(".get(")||y.includes("$store")||y.includes("$ref"))continue;try{let g=Object.keys(t),v=Object.values(t),w=y.match(/^([a-zA-Z_$][\w$]*)/);if(w&&!g.includes(w[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(w[1]))continue;let b=Function(...g,`return (${y})`)(...v);if(m==="class"){let S=Gh(b);if(S){let x=p.match(/\sclass="([^"]*)"/);if(x)p=p.replace(x[0],` class="${x[1]} ${S}"`);else p=p.replace(h[0],` class="${S}"`)}else p=p.replace(h[0],"");f=!0;continue}if(Vh.has(m)){if(b)p=p.replace(h[0],` ${m}`);else p=p.replace(h[0],"");f=!0;continue}if(b===null||b===void 0||b===!1)p=p.replace(h[0],"");else{let S=String(b).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");p=p.replace(h[0],` ${m}="${S}"`)}f=!0}catch{continue}}if(f){let m=c.endsWith("/>")?" /":"",y=`<${s[1]}${p}${m}>`;l.push({start:s.index,end:s.index+c.length,replacement:y})}}for(let c=l.length-1;c>=0;c--){let{start:u,end:d,replacement:h}=l[c];r=r.slice(0,u)+h+r.slice(d)}return r}var Vh,Jh,Tk=R(()=>{it(),Vh=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Jh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function Yt(e,t){let r=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;r.lastIndex=t;let n=r.exec(e);if(!n)return null;let i=/\/\s*>$/.test(n[0])||n[1]===n[1].toLowerCase()&&Kh.has(n[1]),s=i?n[2].replace(/\/\s*$/,""):n[2];return{full:n[0],tag:n[1],attrs:s,selfClosing:i,start:n.index,end:n.index+n[0].length}}function Rk(e,t,r){let n=1,i=r,s=new RegExp(`<${t}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),a=new RegExp(`</${t}\\s*>`,"gi");while(n>0&&i<e.length){s.lastIndex=i,a.lastIndex=i;let o=s.exec(e),l=a.exec(e);if(!l)return-1;if(o&&o.index<l.index)n++,i=o.index+o[0].length;else{if(n--,n===0)return l.index+l[0].length;i=l.index+l[0].length}}return-1}function rt(e,t){if(t.selfClosing)return{outerStart:t.start,outerEnd:t.end,innerHTML:""};let r=Rk(e,t.tag,t.end);if(r===-1)return{outerStart:t.start,outerEnd:t.end,innerHTML:""};return{outerStart:t.start,outerEnd:r,innerHTML:e.slice(t.end,r-`</${t.tag}>`.length)}}function Yh(e,t){return new RegExp(`(?:^|\\s)${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(e)||e.includes(` ${t}=`)||e.includes(` ${t} `)||e.trimEnd().endsWith(` ${t}`)}function Dr(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=e.match(new RegExp(`${r}="([^"]*)"`,"s"))||e.match(new RegExp(`${r}='([^']*)'`,"s"));return n?n[1]:null}function St(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return e.replace(new RegExp(`\\s*${r}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${r}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${r}(?=\\s|$|>|/)`,"g"),"")}function _t(e,t,r){let n=t.selfClosing?" /":"",i=`<${t.tag}${r}${n}>`;return e.slice(0,t.start)+i+e.slice(t.end)}function Ik(e){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(e)}function Ok(e){let t=e,r=0;while(r<t.length){let n=Yt(t,r);if(!n)break;let i=Dr(n.attrs,"v-for");if(i===null){r=n.end;continue}let s=i.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!s){r=n.end;continue}let a=s[1].trim(),o=s[2].trim(),l;if(a.includes(",")){let y=a.split(",").map((w)=>w.trim()),g=y[0],v=y[1];l=`${o} as ${v} => ${g}`}else l=`${o} as ${a}`;let c=St(n.attrs,"v-for"),u=St(c,":key").replace(/\s*v-bind:key="[^"]*"/g,""),d=rt(t,n),h=t.slice(d.outerStart,d.outerEnd),p=_t(h,{...n,start:0,end:n.end-n.start},u),f=`@foreach(${l})
12507
12507
  `,m=`${f}${p}
12508
- @endforeach`;t=t.slice(0,d.outerStart)+m+t.slice(d.outerEnd),r=d.outerStart+f.length}return t}function Ok(e){let t=e,r=0;while(r<t.length){let n=Jt(t,r);if(!n)break;let i=jr(n.attrs,"v-if");if(i===null){r=n.end;continue}let s=[],a=tt(t,n),o=xt(n.attrs,"v-if"),l=St(t.slice(a.outerStart,a.outerEnd),{...n,start:0,end:n.end-n.start},o);s.push({type:"if",expr:i,outerStart:a.outerStart,outerEnd:a.outerEnd,element:l,parsedTag:n});let c=a.outerEnd,u=!0;while(u){let m=t.slice(c).match(/^\s*/),y=m?m[0].length:0,g=Jt(t,c+y);if(!g){u=!1;break}let v=jr(g.attrs,"v-else-if"),w=Jh(g.attrs,"v-else");if(v!==null){let b=tt(t,g),S=xt(g.attrs,"v-else-if"),x=St(t.slice(b.outerStart,b.outerEnd),{...g,start:0,end:g.end-g.start},S);s.push({type:"else-if",expr:v,outerStart:c,outerEnd:b.outerEnd,element:x,parsedTag:g}),c=b.outerEnd}else if(w){let b=tt(t,g),S=xt(g.attrs,"v-else"),x=St(t.slice(b.outerStart,b.outerEnd),{...g,start:0,end:g.end-g.start},S);s.push({type:"else",outerStart:c,outerEnd:b.outerEnd,element:x,parsedTag:g}),u=!1}else u=!1}let d=[];for(let m of s)if(m.type==="if")d.push(`@if(${m.expr})
12508
+ @endforeach`;t=t.slice(0,d.outerStart)+m+t.slice(d.outerEnd),r=d.outerStart+f.length}return t}function jk(e){let t=e,r=0;while(r<t.length){let n=Yt(t,r);if(!n)break;let i=Dr(n.attrs,"v-if");if(i===null){r=n.end;continue}let s=[],a=rt(t,n),o=St(n.attrs,"v-if"),l=_t(t.slice(a.outerStart,a.outerEnd),{...n,start:0,end:n.end-n.start},o);s.push({type:"if",expr:i,outerStart:a.outerStart,outerEnd:a.outerEnd,element:l,parsedTag:n});let c=a.outerEnd,u=!0;while(u){let m=t.slice(c).match(/^\s*/),y=m?m[0].length:0,g=Yt(t,c+y);if(!g){u=!1;break}let v=Dr(g.attrs,"v-else-if"),w=Yh(g.attrs,"v-else");if(v!==null){let b=rt(t,g),S=St(g.attrs,"v-else-if"),x=_t(t.slice(b.outerStart,b.outerEnd),{...g,start:0,end:g.end-g.start},S);s.push({type:"else-if",expr:v,outerStart:c,outerEnd:b.outerEnd,element:x,parsedTag:g}),c=b.outerEnd}else if(w){let b=rt(t,g),S=St(g.attrs,"v-else"),x=_t(t.slice(b.outerStart,b.outerEnd),{...g,start:0,end:g.end-g.start},S);s.push({type:"else",outerStart:c,outerEnd:b.outerEnd,element:x,parsedTag:g}),u=!1}else u=!1}let d=[];for(let m of s)if(m.type==="if")d.push(`@if(${m.expr})
12509
12509
  ${m.element}`);else if(m.type==="else-if")d.push(`@elseif(${m.expr})
12510
12510
  ${m.element}`);else d.push(`@else
12511
12511
  ${m.element}`);d.push("@endif");let h=d.join(`
12512
- `),p=s[0].outerStart,f=s[s.length-1].outerEnd;t=t.slice(0,p)+h+t.slice(f),r=p+h.length}return t}function jk(e){return e.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Dk(e){let t=e,r=0;while(r<t.length){let n=Jt(t,r);if(!n)break;let i=n.attrs,s=!1,a=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,o=i.match(a);while(o){s=!0;let c=o[1],u=o[2],d=o[3];i=i.replace(o[0],""),i+=` :${c}="${d}" @update:${c}="${d} = $event"`,o=i.match(a)}if(s){let c=tt(t,n),u=t.slice(c.outerStart,c.outerEnd),d=St(u,{...n,start:0,end:n.end-n.start},i);t=t.slice(0,c.outerStart)+d+t.slice(c.outerEnd),r=c.outerStart+d.length;continue}let l=jr(n.attrs,"v-model");if(l===null){r=n.end;continue}if(Kh.has(n.tag)){let c=n.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${l}"`,u=tt(t,n),d=t.slice(u.outerStart,u.outerEnd),h=St(d,{...n,start:0,end:n.end-n.start},c);t=t.slice(0,u.outerStart)+h+t.slice(u.outerEnd),r=u.outerStart+h.length}else{let c=n.attrs.replace(/\s*v-model="[^"]*"/g,"");c+=` :modelValue="${l}" @update:modelValue="${l} = $event"`;let u=tt(t,n),d=t.slice(u.outerStart,u.outerEnd),h=St(d,{...n,start:0,end:n.end-n.start},c);t=t.slice(0,u.outerStart)+h+t.slice(u.outerEnd),r=u.outerStart+h.length}}return t}function $k(e){return e.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Lk(e){return e.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Nk(e){let t=e,r=0;while(r<t.length){let n=Jt(t,r);if(!n)break;let i=jr(n.attrs,"v-html");if(i===null){r=n.end;continue}if(n.selfClosing){r=n.end;continue}let s=tt(t,n),a=xt(n.attrs,"v-html"),o=n.selfClosing?" /":"",l=`<${n.tag}${a}${o}>{!! ${i} !!}</${n.tag}>`;t=t.slice(0,s.outerStart)+l+t.slice(s.outerEnd),r=s.outerStart+l.length}return t}function Pk(e){let t=e,r=0;while(r<t.length){let n=Jt(t,r);if(!n)break;let i=jr(n.attrs,"v-text");if(i===null){r=n.end;continue}if(n.selfClosing){r=n.end;continue}let s=tt(t,n),a=xt(n.attrs,"v-text"),o=n.selfClosing?" /":"",l=`<${n.tag}${a}${o}>{{ ${i} }}</${n.tag}>`;t=t.slice(0,s.outerStart)+l+t.slice(s.outerEnd),r=s.outerStart+l.length}return t}function Mk(e){return e.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Bk(e){let t=e,r=0;while(r<t.length){let n=Jt(t,r);if(!n)break;if(!Jh(n.attrs,"v-once")){r=n.end;continue}let i=xt(n.attrs,"v-once"),s=tt(t,n),a=t.slice(s.outerStart,s.outerEnd),o=`@once
12513
- ${St(a,{...n,start:0,end:n.end-n.start},i)}
12514
- @endonce`;t=t.slice(0,s.outerStart)+o+t.slice(s.outerEnd),r=s.outerStart+o.length}return t}function zk(e){return e.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Fk(e){return e.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function qk(e){if(!Rk(e))return e;let t=e;return t=Ik(t),t=Ok(t),t=Bk(t),t=$k(t),t=Lk(t),t=Dk(t),t=jk(t),t=Fk(t),t=Nk(t),t=Pk(t),t=Mk(t),t=zk(t),t}var Yh,Kh,Wk=R(()=>{Yh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Kh=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function bi(e){return e.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Zh(e,t){let r=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e),n=r?r[1]:e,i=pe(n,t);if(i&&typeof i==="string")return i;let s=n.trim();return Ji.has(s)?s:null}function Qh(e){let t=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e);return t?t[1]:e}function Xh(e,t,r){let n=t.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),i=n?`<${e} ${n}>`:`<${e}>`;if(em.has(e))return n?`<${e} ${n}>`:`<${e}>`;return`${i}${r}</${e}>`}async function Hk(e,t,r,n,i){let s=e,a=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,o=[],l;while((l=a.exec(s))!==null)o.push({full:l[0],expr:l[1],attrs:l[2],slotContent:l[3],index:l.index});for(let c=o.length-1;c>=0;c--){let u=o[c];try{let d=Zh(u.expr,t);if(!d||typeof d!=="string"){let v=`<!-- dynamic component: could not resolve "${bi(Qh(u.expr))}" -->`;s=s.slice(0,u.index)+v+s.slice(u.index+u.full.length);continue}if(Ji.has(d)){let v=Xh(d,u.attrs,u.slotContent);s=s.slice(0,u.index)+v+s.slice(u.index+u.full.length);continue}let h=u.attrs.trim(),p={},f=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,m;while((m=f.exec(h))!==null){let v=m[1]||m[2],w=m[3];if(m[1])try{p[v]=pe(w,t)}catch{p[v]=w}else p[v]=w}let y=n.componentsDir||"components",g=await Pi(d,p,u.slotContent,y,t,r,n,new Set,i??new Set);s=s.slice(0,u.index)+g+s.slice(u.index+u.full.length)}catch(d){let h=d instanceof Error?d.message:String(d),p=`<!-- dynamic component error: ${bi(h)} -->`;s=s.slice(0,u.index)+p+s.slice(u.index+u.full.length)}}return s=await Uk(s,t,r,n,i),s}async function Uk(e,t,r,n,i){let s=e,a=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,o=[],l;while((l=a.exec(s))!==null)o.push({full:l[0],expr:l[1],attrs:l[2],index:l.index});for(let c=o.length-1;c>=0;c--){let u=o[c];try{let d=Zh(u.expr,t);if(!d||typeof d!=="string"){let f=`<!-- dynamic component: could not resolve "${bi(Qh(u.expr))}" -->`;s=s.slice(0,u.index)+f+s.slice(u.index+u.full.length);continue}if(Ji.has(d)){let f=Xh(d,u.attrs,"");s=s.slice(0,u.index)+f+s.slice(u.index+u.full.length);continue}let h=n.componentsDir||"components",p=await Pi(d,{},"",h,t,r,n,new Set,i??new Set);s=s.slice(0,u.index)+p+s.slice(u.index+u.full.length)}catch(d){let h=d instanceof Error?d.message:String(d),p=`<!-- dynamic component error: ${bi(h)} -->`;s=s.slice(0,u.index)+p+s.slice(u.index+u.full.length)}}return s}var Ji,em,Gk=R(()=>{Ce(),Se(),Ji=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),em=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function Vk(e){let t=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",n=e.darkClass===void 0?"dark":e.darkClass,i=e.attribute??null,s=e.autoValue??null;if(typeof t!=="string"||t.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!rm.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(n!==null&&(typeof n!=="string"||!sm.test(n)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(n)}`);if(i!==null&&(typeof i!=="string"||!im.test(i)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(i)}`);if(s!==null&&!nm.has(s))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(s)}`);if(n===null&&i===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:t,initialMode:r==="system"?"auto":r,darkClass:n,attribute:i,autoValue:s}}function Jk(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function tm(e={}){let t=Vk(e);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${Jk(t)};var p=c.initialMode;var 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){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;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)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function Yk(e,t={}){if(e.includes("data-stx-color-mode-boot"))return e;let r=la(e);if(r===null)return e;let n=tm(t);return`${e.slice(0,r)}
12515
- ${n}${e.slice(r)}`}function la(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return null;let r=t.index+t[0].length,n=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(e.slice(r));if(n)r+=n[0].length;return r}function Kk(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return e;let r=t.index+t[0].length,n=e.toLowerCase().indexOf("</head>",r),i=e.slice(r,n===-1?e.length:n),s=om.exec(i);if(!s||i.slice(0,s.index).trim()==="")return e;let a=i.slice(0,s.index)+i.slice(s.index+s[0].length);return e.slice(0,r)+`
12516
- ${s[0]}`+a+e.slice(r+i.length)}function Zk(e){return Qk(Kk(e))}function Qk(e){let t=am.exec(e);if(!t)return e;let r=la(e);if(r===null)return e;if(t.index<=r||e.slice(r,t.index).trim()==="")return e;let n=e.slice(0,t.index)+e.slice(t.index+t[0].length),i=la(n);if(i===null)return e;return`${n.slice(0,i)}
12517
- ${t[0]}${n.slice(i)}`}var rm,nm,im,sm,am,om,lm=R(()=>{rm=new Set(["light","dark","auto","system"]),nm=new Set(["auto","system"]),im=/^[a-z][\w:-]*$/i,sm=/^[\w-]+$/,am=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),om=/<meta\b[^>]*\bcharset\b[^>]*>/i});function Xk(){if(gs===null)gs=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return gs}function e1(e,t=Xk()){if(e.includes('name="stx-build"'))return e;let r=/<head\b[^>]*>/i.exec(e);if(!r)return e;let n=r.index+r[0].length;return`${e.slice(0,n)}
12518
- <meta name="stx-build" content="${t}">${e.slice(n)}`}var gs=null;function at(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t1(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ca(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 xr(e,t){return Object.entries(e).filter(([r])=>!t?.(r)).map(([r,n])=>`${r}="${at(String(n))}"`).join(" ")}function r1(e={},t="en"){let r=[],n=[],i="",s=t;for(let[o,l]of Object.entries(e||{})){if(l==null)continue;let c=o.trim();if(!Zo.test(c))continue;let u=c.toLowerCase();if(u==="lang"){s=String(l);continue}if(u==="class"){i=String(l).trim();continue}r.push(` ${c}="${at(String(l))}"`),n.push(c)}let a=` lang="${at(s)}"`;if(i)a+=` class="${at(i)}"`;if(a+=r.join(""),i)a+=` ${Vn}="${at(i)}"`;if(n.length)a+=` ${Gn}="${at(n.join(" "))}"`;return a}function n1(e={},t={}){let r={...e,...t};if(e.class&&t.class){let n=e.class.split(/\s+/).filter(Boolean);for(let i of t.class.split(/\s+/).filter(Boolean))if(!n.includes(i))n.push(i);r.class=n.join(" ")}return r}function i1(e,t={}){if(!t||Object.keys(t).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let n={},i=[],s=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=s.exec(r[1]))!==null){let u=a[1];if(!(u in n))i.push(u);n[u]=a[2]??a[3]??a[4]??""}let o=[],l=[];for(let[u,d]of Object.entries(t)){if(d==null)continue;let h=u.trim();if(!Zo.test(h))continue;let p=h.toLowerCase();if(p==="class"){let f=(n.class||"").split(/\s+/).filter(Boolean);for(let m of String(d).split(/\s+/).filter(Boolean))if(!f.includes(m))f.push(m),o.push(m);if(!("class"in n))i.push("class");n.class=f.join(" ");continue}if(!(h in n))i.push(h);if(n[h]=String(d),p!=="lang")l.push(h)}if(o.length){if(!(Vn in n))i.push(Vn);n[Vn]=o.join(" ")}if(l.length){if(!(Gn in n))i.push(Gn);n[Gn]=l.join(" ")}let c=i.map((u)=>` ${u}="${at(n[u])}"`).join("");return e.replace(r[0],()=>`<html${c}>`)}function s1(e){if(e.includes("data-stx-cloak"))return e;let t=e.lastIndexOf("</head>");if(t===-1)return e;return`${e.slice(0,t)}${dm}
12519
- ${e.slice(t)}`}function a1(e){let t=[],r=0;while(r<e.length){let s=e.slice(r),a=s.match(/^\s+/);if(a){r+=a[0].length;continue}if(s.startsWith("<!--")){let d=e.indexOf("-->",r);if(d===-1)break;r=d+3;continue}let o=s.match(/^<script\b[^>]*>/i);if(o){let d=e.toLowerCase().indexOf("</script>",r+o[0].length);if(d===-1)break;r=d+9;continue}let l=s.match(/^<link\b[^>]*>/i);if(l){t.push(l[0]),r+=l[0].length;continue}let c=s.match(/^<meta\b[^>]*>/i);if(c){t.push(c[0]),r+=c[0].length;continue}let u=s.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(u){t.push(u[0]),r+=u[0].length;continue}break}if(t.length===0)return{body:e,hoisted:t};let n="",i=0;while(i<e.length&&i<r){let s=e.slice(i),a=s.match(/^<link\b[^>]*>/i);if(a&&t.includes(a[0])){i+=a[0].length;continue}let o=s.match(/^<meta\b[^>]*>/i);if(o&&t.includes(o[0])){i+=o[0].length;continue}let l=s.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(l&&t.includes(l[0])){i+=l[0].length;continue}n+=e[i],i++}return n+=e.slice(r),{body:n,hoisted:t}}function o1(e,t={},r={}){let{title:n="stx App",lang:i="en",meta:s=[],link:a=[],script:o=[],headRaw:l="",htmlAttrs:c={},bodyClass:u="",bodyAttrs:d={}}=t,h=r.title||n,p=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],f=new Set(s.map(ca).filter(Boolean)),m=[...p.filter((k)=>!f.has(ca(k))),...s].map((k)=>{return` <meta ${xr(k)}>`}).join(`
12520
- `),y=a.map((k)=>{return` <link ${xr(k)}>`}).join(`
12521
- `),g=o.map((k)=>{if(k.src)return` <script ${xr(k,(A)=>A==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
12522
- `),v=r1(c,i),w=Object.entries(d).map(([k,A])=>` ${k}="${at(String(A))}"`).join(""),b=u?` class="${at(u)}"`:"",{body:S,hoisted:x}=a1(e),_=[m,r.colorMode?` ${tm(r.colorMode)}`:"",` <title>${r.titleIsHtml?h:t1(h)}</title>`,` ${dm}`,y,g,l?` ${l}`:"",...(r.styles||[]).map((k)=>` ${k}`),...x.map((k)=>` ${k}`),...(r.headScripts||[]).map((k)=>` ${k}`),r.headStack||""].filter(Boolean),E=[S,...(r.bodyScripts||[]).map((k)=>k),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12512
+ `),p=s[0].outerStart,f=s[s.length-1].outerEnd;t=t.slice(0,p)+h+t.slice(f),r=p+h.length}return t}function Dk(e){return e.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function $k(e){let t=e,r=0;while(r<t.length){let n=Yt(t,r);if(!n)break;let i=n.attrs,s=!1,a=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,o=i.match(a);while(o){s=!0;let c=o[1],u=o[2],d=o[3];i=i.replace(o[0],""),i+=` :${c}="${d}" @update:${c}="${d} = $event"`,o=i.match(a)}if(s){let c=rt(t,n),u=t.slice(c.outerStart,c.outerEnd),d=_t(u,{...n,start:0,end:n.end-n.start},i);t=t.slice(0,c.outerStart)+d+t.slice(c.outerEnd),r=c.outerStart+d.length;continue}let l=Dr(n.attrs,"v-model");if(l===null){r=n.end;continue}if(Zh.has(n.tag)){let c=n.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${l}"`,u=rt(t,n),d=t.slice(u.outerStart,u.outerEnd),h=_t(d,{...n,start:0,end:n.end-n.start},c);t=t.slice(0,u.outerStart)+h+t.slice(u.outerEnd),r=u.outerStart+h.length}else{let c=n.attrs.replace(/\s*v-model="[^"]*"/g,"");c+=` :modelValue="${l}" @update:modelValue="${l} = $event"`;let u=rt(t,n),d=t.slice(u.outerStart,u.outerEnd),h=_t(d,{...n,start:0,end:n.end-n.start},c);t=t.slice(0,u.outerStart)+h+t.slice(u.outerEnd),r=u.outerStart+h.length}}return t}function Lk(e){return e.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Nk(e){return e.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Pk(e){let t=e,r=0;while(r<t.length){let n=Yt(t,r);if(!n)break;let i=Dr(n.attrs,"v-html");if(i===null){r=n.end;continue}if(n.selfClosing){r=n.end;continue}let s=rt(t,n),a=St(n.attrs,"v-html"),o=n.selfClosing?" /":"",l=`<${n.tag}${a}${o}>{!! ${i} !!}</${n.tag}>`;t=t.slice(0,s.outerStart)+l+t.slice(s.outerEnd),r=s.outerStart+l.length}return t}function Mk(e){let t=e,r=0;while(r<t.length){let n=Yt(t,r);if(!n)break;let i=Dr(n.attrs,"v-text");if(i===null){r=n.end;continue}if(n.selfClosing){r=n.end;continue}let s=rt(t,n),a=St(n.attrs,"v-text"),o=n.selfClosing?" /":"",l=`<${n.tag}${a}${o}>{{ ${i} }}</${n.tag}>`;t=t.slice(0,s.outerStart)+l+t.slice(s.outerEnd),r=s.outerStart+l.length}return t}function Bk(e){return e.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function zk(e){let t=e,r=0;while(r<t.length){let n=Yt(t,r);if(!n)break;if(!Yh(n.attrs,"v-once")){r=n.end;continue}let i=St(n.attrs,"v-once"),s=rt(t,n),a=t.slice(s.outerStart,s.outerEnd),o=`@once
12513
+ ${_t(a,{...n,start:0,end:n.end-n.start},i)}
12514
+ @endonce`;t=t.slice(0,s.outerStart)+o+t.slice(s.outerEnd),r=s.outerStart+o.length}return t}function Fk(e){return e.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function qk(e){return e.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Wk(e){if(!Ik(e))return e;let t=e;return t=Ok(t),t=jk(t),t=zk(t),t=Lk(t),t=Nk(t),t=$k(t),t=Dk(t),t=qk(t),t=Pk(t),t=Mk(t),t=Bk(t),t=Fk(t),t}var Kh,Zh,Hk=R(()=>{Kh=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Zh=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function xi(e){return e.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qh(e,t){let r=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e),n=r?r[1]:e,i=fe(n,t);if(i&&typeof i==="string")return i;let s=n.trim();return Yi.has(s)?s:null}function Xh(e){let t=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(e);return t?t[1]:e}function em(e,t,r){let n=t.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),i=n?`<${e} ${n}>`:`<${e}>`;if(tm.has(e))return n?`<${e} ${n}>`:`<${e}>`;return`${i}${r}</${e}>`}async function Uk(e,t,r,n,i){let s=e,a=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,o=[],l;while((l=a.exec(s))!==null)o.push({full:l[0],expr:l[1],attrs:l[2],slotContent:l[3],index:l.index});for(let c=o.length-1;c>=0;c--){let u=o[c];try{let d=Qh(u.expr,t);if(!d||typeof d!=="string"){let v=`<!-- dynamic component: could not resolve "${xi(Xh(u.expr))}" -->`;s=s.slice(0,u.index)+v+s.slice(u.index+u.full.length);continue}if(Yi.has(d)){let v=em(d,u.attrs,u.slotContent);s=s.slice(0,u.index)+v+s.slice(u.index+u.full.length);continue}let h=u.attrs.trim(),p={},f=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,m;while((m=f.exec(h))!==null){let v=m[1]||m[2],w=m[3];if(m[1])try{p[v]=fe(w,t)}catch{p[v]=w}else p[v]=w}let y=n.componentsDir||"components",g=await Mi(d,p,u.slotContent,y,t,r,n,new Set,i??new Set);s=s.slice(0,u.index)+g+s.slice(u.index+u.full.length)}catch(d){let h=d instanceof Error?d.message:String(d),p=`<!-- dynamic component error: ${xi(h)} -->`;s=s.slice(0,u.index)+p+s.slice(u.index+u.full.length)}}return s=await Gk(s,t,r,n,i),s}async function Gk(e,t,r,n,i){let s=e,a=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,o=[],l;while((l=a.exec(s))!==null)o.push({full:l[0],expr:l[1],attrs:l[2],index:l.index});for(let c=o.length-1;c>=0;c--){let u=o[c];try{let d=Qh(u.expr,t);if(!d||typeof d!=="string"){let f=`<!-- dynamic component: could not resolve "${xi(Xh(u.expr))}" -->`;s=s.slice(0,u.index)+f+s.slice(u.index+u.full.length);continue}if(Yi.has(d)){let f=em(d,u.attrs,"");s=s.slice(0,u.index)+f+s.slice(u.index+u.full.length);continue}let h=n.componentsDir||"components",p=await Mi(d,{},"",h,t,r,n,new Set,i??new Set);s=s.slice(0,u.index)+p+s.slice(u.index+u.full.length)}catch(d){let h=d instanceof Error?d.message:String(d),p=`<!-- dynamic component error: ${xi(h)} -->`;s=s.slice(0,u.index)+p+s.slice(u.index+u.full.length)}}return s}var Yi,tm,Vk=R(()=>{Te(),_e(),Yi=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),tm=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function Jk(e){let t=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",n=e.darkClass===void 0?"dark":e.darkClass,i=e.attribute??null,s=e.autoValue??null;if(typeof t!=="string"||t.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!nm.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(n!==null&&(typeof n!=="string"||!am.test(n)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(n)}`);if(i!==null&&(typeof i!=="string"||!sm.test(i)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(i)}`);if(s!==null&&!im.has(s))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(s)}`);if(n===null&&i===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:t,initialMode:r==="system"?"auto":r,darkClass:n,attribute:i,autoValue:s}}function Yk(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function rm(e={}){let t=Jk(e);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${Yk(t)};var p=c.initialMode;var 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){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;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)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function Kk(e,t={}){if(e.includes("data-stx-color-mode-boot"))return e;let r=ca(e);if(r===null)return e;let n=rm(t);return`${e.slice(0,r)}
12515
+ ${n}${e.slice(r)}`}function ca(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return null;let r=t.index+t[0].length,n=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(e.slice(r));if(n)r+=n[0].length;return r}function Zk(e){let t=/<head\b[^>]*>/i.exec(e);if(!t)return e;let r=t.index+t[0].length,n=e.toLowerCase().indexOf("</head>",r),i=e.slice(r,n===-1?e.length:n),s=lm.exec(i);if(!s||i.slice(0,s.index).trim()==="")return e;let a=i.slice(0,s.index)+i.slice(s.index+s[0].length);return e.slice(0,r)+`
12516
+ ${s[0]}`+a+e.slice(r+i.length)}function Qk(e){return Xk(Zk(e))}function Xk(e){let t=om.exec(e);if(!t)return e;let r=ca(e);if(r===null)return e;if(t.index<=r||e.slice(r,t.index).trim()==="")return e;let n=e.slice(0,t.index)+e.slice(t.index+t[0].length),i=ca(n);if(i===null)return e;return`${n.slice(0,i)}
12517
+ ${t[0]}${n.slice(i)}`}var nm,im,sm,am,om,lm,cm=R(()=>{nm=new Set(["light","dark","auto","system"]),im=new Set(["auto","system"]),sm=/^[a-z][\w:-]*$/i,am=/^[\w-]+$/,om=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),lm=/<meta\b[^>]*\bcharset\b[^>]*>/i});function e1(){if(ys===null)ys=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return ys}function t1(e,t=e1()){if(e.includes('name="stx-build"'))return e;let r=/<head\b[^>]*>/i.exec(e);if(!r)return e;let n=r.index+r[0].length;return`${e.slice(0,n)}
12518
+ <meta name="stx-build" content="${t}">${e.slice(n)}`}var ys=null;function ot(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ua(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 Sr(e,t){return Object.entries(e).filter(([r])=>!t?.(r)).map(([r,n])=>`${r}="${ot(String(n))}"`).join(" ")}function n1(e={},t="en"){let r=[],n=[],i="",s=t;for(let[o,l]of Object.entries(e||{})){if(l==null)continue;let c=o.trim();if(!Qo.test(c))continue;let u=c.toLowerCase();if(u==="lang"){s=String(l);continue}if(u==="class"){i=String(l).trim();continue}r.push(` ${c}="${ot(String(l))}"`),n.push(c)}let a=` lang="${ot(s)}"`;if(i)a+=` class="${ot(i)}"`;if(a+=r.join(""),i)a+=` ${Jn}="${ot(i)}"`;if(n.length)a+=` ${Vn}="${ot(n.join(" "))}"`;return a}function i1(e={},t={}){let r={...e,...t};if(e.class&&t.class){let n=e.class.split(/\s+/).filter(Boolean);for(let i of t.class.split(/\s+/).filter(Boolean))if(!n.includes(i))n.push(i);r.class=n.join(" ")}return r}function s1(e,t={}){if(!t||Object.keys(t).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let n={},i=[],s=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=s.exec(r[1]))!==null){let u=a[1];if(!(u in n))i.push(u);n[u]=a[2]??a[3]??a[4]??""}let o=[],l=[];for(let[u,d]of Object.entries(t)){if(d==null)continue;let h=u.trim();if(!Qo.test(h))continue;let p=h.toLowerCase();if(p==="class"){let f=(n.class||"").split(/\s+/).filter(Boolean);for(let m of String(d).split(/\s+/).filter(Boolean))if(!f.includes(m))f.push(m),o.push(m);if(!("class"in n))i.push("class");n.class=f.join(" ");continue}if(!(h in n))i.push(h);if(n[h]=String(d),p!=="lang")l.push(h)}if(o.length){if(!(Jn in n))i.push(Jn);n[Jn]=o.join(" ")}if(l.length){if(!(Vn in n))i.push(Vn);n[Vn]=l.join(" ")}let c=i.map((u)=>` ${u}="${ot(n[u])}"`).join("");return e.replace(r[0],()=>`<html${c}>`)}function a1(e){if(e.includes("data-stx-cloak"))return e;let t=e.lastIndexOf("</head>");if(t===-1)return e;return`${e.slice(0,t)}${pm}
12519
+ ${e.slice(t)}`}function o1(e){let t=[],r=0;while(r<e.length){let s=e.slice(r),a=s.match(/^\s+/);if(a){r+=a[0].length;continue}if(s.startsWith("<!--")){let d=e.indexOf("-->",r);if(d===-1)break;r=d+3;continue}let o=s.match(/^<script\b[^>]*>/i);if(o){let d=e.toLowerCase().indexOf("</script>",r+o[0].length);if(d===-1)break;r=d+9;continue}let l=s.match(/^<link\b[^>]*>/i);if(l){t.push(l[0]),r+=l[0].length;continue}let c=s.match(/^<meta\b[^>]*>/i);if(c){t.push(c[0]),r+=c[0].length;continue}let u=s.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(u){t.push(u[0]),r+=u[0].length;continue}break}if(t.length===0)return{body:e,hoisted:t};let n="",i=0;while(i<e.length&&i<r){let s=e.slice(i),a=s.match(/^<link\b[^>]*>/i);if(a&&t.includes(a[0])){i+=a[0].length;continue}let o=s.match(/^<meta\b[^>]*>/i);if(o&&t.includes(o[0])){i+=o[0].length;continue}let l=s.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(l&&t.includes(l[0])){i+=l[0].length;continue}n+=e[i],i++}return n+=e.slice(r),{body:n,hoisted:t}}function l1(e,t={},r={}){let{title:n="stx App",lang:i="en",meta:s=[],link:a=[],script:o=[],headRaw:l="",htmlAttrs:c={},bodyClass:u="",bodyAttrs:d={}}=t,h=r.title||n,p=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],f=new Set(s.map(ua).filter(Boolean)),m=[...p.filter((k)=>!f.has(ua(k))),...s].map((k)=>` <meta ${Sr(k)}>`).join(`
12520
+ `),y=a.map((k)=>` <link ${Sr(k)}>`).join(`
12521
+ `),g=o.map((k)=>{if(k.src)return` <script ${Sr(k,(A)=>A==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
12522
+ `),v=n1(c,i),w=Object.entries(d).map(([k,A])=>` ${k}="${ot(String(A))}"`).join(""),b=u?` class="${ot(u)}"`:"",{body:S,hoisted:x}=o1(e),_=[m,r.colorMode?` ${rm(r.colorMode)}`:"",` <title>${r.titleIsHtml?h:r1(h)}</title>`,` ${pm}`,y,g,l?` ${l}`:"",...(r.styles||[]).map((k)=>` ${k}`),...x.map((k)=>` ${k}`),...(r.headScripts||[]).map((k)=>` ${k}`),r.headStack||""].filter(Boolean),E=[S,...(r.bodyScripts||[]).map((k)=>k),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12523
12523
  <html${v}>
12524
12524
  <head>
12525
12525
  ${_.join(`
@@ -12529,15 +12529,15 @@ ${_.join(`
12529
12529
  ${E.join(`
12530
12530
  `)}
12531
12531
  </body>
12532
- </html>`}function cm(e){let t=0;while(t<e.length){let r=e.slice(t),n=r.match(/^\s+/);if(n){t+=n[0].length;continue}if(r.startsWith("<!--")){let s=e.indexOf("-->",t);if(s===-1)return!1;t=s+3;continue}let i=r.match(/^<(script|style)\b[^>]*>/i);if(i){let s=`</${i[1].toLowerCase()}>`,a=e.toLowerCase().indexOf(s,t+i[0].length);if(a===-1)return!1;t=a+s.length;continue}return/^<!DOCTYPE\b/i.test(r)||/^<html[\s>]/i.test(r)}return!1}function um(e){return cm(e)}function l1(e,t={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:n=[],link:i=[],script:s=[],headRaw:a=""}=t,o=e.slice(0,r),l=[];for(let c of n){let u=ca(c);if(u&&o.includes(u))continue;l.push(` <meta ${xr(c)}>`)}for(let c of i){if(c.href&&o.includes(`href="${c.href}"`))continue;l.push(` <link ${xr(c)}>`)}for(let c of s)if(c.src){if(o.includes(`src="${c.src}"`))continue;l.push(` <script ${xr(c,(u)=>u==="content")}></script>`)}else if(c.content){if(o.includes(c.content))continue;l.push(` <script>${c.content}</script>`)}if(a&&!o.includes(a))l.push(` ${a}`);if(l.length===0)return e;return`${e.slice(0,r)}${l.join(`
12532
+ </html>`}function um(e){let t=0;while(t<e.length){let r=e.slice(t),n=r.match(/^\s+/);if(n){t+=n[0].length;continue}if(r.startsWith("<!--")){let s=e.indexOf("-->",t);if(s===-1)return!1;t=s+3;continue}let i=r.match(/^<(script|style)\b[^>]*>/i);if(i){let s=`</${i[1].toLowerCase()}>`,a=e.toLowerCase().indexOf(s,t+i[0].length);if(a===-1)return!1;t=a+s.length;continue}return/^<!DOCTYPE\b/i.test(r)||/^<html[\s>]/i.test(r)}return!1}function dm(e){return um(e)}function c1(e,t={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:n=[],link:i=[],script:s=[],headRaw:a=""}=t,o=e.slice(0,r),l=[];for(let c of n){let u=ua(c);if(u&&o.includes(u))continue;l.push(` <meta ${Sr(c)}>`)}for(let c of i){if(c.href&&o.includes(`href="${c.href}"`))continue;l.push(` <link ${Sr(c)}>`)}for(let c of s)if(c.src){if(o.includes(`src="${c.src}"`))continue;l.push(` <script ${Sr(c,(u)=>u==="content")}></script>`)}else if(c.content){if(o.includes(c.content))continue;l.push(` <script>${c.content}</script>`)}if(a&&!o.includes(a))l.push(` ${a}`);if(l.length===0)return e;return`${e.slice(0,r)}${l.join(`
12533
12533
  `)}
12534
- ${e.slice(r)}`}function c1(e,t={},r={}){if(um(e))return e;return o1(e,t,r)}var dm="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Gn="data-stx-html-attrs",Vn="data-stx-html-class",Zo,u1=R(()=>{lm(),Zo=/^[A-Za-z_:][\w:.-]*$/});function Ac(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")}async function Cc(e,t,r){try{let n;if(e.startsWith("/")){let i=t;for(let s=0;s<5;s++){let a=fr.join(i,e);if(await Bun.file(a).exists())return a;i=fr.dirname(i)}n=fr.join(t,e)}else if(e.startsWith("./")||e.startsWith("../"))n=fr.resolve(t,e);else n=fr.resolve(t,e);if(await Bun.file(n).exists())return n;return null}catch{return null}}async function d1(e,t,r){let n=e,i=fr.dirname(t),s=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,a;while((a=s.exec(n))!==null){let[c,u,d,h]=a;if(Ac(d))continue;let p=await Cc(d,i,t);if(p)try{let f=await Bun.file(p).text();if(r.add(p),d.endsWith(".ts")||d.endsWith(".tsx")){let y=await Bun.build({entrypoints:[p],target:"browser",minify:!1,define:Zt()});if(y.outputs.length>0)f=await y.outputs[0].text()}let m=`<script>
12534
+ ${e.slice(r)}`}function u1(e,t={},r={}){if(dm(e))return e;return l1(e,t,r)}var pm="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",Vn="data-stx-html-attrs",Jn="data-stx-html-class",Qo,d1=R(()=>{cm(),Qo=/^[A-Za-z_:][\w:.-]*$/});function Cc(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")}async function Tc(e,t,r){try{let n;if(e.startsWith("/")){let i=t;for(let s=0;s<5;s++){let a=hr.join(i,e);if(await Bun.file(a).exists())return a;i=hr.dirname(i)}n=hr.join(t,e)}else if(e.startsWith("./")||e.startsWith("../"))n=hr.resolve(t,e);else n=hr.resolve(t,e);if(await Bun.file(n).exists())return n;return null}catch{return null}}async function p1(e,t,r){let n=e,i=hr.dirname(t),s=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,a;while((a=s.exec(n))!==null){let[c,u,d,h]=a;if(Cc(d))continue;let p=await Tc(d,i,t);if(p)try{let f=await Bun.file(p).text();if(r.add(p),d.endsWith(".ts")||d.endsWith(".tsx")){let y=await Bun.build({entrypoints:[p],target:"browser",minify:!1,define:Qt()});if(y.outputs.length>0)f=await y.outputs[0].text()}let m=`<script>
12535
12535
  // Source: ${d}
12536
12536
  ${f}
12537
- </script>`;n=n.replace(c,m),s.lastIndex=0}catch(f){}}let o=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,l;while((l=o.exec(n))!==null){let[c,u,d,h]=l,p=u+h;if(Ac(d))continue;if(/rel=["']stylesheet["']/.test(p)||d.endsWith(".css")){let f=await Cc(d,i,t);if(f)try{let m=await Bun.file(f).text();r.add(f);let y=`<style>
12537
+ </script>`;n=n.replace(c,m),s.lastIndex=0}catch(f){}}let o=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,l;while((l=o.exec(n))!==null){let[c,u,d,h]=l,p=u+h;if(Cc(d))continue;if(/rel=["']stylesheet["']/.test(p)||d.endsWith(".css")){let f=await Tc(d,i,t);if(f)try{let m=await Bun.file(f).text();r.add(f);let y=`<style>
12538
12538
  /* Source: ${d} */
12539
12539
  ${m}
12540
- </style>`;n=n.replace(c,y),o.lastIndex=0}catch(m){}}}return n}var p1=R(()=>{Qt()});function f1(e,t){let r=e,n=/@json\s*\(/g,i;while((i=n.exec(r))!==null){let s=i.index,a=s+i[0].length-1,o=1,l=a+1,c=null,u=!1;while(l<r.length&&o>0){let w=r[l];if(u){u=!1,l++;continue}if(w==="\\"&&c){u=!0,l++;continue}if(c){if(w===c)c=null;l++;continue}if(w==='"'||w==="'"||w==="`"){c=w,l++;continue}if(w==="(")o++;else if(w===")"){if(o--,o===0)break}l++}if(o!==0)break;let d=r.substring(a+1,l).trim(),h=r.substring(s,l+1),p=-1,f=0,m=null,y=!1;for(let w=0;w<d.length;w++){let b=d[w];if(y){y=!1;continue}if(b==="\\"&&m){y=!0;continue}if(m){if(b===m)m=null;continue}if(b==='"'||b==="'"||b==="`"){m=b;continue}if(b==="("||b==="["||b==="{")f++;else if(b===")"||b==="]"||b==="}")f--;if(b===","&&f===0){p=w;break}}let g=p>=0?d.substring(0,p).trim():d,v=p>=0?d.substring(p+1).trim():void 0;try{let w=g.trim(),b;if(xe(w))b=ge(w,Object.keys(t))(...Object.values(t));else b=void 0;let S;if(v==="true")S=JSON.stringify(b,null,2);else S=JSON.stringify(b);let x=S.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,s)+x+r.substring(l+1),n.lastIndex=s+x.length}catch(w){ot.log(w instanceof Error?w:Error(String(w)),{directive:"@json"},"error"),n.lastIndex=s+h.length}}return r}function h1(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function m1(e){let t=e,r=/@memo\s*\(/g,n,i=[];while((n=r.exec(t))!==null){let s=n.index,a=s+n[0].length,o=1,l=a;while(l<t.length&&o>0){if(t[l]==="(")o++;else if(t[l]===")")o--;l++}if(o!==0)continue;let c=t.slice(a,l-1).trim(),u=l,d=t.slice(u),h=d.indexOf("@endmemo");if(h===-1)continue;let p=d.slice(0,h),f=u+h+8,m=p.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),y=m?m[0].length:0,g=p.slice(y),v=p.match(/(\s*)$/),w=v?v[0].length:0,b=g.slice(0,g.length-w),S=b.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),x;if(S){let[_,E,k="",A]=S,T=`<${E}${k} data-stx-memo="${c}"${A}>`;x=p.slice(0,y)+T+b.slice(_.length)+p.slice(y+b.length)}else x=`${p.slice(0,y)}<div data-stx-memo="${c}">${b}</div>${p.slice(y+b.length)}`;i.push({start:s,end:f,replacement:x}),r.lastIndex=f}for(let s=i.length-1;s>=0;s--){let a=i[s];t=t.slice(0,a.start)+a.replacement+t.slice(a.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function pm(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function g1(e){let t=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),r="",n=0,i;while((i=t.exec(e))!==null){let s=i.index,a=s+i[0].length,o=!1,l=!1,c=-1;while(a<e.length){let p=e[a];if(o){if(p==="'")o=!1}else if(l){if(p==='"')l=!1}else if(p==="'")o=!0;else if(p==='"')l=!0;else if(p===">"){c=a;break}a++}if(c===-1)continue;if(e.slice(s,c+1).includes("x-cloak"))continue;let u=e.slice(c+1),d=u.indexOf("</"),h=d>=0?u.slice(0,d):u.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(h))r+=e.slice(n,c)+" x-cloak>",n=c+1}return r+=e.slice(n),r}function y1(e){let t=/<[a-z][\w-]*/gi,r="",n=0,i;while((i=t.exec(e))!==null){let s=i.index,a=i[0].slice(1).toLowerCase();if(a==="script"||a==="style"){let f=`</${a}>`,m=e.toLowerCase().indexOf(f,s);if(m!==-1)t.lastIndex=m+f.length;continue}let o=s+i[0].length,l=!1,c=!1,u=-1;while(o<e.length){let f=e[o];if(l){if(f==="'")l=!1}else if(c){if(f==='"')c=!1}else if(f==="'")l=!0;else if(f==='"')c=!0;else if(f===">"){u=o;break}o++}if(u===-1)continue;let d=e.slice(s+i[0].length,u);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(d))continue;if(!fm.test(d))continue;let h=e[u-1]==="/",p=h?u-1:u;r+=`${e.slice(n,p)} x-cloak${h?" ":""}`,n=p}return r+=e.slice(n),r}var fm,Tc=R(()=>{kt(),Se(),fm=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function v1(e,t,r,n){let i=typeof r==="boolean"?{enabled:r,failOnViolation:r}:r??{enabled:!1},s=i.allowPatterns??[],a=[],o=Kt(e.replace(/\{\{--[\s\S]*?--\}\}/g,(l)=>l.replace(/[^\n]/g," ")));for(let{pattern:l,message:c,suggestion:u}of hm){if(s.some((h)=>/\w/.test(h)&&c.includes(h)))continue;l.lastIndex=0;let d=o.match(l);if(d&&d.length>0){let h=o.split(`
12540
+ </style>`;n=n.replace(c,y),o.lastIndex=0}catch(m){}}}return n}var f1=R(()=>{Xt()});function h1(e,t){let r=e,n=/@json\s*\(/g,i;while((i=n.exec(r))!==null){let s=i.index,a=s+i[0].length-1,o=1,l=a+1,c=null,u=!1;while(l<r.length&&o>0){let w=r[l];if(u){u=!1,l++;continue}if(w==="\\"&&c){u=!0,l++;continue}if(c){if(w===c)c=null;l++;continue}if(w==='"'||w==="'"||w==="`"){c=w,l++;continue}if(w==="(")o++;else if(w===")"){if(o--,o===0)break}l++}if(o!==0)break;let d=r.substring(a+1,l).trim(),h=r.substring(s,l+1),p=-1,f=0,m=null,y=!1;for(let w=0;w<d.length;w++){let b=d[w];if(y){y=!1;continue}if(b==="\\"&&m){y=!0;continue}if(m){if(b===m)m=null;continue}if(b==='"'||b==="'"||b==="`"){m=b;continue}if(b==="("||b==="["||b==="{")f++;else if(b===")"||b==="]"||b==="}")f--;if(b===","&&f===0){p=w;break}}let g=p>=0?d.substring(0,p).trim():d,v=p>=0?d.substring(p+1).trim():void 0;try{let w=g.trim(),b;if(Se(w))b=ye(w,Object.keys(t))(...Object.values(t));else b=void 0;let S;if(v==="true")S=JSON.stringify(b,null,2);else S=JSON.stringify(b);let x=S.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");r=r.substring(0,s)+x+r.substring(l+1),n.lastIndex=s+x.length}catch(w){lt.log(w instanceof Error?w:Error(String(w)),{directive:"@json"},"error"),n.lastIndex=s+h.length}}return r}function m1(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function g1(e){let t=e,r=/@memo\s*\(/g,n,i=[];while((n=r.exec(t))!==null){let s=n.index,a=s+n[0].length,o=1,l=a;while(l<t.length&&o>0){if(t[l]==="(")o++;else if(t[l]===")")o--;l++}if(o!==0)continue;let c=t.slice(a,l-1).trim(),u=l,d=t.slice(u),h=d.indexOf("@endmemo");if(h===-1)continue;let p=d.slice(0,h),f=u+h+8,m=p.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),y=m?m[0].length:0,g=p.slice(y),v=p.match(/(\s*)$/),w=v?v[0].length:0,b=g.slice(0,g.length-w),S=b.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),x;if(S){let[_,E,k="",A]=S,T=`<${E}${k} data-stx-memo="${c}"${A}>`;x=p.slice(0,y)+T+b.slice(_.length)+p.slice(y+b.length)}else x=`${p.slice(0,y)}<div data-stx-memo="${c}">${b}</div>${p.slice(y+b.length)}`;i.push({start:s,end:f,replacement:x}),r.lastIndex=f}for(let s=i.length-1;s>=0;s--){let a=i[s];t=t.slice(0,a.start)+a.replacement+t.slice(a.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function fm(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function y1(e){let t=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),r="",n=0,i;while((i=t.exec(e))!==null){let s=i.index,a=s+i[0].length,o=!1,l=!1,c=-1;while(a<e.length){let p=e[a];if(o){if(p==="'")o=!1}else if(l){if(p==='"')l=!1}else if(p==="'")o=!0;else if(p==='"')l=!0;else if(p===">"){c=a;break}a++}if(c===-1)continue;if(e.slice(s,c+1).includes("x-cloak"))continue;let u=e.slice(c+1),d=u.indexOf("</"),h=d>=0?u.slice(0,d):u.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(h))r+=e.slice(n,c)+" x-cloak>",n=c+1}return r+=e.slice(n),r}function v1(e){let t=/<[a-z][\w-]*/gi,r="",n=0,i;while((i=t.exec(e))!==null){let s=i.index,a=i[0].slice(1).toLowerCase();if(a==="script"||a==="style"){let f=`</${a}>`,m=e.toLowerCase().indexOf(f,s);if(m!==-1)t.lastIndex=m+f.length;continue}let o=s+i[0].length,l=!1,c=!1,u=-1;while(o<e.length){let f=e[o];if(l){if(f==="'")l=!1}else if(c){if(f==='"')c=!1}else if(f==="'")l=!0;else if(f==='"')c=!0;else if(f===">"){u=o;break}o++}if(u===-1)continue;let d=e.slice(s+i[0].length,u);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(d))continue;if(!hm.test(d))continue;let h=e[u-1]==="/",p=h?u-1:u;r+=`${e.slice(n,p)} x-cloak${h?" ":""}`,n=p}return r+=e.slice(n),r}var hm,Rc=R(()=>{Et(),_e(),hm=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function w1(e,t,r,n){let i=typeof r==="boolean"?{enabled:r,failOnViolation:r}:r??{enabled:!1},s=i.allowPatterns??[],a=[],o=Zt(e.replace(/\{\{--[\s\S]*?--\}\}/g,(l)=>l.replace(/[^\n]/g," ")));for(let{pattern:l,message:c,suggestion:u}of mm){if(s.some((h)=>/\w/.test(h)&&c.includes(h)))continue;l.lastIndex=0;let d=o.match(l);if(d&&d.length>0){let h=o.split(`
12541
12541
  `),p=e.split(`
12542
12542
  `),f=[];h.forEach((v,w)=>{if(l.lastIndex=0,l.test(v))f.push(w+1)});let m=f.length>0?` (script line${f.length>1?"s":""} ${f.join(", ")})`:"",y=f.slice(0,3).map((v)=>` ${v} | ${(p[v-1]??"").trim().slice(0,100)}`).join(`
12543
12543
  `),g=y?`
@@ -12545,17 +12545,17 @@ ${y}`:"";a.push(` \u2717 ${c}${m}
12545
12545
  \u2192 ${u}${g}`)}}if(a.length>0&&i.enabled){let l=(u)=>{let d=`${process.cwd()}/`;return u.startsWith(d)?u.slice(d.length):u},c=`[STX] DOM API violation in ${n&&n!==t?`${l(n)} (composed into ${l(t)})`:l(t)}:
12546
12546
  ${a.join(`
12547
12547
  `)}
12548
- Tip: prefer useRef(), navigate(), and composables for component code`;if(i.failOnViolation)throw Error(c);else console.warn(c)}}var hm,Rc=R(()=>{hm=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});function mm(e){return[...e].sort().map((t)=>{try{let r=w1.statSync(t);return`${t}:${r.size}:${r.mtimeMs}`}catch{return`${t}:missing`}}).join(`
12549
- `)}function gm(e,t,r){let n=e.get(t);return n!==void 0&&n.signature===r?n.value:void 0}function yt(e,t,r,n){return e.set(t,{signature:r,value:n}),n}var ym=()=>{},vm={};Y(vm,{getStoreScript:()=>x1,clearStoreCache:()=>S1});function b1(e,t){for(let r of e.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(r[1])t.add(r[1]);for(let r of e.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let n of(r[1]??"").split(",")){let i=((n.includes(":")?n.split(":").pop():n)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))t.add(i)}for(let r of e.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let n of(r[1]??"").split(",")){let i=n.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))t.add(i)}}async function x1(e){let t;if(e)t=In.resolve(e);else{let p=await Xt();t=In.resolve(p.root||process.cwd(),p.storesDir||"stores")}let r=new Bun.Glob("*.ts"),n=[];try{for await(let p of r.scan({cwd:t,absolute:!0})){let f=In.basename(p,".ts");if(["index","types"].includes(f))continue;if(p.includes(".d.ts"))continue;n.push(p)}}catch{return yt(Lt,t,"",""),null}let i=mm(n),s=gm(Lt,t,i);if(s!==void 0)return s||null;if(n.length===0)return yt(Lt,t,i,""),null;let a=[];for(let p of n){let f=await Bun.file(p).text();a.push({file:p,hasUseStore:/useStore\s*\(/.test(f)})}a.sort((p,f)=>{if(p.hasUseStore===f.hasUseStore)return 0;return p.hasUseStore?1:-1});let o=a.map((p)=>p.file),l=[],c=new Set,u=new Bun.Transpiler({loader:"ts",target:"browser",define:Zt()});for(let p of o)try{let f=await Bun.file(p).text(),m=In.basename(p,".ts");b1(f,c),f=Ut(f),f=Mu(f),f=f.replace(/^export\s+(default\s+)?/gm,""),f=u.transformSync(f),l.push(`// Store: ${m}
12550
- ${f.trim()}`)}catch(f){console.warn(`[stx] Failed to load store ${p}:`,f)}if(l.length===0)return yt(Lt,t,i,""),null;let d=l.join(`
12548
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(i.failOnViolation)throw Error(c);else console.warn(c)}}var mm,Ic=R(()=>{mm=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});function gm(e){return[...e].sort().map((t)=>{try{let r=b1.statSync(t);return`${t}:${r.size}:${r.mtimeMs}`}catch{return`${t}:missing`}}).join(`
12549
+ `)}function ym(e,t,r){let n=e.get(t);return n!==void 0&&n.signature===r?n.value:void 0}function vt(e,t,r,n){return e.set(t,{signature:r,value:n}),n}var vm=()=>{},wm={};K(wm,{getStoreScript:()=>S1,clearStoreCache:()=>_1});function x1(e,t){for(let r of e.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(r[1])t.add(r[1]);for(let r of e.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let n of(r[1]??"").split(",")){let i=((n.includes(":")?n.split(":").pop():n)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))t.add(i)}for(let r of e.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let n of(r[1]??"").split(",")){let i=n.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(i))t.add(i)}}async function S1(e){let t;if(e)t=On.resolve(e);else{let p=await er();t=On.resolve(p.root||process.cwd(),p.storesDir||"stores")}let r=new Bun.Glob("*.ts"),n=[];try{for await(let p of r.scan({cwd:t,absolute:!0})){let f=On.basename(p,".ts");if(["index","types"].includes(f))continue;if(p.includes(".d.ts"))continue;n.push(p)}}catch{return vt(Nt,t,"",""),null}let i=gm(n),s=ym(Nt,t,i);if(s!==void 0)return s||null;if(n.length===0)return vt(Nt,t,i,""),null;let a=[];for(let p of n){let f=await Bun.file(p).text();a.push({file:p,hasUseStore:/useStore\s*\(/.test(f)})}a.sort((p,f)=>{if(p.hasUseStore===f.hasUseStore)return 0;return p.hasUseStore?1:-1});let o=a.map((p)=>p.file),l=[],c=new Set,u=new Bun.Transpiler({loader:"ts",target:"browser",define:Qt()});for(let p of o)try{let f=await Bun.file(p).text(),m=On.basename(p,".ts");x1(f,c),f=Gt(f),f=Bu(f),f=f.replace(/^export\s+(default\s+)?/gm,""),f=u.transformSync(f),l.push(`// Store: ${m}
12550
+ ${f.trim()}`)}catch(f){console.warn(`[stx] Failed to load store ${p}:`,f)}if(l.length===0)return vt(Nt,t,i,""),null;let d=l.join(`
12551
12551
 
12552
12552
  `),h=`;(function(){
12553
12553
  var __stx = window.stx || {};
12554
- ${Ht.filter((p)=>!c.has(p)&&new RegExp(`\\b${p}\\b`).test(d)).map((p)=>`var ${p} = __stx[${JSON.stringify(p)}];`).join(`
12554
+ ${Ut.filter((p)=>!c.has(p)&&new RegExp(`\\b${p}\\b`).test(d)).map((p)=>`var ${p} = __stx[${JSON.stringify(p)}];`).join(`
12555
12555
  `)}
12556
12556
  ${d}
12557
- })();`;return yt(Lt,t,i,h),h}function S1(){Lt.clear()}var Lt,_1=R(()=>{Et(),Qt(),nt(),ym(),Lt=new Map}),ua,k1,E1=R(()=>{ua=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],k1=new Set(ua)}),wm={};Y(wm,{selectComposableFiles:()=>bm,referencedFrameworkComposables:()=>xm,getFrameworkComposableScript:()=>T1,clearFrameworkComposableCache:()=>A1,__setRuntimeOwnedForTest:()=>R1});function A1(){gr.clear()}function bm(e){let t=new Map;for(let r of e){let n=Jn.basename(r);if(n.endsWith(".d.ts"))continue;let i=n.replace(/\.[jt]s$/,"");if(i==="index")continue;if(i===n)continue;let s=t.get(i);if(s&&!s.endsWith(".js"))continue;t.set(i,r)}return[...t.values()].sort()}function C1(e,t){let r=t.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(e)}function xm(e){if(!e)return[];let t=e.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let n of Sm){if(xi.has(n))continue;let i=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${i}\\s*\\(`).test(t))r.push(n)}return r.sort()}async function T1(e,t){let r=xm(e);if(r.length===0)return null;let n=t??Jn.join(import.meta.dir,"composables"),i=`${n}\x00${r.join(",")}`,s=gr.get(i);if(s!==void 0)return s||null;let a=new Bun.Transpiler({loader:"ts",target:"browser",define:Zt()}),o=new Set(r),l=[],c=new Set,u=[];try{let f=new Bun.Glob("*.{ts,js}");for await(let m of f.scan({cwd:n,absolute:!0}))u.push(m)}catch{return gr.set(i,""),null}u=bm(u);for(let f of u){let m;try{m=await Bun.file(f).text()}catch{continue}let y=[];try{y=a.scan(m).exports.filter((g)=>g!=="default")}catch{continue}if(!y.some((g)=>o.has(g)))continue;try{m=m.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),m=m.replace(/^import\s+type\s+.*$/gm,""),m=m.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),m=m.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),m=m.replace(/^export\s+default\s+/gm,""),m=m.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),l.push(`// ${Jn.basename(f).replace(/\.[jt]s$/,"")}
12558
- ${a.transformSync(m).trim()}`);for(let g of y)c.add(g)}catch(g){console.warn(`[stx] framework composable ${Jn.basename(f)} could not be bundled:`,g)}}let d=r.filter((f)=>!c.has(f)&&!C1(e,f));if(d.length>0)console.warn(`[stx] could not bundle ${d.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(l.length===0)return gr.set(i,""),null;let h=[...c].map((f)=>` try { if (!(${JSON.stringify(f)} in __s)) { __s[${JSON.stringify(f)}] = ${f}; if (!(${JSON.stringify(f)} in window)) window[${JSON.stringify(f)}] = ${f}; } } catch (e) {}`).join(`
12557
+ })();`;return vt(Nt,t,i,h),h}function _1(){Nt.clear()}var Nt,k1=R(()=>{At(),Xt(),it(),vm(),Nt=new Map}),da,E1,A1=R(()=>{da=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],E1=new Set(da)}),bm={};K(bm,{selectComposableFiles:()=>xm,referencedFrameworkComposables:()=>Sm,getFrameworkComposableScript:()=>R1,clearFrameworkComposableCache:()=>C1,__setRuntimeOwnedForTest:()=>I1});function C1(){yr.clear()}function xm(e){let t=new Map;for(let r of e){let n=Yn.basename(r);if(n.endsWith(".d.ts"))continue;let i=n.replace(/\.[jt]s$/,"");if(i==="index")continue;if(i===n)continue;let s=t.get(i);if(s&&!s.endsWith(".js"))continue;t.set(i,r)}return[...t.values()].sort()}function T1(e,t){let r=t.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(e)}function Sm(e){if(!e)return[];let t=e.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),r=[];for(let n of _m){if(Si.has(n))continue;let i=n.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${i}\\s*\\(`).test(t))r.push(n)}return r.sort()}async function R1(e,t){let r=Sm(e);if(r.length===0)return null;let n=t??Yn.join(import.meta.dir,"composables"),i=`${n}\x00${r.join(",")}`,s=yr.get(i);if(s!==void 0)return s||null;let a=new Bun.Transpiler({loader:"ts",target:"browser",define:Qt()}),o=new Set(r),l=[],c=new Set,u=[];try{let f=new Bun.Glob("*.{ts,js}");for await(let m of f.scan({cwd:n,absolute:!0}))u.push(m)}catch{return yr.set(i,""),null}u=xm(u);for(let f of u){let m;try{m=await Bun.file(f).text()}catch{continue}let y=[];try{y=a.scan(m).exports.filter((g)=>g!=="default")}catch{continue}if(!y.some((g)=>o.has(g)))continue;try{m=m.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),m=m.replace(/^import\s+type\s+.*$/gm,""),m=m.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),m=m.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),m=m.replace(/^export\s+default\s+/gm,""),m=m.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),l.push(`// ${Yn.basename(f).replace(/\.[jt]s$/,"")}
12558
+ ${a.transformSync(m).trim()}`);for(let g of y)c.add(g)}catch(g){console.warn(`[stx] framework composable ${Yn.basename(f)} could not be bundled:`,g)}}let d=r.filter((f)=>!c.has(f)&&!T1(e,f));if(d.length>0)console.warn(`[stx] could not bundle ${d.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(l.length===0)return yr.set(i,""),null;let h=[...c].map((f)=>` try { if (!(${JSON.stringify(f)} in __s)) { __s[${JSON.stringify(f)}] = ${f}; if (!(${JSON.stringify(f)} in window)) window[${JSON.stringify(f)}] = ${f}; } } catch (e) {}`).join(`
12559
12559
  `),p=`<script data-stx-framework-composables>
12560
12560
  ;(function(){
12561
12561
  var __s = window.stx = window.stx || {};
@@ -12564,15 +12564,15 @@ ${l.join(`
12564
12564
  `)}
12565
12565
  ${h}
12566
12566
  })();
12567
- </script>`;return gr.set(i,p),p}function R1(e){xi.clear();for(let t of e)xi.add(t)}var gr,xi,Sm,I1=R(()=>{Qt(),E1(),gr=new Map,xi=new Set,Sm=new Set(ua)}),_m={};Y(_m,{getComposableScript:()=>D1,clearComposableCache:()=>$1});function km(e){let t=un.basename(e,".ts");return t==="index"||t==="types"||e.endsWith(".d.ts")}async function O1(e){if(e)return un.resolve(e);let t=`<default>:${process.cwd()}`,r=Si.get(t);if(r!==void 0)return r;let n=await j1();if(n!==null)Si.set(t,n);return n}async function j1(){let e=await Xt(),t=e.root||process.cwd(),r=e.composablesDir;if(r)return un.resolve(t,r);for(let n of Em){let i=un.resolve(t,n);try{let s=new Bun.Glob("**/*.ts");for await(let a of s.scan({cwd:i,absolute:!0}))if(!km(a))return i}catch{}}return null}async function D1(e){let t=await O1(e);if(!t)return null;let r=[];try{let p=new Bun.Glob("**/*.ts");for await(let f of p.scan({cwd:t,absolute:!0})){if(km(f))continue;r.push(f)}}catch{return yt(Nt,t,"",""),null}let n=mm(r),i=gm(Nt,t,n);if(i!==void 0)return i||null;if(r.length===0)return yt(Nt,t,n,""),null;r.sort();let s=new Bun.Transpiler({loader:"ts",target:"browser",define:Zt()}),a=[],o=new Set,l=new Set;for(let p of r)try{let f=await Bun.file(p).text(),m=un.basename(p,".ts");for(let y of f.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(y[1])l.add(y[1]);try{for(let y of s.scan(f).exports)if(y!=="default")o.add(y)}catch{}f=Ut(f),f=Mu(f),f=f.replace(/^export\s+(default\s+)?/gm,""),f=s.transformSync(f),a.push(`// Composable: ${m}
12568
- ${f.trim()}`)}catch(f){console.warn(`[stx] Failed to load composable ${p}:`,f)}if(a.length===0||o.size===0)return yt(Nt,t,n,""),null;let c=[...o].map((p)=>` try { __c[${JSON.stringify(p)}] = ${p}; } catch (e) {}`).join(`
12567
+ </script>`;return yr.set(i,p),p}function I1(e){Si.clear();for(let t of e)Si.add(t)}var yr,Si,_m,O1=R(()=>{Xt(),A1(),yr=new Map,Si=new Set,_m=new Set(da)}),km={};K(km,{getComposableScript:()=>$1,clearComposableCache:()=>L1});function Em(e){let t=dn.basename(e,".ts");return t==="index"||t==="types"||e.endsWith(".d.ts")}async function j1(e){if(e)return dn.resolve(e);let t=`<default>:${process.cwd()}`,r=_i.get(t);if(r!==void 0)return r;let n=await D1();if(n!==null)_i.set(t,n);return n}async function D1(){let e=await er(),t=e.root||process.cwd(),r=e.composablesDir;if(r)return dn.resolve(t,r);for(let n of Am){let i=dn.resolve(t,n);try{let s=new Bun.Glob("**/*.ts");for await(let a of s.scan({cwd:i,absolute:!0}))if(!Em(a))return i}catch{}}return null}async function $1(e){let t=await j1(e);if(!t)return null;let r=[];try{let p=new Bun.Glob("**/*.ts");for await(let f of p.scan({cwd:t,absolute:!0})){if(Em(f))continue;r.push(f)}}catch{return vt(Pt,t,"",""),null}let n=gm(r),i=ym(Pt,t,n);if(i!==void 0)return i||null;if(r.length===0)return vt(Pt,t,n,""),null;r.sort();let s=new Bun.Transpiler({loader:"ts",target:"browser",define:Qt()}),a=[],o=new Set,l=new Set;for(let p of r)try{let f=await Bun.file(p).text(),m=dn.basename(p,".ts");for(let y of f.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(y[1])l.add(y[1]);try{for(let y of s.scan(f).exports)if(y!=="default")o.add(y)}catch{}f=Gt(f),f=Bu(f),f=f.replace(/^export\s+(default\s+)?/gm,""),f=s.transformSync(f),a.push(`// Composable: ${m}
12568
+ ${f.trim()}`)}catch(f){console.warn(`[stx] Failed to load composable ${p}:`,f)}if(a.length===0||o.size===0)return vt(Pt,t,n,""),null;let c=[...o].map((p)=>` try { __c[${JSON.stringify(p)}] = ${p}; } catch (e) {}`).join(`
12569
12569
  `),u=JSON.stringify([...o]),d=a.join(`
12570
12570
 
12571
12571
  `),h=`;(function(){
12572
12572
  window.__composables = window.__composables || {};
12573
12573
  var __c = window.__composables;
12574
12574
  var __stx = window.stx || {};
12575
- ${Ht.filter((p)=>!l.has(p)&&new RegExp(`\\b${p}\\b`).test(d)).map((p)=>`var ${p} = __stx[${JSON.stringify(p)}];`).join(`
12575
+ ${Ut.filter((p)=>!l.has(p)&&new RegExp(`\\b${p}\\b`).test(d)).map((p)=>`var ${p} = __stx[${JSON.stringify(p)}];`).join(`
12576
12576
  `)}
12577
12577
  ${d}
12578
12578
  ${c}
@@ -12589,7 +12589,7 @@ ${c}
12589
12589
  }
12590
12590
  window[__n] = __c[__n];
12591
12591
  }
12592
- })();`;return yt(Nt,t,n,h),h}function $1(){Nt.clear(),Si.clear()}var Nt,Si,Em,L1=R(()=>{Et(),Qt(),ym(),nt(),Nt=new Map,Si=new Map,Em=["composables","functions"]}),Am={};Y(Am,{processDeferDirectives:()=>z1});function N1(){return`stx-defer-${++Cm}`}function P1(e){let t=e.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(t)return{trigger:t[1],value:t[2]};return{trigger:"immediate"}}function M1(e,t,r){let{trigger:n,value:i}=P1(t),s=r,a,o,l,c=r.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(c)a=c[1].trim(),s=s.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let u=r.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(u)o=u[1].trim(),s=s.replace(/@loading[\s\S]*?(?=@error|$)/,"");let d=r.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(d)l=d[2].trim(),s=s.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return s=s.trim(),{trigger:n,triggerValue:i,content:s,placeholder:a,loading:o,error:l}}function B1(e,t){let{trigger:r,triggerValue:n}=t,i;switch(r){case"visible":i=`
12592
+ })();`;return vt(Pt,t,n,h),h}function L1(){Pt.clear(),_i.clear()}var Pt,_i,Am,N1=R(()=>{At(),Xt(),vm(),it(),Pt=new Map,_i=new Map,Am=["composables","functions"]}),Cm={};K(Cm,{processDeferDirectives:()=>F1});function P1(){return`stx-defer-${++Tm}`}function M1(e){let t=e.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(t)return{trigger:t[1],value:t[2]};return{trigger:"immediate"}}function B1(e,t,r){let{trigger:n,value:i}=M1(t),s=r,a,o,l,c=r.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(c)a=c[1].trim(),s=s.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let u=r.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(u)o=u[1].trim(),s=s.replace(/@loading[\s\S]*?(?=@error|$)/,"");let d=r.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(d)l=d[2].trim(),s=s.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return s=s.trim(),{trigger:n,triggerValue:i,content:s,placeholder:a,loading:o,error:l}}function z1(e,t){let{trigger:r,triggerValue:n}=t,i;switch(r){case"visible":i=`
12593
12593
  const observer = new IntersectionObserver((entries) => {
12594
12594
  if (entries[0].isIntersecting) {
12595
12595
  observer.disconnect();
@@ -12662,7 +12662,7 @@ else {
12662
12662
  ${i}
12663
12663
  })();
12664
12664
  </script>
12665
- `}function z1(e,t,r){Cm=0;let n=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return e.replace(n,(i,s,a)=>{let o=N1(),l=M1(i,s,a),c=l.placeholder?`<div data-defer-placeholder>${l.placeholder}</div>`:"",u=l.loading?`<div data-defer-loading style="display: none;">${l.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',d=l.error?`<div data-defer-error style="display: none;">${l.error}</div>`:"",h=`<div data-defer-content style="display: none;">${l.content}</div>`,p=B1(o,l);return`
12665
+ `}function F1(e,t,r){Tm=0;let n=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return e.replace(n,(i,s,a)=>{let o=P1(),l=B1(i,s,a),c=l.placeholder?`<div data-defer-placeholder>${l.placeholder}</div>`:"",u=l.loading?`<div data-defer-loading style="display: none;">${l.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',d=l.error?`<div data-defer-error style="display: none;">${l.error}</div>`:"",h=`<div data-defer-content style="display: none;">${l.content}</div>`,p=z1(o,l);return`
12666
12666
  <div id="${o}" class="stx-defer" data-defer-trigger="${l.trigger}">
12667
12667
  ${c}
12668
12668
  ${u}
@@ -12670,7 +12670,7 @@ else {
12670
12670
  ${d}
12671
12671
  </div>
12672
12672
  ${p}
12673
- `})}var Cm=0,Tm={};Y(Tm,{processTeleportDirectives:()=>H1,ensureTeleportTargets:()=>U1});function F1(){return`stx-teleport-${++Rm}`}function q1(e){let t=e.split(",").map((i)=>i.trim()),r=t[0].replace(/['"]/g,""),n;for(let i=1;i<t.length;i++){let s=t[i].match(/disabled:\s*(.+)/);if(s)n=s[1].trim()}return{target:r,disabled:n}}function W1(e,t){return`
12673
+ `})}var Tm=0,Rm={};K(Rm,{processTeleportDirectives:()=>U1,ensureTeleportTargets:()=>G1});function q1(){return`stx-teleport-${++Im}`}function W1(e){let t=e.split(",").map((i)=>i.trim()),r=t[0].replace(/['"]/g,""),n;for(let i=1;i<t.length;i++){let s=t[i].match(/disabled:\s*(.+)/);if(s)n=s[1].trim()}return{target:r,disabled:n}}function H1(e,t){return`
12674
12674
  <script>
12675
12675
  (function() {
12676
12676
  const source = document.getElementById('${e}');
@@ -12716,12 +12716,12 @@ else {
12716
12716
  });
12717
12717
  })();
12718
12718
  </script>
12719
- `}function H1(e,t,r){Rm=0;let n=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return e.replace(n,(i,s,a)=>{let o=F1(),{target:l,disabled:c}=q1(s),u=a.trim();if(c)try{let h=!1;if(c==="true")h=!0;else if(c==="false")h=!1;else if(c in t)h=Boolean(t[c]);if(h)return`<div class="stx-teleport-inline" data-teleport-disabled>${u}</div>`}catch{}let d=W1(o,l);return`
12719
+ `}function U1(e,t,r){Im=0;let n=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return e.replace(n,(i,s,a)=>{let o=q1(),{target:l,disabled:c}=W1(s),u=a.trim();if(c)try{let h=!1;if(c==="true")h=!0;else if(c==="false")h=!1;else if(c in t)h=Boolean(t[c]);if(h)return`<div class="stx-teleport-inline" data-teleport-disabled>${u}</div>`}catch{}let d=H1(o,l);return`
12720
12720
  <div id="${o}" class="stx-teleport-source" style="display: none;">
12721
12721
  <template>${u}</template>
12722
12722
  </div>
12723
12723
  ${d}
12724
- `})}function U1(){return`
12724
+ `})}function G1(){return`
12725
12725
  <script>
12726
12726
  (function() {
12727
12727
  // Common teleport targets
@@ -12738,7 +12738,7 @@ else {
12738
12738
  });
12739
12739
  })();
12740
12740
  </script>
12741
- `}var Rm=0,Im={};Y(Im,{processTransitionDirectives:()=>Y1,processTransitionAttributes:()=>X1,performLeave:()=>J1,performEnter:()=>V1,generateTransitionRuntime:()=>Q1,generateTransitionCSS:()=>Z1});function Om(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function G1(e){let t=getComputedStyle(e),r=t.transitionDuration||"0s",n=t.animationDuration||"0s",i=(s)=>{let a=s.match(/^([\d.]+)(s|ms)?$/);if(!a)return 0;let o=parseFloat(a[1]);return(a[2]||"s")==="ms"?o:o*1000};return Math.max(i(r),i(n))}function jm(e,t){return new Promise((r)=>{let n=t??G1(e);if(n===0){r();return}let i=!1,s=()=>{if(i)return;i=!0,e.removeEventListener("transitionend",a),e.removeEventListener("animationend",a),r()},a=(o)=>{if(o.target===e)s()};e.addEventListener("transitionend",a),e.addEventListener("animationend",a),setTimeout(s,n+50)})}function Dm(e){e.offsetHeight}async function V1(e,t={}){let r=t.name||"stx",n=Om(r,t),i=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),Dm(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((s)=>{t.onEnter(e,s)});else await jm(e,i);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function J1(e,t={}){let r=t.name||"stx",n=Om(r,t),i=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),Dm(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((s)=>{t.onLeave(e,s)});else await jm(e,i);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function Y1(e,t={},r){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(i,s,a)=>{let o=K1(s),l=o.name||"stx",c=o.duration||300,u=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12741
+ `}var Im=0,Om={};K(Om,{processTransitionDirectives:()=>K1,processTransitionAttributes:()=>eE,performLeave:()=>Y1,performEnter:()=>J1,generateTransitionRuntime:()=>X1,generateTransitionCSS:()=>Q1});function jm(e,t={}){return{enterFrom:t.enterClass||`${e}-enter-from`,enterActive:t.enterActiveClass||`${e}-enter-active`,enterTo:t.enterToClass||`${e}-enter-to`,leaveFrom:t.leaveClass||`${e}-leave-from`,leaveActive:t.leaveActiveClass||`${e}-leave-active`,leaveTo:t.leaveToClass||`${e}-leave-to`}}function V1(e){let t=getComputedStyle(e),r=t.transitionDuration||"0s",n=t.animationDuration||"0s",i=(s)=>{let a=s.match(/^([\d.]+)(s|ms)?$/);if(!a)return 0;let o=parseFloat(a[1]);return(a[2]||"s")==="ms"?o:o*1000};return Math.max(i(r),i(n))}function Dm(e,t){return new Promise((r)=>{let n=t??V1(e);if(n===0){r();return}let i=!1,s=()=>{if(i)return;i=!0,e.removeEventListener("transitionend",a),e.removeEventListener("animationend",a),r()},a=(o)=>{if(o.target===e)s()};e.addEventListener("transitionend",a),e.addEventListener("animationend",a),setTimeout(s,n+50)})}function $m(e){e.offsetHeight}async function J1(e,t={}){let r=t.name||"stx",n=jm(r,t),i=typeof t.duration==="object"?t.duration.enter:t.duration;if(t.onBeforeEnter?.(e),e.classList.add(n.enterFrom),e.classList.add(n.enterActive),$m(e),e.classList.remove(n.enterFrom),e.classList.add(n.enterTo),t.onEnter)await new Promise((s)=>{t.onEnter(e,s)});else await Dm(e,i);e.classList.remove(n.enterActive),e.classList.remove(n.enterTo),t.onAfterEnter?.(e)}async function Y1(e,t={}){let r=t.name||"stx",n=jm(r,t),i=typeof t.duration==="object"?t.duration.leave:t.duration;if(t.onBeforeLeave?.(e),e.classList.add(n.leaveFrom),e.classList.add(n.leaveActive),$m(e),e.classList.remove(n.leaveFrom),e.classList.add(n.leaveTo),t.onLeave)await new Promise((s)=>{t.onLeave(e,s)});else await Dm(e,i);e.classList.remove(n.leaveActive),e.classList.remove(n.leaveTo),t.onAfterLeave?.(e)}function K1(e,t={},r){let n=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return e.replace(n,(i,s,a)=>{let o=Z1(s),l=o.name||"stx",c=o.duration||300,u=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12742
12742
  <div
12743
12743
  class="stx-transition-wrapper"
12744
12744
  data-transition="${l}"
@@ -12780,7 +12780,7 @@ else {
12780
12780
  });
12781
12781
  })();
12782
12782
  </script>
12783
- `})}function K1(e){let t={},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3]||n[4]||n[5];switch(i){case"name":t.name=s;break;case"duration":t.duration=parseInt(s,10);break;case"mode":t.mode=s;break;case"easing":t.easing=s;break}}return t}function Z1(){return`
12783
+ `})}function Z1(e){let t={},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3]||n[4]||n[5];switch(i){case"name":t.name=s;break;case"duration":t.duration=parseInt(s,10);break;case"mode":t.mode=s;break;case"easing":t.easing=s;break}}return t}function Q1(){return`
12784
12784
  /* STX Transition Presets */
12785
12785
 
12786
12786
  /* Fade */
@@ -12967,7 +12967,7 @@ else {
12967
12967
  opacity: 1;
12968
12968
  max-height: 1000px;
12969
12969
  }
12970
- `}function Q1(){return`
12970
+ `}function X1(){return`
12971
12971
  // STX Transition Runtime
12972
12972
  (function() {
12973
12973
  if (typeof window === 'undefined') return;
@@ -13056,7 +13056,7 @@ else {
13056
13056
 
13057
13057
  console.log('[stx] Transition runtime initialized');
13058
13058
  })();
13059
- `}function X1(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(r,n,i,s)=>{let a=i||"300",o=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${a}" data-stx-transition-condition="${s}" data-stx-transition-id="${o}"`})}var $m={};Y($m,{withErrorBoundary:()=>Lm,processErrorBoundaryDirectives:()=>tE,generateErrorBoundaryRuntime:()=>aE,generateErrorBoundaryCSS:()=>sE,createErrorBoundary:()=>iE});function eE(){return`eb-${++oE}-${Date.now().toString(36)}`}function tE(e,t={},r){let n=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return e.replace(n,(i,s,a,o)=>{let l=eE(),c=rE(s||"");return nE(l,a.trim(),o.trim(),c)})}function rE(e){let t={},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3]||n[4];switch(i){case"id":t.id=s;break;case"logErrors":t.logErrors=s==="true";break}}return t}function nE(e,t,r,n){let i=n.logErrors!==!1;return`
13059
+ `}function eE(e){let t=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return e.replace(t,(r,n,i,s)=>{let a=i||"300",o=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${n}" data-stx-transition-duration="${a}" data-stx-transition-condition="${s}" data-stx-transition-id="${o}"`})}var Lm={};K(Lm,{withErrorBoundary:()=>Nm,processErrorBoundaryDirectives:()=>rE,generateErrorBoundaryRuntime:()=>oE,generateErrorBoundaryCSS:()=>aE,createErrorBoundary:()=>sE});function tE(){return`eb-${++lE}-${Date.now().toString(36)}`}function rE(e,t={},r){let n=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return e.replace(n,(i,s,a,o)=>{let l=tE(),c=nE(s||"");return iE(l,a.trim(),o.trim(),c)})}function nE(e){let t={},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3]||n[4];switch(i){case"id":t.id=s;break;case"logErrors":t.logErrors=s==="true";break}}return t}function iE(e,t,r,n){let i=n.logErrors!==!1;return`
13060
13060
  <div class="stx-error-boundary" data-boundary-id="${e}" data-has-error="false">
13061
13061
  <div class="stx-error-boundary-content" data-boundary-content="${e}">
13062
13062
  ${t}
@@ -13176,7 +13176,7 @@ else {
13176
13176
  };
13177
13177
  })();
13178
13178
  </script>
13179
- `}async function Lm(e,t,r){try{return await e()}catch(n){if(r)r(n instanceof Error?n:Error(String(n)));else console.error("[stx:errorBoundary] SSR Error:",n);return t}}function iE(e,t={}){let r=t.onError?(n)=>t.onError(n,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(n)=>Lm(n,e,r)}function sE(){return`
13179
+ `}async function Nm(e,t,r){try{return await e()}catch(n){if(r)r(n instanceof Error?n:Error(String(n)));else console.error("[stx:errorBoundary] SSR Error:",n);return t}}function sE(e,t={}){let r=t.onError?(n)=>t.onError(n,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(n)=>Nm(n,e,r)}function aE(){return`
13180
13180
  /* STX Error Boundary Styles */
13181
13181
  .stx-error-boundary {
13182
13182
  position: relative;
@@ -13220,7 +13220,7 @@ else {
13220
13220
  color: #fecaca;
13221
13221
  }
13222
13222
  }
13223
- `}function aE(){return`
13223
+ `}function oE(){return`
13224
13224
  // STX Error Boundary Runtime
13225
13225
  (function() {
13226
13226
  if (typeof window === 'undefined') return;
@@ -13285,7 +13285,7 @@ else {
13285
13285
 
13286
13286
  console.log('[stx] Error boundary runtime initialized');
13287
13287
  })();
13288
- `}var oE=0,Nm={};Y(Nm,{renderSSRSuspense:()=>fE,processSuspenseDirectives:()=>cE,generateSuspenseRuntime:()=>mE,generateSuspenseCSS:()=>hE,createSSRSuspense:()=>pE});function lE(){return`suspense-${++gE}-${Date.now().toString(36)}`}function cE(e,t={},r){let n=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return e.replace(n,(i,s,a,o)=>{let l=lE(),c=uE(s||"");return dE(l,a.trim(),o.trim(),c)})}function uE(e){let t={},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3],a=n[4];switch(i){case"id":t.id=s;break;case"timeout":t.timeout=a?parseInt(a,10):void 0;break}}return t}function dE(e,t,r,n){let i=n.timeout||30000,s=n.id||e;return`
13288
+ `}var lE=0,Pm={};K(Pm,{renderSSRSuspense:()=>hE,processSuspenseDirectives:()=>uE,generateSuspenseRuntime:()=>gE,generateSuspenseCSS:()=>mE,createSSRSuspense:()=>fE});function cE(){return`suspense-${++yE}-${Date.now().toString(36)}`}function uE(e,t={},r){let n=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return e.replace(n,(i,s,a,o)=>{let l=cE(),c=dE(s||"");return pE(l,a.trim(),o.trim(),c)})}function dE(e){let t={},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3],a=n[4];switch(i){case"id":t.id=s;break;case"timeout":t.timeout=a?parseInt(a,10):void 0;break}}return t}function pE(e,t,r,n){let i=n.timeout||30000,s=n.id||e;return`
13289
13289
  <div class="stx-suspense" data-suspense-id="${e}" data-custom-id="${s}" data-status="pending">
13290
13290
  <div class="stx-suspense-fallback" data-suspense-fallback="${e}">
13291
13291
  ${r}
@@ -13475,7 +13475,7 @@ else {
13475
13475
  }, 0);
13476
13476
  })();
13477
13477
  </script>
13478
- `}function pE(e,t,r){return{id:e,fallback:r,content:t}}async function fE(e){let t=e.map((n)=>`
13478
+ `}function fE(e,t,r){return{id:e,fallback:r,content:t}}async function hE(e){let t=e.map((n)=>`
13479
13479
  <div id="stx-ssr-suspense-${n.id}" class="stx-ssr-suspense">
13480
13480
  ${n.fallback}
13481
13481
  </div>
@@ -13500,7 +13500,7 @@ else {
13500
13500
  }
13501
13501
  })();
13502
13502
  </script>
13503
- `}}return{initial:t,streaming:r()}}function hE(){return`
13503
+ `}}return{initial:t,streaming:r()}}function mE(){return`
13504
13504
  /* STX Suspense Styles */
13505
13505
  .stx-suspense {
13506
13506
  position: relative;
@@ -13556,7 +13556,7 @@ else {
13556
13556
  background-size: 200% 100%;
13557
13557
  }
13558
13558
  }
13559
- `}function mE(){return`
13559
+ `}function gE(){return`
13560
13560
  // STX Suspense Runtime
13561
13561
  (function() {
13562
13562
  if (typeof window === 'undefined') return;
@@ -13623,7 +13623,7 @@ else {
13623
13623
 
13624
13624
  console.log('[stx] Suspense runtime initialized');
13625
13625
  })();
13626
- `}var gE=0,Pm={};Y(Pm,{processAsyncDirectives:()=>yE,isAsyncComponent:()=>wE,generateAsyncComponentRuntime:()=>xE,generateAsyncComponentCSS:()=>bE,defineAsyncComponent:()=>vE});function Ic(){return`async-${++SE}-${Date.now().toString(36)}`}function yE(e,t={},r){let n=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,s=e;return s=s.replace(n,(a,o,l,c)=>{let u=Ic(),d=Oc(o);return jc(u,d,l.trim(),c.trim())}),s=s.replace(i,(a,o,l)=>{let c=Ic(),u=Oc(o);return jc(c,u,l.trim(),'<div class="stx-async-error">Failed to load component</div>')}),s}function Oc(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3],a=n[4],o=n[5];switch(i){case"component":t.component=s||o||"";break;case"timeout":t.timeout=a?parseInt(a,10):30000;break;case"delay":t.delay=a?parseInt(a,10):200;break;case"suspensible":t.suspensible=o==="true";break;case"retries":t.retries=a?parseInt(a,10):0;break;case"loadingComponent":t.loadingComponent=s||o;break;case"errorComponent":t.errorComponent=s||o;break}}return t}function jc(e,t,r,n){let{component:i,timeout:s,delay:a,suspensible:o,retries:l}=t;return`
13626
+ `}var yE=0,Mm={};K(Mm,{processAsyncDirectives:()=>vE,isAsyncComponent:()=>bE,generateAsyncComponentRuntime:()=>SE,generateAsyncComponentCSS:()=>xE,defineAsyncComponent:()=>wE});function Oc(){return`async-${++_E}-${Date.now().toString(36)}`}function vE(e,t={},r){let n=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,s=e;return s=s.replace(n,(a,o,l,c)=>{let u=Oc(),d=jc(o);return Dc(u,d,l.trim(),c.trim())}),s=s.replace(i,(a,o,l)=>{let c=Oc(),u=jc(o);return Dc(c,u,l.trim(),'<div class="stx-async-error">Failed to load component</div>')}),s}function jc(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3],a=n[4],o=n[5];switch(i){case"component":t.component=s||o||"";break;case"timeout":t.timeout=a?parseInt(a,10):30000;break;case"delay":t.delay=a?parseInt(a,10):200;break;case"suspensible":t.suspensible=o==="true";break;case"retries":t.retries=a?parseInt(a,10):0;break;case"loadingComponent":t.loadingComponent=s||o;break;case"errorComponent":t.errorComponent=s||o;break}}return t}function Dc(e,t,r,n){let{component:i,timeout:s,delay:a,suspensible:o,retries:l}=t;return`
13627
13627
  <div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
13628
13628
  <div class="stx-async-loading" data-async-loading="${e}">
13629
13629
  ${r}
@@ -13850,7 +13850,7 @@ catch (error) {
13850
13850
  loadComponent();
13851
13851
  })();
13852
13852
  </script>
13853
- `}function vE(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function wE(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function bE(){return`
13853
+ `}function wE(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function bE(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function xE(){return`
13854
13854
  /* STX Async Component Styles */
13855
13855
  .stx-async-component {
13856
13856
  position: relative;
@@ -13924,7 +13924,7 @@ catch (error) {
13924
13924
  background-size: 200% 100%;
13925
13925
  }
13926
13926
  }
13927
- `}function xE(){return`
13927
+ `}function SE(){return`
13928
13928
  // STX Async Component Runtime
13929
13929
  (function() {
13930
13930
  if (typeof window === 'undefined') return;
@@ -13978,7 +13978,7 @@ catch (error) {
13978
13978
 
13979
13979
  console.log('[stx] Async component runtime initialized');
13980
13980
  })();
13981
- `}var SE=0,Mm={};Y(Mm,{shouldCacheComponent:()=>CE,processKeepAliveDirectives:()=>_E,onDeactivated:()=>OE,onActivated:()=>IE,generateKeepAliveRuntime:()=>RE,generateKeepAliveCSS:()=>TE,createKeepAliveCache:()=>AE});function Bm(){return`keep-alive-${++jE}-${Date.now().toString(36)}`}function _E(e,t={},r){let n=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(n,(i,s,a)=>{let o=Bm(),l=kE(s||"");return EE(o,a.trim(),l)})}function kE(e){let t={max:10},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3],a=n[4];switch(i){case"max":t.max=a?parseInt(a,10):10;break;case"include":t.include=s;break;case"exclude":t.exclude=s;break;case"id":t.id=s;break}}return t}function EE(e,t,r){let{max:n,include:i,exclude:s}=r,a=r.id||e;return`
13981
+ `}var _E=0,Bm={};K(Bm,{shouldCacheComponent:()=>TE,processKeepAliveDirectives:()=>kE,onDeactivated:()=>jE,onActivated:()=>OE,generateKeepAliveRuntime:()=>IE,generateKeepAliveCSS:()=>RE,createKeepAliveCache:()=>CE});function zm(){return`keep-alive-${++DE}-${Date.now().toString(36)}`}function kE(e,t={},r){let n=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return e.replace(n,(i,s,a)=>{let o=zm(),l=EE(s||"");return AE(o,a.trim(),l)})}function EE(e){let t={max:10},r=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,n;while((n=r.exec(e))!==null){let i=n[1],s=n[2]||n[3],a=n[4];switch(i){case"max":t.max=a?parseInt(a,10):10;break;case"include":t.include=s;break;case"exclude":t.exclude=s;break;case"id":t.id=s;break}}return t}function AE(e,t,r){let{max:n,include:i,exclude:s}=r,a=r.id||e;return`
13982
13982
  <div class="stx-keep-alive" data-keep-alive-id="${e}" data-custom-id="${a}">
13983
13983
  <div class="stx-keep-alive-content" data-keep-alive-content="${e}">
13984
13984
  ${t}
@@ -14265,7 +14265,7 @@ else {
14265
14265
  });
14266
14266
  })();
14267
14267
  </script>
14268
- `}function AE(e={}){return{id:e.id||Bm(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((t)=>t.trim()):null,exclude:e.exclude?e.exclude.split(",").map((t)=>t.trim()):null}}function CE(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function TE(){return`
14268
+ `}function CE(e={}){return{id:e.id||zm(),cache:new Map,max:e.max||10,include:e.include?e.include.split(",").map((t)=>t.trim()):null,exclude:e.exclude?e.exclude.split(",").map((t)=>t.trim()):null}}function TE(e,t){if(t.exclude&&t.exclude.includes(e))return!1;if(t.include&&!t.include.includes(e))return!1;return!0}function RE(){return`
14269
14269
  /* STX Keep-Alive Styles */
14270
14270
  .stx-keep-alive {
14271
14271
  position: relative;
@@ -14290,7 +14290,7 @@ else {
14290
14290
  .stx-keep-alive-content > [data-activated] {
14291
14291
  opacity: 1;
14292
14292
  }
14293
- `}function RE(){return`
14293
+ `}function IE(){return`
14294
14294
  // STX Keep-Alive Runtime
14295
14295
  (function() {
14296
14296
  if (typeof window === 'undefined') return;
@@ -14326,7 +14326,7 @@ else {
14326
14326
 
14327
14327
  console.log('[stx] Keep-alive runtime initialized');
14328
14328
  })();
14329
- `}function IE(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function OE(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}var jE=0,zm={};Y(zm,{useVirtualList:()=>qm,processVirtualListDirectives:()=>Xo,processVirtualGridDirectives:()=>Hm,processInfiniteListDirectives:()=>Wm,generateVirtualListCSS:()=>Fm,default:()=>Um,createVirtualList:()=>Qo});function Qo(e,t){let{itemHeight:r,containerHeight:n,overscan:i=3,keyProperty:s="id",dynamicHeight:a=!1,estimatedItemHeight:o=r,direction:l="vertical"}=t,c=[...e],u=0,d=new Map;function h(){if(a)return p();let x=Math.max(0,Math.floor(u/r)-i),_=Math.ceil(n/r),E=Math.min(c.length-1,x+_+i*2);return{startIndex:x,endIndex:E}}function p(){let x=0,_=0,E=c.length-1;for(let k=0;k<c.length;k++){let A=d.get(k)||o;if(x+A>u){_=Math.max(0,k-i);break}x+=A}x=0;for(let k=0;k<c.length;k++){let A=d.get(k)||o;if(x+=A,x>u+n){E=Math.min(c.length-1,k+i);break}}return{startIndex:_,endIndex:E}}function f(){if(a){let x=0;for(let _=0;_<c.length;_++)x+=d.get(_)||o;return x}return c.length*r}function m(x){if(a){let _=0;for(let E=0;E<x;E++)_+=d.get(E)||o;return _}return x*r}function y(){let{startIndex:x,endIndex:_}=h();return{startIndex:x,endIndex:_,scrollTop:u,totalHeight:f(),visibleItems:c.slice(x,_+1),itemHeights:new Map(d)}}function g(x,_="auto"){let E=m(x);v(E,_)}function v(x,_="auto"){u=Math.max(0,Math.min(x,f()-n))}function w(){h()}function b(x){c=[...x],d.clear(),w()}function S(){c=[],d.clear()}return{scrollToIndex:g,scrollToOffset:v,getState:y,refresh:w,setItems:b,destroy:S}}function Xo(e,t={},r){let n=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return e.replace(n,(i,s,a,o)=>{let l=s.trim(),c=t[l];if(!c||!Array.isArray(c))return`<!-- virtualList: items "${l}" not found or not an array -->`;let u={itemHeight:50,containerHeight:400,overscan:3};if(a)try{let v=a.trim(),w=Function(`return ${v}`)();u={...u,...w}}catch{}let d=`vlist-${Math.random().toString(36).substring(2,9)}`,h=Math.ceil(u.containerHeight/u.itemHeight),p=u.overscan||3,f=0,m=Math.min(c.length-1,h+p),y="";for(let v=f;v<=m&&v<c.length;v++){let w=c[v],b=o.replace(/\{\{\s*item\s*\}\}/g,typeof w==="object"?JSON.stringify(w):String(w)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(S,x)=>{if(typeof w==="object"&&w!==null)return String(w[x]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(v));y+=`
14329
+ `}function OE(e){if(typeof document<"u")document.addEventListener("stx:activated",(t)=>{e(t.detail)})}function jE(e){if(typeof document<"u")document.addEventListener("stx:deactivated",(t)=>{e(t.detail)})}var DE=0,Fm={};K(Fm,{useVirtualList:()=>Wm,processVirtualListDirectives:()=>el,processVirtualGridDirectives:()=>Um,processInfiniteListDirectives:()=>Hm,generateVirtualListCSS:()=>qm,default:()=>Gm,createVirtualList:()=>Xo});function Xo(e,t){let{itemHeight:r,containerHeight:n,overscan:i=3,keyProperty:s="id",dynamicHeight:a=!1,estimatedItemHeight:o=r,direction:l="vertical"}=t,c=[...e],u=0,d=new Map;function h(){if(a)return p();let x=Math.max(0,Math.floor(u/r)-i),_=Math.ceil(n/r),E=Math.min(c.length-1,x+_+i*2);return{startIndex:x,endIndex:E}}function p(){let x=0,_=0,E=c.length-1;for(let k=0;k<c.length;k++){let A=d.get(k)||o;if(x+A>u){_=Math.max(0,k-i);break}x+=A}x=0;for(let k=0;k<c.length;k++){let A=d.get(k)||o;if(x+=A,x>u+n){E=Math.min(c.length-1,k+i);break}}return{startIndex:_,endIndex:E}}function f(){if(a){let x=0;for(let _=0;_<c.length;_++)x+=d.get(_)||o;return x}return c.length*r}function m(x){if(a){let _=0;for(let E=0;E<x;E++)_+=d.get(E)||o;return _}return x*r}function y(){let{startIndex:x,endIndex:_}=h();return{startIndex:x,endIndex:_,scrollTop:u,totalHeight:f(),visibleItems:c.slice(x,_+1),itemHeights:new Map(d)}}function g(x,_="auto"){let E=m(x);v(E,_)}function v(x,_="auto"){u=Math.max(0,Math.min(x,f()-n))}function w(){h()}function b(x){c=[...x],d.clear(),w()}function S(){c=[],d.clear()}return{scrollToIndex:g,scrollToOffset:v,getState:y,refresh:w,setItems:b,destroy:S}}function el(e,t={},r){let n=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return e.replace(n,(i,s,a,o)=>{let l=s.trim(),c=t[l];if(!c||!Array.isArray(c))return`<!-- virtualList: items "${l}" not found or not an array -->`;let u={itemHeight:50,containerHeight:400,overscan:3};if(a)try{let v=a.trim(),w=Function(`return ${v}`)();u={...u,...w}}catch{}let d=`vlist-${Math.random().toString(36).substring(2,9)}`,h=Math.ceil(u.containerHeight/u.itemHeight),p=u.overscan||3,f=0,m=Math.min(c.length-1,h+p),y="";for(let v=f;v<=m&&v<c.length;v++){let w=c[v],b=o.replace(/\{\{\s*item\s*\}\}/g,typeof w==="object"?JSON.stringify(w):String(w)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(S,x)=>{if(typeof w==="object"&&w!==null)return String(w[x]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(v));y+=`
14330
14330
  <div class="virtual-item ${u.itemClass||""}"
14331
14331
  style="position: absolute; top: ${v*u.itemHeight}px; height: ${u.itemHeight}px; width: 100%;"
14332
14332
  data-index="${v}">
@@ -14403,7 +14403,7 @@ else {
14403
14403
  };
14404
14404
  })();
14405
14405
  </script>
14406
- `})}function Fm(){return`
14406
+ `})}function qm(){return`
14407
14407
  .virtual-list-container {
14408
14408
  position: relative;
14409
14409
  overflow-y: auto;
@@ -14451,7 +14451,7 @@ else {
14451
14451
  0% { background-position: 200% 0; }
14452
14452
  100% { background-position: -200% 0; }
14453
14453
  }
14454
- `}function qm(e,t){let r=null,n=()=>{if(!r)r=Qo(e(),t);return r};return{visibleItems:()=>{return n().getState().visibleItems},totalHeight:()=>{return n().getState().totalHeight},containerProps:()=>({style:{height:`${t.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(i)=>{let s=i.target;if(r)r.scrollToOffset(s.scrollTop)}}),itemProps:(i)=>({style:{position:"absolute",top:`${i*t.itemHeight}px`,height:`${t.itemHeight}px`,width:"100%"},"data-index":i}),scrollToIndex:(i)=>{n().scrollToIndex(i)}}}function Wm(e,t={},r){let n=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return e.replace(n,(i,s,a,o,l)=>{let c=s.trim(),u=t[c];if(!u||!Array.isArray(u))return`<!-- infiniteList: items "${c}" not found or not an array -->`;let d={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(a)try{let f=Function(`return ${a.trim()}`)();d={...d,...f}}catch{}let h=`ilist-${Math.random().toString(36).substring(2,9)}`,p=Xo(`@virtualList(${c}, ${JSON.stringify({itemHeight:d.itemHeight,containerHeight:d.containerHeight,overscan:d.overscan,containerClass:d.containerClass})})${o}@endvirtualList`,t);return p=p.replace("</script>",`
14454
+ `}function Wm(e,t){let r=null,n=()=>{if(!r)r=Xo(e(),t);return r};return{visibleItems:()=>n().getState().visibleItems,totalHeight:()=>n().getState().totalHeight,containerProps:()=>({style:{height:`${t.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(i)=>{let s=i.target;if(r)r.scrollToOffset(s.scrollTop)}}),itemProps:(i)=>({style:{position:"absolute",top:`${i*t.itemHeight}px`,height:`${t.itemHeight}px`,width:"100%"},"data-index":i}),scrollToIndex:(i)=>{n().scrollToIndex(i)}}}function Hm(e,t={},r){let n=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return e.replace(n,(i,s,a,o,l)=>{let c=s.trim(),u=t[c];if(!u||!Array.isArray(u))return`<!-- infiniteList: items "${c}" not found or not an array -->`;let d={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(a)try{let f=Function(`return ${a.trim()}`)();d={...d,...f}}catch{}let h=`ilist-${Math.random().toString(36).substring(2,9)}`,p=el(`@virtualList(${c}, ${JSON.stringify({itemHeight:d.itemHeight,containerHeight:d.containerHeight,overscan:d.overscan,containerClass:d.containerClass})})${o}@endvirtualList`,t);return p=p.replace("</script>",`
14455
14455
  // Infinite scroll detection
14456
14456
  container.addEventListener('scroll', function() {
14457
14457
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -14469,7 +14469,7 @@ else {
14469
14469
  ${l}
14470
14470
  </div>
14471
14471
  </div>
14472
- `})}function Hm(e,t={},r){let n=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return e.replace(n,(i,s,a,o)=>{let l=s.trim(),c=t[l];if(!c||!Array.isArray(c))return`<!-- virtualGrid: items "${l}" not found or not an array -->`;let u={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(a)try{let w=Function(`return ${a.trim()}`)();u={...u,...w}}catch{}let d=`vgrid-${Math.random().toString(36).substring(2,9)}`,h=Math.ceil(c.length/u.columns),p=h*(u.rowHeight+(u.gap||0)),f=Math.ceil(u.containerHeight/(u.rowHeight+(u.gap||0))),m=u.overscan||2,y=0,g=Math.min(h-1,f+m),v="";for(let w=y;w<=g;w++)for(let b=0;b<u.columns;b++){let S=w*u.columns+b;if(S>=c.length)break;let x=c[S],_=b*(100/u.columns),E=w*(u.rowHeight+(u.gap||0)),k=o.replace(/\{\{\s*item\s*\}\}/g,typeof x==="object"?JSON.stringify(x):String(x)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,T)=>{if(typeof x==="object"&&x!==null)return String(x[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(S));v+=`
14472
+ `})}function Um(e,t={},r){let n=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return e.replace(n,(i,s,a,o)=>{let l=s.trim(),c=t[l];if(!c||!Array.isArray(c))return`<!-- virtualGrid: items "${l}" not found or not an array -->`;let u={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(a)try{let w=Function(`return ${a.trim()}`)();u={...u,...w}}catch{}let d=`vgrid-${Math.random().toString(36).substring(2,9)}`,h=Math.ceil(c.length/u.columns),p=h*(u.rowHeight+(u.gap||0)),f=Math.ceil(u.containerHeight/(u.rowHeight+(u.gap||0))),m=u.overscan||2,y=0,g=Math.min(h-1,f+m),v="";for(let w=y;w<=g;w++)for(let b=0;b<u.columns;b++){let S=w*u.columns+b;if(S>=c.length)break;let x=c[S],_=b*(100/u.columns),E=w*(u.rowHeight+(u.gap||0)),k=o.replace(/\{\{\s*item\s*\}\}/g,typeof x==="object"?JSON.stringify(x):String(x)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,T)=>{if(typeof x==="object"&&x!==null)return String(x[T]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(S));v+=`
14473
14473
  <div class="virtual-grid-item"
14474
14474
  style="position: absolute; top: ${E}px; left: ${_}%; width: calc(${100/u.columns}% - ${u.gap||0}px); height: ${u.rowHeight}px;"
14475
14475
  data-index="${S}">
@@ -14539,7 +14539,7 @@ else {
14539
14539
  });
14540
14540
  })();
14541
14541
  </script>
14542
- `})}var Um,DE=R(()=>{Um={createVirtualList:Qo,processVirtualListDirectives:Xo,processInfiniteListDirectives:Wm,processVirtualGridDirectives:Hm,generateVirtualListCSS:Fm,useVirtualList:qm}});function $E(){return`<script data-stx-hydration-runtime>
14542
+ `})}var Gm,$E=R(()=>{Gm={createVirtualList:Xo,processVirtualListDirectives:el,processInfiniteListDirectives:Hm,processVirtualGridDirectives:Um,generateVirtualListCSS:qm,useVirtualList:Wm}});function LE(){return`<script data-stx-hydration-runtime>
14543
14543
  (function() {
14544
14544
  'use strict';
14545
14545
 
@@ -14699,7 +14699,7 @@ else {
14699
14699
  stxIslands.initIslands();
14700
14700
  }
14701
14701
  })();
14702
- </script>`}function LE(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let r=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(r)return r[1];return null}function NE(e,t){let r={},n=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=n.exec(e))!==null){let s=i[1],a=i[2];if(a in t)r[s]=t[a];else r[s]=a}return r}var Gm={};Y(Gm,{processStaticDirectives:()=>tg,processPartialHydrationDirectives:()=>Jm,onHydrated:()=>eg,isHydrated:()=>Xm,hydrateIsland:()=>Km,hydrateByStrategy:()=>Zm,hydrateAll:()=>Qm,generatePartialHydrationCSS:()=>Ym,generateIslandManifest:()=>rg,default:()=>ng,createIslandRegistry:()=>Vm});function Vm(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let r=e.get(t);if(!r||r.hydrated)return;if(r.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:r.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((r)=>!r.hydrated).map((r)=>this.hydrate(r.id));await Promise.all(t)}}}function PE(e){return`
14702
+ </script>`}function NE(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let r=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(r)return r[1];return null}function PE(e,t){let r={},n=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=n.exec(e))!==null){let s=i[1],a=i[2];if(a in t)r[s]=t[a];else r[s]=a}return r}var Vm={};K(Vm,{processStaticDirectives:()=>rg,processPartialHydrationDirectives:()=>Ym,onHydrated:()=>tg,isHydrated:()=>eg,hydrateIsland:()=>Zm,hydrateByStrategy:()=>Qm,hydrateAll:()=>Xm,generatePartialHydrationCSS:()=>Km,generateIslandManifest:()=>ng,default:()=>ig,createIslandRegistry:()=>Jm});function Jm(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let r=e.get(t);if(!r||r.hydrated)return;if(r.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:r.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((r)=>!r.hydrated).map((r)=>this.hydrate(r.id));await Promise.all(t)}}}function ME(e){return`
14703
14703
  <script data-hydrate="${e}">
14704
14704
  (function() {
14705
14705
  const island = document.querySelector('[data-island="${e}"]');
@@ -14710,7 +14710,7 @@ else {
14710
14710
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
14711
14711
  })();
14712
14712
  </script>
14713
- `}function ME(e,t){let r=t.timeout||2000,n=t.priority||"low";return`
14713
+ `}function BE(e,t){let r=t.timeout||2000,n=t.priority||"low";return`
14714
14714
  <script data-hydrate="${e}">
14715
14715
  (function() {
14716
14716
  const island = document.querySelector('[data-island="${e}"]');
@@ -14746,7 +14746,7 @@ else {
14746
14746
  }
14747
14747
  })();
14748
14748
  </script>
14749
- `}function BE(e,t){let r=t.rootMargin||"0px",n=t.threshold||0;return`
14749
+ `}function zE(e,t){let r=t.rootMargin||"0px",n=t.threshold||0;return`
14750
14750
  <script data-hydrate="${e}">
14751
14751
  (function() {
14752
14752
  const island = document.querySelector('[data-island="${e}"]');
@@ -14779,7 +14779,7 @@ else {
14779
14779
  }
14780
14780
  })();
14781
14781
  </script>
14782
- `}function zE(e,t){let r=t.media||"(min-width: 768px)";return`
14782
+ `}function FE(e,t){let r=t.media||"(min-width: 768px)";return`
14783
14783
  <script data-hydrate="${e}">
14784
14784
  (function() {
14785
14785
  const island = document.querySelector('[data-island="${e}"]');
@@ -14808,7 +14808,7 @@ else {
14808
14808
  }
14809
14809
  })();
14810
14810
  </script>
14811
- `}function FE(e){return`
14811
+ `}function qE(e){return`
14812
14812
  <script data-hydrate="${e}">
14813
14813
  (function() {
14814
14814
  const island = document.querySelector('[data-island="${e}"]');
@@ -14830,7 +14830,7 @@ else {
14830
14830
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
14831
14831
  })();
14832
14832
  </script>
14833
- `}function qE(e,t){let r=t.event||"stx:activate";return`
14833
+ `}function WE(e,t){let r=t.event||"stx:activate";return`
14834
14834
  <script data-hydrate="${e}">
14835
14835
  (function() {
14836
14836
  const island = document.querySelector('[data-island="${e}"]');
@@ -14851,9 +14851,9 @@ else {
14851
14851
  });
14852
14852
  })();
14853
14853
  </script>
14854
- `}function Jm(e,t={},r){let n=e,i=!1,s=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(n=cr(n,"load",t),n=cr(n,"idle",t),n=cr(n,"visible",t),n=cr(n,"media",t),n=WE(n),n=cr(n,"hover",t),n=cr(n,"event",t),i=s&&n!==e,i)n+=`
14855
- `+$E();return n}function cr(e,t,r){let n=new RegExp(`@client:${t}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return e.replace(n,(i,s,a)=>{let o={strategy:t};if(s)try{let f=s.split(",").map((m)=>m.trim());for(let m of f){let[y,g]=m.split(":").map((v)=>v.trim());if(y&&g){let v=g.replace(/^['"]|['"]$/g,"");o[y]=v}}}catch{}let l=`island-${Math.random().toString(36).substring(2,9)}`,c=LE(a.trim()),u=NE(a.trim(),r),d=[];if(o.rootMargin)d.push(`data-root-margin="${o.rootMargin}"`);if(o.threshold!==void 0)d.push(`data-threshold="${o.threshold}"`);if(o.media)d.push(`data-media="${o.media}"`);if(o.event)d.push(`data-event="${o.event}"`);if(c)d.push(`data-component="${c}"`);let h=Object.keys(u).length>0?`
14856
- <script type="application/json" data-island-props="${l}">${JSON.stringify(u)}</script>`:"",p="";switch(t){case"load":p=PE(l);break;case"idle":p=ME(l,o);break;case"visible":p=BE(l,o);break;case"media":p=zE(l,o);break;case"hover":p=FE(l);break;case"event":p=qE(l,o);break}return`
14854
+ `}function Ym(e,t={},r){let n=e,i=!1,s=/@client:(load|idle|visible|media|only|hover|event)/i.test(e);if(n=ur(n,"load",t),n=ur(n,"idle",t),n=ur(n,"visible",t),n=ur(n,"media",t),n=HE(n),n=ur(n,"hover",t),n=ur(n,"event",t),i=s&&n!==e,i)n+=`
14855
+ `+LE();return n}function ur(e,t,r){let n=new RegExp(`@client:${t}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return e.replace(n,(i,s,a)=>{let o={strategy:t};if(s)try{let f=s.split(",").map((m)=>m.trim());for(let m of f){let[y,g]=m.split(":").map((v)=>v.trim());if(y&&g){let v=g.replace(/^['"]|['"]$/g,"");o[y]=v}}}catch{}let l=`island-${Math.random().toString(36).substring(2,9)}`,c=NE(a.trim()),u=PE(a.trim(),r),d=[];if(o.rootMargin)d.push(`data-root-margin="${o.rootMargin}"`);if(o.threshold!==void 0)d.push(`data-threshold="${o.threshold}"`);if(o.media)d.push(`data-media="${o.media}"`);if(o.event)d.push(`data-event="${o.event}"`);if(c)d.push(`data-component="${c}"`);let h=Object.keys(u).length>0?`
14856
+ <script type="application/json" data-island-props="${l}">${JSON.stringify(u)}</script>`:"",p="";switch(t){case"load":p=ME(l);break;case"idle":p=BE(l,o);break;case"visible":p=zE(l,o);break;case"media":p=FE(l,o);break;case"hover":p=qE(l);break;case"event":p=WE(l,o);break}return`
14857
14857
  <div data-island="${l}"
14858
14858
  data-strategy="${t}"
14859
14859
  ${d.join(`
@@ -14863,7 +14863,7 @@ else {
14863
14863
  ${a.trim()}${h}
14864
14864
  </div>
14865
14865
  ${p}
14866
- `})}function WE(e){let t=/@client:only\s*([\s\S]*?)@endclient/gi;return e.replace(t,(r,n)=>{let i=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14866
+ `})}function HE(e){let t=/@client:only\s*([\s\S]*?)@endclient/gi;return e.replace(t,(r,n)=>{let i=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14867
14867
  <div data-island="${i}"
14868
14868
  data-strategy="only"
14869
14869
  class="stx-island stx-client-only">
@@ -14882,7 +14882,7 @@ else {
14882
14882
  }
14883
14883
  })();
14884
14884
  </script>
14885
- `})}function Ym(){return`
14885
+ `})}function Km(){return`
14886
14886
  /* Island base styles */
14887
14887
  .stx-island {
14888
14888
  display: contents;
@@ -14923,11 +14923,11 @@ else {
14923
14923
  .stx-island.hydrated {
14924
14924
  opacity: 1;
14925
14925
  }
14926
- `}function Km(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Zm(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Qm(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((e)=>{e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Xm(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function eg(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let r=document.querySelector(`[data-island="${e}"]`);if(!r){t();return}if(r.classList.contains("hydrated")){t();return}r.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function tg(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,r)=>{return`<div class="stx-static">${r.trim()}</div>`})}function rg(e){let t=e.map((r)=>({id:r.id,component:r.component,strategy:r.options.strategy,props:r.props}));return`
14926
+ `}function Zm(e){if(typeof window>"u")return;let t=document.querySelector(`[data-island="${e}"]`);if(!t||t.classList.contains("hydrated"))return;t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Qm(e){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${e}"]:not(.hydrated)`).forEach((t)=>{t.classList.add("hydrated"),t.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function Xm(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((e)=>{e.classList.add("hydrated"),e.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function eg(e){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${e}"]`)?.classList.contains("hydrated")??!1}function tg(e){return new Promise((t)=>{if(typeof window>"u"){t();return}let r=document.querySelector(`[data-island="${e}"]`);if(!r){t();return}if(r.classList.contains("hydrated")){t();return}r.addEventListener("stx:hydrated",()=>t(),{once:!0})})}function rg(e){return e.replace(/@static\s*([\s\S]*?)@endstatic/gi,(t,r)=>`<div class="stx-static">${r.trim()}</div>`)}function ng(e){let t=e.map((r)=>({id:r.id,component:r.component,strategy:r.options.strategy,props:r.props}));return`
14927
14927
  <script type="application/json" id="stx-island-manifest">
14928
14928
  ${JSON.stringify(t)}
14929
14929
  </script>
14930
- `}var ng,HE=R(()=>{ng={processPartialHydrationDirectives:Jm,processStaticDirectives:tg,generatePartialHydrationCSS:Ym,generateIslandManifest:rg,createIslandRegistry:Vm,hydrateIsland:Km,hydrateByStrategy:Zm,hydrateAll:Qm,isHydrated:Xm,onHydrated:eg}}),ig={};Y(ig,{watchMultiple:()=>ma,watchEffect:()=>ga,watch:()=>ha,unref:()=>da,toRefs:()=>pa,throttledComputed:()=>va,stxWatchMultiple:()=>ma,stxWatchEffect:()=>ga,stxWatch:()=>ha,stxUnref:()=>da,stxToRefs:()=>pa,stxThrottledComputed:()=>va,stxShallowRef:()=>fa,stxRef:()=>Yt,stxIsRef:()=>lt,stxDebouncedComputed:()=>ya,stxComputed:()=>Dr,shallowRef:()=>fa,ref:()=>Yt,processWatchDirectives:()=>ag,processComputedDirectives:()=>sg,isRef:()=>lt,default:()=>og,debouncedComputed:()=>ya,computed:()=>Dr});function Yt(e){let t=e,r=new Set,n={get value(){if(et){let i=Sr.get(n);if(!i)i=new Set,Sr.set(n,i);i.add(et)}return t},set value(i){if(!Object.is(t,i)){t=i,r.forEach((a)=>a(i));let s=Sr.get(n);if(s)s.forEach((a)=>a())}},subscribe(i){return r.add(i),()=>r.delete(i)},peek(){return t}};return n}function lt(e){return e!==null&&typeof e==="object"&&"value"in e&&"subscribe"in e&&"peek"in e}function da(e){return lt(e)?e.value:e}function pa(e){let t={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=Yt(e[r]);return t}function fa(e){return Yt(e)}function Dr(e){let t=typeof e==="function",r=t?e:e.get,n=t?void 0:e.set,i=t?Object.is:e.equals||Object.is,s,a=!0,o=new Set,l=new Set,c=()=>{if(a=!0,l.size>0){let h=d.value;l.forEach((p)=>p(h))}};function u(){o.clear();let h=et;et=c,dn.push(c);try{return r()}finally{dn.pop(),et=h}}let d={get value(){if(et){let h=Sr.get(d);if(!h)h=new Set,Sr.set(d,h);h.add(et)}if(a){let h=u();if(!i(s,h))s=h;a=!1}return s},set value(h){if(n)n(h);else console.warn("Computed property is readonly")},subscribe(h){return l.add(h),()=>l.delete(h)},peek(){if(a)s=r(),a=!1;return s},invalidate(){a=!0},get dirty(){return a},get deps(){return o}};return d}function ha(e,t,r={}){let{immediate:n=!1,deep:i=!1,flush:s="pre",once:a=!1}=r,o,l=!0,c=!1,u=()=>{if(lt(e))return i?Pt(e.value):e.value;return e()},d=()=>{if(!l||c)return;let f=u();if(o!==void 0&&Object.is(o,f)&&!i)return;let m=()=>{if(t(f,o),o=i?Pt(f):f,a)p()};if(s==="sync")m();else if(s==="post")queueMicrotask(m);else Promise.resolve().then(m)},h=null;if(lt(e))h=e.subscribe(()=>d());else h=Dr(e).subscribe(()=>d());if(n)o=void 0,d();else o=u();let p=()=>{if(l=!1,h)h(),h=null};return p.pause=()=>{c=!0},p.resume=()=>{c=!1},p}function ma(e,t,r={}){let{immediate:n=!1,once:i=!1}=r,s=e.map((d)=>lt(d)?d.value:void 0),a=!0,o=!1,l=()=>{if(!a||o)return;let d=e.map((h)=>lt(h)?h.value:void 0);if(t(d,s),s=[...d],i)u()},c=e.map((d)=>{if(lt(d))return d.subscribe(()=>l());return()=>{}});if(n)l();let u=()=>{a=!1,c.forEach((d)=>d())};return u.pause=()=>{o=!0},u.resume=()=>{o=!1},u}function ga(e,t={}){let{flush:r="pre"}=t,n,i=!0,s=!1,a=()=>{if(!i||s)return;if(n)n();let l=et;et=a,dn.push(a);try{n=e()}finally{dn.pop(),et=l}};if(r==="sync")a();else if(r==="post")queueMicrotask(a);else Promise.resolve().then(a);let o=()=>{if(i=!1,n)n()};return o.pause=()=>{s=!0},o.resume=()=>{s=!1},o}function sg(e,t={},r){let n=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return e.replace(n,(i,s,a)=>{try{let o=Function(...Object.keys(t),`return ${a}`)(...Object.values(t));return t[s]=o,`<!-- computed: ${s} = ${o} -->`}catch(o){return`<!-- computed error: ${s} - ${o} -->`}})}function ag(e,t={},r){let n=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return e.replace(n,(i,s,a)=>{return`
14930
+ `}var ig,UE=R(()=>{ig={processPartialHydrationDirectives:Ym,processStaticDirectives:rg,generatePartialHydrationCSS:Km,generateIslandManifest:ng,createIslandRegistry:Jm,hydrateIsland:Zm,hydrateByStrategy:Qm,hydrateAll:Xm,isHydrated:eg,onHydrated:tg}}),sg={};K(sg,{watchMultiple:()=>ga,watchEffect:()=>ya,watch:()=>ma,unref:()=>pa,toRefs:()=>fa,throttledComputed:()=>wa,stxWatchMultiple:()=>ga,stxWatchEffect:()=>ya,stxWatch:()=>ma,stxUnref:()=>pa,stxToRefs:()=>fa,stxThrottledComputed:()=>wa,stxShallowRef:()=>ha,stxRef:()=>Kt,stxIsRef:()=>ct,stxDebouncedComputed:()=>va,stxComputed:()=>$r,shallowRef:()=>ha,ref:()=>Kt,processWatchDirectives:()=>og,processComputedDirectives:()=>ag,isRef:()=>ct,default:()=>lg,debouncedComputed:()=>va,computed:()=>$r});function Kt(e){let t=e,r=new Set,n={get value(){if(tt){let i=_r.get(n);if(!i)i=new Set,_r.set(n,i);i.add(tt)}return t},set value(i){if(!Object.is(t,i)){t=i,r.forEach((a)=>a(i));let s=_r.get(n);if(s)s.forEach((a)=>a())}},subscribe(i){return r.add(i),()=>r.delete(i)},peek(){return t}};return n}function ct(e){return e!==null&&typeof e==="object"&&"value"in e&&"subscribe"in e&&"peek"in e}function pa(e){return ct(e)?e.value:e}function fa(e){let t={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=Kt(e[r]);return t}function ha(e){return Kt(e)}function $r(e){let t=typeof e==="function",r=t?e:e.get,n=t?void 0:e.set,i=t?Object.is:e.equals||Object.is,s,a=!0,o=new Set,l=new Set,c=()=>{if(a=!0,l.size>0){let h=d.value;l.forEach((p)=>p(h))}};function u(){o.clear();let h=tt;tt=c,pn.push(c);try{return r()}finally{pn.pop(),tt=h}}let d={get value(){if(tt){let h=_r.get(d);if(!h)h=new Set,_r.set(d,h);h.add(tt)}if(a){let h=u();if(!i(s,h))s=h;a=!1}return s},set value(h){if(n)n(h);else console.warn("Computed property is readonly")},subscribe(h){return l.add(h),()=>l.delete(h)},peek(){if(a)s=r(),a=!1;return s},invalidate(){a=!0},get dirty(){return a},get deps(){return o}};return d}function ma(e,t,r={}){let{immediate:n=!1,deep:i=!1,flush:s="pre",once:a=!1}=r,o,l=!0,c=!1,u=()=>{if(ct(e))return i?Mt(e.value):e.value;return e()},d=()=>{if(!l||c)return;let f=u();if(o!==void 0&&Object.is(o,f)&&!i)return;let m=()=>{if(t(f,o),o=i?Mt(f):f,a)p()};if(s==="sync")m();else if(s==="post")queueMicrotask(m);else Promise.resolve().then(m)},h=null;if(ct(e))h=e.subscribe(()=>d());else h=$r(e).subscribe(()=>d());if(n)o=void 0,d();else o=u();let p=()=>{if(l=!1,h)h(),h=null};return p.pause=()=>{c=!0},p.resume=()=>{c=!1},p}function ga(e,t,r={}){let{immediate:n=!1,once:i=!1}=r,s=e.map((d)=>ct(d)?d.value:void 0),a=!0,o=!1,l=()=>{if(!a||o)return;let d=e.map((h)=>ct(h)?h.value:void 0);if(t(d,s),s=[...d],i)u()},c=e.map((d)=>{if(ct(d))return d.subscribe(()=>l());return()=>{}});if(n)l();let u=()=>{a=!1,c.forEach((d)=>d())};return u.pause=()=>{o=!0},u.resume=()=>{o=!1},u}function ya(e,t={}){let{flush:r="pre"}=t,n,i=!0,s=!1,a=()=>{if(!i||s)return;if(n)n();let l=tt;tt=a,pn.push(a);try{n=e()}finally{pn.pop(),tt=l}};if(r==="sync")a();else if(r==="post")queueMicrotask(a);else Promise.resolve().then(a);let o=()=>{if(i=!1,n)n()};return o.pause=()=>{s=!0},o.resume=()=>{s=!1},o}function ag(e,t={},r){let n=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return e.replace(n,(i,s,a)=>{try{let o=Function(...Object.keys(t),`return ${a}`)(...Object.values(t));return t[s]=o,`<!-- computed: ${s} = ${o} -->`}catch(o){return`<!-- computed error: ${s} - ${o} -->`}})}function og(e,t={},r){let n=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return e.replace(n,(i,s,a)=>`
14931
14931
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
14932
14932
  (function() {
14933
14933
  // Watch implementation for ${s}
@@ -14939,9 +14939,9 @@ else {
14939
14939
  }
14940
14940
  })();
14941
14941
  </script>
14942
- `})}function Pt(e){if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>Pt(r));if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map){let r=new Map;return e.forEach((n,i)=>r.set(Pt(i),Pt(n))),r}if(e instanceof Set){let r=new Set;return e.forEach((n)=>r.add(Pt(n))),r}let t={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=Pt(e[r]);return t}function ya(e,t=100){let r=Yt(e()),n=null,i=()=>{if(n)clearTimeout(n);n=setTimeout(()=>{r.value=e()},t)};return Dr(e).subscribe(()=>i()),{get value(){return r.value},set value(s){console.warn("Debounced computed is readonly")},subscribe:r.subscribe,peek:r.peek,invalidate(){i()},get dirty(){return!1},get deps(){return new Set}}}function va(e,t=100){let r=Yt(e()),n=0,i=()=>{let s=Date.now();if(s-n>=t)n=s,r.value=e()};return Dr(e).subscribe(()=>i()),{get value(){return r.value},set value(s){console.warn("Throttled computed is readonly")},subscribe:r.subscribe,peek:r.peek,invalidate(){i()},get dirty(){return!1},get deps(){return new Set}}}var et=null,dn,Sr,og,UE=R(()=>{dn=[],Sr=new WeakMap,og={ref:Yt,computed:Dr,watch:ha,watchMultiple:ma,watchEffect:ga,isRef:lt,unref:da,toRefs:pa,shallowRef:fa,debouncedComputed:ya,throttledComputed:va,processComputedDirectives:sg,processWatchDirectives:ag}});function Wr(e,t){let r={};for(let n of e)r[n]=Ir(t(n));return new Proxy({},{get:(n,i)=>r[i]?.(),set:(n,i,s)=>{if(r[i])r[i].set(s);else r[i]=Ir(s);return!0},has:(n,i)=>(i in r),deleteProperty:(n,i)=>{return delete r[i],!0},ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,i)=>(i in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[i]()}:void 0})}function GE(e,t){let r={};for(let n of t)r[n]=e[n];return r}function lg(e,t){let r=Object.keys(e),n=Wr(r,(g)=>t?.[g]??e[g].getDefaultValue()),i=Wr(r,()=>[]),s=Wr(r,()=>!1),a=Wr(r,()=>!1),o=Wr(r,()=>!1),l=Ir(!1);async function c(g){o[g]=!0;let v=await e[g].validate(n[g],n);return i[g]=v,o[g]=!1,v.length===0}async function u(){l.set(!0);let g=await Promise.all(r.map(c));return l.set(!1),g.every(Boolean)}function d(){for(let g of r)n[g]=t?.[g]??e[g].getDefaultValue(),i[g]=[],s[g]=!1,a[g]=!1}function h(g){for(let v of r)if(v in g)n[v]=g[v],a[v]=!0}function p(g,v){n[g]=v,a[g]=!0}function f(g,v=!0){if(s[g]=v,v)c(g)}function m(g){return{value:n[g],errors:i[g],touched:s[g],dirty:a[g],valid:i[g].length===0,validating:o[g]}}function y(g){return async(v)=>{v?.preventDefault?.();for(let w of r)s[w]=!0;if(await u())await g(GE(n,r))}}return{values:n,errors:i,touched:s,dirty:a,get isValid(){return r.every((g)=>i[g].length===0)},get isValidating(){return l()||r.some((g)=>o[g])},get isDirty(){return r.some((g)=>a[g])},validate:u,validateField:c,reset:d,setValues:h,setFieldValue:p,setFieldTouched:f,getFieldState:m,handleSubmit:y}}var cg,VE=R(()=>{Ms(),cg=lg}),ug={};Y(ug,{v:()=>hg,useForm:()=>lg,processHasErrorsDirective:()=>fg,processFormValidationDirectives:()=>JE,processErrorsDirective:()=>pg,processErrorDirective:()=>dg,defineForm:()=>cg,Validator:()=>_r});class _r{rules=[];defaultValue="";addRule(e){let t=new _r;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(i)=>{if(!i)return!0;let s=String(i).length;return s>=e&&s<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(i)=>{if(!i&&i!==0)return!0;let s=Number(i);return s>=e&&s<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,i)=>{if(!i)return!0;return n===i[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(i)=>{if(!i)return!0;return new Date(String(i))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(i)=>{if(!i)return!0;return new Date(String(i))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new _r;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(i,s)=>{if(!e(i,s||{}))return!0;return n.validate(i,s)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new _r;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let i=await n.validate(e,t);if(i!==!0)r.push(i)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let i=n.validate(e,t);if(i!==!0)r.push(i)}return r}}function dg(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(i,s,a)=>{try{let o=s.trim().split("."),l=t;for(let u of o)if(l&&typeof l==="object"&&u in l)l=l[u];else return"";let c=l;if(!c||!Array.isArray(c)||c.length===0)return"";return c.map((u)=>{return a.replace(/\{\{\s*message\s*\}\}/g,u)}).join(`
14943
- `)}catch{return""}})}function pg(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(i,s,a)=>{try{let o=s.trim().split("."),l=t;for(let u of o)if(l&&typeof l==="object"&&u in l)l=l[u];else return"";let c=l;if(!c||!Array.isArray(c)||c.length===0)return"";return c.map((u)=>a.replace(/\{\{\s*message\s*\}\}/g,u)).join(`
14944
- `)}catch{return""}})}function fg(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(i,s,a)=>{try{let o=s.trim().split("."),l=t;for(let u of o)if(l&&typeof l==="object"&&u in l)l=l[u];else return"";let c=l;if(!c||!Array.isArray(c)||c.length===0)return"";return a}catch{return""}})}function JE(e,t,r){let n=e;return n=dg(n,t,r),n=pg(n,t,r),n=fg(n,t,r),n}var hg,YE=R(()=>{VE(),hg=new _r}),mg={};Y(mg,{processXElementDirectives:()=>KE,hasXElementDirectives:()=>yg,generateXElementRuntime:()=>gg});function gg(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14942
+ `)}function Mt(e){if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>Mt(r));if(e instanceof Date)return new Date(e.getTime());if(e instanceof Map){let r=new Map;return e.forEach((n,i)=>r.set(Mt(i),Mt(n))),r}if(e instanceof Set){let r=new Set;return e.forEach((n)=>r.add(Mt(n))),r}let t={};for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t[r]=Mt(e[r]);return t}function va(e,t=100){let r=Kt(e()),n=null,i=()=>{if(n)clearTimeout(n);n=setTimeout(()=>{r.value=e()},t)};return $r(e).subscribe(()=>i()),{get value(){return r.value},set value(s){console.warn("Debounced computed is readonly")},subscribe:r.subscribe,peek:r.peek,invalidate(){i()},get dirty(){return!1},get deps(){return new Set}}}function wa(e,t=100){let r=Kt(e()),n=0,i=()=>{let s=Date.now();if(s-n>=t)n=s,r.value=e()};return $r(e).subscribe(()=>i()),{get value(){return r.value},set value(s){console.warn("Throttled computed is readonly")},subscribe:r.subscribe,peek:r.peek,invalidate(){i()},get dirty(){return!1},get deps(){return new Set}}}var tt=null,pn,_r,lg,GE=R(()=>{pn=[],_r=new WeakMap,lg={ref:Kt,computed:$r,watch:ma,watchMultiple:ga,watchEffect:ya,isRef:ct,unref:pa,toRefs:fa,shallowRef:ha,debouncedComputed:va,throttledComputed:wa,processComputedDirectives:ag,processWatchDirectives:og}});function Hr(e,t){let r={};for(let n of e)r[n]=Or(t(n));return new Proxy({},{get:(n,i)=>r[i]?.(),set:(n,i,s)=>{if(r[i])r[i].set(s);else r[i]=Or(s);return!0},has:(n,i)=>(i in r),deleteProperty:(n,i)=>(delete r[i],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,i)=>(i in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[i]()}:void 0})}function VE(e,t){let r={};for(let n of t)r[n]=e[n];return r}function cg(e,t){let r=Object.keys(e),n=Hr(r,(g)=>t?.[g]??e[g].getDefaultValue()),i=Hr(r,()=>[]),s=Hr(r,()=>!1),a=Hr(r,()=>!1),o=Hr(r,()=>!1),l=Or(!1);async function c(g){o[g]=!0;let v=await e[g].validate(n[g],n);return i[g]=v,o[g]=!1,v.length===0}async function u(){l.set(!0);let g=await Promise.all(r.map(c));return l.set(!1),g.every(Boolean)}function d(){for(let g of r)n[g]=t?.[g]??e[g].getDefaultValue(),i[g]=[],s[g]=!1,a[g]=!1}function h(g){for(let v of r)if(v in g)n[v]=g[v],a[v]=!0}function p(g,v){n[g]=v,a[g]=!0}function f(g,v=!0){if(s[g]=v,v)c(g)}function m(g){return{value:n[g],errors:i[g],touched:s[g],dirty:a[g],valid:i[g].length===0,validating:o[g]}}function y(g){return async(v)=>{v?.preventDefault?.();for(let w of r)s[w]=!0;if(await u())await g(VE(n,r))}}return{values:n,errors:i,touched:s,dirty:a,get isValid(){return r.every((g)=>i[g].length===0)},get isValidating(){return l()||r.some((g)=>o[g])},get isDirty(){return r.some((g)=>a[g])},validate:u,validateField:c,reset:d,setValues:h,setFieldValue:p,setFieldTouched:f,getFieldState:m,handleSubmit:y}}var ug,JE=R(()=>{Bs(),ug=cg}),dg={};K(dg,{v:()=>mg,useForm:()=>cg,processHasErrorsDirective:()=>hg,processFormValidationDirectives:()=>YE,processErrorsDirective:()=>fg,processErrorDirective:()=>pg,defineForm:()=>ug,Validator:()=>kr});class kr{rules=[];defaultValue="";addRule(e){let t=new kr;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(i)=>{if(!i)return!0;let s=String(i).length;return s>=e&&s<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(i)=>{if(!i&&i!==0)return!0;let s=Number(i);return s>=e&&s<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,i)=>{if(!i)return!0;return n===i[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(i)=>{if(!i)return!0;return new Date(String(i))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(i)=>{if(!i)return!0;return new Date(String(i))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new kr;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(i,s)=>{if(!e(i,s||{}))return!0;return n.validate(i,s)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new kr;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let i=await n.validate(e,t);if(i!==!0)r.push(i)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let i=n.validate(e,t);if(i!==!0)r.push(i)}return r}}function pg(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(i,s,a)=>{try{let o=s.trim().split("."),l=t;for(let u of o)if(l&&typeof l==="object"&&u in l)l=l[u];else return"";let c=l;if(!c||!Array.isArray(c)||c.length===0)return"";return c.map((u)=>a.replace(/\{\{\s*message\s*\}\}/g,u)).join(`
14943
+ `)}catch{return""}})}function fg(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(i,s,a)=>{try{let o=s.trim().split("."),l=t;for(let u of o)if(l&&typeof l==="object"&&u in l)l=l[u];else return"";let c=l;if(!c||!Array.isArray(c)||c.length===0)return"";return c.map((u)=>a.replace(/\{\{\s*message\s*\}\}/g,u)).join(`
14944
+ `)}catch{return""}})}function hg(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(i,s,a)=>{try{let o=s.trim().split("."),l=t;for(let u of o)if(l&&typeof l==="object"&&u in l)l=l[u];else return"";let c=l;if(!c||!Array.isArray(c)||c.length===0)return"";return a}catch{return""}})}function YE(e,t,r){let n=e;return n=pg(n,t,r),n=fg(n,t,r),n=hg(n,t,r),n}var mg,KE=R(()=>{JE(),mg=new kr}),gg={};K(gg,{processXElementDirectives:()=>ZE,hasXElementDirectives:()=>vg,generateXElementRuntime:()=>yg});function yg(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14945
14945
  (function() {
14946
14946
  'use strict';
14947
14947
 
@@ -15225,16 +15225,16 @@ else {
15225
15225
  // Expose for manual initialization
15226
15226
  window.XElement = XElement;
15227
15227
  })();
15228
- </script>`}function yg(e){return/\bx-data(?:\s|=)/.test(e)}function KE(e){let t=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,r=e.match(t)||[],n=r.length>0?e.replace(t,""):e;if(!yg(n))return n;let i=r[0]?.trim()||gg(),s=n.lastIndexOf("</body>");if(s!==-1)return n.slice(0,s)+i+`
15228
+ </script>`}function vg(e){return/\bx-data(?:\s|=)/.test(e)}function ZE(e){let t=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,r=e.match(t)||[],n=r.length>0?e.replace(t,""):e;if(!vg(n))return n;let i=r[0]?.trim()||yg(),s=n.lastIndexOf("</body>");if(s!==-1)return n.slice(0,s)+i+`
15229
15229
  `+n.slice(s);return n+`
15230
- `+i}var vg={};Y(vg,{rewriteImagesWithSiblings:()=>ZE});async function ZE(e,t){let r=t.formats??bg;if(!t.publicDir)return e;let n=eA(e),i=[],s=/<img\b[^>]*?>/gi,a=[],o;while((o=s.exec(e))!==null){let d=o[0],h=d.match(/\bsrc=["']([^"']+)["']/i);if(!h)continue;if(tA(o.index,n))continue;a.push({idx:o.index,length:d.length,src:h[1],raw:d})}if(a.length===0)return e;let l=await Promise.all(a.map(async(d)=>{let h=await QE(d.src,t.publicDir,r);return{match:d,sources:h}}));for(let{match:d,sources:h}of l){if(h.length===0)continue;let p=`<picture>${h.map((f)=>`<source type="${f.mime}" srcset="${rA(f.url)}">`).join("")}${d.raw}</picture>`;i.push({start:d.idx,end:d.idx+d.length,replacement:p})}if(i.length===0)return e;let c="",u=0;for(let d of i)c+=e.slice(u,d.start),c+=d.replacement,u=d.end;return c+=e.slice(u),c}async function QE(e,t,r){if(!XE(e))return[];let n=st.extname(e).toLowerCase();if(!wg.has(n))return[];if(!e.startsWith("/"))return[];let i=st.join(t,e.slice(1)),s=st.dirname(i),a=st.basename(i,n),o=st.resolve(s),l=st.resolve(t);if(!o.startsWith(l))return[];let c=st.posix.dirname(e),u=r.map(async(d)=>{let h=st.join(s,`${a}${d.ext}`);if(!await Bun.file(h).exists())return null;return{url:st.posix.join(c,`${a}${d.ext}`),mime:d.mime}});return(await Promise.all(u)).filter((d)=>d!==null)}function XE(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function eA(e){let t=[],r=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,n;while((n=r.exec(e))!==null)t.push([n.index,n.index+n[0].length]);return t}function tA(e,t){for(let[r,n]of t)if(e>=r&&e<n)return!0;return!1}function rA(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var wg,bg,nA=R(()=>{wg=new Set([".jpg",".jpeg",".png",".gif"]),bg=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]}),iA=()=>{};function xg(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}var sA=R(()=>{iA()}),Sg={};Y(Sg,{injectPwaTags:()=>aA,generateThemeColorMeta:()=>cA,generateSwRegistrationScript:()=>oA,generatePwaTags:()=>Yn,generateManifestLink:()=>lA});function Yn(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.manifest,n=t.icons?.outputDir?`/${t.icons.outputDir}`:"/pwa-icons",i=xg(e),s=`
15230
+ `+i}var wg={};K(wg,{rewriteImagesWithSiblings:()=>QE});async function QE(e,t){let r=t.formats??xg;if(!t.publicDir)return e;let n=tA(e),i=[],s=/<img\b[^>]*?>/gi,a=[],o;while((o=s.exec(e))!==null){let d=o[0],h=d.match(/\bsrc=["']([^"']+)["']/i);if(!h)continue;if(rA(o.index,n))continue;a.push({idx:o.index,length:d.length,src:h[1],raw:d})}if(a.length===0)return e;let l=await Promise.all(a.map(async(d)=>{let h=await XE(d.src,t.publicDir,r);return{match:d,sources:h}}));for(let{match:d,sources:h}of l){if(h.length===0)continue;let p=`<picture>${h.map((f)=>`<source type="${f.mime}" srcset="${nA(f.url)}">`).join("")}${d.raw}</picture>`;i.push({start:d.idx,end:d.idx+d.length,replacement:p})}if(i.length===0)return e;let c="",u=0;for(let d of i)c+=e.slice(u,d.start),c+=d.replacement,u=d.end;return c+=e.slice(u),c}async function XE(e,t,r){if(!eA(e))return[];let n=at.extname(e).toLowerCase();if(!bg.has(n))return[];if(!e.startsWith("/"))return[];let i=at.join(t,e.slice(1)),s=at.dirname(i),a=at.basename(i,n),o=at.resolve(s),l=at.resolve(t);if(!o.startsWith(l))return[];let c=at.posix.dirname(e),u=r.map(async(d)=>{let h=at.join(s,`${a}${d.ext}`);if(!await Bun.file(h).exists())return null;return{url:at.posix.join(c,`${a}${d.ext}`),mime:d.mime}});return(await Promise.all(u)).filter((d)=>d!==null)}function eA(e){if(!e)return!1;if(e.startsWith("http://")||e.startsWith("https://"))return!1;if(e.startsWith("//"))return!1;if(e.startsWith("data:"))return!1;return!0}function tA(e){let t=[],r=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,n;while((n=r.exec(e))!==null)t.push([n.index,n.index+n[0].length]);return t}function rA(e,t){for(let[r,n]of t)if(e>=r&&e<n)return!0;return!1}function nA(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var bg,xg,iA=R(()=>{bg=new Set([".jpg",".jpeg",".png",".gif"]),xg=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]}),sA=()=>{};function Sg(e){return e.pwa?.serviceWorker?.fileName||"sw.js"}var aA=R(()=>{sA()}),_g={};K(_g,{injectPwaTags:()=>oA,generateThemeColorMeta:()=>uA,generateSwRegistrationScript:()=>lA,generatePwaTags:()=>Kn,generateManifestLink:()=>cA});function Kn(e){let t=e.pwa;if(!t?.enabled)return"";let r=t.manifest,n=t.icons?.outputDir?`/${t.icons.outputDir}`:"/pwa-icons",i=Sg(e),s=`
15231
15231
  <!-- stx PWA Meta Tags -->
15232
15232
  <link rel="manifest" href="/manifest.json">
15233
- <meta name="theme-color" content="${wa(r?.themeColor||"#000000")}">
15233
+ <meta name="theme-color" content="${ba(r?.themeColor||"#000000")}">
15234
15234
  <meta name="mobile-web-app-capable" content="yes">
15235
15235
  <meta name="apple-mobile-web-app-capable" content="yes">
15236
15236
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
15237
- <meta name="apple-mobile-web-app-title" content="${wa(r?.shortName||r?.name||"App")}">`;if(t.icons?.generateAppleIcons!==!1)s+=`
15237
+ <meta name="apple-mobile-web-app-title" content="${ba(r?.shortName||r?.name||"App")}">`;if(t.icons?.generateAppleIcons!==!1)s+=`
15238
15238
  <link rel="apple-touch-icon" href="${n}/apple-touch-icon.png">
15239
15239
  <link rel="apple-touch-icon" sizes="120x120" href="${n}/apple-touch-icon-120x120.png">
15240
15240
  <link rel="apple-touch-icon" sizes="152x152" href="${n}/apple-touch-icon-152x152.png">
@@ -15271,12 +15271,12 @@ if ('serviceWorker' in navigator) {
15271
15271
  });
15272
15272
  }
15273
15273
  </script>
15274
- <!-- End stx PWA -->`,s}function aA(e,t){let r=t.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let i=e.lastIndexOf("</body>");if(i!==-1){let s=Yn(t);return e.slice(0,i)+s+`
15275
- `+e.slice(i)}return e+Yn(t)}let n=Yn(t);return e.replace("</head>",`${n}
15276
- </head>`)}function oA(e){if(!e.pwa?.enabled)return"";return`<script>
15274
+ <!-- End stx PWA -->`,s}function oA(e,t){let r=t.pwa;if(!r?.enabled||r.autoInject===!1)return e;if(e.includes("<!-- stx PWA Meta Tags -->"))return e;if(!e.includes("</head>")){let i=e.lastIndexOf("</body>");if(i!==-1){let s=Kn(t);return e.slice(0,i)+s+`
15275
+ `+e.slice(i)}return e+Kn(t)}let n=Kn(t);return e.replace("</head>",`${n}
15276
+ </head>`)}function lA(e){if(!e.pwa?.enabled)return"";return`<script>
15277
15277
  if ('serviceWorker' in navigator) {
15278
15278
  window.addEventListener('load', function() {
15279
- navigator.serviceWorker.register('/${xg(e)}')
15279
+ navigator.serviceWorker.register('/${Sg(e)}')
15280
15280
  .then(function(registration) {
15281
15281
  console.log('[PWA] Service Worker registered:', registration.scope);
15282
15282
  })
@@ -15285,90 +15285,90 @@ if ('serviceWorker' in navigator) {
15285
15285
  });
15286
15286
  });
15287
15287
  }
15288
- </script>`}function lA(){return'<link rel="manifest" href="/manifest.json">'}function cA(e){return`<meta name="theme-color" content="${wa(e)}">`}function wa(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var uA=R(()=>{sA()});function Dc(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pA(e,t){let r=e.length,n=t,i=!0,s=[],a=(o)=>o+9<=r&&e[o]==="<"&&e[o+1]==="/"&&(e[o+2]==="s"||e[o+2]==="S")&&(e[o+3]==="c"||e[o+3]==="C")&&(e[o+4]==="r"||e[o+4]==="R")&&(e[o+5]==="i"||e[o+5]==="I")&&(e[o+6]==="p"||e[o+6]==="P")&&(e[o+7]==="t"||e[o+7]==="T")&&(e[o+8]===">"||/\s/.test(e[o+8]));while(n<r){let o=e[n];if(a(n))return n;if(o==="/"&&e[n+1]==="/"){if(n=e.indexOf(`
15288
+ </script>`}function cA(){return'<link rel="manifest" href="/manifest.json">'}function uA(e){return`<meta name="theme-color" content="${ba(e)}">`}function ba(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var dA=R(()=>{aA()});function $c(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fA(e,t){let r=e.length,n=t,i=!0,s=[],a=(o)=>o+9<=r&&e[o]==="<"&&e[o+1]==="/"&&(e[o+2]==="s"||e[o+2]==="S")&&(e[o+3]==="c"||e[o+3]==="C")&&(e[o+4]==="r"||e[o+4]==="R")&&(e[o+5]==="i"||e[o+5]==="I")&&(e[o+6]==="p"||e[o+6]==="P")&&(e[o+7]==="t"||e[o+7]==="T")&&(e[o+8]===">"||/\s/.test(e[o+8]));while(n<r){let o=e[n];if(a(n))return n;if(o==="/"&&e[n+1]==="/"){if(n=e.indexOf(`
15289
15289
  `,n+2),n===-1)return-1;n+=1,i=!0;continue}if(o==="/"&&e[n+1]==="*"){let l=e.indexOf("*/",n+2);if(l===-1)return-1;n=l+2,i=!0;continue}if(o==="/"&&i){let l=n+1,c=!1;while(l<r){let u=e[l];if(u==="\\"){l+=2;continue}if(u==="[")c=!0;else if(u==="]")c=!1;else if(u==="/"&&!c){l++;break}else if(u===`
15290
15290
  `){l=-1;break}l++}if(l===-1){n++,i=!1;continue}while(l<r&&/[a-z]/.test(e[l]))l++;n=l,i=!1;continue}if(o==="'"||o==='"'){let l=o;n++;while(n<r){if(e[n]==="\\"){n+=2;continue}if(e[n]===l){n++;break}if(e[n]===`
15291
- `)break;n++}i=!1;continue}if(o==="`"){n++;while(n<r){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;break}if(e[n]==="$"&&e[n+1]==="{"){s.push(!0),n+=2,i=!0;break}n++}if(s.length===0)i=!1;continue}if(o==="}"&&s.length>0){s.pop(),n++;while(n<r){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++,i=!1;break}if(e[n]==="$"&&e[n+1]==="{"){s.push(!0),n+=2,i=!0;break}n++}continue}if(/\s/.test(o));else if(/[)\].\w$]/.test(o))i=!1;else i=!0;n++}return-1}function hr(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`<script\\b(?=[^>]*\\b${r}(?:\\s|=|/?>))[^>]*>`,"i").exec(e);if(!n)return null;let i=n.index+n[0].length,s=e.indexOf("</script>",i);if(s===-1)return null;let a=e.indexOf(">",s);if(a===-1)return null;return{start:n.index,end:a+1}}function $c(e){let t=0;while(t<e.length){let r=e.indexOf("<",t);if(r===-1)return-1;if(e.startsWith("<!--",r)){let s=e.indexOf("-->",r+4);t=s===-1?e.length:s+3;continue}let n=e.slice(r),i=/^<style\b[^>]*>/i.exec(n);if(i){let s=e.toLowerCase().indexOf("</style>",r+i[0].length);t=s===-1?e.length:s+8;continue}if(/^<script\b[^>]*>/i.test(n))return r;t=r+1}return-1}function fA(e){let t=hr(e,"data-stx-runtime");if(!t)return e;let r=$c(e);if(r===-1||r===t.start)return e;let n=e.slice(t.start,t.end),i=e.slice(0,t.start)+e.slice(t.end),s=$c(i);if(s===-1)return n+`
15291
+ `)break;n++}i=!1;continue}if(o==="`"){n++;while(n<r){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;break}if(e[n]==="$"&&e[n+1]==="{"){s.push(!0),n+=2,i=!0;break}n++}if(s.length===0)i=!1;continue}if(o==="}"&&s.length>0){s.pop(),n++;while(n<r){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++,i=!1;break}if(e[n]==="$"&&e[n+1]==="{"){s.push(!0),n+=2,i=!0;break}n++}continue}if(/\s/.test(o));else if(/[)\].\w$]/.test(o))i=!1;else i=!0;n++}return-1}function mr(e,t){let r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp(`<script\\b(?=[^>]*\\b${r}(?:\\s|=|/?>))[^>]*>`,"i").exec(e);if(!n)return null;let i=n.index+n[0].length,s=e.indexOf("</script>",i);if(s===-1)return null;let a=e.indexOf(">",s);if(a===-1)return null;return{start:n.index,end:a+1}}function Lc(e){let t=0;while(t<e.length){let r=e.indexOf("<",t);if(r===-1)return-1;if(e.startsWith("<!--",r)){let s=e.indexOf("-->",r+4);t=s===-1?e.length:s+3;continue}let n=e.slice(r),i=/^<style\b[^>]*>/i.exec(n);if(i){let s=e.toLowerCase().indexOf("</style>",r+i[0].length);t=s===-1?e.length:s+8;continue}if(/^<script\b[^>]*>/i.test(n))return r;t=r+1}return-1}function hA(e){let t=mr(e,"data-stx-runtime");if(!t)return e;let r=Lc(e);if(r===-1||r===t.start)return e;let n=e.slice(t.start,t.end),i=e.slice(0,t.start)+e.slice(t.end),s=Lc(i);if(s===-1)return n+`
15292
15292
  `+i;return i.slice(0,s)+n+`
15293
- `+i.slice(s)}async function me(e,t,r,n,i){if(n.ssr===!1&&!n.autoShell&&n.buildMode==="spa")return e;if(t.__stx_signals_gate===void 0)t.__stx_signals_gate=Nr(e);let s=!t.__stxProcessingDepth;if(s)rv(t);if(!t.__stxProcessingDepth)t.__stxProcessingDepth=0;if(t.__stxProcessingDepth++,!t.__onceStore)t.__onceStore=new Set;if((n.debug||!jo()&&!Tf())&&r&&r.endsWith(".stx"))ch(e,r);try{return await gd.timeAsync("template-processing",async()=>{let a=await hA(e,t,r,n,i);if(s)a=pm(a);if(s&&n.autoShell&&n.buildMode!=="compile"){let o=n.app?.head||{},l=(t.__stx_runtime_head||null)??kd(),c=(t.__stx_head_raw||"").trim(),u,d=c.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)u=d[1].trim(),c=c.replace(d[0],"").trim();let h=t.__sections?.title,p=l.title||u||h,f=!l.title&&(!!u||!!h),m={...o,...p&&{title:p},meta:[...o.meta||[],...l.meta||[]],link:[...o.link||[],...l.link||[]],script:[...o.script||[],...l.script||[]],headRaw:[o.headRaw,c].filter(Boolean).join(`
15294
- `),...l.htmlAttrs&&{htmlAttrs:n1(o.htmlAttrs,l.htmlAttrs)},...l.bodyAttrs&&{bodyAttrs:{...o.bodyAttrs||{},...l.bodyAttrs}}},y=um(a);if(a=c1(a,m,{...f&&{titleIsHtml:!0},...n.app?.colorMode&&{colorMode:n.app.colorMode}}),y)a=l1(a,o),a=i1(a,m.htmlAttrs);let g=a.match(/<!-- stx-layout: ([^ ]+) -->/);if(g&&a.includes("<head")){let b=g[1],S=Ea(b);a=a.replace(/<head\b[^>]*>/i,(x)=>`${x}
15295
- <meta name="stx-layout" content="${Dc(b)}">
15296
- <meta name="stx-layout-group" content="${Dc(S)}">`)}let v=a.match(/function (__stx_setup_\d+_\d+)\(/),w=v?ro(a):null;if(v&&w&&!/\bdata-stx=/.test(w.tag)){a=Gd(a,(S,x)=>`<body${x} data-stx="${v[1]}">`);let b=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${v[1]}"`,"i");a=a.replace(b,"$1")}}if(s){a=s1(a);let o=n.app?.colorMode;if(o)a=Yk(a,o);a=e1(a),a=fA(a)}if(s)try{let{getStoreScript:o}=await X("stx/store-loader",()=>Promise.resolve().then(()=>(_1(),vm))),l=n.storesDir,c=await o(l);if(c){let u=`<script data-stx-stores>${c}</script>`,d=hr(a,"data-stx-runtime");if(d)a=a.slice(0,d.end)+`
15297
- `+u+a.slice(d.end)}}catch{}if(s)try{let{getFrameworkComposableScript:o}=await X("stx/framework-composables",()=>Promise.resolve().then(()=>(I1(),wm))),l=await o(a);if(l){let c=hr(a,"data-stx-stores")||hr(a,"data-stx-runtime");if(c)a=a.slice(0,c.end)+`
15298
- `+l+a.slice(c.end)}}catch{}if(s)try{let{getComposableScript:o}=await X("stx/composable-loader",()=>Promise.resolve().then(()=>(L1(),_m))),l=n.composablesDir,c=await o(l);if(c){let u=`<script data-stx-composables>${c}</script>`,d=hr(a,"data-stx-stores")||hr(a,"data-stx-runtime");if(d)a=a.slice(0,d.end)+`
15299
- `+u+a.slice(d.end)}}catch{}if(s)a=Zk(a);if(s&&t.__stx_inject_css!==!1)a=await Mo(a,void 0,n.buildMode==="serve");if(s)a=Tv(a);return a=a.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),a})}catch(a){if(a instanceof If)throw a;let o=a instanceof Error?a.message:String(a),l=new Xr(`Template processing failed: ${o}`,r,void 0,void 0,e.substring(0,200)+(e.length>200?"...":""));if(ot.log(l,{filePath:r,context:t}),Df.logDetailedError(l,{filePath:r,template:e.substring(0,500)}),n.debug)throw l;return jf.createFallbackContent("Template Processing",l)}}async function hA(e,t,r,n,i){let s=process.cwd(),a={...n,partialsDir:n.partialsDir&&!Ee.isAbsolute(n.partialsDir)?Ee.resolve(s,n.partialsDir):n.partialsDir,componentsDir:n.componentsDir&&!Ee.isAbsolute(n.componentsDir)?Ee.resolve(s,n.componentsDir):n.componentsDir,layoutsDir:n.layoutsDir&&!Ee.isAbsolute(n.layoutsDir)?Ee.resolve(s,n.layoutsDir):n.layoutsDir},o=a,l=e;await yA(r,t),gA(t,o),l=await Bn(()=>vk(l,t,r,o),l,(w)=>{ot.log(w,{filePath:r,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${r}: ${w.message}`)}),l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");let c=Ar(l,Ga,(w,b)=>`\x00STX_HTML_COMMENT_${b}\x00`);l=c.output;let u=c.tokens,d=(w)=>u.length===0?w:w.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(b,S)=>u[Number(S)]??""),h="\x00STX_ESCAPED_AT\x00";l=l.replace(/@@/g,h),l=l.replace(/@\{\{([\s\S]*?)\}\}/g,(w,b)=>{return`{{ ${b} }}`}),l=qk(l),l=await d1(l,r,i);let p={};l=_c(l,p);let f={...t.__sections||{}},m="",y=Ux(Jf(e)),g=/@nolayout\b/.test(l)||y===!1;if(/@nolayout\b/.test(l))l=l.replace(/@nolayout\b\s*/g,"");let v=l.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(v)m=v[1],l=l.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof y==="string"){if(m=y,!/@section\s*\(/.test(l))l=`@section('content')
15293
+ `+i.slice(s)}async function ge(e,t,r,n,i){if(n.ssr===!1&&!n.autoShell&&n.buildMode==="spa")return e;if(t.__stx_signals_gate===void 0)t.__stx_signals_gate=Pr(e);let s=!t.__stxProcessingDepth;if(s)nv(t);if(!t.__stxProcessingDepth)t.__stxProcessingDepth=0;if(t.__stxProcessingDepth++,!t.__onceStore)t.__onceStore=new Set;if((n.debug||!Do()&&!Rf())&&r&&r.endsWith(".stx"))uh(e,r);try{return await yd.timeAsync("template-processing",async()=>{let a=await mA(e,t,r,n,i);if(s)a=fm(a);if(s&&n.autoShell&&n.buildMode!=="compile"){let o=n.app?.head||{},l=(t.__stx_runtime_head||null)??Ed(),c=(t.__stx_head_raw||"").trim(),u,d=c.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)u=d[1].trim(),c=c.replace(d[0],"").trim();let h=t.__sections?.title,p=l.title||u||h,f=!l.title&&(!!u||!!h),m={...o,...p&&{title:p},meta:[...o.meta||[],...l.meta||[]],link:[...o.link||[],...l.link||[]],script:[...o.script||[],...l.script||[]],headRaw:[o.headRaw,c].filter(Boolean).join(`
15294
+ `),...l.htmlAttrs&&{htmlAttrs:i1(o.htmlAttrs,l.htmlAttrs)},...l.bodyAttrs&&{bodyAttrs:{...o.bodyAttrs||{},...l.bodyAttrs}}},y=dm(a);if(a=u1(a,m,{...f&&{titleIsHtml:!0},...n.app?.colorMode&&{colorMode:n.app.colorMode}}),y)a=c1(a,o),a=s1(a,m.htmlAttrs);let g=a.match(/<!-- stx-layout: ([^ ]+) -->/);if(g&&a.includes("<head")){let b=g[1],S=Aa(b);a=a.replace(/<head\b[^>]*>/i,(x)=>`${x}
15295
+ <meta name="stx-layout" content="${$c(b)}">
15296
+ <meta name="stx-layout-group" content="${$c(S)}">`)}let v=a.match(/function (__stx_setup_\d+_\d+)\(/),w=v?no(a):null;if(v&&w&&!/\bdata-stx=/.test(w.tag)){a=Vd(a,(S,x)=>`<body${x} data-stx="${v[1]}">`);let b=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${v[1]}"`,"i");a=a.replace(b,"$1")}}if(s){a=a1(a);let o=n.app?.colorMode;if(o)a=Kk(a,o);a=t1(a),a=hA(a)}if(s)try{let{getStoreScript:o}=await ee("stx/store-loader",()=>Promise.resolve().then(()=>(k1(),wm))),l=n.storesDir,c=await o(l);if(c){let u=`<script data-stx-stores>${c}</script>`,d=mr(a,"data-stx-runtime");if(d)a=a.slice(0,d.end)+`
15297
+ `+u+a.slice(d.end)}}catch{}if(s)try{let{getFrameworkComposableScript:o}=await ee("stx/framework-composables",()=>Promise.resolve().then(()=>(O1(),bm))),l=await o(a);if(l){let c=mr(a,"data-stx-stores")||mr(a,"data-stx-runtime");if(c)a=a.slice(0,c.end)+`
15298
+ `+l+a.slice(c.end)}}catch{}if(s)try{let{getComposableScript:o}=await ee("stx/composable-loader",()=>Promise.resolve().then(()=>(N1(),km))),l=n.composablesDir,c=await o(l);if(c){let u=`<script data-stx-composables>${c}</script>`,d=mr(a,"data-stx-stores")||mr(a,"data-stx-runtime");if(d)a=a.slice(0,d.end)+`
15299
+ `+u+a.slice(d.end)}}catch{}if(s)a=Qk(a);if(s&&t.__stx_inject_css!==!1)a=await Bo(a,void 0,n.buildMode==="serve");if(s)a=Rv(a);return a=a.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),a})}catch(a){if(a instanceof Of)throw a;let o=a instanceof Error?a.message:String(a),l=new en(`Template processing failed: ${o}`,r,void 0,void 0,e.substring(0,200)+(e.length>200?"...":""));if(lt.log(l,{filePath:r,context:t}),$f.logDetailedError(l,{filePath:r,template:e.substring(0,500)}),n.debug)throw l;return Df.createFallbackContent("Template Processing",l)}}async function mA(e,t,r,n,i){let s=process.cwd(),a={...n,partialsDir:n.partialsDir&&!Ae.isAbsolute(n.partialsDir)?Ae.resolve(s,n.partialsDir):n.partialsDir,componentsDir:n.componentsDir&&!Ae.isAbsolute(n.componentsDir)?Ae.resolve(s,n.componentsDir):n.componentsDir,layoutsDir:n.layoutsDir&&!Ae.isAbsolute(n.layoutsDir)?Ae.resolve(s,n.layoutsDir):n.layoutsDir},o=a,l=e;await vA(r,t),yA(t,o),l=await zn(()=>wk(l,t,r,o),l,(w)=>{lt.log(w,{filePath:r,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${r}: ${w.message}`)}),l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");let c=Cr(l,Va,(w,b)=>`\x00STX_HTML_COMMENT_${b}\x00`);l=c.output;let u=c.tokens,d=(w)=>u.length===0?w:w.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(b,S)=>u[Number(S)]??""),h="\x00STX_ESCAPED_AT\x00";l=l.replace(/@@/g,h),l=l.replace(/@\{\{([\s\S]*?)\}\}/g,(w,b)=>`{{ ${b} }}`),l=Wk(l),l=await p1(l,r,i);let p={};l=kc(l,p);let f={...t.__sections||{}},m="",y=G0(Yf(e)),g=/@nolayout\b/.test(l)||y===!1;if(/@nolayout\b/.test(l))l=l.replace(/@nolayout\b\s*/g,"");let v=l.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(v)m=v[1],l=l.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof y==="string"){if(m=y,!/@section\s*\(/.test(l))l=`@section('content')
15300
15300
  ${l.trim()}
15301
- @endsection`}if(!m&&!g&&o.defaultLayout){let w=cm(l),b=/@section\s*\(/.test(l);if(!w||b){let S="",x=Ee.dirname(r),_=o.layoutsDir?Ee.dirname(o.layoutsDir):process.cwd();for(let E=0;E<20;E++){let k=Ee.join(x,"_layout.stx");if(await Q(k)){S=k;break}let A=Ee.dirname(x);if(A===x||A.length<_.length)break;x=A}if(S)m=S;else if(o.layoutsDir){let E=Ee.isAbsolute(o.layoutsDir)?o.layoutsDir:Ee.resolve(process.cwd(),o.layoutsDir),k=Ee.join(E,`${o.defaultLayout}.stx`);if(await Q(k))m=k}if(m&&!b)l=`@section('content')
15301
+ @endsection`}if(!m&&!g&&o.defaultLayout){let w=um(l),b=/@section\s*\(/.test(l);if(!w||b){let S="",x=Ae.dirname(r),_=o.layoutsDir?Ae.dirname(o.layoutsDir):process.cwd();for(let E=0;E<20;E++){let k=Ae.join(x,"_layout.stx");if(await X(k)){S=k;break}let A=Ae.dirname(x);if(A===x||A.length<_.length)break;x=A}if(S)m=S;else if(o.layoutsDir){let E=Ae.isAbsolute(o.layoutsDir)?o.layoutsDir:Ae.resolve(process.cwd(),o.layoutsDir),k=Ae.join(E,`${o.defaultLayout}.stx`);if(await X(k))m=k}if(m&&!b)l=`@section('content')
15302
15302
  ${l.trim()}
15303
- @endsection`}}if(l=l.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(w,b,S)=>{return f[b]=S,""}),l=l.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(w,b,S)=>{if(/^(['"]).*\1$/.test(S.trim()))return w;try{let x=pe(S.trim(),t);if(x===void 0)return w;return f[b]=String(x??""),""}catch{return w}}),l=l.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(w,b,S)=>{if(S.includes("@parent"))f[b]=S.replace("@parent",Ot);else f[b]=S.trim();return""}),t.__sections=f,l=l.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(w,b,S)=>{return f[b]||S||""}),!("slot"in t)||t.slot===void 0)l=l.replace(/\{\{\s*slot\s*\}\}/g,()=>{return f.content||""});if(l=kc(l,p),m){let w=[],b=Oi(l),S=Ar(b.output,Ua,(x,_)=>`\x00STX_ORPHAN_STYLE_${_}\x00`);if(l=S.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(x,_,E)=>{let k=_==="SCRIPT"?b.scripts[Number(E)]:S.tokens[Number(E)];if(k)w.push(k);return""}),w.length>0){let x=w.join(`
15303
+ @endsection`}}if(l=l.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(w,b,S)=>(f[b]=S,"")),l=l.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(w,b,S)=>{if(/^(['"]).*\1$/.test(S.trim()))return w;try{let x=fe(S.trim(),t);if(x===void 0)return w;return f[b]=String(x??""),""}catch{return w}}),l=l.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(w,b,S)=>{if(S.includes("@parent"))f[b]=S.replace("@parent",jt);else f[b]=S.trim();return""}),t.__sections=f,l=l.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(w,b,S)=>f[b]||S||""),!("slot"in t)||t.slot===void 0)l=l.replace(/\{\{\s*slot\s*\}\}/g,()=>f.content||"");if(l=Ec(l,p),m){let w=[],b=ji(l),S=Cr(b.output,Ga,(x,_)=>`\x00STX_ORPHAN_STYLE_${_}\x00`);if(l=S.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(x,_,E)=>{let k=_==="SCRIPT"?b.scripts[Number(E)]:S.tokens[Number(E)];if(k)w.push(k);return""}),w.length>0){let x=w.join(`
15304
15304
  `);f.content=f.content?`${f.content}
15305
- ${x}`:x,t.__sections=f}}if(m)try{let w;if(Ee.isAbsolute(m))w=m,i.add(m);else w=await Bn(()=>l0(m,r,a,i),null,()=>{throw new Xr(`Failed to resolve layout path: ${m}`,r,void 0,void 0,`Layout referenced from ${r}`)});if(!w){let k=[];try{let T=a.layoutsDir;if(T){let C=Ee.isAbsolute(T)?T:Ee.resolve(process.cwd(),T);k=dA.readdirSync(C).filter((D)=>D.endsWith(".stx")).map((D)=>D.replace(/\.stx$/,"")).sort()}}catch{}let A=`Layout not found: ${m} (referenced from ${r})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:a.layoutsDir?`. No .stx layouts found in ${a.layoutsDir}`:"");if(ot.log(Error(A),{layoutPath:m,filePath:r,available:k},"error"),console.error(`[stx] ${A}`),a.debug)throw new Xr(A,r);return l}let b=await Bn(()=>Bun.file(w).text(),"",()=>{throw new Xr(`Failed to read layout file: ${w}`,r,void 0,void 0,"Layout content could not be loaded")}),S=b.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(S){if(a.debug)console.log(`Found nested layout: ${S[1]} in ${w}`);let k={},A=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,O)=>{return k[I]=O.trim(),""});for(let[D,I]of Object.entries(k))if(f[D]&&f[D].includes(Ot)){let O=f[D].indexOf(Ot);f[D]=f[D].slice(0,O)+I+f[D].slice(O+Ot.length)}else if(!f[D])f[D]=I;let T={...t,__sections:f},C=`@layout('${S[1]}')${A}`;return await me(C,T,w,a,i)}let x=b.replace(/\{\{--[\s\S]*?--\}\}/g,""),_=_c(x,p),E={};return _=_.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,A,T)=>{return E[A]=T.trim(),`@slot('${A}')`}),_=_.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,A,T)=>{if(f[A]){let C=f[A];if(C.includes(Ot)){let D=E[A]||"",I=C.indexOf(Ot);C=C.slice(0,I)+D+C.slice(I+Ot.length)}return C}return T||""}),_=mA(_,f),_=_.replace(/\{\{\s*slot\s*\}\}/g,()=>{return f.content||""}),_=kc(_,p),t.__originalFilePath=r,l=await Lc(_,t,w,a,i),l=`<!-- stx-layout: ${m} -->
15306
- ${l}`,d(l)}catch(w){return ot.log(w instanceof Error?w:Error(String(w)),{layoutPath:m,filePath:r},"error"),`[Error processing layout: ${w instanceof Error?w.message:String(w)}]`}return d(await Lc(l,t,r,a,i))}function mA(e,t){return e.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(r,n,i)=>{let s=t[n];if(s!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(s))return s}return i||""})}function gA(e,t){if(e.__stx_sfc_mode=!0,e.__stx_options=t,t.buildMode)e.__stx_buildMode=t.buildMode;let r=t.envPrefix||"STX_PUBLIC_",n={};for(let[i,s]of Object.entries(process.env))if(i.startsWith(r)&&s!==void 0)n[i]=s;e.$env=n}async function yA(e,t){await Bn(()=>_k(e,t),void 0,(r)=>{ot.log(r,{filePath:e,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${e}: ${r.message}`)})}async function vA(e,t,r){let n=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,i;while((i=n.exec(e))!==null){let s=i[1],a=i[2];if(!/\bserver\b/.test(s)||!a.trim())continue;try{let{extractVariables:o}=await X("stx/variable-extractor",()=>Promise.resolve().then(()=>(Di(),ji)));await o(a,t,r,{preserveExisting:!0})}catch(o){let l=o instanceof Error?o:Error(String(o));ot.log(l,{filePath:r,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${r}: ${l.message}`)}}}async function wA(e,t,r){try{let{interpolateScriptsInTemplate:n}=await X("stx/expressions",()=>Promise.resolve().then(()=>(ut(),cd)));return n(e,t,{skipServer:!0})}catch(n){let i=n instanceof Error?n:Error(String(n));return ot.log(i,{filePath:r,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${r}: ${i.message}`),e}}async function Lc(e,t,r,n,i){let s=e,a=n;if(await vA(s,t,r),s=await wA(s,t,r),s=await fk(s,t,r),s=await hk(s,t,r),s=await AS(s,t,r,a),Nr(s))s=fp(s,t),s=mp(s,t);s=hp(s);let{processStreamDirectives:o}=await X("stx/streaming",()=>Promise.resolve().then(()=>(ah(),Wo)));s=o(s,t),s=$h(s,t,r,a),s=await Hk(s,t,r,a,i),s=await aa(s,t,r,a,i),s=dy(s,t,r,a);let{processDeferDirectives:l}=await X("stx/defer",()=>Promise.resolve().then(()=>Am));s=l(s,t,r);let{processTeleportDirectives:c}=await X("stx/teleport",()=>Promise.resolve().then(()=>Tm));s=c(s,t,r);let{processTransitionDirectives:u,processTransitionAttributes:d}=await X("stx/transitions",()=>Promise.resolve().then(()=>Im));s=u(s,t,r),s=d(s);let{processErrorBoundaryDirectives:h}=await X("stx/error-boundaries",()=>Promise.resolve().then(()=>$m));s=h(s,t,r);let{processSuspenseDirectives:p}=await X("stx/suspense",()=>Promise.resolve().then(()=>Nm));s=p(s,t,r);let{processAsyncDirectives:f}=await X("stx/async-components",()=>Promise.resolve().then(()=>Pm));s=f(s,t,r);let{processKeepAliveDirectives:m}=await X("stx/keep-alive",()=>Promise.resolve().then(()=>Mm));s=m(s,t,r);let{processVirtualListDirectives:y,processVirtualGridDirectives:g,processInfiniteListDirectives:v}=await X("stx/virtual-scrolling",()=>Promise.resolve().then(()=>(DE(),zm)));s=y(s,t,r),s=g(s,t,r),s=v(s,t,r);let{processPartialHydrationDirectives:w,processStaticDirectives:b}=await X("stx/partial-hydration",()=>Promise.resolve().then(()=>(HE(),Gm)));s=w(s,t,r),s=b(s);let{processComputedDirectives:S,processWatchDirectives:x}=await X("stx/computed",()=>Promise.resolve().then(()=>(UE(),ig)));s=S(s,t,r),s=x(s,t,r);let{processFormValidationDirectives:_}=await X("stx/forms-validation",()=>Promise.resolve().then(()=>(YE(),ug)));s=_(s,t,r);let{processHeadDirective:E,processTitleDirective:k,processMetaDirective:A,resetHead:T}=await X("stx/head",()=>Promise.resolve().then(()=>(ni(),Ds)));if(!t.__stx_head_preset&&!t.__stx_runtime_head)T();let C=E(s);if(s=C.content,C.headContent)t.__stx_head_raw=`${t.__stx_head_raw||""}${C.headContent}
15307
- `;if(s=k(s,t),s=A(s,t),s=xk(s),s=Kf(s,t),s=_S(s),s=yk(s),s=await Fh(s,t,r,a,i),s=await aa(s,t,r,a,i),t.__stxProcessingDepth===1)s=iv(s,t);if(s=s.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),s=pm(s),s=Ui(s,t,r),s=Zf(s,t),s=Qf(s,t),s=Xs(s,t),s=MS(s,t),s=BS(s,t),s=await aS(s,t,r,a),s=await p0(s,t,r),s=await u_(s,t,r,a),s=iy(s,t,r,a),s=Zb(s,t,r,a),s=Qb(s,t,r),s=Xb(s,t,r,a),s=yS(s,t,r,a),s=f1(s,t),s=h1(s),s=m1(s),!a.skipEventDirectives)s=ky(s,t,r);if(s=Qx(s,t,r),a.debug){let H=/\bx-data\s*=/.test(s),ne=fo(e);if(H&&ne)console.warn(`[stx] ${r}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15305
+ ${x}`:x,t.__sections=f}}if(m)try{let w;if(Ae.isAbsolute(m))w=m,i.add(m);else w=await zn(()=>cb(m,r,a,i),null,()=>{throw new en(`Failed to resolve layout path: ${m}`,r,void 0,void 0,`Layout referenced from ${r}`)});if(!w){let k=[];try{let T=a.layoutsDir;if(T){let C=Ae.isAbsolute(T)?T:Ae.resolve(process.cwd(),T);k=pA.readdirSync(C).filter((D)=>D.endsWith(".stx")).map((D)=>D.replace(/\.stx$/,"")).sort()}}catch{}let A=`Layout not found: ${m} (referenced from ${r})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:a.layoutsDir?`. No .stx layouts found in ${a.layoutsDir}`:"");if(lt.log(Error(A),{layoutPath:m,filePath:r,available:k},"error"),console.error(`[stx] ${A}`),a.debug)throw new en(A,r);return l}let b=await zn(()=>Bun.file(w).text(),"",()=>{throw new en(`Failed to read layout file: ${w}`,r,void 0,void 0,"Layout content could not be loaded")}),S=b.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(S){if(a.debug)console.log(`Found nested layout: ${S[1]} in ${w}`);let k={},A=b.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,I,O)=>(k[I]=O.trim(),""));for(let[D,I]of Object.entries(k))if(f[D]&&f[D].includes(jt)){let O=f[D].indexOf(jt);f[D]=f[D].slice(0,O)+I+f[D].slice(O+jt.length)}else if(!f[D])f[D]=I;let T={...t,__sections:f},C=`@layout('${S[1]}')${A}`;return await ge(C,T,w,a,i)}let x=b.replace(/\{\{--[\s\S]*?--\}\}/g,""),_=kc(x,p),E={};return _=_.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,A,T)=>(E[A]=T.trim(),`@slot('${A}')`)),_=_.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,A,T)=>{if(f[A]){let C=f[A];if(C.includes(jt)){let D=E[A]||"",I=C.indexOf(jt);C=C.slice(0,I)+D+C.slice(I+jt.length)}return C}return T||""}),_=gA(_,f),_=_.replace(/\{\{\s*slot\s*\}\}/g,()=>f.content||""),_=Ec(_,p),t.__originalFilePath=r,l=await Nc(_,t,w,a,i),l=`<!-- stx-layout: ${m} -->
15306
+ ${l}`,d(l)}catch(w){return lt.log(w instanceof Error?w:Error(String(w)),{layoutPath:m,filePath:r},"error"),`[Error processing layout: ${w instanceof Error?w.message:String(w)}]`}return d(await Nc(l,t,r,a,i))}function gA(e,t){return e.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(r,n,i)=>{let s=t[n];if(s!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(s))return s}return i||""})}function yA(e,t){if(e.__stx_sfc_mode=!0,e.__stx_options=t,t.buildMode)e.__stx_buildMode=t.buildMode;let r=t.envPrefix||"STX_PUBLIC_",n={};for(let[i,s]of Object.entries(process.env))if(i.startsWith(r)&&s!==void 0)n[i]=s;e.$env=n}async function vA(e,t){await zn(()=>kk(e,t),void 0,(r)=>{lt.log(r,{filePath:e,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${e}: ${r.message}`)})}async function wA(e,t,r){let n=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,i;while((i=n.exec(e))!==null){let s=i[1],a=i[2];if(!/\bserver\b/.test(s)||!a.trim())continue;try{let{extractVariables:o}=await ee("stx/variable-extractor",()=>Promise.resolve().then(()=>($i(),Di)));await o(a,t,r,{preserveExisting:!0})}catch(o){let l=o instanceof Error?o:Error(String(o));lt.log(l,{filePath:r,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${r}: ${l.message}`)}}}async function bA(e,t,r){try{let{interpolateScriptsInTemplate:n}=await ee("stx/expressions",()=>Promise.resolve().then(()=>(dt(),ud)));return n(e,t,{skipServer:!0})}catch(n){let i=n instanceof Error?n:Error(String(n));return lt.log(i,{filePath:r,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${r}: ${i.message}`),e}}async function Nc(e,t,r,n,i){let s=e,a=n;if(await wA(s,t,r),s=await bA(s,t,r),s=await hk(s,t,r),s=await mk(s,t,r),s=await CS(s,t,r,a),Pr(s))s=hp(s,t),s=gp(s,t);s=mp(s);let{processStreamDirectives:o}=await ee("stx/streaming",()=>Promise.resolve().then(()=>(oh(),Ho)));s=o(s,t),s=Lh(s,t,r,a),s=await Uk(s,t,r,a,i),s=await oa(s,t,r,a,i),s=py(s,t,r,a);let{processDeferDirectives:l}=await ee("stx/defer",()=>Promise.resolve().then(()=>Cm));s=l(s,t,r);let{processTeleportDirectives:c}=await ee("stx/teleport",()=>Promise.resolve().then(()=>Rm));s=c(s,t,r);let{processTransitionDirectives:u,processTransitionAttributes:d}=await ee("stx/transitions",()=>Promise.resolve().then(()=>Om));s=u(s,t,r),s=d(s);let{processErrorBoundaryDirectives:h}=await ee("stx/error-boundaries",()=>Promise.resolve().then(()=>Lm));s=h(s,t,r);let{processSuspenseDirectives:p}=await ee("stx/suspense",()=>Promise.resolve().then(()=>Pm));s=p(s,t,r);let{processAsyncDirectives:f}=await ee("stx/async-components",()=>Promise.resolve().then(()=>Mm));s=f(s,t,r);let{processKeepAliveDirectives:m}=await ee("stx/keep-alive",()=>Promise.resolve().then(()=>Bm));s=m(s,t,r);let{processVirtualListDirectives:y,processVirtualGridDirectives:g,processInfiniteListDirectives:v}=await ee("stx/virtual-scrolling",()=>Promise.resolve().then(()=>($E(),Fm)));s=y(s,t,r),s=g(s,t,r),s=v(s,t,r);let{processPartialHydrationDirectives:w,processStaticDirectives:b}=await ee("stx/partial-hydration",()=>Promise.resolve().then(()=>(UE(),Vm)));s=w(s,t,r),s=b(s);let{processComputedDirectives:S,processWatchDirectives:x}=await ee("stx/computed",()=>Promise.resolve().then(()=>(GE(),sg)));s=S(s,t,r),s=x(s,t,r);let{processFormValidationDirectives:_}=await ee("stx/forms-validation",()=>Promise.resolve().then(()=>(KE(),dg)));s=_(s,t,r);let{processHeadDirective:E,processTitleDirective:k,processMetaDirective:A,resetHead:T}=await ee("stx/head",()=>Promise.resolve().then(()=>(ii(),$s)));if(!t.__stx_head_preset&&!t.__stx_runtime_head)T();let C=E(s);if(s=C.content,C.headContent)t.__stx_head_raw=`${t.__stx_head_raw||""}${C.headContent}
15307
+ `;if(s=k(s,t),s=A(s,t),s=Sk(s),s=Zf(s,t),s=kS(s),s=vk(s),s=await qh(s,t,r,a,i),s=await oa(s,t,r,a,i),t.__stxProcessingDepth===1)s=sv(s,t);if(s=s.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),s=fm(s),s=Gi(s,t,r),s=Qf(s,t),s=Xf(s,t),s=ea(s,t),s=BS(s,t),s=zS(s,t),s=await oS(s,t,r,a),s=await fb(s,t,r),s=await d_(s,t,r,a),s=sy(s,t,r,a),s=Qx(s,t,r,a),s=Xx(s,t,r),s=e0(s,t,r,a),s=vS(s,t,r,a),s=h1(s,t),s=m1(s),s=g1(s),!a.skipEventDirectives)s=Ey(s,t,r);if(s=X0(s,t,r),a.debug){let U=/\bx-data\s*=/.test(s),ie=ho(e);if(U&&ie)console.warn(`[stx] ${r}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15308
15308
  Both work on the same page, but they manage separate scopes.
15309
- Prefer signals (state/derived/effect) for new components.`)}s=Ak(s,t),s=await fn(s,t,r),s=g1(s),s=y1(s),s=Lx(s);let{processXElementDirectives:D}=await X("stx/x-element",()=>Promise.resolve().then(()=>mg));s=D(s);let I=t.__originalFilePath||r,O=$a(t);if(s=await vp(s,a,I,O),s=$S(s,t),s=await wk(s,t,r,a),a.media?.image?.autoSiblings){let H=a.publicDir||"public",{rewriteImagesWithSiblings:ne}=await X("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(()=>(nA(),vg)));s=await ne(s,{publicDir:H})}if(a.seo?.enabled)s=ex(s,t,a);let L=(H,ne,ie=!0)=>{if(!ne)return H;let _e=ne.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),we=H.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(_e&&we){if(ie)H=H.replace(we[0],_e[0]);if(ne=ne.replace(_e[0],"").trim(),!ne)return H}if(/<\/head>/i.test(H))return H.replace(/<\/head>/i,`${ne}
15310
- </head>`);if(/<head\b[^>]*>/i.test(H))return H.replace(/(<head\b[^>]*>)/i,`$1
15311
- ${ne}`);if(/<html\b[^>]*>/i.test(H))return H.replace(/(<html\b[^>]*>)/i,`$1
15309
+ Prefer signals (state/derived/effect) for new components.`)}s=Ck(s,t),s=await hn(s,t,r),s=y1(s),s=v1(s),s=N0(s);let{processXElementDirectives:D}=await ee("stx/x-element",()=>Promise.resolve().then(()=>gg));s=D(s);let I=t.__originalFilePath||r,O=La(t);if(s=await wp(s,a,I,O),s=LS(s,t),s=await bk(s,t,r,a),a.media?.image?.autoSiblings){let U=a.publicDir||"public",{rewriteImagesWithSiblings:ie}=await ee("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(()=>(iA(),wg)));s=await ie(s,{publicDir:U})}if(a.seo?.enabled)s=t0(s,t,a);let N=(U,ie,se=!0)=>{if(!ie)return U;let ke=ie.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),be=U.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(ke&&be){if(se)U=U.replace(be[0],ke[0]);if(ie=ie.replace(ke[0],"").trim(),!ie)return U}if(/<\/head>/i.test(U))return U.replace(/<\/head>/i,`${ie}
15310
+ </head>`);if(/<head\b[^>]*>/i.test(U))return U.replace(/(<head\b[^>]*>)/i,`$1
15311
+ ${ie}`);if(/<html\b[^>]*>/i.test(U))return U.replace(/(<html\b[^>]*>)/i,`$1
15312
15312
  <head>
15313
- ${ne}
15314
- </head>`);return H},{renderHead:N,getHead:B}=await X("stx/head",()=>Promise.resolve().then(()=>(ni(),Ds))),F=t.__stx_runtime_head??B();if(F.title||F.meta?.length||F.link?.length){let H=N(F);if(H)s=L(s,H)}if(C.headContent)s=L(s,C.headContent,!F.title);if(a.csp?.enabled&&a.csp.addMetaTag)s=mS(s,a.csp,t);if(a.analytics?.enabled)s=Wx(s,a);if(a.heatmap?.enabled)s=hy(s,a);if(a.pwa?.enabled&&a.pwa.autoInject!==!1){let{injectPwaTags:H}=await X("stx/pwa/inject",()=>Promise.resolve().then(()=>(uA(),Sg)));s=H(s,a)}let K=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(s),Te=/\bSTX\.\w+/.test(s),ae=/window\.STX\s*=/.test(s);if(K&&Te&&!ae){let H=`<script data-stx-scoped data-stx-run="once">
15315
- ${Ax()}
15316
- </script>`;if(s.includes("</head>")){let ne=s.indexOf("</head>"),ie=s.slice(0,ne).indexOf("<script");if(ie!==-1){let _e=s.slice(0,ie),we=s.slice(ie);s=_e+H+`
15317
- `+we}else s=s.replace("</head>",`${H}
15313
+ ${ie}
15314
+ </head>`);return U},{renderHead:P,getHead:z}=await ee("stx/head",()=>Promise.resolve().then(()=>(ii(),$s))),q=t.__stx_runtime_head??z();if(q.title||q.meta?.length||q.link?.length){let U=P(q);if(U)s=N(s,U)}if(C.headContent)s=N(s,C.headContent,!q.title);if(a.csp?.enabled&&a.csp.addMetaTag)s=gS(s,a.csp,t);if(a.analytics?.enabled)s=H0(s,a);if(a.heatmap?.enabled)s=my(s,a);if(a.pwa?.enabled&&a.pwa.autoInject!==!1){let{injectPwaTags:U}=await ee("stx/pwa/inject",()=>Promise.resolve().then(()=>(dA(),_g)));s=U(s,a)}let Z=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(s),Re=/\bSTX\.\w+/.test(s),oe=/window\.STX\s*=/.test(s);if(Z&&Re&&!oe){let U=`<script data-stx-scoped data-stx-run="once">
15315
+ ${C0()}
15316
+ </script>`;if(s.includes("</head>")){let ie=s.indexOf("</head>"),se=s.slice(0,ie).indexOf("<script");if(se!==-1){let ke=s.slice(0,se),be=s.slice(se);s=ke+U+`
15317
+ `+be}else s=s.replace("</head>",`${U}
15318
15318
  </head>`)}else if(s.includes("<body"))s=s.replace(/<body([^>]*)>/,`<body$1>
15319
- ${H}`);else s=H+`
15320
- `+s}{let{scanScriptTags:H}=await X("stx/signal-processing",()=>Promise.resolve().then(()=>(li(),ai))),ne=[];for(let ie of H(s)){if(!/\bserver\b/i.test(ie.attrs))continue;let _e=ie.start+ie.fullMatch.indexOf(">")+1,we=pA(s,_e);if(we===-1)continue;let He=we+9;while(He<s.length&&/\s/.test(s[He]))He++;ne.push({start:ie.start,end:He})}for(let ie=ne.length-1;ie>=0;ie--){let{start:_e,end:we}=ne[ie];s=s.substring(0,_e)+s.substring(we)}}let ye=vd(s,r);if(ye.hasScoped)s=ye.html;let z=t.__stx_event_bindings||[],G=!1,ve=[],Ie=/\s:[a-z][\w.-]*\s*=/.test(s),{scanScriptTags:er}=await X("stx/signal-processing",()=>Promise.resolve().then(()=>(li(),ai)));for(let H of er(s,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ve.push({match:H.fullMatch,attrs:H.attrs,content:H.body});for(let{match:H,attrs:ne,content:ie}of ve){G=!0;let _e=ie;v1(ie,r,n.strict,t.__originalFilePath);let we=await Na(ie,{eventBindings:z,attrs:ne,hasColonDirectives:Ie,templateContent:e,filePath:r,projectRoot:process.cwd(),production:n.buildMode==="compile",serverData:O});s=s.replace(H,()=>we)}if(G)t.__stx_event_bindings=[];if(!G&&t.__stxProcessingDepth===1){let H=t.__stx_event_bindings||[];if(H.length>0){let ne=Lu(H);if(ne){let ie=s.lastIndexOf("</body>");s=ie===-1?s+ne:s.slice(0,ie)+ne+`
15321
- `+s.slice(ie)}t.__stx_event_bindings=[]}}if(!Mw(s)&&Bw(s))s=await up(s,a);if(s=Fw(s),a.csp?.enabled&&a.csp.useNonce&&typeof t.cspNonce==="string")s=gS(s,t.cspNonce);return s}var Ot="<!--PARENT_CONTENT_PLACEHOLDER-->",el=R(()=>{Bo(),Vd(),Lr(),pu(),Ix(),Nx(),Hx(),_u(),yu(),Pu(),Ii(),rS(),lS(),zo(),vS(),ES(),RS(),LS(),kt(),ni(),ut(),zS(),d_(),pk(),mk(),Ph(),Sp(),bk(),hn(),Sk(),$o(),Ce(),kk(),Ck(),Wk(),Gk(),bd(),lm(),u1(),li(),Oh(),p1(),Tc(),Rc(),Se(),ph(),rd(),Ai(),Bs(),Bs(),Tc(),Rc()}),_g="resources/assets",xA="assets";function SA(e=process.cwd()){let t=bA.resolve(e,_g);return Nc.existsSync(t)&&Nc.statSync(t).isDirectory()?t:null}var kg="_stx";function _A(e){return Bun.hash(e).toString(16).slice(0,8)}function kA(e){let t=[],r=(n)=>{for(let i of yr.readdirSync(n,{withFileTypes:!0})){let s=ba.join(n,i.name);if(i.isDirectory())r(s);else if(i.isFile()&&s.endsWith(".html"))t.push(s)}};if(yr.existsSync(e))r(e);return t}var EA=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-crosswind="generated" rel="stylesheet" href="${e}">`}];function AA(e,t=`/${kg}`){let r=[],n=new Set,i=0,s=e;for(let a of EA)s=s.replace(a.pattern,(o,l,c)=>{if(/\b(?:src|href)\s*=/.test(l)||!c.trim())return o;let u=`${a.prefix}.${_A(c)}.${a.extension}`;if(!n.has(u))n.add(u),r.push({filename:u,contents:c,contentType:a.contentType});return i+=c.length,a.replace(`${t}/${u}`)});return{html:s,assets:r,bytesInlined:i}}function CA(e){let t={pages:0,assets:0,bytesInlined:0},r=ba.join(e,kg),n=new Set;for(let i of kA(e)){let s=yr.readFileSync(i,"utf8"),{html:a,assets:o,bytesInlined:l}=AA(s);if(a===s)continue;for(let c of o){if(n.has(c.filename))continue;n.add(c.filename),yr.mkdirSync(r,{recursive:!0}),yr.writeFileSync(ba.join(r,c.filename),c.contents),t.assets++}yr.writeFileSync(i,a),t.bytesInlined+=l,t.pages++}return t}lu();el();function RA(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}var IA=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function OA(e){return Bun.hash(e).toString(16)}function jA(e,t={}){if(!e.includes('type="stx/island"'))return{html:e,chunks:[]};let r=new Map,n=e.replace(IA,(s,a,o,l)=>{let c=l.trim();if(!c)return s;if(/\bdata-stx-src=/.test(o))return s;if(t.minify)c=RA(c);let u=OA(c);if(!r.has(u))r.set(u,c);let d=t.integrity?` data-stx-integrity="sha384-${TA("sha384").update(c).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${a}" data-stx-src="/_stx/islands/${u}.js"${d}${o}></script>`}),i=Array.from(r,([s,a])=>({hash:s,code:a}));return{html:n,chunks:i}}var DA=new Set(["visible","idle"]);function $A(e){if(!e.includes("data-stx-src="))return e;let t=new Map,r=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=r.exec(e))!==null)t.set(n[1],n[2]);let i=new Set,s=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,a;while((a=s.exec(e))!==null)if(DA.has(t.get(a[1])||""))i.add(a[2]);let o=e.lastIndexOf("</head>");if(i.size===0||o===-1)return e;let l=Array.from(i).filter((c)=>!e.includes(`rel="prefetch" href="${c}"`)).map((c)=>`<link rel="prefetch" href="${c}" as="script">`).join("");if(!l)return e;return e.slice(0,o)+l+e.slice(o)}Et();var LA="layout-types.d.ts";function NA(e){let t=[],r=(n,i)=>{let s;try{s=Vr.readdirSync(n,{withFileTypes:!0})}catch{return}for(let a of s){if(a.name.startsWith("."))continue;let o=Kn.join(n,a.name);if(a.isDirectory())r(o,i?`${i}/${a.name}`:a.name);else if(a.isFile()&&a.name.endsWith(".stx")&&a.name!=="_layout.stx"){let l=a.name.slice(0,-4);t.push(i?`${i}/${l}`:l)}}};return r(e,""),t.sort()}function PA(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
15319
+ ${U}`);else s=U+`
15320
+ `+s}{let{scanScriptTags:U}=await ee("stx/signal-processing",()=>Promise.resolve().then(()=>(ci(),oi))),ie=[];for(let se of U(s)){if(!/\bserver\b/i.test(se.attrs))continue;let ke=se.start+se.fullMatch.indexOf(">")+1,be=fA(s,ke);if(be===-1)continue;let Ue=be+9;while(Ue<s.length&&/\s/.test(s[Ue]))Ue++;ie.push({start:se.start,end:Ue})}for(let se=ie.length-1;se>=0;se--){let{start:ke,end:be}=ie[se];s=s.substring(0,ke)+s.substring(be)}}let ve=wd(s,r);if(ve.hasScoped)s=ve.html;let F=t.__stx_event_bindings||[],V=!1,we=[],Oe=/\s:[a-z][\w.-]*\s*=/.test(s),{scanScriptTags:tr}=await ee("stx/signal-processing",()=>Promise.resolve().then(()=>(ci(),oi)));for(let U of tr(s,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))we.push({match:U.fullMatch,attrs:U.attrs,content:U.body});for(let{match:U,attrs:ie,content:se}of we){V=!0;let ke=se;w1(se,r,n.strict,t.__originalFilePath);let be=await Pa(se,{eventBindings:F,attrs:ie,hasColonDirectives:Oe,templateContent:e,filePath:r,projectRoot:process.cwd(),production:n.buildMode==="compile",serverData:O});s=s.replace(U,()=>be)}if(V)t.__stx_event_bindings=[];if(!V&&t.__stxProcessingDepth===1){let U=t.__stx_event_bindings||[];if(U.length>0){let ie=Nu(U);if(ie){let se=s.lastIndexOf("</body>");s=se===-1?s+ie:s.slice(0,se)+ie+`
15321
+ `+s.slice(se)}t.__stx_event_bindings=[]}}if(!Bw(s)&&zw(s))s=await dp(s,a);if(s=qw(s),a.csp?.enabled&&a.csp.useNonce&&typeof t.cspNonce==="string")s=yS(s,t.cspNonce);return s}var jt="<!--PARENT_CONTENT_PLACEHOLDER-->",tl=R(()=>{zo(),Jd(),Nr(),fu(),O0(),P0(),U0(),ku(),vu(),Mu(),Oi(),nS(),cS(),Fo(),wS(),AS(),IS(),NS(),Et(),ii(),dt(),FS(),p_(),fk(),gk(),Mh(),_p(),xk(),mn(),_k(),Lo(),Te(),Ek(),Tk(),Hk(),Vk(),xd(),cm(),d1(),ci(),jh(),f1(),Rc(),Ic(),_e(),fh(),nd(),Ci(),zs(),zs(),Rc(),Ic()}),kg="resources/assets",SA="assets";function _A(e=process.cwd()){let t=xA.resolve(e,kg);return Pc.existsSync(t)&&Pc.statSync(t).isDirectory()?t:null}var Eg="_stx";function kA(e){return Bun.hash(e).toString(16).slice(0,8)}function EA(e){let t=[],r=(n)=>{for(let i of vr.readdirSync(n,{withFileTypes:!0})){let s=xa.join(n,i.name);if(i.isDirectory())r(s);else if(i.isFile()&&s.endsWith(".html"))t.push(s)}};if(vr.existsSync(e))r(e);return t}var AA=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-runtime src="${e}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:(e)=>`<script data-stx-router src="${e}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:(e)=>`<link data-crosswind="generated" rel="stylesheet" href="${e}">`}];function CA(e,t=`/${Eg}`){let r=[],n=new Set,i=0,s=e;for(let a of AA)s=s.replace(a.pattern,(o,l,c)=>{if(/\b(?:src|href)\s*=/.test(l)||!c.trim())return o;let u=`${a.prefix}.${kA(c)}.${a.extension}`;if(!n.has(u))n.add(u),r.push({filename:u,contents:c,contentType:a.contentType});return i+=c.length,a.replace(`${t}/${u}`)});return{html:s,assets:r,bytesInlined:i}}function TA(e){let t={pages:0,assets:0,bytesInlined:0},r=xa.join(e,Eg),n=new Set;for(let i of EA(e)){let s=vr.readFileSync(i,"utf8"),{html:a,assets:o,bytesInlined:l}=CA(s);if(a===s)continue;for(let c of o){if(n.has(c.filename))continue;n.add(c.filename),vr.mkdirSync(r,{recursive:!0}),vr.writeFileSync(xa.join(r,c.filename),c.contents),t.assets++}vr.writeFileSync(i,a),t.bytesInlined+=l,t.pages++}return t}cu();tl();function IA(e){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}var OA=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function jA(e){return Bun.hash(e).toString(16)}function DA(e,t={}){if(!e.includes('type="stx/island"'))return{html:e,chunks:[]};let r=new Map,n=e.replace(OA,(s,a,o,l)=>{let c=l.trim();if(!c)return s;if(/\bdata-stx-src=/.test(o))return s;if(t.minify)c=IA(c);let u=jA(c);if(!r.has(u))r.set(u,c);let d=t.integrity?` data-stx-integrity="sha384-${RA("sha384").update(c).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${a}" data-stx-src="/_stx/islands/${u}.js"${d}${o}></script>`}),i=Array.from(r,([s,a])=>({hash:s,code:a}));return{html:n,chunks:i}}var $A=new Set(["visible","idle"]);function LA(e){if(!e.includes("data-stx-src="))return e;let t=new Map,r=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,n;while((n=r.exec(e))!==null)t.set(n[1],n[2]);let i=new Set,s=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,a;while((a=s.exec(e))!==null)if($A.has(t.get(a[1])||""))i.add(a[2]);let o=e.lastIndexOf("</head>");if(i.size===0||o===-1)return e;let l=Array.from(i).filter((c)=>!e.includes(`rel="prefetch" href="${c}"`)).map((c)=>`<link rel="prefetch" href="${c}" as="script">`).join("");if(!l)return e;return e.slice(0,o)+l+e.slice(o)}At();var NA="layout-types.d.ts";function PA(e){let t=[],r=(n,i)=>{let s;try{s=Jr.readdirSync(n,{withFileTypes:!0})}catch{return}for(let a of s){if(a.name.startsWith("."))continue;let o=Zn.join(n,a.name);if(a.isDirectory())r(o,i?`${i}/${a.name}`:a.name);else if(a.isFile()&&a.name.endsWith(".stx")&&a.name!=="_layout.stx"){let l=a.name.slice(0,-4);t.push(i?`${i}/${l}`:l)}}};return r(e,""),t.sort()}function MA(e){let t=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if(e.length===0)return t.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),t.join(`
15322
15322
  `);return t.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...e.map((r)=>` '${r}': true`)," }","}","","export {}",""),t.join(`
15323
- `)}function MA(e,t){if(!e)return[];let r=Kn.isAbsolute(e)?e:Kn.resolve(process.cwd(),e),n=NA(r),i=PA(n),s=Kn.join(t,LA);try{if(Vr.existsSync(s)&&Vr.readFileSync(s,"utf8")===i)return n;Vr.mkdirSync(t,{recursive:!0}),Vr.writeFileSync(s,i)}catch{}return n}var BA=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function tl(e){let t=e.trim();if(!t)return null;let r=/^https?:\/\//i.test(t)?t:`https://${t}`;try{return new URL(r).origin+new URL(r).pathname.replace(/\/$/,"")}catch{return null}}function zA(e){for(let t of BA){let r=e[t];if(!r)continue;let n=tl(r);if(n)return{url:n,source:"env",via:t}}return null}function Eg(e){if(!e||typeof e!=="object")return null;let t=e,r=t.site?.url??t.url??t.app?.url;return typeof r==="string"?tl(r):null}async function FA(e){let{existsSync:t}=await import("fs"),r=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let i=r.resolve(e,n);if(!t(i))continue;try{let s=await import(i),a=Eg(s.default??s);if(a)return a}catch{}}return null}async function qA(e={}){let t=e.cwd??process.cwd(),r=e.env??process.env;if(e.explicit){let a=tl(e.explicit);if(a)return{url:a,source:"option"}}let n=Eg(e.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let i=await FA(t);if(i)return{url:i,source:"site.config",via:"url"};let s=zA(r);if(s)return s;return{url:"http://localhost",source:"fallback"}}function WA(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
15324
- `)}$o();Ei();Bo();Wt();class Ag{cacheDir;cache=new Map;loaded=!1;constructor(e){this.cacheDir=e}async load(){if(this.loaded)return;let e=ee.join(this.cacheDir,"build-cache.json");if(await Bun.file(e).exists())try{let t=JSON.parse(await Bun.file(e).text());for(let[r,n]of Object.entries(t))this.cache.set(r,n)}catch{}this.loaded=!0}async save(){await de.promises.mkdir(this.cacheDir,{recursive:!0});let e=ee.join(this.cacheDir,"build-cache.json"),t={};for(let[r,n]of this.cache)t[r]=n;await Bun.write(e,JSON.stringify(t))}getHash(e,t){let r=de.statSync(e),n=`${e}:${r.mtimeMs}`;for(let s of t)if(de.existsSync(s)){let a=de.statSync(s);n+=`:${s}:${a.mtimeMs}`}let i=0;for(let s=0;s<n.length;s++){let a=n.charCodeAt(s);i=(i<<5)-i+a,i=i&i}return Math.abs(i).toString(36)}get(e,t){let r=this.cache.get(e);if(!r)return null;let n=this.getHash(t,r.dependencies??[]);if(r.hash!==n)return this.cache.delete(e),null;return r.html}set(e,t,r,n){let i=this.getHash(t,r);this.cache.set(e,{hash:i,html:n,generatedAt:Date.now(),dependencies:r})}}class Cg{cacheDir;constructor(e){this.cacheDir=e}getFilePath(e){let t=e.replace(/[^a-zA-Z0-9]/g,"_")+".json";return ee.join(this.cacheDir,"isr",t)}async get(e){let t=this.getFilePath(e);if(!await Bun.file(t).exists())return null;try{return JSON.parse(await Bun.file(t).text())}catch{return null}}async set(e,t){let r=this.getFilePath(e);await de.promises.mkdir(ee.dirname(r),{recursive:!0}),await Bun.write(r,JSON.stringify(t))}async invalidate(e){let t=this.getFilePath(e);if(await Bun.file(t).exists())await de.promises.unlink(t)}async invalidatePattern(e){let t=ee.join(this.cacheDir,"isr");if(!de.existsSync(t))return;let r=await de.promises.readdir(t);for(let n of r){let i=n.replace(/_/g,"/").replace(".json","");if(e.test(i))await de.promises.unlink(ee.join(t,n))}}async needsRevalidation(e){let t=await this.get(e);if(!t)return!0;return Date.now()>t.revalidateAfter}}async function HA(e){try{let t=(await Bun.file(e).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!t)return null;let r=t[1];if(!r.includes("getStaticPaths"))return null;let n=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!n)return null;return await Function(`
15323
+ `)}function BA(e,t){if(!e)return[];let r=Zn.isAbsolute(e)?e:Zn.resolve(process.cwd(),e),n=PA(r),i=MA(n),s=Zn.join(t,NA);try{if(Jr.existsSync(s)&&Jr.readFileSync(s,"utf8")===i)return n;Jr.mkdirSync(t,{recursive:!0}),Jr.writeFileSync(s,i)}catch{}return n}var zA=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function rl(e){let t=e.trim();if(!t)return null;let r=/^https?:\/\//i.test(t)?t:`https://${t}`;try{return new URL(r).origin+new URL(r).pathname.replace(/\/$/,"")}catch{return null}}function FA(e){for(let t of zA){let r=e[t];if(!r)continue;let n=rl(r);if(n)return{url:n,source:"env",via:t}}return null}function Ag(e){if(!e||typeof e!=="object")return null;let t=e,r=t.site?.url??t.url??t.app?.url;return typeof r==="string"?rl(r):null}async function qA(e){let{existsSync:t}=await import("fs"),r=await import("path");for(let n of["site.config.ts","site.config.js",".config/site.config.ts"]){let i=r.resolve(e,n);if(!t(i))continue;try{let s=await import(i),a=Ag(s.default??s);if(a)return a}catch{}}return null}async function WA(e={}){let t=e.cwd??process.cwd(),r=e.env??process.env;if(e.explicit){let a=rl(e.explicit);if(a)return{url:a,source:"option"}}let n=Ag(e.stxConfig);if(n)return{url:n,source:"stx.config",via:"site.url"};let i=await qA(t);if(i)return{url:i,source:"site.config",via:"url"};let s=FA(r);if(s)return s;return{url:"http://localhost",source:"fallback"}}function HA(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
15324
+ `)}Lo();Ai();zo();Ht();class Cg{cacheDir;cache=new Map;loaded=!1;constructor(e){this.cacheDir=e}async load(){if(this.loaded)return;let e=te.join(this.cacheDir,"build-cache.json");if(await Bun.file(e).exists())try{let t=JSON.parse(await Bun.file(e).text());for(let[r,n]of Object.entries(t))this.cache.set(r,n)}catch{}this.loaded=!0}async save(){await pe.promises.mkdir(this.cacheDir,{recursive:!0});let e=te.join(this.cacheDir,"build-cache.json"),t={};for(let[r,n]of this.cache)t[r]=n;await Bun.write(e,JSON.stringify(t))}getHash(e,t){let r=pe.statSync(e),n=`${e}:${r.mtimeMs}`;for(let s of t)if(pe.existsSync(s)){let a=pe.statSync(s);n+=`:${s}:${a.mtimeMs}`}let i=0;for(let s=0;s<n.length;s++){let a=n.charCodeAt(s);i=(i<<5)-i+a,i=i&i}return Math.abs(i).toString(36)}get(e,t){let r=this.cache.get(e);if(!r)return null;let n=this.getHash(t,r.dependencies??[]);if(r.hash!==n)return this.cache.delete(e),null;return r.html}set(e,t,r,n){let i=this.getHash(t,r);this.cache.set(e,{hash:i,html:n,generatedAt:Date.now(),dependencies:r})}}class Tg{cacheDir;constructor(e){this.cacheDir=e}getFilePath(e){let t=e.replace(/[^a-zA-Z0-9]/g,"_")+".json";return te.join(this.cacheDir,"isr",t)}async get(e){let t=this.getFilePath(e);if(!await Bun.file(t).exists())return null;try{return JSON.parse(await Bun.file(t).text())}catch{return null}}async set(e,t){let r=this.getFilePath(e);await pe.promises.mkdir(te.dirname(r),{recursive:!0}),await Bun.write(r,JSON.stringify(t))}async invalidate(e){let t=this.getFilePath(e);if(await Bun.file(t).exists())await pe.promises.unlink(t)}async invalidatePattern(e){let t=te.join(this.cacheDir,"isr");if(!pe.existsSync(t))return;let r=await pe.promises.readdir(t);for(let n of r){let i=n.replace(/_/g,"/").replace(".json","");if(e.test(i))await pe.promises.unlink(te.join(t,n))}}async needsRevalidation(e){let t=await this.get(e);if(!t)return!0;return Date.now()>t.revalidateAfter}}async function UA(e){try{let t=(await Bun.file(e).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!t)return null;let r=t[1];if(!r.includes("getStaticPaths"))return null;let n=r.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!n)return null;return await Function(`
15325
15325
  return (async function getStaticPaths() {
15326
15326
  ${n[1]}
15327
15327
  })()
15328
- `)()}catch(t){return console.error(`Error extracting static paths from ${e}:`,t),null}}async function UA(e){let t=[];if(!e.isDynamic)t.push({url:e.pattern,params:{}});else{let r=await HA(e.filePath);if(!r||r.paths.length===0)return console.warn(`Warning: Dynamic route ${e.pattern} has no getStaticPaths or returned empty paths`),t;for(let n of r.paths){let i=e.pattern;for(let[s,a]of Object.entries(n.params))i=i.replace(`:${s}`,a).replace(`:${s}*`,a);t.push({url:i,params:n.params,props:n.props,revalidate:n.revalidate})}}return t}async function GA(e){let t=[e.replace(/\.stx$/,".data.ts"),e.replace(/\.stx$/,".data.js"),e+".data.ts",e+".data.js"];for(let r of t)if(await Bun.file(r).exists())try{let n=await import(r);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:i,...s}=n;return s}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function VA(e,t,r){let n=e.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let i=n[1];if(!i.includes("getStaticProps"))return null;try{let s=i.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!s)return null;return await Function("params",`
15328
+ `)()}catch(t){return console.error(`Error extracting static paths from ${e}:`,t),null}}async function GA(e){let t=[];if(!e.isDynamic)t.push({url:e.pattern,params:{}});else{let r=await UA(e.filePath);if(!r||r.paths.length===0)return console.warn(`Warning: Dynamic route ${e.pattern} has no getStaticPaths or returned empty paths`),t;for(let n of r.paths){let i=e.pattern;for(let[s,a]of Object.entries(n.params))i=i.replace(`:${s}`,a).replace(`:${s}*`,a);t.push({url:i,params:n.params,props:n.props,revalidate:n.revalidate})}}return t}async function VA(e){let t=[e.replace(/\.stx$/,".data.ts"),e.replace(/\.stx$/,".data.js"),e+".data.ts",e+".data.js"];for(let r of t)if(await Bun.file(r).exists())try{let n=await import(r);if(typeof n.default==="function")return await n.default();else if(typeof n.default==="object")return n.default;else if(typeof n.getData==="function")return await n.getData();else{let{default:i,...s}=n;return s}}catch(n){console.error(`Error loading data file ${r}:`,n)}return null}async function JA(e,t,r){let n=e.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!n)return null;let i=n[1];if(!i.includes("getStaticProps"))return null;try{let s=i.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!s)return null;return await Function("params",`
15329
15329
  return (async function getStaticProps() {
15330
15330
  ${s[1]}
15331
15331
  })()
15332
- `)(t)}catch(s){return console.error(`Error executing getStaticProps in ${r}:`,s),null}}function JA(e){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(e)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(e)}async function Tg(e,t,r={},n,i){let s=await Bun.file(e.filePath).text(),a=await GA(e.filePath),o=await VA(s,t,e.filePath),l={...a||{},...o||{},...r,params:t,$route:{path:e.pattern,params:t}},c=new Set,u=[],d={...i,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(p)=>{u.push(`${ee.relative(process.cwd(),p.templatePath)}: ${p.message}
15333
- resolved against partialsDir: ${p.partialsDir}`)}};if(JA(s))console.warn(`Warning: ${e.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let h=await me(s,l,e.filePath,d,c);if(Object.keys(t).length>0){let p=`<script>if(window.stx)window.stx._rp=${JSON.stringify(t)};else window.__stx_rp=${JSON.stringify(t)};</script>`;if(h.includes("</head>"))h=h.replace("</head>",`${p}
15332
+ `)(t)}catch(s){return console.error(`Error executing getStaticProps in ${r}:`,s),null}}function YA(e){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test(e)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test(e)}async function Rg(e,t,r={},n,i){let s=await Bun.file(e.filePath).text(),a=await VA(e.filePath),o=await JA(s,t,e.filePath),l={...a||{},...o||{},...r,params:t,$route:{path:e.pattern,params:t}},c=new Set,u=[],d={...i,...n.partialsDir?{partialsDir:n.partialsDir}:{},...n.componentsDir?{componentsDir:n.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(p)=>{u.push(`${te.relative(process.cwd(),p.templatePath)}: ${p.message}
15333
+ resolved against partialsDir: ${p.partialsDir}`)}};if(YA(s))console.warn(`Warning: ${e.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let h=await ge(s,l,e.filePath,d,c);if(Object.keys(t).length>0){let p=`<script>if(window.stx)window.stx._rp=${JSON.stringify(t)};else window.__stx_rp=${JSON.stringify(t)};</script>`;if(h.includes("</head>"))h=h.replace("</head>",`${p}
15334
15334
  </head>`);else h=`${p}
15335
- ${h}`}if(h=await qw(h,{router:n.router}),h=await Mo(h),n.minify!==!1)return{html:YA(h),dependencies:Array.from(c),includeFailures:u};return{html:h,dependencies:Array.from(c),includeFailures:u}}function YA(e){let t=[],r=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,i;while((i=n.exec(e))!==null){let a=e.slice(r,i.index);t.push(a.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let o=i[1],l=i[2],c=i[3];l=l.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),t.push(o+l+c),r=i.index+i[0].length}let s=e.slice(r);return t.push(s.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),t.join("").trim()}function KA(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return`"${Math.abs(t).toString(36)}"`}function ZA(e,t,r,n){if(r?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(t))return!0;return n.some((i)=>{if(i instanceof RegExp)return i.test(e);return i.endsWith("/")?e===i.slice(0,-1)||e.startsWith(i):e===i})}function QA(e,t){return`<?xml version="1.0" encoding="UTF-8"?>
15335
+ ${h}`}if(h=await Ww(h,{router:n.router}),h=await Bo(h),n.minify!==!1)return{html:KA(h),dependencies:Array.from(c),includeFailures:u};return{html:h,dependencies:Array.from(c),includeFailures:u}}function KA(e){let t=[],r=0,n=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,i;while((i=n.exec(e))!==null){let a=e.slice(r,i.index);t.push(a.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let o=i[1],l=i[2],c=i[3];l=l.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),t.push(o+l+c),r=i.index+i[0].length}let s=e.slice(r);return t.push(s.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),t.join("").trim()}function ZA(e){let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return`"${Math.abs(t).toString(36)}"`}function QA(e,t,r,n){if(r?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(t))return!0;return n.some((i)=>{if(i instanceof RegExp)return i.test(e);return i.endsWith("/")?e===i.slice(0,-1)||e.startsWith(i):e===i})}function XA(e,t){return`<?xml version="1.0" encoding="UTF-8"?>
15336
15336
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
15337
15337
  ${e.map((r)=>{let n=new URL(r.loc,t).href,i=` <url>
15338
- <loc>${Ue(n)}</loc>`;if(r.lastmod)i+=`
15338
+ <loc>${Ge(n)}</loc>`;if(r.lastmod)i+=`
15339
15339
  <lastmod>${r.lastmod}</lastmod>`;if(r.changefreq)i+=`
15340
15340
  <changefreq>${r.changefreq}</changefreq>`;if(r.priority!==void 0)i+=`
15341
15341
  <priority>${r.priority}</priority>`;return i+=`
15342
15342
  </url>`,i}).join(`
15343
15343
  `)}
15344
- </urlset>`}function Ue(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function XA(e,t){let r=t.map((n)=>{let i=" <item>";if(i+=`
15345
- <title>${Ue(n.title)}</title>`,i+=`
15346
- <link>${Ue(n.link)}</link>`,n.description)i+=`
15347
- <description>${Ue(n.description)}</description>`;if(n.pubDate)i+=`
15344
+ </urlset>`}function Ge(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function eC(e,t){let r=t.map((n)=>{let i=" <item>";if(i+=`
15345
+ <title>${Ge(n.title)}</title>`,i+=`
15346
+ <link>${Ge(n.link)}</link>`,n.description)i+=`
15347
+ <description>${Ge(n.description)}</description>`;if(n.pubDate)i+=`
15348
15348
  <pubDate>${n.pubDate.toUTCString()}</pubDate>`;if(n.author)i+=`
15349
- <author>${Ue(n.author)}</author>`;if(n.categories)for(let s of n.categories)i+=`
15350
- <category>${Ue(s)}</category>`;if(n.guid)i+=`
15351
- <guid>${Ue(n.guid)}</guid>`;return i+=`
15349
+ <author>${Ge(n.author)}</author>`;if(n.categories)for(let s of n.categories)i+=`
15350
+ <category>${Ge(s)}</category>`;if(n.guid)i+=`
15351
+ <guid>${Ge(n.guid)}</guid>`;return i+=`
15352
15352
  </item>`,i});return`<?xml version="1.0" encoding="UTF-8"?>
15353
15353
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
15354
15354
  <channel>
15355
- <title>${Ue(e.title)}</title>
15356
- <link>${Ue(e.link)}</link>
15357
- <description>${Ue(e.description)}</description>
15355
+ <title>${Ge(e.title)}</title>
15356
+ <link>${Ge(e.link)}</link>
15357
+ <description>${Ge(e.description)}</description>
15358
15358
  ${e.language?`<language>${e.language}</language>`:""}
15359
- ${e.copyright?`<copyright>${Ue(e.copyright)}</copyright>`:""}
15359
+ ${e.copyright?`<copyright>${Ge(e.copyright)}</copyright>`:""}
15360
15360
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
15361
15361
  <atom:link href="${e.link}/rss.xml" rel="self" type="application/rss+xml"/>
15362
15362
  ${r.join(`
15363
15363
  `)}
15364
15364
  </channel>
15365
- </rss>`}async function eC(e={}){let t=Date.now(),r=await Xt(),n=await qA({explicit:e.domain,stxConfig:r});if(n.source==="fallback"&&(e.sitemap??!0))console.warn(WA());let i={pagesDir:e.pagesDir||"pages",outputDir:e.outputDir||"dist",baseUrl:e.baseUrl||"/",domain:n.url,revalidate:e.revalidate??!1,sitemap:e.sitemap??!0,sitemapExclude:e.sitemapExclude||[],robots:e.robots??!0,rss:e.rss??!1,concurrency:e.concurrency||10,cache:e.cache??!0,cacheDir:e.cacheDir||Er(process.cwd(),"ssg-cache"),contentLoaders:e.contentLoaders||[],hooks:e.hooks||{},minify:e.minify??!1,generate404:e.generate404??!0,publicDir:e.publicDir||"public",trailingSlash:e.trailingSlash??!1,cleanOutput:e.cleanOutput??!0,partialsDir:e.partialsDir||r?.partialsDir||"",componentsDir:e.componentsDir||r?.componentsDir||"",failOnIncludeError:e.failOnIncludeError??!0,chunkIslands:e.chunkIslands===!0,prefetchIslands:e.prefetchIslands===!0,integrityIslands:e.integrityIslands===!0},s={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},a=new Set,o=0,l={},c={};await i.hooks.onBuildStart?.();try{if(i.cleanOutput&&de.existsSync(i.outputDir))await de.promises.rm(i.outputDir,{recursive:!0});await de.promises.mkdir(i.outputDir,{recursive:!0});let d=new Ag(i.cacheDir);if(i.cache)await d.load();try{let{generateCrosswindCSS:x}=await Promise.resolve().then(()=>(Bo(),qf));await x('<div class="bg-black"></div>')}catch{}eu();let h=r?.routeMiddleware?.dir||"middleware";await ru(process.cwd(),h);let p=tu();if(p.length>0)console.log(`Loaded ${p.length} middleware: ${p.join(", ")}`);let f=r?.routeMiddleware?.global||[];MA(r?.layoutsDir,Er(process.cwd()));let m=Aa(".",{pagesDir:i.pagesDir});console.log(`Found ${m.length} routes`);let y=[];for(let x of m){let _=await UA(x);for(let E of _)y.push({route:x,url:E.url,params:E.params,props:E.props,revalidate:E.revalidate??i.revalidate})}s.totalPages=y.length,console.log(`Generating ${s.totalPages} pages...`);let g=[],v=[];for(let x=0;x<y.length;x+=i.concurrency)v.push(y.slice(x,x+i.concurrency));for(let x of v)await Promise.all(x.map(async(_)=>{let{route:E,url:k,params:A,props:T,revalidate:C}=_;try{await i.hooks.onPageStart?.(k);let D=await Bun.file(E.filePath).text(),I=iC(D),O=I?.middleware?Array.isArray(I.middleware)?I.middleware:[I.middleware]:[],L=[...f,...O];if(L.length>0){let ae=nu(k,A,I||{}),ye=iu(ae,null,void 0,{isServer:!0}),z=await su(L,ye);if(z.redirect){let G=typeof z.redirect==="string"?z.redirect:z.redirect.path||z.redirect,ve=sC(String(G),k),Ie=aC(k,i);await de.promises.mkdir(ee.dirname(Ie),{recursive:!0}),await Bun.write(Ie,ve),s.successCount++,s.pages.push({route:k,outputPath:Ie,size:Buffer.byteLength(ve),cached:!1}),g.push({loc:k,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${k} \u2192 redirect to ${G}`);return}if(z.abort){let G=typeof z.abort==="string"?z.abort:z.abort?.error?.message||"aborted";console.warn(` \u21B3 ${k} \u2014 middleware aborted: ${G}`);return}}let N=D.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(N)try{if(!await Function("route",`
15366
- const validate = ${N[1]};
15365
+ </rss>`}async function tC(e={}){let t=Date.now(),r=await er(),n=await WA({explicit:e.domain,stxConfig:r});if(n.source==="fallback"&&(e.sitemap??!0))console.warn(HA());let i={pagesDir:e.pagesDir||"pages",outputDir:e.outputDir||"dist",baseUrl:e.baseUrl||"/",domain:n.url,revalidate:e.revalidate??!1,sitemap:e.sitemap??!0,sitemapExclude:e.sitemapExclude||[],robots:e.robots??!0,rss:e.rss??!1,concurrency:e.concurrency||10,cache:e.cache??!0,cacheDir:e.cacheDir||Ar(process.cwd(),"ssg-cache"),contentLoaders:e.contentLoaders||[],hooks:e.hooks||{},minify:e.minify??!1,generate404:e.generate404??!0,publicDir:e.publicDir||"public",trailingSlash:e.trailingSlash??!1,cleanOutput:e.cleanOutput??!0,partialsDir:e.partialsDir||r?.partialsDir||"",componentsDir:e.componentsDir||r?.componentsDir||"",failOnIncludeError:e.failOnIncludeError??!0,chunkIslands:e.chunkIslands===!0,prefetchIslands:e.prefetchIslands===!0,integrityIslands:e.integrityIslands===!0},s={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},a=new Set,o=0,l={},c={};await i.hooks.onBuildStart?.();try{if(i.cleanOutput&&pe.existsSync(i.outputDir))await pe.promises.rm(i.outputDir,{recursive:!0});await pe.promises.mkdir(i.outputDir,{recursive:!0});let d=new Cg(i.cacheDir);if(i.cache)await d.load();try{let{generateCrosswindCSS:x}=await Promise.resolve().then(()=>(zo(),Wf));await x('<div class="bg-black"></div>')}catch{}tu();let h=r?.routeMiddleware?.dir||"middleware";await nu(process.cwd(),h);let p=ru();if(p.length>0)console.log(`Loaded ${p.length} middleware: ${p.join(", ")}`);let f=r?.routeMiddleware?.global||[];BA(r?.layoutsDir,Ar(process.cwd()));let m=Ca(".",{pagesDir:i.pagesDir});console.log(`Found ${m.length} routes`);let y=[];for(let x of m){let _=await GA(x);for(let E of _)y.push({route:x,url:E.url,params:E.params,props:E.props,revalidate:E.revalidate??i.revalidate})}s.totalPages=y.length,console.log(`Generating ${s.totalPages} pages...`);let g=[],v=[];for(let x=0;x<y.length;x+=i.concurrency)v.push(y.slice(x,x+i.concurrency));for(let x of v)await Promise.all(x.map(async(_)=>{let{route:E,url:k,params:A,props:T,revalidate:C}=_;try{await i.hooks.onPageStart?.(k);let D=await Bun.file(E.filePath).text(),I=sC(D),O=I?.middleware?Array.isArray(I.middleware)?I.middleware:[I.middleware]:[],N=[...f,...O];if(N.length>0){let oe=iu(k,A,I||{}),ve=su(oe,null,void 0,{isServer:!0}),F=await au(N,ve);if(F.redirect){let V=typeof F.redirect==="string"?F.redirect:F.redirect.path||F.redirect,we=aC(String(V),k),Oe=oC(k,i);await pe.promises.mkdir(te.dirname(Oe),{recursive:!0}),await Bun.write(Oe,we),s.successCount++,s.pages.push({route:k,outputPath:Oe,size:Buffer.byteLength(we),cached:!1}),g.push({loc:k,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${k} \u2192 redirect to ${V}`);return}if(F.abort){let V=typeof F.abort==="string"?F.abort:F.abort?.error?.message||"aborted";console.warn(` \u21B3 ${k} \u2014 middleware aborted: ${V}`);return}}let P=D.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(P)try{if(!await Function("route",`
15366
+ const validate = ${P[1]};
15367
15367
  return validate(route);
15368
- `)({params:A})){console.warn(`Validation failed for ${k}, skipping...`);return}}catch{}let B=null,F=!1;if(i.cache){if(B=d.get(k,E.filePath),B)F=!0,s.cachedCount++}if(!B){let ae=await Tg(E,A,T,i,r);if(B=ae.html,i.failOnIncludeError&&ae.includeFailures.length>0)throw Error(`${ae.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15369
- ${ae.includeFailures.join(`
15368
+ `)({params:A})){console.warn(`Validation failed for ${k}, skipping...`);return}}catch{}let z=null,q=!1;if(i.cache){if(z=d.get(k,E.filePath),z)q=!0,s.cachedCount++}if(!z){let oe=await Rg(E,A,T,i,r);if(z=oe.html,i.failOnIncludeError&&oe.includeFailures.length>0)throw Error(`${oe.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15369
+ ${oe.includeFailures.join(`
15370
15370
  `)}
15371
- Set ssg.failOnIncludeError to false to build anyway.`);if(i.cache)d.set(k,E.filePath,ae.dependencies,B)}let K;if(i.trailingSlash)K=ee.join(i.outputDir,k,"index.html");else K=k==="/"?ee.join(i.outputDir,"index.html"):ee.join(i.outputDir,`${k}.html`);if(i.chunkIslands){let{html:ae,chunks:ye}=jA(B,{integrity:i.integrityIslands,minify:i.minify});if(ye.length>0){let z=ee.join(i.outputDir,"_stx","islands");await de.promises.mkdir(z,{recursive:!0});for(let G of ye){let ve=ee.join(z,`${G.hash}.js`);if(!await Bun.file(ve).exists())await Bun.write(ve,G.code);if(!a.has(G.hash)){a.add(G.hash);let Ie=Buffer.byteLength(G.code,"utf8");o+=Ie,l[G.hash]={bytes:Ie,file:`/_stx/islands/${G.hash}.js`}}}if(c[k]=ye.map((G)=>G.hash),B=ae,i.prefetchIslands)B=$A(B)}}if(await de.promises.mkdir(ee.dirname(K),{recursive:!0}),await Bun.write(K,B),!ZA(k,B,I,i.sitemapExclude))g.push({loc:k,lastmod:new Date().toISOString().split("T")[0],priority:k==="/"?1:0.8});let Te={route:k,outputPath:K,size:Buffer.byteLength(B,"utf8"),cached:F};if(C!==!1)Te.revalidateAt=Date.now()+C*1000;s.pages.push(Te),s.successCount++,await i.hooks.onPageEnd?.(k,B)}catch(D){s.failedCount++,s.errors.push({route:k,error:D}),await i.hooks.onError?.(D,k),console.error(`Error generating ${k}:`,D)}}));if(i.cache)await d.save();if(i.generate404){let x=ee.join(i.pagesDir,"404.stx");if(await Bun.file(x).exists()){let _=new Set,E={...r,debug:!1,cache:!1},k=await me(await Bun.file(x).text(),{},x,E,_);await Bun.write(ee.join(i.outputDir,"404.html"),k)}else await Bun.write(ee.join(i.outputDir,"404.html"),`<!DOCTYPE html>
15371
+ Set ssg.failOnIncludeError to false to build anyway.`);if(i.cache)d.set(k,E.filePath,oe.dependencies,z)}let Z;if(i.trailingSlash)Z=te.join(i.outputDir,k,"index.html");else Z=k==="/"?te.join(i.outputDir,"index.html"):te.join(i.outputDir,`${k}.html`);if(i.chunkIslands){let{html:oe,chunks:ve}=DA(z,{integrity:i.integrityIslands,minify:i.minify});if(ve.length>0){let F=te.join(i.outputDir,"_stx","islands");await pe.promises.mkdir(F,{recursive:!0});for(let V of ve){let we=te.join(F,`${V.hash}.js`);if(!await Bun.file(we).exists())await Bun.write(we,V.code);if(!a.has(V.hash)){a.add(V.hash);let Oe=Buffer.byteLength(V.code,"utf8");o+=Oe,l[V.hash]={bytes:Oe,file:`/_stx/islands/${V.hash}.js`}}}if(c[k]=ve.map((V)=>V.hash),z=oe,i.prefetchIslands)z=LA(z)}}if(await pe.promises.mkdir(te.dirname(Z),{recursive:!0}),await Bun.write(Z,z),!QA(k,z,I,i.sitemapExclude))g.push({loc:k,lastmod:new Date().toISOString().split("T")[0],priority:k==="/"?1:0.8});let Re={route:k,outputPath:Z,size:Buffer.byteLength(z,"utf8"),cached:q};if(C!==!1)Re.revalidateAt=Date.now()+C*1000;s.pages.push(Re),s.successCount++,await i.hooks.onPageEnd?.(k,z)}catch(D){s.failedCount++,s.errors.push({route:k,error:D}),await i.hooks.onError?.(D,k),console.error(`Error generating ${k}:`,D)}}));if(i.cache)await d.save();if(i.generate404){let x=te.join(i.pagesDir,"404.stx");if(await Bun.file(x).exists()){let _=new Set,E={...r,debug:!1,cache:!1},k=await ge(await Bun.file(x).text(),{},x,E,_);await Bun.write(te.join(i.outputDir,"404.html"),k)}else await Bun.write(te.join(i.outputDir,"404.html"),`<!DOCTYPE html>
15372
15372
  <html lang="en">
15373
15373
  <head>
15374
15374
  <meta charset="UTF-8">
@@ -15389,7 +15389,7 @@ Set ssg.failOnIncludeError to false to build anyway.`);if(i.cache)d.set(k,E.file
15389
15389
  <a href="/">Go home</a>
15390
15390
  </div>
15391
15391
  </body>
15392
- </html>`)}for(let x of[500]){let _=ee.join(i.pagesDir,`${x}.stx`);if(await Bun.file(_).exists()){let E=new Set,k={...r,debug:!1,cache:!1},A=await me(await Bun.file(_).text(),{},_,k,E);await Bun.write(ee.join(i.outputDir,`${x}.html`),A)}}let w=ee.join(i.pagesDir,"error.stx");if(await Bun.file(w).exists()){let x=new Set,_={...r,debug:!1,cache:!1},E=await me(await Bun.file(w).text(),{},w,_,x);await Bun.write(ee.join(i.outputDir,"error.html"),E)}if(i.sitemap&&g.length>0){let x=QA(g,i.domain),_=ee.join(i.outputDir,"sitemap.xml");await Bun.write(_,x),s.sitemapPath=_,console.log(`Generated sitemap.xml with ${g.length} URLs`)}if(i.robots!==!1){let x=typeof i.robots==="object"?i.robots:{},_=[...i.sitemapExclude.filter((k)=>typeof k==="string"),...x.disallow||[]],E=tx({rules:[{userAgent:x.userAgent||"*",allow:x.allow||["/"],..._.length>0?{disallow:_}:{}}],...x.sitemap!==!1&&s.sitemapPath?{sitemap:new URL("/sitemap.xml",i.domain).href}:{}});await Bun.write(ee.join(i.outputDir,"robots.txt"),E),console.log("Generated robots.txt")}if(i.rss){let x=typeof i.rss==="object"?i.rss:{title:"Site Feed",description:"Latest updates",link:i.domain},_=[];if(x.getItems)_=await x.getItems();let E=XA(x,_),k=ee.join(i.outputDir,"rss.xml");await Bun.write(k,E),s.rssPath=k,console.log(`Generated rss.xml with ${_.length} items`)}let b=CA(i.outputDir);if(b.assets>0)console.log(`Externalized ${b.assets} asset(s) from ${b.pages} page(s) (${(b.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(i.publicDir&&de.existsSync(i.publicDir))await xa(i.publicDir,i.outputDir),console.log(`Copied public assets from ${i.publicDir}`);let S=SA();if(S)await xa(S,ee.join(i.outputDir,xA)),console.log(`Copied assets from ${_g}`)}catch(d){throw await i.hooks.onError?.(d),d}if(s.buildTime=Date.now()-t,a.size>0){s.islandChunks={count:a.size,totalBytes:o};let d={generatedChunks:a.size,totalBytes:o,chunks:l,pages:c};await Bun.write(ee.join(i.outputDir,"_stx","islands-manifest.json"),JSON.stringify(d,null,2))}await i.hooks.onBuildEnd?.(s);let u=s.islandChunks?`
15392
+ </html>`)}for(let x of[500]){let _=te.join(i.pagesDir,`${x}.stx`);if(await Bun.file(_).exists()){let E=new Set,k={...r,debug:!1,cache:!1},A=await ge(await Bun.file(_).text(),{},_,k,E);await Bun.write(te.join(i.outputDir,`${x}.html`),A)}}let w=te.join(i.pagesDir,"error.stx");if(await Bun.file(w).exists()){let x=new Set,_={...r,debug:!1,cache:!1},E=await ge(await Bun.file(w).text(),{},w,_,x);await Bun.write(te.join(i.outputDir,"error.html"),E)}if(i.sitemap&&g.length>0){let x=XA(g,i.domain),_=te.join(i.outputDir,"sitemap.xml");await Bun.write(_,x),s.sitemapPath=_,console.log(`Generated sitemap.xml with ${g.length} URLs`)}if(i.robots!==!1){let x=typeof i.robots==="object"?i.robots:{},_=[...i.sitemapExclude.filter((k)=>typeof k==="string"),...x.disallow||[]],E=r0({rules:[{userAgent:x.userAgent||"*",allow:x.allow||["/"],..._.length>0?{disallow:_}:{}}],...x.sitemap!==!1&&s.sitemapPath?{sitemap:new URL("/sitemap.xml",i.domain).href}:{}});await Bun.write(te.join(i.outputDir,"robots.txt"),E),console.log("Generated robots.txt")}if(i.rss){let x=typeof i.rss==="object"?i.rss:{title:"Site Feed",description:"Latest updates",link:i.domain},_=[];if(x.getItems)_=await x.getItems();let E=eC(x,_),k=te.join(i.outputDir,"rss.xml");await Bun.write(k,E),s.rssPath=k,console.log(`Generated rss.xml with ${_.length} items`)}let b=TA(i.outputDir);if(b.assets>0)console.log(`Externalized ${b.assets} asset(s) from ${b.pages} page(s) (${(b.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(i.publicDir&&pe.existsSync(i.publicDir))await Sa(i.publicDir,i.outputDir),console.log(`Copied public assets from ${i.publicDir}`);let S=_A();if(S)await Sa(S,te.join(i.outputDir,SA)),console.log(`Copied assets from ${kg}`)}catch(d){throw await i.hooks.onError?.(d),d}if(s.buildTime=Date.now()-t,a.size>0){s.islandChunks={count:a.size,totalBytes:o};let d={generatedChunks:a.size,totalBytes:o,chunks:l,pages:c};await Bun.write(te.join(i.outputDir,"_stx","islands-manifest.json"),JSON.stringify(d,null,2))}await i.hooks.onBuildEnd?.(s);let u=s.islandChunks?`
15393
15393
  Island chunks: ${s.islandChunks.count} (${(s.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
15394
15394
  Build complete!
15395
15395
  Total: ${s.totalPages} pages
@@ -15397,8 +15397,8 @@ Build complete!
15397
15397
  Cached: ${s.cachedCount}
15398
15398
  Failed: ${s.failedCount}
15399
15399
  Time: ${s.buildTime}ms${u}
15400
- `),s}async function xa(e,t){await de.promises.mkdir(t,{recursive:!0});let r=await de.promises.readdir(e,{withFileTypes:!0});for(let n of r){let i=ee.join(e,n.name),s=ee.join(t,n.name);if(n.isDirectory())await de.promises.mkdir(s,{recursive:!0}),await xa(i,s);else await de.promises.copyFile(i,s)}}function tC(e={}){let t=e.cacheDir||Er(process.cwd(),"ssg-cache"),r=new Cg(t),n=e.revalidate||3600;return{async get(i){let s=await r.get(i);if(!s)return null;if(Date.now()>s.revalidateAfter)this.revalidate(i).catch(console.error);return{html:s.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:s.etag,"X-ISR-Generated":new Date(s.generatedAt).toISOString(),...s.headers}}},async revalidate(i){let s=Aa(".",{pagesDir:e.pagesDir||"pages"}).find((u)=>{return i.match(u.regex)!==null});if(!s){console.warn(`Route not found for revalidation: ${i}`);return}let a=i.match(s.regex),o={};if(a)s.params.forEach((u,d)=>{o[u]=a[d+1]});let l=await Xt(),{html:c}=await Tg(s,o,{},e,l);await r.set(i,{html:c,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:KA(c)}),console.log(`Revalidated: ${i}`)},async invalidate(i){if(typeof i==="string")await r.invalidate(i);else await r.invalidatePattern(i)}}}function rC(e){return async()=>{return{paths:await e(),fallback:!1}}}function nC(){return{name:"markdown",extensions:[".md",".mdx"],async load(e){let t=await Bun.file(e).text(),r=t.match(/^---\n([\s\S]*?)\n---/),n={},i=t;if(r){let c=r[1];i=t.slice(r[0].length).trim();for(let u of c.split(`
15401
- `)){let d=u.indexOf(":");if(d>0){let h=u.slice(0,d).trim(),p=u.slice(d+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((f)=>f.trim().replace(/^['"]|['"]$/g,""));n[h]=p}}}let s=i.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),a=[],o=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,l;while((l=o.exec(s))!==null){let c=parseInt(l[1],10),u=l[2],d=u.toLowerCase().replace(/[^a-z0-9]+/g,"-");a.push({id:d,text:u,level:c})}return{content:s,data:n,toc:a}}}}function iC(e){return Jf(e)}function sC(e,t){return`<!DOCTYPE html>
15400
+ `),s}async function Sa(e,t){await pe.promises.mkdir(t,{recursive:!0});let r=await pe.promises.readdir(e,{withFileTypes:!0});for(let n of r){let i=te.join(e,n.name),s=te.join(t,n.name);if(n.isDirectory())await pe.promises.mkdir(s,{recursive:!0}),await Sa(i,s);else await pe.promises.copyFile(i,s)}}function rC(e={}){let t=e.cacheDir||Ar(process.cwd(),"ssg-cache"),r=new Tg(t),n=e.revalidate||3600;return{async get(i){let s=await r.get(i);if(!s)return null;if(Date.now()>s.revalidateAfter)this.revalidate(i).catch(console.error);return{html:s.html,headers:{"Cache-Control":`public, max-age=${n}, stale-while-revalidate=${n*2}`,ETag:s.etag,"X-ISR-Generated":new Date(s.generatedAt).toISOString(),...s.headers}}},async revalidate(i){let s=Ca(".",{pagesDir:e.pagesDir||"pages"}).find((u)=>i.match(u.regex)!==null);if(!s){console.warn(`Route not found for revalidation: ${i}`);return}let a=i.match(s.regex),o={};if(a)s.params.forEach((u,d)=>{o[u]=a[d+1]});let l=await er(),{html:c}=await Rg(s,o,{},e,l);await r.set(i,{html:c,generatedAt:Date.now(),revalidateAfter:Date.now()+n*1000,etag:ZA(c)}),console.log(`Revalidated: ${i}`)},async invalidate(i){if(typeof i==="string")await r.invalidate(i);else await r.invalidatePattern(i)}}}function nC(e){return async()=>({paths:await e(),fallback:!1})}function iC(){return{name:"markdown",extensions:[".md",".mdx"],async load(e){let t=await Bun.file(e).text(),r=t.match(/^---\n([\s\S]*?)\n---/),n={},i=t;if(r){let c=r[1];i=t.slice(r[0].length).trim();for(let u of c.split(`
15401
+ `)){let d=u.indexOf(":");if(d>0){let h=u.slice(0,d).trim(),p=u.slice(d+1).trim();if(p==="true")p=!0;else if(p==="false")p=!1;else if(/^\d+$/.test(p))p=parseInt(p,10);else if(/^\d+\.\d+$/.test(p))p=parseFloat(p);else if(p.startsWith("[")&&p.endsWith("]"))p=p.slice(1,-1).split(",").map((f)=>f.trim().replace(/^['"]|['"]$/g,""));n[h]=p}}}let s=i.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),a=[],o=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,l;while((l=o.exec(s))!==null){let c=parseInt(l[1],10),u=l[2],d=u.toLowerCase().replace(/[^a-z0-9]+/g,"-");a.push({id:d,text:u,level:c})}return{content:s,data:n,toc:a}}}}function sC(e){return Yf(e)}function aC(e,t){return`<!DOCTYPE html>
15402
15402
  <html>
15403
15403
  <head>
15404
15404
  <meta charset="utf-8">
@@ -15410,4 +15410,4 @@ Build complete!
15410
15410
  <p>Redirecting to <a href="${e}">${e}</a>...</p>
15411
15411
  <script>window.location.replace('${e}')</script>
15412
15412
  </body>
15413
- </html>`}function aC(e,t){if(e==="/"||e==="")return ee.join(t.outputDir,"index.html");let r=e.replace(/^\/|\/$/g,"");if(t.trailingSlash)return ee.join(t.outputDir,r,"index.html");return ee.join(t.outputDir,`${r}.html`)}var TT={generateStaticSite:eC,createISRHandler:tC,defineStaticPaths:rC,createMarkdownLoader:nC};export{ZA as isExcludedFromSitemap,eC as generateStaticSite,rC as defineStaticPaths,TT as default,JA as declaresPageAction,nC as createMarkdownLoader,tC as createISRHandler};
15413
+ </html>`}function oC(e,t){if(e==="/"||e==="")return te.join(t.outputDir,"index.html");let r=e.replace(/^\/|\/$/g,"");if(t.trailingSlash)return te.join(t.outputDir,r,"index.html");return te.join(t.outputDir,`${r}.html`)}var R2={generateStaticSite:tC,createISRHandler:rC,defineStaticPaths:nC,createMarkdownLoader:iC};export{rC as createISRHandler,iC as createMarkdownLoader,YA as declaresPageAction,R2 as default,nC as defineStaticPaths,tC as generateStaticSite,QA as isExcludedFromSitemap};