import { Context } from "../model.js";
import detailContent_default from "../resources/detail/detailContent.js";
import { getOpenHoursSchedule } from "./serve.js";
import React, { useContext, useEffect, useImperativeHandle, useRef } from "react";
import { useRequest } from "ahooks";
import "./index.less";
//#region src/components/schedules/openHours/index.tsx
const OpenHours = React.forwardRef((props, ref) => {
	const { state } = useContext(Context);
	const tabKey = state === null || state === void 0 ? void 0 : state.tabKey;
	const detailContentRef = useRef(null);
	const _getOpenHoursSchedule = useRequest(getOpenHoursSchedule, {
		manual: true,
		onSuccess: (result) => {
			var _detailContentRef$cur, _detailContentRef$cur2;
			const data = (result === null || result === void 0 ? void 0 : result.data) || {};
			detailContentRef === null || detailContentRef === void 0 || (_detailContentRef$cur = detailContentRef.current) === null || _detailContentRef$cur === void 0 || (_detailContentRef$cur2 = _detailContentRef$cur.setFieldsValue) === null || _detailContentRef$cur2 === void 0 || _detailContentRef$cur2.call(_detailContentRef$cur, data);
		}
	});
	useImperativeHandle(ref, () => {
		return { getIsEdit: () => detailContentRef.current.getIsEdit() };
	});
	useEffect(() => {
		_getOpenHoursSchedule.run();
	}, []);
	return /* @__PURE__ */ React.createElement("div", { className: "pisell-lowcode__schedules-component-openHours" }, /* @__PURE__ */ React.createElement(detailContent_default, {
		isAutoSetCalendarData: tabKey === "openHours",
		tabKey,
		ref: detailContentRef,
		loading: _getOpenHoursSchedule.loading,
		drawerContainer: document.querySelector(".pisell-lowcode__schedules-component-openHours")
	}));
});
//#endregion
export { OpenHours as default };
