@stacksjs/stx 0.2.675 → 0.2.676

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 (109) hide show
  1. package/dist/chunk-1e73whqh.js +2 -0
  2. package/dist/{chunk-hfbkbrwk.js → chunk-1rztwjdj.js} +3 -3
  3. package/dist/{chunk-6qh2mx6q.js → chunk-245sas8r.js} +2 -2
  4. package/dist/{chunk-8jdbrcgt.js → chunk-304dbbsw.js} +5 -5
  5. package/dist/{chunk-5fh9m8fm.js → chunk-34e8e8te.js} +1 -1
  6. package/dist/{chunk-n615cbxq.js → chunk-3bfegbpw.js} +1 -1
  7. package/dist/chunk-3gdt16xa.js +2 -0
  8. package/dist/{chunk-03hhanvm.js → chunk-4jnv2v5e.js} +1 -1
  9. package/dist/{chunk-nw44qq6h.js → chunk-4rk5qnqf.js} +1 -1
  10. package/dist/{chunk-etbpzmxv.js → chunk-526mf3fr.js} +1 -1
  11. package/dist/{chunk-z6mrnh98.js → chunk-54zkkxmb.js} +1 -1
  12. package/dist/{chunk-6ncvb8gp.js → chunk-551s7ha0.js} +3 -3
  13. package/dist/{chunk-4e5jrxbn.js → chunk-5v7vm8cv.js} +5 -5
  14. package/dist/{chunk-93z9f2be.js → chunk-6bwca55g.js} +6 -6
  15. package/dist/{chunk-nvbyscdh.js → chunk-707sx5sk.js} +1 -1
  16. package/dist/chunk-78d5tn4r.js +2 -0
  17. package/dist/{chunk-09gchq7d.js → chunk-8aq07a1j.js} +3 -3
  18. package/dist/{chunk-1s2y6f4b.js → chunk-909ymsjz.js} +1 -1
  19. package/dist/{chunk-5zvrbms2.js → chunk-a2zb5fgg.js} +2 -2
  20. package/dist/chunk-b18x0v21.js +2 -0
  21. package/dist/{chunk-hg0dd64a.js → chunk-b23vscaq.js} +1 -1
  22. package/dist/{chunk-qdkwg2b8.js → chunk-be2rswkw.js} +2 -2
  23. package/dist/chunk-bm42rsaa.js +2 -0
  24. package/dist/{chunk-ram7pa4k.js → chunk-bpj387yx.js} +2 -2
  25. package/dist/{chunk-w0vpvcj0.js → chunk-c4enpsj8.js} +1 -1
  26. package/dist/chunk-cdbaanmx.js +2 -0
  27. package/dist/{chunk-c2rq9pap.js → chunk-cs8wq7nv.js} +1 -1
  28. package/dist/chunk-d2xf5hh9.js +2 -0
  29. package/dist/{chunk-8xxc5edr.js → chunk-d4ch6exz.js} +1 -1
  30. package/dist/chunk-dda8pdya.js +2 -0
  31. package/dist/{chunk-t9bsgbwv.js → chunk-dmd7mgjw.js} +2 -2
  32. package/dist/chunk-ds91e0fe.js +2 -0
  33. package/dist/{chunk-dba795e1.js → chunk-dxh45gve.js} +1 -1
  34. package/dist/{chunk-q7tfqavs.js → chunk-ehzd1yc6.js} +2 -2
  35. package/dist/{chunk-ammn4wbd.js → chunk-etz2dmec.js} +1 -1
  36. package/dist/{chunk-g98gafg7.js → chunk-fbrgz3s8.js} +1 -1
  37. package/dist/{chunk-7475sm3m.js → chunk-fd72t30s.js} +1 -1
  38. package/dist/{chunk-db5017x8.js → chunk-fdvfzknd.js} +1 -1
  39. package/dist/{chunk-nv0jjhtd.js → chunk-ft3f9nj0.js} +1 -1
  40. package/dist/{chunk-p6g58hwg.js → chunk-g12ht81a.js} +1 -1
  41. package/dist/chunk-g6gqja52.js +2 -0
  42. package/dist/{chunk-ggf4z3bv.js → chunk-ga5kjf9b.js} +3 -3
  43. package/dist/{chunk-mvz825w0.js → chunk-ghm9f13q.js} +1 -1
  44. package/dist/chunk-gz5rvwgx.js +2 -0
  45. package/dist/chunk-hqj28381.js +3 -0
  46. package/dist/{chunk-z4bfgvb3.js → chunk-j60jye3e.js} +3 -3
  47. package/dist/chunk-jjet6qxq.js +2 -0
  48. package/dist/chunk-jk7chxkt.js +2 -0
  49. package/dist/{chunk-shft9r9d.js → chunk-kn34esxw.js} +1 -1
  50. package/dist/{chunk-9azagdq6.js → chunk-krcd3039.js} +13 -13
  51. package/dist/{chunk-wtvy9r5w.js → chunk-kxj8e1gd.js} +3 -3
  52. package/dist/{chunk-xrrx2ddz.js → chunk-mjsebtg6.js} +1 -1
  53. package/dist/{chunk-29wj0c68.js → chunk-mq915g3j.js} +2 -2
  54. package/dist/chunk-n63r9b4f.js +2 -0
  55. package/dist/{chunk-z17sy8g3.js → chunk-n8wvqnfc.js} +2 -2
  56. package/dist/{chunk-hz8dj5jy.js → chunk-n94ts3t9.js} +2 -2
  57. package/dist/{chunk-8md2707p.js → chunk-p27ptd9f.js} +12 -12
  58. package/dist/{chunk-9ybjsfyp.js → chunk-p9az13b2.js} +2 -2
  59. package/dist/chunk-pwn0j1vq.js +2 -0
  60. package/dist/{chunk-4x5dk7a4.js → chunk-q1jcf6vm.js} +1 -1
  61. package/dist/{chunk-vf6yaymh.js → chunk-q3nnaxf9.js} +1 -1
  62. package/dist/{chunk-54fazdmn.js → chunk-qbzqary0.js} +1 -1
  63. package/dist/{chunk-kzb04293.js → chunk-qwdcts9w.js} +3 -3
  64. package/dist/chunk-rc79yyqx.js +2 -0
  65. package/dist/{chunk-xdn6rtq2.js → chunk-rfc5pdv2.js} +1 -1
  66. package/dist/{chunk-xayfz35c.js → chunk-rnws0dh3.js} +1 -1
  67. package/dist/{chunk-gc4w2s5n.js → chunk-rxxajm31.js} +2 -2
  68. package/dist/{chunk-2xv29pfj.js → chunk-s73z8zss.js} +1 -1
  69. package/dist/{chunk-81rdyz2n.js → chunk-sptewgky.js} +1 -1
  70. package/dist/{chunk-0thxpgtp.js → chunk-sqh3tvtw.js} +1 -1
  71. package/dist/{chunk-j6x7ryyn.js → chunk-tmqrbs98.js} +22 -11
  72. package/dist/{chunk-xtnxvmdb.js → chunk-vay5v6sj.js} +1 -1
  73. package/dist/chunk-vewt3464.js +2 -0
  74. package/dist/chunk-whzvx5w5.js +2 -0
  75. package/dist/chunk-wk1gt95z.js +2 -0
  76. package/dist/{chunk-8an7vcxx.js → chunk-x63f2ywm.js} +1 -1
  77. package/dist/chunk-xk7cp691.js +2 -0
  78. package/dist/{chunk-e4ezpevb.js → chunk-xnx06qqt.js} +1 -1
  79. package/dist/{chunk-yaccg2c0.js → chunk-y34tyrpb.js} +1 -1
  80. package/dist/{chunk-3vwkyjan.js → chunk-z35ftpqp.js} +12 -12
  81. package/dist/{chunk-7q699phs.js → chunk-z7ghjs7w.js} +1 -1
  82. package/dist/cli.js +8 -8
  83. package/dist/client/signals-for-runtime.js +16 -5
  84. package/dist/craft-entry.js +2 -2
  85. package/dist/craft.js +2 -2
  86. package/dist/pwa.js +1 -1
  87. package/dist/ssg.js +4 -4
  88. package/package.json +2 -2
  89. package/dist/chunk-1wdawkn8.js +0 -2
  90. package/dist/chunk-41q5rww8.js +0 -2
  91. package/dist/chunk-4c5tk71j.js +0 -2
  92. package/dist/chunk-57ege36s.js +0 -2
  93. package/dist/chunk-5n4c99y5.js +0 -2
  94. package/dist/chunk-6rftdp7c.js +0 -2
  95. package/dist/chunk-7s6hypn5.js +0 -2
  96. package/dist/chunk-7ym269yp.js +0 -2
  97. package/dist/chunk-855h3crg.js +0 -2
  98. package/dist/chunk-bpf3xxng.js +0 -3
  99. package/dist/chunk-dasxbb9y.js +0 -2
  100. package/dist/chunk-e02ne8zd.js +0 -2
  101. package/dist/chunk-fqa5ej45.js +0 -2
  102. package/dist/chunk-hz5eh77e.js +0 -2
  103. package/dist/chunk-prc5dxp1.js +0 -2
  104. package/dist/chunk-qwdgx34g.js +0 -2
  105. package/dist/chunk-r6t1712p.js +0 -2
  106. package/dist/chunk-s5q9ztvj.js +0 -2
  107. package/dist/chunk-sfpymq5h.js +0 -2
  108. package/dist/chunk-t8tst3sk.js +0 -2
  109. 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-z35ftpqp.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};
