import { c } from "react-compiler-runtime";
import React, { useEffect } from "react";
import { makeStyles } from "@material-ui/core";
import clsx from "clsx";
import { CKEditor } from "@ckeditor/ckeditor5-react";
import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
//#region src/UI/inputs/richEditors/CkRichEditor.jsx
const useStyles = makeStyles((theme) => ({ editor: { "& .ck-editor__main > .ck-editor__editable_inline": { height: (props) => props.height ? props.height : 300 } } }));
const CkRichEditor = (props) => {
	const $ = c(27);
	const { includeToolbar: t0, data, readOnly: t1, handleChange, placeholder, editorRef, isUsingRef: t2, classes: classProps } = props;
	const includeToolbar = t0 === void 0 ? true : t0;
	const readOnly = t1 === void 0 ? false : t1;
	const isUsingRef = t2 === void 0 ? false : t2;
	const classes = useStyles(props);
	let t3;
	if ($[0] !== classProps) {
		t3 = classProps || {};
		$[0] = classProps;
		$[1] = t3;
	} else t3 = $[1];
	const { editor } = t3;
	let t4;
	if ($[2] !== includeToolbar) {
		t4 = includeToolbar ? [
			"heading",
			"|",
			"bold",
			"italic",
			"link",
			"bulletedList",
			"numberedList",
			"blockQuote"
		] : [];
		$[2] = includeToolbar;
		$[3] = t4;
	} else t4 = $[3];
	const toolbar = t4;
	let t5;
	if ($[4] !== handleChange || $[5] !== readOnly) {
		t5 = (event, editor_0) => {
			if (!readOnly) {
				const data_0 = editor_0.getData();
				if (handleChange) handleChange(data_0);
			}
		};
		$[4] = handleChange;
		$[5] = readOnly;
		$[6] = t5;
	} else t5 = $[6];
	const handleBodyChange = t5;
	let t6;
	if ($[7] !== editorRef) {
		t6 = [editorRef];
		$[7] = editorRef;
		$[8] = t6;
	} else t6 = $[8];
	useEffect(_temp, t6);
	let t7;
	if ($[9] !== classes.editor || $[10] !== editor) {
		t7 = clsx(classes.editor, editor);
		$[9] = classes.editor;
		$[10] = editor;
		$[11] = t7;
	} else t7 = $[11];
	let t8;
	if ($[12] !== placeholder || $[13] !== toolbar) {
		t8 = {
			toolbar,
			placeholder
		};
		$[12] = placeholder;
		$[13] = toolbar;
		$[14] = t8;
	} else t8 = $[14];
	let t9;
	if ($[15] !== editorRef || $[16] !== isUsingRef) {
		t9 = (editor_1) => {
			if (isUsingRef) editorRef.current = editor_1;
		};
		$[15] = editorRef;
		$[16] = isUsingRef;
		$[17] = t9;
	} else t9 = $[17];
	let t10;
	if ($[18] !== data || $[19] !== handleBodyChange || $[20] !== readOnly || $[21] !== t8 || $[22] !== t9) {
		t10 = /* @__PURE__ */ React.createElement(CKEditor, {
			editor: ClassicEditor,
			disabled: readOnly,
			data,
			config: t8,
			onChange: handleBodyChange,
			onReady: t9
		});
		$[18] = data;
		$[19] = handleBodyChange;
		$[20] = readOnly;
		$[21] = t8;
		$[22] = t9;
		$[23] = t10;
	} else t10 = $[23];
	let t11;
	if ($[24] !== t10 || $[25] !== t7) {
		t11 = /* @__PURE__ */ React.createElement("div", { className: t7 }, t10);
		$[24] = t10;
		$[25] = t7;
		$[26] = t11;
	} else t11 = $[26];
	return t11;
};
function _temp() {}
//#endregion
export { CkRichEditor };

//# sourceMappingURL=CkRichEditor.mjs.map