import { Field as Field$1 } from "../utilities/form/Field.mjs";
import { FluentTextFieldAutoComplete } from "../UI/inputs/textField/FluentTextFieldAutoComplete.mjs";
import { FluentDialog } from "../UI/feedback/FluentDialog.mjs";
import { c } from "react-compiler-runtime";
import React from "react";
import { useForm } from "react-final-form";
import { useTranslation } from "react-i18next";
//#region src/inquiry/ExecuteApiDialog.jsx
const ExecuteApiDialog = (props) => {
	const $ = c(32);
	let handleCloseDialog;
	let message;
	let open;
	let other;
	let t0;
	let t1;
	let t2;
	if ($[0] !== props) {
		({open, handleCloseDialog, actionLabel: t0, title: t1, message, apiMethods: t2, ...other} = props);
		$[0] = props;
		$[1] = handleCloseDialog;
		$[2] = message;
		$[3] = open;
		$[4] = other;
		$[5] = t0;
		$[6] = t1;
		$[7] = t2;
	} else {
		handleCloseDialog = $[1];
		message = $[2];
		open = $[3];
		other = $[4];
		t0 = $[5];
		t1 = $[6];
		t2 = $[7];
	}
	const actionLabel = t0 === void 0 ? "Execute" : t0;
	const title = t1 === void 0 ? "Execute the below Api" : t1;
	let t3;
	if ($[8] !== t2) {
		t3 = t2 === void 0 ? [] : t2;
		$[8] = t2;
		$[9] = t3;
	} else t3 = $[9];
	const apiMethods = t3;
	const form = useForm();
	const { t } = useTranslation();
	let t4;
	if ($[10] !== form) {
		t4 = () => {
			form.submit();
		};
		$[10] = form;
		$[11] = t4;
	} else t4 = $[11];
	const handleSubmit = t4;
	let t5;
	if ($[12] !== t) {
		t5 = t("Cancel");
		$[12] = t;
		$[13] = t5;
	} else t5 = $[13];
	let t6;
	if ($[14] !== t) {
		t6 = t("Api(s)");
		$[14] = t;
		$[15] = t6;
	} else t6 = $[15];
	let t7;
	if ($[16] !== apiMethods) {
		t7 = apiMethods || [];
		$[16] = apiMethods;
		$[17] = t7;
	} else t7 = $[17];
	const t8 = apiMethods[0] || null;
	let t9;
	if ($[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
		t9 = /* @__PURE__ */ React.createElement(Field$1, {
			component: FluentTextFieldAutoComplete,
			label: t6,
			id: "apis",
			name: "apiMethod",
			fullWidth: true,
			variant: "outlined",
			margin: "normal",
			size: "small",
			options: t7,
			initialValue: t8,
			required: true,
			optionKey: "name"
		});
		$[18] = t6;
		$[19] = t7;
		$[20] = t8;
		$[21] = t9;
	} else t9 = $[21];
	let t10;
	if ($[22] !== actionLabel || $[23] !== handleCloseDialog || $[24] !== handleSubmit || $[25] !== message || $[26] !== open || $[27] !== other || $[28] !== t5 || $[29] !== t9 || $[30] !== title) {
		t10 = /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(FluentDialog, {
			open,
			title,
			actionOne: handleCloseDialog,
			actionTwo: handleSubmit,
			labelOne: t5,
			labelTwo: actionLabel,
			onClose: handleCloseDialog,
			message,
			maxWidth: "sm",
			...other
		}, t9));
		$[22] = actionLabel;
		$[23] = handleCloseDialog;
		$[24] = handleSubmit;
		$[25] = message;
		$[26] = open;
		$[27] = other;
		$[28] = t5;
		$[29] = t9;
		$[30] = title;
		$[31] = t10;
	} else t10 = $[31];
	return t10;
};
//#endregion
export { ExecuteApiDialog };

//# sourceMappingURL=ExecuteApiDialog.mjs.map