@stacksjs/stx 0.2.833 → 0.2.835
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/builtins/image-worker.js +6 -1
- package/dist/{chunk-a395a3dt.js → chunk-02s0hzwa.js} +8 -8
- package/dist/{chunk-vb4xzz5c.js → chunk-0a36jnq4.js} +1 -1
- package/dist/chunk-0nc94zjd.js +2 -0
- package/dist/chunk-0rnfywsx.js +2 -0
- package/dist/chunk-0ygvav3v.js +3 -0
- package/dist/{chunk-qym44qqd.js → chunk-12bwztw2.js} +4 -4
- package/dist/{chunk-4xw22xqd.js → chunk-1pg50kva.js} +6 -6
- package/dist/chunk-1q3gjt3t.js +2 -0
- package/dist/chunk-213skjvq.js +2 -0
- package/dist/{chunk-mxvevxb8.js → chunk-29f6vmyz.js} +4 -4
- package/dist/{chunk-jp6sbk05.js → chunk-2nxxhcyy.js} +1 -1
- package/dist/{chunk-1c62mrad.js → chunk-2xcnynmg.js} +5 -5
- package/dist/{chunk-xdwnbr9b.js → chunk-33czswpt.js} +2 -2
- package/dist/{chunk-r2fwxtke.js → chunk-35vsv68x.js} +1 -1
- package/dist/{chunk-ekh3mxyp.js → chunk-3bjnrmha.js} +2 -2
- package/dist/{chunk-1b1crd5a.js → chunk-3fk1cm0n.js} +4 -4
- package/dist/{chunk-tchz2m2v.js → chunk-3s70qc9v.js} +1 -1
- package/dist/{chunk-04z1xyrb.js → chunk-4ntm3dtk.js} +2 -2
- package/dist/{chunk-mypygxdm.js → chunk-52g026sc.js} +2 -2
- package/dist/{chunk-716jrdcg.js → chunk-52t0qpx6.js} +1 -1
- package/dist/{chunk-w7m9pecb.js → chunk-53gp3w46.js} +5 -5
- package/dist/{chunk-4a3r1kh1.js → chunk-55e46spy.js} +2 -2
- package/dist/{chunk-kn3pknzt.js → chunk-5n988caw.js} +3 -3
- package/dist/{chunk-xdqv5yq4.js → chunk-6eqjf0r6.js} +2 -2
- package/dist/{chunk-6kk8p766.js → chunk-6vx101bj.js} +1 -1
- package/dist/{chunk-yrw5ensv.js → chunk-7bvvv74e.js} +2 -2
- package/dist/chunk-7chq9qj0.js +2 -0
- package/dist/chunk-7efkc3gk.js +2 -0
- package/dist/chunk-7phzt95j.js +2 -0
- package/dist/{chunk-g00nhj1d.js → chunk-7v372ds3.js} +7 -7
- package/dist/chunk-7ygadxrq.js +2 -0
- package/dist/{chunk-5201w0f1.js → chunk-84nw3921.js} +3 -3
- package/dist/{chunk-qws72sn9.js → chunk-88b319bz.js} +32 -32
- package/dist/{chunk-g0vz0ch5.js → chunk-8f49t8wb.js} +7 -7
- package/dist/chunk-8tm6701m.js +2 -0
- package/dist/{chunk-gy59sm92.js → chunk-9cy3fy0k.js} +2 -2
- package/dist/chunk-9fk98kja.js +2 -0
- package/dist/chunk-9q378vgc.js +2 -0
- package/dist/{chunk-c6gr71fg.js → chunk-9q3pqtx8.js} +1 -1
- package/dist/chunk-9w3r1ch2.js +3 -0
- package/dist/{chunk-38wq4ttd.js → chunk-a1fp1nyf.js} +95 -95
- package/dist/chunk-a1hxz8q4.js +2 -0
- package/dist/{chunk-wt7qhv5b.js → chunk-a579jdwb.js} +1 -1
- package/dist/{chunk-7p8m82pj.js → chunk-amg6kr1p.js} +2 -2
- package/dist/chunk-anckn6bc.js +42 -0
- package/dist/{chunk-67nq6csk.js → chunk-bc4x45vx.js} +1 -1
- package/dist/{chunk-3p7r3ajd.js → chunk-bky02g7k.js} +2 -2
- package/dist/chunk-bsm5ds0r.js +2 -0
- package/dist/{chunk-hd378dgy.js → chunk-c3dg8qdn.js} +2 -2
- package/dist/chunk-c7hw37ww.js +2 -0
- package/dist/{chunk-cca18z35.js → chunk-c9vxm8yq.js} +8 -8
- package/dist/{chunk-gcf97wgx.js → chunk-dv11h4f0.js} +1 -1
- package/dist/{chunk-6b1g5a6a.js → chunk-e3pkgwd8.js} +11 -11
- package/dist/chunk-f6vzn90z.js +2 -0
- package/dist/chunk-fcy7n409.js +2 -0
- package/dist/{chunk-wr7bmkne.js → chunk-fvgk1w9s.js} +2 -2
- package/dist/chunk-g40zerct.js +2 -0
- package/dist/{chunk-cv1zc9dg.js → chunk-gh62p9mx.js} +2 -2
- package/dist/chunk-gtj8wy95.js +2 -0
- package/dist/{chunk-3grrmmrg.js → chunk-gy3pegf9.js} +1 -1
- package/dist/{chunk-wb6w807m.js → chunk-h4tbpr7p.js} +1 -1
- package/dist/{chunk-s67pnfvz.js → chunk-h6w7jr4b.js} +4 -4
- package/dist/{chunk-a7j451hn.js → chunk-h8pp1dsq.js} +2 -2
- package/dist/chunk-hhh6v5cw.js +2 -0
- package/dist/chunk-hzs22cc9.js +2 -0
- package/dist/chunk-j0w048sj.js +2 -0
- package/dist/chunk-j6146c13.js +2 -0
- package/dist/{chunk-t59bc7na.js → chunk-jr0r5pzw.js} +2 -2
- package/dist/{chunk-fby81k5g.js → chunk-k23nn7k9.js} +2 -2
- package/dist/chunk-k5jmnt0z.js +2 -0
- package/dist/chunk-k761q7s7.js +2 -0
- package/dist/{chunk-1vzncfka.js → chunk-kw5gra2z.js} +2 -2
- package/dist/chunk-mdtysd2d.js +2 -0
- package/dist/{chunk-hfktzsat.js → chunk-mejtwsgy.js} +1 -1
- package/dist/chunk-mmm5t7jf.js +2 -0
- package/dist/chunk-mr97dmgb.js +2 -0
- package/dist/{chunk-rkdsgfhd.js → chunk-ms3v5nat.js} +6 -6
- package/dist/{chunk-95d5qy7d.js → chunk-mvk7rm5q.js} +2 -2
- package/dist/{chunk-f6b7av6b.js → chunk-n4qznmkm.js} +5 -5
- package/dist/{chunk-6qbatp72.js → chunk-n82sms5e.js} +5 -5
- package/dist/{chunk-a9d14beh.js → chunk-nbz025jk.js} +1 -1
- package/dist/{chunk-m9bbhg46.js → chunk-nmtya57z.js} +2 -2
- package/dist/{chunk-02zvytqx.js → chunk-nxfyjw59.js} +1 -1
- package/dist/{chunk-xn9jg1q5.js → chunk-nyg0nbjj.js} +1 -1
- package/dist/{chunk-7nnep25t.js → chunk-pq6x35gz.js} +5 -5
- package/dist/chunk-pwv77cyb.js +2 -0
- package/dist/{chunk-dzm9g76x.js → chunk-pzavparv.js} +1 -1
- package/dist/{chunk-bgqbvf1w.js → chunk-q4h6mhn1.js} +6 -6
- package/dist/chunk-rkk2mb0h.js +2 -0
- package/dist/{chunk-wvds0s9m.js → chunk-rnm8ejpz.js} +2 -2
- package/dist/chunk-rsg4zdt3.js +2 -0
- package/dist/{chunk-c84pxd2k.js → chunk-s33andzg.js} +2 -2
- package/dist/{chunk-4z0jpzdq.js → chunk-s3j5vxy9.js} +2 -2
- package/dist/{chunk-8y8kgw9s.js → chunk-s6r54dyf.js} +2 -2
- package/dist/{chunk-vhehb6eh.js → chunk-sstbhctt.js} +1 -1
- package/dist/chunk-t612xpa4.js +2 -0
- package/dist/{chunk-g4qzy5hv.js → chunk-tesbhpbp.js} +1 -1
- package/dist/chunk-tj90sfcs.js +2 -0
- package/dist/{chunk-m9dj8pgb.js → chunk-tvw571ab.js} +1 -1
- package/dist/{chunk-6k26n0sj.js → chunk-tx8wk6h7.js} +2 -2
- package/dist/{chunk-c9mdvpf5.js → chunk-txd2js5v.js} +10 -10
- package/dist/{chunk-qnrgfm9v.js → chunk-v3xyb3ws.js} +2 -2
- package/dist/chunk-vbwtx73e.js +2 -0
- package/dist/{chunk-2qngyyaz.js → chunk-vfj9wp11.js} +2 -2
- package/dist/{chunk-nfpsaaqm.js → chunk-vfxkn1pe.js} +3 -3
- package/dist/{chunk-cfqz4bd6.js → chunk-vmj0hqzc.js} +1 -1
- package/dist/chunk-vqpypnys.js +2 -0
- package/dist/{chunk-qy6dtm1a.js → chunk-w0a6yz73.js} +8 -8
- package/dist/{chunk-ba499a3p.js → chunk-w5g788r7.js} +1 -1
- package/dist/{chunk-3sqay5jm.js → chunk-waz6g84g.js} +3 -3
- package/dist/{chunk-yd1j88kp.js → chunk-wpy1ytv9.js} +6 -6
- package/dist/{chunk-m6q2vedz.js → chunk-ws9ypnvs.js} +4 -4
- package/dist/chunk-wz24zyt1.js +2 -0
- package/dist/chunk-x4x1xj40.js +2 -0
- package/dist/{chunk-z58dr234.js → chunk-x6ck5s29.js} +1 -1
- package/dist/chunk-x7bbbmgd.js +2 -0
- package/dist/{chunk-6tjm38e4.js → chunk-xtqapjz3.js} +1 -1
- package/dist/{chunk-qadce16v.js → chunk-ya6bp08c.js} +1 -1
- package/dist/{chunk-zvvv6x8c.js → chunk-yw1s8kyj.js} +3 -3
- package/dist/{chunk-rmygv0n0.js → chunk-z0ynyz62.js} +4 -4
- package/dist/{chunk-y34ayg61.js → chunk-zr4e0jrh.js} +42 -40
- package/dist/cli.js +13 -13
- package/dist/client/signals-class-runtime.js +1 -1
- package/dist/client/signals-native-row-runtime.js +3 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/document-styles.d.ts +7 -0
- package/dist/document-styles.js +40 -0
- package/dist/html-masking.js +6 -3
- package/dist/process.js +3 -0
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-09fbj9b4.js +0 -2
- package/dist/chunk-17h13201.js +0 -2
- package/dist/chunk-17zrprh0.js +0 -2
- package/dist/chunk-28z6pq6w.js +0 -42
- package/dist/chunk-293fnyc2.js +0 -2
- package/dist/chunk-42c92rp3.js +0 -2
- package/dist/chunk-437wgphe.js +0 -2
- package/dist/chunk-46yyc2sf.js +0 -2
- package/dist/chunk-503ppv77.js +0 -2
- package/dist/chunk-5e7abvtz.js +0 -2
- package/dist/chunk-6r4teng3.js +0 -2
- package/dist/chunk-7b105hww.js +0 -2
- package/dist/chunk-83hwrh5n.js +0 -2
- package/dist/chunk-8n8vj099.js +0 -2
- package/dist/chunk-9jvpyq5h.js +0 -2
- package/dist/chunk-abh791bh.js +0 -2
- package/dist/chunk-aqjcqnex.js +0 -2
- package/dist/chunk-awd0dvjb.js +0 -2
- package/dist/chunk-b39g02k9.js +0 -2
- package/dist/chunk-e7yejx6x.js +0 -2
- package/dist/chunk-f8g0sgs0.js +0 -2
- package/dist/chunk-fb90n0by.js +0 -2
- package/dist/chunk-ggnzezrn.js +0 -2
- package/dist/chunk-jny0vbmt.js +0 -2
- package/dist/chunk-k6ye0159.js +0 -3
- package/dist/chunk-kgn911k7.js +0 -2
- package/dist/chunk-kr6x19z0.js +0 -2
- package/dist/chunk-kshem79d.js +0 -2
- package/dist/chunk-ns23fv15.js +0 -3
- package/dist/chunk-pc4xah5j.js +0 -2
- package/dist/chunk-q2tbbtqn.js +0 -2
- package/dist/chunk-qg2tpvdw.js +0 -2
- package/dist/chunk-shzkz2az.js +0 -2
- package/dist/chunk-v1mwhvf8.js +0 -2
- package/dist/chunk-vce1js6z.js +0 -2
- package/dist/chunk-vhmzkhy4.js +0 -2
- package/dist/chunk-wpyhavjy.js +0 -2
- package/dist/chunk-zt74q4c8.js +0 -2
- package/dist/chunk-zty254tw.js +0 -2
- package/dist/chunk-zy41xhc4.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{X}from"./chunk-
|
|
2
|
+
import{X}from"./chunk-jr0r5pzw.js";import He 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 Q(e){for(let[n,r]of Object.entries(t))if(r===e)return n;return}import ht from"path";var yt={showRelativePaths:!1,enableAutoRecovery:X(),logRecoveryWarnings:!0},ee={...yt};function F(){return{...ee}}function j(e){if(!ee.showRelativePaths||!e)return e;let n=ee.baseDir||process.cwd();try{let r=ht.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=j(this.filePath)}}class ce 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 Tr 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 K 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 we(e){let{type:n,message:r,code:i,filePath:s,line:o,column:a,template:c,offset:p,snippet:g,suggestion:h,format:m="text"}=e,y=o,E=a;if(!y&&c&&p!==void 0){let Z=St(c,p);y=Z.line,E=Z.column}let v=s?j(s):void 0,w=i?Q(i):void 0,R={type:n,code:i,codeName:w,message:r,filePath:v,line:y,column:E,snippet:g,suggestion:h,timestamp:new Date().toISOString()},_;switch(m){case"html":_=Et(R);break;case"json":_=JSON.stringify(R,null,2);break;case"console":_=xt(R,c,p);break;case"text":default:_=bt(R,c,p);break}return{formatted:_,data:R}}function bt(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=wt(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(`
|
|
@@ -24,7 +24,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
24
24
|
`)}writeToFile(e){this.writeQueue=this.writeQueue.then(async()=>{try{let n=await import("fs"),r=await import("path"),i=r.dirname(this.logFilePath);if(!n.existsSync(i))n.mkdirSync(i,{recursive:!0});await this.rotateIfNeeded(n);let s=`${this.formatEntry(e)}
|
|
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
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var z=new te,
|
|
27
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var z=new te,_n={isDevelopment(){return X()},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
28
|
`)}};function x(e,n,r,i=0){let s=0,o=i,a=null,c=0,p=!1;while(o<e.length){let g=e[o];if(a&&p){p=!1,o++;continue}if(a&&g==="\\"){p=!0,o++;continue}if(p=!1,(g==='"'||g==="'"||g==="`")&&!a){a=g,o++;continue}if(g===a&&a!=="`"){a=null,o++;continue}if(a==="`"&&g==="$"&&e[o+1]==="{"){c++,o+=2;continue}if(c>0&&g==="}"){c--,o++;continue}if(g==="`"&&a==="`"&&c===0){a=null,o++;continue}if(a){o++;continue}if(g===n)s++;else if(g===r){if(s--,s===0)return o}o++}return-1}function ol(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 T{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,Tt=500;function jt(e,n){if(n?.includes("g"))return new RegExp(e,n);let r=`${e}:${n||""}`;if(!M.has(r)){if(M.size>=Tt){let i=M.keys().next().value;if(i)M.delete(i)}M.set(r,new RegExp(e,n))}return M.get(r)}class Se{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)=>(p)=>{try{let g=`${r}:${p}`,h=s.get(g);if(!h){if(s.size>=o){let m=s.keys().next().value;if(m)s.delete(m)}h=Function(...n,`
|
|
29
29
|
'use strict';
|
|
30
30
|
try {
|
|
@@ -36,7 +36,7 @@ catch (e) {
|
|
|
36
36
|
}
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
|
-
`),s.set(g,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var nr=new Se;class Te{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let p of this.violationHandlers)try{p(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ne=null;function kt(){if(!ne)ne=new Te;return ne}var ae=new Proxy({},{get(e,n){return kt()[n]}});var ve=0;async function A(){if(performance.now()-ve<16)return;await new Promise((e)=>setTimeout(e,0)),ve=performance.now()}var Rt={maxSanitizeDepth:10,allowBracketNotation:!1},Pe={...Rt};var U=/\bnew\s+/,V="__stx_safe_ctors",Le=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],re=[...Le,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],ke=re.map(()=>{return}),ie=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),oe=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,U,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],le=new Set([...Le,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",V]),ue=new Set(["__proto__","constructor","prototype"]);function Me(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Ne(e){return Me(e).text}var Fe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],De=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Fe)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),$t=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Re=/(?<![\w$])new(?![\w$])/g,$e=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Fe.join(",")}}() are allowed`;function Ct(e){let{text:n,map:r}=Me(e),i=[];Re.lastIndex=0;let s;while((s=Re.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=$t.exec(n.slice(a)),p=c?.[3],g=!c?null:p?`Intl_${p}`:c[2];if(!c||!g||!(g in De))throw new S(`matched /${U.source}/; ${$e}`,e);let h=a+c[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new S(`matched /${U.source}/; ${$e}`,e);let E=m+3+c[1].length;i.push({start:E,end:E+c[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${V}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function qs(e){try{return ge(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function ze(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(le.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ue.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function je(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(c),g=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(p||g){let m=c.slice(1,-1);if(ue.has(m))throw new S(`bracket key ${m}`,e);if(!Pe.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ge(e){let n=e.trim(),r=Ne(n);ze(r,n);let i=je(n);for(let s of oe){if(s===U)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{...Ct(n),dynamicKeys:i}}function _i(e){return ge(e),e.trim()}var Ks=Symbol("stx.sanitizeCache"),At=4000,B=new Map;function _t(e){let n=B.get(e);if(n===void 0){if(n=oe.some((r)=>r.test(e)),B.size>=At)B.clear();B.set(e,n)}return n}function W(e){let n={},r=e[Ks];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=ie,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||_t(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=se(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function se(e,n=0){if(n>=Pe.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>se(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=se(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=W(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return _i(e),!0}catch{return!1}}function sl(e,n){try{let r=W(n),i=Object.keys(r),s=Object.values(r),o=!1,c=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function P(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Be=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),It=2000,H=new Map;function Ae(e,n){let r=`${e.join(",")}\x00${n}`,i=H.get(r);if(i)return i;let s=Function(...e,n);if(H.size>=It)H.clear();return H.set(r,s),s}function ot(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var Ot=/^[A-Za-z_$][\w$]*$/;function Bt(e){return Ot.test(e)&&!Be.has(e)}var Ie=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function d(e,n,r){let i=JSON.stringify([e,n]),s=Ie.get(i);if(!s)s=Pt(e,[...n]),s.sourceBytes+=i.length*2,Ie.set(i,s);return Lt(Mt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Pt(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ge(e),o=[];for(let m=0;m<n.length;m++){if(!Bt(n[m]))continue;if(n[m]===V||n[m]==="Object"||le.has(n[m]))continue;o.push({key:n[m],index:m})}o.sort((m,y)=>m.key<y.key?-1:1);let a=o.map((m)=>m.key),c=o.map((m)=>m.index),p=`
|
|
39
|
+
`),s.set(g,h)}return h(...c)}catch{return}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:a,context:n.slice()});return a}clear(){this.pool.length=0,this.fnCache.clear()}}var nr=new Se;class Te{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(e){this.enabled=e}isEnabled(){return this.enabled}setBudget(e,n){this.budgets.set(e,{warnThreshold:0.8,action:"warn",...n})}setBudgets(e){for(let[n,r]of Object.entries(e))this.setBudget(n,r)}removeBudget(e){this.budgets.delete(e)}getBudgets(){let e={};for(let[n,r]of this.budgets.entries())e[n]=r;return e}onViolation(e){this.violationHandlers.push(e)}offViolation(e){let n=this.violationHandlers.indexOf(e);if(n!==-1)this.violationHandlers.splice(n,1)}time(e,n){if(!this.enabled)return n();let r=performance.now(),i=n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}async timeAsync(e,n){if(!this.enabled)return n();let r=performance.now(),i=await n(),s=performance.now()-r;return this.recordTime(e,s),this.checkBudget(e,s),i}checkBudget(e,n){let r=this.budgets.get(e);if(!r)return;let i=n/r.maxTime*100,s=r.warnThreshold!==void 0?n>=r.maxTime*r.warnThreshold&&n<r.maxTime:!1,o=n>=r.maxTime;if(!s&&!o)return;let a={label:e,actualTime:n,budgetTime:r.maxTime,exceedancePercent:i,timestamp:new Date,isWarning:s};this.violations.push(a);while(this.violations.length>this.maxViolations)this.violations.shift();for(let p of this.violationHandlers)try{p(a)}catch{}let c=s?`[Performance Warning] "${e}" took ${n.toFixed(2)}ms (${i.toFixed(1)}% of ${r.maxTime}ms budget)`:`[Performance Budget Exceeded] "${e}" took ${n.toFixed(2)}ms (exceeded ${r.maxTime}ms budget by ${(i-100).toFixed(1)}%)`;switch(r.action){case"log":console.log(c);break;case"warn":console.warn(c);break;case"error":console.error(c);break;case"throw":if(o)throw Error(c);else console.warn(c);break}}recordTime(e,n){let r=this.metrics.get(e);if(r)r.count++,r.totalTime+=n,r.maxTime=Math.max(r.maxTime,n),r.minTime=Math.min(r.minTime,n);else this.metrics.set(e,{count:1,totalTime:n,maxTime:n,minTime:n})}getStats(e){if(e){let r=this.metrics.get(e);if(!r)return{};let i=this.budgets.get(e);return{count:r.count,avgTime:r.totalTime/r.count,totalTime:r.totalTime,maxTime:r.maxTime,minTime:r.minTime,budget:i?.maxTime,budgetUtilization:i?r.totalTime/r.count/i.maxTime*100:void 0}}let n={};for(let[r,i]of this.metrics.entries()){let s=this.budgets.get(r);n[r]={count:i.count,avgTime:i.totalTime/i.count,totalTime:i.totalTime,maxTime:i.maxTime,minTime:i.minTime,budget:s?.maxTime,budgetUtilization:s?i.totalTime/i.count/s.maxTime*100:void 0}}return n}getViolations(e){if(e)return this.violations.filter((n)=>n.label===e);return[...this.violations]}getViolationStats(){let e={},n=0,r=0;for(let i of this.violations)if(e[i.label]=(e[i.label]||0)+1,i.isWarning)n++;else r++;return{total:this.violations.length,byLabel:e,warnings:n,errors:r}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var ne=null;function kt(){if(!ne)ne=new Te;return ne}var ae=new Proxy({},{get(e,n){return kt()[n]}});var ve=0;async function A(){if(performance.now()-ve<16)return;await new Promise((e)=>setTimeout(e,0)),ve=performance.now()}var Rt={maxSanitizeDepth:10,allowBracketNotation:!1},Pe={...Rt};var U=/\bnew\s+/,V="__stx_safe_ctors",Le=["Bun","Deno","Buffer","fetch","atob","btoa","console","Response","Request","Headers","WebAssembly","structuredClone","queueMicrotask","crypto","performance","navigator","Worker","WebSocket","BroadcastChannel","EventSource","XMLHttpRequest","localStorage","sessionStorage"],re=[...Le,"Function","setTimeout","setInterval","setImmediate","process","require","exports","module","window","document","global","globalThis","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry"],ke=re.map(()=>{return}),ie=Object.freeze(Object.assign(Object.create(null),{keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,assign:Object.assign,hasOwn:Object.hasOwn,is:Object.is})),oe=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,U,/\bdelete\s+/,/\bthis\b/,/\\u(?:\{[\dA-Fa-f]+\}|[\dA-Fa-f]{4})/],le=new Set([...Le,"eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this",V]),ue=new Set(["__proto__","constructor","prototype"]);function Me(e){let n="",r=[],i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(s){s=!1;continue}if(a==="\\"&&i){s=!0;continue}if(i){if(i==="`"&&a==="$"&&o+1<e.length&&e[o+1]==="{"){let c=1;o+=2;while(o<e.length&&c>0){if(e[o]==="{")c++;else if(e[o]==="}")c--;if(c>0)n+=e[o],r.push(o),o++}continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}n+=a,r.push(o)}return{text:n,map:r}}function Ne(e){return Me(e).text}var Fe=["Collator","DateTimeFormat","DisplayNames","ListFormat","Locale","NumberFormat","PluralRules","RelativeTimeFormat","Segmenter"],De=(()=>{let e={Date,URL,URLSearchParams},n=Intl;for(let r of Fe)if(typeof n[r]==="function")e[`Intl_${r}`]=n[r];return Object.freeze(Object.assign(Object.create(null),e))})(),$t=/^new(\s+)(Date|URLSearchParams|URL|Intl\s*\.\s*([A-Z_a-z]\w*))\s*\(/,Re=/(?<![\w$])new(?![\w$])/g,$e=`only new Date(), new URL(), new URLSearchParams() and new Intl.{${Fe.join(",")}}() are allowed`;function Ct(e){let{text:n,map:r}=Me(e),i=[];Re.lastIndex=0;let s;while((s=Re.exec(n))!==null){let a=s.index;if(/(?<!\.)\.\s*$/.test(n.slice(0,a)))continue;let c=$t.exec(n.slice(a)),p=c?.[3],g=!c?null:p?`Intl_${p}`:c[2];if(!c||!g||!(g in De))throw new S(`matched /${U.source}/; ${$e}`,e);let h=a+c[0].length,m=r[a],y=r[h-1]+1;if(e.slice(m,y)!==n.slice(a,h))throw new S(`matched /${U.source}/; ${$e}`,e);let E=m+3+c[1].length;i.push({start:E,end:E+c[2].length,key:g})}let o=e;for(let a=i.length-1;a>=0;a--){let c=i[a];o=`${o.slice(0,c.start)}${V}.${c.key}${o.slice(c.end)}`}return{source:o,usesSafeConstructors:i.length>0}}class S extends Error{rule;expression;constructor(e,n,r){super(r??`Potentially unsafe expression (${e}): ${n}`);this.name="UnsafeExpressionError",this.rule=e,this.expression=n}}function Ks(e){try{return ge(e),null}catch(n){return n instanceof S?n.rule:n instanceof Error?n.message:String(n)}}function ze(e,n){let r=/[$A-Z_a-z][$\w]*/g,i;while((i=r.exec(e))!==null){let s=i[0],o=e[i.index-1];if(le.has(s))throw new S(`matched /\\b${s}\\b/; identifier ${s}`,n);if(o==="."&&ue.has(s))throw new S(`matched /.${s}/; property ${s}`,n)}}function je(e,n=!0){let r=/(?:[$\w)\].]|\?\.)\s*\[([^\]]*)\]/g,i=new Set,s;while((s=r.exec(e))!==null){let o=s.index+s[0].indexOf("["),a=e.slice(0,o);if(/(?:^|[^$\w])(?:let|const|var)\s*$/.test(a))continue;let c=s[1].trim(),p=/^'(?:[^'\\]|\\.)*'$/.test(c),g=/^"(?:[^"\\]|\\.)*"$/.test(c);if(/^\d+$/.test(c))continue;if(p||g){let m=c.slice(1,-1);if(ue.has(m))throw new S(`bracket key ${m}`,e);if(!Pe.allowBracketNotation)throw new S("bracket notation with a string key; enable with configureSafeEvaluator({ allowBracketNotation: true })",e,`Bracket notation with strings not allowed: ${e}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);continue}if(n&&/^[$A-Z_a-z][$\w]*$/.test(c)){i.add(c);continue}throw new S("dynamic bracket notation is not allowed",e)}return[...i]}function ge(e){let n=e.trim(),r=Ne(n);ze(r,n);let i=je(n);for(let s of oe){if(s===U)continue;if(s.test(r))throw new S(`matched /${s.source}/`,n)}return{...Ct(n),dynamicKeys:i}}function _i(e){return ge(e),e.trim()}var Xs=Symbol("stx.sanitizeCache"),At=4000,B=new Map;function _t(e){let n=B.get(e);if(n===void 0){if(n=oe.some((r)=>r.test(e)),B.size>=At)B.clear();B.set(e,n)}return n}function W(e){let n={},r=e[Xs];n.Math=Math,n.JSON=JSON,n.Date=Date,n.String=String,n.Number=Number,n.Boolean=Boolean,n.Array=Array,n.Object=ie,n.parseInt=Number.parseInt,n.parseFloat=Number.parseFloat,n.isNaN=Number.isNaN,n.isFinite=Number.isFinite,n.encodeURIComponent=encodeURIComponent,n.decodeURIComponent=decodeURIComponent;for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||_t(i))continue;if(s&&typeof s==="object"&&!Array.isArray(s)){let o=r?.get(s);if(o===void 0)o=se(s),r?.set(s,o);n[i]=o}else n[i]=s}return n}function se(e,n=0){if(n>=Pe.maxSanitizeDepth)return"[Object too deep]";if(e===null||typeof e!=="object")return e;if(Array.isArray(e))return e.map((i)=>se(i,n+1));if(e instanceof Date||e instanceof RegExp||e instanceof Map||e instanceof Set||e instanceof Error)return e;let r={};for(let[i,s]of Object.entries(e)){if(i.startsWith("__")||i==="constructor"||i==="prototype")continue;if(s&&typeof s==="object")r[i]=se(s,n+1);else r[i]=s}return r}function u(e,n){try{let r=W(n),i=Object.keys(r),s=Object.values(r);return d(e,i)(...s)}catch{return}}function f(e){try{return _i(e),!0}catch{return!1}}function sl(e,n){try{let r=W(n),i=Object.keys(r),s=Object.values(r),o=!1,c=d(e,i,()=>{o=!0})(...s);return!o&&Boolean(c)}catch{return!1}}function P(e,n){try{let r=u(e,n);if(r&&typeof r==="object"&&!Array.isArray(r))return r;return{}}catch{return{}}}var Be=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),It=2000,H=new Map;function Ae(e,n){let r=`${e.join(",")}\x00${n}`,i=H.get(r);if(i)return i;let s=Function(...e,n);if(H.size>=It)H.clear();return H.set(r,s),s}function ot(e){return e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var Ot=/^[A-Za-z_$][\w$]*$/;function Bt(e){return Ot.test(e)&&!Be.has(e)}var Ie=new T(2000,{maxBytes:2097152,sizeOf:(e)=>e.sourceBytes});function d(e,n,r){let i=JSON.stringify([e,n]),s=Ie.get(i);if(!s)s=Pt(e,[...n]),s.sourceBytes+=i.length*2,Ie.set(i,s);return Lt(Mt(s.buildFunc,s.filteredKeys,s.contextKeys,s.validEntries,s.validIndices,r),s.contextKeys,s.dynamicKeys)}function Pt(e,n){let{source:r,usesSafeConstructors:i,dynamicKeys:s}=ge(e),o=[];for(let m=0;m<n.length;m++){if(!Bt(n[m]))continue;if(n[m]===V||n[m]==="Object"||le.has(n[m]))continue;o.push({key:n[m],index:m})}o.sort((m,y)=>m.key<y.key?-1:1);let a=o.map((m)=>m.key),c=o.map((m)=>m.index),p=`
|
|
40
40
|
'use strict';
|
|
41
41
|
try {
|
|
42
42
|
return ${r};
|
|
@@ -47,11 +47,11 @@ catch (e) {
|
|
|
47
47
|
}
|
|
48
48
|
throw e;
|
|
49
49
|
}
|
|
50
|
-
`,g=i?(m)=>{let y=Ae([V,"Object",...re,...a,...m],p);return(...E)=>y(De,ie,...ke,...E)}:(m)=>{let y=Ae(["Object",...re,...a,...m],p);return(...E)=>y(ie,...ke,...E)},h=g([]);return{sourceBytes:e.length*2+n.reduce((m,y)=>m+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(m)=>m.length===0?h:g(m)}}function Lt(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 Mt(e,n,r,i,s,o){let a=e([]),c=i.every((g,h)=>g.index===h);if(n.length===r.length&&c)return Oe(a,n,e,void 0,o);return Oe((...g)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=g[s[m]];return a(...h)},n,e,(g)=>{a=e(g)},o)}function Oe(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return c(...h)}catch(y){let E=y instanceof Error?y.message:"",v=a.exec(E);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(g.has(w)||Be.has(w)||le.has(w))return;if(s?.(w),g.add(w),p.push(w),i)i(p);else c=r(p)}return}}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 Nt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Ht(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=
|
|
52
|
-
${i}${e.slice(r)}`}var fe
|
|
50
|
+
`,g=i?(m)=>{let y=Ae([V,"Object",...re,...a,...m],p);return(...E)=>y(De,ie,...ke,...E)}:(m)=>{let y=Ae(["Object",...re,...a,...m],p);return(...E)=>y(ie,...ke,...E)},h=g([]);return{sourceBytes:e.length*2+n.reduce((m,y)=>m+y.length*2,0),contextKeys:n,filteredKeys:a,validEntries:o,validIndices:c,dynamicKeys:s,buildFunc:(m)=>m.length===0?h:g(m)}}function Lt(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 Mt(e,n,r,i,s,o){let a=e([]),c=i.every((g,h)=>g.index===h);if(n.length===r.length&&c)return Oe(a,n,e,void 0,o);return Oe((...g)=>{let h=Array(s.length);for(let m=0;m<s.length;m++)h[m]=g[s[m]];return a(...h)},n,e,(g)=>{a=e(g)},o)}function Oe(e,n,r,i,s){let a=/^(\w+) is not defined$/,c=e,p=[],g=new Set(n);return(...h)=>{for(let m=0;m<=8;m++)try{return c(...h)}catch(y){let E=y instanceof Error?y.message:"",v=a.exec(E);if(!(y instanceof ReferenceError)||!v)return;let w=v[1];if(g.has(w)||Be.has(w)||le.has(w))return;if(s?.(w),g.add(w),p.push(w),i)i(p);else c=r(p)}return}}function Gs(e){let n=e.trim();try{let r=Ne(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;ze(r,n),je(n);for(let i of oe)if(i.test(r))return!1}catch{return!1}return!0}function Ei(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=x(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 Ft(e,n,r,i){let s="",o=0;for(let a of Ei(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 zt(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 de(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 Nt=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Ht(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let i=Ks(r);if(i)return{ok:!1,message:`the expression is not allowed (${i})`,code:t.UNSAFE_EXPRESSION};let s=W(n),o;try{o=d(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(ot(r))].filter((c)=>!Nt.has(c)&&!(c in s)&&!(c in globalThis));if(a.length>0)return{ok:!1,message:`${a.map((p)=>`"${p}"`).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 Ve(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 it(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function We(e){if(!e)return"";return He.isAbsolute(e)?He.relative(process.cwd(),e)||e:e}function pe(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function D(e,n,r,i,s=t.EVALUATION_ERROR){let o=i?` in ${We(i)}`:"";return console.warn(`[stx] ${pe(n)}${o}: ${r}`),l(e,`${pe(n)}: ${r}`,s)}function Js(e,n,r){let i=r?` in ${We(r)}`:"";console.warn(`[stx] ${pe(e)}${i}: ${n}`)}function Ti(){return{afterOpen:[],beforeClose:[]}}function Dt(e){return e.afterOpen.length>0||e.beforeClose.length>0}function il(e,n){if(!Dt(n))return e;let r=n.afterOpen.join(""),i=n.beforeClose.join(""),s=e.lastIndexOf("</head>"),o=r?$r(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 Ke=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function $r(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;Ke.lastIndex=r;let i=Ke.exec(e);return i?r+i[0].length:r}var me="data-stx-color-mode-boot",Xe="__STX_COLOR_MODE__",Ut=new Set(["light","dark","auto","system"]),Vt=new Set(["auto","system"]),Wt=/^[a-z][\w:-]*$/i,Kt=/^[\w-]+$/;function Xt(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(!Ut.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"||!Kt.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"||!Wt.test(s)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(s)}`);if(o!==null&&!Vt.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 he(e={}){let n=Xt(e),r=qt(n),i=`(function(){"use strict";var o=window.${Xe};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.${Xe}={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 ${me}>${i}</script>`}function Rr(e,n={}){if(e.includes(me))return e;let r=fe(e);if(r===null)return e;let i=he(n);return`${e.slice(0,r)}
|
|
52
|
+
${i}${e.slice(r)}`}var fe=$r,Gt=new RegExp(`<script\\b[^>]*\\b${me}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),qe=/<meta\b[^>]*\bcharset\b[^>]*>/gi,Ge=/<\/head>/gi;function Yt(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;Ge.lastIndex=r;let i=Ge.exec(e),s=i?i.index:e.length;qe.lastIndex=r;let o=qe.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 al(e){return Jt(Yt(e))}function Jt(e){let n=Gt.exec(e);if(!n)return e;let r=fe(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=fe(i);if(s===null)return e;return`${i.slice(0,s)}
|
|
54
|
-
${n[0]}${i.slice(s)}`}var Zt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ze=`<style data-stx-cloak>[x-cloak]{display:none !important}${Zt}</style>`,q="data-stx-html-attrs",G="data-stx-html-class",Qe=/^[A-Za-z_:][\w:.-]*$/;function k(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qt(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function at(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 en(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 I(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${k(String(i))}"`).join(" ")}function Y(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 et(e){let n=I(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${Y(e)}</script>`}function tn(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,p]of Object.entries(e||{})){if(p==null)continue;let g=c.trim();if(!Qe.test(g))continue;let h=g.toLowerCase();if(h==="lang"){o=String(p);continue}if(h==="class"){s=String(p).trim();continue}r.push(` ${g}="${k(String(p))}"`),i.push(g)}let a=` lang="${k(o)}"`;if(s)a+=` class="${k(s)}"`;if(a+=r.join(""),s)a+=` ${G}="${k(s)}"`;if(i.length)a+=` ${q}="${k(i.join(" "))}"`;return a}function cl(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 Zt="[data-stx-component-wrapper]:not([stx-hydrate]){display:contents}",Ze=`<style data-stx-cloak>[x-cloak]{display:none !important}${Zt}</style>`,q="data-stx-html-attrs",G="data-stx-html-class",Qe=/^[A-Za-z_:][\w:.-]*$/;function k(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Qt(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function at(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 en(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 I(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,i])=>`${r}="${k(String(i))}"`).join(" ")}function Y(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 et(e){let n=I(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${Y(e)}</script>`}function tn(e={},n="en"){let r=[],i=[],s="",o=n;for(let[c,p]of Object.entries(e||{})){if(p==null)continue;let g=c.trim();if(!Qe.test(g))continue;let h=g.toLowerCase();if(h==="lang"){o=String(p);continue}if(h==="class"){s=String(p).trim();continue}r.push(` ${g}="${k(String(p))}"`),i.push(g)}let a=` lang="${k(o)}"`;if(s)a+=` class="${k(s)}"`;if(a+=r.join(""),s)a+=` ${G}="${k(s)}"`;if(i.length)a+=` ${q}="${k(i.join(" "))}"`;return a}function cl(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 Ar(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=[],p=[];for(let[h,m]of Object.entries(n)){if(m==null)continue;let y=h.trim();if(!Qe.test(y))continue;let E=y.toLowerCase();if(E==="class"){let v=(i.class||"").split(/\s+/).filter(Boolean);for(let w of String(m).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(m),E!=="lang")p.push(y)}if(c.length){if(!(G in i))s.push(G);i[G]=c.join(" ")}if(p.length){if(!(q in i))s.push(q);i[q]=p.join(" ")}let g=s.map((h)=>` ${h}="${k(i[h])}"`).join("");return e.replace(r[0],()=>`<html${g}>`)}function ll(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Ze}
|
|
55
55
|
`}function nn(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 m=e.indexOf("-->",r);if(m===-1)break;r=m+3;continue}let c=o.match(/^<script\b[^>]*>/i);if(c){let m=e.toLowerCase().indexOf("</script>",r+c[0].length);if(m===-1)break;r=m+9;continue}let p=o.match(/^<link\b[^>]*>/i);if(p){n.push(p[0]),r+=p[0].length;continue}let g=o.match(/^<meta\b[^>]*>/i);if(g){n.push(g[0]),r+=g[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 p=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(p&&n.includes(p[0])){s+=p[0].length;continue}i+=e[s],s++}return i+=e.slice(r),{body:i,hoisted:n}}function rn(e,n={},r={}){let{title:i="stx App",lang:s="en",meta:o=[],link:a=[],script:c=[],headRaw:p="",htmlAttrs:g={},bodyClass:h="",bodyAttrs:m={}}=n,y=r.title||i,E=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],v=new Set(o.map(at).filter(Boolean)),{body:w,hoisted:R}=nn(e),_=new Set(R.flatMap((b)=>{let L=en(b);return L?[at(L)].filter(Boolean):[]})),ct=[...E.filter((b)=>!v.has(at(b))),...o].filter((b)=>!_.has(at(b))).map((b)=>` <meta ${I(b)}>`).join(`
|
|
56
56
|
`),lt=a.map((b)=>` <link ${I(b)}>`).join(`
|
|
57
57
|
`),ut=c.map((b)=>{if(b.src)return` <script ${I(b,(L)=>L==="content")}></script>`;if(b.content)return` ${et(b)}`;return""}).filter(Boolean).join(`
|
|
@@ -65,8 +65,8 @@ ${ft.join(`
|
|
|
65
65
|
${mt.join(`
|
|
66
66
|
`)}
|
|
67
67
|
</body>
|
|
68
|
-
</html>`}var ye=/\s+/y,be=/<(script|style)\b[^>]*>/iy,sn=/<\/script>/gi,on=/<\/style>/gi,Ye=/<!DOCTYPE\b/iy,Je=/<html[\s>]/iy;function
|
|
68
|
+
</html>`}var ye=/\s+/y,be=/<(script|style)\b[^>]*>/iy,sn=/<\/script>/gi,on=/<\/style>/gi,Ye=/<!DOCTYPE\b/iy,Je=/<html[\s>]/iy;function Cn(e){let n=0;while(n<e.length){if(ye.lastIndex=n,ye.exec(e)){n=ye.lastIndex;continue}if(e.startsWith("<!--",n)){let s=e.indexOf("-->",n);if(s===-1)return!1;n=s+3;continue}be.lastIndex=n;let i=be.exec(e);if(i){let s=i[1].toLowerCase()==="script"?sn:on;s.lastIndex=be.lastIndex;let o=s.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(Ye.lastIndex=n,Ye.test(e))return!0;return Je.lastIndex=n,Je.test(e)}return!1}function $i(e){return Cn(e)}function ul(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:i=[],link:s=[],script:o=[],headRaw:a=""}=n,c=e.slice(0,r),p=[];for(let g of i){let h=at(g);if(h&&c.includes(h))continue;p.push(` <meta ${I(g)}>`)}for(let g of s){if(g.href&&c.includes(`href="${g.href}"`))continue;p.push(` <link ${I(g)}>`)}for(let g of o)if(g.src){if(c.includes(`src="${g.src}"`))continue;p.push(` <script ${I(g,(h)=>h==="content")}></script>`)}else if(g.content){if(c.includes(Y(g)))continue;p.push(` ${et(g)}`)}if(a&&!c.includes(a))p.push(` ${a}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
|
|
69
69
|
`)}
|
|
70
|
-
${e.slice(r)}`}function
|
|
70
|
+
${e.slice(r)}`}function Pr(e,n={},r={},i){if(i??$i(e))return e;return rn(e,n,r)}var an=["og:","article:","book:","profile:","fb:","music:","video:"],cn=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function Ir(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=ln(e[0],n);if(typeof r!=="string")return r;let i;if(e.length===2){let o=un(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]??(it(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:an.some((o)=>r.startsWith(o))?{property:r,content:i}:{name:r,content:i}}}function ln(e,n){let r=de(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(cn.test(e.trim()))return e.trim();let i=Ht(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 ${Ve(i.value)}`,code:t.TYPE_ERROR};return i.value}function un(e,n){let r=de(e);if(r!==null)return r;let i=Ht(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 ${Ve(s)}`,code:t.TYPE_ERROR};return String(s)}var Or=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],Ys=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],rt={links:"link",metas:"meta",scripts:"script",styles:"style"},tt=new Set,nt=new WeakMap;function Ee(e){if(tt.has(e))return;tt.add(e),console.warn(e)}function gn(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 pn(e,n){let r=e.toLowerCase(),i=n.find((p)=>p.toLowerCase()===r);if(i)return i;let s=rt[r];if(s&&n.includes(s))return s;let o,a=1/0;for(let p of n){let g=gn(r,p.toLowerCase());if(g<a)o=p,a=g}let c=Math.min(e.length,o?.length??0)<=4?1:2;return a<=c?o:void 0}function Ce(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=nt.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=rt[a];if(c&&i.includes(c)&&Array.isArray(e[a])){if(o===e)o={...e};let g=Array.isArray(o[c])?o[c]:[];o[c]=[...g,...e[a]],delete o[a],Ee(`[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")){Ee(`[stx] ${s}.${a} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=pn(a,i);Ee(p?`[stx] ${s}.${a} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${s}.${a} is not a head key and is ignored. Known keys: ${i.join(", ")}.`)}return nt.set(e,o),o}var C={},dn=[],J={};function Ri(){return C}function sy(){return J}function oy(){C={},dn.length=0,J={}}function dl(e){C=Ue(C,Ce(e,{known:Ys,source:"useHead()"}))}function st(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 Ue(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:st(e.meta,n.meta,(r)=>r.name||r.property||(r.httpEquiv?`http:${r.httpEquiv}`:void 0)),link:st(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 kg(e){dl(Zs(e))}function Zs(e){let n=[];if(e.description)n.push({name:"description",content:e.description});if(e.keywords){let p=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;n.push({name:"keywords",content:p})}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 p=e.twitterImageAlt??(e.twitterImage?void 0:e.ogImageAlt);if(p)n.push({name:"twitter:image:alt",content:p})}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 p of e.articleTags)n.push({property:"article:tag",content:p});let c=[];if(e.canonical)c.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:c}}function iy(e){if(J={...J,...e},e.title||e.description)kg({title:e.title,description:e.description})}function ay(e){let n=typeof e==="function"?e():e;dl({title:n})}function cy(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>${O(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([i,s])=>`${i}="${O(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}="${O(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}="${O(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}="${O(String(c))}"`}).filter(Boolean).join(" ");if(i)n.push(`<script ${o}>${Y(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 ly(e=C){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function uy(e=C){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${O(r)}"`).join(" ")}function O(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dy(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 py(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(i,s)=>(n+=s.trim()+`
|
|
72
|
-
`,"")),headContent:n.trim()}}function fy(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=Ue(c,{title:a}),""})}function gy(e,n,r=""){if(!e.includes("@meta"))return e;return Ft(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=
|
|
72
|
+
`,"")),headContent:n.trim()}}function fy(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=Ue(c,{title:a}),""})}function gy(e,n,r=""){if(!e.includes("@meta"))return e;return Ft(e,/(?<![\w$@])@meta\s*\(/g,(i,s)=>{let o=Ir(zt(i),n);if(o.kind==="error")return D("Meta",s,o.message,r,o.code);if(o.kind==="tag"){let a=n.__stx_runtime_head??{};n.__stx_runtime_head=Ue(a,{meta:[o.tag]})}return""},(i)=>D("Meta",i,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{T,jt,ae,A,Ks,_i,Xs,u,f,sl,P,ot,Bt,d,Gs,t,ce,Tr,K,l,_e,Ci,z,_n,x,ol,Ei,Ft,zt,Ht,Ve,it,D,Js,Ti,il,$r,Rr,al,at,cl,Ar,ll,Cn,$i,ul,Pr,Ir,Or,Ys,Ce,Ri,sy,oy,dl,Ue,kg,Zs,iy,ay,cy,ly,uy,dy,py,fy,gy};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var w={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",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function Ut(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function
|
|
3
|
-
export{Ut,
|
|
2
|
+
var w={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",brightRed:"\x1B[91m",brightGreen:"\x1B[92m",brightYellow:"\x1B[93m",brightBlue:"\x1B[94m",brightMagenta:"\x1B[95m",brightCyan:"\x1B[96m",brightWhite:"\x1B[97m"},R={bold:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",inverse:"\x1B[7m",strikethrough:"\x1B[9m"};function p(e,t){return`${w[t]}${e}\x1B[0m`}function C(e,t){return`${R[t]}${e}\x1B[0m`}var b=(e)=>p(e,"red"),S=(e)=>p(e,"green"),y=(e)=>p(e,"yellow"),O=(e)=>p(e,"blue");var c=(e)=>p(e,"cyan");var a=(e)=>C(e,"bold"),m=(e)=>C(e,"dim");function Ut(){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" \uD83D\uDCD6 STX Story ")+c("\u2551")),console.log(c(" \u2551")+m(" Component Showcase & Testing ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log("")}function ro(e,t){if(console.log(a(" Server running at:")),console.log(""),console.log(` ${m("\u279C")} ${a("Local:")} ${c(e)}`),t)console.log(` ${m("\u279C")} ${a("Network:")} ${c(t)}`);console.log("")}function Wt(e){let t=e>0?"\u2713":"\u25CB",r=e>0?S:y;console.log(` ${r(t)} Found ${a(String(e))} story ${e===1?"file":"files"}`)}function Wi(e,t){if(console.log(""),console.log(` ${b("\u2717")} ${a(b("Error:"))} ${e}`),t)console.log(` ${m(t)}`);console.log("")}function lt(e){console.log(` ${y("\u26A0")} ${y("Warning:")} ${e}`)}function qi(e){console.log(` ${O("\u2139")} ${e}`)}function Ki(e,t,r){console.log(""),console.log(c(" \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")),console.log(c(" \u2551")+a(" Build Complete ")+c("\u2551")),console.log(c(" \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D")),console.log(""),console.log(` ${S("\u2713")} Stories: ${a(String(e))}`),console.log(` ${S("\u2713")} Output: ${a(t)}`),console.log(` ${S("\u2713")} Time: ${a(`${r}ms`)}`),console.log("")}function so(){console.log(""),console.log(a(" Keyboard Shortcuts:")),console.log(""),console.log(` ${c("h")} Show this help`),console.log(` ${c("o")} Open in browser`),console.log(` ${c("r")} Restart server`),console.log(` ${c("c")} Clear console`),console.log(` ${c("q")} Quit`),console.log("")}import h from"fs";import d from"path";async function qt(e){let{root:t,config:r}=e,o=[],i=await P(t,r.storyMatch,r.storyIgnored);for(let s of i){let n=d.resolve(t,s),l=v(s,n);o.push(l)}return o}async function P(e,t,r){let o=[];async function i(s,n){let l=await h.promises.readdir(s,{withFileTypes:!0});for(let g of l){let f=d.join(s,g.name),u=d.relative(n,f);if(T(u,r))continue;if(g.isDirectory())await i(f,n);else if(g.isFile()){if(F(u,t))o.push(u)}}}return await i(e,e),o}function T(e,t){for(let r of t)if(E(e,r))return!0;return!1}function F(e,t){for(let r of t)if(E(e,r))return!0;return!1}function E(e,t){let r=e.replace(/\\/g,"/"),i=t.replace(/\\/g,"/").replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*\*/g,"{{GLOBSTAR}}").replace(/\*/g,"[^/]*").replace(/\?/g,".").replace(/\{\{GLOBSTAR\}\}/g,".*");return i=`^${i}$`,new RegExp(i).test(r)}function v(e,t){let r=d.basename(e,".story.stx");return{id:e.toLowerCase().replace(/\.story\.stx$/,"").replace(/[/\\]/g,"-").replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),path:t,relativePath:e,fileName:r,treeFile:{title:r,path:e}}}function Xi(e,t){let{root:r,config:o}=e,i=[],s=h.watch(r,{recursive:!0},async(n,l)=>{if(!l)return;let g=l.replace(/\\/g,"/");if(!F(g,o.storyMatch))return;if(T(g,o.storyIgnored))return;let f=d.resolve(r,g);try{await h.promises.access(f);let u=v(g,f);t(n==="rename"?"add":"change",u)}catch{let u=v(g,f);t("unlink",u)}});return i.push(s),()=>{for(let n of i)n.close()}}function N(e,t){let r=t.treeFile||{title:t.fileName,path:t.relativePath};if(e.tree.file==="title")return r.title.split("/");if(e.tree.file==="path")return[...t.relativePath.split("/").slice(0,-1),r.title];if(typeof e.tree.file==="function")return e.tree.file(r);return[r.title]}function Kt(e,t){for(let n of t)n.treePath=N(e,n);let r=(e.tree.groups||[]).map((n)=>({groupConfig:{id:n.id||n.title,title:n.title,include:n.include},treeObject:{}})),o={treeObject:{}};r.push(o);for(let n=0;n<t.length;n++){let l=t[n],g=j(l,r,o);k(l.treePath,n,g.treeObject)}let i=e.tree.order==="asc"?(n,l)=>n.localeCompare(l):e.tree.order,s=[];for(let n of r)if(n===o)s.push(...x(n.treeObject,i));else if(n.groupConfig&&Object.keys(n.treeObject).length>0)s.push({group:!0,id:n.groupConfig.id,title:n.groupConfig.title,children:x(n.treeObject,i)});return s}function j(e,t,r){let o=e.treeFile||{title:e.fileName,path:e.relativePath};for(let i of t)if(i.groupConfig?.include&&i.groupConfig.include(o))return i;return r}function k(e,t,r){let o=r;for(let i=0;i<e.length;i++){let s=e[i];if(i===e.length-1)if(o[s]!==void 0){let l=1;while(o[`${s}-${l}`]!==void 0)l++;o[`${s}-${l}`]=t}else o[s]=t;else{if(o[s]===void 0)o[s]={};else if(typeof o[s]==="number"){let l=o[s];o[s]={"":l}}o=o[s]}}}function x(e,t){let r=[];for(let[o,i]of Object.entries(e))if(typeof i==="number")r.push({title:o,index:i});else r.push({title:o,children:x(i,t)});return r.sort((o,i)=>t(o.title,i.title)),r}
|
|
3
|
+
export{Ut,ro,Wt,Wi,lt,qi,Ki,so,qt,Xi,Kt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{aa,tm,ca,nm,Bl,Fl,rm,sm}from"./chunk-12bwztw2.js";import"./chunk-waz6g84g.js";import"./chunk-3fk1cm0n.js";import"./chunk-53gp3w46.js";import"./chunk-tx8wk6h7.js";import"./chunk-8f49t8wb.js";import"./chunk-wpy1ytv9.js";import"./chunk-ya6bp08c.js";import"./chunk-02s0hzwa.js";import"./chunk-h8pp1dsq.js";import"./chunk-gh62p9mx.js";import"./chunk-amg6kr1p.js";import"./chunk-ms3v5nat.js";import"./chunk-29f6vmyz.js";import{It,eg}from"./chunk-a1fp1nyf.js";import"./chunk-6eqjf0r6.js";import"./chunk-vfj9wp11.js";import"./chunk-txd2js5v.js";import"./chunk-s6r54dyf.js";import"./chunk-4ntm3dtk.js";export{aa as buildScriptVirtualFile,tm as buildVirtualSource,It as extractScriptBlocks,eg as extractTemplateExpressions,Bl as findRuntimeTypeDeclarations,Fl as findStxModuleDeclarations,sm as formatTypecheckDiagnostics,nm as sourcePathFor,rm as typecheckStxFiles,ca as virtualPathFor};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function He(n,f){return m.run(n,f)}function
|
|
3
|
-
export{He,
|
|
2
|
+
import{AsyncLocalStorage as R}from"async_hooks";var b=Symbol.for("stx.runtime-config.scope"),y=globalThis,m=y[b]??=new R;function He(n,f){return m.run(n,f)}function kn(){return m.getStore()}function qs(){let n=m.getStore();if(!n)throw Error("useServerRuntimeConfig requires a server request or template render");return Object.freeze(Object.defineProperty({public:n.public},"private",{value:n.private}))}function ki(){return qs().public}function M(n={},f=process.env){let s=new Set;function o(e,i){if(i===null)return e===null;if(Array.isArray(i))return Array.isArray(e)&&(!i.length||e.every((r)=>i.some((u)=>o(r,u))));if(typeof i==="object")return e!==null&&typeof e==="object"&&!Array.isArray(e)&&Object.entries(i).every(([r,u])=>Object.hasOwn(e,r)&&o(e[r],u));return typeof e===typeof i}function g(e,i){if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`);let t=Object.create(null);for(let[c,l]of Object.entries(e)){if(!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(c)||["constructor","prototype","__proto__"].includes(c))throw TypeError(`Invalid runtime config key: ${c}`);t[c]=g(l,[...i,c])}return Object.freeze(t)}let r=`STX_RUNTIME_${i.map((t)=>t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()).join("__")}`;if(s.has(r))throw TypeError(`Ambiguous runtime config environment key: ${r}`);s.add(r);let u=f[r],a=e;if(u!==void 0){try{a=typeof e==="string"?u:JSON.parse(u)}catch{throw TypeError(`Invalid runtime config override: ${r}`)}if(!o(a,e))throw TypeError(`Wrong runtime config override type: ${r}`)}function p(t){if(t===null||typeof t==="string"||typeof t==="boolean")return t;if(typeof t==="number"&&Number.isFinite(t))return t;if(Array.isArray(t))return Object.freeze(t.map(p));if(t&&typeof t==="object"&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null))return Object.freeze(Object.fromEntries(Object.entries(t).map(([c,l])=>[c,p(l)])));throw TypeError(`Runtime config ${i.join(".")} must contain JSON values`)}return p(a)}return Object.freeze({public:g(n.public??{},["public"]),private:g(n.private??{},["private"])})}function C(n){return`<script data-stx-scoped data-stx-runtime-config type="application/json">${JSON.stringify(n.public).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function Lt(n,f){let s=n.replace(/<script\b[^>]*\bdata-stx-runtime-config\b[^>]*>[\s\S]*?<\/script>/gi,""),o=/<head\b[^>]*>/i.exec(s),g=o?o.index+o[0].length:0;return s.slice(0,g)+C(f)+s.slice(g)}
|
|
3
|
+
export{He,kn,qs,ki,M,Lt};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function
|
|
3
|
-
export default kept[${n}] || (kept[${n}] = {});`}var M=new Map;function
|
|
2
|
+
import{existsSync as x,realpathSync as b,statSync as y}from"fs";import f from"path";import k from"process";var E=/^[\w-]+(?:\/[\w-]+)*$/,j=/^[\w-]+$/;async function Br(s,e){let n=f.resolve(s,e.dir);if(!e.languages?.length)throw Error("messages.languages must name at least one language");let a=new Map,r=new Map;for(let t of e.languages){if(!j.test(t))throw Error(`messages: "${t}" is not a language directory name`);let g=f.join(n,t);if(!x(g))throw Error(`messages: ${f.relative(s,g)} does not exist`);let o=new Map;for(let i of[...new Bun.Glob("**/*.{ts,js,mjs,json}").scanSync({cwd:g})].sort()){if(/\.(?:test|spec|d)\.[^.]+$/.test(i))continue;let l=i.replace(/\.[^./]+$/,"").split(f.sep).join("/");if(!E.test(l))throw Error(`messages: ${t}/${i} is not an area name`);if(o.has(l))throw Error(`messages: ${t}/${l} is defined twice`);let c=f.join(g,i),p=await import(c),m=Object.keys(p).filter((S)=>S!=="default");if(m.length)throw Error(`messages: ${t}/${i} exports ${m.join(", ")}; a message module exports its messages as default, and nothing else`);let u=p.default,d=u!==null&&typeof u==="object"&&!Array.isArray(u)?JSON.stringify(u):void 0;if(d===void 0||!Bun.deepEquals(JSON.parse(d),u,!0))throw Error(`messages: ${t}/${i} must export plain data (an object JSON can hold) as default`);o.set(l,d),a.set(c,{language:t,area:l})}r.set(t,o)}return{files:a,data:r}}function h(s,e){return`stx-messages:${s}:${e}`}function _(s,e){let n=JSON.stringify(h(s,e));return`var kept = globalThis.__stxMessages || (globalThis.__stxMessages = {});
|
|
3
|
+
export default kept[${n}] || (kept[${n}] = {});`}var M=new Map;function Fr(s){let e=[s];try{e.push(b(s))}catch{}for(let n of[...e])if(n.startsWith("/private/"))e.push(n.slice(8));return[...new Set(e)]}function Vg(s,e=k.env){if(!s.messages||e.STX_PAGE_MESSAGES==="0")return!1;return e.STX_PAGE_MESSAGES==="1"||e.NODE_ENV==="production"}async function Ug(s,e){let n=f.resolve(s,e.dir),a=e.languages.map((c)=>{try{return`${c}:${y(f.join(n,c)).mtimeMs}`}catch{return`${c}:-`}}).join("|"),r=`${n}\x00${e.languages.join(",")}\x00${e.fallback??""}`,t=M.get(r);if(t&&t.signature===a)return t.messages;let g=await Br(s,e),o=new Map;for(let[c,{language:p,area:m}]of g.files){let u=_(p,m);for(let d of Fr(c))o.set(d,u)}let i=e.fallback??e.languages[0];if(!e.languages.includes(i))throw Error(`messages.fallback "${i}" is not one of messages.languages`);let l={...g,stubs:o,languages:[...e.languages],fallback:i};return M.set(r,{signature:a,messages:l}),l}function Wg(...s){let e=new Set;for(let n of s){if(!n||!n.includes("stx-messages:"))continue;for(let a of n.matchAll(/stx-messages:[\w-]+:([\w/-]+)/g))e.add(a[1])}return e}function qg(s,e){let n=/<html\b[^>]*>/i.exec(s)?.[0]??"",a=/\slang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(n),r=(a?a[1]??a[2]??a[3]??"":"").trim().toLowerCase(),t=new Map(e.languages.map((o)=>[o.toLowerCase(),o])),g=t.get(r)??t.get(r.split(/[-_]/)[0]??"");if(!g)return[...e.languages];return[...new Set([g,e.fallback])]}var w=new WeakMap;function Kg(s,e,n){let a=[...n].sort(),r=w.get(s);if(!r)w.set(s,r=new Map);let t=`${e.join(",")}\x00${a.join(",")}`;if(r.has(t))return r.get(t);let g=P(s,e,a);return r.set(t,g),g}function P(s,e,n){let a=[];for(let r of e){let t=s.data.get(r);if(!t)continue;for(let g of n){let o=t.get(g);if(o!==void 0)a.push(`put(${JSON.stringify(h(r,g))},${JSON.stringify(o)})`)}}if(a.length===0)return null;return`;(function(){var kept=globalThis.__stxMessages||(globalThis.__stxMessages={}),filled=globalThis.__stxMessagesFilled||(globalThis.__stxMessagesFilled={});function put(key,json){if(filled[key])return;filled[key]=1;var into=kept[key]||(kept[key]={}),data=JSON.parse(json);for(var name in data)into[name]=data[name]}
|
|
4
4
|
${a.join(`;
|
|
5
5
|
`)};
|
|
6
6
|
})();`}
|
|
7
|
-
export{
|
|
7
|
+
export{Br,Fr,Vg,Ug,Wg,qg,Kg};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import"./chunk-
|
|
2
|
+
import"./chunk-4ntm3dtk.js";import"./chunk-s6r54dyf.js";import"./chunk-txd2js5v.js";import{w,S,C,Z}from"./chunk-a1fp1nyf.js";import"./chunk-vfj9wp11.js";import"./chunk-6eqjf0r6.js";import f from"path";var b=["applyOfflineUpdate","broadcast","cacheMedia","calculateDistance","canNotify","clearCookies","clearFetchCache","clearOfflineData","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","onOfflineUpdateReady","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAmbientSound","useAnimationFrame","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBreathPacer","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useCompletion","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useOutbox","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVirtualList","useVisibility","useWakeLock","useWindowSize"],L=new Set(b);var l=new Map,h=w(64),x=new Set,k=0,R=new Set(b);function T(){l.clear(),h.clear()}function P(n){let o=new Map;for(let r of n){let a=f.basename(r);if(a.endsWith(".d.ts"))continue;let t=a.replace(/\.[jt]s$/,"");if(t==="index")continue;if(t===a)continue;let i=o.get(t);if(i&&!i.endsWith(".js"))continue;o.set(t,r)}return[...o.values()].sort()}function I(n,o){let r=o.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${r}\\b`).test(n)}function M(n){if(!n)return[];let o=S(n,k),r=h.get(o);if(r)return r.slice();let a=n.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),t=[];for(let i of R){if(x.has(i))continue;let u=i.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${u}\\s*\\(`).test(a))t.push(i)}return t.sort(),h.set(o,t),t.slice()}async function A(n,o){let r=M(n);if(r.length===0)return null;let a=o??f.join(import.meta.dir,"composables"),t=`${a}\x00${r.join(",")}`,i=l.get(t);if(i!==void 0)return i||null;let u=Z({loader:"ts",target:"browser",define:C()}),O=new Set(r),m=[],d=new Set,p=[];try{let s=new Bun.Glob("*.{ts,js}");for await(let e of s.scan({cwd:a,absolute:!0}))p.push(e)}catch{return l.set(t,""),null}p=P(p);for(let s of p){let e;try{e=await Bun.file(s).text()}catch{continue}let g=[];try{g=u.scan(e).exports.filter((c)=>c!=="default")}catch{continue}if(!g.some((c)=>O.has(c)))continue;try{e=e.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^import\s+type\s+.*$/gm,""),e=e.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),e=e.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),e=e.replace(/^export\s+default\s+/gm,""),e=e.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),m.push(`// ${f.basename(s).replace(/\.[jt]s$/,"")}
|
|
3
3
|
${u.transformSync(e).trim()}`);for(let c of g)d.add(c)}catch(c){console.warn(`[stx] framework composable ${f.basename(s)} could not be bundled:`,c)}}let y=r.filter((s)=>!d.has(s)&&!I(n,s));if(y.length>0)console.warn(`[stx] could not bundle ${y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(m.length===0)return l.set(t,""),null;let E=[...d].map((s)=>` try { if (!(${JSON.stringify(s)} in __s)) { __s[${JSON.stringify(s)}] = ${s}; if (!(${JSON.stringify(s)} in window)) window[${JSON.stringify(s)}] = ${s}; } } catch (e) {}`).join(`
|
|
4
4
|
`),v=`<script data-stx-scoped data-stx-run="always" data-stx-framework-composables>
|
|
5
5
|
;(function(){
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{yl,bl,wl}from"./chunk-04z1xyrb.js";import{ue,Un,Wn,vo,Gr,Jr,qn,Kn,xo,Yr}from"./chunk-wvds0s9m.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,`
|
|
2
|
+
import{yl,bl,wl}from"./chunk-4ntm3dtk.js";import{ue,Wn,qn,xo,Jr,Yr,Kn,Xn,So,Zr}from"./chunk-rnm8ejpz.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(`
|
|
@@ -678,7 +678,7 @@ console.log('[stx] entering IIFE');
|
|
|
678
678
|
}
|
|
679
679
|
|
|
680
680
|
`;var le=` function bindClass(el, expr, passedScope = componentScope, isVisible) {
|
|
681
|
-
const originalClasses = el.
|
|
681
|
+
const originalClasses = el.getAttribute('class') || '';
|
|
682
682
|
const capturedScope = layerTemplateScopes(globalHelpers, passedScope, (findElementScope(el) || {}));
|
|
683
683
|
|
|
684
684
|
// Pre-compile \u2014 only the names the expression mentions (see
|
|
@@ -4405,7 +4405,7 @@ catch (e) {
|
|
|
4405
4405
|
|
|
4406
4406
|
// bindClass, reading its names through the row's scope.
|
|
4407
4407
|
function bindRowClass(el, site, row, visible) {
|
|
4408
|
-
var originalClasses = el.
|
|
4408
|
+
var originalClasses = el.getAttribute('class') || '';
|
|
4409
4409
|
effect(function() {
|
|
4410
4410
|
if (!visible()) return;
|
|
4411
4411
|
var value = evaluateRowSite(row.local, site, el, '', true);
|
|
@@ -4417,10 +4417,10 @@ catch (e) {
|
|
|
4417
4417
|
});
|
|
4418
4418
|
}
|
|
4419
4419
|
else if (Array.isArray(value)) {
|
|
4420
|
-
el.
|
|
4420
|
+
el.setAttribute('class', [originalClasses, value.filter(Boolean).join(' ')].filter(Boolean).join(' '));
|
|
4421
4421
|
}
|
|
4422
4422
|
else {
|
|
4423
|
-
el.
|
|
4423
|
+
el.setAttribute('class', [originalClasses, value || ''].filter(Boolean).join(' '));
|
|
4424
4424
|
}
|
|
4425
4425
|
});
|
|
4426
4426
|
}
|
|
@@ -11775,7 +11775,7 @@ else if (timer === null) {
|
|
|
11775
11775
|
subscribe: subscribe
|
|
11776
11776
|
};
|
|
11777
11777
|
}
|
|
11778
|
-
`;function yt(e={}){let o=kt(
|
|
11778
|
+
`;function yt(e={}){let o=kt(Un(e));try{let r=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(o);return r=r.replace(/\}(var |let |const |function )/g,"};$1"),r}catch{return o}}function kt(e){let o=[],l=0,r="console.log(";while(l<e.length){let d=e.indexOf(r,l);if(d===-1){o.push(e.slice(l));break}o.push(e.slice(l,d));let y=1,s=d+r.length;while(s<e.length&&y>0){let u=e[s];if(u==='"'||u==="'"||u==="`"){let h=u;s++;while(s<e.length&&e[s]!==h){if(e[s]==="\\")s++;s++}s++;continue}if(u==="(")y++;else if(u===")")y--;s++}o.push("0"),l=s}return o.join("")}function Un(e={}){return`${ae}${Pe}
|
|
11779
11779
|
${Ze(ie,ke,Te)}
|
|
11780
11780
|
|
|
11781
11781
|
${De}
|
|
@@ -11856,5 +11856,5 @@ ${ct}
|
|
|
11856
11856
|
${dt}
|
|
11857
11857
|
${it}
|
|
11858
11858
|
})();
|
|
11859
|
-
`}var gh={state:ue,derived:
|
|
11860
|
-
export{yt,
|
|
11859
|
+
`}var gh={state:ue,derived:Wn,effect:qn,batch:xo,onMount:Jr,onDestroy:Yr,isSignal:Kn,isDerived:Xn,untrack:So,peek:Zr,generateSignalsRuntime:yt,generateSignalsRuntimeDev:Un};
|
|
11860
|
+
export{yt,Un,gh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{nt}from"./chunk-
|
|
2
|
+
import{nt}from"./chunk-29f6vmyz.js";import{yt,Un}from"./chunk-w0a6yz73.js";import{Rr,Ar,Pr,Or,Ce}from"./chunk-txd2js5v.js";import{De,hn,el,tl}from"./chunk-a1fp1nyf.js";import{M}from"./chunk-vfj9wp11.js";import{Si}from"./chunk-6eqjf0r6.js";import{b}from"./chunk-q4h6mhn1.js";import{i}from"./chunk-zr4e0jrh.js";import{F,a}from"./chunk-02s0hzwa.js";import{_c}from"./chunk-amg6kr1p.js";import{On,qe,Te,da,pa,Nn}from"./chunk-1pg50kva.js";import{an,Io}from"./chunk-53gp3w46.js";import{Mn}from"./chunk-fvgk1w9s.js";import{Qt,Qn,er}from"./chunk-s3j5vxy9.js";import{G}from"./chunk-wpy1ytv9.js";import m from"fs";import c from"path";import{createHash as Q}from"crypto";function J(n){return Q("sha256").update(n).digest("hex").slice(0,8)}function U(n=!1){let l=n?Un():yt(),o=J(l);return{content:l,filename:`runtime.${o}.js`,hash:o}}function V(){let n=nt(),l=J(n);return{content:n,filename:`router.${l}.js`,hash:l}}import q from"path";import{createHash as ee}from"crypto";function te(n={}){let l=new Set;return{context:new Proxy(n,{get(r,e){if(e in r)return r[e];if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return},has(r,e){if(e in r)return!0;if(typeof e==="string"&&!e.startsWith("__"))l.add(e);return!1}}),accessedKeys:l}}async function X(n,l,o={}){let r=q.resolve(n),e=await Bun.file(r).text(),S=ee("sha256").update(e).digest("hex").slice(0,16);el();let _={};try{_=await a(o.configDir)}catch{}let h=[],d=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,g;while((g=d.exec(e))!==null){let R=g[1];if(/\bserver\b/.test(R))h.push(g[2])}let u=new Set(h.flatMap((R)=>De(R))),{context:D}=te({__filename:r,__dirname:q.dirname(r),__stx_serverDeclared:u}),A=new Set,T={...F,..._,...o,buildMode:"compile",strict:!1},y=await i(e,D,r,T,A),w=On(y)+qe(y),j=tl();return{route:l,sourceFile:n,html:y,fragment:w,placeholders:j,hasServerScripts:h.length>0,serverScriptContent:h,dependencies:Array.from(A),contentHash:S,status:hn(e),streamTemplates:D.__streamTemplates}}var re=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function Z(n,l){let o=0,r=0;if(!m.existsSync(n))return{copied:o,bytes:r};m.mkdirSync(l,{recursive:!0});function e(S,_){let h=m.readdirSync(S,{withFileTypes:!0});for(let d of h){if(re.has(d.name))continue;let g=c.join(S,d.name),u=c.join(_,d.name);if(d.isDirectory())m.mkdirSync(u,{recursive:!0}),e(g,u);else if(d.isFile()){if(m.existsSync(u))continue;m.copyFileSync(g,u),o++,r+=m.statSync(u).size}}}return e(n,l),{copied:o,bytes:r}}async function om(n={}){let l=Date.now(),o=c.resolve(n.root||process.cwd()),r=c.resolve(o,n.outputDir||".output");console.log("[stx build] Starting production build...");let e=await a(o),S=c.resolve(o,n.componentsDir??e.componentsDir??"components"),_=c.resolve(o,n.partialsDir??e.partialsDir??"partials"),h=c.resolve(o,n.layoutsDir??e.layoutsDir??"layouts"),d=n.publicDir??e.publicDir??"public",g=Ce(e.app?.head,{known:Or,source:"app.head"}),u=e.app?.colorMode,D=e.router?.container||"main",A=n.routeRules??e.routeRules??{},T=Mn(A),y=n.serverApi??e.serverApi,w=typeof y==="object"?y:{};if(y)an(o,w);if(e.runtimeConfig)M(e.runtimeConfig,{});if(m.existsSync(r))m.rmSync(r,{recursive:!0});let j=[c.join(r,"public","__stx"),c.join(r,"public","assets"),c.join(r,"server","pages"),c.join(r,"server","fragments")];for(let s of j)m.mkdirSync(s,{recursive:!0});console.log("[stx build] Discovering routes...");let R=G(o,{pagesDirs:e._layerPageDirs}),Y=["components","layouts","partials"],P=R.filter((s)=>!Y.some((f)=>s.pattern.startsWith(`/${f}/`)||s.pattern===`/${f}`));console.log(`[stx build] Found ${P.length} page routes (${R.length-P.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let v=U(n.debug),x=V();await Bun.write(c.join(r,"public","__stx",v.filename),v.content),await Bun.write(c.join(r,"public","__stx",x.filename),x.content),console.log(`[stx build] Runtime: ${v.filename} (${(v.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${x.filename} (${(x.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let B=[],H=[];for(let s of P){let f=T(s.pattern),O=f.rendering==="prerender";if(O&&(s.pattern.includes(":")||s.pattern.includes("[")))throw Error(`Cannot prerender parameter route ${s.pattern}; use dynamic rendering (explicit path enumeration is not supported here)`);try{let t=await X(s.filePath,s.pattern,{configDir:o,componentsDir:S,partialsDir:_,layoutsDir:h,debug:n.debug});if(B.push(t),t.html=t.html.replace(/runtime\.__STX_HASH__\.js/g,v.filename).replace(/router\.__STX_HASH__\.js/g,x.filename),t.html=Pr(t.html,g,{bodyScripts:[`<script src="/__stx/${x.filename}"></script>`],...u&&{colorMode:u}}),u)t.html=Rr(t.html,u);if(g.htmlAttrs)t.html=Ar(t.html,g.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(t.html)){let p=t.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(p&&p[1]){let W=p[1];t.html=t.html.replace(" "+W,""),t.html=t.html.replace(/<body([^>]*)>/,`<body$1 ${W}>`)}}if(t.html=t.html.replace(/<style data-css="generated">[\s\S]*?<\/style>\s*/g,""),t.html=await b(t.html),O){let p=await Nn(t,{params:{},request:new Request(`http://stx.build${s.pattern}`),method:"GET",__stx_strict_hydration:!0});if(p.redirect||p.cookies?.length||p.boundaries?.length||p.headers&&Object.keys(p.headers).length)throw Error(`Prerendered route ${s.pattern} cannot set response headers/cookies, redirect or stream`);t.html=p.html,t.status=p.status??t.status,t.hasServerScripts=!1,t.serverScriptContent=[],t.placeholders={}}t.fragment=Te(t.html,D,!0);let L=s.pattern==="/"?"index":s.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),z=c.join("server","pages",`${L}.compiled.json`),I=c.join("server","fragments",`${L}.html`);await Bun.write(c.join(r,z),JSON.stringify(t,null,2)),await Bun.write(c.join(r,I),t.fragment),H.push({pattern:s.pattern,compiledPath:z,fragmentPath:I,isDynamic:t.hasServerScripts,hasParams:s.pattern.includes(":")||s.pattern.includes("["),prerendered:O}),console.log(`[stx build] \u2713 ${s.pattern}`)}catch(t){if(Object.keys(f).length)throw t;console.error(`[stx build] \u2717 ${s.pattern}:`,t instanceof Error?t.message:t)}}let k=c.resolve(o,d);if(m.existsSync(k)){let{copied:s,bytes:f}=Z(k,c.join(r,"public"));if(s>0)console.log(`[stx build] Copied ${s} public asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${d}/`)}let E=er(o);if(E){let{copied:s,bytes:f}=Z(E,c.join(r,"public",Qn));if(s>0)console.log(`[stx build] Copied ${s} asset${s===1?"":"s"} (${(f/1024).toFixed(1)}KB) from ${Qt}/`)}let N={runtime:v.filename,router:x.filename},C=da(H,N,r);if(C.routeRules=A,C.routerContainer=D,y)C.apiRoutes=await Io(o,r,w);if(e.runtimeConfig)await Bun.write(c.join(r,"server/runtime-config.json"),JSON.stringify(e.runtimeConfig)),await Si(o,e.runtimeConfig);if(e._layerGraph)await Bun.write(c.join(r,"server/layers.json"),JSON.stringify(_c(e._layerGraph),null,2));pa(C,r);let K=Date.now()-l;return console.log(`
|
|
3
3
|
[stx build] Done in ${K}ms \u2014 ${B.length} pages compiled`),{pageCount:B.length,assets:N,outputDir:r,duration:K}}
|
|
4
4
|
export{om};
|