import { create } from "zustand";

//#region src/components/RightDrawer/useRightDrawerStore.ts
/**
* Zustand store for managing RightDrawer component states
*
* This store provides centralized state management for multiple drawer instances,
* allowing different parts of the application to open, close, and check the status
* of drawers using unique identifiers.
*
* ## Features
* - **Multi-instance Management**: Handle multiple drawers simultaneously
* - **Simple API**: Open, close, and check drawer states with string identifiers
* - **Persistent State**: Drawer states persist until explicitly changed
* - **Type Safety**: Full TypeScript support with proper type inference
*
* ## Usage Patterns
*
* ### Basic Usage
* ```tsx
* import { useRightDrawerStore } from './useRightDrawerStore';
*
* function NavigationButton() {
*   const { open } = useRightDrawerStore();
*
*   return (
*     <button onClick={() => open('main-menu')}>
*       Open Menu
*     </button>
*   );
* }
* ```
*
* ### Conditional Rendering
* ```tsx
* function ConditionalContent() {
*   const isMenuOpen = useRightDrawerStore(state => state.isOpen('main-menu'));
*
*   return (
*     <div>
*       {isMenuOpen ? 'Menu is open' : 'Menu is closed'}
*     </div>
*   );
* }
* ```
*
* ### Multiple Drawers
* ```tsx
* function MultiDrawerManager() {
*   const { open, close, isOpen } = useRightDrawerStore();
*
*   return (
*     <div>
*       <button onClick={() => open('cart')}>Open Cart</button>
*       <button onClick={() => open('profile')}>Open Profile</button>
*       <button onClick={() => {
*         close('cart');
*         close('profile');
*       }}>Close All</button>
*
*       <div>
*         Cart: {isOpen('cart') ? 'Open' : 'Closed'}
*         Profile: {isOpen('profile') ? 'Open' : 'Closed'}
*       </div>
*     </div>
*   );
* }
* ```
*
* @returns RightDrawerStore instance with drawer management capabilities
*/
const useRightDrawerStore = create((set, get) => ({
	drawers: {},
	open: (key) => set((state) => ({ drawers: {
		...state.drawers,
		[key]: true
	} })),
	close: (key) => set((state) => ({ drawers: {
		...state.drawers,
		[key]: false
	} })),
	isOpen: (key) => get().drawers[key] ?? false
}));

//#endregion
export { useRightDrawerStore };
//# sourceMappingURL=useRightDrawerStore.mjs.map