import { n as StateInitializer } from '../types-5EvFF6wb.cjs'; import 'keyweaver'; import 'react'; type SafeStorage = { /** Retrieves a value by key. */ getItem(key: string): string | undefined | null; /** Stores a value with the given key. */ setItem(key: string, value: string): void; /** Removes a value by key. */ removeItem(key: string): void; /** * listener to observe storage changes * @returns a function to unsubscribe. */ listen?(key: string, onChange: (value: string | undefined) => void): () => void; }; type Converter = { parse(value: string): T; stringify(value: Exclude): string; }; type Options = { /** The key used to store and retrieve the value from storage. */ name: string; storage: SafeStorage | undefined; isValid?(value: T): boolean; converter?: Converter; /** If `true`, enables observing storage changes */ sharable?: boolean; }; declare const safeLocalStorage: { getItem(key: string): string | null; setItem(key: string, value: string): void; removeItem(key: string): void; listen(key: string, onChange: (value: string | undefined) => void): () => void; } | undefined; declare const safeSessionStorage: Storage | undefined; /** * A utility for persisting state using a specified storage mechanism such as * {@link localStorage} or {@link sessionStorage}. It provides a customizable way to store, * retrieve, and observe state changes of provided persistent {@link Options.storage storage} */ declare const getPersistInitializer: ({ name, storage, converter, isValid, sharable, }: Options) => StateInitializer | undefined; export { getPersistInitializer as default, safeLocalStorage, safeSessionStorage };