@stacksjs/stx 0.2.800 → 0.2.802
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-gzfvj15b.js → chunk-06hc6rs6.js} +1 -1
- package/dist/{chunk-rq5s1hc6.js → chunk-077dwzpp.js} +1 -1
- package/dist/{chunk-fes0t0js.js → chunk-0vztrb90.js} +32 -32
- package/dist/chunk-1338vj5g.js +2 -0
- package/dist/chunk-14qhn86r.js +2 -0
- package/dist/{chunk-kydgndkt.js → chunk-1pz11ez9.js} +1 -1
- package/dist/{chunk-szkmxk09.js → chunk-24x7s0x5.js} +3 -3
- package/dist/chunk-27p6cxa2.js +2 -0
- package/dist/chunk-2jwmtbsj.js +2 -0
- package/dist/{chunk-akcyaxwv.js → chunk-2vqpz4qv.js} +2 -2
- package/dist/{chunk-6c50nsgz.js → chunk-3dtp59r9.js} +1 -1
- package/dist/{chunk-95k6shcv.js → chunk-3j9zzpbd.js} +2 -2
- package/dist/{chunk-70j06zqt.js → chunk-3vfxn6g5.js} +1 -1
- package/dist/{chunk-rp9xzzmt.js → chunk-4gf3khd9.js} +2 -2
- package/dist/{chunk-s1eb3b3x.js → chunk-4q2fh4r4.js} +1 -1
- package/dist/{chunk-2ehn5r6d.js → chunk-50be1xy0.js} +1 -1
- package/dist/{chunk-48914p88.js → chunk-5hgghq24.js} +1 -1
- package/dist/chunk-6cgak0k1.js +2 -0
- package/dist/{chunk-et40w1wx.js → chunk-7j4tf0ba.js} +1 -1
- package/dist/{chunk-xa3xk823.js → chunk-7tkxshah.js} +8 -8
- package/dist/{chunk-jg4xvn1f.js → chunk-8fnhv8jq.js} +1 -1
- package/dist/{chunk-j0bbr6ee.js → chunk-8fvgsd9v.js} +3 -3
- package/dist/chunk-8hm4a8p2.js +2 -0
- package/dist/{chunk-2sgrapfw.js → chunk-9767yz39.js} +1 -1
- package/dist/{chunk-7z5ga45f.js → chunk-a0xxm3eh.js} +1 -1
- package/dist/{chunk-2yb1rwmy.js → chunk-a5byhf8f.js} +1 -1
- package/dist/{chunk-ssr3h26v.js → chunk-aj5na3d3.js} +1 -1
- package/dist/{chunk-9kadf7pv.js → chunk-antc6crh.js} +1 -1
- package/dist/chunk-b22yj5j5.js +2 -0
- package/dist/{chunk-dpctjkac.js → chunk-b29x9hsz.js} +1 -1
- package/dist/{chunk-sprgkk9j.js → chunk-bs02d6mm.js} +8 -8
- package/dist/{chunk-czsagff5.js → chunk-byatzyvf.js} +2 -2
- package/dist/chunk-bz3papjy.js +2 -0
- package/dist/{chunk-d47z4fky.js → chunk-c36bj74x.js} +1 -1
- package/dist/{chunk-04eq8yhz.js → chunk-casq5t61.js} +1 -1
- package/dist/{chunk-k3rcpnzm.js → chunk-cmnze7at.js} +2 -2
- package/dist/{chunk-8qhdbch9.js → chunk-cs38hg43.js} +8 -8
- package/dist/chunk-d3gncxq1.js +2 -0
- package/dist/{chunk-j2v9f2dk.js → chunk-dbbc84mj.js} +2 -2
- package/dist/{chunk-r32pqvpq.js → chunk-ddk34ppv.js} +5 -5
- package/dist/chunk-dwn8ye99.js +2 -0
- package/dist/{chunk-0gvrpg5x.js → chunk-dxemdr58.js} +41 -41
- package/dist/{chunk-xd8w1vf4.js → chunk-e1g3ns8y.js} +2 -2
- package/dist/{chunk-ysyh69a7.js → chunk-e5fszb5z.js} +1 -1
- package/dist/chunk-e88bsw36.js +2 -0
- package/dist/{chunk-ddhkhhc7.js → chunk-eayewa2s.js} +2 -2
- package/dist/{chunk-q3dsjk2b.js → chunk-esm9sdyf.js} +3 -3
- package/dist/chunk-ewhkvqce.js +72 -0
- package/dist/chunk-fq1dw4ph.js +3 -0
- package/dist/{chunk-2fkzsmcr.js → chunk-fsfj0s13.js} +6 -6
- package/dist/{chunk-qa358n74.js → chunk-fy6sdbak.js} +48 -48
- package/dist/{chunk-chgchzd9.js → chunk-g02jnsz5.js} +1 -1
- package/dist/chunk-g4sdthck.js +2 -0
- package/dist/chunk-gabw11g3.js +2 -0
- package/dist/{chunk-5h32se25.js → chunk-gk214p91.js} +2 -2
- package/dist/{chunk-dd1vqndp.js → chunk-gxrpf87x.js} +1 -1
- package/dist/{chunk-dwydz68f.js → chunk-h1dwth11.js} +1 -1
- package/dist/{chunk-4zv5vfv0.js → chunk-hzhsg5j7.js} +6 -6
- package/dist/chunk-j0jgc426.js +2 -0
- package/dist/{chunk-qkck7zx0.js → chunk-jdjv5x6q.js} +1 -1
- package/dist/chunk-jkn9garq.js +2 -0
- package/dist/chunk-jy9qmwpm.js +2 -0
- package/dist/chunk-krqj3cx9.js +2 -0
- package/dist/chunk-kzny87pz.js +2 -0
- package/dist/{chunk-p1d6hwty.js → chunk-kzt46v41.js} +1 -1
- package/dist/{chunk-8adf5x29.js → chunk-m0c64sna.js} +1 -1
- package/dist/{chunk-f4a6sbnt.js → chunk-m4w61tyq.js} +2 -2
- package/dist/{chunk-nm20k22y.js → chunk-md55r6zp.js} +1 -1
- package/dist/chunk-mv9k42dn.js +2 -0
- package/dist/{chunk-8ey61ppd.js → chunk-mz1kffvs.js} +2 -2
- package/dist/{chunk-33vr7x2t.js → chunk-n7arptzc.js} +3 -3
- package/dist/chunk-nhfksrce.js +3 -0
- package/dist/{chunk-cas0vn5m.js → chunk-ntwgk0tf.js} +1 -1
- package/dist/{chunk-7q0y6qg5.js → chunk-nya33asw.js} +3 -3
- package/dist/{chunk-83myk906.js → chunk-p4aaxpaw.js} +1 -1
- package/dist/{chunk-hcwjdpzv.js → chunk-p8wq37hd.js} +2 -2
- package/dist/{chunk-d5bhtsb5.js → chunk-pamtcna7.js} +1 -1
- package/dist/{chunk-gvnfb6s2.js → chunk-q7zwv88b.js} +2 -2
- package/dist/{chunk-aqf0kt1w.js → chunk-qx5jhe7h.js} +5 -5
- package/dist/{chunk-2yxva96k.js → chunk-r9e0r6jx.js} +2 -2
- package/dist/chunk-r9eyepbk.js +21 -0
- package/dist/{chunk-7tjw0mpm.js → chunk-rs0ejvjm.js} +1 -1
- package/dist/{chunk-t5vjt37c.js → chunk-rxhymzj8.js} +1 -1
- package/dist/{chunk-mb2d9spg.js → chunk-s81y1dw3.js} +4 -4
- package/dist/chunk-sfvdj9dj.js +2 -0
- package/dist/chunk-szma9dby.js +2 -0
- package/dist/{chunk-x8h81amr.js → chunk-t4j2rw91.js} +2 -2
- package/dist/chunk-txyyvtdp.js +2 -0
- package/dist/{chunk-8nsn1mkz.js → chunk-v18816jj.js} +8 -8
- package/dist/chunk-ved3r01r.js +420 -0
- package/dist/chunk-vxd3akt4.js +2 -0
- package/dist/{chunk-hp9e8nz6.js → chunk-we6jnjjp.js} +1 -1
- package/dist/{chunk-99jzhp6x.js → chunk-wes7vsze.js} +2 -2
- package/dist/chunk-wf6vjd41.js +2 -0
- package/dist/{chunk-ps9fcjyg.js → chunk-wghv9vr6.js} +1 -1
- package/dist/{chunk-w0zayhmg.js → chunk-wpendr22.js} +2 -2
- package/dist/{chunk-r1t4978q.js → chunk-wvnzq8w8.js} +3 -3
- package/dist/{chunk-qxt6hdat.js → chunk-wy0gghvh.js} +1 -1
- package/dist/{chunk-qph9n5vc.js → chunk-x0ttkvr7.js} +2 -2
- package/dist/chunk-xbvx8j82.js +2 -0
- package/dist/{chunk-e0vrayws.js → chunk-xndhzwdj.js} +5 -5
- package/dist/{chunk-dq87xd5c.js → chunk-xrvdef6x.js} +3 -3
- package/dist/{chunk-pfygdsms.js → chunk-yxsrerew.js} +1 -1
- package/dist/chunk-z0kx564w.js +2 -0
- package/dist/{chunk-y87whqd5.js → chunk-zwptpjjt.js} +16 -16
- package/dist/cli.js +13 -13
- package/dist/client-parameter-bindings.js +10 -6
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/inline-style.js +51 -28
- package/dist/native/runtime/craft-bridge.js +37 -4
- package/dist/performance-utils.d.ts +255 -115
- package/dist/pwa.js +2 -2
- package/dist/safe-evaluator.js +28 -3
- package/dist/signal-processing.js +20 -41
- package/dist/ssg.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-09vge2qv.js +0 -21
- package/dist/chunk-0h07bnrc.js +0 -2
- package/dist/chunk-0tbf7n5v.js +0 -2
- package/dist/chunk-2dmytnfq.js +0 -3
- package/dist/chunk-2f1kqrdc.js +0 -2
- package/dist/chunk-2g21c65w.js +0 -2
- package/dist/chunk-4q5y2b0z.js +0 -2
- package/dist/chunk-5fzvcr9v.js +0 -2
- package/dist/chunk-7m4eesp0.js +0 -2
- package/dist/chunk-b3b9tfpx.js +0 -2
- package/dist/chunk-baryfj93.js +0 -2
- package/dist/chunk-cn6cmy23.js +0 -2
- package/dist/chunk-eszpqrxy.js +0 -2
- package/dist/chunk-ex43dwnv.js +0 -431
- package/dist/chunk-f13yn6xw.js +0 -2
- package/dist/chunk-faqzszzs.js +0 -3
- package/dist/chunk-h2xrfjh8.js +0 -2
- package/dist/chunk-jfq3nwe0.js +0 -2
- package/dist/chunk-ktxatzbd.js +0 -2
- package/dist/chunk-m6a8mftb.js +0 -2
- package/dist/chunk-nq4d91zm.js +0 -2
- package/dist/chunk-q38vjqv2.js +0 -2
- package/dist/chunk-q78jxqnr.js +0 -2
- package/dist/chunk-qftr9bm2.js +0 -2
- package/dist/chunk-rp831mk8.js +0 -2
- package/dist/chunk-se44tmvx.js +0 -61
- package/dist/chunk-tmr6ey5s.js +0 -2
- package/dist/chunk-tq5mqv8d.js +0 -2
- package/dist/chunk-xqe2jt3f.js +0 -2
- package/dist/chunk-ys46rqxg.js +0 -2
- package/dist/chunk-zxm9hkqb.js +0 -2
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ze,xn,Ws,Si,N}from"./chunk-2vqpz4qv.js";import{vn}from"./chunk-casq5t61.js";import{Nr,k,ul,at,Ai,dl}from"./chunk-t65tn8ee.js";import{P}from"./chunk-r9e0r6jx.js";import{R,qs,u,f,jt,d,q,F,w,Js,_e,Ve,Ys}from"./chunk-ewhkvqce.js";import{r,ge}from"./chunk-b9d70mgr.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-wpendr22.js";import Qe from"path";import kt from"process";import{AsyncLocalStorage as Bo}from"async_hooks";var or=new Bo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function cr(e,t){return or.run(mn(e),t)}async function ar(e,t){let i=or.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let c=Promise.resolve().then(t).then((l)=>{let a=JSON.stringify(l,(v,E)=>{if(E===void 0||typeof E==="function"||typeof E==="symbol"||typeof E==="bigint"||typeof E==="number"&&!Number.isFinite(E))throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);if(E&&typeof E==="object"&&!Array.isArray(E)&&Object.getPrototypeOf(E)!==Object.prototype&&Object.getPrototypeOf(E)!==null)throw TypeError(`useServerData(${JSON.stringify(e)}) requires JSON-serializable data`);return E}),y=JSON.parse(a);return i.values.set(e,y),y}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,c),c}function Cr(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function H(e,t=!1){let i=r(e),n=[],c=new Set,l=0,a=0,y=i.length,v=()=>{if(l!==0)return;let E=i.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let I=E[2];if(!c.has(I))n.push(I),c.add(I);return}let A=i.slice(a).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(a).startsWith("const"))return;A[1].split(",").forEach((I)=>{let j=I.trim();if(!j)return;let Q=j.indexOf(":"),z=(Q>=0?j.slice(Q+1).trim():j).split(/[\s=]/)[0];if(z&&!c.has(z))n.push(z),c.add(z)});return}let D=i.slice(a).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(D){if(t&&i.slice(a).startsWith("const"))return;D[1].split(",").forEach((I)=>{let j=I.trim().replace(/^\.\.\./,"");if(!j)return;let Q=j.split(/[\s=]/)[0];if(Q&&!c.has(Q))n.push(Q),c.add(Q)});return}if(t)return;let B=i.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let I=B[1];if(!c.has(I))n.push(I),c.add(I);return}let M=i.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(M){let I=M[1];if(!c.has(I))n.push(I),c.add(I)}};while(a<y){if(i[a]==="{"){l++,a++;continue}if(i[a]==="}"){l--,a++;continue}if(l===0&&/[a-z]/i.test(i[a])&&(a===0||/\s|[;{}()]/.test(i[a-1])))v();a++}return n.join(", ")}function Is(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,t=H(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(H(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Os(e,t){let i=`{ ${Wo(e,t)} }`;return H(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import Cn from"fs";import Ae from"path";function V(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var lr=new Map;function yr(e,t=!0){let i=lr.get(e);if(t&&i)return i;let n=new Map,c=[Ae.join(e,"src"),Ae.join(e,"dist"),e];function l(a,y){if(y>6)return;let v;try{v=Cn.readdirSync(a,{withFileTypes:!0})}catch{return}for(let E of v){let A=Ae.join(a,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let D=E.name.slice(0,-4);if(!n.has(D))n.set(D,A);let B=D.toLowerCase();if(!n.has(B))n.set(B,A);let M=V(D);if(!n.has(M))n.set(M,A)}}}for(let a of c)if(l(a,0),n.size>0)break;if(t)lr.set(e,n);return n}function Ns(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=Ae.join(i,"node_modules",e);try{if(Cn.statSync(n).isDirectory())return n}catch{}let c=Ae.dirname(i);if(c===i)return null;i=c}}function Ms(e,t,i={}){return[Ae.resolve(Ae.dirname(t),`${e}.stx`),Ae.resolve(Ae.dirname(t),e),Ae.resolve(i.componentsDir||"components",`${e}.stx`),Ae.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function ur(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),n=V(t);return[t,i,n]}function oi(e,t){let[i,n,c]=ur(e);for(let l of[i,i.toLowerCase(),n,c]){let a=t?.__importedComponents?.get(l);if(a!==void 0)return a}}function*ii(e,t,i={},n){let c=ur(e);if(c[0].startsWith("./")||c[0].startsWith("../")){yield Ae.resolve(Ae.dirname(t),`${c[0]}.stx`);return}let l=[...new Set(c.map((v)=>`${v}.stx`))],a=i.projectRoot||process.cwd(),y=[...n?.__originalFilePath?[Ae.join(Ae.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],Ae.join(Ae.dirname(t),"components"),Ae.resolve(a,"src/components"),Ae.resolve(a,"components"),...import.meta.dir?[Ae.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield Ae.join(v,E);try{for(let E of Cn.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield Ae.join(v,E.name,A)}catch{}}}function fr(e,t,i={},n){let c=oi(e,n);if(c!==void 0)return c;for(let l of ii(e,t,i,n))try{if(Cn.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ds(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")||!n.has("alt")&&!n.has("decorative"))return!1;let c=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=c.get("alt"),a=c.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof a==="string"?!["false","0","off","no"].includes(a.trim().toLowerCase()):Boolean(a);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;return["fit","objectfit","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import Hn from"fs";import ce from"path";import ht from"path";import qt from"fs";var zo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function os(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return zo.has(e.toLowerCase())}var pr=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),dr={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Fo=new Set(["ctrl","alt","shift","meta"]),hr={left:0,middle:1,right:2};function gr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(Fo.has(n))t.systemKeys.push(n);else if(n in hr)t.mouse=n;else if(n in dr||/^[a-z]$/.test(n))t.keys.push(dr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let c=n.match(/debounce(?:\.(\d+))?/);t.debounce=c?.[1]?Number.parseInt(c[1],10):300}else if(n.startsWith("throttle")){let c=n.match(/throttle(?:\.(\d+))?/);t.throttle=c?.[1]?Number.parseInt(c[1],10):300}}return t}function $r(e,t=""){let i=[],n=0,c=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=c.exec(e))!==null){let[a,y,v]=l,E=l.index,A=E+a.length,D=`__stx_evt_${t}${n++}`,B=[],M=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,I;while((I=M.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!pr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:gr(z.slice(1)),elementId:D})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((I=j.exec(v))!==null){let[,Q,X]=I,z=Q.split("."),L=z[0];if(!pr.has(L))continue;B.push({attribute:`@${Q}`,event:L,handler:X,modifiers:gr(z.slice(1)),elementId:D})}if(B.length>0)i.push({originalTag:a,elementId:D,events:B,startIndex:E,endIndex:A})}return i}function Uo(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((c)=>`$event.key === '${c}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=hr[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function Vo(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function cs(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function Ho(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=Uo(e),c=Vo(cs(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(os(e.event,t))l.push("passive: true");let a=l.length>0?`, { ${l.join(", ")} }`:"",y=c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
|
+
(function() {
|
|
4
|
+
var $el = document.getElementById('${i}');
|
|
5
|
+
if (!$el) return;
|
|
6
|
+
// Run mounted handler immediately (DOM is ready)
|
|
7
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
8
|
+
if (scope && scope.__stx_execute) {
|
|
9
|
+
scope.__stx_execute('${y}', null, $el);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
__stx_runHandler('${y}', null, $el);
|
|
13
|
+
}
|
|
14
|
+
})();`;if(e.event==="unmounted")return`
|
|
15
|
+
(function() {
|
|
16
|
+
var $el = document.getElementById('${i}');
|
|
17
|
+
if (!$el) return;
|
|
18
|
+
// Set up MutationObserver to detect removal
|
|
19
|
+
var observer = new MutationObserver(function(mutations) {
|
|
20
|
+
for (var m of mutations) {
|
|
21
|
+
for (var node of m.removedNodes) {
|
|
22
|
+
if (node === $el || (node.contains && node.contains($el))) {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
25
|
+
if (scope && scope.__stx_execute) {
|
|
26
|
+
scope.__stx_execute('${y}', null, $el);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
__stx_runHandler('${y}', null, $el);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
37
|
+
// Store observer for cleanup
|
|
38
|
+
$el.__stx_unmount_observer = observer;
|
|
39
|
+
})();`;return`
|
|
40
|
+
(function() {
|
|
41
|
+
var $el = document.getElementById('${i}');
|
|
42
|
+
if (!$el) return;
|
|
43
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
44
|
+
$el.addEventListener('${e.event}', function($event) {
|
|
45
|
+
${n?n+";":""}
|
|
46
|
+
// Find the closest reactive scope and execute within its context
|
|
47
|
+
var scope = $el.closest('[data-stx-scope]');
|
|
48
|
+
if (scope && scope.__stx_execute) {
|
|
49
|
+
scope.__stx_execute('${y}', $event, $el);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
// Fallback for non-reactive context (entity-safe; decoded + run in memory)
|
|
53
|
+
__stx_runHandler('${y}', $event, $el);
|
|
54
|
+
}
|
|
55
|
+
}${a});
|
|
56
|
+
})();`}function ai(e){if(e.length===0)return"";return`
|
|
57
|
+
<script data-stx-events>
|
|
58
|
+
(function() {
|
|
59
|
+
'use strict';
|
|
60
|
+
|
|
61
|
+
// Utility functions
|
|
62
|
+
function __stx_debounce(fn, delay) {
|
|
63
|
+
var timeout;
|
|
64
|
+
return function() {
|
|
65
|
+
var args = arguments;
|
|
66
|
+
var ctx = this;
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function __stx_throttle(fn, delay) {
|
|
73
|
+
var last = 0;
|
|
74
|
+
return function() {
|
|
75
|
+
var now = Date.now();
|
|
76
|
+
if (now - last >= delay) {
|
|
77
|
+
last = now;
|
|
78
|
+
fn.apply(this, arguments);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
|
|
84
|
+
// so the surrounding script element can never contain raw markup, including
|
|
85
|
+
// its own closing tag; we decode it to JS only in memory here, then run it
|
|
86
|
+
// with $event/$el in scope.
|
|
87
|
+
//
|
|
88
|
+
// This comment must not spell that closing tag out. It used to, as an
|
|
89
|
+
// example, and a browser ends the script element at the FIRST one it sees \u2014
|
|
90
|
+
// so everything below this line, __stx_runHandler included, was emitted as
|
|
91
|
+
// page text and no listener was ever bound. The comment about escaping was
|
|
92
|
+
// the thing that needed escaping.
|
|
93
|
+
function __stx_runHandler(h, $event, $el) {
|
|
94
|
+
var code = h
|
|
95
|
+
.replace(/</g, '<')
|
|
96
|
+
.replace(/>/g, '>')
|
|
97
|
+
.replace(/"/g, '"')
|
|
98
|
+
.replace(/'/g, "'")
|
|
99
|
+
.replace(/'/g, "'")
|
|
100
|
+
.replace(/&/g, '&');
|
|
101
|
+
try {
|
|
102
|
+
// eslint-disable-next-line no-new-func
|
|
103
|
+
(new Function('$event', '$el', code)).call($el, $event, $el);
|
|
104
|
+
}
|
|
105
|
+
catch (e) {
|
|
106
|
+
if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Event listeners
|
|
111
|
+
${e.map(Ho).join(`
|
|
112
|
+
`)}
|
|
113
|
+
})();
|
|
114
|
+
</script>`}function Zo(e,t=""){let i=$r(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,c=[];for(let l=i.length-1;l>=0;l--){let a=i[l],y=a.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${a.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of a.events)E.elementId=v[1]}for(let v of a.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),D=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(A,""),y=y.replace(D,"")}n=n.slice(0,a.startIndex)+y+n.slice(a.endIndex),c.push(...a.events)}return{template:n,bindings:c}}function mr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Rc(e,t,i){if(dl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Zo(e,mr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],y}let n=$r(e,mr(t));if(n.length===0)return e;let c=e;for(let y=n.length-1;y>=0;y--){let v=n[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let D of v.events)D.elementId=A[1]}for(let A of v.events){let D=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${D}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${D}\\s*=\\s*'[^']*'`,"g");E=E.replace(B,""),E=E.replace(M,"")}c=c.slice(0,v.startIndex)+E+c.slice(v.endIndex)}let l=ai(n.flatMap((y)=>y.events)),a=c.lastIndexOf("</body>");if(a!==-1)c=c.slice(0,a)+l+`
|
|
115
|
+
`+c.slice(a);else c+=l;return c}function Rr(e,t){let i=new Set;for(let n of e.split(",")){let c=n.trim().replace(/^\.\.\./,"").trim();if(!c)continue;if(t){let l=c.lastIndexOf(":");if(l!==-1)c=c.slice(l+1).trim()}if(c=c.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(c))i.add(c)}return i}function Rt(e,t){let i=r(e),{depths:n,balanced:c}=ge(i),l=(y)=>!c||n[y]===0,a=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let y of i.matchAll(a)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Rr(y[1],!0).has(t))return!0;for(let y of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Rr(y[1],!1).has(t))return!0;return!1}var Tr=new R(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),ut=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Ar=["(","[","{"],Ir=[")","]","}"],Ko=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Xo(e){let t=r(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let c=n.index??0;i.push({text:n[0],start:c,end:c+n[0].length})}return{code:t,tokens:i}}function as(e){let t=Tr.get(e);if(t)return t;let{code:i,tokens:n}=Xo(e),c=new Map,l=[];for(let Q=0;Q<n.length;Q++){let X=n[Q].text;if(["(","[","{"].includes(X))l.push(Q);else if([")","]","}"].includes(X)){let z=l.at(-1);if(z!==void 0&&["()","[]","{}"].includes(n[z].text+X))l.pop(),c.set(z,Q),c.set(Q,z)}}function a(Q,X){let z=[],L=Q;for(let ee=Q;ee<X;ee++){if(["(","[","{"].includes(n[ee].text)&&(c.get(ee)??X)<X){ee=c.get(ee);continue}if(n[ee].text===",")z.push([L,ee]),L=ee+1}return z.push([L,X]),z}let y=[];function v(Q,X,z,L=!1){if(n[Q]?.text==="...")Q++;if(Q>=X)return;let ee=n[Q].text;if(ut.test(ee)){if(z.add(ee),z===D)y.push({name:ee,token:Q,functionScoped:L});return}if(ee!=="{"&&ee!=="[")return;let te=c.get(Q);if(te===void 0||te>=X)return;for(let[re,me]of a(Q+1,te)){let he=re;if(ee==="{")for(let le=re;le<me;le++){if(n[le].text===":"){he=le+1;break}if(n[le].text==="=")break;if(["(","[","{"].includes(n[le].text)&&c.has(le))le=c.get(le)}v(he,me,z,L)}}function E(Q,X){let z=new Set;for(let[L,ee]of a(Q,X))v(L,ee,z);return z}function A(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(["(","[","{"].includes(z)&&c.has(X)){X=c.get(X);continue}if([",",";",")","]","}"].includes(z))break}return n[Math.max(Q,X-1)]?.end??i.length}let D=new Set,B=[];for(let Q=0;Q<n.length;Q++)if(n[Q].text==="=>"){let X=Q-1,z=X,L;if(n[X]?.text===")"&&c.has(X))z=c.get(X),L=E(z+1,X);else if(n[X]&&ut.test(n[X].text))L=new Set([n[X].text]);else continue;let ee=Q+1,te=n[ee]?.text==="{"&&c.has(ee)?n[c.get(ee)].end:A(ee);B.push({start:n[z].start,end:te,bodyStart:n[ee]?.start??te,functionBody:!0,names:L})}else if(n[Q].text==="("&&c.has(Q)){let X=n[Q-1]?.text;if(!X||qo.has(X)||!ut.test(X)&&X!=="*"&&X!=="]")continue;let z=c.get(Q),L=z+1;if(n[L]?.text===":"){L++;while(L<n.length&&!["{","=>",";","="].includes(n[L].text))L++}if(n[L]?.text!=="{"||!c.has(L))continue;B.push({start:n[Q].start,end:n[c.get(L)].end,bodyStart:n[L].start,functionBody:X!=="catch",names:E(Q+1,z)})}function M(Q){let X=Q;for(;X<n.length;X++){let z=n[X].text;if(Ar.includes(z)&&c.has(X)){X=c.get(X);continue}if(z===";"||Ir.includes(z))break;let L=n[X-1];if(X>Q&&Ko.has(z)&&L.text!==".")break;if(X>Q&&/[\n\r]/.test(i.slice(L.end,n[X].start))&&(/^[\w$]+$/.test(L.text)||Ir.includes(L.text)||['"',"'","`"].includes(L.text))&&ut.test(z)&&!["in","of","instanceof"].includes(z))break}return X}let I=[];for(let Q=0;Q<n.length;Q++){if(n[Q].text!=="for")continue;let X=n[Q+1]?.text==="await"?Q+2:Q+1;if(n[X]?.text!=="("||!c.has(X))continue;let z=c.get(X),L=z+1,ee=n[L]?.text==="{"&&c.has(L)?c.get(L):M(L),te=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(L,ee-1)]?.end??i.length;I.push({headStart:X,headEnd:z,start:n[X].start,end:te})}for(let Q=0;Q<n.length;Q++){let X=n[Q].text,z=n[Q-1]?.text;if(z==="."||n[Q+1]?.text===":")continue;if(z==="as"||z==="<")continue;if(X==="const"||X==="let"||X==="var"){let L=M(Q+1),ee=Q+1,te=!1,re=!1,me=0;for(let he=Q+1;he<=L;he++){let le=n[he]?.text;if(he<L&&Ar.includes(le)&&c.has(he)&&c.get(he)<L){he=c.get(he);continue}if(he<L&&le===":"&&!re)te=!0;else if(he<L&&le==="="&&me===0)te=!1,re=!0;else if(he<L&&te&&le==="<")me++;else if(he<L&&te&&le===">"&&me>0)me--;else if(he===L||le===","&&me===0)v(ee,he,D,X==="var"),ee=he+1,te=!1,re=!1}}else if(X==="function"||X==="class"){let L=Q+1;if(n[L]?.text==="*")L++;if(n[L]&&ut.test(n[L].text)&&n[L].text!=="extends")D.add(n[L].text),y.push({name:n[L].text,token:L})}else if(X==="import"){let L=Q+1;if(n[L]?.text==="*"&&n[L+1]?.text==="as")L+=2;let ee=n[L]?.text;if(ee&&ut.test(ee)&&ee!=="type"&&n[L+1]?.text!=="("&&n[L+1]?.text!==".")D.add(ee),y.push({name:ee,token:L,file:!0});let te=n[L]?.text==="{"?L:n[L+1]?.text===","&&n[L+2]?.text==="{"?L+2:-1;if(te!==-1&&c.has(te)){let re=c.get(te);for(let[me,he]of a(te+1,re)){let le=he-1;while(le>=me&&!ut.test(n[le].text))le--;if(le>=me&&n[le].text!=="type")y.push({name:n[le].text,token:le,file:!0})}}}}let j={code:i,scopes:B,loops:I,declarations:D,sites:y,tokens:n,pairs:c};return Tr.set(e,j),j}function ls(e){let t=as(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((c)=>n>=c.start&&n<c.end&&c.names.has(i))}}function Tn(e){return new Set(as(e).declarations)}function Ie(e,t){let{scopes:i,loops:n,sites:c,tokens:l,pairs:a}=as(e),y=Array.from({length:l.length},()=>-1),v=[];for(let M=0;M<l.length;M++){y[M]=v.length?v[v.length-1]:-1;let I=l[M].text;if(I==="{"&&a.has(M))v.push(M);else if(I==="}"&&v.length&&a.get(M)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let M of c){if(!t.has(M.name))continue;E.add(M.token);let I=M.file?-1:y[M.token],j=I===-1?[0,Number.POSITIVE_INFINITY]:[l[I].start,l[a.get(I)].end];if(M.functionScoped){let X=l[M.token].start,z=i.filter((L)=>L.functionBody&&X>=L.bodyStart&&X<L.end).sort((L,ee)=>L.end-L.bodyStart-(ee.end-ee.bodyStart))[0];j=z?[z.bodyStart,z.end]:[0,Number.POSITIVE_INFINITY]}else if(!M.file){let X=n.filter((z)=>M.token>z.headStart&&M.token<z.headEnd).sort((z,L)=>z.headEnd-z.headStart-(L.headEnd-L.headStart))[0];if(X)j=[X.start,X.end]}let Q=A.get(M.name);if(Q)Q.push(j);else A.set(M.name,[j])}let D=new Set;for(let M=0;M<l.length;M++){if(l[M].text!=="import"||l[M-1]?.text===".")continue;let I=M+1;if(l[I]?.text==="type")I++;if(l[I]&&ut.test(l[I].text)&&l[I+1]?.text===",")I+=2;if(l[I]?.text==="{"&&a.has(I))for(let j=I+1;j<a.get(I);j++)D.add(j)}let B=new Set;for(let M=0;M<l.length;M++){let I=l[M].text;if(!t.has(I)||B.has(I)||E.has(M)||D.has(M))continue;let j=l[M-1]?.text;if(j==="#"||j==="."&&l[M-2]?.text!=="..")continue;if(l[M+1]?.text===":"&&(j==="{"||j===","))continue;let Q=l[M].start;if(A.get(I)?.some(([X,z])=>Q>=X&&Q<z))continue;if(i.some((X)=>Q>=X.start&&Q<X.end&&X.names.has(I)))continue;B.add(I)}return B}var Pe="0.2.802";var Or=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Go(){let e=globalThis;return e[Or]??=new Map,e[Or]}function o(e,t){let i=Go(),n=`${import.meta.url}\x00${e}`,c=i.get(n);if(c)return c;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var Yo=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Yo,"<\\/$1")}import Pr from"fs";var Dr=[];function b(e){let t=new R(e);return Dr.push(t),t}function Ac(){for(let e of Dr)e.clear()}function x(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function br(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Pr.statSync(i).mtimeMs})}catch{}return t}function Ls(e){for(let t of e)try{if(Pr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var xe=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var Qo=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function ec(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function tc(e,t){let i=t;while(!0){let n=ht.join(i,"node_modules",e,"package.json");if(qt.existsSync(n))return ht.dirname(n);let c=ht.dirname(i);if(c===i)return null;i=c}}function nc(e,t){if(!e||typeof e!=="object")return null;let i=(c)=>{if(typeof c==="string")return c;if(c&&typeof c==="object"){if(typeof c.import==="string")return c.import;if(typeof c.default==="string")return c.default;if(typeof c.import==="object")return i(c.import);if(typeof c.default==="object")return i(c.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let c of Object.keys(e)){let l=c.indexOf("*");if(l===-1)continue;let a=c.slice(0,l),y=c.slice(l+1);if(!t.startsWith(a)||!t.endsWith(y))continue;if(t.length<a.length+y.length)continue;if(!n||a.length>n.prefix.length)n={pattern:c,prefix:a,suffix:y}}if(n){let c=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",c)}return null}function sc(e,t){let i=ec(e);if(!i||!i.subpath)return null;let n=tc(i.pkg,t);if(!n)return null;let c;try{c=JSON.parse(qt.readFileSync(ht.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,a=nc(c.exports,l);if(!a)return null;let y=ht.resolve(n,a);return qt.existsSync(y)?y:null}function mi(e,t){let i=t.filePath?ht.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),c=new Set,l=[],a=[];return{code:e.replace(Qo,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:ht.resolve(i,E),!qt.existsSync(A))throw Error(`file not found: ${A}`)}else{let D=null;try{D=Bun.resolveSync(E,n)}catch{D=sc(E,n)}if(!D)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=D}}catch(D){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${D?.message||D}`),a.push(E),""}if(c.has(A))return"";c.add(A);try{let D=qt.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:D})}catch(D){console.warn(`[stx:vendor-css] could not read ${A}: ${D?.message||D}`),a.push(E)}return""}),styles:l,unresolved:a}}function rc(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function hi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${rc(t.source)}" data-stx-layer="vendor">
|
|
116
|
+
@layer vendor {
|
|
117
|
+
${t.contents}
|
|
118
|
+
}
|
|
119
|
+
</style>`).join(`
|
|
120
|
+
`)}
|
|
121
|
+
`}var og=k,Mr=b(256);function Nt(e){let t=x(e),i=Mr.get(t);if(!i)i=ic(e),Mr.set(t,i);return{code:i.code,imports:[...i.imports],models:[...i.models]}}function ic(e){let t=r(e),i=new Set;for(let y of e.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let v of y[1].split(",")){let E=v.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(E)i.add(E)}let n=Tn(t),c=xe.filter((y)=>{if(i.has(y)||n.has(y))return!1;return yi(t,y,!0)}),l=Wr(t).filter((y)=>!i.has(y)&&!n.has(y));if(c.length===0&&l.length===0)return{code:e,imports:c,models:l};return{code:`${[c.length>0?`import { ${c.join(", ")} } from '@stacksjs/browser'`:"",l.length>0?"import '@stacksjs/browser'":"",l.length>0?`const { ${l.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
122
|
+
`)}
|
|
123
|
+
${e}`,imports:c,models:l}}var oc=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function Wr(e){let t=new Set,i=ls(e),n=Tn(e),c=/(?<![\w$.])([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g;for(let l of i.code.matchAll(c)){let a=l[1];if(oc.has(a)||n.has(a)||a.length<3)continue;if(i.shadows(a,l.index??0))continue;t.add(a)}return Array.from(t)}function cc(e){return Tn(e)}var jr=b(128);function Kc(e){let t=x(e),i=jr.get(t);if(!i)i=ac(e),jr.set(t,i);return{code:i.code,stxImports:[...i.stxImports],browserImports:[...i.browserImports]}}function ac(e){let t=new Set,i=new Set,n=e;n=n.replace(/^[ \t]*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"][ \t]*;?[ \t]*$/gm,"// [type import stripped]");let c=new Set,l=/^[ \t]*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"][ \t]*;?[ \t]*$/gm,a;while((a=l.exec(e))!==null){let D=a[1],B=a[2];if(a[0].includes("import type"))continue;let M=[];for(let j of D.split(",")){let Q=j.trim();if(!Q||Q.startsWith("type "))continue;let X=Q.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!X)continue;let z=X[1],L=X[2]||z;if(c.add(z),c.add(L),B==="stx"||B==="@stacksjs/stx")t.add(z);else i.add(z);if(L!==z)M.push(`${L} = ${z}`)}let I=M.length>0?`var ${M.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";n=n.replace(a[0],I)}let y=cc(n);for(let D of og){if(c.has(D)||y.has(D))continue;if(yi(n,D,!0))t.add(D)}let v=r(n),E=new Set;for(let D of n.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let B of D[1].split(",")){let M=B.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let I of M){let j=I.trim();if(j)E.add(j)}}for(let D of xe){if(c.has(D)||y.has(D)||E.has(D))continue;if(yi(v,D))i.add(D)}let A=Wr(v);for(let D of A)if(!c.has(D)&&!y.has(D))i.add(D);return{code:n,stxImports:Array.from(t),browserImports:Array.from(i)}}function yi(e,t,i=!1){let n=ls(e);e=n.code;let c=new RegExp(`\\b${t.replace(/[$]/g,"\\$")}\\b`,"g");for(let l of e.matchAll(c)){let a=l.index??0;if(n.shadows(t,a))continue;let y=a+t.length,v=a-1;while(v>=0&&/\s/.test(e[v]))v--;if(e[v]==="."&&e.slice(Math.max(0,v-2),v+1)!=="...")continue;let E=y;while(E<e.length&&/\s/.test(e[E]))E++;if(e[E]===":"&&e[E+1]!==":"&&(e[v]==="{"||e[v]===","))continue;if(i&&!/^\s*(?:<[^>]*>)?\s*\(/.test(e.slice(y)))continue;if(lc(e,y))continue;return!0}return!1}function lc(e,t){let i=t;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;if(e[i]!=="(")return!1;let n=0;for(;i<e.length;i++){let c=e[i];if(c==="(")n++;else if(c===")"){if(n--,n===0)break}}if(n!==0)return!1;i++;while(i<e.length&&(e[i]===" "||e[i]==="\t"))i++;return e[i]==="{"}function Xc(e,t){let i=[];if(e.length>0)i.push(` var { ${e.join(", ")} } = window.stx || window;`);if(t.length>0)i.push(` var { ${t.join(", ")} } = window.StacksBrowser || {};`);if(i.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
|
|
124
|
+
${i.join(`
|
|
125
|
+
`)}
|
|
126
|
+
${uc(e,t)}`;return""}function Kh(e,t=[]){let{browserImports:i}=Kc(e),n=new Set(t);return Xc([],i.filter((c)=>!n.has(c)))}function uc(e,t){let i=[...e.map((n)=>`['${n}', typeof ${n}, 'stx']`),...t.map((n)=>`['${n}', typeof ${n}, '@stacksjs/browser']`)];if(i.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
127
|
+
[${i.join(", ")}].forEach(function (e) {
|
|
128
|
+
if (e[1] !== 'undefined') return;
|
|
129
|
+
console.error(
|
|
130
|
+
'[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
|
|
131
|
+
+ 'but the client runtime does not provide it. Either it is not exported to the browser, '
|
|
132
|
+
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
133
|
+
);
|
|
134
|
+
});
|
|
135
|
+
`}function De(e){let t=e.__stxClientPayload;if(t&&typeof t==="object"){let n={};for(let c in t){let l=t[c];if(typeof l==="function")continue;n[c]=l}return n.__stxDeclaredPayload=!0,n}let i={};for(let n in e){if(n.startsWith("__")||n.startsWith("$"))continue;let c=e[n];if(typeof c==="function")continue;i[n]=c}return i}var fc=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,Lr=new Set;function pc(e,t){let i=fc.test(e),n=t.length>32768;if(!i&&!n)return;if(Lr.has(e))return;if(Lr.add(e),i)console.warn(`[stx] server\u2192client bridge is publishing "${e}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(n)console.warn(`[stx] server\u2192client bridge is publishing ${(t.length/1024).toFixed(1)}KB under "${e}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function yn(e,t){if(!t)return"";let i=Ie(e,new Set(Object.keys(t))),n=t.__stxDeclaredPayload===!0,c=[],l=Object.entries(t).sort(([a],[y])=>a<y?-1:a>y?1:0);for(let[a,y]of l){if(!/^[A-Za-z_$][\w$]*$/.test(a))continue;if(a.startsWith("__")||a.startsWith("$"))continue;if(!n&&!i.has(a))continue;if(Rt(e,a)){if(n)console.warn(`[stx] defineClientPayload declares "${a}", but this client block also declares "${a}" at the top level, so the server value is not published (emitting it would be a duplicate binding). Rename the local, or drop "${a}" from defineClientPayload.`);continue}let v;try{v=JSON.stringify(y)}catch{continue}if(v===void 0)continue;pc(a,v),c.push(` var ${a} = ${v.replace(/</g,"\\u003c")};`)}if(c.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
136
|
+
${c.join(`
|
|
137
|
+
`)}
|
|
138
|
+
`}var dc={left:0,middle:1,right:2};function gc(e){let t=[];if(e.self)t.push("if ($event.target !== $el) return");for(let i of e.systemKeys)t.push(`if (!$event.${i}Key) return`);if(e.keys.length>0){let i=e.keys.map((n)=>`$event.key === '${n}'`).join(" || ");t.push(`if (!(${i})) return`)}if(e.mouse!==null){let i=dc[e.mouse];t.push(`if ($event.button !== ${i}) return`)}if(e.prevent)t.push("$event.preventDefault()");if(e.stop)t.push("$event.stopPropagation()");return t.join("; ")}function mc(e,t){let{elementId:i,event:n,modifiers:c}=e,l=cs(e.handler),a=gc(c),y=[];if(c.once)y.push("once: true");if(c.capture)y.push("capture: true");if(os(n,c))y.push("passive: true");let v=y.length>0?`, { ${y.join(", ")} }`:"",E="";if(a)E+=`${a}; `;let A=l.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),D=`var $emit = function(name, detail) {
|
|
139
|
+
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
140
|
+
};`;function B(M){if(/\$emit\s*\(/.test(M))return`${D}
|
|
141
|
+
${M}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
142
|
+
if (scope && scope.__stx_execute) {
|
|
143
|
+
scope.__stx_execute('${A}', $event, $el);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
${M}
|
|
147
|
+
}`}if(c.debounce!==null)return` ;(function() {
|
|
148
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
149
|
+
var $el = document.getElementById('${i}')
|
|
150
|
+
if (!$el) return
|
|
151
|
+
var __timer
|
|
152
|
+
$el.addEventListener('${n}', function($event) {
|
|
153
|
+
${a?a+"; ":""}clearTimeout(__timer)
|
|
154
|
+
__timer = setTimeout(function() { ${B(l)} }, ${c.debounce})
|
|
155
|
+
}${v})
|
|
156
|
+
})()`;if(c.throttle!==null)return` ;(function() {
|
|
157
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
158
|
+
var $el = document.getElementById('${i}')
|
|
159
|
+
if (!$el) return
|
|
160
|
+
var __last = 0
|
|
161
|
+
$el.addEventListener('${n}', function($event) {
|
|
162
|
+
${a?a+"; ":""}var __now = Date.now()
|
|
163
|
+
if (__now - __last >= ${c.throttle}) {
|
|
164
|
+
__last = __now
|
|
165
|
+
${B(l)}
|
|
166
|
+
}
|
|
167
|
+
}${v})
|
|
168
|
+
})()`;if(/\$emit\s*\(/.test(l))return` var $el = document.getElementById('${i}')
|
|
169
|
+
if ($el) $el.addEventListener('${n}', function($event) {
|
|
170
|
+
${E}${D}
|
|
171
|
+
${l}
|
|
172
|
+
}${v})`;return` var $el = document.getElementById('${i}')
|
|
173
|
+
if ($el) $el.addEventListener('${n}', function($event) {
|
|
174
|
+
${E}var scope = $el.closest('[data-stx-scope]');
|
|
175
|
+
if (scope && scope.__stx_execute) {
|
|
176
|
+
scope.__stx_execute('${A}', $event, $el);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
${l}
|
|
180
|
+
}
|
|
181
|
+
}${v})`}function hc(e){if(e.length===0)return"";return`
|
|
182
|
+
// STX: auto-generated event bindings
|
|
183
|
+
${e.map((i,n)=>mc(i,n)).join(`
|
|
184
|
+
`)}`}function Br(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),c=0,l=n.length,a=0;while(a<l){let y=n[a];if(y==="'"||y==='"'||y==="`"){let v=y;if(a++,v==="`"){let E=0;while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]==="`"&&E===0){a++;break}if(n[a]==="$"&&n[a+1]==="{"){E++,a+=2;continue}if(n[a]==="}"&&E>0){E--,a++;continue}a++}}else while(a<l){if(n[a]==="\\"){a+=2;continue}if(n[a]===v){a++;break}a++}continue}if(y==="/"&&n[a+1]==="/"){while(a<l&&n[a]!==`
|
|
185
|
+
`)a++;continue}if(y==="/"&&n[a+1]==="*"){a+=2;while(a<l-1&&!(n[a]==="*"&&n[a+1]==="/"))a++;a+=2;continue}if(y==="{"){c++,a++;continue}if(y==="}"){c--,a++;continue}if(c===0){let v=n.slice(a),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let B=E[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((B)=>{let M=B.trim(),I=M.indexOf(":"),j=I>=0?M.slice(I+1).trim().split(/[\s=]/)[0]:M.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!i.has(j))t.push(j),i.add(j)}),a+=A[0].length;continue}let D=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(D){let B=D[1];if(!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B);a+=D[0].length;continue}}a++}return t}var xc=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function bc(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(B){let M;while((M=i.exec(B))!==null){let I=M[0];if(!xc.has(I))t.add(I)}}let c=/\{\{([\s\S]*?)\}\}/g,l;while((l=c.exec(e))!==null)n(l[1]);let a=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=a.exec(e))!==null)n(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let D=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=D.exec(e))!==null)n(l[1]);return t}async function Le(e,t={}){let i=e,n="",c=!1,l=[],a=mi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=a.code;let y=hi(a.styles),v=Nt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-5hgghq24.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),c=!0;if(t.autoImports!==!1){let L=Kc(i);i=L.code,n=Xc(L.stxImports,L.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${yn(i,t.serverData)}${n}`,i=P(i),!c&&je(t.attrs||""))i=Be(i);let D=hc(t.eventBindings||[]),B=(t.attrs||"").trim(),M=/\btype\s*=\s*["']module["']/i.test(B),I=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(M){let L=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${I}${L?` ${L}`:""}`;return`${y}<script ${ee}>
|
|
186
|
+
${dn(`${n}${i}
|
|
187
|
+
${D}`)}
|
|
188
|
+
</script>`}let j=Ai(e),Q=/function __stx_setup_/.test(i),X=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function z(L){let ee=L.length>0?`
|
|
189
|
+
return ${Os(i,L)};`:"",te=JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`);return`${y}<script data-stx-scoped data-stx-run="always"${I}>
|
|
190
|
+
window.stx.mount(function() {
|
|
191
|
+
'use strict';
|
|
192
|
+
try {
|
|
193
|
+
${dn(`${n}${i}
|
|
194
|
+
${D}${ee}`)}
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(${te}, error);
|
|
197
|
+
return {};
|
|
198
|
+
}
|
|
199
|
+
})</script>`}if(!X&&!Q){if(j)return z(Br(e));if(t.templateContent){let L=Br(e);if(L.length>0){let ee=bc(t.templateContent);if(L.some((re)=>ee.has(re)))return z(L)}}}return`${y}<script data-stx-scoped data-stx-run="always"${I}>
|
|
200
|
+
;(function() {
|
|
201
|
+
'use strict';
|
|
202
|
+
try {
|
|
203
|
+
${dn(`${n}${i}
|
|
204
|
+
${D}`)}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error(${JSON.stringify(`[stx] client block failed${t.filePath?` (${t.filePath})`:""}; this block will not hydrate`)}, error);
|
|
207
|
+
}
|
|
208
|
+
})()</script>`}import{createHash as Ec}from"crypto";var An=/<script\b[^>]*>/iy,ds=/<\/script\s*>/ig,In=/<style\b[^>]*>/iy,gs=/<\/style\s*>/ig;function zr(e,t,i,n){i.lastIndex=t;let c=i.exec(e);if(!c||c.index!==t)return-1;n.lastIndex=i.lastIndex;let l=n.exec(e);if(!l)return-1;return l.index+l[0].length}function W(e,t){return zr(e,t,An,ds)}function pn(e,t){return zr(e,t,In,gs)}function Ne(e,t){if(!e.startsWith("<!--",t))return-1;let i=e.indexOf("-->",t+4);if(i===-1)return-1;return i+3}function Fr(e,t){if(e.startsWith("<!--",t)){let c=Ne(e,t);return c===-1?e.length:c}if(An.lastIndex=t,An.exec(e)?.index===t){ds.lastIndex=An.lastIndex;let c=ds.exec(e);return c?c.index+c[0].length:e.length}if(In.lastIndex=t,In.exec(e)?.index===t){gs.lastIndex=In.lastIndex;let c=gs.exec(e);return c?c.index+c[0].length:e.length}return-1}function S(e,t){let i=[],n=0,c=e.length,l=!1,a=null;while(n<c){let y=e[n];if(l){if(a){if(y===a)a=null}else if(y==='"'||y==="'")a=y;else if(y===">")l=!1;n++;continue}if(y!=="<"){let D=e.indexOf("<",n+1);if(D===-1)break;n=D;continue}let v=t(e,n);if(v>n){i.push({start:n,end:v,token:e.slice(n,v)}),n=v;continue}let E=Fr(e,n);if(E>n){n=E;continue}let A=e.charCodeAt(n+1);if(A>=65&&A<=90||A>=97&&A<=122)l=!0;n++}return i}function Ur(e){let t=0,i=0,n=0,c=!1,l=null;while(n<e.length){if(c){let D=e[n];if(l){if(D===l)l=null}else if(D==='"'||D==="'")l=D;else if(D===">")c=!1;n++;continue}let a=e.indexOf("<",n),y=a===-1?e.length:a;while(n<y){let D=e[n++];if(D==="{")t++;else if(D==="}")i++;if(t>=2&&i>=2)return!0}if(a===-1)break;let v=Fr(e,a);if(v>a){n=v;continue}let E=e.charCodeAt(a+1),A=E===47?e.charCodeAt(a+2):E;if(A>=65&&A<=90||A>=97&&A<=122)c=!0;n=a+1}return!1}function Pc(e,t){while(e.size>=t){let i=e.keys().next();if(i.done)return;e.delete(i.value)}}var yc=1024,_c=16777216,vt=new Map,us=0;function wc(e,t){vt.set(e,t),us+=e.length+t.output.length;for(let[i,n]of vt){if(us<=_c)break;vt.delete(i),us-=i.length+n.output.length}}function pe(e,t,i,n){let c=n!==void 0&&e.length>=yc,l=c?`${n}\x00${e}`:"";if(c){let A=vt.get(l);if(A)return vt.delete(l),vt.set(l,A),{output:A.output,tokens:A.tokens.slice()}}let a=S(e,t);if(a.length===0)return{output:e,tokens:[]};let y=a.map((A)=>A.token),v="",E=0;for(let A=0;A<a.length;A++){let D=a[A];v+=e.slice(E,D.start),v+=i(D.token,A),E=D.end}if(v+=e.slice(E),c)return wc(l,{output:v,tokens:y}),{output:v,tokens:y.slice()};return{output:v,tokens:y}}var Sc=1024,$c=16777216,Et=new Map,fs=0;function vc(e,t){Et.set(e,t),fs+=e.length+t.output.length;for(let[i,n]of Et){if(fs<=$c)break;Et.delete(i),fs-=i.length+n.output.length}}function ps(e,t,i){return{output:t,scripts:i,restore:(n)=>n===t?e:vr(n,i)}}function G(e){let t=e.length>=Sc;if(t){let c=Et.get(e);if(c)return Et.delete(e),Et.set(e,c),ps(e,c.output,c.scripts.slice())}let{output:i,tokens:n}=pe(e,W,(c,l)=>`\x00STX_SCRIPT_${l}\x00`);if(t)return vc(e,{output:i,scripts:n}),ps(e,i,n.slice());return ps(e,i,n)}function vr(e,t){if(t.length===0)return e;return e.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(i,n)=>t[+n]??"")}var On="__stx_component_client_factories";function Pn(e){let t=e[On];return t instanceof Map?t:null}function Vc(e){e[On]=new Map}function ms(e,t){let i=Pn(e);if(!i)return null;let n=Ec("sha256").update(t).digest("hex").slice(0,16),c=i.get(n);if(c)c.instances++;else i.set(n,{body:t,instances:1});return n}function Uc(e,t){let i=Pn(t);if(!i?.size)return e;let n=new Map;for(let[A,D]of i)if(D.instances===1)n.set(A,D.body);let c=[];if(n.size>0){let A=[...n.keys()].map((M)=>JSON.stringify(M).replace(/[$()*+.?[\\\]^{|}]/g,"\\$&")).join("|"),D=new RegExp(`window\\.__stxComponentFactories\\[(${A})\\]\\(("[^"]+")\\);`,"g"),B=D.exec(e);while(B!==null){let M=n.get(JSON.parse(B[1]));if(M!==void 0)c.push({start:B.index,end:B.index+B[0].length,replacement:`(${M})(${B[2]});`});B=D.exec(e)}}let l=[...i].filter(([,A])=>A.instances>1);if(l.length===0)return Vr(e,c);let y=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
209
|
+
(function() {
|
|
210
|
+
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
211
|
+
${l.map(([A,D])=>` try { factories[${JSON.stringify(A)}] = factories[${JSON.stringify(A)}] || ${D.body}; }
|
|
212
|
+
catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(A)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
|
|
213
|
+
`)}
|
|
214
|
+
})();
|
|
215
|
+
</script>`,v,E=/<(?:template\b|script\b(?=[^>]*\bdata-stx-scoped\b))/iy;return S(e,(A,D)=>{if(v===void 0){if(E.lastIndex=D,E.test(A))v=D}return-1}),c.push({start:v??0,end:v??0,replacement:`${y}
|
|
216
|
+
`}),Vr(e,c)}function Vr(e,t){if(t.length===0)return e;t.sort((l,a)=>l.start-a.start||l.end-a.end);let i=Array(t.length*2+1),n=0,c=0;for(let l of t)i[c++]=e.slice(n,l.start),i[c++]=l.replacement,n=l.end;return i[c]=e.slice(n),i.join("")}function Hr(e){let t=Pn(e),i=new Map;if(t)for(let[n,c]of t)i.set(n,c.instances);return i}function Zr(e,t){let i=Pn(e);if(!i)return[];let n=[];for(let[c,l]of i){let a=l.instances-(t.get(c)??0);if(a>0)n.push({body:l.body,count:a})}return n}function qr(e,t){for(let{body:i,count:n}of t)for(let c=0;c<n;c++)ms(e,i)}function ve(e,t,i=2){let n=0,c=null;for(let l=t+i;l<e.length;l++){let a=e[l];if(c){if(a==="\\"){l++;continue}if(a===c)c=null;continue}if(a==='"'||a==="'"||a==="`"){c=a;continue}if(a==="{"){n++;continue}if(a==="}"){if(n>0){n--;continue}let y=0;while(e[l+y]==="}")y++;if(y>=i)return l}}return-1}import ti from"fs";var Kr=0,hs=new Map;function Zc(){Kr=0,hs.clear()}function Dn(e,t){let i=Kr++,n=`<!--__STX_${e.toUpperCase()}_${i}__-->`;return hs.set(n,{type:e,expression:t}),n}function Qc(){let e={};for(let[t,i]of hs)e[t]={type:i.type,expression:i.expression};return e}function el(e,t){let i=e;for(let[n,c]of t)i=i.split(n).join(c);return i}function wi(e){return e.includes("<!--__STX_")}var kc=/@(?=[a-zA-Z_]\w*\s*\(|end[a-zA-Z]*\b|else(?:if)?\b|empty\b|case\b|default\b|break\b|continue\b|fallback\b)/g;function Cc(e){return Array.from({length:e},()=>"{").join("⁠")}function Xr(e){return e.replace(/\{{2,}/g,(t)=>Cc(t.length)).replace(/\{(?=!)/g,"{⁠").replace(kc,"@")}function xr(e,t,i=!1){let{openTag:n,tail:c}=i?Tc(e,t):ea(e).at(t);return na(c,n,i)}function Tc(e,t){let i="",n=0;for(let a=0;a<t;a++){if(!e.startsWith("{{",a))continue;let y=ve(e,a);if(y<0||y+2>t)break;i+=e.slice(n,a)+"x",a=y+1,n=y+2}i+=e.slice(n,t);let c=-1,l=null;for(let a=0;a<i.length;a++){let y=i[a];if(l){if(y===l)l=null;continue}if(y==='"'||y==="'"){l=y;continue}if(y===">"){c=-1;continue}if(y==="<")c=a}return{openTag:c,tail:c>=0?i.slice(c+1):i}}var Mn=null;function ea(e){if(Mn&&Mn.source===e)return Mn.scanner;let t=ta(e);return Mn={source:e,scanner:t},t}function ta(e){let t=0,i=-1,n=null,c=-1,l=(y,v)=>{let E=e[y];if(v.quote){if(E===v.quote)v.quote=null;return}if(v.openTag>=0){if(E==='"'||E==="'"){v.quote=E;return}if(E===">"){v.openTag=-1;return}}if(E==="<")v.openTag=y},a=(y,v)=>{if(v.openTag>=0||!e.startsWith("<!--",y))return-1;let E=e.indexOf("-->",y+4);return E<0?e.length:E+3};return{at(y){if(y<t)t=0,i=-1,n=null,c=-1;let v={openTag:i,quote:n},E=!1;while(t<y){if(c<0&&e.startsWith("{{",t)){let j=ve(e,t);if(j<0)c=t;else if(j+2<=y){t=j+2;continue}else break}let I=a(t,v);if(I>=0){if(I>y){E=!0;break}t=I;continue}l(t,v),t++}if(i=v.openTag,n=v.quote,E)return{openTag:-1,tail:""};let A=c>=0?c:t,D={openTag:i,quote:n};for(let I=t;I<y;I++){let j=a(I,D);if(j>=0){if(j>y)return{openTag:-1,tail:""};I=j-1;continue}l(I,D)}if(D.openTag<0)return{openTag:-1,tail:""};let B="",M=D.openTag+1;for(let I=M;I<Math.min(y,A);I++){if(!e.startsWith("{{",I))continue;let j=ve(e,I);B+=e.slice(M,I)+"x",I=j+1,M=j+2}return B+=e.slice(M,y),{openTag:D.openTag,tail:B}}}}function na(e,t,i){if(t<0&&!i)return null;if(t>=0&&/^\s*[!/?]/.test(e))return/^\s*\/?\s*$/.test(e)?{kind:"tag-name"}:null;if(t>=0&&/^\s*$/.test(e))return{kind:"tag-name"};let n=0;if(t>=0)while(n<e.length&&!/\s/.test(e[n]))n++;while(n<e.length){while(/\s/.test(e[n]??"")&&n<e.length)n++;let c=n;while(n<e.length&&!/[\s=/>]/.test(e[n]))n++;let l=e.slice(c,n);if(!l)break;while(n<e.length&&/\s/.test(e[n]))n++;if(e[n]!=="=")continue;n++;while(n<e.length&&/\s/.test(e[n]))n++;let a=e[n];if(a==='"'||a==="'"){let y=++n,v=e.indexOf(a,n);if(v===-1)return{kind:"attribute",name:l,quote:a,valuePrefix:e.slice(y)};n=v+1}else{let y=n;while(n<e.length&&!/\s/.test(e[n]))n++;if(n===e.length)return{kind:"attribute",name:l,quote:null,valuePrefix:e.slice(y)}}}return{kind:"tag"}}class oe extends Error{attribute;near;constructor(e,t){super(`Unsafe interpolation in ${e}: ${t}`);this.name="UnsafeInterpolationContextError",this.attribute=e}locate(e,t){if(this.near===void 0)this.near=e.slice(Math.max(0,t-160),t).replace(/\s+/g," ").trim(),this.message+=` (after: ${JSON.stringify(this.near)})`;return this}}var Jr="unsafe:";var sa=/^(?:javascript|vbscript|livescript|mocha|view-source):/,ra=/^data:(?:text\/html|text\/xml|application\/xhtml\+xml|application\/xml|image\/svg\+xml)/,ia=/^data:(?:text\/html|application\/xhtml\+xml)/,oa=new RegExp("[\\u0000-\\u0020\\u00A0\\u1680\\u2000-\\u200F\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]+","g");function ca(e){return e.replace(oa,"").toLowerCase()}function xs(e){let t=e.toLowerCase();if(new RegExp("^(?:href|xlink:href|action|formaction|ping|cite|manifest|data|to)$").test(t))return"navigable";if(new RegExp("^(?:src|srcset|poster|background)$").test(t))return"fetched";return null}function jn(e,t="navigable"){let i=ca(e);if(sa.test(i))return!0;return t==="navigable"?ra.test(i):ia.test(i)}function wr(e,t="navigable"){return jn(e,t)?"unsafe:"+e:e}function aa(e){let t=e.match(/(?:^|[\s"'`/])([A-Za-z][\w:-]*)\s*=\s*(["'])([^"']*)$/);if(!t)return null;if(t[3].trim()!=="")return null;return xs(t[1])}function Gr(e,t,i=256){if(t<=i)return e.slice(0,t);let n=e.slice(t-i,t),c=n.search(/[\s"'`/]/);return c===-1?"":n.slice(c)}function Yr(e,t,i=t){let n=aa(e);return n&&jn(t,n)?"unsafe:"+i:i}function At(e){let t=e.indexOf(" as ");if(t!==-1){let l=e.slice(0,t).trim(),a=e.slice(t+4).trim();return l&&a?{arrayExpr:l,itemVar:a}:null}let i=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(e);if(!i)return null;let n=i[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),c=i[2].trim();return n&&c?{arrayExpr:c,itemVar:n}:null}function Nn(e){let t=[],i=0,n="",c=0;for(let l=0;l<e.length;l++){let a=e[l];if(n){if(a==="\\")l++;else if(a===n)n="";continue}if(a==="'"||a==='"'||a==="`")n=a;else if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===","&&i===0)t.push(e.slice(c,l)),c=l+1}return t.push(e.slice(c)),t}function Qr(e,t){let i=0;for(let n=0;n<e.length;n++){let c=e[n];if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===t&&i===0)return n}return-1}function ei(e){let t=0;for(let i=0;i<e.length;i++){let n=e[i];if(n==="("||n==="["||n==="{")t++;else if((n===")"||n==="]"||n==="}")&&--t===0)return i}return-1}function xt(e,t){let i=e.trim().replace(/^\.\.\./,"").trim(),n=Qr(i,"=");if(n!==-1&&i[n+1]!==">")i=i.slice(0,n).trim();if(!i)return;if(i.startsWith("{")&&i.endsWith("}")){for(let c of Nn(i.slice(1,-1))){let l=c.trim();if(!l)continue;if(l.startsWith("...")){xt(l,t);continue}let a=Qr(l,":");xt(a===-1?l:l.slice(a+1),t)}return}if(i.startsWith("[")&&i.endsWith("]")){for(let c of Nn(i.slice(1,-1)))xt(c,t);return}if(/^[A-Z_$][\w$]*$/i.test(i))t.push(i)}function J(e){let t=e.trim(),i=[],n=0;for(let l=0;l<t.length;l++){let a=t[l];if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(n===0&&/\s/.test(a)){if(!/^\s+(?:in|of)\s/.exec(t.slice(l)))continue;let v=t.slice(0,l).trim();if(v.startsWith("(")&&ei(v)===v.length-1)v=v.slice(1,-1);for(let E of Nn(v))xt(E,i);if(i.length>0)return i;break}}let c=/^[\s\S]+?\s+as\s+([\s\S]+)$/.exec(t);if(c){let l=c[1].trim();if(l.startsWith("(")&&ei(l)===l.length-1)l=l.slice(1,-1);let a=/^([\w$]+)\s*=>\s*([\s\S]+)$/.exec(l);if(a)xt(a[2],i),xt(a[1],i);else for(let y of Nn(l))xt(y,i)}return i}function O(e,t){let i=t instanceof Set?t:new Set(t);if(i.size===0)return!1;let a=e.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"/g," ").replace(/`(?:[^`\\$]|\\.|\$(?!\{))*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:(?!:))/g,"$1$2");for(let y of a.match(/[a-zA-Z_$][\w$]*/g)||[])if(i.has(y))return!0;return!1}var Ln="__stx_client_loop_names";function rt(e){let t=e?.[Ln];return Array.isArray(t)?t:[]}function Bn(e){if(!e.includes("#")&&!e.includes("v-slot:")&&!e.includes("data-stx-slot-binding"))return[];let t=[],i=[],n=/<!--[\s\S]*?-->|<script\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/script\s*>|<style\b(?:"[^"]*"|'[^']*'|[^'">])*>[\s\S]*?<\/style\s*>|<\/?[a-z][\w:-]*\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi;for(let c of e.matchAll(n)){let l=c[0];if(/^<\/template\s*>$/i.test(l)){let a=i.pop();if(a)a.end=c.index}else if(/^<template\b/i.test(l)&&!/\/\s*>$/.test(l)){let y=[...l.slice(9).matchAll(/([^\s=/>]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)].find((A)=>/^(?:#[\w-]+|v-slot:[\w-]+|data-stx-slot-binding)$/i.test(A[1])),v=(y?.[2]??y?.[3])?.trim();if(v&&y?.[1]==="data-stx-slot-binding")try{v=decodeURIComponent(v)}catch{v=void 0}let E=v?{start:c.index+l.length,end:e.length,binding:v}:void 0;if(i.push(E),E)t.push(E)}}return t}var Xt={},ni=new Map;function la(e){let t=ni.get(e);if(!t){let i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=new RegExp(`:${i}(?!\\w)`,"g"),ni.set(e,t)}return t.lastIndex=0,t}var Us={uppercase:(e,t)=>e!==void 0&&e!==null?String(e).toUpperCase():"",lowercase:(e,t)=>e!==void 0&&e!==null?String(e).toLowerCase():"",capitalize:(e,t)=>{if(e===void 0||e===null)return"";let i=String(e);return i.charAt(0).toUpperCase()+i.slice(1)},number:(e,t,i=0)=>{if(e===void 0||e===null)return"";try{let n=Number(e);return Number.isNaN(n)?"":n.toFixed(Number.parseInt(String(i),10))}catch{return""}},fmt:(e,t,i="en-US")=>{if(e===void 0||e===null)return"";try{let n=Number(e);if(Number.isNaN(n))return String(e);return n.toLocaleString(i)}catch{return String(e)}},join:(e,t,i=",")=>{if(!Array.isArray(e))return"";return e.join(String(i))},escape:(e,t)=>{if(e===void 0||e===null)return"";return U(String(e))},translate:(e,t,i={})=>{if(!t||!t.__translations)return e;let n=t.__translations,c=t.__i18nConfig?.fallbackToKey??!0,l=String(e).split("."),a=n;for(let v of l){if(a===void 0||a===null)break;a=a[v]}if(a===void 0||a===null)return c?e:"";let y=String(a);return Object.entries(i).forEach(([v,E])=>{y=y.replace(la(v),()=>String(E))}),y},t:(e,t,i={})=>Us.translate(e,t,i),truncate:(e,t,i=50,n="...")=>{if(e===void 0||e===null)return"";let c=String(e);if(c.length<=i)return c;if(i<=n.length)return n.substring(0,i);return c.substring(0,i-n.length)+n},date:(e,t,i="short",n="en-US")=>{if(e===void 0||e===null)return"";try{let c=e instanceof Date?e:new Date(e);if(Number.isNaN(c.getTime()))return String(e);let l={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(i==="iso")return c.toISOString();return new Intl.DateTimeFormat(n,l[i]||l.short).format(c)}catch{return String(e)}},currency:(e,t,i="USD",n="en-US")=>{if(e===void 0||e===null)return"";try{let c=Number(e);if(Number.isNaN(c))return String(e);return new Intl.NumberFormat(n,{style:"currency",currency:i}).format(c)}catch{return String(e)}},pluralize:(e,t,i,n)=>{let c=Number(e);if(Number.isNaN(c))return i;let l=n||`${i}s`;return c===1?i:l},first:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[0];return String(e).charAt(0)},last:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return e.length===0?"":e[e.length-1];let i=String(e);return i.charAt(i.length-1)},length:(e,t)=>{if(e===void 0||e===null)return 0;if(Array.isArray(e)||typeof e==="string")return e.length;if(e instanceof Map||e instanceof Set)return e.size;if(typeof e==="object")return Object.keys(e).length;return 0},json:(e,t,i=!1)=>{if(e===void 0)return"undefined";if(e===null)return"null";try{return i?JSON.stringify(e,null,2):JSON.stringify(e)}catch{return String(e)}},default:(e,t,i="")=>e===void 0||e===null||e===""?i:e,reverse:(e,t)=>{if(e===void 0||e===null)return"";if(Array.isArray(e))return[...e].reverse();return String(e).split("").reverse().join("")},slice:(e,t,i=0,n)=>{if(e===void 0||e===null)return"";if(Array.isArray(e)||typeof e==="string")return e.slice(i,n);return e},replace:(e,t,i,n="")=>{if(e===void 0||e===null)return"";let c=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(e).replace(new RegExp(c,"g"),()=>n)},stripTags:(e,t)=>{if(e===void 0||e===null)return"";return String(e).replace(/<[^>]*>/g,"")},urlencode:(e,t)=>{if(e===void 0||e===null)return"";return encodeURIComponent(String(e))},abs:(e,t)=>{let i=Number(e);return Number.isNaN(i)?0:Math.abs(i)},round:(e,t,i=0)=>{let n=Number(e);if(Number.isNaN(n))return 0;let c=10**i;return Math.round(n*c)/c}};function gg(e,t){if(e in Us)console.warn(`Filter "${e}" already exists as a built-in filter. Custom filter will take precedence.`);Xt[e]=t}function Gh(e){for(let[t,i]of Object.entries(e))gg(t,i)}function mg(){return{...Us,...Xt}}function Jh(){for(let e of Object.keys(Xt))delete Xt[e]}function Mt(e,t,i=2){let n="{".repeat(i);if(!e.includes(n))return e;let c="",l=0;for(;;){let a=e.indexOf(n,l);if(a===-1)break;let y=ve(e,a,i);if(y===-1)break;c+=e.slice(l,a)+t(e.slice(a,y+i),e.slice(a+i,y),a),l=y+i}return l===0?e:c+e.slice(l)}function ua(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let c=xr(e,t);if(!c||c.kind!=="attribute"||c.quote===n)return!1;if(!/^(?::|@|x-|v-)/.test(c.name))return!1;let l=0;for(let a=0;a<c.valuePrefix.length;a++)if(c.valuePrefix[a]==="\\")a++;else if(c.valuePrefix[a]===n)l++;return l%2===1}function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function U(e){return Xr(p(e))}function fa(e){return e.replace(/ /g," ").replace(/\t/g,"	").replace(/\n/g," ").replace(/\r/g," ").replace(/\f/g,"").replace(/=/g,"=").replace(/`/g,"`")}function pa(e){return e.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\\([\dA-Fa-f]{1,6})\s?/g,(t,i)=>String.fromCodePoint(Number.parseInt(i,16))).replace(/\\([^\r\n])/g,"$1").replace(/[\u0000-\u0020]+/g,"").toLowerCase()}function da(e,t){let i=pa(e);if(/@import|expression\(|behavior:|-moz-binding|(?:image-set|cross-fade)\(/.test(i))throw new oe(t,"network-capable or executable CSS is not allowed in an escaped interpolation");let n=/url\(([^)]*)\)/g,c;while((c=n.exec(i))!==null){let l=c[1].replace(/^["']|["']$/g,""),a=l.startsWith("/")&&!l.startsWith("//")||l.startsWith("./")||l.startsWith("../")||l.startsWith("#"),y=/^data:image\/(?:avif|bmp|gif|jpeg|jpg|png|webp);base64,[a-z\d+/=]+$/i.test(l);if(!a&&!y)throw new oe(t,"CSS URLs must be local paths or base64 raster images")}}function Z(e,t,i,n=!1,c=0){try{return ga(e,t,i,n,c)}catch(l){if(l instanceof oe)l.locate(e,t);throw l}}function ga(e,t,i,n,c){let l=xr(e,t,n),a=U(i);if(!l)return a;if(l.kind==="tag-name"){if(!/^[A-Za-z][A-Za-z0-9:-]*$/.test(i))throw new oe("tag name","dynamic tag names may contain only letters, digits, colons, and hyphens");return i}if(l.kind==="tag"){let E=e.slice(t+c).trimStart(),A=i.trim();if(!E.startsWith("=")&&(A===""||/^(?!on)[A-Za-z_:][\w:.-]*(?:\s+(?!on)[A-Za-z_:][\w:.-]*)*$/.test(A)))return A;throw new oe("tag structure","only standalone boolean attributes may be interpolated into tag structure")}let y=l.name.toLowerCase();if(/^on[a-z]/.test(y))throw new oe(l.name,"native event-handler attributes execute JavaScript; use an @event binding instead");if(y==="srcdoc")a=U(a);if(y==="style")da(i,l.name);if(l.quote===null)a=fa(a);let v=xs(y);if(v&&l.valuePrefix.trim()===""&&jn(i,v))return Jr+a;return Yr(Gr(e,t),i,a)}function wn(e,t){let i=` ${e}="`;return Z(i,i.length,t,!0)}function Ei(e){return e.flatMap((t)=>{let i=t.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);return!i||/\bserver\b|\bsrc\s*=/.test(i[1])?[]:[i[2]]})}function Se(e,t){let{scripts:i}=G(e);for(let n of Ei(i)){if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useModel)\s*(?:<[^>]*>)?\s*\(/.test(n)||Jc.test(n))return!0;if(Nr(n,t))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(e))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(e))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(e))return!0;return!1}function hg(e){let t=[],i=/<([a-zA-Z][\w-]*)\b[^>]*?\s(?::for|x-for|@for)\s*=\s*(["'])([\s\S]*?)\2[^>]*>/g;for(let n=i.exec(e);n;n=i.exec(e)){let c=n[1].toLowerCase(),l=new Set(J(n[3]));if(l.size===0)continue;let a=n.index+n[0].length;if(n[0].endsWith("/>")){t.push({start:n.index,end:a,names:l});continue}let y=new RegExp(`<(/?)${c}\\b[^>]*?(/?)>`,"gi");y.lastIndex=a;let v=1,E=e.length;for(let A=y.exec(e);A;A=y.exec(e)){if(A[2]==="/")continue;if(v+=A[1]==="/"?-1:1,v===0){E=A.index+A[0].length;break}}t.push({start:n.index,end:E,names:l})}return t}function si(e,t,i){let n=r(i);for(let c of e){if(t<c.start||t>=c.end)continue;for(let l of c.names)if(new RegExp(`(?<![.#\\w$])${l.replace(/\$/g,"\\$")}(?![\\w$])`).test(n))return!0}return!1}function ri(e,t){let i=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","URL","URLSearchParams","Intl","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console","new","typeof","instanceof","in","void"],n=e.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),c="",l=!1,a=0;for(let E=0;E<n.length;E++){let A=n[E];if(!l&&A==="`"){l=!0,a=0;continue}if(l){if(A==="`"&&a===0){l=!1;continue}if(A==="$"&&n[E+1]==="{"){a++,E++,c+=" ";continue}if(A==="}"&&a>0){a--;continue}if(a>0){c+=A;continue}continue}c+=A}n=c;let y=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,v;while((v=y.exec(n))!==null){let E=v[1];if(!n.substring(0,v.index).trimEnd().endsWith(".")){if(!i.includes(E)&&!(E in t))return!1}}return!0}function ma(e,t){let i=r(e);for(let n of i.matchAll(/(?<![.\w$])([A-Z_$][\w$]*)\s*\(/gi))if(typeof t[n[1]]==="function")return!0;return!1}function ha(e,t){let i=t.__stx_serverDeclared;if(!i||i.size===0)return!1;let n=r(e);for(let c of i)if(new RegExp(`(?<![.#\\w$])${c}(?![\\w$])`).test(n))return!0;return!1}var xi=new Set;function _i(e){return/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(e.trim())}function xa(e,t,i){let n=i[0];if(n!=="'"&&n!=='"'&&n!=="`")return!1;let c=0;for(let l=e.lastIndexOf(`
|
|
217
|
+
`,t-1)+1;l<t;l++)if(e[l]==="\\")l++;else if(e[l]===n)c++;return c%2===1}function $i(e,t){let i=`${t??"<unknown>"}\x00${e}`;if(process.env.STX_DEBUG||!xi.has(i))xi.add(i),console.warn(`[stx] {{ ${e} }} in a <script> in ${t??"<unknown>"} has no server value, so it was emitted as undefined. A mustache left in JavaScript is a SyntaxError that takes the whole script down, so give the value a default in <script server>.`);return"undefined"}function vi(e,t,i){let n=e;return n=n.replace(/\{!!([\s\S]*?)!!\}/g,(c,l)=>{try{let a=T(l,t);if(a===void 0)return _i(l)?$i(l.trim(),i):c;return a===null?"":String(a)}catch{return c}}),n=Mt(n,(c,l,a)=>{let y=l.trim();if(xa(n,a,l))return c;if(/^__[A-Z_]+__$/.test(y))return c;try{let v=T(l,t);if(v===void 0)return _i(y)?$i(y,i):c;return JSON.stringify(v).replace(/</g,"\\u003c").replace(/@/g,"\\u0040").replace(/\{{2,}/g,(E)=>"\\u007b".repeat(E.length)).replace(/\{(?=!)/g,"\\u007b")}catch{return c}}),n}function yg(e,t){if(!e.includes("{"))return e;let i=e;return i=i.replace(/\{!!([\s\S]*?)!!\}/g,(n,c)=>{try{let l=T(c,t);if(l===void 0)return n;return l===null?"":String(l)}catch{return n}}),i=Mt(i,(n,c,l)=>{let a=c.trim();if(/^__[A-Z_]+__$/.test(a))return n;try{let y=T(c,t);if(y===void 0)return n;if(y===null)return"";let v=String(y);return Z(i,l,v,!0,n.length)}catch(y){if(y instanceof oe)throw y;return n}}),i}function Yh(e,t,i={}){let{output:n,scripts:c}=G(e),l=c.map((a)=>{let y=a.match(/^<script\b((?:[^>\"']|\"[^\"]*\"|'[^']*')*)>/i),v=a.search(/<\/script\s*>$/i);if(!y||v===-1)return a;let E=y[1],A=a.slice(y[0].length,v);if(/\bdata-raw\b/.test(E))return a;if(i.skipServer&&/\bserver\b/.test(E))return a;let B=`<script${yg(E,t)}>`;if(/\bsrc\s*=/.test(E)||/\btype\s*=\s*["']application\/json["']/.test(E))return B+A+a.slice(v);return B+vi(A,t)+a.slice(v)});return vr(n,l)}function _(e,t,i){let n=e,c=(I,j)=>{let Q=pn(I,j);if(Q===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(I.slice(j,Q))?-1:Q},l=(I,j,Q,X)=>{let z=Q.length,{output:L,tokens:ee}=pe(I,j,(te,re)=>X(z+re));return Q.push(...ee),L},a=[];n=l(n,c,a,(I)=>`<!--__STX_STYLE_${I}__-->`);let y=[];n=l(n,W,y,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`);let v=t?.__stx_signals_gate===!0||Se(e),E=new Set([...Array.isArray(t?.__stx_client_signal_names)?t.__stx_client_signal_names:[],...bi(Ei(y))]),A=new Set(Array.isArray(t?.__stx_preserved_client_expressions)?t.__stx_preserved_client_expressions:[]);n=Mt(n,(I,j,Q)=>{if(O(j,E))return I;try{let X=T(j,t,!1,(z)=>bs(z,I,i,e));return X!==void 0&&X!==null?String(X):""}catch(X){let z=X instanceof Error?X.message:String(X);return h("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${z}`,i,e,Q,I)}},3),n=n.replace(/\{!!([\s\S]*?)!!\}/g,(I,j,Q)=>{if(O(j,E))return I;try{let X=T(j,t,!1,(z)=>bs(z,I,i,e));if(X===void 0&&t.__stx_buildMode==="compile")return Dn("raw",j.trim());return X!==void 0&&X!==null?String(X):""}catch(X){if(t.__stx_buildMode==="compile")return Dn("raw",j.trim());let z=X instanceof Error?X.message:String(X);return h("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${z}`,i,e,Q,I)}}),n=l(n,W,y,(I)=>`<!--__STX_SCRIPT_EXPR_${I}__-->`),n=l(n,c,a,(I)=>`<!--__STX_STYLE_${I}__-->`);let D=v?hg(n):[],B=Bn(n).map((I)=>({...I,names:new Set(J(`${I.binding} in __slot`))})),M=new Set(rt(t));if(n=Mt(n,(I,j,Q)=>{let X=j.trim();if(ua(n,Q,j))return I;if(si(B,Q,X))return I;if(O(X,M))return I;if(D.length>0&&si(D,Q,X))return I;if(A.has(X))return I;let z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],L=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,te=X.match(L)?.[1],re=te&&((te in t)||z.includes(te)),me=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,he=X.match(me),le=he&&!z.includes(he[1])&&!(he[1]in t);if(/^__[A-Z_]+__$/.test(X))return"";if(O(X,E))return I;if(t.__stx_native_screen===!0&&ma(X,t))return I;let ke;try{let Re=T(j,t,!1,(Xe)=>{ke=Xe});if(v&&!ri(X,t))return I;if(ke)bs(ke,I,i,e);if(t.__stx_buildMode==="compile"&&!v&&(Re===void 0||ha(X,t)))return Dn("expr",X);if(Re===void 0||Re===null)return"";let He=String(Re);return Z(n,Q,He,!1,I.length)}catch(Re){if(Re instanceof oe)throw Re;if(v&&!ri(X,t))return I;if(le)return I;let He=Re instanceof Error?Re.message:String(Re);return h("Expression",`Error evaluating: {{ ${X} }}: ${He}`,i,e,Q,I)}}),y.length>0)n=n.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(I,j)=>y[Number(j)]??I);if(a.length>0)n=n.replace(/<!--__STX_STYLE_(\d+)__-->/g,(I,j)=>a[Number(j)]??I);return n}function bg(e,t,i){if(!t.trim())return e;let n=e,c=t.trim();while(c.length>0){let l=c.match(/^(\w+)/);if(!l)break;let a=l[1];c=c.substring(a.length).trim();let y=Xt[a]||Us[a];if(!y)throw Error(`Filter not found: ${a}. Available filters: ${Object.keys(mg()).join(", ")}`);let v=[];if(c.startsWith(":")){let E=c.match(/^:([^|\s]+)/);if(E){let A=E[1].trim();try{let D=Number(A);v=[Number.isNaN(D)?A:D]}catch{v=[A]}c=c.substring(E[0].length).trim()}}else if(c.startsWith("(")){let E=1,A=1;while(E>0&&A<c.length){if(c[A]==="(")E++;if(c[A]===")")E--;A++}if(E===0){let D=c.substring(1,A-1).trim();if(D)try{if(D.startsWith("{")&&D.endsWith("}"))v=[T(`(${D})`,i,!0)];else{let B=[],M="",I=null,j=0,Q=0,X=0,z=!1;for(let L=0;L<D.length;L++){let ee=D[L];if(z){M+=ee,z=!1;continue}if(ee==="\\"){M+=ee,z=!0;continue}if(I){if(M+=ee,ee===I)I=null;continue}if(ee==='"'||ee==="'"||ee==="`"){I=ee,M+=ee;continue}if(ee==="(")j++;else if(ee===")")j--;else if(ee==="[")Q++;else if(ee==="]")Q--;else if(ee==="{")X++;else if(ee==="}")X--;if(ee===","&&j===0&&Q===0&&X===0){B.push(M),M="";continue}M+=ee}if(M)B.push(M);v=B.map((L)=>{let ee=L.trim();return T(ee,i,!0)})}}catch{v=[D]}c=c.substring(A).trim()}}try{n=y(n,i,...v)}catch(E){let A=E instanceof Error?E.message:String(E);throw Error(`Error applying filter '${a}': ${A}`)}if(c.startsWith("|"))c=c.substring(1).trim();else break}return n}function ba(e){let t=!1,i="",n=0,c=0,l=0,a=!1;for(let y=0;y<e.length;y++){let v=e[y],E=e[y+1];if(t&&a){a=!1;continue}if(t&&v==="\\"){a=!0;continue}if(a=!1,(v==='"'||v==="'"||v==="`")&&!a){if(!t)t=!0,i=v;else if(v===i)t=!1,i="";continue}if(t&&i==="`"&&v==="$"&&E==="{"){let A=1;y+=2;while(y<e.length&&A>0){if(e[y]==="{")A++;else if(e[y]==="}")A--;if(A>0)y++}continue}if(t)continue;if(v==="(")n++;else if(v===")")n--;else if(v==="[")c++;else if(v==="]")c--;else if(v==="{")l++;else if(v==="}")l--;if(v==="|"&&n===0&&c===0&&l===0){if(E==="|"){y++;continue}if(E==="="){y++;continue}return y}}return-1}var Kt=new Set,ya=1000;function Zh(){Kt.clear()}function bs(e,t,i,n){if(!K())return;let c=`${i}\x00${e.expression}`;if(Kt.has(c))return;if(Kt.size>=ya)Kt.clear();Kt.add(c);let l=i,a=n;try{if(i&&ti.existsSync(i))a=ti.readFileSync(i,"utf8")}catch{}let y=a.indexOf(t);if(y>=0)l=`${i}:${a.slice(0,y).split(`
|
|
218
|
+
`).length}`;console.warn(`${l}: stx warning: ${t} rendered as an empty string. The safe evaluator rejected \`${e.expression}\` (${e.rule}). Compute the value in <script server> and interpolate the variable instead.`)}function T(e,t,i=!1,n){try{let c=e.trim(),l=ba(c);if(l>0){let y=c.substring(0,l).trim(),v=c.substring(l+1).trim(),E=T(y,t,!0,n);return bg(E,v,t)}let a=qs(c);if(a!==null){n?.({expression:c,rule:a});return}try{let y=Object.keys(t),v=Object.values(t);return d(c,y)(...v)}catch{return u(c,t)}}catch(c){if(c instanceof ReferenceError){let l=/(\b\w+)\s+is not defined/.exec(c.message);if(l){let a=l[1],y=_a(a,Object.keys(t));if(y&&y!==a)c.message=`${c.message} \u2014 did you mean '${y}'?`}}if(!i)console.error(`Error evaluating expression: ${e}`,c);throw c}}function _a(e,t){let i=null;for(let c of t){if(c===e)continue;let l=wa(e,c);if(i===null||l<i.dist)i={key:c,dist:l}}if(!i)return null;let n=Math.max(e.length,i.key.length);if(i.dist<=2||i.dist/n<=0.35)return i.key;return null}function wa(e,t){if(e===t)return 0;if(e.length===0)return t.length;if(t.length===0)return e.length;let[i,n]=e.length<t.length?[e,t]:[t,e],c=Array(i.length+1),l=Array(i.length+1);for(let a=0;a<=i.length;a++)c[a]=a;for(let a=1;a<=n.length;a++){l[0]=a;for(let y=1;y<=i.length;y++){let v=i[y-1]===n[a-1]?0:1;l[y]=Math.min(l[y-1]+1,c[y]+1,c[y-1]+v)}for(let y=0;y<=i.length;y++)c[y]=l[y]}return c[i.length]}function Qh(e){if(!e)return"";return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}import Sa from"process";function C(e="STX_PUBLIC_"){let t={},i={};for(let[n,c]of Object.entries(Sa.env)){if(!n.startsWith(e)||c===void 0)continue;t[`import.meta.env.${n}`]=JSON.stringify(c),i[n]=c}return t["import.meta.env"]=JSON.stringify(i),t}function ki(e,t=""){let i=`${e}${t}`,n=0;for(let c=0;c<i.length;c++){let l=i.charCodeAt(c);n=(n<<5)-n+l,n=n&n}return`stx-${Math.abs(n).toString(36)}`}function Ri(e,t,i={}){let{prefix:n="",preserveHost:c=!0,scopeKeyframes:l=!0,scopeCustomProperties:a=!1}=i;if(!e.trim())return"";let y=ys(e),v=[],E=new Map;if(l)for(let A of y){let D=A.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(D){let B=D[1],M=`${t}_${B}`;E.set(B,M)}}for(let A of y){let D=Ci(A,t,n,c,E,a);v.push(D)}return v.join(`
|
|
219
|
+
|
|
220
|
+
`)}function ys(e){let t=[],i=e.replace(/\/\*[\s\S]*?\*\//g,""),n=0,c="",l=!1,a="";for(let y=0;y<i.length;y++){let v=i[y];if(v==="@"&&n===0)l=!0;if(v==="{")n++;else if(v==="}"){if(n--,n===0){if(l){a+=v;let E=a.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(E){let[,A,D,B]=E;if(A==="keyframes")t.push({selector:`@keyframes ${D.trim()}`,declarations:B.trim()});else if(A==="media"||A==="supports"||A==="container"){let M=ys(B);t.push({selector:`@${A} ${D.trim()}`,declarations:M.map((I)=>`${I.selector} { ${I.declarations} }`).join(`
|
|
221
|
+
`)})}else t.push({selector:`@${A} ${D.trim()}`,declarations:B.trim()})}a="",l=!1}else if(c.trim()){c+=v;let E=c.match(/([^{]+)\{([^}]*)\}/);if(E)t.push({selector:E[1].trim(),declarations:E[2].trim()});c=""}continue}}if(l)a+=v;else c+=v}return t}function Ci(e,t,i,n,c,l){let{selector:a,declarations:y}=e;if(a.startsWith("@")){if(a.startsWith("@keyframes")){let A=a.replace("@keyframes ","").trim();return`@keyframes ${c.get(A)||A} { ${y} }`}if(a.startsWith("@media")||a.startsWith("@supports")||a.startsWith("@container")){let D=ys(`x { ${y} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>Ci(B,t,i,n,c,l)).join(`
|
|
222
|
+
`);return`${a} {
|
|
223
|
+
${D}
|
|
224
|
+
}`}return`${a} { ${y} }`}let v=$a(a,t,i,n),E=y;for(let[A,D]of c)E=E.replace(new RegExp(`\\b${A}\\b`,"g"),D);if(l)E=E.replace(/--([a-z-]+)/gi,`--${t}-$1`);return`${v} { ${E} }`}function $a(e,t,i,n){let c=e.split(",").map((a)=>a.trim()),l=[];for(let a of c){if(a.startsWith(":host")){if(n)l.push(a);else{let E=a.replace(/:host(\([^)]*\))?/,`.${t}$1`);l.push(E)}continue}if(a.includes("::slotted")){l.push(a);continue}if(a===":root"){l.push(`:root .${t}`);continue}let y=i?`${i} .${t}`:`.${t}`;l.push(`${y} ${a}`);let v=va(a,t);if(v)l.push(i?`${i} ${v}`:v)}return l.join(", ")}function va(e,t){let i=0,n=e.length;for(let v=0;v<e.length;v++){let E=e[v];if(E==="["||E==="(")i++;else if(E==="]"||E===")")i--;else if(i===0&&(E===" "||E===">"||E==="+"||E==="~")){n=v;break}}let c=e.slice(0,n),l=e.slice(n);if(!c)return"";let a=c.length,y=0;for(let v=0;v<c.length;v++){let E=c[v];if(E==="["||E==="(")y++;else if(E==="]"||E===")")y--;else if(i===0&&y===0&&E===":"){a=v;break}}return`${c.slice(0,a)}.${t}${c.slice(a)}${l}`}var Oi=String.raw`(?<![\w-])scoped(?![\w-])`,_s=/<style\s+([^>]*)>/gi,Ti=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,Pi=new RegExp(Oi,"i"),Ea=new RegExp(Oi,"gi"),ws=/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi;function ka(e){_s.lastIndex=0;let t=_s.exec(e);while(t!==null){if(Pi.test(t[1]))return!0;t=_s.exec(e)}return!1}function pi(e){let t=new Set,i=[];ws.lastIndex=0;let n=ws.exec(e);while(n!==null){let c=n[0].trim();if(t.has(c))i.push({start:n.index,end:n.index+n[0].length});else t.add(c);n=ws.exec(e)}return i}function fn(e){let t=pi(e);if(t.length===0)return e;let i=Array(t.length+1),n=0;for(let c=0;c<t.length;c++){let l=t[c];i[c]=e.slice(n,l.start),n=l.end}return i[t.length]=e.slice(n),i.join("")}function Bs(e,t){if(!ka(e))return{html:e,hasScoped:!1};let i=ki(t),n=`data-v-${i}`,c=e,l=!1;if(Ti.lastIndex=0,c=c.replace(Ti,(a,y,v)=>{if(!Pi.test(y))return a;l=!0;let E=Ra(v,n),A=y.replace(Ea,"").trim(),D=A?` ${A}`:"";return`<style data-stx-scoped="${i}"${D}>${E}</style>`}),!l)return{html:e,hasScoped:!1};return c=Ta(c,n),{html:c,hasScoped:!0}}function Ra(e,t){return Ri(e,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${t}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${t}]`)}var Ca=(e)=>`\x00stx-scope-mask-${e}\x00`,Ii=/\u0000stx-scope-mask-(\d+)\u0000/g;function Ta(e,t){let i=pe(e,(c,l)=>{let a=W(c,l);return a>l?a:pn(c,l)},(c,l)=>Ca(l)),n=Aa(i.output,t);return Ii.lastIndex=0,n.replace(Ii,(c,l)=>i.tokens[Number(l)])}function Aa(e,t){let i=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return e.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(n,c,l)=>{if(i.has(c.toLowerCase()))return n;if(n.includes(t))return n;if(c.toLowerCase()==="style"||c.toLowerCase()==="script")return n;if(l)return n.replace(`<${c}${l}`,`<${c} ${t}${l}`);if(n.endsWith("/>"))return`<${c} ${t} />`;return`<${c} ${t}>`})}var Jt=/<\/?template\b[^>]*>/gi,Ia=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function Oa(e){let t=e.replace(/^<template\b/i,"").replace(/>$/,"");return Ia.test(t)}function de(e){Jt.lastIndex=0;let t;while((t=Jt.exec(e))!==null){if(t[0].startsWith("</")||Oa(t[0]))continue;let i=t.index,n=Jt.lastIndex,c=1,l;while((l=Jt.exec(e))!==null)if(l[0].startsWith("</")){if(c--,c===0){let a=l.index;return{start:i,openEnd:n,closeStart:a,end:Jt.lastIndex,content:e.slice(n,a)}}}else c++;return null}return null}function zs(e,t){let i=e,n=/@json\s*\(/g,c;while((c=n.exec(i))!==null){let l=c.index,a=l+c[0].length-1,y=1,v=a+1,E=null,A=!1;while(v<i.length&&y>0){let L=i[v];if(A){A=!1,v++;continue}if(L==="\\"&&E){A=!0,v++;continue}if(E){if(L===E)E=null;v++;continue}if(L==='"'||L==="'"||L==="`"){E=L,v++;continue}if(L==="(")y++;else if(L===")"){if(y--,y===0)break}v++}if(y!==0)break;let D=i.substring(a+1,v).trim(),B=i.substring(l,v+1),M=-1,I=0,j=null,Q=!1;for(let L=0;L<D.length;L++){let ee=D[L];if(Q){Q=!1;continue}if(ee==="\\"&&j){Q=!0;continue}if(j){if(ee===j)j=null;continue}if(ee==='"'||ee==="'"||ee==="`"){j=ee;continue}if(ee==="("||ee==="["||ee==="{")I++;else if(ee===")"||ee==="]"||ee==="}")I--;if(ee===","&&I===0){M=L;break}}let X=M>=0?D.substring(0,M).trim():D,z=M>=0?D.substring(M+1).trim():void 0;try{let L=X.trim(),ee;if(f(L))ee=d(L,Object.keys(t))(...Object.values(t));else ee=void 0;let te;if(z==="true")te=JSON.stringify(ee,null,2);else te=JSON.stringify(ee);let re=te.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");i=i.substring(0,l)+re+i.substring(v+1),n.lastIndex=l+re.length}catch(L){F.log(L instanceof Error?L:Error(String(L)),{directive:"@json"},"error"),n.lastIndex=l+B.length}}return i}function Hs(e){return e.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Fc(e){let t=e,i=/@memo\s*\(/g,n,c=[];while((n=i.exec(t))!==null){let l=n.index,a=l+n[0].length,y=1,v=a;while(v<t.length&&y>0){if(t[v]==="(")y++;else if(t[v]===")")y--;v++}if(y!==0)continue;let E=t.slice(a,v-1).trim(),A=v,D=t.slice(A),B=D.indexOf("@endmemo");if(B===-1)continue;let M=D.slice(0,B),I=A+B+8,j=M.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),Q=j?j[0].length:0,X=M.slice(Q),z=M.match(/(\s*)$/),L=z?z[0].length:0,ee=X.slice(0,X.length-L),te=ee.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),re;if(te){let[me,he,le="",ke]=te,Re=`<${he}${le} data-stx-memo="${E}"${ke}>`;re=M.slice(0,Q)+Re+ee.slice(me.length)+M.slice(Q+ee.length)}else re=`${M.slice(0,Q)}<div data-stx-memo="${E}">${ee}</div>${M.slice(Q+ee.length)}`;c.push({start:l,end:I,replacement:re}),i.lastIndex=I}for(let l=c.length-1;l>=0;l--){let a=c[l];t=t.slice(0,a.start)+a.replacement+t.slice(a.end)}return t.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function fi(e){let t=e.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return t=t.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),t}function Ni(e,t){if(!/\bref\s*=/.test(e))return e;let i=/<\/?([a-zA-Z][\w-]*)\b(?:"[^"]*"|'[^']*'|[^'">])*>/y,n=S(e,(v,E)=>{i.lastIndex=E;let A=i.exec(v);if(!A||/^(?:script|style)$/i.test(A[1]))return-1;return i.lastIndex}),c=[],l=0,a=0,y=[];for(let{start:v,end:E,token:A}of n){let D=/^<\/?([\w-]+)/.exec(A)[1].toLowerCase();if(A.startsWith("</")){let j;while(j=c.pop()){if(j.scoped)l--;if(j.name===D)break}continue}let B=/\sdata-stx-scope\s*=/.test(A),M=/\sdata-stx-ref-caller\s*=\s*(["'])(.*?)\1/.exec(A),I=c.find((j)=>j.scoped)?.scopeId;if(M&&I&&M[2]===I)y.push(e.slice(a,v),A.replace(M[0],` data-stx-ref-caller="${t}"`)),a=E;else if(!l&&!B&&/\s(?:ref|@ref|:ref|x-ref|data-stx-ref)\s*=/.test(A)&&!/\sdata-stx-ref-caller\s*=/.test(A))y.push(e.slice(a,v),A.replace(/\s*\/?>$/,(j)=>` data-stx-ref-caller="${t}"${j}`)),a=E;if(!Li.has(D)&&!/\/>$/.test(A)){let j=/\sdata-stx-scope\s*=\s*(?:"([^"]*)"|'([^']*)')/.exec(A);if(c.push({name:D,scoped:B,scopeId:j?.[1]??j?.[2]}),B)l++}}return y.push(e.slice(a)),y.join("")}var Li=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Bi=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/,Di=/<\/?\s*([a-z][\w-]*)/iy,Pa=/\s/;function Da(e,t){let i=t-1;while(i>=0&&Pa.test(e[i]))i--;return i>=0&&e[i]==="/"}function Ma(e,t){let i=!1,n=!1;for(let c=t;c<e.length;c++){let l=e[c];if(i){if(l==="'")i=!1}else if(n){if(l==='"')n=!1}else if(l==="'")i=!0;else if(l==='"')n=!0;else if(l===">")return c}return-1}function ja(e,t){if(e.indexOf("{",t)===-1||e.indexOf("}",t)===-1)return!1;let i=0,n=t,c=!1,l=!1,a=!1;while(n<e.length){let y=e.indexOf("<",n),v=y===-1?e.length:y;if(v>n){if(i===0)while(n<v){let D=e.indexOf(l?"}":"{",n);if(D===-1||D>=v){if(l)a=!1;else c=!1;break}if(D>n)if(l)a=!1;else c=!1;if(l){if(a)return!0;a=!0}else if(c)l=!0,a=!1;else c=!0;n=D+1}n=v;continue}if(e.startsWith("<!--",n)){let D=e.indexOf("-->",n);n=D===-1?e.length:D+3;continue}let E=Ma(e,n);if(E===-1)break;Di.lastIndex=n;let A=Di.exec(e)?.[1]?.toLowerCase()??"";if(e[n+1]==="/"){if(i===0)break;i--}else if(!Da(e,E)&&!Li.has(A))i++;n=E+1}return!1}var Mi=b(256);function zc(e){if(e.length<1024)return ji(e);let t=x(e),i=Mi.get(t);if(i!==void 0)return i;let n=ji(e);return Mi.set(t,n),n}function ji(e){if(e.length>=32768&&!Ur(e))return e;let i=new RegExp(`<(${"div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i"})\\b`,"gi"),n="",c=0,l;while((l=i.exec(e))!==null){let a=l.index,y=a+l[0].length,v=!1,E=!1,A=-1;while(y<e.length){let B=e[y];if(v){if(B==="'")v=!1}else if(E){if(B==='"')E=!1}else if(B==="'")v=!0;else if(B==='"')E=!0;else if(B===">"){A=y;break}y++}if(A===-1)continue;let D=e.slice(a,A+1);if(Bi.test(D))continue;if(D.includes("x-cloak"))continue;if(ja(e,A+1))n+=e.slice(c,A)+" x-cloak>",c=A+1}return n+=e.slice(c),n}var Na=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,La=/<\/script>/gi,Ba=/<\/style>/gi;function Hc(e){let t=/<[a-z][\w-]*/gi,i="",n=0,c;while((c=t.exec(e))!==null){let l=c.index,a=c[0].slice(1).toLowerCase();if(a==="script"||a==="style"){let I=a==="script"?La:Ba;I.lastIndex=l;let j=I.exec(e);if(j!==null)t.lastIndex=j.index+j[0].length;continue}let y=l+c[0].length,v=!1,E=!1,A=-1;while(y<e.length){let I=e[y];if(v){if(I==="'")v=!1}else if(E){if(I==='"')E=!1}else if(I==="'")v=!0;else if(I==='"')E=!0;else if(I===">"){A=y;break}y++}if(A===-1)continue;let D=e.slice(l+c[0].length,A);if(Bi.test(D))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(D))continue;if(!Na.test(D))continue;let B=e[A-1]==="/",M=B?A-1:A;i+=`${e.slice(n,M)} x-cloak${B?" ":""}`,n=M}return i+=e.slice(n),i}import Qi from"path";import $s from"fs";import Gt from"path";function Wi(e,t,i,n){let c=0;for(let l=t;l<e.length;l++)if(e[l]===i)c++;else if(e[l]===n&&!(n===">"&&e[l-1]==="=")){if(--c===0)return l}return-1}function Wa(e){let t=r(e),i=0,n=0,c=[];for(let l=0;l<t.length;l++)if("([{".includes(t[l]))i++;else if(")]}".includes(t[l]))i--;else if(t[l]===","&&i===0)c.push(e.slice(n,l).trim()),n=l+1;return c.push(e.slice(n).trim()),c}function Ss(e,t){let i=r(e),n=new RegExp(`\\b(?:${t.map((c)=>c.replace(/[$]/g,"\\$&")).join("|")})\\s*(?=[<(])`,"g");for(let c of i.matchAll(n)){let l=c.index+c[0].length,a="";if(i[l]==="<"){let v=Wi(i,l,"<",">");if(v<0)continue;a=e.slice(l+1,v),l=v+1;while(/\s/.test(i[l]||"")&&l<i.length)l++}if(i[l]!=="(")continue;let y=Wi(i,l,"(",")");if(y>=0)return{type:a,args:Wa(e.slice(l+1,y))}}return null}var zi=`
|
|
225
|
+
type __StxCtor<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends ArrayConstructor ? unknown[] : T extends ObjectConstructor ? object : T extends readonly unknown[] ? __StxCtor<T[number]> : T extends abstract new (...args: any[]) => infer V ? V : unknown;
|
|
226
|
+
type __StxWiden<T> = T extends string ? string : T extends number ? number : T extends boolean ? boolean : T;
|
|
227
|
+
type __StxOption<T> = T extends { type: infer C } ? __StxCtor<C> : T extends { default: infer D } ? D extends (...args: any[]) => infer V ? V : __StxWiden<D> : __StxCtor<T>;
|
|
228
|
+
type __StxRequired<O> = { [K in keyof O]-?: O[K] extends { required: true } ? K : never }[keyof O];
|
|
229
|
+
type __StxDefaulted<O> = { [K in keyof O]-?: O[K] extends { default: unknown } ? K : never }[keyof O];
|
|
230
|
+
type __StxOptions<O> = { [K in Exclude<__StxRequired<O>, __StxDefaulted<O>>]: __StxOption<O[K]> } & { [K in Exclude<keyof O, Exclude<__StxRequired<O>, __StxDefaulted<O>>>]?: __StxOption<O[K]> };
|
|
231
|
+
type __StxDefaults<P, K> = Omit<P, Extract<keyof P, K>> & Partial<Pick<P, Extract<keyof P, K>>>;
|
|
232
|
+
`;function Fi(e,t){let i=[],n={defineProps:["defineProps"],defineEmits:["defineEmits"],withDefaults:["withDefaults"]},c=r(e),l=e.replace(/\bimport\s+(?:type\s+)?(\{[^}]*\}|\*\s+as\s+[\w$]+|[\w$]+)\s+from\s*(['"])([^'"]+)\2\s*;?/g,(B,M,I,j,Q)=>{if(c.slice(Q,Q+6)!=="import")return B;if(j.endsWith(".stx"))return"";let X=`${t}Import${i.length}`;if(i.push(`import * as ${X} from ${JSON.stringify(j)};`),M.startsWith("*"))return`import ${M.replace(/^\*\s+as\s+/,"")} = ${X};`;if(!M.startsWith("{"))return`import ${M} = ${X}.default;`;return M.slice(1,-1).split(",").map((z)=>{let[L,ee=L]=z.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(!L)return"";if(/^(?:stx|@stacksjs\/stx)(?:\/|$)/.test(j)&&L in n)n[L].push(ee);return`import ${ee} = ${X}.${L};`}).join(`
|
|
233
|
+
`)}),a=Ss(e,n.defineProps),y=Ss(e,n.defineEmits),v=Ss(e,n.withDefaults);if(!a&&!y)return{declarations:"",props:null,events:null};let E=[],A=null,D=null;if(a){E.push(`const __options = (${a.args[0]||"{}"}) as const;`),E.push(`const __defaults = (${v?.args[1]||"{}"});`);let B=a.type||"__StxOptions<typeof __options>";E.push(`export type __StxProps = __StxDefaults<${B}, keyof typeof __defaults | __StxDefaulted<typeof __options>>;`),A=`${t}.__StxProps`}if(y)E.push(`const __events = (${y.args[0]||"[]"}) as const;`),E.push(`export type __StxEvents = ${y.type||"Record<(typeof __events)[number], any[]>"};`),D=`${t}.__StxEvents`;return{declarations:`${i.join(`
|
|
234
|
+
`)}
|
|
235
|
+
namespace ${t} {
|
|
236
|
+
${l}
|
|
237
|
+
${E.join(`
|
|
238
|
+
`)}
|
|
239
|
+
}`,props:A,events:D}}var Sr=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function kr(e){if(e.includes("-")||e==="component")return!1;if(/^[A-Z]/.test(e))return!/[a-z]/.test(e)&&[...Sr].some((t)=>t.toLowerCase()===e.toLowerCase());return Sr.has(e)||/[A-Z]/.test(e)}function*za(e){let t=/<([A-Za-z][\w.-]*)(?=[\s/>])/g,i;while(i=t.exec(e)){let n=t.lastIndex,c=[];while(n<e.length){while(/\s/.test(e[n]||""))n++;if(e[n]===">"||e.slice(n,n+2)==="/>"){n+=e[n]===">"?1:2;break}let l=/^[^\s=/>]+/.exec(e.slice(n))?.[0];if(!l){n++;continue}let a=n;n+=l.length;while(/\s/.test(e[n]||""))n++;if(e[n]!=="="){c.push({name:l,value:!0,offset:a,braced:!1});continue}n++;while(/\s/.test(e[n]||""))n++;let y=e[n],v=y==="{",E=y==='"'||y==="'";if(E||v)n++;let A=n;if(v){let D=r(e.slice(n)),B=1,M=0;for(;M<D.length;M++){if(D[M]==="{")B++;if(D[M]==="}"&&--B===0)break}n+=M}else if(E)while(n<e.length&&e[n]!==y)n++;else while(n<e.length&&!/[\s/>]/.test(e[n]))n++;if(c.push({name:l,value:e.slice(A,n),offset:A,braced:v}),E||v)n++}t.lastIndex=n,yield{name:i[1],offset:i.index,attributes:c}}}function Ui(e,t,i){let n=[],c=[zi,"type __StxAssignedValue<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? T extends () => infer V ? V : T : T;","type __StxProp<P, K> = K extends keyof P ? P[K] : unknown;",'type __StxStaticProp<P, K> = __StxProp<P, K> extends infer T ? boolean extends T ? T | "true" | "false" : T : never;','type __StxEvent<E, K> = K extends keyof E ? E[K] extends readonly unknown[] ? number extends E[K]["length"] ? E[K][0] : Exclude<E[K]["length"], 0 | 1> extends never ? E[K][0] : E[K] : E[K] : any;'],l=new Map,a=new Map,y=new Map,v=i.scriptCode(e,i.filePath),E=r(v);for(let I of v.matchAll(/\bimport\s+(\{[^}]+\}|[\w$]+)\s+from\s*['"]([^'"]+)['"]/g)){if(E.slice(I.index,I.index+6)!=="import")continue;let j=I[2],Q=Gt.isAbsolute(j)||j.startsWith(".")?Gt.resolve(Gt.dirname(i.filePath),j):Ns(j,Gt.dirname(i.filePath));if(!Q)continue;let X=Q.endsWith(".stx")?Q:$s.existsSync(`${Q}.stx`)?`${Q}.stx`:void 0,z=X?null:yr(Q,!1),L=I[1].startsWith("{")?I[1].slice(1,-1).split(","):[I[1]];for(let ee of L){let[te,re=te]=ee.trim().split(/\s+as\s+/),me=X||z?.get(te)||z?.get(te.toLowerCase());if(me)y.set(re,me),y.set(re.toLowerCase(),me),y.set(re.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),me)}}for(let I of t.matchAll(/@import\s*\(([^)]+)\)/g))for(let j of I[1].matchAll(/['"]([^'"]+)['"]/g)){let Q=Ms(j[1],i.filePath,i).find((X)=>$s.statSync(X,{throwIfNoEntry:!1})?.isFile());if(Q)y.set(Gt.basename(j[1]).replace(/\.stx$/,""),Q)}let A={__importedComponents:y},D=new Map,B=(I,j,Q)=>{let X=e.slice(0,I);return{code:j,offset:I,attribute:Q,anchor:!0,kind:"directive",line:X.split(`
|
|
240
|
+
`).length,column:I-X.lastIndexOf(`
|
|
241
|
+
`)}},M=(I,j,Q)=>n.push({expression:I,statement:{text:j+I.code+Q,prefixLength:j.length}});for(let I of za(t)){if(kr(I.name)||I.name==="component")continue;let j=fr(I.name,i.filePath,i,A);if(!j)continue;let Q=D.get(j);if(!Q){let z;try{z=i.readComponent?i.readComponent(j):$s.readFileSync(j,"utf8")}catch{continue}if(z===void 0)continue;a.set(j,z),Q=Fi(i.scriptCode(z,j),`__StxComponent${D.size}`),D.set(j,Q),c.push(Q.declarations)}let X=[];for(let z of I.attributes){let{name:L,offset:ee}=z,te=z.value===!0?"true":z.value;if(L.startsWith("@")||L.startsWith("v-on:")){if(Q.events&&z.value!==!0)l.set(ee,`__StxEvent<${Q.events}, ${JSON.stringify(L.replace(/^@|^v-on:/,"").split(".")[0])}>`);continue}let re=/^v-model(?::([\w-]+))?(?:\.[\w-]+)*$/.exec(L);if(L.startsWith("v-")&&!L.startsWith("v-bind:")&&!re)continue;if(/^(?:x-|:)(?:if|for|show|key|else)(?:$|[.:-])/.test(L))continue;let me=(re?re[1]||"modelValue":L.replace(/^:|^v-bind:/,"")).replace(/-([a-z])/g,(Re,He)=>He.toUpperCase());if(X.push(me),!Q.props)continue;let he=L.startsWith(":")||L.startsWith("v-bind:")||!!re||z.braced,le=he?te:z.value!==!0?JSON.stringify(te):"true",ke=!he&&z.value!==!0&&(te==="true"||te==="false");M(B(ee,le,L),";void ((",`) satisfies ${ke?"__StxStaticProp":"__StxProp"}<${Q.props}, ${JSON.stringify(me)}>);`)}if(Q.props){let z=[...new Set(X)].map((ee)=>`${JSON.stringify(ee)}: undefined as any`).join(", "),L=B(I.offset,`<${I.name}>`);n.push({expression:L,statement:{text:`;void ({ ${z} } satisfies ${Q.props} & Record<string, unknown>);`,prefixLength:0}})}}return{declarations:D.size?c.join(`
|
|
242
|
+
`):"",checks:n,events:l,dependencies:a}}var Vi=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function Fa(e){let t=(i)=>i.replace(/[^\n]/g," ");return e.replace(/<!--[\s\S]*?-->/g,t).replace(/\{\{--[\s\S]*?--\}\}/g,t)}function Pt(e){let t=[],i=Fa(e);Vi.lastIndex=0;let n;while((n=Vi.exec(i))!==null){let c=(n[1]||"").trim(),l=(n[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,a=(n[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,y=n.index+l,v=n.index+n[0].length-a,E=e.slice(y,v);if(/\bsrc\s*=/.test(c))continue;let A=c.match(/\btype\s*=\s*["']([^"']+)["']/i);if(A&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(A[1]))continue;let D=/\bserver\b/.test(c)?"server":/\bclient\b/.test(c)?"client":"plain",B=Yt(e,y);t.push({kind:D,code:E,startLine:B,startColumn:Qt(e,y),offset:y,attrs:c})}return t}function Yt(e,t){let i=1;for(let n=0;n<t&&n<e.length;n++)if(e.charCodeAt(n)===10)i++;return i}function Qt(e,t){let i=e.lastIndexOf(`
|
|
243
|
+
`,t-1)+1;return t-i+1}function Wn(e){let t=e.split(""),i=(c,l)=>{for(let a=c;a<l&&a<t.length;a++)if(t[a]!==`
|
|
244
|
+
`)t[a]=" "},n=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let c of n){c.lastIndex=0;let l;while((l=c.exec(e))!==null)i(l.index,l.index+l[0].length)}return t.join("")}function eo(e){let t=0,i="";for(let n=0;n<e.length;n++){let c=e[n];if(i){if(c==="\\"){n++;continue}if(c===i)i="";continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="("||c==="["||c==="{"){t++;continue}if(c===")"||c==="]"||c==="}"){t--;continue}if(c==="|"&&t===0){if(e[n+1]==="|"){n++;continue}if(e[n-1]==="|")continue;return e.slice(0,n)}}return e}var to=new Set([":for","x-for","v-for"]),zn=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,vs="__stx_interpolated",Hi="__StxElement",no="__StxTemplateValue",Ua=`type ${no}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function Zi(e){return e.replace(/\{\{[\s\S]*?\}\}/g,vs).replace(/\{!![\s\S]*?!!\}/g,vs)}function ci(e,t,i="0"){let n=`__stxScript${i}`;while((e+t).includes(n))n+="_";let c=new Map,l=[],a=[],y=r(e),v=cl(e),E=[],A=0;for(let Q of y.matchAll(/\{\{([\s\S]*?)\}\}|\{!!([\s\S]*?)!!\}/g)){let X=Q.index,z=e.slice(X,X+Q[0].length),L=Q[1]!==void 0,ee=z.slice(L?2:3,L?-2:-3),te=a.length,re=Yi(v,X),me=Yi(v,X+(L?2:3));a.push({code:eo(ee),...me});let he=`${n}_${te}`,le=z.split(`
|
|
245
|
+
`),ke=le[0].length;le[0]=he+" ".repeat(Math.max(0,ke-he.length));for(let Ze=1;Ze<le.length;Ze++)le[Ze]=le[Ze].replace(/[^\r]/g," ");let Re=c.get(re.line)??[],He=Re.at(-1),Xe=re.column+(He?He.generatedEnd-He.sourceEnd:0);Re.push({sourceStart:re.column,sourceEnd:re.column+ke,generatedStart:Xe,generatedEnd:Xe+le[0].length}),c.set(re.line,Re),E.push(e.slice(A,X),le.join(`
|
|
246
|
+
`)),A=X+z.length}E.push(e.slice(A));let D=E.join("");if(!a.length)return{code:D,columns:c,declarations:l};let{imports:B,body:M}=ro(t),I=[],j=0;for(let Q of B.split(/\n(?=import\b)/)){if(!Q.trim())continue;let X=/^import\s+(?:type\s+)?([\s\S]+?)\s+from\s*(['"][^'"]+['"])/.exec(Q);if(!X){l.push({text:Q});continue}let z=`${n}Module${j++}`;l.push({text:`import * as ${z} from ${X[2]}`});let L=X[1],ee=/\{([\s\S]*?)\}/.exec(L);for(let he of ee?.[1].split(",")??[]){let[le,ke=le]=he.trim().replace(/^type\s+/,"").split(/\s+as\s+/);if(le==="default")I.push(`const ${ke} = ${z}.default; type ${ke} = import(${X[2]}).default`);else if(le)I.push(`import ${ke} = ${z}.${le}`)}let te=L.replace(/\{[\s\S]*?\}/,""),re=/\*\s+as\s+(\w+)/.exec(te);if(re)I.push(`import ${re[1]} = ${z}`);let me=/^\s*([\w$]+)/.exec(te)?.[1];if(me)I.push(`const ${me} = ${z}.default; type ${me} = import(${X[2]}).default`)}l.push({text:`namespace ${n}Scope {
|
|
247
|
+
${I.join(`
|
|
248
|
+
`)}
|
|
249
|
+
export async function read() {
|
|
250
|
+
${js(M).replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class|interface|type)\b)/gm,"")}
|
|
251
|
+
return {`});for(let[Q,X]of a.entries())l.push({text:`value${Q}: (`}),l.push({text:X.code,origin:{line:X.line,column:X.column}}),l.push({text:"),"});l.push({text:`}
|
|
252
|
+
}
|
|
253
|
+
}`});for(let Q=0;Q<a.length;Q++)l.push({text:`declare var ${n}_${Q}: Awaited<ReturnType<typeof ${n}Scope.read>>['value${Q}']`});return{code:D,columns:c,declarations:l}}function Va(e,t){let i=0;for(let n of e){if(t<n.generatedStart)break;if(t<n.generatedEnd)return n.sourceStart+Math.min(t-n.generatedStart,n.sourceEnd-n.sourceStart);i=n.sourceEnd-n.generatedEnd}return t+i}var Ha=["foreach","endforeach","forelse","endforelse","for","endfor","while","endwhile","empty","if","elseif","else","endif","unless","endunless","isset","endisset","switch","case","default","endswitch","auth","endauth","guest","endguest","env","endenv","once","endonce","break","continue"],Za=new RegExp(String.raw`^[ \t]*@(?:${Ha.join("|")})\b[ \t]*(\([^\n)]*\))?[ \t]*$`,"gm");function js(e){return e.replace(Za,(t)=>t.replace(/[^\n]/g," "))}var qi=new Set(["x-cloak","x-ref","x-transition","x-teleport","v-slot","x-hydrate",":key","x-tooltip","x-tooltip-position"]);function Yf(e){let t=Wn(e),i=[],n=/(@?)\{\{([\s\S]*?)\}\}|(@?)\{!!([\s\S]*?)!!\}/g,c;while((c=n.exec(t))!==null){if(c[1]||c[3])continue;let y=c[2]??c[4]??"",v=c[2]!==void 0?2:3,E=eo(y);if(!E.trim())continue;let A=c.index+v+(E.length-E.trimStart().length);i.push({code:E.trim(),line:Yt(t,A),column:Qt(t,A),offset:A,kind:"interpolation"})}let l=/@(if|elseif|else\s+if|unless)\b\s*\(/g;while((c=l.exec(t))!==null){let a=c.index+c[0].length-1,y=0,v=a;for(;v<t.length;v++){let B=t[v];if(B==="(")y++;else if(B===")"){if(y--,y===0)break}}if(y!==0)continue;let E=t.slice(a+1,v),A=E.trim();if(l.lastIndex=v+1,!A)continue;let D=a+1+(E.length-E.trimStart().length);i.push({code:A,line:Yt(t,D),column:Qt(t,D),offset:c.index,kind:"condition"})}zn.lastIndex=0;while((c=zn.exec(t))!==null){let a=c[1],y=c[3]??"",v=a.replace(/\..*$/,"").replace(/^([^:].*?):.*$/,"$1");if(qi.has(v)||qi.has(a))continue;if(!y.trim())continue;let E=c.index+c[0].indexOf(c[2],c[0].indexOf(a)+a.length)+1;if(to.has(v)){let D=y.match(/\s+(?:in|of)\s+/);if(!D||D.index===void 0)continue;let B=y.slice(D.index+D[0].length),M=D.index+D[0].length+(B.length-B.trimStart().length);i.push({code:Zi(B.trim()),line:Yt(t,E+M),column:Qt(t,E+M),offset:E+M,kind:"directive",attribute:v});continue}let A=y.length-y.trimStart().length;i.push({code:Zi(y.trim()),line:Yt(t,E+A),column:Qt(t,E+A),offset:E+A,kind:"directive",attribute:v})}return i.sort((a,y)=>a.line-y.line||a.column-y.column),i}var qa=2000;function Ka(e,t){let i=0,n=Math.min(e.length,t+qa);for(let c=t;c<n;c++){let l=e[c];if(l==="(")i++;else if(l===")"){if(i--,i===0)return e.slice(t+1,c)}}return null}function Xa(e){let t=new Map,i=(y,v)=>{let E=y.split(/[,[\]{}()\s]+/).filter(Boolean);for(let A of E){let D=A.replace(/^\.\.\./,"").trim();if(!/^\$?[A-Z_$][\w$]*$/i.test(D))continue;let B=E.length===1?v:void 0,M=t.get(D);if(!M)t.set(D,{name:D,iterable:B});else if(M.iterable!==B)M.iterable=void 0}},n=/^\$?[A-Z_$][\w$]*$/i,c=(y)=>{let v=y.trim();return n.test(v)?v:void 0};for(let y of e.matchAll(/@for(?:each|else)\s*\(/g)){let v=Ka(e,y.index+y[0].length-1);if(v===null)continue;let E=At(v);if(!E)continue;i(E.itemVar.replace(/=>/g," "),c(E.arrayExpr))}for(let y of e.matchAll(/@for\s*\(\s*(?:(?:let|const|var)\s+)?([\w$]+|\[[^\]]*\]|\{[^}]*\})\s+(of|in)\s+([^)]*)/g))i(y[1],y[2]==="of"?c(y[3]):void 0);for(let y of e.matchAll(/@for\s*\(\s*(?:let|const|var)\s+([\w$]+)\s*[=;]/g))i(y[1]);let l=Wn(e);zn.lastIndex=0;let a;while((a=zn.exec(l))!==null){let y=a[1].replace(/\..*$/,"");if(!to.has(y))continue;let v=a[3].match(/\s+(?:in|of)\s+/);if(!v||v.index===void 0)continue;i(a[3].slice(0,v.index),c(a[3].slice(v.index+v[0].length)))}for(let y of e.matchAll(/@(?:php|js|ts)\b([\s\S]*?)@end(?:php|js|ts)\b/g))for(let v of y[1].matchAll(/\b(?:const|let|var|function|class)\s+([\w$]+)/g))i(v[1]);return[...t.values()].sort((y,v)=>y.name.localeCompare(v.name))}function Me(e){let t=new Set;for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?class\s+([\w$]+)/gm))t.add(i[1]);for(let i of e.matchAll(/^\s*(?:export\s+)?(?:const|let|var)\s*[[{]([^\]}]*)[\]}]/gm))for(let n of i[1].split(",")){let c=n.split(":").pop().split("=")[0].replace(/^\.\.\./,"").trim();if(/^[A-Z_$][\w$]*$/i.test(c))t.add(c)}return[...t].sort()}var Es=["params","query","cookies","host","ip","setResponseStatus","setResponseHeader","notFound","request","url","definePageMeta","defineClientPayload","defineStore","props","$props"],Ja={$bool:"declare function $bool(value: unknown, fallback?: boolean): boolean",$num:"declare function $num(value: unknown, fallback?: number): number",$uid:"declare var $uid: string",$native:"declare var $native: boolean"};function Ic(e=new Set){return[...Es.filter((t)=>!e.has(t)).map((t)=>`declare var ${t}: any`),...Object.entries(Ja).filter(([t])=>!e.has(t)).map(([,t])=>t)].join(`
|
|
254
|
+
`)}function Oc(e){return new Set([...e.matchAll(/^declare (?:function|const|let|var)\s+([A-Za-z_$][\w$]*)/gm)].map((t)=>t[1]))}function so(e){let t=/\bdefineClientPayload\s*\(\s*\{([\s\S]*?)\}\s*\)/g,i,n=!1,c=new Set,l=r(e);while((i=t.exec(l))!==null){n=!0;for(let a of Ga(i[1])){let y=a.split(":")[0].trim();if(/^[A-Za-z_$][\w$]*$/.test(y))c.add(y)}}return n?[...c]:null}function Ga(e){let t=[],i=0,n="";for(let c of e){if(c===","&&i===0){t.push(n),n="";continue}if(c==="("||c==="["||c==="{")i++;else if(c===")"||c==="]"||c==="}")i--;n+=c}return t.push(n),t.filter((c)=>c.trim().length>0)}function ro(e){let t=/^[ \t]*import\b[\s\S]*?(?:from\s*['"][^'"]*['"]|['"][^'"]*['"])[ \t]*;?[ \t]*$/gm,i=[],n=e.replace(t,(c)=>(i.push(c.trim()),c.split(`
|
|
255
|
+
`).map(()=>"").join(`
|
|
256
|
+
`)));return{imports:i.join(`
|
|
257
|
+
`),body:n}}function io(e){let t=r(e),i=Array(t.length),n=0;for(let y=0;y<t.length;y++){let v=t[y];if(v==="}"||v===")"||v==="]")n=Math.max(0,n-1);if(i[y]=n,v==="{"||v==="("||v==="[")n++}let c=[],l=/^[ \t]*(?:export[ \t]+)?(interface|type)[ \t]+([A-Za-z_$][\w$]*)/gm,a;while((a=l.exec(t))!==null){if(i[a.index]!==0)continue;let y=a[1],v=a[2],E;if(y==="interface"){let A=t.indexOf("{",a.index);if(A===-1)continue;let D=0;E=-1;for(let B=A;B<t.length;B++)if(t[B]==="{")D++;else if(t[B]==="}"&&--D===0){E=B+1;break}if(E===-1)continue}else{let A=0;E=t.length;for(let D=t.indexOf("=",a.index)+1;D<t.length;D++){let B=t[D];if(B==="{"||B==="["||B==="("||B==="<")A++;else if(B==="}"||B==="]"||B===")"||B===">")A--;else if(A<=0&&(B===";"||B===`
|
|
258
|
+
`&&!/[=|&,<([{]\s*$/.test(t.slice(Math.max(0,D-40),D)))){E=B===";"?D+1:D;break}}}c.push({name:v,text:e.slice(a.index,E).replace(/^[ \t]*export[ \t]+/,"")}),l.lastIndex=E}return c}function Ya(e){return new Set(io(e).map((t)=>t.name))}function Nc(e,t=""){let i=so(e),n=Ya(t),c=io(e).filter((E)=>!n.has(E.name)).map((E)=>E.text);if(!i){let E=Me(e).filter((A)=>!Rt(t,A));if(E.length===0&&c.length===0)return"";return["",`// ${Qa}`,...c,...E.map((A)=>`declare var ${A}: any`)].join(`
|
|
259
|
+
`)}if(i.length===0)return c.length>0?["",`// ${Ki}`,...c].join(`
|
|
260
|
+
`):"";let{imports:l,body:a}=ro(e),y=a.replace(/^[ \t]*export[ \t]+(?=(?:const|let|var|function|async|class)\b)/gm,""),v=["",`// ${Ki}`];if(l)v.push(l);return v.push(...c),v.push(`async function ${Xi}() {`,y,` return { ${i.join(", ")} }`,"}",`type ${Ji} = Awaited<ReturnType<typeof ${Xi}>>`,...i.map((E)=>`declare var ${E}: ${Ji}[${JSON.stringify(E)}]`)),v.join(`
|
|
261
|
+
`)}function li(e){let i=r(e).split(""),n=0;for(let c=0;c<i.length;c++){let l=i[c];if(l==="{"||l==="("||l==="["){n++;continue}if(l==="}"||l===")"||l==="]"){n=Math.max(0,n-1);continue}if(n>0&&l!==`
|
|
262
|
+
`)i[c]=" "}return Me(i.join(""))}function Mc(e,t){if(so(e)!==null)return[];let i=li(e),n=Ie(t,new Set(i)),c=new Set(k);return i.filter((l)=>{if(c.has(l))return!1;if(Rt(t,l))return!1;return n.has(l)})}var Ki="stx: types for the declared client payload (#1868)",Qa="stx: untyped bridge names \u2014 declare a defineClientPayload to check these (#1868)",Xi="__stxServerScope",Ji="__StxClientPayload";var Gi=["$env","$user","$slot","$slots","$attrs","$props","$page","$route","$loop","loop","$errors","$csrf","$native","props","slot"];var tl=/^\s*[A-Z_$][\w$]*\s*=[^=]/i;function nl(e){let t=new Map,i=/!|===|!==|==|!=|&&|\|\||<|>|\btypeof\b|\binstanceof\b|\bin\b/;for(let n of e){let c=r(n),{depths:l,balanced:a}=ge(c);if(!a)continue;let y=/^([ \t]*(?:export[ \t]+)?const[ \t]+)([A-Za-z_$][\w$]*)[ \t]*(?::[^=\n]+)?=[ \t]*([^\n]+)$/gm;for(let v of c.matchAll(y)){let E=v.index??0;if(l[E+v[1].length]!==0)continue;let A=v[2],D=E+v[0].length-v[3].length,B=n.slice(D,E+v[0].length).trim().replace(/;$/,"").trim(),M=v[3],I=i.test(M)&&!/\bawait\b|=>|\bfunction\b|[{}]/.test(M)&&!/[,+\-*/%&|?:=]$/.test(B)&&ge(M).balanced;t.set(A,t.has(A)||!I?null:B)}}return new Map([...t].filter((n)=>n[1]!==null))}function oo(e,t,i=0,n=new Set){if(t.size===0||i>=5)return e;let c=r(e),l="",a=0;for(let y of c.matchAll(/[A-Za-z_$][\w$]*/g)){let v=y.index??0,E=y[0],A=t.get(E);if(!A||n.has(E))continue;let D=c.slice(0,v).trimEnd(),B=c.slice(v+E.length).trimStart();if(D.endsWith(".")||/^:(?!:)/.test(B)&&/[{,]$/.test(D))continue;if(v>0&&/[\w$]/.test(c[v-1]))continue;l+=`${e.slice(a,v)}(${oo(A,t,i+1,new Set([...n,E]))})`,a=v+E.length}return l+e.slice(a)}function sl(e,t){let i=/@(if|unless|elseif|else|endif|endunless)\b\s*(\()?/g,n=[],c;while((c=i.exec(e))!==null){if(c.index>t)break;let l=c[1];if(c.index===t){if(l==="elseif"){let y=n[n.length-1];if(y?.current)y.seen.push(y.current);if(y)y.current=null}break}if(l==="endif"||l==="endunless"){n.pop();continue}let a="";if(c[2]==="("){let y=0,v=c.index+c[0].length-1,E=v+1;for(;v<e.length;v++){let A=e[v];if(A==="(")y++;else if(A===")"){if(y--,y===0)break}}a=e.slice(E,v).trim(),i.lastIndex=v+1}if(l==="if")n.push({seen:[],current:a});else if(l==="unless")n.push({seen:[],current:`!(${a})`});else if(l==="elseif"||l==="else"){let y=n[n.length-1];if(!y)continue;if(y.current)y.seen.push(y.current);y.current=l==="elseif"?a:null}}return n.flatMap((l)=>[...l.seen.map((a)=>`!(${a})`),...l.current?[l.current]:[]]).filter(Boolean)}function rl(e){let t=e.code.trim();if(!t)return null;if(e.attribute?.startsWith("@")){if(tl.test(t))return null;let n=";(($event: any): void => { ";return{text:`${n}${t} });`,prefixLength:n.length}}let i=";void ((";return{text:`${i}${t}));`,prefixLength:i.length}}var il=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.{1,2}\/[^'"\n]*)\2/g;function _r(e,t){if(!t)return e;return e.replace(il,(i,n,c,l)=>{let a=Qi.resolve(t,l).replace(/\\/g,"/");return`${n}${c}${a}${c}`})}function ui(e){return" ".repeat(Math.max(0,(e.startColumn??1)-1))}function ol(e){let t=new Set,i=r(e);for(let n of i.matchAll(/\bimport\s+(?:type\s+)?([\w$*{}\s,]+?)\s+from\b/g)){let c=n[1],l=/\{([^}]*)\}/.exec(c);for(let E of l?.[1].split(",")??[]){let A=E.trim().replace(/^type\s+/,"").split(/\s+as\s+/).pop()?.trim();if(A&&/^[A-Z_$][\w$]*$/i.test(A))t.add(A)}let a=c.replace(/\{[^}]*\}/,""),y=/\*\s*as\s+([A-Z_$][\w$]*)/i.exec(a);if(y)t.add(y[1]);let v=/^\s*([A-Z_$][\w$]*)/i.exec(a);if(v&&v[1]!=="type")t.add(v[1])}return[...t].sort()}function Dc(e,t={}){let i=Pt(e),n=e.split(`
|
|
263
|
+
`),c=Array.from({length:n.length},()=>""),l=new Map,a=new Map,y=[],v=i.filter((I)=>I.kind==="server").map((I)=>I.code).join(`
|
|
264
|
+
`),E=t.filePath&&t.templateExpressions!==!1?Ui(e,Wn(e),{filePath:t.filePath,componentsDir:t.componentsDir,projectRoot:t.projectRoot,readComponent:t.readComponent,scriptCode:(I,j)=>Pt(I).map((Q)=>_r(Q.code,Qi.dirname(j))).join(`
|
|
265
|
+
`)}):void 0,A=new Set,D=[];for(let[I,j]of i.entries()){let Q=ci(ui(j)+j.code,v,String(I));for(let[L,ee]of Q.columns)a.set(j.startLine+L-1,ee);for(let L of Q.declarations)y.push({text:_r(L.text,t.originDir??""),origin:L.origin?{...L.origin,line:L.origin.line+j.startLine-1}:void 0});let X=js(Q.code),z=_r(X,t.originDir??"").split(`
|
|
266
|
+
`);z.forEach((L,ee)=>{let te=j.startLine-1+ee;if(te<c.length)c[te]=L,A.add(te)}),D.push(j.startLine-1+z.length-1)}for(let I of D){let j=c[I]?.trim()===""?I:I+1;if(j<c.length&&c[j].trim()===""&&(j===I||!A.has(j)))c[j]=";"}let B=(I,j)=>{for(let[Q,X]of I.split(`
|
|
267
|
+
`).entries())if(c.push(X),j)l.set(c.length,Q===0?j:{...j,line:j.line+Q,column:1,prefixLength:0})};for(let I of y)B(I.text,I.origin);if(t.globals!==!1){B("");let I=new Set([...i.flatMap((z)=>Me(z.code)),...i.flatMap((z)=>ol(z.code))]),j=(z)=>{if(!I.has(z))B(`declare var ${z}: any`)};if(t.runtimeGlobals!==!1){if(!I.has("window"))B("declare var window: any");for(let z of k)j(z)}let Q=[...new Set([...Es,...xe,...Gi])].filter((z)=>t.runtimeGlobals!==!1||!k.includes(z));if(t.contextScope==="global"){B("declare global {");for(let z of Q)B(` var ${z}: any`);B("}")}else{for(let z of Es)j(z);for(let z of xe)j(z);for(let z of Gi)j(z)}B(`declare var ${vs}: any`);let X=new Set(i.flatMap((z)=>Me(z.code)));B(`type ${Hi}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let z of Xa(e)){if(X.has(z.name))continue;let L=z.iterable&&X.has(z.iterable)?`${Hi}<typeof ${z.iterable}>`:"any";B(`declare var ${z.name}: ${L}`)}}if(t.templateExpressions!==!1){if(E?.declarations)for(let j of E.declarations.split(`
|
|
268
|
+
`))B(j);let I=Yf(e).map((j)=>{let Q=E?.events.get(j.offset??-1);if(Q){j.anchor=!0;let X=j.code.trim(),z=/^([\w$]+)\s*=\s*([^=][\s\S]*)$/.exec(X),L=z?`void ((${z[2]}) satisfies __StxAssignedValue<typeof ${z[1]}>)`:/^[\w$]+(?:\.[\w$]+)*$/.test(X)?`${X} satisfies (($event: ${Q}) => unknown)`:X,ee=`;(($event: ${Q}): void => { `;return{expression:j,statement:{text:`${ee}${L} });`,prefixLength:ee.length}}}return{expression:j,statement:rl(j)}}).filter((j)=>j.statement!==null);if(I.push(...E?.checks||[]),I.length>0){let j=Wn(e),Q=Bn(j),X=nl(i.map((te)=>te.code)),L=[...new Set(i.flatMap((te)=>Me(te.code)))].filter((te)=>/^[A-Z_$][\w$]*$/i.test(te)),ee=0;if(L.length>0){B(Ua);for(let te of L)B(`function __StxRead_${te}() { return ${te} }`),B(`type __StxT_${te} = ${no}<ReturnType<typeof __StxRead_${te}>>`);B(`;((${L.map((te)=>`${te}: __StxT_${te}`).join(", ")}) => {`),ee=1}for(let{expression:te,statement:re}of I){let me=" ".repeat(ee),he=te.offset===void 0?[]:Q.filter((Ze)=>te.offset>=Ze.start&&te.offset<Ze.end),le=he.map((Ze)=>`;((${Ze.binding.replace(/[\r\n]/g," ")}: any) => { `).join(""),ke=" });".repeat(he.length),Re=te.offset===void 0?[]:sl(j,te.offset),He=Re.length>0?`${Re.map((Ze)=>`if (${oo(Ze,X)}) `).join("")}{ `:"",Xe=Re.length>0?" }":"";B(me+le+He+re.text+Xe+ke,{line:te.line,column:te.column,expression:te,prefixLength:re.prefixLength+me.length+le.length+He.length,guardPrefixLength:me.length+le.length+He.length})}if(ee>0)B("});")}}let M=!1;if(t.reference&&c[0]!==void 0&&c[0].trim()==="")c[0]=`/// <reference path=${JSON.stringify(t.reference.replace(/\\/g,"/"))} />`,M=!0;return B("export {}"),{text:c.join(`
|
|
269
|
+
`),lineMap:l,sourceLineCount:n.length,componentDependencies:E?.dependencies,referenced:M,scriptColumns:a}}function cl(e){let t=[0];for(let i=0;i<e.length;i++)if(e.charCodeAt(i)===10)t.push(i+1);return t}function Yi(e,t){let i=0,n=e.length-1;while(i<n){let c=Math.ceil((i+n)/2);if(e[c]<=t)i=c;else n=c-1}return{line:i+1,column:t-e[i]+1}}function Lc(e,t){if(!e.expression)return!1;return e.inGuard===!0||t===2774}function di(e,t,i){let n=e.lineMap.get(t);if(!n)return t<=e.sourceLineCount?{line:t,column:Va(e.scriptColumns?.get(t)??[],i)}:null;let c=n.expression?.anchor?0:Math.max(0,i-1-(n.prefixLength??0));return{line:n.line,column:n.column+c,expression:n.expression,inGuard:i<=(n.guardPrefixLength??0)}}var ks=b(256),al=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or, where this must run before first paint and the runtime does not exist yet, the colorMode config for a light/dark theme, or @appearanceBootstrap when there is a second appearance axis"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}],co=/(?:\/\/|\/\*|\{\{--)\s*stx-strict-ignore(-next-line)?([^\n*}]*)/g;function ll(e){let t=Array.from(e,(c)=>c===`
|
|
270
|
+
`?`
|
|
271
|
+
`:" "),i=0,n="";while(i<e.length){let c=e[i],l=e[i+1];if(n){if(c==="\\"){i+=2;continue}if(c===n)n="";i++;continue}if(c==='"'||c==="'"||c==="`"){n=c,i++;continue}if(c==="/"&&l==="/"){while(i<e.length&&e[i]!==`
|
|
272
|
+
`)t[i]=e[i],i++;continue}if(c==="/"&&l==="*"){let a=e.indexOf("*/",i+2),y=a===-1?e.length:a+2;for(;i<y;i++)t[i]=e[i];continue}if(c==="{"&&l==="{"&&e.slice(i,i+4)==="{{--"){let a=e.indexOf("--}}",i+4),y=a===-1?e.length:a+4;for(;i<y;i++)t[i]=e[i];continue}i++}return t.join("")}function fl(e){let t=new Map,i=ll(e).split(`
|
|
273
|
+
`),n=e.split(`
|
|
274
|
+
`);return i.forEach((c,l)=>{co.lastIndex=0;for(let a of c.matchAll(co)){let y=a[1]==="-next-line",v=(n[l]??"").slice(0,a.index).trim(),E=y||v===""?l+2:l+1,D=(a[2]??"").split("--")[0].split(/[\s,]+/).filter(Boolean),B=D.filter((I)=>/\w/.test(I));if(D.length>0&&B.length===0)continue;let M=t.get(E);if(M&&M.size===0)continue;if(B.length===0){t.set(E,new Set);continue}if(M)B.forEach((I)=>M.add(I));else t.set(E,new Set(B))}}),t}function pl(e,t,i){let n=e.get(t);if(!n)return!1;if(n.size===0)return!0;return[...n].some((c)=>i.includes(c))}function Oe(e,t,i,n){let c=typeof i==="boolean"?{enabled:i,failOnViolation:i}:i??{enabled:!1};if(!c.enabled)return;let l=x(e,t,n,JSON.stringify(c)),a=ks.get(l);if(a!==void 0){if(a&&c.failOnViolation)throw new q(a,n??t);return}let y=c.allowPatterns??[],v=fl(e),E=[],A=r(e.replace(/\{\{--[\s\S]*?--\}\}/g,(I)=>I.replace(/[^\n]/g," ")));for(let{pattern:I,message:j,suggestion:Q}of al){if(y.some((z)=>/\w/.test(z)&&j.includes(z)))continue;I.lastIndex=0;let X=A.match(I);if(X&&X.length>0){let z=A.split(`
|
|
275
|
+
`),L=e.split(`
|
|
276
|
+
`),ee=[];if(z.forEach((he,le)=>{if(I.lastIndex=0,I.test(he)&&!pl(v,le+1,j))ee.push(le+1)}),ee.length===0&&z.some((he)=>(I.lastIndex=0,I.test(he))))continue;let te=ee.length>0?` (script line${ee.length>1?"s":""} ${ee.join(", ")})`:"",re=ee.slice(0,3).map((he)=>` ${he} | ${(L[he-1]??"").trim().slice(0,100)}`).join(`
|
|
277
|
+
`),me=re?`
|
|
278
|
+
${re}`:"";E.push(` \u2717 ${j}${te}
|
|
279
|
+
\u2192 ${Q}${me}`)}}if(E.length===0){ks.set(l,"");return}let D=(I)=>{let j=`${process.cwd()}/`;return I.startsWith(j)?I.slice(j.length):I},M=`[STX] DOM API violation in ${n&&n!==t?`${D(n)} (composed into ${D(t)})`:D(t)}:
|
|
280
|
+
${E.join(`
|
|
281
|
+
`)}
|
|
282
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(ks.set(l,M),console.warn(M),c.failOnViolation)throw new q(M,n??t)}var gl=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],ml=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],hl=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function ig(e){let t=[],i=[];return xl(e,t),bl(e,t,i),yl(e,i),_l(e,t),{valid:t.length===0,errors:t,warnings:i}}function xl(e,t){let i=(e.match(/\{\{/g)||[]).length,n=(e.match(/\}\}/g)||[]).length;if(i!==n)t.push({type:"expression",message:`Unclosed expression brackets: found ${i} opening '{{' and ${n} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function bl(e,t,i){for(let n of gl){let c=new RegExp(`${n.open}(?:\\s|\\()`,"g"),l=new RegExp(n.close,"g"),a=(e.match(c)||[]).length,y=(e.match(l)||[]).length;if(n.altClose){let v=new RegExp(n.altClose,"g");y+=(e.match(v)||[]).length}if(a>y)t.push({type:"directive",message:`Unclosed @${n.name} directive: found ${a} opening and ${y} closing`,suggestion:`Add ${a-y} missing ${n.close} tag(s)`});else if(y>a)i.push({type:"directive",message:`Extra ${n.close} found: ${y-a} more closing than opening`,suggestion:`Check for orphaned ${n.close} tags`})}}function yl(e,t){for(let i of ml)if(i.pattern.test(e))t.push({type:"syntax",message:i.message,suggestion:i.suggestion})}function _l(e,t){for(let i of hl)if(i.pattern.test(e))t.push({type:"expression",message:`Security warning: ${i.message}`,suggestion:"Remove dangerous code from template expressions"})}function ag(e,t){let i=e.slice(0,t).split(`
|
|
283
|
+
`);return{line:i.length,column:i[i.length-1].length+1}}function cg(e,t,i){let n=[];switch(e){case"if":case"elseif":case"unless":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a condition`,suggestion:`Use @${e}(condition)`});break;case"foreach":if(i.length===0||!i[0].includes(" as "))n.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(i.length===0)n.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(i.length===0)n.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(i.length===0)n.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(i.length===0)n.push({type:"syntax",message:`@${e} requires a path`,suggestion:`Use @${e}('path/to/template')`});break}return n}function lg(e){return/@[a-z]+/i.test(e)||/\{\{/.test(e)}function ug(e){let t=e.matchAll(/@([a-z]+)/gi),i=new Set;for(let n of t){let c=n[1].toLowerCase();if(!c.startsWith("end"))i.add(c)}return Array.from(i)}function ao(e,t,i){let n=/^<script\b([^>]*)>/i.exec(e);if(!n||!/(?:^|\s)src\s*=/i.test(n[1]??""))return null;return _(n[0],t,i)+e.slice(n[0].length)}var en=new R(500),Ts=new Map;function lo(e){try{let t=Hn.statSync(e);return`${t.size}:${t.mtimeMs}`}catch{return""}}var Un=new R(1000),As=new R(2000),Ps=new R(500),yo=33554432,Zs=yo;function wl(e){let t=e.componentRenderCacheBytes;if(typeof t!=="number"||t<0||t===Zs)return;Zs=t,Vn.setMaxBytes(t)}var Vn=new R(2000,{maxBytes:yo,sizeOf:(e)=>e.output.length});function Sl(e){let t=new WeakSet;try{let i=(n)=>{if(n===void 0)return{__stxType:"undefined"};if(typeof n==="bigint")return{__stxType:"bigint",value:n.toString()};if(typeof n==="function"||typeof n==="symbol")throw TypeError("Non-serializable component input");if(n===null||typeof n!=="object")return n;if(t.has(n))throw TypeError("Circular component input");t.add(n);try{if(n instanceof Date)return{__stxType:"date",value:n.toISOString()};if(Array.isArray(n))return n.map(i);let c=Object.getPrototypeOf(n);if(c!==Object.prototype&&c!==null)throw TypeError("Non-plain component input");let l={};for(let a of Object.keys(n).sort())l[a]=i(n[a]);return l}finally{t.delete(n)}};return JSON.stringify(i(e))}catch{return null}}function $l(e){let t={};for(let[i,n]of Object.entries(e))if(!i.startsWith("__")||i==="__stxServeContext")t[i]=n;return t}function Rs(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Vs(e){let t=process.cwd(),i=`${t}\x00${e}`,n=uo.get(i);if(n===void 0)n=Bun.hash(_o(e,t).split(ce.sep).join("/")).toString(36).slice(0,6),uo.set(i,n);return n}var uo=new Map;function _o(e,t){if(!ce.isAbsolute(e))return e;let i=(n)=>{try{return Hn.realpathSync(n)}catch{return n}};return ce.relative(i(t),i(e))}function dg(e){return/\bjs\b/.test(e)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(e)}function je(e){return!dg(e)}var Fn=new Map;function Y(e){let t;try{t=JSON.stringify(e)}catch{return new Bun.Transpiler(e)}let i=Fn.get(t);if(i)return i;if(Fn.size>=16)Fn.clear();let n=new Bun.Transpiler(e);return Fn.set(t,n),n}var fo=new WeakMap,vl=256;function Be(e){try{let t=Y({loader:"ts",target:"browser",define:C()}),i=fo.get(t);if(!i)i=new Map,fo.set(t,i);let n=i.get(e);if(n!==void 0)return n;let c=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");c=c.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let l=[];c=c.replace(/\{!![\s\S]*?!!\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),c=c.replace(/\{\{\{[\s\S]*?\}\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`}),c=c.replace(/\{\{[\s\S]*?\}\}/g,(y)=>{let v=l.length;return l.push(y),`"__STX_EXPR_${v}__"`});let a=t.transformSync(c);for(let y=0;y<l.length;y++)a=a.replace(`"__STX_EXPR_${y}__"`,l[y]),a=a.replace(`'__STX_EXPR_${y}__'`,l[y]);if(i.size>=vl){let y=i.keys().next();if(!y.done)i.delete(y.value)}return i.set(e,a),a}catch(t){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",t);return e}}function El(e){let t=[],i=new Set,n=0,c=0,l=e.length,a=(M)=>{c++;while(c<l){if(e[c]==="\\"){c+=2;continue}if(e[c]===M){c++;return}c++}},y=()=>{c++;while(c<l){if(e[c]==="\\"){c+=2;continue}if(e[c]==="`"){c++;return}if(e[c]==="$"&&e[c+1]==="{"){c+=2;let M=1;while(c<l&&M>0)if(e[c]==="{")M++,c++;else if(e[c]==="}")M--,c++;else if(e[c]==="'"||e[c]==='"')a(e[c]);else if(e[c]==="`")y();else c++;continue}c++}},v=()=>{if(e[c]==="/"&&e[c+1]==="/"){while(c<l&&e[c]!==`
|
|
284
|
+
`)c++;return!0}if(e[c]==="/"&&e[c+1]==="*"){c+=2;while(c<l-1&&!(e[c]==="*"&&e[c+1]==="/"))c++;return c+=2,!0}return!1},E=new Set(["return","typeof","instanceof","in","of","new","delete","void","throw","case","do","else","yield","await"]),A=()=>{let M=c-1;while(M>=0&&/\s/.test(e[M]))M--;if(M<0)return!0;let I=e[M];if("(,=:[!&|?{};+-*%<>~^".includes(I))return!0;if(!/[\w$]/.test(I))return!1;let j=M;while(j>0&&/[\w$]/.test(e[j-1]))j--;return E.has(e.slice(j,M+1))},D=()=>{c++;let M=!1;while(c<l&&e[c]!==`
|
|
285
|
+
`){let I=e[c];if(I==="\\"){c+=2;continue}if(I==="[")M=!0;else if(I==="]")M=!1;else if(I==="/"&&!M){c++;while(c<l&&/[a-z]/i.test(e[c]))c++;return}c++}},B=()=>{if(n!==0)return;let M=e.slice(c).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(M){let X=M[2].split(",").map((z)=>{let L=z.trim().split(":");return L[L.length-1].trim()});for(let z of X)if(z&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(z)&&!i.has(z))t.push(z),i.add(z);return}let I=e.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(I){let X=I[2];if(!i.has(X))t.push(X),i.add(X);return}let j=e.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let X=j[1];if(!i.has(X))t.push(X),i.add(X);return}let Q=e.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Q){let X=Q[1];if(!i.has(X))t.push(X),i.add(X)}};while(c<l){if(v())continue;if(e[c]==="'"||e[c]==='"'){a(e[c]);continue}if(e[c]==="`"){y();continue}if(e[c]==="/"&&A()){D();continue}if(e[c]==="{"){n++,c++;continue}if(e[c]==="}"){n--,c++;continue}if(n===0&&/[a-z]/i.test(e[c])&&(c===0||/\s|[;{}()]/.test(e[c-1])))B();c++}return t}function kl(e){let t=[],i=0,n=0,c=null;for(let l=0;l<e.length;l++){let a=e[l];if(c){if(a==="\\"){l++;continue}if(a===c)c=null;continue}if(a==='"'||a==="'"||a==="`"){c=a;continue}if(a==="("||a==="["||a==="{")i++;else if(a===")"||a==="]"||a==="}")i--;else if(a===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function Rl(e){let t=0,i=null;for(let n=0;n<e.length;n++){let c=e[n];if(i){if(c==="\\"){n++;continue}if(c===i)i=null;continue}if(c==='"'||c==="'"||c==="`"){i=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c==="="&&t===0){let l=e[n-1],a=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(a==="="||a===">")continue;return n}}return-1}function Cl(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let c=n,l=0,a=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){a=n;break}}}if(a===-1)return;let y=e.slice(a+1,c);for(let v of kl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=Rl(E);if(A===-1)continue;let D=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(D))continue;if(t[D]!==void 0)continue;let B=E.slice(A+1).trim();if(!B)continue;try{let M=Object.keys(t).filter(jt),I=Function(...M,`"use strict"; return (${B});`);t[D]=I(...M.map((j)=>t[j]))}catch{}}}catch{}}var Tl=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function pg(e,t){let i=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!i)return null;let n=i[2].toLowerCase();if(!Tl.has(n))return null;let c=new RegExp(`<\\/?${n}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,A)=>(c.lastIndex=A,c.exec(E)?.index===A?c.lastIndex:-1));if(n==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let a=0,y=!1;for(let E of l){if(a+=E.token.startsWith("</")?-1:1,a<0)return null;if(a===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=i[0].length;return e.slice(0,v)+t+e.slice(v)}function wo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let c=ce.relative(ce.resolve(n),ce.resolve(e));return!c.startsWith("..")&&!ce.isAbsolute(c)})}async function Er(e,t,i,n,c){let l=e.endsWith(".stx")?e.slice(0,-4):e,a=(re)=>re.split("-").map((me)=>me.charAt(0).toUpperCase()+me.slice(1)).join(""),y=i.__importedComponents;if(y){for(let re of[l,l.toLowerCase(),a(l),V(l)])if(y.has(re))return!0}let v=[...new Set([`${l}.stx`,`${a(l)}.stx`,`${V(l)}.stx`])],E=typeof c.root==="string"?ce.resolve(c.root):void 0,A=E??ce.dirname(n),D=[],B=(re)=>{if(re&&!D.includes(re))D.push(re)},M=i.__originalFilePath;if(M)B(ce.join(ce.dirname(M),"components"));if(wo(t,c))B(c._rootComponentsDir);B(t),B(c._rootComponentsDir),B(ce.join(ce.dirname(n),"components")),B(c.componentsDir);for(let re of c.additionalComponentsDirs??[])B(re);let I=c._targetComponentFallbackNames?.some((re)=>re.toLowerCase()===l.toLowerCase());if(!I)for(let re of c._targetComponentDirs??[])B(re);if(E)B(ce.resolve(E,"resources/views/components")),B(ce.resolve(E,"resources/components")),B(ce.resolve(E,"src/components")),B(ce.resolve(E,"components"));for(let re of c._layerComponentDirs??[])B(re);let j=c._pluginComponentDirs;if(Array.isArray(j))for(let re of j)B(typeof re==="string"?re:null);if(B(c.fallbackComponentsDir),I)for(let re of c._targetComponentDirs??[])B(re);let Q=c._nativePrimitivesFallback;if(Q&&!Q.except.some((re)=>re.toLowerCase()===l.toLowerCase()))B(Q.dir);if(l.startsWith("./")||l.startsWith("../"))return s(ce.resolve(ce.dirname(n),`${l}.stx`));let X=po(ce.resolve(import.meta.dir,"components")),z=D.map((re)=>ce.isAbsolute(re)?re:ce.resolve(A,re)),L=`${v.join("\x00")}\x00\x00${z.join("\x00")}`,ee=As.get(L);if(ee!==void 0)return ee;let te=!1;e:for(let re of z){if(po(re)===X)continue;for(let me of v)if(await s(ce.join(re,me))){te=!0;break e}}return As.set(L,te),te}function po(e){let t=Ps.get(e);if(t!==void 0)return t;let i=e;try{i=Hn.realpathSync(e)}catch{}return Ps.set(e,i),i}function fg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Gc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function Al(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(c,l)=>{let a;try{a=T(c,t)}catch{return l}if(a===void 0||a===null)return"";let y=String(a);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return y};return e.replace(/\{!!([\s\S]*?)!!\}/g,(c,l)=>n(l,c)).replace(/\{\{([\s\S]*?)\}\}/g,(c,l)=>n(l,c))}var go=new Set;function mo(e,t,i,n){let c=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&go.has(c))return;go.add(c);let l=t?` used in ${t}`:"",a=n?` Cause: ${n}.`:"",y=i.length>0?`
|
|
286
|
+
searched:
|
|
287
|
+
${i.map((v)=>` - ${v}`).join(`
|
|
288
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${a}${y}`)}function ho(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var Il=new Set(["for","if","show","key","ref","class","className","style"]),xo=new Set,So="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Jc=new RegExp(`\\b(?:${So})\\s*(?:<[^>]*>)?\\s*\\(`);function bi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${So})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let c;while((c=i.exec(n))!==null)t.add(c[1]);i.lastIndex=0}return[...t]}async function Fe(e,t,i,n,c,l,a,y=new Set,v,E=rt(c),A,D=e){let{extractVariables:B}=await o("stx/variable-extractor",()=>import("./chunk-9767yz39.js")),M=y??new Set;if(M.has(e))return`[Circular component reference: ${e}]`;let I=new Set(M);I.add(e);let j=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let Q=j&&j!=="load"&&fg(j)?j:"";try{let X=(se)=>se.split("-").map((ae)=>ae.charAt(0).toUpperCase()+ae.slice(1)).join(""),z=D.endsWith(".stx")?D.slice(0,-4):D,L=null,ee=c.__importedComponents;if(ee){let se=[z,z.toLowerCase(),X(z),V(z)];for(let ae of se)if(ee.has(ae)){L=ee.get(ae);break}}let te=[];if(!L){let se=[`${z}.stx`,`${X(z)}.stx`,`${V(z)}.stx`],ae=[...new Set(se)],we=c.__originalFilePath,be=[];if(be.push(...a._layerComponentDirs??[]),we){let ye=ce.join(ce.dirname(we),"components");be.push(ye)}let Ue=a._rootComponentsDir;if(typeof Ue==="string"&&wo(n,a)&&!be.includes(Ue))be.push(Ue);if(n&&!be.includes(n))be.push(n);if(typeof Ue==="string"&&!be.includes(Ue))be.push(Ue);let Te=ce.join(ce.dirname(l),"components");if(!be.includes(Te))be.push(Te);if(a.componentsDir&&a.componentsDir!==n&&!be.includes(a.componentsDir))be.push(a.componentsDir);for(let ye of a.additionalComponentsDirs??[])if(ye&&!be.includes(ye))be.push(ye);let ct=a._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(z),lt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),yt=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),Qn=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),es=!lt.includes("valuechange")&&(yt||lt.includes("change")&&!Qn),gt=a._nativeHostAttrs&&/^textinput$/i.test(z),_t=lt.includes("update:value")&&!lt.includes("input"),Ht=a._nativeHostAttrs&&/^video$/i.test(z),ts=a._nativeHostAttrs&&/^image$/i.test(z),an=Ds([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),wt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),ln=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),un=Ht&&wt&&!ln&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),mt=(ye)=>Object.hasOwn(t,ye)||Boolean(A?.reactiveProps?.includes(ye)),_n=a._nativeHostAttrs&&/^button$/i.test(z)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!i.trim()),Zt=a._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&(!ct||es)&&(!gt||_t)&&(!Ht||un)&&(!ts||an)&&!_n;for(let ye of Zt?[]:a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye);let St=typeof a.root==="string"?ce.resolve(a.root):void 0,jo=St??ce.dirname(l),$t=[];if(St)$t.push(ce.resolve(St,"resources/views/components")),$t.push(ce.resolve(St,"resources/components")),$t.push(ce.resolve(St,"src/components")),$t.push(ce.resolve(St,"components"));$t.push(ce.resolve(import.meta.dir,"components"));for(let ye of $t)if(!be.includes(ye))be.push(ye);let nr=a._pluginComponentDirs;if(Array.isArray(nr)){for(let ye of nr)if(typeof ye==="string"&&!be.includes(ye))be.push(ye)}if(a.fallbackComponentsDir&&!be.includes(a.fallbackComponentsDir))be.push(a.fallbackComponentsDir);if(Zt){for(let ye of a._targetComponentDirs??[])if(ye&&!be.includes(ye))be.push(ye)}let Sn=a._nativePrimitivesFallback;if(Sn&&!Sn.except.some((ye)=>ye.toLowerCase()===z.toLowerCase())&&!be.includes(Sn.dir))be.push(Sn.dir);let sr=[...new Set(be.map((ye)=>{if(!ye)return ye;return ce.isAbsolute(ye)?ye:ce.resolve(jo,ye)}))];be.length=0,be.push(...sr);let ns=`${z}\x00${l}\x00${sr.join("\x00")}`,ss=Un.get(ns);if(ss)if(await s(ss))L=ss;else Un.delete(ns);if(!L&&(z.startsWith("./")||z.startsWith("../")))L=ce.resolve(ce.dirname(l),`${z}.stx`),te.push(L);else if(!L)for(let ye of be){if(!ye)continue;for(let $n of ae){let En=ce.join(ye,$n);if(te.push(En),await s(En)){L=En;break}}if(L)break;if(!L)try{let $n=await import("fs");if(!$n.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let No=8,rs=[{path:ye,depth:0}];while(rs.length>0&&!L){let kn=rs.pop();if(kn.depth>=No)continue;let rr;try{rr=$n.readdirSync(kn.path,{withFileTypes:!0})}catch{continue}for(let Rn of rr){if(!Rn.isDirectory())continue;if(Rn.name==="node_modules"||Rn.name.startsWith("."))continue;let ir=ce.join(kn.path,Rn.name);for(let Lo of ae){let is=ce.join(ir,Lo);if(te.push(is),await s(is)){L=is;break}}if(L)break;rs.push({path:ir,depth:kn.depth+1})}}}catch{}if(L)break}if(L)Un.set(ns,L)}if(!L||!await s(L))return mo(e,l,te),ho(e);v.add(L);let re;if(en.has(L)&&Ts.get(L)===lo(L))re=en.get(L);else try{let se=lo(L);re=await Bun.file(L).text(),en.set(L,re),Ts.set(L,se)}catch(se){let ae=se instanceof Error?se.message:String(se);return mo(e,l,[L],ae),ho(e)}if(A)for(let se of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ae=se.toLowerCase();if(ae.startsWith("aria-")||ae.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(re))A.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(re)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(re))A.consumedProps?.add(se)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(re))for(let se of A.reactiveProps){if(Il.has(se)||A.consumedProps?.has(se))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(re))continue;let ae=`${L}\x00${se}`;if(xo.has(ae))continue;xo.add(ae),console.warn(`[stx] ${ce.basename(L)} reads \`${se}\` with defineProps(), which is not live, but ${ce.basename(l)} binds it (:${se}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${se}').`)}let me=new Set(["__originalFilePath","__importedComponents",On,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),he={};for(let[se,ae]of Object.entries(c))if(!se.startsWith("__")||me.has(se))he[se]=ae;let le=E.length>0?{[Ln]:[...E]}:{},ke=i;if(i.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-1338vj5g.js"));ke=await se(i,c,l,a,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(ke)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-27p6cxa2.js")),ae={...c,__processedComponents:M,...le};ke=await se(ke,ae,l,a,v);let we=ae.__stx_preserved_client_expressions;if(Array.isArray(we)&&we.length>0)c.__stx_preserved_client_expressions=[...new Set([...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...we])]}let Re=[];if(Gc(ke)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-7j4tf0ba.js")),ae=c.__stx_signals_gate===void 0?{...c,__stx_signals_gate:!0,...le}:E.length>0?{...c,...le}:c;ke=se(ke,ae,l);for(let we of ke.matchAll(/\{\{([\s\S]*?)\}\}/g))Re.push(we[1].trim())}let He=G(ke),Xe=[],Ze=He.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,ae)=>{let we=He.scripts[Number(ae)]||"",be=we.match(/^<script\b([^>]*)>/i)?.[1]||"",Ue=be.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Te=!Ue||["module","text/javascript","application/javascript"].includes(Ue),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${be}`);if(!/\bserver\b/i.test(be)&&Te&&!ct)return Xe.push(we),"";return we}),{extractSlotContent:qn}=await o("stx/slots",()=>import("./chunk-dwn8ye99.js")),ft=qn(Ze),pt={};if(ft.defaultSlot?.trim())pt.default=ft.defaultSlot;for(let[se,ae]of ft.namedSlots)pt[se]=ae.content;let dt=c.__stx_scope_seq??={n:0,key:Vs(String(c.__filename??l))},Ct=_o(e,process.cwd()),it=`stx_${(Ct.endsWith(".stx")?Ct.slice(0,-4):Ct).replace(/[^a-zA-Z0-9]/g,"_")}_${++dt.n}_${dt.key}`,We={...he,$uid:it,$native:a._nativeHostAttrs===!0,...t,props:t,slot:Ze,$slots:pt,__processedComponents:I,__sections:{},__stx_signals_gate:Se(re)||Gc(i),__stx_preserved_client_expressions:[...Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[],...Re]};Cl(re,We);let Tt=re,nn=de(Tt);if(nn)Tt=nn.content.trim();let Kn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Dt=[...re.matchAll(Kn)];for(let[,se,ae]of Dt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(ae,L,a.strict);let Je=[],Lt=null,Xn=Dt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,et=null,Bt=null,sn=0,Wt=null;if(wl(a),Xn&&Zs>0){let se=Sl({props:t,slot:ke,slotContext:i.trim()?$l(he):void 0,buildMode:a.buildMode??"",skipEventDirectives:a.skipEventDirectives===!0,native:a._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:a._layerGraph?.layers.map((ae)=>ae.configFile),uid:it});if(se!==null){bt=`${L}\x00${x(re)}\x00${se}`;let ae=Vn.get(bt);if(ae){for(let we of ae.dependencies)v.add(we);if(qr(c,ae.clientFactories),dt.n+=ae.uidsConsumed,ae.preservedClientExpressions.length>0){let we=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let be of ae.preservedClientExpressions)we.add(be);c.__stx_preserved_client_expressions=[...we]}return ae.output}et=new Set(v),Bt=Hr(c),sn=dt.n,Wt=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[])}}let zt=new Set;for(let se of Dt){let ae=se[1]||"",we=se[2]||"",be=ae.includes("server");if(je(ae)&&we.trim())we=Be(we);if(be&&we){for(let Te of Me(we))zt.add(Te);try{await B(we,We,L,{onFailure:(Te)=>{if(Te.kind!=="unknown")Lt=Te.kind}})}catch(Te){}}if(!be){let Te=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Te.includes("{{")&&Te.includes("}}"),lt=Te.includes("{!!")&&Te.includes("!!}");if(ct||lt)Te=vi(Te,We,L);let yt=ae.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Je.push(`<script${yt}>${Te}</script>`)}}let Ge=G(re).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ft=Ge?Ge[1]:"",Jn=Ge?Ge[2]:"",tt="",ne=Ft&&/\bscoped\b/i.test(Ft);if(Ge)tt=`<style${Ft}>${Al(Jn,We,L)}</style>`;let ie=Tt;if(ie=ie.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Ge)ie=ie.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ae=[];if(ie=ie.replace(se,(we,be)=>{let Ue=be.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ue)ae.push(`<style${Ue[1]}>${Ue[2]}</style>`);return""}),ie=ie.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ae.length>0)tt=`${tt}${ae.join(`
|
|
289
|
+
`)}`}if(i&&ie.includes("{{ text || slot }}"))ie=ie.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:ue}=await o("stx/slots",()=>import("./chunk-dwn8ye99.js")),{defaultSlot:$e,namedSlots:Ce}=ft,qe=c.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ze),nt=a._nativeHostAttrs===!0&&Je.length>0||qe&&Je.length>0||Je.some((se)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(se)),Gn=(se)=>nt?Ni(se,it):se,Yn=new Map([...Ce].map(([se,ae])=>[se,{...ae,content:Gn(ae.content)}]));ie=await ue(ie,Gn($e),Yn,We,nt?it:"");let rn=bi(Je),Ut=(Array.isArray(We.__stx_client_signal_names)?We.__stx_client_signal_names:[]).filter((se)=>!zt.has(se));if(rn.length>0||Ut.length>0)We.__stx_client_signal_names=[...new Set([...Ut,...rn])];else delete We.__stx_client_signal_names;let Vt=E.filter((se)=>!zt.has(se)&&!(se in t));if(Vt.length>0)We[Ln]=Vt;let on={...a,_rootComponentsDir:a._rootComponentsDir||a.componentsDir,componentsDir:ce.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:a._nativeHostAttrs===!0||nt||Je.length===0,defaultLayout:void 0};We.__stxProcessingDepth=(c.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-mv9k42dn.js")),Ye=await cn(ie,We,L,on,v),ot=new Set(Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[]);for(let se of Ye.matchAll(/\{\{([\s\S]*?)\}\}/g))ot.add(se[1].trim());if(ot.size>0)c.__stx_preserved_client_expressions=[...ot];let st=it,Ke=Ye;if(nt){let se="";if(Object.keys(t).length>0)try{se=` data-stx-props="${Rs(JSON.stringify(t))}"`}catch{}let ae=Q?` stx-hydrate="${Rs(Q)}"`:"",we=Object.fromEntries(Object.entries(pt).map(([gt,_t])=>[gt,Boolean(_t)])),be=Object.keys(we).length>0?` data-stx-slots="${Rs(JSON.stringify(we))}"`:"",Ue=` data-stx-scope="${st}"${se}${be}${ae}`,Te=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(Ye),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Ye),lt=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Ye),yt=Te?"span":"div",Qn=ct&&a._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':lt&&a._nativeHostAttrs?' style="width:100%;height:100%"':Te||ct?' style="display:contents"':"";Ke=pg(Ye,Ue)??`<${yt}${Ue} data-stx-component-wrapper${Qn}>${Ye}</${yt}>`;let es=await Promise.all(Je.map(async(gt)=>{let _t=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!_t)return gt;let[,Ht,ts]=_t,an=ao(gt,We,L);if(an!==null)return an;let wt=await Pl(ts,L,a.buildMode==="compile"),ln=yn(wt.clientCode,De(We)),{vendorStyleTags:un}=wt,mt=ln?`function(__scopeId) {
|
|
290
|
+
${ln}
|
|
291
|
+
return (${wt.factoryBody})(__scopeId);
|
|
292
|
+
}`:wt.factoryBody,_n=Q?null:ms(c,mt),Zt=_n?`window.__stxComponentFactories[${JSON.stringify(_n)}](${JSON.stringify(st)});`:`(${mt})(${JSON.stringify(st)});`;if(Q)return`${un}<script type="stx/island" data-stx-island="${st}" data-stx-scoped data-stx-owner="${st}"${Ht}>${Zt}</script>`;return`${un}<script data-stx-scoped data-stx-run="always" data-stx-owner="${st}"${Ht}>${Zt}</script>`}));if(Ke=Ke+`
|
|
293
|
+
`+es.join(`
|
|
294
|
+
`),tt)Ke+=`
|
|
295
|
+
`+tt}else{if(tt)Ke+=`
|
|
296
|
+
`+tt;if(Je.length>0){let se=We.__stx_event_bindings||[],ae=De(We),we=await Promise.all(Je.map(async(be)=>{let Ue=ao(be,We,L);if(Ue!==null)return Ue;let Te=be.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!Te)return be;return await Le(Te[1],{eventBindings:se,templateContent:Ke,filePath:L,projectRoot:process.cwd(),serverData:ae,instanceId:it})}));Ke+=`
|
|
297
|
+
`+we.join(`
|
|
298
|
+
`),We.__stx_event_bindings=[]}}if(ne){let se=Bs(Ke,L);if(se.hasScoped)Ke=se.html}if(bt&&et){let se=Array.isArray(c.__stx_preserved_client_expressions)?c.__stx_preserved_client_expressions:[];Vn.set(bt,{output:Ke,dependencies:[...v].filter((ae)=>!et.has(ae)),clientFactories:Bt?Zr(c,Bt):[],uidsConsumed:dt.n-sn,preservedClientExpressions:Wt?se.filter((ae)=>!Wt.has(ae)):[]})}if(Lt)Ke=`<!--stx-render-failed:${Lt}-->${Ke}`;return Xe.length>0?`${Ke}
|
|
299
|
+
${Xe.join(`
|
|
300
|
+
`)}`:Ke}catch(X){if(X instanceof q)throw X;return`[Error processing component: ${X instanceof Error?X.message:String(X)}]`}finally{M.delete(e)}}async function s(e){return Bun.file(e).exists()}function Ks(e,t){let i=ce.resolve(t),n=ce.resolve(e),c=i.endsWith(ce.sep)?i:i+ce.sep;if(n===i||n.startsWith(c))return n;return null}async function bo(e,t,i,n){let c=t.startsWith("layouts/")?t.slice(8):t,l=ce.join(e,c);for(let a of l.endsWith(".stx")?[l]:[l,`${l}.stx`])if(await s(a)){if(n)console.log(`Found layout in ${e}: ${a}`);return i?.add(a),a}return null}async function bn(e,t,i,n){let c=await Ol(e,t,i,n);if(c===null)return null;let l=Ks(c,process.cwd());if(l)return l;let a=[i.root,i.layoutsDir,i.fallbackLayoutsDir,i.componentsDir,i.partialsDir,i.pagesDir,...i._layerLayoutDirs??[]].filter((y)=>typeof y==="string"&&y.length>0);for(let y of a){let v=ce.isAbsolute(y)?y:ce.resolve(process.cwd(),y);if(Ks(c,v))return ce.resolve(c)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${c} (template: ${e}, from: ${t})`),null}async function Ol(e,t,i,n){if(i.debug)console.log(`Resolving template path: ${e} from ${t}`);let c=ce.dirname(t),l=process.cwd();if(e.startsWith("/")){let M=ce.join(l,e),I=Ks(M,l);if(!I)return console.warn(`[stx] rejected template path that escapes project root: ${e} (from ${t})`),null;if(i.debug)console.log(`Checking absolute path: ${I}`);if(await s(I)&&n)n.add(I);return I}let a=async(M)=>{if(!i.layoutsDir||!i.fallbackLayoutsDir)return M;let I=ce.relative(ce.resolve(l,i.fallbackLayoutsDir),M);if(I.startsWith("..")||ce.isAbsolute(I))return M;return await bo(ce.resolve(l,i.layoutsDir),e,n,i.debug)??M},y=ce.join(c,e);if(await s(y)){if(i.debug)console.log(`Found direct path: ${y}`);let M=await a(y);if(n)n.add(M);return M}if(!e.endsWith(".stx")&&!e.endsWith(".jsx")&&!e.endsWith(".tsx"))for(let M of[".stx",".tsx",".jsx"]){let I=`${y}${M}`;if(await s(I)){if(i.debug)console.log(`Found direct path with extension: ${I}`);let j=await a(I);if(n)n.add(j);return j}}let v=[];if(v.push(...i._layerLayoutDirs??[]),i.layoutsDir)v.push(ce.isAbsolute(i.layoutsDir)?i.layoutsDir:ce.resolve(process.cwd(),i.layoutsDir));let E=ce.resolve(c),A=process.cwd();for(let M=0;M<10;M++){let I=ce.join(E,"layouts"),j=!1;try{j=Hn.statSync(I,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){v.push(I);break}let Q=ce.dirname(E);if(Q===E||Q.length<A.length)break;E=Q}for(let M of v){let I=await bo(M,e,n,i.debug);if(I)return I}if(i.fallbackLayoutsDir){let M=ce.isAbsolute(i.fallbackLayoutsDir)?i.fallbackLayoutsDir:ce.resolve(process.cwd(),i.fallbackLayoutsDir),I=e.startsWith("layouts/")?e.slice(8):e,j=[ce.join(M,I)];if(!e.endsWith(".stx"))j.push(`${j[0]}.stx`);for(let Q of j)if(await s(Q)){if(i.debug)console.log(`Found in options.fallbackLayoutsDir: ${Q}`);if(n)n.add(Q);return Q}}if(e.startsWith("layouts/")||e.includes("/layouts/")){let M=e.split("layouts/"),I=ce.join(i.partialsDir||c,"layouts",M[1]);if(await s(I)){if(i.debug)console.log(`Found in layouts path: ${I}`);if(n)n.add(I);return I}if(!I.endsWith(".stx")){let j=`${I}.stx`;if(await s(j)){if(i.debug)console.log(`Found in layouts path with extension: ${j}`);if(n)n.add(j);return j}}}if(i.partialsDir){let M=ce.join(i.partialsDir,"layouts");if(await s(M)){let I=ce.join(M,e);if(await s(I)){if(i.debug)console.log(`Found in partials layouts dir: ${I}`);if(n)n.add(I);return I}if(!e.endsWith(".stx")){let j=`${I}.stx`;if(await s(j)){if(i.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(n)n.add(j);return j}}}}let D=i.partialsDir||ce.join(process.cwd(),"views"),B=ce.join(D,e);if(await s(B)){if(i.debug)console.log(`Found in views path: ${B}`);if(n)n.add(B);return B}if(!e.endsWith(".stx")){let M=`${B}.stx`;if(await s(M)){if(i.debug)console.log(`Found in views path with extension: ${M}`);if(n)n.add(M);return M}}if(c.includes("temp")){let M=ce.join(ce.dirname(c),"layouts",e);if(await s(M)){if(i.debug)console.log(`Found in temp layouts dir: ${M}`);if(n)n.add(M);return M}if(!e.endsWith(".stx")){let I=`${M}.stx`;if(await s(I)){if(i.debug)console.log(`Found in temp layouts dir with extension: ${I}`);if(n)n.add(I);return I}}}if(i.debug)console.warn(`Template not found after trying all paths: ${e} (referenced from ${t})`);else console.warn(`Template not found: ${e} (referenced from ${t})`);return null}function Yc(e,t,i){let n=0,c="",l="";try{if(typeof t==="number"&&t>=0){let a=e.split(`
|
|
301
|
+
`),y=0;for(let v=0;v<a.length;v++)if(y+=a[v].length+1,y>=t){n=v+1,c=a[v].trim();let E=Math.max(0,v-2),A=Math.min(a.length,v+3);l=a.slice(E,A).map((D,B)=>{let M=E+B+1;return`${M===n?"> ":" "}${M}: ${D}`}).join(`
|
|
302
|
+
`);break}}else if(i){let a=e.indexOf(i);if(a>=0)return Yc(e,a)}}catch{}return{lineNumber:n,lineContent:c,context:l}}var Ee={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function h(e,t,i,n,c,l){let{lineNumber:a,context:y}=Yc(n,c,l),v=i.split("/").pop(),E=0;if(typeof c==="number"&&c>=0&&n){let D=n.lastIndexOf(`
|
|
303
|
+
`,Math.max(0,c-1));E=c-(D+1)+1}let A="";if(a>0)A+=`
|
|
304
|
+
${i}:${a}${E>0?`:${E}`:""}: ${e.toLowerCase()} error: ${t}
|
|
305
|
+
`;if(A+=`
|
|
306
|
+
${Ee.bold}${Ee.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Ee.reset}
|
|
307
|
+
`,A+=`${Ee.bold}${Ee.red}\u2502${Ee.reset} ${Ee.bold}${Ee.bgRed} ERROR ${Ee.reset} ${Ee.red}${e} Error${Ee.reset}${" ".repeat(Math.max(0,43-e.length))}${Ee.bold}${Ee.red}\u2502${Ee.reset}
|
|
308
|
+
`,A+=`${Ee.bold}${Ee.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Ee.reset}
|
|
309
|
+
`,A+=`
|
|
310
|
+
${Ee.cyan}${Ee.bold}File:${Ee.reset} ${Ee.dim}${v}${Ee.reset}`,a>0)A+=` ${Ee.gray}(line ${a}${E>0?`, col ${E}`:""})${Ee.reset}`;if(A+=`
|
|
311
|
+
${Ee.yellow}${Ee.bold}Message:${Ee.reset} ${t}
|
|
312
|
+
`,y)A+=`
|
|
313
|
+
${Ee.blue}${Ee.bold}Context:${Ee.reset}
|
|
314
|
+
${Ee.dim}${y}${Ee.reset}
|
|
315
|
+
`;return A}function fe(){en.clear(),Ts.clear(),Un.clear(),As.clear(),Ps.clear(),Vn.clear()}function Xh(){return{size:en.size,maxSize:500}}var Cs=b(128);async function Pl(e,t,i){let n=x(e,t,i),c=Cs.get(n);if(c){if(Ls(c.deps))return c;Cs.delete(n)}let l=mi(e,{filePath:t,projectRoot:process.cwd()}),a=l.code,y=hi(l.styles);a=Nt(a).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-5hgghq24.js")),A=[],D=!1;if(v(a)){let z=a;a=await E(z,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),D=a===z}let{stripStxRuntimeImports:B}=await o("stx/signal-processing",()=>import("./chunk-b29x9hsz.js"));a=B(a);let M=P(a),I=El(M),j=new Set(H(M,!0).split(",").map((z)=>z.trim())),Q=`function(__scopeId) {
|
|
316
|
+
${at("const",[...ul,...I],M)}
|
|
317
|
+
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
318
|
+
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
319
|
+
__scopeVars.$refs = __scopeVars.$refs || {};
|
|
320
|
+
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
321
|
+
const __previousCurrentProps = window.__STX_CURRENT_PROPS__;
|
|
322
|
+
// A clone the runtime is setting up may not be in the document yet (rows
|
|
323
|
+
// a loop builds inside a closed :if), where a lookup cannot see it, so the
|
|
324
|
+
// runtime hands its root over in __STX_SETUP_ROOT__ (signals.ts).
|
|
325
|
+
const __setupRoot = window.__STX_SETUP_ROOT__;
|
|
326
|
+
const __componentElement = (__setupRoot && __setupRoot.getAttribute('data-stx-scope') === __scopeId && __setupRoot) || document.querySelector('[data-stx-scope="' + __scopeId + '"]');
|
|
327
|
+
__scopeVars.$slots = Object.create(null);
|
|
328
|
+
if (__componentElement) {
|
|
329
|
+
try { Object.assign(__scopeVars.$slots, JSON.parse(__componentElement.getAttribute('data-stx-slots') || '{}')); }
|
|
330
|
+
catch {}
|
|
331
|
+
}
|
|
332
|
+
window.__STX_CURRENT_ELEMENT__ = __componentElement;
|
|
333
|
+
let __componentProps = __componentElement && __componentElement.__stx_props;
|
|
334
|
+
if (!__componentProps && __componentElement) {
|
|
335
|
+
try { __componentProps = JSON.parse(__componentElement.getAttribute('data-stx-props') || '{}'); }
|
|
336
|
+
catch { __componentProps = {}; }
|
|
337
|
+
}
|
|
338
|
+
window.__STX_CURRENT_PROPS__ = __componentProps && typeof __componentProps === 'object' && !Array.isArray(__componentProps) ? __componentProps : {};
|
|
339
|
+
|
|
340
|
+
// Scope-specific lifecycle callbacks. The queues drain as they run; the
|
|
341
|
+
// hook lists keep what setup registered, because a component behind an :if
|
|
342
|
+
// unmounts at each hide and mounts again at each show (signals.ts,
|
|
343
|
+
// suspendSubtreeScopes).
|
|
344
|
+
if (__scopeVars.__suspended && !__scopeVars.__mounted) {
|
|
345
|
+
// Set up again after an :if hid it -- a <template :if> clones the
|
|
346
|
+
// component afresh on every show, and the clone's script runs. This run's
|
|
347
|
+
// hooks close over this run's state, so they replace the ones the hide
|
|
348
|
+
// kept for a re-show rather than queueing beside them.
|
|
349
|
+
__scopeVars.__mountCallbacks = [];
|
|
350
|
+
__scopeVars.__destroyCallbacks = [];
|
|
351
|
+
__scopeVars.__mountHooks = [];
|
|
352
|
+
__scopeVars.__destroyHooks = [];
|
|
353
|
+
// So do its effects: the last run's watched a clone that is gone.
|
|
354
|
+
if (typeof __scopeVars.__disposeEffects === 'function') __scopeVars.__disposeEffects();
|
|
355
|
+
__scopeVars.__disposeEffects = null;
|
|
356
|
+
}
|
|
357
|
+
__scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
|
|
358
|
+
__scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
|
|
359
|
+
__scopeVars.__mountHooks = __scopeVars.__mountHooks || [];
|
|
360
|
+
__scopeVars.__destroyHooks = __scopeVars.__destroyHooks || [];
|
|
361
|
+
let __registeringSetupHooks = true;
|
|
362
|
+
const onMount = (fn) => { __scopeVars.__mountCallbacks.push(fn); __scopeVars.__mountHooks.push(fn); };
|
|
363
|
+
const onDestroy = (fn) => {
|
|
364
|
+
__scopeVars.__destroyCallbacks.push(fn);
|
|
365
|
+
// A teardown registered inside onMount belongs to this mount alone.
|
|
366
|
+
// Replaying it AND registering the next mount's teardown doubles cleanup.
|
|
367
|
+
if (__registeringSetupHooks) __scopeVars.__destroyHooks.push(fn);
|
|
368
|
+
};
|
|
369
|
+
// The effects this setup makes (effect, watch) belong to the scope and are
|
|
370
|
+
// disposed with it (disposeSubtreeScopes in the runtime), as its bindings
|
|
371
|
+
// are. Untracked, one reading a store kept running for a component the
|
|
372
|
+
// router had long swapped out.
|
|
373
|
+
const __endEffects = window.stx._beginEffects ? window.stx._beginEffects() : null;
|
|
374
|
+
|
|
375
|
+
try {
|
|
376
|
+
${M}
|
|
377
|
+
|
|
378
|
+
// Register all defined signals and functions in this scope
|
|
379
|
+
const __localVars = {};
|
|
380
|
+
try {
|
|
381
|
+
${I.map((z)=>j.has(z)?`Object.defineProperty(__localVars, '${z}', ${Is(z)});`:`if (typeof ${z} !== 'undefined') __localVars['${z}'] = ${z};`).join(`
|
|
382
|
+
`)}
|
|
383
|
+
}
|
|
384
|
+
catch (e) {}
|
|
385
|
+
Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__localVars));
|
|
386
|
+
if (typeof __stxLiveBindings !== 'undefined') Object.defineProperties(__scopeVars, Object.getOwnPropertyDescriptors(__stxLiveBindings));
|
|
387
|
+
}
|
|
388
|
+
finally {
|
|
389
|
+
__registeringSetupHooks = false;
|
|
390
|
+
if (__endEffects) {
|
|
391
|
+
const __previousDispose = __scopeVars.__disposeEffects;
|
|
392
|
+
const __disposeSetup = __endEffects();
|
|
393
|
+
__scopeVars.__disposeEffects = typeof __previousDispose === 'function'
|
|
394
|
+
? function() { __previousDispose(); __disposeSetup(); }
|
|
395
|
+
: __disposeSetup;
|
|
396
|
+
}
|
|
397
|
+
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
398
|
+
window.__STX_CURRENT_PROPS__ = __previousCurrentProps;
|
|
399
|
+
}
|
|
400
|
+
}`,X={vendorStyleTags:y,factoryBody:Q,clientCode:M,deps:br([...A,...l.styles.map((z)=>z.resolvedPath)])};if(!D&&l.unresolved.length===0)Cs.set(n,X);return X}var hn=["module","exports","require","props","$props","$bool","$num","defineProps","withDefaults","defineClientPayload","useServerData","useRuntimeConfig","useServerRuntimeConfig","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"];var Dl=100,Ml=599,Gs="__stxResponseStatus",tn="__stxResponseHeaders";function Zn(e){return typeof e==="number"&&Number.isInteger(e)&&e>=Dl&&e<=Ml}function gn(e){for(let t of e.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let i=t[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!i)continue;let n=Number(i[1]);if(Zn(n))return n}return}function Xs(e,t){if(!e||typeof e!=="object")return!1;let i=typeof t==="string"&&/^\d+$/.test(t.trim())?Number(t.trim()):t;if(!Zn(i))return!1;return e[Gs]=i,!0}function jl(e,t,i){if(!e||typeof e!=="object")return;let n=String(t??"").trim();if(!n)return;e[tn]={...e[tn],[n]:String(i)}}function It(e){let t=e?.[Gs];return Zn(t)?t:void 0}function Ot(e){let t=e?.[tn];if(!t||typeof t!=="object")return;let i=Object.entries(t).map(([n,c])=>[n,String(c)]);return i.length>0?Object.fromEntries(i):void 0}function jc(e,t){if(!e||!t||e===t||typeof t!=="object")return;let i=It(e);if(i!==void 0)t[Gs]=i;let n=Ot(e);if(n)t[tn]={...t[tn],...n}}function Fs(e){return{setResponseStatus:(t)=>{Xs(e,t)},notFound:(t=404)=>{let i=Zn(t)&&t>=400?t:404;Xs(e,i)},setResponseHeader:(t,i)=>{jl(e,t,i)}}}function Bc(e,t,i={}){if(!e.includes("@status"))return e;let{filePath:n,buildMode:c}=i,l=c==="compile",a="",y=0,v=/@status\s*\(/g,E;while((E=v.exec(e))!==null){let A=Nl(e,E.index+E[0].length-1);if(A<0)break;let D=e.slice(E.index+E[0].length,A).trim(),B=/^\d+$/.test(D)?Number(D):u(D,t),M=n?` in ${n}`:"";if(l)console.warn(`[stx] @status(${D})${M} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${D}) from <script server> instead \u2014 that runs per request.`);else if(!Xs(t,B))console.warn(`[stx] @status(${D})${M} is not an HTTP status (100-599) \u2014 ignoring it.`);a+=e.slice(y,E.index),y=A+1+(e.slice(A+1).match(/^[^\S\n]*\n?/)?.[0].length??0),v.lastIndex=y}return y===0?e:a+e.slice(y)}function Nl(e,t){let i=1,n=null,c=!1;for(let l=t+1;l<e.length;l++){let a=e[l];if(c){c=!1;continue}if(n){if(a==="\\")c=!0;else if(a===n)n=null;continue}if(a==='"'||a==="'"||a==="`"){n=a;continue}if(a==="(")i++;else if(a===")"&&--i===0)return l}return-1}var $o=new Set(hn),Ll=new Set(["props","$props","defineProps"]),Bl=new Set(["stx","@stacksjs/stx"]),vo=b(128),Eo=b(64);function Wl(e){let t=[],i=0,n=e.split(`
|
|
401
|
+
`);for(let c of n){let l=i,a=null,y=!1;for(let v=0;v<c.length;v++){let E=c[v];if(y){y=!1;continue}if(E==="\\"){y=!0;continue}if(a){if(E===a)a=null;continue}if(E==="'"||E==='"'||E==="`"){a=E;continue}if(E==="/"&&v+1<c.length&&c[v+1]==="/")break;if(E==="{")i++;else if(E==="}")i--}if(l===0){let v=c.match(/(?:const|let|var)\s+(\w+)\s*=/);if(v)t.push(v[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(c)){let E=c.match(/(?:const|let|var)\s+(\w+)/);if(E)t.push(E[1])}else{let E=c.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(E){let D=E[1].slice(1,-1).split(",").map((B)=>{let M=B.split(":");return(M.length>1?M[1]:M[0]).trim()}).filter((B)=>/^\w+$/.test(B));t.push(...D)}}}}return[...new Set(t)]}function Zf(e){let t=e;t=t.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),t=t.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),t=t.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),t=t.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function i(n){if(!n.includes(":"))return n;let c=[],l="",a=0,y=0,v=null;for(let E=0;E<n.length;E++){let A=n[E];if(v){if(l+=A,A===v)v=null;continue}if(A==='"'||A==="'"||A==="`"){v=A,l+=A;continue}if(A==="<")a++;else if(A===">"&&a>0)a--;else if(A==="(")y++;else if(A===")")y--;if(A===","&&a===0&&y===0){c.push(l),l="";continue}l+=A}if(l)c.push(l);return c.map((E)=>{let A=E.trim(),D=A.startsWith("..."),B=D?A.slice(3):A,M=-1,I=0;for(let te=0;te<B.length;te++)if(B[te]==="<")I++;else if(B[te]===">")I--;else if(B[te]===":"&&I===0){M=te;break}if(M===-1)return E;let Q=B.substring(0,M).trim().replace(/\?$/,""),X=B.substring(M+1),z=-1,L=0;for(let te=0;te<X.length;te++)if(X[te]==="<")L++;else if(X[te]===">")L--;else if(X[te]==="="&&L===0){z=te;break}let ee=D?"...":"";if(z!==-1)return`${ee}${Q} = ${X.substring(z+1).trim()}`;return`${ee}${Q}`}).join(", ")}t=t.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(n,c,l)=>{if(!l.includes(":"))return n;return`${c}(${i(l)})`});{let n=/\b(function\s+\w*\s*)\(/g,c,l=[];while((c=n.exec(t))!==null){let a=c.index+c[0].length-1,y=1,v=a+1,E=0,A=null;while(v<t.length&&y>0){let M=t[v];if(A){if(M===A)A=null;v++;continue}if(M==='"'||M==="'"||M==="`"){A=M,v++;continue}if(M==="<")E++;else if(M===">"&&E>0)E--;else if(E===0){if(M==="(")y++;else if(M===")")y--}if(y>0)v++}if(y!==0)continue;let D=t.substring(a+1,v);if(!D.includes(":"))continue;let B=i(D);l.push({start:a+1,end:v,replacement:B})}for(let a=l.length-1;a>=0;a--){let{start:y,end:v,replacement:E}=l[a];t=t.substring(0,y)+E+t.substring(v)}}return t=t.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(n,c)=>{if(!c.includes(":"))return n;if(c.includes("{")||c.includes("}"))return n;return`(${c.split(",").map((a)=>{let[y,...v]=a.split("="),E=y.split(":")[0].trim();if(v.length>0)return`${E} = ${v.join("=").trim()}`;return E}).join(", ")}) =>`}),t=t.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),t=t.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),t=t.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),t=t.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),t=t.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),t=t.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),t=t.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),t=t.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),t=t.replace(/\n\s*\n\s*\n/g,`
|
|
402
|
+
|
|
403
|
+
`),t}function Qf(e){return e.replace(/\s*(?:imported from|from)\s+(?:(['"])([^'"\r\n]+)\1|(\S+))/g,(t,...i)=>{let[,n,c]=i,l=n??c;return/(?:[/\\]packages[/\\]stx[/\\]|@stacksjs[/\\]stx[/\\])/.test(l)?"":t})}function eg(e){return/cannot find module|cannot find package|could not resolve|module not found|failed to resolve/i.test(e)}function tg(e){if(e instanceof SyntaxError)return!0;let t=e instanceof Error?e.message:String(e);return/SyntaxError|Unexpected (token|identifier|string|number|keyword|end of)|Unterminated|Expected .+ but found/i.test(t)}function ng(e){if(!/is not defined|can't find variable/i.test(e))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(e)}var ko=new Set;async function m(e,t,i,n={}){if(!e.trim())return;let c=C(),l=x(e,JSON.stringify(c)),a=vo.get(l);if(a===void 0){try{let ne=Y({loader:"ts",target:"browser",define:c}),ie=e.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");ie=ie.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),a=ne.transformSync(ie)}catch{a=Zf(e)}vo.set(l,a)}let y={exports:{}},v=y.exports,E=kt.cwd(),A={},D=[...a.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((ne)=>ne[1]).filter((ne)=>!ne.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(ne)),B=new Map;for(let ne of D)try{if(ne.startsWith(".")){A[ne]=await import(Qe.resolve(Qe.dirname(i),ne));continue}let ie=Qe.resolve(E,"node_modules",ne),ue=Qe.join(ie,"package.json"),$e=JSON.parse(g("fs").readFileSync(ue,"utf8")),Ce=$e.main||"index.js";if($e.exports){let qe=typeof $e.exports==="string"?$e.exports:$e.exports["."];if(typeof qe==="string")Ce=qe;else if(qe?.bun)Ce=qe.bun;else if(qe?.import)Ce=qe.import;else if(qe?.default)Ce=qe.default}A[ne]=await import(Qe.resolve(ie,Ce))}catch(ie){if(ne.startsWith("."))B.set(ne,ie instanceof Error?ie.message:String(ie))}let M=(ne)=>{if(A[ne])return A[ne];let ie=B.get(ne);if(ie!==void 0)throw Error(`Cannot require '${ne}' from ${i}: ${ie}`);return g(ne)},I=t.props||{},j=(ne)=>{if(!ne)return I;let ie={};for(let[ue,$e]of Object.entries(ne)){let Ce=I[ue];if(Ce!==void 0)ie[ue]=Ce;else if(typeof $e==="function")ie[ue]=$e();else ie[ue]=$e}return ie};for(let[ne,ie]of Object.entries(I))Object.defineProperty(j,ne,{value:ie,enumerable:!0,configurable:!0,writable:!0});let Q=(ne,ie=!1)=>{if(ne===void 0||ne===null)return ie;if(typeof ne==="string"){let ue=ne.trim().toLowerCase();if(ue===""||ue==="true"||ue==="1"||ue==="on"||ue==="yes")return!0;if(ue==="false"||ue==="0"||ue==="off"||ue==="no")return!1;return!0}return Boolean(ne)},X=(ne,ie=0)=>{if(ne===void 0||ne===null)return ie;if(typeof ne==="string"){let $e=ne.trim();if($e==="")return ie;let Ce=Number($e);return Number.isFinite(Ce)?Ce:ie}let ue=Number(ne);return Number.isFinite(ue)?ue:ie};for(let ne of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(I,ne))continue;try{Object.defineProperty(j,ne,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let z=(ne)=>{if(!ne)return I;let ie={...I};for(let[ue,$e]of Object.entries(ne)){let Ce=$e&&typeof $e==="object"&&!Array.isArray($e)?$e:{type:$e};if(ie[ue]===void 0&&Ce.default!==void 0)ie[ue]=typeof Ce.default==="function"?Ce.default():Ce.default}return ie},L=()=>t.slots||{},ee=(ne,ie)=>{let ue={...ne};for(let[$e,Ce]of Object.entries(ie))if(ue[$e]===void 0)if(typeof Ce==="function")ue[$e]=Ce();else ue[$e]=Ce;return ue},te=(ne)=>{let ie=()=>ne;return ie.set=(ue)=>{},ie.update=(ue)=>{},ie},re=(ne)=>{let ie,ue=!1;return()=>{if(!ue)try{ie=ne(),ue=!0}catch{ie=void 0}return ie}},me=(ne)=>{},he=(ne)=>ne(),le=(ne)=>{},ke=(ne)=>{},Re=Fs(t);function He(ne){let ie=ne||{};if(ie.title!==void 0||ie.description!==void 0)pt({title:ie.title,description:ie.description})}function Xe(ne){if(!ne||typeof ne!=="object")return;let ie=t.__stxClientPayload??{};Object.assign(ie,ne),t.__stxClientPayload=ie}let Ze=()=>{let ne=t.__stxServeContext,ie=t.__stxServeSearch??ne?.search??"",ue=ne?.path??"",$e=Object.fromEntries(new URLSearchParams(ie)),Ce=t.query,qe=Object.keys($e).length>0?$e:Ce??{},nt=ie||(Object.keys(qe).length>0?`?${new URLSearchParams(qe).toString()}`:"");return{params:t.params??{},query:qe,path:ue,name:"",fullPath:ue+nt,hash:"",matched:[]}},qn=()=>({push:(ne)=>{},replace:(ne)=>{},back:()=>{},forward:()=>{},go:(ne)=>{}}),ft=(ne)=>{let ie=t.__stx_runtime_head||{};t.__stx_runtime_head=Ve(ie,_e(ne||{},{known:Js,source:"useHead()"}))},pt=(ne)=>{ft(Ys(ne||{}))},dt=(ne)=>({value:ne}),Ct=(ne)=>ne,er=(ne)=>({value:typeof ne==="function"?ne():ne}),it=(ne,ie)=>{},We=(ne)=>{},Tt=(ne)=>{},nn=(ne)=>ne?ne():Promise.resolve(),Kn=(ne)=>(ie,...ue)=>{},Dt=(ne)=>{},Je=(ne,ie)=>{},Lt=(ne,ie)=>ie,Xn=()=>({value:"light"}),bt=()=>te(!1),et=(ne)=>te(!1),Bt=()=>te(!1),sn=()=>et("(prefers-color-scheme: dark)"),Wt=()=>et("(prefers-color-scheme: light)"),zt=()=>et("(prefers-reduced-motion: reduce)"),tr=()=>et("(prefers-contrast: more)"),Ge={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Ft=new Proxy(Ge,{get(ne,ie){if(ie in ne)return ne[ie];return},set(ne,ie,ue){return ne[ie]=ue,!0}}),Jn={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},tt=console;try{let ne=gi(a,i),ie=new Set(Object.keys(I)),ue=Object.keys(t).filter((se)=>!ie.has(se)&&!Ll.has(se)&&jt(se)),$e=ue.map((se)=>t[se]);if(!ue.includes("__stxServeContext"))ue.push("__stxServeContext"),$e.push(void 0);if(!ie.has("cookies")){let se=t.cookies??t.__stxServeContext?.cookies??{},ae=ue.indexOf("cookies");if(ae<0)ue.push("cookies"),$e.push(se);else $e[ae]=se}let Ce=new Set(["async","module","exports","require","params","window","document","console","state","derived","effect"]),qe=[],nt=[];for(let[se,ae]of Object.entries(I)){if(!jt(se))continue;if(Ce.has(se))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${se}\\b`).test(ne))continue;qe.push(se),nt.push(ae)}let Yn=Wl(ne).map((se)=>`module.exports.${se} = typeof ${se} !== 'undefined' ? ${se} : module.exports.${se};`).join(`
|
|
404
|
+
`),rn=t.params??{},Ut=[],Vt=[];for(let se=0;se<ue.length;se++){if(ue[se]==="params")continue;Ut.push(ue[se]),Vt.push($e[se])}let on=[...hn,...qe,...Ut],cn=`return (async () => {
|
|
405
|
+
${ne}
|
|
406
|
+
${Yn}
|
|
407
|
+
return module.exports
|
|
408
|
+
})()`,Ye=x(cn,on.join("\x00")),ot=Eo.get(Ye);if(!ot)ot=Function(...on,cn),Eo.set(Ye,ot);let st=t.__stx_options?.runtimeConfig;if(st||/\buse(?:Server)?RuntimeConfig\b/.test(a))await vn(t,i,st);let Ke=await ze(t.__stx_runtime_config??xn()??N(),()=>cr(t,()=>ot(y,v,M,I,j,Q,X,z,ee,Xe,ar,Si,Ws,te,re,me,he,le,ke,He,Ze,qn,ft,pt,Re.setResponseStatus,Re.setResponseHeader,Re.notFound,dt,Ct,er,it,We,Tt,nn,Kn,Dt,L,Je,Lt,Xn,bt,et,Bt,sn,Wt,zt,tr,Ft,Jn,tt,Ge.confirm,Ge.alert,Ge.fetch,rn,...nt,...Vt)));if(n.preserveExisting){for(let[se,ae]of Object.entries(Ke))if(!(se in t)||t[se]===void 0)t[se]=ae}else Object.assign(t,Ke);for(let[se,ae]of Object.entries(I))if(!(se in t))t[se]=ae}catch(ne){if(t.__stx_strict_hydration)throw ne;let ie=Qf(ne instanceof Error?ne.message:String(ne));if(eg(ie))console.warn(`[stx] server <script> in ${i??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${ie}`),n.onFailure?.({kind:"module-resolution",message:ie,error:ne});else if(tg(ne))console.warn(`[stx] server <script> in ${i??"<unknown>"} does not parse, so every variable in that script is undefined. Cause: ${ie}`),n.onFailure?.({kind:"syntax",message:ie,error:ne});else if(ng(ie))console.warn(`[stx] server <script> in ${i??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${ie}`),n.onFailure?.({kind:"missing-binding",message:ie,error:ne});else{let ue=`${i??"<unknown>"}\x00${ie}`;if(kt.env.STX_DEBUG||!ko.has(ue))ko.add(ue),console.warn(`[stx] server <script> in ${i??"<unknown>"} threw, so every variable in that script is undefined and anything that reads one renders empty. Cause: ${ie}`);n.onFailure?.({kind:"unknown",message:ie,error:ne})}try{await Zl(a,t,i)}catch(ue){if(kt.env.STX_DEBUG){let $e=ue instanceof Error?ue.message:String(ue);console.warn(`[stx] fallback extraction also failed in ${i??"<unknown>"}: ${$e}`)}}}}function rg(e){let t=0,i=null,n=!1,c=!1;for(let l=0;l<e.length;l++){let a=e[l];if(i){if(a===i){if(i=null,n||t===0)c=!0}continue}if(a==="'"||a==='"'||a==="`"){i=a;continue}if(a==="{")t++;else if(a==="}")t--;else if(e.startsWith("from",l)&&t===0)n=!0}return i===null&&t===0&&c}var zl=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function gi(e,t){let i=t?Qe.dirname(t):kt.cwd(),n=kt.cwd(),c=e.split(`
|
|
409
|
+
`),l=[],a=0;while(a<c.length){let y=c[a].trim();if(y.startsWith("interface ")||y.startsWith("export interface ")||y.startsWith("type ")||y.startsWith("export type ")){if(y.includes("{")&&!y.includes("}")){let v=0;for(;a<c.length;a++){for(let E of c[a])if(E==="{")v++;else if(E==="}")v--;if(v<=0)break}}a++;continue}if(y.startsWith("definePageMeta(")){let v=0,E=!1,A=a;for(let M=a;M<c.length&&!E;M++){let I=null,j=!1,Q=c[M];for(let X=0;X<Q.length;X++){let z=Q[X];if(j){j=!1;continue}if(z==="\\"){j=!0;continue}if(I){if(z===I)I=null;continue}if(z==='"'||z==="'"||z==="`"){I=z;continue}if(z==="(")v++;else if(z===")"){if(v--,v===0){a=M+1,E=!0;break}}}}if(!E)a=c.length;let D=c.slice(A,a).join(`
|
|
410
|
+
`),B=[];for(let M of["title","description"]){let I=new RegExp(`\\b${M}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(D);if(I)B.push(`${M}: ${JSON.stringify(I[2])}`)}if(B.length>0)l.push(`useSeoMeta({ ${B.join(", ")} });`);continue}if(y.startsWith("import ")||y==="import"||y.startsWith("import{")||/^import['"]/.test(y)){let v=y,E=0;while(!rg(v)&&a+E+1<c.length)E++,v=`${v} ${c[a+E].trim()}`;a+=E;let A=v.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),D=v.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),B=v.match(/^import\s*['"](.+?)['"]/),M=v,I=(j)=>{if(j.startsWith("."))return Qe.resolve(i,j);if(j.startsWith("~/")||j.startsWith("@/"))return Qe.resolve(n,j.slice(2));try{return Bun.resolveSync(j,i)}catch{return j}};if(A){let[,j,Q]=A,X=I(Q);l.push(`const ${j} = (await import('${X}')).default`),l.push(`module.exports.${j} = ${j};`)}else if(D){let[,j,Q]=D,X=I(Q),z=[],L=[],ee=Bl.has(Q);for(let te of j.split(",")){let re=te.trim();if(!re)continue;let me=re.split(/\s+as\s+/);if(me.length===2){let[he,le]=[me[0].trim(),me[1].trim()];if(ee&&$o.has(he)){l.push(`const ${le} = ${he};`);continue}z.push(`${he}: ${le}`),L.push(le)}else{if(ee&&$o.has(re))continue;z.push(re),L.push(re)}}if(z.length>0)l.push(`const { ${z.join(", ")} } = await import('${X}')`);for(let te of L)l.push(`module.exports.${te} = ${te};`)}else if(B){let j=I(B[1]);l.push(`await import('${j}')`)}else l.push(M);a++;continue}if(zl.test(y))l.push(c[a]),a++;else if(y.startsWith("export const ")||y.startsWith("export let ")||y.startsWith("export var ")){let v=Co(c,a),{type:E,name:A,value:D}=v;l.push(`${E} ${A} = ${D};`),l.push(`module.exports.${A} = ${A};`),a=v.nextIndex}else if(y.startsWith("export function ")||y.startsWith("export async function ")){let v=Qs(c,a);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),a=v.nextIndex}else if(y.startsWith("const ")||y.startsWith("let ")||y.startsWith("var ")){let v=Co(c,a),{type:E,name:A,value:D}=v;l.push(`${E} ${A} = ${D};`),l.push(`module.exports.${A} = ${A};`),a=v.nextIndex}else if(y.startsWith("function ")||y.startsWith("async function ")){let v=Qs(c,a);l.push(v.functionCode),l.push(`module.exports.${v.name} = ${v.name};`),a=v.nextIndex}else if(y.startsWith("export default function ")||y.startsWith("export default async function ")){let v=c[a].replace(/^(\s*)export\s+default\s+/,"$1"),E=[...c];E[a]=v;let A=Qs(E,a);if(l.push(A.functionCode),A.name)l.push(`module.exports.default = ${A.name};`);a=A.nextIndex}else if(y.startsWith("export default ")){let v=y.replace(/^export\s+default\s+/,"").replace(/;$/,"");l.push(`module.exports.default = ${v};`),a++}else if(y.startsWith("class ")||y.startsWith("export class ")){let v=y.match(/(?:export\s+)?class\s+(\w+)/);if(v){let E=v[1],A=c[a].replace(/^export\s+/,""),D=0,B=a;for(;B<c.length;B++){let M=c[B];for(let I of M)if(I==="{")D++;else if(I==="}")D--;if(B>a)A+=`
|
|
411
|
+
`+M;if(D<=0&&B>=a)break}l.push(A),l.push(`module.exports.${E} = ${E};`),a=B+1}else l.push(y),a++}else if(y.includes("module.exports"))l.push(y),a++;else if(y.trim()&&!y.startsWith("//"))l.push(y),a++;else a++}return Fl(l.join(`
|
|
412
|
+
`),i,n)}function Fl(e,t,i){let n=e.length,c="",l=0,a=null,y=!1,v=!1,E=0;while(l<n){let A=e[l],D=e[l+1];if(y){if(c+=A,A===`
|
|
413
|
+
`)y=!1;l++;continue}if(v){if(c+=A,A==="*"&&D==="/"){c+=D,l+=2,v=!1;continue}l++;continue}if(!a&&A==="/"&&D==="/"){y=!0,c+=A,l++;continue}if(!a&&A==="/"&&D==="*"){v=!0,c+=A,l++;continue}if(a){if(c+=A,A==="\\"){c+=D,l+=2;continue}if(A===a&&a!=="`"){a=null,l++;continue}if(a==="`"){if(A==="$"&&D==="{"){E++,c+=D,l+=2;continue}if(A==="`"){a=null,l++;continue}}l++;continue}if(E>0){if(A==="{")E++;else if(A==="}")E--}if(A==='"'||A==="'"||A==="`"){a=A,c+=A,l++;continue}if(A==="a"&&e.startsWith("await",l)){let B=Ul(e,l);if(B){let{quote:M,path:I,end:j}=B;if(I.startsWith(".")||I.startsWith("~/")||I.startsWith("@/")){let Q=I.startsWith(".")?Qe.resolve(t,I):Qe.resolve(i,I.slice(2));c+=`await import(${M}${Q}${M})`,l=j;continue}}}c+=A,l++}return c}function Ul(e,t){let i=t+5;if(i>=e.length)return null;if(!/\s/.test(e[i]))return null;while(i<e.length&&/\s/.test(e[i]))i++;if(!e.startsWith("import",i))return null;i+=6;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!=="(")return null;i++;while(i<e.length&&/\s/.test(e[i]))i++;let n=e[i];if(n!=="'"&&n!=='"')return null;i++;let c=i;while(i<e.length&&e[i]!==n)if(e[i]==="\\")i+=2;else i++;if(i>=e.length)return null;let l=e.slice(c,i);i++;while(i<e.length&&/\s/.test(e[i]))i++;if(e[i]!==")")return null;return{quote:n,path:l,end:i+1}}function Oo(e,t){let i=e[t];if(i!=="{"&&i!=="[")return null;let c=w(e,i,i==="{"?"}":"]",t);if(c===-1)return null;return{pattern:e.slice(t,c+1),endPos:c+1}}function Po(e){let t=[],i=e.slice(1,-1).trim();if(!i)return t;let n=0,c=0,l="";while(n<i.length){let a=i[n];if(a==="{"||a==="["){let y=c===0?Oo(i,n):null;if(y){t.push(...Po(y.pattern)),n=y.endPos,l="";continue}c++}else if(a==="}"||a==="]")c--;if(c>0){n++;continue}if(a===","){if(l.trim())t.push(l.trim());l="",n++;continue}if(a===":"){l="",n++;continue}if(a==="="){if(l.trim())t.push(l.trim());l="",n++;while(n<i.length&&i[n]!==","&&c===0){if(i[n]==="{"||i[n]==="[")c++;else if(i[n]==="}"||i[n]==="]")c--;n++}continue}if(/[\w$]/.test(a))l+=a;n++}if(l.trim())t.push(l.trim());return t}function sg(e){let t=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(e);if(!t)return null;let i=t[0].length,n=(c)=>c===" "||c==="\t";while(i<e.length&&n(e[i]))i++;if(e[i]===":"){let c=0,l=null;i++;for(;i<e.length;i++){let a=e[i];if(l){if(a==="\\"){i++;continue}if(a===l)l=null;continue}if(a==="'"||a==='"'||a==="`"){l=a;continue}if(a==="("||a==="["||a==="{"||a==="<"){c++;continue}if(a===")"||a==="]"||a==="}"||a===">"){c--;continue}if(a==="="&&c<=0){let y=e[i+1],v=e[i-1];if(y!=="="&&y!==">"&&v!=="="&&v!=="!"&&v!=="<"&&v!==">")break}}if(e[i]!=="=")return null}while(i<e.length&&n(e[i]))i++;if(e[i]!=="=")return null;return{type:t[1],name:t[2],value:e.slice(i+1).trim()}}function Ro(e,t,i,n){let c=null,l=!1;for(let a of e){if(l){l=!1;continue}if(a==="\\"){l=!0;continue}if(c){if(a===c)c=null;continue}if(a==="'"||a==='"'||a==="`"){c=a;continue}if(a===t)n++;else if(a===i)n--}return n}function Co(e,t){let i=e[t].trim(),n=sg(i),c=n?[i,n.type,n.name,n.value]:null;if(!c){let A=i.match(/^(?:export\s+)?(const|let|var)\s+/);if(A){let D=i.slice(A[0].length),B=t;if(D.startsWith("{")||D.startsWith("[")){let I=D[0],j=I==="{"?"}":"]",Q=Ro(D,I,j,0),X=D;for(let z=t+1;z<e.length&&Q>0;z++)X+=` ${e[z].trim()}`,B=z,Q=Ro(e[z],I,j,Q);if(Q>0)X=D,B=t;D=X}let M=Oo(D,0);if(M){let I=A[1],j=M.pattern,Q=D.slice(M.endPos).trim();if(Q.startsWith("=")){let X=Q.slice(1).trim(),z=X,L=Math.max(B,t);if(To(X)){let me=Ao(e,L,X);z=me.value,L=me.nextIndex}else L=L+1;z=z.trim().replace(/;$/,"");let ee=Po(j),te=`__stx_src_${t}`,re=ee.map((me)=>`module.exports.${me} = ${me};`).join(`
|
|
414
|
+
`);return{type:I,name:te,value:`${z}; ${I} ${j} = ${te};
|
|
415
|
+
${re}`,nextIndex:L}}}}throw Error(`Failed to parse variable declaration: ${i}`)}let[,l,a,y]=c,v=y,E=t;if(To(y)){let A=Ao(e,t,y);v=A.value,E=A.nextIndex}else E=t+1;while(E<e.length){let A=e[E].trim();if(A.startsWith(".")||A.startsWith("?."))v+=`
|
|
416
|
+
${e[E]}`,E++;else break}return v=v.trim().replace(/;$/,""),{type:l,name:a,value:v,nextIndex:E}}function Qs(e,t){let i=e[t].trim(),n=i.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!n)throw Error(`Failed to parse function declaration: ${i}`);let[,c]=n,l=i.replace(/^export\s+/,""),a=t;if(Vl(i)){let y=Hl(e,t,l);l=y.functionCode,a=y.nextIndex}else a=t+1;return{name:c,functionCode:l,nextIndex:a}}function To(e){let t=e.trim();if(t.startsWith("{"))return w(t,"{","}",0)===-1;if(t.startsWith("["))return w(t,"[","]",0)===-1;return!Do(t)}function Do(e){let t={paren:0,bracket:0,brace:0},i=null,n=0;for(let c=0;c<e.length;c++){let l=e[c];if((c>0?e[c-1]:"")==="\\"&&i)continue;if((l==='"'||l==="'")&&!i){i=l;continue}if(l===i&&i!=="`"){i=null;continue}if(l==="`"&&!i){i="`";continue}if(l==="`"&&i==="`"&&n===0){i=null;continue}if(i==="`"&&l==="$"&&e[c+1]==="{"){n++,c++;continue}if(n>0&&l==="{"){n++;continue}if(n>0&&l==="}"){n--;continue}if(i)continue;if(l==="(")t.paren++;else if(l===")")t.paren--;else if(l==="[")t.bracket++;else if(l==="]")t.bracket--;else if(l==="{")t.brace++;else if(l==="}")t.brace--}return t.paren===0&&t.bracket===0&&t.brace===0&&i===null}function Mo(e){let t=e.indexOf("(");if(t===-1)return e.indexOf("{");let i=w(e,"(",")",t);if(i===-1)return-1;return e.indexOf("{",i)}function Vl(e){let t=Mo(e);if(t===-1)return!0;return w(e,"{","}",t)===-1}function Ao(e,t,i){let n=i,c=t+1;while(c<e.length&&!Do(n)){let l=e[c];n+=`
|
|
417
|
+
${l}`,c++}while(c<e.length){let l=e[c].trim();if(l.startsWith(".")||l.startsWith("?."))n+=`
|
|
418
|
+
${e[c]}`,c++;else break}return{value:n,nextIndex:c}}function Hl(e,t,i){let n=i,c=t+1;while(c<e.length){let l=Mo(n);if(l!==-1){if(w(n,"{","}",l)!==-1)break}let a=e[c];n+=`
|
|
419
|
+
${a}`,c++}return{functionCode:n,nextIndex:c}}function Io(e,t){let i=u(e,t)??u(`(${e})`,t);if(i!==void 0)return i;if(!/\bprocess\b/.test(e))return;let n={...t,process:Object.freeze({env:{...kt.env}})},c=Object.keys(n).filter(jt),l=c.map((a)=>n[a]);try{return Function(...c,`'use strict'; return (${e});`)(...l)}catch{try{return Function(...c,`'use strict'; return ${e};`)(...l)}catch{return}}}async function Zl(e,t,i){let n=e.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let l of n){let[,,a,y]=l;try{let v=y.trim().replace(/;$/,""),E=Io(v,t);if(E!==void 0)t[a]=E}catch(v){console.warn(`Failed to parse export ${a} in fallback:`,v)}}let c=e.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let l of c){let[,,a,y]=l;if(!(a in t))try{let v=y.trim().replace(/;$/,""),E=Io(v,t);if(E!==void 0)t[a]=E}catch{}}}function Wc(e){let t=e.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),i=t?t[1]:"",n=t?e.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):e;return{scriptContent:i,templateWithoutScript:n}}function qc(e){let t=e.trim();if(!t)return!1;return/(?:const|let|var|function)\s+\w+/.test(t)}
|
|
420
|
+
export{Pe,ve,H,Is,Os,V,yr,Ns,Ms,oi,ii,Ds,ai,Rc,Rt,Ie,o,dn,b,Ac,x,br,Ls,xe,C,Oe,de,wr,W,pn,Ne,S,Pc,pe,G,vr,xr,oe,At,J,O,rt,Sr,kr,Pt,ci,js,Yf,Me,Ic,Oc,Nc,li,Mc,_r,ui,Dc,Lc,di,pi,fn,Bs,gn,It,Ot,jc,Fs,Bc,mn,Cr,zs,Hs,Fc,fi,zc,Hc,Vc,Uc,hn,Zf,Qf,eg,tg,ng,m,rg,gi,sg,Wc,qc,mi,hi,og,Nt,Kc,yi,Xc,Kh,De,yn,Le,ig,ag,cg,lg,ug,Vs,dg,je,Y,Be,pg,Er,fg,Gc,Jc,bi,Fe,s,bn,Yc,h,fe,Xh,Zc,Qc,el,wi,Us,gg,Gh,mg,Jh,Mt,p,U,Z,wn,Se,hg,vi,yg,Yh,_,bg,Zh,T,Qh};
|