@stacksjs/stx 0.2.675 → 0.2.677

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 (111) hide show
  1. package/dist/{chunk-4x5dk7a4.js → chunk-01cx2p82.js} +1 -1
  2. package/dist/chunk-08d4wb3x.js +2 -0
  3. package/dist/{chunk-nw44qq6h.js → chunk-0rpr2aax.js} +1 -1
  4. package/dist/{chunk-xayfz35c.js → chunk-0wmcs0w3.js} +1 -1
  5. package/dist/{chunk-8md2707p.js → chunk-1nrz39tr.js} +13 -13
  6. package/dist/{chunk-6qh2mx6q.js → chunk-2t51tpkc.js} +2 -2
  7. package/dist/{chunk-n615cbxq.js → chunk-3bfegbpw.js} +1 -1
  8. package/dist/{chunk-shft9r9d.js → chunk-3rde002j.js} +1 -1
  9. package/dist/{chunk-t9bsgbwv.js → chunk-4tn437tn.js} +2 -2
  10. package/dist/{chunk-z6mrnh98.js → chunk-54zkkxmb.js} +1 -1
  11. package/dist/{chunk-7q699phs.js → chunk-569s7hg6.js} +1 -1
  12. package/dist/{chunk-8an7vcxx.js → chunk-69qhykgz.js} +1 -1
  13. package/dist/{chunk-3vwkyjan.js → chunk-7dnpjrqp.js} +12 -12
  14. package/dist/{chunk-09gchq7d.js → chunk-8aq07a1j.js} +3 -3
  15. package/dist/chunk-8z8w9rxc.js +2 -0
  16. package/dist/{chunk-1s2y6f4b.js → chunk-909ymsjz.js} +1 -1
  17. package/dist/{chunk-5zvrbms2.js → chunk-a2zb5fgg.js} +2 -2
  18. package/dist/chunk-adyseb6y.js +2 -0
  19. package/dist/{chunk-54fazdmn.js → chunk-aypmc7qg.js} +1 -1
  20. package/dist/{chunk-9azagdq6.js → chunk-b4709e09.js} +13 -13
  21. package/dist/chunk-bm42rsaa.js +2 -0
  22. package/dist/chunk-br3cde1t.js +2 -0
  23. package/dist/chunk-cep5ba7w.js +2 -0
  24. package/dist/{chunk-29wj0c68.js → chunk-dckjv2vk.js} +2 -2
  25. package/dist/{chunk-03hhanvm.js → chunk-dx037j0p.js} +1 -1
  26. package/dist/{chunk-dba795e1.js → chunk-dxh45gve.js} +1 -1
  27. package/dist/chunk-dzbn56tx.js +2 -0
  28. package/dist/chunk-e0fhfnee.js +2 -0
  29. package/dist/{chunk-g98gafg7.js → chunk-efpd1yyg.js} +1 -1
  30. package/dist/{chunk-etbpzmxv.js → chunk-fjtffqf9.js} +1 -1
  31. package/dist/{chunk-zwkc8yge.js → chunk-fka2073f.js} +48 -48
  32. package/dist/chunk-fp3a3gmr.js +2 -0
  33. package/dist/{chunk-nv0jjhtd.js → chunk-ft3f9nj0.js} +1 -1
  34. package/dist/{chunk-ggf4z3bv.js → chunk-ga5kjf9b.js} +3 -3
  35. package/dist/{chunk-z4bfgvb3.js → chunk-gjdpdvw5.js} +3 -3
  36. package/dist/{chunk-8xxc5edr.js → chunk-hejx7gbs.js} +1 -1
  37. package/dist/{chunk-xtnxvmdb.js → chunk-hg9dxba9.js} +1 -1
  38. package/dist/{chunk-4e5jrxbn.js → chunk-hh2dcnsx.js} +5 -5
  39. package/dist/{chunk-w0vpvcj0.js → chunk-hkfabb1e.js} +1 -1
  40. package/dist/chunk-hqj28381.js +3 -0
  41. package/dist/chunk-j9pwgyf1.js +2 -0
  42. package/dist/{chunk-7475sm3m.js → chunk-je8t9yka.js} +1 -1
  43. package/dist/chunk-jkw89s1t.js +2 -0
  44. package/dist/{chunk-hfbkbrwk.js → chunk-k65zz7t3.js} +3 -3
  45. package/dist/chunk-kas6xn08.js +2 -0
  46. package/dist/{chunk-wtvy9r5w.js → chunk-kxj8e1gd.js} +3 -3
  47. package/dist/{chunk-ram7pa4k.js → chunk-m46bj8c8.js} +2 -2
  48. package/dist/{chunk-gc4w2s5n.js → chunk-mgk7bwb3.js} +2 -2
  49. package/dist/{chunk-hz8dj5jy.js → chunk-mhacarm5.js} +2 -2
  50. package/dist/{chunk-xrrx2ddz.js → chunk-mjsebtg6.js} +1 -1
  51. package/dist/{chunk-81rdyz2n.js → chunk-mzcf1dr1.js} +1 -1
  52. package/dist/{chunk-p6g58hwg.js → chunk-n1d2t5h4.js} +1 -1
  53. package/dist/{chunk-2xv29pfj.js → chunk-n46pv8kp.js} +1 -1
  54. package/dist/{chunk-z17sy8g3.js → chunk-n8wvqnfc.js} +2 -2
  55. package/dist/{chunk-9ybjsfyp.js → chunk-p9az13b2.js} +2 -2
  56. package/dist/{chunk-hg0dd64a.js → chunk-phdd7jxx.js} +1 -1
  57. package/dist/{chunk-c2rq9pap.js → chunk-qjv5tjmy.js} +1 -1
  58. package/dist/{chunk-kzb04293.js → chunk-qwdcts9w.js} +3 -3
  59. package/dist/chunk-r16n5dc4.js +2 -0
  60. package/dist/chunk-r1v1496g.js +2 -0
  61. package/dist/{chunk-q7tfqavs.js → chunk-r9p7r6mx.js} +2 -2
  62. package/dist/chunk-rc79yyqx.js +2 -0
  63. package/dist/chunk-reqdy80m.js +2 -0
  64. package/dist/{chunk-db5017x8.js → chunk-rza3yydb.js} +1 -1
  65. package/dist/{chunk-qdkwg2b8.js → chunk-scgn8dmx.js} +2 -2
  66. package/dist/{chunk-ammn4wbd.js → chunk-sqv40sqk.js} +1 -1
  67. package/dist/chunk-tjqyhgh2.js +2 -0
  68. package/dist/{chunk-j6x7ryyn.js → chunk-tmqrbs98.js} +22 -11
  69. package/dist/{chunk-8jdbrcgt.js → chunk-tqc86aaw.js} +5 -5
  70. package/dist/{chunk-mvz825w0.js → chunk-vdsf1yrt.js} +1 -1
  71. package/dist/{chunk-93z9f2be.js → chunk-wbz32ffd.js} +6 -6
  72. package/dist/{chunk-0thxpgtp.js → chunk-wkkmk4aa.js} +1 -1
  73. package/dist/{chunk-xdn6rtq2.js → chunk-wwgh5ae7.js} +1 -1
  74. package/dist/{chunk-6ncvb8gp.js → chunk-x5sjsf3b.js} +3 -3
  75. package/dist/{chunk-nvbyscdh.js → chunk-x5v3rqbn.js} +1 -1
  76. package/dist/{chunk-e4ezpevb.js → chunk-xnx06qqt.js} +1 -1
  77. package/dist/{chunk-yaccg2c0.js → chunk-y34tyrpb.js} +1 -1
  78. package/dist/chunk-yaej3mgj.js +2 -0
  79. package/dist/chunk-zbp10hjz.js +2 -0
  80. package/dist/{chunk-vf6yaymh.js → chunk-zeyfefpc.js} +1 -1
  81. package/dist/chunk-ztebv7c0.js +2 -0
  82. package/dist/{chunk-5fh9m8fm.js → chunk-zvr3r5p0.js} +1 -1
  83. package/dist/cli.js +8 -8
  84. package/dist/client/signals-for-runtime.js +16 -5
  85. package/dist/craft-entry.js +2 -2
  86. package/dist/craft.js +2 -2
  87. package/dist/desktop.d.ts +5 -0
  88. package/dist/pwa.js +1 -1
  89. package/dist/ssg.js +4 -4
  90. package/package.json +3 -3
  91. package/dist/chunk-1wdawkn8.js +0 -2
  92. package/dist/chunk-41q5rww8.js +0 -2
  93. package/dist/chunk-4c5tk71j.js +0 -2
  94. package/dist/chunk-57ege36s.js +0 -2
  95. package/dist/chunk-5n4c99y5.js +0 -2
  96. package/dist/chunk-6rftdp7c.js +0 -2
  97. package/dist/chunk-7s6hypn5.js +0 -2
  98. package/dist/chunk-7ym269yp.js +0 -2
  99. package/dist/chunk-855h3crg.js +0 -2
  100. package/dist/chunk-bpf3xxng.js +0 -3
  101. package/dist/chunk-dasxbb9y.js +0 -2
  102. package/dist/chunk-e02ne8zd.js +0 -2
  103. package/dist/chunk-fqa5ej45.js +0 -2
  104. package/dist/chunk-hz5eh77e.js +0 -2
  105. package/dist/chunk-prc5dxp1.js +0 -2
  106. package/dist/chunk-qwdgx34g.js +0 -2
  107. package/dist/chunk-r6t1712p.js +0 -2
  108. package/dist/chunk-s5q9ztvj.js +0 -2
  109. package/dist/chunk-sfpymq5h.js +0 -2
  110. package/dist/chunk-t8tst3sk.js +0 -2
  111. package/dist/chunk-xh5mh8kn.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{pc,fc}from"./chunk-78yjmbbs.js";import{j,as,cs,ls,Co,Eo,ar,Ie,de,G,ds,oe,K,z,et,lr,Ao,pr,je,n,d,H,mn}from"./chunk-3vwkyjan.js";import{p,E,tt,u}from"./chunk-kzb04293.js";import{ne}from"./chunk-e4ezpevb.js";import{r}from"./chunk-tst8p27s.js";import{f}from"./chunk-b7e07ybq.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import Te from"fs";function Ce(e,t,s){let i=Buffer.alloc(s),o=Te.readSync(e,i,0,s,t);return i.subarray(0,o)}function De(e){if(e.length<25)return!1;let t=(i,o)=>String.fromCharCode(...e.subarray(i,o));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let s=t(12,16);if(s==="VP8X")return(e[20]&16)!==0;if(s==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=Te.openSync(e,"r");let s=Ce(t,0,33);if(s.length>=3&&s[0]===255&&s[1]===216&&s[2]===255)return"none";if(s.length>=26&&s[0]===137&&s.toString("latin1",1,4)==="PNG"){let i=s[25];if(i===4||i===6)return"possible";let o=8;for(let a=0;a<64;a++){let c=Ce(t,o,8);if(c.length<8)return"unknown";let g=c.toString("latin1",4,8);if(g==="tRNS")return"possible";if(g==="IDAT"||g==="IEND")return"none";o+=12+c.readUInt32BE(0)}return"unknown"}if(s.length>=25&&s.toString("latin1",0,4)==="RIFF"&&s.toString("latin1",8,12)==="WEBP"){if(De(s))return"possible";let i=s.toString("latin1",12,16);return i==="VP8 "||i==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)Te.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let s=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(s.protocol==="file:"&&Jt.existsSync(gt(s)))return gt(s)}catch{}try{let s=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return s&&rn(s)?s:void 0}catch{return}}function rn(e,t=process.env){let s=e.replace(/\\/g,"/");if(s.split("/").some((o)=>/@\d[^/]*@@@\d+$/.test(o)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((o)=>!!o).map((o)=>`${o.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((o)=>s.startsWith(o))}var pt=!1;function pe(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return pe("node:worker_threads has no Worker in this runtime");let s=nn();if(!s)return pe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((i,o)=>{let a;try{a=new mt(s)}catch(h){i(pe(`could not start ${s}: ${Le(h)}`));return}let c=!1,g=!1,l=(h)=>{if(g)return;g=!0,h(),a.terminate()};a.on("message",(h)=>{if(h.type==="ready"){c=!0,a.postMessage({task:e,args:t});return}if(h.type==="result"){l(()=>i(h.value));return}let v=Error(h.error?.message??"image worker failed");if(h.error?.name)v.name=h.error.name;if(h.error?.stack)v.stack=h.error.stack;l(()=>o(v))}),a.on("error",(h)=>{l(()=>c?o(h instanceof Error?h:Error(Le(h)||"image worker crashed")):i(pe(`the worker failed before it was ready: ${Le(h)}`)))}),a.on("exit",(h)=>{l(()=>c?o(Error("image worker exited before it finished")):i(pe(`the worker exited with code ${h} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let s=Q.dirname(Bun.resolveSync(e,t));while(s!==Q.dirname(s)){let i=Q.join(s,"package.json");if(ee.existsSync(i)){let o=JSON.parse(ee.readFileSync(i,"utf8"));if(o.name===e)return o.version}s=Q.dirname(s)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let s;try{s=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${s??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=Q.extname(e),s=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),i=Ct("sha256").update(e).digest("hex").slice(0,8);return`${s||"image"}-${i}`}function wt(e,t=`stx:${he}`){let s=(i)=>`${he}/${i.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(i){let o=Q.join(e,i);try{let a=await ee.promises.stat(o);return a.size>0?{bytes:a.size,path:o,url:s(i)}:null}catch{return null}},async write(i,o){let a=Q.join(e,i);await ee.promises.mkdir(Q.dirname(a),{recursive:!0});let c=`${a}.${process.pid}.tmp`;return await ee.promises.writeFile(c,o),await ee.promises.rename(c,a),{bytes:o.byteLength,path:a,url:s(i)}},url:s}}async function Rt(e,t=e){let s=await ee.promises.readdir(t,{withFileTypes:!0});s.sort((o,a)=>o.name.localeCompare(a.name));let i=[];for(let o of s){let a=Q.join(t,o.name);if(o.isDirectory()){i.push(...await Rt(e,a));continue}if(!o.isFile()||!an.has(Q.extname(o.name).toLowerCase()))continue;i.push({absolutePath:a,relativePath:Q.relative(e,a)})}return i}function $t(e,t){return e.map((s)=>({key:gn(s.relativePath),input:s.absolutePath,name:pn(s.relativePath),...hn(s.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Me(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,o])=>o.fallback.format==="png"),s=new Set,i=8;for(let o=0;o<t.length;o+=8)await Promise.all(t.slice(o,o+8).map(async([a,c])=>{let g=c.variants.filter((l)=>l.format==="png").sort((l,h)=>l.width-h.width)[0];try{let l=await sn(new Uint8Array(await ee.promises.readFile(g?.path??c.fallback.path)));if(yn(l.data))s.add(a)}catch{s.add(a)}}));return s}function bn(e,t){let s=[];for(let i of t){let o=e[i],a=o?.variants.filter((g)=>g.format==="webp")??[];if(!o||a.length===0)continue;if(!a.some((g)=>{let l;try{return l=ee.openSync(g.path,"r"),!De(Ce(l,0,32))}catch{return!0}finally{if(l!==void 0)ee.closeSync(l)}}))continue;if(o.variants=o.variants.filter((g)=>g.format!=="webp"),delete o.sources.webp,s.push(i),!vt.has(i))vt.add(i),console.warn(`[stx-images] ${i} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return s}async function vn(e){let t=[],s=8;for(let i=0;i<e.length;i+=8){let o=e.slice(i,i+8),a=await Promise.all(o.map(async(c)=>{try{return await on(c.absolutePath),c}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${c.relativePath}`),null}}));t.push(...a.filter((c)=>c!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),s=JSON.parse(t);return s&&typeof s==="object"?s:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function no(e){let t=At(e);return t?ye().catalog.get(t):void 0}function ro(e){let t=At(e);return t?ye().transparent.has(t):!1}function so(e){let t=(i)=>e.variants.filter((o)=>o.format===i).reduce((o,a)=>o+a.bytes,0),s=t(e.fallback.format);return["avif","webp"].map((i)=>({format:i,srcset:e.sources[i]||"",bytes:t(i)})).filter((i)=>i.srcset&&i.bytes>0&&i.bytes<s).sort((i,o)=>i.bytes-o.bytes).map(({format:i,srcset:o})=>({format:i,srcset:o}))}function gp(e){let t=no(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:so(t).map(({format:s,srcset:i})=>({type:`image/${s}`,srcset:i})),width:t.source.width,height:t.source.height,placeholder:ro(e)?void 0:t.placeholder?.dataUrl}}function zr(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function mp(e,t,s={}){if(!e||!ee.existsSync(e))return zr(),{count:0,fingerprint:""};if(s.offThread){let m=await ze("delivery",{publicDir:e,outputDir:t});if(m!==ke)return Sn(m.state),m.result}let i=await Rt(e);if(i.length===0)return zr(),{count:0,fingerprint:""};let o=wn(t),a=i.filter((m)=>{let b=o[m.relativePath];if(!b)return!0;let w=St(m.absolutePath);return!w||w.mtimeMs!==b.mtimeMs||w.size!==b.size});if(a.length===0)return zr(),{count:0,fingerprint:""};let c=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),g={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},l=a,h;try{h=await yt({...g,entries:$t(a,c)})}catch(m){if(l=await vn(a),l.length===a.length)throw m;let b=new Set(l.map((C)=>C.relativePath)),w=!1;for(let C of a){if(b.has(C.relativePath))continue;let k=St(C.absolutePath);if(!k)continue;o[C.relativePath]=k,w=!0}if(w)$n(t,o);if(l.length===0)return zr(),{count:0,fingerprint:""};h=await yt({...g,entries:$t(l,c)})}let v=await xn(h.entries),y=bn(h.entries,v),S=ye();S.catalog=new Map(Object.entries(h.entries)),S.transparent=v;let x=v.size===0&&y.length===0?h.fingerprint:Ct("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:y.sort()})).digest("hex");return{count:l.length,fingerprint:x}}class kt{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,s,i){let o=Co(e,i);if(o!==void 0)return o;for(let a of Eo(e,t,s,i))if(await n(a))return a;return null}}var le=new kt;function R(e){return H(e)}var se="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function ie(e,t){let s=[];for(let[i,o]of Object.entries(e.static)){if(t.has(i))continue;let a=e.staticNames?.[i]??i;if(typeof o==="boolean"){if(o)s.push(d(a));continue}if(o===se){s.push(d(a));continue}s.push(`${d(a)}="${mn(a,We(String(o)))}"`)}return s}function ae(e,t){let s=[];for(let[i,o]of Object.entries(e.serverDynamic??{})){if(t.has(i))continue;if(o===null||o===void 0||o===!1)continue;let a=e.serverDynamicNames?.[i]??i;if(o===!0){s.push(d(a));continue}if(typeof o==="object")continue;s.push(`${d(a)}="${mn(a,We(String(o)))}"`)}return s}function Rn(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 He={name:"StxLink",aliases:["stx-link"],render(e,t,s){let i=Rn(e),o=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),a=typeof e.static.activeClass==="string"?e.static.activeClass:"active",c=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",g=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,l=[];if(i.reactive)l.push(`:href="${R(i.value)}"`);else l.push(`href="${R(ar(i.value,"navigable"))}"`);if(o)l.push(`class="${R(o)}"`);if(l.push("data-stx-link"),l.push(`data-stx-active-class="${R(a)}"`),l.push(`data-stx-exact-active-class="${R(c)}"`),g)l.push("data-stx-prefetch");let h=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(h)l.push(`data-stx-active-match="${R(h)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return l.push(...ie(e,v)),l.push(...ae(e,v)),`<a ${l.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function J(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let s=e.static[t];if(typeof s==="string")return s;return}function _e(e,t,s=!1){let i=e.serverDynamic[t];if(i!==void 0)return i!==!1&&i!=="false";let o=e.static[t];if(o!==void 0)return o!=="false"&&o!==!1;return s}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),s=[];for(let i of t)if(i.includes(":")){let[o,a]=i.split(":"),c=kn[o];if(c)s.push(`(max-width: ${c}px) ${a}`);else{let g=Number.parseInt(o);if(!Number.isNaN(g))s.push(`(max-width: ${g}px) ${a}`)}}else s.push(i);return s.join(", ")}function Ve(e,t,s,i){return t.map((o)=>`${xe(e,o,void 0,s,i)} ${o}w`).join(", ")}function Pn(e,t,s,i,o){return t.map((a)=>{let c=s?s*a:void 0;return`${xe(e,c,void 0,i,o)} ${a}x`}).join(", ")}function xe(e,t,s,i,o){if(!i||i==="local"||i==="static")return e;if(i==="cloudinary"){let a=[];if(t)a.push(`w_${t}`);if(s)a.push(`h_${s}`);if(o)a.push(`f_${o}`);a.push("q_auto");let c=a.join(",");return e.replace("/upload/",`/upload/${c}/`)}if(i==="imgix"){let a=new URLSearchParams;if(t)a.set("w",String(t));if(s)a.set("h",String(s));if(o)a.set("fm",o);a.set("auto","format");let c=e.includes("?")?"&":"?";return`${e}${c}${a.toString()}`}if(i==="bunny"){let a=new URLSearchParams;if(t)a.set("width",String(t));if(s)a.set("height",String(s));if(o)a.set("format",o);let c=e.includes("?")?"&":"?";return`${e}${c}${a.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,s="#e5e7eb"){let i=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${s}"/></svg>`;return`data:image/svg+xml;base64,${btoa(i)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,s){let i=J(e,"src")||"",o=no(i),a=J(e,"alt")||"",c=J(e,"width")||(o?String(o.source.width):void 0),g=J(e,"height")||(o?String(o.source.height):void 0),l=J(e,"sizes"),h=J(e,"srcset"),v=J(e,"densities"),y=J(e,"format"),S=ro(i)||qe(i)?.transparent===!0,x=J(e,"placeholder")||(o&&!S?"thumbhash":void 0),m=J(e,"placeholderColor")||"#e5e7eb",b=J(e,"provider"),w=J(e,"class")||J(e,"className")||"",C=J(e,"style")||"",k=J(e,"objectFit")||J(e,"fit"),A=J(e,"objectPosition")||J(e,"position"),I=J(e,"quality"),W=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),X=J(e,"loading"),N=J(e,"decoding")||"async",_=!!o||_e(e,"picture",!1)||!!y,O=c?Number.parseInt(c):void 0,B=g?Number.parseInt(g):void 0,U=h||"",V="";if(o)U=o.sources[o.fallback.format]||"",V=l?Ze(l):"100vw";else if(!U&&l&&b&&b!=="local"&&b!=="static")U=Ve(i,Xe,b,y),V=Ze(l);else if(!U&&v){let P=v.split(/\s+/).map((q)=>Number.parseFloat(q.replace("x","")));U=Pn(i,P,O,b,y)}else if(l)V=Ze(l);let D=[];if(C)D.push(C);if(k)D.push(`object-fit:${k}`);if(A)D.push(`object-position:${A}`);if(O&&B)D.push(`aspect-ratio:${O}/${B}`);let F=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!S){let P=o?.placeholder?{dataUrl:o.placeholder.dataUrl,color:m}:qe(i);if(P&&x==="color")D.push(`background-color:${P.color}`),F.push("backgroundColor");else if(P)D.push(`background-color:${P.color}`),D.push(`background-image:url(${P.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let q=In(O||16,B||9,m);D.push(`background-image:url(${q})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")D.push(`background-image:url(${R(x)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=o?.fallback.url||xe(i,O,B,b,y),Y=[];if(Y.push(`src="${R(ar(we,"fetched"))}"`),Y.push(`alt="${R(a)}"`),c)Y.push(`width="${R(c)}"`);if(g)Y.push(`height="${R(g)}"`);let re=X||(L||M?"eager":W?"lazy":"");if(re)Y.push(`loading="${R(re)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${R(N)}"`),w)Y.push(`class="${R(w)}"`);if(D.length>0)Y.push(`style="${R(D.join(";"))}"`);if(U)Y.push(`srcset="${R(ar(U,"fetched"))}"`);if(V)Y.push(`sizes="${R(V)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let P=typeof e.static.onload==="string"?e.static.onload:"",q=_n(F)+(P?`;${P}`:"");Y.push(`onload="${R(q)}"`),$e.add("onload")}Y.push(...ie(e,$e)),Y.push(...ae(e,$e));let T=`<img ${Y.join(" ")} />`,Z="";if(M){let q=y==="webp"?"image/webp":y==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${R(we)}"${q?` type="${q}"`:""}${U?` imagesrcset="${R(U)}"`:""}${V?` imagesizes="${R(V)}"`:""} />
2
+ import{pc,fc}from"./chunk-78yjmbbs.js";import{j,as,cs,ls,Co,Eo,ar,Ie,de,K,ds,oe,G,z,et,lr,Ao,pr,je,n,d,H,mn}from"./chunk-7dnpjrqp.js";import{p,E,tt,u}from"./chunk-qwdcts9w.js";import{ne}from"./chunk-xnx06qqt.js";import{r}from"./chunk-tst8p27s.js";import{f}from"./chunk-b7e07ybq.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import Te from"fs";function Ce(e,t,s){let i=Buffer.alloc(s),o=Te.readSync(e,i,0,s,t);return i.subarray(0,o)}function De(e){if(e.length<25)return!1;let t=(i,o)=>String.fromCharCode(...e.subarray(i,o));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let s=t(12,16);if(s==="VP8X")return(e[20]&16)!==0;if(s==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=Te.openSync(e,"r");let s=Ce(t,0,33);if(s.length>=3&&s[0]===255&&s[1]===216&&s[2]===255)return"none";if(s.length>=26&&s[0]===137&&s.toString("latin1",1,4)==="PNG"){let i=s[25];if(i===4||i===6)return"possible";let o=8;for(let a=0;a<64;a++){let c=Ce(t,o,8);if(c.length<8)return"unknown";let g=c.toString("latin1",4,8);if(g==="tRNS")return"possible";if(g==="IDAT"||g==="IEND")return"none";o+=12+c.readUInt32BE(0)}return"unknown"}if(s.length>=25&&s.toString("latin1",0,4)==="RIFF"&&s.toString("latin1",8,12)==="WEBP"){if(De(s))return"possible";let i=s.toString("latin1",12,16);return i==="VP8 "||i==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)Te.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as mt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let s=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(s.protocol==="file:"&&Jt.existsSync(gt(s)))return gt(s)}catch{}try{let s=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return s&&rn(s)?s:void 0}catch{return}}function rn(e,t=process.env){let s=e.replace(/\\/g,"/");if(s.split("/").some((o)=>/@\d[^/]*@@@\d+$/.test(o)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((o)=>!!o).map((o)=>`${o.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((o)=>s.startsWith(o))}var pt=!1;function pe(e){if(!pt)pt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof mt!=="function")return pe("node:worker_threads has no Worker in this runtime");let s=nn();if(!s)return pe("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((i,o)=>{let a;try{a=new mt(s)}catch(h){i(pe(`could not start ${s}: ${Le(h)}`));return}let c=!1,g=!1,l=(h)=>{if(g)return;g=!0,h(),a.terminate()};a.on("message",(h)=>{if(h.type==="ready"){c=!0,a.postMessage({task:e,args:t});return}if(h.type==="result"){l(()=>i(h.value));return}let v=Error(h.error?.message??"image worker failed");if(h.error?.name)v.name=h.error.name;if(h.error?.stack)v.stack=h.error.stack;l(()=>o(v))}),a.on("error",(h)=>{l(()=>c?o(h instanceof Error?h:Error(Le(h)||"image worker crashed")):i(pe(`the worker failed before it was ready: ${Le(h)}`)))}),a.on("exit",(h)=>{l(()=>c?o(Error("image worker exited before it finished")):i(pe(`the worker exited with code ${h} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let s=Q.dirname(Bun.resolveSync(e,t));while(s!==Q.dirname(s)){let i=Q.join(s,"package.json");if(ee.existsSync(i)){let o=JSON.parse(ee.readFileSync(i,"utf8"));if(o.name===e)return o.version}s=Q.dirname(s)}return}function xt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let s;try{s=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${s??"unknown"}`}).join("+"),Pe}var bt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[bt]??={catalog:new Map,transparent:new Set},e[bt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=Q.extname(e),s=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),i=Ct("sha256").update(e).digest("hex").slice(0,8);return`${s||"image"}-${i}`}function wt(e,t=`stx:${he}`){let s=(i)=>`${he}/${i.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(i){let o=Q.join(e,i);try{let a=await ee.promises.stat(o);return a.size>0?{bytes:a.size,path:o,url:s(i)}:null}catch{return null}},async write(i,o){let a=Q.join(e,i);await ee.promises.mkdir(Q.dirname(a),{recursive:!0});let c=`${a}.${process.pid}.tmp`;return await ee.promises.writeFile(c,o),await ee.promises.rename(c,a),{bytes:o.byteLength,path:a,url:s(i)}},url:s}}async function Rt(e,t=e){let s=await ee.promises.readdir(t,{withFileTypes:!0});s.sort((o,a)=>o.name.localeCompare(a.name));let i=[];for(let o of s){let a=Q.join(t,o.name);if(o.isDirectory()){i.push(...await Rt(e,a));continue}if(!o.isFile()||!an.has(Q.extname(o.name).toLowerCase()))continue;i.push({absolutePath:a,relativePath:Q.relative(e,a)})}return i}function $t(e,t){return e.map((s)=>({key:gn(s.relativePath),input:s.absolutePath,name:pn(s.relativePath),...hn(s.absolutePath)?{options:{storage:t}}:{}}))}function hn(e){return Me(e)==="possible"}function yn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function xn(e){let t=Object.entries(e).filter(([,o])=>o.fallback.format==="png"),s=new Set,i=8;for(let o=0;o<t.length;o+=8)await Promise.all(t.slice(o,o+8).map(async([a,c])=>{let g=c.variants.filter((l)=>l.format==="png").sort((l,h)=>l.width-h.width)[0];try{let l=await sn(new Uint8Array(await ee.promises.readFile(g?.path??c.fallback.path)));if(yn(l.data))s.add(a)}catch{s.add(a)}}));return s}function bn(e,t){let s=[];for(let i of t){let o=e[i],a=o?.variants.filter((g)=>g.format==="webp")??[];if(!o||a.length===0)continue;if(!a.some((g)=>{let l;try{return l=ee.openSync(g.path,"r"),!De(Ce(l,0,32))}catch{return!0}finally{if(l!==void 0)ee.closeSync(l)}}))continue;if(o.variants=o.variants.filter((g)=>g.format!=="webp"),delete o.sources.webp,s.push(i),!vt.has(i))vt.add(i),console.warn(`[stx-images] ${i} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return s}async function vn(e){let t=[],s=8;for(let i=0;i<e.length;i+=8){let o=e.slice(i,i+8),a=await Promise.all(o.map(async(c)=>{try{return await on(c.absolutePath),c}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${c.relativePath}`),null}}));t.push(...a.filter((c)=>c!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),s=JSON.parse(t);return s&&typeof s==="object"?s:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function no(e){let t=At(e);return t?ye().catalog.get(t):void 0}function ro(e){let t=At(e);return t?ye().transparent.has(t):!1}function so(e){let t=(i)=>e.variants.filter((o)=>o.format===i).reduce((o,a)=>o+a.bytes,0),s=t(e.fallback.format);return["avif","webp"].map((i)=>({format:i,srcset:e.sources[i]||"",bytes:t(i)})).filter((i)=>i.srcset&&i.bytes>0&&i.bytes<s).sort((i,o)=>i.bytes-o.bytes).map(({format:i,srcset:o})=>({format:i,srcset:o}))}function gp(e){let t=no(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:so(t).map(({format:s,srcset:i})=>({type:`image/${s}`,srcset:i})),width:t.source.width,height:t.source.height,placeholder:ro(e)?void 0:t.placeholder?.dataUrl}}function zr(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function mp(e,t,s={}){if(!e||!ee.existsSync(e))return zr(),{count:0,fingerprint:""};if(s.offThread){let m=await ze("delivery",{publicDir:e,outputDir:t});if(m!==ke)return Sn(m.state),m.result}let i=await Rt(e);if(i.length===0)return zr(),{count:0,fingerprint:""};let o=wn(t),a=i.filter((m)=>{let b=o[m.relativePath];if(!b)return!0;let w=St(m.absolutePath);return!w||w.mtimeMs!==b.mtimeMs||w.size!==b.size});if(a.length===0)return zr(),{count:0,fingerprint:""};let c=wt(Q.join(t,"_stx","images"),`${ln}:${xt()}`),g={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${xt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},l=a,h;try{h=await yt({...g,entries:$t(a,c)})}catch(m){if(l=await vn(a),l.length===a.length)throw m;let b=new Set(l.map((C)=>C.relativePath)),w=!1;for(let C of a){if(b.has(C.relativePath))continue;let k=St(C.absolutePath);if(!k)continue;o[C.relativePath]=k,w=!0}if(w)$n(t,o);if(l.length===0)return zr(),{count:0,fingerprint:""};h=await yt({...g,entries:$t(l,c)})}let v=await xn(h.entries),y=bn(h.entries,v),S=ye();S.catalog=new Map(Object.entries(h.entries)),S.transparent=v;let x=v.size===0&&y.length===0?h.fingerprint:Ct("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:y.sort()})).digest("hex");return{count:l.length,fingerprint:x}}class kt{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,s,i){let o=Co(e,i);if(o!==void 0)return o;for(let a of Eo(e,t,s,i))if(await n(a))return a;return null}}var le=new kt;function R(e){return H(e)}var se="\x00stx-boolean-attribute";function We(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function Fe(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function ie(e,t){let s=[];for(let[i,o]of Object.entries(e.static)){if(t.has(i))continue;let a=e.staticNames?.[i]??i;if(typeof o==="boolean"){if(o)s.push(d(a));continue}if(o===se){s.push(d(a));continue}s.push(`${d(a)}="${mn(a,We(String(o)))}"`)}return s}function ae(e,t){let s=[];for(let[i,o]of Object.entries(e.serverDynamic??{})){if(t.has(i))continue;if(o===null||o===void 0||o===!1)continue;let a=e.serverDynamicNames?.[i]??i;if(o===!0){s.push(d(a));continue}if(typeof o==="object")continue;s.push(`${d(a)}="${mn(a,We(String(o)))}"`)}return s}function Rn(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 He={name:"StxLink",aliases:["stx-link"],render(e,t,s){let i=Rn(e),o=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),a=typeof e.static.activeClass==="string"?e.static.activeClass:"active",c=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",g=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,l=[];if(i.reactive)l.push(`:href="${R(i.value)}"`);else l.push(`href="${R(ar(i.value,"navigable"))}"`);if(o)l.push(`class="${R(o)}"`);if(l.push("data-stx-link"),l.push(`data-stx-active-class="${R(a)}"`),l.push(`data-stx-exact-active-class="${R(c)}"`),g)l.push("data-stx-prefetch");let h=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(h)l.push(`data-stx-active-match="${R(h)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return l.push(...ie(e,v)),l.push(...ae(e,v)),`<a ${l.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function J(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let s=e.static[t];if(typeof s==="string")return s;return}function _e(e,t,s=!1){let i=e.serverDynamic[t];if(i!==void 0)return i!==!1&&i!=="false";let o=e.static[t];if(o!==void 0)return o!=="false"&&o!==!1;return s}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),s=[];for(let i of t)if(i.includes(":")){let[o,a]=i.split(":"),c=kn[o];if(c)s.push(`(max-width: ${c}px) ${a}`);else{let g=Number.parseInt(o);if(!Number.isNaN(g))s.push(`(max-width: ${g}px) ${a}`)}}else s.push(i);return s.join(", ")}function Ve(e,t,s,i){return t.map((o)=>`${xe(e,o,void 0,s,i)} ${o}w`).join(", ")}function Pn(e,t,s,i,o){return t.map((a)=>{let c=s?s*a:void 0;return`${xe(e,c,void 0,i,o)} ${a}x`}).join(", ")}function xe(e,t,s,i,o){if(!i||i==="local"||i==="static")return e;if(i==="cloudinary"){let a=[];if(t)a.push(`w_${t}`);if(s)a.push(`h_${s}`);if(o)a.push(`f_${o}`);a.push("q_auto");let c=a.join(",");return e.replace("/upload/",`/upload/${c}/`)}if(i==="imgix"){let a=new URLSearchParams;if(t)a.set("w",String(t));if(s)a.set("h",String(s));if(o)a.set("fm",o);a.set("auto","format");let c=e.includes("?")?"&":"?";return`${e}${c}${a.toString()}`}if(i==="bunny"){let a=new URLSearchParams;if(t)a.set("width",String(t));if(s)a.set("height",String(s));if(o)a.set("format",o);let c=e.includes("?")?"&":"?";return`${e}${c}${a.toString()}`}return e}function _n(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function In(e,t,s="#e5e7eb"){let i=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${s}"/></svg>`;return`data:image/svg+xml;base64,${btoa(i)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,s){let i=J(e,"src")||"",o=no(i),a=J(e,"alt")||"",c=J(e,"width")||(o?String(o.source.width):void 0),g=J(e,"height")||(o?String(o.source.height):void 0),l=J(e,"sizes"),h=J(e,"srcset"),v=J(e,"densities"),y=J(e,"format"),S=ro(i)||qe(i)?.transparent===!0,x=J(e,"placeholder")||(o&&!S?"thumbhash":void 0),m=J(e,"placeholderColor")||"#e5e7eb",b=J(e,"provider"),w=J(e,"class")||J(e,"className")||"",C=J(e,"style")||"",k=J(e,"objectFit")||J(e,"fit"),A=J(e,"objectPosition")||J(e,"position"),I=J(e,"quality"),W=_e(e,"lazy",!0),M=_e(e,"preload",!1),L=_e(e,"priority",!1),X=J(e,"loading"),N=J(e,"decoding")||"async",_=!!o||_e(e,"picture",!1)||!!y,O=c?Number.parseInt(c):void 0,B=g?Number.parseInt(g):void 0,U=h||"",V="";if(o)U=o.sources[o.fallback.format]||"",V=l?Ze(l):"100vw";else if(!U&&l&&b&&b!=="local"&&b!=="static")U=Ve(i,Xe,b,y),V=Ze(l);else if(!U&&v){let P=v.split(/\s+/).map((q)=>Number.parseFloat(q.replace("x","")));U=Pn(i,P,O,b,y)}else if(l)V=Ze(l);let D=[];if(C)D.push(C);if(k)D.push(`object-fit:${k}`);if(A)D.push(`object-position:${A}`);if(O&&B)D.push(`aspect-ratio:${O}/${B}`);let F=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!S){let P=o?.placeholder?{dataUrl:o.placeholder.dataUrl,color:m}:qe(i);if(P&&x==="color")D.push(`background-color:${P.color}`),F.push("backgroundColor");else if(P)D.push(`background-color:${P.color}`),D.push(`background-image:url(${P.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let q=In(O||16,B||9,m);D.push(`background-image:url(${q})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")D.push(`background-image:url(${R(x)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=o?.fallback.url||xe(i,O,B,b,y),Y=[];if(Y.push(`src="${R(ar(we,"fetched"))}"`),Y.push(`alt="${R(a)}"`),c)Y.push(`width="${R(c)}"`);if(g)Y.push(`height="${R(g)}"`);let re=X||(L||M?"eager":W?"lazy":"");if(re)Y.push(`loading="${R(re)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${R(N)}"`),w)Y.push(`class="${R(w)}"`);if(D.length>0)Y.push(`style="${R(D.join(";"))}"`);if(U)Y.push(`srcset="${R(ar(U,"fetched"))}"`);if(V)Y.push(`sizes="${R(V)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let P=typeof e.static.onload==="string"?e.static.onload:"",q=_n(F)+(P?`;${P}`:"");Y.push(`onload="${R(q)}"`),$e.add("onload")}Y.push(...ie(e,$e)),Y.push(...ae(e,$e));let T=`<img ${Y.join(" ")} />`,Z="";if(M){let q=y==="webp"?"image/webp":y==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${R(we)}"${q?` type="${q}"`:""}${U?` imagesrcset="${R(U)}"`:""}${V?` imagesizes="${R(V)}"`:""} />
3
3
  `}if(_){let P=[];if(o)for(let q of so(o))P.push(`<source type="image/${q.format}" srcset="${R(q.srcset)}"${V?` sizes="${R(V)}"`:""} />`);if(!o&&(y==="avif"||y==="auto")){let q=xe(i,O,B,b,"avif"),te=U?Ve(i,Xe,b,"avif"):`${q}`;P.push(`<source type="image/avif" srcset="${R(te)}"${V?` sizes="${R(V)}"`:""} />`)}if(!o&&(y==="webp"||y==="auto")){let q=xe(i,O,B,b,"webp"),te=U?Ve(i,Xe,b,"webp"):`${q}`;P.push(`<source type="image/webp" srcset="${R(te)}"${V?` sizes="${R(V)}"`:""} />`)}return`${Z}<picture>
4
4
  ${P.join(`
5
5
  `)}
@@ -38,5 +38,5 @@ ${T}
38
38
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
39
39
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
40
40
  </style>`}};import{existsSync as On,readFileSync as Bn}from"fs";var Oe=new Map,Ot=new Set;function Tn(e){if(Ot.has(e))return;Ot.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 Dn(e){let t=process.cwd();for(let s 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(On(s))return s;for(let s of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return f.resolve(s)}catch{}return null}function jn(e){if(Oe.has(e))return Oe.get(e);let t=Dn(e);if(!t)return Tn(e),null;try{let s=JSON.parse(Bn(t,"utf8"));return Oe.set(e,s.icons),s.icons}catch{return null}}function ge(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 st={name:"Icon",aliases:["icon","stx-icon"],render(e,t,s){let i=ge(e,"name")??ge(e,"icon");if(!i)return"<!-- Icon: missing name/icon prop -->";let o="lucide",a=i;if(i.includes(":")){let k=i.split(":");o=k[0],a=k[1]}let c=R(ge(e,"size")||"24"),g=R(ge(e,"color")||"currentColor"),l=R(ge(e,"class")||""),h=R(ge(e,"style")||""),v=Oe.get(o)??jn(o);if(!v)return`<!-- Icon: collection "${o}" not loaded -->`;let y=v[a];if(!y)return`<!-- Icon: "${a}" not found in ${o} -->`;let S=y.width||24,x=y.height||24,m=`0 0 ${S} ${x}`,b=y.body;if(g!=="currentColor")b=b.replace(/currentColor/g,g);let w=l?` class="${l}"`:"",C=h?` style="${h}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${c}" height="${c}" viewBox="${m}" fill="none"${w}${C}>${b}</svg>`}};function Bt(e,...t){for(let s of t){if(e.serverDynamic[s]!==void 0)return String(e.serverDynamic[s]);let i=e.static[s];if(typeof i==="string")return i}return}function Tt(e,t){let s=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${t}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),i=e.match(s);if(!i)return{region:null,rest:e};return{region:i[2],rest:e.replace(i[0],"")}}var it={name:"Suspense",aliases:["suspense"],render(e,t,s){let i=Tt(t,"fallback"),o=i.rest,a=Tt(o,"error"),c=a.rest,g=i.region??Bt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',l=a.region??Bt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${g}</div><div data-stx-suspense-error hidden>${l}</div><div data-stx-suspense-content hidden>${c}</div></div>`}};function Be(e,...t){for(let s of t){if(e.serverDynamic[s]!==void 0)return String(e.serverDynamic[s]);let i=e.static[s];if(typeof i==="string")return i}return}var ot={name:"TransitionGroup",aliases:["transition-group"],render(e,t,s){let i=(Be(e,"name")||"v").replace(/["'<>]/g,""),o=(Be(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",a=Be(e,"class"),c=Be(e,"id"),g=[`data-stx-transition-group="${i}"`,a?`class="${a}"`:"",c?`id="${c}"`:""].filter(Boolean).join(" ");return`<${o} ${g}>${t}</${o}>`}};function Dt(e=le){e.registerBuiltin(He),e.registerBuiltin(Ge),e.registerBuiltin(Ke),e.registerBuiltin(Ye),e.registerBuiltin(Qe),e.registerBuiltin(nt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot)}var jt=new Map;function Mn(e){let t=jt.get(e.source);if(!t)t=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),jt.set(e.source,t);return t}var Mt=new WeakMap;function Lt(e){let t=Mt.get(e);if(!t)t=new Set([...e].map((i)=>i.toLowerCase())),Mt.set(e,t);let s=t;return(i)=>!/[a-z]/.test(i)&&s.has(i.toLowerCase())}function Ln(e,t){let s="";for(let i=t;i<e.length;i++){let o=e[i];if(s){if(o==="\\")i++;else if(o===s)s=""}else if(o==='"'||o==="'")s=o;else if(o===">")return i}return e.length}function zt(e,t,s){let i=[],o=0,a=typeof s==="function"?s:s?(c)=>s.has(c.toLowerCase()):void 0;while(o<e.length){let c=e.indexOf("<",o);if(c===-1)break;let g=Mn(t);g.lastIndex=c+1;let l=g.exec(e);if(!l){o=c+1;continue}let h=l[1];if(a&&a(h)){let w=c+1+h.length;while(w<e.length&&e[w]!==">")w++;o=w+1;continue}let v=c+1+h.length,y=null,S=v,x=-1,m=!1;while(v<e.length){let w=e[v];if(y){if(w==="\\"&&v+1<e.length){v+=2;continue}if(w===y)y=null;v++;continue}if(w==='"'||w==="'"){y=w,v++;continue}if(w==="/"&&v+1<e.length&&e[v+1]===">"){x=v+2,m=!0;break}if(w===">"){x=v+1;break}v++}if(x===-1){o=c+1;continue}let b=e.slice(S,m?x-2:x-1).trim();if(m)i.push({fullMatch:e.slice(c,x),tagName:h,attributes:b,content:"",startIndex:c,endIndex:x,isSelfClosing:!0}),o=x;else{let w=`<${h}`,C=`</${h}>`,k=1,A=x,I=-1;while(k>0&&A<e.length){let L=e.indexOf(w,A),X=e.indexOf(C,A);if(X===-1)break;if(L!==-1&&L<X){let N=e[L+w.length];if(N===" "||N===">"||N==="/"||N===`
41
- `||N==="\t"){let _=Ln(e,L+w.length);if(e[_-1]!=="/")k++;A=_+1}else A=L+w.length}else{if(k--,k===0){I=X;break}A=X+C.length}}if(I===-1){o=x;continue}let W=e.slice(x,I),M=I+C.length;i.push({fullMatch:e.slice(c,M),tagName:h,attributes:b,content:W,startIndex:c,endIndex:M,isSelfClosing:!1}),o=M}}return i}function at(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ut(e,t){try{let s=Buffer.from(e,"base64").toString("utf8");return JSON.parse(s)}catch{}try{let s=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(s)}catch(s){if(t?.debug)console.error("Error decoding __stx_ prop:",s);return e}}function ct(e,t){let s=0,i="",o=t;while(o<e.length){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'"||a==="`")i=a;else if(a==="{")s++;else if(a==="}"){if(s--,s===0)return e.slice(t,o+1)}o++}return e.slice(t)}function Wt(e){let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;if(ct(t,0).length!==t.length)return null;return t.slice(1,-1).trim()}var zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wn(e){return lt(e).map((t)=>[t.start,t.end])}function lt(e){let t=[],s=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,i;while((i=s.exec(e))!==null){let o=i[2]||"",a=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(o);if(!a)continue;let c=K(a[1]??a[2]??a[3]??""),g=i.index,l=g+i[0].length,h=i[1].toLowerCase();if(i[0].endsWith("/>")||Un.has(h)){t.push({start:g,end:l,names:c});continue}let v=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),y=new RegExp(`<\\/?${v}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");y.lastIndex=l;let S=1,x=l,m;while((m=y.exec(e))!==null)if(m[0].startsWith("</")){if(S--,S===0){x=m.index+m[0].length;break}}else if(!m[0].endsWith("/>"))S++;t.push({start:g,end:x,names:c})}return t}function Ft(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Ft(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function aa(e,t){if(!/:[\w-]+=/.test(e))return e;let s=e,i=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,o=[],a;while((a=i.exec(e))!==null)o.push([a.index,a.index+a[0].length]);o.push(...Wn(e));let c=new Set([...et(t),...Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]]);function g(S){return o.some(([x,m])=>S>=x&&S<m)}let l=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,h=[],v=new Map,y=256;while((a=l.exec(s))!==null){if(g(a.index))continue;let S=a[0],x=a[2];if(!x||!x.includes(":"))continue;let m=/(?:^|\s)data-native(?:\s|=|$)/i.test(x.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,w,C=x,k=!1;while((w=b.exec(x))!==null){if(ds(x,w.index,!0)?.kind==="attribute")continue;let A=w[1],I=w[2];if(pc(A))continue;if(z(I,c))continue;if(I.includes("()")&&!I.includes(".get(")||I.includes("$store")||I.includes("$ref"))continue;try{let W=Object.keys(t),M=Object.values(t),L=I.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!W.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let X=JSON.stringify([W,I]),N=v.get(X);if(!N){if(N=Function(...W,`return (${I})`),v.size>=y)v.clear();v.set(X,N)}let _=N(...M);if(A==="class"){let O=H(Ft(_));if(O){let B=C.match(/\sclass="([^"]*)"/);if(B)C=C.replace(B[0],()=>` class="${B[1]} ${O}"`);else C=C.replace(w[0],()=>` class="${O}"`)}else C=C.replace(w[0],"");k=!0;continue}if(zn.has(A)){if(_)C=C.replace(w[0],` ${A}`);else C=C.replace(w[0],"");k=!0;continue}if(_===null||_===void 0||_===!1)C=C.replace(w[0],"");else{let O=m&&typeof _==="object"?JSON.stringify(_):String(_),B=mn(A,O);C=C.replace(w[0],()=>` ${A}="${B}"`)}k=!0}catch(W){if(W instanceof oe)throw W;continue}}if(k){let A=a[3]?" /":"",W=`<${a[1]}${C}${A}>`;h.push({start:a.index,end:a.index+S.length,replacement:W})}}if(h.length>0){let S=Array(h.length*2+1),x=0;for(let m=0;m<h.length;m++){let{start:b,end:w,replacement:C}=h[m];S[m*2]=s.slice(x,b),S[m*2+1]=C,x=w}S[h.length*2]=s.slice(x),s=S.join("")}return s}import Ht from"fs";import qt from"path";var Xt=!1;function Fn(e,t,s,i=!1,o=new Set){let a={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},c=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),g=(y)=>{if(c.size===0)return!1;let S=r(y),x=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&c.has(x))return!0;for(let m of c){let b=m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${b}\\s*\\(`).test(S))return!0}return!1},l=new Set(fc),h=(y)=>{if(!y.includes("-")||y.startsWith("@")||y.startsWith(":")||y.startsWith("x-")||y.startsWith("__"))return y;if(y.startsWith("aria-")||y.startsWith("data-"))return y;return y.replace(/-([a-z0-9])/g,(S,x)=>x.toUpperCase())},v=(y,S)=>{let x=h(y);if(a.static[x]=S,x!==y)a.staticNames[x]=y};for(let[y,S]of Object.entries(e)){let x=y.startsWith("x-")&&!l.has(y)&&!y.startsWith("x-bind:")&&!y.startsWith("x-on:")?`:${y.slice(2)}`:y;if(x.startsWith("@")){a.events[x]=S;continue}if(x.startsWith("__stx_")){let m=h(x.slice(6));a.serverDynamic[m]=Ut(S,s);continue}if(x.startsWith(":")){let m=h(x.slice(1)),b=S===se?m:S;if(m==="if"||m==="for"||m==="show"){a.clientReactive[m]=b;continue}if(i){a.clientReactive[m]=b;continue}if(z(b,o)){a.clientReactive[m]=b;continue}if(g(b)){a.clientReactive[m]=b;continue}try{if(!p(b)){if(s.debug)console.error(`Unsafe expression in :${m} binding: ${b}`);a.clientReactive[m]=b;continue}let w=Object.keys(t),C=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]);if(tt(b).some((M)=>!C.has(M)&&!w.includes(M)&&(!(M in globalThis)||k.has(M)))){a.clientReactive[m]=b;continue}let W=u(b,w)(...Object.values(t));if(a.serverDynamic[m]=W,m!==x.slice(1)&&a.serverDynamicNames)a.serverDynamicNames[m]=x.slice(1)}catch{a.clientReactive[m]=b}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let m=Hn(S,o);if(m!==null){a.clientReactive[h(x)]=m;continue}let b=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(b)try{let w=b[1];if(p(w)){let k=u(w,Object.keys(t))(...Object.values(t));v(x,k!=null?String(k):"")}else{if(s.debug)console.error(`Unsafe expression in ${x}: ${w}`);v(x,S)}}catch(w){if(s.debug)console.error(`Error evaluating expression for ${x}:`,w);v(x,S)}else{let w=S,C=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=C.exec(S))!==null)try{let A=k[1];if(!p(A)){if(s.debug)console.error(`Unsafe expression in ${x}: ${A}`);continue}let W=u(A,Object.keys(t))(...Object.values(t));w=w.replace(k[0],String(W??""))}catch(A){if(s.debug)console.error(`Error evaluating expression in ${x}:`,A)}v(x,w)}continue}v(x,S===se?"true":at(S))}return a}function Hn(e,t){if(t.size===0)return null;let s=/\{\{\s*([\s\S]+?)\s*\}\}/g,i=[...e.matchAll(s)];if(!i.some((g)=>z(g[1],t)))return null;let o=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(o&&i.length===1)return o[1];let a="",c=0;for(let g of i)a+=e.slice(c,g.index).replace(/[`\\$]/g,(l)=>`\\${l}`),a+=`\${${g[1]}}`,c=g.index+g[0].length;return a+=e.slice(c).replace(/[`\\$]/g,(g)=>`\\${g}`),`\`${a}\``}var qn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Xn(e,t,s){if(!e.includes("@"))return e;if(!qn.some(([o,a])=>o.test(e)&&e.includes(a)))return e;try{return ne(e,t,s)}catch{return e}}function me(e){let t={},s=0,i=e.length;while(s<i){while(s<i&&/\s/.test(e[s]))s++;if(s>=i)break;let o="";while(s<i&&!/[\s=]/.test(e[s]))o+=e[s],s++;if(!o)break;while(s<i&&/\s/.test(e[s]))s++;if(s<i&&e[s]==="="){s++;while(s<i&&/\s/.test(e[s]))s++;let a="";if(s<i&&(e[s]==='"'||e[s]==="'")){let c=e[s];s++;while(s<i){let g=e[s];if(g==="\\"&&s+1<i){s++,a+=e[s],s++;continue}if(g===c){s++;break}a+=g,s++}}else if(e[s]==="{"){a=ct(e,s),s+=a.length;let c=Wt(a);if(c!==null){t[`:${o}`]=c;continue}}else while(s<i&&!/\s/.test(e[s]))a+=e[s],s++;t[o]=a}else t[o]=se}return t}function Zt(e){return Object.entries(e).map(([t,s])=>s===se?t:`${t}="${Zn(s)}"`).join(" ")}function Zn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vn(e){let t=new Set,s=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,i;while((i=s.exec(e))!==null){let o=i[1];if(le.isBuiltin(o))t.add(o)}return[...t].sort()}async function El(e,t,s,i,o){if(!/import\s/.test(e))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let a=t.__importedComponents,c=qt.dirname(s),g=[],l=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let y of e.matchAll(l)){let[S,x,m]=y,b=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=m,C,k=[];while((C=b.exec(m))!==null){let[A,I,W,M]=C,L=null,X=null;if(M.startsWith(".")||M.startsWith("/")){let O=qt.resolve(c,M);if(O.endsWith(".stx"))X=O;else{let B=`${O}.stx`;try{if(Ht.statSync(B).isFile())X=B}catch{try{if(Ht.statSync(O).isDirectory())L=O}catch{}}}}else L=cs(M,c);if(!L&&!X)continue;let N=!1,_=(O,B)=>{a.set(O,B),a.set(O.toLowerCase(),B);let U=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();a.set(U,B),o.add(B)};if(W&&X)_(W,X),N=!0;else if(I){let O=I.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean).map((U)=>{let V=U.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(V)return{source:V[1],local:V[2]};return{source:U,local:U}}),B=L?as(L):null;for(let{source:U,local:V}of O){let D=null;if(X)D=X;else if(B)D=B.get(U)??B.get(U.toLowerCase())??B.get(U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)_(V,D),N=!0}}if(N)k.push({start:C.index,end:C.index+A.length})}if(k.length===0)continue;for(let A=k.length-1;A>=0;A--)w=w.slice(0,k[A].start)+w.slice(k[A].end);g.push({start:y.index,end:y.index+S.length,value:`<script${x}>${w}</script>`})}if(g.length===0)return e;let h=[],v=0;for(let y of g)h.push(e.slice(v,y.start),y.value),v=y.end;return h.push(e.slice(v)),h.join("")}async function Gn(e,t,s,i,o){let a=e;if(!t.__importedComponents)t.__importedComponents=new Map;let c=t.__importedComponents,g=/@import\s*\(\s*([^)]+)\s*\)/g,l;while((l=g.exec(a))!==null){let[h,v]=l,y=v.split(",").map((S)=>S.trim().replace(/^['"]|['"]$/g,"")).filter((S)=>S.length>0);for(let S of y){let x=S.split("/"),b=x[x.length-1].replace(/\.stx$/,""),w=b.includes("-")?b.split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(""):b.charAt(0).toUpperCase()+b.slice(1),C=null,k=ls(S,s,i);for(let A of k)try{if(await Bun.file(A).exists()){C=A;break}}catch{}if(C){c.set(w,C),c.set(b,C),c.set(b.toLowerCase(),C);let A=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(c.set(A,C),o.add(C),i.debug)console.log(`Imported component: ${w} -> ${C}`)}else if(i.debug)console.warn(`Could not resolve imported component: ${S}`)}a=a.replace(h,""),g.lastIndex=0}return a}async function Kn(e,t,s,i,o){let a=e,c=i.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let g=t.__processedComponents,l=/@component\s*\(/g,h;while((h=l.exec(a))!==null){let v=h.index,y=v+h[0].length-1,S=1,x=y+1;while(x<a.length&&S>0){if(a[x]==="(")S++;else if(a[x]===")"){if(S--,S===0)break}x++}if(S!==0)break;let m=a.substring(y+1,x),b=x+1,w=m.match(/^\s*['"]([^'"]+)['"]/);if(!w){l.lastIndex=0;continue}let C=w[1],k,A=m.slice(w[0].length),I=A.match(/^\s*,\s*/);if(I)k=A.slice(I[0].length).trim();let W={};if(k)try{W=E(k,t)}catch(O){let B=O instanceof Error?O.message:String(O);a=a.replace(a.substring(v,b),`[Error parsing component props: ${B}]`);continue}let M="",L=b,N=a.substring(b).match(/^([\s\S]*?)@endcomponent/);if(N)M=N[1].trim(),L=b+N[0].length;let _=await je(C,W,M,c,t,s,i,g,o);a=a.substring(0,v)+_+a.substring(L),l.lastIndex=0}return a}async function Jn(e,t,s,i,o){if(!e)return e;let a=e,c=i.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let g=t.__processedComponents,l=er(a);if(l.size>0){let b=Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[];t.__stx_client_declared_names=[...new Set([...b,...l])]}let h=G(a);a=h.output;let v=et(t);return a=await m(a,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),a=await m(a,/[A-Z][a-zA-Z0-9]*/,!0,Lt(lr)),a=await m(a,/[a-z][a-z0-9]*/,!1,lr),a=h.restore(a),a;async function m(b,w,C,k){if(!b)return b;let A=b,I=zt(A,w,k),W=lt(A),M=new Map;for(let N=I.length-1;N>=0;N--){let _=I[N],O=C?j(_.tagName):_.tagName,B=me(Xn(_.attributes,t,s)),U=W.filter(({start:Z,end:P})=>_.startIndex>=Z&&_.startIndex<P),V=U.length>0,D=new Set(v);for(let Z of U)for(let P of Z.names)D.add(P);let F=Fn(B,t,i,V,D);if(typeof F.clientReactive.for==="string")for(let Z of K(F.clientReactive.for))D.add(Z);let ce=le.getBuiltin(_.tagName),we=ce?await pr(_.tagName,c,t,s,i):!1;if(ce&&!we){let Z={context:t,filePath:s,options:i,dependencies:o},P=ce.render(F,_.content,Z);if(Object.keys(F.events).length>0){let q=Zt(F.events);P=P.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${q}`)}if(Object.keys(F.clientReactive).length>0)P=Vt(P,F.clientReactive);M.set(N,P);continue}if(!C&&_.tagName.includes("-")&&!await pr(O,c,t,s,i))continue;let Y={};for(let[Z,P]of Object.entries(F.static))Y[Z]=P;for(let[Z,P]of Object.entries(F.serverDynamic))Y[Z]=P;let re={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(F.clientReactive),events:Object.keys(F.events)},T=await je(O,Y,h.restore(_.content),c,t,s,i,g,o,[...D],re,_.tagName);if(T=Yn(T,F,re.declaredProps,re.consumedProps,i._nativeHostAttrs),i._nativeHostAttrs){let Z=re.reactiveProps.filter((te)=>!re.consumedProps.has(te)&&!["if","for","show","key","ref"].includes(te)).map(j),P=ut(T,!0);if(Z.length&&P){if(!Object.hasOwn(me(T.slice(P.insertPos,P.tagEnd)),"data-stx-native-host-root"))T=T.slice(0,P.insertPos)+' data-stx-native-host-root="true"'+T.slice(P.insertPos);let te=ve(T);T=T.slice(0,te.insertPos)+` data-stx-native-forward="${Z.join(" ")}"`+T.slice(te.insertPos)}let q=ut(T,!0);if(q){let te=me(T.slice(q.insertPos,q.tagEnd)),Se=ve(T),Kt=me(T.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(te,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))T=T.slice(0,Se.insertPos)+" data-stx-native-host-owner"+T.slice(Se.insertPos)}}if(Object.keys(F.events).length>0){let Z=ve(T);if(Z){let P=Zt(F.events),q=Object.keys(F.events).map((te)=>te.replace(/^@/,"").split(".")[0]).join(" ");T=T.substring(0,Z.insertPos)+` data-stx-parent-events="${q}" ${P}`+T.substring(Z.insertPos)}}if(Object.keys(F.clientReactive).length>0)T=Vt(T,F.clientReactive);M.set(N,T)}if(M.size===0)return A;let L="",X=0;for(let N=0;N<I.length;N++){let _=M.get(N);if(_===void 0)continue;L+=A.slice(X,I[N].startIndex),L+=_,X=I[N].endIndex}return L+=A.slice(X),L}}function Vt(e,t){let s=new Set(["if","for"]),i=new Set(["show"]),o=Object.entries(t).filter(([v])=>!s.has(v)),a=o.filter(([v])=>!i.has(v)).map(([v])=>j(v)).join(" "),c=e,g=o.length>0?ve(c):null;if(g){let v=o.map(([S,x])=>`:${j(S)}="${x.replace(/"/g,"&quot;")}"`).join(" "),y=a?` data-stx-parent-bindings="${a}"`:"";c=c.substring(0,g.insertPos)+`${y} ${v}`+c.substring(g.insertPos)}let l=t.if;if(l)c=`<template :if="${l.replace(/"/g,"&quot;")}">${c}</template>`;let h=t.for;if(h){let v=t.key,y=v?` :key="${v.replace(/"/g,"&quot;")}"`:"";c=`<template :for="${h.replace(/"/g,"&quot;")}"${y}>${c}</template>`}return c}function Yn(e,t,s=new Set,i=new Set,o=!1){let a=ut(e,o);if(!a)return e;let c=e.slice(a.insertPos,a.tagEnd),g=t.serverDynamic.class??t.static.class;if(o&&typeof g==="string"&&g&&!i.has("class")){let m=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,b=m.test(c)?c.replace(m,(w,C,k,A,I)=>`${C}class="${R(`${at(k??A??I)} ${g}`)}"`):` class="${R(g)}"${c}`;e=e.slice(0,a.insertPos)+b+e.slice(a.tagEnd),a.tagEnd+=b.length-c.length,c=b}let l=o||/\bdata-native(?:\s|=)/i.test(c),h=l?i:s,v=new Set(Object.keys(me(c))),y=new Set(["class","className"]);for(let m of Object.keys(t.static)){let b=t.staticNames[m]??m;if(v.has(b)||h.has(m)||!l&&!Fe(b))y.add(m)}for(let m of Object.keys(t.serverDynamic)){let b=t.serverDynamicNames?.[m]??m;if(v.has(b)||h.has(m)||!l&&!Fe(b))y.add(m)}let S=[];if(l){for(let[m,b]of Object.entries(t.static)){if(y.has(m)||b!==!0&&b!==se)continue;y.add(m),S.push(`${R(t.staticNames?.[m]??m)}="true"`)}for(let[m,b]of Object.entries(t.serverDynamic)){if(y.has(m)||b!==!0)continue;y.add(m),S.push(`${R(t.serverDynamicNames?.[m]??m)}="true"`)}}let x=[...ie(t,y),...ae(t,y),...S];if(l){for(let[m,b]of Object.entries(t.serverDynamic)){if(y.has(m)||b!==!1)continue;let w=t.serverDynamicNames?.[m]??m;x.push(`${R(w)}="false"`)}for(let[m,b]of Object.entries(t.serverDynamic)){if(y.has(m)||b===null||typeof b!=="object")continue;let w=JSON.stringify(b);if(w!==void 0){let C=t.serverDynamicNames?.[m]??m;x.push(`${R(C)}="${R(w)}"`)}}}if(x.length===0)return e;return`${e.slice(0,a.insertPos)} ${x.join(" ")}${e.slice(a.insertPos)}`}function ve(e){let t=Gt(e,0);if(t)return t;let s=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(s)return{insertPos:s.index+1+s[1].length,tagEnd:ft(e,s.index+1+s[1].length)};return null}function ut(e,t=!1){let s=ve(e);if(!s)return null;let i=e.slice(s.insertPos,s.tagEnd),o=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(i)?Gt(e,s.tagEnd+1):s;return o&&t?Qn(e,o)??o:o}function Qn(e,t){if(!e.includes("data-stx-native-host-root"))return null;let s=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),i=e.lastIndexOf("<",t.insertPos),o=0,a;while(i>=0&&i<e.length){if(e.startsWith("<!--",i)){let v=e.indexOf("-->",i+4);if(v<0)return null;i=e.indexOf("<",v+3);continue}let c=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(i));if(!c){i=e.indexOf("<",i+1);continue}let g=c[2].toLowerCase(),l=i+c[0].length,h=ft(e,l);if(c[1]){if(o--,a!==void 0&&o<a)a=void 0;if(o<=0)return null}else if(g==="script"||g==="style"){let v=new RegExp(`</${g}\\s*>`,"gi");if(v.lastIndex=h+1,!v.exec(e))return null;i=e.indexOf("<",v.lastIndex);continue}else{let v=me(e.slice(l,h)),y=o>0&&(Object.hasOwn(v,"data-stx-component-wrapper")||Object.hasOwn(v,"data-stx-native-host-owner"));if(a===void 0&&!y&&Object.hasOwn(v,"data-stx-native-host-root"))return{insertPos:l,tagEnd:h};if(!s.has(g)&&e[h-1]!=="/"){if(o++,a===void 0&&y)a=o}else if(o===0)return null}i=e.indexOf("<",h+1)}return null}function Gt(e,t){let s=t;while(s<e.length){let i=e.slice(s),o=i.match(/^\s+/);if(o){s+=o[0].length;continue}if(i.startsWith("<!--")){let g=e.indexOf("-->",s+4);if(g===-1)return null;s=g+3;continue}let a=i.match(/^<(script|style)\b[^>]*>/i);if(a){let g=`</${a[1].toLowerCase()}>`,l=e.toLowerCase().indexOf(g,s+a[0].length);if(l===-1)return null;s=l+g.length;continue}let c=i.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!c)return null;return{insertPos:s+1+c[1].length,tagEnd:ft(e,s+1+c[1].length)}}return null}function ft(e,t){let s="";for(let i=t;i<e.length;i++){let o=e[i];if(s){if(o==="\\")i++;else if(o===s)s=""}else if(o==='"'||o==="'")s=o;else if(o===">")return i}return e.length}function er(e){let t=new Set;for(let s of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let i=s[1];if(!/\bclient\b/.test(i)||/\bserver\b/.test(i))continue;for(let o of Ao(s[2]))t.add(o);for(let o of s[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(o[1])t.add(o[1]);if(o[3])t.add(o[3]);for(let a of(o[2]??"").split(",")){let c=a.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(c))t.add(c)}}}return t}async function Hr(e,t,s,i,o){if(!Xt)Dt(le),Xt=!0;let a=await El(e,t,s,i,o);a=await Gn(a,t,s,i,o),a=await Kn(a,t,s,i,o);let c=[];for(let g=0;g<3;g++){let l=c.length,h=de(a,Ie,(y,S)=>`\x00STX_COMPONENT_COMMENT_${l+S}\x00`,`STX_COMPONENT_COMMENT:${l}`);c.push(...h.tokens);let v=a;if(a=await Jn(h.output,t,s,i,o),a===v)break}if(c.length>0)a=a.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(g,l)=>c[Number(l)]??"");if(i.debug){let g=Vn(a);if(g.length>0)console.warn(`[stx] ${s}: unresolved component tag(s) after render passes: ${g.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return a}
41
+ `||N==="\t"){let _=Ln(e,L+w.length);if(e[_-1]!=="/")k++;A=_+1}else A=L+w.length}else{if(k--,k===0){I=X;break}A=X+C.length}}if(I===-1){o=x;continue}let W=e.slice(x,I),M=I+C.length;i.push({fullMatch:e.slice(c,M),tagName:h,attributes:b,content:W,startIndex:c,endIndex:M,isSelfClosing:!1}),o=M}}return i}function at(e){return e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function Ut(e,t){try{let s=Buffer.from(e,"base64").toString("utf8");return JSON.parse(s)}catch{}try{let s=e.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(s)}catch(s){if(t?.debug)console.error("Error decoding __stx_ prop:",s);return e}}function ct(e,t){let s=0,i="",o=t;while(o<e.length){let a=e[o];if(i){if(a==="\\")o++;else if(a===i)i=""}else if(a==='"'||a==="'"||a==="`")i=a;else if(a==="{")s++;else if(a==="}"){if(s--,s===0)return e.slice(t,o+1)}o++}return e.slice(t)}function Wt(e){let t=e.trim();if(!t.startsWith("{")||!t.endsWith("}"))return null;if(ct(t,0).length!==t.length)return null;return t.slice(1,-1).trim()}var zn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Un=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Wn(e){return lt(e).map((t)=>[t.start,t.end])}function lt(e){let t=[],s=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,i;while((i=s.exec(e))!==null){let o=i[2]||"",a=/(?:^|\s)(?::for|x-for|v-for|@for)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/.exec(o);if(!a)continue;let c=G(a[1]??a[2]??a[3]??""),g=i.index,l=g+i[0].length,h=i[1].toLowerCase();if(i[0].endsWith("/>")||Un.has(h)){t.push({start:g,end:l,names:c});continue}let v=h.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),y=new RegExp(`<\\/?${v}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");y.lastIndex=l;let S=1,x=l,m;while((m=y.exec(e))!==null)if(m[0].startsWith("</")){if(S--,S===0){x=m.index+m[0].length;break}}else if(!m[0].endsWith("/>"))S++;t.push({start:g,end:x,names:c})}return t}function Ft(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((t)=>Ft(t)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,t])=>t).map(([t])=>t).join(" ");return e?String(e):""}function aa(e,t){if(!/:[\w-]+=/.test(e))return e;let s=e,i=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,o=[],a;while((a=i.exec(e))!==null)o.push([a.index,a.index+a[0].length]);o.push(...Wn(e));let c=new Set([...et(t),...Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]]);function g(S){return o.some(([x,m])=>S>=x&&S<m)}let l=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*?)\s*(\/?)>/g,h=[],v=new Map,y=256;while((a=l.exec(s))!==null){if(g(a.index))continue;let S=a[0],x=a[2];if(!x||!x.includes(":"))continue;let m=/(?:^|\s)data-native(?:\s|=|$)/i.test(x.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,w,C=x,k=!1;while((w=b.exec(x))!==null){if(ds(x,w.index,!0)?.kind==="attribute")continue;let A=w[1],I=w[2];if(pc(A))continue;if(z(I,c))continue;if(I.includes("()")&&!I.includes(".get(")||I.includes("$store")||I.includes("$ref"))continue;try{let W=Object.keys(t),M=Object.values(t),L=I.match(/^([a-zA-Z_$][\w$]*)/);if(L&&!W.includes(L[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(L[1]))continue;let X=JSON.stringify([W,I]),N=v.get(X);if(!N){if(N=Function(...W,`return (${I})`),v.size>=y)v.clear();v.set(X,N)}let _=N(...M);if(A==="class"){let O=H(Ft(_));if(O){let B=C.match(/\sclass="([^"]*)"/);if(B)C=C.replace(B[0],()=>` class="${B[1]} ${O}"`);else C=C.replace(w[0],()=>` class="${O}"`)}else C=C.replace(w[0],"");k=!0;continue}if(zn.has(A)){if(_)C=C.replace(w[0],` ${A}`);else C=C.replace(w[0],"");k=!0;continue}if(_===null||_===void 0||_===!1)C=C.replace(w[0],"");else{let O=m&&typeof _==="object"?JSON.stringify(_):String(_),B=mn(A,O);C=C.replace(w[0],()=>` ${A}="${B}"`)}k=!0}catch(W){if(W instanceof oe)throw W;continue}}if(k){let A=a[3]?" /":"",W=`<${a[1]}${C}${A}>`;h.push({start:a.index,end:a.index+S.length,replacement:W})}}if(h.length>0){let S=Array(h.length*2+1),x=0;for(let m=0;m<h.length;m++){let{start:b,end:w,replacement:C}=h[m];S[m*2]=s.slice(x,b),S[m*2+1]=C,x=w}S[h.length*2]=s.slice(x),s=S.join("")}return s}import Ht from"fs";import qt from"path";var Xt=!1;function Fn(e,t,s,i=!1,o=new Set){let a={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},c=new Set(Array.isArray(t.__stx_client_signal_names)?t.__stx_client_signal_names:[]),g=(y)=>{if(c.size===0)return!1;let S=r(y),x=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(x&&c.has(x))return!0;for(let m of c){let b=m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${b}\\s*\\(`).test(S))return!0}return!1},l=new Set(fc),h=(y)=>{if(!y.includes("-")||y.startsWith("@")||y.startsWith(":")||y.startsWith("x-")||y.startsWith("__"))return y;if(y.startsWith("aria-")||y.startsWith("data-"))return y;return y.replace(/-([a-z0-9])/g,(S,x)=>x.toUpperCase())},v=(y,S)=>{let x=h(y);if(a.static[x]=S,x!==y)a.staticNames[x]=y};for(let[y,S]of Object.entries(e)){let x=y.startsWith("x-")&&!l.has(y)&&!y.startsWith("x-bind:")&&!y.startsWith("x-on:")?`:${y.slice(2)}`:y;if(x.startsWith("@")){a.events[x]=S;continue}if(x.startsWith("__stx_")){let m=h(x.slice(6));a.serverDynamic[m]=Ut(S,s);continue}if(x.startsWith(":")){let m=h(x.slice(1)),b=S===se?m:S;if(m==="if"||m==="for"||m==="show"){a.clientReactive[m]=b;continue}if(i){a.clientReactive[m]=b;continue}if(z(b,o)){a.clientReactive[m]=b;continue}if(g(b)){a.clientReactive[m]=b;continue}try{if(!p(b)){if(s.debug)console.error(`Unsafe expression in :${m} binding: ${b}`);a.clientReactive[m]=b;continue}let w=Object.keys(t),C=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),k=new Set(Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[]);if(tt(b).some((M)=>!C.has(M)&&!w.includes(M)&&(!(M in globalThis)||k.has(M)))){a.clientReactive[m]=b;continue}let W=u(b,w)(...Object.values(t));if(a.serverDynamic[m]=W,m!==x.slice(1)&&a.serverDynamicNames)a.serverDynamicNames[m]=x.slice(1)}catch{a.clientReactive[m]=b}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let m=Hn(S,o);if(m!==null){a.clientReactive[h(x)]=m;continue}let b=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(b)try{let w=b[1];if(p(w)){let k=u(w,Object.keys(t))(...Object.values(t));v(x,k!=null?String(k):"")}else{if(s.debug)console.error(`Unsafe expression in ${x}: ${w}`);v(x,S)}}catch(w){if(s.debug)console.error(`Error evaluating expression for ${x}:`,w);v(x,S)}else{let w=S,C=/\{\{\s*([\s\S]+?)\s*\}\}/g,k;while((k=C.exec(S))!==null)try{let A=k[1];if(!p(A)){if(s.debug)console.error(`Unsafe expression in ${x}: ${A}`);continue}let W=u(A,Object.keys(t))(...Object.values(t));w=w.replace(k[0],String(W??""))}catch(A){if(s.debug)console.error(`Error evaluating expression in ${x}:`,A)}v(x,w)}continue}v(x,S===se?"true":at(S))}return a}function Hn(e,t){if(t.size===0)return null;let s=/\{\{\s*([\s\S]+?)\s*\}\}/g,i=[...e.matchAll(s)];if(!i.some((g)=>z(g[1],t)))return null;let o=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(o&&i.length===1)return o[1];let a="",c=0;for(let g of i)a+=e.slice(c,g.index).replace(/[`\\$]/g,(l)=>`\\${l}`),a+=`\${${g[1]}}`,c=g.index+g[0].length;return a+=e.slice(c).replace(/[`\\$]/g,(g)=>`\\${g}`),`\`${a}\``}var qn=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function Xn(e,t,s){if(!e.includes("@"))return e;if(!qn.some(([o,a])=>o.test(e)&&e.includes(a)))return e;try{return ne(e,t,s)}catch{return e}}function me(e){let t={},s=0,i=e.length;while(s<i){while(s<i&&/\s/.test(e[s]))s++;if(s>=i)break;let o="";while(s<i&&!/[\s=]/.test(e[s]))o+=e[s],s++;if(!o)break;while(s<i&&/\s/.test(e[s]))s++;if(s<i&&e[s]==="="){s++;while(s<i&&/\s/.test(e[s]))s++;let a="";if(s<i&&(e[s]==='"'||e[s]==="'")){let c=e[s];s++;while(s<i){let g=e[s];if(g==="\\"&&s+1<i){s++,a+=e[s],s++;continue}if(g===c){s++;break}a+=g,s++}}else if(e[s]==="{"){a=ct(e,s),s+=a.length;let c=Wt(a);if(c!==null){t[`:${o}`]=c;continue}}else while(s<i&&!/\s/.test(e[s]))a+=e[s],s++;t[o]=a}else t[o]=se}return t}function Zt(e){return Object.entries(e).map(([t,s])=>s===se?t:`${t}="${Zn(s)}"`).join(" ")}function Zn(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Vn(e){let t=new Set,s=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,i;while((i=s.exec(e))!==null){let o=i[1];if(le.isBuiltin(o))t.add(o)}return[...t].sort()}async function El(e,t,s,i,o){if(!/import\s/.test(e))return e;if(!t.__importedComponents)t.__importedComponents=new Map;let a=t.__importedComponents,c=qt.dirname(s),g=[],l=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let y of e.matchAll(l)){let[S,x,m]=y,b=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,w=m,C,k=[];while((C=b.exec(m))!==null){let[A,I,W,M]=C,L=null,X=null;if(M.startsWith(".")||M.startsWith("/")){let O=qt.resolve(c,M);if(O.endsWith(".stx"))X=O;else{let B=`${O}.stx`;try{if(Ht.statSync(B).isFile())X=B}catch{try{if(Ht.statSync(O).isDirectory())L=O}catch{}}}}else L=cs(M,c);if(!L&&!X)continue;let N=!1,_=(O,B)=>{a.set(O,B),a.set(O.toLowerCase(),B);let U=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();a.set(U,B),o.add(B)};if(W&&X)_(W,X),N=!0;else if(I){let O=I.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean).map((U)=>{let V=U.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(V)return{source:V[1],local:V[2]};return{source:U,local:U}}),B=L?as(L):null;for(let{source:U,local:V}of O){let D=null;if(X)D=X;else if(B)D=B.get(U)??B.get(U.toLowerCase())??B.get(U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)_(V,D),N=!0}}if(N)k.push({start:C.index,end:C.index+A.length})}if(k.length===0)continue;for(let A=k.length-1;A>=0;A--)w=w.slice(0,k[A].start)+w.slice(k[A].end);g.push({start:y.index,end:y.index+S.length,value:`<script${x}>${w}</script>`})}if(g.length===0)return e;let h=[],v=0;for(let y of g)h.push(e.slice(v,y.start),y.value),v=y.end;return h.push(e.slice(v)),h.join("")}async function Gn(e,t,s,i,o){let a=e;if(!t.__importedComponents)t.__importedComponents=new Map;let c=t.__importedComponents,g=/@import\s*\(\s*([^)]+)\s*\)/g,l;while((l=g.exec(a))!==null){let[h,v]=l,y=v.split(",").map((S)=>S.trim().replace(/^['"]|['"]$/g,"")).filter((S)=>S.length>0);for(let S of y){let x=S.split("/"),b=x[x.length-1].replace(/\.stx$/,""),w=b.includes("-")?b.split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(""):b.charAt(0).toUpperCase()+b.slice(1),C=null,k=ls(S,s,i);for(let A of k)try{if(await Bun.file(A).exists()){C=A;break}}catch{}if(C){c.set(w,C),c.set(b,C),c.set(b.toLowerCase(),C);let A=w.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(c.set(A,C),o.add(C),i.debug)console.log(`Imported component: ${w} -> ${C}`)}else if(i.debug)console.warn(`Could not resolve imported component: ${S}`)}a=a.replace(h,""),g.lastIndex=0}return a}async function Kn(e,t,s,i,o){let a=e,c=i.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let g=t.__processedComponents,l=/@component\s*\(/g,h;while((h=l.exec(a))!==null){let v=h.index,y=v+h[0].length-1,S=1,x=y+1;while(x<a.length&&S>0){if(a[x]==="(")S++;else if(a[x]===")"){if(S--,S===0)break}x++}if(S!==0)break;let m=a.substring(y+1,x),b=x+1,w=m.match(/^\s*['"]([^'"]+)['"]/);if(!w){l.lastIndex=0;continue}let C=w[1],k,A=m.slice(w[0].length),I=A.match(/^\s*,\s*/);if(I)k=A.slice(I[0].length).trim();let W={};if(k)try{W=E(k,t)}catch(O){let B=O instanceof Error?O.message:String(O);a=a.replace(a.substring(v,b),`[Error parsing component props: ${B}]`);continue}let M="",L=b,N=a.substring(b).match(/^([\s\S]*?)@endcomponent/);if(N)M=N[1].trim(),L=b+N[0].length;let _=await je(C,W,M,c,t,s,i,g,o);a=a.substring(0,v)+_+a.substring(L),l.lastIndex=0}return a}async function Jn(e,t,s,i,o){if(!e)return e;let a=e,c=i.componentsDir||"components";if(!t.__processedComponents)t.__processedComponents=new Set;let g=t.__processedComponents,l=er(a);if(l.size>0){let b=Array.isArray(t.__stx_client_declared_names)?t.__stx_client_declared_names:[];t.__stx_client_declared_names=[...new Set([...b,...l])]}let h=K(a);a=h.output;let v=et(t);return a=await m(a,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),a=await m(a,/[A-Z][a-zA-Z0-9]*/,!0,Lt(lr)),a=await m(a,/[a-z][a-z0-9]*/,!1,lr),a=h.restore(a),a;async function m(b,w,C,k){if(!b)return b;let A=b,I=zt(A,w,k),W=lt(A),M=new Map;for(let N=I.length-1;N>=0;N--){let _=I[N],O=C?j(_.tagName):_.tagName,B=me(Xn(_.attributes,t,s)),U=W.filter(({start:Z,end:P})=>_.startIndex>=Z&&_.startIndex<P),V=U.length>0,D=new Set(v);for(let Z of U)for(let P of Z.names)D.add(P);let F=Fn(B,t,i,V,D);if(typeof F.clientReactive.for==="string")for(let Z of G(F.clientReactive.for))D.add(Z);let ce=le.getBuiltin(_.tagName),we=ce?await pr(_.tagName,c,t,s,i):!1;if(ce&&!we){let Z={context:t,filePath:s,options:i,dependencies:o},P=ce.render(F,_.content,Z);if(Object.keys(F.events).length>0){let q=Zt(F.events);P=P.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${q}`)}if(Object.keys(F.clientReactive).length>0)P=Vt(P,F.clientReactive);M.set(N,P);continue}if(!C&&_.tagName.includes("-")&&!await pr(O,c,t,s,i))continue;let Y={};for(let[Z,P]of Object.entries(F.static))Y[Z]=P;for(let[Z,P]of Object.entries(F.serverDynamic))Y[Z]=P;let re={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(F.clientReactive),events:Object.keys(F.events)},T=await je(O,Y,h.restore(_.content),c,t,s,i,g,o,[...D],re,_.tagName);if(T=Yn(T,F,re.declaredProps,re.consumedProps,i._nativeHostAttrs),i._nativeHostAttrs){let Z=re.reactiveProps.filter((te)=>!re.consumedProps.has(te)&&!["if","for","show","key","ref"].includes(te)).map(j),P=ut(T,!0);if(Z.length&&P){if(!Object.hasOwn(me(T.slice(P.insertPos,P.tagEnd)),"data-stx-native-host-root"))T=T.slice(0,P.insertPos)+' data-stx-native-host-root="true"'+T.slice(P.insertPos);let te=ve(T);T=T.slice(0,te.insertPos)+` data-stx-native-forward="${Z.join(" ")}"`+T.slice(te.insertPos)}let q=ut(T,!0);if(q){let te=me(T.slice(q.insertPos,q.tagEnd)),Se=ve(T),Kt=me(T.slice(Se.insertPos,Se.tagEnd));if(Object.hasOwn(te,"data-stx-native-host-root")&&!Object.hasOwn(Kt,"data-stx-native-host-owner"))T=T.slice(0,Se.insertPos)+" data-stx-native-host-owner"+T.slice(Se.insertPos)}}if(Object.keys(F.events).length>0){let Z=ve(T);if(Z){let P=Zt(F.events),q=Object.keys(F.events).map((te)=>te.replace(/^@/,"").split(".")[0]).join(" ");T=T.substring(0,Z.insertPos)+` data-stx-parent-events="${q}" ${P}`+T.substring(Z.insertPos)}}if(Object.keys(F.clientReactive).length>0)T=Vt(T,F.clientReactive);M.set(N,T)}if(M.size===0)return A;let L="",X=0;for(let N=0;N<I.length;N++){let _=M.get(N);if(_===void 0)continue;L+=A.slice(X,I[N].startIndex),L+=_,X=I[N].endIndex}return L+=A.slice(X),L}}function Vt(e,t){let s=new Set(["if","for"]),i=new Set(["show"]),o=Object.entries(t).filter(([v])=>!s.has(v)),a=o.filter(([v])=>!i.has(v)).map(([v])=>j(v)).join(" "),c=e,g=o.length>0?ve(c):null;if(g){let v=o.map(([S,x])=>`:${j(S)}="${x.replace(/"/g,"&quot;")}"`).join(" "),y=a?` data-stx-parent-bindings="${a}"`:"";c=c.substring(0,g.insertPos)+`${y} ${v}`+c.substring(g.insertPos)}let l=t.if;if(l)c=`<template :if="${l.replace(/"/g,"&quot;")}">${c}</template>`;let h=t.for;if(h){let v=t.key,y=v?` :key="${v.replace(/"/g,"&quot;")}"`:"";c=`<template :for="${h.replace(/"/g,"&quot;")}"${y}>${c}</template>`}return c}function Yn(e,t,s=new Set,i=new Set,o=!1){let a=ut(e,o);if(!a)return e;let c=e.slice(a.insertPos,a.tagEnd),g=t.serverDynamic.class??t.static.class;if(o&&typeof g==="string"&&g&&!i.has("class")){let m=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,b=m.test(c)?c.replace(m,(w,C,k,A,I)=>`${C}class="${R(`${at(k??A??I)} ${g}`)}"`):` class="${R(g)}"${c}`;e=e.slice(0,a.insertPos)+b+e.slice(a.tagEnd),a.tagEnd+=b.length-c.length,c=b}let l=o||/\bdata-native(?:\s|=)/i.test(c),h=l?i:s,v=new Set(Object.keys(me(c))),y=new Set(["class","className"]);for(let m of Object.keys(t.static)){let b=t.staticNames[m]??m;if(v.has(b)||h.has(m)||!l&&!Fe(b))y.add(m)}for(let m of Object.keys(t.serverDynamic)){let b=t.serverDynamicNames?.[m]??m;if(v.has(b)||h.has(m)||!l&&!Fe(b))y.add(m)}let S=[];if(l){for(let[m,b]of Object.entries(t.static)){if(y.has(m)||b!==!0&&b!==se)continue;y.add(m),S.push(`${R(t.staticNames?.[m]??m)}="true"`)}for(let[m,b]of Object.entries(t.serverDynamic)){if(y.has(m)||b!==!0)continue;y.add(m),S.push(`${R(t.serverDynamicNames?.[m]??m)}="true"`)}}let x=[...ie(t,y),...ae(t,y),...S];if(l){for(let[m,b]of Object.entries(t.serverDynamic)){if(y.has(m)||b!==!1)continue;let w=t.serverDynamicNames?.[m]??m;x.push(`${R(w)}="false"`)}for(let[m,b]of Object.entries(t.serverDynamic)){if(y.has(m)||b===null||typeof b!=="object")continue;let w=JSON.stringify(b);if(w!==void 0){let C=t.serverDynamicNames?.[m]??m;x.push(`${R(C)}="${R(w)}"`)}}}if(x.length===0)return e;return`${e.slice(0,a.insertPos)} ${x.join(" ")}${e.slice(a.insertPos)}`}function ve(e){let t=Gt(e,0);if(t)return t;let s=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(s)return{insertPos:s.index+1+s[1].length,tagEnd:ft(e,s.index+1+s[1].length)};return null}function ut(e,t=!1){let s=ve(e);if(!s)return null;let i=e.slice(s.insertPos,s.tagEnd),o=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(i)?Gt(e,s.tagEnd+1):s;return o&&t?Qn(e,o)??o:o}function Qn(e,t){if(!e.includes("data-stx-native-host-root"))return null;let s=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),i=e.lastIndexOf("<",t.insertPos),o=0,a;while(i>=0&&i<e.length){if(e.startsWith("<!--",i)){let v=e.indexOf("-->",i+4);if(v<0)return null;i=e.indexOf("<",v+3);continue}let c=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(i));if(!c){i=e.indexOf("<",i+1);continue}let g=c[2].toLowerCase(),l=i+c[0].length,h=ft(e,l);if(c[1]){if(o--,a!==void 0&&o<a)a=void 0;if(o<=0)return null}else if(g==="script"||g==="style"){let v=new RegExp(`</${g}\\s*>`,"gi");if(v.lastIndex=h+1,!v.exec(e))return null;i=e.indexOf("<",v.lastIndex);continue}else{let v=me(e.slice(l,h)),y=o>0&&(Object.hasOwn(v,"data-stx-component-wrapper")||Object.hasOwn(v,"data-stx-native-host-owner"));if(a===void 0&&!y&&Object.hasOwn(v,"data-stx-native-host-root"))return{insertPos:l,tagEnd:h};if(!s.has(g)&&e[h-1]!=="/"){if(o++,a===void 0&&y)a=o}else if(o===0)return null}i=e.indexOf("<",h+1)}return null}function Gt(e,t){let s=t;while(s<e.length){let i=e.slice(s),o=i.match(/^\s+/);if(o){s+=o[0].length;continue}if(i.startsWith("<!--")){let g=e.indexOf("-->",s+4);if(g===-1)return null;s=g+3;continue}let a=i.match(/^<(script|style)\b[^>]*>/i);if(a){let g=`</${a[1].toLowerCase()}>`,l=e.toLowerCase().indexOf(g,s+a[0].length);if(l===-1)return null;s=l+g.length;continue}let c=i.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!c)return null;return{insertPos:s+1+c[1].length,tagEnd:ft(e,s+1+c[1].length)}}return null}function ft(e,t){let s="";for(let i=t;i<e.length;i++){let o=e[i];if(s){if(o==="\\")i++;else if(o===s)s=""}else if(o==='"'||o==="'")s=o;else if(o===">")return i}return e.length}function er(e){let t=new Set;for(let s of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let i=s[1];if(!/\bclient\b/.test(i)||/\bserver\b/.test(i))continue;for(let o of Ao(s[2]))t.add(o);for(let o of s[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(o[1])t.add(o[1]);if(o[3])t.add(o[3]);for(let a of(o[2]??"").split(",")){let c=a.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(c))t.add(c)}}}return t}async function Hr(e,t,s,i,o){if(!Xt)Dt(le),Xt=!0;let a=await El(e,t,s,i,o);a=await Gn(a,t,s,i,o),a=await Kn(a,t,s,i,o);let c=[];for(let g=0;g<3;g++){let l=c.length,h=de(a,Ie,(y,S)=>`\x00STX_COMPONENT_COMMENT_${l+S}\x00`,`STX_COMPONENT_COMMENT:${l}`);c.push(...h.tokens);let v=a;if(a=await Jn(h.output,t,s,i,o),a===v)break}if(c.length>0)a=a.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(g,l)=>c[Number(l)]??"");if(i.debug){let g=Vn(a);if(g.length>0)console.warn(`[stx] ${s}: unresolved component tag(s) after render passes: ${g.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return a}
42
42
  export{no,ro,so,gp,zr,mp,aa,El,Hr};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ft,Dn,qd}from"./chunk-tmqrbs98.js";import{ce,Mn,Kd,Ln,Ws,Nr,Dr,Gd,Xd,Jd,jn,Bn,qs,Mr,Yd}from"./chunk-p9az13b2.js";import"./chunk-78yjmbbs.js";export{Ws as batch,qd as default,Mn as derived,Ln as effect,ft as generateSignalsRuntime,Dn as generateSignalsRuntimeDev,Bn as isDerived,jn as isSignal,Kd as memo,Dr as onDestroy,Nr as onMount,Mr as peek,Jd as pendingLifecycleCounts,Xd as runDestroyCallbacks,Gd as runMountCallbacks,ce as state,qs as untrack,Yd as useOptimistic};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{_c,Cc}from"./chunk-1nrz39tr.js";import"./chunk-0rpr2aax.js";import"./chunk-rza3yydb.js";import"./chunk-mn47s2ef.js";import"./chunk-bh19ezq0.js";import"./chunk-hg9dxba9.js";import"./chunk-6ycyaf5g.js";import"./chunk-fjtffqf9.js";import"./chunk-mgk7bwb3.js";import"./chunk-n8wvqnfc.js";import"./chunk-1b9thkg5.js";import"./chunk-zvr3r5p0.js";import"./chunk-wr1gm35v.js";import"./chunk-efpd1yyg.js";import"./chunk-x4q4bx3q.js";import"./chunk-kxj8e1gd.js";import"./chunk-ga5kjf9b.js";import"./chunk-wwgh5ae7.js";import"./chunk-q4rejyd2.js";import"./chunk-dx037j0p.js";import"./chunk-wscnjtss.js";import"./chunk-k06n5bjp.js";import"./chunk-5z0q3qv3.js";import"./chunk-78x52gz3.js";import"./chunk-4fhbh04h.js";import"./chunk-x7wr720m.js";import"./chunk-n46pv8kp.js";import"./chunk-vdsf1yrt.js";import"./chunk-tmqrbs98.js";import"./chunk-m46bj8c8.js";import"./chunk-qr7a378v.js";import"./chunk-97h9ga3b.js";import{Gt}from"./chunk-4tn437tn.js";import"./chunk-x5v3rqbn.js";import"./chunk-aypmc7qg.js";import"./chunk-374nhgyf.js";import{$e,o}from"./chunk-b4709e09.js";import"./chunk-x5sjsf3b.js";import"./chunk-078qg8r5.js";import"./chunk-gjdpdvw5.js";import"./chunk-tqc86aaw.js";import"./chunk-r9p7r6mx.js";import"./chunk-xnx06qqt.js";import"./chunk-mhacarm5.js";import{ye}from"./chunk-hh2dcnsx.js";import"./chunk-dxh45gve.js";import{Zn,Qn}from"./chunk-scgn8dmx.js";import{Xr,N,i}from"./chunk-2t51tpkc.js";import"./chunk-hejx7gbs.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import{g,De}from"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";import"./chunk-vg1pg6yt.js";import"./chunk-vd5w1jaz.js";export{Xr as buildWebComponents,Qn as cacheTemplate,Zn as checkCache,Gt as classifyAllScripts,_c as createMiddleware,Cc as createRoute,N as defaultConfig,g as extractVariables,ye as injectRouterScript,i as loadStxConfig,De as processClientScript,o as processDirectives,$e as readMarkdownFile};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{B}from"./chunk-3vwkyjan.js";import{Be,A,Nt}from"./chunk-9wdd7eq6.js";import{ut,ke,O,_e,Ii,Hs,Oi,Cn}from"./chunk-gc4w2s5n.js";import{vt,le,Ye}from"./chunk-f26n6y9p.js";import{Zs}from"./chunk-54fazdmn.js";import{En}from"./chunk-wav0xbnb.js";import{he}from"./chunk-4e5jrxbn.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function kn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ke(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Pu(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Ii(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=En(r.routeRules),f=new G,h=Zs(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Nt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ye(i.html)),M.set(n.pattern,he(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Nt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=le(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return kn(n,await Be(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=ke(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Hs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Cn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Oi(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-855h3crg.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Ye(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",he(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?_e(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Ye(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",he(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(_e(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
2
+ import{B}from"./chunk-7dnpjrqp.js";import{Be,A,Nt}from"./chunk-9wdd7eq6.js";import{ut,ke,O,_e,Ii,Hs,Oi,Cn}from"./chunk-mgk7bwb3.js";import{vt,le,Ye}from"./chunk-f26n6y9p.js";import{Zs}from"./chunk-aypmc7qg.js";import{En}from"./chunk-wav0xbnb.js";import{he}from"./chunk-hh2dcnsx.js";import Z from"fs";import T from"path";var{serve:ce}=globalThis.Bun;import F from"zlib";import{promisify as Q}from"util";var K=Q(F.brotliCompress),ee=Q(F.gzip),te=["text/","application/json","application/javascript","application/xml","application/xhtml+xml","application/rss+xml","application/atom+xml","application/manifest+json","image/svg+xml"],ne=["text/event-stream","multipart/x-mixed-replace"],re=1024;function se(t){if(!t)return!1;let e=t.toLowerCase();if(ne.some((o)=>e.startsWith(o)))return!1;return te.some((o)=>e.startsWith(o))}function oe(t){let e=new Map;for(let o of t.split(",")){let[r,...a]=o.trim().split(";"),f=r.trim().toLowerCase();if(!f)continue;let h=1;for(let g of a){let l=/^\s*q\s*=\s*([\d.]+)\s*$/i.exec(g);if(!l)continue;let m=Number.parseFloat(l[1]);if(Number.isFinite(m))h=m}e.set(f,h)}return e}function ae(t){if(!t)return null;let e=oe(t),o=e.get("*"),r=(a)=>e.get(a)??o??0;if(r("br")>0)return"br";if(r("gzip")>0)return"gzip";return null}var Y=33554432,H=new Map,U=0;function ie(t,e){if(e.length>Y/8)return;H.set(t,e),U+=e.length;for(let[o,r]of H){if(U<=Y)break;H.delete(o),U-=r.length}}async function kn(t,e,o={}){if(e.headers.get("content-encoding"))return e;if(e.status===204||e.status===304||!e.body)return e;if(!se(e.headers.get("content-type")))return e;let r=ae(t.headers.get("accept-encoding"));if(!r)return e;let a;try{a=new Uint8Array(await e.arrayBuffer())}catch{return e}let f=()=>new Response(a,{status:e.status,statusText:e.statusText,headers:J(e.headers)});if(a.length<(o.threshold??re))return f();try{let h=o.quality??5,g=`${r}:${h}:${a.length}:${Bun.hash(a)}`,l=H.get(g);if(!l)l=r==="br"?await K(a,{params:{[F.constants.BROTLI_PARAM_QUALITY]:h,[F.constants.BROTLI_PARAM_SIZE_HINT]:a.length}}):await ee(a),ie(g,l);if(l.length>=a.length)return f();let m=J(e.headers);return m.set("Content-Encoding",r),m.set("Content-Length",String(l.length)),new Response(l,{status:e.status,statusText:e.statusText,headers:m})}catch{return f()}}function J(t){let e=new Headers(t),o=e.get("Vary");if(!o)return e.set("Vary","Accept-Encoding"),e;if(!o.split(",").some((a)=>a.trim().toLowerCase()==="accept-encoding"))e.set("Vary",`${o}, Accept-Encoding`);return e}class G{now;entries=new B(1000,{maxBytes:33554432,sizeOf:(t)=>t.body.byteLength+JSON.stringify(t.headers).length*2});pending=new Map;generation=0;constructor(t=Date.now){this.now=t}invalidate(t){this.generation++,this.pending.clear();for(let e of Array.from(this.entries.keys()))if(t===void 0||this.entries.get(e)?.path===t)this.entries.delete(e)}async respond(t,e,o){let r,a=async()=>{let s=r??await o();return s.headers.set("Cache-Control","private, no-store"),s.headers.set("Vary",O(s.headers.get("Vary")).Vary),s};if(!e||t.method!=="GET"||t.headers.has("Cookie")||t.headers.has("Authorization")||t.headers.has("Range"))return a();let f=new URL(t.url),h=`${f.origin}${f.pathname}${f.search}|${ke(t)?"fragment":"document"}`,g=this.entries.get(h),l=(s)=>{let b=new Headers(s.headers);return b.set("Cache-Control","private, no-store"),b.set("Age",String(Math.max(0,Math.floor((this.now()-s.created)/1000)))),new Response(s.body.slice(0),{headers:b})},m=g?(this.now()-g.created)/1000:1/0;if(g&&m<e.maxAge)return l(g);let v=this.generation,N=async()=>{let s=await o();r=s;let b=(s.headers.get("Vary")??"").toLowerCase().split(",").map((y)=>y.trim()).filter(Boolean);if(s.status!==200||s.headers.has("Set-Cookie")||/(?:private|no-store|no-cache)/i.test(s.headers.get("Cache-Control")??"")||b.some((y)=>y!=="x-stx-router"&&y!=="accept-encoding"))return null;let E=await s.clone().arrayBuffer();if(E.byteLength>1048576)return null;s.headers.set("Vary",O(s.headers.get("Vary")).Vary);let n={body:E,headers:Array.from(s.headers.entries()),created:this.now(),path:f.pathname};if(this.generation===v)this.entries.set(h,n);return n},x=this.pending.get(h);if(!x){if(this.pending.size>=1000)return a();x=N().finally(()=>{if(this.pending.get(h)===x)this.pending.delete(h)}),this.pending.set(h,x)}if(g&&m<e.maxAge+(e.swr??0))return x.catch(()=>{}),l(g);let M=await x;return M?l(M):a()}}var pe={".js":"application/javascript",".mjs":"application/javascript",".css":"text/css",".json":"application/json",".html":"text/html",".txt":"text/plain",".xml":"application/xml",".pdf":"application/pdf",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".avif":"image/avif",".svg":"image/svg+xml",".ico":"image/x-icon",".bmp":"image/bmp",".mp4":"video/mp4",".webm":"video/webm",".ogg":"audio/ogg",".mp3":"audio/mpeg",".wav":"audio/wav",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"};async function Pu(t={}){let e=T.resolve(t.outputDir||".output"),o=t.port??3000,r=Ii(e);if(!r)console.error("[stx] No build manifest found. Run `stx build` first."),process.exit(1);console.log(`[stx] Production server loading ${r.routes.length} routes...`);let a=En(r.routeRules),f=new G,h=Zs(e,r.apiRoutes??[]),g=Bun.file(T.join(e,"server/runtime-config.json")),l=t.runtimeConfig??(await g.exists()?await g.json():void 0),m=l?A(l):void 0,v=new Map,N=new Map,x=new Map,M=new Map;for(let n of r.routes)try{let y=T.join(e,n.compiledPath),i=JSON.parse(await Bun.file(y).text());if(m)i.html=Nt(i.html,m);v.set(n.pattern,i),x.set(n.pattern,Ye(i.html)),M.set(n.pattern,he(i.html));let X=T.join(e,n.fragmentPath);if(await Bun.file(X).exists()){let P=await Bun.file(X).text();N.set(n.pattern,m?Nt(P,m):P)}}catch(y){console.warn(`[stx] Failed to load route ${n.pattern}:`,y)}let s=new Map,b=[];for(let n of r.routes)if(n.hasParams){let{regex:y,params:i}=le(n.pattern,{page:!0});b.push({regex:y,route:n,paramNames:i})}else s.set(n.pattern,n);let E=ce({port:o,async fetch(n){return kn(n,await Be(m??A(),async()=>{let i=new URL(n.url).pathname;if(t.onRequest){let p=await t.onRequest(n);if(p)return p}if(t.apiRouter){let p=await t.apiRouter.handleRequest(n);if(p.status!==404)return p}if(t.apiRoutes?.[i])return t.apiRoutes[i](n);let X=await h(n);if(X)return X;if((n.method==="GET"||n.method==="HEAD")&&i!=="/"){let p=T.resolve(e,"public"),d;try{d=decodeURIComponent(i)}catch{d=i}if(!d.includes("\x00")){let u=T.resolve(p,`.${d}`);if(u===p||u.startsWith(`${p}${T.sep}`))try{if(Z.existsSync(u)&&Z.statSync(u).isFile()){let R=T.extname(u).toLowerCase(),L=pe[R]||"application/octet-stream",_=i.startsWith("/__stx/")||/\.[0-9a-f]{8}\./.test(i);return new Response(Bun.file(u),{headers:{"Content-Type":L,"Cache-Control":_?"public, max-age=31536000, immutable":"public, max-age=3600"}})}}catch{}}}let P=ke(n),C=null,q={};if(C=s.get(i)||null,!C)for(let{regex:p,route:d,paramNames:u}of b){let c=i.match(p);if(c){C=d,u.forEach((R,L)=>{q[R]=c[L+1]});break}}if(!C){let p=vt(i)?null:s.get("/404")||null;if(p){let d=v.get(p.pattern);if(d)return new Response(d.html,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain; charset=utf-8"}})}let k=a(i),W=Object.keys(k).length>0;return f.respond(n,k.cache,async()=>{let p=v.get(C.pattern);if(P&&n.method==="GET"&&p&&!p.hasServerScripts&&Object.keys(p.placeholders).length===0){let c=N.get(C.pattern);if(c){let R=x.get(C.pattern);return new Response(c,{status:p.status??200,headers:{"Content-Type":"text/html","X-STX-Fragment":"true",...M.has(C.pattern)?{"X-STX-Runtime":M.get(C.pattern)?"true":"false"}:{},...R?{"X-STX-Layout":R.layout,"X-STX-Layout-Group":R.group}:{},...O(),...k.cache?{}:{"Cache-Control":ut}}})}}let d=Hs(n.method),u=v.get(C.pattern);if(!u){let c=s.get("/500")||null;if(c){let R=v.get(c.pattern);if(R)return new Response(R.html,{status:500,headers:{"Content-Type":"text/html"}})}return new Response("Internal Server Error",{status:500})}if(C.prerendered&&d)return new Response("Prerendered pages do not accept actions",{status:405,headers:{Allow:"GET, HEAD"}});if(!d&&!u.hasServerScripts&&Object.keys(u.placeholders).length===0)return new Response(u.html,{status:u.status??200,headers:{"Content-Type":"text/html",...O(),"Cache-Control":"public, max-age=60"}});try{let{html:c,boundaries:R,redirect:L,cookies:_,status:I,headers:D}=await Cn(u,{params:q,request:n,method:n.method,__stx_strict_hydration:W,__stx_runtime_config:m});if(L)return Oi(L,_,D);if(R&&R.length>0){let{renderStreamingPage:S,streamToResponse:z}=await import("./chunk-fp3a3gmr.js"),j=new Headers({...O(),...D,"Cache-Control":"private, no-store"});for(let V of _??[])j.append("Set-Cookie",V);if(P&&!d){let V=Ye(c);j.set("X-STX-Fragment","true"),j.set("X-STX-Runtime",he(c)?"true":"false"),j.set("X-STX-Layout",V.layout),j.set("X-STX-Layout-Group",V.group)}return z(S(P&&!d?_e(c,r.routerContainer||"main"):c,R,{timeoutMs:30000}),{status:I??u.status??200,headers:j})}let w=new Headers({"Content-Type":"text/html",...O(),...k.cache?{}:{"Cache-Control":"private, no-store"}});for(let S of _??[])w.append("Set-Cookie",S);for(let[S,z]of Object.entries(D??{}))w.set(S,z);if(w.set("Vary",O(w.get("Vary")).Vary),P&&!d){let S=Ye(c);return w.set("X-STX-Fragment","true"),w.set("X-STX-Runtime",he(c)?"true":"false"),w.set("X-STX-Layout",S.layout),w.set("X-STX-Layout-Group",S.group),new Response(_e(c,r.routerContainer||"main"),{status:I??u.status??200,headers:w})}return new Response(c,{status:I??u.status??200,headers:w})}catch(c){if(console.error(`[stx] Hydration error for ${i}:`,c),W)return new Response("Internal Server Error",{status:500});return new Response(u.html,{headers:{"Content-Type":"text/html"}})}})}))}});return console.log(`[stx] Production server running at http://localhost:${E.port}`),console.log(`[stx] Serving ${r.routes.length} routes (${v.size} pre-loaded)`),{port:E.port,stop:()=>{f.invalidate(),E.stop()},invalidate:(n)=>f.invalidate(n)}}
3
3
  export{kn,Pu};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ra,n,pe}from"./chunk-3vwkyjan.js";import{Qe}from"./chunk-yn9kvsk1.js";import{c}from"./chunk-mf19qxgv.js";import o from"fs";import l from"path";var Rl=new Map,m=new Map;async function yp(e){let r;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){r=s;break}throw m.delete(e),Error(`File not found: ${e}${r?` (${r.message})`:""}`)}function bp(e){m.delete(e)}function vp(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function wp(e){x=e}async function Al(e=!1){let t=x??await import("./chunk-7s6hypn5.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Pl(){if(S===null){let{getRouterScript:e}=await import("./chunk-hamk3dky.js");S=e()}return S}var y={};async function xp(e,t=!1){let r=e==="runtime"?await Al(t):await Pl(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==r)s={content:r,hash:Bun.hash(r).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:r,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function Sp(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),r=u.get(t),i=r!==void 0;if(i)u.delete(t),p-=r.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let s=u.keys().next().value;p-=u.get(s).length*2,u.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(l.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function go(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function kp(){m.clear(),pe(),Ra(),f=null,B=null,S=null}function v(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,rawParams:r.rawParams===!0,handler:String(r.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Zn(e,t){try{if(!t.cachePath)return null;let r=l.resolve(t.cachePath),i=l.join(r,`${Kr(e)}.html`),s=l.join(r,`${Kr(e)}.meta.json`);if(!await n(i)||!await n(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==Qe())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await n(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(r){return console.warn(`Cache error for ${e}:`,r),null}}async function Qn(e,t,r,i){try{if(!i.cachePath)return;let s=l.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=l.join(s,`${Kr(e)}.html`),a=l.join(s,`${Kr(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(r),cacheVersion:i.cacheVersion,engine:Qe(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Rl.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:r})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function Kr(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
- export{Rl,yp,bp,vp,wp,Al,Pl,xp,Sp,go,kp,Zn,Qn,Kr};
2
+ import{Ra,n,pe}from"./chunk-7dnpjrqp.js";import{Qe}from"./chunk-yn9kvsk1.js";import{c}from"./chunk-mf19qxgv.js";import o from"fs";import l from"path";var Rl=new Map,m=new Map;async function yp(e){let r;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){r=s;break}throw m.delete(e),Error(`File not found: ${e}${r?` (${r.message})`:""}`)}function bp(e){m.delete(e)}function vp(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function wp(e){x=e}async function Al(e=!1){let t=x??await import("./chunk-rc79yyqx.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Pl(){if(S===null){let{getRouterScript:e}=await import("./chunk-hamk3dky.js");S=e()}return S}var y={};async function xp(e,t=!1){let r=e==="runtime"?await Al(t):await Pl(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==r)s={content:r,hash:Bun.hash(r).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:r,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,u=new Map,p=0;function C(e){return c(process.cwd(),"module-bundles",`${e}.js`)}function Sp(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),r=u.get(t),i=r!==void 0;if(i)u.delete(t),p-=r.length*2;u.set(t,e),p+=e.length*2;while(u.size>1&&(u.size>E||p>T)){let s=u.keys().next().value;p-=u.get(s).length*2,u.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(l.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function go(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=u.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function kp(){m.clear(),pe(),Ra(),f=null,B=null,S=null}function v(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,rawParams:r.rawParams===!0,handler:String(r.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function Zn(e,t){try{if(!t.cachePath)return null;let r=l.resolve(t.cachePath),i=l.join(r,`${Gr(e)}.html`),s=l.join(r,`${Gr(e)}.meta.json`);if(!await n(i)||!await n(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==Qe())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await n(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(r){return console.warn(`Cache error for ${e}:`,r),null}}async function Qn(e,t,r,i){try{if(!i.cachePath)return;let s=l.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=l.join(s,`${Gr(e)}.html`),a=l.join(s,`${Gr(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(r),cacheVersion:i.cacheVersion,engine:Qe(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),Rl.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:r})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function Gr(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
3
+ export{Rl,yp,bp,vp,wp,Al,Pl,xp,Sp,go,kp,Zn,Qn,Gr};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ji,sl,On,sd,ol,il,al,od}from"./chunk-xdn6rtq2.js";import"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{On as Validator,sl as defineForm,ol as processErrorDirective,il as processErrorsDirective,od as processFormValidationDirectives,al as processHasErrorsDirective,ji as useForm,sd as v};
2
+ import{ji,sl,On,sd,ol,il,al,od}from"./chunk-wwgh5ae7.js";import"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{On as Validator,sl as defineForm,ol as processErrorDirective,il as processErrorsDirective,od as processFormValidationDirectives,al as processHasErrorsDirective,ji as useForm,sd as v};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{El,Hr}from"./chunk-r9p7r6mx.js";import"./chunk-xnx06qqt.js";import"./chunk-dxh45gve.js";import{ur}from"./chunk-7dnpjrqp.js";import"./chunk-wkkmk4aa.js";import"./chunk-9wdd7eq6.js";import{tt}from"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{tt as freeIdentifiers,Hr as processComponents,El as processESImports,ur as rendersAsElement};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{gc,mc,hc}from"./chunk-78yjmbbs.js";import{ce,Mn,Ln,Ws,Nr,Dr,jn,Bn,qs,Mr}from"./chunk-9ybjsfyp.js";function z(t,a,i,r,d,y){let o=!0,u=new Set,h=(p)=>r.get?r.get(p):p,l=()=>h(t());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:a}),l.set=(p)=>{if(!o)return;let f=a(),e=r.set?r.set(p,f):p;if(f.trim&&typeof e==="string")e=e.trim();if(f.number&&typeof e==="string"&&e!==""){let s=Number(e);if(!Number.isNaN(s))e=s}if(Object.is(t(),e))return;t.set(e),i(e)},l.update=(p)=>l.set(p(l())),l.input=(p)=>{if(!a().lazy)l.set(p)},l.change=(p)=>{if(a().lazy)l.set(p)},l.subscribe=(p)=>{if(!o)return()=>{};let f=t.subscribe((e,s)=>p(h(e),h(s)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(l,"value",{get:l,set:l.set}),d(()=>{o=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{o=!0}),l}function X(t,a=!0,i){if(!a||!t||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let o=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=o&&typeof o==="object"&&!Array.isArray(o)?o:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,t))try{return{data:i?i(d[t]):d[t]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(t){if(typeof window>"u")return;let a=window;if(t===void 0)a.__STX_DATA__={};else{if(!a.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");a.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{a.__STX_DATA__={}}if(a.__STX_DATA__)delete a.__STX_DATA__[t]}}function Y(t){let a=null;try{a=typeof indexedDB<"u"?indexedDB:null}catch{a=null}if(!a)return null;let i=a,r=t||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let l=i.open(r,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>u(l.result),l.onerror=()=>h(l.error),l.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},o=(u,h)=>y().then((l)=>new Promise((p,f)=>{let e=l.transaction("kv",u),s=h(e.objectStore("kv"));e.oncomplete=()=>p(s?s.result:void 0),e.onerror=()=>f(e.error),e.onabort=()=>f(e.error)}));return{get:(u)=>o("readonly",(h)=>h.get(u)),set:(u,h)=>o("readwrite",(l)=>{l.put(h,u)}),remove:(u)=>o("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>o("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(t,a){let i=t||{},r=null;if(i.storage!==void 0)r=i.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let o=()=>{if(y)return d;y=!0;try{d=a?a():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,h=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),l=new Map,p=new Set,f=new Map,e=!1,s=Promise.resolve(),v=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},E=(n)=>{try{if(r)r.removeItem(n)}catch{}},S=()=>{if(e=!1,!f.size)return s;let n=Array.from(f.entries());return f.clear(),s=s.then(()=>Promise.all(n.map(([c,g])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(g===void 0?null:g))}catch{}return}let _;try{return _={v:g},d.set(c,_).catch(()=>{let x;try{x=JSON.stringify(g)}catch{return}return d?d.set(c,{j:x}).catch(()=>{m(c,x)}):void 0})}catch{return}}))).then(()=>{}),s},N=(n,c)=>{if(f.set(n,c),p.add(n),e)return;e=!0,h(()=>{S()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:v(c.j)};return},k={peek(n){if(l.has(n))return{value:l.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let g=v(c);return l.set(n,g),{value:g}},load(n){let c=k.peek(n),g=c?null:o();if(c||!g)return Promise.resolve(c);return g.get(n).then((_)=>{if(l.has(n))return{value:l.get(n)};let x=D(_);if(x)l.set(n,x.value),p.add(n);return x},()=>{return})},set(n,c){if(l.set(n,c),d&&p.has(n)){N(n,c);return}let g;try{g=JSON.stringify(c===void 0?null:c)}catch{return}if(g.length<=u&&m(n,g))return;if(!o()){if(g.length>u)m(n,g);return}E(n),N(n,c)},forget(n){for(let g of Array.from(l.keys()))if(g.indexOf(n)===0)l.delete(g);for(let g of Array.from(f.keys()))if(g.indexOf(n)===0)f.delete(g);for(let g of Array.from(p))if(g.indexOf(n)===0)p.delete(g);try{if(r)for(let g=r.length-1;g>=0;g--){let _=r.key(g);if(_&&_.indexOf(n)===0)r.removeItem(_)}}catch{}let c=o();if(!c)return s;return s=s.then(()=>c.removePrefix(n)).catch(()=>{}),s},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return k}function Z(t,a){if(!t)return!1;if(t===a.key)return!0;if(!a.url)return!1;if(t===a.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(t,i),d=new URL(a.url,i);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(t){let a=t.prefix||"stx:kept:",i=t.matches||((e,s)=>e===s.key||e===s.url),r=new Set,d=new Map,y,o=(e)=>e===void 0?y:e,u=(e,s)=>{let v=o(s);if(v===!1||v===null||v==="")return null;return`${a}${v===void 0?"":`${v}:`}query:${e}`},h=(e)=>{let s=e&&e.value;if(!s||typeof s!=="object"||!("d"in s))return;return{data:s.d,at:Number(s.at)||0}},l=()=>{let e=globalThis;return e.__stx_outboxes instanceof Map?e.__stx_outboxes:null},p={setScope(e){y=e},scope:()=>y,keyFor:u,seed(e,s){let v=u(e,s);return v?h(t.kept.peek(v)):void 0},restore(e,s){let v=u(e,s);return v?t.kept.load(v).then(h):Promise.resolve(void 0)},persist(e,s,v){let m=u(e,v);if(m)t.kept.set(m,{d:s,at:Date.now()})},overlay(e,s,v){let m=l();if(!m||!m.size)return s;let E=s;return m.forEach((S)=>{try{E=S.overlay(e,E,v)}catch{}}),E},watch(e){return r.add(e),()=>{r.delete(e)}},cachedQuery(e,s){let v=d.get(e);if(v){if(s&&v.__options)v.__options(s);return v}let m=s||{},E=m.initial===void 0?null:m.initial,S=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:e,url:N()}),k=S(),n=E,c=0,g=t.sharedRequest(),_=0,x=p.seed(e,k);if(x)n=x.data;let I=t.state(p.overlay(D(),n)),U=t.state(!1),q=t.state(!1),K=t.state(null),P=t.state(x?x.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(e,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!x)W(k);let wt=()=>{let b=S();if(b===k)return;k=b,R++,_=0,q.set(!1),U.set(!1),c=0;let w=p.seed(e,k);if(n=w?w.data:E,P.set(w?w.at:0),F(),!w)W(k)},_t=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,j=new Promise((M,V)=>{O=setTimeout(()=>{if(C)C.abort();V(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),V={method:"GET",headers:{Accept:"application/json"}};if(b)V.cache="no-cache";if(C)V.signal=C.signal;A=M(w,V).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,j]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(_++,q.set(!0),c===0&&!P())U.set(!0);let j=()=>{if(w!==R)return;if(_=Math.max(0,_-1),!_)q.set(!1),U.set(!1)};return _t(b,T).then((A)=>{if(w!==R||T!==N())return j(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(e,A,k),F(),j(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return j(),I()})},O=`${w} ${T||""}`;return b?g.fresh(O,C):g.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return e},load(b){if(wt(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(e,n,k),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(r.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(e,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(t.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(e)=>{let s=e.detail||{};if(s.kind!=="api"||typeof s.url!=="string")return;r.forEach((v)=>{if(i(s.url,v.target()))v.updated()})}),f.addEventListener("stx:outbox",(e)=>{let s=e.detail||{},v=s.sent&&typeof s.sent.id==="string"?s.sent:null;r.forEach((m)=>{if(v){let E=Array.isArray(v.affects)?v.affects:[],S=m.target();if(!E.some((N)=>i(N,S)))return}m.outbox(v)})});return p}function te(t){let a=t&&t.covers||((o,u)=>Object.is(o,u)),i=[],r=[],d=0,y=(o,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let l={key:o,promise:h};i.push(l);let p=()=>{let f=i.indexOf(l);if(f!==-1)i.splice(f,1)};return h.then(p,p),h};return{run(o,u){for(let h of i)if(a(h.key,o))return h.promise;for(let h of r)if(a(h.key,o))return h.promise;return y(o,u)},fresh(o,u){for(let f of r)if(a(f.key,o))return f.promise;let h=i.filter((f)=>a(f.key,o)).map((f)=>f.promise);if(!h.length)return y(o,u);let l={key:o,promise:null},p=()=>{};return l.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(l);if(f!==-1)r.splice(f,1);return y(o,u)}),r.push(l),l.promise},latest(){let o=++d;return()=>o===d},get busy(){return i.length>0||r.length>0}}}var ne=` function useColorMode(options) {
2
+ import{gc,mc,hc}from"./chunk-78yjmbbs.js";import{ce,Mn,Ln,Ws,Nr,Dr,jn,Bn,qs,Mr}from"./chunk-p9az13b2.js";function z(t,a,i,r,d,y){let o=!0,u=new Set,f=(p)=>r.get?r.get(p):p,l=()=>f(t());return Object.defineProperty(l,"_isSignal",{value:!0}),Object.defineProperty(l,"modifiers",{get:a}),l.set=(p)=>{if(!o)return;let h=a(),e=r.set?r.set(p,h):p;if(h.trim&&typeof e==="string")e=e.trim();if(h.number&&typeof e==="string"&&e!==""){let s=Number(e);if(!Number.isNaN(s))e=s}if(Object.is(t(),e))return;t.set(e),i(e)},l.update=(p)=>l.set(p(l())),l.input=(p)=>{if(!a().lazy)l.set(p)},l.change=(p)=>{if(a().lazy)l.set(p)},l.subscribe=(p)=>{if(!o)return()=>{};let h=t.subscribe((e,s)=>p(f(e),f(s)));return u.add(h),()=>{h(),u.delete(h)}},Object.defineProperty(l,"value",{get:l,set:l.set}),d(()=>{o=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{o=!0}),l}function X(t,a=!0,i){if(!a||!t||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let o=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=o&&typeof o==="object"&&!Array.isArray(o)?o:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,t))try{return{data:i?i(d[t]):d[t]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(t){if(typeof window>"u")return;let a=window;if(t===void 0)a.__STX_DATA__={};else{if(!a.__STX_DATA__)try{let i=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");a.__STX_DATA__=i&&typeof i==="object"&&!Array.isArray(i)?i:{}}catch{a.__STX_DATA__={}}if(a.__STX_DATA__)delete a.__STX_DATA__[t]}}function Y(t){let a=null;try{a=typeof indexedDB<"u"?indexedDB:null}catch{a=null}if(!a)return null;let i=a,r=t||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,f)=>{let l=i.open(r,1);l.onupgradeneeded=()=>{l.result.createObjectStore("kv")},l.onsuccess=()=>u(l.result),l.onerror=()=>f(l.error),l.onblocked=()=>f(Error("blocked"))}),d.catch(()=>{d=null});return d},o=(u,f)=>y().then((l)=>new Promise((p,h)=>{let e=l.transaction("kv",u),s=f(e.objectStore("kv"));e.oncomplete=()=>p(s?s.result:void 0),e.onerror=()=>h(e.error),e.onabort=()=>h(e.error)}));return{get:(u)=>o("readonly",(f)=>f.get(u)),set:(u,f)=>o("readwrite",(l)=>{l.put(f,u)}),remove:(u)=>o("readwrite",(f)=>{f.delete(u)}),removePrefix:(u)=>o("readwrite",(f)=>{f.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(t,a){let i=t||{},r=null;if(i.storage!==void 0)r=i.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=i.backend!==void 0;if(y)d=i.backend||null;let o=()=>{if(y)return d;y=!0;try{d=a?a():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=i.limit||32768,f=i.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),l=new Map,p=new Set,h=new Map,e=!1,s=Promise.resolve(),v=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},E=(n)=>{try{if(r)r.removeItem(n)}catch{}},S=()=>{if(e=!1,!h.size)return s;let n=Array.from(h.entries());return h.clear(),s=s.then(()=>Promise.all(n.map(([c,g])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(g===void 0?null:g))}catch{}return}let _;try{return _={v:g},d.set(c,_).catch(()=>{let x;try{x=JSON.stringify(g)}catch{return}return d?d.set(c,{j:x}).catch(()=>{m(c,x)}):void 0})}catch{return}}))).then(()=>{}),s},N=(n,c)=>{if(h.set(n,c),p.add(n),e)return;e=!0,f(()=>{S()})},D=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:v(c.j)};return},k={peek(n){if(l.has(n))return{value:l.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let g=v(c);return l.set(n,g),{value:g}},load(n){let c=k.peek(n),g=c?null:o();if(c||!g)return Promise.resolve(c);return g.get(n).then((_)=>{if(l.has(n))return{value:l.get(n)};let x=D(_);if(x)l.set(n,x.value),p.add(n);return x},()=>{return})},set(n,c){if(l.set(n,c),d&&p.has(n)){N(n,c);return}let g;try{g=JSON.stringify(c===void 0?null:c)}catch{return}if(g.length<=u&&m(n,g))return;if(!o()){if(g.length>u)m(n,g);return}E(n),N(n,c)},forget(n){for(let g of Array.from(l.keys()))if(g.indexOf(n)===0)l.delete(g);for(let g of Array.from(h.keys()))if(g.indexOf(n)===0)h.delete(g);for(let g of Array.from(p))if(g.indexOf(n)===0)p.delete(g);try{if(r)for(let g=r.length-1;g>=0;g--){let _=r.key(g);if(_&&_.indexOf(n)===0)r.removeItem(_)}}catch{}let c=o();if(!c)return s;return s=s.then(()=>c.removePrefix(n)).catch(()=>{}),s},flush(){return S()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")S()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{S()})}catch{}return k}function Z(t,a){if(!t)return!1;if(t===a.key)return!0;if(!a.url)return!1;if(t===a.url)return!0;try{let i=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(t,i),d=new URL(a.url,i);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(t){let a=t.prefix||"stx:kept:",i=t.matches||((e,s)=>e===s.key||e===s.url),r=new Set,d=new Map,y,o=(e)=>e===void 0?y:e,u=(e,s)=>{let v=o(s);if(v===!1||v===null||v==="")return null;return`${a}${v===void 0?"":`${v}:`}query:${e}`},f=(e)=>{let s=e&&e.value;if(!s||typeof s!=="object"||!("d"in s))return;return{data:s.d,at:Number(s.at)||0}},l=()=>{let e=globalThis;return e.__stx_outboxes instanceof Map?e.__stx_outboxes:null},p={setScope(e){y=e},scope:()=>y,keyFor:u,seed(e,s){let v=u(e,s);return v?f(t.kept.peek(v)):void 0},restore(e,s){let v=u(e,s);return v?t.kept.load(v).then(f):Promise.resolve(void 0)},persist(e,s,v){let m=u(e,v);if(m)t.kept.set(m,{d:s,at:Date.now()})},overlay(e,s,v){let m=l();if(!m||!m.size)return s;let E=s;return m.forEach((S)=>{try{E=S.overlay(e,E,v)}catch{}}),E},watch(e){return r.add(e),()=>{r.delete(e)}},cachedQuery(e,s){let v=d.get(e);if(v){if(s&&v.__options)v.__options(s);return v}let m=s||{},E=m.initial===void 0?null:m.initial,S=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,D=()=>({key:e,url:N()}),k=S(),n=E,c=0,g=t.sharedRequest(),_=0,x=p.seed(e,k);if(x)n=x.data;let I=t.state(p.overlay(D(),n)),U=t.state(!1),q=t.state(!1),K=t.state(null),P=t.state(x?x.at:0),R=0,F=()=>{I.set(p.overlay(D(),n))},W=(b)=>{let w=R;p.restore(e,b).then((T)=>{if(!T||w!==R||c)return;n=T.data,P.set(T.at),F()})};if(!x)W(k);let wt=()=>{let b=S();if(b===k)return;k=b,R++,_=0,q.set(!1),U.set(!1),c=0;let w=p.seed(e,k);if(n=w?w.data:E,P.set(w?w.at:0),F(),!w)W(k)},_t=(b,w)=>{let T=m.timeoutMs||15000,C=typeof AbortController<"u"?new AbortController:null,O=null,j=new Promise((M,V)=>{O=setTimeout(()=>{if(C)C.abort();V(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:b,url:w,signal:C?C.signal:void 0});else if(w){let M=m.fetch||((L,H)=>fetch(L,H)),V={method:"GET",headers:{Accept:"application/json"}};if(b)V.cache="no-cache";if(C)V.signal=C.signal;A=M(w,V).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(I());return Promise.race([A,j]).then((M)=>{if(O)clearTimeout(O);return m.transform?m.transform(M):M},(M)=>{if(O)clearTimeout(O);throw M})},G=(b)=>{let w=R,T=N(),C=()=>{if(w!==R)return Promise.resolve(I());if(_++,q.set(!0),c===0&&!P())U.set(!0);let j=()=>{if(w!==R)return;if(_=Math.max(0,_-1),!_)q.set(!1),U.set(!1)};return _t(b,T).then((A)=>{if(w!==R||T!==N())return j(),I();return n=A,c=Date.now(),P.set(c),K.set(null),p.persist(e,A,k),F(),j(),I()},(A)=>{if(w===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return j(),I()})},O=`${w} ${T||""}`;return b?g.fresh(O,C):g.run(O,C)},B={data:I,loading:U,isFetching:q,error:K,updatedAt:P,get key(){return e},load(b){if(wt(),!b&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(I());return G(!!b)},refresh(){return B.load(!0)},set(b){n=typeof b==="function"?b(n):b,p.persist(e,n,k),F()},invalidate(){c=0},__options(b){m={...m,...b}}};if(r.add({target:D,updated:()=>{if(c||P())G(!1)},outbox:(b)=>{if(b)n=p.overlay(D(),n,b.id),c=0,G(!0);F()}}),d.set(e,B),m.immediate)B.load();return B}},h=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(t.listen!==!1&&h&&typeof h.addEventListener==="function")h.addEventListener("stx:updated",(e)=>{let s=e.detail||{};if(s.kind!=="api"||typeof s.url!=="string")return;r.forEach((v)=>{if(i(s.url,v.target()))v.updated()})}),h.addEventListener("stx:outbox",(e)=>{let s=e.detail||{},v=s.sent&&typeof s.sent.id==="string"?s.sent:null;r.forEach((m)=>{if(v){let E=Array.isArray(v.affects)?v.affects:[],S=m.target();if(!E.some((N)=>i(N,S)))return}m.outbox(v)})});return p}function te(t){let a=t&&t.covers||((o,u)=>Object.is(o,u)),i=[],r=[],d=0,y=(o,u)=>{let f;try{f=Promise.resolve(u())}catch(h){f=Promise.reject(h)}let l={key:o,promise:f};i.push(l);let p=()=>{let h=i.indexOf(l);if(h!==-1)i.splice(h,1)};return f.then(p,p),f};return{run(o,u){for(let f of i)if(a(f.key,o))return f.promise;for(let f of r)if(a(f.key,o))return f.promise;return y(o,u)},fresh(o,u){for(let h of r)if(a(h.key,o))return h.promise;let f=i.filter((h)=>a(h.key,o)).map((h)=>h.promise);if(!f.length)return y(o,u);let l={key:o,promise:null},p=()=>{};return l.promise=Promise.all(f.map((h)=>h.then(p,p))).then(()=>{let h=r.indexOf(l);if(h!==-1)r.splice(h,1);return y(o,u)}),r.push(l),l.promise},latest(){let o=++d;return()=>o===d},get busy(){return i.length>0||r.length>0}}}var ne=` function useColorMode(options) {
3
3
  options = options || {};
4
4
  // The pre-paint boot script (stacksjs/stx#1794) publishes the app's
5
5
  // configured options here. Reading them makes a bare useColorMode() agree
@@ -1273,7 +1273,7 @@ else {
1273
1273
  // implementation behind it (#1804).
1274
1274
  useSlots: function() {
1275
1275
  return window.__STX_CURRENT_SLOTS__ || {};
1276
- },`;var fe=` var __bindIfCounter = 0;
1276
+ },`;var he=` var __bindIfCounter = 0;
1277
1277
  // \u2500\u2500 x-else / x-else-if chain support (stacksjs/stx#1734) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1278
1278
  // Returns { name, terminal } for an else/else-if attribute present on el,
1279
1279
  // or null. terminal=true for the catch-all x-else (no further siblings
@@ -1311,7 +1311,7 @@ else {
1311
1311
  }
1312
1312
  return chain;
1313
1313
  }
1314
- `;var he=` // A false :if detaches its subtree before the DOMContentLoaded scope walk
1314
+ `;var fe=` // A false :if detaches its subtree before the DOMContentLoaded scope walk
1315
1315
  // reaches nested components. Capture and bind their caller-owned props while
1316
1316
  // the ancestor chain is still connected, otherwise resolveComponentCallerScope
1317
1317
  // can no longer see the component that declared expressions such as
@@ -3280,15 +3280,26 @@ catch (e) {
3280
3280
  return elements;
3281
3281
  };
3282
3282
 
3283
- // Helper: compute key for an item
3283
+ // Keys have the same component and enclosing-row scope as other bindings.
3284
+ // Compiling with only item/index hid helper functions and outer signals,
3285
+ // silently turning explicit keyed lists into positional lists.
3286
+ let warnedKeyExpression = false;
3284
3287
  const getItemKey = (item, index) => {
3285
3288
  if (!keyExpr) return String(index);
3286
3289
  try {
3287
- const scope = { [itemName]: item };
3288
- if (indexName) scope[indexName] = index;
3289
- const fn = __stxCompile([itemName, indexName || '_idx'], 'return ' + keyExpr);
3290
- return String(fn(item, index));
3290
+ const rowScope = { [itemName]: item };
3291
+ rowScope[indexName || '_idx'] = index;
3292
+ const scope = mergeTemplateScopes(globalHelpers, passedScope, (capturedScope || {}), rowScope);
3293
+ const unwrapScope = createExpressionAutoUnwrapProxy(scope, keyExpr);
3294
+ const fn = __stxCompileScoped(unwrapScope, [], 'return ' + keyExpr);
3295
+ const key = fn(...__stxArgs(fn, unwrapScope));
3296
+ if (key === null || key === undefined) throw new Error('The key is null or undefined');
3297
+ return String(key);
3291
3298
  } catch (e) {
3299
+ if (!warnedKeyExpression) {
3300
+ warnedKeyExpression = true;
3301
+ console.warn('[STX] :for could not evaluate :key "' + keyExpr + '"; using item positions. Give each item a valid unique key.', e);
3302
+ }
3292
3303
  return String(index);
3293
3304
  }
3294
3305
  };
@@ -10444,7 +10455,7 @@ else if (timer === null) {
10444
10455
  subscribe: subscribe
10445
10456
  };
10446
10457
  }
10447
- `;function ft(){let t=xt(Dn());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return t}}function xt(t){let a=[],i=0,r="console.log(";while(i<t.length){let d=t.indexOf(r,i);if(d===-1){a.push(t.slice(i));break}a.push(t.slice(i,d));let y=1,o=d+r.length;while(o<t.length&&y>0){let u=t[o];if(u==='"'||u==="'"||u==="`"){let h=u;o++;while(o<t.length&&t[o]!==h){if(t[o]==="\\")o++;o++}o++;continue}if(u==="(")y++;else if(u===")")y--;o++}a.push("0"),i=o}return a.join("")}function Dn(){return`${se}${Oe}
10458
+ `;function ft(){let t=xt(Dn());try{let i=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(t);return i=i.replace(/\}(var |let |const |function )/g,"};$1"),i}catch{return t}}function xt(t){let a=[],i=0,r="console.log(";while(i<t.length){let d=t.indexOf(r,i);if(d===-1){a.push(t.slice(i));break}a.push(t.slice(i,d));let y=1,o=d+r.length;while(o<t.length&&y>0){let u=t[o];if(u==='"'||u==="'"||u==="`"){let f=u;o++;while(o<t.length&&t[o]!==f){if(t[o]==="\\")o++;o++}o++;continue}if(u==="(")y++;else if(u===")")y--;o++}a.push("0"),i=o}return a.join("")}function Dn(){return`${se}${Oe}
10448
10459
  ${Ye(ae,Se,Ee)}
10449
10460
 
10450
10461
  ${Re}
@@ -10469,7 +10480,7 @@ ${Ce}
10469
10480
  ${je}
10470
10481
  ${oe}
10471
10482
  ${de}
10472
- ${he}
10483
+ ${fe}
10473
10484
  ${Be}
10474
10485
  ${et(mc(),hc(),gc())}
10475
10486
 
@@ -10484,7 +10495,7 @@ ${ue}
10484
10495
  ${qe}
10485
10496
  ${Ae}
10486
10497
  ${Ue}
10487
- ${fe}
10498
+ ${he}
10488
10499
  ${Pe}
10489
10500
  ${Le}
10490
10501
  ${le}