@stacksjs/stx 0.2.890 → 0.2.891
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.
- package/dist/{chunk-9a9cec4x.js → chunk-08kcxz79.js} +1 -1
- package/dist/{chunk-r7m60q1m.js → chunk-0fyh29m1.js} +1 -1
- package/dist/{chunk-xeyq6d0t.js → chunk-0t31rf3v.js} +1 -1
- package/dist/chunk-0w578pgv.js +3 -0
- package/dist/{chunk-1t15z230.js → chunk-0yxvz6qz.js} +2 -2
- package/dist/chunk-0zynd3x0.js +2 -0
- package/dist/chunk-10c7pg5h.js +2 -0
- package/dist/{chunk-wedwczed.js → chunk-12m3qagv.js} +1 -1
- package/dist/{chunk-8f8qgjjr.js → chunk-12nmmdnp.js} +1 -1
- package/dist/{chunk-6svc4kb8.js → chunk-1vp0h7d6.js} +9 -9
- package/dist/{chunk-zpqjsnz9.js → chunk-29cw0fcr.js} +1 -1
- package/dist/{chunk-xwrjre34.js → chunk-2eq3aret.js} +1 -1
- package/dist/chunk-3ngbdap1.js +2 -0
- package/dist/{chunk-gfea8a9y.js → chunk-3t30a2nx.js} +1 -1
- package/dist/chunk-484x27q5.js +2 -0
- package/dist/{chunk-9344rq4r.js → chunk-4f3456ht.js} +1 -1
- package/dist/{chunk-v1mwwben.js → chunk-4r6hbjx7.js} +2 -2
- package/dist/chunk-4ts8qztg.js +2 -0
- package/dist/{chunk-1bft48gk.js → chunk-5zs5hrgz.js} +2 -2
- package/dist/{chunk-k8bk685s.js → chunk-6aq1pv9a.js} +1 -1
- package/dist/chunk-6kkatcka.js +2 -0
- package/dist/{chunk-a3zrwky3.js → chunk-6kt9wxja.js} +1 -1
- package/dist/{chunk-nzpb263k.js → chunk-70paeznz.js} +5 -5
- package/dist/{chunk-v90nz5xm.js → chunk-7d2j41e3.js} +4 -4
- package/dist/{chunk-49xwf7dk.js → chunk-8ay5r808.js} +2 -2
- package/dist/{chunk-40k0r6z9.js → chunk-8hdp4ark.js} +1 -1
- package/dist/chunk-8res5m9x.js +2 -0
- package/dist/{chunk-zf68afyh.js → chunk-8y39f6z3.js} +3 -3
- package/dist/{chunk-4akw3bym.js → chunk-90qwzwsm.js} +1 -1
- package/dist/{chunk-ch9028z3.js → chunk-9f8fda1j.js} +1 -1
- package/dist/{chunk-eq86wzhr.js → chunk-9w6k311w.js} +35 -27
- package/dist/{chunk-3yvmaphj.js → chunk-9zhpv03v.js} +1 -1
- package/dist/chunk-a5d5qveh.js +2 -0
- package/dist/{chunk-4eescf3s.js → chunk-aasgawa9.js} +4 -4
- package/dist/{chunk-xmg6bmh6.js → chunk-ac3e6nhg.js} +3 -3
- package/dist/{chunk-qnf7w4xw.js → chunk-b0jk94wx.js} +3 -3
- package/dist/{chunk-kr2400c3.js → chunk-b18vpz6p.js} +1 -1
- package/dist/chunk-bsbd6y64.js +2 -0
- package/dist/{chunk-sztr4d5g.js → chunk-cf527twj.js} +1 -1
- package/dist/{chunk-bm0mzk3b.js → chunk-cgrg6xzg.js} +1 -1
- package/dist/{chunk-adsqckg4.js → chunk-dm069acv.js} +4 -4
- package/dist/{chunk-yesh4dfe.js → chunk-e5md1cck.js} +4 -4
- package/dist/{chunk-j9vfv53x.js → chunk-fs7tv867.js} +1 -1
- package/dist/{chunk-1jtsr42q.js → chunk-gcjqxvbb.js} +6 -2
- package/dist/{chunk-35j7gaj5.js → chunk-gk0h2hp7.js} +1 -1
- package/dist/{chunk-b0hj8eg2.js → chunk-gwayvyg5.js} +1 -1
- package/dist/{chunk-kg7vby72.js → chunk-gydvy8a3.js} +5 -5
- package/dist/{chunk-8ccgty8s.js → chunk-gzc16hs8.js} +2 -2
- package/dist/{chunk-xy8smv5e.js → chunk-h7yme97q.js} +2 -2
- package/dist/chunk-h87pjzn7.js +2 -0
- package/dist/{chunk-94j4p584.js → chunk-hq03mwtw.js} +1 -1
- package/dist/chunk-k0mndyb4.js +2 -0
- package/dist/{chunk-nhv81gp2.js → chunk-k89gbytd.js} +2 -2
- package/dist/{chunk-aj5tsksz.js → chunk-kd7k31x3.js} +4 -4
- package/dist/{chunk-t0ttxayz.js → chunk-kfbw96c5.js} +2 -2
- package/dist/chunk-kh3sxa3j.js +2 -0
- package/dist/chunk-kr4z3633.js +2 -0
- package/dist/{chunk-rd663v1m.js → chunk-kvz7ad7p.js} +1 -1
- package/dist/{chunk-wy6vjz1e.js → chunk-kxewj557.js} +19 -19
- package/dist/chunk-mbpz45v9.js +2 -0
- package/dist/{chunk-whcrca58.js → chunk-mxf6cfbg.js} +6 -6
- package/dist/{chunk-9rjgq8k4.js → chunk-n64zbwzr.js} +1 -1
- package/dist/chunk-nd0f11at.js +2 -0
- package/dist/{chunk-p0bjbtdx.js → chunk-nvre22sw.js} +5 -5
- package/dist/chunk-p9cwapm8.js +2 -0
- package/dist/{chunk-12cjs6vs.js → chunk-ph4tgp9g.js} +1 -1
- package/dist/{chunk-0wp23n1d.js → chunk-phx820py.js} +1 -1
- package/dist/{chunk-690518hw.js → chunk-pjpf21y9.js} +1 -1
- package/dist/{chunk-1w0bqqh5.js → chunk-psykt348.js} +1 -1
- package/dist/{chunk-0k437z3q.js → chunk-qn45rk5n.js} +1 -1
- package/dist/{chunk-t3zmfh8w.js → chunk-qrk535j6.js} +4 -4
- package/dist/{chunk-97snfzsy.js → chunk-rc7djca5.js} +19 -19
- package/dist/chunk-sydgagr1.js +2 -0
- package/dist/chunk-vm57848v.js +2 -0
- package/dist/{chunk-4d85str1.js → chunk-vya7cck4.js} +1 -1
- package/dist/{chunk-vkfw9k1n.js → chunk-w8djc4qb.js} +8 -8
- package/dist/chunk-wwb6c5rr.js +2 -0
- package/dist/chunk-x691tnkx.js +2 -0
- package/dist/{chunk-cphc60zw.js → chunk-x9036mfd.js} +2 -2
- package/dist/{chunk-80ky40mm.js → chunk-xvprhdcb.js} +1 -1
- package/dist/chunk-y7qm1m0e.js +2 -0
- package/dist/{chunk-c25q87ys.js → chunk-ye6ev3qp.js} +1 -1
- package/dist/{chunk-g3vce7ka.js → chunk-ypyezjr0.js} +1 -1
- package/dist/{chunk-vxbvrbqs.js → chunk-yv797v6e.js} +2 -2
- package/dist/{chunk-cmg9x1ka.js → chunk-z012vpdz.js} +3 -3
- package/dist/{chunk-hyyh7qxw.js → chunk-z6ndrx2p.js} +1 -1
- package/dist/{chunk-2nqmw4dv.js → chunk-z8sv926e.js} +1 -1
- package/dist/{chunk-2xnbdqy4.js → chunk-z92e297r.js} +2 -2
- package/dist/chunk-zd21ntcm.js +2 -0
- package/dist/cli.js +14 -14
- package/dist/client/signals-timer-runtime.js +4 -0
- package/dist/component-library.js +11 -3
- package/dist/component-renderer.js +23 -10
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/prop-names.js +7 -2
- package/dist/native/runtime/craft-bridge.js +29 -2
- package/dist/native/runtime/craft.d.ts +32 -0
- package/dist/native/runtime/native-host.js +27 -11
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +10 -10
- package/package.json +5 -5
- package/stx.d.ts +2 -1
- package/dist/chunk-0q0nbq50.js +0 -2
- package/dist/chunk-44teqn0b.js +0 -2
- package/dist/chunk-4xbtxeak.js +0 -2
- package/dist/chunk-6s3jwysv.js +0 -2
- package/dist/chunk-850tye3c.js +0 -2
- package/dist/chunk-amb7e0fp.js +0 -2
- package/dist/chunk-e8szp5wa.js +0 -2
- package/dist/chunk-hda7t8g6.js +0 -2
- package/dist/chunk-j6fs31va.js +0 -2
- package/dist/chunk-jvnsz2x9.js +0 -2
- package/dist/chunk-kexqmwx8.js +0 -2
- package/dist/chunk-kpjq135z.js +0 -2
- package/dist/chunk-kqsm7gf1.js +0 -2
- package/dist/chunk-mtfymhy1.js +0 -2
- package/dist/chunk-p82fzxdg.js +0 -2
- package/dist/chunk-qsv84cwm.js +0 -2
- package/dist/chunk-r98pye4h.js +0 -2
- package/dist/chunk-t4gcsbna.js +0 -2
- package/dist/chunk-tbh7r1wh.js +0 -2
- package/dist/chunk-vfcbz0an.js +0 -3
- package/dist/chunk-wmvvrsn0.js +0 -2
- package/dist/chunk-wnrh62by.js +0 -2
- package/dist/chunk-ymc1wgb3.js +0 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Hl,Vl}from"./chunk-cphc60zw.js";import{J,Ir,Js,Ys,Ti,Ri,Zs,Oe,qe,ke,se,Mr,Dr,he,oe,F,mt,Lr,Oi,Fr,Ye,s,g,Y,On}from"./chunk-eq86wzhr.js";import{m,M,yt,p}from"./chunk-xmg6bmh6.js";import{r}from"./chunk-vfcbz0an.js";import{ge}from"./chunk-80ky40mm.js";import{vr}from"./chunk-3bsz7zj3.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-neg6ckjg.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import rn from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function sn(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,vt=[];async function on(){if(Pe<sn()){Pe++;return}await new Promise((e)=>vt.push(e)),Pe++}function an(){Pe--,vt.shift()?.()}var cn="@stacksjs/stx/builtins/image-warmup-worker";function ln(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&rn.existsSync(bt(n)))return bt(n)}catch{}return vr(cn,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Ie(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Ie(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=ln();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await on();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${Ie(h)}`));return}let u=!1,f=!1,v=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){v(()=>a(h.value));return}let y=Error(h.error?.message??"image worker failed");if(h.error?.name)y.name=h.error.name;if(h.error?.stack)y.stack=h.error.stack;v(()=>c(y))}),l.on("error",(h)=>{v(()=>u?c(h instanceof Error?h:Error(Ie(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Ie(h)}`)))}),l.on("exit",(h)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{an()}}var un=new Set([".avif",".jpeg",".jpg",".png",".webp"]),fn=[320,640,960,1280,1920],xe="/_stx/images",dn=`stx:${xe}:alpha-1`,gn=`stx:${xe}:opaque-1`,pn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function mn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=pn.map((i)=>{let n;try{n=e?mn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function ve(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function hn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function yn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${xe}`){let n=(o)=>`${xe}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function It(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await It(e,c));continue}if(!a.isFile()||!un.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:hn(n.relativePath),input:n.absolutePath,name:yn(n.relativePath),...bn(n.absolutePath)?{options:{storage:i}}:{}}))}function bn(e){return Ue(e)==="possible"}function xn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function vn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,h)=>v.width-h.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(xn(v.data))n.add(l)}catch{n.add(l)}}));return n}function wn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return n}async function $n(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Sn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Cn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function si(e){let i=Pt(e);return i?ve().catalog.get(i):void 0}function oi(e){let i=Pt(e);return i?ve().transparent.has(i):!1}function ii(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function cy(e){let i=si(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ii(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:oi(e)?void 0:i.placeholder?.dataUrl}}function Ts(){let e=ve();e.catalog=new Map,e.transparent=new Set}function Rn(e){let i=ve();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ly(e,i,n={}){if(!e||!K.existsSync(e))return Ts(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return Rn(d.state),d.result}let o=await It(e);if(o.length===0)return Ts(),{count:0,fingerprint:""};let a=Sn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return Ts(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${dn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${gn}:${wt()}`),baseUrl:xe,widths:fn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await $n(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)Cn(i,a);if(v.length===0)return Ts(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(v,l)})}let y=await vn(h.entries),C=wn(h.entries,y),S=ve();S.catalog=new Map(Object.entries(h.entries)),S.transparent=y;let b=y.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...y].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ti(e,o);if(a!==void 0)return a;for(let c of Ri(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var kn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||kn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function An(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=An(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Mr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,h)),f.push(...ie(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var Pn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=Pn[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${we(e,a,void 0,n,o)} ${a}w`).join(", ")}function _n(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${we(e,l,void 0,o,a)} ${c}x`}).join(", ")}function we(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(n)c.set("h",String(n));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function En(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Nn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=si(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),h=H(e,"densities"),y=H(e,"format"),C=oi(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!y,I=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,y),U=Je(f);else if(!T&&h){let Z=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=_n(o,Z,I,d,y)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(I&&_)D.push(`aspect-ratio:${I}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=Nn(I||16,_||9,b);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||we(o,I,_,d,y),X=[];if(X.push(`src="${r(Mr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Mr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let be=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",P=En(te)+(Z?`;${Z}`:"");X.push(`onload="${r(P)}"`),be.add("onload")}X.push(...re(e,be)),X.push(...ie(e,be));let le=`<img ${X.join(" ")} />`,Q="";if(z){let P=y==="webp"?"image/webp":y==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
|
|
3
|
-
`}if(q){let Z=[];if(a)for(let
|
|
2
|
+
import{Hl,Ul}from"./chunk-x9036mfd.js";import{J,Ir,Js,Ys,Ti,Ri,Zs,Oe,qe,ke,se,Mr,Dr,he,oe,F,mt,Lr,Oi,Fr,Ye,s,g,Y,On}from"./chunk-9w6k311w.js";import{m,M,yt,p}from"./chunk-ac3e6nhg.js";import{r}from"./chunk-0w578pgv.js";import{ge}from"./chunk-xvprhdcb.js";import{vr}from"./chunk-3bsz7zj3.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-neg6ckjg.js";import{createHash as At}from"crypto";import K from"fs";import V from"path";import Le from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=Le.readSync(e,o,0,n,i);return o.subarray(0,a)}function ze(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Ue(e){let i;try{i=Le.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(ze(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)Le.closeSync(i)}}import on from"fs";import Fe from"os";import{fileURLToPath as bt}from"url";var _e=Symbol("stx.image-worker.unavailable");function an(e=typeof Fe.availableParallelism==="function"?Fe.availableParallelism():Fe.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ie=0,vt=[];async function cn(){if(Ie<an()){Ie++;return}await new Promise((e)=>vt.push(e)),Ie++}function ln(){Ie--,vt.shift()?.()}var un="@stacksjs/stx/builtins/image-warmup-worker";function fn(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&on.existsSync(bt(n)))return bt(n)}catch{}return vr(un,e)}var xt=!1;function ue(e){if(!xt)xt=!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 _e}function Pe(e){return e instanceof Error?e.message:String(e)}async function We(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${Pe(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=fn();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await cn();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(y){a(ue(`could not start ${o}: ${Pe(y)}`));return}let u=!1,f=!1,v=(y)=>{if(f)return;f=!0,y(),l.terminate()};l.on("message",(y)=>{if(y.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(y.type==="result"){v(()=>a(y.value));return}let h=Error(y.error?.message??"image worker failed");if(y.error?.name)h.name=y.error.name;if(y.error?.stack)h.stack=y.error.stack;v(()=>c(h))}),l.on("error",(y)=>{v(()=>u?c(y instanceof Error?y:Error(Pe(y)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${Pe(y)}`)))}),l.on("exit",(y)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${y} before it was ready`)))})})}finally{ln()}}var dn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),gn=[320,640,960,1280,1920],ve="/_stx/images",pn=`stx:${ve}:alpha-1`,mn=`stx:${ve}:opaque-1`,hn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Ee;function yn(e,i){let n=V.dirname(Bun.resolveSync(e,i));while(n!==V.dirname(n)){let o=V.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=V.dirname(n)}return}function wt(){if(Ee!==void 0)return Ee;let e;try{e=V.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Ee=hn.map((i)=>{let n;try{n=e?yn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Ee}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function bn(e){return`/${e.split(V.sep).map(encodeURIComponent).join("/")}`}function xn(e){let i=V.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=V.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=V.join(e,o);await K.promises.mkdir(V.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function Pt(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=V.join(i,a.name);if(a.isDirectory()){o.push(...await Pt(e,c));continue}if(!a.isFile()||!dn.has(V.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:V.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:bn(n.relativePath),input:n.absolutePath,name:xn(n.relativePath),...vn(n.absolutePath)?{options:{storage:i}}:{}}))}function vn(e){return Ue(e)==="possible"}function wn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function $n(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,y)=>v.width-y.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(wn(v.data))n.add(l)}catch{n.add(l)}}));return n}function Sn(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!ze(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return n}async function Cn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function He(e){return V.join(e,"undecodable.json")}function Rn(e){try{let i=K.readFileSync(He(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function kn(e,i){try{K.mkdirSync(V.dirname(He(e)),{recursive:!0}),K.writeFileSync(He(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function It(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function si(e){let i=It(e);return i?we().catalog.get(i):void 0}function oi(e){let i=It(e);return i?we().transparent.has(i):!1}function ii(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function cy(e){let i=si(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:ii(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:oi(e)?void 0:i.placeholder?.dataUrl}}function Ts(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function ly(e,i,n={}){if(!e||!K.existsSync(e))return Ts(),{count:0,fingerprint:""};if(n.offThread){let d=await We("delivery",{publicDir:e,outputDir:i});if(d!==_e)return An(d.state),d.result}let o=await Pt(e);if(o.length===0)return Ts(),{count:0,fingerprint:""};let a=Rn(i),c=o.filter((d)=>{let x=a[d.relativePath];if(!x)return!0;let k=kt(d.absolutePath);return!k||k.mtimeMs!==x.mtimeMs||k.size!==x.size});if(c.length===0)return Ts(),{count:0,fingerprint:""};let l=Ct(V.join(i,"_stx","images"),`${pn}:${wt()}`),u={outDir:V.join(i,"_stx","images"),storage:Ct(V.join(i,"_stx","images"),`${mn}:${wt()}`),baseUrl:ve,widths:gn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,y;try{y=await f({...u,entries:Rt(c,l)})}catch(d){if(v=await Cn(c),v.length===c.length)throw d;let x=new Set(v.map((A)=>A.relativePath)),k=!1;for(let A of c){if(x.has(A.relativePath))continue;let R=kt(A.absolutePath);if(!R)continue;a[A.relativePath]=R,k=!0}if(k)kn(i,a);if(v.length===0)return Ts(),{count:0,fingerprint:""};y=await f({...u,entries:Rt(v,l)})}let h=await $n(y.entries),C=Sn(y.entries,h),S=we();S.catalog=new Map(Object.entries(y.entries)),S.transparent=h;let b=h.size===0&&C.length===0?y.fingerprint:At("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...h].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class _t{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ti(e,o);if(a!==void 0)return a;for(let c of Ri(e,i,n,o))if(await s(c))return c;return null}}var fe=new _t;var ne="\x00stx-boolean-attribute";function Xe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Pn=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 Ze(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||Pn.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${On(c,Xe(String(a)))}"`)}return n}function In(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 Ve={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=In(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Mr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let y=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,y)),f.push(...ie(e,y)),`<a ${f.join(" ")}>${i}</a>`}};var _n=new Map;function Ge(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return _n.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ke=[320,640,768,1024,1280,1536,1920];function H(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Ne(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Je(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function Qe(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function Nn(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(n)c.set("h",String(n));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function Bn(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Tn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var et={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=H(e,"src")||"",a=si(o),c=H(e,"alt")||"",l=H(e,"width")||(a?String(a.source.width):void 0),u=H(e,"height")||(a?String(a.source.height):void 0),f=H(e,"sizes"),v=H(e,"srcset"),y=H(e,"densities"),h=H(e,"format"),C=oi(o)||Ge(o)?.transparent===!0,S=H(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=H(e,"placeholderColor")||"#e5e7eb",d=H(e,"provider"),x=H(e,"class")||H(e,"className")||"",k=H(e,"style")||"",A=H(e,"objectFit")||H(e,"fit"),R=H(e,"objectPosition")||H(e,"position"),E=H(e,"quality"),G=Ne(e,"lazy",!0),z=Ne(e,"preload",!1),B=Ne(e,"priority",!1),L=H(e,"loading"),N=H(e,"decoding")||"async",q=!!a||Ne(e,"picture",!1)||!!h,P=l?Number.parseInt(l):void 0,_=u?Number.parseInt(u):void 0,T=v||"",U="";if(a)T=a.sources[a.fallback.format]||"",U=f?Je(f):"100vw";else if(!T&&f&&d&&d!=="local"&&d!=="static")T=Qe(o,Ke,d,h),U=Je(f);else if(!T&&y){let Z=y.split(/\s+/).map((I)=>Number.parseFloat(I.replace("x","")));T=Nn(o,Z,P,d,h)}else if(f)U=Je(f);let D=[];if(k)D.push(k);if(A)D.push(`object-fit:${A}`);if(R)D.push(`object-position:${R}`);if(P&&_)D.push(`aspect-ratio:${P}/${_}`);let te=[],ae=S==="blur"||S==="color"||S==="thumbhash";if(ae&&!C){let Z=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ge(o);if(Z&&S==="color")D.push(`background-color:${Z.color}`),te.push("backgroundColor");else if(Z)D.push(`background-color:${Z.color}`),D.push(`background-image:url(${Z.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let I=Tn(P||16,_||9,b);D.push(`background-image:url(${I})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&S&&S!=="empty"&&S!=="none")D.push(`background-image:url(${r(S)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,P,_,d,h),X=[];if(X.push(`src="${r(Mr(j,"fetched"))}"`),X.push(`alt="${r(c)}"`),l)X.push(`width="${r(l)}"`);if(u)X.push(`height="${r(u)}"`);let Ce=L||(B||z?"eager":G?"lazy":"");if(Ce)X.push(`loading="${r(Ce)}"`);if(B)X.push('fetchpriority="high"');if(X.push(`decoding="${r(N)}"`),x)X.push(`class="${r(x)}"`);if(D.length>0)X.push(`style="${r(D.join(";"))}"`);if(T)X.push(`srcset="${r(Mr(T,"fetched"))}"`);if(U)X.push(`sizes="${r(U)}"`);let xe=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(te.length>0){let Z=typeof e.static.onload==="string"?e.static.onload:"",I=Bn(te)+(Z?`;${Z}`:"");X.push(`onload="${r(I)}"`),xe.add("onload")}X.push(...re(e,xe)),X.push(...ie(e,xe));let le=`<img ${X.join(" ")} />`,Q="";if(z){let I=h==="webp"?"image/webp":h==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${I?` type="${I}"`:""}${T?` imagesrcset="${r(T)}"`:""}${U?` imagesizes="${r(U)}"`:""} />
|
|
3
|
+
`}if(q){let Z=[];if(a)for(let I of ii(a))Z.push(`<source type="image/${I.format}" srcset="${r(I.srcset)}"${U?` sizes="${r(U)}"`:""} />`);if(!a&&(h==="avif"||h==="auto")){let I=$e(o,P,_,d,"avif"),O=T?Qe(o,Ke,d,"avif"):`${I}`;Z.push(`<source type="image/avif" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}if(!a&&(h==="webp"||h==="auto")){let I=$e(o,P,_,d,"webp"),O=T?Qe(o,Ke,d,"webp"):`${I}`;Z.push(`<source type="image/webp" srcset="${r(O)}"${U?` sizes="${r(U)}"`:""} />`)}return`${Q}<picture>
|
|
4
4
|
${Z.join(`
|
|
5
5
|
`)}
|
|
6
6
|
${le}
|
|
7
|
-
</picture>`}return`${Q}${le}`}};var Et="/images/safe-image-default.svg";function de(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var
|
|
7
|
+
</picture>`}return`${Q}${le}`}};var Et="/images/safe-image-default.svg";function de(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Dn=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${Et}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,tt={name:"SafeImage",aliases:["safe-image","safe-img"],render(e,i,n){let o=de(e,"src")||"",a=de(e,"alt")||"",c=de(e,"fallback")||Et,l=de(e,"class")||de(e,"className")||"",u=de(e,"fallbackClassName")||"",f=[];if(f.push(`src="${r(o)}"`),f.push(`alt="${r(a)}"`),l)f.push(`class="${r(l)}"`);if(f.push(`data-fallback="${r(c)}"`),u)f.push(`data-fallback-class="${r(u)}"`);f.push('onerror="window.__stxSafeImageHandler(this)"');let v=new Set(["src","alt","fallback","class","className","fallbackClassName"]);f.push(...re(e,v)),f.push(...ie(e,v));let y=`<img ${f.join(" ")} />`,h=n.context;if(!h.__safeImageHandlerEmitted)return h.__safeImageHandlerEmitted=!0,`${Dn}${y}`;return y}};function nt(e){return e.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Se(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Be(e,i,n){let o=Se(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var rt={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(e,i,n){let o=nt(Se(e,"color")||"#6366f1"),a=nt(Se(e,"initialColor")||Se(e,"initial-color")||""),c=nt(Se(e,"height")||"3px"),l=Be(e,"duration",2000),u=Be(e,"throttle",200),f=Be(e,"zIndex",999999)||Be(e,"z-index",999999),v=a?`linear-gradient(to right, ${a}, ${o})`:o;return`
|
|
8
8
|
<div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${c};background:${v};z-index:${f};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
|
|
9
9
|
<div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
|
|
10
10
|
</div>
|
|
11
11
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
12
12
|
<script>
|
|
13
13
|
(function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${u})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
|
|
14
|
-
</script>`}};function Ot(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function
|
|
14
|
+
</script>`}};function Ot(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function jn(e,i,n){let o=Ot(e,i);if(o!==void 0){let a=Number.parseInt(o,10);if(!Number.isNaN(a))return a}return n}var Nt={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},st={name:"StxToast",aliases:["stx-toast"],render(e,i,n){let o=r(Ot(e,"position")||"top-right"),a=jn(e,"max",5),c=Nt[o]||Nt["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${o}" data-stx-toast-max="${a}" style="position:fixed;${c};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
15
15
|
<style>
|
|
16
16
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
17
17
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -28,8 +28,8 @@ ${le}
|
|
|
28
28
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
29
29
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
30
30
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
31
|
-
</style>`}};function pe(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Tt={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ot={name:"StxDrawer",aliases:["stx-drawer"],render(e,i,n){let o=pe(e,"id");if(!o)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let a=r(o),c=pe(e,"side")||"right",l=pe(e,"size")||"md",u=pe(e,"closeOnBackdrop")!=="false",f=pe(e,"closeOnEscape")!=="false",v=pe(e,"overlay")!=="false",
|
|
32
|
-
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${
|
|
31
|
+
</style>`}};function pe(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}var Tt={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},ot={name:"StxDrawer",aliases:["stx-drawer"],render(e,i,n){let o=pe(e,"id");if(!o)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let a=r(o),c=pe(e,"side")||"right",l=pe(e,"size")||"md",u=pe(e,"closeOnBackdrop")!=="false",f=pe(e,"closeOnEscape")!=="false",v=pe(e,"overlay")!=="false",y=Tt[l]||Tt.md,h=c==="left",C=h?"left:0":"right:0",S=h?"translateX(-100%)":"translateX(100%)",b=h?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${a}" class="stx-drawer-backdrop" data-stx-drawer="${a}" data-close-backdrop="${u}" data-close-escape="${f}" style="display:none;position:fixed;inset:0;z-index:99999;${v?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
32
|
+
<div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${C};width:${y};max-width:100vw;transform:${S};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
|
|
33
33
|
<div style="padding:1.5rem">${i}</div>
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
@@ -37,6 +37,6 @@ ${le}
|
|
|
37
37
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
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
|
-
</style>`}};import{existsSync as
|
|
41
|
-
`||N==="\t"){let q=Hn(e,B+x.length);if(e[q-1]!=="/")A++;R=q+1}else R=B+x.length}else{if(A--,A===0){E=L;break}R=L+k.length}}if(E===-1){a=S;continue}let G=e.slice(S,E),z=E+k.length;o.push({fullMatch:e.slice(l,z),tagName:v,attributes:d,content:G,startIndex:l,endIndex:z,isSelfClosing:!1}),a=z}}return o}function ut(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Ht(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Me(e,i){let n=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}var qn=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),Xn=new Set([":for","x-for","v-for","@for"]),Zt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Zn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){let v=n.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((v)=>Xn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:oe(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Zt.has(a)){let v=n.get(a);if(!v)v=[],n.set(a,v);v.push(f)}}return i}var Vn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Vt(e){let i=new Map,n=[];for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=n.length-1;l>=0;l--)if(n[l].name===a){n.length=l;break}continue}let c=n.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Zt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Vn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Oc(e,i){if(!/:[\w-]+=/.test(e))return e;let n=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Zn(e));let l=new Set([...mt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(y){return a.some(([C,S])=>y>=C&&y<S)}let f=[],v=new Map,h=256;for(let y of Oe(n)){if(y.closing||u(y.start))continue;let C=y.attributes.trimEnd();if(!C||!C.includes(":"))continue;let S=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,d,x=C,k=!1;while((d=b.exec(C))!==null){if(Dr(C,d.index,!0)?.kind==="attribute")continue;let A=d[1],R=d[2];if(Hl(A))continue;if(F(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),G=Object.values(i),z=R.match(/^([a-zA-Z_$][\w$]*)/);if(z&&!E.includes(z[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(z[1]))continue;let B=JSON.stringify([E,R]),L=v.get(B);if(!L){if(L=Function(...E,`return (${R})`),v.size>=h)v.clear();v.set(B,L)}let N=L(...G);if(A==="class"){let q=Y(Gt(N));if(q){let I=x.match(/\sclass="([^"]*)"/);if(I)x=x.replace(I[0],()=>` class="${I[1]} ${q}"`);else x=x.replace(d[0],()=>` class="${q}"`)}else x=x.replace(d[0],"");k=!0;continue}if(qn.has(A)){if(N)x=x.replace(d[0],` ${A}`);else x=x.replace(d[0],"");k=!0;continue}if(N===null||N===void 0||N===!1)x=x.replace(d[0],"");else{let q=S&&typeof N==="object"?JSON.stringify(N):String(N),I=On(A,q);x=x.replace(d[0],()=>` ${A}="${I}"`)}k=!0}catch(E){if(E instanceof he)throw E;continue}}if(k){let A=y.selfClosing?" /":"",E=`<${y.name}${x}${A}>`;f.push({start:y.start,end:y.end,replacement:E})}}if(f.length>0){let y=Array(f.length*2+1),C=0;for(let S=0;S<f.length;S++){let{start:b,end:d,replacement:x}=f[S];y[S*2]=n.slice(C,b),y[S*2+1]=x,C=d}y[f.length*2]=n.slice(C),n=y.join("")}return n}import Kt from"fs";import Jt from"path";var Yt=!1;function Gn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(C)=>{if(l.size===0)return!1;let S=t(C),b=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let d of l){let x=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${x}\\s*\\(`).test(S))return!0}return!1},f=new Set(Vl),v=(C)=>{if(!C.includes("-")||C.startsWith("@")||C.startsWith(":")||C.startsWith("x-")||C.startsWith("__"))return C;if(C.startsWith("aria-")||C.startsWith("data-"))return C;return C.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())},h=(C,S)=>{let b=v(C);if(c.static[b]=S,b!==C)c.staticNames[b]=C},y={...e};for(let[C,S]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete y[C];let d=b[1]||"modelValue";if(y[`:${d}`]=S,y[`@update:${d}`]=`${S} = $event`,b[2]){let x=b[2].slice(1).split(".").map((k)=>`${k}: true`).join(", ");y[`:${b[1]?`${d}Modifiers`:"modelModifiers"}`]=`{ ${x} }`}}for(let[C,S]of Object.entries(y)){let b=C.startsWith("x-")&&!f.has(C)&&!C.startsWith("x-bind:")&&!C.startsWith("x-on:")?`:${C.slice(2)}`:C;if(b.startsWith("@")){c.events[b]=S;continue}if(b.startsWith("__stx_")){let d=v(b.slice(6));c.serverDynamic[d]=Ht(S,n);continue}if(b.startsWith(":")){let d=v(b.slice(1)),x=S===ne?d:S;if(d==="if"||d==="for"||d==="show"){c.clientReactive[d]=x;continue}if(o){c.clientReactive[d]=x;continue}if(F(x,a)){c.clientReactive[d]=x;continue}if(u(x)){c.clientReactive[d]=x;continue}try{if(!m(x)){if(n.debug)console.error(`Unsafe expression in :${d} binding: ${x}`);c.clientReactive[d]=x;continue}let k=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),R=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(yt(x).some((B)=>!A.has(B)&&!k.includes(B)&&(!(B in globalThis)||R.has(B)))){c.clientReactive[d]=x;continue}let z=p(x,k)(...Object.values(i));if(c.serverDynamic[d]=z,d!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[d]=b.slice(1)}catch{c.clientReactive[d]=x}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let d=Qn(S,a);if(d!==null){c.clientReactive[v(b)]=d;continue}let x=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(x)try{let k=x[1];if(m(k)){let R=p(k,Object.keys(i))(...Object.values(i));h(b,R!=null?String(R):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${k}`);h(b,S)}}catch(k){if(n.debug)console.error(`Error evaluating expression for ${b}:`,k);h(b,S)}else{let k=S,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,R;while((R=A.exec(S))!==null)try{let E=R[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let z=p(E,Object.keys(i))(...Object.values(i));k=k.replace(R[0],String(z??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}h(b,k)}continue}h(b,S===ne?"true":ut(S))}return c}var dt=new Set;function uy(){dt.clear()}function Kn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Jn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var gt=new Set;function dy(){gt.clear()}function Yn(e,i){let n=`${i}\x00${e}`;if(gt.has(n))return;gt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function Qn(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>F(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var er=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function tr(e,i,n){if(!e.includes("@"))return e;if(!er.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return ge(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Qt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${nr(n)}"`).join(" ")}function nr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function rr(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(fe.isBuiltin(a))i.add(a)}return[...i].sort()}async function ug(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let y of e.matchAll(f)){let[C,S,b]=y,d=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,x=b,k,A=[];while((k=d.exec(b))!==null){let[R,E,G,z]=k,B=null,L=null;if(z.startsWith(".")||z.startsWith("/")){let I=Jt.resolve(l,z);if(I.endsWith(".stx"))L=I;else{let _=`${I}.stx`;try{if(Kt.statSync(_).isFile())L=_}catch{try{if(Kt.statSync(I).isDirectory())B=I}catch{}}}}else B=Js(z,l);if(!B&&!L)continue;let N=!1,q=(I,_)=>{c.set(I,_),c.set(I.toLowerCase(),_);let T=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(G&&L)q(G,L),N=!0;else if(E){let I=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let U=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U)return{source:U[1],local:U[2]};return{source:T,local:T}}),_=B?Ir(B):null;for(let{source:T,local:U}of I){let D=null;if(L)D=L;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(U,D),N=!0}}if(N)A.push({start:k.index,end:k.index+R.length})}if(A.length===0)continue;for(let R=A.length-1;R>=0;R--)x=x.slice(0,A[R].start)+x.slice(A[R].end);u.push({start:y.index,end:y.index+C.length,value:`<script${S}>${x}</script>`})}if(u.length===0)return e;let v=[],h=0;for(let y of u)v.push(e.slice(h,y.start),y.value),h=y.end;return v.push(e.slice(h)),v.join("")}async function sr(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[v,h]=f,y=h.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of y){let S=C.split("/"),d=S[S.length-1].replace(/\.stx$/,""),x=d.includes("-")?d.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):d.charAt(0).toUpperCase()+d.slice(1),k=null,A=Ys(C,n,o);for(let R of A)try{if(await Bun.file(R).exists()){k=R;break}}catch{}if(k){l.set(x,k),l.set(d,k),l.set(d.toLowerCase(),k);let R=x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,k),a.add(k),o.debug)console.log(`Imported component: ${x} -> ${k}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function ir(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,v;while((v=f.exec(c))!==null){let h=v.index,y=h+v[0].length-1,C=1,S=y+1;while(S<c.length&&C>0){if(c[S]==="(")C++;else if(c[S]===")"){if(C--,C===0)break}S++}if(C!==0)break;let b=c.substring(y+1,S),d=S+1,x=b.match(/^\s*['"]([^'"]+)['"]/);if(!x){f.lastIndex=d;continue}let k=x[1],A,R=b.slice(x[0].length),E=R.match(/^\s*,\s*/);if(E)A=R.slice(E[0].length).trim();let G={};if(A)try{G=M(A,i)}catch(I){let _=I instanceof Error?I.message:String(I);c=c.replace(c.substring(h,d),`[Error parsing component props: ${_}]`);continue}let z="",B=d,N=c.substring(d).match(/^([\s\S]*?)@endcomponent/);if(N)z=N[1].trim(),B=d+N[0].length;let q=await Ye(k,G,z,l,i,n,o,u,a);c=c.substring(0,h)+q+c.substring(B),f.lastIndex=0}return c}async function or(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=lr(c);if(f.size>0){let d=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...d,...f])]}let v=se(c);c=v.output;let h=mt(i);return c=await b(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await b(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Lr)),c=await b(c,/[a-z][a-z0-9]*/,!1,Lr),c=v.restore(c),c;async function b(d,x,k,A){if(!d)return d;let R=d,E=Wt(R,x,A),G=ft(R),z=!o._nativeHostAttrs&&/space-[xy]-/.test(R),B,L=new Map;for(let I=E.length-1;I>=0;I--){let _=E[I],T=k?J(_.tagName):_.tagName,U=ye(tr(_.attributes,i,n)),D=G.filter(({start:O,end:W})=>_.startIndex>=O&&_.startIndex<W);if(D.some((O)=>O.tag==="template"))Yn(_.tagName,n);let te=D.length>0,ae=new Set(h);for(let O of D)for(let W of O.names)ae.add(W);let j=Gn(U,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let O of oe(j.clientReactive.for))ae.add(O);let X=fe.getBuiltin(_.tagName),Ce=X?await Fr(_.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,be=_.tagName==="Image"&&Zs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((O)=>Ir(O).has("Image"));if(X&&!Ce&&!be){let O={context:i,filePath:n,options:o,dependencies:a},W=X.render(j,_.content,O);if(Object.keys(j.events).length>0){let ce=Qt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=en(W,j.clientReactive);L.set(I,W);continue}if(!k&&_.tagName.includes("-")&&!await Fr(T,l,i,n,o))continue;let le={};for(let[O,W]of Object.entries(j.static))le[O]=W;for(let[O,W]of Object.entries(j.serverDynamic))le[O]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},Z=await Ye(T,le,v.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(z&&Kn(Z)){B??=Vt(R);let O=B.get(_.startIndex);if(O)Jn(_.tagName,O,n)}let P=Z;if(P=ar(P,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let O=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),W=pt(P,!0);if(O.length&&W){if(!Object.hasOwn(ye(P.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))P=P.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+P.slice(W.insertPos);let ee=Se(P);P=P.slice(0,ee.insertPos)+` data-stx-native-forward="${O.join(" ")}"`+P.slice(ee.insertPos)}let ce=pt(P,!0);if(ce){let ee=ye(P.slice(ce.insertPos,ce.tagEnd)),Re=Se(P),nn=ye(P.slice(Re.insertPos,Re.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(nn,"data-stx-native-host-owner"))P=P.slice(0,Re.insertPos)+" data-stx-native-host-owner"+P.slice(Re.insertPos)}}if(Object.keys(j.events).length>0){let O=Se(P);if(O){let W=Qt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");P=P.substring(0,O.insertPos)+` data-stx-parent-events="${ce}" ${W}`+P.substring(O.insertPos)}}if(Object.keys(j.clientReactive).length>0)P=en(P,j.clientReactive);L.set(I,P)}if(L.size===0)return R;let N="",q=0;for(let I=0;I<E.length;I++){let _=L.get(I);if(_===void 0)continue;N+=R.slice(q,E[I].startIndex),N+=_,q=E[I].endIndex}return N+=R.slice(q),N}}function en(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([h])=>!n.has(h)),c=a.filter(([h])=>!o.has(h)).map(([h])=>J(h)).join(" "),l=e,u=a.length>0?Se(l):null;if(u){let h=a.map(([C,S])=>`:${J(C)}="${S.replace(/"/g,""")}"`).join(" "),y=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${y} ${h}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,""")}">${l}</template>`;let v=i.for;if(v){let h=i.key,y=h?` :key="${h.replace(/"/g,""")}"`:"";l=`<template :for="${v.replace(/"/g,""")}"${y}>${l}</template>`}return l}function ar(e,i,n=new Set,o=new Set,a=!1){let c=pt(e,a);if(!c)return e;let l=e.slice(c.insertPos,c.tagEnd),u=i.serverDynamic.class??i.static.class;if(a&&typeof u==="string"&&u&&!o.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,d=b.test(l)?l.replace(b,(x,k,A,R,E)=>`${k}class="${r(`${ut(A??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,c.insertPos)+d+e.slice(c.tagEnd),c.tagEnd+=d.length-l.length,l=d}let f=a||/\bdata-native(?:\s|=)/i.test(l),v=f?o:n,h=new Set(Object.keys(ye(l))),y=new Set(["class","className"]);for(let b of Object.keys(i.static)){let d=i.staticNames[b]??b;if(h.has(d)||v.has(b)||!f&&!Ze(d))y.add(b)}for(let b of Object.keys(i.serverDynamic)){let d=i.serverDynamicNames?.[b]??b;if(h.has(d)||v.has(b)||!f&&!Ze(d))y.add(b)}let C=[];if(f){for(let[b,d]of Object.entries(i.static)){if(y.has(b)||d!==!0&&d!==ne)continue;y.add(b),C.push(`${r(i.staticNames?.[b]??b)}="true"`)}for(let[b,d]of Object.entries(i.serverDynamic)){if(y.has(b)||d!==!0)continue;y.add(b),C.push(`${r(i.serverDynamicNames?.[b]??b)}="true"`)}}let S=[...re(i,y),...ie(i,y),...C];if(f){for(let[b,d]of Object.entries(i.serverDynamic)){if(y.has(b)||d!==!1)continue;let x=i.serverDynamicNames?.[b]??b;S.push(`${r(x)}="false"`)}for(let[b,d]of Object.entries(i.serverDynamic)){if(y.has(b)||d===null||typeof d!=="object")continue;let x=JSON.stringify(d);if(x!==void 0){let k=i.serverDynamicNames?.[b]??b;S.push(`${r(k)}="${r(x)}"`)}}}if(S.length===0)return e;return`${e.slice(0,c.insertPos)} ${S.join(" ")}${e.slice(c.insertPos)}`}function Se(e){let i=tn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:ht(e,n.index+1+n[1].length)};return null}function pt(e,i=!1){let n=Se(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?tn(e,n.tagEnd+1):n;return a&&i?cr(e,a)??a:a}function cr(e,i){if(!e.includes("data-stx-native-host-root"))return null;let n=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),o=e.lastIndexOf("<",i.insertPos),a=0,c;while(o>=0&&o<e.length){if(e.startsWith("<!--",o)){let h=e.indexOf("-->",o+4);if(h<0)return null;o=e.indexOf("<",h+3);continue}let l=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(o));if(!l){o=e.indexOf("<",o+1);continue}let u=l[2].toLowerCase(),f=o+l[0].length,v=ht(e,f);if(l[1]){if(a--,c!==void 0&&a<c)c=void 0;if(a<=0)return null}else if(u==="script"||u==="style"){let h=new RegExp(`</${u}\\s*>`,"gi");if(h.lastIndex=v+1,!h.exec(e))return null;o=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(f,v)),y=a>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner"));if(c===void 0&&!y&&Object.hasOwn(h,"data-stx-native-host-root"))return{insertPos:f,tagEnd:v};if(!n.has(u)&&e[v-1]!=="/"){if(a++,c===void 0&&y)c=a}else if(a===0)return null}o=e.indexOf("<",v+1)}return null}function tn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:ht(e,n+1+l[1].length)}}return null}function ht(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function lr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Oi(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function $s(e,i,n,o,a){if(!Yt)Lt(fe),Yt=!0;let c=await ug(e,i,n,o,a);c=await sr(c,i,n,o,a),c=await ir(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,v=ke(c,qe,(y,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...v.tokens);let h=c;if(c=await or(v.output,i,n,o,a),c===h)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=rr(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
|
|
40
|
+
</style>`}};import{existsSync as Mn,readFileSync as Ln}from"fs";var De=new Map,Dt=new Set;function zn(e){if(Dt.has(e))return;Dt.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 Un(e){let i=process.cwd();for(let n of[`${i}/node_modules/@iconify-json/${e}/icons.json`,`${i}/pantry/@iconify-json/${e}/icons.json`,`${i}/node_modules/@iconify/json/json/${e}.json`,`${i}/pantry/@iconify/json/json/${e}.json`])if(Mn(n))return n;for(let n of[`@iconify-json/${e}/icons.json`,`@iconify/json/json/${e}.json`])try{return w.resolve(n)}catch{}return null}function Fn(e){if(De.has(e))return De.get(e);let i=Un(e);if(!i)return zn(e),null;try{let n=JSON.parse(Ln(i,"utf8"));return De.set(e,n),n}catch{return null}}function Wn(e,i,n,o){let a=[];if(i.rotate)a.push(`rotate(${i.rotate*90} ${n/2} ${o/2})`);if(i.hFlip)a.push(`translate(${n} 0) scale(-1 1)`);if(i.vFlip)a.push(`translate(0 ${o}) scale(1 -1)`);return a.length?`<g transform="${a.join(" ")}">${e}</g>`:e}function Hn(e,i){let n=i,o=e.icons[n],a={hFlip:!1,vFlip:!1,rotate:0};for(let u=0;!o&&u<8;u++){let f=e.aliases?.[n];if(!f)return null;if(f.hFlip)a.hFlip=!a.hFlip;if(f.vFlip)a.vFlip=!a.vFlip;if(f.rotate)a.rotate=((a.rotate+f.rotate)%4+4)%4;n=f.parent,o=e.icons[n]}if(!o)return null;let c=o.width??e.width??24,l=o.height??e.height??24;return{body:Wn(o.body,a,c,l),width:c,height:l}}function me(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);if(e.static[i]!==void 0)return String(e.static[i]);if(e.clientReactive[i]!==void 0)return e.clientReactive[i];return}var at={name:"Icon",aliases:["icon","stx-icon"],render(e,i,n){let o=me(e,"name")??me(e,"icon");if(!o)return"<!-- Icon: missing name/icon prop -->";let a="lucide",c=o;if(o.includes(":")){let x=o.split(":");a=x[0],c=x[1]}let l=r(me(e,"size")||"24"),u=r(me(e,"color")||"currentColor"),f=r(me(e,"class")||""),v=r(me(e,"style")||""),y=De.get(a)??Fn(a);if(!y)return`<!-- Icon: collection "${a}" not loaded -->`;let h=Hn(y,c);if(!h)return`<!-- Icon: "${c}" not found in ${a} -->`;let C=`0 0 ${h.width} ${h.height}`,S=h.body;if(u!=="currentColor")S=S.replace(/currentColor/g,u);let b=f?` class="${f}"`:"",d=v?` style="${v}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${l}" height="${l}" viewBox="${C}" fill="none"${b}${d}>${S}</svg>`}};function jt(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}function Mt(e,i){let n=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${i}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),o=e.match(n);if(!o)return{region:null,rest:e};return{region:o[2],rest:e.replace(o[0],"")}}var ct={name:"Suspense",aliases:["suspense"],render(e,i,n){let o=Mt(i,"fallback"),a=o.rest,c=Mt(a,"error"),l=c.rest,u=o.region??jt(e,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',f=c.region??jt(e,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${u}</div><div data-stx-suspense-error hidden>${f}</div><div data-stx-suspense-content hidden>${l}</div></div>`}};function je(e,...i){for(let n of i){if(e.serverDynamic[n]!==void 0)return String(e.serverDynamic[n]);let o=e.static[n];if(typeof o==="string")return o}return}var lt={name:"TransitionGroup",aliases:["transition-group"],render(e,i,n){let o=(je(e,"name")||"v").replace(/["'<>]/g,""),a=(je(e,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",c=je(e,"class"),l=je(e,"id"),u=[`data-stx-transition-group="${o}"`,c?`class="${c}"`:"",l?`id="${l}"`:""].filter(Boolean).join(" ");return`<${a} ${u}>${i}</${a}>`}};function Lt(e=fe){e.registerBuiltin(Ve),e.registerBuiltin(et),e.registerBuiltin(tt),e.registerBuiltin(rt),e.registerBuiltin(st),e.registerBuiltin(it),e.registerBuiltin(ot),e.registerBuiltin(at),e.registerBuiltin(ct),e.registerBuiltin(lt)}var zt=new Map;function qn(e){let i=zt.get(e.source);if(!i)i=new RegExp(`(${e.source})(?![\\w.:-])`,"y"),zt.set(e.source,i);return i}var Ut=new WeakMap;function Ft(e){let i=Ut.get(e);if(!i)i=new Set([...e].map((o)=>o.toLowerCase())),Ut.set(e,i);let n=i;return(o)=>!/[a-z]/.test(o)&&n.has(o.toLowerCase())}function Xn(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function Wt(e,i,n){let o=[],a=0,c=typeof n==="function"?n:n?(l)=>n.has(l.toLowerCase()):void 0;while(a<e.length){let l=e.indexOf("<",a);if(l===-1)break;let u=qn(i);u.lastIndex=l+1;let f=u.exec(e);if(!f){a=l+1;continue}let v=f[1];if(c&&c(v)){let x=l+1+v.length;while(x<e.length&&e[x]!==">")x++;a=x+1;continue}let y=l+1+v.length,h=null,C=y,S=-1,b=!1;while(y<e.length){let x=e[y];if(h){if(x==="\\"&&y+1<e.length){y+=2;continue}if(x===h)h=null;y++;continue}if(x==='"'||x==="'"){h=x,y++;continue}if(x==="/"&&y+1<e.length&&e[y+1]===">"){S=y+2,b=!0;break}if(x===">"){S=y+1;break}y++}if(S===-1){a=l+1;continue}let d=e.slice(C,b?S-2:S-1).trim();if(b)o.push({fullMatch:e.slice(l,S),tagName:v,attributes:d,content:"",startIndex:l,endIndex:S,isSelfClosing:!0}),a=S;else{let x=`<${v}`,k=`</${v}>`,A=1,R=S,E=-1;while(A>0&&R<e.length){let B=e.indexOf(x,R),L=e.indexOf(k,R);if(L===-1)break;if(B!==-1&&B<L){let N=e[B+x.length];if(N===" "||N===">"||N==="/"||N===`
|
|
41
|
+
`||N==="\t"){let q=Xn(e,B+x.length);if(e[q-1]!=="/")A++;R=q+1}else R=B+x.length}else{if(A--,A===0){E=L;break}R=L+k.length}}if(E===-1){a=S;continue}let G=e.slice(S,E),z=E+k.length;o.push({fullMatch:e.slice(l,z),tagName:v,attributes:d,content:G,startIndex:l,endIndex:z,isSelfClosing:!1}),a=z}}return o}function ut(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function Ht(e,i){try{let n=Buffer.from(e,"base64").toString("utf8");return JSON.parse(n)}catch{}try{let n=e.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(n)}catch(n){if(i?.debug)console.error("Error decoding __stx_ prop:",n);return e}}function Me(e,i){let n=0,o="",a=i;while(a<e.length){let c=e[a];if(o){if(c==="\\")a++;else if(c===o)o=""}else if(c==='"'||c==="'"||c==="`")o=c;else if(c==="{")n++;else if(c==="}"){if(n--,n===0)return e.slice(i,a+1)}a++}return e.slice(i)}function qt(e){let i=e.trim();if(!i.startsWith("{")||!i.endsWith("}"))return null;if(Me(i,0).length!==i.length)return null;return i.slice(1,-1).trim()}function Xt(e){let i=[],n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o&&e[n]!==l){if(e[n]==="\\"&&n+1<o)n++,c+=e[n];else c+=e[n];n++}if(n<o)n++}else if(e[n]==="{")c=Me(e,n),n+=c.length;else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i.push({name:a,value:c})}else i.push({name:a,value:!0})}return i}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"]),Vn=new Set([":for","x-for","v-for","@for"]),Zt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gn(e){return ft(e).map((i)=>[i.start,i.end])}function ft(e){let i=[],n=new Map;for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){let v=n.get(a)?.pop();if(v)v.end=o.end;continue}let l=/(?::for|x-for|v-for|@for)\s*=/.test(o.attributes)?Xt(o.attributes).find((v)=>Vn.has(v.name)):void 0,u=typeof l?.value==="string"?l.value:null,f=u!==null?{start:o.start,end:o.end,names:oe(u),tag:a}:null;if(f)i.push(f);if(!o.selfClosing&&!Zt.has(a)){let v=n.get(a);if(!v)v=[],n.set(a,v);v.push(f)}}return i}var Kn=/(?:^|\s)((?:[\w-]+:)*-?space-[xy]-(?!reverse(?:\s|$))[\w./[\]-]+)(?=\s|$)/;function Vt(e){let i=new Map,n=[];for(let o of Oe(e)){let a=o.name.toLowerCase();if(o.closing){for(let l=n.length-1;l>=0;l--)if(n[l].name===a){n.length=l;break}continue}let c=n.at(-1);if(c){if(c.utility&&c.children>0)i.set(o.start,c.utility);if(!/(?:^|\s)hidden(?=[\s=]|$)/.test(o.attributes))c.children++}if(!o.selfClosing&&!Zt.has(a)){let l=/(?:^|\s)class\s*=\s*(["'])([\s\S]*?)\1/.exec(o.attributes)?.[2];n.push({name:a,utility:l?Kn.exec(l)?.[1]??null:null,children:0})}}return i}function Gt(e){if(typeof e==="string")return e;if(Array.isArray(e))return e.filter(Boolean).map((i)=>Gt(i)).join(" ");if(e&&typeof e==="object")return Object.entries(e).filter(([,i])=>i).map(([i])=>i).join(" ");return e?String(e):""}function Oc(e,i){if(!/:[\w-]+=/.test(e))return e;let n=e,o=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,a=[],c;while((c=o.exec(e))!==null)a.push([c.index,c.index+c[0].length]);a.push(...Gn(e));let l=new Set([...mt(i),...Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]]);function u(h){return a.some(([C,S])=>h>=C&&h<S)}let f=[],v=new Map,y=256;for(let h of Oe(n)){if(h.closing||u(h.start))continue;let C=h.attributes.trimEnd();if(!C||!C.includes(":"))continue;let S=/(?:^|\s)data-native(?:\s|=|$)/i.test(C.replace(/"[^"]*"|'[^']*'/g,"")),b=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,d,x=C,k=!1;while((d=b.exec(C))!==null){if(Dr(C,d.index,!0)?.kind==="attribute")continue;let A=d[1],R=d[2];if(Hl(A))continue;if(F(R,l))continue;if(R.includes("()")&&!R.includes(".get(")||R.includes("$store")||R.includes("$ref"))continue;try{let E=Object.keys(i),G=Object.values(i),z=R.match(/^([a-zA-Z_$][\w$]*)/);if(z&&!E.includes(z[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(z[1]))continue;let B=JSON.stringify([E,R]),L=v.get(B);if(!L){if(L=Function(...E,`return (${R})`),v.size>=y)v.clear();v.set(B,L)}let N=L(...G);if(A==="class"){let q=Y(Gt(N));if(q){let P=x.match(/\sclass="([^"]*)"/);if(P)x=x.replace(P[0],()=>` class="${P[1]} ${q}"`);else x=x.replace(d[0],()=>` class="${q}"`)}else x=x.replace(d[0],"");k=!0;continue}if(Zn.has(A)){if(N)x=x.replace(d[0],` ${A}`);else x=x.replace(d[0],"");k=!0;continue}if(N===null||N===void 0||N===!1)x=x.replace(d[0],"");else{let q=S&&typeof N==="object"?JSON.stringify(N):String(N),P=On(A,q);x=x.replace(d[0],()=>` ${A}="${P}"`)}k=!0}catch(E){if(E instanceof he)throw E;continue}}if(k){let A=h.selfClosing?" /":"",E=`<${h.name}${x}${A}>`;f.push({start:h.start,end:h.end,replacement:E})}}if(f.length>0){let h=Array(f.length*2+1),C=0;for(let S=0;S<f.length;S++){let{start:b,end:d,replacement:x}=f[S];h[S*2]=n.slice(C,b),h[S*2+1]=x,C=d}h[f.length*2]=n.slice(C),n=h.join("")}return n}import Kt from"fs";import Jt from"path";var Yt=!1;function Jn(e,i,n,o=!1,a=new Set){let c={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},l=new Set(Array.isArray(i.__stx_client_signal_names)?i.__stx_client_signal_names:[]),u=(C)=>{if(l.size===0)return!1;let S=t(C),b=S.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(b&&l.has(b))return!0;for(let d of l){let x=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${x}\\s*\\(`).test(S))return!0}return!1},f=new Set(Ul),v=(C)=>{if(!C.includes("-")||C.startsWith("@")||C.startsWith(":")||C.startsWith("x-")||C.startsWith("__"))return C;if(C.startsWith("aria-")||C.startsWith("data-"))return C;return C.replace(/-([a-z0-9])/g,(S,b)=>b.toUpperCase())},y=(C,S)=>{let b=v(C);if(c.static[b]=S,b!==C)c.staticNames[b]=C},h={...e};for(let[C,S]of Object.entries(e)){let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(C);if(!b)continue;delete h[C];let d=b[1]||"modelValue";if(h[`:${d}`]=S,h[`@update:${d}`]=`${S} = $event`,b[2]){let x=b[2].slice(1).split(".").map((k)=>`${k}: true`).join(", ");h[`:${b[1]?`${d}Modifiers`:"modelModifiers"}`]=`{ ${x} }`}}for(let[C,S]of Object.entries(h)){let b=C.startsWith("x-")&&!f.has(C)&&!C.startsWith("x-bind:")&&!C.startsWith("x-on:")?`:${C.slice(2)}`:C;if(b.startsWith("@")){c.events[b]=S;continue}if(b.startsWith("__stx_")){let d=v(b.slice(6));c.serverDynamic[d]=Ht(S,n);continue}if(b.startsWith(":")){let d=v(b.slice(1)),x=S===ne?d:S;if(d==="if"||d==="for"||d==="show"){c.clientReactive[d]=x;continue}if(o){c.clientReactive[d]=x;continue}if(F(x,a)){c.clientReactive[d]=x;continue}if(u(x)){c.clientReactive[d]=x;continue}try{if(!m(x)){if(n.debug)console.error(`Unsafe expression in :${d} binding: ${x}`);c.clientReactive[d]=x;continue}let k=Object.keys(i),A=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]),R=new Set(Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[]);if(yt(x).some((B)=>!A.has(B)&&!k.includes(B)&&(!(B in globalThis)||R.has(B)))){c.clientReactive[d]=x;continue}let z=p(x,k)(...Object.values(i));if(c.serverDynamic[d]=z,d!==b.slice(1)&&c.serverDynamicNames)c.serverDynamicNames[d]=b.slice(1)}catch{c.clientReactive[d]=x}continue}if(typeof S==="string"&&S.includes("{{")&&S.includes("}}")){let d=tr(S,a);if(d!==null){c.clientReactive[v(b)]=d;continue}let x=S.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(x)try{let k=x[1];if(m(k)){let R=p(k,Object.keys(i))(...Object.values(i));y(b,R!=null?String(R):"")}else{if(n.debug)console.error(`Unsafe expression in ${b}: ${k}`);y(b,S)}}catch(k){if(n.debug)console.error(`Error evaluating expression for ${b}:`,k);y(b,S)}else{let k=S,A=/\{\{\s*([\s\S]+?)\s*\}\}/g,R;while((R=A.exec(S))!==null)try{let E=R[1];if(!m(E)){if(n.debug)console.error(`Unsafe expression in ${b}: ${E}`);continue}let z=p(E,Object.keys(i))(...Object.values(i));k=k.replace(R[0],String(z??""))}catch(E){if(n.debug)console.error(`Error evaluating expression in ${b}:`,E)}y(b,k)}continue}y(b,S===ne?"true":ut(S))}return c}var dt=new Set;function uy(){dt.clear()}function Yn(e){let i=/^\s*(?:<!--[\s\S]*?-->\s*)*<(?:div|span)\b((?:[^>"']|"[^"]*"|'[^']*')*)>/.exec(e);return!!i&&/\sdata-stx-component-wrapper(?=[\s=]|$)/.test(i[1])&&!/\sstx-hydrate(?=[\s=]|$)/.test(i[1])}function Qn(e,i,n){let o=`${n}\x00${e}\x00${i}`;if(dt.has(o))return;dt.add(o);let a=/space-x-/.test(i)?"flex":"flex flex-col",c=i.replace(/space-[xy]-/,"gap-");console.warn(`[stx] <${e}> in ${n} is a later child of a "${i}" stack, so it gets no spacing: the utility puts its margin on the component's scope wrapper, which generates no box. Use "${a} ${c}" on the parent instead -- gap reaches through the wrapper.`)}var gt=new Set;function dy(){gt.clear()}function er(e,i){let n=`${i}\x00${e}`;if(gt.has(n))return;gt.add(n),console.warn(`[stx] <${e}> in ${i} is inside a <template :for>, so its props and slot expressions will not see the loop variables and render empty. Put the directive on the element the loop repeats instead -- <tr :for="..."> or <span :for="..." class="contents"> -- which binds correctly.`)}function tr(e,i){if(i.size===0)return null;let n=/\{\{\s*([\s\S]+?)\s*\}\}/g,o=[...e.matchAll(n)];if(!o.some((u)=>F(u[1],i)))return null;let a=e.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(a&&o.length===1)return a[1];let c="",l=0;for(let u of o)c+=e.slice(l,u.index).replace(/[`\\$]/g,(f)=>`\\${f}`),c+=`\${${u[1]}}`,l=u.index+u[0].length;return c+=e.slice(l).replace(/[`\\$]/g,(u)=>`\\${u}`),`\`${c}\``}var nr=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function rr(e,i,n){if(!e.includes("@"))return e;if(!nr.some(([a,c])=>a.test(e)&&e.includes(c)))return e;try{return ge(e,i,n)}catch{return e}}function ye(e){let i={},n=0,o=e.length;while(n<o){while(n<o&&/\s/.test(e[n]))n++;if(n>=o)break;let a="";while(n<o&&!/[\s=]/.test(e[n]))a+=e[n],n++;if(!a)break;while(n<o&&/\s/.test(e[n]))n++;if(n<o&&e[n]==="="){n++;while(n<o&&/\s/.test(e[n]))n++;let c="";if(n<o&&(e[n]==='"'||e[n]==="'")){let l=e[n];n++;while(n<o){let u=e[n];if(u==="\\"&&n+1<o){n++,c+=e[n],n++;continue}if(u===l){n++;break}c+=u,n++}}else if(e[n]==="{"){c=Me(e,n),n+=c.length;let l=qt(c);if(l!==null){i[`:${a}`]=l;continue}}else while(n<o&&!/\s/.test(e[n]))c+=e[n],n++;i[a]=c}else i[a]=ne}return i}function Qt(e){return Object.entries(e).map(([i,n])=>n===ne?i:`${i}="${sr(n)}"`).join(" ")}function sr(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function ir(e){let i=new Set,n=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,o;while((o=n.exec(e))!==null){let a=o[1];if(fe.isBuiltin(a))i.add(a)}return[...i].sort()}async function ug(e,i,n,o,a){if(!/import\s/.test(e))return e;if(!i.__importedComponents)i.__importedComponents=new Map;let c=i.__importedComponents,l=Jt.dirname(n),u=[],f=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;for(let h of e.matchAll(f)){let[C,S,b]=h,d=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,x=b,k,A=[];while((k=d.exec(b))!==null){let[R,E,G,z]=k,B=null,L=null;if(z.startsWith(".")||z.startsWith("/")){let P=Jt.resolve(l,z);if(P.endsWith(".stx"))L=P;else{let _=`${P}.stx`;try{if(Kt.statSync(_).isFile())L=_}catch{try{if(Kt.statSync(P).isDirectory())B=P}catch{}}}}else B=Js(z,l);if(!B&&!L)continue;let N=!1,q=(P,_)=>{c.set(P,_),c.set(P.toLowerCase(),_);let T=P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();c.set(T,_),a.add(_)};if(G&&L)q(G,L),N=!0;else if(E){let P=E.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let U=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U)return{source:U[1],local:U[2]};return{source:T,local:T}}),_=B?Ir(B):null;for(let{source:T,local:U}of P){let D=null;if(L)D=L;else if(_)D=_.get(T)??_.get(T.toLowerCase())??_.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)q(U,D),N=!0}}if(N)A.push({start:k.index,end:k.index+R.length})}if(A.length===0)continue;for(let R=A.length-1;R>=0;R--)x=x.slice(0,A[R].start)+x.slice(A[R].end);u.push({start:h.index,end:h.index+C.length,value:`<script${S}>${x}</script>`})}if(u.length===0)return e;let v=[],y=0;for(let h of u)v.push(e.slice(y,h.start),h.value),y=h.end;return v.push(e.slice(y)),v.join("")}async function or(e,i,n,o,a){let c=e;if(!i.__importedComponents)i.__importedComponents=new Map;let l=i.__importedComponents,u=/@import\s*\(\s*([^)]+)\s*\)/g,f;while((f=u.exec(c))!==null){let[v,y]=f,h=y.split(",").map((C)=>C.trim().replace(/^['"]|['"]$/g,"")).filter((C)=>C.length>0);for(let C of h){let S=C.split("/"),d=S[S.length-1].replace(/\.stx$/,""),x=d.includes("-")?d.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):d.charAt(0).toUpperCase()+d.slice(1),k=null,A=Ys(C,n,o);for(let R of A)try{if(await Bun.file(R).exists()){k=R;break}}catch{}if(k){l.set(x,k),l.set(d,k),l.set(d.toLowerCase(),k);let R=x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(l.set(R,k),a.add(k),o.debug)console.log(`Imported component: ${x} -> ${k}`)}else if(o.debug)console.warn(`Could not resolve imported component: ${C}`)}c=c.replace(v,""),u.lastIndex=0}return c}async function ar(e,i,n,o,a){let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=/@component\s*\(/g,v;while((v=f.exec(c))!==null){let y=v.index,h=y+v[0].length-1,C=1,S=h+1;while(S<c.length&&C>0){if(c[S]==="(")C++;else if(c[S]===")"){if(C--,C===0)break}S++}if(C!==0)break;let b=c.substring(h+1,S),d=S+1,x=b.match(/^\s*['"]([^'"]+)['"]/);if(!x){f.lastIndex=d;continue}let k=x[1],A,R=b.slice(x[0].length),E=R.match(/^\s*,\s*/);if(E)A=R.slice(E[0].length).trim();let G={};if(A)try{G=M(A,i)}catch(P){let _=P instanceof Error?P.message:String(P);c=c.replace(c.substring(y,d),`[Error parsing component props: ${_}]`);continue}let z="",B=d,N=c.substring(d).match(/^([\s\S]*?)@endcomponent/);if(N)z=N[1].trim(),B=d+N[0].length;let q=await Ye(k,G,z,l,i,n,o,u,a);c=c.substring(0,y)+q+c.substring(B),f.lastIndex=0}return c}async function cr(e,i,n,o,a){if(!e)return e;let c=e,l=o.componentsDir||"components";if(!i.__processedComponents)i.__processedComponents=new Set;let u=i.__processedComponents,f=fr(c);if(f.size>0){let d=Array.isArray(i.__stx_client_declared_names)?i.__stx_client_declared_names:[];i.__stx_client_declared_names=[...new Set([...d,...f])]}let v=se(c);c=v.output;let y=mt(i);return c=await b(c,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),c=await b(c,/[A-Z][a-zA-Z0-9]*/,!0,Ft(Lr)),c=await b(c,/[a-z][a-z0-9]*/,!1,Lr),c=v.restore(c),c;async function b(d,x,k,A){if(!d)return d;let R=d,E=Wt(R,x,A),G=ft(R),z=!o._nativeHostAttrs&&/space-[xy]-/.test(R),B,L=new Map;for(let P=E.length-1;P>=0;P--){let _=E[P],T=k?J(_.tagName):_.tagName,U=ye(rr(_.attributes,i,n)),D=G.filter(({start:O,end:W})=>_.startIndex>=O&&_.startIndex<W);if(D.some((O)=>O.tag==="template"))er(_.tagName,n);let te=D.length>0,ae=new Set(y);for(let O of D)for(let W of O.names)ae.add(W);let j=Jn(U,i,o,te,ae);if(typeof j.clientReactive.for==="string")for(let O of oe(j.clientReactive.for))ae.add(O);let X=fe.getBuiltin(_.tagName),Ce=X?await Fr(_.tagName,l,i,n,{...o,_nativePrimitivesFallback:void 0}):!1,xe=_.tagName==="Image"&&Zs([...Object.keys(j.static),...Object.keys(j.serverDynamic),...Object.keys(j.clientReactive)],Object.keys(j.events),{...j.static,...j.serverDynamic})&&(o._pluginComponentDirs??[]).some((O)=>Ir(O).has("Image"));if(X&&!Ce&&!xe){let O={context:i,filePath:n,options:o,dependencies:a},W=X.render(j,_.content,O);if(Object.keys(j.events).length>0){let ce=Qt(j.events);W=W.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${ce}`)}if(Object.keys(j.clientReactive).length>0)W=en(W,j.clientReactive);L.set(P,W);continue}if(!k&&_.tagName.includes("-")&&!await Fr(T,l,i,n,o))continue;let le={};for(let[O,W]of Object.entries(j.static))le[O]=W;for(let[O,W]of Object.entries(j.serverDynamic))le[O]=W;let Q={declaredProps:new Set,consumedProps:new Set,reactiveProps:Object.keys(j.clientReactive),events:Object.keys(j.events)},Z=await Ye(T,le,v.restore(_.content),l,i,n,o,u,a,[...ae],Q,_.tagName);if(z&&Yn(Z)){B??=Vt(R);let O=B.get(_.startIndex);if(O)Qn(_.tagName,O,n)}let I=Z;if(I=lr(I,j,Q.declaredProps,Q.consumedProps,o._nativeHostAttrs),o._nativeHostAttrs){let O=Q.reactiveProps.filter((ee)=>!Q.consumedProps.has(ee)&&!["if","for","show","key","ref"].includes(ee)).map(J),W=pt(I,!0);if(O.length&&W){if(!Object.hasOwn(ye(I.slice(W.insertPos,W.tagEnd)),"data-stx-native-host-root"))I=I.slice(0,W.insertPos)+' data-stx-native-host-root="true"'+I.slice(W.insertPos);let ee=be(I);I=I.slice(0,ee.insertPos)+` data-stx-native-forward="${O.join(" ")}"`+I.slice(ee.insertPos)}let ce=pt(I,!0);if(ce){let ee=ye(I.slice(ce.insertPos,ce.tagEnd)),Re=be(I),sn=ye(I.slice(Re.insertPos,Re.tagEnd));if(Object.hasOwn(ee,"data-stx-native-host-root")&&!Object.hasOwn(sn,"data-stx-native-host-owner"))I=I.slice(0,Re.insertPos)+" data-stx-native-host-owner"+I.slice(Re.insertPos)}}if(Object.keys(j.events).length>0){let O=be(I);if(O){let W=Qt(j.events),ce=Object.keys(j.events).map((ee)=>ee.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,O.insertPos)+` data-stx-parent-events="${ce}" ${W}`+I.substring(O.insertPos)}}if(Object.keys(j.clientReactive).length>0)I=en(I,j.clientReactive);L.set(P,I)}if(L.size===0)return R;let N="",q=0;for(let P=0;P<E.length;P++){let _=L.get(P);if(_===void 0)continue;N+=R.slice(q,E[P].startIndex),N+=_,q=E[P].endIndex}return N+=R.slice(q),N}}function en(e,i){let n=new Set(["if","for"]),o=new Set(["show"]),a=Object.entries(i).filter(([y])=>!n.has(y)),c=a.filter(([y])=>!o.has(y)).map(([y])=>J(y)).join(" "),l=e,u=a.length>0?be(l):null;if(u){let y=a.map(([C,S])=>`:${J(C)}="${S.replace(/"/g,""")}"`).join(" "),h=c?` data-stx-parent-bindings="${c}"`:"";l=l.substring(0,u.insertPos)+`${h} ${y}`+l.substring(u.insertPos)}let f=i.if;if(f)l=`<template :if="${f.replace(/"/g,""")}">${l}</template>`;let v=i.for;if(v){let y=i.key,h=y?` :key="${y.replace(/"/g,""")}"`:"";l=`<template :for="${v.replace(/"/g,""")}"${h}>${l}</template>`}return l}function lr(e,i,n=new Set,o=new Set,a=!1){let c=pt(e,a);if(!c)return e;let l=a?be(e):null;if(l){let u=nn(e,l).filter((f)=>f.insertPos>c.insertPos);for(let f=u.length-1;f>=0;f--)e=tn(e,u[f],i,n,o,a)}return tn(e,c,i,n,o,a)}function tn(e,i,n,o,a,c){let l=e.slice(i.insertPos,i.tagEnd),u=n.serverDynamic.class??n.static.class;if(c&&typeof u==="string"&&u&&!a.has("class")){let b=/(^|\s)class\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i,d=b.test(l)?l.replace(b,(x,k,A,R,E)=>`${k}class="${r(`${ut(A??R??E)} ${u}`)}"`):` class="${r(u)}"${l}`;e=e.slice(0,i.insertPos)+d+e.slice(i.tagEnd),i.tagEnd+=d.length-l.length,l=d}let f=c||/\bdata-native(?:\s|=)/i.test(l),v=f?a:o,y=new Set(Object.keys(ye(l))),h=new Set(["class","className"]);for(let b of Object.keys(n.static)){let d=n.staticNames[b]??b;if(y.has(d)||v.has(b)||!f&&!Ze(d))h.add(b)}for(let b of Object.keys(n.serverDynamic)){let d=n.serverDynamicNames?.[b]??b;if(y.has(d)||v.has(b)||!f&&!Ze(d))h.add(b)}let C=[];if(f){for(let[b,d]of Object.entries(n.static)){if(h.has(b)||d!==!0&&d!==ne)continue;h.add(b),C.push(`${r(n.staticNames?.[b]??b)}="true"`)}for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d!==!0)continue;h.add(b),C.push(`${r(n.serverDynamicNames?.[b]??b)}="true"`)}}let S=[...re(n,h),...ie(n,h),...C];if(f){for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d!==!1)continue;let x=n.serverDynamicNames?.[b]??b;S.push(`${r(x)}="false"`)}for(let[b,d]of Object.entries(n.serverDynamic)){if(h.has(b)||d===null||typeof d!=="object")continue;let x=JSON.stringify(d);if(x!==void 0){let k=n.serverDynamicNames?.[b]??b;S.push(`${r(k)}="${r(x)}"`)}}}if(S.length===0)return e;return`${e.slice(0,i.insertPos)} ${S.join(" ")}${e.slice(i.insertPos)}`}function be(e){let i=rn(e,0);if(i)return i;let n=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(e);if(n)return{insertPos:n.index+1+n[1].length,tagEnd:ht(e,n.index+1+n[1].length)};return null}function pt(e,i=!1){let n=be(e);if(!n)return null;let o=e.slice(n.insertPos,n.tagEnd),a=/\bdata-stx-component-wrapper(?:\s|=|>|$)/i.test(o)?rn(e,n.tagEnd+1):n;return a&&i?ur(e,a)??a:a}function ur(e,i){return nn(e,i)[0]??null}function nn(e,i){let n=[];if(!e.includes("data-stx-native-host-root"))return n;let o=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),a=e.lastIndexOf("<",i.insertPos),c=0,l;while(a>=0&&a<e.length){if(e.startsWith("<!--",a)){let h=e.indexOf("-->",a+4);if(h<0)return n;a=e.indexOf("<",h+3);continue}let u=/^<(\/?)([a-z][\w-]*)\b/i.exec(e.slice(a));if(!u){a=e.indexOf("<",a+1);continue}let f=u[2].toLowerCase(),v=a+u[0].length,y=ht(e,v);if(u[1]){if(c--,l!==void 0&&c<l)l=void 0;if(c<=0)return n}else if(f==="script"||f==="style"){let h=new RegExp(`</${f}\\s*>`,"gi");if(h.lastIndex=y+1,!h.exec(e))return n;a=e.indexOf("<",h.lastIndex);continue}else{let h=ye(e.slice(v,y)),C=c>0&&(Object.hasOwn(h,"data-stx-component-wrapper")||Object.hasOwn(h,"data-stx-native-host-owner")),S=l===void 0&&!C&&Object.hasOwn(h,"data-stx-native-host-root");if(S)n.push({insertPos:v,tagEnd:y});if(!o.has(f)&&e[y-1]!=="/"){if(c++,l===void 0&&(C||S))l=c}else if(c===0)return n}a=e.indexOf("<",y+1)}return n}function rn(e,i){let n=i;while(n<e.length){let o=e.slice(n),a=o.match(/^\s+/);if(a){n+=a[0].length;continue}if(o.startsWith("<!--")){let u=e.indexOf("-->",n+4);if(u===-1)return null;n=u+3;continue}let c=o.match(/^<(script|style)\b[^>]*>/i);if(c){let u=`</${c[1].toLowerCase()}>`,f=e.toLowerCase().indexOf(u,n+c[0].length);if(f===-1)return null;n=f+u.length;continue}let l=o.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!l)return null;return{insertPos:n+1+l[1].length,tagEnd:ht(e,n+1+l[1].length)}}return null}function ht(e,i){let n="";for(let o=i;o<e.length;o++){let a=e[o];if(n){if(a==="\\")o++;else if(a===n)n=""}else if(a==='"'||a==="'")n=a;else if(a===">")return o}return e.length}function fr(e){let i=new Set;for(let n of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi)){let o=n[1];if(!/\bclient\b/.test(o)||/\bserver\b/.test(o))continue;for(let a of Oi(n[2]))i.add(a);for(let a of n[2].matchAll(/^\s*import\s+(?:type\s+)?(?:([\w$]+)\s*,?\s*)?(?:\{([^}]*)\}|\*\s+as\s+([\w$]+))?\s*from\s/gm)){if(a[1])i.add(a[1]);if(a[3])i.add(a[3]);for(let c of(a[2]??"").split(",")){let l=c.replace(/^\s*type\s+/,"").split(/\s+as\s+/).pop().trim();if(/^[A-Za-z_$][\w$]*$/.test(l))i.add(l)}}}return i}async function $s(e,i,n,o,a){if(!Yt)Lt(fe),Yt=!0;let c=await ug(e,i,n,o,a);c=await or(c,i,n,o,a),c=await ar(c,i,n,o,a);let l=[];for(let u=0;u<3;u++){let f=l.length,v=ke(c,qe,(h,C)=>`\x00STX_COMPONENT_COMMENT_${f+C}\x00`,`STX_COMPONENT_COMMENT:${f}`);l.push(...v.tokens);let y=c;if(c=await cr(v.output,i,n,o,a),c===y)break}if(l.length>0)c=c.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(u,f)=>l[Number(f)]??"");if(o.debug){let u=ir(c);if(u.length>0)console.warn(`[stx] ${n}: unresolved component tag(s) after render passes: ${u.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return c}
|
|
42
42
|
export{si,oi,ii,cy,Ts,ly,Oc,uy,dy,ug,$s};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ja,Ya,Za,Qa,Qh}from"./chunk-nvre22sw.js";import"./chunk-mxf6cfbg.js";import"./chunk-0yxvz6qz.js";import"./chunk-pvm48tse.js";import"./chunk-1vp0h7d6.js";import"./chunk-dm069acv.js";import"./chunk-7d2j41e3.js";import"./chunk-05x1rd86.js";import"./chunk-w8djc4qb.js";import"./chunk-0w578pgv.js";import"./chunk-z6ndrx2p.js";import"./chunk-xvprhdcb.js";import"./chunk-yv797v6e.js";import"./chunk-gydvy8a3.js";import"./chunk-n64zbwzr.js";import"./chunk-gwayvyg5.js";import"./chunk-n6q1d66k.js";import"./chunk-e5md1cck.js";import"./chunk-b0jk94wx.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import"./chunk-9w6k311w.js";import"./chunk-ypyezjr0.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{Ja as buildNative,Qh as default,Ya as findCraftBinary,Qa as getAvailableFormats,Za as getAvailableTargets};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{hr,i}from"./chunk-1vp0h7d6.js";import"./chunk-dm069acv.js";import"./chunk-7d2j41e3.js";import"./chunk-05x1rd86.js";import"./chunk-w8djc4qb.js";import"./chunk-0w578pgv.js";import"./chunk-z6ndrx2p.js";import"./chunk-xvprhdcb.js";import"./chunk-yv797v6e.js";import{Ae}from"./chunk-gydvy8a3.js";import"./chunk-n64zbwzr.js";import"./chunk-gwayvyg5.js";import"./chunk-n6q1d66k.js";import"./chunk-e5md1cck.js";import"./chunk-b0jk94wx.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{We,io,ao}from"./chunk-9w6k311w.js";import"./chunk-ypyezjr0.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{hr as buildModulesTag,Ae as injectRouterScript,i as processDirectives,io as processJsonDirective,ao as processOnceDirective,We as validateClientScript};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Jr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Jr(i,n,r+1,o))return!0}return!1}var C=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Bl=["onMount","onDestroy"];function xt(e="const",t=[],r){let o=t.length?C.filter((s)=>!t.includes(s)):C;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=C.filter((e)=>!y.includes(e));function ta(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function Fl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(ta(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Jr(r[1],t))return!0;return!1}function zl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Hl(e){return R.includes(e.toLowerCase())}var wo=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],
|
|
3
|
-
export{Jr,C,Bl,xt,ta,Fl,zl,Hl,wo,Vl,
|
|
2
|
+
import l from"fs";import u from"path";var m=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^<>()]*>)?\s*\(/,g=/(?:^|\n)\s*(?:import|export)\s+(?:[^'"]*?\sfrom\s+)?['"](\.[^'"]*)['"]/g,b=["",".ts",".tsx",".js",".jsx",".mts",".mjs","/index.ts","/index.js"],x=3;function h(e,t){let r=u.resolve(u.dirname(t),e);for(let o of b){let s=r+o;try{if(l.statSync(s).isFile())return s}catch{}}return null}function Jr(e,t,r=0,o=new Set){if(!t||r>=x)return!1;for(let s of e.matchAll(g)){let n=h(s[1],t);if(!n||o.has(n))continue;o.add(n);let i;try{i=l.readFileSync(n,"utf8")}catch{continue}if(m.test(i))return!0;if(Jr(i,n,r+1,o))return!0}return!1}var C=["batch","cachedQuery","clearServerData","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","flushKeptState","forgetKeptState","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","keptState","memo","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refDebounced","refresh","registerStoresClient","setKeptScope","setRouteParams","sharedRequest","state","untrack","useAsync","useBroadcastStream","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebounceFn","useDebouncedValue","useDocumentVisibility","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useModel","useMutation","useNativeDesktop","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useThrottleFn","useTimeout","useTimeoutFn","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],Bl=["onMount","onDestroy"];function xt(e="const",t=[],r){let o=t.length?C.filter((s)=>!t.includes(s)):C;if(r!==void 0)o=o.filter((s)=>{let n=s.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${n}(?![\\w$])`).test(r)});return`${e} { ${o.join(", ")} } = window.stx;`}var y=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"];var S=C.filter((e)=>!y.includes(e));function ta(e){if(!e)return!1;return S.some((t)=>new RegExp(`\\b${t}\\s*(?:<[^>]*>)?\\s*\\(`).test(e))}var v=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],E=/\s@[a-z][\w.:-]*\s*=/i;function Fl(e,t){if(!e)return!1;let r=f(e);return d(r,t)}function d(e,t){if(v.some((r)=>r.test(e)))return!0;if(ta(e))return!0;return T(e,t)}function T(e,t){if(!t)return!1;for(let r of e.matchAll(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script\s*>/gi))if(Jr(r[1],t))return!0;return!1}function zl(e,t){if(!e)return!1;let r=f(e);return E.test(r)||d(r,t)}var R=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];function Hl(e){return R.includes(e.toLowerCase())}var wo=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_=["x-init","x-transition","x-effect","x-on"],Ul=[...wo,..._];function Vl(){return`{${wo.map((e)=>`'${e}':1`).join(",")}}`}var na=["class","style","text","html","show","model","if","ref"];function Wl(){return`{${na.map((e)=>e==="if"?"'if':1":`${e}:1`).join(",")}}`}var p=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","keydown","keyup","keypress","input","change","submit","focus","blur","scroll","resize","touchstart","touchend","touchmove","contextmenu","wheel","pointerdown","pointerup","pointermove"];function ql(){return`/^(${p.join("|")})(?:\\.|$)/`}function Kl(e){return p.some((t)=>e===t||e.startsWith(`${t}.`))}var w=65536,A=4,c=new Map;function f(e){if(!e)return e;if(!e.includes("<!--")&&!/<(?:pre|code)\b/i.test(e))return e;let t=e.length>=w;if(t){let s=c.get(e);if(s!==void 0)return s}let r=(s)=>s.replace(/(<[^>]*>)|([^<]+)/g,(n,i,a)=>i??" ".repeat(a.length)),o=e.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(s,n,i,a)=>n+r(i)+a).replace(/<!--[\s\S]*?-->/g,(s)=>" ".repeat(s.length));if(t){while(c.size>=A){let s=c.keys().next();if(s.done)break;c.delete(s.value)}c.set(e,o)}return o}
|
|
3
|
+
export{Jr,C,Bl,xt,ta,Fl,zl,Hl,wo,Ul,Vl,na,Wl,ql,Kl};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{d,m,$l,p,n,u}from"./chunk-xmg6bmh6.js";import{ut,Nt,kn,mi}from"./chunk-9rjgq8k4.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=mi(t,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,f)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,f)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function ge(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let f=t.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=ut(t,s+7);if(!o)break;let r=o.endPos,c=Nt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=li(t,e,g),t=ui(t,e,g),t=ci(t,e);let v=()=>{let a=kn(t);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?$l(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function ci(w,e){let g=w;function t(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function li(w,e,g){let t=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=ut(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Nt(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),t}function ui(w,e,g){let t=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
|
|
2
|
+
import{d,m,$l,p,n,u}from"./chunk-ac3e6nhg.js";import{ut,Nt,kn,mi}from"./chunk-n64zbwzr.js";function L(w,e){try{let g=w.trim();if(m(g))return p(g,Object.keys(e))(...Object.values(e));else return d(g,e)}catch{return!1}}function Q(w,e,g){let t=w,v=!0;while(v){v=!1;let a=t.match(/@switch\s*\(/);if(!a||a.index===void 0)break;let f=a.index,s=mi(t,f);if(!s)break;try{let o;if(m(s.expression))o=p(s.expression,Object.keys(e))(...Object.values(e));else o=d(s.expression,e);let r="",c=!1;for(let i of s.cases)if(i.type==="default"){if(!c)r=i.content.trim()}else try{let b;if(i.value&&m(i.value))b=p(i.value,Object.keys(e))(...Object.values(e));else if(i.value)b=d(i.value,e);if(o===b){r=i.content.trim(),c=!0;break}}catch{continue}t=t.substring(0,f)+r+t.substring(s.end),v=!0}catch(o){let r=o instanceof Error?o.message:String(o),c=u("Switch",`Error evaluating @switch expression: ${r}`,n.EVALUATION_ERROR);t=t.substring(0,f)+c+t.substring(s.end);break}}return t}function H(w){let e=[];return{masked:w.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(t)=>(e.push(t),`\x00stx-script-${e.length-1}\x00`)),scripts:e}}function J(w,e){if(e.length===0)return w;return w.replace(/\u0000stx-script-(\d+)\u0000/g,(g,t)=>e[Number(t)]??g)}function ge(w,e,g){let{masked:t,scripts:v}=H(w);return J(K(t,e,g),v)}function K(w,e,g){let t=w;t=Q(t,e,g);{let a=!0;while(a){a=!1;let f=t.match(/@unless\s*\(/);if(!f||f.index===void 0)break;let s=f.index,o=ut(t,s+7);if(!o)break;let r=o.endPos,c=Nt(t,"unless","endunless",r);if(c===-1){console.warn(`[stx] @unless directive at position ${s} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let i=t.slice(r,c),b=o.expression,y=-1;{let x=0,k=/@(?:if|unless)\s*\(/g,h=/@(?:endif|endunless)(?![a-z])/g,E=/@else(?![a-z])/g,S=[],C;while((C=k.exec(i))!==null)S.push({pos:C.index,type:"open"});while((C=h.exec(i))!==null)S.push({pos:C.index,type:"close"});while((C=E.exec(i))!==null)S.push({pos:C.index,type:"else"});S.sort((P,R)=>P.pos-R.pos);for(let P of S)if(P.type==="open")x++;else if(P.type==="close")x--;else if(P.type==="else"&&x===0){y=P.pos;break}}let l;if(y!==-1){let x=i.slice(0,y),k=i.slice(y+5);l=`@if (${b})${k}@else ${x}@endif`}else l=`@if (!(${b}))${i}@endif`;t=t.substring(0,s)+l+t.substring(c+10),a=!0}}t=li(t,e,g),t=ui(t,e,g),t=ci(t,e);let v=()=>{let a=kn(t);if(a.length===0)return!1;let f=Array(a.length);for(let r=a.length-1;r>=0;r--){let c=a[r];try{let i="",b=!1;for(let y of c.branches){if(b)break;if(y.type==="else")i=y.content,b=!0;else try{if(y.condition?$l(y.condition,e):!1)i=y.content,b=!0}catch(l){i=u(y.type==="if"?"If":"Elseif",`Error in @${y.type}(${y.condition}): ${l instanceof Error?l.message:String(l)}`,n.EVALUATION_ERROR),b=!0}}f[r]=i}catch(i){let b=i instanceof Error?i.message:String(i);f[r]=u("If",`Error processing @if block: ${b}`,n.EVALUATION_ERROR)}}let s=Array(a.length*2+1),o=0;for(let r=0;r<a.length;r++){let c=a[r];s[r*2]=t.slice(o,c.start),s[r*2+1]=f[r],o=c.end}return s[a.length*2]=t.slice(o),t=s.join(""),!0};while(!0){let a=t;if(!v())break;if(t===a)break}return t}function q(w){let e=0;while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!=="(")return null;e++;while(e<w.length&&/\s/.test(w[e]))e++;let g=w[e];if(g!=="'"&&g!=='"')return null;e++;let t=[];while(e<w.length){let v=w[e];if(v==="\\"&&e+1<w.length){t.push(w[e+1]),e+=2;continue}if(v===g){e++;break}t.push(v),e++}while(e<w.length&&/\s/.test(w[e]))e++;if(w[e]!==")")return null;return e++,{value:t.join(""),consumed:e}}function ci(w,e){let g=w;function t(s,o,r,c){let i=1,b=c,y=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),l=new RegExp(`@${r}(?![a-z])`,"g");while(b<s.length&&i>0){y.lastIndex=b,l.lastIndex=b;let x=y.exec(s),k=l.exec(s),h=x?x.index:1/0,E=k?k.index:1/0;if(h<E)i++,b=h+x[0].length;else if(E<1/0){if(i--,i===0)return E;b=E+k[0].length}else break}return-1}function v(s,o,r){let c=0,i=new RegExp(`@${o}(?:\\s*\\(|\\s|$)`,"g"),b=new RegExp(`@${r}(?![a-z])`,"g"),y=/@else(?![a-z])/g,l=[],x;while((x=i.exec(s))!==null)l.push({pos:x.index,type:"open"});while((x=b.exec(s))!==null)l.push({pos:x.index,type:"close"});while((x=y.exec(s))!==null)l.push({pos:x.index,type:"else"});l.sort((k,h)=>k.pos-h.pos);for(let k of l)if(k.type==="open")c++;else if(k.type==="close")c--;else if(k.type==="else"&&c===0)return k.pos;return-1}{let s=!0;while(s){s=!1;let o=g.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+5),y=q(b);if(y)c=y.value,i=r+5+y.consumed;else i=r+5;let l=t(g,"auth","endauth",i);if(l===-1){console.warn(`[stx] @auth directive at position ${r} has no matching @endauth \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"auth","endauth"),h;if(!e.auth)h=!1;else h=c?L(`auth?.check && auth?.user?.[${c}]`,e):L("auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+8),s=!0}}{let s=!0;while(s){s=!1;let o=g.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!o||o.index===void 0)break;let r=o.index,c,i,b=g.slice(r+6),y=q(b);if(y)c=y.value,i=r+6+y.consumed;else i=r+6;let l=t(g,"guest","endguest",i);if(l===-1){console.warn(`[stx] @guest directive at position ${r} has no matching @endguest \u2014 the block was skipped.`);break}let x=g.slice(i,l),k=v(x,"guest","endguest"),h;if(!e.auth)h=!0;else h=c?L(`!auth?.check || !auth?.user?.[${c}]`,e):L("!auth?.check",e);let E;if(k!==-1){let S=x.slice(0,k),C=x.slice(k+5);E=h?S:C}else E=h?x:"";g=g.substring(0,r)+E+g.substring(l+9),s=!0}}function a(s,o,r){if(e.userCan&&typeof e.userCan[s]==="boolean")return e.userCan[s];if(e.permissions?.check&&typeof e.permissions.check==="function")try{let c=[s];if(o)c.push(o);if(r){let i=L(r,e);c.push(i)}return e.permissions.check(...c)}catch{return!1}return!1}function f(s){let o=s.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!o)return null;return{ability:o[1],type:o[2],id:o[3]?.trim(),paramsEnd:o[0].length}}for(let s of["can","cannot"]){let o=`end${s}`,r=s==="can"?"elsecan":"elsecannot",c=!0;while(c){c=!1;let i=g.match(new RegExp(`@${s}\\s*\\(`));if(!i||i.index===void 0)break;let b=i.index,y=g.slice(b+`@${s}`.length),l=f(y);if(!l)break;let x=b+`@${s}`.length+l.paramsEnd,k=t(g,s,o,x);if(k===-1){console.warn(`[stx] @${s} directive at position ${b} has no matching @${o} \u2014 the block was skipped.`);break}let h=g.slice(x,k),E=[],S=0,C=new RegExp(`@${s}\\s*\\(`,"g"),P=new RegExp(`@${o}(?![a-z])`,"g"),R=new RegExp(`@${r}\\s*\\(`,"g"),T=/@else(?![a-z])/g,_=[],M;while((M=C.exec(h))!==null)_.push({pos:M.index,type:"open"});while((M=P.exec(h))!==null)_.push({pos:M.index,type:"close"});while((M=R.exec(h))!==null)_.push({pos:M.index,type:"elseDirective"});while((M=T.exec(h))!==null)_.push({pos:M.index,type:"else"});_.sort((A,z)=>A.pos-z.pos);for(let A of _){if(A.type==="open"){S++;continue}if(A.type==="close"){S--;continue}if(S===0)E.push(A)}let I=[],F=0;for(let A=0;A<E.length;A++){let z=E[A];if(I.push({content:h.slice(F,z.pos),ability:void 0}),z.type==="elseDirective"){let D=h.slice(z.pos+`@${r}`.length),B=f(D);if(B){I[I.length-1]={content:h.slice(F,z.pos)},F=z.pos+`@${r}`.length+B.paramsEnd,I.push({content:"",ability:B.ability,type:B.type,id:B.id}),I.pop();let G=E[A+1],U=G?G.pos:h.length;I.push({content:h.slice(F,U),ability:B.ability,type:B.type,id:B.id}),F=U}}else F=z.pos+5}if(F<h.length){let A=I[I.length-1];if(E.length>0&&E[E.length-1].type==="else")I.push({content:h.slice(F),isFinalElse:!0});else if(I.length===0)I.push({content:h.slice(F)})}let O=a(l.ability,l.type,l.id),j=s==="can"?O:!O,V="";if(j)V=I[0]?.content||"";else{let A=!1;for(let z=1;z<I.length;z++){let D=I[z];if(D.isFinalElse){V=D.content,A=!0;break}if(D.ability){let B=a(D.ability,D.type,D.id);if(s==="can"?B:!B){V=D.content,A=!0;break}}}if(!A&&I.length>0){let z=I[I.length-1];if(z.isFinalElse)V=z.content}}g=g.substring(0,b)+V+g.substring(k+`@${o}`.length),c=!0}}return g}function li(w,e,g){let t=w;function v(a,f,s,o,r){let c=!0;while(c){c=!1;let i=new RegExp(`@${f}\\s*\\(`),b=a.match(i);if(!b||b.index===void 0)break;let y=b.index,l=ut(a,y+`@${f}`.length);if(!l)break;let x=l.endPos,k=Nt(a,f,s,x);if(k===-1){console.warn(`[stx] @${f} directive at position ${y} has no matching @${s} \u2014 the block was skipped.`);break}let h=a.slice(x,k),E=l.expression,S=-1,C=0,P=0;while(P<h.length){let R=h.indexOf("@",P);if(R===-1)break;let T=h.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){C++,P=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){C--,P=R+1;continue}if(C===0&&/^@else(?![a-z])/.test(T)){S=R;break}P=R+1}try{let R=o(E.trim()),T;if(S!==-1){let _=h.slice(0,S),M=h.slice(S+5);T=R?_:M}else T=R?h:"";a=a.substring(0,y)+T+a.substring(k+`@${s}`.length),c=!0}catch(R){let T=R instanceof Error?R.message:String(R),_=u(r,`Error processing @${f} directive: ${T}`,n.EVALUATION_ERROR);a=a.substring(0,y)+_+a.substring(k+`@${s}`.length);break}}return a}return t=v(t,"isset","endisset",(a)=>{let f=L(a,e);return f!==void 0&&f!==null},"Isset"),t=v(t,"empty","endempty",(a)=>{let f=L(a,e);return f===void 0||f===null||f===""||f===0||f===!1||Array.isArray(f)&&f.length===0||typeof f==="object"&&f!==null&&Object.keys(f).length===0},"Empty"),t}function ui(w,e,g){let t=w,v="development";function a(f,s,o,r){let c=new RegExp(`@${s}(?![a-z])`,"g"),i=new RegExp(`@${o}(?![a-z])`,"g"),b=new RegExp(`^@${s}(?![a-z])`),y=new RegExp(`^@${o}(?![a-z])`),l=f,x=!0;while(x){x=!1,c.lastIndex=0;let k=c.exec(l);if(!k)break;let h=k.index,E=h+k[0].length;if(s==="env"){let O=l.substring(E).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!O)break;E+=O[0].length,r=v===O[2]}let S=1,C=E,P=-1;while(S>0&&C<l.length){c.lastIndex=C,i.lastIndex=C;let O=c.exec(l),j=i.exec(l),V=O?O.index:1/0,A=j?j.index:1/0;if(V<A)S++,C=V+O[0].length;else if(A<1/0){if(S--,S===0){P=A;break}C=A+j[0].length}else break}if(P===-1){console.warn(`[stx] @${s} directive at position ${h} has no matching @${o} \u2014 the block was skipped.`);break}let R=l.substring(E,P),T=-1,_=0,M=0;while(M<R.length){let O=R.indexOf("@",M);if(O===-1)break;let j=R.substring(O);if(b.test(j)){_++,M=O+1;continue}if(y.test(j)){_--,M=O+1;continue}if(_===0&&/^@else(?![a-z])/.test(j)){T=O;break}M=O+1}let I;if(T!==-1){let O=R.slice(0,T),j=R.slice(T+5);I=r?O:j}else I=r?R:"";let F=`@${o}`.length;l=l.substring(0,h)+I+l.substring(P+F),x=!0}return l}return t=a(t,"env","endenv",!1),t=a(t,"production","endproduction",v==="production"),t=a(t,"development","enddevelopment",v==="development"),t=a(t,"staging","endstaging",v==="staging"),t=a(t,"testing","endtesting",v==="testing"),t}
|
|
3
3
|
export{ge,ci,li,ui};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Rs,dg,ai,pg}from"./chunk-z6ndrx2p.js";import"./chunk-xvprhdcb.js";import"./chunk-yv797v6e.js";import"./chunk-gydvy8a3.js";import"./chunk-n64zbwzr.js";import"./chunk-e5md1cck.js";import"./chunk-b0jk94wx.js";import"./chunk-q0y8gv18.js";import"./chunk-rb2zbdqd.js";import"./chunk-qrk535j6.js";import"./chunk-gzc16hs8.js";import{Wt}from"./chunk-9w6k311w.js";import"./chunk-ypyezjr0.js";import"./chunk-41z7f41b.js";import"./chunk-ac3e6nhg.js";import"./chunk-vk2jy6mn.js";import"./chunk-3b3mkgpj.js";import"./chunk-0jdz31q1.js";import"./chunk-x9036mfd.js";export{pg as declareBareLoopHead,Wt as parseLoopBinding,dg as processLoops,ai as processLoopsAsync,Rs as reportDeferredLoopWarnings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ft}from"./chunk-
|
|
2
|
+
import{ft}from"./chunk-gzc16hs8.js";import{At,rr}from"./chunk-gcjqxvbb.js";import{ye,$n,Cl,El}from"./chunk-9w6k311w.js";import{Vr,Wr,qr,Gr,De}from"./chunk-ac3e6nhg.js";import{z}from"./chunk-41z7f41b.js";import{qi}from"./chunk-ypyezjr0.js";import{S}from"./chunk-dm069acv.js";import{i}from"./chunk-1vp0h7d6.js";import{q,a}from"./chunk-e5md1cck.js";import{Xc}from"./chunk-rb2zbdqd.js";import{Wn,qn,rt,Be,Na,Ma,Kn}from"./chunk-70paeznz.js";import{vn,Zo}from"./chunk-z92e297r.js";import{Gn}from"./chunk-nq60tjkz.js";import{fn,pr,fr}from"./chunk-1ph2yhfn.js";import{re}from"./chunk-gydvy8a3.js";import m from"fs";import c from"path";import{createHash as Y}from"crypto";function I(n){return Y("sha256").update(n).digest("hex").slice(0,8)}function W(n=!1){let l=n?rr():At(),o=I(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function J(){let n=ft(),l=I(n);return{content:n,filename:`router.${l}.js`,hash:l}}import U from"path";import{createHash as Q}from"crypto";function ee(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function V(n,l,o={}){let r=U.resolve(n),e=await Bun.file(r).text(),x=Q("sha256").update(e).digest("hex").slice(0,16);Cl();let _={};try{_=await a(o.configDir)}catch{}let y=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))y.push(g[2])}let u=new Set(y.flatMap((R)=>ye(R))),{context:D}=ee({__filename:r,__dirname:U.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...q,..._,...o,buildMode:"compile",strict:!1},f=await i(e,D,r,T,A),w=Wn(f)+qn(f)+rt(f),j=El();return{route:l,sourceFile:n,html:f,fragment:w,placeholders:j,hasServerScripts:y.length>0,serverScriptContent:y,dependencies:Array.from(A),contentHash:x,status:$n(e),streamTemplates:D.__streamTemplates}}var te=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function X(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(x,_){let y=m.readdirSync(x,{withFileTypes:!0});for(let d of y){if(te.has(d.name))continue;let g=c.join(x,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function Om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),x=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),y=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=De(e.app?.head,{known:Gr,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Gn(A),f=n.serverApi??e.serverApi,w=typeof f==="object"?f:{};if(f)vn(o,w);if(e.runtimeConfig)z(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=re(o,{pagesDirs:e._layerPageDirs}),Z=["components","layouts","partials"],P=R.filter((s)=>!Z.some((h)=>s.pattern.startsWith(`/${h}/`)||s.pattern===`/${h}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=W(n.debug),b=J();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",b.filename),b.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${b.filename} (${(b.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],O=[];for(let s of P){let h=T(s.pattern),M=h.rendering==="prerender";if(M&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await V(s.filePath,s.pattern,{configDir:o,componentsDir:x,partialsDir:_,layoutsDir:y,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,b.filename),t.html=qr(t.html,g,{bodyScripts:[`<script src="/__stx/${b.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Vr(t.html,u);if(g.htmlAttrs)t.html=Wr(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let G=p[1];t.html=t.html.replace(" "+G,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${G}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await S(t.html),M){let p=await Kn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Be(t.html,D,!0);let N=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),K=c.join("server","pages",`${N}.compiled.json`),L=c.join("server","fragments",`${N}.html`);await Bun.write(c.join(r,K),JSON.stringify(t,null,2)),await Bun.write(c.join(r,L),t.fragment),O.push({pattern:s.pattern,compiledPath:K,fragmentPath:L,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:M}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(h).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let H=c.resolve(o,d);if(m.existsSync(H)){let{copied:s,bytes:h}=X(H,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${d}/`)}let k=fr(o);if(k){let{copied:s,bytes:h}=X(k,c.join(r,"public",pr));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(h/1024).toFixed(1)}KB) from ${fn}/`)}let E={runtime:v.filename,router:b.filename},C=Na(O,E,r);if(C.routeRules=A,C.routerContainer=D,f)C.apiRoutes=await Zo(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await qi(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(Xc(e._layerGraph),null,2));Ma(C,r);let F=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${F}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:E,outputDir:r,duration:F}}
|
|
4
4
|
export{Om};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Mn,z}from"./chunk-41z7f41b.js";import m from"fs";import e from"path";async function Nn(r,o,i){if(r.__stx_runtime_config)return;let n=Mn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-
|
|
2
|
+
import{Mn,z}from"./chunk-41z7f41b.js";import m from"fs";import e from"path";async function Nn(r,o,i){if(r.__stx_runtime_config)return;let n=Mn();if(n||i){r.__stx_runtime_config=n??z(i);return}let t=e.dirname(e.resolve(o));while(!0){if(["stx.config.ts","stx.config.js",".config/stx.config.ts",".config/stx.config.js"].some((f)=>m.existsSync(e.join(t,f)))){let{loadStxConfig:f}=await import("./chunk-4ts8qztg.js"),c=await f(t);if(c.runtimeConfig)r.__stx_runtime_config=z(c.runtimeConfig);return}let s=e.dirname(t);if(s===t)return;t=s}}async function qi(r,o){function i(n){if(n===null)return"null";if(Array.isArray(n))return`Array<${n.length?[...new Set(n.map(i))].join(" | "):"unknown"}>`;if(typeof n==="object")return`{ ${Object.entries(n).map(([t,s])=>`readonly ${JSON.stringify(t)}: ${i(s)}`).join("; ")} }`;return typeof n}await Bun.write(e.join(r,".stx/runtime-config.d.ts"),`import '@stacksjs/stx/runtime-config'
|
|
3
3
|
declare module '@stacksjs/stx/runtime-config' { interface PublicRuntimeConfig ${i(o.public??{})} }
|
|
4
4
|
`),await Bun.write(e.join(r,".stx/runtime-config-server.d.ts"),`import '@stacksjs/stx/runtime-config-server'
|
|
5
5
|
declare module '@stacksjs/stx/runtime-config-server' { interface PrivateRuntimeConfig ${i(o.private??{})} }
|