@stacksjs/stx 0.2.226 → 0.2.228

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.
Files changed (74) hide show
  1. package/dist/{chunk-gz7j5eer.js → chunk-061f3pf7.js} +274 -274
  2. package/dist/{chunk-dfmznp98.js → chunk-07pmn67t.js} +1 -1
  3. package/dist/{chunk-dpad3k7h.js → chunk-0r9xr2km.js} +1 -1
  4. package/dist/{chunk-c38dqdqt.js → chunk-0vzvd62b.js} +1 -1
  5. package/dist/{chunk-t213539b.js → chunk-1cs82015.js} +1 -1
  6. package/dist/{chunk-gpfg5kp2.js → chunk-25b3r6ff.js} +1 -1
  7. package/dist/{chunk-2e0sr1v8.js → chunk-2v51cp46.js} +2 -2
  8. package/dist/{chunk-7rkgc61n.js → chunk-2wvg84c0.js} +1 -1
  9. package/dist/{chunk-pgeds8b5.js → chunk-4p0bja56.js} +1 -1
  10. package/dist/{chunk-983n86r5.js → chunk-512qkvya.js} +2 -2
  11. package/dist/{chunk-n3ggrhb3.js → chunk-5d4csjhx.js} +1 -1
  12. package/dist/{chunk-ectezqxn.js → chunk-5mrs8cs2.js} +1 -1
  13. package/dist/{chunk-ytr18qnm.js → chunk-5ys0zfgp.js} +1 -1
  14. package/dist/{chunk-a0gt8bs5.js → chunk-62pema3f.js} +1 -1
  15. package/dist/{chunk-b0h9pk4g.js → chunk-65yw97a2.js} +1 -1
  16. package/dist/{chunk-0n4fvqm8.js → chunk-6pzgmp1h.js} +2 -2
  17. package/dist/{chunk-3hwdp8gg.js → chunk-6wrkkdve.js} +1 -1
  18. package/dist/{chunk-txkh4qz0.js → chunk-7jbfha4x.js} +1 -1
  19. package/dist/{chunk-0sn2mc3a.js → chunk-7xwjaqh9.js} +1 -1
  20. package/dist/{chunk-ds6jn0m1.js → chunk-800m4ehs.js} +1 -1
  21. package/dist/{chunk-wyy4ny3x.js → chunk-8n8ae329.js} +1 -1
  22. package/dist/{chunk-hg6ygmwr.js → chunk-8z29ty0t.js} +2 -2
  23. package/dist/{chunk-4tmw4kjm.js → chunk-9edt3qh6.js} +1 -1
  24. package/dist/{chunk-vsq2a4yp.js → chunk-9nnq8xrq.js} +2 -2
  25. package/dist/{chunk-x8panzma.js → chunk-b02x07dh.js} +1 -1
  26. package/dist/{chunk-w926t3ws.js → chunk-bd7v7g46.js} +2 -2
  27. package/dist/{chunk-87q97btf.js → chunk-c9v94scd.js} +1 -1
  28. package/dist/chunk-ccam7wfn.js +2 -0
  29. package/dist/{chunk-750c7q4b.js → chunk-cjk8zvjm.js} +1 -1
  30. package/dist/{chunk-hb10w602.js → chunk-cp834r9n.js} +8 -8
  31. package/dist/{chunk-j4v43wsq.js → chunk-d550gf3h.js} +1 -1
  32. package/dist/{chunk-hm4gvkhg.js → chunk-d62d38ss.js} +1 -1
  33. package/dist/{chunk-f5cw54q3.js → chunk-dxd830pt.js} +1 -1
  34. package/dist/chunk-e1eze8zn.js +2 -0
  35. package/dist/{chunk-vqxmxgaj.js → chunk-e6tvnnnz.js} +1 -1
  36. package/dist/{chunk-n05tp724.js → chunk-eakgdbd0.js} +1 -1
  37. package/dist/{chunk-y8nn1bgk.js → chunk-emgn7z93.js} +1 -1
  38. package/dist/{chunk-7yezgte8.js → chunk-f5z2jbtk.js} +1 -1
  39. package/dist/{chunk-tac7ch13.js → chunk-ft56brtb.js} +1 -1
  40. package/dist/{chunk-vpqdd4th.js → chunk-h0xfat7c.js} +1 -1
  41. package/dist/chunk-h23wts30.js +2 -0
  42. package/dist/{chunk-3er86x2f.js → chunk-h3a96ak4.js} +2 -2
  43. package/dist/{chunk-s6772ht7.js → chunk-h92r2rv6.js} +2 -2
  44. package/dist/{chunk-nx5qkm8k.js → chunk-jcped0kt.js} +1 -1
  45. package/dist/{chunk-wknxcvkg.js → chunk-jw0y7tx4.js} +1 -1
  46. package/dist/{chunk-2p22edns.js → chunk-knr1wfcd.js} +1 -1
  47. package/dist/{chunk-ps9pq4ya.js → chunk-ksfkskte.js} +1 -1
  48. package/dist/{chunk-21kvpnqq.js → chunk-m38wyaes.js} +1 -1
  49. package/dist/{chunk-5rynsy4e.js → chunk-m54yzzn8.js} +1 -1
  50. package/dist/{chunk-pmgc5m39.js → chunk-qtj8qrz6.js} +1 -1
  51. package/dist/{chunk-vyzat3rg.js → chunk-r3k599q0.js} +2 -2
  52. package/dist/{chunk-yfcb5zen.js → chunk-tfkwgjvm.js} +1 -1
  53. package/dist/{chunk-8wqmsq87.js → chunk-vg62v5bz.js} +2 -2
  54. package/dist/{chunk-5m9vyv2m.js → chunk-vr04z80c.js} +1 -1
  55. package/dist/{chunk-k99zfk6j.js → chunk-we3731c4.js} +2 -2
  56. package/dist/{chunk-j3g5vhfc.js → chunk-wmj84fj0.js} +1 -1
  57. package/dist/{chunk-ezpz476c.js → chunk-x3gv35ke.js} +1 -1
  58. package/dist/{chunk-qrpg15eb.js → chunk-xcac3tkq.js} +1 -1
  59. package/dist/{chunk-f4y91mnt.js → chunk-xfbc0xp4.js} +1 -1
  60. package/dist/{chunk-3jvad7mx.js → chunk-ydwg6e34.js} +1 -1
  61. package/dist/{chunk-d9bx2yse.js → chunk-ykss7ta8.js} +1 -1
  62. package/dist/{chunk-c0jt81gb.js → chunk-yq2j2tzb.js} +1 -1
  63. package/dist/{chunk-n3w7xxx7.js → chunk-z6e0b8wv.js} +1 -1
  64. package/dist/{chunk-p3h8z1zx.js → chunk-zdrpkrgc.js} +1 -1
  65. package/dist/{chunk-4jzzgnym.js → chunk-zpvva2dh.js} +2 -2
  66. package/dist/cli.js +10 -10
  67. package/dist/craft-entry.js +1 -1
  68. package/dist/craft.js +1 -1
  69. package/dist/pwa.js +1 -1
  70. package/dist/ssg.js +2 -2
  71. package/dist/utils.js +6 -1
  72. package/package.json +5 -5
  73. package/dist/chunk-jd68p7x1.js +0 -2
  74. package/dist/chunk-k7xpch16.js +0 -2
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$f as k,Rf as a,Sf as b,Tf as c,Uf as d,Vf as e,Wf as f,Xf as g,Yf as h,Zf as i,_f as j,ag as l,bg as m,cg as n,dg as o}from"./chunk-nx5qkm8k.js";import"./chunk-q891e1vj.js";export{k as writeNetlifyConfig,n as initNetlify,l as hasNetlifyConfig,g as getTotalSize,h as generateNetlifyToml,f as formatSize,e as filterRequiredFiles,i as detectProjectConfig,m as deploy,a as createNetlifyClient,d as createFileManifest,j as createDefaultNetlifyConfig,c as collectDeployFiles,b as calculateSha1,o as DeployError};
2
+ import{$e as e,Xe as a,Ye as b,Ze as c,_e as d,af as f,bf as g,cf as h,df as i,ef as j,ff as k,gf as l,hf as m,if as n,jf as o}from"./chunk-jcped0kt.js";import"./chunk-q891e1vj.js";export{k as writeNetlifyConfig,n as initNetlify,l as hasNetlifyConfig,g as getTotalSize,h as generateNetlifyToml,f as formatSize,e as filterRequiredFiles,i as detectProjectConfig,m as deploy,a as createNetlifyClient,d as createFileManifest,j as createDefaultNetlifyConfig,c as collectDeployFiles,b as calculateSha1,o as DeployError};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{th as a}from"./chunk-9edt3qh6.js";import"./chunk-q891e1vj.js";export{a as rewriteImagesWithSiblings};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$o as d,Yo as a,Zo as b,_o as c,ap as e,bp as f,cp as g,dp as h,ep as i,fp as j}from"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
2
+ import{$o as d,Yo as a,Zo as b,_o as c,ap as e,bp as f,cp as g,dp as h,ep as i,fp as j}from"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Hf as _$,If as G5}from"./chunk-hg6ygmwr.js";import{$g as b6,Vg as b7,Xg as U$,Yg as A6,_g as Q1,ah as $5,bh as B$,ch as L$,dh as y6,eh as v6}from"./chunk-k99zfk6j.js";import{Vi as Y$,Wi as J$}from"./chunk-d9bx2yse.js";import{Ej as u1,Fj as j1,Gj as O1,Hj as d$,Ij as u$,Jj as m5,Lj as p5}from"./chunk-k6b7gpk2.js";import{wk as v5,xk as g5}from"./chunk-n58aem37.js";import{Dk as c7,Ek as l7}from"./chunk-c0n802j1.js";import{gl as X1}from"./chunk-ncvd7673.js";import{$r as M0,Bq as O0,Gm as x6,Km as X5,Lr as G$,Mp as v7,Nm as N1,Om as M1,Pq as X6,Qq as E1,Tp as k6,Uo as Z$,Up as S6,Uq as m0,Yl as P7,Yr as E$,Zm as c1,_l as $6,_r as H1,an as B6,ap as j0,ds as V0,in as r$,ip as u0,jq as e$,kn as s$,lq as P6,mq as F6,nn as l1,om as d0,rn as n$,un as Q$,vn as L6,ym as a$}from"./chunk-gz7j5eer.js";import{Js as B,Rs as W$,Ss as K$,Ws as o}from"./chunk-ezpz476c.js";import{gt as S0}from"./chunk-t0jzk81v.js";import{Qt as t$,Rt as O6,Vt as M6,Wt as V6,ju as E6,ku as I6,lu as R6,mu as D6,nu as w6,ou as T6,qu as C6,uu as H6}from"./chunk-bqdbf8k2.js";import{Eu as p}from"./chunk-q891e1vj.js";var c5={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function t7($,X,Q={}){let{storage:Z="local",serializer:Y=c5,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Q,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Z==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let H=L.getItem($);if(H===null)return X;let A=Y.read(H);if(J&&typeof X==="object"&&X!==null)return{...X,...A};return A}catch{return X}},z=(L)=>{let H=_();if(!H)return;try{if(L===null||L===void 0)H.removeItem($);else H.setItem($,Y.write(L))}catch(A){console.warn(`[useStorage] Failed to write key "${$}":`,A)}},F=U(),O=(L,H)=>{for(let A of W)try{A(L,H)}catch(q){console.error("[useStorage] Subscriber error:",q)}};if(K&&G){let L=(A)=>{if(A.key===$&&A.storageArea===_()){let q=F;try{F=A.newValue?Y.read(A.newValue):X}catch(M){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,M);return}O(F,q)}};window.addEventListener("storage",L);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",L))}let j={get value(){return F},set value(L){let H=F;F=L,z(L),O(L,H)},get:()=>F,set:(L)=>{j.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let H=F;F=X,O(X,H)}},subscribe:(L)=>{return W.add(L),L(F,void 0),()=>W.delete(L)}};return j}function l5($,X,Q,Z,Y={}){let{serializer:J=c5,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(O)=>{if(O===null||O===void 0)return Z;try{let j=J.read(O);if(G&&typeof Z==="object"&&Z!==null)return{...Z,...j};return j}catch(j){return console.warn(`[${X}] Failed to read key "${Q}":`,j),Z}},F=m5((()=>{let O=_();if(!O)return Z;try{return U(O.getItem(Q))}catch(j){return console.warn(`[${X}] Cannot read "${Q}":`,j),Z}})());if(p5(()=>{let O=F(),j=_();if(!j)return;try{if(O===null||O===void 0)j.removeItem(Q);else j.setItem(Q,J.write(O))}catch(L){console.warn(`[${X}] Cannot persist "${Q}":`,L)}}),K&&W){let O=(L)=>{if(L.key!==Q)return;if(L.storageArea&&L.storageArea!==_())return;F.set(U(L.newValue))};window.addEventListener("storage",O);let j=globalThis.onDestroy;if(typeof j==="function")j(()=>window.removeEventListener("storage",O))}return F}function e7($,X,Q){return l5("local","useLocalStorage",$,X,Q)}function $3($,X,Q){return l5("session","useSessionStorage",$,X,Q)}function X3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function Q3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function Z3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Q=0;for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))Q+=(Z.length+(X.getItem(Z)?.length||0))*2;return Q}var l=null;function d1($,X,Q=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Q.has($))return!0;if(Q.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!d1($[J],X[J],Q))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!d1(G,X.get(J),Q))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Z=Object.keys($),Y=Object.keys(X);if(Z.length!==Y.length)return!1;for(let J of Z){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!d1($[J],X[J],Q))return!1}return!0}function WJ($){l=$}function KJ(){return l}function _J(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:Y3()}}function Y3(){return{refs:new Map,effects:new Set,cleanups:[]}}function UJ($){let X=new Set,Q=new Set,Z=$,Y=Symbol("ref"),J={get value(){let G=u1();if(G)Q.add(G);return Z},set value(G){if(!Object.is(G,Z)){let W=Z;Z=G;for(let K of X)K(G,W);for(let K of Q)if(d$())u$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(l)l.scope.refs.set(Y,J);return J}var i5=new WeakMap;function J3($){let X=i5.get($);if(X)return X;let Q=new Map,Z=(G)=>{let W=Q.get(G);if(!W)return;for(let K of[...W])if(d$())u$(K);else K()},Y=(G,W)=>{if(!Q.has(G))Q.set(G,new Set);return Q.get(G).add(W),()=>{Q.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=u1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let z=Object.getPrototypeOf(_);if(z===Object.prototype||z===null)return J3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),z=Reflect.set(G,W,K,_);if(!Object.is(K,U))Z(W);return z},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Z(W),K}});return i5.set($,J),J}function BJ($){let X,Q=!0,Z=new Set,Y=new Set,J=()=>{Q=!0,G()},G=()=>{if(Q){let K=X,_=j1(J);if(X=$(),O1(_),Q=!1,!Object.is(X,K)){for(let U of Z)U(X,K);for(let U of Y)U()}}},W=j1(J);return X=$(),Q=!1,O1(W),{get value(){let K=u1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Z.add(K),()=>{Z.delete(K)}}}}function G3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function LJ($,X,Q={}){let{immediate:Z=!1,deep:Y=!1,flush:J="post"}=Q,G,W,K=!1,_=()=>{if(K)return;let j=O();if((Y?!d1(j,G):!Object.is(j,G))||Z)if(X(j,G),Y&&j!==null&&typeof j==="object")try{G=structuredClone(j)}catch{G=j}else G=j},U=(j)=>{if(J==="sync")j();else if(J==="pre")Promise.resolve().then(j);else G3(j)},z=!1,F=()=>{if(K||z)return;z=!0,U(()=>{z=!1,_()})},O=()=>{if(typeof $==="function"){let j=j1(F);try{return $()}finally{O1(j)}}return $.value};if(typeof $!=="function"){let j=$.subscribe(()=>{U(_)});W=()=>{K=!0,j()}}else W=()=>{K=!0};if(G=O(),Z)U(_);if(l)l.scope.cleanups.push(()=>W?.());return()=>W?.()}function FJ($,X,Q={}){let Z=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Z.push(G)}if(Q.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Z)J()}}function zJ($){let X,Q=!1,Z=()=>{if(Q)return;if(X)X();let Y=j1(Z);X=$(),O1(Y)};if(Z(),l)l.scope.cleanups.push(()=>{if(Q=!0,X)X()});return()=>{if(Q=!0,X)X()}}function jJ($){if(l)l.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function OJ($){if(l)l.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function HJ($){if(l)l.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function AJ($){if(l)l.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function qJ($){if(l)l.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function NJ($){if(l)l.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function s0($,X){let Q=$.hooks[X];for(let Z of Q)await Z()}async function MJ($){await s0($,"beforeMount"),$.isMounted=!0,await s0($,"mounted")}async function VJ($){if(!$.isMounted||$.isUnmounted)return;await s0($,"beforeUpdate"),await s0($,"updated")}async function EJ($){if($.isUnmounted)return;await s0($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await s0($,"unmounted")}function IJ(){return`
2
+ import{lg as _$,mg as G5}from"./chunk-8z29ty0t.js";import{Bg as Q1,Cg as b6,Dg as $5,Eg as B$,Fg as L$,Gg as y6,Hg as v6,wg as b7,yg as U$,zg as A6}from"./chunk-we3731c4.js";import{Vi as Y$,Wi as J$}from"./chunk-ykss7ta8.js";import{Ej as u1,Fj as j1,Gj as O1,Hj as d$,Ij as u$,Jj as m5,Lj as p5}from"./chunk-k6b7gpk2.js";import{wk as v5,xk as g5}from"./chunk-n58aem37.js";import{Dk as c7,Ek as l7}from"./chunk-c0n802j1.js";import{gl as X1}from"./chunk-ncvd7673.js";import{$r as M0,Bq as O0,Gm as x6,Km as X5,Lr as G$,Mp as v7,Nm as N1,Om as M1,Pq as X6,Qq as E1,Tp as k6,Uo as Z$,Up as S6,Uq as m0,Yl as P7,Yr as E$,Zm as c1,_l as $6,_r as H1,an as B6,ap as j0,ds as V0,in as r$,ip as u0,jq as e$,kn as s$,lq as P6,mq as F6,nn as l1,om as d0,rn as n$,un as Q$,vn as L6,ym as a$}from"./chunk-061f3pf7.js";import{Js as B,Rs as W$,Ss as K$,Ws as o}from"./chunk-x3gv35ke.js";import{gt as S0}from"./chunk-t0jzk81v.js";import{Qt as t$,Rt as O6,Vt as M6,Wt as V6,ju as E6,ku as I6,lu as R6,mu as D6,nu as w6,ou as T6,qu as C6,uu as H6}from"./chunk-bqdbf8k2.js";import{Eu as p}from"./chunk-q891e1vj.js";var c5={read:($)=>{try{return JSON.parse($)}catch{return $}},write:($)=>{return JSON.stringify($)}};function t7($,X,Q={}){let{storage:Z="local",serializer:Y=c5,mergeDefaults:J=!1,listenToStorageChanges:G=!0}=Q,W=new Set,K=typeof window<"u",_=()=>{if(!K)return null;return Z==="session"?sessionStorage:localStorage},U=()=>{let L=_();if(!L)return X;try{let H=L.getItem($);if(H===null)return X;let A=Y.read(H);if(J&&typeof X==="object"&&X!==null)return{...X,...A};return A}catch{return X}},z=(L)=>{let H=_();if(!H)return;try{if(L===null||L===void 0)H.removeItem($);else H.setItem($,Y.write(L))}catch(A){console.warn(`[useStorage] Failed to write key "${$}":`,A)}},F=U(),O=(L,H)=>{for(let A of W)try{A(L,H)}catch(q){console.error("[useStorage] Subscriber error:",q)}};if(K&&G){let L=(A)=>{if(A.key===$&&A.storageArea===_()){let q=F;try{F=A.newValue?Y.read(A.newValue):X}catch(M){console.warn(`[useStorage] Failed to read key "${$}" from a cross-tab update:`,M);return}O(F,q)}};window.addEventListener("storage",L);let H=globalThis.onDestroy;if(typeof H==="function")H(()=>window.removeEventListener("storage",L))}let j={get value(){return F},set value(L){let H=F;F=L,z(L),O(L,H)},get:()=>F,set:(L)=>{j.value=L},remove:()=>{let L=_();if(L){L.removeItem($);let H=F;F=X,O(X,H)}},subscribe:(L)=>{return W.add(L),L(F,void 0),()=>W.delete(L)}};return j}function l5($,X,Q,Z,Y={}){let{serializer:J=c5,mergeDefaults:G=!1,listenToStorageChanges:W=!0}=Y,K=typeof window<"u",_=()=>{if(!K)return null;return $==="session"?sessionStorage:localStorage},U=(O)=>{if(O===null||O===void 0)return Z;try{let j=J.read(O);if(G&&typeof Z==="object"&&Z!==null)return{...Z,...j};return j}catch(j){return console.warn(`[${X}] Failed to read key "${Q}":`,j),Z}},F=m5((()=>{let O=_();if(!O)return Z;try{return U(O.getItem(Q))}catch(j){return console.warn(`[${X}] Cannot read "${Q}":`,j),Z}})());if(p5(()=>{let O=F(),j=_();if(!j)return;try{if(O===null||O===void 0)j.removeItem(Q);else j.setItem(Q,J.write(O))}catch(L){console.warn(`[${X}] Cannot persist "${Q}":`,L)}}),K&&W){let O=(L)=>{if(L.key!==Q)return;if(L.storageArea&&L.storageArea!==_())return;F.set(U(L.newValue))};window.addEventListener("storage",O);let j=globalThis.onDestroy;if(typeof j==="function")j(()=>window.removeEventListener("storage",O))}return F}function e7($,X,Q){return l5("local","useLocalStorage",$,X,Q)}function $3($,X,Q){return l5("session","useSessionStorage",$,X,Q)}function X3($="local"){if(typeof window>"u")return;($==="session"?sessionStorage:localStorage).clear()}function Q3($="local"){if(typeof window>"u")return[];let X=$==="session"?sessionStorage:localStorage;return Object.keys(X)}function Z3($="local"){if(typeof window>"u")return 0;let X=$==="session"?sessionStorage:localStorage,Q=0;for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))Q+=(Z.length+(X.getItem(Z)?.length||0))*2;return Q}var l=null;function d1($,X,Q=new WeakSet){if(Object.is($,X))return!0;if(typeof $!=="object"||typeof X!=="object"||$===null||X===null)return!1;if(Q.has($))return!0;if(Q.add($),$ instanceof Date&&X instanceof Date)return $.getTime()===X.getTime();if($ instanceof RegExp&&X instanceof RegExp)return $.source===X.source&&$.flags===X.flags;if(Array.isArray($)){if(!Array.isArray(X)||$.length!==X.length)return!1;for(let J=0;J<$.length;J++)if(!d1($[J],X[J],Q))return!1;return!0}if(Array.isArray(X))return!1;if($ instanceof Map){if(!(X instanceof Map)||$.size!==X.size)return!1;for(let[J,G]of $)if(!X.has(J)||!d1(G,X.get(J),Q))return!1;return!0}if(X instanceof Map)return!1;if($ instanceof Set){if(!(X instanceof Set)||$.size!==X.size)return!1;for(let J of $)if(!X.has(J))return!1;return!0}if(X instanceof Set)return!1;let Z=Object.keys($),Y=Object.keys(X);if(Z.length!==Y.length)return!1;for(let J of Z){if(!Object.prototype.hasOwnProperty.call(X,J))return!1;if(!d1($[J],X[J],Q))return!1}return!0}function WJ($){l=$}function KJ(){return l}function _J(){return{isMounted:!1,isUnmounted:!1,hooks:{beforeMount:[],mounted:[],beforeUpdate:[],updated:[],beforeUnmount:[],unmounted:[]},effects:[],scope:Y3()}}function Y3(){return{refs:new Map,effects:new Set,cleanups:[]}}function UJ($){let X=new Set,Q=new Set,Z=$,Y=Symbol("ref"),J={get value(){let G=u1();if(G)Q.add(G);return Z},set value(G){if(!Object.is(G,Z)){let W=Z;Z=G;for(let K of X)K(G,W);for(let K of Q)if(d$())u$(K);else K()}},subscribe(G){return X.add(G),()=>{X.delete(G)}}};if(l)l.scope.refs.set(Y,J);return J}var i5=new WeakMap;function J3($){let X=i5.get($);if(X)return X;let Q=new Map,Z=(G)=>{let W=Q.get(G);if(!W)return;for(let K of[...W])if(d$())u$(K);else K()},Y=(G,W)=>{if(!Q.has(G))Q.set(G,new Set);return Q.get(G).add(W),()=>{Q.get(G)?.delete(W)}},J=new Proxy($,{get(G,W,K){let _=Reflect.get(G,W,K),U=u1();if(U)Y(W,U);if(_!==null&&typeof _==="object"&&!Array.isArray(_)){let z=Object.getPrototypeOf(_);if(z===Object.prototype||z===null)return J3(_)}return _},set(G,W,K,_){let U=Reflect.get(G,W,_),z=Reflect.set(G,W,K,_);if(!Object.is(K,U))Z(W);return z},deleteProperty(G,W){let K=Reflect.deleteProperty(G,W);return Z(W),K}});return i5.set($,J),J}function BJ($){let X,Q=!0,Z=new Set,Y=new Set,J=()=>{Q=!0,G()},G=()=>{if(Q){let K=X,_=j1(J);if(X=$(),O1(_),Q=!1,!Object.is(X,K)){for(let U of Z)U(X,K);for(let U of Y)U()}}},W=j1(J);return X=$(),Q=!1,O1(W),{get value(){let K=u1();if(K)Y.add(K);return G(),X},set value(K){console.warn("[stx] Computed properties are readonly")},subscribe(K){return Z.add(K),()=>{Z.delete(K)}}}}function G3($){if(typeof requestAnimationFrame==="function"){requestAnimationFrame(()=>{requestAnimationFrame($)});return}setTimeout($,0)}function LJ($,X,Q={}){let{immediate:Z=!1,deep:Y=!1,flush:J="post"}=Q,G,W,K=!1,_=()=>{if(K)return;let j=O();if((Y?!d1(j,G):!Object.is(j,G))||Z)if(X(j,G),Y&&j!==null&&typeof j==="object")try{G=structuredClone(j)}catch{G=j}else G=j},U=(j)=>{if(J==="sync")j();else if(J==="pre")Promise.resolve().then(j);else G3(j)},z=!1,F=()=>{if(K||z)return;z=!0,U(()=>{z=!1,_()})},O=()=>{if(typeof $==="function"){let j=j1(F);try{return $()}finally{O1(j)}}return $.value};if(typeof $!=="function"){let j=$.subscribe(()=>{U(_)});W=()=>{K=!0,j()}}else W=()=>{K=!0};if(G=O(),Z)U(_);if(l)l.scope.cleanups.push(()=>W?.());return()=>W?.()}function FJ($,X,Q={}){let Z=[],Y=$.map((J)=>J.value);for(let J of $){let G=J.subscribe(()=>{let W=$.map((K)=>K.value);X(W,Y),Y=[...W]});Z.push(G)}if(Q.immediate){let J=$.map((G)=>G.value);X(J,Y)}return()=>{for(let J of Z)J()}}function zJ($){let X,Q=!1,Z=()=>{if(Q)return;if(X)X();let Y=j1(Z);X=$(),O1(Y)};if(Z(),l)l.scope.cleanups.push(()=>{if(Q=!0,X)X()});return()=>{if(Q=!0,X)X()}}function jJ($){if(l)l.hooks.beforeMount.push($);else console.warn("[stx] onBeforeMount called outside of component setup")}function OJ($){if(l)l.hooks.mounted.push($);else console.warn("[stx] onMounted called outside of component setup")}function HJ($){if(l)l.hooks.beforeUpdate.push($);else console.warn("[stx] onBeforeUpdate called outside of component setup")}function AJ($){if(l)l.hooks.updated.push($);else console.warn("[stx] onUpdated called outside of component setup")}function qJ($){if(l)l.hooks.beforeUnmount.push($);else console.warn("[stx] onBeforeUnmount called outside of component setup")}function NJ($){if(l)l.hooks.unmounted.push($);else console.warn("[stx] onUnmounted called outside of component setup")}async function s0($,X){let Q=$.hooks[X];for(let Z of Q)await Z()}async function MJ($){await s0($,"beforeMount"),$.isMounted=!0,await s0($,"mounted")}async function VJ($){if(!$.isMounted||$.isUnmounted)return;await s0($,"beforeUpdate"),await s0($,"updated")}async function EJ($){if($.isUnmounted)return;await s0($,"beforeUnmount");for(let X of $.scope.cleanups)X();$.isUnmounted=!0,await s0($,"unmounted")}function IJ(){return`
3
3
  <script data-stx-client-runtime>
4
4
  (function() {
5
5
  'use strict';
@@ -1057,7 +1057,7 @@ else {
1057
1057
  };
1058
1058
  })();
1059
1059
  </script>
1060
- `}function D0($,X,Q={}){let Z=F4(X,Q),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Z}</html>`);return $+Z}function t1($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function e1($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Z)=>X.endsWith(Z))}function $$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Q)=>Q.test($))}var e0=null;function X$($){if(!e0)e0=new U6($);return e0}function A1(){if(e0)e0.stop(),e0=null}import q1 from"path";var $1={name:"bun-plugin-stx",async setup($){let Q={...await H1(),...$.config?.stx},Z=new Set,Y=Q.webComponents?.enabled?`./${q1.relative(q1.dirname($.config?.outdir||"dist"),Q.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Q.webComponents?.enabled)try{let G=await G$(Q,Z);if(J.push(...G),Q.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Q.cache&&Q.cachePath){let L=await Y$(G,Q);if(L){if(Q.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await n$(()=>Bun.file(G).text(),"",(L)=>{throw new s$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new s$(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:z}=a$.time("script-extraction",()=>{let L=K,H=Z$(K);if(H)L=H.content.trim();let A=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],q="",M=[];for(let N of A){let R=N.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",w=N.match(/<script\b([^>]*)>/i),C=w?w[1]:"";if(/\bserver\b/i.test(C))q=R;else M.push(N)}let V=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:q,templateContent:V,allScripts:M}}),F={__filename:G,__dirname:q1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await n$(()=>j0(_,F,G),void 0,(L)=>{let H=new r$(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(Q$.log(H,{filePath:G,scriptContent:_}),Q.debug)throw H});let j=await a$.timeAsync("directive-processing",async()=>{return await O0(U,F,G,Q,W)});if(z.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-tac7ch13.js"),H=L(z.join(`
1060
+ `}function D0($,X,Q={}){let Z=F4(X,Q),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);if($.includes("</html>"))return $.replace("</html>",`${Z}</html>`);return $+Z}function t1($){let X=$.toLowerCase();return X.endsWith(".css")||X.endsWith(".scss")||X.endsWith(".sass")||X.endsWith(".less")}function e1($){let X=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((Z)=>X.endsWith(Z))}function $$($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Q)=>Q.test($))}var e0=null;function X$($){if(!e0)e0=new U6($);return e0}function A1(){if(e0)e0.stop(),e0=null}import q1 from"path";var $1={name:"bun-plugin-stx",async setup($){let Q={...await H1(),...$.config?.stx},Z=new Set,Y=Q.webComponents?.enabled?`./${q1.relative(q1.dirname($.config?.outdir||"dist"),Q.webComponents.outputDir||"dist/web-components")}`:"/web-components",J=[];if(Q.webComponents?.enabled)try{let G=await G$(Q,Z);if(J.push(...G),Q.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let W=new Set;if(Q.cache&&Q.cachePath){let L=await Y$(G,Q);if(L){if(Q.debug)console.log(`Using cached version of ${G}`);return{contents:L,loader:"html"}}}let K=await n$(()=>Bun.file(G).text(),"",(L)=>{throw new s$(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${L.message}`)});if(!K)throw new s$(`stx file is empty: ${G}`,G);let{scriptContent:_,templateContent:U,allScripts:z}=a$.time("script-extraction",()=>{let L=K,H=Z$(K);if(H)L=H.content.trim();let A=K.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],q="",M=[];for(let N of A){let R=N.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",w=N.match(/<script\b([^>]*)>/i),C=w?w[1]:"";if(/\bserver\b/i.test(C))q=R;else M.push(N)}let V=L.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:q,templateContent:V,allScripts:M}}),F={__filename:G,__dirname:q1.dirname(G),__stx:{webComponentsPath:Y,builtComponents:J}};await n$(()=>j0(_,F,G),void 0,(L)=>{let H=new r$(`Script execution failed in ${G}: ${L.message}`,G,void 0,void 0,_.substring(0,100));if(Q$.log(H,{filePath:G,scriptContent:_}),Q.debug)throw H});let j=await a$.timeAsync("directive-processing",async()=>{return await O0(U,F,G,Q,W)});if(z.length>0){let{interpolateScriptsInTemplate:L}=await import("./chunk-ft56brtb.js"),H=L(z.join(`
1061
1061
  `),F),A=j.search(/<\/body>/i);if(A!==-1)j=j.slice(0,A)+H+`
1062
1062
  `+j.slice(A);else j+=`
1063
1063
  ${H}`}if(j=await F6(j),W.forEach((L)=>Z.add(L)),Q.cache&&Q.cachePath){if(await J$(G,j,W,Q),Q.debug)console.log(`Cached template ${G} with ${W.size} dependencies`)}return{contents:j,loader:"html"}}catch(W){let K=W instanceof Error?W:new r$(`Plugin processing failed: ${String(W)}`,G);if(Q$.log(K,{filePath:G,buildConfig:$.config}),L6.logDetailedError(K,{filePath:G,plugin:"bun-plugin-stx"}),Q.debug)console.error("stx Plugin Error:",K);let _=K,U=_.line||null,z=_.context||null;return{contents:Q.debug||B6()?`<!DOCTYPE html>
@@ -1120,7 +1120,7 @@ ${H}`}if(j=await F6(j),W.forEach((L)=>Z.add(L)),Q.cache&&Q.cachePath){if(await J
1120
1120
  <h1>Something went wrong</h1>
1121
1121
  <p>An internal error occurred. Please try again later.</p>
1122
1122
  </body>
1123
- </html>`,loader:"html"}}})}};async function j4($,X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=Z0.resolve($);if(!H0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return i$(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=S0(process.cwd(),"output");H0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let q={name:"public-assets",setup(R){R.onResolve({filter:/^\/(images|fonts|assets|public)\//},(w)=>{return{path:w.path,external:!0}})}},M=await Bun.build({entrypoints:[W],outdir:K,plugins:[q,$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!M.success)return console.error(`${B.red}Build failed:${B.reset}`,M.logs),!1;let V=M.outputs.find((R)=>R.path.endsWith(".html"));if(!V)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(V.path).text(),!0}catch(q){return console.error(`${B.red}Error building stx file:${B.reset}`,q),!1}};if(!await U())return!1;let F=Z0.dirname(W);await W$(F);let O=Q;try{if(O=await x0(Q),O!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${O} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let q=X.hmrPort||O+1;J=X$({wsPort:q,verbose:!1}),G=J.start(q)}let j={},L=null;try{let{loadStxConfig:q}=await import("./chunk-3hwdp8gg.js"),M=await q();if(M?.apiRouter)L=M?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(M?.apiRoutes){j=M.apiRoutes;let V=Object.keys(j).length;if(V>0)console.log(`${B.blue}Loaded ${B.bright}${V} API route${V>1?"s":""}${B.reset}`)}if(M?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:N}=await import("./chunk-ectezqxn.js"),R=M.broadcasting;await V(R);let w=R.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w}/ws${B.reset}`);let C=Z0.join(process.cwd(),"channels.ts");if(H0.existsSync(C))try{let I=await N(C);console.log(`${B.blue}Loaded ${B.bright}${I} broadcast channel${I!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(I){console.warn(`${B.yellow}Failed to load channels.ts: ${I.message}${B.reset}`)}}catch(V){console.warn(`${B.yellow}Broadcasting failed to start: ${V.message}${B.reset}`)}}catch{}if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${O}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let H=z4({port:O,async fetch(q){return _$(q,await(async()=>{let M=new URL(q.url);if(L)try{let C=await L.handleRequest(q);if(C.status!==404)return C}catch{}if(j[M.pathname])try{return await j[M.pathname](q)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(M.pathname==="/")return(async()=>{let I=await o(_||"");if(Y)I=D0(I,G);if(X.native)if(I.includes("<head>"))I=I.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else I="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+I;if(X.titlebarHidden)if(I.includes("<head>"))I=I.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else I=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${I}`;return I})().then((I)=>new Response(I,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let V=Z0.join(K,M.pathname);if(H0.existsSync(V)&&H0.statSync(V).isFile()){let C=Bun.file(V),I=Z0.extname(V).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let N=Z0.dirname(W),R=Z0.join(N,M.pathname);if(H0.existsSync(R)&&H0.statSync(R).isFile()){let C=Bun.file(R),I=Z0.extname(R).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let w=Z0.join(process.cwd(),"public",M.pathname);if(H0.existsSync(w)&&H0.statSync(w).isFile()){let C=Bun.file(w),I=Z0.extname(w).toLowerCase(),E="application/octet-stream";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})})())},error(q){return new Response(`<pre>${q}
1123
+ </html>`,loader:"html"}}})}};async function j4($,X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=Z0.resolve($);if(!H0.existsSync(W))return console.error(`${B.red}Error: File not found: ${B.bright}${W}${B.reset}`),!1;if(W.endsWith(".md"))return i$(W,X);else if(!W.endsWith(".stx"))return console.error(`${B.red}Error: Unsupported file type: ${B.bright}${W}${B.reset}. Only .stx and .md files are supported.`),!1;let K=S0(process.cwd(),"output");H0.mkdirSync(K,{recursive:!0}),console.log(`${B.blue}Building ${B.bright}${$}${B.reset}...`);let _=null,U=async()=>{try{let q={name:"public-assets",setup(R){R.onResolve({filter:/^\/(images|fonts|assets|public)\//},(w)=>{return{path:w.path,external:!0}})}},M=await Bun.build({entrypoints:[W],outdir:K,plugins:[q,$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!M.success)return console.error(`${B.red}Build failed:${B.reset}`,M.logs),!1;let V=M.outputs.find((R)=>R.path.endsWith(".html"));if(!V)return console.error(`${B.red}No HTML output found${B.reset}`),!1;return _=await Bun.file(V.path).text(),!0}catch(q){return console.error(`${B.red}Error building stx file:${B.reset}`,q),!1}};if(!await U())return!1;let F=Z0.dirname(W);await W$(F);let O=Q;try{if(O=await x0(Q),O!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${O} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let q=X.hmrPort||O+1;J=X$({wsPort:q,verbose:!1}),G=J.start(q)}let j={},L=null;try{let{loadStxConfig:q}=await import("./chunk-6wrkkdve.js"),M=await q();if(M?.apiRouter)L=M?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(M?.apiRoutes){j=M.apiRoutes;let V=Object.keys(j).length;if(V>0)console.log(`${B.blue}Loaded ${B.bright}${V} API route${V>1?"s":""}${B.reset}`)}if(M?.broadcasting?.enabled)try{let{startBroadcasting:V,loadChannels:N}=await import("./chunk-5mrs8cs2.js"),R=M.broadcasting;await V(R);let w=R.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${w}/ws${B.reset}`);let C=Z0.join(process.cwd(),"channels.ts");if(H0.existsSync(C))try{let I=await N(C);console.log(`${B.blue}Loaded ${B.bright}${I} broadcast channel${I!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(I){console.warn(`${B.yellow}Failed to load channels.ts: ${I.message}${B.reset}`)}}catch(V){console.warn(`${B.yellow}Broadcasting failed to start: ${V.message}${B.reset}`)}}catch{}if(console.log(`${B.blue}Starting server on ${B.cyan}http://localhost:${O}/${B.reset}...`),Y)console.log(`${B.magenta}Hot reload enabled on ws://localhost:${G}${B.reset}`);let H=z4({port:O,async fetch(q){return _$(q,await(async()=>{let M=new URL(q.url);if(L)try{let C=await L.handleRequest(q);if(C.status!==404)return C}catch{}if(j[M.pathname])try{return await j[M.pathname](q)}catch(C){return new Response(JSON.stringify({error:C.message}),{status:500,headers:{"Content-Type":"application/json"}})}if(M.pathname==="/")return(async()=>{let I=await o(_||"");if(Y)I=D0(I,G);if(X.native)if(I.includes("<head>"))I=I.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>");else I="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+I;if(X.titlebarHidden)if(I.includes("<head>"))I=I.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else if(I.includes("<html"))I=I.replace(/(<html[^>]*>)/,"$1<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>");else I=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${I}`;return I})().then((I)=>new Response(I,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}}));let V=Z0.join(K,M.pathname);if(H0.existsSync(V)&&H0.statSync(V).isFile()){let C=Bun.file(V),I=Z0.extname(V).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let N=Z0.dirname(W),R=Z0.join(N,M.pathname);if(H0.existsSync(R)&&H0.statSync(R).isFile()){let C=Bun.file(R),I=Z0.extname(R).toLowerCase(),E="text/plain";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}let w=Z0.join(process.cwd(),"public",M.pathname);if(H0.existsSync(w)&&H0.statSync(w).isFile()){let C=Bun.file(w),I=Z0.extname(w).toLowerCase(),E="application/octet-stream";if(I===".ts"||I===".tsx"){let m=new Bun.Transpiler({loader:I===".tsx"?"tsx":"ts"}),f=await C.text(),K0=m.transformSync(f);return new Response(K0,{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}switch(I){case".html":E="text/html";break;case".css":E="text/css";break;case".js":E="text/javascript";break;case".json":E="application/json";break;case".png":E="image/png";break;case".jpg":case".jpeg":E="image/jpeg";break;case".gif":E="image/gif";break;case".svg":E="image/svg+xml";break;case".ico":E="image/x-icon";break;case".woff":E="font/woff";break;case".woff2":E="font/woff2";break;case".ttf":E="font/ttf";break;case".otf":E="font/otf";break;case".eot":E="application/vnd.ms-fontobject";break}return new Response(C,{headers:{"Content-Type":E}})}return new Response("Not Found",{status:404})})())},error(q){return new Response(`<pre>${q}
1124
1124
  ${q.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),console.log(`
1125
1125
  ${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
1126
1126
  ${B.bright}\u2192 ${B.cyan}http://localhost:${O}/${B.reset}`),console.log(`
@@ -1607,12 +1607,12 @@ ${j.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
1607
1607
  ${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
1608
1608
  ${B.bright}\u2192 ${B.cyan}http://localhost:${U}/${B.reset}`),console.log(`
1609
1609
  ${B.yellow}Routes:${B.reset}`);let F=new Set(W.map((j)=>j.routeTemplate)),O=Object.entries(G).filter(([j])=>!F.has(j)).sort(([j],[L])=>j.localeCompare(L)).map(([j,L])=>({route:j==="/"?"/":j,filePath:X0.relative(process.cwd(),L.filePath),fileType:L.fileType}));for(let j of W){let L=j.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");O.push({route:L,filePath:X0.relative(process.cwd(),j.filePath),fileType:"stx"})}if(O.sort((j,L)=>j.route.localeCompare(L.route)),O.forEach((j,L)=>{let A=L===O.length-1?"\u2514\u2500 ":"\u251C\u2500 ",q=j.fileType==="md"?`${B.magenta}(markdown)${B.reset}`:"";console.log(` ${B.green}${A}${j.route}${B.reset} \u2192 ${B.bright}${j.filePath}${B.reset} ${q}`)}),console.log(`
1610
- Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(z.url.toString(),()=>{if(Z)P0.watch(J,{recursive:!0}).close();z.stop()}),Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let j=P0.watch(J,{recursive:!0},async(L,H)=>{if(!H)return;if(H.endsWith(".stx")||H.endsWith(".js")||H.endsWith(".ts")||H.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${H}${B.yellow} changed, rebuilding...${B.reset}`),u0.clear(),m0(),await K()});process.on("SIGINT",()=>{j.close(),z.stop(),process.exit(0)})}return!0}function j6($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:A4}=globalThis.Bun;import Y0 from"fs";import g from"path";async function N6($){try{return X5(await Bun.file($).text())}catch{return}}function o$($){let X=Bun.file($),Q=g.extname($).toLowerCase(),Z={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Q)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Z[Q]||"application/octet-stream",...J}})}async function q4($=".",X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=g.resolve($),{loadStxConfig:K}=await import("./chunk-3hwdp8gg.js"),_=await K(W),U=_.root&&_.root!=="."?g.join(W,_.root):W,z=X.pagesDir||_.pagesDir||"pages",F=g.join(U,z);if(!Y0.existsSync(F))return console.error(`${B.red}Error: No '${z}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${F}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${z}/index.stx for the homepage.${B.reset}`),!1;let O=e$(U,{pagesDir:z});if(O.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${F}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${O.length}${B.blue} routes${B.reset}`);let j=_?._pluginPageDirs||[],L=[];for(let{dir:D,prefix:T}of j)if(Y0.existsSync(D)){let k=e$(g.dirname(D),{pagesDir:g.basename(D)});for(let S of k){let b=T==="/"?S.pattern:`${T}${S.pattern==="/"?"":S.pattern}`;L.push({route:{...S,pattern:b},prefix:T})}if(k.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${k.length}${B.blue} routes at ${B.cyan}${T}${B.reset}`)}let H=new Map,A=null,q=null;if(X.stxOptions?.shell!==!1){if(q=await b6(W,X.stxOptions?.shell),q){if(A=await $5(q,X.stxOptions||{}),A)console.log(`${B.blue}Using app shell: ${B.bright}${g.relative(W,q)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}E6(),await R6(W);let M=I6();if(M.length>0)console.log(`${B.blue}Loaded ${B.bright}${M.length}${B.blue} middleware: ${B.dim}${M.join(", ")}${B.reset}`);let V={},N=null;try{let{loadStxConfig:D}=await import("./chunk-3hwdp8gg.js"),T=await D(W);if(T?.apiRouter)N=T?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(T?.apiRoutes){V=T.apiRoutes;let k=Object.keys(V).length;if(k>0)console.log(`${B.blue}Loaded ${B.bright}${k} API route${k>1?"s":""}${B.reset}`)}if(T?.broadcasting?.enabled)try{let{startBroadcasting:k,loadChannels:S}=await import("./chunk-ectezqxn.js"),b=T.broadcasting;await k(b);let _0=b.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${_0}/ws${B.reset}`);let W0=g.join(process.cwd(),"channels.ts");if(Y0.existsSync(W0))try{let C0=await S(W0);console.log(`${B.blue}Loaded ${B.bright}${C0} broadcast channel${C0!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(C0){console.warn(`${B.yellow}Failed to load channels.ts: ${C0.message}${B.reset}`)}}catch(k){console.warn(`${B.yellow}Broadcasting failed to start: ${k.message}${B.reset}`)}}catch{}let R=S0(W,"output");Y0.mkdirSync(R,{recursive:!0});let w=new Map,C=new Set,I=async(D)=>{let T=M6(F,D);if(!T)return null;try{let k=await Bun.build({entrypoints:[T],outdir:R,plugins:[$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!k.success)return null;let S=k.outputs.find((b)=>b.path.endsWith(".html"));if(!S)return null;return await Bun.file(S.path).text()}catch{return null}},E=new Map,m=async(D,T)=>{try{let{processDirectives:k,extractVariables:S,defaultConfig:b,loadStxConfig:_0,injectRouterScript:W0}=await import("./chunk-3hwdp8gg.js"),{checkCache:C0,cacheTemplate:h$,readFileCached:r,templateCache:f1}=await import("./chunk-yfcb5zen.js"),h1=await _0(W),x=(d)=>{if(!d)return d;if(g.isAbsolute(d))return d;return g.resolve(W,d)},y={...b,...h1,...X.stxOptions,autoShell:!0};if(X.debugDirectives)y.debug=!0;y.partialsDir=x(y.partialsDir),y.componentsDir=x(y.componentsDir),y.layoutsDir=x(y.layoutsDir),y.storesDir=x(y.storesDir||"stores"),y.cachePath=x(y.cachePath)??S0(W,"cache");let u=!T&&!X.profile,c=y.cache!==!1;if(c&&u){let d=f1.get(D.filePath);if(d)try{if((await Y0.promises.stat(D.filePath)).mtime.getTime()<=d.mtime){let z0=!0;for(let e of d.dependencies){if(!Y0.existsSync(e)){z0=!1;break}if((await Y0.promises.stat(e)).mtime.getTime()>d.mtime){z0=!1;break}}if(z0){let e=d.output;if(A)e=L$(e,{preserveHead:!0});let z1=E.get(D.filePath);return{route:D,content:e,status:z1?.status??await N6(D.filePath),headers:z1?.headers}}}}catch{}let L0=await C0(D.filePath,y);if(L0){let F0=L0;if(A)F0=L$(F0,{preserveHead:!0});let z0=E.get(D.filePath);return{route:D,content:F0,status:z0?.status??await N6(D.filePath),headers:z0?.headers}}}let s=c?await r(D.filePath):await Bun.file(D.filePath).text(),v=X5(s),{classifyAllScripts:U0}=await import("./chunk-3hwdp8gg.js"),B0=U0(s),a=B0.server.map((d)=>d.content),t=s;for(let d of B0.server)t=t.replace(d.fullTag,"");let n={__filename:D.filePath,__dirname:g.dirname(D.filePath),params:T??{},__stx_runtime_head:{}};for(let d of a)try{await S(d,n,D.filePath)}catch(L0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",D.filePath,L0?.message||L0)}let a0=new Set,N0;if(X.profile){let d=performance.now();N0=await k(t,n,D.filePath,y,a0);let L0=performance.now()-d,F0=g.relative(W,D.filePath)||D.filePath;console.log(`[stx:profile] ${F0} \u2192 ${L0.toFixed(2)}ms`)}else N0=await k(t,n,D.filePath,y,a0);if(!A)N0=await W0(N0,{router:y.router});{let{interpolateScriptExpressions:d}=await import("./chunk-tac7ch13.js");N0=N0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(L0,F0,z0)=>{if(!/function\s+__stx_setup_/.test(z0))return L0;return`<script${F0}>${d(z0,n)}</script>`})}if(A)N0=L$(N0,{preserveHead:!0});if(c&&u)await h$(D.filePath,N0,a0,y);let{extractStreamBoundaries:o7}=await import("./chunk-ps9pq4ya.js"),r0=o7(n),F1=n.__streamTemplates;if(F1&&typeof F1==="object"&&Object.keys(F1).length>0){let d=n.streamBoundaries||{},L0={...y,autoShell:!1},F0=Object.keys(F1).map((e)=>({id:e,render:async()=>{let z1=typeof d[e]==="function"?await d[e]():void 0;return k(F1[e],{...n,$boundary:z1},D.filePath,L0,new Set)}})),z0=new Set(F0.map((e)=>e.id));r0=[...(r0||[]).filter((e)=>!z0.has(e.id)),...F0]}if(r0&&r0.length>0)C.add(D.pattern);else r0=void 0;let d5=N1(n),u5=M1(n);if(u)E.set(D.filePath,{status:d5,headers:u5});return{route:D,content:N0,status:d5??v,headers:u5,boundaries:r0}}catch(k){return console.error(`${B.red}Error building ${B.bright}${D.pattern}${B.reset}:`,k),null}},f=8,K0=async()=>{w.clear(),H.clear();for(let D=0;D<O.length;D+=f){let T=O.slice(D,D+f),k=await Promise.all(T.map((S)=>m(S)));for(let S of k)if(S)w.set(S.route.pattern,S)}for(let D=0;D<L.length;D+=f){let T=L.slice(D,D+f),k=await Promise.all(T.map(({route:S})=>m(S)));for(let S of k)if(S)H.set(S.route.pattern,S)}return w.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await K0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await W$(W);let G0=Q;try{if(G0=await x0(Q),G0!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${G0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let D=X.hmrPort||G0+1;J=X$({wsPort:D,verbose:!1}),G=J.start(D)}let v1=(D,T)=>{let S=`<script data-stx-route-params>(function(){var p=${JSON.stringify(T).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(D.includes("</head>"))return D.replace("</head>",`${S}</head>`);if(D.includes("<body"))return D.replace(/<body([^>]*)>/,`<body$1>${S}`);return S+D};console.log(`${B.blue}Starting server...${B.reset}`);let g1=A4({port:G0,async fetch(D){let T=new URL(D.url),k=_?.publicDir||"public",S=g.join(W,k,T.pathname),b=g.join(W,T.pathname),_0=g.join(R,T.pathname),[W0,C0,h$]=await Promise.all([Y0.promises.stat(S).catch(()=>null),Y0.promises.stat(b).catch(()=>null),Y0.promises.stat(_0).catch(()=>null)]);if(W0?.isFile())return o$(S);if(C0?.isFile())return o$(b);if(h$?.isFile())return o$(_0);if(T.pathname.startsWith("/_stx/component/")){let x=decodeURIComponent(T.pathname.slice(16));if(x)try{let y=`<${x} />`,u={...buildConfig,autoShell:!1},c=await processDirectives(y,{},g.join(W,"components",`${x}.stx`),u,new Set);return new Response(c,{headers:{"Content-Type":"text/html"}})}catch(y){return new Response(`<div class="stx-async-error">${y.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(T.pathname==="/_stx/img"){let{handleImageRequest:x}=await import("./chunk-jd68p7x1.js"),y=await x(D,{publicDir:g.join(W,k),cacheDir:S0(W,"cache","img")});if(y)return y}if(N)try{let x=await N.handleRequest(D);if(x.status!==404)return x}catch{}if(V[T.pathname])try{return await V[T.pathname](D)}catch(x){return new Response(JSON.stringify({error:x.message}),{status:500,headers:{"Content-Type":"application/json"}})}let r=t$(T.pathname,O);if(r){let x=w.get(r.route.pattern),y=C.has(r.route.pattern);if(r.route.isDynamic&&Object.keys(r.params).length>0||y){let u=await m(r.route,r.params);if(u)x=u}if(x){let u=x.status??200,c=x.headers??{},s=(r.route.filePath?x6(await Bun.file(r.route.filePath).text().catch(()=>"")):null)??{};if(s.validate){if(!await s.validate({params:r.params})){let B0=await I(404);if(B0){let a=B0;if(a=await o(a,W),Y)a=D0(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(s.middleware){let U0=D6(T.pathname,r.params,s,T.search),B0=w6(U0,null,D,{isServer:!0}),a=await T6(s.middleware,B0);if(a.redirect){let t=a.redirect.path,n=a.redirect.options.redirectCode||302,a0=new Headers(a.responseHeaders);return a0.set("Location",t),new Response(null,{status:n,headers:a0})}if(a.abort){let{statusCode:t,message:n}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${t}</title></head><body><h1>Error ${t}</h1><p>${n}</p></body></html>`,{status:t,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let t=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;x.content=x.content.replace("</head>",`${t}</head>`)}}let v=x.content;if(A&&y6(D)){let U0=C6(v),B0=P6(v),a=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i),t=a?a[1].trim():"";if(Object.keys(r.params).length>0)v=v1(v,r.params);v=await o(v,W);let n=_?.router?.container||"main";return v=v6(v,n),new Response(v,{status:u,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":U0.layout,"X-STX-Layout-Group":U0.group,"X-STX-Runtime":B0?"true":"false",...t&&{"X-STX-Title":encodeURIComponent(t)},[k6]:S6(),...Q1(),"Cache-Control":U$}})}if(A)v=B$(A,v);if(Object.keys(r.params).length>0)v=v1(v,r.params);if(v=await o(v,W),Y)v=D0(v,G);if(X.native)if(v.includes("<head>"))v=v.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else v="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+v;if(X.titlebarHidden)if(v.includes("<head>"))v=v.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else v=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${v}`;if(x.boundaries&&x.boundaries.length>0){let{renderStreamingPage:U0,streamToResponse:B0}=await import("./chunk-ps9pq4ya.js");return B0(U0(v,x.boundaries,{timeoutMs:30000}),{status:u,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(v,{status:u,headers:{"Content-Type":"text/html",...Q1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...c}})}}if(L.length>0){let x=L.map((u)=>u.route),y=t$(T.pathname,x);if(y){let u=H.get(y.route.pattern);if(u){let c=u.content;if(A)c=B$(A,c);if(Object.keys(y.params).length>0)c=v1(c,y.params);if(c=await o(c,W),Y)c=D0(c,G);return new Response(c,{status:u.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:u}of j)if(u!=="/"&&T.pathname.startsWith(u)){let c=H.get(u)||H.get(u+"/");if(c){let s=c.content;if(A)s=B$(A,s);if(s=await o(s,W),Y)s=D0(s,G);return new Response(s,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let f1=w.get("/");if(f1){let x=f1.content;if(x=await o(x,W),Y)x=D0(x,G);if(X.native)if(x.includes("<head>"))x=x.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else x="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+x;return new Response(x,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let h1=await I(404);if(h1){let x=h1;if(x=await o(x,W),Y)x=D0(x,G);return new Response(x,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(D){let T=await I(500);if(T)return new Response(T,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${D}
1610
+ Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(z.url.toString(),()=>{if(Z)P0.watch(J,{recursive:!0}).close();z.stop()}),Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let j=P0.watch(J,{recursive:!0},async(L,H)=>{if(!H)return;if(H.endsWith(".stx")||H.endsWith(".js")||H.endsWith(".ts")||H.endsWith(".md"))console.log(`${B.yellow}File ${B.bright}${H}${B.yellow} changed, rebuilding...${B.reset}`),u0.clear(),m0(),await K()});process.on("SIGINT",()=>{j.close(),z.stop(),process.exit(0)})}return!0}function j6($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var{serve:A4}=globalThis.Bun;import Y0 from"fs";import g from"path";async function N6($){try{return X5(await Bun.file($).text())}catch{return}}function o$($){let X=Bun.file($),Q=g.extname($).toLowerCase(),Z={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},J=[".js",".css",".json"].includes(Q)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(X,{headers:{"Content-Type":Z[Q]||"application/octet-stream",...J}})}async function q4($=".",X={}){let Q=X.port||3000,Z=X.watch!==!1,Y=X.hotReload!==!1&&Z,J=null,G=X.hmrPort||Q+1,W=g.resolve($),{loadStxConfig:K}=await import("./chunk-6wrkkdve.js"),_=await K(W),U=_.root&&_.root!=="."?g.join(W,_.root):W,z=X.pagesDir||_.pagesDir||"pages",F=g.join(U,z);if(!Y0.existsSync(F))return console.error(`${B.red}Error: No '${z}' directory found${B.reset}`),console.log(`${B.dim}Looked in: ${B.bright}${F}${B.reset}`),console.log(`${B.dim}Run stx dev from the app directory, pass it as an argument (stx dev <dir>),${B.reset}`),console.log(`${B.dim}point at another directory with --pages <dir>, or set pagesDir in stx.config.ts.${B.reset}`),console.log(`${B.dim}Starting fresh? Create ${z}/index.stx for the homepage.${B.reset}`),!1;let O=e$(U,{pagesDir:z});if(O.length===0)return console.error(`${B.red}Error: No page files found in ${B.bright}${F}${B.reset}`),!1;console.log(`${B.blue}Found ${B.bright}${O.length}${B.blue} routes${B.reset}`);let j=_?._pluginPageDirs||[],L=[];for(let{dir:D,prefix:T}of j)if(Y0.existsSync(D)){let k=e$(g.dirname(D),{pagesDir:g.basename(D)});for(let S of k){let b=T==="/"?S.pattern:`${T}${S.pattern==="/"?"":S.pattern}`;L.push({route:{...S,pattern:b},prefix:T})}if(k.length>0)console.log(`${B.blue}Plugin pages: ${B.bright}${k.length}${B.blue} routes at ${B.cyan}${T}${B.reset}`)}let H=new Map,A=null,q=null;if(X.stxOptions?.shell!==!1){if(q=await b6(W,X.stxOptions?.shell),q){if(A=await $5(q,X.stxOptions||{}),A)console.log(`${B.blue}Using app shell: ${B.bright}${g.relative(W,q)}${B.reset} ${B.dim}(deprecated: use layouts/default.stx instead)${B.reset}`)}}E6(),await R6(W);let M=I6();if(M.length>0)console.log(`${B.blue}Loaded ${B.bright}${M.length}${B.blue} middleware: ${B.dim}${M.join(", ")}${B.reset}`);let V={},N=null;try{let{loadStxConfig:D}=await import("./chunk-6wrkkdve.js"),T=await D(W);if(T?.apiRouter)N=T?.apiRouter,console.log(`${B.blue}Using custom router for API handling${B.reset}`);if(T?.apiRoutes){V=T.apiRoutes;let k=Object.keys(V).length;if(k>0)console.log(`${B.blue}Loaded ${B.bright}${k} API route${k>1?"s":""}${B.reset}`)}if(T?.broadcasting?.enabled)try{let{startBroadcasting:k,loadChannels:S}=await import("./chunk-5mrs8cs2.js"),b=T.broadcasting;await k(b);let _0=b.port??6001;console.log(`${B.magenta}Broadcasting on ${B.cyan}ws://localhost:${_0}/ws${B.reset}`);let W0=g.join(process.cwd(),"channels.ts");if(Y0.existsSync(W0))try{let C0=await S(W0);console.log(`${B.blue}Loaded ${B.bright}${C0} broadcast channel${C0!==1?"s":""}${B.blue} from channels.ts${B.reset}`)}catch(C0){console.warn(`${B.yellow}Failed to load channels.ts: ${C0.message}${B.reset}`)}}catch(k){console.warn(`${B.yellow}Broadcasting failed to start: ${k.message}${B.reset}`)}}catch{}let R=S0(W,"output");Y0.mkdirSync(R,{recursive:!0});let w=new Map,C=new Set,I=async(D)=>{let T=M6(F,D);if(!T)return null;try{let k=await Bun.build({entrypoints:[T],outdir:R,plugins:[$1],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...X.stxOptions});if(!k.success)return null;let S=k.outputs.find((b)=>b.path.endsWith(".html"));if(!S)return null;return await Bun.file(S.path).text()}catch{return null}},E=new Map,m=async(D,T)=>{try{let{processDirectives:k,extractVariables:S,defaultConfig:b,loadStxConfig:_0,injectRouterScript:W0}=await import("./chunk-6wrkkdve.js"),{checkCache:C0,cacheTemplate:h$,readFileCached:r,templateCache:f1}=await import("./chunk-tfkwgjvm.js"),h1=await _0(W),x=(d)=>{if(!d)return d;if(g.isAbsolute(d))return d;return g.resolve(W,d)},y={...b,...h1,...X.stxOptions,autoShell:!0};if(X.debugDirectives)y.debug=!0;y.partialsDir=x(y.partialsDir),y.componentsDir=x(y.componentsDir),y.layoutsDir=x(y.layoutsDir),y.storesDir=x(y.storesDir||"stores"),y.cachePath=x(y.cachePath)??S0(W,"cache");let u=!T&&!X.profile,c=y.cache!==!1;if(c&&u){let d=f1.get(D.filePath);if(d)try{if((await Y0.promises.stat(D.filePath)).mtime.getTime()<=d.mtime){let z0=!0;for(let e of d.dependencies){if(!Y0.existsSync(e)){z0=!1;break}if((await Y0.promises.stat(e)).mtime.getTime()>d.mtime){z0=!1;break}}if(z0){let e=d.output;if(A)e=L$(e,{preserveHead:!0});let z1=E.get(D.filePath);return{route:D,content:e,status:z1?.status??await N6(D.filePath),headers:z1?.headers}}}}catch{}let L0=await C0(D.filePath,y);if(L0){let F0=L0;if(A)F0=L$(F0,{preserveHead:!0});let z0=E.get(D.filePath);return{route:D,content:F0,status:z0?.status??await N6(D.filePath),headers:z0?.headers}}}let s=c?await r(D.filePath):await Bun.file(D.filePath).text(),v=X5(s),{classifyAllScripts:U0}=await import("./chunk-6wrkkdve.js"),B0=U0(s),a=B0.server.map((d)=>d.content),t=s;for(let d of B0.server)t=t.replace(d.fullTag,"");let n={__filename:D.filePath,__dirname:g.dirname(D.filePath),params:T??{},__stx_runtime_head:{}};for(let d of a)try{await S(d,n,D.filePath)}catch(L0){if(X.stxOptions?.debug)console.error("[stx] variable extraction error",D.filePath,L0?.message||L0)}let a0=new Set,N0;if(X.profile){let d=performance.now();N0=await k(t,n,D.filePath,y,a0);let L0=performance.now()-d,F0=g.relative(W,D.filePath)||D.filePath;console.log(`[stx:profile] ${F0} \u2192 ${L0.toFixed(2)}ms`)}else N0=await k(t,n,D.filePath,y,a0);if(!A)N0=await W0(N0,{router:y.router});{let{interpolateScriptExpressions:d}=await import("./chunk-ft56brtb.js");N0=N0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,(L0,F0,z0)=>{if(!/function\s+__stx_setup_/.test(z0))return L0;return`<script${F0}>${d(z0,n)}</script>`})}if(A)N0=L$(N0,{preserveHead:!0});if(c&&u)await h$(D.filePath,N0,a0,y);let{extractStreamBoundaries:o7}=await import("./chunk-ksfkskte.js"),r0=o7(n),F1=n.__streamTemplates;if(F1&&typeof F1==="object"&&Object.keys(F1).length>0){let d=n.streamBoundaries||{},L0={...y,autoShell:!1},F0=Object.keys(F1).map((e)=>({id:e,render:async()=>{let z1=typeof d[e]==="function"?await d[e]():void 0;return k(F1[e],{...n,$boundary:z1},D.filePath,L0,new Set)}})),z0=new Set(F0.map((e)=>e.id));r0=[...(r0||[]).filter((e)=>!z0.has(e.id)),...F0]}if(r0&&r0.length>0)C.add(D.pattern);else r0=void 0;let d5=N1(n),u5=M1(n);if(u)E.set(D.filePath,{status:d5,headers:u5});return{route:D,content:N0,status:d5??v,headers:u5,boundaries:r0}}catch(k){return console.error(`${B.red}Error building ${B.bright}${D.pattern}${B.reset}:`,k),null}},f=8,K0=async()=>{w.clear(),H.clear();for(let D=0;D<O.length;D+=f){let T=O.slice(D,D+f),k=await Promise.all(T.map((S)=>m(S)));for(let S of k)if(S)w.set(S.route.pattern,S)}for(let D=0;D<L.length;D+=f){let T=L.slice(D,D+f),k=await Promise.all(T.map(({route:S})=>m(S)));for(let S of k)if(S)H.set(S.route.pattern,S)}return w.size>0};if(console.log(`${B.blue}Building pages...${B.reset}`),!await K0())return console.error(`${B.red}No pages were successfully built${B.reset}`),!1;await W$(W);let G0=Q;try{if(G0=await x0(Q),G0!==Q)console.log(`${B.yellow}Port ${Q} is busy, using port ${G0} instead${B.reset}`)}catch{return console.error(`${B.red}Could not find an available port${B.reset}`),!1}if(Y){let D=X.hmrPort||G0+1;J=X$({wsPort:D,verbose:!1}),G=J.start(D)}let v1=(D,T)=>{let S=`<script data-stx-route-params>(function(){var p=${JSON.stringify(T).replace(/</g,"\\u003C").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")};window.__stx_rp=p;if(window.stx){window.stx._rp=p;if(window.stx.setRouteParams)window.stx.setRouteParams(p)}})()</script>`;if(D.includes("</head>"))return D.replace("</head>",`${S}</head>`);if(D.includes("<body"))return D.replace(/<body([^>]*)>/,`<body$1>${S}`);return S+D};console.log(`${B.blue}Starting server...${B.reset}`);let g1=A4({port:G0,async fetch(D){let T=new URL(D.url),k=_?.publicDir||"public",S=g.join(W,k,T.pathname),b=g.join(W,T.pathname),_0=g.join(R,T.pathname),[W0,C0,h$]=await Promise.all([Y0.promises.stat(S).catch(()=>null),Y0.promises.stat(b).catch(()=>null),Y0.promises.stat(_0).catch(()=>null)]);if(W0?.isFile())return o$(S);if(C0?.isFile())return o$(b);if(h$?.isFile())return o$(_0);if(T.pathname.startsWith("/_stx/component/")){let x=decodeURIComponent(T.pathname.slice(16));if(x)try{let y=`<${x} />`,u={...buildConfig,autoShell:!1},c=await processDirectives(y,{},g.join(W,"components",`${x}.stx`),u,new Set);return new Response(c,{headers:{"Content-Type":"text/html"}})}catch(y){return new Response(`<div class="stx-async-error">${y.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(T.pathname==="/_stx/img"){let{handleImageRequest:x}=await import("./chunk-h23wts30.js"),y=await x(D,{publicDir:g.join(W,k),cacheDir:S0(W,"cache","img")});if(y)return y}if(N)try{let x=await N.handleRequest(D);if(x.status!==404)return x}catch{}if(V[T.pathname])try{return await V[T.pathname](D)}catch(x){return new Response(JSON.stringify({error:x.message}),{status:500,headers:{"Content-Type":"application/json"}})}let r=t$(T.pathname,O);if(r){let x=w.get(r.route.pattern),y=C.has(r.route.pattern);if(r.route.isDynamic&&Object.keys(r.params).length>0||y){let u=await m(r.route,r.params);if(u)x=u}if(x){let u=x.status??200,c=x.headers??{},s=(r.route.filePath?x6(await Bun.file(r.route.filePath).text().catch(()=>"")):null)??{};if(s.validate){if(!await s.validate({params:r.params})){let B0=await I(404);if(B0){let a=B0;if(a=await o(a,W),Y)a=D0(a,G);return new Response(a,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(s.middleware){let U0=D6(T.pathname,r.params,s,T.search),B0=w6(U0,null,D,{isServer:!0}),a=await T6(s.middleware,B0);if(a.redirect){let t=a.redirect.path,n=a.redirect.options.redirectCode||302,a0=new Headers(a.responseHeaders);return a0.set("Location",t),new Response(null,{status:n,headers:a0})}if(a.abort){let{statusCode:t,message:n}=a.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${t}</title></head><body><h1>Error ${t}</h1><p>${n}</p></body></html>`,{status:t,headers:{"Content-Type":"text/html"}})}if(Object.keys(a.state).length>0){let t=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(a.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;x.content=x.content.replace("</head>",`${t}</head>`)}}let v=x.content;if(A&&y6(D)){let U0=C6(v),B0=P6(v),a=v.match(/<title[^>]*>([\s\S]*?)<\/title>/i),t=a?a[1].trim():"";if(Object.keys(r.params).length>0)v=v1(v,r.params);v=await o(v,W);let n=_?.router?.container||"main";return v=v6(v,n),new Response(v,{status:u,headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":U0.layout,"X-STX-Layout-Group":U0.group,"X-STX-Runtime":B0?"true":"false",...t&&{"X-STX-Title":encodeURIComponent(t)},[k6]:S6(),...Q1(),"Cache-Control":U$}})}if(A)v=B$(A,v);if(Object.keys(r.params).length>0)v=v1(v,r.params);if(v=await o(v,W),Y)v=D0(v,G);if(X.native)if(v.includes("<head>"))v=v.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else v="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+v;if(X.titlebarHidden)if(v.includes("<head>"))v=v.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else v=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${v}`;if(x.boundaries&&x.boundaries.length>0){let{renderStreamingPage:U0,streamToResponse:B0}=await import("./chunk-ksfkskte.js");return B0(U0(v,x.boundaries,{timeoutMs:30000}),{status:u,headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(v,{status:u,headers:{"Content-Type":"text/html",...Q1(),"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0",...c}})}}if(L.length>0){let x=L.map((u)=>u.route),y=t$(T.pathname,x);if(y){let u=H.get(y.route.pattern);if(u){let c=u.content;if(A)c=B$(A,c);if(Object.keys(y.params).length>0)c=v1(c,y.params);if(c=await o(c,W),Y)c=D0(c,G);return new Response(c,{status:u.status??200,headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:u}of j)if(u!=="/"&&T.pathname.startsWith(u)){let c=H.get(u)||H.get(u+"/");if(c){let s=c.content;if(A)s=B$(A,s);if(s=await o(s,W),Y)s=D0(s,G);return new Response(s,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let f1=w.get("/");if(f1){let x=f1.content;if(x=await o(x,W),Y)x=D0(x,G);if(X.native)if(x.includes("<head>"))x=x.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else x="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+x;return new Response(x,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let h1=await I(404);if(h1){let x=h1;if(x=await o(x,W),Y)x=D0(x,G);return new Response(x,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(D){let T=await I(500);if(T)return new Response(T,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${D}
1611
1611
  ${D.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
1612
1612
  ${B.blue}stx${B.reset} ${B.green}${process.env.stx_VERSION||"v0.0.10"}${B.reset} ${B.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${B.reset}`),console.log(`
1613
1613
  ${B.bright}\u2192 ${B.cyan}http://localhost:${G0}/${B.reset}`),Y)console.log(`${B.dim} HMR: ws://localhost:${G}${B.reset}`);console.log(`
1614
1614
  ${B.yellow}Routes:${B.reset}`);let i0=[...V6(O,W)];for(let{route:D}of L)i0.push(`${D.pattern}`);if(i0.forEach((D,T)=>{let S=T===i0.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${B.green}${S}${B.reset}${D}`)}),console.log(`
1615
- Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(g1.url.toString(),()=>{if(J)A1();g1.stop()}),X.native){let D,T=g.join(F,"index.stx");if(Y0.existsSync(T)){let S=await Bun.file(T).text();D=o1(S)}let k=_?.app?.window??{};await o0(G0,{title:_?.app?.head?.title||g.basename(W)||"stx App",width:k.width,height:k.height,darkMode:k.darkMode,hotReload:k.hotReload,titlebarHidden:k.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!D,sidebarConfig:D})}if(Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let D=(S)=>{return S.startsWith("public/")||S.startsWith("public\\")},T=(S)=>{let b=S.toLowerCase();return b.endsWith(".stx")||b.endsWith(".html")||b.endsWith(".md")},k=Y0.watch(W,{recursive:!0},async(S,b)=>{if(!b||$$(b))return;if(e1(b))if(D(b)){if(console.log(`${B.cyan}${b} changed${B.reset}`),Y&&J)J.reload(b)}else if(T(b)){console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-yfcb5zen.js");_0(g.resolve(W,b)),W0.delete(g.resolve(W,b))}catch{}if(q&&b){if(g.resolve(W,b)===q||g.basename(q)===b){let W0=await $5(q,X.stxOptions||{});if(W0)A=W0}}if(await K0(),await K$(W),Y&&J)J.reload(b)}else{console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-yfcb5zen.js");_0(g.resolve(W,b)),W0.delete(g.resolve(W,b))}catch{}if(await K0(),Y&&J)J.reload(b)}else if(t1(b)){if(console.log(`${B.cyan}CSS ${b} changed${B.reset}`),Y&&J)J.updateCss(b)}});process.on("SIGINT",()=>{if(k.close(),J)A1();g1.stop(),process.exit(0)})}return!0}var N4=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function M4($){let X=($||"").trim();if(!X)return null;if(/[\s>+~,:]/.test(X))return null;let Q={},Z=X,Y=Z.match(/^[a-z][\w-]*/i);if(Y)Q.tag=Y[0].toLowerCase(),Z=Z.slice(Y[0].length);while(Z.length>0){let J=Z.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(J){if(Q.attr=J[1],J[3]!==void 0&&J[3]!=="")Q.attrValue=J[3];Z=Z.slice(J[0].length);continue}let G=Z.match(/^#([\w-]+)/);if(G){Q.id=G[1],Z=Z.slice(G[0].length);continue}let W=Z.match(/^\.([\w-]+)/);if(W){Q.className=W[1],Z=Z.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function V4($,X){if(X.attr){if(!(X.attrValue===void 0?new RegExp(`\\b${X.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${X.attr}\\s*=\\s*(["'])\\s*${X.attrValue}\\s*\\1`,"i")).test($))return!1}if(X.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${X.id}\\s*\\1`,"i").test($))return!1}if(X.className){let Q=$.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(X.className))return!1}return!0}function bW($,X="main"){let Q=M4(X);if(!Q)return null;let Z=/<([a-z][\w-]*)\b([^>]*)>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1].toLowerCase(),G=Y[2]||"";if(G.trimEnd().endsWith("/")||N4.has(J))continue;if(Q.tag&&Q.tag!==J)continue;if(!V4(G,Q))continue;let W=Y[0],K=Y.index+W.length,_=new RegExp(`<(/?)${J}\\b([^>]*)>`,"gi");_.lastIndex=K;let U=1,z;while((z=_.exec($))!==null){let F=z[1]==="/";if(!F&&(z[2]||"").trimEnd().endsWith("/"))continue;if(U+=F?-1:1,U===0)return{openTag:W,openIndex:Y.index,start:K,end:z.index,tagName:J}}return null}return null}var P={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function E4($={}){if(typeof window>"u")return;P.enabled=!0,P.maxEvents=$.maxEvents||1000,P.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>P,getComponents:()=>Array.from(P.components.values()),getComponent:(X)=>P.components.get(X),getStores:()=>Array.from(P.stores.values()),getStore:(X)=>P.stores.get(X),getEvents:()=>P.events,getPerformance:()=>P.performance,selectComponent:(X)=>Z5(X),selectStore:(X)=>R4(X),inspectElement:(X)=>D4(X),highlightComponent:(X)=>u6(X),clearHighlight:()=>m6(),logComponentTree:()=>w4(),logStoreState:(X)=>T4(X),timeTravel:(X,Q)=>C4(X,Q)},k4(),x4(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function I4(){P.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function g6($){if(!P.enabled)return;let X=P.components.get($);if(X){if(X.parentId){let Q=P.components.get(X.parentId);if(Q)Q.children=Q.children.filter((Z)=>Z!==$)}P.components.delete($),Q5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function h6($,X,Q={},Z=[]){if(!P.enabled)return;let Y={id:$,state:X,getters:Q,actions:Z,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};P.stores.set($,Y),Q5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function d6($,X,Q,Z,Y="state"){if(!P.enabled)return;let J=P.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Q,newValue:Z,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Z};Q5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Q,newValue:Z}})}}function Q5($){if(!P.enabled)return;if(P.events.push($),P.events.length>P.maxEvents)P.events=P.events.slice(-P.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function Z5($){P.selectedComponent=$;let X=P.components.get($);if(X)u6($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function R4($){P.selectedStore=$;let X=P.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function D4($){let X=$;while(X){let Q=X.getAttribute("data-stx-component-id");if(Q)return Z5(Q);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function u6($){m6();let X=P.components.get($);if(X?.element){let Q=document.createElement("div");Q.id="stx-devtools-highlight",Q.style.cssText=`
1615
+ Press ${B.cyan}h${B.reset} + ${B.cyan}Enter${B.reset} to show shortcuts`),k0(g1.url.toString(),()=>{if(J)A1();g1.stop()}),X.native){let D,T=g.join(F,"index.stx");if(Y0.existsSync(T)){let S=await Bun.file(T).text();D=o1(S)}let k=_?.app?.window??{};await o0(G0,{title:_?.app?.head?.title||g.basename(W)||"stx App",width:k.width,height:k.height,darkMode:k.darkMode,hotReload:k.hotReload,titlebarHidden:k.titlebarHidden??X.titlebarHidden===!0,nativeSidebar:!!D,sidebarConfig:D})}if(Z){console.log(`${B.blue}Watching for changes...${B.reset}`);let D=(S)=>{return S.startsWith("public/")||S.startsWith("public\\")},T=(S)=>{let b=S.toLowerCase();return b.endsWith(".stx")||b.endsWith(".html")||b.endsWith(".md")},k=Y0.watch(W,{recursive:!0},async(S,b)=>{if(!b||$$(b))return;if(e1(b))if(D(b)){if(console.log(`${B.cyan}${b} changed${B.reset}`),Y&&J)J.reload(b)}else if(T(b)){console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-tfkwgjvm.js");_0(g.resolve(W,b)),W0.delete(g.resolve(W,b))}catch{}if(q&&b){if(g.resolve(W,b)===q||g.basename(q)===b){let W0=await $5(q,X.stxOptions||{});if(W0)A=W0}}if(await K0(),await K$(W),Y&&J)J.reload(b)}else{console.log(`${B.yellow}${b} changed, rebuilding...${B.reset}`),u0.clear(),m0();try{let{invalidateFileCache:_0,templateCache:W0}=await import("./chunk-tfkwgjvm.js");_0(g.resolve(W,b)),W0.delete(g.resolve(W,b))}catch{}if(await K0(),Y&&J)J.reload(b)}else if(t1(b)){if(console.log(`${B.cyan}CSS ${b} changed${B.reset}`),Y&&J)J.updateCss(b)}});process.on("SIGINT",()=>{if(k.close(),J)A1();g1.stop(),process.exit(0)})}return!0}var N4=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function M4($){let X=($||"").trim();if(!X)return null;if(/[\s>+~,:]/.test(X))return null;let Q={},Z=X,Y=Z.match(/^[a-z][\w-]*/i);if(Y)Q.tag=Y[0].toLowerCase(),Z=Z.slice(Y[0].length);while(Z.length>0){let J=Z.match(/^\[([\w-]+)(?:=(["']?)([^\]"']*)\2)?\]/);if(J){if(Q.attr=J[1],J[3]!==void 0&&J[3]!=="")Q.attrValue=J[3];Z=Z.slice(J[0].length);continue}let G=Z.match(/^#([\w-]+)/);if(G){Q.id=G[1],Z=Z.slice(G[0].length);continue}let W=Z.match(/^\.([\w-]+)/);if(W){Q.className=W[1],Z=Z.slice(W[0].length);continue}return null}if(!Q.tag&&!Q.attr&&!Q.id&&!Q.className)return null;return Q}function V4($,X){if(X.attr){if(!(X.attrValue===void 0?new RegExp(`\\b${X.attr}(?=[\\s=>/]|$)`,"i"):new RegExp(`\\b${X.attr}\\s*=\\s*(["'])\\s*${X.attrValue}\\s*\\1`,"i")).test($))return!1}if(X.id){if(!new RegExp(`\\bid\\s*=\\s*(["'])\\s*${X.id}\\s*\\1`,"i").test($))return!1}if(X.className){let Q=$.match(/\bclass\s*=\s*(["'])([\s\S]*?)\1/i);if(!Q)return!1;if(!Q[2].split(/\s+/).includes(X.className))return!1}return!0}function bW($,X="main"){let Q=M4(X);if(!Q)return null;let Z=/<([a-z][\w-]*)\b([^>]*)>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1].toLowerCase(),G=Y[2]||"";if(G.trimEnd().endsWith("/")||N4.has(J))continue;if(Q.tag&&Q.tag!==J)continue;if(!V4(G,Q))continue;let W=Y[0],K=Y.index+W.length,_=new RegExp(`<(/?)${J}\\b([^>]*)>`,"gi");_.lastIndex=K;let U=1,z;while((z=_.exec($))!==null){let F=z[1]==="/";if(!F&&(z[2]||"").trimEnd().endsWith("/"))continue;if(U+=F?-1:1,U===0)return{openTag:W,openIndex:Y.index,start:K,end:z.index,tagName:J}}return null}return null}var P={enabled:!1,components:new Map,stores:new Map,events:[],performance:[],selectedComponent:null,selectedStore:null,maxEvents:1000,maxPerformance:500};function E4($={}){if(typeof window>"u")return;P.enabled=!0,P.maxEvents=$.maxEvents||1000,P.maxPerformance=$.maxPerformance||500,window.__STX_DEVTOOLS__={getState:()=>P,getComponents:()=>Array.from(P.components.values()),getComponent:(X)=>P.components.get(X),getStores:()=>Array.from(P.stores.values()),getStore:(X)=>P.stores.get(X),getEvents:()=>P.events,getPerformance:()=>P.performance,selectComponent:(X)=>Z5(X),selectStore:(X)=>R4(X),inspectElement:(X)=>D4(X),highlightComponent:(X)=>u6(X),clearHighlight:()=>m6(),logComponentTree:()=>w4(),logStoreState:(X)=>T4(X),timeTravel:(X,Q)=>C4(X,Q)},k4(),x4(),console.log("%c[STX DevTools] Enabled","color: #10b981; font-weight: bold;")}function I4(){P.enabled=!1,delete window.__STX_DEVTOOLS__;let $=document.getElementById("stx-devtools-panel");if($)$.remove();console.log("%c[STX DevTools] Disabled","color: #ef4444;")}function g6($){if(!P.enabled)return;let X=P.components.get($);if(X){if(X.parentId){let Q=P.components.get(X.parentId);if(Q)Q.children=Q.children.filter((Z)=>Z!==$)}P.components.delete($),Q5({timestamp:Date.now(),type:"component:unmounted",componentId:$,payload:{name:X.name}})}}function h6($,X,Q={},Z=[]){if(!P.enabled)return;let Y={id:$,state:X,getters:Q,actions:Z,history:[{timestamp:Date.now(),type:"state",name:"__init__",newValue:X}]};P.stores.set($,Y),Q5({timestamp:Date.now(),type:"store:registered",payload:{id:$,state:X}})}function d6($,X,Q,Z,Y="state"){if(!P.enabled)return;let J=P.stores.get($);if(J){let G={timestamp:Date.now(),type:Y,name:X,oldValue:Q,newValue:Z,stack:Error().stack};if(J.history.push(G),J.history.length>100)J.history=J.history.slice(-100);if(Y==="state")J.state={...J.state,[X]:Z};Q5({timestamp:Date.now(),type:`store:${Y}`,payload:{storeId:$,name:X,oldValue:Q,newValue:Z}})}}function Q5($){if(!P.enabled)return;if(P.events.push($),P.events.length>P.maxEvents)P.events=P.events.slice(-P.maxEvents);if(typeof window<"u")window.dispatchEvent(new CustomEvent("stx:devtools:event",{detail:$}))}function Z5($){P.selectedComponent=$;let X=P.components.get($);if(X)u6($),console.log("%c[STX DevTools] Selected component:","color: #3b82f6;",X);return X}function R4($){P.selectedStore=$;let X=P.stores.get($);if(X)console.log("%c[STX DevTools] Selected store:","color: #8b5cf6;",X);return X}function D4($){let X=$;while(X){let Q=X.getAttribute("data-stx-component-id");if(Q)return Z5(Q);X=X.parentElement}console.log("%c[STX DevTools] No component found for element","color: #f59e0b;");return}function u6($){m6();let X=P.components.get($);if(X?.element){let Q=document.createElement("div");Q.id="stx-devtools-highlight",Q.style.cssText=`
1616
1616
  position: absolute;
1617
1617
  background: rgba(59, 130, 246, 0.2);
1618
1618
  border: 2px solid #3b82f6;
@@ -2881,9 +2881,9 @@ describe('Example', () => {
2881
2881
  </footer>
2882
2882
  @yield('scripts')
2883
2883
  </body>
2884
- </html>`}function aX(){return"<!-- Hero section -->"}function rX(){return"<!-- Features -->"}function sX(){return"<!-- Pricing -->"}function nX(){return"<!-- Button -->"}function C1($){if(!T1($))U5($,{recursive:!0})}function oX(){if(T1("bun.lockb"))return"bun";if(T1("pnpm-lock.yaml"))return"pnpm";if(T1("yarn.lock"))return"yarn";return"bun"}function B5($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function tX($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function p0($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:eX}=globalThis.Bun;import x1 from"fs";import y0 from"path";function c2($,X=200,Q={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Q}})}async function Y8($){let{loadStxConfig:X}=await import("./chunk-y8nn1bgk.js");return{...await X($.configDir??process.cwd()).catch(()=>({})),...$.stxOptions??{}}}async function $Q($={}){let{port:X=3000,root:Q=".",watch:Z=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=y0.resolve(Q),U=await Y8($),z=new Map;async function F(q){let M=x1.statSync(q),V=`${q}:${M.mtimeMs}`,N=z.get(V);if(N)return{content:N.content,status:N.status,headers:N.headers};for(let T of z.keys())if(T.startsWith(`${q}:`)&&T!==V)z.delete(T);let R=await Bun.file(q).text(),w=R,C=Z$(R);if(C)w=C.content.trim();let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[],m=[],f;while((f=I.exec(R))!==null){let T=f[1],k=f[2],S=f[0];if(T.includes("server"))m.push(k);else E.push(S)}let K0=R.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],h5=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),G0={__filename:q,__dirname:y0.dirname(q)};for(let T of m)await j0(T,G0,q);let q0=await O0(h5,G0,q,U,new Set);if(K0.length>0){let T=K0.join(`
2884
+ </html>`}function aX(){return"<!-- Hero section -->"}function rX(){return"<!-- Features -->"}function sX(){return"<!-- Pricing -->"}function nX(){return"<!-- Button -->"}function C1($){if(!T1($))U5($,{recursive:!0})}function oX(){if(T1("bun.lockb"))return"bun";if(T1("pnpm-lock.yaml"))return"pnpm";if(T1("yarn.lock"))return"yarn";return"bun"}function B5($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toUpperCase())}function tX($){return $.replace(/[-_\s]+(.)?/g,(X,Q)=>Q?Q.toUpperCase():"").replace(/^./,(X)=>X.toLowerCase())}function p0($){return $.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}var{serve:eX}=globalThis.Bun;import x1 from"fs";import y0 from"path";function c2($,X=200,Q={}){return new Response($,{status:X,headers:{"Content-Type":"text/html; charset=utf-8",...Q}})}async function Y8($){let{loadStxConfig:X}=await import("./chunk-emgn7z93.js");return{...await X($.configDir??process.cwd()).catch(()=>({})),...$.stxOptions??{}}}async function $Q($={}){let{port:X=3000,root:Q=".",watch:Z=!0,onRequest:Y,routes:J={},middleware:G=[],on404:W,onError:K}=$,_=y0.resolve(Q),U=await Y8($),z=new Map;async function F(q){let M=x1.statSync(q),V=`${q}:${M.mtimeMs}`,N=z.get(V);if(N)return{content:N.content,status:N.status,headers:N.headers};for(let T of z.keys())if(T.startsWith(`${q}:`)&&T!==V)z.delete(T);let R=await Bun.file(q).text(),w=R,C=Z$(R);if(C)w=C.content.trim();let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[],m=[],f;while((f=I.exec(R))!==null){let T=f[1],k=f[2],S=f[0];if(T.includes("server"))m.push(k);else E.push(S)}let K0=R.match(/<style\b[^>]*>[\s\S]*?<\/style>/gi)||[],h5=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),G0={__filename:q,__dirname:y0.dirname(q)};for(let T of m)await j0(T,G0,q);let q0=await O0(h5,G0,q,U,new Set);if(K0.length>0){let T=K0.join(`
2885
2885
  `);if(q0.match(/(<\/head>)/i))q0=q0.replace(/(<\/head>)/i,`${T}
2886
- $1`)}if(E.length>0){let{interpolateScriptsInTemplate:T}=await import("./chunk-tac7ch13.js"),k=T(E.join(`
2886
+ $1`)}if(E.length>0){let{interpolateScriptsInTemplate:T}=await import("./chunk-ft56brtb.js"),k=T(E.join(`
2887
2887
  `),G0);if(q0.match(/(<\/body>)/i))q0=q0.replace(/(<\/body>)/i,`${k}
2888
2888
  $1`);else q0+=`
2889
2889
  ${k}`}let i0=N1(G0),D=M1(G0);return z.set(V,{content:q0,mtime:M.mtimeMs,status:i0,headers:D}),{content:q0,status:i0,headers:D}}async function O(q){let M=x1.statSync(q),V=`${q}:${M.mtimeMs}`,N=z.get(V);if(N)return N.content;let{content:R}=await V0(q,U);return z.set(V,{content:R,mtime:M.mtimeMs}),R}function j(q){let M=q.startsWith("/")?q.slice(1):q,V=[M,`${M}.stx`,`${M}.md`,`${M}.html`,y0.join(M,"index.stx"),y0.join(M,"index.md"),y0.join(M,"index.html")];for(let N of V){let R=y0.join(_,N);if(x1.existsSync(R)&&x1.statSync(R).isFile())return R}return null}async function L(q){let M=new URL(q.url),V=async()=>{if(J[M.pathname])return await J[M.pathname](q);if(Y){let R=await Y(q);if(R)return R}let N=j(M.pathname);if(!N){if(W)return await W(q);return new Response("Not Found",{status:404})}try{let R,w="text/html",C,I;if(N.endsWith(".stx")){let E=await F(N);R=E.content,C=E.status,I=E.headers}else if(N.endsWith(".md"))R=await O(N);else if(N.endsWith(".html"))R=await Bun.file(N).text();else if(N.endsWith(".css"))R=await Bun.file(N).text(),w="text/css";else if(N.endsWith(".js"))R=await Bun.file(N).text(),w="text/javascript";else if(N.endsWith(".json"))R=await Bun.file(N).text(),w="application/json";else return new Response(Bun.file(N));return new Response(R,{status:C??200,headers:{"Content-Type":w,...I}})}catch(R){if(K)return await K(R,q);let w=R instanceof Error?R.message:String(R),I=U?.debug===!0?`<h1>Error</h1><pre>${w}
@@ -4315,7 +4315,7 @@ else {
4315
4315
  \u26A0\uFE0F Built ${Q.views.length} views with ${Q.errors.length} errors`);return Q}function Y9($,X){let Q=V$.watch($.viewsDir,{recursive:!0},async(Z,Y)=>{if(!Y)return;if(Y.endsWith(".stx")||Y.endsWith(".ts")||Y.endsWith(".js")){if($.debug)console.log(`
4316
4316
  File changed: ${Y}, rebuilding...`);let J=await VZ($);X?.(J)}});return{close:()=>Q.close()}}async function J9($,X={},Q={}){let Z={...Q,skipDefaultSeoTags:!0,skipSignalsRuntime:!0},Y=await M7($,X,Z);Y=await EZ(Y),Y=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),Y=Y.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,""),Y=Y.replace(/<!--\s*stx SEO Tags\s*-->/gi,""),Y=Y.replace(/\n\s*\n\s*\n/g,`
4317
4317
 
4318
- `).trim();let J=RZ(Y);return{html:Y,text:J}}async function EZ($){try{let{generateCrosswindCSS:X,extractClassNames:Q}=await import("./chunk-7rkgc61n.js");if(Q($).size===0)return $;let Y=await X($);if(!Y)return $;let J=IZ(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,z)=>{let F=_.split(/\s+/).filter(Boolean),O=[];for(let A of F){let q=J.get(A);if(q)O.push(q)}if(O.length===0)return`${W}${K}class="${_}"${U}${z}`;let j=O.join("; "),H=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(H){let A=`${j}; ${H[1]}`,q=K.replace(/style\s*=\s*"[^"]*"/,`style="${A}"`),M=U.replace(/style\s*=\s*"[^"]*"/,`style="${A}"`);return`${W}${q}class="${_}"${M}${z}`}return`${W}${K}class="${_}" style="${j}"${U}${z}`})}catch{return $}}function IZ($){let X=new Map,Q=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Z=Q.exec($);while(Z!==null){let Y=Z[1].replace(/\\/g,""),J=Z[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Z=Q.exec($)}return X}function RZ($){return $.replace(/<br\s*\/?>/gi,`
4318
+ `).trim();let J=RZ(Y);return{html:Y,text:J}}async function EZ($){try{let{generateCrosswindCSS:X,extractClassNames:Q}=await import("./chunk-2wvg84c0.js");if(Q($).size===0)return $;let Y=await X($);if(!Y)return $;let J=IZ(Y);if(J.size===0)return $;return $.replace(/(<[a-z][a-z0-9]*)((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s+)class\s*=\s*"([^"]*)"((?:\s+[a-z][a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?>)/gi,(G,W,K,_,U,z)=>{let F=_.split(/\s+/).filter(Boolean),O=[];for(let A of F){let q=J.get(A);if(q)O.push(q)}if(O.length===0)return`${W}${K}class="${_}"${U}${z}`;let j=O.join("; "),H=`${K}${U}`.match(/style\s*=\s*"([^"]*)"/);if(H){let A=`${j}; ${H[1]}`,q=K.replace(/style\s*=\s*"[^"]*"/,`style="${A}"`),M=U.replace(/style\s*=\s*"[^"]*"/,`style="${A}"`);return`${W}${q}class="${_}"${M}${z}`}return`${W}${K}class="${_}" style="${j}"${U}${z}`})}catch{return $}}function IZ($){let X=new Map,Q=/\.([a-zA-Z0-9_-]+(?:\\:[a-zA-Z0-9_-]+)*)\s*\{([^}]+)\}/g,Z=Q.exec($);while(Z!==null){let Y=Z[1].replace(/\\/g,""),J=Z[2].split(";").map((G)=>G.trim()).filter(Boolean).join("; ");if(J)X.set(Y,J);Z=Q.exec($)}return X}function RZ($){return $.replace(/<br\s*\/?>/gi,`
4319
4319
  `).replace(/<\/(p|div|h[1-6]|li|tr)>/gi,`
4320
4320
  `).replace(/<\/td>/gi,"\t").replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&copy;/g,"(c)").replace(/&middot;/g,"-").replace(/\n\s*\n\s*\n/g,`
4321
4321
 
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$e as x,Xe as t,Ye as u,Ze as v,_e as w,af as y,bf as z,cf as A,df as B,ef as C,ff as D,gf as E}from"./chunk-4jzzgnym.js";import{Cf as r,Df as s}from"./chunk-0n4fvqm8.js";import{Ag as o,Bg as p,Cg as q,mg as b,ng as c,og as d,pg as e,qg as f,rg as g,sg as h,ug as i,vg as j,wg as k,xg as l,yg as m,zg as n}from"./chunk-21kvpnqq.js";import{ih as a}from"./chunk-4tmw4kjm.js";import"./chunk-a2ppgamd.js";import"./chunk-q891e1vj.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
2
+ import{kf as t,lf as u,mf as v,nf as w,of as x,pf as y,qf as z,rf as A,sf as B,tf as C,uf as D,vf as E}from"./chunk-zpvva2dh.js";import{gg as r,hg as s}from"./chunk-6pzgmp1h.js";import{ch as b,dh as c,eh as d,fh as e,gh as f,hh as g,ih as h,kh as i,lh as j,mh as k,nh as l,oh as m,ph as n,qh as o,rh as p,sh as q}from"./chunk-m38wyaes.js";import{th as a}from"./chunk-9edt3qh6.js";import"./chunk-a2ppgamd.js";import"./chunk-q891e1vj.js";export{D as writeImageManifest,a as rewriteImagesWithSiblings,t as renderImageComponent,v as processImageComponents,g as processImage,u as parseImageComponent,A as optimizeImage,B as optimizeDirectory,e as isSharpAvailable,m as isImageFile,f as isImageBackendAvailable,y as imageDirective,r as handleImageRequest,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,h as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,C as generateImageManifest,p as formatSize,E as defaultImageConfig,z as createImagePlugin,s as createImageHandler,x as createImageDirective,w as clearImageCache,q as ImageProcessingError,b as DEFAULT_WIDTHS,d as DEFAULT_QUALITY,c as DEFAULT_FORMATS};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ag as o,Bg as p,Cg as q,mg as a,ng as b,og as c,pg as d,qg as e,rg as f,sg as g,tg as h,ug as i,vg as j,wg as k,xg as l,yg as m,zg as n}from"./chunk-21kvpnqq.js";import"./chunk-q891e1vj.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
2
+ import{ch as a,dh as b,eh as c,fh as d,gh as e,hh as f,ih as g,jh as h,kh as i,lh as j,mh as k,nh as l,oh as m,ph as n,qh as o,rh as p,sh as q}from"./chunk-m38wyaes.js";import"./chunk-q891e1vj.js";export{h as resizeAndConvert,f as processImage,d as isSharpAvailable,m as isImageFile,e as isImageBackendAvailable,l as groupVariantsByFormat,o as getTotalSize,n as getMimeType,g as getImageMetadata,k as getFallbackVariant,i as generateSrcSet,j as generateSizes,p as formatSize,q as ImageProcessingError,a as DEFAULT_WIDTHS,c as DEFAULT_QUALITY,b as DEFAULT_FORMATS};
@@ -5,4 +5,4 @@ var P=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{nam
5
5
  ${F} [${U.join(`,
6
6
  ${F} `)}]`:"";return`Craft.create("${j.zigType}", ${Q}${W})`}function s(j,q,F){if(q.target==="universal"){let G=[];G.push("// Universal entry point"),G.push("");for(let[Q,U]of F)G.push(`// --- ${Q.toUpperCase()} ---`),G.push(`#if ${Q.toUpperCase()}`),G.push(U),G.push("#endif"),G.push("");return G.join(`
7
7
  `)}return F.get(q.target)||J(j,q)}function r(j,q,F){let G=[];function Q(U){G.push({name:U.zigType,hash:D(JSON.stringify(U.props)),props:Object.keys(U.props),events:Array.from(U.events.keys()),slots:[],isNative:U.zigType.startsWith("craft.")});for(let W of U.children)Q(W)}return Q(q),{version:"1.0.0",components:G,entry:j.id,assets:[],styles:j.styles}}function p(j,q){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var d=0;function E(){return`id_${++d}`}function D(j){let q=0;for(let F=0;F<j.length;F++){let G=j.charCodeAt(F);q=(q<<5)-q+G,q=q&q}return Math.abs(q).toString(36)}function l(j){return j.charAt(0).toUpperCase()+j.slice(1)}function i(j){let q=[],F=/<script[^>]*>([\s\S]*?)<\/script>/gi,G;while((G=F.exec(j))!==null)q.push(G[1]);return q}function a(j){let q=[],F=/<style[^>]*>([\s\S]*?)<\/style>/gi,G;while((G=F.exec(j))!==null)q.push(G[1]);return q}function B(j){let q=j.type==="component"?1:0;if(j.children)for(let F of j.children)q+=B(F);return q}function b(j){let q=j.zigType.startsWith("craft.")?1:0;for(let F of j.children)q+=b(F);return q}function o(j){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:(q)=>{console.log(`[craft-compiler] File changed: ${q}`)}}}var t={compileToNative:k,createHotReloadServer:o,NATIVE_COMPONENTS:P},e=t;
8
- export{P as Xj,k as Yj,o as Zj,e as _j};
8
+ export{P as kk,k as lk,o as mk,e as nk};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ip as a,jp as b,kp as c,lp as d,mp as e,np as f}from"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{Broadcast as D,BroadcastServer as U}from"ts-broadcasting";import{channel as b}from"ts-broadcasting";import{Broadcast as N,BroadcastServer as p}from"ts-broadcasting";var z=null,H=[];function X(){return z}async function Y(j){if(z)return z;let k=j.driver??"bun",q=j.host??"0.0.0.0",G=j.port??6001,J=j.scheme??"ws",E={verbose:j.verbose??!1,driver:k,default:k,connections:{[k]:{driver:k,host:q,port:G,scheme:J}}};return z=new U(E),D.setServer(z),await z.start(),z}async function Z(){for(let j of H)clearInterval(j);if(H.length=0,!z)return;await z.stop(),z=null}async function $(j){let k=await import(j),q=k.default??k;if(typeof q!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof q}`);let G=0;return q({channel(E,A){if(G++,A.authorize&&z)z.channels.channel(E,A.authorize);if(A.interval&&A.data){let L=A.event??`${E}.updated`,M=A.data,Q=setInterval(async()=>{try{let T=await M();V(E,L,T)}catch{}},A.interval);H.push(Q)}}}),G}var K=!1;function F(){if(z)return!0;if(!K)K=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function V(j,k,q){if(!F())return;D.send(j,k,q)}function x(j,k,q){if(!F())return;D.toUser(j,k,q)}function C(j,k,q){if(!F())return;D.toUsers(j,k,q)}function S(j,k,q){if(!F())return;D.send(`private-${j}`,k,q)}function w(j,k,q){if(!F())return;D.presence(j,k,q)}
3
- export{X as qf,Y as rf,Z as sf,$ as tf,V as uf,x as vf,C as wf,S as xf,w as yf,b as zf,N as Af,p as Bf};
3
+ export{X as Wf,Y as Xf,Z as Yf,$ as Zf,V as _f,x as $f,C as ag,S as bg,w as cg,b as dg,N as eg,p as fg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ef as a}from"./chunk-983n86r5.js";import"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as buildApp};
2
+ import{ig as a}from"./chunk-512qkvya.js";import"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as buildApp};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$r as d,Yr as a,Zr as b,_r as c,as as e,bs as f}from"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
2
+ import{$r as d,Yr as a,Zr as b,_r as c,as as e,bs as f}from"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{f as validateConfig,b as resolveStxDirectories,c as loadStxConfig,e as defineStxConfig,a as defaultConfig,d as config};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{fl as _,gl as h}from"./chunk-ncvd7673.js";import{$r as p,Ol as g}from"./chunk-gz7j5eer.js";import{gt as N}from"./chunk-t0jzk81v.js";import W from"path";import q from"fs";var l=5,u=1;function t(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function L(...J){if(t())console.log("[stx:bundler]",...J)}var D=[];function v(J,K,$){D.push({filePath:J||"<inline>",message:K,details:$})}function Yz(){return D.slice()}function Zz(){D.length=0}var F;function $z(J){F=J}function b(){if(F)return F;try{let J=p.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var f=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function wz(J){let K=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,$;while(($=K.exec(J))!==null){let M=$[1];if(!f.some((z)=>z.test(M)))return L("detected user import:",M),!0}let Q=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while(($=Q.exec(J))!==null){let M=$[1];if(/\.css(?:\?.*)?$/.test(M))continue;if(!f.some((z)=>z.test(M)))return L("detected side-effect import:",M),!0}return!1}function i(J,K,$,Q){let M=(Z,z)=>{let G=Z===$?K:W.dirname(Z),Y=W.resolve(G,z),H=[Y,`${Y}.ts`,`${Y}.tsx`,`${Y}.js`,`${Y}.mjs`,`${Y}.jsx`,W.join(Y,"index.ts"),W.join(Y,"index.tsx"),W.join(Y,"index.js"),W.join(Y,"index.mjs")];for(let j of H)try{if(q.existsSync(j)&&q.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return Y};return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(z)=>({path:z.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(z)=>({path:z.path,external:!0})),Z.onResolve({filter:/^\//},(z)=>{if(q.existsSync(z.path))return{path:z.path};return{path:z.path,external:!0}}),Z.onResolve({filter:/^\.\.?\//},(z)=>{let G=M(z.importer,z.path);return Q.add(G),{path:G}}),Z.onResolve({filter:/^[@~]\//},(z)=>{let G=W.resolve(J,z.path.slice(2)),Y=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,W.join(G,"index.ts"),W.join(G,"index.tsx"),W.join(G,"index.js"),W.join(G,"index.mjs")];for(let H of Y)if(q.existsSync(H)&&q.statSync(H,{throwIfNoEntry:!1})?.isFile())return L(`resolved ${z.path[0]}/ import:`,z.path,"\u2192",H),Q.add(H),{path:H};return console.warn(`[stx:bundler] could not resolve ${z.path[0]}/ import:`,z.path),{path:G}}),Z.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(z)=>{let G=W.extname(z.path).toLowerCase(),Y=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(z.path!==$)Q.add(z.path);return{contents:q.readFileSync(z.path,"utf8"),loader:Y}})}}}var R=new Map,m=Symbol.for("stx.client-bundle-build-queue");function s(J){let K=globalThis,Q=(K[m]??Promise.resolve()).then(J,J);return K[m]=Q.then(()=>{return},()=>{return}),Q}async function Qz(J,K,$={}){let Q=$.projectRoot||process.cwd(),M=$.minify??!1,Z=$.cacheDir||N(Q,"bundle-cache"),z=new Bun.CryptoHasher("md5");z.update(`${l}\x00${J}\x00${K}`);let G=z.digest("hex").slice(0,12),Y=W.join(Z,`${G}.js`),H=W.join(Z,`${G}.deps.json`),j=Bun.file(Y);if(await j.exists()){let V=Bun.file(H),k=!0;if(await V.exists())try{let T=JSON.parse(await V.text());if(T.metadataVersion!==u||!Array.isArray(T.files))k=!1;for(let S of Array.isArray(T.files)?T.files:[])try{if(q.statSync(S.path).mtimeMs!==S.mtimeMs){k=!1;break}}catch{k=!1;break}}catch{k=!1}if(k)return L("cache hit:",G),await j.text();L("cache invalidated by dep change:",G)}let y=R.get(G);if(y)return await y;let x=s(()=>a(J,K,{projectRoot:Q,minify:M,cacheDir:Z,hash:G,cachePath:Y,depsPath:H}));R.set(G,x);try{return await x}finally{R.delete(G)}}async function a(J,K,$){let{projectRoot:Q,minify:M,cacheDir:Z,hash:z,cachePath:G,depsPath:Y}=$,H=N(Q,"bundle-tmp"),j=W.join(H,`${z}.ts`),y=W.join(H,"out",z);q.mkdirSync(H,{recursive:!0}),q.mkdirSync(y,{recursive:!0});let x=W.dirname(K),V=[],k=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,T=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,S;while((S=k.exec(J))!==null){if(S[1])continue;if(S[2])S[2].split(",").forEach((I)=>{let X=I.split(":")[0].trim();if(X)V.push(X)});else if(S[3])V.push(S[3])}while((S=T.exec(J))!==null){if(S[1])continue;V.push(S[2])}let B=V.length>0?`
2
+ import{fl as _,gl as h}from"./chunk-ncvd7673.js";import{$r as p,Ol as g}from"./chunk-061f3pf7.js";import{gt as N}from"./chunk-t0jzk81v.js";import W from"path";import q from"fs";var l=5,u=1;function t(J=process.env){return J.STX_DEBUG==="true"||J.STX_DEBUG==="1"}function L(...J){if(t())console.log("[stx:bundler]",...J)}var D=[];function v(J,K,$){D.push({filePath:J||"<inline>",message:K,details:$})}function Yz(){return D.slice()}function Zz(){D.length=0}var F;function $z(J){F=J}function b(){if(F)return F;try{let J=p.strict;return typeof J==="object"&&J!==null?J.bundlerFallback??"warn":"warn"}catch{return"warn"}}var f=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];function wz(J){let K=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,$;while(($=K.exec(J))!==null){let M=$[1];if(!f.some((z)=>z.test(M)))return L("detected user import:",M),!0}let Q=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while(($=Q.exec(J))!==null){let M=$[1];if(/\.css(?:\?.*)?$/.test(M))continue;if(!f.some((z)=>z.test(M)))return L("detected side-effect import:",M),!0}return!1}function i(J,K,$,Q){let M=(Z,z)=>{let G=Z===$?K:W.dirname(Z),Y=W.resolve(G,z),H=[Y,`${Y}.ts`,`${Y}.tsx`,`${Y}.js`,`${Y}.mjs`,`${Y}.jsx`,W.join(Y,"index.ts"),W.join(Y,"index.tsx"),W.join(Y,"index.js"),W.join(Y,"index.mjs")];for(let j of H)try{if(q.existsSync(j)&&q.statSync(j,{throwIfNoEntry:!1})?.isFile())return j}catch{}return Y};return{name:"stx-client-bundle",setup(Z){Z.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(z)=>({path:z.path,external:!0})),Z.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(z)=>({path:z.path,external:!0})),Z.onResolve({filter:/^\//},(z)=>{if(q.existsSync(z.path))return{path:z.path};return{path:z.path,external:!0}}),Z.onResolve({filter:/^\.\.?\//},(z)=>{let G=M(z.importer,z.path);return Q.add(G),{path:G}}),Z.onResolve({filter:/^[@~]\//},(z)=>{let G=W.resolve(J,z.path.slice(2)),Y=[G,`${G}.ts`,`${G}.tsx`,`${G}.js`,`${G}.mjs`,`${G}.jsx`,W.join(G,"index.ts"),W.join(G,"index.tsx"),W.join(G,"index.js"),W.join(G,"index.mjs")];for(let H of Y)if(q.existsSync(H)&&q.statSync(H,{throwIfNoEntry:!1})?.isFile())return L(`resolved ${z.path[0]}/ import:`,z.path,"\u2192",H),Q.add(H),{path:H};return console.warn(`[stx:bundler] could not resolve ${z.path[0]}/ import:`,z.path),{path:G}}),Z.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(z)=>{let G=W.extname(z.path).toLowerCase(),Y=G===".json"?"json":G===".tsx"?"tsx":G===".jsx"?"jsx":G===".ts"||G===".mts"||G===".cts"?"ts":"js";if(z.path!==$)Q.add(z.path);return{contents:q.readFileSync(z.path,"utf8"),loader:Y}})}}}var R=new Map,m=Symbol.for("stx.client-bundle-build-queue");function s(J){let K=globalThis,Q=(K[m]??Promise.resolve()).then(J,J);return K[m]=Q.then(()=>{return},()=>{return}),Q}async function Qz(J,K,$={}){let Q=$.projectRoot||process.cwd(),M=$.minify??!1,Z=$.cacheDir||N(Q,"bundle-cache"),z=new Bun.CryptoHasher("md5");z.update(`${l}\x00${J}\x00${K}`);let G=z.digest("hex").slice(0,12),Y=W.join(Z,`${G}.js`),H=W.join(Z,`${G}.deps.json`),j=Bun.file(Y);if(await j.exists()){let V=Bun.file(H),k=!0;if(await V.exists())try{let T=JSON.parse(await V.text());if(T.metadataVersion!==u||!Array.isArray(T.files))k=!1;for(let S of Array.isArray(T.files)?T.files:[])try{if(q.statSync(S.path).mtimeMs!==S.mtimeMs){k=!1;break}}catch{k=!1;break}}catch{k=!1}if(k)return L("cache hit:",G),await j.text();L("cache invalidated by dep change:",G)}let y=R.get(G);if(y)return await y;let x=s(()=>a(J,K,{projectRoot:Q,minify:M,cacheDir:Z,hash:G,cachePath:Y,depsPath:H}));R.set(G,x);try{return await x}finally{R.delete(G)}}async function a(J,K,$){let{projectRoot:Q,minify:M,cacheDir:Z,hash:z,cachePath:G,depsPath:Y}=$,H=N(Q,"bundle-tmp"),j=W.join(H,`${z}.ts`),y=W.join(H,"out",z);q.mkdirSync(H,{recursive:!0}),q.mkdirSync(y,{recursive:!0});let x=W.dirname(K),V=[],k=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,T=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,S;while((S=k.exec(J))!==null){if(S[1])continue;if(S[2])S[2].split(",").forEach((I)=>{let X=I.split(":")[0].trim();if(X)V.push(X)});else if(S[3])V.push(S[3])}while((S=T.exec(J))!==null){if(S[1])continue;V.push(S[2])}let B=V.length>0?`
3
3
  export { ${V.join(", ")} }`:"";await Bun.write(j,J+B),L("bundling:",z,"from:",W.basename(K));let P=new Set;try{let I=await Bun.build({entrypoints:[j],outdir:y,target:"browser",format:"esm",minify:M,plugins:[i(Q,x,j,P)],define:{"process.env.NODE_ENV":M?'"production"':'"development"',...g()},root:Q});if(!I.success){let U=I.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ")||`Unable to bundle ${W.basename(K)}`,A=_(I.logs,K||void 0);if(console.warn("[stx:bundler] build failed:",U),v(K||"",U,A),b()==="error")throw Error(U);return J}let X="";for(let w of I.outputs){X=await w.text();break}let O=[];for(let w of X.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let U of w[1].split(",")){let A=U.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(A){O.push([A[2],A[1]]);continue}let C=U.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))O.push([C,C])}let c=X.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];X=X.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let E=`__stxBundle_${z}`,n=O.map(([w,U])=>`${JSON.stringify(w)}: ${U}`).join(", "),o=O.map(([w])=>`var ${w} = undefined;`).join(`
4
4
  `),r=O.map(([w])=>`${w} = ${E}[${JSON.stringify(w)}];`).join(`
5
5
  `);if(X=`${c.join(`
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{jm as a,km as b,lm as c,mm as d,nm as e,om as f,pm as g,qm as h,rm as i,sm as j,tm as k,um as l,vm as m,wm as n,xm as o}from"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{h as usesSignalsInScript,o as unescapeHtml,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,n as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
2
+ import{jm as a,km as b,lm as c,mm as d,nm as e,om as f,pm as g,qm as h,rm as i,sm as j,tm as k,um as l,vm as m,wm as n,xm as o}from"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{h as usesSignalsInScript,o as unescapeHtml,c as registerFilters,b as registerFilter,l as processExpressions,k as interpolateScriptsInTemplate,i as interpolateScriptExpressions,j as interpolateScriptAttributes,d as getAllFilters,n as evaluateExpression,g as escapeHtmlValue,f as escapeHtml,a as defaultFilters,e as clearCustomFilters,m as applyFilters};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{jh as a,kh as b,lh as c,mh as d,nh as e,oh as f}from"./chunk-vyzat3rg.js";import"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
2
+ import{uh as a,vh as b,wh as c,xh as d,yh as e,zh as f}from"./chunk-r3k599q0.js";import"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{c as renderSlot,d as processSlots,a as parseSlots,b as parseSlotElement,e as extractSlotContent,f as applySlots};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{gg as a,hg as b}from"./chunk-6pzgmp1h.js";import"./chunk-m38wyaes.js";import"./chunk-q891e1vj.js";export{a as handleImageRequest,b as createImageHandler};
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ng as p}from"./chunk-ytr18qnm.js";import{ch as a,eh as JF,fh as ZF,gh as qF}from"./chunk-k99zfk6j.js";import{Bj as C,Cj as D}from"./chunk-6rjc6687.js";import{Ck as QF,Dk as XF,Ek as YF}from"./chunk-c0n802j1.js";import{Bq as c,Km as u,Pp as o,Yr as n,_r as N,bm as l,bq as e,dm as d,iq as t,jq as FF}from"./chunk-gz7j5eer.js";import{Ws as r}from"./chunk-ezpz476c.js";import{su as S,uu as WF}from"./chunk-bqdbf8k2.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function UF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as GF}from"crypto";function VF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("sha256").update(X).digest("hex").slice(0,16);l();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>p($))),{context:E}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),L=new Set,_={...n,...K,...z,buildMode:"compile",strict:!1},w=await c(X,E,Q,_,L),U=a(w),H=d();return{route:q,sourceFile:J,html:w,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(L),contentHash:I,status:u(X),streamTemplates:E.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(kF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function lF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,E=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let L=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of L)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let _=FF(z),w=["components","layouts","partials"],U=_.filter((Y)=>{return!w.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${_.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await i(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=t(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=o(F.html,W);if(k.htmlAttrs)F.html=e(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await r(F.html),F.fragment=JF(F.html,E);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=s(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,Q);let x=Date.now()-q;return console.log(`
2
+ import{Pf as p}from"./chunk-5ys0zfgp.js";import{Fg as a,Hg as JF,Ig as ZF,Jg as qF}from"./chunk-we3731c4.js";import{Bj as C,Cj as D}from"./chunk-6rjc6687.js";import{Ck as QF,Dk as XF,Ek as YF}from"./chunk-c0n802j1.js";import{Bq as c,Km as u,Pp as o,Yr as n,_r as N,bm as l,bq as e,dm as d,iq as t,jq as FF}from"./chunk-061f3pf7.js";import{Ws as r}from"./chunk-x3gv35ke.js";import{su as S,uu as WF}from"./chunk-bqdbf8k2.js";import G from"fs";import Z from"path";import{createHash as $F}from"crypto";WF();function g(J){return $F("sha256").update(J).digest("hex").slice(0,8)}function f(J=!1){let q=J?D():C(),z=g(q);return{content:q,filename:`runtime.${z}.js`,hash:z}}function m(){let J=S(),q=g(J);return{content:J,filename:`router.${q}.js`,hash:q}}function UF(J){return{runtimeTag:J.runtime?`<script src="/__stx/${J.runtime.filename}"></script>`:"",routerTag:J.router?`<script src="/__stx/${J.router.filename}"></script>`:"",cssTag:J.css?`<link rel="stylesheet" href="/__stx/${J.css.filename}">`:""}}import h from"path";import{createHash as GF}from"crypto";function VF(J={}){let q=new Set;return{context:new Proxy(J,{get(Q,X){if(X in Q)return Q[X];if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return},has(Q,X){if(X in Q)return!0;if(typeof X==="string"&&!X.startsWith("__"))q.add(X);return!1}}),accessedKeys:q}}async function i(J,q,z={}){let Q=h.resolve(J),X=await Bun.file(Q).text(),I=GF("sha256").update(X).digest("hex").slice(0,16);l();let K={};try{K=await N()}catch{}let B=[],V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k;while((k=V.exec(X))!==null){let $=k[1];if(/\bserver\b/.test($))B.push(k[2])}let W=new Set(B.flatMap(($)=>p($))),{context:E}=VF({__filename:Q,__dirname:h.dirname(Q),__stx_serverDeclared:W}),L=new Set,_={...n,...K,...z,buildMode:"compile",strict:!1},w=await c(X,E,Q,_,L),U=a(w),H=d();return{route:q,sourceFile:J,html:w,fragment:U,placeholders:H,hasServerScripts:B.length>0,serverScriptContent:B,dependencies:Array.from(L),contentHash:I,status:u(X),streamTemplates:E.__streamTemplates}}var kF=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"]);function s(J,q){let z=0,Q=0;if(!G.existsSync(J))return{copied:z,bytes:Q};G.mkdirSync(q,{recursive:!0});function X(I,K){let B=G.readdirSync(I,{withFileTypes:!0});for(let V of B){if(kF.has(V.name))continue;let k=Z.join(I,V.name),W=Z.join(K,V.name);if(V.isDirectory())G.mkdirSync(W,{recursive:!0}),X(k,W);else if(V.isFile()){if(G.existsSync(W))continue;G.copyFileSync(k,W),z++,Q+=G.statSync(W).size}}}return X(J,q),{copied:z,bytes:Q}}async function lF(J={}){let q=Date.now(),z=Z.resolve(J.root||process.cwd()),Q=Z.resolve(z,J.outputDir||".output");console.log("[stx build] Starting production build...");let X={};try{X=await N()}catch{}let I=J.componentsDir??X.componentsDir??"components",K=J.partialsDir??X.partialsDir??"partials",B=J.layoutsDir??X.layoutsDir??"layouts",V=J.publicDir??X.publicDir??"public",k=X.app?.head||{},W=X.app?.colorMode,E=X.router?.container||"main";if(G.existsSync(Q))G.rmSync(Q,{recursive:!0});let L=[Z.join(Q,"public","__stx"),Z.join(Q,"public","assets"),Z.join(Q,"server","pages"),Z.join(Q,"server","fragments")];for(let Y of L)G.mkdirSync(Y,{recursive:!0});console.log("[stx build] Discovering routes...");let _=FF(z),w=["components","layouts","partials"],U=_.filter((Y)=>{return!w.some((F)=>Y.pattern.startsWith(`/${F}/`)||Y.pattern===`/${F}`)});console.log(`[stx build] Found ${U.length} page routes (${_.length-U.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=f(J.debug),$=m();await Bun.write(Z.join(Q,"public","__stx",H.filename),H.content),await Bun.write(Z.join(Q,"public","__stx",$.filename),$.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${$.filename} (${($.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let O=[],j=[];for(let Y of U)try{let F=await i(Y.filePath,Y.pattern,{componentsDir:I,partialsDir:K,layoutsDir:B,debug:J.debug});if(O.push(F),F.html=F.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,$.filename),F.html=t(F.html,k,{bodyScripts:[`<script src="/__stx/${$.filename}"></script>`],...W&&{colorMode:W}}),W)F.html=o(F.html,W);if(k.htmlAttrs)F.html=e(F.html,k.htmlAttrs);if(!/<body[^>]*\bdata-stx=/.test(F.html)){let T=F.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(T&&T[1]){let P=T[1];F.html=F.html.replace(" "+P,""),F.html=F.html.replace(/<body([^>]*)>/,`<body$1 ${P}>`)}}F.html=F.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),F.html=await r(F.html),F.fragment=JF(F.html,E);let y=Y.pattern==="/"?"index":Y.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),b=Z.join("server","pages",`${y}.compiled.json`),A=Z.join("server","fragments",`${y}.html`);await Bun.write(Z.join(Q,b),JSON.stringify(F,null,2)),await Bun.write(Z.join(Q,A),F.fragment),j.push({pattern:Y.pattern,compiledPath:b,fragmentPath:A,isDynamic:F.hasServerScripts,hasParams:Y.pattern.includes(":")||Y.pattern.includes("[")}),console.log(`[stx build] \u2713 ${Y.pattern}`)}catch(F){console.error(`[stx build] \u2717 ${Y.pattern}:`,F instanceof Error?F.message:F)}let M=Z.resolve(z,V);if(G.existsSync(M)){let{copied:Y,bytes:F}=s(M,Z.join(Q,"public"));if(Y>0)console.log(`[stx build] Copied ${Y} public asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${V}/`)}let v=YF(z);if(v){let{copied:Y,bytes:F}=s(v,Z.join(Q,"public",XF));if(Y>0)console.log(`[stx build] Copied ${Y} asset${Y===1?"":"s"} (${(F/1024).toFixed(1)}KB) from ${QF}/`)}let R={runtime:H.filename,router:$.filename},zF=ZF(j,R,Q);qF(zF,Q);let x=Date.now()-q;return console.log(`
3
3
  [stx build] Done in ${x}ms \u2014 ${O.length} pages compiled`),{pageCount:O.length,assets:R,outputDir:Q,duration:x}}
4
- export{g as Dg,f as Eg,m as Fg,UF as Gg,i as Hg,lF as Ig};
4
+ export{g as Ff,f as Gf,m as Hf,UF as If,i as Jf,lF as Kf};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Jg as S,Kg as s,Lg as i,Og as t,Pg as e,Qg as HH,Rg as KH,Sg as QH,Tg as YH}from"./chunk-ytr18qnm.js";import{_i as a}from"./chunk-txkh4qz0.js";import{gt as h}from"./chunk-t0jzk81v.js";import{At as f}from"./chunk-myh6j9ab.js";import{existsSync as ZH,readFileSync as XH}from"fs";import J from"path";function qH(K,Q="",V=""){let U=K.startLine>1?`
2
+ import{Lf as S,Mf as s,Nf as i,Qf as t,Rf as e,Sf as HH,Tf as KH,Uf as QH,Vf as YH}from"./chunk-5ys0zfgp.js";import{_i as a}from"./chunk-7jbfha4x.js";import{gt as h}from"./chunk-t0jzk81v.js";import{At as f}from"./chunk-myh6j9ab.js";import{existsSync as ZH,readFileSync as XH}from"fs";import J from"path";function qH(K,Q="",V=""){let U=K.startLine>1?`
3
3
  `.repeat(K.startLine-1):"",E=i(s(K.code)),X=K.kind==="client"||K.kind==="plain"?e(Q,K.code):"";return KH(`${U+E}
4
4
  ${X}
5
5
  export {}
@@ -15,4 +15,4 @@ ${b.trim().split(`
15
15
  `).slice(0,12).join(`
16
16
  `)||"(no output)"}`:void 0;return{diagnostics:D,checkedFiles:q,blockCount:B,expressionCount:T,failure:VH}}function PH(K){return K.map((Q)=>{let V=Q.blockKind==="template"?`[template: ${Q.expression??""}]`:`[${Q.blockKind==="plain"?"<script>":`<script ${Q.blockKind}>`}]`;return`${Q.file}:${Q.line}:${Q.column} ${Q.category} TS${Q.code} ${Q.message} ${V}`}).join(`
17
17
  `)}
18
- export{qH as hf,r as if,wH as jf,MH as kf,TH as lf,PH as mf};
18
+ export{qH as wf,r as xf,wH as yf,MH as zf,TH as Af,PH as Bf};
@@ -27,4 +27,4 @@ Check your site ID or create a new site at https://app.netlify.com`,"SITE_NOT_FO
27
27
  `))Q+=`
28
28
  `}Q+=`NETLIFY_SITE_ID=${K.siteId}
29
29
  `,await Bun.write(W,Q)}return{configPath:V,siteId:K.siteId}}class R extends Error{code;constructor(K,L){super(K);this.name="DeployError",this.code=L}}function d(K){let L=process.platform,V=L==="darwin"?"open":L==="win32"?"start":"xdg-open";Bun.spawn([V,K],{stdio:["ignore","ignore","ignore"]})}
30
- export{D as Rf,h as Sf,x as Tf,T as Uf,v as Vf,z as Wf,N as Xf,u as Yf,j as Zf,q as _f,b as $f,P as ag,n as bg,i as cg,R as dg};
30
+ export{D as Xe,h as Ye,x as Ze,T as _e,v as $e,z as af,N as bf,u as cf,j as df,q as ef,b as ff,P as gf,n as hf,i as if,R as jf};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Yi as a,Zi as b}from"./chunk-b0h9pk4g.js";import"./chunk-efr3ejqt.js";import"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as getStoreScript,b as clearStoreCache};
2
+ import{Yi as a,Zi as b}from"./chunk-65yw97a2.js";import"./chunk-efr3ejqt.js";import"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as getStoreScript,b as clearStoreCache};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{pf as a}from"./chunk-vsq2a4yp.js";import"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as startInteractive};
2
+ import{Ef as a}from"./chunk-9nnq8xrq.js";import"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as startInteractive};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Aj as n,nj as a,oj as b,pj as c,qj as d,rj as e,sj as f,tj as g,uj as h,vj as i,wj as j,xj as k,yj as l,zj as m}from"./chunk-0sn2mc3a.js";import"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
2
+ import{Aj as n,nj as a,oj as b,pj as c,qj as d,rj as e,sj as f,tj as g,uj as h,vj as i,wj as j,xj as k,yj as l,zj as m}from"./chunk-7xwjaqh9.js";import"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{i as streamingSuspenseDirective,m as streamToResponse,g as streamTemplateSimple,a as streamTemplate,d as renderStreamingPage,k as registerStreamingDirectives,e as processStreamDirectives,l as processSectionDirectives,j as islandDirective,n as generateHydrationRuntime,f as extractStreamBoundaries,h as createStreamRenderer,b as buildSuspenseResolveScript,c as SUSPENSE_RESOLVER_RUNTIME};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{Eu as l}from"./chunk-q891e1vj.js";import U from"fs";import G from"path";import I from"os";import H from"crypto";import{generatePlaceholder as m,processImage as g}from"ts-images";var d=[320,640,768,1024,1280,1536,1920],h=["webp","jpeg"],b=80,u=[".jpg",".jpeg",".png",".webp",".avif",".gif",".svg"],P={webp:"image/webp",avif:"image/avif",jpeg:"image/jpeg",png:"image/png"},N=null,W=!1;async function Y(){if(W)return N;W=!0;try{let J=await import("sharp");return N=J.default||J,N}catch{return null}}async function e(){return await Y()!==null}async function t(){return!0}async function JJ(J,K={}){let{widths:Z=d,formats:$=h,quality:q=b,fit:C="cover",placeholder:X="none",outputDir:Q=".stx/images",baseUrl:_="/images"}=K,j,x;if(typeof J==="string"){if(x=J,!await Bun.file(J).exists())throw new L(`Image not found: ${J}`,"NOT_FOUND");j=await Bun.file(J).arrayBuffer().then((V)=>Buffer.from(V))}else x="buffer-input",j=J;let w=H.createHash("sha256").update(j).digest("hex").slice(0,12),y=await O(j),{width:B,height:D}=y,A=B/D;await U.promises.mkdir(Q,{recursive:!0});let T=[],v=G.basename(x,G.extname(x)),z=Z.filter((V)=>V<=B);if(!z.includes(B)&&B<=Math.max(...Z))z.push(B);z.sort((V,R)=>V-R);for(let V of z){let R=Math.round(V/A);for(let F of $){let S=`${v}-${V}w-${w}.${F}`,k=G.join(Q,S),c=`${_}/${S}`,E=await n(j,{width:V,height:R,format:F,quality:q,fit:C});await Bun.write(k,E),T.push({path:k,url:c,width:V,height:R,format:F,size:E.length})}}let M;if(X!=="none")M=await o(j,X);return{src:x,variants:T,placeholder:M,width:B,height:D,aspectRatio:A,hash:w}}async function O(J){let K=typeof J==="string"?Buffer.from(await Bun.file(J).arrayBuffer()):J,Z=await Y();if(Z){let q=await Z(K).metadata();return{width:q.width||0,height:q.height||0,format:q.format||"unknown",hasAlpha:q.hasAlpha}}return p(K)}function p(J){if(J[0]===137&&J[1]===80&&J[2]===78&&J[3]===71){let K=J.readUInt32BE(16),Z=J.readUInt32BE(20);return{width:K,height:Z,format:"png",hasAlpha:!0}}if(J[0]===255&&J[1]===216){let K=2;while(K<J.length){if(J[K]!==255)break;let Z=J[K+1];if(Z>=192&&Z<=207&&Z!==196&&Z!==200&&Z!==204){let q=J.readUInt16BE(K+5);return{width:J.readUInt16BE(K+7),height:q,format:"jpeg",hasAlpha:!1}}let $=J.readUInt16BE(K+2);K+=2+$}}if(J.toString("utf8",0,4)==="RIFF"&&J.toString("utf8",8,12)==="WEBP"){let K=J.toString("utf8",12,16);if(K==="VP8 "){let Z=J.readUInt16LE(26)&16383,$=J.readUInt16LE(28)&16383;return{width:Z,height:$,format:"webp",hasAlpha:!1}}if(K==="VP8L"){let Z=J.readUInt32LE(21),$=(Z&16383)+1,q=(Z>>14&16383)+1;return{width:$,height:q,format:"webp",hasAlpha:!0}}}if(J.toString("utf8",0,3)==="GIF"){let K=J.readUInt16LE(6),Z=J.readUInt16LE(8);return{width:K,height:Z,format:"gif",hasAlpha:!0}}throw new L("Unable to parse image dimensions","PARSE_ERROR")}async function n(J,K){let Z=await Y();if(Z){let q=Z(J).resize(K.width,K.height,{fit:K.fit});switch(K.format){case"webp":q=q.webp({quality:K.quality});break;case"avif":q=q.avif({quality:K.quality});break;case"jpeg":q=q.jpeg({quality:K.quality});break;case"png":q=q.png({quality:K.quality});break}return q.toBuffer()}let $=G.join(I.tmpdir(),`stx-img-${H.randomBytes(8).toString("hex")}.${K.format}`);try{return await g({input:J,output:$,format:K.format,quality:K.quality,resize:{width:K.width,height:K.height,fit:K.fit}}),Buffer.from(await Bun.file($).arrayBuffer())}finally{await U.promises.unlink($).catch(()=>{})}}async function o(J,K){let Z=await Y();if(K==="blur"&&Z){let X=(await Z(J).resize(20).blur(10).toBuffer()).toString("base64"),Q=await O(J);return`data:${P[Q.format]||"image/jpeg"};base64,${X}`}if(K==="dominant-color"&&Z){let{dominant:C}=await Z(J).resize(1,1).toBuffer().then(async(X)=>{let Q=await Z(X).metadata();return{dominant:{r:128,g:128,b:128}}}).catch(()=>({dominant:{r:128,g:128,b:128}}));return`rgb(${C.r}, ${C.g}, ${C.b})`}let $=await O(J),q=G.join(I.tmpdir(),`stx-ph-${H.randomBytes(8).toString("hex")}.${$.format==="unknown"?"bin":$.format}`);try{await Bun.write(q,J);let C=K==="blur"?"blur":K==="thumbhash"?"thumbhash":"dominant-color",Q=await m(q,{strategy:C,width:C==="thumbhash"?void 0:32});if(K==="dominant-color"&&Q.dominantColor)return Q.dominantColor;if(Q.dataURL)return Q.dataURL;return"rgb(128, 128, 128)"}catch{return"rgb(128, 128, 128)"}finally{await U.promises.unlink(q).catch(()=>{})}}function KJ(J,K){return(K?J.filter(($)=>$.format===K):J).sort(($,q)=>$.width-q.width).map(($)=>`${$.url} ${$.width}w`).join(", ")}function ZJ(J){if(!J||Object.keys(J).length===0)return"100vw";return Object.entries(J).sort((Z,$)=>{let q=Number.parseInt(Z[0].replace(/\D/g,""))||0;return(Number.parseInt($[0].replace(/\D/g,""))||0)-q}).map(([Z,$])=>`(max-width: ${Z}) ${$}`).join(", ")+", 100vw"}function $J(J){let K=J.filter(($)=>$.format==="jpeg");if(K.length===0)return J[Math.floor(J.length/2)];let Z=K.sort(($,q)=>$.width-q.width);return Z[Math.floor(Z.length/2)]}function qJ(J){let K=new Map;for(let Z of J){let $=K.get(Z.format)||[];$.push(Z),K.set(Z.format,$)}return K}function CJ(J){let K=G.extname(J).toLowerCase();return u.includes(K)}function QJ(J){return P[J]||"application/octet-stream"}function VJ(J){return J.reduce((K,Z)=>K+Z.size,0)}function XJ(J){if(J<1024)return`${J} B`;if(J<1048576)return`${(J/1024).toFixed(1)} KB`;return`${(J/1048576).toFixed(2)} MB`}class L extends Error{code;constructor(J,K){super(J);this.name="ImageProcessingError",this.code=K}}
3
- export{d as mg,h as ng,b as og,e as pg,t as qg,JJ as rg,O as sg,n as tg,KJ as ug,ZJ as vg,$J as wg,qJ as xg,CJ as yg,QJ as zg,VJ as Ag,XJ as Bg,L as Cg};
3
+ export{d as ch,h as dh,b as eh,e as fh,t as gh,JJ as hh,O as ih,n as jh,KJ as kh,ZJ as lh,$J as mh,qJ as nh,CJ as oh,QJ as ph,VJ as qh,XJ as rh,L as sh};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  function D(j){return j}class F{plugins=new Map;sortedPlugins=[];initialized=!1;async register(j,q){if(this.plugins.has(j.name))throw Error(`Plugin "${j.name}" is already registered`);if(j.dependencies){for(let w of j.dependencies)if(!this.plugins.has(w))throw Error(`Plugin "${j.name}" depends on "${w}" which is not registered`)}if(this.plugins.set(j.name,j),j.onRegister)await j.onRegister(q);this.sortPlugins()}async unregister(j){let q=this.plugins.get(j);if(!q)return!1;for(let[w,z]of this.plugins)if(z.dependencies?.includes(j))throw Error(`Cannot unregister "${j}" because "${w}" depends on it`);if(q.onUnregister)await q.onUnregister();return this.plugins.delete(j),this.sortPlugins(),!0}get(j){return this.plugins.get(j)}has(j){return this.plugins.has(j)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let j=[];for(let q of this.sortedPlugins)if(q.registerDirectives)j.push(...q.registerDirectives());return j}getAllFilters(){let j={};for(let q of this.sortedPlugins)if(q.registerFilters)Object.assign(j,q.registerFilters());return j}async runBeforeProcess(j){return this.runHooks("beforeProcess",j)}async runAfterParse(j){return this.runHooks("afterParse",j)}async runBeforeDirective(j,q){return this.runDirectiveHooks("beforeDirective",j,q)}async runAfterDirective(j,q){return this.runDirectiveHooks("afterDirective",j,q)}async runBeforeRender(j){return this.runHooks("beforeRender",j)}async runAfterRender(j){return this.runHooks("afterRender",j)}async runOnError(j){for(let q of this.sortedPlugins)if(q.onError)try{let w=await q.onError(j);if(w){if(w.template!==void 0)j.template=w.template;if(w.context)j.context={...j.context,...w.context};if(w.metadata)j.metadata={...j.metadata,...w.metadata};if(w.skip)return j}}catch(w){console.error(`Error in plugin "${q.name}" onError hook:`,w)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((j,q)=>(j.priority??100)-(q.priority??100))}async runHooks(j,q){let w={...q};for(let z of this.sortedPlugins){let B=z[j];if(B)try{let y=await B(w);if(y){if(y.template!==void 0)w.template=y.template;if(y.context)w.context={...w.context,...y.context};if(y.metadata)w.metadata={...w.metadata,...y.metadata};if(y.skip)break}}catch(y){console.error(`Error in plugin "${z.name}" ${j} hook:`,y)}}return w}async runDirectiveHooks(j,q,w){let z={...w};for(let B of this.sortedPlugins){let y=B[j];if(y)try{let A=await y(q,z);if(A){if(A.template!==void 0)z.template=A.template;if(A.context)z.context={...z.context,...A.context};if(A.metadata)z.metadata={...z.metadata,...A.metadata};if(A.skip)break}}catch(A){console.error(`Error in plugin "${B.name}" ${j} hook:`,A)}}return z}}var G=new F;function H(j,q,w={}){return{name:j,...w,registerDirectives:()=>q}}function I(j,q,w={}){return{name:j,...w,registerFilters:()=>q}}var J=D({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(j){console.log("[stx-debug] beforeProcess:",j.filePath)},afterParse(j){console.log("[stx-debug] afterParse:",j.template.length,"chars")},beforeDirective(j,q){console.log("[stx-debug] beforeDirective:",j)},afterDirective(j,q){console.log("[stx-debug] afterDirective:",j)},beforeRender(j){console.log("[stx-debug] beforeRender")},afterRender(j){console.log("[stx-debug] afterRender:",j.template.length,"chars")},onError(j){console.error("[stx-debug] onError:",j.error.message,"in phase:",j.phase)}}),K=D({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(j){j.metadata.startTime=performance.now()},afterRender(j){let q=j.metadata.startTime;if(q){let w=performance.now()-q;console.log(`[stx-timing] Processing took ${w.toFixed(2)}ms`)}}});function L(j){return D({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(q){return{context:{...q.context,...j}}}})}
3
- export{D as eg,F as fg,G as gg,H as hg,I as ig,J as jg,K as kg,L as lg};
3
+ export{D as Wg,F as Xg,G as Yg,H as Zg,I as _g,J as $g,K as ah,L as bh};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Qf as a}from"./chunk-hg6ygmwr.js";import"./chunk-k99zfk6j.js";import"./chunk-gz7j5eer.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-ezpz476c.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as startProductionServer};
2
+ import{ug as a}from"./chunk-8z29ty0t.js";import"./chunk-we3731c4.js";import"./chunk-061f3pf7.js";import"./chunk-by2p4by1.js";import"./chunk-a2ppgamd.js";import"./chunk-dmzc008f.js";import"./chunk-nstqd54d.js";import"./chunk-x3gv35ke.js";import"./chunk-kqjxwz6c.js";import"./chunk-t0jzk81v.js";import"./chunk-njc6sven.js";import"./chunk-70v7vvry.js";import"./chunk-myh6j9ab.js";import"./chunk-bqdbf8k2.js";import"./chunk-ge69r310.js";import"./chunk-q891e1vj.js";export{a as startProductionServer};