try {
	let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
	n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "e5e78a1d-3f3d-40f9-aa55-f8f89b16e5ae", e._sentryDebugIdIdentifier = "sentry-dbid-e5e78a1d-3f3d-40f9-aa55-f8f89b16e5ae");
} catch (e) {}
import { r as useTranslation } from "./translation-Br5wIPO-.js";
import { t as Button } from "./Button-BDEdGXnd.js";
import { r as httpPost, s as useApiContext } from "./http-CHTzpXCd.js";
import { t as Header } from "./Header-B_MIsVov.js";
import { t as useToastContext } from "./useToastContext-CK7UoZ5Z.js";
import { t as LoaderWrapper } from "./LoaderWrapper-CRf5MAK1.js";
import { t as Checkbox } from "./Checkbox-BJJIXNHL.js";
import { t as Spacer } from "./Spacer-D1yp_1Io.js";
import { useState } from "preact/hooks";
import { jsx, jsxs } from "preact/jsx-runtime";
import { useMutation } from "@tanstack/preact-query";
//#region src/api/legalEntity/useConfirmReview.ts
var confirmReview = async (legalEntityId, baseUrl) => {
	return httpPost({
		baseUrl,
		path: `legalEntities/${legalEntityId}/confirmDataReview`
	});
};
var useConfirmReview = (options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	return useMutation({
		mutationFn: () => {
			return confirmReview(rootLegalEntityId.value, baseUrl.value);
		},
		...options
	});
};
//#endregion
//#region src/components/Shared/tasks/Review/Review.tsx
function Review({ handleHomeClick }) {
	const { t } = useTranslation("common");
	const [loadingStatus, setLoadingStatus] = useState();
	const { showToast } = useToastContext();
	const [hasConfirmed, setHasConfirmed] = useState(false);
	const content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(LoaderWrapper, {
		status: loadingStatus,
		formOpacityWhenLoading: .3,
		showSpinner: false,
		children: [
			/* @__PURE__ */ jsx(Header, { title: t(($) => $["submitReviewOfYourData"]) }),
			/* @__PURE__ */ jsx("span", { children: t(($) => $["pleaseNote"]) }),
			/* @__PURE__ */ jsx("br", {}),
			/* @__PURE__ */ jsx("br", {}),
			/* @__PURE__ */ jsx(Checkbox, {
				id: "review-checkbox",
				checked: hasConfirmed,
				onChange: setHasConfirmed,
				label: t(($) => $["byClickingSubmitReview"]),
				name: "confirmReviewData"
			})
		]
	}) });
	const { mutateAsync: confirmReview } = useConfirmReview();
	const onConfirmClick = async () => {
		try {
			setLoadingStatus("loading");
			await confirmReview();
			setLoadingStatus("success");
			showToast({
				label: t(($) => $["submitSuccessful"]),
				variant: "success"
			});
			handleHomeClick();
		} catch {
			showToast({
				label: t(($) => $["submitFailed"]),
				variant: "error"
			});
		} finally {
			setLoadingStatus("success");
		}
	};
	return /* @__PURE__ */ jsxs("div", { children: [
		content,
		" ",
		/* @__PURE__ */ jsxs("div", {
			class: "u-display-flex u-margin-top-48",
			children: [
				/* @__PURE__ */ jsx(Button, {
					variant: "secondary",
					onClick: handleHomeClick,
					children: t(($) => $["goToOverview"])
				}),
				/* @__PURE__ */ jsx(Spacer, {}),
				/* @__PURE__ */ jsx(Button, {
					onClick: onConfirmClick,
					disabled: !hasConfirmed,
					children: t(($) => $["submitReview"])
				})
			]
		})
	] });
}
//#endregion
export { Review };
