@stacksjs/stx 0.2.910 → 0.2.913
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-027qc41m.js +2 -0
- package/dist/{chunk-c829tgwv.js → chunk-084f6953.js} +1 -1
- package/dist/{chunk-ba27s9vr.js → chunk-0b5vmmf8.js} +1 -1
- package/dist/chunk-12f99j3h.js +2 -0
- package/dist/{chunk-cpt9sg6d.js → chunk-132j46ey.js} +1 -1
- package/dist/{chunk-cw7vnkc8.js → chunk-1nf2ma94.js} +1 -1
- package/dist/{chunk-cd2jc724.js → chunk-1qygqpc7.js} +1 -1
- package/dist/{chunk-dh4p07cc.js → chunk-2qypb5q8.js} +1 -1
- package/dist/{chunk-13awnyq0.js → chunk-2vdbt2a7.js} +1 -1
- package/dist/{chunk-e4fseqnv.js → chunk-3xgr1z61.js} +1 -1
- package/dist/{chunk-a259mfax.js → chunk-500be1wy.js} +2 -2
- package/dist/chunk-5md9ymx3.js +2 -0
- package/dist/{chunk-xjbj655y.js → chunk-5mv2hc96.js} +3 -3
- package/dist/{chunk-pp89n1et.js → chunk-5xsghm23.js} +1 -1
- package/dist/{chunk-4kh0616n.js → chunk-6s82ecbh.js} +4 -4
- package/dist/{chunk-anj2j86n.js → chunk-6vyy44ve.js} +2 -2
- package/dist/{chunk-ck4ypzet.js → chunk-75r2p1cz.js} +1 -1
- package/dist/{chunk-gwvkqf5r.js → chunk-7b2t9j0x.js} +4 -4
- package/dist/{chunk-7apr0ww2.js → chunk-7mv9z3mp.js} +1 -1
- package/dist/{chunk-688hf1mx.js → chunk-89z732nx.js} +1 -1
- package/dist/{chunk-87aqcw1w.js → chunk-8mc1kr6z.js} +1 -1
- package/dist/{chunk-b234w3mf.js → chunk-9gptdyqq.js} +14 -4
- package/dist/chunk-a774ncg3.js +3 -0
- package/dist/chunk-aty34jhn.js +2 -0
- package/dist/chunk-banmft69.js +2 -0
- package/dist/{chunk-jcp3rs1t.js → chunk-bwk2jakf.js} +1 -1
- package/dist/chunk-dk881ye4.js +2 -0
- package/dist/{chunk-ccq7d7ar.js → chunk-dm9r5gzb.js} +1 -1
- package/dist/{chunk-ggez55jb.js → chunk-etn044yn.js} +7 -7
- package/dist/{chunk-kvcz1926.js → chunk-exny40nv.js} +1 -1
- package/dist/chunk-f9dy0r3f.js +2 -0
- package/dist/{chunk-4zw9trtx.js → chunk-fcqca9qb.js} +1 -1
- package/dist/{chunk-vd03gnnb.js → chunk-fcxg3xwf.js} +5 -5
- package/dist/{chunk-9grwqzpe.js → chunk-fd8fp6h4.js} +1 -1
- package/dist/{chunk-ah615efp.js → chunk-fx6hg5yd.js} +1 -1
- package/dist/{chunk-r425m35g.js → chunk-g9s2t064.js} +1 -1
- package/dist/{chunk-zbzfkh3m.js → chunk-gfm238j6.js} +1 -1
- package/dist/{chunk-8d6wkfdx.js → chunk-gqz6502d.js} +2 -2
- package/dist/{chunk-94k80qpp.js → chunk-hacdy30m.js} +1 -1
- package/dist/{chunk-pgqc8895.js → chunk-hcxsyw55.js} +4 -4
- package/dist/{chunk-ph8k7jdx.js → chunk-hgpjneyy.js} +2 -2
- package/dist/{chunk-9nf58keq.js → chunk-hm954re1.js} +1 -1
- package/dist/{chunk-2r84qtat.js → chunk-ja4fyz87.js} +2 -2
- package/dist/chunk-jr3txt3f.js +2 -0
- package/dist/{chunk-3760wpvw.js → chunk-kc3w40c2.js} +1 -1
- package/dist/{chunk-5k55yk8g.js → chunk-mqknt05a.js} +1 -1
- package/dist/chunk-n008g6xh.js +2 -0
- package/dist/{chunk-dqt1kw68.js → chunk-p9cm5ksf.js} +1 -1
- package/dist/{chunk-gt3426kc.js → chunk-pasjfsz4.js} +1 -1
- package/dist/{chunk-4ccbj4z6.js → chunk-px6zx8ae.js} +1 -1
- package/dist/{chunk-pn3gj7zm.js → chunk-pzf34jvd.js} +1 -1
- package/dist/chunk-q8k9ava8.js +2 -0
- package/dist/{chunk-d5szrgdq.js → chunk-qedhz0p8.js} +1 -1
- package/dist/chunk-qfwnp28b.js +2 -0
- package/dist/{chunk-q33tyfpp.js → chunk-rbfrxaer.js} +1 -1
- package/dist/{chunk-caaexbqy.js → chunk-rmyhjta6.js} +1 -1
- package/dist/{chunk-29trx6h3.js → chunk-s19t5mh2.js} +1 -1
- package/dist/chunk-s26a54qk.js +2 -0
- package/dist/{chunk-magfdzdj.js → chunk-thrvqves.js} +1 -1
- package/dist/{chunk-pmmctgdd.js → chunk-tm4fgc58.js} +1 -1
- package/dist/{chunk-r2ns89f7.js → chunk-v37hjzt2.js} +1 -1
- package/dist/{chunk-13kfjnyn.js → chunk-vk9s9byv.js} +4 -4
- package/dist/{chunk-azyq6fds.js → chunk-vr6maaas.js} +1 -1
- package/dist/{chunk-g17g6w1t.js → chunk-whd6y829.js} +3 -3
- package/dist/chunk-ygrrbcfm.js +2 -0
- package/dist/chunk-ys68yvgz.js +2 -0
- package/dist/{chunk-kvrbdez2.js → chunk-z02jzx63.js} +1 -1
- package/dist/chunk-zjrnz9yt.js +7 -0
- package/dist/{chunk-x40j9ta1.js → chunk-zwhc17pt.js} +2 -2
- package/dist/chunk-zzpedcte.js +2 -0
- package/dist/cli.js +8 -8
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/dist/strip-literals.js +40 -26
- package/package.json +5 -5
- package/dist/chunk-1a911c4c.js +0 -2
- package/dist/chunk-24hrd8sg.js +0 -2
- package/dist/chunk-2cbrcb9m.js +0 -2
- package/dist/chunk-3rzpkjmn.js +0 -2
- package/dist/chunk-44qcbbc4.js +0 -2
- package/dist/chunk-6w9sgs52.js +0 -2
- package/dist/chunk-7w9ksdbp.js +0 -2
- package/dist/chunk-850b0cxa.js +0 -2
- package/dist/chunk-9yvhj108.js +0 -2
- package/dist/chunk-ahf9j8wb.js +0 -12
- package/dist/chunk-cf4apy9s.js +0 -3
- package/dist/chunk-cqcxj08t.js +0 -2
- package/dist/chunk-q6jecdtg.js +0 -2
- package/dist/chunk-ssdjny2r.js +0 -2
- package/dist/chunk-sx1jg8dw.js +0 -2
- package/dist/chunk-vf29gp9a.js +0 -2
- package/dist/chunk-ya8nwtdn.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Ma,Om,jo,Nm,hu,yu,Mm,Dm}from"./chunk-hacdy30m.js";import"./chunk-pzf34jvd.js";import"./chunk-px6zx8ae.js";import"./chunk-gqz6502d.js";import"./chunk-cwcmmgvz.js";import"./chunk-6vyy44ve.js";import"./chunk-hcxsyw55.js";import"./chunk-v0yay1kw.js";import"./chunk-2vdbt2a7.js";import"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import{_e,so}from"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Ma as buildScriptVirtualFile,Om as buildVirtualSource,_e as extractScriptBlocks,so as extractTemplateExpressions,hu as findRuntimeTypeDeclarations,yu as findStxModuleDeclarations,Dm as formatTypecheckDiagnostics,Nm as sourcePathFor,Mm as typecheckStxFiles,jo as virtualPathFor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{R}from"./chunk-0jdz31q1.js";import{Ie,Wt,oe,F,Nn,ae,P}from"./chunk-ggez55jb.js";import{Zi,ho,d,m,M,Ee,p,yo,n,u,_}from"./chunk-c08jvjqt.js";import{kr}from"./chunk-anj2j86n.js";import{ge}from"./chunk-9bexzgws.js";import{js}from"./chunk-v0yay1kw.js";var he=1000,me=!1;function xe(t,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(t))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=_(t,"(",")",b);if(x===-1)continue;let f=t.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=M(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=t.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?t:e+t.slice(o)}function be(t,r){let i=/@component\s*\(/g,e=t,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),w=g.match(/^\s*,\s*/);if(!w)continue;let k=g.slice(w[0].length).trim();if(!k)continue;try{let S=M(k,r),B=JSON.stringify(S),I=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:I})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function se(t,r,i){let e=t,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(t,r){let i=t;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(F(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Zi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!Ee(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function le(t,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(t);s;s=i.exec(t)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?t.indexOf("!!}",i.lastIndex):Ie(t,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(t.slice(l));if(x){let f=l+x[0].length-1,c=_(t,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${t.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=t.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+t.slice(o)}function ue(t){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Nn(t,(o,s,l)=>(i+=ie(r(t.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ie(r(t.slice(e)))}function fe(t,r,i,e){return ae(t,r,i==null?"":String(i),!1,e)}function ie(t){let r=t;return r=se(r,"@break",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { break; } result += \``}),r=se(r,"@continue",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function _e(t){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(t))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(t))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(t))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<t.length&&a>0){if(t[y]==="(")a++;else if(t[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let w=t.substring(h+1,g),k=Wt(w);if(!k)continue;let{arrayExpr:S,itemVar:B}=k,I=g+1,A=1,T=I,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&T<t.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(t),E=L.exec(t);if(!E)break;if(C&&C.index<E.index)A++,T=C.index+C[0].length;else{if(A--,A===0){V=E.index;break}T=E.index+11}}if(V===-1)continue;let O=t.substring(I,V),Z=V+11,z=-1,D=0,N=0;while(N<O.length){let C=O.indexOf("@",N);if(C===-1)break;let E=O.substring(C);if(/^@forelse\s*\(/.test(E))D++,N=C+1;else if(E.startsWith("@endforelse"))D--,N=C+11;else if(D===0&&E.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){z=C;break}N=C+1}else N=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:S,itemVar:B,foreachContent:O.substring(0,z),emptyContent:O.substring(z+6)}}return null}function ce(t,r){let i=t;while(!0){let e=_e(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,n.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",$e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Re(t,r){return`${de}${encodeURIComponent(t)}|${encodeURIComponent(r)}-->`}function Ae(t,r){console.warn(`[stx] @foreach(${t}) in ${r}: ${t} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Is(t){if(!t.includes(de))return t;return t.replace($e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function mg(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function ui(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)await R(),l=s.next();return l.value}function*ne(t,r,i,e,o=!1){let s=t,l=new Set(r.__stx_client_signal_names||[]);for(let c of kr(t))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=ce(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,w=1,k=g+1,S=-1;while(k<c.length&&w>0){if(c[k]==="(")w++;else if(c[k]===")"){if(w--,w===0){S=k;break}}k++}if(S===-1)continue;let B=c.substring(g+1,S),I=Wt(B);if(!I)continue;let A=y,{arrayExpr:T,itemVar:K}=I,L=S+1,V=1,O=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&O<c.length){Z.lastIndex=O,z.lastIndex=O;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,O=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:T,itemVar:K,content:C}}O=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:w,arrayExpr:k,itemVar:S,content:B}=y;try{let I=k.trim(),A;if(m(I))A=p(I,Object.keys(h))(...Object.values(h));else A=d(I,h);let T=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),T=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),T=!0;else{let E=Re(I,i)+u("Foreach",`Error in @foreach: ${I} is not iterable`,n.TYPE_ERROR);a=a.substring(0,g)+E+a.substring(w);continue}let K=e?.loops?.useAltLoopVariable??me,L=S.trim(),V=null,O,Z=!1;if(L.includes("=>")){let E=L.split("=>").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])V=E[0],O=E[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])O=E[0],V=E[1],Z=!0;else O=L}else O=L;let z="",D=new Set(oe(`${k} as ${S}`)),N=A,C=h[ho]??new WeakMap;for(let E=0;E<N.length;E++){if(E%16===0)yield;let W=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},j={...h,loop:te,$loop:te,[ho]:C};if(Array.isArray(h.__stx_client_signal_names))j.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[O]=W}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),re=X===-1?Y:U.slice(X+1).trim();if(Y&&re)j[re]=W[Y]});else j[O]=W}else j[O]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[O]=W[1];else j[V]=E;let v=ce(B,j);v=yield*ne(v,j,i,e,!0),v=ge(v,j,i),v=le(v,j);let J=v.indexOf(Q),G=v.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=P(v,j,i),v=ye(v,j),v=be(v,j),v=xe(v,j),z+=v,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(w)}catch(I){let A=u("Foreach",`Error in @foreach(${k.trim()} as ${S.trim()}): ${I instanceof Error?I.message:String(I)}`,n.EVALUATION_ERROR);a=a.substring(0,g)+A+a.substring(w)}}return a}s=yield*x(s,r),s=we(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=Se(s,r,f),o?s:Is(s)}function hg(t){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(t);if(!r||/^(?:const|let|var)$/.test(r[2]))return t;return`${r[1]}let ${t.slice(r[1].length)}`}function pe(t){return yo(t)}function we(t,r,i,e){let o=t,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=_(o,"(",")",x);if(f===-1)break;let c=hg(o.slice(x+1,f)),h=f+1,a=js(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let w=u("For",`Unsafe expression in @for: ${c}`,n.UNSAFE_EXPRESSION);o=o.substring(0,b)+w+o.substring(g),s=!0;continue}try{let w=Oe(c),k=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(w.length>0&&k){let K=ke({forExpr:c,content:y,iterVarNames:w,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let S=Object.keys(r),B=Object.values(r),I=ue(y),T=Function(...S,"__stxRenderLoopValue",`
|
|
2
|
+
import{R}from"./chunk-0jdz31q1.js";import{Ie,Wt,oe,F,Nn,ae,P}from"./chunk-etn044yn.js";import{Zi,ho,d,m,M,Ee,p,yo,n,u,_}from"./chunk-c08jvjqt.js";import{kr}from"./chunk-6vyy44ve.js";import{ge}from"./chunk-9bexzgws.js";import{js}from"./chunk-v0yay1kw.js";var he=1000,me=!1;function xe(t,r){let i=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,s;while((s=i.exec(t))!==null){let l=s.index+s[0].length,b=s.index+s[0].indexOf("("),x=_(t,"(",")",b);if(x===-1)continue;let f=t.slice(l,x).trim();if(!f)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(f)))continue;let h;try{let a=M(f,r);if(!a||typeof a!=="object")continue;h=JSON.stringify(a)}catch{continue}e+=t.slice(o,l)+h,o=x,i.lastIndex=x}return o===0?t:e+t.slice(o)}function be(t,r){let i=/@component\s*\(/g,e=t,o,s=[];while((o=i.exec(e))!==null){let l=o.index,b=l+o[0].length-1,x=1,f=b+1;while(f<e.length&&x>0){if(e[f]==="(")x++;else if(e[f]===")"){if(x--,x===0)break}f++}if(x!==0)continue;let c=e.substring(b+1,f),h=f+1,a=c.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],g=c.slice(a[0].length),w=g.match(/^\s*,\s*/);if(!w)continue;let k=g.slice(w[0].length).trim();if(!k)continue;try{let S=M(k,r),B=JSON.stringify(S),I=`@component('${y}', ${B})`;s.push({start:l,end:h,replacement:I})}catch{continue}}for(let l=s.length-1;l>=0;l--){let{start:b,end:x,replacement:f}=s[l];e=e.substring(0,b)+f+e.substring(x)}return e}function se(t,r,i){let e=t,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),s;while((s=o.exec(e))!==null){let l=s.index,b=l+s[0].length-1,x=1,f=b+1,c=null,h=!1;while(f<e.length&&x>0){let g=e[f];if(h){h=!1,f++;continue}if(g==="\\"&&c){h=!0,f++;continue}if(c){if(g===c)c=null;f++;continue}if(g==='"'||g==="'"||g==="`"){c=g,f++;continue}if(g==="(")x++;else if(g===")"){if(x--,x===0)break}f++}if(x!==0)break;let a=e.substring(b+1,f),y=i(a);e=e.substring(0,l)+y+e.substring(f+1)}return e}function ye(t,r){let i=t;return i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),i=i.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,s)=>{try{if(F(s,r.__stx_client_signal_names||[]))return e;let l=Object.keys(r),b=Object.values(r);Zi(s);let x=!1,c=p(s,l,()=>{x=!0})(...b);if(x)return e;let h=JSON.stringify(c);if(h===void 0){if(!Ee(s).some((g)=>!(g in r)))return"";return e}let a=Buffer.from(h,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(l){return e}}),i}var Q="<!--__STX_BREAK__-->",ee="<!--__STX_CONTINUE__-->";function le(t,r){let i=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let s=i.exec(t);s;s=i.exec(t)){if(!s[1]){let f=s[0].length===3&&s[0]==="{{{"?3:2,c=s[0]==="{!!"?t.indexOf("!!}",i.lastIndex):Ie(t,s.index,f);if(c<0)break;i.lastIndex=c+(s[0]==="{!!"?3:f);continue}let l=i.lastIndex,b=!0,x=/^\s*\(/.exec(t.slice(l));if(x){let f=l+x[0].length-1,c=_(t,"(",")",f);if(c<0)break;l=c+1;try{let h=`!!(${t.slice(f+1,c).trim()})`;b=m(h)?Boolean(p(h,Object.keys(r))(...Object.values(r))):Boolean(d(h,r))}catch{b=!1}}if(e+=t.slice(o,s.index),b)return e+(s[1]==="break"?Q:ee);o=l,i.lastIndex=l}return e+t.slice(o)}function ue(t){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),i="",e=0;return Nn(t,(o,s,l)=>(i+=ie(r(t.slice(e,l))),i+=`\${__stxRenderLoopValue(${l}, (${s}), ${o.length})}`,e=l+o.length,o)),i+ie(r(t.slice(e)))}function fe(t,r,i,e){return ae(t,r,i==null?"":String(i),!1,e)}function ie(t){let r=t;return r=se(r,"@break",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { break; } result += \``}),r=se(r,"@continue",(i)=>{let e=i.trim();if(!yo(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function _e(t){let r=/@forelse\s*\(/g,i,e=[],o=/@foreach\s*\(/g,s=/@endforeach/g,l;while((l=o.exec(t))!==null)e.push({pos:l.index,delta:1});while((l=s.exec(t))!==null)e.push({pos:l.index,delta:-1});e.sort((c,h)=>c.pos-h.pos);let b=[],x=0;for(let c of e)x+=c.delta,b.push({pos:c.pos,depth:x});function f(c){let h=0,a=b.length-1,y=0;while(h<=a){let g=h+a>>1;if(b[g].pos<=c)y=b[g].depth,h=g+1;else a=g-1}return y}while((i=r.exec(t))!==null){if(f(i.index)>0)continue;let c=i.index,h=i.index+i[0].length-1,a=1,y=h+1,g=-1;while(y<t.length&&a>0){if(t[y]==="(")a++;else if(t[y]===")"){if(a--,a===0){g=y;break}}y++}if(g===-1)continue;let w=t.substring(h+1,g),k=Wt(w);if(!k)continue;let{arrayExpr:S,itemVar:B}=k,I=g+1,A=1,T=I,K=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&T<t.length){K.lastIndex=T,L.lastIndex=T;let C=K.exec(t),E=L.exec(t);if(!E)break;if(C&&C.index<E.index)A++,T=C.index+C[0].length;else{if(A--,A===0){V=E.index;break}T=E.index+11}}if(V===-1)continue;let O=t.substring(I,V),Z=V+11,z=-1,D=0,N=0;while(N<O.length){let C=O.indexOf("@",N);if(C===-1)break;let E=O.substring(C);if(/^@forelse\s*\(/.test(E))D++,N=C+1;else if(E.startsWith("@endforelse"))D--,N=C+11;else if(D===0&&E.startsWith("@empty")){if(O.length<=C+6||!/[a-z]/i.test(O[C+6])){z=C;break}N=C+1}else N=C+1}if(z===-1)continue;return{start:c,end:Z,arrayExpr:S,itemVar:B,foreachContent:O.substring(0,z),emptyContent:O.substring(z+6)}}return null}function ce(t,r){let i=t;while(!0){let e=_e(i);if(!e)break;let{start:o,end:s,arrayExpr:l,itemVar:b,foreachContent:x,emptyContent:f}=e;try{let c;if(m(l))c=p(l,Object.keys(r))(...Object.values(r));else c=d(l,r);let h;if(!Array.isArray(c)||c.length===0)h=f;else h=`@foreach (${l} as ${b})${x}@endforeach`;i=i.substring(0,o)+h+i.substring(s)}catch(c){let h=c instanceof Error?c.message:String(c),a=u("Forelse",`Error in @forelse(${l} as ${b}): ${h}`,n.EVALUATION_ERROR);i=i.substring(0,o)+a+i.substring(s)}}return i}var de="<!--stx:foreach-not-iterable:",$e=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Re(t,r){return`${de}${encodeURIComponent(t)}|${encodeURIComponent(r)}-->`}function Ae(t,r){console.warn(`[stx] @foreach(${t}) in ${r}: ${t} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function Is(t){if(!t.includes(de))return t;return t.replace($e,(r,i,e)=>(Ae(decodeURIComponent(i),decodeURIComponent(e)),""))}function mg(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)l=s.next();return l.value}async function ui(t,r,i,e,o=!1){let s=ne(t,r,i,e,o),l=s.next();while(!l.done)await R(),l=s.next();return l.value}function*ne(t,r,i,e,o=!1){let s=t,l=new Set(r.__stx_client_signal_names||[]);for(let c of kr(t))l.add(c);if(l.size)r={...r,__stx_client_signal_names:[...l]};s=ce(s,r);function b(c){let h=/@foreach\s*\(/g,a;while((a=h.exec(c))!==null){let y=a.index,g=a.index+a[0].length-1,w=1,k=g+1,S=-1;while(k<c.length&&w>0){if(c[k]==="(")w++;else if(c[k]===")"){if(w--,w===0){S=k;break}}k++}if(S===-1)continue;let B=c.substring(g+1,S),I=Wt(B);if(!I)continue;let A=y,{arrayExpr:T,itemVar:K}=I,L=S+1,V=1,O=L,Z=/@foreach\s*\(/g,z=/@endforeach/g;while(V>0&&O<c.length){Z.lastIndex=O,z.lastIndex=O;let D=Z.exec(c),N=z.exec(c);if(!N)break;if(D&&D.index<N.index)V++,O=D.index+D[0].length;else{if(V--,V===0){let C=c.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:T,itemVar:K,content:C}}O=N.index+11}}}return null}function*x(c,h){let a=c;while(!0){let y=b(a);if(!y)break;let{start:g,end:w,arrayExpr:k,itemVar:S,content:B}=y;try{let I=k.trim(),A;if(m(I))A=p(I,Object.keys(h))(...Object.values(h));else A=d(I,h);let T=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),T=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),T=!0;else{let E=Re(I,i)+u("Foreach",`Error in @foreach: ${I} is not iterable`,n.TYPE_ERROR);a=a.substring(0,g)+E+a.substring(w);continue}let K=e?.loops?.useAltLoopVariable??me,L=S.trim(),V=null,O,Z=!1;if(L.includes("=>")){let E=L.split("=>").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])V=E[0],O=E[1];else O=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((W)=>W.trim());if(E.length===2&&E[0]&&E[1])O=E[0],V=E[1],Z=!0;else O=L}else O=L;let z="",D=new Set(oe(`${k} as ${S}`)),N=A,C=h[ho]??new WeakMap;for(let E=0;E<N.length;E++){if(E%16===0)yield;let W=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},j={...h,loop:te,$loop:te,[ho]:C};if(Array.isArray(h.__stx_client_signal_names))j.__stx_client_signal_names=h.__stx_client_signal_names.filter((H)=>!D.has(H));if(O.startsWith("[")&&O.endsWith("]")){let H=O.slice(1,-1).split(",").map((U)=>U.trim());if(Array.isArray(W))H.forEach((U,X)=>{if(U)j[U]=W[X]});else j[O]=W}else if(O.startsWith("{")&&O.endsWith("}")){let H=O.slice(1,-1).split(",").map((U)=>U.trim()).filter(Boolean);if(W!==null&&typeof W==="object")H.forEach((U)=>{let X=U.indexOf(":"),Y=(X===-1?U:U.slice(0,X)).trim(),re=X===-1?Y:U.slice(X+1).trim();if(Y&&re)j[re]=W[Y]});else j[O]=W}else j[O]=W;if(V)if(!Z&&T&&Array.isArray(W)&&W.length===2)j[V]=W[0],j[O]=W[1];else j[V]=E;let v=ce(B,j);v=yield*ne(v,j,i,e,!0),v=ge(v,j,i),v=le(v,j);let J=v.indexOf(Q),G=v.indexOf(ee),q=J<0?G:G<0?J:Math.min(J,G);if(q>=0)v=v.slice(0,q);if(v=P(v,j,i),v=ye(v,j),v=be(v,j),v=xe(v,j),z+=v,q>=0&&q===J)break}a=a.substring(0,g)+z+a.substring(w)}catch(I){let A=u("Foreach",`Error in @foreach(${k.trim()} as ${S.trim()}): ${I instanceof Error?I.message:String(I)}`,n.EVALUATION_ERROR);a=a.substring(0,g)+A+a.substring(w)}}return a}s=yield*x(s,r),s=we(s,r,i,e);let f=e?.loops?.maxWhileIterations??he;return s=Se(s,r,f),o?s:Is(s)}function hg(t){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(t);if(!r||/^(?:const|let|var)$/.test(r[2]))return t;return`${r[1]}let ${t.slice(r[1].length)}`}function pe(t){return yo(t)}function we(t,r,i,e){let o=t,s=!0;while(s){s=!1;let l=o.match(/@for\s*\(/);if(!l||l.index===void 0)break;let b=l.index,x=b+l[0].length-1,f=_(o,"(",")",x);if(f===-1)break;let c=hg(o.slice(x+1,f)),h=f+1,a=js(o.slice(b),"for","endfor");if(a.length===0)break;let y=a[0].content,g=b+a[0].end;if(!pe(c)){let w=u("For",`Unsafe expression in @for: ${c}`,n.UNSAFE_EXPRESSION);o=o.substring(0,b)+w+o.substring(g),s=!0;continue}try{let w=Oe(c),k=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(w.length>0&&k){let K=ke({forExpr:c,content:y,iterVarNames:w,context:r,filePath:i,options:e});o=o.substring(0,b)+K+o.substring(g),s=!0;continue}let S=Object.keys(r),B=Object.values(r),I=ue(y),T=Function(...S,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${c}) {
|
|
5
5
|
result += \`${I}\`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ql,Kl}from"./chunk-4b110x6r.js";import{J,Nr,Zs,Qs,Ii,Ni,eo,Ne,Xe,ke,se,Lr,jr,he,oe,F,mt,Br,io,Hr,Qe,s,g,Y,Mn}from"./chunk-ggez55jb.js";import{m,M,Ee,p}from"./chunk-c08jvjqt.js";import{r}from"./chunk-cf4apy9s.js";import{ge}from"./chunk-9bexzgws.js";import{Sr}from"./chunk-1hx6dyy9.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-ahf9j8wb.js";import{createHash as At}from"crypto";import K from"fs";import G from"path";import ze from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=ze.readSync(e,o,0,n,i);return o.subarray(0,a)}function Ue(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Fe(e){let i;try{i=ze.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(Ue(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)ze.closeSync(i)}}import sn from"fs";import We from"os";import{fileURLToPath as bt}from"url";var Ie=Symbol("stx.image-worker.unavailable");function on(e=typeof We.availableParallelism==="function"?We.availableParallelism():We.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,vt=[];async function an(){if(Pe<on()){Pe++;return}await new Promise((e)=>vt.push(e)),Pe++}function cn(){Pe--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return Sr(ln,e)}var xt=!1;function ue(e){if(!xt)xt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ie}function _e(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${_e(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${_e(h)}`));return}let u=!1,f=!1,v=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){v(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;v(()=>c(d))}),l.on("error",(h)=>{v(()=>u?c(h instanceof Error?h:Error(_e(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${_e(h)}`)))}),l.on("exit",(h)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Oe;function hn(e,i){let n=G.dirname(Bun.resolveSync(e,i));while(n!==G.dirname(n)){let o=G.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=G.dirname(n)}return}function wt(){if(Oe!==void 0)return Oe;let e;try{e=G.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Oe=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Oe}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(G.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=G.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=G.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=G.join(e,o);await K.promises.mkdir(G.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function _t(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=G.join(i,a.name);if(a.isDirectory()){o.push(...await _t(e,c));continue}if(!a.isFile()||!fn.has(G.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:G.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Fe(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,h)=>v.width-h.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(vn(v.data))n.add(l)}catch{n.add(l)}}));return n}function $n(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!Ue(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return n}async function Sn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return G.join(e,"undecodable.json")}function Cn(e){try{let i=K.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{K.mkdirSync(G.dirname(qe(e)),{recursive:!0}),K.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ai(e){let i=Pt(e);return i?we().catalog.get(i):void 0}function ci(e){let i=Pt(e);return i?we().transparent.has(i):!1}function li(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function py(e){let i=ai(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:li(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ci(e)?void 0:i.placeholder?.dataUrl}}function As(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function fy(e,i,n={}){if(!e||!K.existsSync(e))return As(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ie)return An(y.state),y.result}let o=await _t(e);if(o.length===0)return As(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((y)=>{let S=a[y.relativePath];if(!S)return!0;let R=kt(y.absolutePath);return!R||R.mtimeMs!==S.mtimeMs||R.size!==S.size});if(c.length===0)return As(),{count:0,fingerprint:""};let l=Ct(G.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:G.join(i,"_stx","images"),storage:Ct(G.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(y){if(v=await Sn(c),v.length===c.length)throw y;let S=new Set(v.map((I)=>I.relativePath)),R=!1;for(let I of c){if(S.has(I.relativePath))continue;let k=kt(I.absolutePath);if(!k)continue;a[I.relativePath]=k,R=!0}if(R)Rn(i,a);if(v.length===0)return As(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(v,l)})}let d=await wn(h.entries),C=$n(h.entries,d),x=we();x.catalog=new Map(Object.entries(h.entries)),x.transparent=d;let b=d.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class It{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ii(e,o);if(a!==void 0)return a;for(let c of Ni(e,i,n,o))if(await s(c))return c;return null}}var fe=new It;var ne="\x00stx-boolean-attribute";function Ze(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var _n=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 Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||_n.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${Mn(c,Ze(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${Mn(c,Ze(String(a)))}"`)}return n}function Pn(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 Ge={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=Pn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Lr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,h)),f.push(...ie(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ke(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Je=[320,640,768,1024,1280,1536,1920];function X(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Be(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Ye(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function et(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function Nn(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(n)c.set("h",String(n));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function On(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Bn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var tt={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=X(e,"src")||"",a=ai(o),c=X(e,"alt")||"",l=X(e,"width")||(a?String(a.source.width):void 0),u=X(e,"height")||(a?String(a.source.height):void 0),f=X(e,"sizes"),v=X(e,"srcset"),h=X(e,"densities"),d=X(e,"format"),C=ci(o)||Ke(o)?.transparent===!0,x=X(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=X(e,"placeholderColor")||"#e5e7eb",y=X(e,"provider"),S=X(e,"class")||X(e,"className")||"",R=X(e,"style")||"",I=X(e,"objectFit")||X(e,"fit"),k=X(e,"objectPosition")||X(e,"position"),E=X(e,"quality"),z=Be(e,"lazy",!0),W=Be(e,"preload",!1),B=Be(e,"priority",!1),O=X(e,"loading"),L=X(e,"decoding")||"async",U=!!a||Be(e,"picture",!1)||!!d,_=l?Number.parseInt(l):void 0,A=u?Number.parseInt(u):void 0,T=v||"",H="";if(a)T=a.sources[a.fallback.format]||"",H=f?Ye(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=et(o,Je,y,d),H=Ye(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=Nn(o,V,_,y,d)}else if(f)H=Ye(f);let D=[];if(R)D.push(R);if(I)D.push(`object-fit:${I}`);if(k)D.push(`object-position:${k}`);if(_&&A)D.push(`aspect-ratio:${_}/${A}`);let te=[],ae=x==="blur"||x==="color"||x==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ke(o);if(V&&x==="color")D.push(`background-color:${V.color}`),te.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=Bn(_||16,A||9,b);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&x&&x!=="empty"&&x!=="none")D.push(`background-image:url(${r(x)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,_,A,y,d),Z=[];if(Z.push(`src="${r(Lr(j,"fetched"))}"`),Z.push(`alt="${r(c)}"`),l)Z.push(`width="${r(l)}"`);if(u)Z.push(`height="${r(u)}"`);let Ce=O||(B||W?"eager":z?"lazy":"");if(Ce)Z.push(`loading="${r(Ce)}"`);if(B)Z.push('fetchpriority="high"');if(Z.push(`decoding="${r(L)}"`),S)Z.push(`class="${r(S)}"`);if(D.length>0)Z.push(`style="${r(D.join(";"))}"`);if(T)Z.push(`srcset="${r(Lr(T,"fetched"))}"`);if(H)Z.push(`sizes="${r(H)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(te.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=On(te)+(V?`;${V}`:"");Z.push(`onload="${r(P)}"`),xe.add("onload")}Z.push(...re(e,xe)),Z.push(...ie(e,xe));let le=`<img ${Z.join(" ")} />`,Q="";if(W){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${H?` imagesizes="${r(H)}"`:""} />
|
|
2
|
+
import{ql,Kl}from"./chunk-4b110x6r.js";import{J,Nr,Zs,Qs,Ii,Ni,eo,Ne,Xe,ke,se,Lr,jr,he,oe,F,mt,Br,io,Hr,Qe,s,g,Y,Mn}from"./chunk-etn044yn.js";import{m,M,Ee,p}from"./chunk-c08jvjqt.js";import{r}from"./chunk-a774ncg3.js";import{ge}from"./chunk-9bexzgws.js";import{Sr}from"./chunk-1hx6dyy9.js";import{w}from"./chunk-v6gkjg5f.js";import{t}from"./chunk-zjrnz9yt.js";import{createHash as At}from"crypto";import K from"fs";import G from"path";import ze from"fs";function Ae(e,i,n){let o=Buffer.alloc(n),a=ze.readSync(e,o,0,n,i);return o.subarray(0,a)}function Ue(e){if(e.length<25)return!1;let i=(o,a)=>String.fromCharCode(...e.subarray(o,a));if(i(0,4)!=="RIFF"||i(8,12)!=="WEBP")return!1;let n=i(12,16);if(n==="VP8X")return(e[20]&16)!==0;if(n==="VP8L")return((e[21]|e[22]<<8|e[23]<<16|e[24]<<24)>>>28&1)===1;return!1}function Fe(e){let i;try{i=ze.openSync(e,"r");let n=Ae(i,0,33);if(n.length>=3&&n[0]===255&&n[1]===216&&n[2]===255)return"none";if(n.length>=26&&n[0]===137&&n.toString("latin1",1,4)==="PNG"){let o=n[25];if(o===4||o===6)return"possible";let a=8;for(let c=0;c<64;c++){let l=Ae(i,a,8);if(l.length<8)return"unknown";let u=l.toString("latin1",4,8);if(u==="tRNS")return"possible";if(u==="IDAT"||u==="IEND")return"none";a+=12+l.readUInt32BE(0)}return"unknown"}if(n.length>=25&&n.toString("latin1",0,4)==="RIFF"&&n.toString("latin1",8,12)==="WEBP"){if(Ue(n))return"possible";let o=n.toString("latin1",12,16);return o==="VP8 "||o==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if(i!==void 0)ze.closeSync(i)}}import sn from"fs";import We from"os";import{fileURLToPath as bt}from"url";var Ie=Symbol("stx.image-worker.unavailable");function on(e=typeof We.availableParallelism==="function"?We.availableParallelism():We.cpus().length){return Math.max(1,Math.min(2,e-1))}var Pe=0,vt=[];async function an(){if(Pe<on()){Pe++;return}await new Promise((e)=>vt.push(e)),Pe++}function cn(){Pe--,vt.shift()?.()}var ln="@stacksjs/stx/builtins/image-warmup-worker";function un(e=process.cwd()){let i=import.meta.url.endsWith(".ts")?"ts":"js";try{let n=new URL(`./image-warmup-worker.${i}`,import.meta.url);if(n.protocol==="file:"&&sn.existsSync(bt(n)))return bt(n)}catch{}return Sr(ln,e)}var xt=!1;function ue(e){if(!xt)xt=!0,console.warn(`[stx] image worker unavailable (${e}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return Ie}function _e(e){return e instanceof Error?e.message:String(e)}async function He(e,i){let n;try{n=(await import("worker_threads")).Worker}catch(a){return ue(`could not load node:worker_threads: ${_e(a)}`)}if(typeof n!=="function")return ue("node:worker_threads has no Worker in this runtime");let o=un();if(!o)return ue("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await an();try{return await new Promise((a,c)=>{let l;try{l=new n(o)}catch(h){a(ue(`could not start ${o}: ${_e(h)}`));return}let u=!1,f=!1,v=(h)=>{if(f)return;f=!0,h(),l.terminate()};l.on("message",(h)=>{if(h.type==="ready"){u=!0,l.postMessage({task:e,args:i});return}if(h.type==="result"){v(()=>a(h.value));return}let d=Error(h.error?.message??"image worker failed");if(h.error?.name)d.name=h.error.name;if(h.error?.stack)d.stack=h.error.stack;v(()=>c(d))}),l.on("error",(h)=>{v(()=>u?c(h instanceof Error?h:Error(_e(h)||"image worker crashed")):a(ue(`the worker failed before it was ready: ${_e(h)}`)))}),l.on("exit",(h)=>{v(()=>u?c(Error("image worker exited before it finished")):a(ue(`the worker exited with code ${h} before it was ready`)))})})}finally{cn()}}var fn=new Set([".avif",".jpeg",".jpg",".png",".webp"]),dn=[320,640,960,1280,1920],ve="/_stx/images",gn=`stx:${ve}:alpha-1`,pn=`stx:${ve}:opaque-1`,mn=["@stacksjs/ts-webp","@stacksjs/ts-avif","ts-images"],Oe;function hn(e,i){let n=G.dirname(Bun.resolveSync(e,i));while(n!==G.dirname(n)){let o=G.join(n,"package.json");if(K.existsSync(o)){let a=JSON.parse(K.readFileSync(o,"utf8"));if(a.name===e)return a.version}n=G.dirname(n)}return}function wt(){if(Oe!==void 0)return Oe;let e;try{e=G.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return Oe=mn.map((i)=>{let n;try{n=e?hn(i,e):void 0}catch{}return`${i.replace("@stacksjs/","")}@${n??"unknown"}`}).join("+"),Oe}var $t=Symbol.for("stx.image-delivery");function we(){let e=globalThis;return e[$t]??={catalog:new Map,transparent:new Set},e[$t]}var St=new Set;function yn(e){return`/${e.split(G.sep).map(encodeURIComponent).join("/")}`}function bn(e){let i=G.extname(e),n=e.slice(0,-i.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),o=At("sha256").update(e).digest("hex").slice(0,8);return`${n||"image"}-${o}`}function Ct(e,i=`stx:${ve}`){let n=(o)=>`${ve}/${o.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:i,async stat(o){let a=G.join(e,o);try{let c=await K.promises.stat(a);return c.size>0?{bytes:c.size,path:a,url:n(o)}:null}catch{return null}},async write(o,a){let c=G.join(e,o);await K.promises.mkdir(G.dirname(c),{recursive:!0});let l=`${c}.${process.pid}.tmp`;return await K.promises.writeFile(l,a),await K.promises.rename(l,c),{bytes:a.byteLength,path:c,url:n(o)}},url:n}}async function _t(e,i=e){let n=await K.promises.readdir(i,{withFileTypes:!0});n.sort((a,c)=>a.name.localeCompare(c.name));let o=[];for(let a of n){let c=G.join(i,a.name);if(a.isDirectory()){o.push(...await _t(e,c));continue}if(!a.isFile()||!fn.has(G.extname(a.name).toLowerCase()))continue;o.push({absolutePath:c,relativePath:G.relative(e,c)})}return o}function Rt(e,i){return e.map((n)=>({key:yn(n.relativePath),input:n.absolutePath,name:bn(n.relativePath),...xn(n.absolutePath)?{options:{storage:i}}:{}}))}function xn(e){return Fe(e)==="possible"}function vn(e){for(let i=3;i<e.length;i+=4)if(e[i]!==255)return!0;return!1}async function wn(e){let i=Object.entries(e).filter(([,c])=>c.fallback.format==="png"),n=new Set,o=8;if(i.length===0)return n;let{decode:a}=await import("ts-images");for(let c=0;c<i.length;c+=8)await Promise.all(i.slice(c,c+8).map(async([l,u])=>{let f=u.variants.filter((v)=>v.format==="png").sort((v,h)=>v.width-h.width)[0];try{let v=await a(new Uint8Array(await K.promises.readFile(f?.path??u.fallback.path)));if(vn(v.data))n.add(l)}catch{n.add(l)}}));return n}function $n(e,i){let n=[];for(let o of i){let a=e[o],c=a?.variants.filter((u)=>u.format==="webp")??[];if(!a||c.length===0)continue;if(!c.some((u)=>{let f;try{return f=K.openSync(u.path,"r"),!Ue(Ae(f,0,32))}catch{return!0}finally{if(f!==void 0)K.closeSync(f)}}))continue;if(a.variants=a.variants.filter((u)=>u.format!=="webp"),delete a.sources.webp,n.push(o),!St.has(o))St.add(o),console.warn(`[stx-images] ${o} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return n}async function Sn(e){let i=[],n=8;if(e.length===0)return i;let{generateThumbHash:o}=await import("ts-images");for(let a=0;a<e.length;a+=8){let c=e.slice(a,a+8),l=await Promise.all(c.map(async(u)=>{try{return await o(u.absolutePath),u}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${u.relativePath}`),null}}));i.push(...l.filter((u)=>u!==null))}return i}function qe(e){return G.join(e,"undecodable.json")}function Cn(e){try{let i=K.readFileSync(qe(e),"utf-8"),n=JSON.parse(i);return n&&typeof n==="object"?n:{}}catch{return{}}}function Rn(e,i){try{K.mkdirSync(G.dirname(qe(e)),{recursive:!0}),K.writeFileSync(qe(e),JSON.stringify(i))}catch{}}function kt(e){try{let i=K.statSync(e);return{mtimeMs:i.mtimeMs,size:i.size}}catch{return}}function Pt(e){if(!e||e.startsWith("data:")||e.startsWith("blob:")||/^https?:\/\//i.test(e)||e.startsWith("//"))return;let i=e.split(/[?#]/,1)[0];if(!i)return;try{return`/${i.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function ai(e){let i=Pt(e);return i?we().catalog.get(i):void 0}function ci(e){let i=Pt(e);return i?we().transparent.has(i):!1}function li(e){let i=(o)=>e.variants.filter((a)=>a.format===o).reduce((a,c)=>a+c.bytes,0),n=i(e.fallback.format);return["avif","webp"].map((o)=>({format:o,srcset:e.sources[o]||"",bytes:i(o)})).filter((o)=>o.srcset&&o.bytes>0&&o.bytes<n).sort((o,a)=>o.bytes-a.bytes).map(({format:o,srcset:a})=>({format:o,srcset:a}))}function py(e){let i=ai(e);if(!i)return;return{src:i.fallback.url,srcset:i.sources[i.fallback.format]||"",sources:li(i).map(({format:n,srcset:o})=>({type:`image/${n}`,srcset:o})),width:i.source.width,height:i.source.height,placeholder:ci(e)?void 0:i.placeholder?.dataUrl}}function As(){let e=we();e.catalog=new Map,e.transparent=new Set}function An(e){let i=we();i.catalog=new Map(e.entries),i.transparent=new Set(e.transparent)}async function fy(e,i,n={}){if(!e||!K.existsSync(e))return As(),{count:0,fingerprint:""};if(n.offThread){let y=await He("delivery",{publicDir:e,outputDir:i});if(y!==Ie)return An(y.state),y.result}let o=await _t(e);if(o.length===0)return As(),{count:0,fingerprint:""};let a=Cn(i),c=o.filter((y)=>{let S=a[y.relativePath];if(!S)return!0;let R=kt(y.absolutePath);return!R||R.mtimeMs!==S.mtimeMs||R.size!==S.size});if(c.length===0)return As(),{count:0,fingerprint:""};let l=Ct(G.join(i,"_stx","images"),`${gn}:${wt()}`),u={outDir:G.join(i,"_stx","images"),storage:Ct(G.join(i,"_stx","images"),`${pn}:${wt()}`),baseUrl:ve,widths:dn,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},{createImageDeliveryCatalog:f}=await import("ts-images/delivery"),v=c,h;try{h=await f({...u,entries:Rt(c,l)})}catch(y){if(v=await Sn(c),v.length===c.length)throw y;let S=new Set(v.map((I)=>I.relativePath)),R=!1;for(let I of c){if(S.has(I.relativePath))continue;let k=kt(I.absolutePath);if(!k)continue;a[I.relativePath]=k,R=!0}if(R)Rn(i,a);if(v.length===0)return As(),{count:0,fingerprint:""};h=await f({...u,entries:Rt(v,l)})}let d=await wn(h.entries),C=$n(h.entries,d),x=we();x.catalog=new Map(Object.entries(h.entries)),x.transparent=d;let b=d.size===0&&C.length===0?h.fingerprint:At("sha256").update(h.fingerprint).update(JSON.stringify({transparent:[...d].sort(),droppedWebp:C.sort()})).digest("hex");return{count:v.length,fingerprint:b}}class It{builtins=new Map;registerBuiltin(e){this.builtins.set(e.name.toLowerCase(),e);for(let i of e.aliases)this.builtins.set(i.toLowerCase(),e)}isBuiltin(e){return this.builtins.has(e.toLowerCase())}getBuiltin(e){return this.builtins.get(e.toLowerCase())??null}async resolveFile(e,i,n,o){let a=Ii(e,o);if(a!==void 0)return a;for(let c of Ni(e,i,n,o))if(await s(c))return c;return null}}var fe=new It;var ne="\x00stx-boolean-attribute";function Ze(e){return e.indexOf("\x00")===-1?e:e.replace(/\0/g,"")}var _n=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 Ve(e){let i=e.toLowerCase();return i.startsWith("aria-")||i.startsWith("data-")||_n.has(i)}function re(e,i){let n=[];for(let[o,a]of Object.entries(e.static)){if(i.has(o))continue;let c=e.staticNames?.[o]??o;if(typeof a==="boolean"){if(a)n.push(g(c));continue}if(a===ne){n.push(g(c));continue}n.push(`${g(c)}="${Mn(c,Ze(String(a)))}"`)}return n}function ie(e,i){let n=[];for(let[o,a]of Object.entries(e.serverDynamic??{})){if(i.has(o))continue;if(a===null||a===void 0||a===!1)continue;let c=e.serverDynamicNames?.[o]??o;if(a===!0){n.push(g(c));continue}if(typeof a==="object")continue;n.push(`${g(c)}="${Mn(c,Ze(String(a)))}"`)}return n}function Pn(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 Ge={name:"StxLink",aliases:["stx-link"],render(e,i,n){let o=Pn(e),a=(typeof e.static.class==="string"?e.static.class:"")||(typeof e.static.className==="string"?e.static.className:""),c=typeof e.static.activeClass==="string"?e.static.activeClass:"active",l=typeof e.static.exactActiveClass==="string"?e.static.exactActiveClass:"exact-active",u=e.static.prefetch===!0||e.static.prefetch==="true"||e.serverDynamic.prefetch===!0,f=[];if(o.reactive)f.push(`:href="${r(o.value)}"`);else f.push(`href="${r(Lr(o.value,"navigable"))}"`);if(a)f.push(`class="${r(a)}"`);if(f.push("data-stx-link"),f.push(`data-stx-active-class="${r(c)}"`),f.push(`data-stx-exact-active-class="${r(l)}"`),u)f.push("data-stx-prefetch");let v=typeof e.static.activeMatch==="string"?e.static.activeMatch.trim():"";if(v)f.push(`data-stx-active-match="${r(v)}"`);let h=new Set(["to","class","className","activeClass","exactActiveClass","activeMatch","prefetch"]);return f.push(...re(e,h)),f.push(...ie(e,h)),`<a ${f.join(" ")}>${i}</a>`}};var In=new Map;function Ke(e){if(!e)return;let i=e.split("?")[0].split("#")[0];return In.get(i)}var En={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Je=[320,640,768,1024,1280,1536,1920];function X(e,i){if(e.serverDynamic[i]!==void 0)return String(e.serverDynamic[i]);let n=e.static[i];if(typeof n==="string")return n;return}function Be(e,i,n=!1){let o=e.serverDynamic[i];if(o!==void 0)return o!==!1&&o!=="false";let a=e.static[i];if(a!==void 0)return a!=="false"&&a!==!1;return n}function Ye(e){if(e.includes("(")||e.includes(","))return e;let i=e.trim().split(/\s+/),n=[];for(let o of i)if(o.includes(":")){let[a,c]=o.split(":"),l=En[a];if(l)n.push(`(max-width: ${l}px) ${c}`);else{let u=Number.parseInt(a);if(!Number.isNaN(u))n.push(`(max-width: ${u}px) ${c}`)}}else n.push(o);return n.join(", ")}function et(e,i,n,o){return i.map((a)=>`${$e(e,a,void 0,n,o)} ${a}w`).join(", ")}function Nn(e,i,n,o,a){return i.map((c)=>{let l=n?n*c:void 0;return`${$e(e,l,void 0,o,a)} ${c}x`}).join(", ")}function $e(e,i,n,o,a){if(!o||o==="local"||o==="static")return e;if(o==="cloudinary"){let c=[];if(i)c.push(`w_${i}`);if(n)c.push(`h_${n}`);if(a)c.push(`f_${a}`);c.push("q_auto");let l=c.join(",");return e.replace("/upload/",`/upload/${l}/`)}if(o==="imgix"){let c=new URLSearchParams;if(i)c.set("w",String(i));if(n)c.set("h",String(n));if(a)c.set("fm",a);c.set("auto","format");let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}if(o==="bunny"){let c=new URLSearchParams;if(i)c.set("width",String(i));if(n)c.set("height",String(n));if(a)c.set("format",a);let l=e.includes("?")?"&":"?";return`${e}${l}${c.toString()}`}return e}function On(e){return`var s=this.style;${e.map((i)=>`s.${i}=''`).join(";")}`}function Bn(e,i,n="#e5e7eb"){let o=`<svg xmlns="http://www.w3.org/2000/svg" width="${e}" height="${i}"><rect width="100%" height="100%" fill="${n}"/></svg>`;return`data:image/svg+xml;base64,${btoa(o)}`}var tt={name:"StxImage",aliases:["Image","stx-image","stx-img"],render(e,i,n){let o=X(e,"src")||"",a=ai(o),c=X(e,"alt")||"",l=X(e,"width")||(a?String(a.source.width):void 0),u=X(e,"height")||(a?String(a.source.height):void 0),f=X(e,"sizes"),v=X(e,"srcset"),h=X(e,"densities"),d=X(e,"format"),C=ci(o)||Ke(o)?.transparent===!0,x=X(e,"placeholder")||(a&&!C?"thumbhash":void 0),b=X(e,"placeholderColor")||"#e5e7eb",y=X(e,"provider"),S=X(e,"class")||X(e,"className")||"",R=X(e,"style")||"",I=X(e,"objectFit")||X(e,"fit"),k=X(e,"objectPosition")||X(e,"position"),E=X(e,"quality"),z=Be(e,"lazy",!0),W=Be(e,"preload",!1),B=Be(e,"priority",!1),O=X(e,"loading"),L=X(e,"decoding")||"async",U=!!a||Be(e,"picture",!1)||!!d,_=l?Number.parseInt(l):void 0,A=u?Number.parseInt(u):void 0,T=v||"",H="";if(a)T=a.sources[a.fallback.format]||"",H=f?Ye(f):"100vw";else if(!T&&f&&y&&y!=="local"&&y!=="static")T=et(o,Je,y,d),H=Ye(f);else if(!T&&h){let V=h.split(/\s+/).map((P)=>Number.parseFloat(P.replace("x","")));T=Nn(o,V,_,y,d)}else if(f)H=Ye(f);let D=[];if(R)D.push(R);if(I)D.push(`object-fit:${I}`);if(k)D.push(`object-position:${k}`);if(_&&A)D.push(`aspect-ratio:${_}/${A}`);let te=[],ae=x==="blur"||x==="color"||x==="thumbhash";if(ae&&!C){let V=a?.placeholder?{dataUrl:a.placeholder.dataUrl,color:b}:Ke(o);if(V&&x==="color")D.push(`background-color:${V.color}`),te.push("backgroundColor");else if(V)D.push(`background-color:${V.color}`),D.push(`background-image:url(${V.dataUrl})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundColor","backgroundImage");else{let P=Bn(_||16,A||9,b);D.push(`background-image:url(${P})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage")}}else if(!ae&&x&&x!=="empty"&&x!=="none")D.push(`background-image:url(${r(x)})`),D.push("background-size:cover"),D.push("background-repeat:no-repeat"),te.push("backgroundImage");let j=a?.fallback.url||$e(o,_,A,y,d),Z=[];if(Z.push(`src="${r(Lr(j,"fetched"))}"`),Z.push(`alt="${r(c)}"`),l)Z.push(`width="${r(l)}"`);if(u)Z.push(`height="${r(u)}"`);let Ce=O||(B||W?"eager":z?"lazy":"");if(Ce)Z.push(`loading="${r(Ce)}"`);if(B)Z.push('fetchpriority="high"');if(Z.push(`decoding="${r(L)}"`),S)Z.push(`class="${r(S)}"`);if(D.length>0)Z.push(`style="${r(D.join(";"))}"`);if(T)Z.push(`srcset="${r(Lr(T,"fetched"))}"`);if(H)Z.push(`sizes="${r(H)}"`);let xe=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","objectFit","objectPosition","fit","position","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);if(te.length>0){let V=typeof e.static.onload==="string"?e.static.onload:"",P=On(te)+(V?`;${V}`:"");Z.push(`onload="${r(P)}"`),xe.add("onload")}Z.push(...re(e,xe)),Z.push(...ie(e,xe));let le=`<img ${Z.join(" ")} />`,Q="";if(W){let P=d==="webp"?"image/webp":d==="avif"?"image/avif":"";Q=`<link rel="preload" as="image" href="${r(j)}"${P?` type="${P}"`:""}${T?` imagesrcset="${r(T)}"`:""}${H?` imagesizes="${r(H)}"`:""} />
|
|
3
3
|
`}if(U){let V=[];if(a)for(let P of li(a))V.push(`<source type="image/${P.format}" srcset="${r(P.srcset)}"${H?` sizes="${r(H)}"`:""} />`);if(!a&&(d==="avif"||d==="auto")){let P=$e(o,_,A,y,"avif"),N=T?et(o,Je,y,"avif"):`${P}`;V.push(`<source type="image/avif" srcset="${r(N)}"${H?` sizes="${r(H)}"`:""} />`)}if(!a&&(d==="webp"||d==="auto")){let P=$e(o,_,A,y,"webp"),N=T?et(o,Je,y,"webp"):`${P}`;V.push(`<source type="image/webp" srcset="${r(N)}"${H?` sizes="${r(H)}"`:""} />`)}return`${Q}<picture>
|
|
4
4
|
${V.join(`
|
|
5
5
|
`)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Uo,Vh,Wh}from"./chunk-pzf34jvd.js";import"./chunk-px6zx8ae.js";import"./chunk-gqz6502d.js";import"./chunk-cwcmmgvz.js";import"./chunk-6vyy44ve.js";import"./chunk-hcxsyw55.js";import"./chunk-v0yay1kw.js";import"./chunk-2vdbt2a7.js";import"./chunk-ja4fyz87.js";import"./chunk-v37hjzt2.js";import"./chunk-razwegar.js";import"./chunk-mpfm5ctr.js";import"./chunk-eca022er.js";import"./chunk-9gptdyqq.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Wh as clearComposableCache,Vh as getComposableScript,Uo as listComposableModules};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t}from"./chunk-
|
|
2
|
+
import{t}from"./chunk-zjrnz9yt.js";function y(e,i,s=240){return e.slice(i,i+s)}var v=[{rule:"route-params",pattern:/\blocation\s*\.\s*pathname\s*\.\s*(?:match|split)\s*\(/g,primitive:"useRoute() / useRouteParams() / useRouteParam(name)",why:"parsing the URL by hand re-implements the router and does not update on SPA navigation"},{rule:"alert",pattern:/(?<![.#\w$])(?:(?:window|globalThis)\s*\.\s*)?alert\s*\(/g,primitive:"stxAlert(message)",why:"themed, focus-trapped and non-blocking \u2014 but `await` it if the code after it "+"depended on the native dialog blocking until dismissal",reject:(e)=>/\b(?:async\s+)?function\s+alert\s*\(/.test(e)||/\b(?:const|let|var)\s+alert\s*=/.test(e)},{rule:"search-params",pattern:/new\s+URLSearchParams\s*\(/g,primitive:"useSearchParams()",why:"reactive, and writes back through the router instead of history.replaceState",reject:(e,i)=>{let s=e.indexOf("(",i);if(s===-1)return!0;let o=e.slice(s+1,e.indexOf(")",s)+1);return!/\b(?:location|search|href|url)\b/i.test(o)}},{rule:"navigate",pattern:/\blocation\s*\.\s*(?:assign|replace)\s*\(|\blocation\s*\.\s*href\s*=/g,primitive:"navigate(path) / goBack()",why:"a full document load throws away every store and the scroll position; navigate() is an SPA transition",reject:(e,i)=>/^[^\n]*?(?:['"`]\s*)?(?:mailto:|tel:|sms:|https?:\/\/|\/\/)/.test(y(e,i,160))},{rule:"fetch",pattern:/new\s+AbortController\s*\(/g,primitive:"useFetch(url) / useAsyncData(key, fn)",why:"cancellation, loading and error state are already wired; hand-rolling them is where the races live"},{rule:"polling",pattern:/setInterval\s*\(/g,primitive:"useEventSource() / useSSE() / useWebSocket() / useChannel()",why:"polling burns requests and lags; the push primitives are delivered",reject:(e,i)=>!/\bfetch\s*\(|\$fetch\b|useFetch\b|\.get\s*\(|axios\b/.test(y(e,i))},{rule:"debounce",pattern:/\bclearTimeout\s*\(/g,primitive:"useDebounce(fn, ms) / useThrottle(fn, ms)",why:"a hand-held timer handle per call site is the usual source of stale-result bugs",requires:(e)=>/setTimeout\s*\(/.test(e)},{rule:"click-outside",pattern:/document\s*\.\s*addEventListener\s*\(\s*['"](?:click|mousedown|pointerdown)['"]/g,primitive:"useClickOutside(ref, fn)",why:"the document-level listener plus the blur race is exactly what this composable exists to remove"},{rule:"focus",pattern:/\.\s*(?:getElementById|querySelector)\s*\([^)]*\)\s*(?:\?\.)?\s*\.?focus\s*\(/g,primitive:"useFocus(ref) with x-ref",why:"a query by id breaks under nested scopes and SPA navigation; a ref does not"},{rule:"clipboard",pattern:/navigator\s*\.\s*(?:clipboard|share)\b/g,primitive:"useClipboard() / useShare()",why:"permission state, the copied flag and the unsupported-browser fallback are already handled"},{rule:"watch",pattern:/\beffect\s*\(\s*\(\s*\)\s*=>\s*\{[^}]*\bvoid\s+\w+\s*\(\s*\)/g,primitive:"watch(source, cb) / watchMultiple([...], cb)",why:"the `void a(); void b()` dance is a manual dependency list; watch takes one directly"}],C=["confirm","tooltip",...v.map((e)=>e.rule)];function g(e,i){let s=1;for(let o=0;o<i;o++)if(e[o]===`
|
|
3
3
|
`)s++;return s}function b(e,i){let s=e.lastIndexOf(`
|
|
4
4
|
`,i)+1,o=e.indexOf(`
|
|
5
5
|
`,i);return e.slice(s,o===-1?e.length:o).trim().slice(0,120)}function S(e,i){let s=e.slice(0,i),o=s.lastIndexOf("function"),l=s.lastIndexOf("=>"),r=Math.max(o,l);if(r===-1)return!1;let n=e.slice(Math.max(0,r-120),r);return/\basync\b[^;{}]*$/.test(n)}function k(e){return/\b(?:async\s+)?function\s+confirm\s*\(/.test(e)||/\b(?:const|let|var)\s+confirm\s*=/.test(e)||/\bimport\s*\{[^}]*\bconfirm\b[^}]*\}/.test(e)}function A(e,i,s){if(k(e))return e;let o=/(^|[^\w$.])(?:(?:window|globalThis)\s*\.\s*)?confirm\s*\(/g,l=m(e),r="",n=0,a;while((a=o.exec(l))!==null){let c=a.index+a[1].length,u=g(e,c),d=b(e,c);if(/stxConfirm\s*\($/.test(e.slice(0,c+8)))continue;let p=S(e,c);if(s.push({file:i,line:u,rule:"confirm",applied:p,snippet:d,reason:p?void 0:"stxConfirm() returns a Promise and native confirm() is synchronous, so this needs `await` inside an async function. Rewriting it here would make the condition always true."}),p)r+=e.slice(n,c)+"await stxConfirm(",n=c+(a[0].length-a[1].length)}return r+e.slice(n)}function E(e,i,s){let o=/(<[a-z][\w-]*\b[^>]*?)\stitle=(["'])(.*?)\2/gis,l=R(e),r="",n=0,a;while((a=o.exec(l))!==null){let[c,u,d,p]=a,h=g(e,a.index),f=b(e,a.index),w=u.match(/^<([A-Za-z][\w-]*)/)?.[1]??"";if(/^[A-Z]/.test(w)){s.push({file:i,line:h,rule:"tooltip",applied:!1,snippet:f,reason:`\`title\` on <${w}> is a component prop, not an HTML attribute \u2014 `+"adding x-tooltip here would put a tooltip on a component and may duplicate text it already renders."});continue}if(/\bx-tooltip[=\s]/.test(u)||p.trim()===""){s.push({file:i,line:h,rule:"tooltip",applied:!1,snippet:f,reason:/\bx-tooltip[=\s]/.test(u)?"already has x-tooltip":"empty title"});continue}s.push({file:i,line:h,rule:"tooltip",applied:!0,snippet:f}),r+=e.slice(n,a.index)+`${u} x-tooltip=${d}${p}${d} title=${d}${p}${d}`,n=a.index+c.length}return r+e.slice(n)}function R(e){return e.replace(/<!--[\s\S]*?-->/g,(i)=>i.replace(/[^\n]/g," ")).replace(/\{\{--[\s\S]*?--\}\}/g,(i)=>i.replace(/[^\n]/g," "))}function F(e){let i=(s)=>s.replace(/[^\n]/g," ");return e.replace(/\/\*[\s\S]*?\*\//g,i).replace(/\/\/[^\n]*/g,i)}function m(e,i=!1){let s=R(e);return(i?F(s):t(s)).replace(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi,(l,r)=>/\bclient\b/i.test(r)?l:l.replace(/[^\n]/g," "))}function O(e,i,s,o){let l=m(e),r=m(e,!0);for(let n of v){if(!s.includes(n.rule))continue;if(n.requires&&!n.requires(e))continue;n.pattern.lastIndex=0;let a,c=/['"]/.test(n.pattern.source)?r:l;n.pattern.lastIndex=0;while((a=n.pattern.exec(c))!==null){if(n.reject?.(e,a.index))continue;o.push({file:i,line:g(e,a.index),rule:n.rule,applied:!1,snippet:b(e,a.index),reason:`${n.primitive} \u2014 ${n.why}`})}}}function q(e,i={}){let s=i.rules??C,o=i.file??"<source>",l=[];O(e,o,s,l);let r=e;if(s.includes("confirm"))r=A(r,o,l);if(s.includes("tooltip"))r=E(r,o,l);l.sort((c,u)=>c.line-u.line);let n=new Set,a=l.filter((c)=>{let u=`${c.rule}:${c.line}`;if(n.has(u))return!1;return n.add(u),!0});return{code:r,findings:a}}var x=new Set(["confirm","tooltip"]);function I(e,i){if(e.length===0)return"No hand-rolled equivalents found.";let s=e.filter((n)=>n.applied),o=e.filter((n)=>!n.applied&&x.has(n.rule)),l=e.filter((n)=>!n.applied&&!x.has(n.rule)),r=[];if(s.length>0){r.push(i?`Rewrote ${s.length} site(s):`:`Would rewrite ${s.length} site(s) (pass --fix):`);for(let n of s)r.push(` ${n.file}:${n.line} [${n.rule}] ${n.snippet}`)}if(o.length>0){r.push("",`Needs a human \u2014 ${o.length} site(s):`);for(let n of o)r.push(` ${n.file}:${n.line} [${n.rule}] ${n.snippet}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Oe,Vi,Wi,Fg,Gt,_l,zg,Cl,Py,Ge,In,Je}from"./chunk-
|
|
2
|
+
import{Oe,Vi,Wi,Fg,Gt,_l,zg,Cl,Py,Ge,In,Je}from"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import{Hl,t}from"./chunk-zjrnz9yt.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Oe as BROWSER_CORE_IMPORTS,Fg as STX_AUTO_IMPORTS,Vi as extractAndStripCssImports,Ge as extractBridgeData,Hl as findInterpolationEnd,Cl as generateAutoImportDestructuring,Py as generateBrowserAutoImportDestructuring,In as generateServerDataBridge,Gt as injectBrowserCoreAutoImports,Je as processClientScript,zg as referencesName,Wi as renderVendorStyleTags,t as stripCommentsAndLiterals,_l as transformAutoImports};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{P}from"./chunk-
|
|
2
|
+
import{P}from"./chunk-etn044yn.js";import{xe}from"./chunk-kmy34he2.js";function g(e,t){let r={};for(let n of e)r[n]=xe(t(n));return new Proxy({},{get:(n,a)=>r[a]?.(),set:(n,a,o)=>{if(r[a])r[a].set(o);else r[a]=xe(o);return!0},has:(n,a)=>(a in r),deleteProperty:(n,a)=>(delete r[a],!0),ownKeys:()=>Reflect.ownKeys(r),getOwnPropertyDescriptor:(n,a)=>(a in r)?{enumerable:!0,configurable:!0,writable:!0,value:r[a]()}:void 0})}function v(e,t){let r={};for(let n of t)r[n]=e[n];return r}function qa(e,t){let r=Object.keys(e),n=g(r,(i)=>t?.[i]??e[i].getDefaultValue()),a=g(r,()=>[]),o=g(r,()=>!1),c=g(r,()=>!1),f=g(r,()=>!1),s=xe(!1);async function u(i){f[i]=!0;let d=await e[i].validate(n[i],n);return a[i]=d,f[i]=!1,d.length===0}async function l(){s.set(!0);let i=await Promise.all(r.map(u));return s.set(!1),i.every(Boolean)}function m(){for(let i of r)n[i]=t?.[i]??e[i].getDefaultValue(),a[i]=[],o[i]=!1,c[i]=!1}function h(i){for(let d of r)if(d in i)n[d]=i[d],c[d]=!0}function b(i,d){n[i]=d,c[i]=!0}function y(i,d=!0){if(o[i]=d,d)u(i)}function p(i){return{value:n[i],errors:a[i],touched:o[i],dirty:c[i],valid:a[i].length===0,validating:f[i]}}function V(i){return async(d)=>{d?.preventDefault?.();for(let w of r)o[w]=!0;if(await l())await i(v(n,r))}}return{values:n,errors:a,touched:o,dirty:c,get isValid(){return r.every((i)=>a[i].length===0)},get isValidating(){return s()||r.some((i)=>f[i])},get isDirty(){return r.some((i)=>c[i])},validate:l,validateField:u,reset:m,setValues:h,setFieldValue:b,setFieldTouched:y,getFieldState:p,handleSubmit:V}}var Bu=qa;class rr{rules=[];defaultValue="";addRule(e){let t=new rr;return t.rules=[...this.rules,e],t.defaultValue=this.defaultValue,t}required(e="This field is required"){return this.addRule({name:"required",message:e,validate:(t)=>{if(t===null||t===void 0)return e;if(typeof t==="string"&&t.trim()==="")return e;if(Array.isArray(t)&&t.length===0)return e;return!0}})}email(e="Please enter a valid email"){return this.addRule({name:"email",message:e,validate:(t)=>{if(!t)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(t))||e}})}url(e="Please enter a valid URL"){return this.addRule({name:"url",message:e,validate:(t)=>{if(!t)return!0;try{return new URL(String(t)),!0}catch{return e}}})}min(e,t){let r=t||`Must be at least ${e} characters`;return this.addRule({name:"min",message:r,validate:(n)=>{if(!n)return!0;return String(n).length>=e||r}})}max(e,t){let r=t||`Must be no more than ${e} characters`;return this.addRule({name:"max",message:r,validate:(n)=>{if(!n)return!0;return String(n).length<=e||r}})}length(e,t,r){let n=r||`Must be between ${e} and ${t} characters`;return this.addRule({name:"length",message:n,validate:(a)=>{if(!a)return!0;let o=String(a).length;return o>=e&&o<=t||n}})}pattern(e,t="Invalid format"){return this.addRule({name:"pattern",message:t,validate:(r)=>{if(!r)return!0;return e.test(String(r))||t}})}hasUppercase(e="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,e)}hasLowercase(e="Must contain a lowercase letter"){return this.pattern(/[a-z]/,e)}hasNumber(e="Must contain a number"){return this.pattern(/\d/,e)}hasSpecial(e="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,e)}alphanumeric(e="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,e)}startsWithLetter(e="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,e)}noSpaces(e="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:e,validate:(t)=>{if(!t)return!0;return!String(t).includes(" ")||e}})}number(e="Must be a number"){let t=this.addRule({name:"number",message:e,validate:(r)=>{if(!r&&r!==0)return!0;return!Number.isNaN(Number(r))||e}});return t.defaultValue=0,t}integer(e="Must be a whole number"){return this.addRule({name:"integer",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number.isInteger(Number(t))||e}})}positive(e="Must be a positive number"){return this.addRule({name:"positive",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)>0||e}})}negative(e="Must be a negative number"){return this.addRule({name:"negative",message:e,validate:(t)=>{if(!t&&t!==0)return!0;return Number(t)<0||e}})}minValue(e,t){let r=t||`Must be at least ${e}`;return this.addRule({name:"minValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)>=e||r}})}maxValue(e,t){let r=t||`Must be no more than ${e}`;return this.addRule({name:"maxValue",message:r,validate:(n)=>{if(!n&&n!==0)return!0;return Number(n)<=e||r}})}between(e,t,r){let n=r||`Must be between ${e} and ${t}`;return this.addRule({name:"between",message:n,validate:(a)=>{if(!a&&a!==0)return!0;let o=Number(a);return o>=e&&o<=t||n}})}matches(e,t){let r=t||`Must match ${e}`;return this.addRule({name:"matches",message:r,validate:(n,a)=>{if(!a)return!0;return n===a[e]||r}})}oneOf(e,t){let r=t||`Must be one of: ${e.join(", ")}`;return this.addRule({name:"oneOf",message:r,validate:(n)=>{if(!n)return!0;return e.includes(n)||r}})}notOneOf(e,t){let r=t||`Cannot be one of: ${e.join(", ")}`;return this.addRule({name:"notOneOf",message:r,validate:(n)=>{if(!n)return!0;return!e.includes(n)||r}})}date(e="Must be a valid date"){return this.addRule({name:"date",message:e,validate:(t)=>{if(!t)return!0;let r=new Date(String(t));return!Number.isNaN(r.getTime())||e}})}before(e,t){let r=new Date(e),n=t||`Must be before ${r.toLocaleDateString()}`;return this.addRule({name:"before",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))<r||n}})}after(e,t){let r=new Date(e),n=t||`Must be after ${r.toLocaleDateString()}`;return this.addRule({name:"after",message:n,validate:(a)=>{if(!a)return!0;return new Date(String(a))>r||n}})}custom(e,t="Invalid value"){return this.addRule({name:"custom",message:t,validate:e})}async(e,t="Invalid value"){return this.addRule({name:"async",message:t,async:!0,validate:e})}when(e,t){let r=new rr;r.rules=[...this.rules],r.defaultValue=this.defaultValue;for(let n of t.getRules())r.rules.push({...n,validate:(a,o)=>{if(!e(a,o||{}))return!0;return n.validate(a,o)}});return r}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(e){let t=new rr;return t.rules=[...this.rules],t.defaultValue=e,t}async validate(e,t){let r=[];for(let n of this.rules){let a=await n.validate(e,t);if(a!==!0)r.push(a)}return r}validateSync(e,t){let r=[];for(let n of this.rules){if(n.async)continue;let a=n.validate(e,t);if(a!==!0)r.push(a)}return r}}var fh=new rr;function Fu(e,t,r){let n=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
|
|
3
3
|
`)}catch{return""}})}function zu(e,t,r){let n=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return u.map((l)=>P(c,{...t,message:l},r)).join(`
|
|
4
4
|
`)}catch{return""}})}function Hu(e,t,r){let n=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return e.replace(n,(a,o,c)=>{try{let f=o.trim().split("."),s=t;for(let l of f)if(s&&typeof s==="object"&&l in s)s=s[l];else return"";let u=s;if(!u||!Array.isArray(u)||u.length===0)return"";return c}catch{return""}})}function gh(e,t,r){let n=e;return n=Fu(n,t,r),n=zu(n,t,r),n=Hu(n,t,r),n}export{qa,Bu,rr,fh,Fu,zu,Hu,gh};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,p}from"./chunk-c08jvjqt.js";import{oe,F,g}from"./chunk-
|
|
2
|
+
import{m,p}from"./chunk-c08jvjqt.js";import{oe,F,g}from"./chunk-etn044yn.js";function z(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var N=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function k(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function B(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let f=t.indexOf("-->",s+4);n=f===-1?t.length:f+3;continue}let a=k(t,s+1);if(a===-1)return-1;let u=t.slice(s,a),c=u.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(c&&c[2].toLowerCase()===r){if(c[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(u))e++}n=a}return-1}function Z(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[2].toLowerCase();if(u[1]==="/"){let l=i.lastIndexOf(c);if(l!==-1)i.splice(l);e=s;continue}let f=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],h=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),S=f||N.has(c)?-1:B(t,c,s);if(S===-1)o.push({start:n,end:s,slotName:l,element:h}),e=s;else o.push({start:n,end:S,slotName:l,element:h+t.slice(s,S)}),e=S;continue}if(!f&&!N.has(c)){if(i.push(c),c==="script"||c==="style"){let l=t.toLowerCase().indexOf(`</${c}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function L(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=k(t,n+1);if(s===-1)break;let a=t.slice(n,s),u=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!u){e=s;continue}let c=u[1]==="/",f=u[2].toLowerCase();if(c){let l=i.lastIndexOf(f);if(l!==-1)i.splice(l);e=s;continue}if(f==="template"&&i.length===0){let l=a.match(r);if(l){let h=z(t,s);if(h!==-1){let S=l[1]||l[2]||l[3];o.push({start:n,end:h,slotName:S,content:t.slice(s,h-11).trim(),propsBinding:l[4]||void 0}),e=h;continue}}}if(!/\/\s*>$/.test(a)&&!N.has(f)){if(i.push(f),f==="script"||f==="style"){let l=t.toLowerCase().indexOf(`</${f}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function vu(t){let o={default:"",named:new Map},i=t,r=L(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=Z(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function Jm(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function xu(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r},a=new Set,u=new Set;if(n.startsWith("{")&&n.endsWith("}")){let c=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of c){let[d,l]=f.split(":").map((S)=>S.trim()),h=l||d;if(s[h]=o[d],o[d]!==void 0)u.add(h);else a.add(h)}}else if(s[n]=o,Object.values(o).some((c)=>c===void 0))a.add(n);else u.add(n);e=j(e,s,a,u)}return e}function j(t,o,i,r){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(e,n)=>{try{let s=n.trim();if(F(s,i))return e;if(Array.isArray(o.__stx_preserved_client_expressions)&&o.__stx_preserved_client_expressions.includes(s)&&!F(s,r))return e;let a=_(s,o);if(a===void 0)return e;return g(String(a??""))}catch{return`{{ ${n} }}`}})}function _(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!m(t))return;return p(t,Object.keys(o))(...Object.values(o))}catch{return}}async function Su(t,o,i,r){let e=t;e=await I(e,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(a,u,c,f)=>{let d=o.named.get(u),l=f?.trim()||"",h=c||"",S={},E=[],C=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,b;while((b=C.exec(h))!==null){let w=b[1],x=b[2];S[w]=_(x,i),E.push([w,x])}if(r!==void 0&&d?.propsBinding&&Object.values(S).some((w)=>w===void 0)){let w=d.propsBinding.trim(),x=oe(`${w} in []`),y="__stx_slot_props";while(x.includes(y))y+="_";let M=E.map(([A,P])=>{let O=S[A],R;try{R=O===void 0?void 0:JSON.stringify(O)}catch{}return`${JSON.stringify(A)}:(${R??P})`}).join(","),v=g(JSON.stringify({binding:w,names:x,owner:r}));return`<template :for="${g(`${y} in [{${M}}]`)}" data-stx-slot-binding="${encodeURIComponent(w)}" data-stx-slot-scope="${v}">${d.content}</template>`}return await xu(d,S,l,i)});let s=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return e=e.replace(s,(a,u,c)=>{if(/\bname\s*=/.test(u||""))return a;let f=c?.trim()||"";return o.default||f}),e}async function I(t,o,i){let r=[],e=[];t.replace(o,(a,...u)=>{let c=u[u.length-2];return e.push({match:a,index:c}),r.push(i(a,...u.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:u,index:c}=e[a];s=s.slice(0,c)+n[a]+s.slice(c+u.length)}return s}function Ym(t){let o=vu(t);return{defaultSlot:o.default,namedSlots:o.named}}async function Zm(t,o,i,r,e){return await Su(t,{default:o,named:i},r,e)}
|
|
3
3
|
export{vu,Jm,xu,Su,Ym,Zm};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{T}from"./chunk-0jdz31q1.js";import{zl}from"./chunk-
|
|
2
|
+
import{T}from"./chunk-0jdz31q1.js";import{zl}from"./chunk-75r2p1cz.js";var t=new T(256,{maxBytes:16777216,sizeOf:(n)=>n.source.length*2});function Z(n){let r=t.get(n);if(r)return r.asynchronous;let s=o(n);return t.set(n,{source:n,asynchronous:s}),s}function o(n){let r=new Bun.Transpiler({loader:"js"});if(zl(n))return r.transformSync(`(async function(){
|
|
3
3
|
${n}
|
|
4
4
|
})()`),!0;try{return r.transformSync(`(function(){
|
|
5
5
|
${n}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vu,Jm,xu,Su,Ym,Zm}from"./chunk-
|
|
2
|
+
import{vu,Jm,xu,Su,Ym,Zm}from"./chunk-2qypb5q8.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Zm as applySlots,Ym as extractSlotContent,Jm as parseSlotElement,vu as parseSlots,Su as processSlots,xu as renderSlot};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{B,gl,co,Pn,y,Ge,Je}from"./chunk-
|
|
2
|
+
import{B,gl,co,Pn,y,Ge,Je}from"./chunk-etn044yn.js";import{$r,pt,q}from"./chunk-ja4fyz87.js";import{br,i}from"./chunk-6s82ecbh.js";import{Pe}from"./chunk-hcxsyw55.js";import{la}from"./chunk-8tfpv6zf.js";function h(s){return s.endsWith(".md")||s.endsWith(".markdown")}function C(s){let e=[];m(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];m(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function m(n,p){let g;while((g=n.exec(s))!==null){let t=g.index,o=t+g[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 b(s,e={}){let{data:r,content:m}=$r(s),a=await(e.renderer??((n)=>pt(n)))(m);return{html:C(a),frontmatter:r??{}}}import{dirname as k,resolve as R}from"path";function v(s){let e=s,r=B(s);if(r)e=r.content.trim();let m=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),g;while((g=m.exec(s))!==null){let o=g[1],l=g[2],d=g[0],u=o.includes("server");if(p(l))n.push(d);else if(u)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 u=l.index+l[0].length,f=t.indexOf("</script>",u);if(f===-1)continue;d.push({start:l.index,end:f+9}),o.lastIndex=f+9}for(let u=d.length-1;u>=0;u--)t=t.substring(0,d[u].start)+t.substring(d[u].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function M(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -12,5 +12,5 @@ ${s}
|
|
|
12
12
|
</html>`}async function _c(s,e={}){let r=R(s),m=Bun.file(r);if(!await m.exists())throw Error(`Template file not found: ${r}`);let c=await m.text(),a=null;if(h(r)){let n=await b(c,{renderer:e.markdownRenderer});c=n.html,a=n.frontmatter}if(a)e={...e,context:{...a,...e.context||{}}};if(e.layout){let n=R(e.layout),p=Bun.file(n);if(!await p.exists())throw Error(`Layout template not found: ${n}`);let{layout:g,injectCSS:t,...o}=e,l={...e.context||{}};Pn(l);let d=await w(c,r,{...o,context:{...l,__stx_defer_server_data:!0},injectCSS:!1}),u=await p.text(),f={...l,content:d},x={...o,context:f,injectCSS:t};return w(u,n,x)}return w(c,r,e)}async function w(s,e,r={}){let{templateContent:m,serverScripts:c,clientScripts:a}=v(s),n={...q,...r.options},p={__filename:e,__dirname:k(e),__stx:{},__stx_options:n,__stx_sfc_mode:!0,__stx_inject_css:r.injectCSS===!0,__stxServeContext:void 0,...co(r.context??{}),definePageMeta:()=>{},...r.context||{}};for(let o of c)await y(o,p,e);let g=new Set,t=m;if(t=await i(t,p,e,n,g),gl(p,r.context),r.templateOnly){if(t=t.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),t=t.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),a.length>0)t+=`
|
|
13
13
|
${a.join(`
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Ge(p),d=await Promise.all(a.map(async(x)=>{let _=x.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(_))return x;let S=x.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!S)return x;return await Je(S[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),f=[await br(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
|
-
`);t=la(t,f)}t=await Pe(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
15
|
+
`);t=la(t,f)}t=await Pe(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=M(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-5md9ymx3.js");t=await o(t)}catch{}return t}
|
|
16
16
|
export{_c};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{cg,Nc,ay,Mc,lg,ug,Sn,xr,cy,dg,pg,ly,S}from"./chunk-zwhc17pt.js";import"./chunk-z02jzx63.js";import"./chunk-etn044yn.js";import"./chunk-fcqca9qb.js";import"./chunk-w98yt4d4.js";import"./chunk-c08jvjqt.js";import"./chunk-phzhmnnm.js";import"./chunk-75r2p1cz.js";import"./chunk-0jdz31q1.js";import"./chunk-4b110x6r.js";export{Sn as buildCss,dg as extractClassNames,ug as fingerprintConfig,pg as generateCss,cy as getCachedCSS,cg as getCssServeAsset,S as injectCss,Nc as loadCssEngine,Mc as loadCssEngineConfig,xr as rebuildCss,ay as resetCssCache,lg as resolveUserCssConfig,ly as withLinkedModuleBundles};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Bn}from"./chunk-c08jvjqt.js";import{B,Q,x,Kt,Xt,zr,y,Pl,Ki,Y,N}from"./chunk-
|
|
2
|
+
import{Bn}from"./chunk-c08jvjqt.js";import{B,Q,x,Kt,Xt,zr,y,Pl,Ki,Y,N}from"./chunk-etn044yn.js";import{gn}from"./chunk-7mv9z3mp.js";import{r}from"./chunk-a774ncg3.js";import{ne}from"./chunk-e5rag6rh.js";import{L,c}from"./chunk-8tfpv6zf.js";var J=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function K(t){let s=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,n;while((n=e.exec(t))!==null)s.push({start:n.index,end:n.index+n[0].length});return s}function I(t,s){return s.some((e)=>t>=e.start&&t<e.end)}function Z(t){let s=(t||"").trim();if(!s)return null;if(/[\s>+~,:]/.test(s))return null;let e={},n=s,i=n.match(/^[a-z][\w-]*/i);if(i)e.tag=i[0].toLowerCase(),n=n.slice(i[0].length);while(n.length>0){let o=n.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(o){if(e.attr=o[1],o[3]!==void 0&&o[3]!=="")e.attrValue=o[3];n=n.slice(o[0].length);continue}let l=n.match(/^#([\w-]+)/);if(l){e.id=l[1],n=n.slice(l[0].length);continue}let a=n.match(/^\.([\w-]+)/);if(a){e.className=a[1],n=n.slice(a[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function tt(t,s){if(s.attr){if(!(s.attrValue===void 0?new RegExp(`\\b${s.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${s.attr}\\s*=\\s*(["'])\\s*${s.attrValue}\\s*\\1`,"i")).test(t))return!1}if(s.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${s.id}\\s*\\1`,"i").test(t))return!1}if(s.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(s.className))return!1}return!0}function T(t,s="main"){let e=Z(s);if(!e)return null;let n=/<([a-z][\w-]*)\b([^>]*)>/gi,i=K(t),o;while((o=n.exec(t))!==null){if(I(o.index,i))continue;let l=o[1].toLowerCase(),a=o[2]||"";if(a.trimEnd().endsWith("/")||J.has(l))continue;if(e.tag&&e.tag!==l)continue;if(!tt(a,e))continue;let u=o[0],g=o.index+u.length,f=new RegExp(`<(/?)${l}\\b([^>]*)>`,"gi");f.lastIndex=g;let d=1,h;while((h=f.exec(t))!==null){if(I(h.index,i))continue;let b=h[1]==="/";if(!b&&(h[2]||"").trimEnd().endsWith("/"))continue;if(d+=b?-1:1,d===0)return{openTag:u,openIndex:o.index,start:g,end:h.index,tagName:l}}return null}return null}var Et="private, no-store";function cn(t){return t.replace(/&#(\d+);/g,(s,e)=>D(Number(e),s)).replace(/&#x([0-9a-f]+);/gi,(s,e)=>D(Number.parseInt(e,16),s)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function D(t,s){if(!Number.isInteger(t)||t<0||t>1114111)return s;try{return String.fromCodePoint(t)}catch{return s}}function Be(t){return t.headers.get("X-STX-Router")==="true"}function H(t,s){if(!t)return s;return t.split(",").some((n)=>n.trim().toLowerCase()===s.toLowerCase())?t:`${t}, ${s}`}function V(t){let s=H(t,"X-STX-Router");for(let e of ds)s=H(s,e);return{Vary:s}}var ds=["X-STX-Have-Layout","X-STX-Have-Layout-Group"];function k(t){return t.replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function F(t){let s=/<head\b[^>]*>([\s\S]*?)<\/head\s*>/i.exec(t)?.[1]??"",e=/<(meta|link)\b(?:[^>"']|"[^"]*"|'[^']*')*>|<title\b[^>]*>[\s\S]*?<\/title\s*>/giy;return x(s,(n,i)=>(e.lastIndex=i,e.exec(n)?e.lastIndex:-1)).map(({token:n})=>n)}function q(t){let s=Object.create(null),e=t.replace(/^<\w+\b|>$/g,"");for(let n of e.matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g)){let i=n[1].toLowerCase();if(!(i in s))s[i]=n[2]??n[3]??n[4]??""}return s}function Kn(t){let s=[];for(let e of F(t)){if(/^<title\b/i.test(e)){s.push(`<title>${k(e.replace(/^<title\b[^>]*>|<\/title\s*>$/gi,""))}</title>`);continue}let n=q(e);if(/^<meta\b/i.test(e)){let i=n.property?"property":"name",o=cn(n[i]??"").toLowerCase();if(o==="description"||/^(?:og|twitter):[\w:]+$/.test(o))s.push(`<meta ${i}="${r(o)}" content="${k(n.content??"")}">`)}else{let i=cn(n.rel??"").toLowerCase();if(i==="canonical"||i==="alternate"&&n.hreflang)s.push(`<link rel="${i}" href="${k(n.href??"")}"${i==="alternate"?` hreflang="${k(n.hreflang)}"`:""}>`)}}return`<template data-stx-page-head="1">${s.join("")}</template>
|
|
3
3
|
`}var et=["media","crossorigin","integrity"];function Xn(t){let s=[];for(let e of F(t)){if(!/^<link\b/i.test(e))continue;let n=q(e);if(cn(n.rel??"").trim().toLowerCase()!=="stylesheet")continue;if(!n.href||"data-css"in n||"disabled"in n)continue;let i=et.filter((o)=>(o in n)).map((o)=>` ${o}="${k(n[o])}"`).join("");s.push(`<link rel="stylesheet" href="${k(n.href)}"${i}>`)}return s.length?`<template data-stx-page-css="1">${s.join("")}</template>
|
|
4
|
-
`:""}import P from"path";var nt="stx-page-head:",rt=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function st(){let t=ne()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-
|
|
4
|
+
`:""}import P from"path";var nt="stx-page-head:",rt=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,_={dev:null,prod:null};function st(){let t=ne()?"dev":"prod",s=_[t];if(s!==null)return s;try{let e=import.meta.require("./chunk-5xsghm23.js"),n=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;_[t]=`<script>${n()}</script>`}catch{_[t]=""}return _[t]}async function Da(t,s){if(s===!1)return null;if(s&&typeof s==="string"){let n=P.resolve(t,s);if(await Bun.file(n).exists())return n;return null}let e=P.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Bo(t,s){try{let e=await Bun.file(t).text(),n=e,i=B(e);if(i)n=i.content.trim();let o=gn(e),l=[...o.client.map((p)=>p.fullTag),...o.signals.map((p)=>p.fullTag)],a=[],u=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,g;while((g=u.exec(e))!==null)a.push(g[0]);let f=n;for(let p of o.server)f=f.replace(p.fullTag,"");for(let p of o.client)f=f.replace(p.fullTag,"");f=f.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let d="<!--__STX_PAGE_SLOT__-->";if(f=f.replace(/<slot\s*\/>/gi,d).replace(/<slot\s*>\s*<\/slot>/gi,d),!f.includes(d))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:h,extractVariables:b,defaultConfig:w,loadStxConfig:R}=await import("./chunk-dk881ye4.js"),E=await R(),m={__filename:t,__dirname:P.dirname(t)};for(let p of l){let C=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!p.includes("client")&&!p.includes('type="module"'))await b(C[1],m,t)}let S=await h(f,m,t,{...w,...E,...s},new Set),A=S.indexOf(d);if(A===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:S.substring(0,A),afterSlot:S.substring(A+d.length),filePath:t,shellScripts:l,shellStyles:a}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function ps(t,s,e){let n,i="",o=s.match(rt);if(o){s=s.replace(o[0],"");try{let f=Buffer.from(o[1],"base64").toString("utf8"),d=f.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(d)n=d[1].trim();i=f.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let l=e||n||"stx App",a=st(),u="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
5
5
|
<html lang="en">
|
|
6
6
|
<head>
|
|
7
7
|
<meta charset="UTF-8">
|
|
@@ -29,5 +29,5 @@ ${a}
|
|
|
29
29
|
`));if(o.length>0)m.push(o.filter((S)=>!g.has(S)).join(`
|
|
30
30
|
`));if(w.length>0)m.push(w.filter((S)=>!g.has(S)).join(`
|
|
31
31
|
`));return m.push(b),m.join(`
|
|
32
|
-
`)}import O from"fs";import X from"path";function ja(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Ba(t,s){let e=X.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function Fa(t){let s=X.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function at(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function Fo(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function z(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!Fo(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await at(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=ct(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function ct(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(M(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function za(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function Gn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await lt(t,s),l=Kt(n),a=Xt(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-
|
|
32
|
+
`)}import O from"fs";import X from"path";function ja(t,s,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:s,outputDir:e}}function Ba(t,s){let e=X.join(s,"manifest.json");O.writeFileSync(e,JSON.stringify(t,null,2))}function Fa(t){let s=X.join(t,"manifest.json");if(!O.existsSync(s))return null;try{let e=O.readFileSync(s,"utf-8"),n=JSON.parse(e);if(n.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${n.version}`),null;return n}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}function M(t,s,e={}){let n=`${encodeURIComponent(t)}=${encodeURIComponent(s)}`;if(e.maxAge!==void 0)n+=`; Max-Age=${e.maxAge}`;if(e.expires)n+=`; Expires=${e.expires.toUTCString()}`;if(e.path)n+=`; Path=${e.path}`;if(e.domain)n+=`; Domain=${e.domain}`;if(e.secure)n+="; Secure";if(e.httpOnly)n+="; HttpOnly";if(e.sameSite)n+=`; SameSite=${e.sameSite}`;return n}async function at(t){let s=t.headers.get("content-type")||"",e={},n=(i,o)=>{let l=e[i];if(l===void 0)e[i]=o;else if(Array.isArray(l))l.push(o);else e[i]=[l,o]};if(s.includes("multipart/form-data")){let i=await t.formData();for(let[o,l]of i.entries())if(typeof l==="string")n(o,l);return e}if(s.includes("application/x-www-form-urlencoded")){for(let[i,o]of new URLSearchParams(await t.text()).entries())n(i,o);return e}return e}function Fo(t){if(!t)return!1;let s=t.toUpperCase();return s!=="GET"&&s!=="HEAD"}async function z(t,s={}){let e=s.request,n=s.method??e?.method;if(!e||!Fo(n))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let i={};try{i=await at(e)}catch{}let o=await t.action({request:e,form:i,params:s.params??{},query:t.query??{},cookies:s.cookies??{}});if(o&&typeof o==="object"){let l=o,a=ct(l.cookies),u=l.redirect;if(typeof u==="string"&&u)return{redirect:u,ran:!0,...a.length>0?{cookies:a}:{}};let{cookies:g,redirect:f,...d}=l;if(Object.assign(t,d),a.length>0)return{ran:!0,cookies:a}}return{ran:!0}}function ct(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let s=[];for(let[e,n]of Object.entries(t)){if(!e)continue;if(typeof n==="string"){s.push(M(e,n));continue}if(n&&typeof n==="object"){let i=n;if(typeof i.value!=="string")continue;s.push(M(e,i.value,i))}}return s}function za(t,s=[],e){let n=new Headers({Location:t,"Cache-Control":"no-store"});for(let i of s)n.append("Set-Cookie",i);for(let[i,o]of Object.entries(e??{}))if(i.toLowerCase()!=="location")n.set(i,o);return new Response(null,{status:303,headers:n})}async function Gn(t,s={}){let{html:e,context:n,redirect:i,cookies:o}=await lt(t,s),l=Kt(n),a=Xt(n);if(i)return{html:e,redirect:i,cookies:o,status:l,headers:a};let{extractStreamBoundaries:u}=await import("./chunk-n008g6xh.js"),g=u(n),f=t.streamTemplates;if(f&&Object.keys(f).length>0){let{processDirectives:d}=await import("./chunk-zzpedcte.js"),{defaultConfig:h}=await import("./chunk-qfwnp28b.js"),b=n.streamBoundaries||{},w={...h,autoShell:!1},R=Object.keys(f).map((m)=>({id:m,render:async()=>{let S=typeof b[m]==="function"?await b[m]():void 0;return d(f[m],{...n,$boundary:S},t.sourceFile,w,new Set)}})),E=new Set(R.map((m)=>m.id));g=[...(g||[]).filter((m)=>!E.has(m.id)),...R]}return{html:e,boundaries:g&&g.length>0?g:void 0,cookies:o,status:l,headers:a}}async function lt(t,s){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...s};if(!t.hasServerScripts&&!Ki(t.html))return{html:t.html,context:e};for(let l of t.serverScriptContent)try{await y(l,e,t.sourceFile)}catch(a){if(s.__stx_strict_hydration)throw a;console.warn(`[stx] Server script error in ${t.sourceFile}:`,a)}let n=await z(e,{request:s.request,method:s.method,params:s.params??{},cookies:s.cookies??{}}),i=(l)=>{let a=l.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),u=zr(e);if(!u)return a;let g=L(a);return g<0?u+a:a.slice(0,g)+u+a.slice(g)};if(n.redirect)return{html:t.html,context:e,redirect:n.redirect,cookies:n.cookies};if(!Ki(t.html))return{html:i(t.html),context:e,cookies:n.cookies};let o=new Map;for(let[l,a]of Object.entries(t.placeholders))if(a.expression)try{let u=N(a.expression,e);if(a.type==="raw")o.set(l,u!==void 0&&u!==null?String(u):"");else o.set(l,u!==void 0&&u!==null?Y(String(u)):"")}catch(u){if(s.__stx_strict_hydration)throw u;o.set(l,"")}return{html:i(Pl(t.html,o)),context:e,cookies:n.cookies}}
|
|
33
33
|
export{Et,cn,Be,V,ds,Kn,Xn,Da,Bo,ps,ot,La,Tt,Fe,ja,Ba,Fa,Fo,za,Gn};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ti,$i,Dt,Se,Rr,Ks,Ar,Xs,Gs,_g,Cg,Eg,Pr,Tg,$g,Rg,Ag,el,tl,nl,Ri,rl,Pg,Lt,jt,Bt,Ft,zt,Ht,ft,Ig}from"./chunk-
|
|
2
|
+
import{Ti,$i,Dt,Se,Rr,Ks,Ar,Xs,Gs,_g,Cg,Eg,Pr,Tg,$g,Rg,Ag,el,tl,nl,Ri,rl,Pg,Lt,jt,Bt,Ft,zt,Ht,ft,Ig}from"./chunk-9gptdyqq.js";export{Ar as Router,Rg as abortNavigation,Ks as bracketPathToRegex,Lt as clearMiddleware,tl as createClientCookieManager,zt as createMiddlewareContext,Ft as createRouteLocation,el as createServerCookieManager,nl as createStorageManager,Ag as defineMiddleware,Cg as defineRoute,Eg as defineRoutes,Xs as findErrorPage,Gs as formatRoutes,$i as generateRouteManifest,Ti as generateRouteTypes,rl as getMiddleware,jt as getMiddlewareNames,ft as getRouterScript,Ig as getRouterScriptDev,Pg as hasMiddleware,Dt as isFileRequestPath,Bt as loadMiddlewareFromDirectory,Rr as matchRoute,$g as navigateTo,Se as patternToRegex,Ri as registerMiddleware,Tg as resetRoutes,Pr as route,Ht as runMiddleware,_g as setAppUrl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{en,we,R}from"./chunk-0jdz31q1.js";import{Z}from"./chunk-
|
|
2
|
+
import{en,we,R}from"./chunk-0jdz31q1.js";import{Z}from"./chunk-2vdbt2a7.js";import{Mi,ol,o,A,Ke,Ne,Tn,Xe,ke,se,Dr,O,Rn,ao,ml,hl,Pn,zr,lo,uo,yl,Hi,bl,wl,vl,xl,Ge,Je,po,Qe,s,On,b,g,Y,ae,Me,P,Gi}from"./chunk-etn044yn.js";import{d,m,M,n,ce,te,u,De,Qi,K,jn,ea,Zt,ta,Nl,qr,Ml,wt,Dl,Kr,Ll,Bn,na,jl,Xr,Jr,Le,ra}from"./chunk-c08jvjqt.js";import{Jt}from"./chunk-w98yt4d4.js";import{Dn}from"./chunk-fcqca9qb.js";import{S}from"./chunk-zwhc17pt.js";import{Pr,Cn}from"./chunk-9gptdyqq.js";import{Hc,Uc,$r,pt,Vc,j}from"./chunk-ja4fyz87.js";import{ki,_i,Ci,Ei}from"./chunk-eca022er.js";import{kn,Lc,Ps}from"./chunk-0b5vmmf8.js";import{Ts,$s,Rs}from"./chunk-vk9s9byv.js";import{Ns,mi,hi,Ms,Ds,yi}from"./chunk-6vyy44ve.js";import{Is,ui}from"./chunk-084f6953.js";import{ii}from"./chunk-fs43342z.js";import{ge,di,pi,fi}from"./chunk-9bexzgws.js";import{_r,Ae,Bc,Cr,Fc}from"./chunk-hcxsyw55.js";import{W,ut}from"./chunk-1jxkc6d0.js";import{qc,Kc}from"./chunk-v37hjzt2.js";import{I,Fn,sa}from"./chunk-e5rag6rh.js";import{Un}from"./chunk-zjrnz9yt.js";import{L,c,f}from"./chunk-8tfpv6zf.js";function Ve(r){return/\bimport\s*\.\s*meta\b/.test(Un(r))}function Br(r){let e=Ne(r),l=[],a=0;for(let h=0;h<e.length;h++){let t=e[h],p=t.name.toLowerCase();if(p==="template")a+=t.closing?-1:1;if(p!=="script"||t.closing)continue;let w=e[h+1];if(w?.name.toLowerCase()!=="script"||!w.closing)continue;l.push({start:t.start,end:w.end,attrs:t.attributes,body:r.slice(t.end,w.start),inert:a>0})}return l}function nt(r){return[...r].map(([e,l])=>l===!0?e:`${e}="${l.replace(/"/g,""")}"`).join(" ")}function vt(r){let e=Br(r);if(e.some((y)=>O(y.attrs).has("data-stx-module-bootstrap")))return r;let l=(y)=>{if(Ve(y))return!0;try{return Z(y)}catch{return!1}};if(!e.some((y)=>l(y.body)||O(y.attrs).get("type")==="module"))return r;let a=new Bun.CryptoHasher("md5").update(r).digest("hex").slice(0,16),h="",t=0,p=!1,w=0;for(let y of e){let v=O(y.attrs),x=v.get("type");if(y.inert||v.has("data-stx-module-job")||v.has("data-stx-runtime")||v.has("data-stx-router"))continue;if(typeof x==="string"&&!["module","text/javascript","application/javascript"].includes(x.toLowerCase()))continue;if(![...v.keys()].some((T)=>/^data-stx-(?:scoped|modules|stores|(?:framework-)?composables)$/.test(T)))continue;let _=x==="module"||l(y.body);if(_)p=!0;if(!p)continue;if(!_&&(v.has("data-stx-owner")||v.has("data-stx-instance")))continue;h+=r.slice(t,y.start);let E=y.body,D=v.get("src");if(typeof D==="string")v.delete("src"),v.set("data-stx-source-url",D),E=`${_?"await":"return"} new Promise(function(resolve,reject){
|
|
3
3
|
var source=globalThis.__stxExecutingScript,script=document.createElement('script');
|
|
4
4
|
for(var attr of source.attributes)if(!['type','src','data-stx-module-job'].includes(attr.name))script.setAttribute(attr.name,attr.value);
|
|
5
5
|
${_?"script.type='module';":""}
|
|
@@ -1435,7 +1435,7 @@ ${C}
|
|
|
1435
1435
|
</style>`;a=a.replace(v,N),w.lastIndex=0}catch(C){}}}return a}import gt from"path";var os=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,as=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function cs(r,e){if(!e||!r.includes("/"))return r;let l=gt.dirname(e);return r.replace(os,(a,h,t,p)=>{let w=gt.resolve(l,p);return`${h}${t}${w.split(gt.sep).join("/")}${t}`})}function wr(r,e){if(!e||!r.includes("<script"))return r;return r.replace(as,(l,a,h,t)=>`${a}${cs(h,e)}${t}`)}var Re="<!--PARENT_CONTENT_PLACEHOLDER-->";function vr(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Mr(r,e){let l=r.length,a=e,h=!0,t=[],p=(w)=>w+9<=l&&r[w]==="<"&&r[w+1]==="/"&&(r[w+2]==="s"||r[w+2]==="S")&&(r[w+3]==="c"||r[w+3]==="C")&&(r[w+4]==="r"||r[w+4]==="R")&&(r[w+5]==="i"||r[w+5]==="I")&&(r[w+6]==="p"||r[w+6]==="P")&&(r[w+7]==="t"||r[w+7]==="T")&&(r[w+8]===">"||/\s/.test(r[w+8]));while(a<l){let w=r[a];if(p(a))return a;if(w==="/"&&r[a+1]==="/"){if(a=r.indexOf(`
|
|
1436
1436
|
`,a+2),a===-1)return-1;a+=1,h=!0;continue}if(w==="/"&&r[a+1]==="*"){let y=r.indexOf("*/",a+2);if(y===-1)return-1;a=y+2,h=!0;continue}if(w==="/"&&h){let y=a+1,v=!1;while(y<l){let x=r[y];if(x==="\\"){y+=2;continue}if(x==="[")v=!0;else if(x==="]")v=!1;else if(x==="/"&&!v){y++;break}else if(x===`
|
|
1437
1437
|
`){y=-1;break}y++}if(y===-1){a++,h=!1;continue}while(y<l&&/[a-z]/.test(r[y]))y++;a=y,h=!1;continue}if(w==="'"||w==='"'){let y=w;a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]===y){a++;break}if(r[a]===`
|
|
1438
|
-
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Rr(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var us=4096;async function mt(r,e,l){if(Ve(e)||Z(e)||l.buildMode!=="serve"||e.length<us)return null;let{registerServeModuleBundle:a}=await import("./chunk-
|
|
1438
|
+
`)break;a++}h=!1;continue}if(w==="`"){a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}if(t.length===0)h=!1;continue}if(w==="}"&&t.length>0){t.pop(),a++;while(a<l){if(r[a]==="\\"){a+=2;continue}if(r[a]==="`"){a++,h=!1;break}if(r[a]==="$"&&r[a+1]==="{"){t.push(!0),a+=2,h=!0;break}a++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))h=!1;else h=!0;a++}return-1}function Rr(r,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(r);if(!a)return null;let h=a.index+a[0].length,t=r.indexOf("</script>",h);if(t===-1)return null;let p=r.indexOf(">",t);if(p===-1)return null;return{start:a.index,end:p+1}}var us=4096;async function mt(r,e,l){if(Ve(e)||Z(e)||l.buildMode!=="serve"||e.length<us)return null;let{registerServeModuleBundle:a}=await import("./chunk-s19t5mh2.js");return`<script ${r} src="${a(e)}"></script>`}async function br(r,e,l,a){try{let{registeredModuleIdsIn:h,buildModuleRegistryScript:t}=await o("stx/client-module-registry",()=>import("./chunk-exny40nv.js")),p=[],w=await t(h(...r),{minify:sa(e.buildMode,e.minifyClient),collectInputs:p});for(let y of p)l?.add(y);if(a)a.inputs=p,a.code=w??void 0;if(!w)return null;if(e.buildMode==="serve"&&!Ve(w)&&!Z(w)){let{registerServeModuleBundle:y}=await import("./chunk-s19t5mh2.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${y(w)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${w.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function ds(r,e,l,a){let h={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:_}=await o("stx/framework-composables",()=>import("./chunk-fd8fp6h4.js"));h.frameworkScript=await _(r)}catch{}let t=null;try{t=await o("stx/store-loader",()=>import("./chunk-f9dy0r3f.js"))}catch{}let p=e.storesDir,w=!!a.__stx_native_screen||(t?.pageStoresAll()??!0),y=w?"":r.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),v=[],x=[],k=null;for(let _=0;_<8;_++){let E=null,D="",T=!1;try{if(t){let q=w?await t.getStoreScript(p).then((V)=>V?{code:V,stores:["*"],functions:null}:null):await t.getStoreScriptFor(p,[y],{reads:t.storesReadInFiles([...v,...x]),runOnce:!0});if(q)E=q.code,D=q.stores.join(","),T=!!q.functions&&!w}}catch{}if(k!==null&&D===k)break;k=D;let C=T?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",N=E?`<script ${C}>${E}</script>`:null;h.storeCode=E,h.storeTag=E?await mt(C,E,e)??N:null;let F={};h.modulesTag=await br([r,N],e,l,F),h.modulesCode=F.code??null,v=F.inputs??[],h.composableTag=null,h.composableCode=null,x=[];try{let{getComposableScript:q}=await o("stx/composable-loader",()=>import("./chunk-12f99j3h.js")),V=e.composablesDir,H=[h.modulesCode??h.modulesTag,N,h.frameworkScript].filter((U)=>U!==null),B=await q(e._layerComposableDirs??V,r,H,x);if(B)h.composableCode=B,h.composableTag=await mt('data-stx-scoped data-stx-run="always" data-stx-composables',B,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${B.replace(/<\/script/gi,"<\\/script")}</script>`}catch{}if(w||!t)break}return h}async function ps(r,e,l,a={}){let{withModuleSubstitutes:h,moduleSubstitutionKey:t}=await import("./chunk-rbfrxaer.js"),p=await import("./chunk-bprjp80g.js"),{messages:w,webModules:y}=e,v=null,x=null,k=t()===""&&!a.__stx_native_screen;if(w&&p.pageMessagesEnabled(e)&&k)try{v=await p.loadPageMessages(process.cwd(),w)}catch(C){fs(C)}if(y&&Object.keys(y).length&&k)try{x=await(await import("./chunk-6w9av0n9.js")).loadWebModules(process.cwd(),y)}catch(C){gs(C)}let _=new Map([...x??[],...v?.stubs??[]]),E=()=>ds(r,e,l,a),D=_.size?await h(_,E):await E(),T=null;if(v){let C=p.messageAreasIn(D.modulesCode,D.storeCode,D.composableCode),N=p.pageMessagesScript(v,p.pageLanguages(r,v),C);if(N)T=await mt('data-stx-scoped data-stx-run="always" data-stx-messages',N,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${N.replace(/<\/script/gi,"<\\/script")}</script>`}return[T,D.modulesTag,D.storeTag,D.composableTag,D.frameworkScript].filter((C)=>C!==null)}var xr=!1;function fs(r){if(xr)return;xr=!0,console.warn(`[stx] messages: ${r instanceof Error?r.message:String(r)}; pages ship every language`)}var Sr=!1;function gs(r){if(Sr)return;Sr=!0,console.warn(`[stx] ${r instanceof Error?r.message:String(r)}; pages bundle the real modules`)}function ms(r,e=""){let l=Rr(r,"data-stx-runtime");if(!l)return r;let a=_r(r);if(a===-1||a===l.start){if(!e)return r;return r.slice(0,l.end)+e+r.slice(l.end)}if(a<l.start)return r.slice(0,a)+r.slice(l.start,l.end)+e+`
|
|
1439
1439
|
`+r.slice(a,l.start)+r.slice(l.end);let h=r.slice(l.start,l.end),t=r.slice(0,l.start)+r.slice(l.end),p=_r(t);if(p===-1)return h+e+`
|
|
1440
1440
|
`+t;return t.slice(0,p)+h+e+`
|
|
1441
1441
|
`+t.slice(p)}function hs(r){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return r.replace(e,(l,a,h)=>{let t=r.slice(0,h);return t.lastIndexOf("<")>t.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(r,e,l,a,h){if(await R(),a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return r;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Me(r,l);let t=!e.__stxProcessingDepth;Pn(e);for(let p of a._layerGraph?.configDependencies??[])h.add(p);if(t&&a.runtimeConfig)await Dn(e,l,a.runtimeConfig);if(t)vl(e),e.__stx_scope_seq??={n:0,key:po(String(e.__filename??l))},e.__stx_head_injections=ta(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!I()&&!Fn())&&l&&l.endsWith(".stx"))ii(r,l);try{return await we.timeAsync("template-processing",async()=>{let p=await ys(r,e,l,a,h);if(t)p=Hi(p);if(t&&a.autoShell&&a.buildMode!=="compile"){let w=Le(a.app?.head,{known:Jr,source:"app.head"}),v=(e.__stx_runtime_head||null)??ra(),x=(e.__stx_head_raw||"").trim(),k,_=x.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)k=_[1].trim(),x=x.replace(_[0],"").trim();let E=e.__sections?.title,D=E?P(E,e,l):void 0,T=v.title||k||D,C=!v.title&&(!!k||!!D),N=v.meta||[],F=new Set(N.map((J)=>wt(J)).filter(Boolean)),q={...w,...T&&{title:T},meta:[...(w.meta||[]).filter((J)=>!F.has(wt(J))),...N],link:[...w.link||[],...v.link||[]],script:[...w.script||[],...v.script||[]],headRaw:[w.headRaw,x].filter(Boolean).join(`
|
|
@@ -1450,7 +1450,7 @@ ${y.trim()}
|
|
|
1450
1450
|
@endsection`}}if(N&&y.includes("<script")){let H=se(y),B=H.scripts.map((U)=>kr(U,l)??U);y=Dr(H.output,B)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,B,U)=>(C[B]=U,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(H,B,U)=>{if(/^(['"]).*\1$/.test(U.trim()))return H;try{let J=d(U.trim(),e);if(J===void 0)return H;let G=(e.__stx_inline_section_values??=[]).push(J)-1;return C[B]=`{{ __stx_inline_section_values[${G}] }}`,""}catch{return H}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(H,B,U)=>{if(U.includes("@parent"))C[B]=U.replace("@parent",Re);else C[B]=U.trim();return""}),e.__sections=C,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(H,B,U)=>C[B]||U||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||"");if(y=Rs(y,T),N){let H=[],B=se(y),U=ke(B.output,Tn,(J,de)=>`\x00STX_ORPHAN_STYLE_${de}\x00`);if(y=U.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(J,de,G)=>{let pe=de==="SCRIPT"?kr(B.scripts[Number(G)],l):U.tokens[Number(G)];if(pe)H.push(pe);return""}),H.length>0){let J=H.join(`
|
|
1451
1451
|
`);C.content=C.content?`${C.content}
|
|
1452
1452
|
${J}`:J,e.__sections=C}}if(N)try{let H;if(le.isAbsolute(N))H=N,h.add(N);else H=await De(()=>On(N,l,p,h),null,()=>{throw new ce(`Failed to resolve layout path: ${N}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!H){let ue=(Q)=>{if(!Q)return[];try{let xe=le.isAbsolute(Q)?Q:le.resolve(process.cwd(),Q);return ls.readdirSync(xe).filter(($e)=>$e.endsWith(".stx")).map(($e)=>$e.replace(/\.stx$/,""))}catch{return[]}},ne=[...ue(p.layoutsDir),...ue(p.fallbackLayoutsDir)].filter((Q,xe,$e)=>$e.indexOf(Q)===xe).sort(),ve=[p.layoutsDir,p.fallbackLayoutsDir].filter((Q)=>typeof Q==="string"&&Q.length>0),me=ve.length>0?` Searched: ${ve.join(", ")} (set \`layoutsDir\` to look elsewhere).`:"",ie=`Layout not found: ${N} (referenced from ${l})`+(ne.length>0?`. Available layouts: ${ne.join(", ")}`:p.layoutsDir?`. No .stx layouts found in ${p.layoutsDir}`:"")+me;if(K.log(Error(ie),{layoutPath:N,filePath:l,available:ne},"error"),console.error(`[stx] ${ie}`),p.debug)throw new ce(ie,l);return y}let B=await De(()=>Bun.file(H).text(),"",()=>{throw new ce(`Failed to read layout file: ${H}`,l,void 0,void 0,"Layout content could not be loaded")});B=wr(B,H),B=B.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Array.isArray(e.__layoutChain)?e.__layoutChain:[];if(U.includes(H)){let ue=[...U.slice(U.indexOf(H)),H];throw new ce(ue.length===2?`Circular layout: ${H} extends itself`:`Circular layout: ${ue.join(" -> ")}`,l,void 0,void 0,"Remove the @extends or @layout line that points back at a layout already in use")}let J=B.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(J){if(p.debug)console.log(`Found nested layout: ${J[1]} in ${H}`);let ue={},ne=B.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,Q,xe)=>(ue[Q]=xe.trim(),""));for(let[ie,Q]of Object.entries(ue))if(C[ie]&&C[ie].includes(Re)){let xe=C[ie].indexOf(Re);C[ie]=C[ie].slice(0,xe)+Q+C[ie].slice(xe+Re.length)}else if(!C[ie])C[ie]=Q;let ve={...e,__sections:C,__layoutChain:[...U,H]},me=`@layout('${J[1]}')${ne}`;return await i(me,ve,H,p,h)}let de=B.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=$s(de,T),pe={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ue,ne,ve)=>(pe[ne]=ve.trim(),`@slot('${ne}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ue,ne,ve)=>{if(C[ne]){let me=C[ne];if(me.includes(Re)){let ie=pe[ne]||"",Q=me.indexOf(Re);me=me.slice(0,Q)+ie+me.slice(Q+Re.length)}return me}return ve||""}),G=bs(G,C),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>C.content||""),G=Rs(G,T),e.__originalFilePath=l,y=await Ar(G,e,H,p,h),y=`<!-- stx-layout: ${N} -->
|
|
1453
|
-
${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await Ar(y,e,l,p,h))}function bs(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function ws(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function vs(r,e){await De(()=>nr(r,e),void 0,(l)=>{K.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function kr(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function xs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Tr(r,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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function Ss(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1453
|
+
${y}`,k(y)}catch(H){if(H instanceof te)throw H;throw new ce(`Error processing layout ${N}: ${H instanceof Error?H.message:String(H)}`,l)}return k(await Ar(y,e,l,p,h))}function bs(r,e){return r.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,h)=>{let t=e[a];if(t!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(t))return t}return h||""})}function ws(r,e){if(r.__stx_sfc_mode=!0,r.__stx_options=e,e.buildMode)r.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[h,t]of Object.entries(process.env))if(h.startsWith(l)&&t!==void 0)a[h]=t;r.$env=a}async function vs(r,e){await De(()=>nr(r,e),void 0,(l)=>{K.log(l,{filePath:r,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${r}: ${l.message}`)})}var ht="data-stx-source";function kr(r,e){if(!r)return r;let l=/^<script\b([^>]*)>/i.exec(r);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(ht))return r;return`<script ${ht}="${encodeURIComponent(e)}"${r.slice(7)}`}function xs(r){let e=new RegExp(`${ht}="([^"]*)"`).exec(r);return e?decodeURIComponent(e[1]):void 0}function Er(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Tr(r,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">${Er(r)}</span><span style="display:block;margin-top:4px">${Er(l)}</span></div>`}async function Ss(r,e,l,a){let{scanScriptTags:h}=await o("stx/signal-processing",()=>import("./chunk-g9s2t064.js")),t=[],p=!I()&&!Fn();for(let y of h(r)){let v=y.attrs;if(!/\bserver\b/.test(v))continue;let x=y.start+y.fullMatch.indexOf(">")+1,k=Mr(r,x);if(k===-1)continue;let _=r.slice(x,k);if(!_.trim())continue;let E=xs(v)??l,D={index:y.start,length:k+9-y.start};try{let{extractVariables:T}=await o("stx/variable-extractor",()=>import("./chunk-kc3w40c2.js"));await T(_,e,E,{preserveExisting:!0,onFailure:(C)=>{if(C.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:E,kind:C.kind,message:C.message}),!p)return;t.push({...D,markup:Tr(E,C.kind,C.message)})}})}catch(T){let C=T instanceof Error?T:Error(String(T));if(K.log(C,{filePath:E,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${E}: ${C.message}`),p)t.push({...D,markup:Tr(E,"unknown",C.message)})}}if(t.length===0)return r;let w=r;for(let y of t.sort((v,x)=>x.index-v.index))w=w.slice(0,y.index)+y.markup+w.slice(y.index+y.length);return w}async function ks(r,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-tm4fgc58.js"));return a(r,e,{skipServer:!0})}catch(a){let h=a instanceof Error?a:Error(String(a));return K.log(h,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${h.message}`),r}}async function Ar(r,e,l,a,h){let t=r;await R();let p=a;if(t=await Ss(t,e,l,a),t=await zt(t,e,l),t=await Kt(t,e,l),t=await ks(t,e,l),await R(),t=await Nt(t,e,l,p),Me(t))t=mi(t,e),t=Ds(t,e),t=Ms(t,e);t=hi(t),await R();let{processStreamDirectives:w}=await o("stx/streaming",()=>import("./chunk-n008g6xh.js"));t=w(t,e),t=await ui(t,e,l,p,!0),await R(),t=await ur(t,e,l,p,h),t=await Ps(t,e,l,p,h),await R(),t=Hc(t,e,l,p);let{processDeferDirectives:y}=await o("stx/defer",()=>import("./chunk-n62nqhey.js"));t=y(t,e,l);let{processTeleportDirectives:v}=await o("stx/teleport",()=>import("./chunk-2fyey6pn.js"));t=v(t,e,l);let{processTransitionDirectives:x,processTransitionAttributes:k}=await o("stx/transitions",()=>import("./chunk-c60egpe6.js"));t=x(t,e,l),t=k(t);let{processErrorBoundaryDirectives:_,stripRenderFailedMarkers:E}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));t=_(t,e,l),t=E(t);let{processSuspenseDirectives:D}=await o("stx/suspense",()=>import("./chunk-fzh73jtc.js"));t=D(t,e,l);let{processAsyncDirectives:T}=await o("stx/async-components",()=>import("./chunk-jnk3nk5k.js"));t=T(t,e,l);let{processKeepAliveDirectives:C}=await o("stx/keep-alive",()=>import("./chunk-7k1thytm.js"));t=C(t,e,l);let{processVirtualListDirectives:N,processVirtualGridDirectives:F,processInfiniteListDirectives:q}=await o("stx/virtual-scrolling",()=>import("./chunk-x1svtz8k.js"));t=N(t,e,l),t=F(t,e,l),t=q(t,e,l),await R();let{processPartialHydrationDirectives:V,processStaticDirectives:H}=await o("stx/partial-hydration",()=>import("./chunk-mgcakk1m.js"));t=V(t,e,l),t=H(t);let{processComputedDirectives:B,processWatchDirectives:U}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));t=B(t,e,l),t=U(t,e,l);let{processFormValidationDirectives:J}=await o("stx/forms-validation",()=>import("./chunk-vr6maaas.js"));t=J(t,e,l);let{processHeadDirective:de,processTitleDirective:G,processMetaDirective:pe,resetHead:ue}=await o("stx/head",()=>import("./chunk-qjkpwjg6.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)ue();let ne=de(t);if(t=ne.content,ne.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ne.headContent}
|
|
1454
1454
|
`;if(t=G(t,e),t=pe(t,e,l),t=rr(t),t=di(t,e),t=jt(t),t=Qt(t),t=await Ts(t,e,l,p,h),t=await Ps(t,e,l,p,h),await R(),t=t.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),t=Hi(t),t=ge(t,e,l),t=Is(t),await R(),e.__stxProcessingDepth===1)t=xl(t,e);if(t=ml(t,e,{filePath:l,buildMode:p.buildMode}),t=pi(t,e),t=fi(t,e),t=et(t,e),t=Vt(t,e),t=Xt(t,e),t=await Ct(t,e,l,p),t=await Vc(t,e,l),t=await qc(t,e,l,p),await R(),t=Kc(t,e,l,p),t=ki(t,e,l,p),t=_i(t,e,l),t=Ci(t,e,l,p),t=Ot(t,e,l,p),t=lo(t,e),t=uo(t),t=yl(t),!p.skipEventDirectives)t=ol(t,e,l);if(t=hl(t,e,l,a.skipSignalsRuntime===!0&&Number(e.__stxProcessingDepth)>0),await R(),p.debug){let X=/\bx-data\s*=/.test(t),z=Ns(r);if(X&&z)console.warn(`[stx] ${l}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
1455
1455
|
Both work on the same page, but they manage separate scopes.
|
|
1456
1456
|
Prefer signals (state/derived/effect) for new components.`)}t=Lc(t,e),t=await Gi(t,e,l),await R(),t=bl(t),t=wl(t),t=$t(t);let{processXElementDirectives:ve}=await o("stx/x-element",()=>import("./chunk-va4xam1q.js"));t=ve(t);let me=e.__originalFilePath||l,ie=Ge(e);if(t=await yi(t,p,me,ie),await R(),t=Ut(t,e),t=await tr(t,e,l,p),await R(),p.media?.image?.autoSiblings){let X=p.publicDir||"public",{rewriteImagesWithSiblings:z}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-abxwggen.js"));t=await z(t,{publicDir:X})}if(p.seo?.enabled)t=Ei(t,e,p);let Q=(X,z,ee=!0)=>{if(!z)return X;let be=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),oe=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(X),he=oe?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(oe[0]):null;if(be&&oe&&he){if(ee){let Ie=oe.index+he.index;X=X.slice(0,Ie)+be[0]+X.slice(Ie+he[0].length)}if(z=z.replace(be[0],"").trim(),!z)return X}if(/<\/head>/i.test(X))return f(X,z);if(/<head\b[^>]*>/i.test(X))return X.replace(/(<head\b[^>]*>)/i,`$1
|
|
@@ -1462,6 +1462,6 @@ ${St()}
|
|
|
1462
1462
|
</script>`;if(t.includes("</head>")){let ee=L(t),oe=t.slice(0,ee).indexOf("<script");if(oe!==-1){let he=t.slice(0,oe),Ie=t.slice(oe);t=he+z+`
|
|
1463
1463
|
`+Ie}else t=f(t,z)}else if(t.includes("<body"))t=t.replace(/<body([^>]*)>/,`<body$1>
|
|
1464
1464
|
${z}`);else t=z+`
|
|
1465
|
-
`+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-
|
|
1465
|
+
`+t}{let{scanScriptTags:X}=await o("stx/signal-processing",()=>import("./chunk-g9s2t064.js")),z=[];for(let ee of X(t)){if(!/\bserver\b/i.test(ee.attrs))continue;let be=ee.start+ee.fullMatch.indexOf(">")+1,oe=Mr(t,be);if(oe===-1)continue;let he=oe+9;while(he<t.length&&/\s/.test(t[he]))he++;z.push({start:ee.start,end:he})}if(z.length>0){let ee=Array(z.length+1),be=0;for(let oe=0;oe<z.length;oe++){let{start:he,end:Ie}=z[oe];ee[oe]=t.slice(be,he),be=Ie}ee[z.length]=t.slice(be),t=ee.join("")}}let yt=ao(t,l);if(yt.hasScoped)t=yt.html;let jr=e.__stx_event_bindings||[],rt=!1,bt=[],Nr=/\s:[a-z][\w.-]*\s*=/.test(t),{scanScriptTags:Hr}=await o("stx/signal-processing",()=>import("./chunk-g9s2t064.js"));for(let X of Hr(t,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))bt.push({match:X.fullMatch,attrs:X.attrs,content:X.body});for(let{match:X,attrs:z,content:ee}of bt){rt=!0;let be=ee;Ke(ee,l,a.strict,e.__originalFilePath);let oe=await Je(ee,{eventBindings:jr,attrs:z,hasColonDirectives:Nr,templateContent:r,filePath:l,projectRoot:process.cwd(),production:sa(a.buildMode,a.minifyClient),serverData:ie});t=t.replace(X,()=>oe)}if(rt)e.__stx_event_bindings=[];if(!rt&&e.__stxProcessingDepth===1){let X=e.__stx_event_bindings||[];if(X.length>0){let z=Mi(X);if(z){let ee=c(t);t=ee===-1?t+z:t.slice(0,ee)+z+`
|
|
1466
1466
|
`+t.slice(ee)}e.__stx_event_bindings=[]}}if(!p.skipSignalsRuntime&&!Ae(t)&&Bc(t))t=await Cr(t,p);if(t=Fc(t),p.csp?.enabled&&p.csp.useNonce&&typeof e.cspNonce==="string")t=It(t,e.cspNonce);return t}
|
|
1467
1467
|
export{Pt,Ue,Oc,Es,si,oi,br,i};
|