import { Form } from "../utilities/form/Form.mjs";
import { Field } from "../utilities/form/Field.mjs";
import { UdpEnums } from "../enums/unitySystemEnums.mjs";
import { useHandleAxiosSnackbar } from "../utilities/apiHelpers.mjs";
import { useUser } from "../utilities/auth/useUser.mjs";
import { FluentTextFieldAutoComplete } from "../UI/inputs/textField/FluentTextFieldAutoComplete.mjs";
import { useActionStore } from "../stores/actionStore.mjs";
import { useShellStore } from "../stores/shellStore.mjs";
import { useActionState } from "../hooks/useActions.mjs";
import { getSearchObject } from "../utilities/search/SearchUtilities.mjs";
import { constructBusinessObjectArrFromTree } from "../utilities/tree/TreeUtilities.mjs";
import { LayoutUnit } from "../layout/LayoutUnit.mjs";
import { executeQueryAdHoc, executeQueryWithParameters, getBaseMethod } from "../udp/utilities/methodUtils.mjs";
import { AmbientCard } from "../UI/surfaces/cards/AmbientCard/AmbientCard.mjs";
import { CkRichEditor } from "../UI/inputs/richEditors/CkRichEditor.mjs";
import { ShortcutContentFinder } from "../udp/ShortcutContent/ShortcutContentFinder.mjs";
import { FluentDatePicker } from "../UI/inputs/pickers/FluentDatePicker.mjs";
import { FILE_TO_TYPES } from "../constants/reminderConstants.mjs";
import { c } from "react-compiler-runtime";
import React, { useEffect, useRef, useState } from "react";
import { LinearProgress, TextField, makeStyles } from "@material-ui/core";
import { useTranslation } from "react-i18next";
import { differenceWith } from "lodash-es";
//#region src/reminders/RemindersScreen.jsx
const useStyles = makeStyles((theme) => ({
	root: {},
	editor: { "& .ck-editor__main > .ck-editor__editable_inline": { backgroundColor: theme?.getThemeData()?.mode === "dark" ? theme.palette.grey[800] : theme.palette.grey[100] } },
	row: {
		display: "flex",
		justifyContent: "space-between"
	},
	input: {
		height: 34,
		padding: 0
	},
	formTextInput: { fontSize: 14 },
	labelRoot: { fontSize: 14 }
}));
const RemindersScreen = (props) => {
	const $ = c(167);
	const { formRef, onSubmit, shortcutContentFinderEnabled, id, viewOnly, reloadReminders } = props;
	const [reminder, setReminder] = useState("");
	let t0;
	if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
		t0 = [];
		$[0] = t0;
	} else t0 = $[0];
	const [typeOptions, setTypeOptions] = useState(t0);
	let t1;
	if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
		t1 = [];
		$[1] = t1;
	} else t1 = $[1];
	const [templateOptions, setTemplateOptions] = useState(t1);
	const [reminderId, setReminderId] = useState(id || "");
	let t2;
	if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = [];
		$[2] = t2;
	} else t2 = $[2];
	const [existingReminderFiledFor, setExistingReminderFiledFor] = useState(t2);
	const [existingReminderObj, setExistingReminderObj] = useState(null);
	const [loading, setLoading] = useState(false);
	const classes = useStyles(props);
	const { t } = useTranslation();
	const actionState = useActionState();
	const shellHidden = useShellStore(_temp);
	const { menuListState, catalogPromotedEntities } = actionState;
	const { handleSuccessSnackbar, handleErrorSnackbar } = useHandleAxiosSnackbar();
	const user = useUser();
	const editorRef = useRef(null);
	const selectedNode = useActionStore(_temp2);
	let t3;
	bb0: {
		if (menuListState.menuList.length) {
			t3 = menuListState.menuList[menuListState.selectedMenuIndex] || null;
			break bb0;
		}
		t3 = null;
	}
	const selectedMenu = t3;
	let t4;
	if ($[3] !== catalogPromotedEntities) {
		t4 = getBaseMethod(UdpEnums.Udp_Reminder, "unityBaseGetFullMethod", catalogPromotedEntities);
		$[3] = catalogPromotedEntities;
		$[4] = t4;
	} else t4 = $[4];
	const reminderGetFullApiMethod = t4;
	let t5;
	if ($[5] !== catalogPromotedEntities) {
		t5 = getBaseMethod(UdpEnums.Udp_Reminder_Type, "unityBaseSearchMethod", catalogPromotedEntities);
		$[5] = catalogPromotedEntities;
		$[6] = t5;
	} else t5 = $[6];
	const reminderTypeSearchApiMethod = t5;
	let t6;
	if ($[7] !== catalogPromotedEntities) {
		t6 = getBaseMethod(UdpEnums.Udp_Reminder_Template, "unityBaseSearchMethod", catalogPromotedEntities);
		$[7] = catalogPromotedEntities;
		$[8] = t6;
	} else t6 = $[8];
	const reminderTemplateSearchApiMethod = t6;
	let t7;
	if ($[9] !== catalogPromotedEntities) {
		t7 = getBaseMethod(UdpEnums.Udp_Reminder, "unityBaseCreateMethod", catalogPromotedEntities);
		$[9] = catalogPromotedEntities;
		$[10] = t7;
	} else t7 = $[10];
	const createReminderApiMethod = t7;
	let t8;
	if ($[11] !== catalogPromotedEntities) {
		t8 = getBaseMethod(UdpEnums.Udp_Reminder, "unityBaseUpdateMethod", catalogPromotedEntities);
		$[11] = catalogPromotedEntities;
		$[12] = t8;
	} else t8 = $[12];
	const updateReminderApiMethod = t8;
	let t9;
	if ($[13] !== catalogPromotedEntities) {
		t9 = getBaseMethod(UdpEnums.Udp_Reminder_Filed_For, "unityBaseCreateMethod", catalogPromotedEntities);
		$[13] = catalogPromotedEntities;
		$[14] = t9;
	} else t9 = $[14];
	const createReminderFiledForApiMethod = t9;
	let t10;
	if ($[15] !== catalogPromotedEntities) {
		t10 = getBaseMethod(UdpEnums.Udp_Reminder_Filed_For, "unityBaseUpdateMethod", catalogPromotedEntities);
		$[15] = catalogPromotedEntities;
		$[16] = t10;
	} else t10 = $[16];
	const updateReminderFiledForApiMethod = t10;
	let t11;
	if ($[17] !== catalogPromotedEntities) {
		t11 = getBaseMethod(UdpEnums.Udp_Reminder_Filed_For, "unityBaseDeleteMethod", catalogPromotedEntities);
		$[17] = catalogPromotedEntities;
		$[18] = t11;
	} else t11 = $[18];
	const deleteReminderFiledForApiMethod = t11;
	const disabled = viewOnly;
	let t12;
	if ($[19] !== createReminderApiMethod || $[20] !== handleErrorSnackbar || $[21] !== handleSuccessSnackbar || $[22] !== reloadReminders || $[23] !== reminderId || $[24] !== updateReminderApiMethod || $[25] !== user?.currentTenantId || $[26] !== user?.familyName || $[27] !== user?.firstName || $[28] !== user?.id) {
		t12 = async (values) => {
			let response = null;
			const reminderDate = new Date(values?.reminderDate?.setHours(0, 0, 0, 0));
			const data = { requestBody: {
				tenantId: user?.currentTenantId,
				typeCode: values?.type?.code,
				subject: values?.subject,
				content: values?.reminder,
				unityUserId: user?.id,
				userDisplayName: `${user?.firstName} ${user?.familyName}`,
				reminderDate: reminderDate.toDateString()
			} };
			if (reminderId) if (updateReminderApiMethod) {
				data["{iD}"] = reminderId;
				response = await executeQueryWithParameters({ data }, updateReminderApiMethod.apiMethodId).catch((e) => handleErrorSnackbar(e, "Could not Update Reminder"));
			} else handleErrorSnackbar(null, "Update Reminder Method Not Promoted");
			else if (createReminderApiMethod) response = await executeQueryWithParameters({ data }, createReminderApiMethod.apiMethodId).catch((e_0) => handleErrorSnackbar(e_0, "Could not Save Reminder"));
			else handleErrorSnackbar(null, "Create Reminder Method Not Promoted");
			if (response?.status === 200) {
				if (!reminderId) {
					setReminderId(response.data.id || "");
					handleSuccessSnackbar("Reminder Saved");
				} else handleSuccessSnackbar("Reminder Updated");
				if (reloadReminders) reloadReminders();
				return response.data.id || reminderId;
			}
			return reminderId;
		};
		$[19] = createReminderApiMethod;
		$[20] = handleErrorSnackbar;
		$[21] = handleSuccessSnackbar;
		$[22] = reloadReminders;
		$[23] = reminderId;
		$[24] = updateReminderApiMethod;
		$[25] = user?.currentTenantId;
		$[26] = user?.familyName;
		$[27] = user?.firstName;
		$[28] = user?.id;
		$[29] = t12;
	} else t12 = $[29];
	const handleSaveReminder = t12;
	const reminderFiledForToComparator = _temp3;
	let t13;
	if ($[30] !== createReminderFiledForApiMethod || $[31] !== deleteReminderFiledForApiMethod || $[32] !== existingReminderFiledFor || $[33] !== handleErrorSnackbar || $[34] !== updateReminderFiledForApiMethod) {
		t13 = async (values_0, reminderdIdToFileFor) => {
			const reminderFiledForToDelete = differenceWith(existingReminderFiledFor, values_0?.fileTo, reminderFiledForToComparator);
			const reminderFiledForToCreate = differenceWith(values_0?.fileTo, existingReminderFiledFor, reminderFiledForToComparator);
			if (reminderdIdToFileFor) {
				if (deleteReminderFiledForApiMethod) {
					const deletedPromises = [];
					reminderFiledForToDelete.forEach((nftd) => {
						const data_0 = {};
						data_0["{reminderID}"] = reminderdIdToFileFor;
						data_0["{entityBusinessKey}"] = nftd.value;
						deletedPromises.push(executeQueryWithParameters({ data: data_0 }, deleteReminderFiledForApiMethod.apiMethodId));
					});
					await Promise.all(deletedPromises.map(_temp5)).then((responses) => {
						if (responses.length !== deletedPromises.length) console.warn("Not all Reminder Filed For deleted");
					});
				} else handleErrorSnackbar(null, "Delete Reminder Filed For Method Not Promoted");
				if (createReminderFiledForApiMethod) {
					const createdPromises = [];
					reminderFiledForToCreate.forEach((nftc) => {
						const data_1 = { requestBody: {
							reminderId: reminderdIdToFileFor,
							entityBusinessKey: nftc.value,
							domainObject: nftc.domainObject,
							type: values_0?.fileToType?.value || 1
						} };
						createdPromises.push(executeQueryWithParameters({ data: data_1 }, createReminderFiledForApiMethod.apiMethodId));
					});
					await Promise.all(createdPromises.map(_temp7)).then((responses_0) => {
						responses_0.forEach((response_0) => {
							if (response_0.status === 200) {
								const entityBusinessKey = response_0.data.entityBusinessKey;
								if (!reminderFiledForToCreate.find((nftc_0) => nftc_0.value === entityBusinessKey)) console.warn("Reminder Filed For not created for all file to entities");
							}
						});
					});
					setExistingReminderFiledFor(values_0?.fileTo);
				} else handleErrorSnackbar(null, "Create Reminder Filed For Method Not Promoted");
				if (updateReminderFiledForApiMethod) {
					const updatedPromises = [];
					values_0?.fileTo?.forEach((nftu) => {
						const data_2 = { requestBody: {
							reminderId: reminderdIdToFileFor,
							entityBusinessKey: nftu.value,
							domainObject: nftu.domainObject,
							type: values_0?.fileToType?.value || 1
						} };
						data_2["{reminderID}"] = reminderdIdToFileFor;
						data_2["{entityBusinessKey}"] = nftu.value;
						updatedPromises.push(executeQueryWithParameters({ data: data_2 }, updateReminderFiledForApiMethod.apiMethodId));
					});
					await Promise.all(updatedPromises.map(_temp9)).then((responses_1) => {
						responses_1.forEach((response_1) => {
							if (response_1.status === 200) {
								const entityBusinessKey_0 = response_1.data.entityBusinessKey;
								if (!values_0?.fileTo?.find((nftu_0) => nftu_0.value === entityBusinessKey_0)) console.warn("Reminder Filed For not updated for all file to entities");
							}
						});
					});
					setExistingReminderFiledFor(values_0?.fileTo);
				} else handleErrorSnackbar(null, "Update Reminder Filed For Method Not Promoted");
			}
		};
		$[30] = createReminderFiledForApiMethod;
		$[31] = deleteReminderFiledForApiMethod;
		$[32] = existingReminderFiledFor;
		$[33] = handleErrorSnackbar;
		$[34] = updateReminderFiledForApiMethod;
		$[35] = t13;
	} else t13 = $[35];
	const handleReminderFiledFor = t13;
	let t14;
	if ($[36] !== handleReminderFiledFor || $[37] !== handleSaveReminder || $[38] !== onSubmit || $[39] !== reminder) {
		t14 = async (values_1) => {
			if (onSubmit) onSubmit({
				reminder,
				...values_1
			});
			else {
				const reminderdIdToFileFor_0 = await handleSaveReminder({
					reminder,
					...values_1
				});
				await handleReminderFiledFor({
					reminder,
					...values_1
				}, reminderdIdToFileFor_0);
			}
		};
		$[36] = handleReminderFiledFor;
		$[37] = handleSaveReminder;
		$[38] = onSubmit;
		$[39] = reminder;
		$[40] = t14;
	} else t14 = $[40];
	const handleOnSubmit = t14;
	let t15;
	if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
		t15 = (reminder_0) => {
			setReminder(reminder_0);
		};
		$[41] = t15;
	} else t15 = $[41];
	const handleTextEditorChange = t15;
	let t16;
	if ($[42] !== formRef || $[43] !== typeOptions) {
		t16 = (value) => {
			formRef?.current?.form?.change("subject", value?.subject || "");
			const type = typeOptions.find((option) => option.code === value.typeCode);
			formRef?.current?.form?.change("type", type || null);
			formRef?.current?.form?.change("reminderDate", value.reminderDate === "0001-01-01T00:00:00" ? /* @__PURE__ */ new Date() : new Date(value.reminderDate));
			setReminder(value?.content || "");
		};
		$[42] = formRef;
		$[43] = typeOptions;
		$[44] = t16;
	} else t16 = $[44];
	const onTemplateChange = t16;
	let t17;
	if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
		t17 = (shortcutContent) => {
			editorRef?.current?.model?.change((writer) => {
				const insertPosition = editorRef?.current?.model?.document?.selection?.getFirstPosition();
				writer.remove(editorRef?.current?.model?.document?.selection?.getFirstRange());
				writer.insertText(shortcutContent, insertPosition);
			});
			setReminder(editorRef?.current?.getData());
		};
		$[45] = t17;
	} else t17 = $[45];
	const handleShortcutOnSelect = t17;
	let t18;
	if ($[46] === Symbol.for("react.memo_cache_sentinel")) {
		t18 = [];
		$[46] = t18;
	} else t18 = $[46];
	let options = t18;
	if (selectedMenu) {
		let t19;
		if ($[47] !== selectedMenu) {
			t19 = constructBusinessObjectArrFromTree(selectedMenu);
			$[47] = selectedMenu;
			$[48] = t19;
		} else t19 = $[48];
		options = t19;
	}
	const fileToOptions = options;
	let t19;
	if ($[49] !== reminderTypeSearchApiMethod) {
		t19 = () => {
			const getTypeOptions = async () => {
				let options_0 = [];
				if (reminderTypeSearchApiMethod) {
					const typesResponse = await executeQueryAdHoc({ data: getSearchObject([], 1, 200, true) }, reminderTypeSearchApiMethod.apiMethodId);
					if (typesResponse?.status === 200) options_0 = typesResponse.data?.pageList || [];
				}
				setTypeOptions(options_0);
			};
			getTypeOptions();
		};
		$[49] = reminderTypeSearchApiMethod;
		$[50] = t19;
	} else t19 = $[50];
	let t20;
	if ($[51] !== reminderTypeSearchApiMethod || $[52] !== user) {
		t20 = [
			reminderTypeSearchApiMethod,
			setTypeOptions,
			user
		];
		$[51] = reminderTypeSearchApiMethod;
		$[52] = user;
		$[53] = t20;
	} else t20 = $[53];
	useEffect(t19, t20);
	let t21;
	if ($[54] !== reminderTemplateSearchApiMethod) {
		t21 = () => {
			const getTemplateOptions = async () => {
				let options_1 = [];
				if (reminderTemplateSearchApiMethod) {
					const templatesResponse = await executeQueryAdHoc({ data: getSearchObject([], 1, 200, true) }, reminderTemplateSearchApiMethod.apiMethodId);
					if (templatesResponse?.status === 200) options_1 = templatesResponse.data?.pageList || [];
				}
				setTemplateOptions(options_1);
			};
			getTemplateOptions();
		};
		$[54] = reminderTemplateSearchApiMethod;
		$[55] = t21;
	} else t21 = $[55];
	let t22;
	if ($[56] !== reminderTemplateSearchApiMethod || $[57] !== user) {
		t22 = [
			reminderTemplateSearchApiMethod,
			setTemplateOptions,
			user
		];
		$[56] = reminderTemplateSearchApiMethod;
		$[57] = user;
		$[58] = t22;
	} else t22 = $[58];
	useEffect(t21, t22);
	let t23;
	let t24;
	if ($[59] !== id || $[60] !== reminderGetFullApiMethod) {
		t23 = () => {
			const getExistingReminder = async () => {
				let existingReminderObj_0 = null;
				const data_5 = {};
				if (reminderGetFullApiMethod) {
					setLoading(true);
					data_5["{iD}"] = id;
					const reminderResponse = await executeQueryWithParameters({ data: data_5 }, reminderGetFullApiMethod.apiMethodId).catch((e_4) => {
						console.error(e_4);
						setLoading(false);
					});
					if (reminderResponse?.status === 200) existingReminderObj_0 = reminderResponse.data;
				}
				setExistingReminderObj(existingReminderObj_0);
				setReminder(existingReminderObj_0?.content);
				setLoading(false);
			};
			if (id) getExistingReminder();
		};
		t24 = [id, reminderGetFullApiMethod];
		$[59] = id;
		$[60] = reminderGetFullApiMethod;
		$[61] = t23;
		$[62] = t24;
	} else {
		t23 = $[61];
		t24 = $[62];
	}
	useEffect(t23, t24);
	let t25;
	let t26;
	if ($[63] !== existingReminderObj || $[64] !== fileToOptions || $[65] !== formRef) {
		t25 = () => {
			if (!existingReminderObj || !fileToOptions?.length) return;
			const initialFileTos = fileToOptions.filter((option_0) => existingReminderObj.reminderFiledFor.find((nff) => option_0.value === nff.entityBusinessKey));
			setExistingReminderFiledFor(initialFileTos);
			formRef?.current?.form?.change("fileTo", initialFileTos);
		};
		t26 = [
			existingReminderObj,
			fileToOptions,
			formRef
		];
		$[63] = existingReminderObj;
		$[64] = fileToOptions;
		$[65] = formRef;
		$[66] = t25;
		$[67] = t26;
	} else {
		t25 = $[66];
		t26 = $[67];
	}
	useEffect(t25, t26);
	let t27;
	let t28;
	if ($[68] !== existingReminderObj || $[69] !== formRef || $[70] !== typeOptions) {
		t27 = () => {
			if (!existingReminderObj || !typeOptions?.length) return;
			const initialType = typeOptions.find((option_1) => option_1.code === existingReminderObj.typeCode);
			formRef?.current?.form?.change("type", initialType || null);
		};
		t28 = [
			existingReminderObj,
			typeOptions,
			formRef
		];
		$[68] = existingReminderObj;
		$[69] = formRef;
		$[70] = typeOptions;
		$[71] = t27;
		$[72] = t28;
	} else {
		t27 = $[71];
		t28 = $[72];
	}
	useEffect(t27, t28);
	let t29;
	let t30;
	if ($[73] !== existingReminderObj || $[74] !== formRef) {
		t29 = () => {
			if (!existingReminderObj) return;
			formRef?.current?.form?.change("subject", existingReminderObj?.subject || "");
		};
		t30 = [existingReminderObj, formRef];
		$[73] = existingReminderObj;
		$[74] = formRef;
		$[75] = t29;
		$[76] = t30;
	} else {
		t29 = $[75];
		t30 = $[76];
	}
	useEffect(t29, t30);
	let t31;
	let t32;
	if ($[77] !== existingReminderObj || $[78] !== formRef) {
		t31 = () => {
			if (!existingReminderObj?.reminderDate) return;
			formRef?.current?.form?.change("reminderDate", new Date(existingReminderObj.reminderDate));
		};
		t32 = [existingReminderObj, formRef];
		$[77] = existingReminderObj;
		$[78] = formRef;
		$[79] = t31;
		$[80] = t32;
	} else {
		t31 = $[79];
		t32 = $[80];
	}
	useEffect(t31, t32);
	let t33;
	if ($[81] !== existingReminderObj || $[82] !== formRef || $[83] !== selectedNode?.properties?.catalogReturnObject) {
		t33 = () => {
			if (!existingReminderObj) return;
			const matchingReminderFiledFor_1 = existingReminderObj.reminderFiledFor?.find((rff) => rff.domainObject === selectedNode?.properties?.catalogReturnObject);
			const initialFileToType = FILE_TO_TYPES.find((option_2) => option_2.value === matchingReminderFiledFor_1?.type);
			formRef?.current?.form?.change("fileToType", initialFileToType || null);
		};
		$[81] = existingReminderObj;
		$[82] = formRef;
		$[83] = selectedNode?.properties?.catalogReturnObject;
		$[84] = t33;
	} else t33 = $[84];
	let t34;
	if ($[85] !== existingReminderObj || $[86] !== formRef || $[87] !== selectedNode || $[88] !== typeOptions) {
		t34 = [
			existingReminderObj,
			typeOptions,
			formRef,
			selectedNode
		];
		$[85] = existingReminderObj;
		$[86] = formRef;
		$[87] = selectedNode;
		$[88] = typeOptions;
		$[89] = t34;
	} else t34 = $[89];
	useEffect(t33, t34);
	const t35 = classes.root;
	let t36;
	if ($[90] !== loading) {
		t36 = loading && /* @__PURE__ */ React.createElement(LinearProgress, { color: "secondary" });
		$[90] = loading;
		$[91] = t36;
	} else t36 = $[91];
	let t37;
	if ($[92] !== t) {
		t37 = t("File To");
		$[92] = t;
		$[93] = t37;
	} else t37 = $[93];
	let t38;
	if ($[94] !== fileToOptions) {
		t38 = fileToOptions || [];
		$[94] = fileToOptions;
		$[95] = t38;
	} else t38 = $[95];
	const t39 = !viewOnly ? 2 : -1;
	let t40;
	if ($[96] !== disabled || $[97] !== t37 || $[98] !== t38 || $[99] !== t39) {
		t40 = /* @__PURE__ */ React.createElement(Field, {
			component: FluentTextFieldAutoComplete,
			label: t37,
			name: "fileTo",
			id: "fileTo",
			fullWidth: true,
			variant: "outlined",
			margin: "dense",
			size: "small",
			options: t38,
			optionKey: "label",
			required: true,
			limitTags: t39,
			isMultiple: true,
			disabled
		});
		$[96] = disabled;
		$[97] = t37;
		$[98] = t38;
		$[99] = t39;
		$[100] = t40;
	} else t40 = $[100];
	let t41;
	if ($[101] !== t) {
		t41 = t("File To Type");
		$[101] = t;
		$[102] = t41;
	} else t41 = $[102];
	let t42;
	if ($[103] === Symbol.for("react.memo_cache_sentinel")) {
		t42 = FILE_TO_TYPES || [];
		$[103] = t42;
	} else t42 = $[103];
	let t43;
	if ($[104] !== disabled || $[105] !== t41) {
		t43 = /* @__PURE__ */ React.createElement(Field, {
			component: FluentTextFieldAutoComplete,
			label: t41,
			name: "fileToType",
			id: "fileToType",
			fullWidth: true,
			variant: "outlined",
			margin: "dense",
			size: "small",
			options: t42,
			optionKey: "label",
			required: true,
			disabled
		});
		$[104] = disabled;
		$[105] = t41;
		$[106] = t43;
	} else t43 = $[106];
	const t44 = classes.row;
	let t45;
	if ($[107] === Symbol.for("react.memo_cache_sentinel")) {
		t45 = { width: "100%" };
		$[107] = t45;
	} else t45 = $[107];
	let t46;
	if ($[108] !== t) {
		t46 = t("Type");
		$[108] = t;
		$[109] = t46;
	} else t46 = $[109];
	let t47;
	if ($[110] !== typeOptions) {
		t47 = typeOptions || [];
		$[110] = typeOptions;
		$[111] = t47;
	} else t47 = $[111];
	let t48;
	if ($[112] !== disabled || $[113] !== t46 || $[114] !== t47) {
		t48 = /* @__PURE__ */ React.createElement("div", { style: t45 }, /* @__PURE__ */ React.createElement(Field, {
			component: FluentTextFieldAutoComplete,
			label: t46,
			name: "type",
			id: "type",
			fullWidth: true,
			variant: "outlined",
			margin: "dense",
			size: "small",
			options: t47,
			optionKey: "name",
			required: true,
			disabled
		}));
		$[112] = disabled;
		$[113] = t46;
		$[114] = t47;
		$[115] = t48;
	} else t48 = $[115];
	let t49;
	if ($[116] !== onTemplateChange || $[117] !== t || $[118] !== templateOptions || $[119] !== viewOnly) {
		t49 = !viewOnly && /* @__PURE__ */ React.createElement("div", { style: {
			width: "100%",
			marginLeft: 8
		} }, /* @__PURE__ */ React.createElement(Field, {
			component: FluentTextFieldAutoComplete,
			label: t("Template"),
			name: "template",
			id: "template",
			fullWidth: true,
			variant: "outlined",
			margin: "dense",
			size: "small",
			options: templateOptions || [],
			optionKey: "name",
			additionalOnChangeAction: onTemplateChange
		}));
		$[116] = onTemplateChange;
		$[117] = t;
		$[118] = templateOptions;
		$[119] = viewOnly;
		$[120] = t49;
	} else t49 = $[120];
	let t50;
	if ($[121] !== classes.row || $[122] !== t48 || $[123] !== t49) {
		t50 = /* @__PURE__ */ React.createElement("div", { className: t44 }, t48, t49);
		$[121] = classes.row;
		$[122] = t48;
		$[123] = t49;
		$[124] = t50;
	} else t50 = $[124];
	let t51;
	if ($[125] !== t) {
		t51 = t("Reminder Date");
		$[125] = t;
		$[126] = t51;
	} else t51 = $[126];
	let t52;
	if ($[127] !== disabled || $[128] !== t51) {
		t52 = /* @__PURE__ */ React.createElement(Field, {
			component: FluentDatePicker,
			label: t51,
			name: "reminderDate",
			id: "reminderDate",
			fullWidth: true,
			variant: "outlined",
			size: "small",
			margin: "dense",
			required: true,
			disabled
		});
		$[127] = disabled;
		$[128] = t51;
		$[129] = t52;
	} else t52 = $[129];
	let t53;
	if ($[130] !== t) {
		t53 = t("Subject");
		$[130] = t;
		$[131] = t53;
	} else t53 = $[131];
	const t54 = classes?.input;
	const t55 = classes?.formTextInput;
	let t56;
	if ($[132] !== t54 || $[133] !== t55) {
		t56 = { classes: {
			root: t54,
			input: t55
		} };
		$[132] = t54;
		$[133] = t55;
		$[134] = t56;
	} else t56 = $[134];
	const t57 = classes?.labelRoot;
	let t58;
	if ($[135] !== t57) {
		t58 = { classes: { root: t57 } };
		$[135] = t57;
		$[136] = t58;
	} else t58 = $[136];
	let t59;
	if ($[137] !== disabled || $[138] !== t53 || $[139] !== t56 || $[140] !== t58) {
		t59 = /* @__PURE__ */ React.createElement(Field, {
			component: TextField,
			label: t53,
			name: "subject",
			id: "subject",
			fullWidth: true,
			variant: "outlined",
			size: "small",
			margin: "dense",
			required: true,
			disabled,
			InputProps: t56,
			InputLabelProps: t58
		});
		$[137] = disabled;
		$[138] = t53;
		$[139] = t56;
		$[140] = t58;
		$[141] = t59;
	} else t59 = $[141];
	let t60;
	if ($[142] === Symbol.for("react.memo_cache_sentinel")) {
		t60 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "nudge" });
		$[142] = t60;
	} else t60 = $[142];
	let t61;
	if ($[143] !== classes.editor) {
		t61 = { editor: classes.editor };
		$[143] = classes.editor;
		$[144] = t61;
	} else t61 = $[144];
	let t62;
	if ($[145] !== disabled || $[146] !== reminder || $[147] !== t61) {
		t62 = /* @__PURE__ */ React.createElement(CkRichEditor, {
			handleChange: handleTextEditorChange,
			classes: t61,
			data: reminder,
			editorRef,
			isUsingRef: true,
			readOnly: disabled
		});
		$[145] = disabled;
		$[146] = reminder;
		$[147] = t61;
		$[148] = t62;
	} else t62 = $[148];
	let t63;
	if ($[149] !== formRef || $[150] !== handleOnSubmit || $[151] !== t40 || $[152] !== t43 || $[153] !== t50 || $[154] !== t52 || $[155] !== t59 || $[156] !== t62) {
		t63 = /* @__PURE__ */ React.createElement(AmbientCard, {
			fullWidth: true,
			header: true
		}, /* @__PURE__ */ React.createElement(Form, {
			onSubmit: handleOnSubmit,
			ref: formRef
		}, t40, t43, t50, t52, t59, t60, t62));
		$[149] = formRef;
		$[150] = handleOnSubmit;
		$[151] = t40;
		$[152] = t43;
		$[153] = t50;
		$[154] = t52;
		$[155] = t59;
		$[156] = t62;
		$[157] = t63;
	} else t63 = $[157];
	let t64;
	if ($[158] === Symbol.for("react.memo_cache_sentinel")) {
		t64 = /* @__PURE__ */ React.createElement(LayoutUnit, { unit: "nudge" });
		$[158] = t64;
	} else t64 = $[158];
	let t65;
	if ($[159] !== shellHidden || $[160] !== shortcutContentFinderEnabled) {
		t65 = shortcutContentFinderEnabled && /* @__PURE__ */ React.createElement(AmbientCard, {
			fullWidth: true,
			header: true,
			lastChildBottomPadding: "0px",
			cardContentHeight: `calc(100vh - ${shellHidden ? "568px" : "623px"})`
		}, /* @__PURE__ */ React.createElement(ShortcutContentFinder, { onSelect: handleShortcutOnSelect }));
		$[159] = shellHidden;
		$[160] = shortcutContentFinderEnabled;
		$[161] = t65;
	} else t65 = $[161];
	let t66;
	if ($[162] !== classes.root || $[163] !== t36 || $[164] !== t63 || $[165] !== t65) {
		t66 = /* @__PURE__ */ React.createElement("div", { className: t35 }, t36, t63, t64, t65);
		$[162] = classes.root;
		$[163] = t36;
		$[164] = t63;
		$[165] = t65;
		$[166] = t66;
	} else t66 = $[166];
	return t66;
};
function _temp(state) {
	return state.shellHidden;
}
function _temp2(state_0) {
	return state_0.selectedNode;
}
function _temp3(nftc1, nftc2) {
	return nftc1?.value === nftc2?.value;
}
function _temp4(e_1) {
	return e_1;
}
function _temp5(p) {
	return p.catch(_temp4);
}
function _temp6(e_2) {
	return e_2;
}
function _temp7(p_0) {
	return p_0.catch(_temp6);
}
function _temp8(e_3) {
	return e_3;
}
function _temp9(p_1) {
	return p_1.catch(_temp8);
}
//#endregion
export { RemindersScreen };

//# sourceMappingURL=RemindersScreen.mjs.map