// @bun
var{defineProperty:E,getOwnPropertyNames:L,getOwnPropertyDescriptor:N}=Object,O=Object.prototype.hasOwnProperty;function Q(q){return this[q]}var C=(q)=>{var x=(I??=new WeakMap).get(q),z;if(x)return x;if(x=E({},"__esModule",{value:!0}),q&&typeof q==="object"||typeof q==="function"){for(var B of L(q))if(!O.call(x,B))E(x,B,{get:Q.bind(q,B),enumerable:!(z=N(q,B))||z.enumerable})}return I.set(q,x),x},I;var U=(q)=>q;function W(q,x){this[q]=U.bind(null,x)}var M=(q,x)=>{for(var z in x)E(q,z,{get:x[z],enumerable:!0,configurable:!0,set:W.bind(x,z)})};var T=(q,x)=>()=>(q&&(x=q(q=0)),x);var h=import.meta.require;function A(q,x){if(typeof window>"u")return x;return window[q]??x}function D(q,x){if(typeof window>"u")return;window[q]=x}function J(q){let z=A("__STX_STORES__",{})[q];if(!z)throw Error(`Store "${q}" not found. Make sure it's defined with defineStore().`);return z}function p(q){return J(q)}function P(q){let x=A("__STX_STORES__",{});return q in x}function R(){let q=A("__STX_STORES__",{});return Object.keys(q)}function f(q,x=5000){return new Promise((z,B)=>{let K=Date.now(),F=()=>{let H=J(q);if(H)z(H);else if(Date.now()-K>x)B(Error(`Timeout waiting for store "${q}"`));else requestAnimationFrame(F)};F()})}function Y(){return A("__STX_ROUTE_PARAMS__",{})}function Z(q){return Y()[q]}function S(q){let x=Z(q);if(x===void 0)throw Error(`Route parameter "${q}" not found`);return x}function _(){return A("__STX_MIDDLEWARE_STATE__",{})}function V(q){return _()[q]}function d(){if(typeof window>"u")return;if(!A("__STX_STORES__",null))D("__STX_STORES__",{})}function i(q,x){let z=A("__STX_STORES__",{});z[q]=x,D("__STX_STORES__",z)}function y(){return A("__STX_STORE_STATE__",null)}function g(q){D("__STX_ROUTE_PARAMS__",q)}function v(q){D("__STX_MIDDLEWARE_STATE__",q)}function $(){return typeof window>"u"}function w(){return typeof window<"u"}function G(q){if(w())q()}function k(q){if($())q()}export{f as waitForStore,p as useStoreOrThrow,J as useStore,Y as useRouteParams,S as useRouteParamOrThrow,Z as useRouteParam,V as useMiddlewareValue,_ as useMiddlewareState,g as setRouteParams,v as setMiddlewareState,i as registerStore,k as onServer,G as onClient,$ as isServer,w as isClient,d as initStoreRegistry,P as hasStore,R as getStoreNames,y as getHydratedStoreState};
