@stacksjs/stx 0.2.544 → 0.2.546
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-0xydscd9.js +2 -0
- package/dist/chunk-13xhvx68.js +2 -0
- package/dist/chunk-16e1y0dk.js +2 -0
- package/dist/{chunk-bczcm7jk.js → chunk-1b50m7e7.js} +2 -2
- package/dist/chunk-1hqxdn25.js +2 -0
- package/dist/{chunk-r9m4cgq9.js → chunk-1m3k0exr.js} +2 -2
- package/dist/chunk-1v2vehpc.js +2 -0
- package/dist/chunk-1w11d6gq.js +2 -0
- package/dist/chunk-2bpj2dsh.js +2 -0
- package/dist/{chunk-qmza4327.js → chunk-39tkfkp7.js} +3 -3
- package/dist/chunk-3j5bg3xq.js +2 -0
- package/dist/chunk-3m2h76cz.js +2 -0
- package/dist/{chunk-ty1v368m.js → chunk-3nc2fr4q.js} +2 -2
- package/dist/{chunk-hsf7nz8x.js → chunk-3v1av932.js} +2 -2
- package/dist/chunk-5141wftw.js +2 -0
- package/dist/{chunk-66s4nhp7.js → chunk-5fx8m234.js} +2 -2
- package/dist/chunk-5g7d3r7a.js +2 -0
- package/dist/{chunk-tzf7znh0.js → chunk-5ghn1gh5.js} +15 -15
- package/dist/{chunk-h51g1ydb.js → chunk-5hdby5qp.js} +4 -4
- package/dist/{chunk-s3r2pv39.js → chunk-64pbmrqg.js} +1 -1
- package/dist/{chunk-4d925m39.js → chunk-652v9mq4.js} +16 -16
- package/dist/chunk-6bcvd3pg.js +2 -0
- package/dist/chunk-6sa2s18z.js +2 -0
- package/dist/chunk-6w8r81kh.js +2 -0
- package/dist/{chunk-p15j9fzt.js → chunk-6wktqt18.js} +3 -3
- package/dist/chunk-6wpgxryt.js +2 -0
- package/dist/{chunk-292vew7b.js → chunk-74j18qk0.js} +28 -28
- package/dist/{chunk-jjwg83xv.js → chunk-75hb7wg6.js} +1 -1
- package/dist/{chunk-8m1y1kyr.js → chunk-77j26p6r.js} +6 -6
- package/dist/{chunk-0m3sjh3t.js → chunk-7dn3bdeh.js} +5 -5
- package/dist/chunk-7pewegtw.js +2 -0
- package/dist/{chunk-nd8v4xgb.js → chunk-7ze47qgv.js} +5 -5
- package/dist/{chunk-6dtmants.js → chunk-8a4g0mex.js} +5 -5
- package/dist/{chunk-ngxqydsg.js → chunk-8nwzd6eg.js} +3 -3
- package/dist/chunk-8sfdj65f.js +2 -0
- package/dist/{chunk-6abvk7vj.js → chunk-97vj2cqz.js} +2 -2
- package/dist/chunk-a3452td4.js +2 -0
- package/dist/chunk-a5kaw8sc.js +40 -0
- package/dist/{chunk-hvpzy98g.js → chunk-ah7h9q0x.js} +2 -2
- package/dist/{chunk-3bma1215.js → chunk-at2d96rz.js} +4 -4
- package/dist/{chunk-jbfad9cc.js → chunk-avgx6hd9.js} +2 -2
- package/dist/{chunk-wav410fm.js → chunk-b2fkxk6k.js} +3 -3
- package/dist/{chunk-zzphh8g9.js → chunk-b9jb44kv.js} +5 -5
- package/dist/chunk-byjr72wz.js +2 -0
- package/dist/chunk-cg8hg6cs.js +3 -0
- package/dist/{chunk-fq9vhy6b.js → chunk-cr4ab43x.js} +2 -2
- package/dist/chunk-cv8ea5yp.js +2 -0
- package/dist/{chunk-wh7xn313.js → chunk-d0yx9kef.js} +1 -1
- package/dist/{chunk-33bzhsyw.js → chunk-d37enreq.js} +3 -3
- package/dist/chunk-d7mfkc61.js +2 -0
- package/dist/chunk-d8fhthyf.js +2 -0
- package/dist/{chunk-x607yxrc.js → chunk-dyreg5df.js} +2 -2
- package/dist/{chunk-v9vvzdag.js → chunk-e124cgb6.js} +2 -2
- package/dist/{chunk-bpr4bkde.js → chunk-ec8k75ep.js} +2 -2
- package/dist/{chunk-gxedmh17.js → chunk-eeadhr78.js} +1 -1
- package/dist/{chunk-m011s2ha.js → chunk-f1n5napx.js} +3 -3
- package/dist/chunk-f8cs6j3n.js +2 -0
- package/dist/chunk-fprgww47.js +2 -0
- package/dist/{chunk-2kvbg3t5.js → chunk-frgpx23w.js} +4 -4
- package/dist/chunk-ft447y2j.js +2 -0
- package/dist/chunk-fyq2gste.js +2 -0
- package/dist/chunk-fz7dxc1q.js +2 -0
- package/dist/{chunk-m5fw8jq1.js → chunk-gjx5256r.js} +5 -5
- package/dist/{chunk-vfcwvqvd.js → chunk-hmehxwzj.js} +193 -193
- package/dist/chunk-hvs58485.js +2 -0
- package/dist/chunk-hzx0vtw0.js +2 -0
- package/dist/{chunk-y18yvcjb.js → chunk-j2erwdgt.js} +11 -11
- package/dist/chunk-jj4b0y48.js +2 -0
- package/dist/{chunk-tkvp3rz0.js → chunk-jmvp99ay.js} +7 -7
- package/dist/chunk-kb62w54c.js +2 -0
- package/dist/{chunk-xab6b4mt.js → chunk-kch9a9v1.js} +2 -2
- package/dist/chunk-kg8rbkcf.js +2 -0
- package/dist/{chunk-2bvk0qyd.js → chunk-kvmg6r89.js} +2 -2
- package/dist/{chunk-g12j8ahm.js → chunk-m6m19hwd.js} +4 -4
- package/dist/chunk-m9cmc6np.js +2 -0
- package/dist/chunk-m9r4x7e6.js +2 -0
- package/dist/{chunk-aqra6vsk.js → chunk-mbazkfy1.js} +3 -3
- package/dist/chunk-mbwdn96z.js +2 -0
- package/dist/{chunk-2me3dm0z.js → chunk-me81wras.js} +3 -3
- package/dist/chunk-mqje968d.js +2 -0
- package/dist/chunk-mxzge1d8.js +2 -0
- package/dist/chunk-myndj1r8.js +3 -0
- package/dist/{chunk-7tabykst.js → chunk-n1cqg89v.js} +2 -2
- package/dist/{chunk-0vn4gzyb.js → chunk-n77shkpy.js} +1 -1
- package/dist/chunk-njrakvz7.js +2 -0
- package/dist/{chunk-r2sy59wb.js → chunk-nrnq7x7p.js} +2 -2
- package/dist/chunk-pq8mz4ma.js +2 -0
- package/dist/{chunk-90wh9zzy.js → chunk-pz8mf91e.js} +5 -5
- package/dist/{chunk-dyegyt6m.js → chunk-q04fdq91.js} +2 -2
- package/dist/chunk-q24yyt9k.js +2 -0
- package/dist/chunk-qbsnvmj0.js +2 -0
- package/dist/chunk-qdrvx7vh.js +2 -0
- package/dist/chunk-qyj6zygv.js +2 -0
- package/dist/chunk-qzs6q626.js +2 -0
- package/dist/{chunk-d7zterbp.js → chunk-r4199q6x.js} +2 -2
- package/dist/chunk-r63aqsc9.js +2 -0
- package/dist/chunk-rrw61yk5.js +2 -0
- package/dist/chunk-rwgp4vt5.js +2 -0
- package/dist/chunk-sn98t7ef.js +2 -0
- package/dist/{chunk-3zqq3f2b.js → chunk-ssthwjpr.js} +5 -5
- package/dist/{chunk-2qbvsvwc.js → chunk-t61vdbje.js} +6 -6
- package/dist/chunk-te6s2apv.js +2 -0
- package/dist/chunk-tgfpk4ng.js +2 -0
- package/dist/chunk-v02g9244.js +2 -0
- package/dist/{chunk-c56qtne1.js → chunk-v2b8pa86.js} +1 -1
- package/dist/chunk-v2rhpdw3.js +2 -0
- package/dist/{chunk-vb4xxpa6.js → chunk-v39ysweq.js} +2 -2
- package/dist/chunk-v40d4bdy.js +2 -0
- package/dist/{chunk-vjdj0ex3.js → chunk-v79qs0qh.js} +1 -1
- package/dist/{chunk-m56m95gk.js → chunk-vpmb8gcc.js} +4 -4
- package/dist/{chunk-p8qr0q85.js → chunk-vvkfde23.js} +2 -2
- package/dist/{chunk-sgh6zsmc.js → chunk-vyjsrvpr.js} +3 -3
- package/dist/{chunk-150v780g.js → chunk-wcp4tf94.js} +23 -17
- package/dist/{chunk-yn3kp3qy.js → chunk-wy4hfmjs.js} +5 -5
- package/dist/{chunk-r6gxy92f.js → chunk-xya3vdqy.js} +2 -2
- package/dist/{chunk-3r1m3tyr.js → chunk-xzcmh5va.js} +1 -1
- package/dist/chunk-y83we135.js +2 -0
- package/dist/{chunk-0dqxnx20.js → chunk-yq1mvakj.js} +2 -2
- package/dist/{chunk-c2ys6ezs.js → chunk-ys3640vq.js} +9 -9
- package/dist/chunk-zfypzka2.js +2 -0
- package/dist/{chunk-9a73re8k.js → chunk-zmq9hwta.js} +2 -2
- package/dist/cli.js +43 -43
- package/dist/conditionals.js +2 -7
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/expressions.js +57 -4
- package/dist/interpolation-context.d.ts +27 -0
- package/dist/interpolation-context.js +46 -0
- package/dist/native/compiler/bundle.js +7 -1
- package/dist/native/compiler/render-screen.d.ts +2 -1
- package/dist/native/compiler/render-screen.js +7 -4
- package/dist/native/compiler/setup-script.d.ts +7 -0
- package/dist/native/compiler/setup-script.js +13 -2
- package/dist/native/runtime/binding-tree.d.ts +1 -0
- package/dist/native/runtime/binding-tree.js +10 -2
- package/dist/native/runtime/browser-screen.js +34 -3
- package/dist/native/runtime/craft.d.ts +1 -0
- package/dist/native/runtime/shared-screen.d.ts +2 -0
- package/dist/native/runtime/shared-screen.js +3 -0
- package/dist/pwa.js +3 -3
- package/dist/safe-evaluator.d.ts +1 -1
- package/dist/safe-evaluator.js +171 -66
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-08emfsq3.js +0 -2
- package/dist/chunk-12v4d123.js +0 -2
- package/dist/chunk-2a4szpje.js +0 -3
- package/dist/chunk-2j0h8m7g.js +0 -2
- package/dist/chunk-3bwvaxk7.js +0 -2
- package/dist/chunk-3j4rze3n.js +0 -2
- package/dist/chunk-4hyhr5r7.js +0 -2
- package/dist/chunk-4q7ge545.js +0 -2
- package/dist/chunk-4qts8zk7.js +0 -2
- package/dist/chunk-4y2av4ev.js +0 -2
- package/dist/chunk-5gq8m2m7.js +0 -2
- package/dist/chunk-5rmc52h6.js +0 -2
- package/dist/chunk-69v9cn6n.js +0 -2
- package/dist/chunk-6sd4zdtg.js +0 -2
- package/dist/chunk-6tnh3cyq.js +0 -2
- package/dist/chunk-6va8wt88.js +0 -2
- package/dist/chunk-9a111pet.js +0 -3
- package/dist/chunk-9e1hftmd.js +0 -2
- package/dist/chunk-9etv5vzp.js +0 -2
- package/dist/chunk-9skdekv5.js +0 -2
- package/dist/chunk-c2cdv6rh.js +0 -2
- package/dist/chunk-cp4dr9ch.js +0 -2
- package/dist/chunk-d576yrbj.js +0 -2
- package/dist/chunk-dw5hrb3n.js +0 -2
- package/dist/chunk-ev51qyw1.js +0 -2
- package/dist/chunk-f1fyvqz0.js +0 -2
- package/dist/chunk-frw35d2v.js +0 -2
- package/dist/chunk-fzn7k9kn.js +0 -2
- package/dist/chunk-gsm1y1kb.js +0 -2
- package/dist/chunk-h1kssqxk.js +0 -2
- package/dist/chunk-h4crv0by.js +0 -2
- package/dist/chunk-h5p3h200.js +0 -2
- package/dist/chunk-j9c0yam7.js +0 -2
- package/dist/chunk-jt6p29k1.js +0 -2
- package/dist/chunk-jxbx6dk4.js +0 -2
- package/dist/chunk-kqkja1n4.js +0 -2
- package/dist/chunk-m27w29q6.js +0 -2
- package/dist/chunk-m7ddp1jw.js +0 -2
- package/dist/chunk-m7jmpech.js +0 -2
- package/dist/chunk-m8n9wxba.js +0 -2
- package/dist/chunk-ndv44bgs.js +0 -2
- package/dist/chunk-nssdvec7.js +0 -2
- package/dist/chunk-pkfwxp9n.js +0 -2
- package/dist/chunk-qtgejdvq.js +0 -2
- package/dist/chunk-rdy49a05.js +0 -2
- package/dist/chunk-rx4hz615.js +0 -2
- package/dist/chunk-sb0j0v59.js +0 -2
- package/dist/chunk-shf0hd05.js +0 -2
- package/dist/chunk-t1g1sp2z.js +0 -2
- package/dist/chunk-vdh825gt.js +0 -2
- package/dist/chunk-vhfwnvmc.js +0 -40
- package/dist/chunk-vm2cbysz.js +0 -2
- package/dist/chunk-wzymzex7.js +0 -2
- package/dist/chunk-xey01yna.js +0 -2
- package/dist/chunk-xmd8wp8x.js +0 -2
- package/dist/chunk-xmwd2xm6.js +0 -2
- package/dist/chunk-yw3cqy43.js +0 -2
- package/dist/chunk-zpf9he2x.js +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i,vn,
|
|
3
|
-
`:
|
|
4
|
-
${s}${e.slice(r)}`}var N=fn,Ee=new RegExp(`<script\\b[^>]*\\b${L}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),W=/<meta\b[^>]*\bcharset\b[^>]*>/gi,q=/<\/head>/gi;function Ae(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;q.lastIndex=r;let s=q.exec(e),a=s?s.index:e.length;W.lastIndex=r;let o=W.exec(e);if(!o||o.index>=a)return e;if(e.slice(r,o.index).trim()==="")return e;let
|
|
5
|
-
${o[0]}${e.slice(r,o.index)}${e.slice(
|
|
6
|
-
${n[0]}${s.slice(a)}`}var Y="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",C="data-stx-html-attrs",R="data-stx-html-class",G=/^[A-Za-z_:][\w:.-]*$/;function y(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ce(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Se(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 $e(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let s of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[s[1].toLowerCase()]=s[2]??s[3]??s[4]??"";return r}function k(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,s])=>`${r}="${y(String(s))}"`).join(" ")}function I(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 J(e){let n=k(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${I(e)}</script>`}function Re(e={},n="en"){let r=[],s=[],a="",o=n;for(let[u,p]of Object.entries(e||{})){if(p==null)continue;let d=u.trim();if(!G.test(d))continue;let f=d.toLowerCase();if(f==="lang"){o=String(p);continue}if(f==="class"){a=String(p).trim();continue}r.push(` ${d}="${y(String(p))}"`),s.push(d)}let
|
|
7
|
-
`}function Ie(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),
|
|
8
|
-
`),re=
|
|
2
|
+
import{t,i,vn,lr,ke,c}from"./chunk-a5kaw8sc.js";function S(e,n,r,s=0){let a=0,o=s,l=null,u=0,p=!1;while(o<e.length){let d=e[o];if(l&&p){p=!1,o++;continue}if(l&&d==="\\"){p=!0,o++;continue}if(p=!1,(d==='"'||d==="'"||d==="`")&&!l){l=d,o++;continue}if(d===l&&l!=="`"){l=null,o++;continue}if(l==="`"&&d==="$"&&e[o+1]==="{"){u++,o+=2;continue}if(u>0&&d==="}"){u--,o++;continue}if(d==="`"&&l==="`"&&u===0){l=null,o++;continue}if(l){o++;continue}if(d===n)a++;else if(d===r){if(a--,a===0)return o}o++}return-1}import U from"path";function Os(e,n){let r=[];n.lastIndex=0;let s;while((s=n.exec(e))!==null){let a=s.index,o=a+s[0].length-1,l=S(e,"(",")",o);if(l===-1){r.push({start:a,end:-1,args:"",call:e.slice(a,Math.min(e.length,a+80))}),n.lastIndex=o+1;continue}r.push({start:a,end:l+1,args:e.slice(o+1,l),call:e.slice(a,l+1)}),n.lastIndex=l+1}return r}function Ye(e,n,r,s){let a="",o=0;for(let l of Os(e,n)){if(a+=e.slice(o,l.start),l.end===-1){a+=s(l.call),o=l.start;continue}a+=r(l.args,l.call),o=l.end}return a+e.slice(o)}function Ze(e){let n=[],r=0,s=null,a="";for(let o=0;o<e.length;o++){let l=e[o];if(s){if(a+=l,l==="\\"&&o+1<e.length){a+=e[++o];continue}if(l===s)s=null;continue}if(l==="'"||l==='"'||l==="`")s=l;else if(l==="("||l==="["||l==="{")r++;else if(l===")"||l==="]"||l==="}")r--;else if(l===","&&r===0){n.push(a.trim()),a="";continue}a+=l}if(a.trim())n.push(a.trim());return n}function O(e){let n=e.trim(),r=n[0];if(r!=="'"&&r!=='"'&&r!=="`"||n.length<2||n.at(-1)!==r)return null;let s="";for(let a=1;a<n.length-1;a++){let o=n[a];if(o==="\\"&&a+1<n.length-1){let l=n[++a];s+=l==="n"?`
|
|
3
|
+
`:l==="t"?"\t":l;continue}if(o===r)return null;if(r==="`"&&o==="$"&&n[a+1]==="{")return null;s+=o}return s}var ue=new Set(["true","false","null","undefined","typeof","void","new","in","of","instanceof","this","delete","await","async","function","return","NaN","Infinity"]);function Qe(e,n){let r=e.trim();if(!r)return{ok:!1,message:"the argument is empty",code:t.INVALID_DIRECTIVE_SYNTAX};let s=vn(r);if(s)return{ok:!1,message:`the expression is not allowed (${s})`,code:t.UNSAFE_EXPRESSION};let a=lr(n),o;try{o=c(r,Object.keys(a))(...Object.values(a))}catch(u){return{ok:!1,message:`the expression could not be evaluated: ${u instanceof Error?u.message:String(u)}`,code:t.EVALUATION_ERROR}}if(o!==void 0&&o!==null)return{ok:!0,value:o};let l=[...new Set(ke(r))].filter((u)=>!ue.has(u)&&!(u in a)&&!(u in globalThis));if(l.length>0)return{ok:!1,message:`${l.map((p)=>`"${p}"`).join(", ")} ${l.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 pe(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 xe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function V(e){if(!e)return"";return U.isAbsolute(e)?U.relative(process.cwd(),e)||e:e}function M(e){let n=e.replace(/\s+/g," ").trim();return n.length>80?`${n.slice(0,77)}...`:n}function E(e,n,r,s,a=t.EVALUATION_ERROR){let o=s?` in ${V(s)}`:"";return console.warn(`[stx] ${M(n)}${o}: ${r}`),i(e,`${M(n)}: ${r}`,a)}function or(e,n,r){let s=r?` in ${V(r)}`:"";console.warn(`[stx] ${M(e)}${s}: ${n}`)}function Ds(){return{afterOpen:[],beforeClose:[]}}function de(e){return e.afterOpen.length>0||e.beforeClose.length>0}function Ri(e,n){if(!de(n))return e;let r=n.afterOpen.join(""),s=n.beforeClose.join(""),a=e.lastIndexOf("</head>"),o=r?fn(e):null,l=s&&a!==-1?a:null;if(o===null&&l===null)return e;if(o!==null&&l!==null)return`${e.slice(0,o)}${r}${e.slice(o,l)}${s}${e.slice(l)}`;if(o!==null)return`${e.slice(0,o)}${r}${e.slice(o)}`;return`${e.slice(0,l)}${s}${e.slice(l)}`}var K=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function fn(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return null;let r=n.index+n[0].length;K.lastIndex=r;let s=K.exec(e);return s?r+s[0].length:r}var L="data-stx-color-mode-boot",F="__STX_COLOR_MODE__",he=new Set(["light","dark","auto","system"]),me=new Set(["auto","system"]),ye=/^[a-z][\w:-]*$/i,be=/^[\w-]+$/;function Te(e){let n=e.storageKey??"stx-color-mode",r=e.initialMode??"auto",s=e.darkClass===void 0?"dark":e.darkClass,a=e.attribute??null,o=e.autoValue??null,l=e.respectExisting===!0;if(typeof n!=="string"||n.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!he.has(r))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(r)}`);if(s!==null&&(typeof s!=="string"||!be.test(s)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(s)}`);if(a!==null&&(typeof a!=="string"||!ye.test(a)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(a)}`);if(o!==null&&!me.has(o))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(o)}`);if(s===null&&a===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");if(l&&a===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:s,attribute:a,autoValue:o,respectExisting:l}}function ve(e){return JSON.stringify(e).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function D(e={}){let n=Te(e),r=ve(n),s=`(function(){"use strict";var o=window.${F};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.${F}={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 ${L}>${s}</script>`}function gn(e,n={}){if(e.includes(L))return e;let r=N(e);if(r===null)return e;let s=D(n);return`${e.slice(0,r)}
|
|
4
|
+
${s}${e.slice(r)}`}var N=fn,Ee=new RegExp(`<script\\b[^>]*\\b${L}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),W=/<meta\b[^>]*\bcharset\b[^>]*>/gi,q=/<\/head>/gi;function Ae(e){let n=/<head\b[^>]*>/i.exec(e);if(!n)return e;let r=n.index+n[0].length;q.lastIndex=r;let s=q.exec(e),a=s?s.index:e.length;W.lastIndex=r;let o=W.exec(e);if(!o||o.index>=a)return e;if(e.slice(r,o.index).trim()==="")return e;let l=o.index+o[0].length;return`${e.slice(0,r)}
|
|
5
|
+
${o[0]}${e.slice(r,o.index)}${e.slice(l,a)}${e.slice(a)}`}function Ai(e){return we(Ae(e))}function we(e){let n=Ee.exec(e);if(!n)return e;let r=N(e);if(r===null)return e;if(n.index<=r||e.slice(r,n.index).trim()==="")return e;let s=e.slice(0,n.index)+e.slice(n.index+n[0].length),a=N(s);if(a===null)return e;return`${s.slice(0,a)}
|
|
6
|
+
${n[0]}${s.slice(a)}`}var Y="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",C="data-stx-html-attrs",R="data-stx-html-class",G=/^[A-Za-z_:][\w:.-]*$/;function y(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Ce(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function Se(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 $e(e){let n=/^\s*<meta\b([^>]*)>/i.exec(e);if(!n)return null;let r={};for(let s of n[1].matchAll(/([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g))r[s[1].toLowerCase()]=s[2]??s[3]??s[4]??"";return r}function k(e,n){return Object.entries(e).filter(([r])=>!n?.(r)).map(([r,s])=>`${r}="${y(String(s))}"`).join(" ")}function I(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 J(e){let n=k(e,(r)=>r==="content");return`<script${n?` ${n}`:""}>${I(e)}</script>`}function Re(e={},n="en"){let r=[],s=[],a="",o=n;for(let[u,p]of Object.entries(e||{})){if(p==null)continue;let d=u.trim();if(!G.test(d))continue;let f=d.toLowerCase();if(f==="lang"){o=String(p);continue}if(f==="class"){a=String(p).trim();continue}r.push(` ${d}="${y(String(p))}"`),s.push(d)}let l=` lang="${y(o)}"`;if(a)l+=` class="${y(a)}"`;if(l+=r.join(""),a)l+=` ${R}="${y(a)}"`;if(s.length)l+=` ${C}="${y(s.join(" "))}"`;return l}function Pi(e={},n={}){let r={...e,...n};if(e.class&&n.class){let s=e.class.split(/\s+/).filter(Boolean);for(let a of n.class.split(/\s+/).filter(Boolean))if(!s.includes(a))s.push(a);r.class=s.join(" ")}return r}function mn(e,n={}){if(!n||Object.keys(n).length===0)return e;let r=e.match(/<html\b([^>]*)>/i);if(!r)return e;let s={},a=[],o=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,l;while((l=o.exec(r[1]))!==null){let f=l[1];if(!(f in s))a.push(f);s[f]=l[2]??l[3]??l[4]??""}let u=[],p=[];for(let[f,h]of Object.entries(n)){if(h==null)continue;let m=f.trim();if(!G.test(m))continue;let w=m.toLowerCase();if(w==="class"){let x=(s.class||"").split(/\s+/).filter(Boolean);for(let A of String(h).split(/\s+/).filter(Boolean))if(!x.includes(A))x.push(A),u.push(A);if(!("class"in s))a.push("class");s.class=x.join(" ");continue}if(!(m in s))a.push(m);if(s[m]=String(h),w!=="lang")p.push(m)}if(u.length){if(!(R in s))a.push(R);s[R]=u.join(" ")}if(p.length){if(!(C in s))a.push(C);s[C]=p.join(" ")}let d=a.map((f)=>` ${f}="${y(s[f])}"`).join("");return e.replace(r[0],()=>`<html${d}>`)}function Ii(e){if(e.includes("data-stx-cloak"))return null;if(e.lastIndexOf("</head>")===-1)return null;return`${Y}
|
|
7
|
+
`}function Ie(e){let n=[],r=0;while(r<e.length){let o=e.slice(r),l=o.match(/^\s+/);if(l){r+=l[0].length;continue}if(o.startsWith("<!--")){let h=e.indexOf("-->",r);if(h===-1)break;r=h+3;continue}let u=o.match(/^<script\b[^>]*>/i);if(u){let h=e.toLowerCase().indexOf("</script>",r+u[0].length);if(h===-1)break;r=h+9;continue}let p=o.match(/^<link\b[^>]*>/i);if(p){n.push(p[0]),r+=p[0].length;continue}let d=o.match(/^<meta\b[^>]*>/i);if(d){n.push(d[0]),r+=d[0].length;continue}let f=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(f){n.push(f[0]),r+=f[0].length;continue}break}if(n.length===0)return{body:e,hoisted:n};let s="",a=0;while(a<e.length&&a<r){let o=e.slice(a),l=o.match(/^<link\b[^>]*>/i);if(l&&n.includes(l[0])){a+=l[0].length;continue}let u=o.match(/^<meta\b[^>]*>/i);if(u&&n.includes(u[0])){a+=u[0].length;continue}let p=o.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(p&&n.includes(p[0])){a+=p[0].length;continue}s+=e[a],a++}return s+=e.slice(r),{body:s,hoisted:n}}function _e(e,n={},r={}){let{title:s="stx App",lang:a="en",meta:o=[],link:l=[],script:u=[],headRaw:p="",htmlAttrs:d={},bodyClass:f="",bodyAttrs:h={}}=n,m=r.title||s,w=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],x=new Set(o.map(Se).filter(Boolean)),{body:A,hoisted:B}=Ie(e),te=new Set(B.flatMap((g)=>{let v=$e(g);return v?[Se(v)].filter(Boolean):[]})),ne=[...w.filter((g)=>!x.has(Se(g))),...o].filter((g)=>!te.has(Se(g))).map((g)=>` <meta ${k(g)}>`).join(`
|
|
8
|
+
`),re=l.map((g)=>` <link ${k(g)}>`).join(`
|
|
9
9
|
`),ie=u.map((g)=>{if(g.src)return` <script ${k(g,(v)=>v==="content")}></script>`;if(g.content)return` ${J(g)}`;return""}).filter(Boolean).join(`
|
|
10
10
|
`),se=Re(d,a),oe=Object.entries(h).map(([g,v])=>` ${g}="${y(String(v))}"`).join(""),ae=f?` class="${y(f)}"`:"",le=[ne,r.colorMode?` ${D(r.colorMode)}`:"",` <title>${r.titleIsHtml?m:Ce(m)}</title>`,` ${Y}`,re,ie,p?` ${p}`:"",...(r.styles||[]).map((g)=>` ${g}`),...B.map((g)=>` ${g}`),...(r.headScripts||[]).map((g)=>` ${g}`),r.headStack||""].filter(Boolean),ce=[A,...(r.bodyScripts||[]).map((g)=>g),r.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
11
11
|
<html${se}>
|
|
@@ -17,8 +17,8 @@ ${le.join(`
|
|
|
17
17
|
${ce.join(`
|
|
18
18
|
`)}
|
|
19
19
|
</body>
|
|
20
|
-
</html>`}var H=/\s+/y,j=/<(script|style)\b[^>]*>/iy,Me=/<\/script>/gi,Oe=/<\/style>/gi,z=/<!DOCTYPE\b/iy,X=/<html[\s>]/iy;function At(e){let n=0;while(n<e.length){if(H.lastIndex=n,H.exec(e)){n=H.lastIndex;continue}if(e.startsWith("<!--",n)){let a=e.indexOf("-->",n);if(a===-1)return!1;n=a+3;continue}j.lastIndex=n;let s=j.exec(e);if(s){let a=s[1].toLowerCase()==="script"?Me:Oe;a.lastIndex=j.lastIndex;let o=a.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(z.lastIndex=n,z.test(e))return!0;return X.lastIndex=n,X.test(e)}return!1}function
|
|
20
|
+
</html>`}var H=/\s+/y,j=/<(script|style)\b[^>]*>/iy,Me=/<\/script>/gi,Oe=/<\/style>/gi,z=/<!DOCTYPE\b/iy,X=/<html[\s>]/iy;function At(e){let n=0;while(n<e.length){if(H.lastIndex=n,H.exec(e)){n=H.lastIndex;continue}if(e.startsWith("<!--",n)){let a=e.indexOf("-->",n);if(a===-1)return!1;n=a+3;continue}j.lastIndex=n;let s=j.exec(e);if(s){let a=s[1].toLowerCase()==="script"?Me:Oe;a.lastIndex=j.lastIndex;let o=a.exec(e);if(o===null)return!1;n=o.index+o[0].length;continue}if(z.lastIndex=n,z.test(e))return!0;return X.lastIndex=n,X.test(e)}return!1}function Ms(e){return At(e)}function Oi(e,n={}){let r=e.lastIndexOf("</head>");if(r===-1)return e;let{meta:s=[],link:a=[],script:o=[],headRaw:l=""}=n,u=e.slice(0,r),p=[];for(let d of s){let f=Se(d);if(f&&u.includes(f))continue;p.push(` <meta ${k(d)}>`)}for(let d of a){if(d.href&&u.includes(`href="${d.href}"`))continue;p.push(` <link ${k(d)}>`)}for(let d of o)if(d.src){if(u.includes(`src="${d.src}"`))continue;p.push(` <script ${k(d,(f)=>f==="content")}></script>`)}else if(d.content){if(u.includes(I(d)))continue;p.push(` ${J(d)}`)}if(l&&!u.includes(l))p.push(` ${l}`);if(p.length===0)return e;return`${e.slice(0,r)}${p.join(`
|
|
21
21
|
`)}
|
|
22
|
-
${e.slice(r)}`}function hn(e,n={},r={},s){if(s??
|
|
23
|
-
`)}function
|
|
24
|
-
`,"")),headContent:n.trim()}}function
|
|
22
|
+
${e.slice(r)}`}function hn(e,n={},r={},s){if(s??Ms(e))return e;return _e(e,n,r)}var Ne=["og:","article:","book:","profile:","fb:","music:","video:"],Le=/^[a-z][\w-]*(?::[\w:-]+)?$/i;function yn(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=De(e[0],n);if(typeof r!=="string")return r;let s;if(e.length===2){let o=He(e[1],n);if(typeof o!=="string")return o;s=o}else{let o=r.includes(":")?r.slice(r.indexOf(":")+1):r,l=n.openGraph,u=n[o]??(xe(l)?l[o]:void 0);s=u===void 0||u===null||typeof u==="object"?"":String(u)}if(!s)return{kind:"empty"};return{kind:"tag",tag:Ne.some((o)=>r.startsWith(o))?{property:r,content:s}:{name:r,content:s}}}function De(e,n){let r=O(e);if(r!==null)return r.trim()?r:{kind:"error",message:"the meta name is empty",code:t.INVALID_DIRECTIVE_SYNTAX};if(Le.test(e.trim()))return e.trim();let s=Qe(e,n);if(!s.ok)return{kind:"error",message:`meta name: ${s.message}`,code:s.code};if(typeof s.value!=="string"||!s.value.trim())return{kind:"error",message:`the meta name must be a non-empty string, got ${pe(s.value)}`,code:t.TYPE_ERROR};return s.value}function He(e,n){let r=O(e);if(r!==null)return r;let s=Qe(e,n);if(!s.ok)return{kind:"error",message:s.message,code:s.code};let a=s.value;if(a===void 0||a===null||a===!1)return"";if(Array.isArray(a))return a.filter((o)=>o!==void 0&&o!==null&&o!=="").map(String).join(", ");if(typeof a==="object"&&!(a instanceof Date))return{kind:"error",message:`the content must be text, got ${pe(a)}`,code:t.TYPE_ERROR};return String(a)}var bn=["title","lang","meta","link","script","headRaw","htmlAttrs","bodyClass","bodyAttrs"],ir=["title","titleTemplate","base","meta","link","script","style","htmlAttrs","bodyAttrs"],ee={links:"link",metas:"meta",scripts:"script",styles:"style"},Z=new Set,Q=new WeakMap;function P(e){if(Z.has(e))return;Z.add(e),console.warn(e)}function je(e,n){let r=Array.from({length:n.length+1},(s,a)=>a);for(let s=1;s<=e.length;s++){let a=r[0];r[0]=s;for(let o=1;o<=n.length;o++){let l=r[o];r[o]=Math.min(r[o]+1,r[o-1]+1,a+(e[s-1]===n[o-1]?0:1)),a=l}}return r[n.length]}function Pe(e,n){let r=e.toLowerCase(),s=n.find((p)=>p.toLowerCase()===r);if(s)return s;let a=ee[r];if(a&&n.includes(a))return a;let o,l=1/0;for(let p of n){let d=je(r,p.toLowerCase());if(d<l)o=p,l=d}let u=Math.min(e.length,o?.length??0)<=4?1:2;return l<=u?o:void 0}function fe(e,n){if(!e||typeof e!=="object"||Array.isArray(e))return e||{};let r=Q.get(e);if(r)return r;let{known:s,source:a}=n,o=e;for(let l of Object.keys(e)){if(s.includes(l))continue;let u=ee[l];if(u&&s.includes(u)&&Array.isArray(e[l])){if(o===e)o={...e};let d=Array.isArray(o[u])?o[u]:[];o[u]=[...d,...e[l]],delete o[l],P(`[stx] ${a}.${l} is not a head key; reading it as ${a}.${u}. Rename it to \`${u}\`.`);continue}if(/^styles?$/.test(l)&&!s.includes("style")){P(`[stx] ${a}.${l} is not a head key and is ignored. Use \`link\` with rel: 'stylesheet', or \`headRaw\` for an inline <style>.`);continue}let p=Pe(l,s);P(p?`[stx] ${a}.${l} is not a head key and is ignored. Did you mean \`${p}\`?`:`[stx] ${a}.${l} is not a head key and is ignored. Known keys: ${s.join(", ")}.`)}return Q.set(e,o),o}var b={},Be=[],_={};function Ns(){return b}function lu(){return _}function du(){b={},Be.length=0,_={}}function Di(e){b=ge(b,fe(e,{known:ir,source:"useHead()"}))}function ge(e,n){return{title:n.title??e.title,titleTemplate:n.titleTemplate??e.titleTemplate,base:n.base??e.base,meta:[...e.meta||[],...n.meta||[]],link:[...e.link||[],...n.link||[]],script:[...e.script||[],...n.script||[]],style:[...e.style||[],...n.style||[]],htmlAttrs:{...e.htmlAttrs,...n.htmlAttrs},bodyAttrs:{...e.bodyAttrs,...n.bodyAttrs}}}function Uc(e){Di(ar(e))}function ar(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,s=e.ogDescription??e.description;if(r)n.push({property:"og:title",content:r});if(s)n.push({property:"og:description",content:s});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 a=e.twitterTitle??e.title,o=e.twitterDescription??e.description,l=e.twitterImage??e.ogImage;if(e.twitterCard)n.push({name:"twitter:card",content:e.twitterCard});if(a)n.push({name:"twitter:title",content:a});if(o)n.push({name:"twitter:description",content:o});if(l){n.push({name:"twitter:image",content:l});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 u=[];if(e.canonical)u.push({rel:"canonical",href:e.canonical});return{title:e.title,titleTemplate:e.titleTemplate,meta:n,link:u}}function uu(e){if(_={..._,...e},e.title||e.description)Uc({title:e.title,description:e.description})}function pu(e){let n=typeof e==="function"?e():e;Di({title:n})}function fu(e=b){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>${T(r)}</title>`)}if(e.base){let r=Object.entries(e.base).map(([s,a])=>`${s}="${T(a)}"`).join(" ");n.push(`<base ${r}>`)}for(let r of e.meta||[]){let s=Object.entries(r).filter(([a,o])=>o!==void 0).map(([a,o])=>`${a==="httpEquiv"?"http-equiv":a}="${T(String(o))}"`).join(" ");n.push(`<meta ${s}>`)}for(let r of e.link||[]){let s=Object.entries(r).filter(([a,o])=>o!==void 0).map(([a,o])=>`${a}="${T(String(o))}"`).join(" ");n.push(`<link ${s}>`)}for(let r of e.script||[]){let{content:s,...a}=r,o=Object.entries(a).filter(([l,u])=>u!==void 0).map(([l,u])=>{if(typeof u==="boolean")return u?l:"";return`${l}="${T(String(u))}"`}).filter(Boolean).join(" ");if(s)n.push(`<script ${o}>${I(r)}</script>`);else n.push(`<script ${o}></script>`)}for(let r of e.style||[]){let s=r.type?` type="${r.type}"`:"";n.push(`<style${s}>${r.content}</style>`)}return n.join(`
|
|
23
|
+
`)}function gu(e=b){if(!e.htmlAttrs)return"";return Object.entries(e.htmlAttrs).map(([n,r])=>`${n}="${T(r)}"`).join(" ")}function mu(e=b){if(!e.bodyAttrs)return"";return Object.entries(e.bodyAttrs).map(([n,r])=>`${n}="${T(r)}"`).join(" ")}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function hu(e=b){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 s=document.querySelector(r);if(!s){if(s=document.createElement("meta"),n.name)s.setAttribute("name",n.name);if(n.property)s.setAttribute("property",n.property);document.head.appendChild(s)}s.setAttribute("content",n.content)}}for(let n of e.link||[]){let r=`link[rel="${n.rel}"]${n.href?`[href="${n.href}"]`:""}`,s=document.querySelector(r);if(!s)s=document.createElement("link"),document.head.appendChild(s);for(let[a,o]of Object.entries(n))if(o!==void 0)s.setAttribute(a,String(o))}if(e.htmlAttrs)for(let[n,r]of Object.entries(e.htmlAttrs))if(n==="class")for(let s of String(r).split(/\s+/).filter(Boolean))document.documentElement.classList.add(s);else document.documentElement.setAttribute(n,r);if(e.bodyAttrs)for(let[n,r]of Object.entries(e.bodyAttrs))document.body.setAttribute(n,r)}function yu(e){let n="";return{content:e.replace(/@head\s*([\s\S]*?)@endhead/g,(s,a)=>(n+=a.trim()+`
|
|
24
|
+
`,"")),headContent:n.trim()}}function bu(e,n){return e.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(r,s,a,o)=>{let l=s?a:n[(o||"").trim()]??o,u=n.__stx_runtime_head??{};return n.__stx_runtime_head=ge(u,{title:l}),""})}function wu(e,n,r=""){if(!e.includes("@meta"))return e;return Ye(e,/(?<![\w$@])@meta\s*\(/g,(s,a)=>{let o=yn(Ze(s),n);if(o.kind==="error")return E("Meta",a,o.message,r,o.code);if(o.kind==="tag"){let l=n.__stx_runtime_head??{};n.__stx_runtime_head=ge(l,{meta:[o.tag]})}return""},(s)=>E("Meta",s,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX))}export{S,Os,Ye,Ze,Qe,pe,xe,E,or,Ds,Ri,fn,gn,Ai,Se,Pi,mn,Ii,At,Ms,Oi,hn,yn,bn,ir,fe,Ns,lu,du,Di,ge,Uc,ar,uu,pu,fu,gu,mu,hu,yu,bu,wu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Fr,Fl,zl}from"./chunk-b2fkxk6k.js";import"./chunk-6wktqt18.js";import"./chunk-ssthwjpr.js";import"./chunk-azb58ven.js";import"./chunk-hmehxwzj.js";import"./chunk-1b50m7e7.js";import"./chunk-ec8k75ep.js";import"./chunk-dyreg5df.js";import"./chunk-q04fdq91.js";import"./chunk-e124cgb6.js";import"./chunk-jmvp99ay.js";import"./chunk-j2erwdgt.js";import"./chunk-a5kaw8sc.js";import"./chunk-6v1gwdbv.js";import"./chunk-r4199q6x.js";import"./chunk-kvmg6r89.js";import"./chunk-1xgs9gd5.js";export{zl as clearComposableCache,Fl as getComposableScript,Fr as listComposableModules};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{t,i}from"./chunk-
|
|
2
|
+
import{t,i}from"./chunk-a5kaw8sc.js";import{Ye,Ze,Qe,pe,xe,E,or,yn,ge}from"./chunk-j2erwdgt.js";var I=/(?<![\w$@])@meta\s*\(/g,C=/(?<![\w$@])@metaTag\s*\(/g,k=/(?<![\w$@])@structuredData\s*\(/g,N=/(?<![\w$@])@seo\s*\(/g;function _(e,r){return(n)=>E(e,n,"the call has no closing parenthesis",r,t.INVALID_DIRECTIVE_SYNTAX)}function j(e){return"property"in e?`<meta property="${l(e.property)}" content="${l(e.content)}">`:`<meta name="${l(e.name)}" content="${l(e.content)}">`}function Rs(e,r,n,g){if(!e.includes("@meta"))return e;let a=Ye(e,I,(s,c)=>{let o=yn(Ze(s),r);if(o.kind==="tag")return j(o.tag);if(o.kind==="empty")return"";return E("Meta",c,o.message,n,o.code)},_("Meta",n));return a=Ye(a,C,(s,c)=>{let o=Qe(s,r);if(!o.ok)return E("MetaTag",c,o.message,n,o.code);if(o.value===void 0||o.value===null)return"";if(!xe(o.value))return E("MetaTag",c,`expected an object such as { name, content }, got ${pe(o.value)}`,n,t.TYPE_ERROR);let u=o.value;if(!u.name&&!u.property&&!u.httpEquiv)return E("MetaTag",c,"the tag needs a name, property or httpEquiv",n,t.INVALID_DIRECTIVE_SYNTAX);if(u.content===void 0||u.content===null||u.content===""||u.content===!1)return"";let p="<meta";if(u.name)p+=` name="${l(u.name)}"`;if(u.property)p+=` property="${l(u.property)}"`;if(u.httpEquiv)p+=` http-equiv="${l(u.httpEquiv)}"`;return p+=` content="${l(u.content)}">`,p},_("MetaTag",n)),a}function v(e){let r=(n)=>n["@context"]?{...n}:{...n,"@context":"https://schema.org"};if(xe(e))return r(e);if(Array.isArray(e)&&e.length>0&&e.every(xe))return e.map(r);return null}function A(e){return`<script type="application/ld+json">${JSON.stringify(e).replace(/<\//g,"<\\/")}</script>`}function As(e,r,n){if(!e.includes("@structuredData"))return e;return Ye(e,k,(g,a)=>{let s=Qe(g,r);if(!s.ok)return E("StructuredData",a,s.message,n,s.code);if(s.value===void 0||s.value===null)return"";let c=v(s.value);if(!c)return E("StructuredData",a,`expected an object or an array of objects, got ${pe(s.value)}`,n,t.TYPE_ERROR);try{return A(c)}catch(o){let u=o instanceof Error?o.message:String(o);return E("StructuredData",a,`the data cannot be written as JSON: ${u}`,n,t.EVALUATION_ERROR)}},_("StructuredData",n))}var L=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),R={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Ps(e,r,n,g){if(!e.includes("@seo"))return e;return Ye(e,N,(a,s)=>{if(!a.trim())return E("SEO",s,"expected an object: @seo({ title, description }) or @seo(seoVariable)",n,t.INVALID_DIRECTIVE_SYNTAX);let c=Qe(a,r);if(!c.ok)return E("SEO",s,c.message,n,c.code);if(c.value===void 0||c.value===null)return"";if(!xe(c.value))return E("SEO",s,`expected an object such as { title, description }, got ${pe(c.value)}`,n,t.TYPE_ERROR);try{return q(c.value,s,n)}catch(o){let u=o instanceof Error?o.message:String(o);return E("SEO",s,`Error processing @seo directive: ${u}`,n,t.EVALUATION_ERROR)}},_("SEO",n))}function b(e,r,n,g){let a=e[r];if(a===void 0||a===null||a===!1)return;if(xe(a))return a;or(n,`${r} must be an object, got ${pe(a)}; its tags were left out`,g);return}function q(e,r,n){let g=Object.keys(e).filter((o)=>!L.has(o));if(g.length>0){let o=g.map((u)=>R[u]?`${u} (use ${R[u]})`:u).join(", ");or(r,`@seo does not read ${o}; ${g.length===1?"it was":"they were"} ignored`,n)}let a="";if(e.title)a+=`<title>${l(e.title)}</title>
|
|
3
3
|
`,a+=`<meta name="title" content="${l(e.title)}">
|
|
4
4
|
`;if(e.description)a+=`<meta name="description" content="${l(e.description)}">
|
|
5
5
|
`;if(e.keywords){let o=Array.isArray(e.keywords)?e.keywords.join(", "):e.keywords;a+=`<meta name="keywords" content="${l(o)}">
|
|
@@ -25,7 +25,7 @@ import{t,i}from"./chunk-vhfwnvmc.js";import{Ye,Ze,Qe,pe,xe,E,or,yn,ge}from"./chu
|
|
|
25
25
|
`}if(c.site)a+=`<meta name="twitter:site" content="${l(c.site)}">
|
|
26
26
|
`;if(c.creator)a+=`<meta name="twitter:creator" content="${l(c.creator)}">
|
|
27
27
|
`}if(e.structuredData!==void 0&&e.structuredData!==null){let o=v(e.structuredData);if(o)a+=`${A(o)}
|
|
28
|
-
`;else or(r,`structuredData must be an object or an array of objects, got ${pe(e.structuredData)}; it was left out`,n)}return a.trim()}function
|
|
28
|
+
`;else or(r,`structuredData must be an object or an array of objects, got ${pe(e.structuredData)}; it was left out`,n)}return a.trim()}function Is(e,r,n){if(n.seo?.enabled===!1)return e;if(e.includes("<!-- stx SEO Tags -->")||r.__stx_seo_staged===!0||n.skipDefaultSeoTags===!0)return e;let g=r.__stx_runtime_head;if(!!(g?.title||g?.meta?.some((S)=>S.property==="og:title"||S.name==="og:title"||S.name==="twitter:title"||S.name==="description")))return e;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(e)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(e))return e;if(!e.includes("<head>")&&!e.includes("<head "))return e;let s=e.includes("<title>")||e.includes("</title>"),c=M(e),o=V(c),u=U(c),p="";if(r.title)p=r.title;else if(r.meta&&r.meta.title)p=r.meta.title;else if(o)p=o;else if(n.seo?.defaultConfig?.title)p=n.seo.defaultConfig.title;else p=n.defaultTitle||"stx Project";let m="";if(r.description)m=r.description;else if(r.meta&&r.meta.description)m=r.meta.description;else if(u)m=u;else if(n.seo?.defaultConfig?.description)m=n.seo.defaultConfig.description;else m=n.defaultDescription||"A website built with stx templating engine";let d="";if(r.image)d=r.image;else if(r.meta&&r.meta.image)d=r.meta.image;else if(r.openGraph&&r.openGraph.image)d=r.openGraph.image;else if(n.seo?.defaultImage)d=n.seo.defaultImage;else if(n.defaultImage)d=n.defaultImage;let f=s?"":`
|
|
29
29
|
<meta name="title" content="${l(p)}">`,D=G(c)?"":`
|
|
30
30
|
<meta name="description" content="${l(m)}">`,y=`
|
|
31
31
|
<!-- stx SEO Tags -->${f}${D}
|
|
@@ -43,7 +43,7 @@ import{t,i}from"./chunk-vhfwnvmc.js";import{Ye,Ze,Qe,pe,xe,E,or,yn,ge}from"./chu
|
|
|
43
43
|
${y}
|
|
44
44
|
`),h;return h.replace(/<head[^>]*>/,`$&
|
|
45
45
|
${y}
|
|
46
|
-
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var nr={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=yn(r,n??{});if(a.kind==="error")return E("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=ge(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},rr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function
|
|
46
|
+
`)}function M(e){let r=e.search(/<\/head\s*>/i);return r===-1?e:e.slice(0,r)}function x(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�*39;|'/g,"'").replace(/&/g,"&")}function V(e){let r=e.match(/<title(?:\s[^>]*)?>([\s\S]*?)<\/title\s*>/i);return r?x(r[1].trim()):""}function O(e){return(e.match(/<meta\s[^>]*>/gi)||[]).filter((r)=>/\sname\s*=\s*["']description["']/i.test(r))}function G(e){return O(e).length>0}function U(e){for(let r of O(e)){let n=r.match(/\scontent\s*=\s*(?:"([^"]*)"|'([^']*)')/i),g=(n?.[1]??n?.[2]??"").trim();if(g)return x(g)}return""}function l(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var nr={name:"meta",rawParams:!0,handler:(e,r,n,g)=>{let a=yn(r,n??{});if(a.kind==="error")return E("Meta",`@meta(${r.join(", ")})`,a.message,g,a.code);if(a.kind==="empty")return"";if(n)n.__stx_runtime_head=ge(n.__stx_runtime_head??{},{meta:[a.tag]});return""},hasEndTag:!1},rr={name:"structuredData",handler:(e,r,n,g)=>{if(e.trim()==="")return i("StructuredData","structuredData directive requires JSON-LD content",t.INVALID_DIRECTIVE_SYNTAX);try{let a=JSON.parse(e);if(!a["@context"])a["@context"]="https://schema.org";if(!a["@type"])return i("StructuredData","structuredData requires @type property",t.INVALID_DIRECTIVE_SYNTAX);return A(a)}catch(a){let s=a instanceof Error?a.message:String(a);return i("StructuredData",s,t.EVALUATION_ERROR)}},hasEndTag:!0};function su(){return[nr,rr]}function ou(e,r){let{baseUrl:n,defaultChangefreq:g="weekly",defaultPriority:a=0.5,includeLastmod:s=!0}=r,c=n.replace(/\/$/,""),o=(m)=>m.startsWith("http")?m:`${c}${m.startsWith("/")?"":"/"}${m}`,u=e.map((m)=>{let d=o(m.loc),f=m.lastmod||(s?new Date().toISOString().split("T")[0]:void 0),D=m.changefreq||g,y=m.priority??a,h=` <url>
|
|
47
47
|
<loc>${T(d)}</loc>`;for(let w of m.alternates??[])h+=`
|
|
48
48
|
<xhtml:link rel="alternate" hreflang="${T(w.hreflang)}" href="${T(o(w.href))}"/>`;if(f)h+=`
|
|
49
49
|
<lastmod>${f}</lastmod>`;return h+=`
|
|
@@ -53,13 +53,13 @@ ${y}
|
|
|
53
53
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${e.some((m)=>m.alternates?.length)?' xmlns:xhtml="http://www.w3.org/1999/xhtml"':""}>
|
|
54
54
|
${u.join(`
|
|
55
55
|
`)}
|
|
56
|
-
</urlset>`}function
|
|
56
|
+
</urlset>`}function iu(e,r){let n=r.replace(/\/$/,""),g=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
|
|
57
57
|
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
58
58
|
${e.map((s)=>{let c=s.startsWith("http")?s:`${n}${s.startsWith("/")?"":"/"}${s}`;return` <sitemap>
|
|
59
59
|
<loc>${T(c)}</loc>
|
|
60
60
|
<lastmod>${g}</lastmod>
|
|
61
61
|
</sitemap>`}).join(`
|
|
62
62
|
`)}
|
|
63
|
-
</sitemapindex>`}async function
|
|
64
|
-
`).trim()}function
|
|
65
|
-
export{
|
|
63
|
+
</sitemapindex>`}async function au(e,r){let{extensions:n=[".stx",".html",".htm"],ignore:g=["_*",".*","node_modules","components","partials","layouts"]}=r,a=[],s=n.length===1?`*${n[0]}`:`*{${n.join(",")}}`,c=new Bun.Glob(`**/${s}`);for await(let o of c.scan(e)){if(g.some((f)=>{if(f.startsWith("*"))return o.includes(f.slice(1));return o.startsWith(f)||o.includes(`/${f}`)}))continue;let p=o.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!p.startsWith("/"))p=`/${p}`;if(p!=="/"&&p.endsWith("/"))p=p.slice(0,-1);let m=`${e}/${o}`,d;try{let f=await Bun.file(m).stat();if(f)d=new Date(f.mtime).toISOString().split("T")[0]}catch{}a.push({loc:p||"/",lastmod:d,priority:p==="/"?1:0.5})}return a.sort((o,u)=>o.loc.localeCompare(u.loc)),a}function sr(e){let r=[];for(let n of e.rules){if(r.push(`User-agent: ${n.userAgent}`),n.allow)for(let g of n.allow)r.push(`Allow: ${g}`);if(n.disallow)for(let g of n.disallow)r.push(`Disallow: ${g}`);if(n.crawlDelay!==void 0)r.push(`Crawl-delay: ${n.crawlDelay}`);r.push("")}if(e.sitemap){let n=Array.isArray(e.sitemap)?e.sitemap:[e.sitemap];for(let g of n)r.push(`Sitemap: ${g}`)}if(e.host)r.push(`Host: ${e.host}`);return r.join(`
|
|
64
|
+
`).trim()}function cu(e){return sr({rules:[{userAgent:"*",allow:["/"]}],sitemap:e})}function T(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}
|
|
65
|
+
export{Rs,As,Ps,Is,nr,rr,su,ou,iu,au,sr,cu};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{pa,_l,fa,ga,Tl,$l}from"./chunk-myndj1r8.js";import"./chunk-hmehxwzj.js";import"./chunk-1b50m7e7.js";import"./chunk-ec8k75ep.js";import"./chunk-dyreg5df.js";import"./chunk-q04fdq91.js";import"./chunk-e124cgb6.js";import"./chunk-jmvp99ay.js";import"./chunk-j2erwdgt.js";import"./chunk-a5kaw8sc.js";import"./chunk-6v1gwdbv.js";import"./chunk-r4199q6x.js";import"./chunk-kvmg6r89.js";import"./chunk-1xgs9gd5.js";export{$l as applySlots,Tl as extractSlotContent,_l as parseSlotElement,pa as parseSlots,ga as processSlots,fa as renderSlot};
|
|
@@ -72,7 +72,7 @@ else {
|
|
|
72
72
|
${t}
|
|
73
73
|
})();
|
|
74
74
|
</script>
|
|
75
|
-
`}function
|
|
75
|
+
`}function Hl(i,n,o){f=0;let l=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return i.replace(l,(t,e,s)=>{let a=v(),r=p(t,e,s),d=r.placeholder?`<div data-defer-placeholder>${r.placeholder}</div>`:"",c=r.loading?`<div data-defer-loading style="display: none;">${r.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',g=r.error?`<div data-defer-error style="display: none;">${r.error}</div>`:"",u=`<div data-defer-content style="display: none;">${r.content}</div>`,h=E(a,r);return`
|
|
76
76
|
<div id="${a}" class="stx-defer" data-defer-trigger="${r.trigger}">
|
|
77
77
|
${d}
|
|
78
78
|
${c}
|
|
@@ -81,4 +81,4 @@ else {
|
|
|
81
81
|
</div>
|
|
82
82
|
${h}
|
|
83
83
|
`})}
|
|
84
|
-
export{
|
|
84
|
+
export{Hl};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{Gd,Zo,Kd,Qo,fc,gc,Et,an,Xd,mc,hc,yc,f}from"./chunk-hmehxwzj.js";import"./chunk-1b50m7e7.js";import"./chunk-ec8k75ep.js";import"./chunk-dyreg5df.js";import"./chunk-q04fdq91.js";import"./chunk-e124cgb6.js";import"./chunk-jmvp99ay.js";import"./chunk-j2erwdgt.js";import"./chunk-a5kaw8sc.js";import"./chunk-6v1gwdbv.js";import"./chunk-r4199q6x.js";import"./chunk-kvmg6r89.js";import"./chunk-1xgs9gd5.js";export{Et as buildCss,mc as extractClassNames,gc as fingerprintConfig,hc as generateCss,Xd as getCachedCSS,Gd as getCssServeAsset,f as injectCss,Zo as loadCssEngine,Qo as loadCssEngineConfig,an as rebuildCss,Kd as resetCssCache,fc as resolveUserCssConfig,yc as withLinkedModuleBundles};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import x from"fs";import u from"path";import p from"fs";import w from"path";var y=["components","layouts","partials","emails"];function P(e){return e.split(/[\\/]/).filter(Boolean).slice(0,-1).some((a)=>y.includes(a))}function b(e){return P(e.replace(/^\//,""))}function zs(e,t){let a=e.filter((i)=>!b(i.pattern)),r=["// Auto-generated by STX - do not edit"];if(a.length===0)r.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{r.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let i of a){let c=[];for(let l of i.params){let d=i.pattern.includes(`:${l}?`)?"?":"";c.push(`${l}${d}: string`)}let s=c.join("; ");r.push(` '${i.pattern}': { ${s} }`)}r.push(" }","}","","export {}","")}let n=r.join(`
|
|
3
3
|
`),o=w.join(t,"route-types.d.ts");try{if(p.existsSync(o)&&p.readFileSync(o,"utf8")===n)return;p.mkdirSync(t,{recursive:!0}),p.writeFileSync(o,n)}catch{}}function Hs(e,t,a){let r=process.cwd(),n=w.relative(r,a),o=e.filter((c)=>!b(c.pattern)),i=["// Auto-generated by stx \u2014 do not edit",`// Source: ${n||"pages"}/`,"","export const routes = ["];for(let c of o){let s=w.relative(r,c.filePath).replace(/\\/g,"/"),l=JSON.stringify(c.params),d=c.layout?`, layout: '${w.relative(r,c.layout).replace(/\\/g,"/")}'`:"";i.push(` { pattern: '${c.pattern}', filePath: '${s}', isDynamic: ${c.isDynamic}, params: ${l}${d} },`)}i.push("] as const",""),i.push("export type RouteName = typeof routes[number]['pattern']",""),p.mkdirSync(t,{recursive:!0}),p.writeFileSync(w.join(t,"routes.ts"),i.join(`
|
|
4
|
-
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function tt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function J(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function kn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function ur(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return J(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Cn{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:H,params:M}=J(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:H,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");zs(this.routes,s),Hs(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function pr(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function fr(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Uc(e){k=e.replace(/\/$/,"")}function Vc(e,t,a={}){f[e]={path:t,name:e,params:a}}function Wc(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function En(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function qc(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import U from"path";function Gc(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Kc(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Xc(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Vi(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function Wi(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function qi(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Us(e,t){v.set(e,t)}function Gi(e){return v.get(e)}function Jc(e){return v.has(e)}function nt(){v.clear()}function rt(){return Array.from(v.keys())}async function st(e,t="middleware"){let a=U.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Us(o,s);else if(typeof s==="function")Us(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function ot(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function it(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Vi(a,i):Wi(),storage:qi(),state:{},request:a,responseHeaders:i}}async function at(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Gi(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function gr(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Ce(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||gr(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
|
|
4
|
+
`))}import I from"path";var N=Object.freeze(["ico","png","jpg","jpeg","gif","webp","avif","svg","bmp","tif","tiff","heic","css","js","mjs","cjs","map","wasm","webmanifest","json","xml","txt","rss","atom","woff","woff2","ttf","otf","eot","mp3","mp4","m4a","m4v","mov","webm","ogg","ogv","oga","wav","flac","avi","mkv","pdf","csv","doc","docx","xls","xlsx","ppt","pptx","rtf","odt","zip","gz","tgz","tar","rar","7z","bz2","xz","php","phtml","asp","aspx","jsp","cgi","env","ini","yml","yaml","toml","sql","bak","old","swp","log","conf","cfg","exe","dmg","pkg","apk","ipa","msi","iso","bin","dll"]),D=N.flatMap((e)=>e===e.toUpperCase()?[e]:[e,e.toUpperCase()]).join("|"),G=new RegExp(`\\.(?:${D})$`),E=`(?![^/]*\\.(?:${D})$)`;function tt(e){let t=e,a=t.search(/[?#]/);if(a!==-1)t=t.slice(0,a);let r=t.slice(t.lastIndexOf("/")+1);return r.length>0&&G.test(r)}function R(e,t){let r=I.relative(t,e).replace(/\.(stx|md)$/,"");if(r=r.split(I.sep).join("/"),r==="index")return"/";if(r.endsWith("/index"))r=r.slice(0,-6);return r=r.replace(/\[\[([^\]]+)\]\]/g,":$1?"),r=r.replace(/\[([^\]]+)\]/g,":$1"),r=r.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${r}`}function J(e,t={}){let a=t.page?E:"",r=[],n="",o=0;while(o<e.length){let i=e.slice(o),c=/^\/:([^/?*]+)\?/.exec(i);if(c){r.push(c[1]);let d=o+c[0].length===e.length;n+=`(?:/${d?a:""}([^/]+))?`,o+=c[0].length;continue}let s=/^:([^/?*]+)\*/.exec(i);if(s){r.push(s[1]),n+="(.+)",o+=s[0].length;continue}let l=/^:([^/?*]+)/.exec(i);if(l){r.push(l[1]);let d=o+l[0].length===e.length;n+=`${d?a:""}([^/]+)`,o+=l[0].length;continue}n+=e[o].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),o+=1}return{regex:new RegExp(`^${n}$`),params:r}}function kn(e,t){let a=e===""?"/":e;for(let r of t){let n=a.match(r.regex);if(n){let o={};return r.params.forEach((i,c)=>{o[i]=n[c+1]}),{route:r,params:o}}}return null}function pr(e,t={}){let a=e.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return J(a,t)}import j from"fs";import L from"path";function _(e,t){let a=[],r=L.dirname(e);while(r.startsWith(t)||r===t){let n=L.join(r,"_layout.stx");if(j.existsSync(n))a.unshift(n);if(r===t)break;r=L.dirname(r)}return a}function B(e,t){let a=[];if(!x.existsSync(e))return a;let r=x.readdirSync(e,{withFileTypes:!0});for(let n of r){let o=u.join(e,n.name);if(n.isDirectory()){if(n.name.startsWith("."))continue;if(y.includes(n.name))continue;a.push(...B(o,t))}else if(n.isFile()){let i=u.extname(n.name);if(t.includes(i)){if(n.name.startsWith("_")&&n.name!=="_layout.stx")continue;if(n.name==="_layout.stx")continue;a.push(o)}}}return a}class Cn{routes;pagesDir;pagesDirs;config;constructor(e,t={}){this.config=t;let a=t.pagesDirs&&t.pagesDirs.length>0?t.pagesDirs:[t.pagesDir||"pages"];this.pagesDirs=a.map((s)=>u.resolve(e,s)),this.pagesDir=this.pagesDirs[0];let r=t.extensions||[".stx"],n=(s)=>{let l=u.resolve(e,s);try{return x.realpathSync(l)}catch{return l}},o=(t.exclude??[]).filter((s)=>typeof s==="string"&&s.trim()!=="").map(n),i=(s)=>{if(o.length===0)return!1;let l=n(s);return o.some((d)=>l===d||l.startsWith(`${d}${u.sep}`))},c=new Set;this.routes=[];for(let s of this.pagesDirs){let l=B(s,r).filter((h)=>!i(h)),d=new Map;for(let h of l){let g=R(h,s),m=t.pagesDirs?g.replace(/:[\w]+/g,":param"):g;if(t.pagesDirs&&d.has(m))throw Error(`Conflicting layer pages for ${g}: ${d.get(m)} and ${h}`);if(d.set(m,h),c.has(m))continue;c.add(m);let{regex:H,params:M}=J(g,{page:!0}),C=t.layouts!==!1?_(h,s):[];this.routes.push({pattern:g,regex:H,params:M,filePath:h,isDynamic:M.length>0,layout:C.length>0?C[C.length-1]:void 0})}}if(this.routes.sort((s,l)=>{if(!s.isDynamic&&l.isDynamic)return-1;if(s.isDynamic&&!l.isDynamic)return 1;let d=s.pattern.split("/").length,h=l.pattern.split("/").length;if(d!==h)return h-d;return s.pattern.localeCompare(l.pattern)}),t.emit!==!1){let s=u.resolve(e,t.stateDir||process.env.STX_DIR?.trim()||".stx");zs(this.routes,s),Hs(this.routes,s,this.pagesDir)}}match(e){let t=e===""?"/":e;for(let a of this.routes){let r=t.match(a.regex);if(r){let n={};return a.params.forEach((o,i)=>{n[o]=r[i+1]}),{route:a,params:n}}}return null}resolve(e,t){let a=this.routes.find((n)=>n.pattern===e||n.filePath.includes(e));if(!a)return"#not-found";let r=a.pattern;if(t)for(let[n,o]of Object.entries(t))r=r.replace(`:${n}`,encodeURIComponent(o));return r}addRoute(e){this.routes.push(e),this.routes.sort((t,a)=>{if(!t.isDynamic&&a.isDynamic)return-1;if(t.isDynamic&&!a.isDynamic)return 1;return t.pattern.localeCompare(a.pattern)})}getLayout(e){return e.layout??null}}function fr(e,t){let a=[`${t}.stx`,"error.stx"];for(let r of a){let n=u.join(e,r);if(x.existsSync(n))return n}return null}function gr(e,t){return e.map((a)=>{let r=u.relative(t,a.filePath),n=a.isDynamic?" (dynamic)":"";return`${a.pattern} \u2192 ${r}${n}`})}var f={},k="";function Vc(e){k=e.replace(/\/$/,"")}function Wc(e,t,a={}){f[e]={path:t,name:e,params:a}}function qc(e){for(let[t,a]of Object.entries(e))if(typeof a==="string")f[t]={path:a,name:t};else f[t]={...a,name:t}}function En(e,t={},a=!1){let r=f[e];if(!r)return console.warn(`Route [${e}] not defined.`),"#undefined-route";let n={...r.params,...t},o=r.path;o=o.replace(/:(\w+)/g,(c,s)=>{let l=n[s];if(l===void 0)return console.warn(`Missing parameter [${s}] for route [${e}].`),`:${s}`;return delete n[s],encodeURIComponent(String(l))});let i=Object.entries(n);if(i.length>0){let c=i.map(([s,l])=>`${encodeURIComponent(s)}=${encodeURIComponent(String(l))}`).join("&");o+=(o.includes("?")?"&":"?")+c}return a&&k?`${k}${o}`:o}function Gc(){for(let e of Object.keys(f))delete f[e];k=""}import F from"fs";import U from"path";function Kc(e,t={}){return{type:"redirect",path:e,options:{replace:t.replace??!1,external:t.external??!1,redirectCode:t.redirectCode??302}}}function Xc(e){return{type:"abort",error:typeof e==="string"?{statusCode:500,message:e}:e}}function Jc(e,t={}){return{handler:e,mode:t.mode??"universal"}}function O(e){let t={};if(!e)return t;let a=e.split(";");for(let r of a){let[n,...o]=r.split("=");if(n){let i=n.trim(),c=o.join("=").trim();if(i)t[i]=decodeURIComponent(c)}}return t}function S(e,t,a={}){let r=`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(a.expires){let n=typeof a.expires==="number"?new Date(Date.now()+a.expires*1000):a.expires;r+=`; Expires=${n.toUTCString()}`}if(a.path)r+=`; Path=${a.path}`;if(a.domain)r+=`; Domain=${a.domain}`;if(a.secure)r+="; Secure";if(a.httpOnly)r+="; HttpOnly";if(a.sameSite)r+=`; SameSite=${a.sameSite}`;return r}function Wi(e,t){let a=e.headers.get("cookie")||"",r=O(a);return{get(n){return r[n]},set(n,o,i={}){r[n]=o,t.append("Set-Cookie",S(n,o,i))},delete(n){delete r[n],t.append("Set-Cookie",S(n,"",{expires:new Date(0),path:"/"}))},getAll(){return{...r}}}}function qi(){return{get(e){if(typeof document>"u")return;return O(document.cookie)[e]},set(e,t,a={}){if(typeof document>"u")return;document.cookie=S(e,t,a)},delete(e){if(typeof document>"u")return;document.cookie=S(e,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return O(document.cookie)}}}function Gi(){let e=typeof window<"u"&&typeof window.localStorage<"u";return{get(t){if(!e)return null;try{return window.localStorage.getItem(t)}catch{return null}},set(t,a){if(!e)return;try{window.localStorage.setItem(t,a)}catch{}},remove(t){if(!e)return;try{window.localStorage.removeItem(t)}catch{}},isAvailable(){return e}}}var v=new Map;function Us(e,t){v.set(e,t)}function Ki(e){return v.get(e)}function Yc(e){return v.has(e)}function nt(){v.clear()}function rt(){return Array.from(v.keys())}async function st(e,t="middleware"){let a=U.resolve(e,t);if(!F.existsSync(a))return;let r=F.readdirSync(a);for(let n of r){if(!n.endsWith(".ts")&&!n.endsWith(".js"))continue;if(n.includes(".test.")||n.includes(".spec."))continue;let o=n.replace(/\.(ts|js)$/,""),i=U.join(a,n);try{let s=(await import(i)).default;if(s&&typeof s.handler==="function")Us(o,s);else if(typeof s==="function")Us(o,{handler:s,mode:"universal"})}catch(c){console.warn(`Failed to load middleware '${o}' from ${i}:`,c)}}}function K(e){let t={};if(!e)return t;let a=new URLSearchParams(e);for(let[r,n]of a)t[r]=n;return t}function ot(e,t,a,r=""){return{path:e,params:t,query:K(r),fullPath:r?`${e}?${r}`:e,meta:a}}function it(e,t,a,r){let n=r?.isServer??typeof window>"u",o=!n,i=new Headers;return{to:e,from:t,isClient:o,isServer:n,cookies:n&&a?Wi(a,i):qi(),storage:Gi(),state:{},request:a,responseHeaders:i}}async function at(e,t){let a=Array.isArray(e)?e:[e],r=t.isServer;for(let n of a){let o=Ki(n);if(!o)return console.error(`Route middleware '${n}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${n}' is not registered`}},state:t.state,responseHeaders:t.responseHeaders};if(o.mode==="server"&&!r)continue;try{let i=await o.handler(t);if(i){if(i.type==="redirect")return{passed:!1,redirect:i,state:t.state,responseHeaders:t.responseHeaders};if(i.type==="abort")return{passed:!1,abort:i,state:t.state,responseHeaders:t.responseHeaders}}}catch(i){return console.error(`Error in middleware '${n}':`,i),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:i instanceof Error?i.message:"Middleware error"}},state:t.state,responseHeaders:t.responseHeaders}}}return{passed:!0,state:t.state,responseHeaders:t.responseHeaders}}function mr(e){let a=e.replace(/\\/g,"/").split("/").filter(Boolean),r=a.lastIndexOf("layouts"),n=r>=0?a[r+1]:a.at(-1);if(!n)return"app";return n.replace(/\.stx$/i,"")||"app"}function Ce(e){let t=e.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),a=e.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),r=e.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),n=t?.[1]||r?.[1]||"";return{layout:n,group:a?.[1]||mr(n)}}var A,T;function W(e){let t=[],a="log(",r=0;while(r<e.length){let n=e.indexOf("log(",r);if(n===-1){t.push(e.slice(r));break}let o=n>0?e[n-1]:" ",i=/\bfunction\s+$/.test(e.slice(Math.max(0,n-16),n));if(/[\w$.]/.test(o)||i){t.push(e.slice(r,n+4)),r=n+4;continue}t.push(e.slice(r,n));let c=1,s=n+4;while(s<e.length&&c>0){let l=e[s];if(l==='"'||l==="'"||l==="`"){let d=l;s++;while(s<e.length&&e[s]!==d){if(e[s]==="\\")s++;s++}s++;continue}if(l==="(")c++;else if(l===")")c--;s++}t.push("0"),r=s}return t.join("")}function q(e,t=!1){try{return new Bun.Transpiler(t?{loader:"js",minify:{whitespace:!0,identifiers:!0}}:{loader:"js",minifyWhitespace:!0}).transformSync(e).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return e}}function X(){return`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
@@ -3897,4 +3897,4 @@ else {
|
|
|
3897
3897
|
|
|
3898
3898
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
3899
3899
|
})();
|
|
3900
|
-
`}function Ee(){if(A)return A;return A=q(W(X()),!0),A}function
|
|
3900
|
+
`}function Ee(){if(A)return A;return A=q(W(X()),!0),A}function Zc(){if(T)return T;return T=q(X()),T}export{zs,Hs,tt,J,kn,pr,Cn,fr,gr,Vc,Wc,qc,En,Gc,Kc,Xc,Jc,Wi,qi,Gi,Us,Ki,Yc,nt,rt,st,ot,it,at,mr,Ce,Ee,Zc};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function
|
|
2
|
+
var g=0;function p(){return`async-${++g}-${Date.now().toString(36)}`}function nd(e,t={},c){let o=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,i=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,n=e;return n=n.replace(o,(r,s,a,d)=>{let l=p(),y=u(s);return m(l,y,a.trim(),d.trim())}),n=n.replace(i,(r,s,a)=>{let d=p(),l=u(s);return m(d,l,a.trim(),'<div class="stx-async-error">Failed to load component</div>')}),n}function u(e){let t={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},c=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,o;while((o=c.exec(e))!==null){let i=o[1],n=o[2]||o[3],r=o[4],s=o[5];switch(i){case"component":t.component=n||s||"";break;case"timeout":t.timeout=r?parseInt(r,10):30000;break;case"delay":t.delay=r?parseInt(r,10):200;break;case"suspensible":t.suspensible=s==="true";break;case"retries":t.retries=r?parseInt(r,10):0;break;case"loadingComponent":t.loadingComponent=n||s;break;case"errorComponent":t.errorComponent=n||s;break}}return t}function m(e,t,c,o){let{component:i,timeout:n,delay:r,suspensible:s,retries:a}=t;return`
|
|
3
3
|
<div class="stx-async-component" data-async-id="${e}" data-component="${i}" data-status="pending">
|
|
4
4
|
<div class="stx-async-loading" data-async-loading="${e}">
|
|
5
5
|
${c}
|
|
@@ -226,7 +226,7 @@ catch (error) {
|
|
|
226
226
|
loadComponent();
|
|
227
227
|
})();
|
|
228
228
|
</script>
|
|
229
|
-
`}function
|
|
229
|
+
`}function rd(e){return{__asyncComponent:!0,...typeof e==="function"?{loader:e}:e}}function sd(e){return typeof e==="object"&&e!==null&&"__asyncComponent"in e&&e.__asyncComponent===!0}function od(){return`
|
|
230
230
|
/* STX Async Component Styles */
|
|
231
231
|
.stx-async-component {
|
|
232
232
|
position: relative;
|
|
@@ -300,7 +300,7 @@ catch (error) {
|
|
|
300
300
|
background-size: 200% 100%;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
`}function
|
|
303
|
+
`}function id(){return`
|
|
304
304
|
// STX Async Component Runtime
|
|
305
305
|
(function() {
|
|
306
306
|
if (typeof window === 'undefined') return;
|
|
@@ -355,4 +355,4 @@ catch (error) {
|
|
|
355
355
|
console.log('[stx] Async component runtime initialized');
|
|
356
356
|
})();
|
|
357
357
|
`}
|
|
358
|
-
export{
|
|
358
|
+
export{nd,rd,sd,od,id};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{G,n}from"./chunk-
|
|
2
|
+
import{G,n}from"./chunk-hmehxwzj.js";import p from"fs";import g from"path";import*as y from"readline";var e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m"},u={help:{description:"Show available commands",usage:"help [command]",handler:async(t,o)=>{if(t[0]&&u[t[0]]){let r=u[t[0]];console.log(`
|
|
3
3
|
${e.bold}${t[0]}${e.reset} - ${r.description}`),console.log(` Usage: ${e.cyan}${r.usage}${e.reset}
|
|
4
4
|
`)}else{console.log(`
|
|
5
5
|
${e.bold}Available Commands:${e.reset}
|
|
@@ -16,9 +16,9 @@ ${e.bold}Markdown:${e.reset}`),a.forEach((i)=>console.log(` ${e.blue}${i}${e.re
|
|
|
16
16
|
${e.bold}Other:${e.reset}`),d.forEach((i)=>console.log(` ${e.dim}${i}${e.reset}`));console.log()}},cat:{description:"Show file contents",usage:"cat <file>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file${e.reset}`);return}let r=g.resolve(o.cwd,t[0]);if(!await Bun.file(r).exists()){console.log(`${e.red}Error: File not found: ${r}${e.reset}`);return}let l=(await Bun.file(r).text()).split(`
|
|
17
17
|
`);console.log(),l.forEach((c,a)=>{let d=String(a+1).padStart(3," ");console.log(`${e.dim}${d}${e.reset} ${c}`)}),console.log()}},load:{description:"Load context from JSON file",usage:"load <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a JSON file${e.reset}`);return}let r=g.resolve(o.cwd,t[0]);if(!await Bun.file(r).exists()){console.log(`${e.red}Error: File not found: ${r}${e.reset}`);return}try{let s=await Bun.file(r).text(),l=JSON.parse(s);o.context={...o.context,...l},console.log(`${e.green}\u2713${e.reset} Loaded ${Object.keys(l).length} variables from ${t[0]}`)}catch(s){console.log(`${e.red}Error parsing JSON:${e.reset}`,s)}}},save:{description:"Save context to JSON file",usage:"save <file.json>",handler:async(t,o)=>{if(!t[0]){console.log(`${e.red}Error: Please specify a file name${e.reset}`);return}let r=g.resolve(o.cwd,t[0]);try{await Bun.write(r,JSON.stringify(o.context,null,2)),console.log(`${e.green}\u2713${e.reset} Context saved to ${t[0]}`)}catch(s){console.log(`${e.red}Error saving file:${e.reset}`,s)}}},history:{description:"Show command history",usage:"history [count]",handler:async(t,o)=>{let r=t[0]?Number.parseInt(t[0],10):20,s=o.history.slice(-r);if(s.length===0){console.log(`${e.dim}No history${e.reset}`);return}console.log(),s.forEach((l,c)=>{let a=String(o.history.length-s.length+c+1).padStart(3," ");console.log(`${e.dim}${a}${e.reset} ${l}`)}),console.log()}},exit:{description:"Exit interactive mode",usage:"exit",handler:async(t,o)=>{o.running=!1,console.log(`
|
|
18
18
|
${e.dim}Goodbye!${e.reset}
|
|
19
|
-
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let r=t.split(" "),s=r[0];if(r.length===1)return Object.keys(u).filter((l)=>l.startsWith(s));if(["render","cat","load","cd"].includes(s)){let l=r.slice(1).join(" "),c=g.dirname(l)||".",a=g.basename(l),d=g.resolve(o.cwd,c);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${s} ${c==="."?"":`${c}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(s)){let l=r[1]||"";return Object.keys(o.context).filter((c)=>c.startsWith(l)).map((c)=>`${s} ${c}`)}return[]}async function
|
|
19
|
+
`)}},quit:{description:"Exit interactive mode (alias for exit)",usage:"quit",handler:async(t,o)=>u.exit.handler(t,o)}};function h(t,o){let r=t.split(" "),s=r[0];if(r.length===1)return Object.keys(u).filter((l)=>l.startsWith(s));if(["render","cat","load","cd"].includes(s)){let l=r.slice(1).join(" "),c=g.dirname(l)||".",a=g.basename(l),d=g.resolve(o.cwd,c);if(p.existsSync(d)&&p.statSync(d).isDirectory())try{return p.readdirSync(d).filter((f)=>f.startsWith(a)).map((f)=>`${s} ${c==="."?"":`${c}/`}${f}`)}catch{return[]}}if(["unset","eval","set"].includes(s)){let l=r[1]||"";return Object.keys(o.context).filter((c)=>c.startsWith(l)).map((c)=>`${s} ${c}`)}return[]}async function rl(t={}){let o={context:t.context||{},cwd:t.cwd||process.cwd(),history:[],running:!0,lastResult:null},r=y.createInterface({input:process.stdin,output:process.stdout,completer:(l)=>[h(l,o),l],historySize:t.maxHistory||100});console.log(`
|
|
20
20
|
${e.bold}${e.blue}stx Interactive Mode${e.reset}
|
|
21
21
|
${e.dim}Type 'help' for available commands, 'exit' to quit${e.reset}
|
|
22
22
|
`);let s=()=>{let l=o.cwd.replace(process.env.HOME||"","~");r.question(`${e.cyan}stx${e.reset} ${e.dim}${l}${e.reset} ${e.green}>${e.reset} `,async(c)=>{let a=c.trim();if(!a){if(o.running)s();return}o.history.push(a);let d=a.match(/(?:[^\s"]|"[^"]*")+/g)||[],i=d[0]?.toLowerCase(),f=d.slice(1).map((m)=>m.replace(/^"|"$/g,""));if(i&&u[i])try{await u[i].handler(f,o)}catch(m){console.log(`${e.red}Error:${e.reset}`,m)}else if(i)if(a.includes("{{")||a.includes("}}"))try{let m=await G(a,o.context,"eval");console.log(`${e.green}\u2192${e.reset} ${m}`)}catch{console.log(`${e.red}Unknown command: ${i}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`)}else console.log(`${e.red}Unknown command: ${i}${e.reset}`),console.log(`${e.dim}Type 'help' for available commands${e.reset}`);if(o.running)s();else r.close()})};r.on("SIGINT",()=>{console.log(`
|
|
23
23
|
${e.dim}(Use 'exit' to quit)${e.reset}`),s()}),s()}
|
|
24
|
-
export{
|
|
24
|
+
export{rl};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{At}from"./chunk-
|
|
2
|
+
import{At}from"./chunk-j2erwdgt.js";import{Jo,ns,Z,Fe,Ct,x,He,Ue,Xn,d}from"./chunk-hmehxwzj.js";import{D}from"./chunk-3nk8cnrm.js";import v from"path";var j=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function F(t,n,e){let r={fullTag:e,content:n,attrs:t};if(/\bserver\b/.test(t))return{...r,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...r,type:"client"};if(j.test(n))return{...r,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...r,type:"client"};return{...r,type:"server"}}var H=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function co(t){let n=[],e=[],r=[],o=0;while(o<t.length){let s=t.indexOf("<",o);if(s===-1)break;let a=Fe(t,s);if(a>s){o=a;continue}let i=Z(t,s);if(i>s){let c=t.slice(s,i),u=H.exec(c);if(u){let l=F(u[1],u[2],c);switch(l.type){case"signals":n.push(l);break;case"client":e.push(l);break;case"server":r.push(l);break}}o=i;continue}o=s+(t.startsWith("<!--",s)?4:1)}return{signals:n,client:e,server:r}}var L=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function V(t){let n=[],e=/<!--[\s\S]*?(?:-->|$)|<(script|style|textarea|title|template)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,r;while((r=e.exec(t))!==null)n.push({start:r.index,end:r.index+r[0].length});return n}function P(t,n){return n.some((e)=>t>=e.start&&t<e.end)}function B(t){let n=(t||"").trim();if(!n)return null;if(/[\s>+~,:]/.test(n))return null;let e={},r=n,o=r.match(/^[a-z][\w-]*/i);if(o)e.tag=o[0].toLowerCase(),r=r.slice(o[0].length);while(r.length>0){let s=r.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(s){if(e.attr=s[1],s[3]!==void 0&&s[3]!=="")e.attrValue=s[3];r=r.slice(s[0].length);continue}let a=r.match(/^#([\w-]+)/);if(a){e.id=a[1],r=r.slice(a[0].length);continue}let i=r.match(/^\.([\w-]+)/);if(i){e.className=i[1],r=r.slice(i[0].length);continue}return null}if(!e.tag&&!e.attr&&!e.id&&!e.className)return null;return e}function q(t,n){if(n.attr){if(!(n.attrValue===void 0?new RegExp(`\\b${n.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${n.attr}\\s*=\\s*(["'])\\s*${n.attrValue}\\s*\\1`,"i")).test(t))return!1}if(n.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${n.id}\\s*\\1`,"i").test(t))return!1}if(n.className){let e=t.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!e)return!1;if(!e[2].split(/\s+/).includes(n.className))return!1}return!0}function T(t,n="main"){let e=B(n);if(!e)return null;let r=/<([a-z][\w-]*)\b([^>]*)>/gi,o=V(t),s;while((s=r.exec(t))!==null){if(P(s.index,o))continue;let a=s[1].toLowerCase(),i=s[2]||"";if(i.trimEnd().endsWith("/")||L.has(a))continue;if(e.tag&&e.tag!==a)continue;if(!q(i,e))continue;let c=s[0],u=s.index+c.length,l=new RegExp(`<(/?)${a}\\b([^>]*)>`,"gi");l.lastIndex=u;let f=1,p;while((p=l.exec(t))!==null){if(P(p.index,o))continue;let h=p[1]==="/";if(!h&&(p[2]||"").trimEnd().endsWith("/"))continue;if(f+=h?-1:1,f===0)return{openTag:c,openIndex:s.index,start:u,end:p.index,tagName:a}}return null}return null}var Pe="private, no-store";function lo(t){return t.replace(/&#(\d+);/g,(n,e)=>O(Number(e),n)).replace(/&#x([0-9a-f]+);/gi,(n,e)=>O(Number.parseInt(e,16),n)).replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function O(t,n){if(!Number.isInteger(t)||t<0||t>1114111)return n;try{return String.fromCodePoint(t)}catch{return n}}function re(t){return t.headers.get("X-STX-Router")==="true"}function z(t,n){if(!t)return n;return t.split(",").some((r)=>r.trim().toLowerCase()===n.toLowerCase())?t:`${t}, ${n}`}function _(t){return{Vary:z(t,"X-STX-Router")}}var G="stx-page-head:",U=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/,A={dev:null,prod:null};function W(){let t=D()?"dev":"prod",n=A[t];if(n!==null)return n;try{let e=import.meta.require("./chunk-6wpgxryt.js"),r=t==="dev"&&typeof e.getRouterScriptDev==="function"?e.getRouterScriptDev:e.getRouterScript;A[t]=`<script>${r()}</script>`}catch{A[t]=""}return A[t]}async function uo(t,n){if(n===!1)return null;if(n&&typeof n==="string"){let r=v.resolve(t,n);if(await Bun.file(r).exists())return r;return null}let e=v.join(t,"app.stx");if(await Bun.file(e).exists())return e;return null}async function Tr(t,n){try{let e=await Bun.file(t).text(),r=e,o=e.match(/<template\b[^>]*>([\s\S]*?)<\/template>/i);if(o)r=o[1].trim();let s=co(e),a=[...s.client.map((m)=>m.fullTag),...s.signals.map((m)=>m.fullTag)],i=[],c=/<style\b[^>]*>([\s\S]*?)<\/style>/gi,u;while((u=c.exec(e))!==null)i.push(u[0]);let l=r;for(let m of s.server)l=l.replace(m.fullTag,"");for(let m of s.client)l=l.replace(m.fullTag,"");l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let f="<!--__STX_PAGE_SLOT__-->";if(l=l.replace(/<slot\s*\/>/gi,f).replace(/<slot\s*>\s*<\/slot>/gi,f),!l.includes(f))return console.warn(`[stx] Shell ${t} has no <slot /> \u2014 pages won't be injected`),null;let{processDirectives:p,extractVariables:h,defaultConfig:S,loadStxConfig:b}=await import("./chunk-y83we135.js"),R=await b(),g={__filename:t,__dirname:v.dirname(t)};for(let m of a){let C=m.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(C&&!m.includes("client")&&!m.includes('type="module"'))await h(C[1],g,t)}let y=await p(l,g,t,{...S,...R,...n},new Set),w=y.indexOf(f);if(w===-1)return console.warn("[stx] Shell slot placeholder lost during processing"),null;return{beforeSlot:y.substring(0,w),afterSlot:y.substring(w+f.length),filePath:t,shellScripts:a,shellStyles:i}}catch(e){return console.error(`[stx] Error processing shell ${t}:`,e),null}}function In(t,n,e){let r,o="",s=n.match(U);if(s){n=n.replace(s[0],"");try{let l=Buffer.from(s[1],"base64").toString("utf8"),f=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(f)r=f[1].trim();o=l.replace(/<title[^>]*>[\s\S]*?<\/title>/i,"").trim()}catch{}}let a=e||r||"stx App",i=W(),c="<script>window.__stxRouterConfig={container:'[data-stx-content]'};</script>";return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -26,5 +26,5 @@ ${i}
|
|
|
26
26
|
`));if(o.length>0)S.push(o.join(`
|
|
27
27
|
`));if(f.length>0)S.push(f.join(`
|
|
28
28
|
`));return S.push(l),S.join(`
|
|
29
|
-
`)}function E(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function J(t){let n=t.headers.get("content-type")||"",e={},r=(o,s)=>{let a=e[o];if(a===void 0)e[o]=s;else if(Array.isArray(a))a.push(s);else e[o]=[a,s]};if(n.includes("multipart/form-data")){let o=await t.formData();for(let[s,a]of o.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[o,s]of new URLSearchParams(await t.text()).entries())r(o,s);return e}return e}function
|
|
30
|
-
export{co,Pe,lo,re,_,uo,
|
|
29
|
+
`)}function E(t,n,e={}){let r=`${encodeURIComponent(t)}=${encodeURIComponent(n)}`;if(e.maxAge!==void 0)r+=`; Max-Age=${e.maxAge}`;if(e.expires)r+=`; Expires=${e.expires.toUTCString()}`;if(e.path)r+=`; Path=${e.path}`;if(e.domain)r+=`; Domain=${e.domain}`;if(e.secure)r+="; Secure";if(e.httpOnly)r+="; HttpOnly";if(e.sameSite)r+=`; SameSite=${e.sameSite}`;return r}async function J(t){let n=t.headers.get("content-type")||"",e={},r=(o,s)=>{let a=e[o];if(a===void 0)e[o]=s;else if(Array.isArray(a))a.push(s);else e[o]=[a,s]};if(n.includes("multipart/form-data")){let o=await t.formData();for(let[s,a]of o.entries())if(typeof a==="string")r(s,a);return e}if(n.includes("application/x-www-form-urlencoded")){for(let[o,s]of new URLSearchParams(await t.text()).entries())r(o,s);return e}return e}function $r(t){if(!t)return!1;let n=t.toUpperCase();return n!=="GET"&&n!=="HEAD"}async function N(t,n={}){let e=n.request,r=n.method??e?.method;if(!e||!$r(r))return{ran:!1};if(typeof t.action!=="function")return{ran:!1};let o={};try{o=await J(e)}catch{}let s=await t.action({request:e,form:o,params:n.params??{},query:t.query??{},cookies:n.cookies??{}});if(s&&typeof s==="object"){let a=s,i=K(a.cookies),c=a.redirect;if(typeof c==="string"&&c)return{redirect:c,ran:!0,...i.length>0?{cookies:i}:{}};let{cookies:u,redirect:l,...f}=a;if(Object.assign(t,f),i.length>0)return{ran:!0,cookies:i}}return{ran:!0}}function K(t){if(!t||typeof t!=="object"||Array.isArray(t))return[];let n=[];for(let[e,r]of Object.entries(t)){if(!e)continue;if(typeof r==="string"){n.push(E(e,r));continue}if(r&&typeof r==="object"){let o=r;if(typeof o.value!=="string")continue;n.push(E(e,o.value,o))}}return n}function ho(t,n=[],e){let r=new Headers({Location:t,"Cache-Control":"no-store"});for(let o of n)r.append("Set-Cookie",o);for(let[o,s]of Object.entries(e??{}))if(o.toLowerCase()!=="location")r.set(o,s);return new Response(null,{status:303,headers:r})}import k from"fs";import I from"path";function fo(t,n,e){return{version:1,buildTime:new Date().toISOString(),routes:t,assets:n,outputDir:e}}function go(t,n){let e=I.join(n,"manifest.json");k.writeFileSync(e,JSON.stringify(t,null,2))}function mo(t){let n=I.join(t,"manifest.json");if(!k.existsSync(n))return null;try{let e=k.readFileSync(n,"utf-8"),r=JSON.parse(e);if(r.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${r.version}`),null;return r}catch(e){return console.warn("[stx] Failed to load manifest:",e),null}}async function Nt(t,n={}){let{html:e,context:r,redirect:o,cookies:s}=await Y(t,n),a=He(r),i=Ue(r);if(o)return{html:e,redirect:o,cookies:s,status:a,headers:i};let{extractStreamBoundaries:c}=await import("./chunk-1w11d6gq.js"),u=c(r),l=t.streamTemplates;if(l&&Object.keys(l).length>0){let{processDirectives:f}=await import("./chunk-6w8r81kh.js"),{defaultConfig:p}=await import("./chunk-qzs6q626.js"),h=r.streamBoundaries||{},S={...p,autoShell:!1},b=Object.keys(l).map((g)=>({id:g,render:async()=>{let y=typeof h[g]==="function"?await h[g]():void 0;return f(l[g],{...r,$boundary:y},t.sourceFile,S,new Set)}})),R=new Set(b.map((g)=>g.id));u=[...(u||[]).filter((g)=>!R.has(g.id)),...b]}return{html:e,boundaries:u&&u.length>0?u:void 0,cookies:s,status:a,headers:i}}async function Y(t,n){let e={__filename:t.sourceFile,__dirname:t.sourceFile.replace(/[/\\][^/\\]+$/,""),...n};if(!t.hasServerScripts&&!ns(t.html))return{html:t.html,context:e};for(let a of t.serverScriptContent)try{await d(a,e,t.sourceFile)}catch(i){if(n.__stx_strict_hydration)throw i;console.warn(`[stx] Server script error in ${t.sourceFile}:`,i)}let r=await N(e,{request:n.request,method:n.method,params:n.params??{},cookies:n.cookies??{}}),o=(a)=>{let i=a.replace(/<script\b[^>]*\bdata-stx-server-data\b[^>]*>[\s\S]*?<\/script>/gi,""),c=Xn(e);if(!c)return i;let u=i.indexOf("</head>");return u<0?c+i:i.slice(0,u)+c+i.slice(u)};if(r.redirect)return{html:t.html,context:e,redirect:r.redirect,cookies:r.cookies};if(!ns(t.html))return{html:o(t.html),context:e,cookies:r.cookies};let s=new Map;for(let[a,i]of Object.entries(t.placeholders))if(i.expression)try{let c=x(i.expression,e);if(i.type==="raw")s.set(a,c!==void 0&&c!==null?String(c):"");else s.set(a,c!==void 0&&c!==null?Ct(String(c)):"")}catch(c){if(n.__stx_strict_hydration)throw c;s.set(a,"")}return{html:o(Jo(t.html,s)),context:e,cookies:r.cookies}}
|
|
30
|
+
export{co,Pe,lo,re,_,uo,Tr,In,he,po,se,fo,go,mo,$r,ho,Nt};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{je,dc,Fd,zd,Hd,Ud,uc,pc,Vd,Wd,Yo,qd,sn,on,Un}from"./chunk-hmehxwzj.js";import"./chunk-1b50m7e7.js";import"./chunk-ec8k75ep.js";import"./chunk-dyreg5df.js";import"./chunk-q04fdq91.js";import"./chunk-e124cgb6.js";import"./chunk-jmvp99ay.js";import"./chunk-j2erwdgt.js";import"./chunk-a5kaw8sc.js";import"./chunk-6v1gwdbv.js";import"./chunk-r4199q6x.js";import"./chunk-kvmg6r89.js";import"./chunk-1xgs9gd5.js";export{Ud as __setSignalsGeneratorsForTest,je as cacheEngineFingerprint,on as cacheTemplate,sn as checkCache,qd as clearDevCaches,pc as getCachedRouterScript,uc as getCachedSignalsRuntime,Vd as getServeClientAsset,Yo as getServeModuleBundle,Un as hashFilePath,zd as invalidateFileCache,Hd as invalidateFileCacheByDir,Fd as readFileCached,Wd as registerServeModuleBundle,dc as templateCache};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{p,c}from"./chunk-a5kaw8sc.js";import{b}from"./chunk-hmehxwzj.js";function y(t,o){let i=1,r=o,e="<template",n="</template";while(r<t.length&&i>0){let s=t.indexOf("<",r);if(s===-1)break;if(r=s,t.startsWith(e,r)&&(r+e.length>=t.length||/[\s>\/]/.test(t[r+e.length]))){i++,r+=e.length;continue}if(t.startsWith(n,r)){let a=t.indexOf(">",r+n.length);if(a!==-1){if(i--,i===0)return a+1;r=a+1;continue}}r++}return i===0?r:-1}var w=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function x(t,o){let i=null;for(let r=o;r<t.length;r++){let e=t[r];if(i){if(e==="\\"){r++;continue}if(e===i)i=null;continue}if(e==='"'||e==="'"){i=e;continue}if(e===">")return r+1}return-1}function N(t,o,i){let r=o.toLowerCase(),e=1,n=i;while(n<t.length){let s=t.indexOf("<",n);if(s===-1)return-1;if(t.startsWith("<!--",s)){let g=t.indexOf("-->",s+4);n=g===-1?t.length:g+3;continue}let a=x(t,s+1);if(a===-1)return-1;let f=t.slice(s,a),u=f.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(u&&u[2].toLowerCase()===r){if(u[1]==="/"){if(e--,e===0)return a}else if(!/\/\s*>$/.test(f))e++}n=a}return-1}function A(t){let o=[],i=[],r=/\bslot\s*=\s*(?:"([^"]+)"|'([^']+)')/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[2].toLowerCase();if(f[1]==="/"){let l=i.lastIndexOf(u);if(l!==-1)i.splice(l);e=s;continue}let g=/\/\s*>$/.test(a),d=i.length===0?a.match(r):null;if(d){let l=d[1]||d[2],m=a.replace(r,"").replace(/\s+(?=\/?>$)/,"").replace(/\s{2,}/g," "),h=g||w.has(u)?-1:N(t,u,s);if(h===-1)o.push({start:n,end:s,slotName:l,element:m}),e=s;else o.push({start:n,end:h,slotName:l,element:m+t.slice(s,h)}),e=h;continue}if(!g&&!w.has(u)){if(i.push(u),u==="script"||u==="style"){let l=t.toLowerCase().indexOf(`</${u}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function O(t){let o=[],i=[],r=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,e=0;while(e<t.length){let n=t.indexOf("<",e);if(n===-1)break;if(t.startsWith("<!--",n)){let l=t.indexOf("-->",n+4);e=l===-1?t.length:l+3;continue}let s=x(t,n+1);if(s===-1)break;let a=t.slice(n,s),f=a.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!f){e=s;continue}let u=f[1]==="/",g=f[2].toLowerCase();if(u){let l=i.lastIndexOf(g);if(l!==-1)i.splice(l);e=s;continue}if(g==="template"&&i.length===0){let l=a.match(r);if(l){let m=y(t,s);if(m!==-1){let h=l[1]||l[2]||l[3];o.push({start:n,end:m,slotName:h,content:t.slice(s,m-11).trim(),propsBinding:l[4]||void 0}),e=m;continue}}}if(!/\/\s*>$/.test(a)&&!w.has(g)){if(i.push(g),g==="script"||g==="style"){let l=t.toLowerCase().indexOf(`</${g}>`,s);if(l!==-1){e=l;continue}}}e=s}return o}function pa(t){let o={default:"",named:new Map},i=t,r=O(t);for(let n of r)o.named.set(n.slotName,{name:n.slotName,content:n.content,propsBinding:n.propsBinding});r.sort((n,s)=>s.start-n.start);for(let n of r)i=i.slice(0,n.start)+i.slice(n.end);let e=A(i);for(let n of e){let s=o.named.get(n.slotName);if(s)s.content+=n.element;else o.named.set(n.slotName,{name:n.slotName,content:n.element})}for(let n=e.length-1;n>=0;n--){let s=e[n];i=i.slice(0,s.start)+i.slice(s.end)}return o.default=i.trim(),o}function _l(t){let o=t.match(/name\s*=\s*["']([^"']+)["']/),i=o?o[1]:"",r={},e=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,n;while((n=e.exec(t))!==null)r[n[1]]=n[2];let s=t.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),a=s?s[1].trim():"";return{name:i,props:r,defaultContent:a}}async function fa(t,o,i,r){if(!t)return i;let e=t.content;if(t.propsBinding&&Object.keys(o).length>0){let n=t.propsBinding.trim(),s={...r};if(n.startsWith("{")&&n.endsWith("}")){let a=n.slice(1,-1).split(",").map((f)=>f.trim()).filter(Boolean);for(let f of a){let[u,g]=f.split(":").map((l)=>l.trim()),d=g||u;if(o[u]!==void 0)s[d]=o[u]}}else s[n]=o;e=C(e,s)}return e}function C(t,o){return t.replace(/\{\{\s*([^}]+)\s*\}\}/g,(i,r)=>{try{let e=r.trim(),n=k(e,o);return b(String(n??""))}catch{return`{{ ${r} }}`}})}function k(t,o){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(t)){let r=t.split("."),e=o;for(let n of r)if(e&&typeof e==="object"&&n in e)e=e[n];else return;return e}let i=t.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(i){let[,r,e,n]=i,s=o[r],a=parseInt(n,10);if(typeof s==="number")switch(e){case"+":return s+a;case"-":return s-a;case"*":return s*a;case"/":return s/a}}try{if(!p(t))return;return c(t,Object.keys(o))(...Object.values(o))}catch{return}}async function ga(t,o,i){let r=t;r=await M(r,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(s,a,f,u)=>{let g=o.named.get(a),d=u?.trim()||"",l=f||"",m={},h=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,S;while((S=h.exec(l))!==null){let E=S[1],R=S[2];m[E]=k(R,i)}return await fa(g,m,d,i)});let n=/<slot\b((?:"[^"]*"|'[^']*'|[^>"'])*?)\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return r=r.replace(n,(s,a,f)=>{if(/\bname\s*=/.test(a||""))return s;let u=f?.trim()||"";return o.default||u}),r}async function M(t,o,i){let r=[],e=[];t.replace(o,(a,...f)=>{let u=f[f.length-2];return e.push({match:a,index:u}),r.push(i(a,...f.slice(0,-2))),a});let n=await Promise.all(r),s=t;for(let a=e.length-1;a>=0;a--){let{match:f,index:u}=e[a];s=s.slice(0,u)+n[a]+s.slice(u+f.length)}return s}function Tl(t){let o=pa(t);return{defaultSlot:o.default,namedSlots:o.named}}async function $l(t,o,i,r){return await ga(t,{default:o,named:i},r)}
|
|
3
|
+
export{pa,_l,fa,ga,Tl,$l};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function
|
|
3
|
-
export{
|
|
2
|
+
function c(i){if(!i.startsWith("/")||/[?#\\]/.test(i))throw Error(`Invalid route rule pattern: ${i}`);let t=i==="/"?[]:i.slice(1).split("/");if(t.some((r,e)=>!r||r.includes("*")&&r!=="*"&&r!=="**"||r==="**"&&e!==t.length-1||r.startsWith(":")&&!/^:[\w]+$/.test(r)))throw Error(`Unsupported route rule pattern: ${i}`);return t}function Rr(i){for(let[t,r]of Object.entries(i)){if(c(t),!r||typeof r!=="object"||Object.keys(r).some((e)=>e!=="rendering"&&e!=="cache"))throw Error(`Unsupported route rule for ${t}`);if(r.rendering!==void 0&&r.rendering!=="prerender"&&r.rendering!=="dynamic")throw Error(`Unsupported rendering mode for ${t}`);if(r.cache!==void 0&&r.cache!==!1){let e=r.cache;if(!e||e.public!==!0||Object.keys(e).some((n)=>!["public","maxAge","swr"].includes(n))||!Number.isFinite(e.maxAge)||e.maxAge<=0||e.swr!==void 0&&(!Number.isFinite(e.swr)||e.swr<0))throw Error(`Route cache for ${t} requires public: true, maxAge > 0 and swr >= 0`);if(r.rendering==="prerender")throw Error(`Prerendered route ${t} cannot revalidate; use dynamic rendering with cache`)}}}function Lt(i={}){Rr(i);let t=(e)=>e==="**"?0:e==="*"?1:e.startsWith(":")?2:3,r=Object.entries(i).map(([e,n])=>({pattern:e,parts:c(e),rule:n}));return r.sort((e,n)=>{for(let o=0;o<Math.max(e.parts.length,n.parts.length);o++){let s=(n.parts[o]===void 0?4:t(n.parts[o]))-(e.parts[o]===void 0?4:t(e.parts[o]));if(s)return s}return e.pattern.localeCompare(n.pattern)}),(e)=>{let n=e==="/"?[]:e.replace(/\/$/,"").slice(1).split("/");return r.find(({parts:o})=>o.every((s,u)=>s==="**"||n[u]!==void 0&&(s==="*"||s.startsWith(":")||s===n[u]))&&(o.at(-1)==="**"||o.length===n.length))?.rule??{}}}
|
|
3
|
+
export{Rr,Lt};
|