@stacksjs/stx 0.2.839 → 0.2.840
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-03v59965.js +2 -0
- package/dist/{chunk-mtjt2z77.js → chunk-2knr61g3.js} +1 -1
- package/dist/{chunk-aza2zrhk.js → chunk-2vprq4x0.js} +4 -4
- package/dist/{chunk-aywvbcae.js → chunk-3gzhh69y.js} +1 -1
- package/dist/{chunk-np6h1ct6.js → chunk-40bkdswh.js} +1 -1
- package/dist/{chunk-w5h67xec.js → chunk-4rswqcfc.js} +1 -1
- package/dist/{chunk-1zfxmjrf.js → chunk-57x8wxdf.js} +4 -4
- package/dist/chunk-5khpy4na.js +2 -0
- package/dist/{chunk-mv49hr9y.js → chunk-5pbxjx8s.js} +1 -1
- package/dist/{chunk-rsn9rh07.js → chunk-66eba1h4.js} +1 -1
- package/dist/{chunk-8em568fw.js → chunk-6efz68j8.js} +1 -1
- package/dist/{chunk-8913k8g7.js → chunk-6n5kew7a.js} +1 -1
- package/dist/{chunk-d2mdh669.js → chunk-6nb07mdj.js} +1 -1
- package/dist/{chunk-yn17484y.js → chunk-7dnp8evg.js} +3 -3
- package/dist/{chunk-zyeg9t2t.js → chunk-7m53tpxn.js} +1 -1
- package/dist/{chunk-vr6qa0g2.js → chunk-7y5gz0cs.js} +1 -1
- package/dist/{chunk-mzj71r0m.js → chunk-88rwr1w2.js} +1 -1
- package/dist/{chunk-jzh0n2ct.js → chunk-8d4br2j5.js} +2 -2
- package/dist/{chunk-nb2tedk0.js → chunk-8gdtys3s.js} +1 -1
- package/dist/{chunk-whmqfr3y.js → chunk-9razzga7.js} +2 -2
- package/dist/chunk-a2p42cxf.js +2 -0
- package/dist/{chunk-8h0pnn5p.js → chunk-azderqyk.js} +5 -5
- package/dist/{chunk-f69cmsz9.js → chunk-b3fx75th.js} +1 -1
- package/dist/{chunk-pqg6j26p.js → chunk-b685aqy4.js} +1 -1
- package/dist/{chunk-4w3qpewn.js → chunk-b90xw7v4.js} +1 -1
- package/dist/{chunk-23zzbsms.js → chunk-c87zgwzn.js} +1 -1
- package/dist/{chunk-p83h2dbg.js → chunk-chjdnmqv.js} +2 -2
- package/dist/{chunk-v49rvx9y.js → chunk-ebxz30e5.js} +5 -5
- package/dist/{chunk-r0ssa1xd.js → chunk-ecjx9z8a.js} +1 -1
- package/dist/{chunk-78nsbzcm.js → chunk-fpn5txnm.js} +1 -1
- package/dist/{chunk-ndyj1d0z.js → chunk-g6r2313a.js} +1 -1
- package/dist/chunk-g957a2m3.js +2 -0
- package/dist/{chunk-cax1wts7.js → chunk-ga8waz0a.js} +1 -1
- package/dist/chunk-gbcwna5q.js +2 -0
- package/dist/chunk-jgx0ex9p.js +3 -0
- package/dist/{chunk-5hmm01av.js → chunk-kvpzxnww.js} +1 -1
- package/dist/{chunk-3tydmgwh.js → chunk-m7acbayx.js} +2 -2
- package/dist/{chunk-8byydry7.js → chunk-mh4kpnjr.js} +1 -1
- package/dist/chunk-ndah5rvs.js +2 -0
- package/dist/{chunk-efdfkfp1.js → chunk-ns0171xk.js} +1 -1
- package/dist/{chunk-s85chp3w.js → chunk-p2e02hh7.js} +1 -1
- package/dist/{chunk-jjyt3tsv.js → chunk-p65ax8s0.js} +1 -1
- package/dist/{chunk-nsnzgdjt.js → chunk-pqn7r8fw.js} +1 -1
- package/dist/{chunk-d1vkjxb1.js → chunk-px5kda00.js} +2 -2
- package/dist/{chunk-8q3pyq6a.js → chunk-q1nj47gn.js} +1 -1
- package/dist/chunk-qb3c05qq.js +2 -0
- package/dist/{chunk-sm9f980t.js → chunk-qcars8ar.js} +1 -1
- package/dist/{chunk-ksr6c2kh.js → chunk-qzms4d8s.js} +1 -1
- package/dist/{chunk-nk7nxzxf.js → chunk-rb17ssxh.js} +1 -1
- package/dist/{chunk-ynf16yz4.js → chunk-s2k1x2rn.js} +1 -1
- package/dist/chunk-spdh99jy.js +2 -0
- package/dist/{chunk-xvhxxj4g.js → chunk-vbw9jhz2.js} +6 -6
- package/dist/chunk-vv7b8p5z.js +2 -0
- package/dist/{chunk-31cnrpd1.js → chunk-vwddsdk5.js} +2 -2
- package/dist/{chunk-c2v38ghp.js → chunk-x0ygwk9x.js} +1 -1
- package/dist/{chunk-ryrdx5mw.js → chunk-x42tsdbx.js} +1 -1
- package/dist/{chunk-xx3reejx.js → chunk-xdzy4pm0.js} +1 -1
- package/dist/{chunk-aekq1zyn.js → chunk-xqtt5t6d.js} +4 -4
- package/dist/{chunk-8y3f5fyg.js → chunk-xz2569ra.js} +1 -1
- package/dist/{chunk-cw1ar3dq.js → chunk-y8zzvzww.js} +1 -1
- package/dist/{chunk-7mz6ze0x.js → chunk-ywpan1k5.js} +1 -1
- package/dist/{chunk-rdn1d4bf.js → chunk-z9xjhc5m.js} +1 -1
- package/dist/{chunk-53j9wakh.js → chunk-znwc8gta.js} +1 -1
- package/dist/{chunk-gpschnvk.js → chunk-zrp4159x.js} +1 -1
- package/dist/cli.js +7 -7
- package/dist/craft-entry.js +1 -1
- package/dist/craft.js +1 -1
- package/dist/native/runtime/craft-bridge.js +2 -10
- package/dist/native/runtime/craft.d.ts +11 -0
- package/dist/native/runtime/navigation-chrome.d.ts +2 -0
- package/dist/native/runtime/navigation-chrome.js +25 -3
- package/dist/pwa.js +1 -1
- package/dist/ssg.js +6 -9
- package/package.json +5 -5
- package/dist/chunk-7ka7pvj9.js +0 -2
- package/dist/chunk-7t9951at.js +0 -2
- package/dist/chunk-8z3yjex0.js +0 -2
- package/dist/chunk-8zzepd7g.js +0 -2
- package/dist/chunk-98258444.js +0 -2
- package/dist/chunk-mad4g0yx.js +0 -2
- package/dist/chunk-n8a4jm0p.js +0 -3
- package/dist/chunk-phxkmjnw.js +0 -2
- package/dist/chunk-rt29w5ns.js +0 -2
- package/dist/chunk-s92f8w68.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{He,_n,Ks,_i,M}from"./chunk-8370x30n.js";import{kn}from"./chunk-jjyt3tsv.js";import{Mr,k,fl,ct,Ii,gl}from"./chunk-23r3rby6.js";import{I}from"./chunk-zjqvbcwa.js";import{T,Xs,u,f,Ft,d,K,z,x,Zs,Ce,Ue,Qs}from"./chunk-89d3h8mp.js";import{s,me}from"./chunk-x4f7efgp.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-7vhm0jj5.js";import it from"path";import Bt from"process";import{AsyncLocalStorage as sa}from"async_hooks";var Or=new sa;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function jr(e,t){return Or.run(bn(e),t)}async function Dr(e,t){let i=Or.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).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}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function Er(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let i=s(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let P=E[2];if(!a.has(P))n.push(P),a.add(P);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((P)=>{let B=P.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let j=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(t&&i.slice(c).startsWith("const"))return;j[1].split(",").forEach((P)=>{let B=P.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let F=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let P=F[1];if(!a.has(P))n.push(P),a.add(P);return}let O=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let P=O[1];if(!a.has(P))n.push(P),a.add(P)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ra(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Ns(e,t){let i=`{ ${ra(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import Tt from"fs";import $e from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function wr(e,t=!0){let i=Nr.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=Tt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let j=E.name.slice(0,-4);if(!n.has(j))n.set(j,A);let F=j.toLowerCase();if(!n.has(F))n.set(F,A);let O=U(j);if(!n.has(O))n.set(O,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Nr.set(e,n);return n}function Ms(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(Tt.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ds(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ci(e,t){let[i,n,a]=Lr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ia(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(Tt.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var oa=["src/ui","src/components","components","dist"];function Dn(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=ia(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(Tt.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:oa;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*li(e,t,i={},n){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...Dn(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of Tt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function zr(e,t,i={},n){let a=ci(e,n);if(a!==void 0)return a;for(let l of li(e,t,i,n))try{if(Tt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ls(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")&&!n.has("source")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(n.has("resizemode")&&(n.has("fit")||n.has("objectfit")))return!1;if(n.has("src")&&n.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import ns from"fs";import ae from"path";import wt from"path";import en from"fs";var aa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function hs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return aa.has(e.toLowerCase())}var Br=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"]),Wr={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"},ca=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(ca.has(n))t.systemKeys.push(n);else if(n in Ur)t.mouse=n;else if(n in Wr||/^[a-z]$/.test(n))t.keys.push(Wr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,j=`__stx_evt_${t}${n++}`,F=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=O.exec(v))!==null){let[,L,H]=P,G=L.split("."),D=G[0];if(!Br.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Fr(G.slice(1)),elementId:j})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=B.exec(v))!==null){let[,L,H]=P,G=L.split("."),D=G[0];if(!Br.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Fr(G.slice(1)),elementId:j})}if(F.length>0)i.push({originalTag:c,elementId:j,events:F,startIndex:E,endIndex:A})}return i}function la(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=Ur[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ua(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function xs(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function fa(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=la(e),a=ua(xs(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(hs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(e.event==="mounted")return`
|
|
2
|
+
import{He,_n,Ks,_i,M}from"./chunk-8370x30n.js";import{kn}from"./chunk-p65ax8s0.js";import{Mr,k,fl,ct,Ii,gl}from"./chunk-23r3rby6.js";import{I}from"./chunk-zjqvbcwa.js";import{T,Xs,u,f,Ft,d,K,z,x,Zs,Ce,Ue,Qs}from"./chunk-89d3h8mp.js";import{s,me}from"./chunk-x4f7efgp.js";import{g}from"./chunk-0dve54ne.js";import{X}from"./chunk-7vhm0jj5.js";import it from"path";import Bt from"process";import{AsyncLocalStorage as sa}from"async_hooks";var Or=new sa;function bn(e){return e.__stx_server_data??={pending:new Map,values:new Map}}function jr(e,t){return Or.run(bn(e),t)}async function Dr(e,t){let i=Or.getStore();if(!i)throw Error("useServerData must run inside a <script server> render");if(typeof e!=="string"||!e.trim())throw TypeError("useServerData requires a non-empty string key");let n=i.pending.get(e);if(n)return n;let a=Promise.resolve().then(t).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}),b=JSON.parse(c);return i.values.set(e,b),b}).catch((l)=>{throw i.pending.delete(e),l});return i.pending.set(e,a),a}function Er(e){let t=e.__stx_server_data;if(!t?.values.size)return"";return`<script data-stx-scoped data-stx-server-data type="application/json">${JSON.stringify(Object.fromEntries(t.values)).replace(/</g,"\\u003c").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}</script>`}function V(e,t=!1){let i=s(e),n=[],a=new Set,l=0,c=0,b=i.length,v=()=>{if(l!==0)return;let E=i.slice(c).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(E){if(t&&E[1]==="const")return;let P=E[2];if(!a.has(P))n.push(P),a.add(P);return}let A=i.slice(c).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){if(t&&i.slice(c).startsWith("const"))return;A[1].split(",").forEach((P)=>{let B=P.trim();if(!B)return;let L=B.indexOf(":"),G=(L>=0?B.slice(L+1).trim():B).split(/[\s=]/)[0];if(G&&!a.has(G))n.push(G),a.add(G)});return}let j=i.slice(c).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(j){if(t&&i.slice(c).startsWith("const"))return;j[1].split(",").forEach((P)=>{let B=P.trim().replace(/^\.\.\./,"");if(!B)return;let L=B.split(/[\s=]/)[0];if(L&&!a.has(L))n.push(L),a.add(L)});return}if(t)return;let F=i.slice(c).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let P=F[1];if(!a.has(P))n.push(P),a.add(P);return}let O=i.slice(c).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let P=O[1];if(!a.has(P))n.push(P),a.add(P)}};while(c<b){if(i[c]==="{"){l++,c++;continue}if(i[c]==="}"){l--,c++;continue}if(l===0&&/[a-z]/i.test(i[c])&&(c===0||/\s|[;{}()]/.test(i[c-1])))v();c++}return n.join(", ")}function Os(e){return`{ enumerable: true, configurable: true, get() { return ${e} }, set(__stxValue_${e}) { ${e} = __stxValue_${e} } }`}function ra(e,t=V(e).split(",").map((i)=>i.trim()).filter(Boolean)){let i=new Set(V(e,!0).split(",").map((n)=>n.trim()));return t.map((n)=>i.has(n)?`get ${n}() { return ${n} }, set ${n}(__stxValue_${n}) { ${n} = __stxValue_${n} }`:n).join(", ")}function Ns(e,t){let i=`{ ${ra(e,t)} }`;return V(e).split(",").some((n)=>n.trim()==="__stxLiveBindings")?`Object.defineProperties(${i}, Object.getOwnPropertyDescriptors(__stxLiveBindings))`:i}import Tt from"fs";import $e from"path";function U(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var Nr=new Map;function wr(e,t=!0){let i=Nr.get(e);if(t&&i)return i;let n=new Map,a=[$e.join(e,"src"),$e.join(e,"dist"),e];function l(c,b){if(b>6)return;let v;try{v=Tt.readdirSync(c,{withFileTypes:!0})}catch{return}for(let E of v){let A=$e.join(c,E.name);if(E.isDirectory()){if(E.name==="node_modules"||E.name.startsWith("."))continue;l(A,b+1)}else if(E.isFile()&&E.name.endsWith(".stx")){let j=E.name.slice(0,-4);if(!n.has(j))n.set(j,A);let F=j.toLowerCase();if(!n.has(F))n.set(F,A);let O=U(j);if(!n.has(O))n.set(O,A)}}}for(let c of a)if(l(c,0),n.size>0)break;if(t)Nr.set(e,n);return n}function Ms(e,t){if(e.startsWith(".")||e.startsWith("/"))return null;let i=t;while(!0){let n=$e.join(i,"node_modules",e);try{if(Tt.statSync(n).isDirectory())return n}catch{}let a=$e.dirname(i);if(a===i)return null;i=a}}function Ds(e,t,i={}){return[$e.resolve($e.dirname(t),`${e}.stx`),$e.resolve($e.dirname(t),e),$e.resolve(i.componentsDir||"components",`${e}.stx`),$e.resolve(i.componentsDir||"components",e),e.endsWith(".stx")?e:`${e}.stx`]}function Lr(e){let t=e.endsWith(".stx")?e.slice(0,-4):e,i=t.split("-").map((a)=>a.charAt(0).toUpperCase()+a.slice(1)).join(""),n=U(t);return[t,i,n]}function ci(e,t){let[i,n,a]=Lr(e);for(let l of[i,i.toLowerCase(),n,a]){let c=t?.__importedComponents?.get(l);if(c!==void 0)return c}}function ia(e,t){let i=t?$e.resolve(t):void 0,n=$e.dirname($e.resolve(e));for(;;){if(Tt.existsSync($e.join(n,"package.json")))return i&&n===i?void 0:n;let a=$e.dirname(n);if(a===n)return;n=a}}var oa=["src/ui","src/components","components","dist"];function Dn(e,t){let i=$e.resolve(e);if(!t&&!i.split($e.sep).includes("node_modules"))return[];let n=ia(i,t);if(!n)return[];let a=[];try{let b=JSON.parse(Tt.readFileSync($e.join(n,"package.json"),"utf8")).stx?.components;if(Array.isArray(b))a=b.filter((v)=>typeof v==="string")}catch{}let l=a.length?a:oa;return[$e.dirname($e.resolve(e)),...l.map((c)=>$e.resolve(n,c))]}function*li(e,t,i={},n){let a=Lr(e);if(a[0].startsWith("./")||a[0].startsWith("../")){yield $e.resolve($e.dirname(t),`${a[0]}.stx`);return}let l=[...new Set(a.map((v)=>`${v}.stx`))],c=i.projectRoot||process.cwd(),b=[...Dn(t,i.projectRoot),...n?.__originalFilePath?[$e.join($e.dirname(n.__originalFilePath),"components")]:[],...i.componentsDir?[i.componentsDir]:[],$e.join($e.dirname(t),"components"),$e.resolve(c,"src/components"),$e.resolve(c,"components"),...import.meta.dir?[$e.resolve(import.meta.dir,"components")]:[]];for(let v of new Set(b)){for(let E of l)yield $e.join(v,E);try{for(let E of Tt.readdirSync(v,{withFileTypes:!0}))if(E.isDirectory())for(let A of l)yield $e.join(v,E.name,A)}catch{}}}function zr(e,t,i={},n){let a=ci(e,n);if(a!==void 0)return a;for(let l of li(e,t,i,n))try{if(Tt.statSync(l,{throwIfNoEntry:!1})?.isFile())return l}catch{}return null}function Ls(e,t=[],i={}){let n=new Set([...e].map((E)=>E.replace(/[-_]/g,"").toLowerCase()));if(!n.has("src")&&!n.has("source")||!n.has("alt")&&!n.has("decorative"))return!1;let a=new Map(Object.entries(i).map(([E,A])=>[E.replace(/[-_]/g,"").toLowerCase(),A])),l=a.get("alt"),c=a.get("decorative"),b=typeof l==="string"&&!!l.trim(),v=typeof c==="string"?!["false","0","off","no"].includes(c.trim().toLowerCase()):Boolean(c);if(!b&&!v)return!1;if(["defaultsource","provider","format","densities","quality","preload","modifiers","preset"].some((E)=>n.has(E)))return!1;if([...t].some((E)=>!["load","error"].includes(E.replace(/^@/,"").split(".")[0].toLowerCase())))return!1;if(n.has("resizemode")&&(n.has("fit")||n.has("objectfit")))return!1;if(n.has("src")&&n.has("source"))return!1;return["fit","objectfit","resizemode","position","objectposition","rounded","aspectratio","zoomonhover","sources","webpsrc","webpsrcset"].some((E)=>n.has(E))}import ns from"fs";import ae from"path";import wt from"path";import en from"fs";var aa=new Set(["touchstart","touchmove","wheel","mousewheel"]);function hs(e,t){if(t.passive)return!0;if(t.prevent||t.nonpassive)return!1;return aa.has(e.toLowerCase())}var Br=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"]),Wr={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"},ca=new Set(["ctrl","alt","shift","meta"]),Ur={left:0,middle:1,right:2};function Fr(e){let t={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,nonpassive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let i of e){let n=i.toLowerCase();if(n==="prevent")t.prevent=!0;else if(n==="stop")t.stop=!0;else if(n==="once")t.once=!0;else if(n==="capture")t.capture=!0;else if(n==="self")t.self=!0;else if(n==="passive")t.passive=!0;else if(n==="nonpassive")t.nonpassive=!0;else if(ca.has(n))t.systemKeys.push(n);else if(n in Ur)t.mouse=n;else if(n in Wr||/^[a-z]$/.test(n))t.keys.push(Wr[n]||n.toUpperCase());else if(n.startsWith("debounce")){let a=n.match(/debounce(?:\.(\d+))?/);t.debounce=a?.[1]?Number.parseInt(a[1],10):300}else if(n.startsWith("throttle")){let a=n.match(/throttle(?:\.(\d+))?/);t.throttle=a?.[1]?Number.parseInt(a[1],10):300}}return t}function Hr(e,t=""){let i=[],n=0,a=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,l;while((l=a.exec(e))!==null){let[c,b,v]=l,E=l.index,A=E+c.length,j=`__stx_evt_${t}${n++}`,F=[],O=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,P;while((P=O.exec(v))!==null){let[,L,H]=P,G=L.split("."),D=G[0];if(!Br.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Fr(G.slice(1)),elementId:j})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((P=B.exec(v))!==null){let[,L,H]=P,G=L.split("."),D=G[0];if(!Br.has(D))continue;F.push({attribute:`@${L}`,event:D,handler:H,modifiers:Fr(G.slice(1)),elementId:j})}if(F.length>0)i.push({originalTag:c,elementId:j,events:F,startIndex:E,endIndex:A})}return i}function la(e){let t=[],{modifiers:i}=e;if(i.self)t.push("if ($event.target !== $el) return");for(let n of i.systemKeys)t.push(`if (!$event.${n}Key) return`);if(i.keys.length>0){let n=i.keys.map((a)=>`$event.key === '${a}'`).join(" || ");t.push(`if (!(${n})) return`)}if(i.mouse!==null){let n=Ur[i.mouse];t.push(`if ($event.button !== ${n}) return`)}if(i.prevent)t.push("$event.preventDefault()");if(i.stop)t.push("$event.stopPropagation()");return t.join("; ")}function ua(e,t){let i=e;if(t.debounce!==null)i=`__stx_debounce(() => { ${i} }, ${t.debounce})`;else if(t.throttle!==null)i=`__stx_throttle(() => { ${i} }, ${t.throttle})`;return i}function xs(e){let t=e.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t))return e;return`if (typeof ${t} === 'function' && !${t}._isSignal) ${t}($event);`}function fa(e){let{modifiers:t}=e,i=e.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),n=la(e),a=ua(xs(e.handler),t),l=[];if(t.once)l.push("once: true");if(t.capture)l.push("capture: true");if(hs(e.event,t))l.push("passive: true");let c=l.length>0?`, { ${l.join(", ")} }`:"",b=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('${i}');
|
|
5
5
|
if (!$el) return;
|
|
@@ -112,7 +112,7 @@ else {
|
|
|
112
112
|
`)}
|
|
113
113
|
})();
|
|
114
114
|
</script>`}function pa(e,t=""){let i=Hr(e,t);if(i.length===0)return{template:e,bindings:[]};let n=e,a=[];for(let l=i.length-1;l>=0;l--){let c=i[l],b=c.originalTag;if(!b.includes(" id="))b=b.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${c.elementId}"`);else{let v=b.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,"\\$&"),A=new RegExp(`\\s*${E}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${E}\\s*=\\s*'[^']*'`,"g");b=b.replace(A,""),b=b.replace(j,"")}n=n.slice(0,c.startIndex)+b+n.slice(c.endIndex),a.push(...c.events)}return{template:n,bindings:a}}function Vr(e){let t=e.$uid;return typeof t==="string"&&t?`${t}_`:""}function Pc(e,t,i){if(gl(e))return e;if(t.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(e))return e;let{template:b,bindings:v}=pa(e,Vr(t)),E=t.__stx_event_bindings||[];return t.__stx_event_bindings=[...E,...v],b}let n=Hr(e,Vr(t));if(n.length===0)return e;let a=e;for(let b=n.length-1;b>=0;b--){let v=n[b],E=v.originalTag;if(!E.includes(" id="))E=E.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${v.elementId}"`);else{let A=E.match(/id=["']([^"']+)["']/);if(A)for(let j of v.events)j.elementId=A[1]}for(let A of v.events){let j=A.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),F=new RegExp(`\\s*${j}\\s*=\\s*"[^"]*"`,"g"),O=new RegExp(`\\s*${j}\\s*=\\s*'[^']*'`,"g");E=E.replace(F,""),E=E.replace(O,"")}a=a.slice(0,v.startIndex)+E+a.slice(v.endIndex)}let l=ui(n.flatMap((b)=>b.events)),c=a.lastIndexOf("</body>");if(c!==-1)a=a.slice(0,c)+l+`
|
|
115
|
-
`+a.slice(c);else a+=l;return a}function qr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){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))i.add(a)}return i}function At(e,t){let i=s(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),xt=/^[A-Za-z_$][\w$]*$/,da=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],ga=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ma(e){let t=s(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function bs(e){let t=Zr.get(e);if(t)return t;let{code:i,tokens:n}=ma(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let H=n[L].text;if(["(","[","{"].includes(H))l.push(L);else if([")","]","}"].includes(H)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+H))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,H){let G=[],D=L;for(let ee=L;ee<H;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??H)<H){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,H]),G}let b=[];function v(L,H,G,D=!1){if(n[L]?.text==="...")L++;if(L>=H)return;let ee=n[L].text;if(xt.test(ee)){if(G.add(ee),G===j)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=H)return;for(let[te,le]of c(L+1,ne)){let be=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){be=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(be,le,G,D)}}function E(L,H){let G=new Set;for(let[D,ee]of c(L,H))v(D,ee,G);return G}function A(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(["(","[","{"].includes(G)&&a.has(H)){H=a.get(H);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,H-1)]?.end??i.length}let j=new Set,F=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let H=L-1,G=H,D;if(n[H]?.text===")"&&a.has(H))G=a.get(H),D=E(G+1,H);else if(n[H]&&xt.test(n[H].text))D=new Set([n[H].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);F.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let H=n[L-1]?.text;if(!H||da.has(H)||!xt.test(H)&&H!=="*"&&H!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;F.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:H!=="catch",names:E(L+1,G)})}function O(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(Kr.includes(G)&&a.has(H)){H=a.get(H);continue}if(G===";"||Xr.includes(G))break;let D=n[H-1];if(H>L&&ga.has(G)&&D.text!==".")break;if(H>L&&/[\n\r]/.test(i.slice(D.end,n[H].start))&&(/^[\w$]+$/.test(D.text)||Xr.includes(D.text)||['"',"'","`"].includes(D.text))&&xt.test(G)&&!["in","of","instanceof"].includes(G))break}return H}let P=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let H=n[L+1]?.text==="await"?L+2:L+1;if(n[H]?.text!=="("||!a.has(H))continue;let G=a.get(H),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):O(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;P.push({headStart:H,headEnd:G,start:n[H].start,end:ne})}for(let L=0;L<n.length;L++){let H=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(H==="const"||H==="let"||H==="var"){let D=O(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let be=L+1;be<=D;be++){let ue=n[be]?.text;if(be<D&&Kr.includes(ue)&&a.has(be)&&a.get(be)<D){be=a.get(be);continue}if(be<D&&ue===":"&&!te)ne=!0;else if(be<D&&ue==="="&&le===0)ne=!1,te=!0;else if(be<D&&ne&&ue==="<")le++;else if(be<D&&ne&&ue===">"&&le>0)le--;else if(be===D||ue===","&&le===0)v(ee,be,j,H==="var"),ee=be+1,ne=!1,te=!1}}else if(H==="function"||H==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&xt.test(n[D].text)&&n[D].text!=="extends")j.add(n[D].text),b.push({name:n[D].text,token:D})}else if(H==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&xt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")j.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,be]of c(ne+1,te)){let ue=be-1;while(ue>=le&&!xt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:F,loops:P,declarations:j,sites:b,tokens:n,pairs:a};return Zr.set(e,B),B}function Qt(e){let t=bs(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function Nn(e){return new Set(bs(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=bs(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let P=l[O].text;if(P==="{"&&c.has(O))v.push(O);else if(P==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;E.add(O.token);let P=O.file?-1:b[O.token],B=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(O.functionScoped){let H=l[O.token].start,G=i.filter((D)=>D.functionBody&&H>=D.bodyStart&&H<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let H=n.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(H)B=[H.start,H.end]}let L=A.get(O.name);if(L)L.push(B);else A.set(O.name,[B])}let j=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let P=O+1;if(l[P]?.text==="type")P++;if(l[P]&&xt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let B=P+1;B<c.get(P);B++)j.add(B)}let F=new Set;for(let O=0;O<l.length;O++){let P=l[O].text;if(!t.has(P)||F.has(P)||E.has(O)||j.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[O].start;if(A.get(P)?.some(([H,G])=>L>=H&&L<G))continue;if(i.some((H)=>L>=H.start&&L<H.end&&H.names.has(P)))continue;F.add(P)}return F}var Ie="0.2.839";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function xa(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let i=xa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var ba=/<\/(script)/gi;function fn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ba,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new T(e);return Yr.push(t),t}function Ic(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function vr(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Gr.statSync(i).mtimeMs})}catch{}return t}function js(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var ya=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function _a(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function wa(e,t){let i=t;while(!0){let n=wt.join(i,"node_modules",e,"package.json");if(en.existsSync(n))return wt.dirname(n);let a=wt.dirname(i);if(a===i)return null;i=a}}function Sa(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function $a(e,t){let i=_a(e);if(!i||!i.subpath)return null;let n=wa(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(en.readFileSync(wt.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=Sa(a.exports,l);if(!c)return null;let b=wt.resolve(n,c);return en.existsSync(b)?b:null}function bi(e,t){let i=t.filePath?wt.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ya,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:wt.resolve(i,E),!en.existsSync(A))throw Error(`file not found: ${A}`)}else{let j=null;try{j=Bun.resolveSync(E,n)}catch{j=$a(E,n)}if(!j)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${j?.message||j}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let j=en.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${A}: ${j?.message||j}`),c.push(E)}return""}),styles:l,unresolved:c}}function va(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${va(t.source)}" data-stx-layer="vendor">
|
|
115
|
+
`+a.slice(c);else a+=l;return a}function qr(e,t){let i=new Set;for(let n of e.split(",")){let a=n.trim().replace(/^\.\.\./,"").trim();if(!a)continue;if(t){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))i.add(a)}return i}function At(e,t){let i=s(e),{depths:n,balanced:a}=me(i),l=(b)=>!a||n[b]===0,c=new RegExp(`(?:^|[^\\w$.])((?:const|let|var|function|class)\\s+${t}\\b)`,"g");for(let b of i.matchAll(c)){let v=(b.index??0)+b[0].length-b[1].length;if(l(v))return!0}for(let b of i.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(l(b.index??0)&&qr(b[1],!0).has(t))return!0;for(let b of i.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(l(b.index??0)&&qr(b[1],!1).has(t))return!0;return!1}var Zr=new T(32,{maxBytes:2097152,sizeOf:(e)=>e.code.length*4}),xt=/^[A-Za-z_$][\w$]*$/,da=new Set(["if","for","while","switch","with"]),Kr=["(","[","{"],Xr=[")","]","}"],ga=new Set(["const","let","var","return","if","for","while","do","switch","try","throw","export"]);function ma(e){let t=s(e),i=[];for(let n of t.matchAll(/[A-Za-z_$][\w$]*|=>|\.\.\.|[^\s]/g)){let a=n.index??0;i.push({text:n[0],start:a,end:a+n[0].length})}return{code:t,tokens:i}}function bs(e){let t=Zr.get(e);if(t)return t;let{code:i,tokens:n}=ma(e),a=new Map,l=[];for(let L=0;L<n.length;L++){let H=n[L].text;if(["(","[","{"].includes(H))l.push(L);else if([")","]","}"].includes(H)){let G=l.at(-1);if(G!==void 0&&["()","[]","{}"].includes(n[G].text+H))l.pop(),a.set(G,L),a.set(L,G)}}function c(L,H){let G=[],D=L;for(let ee=L;ee<H;ee++){if(["(","[","{"].includes(n[ee].text)&&(a.get(ee)??H)<H){ee=a.get(ee);continue}if(n[ee].text===",")G.push([D,ee]),D=ee+1}return G.push([D,H]),G}let b=[];function v(L,H,G,D=!1){if(n[L]?.text==="...")L++;if(L>=H)return;let ee=n[L].text;if(xt.test(ee)){if(G.add(ee),G===j)b.push({name:ee,token:L,functionScoped:D});return}if(ee!=="{"&&ee!=="[")return;let ne=a.get(L);if(ne===void 0||ne>=H)return;for(let[te,le]of c(L+1,ne)){let be=te;if(ee==="{")for(let ue=te;ue<le;ue++){if(n[ue].text===":"){be=ue+1;break}if(n[ue].text==="=")break;if(["(","[","{"].includes(n[ue].text)&&a.has(ue))ue=a.get(ue)}v(be,le,G,D)}}function E(L,H){let G=new Set;for(let[D,ee]of c(L,H))v(D,ee,G);return G}function A(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(["(","[","{"].includes(G)&&a.has(H)){H=a.get(H);continue}if([",",";",")","]","}"].includes(G))break}return n[Math.max(L,H-1)]?.end??i.length}let j=new Set,F=[];for(let L=0;L<n.length;L++)if(n[L].text==="=>"){let H=L-1,G=H,D;if(n[H]?.text===")"&&a.has(H))G=a.get(H),D=E(G+1,H);else if(n[H]&&xt.test(n[H].text))D=new Set([n[H].text]);else continue;let ee=L+1,ne=n[ee]?.text==="{"&&a.has(ee)?n[a.get(ee)].end:A(ee);F.push({start:n[G].start,end:ne,bodyStart:n[ee]?.start??ne,functionBody:!0,names:D})}else if(n[L].text==="("&&a.has(L)){let H=n[L-1]?.text;if(!H||da.has(H)||!xt.test(H)&&H!=="*"&&H!=="]")continue;let G=a.get(L),D=G+1;if(n[D]?.text===":"){D++;while(D<n.length&&!["{","=>",";","="].includes(n[D].text))D++}if(n[D]?.text!=="{"||!a.has(D))continue;F.push({start:n[L].start,end:n[a.get(D)].end,bodyStart:n[D].start,functionBody:H!=="catch",names:E(L+1,G)})}function O(L){let H=L;for(;H<n.length;H++){let G=n[H].text;if(Kr.includes(G)&&a.has(H)){H=a.get(H);continue}if(G===";"||Xr.includes(G))break;let D=n[H-1];if(H>L&&ga.has(G)&&D.text!==".")break;if(H>L&&/[\n\r]/.test(i.slice(D.end,n[H].start))&&(/^[\w$]+$/.test(D.text)||Xr.includes(D.text)||['"',"'","`"].includes(D.text))&&xt.test(G)&&!["in","of","instanceof"].includes(G))break}return H}let P=[];for(let L=0;L<n.length;L++){if(n[L].text!=="for")continue;let H=n[L+1]?.text==="await"?L+2:L+1;if(n[H]?.text!=="("||!a.has(H))continue;let G=a.get(H),D=G+1,ee=n[D]?.text==="{"&&a.has(D)?a.get(D):O(D),ne=n[ee]?.text===";"||n[ee]?.text==="}"?n[ee].end:n[Math.max(D,ee-1)]?.end??i.length;P.push({headStart:H,headEnd:G,start:n[H].start,end:ne})}for(let L=0;L<n.length;L++){let H=n[L].text,G=n[L-1]?.text;if(G==="."||n[L+1]?.text===":")continue;if(G==="as"||G==="<")continue;if(H==="const"||H==="let"||H==="var"){let D=O(L+1),ee=L+1,ne=!1,te=!1,le=0;for(let be=L+1;be<=D;be++){let ue=n[be]?.text;if(be<D&&Kr.includes(ue)&&a.has(be)&&a.get(be)<D){be=a.get(be);continue}if(be<D&&ue===":"&&!te)ne=!0;else if(be<D&&ue==="="&&le===0)ne=!1,te=!0;else if(be<D&&ne&&ue==="<")le++;else if(be<D&&ne&&ue===">"&&le>0)le--;else if(be===D||ue===","&&le===0)v(ee,be,j,H==="var"),ee=be+1,ne=!1,te=!1}}else if(H==="function"||H==="class"){let D=L+1;if(n[D]?.text==="*")D++;if(n[D]&&xt.test(n[D].text)&&n[D].text!=="extends")j.add(n[D].text),b.push({name:n[D].text,token:D})}else if(H==="import"){let D=L+1;if(n[D]?.text==="*"&&n[D+1]?.text==="as")D+=2;let ee=n[D]?.text;if(ee&&xt.test(ee)&&ee!=="type"&&n[D+1]?.text!=="("&&n[D+1]?.text!==".")j.add(ee),b.push({name:ee,token:D,file:!0});let ne=n[D]?.text==="{"?D:n[D+1]?.text===","&&n[D+2]?.text==="{"?D+2:-1;if(ne!==-1&&a.has(ne)){let te=a.get(ne);for(let[le,be]of c(ne+1,te)){let ue=be-1;while(ue>=le&&!xt.test(n[ue].text))ue--;if(ue>=le&&n[ue].text!=="type")b.push({name:n[ue].text,token:ue,file:!0})}}}}let B={code:i,scopes:F,loops:P,declarations:j,sites:b,tokens:n,pairs:a};return Zr.set(e,B),B}function Qt(e){let t=bs(e);return{code:t.code,shadows:(i,n)=>t.scopes.some((a)=>n>=a.start&&n<a.end&&a.names.has(i))}}function Nn(e){return new Set(bs(e).declarations)}function Oe(e,t){let{scopes:i,loops:n,sites:a,tokens:l,pairs:c}=bs(e),b=Array.from({length:l.length},()=>-1),v=[];for(let O=0;O<l.length;O++){b[O]=v.length?v[v.length-1]:-1;let P=l[O].text;if(P==="{"&&c.has(O))v.push(O);else if(P==="}"&&v.length&&c.get(O)===v[v.length-1])v.pop()}let E=new Set,A=new Map;for(let O of a){if(!t.has(O.name))continue;E.add(O.token);let P=O.file?-1:b[O.token],B=P===-1?[0,Number.POSITIVE_INFINITY]:[l[P].start,l[c.get(P)].end];if(O.functionScoped){let H=l[O.token].start,G=i.filter((D)=>D.functionBody&&H>=D.bodyStart&&H<D.end).sort((D,ee)=>D.end-D.bodyStart-(ee.end-ee.bodyStart))[0];B=G?[G.bodyStart,G.end]:[0,Number.POSITIVE_INFINITY]}else if(!O.file){let H=n.filter((G)=>O.token>G.headStart&&O.token<G.headEnd).sort((G,D)=>G.headEnd-G.headStart-(D.headEnd-D.headStart))[0];if(H)B=[H.start,H.end]}let L=A.get(O.name);if(L)L.push(B);else A.set(O.name,[B])}let j=new Set;for(let O=0;O<l.length;O++){if(l[O].text!=="import"||l[O-1]?.text===".")continue;let P=O+1;if(l[P]?.text==="type")P++;if(l[P]&&xt.test(l[P].text)&&l[P+1]?.text===",")P+=2;if(l[P]?.text==="{"&&c.has(P))for(let B=P+1;B<c.get(P);B++)j.add(B)}let F=new Set;for(let O=0;O<l.length;O++){let P=l[O].text;if(!t.has(P)||F.has(P)||E.has(O)||j.has(O))continue;let B=l[O-1]?.text;if(B==="#"||B==="."&&l[O-2]?.text!=="..")continue;if(l[O+1]?.text===":"&&(B==="{"||B===","))continue;let L=l[O].start;if(A.get(P)?.some(([H,G])=>L>=H&&L<G))continue;if(i.some((H)=>L>=H.start&&L<H.end&&H.names.has(P)))continue;F.add(P)}return F}var Ie="0.2.840";var Jr=Symbol.for(`stx.lazy-module-promises.${Ie}`);function xa(){let e=globalThis;return e[Jr]??=new Map,e[Jr]}function o(e,t){let i=xa(),n=`${import.meta.url}\x00${e}`,a=i.get(n);if(a)return a;let l=t();return i.set(n,l),l.catch(()=>{if(i.get(n)===l)i.delete(n)}),l}var ba=/<\/(script)/gi;function fn(e){if(!e||e.indexOf("</")===-1)return e;return e.replace(ba,"<\\/$1")}import Gr from"fs";var Yr=[];function w(e){let t=new T(e);return Yr.push(t),t}function Ic(){for(let e of Yr)e.clear()}function S(e,...t){return`${t.map((i)=>String(i??"")).join("\x00")}\x00${e.length}\x00${Bun.hash(e)}`}function vr(e){let t=[];for(let i of new Set(e))try{t.push({path:i,mtimeMs:Gr.statSync(i).mtimeMs})}catch{}return t}function js(e){for(let t of e)try{if(Gr.statSync(t.path).mtimeMs!==t.mtimeMs)return!1}catch{return!1}return!0}var Se=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useIntervalFn","useObjectUrl"];var ya=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function _a(e){if(e.startsWith(".")||e.startsWith("/"))return null;if(e.startsWith("@")){let i=e.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!i)return null;return{pkg:i[1],subpath:i[2]||""}}let t=e.match(/^([^/]+)(\/.*)?$/);if(!t)return null;return{pkg:t[1],subpath:t[2]||""}}function wa(e,t){let i=t;while(!0){let n=wt.join(i,"node_modules",e,"package.json");if(en.existsSync(n))return wt.dirname(n);let a=wt.dirname(i);if(a===i)return null;i=a}}function Sa(e,t){if(!e||typeof e!=="object")return null;let i=(a)=>{if(typeof a==="string")return a;if(a&&typeof a==="object"){if(typeof a.import==="string")return a.import;if(typeof a.default==="string")return a.default;if(typeof a.import==="object")return i(a.import);if(typeof a.default==="object")return i(a.default)}return null};if(Object.prototype.hasOwnProperty.call(e,t))return i(e[t]);let n=null;for(let a of Object.keys(e)){let l=a.indexOf("*");if(l===-1)continue;let c=a.slice(0,l),b=a.slice(l+1);if(!t.startsWith(c)||!t.endsWith(b))continue;if(t.length<c.length+b.length)continue;if(!n||c.length>n.prefix.length)n={pattern:a,prefix:c,suffix:b}}if(n){let a=t.slice(n.prefix.length,t.length-n.suffix.length),l=i(e[n.pattern]);if(l)return l.replace("*",a)}return null}function $a(e,t){let i=_a(e);if(!i||!i.subpath)return null;let n=wa(i.pkg,t);if(!n)return null;let a;try{a=JSON.parse(en.readFileSync(wt.join(n,"package.json"),"utf8"))}catch{return null}let l=`.${i.subpath}`,c=Sa(a.exports,l);if(!c)return null;let b=wt.resolve(n,c);return en.existsSync(b)?b:null}function bi(e,t){let i=t.filePath?wt.dirname(t.filePath):t.projectRoot||process.cwd(),n=t.projectRoot||process.cwd(),a=new Set,l=[],c=[];return{code:e.replace(ya,(v,E)=>{let A;try{if(E.startsWith("./")||E.startsWith("../")||E.startsWith("/")){if(A=E.startsWith("/")?E:wt.resolve(i,E),!en.existsSync(A))throw Error(`file not found: ${A}`)}else{let j=null;try{j=Bun.resolveSync(E,n)}catch{j=$a(E,n)}if(!j)throw Error(`could not resolve ${E} (Bun.resolveSync + exports fallback both failed)`);A=j}}catch(j){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(E)} (from ${t.filePath||"<unknown>"}): ${j?.message||j}`),c.push(E),""}if(a.has(A))return"";a.add(A);try{let j=en.readFileSync(A,"utf8");l.push({source:E,resolvedPath:A,contents:j})}catch(j){console.warn(`[stx:vendor-css] could not read ${A}: ${j?.message||j}`),c.push(E)}return""}),styles:l,unresolved:c}}function va(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wi(e){if(e.length===0)return"";return`${e.map((t)=>`<style data-stx-vendor="${va(t.source)}" data-stx-layer="vendor">
|
|
116
116
|
@layer vendor {
|
|
117
117
|
${t.contents}
|
|
118
118
|
}
|
|
@@ -182,7 +182,7 @@ else {
|
|
|
182
182
|
// STX: auto-generated event bindings
|
|
183
183
|
${e.map((i,n)=>ja(i,n)).join(`
|
|
184
184
|
`)}`}function ni(e){let t=[],i=new Set,n=e.replace(/^\s*import\s+.*$/gm,""),a=0,l=n.length,c=0;while(c<l){let b=n[c];if(b==="'"||b==='"'||b==="`"){let v=b;if(c++,v==="`"){let E=0;while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]==="`"&&E===0){c++;break}if(n[c]==="$"&&n[c+1]==="{"){E++,c+=2;continue}if(n[c]==="}"&&E>0){E--,c++;continue}c++}}else while(c<l){if(n[c]==="\\"){c+=2;continue}if(n[c]===v){c++;break}c++}continue}if(b==="/"&&n[c+1]==="/"){while(c<l&&n[c]!==`
|
|
185
|
-
`)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let F=E[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let O=F.trim(),P=O.indexOf(":"),B=P>=0?O.slice(P+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let F=j[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=j[0].length;continue}}c++}return t}var Na=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 La(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(F){let O;while((O=i.exec(F))!==null){let P=O[0];if(!Na.has(P))t.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=bi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=wi(c.styles),v=Dt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
185
|
+
`)c++;continue}if(b==="/"&&n[c+1]==="*"){c+=2;while(c<l-1&&!(n[c]==="*"&&n[c+1]==="/"))c++;c+=2;continue}if(b==="{"){a++,c++;continue}if(b==="}"){a--,c++;continue}if(a===0){let v=n.slice(c),E=v.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(E){let F=E[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=E[0].length;continue}let A=v.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(A){A[1].split(",").forEach((F)=>{let O=F.trim(),P=O.indexOf(":"),B=P>=0?O.slice(P+1).trim().split(/[\s=]/)[0]:O.split(/[\s=]/)[0];if(B&&!B.startsWith("_")&&!i.has(B))t.push(B),i.add(B)}),c+=A[0].length;continue}let j=v.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(j){let F=j[1];if(!F.startsWith("_")&&!i.has(F))t.push(F),i.add(F);c+=j[0].length;continue}}c++}return t}var Na=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 La(e){let t=new Set,i=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function n(F){let O;while((O=i.exec(F))!==null){let P=O[0];if(!Na.has(P))t.add(P)}}let a=/\{\{([\s\S]*?)\}\}/g,l;while((l=a.exec(e))!==null)n(l[1]);let c=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((l=c.exec(e))!==null)n(l[1]);let b=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((l=b.exec(e))!==null)n(l[1]);let v=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((l=v.exec(e))!==null)n(l[1]);let E=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((l=E.exec(e))!==null)n(l[1]);let A=/@model\s*=\s*["']([^"']*)["']/gi;while((l=A.exec(e))!==null)n(l[1]);let j=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((l=j.exec(e))!==null)n(l[1]);return t}async function je(e,t={}){let i=e,n="",a=!1,l=[],c=bi(i,{filePath:t.filePath,projectRoot:t.projectRoot});i=c.code;let b=wi(c.styles),v=Dt(i);i=v.code,l=[...v.imports,...v.models];let{hasUserImports:E,bundleClientScript:A}=await o("stx/client-script-bundler",()=>import("./chunk-mh4kpnjr.js"));if(E(i))i=await A(i,t.filePath||"",{projectRoot:t.projectRoot,minify:t.production}),a=!0;if(t.autoImports!==!1){let D=Jc(i);i=D.code,n=Yc(D.stxImports,D.browserImports.filter((ee)=>!l.includes(ee)))}if(n=`${vn(i,t.serverData)}${n}`,i=I(i),!a&&Be(t.attrs||""))i=Fe(i);let j=Da(t.eventBindings||[]),F=(t.attrs||"").trim(),O=/\btype\s*=\s*["']module["']/i.test(F),P=t.instanceId?` data-stx-instance="${t.instanceId}"`:"";if(O){let D=F.replace(/\btype\s*=\s*["']module["']/i,"").trim(),ee=`type="module" data-stx-scoped${P}${D?` ${D}`:""}`;return`${b}<script ${ee}>
|
|
186
186
|
${fn(`${n}${i}
|
|
187
187
|
${j}`)}
|
|
188
188
|
</script>`}let B=Ii(e),L=/function __stx_setup_/.test(i),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(e);function G(D){let ee=D.length>0?`
|
|
@@ -570,8 +570,8 @@ ${E.join(`
|
|
|
570
570
|
`){let P=e[a];if(P==="\\"){a+=2;continue}if(P==="[")O=!0;else if(P==="]")O=!1;else if(P==="/"&&!O){a++;while(a<l&&/[a-z]/i.test(e[a]))a++;return}a++}},F=()=>{if(n!==0)return;let O=e.slice(a).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(O){let H=O[2].split(",").map((G)=>{let D=G.trim().split(":");return D[D.length-1].trim()});for(let G of H)if(G&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G)&&!i.has(G))t.push(G),i.add(G);return}let P=e.slice(a).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(P){let H=P[2];if(!i.has(H))t.push(H),i.add(H);return}let B=e.slice(a).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let H=B[1];if(!i.has(H))t.push(H),i.add(H);return}let L=e.slice(a).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let H=L[1];if(!i.has(H))t.push(H),i.add(H)}};while(a<l){if(v())continue;if(e[a]==="'"||e[a]==='"'){c(e[a]);continue}if(e[a]==="`"){b();continue}if(e[a]==="/"&&A()){j();continue}if(e[a]==="{"){n++,a++;continue}if(e[a]==="}"){n--,a++;continue}if(n===0&&/[a-z]/i.test(e[a])&&(a===0||/\s|[;{}()]/.test(e[a-1])))F();a++}return t}function su(e){let t=[],i=0,n=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==="{")i++;else if(c===")"||c==="]"||c==="}")i--;else if(c===","&&i===0)t.push(e.slice(n,l)),n=l+1}if(n<e.length)t.push(e.slice(n));return t}function ru(e){let t=0,i=null;for(let n=0;n<e.length;n++){let a=e[n];if(i){if(a==="\\"){n++;continue}if(a===i)i=null;continue}if(a==='"'||a==="'"||a==="`"){i=a;continue}if(a==="("||a==="["||a==="{")t++;else if(a===")"||a==="]"||a==="}")t--;else if(a==="="&&t===0){let l=e[n-1],c=e[n+1];if(l==="!"||l==="<"||l===">"||l==="=")continue;if(c==="="||c===">")continue;return n}}return-1}function iu(e,t){try{let i=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(e);if(!i)return;let n=i.index-1;while(n>=0&&/\s/.test(e[n]))n--;if(e[n]!=="}")return;let a=n,l=0,c=-1;for(;n>=0;n--){let v=e[n];if(v==="}")l++;else if(v==="{"){if(l--,l===0){c=n;break}}}if(c===-1)return;let b=e.slice(c+1,a);for(let v of su(b)){let E=v.trim();if(!E||E.startsWith("..."))continue;let A=ru(E);if(A===-1)continue;let j=E.slice(0,A).trim();if(!/^[A-Z_$][\w$]*$/i.test(j))continue;if(t[j]!==void 0)continue;let F=E.slice(A+1).trim();if(!F)continue;try{let O=Object.keys(t).filter(Ft),P=Function(...O,`"use strict"; return (${F});`);t[j]=P(...O.map((B)=>t[B]))}catch{}}}catch{}}var ou=new Set(["tr","td","th","thead","tbody","tfoot","caption","colgroup","col","option","optgroup","li","dt","dd","span"]);function yg(e,t){let i=Pt(e),n=e.slice(i).match(/^<([a-zA-Z][a-zA-Z0-9-]*)/);if(!n)return null;let a=n[1].toLowerCase();if(!ou.has(a))return null;let l=new RegExp(`<\\/?${a}(?=[\\s/>])(?:[^>"']|"[^"]*"|'[^']*')*>`,"iy"),c=y(e,(A,j)=>(l.lastIndex=j,l.exec(A)?.index===j?l.lastIndex:-1));if(a==="span"&&/\sdata-stx-scope\s*=/.test(c[0]?.token||""))return null;let b=0,v=!1;for(let A of c){if(b+=A.token.startsWith("</")?-1:1,b<0)return null;if(b===0){if(e.slice(A.end).trim())return null;v=!0;break}}if(!v)return null;let E=i+n[0].length;return e.slice(0,E)+t+e.slice(E)}function Wo(e,t){if(!e)return!1;return[...t.additionalComponentsDirs??[],...t.fallbackComponentsDir?[t.fallbackComponentsDir]:[]].some((n)=>{let a=ae.relative(ae.resolve(n),ae.resolve(e));return!a.startsWith("..")&&!ae.isAbsolute(a)})}async function Tr(e,t,i,n,a){let l=e.endsWith(".stx")?e.slice(0,-4):e,c=(te)=>te.split("-").map((le)=>le.charAt(0).toUpperCase()+le.slice(1)).join(""),b=i.__importedComponents;if(b){for(let te of[l,l.toLowerCase(),c(l),U(l)])if(b.has(te))return!0}let v=[...new Set([`${l}.stx`,`${c(l)}.stx`,`${U(l)}.stx`])],E=typeof a.root==="string"?ae.resolve(a.root):void 0,A=E??ae.dirname(n),j=[],F=(te)=>{if(te&&!j.includes(te))j.push(te)};for(let te of Dn(n,E))F(te);let O=i.__originalFilePath;if(O)F(ae.join(ae.dirname(O),"components"));if(Wo(t,a))F(a._rootComponentsDir);F(t),F(a._rootComponentsDir),F(ae.join(ae.dirname(n),"components")),F(a.componentsDir);for(let te of a.additionalComponentsDirs??[])F(te);let P=a._targetComponentFallbackNames?.some((te)=>te.toLowerCase()===l.toLowerCase());if(!P)for(let te of a._targetComponentDirs??[])F(te);if(E)F(ae.resolve(E,"resources/views/components")),F(ae.resolve(E,"resources/components")),F(ae.resolve(E,"src/components")),F(ae.resolve(E,"components"));for(let te of a._layerComponentDirs??[])F(te);let B=a._pluginComponentDirs;if(Array.isArray(B))for(let te of B)F(typeof te==="string"?te:null);if(F(a.fallbackComponentsDir),P)for(let te of a._targetComponentDirs??[])F(te);let L=a._nativePrimitivesFallback;if(L&&!L.except.some((te)=>te.toLowerCase()===l.toLowerCase()))F(L.dir);if(l.startsWith("./")||l.startsWith("../"))return r(ae.resolve(ae.dirname(n),`${l}.stx`));let H=Oo(ae.resolve(import.meta.dir,"components")),G=j.map((te)=>ae.isAbsolute(te)?te:ae.resolve(A,te)),D=`${v.join("\x00")}\x00\x00${G.join("\x00")}`,ee=lr.get(D);if(ee!==void 0)return ee;let ne=!1;e:for(let te of G){if(Oo(te)===H)continue;for(let le of v)if(await r(ae.join(te,le))){ne=!0;break e}}return lr.set(D,ne),ne}function Oo(e){let t=ur.get(e);if(t!==void 0)return t;let i=e;try{i=ns.realpathSync(e)}catch{}return ur.set(e,i),i}function bg(e){return e==="visible"||e==="idle"||e==="interaction"||e.startsWith("media:")}function Zc(e){if(!e)return!1;let t=e.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(t)}function au(e,t,i){if(!e.includes("{{")&&!e.includes("{!!"))return e;let n=(a,l)=>{let c;try{c=R(a,t)}catch{return l}if(c===void 0||c===null)return"";let b=String(c);if(/<\/style/i.test(b))return console.warn(`[stx] a <style> expression in ${i??"<unknown>"} evaluated to CSS containing a closing style tag, which would end the element early, so it was dropped rather than emitted.`),"";return b};return e.replace(/\{!!([\s\S]*?)!!\}/g,(a,l)=>n(l,a)).replace(/\{\{([\s\S]*?)\}\}/g,(a,l)=>n(l,a))}var Mo=new Set;function jo(e,t,i,n){let a=`${e}\x00${t}\x00${n??""}`;if(!process.env.STX_DEBUG&&Mo.has(a))return;Mo.add(a);let l=t?` used in ${t}`:"",c=n?` Cause: ${n}.`:"",b=i.length>0?`
|
|
571
571
|
searched:
|
|
572
572
|
${i.map((v)=>` - ${v}`).join(`
|
|
573
|
-
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Do(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var cu=new Set(["for","if","show","key","ref","class","className","style"]),No=new Set,Fo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Qc=new RegExp(`\\b(?:${Fo})\\s*(?:<[^>]*>)?\\s*\\(`);function vi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Fo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,j=e){let{extractVariables:F}=await o("stx/variable-extractor",()=>import("./chunk-aywvbcae.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let P=new Set(O);P.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&bg(B)?B:"";try{let H=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),H(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${H(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,he=[];for(let ye of Dn(l))if(!he.includes(ye))he.push(ye);let Ze=he.length;for(let ye of c._layerComponentDirs??[])if(!he.includes(ye))he.push(ye);if(_e){let ye=ae.join(ae.dirname(_e),"components");he.push(ye)}let Re=c._rootComponentsDir;if(typeof Re==="string"&&Wo(n,c)&&!he.includes(Re))he.push(Re);if(n&&!he.includes(n))he.push(n);if(typeof Re==="string"&&!he.includes(Re))he.push(Re);let pt=ae.join(ae.dirname(l),"components");if(!he.includes(pt))he.push(pt);if(c.componentsDir&&c.componentsDir!==n&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!he.includes(ye))he.push(ye);let vt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),mt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ls=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),us=!mt.includes("valuechange")&&(Rn||mt.includes("change")&&!ls),yt=c._nativeHostAttrs&&/^textinput$/i.test(G),Et=mt.includes("update:value")&&!mt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),fs=c._nativeHostAttrs&&/^image$/i.test(G),Cn=Ls([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),kt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Tn=Yt&&(kt||An)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),In=new Set(["","primary","secondary","outline","ghost","danger"]),Pn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",On=c._nativeHostAttrs&&/^button$/i.test(G)&&!In.has(Pn),yr=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())??!1,ps=yr&&(!vt||us)&&(!yt||Et)&&(!Yt||Tn)&&(!fs||Cn)&&!On;for(let ye of ps?[]:c._targetComponentDirs??[])if(ye&&!he.includes(ye))he.push(ye);let Rt=typeof c.root==="string"?ae.resolve(c.root):void 0,$r=Rt??ae.dirname(l),Ct=[];if(Rt)Ct.push(ae.resolve(Rt,"resources/views/components")),Ct.push(ae.resolve(Rt,"resources/components")),Ct.push(ae.resolve(Rt,"src/components")),Ct.push(ae.resolve(Rt,"components"));Ct.push(ae.resolve(import.meta.dir,"components"));for(let ye of Ct)if(!he.includes(ye))he.push(ye);if(yr){let ye=(ps?c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((rt)=>typeof rt==="string"&&rt.length>0);if(ye.length){let rt=he.slice(Ze).map((Je)=>ae.isAbsolute(Je)?Je:ae.resolve($r,Je)).filter((Je)=>!ye.includes(Je)),_t=`${G}\x00${rt.join("\x00")}`,ht=cr.get(_t);if(ht===void 0){ht=!1;for(let Je of rt){for(let dt of ce)if(await r(ae.join(Je,dt))){ht=!0;break}if(ht)break}cr.set(_t,ht)}if(!ht){for(let Je of ye){let dt=he.indexOf(Je);if(dt>=0)he.splice(dt,1)}he.splice(Ze,0,...ye)}}}let Rr=c._pluginComponentDirs;if(Array.isArray(Rr)){for(let ye of Rr)if(typeof ye==="string"&&!he.includes(ye))he.push(ye)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(ps){for(let ye of c._targetComponentDirs??[])if(ye&&!he.includes(ye))he.push(ye)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!he.includes(Mn.dir))he.push(Mn.dir);let Ar=[...new Set(he.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve($r,ye)}))];he.length=0,he.push(...Ar);let ds=`${G}\x00${l}\x00${Ar.join("\x00")}`,gs=es.get(ds);if(gs)if(await r(gs))D=gs;else es.delete(ds);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of he){if(!ye)continue;for(let rt of ce){let _t=ae.join(ye,rt);if(ne.push(_t),await r(_t)){D=_t;break}}if(D)break;if(!D)try{let rt=await import("fs");if(!rt.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let ht=8,Je=[{path:ye,depth:0}];while(Je.length>0&&!D){let dt=Je.pop();if(dt.depth>=ht)continue;let Ir;try{Ir=rt.readdirSync(dt.path,{withFileTypes:!0})}catch{continue}for(let jn of Ir){if(!jn.isDirectory())continue;if(jn.name==="node_modules"||jn.name.startsWith("."))continue;let Pr=ae.join(dt.path,jn.name);for(let na of ce){let ms=ae.join(Pr,na);if(ne.push(ms),await r(ms)){D=ms;break}}if(D)break;Je.push({path:Pr,depth:dt.depth+1})}}}catch{}if(D)break}if(D)es.set(ds,D)}if(!D||!await r(D))return jo(e,l,ne),Do(e);v.add(D);let te;if(cn.has(D)&&ar.get(D)===To(D))te=cn.get(D);else try{let re=To(D);te=await Bun.file(D).text(),cn.set(D,te),ar.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return jo(e,l,[D],ce),Do(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(cu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(No.has(ce))continue;No.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Fn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),be={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))be[re]=ce;let ue=E.length>0?{[Kn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-np6h1ct6.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-f69cmsz9.js")),ce={...a,__processedComponents:O,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Te=[];if(Zc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-nb2tedk0.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(_e[1].trim())}let We=J(Ee),Ke=[],Qe=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",he=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ze=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Re=!Ze||["module","text/javascript","application/javascript"].includes(Ze),pt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Re&&!pt)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-d2mdh669.js")),tt=Xe(Qe),Ge={};if(tt.defaultSlot?.trim())Ge.default=tt.defaultSlot;for(let[re,ce]of tt.namedSlots)Ge[re]=ce.content;let bt=a.__stx_scope_seq??={n:0,key:Ws(String(a.__filename??l))},Wt=Bo(e,process.cwd()),ot=`stx_${(Wt.endsWith(".stx")?Wt.slice(0,-4):Wt).replace(/[^a-zA-Z0-9]/g,"_")}_${++bt.n}_${bt.key}`,Pe={...be,$uid:ot,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Qe,$slots:Ge,__processedComponents:P,__sections:{},__stx_signals_gate:ke(te)||Zc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-f69cmsz9.js"));te=await re(te,Pe,D,c,v)}iu(te,Pe);let Vt=te,un=pe(Vt);if(un)Vt=un.content.trim();let rs=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...te.matchAll(rs)];for(let[,re,ce]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ye=[],Ht=null,is=Ut.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),$t=null,at=null,qt=null,pn=0,Zt=null;if(Yl(c),is&&fr>0){let re=Ql({props:t,slot:Ee,slotContext:i.trim()?eu(be):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:ot});if(re!==null){$t=`${D}\x00${S(te)}\x00${re}`;let ce=ts.get($t);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ki(a,ce.clientFactories),bt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ce.preservedClientExpressions)_e.add(he);a.__stx_preserved_client_expressions=[..._e]}return ce.output}at=new Set(v),qt=$i(a),pn=bt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let re of Ut){let ce=re[1]||"",_e=re[2]||"",he=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(he&&_e){for(let Re of De(_e))Kt.add(Re);try{await F(_e,Pe,D,{onFailure:(Re)=>{if(Re.kind!=="unknown")Ht=Re.kind}})}catch(Re){}}if(!he){let Re=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),pt=Re.includes("{{")&&Re.includes("}}"),vt=Re.includes("{!!")&&Re.includes("!!}");if(pt||vt)Re=Si(Re,Pe,D);let mt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ye.push(`<script${mt}>${Re}</script>`)}}let et=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=et?et[1]:"",os=et?et[2]:"",lt="",se=Xt&&/\bscoped\b/i.test(Xt);if(et)lt=`<style${Xt}>${au(os,Pe,D)}</style>`;let oe=Vt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),et)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,he)=>{let Ze=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ze)ce.push(`<style${Ze[1]}>${Ze[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)lt=`${lt}${ce.join(`
|
|
574
|
-
`)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-
|
|
573
|
+
`)}`:"";console.error(`[stx] component <${e}> could not be resolved${l}, so it rendered as nothing.${c}${b}`)}function Do(e){return`<!-- stx: component "${e.replace(/--+/g,"-")}" could not be resolved; see the server log -->`}var cu=new Set(["for","if","show","key","ref","class","className","style"]),No=new Set,Fo="useMediaQuery|useDark|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useDocumentVisibility|useScrollLock",Qc=new RegExp(`\\b(?:${Fo})\\s*(?:<[^>]*>)?\\s*\\(`);function vi(e){let t=new Set,i=new RegExp(`\\b(?:const|let|var)\\s+([a-zA-Z_$][\\w$]*)\\s*=\\s*(?:state|derived|computed|ref|reactive|signal|useModel|useReactiveProp|useLocalStorage|useSessionStorage|keptState|useCookie|useDebouncedValue|${Fo})\\s*(?:<[^>]*>)?\\s*\\(`,"g");for(let n of e){let a;while((a=i.exec(n))!==null)t.add(a[1]);i.lastIndex=0}return[...t]}async function ze(e,t,i,n,a,l,c,b=new Set,v,E=st(a),A,j=e){let{extractVariables:F}=await o("stx/variable-extractor",()=>import("./chunk-3gzhh69y.js")),O=b??new Set;if(O.has(e))return`[Circular component reference: ${e}]`;let P=new Set(O);P.add(e);let B=typeof t.client==="string"?t.client.trim():"";if("client"in t)delete t.client;let L=B&&B!=="load"&&bg(B)?B:"";try{let H=(re)=>re.split("-").map((ce)=>ce.charAt(0).toUpperCase()+ce.slice(1)).join(""),G=j.endsWith(".stx")?j.slice(0,-4):j,D=null,ee=a.__importedComponents;if(ee){let re=[G,G.toLowerCase(),H(G),U(G)];for(let ce of re)if(ee.has(ce)){D=ee.get(ce);break}}let ne=[];if(!D){let re=[`${G}.stx`,`${H(G)}.stx`,`${U(G)}.stx`],ce=[...new Set(re)],_e=a.__originalFilePath,he=[];for(let ye of Dn(l))if(!he.includes(ye))he.push(ye);let Ze=he.length;for(let ye of c._layerComponentDirs??[])if(!he.includes(ye))he.push(ye);if(_e){let ye=ae.join(ae.dirname(_e),"components");he.push(ye)}let Re=c._rootComponentsDir;if(typeof Re==="string"&&Wo(n,c)&&!he.includes(Re))he.push(Re);if(n&&!he.includes(n))he.push(n);if(typeof Re==="string"&&!he.includes(Re))he.push(Re);let pt=ae.join(ae.dirname(l),"components");if(!he.includes(pt))he.push(pt);if(c.componentsDir&&c.componentsDir!==n&&!he.includes(c.componentsDir))he.push(c.componentsDir);for(let ye of c.additionalComponentsDirs??[])if(ye&&!he.includes(ye))he.push(ye);let vt=c._nativeHostAttrs&&/^(?:checkbox|switch)$/i.test(G),mt=(A?.events??[]).map((ye)=>ye.replace(/^@/,"").split(".")[0].toLowerCase().replace(/-/g,"")),Rn=Object.hasOwn(t,"checked")||Boolean(A?.reactiveProps?.includes("checked")),ls=Object.hasOwn(t,"value")||Boolean(A?.reactiveProps?.includes("value")),us=!mt.includes("valuechange")&&(Rn||mt.includes("change")&&!ls),yt=c._nativeHostAttrs&&/^textinput$/i.test(G),Et=mt.includes("update:value")&&!mt.includes("input"),Yt=c._nativeHostAttrs&&/^video$/i.test(G),fs=c._nativeHostAttrs&&/^image$/i.test(G),Cn=Ls([...Object.keys(t),...A?.reactiveProps??[]],A?.events,t),kt=Object.hasOwn(t,"src")||Boolean(A?.reactiveProps?.includes("src")),An=Object.hasOwn(t,"source")||Boolean(A?.reactiveProps?.includes("source")),Tn=Yt&&(kt||An)&&(A?.events??[]).every((ye)=>/^(?:play|pause|ended|timeupdate|loadedmetadata|loadstart|error)$/.test(ye.replace(/^@/,"").split(".")[0])),In=new Set(["","primary","secondary","outline","ghost","danger"]),Pn=typeof t.variant==="string"?t.variant.trim().toLowerCase():"",On=c._nativeHostAttrs&&/^button$/i.test(G)&&!In.has(Pn),yr=c._targetComponentFallbackNames?.some((ye)=>ye.toLowerCase()===G.toLowerCase())??!1,ps=yr&&(!vt||us)&&(!yt||Et)&&(!Yt||Tn)&&(!fs||Cn)&&!On;for(let ye of ps?[]:c._targetComponentDirs??[])if(ye&&!he.includes(ye))he.push(ye);let Rt=typeof c.root==="string"?ae.resolve(c.root):void 0,$r=Rt??ae.dirname(l),Ct=[];if(Rt)Ct.push(ae.resolve(Rt,"resources/views/components")),Ct.push(ae.resolve(Rt,"resources/components")),Ct.push(ae.resolve(Rt,"src/components")),Ct.push(ae.resolve(Rt,"components"));Ct.push(ae.resolve(import.meta.dir,"components"));for(let ye of Ct)if(!he.includes(ye))he.push(ye);if(yr){let ye=(ps?c._pluginComponentDirs??[]:c._targetComponentDirs??[]).filter((rt)=>typeof rt==="string"&&rt.length>0);if(ye.length){let rt=he.slice(Ze).map((Je)=>ae.isAbsolute(Je)?Je:ae.resolve($r,Je)).filter((Je)=>!ye.includes(Je)),_t=`${G}\x00${rt.join("\x00")}`,ht=cr.get(_t);if(ht===void 0){ht=!1;for(let Je of rt){for(let dt of ce)if(await r(ae.join(Je,dt))){ht=!0;break}if(ht)break}cr.set(_t,ht)}if(!ht){for(let Je of ye){let dt=he.indexOf(Je);if(dt>=0)he.splice(dt,1)}he.splice(Ze,0,...ye)}}}let Rr=c._pluginComponentDirs;if(Array.isArray(Rr)){for(let ye of Rr)if(typeof ye==="string"&&!he.includes(ye))he.push(ye)}if(c.fallbackComponentsDir&&!he.includes(c.fallbackComponentsDir))he.push(c.fallbackComponentsDir);if(ps){for(let ye of c._targetComponentDirs??[])if(ye&&!he.includes(ye))he.push(ye)}let Mn=c._nativePrimitivesFallback;if(Mn&&!Mn.except.some((ye)=>ye.toLowerCase()===G.toLowerCase())&&!he.includes(Mn.dir))he.push(Mn.dir);let Ar=[...new Set(he.map((ye)=>{if(!ye)return ye;return ae.isAbsolute(ye)?ye:ae.resolve($r,ye)}))];he.length=0,he.push(...Ar);let ds=`${G}\x00${l}\x00${Ar.join("\x00")}`,gs=es.get(ds);if(gs)if(await r(gs))D=gs;else es.delete(ds);if(!D&&(G.startsWith("./")||G.startsWith("../")))D=ae.resolve(ae.dirname(l),`${G}.stx`),ne.push(D);else if(!D)for(let ye of he){if(!ye)continue;for(let rt of ce){let _t=ae.join(ye,rt);if(ne.push(_t),await r(_t)){D=_t;break}}if(D)break;if(!D)try{let rt=await import("fs");if(!rt.statSync(ye,{throwIfNoEntry:!1})?.isDirectory())continue;let ht=8,Je=[{path:ye,depth:0}];while(Je.length>0&&!D){let dt=Je.pop();if(dt.depth>=ht)continue;let Ir;try{Ir=rt.readdirSync(dt.path,{withFileTypes:!0})}catch{continue}for(let jn of Ir){if(!jn.isDirectory())continue;if(jn.name==="node_modules"||jn.name.startsWith("."))continue;let Pr=ae.join(dt.path,jn.name);for(let na of ce){let ms=ae.join(Pr,na);if(ne.push(ms),await r(ms)){D=ms;break}}if(D)break;Je.push({path:Pr,depth:dt.depth+1})}}}catch{}if(D)break}if(D)es.set(ds,D)}if(!D||!await r(D))return jo(e,l,ne),Do(e);v.add(D);let te;if(cn.has(D)&&ar.get(D)===To(D))te=cn.get(D);else try{let re=To(D);te=await Bun.file(D).text(),cn.set(D,te),ar.set(D,re)}catch(re){let ce=re instanceof Error?re.message:String(re);return jo(e,l,[D],ce),Do(e)}if(A)for(let re of new Set([...Object.keys(t),...A.reactiveProps??[]])){let ce=re.toLowerCase();if(ce.startsWith("aria-")||ce.startsWith("data-"))continue;let _e=re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${_e}\\b`).test(te))A.declaredProps.add(re);if(new RegExp(`\\$props\\s*(?:\\.\\s*${_e}\\b|\\[\\s*['"]${_e}['"]\\s*\\])`).test(te)||new RegExp(`\\buseReactiveProp\\s*\\(\\s*['"]${_e}['"]`).test(te))A.consumedProps?.add(re)}if(A?.reactiveProps?.length&&/\bdefineProps\s*(?:<[^>]*>)?\s*\(/.test(te))for(let re of A.reactiveProps){if(cu.has(re)||A.consumedProps?.has(re))continue;if(new RegExp(`\\buse(?:ReactiveProp|Model)\\s*\\(\\s*['"]${re.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(te))continue;let ce=`${D}\x00${re}`;if(No.has(ce))continue;No.add(ce),console.warn(`[stx] ${ae.basename(D)} reads \`${re}\` with defineProps(), which is not live, but ${ae.basename(l)} binds it (:${re}): the value can arrive empty or stale (on a native screen, and for a :for's rows, it does not arrive at all). Read it with useReactiveProp('${re}').`)}let le=new Set(["__originalFilePath","__importedComponents",Fn,"__stx_client_signal_names","__stx_client_declared_names","__stx_runtime_config","__stxServeContext","__stx_scope_seq"]),be={};for(let[re,ce]of Object.entries(a))if(!re.startsWith("__")||le.has(re))be[re]=ce;let ue=E.length>0?{[Kn]:[...E]}:{},Ee=i;if(i.includes("@include")){let{processIncludes:re}=await o("stx/includes",()=>import("./chunk-40bkdswh.js"));Ee=await re(i,a,l,c,v)}if(/<[A-Z][\w.-]*[\s/>]/.test(Ee)){let{processComponents:re}=await o("stx/component-renderer",()=>import("./chunk-b3fx75th.js")),ce={...a,__processedComponents:O,...ue};Ee=await re(Ee,ce,l,c,v);let _e=ce.__stx_preserved_client_expressions;if(Array.isArray(_e)&&_e.length>0)a.__stx_preserved_client_expressions=[...new Set([...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],..._e])]}let Te=[];if(Zc(Ee)){let{processExpressions:re}=await o("stx/expressions",()=>import("./chunk-8gdtys3s.js")),ce=a.__stx_signals_gate===void 0?{...a,__stx_signals_gate:!0,...ue}:E.length>0?{...a,...ue}:a;Ee=re(Ee,ce,l);for(let _e of Ee.matchAll(/\{\{([\s\S]*?)\}\}/g))Te.push(_e[1].trim())}let We=J(Ee),Ke=[],Qe=We.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(re,ce)=>{let _e=We.scripts[Number(ce)]||"",he=_e.match(/^<script\b([^>]*)>/i)?.[1]||"",Ze=he.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),Re=!Ze||["module","text/javascript","application/javascript"].includes(Ze),pt=/\sdata-stx-(?:owner|instance)(?=[\s=/>])/i.test(` ${he}`);if(!/\bserver\b/i.test(he)&&Re&&!pt)return Ke.push(_e),"";return _e}),{extractSlotContent:Xe}=await o("stx/slots",()=>import("./chunk-6nb07mdj.js")),tt=Xe(Qe),Ge={};if(tt.defaultSlot?.trim())Ge.default=tt.defaultSlot;for(let[re,ce]of tt.namedSlots)Ge[re]=ce.content;let bt=a.__stx_scope_seq??={n:0,key:Ws(String(a.__filename??l))},Wt=Bo(e,process.cwd()),ot=`stx_${(Wt.endsWith(".stx")?Wt.slice(0,-4):Wt).replace(/[^a-zA-Z0-9]/g,"_")}_${++bt.n}_${bt.key}`,Pe={...be,$uid:ot,$native:c._nativeHostAttrs===!0,...t,props:t,slot:Qe,$slots:Ge,__processedComponents:P,__sections:{},__stx_signals_gate:ke(te)||Zc(i),__stx_preserved_client_expressions:[...Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[],...Te]};if(/import\s/.test(te)){Pe.__importedComponents=new Map(Pe.__importedComponents);let{processESImports:re}=await o("stx/component-renderer",()=>import("./chunk-b3fx75th.js"));te=await re(te,Pe,D,c,v)}iu(te,Pe);let Vt=te,un=pe(Vt);if(un)Vt=un.content.trim();let rs=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Ut=[...te.matchAll(rs)];for(let[,re,ce]of Ut)if(!/\bserver\b|\bsrc\s*=|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/i.test(re))Ne(ce,D,c.strict);let Ye=[],Ht=null,is=Ut.some((re)=>/\bserver\b/.test(re[1]||"")&&/\bcache\b/.test(re[1]||"")),$t=null,at=null,qt=null,pn=0,Zt=null;if(Yl(c),is&&fr>0){let re=Ql({props:t,slot:Ee,slotContext:i.trim()?eu(be):void 0,buildMode:c.buildMode??"",skipEventDirectives:c.skipEventDirectives===!0,native:c._nativeHostAttrs===!0,clientLoopNames:[...E].sort(),layers:c._layerGraph?.layers.map((ce)=>ce.configFile),uid:ot});if(re!==null){$t=`${D}\x00${S(te)}\x00${re}`;let ce=ts.get($t);if(ce){for(let _e of ce.dependencies)v.add(_e);if(ki(a,ce.clientFactories),bt.n+=ce.uidsConsumed,ce.preservedClientExpressions.length>0){let _e=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let he of ce.preservedClientExpressions)_e.add(he);a.__stx_preserved_client_expressions=[..._e]}return ce.output}at=new Set(v),qt=$i(a),pn=bt.n,Zt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[])}}let Kt=new Set;for(let re of Ut){let ce=re[1]||"",_e=re[2]||"",he=ce.includes("server");if(Be(ce)&&_e.trim())_e=Fe(_e);if(he&&_e){for(let Re of De(_e))Kt.add(Re);try{await F(_e,Pe,D,{onFailure:(Re)=>{if(Re.kind!=="unknown")Ht=Re.kind}})}catch(Re){}}if(!he){let Re=_e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),pt=Re.includes("{{")&&Re.includes("}}"),vt=Re.includes("{!!")&&Re.includes("!!}");if(pt||vt)Re=Si(Re,Pe,D);let mt=ce.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");Ye.push(`<script${mt}>${Re}</script>`)}}let et=J(te).output.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Xt=et?et[1]:"",os=et?et[2]:"",lt="",se=Xt&&/\bscoped\b/i.test(Xt);if(et)lt=`<style${Xt}>${au(os,Pe,D)}</style>`;let oe=Vt;if(oe=oe.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),et)oe=oe.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let re=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,ce=[];if(oe=oe.replace(re,(_e,he)=>{let Ze=he.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(Ze)ce.push(`<style${Ze[1]}>${Ze[2]}</style>`);return""}),oe=oe.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),ce.length>0)lt=`${lt}${ce.join(`
|
|
574
|
+
`)}`}if(i&&oe.includes("{{ text || slot }}"))oe=oe.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>i);let{applySlots:de}=await o("stx/slots",()=>import("./chunk-6nb07mdj.js")),{defaultSlot:we,namedSlots:Ae}=tt,Ve=a.__stx_signals_gate===!0&&/\s(?:@[\w:.-]+|x-on:[\w:.-]+)\s*=/.test(Qe),nt=Ye.length>0&&Js(oe)||c._nativeHostAttrs===!0&&Ye.length>0||Ve&&Ye.length>0||Ye.some((re)=>/\b(?:state|derived|effect|ref|useRef|reactive|computed|watch|watchEffect|useModel|useReactiveProp|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(re)),as=(re)=>nt?no(re,ot):re,cs=new Map([...Ae].map(([re,ce])=>[re,{...ce,content:as(ce.content)}]));oe=await de(oe,nt?to(as(we),ot):we,cs,Pe,nt?ot:"");let dn=vi(Ye),Jt=(Array.isArray(Pe.__stx_client_signal_names)?Pe.__stx_client_signal_names:[]).filter((re)=>!Kt.has(re));if(dn.length>0||Jt.length>0)Pe.__stx_client_signal_names=[...new Set([...Jt,...dn])];else delete Pe.__stx_client_signal_names;let Gt=E.filter((re)=>!Kt.has(re)&&!(re in t));if(Gt.length>0)Pe[Kn]=Gt;let $n={...c,_rootComponentsDir:c._rootComponentsDir||c.componentsDir,componentsDir:ae.dirname(D),skipSignalsRuntime:!0,skipEventDirectives:c._nativeHostAttrs===!0||nt||Ye.length===0,defaultLayout:void 0};Pe.__stxProcessingDepth=(a.__stxProcessingDepth||0)+1;let{processDirectives:En}=await o("stx/process",()=>import("./chunk-ndah5rvs.js")),ut=await En(oe,Pe,D,$n,v),gt=new Set(Array.isArray(a.__stx_preserved_client_expressions)?a.__stx_preserved_client_expressions:[]);for(let re of ut.matchAll(/\{\{([\s\S]*?)\}\}/g))gt.add(re[1].trim());if(gt.size>0)a.__stx_preserved_client_expressions=[...gt];let ft=ot,qe=ut;if(nt){let re="";if(Object.keys(t).length>0)try{re=` data-stx-props="${ir(JSON.stringify(t))}"`}catch{}let ce=L?` stx-hydrate="${ir(L)}"`:"",_e=Object.fromEntries(Object.entries(Ge).map(([yt,Et])=>[yt,Boolean(Et)])),he=Object.keys(_e).length>0?` data-stx-slots="${ir(JSON.stringify(_e))}"`:"",Ze=` data-stx-scope="${ft}"${re}${he}${ce}`,Re=ut.slice(Pt(ut)),pt=/^<span(?=[\s/>])/i.test(Re),vt=/^<[^>]+\bdata-stx-layout-root(?:\s|=|>)/i.test(Re),mt=/^<[^>]+\bdata-stx-fill-root(?:\s|=|>)/i.test(Re),Rn=pt?"span":"div",ls=vt&&c._nativeHostAttrs?' style="display:flex;flex-direction:column;flex:1;min-height:0;min-width:0"':mt&&c._nativeHostAttrs?' style="width:100%;height:100%"':pt||vt?' style="display:contents"':"";qe=yg(ut,Ze)??`<${Rn}${Ze} data-stx-component-wrapper${ls}>${ut}</${Rn}>`;let us=await Promise.all(Ye.map(async(yt)=>{let Et=yt.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!Et)return yt;let[,Yt,fs]=Et,Cn=Ao(yt,Pe,D);if(Cn!==null)return Cn;let kt=await uu(fs,D,c.buildMode==="compile"),An=vn(kt.clientCode,Le(Pe)),{vendorStyleTags:Tn}=kt,In=An?`function(__scopeId) {
|
|
575
575
|
${An}
|
|
576
576
|
return (${kt.factoryBody})(__scopeId);
|
|
577
577
|
}`:kt.factoryBody,Pn=L?null:ks(a,In),On=Pn?`window.__stxComponentFactories[${JSON.stringify(Pn)}](${JSON.stringify(ft)});`:`(${In})(${JSON.stringify(ft)});`;if(L)return`${Tn}<script type="stx/island" data-stx-island="${ft}" data-stx-scoped data-stx-owner="${ft}"${Yt}>${On}</script>`;return`${Tn}<script data-stx-scoped data-stx-run="always" data-stx-owner="${ft}"${Yt}>${On}</script>`}));if(qe=qe+`
|
|
@@ -597,7 +597,7 @@ ${ve.yellow}${ve.bold}Message:${ve.reset} ${t}
|
|
|
597
597
|
`,b)A+=`
|
|
598
598
|
${ve.blue}${ve.bold}Context:${ve.reset}
|
|
599
599
|
${ve.dim}${b}${ve.reset}
|
|
600
|
-
`;return A}function ge(){cn.clear(),ar.clear(),es.clear(),cr.clear(),lr.clear(),ur.clear(),ts.clear()}function Qh(){return{size:cn.size,maxSize:500}}var or=w(128);async function uu(e,t,i){let n=S(e,t,i),a=or.get(n);if(a){if(js(a.deps))return a;or.delete(n)}let l=bi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=wi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-
|
|
600
|
+
`;return A}function ge(){cn.clear(),ar.clear(),es.clear(),cr.clear(),lr.clear(),ur.clear(),ts.clear()}function Qh(){return{size:cn.size,maxSize:500}}var or=w(128);async function uu(e,t,i){let n=S(e,t,i),a=or.get(n);if(a){if(js(a.deps))return a;or.delete(n)}let l=bi(e,{filePath:t,projectRoot:process.cwd()}),c=l.code,b=wi(l.styles);c=Dt(c).code;let{hasUserImports:v,bundleClientScript:E}=await o("stx/client-script-bundler",()=>import("./chunk-mh4kpnjr.js")),A=[],j=!1;if(v(c)){let G=c;c=await E(G,t,{projectRoot:process.cwd(),minify:i,collectInputs:A}),j=c===G}let{stripStxRuntimeImports:F}=await o("stx/signal-processing",()=>import("./chunk-qcars8ar.js"));c=F(c);let O=I(c),P=nu(O),B=new Set(V(O,!0).split(",").map((G)=>G.trim())),L=`function(__scopeId) {
|
|
601
601
|
${ct("const",[...fl,...P],O)}
|
|
602
602
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
603
603
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{im}from"./chunk-7m53tpxn.js";import"./chunk-7dnp8evg.js";import"./chunk-xbcnnk8x.js";import"./chunk-xdzy4pm0.js";import"./chunk-qzms4d8s.js";import"./chunk-57x8wxdf.js";import"./chunk-vwddsdk5.js";import"./chunk-2vprq4x0.js";import"./chunk-4dxq7ft1.js";import"./chunk-z9xjhc5m.js";import"./chunk-jgx0ex9p.js";import"./chunk-b90xw7v4.js";import"./chunk-1b1ntgt7.js";import"./chunk-8d4br2j5.js";import"./chunk-xqtt5t6d.js";import"./chunk-2fj5zev7.js";import"./chunk-88rwr1w2.js";import"./chunk-chjdnmqv.js";import"./chunk-ns0171xk.js";import"./chunk-11y84h2d.js";import"./chunk-4657mnht.js";import"./chunk-zg44cf8a.js";import"./chunk-2j5yane9.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{im as buildForProduction};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{w,S,mi,hn}from"./chunk-
|
|
2
|
+
import{w,S,mi,hn}from"./chunk-vbw9jhz2.js";import{Yo}from"./chunk-88rwr1w2.js";import{c}from"./chunk-z4g64re8.js";import F from"fs";import d from"path";import{hasLocalConfig as he}from"bunfig";var wt={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},"line-hover":{light:"neutral-400",dark:"neutral-500",description:"Border of a hovered control"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function Ge(n){return`--stx-${n}`}function _(n,t){let s=t.lastIndexOf("-");if(s===-1)return typeof n[t]==="string"?n[t]:void 0;let r=n[t.slice(0,s)];if(!r||typeof r!=="object")return;let i=r[t.slice(s+1)];return typeof i==="string"?i:void 0}var we=/^(?:#[\da-f]{3,8}|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|var)\(.*\)|white|black|transparent|currentcolor)$/i;function q(n,t){let s=t.trim();return _(n,s)??(we.test(s)?s:void 0)}function ee(n={}){return[...Object.keys(n.roles??{}).filter((t)=>!wt[t]).map((t)=>`roles.${t}`),...Object.keys(n.shapes??{}).filter((t)=>!be[t]).map((t)=>`shapes.${t}`),...Object.keys(n.density??{}).filter((t)=>!Pe[t]).map((t)=>`density.${t}`)]}function te(n){let t={};for(let[s,r]of Object.entries(wt)){let i=_(n,r.light);if(i===void 0)continue;t[s]=`var(${Ge(s)}, ${i})`}return t}function ne(n,t={}){let s=[],r=[];for(let[i,l]of Object.entries(wt)){let a=t[i],g=typeof a==="string"?a:a?.light,o=typeof a==="string"?a:a?.dark,f=g&&q(n,g)||_(n,l.light),h=o&&q(n,o)||_(n,l.dark);if(f===void 0)continue;if(s.push(` ${Ge(i)}: ${f};`),h!==void 0)r.push(` ${Ge(i)}: ${h};`)}if(s.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...s,"}",".dark {",...r,"}",""].join(`
|
|
3
3
|
`)}var be={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function ln(n){return`--stx-radius-${n}`}function se(){let n={};for(let[t,s]of Object.entries(be))n[t]=`var(${ln(t)}, ${s.value})`;return n}function re(n={}){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(be).map(([t,s])=>` ${ln(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
4
4
|
`)}var Pe={"control-px":{value:"1rem",description:"Inline padding of a md text control \u2014 px-4"},"control-py":{value:"0.5rem",description:"Block padding of a md text control \u2014 py-2"},"control-text":{value:"1rem",description:"Font size of a md text control \u2014 text-base"},"control-leading":{value:"1.5rem",description:"Line height of a md text control \u2014 text-base"},"cell-px":{value:"1.5rem",description:"Inline padding of every table cell, header or body \u2014 px-6"},"cell-py":{value:"1rem",description:"Block padding of a body cell \u2014 py-4"},"cell-text":{value:"0.875rem",description:"Font size of a body cell \u2014 text-sm"},"cell-leading":{value:"1.25rem",description:"Line height of a body cell \u2014 text-sm"},"cell-head-py":{value:"0.75rem",description:"Block padding of a header cell \u2014 py-3"},"cell-head-text":{value:"0.75rem",description:"Font size of a header cell \u2014 text-xs"},"cell-head-leading":{value:"1rem",description:"Line height of a header cell \u2014 text-xs"}},or={"control-x":"control-px","control-y":"control-py","cell-x":"cell-px","cell-y":"cell-py","cell-head-y":"cell-head-py"},ir={control:{size:"control-text",leading:"control-leading"},cell:{size:"cell-text",leading:"cell-leading"},"cell-head":{size:"cell-head-text",leading:"cell-head-leading"}};function Je(n){return`--stx-${n}`}function V(n){let t=Pe[n];if(!t)throw Error(`[stx] unknown density token "${n}"`);return`var(${Je(n)}, ${t.value})`}function ie(){let n={};for(let[t,s]of Object.entries(or))n[t]=V(s);return n}function oe(){let n={};for(let[t,{size:s,leading:r}]of Object.entries(ir))n[t]=[V(s),{lineHeight:V(r)}];return n}function ce(n={}){return["/* stx density tokens \u2014 how much room a control or a table cell takes. */",":root {",...Object.entries(Pe).map(([t,s])=>` ${Je(t)}: ${n[t]??s.value};`),"}",""].join(`
|
|
5
5
|
`)}function ae(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function W(n,t){let s={...n};for(let[r,i]of Object.entries(t))s[r]=ae(i)&&ae(s[r])?W(s[r],i):i;return s}function le(n,t){if(!t.fonts)return"";let s=new n({...t.config,fonts:t.fonts,cssVariables:!1}).toCSS(!1,t.minify);return s&&!t.minify?`${s}
|
|
6
|
-
`:s}function de(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...l}=r,{extend:a,...g}=s,o=g.colors||{};g.colors={...o,...te(o)};let f=g.borderRadius||{};g.borderRadius={...f,...se()};let h=g.spacing||{};g.spacing={...h,...ie()};let K=g.fontSize||{};g.fontSize={...K,...oe()};let R=W(g,l),m=W(a||{},i||{});if(Object.keys(m).length>0)R.extend=m;let P=[...n.safelist||[],...t.safelist||[]],M={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:U,...O}=n,{fonts:N,roles:T,shapes:I,density:y,...C}=t,u={roles:T,shapes:I,density:y},j=N??U;return{config:{...O,...C,theme:R,safelist:P,shortcuts:M,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:P,shortcuts:M,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ne({...o,...R.colors},T)+re(I)+ce(y),unknownRoles:ee(u),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import ve from"path";var $e=256,x=new Map,ge=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),fe=(n)=>c(process.cwd(),"css-assets",`${n}.css`);function z(n,t){if(x.delete(n),x.set(n,t),x.size>$e)x.delete(x.keys().next().value)}function ue(n){let t=ge(n),s=fe(t);if(x.has(s))return z(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(ve.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return z(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function Af(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=fe(n),s=x.get(t);if(s!==void 0)return z(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ge(r)!==n)return;return z(t,r),r}catch{return}}function pe(){x.clear()}var p=null,G="";function me(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;G=`${t}@${Math.trunc(F.statSync(t).mtimeMs)}`}catch{G=n}}var Y=!1,v=null,A="",E=!1,Re=256,k=new Map,L=null,Ce=null,H=new Map,ye=new Set;function X(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function Q(n,t){if(k.has(n))k.delete(n);else if(k.size>=Re)k.delete(k.keys().next().value);k.set(n,t)}async function Te(n,t=L){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${X(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function je(n,t,s=L){if(!s)return;try{if(!F.existsSync(s))F.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${X(n)}.css`),t)}catch{}}async function xe(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Be=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ee=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function De(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Be)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Oe(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function ac(){if(Y)return p;Y=!0;try{let n=async(i)=>{for(let l of i){if(!await Bun.file(l).exists())continue;let a=await xe(l);if(a){if(me(l),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(l))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),l=await n([i]);if(!l)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=l,p}let t=await n(De());if(t)return p=t,p;let s=Ee;for(let i of s){let l=await xe(i);if(l){p=l;try{me(import.meta.resolve(i))}catch{G=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Oe());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Ah(){J.clear(),p=null,Y=!1,v=null,A="",k.clear(),pe(),Ce=null,H.clear()}var ke=!1;async function cc(n){try{let t=he({name:"css",cwd:n})?"css":he({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!ke)ke=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Pf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-
|
|
6
|
+
`:s}function de(n={},t={}){let s=n.theme||{},r=t.theme||{},{extend:i,...l}=r,{extend:a,...g}=s,o=g.colors||{};g.colors={...o,...te(o)};let f=g.borderRadius||{};g.borderRadius={...f,...se()};let h=g.spacing||{};g.spacing={...h,...ie()};let K=g.fontSize||{};g.fontSize={...K,...oe()};let R=W(g,l),m=W(a||{},i||{});if(Object.keys(m).length>0)R.extend=m;let P=[...n.safelist||[],...t.safelist||[]],M={...n.shortcuts||{},...t.shortcuts||{}},D=[...n.preflights||[],...t.preflights||[]],{fonts:U,...O}=n,{fonts:N,roles:T,shapes:I,density:y,...C}=t,u={roles:T,shapes:I,density:y},j=N??U;return{config:{...O,...C,theme:R,safelist:P,shortcuts:M,...D.length>0?{preflights:D}:{},content:[],output:""},safelist:P,shortcuts:M,includePreflight:t.preflight!==!1,minify:t.minify===!0,tokenCSS:ne({...o,...R.colors},T)+re(I)+ce(y),unknownRoles:ee(u),...j?{fonts:j}:{}}}var e={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"};import B from"fs";import ve from"path";var $e=256,x=new Map,ge=(n)=>Bun.hash(n).toString(16).padStart(16,"0").slice(0,16),fe=(n)=>c(process.cwd(),"css-assets",`${n}.css`);function z(n,t){if(x.delete(n),x.set(n,t),x.size>$e)x.delete(x.keys().next().value)}function ue(n){let t=ge(n),s=fe(t);if(x.has(s))return z(s,n),t;let r;try{let i;try{i=B.readFileSync(s,"utf8")}catch{}if(i!==n)B.mkdirSync(ve.dirname(s),{recursive:!0}),r=`${s}.${process.pid}.${crypto.randomUUID()}.tmp`,B.writeFileSync(r,n,{flag:"wx"}),B.renameSync(r,s);return z(s,n),t}catch{return}finally{if(r)try{B.unlinkSync(r)}catch{}}}function Af(n){if(!/^[a-f0-9]{16}$/.test(n))return;let t=fe(n),s=x.get(t);if(s!==void 0)return z(t,s),s;try{let r=B.readFileSync(t,"utf8");if(ge(r)!==n)return;return z(t,r),r}catch{return}}function pe(){x.clear()}var p=null,G="";function me(n){try{let t=n.startsWith("file:")?new URL(n).pathname:n;G=`${t}@${Math.trunc(F.statSync(t).mtimeMs)}`}catch{G=n}}var Y=!1,v=null,A="",E=!1,Re=256,k=new Map,L=null,Ce=null,H=new Map,ye=new Set;function X(n){return Bun.hash(n).toString(16).padStart(16,"0").slice(0,16)}function Q(n,t){if(k.has(n))k.delete(n);else if(k.size>=Re)k.delete(k.keys().next().value);k.set(n,t)}async function Te(n,t=L){if(!t)return null;try{let s=Bun.file(d.join(t,`cw-${X(n)}.css`));if(!await s.exists())return null;return await s.text()}catch{return null}}async function je(n,t,s=L){if(!s)return;try{if(!F.existsSync(s))F.mkdirSync(s,{recursive:!0});await Bun.write(d.join(s,`cw-${X(n)}.css`),t)}catch{}}async function xe(n){try{let t=await import(n);if(t&&t.CSSGenerator)return{CSSGenerator:t.CSSGenerator,config:t.config,build:t.build,defaultConfig:t.defaultConfig,extractClasses:t.extractClasses}}catch{}return null}var Be=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],Ee=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function De(){let n=[],t=process.cwd();while(t!==d.dirname(t)){for(let s of["node_modules","pantry"])for(let r of Be)n.push(d.join(t,s,...r));t=d.dirname(t)}return n}function Oe(){let n=[],t=process.env.HOME||process.env.USERPROFILE||"",s=[t&&d.join(t,"Code","Tools","ts-css"),t&&d.join(t,"Code","Tools","crosswind"),t&&d.join(t,"repos","stacks-org","ts-css"),t&&d.join(t,"repos","stacks-org","crosswind"),d.join(process.cwd(),"..","ts-css"),d.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let r of s)n.push(d.join(r,"packages","toolkit","dist","engine","index.js")),n.push(d.join(r,"packages","toolkit","src","engine","index.ts"));if(t)n.push(d.join(t,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return n}async function ac(){if(Y)return p;Y=!0;try{let n=async(i)=>{for(let l of i){if(!await Bun.file(l).exists())continue;let a=await xe(l);if(a){if(me(l),!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded from ${d.dirname(d.dirname(l))}`);return a}}return null};if(process.env.CROSSWIND_SRC){let i=d.resolve(process.env.CROSSWIND_SRC),l=await n([i]);if(!l)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${i}`);return p=l,p}let t=await n(De());if(t)return p=t,p;let s=Ee;for(let i of s){let l=await xe(i);if(l){p=l;try{me(import.meta.resolve(i))}catch{G=i}if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} CSS engine loaded`);return p}}let r=await n(Oe());if(r)return p=r,p;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${e.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${e.reset}`),console.warn(`${e.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${e.reset}`),null}}function Ah(){J.clear(),p=null,Y=!1,v=null,A="",k.clear(),pe(),Ce=null,H.clear()}var ke=!1;async function cc(n){try{let t=he({name:"css",cwd:n})?"css":he({name:"crosswind",cwd:n})?"crosswind":null;if(!t)return null;if(t==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!ke)ke=!0,console.warn(`${e.yellow}[ts-css]${e.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:s}=await import("bunfig"),r=await s({name:t,cwd:n,defaultConfig:{},checkEnv:!1,verbose:!1});if(!r?.path||!r.config||Object.keys(r.config).length===0)return null;let i=d.relative(n,r.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${e.green}[ts-css]${e.reset} Loaded config from ${i||r.path}`);return r.config}catch(t){if(t instanceof Error&&t.name==="ConfigNotFoundError")return null;return console.warn(`${e.yellow}[ts-css]${e.reset} Failed to load css config:`,t instanceof Error?t.message:t),null}}async function Pf(n){let t=null;try{let{loadStxConfig:s}=await import("./chunk-fpn5txnm.js"),r=await s(n);if(r.css)if(typeof r.css==="string"){let i=d.isAbsolute(r.css)?r.css:d.resolve(n,r.css);if(await Bun.file(i).exists()){let l=await import(i);t=l.default||l,console.log(`${e.green}[ts-css]${e.reset} Loaded config from stx.config.ts \u2192 ${r.css}`)}}else{if(t={...r.css,content:r.css.content||[],preflight:r.css.preflight??!0,minify:r.css.minify??!1},r.css.config){let i=d.isAbsolute(r.css.config)?r.css.config:d.resolve(n,r.css.config);if(await Bun.file(i).exists()){let l=await import(i);t={...l.default||l,...t}}}console.log(`${e.green}[ts-css]${e.reset} Using inline CSS config from stx.config.ts`)}}catch{}return t||await cc(n)}function If(n){try{let t=new WeakSet;return X(JSON.stringify(n??{},(s,r)=>{if(typeof r==="function")return`[fn]${String(r)}`;if(typeof r==="object"&&r!==null){if(t.has(r))return"[circular]";t.add(r)}return r})??"")}catch{return"unhashable"}}async function un(n){if(E)return A;E=!0;try{let t=await ac();if(!t||!t.build)return E=!1,"";if(!v)v=await cc(n);if(!v)return E=!1,"";let s=t.defaultConfig?.theme||{},r=v.theme||{},i={...t.defaultConfig,...v,theme:{...s,...r,extend:{...s.extend||{},...r.extend||{}}}},l=performance.now(),a=await t.build(i),g=performance.now()-l;if(A=a.css,console.log(`${e.cyan}[ts-css]${e.reset} Built ${a.classes.size} classes in ${g.toFixed(1)}ms`),i.output){let o=d.isAbsolute(i.output)?i.output:d.join(n,i.output),f=d.dirname(o);if(!F.existsSync(f))F.mkdirSync(f,{recursive:!0});await Bun.write(o,a.css)}return E=!1,a.css}catch(t){return console.error(`${e.red}[ts-css]${e.reset} Build error:`,t),E=!1,A}}async function ar(n){v=null,await un(n)}function Ph(){return A}function Of(n){let t=new Set,s=/class\s*=\s*["']([^"']+)["']/gi,r=s.exec(n);while(r!==null){for(let a of r[1].split(/\s+/))if(a.trim())t.add(a.trim());r=s.exec(n)}let i=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,l=i.exec(n);while(l!==null){let a=l[1].match(/'([^']+)'/g);if(a){for(let g of a)for(let o of g.slice(1,-1).split(/\s+/))if(o.trim())t.add(o.trim())}l=i.exec(n)}return t}var J=w(64);async function Nf(n,t){let s=()=>H.get(t?d.resolve(t):process.cwd())?.fingerprint??null,r=J.get(S(n,t,s()));if(r!==void 0)return r;let i=await Ne(n,t);if(i)J.set(S(n,t,s()),i);return i}function*Se(n){yield n;let t=new Set;for(let s of n.matchAll(/\/_stx\/modules\.([0-9a-f]{16})\.js/g)){let r=s[1];if(t.has(r))continue;t.add(r);let i=Yo(r);if(i)yield i}}function Ih(n){return[...Se(n)].join(`
|
|
7
7
|
`)}async function Ne(n,t){try{let s=await ac();if(!s)return"";let r=new Set;for(let u of Se(n)){let j=typeof s.extractClasses==="function"?s.extractClasses(u):Of(u);for(let Z of j)r.add(Z)}if(r.size===0)return"";let i=t?d.resolve(t):process.cwd(),l=c(i,"cache");if(!L)L=l;let a=H.get(i);if(!a){let u=await Pf(i);a={config:u,fingerprint:If(u)},H.set(i,a),Ce=a.fingerprint}let g=[...r].sort().join(" "),o=`${G}::${a.fingerprint||"default"}::${g}`,f=k.get(o);if(f!==void 0)return Q(o,f),f;let h=await Te(o,l);if(h!==null)return Q(o,h),h;let K=s.defaultConfig||s.config,R=a.config||{},m=de(K,R),{safelist:P,includePreflight:M,minify:D,tokenCSS:U}=m;if(m.unknownRoles.length>0&&!ye.has(i))ye.add(i),console.warn(`${e.yellow}[ts-css]${e.reset} No stx role for ${m.unknownRoles.join(", ")} - these keep the stock value. Role names: semanticTokenNames() in @stacksjs/stx/theme-tokens.`);let O=m.config,N=new s.CSSGenerator(O),T=O.shortcuts||R.shortcuts||{},I=Object.keys(T).filter((u)=>r.has(u)||P.includes(u));for(let u of P)if(!T[u])N.generate(u);for(let u of r)if(!T[u])N.generate(u);let y="";if(I.length>0){let u=new s.CSSGenerator(O);for(let j of I)u.generate(j);if(y=u.toCSS(!1,D),y&&!y.endsWith(`
|
|
8
8
|
`))y+=`
|
|
9
9
|
`}let C=y+N.toCSS(M,D);return C=le(s.CSSGenerator,m)+U+C,Q(o,C),je(o,C,l),C}catch(s){return console.warn("Failed to generate Css CSS:",s),""}}async function b(n,t,s=!1,r=!1){let i=await Nf(n,t);if(!i)return r?hn(n):n;let l=s?ue(i):void 0,a=l?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${l}.css">`:`<style data-css="generated">
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Se,bi,wi,lg,Dt,Jc,ug,Yc,Zh,Le,vn,je}from"./chunk-
|
|
2
|
+
import{Se,bi,wi,lg,Dt,Jc,ug,Yc,Zh,Le,vn,je}from"./chunk-vbw9jhz2.js";import{sl,s}from"./chunk-x4f7efgp.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{Se as BROWSER_CORE_IMPORTS,lg as STX_AUTO_IMPORTS,bi as extractAndStripCssImports,Le as extractBridgeData,sl as findInterpolationEnd,Yc as generateAutoImportDestructuring,Zh as generateBrowserAutoImportDestructuring,vn as generateServerDataBridge,Dt as injectBrowserCoreAutoImports,je as processClientScript,ug as referencesName,wi as renderVendorStyleTags,s as stripCommentsAndLiterals,Jc as transformAutoImports};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{cn,Io,Oo,No,Rh,Mo}from"./chunk-
|
|
2
|
+
import{cn,Io,Oo,No,Rh,Mo}from"./chunk-qzms4d8s.js";import"./chunk-4657mnht.js";import"./chunk-2j5yane9.js";import"./chunk-8370x30n.js";export{Oo as buildServerApi,Rh as createServerApi,cn as discoverServerApi,Io as generateApiTypes,Mo as isServerApiSource,No as productionApiDispatcher};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{q,Me}from"./chunk-
|
|
2
|
+
import{q,Me}from"./chunk-vbw9jhz2.js";var o=/\b(?:state|derived|effect|batch|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/;function u(t,e,r){let i={fullTag:r,content:e,attrs:t};if(/\bserver\b/.test(t))return{...i,type:"server"};if(/\bdata-stx-scoped\b/.test(t))return{...i,type:"client"};if(o.test(e))return{...i,type:"signals"};if(/\bclient\b/.test(t)||/\btype\s*=\s*["']module["']/.test(t)||/\bsrc\s*=/.test(t))return{...i,type:"client"};return{...i,type:"server"}}var S=/^<script\b([^>]*)>([\s\S]*)<\/script\s*>$/i;function tn(t){let e=[],r=[],i=[],c=0;while(c<t.length){let s=t.indexOf("<",c);if(s===-1)break;let p=Me(t,s);if(p>s){c=p;continue}let a=q(t,s);if(a>s){let f=t.slice(s,a),l=S.exec(f);if(l){let n=u(l[1],l[2],f);switch(n.type){case"signals":e.push(n);break;case"client":r.push(n);break;case"server":i.push(n);break}}c=a;continue}c=s+(t.startsWith("<!--",s)?4:1)}return{signals:e,client:r,server:i}}
|
|
3
3
|
export{tn};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{mr}from"./chunk-2j5yane9.js";import{Rr}from"./chunk-89d3h8mp.js";import{a}from"./chunk-
|
|
2
|
+
import{mr}from"./chunk-2j5yane9.js";import{Rr}from"./chunk-89d3h8mp.js";import{a}from"./chunk-chjdnmqv.js";import{B,Ze}from"./chunk-ybq56wam.js";import{gc}from"./chunk-6wrf6302.js";var p=/<style\b[^>]*>/iy,x=/<\/style>/gi,R=/<script\b[^>]*>/iy,b=/<template(?=[\s>/])[^>]*>/iy,S=/<\/template\s*>/iy;function lr(e){let r=0,t=0,s=-1;while(r<e.length){let n=e.indexOf("<",r);if(n===-1)return-1;if(e.startsWith("<!--",n)){let d=e.indexOf("-->",n+4);r=d===-1?e.length:d+3;continue}p.lastIndex=n;let c=p.exec(e);if(c){x.lastIndex=n+c[0].length;let d=x.exec(e);r=d===null?e.length:d.index+8;continue}b.lastIndex=n;let o=b.exec(e);if(o){if(t===0)s=n;t++,r=n+o[0].length;continue}S.lastIndex=n;let u=S.exec(e);if(u){if(t>0)t--;r=n+u[0].length;continue}if(R.lastIndex=n,R.test(e))return t>0?s:n;r=n+1}return-1}function G(e,r={}){return new mr(e,r).routes}import w from"path";var y=new Map;async function h(e,r){let t=e,s=r;if(!t||!s)try{let u=await a();t||=u?.pagesDir||"pages",s||=u?.root||"."}catch{t||="pages",s||="."}let n=w.isAbsolute(t)?t:w.join(s,t),c=y.get(n);if(c)return c;let o=[];try{o=G(".",{pagesDir:n,emit:!1}).map((u)=>u.regex.source).filter(Boolean)}catch{o=[]}return y.set(n,o),o}function O(e){return e.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function g(e){return O(JSON.stringify(e))}function we(e){return e.includes("data-stx-runtime")}function pc(e){let r=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let t=r.exec(e);t!==null;t=r.exec(e)){let s=e.slice(Math.max(0,t.index-80),t.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(s))continue;return!0}return!1}function l(e,r){let t=lr(e),s=e.search(/<!doctype\b/i);if(t!==-1&&(s===-1||t>s))return e.slice(0,t)+r+`
|
|
3
3
|
`+e.slice(t);let n=Rr(e);if(n!==null)return`${e.slice(0,n)}
|
|
4
4
|
${r}${e.slice(n)}`;if(e.includes("</head>")){let o=e.indexOf("</head>");return e.slice(0,o)+r+`
|
|
5
5
|
`+e.slice(o)}if(B(e))return Ze(e,(o)=>`${o}
|
|
6
6
|
${r}`);return`${r}
|
|
7
|
-
${e}`}async function ur(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-
|
|
7
|
+
${e}`}async function ur(e,r){if(e.includes("data-stx-runtime")||e.includes("window.stx.state")||e.includes("STX Signals Runtime"))return e;if(r.buildMode==="serve"){let{getServeClientAsset:n}=await import("./chunk-ywpan1k5.js"),{url:c}=await n("runtime",r.debug===!0);return l(e,`<script data-stx-runtime src="${c}"></script>`)}if(r.buildMode==="compile")return l(e,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:t}=await import("./chunk-ywpan1k5.js"),s=await t(r.debug);return l(e,`<script data-stx-scoped data-stx-runtime>${s}</script>`)}function m(e){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(e)}function fc(e){if(e.includes("data-stx-tooltip-runtime")||!m(e))return e;let r=`<script data-stx-scoped data-stx-tooltip-runtime>${gc()}</script>`,t=e.lastIndexOf("</body>");if(t===-1)return`${e}
|
|
8
8
|
${r}`;return`${e.slice(0,t)}${r}
|
|
9
|
-
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ve(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-
|
|
9
|
+
${e.slice(t)}`}var E=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function C(e){return E.test(e)||e.includes("__stxRouter)return")||e.includes("__stxRouter=true")}async function ve(e,r){if(!e.includes("</body>"))return e;if(C(e))return e;let t=r?.router,s="",n="";{let i={};if(t){if(t.container)i.container=t.container;if(t.interceptAllLinks!==void 0)i.interceptAllLinks=t.interceptAllLinks;if(t.progress!==void 0)i.progress=t.progress;if(t.viewTransitions!==void 0)i.viewTransitions=t.viewTransitions;if(t.viewTransitionDuration!==void 0)i.viewTransitionDuration=t.viewTransitionDuration;if(t.viewTransitionEasing!==void 0)i.viewTransitionEasing=t.viewTransitionEasing;if(t.scrollToTop!==void 0)i.scrollToTop=t.scrollToTop;if(t.scrollRestoration!==void 0)i.scrollRestoration=t.scrollRestoration;if(t.prefetch!==void 0)i.prefetch=t.prefetch;if(t.cache!==void 0)i.cache=t.cache;if(t.progressColor!==void 0)i.progressColor=t.progressColor;if(t.progressHeight!==void 0)i.progressHeight=t.progressHeight;if(t.prefetchVisible!==void 0)i.prefetchVisible=t.prefetchVisible;if(t.prefetchVisibleMax!==void 0)i.prefetchVisibleMax=t.prefetchVisibleMax;if(t.prefetchBudgetBytes!==void 0)i.prefetchBudgetBytes=t.prefetchBudgetBytes;if(t.keepOpening!==void 0)i.keepOpening=t.keepOpening}try{let f=await h(r?.pagesDir,r?.root);if(f.length>0)if(r?.buildMode==="serve"){let{registerServeModuleBundle:T}=await import("./chunk-ywpan1k5.js");n=`<script data-stx-owned-routes src="${T(`(window.__stxRouterConfig=window.__stxRouterConfig||{}).ownedRoutes=${g(f)};
|
|
10
10
|
`)}"></script>
|
|
11
11
|
`}else i.ownedRoutes=f}catch{}if(Object.keys(i).length>0)s=`<script>window.__stxRouterConfig=${g(i)};</script>
|
|
12
|
-
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-
|
|
12
|
+
`}let{getCachedRouterScript:c,getServeClientAsset:o}=await import("./chunk-ywpan1k5.js"),u=r?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':r?.buildMode==="serve"?`<script data-stx-router src="${(await o("router")).url}"></script>`:`<script data-stx-router>${await c()}</script>`,d=e.lastIndexOf("</body>");return e.slice(0,d)+s+n+u+`
|
|
13
13
|
</body>`+e.slice(d+7)}
|
|
14
14
|
export{lr,G,we,pc,ur,fc,ve};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{m,h,p}from"./chunk-
|
|
2
|
+
import{m,h,p}from"./chunk-vbw9jhz2.js";import{F}from"./chunk-chjdnmqv.js";import{i}from"./chunk-57x8wxdf.js";import k from"path";var q={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},T=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g;var M=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;function H(e){let t=[],o=0,n;M.lastIndex=0;while((n=M.exec(e))!==null){if(n.index>o){let a=e.slice(o,n.index);if(a.trim())t.push({type:t.length===0?"shell":"content",content:a})}let s=n[1],r=n[2];t.push({type:"suspense",name:s,content:r}),o=n.index+n[0].length}if(o<e.length){let s=e.slice(o);if(s.trim())t.push({type:t.length===0?"shell":"content",content:s})}if(t.length===0)t.push({type:"shell",content:e});return t}async function jm(e,t={},o={}){let n={...F,...o,streaming:{...q,...o.streaming}},s=n.streaming?.bufferSize||16384;return new ReadableStream({async start(r){try{let a=await Bun.file(e).text(),S=a.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),g=S?S[1]:"",c=a.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y={...t,__filename:e,__dirname:k.dirname(e)};if(g.trim())await m(g,y,e);let E=H(c),l=new Set;if(!E.some((w)=>w.type==="suspense")){let w=n.streaming?.strategy||"auto",x=new RegExp(T.source,"g");if(!(w!=="manual"&&x.test(c))){let u=await i(c,y,e,n,l);for(let b=0;b<u.length;b+=s)r.enqueue(u.slice(b,b+s)),await new Promise((f)=>setTimeout(f,0))}else{let u=[],b=new RegExp(T.source,"g"),f;while((f=b.exec(c))!==null)u.push({name:f[1],content:f[2],start:f.index,end:f.index+f[0].length});let v=0;for(let _ of u){if(_.start>v){let I=c.slice(v,_.start);if(I.trim()){let O=await i(I,y,e,n,l);r.enqueue(O),await new Promise((D)=>setTimeout(D,0))}}let C=await i(_.content,y,e,n,l);r.enqueue(C),await new Promise((I)=>setTimeout(I,0)),v=_.end}if(v<c.length){let _=c.slice(v);if(_.trim()){let C=await i(_,y,e,n,l);r.enqueue(C)}}}}else{let w=new Map;for(let d of E)if(d.type==="shell"||d.type==="content"){let u=await i(d.content,y,e,n,l);r.enqueue(u)}else if(d.type==="suspense"&&d.name){let u=`stx-suspense-${d.name}`;r.enqueue(`<div id="${u}" data-suspense="${d.name}" style="display:contents;">
|
|
3
3
|
<template data-suspense-fallback>Loading...</template>
|
|
4
4
|
</div>`),w.set(d.name,i(d.content,y,e,n,l))}r.enqueue(`
|
|
5
5
|
<script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{rr,Re}from"./chunk-4y6hes3h.js";import{V,w,vr,js,C}from"./chunk-xvhxxj4g.js";import{a,O}from"./chunk-p83h2dbg.js";import{Mo}from"./chunk-ksr6c2kh.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-z4g64re8.js";import{s,me}from"./chunk-x4f7efgp.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Mo(t,e,n)}var at=2;function kf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function _f(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=_f();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function Cf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Cf())console.log("[stx:bundler]",...t)}var K=[];function rc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function nn(){return K.slice()}function rn(){K.length=0}var Q;function Th(t){Q=t}function sc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function sn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var nr="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Ef(t,e){return p.relative(t,e).split(p.sep).join("/")}function Tf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(nr)?`${i}${l}${o}${l}`:n})}function $f(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(nr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(nr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function is(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function on(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,r,u)=>{if(X(r,t,b))return null;if(!d||!f(j)||!Bt.test(r))return null;try{if(!B.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(r);let E=`${nr}${Ef(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(j,r)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,r);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=it(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:r.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(r)=>{let u=p.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return A(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${nr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=p.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))l.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(r.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Rf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function an(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||kf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(js(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=vr(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await r.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=Rf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function oc(t){return`${t}-${process.pid}-${yt()}`}async function $h(t,e){let{projectRoot:n}=e,i=oc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let r=o.get(j.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=oc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=s(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;r.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)r.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let pt=r.size>0?`
|
|
2
|
+
import{rr,Re}from"./chunk-4y6hes3h.js";import{V,w,vr,js,C}from"./chunk-vbw9jhz2.js";import{a,O}from"./chunk-chjdnmqv.js";import{Mo}from"./chunk-qzms4d8s.js";import{rt}from"./chunk-car6nhfe.js";import{c}from"./chunk-z4g64re8.js";import{s,me}from"./chunk-x4f7efgp.js";import p from"path";import B from"fs";import{AsyncLocalStorage as xt}from"async_hooks";import{randomUUID as yt}from"crypto";var $t=11;function X(t,e,n){return/^(?:(?:stx|ui)\.config\.[cm]?[jt]s|runtime-config-(?:server|loader)\.[cm]?[jt]s)$/.test(p.basename(t))||Mo(t,e,n)}var at=2;function kf(t){let e=process.env.STX_BUNDLE_CACHE_DIR?.trim();return e?p.resolve(e):c(t,"bundle-cache")}function nt(t,e){let n=t;for(let i of wt(e))if(i!==p.sep)n=n.split(i).join("\x00root");return n}var st=new Map;function wt(t){let e=p.resolve(t),n=st.get(e);if(!n){let i=e;try{i=B.realpathSync(e)}catch{}n=[...new Set([e,i])].sort((l,d)=>d.length-l.length),st.set(e,n)}return n}function bt(t,e){try{let n=B.statSync(t),i=p.resolve(e),l=t.startsWith(`${i}${p.sep}`);return{path:l?p.relative(i,t):t,...l?{inRoot:!0}:{},mtimeMs:n.mtimeMs,size:n.size,hash:Bun.hash(B.readFileSync(t)).toString(36)}}catch{return null}}function ct(t,e){return t.inRoot?p.join(p.resolve(e),t.path):t.path}function St(t,e){for(let n of t){let i=ct(n,e);try{let l=B.statSync(i);if(l.size!==n.size)return!1;if(l.mtimeMs!==n.mtimeMs&&Bun.hash(B.readFileSync(i)).toString(36)!==n.hash)return!1}catch{return!1}}return!0}var lt=new Map,vt=100;function _f(t=process.env){let e=Number(t.STX_BUNDLE_CACHE_LIMIT);return Number.isFinite(e)&&e>=1?Math.floor(e):2000}var H=new Map;async function jt(t){let e=H.get(t)??0;if(e>0&&e<vt){H.set(t,e+1);return}H.set(t,1);try{let n=(await B.promises.readdir(t)).filter((o)=>o.endsWith(".js")),i=_f();if(n.length<=i)return;let d=(await Promise.all(n.map(async(o)=>{try{return{name:o,at:(await B.promises.stat(p.join(t,o))).mtimeMs}}catch{return null}}))).filter((o)=>o!==null);d.sort((o,b)=>b.at-o.at);for(let o of d.slice(i)){let b=o.name.slice(0,-3);await B.promises.rm(p.join(t,`${b}.js`),{force:!0}),await B.promises.rm(p.join(t,`${b}.deps.json`),{force:!0})}A("pruned bundle cache to",i,"entries")}catch{}}function ye(t){return lt.get(t)??[]}function Z(t,e){if(t)lt.set(t,e)}function Cf(t=process.env){return t.STX_DEBUG==="true"||t.STX_DEBUG==="1"}function A(...t){if(Cf())console.log("[stx:bundler]",...t)}var K=[];function rc(t,e,n){K.push({filePath:t||"<inline>",message:e,details:n})}function nn(){return K.slice()}function rn(){K.length=0}var Q;function Th(t){Q=t}function sc(){if(Q)return Q;try{let t=O.strict;return typeof t==="object"&&t!==null?t.bundlerFallback??"warn":"warn"}catch{return"warn"}}var Y=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function sn(t){let e=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,n;while((n=e.exec(t))!==null){let l=n[1];if(!Y.some((o)=>o.test(l)))return A("detected user import:",l),!0}let i=/^[ \t]*import[ \t]*['"]([^'"]+)['"]/gm;while((n=i.exec(t))!==null){let l=n[1];if(/\.css(?:\?.*)?$/.test(l))continue;if(!Y.some((o)=>o.test(l)))return A("detected side-effect import:",l),!0}return!1}var nr="stx-module:",Bt=/\.(?:[cm]?[jt]sx?|json)$/i;function Ef(t,e){return p.relative(t,e).split(p.sep).join("/")}function Tf(t,e){if(e.size===0)return t;return t.replace(/^([ \t]*import(?:(?:\s+|(?=[{*]))[^;"']*?\s*from\s*|\s*))(["'])([^"']+)\2/gm,(n,i,l,d)=>{let o=e.get(d);return o&&!d.startsWith(nr)?`${i}${l}${o}${l}`:n})}function $f(t,e){let n=0,i=(d)=>{let o=`__stxMod${n++}`,b=JSON.stringify(d);return e.push(`var ${o} = globalThis.__stxModules && globalThis.__stxModules[${b}];`,`if (${o} === undefined) throw new Error("[stx] module " + ${JSON.stringify(b)} + " is not registered on this page (#1957)");`),o},l=(d,o)=>{for(let b of d.split(",")){let I=b.trim();if(!I)continue;let M=I.match(/^("(?:[^"\\]|\\.)*"|[\w$]+)(?:\s+as\s+([\w$]+))?$/);if(!M)continue;let S=M[1].startsWith('"')?JSON.parse(M[1]):M[1],f=M[2]??S;e.push(`var ${f} = ${o}[${JSON.stringify(S)}];`)}};return t=t.replace(/^[ \t]*import(?:\s+|(?=[{*]))([^;"']+?)\s*from\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o,b)=>{let I=b.slice(nr.length),M=i(I),S=o.trim(),f=S.match(/^([\w$]+)\s*(?:,\s*|$)/);if(f&&!S.startsWith("{")&&!S.startsWith("*"))e.push(`var ${f[1]} = ${M}.default;`),S=S.slice(f[0].length).trim();let v=S.match(/^\*\s*as\s+([\w$]+)$/);if(v)e.push(`var ${v[1]} = ${M};`);else if(S.startsWith("{"))l(S.replace(/^\{|\}$/g,""),M);return""}),t=t.replace(/^[ \t]*import\s*["'](stx-module:[^"']+)["'];?[ \t]*$/gm,(d,o)=>(i(o.slice(nr.length)),"")),t}function it(t){let e=[t,`${t}.ts`,`${t}.tsx`,`${t}.js`,`${t}.mjs`,`${t}.jsx`,p.join(t,"index.ts"),p.join(t,"index.tsx"),p.join(t,"index.js"),p.join(t,"index.mjs")];for(let n of e)try{if(B.existsSync(n)&&B.statSync(n,{throwIfNoEntry:!1})?.isFile())return n}catch{}return}var G=new xt;function is(t,e){let n=new Bun.CryptoHasher("md5");for(let[i,l]of[...t].sort(([d],[o])=>d<o?-1:d>o?1:0))n.update(`${i}\x00${l}\x00`);return G.run({modules:t,key:n.digest("hex").slice(0,12)},e)}function on(){return G.getStore()?.key??""}function ut(t,e,n,i,l,d,o=new Map,b,I,M){let S=new Map([[n,i],...M??[]]),f=(j)=>j!==void 0&&S.has(j),v=(j,r,u)=>{if(X(r,t,b))return null;if(!d||!f(j)||!Bt.test(r))return null;try{if(!B.statSync(r,{throwIfNoEntry:!1})?.isFile())return null}catch{return null}l.add(r);let E=`${nr}${Ef(process.cwd(),r)}`;return o.set(u,E),{path:E,external:!0}},y=(j,r)=>{let u=f(j)?e:p.dirname(j),E=p.resolve(u,r);return it(E)??E};return{name:"stx-client-bundle",setup(j){if(j.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(r)=>({path:r.path,external:!0})),j.onResolve({filter:/^\//},(r)=>{if(f(r.path))return{path:r.path};let u=it(r.path);if(u){let E=v(r.importer,u,r.path);if(E)return E;if(!f(u))l.add(u);return{path:u}}return{path:r.path,external:!0}}),j.onResolve({filter:/^\.\.?\//},(r)=>{let u=y(r.importer,r.path),E=v(r.importer,u,r.path);if(E)return E;return l.add(u),{path:u}}),j.onResolve({filter:/^[@~]\//},(r)=>{let u=p.resolve(t,r.path.slice(2)),E=[u,`${u}.ts`,`${u}.tsx`,`${u}.js`,`${u}.mjs`,`${u}.jsx`,p.join(u,"index.ts"),p.join(u,"index.tsx"),p.join(u,"index.js"),p.join(u,"index.mjs")];for(let h of E)if(B.existsSync(h)&&B.statSync(h,{throwIfNoEntry:!1})?.isFile()){let D=v(r.importer,h,r.path);if(D)return D;return A(`resolved ${r.path[0]}/ import:`,r.path,"\u2192",h),l.add(h),{path:h}}return console.warn(`[stx:bundler] could not resolve ${r.path[0]}/ import:`,r.path),{path:u}}),d)j.onResolve({filter:/^(?!node:|bun:)(?:@[\w.-]+\/)?[\w.-]/},(r)=>{if(!f(r.importer))return;let u=`${nr}npm:${r.path}`;return o.set(r.path,u),{path:u,external:!0}});j.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(r)=>{if(S.has(r.path))return{contents:S.get(r.path),loader:"ts"};if(X(r.path,t,b))throw Error(`Server-only API source cannot be imported by a client script: ${r.path}`);let u=p.extname(r.path).toLowerCase(),E=u===".json"?"json":u===".tsx"?"tsx":u===".jsx"?"jsx":u===".ts"||u===".mts"||u===".cts"?"ts":"js";if(!f(r.path))l.add(r.path);let h=I?.get(r.path);if(h!==void 0)return{contents:h,loader:"js"};return{contents:B.readFileSync(r.path,"utf8"),loader:E}})}}}var q=new Map,P=w(64),ot=Symbol.for("stx.client-bundle-build-queue");function Rf(t){let e=globalThis,i=(e[ot]??Promise.resolve()).then(t,t);return e[ot]=i.then(()=>{return},()=>{return}),i}async function an(t,e,n={}){let i=n.projectRoot||process.cwd(),l=(await a(i)).serverApi,d=n.minify??!1,o=n.externalizeUserModules??!0,b=n.expose?.length?[...new Set(n.expose)].sort():void 0,I=n.cacheDir||kf(i),M=G.getStore(),S=new Bun.CryptoHasher("md5");S.update(`${$t}\x00${rt()}\x00${JSON.stringify(l??!1)}\x00${o?"registry":"inline"}\x00${b?b.join(","):"*"}\x00${d?"minified":"readable"}\x00${M?.key??""}\x00${nt(t,i)}\x00${nt(e,i)}`);let f=S.digest("hex").slice(0,12),v=p.join(I,`${f}.js`),y=P.get(v);if(y){if(js(y.files)&&y.files.every((h)=>!X(h.path,i,l))){A("memo hit:",f);let h=y.files.map((D)=>D.path);return Z(e,h),n.collectInputs?.push(...h),y.code}P.delete(v),A("memo invalidated by dep change:",f)}let j=p.join(I,`${f}.deps.json`),r=Bun.file(v);if(await r.exists()){let h=Bun.file(j),D=!1,k=null;if(await h.exists())try{let N=JSON.parse(await h.text());if(N.metadataVersion===at&&Array.isArray(N.files)&&St(N.files,i))k=vr(N.files.map((g)=>ct(g,i))),D=k.length===N.files.length&&!k.some((g)=>X(g.path,i,l))}catch{D=!1}if(D){if(A("cache hit:",f),k)Z(e,k.map((U)=>U.path)),n.collectInputs?.push(...k.map((U)=>U.path));let N=await r.text(),g=new Date;if(B.promises.utimes(v,g,g).catch(()=>{}),k)P.set(v,{code:N,files:k});return N}A("cache invalidated by dep change:",f)}let u=q.get(f);if(u){let h=await u;if(n.collectInputs)n.collectInputs.push(...(P.get(v)?.files??[]).map((D)=>D.path));return h}let E=Rf(()=>Et(t,e,{projectRoot:i,minify:d,cacheDir:I,hash:f,cachePath:v,depsPath:j,collectInputs:n.collectInputs,externalizeUserModules:o,serverApi:l,expose:b,throwOnFailure:n.throwOnFailure,substitutes:M?.modules}));q.set(f,E);try{return await E}finally{q.delete(f)}}function oc(t){return`${t}-${process.pid}-${yt()}`}async function $h(t,e){let{projectRoot:n}=e,i=oc(new Bun.CryptoHasher("md5").update([...t.keys()].join("\x00")).digest("hex").slice(0,12)),l=p.join(c(n,"bundle-tmp"),"out",i);B.mkdirSync(l,{recursive:!0});let d=new Map,o=new Map,b=0;for(let[f,v]of t){let y=p.join(n,`.stx-split-${i}-${b++}.ts`);d.set(y,v),o.set(p.basename(y).replace(/\.ts$/,""),f)}let[I,M]=[...d][0],S=new Set;try{let f=await Bun.build({entrypoints:[...d.keys()],outdir:l,target:"browser",format:"esm",splitting:!0,minify:!1,naming:{entry:"[name].js",chunk:"chunk-[hash].js"},plugins:[ut(n,p.dirname(e.filePath),I,M,S,!1,new Map,void 0,G.getStore()?.modules,d)],define:{"process.env.NODE_ENV":'"development"',...C()},root:n});if(!f.success)throw Error(f.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||"Unable to bundle the entries");let v={entries:new Map,chunks:new Map};for(let y of f.outputs){let j=p.basename(y.path);if(y.kind==="entry-point"){let r=o.get(j.replace(/\.js$/,""));if(r!==void 0)v.entries.set(r,await y.text())}else if(y.kind==="chunk")v.chunks.set(j.replace(/\.js$/,""),await y.text())}return e.collectInputs?.push(...S),v}finally{try{B.rmSync(l,{recursive:!0,force:!0})}catch{}}}async function Et(t,e,n){let{projectRoot:i,minify:l,cacheDir:d,hash:o,cachePath:b,depsPath:I,externalizeUserModules:M}=n,S=c(i,"bundle-tmp"),f=oc(o),v=p.join(i,`.stx-client-${f}.ts`),y=p.join(S,"out",f);B.mkdirSync(y,{recursive:!0});let j=p.dirname(e),r=new Set,u=/^[ \t]*(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,E=/^[ \t]*(export\s+)?(?:async\s+)?function\s+(\w+)/gm,h=s(t),{depths:D,balanced:k}=me(h),N=(R)=>!k||D[R]===0,g;while((g=u.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;if(g[2])g[2].split(",").forEach((R)=>{let m=_t(R);if(m)r.add(m)});else if(g[3])r.add(g[3])}while((g=E.exec(h))!==null){if(g[1])continue;if(!N(g.index))continue;r.add(g[2])}let U=/^[ \t]*import[ \t]+(?!type\b)(?:(\w+)\s*(?:,\s*)?)?(?:\*\s+as\s+(\w+)|\{([^}]+)\})?\s+from\b/gm;while((g=U.exec(h))!==null){if(!N(g.index))continue;let R=/^\s*['"]([^'"]+)['"]/.exec(t.slice(g.index+g[0].length))?.[1];if(R&&Y.some((m)=>m.test(R)))continue;if(g[1])r.add(g[1]);if(g[2])r.add(g[2]);for(let m of(g[3]??"").split(",")){let _=m.trim();if(!_||/^type\s/.test(_))continue;let L=/\bas\s+(\w+)\s*$/.exec(_)?.[1]??/^\w+$/.exec(_)?.[0];if(L)r.add(L)}}for(let R of h.matchAll(/\bexport\s*\{([^}]+)\}/g))for(let m of R[1].split(",")){let _=/\bas\s+(\w+)\s*$/.exec(m)?.[1]??/^\s*(\w+)\s*$/.exec(m)?.[1];if(_)r.delete(_)}let pt=r.size>0?`
|
|
3
3
|
export { ${[...r].join(", ")} }`:"";A("bundling:",o,"from:",p.basename(e));let tt=new Set,et=new Map;try{let R=await Bun.build({entrypoints:[v],outdir:y,target:"browser",format:"esm",minify:l?{whitespace:!1,identifiers:!0,syntax:!0}:!1,plugins:[ut(i,j,v,t+pt,tt,M,et,n.serverApi,n.substitutes)],define:{"process.env.NODE_ENV":l?'"production"':'"development"',...C()},root:i});if(!R.success){let F=R.logs.filter((T)=>T.level==="error").map((T)=>T.message).join(", ")||`Unable to bundle ${p.basename(e)}`,z=rr(R.logs,e||void 0);if(console.warn("[stx:bundler] build failed:",F),rc(e||"",F,z),n.throwOnFailure||sc()==="error")throw Error(F);return t}let m="";for(let x of R.outputs){m=await x.text();break}let _=[];for(let x of m.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let F of x[1].split(",")){let z=F.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(z){_.push([z[2],z[1]]);continue}let T=F.trim();if(/^[A-Za-z_$][\w$]*$/.test(T))_.push([T,T])}if(n.expose){let x=new Set(n.expose);for(let F=_.length-1;F>=0;F--)if(!x.has(_[F][0]))_.splice(F,1)}let L=[];m=$f(Tf(m,et),L);let dt=m.match(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm)||[];if(m=m.replace(/^\s*import(?:\s+|(?=["'{*]))[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),l&&m)try{m=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(m)}catch{}let J=`__stxBundle_${o}`,ft=new Set(V(t,!0).split(",").map((x)=>x.trim())),mt=_.map(([x,F])=>`get ${JSON.stringify(x)}() { return ${F} }${ft.has(x)?`, set ${JSON.stringify(x)}(__stxValue_${F}) { ${F} = __stxValue_${F} }`:""}`).join(", "),gt=_.map(([x])=>`var ${x} = undefined;`).join(`
|
|
4
4
|
`),ht=_.map(([x])=>`${x} = ${J}[${JSON.stringify(x)}];`).join(`
|
|
5
5
|
`);if(m=`${dt.join(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{zf,jh,Bh,Fh,zh,Hf,Vf,Hh,Vh,Yo,Uh,dr,pr,xs}from"./chunk-
|
|
2
|
+
import{zf,jh,Bh,Fh,zh,Hf,Vf,Hh,Vh,Yo,Uh,dr,pr,xs}from"./chunk-88rwr1w2.js";import{rt}from"./chunk-car6nhfe.js";import"./chunk-vbw9jhz2.js";import"./chunk-p65ax8s0.js";import"./chunk-8370x30n.js";import"./chunk-89d3h8mp.js";import"./chunk-zjqvbcwa.js";import"./chunk-23r3rby6.js";export{zh as __setSignalsGeneratorsForTest,rt as cacheEngineFingerprint,pr as cacheTemplate,dr as checkCache,Uh as clearDevCaches,Vf as getCachedRouterScript,Hf as getCachedSignalsRuntime,Hh as getServeClientAsset,Yo as getServeModuleBundle,xs as hashFilePath,Bh as invalidateFileCache,Fh as invalidateFileCacheByDir,jh as readFileCached,Vh as registerServeModuleBundle,zf as templateCache};
|