import { FluentButton } from "../../UI/inputs/buttons/FluentButton.mjs";
import { c } from "react-compiler-runtime";
import React, { forwardRef } from "react";
import { FormSpy } from "react-final-form";
//#region src/utilities/form/SubmitButton.tsx
/**
* A MUI Button varaint intended for use as the submit button for a form
*/
let SubmitButton = forwardRef((props, ref) => {
	const $ = c(12);
	let disabled;
	let otherProps;
	let t0;
	let t1;
	if ($[0] !== props) {
		({ButtonComponent: t0, disabled, disablePristine: t1, ...otherProps} = props);
		$[0] = props;
		$[1] = disabled;
		$[2] = otherProps;
		$[3] = t0;
		$[4] = t1;
	} else {
		disabled = $[1];
		otherProps = $[2];
		t0 = $[3];
		t1 = $[4];
	}
	const ButtonComponent = t0 === void 0 ? FluentButton : t0;
	const disablePristine = t1 === void 0 ? true : t1;
	let t2;
	if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
		t2 = {
			submitting: true,
			pristine: true
		};
		$[5] = t2;
	} else t2 = $[5];
	let t3;
	if ($[6] !== ButtonComponent || $[7] !== disablePristine || $[8] !== disabled || $[9] !== otherProps || $[10] !== ref) {
		t3 = /* @__PURE__ */ React.createElement(FormSpy, { subscription: t2 }, (t4) => {
			const { submitting, pristine } = t4;
			return /* @__PURE__ */ React.createElement(ButtonComponent, {
				ref,
				type: "submit",
				disabled: submitting || disablePristine && pristine || disabled,
				...otherProps
			});
		});
		$[6] = ButtonComponent;
		$[7] = disablePristine;
		$[8] = disabled;
		$[9] = otherProps;
		$[10] = ref;
		$[11] = t3;
	} else t3 = $[11];
	return t3;
});
SubmitButton.displayName = "SubmitButton";
//#endregion
export { SubmitButton };

//# sourceMappingURL=SubmitButton.mjs.map