@@ -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-rfc5pdv2.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.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};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p,u}from"./chunk-kzb04293.js";import{K,z,d}from"./chunk-3vwkyjan.js";function B(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function Z(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),c=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function L(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:Z(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function j(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[1]==="/",g=f[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=B(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Fc(t){let o={default:"",named:new Map},i=t,r=j(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=L(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Qu(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function zc(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)f.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else f.add(n);e=I(e,s,a,f)}return e}function I(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(z(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!z(s,r))return e;let a=_(s,o);if(a===void 0)return e;return d(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return u(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Hc(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,f,c,g)=>{let m=o.named.get(f),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=K(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=d(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${d(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await zc(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,f,c)=>{if(/\bname\s*=/.test(f||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let c=f[f.length-2];return e.push({match:a,index:c}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+f.length)}return s}function ed(t){let o=Fc(t);return{defaultSlot:o.default,namedSlots:o.named}}async function td(t,o,i,r,e){return await Hc(t,{default:o,named:i},r,e)}
2
+ import{p,u}from"./chunk-qwdcts9w.js";import{G,z,d}from"./chunk-z35ftpqp.js";function B(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function Z(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=k(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),c=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function L(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),m=i.length===0?a.match(r):null;if(m){let l=m[1]||m[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=g||N.has(c)?-1:Z(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!g&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function j(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let c=f[1]==="/",g=f[2].toLowerCase();if(c){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let h=B(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function Fc(t){let o={default:"",named:new Map},i=t,r=j(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=L(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Qu(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function zc(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,f=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((g)=>g.trim()).filter(Boolean);for(let g of c){let[m,l]=g.split(":").map((S)=>S.trim()),h=l||m;if(s[h]=o[m],o[m]!==void 0)f.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else f.add(n);e=I(e,s,a,f)}return e}function I(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(z(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!z(s,r))return e;let a=_(s,o);if(a===void 0)return e;return d(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return u(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Hc(t,o,i,r){let e=t;e=await W(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,f,c,g)=>{let m=o.named.get(f),l=g?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&m?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=m.propsBinding.trim(),x=G(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=d(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${d(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${m.content}</template>`}return await zc(m,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,f,c)=>{if(/\bname\s*=/.test(f||""))return a;let g=c?.trim()||"";return o.default||g}),e}async function W(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let c=f[f.length-2];return e.push({match:a,index:c}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+f.length)}return s}function ed(t){let o=Fc(t);return{defaultSlot:o.default,namedSlots:o.named}}async function td(t,o,i,r,e){return await Hc(t,{default:o,named:i},r,e)}
3
3
  export{Fc,Qu,zc,Hc,ed,td};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{hp,Tl,co,Vr,Xn,lo,uo,Ur,Wr,qr,po,ca,$l,ht}from"./chunk-hz8dj5jy.js";import"./chunk-4e5jrxbn.js";import"./chunk-dba795e1.js";import"./chunk-6qh2mx6q.js";import"./chunk-8xxc5edr.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-yaccg2c0.js";import"./chunk-f26n6y9p.js";import{L}from"./chunk-3vwkyjan.js";import"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";import"./chunk-kzb04293.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{hp as clearScriptScanCache,Ur as convertServerLoopAttributesToDirectives,lo as convertSignalDirectivesToAttributes,Wr as convertSignalLoopsToAttributes,Xn as extractClientSignalNames,L as extractExports,ca as findMarkupIndexOutsideScripts,Vr as hasSignalsSyntax,co as parseLoopExpression,uo as preEvalLiteralReactiveIfs,qr as processScriptSetup,po as processSignals,$l as rewriteStxImportSpecifiers,Tl as scanScriptTags,ht as stripStxRuntimeImports};
2
+ import{hp,Tl,co,Vr,Xn,lo,uo,Ur,Wr,qr,po,ca,$l,ht}from"./chunk-n94ts3t9.js";import"./chunk-5v7vm8cv.js";import"./chunk-dxh45gve.js";import"./chunk-245sas8r.js";import"./chunk-d4ch6exz.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import{L}from"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{hp as clearScriptScanCache,Ur as convertServerLoopAttributesToDirectives,lo as convertSignalDirectivesToAttributes,Wr as convertSignalLoopsToAttributes,Xn as extractClientSignalNames,L as extractExports,ca as findMarkupIndexOutsideScripts,Vr as hasSignalsSyntax,co as parseLoopExpression,uo as preEvalLiteralReactiveIfs,qr as processScriptSetup,po as processSignals,$l as rewriteStxImportSpecifiers,Tl as scanScriptTags,ht as stripStxRuntimeImports};
@@ -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-z35ftpqp.js";import{Be,A,Nt}from"./chunk-9wdd7eq6.js";import{ut,ke,O,_e,Ii,Hs,Oi,Cn}from"./chunk-rxxajm31.js";import{vt,le,Ye}from"./chunk-f26n6y9p.js";import{Zs}from"./chunk-qbzqary0.js";import{En}from"./chunk-wav0xbnb.js";import{he}from"./chunk-5v7vm8cv.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-vewt3464.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,2 +1,2 @@
1
1
  // @bun
2
- import{Mi,Li,Uc,Wc,qc,Gc,nd}from"./chunk-wtvy9r5w.js";export{Mi as createVirtualList,nd as default,Uc as generateVirtualListCSS,qc as processInfiniteListDirectives,Gc as processVirtualGridDirectives,Li as processVirtualListDirectives,Wc as useVirtualList};
2
+ import{Mi,Li,Uc,Wc,qc,Kc,nd}from"./chunk-kxj8e1gd.js";export{Mi as createVirtualList,nd as default,Uc as generateVirtualListCSS,qc as processInfiniteListDirectives,Kc as processVirtualGridDirectives,Li as processVirtualListDirectives,Wc as useVirtualList};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-78yjmbbs.js";import"./chunk-6beg47t4.js";import{b,w,S,X}from"./chunk-3vwkyjan.js";import"./chunk-kzb04293.js";import"./chunk-9wdd7eq6.js";import"./chunk-0thxpgtp.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,x=b(64),y=new Set,O=0,R=new Set(h);function T(){l.clear(),x.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=w(n,O),r=x.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=X({loader:"ts",target:"browser",define:S()}),C=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
2
+ import"./chunk-78yjmbbs.js";import"./chunk-6beg47t4.js";import{b,w,S,X}from"./chunk-z35ftpqp.js";import"./chunk-qwdcts9w.js";import"./chunk-9wdd7eq6.js";import"./chunk-sqh3tvtw.js";import f from"path";var h=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useBroadcastStream","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],L=new Set(h);var l=new Map,x=b(64),y=new Set,O=0,R=new Set(h);function T(){l.clear(),x.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=w(n,O),r=x.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(y.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),x.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=X({loader:"ts",target:"browser",define:S()}),C=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>C.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
3
3
  ${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let v=r.filter((s)=>!d.has(s)&&!I(n,s));if(v.length>0)console.warn(`[stx] could not bundle ${v.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
4
4
  `),k=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
5
5
  ;(function(){
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ui,Wi,qi,Ki,sp}from"./chunk-6bwca55g.js";import"./chunk-bpj387yx.js";import"./chunk-qr7a378v.js";import"./chunk-krcd3039.js";import"./chunk-551s7ha0.js";import"./chunk-078qg8r5.js";import"./chunk-j60jye3e.js";import"./chunk-304dbbsw.js";import"./chunk-ehzd1yc6.js";import"./chunk-xnx06qqt.js";import"./chunk-n94ts3t9.js";import"./chunk-5v7vm8cv.js";import"./chunk-dxh45gve.js";import"./chunk-be2rswkw.js";import"./chunk-245sas8r.js";import"./chunk-d4ch6exz.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Ui as buildNative,sp as default,Wi as findCraftBinary,Ki as getAvailableFormats,qi as getAvailableTargets};
@@ -159,7 +159,7 @@ else {
159
159
  stxIslands.initIslands();
160
160
  }
161
161
  })();
162
- </script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function Kc(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
162
+ </script>`}function b(e){let t=e.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(t)return t[1];let n=e.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(n)return n[1];return null}function w(e,t){let n={},r=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,i;while((i=r.exec(e))!==null){let d=i[1],o=i[2];if(o in t)n[d]=t[o];else n[d]=o}return n}function Gc(){let e=new Map;return{islands:e,register(t){e.set(t.id,t)},get(t){return e.get(t)},async hydrate(t){let n=e.get(t);if(!n||n.hydrated)return;if(n.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:t,component:n.component}}))},async hydrateAll(){let t=Array.from(e.values()).filter((n)=>!n.hydrated).map((n)=>this.hydrate(n.id));await Promise.all(t)}}}function I(e){return`
163
163
  <script data-hydrate="${e}">
164
164
  (function() {
165
165
  const island = document.querySelector('[data-island="${e}"]');
@@ -387,5 +387,5 @@ else {
387
387
  <script type="application/json" id="stx-island-manifest">
388
388
  ${JSON.stringify(t)}
389
389
  </script>
390
- `}var rd={processPartialHydrationDirectives:Xc,processStaticDirectives:nl,generatePartialHydrationCSS:Jc,generateIslandManifest:rl,createIslandRegistry:Kc,hydrateIsland:Yc,hydrateByStrategy:Zc,hydrateAll:Qc,isHydrated:el,onHydrated:tl};
391
- export{Kc,Xc,Jc,Yc,Zc,Qc,el,tl,nl,rl,rd};
390
+ `}var rd={processPartialHydrationDirectives:Xc,processStaticDirectives:nl,generatePartialHydrationCSS:Jc,generateIslandManifest:rl,createIslandRegistry:Gc,hydrateIsland:Yc,hydrateByStrategy:Zc,hydrateAll:Qc,isHydrated:el,onHydrated:tl};
391
+ export{Gc,Xc,Jc,Yc,Zc,Qc,el,tl,nl,rl,rd};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{x}from"./chunk-78yjmbbs.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,S,X}from"./chunk-3vwkyjan.js";import{i}from"./chunk-6qh2mx6q.js";import{Ee,Yt,Zt,Qt}from"./chunk-nvbyscdh.js";import{ht}from"./chunk-hz8dj5jy.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-hh58k0nh.js";import h from"path";var v=new Map,k=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Us(t){let{files:n}=await G(t),a=X({loader:"ts",target:"browser",define:S()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function J(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=J(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of J(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function Ud(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(v,e,c,""),null;s.sort();let m=X({loader:"ts",target:"browser",define:S()}),p=qt(k,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((W)=>W!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(k,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),M=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(v,M,c);if(F!==void 0)return F||null;let N=[],B=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")B.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),N.push(`// Composable: ${g}
2
+ import{x}from"./chunk-78yjmbbs.js";import{T,xn}from"./chunk-6beg47t4.js";import{on,b,w,S,X}from"./chunk-z35ftpqp.js";import{i}from"./chunk-245sas8r.js";import{Ee,Yt,Zt,Qt}from"./chunk-707sx5sk.js";import{ht}from"./chunk-n94ts3t9.js";import{pt,Nn,qt,ae}from"./chunk-2pga7zzb.js";import{C,wr}from"./chunk-hh58k0nh.js";import h from"path";var v=new Map,k=new Map,A=b(64),E=new Map,Z=["composables","functions"];function z(t){let n=h.basename(t,".ts");return n==="index"||n==="types"||t.endsWith(".d.ts")}async function q(t){if(t)return h.resolve(t);let n=`<default>:${process.cwd()}`,a=E.get(n);if(a!==void 0)return a;let e=await Q();if(e!==null)E.set(n,e);return e}async function Q(){let t=await i(),n=t.root||process.cwd(),a=t.composablesDir;if(a)return h.resolve(n,a);for(let e of Z){let s=h.resolve(n,e);try{let d=new Bun.Glob("**/*.ts");for await(let c of d.scan({cwd:s,absolute:!0}))if(!z(c))return s}catch{}}return null}async function G(t){let n=Array.isArray(t)?t:t?[h.resolve(t)]:(await i())._layerComposableDirs??[await q()].filter((e)=>!!e),a=new Map;for(let e of n){let s=new Bun.Glob("**/*.ts");try{for await(let d of s.scan({cwd:e,absolute:!0})){let c=h.relative(e,d);if(!z(d)&&!a.has(c))a.set(c,d)}}catch{}}return{key:n.join("\x00"),files:[...a.values()].sort()}}async function Us(t){let{files:n}=await G(t),a=X({loader:"ts",target:"browser",define:S()}),e=[];for(let s of n)try{let d=await Bun.file(s).text(),c=a.scan(d).exports.filter((m)=>m!=="default");if(c.length>0)e.push({file:s,names:c})}catch{}return e}function V(t,n){return new RegExp(`\\b${n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(t)}function J(t,n){let a=new Set(t.match(/\w+/g)),e=new Set;for(let s of n)if(/^\w+$/.test(s)?a.has(s):V(t,s))e.add(s);return e}var U=b(64);function Y(t,n){let a=w(t,n.size),e=U.get(a);if(e)return e;let s;try{s=on(t,n)}catch{s=J(t,n)}let d=[...t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...t.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let c of d)for(let m of c[1].split(",")){let p=m.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(p&&n.has(p))s.add(p)}return U.set(a,s),s}function ee(t,n,a){let e=new Map;for(let{file:u,names:l}of t)for(let f of l)if(!e.has(f))e.set(f,u);let s=(u)=>{let l=[];for(let f of J(u,e.keys()))l.push(e.get(f));return l},d=new Set(e.keys()),c=(u)=>{let l=[];for(let f of Y(u,d))l.push(e.get(f));return l},m=new Set,p=a.flatMap((u,l)=>l===0?s(u):c(u));while(p.length>0){let u=[];for(let l of p){if(m.has(l))continue;m.add(l);for(let f of c(n.get(l)??""))if(!m.has(f))u.push(f)}p=u}return m}async function Ud(t,n,a){let{key:e,files:s}=await G(t);if(!e)return null;let d=()=>[...new Set([...s,...s.flatMap((o)=>Ee(o))])],c=pt(d());if(s.length===0)return ae(v,e,c,""),null;s.sort();let m=X({loader:"ts",target:"browser",define:S()}),p=qt(k,e,c);if(!p){let o=new Map,r=[];for(let g of s)try{let y=await Bun.file(g).text();o.set(g,y);let _=m.scan(y).exports.filter((W)=>W!=="default");if(_.length>0)r.push({file:g,names:_})}catch{o.set(g,"")}p=ae(k,e,c,{codeByFile:o,modules:r})}let{codeByFile:u,modules:l}=p,f;if(n===void 0)f=new Set(s);else{let o=a?[n,...a]:[n],r=w(o.join("\x00"),e,o.length,c),g=A.get(r);if(f=g??ee(l,u,o),!g)A.set(r,f)}if(f.size===0)return null;let I=s.filter((o)=>f.has(o)),M=`${e}\x00${I.join("\x00")}\x00${Zt()}`,F=qt(v,M,c);if(F!==void 0)return F||null;let N=[],B=new Set,R=new Set;for(let o of I)try{let r=u.get(o)??await Bun.file(o).text(),g=h.basename(o,".ts");for(let _ of r.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(_[1])R.add(_[1]);let y=[];try{for(let _ of m.scan(r).exports)if(_!=="default")B.add(_),y.push(_)}catch{}if(r=T(r),Yt(r))r=await Qt(r,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:y}),r=ht(r);r=xn(r),r=r.replace(/^export\s+(default\s+)?/gm,""),r=m.transformSync(r),N.push(`// Composable: ${g}
3
3
  ${r.trim()}`)}catch(r){console.warn(`[stx] Failed to load composable ${o}:`,r)}if(N.length===0||B.size===0)return ae(v,M,c,""),null;let L=[...B].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
4
4
  `),j=JSON.stringify([...B]),D=N.join(`
5
5
 
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Bu}from"./chunk-526mf3fr.js";import"./chunk-rxxajm31.js";import"./chunk-tmqrbs98.js";import"./chunk-dmd7mgjw.js";import"./chunk-qbzqary0.js";import"./chunk-krcd3039.js";import"./chunk-551s7ha0.js";import"./chunk-078qg8r5.js";import"./chunk-j60jye3e.js";import"./chunk-304dbbsw.js";import"./chunk-ehzd1yc6.js";import"./chunk-xnx06qqt.js";import"./chunk-n94ts3t9.js";import"./chunk-5v7vm8cv.js";import"./chunk-dxh45gve.js";import"./chunk-be2rswkw.js";import"./chunk-245sas8r.js";import"./chunk-d4ch6exz.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Bu as buildForProduction};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import t from"fs";import r from"path";var Kt="resources/assets",Fn="assets";function zn(o=process.cwd()){let s=r.resolve(o,Kt);return t.existsSync(s)&&t.statSync(s).isDirectory()?s:null}
3
+ export{Kt,Fn,zn};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Vo,Ss,l,p,E,tt,u,ks,t,a,y}from"./chunk-kzb04293.js";import{be,$t,K,z,Ot,J,k}from"./chunk-3vwkyjan.js";import{Xn}from"./chunk-hz8dj5jy.js";import{ne}from"./chunk-e4ezpevb.js";import{Gr}from"./chunk-dba795e1.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=y(n,"(",")",x);if(b===-1)continue;let d=n.slice(g,b).trim();if(!d)continue;if(!Object.keys(r).some((f)=>new RegExp(`(?:^|[^\\w$.])${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(d)))continue;let m;try{let f=E(d,r);if(!f||typeof f!=="object")continue;m=JSON.stringify(f)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,d=x+1;while(d<e.length&&b>0){if(e[d]==="(")b++;else if(e[d]===")"){if(b--,b===0)break}d++}if(b!==0)continue;let s=e.substring(x+1,d),m=d+1,f=s.match(/^\s*['"]([^'"]+)['"]/);if(!f)continue;let _=f[1],h=s.slice(f[0].length),w=h.match(/^\s*,\s*/);if(!w)continue;let I=h.slice(w[0].length).trim();if(!I)continue;try{let F=E(I,r),j=JSON.stringify(F),S=`@component('${_}', ${j})`;i.push({start:g,end:m,replacement:S})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:d}=i[g];e=e.substring(0,x)+d+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,d=x+1,s=null,m=!1;while(d<e.length&&b>0){let h=e[d];if(m){m=!1,d++;continue}if(h==="\\"&&s){m=!0,d++;continue}if(s){if(h===s)s=null;d++;continue}if(h==='"'||h==="'"||h==="`"){s=h,d++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}d++}if(b!==0)break;let f=e.substring(x+1,d),_=c(f);e=e.substring(0,g)+_+e.substring(d+1)}return e}function xe(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(z(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);Vo(i);let b=!1,s=u(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!tt(i).some((h)=>!(h in r)))return"";return e}let f=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${f}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",te="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let d=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):be(n,i.index,d);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:d);continue}let g=c.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let d=g+b[0].length-1,s=y(n,"(",")",d);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(d+1,s).trim()})`;x=p(m)?Boolean(u(m,Object.keys(r))(...Object.values(r))):Boolean(l(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:te);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Ot(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return J(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!ks(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!ks(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function ye(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function d(s){let m=0,f=x.length-1,_=0;while(m<=f){let h=m+f>>1;if(x[h].pos<=s)_=x[h].depth,m=h+1;else f=h-1}return _}while((c=r.exec(n))!==null){if(d(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,f=1,_=m+1,h=-1;while(_<n.length&&f>0){if(n[_]==="(")f++;else if(n[_]===")"){if(f--,f===0){h=_;break}}_++}if(h===-1)continue;let w=n.substring(m+1,h),I=$t(w);if(!I)continue;let{arrayExpr:F,itemVar:j}=I,S=h+1,R=1,W=S,D=/@forelse\s*\(/g,P=/@endforelse/g,L=-1;while(R>0&&W<n.length){D.lastIndex=W,P.lastIndex=W;let C=D.exec(n),A=P.exec(n);if(!A)break;if(C&&C.index<A.index)R++,W=C.index+C[0].length;else{if(R--,R===0){L=A.index;break}W=A.index+11}}if(L===-1)continue;let O=n.substring(S,L),Z=L+11,T=-1,U=0,V=0;while(V<O.length){let C=O.indexOf("@",V);if(C===-1)break;let A=O.substring(C);if(/^@forelse\s*\(/.test(A))U++,V=C+1;else if(A.startsWith("@endforelse"))U--,V=C+11;else if(U===0&&A.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){T=C;break}V=C+1}else V=C+1}if(T===-1)continue;return{start:s,end:Z,arrayExpr:F,itemVar:j,foreachContent:O.substring(0,T),emptyContent:O.substring(T+6)}}return null}function ce(n,r){let c=n;while(!0){let e=ye(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:d}=e;try{let s;if(p(g))s=u(g,Object.keys(r))(...Object.values(r));else s=l(g,r);let m;if(!Array.isArray(s)||s.length===0)m=d;else m=`@foreach (${g} as ${x})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),f=a("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+f+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",Ee=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function _e(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function $e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Lr(n){if(!n.includes(fe))return n;return n.replace(Ee,(r,c,e)=>($e(decodeURIComponent(c),decodeURIComponent(e)),""))}function Kn(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of Xn(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,f;while((f=m.exec(s))!==null){let _=f.index,h=f.index+f[0].length-1,w=1,I=h+1,F=-1;while(I<s.length&&w>0){if(s[I]==="(")w++;else if(s[I]===")"){if(w--,w===0){F=I;break}}I++}if(F===-1)continue;let j=s.substring(h+1,F),S=$t(j);if(!S)continue;let R=_,{arrayExpr:W,itemVar:D}=S,P=F+1,L=1,O=P,Z=/@foreach\s*\(/g,T=/@endforeach/g;while(L>0&&O<s.length){Z.lastIndex=O,T.lastIndex=O;let U=Z.exec(s),V=T.exec(s);if(!V)break;if(U&&U.index<V.index)L++,O=U.index+U[0].length;else{if(L--,L===0){let C=s.substring(P,V.index),A=V.index+11;return{start:R,end:A,arrayExpr:W,itemVar:D,content:C}}O=V.index+11}}}return null}function b(s,m){let f=s;while(!0){let _=x(f);if(!_)break;let{start:h,end:w,arrayExpr:I,itemVar:F,content:j}=_;try{let S=I.trim(),R;if(p(S))R=u(S,Object.keys(m))(...Object.values(m));else R=l(S,m);let W=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),W=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),W=!0;else{let A=_e(S,c)+a("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);f=f.substring(0,h)+A+f.substring(w);continue}let D=e?.loops?.useAltLoopVariable??pe,P=F.trim(),L=null,O,Z=!1;if(P.includes("=>")){let A=P.split("=>").map((M)=>M.trim());if(A.length===2&&A[0]&&A[1])L=A[0],O=A[1];else O=P}else if(!P.startsWith("[")&&!P.startsWith("{")&&P.includes(",")){let A=P.split(",").map((M)=>M.trim());if(A.length===2&&A[0]&&A[1])O=A[0],L=A[1],Z=!0;else O=P}else O=P;let T="",U=new Set(K(`${I} as ${F}`)),V=R,C=m[Ss]??new WeakMap;for(let A=0;A<V.length;A++){let M=V[A],re={index:A,iteration:A+1,first:A===0,last:A===V.length-1,count:V.length},N={...m,loop:re,$loop:re,[Ss]:C};if(Array.isArray(m.__stx_client_signal_names))N.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!U.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(M))H.forEach((B,X)=>{if(B)N[B]=M[X]});else N[O]=M}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(M!==null&&typeof M==="object")H.forEach((B)=>{let X=B.indexOf(":"),Q=(X===-1?B:B.slice(0,X)).trim(),se=X===-1?Q:B.slice(X+1).trim();if(Q&&se)N[se]=M[Q]});else N[O]=M}else N[O]=M;if(L)if(!Z&&W&&Array.isArray(M)&&M.length===2)N[L]=M[0],N[O]=M[1];else N[L]=A;let v=ce(j,N);v=Kn(v,N,c,e,!0),v=ne(v,N,c),v=le(v,N);let q=v.indexOf(ee),G=v.indexOf(te),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)v=v.slice(0,Y);if(v=k(v,N,c),v=xe(v,N),v=me(v,N),v=he(v,N),T+=v,Y>=0&&Y===q)break}f=f.substring(0,h)+T+f.substring(w)}catch(S){let R=a("Foreach",`Error in @foreach(${I.trim()} as ${F.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);f=f.substring(0,h)+R+f.substring(w)}}return f}i=b(i,r),i=Ae(i,r,c,e);let d=e?.loops?.maxWhileIterations??de;return i=Oe(i,r,d),o?i:Lr(i)}function _l(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return ks(n)}function Ae(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,d=y(o,"(",")",b);if(d===-1)break;let s=_l(o.slice(b+1,d)),m=d+1,f=Gr(o.slice(x),"for","endfor");if(f.length===0)break;let _=f[0].content,h=x+f[0].end;if(!ge(s)){let w=a("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+w+o.substring(h),i=!0;continue}try{let w=Re(s),I=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(w.length>0&&I){let D=we({forExpr:s,content:_,iterVarNames:w,context:r,filePath:c,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let F=Object.keys(r),j=Object.values(r),S=ae(_),W=Function(...F,"__stxRenderLoopValue",`
2
+ import{Vo,Ss,l,p,E,tt,u,ks,t,a,y}from"./chunk-qwdcts9w.js";import{be,$t,G,z,Ot,J,k}from"./chunk-z35ftpqp.js";import{Xn}from"./chunk-n94ts3t9.js";import{ne}from"./chunk-xnx06qqt.js";import{Kr}from"./chunk-dxh45gve.js";var de=1000,pe=!1;function he(n,r){let c=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=c.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=y(n,"(",")",x);if(b===-1)continue;let d=n.slice(g,b).trim();if(!d)continue;if(!Object.keys(r).some((f)=>new RegExp(`(?:^|[^\\w$.])${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(d)))continue;let m;try{let f=E(d,r);if(!f||typeof f!=="object")continue;m=JSON.stringify(f)}catch{continue}e+=n.slice(o,g)+m,o=b,c.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let c=/@component\s*\(/g,e=n,o,i=[];while((o=c.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,d=x+1;while(d<e.length&&b>0){if(e[d]==="(")b++;else if(e[d]===")"){if(b--,b===0)break}d++}if(b!==0)continue;let s=e.substring(x+1,d),m=d+1,f=s.match(/^\s*['"]([^'"]+)['"]/);if(!f)continue;let _=f[1],h=s.slice(f[0].length),w=h.match(/^\s*,\s*/);if(!w)continue;let I=h.slice(w[0].length).trim();if(!I)continue;try{let F=E(I,r),j=JSON.stringify(F),S=`@component('${_}', ${j})`;i.push({start:g,end:m,replacement:S})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:d}=i[g];e=e.substring(0,x)+d+e.substring(b)}return e}function oe(n,r,c){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,d=x+1,s=null,m=!1;while(d<e.length&&b>0){let h=e[d];if(m){m=!1,d++;continue}if(h==="\\"&&s){m=!0,d++;continue}if(s){if(h===s)s=null;d++;continue}if(h==='"'||h==="'"||h==="`"){s=h,d++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}d++}if(b!==0)break;let f=e.substring(x+1,d),_=c(f);e=e.substring(0,g)+_+e.substring(d+1)}return e}function xe(n,r){let c=n;return c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),c=c.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(z(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);Vo(i);let b=!1,s=u(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!tt(i).some((h)=>!(h in r)))return"";return e}let f=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${f}"`}catch(g){return e}}),c}var ee="<!--__STX_BREAK__-->",te="<!--__STX_CONTINUE__-->";function le(n,r){let c=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=c.exec(n);i;i=c.exec(n)){if(!i[1]){let d=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",c.lastIndex):be(n,i.index,d);if(s<0)break;c.lastIndex=s+(i[0]==="{!!"?3:d);continue}let g=c.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let d=g+b[0].length-1,s=y(n,"(",")",d);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(d+1,s).trim()})`;x=p(m)?Boolean(u(m,Object.keys(r))(...Object.values(r))):Boolean(l(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:te);o=g,c.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),c="",e=0;return Ot(n,(o,i,g)=>(c+=ie(r(n.slice(e,g))),c+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),c+ie(r(n.slice(e)))}function ue(n,r,c,e){return J(n,r,c==null?"":String(c),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(c)=>{let e=c.trim();if(!ks(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(c)=>{let e=c.trim();if(!ks(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function ye(n){let r=/@forelse\s*\(/g,c,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function d(s){let m=0,f=x.length-1,_=0;while(m<=f){let h=m+f>>1;if(x[h].pos<=s)_=x[h].depth,m=h+1;else f=h-1}return _}while((c=r.exec(n))!==null){if(d(c.index)>0)continue;let s=c.index,m=c.index+c[0].length-1,f=1,_=m+1,h=-1;while(_<n.length&&f>0){if(n[_]==="(")f++;else if(n[_]===")"){if(f--,f===0){h=_;break}}_++}if(h===-1)continue;let w=n.substring(m+1,h),I=$t(w);if(!I)continue;let{arrayExpr:F,itemVar:j}=I,S=h+1,R=1,W=S,D=/@forelse\s*\(/g,P=/@endforelse/g,L=-1;while(R>0&&W<n.length){D.lastIndex=W,P.lastIndex=W;let C=D.exec(n),A=P.exec(n);if(!A)break;if(C&&C.index<A.index)R++,W=C.index+C[0].length;else{if(R--,R===0){L=A.index;break}W=A.index+11}}if(L===-1)continue;let O=n.substring(S,L),K=L+11,T=-1,U=0,V=0;while(V<O.length){let C=O.indexOf("@",V);if(C===-1)break;let A=O.substring(C);if(/^@forelse\s*\(/.test(A))U++,V=C+1;else if(A.startsWith("@endforelse"))U--,V=C+11;else if(U===0&&A.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){T=C;break}V=C+1}else V=C+1}if(T===-1)continue;return{start:s,end:K,arrayExpr:F,itemVar:j,foreachContent:O.substring(0,T),emptyContent:O.substring(T+6)}}return null}function ce(n,r){let c=n;while(!0){let e=ye(c);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:d}=e;try{let s;if(p(g))s=u(g,Object.keys(r))(...Object.values(r));else s=l(g,r);let m;if(!Array.isArray(s)||s.length===0)m=d;else m=`@foreach (${g} as ${x})${b}@endforeach`;c=c.substring(0,o)+m+c.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),f=a("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);c=c.substring(0,o)+f+c.substring(i)}}return c}var fe="<!--stx:foreach-not-iterable:",Ee=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function _e(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function $e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Lr(n){if(!n.includes(fe))return n;return n.replace(Ee,(r,c,e)=>($e(decodeURIComponent(c),decodeURIComponent(e)),""))}function Gn(n,r,c,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of Xn(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,f;while((f=m.exec(s))!==null){let _=f.index,h=f.index+f[0].length-1,w=1,I=h+1,F=-1;while(I<s.length&&w>0){if(s[I]==="(")w++;else if(s[I]===")"){if(w--,w===0){F=I;break}}I++}if(F===-1)continue;let j=s.substring(h+1,F),S=$t(j);if(!S)continue;let R=_,{arrayExpr:W,itemVar:D}=S,P=F+1,L=1,O=P,K=/@foreach\s*\(/g,T=/@endforeach/g;while(L>0&&O<s.length){K.lastIndex=O,T.lastIndex=O;let U=K.exec(s),V=T.exec(s);if(!V)break;if(U&&U.index<V.index)L++,O=U.index+U[0].length;else{if(L--,L===0){let C=s.substring(P,V.index),A=V.index+11;return{start:R,end:A,arrayExpr:W,itemVar:D,content:C}}O=V.index+11}}}return null}function b(s,m){let f=s;while(!0){let _=x(f);if(!_)break;let{start:h,end:w,arrayExpr:I,itemVar:F,content:j}=_;try{let S=I.trim(),R;if(p(S))R=u(S,Object.keys(m))(...Object.values(m));else R=l(S,m);let W=!1;if(!Array.isArray(R))if(R instanceof Map)R=Array.from(R),W=!0;else if(R instanceof Set)R=Array.from(R);else if(typeof R==="string")R=Array.from(R);else if(R&&typeof R==="object"&&!(R instanceof Date)&&!(R instanceof RegExp))R=Object.entries(R),W=!0;else{let A=_e(S,c)+a("Foreach",`Error in @foreach: ${S} is not iterable`,t.TYPE_ERROR);f=f.substring(0,h)+A+f.substring(w);continue}let D=e?.loops?.useAltLoopVariable??pe,P=F.trim(),L=null,O,K=!1;if(P.includes("=>")){let A=P.split("=>").map((M)=>M.trim());if(A.length===2&&A[0]&&A[1])L=A[0],O=A[1];else O=P}else if(!P.startsWith("[")&&!P.startsWith("{")&&P.includes(",")){let A=P.split(",").map((M)=>M.trim());if(A.length===2&&A[0]&&A[1])O=A[0],L=A[1],K=!0;else O=P}else O=P;let T="",U=new Set(G(`${I} as ${F}`)),V=R,C=m[Ss]??new WeakMap;for(let A=0;A<V.length;A++){let M=V[A],re={index:A,iteration:A+1,first:A===0,last:A===V.length-1,count:V.length},N={...m,loop:re,$loop:re,[Ss]:C};if(Array.isArray(m.__stx_client_signal_names))N.__stx_client_signal_names=m.__stx_client_signal_names.filter((X)=>!U.has(X));if(O.startsWith("[")&&O.endsWith("]")){let X=O.slice(1,-1).split(",").map((B)=>B.trim());if(Array.isArray(M))X.forEach((B,Z)=>{if(B)N[B]=M[Z]});else N[O]=M}else if(O.startsWith("{")&&O.endsWith("}")){let X=O.slice(1,-1).split(",").map((B)=>B.trim()).filter(Boolean);if(M!==null&&typeof M==="object")X.forEach((B)=>{let Z=B.indexOf(":"),Q=(Z===-1?B:B.slice(0,Z)).trim(),se=Z===-1?Q:B.slice(Z+1).trim();if(Q&&se)N[se]=M[Q]});else N[O]=M}else N[O]=M;if(L)if(!K&&W&&Array.isArray(M)&&M.length===2)N[L]=M[0],N[O]=M[1];else N[L]=A;let v=ce(j,N);v=Gn(v,N,c,e,!0),v=ne(v,N,c),v=le(v,N);let H=v.indexOf(ee),Y=v.indexOf(te),q=H<0?Y:Y<0?H:Math.min(H,Y);if(q>=0)v=v.slice(0,q);if(v=k(v,N,c),v=xe(v,N),v=me(v,N),v=he(v,N),T+=v,q>=0&&q===H)break}f=f.substring(0,h)+T+f.substring(w)}catch(S){let R=a("Foreach",`Error in @foreach(${I.trim()} as ${F.trim()}): ${S instanceof Error?S.message:String(S)}`,t.EVALUATION_ERROR);f=f.substring(0,h)+R+f.substring(w)}}return f}i=b(i,r),i=Ae(i,r,c,e);let d=e?.loops?.maxWhileIterations??de;return i=Oe(i,r,d),o?i:Lr(i)}function _l(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return ks(n)}function Ae(n,r,c,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,d=y(o,"(",")",b);if(d===-1)break;let s=_l(o.slice(b+1,d)),m=d+1,f=Kr(o.slice(x),"for","endfor");if(f.length===0)break;let _=f[0].content,h=x+f[0].end;if(!ge(s)){let w=a("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+w+o.substring(h),i=!0;continue}try{let w=Re(s),I=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(w.length>0&&I){let D=we({forExpr:s,content:_,iterVarNames:w,context:r,filePath:c,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let F=Object.keys(r),j=Object.values(r),S=ae(_),W=Function(...F,"__stxRenderLoopValue",`
3
3
  let result = '';
4
4
  for (${s}) {
5
5
  result += \`${S}\`;
@@ -9,7 +9,7 @@ import{Vo,Ss,l,p,E,tt,u,ks,t,a,y}from"./chunk-kzb04293.js";import{be,$t,K,z,Ot,J
9
9
  for (${r}) {
10
10
  if (!__renderIteration([${e.join(", ")}])) break;
11
11
  }
12
- `)(...b,(f)=>{let _={...o};e.forEach((j,S)=>{_[j]=f[S]});let h=Kn(c,_,d,g,!0);h=ne(h,_,d),h=le(h,_);let w=h.indexOf(ee),I=h.indexOf(te),F=w<0?I:I<0?w:Math.min(w,I);if(F>=0)h=h.slice(0,F);return s+=k(h,_,d),F<0||F!==w}),s}function Oe(n,r,c){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,x=g+i[0].length-1,b=y(e,"(",")",x);if(b===-1)break;let d=e.slice(x+1,b),s=Gr(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,f=g+s[0].end;if(!ge(d)){let _=a("While",`Unsafe expression in @while: ${d}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+_+e.substring(f),o=!0;continue}try{let _=Object.keys(r),h=Object.values(r),w=ae(m),F=Function(..._,"__stxRenderLoopValue",`
12
+ `)(...b,(f)=>{let _={...o};e.forEach((j,S)=>{_[j]=f[S]});let h=Gn(c,_,d,g,!0);h=ne(h,_,d),h=le(h,_);let w=h.indexOf(ee),I=h.indexOf(te),F=w<0?I:I<0?w:Math.min(w,I);if(F>=0)h=h.slice(0,F);return s+=k(h,_,d),F<0||F!==w}),s}function Oe(n,r,c){let e=n,o=!0;while(o){o=!1;let i=e.match(/@while\s*\(/);if(!i||i.index===void 0)break;let g=i.index,x=g+i[0].length-1,b=y(e,"(",")",x);if(b===-1)break;let d=e.slice(x+1,b),s=Kr(e.slice(g),"while","endwhile");if(s.length===0)break;let m=s[0].content,f=g+s[0].end;if(!ge(d)){let _=a("While",`Unsafe expression in @while: ${d}`,t.UNSAFE_EXPRESSION);e=e.substring(0,g)+_+e.substring(f),o=!0;continue}try{let _=Object.keys(r),h=Object.values(r),w=ae(m),F=Function(..._,"__stxRenderLoopValue",`
13
13
  let result = '';
14
14
  let maxIterations = ${c}; // Configurable safety limit
15
15
  let counter = 0;
@@ -22,4 +22,4 @@ import{Vo,Ss,l,p,E,tt,u,ks,t,a,y}from"./chunk-kzb04293.js";import{be,$t,K,z,Ot,J
22
22
  }
23
23
  return result;
24
24
  `)(...h,(j,S,R)=>ue(m,j,S,R));e=e.substring(0,g)+F+e.substring(f),o=!0}catch(_){let h=a("While",`Error in @while(${d}): ${_ instanceof Error?_.message:String(_)}`,t.EVALUATION_ERROR);e=e.substring(0,g)+h+e.substring(f),o=!0}}return e}
25
- export{Lr,Kn,_l};
25
+ export{Lr,Gn,_l};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Hd,Vd}from"./chunk-s73z8zss.js";import"./chunk-707sx5sk.js";import"./chunk-qbzqary0.js";import"./chunk-374nhgyf.js";import"./chunk-n94ts3t9.js";import"./chunk-5v7vm8cv.js";import"./chunk-dxh45gve.js";import"./chunk-245sas8r.js";import"./chunk-d4ch6exz.js";import"./chunk-dera8fmc.js";import"./chunk-q3gactm1.js";import"./chunk-y34tyrpb.js";import"./chunk-f26n6y9p.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{Vd as clearStoreCache,Hd as getStoreScript};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{pp,Cl,Ke,ia,fp,jr,Br,Fr}from"./chunk-304dbbsw.js";import"./chunk-ehzd1yc6.js";import"./chunk-xnx06qqt.js";import"./chunk-dxh45gve.js";import"./chunk-z35ftpqp.js";import"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";import"./chunk-qwdcts9w.js";import"./chunk-6beg47t4.js";import"./chunk-78yjmbbs.js";export{fp as clearOnceStore,ia as onceStore,Ke as partialsCache,jr as processIncludes,Br as processStackPushDirectives,Fr as processStackReplacements,pp as resetUnscopedSignalWarnings,Cl as topLevelElements};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{hn,zo}from"./chunk-0thxpgtp.js";import"./chunk-9wdd7eq6.js";export{zo as generateRuntimeConfigTypes,hn as prepareRuntimeConfig};
2
+ import{hn,zo}from"./chunk-sqh3tvtw.js";import"./chunk-9wdd7eq6.js";export{zo as generateRuntimeConfigTypes,hn as prepareRuntimeConfig};