"use client";
import { DrawerStackStoreProvider } from "./use-drawer-stack-store.js";
import { DrawerStackProvider } from "./use-drawer-stack-context.js";
import * as drawer from "@zag-js/drawer";
import { useMemo, useState, useSyncExternalStore } from "react";
import { normalizeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/drawer/drawer-stack.tsx
var DrawerStack = (props) => {
	const { children } = props;
	const [stack] = useState(() => drawer.createStack());
	const snapshot = useSyncExternalStore(stack.subscribe, stack.getSnapshot, stack.getSnapshot);
	return /* @__PURE__ */ jsx(DrawerStackStoreProvider, {
		value: stack,
		children: /* @__PURE__ */ jsx(DrawerStackProvider, {
			value: useMemo(() => drawer.connectStack(snapshot, normalizeProps), [snapshot]),
			children
		})
	});
};
//#endregion
export { DrawerStack };
