'use client';


const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.cjs');
const require_built = require('./config/dist/esm/built.cjs');
let react = require("react");
let react_jsx_runtime = require("react/jsx-runtime");
let uuid = require("uuid");

//#region ../react-intlayer/dist/esm/@intlayer/editor-react/dist/esm/CommunicatorContext.mjs
const { editor } = require_built.built_default ?? {};
const CommunicatorContext = (0, react.createContext)({
	postMessage: () => null,
	allowedOrigins: [
		editor?.applicationURL,
		editor?.editorURL,
		editor?.cmsURL
	],
	senderId: ""
});
const CommunicatorProvider = ({ children, allowedOrigins, postMessage }) => {
	const senderIdRef = (0, react.useRef)((0, uuid.v4)());
	const value = (0, react.useMemo)(() => ({
		postMessage,
		allowedOrigins,
		senderId: senderIdRef.current
	}), [
		postMessage,
		allowedOrigins,
		senderIdRef.current
	]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CommunicatorContext.Provider, {
		value,
		children
	});
};
const useCommunicator = () => (0, react.useContext)(CommunicatorContext);

//#endregion
exports.CommunicatorProvider = CommunicatorProvider;
exports.useCommunicator = useCommunicator;
//# sourceMappingURL=CommunicatorContext.cjs.map