@stacksjs/stx 0.2.782 → 0.2.783
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-03vwhpj8.js +2 -0
- package/dist/chunk-0f6h23m1.js +3 -0
- package/dist/{chunk-de9dkzwy.js → chunk-1cm6011j.js} +1 -1
- package/dist/chunk-2xafghw0.js +2 -0
- package/dist/{chunk-axs1wrkr.js → chunk-3jgb1vcc.js} +3 -3
- package/dist/{chunk-v1eakek3.js → chunk-412jdkys.js} +1 -1
- package/dist/{chunk-gpt1v08p.js → chunk-5pjvhgej.js} +1 -1
- package/dist/{chunk-13zfxwej.js → chunk-681t1ts7.js} +2 -2
- package/dist/chunk-6eck3ner.js +2 -0
- package/dist/{chunk-2skv6cr7.js → chunk-6w2zqayq.js} +1 -1
- package/dist/{chunk-xqa9ze06.js → chunk-6wttrxfq.js} +1 -1
- package/dist/{chunk-fkn08jb3.js → chunk-70ete7t4.js} +1 -1
- package/dist/{chunk-qgy1w573.js → chunk-76g51m0r.js} +1 -1
- package/dist/{chunk-1dp83080.js → chunk-7nvxgt19.js} +1 -1
- package/dist/chunk-81x01c9b.js +2 -0
- package/dist/{chunk-5smaktgt.js → chunk-83yd1h6k.js} +1 -1
- package/dist/chunk-86rnatzb.js +2 -0
- package/dist/{chunk-m60qqnt6.js → chunk-88jqeekv.js} +1 -1
- package/dist/{chunk-smsjcnvm.js → chunk-8dgxebzq.js} +1 -1
- package/dist/{chunk-x2c3mjey.js → chunk-8n4zff12.js} +1 -1
- package/dist/chunk-8w211y5h.js +2 -0
- package/dist/{chunk-q9w8rfve.js → chunk-8wt4c799.js} +1 -1
- package/dist/{chunk-ppnc68ta.js → chunk-9073rpgf.js} +1 -1
- package/dist/{chunk-t6z2ty9v.js → chunk-9cmvsbpe.js} +2 -2
- package/dist/{chunk-avwsq94a.js → chunk-9sp2jz6a.js} +1 -1
- package/dist/{chunk-1p8r3w08.js → chunk-9wb2kk92.js} +1 -1
- package/dist/{chunk-rvvc4twc.js → chunk-bys2jh42.js} +1 -1
- package/dist/chunk-cernr99x.js +2 -0
- package/dist/{chunk-6mdpttxy.js → chunk-cfyntnhe.js} +1 -1
- package/dist/{chunk-z04f6fy2.js → chunk-d0mrdbdw.js} +1 -1
- package/dist/{chunk-p23rgrsc.js → chunk-dd6ekezj.js} +2 -2
- package/dist/{chunk-a623wybr.js → chunk-dd9bt8df.js} +16 -16
- package/dist/{chunk-fj7tedrt.js → chunk-dg0jp3s3.js} +1 -1
- package/dist/{chunk-djqx359s.js → chunk-dnr8jmcy.js} +1 -1
- package/dist/{chunk-xcrrsq09.js → chunk-efz96s8y.js} +1 -1
- package/dist/{chunk-ay2by639.js → chunk-emjt4a58.js} +1 -1
- package/dist/chunk-fcb9c5p6.js +2 -0
- package/dist/{chunk-p5qtdqdt.js → chunk-g1sg1w0g.js} +1 -1
- package/dist/{chunk-ry7w14ax.js → chunk-gnkyh1ax.js} +4 -4
- package/dist/{chunk-2kztshb4.js → chunk-h232y76x.js} +1 -1
- package/dist/{chunk-dnk3ahmm.js → chunk-h2tkfak2.js} +1 -1
- package/dist/{chunk-abzp0cp9.js → chunk-jbw2dpx1.js} +1 -1
- package/dist/chunk-jrhttwd8.js +2 -0
- package/dist/{chunk-4q4vexpc.js → chunk-jvpp6ds2.js} +1 -1
- package/dist/{chunk-f9rtfd58.js → chunk-kc5npv29.js} +1 -1
- package/dist/{chunk-209674ms.js → chunk-krkzkp91.js} +2 -2
- package/dist/{chunk-kkkpgnj3.js → chunk-m24mv9fe.js} +1 -1
- package/dist/{chunk-y2q9f262.js → chunk-mj7agxkf.js} +1 -1
- package/dist/{chunk-7086efsc.js → chunk-npav1grn.js} +1 -1
- package/dist/{chunk-3xzzzrhw.js → chunk-pet0pact.js} +1 -1
- package/dist/{chunk-dfn9cp6v.js → chunk-pnn0x21f.js} +1 -1
- package/dist/{chunk-mx0a1ax8.js → chunk-pty7k0d2.js} +1 -1
- package/dist/{chunk-7r1tcffk.js → chunk-rgvrt6mw.js} +2 -2
- package/dist/{chunk-r0g70zrf.js → chunk-rmg1eesq.js} +6 -6
- package/dist/{chunk-km0tqwx1.js → chunk-s0t7ffrx.js} +4 -4
- package/dist/{chunk-187s3a84.js → chunk-sdtmerd5.js} +1 -1
- package/dist/{chunk-311q3pa2.js → chunk-sgj36ds4.js} +1 -1
- package/dist/{chunk-dd12079e.js → chunk-t371tew4.js} +1 -1
- package/dist/{chunk-267wdqtr.js → chunk-v4dwt843.js} +2 -2
- package/dist/{chunk-62xcwhfd.js → chunk-vyy6768n.js} +1 -1
- package/dist/{chunk-41gq8324.js → chunk-wbtca8ga.js} +4 -4
- package/dist/{chunk-zbeaatev.js → chunk-x9ev48te.js} +1 -1
- package/dist/chunk-y1zq7txb.js +2 -0
- package/dist/{chunk-mhmphbve.js → chunk-zds8fmd3.js} +5 -5
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/compiler/headwind-to-style.d.ts +6 -1
- package/dist/native/compiler/headwind-to-style.js +17 -0
- package/dist/native/compiler/style-variables.js +3 -0
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-02z88h3r.js +0 -2
- package/dist/chunk-fmzdvgka.js +0 -2
- package/dist/chunk-g9makcfg.js +0 -2
- package/dist/chunk-m68scqz0.js +0 -2
- package/dist/chunk-mpny7cmd.js +0 -2
- package/dist/chunk-pwetf855.js +0 -2
- package/dist/chunk-vdx4zfq1.js +0 -2
- package/dist/chunk-wbhv5137.js +0 -3
- package/dist/chunk-y209b8ch.js +0 -2
- package/dist/chunk-z5pvmtd7.js +0 -2
- package/dist/chunk-z79s860q.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ze,xn,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-1dp83080.js";import{Or,k,al,at,$i,cl}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-bq9xf8nq.js";import{s,ge}from"./chunk-m4mpyq3d.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ge from"path";import kt from"process";import{AsyncLocalStorage as zo}from"async_hooks";var fr=new zo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)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 i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=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(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Wo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import On from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=On.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(On.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of On.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(On.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].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)=>i.has(E))}import Jn from"fs";import ce from"path";import ht from"path";import qt from"fs";var Fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ls(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Fo.has(e.toLowerCase())}var $r=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"]),Er={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"},Vo=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Vo.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Uo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Ho(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function us(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ko(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Uo(e),a=Ho(us(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(ls(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{ze,xn,Vs,vi,O}from"./chunk-27rzdq3n.js";import{vn}from"./chunk-7nvxgt19.js";import{Or,k,al,at,$i,cl}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{Us,u,f,jt,d,q,B,w,Xs,_e,Ve,Gs}from"./chunk-bq9xf8nq.js";import{s,ge}from"./chunk-m4mpyq3d.js";import{g}from"./chunk-0dve54ne.js";import{K}from"./chunk-bmfk3b29.js";import Ge from"path";import kt from"process";import{AsyncLocalStorage as zo}from"async_hooks";var fr=new zo;function mn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function dr(e,n){return fr.run(mn(e),n)}async function pr(e,n){let t=fr.getStore();if(!t)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 i=t.pending.get(e);if(i)return i;let a=Promise.resolve().then(n).then((l)=>{let c=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(c);return t.values.set(e,y),y}).catch((l)=>{throw t.pending.delete(e),l});return t.pending.set(e,a),a}function _r(e){let n=e.__stx_server_data;if(!n?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(n.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function z(e,n=!1){let t=s(e),i=[],a=new Set,l=0,c=0,y=t.length,v=()=>{if(l!==0)return;let E=t.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(n&&E[1]==="const")return;let P=E[2];if(!a.has(P))i.push(P),a.add(P);return}let R=t.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){if(n&&t.slice(c).startsWith("const"))return;R[1].split(",").forEach((P)=>{let D=P.trim();if(!D)return;let X=D.indexOf(":"),L=(X>=0?D.slice(X+1).trim():D).split(/[\s=]/)[0];if(L&&!a.has(L))i.push(L),a.add(L)});return}let M=t.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(M){if(n&&t.slice(c).startsWith("const"))return;M[1].split(",").forEach((P)=>{let D=P.trim().replace(/^\.\.\./,"");if(!D)return;let X=D.split(/[\s=]/)[0];if(X&&!a.has(X))i.push(X),a.add(X)});return}if(n)return;let N=t.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(N){let P=N[1];if(!a.has(P))i.push(P),a.add(P);return}let j=t.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let P=j[1];if(!a.has(P))i.push(P),a.add(P)}};while(c<y){if(t[c]==="{"){l++,c++;continue}if(t[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(t[c])&&(c===0||/\s|[;{}()]/.test(t[c-1])))v();c++}return i.join(", ")}function As(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function Wo(e,n=z(e).split(",").map((t)=>t.trim()).filter(Boolean)){let t=new Set(z(e,!0).split(",").map((i)=>i.trim()));return n.map((i)=>t.has(i)?`get ${i}() { return ${i} }, set ${i}(__stxValue_${i}) { ${i} = __stxValue_${i} }`:i).join(", ")}function Ps(e,n){let t=`{ ${Wo(e,n)} }`;return z(e).split(",").some((i)=>i.trim()==="__stxLiveBindings")?`Object.defineProperties(${t}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:t}import On from"fs";import We from"path";function H(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var gr=new Map;function yr(e,n=!0){let t=gr.get(e);if(n&&t)return t;let i=new Map,a=[We.join(e,"src"),We.join(e,"dist"),e];function l(c,y){if(y>6)return;let v;try{v=On.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let R=We.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(R,y+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let M=E.name.slice(0,-4);if(!i.has(M))i.set(M,R);let N=M.toLowerCase();if(!i.has(N))i.set(N,R);let j=H(M);if(!i.has(j))i.set(j,R)}}}for(let c of a)if(l(c,0),i.size>0)break;if(n)gr.set(e,i);return i}function Is(e,n){if(e.startsWith(".")||e.startsWith("/"))return null;let t=n;while(!0){let i=We.join(t,"node_modules",e);try{if(On.statSync(i).isDirectory())return i}catch{}let a=We.dirname(t);if(a===t)return null;t=a}}function Os(e,n,t={}){return[We.resolve(We.dirname(n),`${e}.stx`),We.resolve(We.dirname(n),e),We.resolve(t.componentsDir||"components",`${e}.stx`),We.resolve(t.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function mr(e){let n=e.endsWith(".stx")?e.slice(0,-4):e,t=n.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),i=H(n);return[n,t,i]}function ri(e,n){let[t,i,a]=mr(e);for(let l of[t,t.toLowerCase(),i,a]){let c=n?.__importedComponents?.get(l);if(c!==void 0)return c}}function*si(e,n,t={},i){let a=mr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield We.resolve(We.dirname(n),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=t.projectRoot||process.cwd(),y=[...i?.__originalFilePath?[We.join(We.dirname(i.__originalFilePath),"components")]:[],...t.componentsDir?[t.componentsDir]:[],We.join(We.dirname(n),"components"),We.resolve(c,"src/components"),We.resolve(c,"components"),...import.meta.dir?[We.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(y)){for(let E of l)yield We.join(v,E);try{for(let E of On.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let R of l)yield We.join(v,E.name,R)}catch{}}}function hr(e,n,t={},i){let a=ri(e,i);if(a!==void 0)return a;for(let l of si(e,n,t,i))try{if(On.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ns(e,n=[],t={}){let i=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!i.has("src")||!i.has("alt")&&!i.has("decorative"))return!1;let a=new Map(Object.entries(t).map(([E,R])=>[E.replace(/[-_]/g,"").toLowerCase(),R])),l=a.get("alt"),c=a.get("decorative"),y=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!y&&!v)return!1;if(["source","resizemode","defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>i.has(E)))return!1;if([...n].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)=>i.has(E))}import Jn from"fs";import ce from"path";import ht from"path";import qt from"fs";var Fo=new Set(["touchstart","touchmove","wheel","mousewheel"]);function ls(e,n){if(n.passive)return!0;if(n.prevent||n.nonpassive)return!1;return Fo.has(e.toLowerCase())}var $r=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"]),Er={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"},Vo=new Set(["ctrl","alt","shift","meta"]),Ar={left:0,middle:1,right:2};function Rr(e){let n={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let t of e){let i=t.toLowerCase();if(i==="prevent")n.prevent=!0;else if(i==="stop")n.stop=!0;else if(i==="once")n.once=!0;else if(i==="capture")n.capture=!0;else if(i==="self")n.self=!0;else if(i==="passive")n.passive=!0;else if(i==="nonpassive")n.nonpassive=!0;else if(Vo.has(i))n.systemKeys.push(i);else if(i in Ar)n.mouse=i;else if(i in Er||/^[a-z]$/.test(i))n.keys.push(Er[i]||i.toUpperCase());else if(i.startsWith("debounce")){let a=i.match(/debounce(?:\.(\d+))?/);n.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(i.startsWith("throttle")){let a=i.match(/throttle(?:\.(\d+))?/);n.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return n}function Ir(e,n=""){let t=[],i=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,y,v]=l,E=l.index,R=E+c.length,M=`__stx_evt_${n}${i++}`,N=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=j.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}let D=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=D.exec(v))!==null){let[,X,F]=P,L=X.split("."),Q=L[0];if(!$r.has(Q))continue;N.push({attribute:`@${X}`,event:Q,handler:F,modifiers:Rr(L.slice(1)),elementId:M})}if(N.length>0)t.push({originalTag:c,elementId:M,events:N,startIndex:E,endIndex:R})}return t}function Uo(e){let n=[],{modifiers:t}=e;if(t.self)n.push("if ($event.target !== $el) return");for(let i of t.systemKeys)n.push(`if (!$event.${i}Key) return`);if(t.keys.length>0){let i=t.keys.map((a)=>`$event.key === '${a}'`).join(" || ");n.push(`if (!(${i})) return`)}if(t.mouse!==null){let i=Ar[t.mouse];n.push(`if ($event.button !== ${i}) return`)}if(t.prevent)n.push("$event.preventDefault()");if(t.stop)n.push("$event.stopPropagation()");return n.join("; ")}function Ho(e,n){let t=e;if(n.debounce!==null)t=`__stx_debounce(() => { ${t} }, ${n.debounce})`;else if(n.throttle!==null)t=`__stx_throttle(() => { ${t} }, ${n.throttle})`;return t}function us(e){let n=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(n))return e;return`if (typeof ${n} === 'function' && !${n}._isSignal) ${n}($event);`}function Ko(e){let{modifiers:n}=e,t=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),i=Uo(e),a=Ho(us(e.handler),n),l=[];if(n.once)l.push("once: true");if(n.capture)l.push("capture: true");if(ls(e.event,n))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",y=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
3
3
|
(function() {
|
|
4
4
|
var $el = document.getElementById('${t}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function Zo(e,n=""){let t=Ir(e,n);if(t.length===0)return{template:e,bindings:[]};let i=e,a=[];for(let l=t.length-1;l>=0;l--){let c=t[l],y=c.originalTag;if(!y.includes(" id="))y=y.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=y.match(/id=["']([^"']+)["']/);if(v)for(let E of c.events)E.elementId=v[1]}for(let v of c.events){let E=v.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),R=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),M=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");y=y.replace(R,""),y=y.replace(M,"")}i=i.slice(0,c.startIndex)+y+i.slice(c.endIndex),a.push(...c.events)}return{template:i,bindings:a}}function Tr(e){let n=e.$uid;return typeof n==="string"&&n?`${n}_`:""}function Ec(e,n,t){if(cl(e))return e;if(n.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:y,bindings:v}=Zo(e,Tr(n)),E=n.__stx_event_bindings||[];return n.__stx_event_bindings=[...E,...v],y}let i=Ir(e,Tr(n));if(i.length===0)return e;let a=e;for(let y=i.length-1;y>=0;y--){let v=i[y],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let R=E.match(/id=["']([^"']+)["']/);if(R)for(let M of v.events)M.elementId=R[1]}for(let R of v.events){let M=R.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),N=new RegExp(`\\s*${M}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${M}\\s*=\\s*'[^']*'`,"g");E=E.replace(N,""),E=E.replace(j,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=oi(i.flatMap((y)=>y.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Xo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Jo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function fs(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Jo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let ne=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){ne=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(ne,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&<.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||qo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Xo.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&<.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let ne=P+1;ne<=F;ne++){let ue=t[ne]?.text;if(ne<F&&Dr.includes(ue)&&i.has(ne)&&i.get(ne)<F){ne=i.get(ne);continue}if(ne<F&&ue===":"&&!te)Q=!0;else if(ne<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(ne<F&&Q&&ue==="<")ae++;else if(ne<F&&Q&&ue===">"&&ae>0)ae--;else if(ne===F||ue===","&&ae===0)y(L,ne,R,D==="var"),L=ne+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&<.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&<.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,ne]of l(Q+1,te)){let ue=ne-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ds(e){let n=fs(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Mn(e){return new Set(fs(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=fs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&<.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function Pr(e,n){let t=new Set;for(let i of e.split(",")){let a=i.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(n){let l=a.lastIndexOf(":");if(l!==-1)a=a.slice(l+1).trim()}if(a=a.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(a))t.add(a)}return t}function Rt(e,n){let t=s(e),{depths:i,balanced:a}=ge(t),l=(y)=>!a||i[y]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${n}\\b)`,"g");for(let y of t.matchAll(c)){let v=(y.index??0)+y[0].length-y[1].length;if(l(v))return!0}for(let y of t.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(y.index??0)&&Pr(y[1],!0).has(n))return!0;for(let y of t.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(y.index??0)&&Pr(y[1],!1).has(n))return!0;return!1}var Mr="",Pn,lt=/^[A-Za-z_$][\w$]*$/,qo=new Set(["if","for","while","switch","with"]),Dr=["(","[","{"],jr=[")","]","}"],Xo=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function Jo(e){let n=s(e),t=[];for(let i of n.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=i.index??0;t.push({text:i[0],start:a,end:a+i[0].length})}return{code:n,tokens:t}}function fs(e){if(Pn&&e===Mr)return Pn;let{code:n,tokens:t}=Jo(e),i=new Map,a=[];for(let P=0;P<t.length;P++){let D=t[P].text;if(["(","[","{"].includes(D))a.push(P);else if([")","]","}"].includes(D)){let X=a.at(-1);if(X!==void 0&&["()","[]","{}"].includes(t[X].text+D))a.pop(),i.set(X,P),i.set(P,X)}}function l(P,D){let X=[],F=P;for(let L=P;L<D;L++){if(["(","[","{"].includes(t[L].text)&&(i.get(L)??D)<D){L=i.get(L);continue}if(t[L].text===",")X.push([F,L]),F=L+1}return X.push([F,D]),X}let c=[];function y(P,D,X,F=!1){if(t[P]?.text==="...")P++;if(P>=D)return;let L=t[P].text;if(lt.test(L)){if(X.add(L),X===R)c.push({name:L,token:P,functionScoped:F});return}if(L!=="{"&&L!=="[")return;let Q=i.get(P);if(Q===void 0||Q>=D)return;for(let[te,ae]of l(P+1,Q)){let ne=te;if(L==="{")for(let ue=te;ue<ae;ue++){if(t[ue].text===":"){ne=ue+1;break}if(t[ue].text==="=")break;if(["(","[","{"].includes(t[ue].text)&&i.has(ue))ue=i.get(ue)}y(ne,ae,X,F)}}function v(P,D){let X=new Set;for(let[F,L]of l(P,D))y(F,L,X);return X}function E(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(["(","[","{"].includes(X)&&i.has(D)){D=i.get(D);continue}if([",",";",")","]","}"].includes(X))break}return t[Math.max(P,D-1)]?.end??n.length}let R=new Set,M=[];for(let P=0;P<t.length;P++)if(t[P].text==="=>"){let D=P-1,X=D,F;if(t[D]?.text===")"&&i.has(D))X=i.get(D),F=v(X+1,D);else if(t[D]&<.test(t[D].text))F=new Set([t[D].text]);else continue;let L=P+1,Q=t[L]?.text==="{"&&i.has(L)?t[i.get(L)].end:E(L);M.push({start:t[X].start,end:Q,bodyStart:t[L]?.start??Q,functionBody:!0,names:F})}else if(t[P].text==="("&&i.has(P)){let D=t[P-1]?.text;if(!D||qo.has(D)||!lt.test(D)&&D!=="*"&&D!=="]")continue;let X=i.get(P),F=X+1;if(t[F]?.text===":"){F++;while(F<t.length&&!["{","=>",";","="].includes(t[F].text))F++}if(t[F]?.text!=="{"||!i.has(F))continue;M.push({start:t[P].start,end:t[i.get(F)].end,bodyStart:t[F].start,functionBody:D!=="catch",names:v(P+1,X)})}function N(P){let D=P;for(;D<t.length;D++){let X=t[D].text;if(Dr.includes(X)&&i.has(D)){D=i.get(D);continue}if(X===";"||jr.includes(X))break;let F=t[D-1];if(D>P&&Xo.has(X)&&F.text!==".")break;if(D>P&&/[\n\r]/.test(n.slice(F.end,t[D].start))&&(/^[\w$]+$/.test(F.text)||jr.includes(F.text)||['"',"'","`"].includes(F.text))&<.test(X)&&!["in","of","instanceof"].includes(X))break}return D}let j=[];for(let P=0;P<t.length;P++){if(t[P].text!=="for")continue;let D=t[P+1]?.text==="await"?P+2:P+1;if(t[D]?.text!=="("||!i.has(D))continue;let X=i.get(D),F=X+1,L=t[F]?.text==="{"&&i.has(F)?i.get(F):N(F),Q=t[L]?.text===";"||t[L]?.text==="}"?t[L].end:t[Math.max(F,L-1)]?.end??n.length;j.push({headStart:D,headEnd:X,start:t[D].start,end:Q})}for(let P=0;P<t.length;P++){let D=t[P].text,X=t[P-1]?.text;if(X==="."||t[P+1]?.text===":")continue;if(X==="as"||X==="<")continue;if(D==="const"||D==="let"||D==="var"){let F=N(P+1),L=P+1,Q=!1,te=!1,ae=0;for(let ne=P+1;ne<=F;ne++){let ue=t[ne]?.text;if(ne<F&&Dr.includes(ue)&&i.has(ne)&&i.get(ne)<F){ne=i.get(ne);continue}if(ne<F&&ue===":"&&!te)Q=!0;else if(ne<F&&ue==="="&&ae===0)Q=!1,te=!0;else if(ne<F&&Q&&ue==="<")ae++;else if(ne<F&&Q&&ue===">"&&ae>0)ae--;else if(ne===F||ue===","&&ae===0)y(L,ne,R,D==="var"),L=ne+1,Q=!1,te=!1}}else if(D==="function"||D==="class"){let F=P+1;if(t[F]?.text==="*")F++;if(t[F]&<.test(t[F].text)&&t[F].text!=="extends")R.add(t[F].text),c.push({name:t[F].text,token:F})}else if(D==="import"){let F=P+1;if(t[F]?.text==="*"&&t[F+1]?.text==="as")F+=2;let L=t[F]?.text;if(L&<.test(L)&&L!=="type"&&t[F+1]?.text!=="("&&t[F+1]?.text!==".")R.add(L),c.push({name:L,token:F,file:!0});let Q=t[F]?.text==="{"?F:t[F+1]?.text===","&&t[F+2]?.text==="{"?F+2:-1;if(Q!==-1&&i.has(Q)){let te=i.get(Q);for(let[ae,ne]of l(Q+1,te)){let ue=ne-1;while(ue>=ae&&!lt.test(t[ue].text))ue--;if(ue>=ae&&t[ue].text!=="type")c.push({name:t[ue].text,token:ue,file:!0})}}}}return Mr=e,Pn={code:n,scopes:M,loops:j,declarations:R,sites:c,tokens:t,pairs:i},Pn}function ds(e){let n=fs(e);return{code:n.code,shadows:(t,i)=>n.scopes.some((a)=>i>=a.start&&i<a.end&&a.names.has(t))}}function Mn(e){return new Set(fs(e).declarations)}function Ie(e,n){let{scopes:t,loops:i,sites:a,tokens:l,pairs:c}=fs(e),y=Array.from({length:l.length},()=>-1),v=[];for(let j=0;j<l.length;j++){y[j]=v.length?v[v.length-1]:-1;let P=l[j].text;if(P==="{"&&c.has(j))v.push(j);else if(P==="}"&&v.length&&c.get(j)===v[v.length-1])v.pop()}let E=new Set,R=new Map;for(let j of a){if(!n.has(j.name))continue;E.add(j.token);let P=j.file?-1:y[j.token],D=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(j.functionScoped){let F=l[j.token].start,L=t.filter((Q)=>Q.functionBody&&F>=Q.bodyStart&&F<Q.end).sort((Q,te)=>Q.end-Q.bodyStart-(te.end-te.bodyStart))[0];D=L?[L.bodyStart,L.end]:[0,Number.POSITIVE_INFINITY]}else if(!j.file){let F=i.filter((L)=>j.token>L.headStart&&j.token<L.headEnd).sort((L,Q)=>L.headEnd-L.headStart-(Q.headEnd-Q.headStart))[0];if(F)D=[F.start,F.end]}let X=R.get(j.name);if(X)X.push(D);else R.set(j.name,[D])}let M=new Set;for(let j=0;j<l.length;j++){if(l[j].text!=="import"||l[j-1]?.text===".")continue;let P=j+1;if(l[P]?.text==="type")P++;if(l[P]&<.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let D=P+1;D<c.get(P);D++)M.add(D)}let N=new Set;for(let j=0;j<l.length;j++){let P=l[j].text;if(!n.has(P)||N.has(P)||E.has(j)||M.has(j))continue;let D=l[j-1]?.text;if(D==="#"||D==="."&&l[j-2]?.text!=="..")continue;if(l[j+1]?.text===":"&&(D==="{"||D===","))continue;let X=l[j].start;if(R.get(P)?.some(([F,L])=>X>=F&&X<L))continue;if(t.some((F)=>X>=F.start&&X<F.end&&F.names.has(P)))continue;N.add(P)}return N}var Pe="0.2.783";var Nr=Symbol.for(`stx.lazy-module-promises.${Pe}`);function Yo(){let e=globalThis;return e[Nr]??=new Map,e[Nr]}function o(e,n){let t=Yo(),i=`${import.meta.url}\x00${e}`,a=t.get(i);if(a)return a;let l=n();return t.set(i,l),l.catch(()=>{if(t.get(i)===l)t.delete(i)}),l}var Qo=/<\/(script)/gi;function dn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(Qo,"<\\/$1")}import zr from"fs";class U{cache=new Map;maxSize;options;sizes;bytes=0;constructor(e=100,n){this.maxSize=e,this.options=n??null,this.sizes=n?new Map:null}get byteSize(){return this.bytes}setMaxBytes(e){if(!this.options)return;this.options={...this.options,maxBytes:e};while(this.bytes>e&&this.cache.size>0){let n=this.cache.keys().next().value;if(n===void 0)break;this.delete(n)}}get(e){if(!this.cache.has(e))return;let n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}set(e,n){if(this.cache.has(e))this.delete(e);let t=this.options?this.options.sizeOf(n):0;if(this.options&&t>this.options.maxBytes)return;while(this.cache.size>0&&(this.cache.size>=this.maxSize||this.options!==null&&this.bytes+t>this.options.maxBytes)){let i=this.cache.keys().next().value;if(i===void 0)break;this.delete(i)}if(this.cache.set(e,n),this.sizes)this.sizes.set(e,t),this.bytes+=t}has(e){return this.cache.has(e)}delete(e){if(this.sizes){let n=this.sizes.get(e);if(n!==void 0)this.bytes-=n,this.sizes.delete(e)}return this.cache.delete(e)}clear(){this.cache.clear(),this.sizes?.clear(),this.bytes=0}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}var $t=new Map,ea=500;function At(e,n){if(n?.includes("g"))return new RegExp(e,n);let t=`${e}:${n||""}`;if(!$t.has(t)){if($t.size>=ea){let i=$t.keys().next().value;if(i)$t.delete(i)}$t.set(t,new RegExp(e,n))}return $t.get(t)}class Lr{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(e){let n=Array.from(new Set(e)),t=n.sort().join(","),i=this.pool.find((y)=>y.context.join(",")===t);if(i)return i.func;let a=this.fnCache,l=this.fnCacheMaxSize,c=(...y)=>(v)=>{try{let E=`${t}:${v}`,R=a.get(E);if(!R){if(a.size>=l){let M=a.keys().next().value;if(M)a.delete(M)}R=Function(...n,`
|
|
116
116
|
'use strict';
|
|
117
117
|
try {
|
|
118
118
|
return ${v};
|
|
@@ -193,7 +193,7 @@ else {
|
|
|
193
193
|
// STX: auto-generated event bindings
|
|
194
194
|
${e.map((t,i)=>ba(t,i)).join(`
|
|
195
195
|
`)}`}function Hr(e){let n=[],t=new Set,i=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=i.length,c=0;while(c<l){let y=i[c];if(y==="'"||y==='"'||y==="`"){let v=y;if(c++,v==="`"){let E=0;while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]==="`"&&E===0){c++;break}if(i[c]==="$"&&i[c+1]==="{"){E++,c+=2;continue}if(i[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(i[c]==="\\"){c+=2;continue}if(i[c]===v){c++;break}c++}continue}if(y==="/"&&i[c+1]==="/"){while(c<l&&i[c]!==`
|
|
196
|
-
`)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var _a=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 wa(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!_a.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Dt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
196
|
+
`)c++;continue}if(y==="/"&&i[c+1]==="*"){c+=2;while(c<l-1&&!(i[c]==="*"&&i[c+1]==="/"))c++;c+=2;continue}if(y==="{"){a++,c++;continue}if(y==="}"){a--,c++;continue}if(a===0){let v=i.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let N=E[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=E[0].length;continue}let R=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(R){R[1].split(",").forEach((N)=>{let j=N.trim(),P=j.indexOf(":"),D=P>=0?j.slice(P+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(D&&!D.startsWith("_")&&!t.has(D))n.push(D),t.add(D)}),c+=R[0].length;continue}let M=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(M){let N=M[1];if(!N.startsWith("_")&&!t.has(N))n.push(N),t.add(N);c+=M[0].length;continue}}c++}return n}var _a=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 wa(e){let n=new Set,t=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function i(N){let j;while((j=t.exec(N))!==null){let P=j[0];if(!_a.has(P))n.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)i(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)i(l[1]);let y=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=y.exec(e))!==null)i(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)i(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)i(l[1]);let R=/@model\s*=\s*["']([^"']*)["']/gi;while((l=R.exec(e))!==null)i(l[1]);let M=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=M.exec(e))!==null)i(l[1]);return n}async function Le(e,n={}){let t=e,i="",a=!1,l=[],c=fi(t,{filePath:n.filePath,projectRoot:n.projectRoot});t=c.code;let y=gi(c.styles),v=Dt(t);t=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:R}=await o("stx/client-script-bundler",()=>import("./chunk-pty7k0d2.js"));if(E(t))t=await R(t,n.filePath||"",{projectRoot:n.projectRoot,minify:n.production}),a=!0;if(n.autoImports!==!1){let Q=Wc(t);t=Q.code,i=qc(Q.stxImports,Q.browserImports.filter((te)=>!l.includes(te)))}if(i=`${yn(t,n.serverData)}${i}`,t=A(t),!a&&je(n.attrs||""))t=Be(t);let M=ya(n.eventBindings||[]),N=(n.attrs||"").trim(),j=/\btype\s*=\s*["']module["']/i.test(N),P=n.instanceId?` data-stx-instance="${n.instanceId}"`:"";if(j){let Q=N.replace(/\btype\s*=\s*["']module["']/i,"").trim(),te=`type="module" data-stx-scoped${P}${Q?` ${Q}`:""}`;return`${y}<script ${te}>
|
|
197
197
|
${dn(`${i}${t}
|
|
198
198
|
${M}`)}
|
|
199
199
|
</script>`}let D=$i(e),X=/function __stx_setup_/.test(t),F=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function L(Q){let te=Q.length>0?`
|
|
@@ -288,8 +288,8 @@ ${E.join(`
|
|
|
288
288
|
`){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")j=!0;else if(P==="]")j=!1;else if(P==="/"&&!j){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},N=()=>{if(i!==0)return;let j=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let F=j[2].split(",").map((L)=>{let Q=L.trim().split(":");return Q[Q.length-1].trim()});for(let L of F)if(L&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(L)&&!t.has(L))n.push(L),t.add(L);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let F=P[2];if(!t.has(F))n.push(F),t.add(F);return}let D=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(D){let F=D[1];if(!t.has(F))n.push(F),t.add(F);return}let X=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(X){let F=X[1];if(!t.has(F))n.push(F),t.add(F)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){y();continue}if(e[a]==="/"&&R()){M();continue}if(e[a]==="{"){i++,a++;continue}if(e[a]==="}"){i--,a++;continue}if(i===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))N();a++}return n}function Tl(e){let n=[],t=0,i=0,a=null;for(let l=0;l<e.length;l++){let c=e[l];if(a){if(c==="\\"){l++;continue}if(c===a)a=null;continue}if(c==='"'||c==="'"||c==="`"){a=c;continue}if(c==="("||c==="["||c==="{")t++;else if(c===")"||c==="]"||c==="}")t--;else if(c===","&&t===0)n.push(e.slice(i,l)),i=l+1}if(i<e.length)n.push(e.slice(i));return n}function Al(e){let n=0,t=null;for(let i=0;i<e.length;i++){let a=e[i];if(t){if(a==="\\"){i++;continue}if(a===t)t=null;continue}if(a==='"'||a==="'"||a==="`"){t=a;continue}if(a==="("||a==="["||a==="{")n++;else if(a===")"||a==="]"||a==="}")n--;else if(a==="="&&n===0){let l=e[i-1],c=e[i+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return i}}return-1}function Il(e,n){try{let t=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!t)return;let i=t.index-1;while(i>=0&&/\s/.test(e[i]))i--;if(e[i]!=="}")return;let a=i,l=0,c=-1;for(;i>=0;i--){let v=e[i];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=i;break}}}if(c===-1)return;let y=e.slice(c+1,a);for(let v of Tl(y)){let E=v.trim();if(!E||E.startsWith("..."))continue;let R=Al(E);if(R===-1)continue;let M=E.slice(0,R).trim();if(!/^[A-Z_$][\w$]*$/i.test(M))continue;if(n[M]!==void 0)continue;let N=E.slice(R+1).trim();if(!N)continue;try{let j=Object.keys(n).filter(jt),P=Function(...j,`"use strict"; return (${N});`);n[M]=P(...j.map((D)=>n[D]))}catch{}}}catch{}}var Ol=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function lg(e,n){let t=e.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)<([a-zA-Z][a-zA-Z0-9-]*)/s);if(!t)return null;let i=t[2].toLowerCase();if(!Ol.has(i))return null;let a=new RegExp(`<\\/?${i}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),l=S(e,(E,R)=>(a.lastIndex=R,a.exec(E)?.index===R?a.lastIndex:-1));if(i==="span"&&/\sdata-stx-scope\s*=/.test(l[0]?.token||""))return null;let c=0,y=!1;for(let E of l){if(c+=E.token.startsWith("</")?-1:1,c<0)return null;if(c===0){if(e.slice(E.end).trim())return null;y=!0;break}}if(!y)return null;let v=t[0].length;return e.slice(0,v)+n+e.slice(v)}function $o(e,n){if(!e)return!1;return[...n.additionalComponentsDirs??[],...n.fallbackComponentsDir?[n.fallbackComponentsDir]:[]].some((i)=>{let a=ce.relative(ce.resolve(i),ce.resolve(e));return!a.startsWith("..")&&!ce.isAbsolute(a)})}async function Cr(e,n,t,i,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(ne)=>ne.split("-").map((ue)=>ue.charAt(0).toUpperCase()+ue.slice(1)).join(""),y=t.__importedComponents;if(y){for(let ne of[l,l.toLowerCase(),c(l),H(l)])if(y.has(ne))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${H(l)}.stx`])],E=typeof a.root==="string"?ce.resolve(a.root):void 0,R=E??ce.dirname(i),M=[],N=(ne)=>{if(ne&&!M.includes(ne))M.push(ne)},j=t.__originalFilePath;if(j)N(ce.join(ce.dirname(j),"components"));if($o(n,a))N(a._rootComponentsDir);N(n),N(a._rootComponentsDir),N(ce.join(ce.dirname(i),"components")),N(a.componentsDir);for(let ne of a.additionalComponentsDirs??[])N(ne);let P=a._targetComponentFallbackNames?.some((ne)=>ne.toLowerCase()===l.toLowerCase());if(!P)for(let ne of a._targetComponentDirs??[])N(ne);if(E)N(ce.resolve(E,"resources/views/components")),N(ce.resolve(E,"resources/components")),N(ce.resolve(E,"src/components")),N(ce.resolve(E,"components"));for(let ne of a._layerComponentDirs??[])N(ne);let D=a._pluginComponentDirs;if(Array.isArray(D))for(let ne of D)N(typeof ne==="string"?ne:null);if(N(a.fallbackComponentsDir),P)for(let ne of a._targetComponentDirs??[])N(ne);let X=a._nativePrimitivesFallback;if(X&&!X.except.some((ne)=>ne.toLowerCase()===l.toLowerCase()))N(X.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ce.resolve(ce.dirname(i),`${l}.stx`));let F=ho(ce.resolve(import.meta.dir,"components")),L=M.map((ne)=>ce.isAbsolute(ne)?ne:ce.resolve(R,ne)),Q=`${v.join("\x00")}\x00\x00${L.join("\x00")}`,te=Js.get(Q);if(te!==void 0)return te;let ae=!1;e:for(let ne of L){if(ho(ne)===F)continue;for(let ue of v)if(await r(ce.join(ne,ue))){ae=!0;break e}}return Js.set(Q,ae),ae}function ho(e){let n=Ys.get(e);if(n!==void 0)return n;let t=e;try{t=Jn.realpathSync(e)}catch{}return Ys.set(e,t),t}function ug(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Kc(e){if(!e)return!1;let n=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(n)}function Pl(e,n,t){if(!e.includes("{{")&&!e.includes("{!!"))return e;let i=(a,l)=>{let c;try{c=T(a,n)}catch{return l}if(c===void 0||c===null)return"";let y=String(c);if(/<\/style/i.test(y))return console.warn(`[stx] a <style> expression in ${t??"<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,(a,l)=>i(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>i(l,a))}var xo=new Set;function bo(e,n,t,i){let a=`${e}\x00${n}\x00${i??""}`;if(!process.env.STX_DEBUG&&xo.has(a))return;xo.add(a);let l=n?` used in ${n}`:"",c=i?` Cause: ${i}.`:"",y=t.length>0?`
|
|
289
289
|
searched:
|
|
290
290
|
${t.map((v)=>` - ${v}`).join(`
|
|
291
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function hi(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-abzp0cp9.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&ug(D)?D:"";try{let F=(se)=>se.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let se=[L,L.toLowerCase(),F(L),H(L)];for(let le of se)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(se)],we=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),we){let be=ce.join(ce.dirname(we),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&$o(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),st=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),rs=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),gt=!st.includes("valuechange")&&(Zt||st.includes("change")&&!rs),yt=c._nativeHostAttrs&&/^textinput$/i.test(L),ln=st.includes("update:value")&&!st.includes("input"),un=c._nativeHostAttrs&&/^video$/i.test(L),_n=c._nativeHostAttrs&&/^image$/i.test(L),_t=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),Sn=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),$n=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),En=un&&Sn&&!$n&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),kn=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),or=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ct||gt)&&(!yt||ln)&&(!un||En)&&(!_n||_t)&&!kn;for(let be of or?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let wt=typeof c.root==="string"?ce.resolve(c.root):void 0,No=wt??ce.dirname(l),St=[];if(wt)St.push(ce.resolve(wt,"resources/views/components")),St.push(ce.resolve(wt,"resources/components")),St.push(ce.resolve(wt,"src/components")),St.push(ce.resolve(wt,"components"));St.push(ce.resolve(import.meta.dir,"components"));for(let be of St)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(or){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let Rn=c._nativePrimitivesFallback;if(Rn&&!Rn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(Rn.dir))he.push(Rn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(No,be)}))];he.length=0,he.push(...cr);let is=`${L}\x00${l}\x00${cr.join("\x00")}`,os=qn.get(is);if(os)if(await r(os))Q=os;else qn.delete(is);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Cn of le){let Tn=ce.join(be,Cn);if(ae.push(Tn),await r(Tn)){Q=Tn;break}}if(Q)break;if(!Q)try{let Cn=await import("fs");if(!Cn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let Lo=8,as=[{path:be,depth:0}];while(as.length>0&&!Q){let An=as.pop();if(An.depth>=Lo)continue;let lr;try{lr=Cn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let In of lr){if(!In.isDirectory())continue;if(In.name==="node_modules"||In.name.startsWith("."))continue;let ur=ce.join(An.path,In.name);for(let Bo of le){let cs=ce.join(ur,Bo);if(ae.push(cs),await r(cs)){Q=cs;break}}if(Q)break;as.push({path:ur,depth:An.depth+1})}}}catch{}if(Q)break}if(Q)qn.set(is,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let ne;if(tn.has(Q)&&qs.get(Q)===po(Q))ne=tn.get(Q);else try{let se=po(Q);ne=await Bun.file(Q).text(),tn.set(Q,ne),qs.set(Q,se)}catch(se){let le=se instanceof Error?se.message:String(se);return bo(e,l,[Q],le),yo(e)}if(R)for(let se of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=se.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))R.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))R.consumedProps?.add(se)}let ue=new Set(["__originalFilePath","__importedComponents",Nn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,le]of Object.entries(a))if(!se.startsWith("__")||ue.has(se))Ee[se]=le;let Te=E.length>0?{[Vn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-kkkpgnj3.js"));Ae=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-smsjcnvm.js"));Ae=await se(Ae,{...a,__processedComponents:j,...Te},l,c,v)}let ke=[];if(Kc(Ae)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-xcrrsq09.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=se(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(we[1].trim())}let Je=G(Ae),ut=[],Ct=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,le)=>{let we=Je.scripts[Number(le)]||"",he=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ct)return ut.push(we),"";return we}),{extractSlotContent:Yn}=await o("stx/slots",()=>import("./chunk-ay2by639.js")),ft=Yn(Ct),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[se,le]of ft.namedSlots)dt[se]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Tt=So(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ct,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(ne)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Il(ne,Ue);let Lt=ne,sn=de(Lt);if(sn)Lt=sn.content.trim();let Qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Bt=[...ne.matchAll(Qn)];for(let[,se,le]of Bt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(le,Q,c.strict);let qe=[],zt=null,es=Bt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,Ye=null,Wt=null,rn=0,Ft=null;if(vl(c),es&&Qs>0){let se=El({props:n,slot:Ae,slotContext:t.trim()?kl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:it});if(se!==null){bt=`${Q}\x00${x(ne)}\x00${se}`;let le=Xn.get(bt);if(le){for(let we of le.dependencies)v.add(we);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)we.add(he);a.__stx_preserved_client_expressions=[...we]}return le.output}Ye=new Set(v),Wt=Gr(a),rn=pt.n,Ft=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Vt=new Set;for(let se of Bt){let le=se[1]||"",we=se[2]||"",he=le.includes("server");if(je(le)&&we.trim())we=Be(we);if(he&&we){for(let Ce of De(we))Vt.add(Ce);try{await N(we,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")zt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ce.includes("{{")&&Ce.includes("}}"),st=Ce.includes("{!!")&&Ce.includes("!!}");if(ct||st)Ce=bi(Ce,Ue,Q);let Zt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${Zt}>${Ce}</script>`)}}let Xe=G(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ut=Xe?Xe[1]:"",ts=Xe?Xe[2]:"",Qe="",ee=Ut&&/\bscoped\b/i.test(Ut);if(Xe)Qe=`<style${Ut}>${Pl(ts,Ue,Q)}</style>`;let re=Lt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(se,(we,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)Qe=`${Qe}${le.join(`
|
|
292
|
-
`)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-
|
|
291
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${y}`)}function yo(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}function hi(e){let n=new Set,t=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let i of e){let a;while((a=t.exec(i))!==null)n.add(a[1]);t.lastIndex=0}return[...n]}async function Fe(e,n,t,i,a,l,c,y=new Set,v,E=rt(a),R,M=e){let{extractVariables:N}=await o("stx/variable-extractor",()=>import("./chunk-jbw2dpx1.js")),j=y??new Set;if(j.has(e))return`[Circular component reference: ${e}]`;let P=new Set(j);P.add(e);let D=typeof n.client==="string"?n.client.trim():"";if("client"in n)delete n.client;let X=D&&D!=="load"&&ug(D)?D:"";try{let F=(se)=>se.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),L=M.endsWith(".stx")?M.slice(0,-4):M,Q=null,te=a.__importedComponents;if(te){let se=[L,L.toLowerCase(),F(L),H(L)];for(let le of se)if(te.has(le)){Q=te.get(le);break}}let ae=[];if(!Q){let se=[`${L}.stx`,`${F(L)}.stx`,`${H(L)}.stx`],le=[...new Set(se)],we=a.__originalFilePath,he=[];if(he.push(...c._layerComponentDirs??[]),we){let be=ce.join(ce.dirname(we),"components");he.push(be)}let He=c._rootComponentsDir;if(typeof He==="string"&&$o(i,c)&&!he.includes(He))he.push(He);if(i&&!he.includes(i))he.push(i);if(typeof He==="string"&&!he.includes(He))he.push(He);let Ce=ce.join(ce.dirname(l),"components");if(!he.includes(Ce))he.push(Ce);if(c.componentsDir&&c.componentsDir!==i&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let be of c.additionalComponentsDirs??[])if(be&&!he.includes(be))he.push(be);let ct=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(L),st=(R?.events??[]).map((be)=>be.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Zt=Object.hasOwn(n,"checked")||Boolean(R?.reactiveProps?.includes("checked")),rs=Object.hasOwn(n,"value")||Boolean(R?.reactiveProps?.includes("value")),gt=!st.includes("valuechange")&&(Zt||st.includes("change")&&!rs),yt=c._nativeHostAttrs&&/^textinput$/i.test(L),ln=st.includes("update:value")&&!st.includes("input"),un=c._nativeHostAttrs&&/^video$/i.test(L),_n=c._nativeHostAttrs&&/^image$/i.test(L),_t=Ns([...Object.keys(n),...R?.reactiveProps??[]],R?.events,n),Sn=Object.hasOwn(n,"src")||Boolean(R?.reactiveProps?.includes("src")),$n=Object.hasOwn(n,"source")||Boolean(R?.reactiveProps?.includes("source")),En=un&&Sn&&!$n&&(R?.events??[]).every((be)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(be.replace(/^@/,"").split(".")[0])),mt=(be)=>Object.hasOwn(n,be)||Boolean(R?.reactiveProps?.includes(be)),kn=c._nativeHostAttrs&&/^button$/i.test(L)&&(mt("symbol")||mt("iconOnly")||mt("title")&&!mt("label")&&!t.trim()),or=c._targetComponentFallbackNames?.some((be)=>be.toLowerCase()===L.toLowerCase())&&(!ct||gt)&&(!yt||ln)&&(!un||En)&&(!_n||_t)&&!kn;for(let be of or?[]:c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be);let wt=typeof c.root==="string"?ce.resolve(c.root):void 0,No=wt??ce.dirname(l),St=[];if(wt)St.push(ce.resolve(wt,"resources/views/components")),St.push(ce.resolve(wt,"resources/components")),St.push(ce.resolve(wt,"src/components")),St.push(ce.resolve(wt,"components"));St.push(ce.resolve(import.meta.dir,"components"));for(let be of St)if(!he.includes(be))he.push(be);let ar=c._pluginComponentDirs;if(Array.isArray(ar)){for(let be of ar)if(typeof be==="string"&&!he.includes(be))he.push(be)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(or){for(let be of c._targetComponentDirs??[])if(be&&!he.includes(be))he.push(be)}let Rn=c._nativePrimitivesFallback;if(Rn&&!Rn.except.some((be)=>be.toLowerCase()===L.toLowerCase())&&!he.includes(Rn.dir))he.push(Rn.dir);let cr=[...new Set(he.map((be)=>{if(!be)return be;return ce.isAbsolute(be)?be:ce.resolve(No,be)}))];he.length=0,he.push(...cr);let is=`${L}\x00${l}\x00${cr.join("\x00")}`,os=qn.get(is);if(os)if(await r(os))Q=os;else qn.delete(is);if(!Q&&(L.startsWith("./")||L.startsWith("../")))Q=ce.resolve(ce.dirname(l),`${L}.stx`),ae.push(Q);else if(!Q)for(let be of he){if(!be)continue;for(let Cn of le){let Tn=ce.join(be,Cn);if(ae.push(Tn),await r(Tn)){Q=Tn;break}}if(Q)break;if(!Q)try{let Cn=await import("fs");if(!Cn.statSync(be,{throwIfNoEntry:!1})?.isDirectory())continue;let Lo=8,as=[{path:be,depth:0}];while(as.length>0&&!Q){let An=as.pop();if(An.depth>=Lo)continue;let lr;try{lr=Cn.readdirSync(An.path,{withFileTypes:!0})}catch{continue}for(let In of lr){if(!In.isDirectory())continue;if(In.name==="node_modules"||In.name.startsWith("."))continue;let ur=ce.join(An.path,In.name);for(let Bo of le){let cs=ce.join(ur,Bo);if(ae.push(cs),await r(cs)){Q=cs;break}}if(Q)break;as.push({path:ur,depth:An.depth+1})}}}catch{}if(Q)break}if(Q)qn.set(is,Q)}if(!Q||!await r(Q))return bo(e,l,ae),yo(e);v.add(Q);let ne;if(tn.has(Q)&&qs.get(Q)===po(Q))ne=tn.get(Q);else try{let se=po(Q);ne=await Bun.file(Q).text(),tn.set(Q,ne),qs.set(Q,se)}catch(se){let le=se instanceof Error?se.message:String(se);return bo(e,l,[Q],le),yo(e)}if(R)for(let se of new Set([...Object.keys(n),...R.reactiveProps??[]])){let le=se.toLowerCase();if(le.startsWith("aria-")||le.startsWith("data-"))continue;let we=se.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${we}\\b`).test(ne))R.declaredProps.add(se);if(new RegExp(`\\$props\\s*(?:\\.\\s*${we}\\b|\\[\\s*['"]${we}['"]\\s*\\])`).test(ne)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${we}['"]`).test(ne))R.consumedProps?.add(se)}let ue=new Set(["__originalFilePath","__importedComponents",Nn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),Ee={};for(let[se,le]of Object.entries(a))if(!se.startsWith("__")||ue.has(se))Ee[se]=le;let Te=E.length>0?{[Vn]:[...E]}:{},Ae=t;if(t.includes("@include")){let{processIncludes:se}=await o("stx/includes",()=>import("./chunk-m24mv9fe.js"));Ae=await se(t,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ae)){let{processComponents:se}=await o("stx/component-renderer",()=>import("./chunk-8dgxebzq.js"));Ae=await se(Ae,{...a,__processedComponents:j,...Te},l,c,v)}let ke=[];if(Kc(Ae)){let{processExpressions:se}=await o("stx/expressions",()=>import("./chunk-efz96s8y.js")),le=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...Te}:E.length>0?{...a,...Te}:a;Ae=se(Ae,le,l);for(let we of Ae.matchAll(/\{\{([\s\S]*?)\}\}/g))ke.push(we[1].trim())}let Je=G(Ae),ut=[],Ct=Je.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(se,le)=>{let we=Je.scripts[Number(le)]||"",he=we.match(/^<script\b([^>]*)>/i)?.[1]||"",He=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Ce=!He||["module","text/javascript","application/javascript"].includes(He),ct=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Ce&&!ct)return ut.push(we),"";return we}),{extractSlotContent:Yn}=await o("stx/slots",()=>import("./chunk-emjt4a58.js")),ft=Yn(Ct),dt={};if(ft.defaultSlot?.trim())dt.default=ft.defaultSlot;for(let[se,le]of ft.namedSlots)dt[se]=le.content;let pt=a.__stx_scope_seq??={n:0,key:zs(String(a.__filename??l))},Tt=So(e,process.cwd()),it=`stx_${(Tt.endsWith(".stx")?Tt.slice(0,-4):Tt).replace(/[^a-zA-Z0-9]/g,"_")}_${++pt.n}_${pt.key}`,Ue={...Ee,$uid:it,$native:c._nativeHostAttrs===!0,...n,props:n,slot:Ct,$slots:dt,__processedComponents:P,__sections:{},__stx_signals_gate:Se(ne)||Kc(t),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...ke]};Il(ne,Ue);let Lt=ne,sn=de(Lt);if(sn)Lt=sn.content.trim();let Qn=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Bt=[...ne.matchAll(Qn)];for(let[,se,le]of Bt)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(se))Oe(le,Q,c.strict);let qe=[],zt=null,es=Bt.some((se)=>/\bserver\b/.test(se[1]||"")&&/\bcache\b/.test(se[1]||"")),bt=null,Ye=null,Wt=null,rn=0,Ft=null;if(vl(c),es&&Qs>0){let se=El({props:n,slot:Ae,slotContext:t.trim()?kl(Ee):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((le)=>le.configFile),uid:it});if(se!==null){bt=`${Q}\x00${x(ne)}\x00${se}`;let le=Xn.get(bt);if(le){for(let we of le.dependencies)v.add(we);if(Qr(a,le.clientFactories),pt.n+=le.uidsConsumed,le.preservedClientExpressions.length>0){let we=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of le.preservedClientExpressions)we.add(he);a.__stx_preserved_client_expressions=[...we]}return le.output}Ye=new Set(v),Wt=Gr(a),rn=pt.n,Ft=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Vt=new Set;for(let se of Bt){let le=se[1]||"",we=se[2]||"",he=le.includes("server");if(je(le)&&we.trim())we=Be(we);if(he&&we){for(let Ce of De(we))Vt.add(Ce);try{await N(we,Ue,Q,{onFailure:(Ce)=>{if(Ce.kind!=="unknown")zt=Ce.kind}})}catch(Ce){}}if(!he){let Ce=we.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),ct=Ce.includes("{{")&&Ce.includes("}}"),st=Ce.includes("{!!")&&Ce.includes("!!}");if(ct||st)Ce=bi(Ce,Ue,Q);let Zt=le.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");qe.push(`<script${Zt}>${Ce}</script>`)}}let Xe=G(ne).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Ut=Xe?Xe[1]:"",ts=Xe?Xe[2]:"",Qe="",ee=Ut&&/\bscoped\b/i.test(Ut);if(Xe)Qe=`<style${Ut}>${Pl(ts,Ue,Q)}</style>`;let re=Lt;if(re=re.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Xe)re=re.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let se=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,le=[];if(re=re.replace(se,(we,he)=>{let He=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(He)le.push(`<style${He[1]}>${He[2]}</style>`);return""}),re=re.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),le.length>0)Qe=`${Qe}${le.join(`
|
|
292
|
+
`)}`}if(t&&re.includes("{{ text || slot }}"))re=re.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>t);let{applySlots:me}=await o("stx/slots",()=>import("./chunk-emjt4a58.js")),{defaultSlot:ye,namedSlots:Re}=ft,Ke=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Ct),et=c._nativeHostAttrs===!0&&qe.length>0||Ke&&qe.length>0||qe.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)),ns=(se)=>et?Vi(se,it):se,ss=new Map([...Re].map(([se,le])=>[se,{...le,content:ns(le.content)}]));re=await me(re,ns(ye),ss,Ue,et?it:"");let on=hi(qe),Ht=(Array.isArray(Ue.__stx_client_signal_names)?Ue.__stx_client_signal_names:[]).filter((se)=>!Vt.has(se));if(on.length>0||Ht.length>0)Ue.__stx_client_signal_names=[...new Set([...Ht,...on])];else delete Ue.__stx_client_signal_names;let Kt=E.filter((se)=>!Vt.has(se)&&!(se in n));if(Kt.length>0)Ue[Vn]=Kt;let an={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ce.dirname(Q),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||et||qe.length===0,defaultLayout:void 0};Ue.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:cn}=await o("stx/process",()=>import("./chunk-y1zq7txb.js")),tt=await cn(re,Ue,Q,an,v),ot=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let se of tt.matchAll(/\{\{([\s\S]*?)\}\}/g))ot.add(se[1].trim());if(ot.size>0)a.__stx_preserved_client_expressions=[...ot];let nt=it,Ze=tt;if(et){let se="";if(Object.keys(n).length>0)try{se=` data-stx-props="${Ks(JSON.stringify(n))}"`}catch{}let le=X?` stx-hydrate="${Ks(X)}"`:"",we=Object.fromEntries(Object.entries(dt).map(([gt,yt])=>[gt,Boolean(yt)])),he=Object.keys(we).length>0?` data-stx-slots="${Ks(JSON.stringify(we))}"`:"",He=` data-stx-scope="${nt}"${se}${he}${le}`,Ce=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<span(?=[\s/>])/i.test(tt),ct=/^\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(tt),st=Ce?"span":"div",Zt=ct&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':Ce||ct?' style="display:contents"':"";Ze=lg(tt,He)??`<${st}${He} data-stx-component-wrapper${Zt}>${tt}</${st}>`;let rs=await Promise.all(qe.map(async(gt)=>{let yt=gt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!yt)return gt;let[,ln,un]=yt,_n=fo(gt,Ue,Q);if(_n!==null)return _n;let _t=await Dl(un,Q,c.buildMode==="compile"),Sn=yn(_t.clientCode,Me(Ue)),{vendorStyleTags:$n}=_t,En=Sn?`function(__scopeId) {
|
|
293
293
|
${Sn}
|
|
294
294
|
return (${_t.factoryBody})(__scopeId);
|
|
295
295
|
}`:_t.factoryBody,mt=X?null:ys(a,En),kn=mt?`window.__stxComponentFactories[${JSON.stringify(mt)}](${JSON.stringify(nt)});`:`(${En})(${JSON.stringify(nt)});`;if(X)return`${$n}<script type="stx/island" data-stx-island="${nt}" data-stx-scoped data-stx-owner="${nt}"${ln}>${kn}</script>`;return`${$n}<script data-stx-scoped data-stx-run="always" data-stx-owner="${nt}"${ln}>${kn}</script>`}));if(Ze=Ze+`
|
|
@@ -315,7 +315,7 @@ ${$e.yellow}${$e.bold}Message:${$e.reset} ${n}
|
|
|
315
315
|
`,y)R+=`
|
|
316
316
|
${$e.blue}${$e.bold}Context:${$e.reset}
|
|
317
317
|
${$e.dim}${y}${$e.reset}
|
|
318
|
-
`;return R}function fe(){tn.clear(),qs.clear(),qn.clear(),Js.clear(),Ys.clear(),Xn.clear()}function Wh(){return{size:tn.size,maxSize:500}}var Zs=b(128);async function Dl(e,n,t){let i=x(e,n,t),a=Zs.get(i);if(a){if(Ds(a.deps))return a;Zs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
318
|
+
`;return R}function fe(){tn.clear(),qs.clear(),qn.clear(),Js.clear(),Ys.clear(),Xn.clear()}function Wh(){return{size:tn.size,maxSize:500}}var Zs=b(128);async function Dl(e,n,t){let i=x(e,n,t),a=Zs.get(i);if(a){if(Ds(a.deps))return a;Zs.delete(i)}let l=fi(e,{filePath:n,projectRoot:process.cwd()}),c=l.code,y=gi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-pty7k0d2.js")),R=[],M=!1;if(v(c)){let L=c;c=await E(L,n,{projectRoot:process.cwd(),minify:t,collectInputs:R}),M=c===L}let{stripStxRuntimeImports:N}=await o("stx/signal-processing",()=>import("./chunk-5pjvhgej.js"));c=N(c);let j=A(c),P=Cl(j),D=new Set(z(j,!0).split(",").map((L)=>L.trim())),X=`function(__scopeId) {
|
|
319
319
|
${at("const",[...al,...P],j)}
|
|
320
320
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
321
321
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{u,f,R,d,q}from"./chunk-bq9xf8nq.js";import{z,As,U,Oe,de,kr,je,Be,r,h,Se,_}from"./chunk-
|
|
2
|
+
import{u,f,R,d,q}from"./chunk-bq9xf8nq.js";import{z,As,U,Oe,de,kr,je,Be,r,h,Se,_}from"./chunk-rmg1eesq.js";import{at}from"./chunk-9f6qx8b9.js";import{A}from"./chunk-2yxva96k.js";import{se}from"./chunk-he85ksa7.js";import{L,Ye}from"./chunk-k3rcpnzm.js";import{E,_n}from"./chunk-bmfk3b29.js";import C from"path";import{existsSync as St}from"fs";function ct(a,t){let c=0;for(let i=t;i<a.length;i++){let S=a[i];if(S==="("||S==="["||S==="{")c++;else if(S===")"||S==="]"||S==="}")c--;else if(S===","&&c===0)return i}return-1}function yt(a,t,c){let i=a,S=new RegExp(`${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),s=S.exec(i);while(s){let g=s.index,e=g+s[0].length-1,D=1,Z=e+1;while(Z<i.length&&D>0){if(i[Z]==="(")D++;else if(i[Z]===")")D--;Z++}if(D!==0)break;let rt=i.substring(e+1,Z-1),N=`${c}(${rt})`;i=i.substring(0,g)+N+i.substring(Z),S.lastIndex=g+N.length,s=S.exec(i)}return i}function $t(a){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(a)}function mt(a){let t=a,c=[],i=new Set,S=0,s=0,g=t.length,e=(N)=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]===N){s++;return}s++}},D=()=>{s++;while(s<g){if(t[s]==="\\"){s+=2;continue}if(t[s]==="`"){s++;return}if(t[s]==="$"&&t[s+1]==="{"){s+=2;let N=1;while(s<g&&N>0)if(t[s]==="{")N++,s++;else if(t[s]==="}")N--,s++;else if(t[s]==="'"||t[s]==='"')e(t[s]);else if(t[s]==="`")D();else s++;continue}s++}},Z=()=>{if(t[s]==="/"&&t[s+1]==="/"){while(s<g&&t[s]!==`
|
|
3
3
|
`)s++;return!0}if(t[s]==="/"&&t[s+1]==="*"){s+=2;while(s<g-1&&!(t[s]==="*"&&t[s+1]==="/"))s++;return s+=2,!0}return!1},rt=()=>{if(S!==0)return;let N=t.slice(s).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(N){let H=N[2];if(!i.has(H))c.push(H),i.add(H);return}let et=t.slice(s).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(et){let H=et[1];if(!i.has(H))c.push(H),i.add(H);return}let Y=t.slice(s).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(Y){let H=Y[1];if(!i.has(H))c.push(H),i.add(H)}};while(s<g){if(Z())continue;if(t[s]==="'"||t[s]==='"'){e(t[s]);continue}if(t[s]==="`"){D();continue}if(t[s]==="{"){S++,s++;continue}if(t[s]==="}"){S--,s++;continue}if(S===0&&/[a-z]/i.test(t[s])&&(s===0||/\s|[;{}()]/.test(t[s-1])))rt();s++}return c.join(", ")}function Et(a,t=""){let c=mt(a).split(",").map((i)=>i.trim()).filter(Boolean);return`
|
|
4
4
|
(function() {
|
|
5
5
|
${at("var",c)}
|
|
@@ -44,10 +44,10 @@ ${s}
|
|
|
44
44
|
}
|
|
45
45
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
46
46
|
}
|
|
47
|
-
})();`;return c+a+i}function It(a,t){if(L(a)){let S=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ye(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Ch(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Rf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!Z)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Je=new U(500),sc=new Set;function Eh(){sc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return sc}async function os(a,t,c,i,S,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,I,x)=>{let p=I.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),I});{let m=/@includeIf\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")")n--;w++}if(n!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],P=Z(O,g,c),k="";if(P&&await Bun.file(P).exists())S.add(P),k=`@include(${l})`;e=e.substring(0,x)+k+e.substring(w),m.lastIndex=0}}for(let[m,I]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,w=n+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),P=ct(O,0);if(P===-1){x.lastIndex=o;continue}let k=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let b=W[1],J=V.substring(W[0].length),B,M=ct(J,0);if(M!==-1)B=J.substring(M+1).trim();try{let T=`Boolean(${k})`,j;if(f(T)){let it=d(T,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(T,t));let tt=I?!j:j,nt="";if(tt){let it=Z(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(T){let j=T instanceof Error?T.message:String(T),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,k,V,W]=O;try{let b,J=k.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let M of b){let T={...t,[V]:M},j=await et(P,T,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],k=l.slice(O[0].length),V,W=k.match(/^\s*,\s*\{/);if(W){k=k.slice(W[0].length-1);let B=1,M=1;while(M<k.length&&B>0){if(k[M]==="{")B++;else if(k[M]==="}"){if(B--,B===0)break}M++}V=k.substring(0,M+1),k=k.slice(M+1)}let b,J=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),M={};if(V)try{M=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let T=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,M,a,x);e=e.replace(o,()=>nt),T=!0;break}}if(!T)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let M=B instanceof Error?B.message:String(B),T=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>T)}m.lastIndex=0}}function Z(m,I,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(I),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let b=C.resolve(W,p);if(b.startsWith(`${C.resolve(W)}${C.sep}`)&&St(b))return b}l=C.resolve(I,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(w+C.sep)||o===w,k=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))k=!0}if(!O&&!P&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,I,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:I,partialsDir:g}),h("Include",I,c,x,p)}async function et(m,I={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(n);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-
|
|
47
|
+
})();`;return c+a+i}function It(a,t){if(L(a)){let S=L(a).tag.match(/data-stx-scope="([^"]*)"/);if(S)return{html:a,mergedIntoExisting:S[1],stamped:!0,root:"body"};return{html:Ye(a,(s,g)=>`<body${g} data-stx-scope="${t}">`),mergedIntoExisting:null,stamped:!0,root:"body"}}let c=a.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(c){let i=c[2]+c[3],S=c[2].slice(1),s=i.match(/data-stx-scope="([^"]*)"/);if(s)return{html:a,mergedIntoExisting:s[1],stamped:!0,root:S};let g=c[1],e=c[2],D=c[3];return{html:`${g}${e} data-stx-scope="${t}"${D}${a.slice(c[0].length)}`,mergedIntoExisting:null,stamped:!0,root:S}}return{html:a,mergedIntoExisting:null,stamped:!1,root:null}}var Mt=0;function ut(a,t){let c=C.basename(a,".stx").replace(/[^a-zA-Z0-9]/g,"_"),i=t.__stx_scope_seq;return i?`stx_scope_${c}_${++i.n}_${i.key}`:`stx_scope_${c}_${++Mt}`}var lt=new Set,pt=new Set;function Ch(){lt.clear(),pt.clear()}var Tt=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function Rf(a){let t=(e)=>e.replace(/[^\n]/g," "),c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,t).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,t).replace(/<!--[\s\S]*?-->/g,t).replace(/\x00STX_HTML_COMMENT_\d+\x00/g,t).replace(/\{\{[\s\S]*?\}\}/g,t).replace(/\{!![\s\S]*?!!\}/g,t),i=[],S=0,s=/<(\/?)([A-Za-z][\w-]*)\b(?:[^<>"']|"[^"]*"|'[^']*')*?(\/?)>/g,g;while((g=s.exec(c))!==null){let e=g[1]==="/",D=g[2],Z=g[3]==="/"||Tt.has(D.toLowerCase());if(e){S=Math.max(0,S-1);continue}if(S===0)i.push(D);if(!Z)S++}return i}function ft(a){return/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(a)}var Je=new U(500),sc=new Set;function Eh(){sc.clear()}function Ct(a){if(a.__onceStore instanceof Set)return a.__onceStore;return sc}async function os(a,t,c,i,S,s=new Set){let g=i.partialsDir||C.join(C.dirname(c),"partials");if(g&&!C.isAbsolute(g))g=C.resolve(process.cwd(),g);let e=yt(a,"@partial","@include"),D=Ct(t);e=e.replace(/@once([\s\S]*?)@endonce/g,(m,I,x)=>{let p=I.trim(),n=`${c}:${p}`;if(D.has(n))return"";return D.add(n),I});{let m=/@includeIf\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")")n--;w++}if(n!==0)break;let l=e.substring(p+1,w-1),o=l.match(/^\s*['"]([^'"]+)['"]/);if(!o){m.lastIndex=w;continue}let O=o[1],P=Z(O,g,c),k="";if(P&&await Bun.file(P).exists())S.add(P),k=`@include(${l})`;e=e.substring(0,x)+k+e.substring(w),m.lastIndex=0}}for(let[m,I]of[["@includeWhen",!1],["@includeUnless",!0]]){let x=new RegExp(`${m.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),p;while((p=x.exec(e))!==null){let n=p.index,w=n+p[0].length-1,l=1,o=w+1;while(o<e.length&&l>0){if(e[o]==="(")l++;else if(e[o]===")")l--;o++}if(l!==0)break;let O=e.substring(w+1,o-1),P=ct(O,0);if(P===-1){x.lastIndex=o;continue}let k=O.substring(0,P).trim(),V=O.substring(P+1).trim(),W=V.match(/^\s*['"]([^'"]+)['"]/);if(!W){x.lastIndex=o;continue}let b=W[1],J=V.substring(W[0].length),B,M=ct(J,0);if(M!==-1)B=J.substring(M+1).trim();try{let T=`Boolean(${k})`,j;if(f(T)){let it=d(T,Object.keys(t));j=Boolean(it(...Object.values(t)))}else j=Boolean(u(T,t));let tt=I?!j:j,nt="";if(tt){let it=Z(b,g,c);if(it&&await Bun.file(it).exists())S.add(it);nt=`@include('${b}'${B?`, ${B}`:""})`}e=e.substring(0,n)+nt+e.substring(o),x.lastIndex=0}catch(T){let j=T instanceof Error?T.message:String(T),tt=h("Include",`Error evaluating ${m} condition: ${j}`,c,a,n);e=e.substring(0,n)+tt+e.substring(o),x.lastIndex=0}}}{let m=/@each\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let[,P,k,V,W]=O;try{let b,J=k.trim();if(f(J))b=d(J,Object.keys(t))(...Object.values(t));else b=u(J,t);let B="";if(Array.isArray(b)&&b.length>0)for(let M of b){let T={...t,[V]:M},j=await et(P,T,a,x);B+=j}else if(W)B=await et(W,{},a,x);e=e.substring(0,x)+B+e.substring(w+1),m.lastIndex=0}catch(b){let J=b instanceof Error?b.message:String(b);e=e.substring(0,x)+h("Each",`Error in @each: ${J}`,c,a,x)+e.substring(w+1),m.lastIndex=0}}}{let m=/@includeFirst\s*\(/g,I;while((I=m.exec(e))!==null){let x=I.index,p=x+I[0].length-1,n=1,w=p+1;while(w<e.length&&n>0){if(e[w]==="(")n++;else if(e[w]===")"){if(n--,n===0)break}w++}if(n!==0)break;let l=e.substring(p+1,w),o=e.substring(x,w+1),O=l.match(/^\s*(\[[^\]]+\])/);if(!O){m.lastIndex=0,e=e.replace(o,"");continue}let P=O[1],k=l.slice(O[0].length),V,W=k.match(/^\s*,\s*\{/);if(W){k=k.slice(W[0].length-1);let B=1,M=1;while(M<k.length&&B>0){if(k[M]==="{")B++;else if(k[M]==="}"){if(B--,B===0)break}M++}V=k.substring(0,M+1),k=k.slice(M+1)}let b,J=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(J)b=J[1];try{let B=JSON.parse(P.replace(/'/g,'"')),M={};if(V)try{M=R(V,t)}catch(j){let tt=j instanceof Error?j.message:String(j);if(i.debug){let nt=h("Include",`Error parsing includeFirst variables: ${tt}`,c,a,x,o);e=e.replace(o,()=>nt)}else e=e.replace(o,()=>b||"");continue}let T=!1;for(let j of B){let tt=Z(j,g,c);if(!tt)continue;if(await r(tt)){let nt=await et(j,M,a,x);e=e.replace(o,()=>nt),T=!0;break}}if(!T)if(b!==void 0)e=e.replace(o,()=>b);else if(i.debug){let j=h("Include",`None of the includeFirst paths exist: ${P}`,c,a,x,o);e=e.replace(o,()=>j)}else e=e.replace(o,"")}catch(B){let M=B instanceof Error?B.message:String(B),T=h("Include",`Error processing @includeFirst: ${M}`,c,a,x,o);e=e.replace(o,()=>T)}m.lastIndex=0}}function Z(m,I,x){try{let p=m;if(!m.endsWith(".stx"))p=`${m}.stx`;let n=C.resolve(I),w=C.resolve(C.dirname(x)),l;if(!p.startsWith("./")&&!p.startsWith("../")){for(let W of i._layerPartialDirs??[]){let b=C.resolve(W,p);if(b.startsWith(`${C.resolve(W)}${C.sep}`)&&St(b))return b}l=C.resolve(I,p)}else l=C.resolve(w,p);let o=C.normalize(l),O=o.startsWith(n+C.sep)||o===n,P=o.startsWith(w+C.sep)||o===w,k=!1,V=C.dirname(w);if(o.startsWith(V+C.sep)){if(!C.relative(V,o).split(C.sep).some((B)=>B.startsWith(".")&&B!=="."&&B!==".."))k=!0}if(!O&&!P&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${m}`),console.error(` Resolved to: ${o}`),console.error(` Allowed dirs: ${n}, ${w}`),null;return o}catch(p){return console.error(`Error resolving path ${m}: ${p}`),null}}let rt=C.resolve(c);s.add(rt);function N(m,I,x,p){return i.onIncludeError?.({includePath:m,templatePath:c,message:I,partialsDir:g}),h("Include",I,c,x,p)}async function et(m,I={},x,p){let n=Z(m,g,c);if(!n)return N(m,`Could not resolve path for include: ${m}`,x,p);let w=C.resolve(n);if(s.has(w)){let l=[...s,w].map((o)=>C.basename(o)).join(" -> ");return N(m,`Circular include detected: ${l}`,x,p)}try{S.add(n);let l;if(!l)try{l=await Bun.file(n).text()}catch(v){let K=v instanceof Error?v.message:String(v);return N(m,`Error loading include file ${m}: ${K}`,x,p)}if(l)l=l.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(l&&l.includes("@stream")){let{processStreamDirectives:v}=await import("./chunk-d0mrdbdw.js");l=v(l,t)}if(l&&(i.debug||!E()&&!_n()))try{let{warnUnbalancedTags:v}=await import("./chunk-ajj56vrw.js");v(l,n)}catch{}try{let{processESImports:v}=await import("./chunk-8dgxebzq.js");l=await v(l,t,n,i,S)}catch(v){if(i.debug)console.warn(`[stx] partial ES import extraction skipped for ${n}:`,v instanceof Error?v.message:v)}let o=l,O=de(o);if(O)o=O.content.trim();let k=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),V="";if(k)V=`<style${k[1]}>${k[2]}</style>`;let W=[];o=o.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(v,K,y)=>{if(!ft(K))return"";return W.push({attrs:K,body:y}),`__STX_DATA_BLOCK_${W.length-1}__`}),o=o.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let b={...t};b.__stx_signals_gate=Se(l,n);for(let[v,K]of Object.entries(I))b[v]=K;let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,B=[...l.matchAll(J)].sort((v,K)=>{let y=(v[1]||"").includes("server"),X=(K[1]||"").includes("server");return Number(X)-Number(y)}),M="",T=null,j=!1,tt=!1;for(let v of B){let K=v[1]||"",y=v[2]||"";if(ft(K))continue;let X=K.includes("server"),wt=je(K);if(!X&&!/\bsrc\s*=/i.test(K))Oe(y,n,i.strict);if(!X&&y.trim()){let{interpolateScriptExpressions:F}=await import("./chunk-efz96s8y.js");y=F(y,b,m)}let ot="";try{let{extractAndStripCssImports:F,renderVendorStyleTags:Q}=await import("./chunk-83yd1h6k.js"),st=F(y,{filePath:n,projectRoot:process.cwd()});y=st.code,ot=Q(st.styles)}catch(F){if(i.debug)console.warn(`[stx] vendor-css extractor skipped for ${n}:`,F instanceof Error?F.message:F)}if(wt&&y.trim())y=Be(y);if(!X){try{let{injectBrowserCoreAutoImports:Q}=await import("./chunk-83yd1h6k.js");y=Q(y).code;let{hasUserImports:st,bundleClientScript:bt}=await import("./chunk-pty7k0d2.js");if(st(y))y=await bt(y,n,{projectRoot:process.cwd()})}catch(Q){if(i.debug)console.warn(`[stx] bundler skipped for ${n}:`,Q instanceof Error?Q.message:Q)}let{stripStxRuntimeImports:F}=await import("./chunk-5pjvhgej.js");y=F(y)}let dt=$t(y);if(!X){let{extractBridgeData:F,generateServerDataBridge:Q}=await import("./chunk-83yd1h6k.js"),st=Q(y,F(b));if(st)y=`${st}
|
|
48
48
|
${y}`}if(dt&&!X){j=!0,T=ut(n,t);let F=A(y),Q=gt(F,T);M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}">${Q}</script>
|
|
49
|
-
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-
|
|
50
|
-
`}}if(W.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-
|
|
49
|
+
`;continue}if(X)try{let{extractVariables:F}=await import("./chunk-jbw2dpx1.js");await F(y,b,n)}catch(F){if(i.debug)console.warn(`Warning: Could not extract variables from server script in ${n}:`,F)}if(!X&&!dt){let F=K.replace(/\bclient\b/i,"").trim();T=ut(n,t);let Q=A(y),st=gt(Q,T);if(/__scopeRegistration\["(?!__stx)[^"]+"\]\s*=|Object\.defineProperty\(__scopeRegistration, "(?!__stx)/.test(st))tt=!0;M+=`${ot}<script data-stx-scoped data-stx-run="always" data-stx-owner="${T}"${F?` ${F}`:""}>${st}</script>
|
|
50
|
+
`}}if(W.length>0){let{interpolateScriptExpressions:v}=await import("./chunk-efz96s8y.js");o=o.replace(/__STX_DATA_BLOCK_(\d+)__/g,(K,y)=>{let X=W[Number(y)];return`<script${X.attrs}>${v(X.body,b,m)}</script>`})}if(T){let v=It(o,T);if(o=v.html,v.mergedIntoExisting){let y=T,X=v.mergedIntoExisting;M=M.split(`'${y}'`).join(`'${X}'`).split(`"${y}"`).join(`"${X}"`),T=X}else if(!v.stamped&&j&&!lt.has(n))lt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`);if(v.stamped&&v.root!=="body"&&(j||tt)&&!pt.has(n)){let y=Rf(o);if(y.length>1)pt.add(n),console.warn(`[stx] ${C.relative(process.cwd(),n)} declares ${j?"signals":"bindings"} and has ${y.length} top-level elements (${y.map((X)=>`<${X}>`).join(", ")}). Only the first is scoped, so bindings in the others cannot see what this partial's script declares. Wrap the partial's markup in a single root element.`)}let K=v.stamped&&v.root!==null&&kr(v.root);M=Rt(M,K?T:null)}if(o.includes("@include")||o.includes("@partial"))o=await os(o,b,n,i,S,s);let{processLoops:nt,reportDeferredLoopWarnings:it}=await import("./chunk-cernr99x.js"),G=nt(o,b,n,void 0,!0);G=se(G,b,n),G=it(G);let{processMetaDirectives:ht,processSeoDirective:xt,processStructuredData:_t}=await import("./chunk-9896204h.js");if(G=ht(G,b,n,i),G=_t(G,b,n),G=xt(G,b,n,i),G=_(G,b,n),V)G+=`
|
|
51
51
|
`+V;if(M)G+=`
|
|
52
52
|
`+M;return G}catch(l){if(l instanceof q)throw l;let o=l instanceof Error?l.message:String(l);return N(m,`Error processing include ${m}: ${o}`,x,p)}}let Y=/@include\s*\(/g,H;while((H=Y.exec(e))!==null){let m=H.index,I=m+H[0].length-1,x=1,p=I+1;while(p<e.length&&x>0){if(e[p]==="(")x++;else if(e[p]===")")x--;p++}if(x!==0)break;let n=e.substring(m,p),w=e.substring(I+1,p-1),l=w.match(/^\s*['"]([^'"]+)['"]/);if(!l){Y.lastIndex=p;continue}let o=l[1],O,P=w.substring(l[0].length),k=ct(P,0);if(k!==-1)O=P.substring(k+1).trim();let V={};if(O)try{V=R(O,t)}catch(b){let J=b instanceof Error?b.message:String(b);e=e.replace(n,h("Include",`Error parsing include variables for ${o}: ${J}`,c,a,m)),Y.lastIndex=0;continue}let W=await et(o,V,a,m);e=e.substring(0,m)+W+e.substring(p),Y.lastIndex=0}return e}function is(a,t){let c=a;function i(S,s,g,e){let D=S,Z=!0;while(Z){Z=!1;let rt=new RegExp(`@${s}\\(['"]([^'"]+)['"]\\)`),N=D.match(rt);if(!N||N.index===void 0)break;let et=N.index,Y=N[1],H=et+N[0].length,m=new RegExp(`@${s}\\(`),I=new RegExp(`@${g}(?![a-z])`),x=1,p=H,n=-1;while(x>0&&p<D.length){let l=D.slice(p),o=l.match(m),O=l.match(I),P=o?p+o.index:1/0,k=O?p+O.index:1/0;if(P<k)x++,p=P+(o[0].length||1);else if(k<1/0){if(x--,x===0){n=k;break}p=k+g.length+1}else break}if(n===-1)break;let w=D.slice(H,n);if(!t[Y])t[Y]=[];if(e)t[Y].unshift(w);else t[Y].push(w);D=D.substring(0,et)+D.substring(n+`@${g}`.length),Z=!0}return D}return c=i(c,"push","endpush",!1),c=i(c,"prepend","endprepend",!0),c}function as(a,t){return a.replace(/@stack\(['"]([^'"]+)['"]\)/g,(c,i)=>{if(!t[i]||t[i].length===0)return"";return t[i].join(`
|
|
53
53
|
`)})}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{vn,wi}from"./chunk-
|
|
2
|
+
import{vn,wi}from"./chunk-7nvxgt19.js";import"./chunk-27rzdq3n.js";export{wi as generateRuntimeConfigTypes,vn as prepareRuntimeConfig};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{xi,Ws,u,f,R,st,d,qs,t,c,w}from"./chunk-bq9xf8nq.js";import{ve,Pt,J,I,Mt,Z,_}from"./chunk-r0g70zrf.js";import{ir}from"./chunk-t6z2ty9v.js";import{se}from"./chunk-he85ksa7.js";import{ys}from"./chunk-wj78td69.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=w(n,"(",")",x);if(b===-1)continue;let p=n.slice(g,b).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=b,l.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,p=x+1;while(p<e.length&&b>0){if(e[p]==="(")b++;else if(e[p]===")"){if(b--,b===0)break}p++}if(b!==0)continue;let s=e.substring(x+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],h=s.slice(a[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let S=h.slice(O[0].length).trim();if(!S)continue;try{let v=R(S,r),W=JSON.stringify(v),F=`@component('${y}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:p}=i[g];e=e.substring(0,x)+p+e.substring(b)}return e}function oe(n,r,l){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,p=x+1,s=null,m=!1;while(p<e.length&&b>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}p++}if(b!==0)break;let a=e.substring(x+1,p),y=l(a);e=e.substring(0,g)+y+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);xi(i);let b=!1,s=d(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!st(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let p=g+b[0].length-1,s=w(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;x=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:ne);o=g,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Mt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!qs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!qs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,l,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function p(s){let m=0,a=x.length-1,y=0;while(m<=a){let h=m+a>>1;if(x[h].pos<=s)y=x[h].depth,m=h+1;else a=h-1}return y}while((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[0].length-1,a=1,y=m+1,h=-1;while(y<n.length&&a>0){if(n[y]==="(")a++;else if(n[y]===")"){if(a--,a===0){h=y;break}}y++}if(h===-1)continue;let O=n.substring(m+1,h),S=Pt(O);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,A=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),E=L.exec(n);if(!E)break;if(P&&P.index<E.index)A++,B=P.index+P[0].length;else{if(A--,A===0){V=E.index;break}B=E.index+11}}if(V===-1)continue;let k=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<k.length){let P=k.indexOf("@",N);if(P===-1)break;let E=k.substring(P);if(/^@forelse\s*\(/.test(E))z++,N=P+1;else if(E.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&E.startsWith("@empty")){if(k.length<=P+6||!/[a-z]/i.test(k[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:k.substring(0,U),emptyContent:k.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${x})${b}@endforeach`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function us(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function or(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of ir(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let y=a.index,h=a.index+a[0].length-1,O=1,S=h+1,v=-1;while(S<s.length&&O>0){if(s[S]==="(")O++;else if(s[S]===")"){if(O--,O===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=Pt(W);if(!F)continue;let A=y,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,k=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&k<s.length){K.lastIndex=k,U.lastIndex=k;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,k=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:B,itemVar:D,content:P}}k=N.index+11}}}return null}function b(s,m){let a=s;while(!0){let y=x(a);if(!y)break;let{start:h,end:O,arrayExpr:S,itemVar:v,content:W}=y;try{let F=S.trim(),A;if(f(F))A=d(F,Object.keys(m))(...Object.values(m));else A=u(F,m);let B=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),B=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),B=!0;else{let E=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+E+a.substring(O);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,k,K=!1;if(L.includes("=>")){let E=L.split("=>").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])V=E[0],k=E[1];else k=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])k=E[0],V=E[1],K=!0;else k=L}else k=L;let U="",z=new Set(J(`${S} as ${v}`)),N=A,P=m[Ws]??new WeakMap;for(let E=0;E<N.length;E++){let j=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[Ws]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(k.startsWith("[")&&k.endsWith("]")){let H=k.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[k]=j}else if(k.startsWith("{")&&k.endsWith("}")){let H=k.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[k]=j}else M[k]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[k]=j[1];else M[V]=E;let C=ce(W,M);C=or(C,M,l,e,!0),C=se(C,M,l),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=_(C,M,l),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(O)}catch(F){let A=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+A+a.substring(O)}}return a}i=b(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:us(i)}function Pf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return qs(n)}function $e(n,r,l,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,p=w(o,"(",")",b);if(p===-1)break;let s=Pf(o.slice(b+1,p)),m=p+1,a=ys(o.slice(x),"for","endfor");if(a.length===0)break;let y=a[0].content,h=x+a[0].end;if(!ge(s)){let O=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+O+o.substring(h),i=!0;continue}try{let O=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(O.length>0&&S){let D=Re({forExpr:s,content:y,iterVarNames:O,context:r,filePath:l,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(y),B=Function(...v,"__stxRenderLoopValue",`
|
|
2
|
+
import{xi,Ws,u,f,R,st,d,qs,t,c,w}from"./chunk-bq9xf8nq.js";import{ve,Pt,J,I,Mt,Z,_}from"./chunk-rmg1eesq.js";import{ir}from"./chunk-9cmvsbpe.js";import{se}from"./chunk-he85ksa7.js";import{ys}from"./chunk-wj78td69.js";var de=1000,pe=!1;function he(n,r){let l=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,e="",o=0,i;while((i=l.exec(n))!==null){let g=i.index+i[0].length,x=i.index+i[0].indexOf("("),b=w(n,"(",")",x);if(b===-1)continue;let p=n.slice(g,b).trim();if(!p)continue;if(!Object.keys(r).some((a)=>new RegExp(`(?:^|[^\\w$.])${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(p)))continue;let m;try{let a=R(p,r);if(!a||typeof a!=="object")continue;m=JSON.stringify(a)}catch{continue}e+=n.slice(o,g)+m,o=b,l.lastIndex=b}return o===0?n:e+n.slice(o)}function me(n,r){let l=/@component\s*\(/g,e=n,o,i=[];while((o=l.exec(e))!==null){let g=o.index,x=g+o[0].length-1,b=1,p=x+1;while(p<e.length&&b>0){if(e[p]==="(")b++;else if(e[p]===")"){if(b--,b===0)break}p++}if(b!==0)continue;let s=e.substring(x+1,p),m=p+1,a=s.match(/^\s*['"]([^'"]+)['"]/);if(!a)continue;let y=a[1],h=s.slice(a[0].length),O=h.match(/^\s*,\s*/);if(!O)continue;let S=h.slice(O[0].length).trim();if(!S)continue;try{let v=R(S,r),W=JSON.stringify(v),F=`@component('${y}', ${W})`;i.push({start:g,end:m,replacement:F})}catch{continue}}for(let g=i.length-1;g>=0;g--){let{start:x,end:b,replacement:p}=i[g];e=e.substring(0,x)+p+e.substring(b)}return e}function oe(n,r,l){let e=n,o=new RegExp(`${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),i;while((i=o.exec(e))!==null){let g=i.index,x=g+i[0].length-1,b=1,p=x+1,s=null,m=!1;while(p<e.length&&b>0){let h=e[p];if(m){m=!1,p++;continue}if(h==="\\"&&s){m=!0,p++;continue}if(s){if(h===s)s=null;p++;continue}if(h==='"'||h==="'"||h==="`"){s=h,p++;continue}if(h==="(")b++;else if(h===")"){if(b--,b===0)break}p++}if(b!==0)break;let a=e.substring(x+1,p),y=l(a);e=e.substring(0,g)+y+e.substring(p+1)}return e}function be(n,r){let l=n;return l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(e,o)=>{if(o in r)return`:${o}="${o}"`;return e}),l=l.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(e,o,i)=>{try{if(I(i,r.__stx_client_signal_names||[]))return e;let g=Object.keys(r),x=Object.values(r);xi(i);let b=!1,s=d(i,g,()=>{b=!0})(...x);if(b)return e;let m=JSON.stringify(s);if(m===void 0){if(!st(i).some((h)=>!(h in r)))return"";return e}let a=Buffer.from(m,"utf8").toString("base64");return`__stx_${o}="${a}"`}catch(g){return e}}),l}var ee="<!--__STX_BREAK__-->",ne="<!--__STX_CONTINUE__-->";function le(n,r){let l=/\{\{\{?|\{!!|@(break|continue)(?![\w$])/g,e="",o=0;for(let i=l.exec(n);i;i=l.exec(n)){if(!i[1]){let p=i[0].length===3&&i[0]==="{{{"?3:2,s=i[0]==="{!!"?n.indexOf("!!}",l.lastIndex):ve(n,i.index,p);if(s<0)break;l.lastIndex=s+(i[0]==="{!!"?3:p);continue}let g=l.lastIndex,x=!0,b=/^\s*\(/.exec(n.slice(g));if(b){let p=g+b[0].length-1,s=w(n,"(",")",p);if(s<0)break;g=s+1;try{let m=`!!(${n.slice(p+1,s).trim()})`;x=f(m)?Boolean(d(m,Object.keys(r))(...Object.values(r))):Boolean(u(m,r))}catch{x=!1}}if(e+=n.slice(o,i.index),x)return e+(i[1]==="break"?ee:ne);o=g,l.lastIndex=g}return e+n.slice(o)}function ae(n){let r=(o)=>o.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),l="",e=0;return Mt(n,(o,i,g)=>(l+=ie(r(n.slice(e,g))),l+=`\${__stxRenderLoopValue(${g}, (${i}), ${o.length})}`,e=g+o.length,o)),l+ie(r(n.slice(e)))}function ue(n,r,l,e){return Z(n,r,l==null?"":String(l),!1,e)}function ie(n){let r=n;return r=oe(r,"@break",(l)=>{let e=l.trim();if(!qs(e))return"";return`\`; if (${e}) { break; } result += \``}),r=oe(r,"@continue",(l)=>{let e=l.trim();if(!qs(e))return"";return`\`; if (${e}) { continue; } result += \``}),r=r.replace(/@break(?!\()/g,"`; break; result += `"),r=r.replace(/@continue(?!\()/g,"`; continue; result += `"),r}function xe(n){let r=/@forelse\s*\(/g,l,e=[],o=/@foreach\s*\(/g,i=/@endforeach/g,g;while((g=o.exec(n))!==null)e.push({pos:g.index,delta:1});while((g=i.exec(n))!==null)e.push({pos:g.index,delta:-1});e.sort((s,m)=>s.pos-m.pos);let x=[],b=0;for(let s of e)b+=s.delta,x.push({pos:s.pos,depth:b});function p(s){let m=0,a=x.length-1,y=0;while(m<=a){let h=m+a>>1;if(x[h].pos<=s)y=x[h].depth,m=h+1;else a=h-1}return y}while((l=r.exec(n))!==null){if(p(l.index)>0)continue;let s=l.index,m=l.index+l[0].length-1,a=1,y=m+1,h=-1;while(y<n.length&&a>0){if(n[y]==="(")a++;else if(n[y]===")"){if(a--,a===0){h=y;break}}y++}if(h===-1)continue;let O=n.substring(m+1,h),S=Pt(O);if(!S)continue;let{arrayExpr:v,itemVar:W}=S,F=h+1,A=1,B=F,D=/@forelse\s*\(/g,L=/@endforelse/g,V=-1;while(A>0&&B<n.length){D.lastIndex=B,L.lastIndex=B;let P=D.exec(n),E=L.exec(n);if(!E)break;if(P&&P.index<E.index)A++,B=P.index+P[0].length;else{if(A--,A===0){V=E.index;break}B=E.index+11}}if(V===-1)continue;let k=n.substring(F,V),K=V+11,U=-1,z=0,N=0;while(N<k.length){let P=k.indexOf("@",N);if(P===-1)break;let E=k.substring(P);if(/^@forelse\s*\(/.test(E))z++,N=P+1;else if(E.startsWith("@endforelse"))z--,N=P+11;else if(z===0&&E.startsWith("@empty")){if(k.length<=P+6||!/[a-z]/i.test(k[P+6])){U=P;break}N=P+1}else N=P+1}if(U===-1)continue;return{start:s,end:K,arrayExpr:v,itemVar:W,foreachContent:k.substring(0,U),emptyContent:k.substring(U+6)}}return null}function ce(n,r){let l=n;while(!0){let e=xe(l);if(!e)break;let{start:o,end:i,arrayExpr:g,itemVar:x,foreachContent:b,emptyContent:p}=e;try{let s;if(f(g))s=d(g,Object.keys(r))(...Object.values(r));else s=u(g,r);let m;if(!Array.isArray(s)||s.length===0)m=p;else m=`@foreach (${g} as ${x})${b}@endforeach`;l=l.substring(0,o)+m+l.substring(i)}catch(s){let m=s instanceof Error?s.message:String(s),a=c("Forelse",`Error in @forelse(${g} as ${x}): ${m}`,t.EVALUATION_ERROR);l=l.substring(0,o)+a+l.substring(i)}}return l}var fe="<!--stx:foreach-not-iterable:",ye=/<!--stx:foreach-not-iterable:([^|>]*)\|([^>]*?)-->/g;function Ee(n,r){return`${fe}${encodeURIComponent(n)}|${encodeURIComponent(r)}-->`}function _e(n,r){console.warn(`[stx] @foreach(${n}) in ${r}: ${n} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.")}function us(n){if(!n.includes(fe))return n;return n.replace(ye,(r,l,e)=>(_e(decodeURIComponent(l),decodeURIComponent(e)),""))}function or(n,r,l,e,o=!1){let i=n,g=new Set(r.__stx_client_signal_names||[]);for(let s of ir(n))g.add(s);if(g.size)r={...r,__stx_client_signal_names:[...g]};i=ce(i,r);function x(s){let m=/@foreach\s*\(/g,a;while((a=m.exec(s))!==null){let y=a.index,h=a.index+a[0].length-1,O=1,S=h+1,v=-1;while(S<s.length&&O>0){if(s[S]==="(")O++;else if(s[S]===")"){if(O--,O===0){v=S;break}}S++}if(v===-1)continue;let W=s.substring(h+1,v),F=Pt(W);if(!F)continue;let A=y,{arrayExpr:B,itemVar:D}=F,L=v+1,V=1,k=L,K=/@foreach\s*\(/g,U=/@endforeach/g;while(V>0&&k<s.length){K.lastIndex=k,U.lastIndex=k;let z=K.exec(s),N=U.exec(s);if(!N)break;if(z&&z.index<N.index)V++,k=z.index+z[0].length;else{if(V--,V===0){let P=s.substring(L,N.index),E=N.index+11;return{start:A,end:E,arrayExpr:B,itemVar:D,content:P}}k=N.index+11}}}return null}function b(s,m){let a=s;while(!0){let y=x(a);if(!y)break;let{start:h,end:O,arrayExpr:S,itemVar:v,content:W}=y;try{let F=S.trim(),A;if(f(F))A=d(F,Object.keys(m))(...Object.values(m));else A=u(F,m);let B=!1;if(!Array.isArray(A))if(A instanceof Map)A=Array.from(A),B=!0;else if(A instanceof Set)A=Array.from(A);else if(typeof A==="string")A=Array.from(A);else if(A&&typeof A==="object"&&!(A instanceof Date)&&!(A instanceof RegExp))A=Object.entries(A),B=!0;else{let E=Ee(F,l)+c("Foreach",`Error in @foreach: ${F} is not iterable`,t.TYPE_ERROR);a=a.substring(0,h)+E+a.substring(O);continue}let D=e?.loops?.useAltLoopVariable??pe,L=v.trim(),V=null,k,K=!1;if(L.includes("=>")){let E=L.split("=>").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])V=E[0],k=E[1];else k=L}else if(!L.startsWith("[")&&!L.startsWith("{")&&L.includes(",")){let E=L.split(",").map((j)=>j.trim());if(E.length===2&&E[0]&&E[1])k=E[0],V=E[1],K=!0;else k=L}else k=L;let U="",z=new Set(J(`${S} as ${v}`)),N=A,P=m[Ws]??new WeakMap;for(let E=0;E<N.length;E++){let j=N[E],te={index:E,iteration:E+1,first:E===0,last:E===N.length-1,count:N.length},M={...m,loop:te,$loop:te,[Ws]:P};if(Array.isArray(m.__stx_client_signal_names))M.__stx_client_signal_names=m.__stx_client_signal_names.filter((H)=>!z.has(H));if(k.startsWith("[")&&k.endsWith("]")){let H=k.slice(1,-1).split(",").map((T)=>T.trim());if(Array.isArray(j))H.forEach((T,X)=>{if(T)M[T]=j[X]});else M[k]=j}else if(k.startsWith("{")&&k.endsWith("}")){let H=k.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean);if(j!==null&&typeof j==="object")H.forEach((T)=>{let X=T.indexOf(":"),Q=(X===-1?T:T.slice(0,X)).trim(),re=X===-1?Q:T.slice(X+1).trim();if(Q&&re)M[re]=j[Q]});else M[k]=j}else M[k]=j;if(V)if(!K&&B&&Array.isArray(j)&&j.length===2)M[V]=j[0],M[k]=j[1];else M[V]=E;let C=ce(W,M);C=or(C,M,l,e,!0),C=se(C,M,l),C=le(C,M);let q=C.indexOf(ee),G=C.indexOf(ne),Y=q<0?G:G<0?q:Math.min(q,G);if(Y>=0)C=C.slice(0,Y);if(C=_(C,M,l),C=be(C,M),C=me(C,M),C=he(C,M),U+=C,Y>=0&&Y===q)break}a=a.substring(0,h)+U+a.substring(O)}catch(F){let A=c("Foreach",`Error in @foreach(${S.trim()} as ${v.trim()}): ${F instanceof Error?F.message:String(F)}`,t.EVALUATION_ERROR);a=a.substring(0,h)+A+a.substring(O)}}return a}i=b(i,r),i=$e(i,r,l,e);let p=e?.loops?.maxWhileIterations??de;return i=we(i,r,p),o?i:us(i)}function Pf(n){let r=/^(\s*)([A-Za-z_$][\w$]*|\[[^\]]*\]|\{[^}]*\})(\s+(?:of|in)\s)/.exec(n);if(!r||/^(?:const|let|var)$/.test(r[2]))return n;return`${r[1]}let ${n.slice(r[1].length)}`}function ge(n){return qs(n)}function $e(n,r,l,e){let o=n,i=!0;while(i){i=!1;let g=o.match(/@for\s*\(/);if(!g||g.index===void 0)break;let x=g.index,b=x+g[0].length-1,p=w(o,"(",")",b);if(p===-1)break;let s=Pf(o.slice(b+1,p)),m=p+1,a=ys(o.slice(x),"for","endfor");if(a.length===0)break;let y=a[0].content,h=x+a[0].end;if(!ge(s)){let O=c("For",`Unsafe expression in @for: ${s}`,t.UNSAFE_EXPRESSION);o=o.substring(0,x)+O+o.substring(h),i=!0;continue}try{let O=Ae(s),S=/@(?:for|foreach|if|unless)\s*\(/.test(y);if(O.length>0&&S){let D=Re({forExpr:s,content:y,iterVarNames:O,context:r,filePath:l,options:e});o=o.substring(0,x)+D+o.substring(h),i=!0;continue}let v=Object.keys(r),W=Object.values(r),F=ae(y),B=Function(...v,"__stxRenderLoopValue",`
|
|
3
3
|
let result = '';
|
|
4
4
|
for (${s}) {
|
|
5
5
|
result += \`${F}\`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{k}from"./chunk-9f6qx8b9.js";import{A,En}from"./chunk-2yxva96k.js";import{Ie,b,x,C,Y}from"./chunk-
|
|
2
|
+
import{k}from"./chunk-9f6qx8b9.js";import{A,En}from"./chunk-2yxva96k.js";import{Ie,b,x,C,Y}from"./chunk-rmg1eesq.js";import{a}from"./chunk-681t1ts7.js";import{he,nn,rn,sn}from"./chunk-kc5npv29.js";import{wt}from"./chunk-9cmvsbpe.js";import{mt,zn,Gt,ce}from"./chunk-tsvnhc0c.js";import{E,Cn}from"./chunk-bmfk3b29.js";import h from"path";var v=new Map,I=new Map,F=b(64),R=new Map,V=["composables","functions"];function H(e){let s=h.basename(e,".ts");return s==="index"||s==="types"||e.endsWith(".d.ts")}async function ee(e){if(e)return h.resolve(e);let s=`<default>:${process.cwd()}`,r=R.get(s);if(r!==void 0)return r;let t=await te();if(t!==null)R.set(s,t);return t}async function te(){let e=await a(),s=e.root||process.cwd(),r=e.composablesDir;if(r)return h.resolve(s,r);for(let t of V){let n=h.resolve(s,t);try{let c=new Bun.Glob("**/*.ts");for await(let i of c.scan({cwd:n,absolute:!0}))if(!H(i))return n}catch{}}return null}async function W(e){let s=Array.isArray(e)?e:e?[h.resolve(e)]:(await a())._layerComposableDirs??[await ee()].filter((t)=>!!t),r=new Map;for(let t of s){let n=new Bun.Glob("**/*.ts");try{for await(let c of n.scan({cwd:t,absolute:!0})){let i=h.relative(t,c);if(!H(c)&&!r.has(i))r.set(i,c)}}catch{}}return{key:s.join("\x00"),files:[...r.values()].sort()}}async function yo(e){let{files:s}=await W(e),r=Y({loader:"ts",target:"browser",define:C()}),t=[];for(let n of s)try{let c=await Bun.file(n).text(),i=r.scan(c).exports.filter((u)=>u!=="default");if(i.length>0)t.push({file:n,names:i})}catch{}return t}function ne(e,s){return new RegExp(`\\b${s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test(e)}function P(e,s){let r=new Set(e.match(/\w+/g)),t=new Set;for(let n of s)if(/^\w+$/.test(n)?r.has(n):ne(e,n))t.add(n);return t}var J=b(64);function X(e,s){let r=x(e,s.size),t=J.get(r);if(t)return t;let n;try{n=Ie(e,s)}catch{n=P(e,s)}let c=[...e.matchAll(/(?:const|let|var)\s*\{([^}]*)\}\s*=\s*window\.__composables\u0008/g),...e.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]@composables['"]/g)];for(let i of c)for(let u of i[1].split(",")){let f=u.trim().split(/\s*(?::|\u0008as\u0008)\s*/)[0];if(f&&s.has(f))n.add(f)}return J.set(r,n),n}function se(e){return!e||/^(?:module|(?:text|application)\/(?:java|ecma)script|application\/stx-[\w-]+)$/i.test(e)}var L=b(256);function oe(e,s){let r=new Set(s),t="",n=0,c=new Set;for(let i of e.matchAll(/<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi)){t+=e.slice(n,i.index),n=i.index+i[0].length;let u=i[1]??"",f=i[2]??"",d=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(u),m=d?(d[1]??d[2]??d[3]??"").trim():void 0;if(!se(m)){if(!/json/i.test(m??""))t+=` ${f} `;continue}let y=P(f,r);if(y.size===0)continue;let _=x(f,[...y].sort().join(",")),w=L.get(_);if(!w)w=X(f,y),L.set(_,w);for(let B of w)c.add(B)}t+=e.slice(n);for(let i of P(t,r))c.add(i);return c}function ie(e,s,r){let t=new Map;for(let{file:f,names:d}of e)for(let m of d)if(!t.has(m))t.set(m,f);let n=new Set(t.keys()),c=(f)=>{let d=[];for(let m of X(f,n))d.push(t.get(m));return d},i=new Set,u=r.flatMap((f,d)=>d===0?[...oe(f,t.keys())].map((m)=>t.get(m)):c(f));while(u.length>0){let f=[];for(let d of u){if(i.has(d))continue;i.add(d);for(let m of c(s.get(d)??""))if(!i.has(m))f.push(m)}u=f}return i}async function sh(e,s,r,t){let{key:n,files:c}=await W(e);if(!n)return null;let i=()=>[...new Set([...c,...c.flatMap((o)=>he(o))])],u=mt(i());if(c.length===0)return ce(v,n,u,""),null;c.sort();let f=Y({loader:"ts",target:"browser",define:C()}),d=Gt(I,n,u);if(!d){let o=new Map,l=[];for(let p of c)try{let S=await Bun.file(p).text();o.set(p,S);let g=f.scan(S).exports.filter((Q)=>Q!=="default");if(g.length>0)l.push({file:p,names:g})}catch{o.set(p,"")}d=ce(I,n,u,{codeByFile:o,modules:l})}let{codeByFile:m,modules:y}=d,_;if(s===void 0)_=new Set(c);else{let o=r?[s,...r]:[s],l=x(o.join("\x00"),n,o.length,u),p=F.get(l);if(_=p??ie(y,m,o),!p)F.set(l,_)}if(_.size===0)return null;let w=c.filter((o)=>_.has(o)),B=()=>{if(!t)return;for(let o of w)t.push(o,...he(o))},N=`${n}\x00${w.join("\x00")}\x00${rn()}`,U=Gt(v,N,u);if(U!==void 0)return B(),U||null;let D=[],M=new Set,T=new Set;for(let o of w)try{let l=m.get(o)??await Bun.file(o).text(),p=h.basename(o,".ts");for(let g of l.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(g[1])T.add(g[1]);let S=[];try{for(let g of f.scan(l).exports)if(g!=="default")M.add(g),S.push(g)}catch{}if(l=A(l),nn(l))l=await sn(l,o,{projectRoot:process.cwd(),externalizeUserModules:!1,expose:S}),l=wt(l);l=En(l),l=l.replace(/^export\s+(default\s+)?/gm,""),l=f.transformSync(l),D.push(`// Composable: ${p}
|
|
3
3
|
${l.trim()}`)}catch(l){console.warn(`[stx] Failed to load composable ${o}:`,l)}if(D.length===0||M.size===0)return ce(v,N,u,""),null;let Z=[...M].map((o)=>` try { if (!(${JSON.stringify(o)} in __c)) __c[${JSON.stringify(o)}] = ${o}; } catch (e) {}`).join(`
|
|
4
4
|
`),z=JSON.stringify([...M]),j=D.join(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{de,Mc,js,mn,m,Me,Le}from"./chunk-
|
|
2
|
+
import{de,Mc,js,mn,m,Me,Le}from"./chunk-rmg1eesq.js";import{dr,Qe,j}from"./chunk-681t1ts7.js";import{tr,i}from"./chunk-wbtca8ga.js";import{we}from"./chunk-gnkyh1ax.js";function b(s){return s.endsWith(".md")||s.endsWith(".markdown")}function k(s){let e=[];g(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let r=[...e];g(/<code\b[^>]*>[\s\S]*?<\/code>/gi,r);function g(n,p){let u;while((u=n.exec(s))!==null){let t=u.index,o=t+u[0].length;if(p?.some((l)=>t>=l.start&&o<=l.end))continue;e.push({start:t,end:o})}}if(e.length===0)return s;e.sort((n,p)=>n.start-p.start);let c="",a=0;for(let n of e){if(n.start<a)continue;c+=s.slice(a,n.start),c+=`@raw${s.slice(n.start,n.end)}@endraw`,a=n.end}return c+=s.slice(a),c}async function R(s,e={}){let{data:r,content:g}=dr(s),a=await(e.renderer??((n)=>Qe(n)))(g);return{html:k(a),frontmatter:r??{}}}import{dirname as v,resolve as _}from"path";function M(s){let e=s,r=de(s);if(r)e=r.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,c=[],a=[],n=[],p=(o)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(o),u;while((u=g.exec(s))!==null){let o=u[1],l=u[2],d=u[0],f=o.includes("server");if(p(l))n.push(d);else if(f)a.push(l);else c.push(d)}let t=e;{let o=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,l,d=[];while((l=o.exec(t))!==null){let f=l.index+l[0].length,x=t.indexOf("</script>",f);if(x===-1)continue;d.push({start:l.index,end:x+9}),o.lastIndex=x+9}for(let f=d.length-1;f>=0;f--)t=t.substring(0,d[f].start)+t.substring(d[f].end)}for(let o of c)t=t.replace(o,"");return{templateContent:t,serverScripts:a,clientScripts:c,signalsScripts:n}}function E(s,e){return`<!DOCTYPE html>
|
|
3
3
|
<html lang="en">
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="UTF-8">
|
|
@@ -14,5 +14,5 @@ ${a.join(`
|
|
|
14
14
|
`)}`}else{if(r.processClientScripts!==!1&&a.length>0){let o=p.__stx_event_bindings||[],l=Me(p),d=await Promise.all(a.map(async(w)=>{let C=w.match(/<script\b([^>]*)>/i)?.[1]||"";if(/\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(C))return w;let h=w.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!h)return w;return await Le(h[1],{eventBindings:o,templateContent:t,serverData:l,filePath:e})})),x=[await tr(d,{...n,buildMode:"compile"}),...d].filter(Boolean).join(`
|
|
15
15
|
`);if(t.match(/(<\/body>)/i))t=t.replace(/(<\/body>)/i,`${x}
|
|
16
16
|
$1`);else t+=`
|
|
17
|
-
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-
|
|
17
|
+
${x}`}t=await we(t)}if(r.wrapInDocument){if(!t.trim().toLowerCase().startsWith("<!doctype")&&!t.trim().toLowerCase().startsWith("<html"))t=E(t,r.title)}if(r.injectCSS)try{let{injectCss:o}=await import("./chunk-pnn0x21f.js");t=await o(t)}catch{}return t}
|
|
18
18
|
export{Ka};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Vg}from"./chunk-
|
|
2
|
+
import{Vg}from"./chunk-npav1grn.js";import"./chunk-681t1ts7.js";import"./chunk-76g51m0r.js";import"./chunk-zxfptbac.js";import"./chunk-605b93pe.js";import"./chunk-x8js27hd.js";import"./chunk-yewd8836.js";import"./chunk-rmg1eesq.js";import"./chunk-7nvxgt19.js";import"./chunk-27rzdq3n.js";import"./chunk-bq9xf8nq.js";import"./chunk-2yxva96k.js";import"./chunk-9f6qx8b9.js";export{Vg as buildApp};
|