"use client";
import { useEnvironmentContext } from "../../providers/environment/use-environment-context.js";
import { useLocaleContext } from "../../providers/locale/use-locale-context.js";
import { useDrawerStackStore } from "./use-drawer-stack-store.js";
import * as drawer from "@zag-js/drawer";
import { useId } from "react";
import { normalizeProps, useMachine } from "@zag-js/react";
//#region src/components/drawer/use-drawer.ts
var useDrawer = (props) => {
	const id = useId();
	const { getRootNode } = useEnvironmentContext();
	const { dir } = useLocaleContext();
	const context = {
		id,
		dir,
		getRootNode,
		stack: useDrawerStackStore(),
		...props
	};
	const service = useMachine(drawer.machine, context);
	return drawer.connect(service, normalizeProps);
};
//#endregion
export { useDrawer };
