@stacksjs/stx 0.2.821 → 0.2.824
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-0dvgrqt8.js → chunk-01d9sd40.js} +1 -1
- package/dist/{chunk-3rkh5etz.js → chunk-0hs4nee7.js} +1 -1
- package/dist/{chunk-rx59bmnb.js → chunk-0vtdhckb.js} +1 -1
- package/dist/{chunk-079g8e4w.js → chunk-12g7me4m.js} +1 -1
- package/dist/{chunk-ktna9keb.js → chunk-281eg1pf.js} +1 -1
- package/dist/{chunk-p1jzpgej.js → chunk-36ga0q0r.js} +103 -103
- package/dist/{chunk-zn378280.js → chunk-3smq9j5a.js} +1 -1
- package/dist/chunk-4ka2g6bp.js +2 -0
- package/dist/{chunk-enhys344.js → chunk-56brw839.js} +1 -1
- package/dist/{chunk-nfxgpjhk.js → chunk-5rxd1r60.js} +19 -19
- package/dist/{chunk-3dnkp861.js → chunk-7vvhdrby.js} +1 -1
- package/dist/chunk-88th2wz6.js +2 -0
- package/dist/{chunk-wysfprwt.js → chunk-8nb1z4af.js} +1 -1
- package/dist/{chunk-9wab73nn.js → chunk-97d46jvh.js} +32 -32
- package/dist/chunk-9cp6whxd.js +2 -0
- package/dist/{chunk-ygwgegyb.js → chunk-9cpg01sv.js} +1 -1
- package/dist/{chunk-2c6qbvne.js → chunk-9r0cx3k4.js} +2 -2
- package/dist/{chunk-te2c0qpt.js → chunk-a2xy4z6q.js} +1 -1
- package/dist/{chunk-jyz2g48d.js → chunk-akd4f3pg.js} +1 -1
- package/dist/{chunk-gxg4vvws.js → chunk-aq5xxevm.js} +1 -1
- package/dist/chunk-aqesy5ac.js +2 -0
- package/dist/{chunk-r29repjv.js → chunk-c9dywwkx.js} +5 -5
- package/dist/{chunk-4wjsfq4s.js → chunk-caz5a61p.js} +1 -1
- package/dist/{chunk-kqq896j6.js → chunk-ccvcq9ve.js} +1 -1
- package/dist/chunk-cknd3nb7.js +2 -0
- package/dist/{chunk-dpndrajq.js → chunk-cqq026d3.js} +1 -1
- package/dist/chunk-crxtxw1d.js +2 -0
- package/dist/{chunk-zvwenqn3.js → chunk-ct4qnbtn.js} +1 -1
- package/dist/{chunk-966f94qx.js → chunk-d6jcyxad.js} +1 -1
- package/dist/{chunk-vxxcn14a.js → chunk-dd74gjmv.js} +1 -1
- package/dist/{chunk-nxfkkmxy.js → chunk-ejr5k9np.js} +1 -1
- package/dist/chunk-ezm9jzz1.js +2 -0
- package/dist/chunk-f6dm5a98.js +2 -0
- package/dist/{chunk-817rcghe.js → chunk-fr1585t7.js} +1 -1
- package/dist/{chunk-pvrew37s.js → chunk-h1djr7rt.js} +1 -1
- package/dist/{chunk-wpam70s6.js → chunk-hgwkrd4d.js} +1 -1
- package/dist/{chunk-cveanyb3.js → chunk-jbv8197c.js} +1 -1
- package/dist/{chunk-xe1qxxhs.js → chunk-jkyw0xmt.js} +1 -1
- package/dist/{chunk-d457yx0w.js → chunk-jntc0v38.js} +1 -1
- package/dist/{chunk-0dzmw98y.js → chunk-jy0tvbtg.js} +1 -1
- package/dist/{chunk-pp7ehbxj.js → chunk-k5s6ngaf.js} +2 -2
- package/dist/chunk-kd8w41p2.js +3 -0
- package/dist/{chunk-fqxcs1h1.js → chunk-kfvbd9c9.js} +1 -1
- package/dist/{chunk-8724whyk.js → chunk-kgjtq6fb.js} +4 -4
- package/dist/{chunk-qdea9cew.js → chunk-kqbkvfmg.js} +1 -1
- package/dist/{chunk-k90sf0w8.js → chunk-n2zger20.js} +1 -1
- package/dist/{chunk-z3s9rvyh.js → chunk-n5kg8njw.js} +2 -2
- package/dist/{chunk-ctygc783.js → chunk-nfzm71pr.js} +2 -2
- package/dist/{chunk-npdmeesx.js → chunk-nx6kvnhw.js} +1 -1
- package/dist/{chunk-9gpdkqzn.js → chunk-phs7n6tk.js} +1 -1
- package/dist/{chunk-t4ndn1kf.js → chunk-pxm90y95.js} +1 -1
- package/dist/{chunk-242qc25m.js → chunk-q5vej1ft.js} +4 -4
- package/dist/{chunk-4ff1hdsh.js → chunk-qsdwmymw.js} +1 -1
- package/dist/{chunk-matr6j2d.js → chunk-skh6pwy7.js} +1 -1
- package/dist/chunk-stp2hgag.js +2 -0
- package/dist/{chunk-2b8pyef0.js → chunk-t9hrbrw0.js} +4 -4
- package/dist/{chunk-5v1gp0g1.js → chunk-vvvaf66t.js} +56 -10
- package/dist/{chunk-73h35m0a.js → chunk-w01f9n4r.js} +6 -6
- package/dist/{chunk-a6tajb47.js → chunk-w992as39.js} +4 -4
- package/dist/{chunk-rvdsbthd.js → chunk-wfh3g5w4.js} +2 -2
- package/dist/{chunk-wers7czp.js → chunk-x4pzwbns.js} +1 -1
- package/dist/{chunk-pmk33n5r.js → chunk-xjtm9gde.js} +1 -1
- package/dist/chunk-y9ak2xcy.js +2 -0
- package/dist/{chunk-c0gj3pty.js → chunk-z73wddy9.js} +1 -1
- package/dist/{chunk-zk88r1yh.js → chunk-zb3g4qvd.js} +24 -24
- package/dist/{chunk-22ekceg9.js → chunk-zxnfpy6r.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/client/signals-component-props-runtime.js +26 -2
- package/dist/client/signals-dom-ready-runtime.js +2 -0
- package/dist/client/signals-expression-runtime.js +4 -0
- package/dist/client/signals-for-runtime.js +14 -2
- package/dist/client/signals-native-row-runtime.js +2 -1
- package/dist/client/signals-process-element-runtime.js +1 -0
- package/dist/client/signals-spa-load-runtime.js +2 -0
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/misc-directives.d.ts +2 -0
- package/dist/misc-directives.js +27 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +11 -11
- package/dist/utils.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-3xc2bg6x.js +0 -2
- package/dist/chunk-856zaqcm.js +0 -2
- package/dist/chunk-adsyh38d.js +0 -2
- package/dist/chunk-fb41ty71.js +0 -2
- package/dist/chunk-hzrdtg2s.js +0 -2
- package/dist/chunk-k9g43d24.js +0 -3
- package/dist/chunk-khcb6pm1.js +0 -2
- package/dist/chunk-kqgpd3ee.js +0 -2
- package/dist/chunk-w6nkp7b7.js +0 -2
- package/dist/chunk-ytrg9ghh.js +0 -2
- package/dist/chunk-z09sgx0d.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ba,au,Fn,Om,cu,lu,uu,Nm}from"./chunk-
|
|
2
|
+
import{ba,au,Fn,Om,cu,lu,uu,Nm}from"./chunk-01d9sd40.js";import"./chunk-36ga0q0r.js";import"./chunk-kfvbd9c9.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{Fn as Validator,au as defineForm,cu as processErrorDirective,lu as processErrorsDirective,Nm as processFormValidationDirectives,uu as processHasErrorsDirective,ba as useForm,Om as v};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Lr,so,Fg,El,oo}from"./chunk-
|
|
2
|
+
import{Lr,so,Fg,El,oo}from"./chunk-nfzm71pr.js";export{Fg as buildModuleRegistryScript,oo as buildSharedModuleRegistries,El as exportsMutableBinding,Lr as registeredModuleIdsIn,so as registeredModuleNamesIn};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ia,Qg,aa,em,jl,Bl,tm,nm}from"./chunk-n2zger20.js";import"./chunk-jkyw0xmt.js";import"./chunk-9r0cx3k4.js";import"./chunk-56brw839.js";import"./chunk-7sh9fa3q.js";import"./chunk-kgjtq6fb.js";import"./chunk-w992as39.js";import"./chunk-2nj9aewf.js";import"./chunk-n5kg8njw.js";import"./chunk-x4pzwbns.js";import"./chunk-k81trehg.js";import"./chunk-wf0n9gpj.js";import"./chunk-xpy9yjyx.js";import"./chunk-qj4r08jb.js";import{Pt,Zf}from"./chunk-36ga0q0r.js";import"./chunk-kfvbd9c9.js";import"./chunk-2vqpz4qv.js";import"./chunk-8ttmzcxb.js";import"./chunk-r9e0r6jx.js";import"./chunk-bt0amey5.js";export{ia as buildScriptVirtualFile,Qg as buildVirtualSource,Pt as extractScriptBlocks,Zf as extractTemplateExpressions,jl as findRuntimeTypeDeclarations,Bl as findStxModuleDeclarations,nm as formatTypecheckDiagnostics,em as sourcePathFor,tm as typecheckStxFiles,aa as virtualPathFor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{T,u,f,A,d,q}from"./chunk-8ttmzcxb.js";import{H,Ps,Oe,de,kr,je,Be,s,h,Se,_}from"./chunk-
|
|
2
|
+
import{T,u,f,A,d,q}from"./chunk-8ttmzcxb.js";import{H,Ps,Oe,de,kr,je,Be,s,h,Se,_}from"./chunk-36ga0q0r.js";import{at}from"./chunk-bt0amey5.js";import{P}from"./chunk-r9e0r6jx.js";import{se}from"./chunk-wceg59n0.js";import{j,Ye}from"./chunk-cmnze7at.js";import{E,_n}from"./chunk-wpendr22.js";import C from"path";import{existsSync as St}from"fs";function ct(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=S.exec(i);while(n){let g=n.index,e=g+n[0].length-1,D=1,U=e+1;while(U<i.length&&D>0){if(i[U]==="(")D++;else if(i[U]===")")D--;U++}if(D!==0)break;let rt=i.substring(e+1,U-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(U),S.lastIndex=g+N.length,n=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,n=0,g=t.length,e=(N)=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]===N){n++;return}n++}},D=()=>{n++;while(n<g){if(t[n]==="\\"){n+=2;continue}if(t[n]==="`"){n++;return}if(t[n]==="$"&&t[n+1]==="{"){n+=2;let N=1;while(n<g&&N>0)if(t[n]==="{")N++,n++;else if(t[n]==="}")N--,n++;else if(t[n]==="'"||t[n]==='"')e(t[n]);else if(t[n]==="`")D();else n++;continue}n++}},U=()=>{if(t[n]==="/"&&t[n+1]==="/"){while(n<g&&t[n]!==`
|
|
3
3
|
`)n++;return!0}if(t[n]==="/"&&t[n+1]==="*"){n+=2;while(n<g-1&&!(t[n]==="*"&&t[n+1]==="/"))n++;return n+=2,!0}return!1},rt=()=>{if(S!==0)return;let N=t.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let Z=N[2];if(!i.has(Z))c.push(Z),i.add(Z);return}let et=t.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let Z=et[1];if(!i.has(Z))c.push(Z),i.add(Z);return}let Y=t.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let Z=Y[1];if(!i.has(Z))c.push(Z),i.add(Z)}};while(n<g){if(U())continue;if(t[n]==="'"||t[n]==='"'){e(t[n]);continue}if(t[n]==="`"){D();continue}if(t[n]==="{"){S++,n++;continue}if(t[n]==="}"){S--,n++;continue}if(S===0&&/[a-z]/i.test(t[n])&&(n===0||/\s|[;{}()]/.test(t[n-1])))rt();n++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${at("var",c)}
|
|
@@ -44,10 +44,10 @@ ${n}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return c+a+i}function It(a,t){if(j(a)){let S=j(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ye(a,(n,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),n=i.match(/data-stx-scope="([^"]*)"/);if(n)return{html:a,mergedIntoExisting:n[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Ah(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Of(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(c))!==null){let e=g[1]==="/",D=g[2],U=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!U)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Je=new T(500),ac=new Set;function Ph(){ac.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return ac}async function is(a,t,c,i,S,n=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),r=`${c}:${p}`;if(D.has(r))return"";return D.add(r),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")")r--;w++}if(r!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],W=U(O,g,c),R="";if(W&&await Bun.file(W).exists())S.add(W),R=`@include(${l})`;e=e.substring(0,x)+R+e.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let r=p.index,w=r+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),W=ct(O,0);if(W===-1){x.lastIndex=o;continue}let R=O.substring(0,W).trim(),V=O.substring(W+1).trim(),z=V.match(/^\s*['"]([^'"]+)['"]/);if(!z){x.lastIndex=o;continue}let b=z[1],J=V.substring(z[0].length),B,I=ct(J,0);if(I!==-1)B=J.substring(I+1).trim();try{let M=`Boolean(${R})`,L;if(f(M)){let it=d(M,Object.keys(t));L=Boolean(it(...Object.values(t)))}else L=Boolean(u(M,t));let tt=k?!L:L,nt="";if(tt){let it=U(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,r)+nt+e.substring(o),x.lastIndex=0}catch(M){let L=M instanceof Error?M.message:String(M),tt=h("Include",`Error evaluating ${m} condition: ${L}`,c,a,r);e=e.substring(0,r)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,W,R,V,z]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let I of b){let M={...t,[V]:I},L=await et(W,M,a,x);B+=L}else if(z)B=await et(z,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let W=O[1],R=l.slice(O[0].length),V,z=R.match(/^\s*,\s*\{/);if(z){R=R.slice(z[0].length-1);let B=1,I=1;while(I<R.length&&B>0){if(R[I]==="{")B++;else if(R[I]==="}"){if(B--,B===0)break}I++}V=R.substring(0,I+1),R=R.slice(I+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(W.replace(/'/g,'"')),I={};if(V)try{I=A(V,t)}catch(L){let tt=L instanceof Error?L.message:String(L);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let M=!1;for(let L of B){let tt=U(L,g,c);if(!tt)continue;if(await s(tt)){let nt=await et(L,I,a,x);e=e.replace(o,()=>nt),M=!0;break}}if(!M)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let L=h("Include",`None of the includeFirst paths exist: ${W}`,c,a,x,o);e=e.replace(o,()=>L)}else e=e.replace(o,"")}catch(B){let I=B instanceof Error?B.message:String(B),M=h("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}m.lastIndex=0}}function U(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let r=C.resolve(k),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let z of i._layerPartialDirs??[]){let b=C.resolve(z,p);if(b.startsWith(`${C.resolve(z)}${C.sep}`)&&St(b))return b}l=C.resolve(k,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(r+C.sep)||o===r,W=o.startsWith(w+C.sep)||o===w,R=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))R=!0}if(!O&&!W&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${r}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);n.add(rt);function N(m,k,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:k,partialsDir:g}),h("Include",k,c,x,p)}async function et(m,k={},x,p){let r=U(m,g,c);if(!r)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(r);if(n.has(w)){let l=[...n,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(r);let l;if(!l)try{l=await Bun.file(r).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-
|
|
47
|
+
})();`;return c+a+i}function It(a,t){if(j(a)){let S=j(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ye(a,(n,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),n=i.match(/data-stx-scope="([^"]*)"/);if(n)return{html:a,mergedIntoExisting:n[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Ah(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Of(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=n.exec(c))!==null){let e=g[1]==="/",D=g[2],U=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!U)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Je=new T(500),ac=new Set;function Ph(){ac.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return ac}async function is(a,t,c,i,S,n=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,k,x)=>{let p=k.trim(),r=`${c}:${p}`;if(D.has(r))return"";return D.add(r),k});{let m=/@includeIf\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")")r--;w++}if(r!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],W=U(O,g,c),R="";if(W&&await Bun.file(W).exists())S.add(W),R=`@include(${l})`;e=e.substring(0,x)+R+e.substring(w),m.lastIndex=0}}for(let[m,k]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let r=p.index,w=r+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),W=ct(O,0);if(W===-1){x.lastIndex=o;continue}let R=O.substring(0,W).trim(),V=O.substring(W+1).trim(),z=V.match(/^\s*['"]([^'"]+)['"]/);if(!z){x.lastIndex=o;continue}let b=z[1],J=V.substring(z[0].length),B,I=ct(J,0);if(I!==-1)B=J.substring(I+1).trim();try{let M=`Boolean(${R})`,L;if(f(M)){let it=d(M,Object.keys(t));L=Boolean(it(...Object.values(t)))}else L=Boolean(u(M,t));let tt=k?!L:L,nt="";if(tt){let it=U(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,r)+nt+e.substring(o),x.lastIndex=0}catch(M){let L=M instanceof Error?M.message:String(M),tt=h("Include",`Error evaluating ${m} condition: ${L}`,c,a,r);e=e.substring(0,r)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,W,R,V,z]=O;try{let b,J=R.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let I of b){let M={...t,[V]:I},L=await et(W,M,a,x);B+=L}else if(z)B=await et(z,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,k;while((k=m.exec(e))!==null){let x=k.index,p=x+k[0].length-1,r=1,w=p+1;while(w<e.length&&r>0){if(e[w]==="(")r++;else if(e[w]===")"){if(r--,r===0)break}w++}if(r!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let W=O[1],R=l.slice(O[0].length),V,z=R.match(/^\s*,\s*\{/);if(z){R=R.slice(z[0].length-1);let B=1,I=1;while(I<R.length&&B>0){if(R[I]==="{")B++;else if(R[I]==="}"){if(B--,B===0)break}I++}V=R.substring(0,I+1),R=R.slice(I+1)}let b,J=R.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(W.replace(/'/g,'"')),I={};if(V)try{I=A(V,t)}catch(L){let tt=L instanceof Error?L.message:String(L);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let M=!1;for(let L of B){let tt=U(L,g,c);if(!tt)continue;if(await s(tt)){let nt=await et(L,I,a,x);e=e.replace(o,()=>nt),M=!0;break}}if(!M)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let L=h("Include",`None of the includeFirst paths exist: ${W}`,c,a,x,o);e=e.replace(o,()=>L)}else e=e.replace(o,"")}catch(B){let I=B instanceof Error?B.message:String(B),M=h("Include",`Error processing @includeFirst: ${I}`,c,a,x,o);e=e.replace(o,()=>M)}m.lastIndex=0}}function U(m,k,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let r=C.resolve(k),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let z of i._layerPartialDirs??[]){let b=C.resolve(z,p);if(b.startsWith(`${C.resolve(z)}${C.sep}`)&&St(b))return b}l=C.resolve(k,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(r+C.sep)||o===r,W=o.startsWith(w+C.sep)||o===w,R=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))R=!0}if(!O&&!W&&!R)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${r}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);n.add(rt);function N(m,k,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:k,partialsDir:g}),h("Include",k,c,x,p)}async function et(m,k={},x,p){let r=U(m,g,c);if(!r)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(r);if(n.has(w)){let l=[...n,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(r);let l;if(!l)try{l=await Bun.file(r).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-d6jcyxad.js");l=v(l,t)}if(l&&(i.debug||!E()&&!_n()))try{let{warnUnbalancedTags:v}=await import("./chunk-kgn911k7.js");v(l,r)}catch{}try{let{processESImports:v}=await import("./chunk-hgwkrd4d.js");l=await v(l,t,r,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${r}:`,v instanceof Error?v.message:v)}let o=l,O=de(o);if(O)o=O.content.trim();let R=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(R)V=`<style${R[1]}>${R[2]}</style>`;let z=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,K,y)=>{if(!ft(K))return"";return z.push({attrs:K,body:y}),`__STX_DATA_BLOCK_${z.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=Se(l,r);for(let[v,K]of Object.entries(k))b[v]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((v,K)=>{let y=(v[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(y)}),I="",M=null,L=!1,tt=!1;for(let v of B){let K=v[1]||"",y=v[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=je(K);if(!X&&!/\bsrc\s*=/i.test(K))Oe(y,r,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-cqq026d3.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-fr1585t7.js"),st=F(y,{filePath:r,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${r}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Be(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-fr1585t7.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-phs7n6tk.js");if(st(y))y=await bt(y,r,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${r}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-xjtm9gde.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-fr1585t7.js"),st=Q(y,F(b));if(st)y=`${st}
|
|
48
48
|
${y}`}if(dt&&!X){L=!0,M=ut(r,t);let F=P(y),Q=gt(F,M);I+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}">${Q}</script>
|
|
49
|
-
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-
|
|
50
|
-
`}}if(z.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-zxnfpy6r.js");await F(y,b,r)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${r}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();M=ut(r,t);let Q=P(y),st=gt(Q,M);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;I+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${M}"${F?` ${F}`:""}>${st}</script>
|
|
50
|
+
`}}if(z.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-cqq026d3.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,y)=>{let X=z[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(M){let v=It(o,M);if(o=v.html,v.mergedIntoExisting){let y=M,X=v.mergedIntoExisting;I=I.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),M=X}else if(!v.stamped&&L&&!lt.has(r))lt.add(r),console.warn(`[stx] ${C.relative(process.cwd(),r)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(L||tt)&&!pt.has(r)){let y=Of(o);if(y.length>1)pt.add(r),console.warn(`[stx] ${C.relative(process.cwd(),r)} declares ${L?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=v.stamped&&v.root!==null&&kr(v.root);I=Rt(I,K?M:null)}if(o.includes("@include")||o.includes("@partial"))o=await is(o,b,r,i,S,n);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-f6dm5a98.js"),G=nt(o,b,r,void 0,!0);G=se(G,b,r),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-vafxrky2.js");if(G=ht(G,b,r,i),G=_t(G,b,r),G=xt(G,b,r,i),G=_(G,b,r),V)G+=`
|
|
51
51
|
`+V;if(I)G+=`
|
|
52
52
|
`+I;return G}catch(l){if(l instanceof q)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,Z;while((Z=Y.exec(e))!==null){let m=Z.index,k=m+Z[0].length-1,x=1,p=k+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let r=e.substring(m,p),w=e.substring(k+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,W=w.substring(l[0].length),R=ct(W,0);if(R!==-1)O=W.substring(R+1).trim();let V={};if(O)try{V=A(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(r,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let z=await et(o,V,a,m);e=e.substring(0,m)+z+e.substring(p),Y.lastIndex=0}return e}function as(a,t){let c=a;function i(S,n,g,e){let D=S,U=!0;while(U){U=!1;let rt=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),N=D.match(rt);if(!N||N.index===void 0)break;let et=N.index,Y=N[1],Z=et+N[0].length,m=new RegExp(`@${n}\\(`),k=new RegExp(`@${g}(?![a-z])`),x=1,p=Z,r=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(k),W=o?p+o.index:1/0,R=O?p+O.index:1/0;if(W<R)x++,p=W+(o[0].length||1);else if(R<1/0){if(x--,x===0){r=R;break}p=R+g.length+1}else break}if(r===-1)break;let w=D.slice(Z,r);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(r+`@${g}`.length),U=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function cs(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
|
|
53
53
|
`)})}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{hl,yl,bl}from"./chunk-bt0amey5.js";import{le,Vn,Un,vo,Gr,Jr,Wn,qn,xo,Yr}from"./chunk-y8p85kcj.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,h=(p)=>r.get?r.get(p):p,a=()=>h(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let f=o(),t=r.set?r.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let f=e.subscribe((t,i)=>p(h(t),h(i)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>h(a.error),a.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,h)=>y().then((a)=>new Promise((p,f)=>{let t=a.transaction("kv",u),i=h(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>s("readonly",(h)=>h.get(u)),set:(u,h)=>s("readwrite",(a)=>{a.put(h,u)}),remove:(u)=>s("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>s("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,h=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,f=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return i;let n=Array.from(f.entries());return f.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?h(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let C=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,V=()=>{C.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),V()})};if(!S)W(E);let xt=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),V(),!b)W(E)},St=(w,b)=>{let T=m.timeoutMs||15000,I=typeof AbortController<"u"?new AbortController:null,O=null,H=new Promise((D,F)=>{O=setTimeout(()=>{if(I)I.abort();F(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:I?I.signal:void 0});else if(b){let D=m.fetch||((L,j)=>fetch(L,j)),F={method:"GET",headers:{Accept:"application/json"}};if(w)F.cache="no-cache";if(I)F.signal=I.signal;A=D(b,F).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((j)=>{throw Error(j&&(j.error||j.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(C());return Promise.race([A,H]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),I=()=>{if(b!==R)return Promise.resolve(C());if(x++,q.set(!0),c===0&&!M())U.set(!0);let H=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return St(w,T).then((A)=>{if(b!==R||T!==N())return H(),C();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),V(),H(),C()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return H(),C()})},O=`${b} ${T||""}`;return w?v.fresh(O,I):v.run(O,I)},B={data:C,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(xt(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(C());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),V()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);V()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let a={key:s,promise:h};l.push(a);let p=()=>{let f=l.indexOf(a);if(f!==-1)l.splice(f,1)};return h.then(p,p),h};return{run(s,u){for(let h of l)if(o(h.key,s))return h.promise;for(let h of r)if(o(h.key,s))return h.promise;return y(s,u)},fresh(s,u){for(let f of r)if(o(f.key,s))return f.promise;let h=l.filter((f)=>o(f.key,s)).map((f)=>f.promise);if(!h.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(a);if(f!==-1)r.splice(f,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),h=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:f}=await u.read();if(p)break;if(a+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
2
|
+
import{hl,yl,bl}from"./chunk-bt0amey5.js";import{le,Vn,Un,vo,Gr,Jr,Wn,qn,xo,Yr}from"./chunk-y8p85kcj.js";function z(e,o,l,r,d,y){let s=!0,u=new Set,h=(p)=>r.get?r.get(p):p,a=()=>h(e());return Object.defineProperty(a,"_isSignal",{value:!0}),Object.defineProperty(a,"modifiers",{get:o}),a.set=(p)=>{if(!s)return;let f=o(),t=r.set?r.set(p,f):p;if(f.trim&&typeof t==="string")t=t.trim();if(f.number&&typeof t==="string"&&t!==""){let i=Number(t);if(!Number.isNaN(i))t=i}if(Object.is(e(),t))return;e.set(t),l(t)},a.update=(p)=>a.set(p(a())),a.input=(p)=>{if(!o().lazy)a.set(p)},a.change=(p)=>{if(o().lazy)a.set(p)},a.subscribe=(p)=>{if(!s)return()=>{};let f=e.subscribe((t,i)=>p(h(t),h(i)));return u.add(f),()=>{f(),u.delete(f)}},Object.defineProperty(a,"value",{get:a,set:a.set}),d(()=>{s=!1,u.forEach((p)=>p()),u.clear()}),y?.(()=>{s=!0}),a}function X(e,o=!0,l){if(!o||!e||typeof window>"u")return;let r=window;if(!r.__STX_DATA__){let y=document.querySelector("script[data-stx-server-data]");try{let s=JSON.parse(y?.textContent||"{}");r.__STX_DATA__=s&&typeof s==="object"&&!Array.isArray(s)?s:{}}catch{r.__STX_DATA__={}}}let d=r.__STX_DATA__;if(d&&Object.prototype.hasOwnProperty.call(d,e))try{return{data:l?l(d[e]):d[e]}}catch(y){return{data:null,error:y instanceof Error?y:Error(String(y))}}return}function Q(e){if(typeof window>"u")return;let o=window;if(e===void 0)o.__STX_DATA__={};else{if(!o.__STX_DATA__)try{let l=JSON.parse(document.querySelector("script[data-stx-server-data]")?.textContent||"{}");o.__STX_DATA__=l&&typeof l==="object"&&!Array.isArray(l)?l:{}}catch{o.__STX_DATA__={}}if(o.__STX_DATA__)delete o.__STX_DATA__[e]}}function Y(e){let o=null;try{o=typeof indexedDB<"u"?indexedDB:null}catch{o=null}if(!o)return null;let l=o,r=e||"stx-kept",d=null,y=()=>{if(!d)d=new Promise((u,h)=>{let a=l.open(r,1);a.onupgradeneeded=()=>{a.result.createObjectStore("kv")},a.onsuccess=()=>u(a.result),a.onerror=()=>h(a.error),a.onblocked=()=>h(Error("blocked"))}),d.catch(()=>{d=null});return d},s=(u,h)=>y().then((a)=>new Promise((p,f)=>{let t=a.transaction("kv",u),i=h(t.objectStore("kv"));t.oncomplete=()=>p(i?i.result:void 0),t.onerror=()=>f(t.error),t.onabort=()=>f(t.error)}));return{get:(u)=>s("readonly",(h)=>h.get(u)),set:(u,h)=>s("readwrite",(a)=>{a.put(h,u)}),remove:(u)=>s("readwrite",(h)=>{h.delete(u)}),removePrefix:(u)=>s("readwrite",(h)=>{h.delete(IDBKeyRange.bound(u,`${u}\uFFFF`))})}}function J(e,o){let l=e||{},r=null;if(l.storage!==void 0)r=l.storage;else try{r=typeof localStorage<"u"?localStorage:null}catch{r=null}let d=null,y=l.backend!==void 0;if(y)d=l.backend||null;let s=()=>{if(y)return d;y=!0;try{d=o?o():null}catch{d=null}if(d){let n=d;n.get("__stx_probe__").catch(()=>{if(d===n)d=null})}return d},u=l.limit||32768,h=l.defer||((n)=>{let c=typeof requestIdleCallback==="function"?requestIdleCallback:null;if(c)c(n,{timeout:200});else setTimeout(n,16)}),a=new Map,p=new Set,f=new Map,t=!1,i=Promise.resolve(),g=(n)=>{try{return JSON.parse(n)}catch{return n}},m=(n,c)=>{if(!r)return!1;try{return r.setItem(n,c),!0}catch{return!1}},_=(n)=>{try{if(r)r.removeItem(n)}catch{}},k=()=>{if(t=!1,!f.size)return i;let n=Array.from(f.entries());return f.clear(),i=i.then(()=>Promise.all(n.map(([c,v])=>{if(!d){p.delete(c);try{m(c,JSON.stringify(v===void 0?null:v))}catch{}return}let x;try{return x={v},d.set(c,x).catch(()=>{let S;try{S=JSON.stringify(v)}catch{return}return d?d.set(c,{j:S}).catch(()=>{m(c,S)}):void 0})}catch{return}}))).then(()=>{}),i},N=(n,c)=>{if(f.set(n,c),p.add(n),t)return;t=!0,h(()=>{k()})},P=(n)=>{if(!n||typeof n!=="object")return;let c=n;if("v"in c)return{value:c.v};if(typeof c.j==="string")return{value:g(c.j)};return},E={peek(n){if(a.has(n))return{value:a.get(n)};let c=null;try{c=r?r.getItem(n):null}catch{c=null}if(c===null||c===void 0)return;let v=g(c);return a.set(n,v),{value:v}},load(n){let c=E.peek(n),v=c?null:s();if(c||!v)return Promise.resolve(c);return v.get(n).then((x)=>{if(a.has(n))return{value:a.get(n)};let S=P(x);if(S)a.set(n,S.value),p.add(n);return S},()=>{return})},set(n,c){if(a.set(n,c),d&&p.has(n)){N(n,c);return}let v;try{v=JSON.stringify(c===void 0?null:c)}catch{return}if(v.length<=u&&m(n,v))return;if(!s()){if(v.length>u)m(n,v);return}_(n),N(n,c)},forget(n){for(let v of Array.from(a.keys()))if(v.indexOf(n)===0)a.delete(v);for(let v of Array.from(f.keys()))if(v.indexOf(n)===0)f.delete(v);for(let v of Array.from(p))if(v.indexOf(n)===0)p.delete(v);try{if(r)for(let v=r.length-1;v>=0;v--){let x=r.key(v);if(x&&x.indexOf(n)===0)r.removeItem(x)}}catch{}let c=s();if(!c)return i;return i=i.then(()=>c.removePrefix(n)).catch(()=>{}),i},flush(){return k()}};try{if(typeof document<"u"&&document.addEventListener)document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden")k()});if(typeof addEventListener==="function")addEventListener("pagehide",()=>{k()})}catch{}return E}function Z(e,o){if(!e)return!1;if(e===o.key)return!0;if(!o.url)return!1;if(e===o.url)return!0;try{let l=typeof location<"u"&&location.origin&&location.origin!=="null"?location.origin:"http://localhost",r=new URL(e,l),d=new URL(o.url,l);if(r.origin!==d.origin||r.pathname!==d.pathname)return!1;return!r.search||r.search===d.search}catch{return!1}}function ee(e){let o=e.prefix||"stx:kept:",l=e.matches||((t,i)=>t===i.key||t===i.url),r=new Set,d=new Map,y,s=(t)=>t===void 0?y:t,u=(t,i)=>{let g=s(i);if(g===!1||g===null||g==="")return null;return`${o}${g===void 0?"":`${g}:`}query:${t}`},h=(t)=>{let i=t&&t.value;if(!i||typeof i!=="object"||!("d"in i))return;return{data:i.d,at:Number(i.at)||0}},a=()=>{let t=globalThis;return t.__stx_outboxes instanceof Map?t.__stx_outboxes:null},p={setScope(t){y=t},scope:()=>y,keyFor:u,seed(t,i){let g=u(t,i);return g?h(e.kept.peek(g)):void 0},restore(t,i){let g=u(t,i);return g?e.kept.load(g).then(h):Promise.resolve(void 0)},persist(t,i,g){let m=u(t,g);if(m)e.kept.set(m,{d:i,at:Date.now()})},overlay(t,i,g){let m=a();if(!m||!m.size)return i;let _=i;return m.forEach((k)=>{try{_=k.overlay(t,_,g)}catch{}}),_},watch(t){return r.add(t),()=>{r.delete(t)}},cachedQuery(t,i){let g=d.get(t);if(g){if(i&&g.__options)g.__options(i);return g}let m=i||{},_=m.initial===void 0?null:m.initial,k=()=>typeof m.scope==="function"?m.scope():m.scope,N=()=>(typeof m.url==="function"?m.url():m.url)||null,P=()=>({key:t,url:N()}),E=k(),n=_,c=0,v=e.sharedRequest(),x=0,S=p.seed(t,E);if(S)n=S.data;let C=e.state(p.overlay(P(),n)),U=e.state(!1),q=e.state(!1),K=e.state(null),M=e.state(S?S.at:0),R=0,V=()=>{C.set(p.overlay(P(),n))},W=(w)=>{let b=R;p.restore(t,w).then((T)=>{if(!T||b!==R||c)return;n=T.data,M.set(T.at),V()})};if(!S)W(E);let xt=()=>{let w=k();if(w===E)return;E=w,R++,x=0,q.set(!1),U.set(!1),c=0;let b=p.seed(t,E);if(n=b?b.data:_,M.set(b?b.at:0),V(),!b)W(E)},St=(w,b)=>{let T=m.timeoutMs||15000,I=typeof AbortController<"u"?new AbortController:null,O=null,j=new Promise((D,F)=>{O=setTimeout(()=>{if(I)I.abort();F(Error("The request took too long."))},T)}),A;if(m.load)A=m.load({force:w,url:b,signal:I?I.signal:void 0});else if(b){let D=m.fetch||((L,H)=>fetch(L,H)),F={method:"GET",headers:{Accept:"application/json"}};if(w)F.cache="no-cache";if(I)F.signal=I.signal;A=D(b,F).then((L)=>{if(!L.ok)return L.json().catch(()=>null).then((H)=>{throw Error(H&&(H.error||H.message)||`Request failed (${L.status})`)});return L.json()})}else return Promise.resolve(C());return Promise.race([A,j]).then((D)=>{if(O)clearTimeout(O);return m.transform?m.transform(D):D},(D)=>{if(O)clearTimeout(O);throw D})},G=(w)=>{let b=R,T=N(),I=()=>{if(b!==R)return Promise.resolve(C());if(x++,q.set(!0),c===0&&!M())U.set(!0);let j=()=>{if(b!==R)return;if(x=Math.max(0,x-1),!x)q.set(!1),U.set(!1)};return St(w,T).then((A)=>{if(b!==R||T!==N())return j(),C();return n=A,c=Date.now(),M.set(c),K.set(null),p.persist(t,A,E),V(),j(),C()},(A)=>{if(b===R&&T===N())K.set(A&&A.message?A.message:"Could not load.");return j(),C()})},O=`${b} ${T||""}`;return w?v.fresh(O,I):v.run(O,I)},B={data:C,loading:U,isFetching:q,error:K,updatedAt:M,get key(){return t},load(w){if(xt(),!w&&c&&Date.now()-c<(m.staleTime||0))return Promise.resolve(C());return G(!!w)},refresh(){return B.load(!0)},set(w){n=typeof w==="function"?w(n):w,p.persist(t,n,E),V()},invalidate(){c=0},__options(w){m={...m,...w}}};if(r.add({target:P,updated:()=>{if(c||M())G(!1)},outbox:(w)=>{if(w)n=p.overlay(P(),n,w.id),c=0,G(!0);V()}}),d.set(t,B),m.immediate)B.load();return B}},f=typeof window<"u"?window:typeof addEventListener==="function"?globalThis:null;if(e.listen!==!1&&f&&typeof f.addEventListener==="function")f.addEventListener("stx:updated",(t)=>{let i=t.detail||{};if(i.kind!=="api"||typeof i.url!=="string")return;r.forEach((g)=>{if(l(i.url,g.target()))g.updated()})}),f.addEventListener("stx:outbox",(t)=>{let i=t.detail||{},g=i.sent&&typeof i.sent.id==="string"?i.sent:null;r.forEach((m)=>{if(g){let _=Array.isArray(g.affects)?g.affects:[],k=m.target();if(!_.some((N)=>l(N,k)))return}m.outbox(g)})});return p}function te(e){let o=e&&e.covers||((s,u)=>Object.is(s,u)),l=[],r=[],d=0,y=(s,u)=>{let h;try{h=Promise.resolve(u())}catch(f){h=Promise.reject(f)}let a={key:s,promise:h};l.push(a);let p=()=>{let f=l.indexOf(a);if(f!==-1)l.splice(f,1)};return h.then(p,p),h};return{run(s,u){for(let h of l)if(o(h.key,s))return h.promise;for(let h of r)if(o(h.key,s))return h.promise;return y(s,u)},fresh(s,u){for(let f of r)if(o(f.key,s))return f.promise;let h=l.filter((f)=>o(f.key,s)).map((f)=>f.promise);if(!h.length)return y(s,u);let a={key:s,promise:null},p=()=>{};return a.promise=Promise.all(h.map((f)=>f.then(p,p))).then(()=>{let f=r.indexOf(a);if(f!==-1)r.splice(f,1);return y(s,u)}),r.push(a),a.promise},latest(){let s=++d;return()=>s===d},get busy(){return l.length>0||r.length>0}}}function ne(e){let o=!1,l=null,r=null,d=0;async function y(){if(o)return;l=new AbortController;try{let s=await e.request(e.endpoint,{signal:l.signal,cache:"no-store",headers:{Accept:"text/event-stream"}});if(!s.ok||!s.body||!s.headers.get("content-type")?.includes("text/event-stream"))throw Error("Broadcast stream unavailable");if(o){await s.body.cancel();return}let u=s.body.getReader(),h=new TextDecoder,a="";d=0,e.onStatus?.(!0),e.onConnected?.();try{while(!o){let{done:p,value:f}=await u.read();if(p)break;if(a+=h.decode(f,{stream:!0}).replace(/\r\n/g,`
|
|
3
3
|
`),a.length>1048576)throw Error("Broadcast frame too large");let t;while((t=a.indexOf(`
|
|
4
4
|
|
|
5
5
|
`))!==-1){let i=a.slice(0,t);a=a.slice(t+2);let g=i.split(`
|
|
@@ -1070,7 +1070,28 @@ else {
|
|
|
1070
1070
|
}
|
|
1071
1071
|
|
|
1072
1072
|
function resolveComponentCallerScope(el, pageScope) {
|
|
1073
|
-
|
|
1073
|
+
if (el && el.__stx_slot_scope) return el.__stx_slot_scope;
|
|
1074
|
+
if (el && el.__stx_for_scope) return el.__stx_for_scope;
|
|
1075
|
+
return projectedSlotCallerScope(el, pageScope) || componentCallerScopeFrom(el && (el.parentElement || el.parentNode), pageScope);
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
function projectedSlotCallerScope(el, pageScope) {
|
|
1079
|
+
if (el && el.__stx_row_scope) return el.__stx_row_scope;
|
|
1080
|
+
if (el && el.__stx_page_scope) return layerTemplateScopes(el.__stx_page_scope, pageScope);
|
|
1081
|
+
if (el && el.__stx_scope && !el.hasAttribute('data-stx-scope')) return el.__stx_scope;
|
|
1082
|
+
var owner = el && el.getAttribute && el.getAttribute('data-stx-slot-owner');
|
|
1083
|
+
if (!owner) return null;
|
|
1084
|
+
var receiver = el.parentElement || el.parentNode;
|
|
1085
|
+
while (receiver && receiver !== document) {
|
|
1086
|
+
if (receiver.__stx_row_scope) return receiver.__stx_row_scope;
|
|
1087
|
+
if (receiver.__stx_page_scope) return layerTemplateScopes(receiver.__stx_page_scope, pageScope);
|
|
1088
|
+
// A routed page or keyed row can replace the caller inside a persistent shell.
|
|
1089
|
+
if (receiver.__stx_scope && !receiver.hasAttribute('data-stx-scope')) return receiver.__stx_scope;
|
|
1090
|
+
if (receiver.getAttribute && (receiver.getAttribute('data-stx-template-scope') || receiver.getAttribute('data-stx-scope')) === owner)
|
|
1091
|
+
return receiver.__stx_parent_scope || componentCallerScopeFrom(receiver.parentElement || receiver.parentNode, pageScope);
|
|
1092
|
+
receiver = receiver.parentElement || receiver.parentNode;
|
|
1093
|
+
}
|
|
1094
|
+
return null;
|
|
1074
1095
|
}
|
|
1075
1096
|
|
|
1076
1097
|
// The caller scope for a component placed under \`current\`: the page's
|
|
@@ -1078,14 +1099,17 @@ else {
|
|
|
1078
1099
|
// loop row binds before it is inserted, so it asks from its future parent.
|
|
1079
1100
|
function componentCallerScopeFrom(current, pageScope) {
|
|
1080
1101
|
var ancestors = [];
|
|
1102
|
+
var projected = null;
|
|
1081
1103
|
while (current && current !== document) {
|
|
1082
1104
|
if (current.getAttribute && current.hasAttribute('data-stx-scope'))
|
|
1083
1105
|
ancestors.push(current.getAttribute('data-stx-scope'));
|
|
1106
|
+
projected = projectedSlotCallerScope(current, pageScope);
|
|
1107
|
+
if (projected) break;
|
|
1084
1108
|
current = current.parentElement || current.parentNode;
|
|
1085
1109
|
}
|
|
1086
1110
|
// Layered rather than copied: a copy of the page scope (hundreds of
|
|
1087
1111
|
// names) per component instance was a fifth of mounting a list of rows.
|
|
1088
|
-
var sources = [pageScope];
|
|
1112
|
+
var sources = [projected || pageScope];
|
|
1089
1113
|
ancestors.reverse().forEach(function(scopeId) {
|
|
1090
1114
|
var ancestorScope = window.stx._scopes && window.stx._scopes[scopeId];
|
|
1091
1115
|
if (ancestorScope) sources.push(ancestorScope);
|
|
@@ -1935,6 +1959,8 @@ else {
|
|
|
1935
1959
|
}
|
|
1936
1960
|
});
|
|
1937
1961
|
var pageScopeSnapshot = mergeTemplateScopes(componentScope);
|
|
1962
|
+
// A new document setup owns the page even when the host reuses its body.
|
|
1963
|
+
document.body.__stx_page_scope = pageScopeSnapshot;
|
|
1938
1964
|
|
|
1939
1965
|
/*
|
|
1940
1966
|
* Any x-data scope the reactive bridge did not reach, initialized here.
|
|
@@ -2725,12 +2751,16 @@ finally {
|
|
|
2725
2751
|
if (current.__stx_scope && (name === undefined || name in current.__stx_scope)) {
|
|
2726
2752
|
return current.__stx_scope;
|
|
2727
2753
|
}
|
|
2754
|
+
if (current.__stx_row_scope && (name === undefined || name in current.__stx_row_scope)) return current.__stx_row_scope;
|
|
2728
2755
|
if (current.hasAttribute && current.hasAttribute('data-stx-scope')) {
|
|
2729
2756
|
const scopeId = current.getAttribute('data-stx-scope');
|
|
2730
2757
|
if (window.stx._scopes && window.stx._scopes[scopeId] && (name === undefined || name in window.stx._scopes[scopeId])) {
|
|
2731
2758
|
return window.stx._scopes[scopeId];
|
|
2732
2759
|
}
|
|
2733
2760
|
}
|
|
2761
|
+
if (current.__stx_page_scope && (name === undefined || name in current.__stx_page_scope)) return current.__stx_page_scope;
|
|
2762
|
+
var projected = projectedSlotCallerScope(current, componentScope);
|
|
2763
|
+
if (projected && (name === undefined || name in projected)) return projected;
|
|
2734
2764
|
current = current.parentElement || current.parentNode;
|
|
2735
2765
|
}
|
|
2736
2766
|
return null;
|
|
@@ -3507,7 +3537,10 @@ catch (e) {
|
|
|
3507
3537
|
// Structural directives need a live parent. Keep the iteration
|
|
3508
3538
|
// scope on the clone until the keyed diff inserts it, then bind.
|
|
3509
3539
|
clone.__stx_for_scope = itemScope;
|
|
3510
|
-
if (
|
|
3540
|
+
if (!clone.hasAttribute('data-stx-scope')) {
|
|
3541
|
+
if (slotScopeInfo) clone.__stx_scope = itemScope;
|
|
3542
|
+
else clone.__stx_row_scope = itemScope;
|
|
3543
|
+
}
|
|
3511
3544
|
markLoopRow(clone, itemName, itemSignal);
|
|
3512
3545
|
}
|
|
3513
3546
|
elements.push(clone);
|
|
@@ -3515,8 +3548,17 @@ catch (e) {
|
|
|
3515
3548
|
elements.push(stxHost.anchor('stx-for-item-end'));
|
|
3516
3549
|
} else {
|
|
3517
3550
|
const clone = stxHost.clone(templateContent);
|
|
3551
|
+
// Projection selected the caller before cloning. The keyed iteration
|
|
3552
|
+
// now owns its scope and must retain the new item/index bindings.
|
|
3553
|
+
if (clone.hasAttribute('data-stx-slot-owner')) {
|
|
3554
|
+
clone.removeAttribute('data-stx-slot-owner');
|
|
3555
|
+
if (!clone.hasAttribute('data-stx-scope')) clone.__stx_row_scope = itemScope;
|
|
3556
|
+
}
|
|
3518
3557
|
clone.__stx_for_scope = itemScope;
|
|
3519
|
-
if (
|
|
3558
|
+
if (!clone.hasAttribute('data-stx-scope')) {
|
|
3559
|
+
if (slotScopeInfo) clone.__stx_scope = itemScope;
|
|
3560
|
+
else clone.__stx_row_scope = itemScope;
|
|
3561
|
+
}
|
|
3520
3562
|
markLoopRow(clone, itemName, itemSignal);
|
|
3521
3563
|
elements.push(clone);
|
|
3522
3564
|
componentSetupTemplates.forEach(function(setupTemplate) {
|
|
@@ -4557,7 +4599,8 @@ catch (e) {
|
|
|
4557
4599
|
}
|
|
4558
4600
|
else {
|
|
4559
4601
|
row.scope = itemScope;
|
|
4560
|
-
row.evalScope = layerTemplateScopes(globalHelpers,
|
|
4602
|
+
row.evalScope = layerTemplateScopes(globalHelpers, findElementScope(parent) || {}, itemScope);
|
|
4603
|
+
root.__stx_row_scope = row.evalScope;
|
|
4561
4604
|
}
|
|
4562
4605
|
row.local = rowScopeAt(plan.eval, row.evalScope);
|
|
4563
4606
|
var dispose = trackEffects(function() { bindRowNode(made, row); });
|
|
@@ -5840,7 +5883,7 @@ catch (e) { /* a disposer of its own is not this branch's problem */ }
|
|
|
5840
5883
|
// Shown branches whose deferred bind found them off the page: an enclosing
|
|
5841
5884
|
// :if, bound later in the same pass, hid them between the queue and the run.
|
|
5842
5885
|
// Their own condition has not changed, so their effect never runs again to
|
|
5843
|
-
// retry; each resumes here when an enclosing branch puts it back.`;var
|
|
5886
|
+
// retry; each resumes here when an enclosing branch puts it back.`;var je=` const detachedBranches = new Set();
|
|
5844
5887
|
function resumeDetachedBranches() {
|
|
5845
5888
|
if (!detachedBranches.size) return;
|
|
5846
5889
|
Array.from(detachedBranches).forEach(function(resume) {
|
|
@@ -6256,7 +6299,7 @@ else if (!value && isInserted) {
|
|
|
6256
6299
|
function cachedQuery(key, options) {
|
|
6257
6300
|
return __stxQueries.cachedQuery(key, options);
|
|
6258
6301
|
}
|
|
6259
|
-
`}var
|
|
6302
|
+
`}var He=` // Lazy hydration: defer processElement for subtrees marked with stx-hydrate.
|
|
6260
6303
|
// Triggers: "visible" (IntersectionObserver), "idle" (requestIdleCallback),
|
|
6261
6304
|
// "interaction" (mouseenter/click/focus), "media:<query>" (matchMedia).
|
|
6262
6305
|
function deferHydration(el, trigger, scope) {
|
|
@@ -8575,6 +8618,7 @@ else {
|
|
|
8575
8618
|
// knows where the rest are. The manifest path passes it for every entry, so
|
|
8576
8619
|
// the tree is never walked; see processFromManifest.
|
|
8577
8620
|
function processElement(el, scope = componentScope, skipChildren) {
|
|
8621
|
+
scope = projectedSlotCallerScope(el, scope) || scope;
|
|
8578
8622
|
// Lazy hydration: if this element has stx-hydrate and hasn't been hydrated
|
|
8579
8623
|
// yet, defer its subtree processing until the trigger fires.
|
|
8580
8624
|
if (el.nodeType === Node.ELEMENT_NODE && el.hasAttribute && el.hasAttribute('stx-hydrate') && !el.__stx_hydrated) {
|
|
@@ -9942,6 +9986,8 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
9942
9986
|
});
|
|
9943
9987
|
}
|
|
9944
9988
|
var spaPageScopeSnapshot = mergeTemplateScopes(componentScope);
|
|
9989
|
+
// The container's caller changes even when its outer slot receiver persists.
|
|
9990
|
+
container.__stx_page_scope = spaPageScopeSnapshot;
|
|
9945
9991
|
|
|
9946
9992
|
// Routed component mount scripts execute after DOMContentLoaded. Queue them
|
|
9947
9993
|
// until the destination page setup is active so projected props and parent
|
|
@@ -11750,7 +11796,7 @@ ${Xe}
|
|
|
11750
11796
|
${Ee}
|
|
11751
11797
|
${Se}
|
|
11752
11798
|
${Re}
|
|
11753
|
-
${
|
|
11799
|
+
${He}
|
|
11754
11800
|
${se}
|
|
11755
11801
|
${ue}
|
|
11756
11802
|
${me}
|
|
@@ -11771,7 +11817,7 @@ ${e.native?Ie:""}
|
|
|
11771
11817
|
${Be}
|
|
11772
11818
|
${he}
|
|
11773
11819
|
${Ve}
|
|
11774
|
-
${
|
|
11820
|
+
${je}
|
|
11775
11821
|
${de}
|
|
11776
11822
|
${vt}
|
|
11777
11823
|
${re}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{w,S,fi,fn}from"./chunk-36ga0q0r.js";import{Xo}from"./chunk-nx6kvnhw.js";import{c}from"./chunk-brhas9mp.js";import F from"fs";import d from"path";import{hasLocalConfig as he}from"bunfig";var bt={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Xe(n){return`--stx-${n}`}function _(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var be=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function q(n,t){let s=t.trim();return _(n,s)??(be.test(s)?s:void 0)}function ee(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!bt[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!ye[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Ae[t]).map((t)=>`density.${t}`)]}function te(n){let t={};for(let[s,r]of Object.entries(bt)){let i=_(n,r.light);if(i===void 0)continue;t[s]=`var(${Xe(s)}, ${i})`}return t}function ne(n,t={}){let s=[],r=[];for(let[i,l]of Object.entries(bt)){let a=t[i],g=typeof a==="string"?a:a?.light,o=typeof a==="string"?a:a?.dark,f=g&&q(n,g)||_(n,l.light),h=o&&q(n,o)||_(n,l.dark);if(f===void 0)continue;if(s.push(` ${Xe(i)}: ${f};`),h!==void 0)r.push(` ${Xe(i)}: ${h};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var ye={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function an(n){return`--stx-radius-${n}`}function se(){let n={};for(let[t,s]of Object.entries(ye))n[t]=`var(${an(t)}, ${s.value})`;return n}function re(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(ye).map(([t,s])=>` ${an(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
4
|
`)}var Ae={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},nr={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},rr={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Ge(n){return`--stx-${n}`}function V(n){let t=Ae[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Ge(n)}, ${t.value})`}function ie(){let n={};for(let[t,s]of Object.entries(nr))n[t]=V(s);return n}function oe(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(rr))n[t]=[V(s),{lineHeight:V(r)}];return n}function ce(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Ae).map(([t,s])=>` ${Ge(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function ae(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function W(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=ae(i)&&ae(s[r])?W(s[r],i):i;return s}function le(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function de(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...l}=r,{extend:a,...g}=s,o=g.colors||{};g.colors={...o,...te(o)};let f=g.borderRadius||{};g.borderRadius={...f,...se()};let h=g.spacing||{};g.spacing={...h,...ie()};let K=g.fontSize||{};g.fontSize={...K,...oe()};let R=W(g,l),m=W(a||{},i||{});if(Object.keys(m).length>0)R.extend=m;let P=[...n.safelist||[],...t.safelist||[]],M={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:U,...O}=n,{fonts:N,roles:T,shapes:I,density:
|
|
7
|
-
`)}async function Oe(n,t){try{let s=await oc();if(!s)return"";let r=new Set;for(let u of we(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(u):Pf(u);for(let Z of j)r.add(Z)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),l=c(i,"cache");if(!L)L=l;let a=H.get(i);if(!a){let u=await Rf(i);a={config:u,fingerprint:Af(u)},H.set(i,a),Se=a.fingerprint}let g=[...r].sort().join(" "),o=`${G}::${a.fingerprint||"default"}::${g}`,f=
|
|
8
|
-
`))
|
|
9
|
-
`}let
|
|
6
|
+
`:s}function de(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...l}=r,{extend:a,...g}=s,o=g.colors||{};g.colors={...o,...te(o)};let f=g.borderRadius||{};g.borderRadius={...f,...se()};let h=g.spacing||{};g.spacing={...h,...ie()};let K=g.fontSize||{};g.fontSize={...K,...oe()};let R=W(g,l),m=W(a||{},i||{});if(Object.keys(m).length>0)R.extend=m;let P=[...n.safelist||[],...t.safelist||[]],M={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:U,...O}=n,{fonts:N,roles:T,shapes:I,density:y,...C}=t,u={roles:T,shapes:I,density:y},j=N??U;return{config:{...O,...C,theme:R,safelist:P,shortcuts:M,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:P,shortcuts:M,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ne({...o,...R.colors},T)+re(I)+ce(y),unknownRoles:ee(u),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import ve from"path";var $e=256,x=new Map,ge=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),fe=(n)=>c(process.cwd(),"css-assets",`${n}.css`);function z(n,t){if(x.delete(n),x.set(n,t),x.size>$e)x.delete(x.keys().next().value)}function ue(n){let t=ge(n),s=fe(t);if(x.has(s))return z(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(ve.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return z(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function $f(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=fe(n),s=x.get(t);if(s!==void 0)return z(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ge(r)!==n)return;return z(t,r),r}catch{return}}function pe(){x.clear()}var p=null,G="";function me(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;G=`${t}@${Math.trunc(F.statSync(t).mtimeMs)}`}catch{G=n}}var Y=!1,v=null,A="",E=!1,Re=256,k=new Map,L=null,Se=null,H=new Map,xe=new Set;function X(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function Q(n,t){if(k.has(n))k.delete(n);else if(k.size>=Re)k.delete(k.keys().next().value);k.set(n,t)}async function Te(n,t=L){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${X(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function je(n,t,s=L){if(!s)return;try{if(!F.existsSync(s))F.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${X(n)}.css`),t)}catch{}}async function ke(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Be=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ee=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function Pe(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Be)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function De(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function oc(){if(Y)return p;Y=!0;try{let n=async(i)=>{for(let l of i){if(!await Bun.file(l).exists())continue;let a=await ke(l);if(a){if(me(l),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(l))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),l=await n([i]);if(!l)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=l,p}let t=await n(Pe());if(t)return p=t,p;let s=Ee;for(let i of s){let l=await ke(i);if(l){p=l;try{me(import.meta.resolve(i))}catch{G=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(De());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Th(){J.clear(),p=null,Y=!1,v=null,A="",k.clear(),pe(),Se=null,H.clear()}var Ce=!1;async function ic(n){try{let t=he({name:"css",cwd:n})?"css":he({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!Ce)Ce=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Rf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-7vvhdrby.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let l=await import(i);t=l.default||l,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let l=await import(i);t={...l.default||l,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await ic(n)}function Af(n){try{let t=new WeakSet;return X(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function cn(n){if(E)return A;E=!0;try{let t=await oc();if(!t||!t.build)return E=!1,"";if(!v)v=await ic(n);if(!v)return E=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},l=performance.now(),a=await t.build(i),g=performance.now()-l;if(A=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let o=d.isAbsolute(i.output)?i.output:d.join(n,i.output),f=d.dirname(o);if(!F.existsSync(f))F.mkdirSync(f,{recursive:!0});await Bun.write(o,a.css)}return E=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),E=!1,A}}async function sr(n){v=null,await cn(n)}function $h(){return A}function Pf(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,l=i.exec(n);while(l!==null){let a=l[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let o of g.slice(1,-1).split(/\s+/))if(o.trim())t.add(o.trim())}l=i.exec(n)}return t}var J=w(64);async function If(n,t){let s=()=>H.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=J.get(S(n,t,s()));if(r!==void 0)return r;let i=await Oe(n,t);if(i)J.set(S(n,t,s()),i);return i}function*we(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=Xo(r);if(i)yield i}}function Rh(n){return[...we(n)].join(`
|
|
7
|
+
`)}async function Oe(n,t){try{let s=await oc();if(!s)return"";let r=new Set;for(let u of we(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(u):Pf(u);for(let Z of j)r.add(Z)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),l=c(i,"cache");if(!L)L=l;let a=H.get(i);if(!a){let u=await Rf(i);a={config:u,fingerprint:Af(u)},H.set(i,a),Se=a.fingerprint}let g=[...r].sort().join(" "),o=`${G}::${a.fingerprint||"default"}::${g}`,f=k.get(o);if(f!==void 0)return Q(o,f),f;let h=await Te(o,l);if(h!==null)return Q(o,h),h;let K=s.defaultConfig||s.config,R=a.config||{},m=de(K,R),{safelist:P,includePreflight:M,minify:D,tokenCSS:U}=m;if(m.unknownRoles.length>0&&!xe.has(i))xe.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${m.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let O=m.config,N=new s.CSSGenerator(O),T=O.shortcuts||R.shortcuts||{},I=Object.keys(T).filter((u)=>r.has(u)||P.includes(u));for(let u of P)if(!T[u])N.generate(u);for(let u of r)if(!T[u])N.generate(u);let y="";if(I.length>0){let u=new s.CSSGenerator(O);for(let j of I)u.generate(j);if(y=u.toCSS(!1,D),y&&!y.endsWith(`
|
|
8
|
+
`))y+=`
|
|
9
|
+
`}let C=y+N.toCSS(M,D);return C=le(s.CSSGenerator,m)+U+C,Q(o,C),je(o,C,l),C}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function b(n,t,s=!1,r=!1){let i=await If(n,t);if(!i)return r?fn(n):n;let l=s?ue(i):void 0,a=l?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${l}.css">`:`<style data-css="generated">
|
|
10
10
|
${i}
|
|
11
11
|
</style>`;if(r)return Ne(n,a);let g=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(g.test(n)){let o=!1;return n.replace(g,()=>{if(o)return"";return o=!0,a})}if(n.includes("</head>"))return n.replace("</head>",`${a}
|
|
12
12
|
</head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
@@ -15,4 +15,4 @@ ${a}`);return a+n}function Ne(n,t){let s=fi(n).map((o)=>({...o,replacement:""}))
|
|
|
15
15
|
${t}`});else s.push({start:0,end:0,replacement:t})}}s.sort((o,f)=>o.start-f.start||o.end-f.end);for(let o=1;o<s.length;o++)if(s[o].start<s[o-1].end)return Ie(fn(n),t);let l=Array(s.length*2+1),a=0,g=0;for(let o of s)l[g++]=n.slice(a,o.start),l[g++]=o.replacement,a=o.end;return l[g]=n.slice(a),l.join("")}function Ie(n,t){let s=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(s.test(n)){let r=!1;return n.replace(s,()=>{if(r)return"";return r=!0,t})}if(n.includes("</head>"))return n.replace("</head>",`${t}
|
|
16
16
|
</head>`);if(n.includes("<body"))return n.replace(/<body([^>]*)>/,`<body$1>
|
|
17
17
|
${t}`);return t+n}
|
|
18
|
-
export{bt,Xe,ye,an,Ae,nr,rr,Ge,e,$f,oc,Th,ic,Rf,Af,cn,sr,$h,Pf,If,Rh,
|
|
18
|
+
export{bt,Xe,ye,an,Ae,nr,rr,Ge,e,$f,oc,Th,ic,Rf,Af,cn,sr,$h,Pf,If,Rh,b};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{fr}from"./chunk-qj4r08jb.js";import{Tr}from"./chunk-8ttmzcxb.js";import{a}from"./chunk-
|
|
2
|
+
import{fr}from"./chunk-qj4r08jb.js";import{Tr}from"./chunk-8ttmzcxb.js";import{a}from"./chunk-n5kg8njw.js";import{j,Ye}from"./chunk-cmnze7at.js";import{pc}from"./chunk-7yb82rm6.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function ar(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function X(e,r={}){return new fr(e,r).routes}import w from"path";var y=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=y.get(n);if(c)return c;let o=[];try{o=X(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return y.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g(e){return O(JSON.stringify(e))}function be(e){return e.includes("data-stx-runtime")}function uc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function l(e,r){let t=ar(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=Tr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(j(e))return Ye(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function cr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function cr(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-281eg1pf.js"),{url:c}=await n("runtime",r.debug===!0);return l(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return l(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-281eg1pf.js"),s=await t(r.debug);return l(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function dc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${pc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function we(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function we(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-281eg1pf.js");n=`<script data-stx-owned-routes src="${T(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${g(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${g(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-281eg1pf.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
14
|
export{ar,X,be,uc,cr,dc,we};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{lt,ut,dt}from"./chunk-7qk4exw1.js";import"./chunk-bt0amey5.js";import"./chunk-r9e0r6jx.js";import"./chunk-8ttmzcxb.js";import{m}from"./chunk-
|
|
2
|
+
import{lt,ut,dt}from"./chunk-7qk4exw1.js";import"./chunk-bt0amey5.js";import"./chunk-r9e0r6jx.js";import"./chunk-8ttmzcxb.js";import{m}from"./chunk-36ga0q0r.js";import"./chunk-2vqpz4qv.js";import"./chunk-kfvbd9c9.js";import{Vt,no,Ut,Ui,ct,Wi,ro,Wt,Ki,qt}from"./chunk-q7zwv88b.js";import M from"fs";import x from"path";function E(t,e){let r=[x.join(t.root,"stx.config.ts"),x.join(t.root,"stx.config.js"),x.join(t.root,"stx.config.mjs")],s=e.debounceMs??300,o=null,a=[];for(let c of r)try{if(!M.existsSync(c))continue;let n=M.watch(c,(d)=>{if(d==="change"){if(o)clearTimeout(o);o=setTimeout(async()=>{Wi("Config file changed, restarting...");try{await e.onChange()}catch(p){ct(`Failed to restart: ${p}`)}},s)}});a.push(n)}catch{}return{stop(){if(o)clearTimeout(o);for(let c of a)c.close()}}}import w from"fs";import j from"path";var nt=".stx/story/analytics.json",st=1,A=1e4;class k{storage;storagePath;currentSession=null;dirty=!1;viewStartTimes=new Map;constructor(t){this.storagePath=j.join(t,nt),this.storage=this.loadStorage(),this.startSession()}loadStorage(){try{let t=w.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:st,events:[],sessions:[]}}}async save(){if(!this.dirty)return;let t=j.dirname(this.storagePath);if(await w.promises.mkdir(t,{recursive:!0}),this.storage.events.length>A)this.storage.events=this.storage.events.slice(-A);await w.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}startSession(){this.endSession(),this.currentSession={id:at(),startTime:Date.now(),componentViews:[]},this.storage.sessions.push(this.currentSession),this.dirty=!0}endSession(){if(this.currentSession)this.currentSession.endTime=Date.now(),this.currentSession=null}track(t){this.storage.events.push({...t,timestamp:Date.now()}),this.dirty=!0}trackView(t,e){if(this.endViewTiming(t),this.viewStartTimes.set(t,Date.now()),this.track({type:"view",componentId:t,variantId:e}),this.currentSession&&!this.currentSession.componentViews.includes(t))this.currentSession.componentViews.push(t)}endViewTiming(t){let e=this.viewStartTimes.get(t);if(e){let r=Date.now()-e;this.track({type:"view",componentId:t,metadata:{duration:r,endView:!0}}),this.viewStartTimes.delete(t)}}trackPropChange(t,e,r){this.track({type:"prop_change",componentId:t,propName:e,metadata:{value:r}})}trackVariantSwitch(t,e){this.track({type:"variant_switch",componentId:t,variantId:e})}trackSearch(t,e){this.track({type:"search",query:t,metadata:{resultCount:e}})}getComponentAnalytics(t,e){let r=this.storage.events.filter((i)=>i.componentId===t),s=r.filter((i)=>i.type==="view"&&!i.metadata?.endView),o=r.filter((i)=>i.type==="prop_change"),a=r.filter((i)=>i.type==="variant_switch"),c={};for(let i of o)if(i.propName)c[i.propName]=(c[i.propName]||0)+1;let n={};for(let i of a)if(i.variantId)n[i.variantId]=(n[i.variantId]||0)+1;let d=new Set(this.storage.sessions.filter((i)=>i.componentViews.includes(t)).map((i)=>i.id)),p=r.filter((i)=>i.metadata?.duration).map((i)=>i.metadata.duration),g=p.length>0?p.reduce((i,l)=>i+l,0)/p.length:0,y=Object.entries(c).sort((i,l)=>l[1]-i[1]).slice(0,5).map(([i])=>i);return{componentId:t,componentName:e,viewCount:s.length,uniqueViews:d.size,lastViewed:s[s.length-1]?.timestamp,propChanges:c,topChangedProps:y,variantViews:n,avgTimeSpent:g}}getMostViewedComponents(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="view"&&r.componentId&&!r.metadata?.endView)e.set(r.componentId,(e.get(r.componentId)||0)+1);return Array.from(e.entries()).map(([r,s])=>({componentId:r,viewCount:s})).sort((r,s)=>s.viewCount-r.viewCount).slice(0,t)}getMostChangedProps(t=10){let e=new Map;for(let r of this.storage.events)if(r.type==="prop_change"&&r.propName)e.set(r.propName,(e.get(r.propName)||0)+1);return Array.from(e.entries()).map(([r,s])=>({propName:r,changeCount:s})).sort((r,s)=>s.changeCount-r.changeCount).slice(0,t)}getSearchAnalytics(){let t=this.storage.events.filter((o)=>o.type==="search"),e=new Map,r=0;for(let o of t){if(o.query)e.set(o.query,(e.get(o.query)||0)+1);if(o.metadata?.resultCount!==void 0)r+=o.metadata.resultCount}let s=Array.from(e.entries()).map(([o,a])=>({query:o,count:a})).sort((o,a)=>a.count-o.count).slice(0,10);return{totalSearches:t.length,topQueries:s,avgResultCount:t.length>0?r/t.length:0}}clear(){this.storage.events=[],this.storage.sessions=[],this.dirty=!0,this.startSession()}exportAnalytics(){return JSON.stringify({exportedAt:Date.now(),...this.storage},null,2)}}function at(){return`session-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import S from"fs";import B from"path";var it=".stx/story/bookmarks.json",pt=1;class P{storage;storagePath;dirty=!1;constructor(t){this.storagePath=B.join(t,it),this.storage=this.loadStorage()}loadStorage(){try{let t=S.readFileSync(this.storagePath,"utf-8");return JSON.parse(t)}catch{return{version:pt,bookmarks:[]}}}async save(){if(!this.dirty)return;let t=B.dirname(this.storagePath);await S.promises.mkdir(t,{recursive:!0}),await S.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}addBookmark(t,e,r,s={}){let o={id:mt(),name:s.name||`${t}/${e}`,storyId:t,variantId:e,props:r,created:Date.now(),notes:s.notes,color:s.color};return this.storage.bookmarks.push(o),this.dirty=!0,o}getAllBookmarks(){return[...this.storage.bookmarks]}getBookmarksForStory(t){return this.storage.bookmarks.filter((e)=>e.storyId===t)}getBookmark(t){return this.storage.bookmarks.find((e)=>e.id===t)}isBookmarked(t,e){return this.storage.bookmarks.some((r)=>r.storyId===t&&r.variantId===e)}updateBookmark(t,e){let r=this.getBookmark(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deleteBookmark(t){let e=this.storage.bookmarks.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.bookmarks.splice(e,1),this.dirty=!0,!0}toggleBookmark(t,e,r){let s=this.storage.bookmarks.find((a)=>a.storyId===t&&a.variantId===e);if(s)return this.deleteBookmark(s.id),{added:!1};return{added:!0,bookmark:this.addBookmark(t,e,r)}}exportBookmarks(){return JSON.stringify(this.storage,null,2)}importBookmarks(t,e=!0){let r=JSON.parse(t),s=0;for(let o of r.bookmarks){if(e){let a=this.storage.bookmarks.find((c)=>c.id===o.id);if(a)Object.assign(a,o);else this.storage.bookmarks.push(o)}else this.storage.bookmarks.push(o);s++}if(s>0)this.dirty=!0;return s}}function mt(){return`bm-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}var v=new Set;function N(){return{open(t){v.add(t),t.send(JSON.stringify({type:"connected",timestamp:Date.now()}))},close(t){v.delete(t)},message(t,e){}}}function C(t){let e=JSON.stringify({...t,timestamp:t.timestamp||Date.now()});for(let r of v)try{r.send(e)}catch{v.delete(r)}}function V(t,e){C({type:"story-update",data:{storyId:t,...e}})}function H(t,e){C({type:"story-add",data:{storyId:t,...e}})}function O(t){C({type:"story-remove",data:{storyId:t}})}function F(t){return`
|
|
3
3
|
<script>
|
|
4
4
|
(function() {
|
|
5
5
|
const ws = new WebSocket('${t}');
|
|
@@ -556,7 +556,7 @@ window.__stxPerformance = {
|
|
|
556
556
|
|
|
557
557
|
window.clearPerformanceMetrics = () => window.__stxPerformance.clear();
|
|
558
558
|
</script>
|
|
559
|
-
`}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-
|
|
559
|
+
`}import T from"fs";import K from"path";var ft=".stx/story/presets.json",R=1,yt=10;class I{storage;storagePath;dirty=!1;constructor(t){this.storagePath=K.join(t,ft),this.storage=this.loadStorage()}loadStorage(){try{let t=T.readFileSync(this.storagePath,"utf-8"),e=JSON.parse(t);if(e.version!==R)return this.migrateStorage(e);return e}catch{return{version:R,presets:[],recentIds:[]}}}migrateStorage(t){return{version:R,presets:t.presets||[],recentIds:t.recentIds||[]}}async save(){if(!this.dirty)return;let t=K.dirname(this.storagePath);await T.promises.mkdir(t,{recursive:!0}),await T.promises.writeFile(this.storagePath,JSON.stringify(this.storage,null,2)),this.dirty=!1}createPreset(t,e,r={}){let s={id:ht(),name:t,description:r.description,props:e,componentId:r.componentId,created:Date.now(),usageCount:0,tags:r.tags};return this.storage.presets.push(s),this.dirty=!0,s}getPreset(t){return this.storage.presets.find((e)=>e.id===t)}getAllPresets(){return[...this.storage.presets]}getPresetsForComponent(t){return this.storage.presets.filter((e)=>!e.componentId||e.componentId===t)}getRecentPresets(){return this.storage.recentIds.map((t)=>this.getPreset(t)).filter((t)=>t!==void 0)}usePreset(t){let e=this.getPreset(t);if(!e)return;return e.lastUsed=Date.now(),e.usageCount++,this.storage.recentIds=[t,...this.storage.recentIds.filter((r)=>r!==t)].slice(0,yt),this.dirty=!0,e}updatePreset(t,e){let r=this.getPreset(t);if(!r)return;return Object.assign(r,e),this.dirty=!0,r}deletePreset(t){let e=this.storage.presets.findIndex((r)=>r.id===t);if(e===-1)return!1;return this.storage.presets.splice(e,1),this.storage.recentIds=this.storage.recentIds.filter((r)=>r!==t),this.dirty=!0,!0}searchPresets(t){let e=t.toLowerCase();return this.storage.presets.filter((r)=>{if(r.name.toLowerCase().includes(e))return!0;if(r.description?.toLowerCase().includes(e))return!0;if(r.tags?.some((s)=>s.toLowerCase().includes(e)))return!0;return!1})}getMostUsedPresets(t=5){return[...this.storage.presets].sort((e,r)=>r.usageCount-e.usageCount).slice(0,t)}exportPresets(t){let e=t?this.storage.presets.filter((r)=>t.includes(r.id)):this.storage.presets;return JSON.stringify({presets:e},null,2)}importPresets(t,e=!1){let r=JSON.parse(t),s=0;for(let o of r.presets){let a=this.storage.presets.find((c)=>c.id===o.id);if(a&&!e)continue;if(a)Object.assign(a,o);else this.storage.presets.push(o);s++}if(s>0)this.dirty=!0;return s}}function ht(){return`preset-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}import _ from"fs";var q=new Map;async function b(t,e,r={}){let s=performance.now(),o=[];try{let a=await _.promises.stat(e),c=q.get(e),n;if(c&&c.mtime===a.mtimeMs)n=c.content;else n=await _.promises.readFile(e,"utf-8"),q.set(e,{content:n,mtime:a.mtimeMs,analyzed:null});let{processDirectives:d}=await import("./chunk-cknd3nb7.js"),p={},g=h(n);if(g)try{await m(g,p,e)}catch(f){o.push(`Warning: Could not extract script variables: ${f instanceof Error?f.message:String(f)}`)}if(r.props)Object.assign(p,r.props);let i=await d(n,p,e,{},new Set),l=Z(n),u=h(n);return i=Q(i),i=tt(i,p),{html:i,css:l,js:u,errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}async function vt(t){try{let e=await _.promises.readFile(t,"utf-8"),r=h(e);if(!r)return null;let s={};if(await m(r,s,t),Array.isArray(s.variants))return s.variants;return null}catch{return null}}async function Y(t,e,r,s){let o=e.story?.variants;if(!o){let n=await vt(e.path);if(n)o=n}if(!o&&r==="default")return b(t,e.path,{props:s||{}});if(!o)return b(t,e.path,{props:s||{}});let a=o.find((n)=>n.id===r);if(!a&&r==="default")return b(t,e.path,{props:s||{}});if(!a)return{html:'<div class="stx-render-error">Variant not found</div>',css:"",js:"",errors:[`Variant '${r}' not found`],duration:0};let c={...a.state,...s};if(a.source)return bt(t,a.source,c);return b(t,e.path,{props:c})}async function bt(t,e,r={}){let s=performance.now(),o=[];try{let{processDirectives:a}=await import("./chunk-cknd3nb7.js"),c={...r},n=h(e);if(n)try{await m(n,c,"inline-template.stx")}catch{}let p=await a(e,c,"inline-template.stx",{},new Set);return p=Q(p),p=tt(p,c),{html:p,css:Z(e),js:h(e),errors:o,duration:performance.now()-s}}catch(a){return o.push(a instanceof Error?a.message:String(a)),{html:`<div class="stx-render-error">${et(o[0])}</div>`,css:"",js:"",errors:o,duration:performance.now()-s}}}function Z(t){let e=[],r=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
560
560
|
`)}function Q(t){return t.replace(/<!--[\s\S]*?-->/g,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"").replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/^\s*\n/gm,"").trim()}function h(t){let e=[],r=/<script\b[^>]*>([\s\S]*?)<\/script>/gi,s=r.exec(t);while(s!==null)e.push(s[1].trim()),s=r.exec(t);return e.join(`
|
|
561
561
|
`)}function tt(t,e){let r=`<script>window.__stxProps = ${JSON.stringify(e)};</script>`;return t+r}function et(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}async function rt(t,e){let r=await Wt(t);ut(t,r);let s=qt(t.config,r);dt(t,s),console.log(` Found ${r.length} story files`);let o=typeof e.host==="string"?e.host:e.host===!0?"0.0.0.0":"localhost",a=new I(t.root),c=new P(t.root),n=new k(t.root),d=N(),p=Bun.serve({port:e.port,hostname:o,fetch:async(i,l)=>{let f=new URL(i.url).pathname;if(f==="/__hmr"){if(l.upgrade(i,{data:{isHmr:!0}}))return;return new Response("WebSocket upgrade failed",{status:400})}if(f.startsWith("/api/"))return xt(t,f,i,{presetsManager:a,bookmarksManager:c,analyticsTracker:n});return wt(t,f,e.port)},websocket:{open(i){d.open(i)},close(i){d.close(i)},message(i,l){d.message(i,l)}}}),g=`http://${o}:${e.port}`,y=Ki(t,async(i,l)=>{console.log(` [${i}] ${l.relativePath}`);let u=await Wt(t);ut(t,u);let f=qt(t.config,u);if(dt(t,f),i==="add")H(l.id,{fileName:l.fileName});else if(i==="unlink")O(l.id);else V(l.id,{fileName:l.fileName})});if(e.open){let i=g;try{let{exec:l}=await import("child_process"),u=process.platform;l(`${u==="darwin"?"open":u==="win32"?"start":"xdg-open"} ${i}`)}catch{}}return{server:p,url:g,close:async()=>{y(),p.stop()}}}async function xt(t,e,r,s){let{presetsManager:o,bookmarksManager:a,analyticsTracker:c}=s;if(e==="/api/stories")return Response.json({files:t.storyFiles.map((n)=>({id:n.id,fileName:n.fileName,relativePath:n.relativePath,treePath:n.treePath})),tree:t.tree});if(e.startsWith("/api/story/")){let n=e.slice(11),d=t.storyFiles.find((p)=>p.id===n);if(!d)return new Response("Story not found",{status:404});try{let p=await Bun.file(d.path).text();return Response.json({id:d.id,fileName:d.fileName,relativePath:d.relativePath,content:p})}catch{return new Response("Error reading story",{status:500})}}if(e==="/api/config")return Response.json({theme:t.config.theme,responsivePresets:t.config.responsivePresets,backgroundPresets:t.config.backgroundPresets});if(e.startsWith("/api/render/")){let n=new URL(r.url),d=e.slice(12).split("/"),p=d[0],g=d[1]||"default",y,i=n.searchParams.get("props");if(i)try{y=JSON.parse(i)}catch{}let l=t.storyFiles.find((u)=>u.id===p);if(!l)return new Response("Story not found",{status:404});try{let u=await Y(t,l,g,y);return Response.json({html:u.html,css:u.css,js:u.js,errors:u.errors,duration:u.duration})}catch(u){return Response.json({html:"",css:"",js:"",errors:[u instanceof Error?u.message:String(u)],duration:0},{status:500})}}if(e==="/api/presets"&&r.method==="GET")return Response.json({presets:o.getAllPresets()});if(e==="/api/presets"&&r.method==="POST")try{let n=await r.json(),d=o.createPreset(n.name,n.props,{componentId:n.componentId,description:n.description});return await o.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/presets/")&&!e.includes("/use")&&r.method==="GET"){let n=e.slice(13),d=o.getPreset(n);if(!d)return new Response("Preset not found",{status:404});return Response.json(d)}if(e.endsWith("/use")&&r.method==="POST"){let n=e.slice(13,-4),d=o.usePreset(n);if(!d)return new Response("Preset not found",{status:404});return await o.save(),Response.json(d)}if(e.startsWith("/api/presets/")&&r.method==="DELETE"){let n=e.slice(13);if(!o.deletePreset(n))return new Response("Preset not found",{status:404});return await o.save(),Response.json({success:!0})}if(e==="/api/bookmarks"&&r.method==="GET")return Response.json({bookmarks:a.getAllBookmarks()});if(e==="/api/bookmarks"&&r.method==="POST")try{let n=await r.json(),d=a.addBookmark(n.storyId,n.variantId,n.props,{name:n.name,notes:n.notes,color:n.color});return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/bookmarks/toggle"&&r.method==="POST")try{let n=await r.json(),d=a.toggleBookmark(n.storyId,n.variantId,n.props);return await a.save(),Response.json(d)}catch(n){return Response.json({error:String(n)},{status:400})}if(e.startsWith("/api/bookmarks/")&&e!=="/api/bookmarks/toggle"&&r.method==="GET"){let n=e.slice(15),d=a.getBookmark(n);if(!d)return new Response("Bookmark not found",{status:404});return Response.json(d)}if(e.startsWith("/api/bookmarks/")&&r.method==="DELETE"){let n=e.slice(15);if(!a.deleteBookmark(n))return new Response("Bookmark not found",{status:404});return await a.save(),Response.json({success:!0})}if(e==="/api/analytics/track"&&r.method==="POST")try{let n=await r.json();if(n.type==="view"&&n.componentId)c.trackView(n.componentId,n.variantId);else if(n.type==="prop_change"&&n.componentId&&n.propName)c.trackPropChange(n.componentId,n.propName,null);else if(n.type==="variant_switch"&&n.componentId&&n.variantId)c.trackVariantSwitch(n.componentId,n.variantId);else if(n.type==="search"&&n.query)c.trackSearch(n.query,0);return await c.save(),Response.json({success:!0})}catch(n){return Response.json({error:String(n)},{status:400})}if(e==="/api/analytics/summary"&&r.method==="GET")return Response.json({mostViewed:c.getMostViewedComponents(10),mostChangedProps:c.getMostChangedProps(10),searchAnalytics:c.getSearchAnalytics()});if(e.startsWith("/api/analytics/component/")&&r.method==="GET"){let n=e.slice(25),d=t.storyFiles.find((g)=>g.id===n),p=c.getComponentAnalytics(n,d?.fileName||n);return Response.json(p)}return new Response("Not found",{status:404})}function wt(t,e,r){let s=kt(t,r);return new Response(s,{headers:{"Content-Type":"text/html; charset=utf-8"}})}function kt(t,e){let{theme:r}=t.config,s=r.title||"STX Story",o=`ws://localhost:${e}/__hmr`,a=F(o);return`<!DOCTYPE html>
|
|
562
562
|
<html lang="en" class="${r.darkClass||"dark"}">
|