@stacksjs/stx 0.2.751 → 0.2.753
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-txfh8fg1.js → chunk-1bk3t4s1.js} +3 -3
- package/dist/{chunk-cgb6729y.js → chunk-1mmtkbhf.js} +1 -1
- package/dist/{chunk-g7eye50p.js → chunk-1sb6z37d.js} +1 -1
- package/dist/{chunk-1j2tt4fw.js → chunk-37j288h1.js} +2 -2
- package/dist/{chunk-pnpabjzz.js → chunk-3h2e5jte.js} +4 -4
- package/dist/{chunk-c88nx6te.js → chunk-3t737sdr.js} +1 -1
- package/dist/{chunk-bc1zck9n.js → chunk-3tg9bsbc.js} +1 -1
- package/dist/{chunk-rc1cb58n.js → chunk-4jwp2per.js} +1 -1
- package/dist/{chunk-y52ktcjz.js → chunk-572rs7vb.js} +1 -1
- package/dist/{chunk-nzfbjmvb.js → chunk-5afjh2ms.js} +1 -1
- package/dist/{chunk-xzvbr2gs.js → chunk-5cyzd17z.js} +1 -1
- package/dist/{chunk-qan3tb8e.js → chunk-5q1mnc79.js} +1 -1
- package/dist/{chunk-2kevesvh.js → chunk-6z8rdsc6.js} +1 -1
- package/dist/chunk-7ygjbxm8.js +2 -0
- package/dist/{chunk-1ksc7rnp.js → chunk-80gbx1jn.js} +1 -1
- package/dist/{chunk-6pjmnvph.js → chunk-8q8202pj.js} +2 -2
- package/dist/{chunk-7ws6n88w.js → chunk-8qhw7me1.js} +1 -1
- package/dist/{chunk-0jdrw4rr.js → chunk-8x3axvek.js} +2 -2
- package/dist/{chunk-6hfrf0mb.js → chunk-8zr9xhf3.js} +1 -1
- package/dist/{chunk-xqkh97s7.js → chunk-9b5k0fvr.js} +1 -1
- package/dist/{chunk-tct6rn6f.js → chunk-9d9rn9qs.js} +6 -6
- package/dist/{chunk-1qmeh6ba.js → chunk-9mtc6m11.js} +1 -1
- package/dist/{chunk-nmqak9tg.js → chunk-af1e9spb.js} +1 -1
- package/dist/chunk-bn13c7ma.js +2 -0
- package/dist/{chunk-e7sykgst.js → chunk-bymeqhjp.js} +1 -1
- package/dist/chunk-cpexmwbs.js +2 -0
- package/dist/chunk-cr12w7hv.js +2 -0
- package/dist/{chunk-vawr540d.js → chunk-ecpr2jsc.js} +1 -1
- package/dist/chunk-engy7e5m.js +2 -0
- package/dist/chunk-enzptxpw.js +2 -0
- package/dist/{chunk-aeqm0vdq.js → chunk-fcp5mde5.js} +1 -1
- package/dist/{chunk-r24cv13z.js → chunk-fedcrvrm.js} +1 -1
- package/dist/chunk-fmsrzpb4.js +3 -0
- package/dist/chunk-gbve6fgb.js +2 -0
- package/dist/{chunk-0mehkbcx.js → chunk-gv6w1j3z.js} +1 -1
- package/dist/chunk-h3w9sx7w.js +2 -0
- package/dist/{chunk-04xvdwdv.js → chunk-hf0n98x2.js} +1 -1
- package/dist/{chunk-k0vqjagg.js → chunk-k4yjbkgb.js} +1 -1
- package/dist/{chunk-35s1vpsc.js → chunk-kf80wm87.js} +1 -1
- package/dist/{chunk-hec2qjj8.js → chunk-p5hbpmws.js} +1 -1
- package/dist/chunk-pe5643ce.js +2 -0
- package/dist/{chunk-ng9xkyvs.js → chunk-q82kcwn4.js} +1 -1
- package/dist/{chunk-dtgwjaxf.js → chunk-qeyjbnpn.js} +4 -4
- package/dist/{chunk-wd0xbhf6.js → chunk-qmy12s7k.js} +5 -5
- package/dist/{chunk-cn6k59h6.js → chunk-rra9xhgg.js} +2 -2
- package/dist/chunk-rx71g5z4.js +2 -0
- package/dist/{chunk-0k8ke4sy.js → chunk-s20j5yns.js} +1 -1
- package/dist/{chunk-kdzejksk.js → chunk-sva555j3.js} +1 -1
- package/dist/{chunk-xymxx2np.js → chunk-tcrxk0mv.js} +21 -21
- package/dist/{chunk-6xjkprv4.js → chunk-tg8z1h11.js} +1 -1
- package/dist/{chunk-0k13q4w5.js → chunk-th2ej2dz.js} +1 -1
- package/dist/{chunk-10bge0j5.js → chunk-tkp7npcj.js} +1 -1
- package/dist/{chunk-hzcgq05k.js → chunk-va57s6yw.js} +1 -1
- package/dist/{chunk-sw65q2dx.js → chunk-vch68zrs.js} +1 -1
- package/dist/{chunk-ymfa4w5g.js → chunk-vpzadc7t.js} +2 -2
- package/dist/{chunk-ztqwya0a.js → chunk-wad1w2d2.js} +1 -1
- package/dist/{chunk-wrzmt43b.js → chunk-we96m579.js} +1 -1
- package/dist/{chunk-cq032t09.js → chunk-wjtn0ywp.js} +1 -1
- package/dist/{chunk-ftjfw2bt.js → chunk-wzb2g38x.js} +1 -1
- package/dist/{chunk-9tp4vfv9.js → chunk-xe7wyaac.js} +1 -1
- package/dist/{chunk-t29h7kb3.js → chunk-y1h6z9cy.js} +1 -1
- package/dist/{chunk-wg0w5smr.js → chunk-y627cbst.js} +1 -1
- package/dist/{chunk-391ha6yg.js → chunk-zpqqdyb4.js} +5 -5
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/headwind-to-style.js +8 -0
- package/dist/native/compiler/html-to-ir.js +5 -1
- package/dist/native/compiler/inline-style.js +8 -0
- package/dist/native/compiler/ir.d.ts +1 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-40kmkhkb.js +0 -2
- package/dist/chunk-9293adsm.js +0 -2
- package/dist/chunk-99p5yrkr.js +0 -2
- package/dist/chunk-c0t3hys0.js +0 -2
- package/dist/chunk-e8fqsbs7.js +0 -2
- package/dist/chunk-qdmzr3a1.js +0 -2
- package/dist/chunk-sn86wfnm.js +0 -2
- package/dist/chunk-vb440rt0.js +0 -2
- package/dist/chunk-x24gng8y.js +0 -2
- package/dist/chunk-xh83mf56.js +0 -2
- package/dist/chunk-yx4p2mb7.js +0 -3
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-37j288h1.js";import{oo}from"./chunk-amwxbvdp.js";import p from"path";async function Wg(t={}){let l=performance.now(),s=t.root||process.cwd(),e=await a(s),o=t.ssr?.routeRules??e.routeRules??{};if(oo(o),!e.ssr&&Object.keys(o).length)throw Error("routeRules require ssr: true and the production server; flat SSG output cannot apply request/cache policies");if(!e.ssr&&(t.ssr?.serverApi??e.serverApi))throw Error("serverApi requires ssr: true; flat SSG output cannot execute API endpoints");let r=e.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${r.toUpperCase()}${e.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let u,n;if(r==="ssg"){let{generateStaticSite:i}=await import("./ssg.js");u=await i({pagesDir:p.join(e.root||".",e.pagesDir||e.build?.pagesDir||"pages"),publicDir:e.publicDir||e.build?.publicDir||"public",outputDir:e.build?.outputDir||"dist",generate404:e.build?.generate404??!0,minify:e.build?.minify??!0,cleanOutput:e.build?.cleanOutput??!0,router:e.router,...t.ssg})}else{let{buildForProduction:i}=await import("./chunk-7ygjbxm8.js");n=await i({root:s,outputDir:".output",debug:t.debug,...t.ssr})}let d=Math.round(performance.now()-l);return{mode:r,ssg:u,ssr:n,duration:d}}
|
|
3
3
|
export{Wg};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ve,Ds,eg,Ch,tg,Eh,Nt,p,V,Z,bn,xe,ng,li,rg,Th,k,sg,$h,E,Rh}from"./chunk-
|
|
2
|
+
import{ve,Ds,eg,Ch,tg,Eh,Nt,p,V,Z,bn,xe,ng,li,rg,Th,k,sg,$h,E,Rh}from"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{sg as applyFilters,Eh as clearCustomFilters,ng as clientLoopScopes,Ds as defaultFilters,bn as escapeAttributeValue,p as escapeHtml,V as escapeHtmlValue,Z as escapeInterpolatedHtmlValue,E as evaluateExpression,ve as findMustacheEnd,tg as getAllFilters,rg as interpolateScriptAttributes,li as interpolateScriptExpressions,Th as interpolateScriptsInTemplate,k as processExpressions,eg as registerFilter,Ch as registerFilters,Nt as replaceInterpolations,$h as resetRejectedExpressionWarnings,Rh as unescapeHtml,xe as usesSignalsInScript};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{el,tl}from"./chunk-kyk4ekng.js";import{H,_s,Cs,Es,Go,Xo,hr,Oe,pe,X,$s,ie,J,I,tt,br,Qo,xr,Be,r,p,V,bn}from"./chunk-tct6rn6f.js";import{f,R,nt,d}from"./chunk-5hrm7rtx.js";import{n}from"./chunk-yx4p2mb7.js";import{se}from"./chunk-tary163t.js";import{s}from"./chunk-dg1h0d9r.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var mt=!1;function me(e){if(!mt)mt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function bt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var xt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[xt]??={catalog:new Map,transparent:new Set},e[xt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...mn(i.absolutePath)?{options:{storage:t}}:{}}))}function mn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function yn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.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 i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Eo(e){let t=At(e);return t?ye().catalog.get(t):void 0}function To(e){let t=At(e);return t?ye().transparent.has(t):!1}function $o(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function ih(e){let t=Eo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:$o(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:To(e)?void 0:t.placeholder?.dataUrl}}function ns(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function ah(e,t,i={}){if(!e||!ee.existsSync(e))return ns(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ns(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return ns(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${bt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${bt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ns(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let v=await yn(y.entries),b=xn(y.entries,v),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Go(e,o);if(a!==void 0)return a;for(let c of Xo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function Fe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function We(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${bn(c,Fe(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${bn(c,Fe(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(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",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(hr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${be(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${be(e,l,void 0,o,a)} ${c}x`}).join(", ")}function be(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);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(t)c.set("w",String(t));if(i)c.set("h",String(i));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(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function In(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function _n(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=Eo(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),v=K(e,"densities"),b=K(e,"format"),C=To(o)||qe(o)?.transparent===!0,x=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",w=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=Ie(e,"lazy",!0),M=Ie(e,"preload",!1),L=Ie(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||Ie(e,"picture",!1)||!!b,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&w&&w!=="local"&&w!=="static")z=Ve(o,Xe,w,b),G=Ze(u);else if(!z&&v){let _=v.split(/\s+/).map((W)=>Number.parseFloat(W.replace("x","")));z=Pn(o,_,B,w,b)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let F=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&x==="color")j.push(`background-color:${_.color}`),F.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let W=_n(B||16,T||9,h);j.push(`background-image:url(${W})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")j.push(`background-image:url(${n(x)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=a?.fallback.url||be(o,B,T,w,b),Y=[];if(Y.push(`src="${n(hr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(hr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",W=In(F)+(_?`;${_}`:"");Y.push(`onload="${n(W)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let W=b==="webp"?"image/webp":b==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${W?` type="${W}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
|
|
2
|
+
import{el,tl}from"./chunk-kyk4ekng.js";import{H,_s,Cs,Es,Go,Xo,hr,Oe,pe,X,$s,ie,J,I,tt,br,Qo,xr,Be,r,p,V,bn}from"./chunk-9d9rn9qs.js";import{f,R,nt,d}from"./chunk-5hrm7rtx.js";import{n}from"./chunk-fmsrzpb4.js";import{se}from"./chunk-tary163t.js";import{s}from"./chunk-dg1h0d9r.js";import{g}from"./chunk-0dve54ne.js";import{createHash as Ct}from"crypto";import ee from"fs";import Q from"path";import{decode as sn,generateThumbHash as on}from"ts-images";import{createImageDeliveryCatalog as yt}from"ts-images/delivery";import De from"fs";function Ce(e,t,i){let o=Buffer.alloc(i),a=De.readSync(e,o,0,i,t);return o.subarray(0,a)}function je(e){if(e.length<25)return!1;let t=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(t(0,4)!=="RIFF"||t(8,12)!=="WEBP")return!1;let i=t(12,16);if(i==="VP8X")return(e[20]&16)!==0;if(i==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Me(e){let t;try{t=De.openSync(e,"r");let i=Ce(t,0,33);if(i.length>=3&&i[0]===255&&i[1]===216&&i[2]===255)return"none";if(i.length>=26&&i[0]===137&&i.toString("latin1",1,4)==="PNG"){let o=i[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ce(t,a,8);if(l.length<8)return"unknown";let m=l.toString("latin1",4,8);if(m==="tRNS")return"possible";if(m==="IDAT"||m==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(i.length>=25&&i.toString("latin1",0,4)==="RIFF"&&i.toString("latin1",8,12)==="WEBP"){if(je(i))return"possible";let o=i.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(t!==void 0)De.closeSync(t)}}import Jt from"fs";import Re from"os";import{join as dt}from"path";import{fileURLToPath as gt}from"url";import{Worker as pt}from"worker_threads";var ke=Symbol("stx.image-worker.unavailable");function Yt(e=typeof Re.availableParallelism==="function"?Re.availableParallelism():Re.cpus().length){return Math.max(1,Math.min(2,e-1))}var Ae=0,ht=[];async function Qt(){if(Ae<Yt()){Ae++;return}await new Promise((e)=>ht.push(e)),Ae++}function en(){Ae--,ht.shift()?.()}var tn="@stacksjs/stx/builtins/image-warmup-worker";function nn(e=process.cwd()){let t=import.meta.url.endsWith(".ts")?"ts":"js";try{let i=new URL(`./image-warmup-worker.${t}`,import.meta.url);if(i.protocol==="file:"&&Jt.existsSync(gt(i)))return gt(i)}catch{}try{let i=typeof Bun<"u"?Bun.resolveSync(tn,e):void 0;return i&&rn(i)?i:void 0}catch{return}}function rn(e,t=process.env){let i=e.replace(/\\/g,"/");if(i.split("/").some((a)=>/@\d[^/]*@@@\d+$/.test(a)))return!1;return![t.BUN_INSTALL_CACHE_DIR,dt(t.BUN_INSTALL||dt(Re.homedir(),".bun"),"install","cache")].filter((a)=>!!a).map((a)=>`${a.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((a)=>i.startsWith(a))}var mt=!1;function me(e){if(!mt)mt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return ke}function Le(e){return e instanceof Error?e.message:String(e)}async function ze(e,t){if(typeof pt!=="function")return me("node:worker_threads has no Worker in this runtime");let i=nn();if(!i)return me("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await Qt();try{return await new Promise((o,a)=>{let c;try{c=new pt(i)}catch(y){o(me(`could not start ${i}: ${Le(y)}`));return}let l=!1,m=!1,u=(y)=>{if(m)return;m=!0,y(),c.terminate()};c.on("message",(y)=>{if(y.type==="ready"){l=!0,c.postMessage({task:e,args:t});return}if(y.type==="result"){u(()=>o(y.value));return}let v=Error(y.error?.message??"image worker failed");if(y.error?.name)v.name=y.error.name;if(y.error?.stack)v.stack=y.error.stack;u(()=>a(v))}),c.on("error",(y)=>{u(()=>l?a(y instanceof Error?y:Error(Le(y)||"image worker crashed")):o(me(`the worker failed before it was ready: ${Le(y)}`)))}),c.on("exit",(y)=>{u(()=>l?a(Error("image worker exited before it finished")):o(me(`the worker exited with code ${y} before it was ready`)))})})}finally{en()}}var an=new Set([".avif",".jpeg",".jpg",".png",".webp"]),cn=[320,640,960,1280,1920],he="/_stx/images",ln=`stx:${he}:alpha-1`,un=`stx:${he}:opaque-1`,fn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Pe;function dn(e,t){let i=Q.dirname(Bun.resolveSync(e,t));while(i!==Q.dirname(i)){let o=Q.join(i,"package.json");if(ee.existsSync(o)){let a=JSON.parse(ee.readFileSync(o,"utf8"));if(a.name===e)return a.version}i=Q.dirname(i)}return}function bt(){if(Pe!==void 0)return Pe;let e;try{e=Q.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Pe=fn.map((t)=>{let i;try{i=e?dn(t,e):void 0}catch{}return`${t.replace("@stacksjs/","")}@${i??"unknown"}`}).join("+"),Pe}var xt=Symbol.for("stx.image-delivery");function ye(){let e=globalThis;return e[xt]??={catalog:new Map,transparent:new Set},e[xt]}var vt=new Set;function gn(e){return`/${e.split(Q.sep).map(encodeURIComponent).join("/")}`}function pn(e){let t=Q.extname(e),i=e.slice(0,-t.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=Ct("sha256").update(e).digest("hex").slice(0,8);return`${i||"image"}-${o}`}function wt(e,t=`stx:${he}`){let i=(o)=>`${he}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:t,async stat(o){let a=Q.join(e,o);try{let c=await ee.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:i(o)}:null}catch{return null}},async write(o,a){let c=Q.join(e,o);await ee.promises.mkdir(Q.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await ee.promises.writeFile(l,a),await ee.promises.rename(l,c),{bytes:a.byteLength,path:c,url:i(o)}},url:i}}async function Rt(e,t=e){let i=await ee.promises.readdir(t,{withFileTypes:!0});i.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of i){let c=Q.join(t,a.name);if(a.isDirectory()){o.push(...await Rt(e,c));continue}if(!a.isFile()||!an.has(Q.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:Q.relative(e,c)})}return o}function $t(e,t){return e.map((i)=>({key:gn(i.relativePath),input:i.absolutePath,name:pn(i.relativePath),...mn(i.absolutePath)?{options:{storage:t}}:{}}))}function mn(e){return Me(e)==="possible"}function hn(e){for(let t=3;t<e.length;t+=4)if(e[t]!==255)return!0;return!1}async function yn(e){let t=Object.entries(e).filter(([,a])=>a.fallback.format==="png"),i=new Set,o=8;for(let a=0;a<t.length;a+=8)await Promise.all(t.slice(a,a+8).map(async([c,l])=>{let m=l.variants.filter((u)=>u.format==="png").sort((u,y)=>u.width-y.width)[0];try{let u=await sn(new Uint8Array(await ee.promises.readFile(m?.path??l.fallback.path)));if(hn(u.data))i.add(c)}catch{i.add(c)}}));return i}function xn(e,t){let i=[];for(let o of t){let a=e[o],c=a?.variants.filter((m)=>m.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((m)=>{let u;try{return u=ee.openSync(m.path,"r"),!je(Ce(u,0,32))}catch{return!0}finally{if(u!==void 0)ee.closeSync(u)}}))continue;if(a.variants=a.variants.filter((m)=>m.format!=="webp"),delete a.sources.webp,i.push(o),!vt.has(o))vt.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 i}async function vn(e){let t=[],i=8;for(let o=0;o<e.length;o+=8){let a=e.slice(o,o+8),c=await Promise.all(a.map(async(l)=>{try{return await on(l.absolutePath),l}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${l.relativePath}`),null}}));t.push(...c.filter((l)=>l!==null))}return t}function Ue(e){return Q.join(e,"undecodable.json")}function wn(e){try{let t=ee.readFileSync(Ue(e),"utf-8"),i=JSON.parse(t);return i&&typeof i==="object"?i:{}}catch{return{}}}function $n(e,t){try{ee.mkdirSync(Q.dirname(Ue(e)),{recursive:!0}),ee.writeFileSync(Ue(e),JSON.stringify(t))}catch{}}function St(e){try{let t=ee.statSync(e);return{mtimeMs:t.mtimeMs,size:t.size}}catch{return}}function At(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let t=e.split(/[?#]/,1)[0];if(!t)return;try{return`/${t.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function Eo(e){let t=At(e);return t?ye().catalog.get(t):void 0}function To(e){let t=At(e);return t?ye().transparent.has(t):!1}function $o(e){let t=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),i=t(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:t(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<i).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function ih(e){let t=Eo(e);if(!t)return;return{src:t.fallback.url,srcset:t.sources[t.fallback.format]||"",sources:$o(t).map(({format:i,srcset:o})=>({type:`image/${i}`,srcset:o})),width:t.source.width,height:t.source.height,placeholder:To(e)?void 0:t.placeholder?.dataUrl}}function ns(){let e=ye();e.catalog=new Map,e.transparent=new Set}function Sn(e){let t=ye();t.catalog=new Map(e.entries),t.transparent=new Set(e.transparent)}async function ah(e,t,i={}){if(!e||!ee.existsSync(e))return ns(),{count:0,fingerprint:""};if(i.offThread){let h=await ze("delivery",{publicDir:e,outputDir:t});if(h!==ke)return Sn(h.state),h.result}let o=await Rt(e);if(o.length===0)return ns(),{count:0,fingerprint:""};let a=wn(t),c=o.filter((h)=>{let w=a[h.relativePath];if(!w)return!0;let S=St(h.absolutePath);return!S||S.mtimeMs!==w.mtimeMs||S.size!==w.size});if(c.length===0)return ns(),{count:0,fingerprint:""};let l=wt(Q.join(t,"_stx","images"),`${ln}:${bt()}`),m={outDir:Q.join(t,"_stx","images"),storage:wt(Q.join(t,"_stx","images"),`${un}:${bt()}`),baseUrl:he,widths:cn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},u=c,y;try{y=await yt({...m,entries:$t(c,l)})}catch(h){if(u=await vn(c),u.length===c.length)throw h;let w=new Set(u.map((A)=>A.relativePath)),S=!1;for(let A of c){if(w.has(A.relativePath))continue;let P=St(A.absolutePath);if(!P)continue;a[A.relativePath]=P,S=!0}if(S)$n(t,a);if(u.length===0)return ns(),{count:0,fingerprint:""};y=await yt({...m,entries:$t(u,l)})}let v=await yn(y.entries),b=xn(y.entries,v),C=ye();C.catalog=new Map(Object.entries(y.entries)),C.transparent=v;let x=v.size===0&&b.length===0?y.fingerprint:Ct("sha256").update(y.fingerprint).update(JSON.stringify({transparent:[...v].sort(),droppedWebp:b.sort()})).digest("hex");return{count:u.length,fingerprint:x}}class kt{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let t of e.aliases)this.builtins.set(t.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,t,i,o){let a=Go(e,o);if(a!==void 0)return a;for(let c of Xo(e,t,i,o))if(await r(c))return c;return null}}var le=new kt;var re="\x00stx-boolean-attribute";function Fe(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var Cn=new Set(["accesskey","autocapitalize","autofocus","class","contenteditable","dir","draggable","enterkeyhint","exportparts","hidden","id","inert","inputmode","is","itemid","itemprop","itemref","itemscope","itemtype","lang","nonce","part","role","slot","spellcheck","style","tabindex","title","translate","accept","action","alt","autocomplete","capture","cite","cols","colspan","content","controls","datetime","default","download","enctype","for","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","href","hreflang","kind","label","loading","loop","max","maxlength","media","method","min","minlength","multiple","muted","name","open","pattern","placeholder","playsinline","poster","preload","readonly","referrerpolicy","rel","required","reversed","rows","rowspan","scope","selected","shape","size","span","src","srcdoc","srclang","srcset","start","step","target","type","usemap","value","width","wrap"]);function We(e){let t=e.toLowerCase();return t.startsWith("aria-")||t.startsWith("data-")||Cn.has(t)}function oe(e,t){let i=[];for(let[o,a]of Object.entries(e.static)){if(t.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)i.push(p(c));continue}if(a===re){i.push(p(c));continue}i.push(`${p(c)}="${bn(c,Fe(String(a)))}"`)}return i}function ae(e,t){let i=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(t.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){i.push(p(c));continue}if(typeof a==="object")continue;i.push(`${p(c)}="${bn(c,Fe(String(a)))}"`)}return i}function Rn(e){if(e.clientReactive.to)return{value:e.clientReactive.to,reactive:!0};if(e.serverDynamic.to!==void 0)return{value:String(e.serverDynamic.to),reactive:!1};if(typeof e.static.to==="string")return{value:e.static.to,reactive:!1};return{value:"#",reactive:!1}}var He={name:"StxLink",aliases:["stx-link"],render(e,t,i){let o=Rn(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",m=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,u=[];if(o.reactive)u.push(`:href="${n(o.value)}"`);else u.push(`href="${n(hr(o.value,"navigable"))}"`);if(a)u.push(`class="${n(a)}"`);if(u.push("data-stx-link"),u.push(`data-stx-active-class="${n(c)}"`),u.push(`data-stx-exact-active-class="${n(l)}"`),m)u.push("data-stx-prefetch");let y=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(y)u.push(`data-stx-active-match="${n(y)}"`);let v=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return u.push(...oe(e,v)),u.push(...ae(e,v)),`<a ${u.join(" ")}>${t}</a>`}};var An=new Map;function qe(e){if(!e)return;let t=e.split("?")[0].split("#")[0];return An.get(t)}var kn={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Xe=[320,640,768,1024,1280,1536,1920];function K(e,t){if(e.serverDynamic[t]!==void 0)return String(e.serverDynamic[t]);let i=e.static[t];if(typeof i==="string")return i;return}function Ie(e,t,i=!1){let o=e.serverDynamic[t];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[t];if(a!==void 0)return a!=="false"&&a!==!1;return i}function Ze(e){if(e.includes("(")||e.includes(","))return e;let t=e.trim().split(/\s+/),i=[];for(let o of t)if(o.includes(":")){let[a,c]=o.split(":"),l=kn[a];if(l)i.push(`(max-width: ${l}px) ${c}`);else{let m=Number.parseInt(a);if(!Number.isNaN(m))i.push(`(max-width: ${m}px) ${c}`)}}else i.push(o);return i.join(", ")}function Ve(e,t,i,o){return t.map((a)=>`${be(e,a,void 0,i,o)} ${a}w`).join(", ")}function Pn(e,t,i,o,a){return t.map((c)=>{let l=i?i*c:void 0;return`${be(e,l,void 0,o,a)} ${c}x`}).join(", ")}function be(e,t,i,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(t)c.push(`w_${t}`);if(i)c.push(`h_${i}`);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(t)c.set("w",String(t));if(i)c.set("h",String(i));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(t)c.set("width",String(t));if(i)c.set("height",String(i));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function In(e){return`var s=this.style;${e.map((t)=>`s.${t}=''`).join(";")}`}function _n(e,t,i="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${t}"><rect width="100%" height="100%" fill="${i}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var Ge={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,t,i){let o=K(e,"src")||"",a=Eo(o),c=K(e,"alt")||"",l=K(e,"width")||(a?String(a.source.width):void 0),m=K(e,"height")||(a?String(a.source.height):void 0),u=K(e,"sizes"),y=K(e,"srcset"),v=K(e,"densities"),b=K(e,"format"),C=To(o)||qe(o)?.transparent===!0,x=K(e,"placeholder")||(a&&!C?"thumbhash":void 0),h=K(e,"placeholderColor")||"#e5e7eb",w=K(e,"provider"),S=K(e,"class")||K(e,"className")||"",A=K(e,"style")||"",P=K(e,"objectFit")||K(e,"fit"),k=K(e,"objectPosition")||K(e,"position"),N=K(e,"quality"),U=Ie(e,"lazy",!0),M=Ie(e,"preload",!1),L=Ie(e,"priority",!1),q=K(e,"loading"),O=K(e,"decoding")||"async",E=!!a||Ie(e,"picture",!1)||!!b,B=l?Number.parseInt(l):void 0,T=m?Number.parseInt(m):void 0,z=y||"",G="";if(a)z=a.sources[a.fallback.format]||"",G=u?Ze(u):"100vw";else if(!z&&u&&w&&w!=="local"&&w!=="static")z=Ve(o,Xe,w,b),G=Ze(u);else if(!z&&v){let _=v.split(/\s+/).map((W)=>Number.parseFloat(W.replace("x","")));z=Pn(o,_,B,w,b)}else if(u)G=Ze(u);let j=[];if(A)j.push(A);if(P)j.push(`object-fit:${P}`);if(k)j.push(`object-position:${k}`);if(B&&T)j.push(`aspect-ratio:${B}/${T}`);let F=[],ce=x==="blur"||x==="color"||x==="thumbhash";if(ce&&!C){let _=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:h}:qe(o);if(_&&x==="color")j.push(`background-color:${_.color}`),F.push("backgroundColor");else if(_)j.push(`background-color:${_.color}`),j.push(`background-image:url(${_.dataUrl})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundColor","backgroundImage");else{let W=_n(B||16,T||9,h);j.push(`background-image:url(${W})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage")}}else if(!ce&&x&&x!=="empty"&&x!=="none")j.push(`background-image:url(${n(x)})`),j.push("background-size:cover"),j.push("background-repeat:no-repeat"),F.push("backgroundImage");let we=a?.fallback.url||be(o,B,T,w,b),Y=[];if(Y.push(`src="${n(hr(we,"fetched"))}"`),Y.push(`alt="${n(c)}"`),l)Y.push(`width="${n(l)}"`);if(m)Y.push(`height="${n(m)}"`);let ne=q||(L||M?"eager":U?"lazy":"");if(ne)Y.push(`loading="${n(ne)}"`);if(L)Y.push('fetchpriority="high"');if(Y.push(`decoding="${n(O)}"`),S)Y.push(`class="${n(S)}"`);if(j.length>0)Y.push(`style="${n(j.join(";"))}"`);if(z)Y.push(`srcset="${n(hr(z,"fetched"))}"`);if(G)Y.push(`sizes="${n(G)}"`);let $e=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(F.length>0){let _=typeof e.static.onload==="string"?e.static.onload:"",W=In(F)+(_?`;${_}`:"");Y.push(`onload="${n(W)}"`),$e.add("onload")}Y.push(...oe(e,$e)),Y.push(...ae(e,$e));let D=`<img ${Y.join(" ")} />`,Z="";if(M){let W=b==="webp"?"image/webp":b==="avif"?"image/avif":"";Z=`<link rel="preload" as="image" href="${n(we)}"${W?` type="${W}"`:""}${z?` imagesrcset="${n(z)}"`:""}${G?` imagesizes="${n(G)}"`:""} />
|
|
3
3
|
`}if(E){let _=[];if(a)for(let W of $o(a))_.push(`<source type="image/${W.format}" srcset="${n(W.srcset)}"${G?` sizes="${n(G)}"`:""} />`);if(!a&&(b==="avif"||b==="auto")){let W=be(o,B,T,w,"avif"),te=z?Ve(o,Xe,w,"avif"):`${W}`;_.push(`<source type="image/avif" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}if(!a&&(b==="webp"||b==="auto")){let W=be(o,B,T,w,"webp"),te=z?Ve(o,Xe,w,"webp"):`${W}`;_.push(`<source type="image/webp" srcset="${n(te)}"${G?` sizes="${n(G)}"`:""} />`)}return`${Z}<picture>
|
|
4
4
|
${_.join(`
|
|
5
5
|
`)}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{eh,qa,th,Ka,mf,hf,on,nr,nh,yf,bf,rh,y}from"./chunk-
|
|
2
|
+
import{eh,qa,th,Ka,mf,hf,on,nr,nh,yf,bf,rh,y}from"./chunk-8x3axvek.js";import"./chunk-we96m579.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{on as buildCss,yf as extractClassNames,hf as fingerprintConfig,bf as generateCss,nh as getCachedCSS,eh as getCssServeAsset,y as injectCss,qa as loadCssEngine,Ka as loadCssEngineConfig,nr as rebuildCss,th as resetCssCache,mf as resolveUserCssConfig,rh as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Zn,$e}from"./chunk-19safa6y.js";import{z,w,mr,Ts,C}from"./chunk-tct6rn6f.js";import{a,P}from"./chunk-1j2tt4fw.js";import{So}from"./chunk-cq032t09.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-myr79xxf.js";import{s,ge}from"./chunk-dg1h0d9r.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||So(t,e,n)}var at=2;function af(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function cf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=cf();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}D("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function lf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(lf())console.log("[stx:bundler]",...t)}var Y=[];function Va(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Zt(){return Y.slice()}function Qt(){Y.length=0}var Z;function Zm(t){Z=t}function Ua(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function en(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return D("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return D("detected side-effect import:",u),!0}return!1}var Yn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function uf(t,e){return d.relative(t,e).split(d.sep).join("/")}function df(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Yn)?`${i}${u}${c}${u}`:n})}function pf(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let R=y.trim();if(!R)continue;let B=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let R=y.slice(Yn.length),B=i(R),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Yn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function bo(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function tn(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,R){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Yn}${uf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let A=B(r.importer,x,r.path);if(A)return A;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Yn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=R?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,k=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function ff(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function nn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||af(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(R,`${p}.js`),o=k.get(r);if(o){if(Ts(o.files)&&o.files.every((M)=>!X(M.path,i,u))){D("memo hit:",p);let M=o.files.map((O)=>O.path);return q(e,M),n.collectInputs?.push(...M),o.code}k.delete(r),D("memo invalidated by dep change:",p)}let b=d.join(R,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let M=Bun.file(b),O=!1,I=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===at&&Array.isArray(F.files)&&bt(F.files,i))I=mr(F.files.map((g)=>ct(g,i))),O=I.length===F.files.length&&!I.some((g)=>X(g.path,i,u))}catch{O=!1}if(O){if(D("cache hit:",p),I)q(e,I.map((T)=>T.path)),n.collectInputs?.push(...I.map((T)=>T.path));let F=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),I)k.set(r,{code:F,files:I});return F}D("cache invalidated by dep change:",p)}let A=H.get(p);if(A){let M=await A;if(n.collectInputs)n.collectInputs.push(...(k.get(r)?.files??[]).map((O)=>O.path));return M}let V=ff(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:R,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function gf(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:R,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=gf(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,A=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:O,balanced:I}=ge(M),F=(_)=>!I||O[_]===0,g;while((g=A.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((_)=>{let f=Et(_);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;x.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!F(g.index))continue;let _=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(_&&Q.some((f)=>f.test(_)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let L=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(L)x.add(L)}}for(let _ of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of _[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
|
|
2
|
+
import{Zn,$e}from"./chunk-19safa6y.js";import{z,w,mr,Ts,C}from"./chunk-9d9rn9qs.js";import{a,P}from"./chunk-37j288h1.js";import{So}from"./chunk-wjtn0ywp.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-myr79xxf.js";import{s,ge}from"./chunk-dg1h0d9r.js";import d from"path";import v from"fs";import{AsyncLocalStorage as ht}from"async_hooks";var xt=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(d.basename(t))||So(t,e,n)}var at=2;function af(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?d.resolve(e):l(t,"bundle-cache")}function st(t,e){let n=t;for(let i of $t(e))if(i!==d.sep)n=n.split(i).join("\x00root");return n}var rt=new Map;function $t(t){let e=d.resolve(t),n=rt.get(e);if(!n){let i=e;try{i=v.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((u,m)=>m.length-u.length),rt.set(e,n)}return n}function yt(t,e){try{let n=v.statSync(t),i=d.resolve(e),u=t.startsWith(`${i}${d.sep}`);return{path:u?d.relative(i,t):t,...u?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(v.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?d.join(d.resolve(e),t.path):t.path}function bt(t,e){for(let n of t){let i=ct(n,e);try{let u=v.statSync(i);if(u.size!==n.size)return!1;if(u.mtimeMs!==n.mtimeMs&&Bun.hash(v.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,wt=100;function cf(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var G=new Map;async function St(t){let e=G.get(t)??0;if(e>0&&e<wt){G.set(t,e+1);return}G.set(t,1);try{let n=(await v.promises.readdir(t)).filter((c)=>c.endsWith(".js")),i=cf();if(n.length<=i)return;let m=(await Promise.all(n.map(async(c)=>{try{return{name:c,at:(await v.promises.stat(d.join(t,c))).mtimeMs}}catch{return null}}))).filter((c)=>c!==null);m.sort((c,y)=>y.at-c.at);for(let c of m.slice(i)){let y=c.name.slice(0,-3);await v.promises.rm(d.join(t,`${y}.js`),{force:!0}),await v.promises.rm(d.join(t,`${y}.deps.json`),{force:!0})}D("pruned bundle cache to",i,"entries")}catch{}}function Te(t){return lt.get(t)??[]}function q(t,e){if(t)lt.set(t,e)}function lf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function D(...t){if(lf())console.log("[stx:bundler]",...t)}var Y=[];function Va(t,e,n){Y.push({filePath:t||"<inline>",message:e,details:n})}function Zt(){return Y.slice()}function Qt(){Y.length=0}var Z;function Zm(t){Z=t}function Ua(){if(Z)return Z;try{let t=P.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Q=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function en(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let u=n[1];if(!Q.some((c)=>c.test(u)))return D("detected user import:",u),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let u=n[1];if(/\.css(?:\?.*)?$/.test(u))continue;if(!Q.some((c)=>c.test(u)))return D("detected side-effect import:",u),!0}return!1}var Yn="stx-module:",vt=/\.(?:[cm]?[jt]sx?|json)$/i;function uf(t,e){return d.relative(t,e).split(d.sep).join("/")}function df(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,u,m)=>{let c=e.get(m);return c&&!m.startsWith(Yn)?`${i}${u}${c}${u}`:n})}function pf(t,e){let n=0,i=(m)=>{let c=`__stxMod${n++}`,y=JSON.stringify(m);return e.push(`var ${c} = globalThis.__stxModules && globalThis.__stxModules[${y}];`,`if (${c} === undefined) throw new Error("[stx] module " + ${JSON.stringify(y)} + " is not registered on this page (#1957)");`),c},u=(m,c)=>{for(let y of m.split(",")){let R=y.trim();if(!R)continue;let B=R.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!B)continue;let j=B[1].startsWith('"')?JSON.parse(B[1]):B[1],p=B[2]??j;e.push(`var ${p} = ${c}[${JSON.stringify(j)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c,y)=>{let R=y.slice(Yn.length),B=i(R),j=c.trim(),p=j.match(/^([\w$]+)\s*(?:,\s*|$)/);if(p&&!j.startsWith("{")&&!j.startsWith("*"))e.push(`var ${p[1]} = ${B}.default;`),j=j.slice(p[0].length).trim();let r=j.match(/^\*\s*as\s+([\w$]+)$/);if(r)e.push(`var ${r[1]} = ${B};`);else if(j.startsWith("{"))u(j.replace(/^\{|\}$/g,""),B);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(m,c)=>(i(c.slice(Yn.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,d.join(t,"index.ts"),d.join(t,"index.tsx"),d.join(t,"index.js"),d.join(t,"index.mjs")];for(let n of e)try{if(v.existsSync(n)&&v.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var K=new ht;function bo(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,u]of[...t].sort(([m],[c])=>m<c?-1:m>c?1:0))n.update(`${i}\x00${u}\x00`);return K.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function tn(){return K.getStore()?.key??""}function Bt(t,e,n,i,u,m,c=new Map,y,R){let B=(p,r,o)=>{if(X(r,t,y))return null;if(!m||p!==n||!vt.test(r))return null;try{if(!v.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}u.add(r);let b=`${Yn}${uf(process.cwd(),r)}`;return c.set(o,b),{path:b,external:!0}},j=(p,r)=>{let o=p===n?e:d.dirname(p),b=d.resolve(o,r);return it(b)??b};return{name:"stx-client-bundle",setup(p){if(p.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),p.onResolve({filter:/^\//},(r)=>{if(r.path===n)return{path:n};let o=it(r.path);if(o){let b=B(r.importer,o,r.path);if(b)return b;if(o!==n)u.add(o);return{path:o}}return{path:r.path,external:!0}}),p.onResolve({filter:/^\.\.?\//},(r)=>{let o=j(r.importer,r.path),b=B(r.importer,o,r.path);if(b)return b;return u.add(o),{path:o}}),p.onResolve({filter:/^[@~]\//},(r)=>{let o=d.resolve(t,r.path.slice(2)),b=[o,`${o}.ts`,`${o}.tsx`,`${o}.js`,`${o}.mjs`,`${o}.jsx`,d.join(o,"index.ts"),d.join(o,"index.tsx"),d.join(o,"index.js"),d.join(o,"index.mjs")];for(let x of b)if(v.existsSync(x)&&v.statSync(x,{throwIfNoEntry:!1})?.isFile()){let A=B(r.importer,x,r.path);if(A)return A;return D(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",x),u.add(x),{path:x}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:o}}),m)p.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(r.importer!==n)return;let o=`${Yn}npm:${r.path}`;return c.set(r.path,o),{path:o,external:!0}});p.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(r.path===n)return{contents:i,loader:"ts"};if(X(r.path,t,y))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let o=d.extname(r.path).toLowerCase(),b=o===".json"?"json":o===".tsx"?"tsx":o===".jsx"?"jsx":o===".ts"||o===".mts"||o===".cts"?"ts":"js";if(r.path!==n)u.add(r.path);let x=R?.get(r.path);if(x!==void 0)return{contents:x,loader:"js"};return{contents:v.readFileSync(r.path,"utf8"),loader:b}})}}}var H=new Map,k=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function ff(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function nn(t,e,n={}){let i=n.projectRoot||process.cwd(),u=(await a(i)).serverApi,m=n.minify??!1,c=n.externalizeUserModules??!0,y=n.expose?.length?[...new Set(n.expose)].sort():void 0,R=n.cacheDir||af(i),B=K.getStore(),j=new Bun.CryptoHasher("md5");j.update(`${xt}\x00${et()}\x00${JSON.stringify(u??!1)}\x00${c?"registry":"inline"}\x00${y?y.join(","):"*"}\x00${m?"minified":"readable"}\x00${B?.key??""}\x00${st(t,i)}\x00${st(e,i)}`);let p=j.digest("hex").slice(0,12),r=d.join(R,`${p}.js`),o=k.get(r);if(o){if(Ts(o.files)&&o.files.every((M)=>!X(M.path,i,u))){D("memo hit:",p);let M=o.files.map((O)=>O.path);return q(e,M),n.collectInputs?.push(...M),o.code}k.delete(r),D("memo invalidated by dep change:",p)}let b=d.join(R,`${p}.deps.json`),x=Bun.file(r);if(await x.exists()){let M=Bun.file(b),O=!1,I=null;if(await M.exists())try{let F=JSON.parse(await M.text());if(F.metadataVersion===at&&Array.isArray(F.files)&&bt(F.files,i))I=mr(F.files.map((g)=>ct(g,i))),O=I.length===F.files.length&&!I.some((g)=>X(g.path,i,u))}catch{O=!1}if(O){if(D("cache hit:",p),I)q(e,I.map((T)=>T.path)),n.collectInputs?.push(...I.map((T)=>T.path));let F=await x.text(),g=new Date;if(v.promises.utimes(r,g,g).catch(()=>{}),I)k.set(r,{code:F,files:I});return F}D("cache invalidated by dep change:",p)}let A=H.get(p);if(A){let M=await A;if(n.collectInputs)n.collectInputs.push(...(k.get(r)?.files??[]).map((O)=>O.path));return M}let V=ff(()=>_t(t,e,{projectRoot:i,minify:m,cacheDir:R,hash:p,cachePath:r,depsPath:b,collectInputs:n.collectInputs,externalizeUserModules:c,serverApi:u,expose:y,throwOnFailure:n.throwOnFailure,substitutes:B?.modules}));H.set(p,V);try{return await V}finally{H.delete(p)}}var jt=0;function gf(t){return`${t}-${process.pid}-${++jt}`}async function _t(t,e,n){let{projectRoot:i,minify:u,cacheDir:m,hash:c,cachePath:y,depsPath:R,externalizeUserModules:B}=n,j=l(i,"bundle-tmp"),p=gf(c),r=d.join(i,`.stx-client-${p}.ts`),o=d.join(j,"out",p);v.mkdirSync(o,{recursive:!0});let b=d.dirname(e),x=new Set,A=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,V=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,M=s(t),{depths:O,balanced:I}=ge(M),F=(_)=>!I||O[_]===0,g;while((g=A.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;if(g[2])g[2].split(",").forEach((_)=>{let f=Et(_);if(f)x.add(f)});else if(g[3])x.add(g[3])}while((g=V.exec(M))!==null){if(g[1])continue;if(!F(g.index))continue;x.add(g[2])}let T=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=T.exec(M))!==null){if(!F(g.index))continue;let _=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(_&&Q.some((f)=>f.test(_)))continue;if(g[1])x.add(g[1]);if(g[2])x.add(g[2]);for(let f of(g[3]??"").split(",")){let S=f.trim();if(!S||/^type\s/.test(S))continue;let L=/\bas\s+(\w+)\s*$/.exec(S)?.[1]??/^\w+$/.exec(S)?.[0];if(L)x.add(L)}}for(let _ of M.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let f of _[1].split(",")){let S=/\bas\s+(\w+)\s*$/.exec(f)?.[1]??/^\s*(\w+)\s*$/.exec(f)?.[1];if(S)x.delete(S)}let ut=x.size>0?`
|
|
3
3
|
export { ${[...x].join(", ")} }`:"";D("bundling:",c,"from:",d.basename(e));let tt=new Set,nt=new Map;try{let _=await Bun.build({entrypoints:[r],outdir:o,target:"browser",format:"esm",minify:u?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[Bt(i,b,r,t+ut,tt,B,nt,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":u?'"production"':'"development"',...C()},root:i});if(!_.success){let E=_.logs.filter((N)=>N.level==="error").map((N)=>N.message).join(", ")||`Unable to bundle ${d.basename(e)}`,U=Zn(_.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",E),Va(e||"",E,U),n.throwOnFailure||Ua()==="error")throw Error(E);return t}let f="";for(let h of _.outputs){f=await h.text();break}let S=[];for(let h of f.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let E of h[1].split(",")){let U=E.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(U){S.push([U[2],U[1]]);continue}let N=E.trim();if(/^[A-Za-z_$][\w$]*$/.test(N))S.push([N,N])}if(n.expose){let h=new Set(n.expose);for(let E=S.length-1;E>=0;E--)if(!h.has(S[E][0]))S.splice(E,1)}let L=[];f=pf(df(f,nt),L);let dt=f.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(f=f.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),u&&f)try{f=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(f)}catch{}let J=`__stxBundle_${c}`,pt=new Set(z(t,!0).split(",").map((h)=>h.trim())),ft=S.map(([h,E])=>`get ${JSON.stringify(h)}() { return ${E} }${pt.has(h)?`, set ${JSON.stringify(h)}(__stxValue_${E}) { ${E} = __stxValue_${E} }`:""}`).join(", "),mt=S.map(([h])=>`var ${h} = undefined;`).join(`
|
|
4
4
|
`),gt=S.map(([h])=>`${h} = ${J}[${JSON.stringify(h)}];`).join(`
|
|
5
5
|
`);if(f=`${dt.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{de,Ec,Ps,gn,m,De,Me}from"./chunk-
|
|
2
|
+
import{de,Ec,Ps,gn,m,De,Me}from"./chunk-9d9rn9qs.js";import{lr,Ye,j}from"./chunk-37j288h1.js";import{Qn,i}from"./chunk-zpqqdyb4.js";import{be}from"./chunk-qeyjbnpn.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=lr(s),a=await(e.renderer??((n)=>Ye(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=De(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Me(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await Qn(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
17
|
+
${x}`}t=await be(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-va57s6yw.js");t=await o(t)}catch{}return t}
|
|
18
18
|
export{ja};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vn,ui}from"./chunk-
|
|
2
|
+
import{vn,ui}from"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";export{ui as generateRuntimeConfigTypes,vn as prepareRuntimeConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yc,r,fe}from"./chunk-
|
|
2
|
+
import{yc,r,fe}from"./chunk-9d9rn9qs.js";import{et}from"./chunk-j2mpqa4p.js";import{l}from"./chunk-myr79xxf.js";import o from"fs";import u from"path";var kf=new Map,m=new Map;async function lh(e){let n;for(let i=0;i<3;i++)try{let g=(await o.promises.stat(e)).mtime.getTime(),a=m.get(e);if(a&&a.mtime===g)return a.content;let h=await Bun.file(e).text(),w=(await o.promises.stat(e)).mtime.getTime();if(w!==g)continue;return m.set(e,{content:h,mtime:w}),h}catch(s){n=s;break}throw m.delete(e),Error(`File not found: ${e}${n?` (${n.message})`:""}`)}function uh(e){m.delete(e)}function dh(e){for(let t of m.keys())if(t.startsWith(e))m.delete(t)}var f=null,B=null,x=null;function ph(e){x=e}async function _f(e=!1){let t=x??await import("./chunk-59512t1y.js");if(e)return t.generateSignalsRuntimeDev();if(f===null)f=t.generateSignalsRuntime();return f}var S=null;async function Cf(){if(S===null){let{getRouterScript:e}=await import("./chunk-cs5gf4zp.js");S=e()}return S}var y={};async function fh(e,t=!1){let n=e==="runtime"?await _f(t):await Cf(),i=e==="runtime"&&t?"runtime-debug":e,s=y[i];if(!s||s.content!==n)s={content:n,hash:Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)},y[i]=s;return{content:n,hash:s.hash,url:`/_stx/${e}.${s.hash}.js`}}var E=500,T=33554432,c=new Map,p=0;function C(e){return l(process.cwd(),"module-bundles",`${e}.js`)}function gh(e){let t=Bun.hash(e).toString(16).padStart(16,"0").slice(0,16),n=c.get(t),i=n!==void 0;if(i)c.delete(t),p-=n.length*2;c.set(t,e),p+=e.length*2;while(c.size>1&&(c.size>E||p>T)){let s=c.keys().next().value;p-=c.get(s).length*2,c.delete(s)}if(!i)try{let s=C(t);if(!o.existsSync(s))o.mkdirSync(u.dirname(s),{recursive:!0}),o.writeFileSync(s,e)}catch{}return`/_stx/modules.${t}.js`}function Lo(e){if(!/^[0-9a-f]{16}$/.test(e))return;let t=c.get(e);if(t!==void 0)return t;try{return o.readFileSync(C(e),"utf8")}catch{return}}function mh(){m.clear(),fe(),yc(),f=null,B=null,S=null}function v(e){let t={debug:e.debug===!0,middleware:(e.middleware??[]).map((n)=>({name:n.name,timing:n.timing,handler:String(n.handler)})),customDirectives:(e.customDirectives??[]).map((n)=>({name:n.name,hasEndTag:n.hasEndTag===!0,rawParams:n.rawParams===!0,handler:String(n.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(t)).digest("hex")}async function ar(e,t){try{if(!t.cachePath)return null;let n=u.resolve(t.cachePath),i=u.join(n,`${us(e)}.html`),s=u.join(n,`${us(e)}.meta.json`);if(!await r(i)||!await r(s))return null;let g=await Bun.file(s).text(),a=JSON.parse(g);if(a.cacheVersion!==t.cacheVersion)return null;if(a.engine!==et())return null;if(a.optionsSignature!==v(t))return null;if((await o.promises.stat(e)).mtime.getTime()>a.mtime)return null;for(let d of a.dependencies)if(await r(d)){if((await o.promises.stat(d)).mtime.getTime()>a.mtime)return null}else return null;return await Bun.file(i).text()}catch(n){return console.warn(`Cache error for ${e}:`,n),null}}async function cr(e,t,n,i){try{if(!i.cachePath)return;let s=u.resolve(i.cachePath);await o.promises.mkdir(s,{recursive:!0});let g=u.join(s,`${us(e)}.html`),a=u.join(s,`${us(e)}.meta.json`),h=await o.promises.stat(e);await Bun.write(g,t);let d={sourcePath:e,mtime:h.mtime.getTime(),dependencies:Array.from(n),cacheVersion:i.cacheVersion,engine:et(),optionsSignature:v(i),generatedAt:Date.now()};await Bun.write(a,JSON.stringify(d,null,2)),kf.set(e,{output:t,mtime:h.mtime.getTime(),dependencies:n})}catch(s){console.warn(`Failed to cache template ${e}:`,s)}}var _=16;function us(e){return new Bun.CryptoHasher("sha1").update(e).digest("hex").substring(0,_)}
|
|
3
3
|
export{kf,lh,uh,dh,ph,_f,Cf,fh,gh,Lo,mh,ar,cr,us};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import{ue}from"./chunk-mdsrnd6s.js";import{Fe,O}from"./chunk-r6s35xw9.js";import{cc}from"./chunk-snfmgp7a.js";import{l}from"./chunk-myr79xxf.js";import v from"fs";import m from"path";import{pathToFileURL as I}from"url";var P=["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"],R=new Set;function rn(s,c={}){let o=m.resolve(s,c.dir??"server/api"),i=[],f=new Map;if(!v.existsSync(o))return i;let t=Array.from(new Bun.Glob("**/*.{ts,js,mts,mjs}").scanSync({cwd:o})).sort();for(let e of t){if(e.endsWith(".d.ts"))continue;let p=e.replace(/\.(?:ts|js|mts|mjs)$/,"").split("/"),n=p.pop(),u=n.lastIndexOf("."),d=u>=0?n.slice(u+1):"get",g=d.toUpperCase();if(!P.includes(g)||d!==d.toLowerCase())throw Error(`Unsupported API method suffix in ${e}; use ${P.map((A)=>A.toLowerCase()).join(", ")}`);if(u>=0)n=n.slice(0,u);if(n!=="index")p.push(n);let r=new Set,h=p.map((A,j)=>{let y=/^\[(\.\.\.)?([A-Za-z_]\w*)\]$/.exec(A);if(y){if(r.has(y[2])||y[1]&&j!==p.length-1)throw Error(`Invalid API parameter in ${e}`);return r.add(y[2]),`:${y[2]}${y[1]?"*":""}`}if(!/^[\w-]+$/.test(A))throw Error(`Unsupported API path segment ${A} in ${e}`);return A}),w=`/api${h.length?`/${h.join("/")}`:""}`,S=`${g} ${w.replace(/:\w+/g,":param")}`;if(f.has(S))throw Error(`Ambiguous API route ${g} ${w}: ${f.get(S)} and ${e}`);f.set(S,e);let x=m.join(o,e);R.add(m.resolve(x)),R.add(v.realpathSync(x)),i.push({pattern:w,method:g,filePath:x})}return i.sort((e,a)=>{let p=e.pattern.split("/"),n=a.pattern.split("/"),u=(d)=>d?.endsWith("*")?0:d?.startsWith(":")?1:2;for(let d=0;d<Math.max(p.length,n.length);d++){let g=u(n[d])-u(p[d]);if(g)return g}return e.pattern.localeCompare(a.pattern)||e.method.localeCompare(a.method)})}async function vo(s,c){let o=l(s,"api-types.d.ts"),i=["// Generated by stx. Include this file in tsconfig.json.","declare module '@stacksjs/stx/api-client' {"," interface KnownApiRoutes {"];for(let t of c){let e=`./${m.relative(m.dirname(o),t.filePath).replace(/\\/g,"/")}`,{params:a}=ue(t.pattern);i.push(` ${JSON.stringify(`${t.method} ${t.pattern}`)}: { params: { ${a.map((p)=>`${JSON.stringify(p)}: string`).join("; ")} }; response: Awaited<ReturnType<typeof import(${JSON.stringify(e)}).default>> }`)}i.push(" }","}","export {}","");let f=i.join(`
|
|
3
3
|
`);if(!await Bun.file(o).exists()||await Bun.file(o).text()!==f)await Bun.write(o,f);return o}async function wo(s,c,o={}){let i=rn(s,o);await vo(s,i);let f=[];for(let t of i){let e=await Bun.build({entrypoints:[t.filePath],target:"bun",format:"esm",minify:!1,splitting:!1});if(!e.success)throw Error(`API build failed for ${t.filePath}: ${e.logs.join(`
|
|
4
|
-
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function xo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Qm(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=rn(s,o);return await vo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=rn(s,o);await vo(s,t);let{loadStxConfig:e}=await import("./chunk-
|
|
4
|
+
`)}`);let a=e.outputs.find((u)=>u.kind==="entry-point");if(!a)throw Error(`No API bundle for ${t.filePath}`);if(e.outputs.length!==1)throw Error(`API endpoint ${t.filePath} emits assets; package those explicitly instead`);let n=`server/api/endpoint-${new Bun.CryptoHasher("sha256").update(await a.arrayBuffer()).digest("hex").slice(0,20)}.mjs`;await Bun.write(m.join(c,n),a),f.push({...t,filePath:n})}return f}function E(s,c){let o=s.map((i)=>({route:i,...ue(i.pattern)}));return async(i)=>{let f=new URL(i.url).pathname,t=o.filter((r)=>r.regex.test(f));if(!t.length)return null;let e=t[0].route.pattern,a=(r)=>r.replace(/:\w+/g,":param"),p=t.filter((r)=>a(r.route.pattern)===a(e)),n=i.method,u=p.find((r)=>r.route.method===n)??(n==="HEAD"?p.find((r)=>r.route.method==="GET"):void 0);if(!u){let r=new Set(p.map((h)=>h.route.method));if(r.has("GET"))r.add("HEAD");return r.add("OPTIONS"),new Response(null,{status:n==="OPTIONS"?204:405,headers:{Allow:Array.from(r).sort().join(", ")}})}let d=u.regex.exec(f),g=Object.create(null);try{u.params.forEach((r,h)=>{g[r]=decodeURIComponent(d[h+1])})}catch{return new Response("Invalid URL parameter encoding",{status:400})}try{let r=await c(u.route);if(typeof r!=="function")throw Error(`API endpoint ${u.route.filePath} must default-export a handler`);let h=await r(i,{params:g}),w=h instanceof Response?h:h===void 0?new Response(null,{status:204}):Response.json(h);if(n==="HEAD")return new Response(null,{status:w.status,headers:w.headers});return w}catch(r){return console.error(`[stx] API error for ${n} ${e}:`,r),Response.json({error:"Internal Server Error"},{status:500})}}}function xo(s,c){return E(c,async(o)=>(await import(I(m.resolve(s,o.filePath)).href)).default)}async function Qm(s,c){if(!c)return async()=>null;let o=c===!0?{}:c,i=rn(s,o);return await vo(s,i),async(f)=>{if(!new URL(f.url).pathname.match(/^\/api(?:\/|$)/))return null;try{let t=rn(s,o);await vo(s,t);let{loadStxConfig:e}=await import("./chunk-af1e9spb.js"),a=O((await e(s)).runtimeConfig);return await Fe(a,()=>E(t,async(p)=>{let n=await Bun.build({entrypoints:[p.filePath],target:"bun",format:"esm",splitting:!1});if(!n.success)throw Error(n.logs.join(`
|
|
5
5
|
`));let u=n.outputs.find((d)=>d.kind==="entry-point");if(!u||n.outputs.length!==1)throw Error(`Unsupported API bundle output: ${p.filePath}`);return(await import(`data:text/javascript;base64,${Buffer.from(await u.text()).toString("base64")}`)).default})(f))}catch(t){return console.error("[stx] API discovery failed:",t),Response.json({error:"API discovery failed; check the server log"},{status:500})}}}function So(s,c,o){if(cc(s))return!0;let i=/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/;if(i.test(m.basename(s)))return!0;try{if(i.test(m.basename(v.realpathSync(s))))return!0}catch{}if(R.has(m.resolve(s)))return!0;if(!o)return!1;let f=m.resolve(c,typeof o==="object"?o.dir??"server/api":"server/api"),t=(a)=>{try{return v.realpathSync(a)}catch{return m.resolve(a)}},e=t(s);return[f,m.resolve(c,"server"),m.resolve(c,".output/server")].some((a)=>{let p=t(a);return e===p||e.startsWith(`${p}${m.sep}`)})}
|
|
6
6
|
export{rn,vo,wo,xo,Qm,So};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rn,vo,wo,xo,Qm,So}from"./chunk-
|
|
2
|
+
import{rn,vo,wo,xo,Qm,So}from"./chunk-wjtn0ywp.js";import"./chunk-snfmgp7a.js";import"./chunk-mdsrnd6s.js";import"./chunk-r6s35xw9.js";export{wo as buildServerApi,Qm as createServerApi,rn as discoverServerApi,vo as generateApiTypes,So as isServerApiSource,xo as productionApiDispatcher};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{af,cf,Te,lf,Va,Zt,Qt,Zm,Ua,en,Yn,uf,df,pf,bo,tn,ff,nn,gf}from"./chunk-
|
|
2
|
+
import{af,cf,Te,lf,Va,Zt,Qt,Zm,Ua,en,Yn,uf,df,pf,bo,tn,ff,nn,gf}from"./chunk-vch68zrs.js";import"./chunk-wjtn0ywp.js";import"./chunk-19safa6y.js";import"./chunk-37j288h1.js";import"./chunk-y1h6z9cy.js";import"./chunk-qeh8f4bk.js";import"./chunk-snfmgp7a.js";import"./chunk-c0v9ng82.js";import"./chunk-mdsrnd6s.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Yn as MODULE_SPECIFIER_PREFIX,af as bundleCacheDir,cf as bundleCacheEntryLimit,nn as bundleClientScript,Qt as clearBundleFailures,Te as clientBundleDependencies,Zt as getBundleFailures,en as hasUserImports,tn as moduleSubstitutionKey,df as normalizeRegistrySpecifiers,ff as queueClientBundleBuild,Va as recordBundleFailure,uf as registryIdForPath,Ua as resolveBundlerFallback,pf as rewriteRegistryImports,Zm as setBundlerFallbackMode,lf as shouldLogBundlerDiagnostics,gf as tempBuildName,bo as withModuleSubstitutes};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R,t,c}from"./chunk-5hrm7rtx.js";import{Z}from"./chunk-
|
|
2
|
+
import{R,t,c}from"./chunk-5hrm7rtx.js";import{Z}from"./chunk-9d9rn9qs.js";import{Bo}from"./chunk-qeh8f4bk.js";import C from"path";var S;async function W(){if(S!==void 0)return S;try{let e=await import("@stacksjs/ts-i18n");S=e.loadLocale??null}catch{S=null}return S}var P={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},v={},L={},k={};function J(e,s=0){if(s<=0)return!1;return Date.now()-e.loadedAt>s}async function G(e,s){if({...P,...s.i18n}.cache&&v[e]){let r=v[e],o=s.i18n?.cacheMaxAge??0;if(!J(r,o))return r.translations}if(L[e]?.state==="loading")return L[e].promise;k[e]="loading";let n=T(e,s).then((r)=>(k[e]="loaded",delete L[e],r)).catch((r)=>{throw k[e]="error",L[e]={promise:n,state:"error",error:r instanceof Error?r:Error(String(r))},r});return L[e]={promise:n,state:"loading"},n}async function T(e,s){let i={...P,...s.i18n},n=C.isAbsolute(i.translationsDir)?i.translationsDir:C.resolve(s.root||process.cwd(),i.translationsDir);try{let r=await W(),o=r?await r(e,{translationsDir:n,defaultLocale:i.defaultLocale,sources:te(i.format)}):await Y(e,i,n);if(o===void 0){let u=e!==i.defaultLocale?await T(i.defaultLocale,s):{};if(i.cache)v[e]={translations:u,loadedAt:Date.now(),locale:e};return u}let l=o;if(i.cache)v[e]={translations:l,loadedAt:Date.now(),locale:e};return l}catch(r){if(s.debug)console.error(`Error loading translation file for locale "${e}":`,r);if(e!==i.defaultLocale)return T(i.defaultLocale,s);return{}}}async function Y(e,s,i){let n=C.join(i,`${e}${Q(s.format)}`);try{let r=await import(n);return r.default||r}catch(r){try{let o=await Bun.file(n).text();if(s.format==="yaml"||s.format==="yml")return X(o);if(s.format==="json")return JSON.parse(o);throw r}catch{return}}}function Q(e){switch(e){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function X(e){let s={},i=e.split(`
|
|
3
3
|
`),n=[{obj:s,indent:-1}];for(let r of i){let o=r.replace(/#.*$/,"").trimEnd();if(!o.trim())continue;let l=o.search(/\S/);if(l===-1)continue;while(n.length>1&&n[n.length-1].indent>=l)n.pop();let u=n[n.length-1].obj,a=o.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(a){let[,,g,p]=a,f=g.trim(),m=p.trim();if(m==="")u[f]={},n.push({obj:u[f],indent:l});else u[f]=ee(m)}}return s}function ee(e){if(e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"'))return e.slice(1,-1);let s=e.toLowerCase();if(s==="true"||s==="yes")return!0;if(s==="false"||s==="no")return!1;if(s==="null"||s==="~")return null;let i=Number(e);if(!Number.isNaN(i)&&e!=="")return i;return e}function te(e){switch(e){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function re(e,s){return G(e,s)}function ne(e,s){for(let i of e){let n=i.trim(),r=n.match(/^\{(\d+)\}\s*(.*)$/);if(r){let l=Number.parseInt(r[1],10);if(s===l)return r[2];continue}let o=n.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(o){let l=Number.parseInt(o[1],10),u=o[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(o[2],10);if(s>=l&&s<=u)return o[3];continue}}if(e.length===2)return s===1?e[0].trim():e[1].trim();if(s<e.length)return e[s].trim();return e[e.length-1].trim()}function ie(e,s={}){return j(e,s)}function j(e,s){let i="",n=0;while(n<e.length)if(e[n]==="{"){let r=se(e,n);if(r===-1){i+=e[n],n++;continue}let o=e.slice(n+1,r);i+=ae(o,s),n=r+1}else if(e[n]==="'"&&n+1<e.length)if(e[n+1]==="'")i+="'",n+=2;else if(e[n+1]==="{"||e[n+1]==="}")i+=e[n+1],n+=2;else i+=e[n],n++;else i+=e[n],n++;return i}function se(e,s){let i=0;for(let n=s;n<e.length;n++)if(e[n]==="{")i++;else if(e[n]==="}"){if(i--,i===0)return n}return-1}function ae(e,s){let i=oe(e);if(i.length===0)return`{${e}}`;let n=i[0].trim(),r=s[n];if(i.length===1)return r!==void 0?String(r):`{${n}}`;switch(i[1].trim().toLowerCase()){case"plural":return le(r,i.slice(2).join(","),s);case"select":return ue(r,i.slice(2).join(","));case"selectordinal":return de(r,i.slice(2).join(","));case"number":return pe(r,i[2]?.trim());case"date":return fe(r,i[2]?.trim());case"time":return me(r,i[2]?.trim());default:return r!==void 0?String(r):`{${e}}`}}function oe(e){let s=[],i="",n=0;for(let r=0;r<e.length;r++){let o=e[r];if(o==="{")n++,i+=o;else if(o==="}")n--,i+=o;else if(o===","&&n===0)s.push(i),i="";else i+=o}if(i)s.push(i);return s}function le(e,s,i){let n=Number(e)||0,r=I(s),o=`=${n}`;if(r[o])return E(r[o],n,i);let l=ce(n);if(r[l])return E(r[l],n,i);if(r.other)return E(r.other,n,i);return String(n)}function E(e,s,i){let n=e.replace(/#/g,String(s));return j(n,i)}function ce(e){let s=Math.abs(e),i=Math.floor(s),n=String(e).includes(".")?String(e).split(".")[1].length:0;if(i===1&&n===0)return"one";return"other"}function ue(e,s){let i=String(e||""),n=I(s);if(n[i])return n[i];return n.other||String(e)}function de(e,s){let i=Number(e)||0,n=I(s),r=ge(i);if(n[r])return n[r].replace(/#/g,String(i));if(n.other)return n.other.replace(/#/g,String(i));return String(i)}function ge(e){let s=Math.abs(e),i=s%10,n=s%100;if(i===1&&n!==11)return"one";if(i===2&&n!==12)return"two";if(i===3&&n!==13)return"few";return"other"}function I(e){let s={},i=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,n=i.exec(e);while(n!==null)s[n[1]]=n[2],n=i.exec(e);return s}function pe(e,s){let i=Number(e);if(Number.isNaN(i))return String(e);switch(s){case"integer":return Math.floor(i).toLocaleString();case"percent":return`${(i*100).toFixed(0)}%`;case"currency":return i.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return i.toLocaleString()}}function fe(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.dateStyle="short";break;case"medium":n.dateStyle="medium";break;case"long":n.dateStyle="long";break;case"full":n.dateStyle="full";break;default:n.dateStyle="medium"}return i.toLocaleDateString(void 0,n)}function me(e,s){let i=e instanceof Date?e:new Date(String(e));if(Number.isNaN(i.getTime()))return String(e);let n={};switch(s){case"short":n.timeStyle="short";break;case"medium":n.timeStyle="medium";break;case"long":n.timeStyle="long";break;case"full":n.timeStyle="full";break;default:n.timeStyle="short"}return i.toLocaleTimeString(void 0,n)}function be(e){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(e)}function O(e,s,i=!0,n={}){let r=e.split("."),o=s;for(let u of r){if(o===void 0||o===null)break;o=o[u]}if(o===void 0||o===null)return i?e:"";let l=String(o);if(be(l))return ie(l,n);if(l.includes("|")&&"count"in n){let u=Number(n.count),a=l.split("|");l=ne(a,u)}for(let[u,a]of Object.entries(n)){let g=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");l=l.replace(new RegExp(`:${g}`,"g"),()=>String(a))}return l}var D=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),he=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function q(e){if(!e)return"ltr";let s=e.trim().toLowerCase().replace(/_/g,"-").split("-"),i=s[0];if(!i)return"ltr";let n=s[1]?.length===4?s[1]:void 0;if(n)return he.has(n)?"rtl":"ltr";if(s.length>1&&D.has(`${i}-${s[1]}`))return"rtl";return D.has(i)?"rtl":"ltr"}async function rc(e,s,i,n){let r=e,o=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,l={...P,...n.i18n},u=await re(l.locale,n);s.__translations=u,s.__locale=l.locale,s.__i18nConfig=l,r=await F(r,o,async(p,f,m,w,h)=>{try{let b={};if(m)try{let d=[()=>JSON.parse(m),()=>{let x=`{"data":${m}}`,A=JSON.parse(x);return typeof A.data==="object"?A.data:{}},()=>R(m,s)];for(let x of d)try{if(b=x(),Object.keys(b).length>0)break}catch{}}catch(d){if(n.debug)console.error("Error parsing parameters for @translate directive:",d)}let y=O(f,u,l.fallbackToKey,b);return y?Z(r,h,y,!1,p.length):w.trim()}catch(b){if(n.debug)console.error("Error processing @translate directive:",b);return c("Translate",`Error in @translate('${f}'): ${b instanceof Error?b.message:String(b)}`,t.EVALUATION_ERROR)}});let a=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(n.debug){console.warn(`Processing translations in template. Sections: ${r.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let p=[...r.matchAll(a)];console.warn(`Found ${p.length} @translate matches`),p.forEach((f,m)=>console.warn(`Match ${m}: ${f[0]}, Key: ${f[1]}, Params: ${f[2]||"none"}`))}return r=await F(r,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(p,f,m,w)=>{try{let h={};if(m)try{let b=[()=>JSON.parse(m),()=>{let y=`{"data":${m}}`,d=JSON.parse(y);return typeof d.data==="object"?d.data:{}},()=>R(m,s)];for(let y of b)try{if(h=y(),Object.keys(h).length>0)break}catch{}}catch(b){if(n.debug)console.error("Error parsing parameters for @translate directive:",b)}return Z(r,w,O(f,u,l.fallbackToKey,h),!1,p.length)}catch(h){if(n.debug)console.error("Error processing @translate directive:",h);return c("Translate",`Error in @translate('${f}'): ${h instanceof Error?h.message:String(h)}`,t.EVALUATION_ERROR)}}),r}async function F(e,s,i){let n=[];return e.replace(s,(o,...l)=>{let u=i(o,...l).then((a)=>({match:o,replacement:a}));return n.push(u),o}),(await Promise.all(n)).reduce((o,{match:l,replacement:u})=>o.replace(l,()=>u),e)}function _(e,s){if(!e||q(e)!=="rtl")return!1;return!s||s.trim().toLowerCase()!=="rtl"}function V(e){if(!e)return!1;return e.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||e.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function U(e,s){let i=new RegExp(`\\b${s}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(e);if(!i)return null;return i[2]??i[3]??i[4]??null}function sc(e,s,i,n){let r=e;r=r.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,u,a)=>{let p={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[u]||"Make this element accessible";return`<!-- a11y-hint: ${a||p} -->`});let o=/@screenReader\(([^@]*)\)@endScreenReader/g;return r=r.replace(o,(l,u)=>`<span class="sr-only">${u.trim()}</span>`),r=r.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(l,u,a)=>`<span id="${`desc-${u}`}" class="sr-only">${a}</span>`),r}function ye(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function xe(e){let s=new Map,i=e.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(r,o,l)=>{let u=s.get(l);if(!u)u=`stx-a11y-component-${s.size}`,s.set(l,u);return`<${o}${u}`}),n=new Map([...s.entries()].map(([r,o])=>[o,r]));return{protectedSource:i,restore:(r)=>r.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(o,l,u)=>{let a=n.get(u);return a?`<${l}${a}`:o})}}function we(e,s){let i=[],n=/<img\s+([^>]*)>/gi,r;r=n.exec(e);while(r!==null){let d=r[1];if(!/\balt\s*=/i.test(d))i.push({type:"missing-alt",element:r[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});r=n.exec(e)}let o=/<button([^>]*)>\s*<\/button>/gi;r=o.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"missing-accessible-name",element:r[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});r=o.exec(e)}let l=/<a\s+([^>]*)>\s*<\/a>/gi;r=l.exec(e);while(r!==null){let d=r[1];if(!/\baria-label\s*=/i.test(d)&&!/\btitle\s*=/i.test(d))i.push({type:"link-missing-text",element:r[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});r=l.exec(e)}let u=/<(input|select|textarea)\s+([^>]*)>/gi;r=u.exec(e);while(r!==null){let d=r[2];if(/\btype\s*=\s*["']hidden["']/i.test(d)){r=u.exec(e);continue}let x=/\baria-label\s*=/i.test(d)||/\baria-labelledby\s*=/i.test(d),A=d.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!x){let B=A&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${A[1]}["']`,"i").test(e),M=r.index,N=e.substring(0,M),Se=e.substring(M),H=(N.match(/<label\b/gi)||[]).length,z=(N.match(/<\/label>/gi)||[]).length,K=H>z;if(!B&&!K)i.push({type:"input-missing-label",element:r[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}r=u.exec(e)}let a=/<h([1-6])[^>]*>/gi,g=[];r=a.exec(e);while(r!==null)g.push(Number.parseInt(r[1],10)),r=a.exec(e);let p=0;for(let d of g){if(p>0&&d>p+1)i.push({type:"heading-skip",element:`<h${d}>`,message:`Heading level skipped from h${p} to h${d}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});p=d}if(/<html\b/i.test(e)&&!/<html[^>]*\slang\s*=/i.test(e))i.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let f=e.match(/<html\b([^>]*)>/i);if(f&&_(U(f[1],"lang"),U(f[1],"dir")))i.push({type:"missing-dir",element:f[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let m=/<table([^>]*)>([\s\S]*?)<\/table>/gi;r=m.exec(e);while(r!==null){let d=r[2];if(!V(U(r[1],"role"))&&!/<th\b/i.test(d))i.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});r=m.exec(e)}let w=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;r=w.exec(e);while(r!==null){if(!/\bmuted\b/i.test(r[0]))i.push({type:"autoplay-audio",element:`<${r[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});r=w.exec(e)}let h=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;r=h.exec(e);while(r!==null)i.push({type:"positive-tabindex",element:`tabindex="${r[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),r=h.exec(e);let b=/<iframe\s+([^>]*)>/gi;r=b.exec(e);while(r!==null){let d=r[1];if(!/\btitle\s*=/i.test(d)&&!/\baria-label\s*=/i.test(d))i.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});r=b.exec(e)}let y=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;r=y.exec(e);while(r!==null){let d=r[1].toLowerCase(),x=r[2];if(d!=="button"&&!/\btabindex\s*=/i.test(x))i.push({type:"button-not-focusable",element:r[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});r=y.exec(e)}return i}async function Ae(e,s){let{protectedSource:i}=xe(e);if(!ye())return we(i,s);let n=[];try{let r=globalThis.document.createElement("div");r.innerHTML=i,r.querySelectorAll("img").forEach((a)=>{if(!a.hasAttribute("alt"))n.push({type:"missing-alt",element:`<${a.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),r.querySelectorAll('button, a, [role="button"]').forEach((a)=>{if(!(a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||a.textContent&&a.textContent.trim().length>0))n.push({type:"missing-accessible-name",element:`<${a.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),r.querySelectorAll("input, select, textarea").forEach((a)=>{let g=a.getAttribute("id"),p=g&&r.querySelector(`label[for="${g}"]`),f=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),m=a.closest("label")!==null;if(!p&&!f&&!m)n.push({type:"input-missing-label",element:`<${a.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let o=Array.from(r.querySelectorAll("h1, h2, h3, h4, h5, h6")),l=0;for(let a of o){let g=Number.parseInt(a.tagName.charAt(1));if(l>0&&g>l+1)n.push({type:"heading-skip",element:`<${a.outerHTML}>`,message:`Heading level skipped from h${l} to h${g}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});l=g}let u=r.querySelector("html");if(i.includes("<html")&&u&&!u.hasAttribute("lang"))n.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(u&&_(u.getAttribute("lang"),u.getAttribute("dir")))n.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if(r.querySelectorAll("a").forEach((a)=>{let g=a.textContent&&a.textContent.trim().length>0,p=a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby"),f=a.hasAttribute("title"),m=a.querySelector("img[alt]");if(!g&&!p&&!f&&!m)n.push({type:"link-missing-text",element:`<${a.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),i.includes("<nav")||i.includes("<header")){if(!r.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&r.querySelectorAll("a").length>5)n.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if(r.querySelectorAll("table").forEach((a)=>{if(V(a.getAttribute("role")))return;let g=a.querySelector("caption");if(!a.querySelector("th"))n.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!g&&!a.hasAttribute("aria-label")&&!a.hasAttribute("aria-labelledby"))n.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),r.querySelectorAll('[style*="color"]').forEach((a)=>{let g=a.getAttribute("style")||"";if(g.includes("color:")&&!g.includes("background"))n.push({type:"potential-contrast-issue",element:`<${a.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),r.querySelectorAll("video[autoplay], audio[autoplay]").forEach((a)=>{if(!a.hasAttribute("muted"))n.push({type:"autoplay-audio",element:`<${a.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),r.querySelectorAll("[tabindex]").forEach((a)=>{if(Number.parseInt(a.getAttribute("tabindex")||"0")>0)n.push({type:"positive-tabindex",element:`<${a.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),r.querySelectorAll('[role="button"]').forEach((a)=>{if(!a.hasAttribute("tabindex"))n.push({type:"button-not-focusable",element:`<${a.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),i.includes("<body")&&!r.querySelector('main, [role="main"]'))n.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});r.querySelectorAll("iframe").forEach((a)=>{if(!a.hasAttribute("title")&&!a.hasAttribute("aria-label"))n.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch(r){console.error(`Error checking accessibility in ${s}:`,r)}return n}async function oc(e,s={}){let i={},{recursive:n=!0,ignorePaths:r=[]}=s,o=Array.isArray(e)?e:[e],l=await Bo(o,{recursive:n,ignorePaths:r}),u=[];for(let a of l)try{let g=await Bun.file(a).text();if(a.endsWith("good-a11y.stx"))continue;let p=await Ae(g,a);if(u.push(a),p.length>0)i[a]=p}catch(g){console.error(`Error scanning ${a}:`,g)}return{results:i,scannedFiles:u}}var ic={name:"a11y",handler:(e,s,i,n)=>{if(!s.length)return e;let r=s[0].replace(/['"]/g,""),o=s.length>1?s[1].replace(/['"]/g,""):"",u={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[r]||"Make this element accessible";return`<!-- a11y-hint: ${o||u} -->${e}`},hasEndTag:!1},ac={name:"screenReader",handler:(e)=>`<span class="sr-only">${e}</span>`,hasEndTag:!0};
|
|
4
4
|
export{rc,sc,oc,ic,ac};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{em,aa,Yl,tm,nm,rm,sm,om,Zl,Ql,im,am,cm,lm}from"./chunk-
|
|
2
|
+
import{em,aa,Yl,tm,nm,rm,sm,om,Zl,Ql,im,am,cm,lm}from"./chunk-kf80wm87.js";import"./chunk-zpqqdyb4.js";import"./chunk-8x3axvek.js";import"./chunk-02c0zcaw.js";import"./chunk-k4yjbkgb.js";import"./chunk-3h2e5jte.js";import"./chunk-tkp7npcj.js";import"./chunk-fmsrzpb4.js";import"./chunk-tary163t.js";import"./chunk-8q8202pj.js";import"./chunk-qeyjbnpn.js";import"./chunk-5s8bt976.js";import"./chunk-we96m579.js";import"./chunk-37j288h1.js";import"./chunk-y1h6z9cy.js";import"./chunk-qeh8f4bk.js";import"./chunk-snfmgp7a.js";import"./chunk-c0v9ng82.js";import"./chunk-mdsrnd6s.js";import"./chunk-9d9rn9qs.js";import"./chunk-fcp5mde5.js";import"./chunk-r6s35xw9.js";import"./chunk-5hrm7rtx.js";import"./chunk-89h4snzd.js";import"./chunk-kyk4ekng.js";export{Yl as SUSPENSE_RESOLVER_RUNTIME,aa as buildSuspenseResolveScript,om as createStreamRenderer,rm as extractStreamBoundaries,lm as generateHydrationRuntime,Ql as islandDirective,am as processSectionDirectives,nm as processStreamDirectives,im as registerStreamingDirectives,tm as renderStreamingPage,em as streamTemplate,sm as streamTemplateSimple,cm as streamToResponse,Zl as streamingSuspenseDirective};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Jo,hc,o,$t,oe,C,Ie,dn,Oe,pe,X,yr,pn,As,Tc,gn,wr,Is,Os,$c,ni,Rc,Ac,Pc,Ic,De,Me,Ns,Be,r,yn,h,p,V,Z,xe,k,E}from"./chunk-
|
|
2
|
+
import{Jo,hc,o,$t,oe,C,Ie,dn,Oe,pe,X,yr,pn,As,Tc,gn,wr,Is,Os,$c,ni,Rc,Ac,Pc,Ic,De,Me,Ns,Be,r,yn,h,p,V,Z,xe,k,E}from"./chunk-9d9rn9qs.js";import{u,f,R,t,ae,q,c,Se,fi,B,xn,gi,jt,mi,Wc,_r,qc,st,Kc,Cr,Gc,Sn,hi,Xc,Er,$r,ke,yi}from"./chunk-5hrm7rtx.js";import{Dt}from"./chunk-r6s35xw9.js";import{vn}from"./chunk-fcp5mde5.js";import{y}from"./chunk-8x3axvek.js";import{pr,xs}from"./chunk-mdsrnd6s.js";import{ec,tc,lr,Ye,nc,P}from"./chunk-37j288h1.js";import{zo,Ho,Vo,Uo}from"./chunk-c0v9ng82.js";import{Xa,rs}from"./chunk-tkp7npcj.js";import{Qr,es,ts}from"./chunk-3h2e5jte.js";import{os,Oo,No,is,as,Do}from"./chunk-8q8202pj.js";import{Zr,rr}from"./chunk-k4yjbkgb.js";import{Co}from"./chunk-02c0zcaw.js";import{se,Ro,Ao,Po}from"./chunk-tary163t.js";import{or,ye,Ya,ir,Za}from"./chunk-qeyjbnpn.js";import{L,Xe}from"./chunk-f4gqzg1y.js";import{rc,sc}from"./chunk-y1h6z9cy.js";import{T,kn,bi}from"./chunk-4nmb776w.js";import fs from"fs";import ce from"path";function lt(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -1558,13 +1558,13 @@ ${M}
|
|
|
1558
1558
|
</style>`;a=a.replace(x,I),v.lastIndex=0}catch(M){}}}return a}import it from"path";var us=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ds=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function ps(s,e){if(!e||!s.includes("/"))return s;let l=it.dirname(e);return s.replace(us,(a,g,n,d)=>{let v=it.resolve(l,d);return`${g}${n}${v.split(it.sep).join("/")}${n}`})}function cn(s,e){if(!e||!s.includes("<script"))return s;return s.replace(ds,(l,a,g,n)=>`${a}${ps(g,e)}${n}`)}var _e="<!--PARENT_CONTENT_PLACEHOLDER-->";function ln(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wn(s,e){let l=s.length,a=e,g=!0,n=[],d=(v)=>v+9<=l&&s[v]==="<"&&s[v+1]==="/"&&(s[v+2]==="s"||s[v+2]==="S")&&(s[v+3]==="c"||s[v+3]==="C")&&(s[v+4]==="r"||s[v+4]==="R")&&(s[v+5]==="i"||s[v+5]==="I")&&(s[v+6]==="p"||s[v+6]==="P")&&(s[v+7]==="t"||s[v+7]==="T")&&(s[v+8]===">"||/\s/.test(s[v+8]));while(a<l){let v=s[a];if(d(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
|
|
1559
1559
|
`,a+2),a===-1)return-1;a+=1,g=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,g=!0;continue}if(v==="/"&&g){let m=a+1,x=!1;while(m<l){let b=s[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
|
|
1560
1560
|
`){m=-1;break}m++}if(m===-1){a++,g=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,g=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
|
|
1561
|
-
`)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function un(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1561
|
+
`)break;a++}g=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}if(n.length===0)g=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,g=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,g=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;a++}return-1}function $n(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let g=a.index+a[0].length,n=s.indexOf("</script>",g);if(n===-1)return null;let d=s.indexOf(">",n);if(d===-1)return null;return{start:a.index,end:d+1}}var gs=4096;async function un(s,e,l){if(l.buildMode!=="serve"||e.length<gs)return null;let{registerServeModuleBundle:a}=await import("./chunk-p5hbpmws.js");return`<script ${s} src="${a(e)}"></script>`}async function Qn(s,e,l){try{let{registeredModuleIdsIn:a,buildModuleRegistryScript:g}=await o("stx/client-module-registry",()=>import("./chunk-8zr9xhf3.js")),n=[],d=await g(a(...s),{minify:bi(e.buildMode,e.minifyClient),collectInputs:n});for(let v of n)l?.add(v);if(!d)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-p5hbpmws.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(d)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${d.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function ms(s,e=""){let l=$n(s,"data-stx-runtime");if(!l)return s;let a=or(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
|
|
1562
1562
|
`+s.slice(a,l.start)+s.slice(l.end);let g=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),d=or(n);if(d===-1)return g+e+`
|
|
1563
1563
|
`+n;return n.slice(0,d)+g+e+`
|
|
1564
1564
|
`+n.slice(d)}function hs(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,g)=>{let n=s.slice(0,g);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,g){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=xe(s,l);let n=!e.__stxProcessingDepth;gn(e);for(let d of a._layerGraph?.configDependencies??[])g.add(d);if(n&&a.runtimeConfig)await vn(e,l,a.runtimeConfig);if(n)Pc(e),e.__stx_scope_seq??={n:0,key:Ns(String(e.__filename??l))},e.__stx_head_injections=mi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!T()&&!kn())&&l&&l.endsWith(".stx"))Co(s,l);try{return await oe.timeAsync("template-processing",async()=>{let d=await ys(s,e,l,a,g);if(n)d=ni(d);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=ke(a.app?.head,{known:$r,source:"app.head"}),x=(e.__stx_runtime_head||null)??yi(),b=(e.__stx_head_raw||"").trim(),w,S=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(S)w=S[1].trim(),b=b.replace(S[0],"").trim();let _=e.__sections?.title,D=_?k(_,e,l):void 0,A=x.title||w||D,M=!x.title&&(!!w||!!D),I=x.meta||[],N=new Set(I.map((K)=>st(K)).filter(Boolean)),U={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((K)=>!N.has(st(K))),...I],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
1565
1565
|
`),...x.htmlAttrs&&{htmlAttrs:Kc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},W=hi(d);if(d=Er(d,U,{...M&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},W),W)d=Xc(d,v),d=Cr(d,U.htmlAttrs);let O=d.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&d.includes("<head")){let K=O[1],G=xs(K);d=d.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
|
|
1566
1566
|
<meta name="stx-layout" content="${ln(K)}">
|
|
1567
|
-
<meta name="stx-layout-group" content="${ln(G)}">`)}let j=d.match(/function (__stx_setup_\w+)\(/),H=j?L(d):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){d=Xe(d,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");d=d.replace(K,"$1")}}if(n){let v=e.__stx_head_injections??mi(),m=Gc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=Wc(d,v);let b=a.app?.colorMode;if(b)d=_r(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,S=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-
|
|
1567
|
+
<meta name="stx-layout-group" content="${ln(G)}">`)}let j=d.match(/function (__stx_setup_\w+)\(/),H=j?L(d):null;if(j&&H&&!/\bdata-stx=/.test(H.tag)){d=Xe(d,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");d=d.replace(K,"$1")}}if(n){let v=e.__stx_head_injections??mi(),m=Gc(d);if(m!==null)v.beforeClose.push(m);let x=tn(d);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!d.includes("data-stx-offline"))v.beforeClose.push(nn);d=Wc(d,v);let b=a.app?.colorMode;if(b)d=_r(d,b)}if(n)if($n(d,"data-stx-runtime")){let m=null,x=null,b=null,w=null,S=null;try{let{getStoreScript:D}=await o("stx/store-loader",()=>import("./chunk-bn13c7ma.js")),A=a.storesDir,M=await D(A);if(M)b=`<script data-stx-stores>${M}</script>`,x=await un("data-stx-stores",M,a)??b}catch{}m=await Qn([d,b],a,g);try{let{getFrameworkComposableScript:D}=await o("stx/framework-composables",()=>import("./chunk-5afjh2ms.js"));S=await D(d)}catch{}try{let{getComposableScript:D}=await o("stx/composable-loader",()=>import("./chunk-gbve6fgb.js")),A=a.composablesDir,M=[m,b,S].filter((N)=>N!==null),I=await D(a._layerComposableDirs??A,d,M);if(I)w=await un('data-stx-scoped data-stx-run="always" data-stx-composables',I,a)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${I}</script>`}catch{}let _=[m,x,w,S].filter((D)=>D!==null).map((D)=>`
|
|
1568
1568
|
${D}`).join("");d=ms(d,_)}else{let m=await Qn([d],a,g);if(m){let x=d.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)d=d.slice(0,x)+m+`
|
|
1569
1569
|
`+d.slice(x)}}if(n)d=qc(d);if(n&&e.__stx_inject_css!==!1)d=await y(d,void 0,a.buildMode==="serve",!0);else if(n)d=pn(d);if(d=d.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),d=hs(d),n&&e.__stx_runtime_config)d=Dt(d,e.__stx_runtime_config);if(n&&!e.__stx_defer_server_data){let v=wr(e);if(v){let m=/<head\b[^>]*>/i.exec(d),x=m?m.index+m[0].length:0;d=d.slice(0,x)+v+d.slice(x)}}return d})}catch(d){if(d instanceof q)throw d;let v=d instanceof Error?d.message:String(d),m=new ae(`Template processing failed: ${v}`,l,void 0,void 0,s.substring(0,200)+(s.length>200?"...":""));if(B.log(m,{filePath:l,context:e}),xn.logDetailedError(m,{filePath:l,template:s.substring(0,500)}),T()&&!a.debug)console.error(`[stx] ${ce.relative(process.cwd(),l)||l}: ${m.message}`);if(a.debug)throw m;return fi.createFallbackContent("Template Processing",m)}}async function ys(s,e,l,a,g){let n=process.cwd(),d={...a,partialsDir:a.partialsDir&&!ce.isAbsolute(a.partialsDir)?ce.resolve(n,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ce.isAbsolute(a.componentsDir)?ce.resolve(n,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ce.isAbsolute(a.layoutsDir)?ce.resolve(n,a.layoutsDir):a.layoutsDir},v=d,m=s;await ws(l,e),bs(e,v),m=await Se(()=>zt(m,e,l,v),m,(O)=>{B.log(O,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${O.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=pe(m,Oe,(O,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);m=x.output;let b=x.tokens,w=(O)=>b.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,H)=>b[Number(H)]??""),S="\x00STX_ESCAPED_AT\x00",_="\x00STX_ESC_MUSTACHE_OPEN\x00",D="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,S),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(O,j)=>`${_}${j}${D}`),m=Jt(m),m=await an(m,l,g);let A={};m=es(m,A);let M={...e.__sections||{}},I="",N=gt(mt(s)),U=/@nolayout\b/.test(m)||N===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let W=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)I=W[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(I=N,!/@section\s*\(/.test(m))m=`@section('content')
|
|
1570
1570
|
${m.trim()}
|
|
@@ -1573,7 +1573,7 @@ ${m.trim()}
|
|
|
1573
1573
|
@endsection`}}if(I&&m.includes("<script")){let O=X(m),j=O.scripts.map((H)=>fn(H,l)??H);m=yr(O.output,j)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,j,H)=>(M[j]=H,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,j,H)=>{if(/^(['"]).*\1$/.test(H.trim()))return O;try{let K=u(H.trim(),e);if(K===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(K)-1;return M[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,j,H)=>{if(H.includes("@parent"))M[j]=H.replace("@parent",_e);else M[j]=H.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,j,H)=>M[j]||H||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=ts(m,A),I){let O=[],j=X(m),H=pe(j.output,dn,(K,G)=>`\x00STX_ORPHAN_STYLE_${G}\x00`);if(m=H.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,G,Y)=>{let ee=G==="SCRIPT"?fn(j.scripts[Number(Y)],l):H.tokens[Number(Y)];if(ee)O.push(ee);return""}),O.length>0){let K=O.join(`
|
|
1574
1574
|
`);M.content=M.content?`${M.content}
|
|
1575
1575
|
${K}`:K,e.__sections=M}}if(I)try{let O;if(ce.isAbsolute(I))O=I,g.add(I);else O=await Se(()=>yn(I,l,d,g),null,()=>{throw new ae(`Failed to resolve layout path: ${I}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let ee=(re)=>{if(!re)return[];try{let ie=ce.isAbsolute(re)?re:ce.resolve(process.cwd(),re);return fs.readdirSync(ie).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(d.layoutsDir),...ee(d.fallbackLayoutsDir)].filter((re,ie,le)=>le.indexOf(re)===ie).sort(),ue=`Layout not found: ${I} (referenced from ${l})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:d.layoutsDir?`. No .stx layouts found in ${d.layoutsDir}`:"");if(B.log(Error(ue),{layoutPath:I,filePath:l,available:te},"error"),console.error(`[stx] ${ue}`),d.debug)throw new ae(ue,l);return m}let j=await Se(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});j=cn(j,O);let H=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(d.debug)console.log(`Found nested layout: ${H[1]} in ${O}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,le,be)=>(ee[le]=be.trim(),""));for(let[ie,le]of Object.entries(ee))if(M[ie]&&M[ie].includes(_e)){let be=M[ie].indexOf(_e);M[ie]=M[ie].slice(0,be)+le+M[ie].slice(be+_e.length)}else if(!M[ie])M[ie]=le;let ue={...e,__sections:M},re=`@layout('${H[1]}')${te}`;return await i(re,ue,O,d,g)}let K=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=es(K,A),Y={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(M[te]){let re=M[te];if(re.includes(_e)){let ie=Y[te]||"",le=re.indexOf(_e);re=re.slice(0,le)+ie+re.slice(le+_e.length)}return re}return ue||""}),G=vs(G,M),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),G=ts(G,A),e.__originalFilePath=l,m=await bn(G,e,O,d,g),m=`<!-- stx-layout: ${I} -->
|
|
1576
|
-
${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await bn(m,e,l,d,g))}function vs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function bs(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function ws(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function fn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function hn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1576
|
+
${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${I}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await bn(m,e,l,d,g))}function vs(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,g)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return g||""})}function bs(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[g,n]of Object.entries(process.env))if(g.startsWith(l)&&n!==void 0)a[g]=n;s.$env=a}async function ws(s,e){await Se(()=>Kt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var ot="data-stx-source";function fn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ot))return s;return`<script ${ot}="${encodeURIComponent(e)}"${s.slice(7)}`}function ks(s){let e=new RegExp(`${ot}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function mn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function hn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${mn(s)}</span><span style="display:block;margin-top:4px">${mn(l)}</span></div>`}async function Ss(s,e,l,a){let{scanScriptTags:g}=await o("stx/signal-processing",()=>import("./chunk-bymeqhjp.js")),n=[],d=!T()&&!kn();for(let m of g(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=wn(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let _=ks(x)??l,D={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-q82kcwn4.js"));await A(S,e,_,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:_,kind:M.kind,message:M.message}),!d)return;n.push({...D,markup:hn(_,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:_,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${_}: ${M.message}`),d)n.push({...D,markup:hn(_,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function $s(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-th2ej2dz.js"));return a(s,e,{skipServer:!0})}catch(a){let g=a instanceof Error?a:Error(String(a));return B.log(g,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${g.message}`),s}}async function bn(s,e,l,a,g){let n=s,d=a;if(n=await Ss(n,e,l,a),n=await Bt(n,e,l),n=await Ft(n,e,l),n=await $s(n,e,l),n=await At(n,e,l,d),xe(n))n=Oo(n,e),n=as(n,e),n=is(n,e);n=No(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-y627cbst.js"));n=v(n,e),n=rr(n,e,l,d,!0),n=await en(n,e,l,d,g),n=await rs(n,e,l,d,g),n=ec(n,e,l,d);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-vqjbqm6c.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-6x112bw3.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-gsawyk8q.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:_}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=_(n);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-1019v091.js"));n=D(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-1kdtapc1.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-fk7gs41v.js"));n=M(n,e,l);let{processVirtualListDirectives:I,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await o("stx/virtual-scrolling",()=>import("./chunk-tyb22n6n.js"));n=I(n,e,l),n=N(n,e,l),n=U(n,e,l);let{processPartialHydrationDirectives:W,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-z3ggbhhc.js"));n=W(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:H}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=H(n,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-3t737sdr.js"));n=K(n,e,l);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-ydx3j69d.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
|
|
1577
1577
|
`;if(n=Y(n,e),n=ee(n,e,l),n=Xt(n),n=Ro(n,e),n=Ct(n),n=Ut(n),n=await Qr(n,e,l,d,g),n=await rs(n,e,l,d,g),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=ni(n),n=se(n,e,l),n=Zr(n),e.__stxProcessingDepth===1)n=Ic(n,e);if(n=Tc(n,e,{filePath:l,buildMode:d.buildMode}),n=Ao(n,e),n=Po(n,e),n=ze(n,e),n=Nt(n,e),n=Ht(n,e),n=await bt(n,e,l,d),n=await nc(n,e,l),n=await rc(n,e,l,d),n=sc(n,e,l,d),n=zo(n,e,l,d),n=Ho(n,e,l),n=Vo(n,e,l,d),n=_t(n,e,l,d),n=Is(n,e),n=Os(n),n=$c(n),!d.skipEventDirectives)n=hc(n,e,l);if(n=vt(n,e,l),d.debug){let F=/\bx-data\s*=/.test(n),z=os(s);if(F&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1578
1578
|
Both work on the same page, but they manage separate scopes.
|
|
1579
1579
|
Prefer signals (state/derived/effect) for new components.`)}n=Xa(n,e),n=await k(n,e,l),n=Rc(n),n=Ac(n),n=pt(n);let{processXElementDirectives:re}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=re(n);let ie=e.__originalFilePath||l,le=De(e);if(n=await Do(n,d,ie,le),n=Ot(n,e),n=await Wt(n,e,l,d),d.media?.image?.autoSiblings){let F=d.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-cgyddqxw.js"));n=await z(n,{publicDir:F})}if(d.seo?.enabled)n=Uo(n,e,d);let be=(F,z,J=!0)=>{if(!z)return F;let me=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Te=ne.index+fe.index;F=F.slice(0,Te)+me[0]+F.slice(Te+fe[0].length)}if(z=z.replace(me[0],"").trim(),!z)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${z}
|
|
@@ -1587,6 +1587,6 @@ ${lt()}
|
|
|
1587
1587
|
`+Te}else n=n.replace("</head>",`${z}
|
|
1588
1588
|
</head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
|
|
1589
1589
|
${z}`);else n=z+`
|
|
1590
|
-
`+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1590
|
+
`+n}{let{scanScriptTags:F}=await o("stx/signal-processing",()=>import("./chunk-bymeqhjp.js")),z=[];for(let J of F(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=wn(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;z.push({start:J.start,end:fe})}if(z.length>0){let J=Array(z.length+1),me=0;for(let ne=0;ne<z.length;ne++){let{start:fe,end:Te}=z[ne];J[ne]=n.slice(me,fe),me=Te}J[z.length]=n.slice(me),n=J.join("")}}let at=As(n,l);if(at.hasScoped)n=at.html;let Rn=e.__stx_event_bindings||[],Ke=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:Dn}=await o("stx/signal-processing",()=>import("./chunk-bymeqhjp.js"));for(let F of Dn(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:J}of ct){Ke=!0;let me=J;Ie(J,l,a.strict,e.__originalFilePath);let ne=await Me(J,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:bi(a.buildMode,a.minifyClient),serverData:le});n=n.replace(F,()=>ne)}if(Ke)e.__stx_event_bindings=[];if(!Ke&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=Jo(F);if(z){let J=n.lastIndexOf("</body>");n=J===-1?n+z:n.slice(0,J)+z+`
|
|
1591
1591
|
`+n.slice(J)}e.__stx_event_bindings=[]}}if(!ye(n)&&Ya(n))n=await ir(n,d);if(n=Za(n),d.csp?.enabled&&d.csp.useNonce&&typeof e.cspNonce==="string")n=Et(n,e.cspNonce);return n}
|
|
1592
1592
|
export{mt,Re,Wa,Yr,ko,_o,Qn,i};
|