const require_runtime = require("../../../../_virtual/_rolldown/runtime.js");
let react = require("react");
react = require_runtime.__toESM(react);
//#region src/components/pisellRecordBoard/shellFrame/Calendar/calendarPersistGuard.tsx
const CalendarPersistContext = (0, react.createContext)({});
const CalendarPersistProvider = ({ children, value }) => /* @__PURE__ */ react.default.createElement(CalendarPersistContext.Provider, { value: value !== null && value !== void 0 ? value : {} }, children);
/**
* 在日历 Demo 内判断某类写操作是否允许执行本地 state 更新。
*/
function useCalendarPersist() {
	const ctx = (0, react.useContext)(CalendarPersistContext);
	return (0, react.useCallback)((kind) => {
		if (!ctx.beforePersist) return true;
		return ctx.beforePersist(kind);
	}, [ctx]);
}
//#endregion
exports.CalendarPersistProvider = CalendarPersistProvider;
exports.useCalendarPersist = useCalendarPersist;
