@stacksjs/stx 0.2.863 → 0.2.864
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-gp8hgpt9.js → chunk-01mwbg1r.js} +3 -3
- package/dist/{chunk-fnv94wc6.js → chunk-0v2yj490.js} +1 -1
- package/dist/chunk-0zxzcrns.js +2 -0
- package/dist/chunk-18qvx7b0.js +2 -0
- package/dist/{chunk-zr22gtpf.js → chunk-1smbjj34.js} +1 -1
- package/dist/chunk-28nk2zej.js +2 -0
- package/dist/chunk-2mgajzam.js +2 -0
- package/dist/{chunk-k7dxm48r.js → chunk-4w8a7f8t.js} +1 -1
- package/dist/chunk-53797jvm.js +2 -0
- package/dist/{chunk-zsnmk5me.js → chunk-5dvkphbe.js} +1 -1
- package/dist/{chunk-v408qsze.js → chunk-5kkq2eqr.js} +1 -1
- package/dist/{chunk-xfd3yqgj.js → chunk-6mhj42gz.js} +12 -12
- package/dist/chunk-6nzdsh2c.js +2 -0
- package/dist/{chunk-ks5p5w6z.js → chunk-6y066pr2.js} +1 -1
- package/dist/chunk-709hfmpj.js +2 -0
- package/dist/{chunk-8502xb4n.js → chunk-79y9amt1.js} +7 -7
- package/dist/{chunk-8v1zpdef.js → chunk-7chzhef2.js} +1 -1
- package/dist/{chunk-5s1fb8z4.js → chunk-7wpk300q.js} +1 -1
- package/dist/{chunk-sj3ry5ck.js → chunk-7xhwqc0c.js} +7 -1
- package/dist/{chunk-z383x16t.js → chunk-8010hzhm.js} +1 -1
- package/dist/{chunk-yhc1c4tr.js → chunk-83qwwnye.js} +52 -52
- package/dist/{chunk-mfa07erx.js → chunk-83tvkw4y.js} +1 -1
- package/dist/{chunk-1grdbpsk.js → chunk-8ay0nq31.js} +2 -2
- package/dist/{chunk-2c18y094.js → chunk-8v8eawjw.js} +1 -1
- package/dist/{chunk-5p1k2h5q.js → chunk-8yybk485.js} +1 -1
- package/dist/chunk-9cwag0tk.js +2 -0
- package/dist/{chunk-vwwpbhd2.js → chunk-a98jgxkb.js} +1 -1
- package/dist/chunk-aef82ns3.js +2 -0
- package/dist/{chunk-ztbexx3h.js → chunk-axkgbc0k.js} +1 -1
- package/dist/chunk-az12j7cr.js +2 -0
- package/dist/{chunk-46ddesnf.js → chunk-b666d8m6.js} +1 -1
- package/dist/{chunk-y190sh29.js → chunk-brs63ht2.js} +9 -9
- package/dist/chunk-byve4g2y.js +2 -0
- package/dist/{chunk-jfmj0wsy.js → chunk-cdbmfe7d.js} +1 -1
- package/dist/{chunk-az5xw3w8.js → chunk-cjy9cdm0.js} +1 -1
- package/dist/chunk-cwjt04kc.js +2 -0
- package/dist/chunk-d10cq130.js +2 -0
- package/dist/{chunk-32ty2zx6.js → chunk-df0ry01a.js} +1 -1
- package/dist/{chunk-qxw9h564.js → chunk-ehd68fc7.js} +1 -1
- package/dist/{chunk-yr1zx78b.js → chunk-epct9fqd.js} +2 -2
- package/dist/{chunk-reeaknf2.js → chunk-eq40b4n4.js} +1 -1
- package/dist/{chunk-58sh82aj.js → chunk-ez6e7rh1.js} +1 -1
- package/dist/chunk-f0b3ca2n.js +2 -0
- package/dist/chunk-f52b9hjv.js +2 -0
- package/dist/{chunk-bx5d87xx.js → chunk-f6ypmk8x.js} +1 -1
- package/dist/{chunk-s9df8srx.js → chunk-fd1bpv35.js} +3 -3
- package/dist/{chunk-wk4wg6sn.js → chunk-fh8jzm4b.js} +2 -2
- package/dist/{chunk-0xtda6aw.js → chunk-fmzyrg2e.js} +1 -1
- package/dist/{chunk-qa5y30sy.js → chunk-g0xn80gz.js} +7 -7
- package/dist/{chunk-gw7t6a3t.js → chunk-gheba4nb.js} +1 -1
- package/dist/{chunk-hc6111md.js → chunk-h4rjzbek.js} +4 -4
- package/dist/{chunk-w468n41y.js → chunk-hpfq5qe4.js} +18 -18
- package/dist/{chunk-xymr4ys9.js → chunk-jbgj2hph.js} +1 -1
- package/dist/{chunk-15m7jnc0.js → chunk-jwghpcqn.js} +1 -1
- package/dist/{chunk-x512h2gv.js → chunk-kh6njq2r.js} +2 -2
- package/dist/{chunk-jgra00m8.js → chunk-kh7hbgx6.js} +1 -1
- package/dist/{chunk-d0afg5f7.js → chunk-ma1tf68v.js} +1 -1
- package/dist/{chunk-wtfamngc.js → chunk-mrw6vmqy.js} +4 -4
- package/dist/{chunk-dtarm8x9.js → chunk-nack2xs5.js} +4 -4
- package/dist/{chunk-ntbe5q5x.js → chunk-ndez5ee8.js} +2 -2
- package/dist/{chunk-h816ta81.js → chunk-p8x0a0fp.js} +2 -2
- package/dist/{chunk-pyckafsb.js → chunk-pfs0gv2a.js} +1 -1
- package/dist/{chunk-gjngg182.js → chunk-pghp2tkv.js} +8 -8
- package/dist/{chunk-g4gcf4jn.js → chunk-ppfp1w98.js} +1 -1
- package/dist/{chunk-xcjvx6zt.js → chunk-ptxptv29.js} +1 -1
- package/dist/{chunk-021tjkd6.js → chunk-q22fpqtr.js} +1 -1
- package/dist/chunk-qcvfzskb.js +2 -0
- package/dist/{chunk-5zzrrxns.js → chunk-qjbjn6vz.js} +4 -4
- package/dist/{chunk-dpmayc2w.js → chunk-r0v2chpn.js} +2 -2
- package/dist/{chunk-b6w0f610.js → chunk-rme1a5qv.js} +19 -19
- package/dist/{chunk-669b2bya.js → chunk-rw5492e2.js} +3 -3
- package/dist/{chunk-czca8yds.js → chunk-sxdzpv90.js} +1 -1
- package/dist/{chunk-2n932qtv.js → chunk-syzggy76.js} +1 -1
- package/dist/{chunk-nttsc0aw.js → chunk-t2a6j64z.js} +5 -5
- package/dist/{chunk-qmkaqjba.js → chunk-t9r644tq.js} +1 -1
- package/dist/{chunk-x3p4emdp.js → chunk-tbq6msyc.js} +1 -1
- package/dist/chunk-v7jjrz5k.js +2 -0
- package/dist/{chunk-prrvggcy.js → chunk-vkj9fem6.js} +1 -1
- package/dist/chunk-w463vqkh.js +2 -0
- package/dist/{chunk-p0tkhd12.js → chunk-w8qr5414.js} +1 -1
- package/dist/{chunk-y036cwc7.js → chunk-wcvzsyf1.js} +2 -2
- package/dist/chunk-wxng15a3.js +2 -0
- package/dist/{chunk-yakdcak2.js → chunk-x5n2jc6m.js} +1 -1
- package/dist/{chunk-qbghf76y.js → chunk-x64afx6z.js} +2 -2
- package/dist/chunk-xsscsar3.js +3 -0
- package/dist/{chunk-r4v4vswq.js → chunk-y69k2fww.js} +1 -1
- package/dist/chunk-yrstc4z4.js +2 -0
- package/dist/chunk-z6c4c951.js +2 -0
- package/dist/{chunk-85zmxbt0.js → chunk-zdrn7wp0.js} +4 -4
- package/dist/cli.js +13 -13
- package/dist/client/signals-component-props-runtime.js +7 -1
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/native/floating-actions-web.d.ts +20 -0
- package/dist/native/floating-actions-web.js +177 -0
- package/dist/native/floating-actions.d.ts +8 -1
- package/dist/native/floating-actions.js +1 -1
- package/dist/native/primitives/FloatingActions.stx +22 -2
- package/dist/pwa.js +3 -3
- package/dist/site-builder/build.d.ts +6 -0
- package/dist/site-builder/build.js +13 -3
- package/dist/site-builder/types.d.ts +3 -0
- package/dist/ssg.js +4 -4
- package/package.json +5 -5
- package/dist/chunk-0bfgsv31.js +0 -2
- package/dist/chunk-36j129p1.js +0 -2
- package/dist/chunk-7mjf144y.js +0 -2
- package/dist/chunk-a4cn8rf4.js +0 -2
- package/dist/chunk-ap84eenm.js +0 -2
- package/dist/chunk-as2ffje6.js +0 -2
- package/dist/chunk-c0t2tdfk.js +0 -2
- package/dist/chunk-caxqwrnc.js +0 -2
- package/dist/chunk-d9vzfbdp.js +0 -2
- package/dist/chunk-e634vffz.js +0 -3
- package/dist/chunk-g65dptx2.js +0 -2
- package/dist/chunk-kw11yydy.js +0 -2
- package/dist/chunk-ns04v3am.js +0 -2
- package/dist/chunk-p2etn78y.js +0 -2
- package/dist/chunk-r23zq8yk.js +0 -2
- package/dist/chunk-rqmb09ss.js +0 -2
- package/dist/chunk-sz6d3v6b.js +0 -2
- package/dist/chunk-va07zs9v.js +0 -2
- package/dist/chunk-vc42mvjn.js +0 -2
- package/dist/chunk-xzdkjkyp.js +0 -2
- package/dist/chunk-ybkwnscv.js +0 -2
- package/dist/chunk-z3gz5fy4.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Y}from"./chunk-bwdbj60y.js";import{
|
|
2
|
+
import{Y}from"./chunk-bwdbj60y.js";import{D}from"./chunk-fd1bpv35.js";import Ve from"path";var t={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function ee(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import bt from"path";var Et={showRelativePaths:!1,enableAutoRecovery:Y(),logRecoveryWarnings:!0},te={...Et};function F(){return{...te}}function z(e){if(!te.showRelativePaths||!e)return e;let n=te.baseDir||process.cwd();try{let r=bt.relative(n,e);return r.startsWith("..")?e:r}catch{return e}}class N extends Error{code;filePath;line;column;context;numericCode;constructor(e,n,r,i,s,o,a){super(e);this.code=n;this.filePath=r;this.line=i;this.column=s;this.context=o;if(this.name="StxError",this.numericCode=a||t.EVALUATION_ERROR,this.filePath)this.filePath=z(this.filePath)}}class re extends N{constructor(e,n,r,i,s,o){super(e,"stx_RUNTIME_ERROR",n,r,i,s,o||t.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Or extends N{constructor(e,n,r,i,s,o){super(e,"stx_FILE_ERROR",n,r,i,s,o||t.FILE_NOT_FOUND);this.name="StxFileError"}}class J extends N{isFatal=!0;constructor(e,n,r,i,s,o){super(e,"stx_VALIDATION_ERROR",n,r,i,s,o||t.DOM_API_VIOLATION);this.name="StxValidationError"}}function ve(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:g,snippet:l,suggestion:h,format:f="text"}=e,y=o,x=a;if(!y&&c&&g!==void 0){let Q=Tt(c,g);y=Q.line,x=Q.column}let v=s?z(s):void 0,w=i?ee(i):void 0,R={type:n,code:i,codeName:w,message:r,filePath:v,line:y,column:x,snippet:l,suggestion:h,timestamp:new Date().toISOString()},A;switch(f){case"html":A=wt(R);break;case"json":A=JSON.stringify(R,null,2);break;case"console":A=vt(R,c,g);break;case"text":default:A=xt(R,c,g);break}return{formatted:A,data:R}}function xt(e,n,r){let i=[],s=e.code?` [${e.codeName||e.code}]`:"";if(i.push(`[${e.type} Error${s}]`),e.filePath){let o=e.filePath;if(e.line){if(o+=`:${e.line}`,e.column)o+=`:${e.column}`}i.push(`at ${o}`)}if(i.push(`
|
|
3
3
|
${e.message}`),n&&e.line){let o=St(n,e.line,2);if(o)i.push(`
|
|
4
4
|
${o}`)}if(e.snippet)i.push(`
|
|
5
5
|
Snippet: ${e.snippet}`);if(e.suggestion)i.push(`
|
|
@@ -25,7 +25,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
25
25
|
`;n.appendFileSync(this.logFilePath,s,"utf-8")}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",n)}})}async rotateIfNeeded(e){try{if(!e.existsSync(this.logFilePath))return;if(e.statSync(this.logFilePath).size<this.maxFileSize)return;for(let r=this.maxLogFiles-1;r>=1;r--){let i=`${this.logFilePath}.${r}`,s=`${this.logFilePath}.${r+1}`;if(e.existsSync(i))if(r>=this.maxLogFiles-1)e.unlinkSync(i);else e.renameSync(i,s)}if(this.maxLogFiles<=1)e.writeFileSync(this.logFilePath,"");else e.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(n){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",n)}}getRecentErrors(e=10){return this.errors.slice(-e)}getErrorsByType(e){return this.errors.filter((n)=>n.error.constructor.name===e)}getErrorsByLevel(e){return this.errors.filter((n)=>n.level===e)}clear(){this.errors.length=0}async clearLogFile(){try{let e=await import("fs");if(e.existsSync(this.logFilePath))e.writeFileSync(this.logFilePath,"","utf-8")}catch(e){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",e)}}getStats(){let e={},n={error:0,warning:0,info:0};for(let r of this.errors){let i=r.error.constructor.name;e[i]=(e[i]||0)+1;let s=r.level||"error";n[s]=(n[s]||0)+1}return{total:this.errors.length,byType:e,byLevel:n}}async exportToFile(e,n="json"){let r=await import("fs"),i=await import("path"),s=i.dirname(e);if(!r.existsSync(s))r.mkdirSync(s,{recursive:!0});if(n==="json"){let o=this.errors.map((a)=>({timestamp:a.timestamp.toISOString(),level:a.level||"error",type:a.error.constructor.name,message:a.error.message,stack:a.error.stack,context:a.context}));r.writeFileSync(e,JSON.stringify(o,null,2),"utf-8")}else{let o=this.errors.map((a)=>this.formatEntry(a));r.writeFileSync(e,o.join(`
|
|
26
26
|
|
|
27
27
|
`),"utf-8")}}async flush(){await this.writeQueue}}var U=new ne,Rn={isDevelopment(){return Y()},logDetailedError(e,n){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",e.message),console.error("Stack:",e.stack),n)console.error("Context:",n);console.error("========================")},createErrorReport(e,n){let r=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${e.message}`,`Type: ${e.constructor.name}`,`Stack: ${e.stack}`];if(n)r.push(`Context: ${JSON.stringify(n,null,2)}`);return r.push("========================"),r.join(`
|
|
28
|
-
`)}};function k(e,n,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===n)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function yl(e,n){let r=n,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(n,r),endPos:r}}class P{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,r),this.bytes+=r}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var
|
|
28
|
+
`)}};function k(e,n,r,i=0){let s=0,o=i,a=null,c=0,g=!1;while(o<e.length){let l=e[o];if(a&&g){g=!1,o++;continue}if(a&&l==="\\"){g=!0,o++;continue}if(g=!1,(l==='"'||l==="'"||l==="`")&&!a){a=l,o++;continue}if(l===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&l==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&l==="}"){c--,o++;continue}if(l==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(l===n)s++;else if(l===r){if(s--,s===0)return o}o++}return-1}function yl(e,n){let r=n,i={paren:0,bracket:0,brace:0},s=null,o=0;while(r<e.length){let a=e[r];if((r>0?e[r-1]:"")==="\\"&&s){r++;continue}if((a==='"'||a==="'")&&!s){s=a,r++;continue}if(a===s&&s!=="`"){s=null,r++;continue}if(a==="`"&&!s){s="`",r++;continue}if(a==="`"&&s==="`"&&o===0){s=null,r++;continue}if(s==="`"&&a==="$"&&e[r+1]==="{"){o++,r+=2;continue}if(o>0){if(a==="{")o++;else if(a==="}")o--;r++;continue}if(s){r++;continue}if(i.paren===0&&i.bracket===0&&i.brace===0){if(e.slice(r,r+2)==="}}"||e.slice(r,r+3)==="!!}")break;if(a===","||a===";")break}if(a==="(")i.paren++;else if(a===")"){if(i.paren--,i.paren<0)break}else if(a==="[")i.bracket++;else if(a==="]"){if(i.bracket--,i.bracket<0)break}else if(a==="{")i.brace++;else if(a==="}"){if(i.brace--,i.brace<0)break}r++}return{expression:e.slice(n,r),endPos:r}}class P{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let r=this.options?this.options.sizeOf(n):0;if(this.options&&r>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+r>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,r),this.bytes+=r}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var M=new Map,Rt=500;function Vt(e,n){if(n?.includes("g"))return new RegExp(e,n);let r=`${e}:${n||""}`;if(!M.has(r)){if(M.size>=Rt){let i=M.keys().next().value;if(i)M.delete(i)}M.set(r,new RegExp(e,n))}return M.get(r)}class ke{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),r=n.sort().join(","),i=this.pool.find((c)=>c.context.join(",")===r);if(i)return i.func;let s=this.fnCache,o=this.fnCacheMaxSize,a=(...c)=>(g)=>{try{let l=`${r}:${g}`,h=s.get(l);if(!h){if(s.size>=o){let f=s.keys().next().value;if(f)s.delete(f)}h=Function(...n,`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
31
31
|
return ${g};
|
|
@@ -47,11 +47,11 @@ catch (e) {
|
|
|
47
47
|
}
|
|
48
48
|
throw e;
|
|
49
49
|
}
|
|
50
|
-
`,l=i?(f)=>{let y=Oe([W,"Object",...se,...a,...f],g);return(...x)=>y(je,oe,...Ce,...x)}:(f)=>{let y=Oe(["Object",...se,...a,...f],g);return(...x)=>y(oe,...Ce,...x)},h=l([]);return{sourceBytes:e.length*2+n.reduce((f,y)=>f+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function zt(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ue.has(a))return}return e(...s)}}function jt(e,n,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(n.length===r.length&&c)return Le(a,n,e,void 0,o);return Le((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},n,e,(l)=>{a=e(l)},o)}function Le(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(n);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let x=y instanceof Error?y.message:"",v=a.exec(x);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(l.has(w)||Ue.has(w)||le.has(w))return;if(s?.(w),l.add(w),g.push(w),i)i(g);else c=r(g)}return}}function to(e){let n=e.trim();try{let r=Fe(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Be(r,n),He(n);for(let i of ce)if(i.test(r))return!1}catch{return!1}return!0}function
|
|
51
|
-
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var Bt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Kt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Qs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=K(n),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ut(r))].filter((c)=>!Bt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Ke(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function dt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return Ve.isAbsolute(e)?Ve.relative(process.cwd(),e)||e:e}function de(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function B(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${We(i)}`:"";return console.warn(`[stx] ${de(n)}${o}: ${r}`),u(e,`${de(n)}: ${r}`,s)}function no(e,n,r){let i=r?` in ${We(r)}`:"";console.warn(`[stx] ${de(e)}${i}: ${n}`)}function
|
|
50
|
+
`,l=i?(f)=>{let y=Oe([W,"Object",...se,...a,...f],g);return(...x)=>y(je,oe,...Ce,...x)}:(f)=>{let y=Oe(["Object",...se,...a,...f],g);return(...x)=>y(oe,...Ce,...x)},h=l([]);return{sourceBytes:e.length*2+n.reduce((f,y)=>f+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(f)=>f.length===0?h:l(f)}}function zt(e,n,r){if(r.length===0)return e;let i=r.map((s)=>n.indexOf(s));return(...s)=>{for(let o of i){if(o<0)continue;let a=s[o];if(typeof a==="string"&&ue.has(a))return}return e(...s)}}function jt(e,n,r,i,s,o){let a=e([]),c=i.every((l,h)=>l.index===h);if(n.length===r.length&&c)return Le(a,n,e,void 0,o);return Le((...l)=>{let h=Array(s.length);for(let f=0;f<s.length;f++)h[f]=l[s[f]];return a(...h)},n,e,(l)=>{a=e(l)},o)}function Le(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,g=[],l=new Set(n);return(...h)=>{for(let f=0;f<=8;f++)try{return c(...h)}catch(y){let x=y instanceof Error?y.message:"",v=a.exec(x);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(l.has(w)||Ue.has(w)||le.has(w))return;if(s?.(w),l.add(w),g.push(w),i)i(g);else c=r(g)}return}}function to(e){let n=e.trim();try{let r=Fe(n);if(/\b(?:eval|function|import|require|process|globalthis|window|document|fetch|bun|deno|buffer|console|reflect|proxy|prototype|constructor|this)\b/i.test(r))return!1;Be(r,n),He(n);for(let i of ce)if(i.test(r))return!1}catch{return!1}return!0}function Di(e,n){let r=[];n.lastIndex=0;let i;while((i=n.exec(e))!==null){let s=i.index,o=s+i[0].length-1,a=k(e,"(",")",o);if(a===-1){r.push({start:s,end:-1,args:"",call:e.slice(s,Math.min(e.length,s+80))}),n.lastIndex=o+1;continue}r.push({start:s,end:a+1,args:e.slice(o+1,a),call:e.slice(s,a+1)}),n.lastIndex=a+1}return r}function Wt(e,n,r,i){let s="",o=0;for(let a of Di(e,n)){if(s+=e.slice(o,a.start),a.end===-1){s+=i(a.call),o=a.start;continue}s+=r(a.args,a.call),o=a.end}return s+e.slice(o)}function qt(e){let n=[],r=0,i=null,s="";for(let o=0;o<e.length;o++){let a=e[o];if(i){if(s+=a,a==="\\"&&o+1<e.length){s+=e[++o];continue}if(a===i)i=null;continue}if(a==="'"||a==='"'||a==="`")i=a;else if(a==="("||a==="["||a==="{")r++;else if(a===")"||a==="]"||a==="}")r--;else if(a===","&&r===0){n.push(s.trim()),s="";continue}s+=a}if(s.trim())n.push(s.trim());return n}function fe(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let i="";for(let s=1;s<n.length-1;s++){let o=n[s];if(o==="\\"&&s+1<n.length-1){let a=n[++s];i+=a==="n"?`
|
|
51
|
+
`:a==="t"?"\t":a;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[s+1]==="{")return null;i+=o}return i}var Bt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Kt(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Qs(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=K(n),o;try{o=p(r,Object.keys(s))(...Object.values(s))}catch(c){return{ok:!1,message:`the expression could not be evaluated: ${c instanceof Error?c.message:String(c)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let a=[...new Set(ut(r))].filter((c)=>!Bt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((g)=>`"${g}"`).join(", ")} ${a.length===1?"is":"are"} not defined here. Values a directive reads must come from <script server> or the render context; a plain <script> runs in the browser. To pass literal text, quote it.`,code:t.UNDEFINED_VARIABLE};if(o===void 0&&(r.startsWith("{")||r.startsWith("[")))return{ok:!1,message:"the expression threw while it was evaluated",code:t.EVALUATION_ERROR};return{ok:!0,value:o}}function Ke(e){if(e===null)return"null";if(Array.isArray(e))return"an array";if(typeof e==="object")return"an object";if(typeof e==="string")return`a string ("${e.length>40?`${e.slice(0,40)}...`:e}")`;return`${/^[aeiou]/.test(typeof e)?"an":"a"} ${typeof e}`}function dt(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return Ve.isAbsolute(e)?Ve.relative(process.cwd(),e)||e:e}function de(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function B(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${We(i)}`:"";return console.warn(`[stx] ${de(n)}${o}: ${r}`),u(e,`${de(n)}: ${r}`,s)}function no(e,n,r){let i=r?` in ${We(r)}`:"";console.warn(`[stx] ${de(e)}${i}: ${n}`)}function Mi(){return{afterOpen:[],beforeClose:[]}}function Ht(e){return e.afterOpen.length>0||e.beforeClose.length>0}function bl(e,n){if(!Ht(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=D(e),o=r?Nr(e):null,a=i&&s!==-1?s:null;if(o===null&&a===null)return e;if(o!==null&&a!==null)return`${e.slice(0,o)}${r}${e.slice(o,a)}${i}${e.slice(a)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,a)}${i}${e.slice(a)}`}var Xe=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function Nr(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Xe.lastIndex=r;let i=Xe.exec(e);return i?r+i[0].length:r}var he="data-stx-color-mode-boot",qe="__STX_COLOR_MODE__",Xt=new Set(["light","dark","auto","system"]),Gt=new Set(["auto","system"]),Yt=/^[a-z][\w:-]*$/i,Jt=/^[\w-]+$/;function Zt(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",i=e.darkClass===void 0?"dark":e.darkClass,s=e.attribute??null,o=e.autoValue??null,a=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Xt.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(i!==null&&(typeof i!=="string"||!Jt.test(i)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(i)}`);if(s!==null&&(typeof s!=="string"||!Yt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Gt.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(i===null&&s===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(a&&s===null)throw Error("colorMode.respectExisting needs an attribute to read \u2014 the dark class alone cannot say whether a mode was chosen");return{storageKey:n,initialMode:r==="system"?"auto":r,darkClass:i,attribute:s,autoValue:o,respectExisting:a}}function Qt(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function ye(e={}){let n=Zt(e),r=Qt(n),i=`(function(){"use strict";var o=window.${qe};if(o&&typeof o.sync==="function"){o.sync();return}var c=${r};var r=document.documentElement;function read(){var p=c.initialMode,a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}return{p:p,a:a}}function sys(){try{return matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){return"light"}}function stamp(m){if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}}var s=read();var f=null;if(c.respectExisting&&c.attribute){var x=r.getAttribute(c.attribute);if(x==="light"||x==="dark")f=x}var m=f||(s.p==="auto"?sys():s.p);var p=s.p;stamp(m);var g=null;function sync(){var t=read(),n=f||(t.p==="auto"?sys():t.p);var moved=n!==m,chose=t.p!==p;if(moved){r.style.setProperty("transition","none","important");stamp(n);void r.offsetHeight;r.style.removeProperty("transition")}else stamp(n);m=n;p=t.p;if(g){g.mode=n;g.preference=t.p;if(t.a)g.autoValue=t.a}if(moved||chose){try{window.dispatchEvent(new CustomEvent("stx:color-mode",{detail:{mode:n,preference:t.p}}))}catch(e){}}}try{g=window.${qe}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:s.a||"auto",respectExisting:c.respectExisting,forced:f,preference:p,mode:m,watching:true,sync:sync}}catch(e){}try{var q=matchMedia("(prefers-color-scheme: dark)");if(q.addEventListener)q.addEventListener("change",sync);else if(q.addListener)q.addListener(sync)}catch(e){}try{addEventListener("pageshow",sync);addEventListener("storage",function(e){if(e.key===null||e.key===c.storageKey)sync()});document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")sync()})}catch(e){}}());`;return`<script ${he}>${i}</script>`}function Dr(e,n={}){if(e.includes(he))return e;let r=me(e);if(r===null)return e;let i=ye(n);return`${e.slice(0,r)}
|
|
52
52
|
${i}${e.slice(r)}`}var me=Nr,en=new RegExp(`<script\\b[^>]*\\b${he}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),Ye=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Je=/<\/head>/gi;function tn(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;Je.lastIndex=r;let i=Je.exec(e),s=i?i.index:e.length;Ye.lastIndex=r;let o=Ye.exec(e);if(!o||o.index>=s)return e;if(e.slice(r,o.index).trim()==="")return e;let a=o.index+o[0].length;return`${e.slice(0,r)}
|
|
53
53
|
${o[0]}${e.slice(r,o.index)}${e.slice(a,s)}${e.slice(s)}`}function wl(e){return nn(tn(e))}function nn(e){let n=en.exec(e);if(!n)return e;let r=me(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let i=e.slice(0,n.index)+e.slice(n.index+n[0].length),s=me(i);if(s===null)return e;return`${i.slice(0,s)}
|
|
54
|
-
${n[0]}${i.slice(s)}`}var rn="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",et=`<style data-stx-cloak>[x-cloak]{display:none !important}${rn}</style>`,X="data-stx-html-attrs",q="data-stx-html-class",tt=/^[A-Za-z_:][\w:.-]*$/;function T(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function sn(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function pt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function on(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${T(String(i))}"`).join(" ")}function G(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function nt(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${G(e)}</script>`}function an(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!tt.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${T(String(g))}"`),i.push(l)}let a=` lang="${T(o)}"`;if(s)a+=` class="${T(s)}"`;if(a+=r.join(""),s)a+=` ${q}="${T(s)}"`;if(i.length)a+=` ${X}="${T(i.join(" "))}"`;return a}function vl(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function
|
|
54
|
+
${n[0]}${i.slice(s)}`}var rn="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",et=`<style data-stx-cloak>[x-cloak]{display:none !important}${rn}</style>`,X="data-stx-html-attrs",q="data-stx-html-class",tt=/^[A-Za-z_:][\w:.-]*$/;function T(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function sn(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function pt(e){if(e.name)return`name="${e.name}"`;if(e.property)return`property="${e.property}"`;if(e.charset!=null)return"charset=";if(e["http-equiv"])return`http-equiv="${e["http-equiv"]}"`;return""}function on(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let i of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[i[1].toLowerCase()]=i[2]??i[3]??i[4]??"";return r}function _(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${T(String(i))}"`).join(" ")}function G(e){let n=String(e.content),r=typeof e.type==="string"?e.type.trim().toLowerCase():"";return/json$|^importmap$/.test(r)?n.replace(/<\//g,"<\\/"):n}function nt(e){let n=_(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${G(e)}</script>`}function an(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,g]of Object.entries(e||{})){if(g==null)continue;let l=c.trim();if(!tt.test(l))continue;let h=l.toLowerCase();if(h==="lang"){o=String(g);continue}if(h==="class"){s=String(g).trim();continue}r.push(` ${l}="${T(String(g))}"`),i.push(l)}let a=` lang="${T(o)}"`;if(s)a+=` class="${T(s)}"`;if(a+=r.join(""),s)a+=` ${q}="${T(s)}"`;if(i.length)a+=` ${X}="${T(i.join(" "))}"`;return a}function vl(e={},n={}){let r={...e,...n};if(e.class&&n.class){let i=e.class.split(/\s+/).filter(Boolean);for(let s of n.class.split(/\s+/).filter(Boolean))if(!i.includes(s))i.push(s);r.class=i.join(" ")}return r}function Mr(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let i={},s=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,a;while((a=o.exec(r[1]))!==null){let h=a[1];if(!(h in i))s.push(h);i[h]=a[2]??a[3]??a[4]??""}let c=[],g=[];for(let[h,f]of Object.entries(n)){if(f==null)continue;let y=h.trim();if(!tt.test(y))continue;let x=y.toLowerCase();if(x==="class"){let v=(i.class||"").split(/\s+/).filter(Boolean);for(let w of String(f).split(/\s+/).filter(Boolean))if(!v.includes(w))v.push(w),c.push(w);if(!("class"in i))s.push("class");i.class=v.join(" ");continue}if(!(y in i))s.push(y);if(i[y]=String(f),x!=="lang")g.push(y)}if(c.length){if(!(q in i))s.push(q);i[q]=c.join(" ")}if(g.length){if(!(X in i))s.push(X);i[X]=g.join(" ")}let l=s.map((h)=>` ${h}="${T(i[h])}"`).join("");return e.replace(r[0],()=>`<html${l}>`)}function xl(e){if(e.includes("data-stx-cloak"))return null;if(D(e)===-1)return null;return`${et}
|
|
55
55
|
`}function cn(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),a=o.match(/^\s+/);if(a){r+=a[0].length;continue}if(o.startsWith("<!--")){let f=e.indexOf("-->",r);if(f===-1)break;r=f+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let f=e.toLowerCase().indexOf("</script>",r+c[0].length);if(f===-1)break;r=f+9;continue}let g=o.match(/^<link\b[^>]*>/i);if(g){n.push(g[0]),r+=g[0].length;continue}let l=o.match(/^<meta\b[^>]*>/i);if(l){n.push(l[0]),r+=l[0].length;continue}let h=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(h){n.push(h[0]),r+=h[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let i="",s=0;while(s<e.length&&s<r){let o=e.slice(s),a=o.match(/^<link\b[^>]*>/i);if(a&&n.includes(a[0])){s+=a[0].length;continue}let c=o.match(/^<meta\b[^>]*>/i);if(c&&n.includes(c[0])){s+=c[0].length;continue}let g=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(g&&n.includes(g[0])){s+=g[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function ln(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:g="",htmlAttrs:l={},bodyClass:h="",bodyAttrs:f={}}=n,y=r.title||i,x=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],v=new Set(o.map(pt).filter(Boolean)),{body:w,hoisted:R}=cn(e),A=new Set(R.flatMap((b)=>{let L=on(b);return L?[pt(L)].filter(Boolean):[]})),at=[...x.filter((b)=>!v.has(pt(b))),...o].filter((b)=>!A.has(pt(b))).map((b)=>` <meta ${_(b)}>`).join(`
|
|
56
56
|
`),ct=a.map((b)=>` <link ${_(b)}>`).join(`
|
|
57
57
|
`),lt=c.map((b)=>{if(b.src)return` <script ${_(b,(L)=>L==="content")}></script>`;if(b.content)return` ${nt(b)}`;return""}).filter(Boolean).join(`
|
|
@@ -65,8 +65,8 @@ ${ht.join(`
|
|
|
65
65
|
${yt.join(`
|
|
66
66
|
`)}
|
|
67
67
|
</body>
|
|
68
|
-
</html>`}var be=/\s+/y,Ee=/<(script|style)\b[^>]*>/iy,un=/<\/script>/gi,gn=/<\/style>/gi,Ze=/<!DOCTYPE\b/iy,Qe=/<html[\s>]/iy;function An(e){let n=0;while(n<e.length){if(be.lastIndex=n,be.exec(e)){n=be.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}Ee.lastIndex=n;let i=Ee.exec(e);if(i){let s=i[1].toLowerCase()==="script"?un:gn;s.lastIndex=Ee.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ze.lastIndex=n,Ze.test(e))return!0;return Qe.lastIndex=n,Qe.test(e)}return!1}function Li(e){return An(e)}function Sl(e,n={}){let r=
|
|
68
|
+
</html>`}var be=/\s+/y,Ee=/<(script|style)\b[^>]*>/iy,un=/<\/script>/gi,gn=/<\/style>/gi,Ze=/<!DOCTYPE\b/iy,Qe=/<html[\s>]/iy;function An(e){let n=0;while(n<e.length){if(be.lastIndex=n,be.exec(e)){n=be.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}Ee.lastIndex=n;let i=Ee.exec(e);if(i){let s=i[1].toLowerCase()==="script"?un:gn;s.lastIndex=Ee.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ze.lastIndex=n,Ze.test(e))return!0;return Qe.lastIndex=n,Qe.test(e)}return!1}function Li(e){return An(e)}function Sl(e,n={}){let r=D(e);if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,c=e.slice(0,r),g=[];for(let l of i){let h=pt(l);if(h&&c.includes(h))continue;g.push(` <meta ${_(l)}>`)}for(let l of s){if(l.href&&c.includes(`href="${l.href}"`))continue;g.push(` <link ${_(l)}>`)}for(let l of o)if(l.src){if(c.includes(`src="${l.src}"`))continue;g.push(` <script ${_(l,(h)=>h==="content")}></script>`)}else if(l.content){if(c.includes(G(l)))continue;g.push(` ${nt(l)}`)}if(a&&!c.includes(a))g.push(` ${a}`);if(g.length===0)return e;return`${e.slice(0,r)}${g.join(`
|
|
69
69
|
`)}
|
|
70
70
|
${e.slice(r)}`}function Lr(e,n={},r={},i){if(i??Li(e))return e;return ln(e,n,r)}var pn=["og:","article:","book:","profile:","fb:","music:","video:"],dn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function jr(e,n){if(e.length<1)return{kind:"error",message:"meta directive requires at least the meta name",code:t.INVALID_DIRECTIVE_SYNTAX};if(e.length>2)return{kind:"error",message:`@meta takes a name and a value, got ${e.length} arguments`,code:t.INVALID_DIRECTIVE_SYNTAX};let r=fn(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=mn(e[1],n);if(typeof o!=="string")return o;i=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,a=n.openGraph,c=n[o]??(dt(a)?a[o]:void 0);i=c===void 0||c===null||typeof c==="object"?"":String(c)}if(!i)return{kind:"empty"};return{kind:"tag",tag:pn.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function fn(e,n){let r=fe(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(dn.test(e.trim()))return e.trim();let i=Kt(e,n);if(!i.ok)return{kind:"error",message:`meta name: ${i.message}`,code:i.code};if(typeof i.value!=="string"||!i.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${Ke(i.value)}`,code:t.TYPE_ERROR};return i.value}function mn(e,n){let r=fe(e);if(r!==null)return r;let i=Kt(e,n);if(!i.ok)return{kind:"error",message:i.message,code:i.code};let s=i.value;if(s===void 0||s===null||s===!1)return"";if(Array.isArray(s))return s.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof s==="object"&&!(s instanceof Date))return{kind:"error",message:`the content must be text, got ${Ke(s)}`,code:t.TYPE_ERROR};return String(s)}var Br=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],ro=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],st={links:"link",metas:"meta",scripts:"script",styles:"style"},rt=new Set,it=new WeakMap;function xe(e){if(rt.has(e))return;rt.add(e),console.warn(e)}function hn(e,n){let r=Array.from({length:n.length+1},(i,s)=>s);for(let i=1;i<=e.length;i++){let s=r[0];r[0]=i;for(let o=1;o<=n.length;o++){let a=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,s+(e[i-1]===n[o-1]?0:1)),s=a}}return r[n.length]}function yn(e,n){let r=e.toLowerCase(),i=n.find((g)=>g.toLowerCase()===r);if(i)return i;let s=st[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let g of n){let l=hn(r,g.toLowerCase());if(l<a)o=g,a=l}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Re(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=it.get(e);if(r)return r;let{known:i,source:s}=n,o=e;for(let a of Object.keys(e)){if(i.includes(a))continue;let c=st[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let l=Array.isArray(o[c])?o[c]:[];o[c]=[...l,...e[a]],delete o[a],xe(`[stx] ${s}.${a} is not a head key; reading it as ${s}.${c}. Rename it to \`${c}\`.`);continue}if(/^styles?$/.test(a)&&!i.includes("style")){xe(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let g=yn(a,i);xe(g?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${g}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return it.set(e,o),o}var C={},bn=[],Z={};function ji(){return C}function vy(){return Z}function xy(){C={},bn.length=0,Z={}}function kl(e){C=Ge(C,Re(e,{known:ro,source:"useHead()"}))}function ot(e,n,r){let i=[...e||[]];for(let s of n||[]){let o=r(s),a=o?i.findIndex((c)=>r(c)===o):-1;if(a<0)i.push(s);else i[a]=s}return i}function Ge(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:ot(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:ot(e.link,n.link,(r)=>["icon","apple-touch-icon","canonical"].includes(r.rel||"")?[r.rel,r.type,r.media,r.sizes].join(":"):void 0),script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function Lg(e){kl(so(e))}function so(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let g=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:g})}if(e.author)n.push({name:"author",content:e.author});if(e.robots)n.push({name:"robots",content:e.robots});let r=e.ogTitle??e.title,i=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(i)n.push({property:"og:description",content:i});if(e.ogImage){if(n.push({property:"og:image",content:e.ogImage}),e.ogImageType)n.push({property:"og:image:type",content:e.ogImageType});if(e.ogImageWidth)n.push({property:"og:image:width",content:String(e.ogImageWidth)});if(e.ogImageHeight)n.push({property:"og:image:height",content:String(e.ogImageHeight)});if(e.ogImageAlt)n.push({property:"og:image:alt",content:e.ogImageAlt})}if(e.ogUrl)n.push({property:"og:url",content:e.ogUrl});if(e.ogType)n.push({property:"og:type",content:e.ogType});if(e.ogSiteName)n.push({property:"og:site_name",content:e.ogSiteName});if(e.ogLocale)n.push({property:"og:locale",content:e.ogLocale});if(e.profileFirstName)n.push({property:"profile:first_name",content:e.profileFirstName});if(e.profileLastName)n.push({property:"profile:last_name",content:e.profileLastName});if(e.profileUsername)n.push({property:"profile:username",content:e.profileUsername});let s=e.twitterTitle??e.title,o=e.twitterDescription??e.description,a=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(s)n.push({name:"twitter:title",content:s});if(o)n.push({name:"twitter:description",content:o});if(a){n.push({name:"twitter:image",content:a});let g=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(g)n.push({name:"twitter:image:alt",content:g})}if(e.twitterSite)n.push({name:"twitter:site",content:e.twitterSite});if(e.twitterCreator)n.push({name:"twitter:creator",content:e.twitterCreator});if(e.articleAuthor)n.push({property:"article:author",content:e.articleAuthor});if(e.articlePublishedTime)n.push({property:"article:published_time",content:e.articlePublishedTime});if(e.articleModifiedTime)n.push({property:"article:modified_time",content:e.articleModifiedTime});if(e.articleSection)n.push({property:"article:section",content:e.articleSection});if(e.articleTags)for(let g of e.articleTags)n.push({property:"article:tag",content:g});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function Sy(e){if(Z={...Z,...e},e.title||e.description)Lg({title:e.title,description:e.description})}function ky(e){let n=typeof e==="function"?e():e;kl({title:n})}function _y(e=C){let n=[];if(e.title){let r=e.title;if(e.titleTemplate)r=typeof e.titleTemplate==="function"?e.titleTemplate(r):e.titleTemplate.replace("%s",r);n.push(`<title>${I(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${I(s)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s==="httpEquiv"?"http-equiv":s}="${I(String(o))}"`).join(" ");n.push(`<meta ${i}>`)}for(let r of e.link||[]){let i=Object.entries(r).filter(([s,o])=>o!==void 0).map(([s,o])=>`${s}="${I(String(o))}"`).join(" ");n.push(`<link ${i}>`)}for(let r of e.script||[]){let{content:i,...s}=r,o=Object.entries(s).filter(([a,c])=>c!==void 0).map(([a,c])=>{if(typeof c==="boolean")return c?a:"";return`${a}="${I(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${G(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let i=r.type?` type="${r.type}"`:"";n.push(`<style${i}>${r.content}</style>`)}return n.join(`
|
|
71
71
|
`)}function Cy(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function Ey(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${I(r)}"`).join(" ")}function I(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ty(e=C){if(typeof document>"u")return;if(e.title){let n=e.title;if(e.titleTemplate)n=typeof e.titleTemplate==="function"?e.titleTemplate(n):e.titleTemplate.replace("%s",n);document.title=n}for(let n of e.meta||[]){let r=n.name?`meta[name="${n.name}"]`:n.property?`meta[property="${n.property}"]`:null;if(r){let i=document.querySelector(r);if(!i){if(i=document.createElement("meta"),n.name)i.setAttribute("name",n.name);if(n.property)i.setAttribute("property",n.property);document.head.appendChild(i)}i.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,i=document.querySelector(r);if(!i)i=document.createElement("link"),document.head.appendChild(i);for(let[s,o]of Object.entries(n))if(o!==void 0)i.setAttribute(s,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let i of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(i);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function $y(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
72
|
-
`,"")),headContent:n.trim()}}function Ry(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ge(c,{title:a}),""})}function Ay(e,n,r=""){if(!e.includes("@meta"))return e;return Wt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=jr(qt(i),n);if(o.kind==="error")return B("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ge(a,{meta:[o.tag]})}return""},(i)=>B("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{P,Vt,pe,E,Qs,Oi,eo,d,m,hl,O,ut,Ut,p,to,t,re,Or,J,u,$e,Ni,U,Rn,k,yl,
|
|
72
|
+
`,"")),headContent:n.trim()}}function Ry(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,i,s,o)=>{let a=i?s:n[(o||"").trim()]??o,c=n.__stx_runtime_head??{};return n.__stx_runtime_head=Ge(c,{title:a}),""})}function Ay(e,n,r=""){if(!e.includes("@meta"))return e;return Wt(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=jr(qt(i),n);if(o.kind==="error")return B("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ge(a,{meta:[o.tag]})}return""},(i)=>B("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{P,Vt,pe,E,Qs,Oi,eo,d,m,hl,O,ut,Ut,p,to,t,re,Or,J,u,$e,Ni,U,Rn,k,yl,Di,Wt,qt,Kt,Ke,dt,B,no,Mi,bl,Nr,Dr,wl,pt,vl,Mr,xl,An,Li,Sl,Lr,jr,Br,ro,Re,ji,vy,xy,kl,Ge,Lg,so,Sy,ky,_y,Cy,Ey,Ty,$y,Ry,Ay};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vf,yc,Vh,bc,Uf,Wf,mn,dr,Uh,qf,Kf,Wh,x}from"./chunk-
|
|
2
|
+
import{Vf,yc,Vh,bc,Uf,Wf,mn,dr,Uh,qf,Kf,Wh,x}from"./chunk-brs63ht2.js";import"./chunk-q22fpqtr.js";import"./chunk-rme1a5qv.js";import"./chunk-4w8a7f8t.js";import"./chunk-k32q90b2.js";import"./chunk-g0xn80gz.js";import"./chunk-farh4p7f.js";import"./chunk-qjey0jk6.js";export{mn as buildCss,qf as extractClassNames,Wf as fingerprintConfig,Kf as generateCss,Uh as getCachedCSS,Vf as getCssServeAsset,x as injectCss,yc as loadCssEngine,bc as loadCssEngineConfig,dr as rebuildCss,Vh as resetCssCache,Uf as resolveUserCssConfig,Wh as withLinkedModuleBundles};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{P,d,m,O,p,J}from"./chunk-
|
|
2
|
+
import{P,d,m,O,p,J}from"./chunk-g0xn80gz.js";import{q,js,je,he,Mt,Ar,Ve,Ue,s,y,Te,R}from"./chunk-rme1a5qv.js";import{ft}from"./chunk-qjey0jk6.js";import{N}from"./chunk-farh4p7f.js";import{le}from"./chunk-jbgj2hph.js";import{H,nt}from"./chunk-8s6s6nd0.js";import{A,Pn}from"./chunk-bwdbj60y.js";import M from"path";import{existsSync as ye}from"fs";function ce(c,e){let a=0;for(let r=e;r<c.length;r++){let b=c[r];if(b==="("||b==="["||b==="{")a++;else if(b===")"||b==="]"||b==="}")a--;else if(b===","&&a===0)return r}return-1}function $e(c,e,a){let r=c,b=new RegExp(`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),n=b.exec(r);while(n){let u=n.index,t=u+n[0].length-1,T=1,L=t+1;while(L<r.length&&T>0){if(r[L]==="(")T++;else if(r[L]===")")T--;L++}if(T!==0)break;let re=r.substring(t+1,L-1),B=`${a}(${re})`;r=r.substring(0,u)+B+r.substring(L),b.lastIndex=u+B.length,n=b.exec(r)}return r}function Ee(c){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(c)}function me(c){let e=c,a=[],r=new Set,b=0,n=0,u=e.length,t=(B)=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]===B){n++;return}n++}},T=()=>{n++;while(n<u){if(e[n]==="\\"){n+=2;continue}if(e[n]==="`"){n++;return}if(e[n]==="$"&&e[n+1]==="{"){n+=2;let B=1;while(n<u&&B>0)if(e[n]==="{")B++,n++;else if(e[n]==="}")B--,n++;else if(e[n]==="'"||e[n]==='"')t(e[n]);else if(e[n]==="`")T();else n++;continue}n++}},L=()=>{if(e[n]==="/"&&e[n+1]==="/"){while(n<u&&e[n]!==`
|
|
3
3
|
`)n++;return!0}if(e[n]==="/"&&e[n+1]==="*"){n+=2;while(n<u-1&&!(e[n]==="*"&&e[n+1]==="/"))n++;return n+=2,!0}return!1},re=()=>{if(b!==0)return;let B=e.slice(n).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let U=B[2];if(!r.has(U))a.push(U),r.add(U);return}let te=e.slice(n).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(te){let U=te[1];if(!r.has(U))a.push(U),r.add(U);return}let Y=e.slice(n).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let U=Y[1];if(!r.has(U))a.push(U),r.add(U)}};while(n<u){if(L())continue;if(e[n]==="'"||e[n]==='"'){t(e[n]);continue}if(e[n]==="`"){T();continue}if(e[n]==="{"){b++,n++;continue}if(e[n]==="}"){b--,n++;continue}if(b===0&&/[a-z]/i.test(e[n])&&(n===0||/\s|[;{}()]/.test(e[n-1])))re();n++}return a.join(", ")}function ve(c,e=""){let a=me(c).split(",").map((r)=>r.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${ft("var",a)}
|
|
@@ -44,10 +44,10 @@ ${n}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return a+c+r}function Me(c,e){if(H(c)){let n=H(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:nt(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=
|
|
47
|
+
})();`;return a+c+r}function Me(c,e){if(H(c)){let n=H(c).tag.match(/data-stx-scope="([^"]*)"/);if(n)return{html:c,mergedIntoExisting:n[1],stamped:!0,root:"body"};return{html:nt(c,(u,t)=>`<body${t} data-stx-scope="${e}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let a=Mt(c),r=c.slice(a).match(/^(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(r){let b=r[1]+r[2],n=r[1].slice(1),u=b.match(/data-stx-scope="([^"]*)"/);if(u)return{html:c,mergedIntoExisting:u[1],stamped:!0,root:n};let t=c.slice(0,a),T=r[1],L=r[2];return{html:`${t}${T} data-stx-scope="${e}"${L}${c.slice(a+r[0].length)}`,mergedIntoExisting:null,stamped:!0,root:n}}return{html:c,mergedIntoExisting:null,stamped:!1,root:null}}var Ae=0;function ue(c,e){let a=M.basename(c,".stx").replace(/[^a-zA-Z0-9]/g,"_"),r=e.__stx_scope_seq;return r?`stx_scope_${a}_${++r.n}_${r.key}`:`stx_scope_${a}_${++Ae}`}var ae=new Set,pe=new Set;function qh(){ae.clear(),pe.clear()}var Ce=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Gf(c){let e=(t)=>t.replace(/[^\n]/g," "),a=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,e).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,e).replace(/<!--[\s\S]*?-->/g,e).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,e).replace(/\{\{[\s\S]*?\}\}/g,e).replace(/\{!![\s\S]*?!!\}/g,e),r=[],b=0,n=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,u;while((u=n.exec(a))!==null){let t=u[1]==="/",T=u[2],L=u[3]==="/"||Ce.has(T.toLowerCase());if(t){b=Math.max(0,b-1);continue}if(b===0)r.push(T);if(!L)b++}return r}function fe(c){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(c)}var tt=new P(500),wc=new Set;function Kh(){wc.clear()}function De(c){if(c.__onceStore instanceof Set)return c.__onceStore;return wc}async function gs(c,e,a,r,b,n=new Set){let u=r.partialsDir||M.join(M.dirname(a),"partials");if(u&&!M.isAbsolute(u))u=M.resolve(process.cwd(),u);let t=$e(c,"@partial","@include"),T=De(e);t=t.replace(/@once([\s\S]*?)@endonce/g,(f,v,h)=>{let g=v.trim(),i=`${a}:${g}`;if(T.has(i))return"";return T.add(i),v});{let f=/@includeIf\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")")i--;x++}if(i!==0)break;let l=t.substring(g+1,x-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){f.lastIndex=x;continue}let C=o[1],W=L(C,u,a),E="";if(W&&await Bun.file(W).exists())b.add(W),E=`@include(${l})`;t=t.substring(0,h)+E+t.substring(x),f.lastIndex=0}}for(let[f,v]of[["@includeWhen",!1],["@includeUnless",!0]]){let h=new RegExp(`${f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),g;while((g=h.exec(t))!==null){let i=g.index,x=i+g[0].length-1,l=1,o=x+1;while(o<t.length&&l>0){if(t[o]==="(")l++;else if(t[o]===")")l--;o++}if(l!==0)break;let C=t.substring(x+1,o-1),W=ce(C,0);if(W===-1){h.lastIndex=o;continue}let E=C.substring(0,W).trim(),Z=C.substring(W+1).trim(),z=Z.match(/^\s*['"]([^'"]+)['"]/);if(!z){h.lastIndex=o;continue}let _=z[1],K=Z.substring(z[0].length),D,k=ce(K,0);if(k!==-1)D=K.substring(k+1).trim();try{let I=`Boolean(${E})`,j;if(m(I)){let ie=p(I,Object.keys(e));j=Boolean(ie(...Object.values(e)))}else j=Boolean(d(I,e));let ee=v?!j:j,ne="";if(ee){let ie=L(_,u,a);if(ie&&await Bun.file(ie).exists())b.add(ie);ne=`@include('${_}'${D?`, ${D}`:""})`}t=t.substring(0,i)+ne+t.substring(o),h.lastIndex=0}catch(I){let j=I instanceof Error?I.message:String(I),ee=y("Include",`Error evaluating ${f} condition: ${j}`,a,c,i);t=t.substring(0,i)+ee+t.substring(o),h.lastIndex=0}}}{let f=/@each\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),C=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let[,W,E,Z,z]=C;try{let _,K=E.trim();if(m(K))_=p(K,Object.keys(e))(...Object.values(e));else _=d(K,e);let D="";if(Array.isArray(_)&&_.length>0)for(let k of _){let I={...e,[Z]:k},j=await te(W,I,c,h);D+=j}else if(z)D=await te(z,{},c,h);t=t.substring(0,h)+D+t.substring(x+1),f.lastIndex=0}catch(_){let K=_ instanceof Error?_.message:String(_);t=t.substring(0,h)+y("Each",`Error in @each: ${K}`,a,c,h)+t.substring(x+1),f.lastIndex=0}}}{let f=/@includeFirst\s*\(/g,v;while((v=f.exec(t))!==null){let h=v.index,g=h+v[0].length-1,i=1,x=g+1;while(x<t.length&&i>0){if(t[x]==="(")i++;else if(t[x]===")"){if(i--,i===0)break}x++}if(i!==0)break;let l=t.substring(g+1,x),o=t.substring(h,x+1),C=l.match(/^\s*(\[[^\]]+\])/);if(!C){f.lastIndex=0,t=t.replace(o,"");continue}let W=C[1],E=l.slice(C[0].length),Z,z=E.match(/^\s*,\s*\{/);if(z){E=E.slice(z[0].length-1);let D=1,k=1;while(k<E.length&&D>0){if(E[k]==="{")D++;else if(E[k]==="}"){if(D--,D===0)break}k++}Z=E.substring(0,k+1),E=E.slice(k+1)}let _,K=E.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(K)_=K[1];try{let D=JSON.parse(W.replace(/'/g,'"')),k={};if(Z)try{k=O(Z,e)}catch(j){let ee=j instanceof Error?j.message:String(j);if(r.debug){let ne=y("Include",`Error parsing includeFirst variables: ${ee}`,a,c,h,o);t=t.replace(o,()=>ne)}else t=t.replace(o,()=>_||"");continue}let I=!1;for(let j of D){let ee=L(j,u,a);if(!ee)continue;if(await s(ee)){let ne=await te(j,k,c,h);t=t.replace(o,()=>ne),I=!0;break}}if(!I)if(_!==void 0)t=t.replace(o,()=>_);else if(r.debug){let j=y("Include",`None of the includeFirst paths exist: ${W}`,a,c,h,o);t=t.replace(o,()=>j)}else t=t.replace(o,"")}catch(D){let k=D instanceof Error?D.message:String(D),I=y("Include",`Error processing @includeFirst: ${k}`,a,c,h,o);t=t.replace(o,()=>I)}f.lastIndex=0}}function L(f,v,h){try{let g=f;if(!f.endsWith(".stx"))g=`${f}.stx`;let i=M.resolve(v),x=M.resolve(M.dirname(h)),l;if(!g.startsWith("./")&&!g.startsWith("../")){for(let z of r._layerPartialDirs??[]){let _=M.resolve(z,g);if(_.startsWith(`${M.resolve(z)}${M.sep}`)&&ye(_))return _}l=M.resolve(v,g)}else l=M.resolve(x,g);let o=M.normalize(l),C=o.startsWith(i+M.sep)||o===i,W=o.startsWith(x+M.sep)||o===x,E=!1,Z=M.dirname(x);if(o.startsWith(Z+M.sep)){if(!M.relative(Z,o).split(M.sep).some((D)=>D.startsWith(".")&&D!=="."&&D!==".."))E=!0}if(!C&&!W&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${f}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${i}, ${x}`),null;return o}catch(g){return console.error(`Error resolving path ${f}: ${g}`),null}}let re=M.resolve(a);n.add(re);function B(f,v,h,g){return r.onIncludeError?.({includePath:f,templatePath:a,message:v,partialsDir:u}),y("Include",v,a,h,g)}async function te(f,v={},h,g){let i=L(f,u,a);if(!i)return B(f,`Could not resolve path for include: ${f}`,h,g);let x=M.resolve(i);if(n.has(x)){let l=[...n,x].map((o)=>M.basename(o)).join(" -> ");return B(f,`Circular include detected: ${l}`,h,g)}try{b.add(i);let l;if(!l)try{l=await Bun.file(i).text()}catch(S){let X=S instanceof Error?S.message:String(S);return B(f,`Error loading include file ${f}: ${X}`,h,g)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:S}=await import("./chunk-f0b3ca2n.js");l=S(l,e)}if(l&&(r.debug||!A()&&!Pn()))try{let{warnUnbalancedTags:S}=await import("./chunk-vk98r75z.js");S(l,i)}catch{}try{let{processESImports:S}=await import("./chunk-53797jvm.js");l=await S(l,e,i,r,b)}catch(S){if(r.debug)console.warn(`[stx] partial ES import extraction skipped for ${i}:`,S instanceof Error?S.message:S)}let o=l,C=he(o);if(C)o=C.content.trim();let E=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Z="";if(E)Z=`<style${E[1]}>${E[2]}</style>`;let z=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(S,X,w)=>{if(!fe(X))return"";return z.push({attrs:X,body:w}),`__STX_DATA_BLOCK_${z.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let _={...e};_.__stx_signals_gate=Te(l,i);for(let[S,X]of Object.entries(v))_[S]=X;let K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...l.matchAll(K)].sort((S,X)=>{let w=(S[1]||"").includes("server"),V=(X[1]||"").includes("server");return Number(V)-Number(w)}),k="",I=null,j=!1,ee=!1;for(let S of D){let X=S[1]||"",w=S[2]||"";if(fe(X))continue;let V=X.includes("server"),be=Ve(X);if(!V&&!/\bsrc\s*=/i.test(X))je(w,i,r.strict);if(!V&&w.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-axkgbc0k.js");w=F(w,_,f)}let oe="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-cdbmfe7d.js"),se=F(w,{filePath:i,projectRoot:process.cwd()});w=se.code,oe=Q(se.styles)}catch(F){if(r.debug)console.warn(`[stx] vendor-css extractor skipped for ${i}:`,F instanceof Error?F.message:F)}if(be&&w.trim())w=Ue(w);if(!V){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-cdbmfe7d.js");w=Q(w).code;let{hasUserImports:se,bundleClientScript:Se}=await import("./chunk-yrstc4z4.js");if(se(w))w=await Se(w,i,{projectRoot:process.cwd()})}catch(Q){if(r.debug)console.warn(`[stx] bundler skipped for ${i}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-t9r644tq.js");w=F(w)}let de=Ee(w);if(!V){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-cdbmfe7d.js"),se=Q(w,F(_));if(se)w=`${se}
|
|
48
48
|
${w}`}if(de&&!V){j=!0,I=ue(i,e);let F=N(w),Q=ge(F,I);k+=`${oe}<script data-stx-scoped data-stx-run="always" data-stx-owner="${I}">${Q}</script>
|
|
49
|
-
`;continue}if(V)try{let{extractVariables:F}=await import("./chunk-
|
|
50
|
-
`}}if(z.length>0){let{interpolateScriptExpressions:S}=await import("./chunk-
|
|
49
|
+
`;continue}if(V)try{let{extractVariables:F}=await import("./chunk-tbq6msyc.js");await F(w,_,i)}catch(F){if(r.debug)console.warn(`Warning: Could not extract variables from server script in ${i}:`,F)}if(!V&&!de){let F=X.replace(/\bclient\b/i,"").trim();I=ue(i,e);let Q=N(w),se=ge(Q,I);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(se))ee=!0;k+=`${oe}<script data-stx-scoped data-stx-run="always" data-stx-owner="${I}"${F?` ${F}`:""}>${se}</script>
|
|
50
|
+
`}}if(z.length>0){let{interpolateScriptExpressions:S}=await import("./chunk-axkgbc0k.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(X,w)=>{let V=z[Number(w)];return`<script${V.attrs}>${S(V.body,_,f)}</script>`})}if(I){let S=Me(o,I);if(o=S.html,S.mergedIntoExisting){let w=I,V=S.mergedIntoExisting;k=k.split(`'${w}'`).join(`'${V}'`).split(`"${w}"`).join(`"${V}"`),I=V}else if(!S.stamped&&j&&!ae.has(i))ae.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} 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(S.stamped&&S.root!=="body"&&(j||ee)&&!pe.has(i)){let w=Gf(o);if(w.length>1)pe.add(i),console.warn(`[stx] ${M.relative(process.cwd(),i)} declares ${j?"signals":"bindings"} and has ${w.length} top-level elements (${w.map((V)=>`<${V}>`).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 X=S.stamped&&S.root!==null&&Ar(S.root);k=ke(k,X?I:null)}if(o.includes("@include")||o.includes("@partial"))o=await gs(o,_,i,r,b,n);let{processLoops:ne,reportDeferredLoopWarnings:ie}=await import("./chunk-qcvfzskb.js"),G=ne(o,_,i,void 0,!0);G=le(G,_,i),G=ie(G);let{processMetaDirectives:xe,processSeoDirective:_e,processStructuredData:we}=await import("./chunk-fmzyrg2e.js");if(G=xe(G,_,i,r),G=we(G,_,i),G=_e(G,_,i,r),G=R(G,_,i),Z)G+=`
|
|
51
51
|
`+Z;if(k)G+=`
|
|
52
52
|
`+k;return G}catch(l){if(l instanceof J)throw l;let o=l instanceof Error?l.message:String(l);return B(f,`Error processing include ${f}: ${o}`,h,g)}}let Y=/@include\s*\(/g,U;while((U=Y.exec(t))!==null){let f=U.index,v=f+U[0].length-1,h=1,g=v+1;while(g<t.length&&h>0){if(t[g]==="(")h++;else if(t[g]===")")h--;g++}if(h!==0)break;let i=t.substring(f,g),x=t.substring(v+1,g-1),l=x.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=g;continue}let o=l[1],C,W=x.substring(l[0].length),E=ce(W,0);if(E!==-1)C=W.substring(E+1).trim();let Z={};if(C)try{Z=O(C,e)}catch(_){let K=_ instanceof Error?_.message:String(_);t=t.replace(i,y("Include",`Error parsing include variables for ${o}: ${K}`,a,c,f)),Y.lastIndex=0;continue}let z=await te(o,Z,c,f);t=t.substring(0,f)+z+t.substring(g),Y.lastIndex=0}return t}function ms(c,e){let a=c;function r(b,n,u,t){let T=b,L=!0;while(L){L=!1;let re=new RegExp(`@${n}\\(['"]([^'"]+)['"]\\)`),B=T.match(re);if(!B||B.index===void 0)break;let te=B.index,Y=B[1],U=te+B[0].length,f=new RegExp(`@${n}\\(`),v=new RegExp(`@${u}(?![a-z])`),h=1,g=U,i=-1;while(h>0&&g<T.length){let l=T.slice(g),o=l.match(f),C=l.match(v),W=o?g+o.index:1/0,E=C?g+C.index:1/0;if(W<E)h++,g=W+(o[0].length||1);else if(E<1/0){if(h--,h===0){i=E;break}g=E+u.length+1}else break}if(i===-1)break;let x=T.slice(U,i);if(!e[Y])e[Y]=[];if(t)e[Y].unshift(x);else e[Y].push(x);T=T.substring(0,te)+T.substring(i+`@${u}`.length),L=!0}return T}return a=r(a,"push","endpush",!1),a=r(a,"prepend","endprepend",!0),a}function hs(c,e){return c.replace(/@stack\(['"]([^'"]+)['"]\)/g,(a,r)=>{if(!e[r]||e[r].length===0)return"";return e[r].join(`
|
|
53
53
|
`)})}
|