/**
* Store state serialization for SSR.
*
* Provides utilities to serialize store state into a `'
* ```
*
* @example
* ```ts
* // Serialize only specific stores
* const { scriptTag } = serializeStoreState({ storeIds: ['counter'] });
* ```
*/
export declare const serializeStoreState: (options?: SerializeOptions) => SerializeResult;
/**
* Deserializes store state from the global variable set by the SSR script tag.
*
* Call this on the client before creating stores to pre-populate them with
* server-rendered state. After deserialization, the script tag and global
* variable are cleaned up automatically.
*
* @param globalKey - The global variable name where state was serialized
* @param scriptId - The ID of the SSR script tag to remove after hydration
* @returns The deserialized state map, or an empty object if not found
*
* @example
* ```ts
* import { deserializeStoreState } from '@bquery/bquery/ssr';
*
* // Call before creating stores
* const state = deserializeStoreState();
* // state = { counter: { count: 42 } }
* ```
*/
export declare const deserializeStoreState: (globalKey?: string, scriptId?: string) => DeserializedStoreState;
/**
* Hydrates a store with pre-serialized state from SSR.
*
* If the store exists and has a `$patch` method, this applies the
* deserialized state as a patch. Otherwise, the state is ignored.
*
* @param storeId - The store ID to hydrate
* @param state - The plain state object to apply
*
* @example
* ```ts
* import { hydrateStore, deserializeStoreState } from '@bquery/bquery/ssr';
* import { createStore } from '@bquery/bquery/store';
*
* // 1. Deserialize state from SSR script tag
* const ssrState = deserializeStoreState();
*
* // 2. Create store (gets initial values from factory)
* const store = createStore({
* id: 'counter',
* state: () => ({ count: 0 }),
* });
*
* // 3. Apply SSR state
* if (ssrState.counter) {
* hydrateStore('counter', ssrState.counter);
* }
* // store.count is now 42 (from SSR)
* ```
*/
export declare const hydrateStore: (storeId: string, state: Record) => void;
/**
* Hydrates all stores at once from a deserialized state map.
*
* Convenience wrapper that calls `hydrateStore` for each entry in the state map.
*
* @param stateMap - Map of store IDs to their state objects
*
* @example
* ```ts
* import { hydrateStores, deserializeStoreState } from '@bquery/bquery/ssr';
*
* const ssrState = deserializeStoreState();
* hydrateStores(ssrState);
* ```
*/
export declare const hydrateStores: (stateMap: DeserializedStoreState) => void;
//# sourceMappingURL=serialize.d.ts.map