import { _objectSpread2 } from "../../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import BookingDataPanel from "../index.js";
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef, useState } from "react";
import { PisellFloatingPanel } from "@pisell/materials";
var pisellFloatingPanel_default = memo(forwardRef((props, ref) => {
	const { currentDate, onBookingClick, bookingId } = props;
	const [isOpen, setIsOpen] = useState(false);
	const bookingDataPanelRef = useRef(null);
	const floationgPanelProps = useMemo(() => {
		return {
			fullHeight: "calc(100% - 62px)",
			retractHeight: "0px",
			defaultOpen: isOpen,
			style: {
				background: "var(--Gray-950, #0C111D)",
				width: "470px",
				height: "100%",
				zIndex: "1000",
				left: "16px"
			},
			retractIconStyle: {
				color: "#fff",
				fontSize: "20px"
			},
			width: "470px",
			isFloat: true,
			onOpenChange: (open) => {
				setIsOpen(open);
			}
		};
	}, []);
	useImperativeHandle(ref, () => ({
		open: () => {
			var _bookingDataPanelRef$;
			(_bookingDataPanelRef$ = bookingDataPanelRef.current) === null || _bookingDataPanelRef$ === void 0 || _bookingDataPanelRef$.refresh();
			setIsOpen(true);
		},
		close: () => {
			setIsOpen(false);
		},
		refresh: () => {
			var _bookingDataPanelRef$2;
			(_bookingDataPanelRef$2 = bookingDataPanelRef.current) === null || _bookingDataPanelRef$2 === void 0 || _bookingDataPanelRef$2.refresh();
		},
		getIsOpen: () => {
			return isOpen;
		}
	}));
	return /* @__PURE__ */ React.createElement(PisellFloatingPanel, _objectSpread2(_objectSpread2({}, floationgPanelProps), {}, { open: isOpen }), /* @__PURE__ */ React.createElement(BookingDataPanel, {
		currentDate,
		bookingId,
		onBookingClick,
		ref: bookingDataPanelRef
	}));
}));
//#endregion
export { pisellFloatingPanel_default as default };
