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] = "5cbf2ef6-651e-4e3a-a281-dabc9237f03c", e._sentryDebugIdIdentifier = "sentry-dbid-5cbf2ef6-651e-4e3a-a281-dabc9237f03c");
} catch (e) {}
import { i as Typography, r as useTranslation } from "./translation-Br5wIPO-.js";
import { t as Button } from "./Button-BDEdGXnd.js";
import { t as useAnalyticsContext } from "./useAnalyticsContext-DfTXpZbA.js";
import { t as Modal } from "./Modal-DOC6JgPI.js";
import { useEffect, useState } from "preact/hooks";
import { jsx, jsxs } from "preact/jsx-runtime";
var Confirm_module_default = {
	confirm: "adyen-kyc-confirm",
	"confirm-message": "adyen-kyc-confirm-message",
	confirmMessage: "adyen-kyc-confirm-message",
	"confirm-actions": "adyen-kyc-confirm-actions",
	confirmActions: "adyen-kyc-confirm-actions"
};
//#endregion
//#region src/components/ui/molecules/Confirm/Confirm.tsx
var Confirm = ({ description, cancelText, confirmText, critical = false, onCancel, onConfirm, title, analyticsEventLabel }) => {
	const { t } = useTranslation("ui");
	const userEvents = useAnalyticsContext();
	const [isInFlight, setIsInFlight] = useState(false);
	const showCancelButton = onCancel !== void 0;
	const buttonVariant = critical ? "critical" : "primary";
	useEffect(() => {
		userEvents.addTaskEvent("Opened modal", {
			actionType: "open",
			label: analyticsEventLabel
		});
	}, []);
	const handleConfirm = async () => {
		setIsInFlight(true);
		try {
			await onConfirm();
		} finally {
			setIsInFlight(false);
		}
	};
	return /* @__PURE__ */ jsx(Modal, {
		size: "small",
		transition: "dropIn",
		showCloseButton: false,
		ariaLabel: title,
		children: /* @__PURE__ */ jsxs("div", {
			className: Confirm_module_default.confirm,
			children: [/* @__PURE__ */ jsxs("div", {
				className: Confirm_module_default.confirmMessage,
				children: [/* @__PURE__ */ jsx(Typography, {
					variant: "title",
					el: "h3",
					children: title
				}), description && /* @__PURE__ */ jsx(Typography, {
					variant: "body",
					el: "p",
					children: description
				})]
			}), /* @__PURE__ */ jsxs("div", {
				className: Confirm_module_default.confirmActions,
				children: [showCancelButton && /* @__PURE__ */ jsx(Button, {
					onClick: onCancel,
					variant: "secondary",
					disabled: isInFlight,
					children: cancelText ?? t(($) => $["cancel"])
				}), /* @__PURE__ */ jsx(Button, {
					onClick: handleConfirm,
					variant: buttonVariant,
					loading: isInFlight,
					children: confirmText ?? t(($) => $["confirm"])
				})]
			})]
		})
	});
};
//#endregion
export { Confirm as t };
