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] = "3d3b5cd3-f66f-4aea-b60b-e6bc5c8c0a93", e._sentryDebugIdIdentifier = "sentry-dbid-3d3b5cd3-f66f-4aea-b60b-e6bc5c8c0a93");
} catch (e) {}
import { c as __exportAll, i as Typography, n as addResourceBundles, r as useTranslation } from "./translation-Br5wIPO-.js";
import { r as Loader, t as Button } from "./Button-BDEdGXnd.js";
import { n as httpGet, s as useApiContext } from "./http-CHTzpXCd.js";
import { r as useLegalEntity } from "./useLegalEntity-Dm6g0wmt.js";
import { t as getLegalEntityCountry } from "./getLegalEntityCountry-C6bSV6sB.js";
import { a as noop } from "./AnalyticsContext-C0HNdPss.js";
import { t as _rolldown_dynamic_import_helper_default } from "./_rolldown_dynamic_import_helper-CCXvMgfE.js";
import { t as StackLayout } from "./StackLayout-BMQXXBDb.js";
import { t as TaskVerificationStatus } from "./TaskVerificationStatus-jBBIJN_A.js";
import { i as TaskStatuses, n as TASK_STATUS_POLLING_INTERVAL_MS } from "./taskStatus-CvMqhrOK.js";
import { t as TaskTypes } from "./taskTypes-DWaxzvnQ.js";
import { t as useAnalyticsContext } from "./useAnalyticsContext-DfTXpZbA.js";
import { t as Image } from "./Image-BPAtdM5Y.js";
import { t as getIndividualLegalEntityName } from "./getName-ODLD6UPV.js";
import { t as IndividualDropin } from "./IndividualDropin-DImA9Gce.js";
import { t as List } from "./List-DLrcpMVd.js";
import { t as LandingLayout } from "./LandingLayout-C9eryD6V.js";
import { t as useTaskStatus } from "./useTaskStatus-DzJWcN_l.js";
import { t as ListItem } from "./ListItem-ByYbZdGG.js";
import { n as getDecisionMakerDescription, r as getLandingLayoutProps, t as DecisionMakerDetails } from "./DecisionMakerDetails-DElp9pZu.js";
import { lazy } from "preact/compat";
import { useCallback as useCallback$1, useEffect as useEffect$1, useMemo as useMemo$1, useState as useState$1 } from "preact/hooks";
import { jsx, jsxs } from "preact/jsx-runtime";
import { useQuery } from "@tanstack/preact-query";
//#region src/api/invitedEntity/useInvitedEntityAssociationData.ts
var getInvitedEntityAssociationData = async (invitedLegalEntityId, baseUrl) => {
	return httpGet({
		baseUrl,
		path: `invitedLegalEntities/${invitedLegalEntityId}/entityAssociationData`
	});
};
var useInvitedEntityAssociationData = (invitedLegalEntityId, options) => {
	const { baseUrl } = useApiContext();
	return useQuery({
		queryKey: ["entityAssociationData", invitedLegalEntityId],
		queryFn: () => getInvitedEntityAssociationData(invitedLegalEntityId, baseUrl.value),
		...options
	});
};
//#endregion
//#region src/api/invitedEntity/useInvitedEntityRootCapabilities.ts
var getInvitedEntityRootCapabilities = async (invitedLegalEntityId, baseUrl) => {
	return httpGet({
		baseUrl,
		path: `invitedLegalEntities/${invitedLegalEntityId}/rootCapabilities`
	});
};
/**
* Retrieves a given legal entity.
*
* @param {boolean} isInvitedEntity :
*/
var useInvitedEntityRootCapabilities = () => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	const result = useQuery({
		queryKey: ["invitedEntityRootCapabilities", rootLegalEntityId.value],
		queryFn: () => getInvitedEntityRootCapabilities(rootLegalEntityId.value, baseUrl.value)
	});
	return {
		refetch: result.refetch,
		isLoading: result.isLoading,
		isError: result.isError,
		data: result.data?.capabilities
	};
};
//#endregion
//#region src/components/Individual/tasks/DecisionMakers/hooks/useInvitedDecisionMakerStep.ts
var POST_SUBMIT_STATUSES = [
	TaskStatuses.PROCESSING,
	TaskStatuses.ERROR,
	TaskStatuses.FINISHED
];
function useInvitedDecisionMakerStep() {
	const [activeStep, setActiveStep] = useState$1(void 0);
	const { data: taskStatus, isLoading: isTaskStatusLoading } = useTaskStatus("INVITED_INDIVIDUAL");
	let step = activeStep;
	if (activeStep === void 0 && !isTaskStatusLoading && taskStatus) step = POST_SUBMIT_STATUSES.includes(taskStatus.status) ? "submitSuccessStep" : "landingStep";
	return {
		step,
		setActiveStep,
		isTaskStatusLoading
	};
}
var InvitedDecisionMaker_module_default = {
	"invited-decision-makers-container": "adyen-kyc-invited-decision-makers-container",
	invitedDecisionMakersContainer: "adyen-kyc-invited-decision-makers-container"
};
//#endregion
//#region src/components/Individual/tasks/DecisionMakers/InvitedDecisionMaker/InvitedDecisionMakerGettingStarted/InvitedDecisionMakerGettingStarted.tsx
var decisionMakerGroup$1 = lazy(() => import("./decision-makers-group-CkP3dlRO.js"));
var InvitedDecisionMakerGettingStarted = ({ addDecisionMakerOnClick }) => {
	const { t } = useTranslation("individual");
	const { t: commonT } = useTranslation("common");
	const userEvents = useAnalyticsContext();
	useEffect$1(() => {
		userEvents.addPageEvent("Landed on page", {
			actionType: "navigate",
			label: "invitedDecisionMakerGettingStarted"
		});
	}, [userEvents]);
	return /* @__PURE__ */ jsx("div", {
		className: InvitedDecisionMaker_module_default.invitedDecisionMakersContainer,
		children: /* @__PURE__ */ jsx(LandingLayout, {
			media: /* @__PURE__ */ jsx(Image, { lazyLoadedImage: decisionMakerGroup$1 }),
			title: t(($) => $["tellUsAboutYourself"]),
			description: t(($) => $["invitedDecisionMakerIntroDescription"]),
			actions: /* @__PURE__ */ jsx(Button, {
				fullWidth: true,
				onClick: addDecisionMakerOnClick,
				children: commonT(($) => $["getStarted"])
			})
		})
	});
};
//#endregion
//#region src/components/Individual/tasks/DecisionMakers/hooks/useTaskStatusWithTimeout.ts
var MIN_POLLING_DURATION_MS = 5e3;
/**
* Custom hook that polls for a specific task status with a built-in timeout.
* It manages the timeout state, stopping polling if the task completes, errors out, or the timeout is reached.
*
* @param taskType - The specific type of task to monitor.
* @param timeoutMs - The duration in milliseconds before timing out if the task is still processing.
* @returns Status indicators and the current task status.
*/
var useTaskStatusWithTimeout = (taskType, timeoutMs = 16e3) => {
	const [hasTimedOut, setHasTimedOut] = useState$1(false);
	const [canStopPollingEarly, setCanStopPollingEarly] = useState$1(false);
	useEffect$1(() => {
		const timer = setTimeout(() => setCanStopPollingEarly(true), MIN_POLLING_DURATION_MS);
		return () => clearTimeout(timer);
	}, []);
	const { data: taskStatusResponse } = useTaskStatus(taskType, { refetchInterval: (query) => {
		const status = query.state.data?.status;
		if (canStopPollingEarly && (status === "FINISHED" || status === "ERROR")) return false;
		if (hasTimedOut) return false;
		return TASK_STATUS_POLLING_INTERVAL_MS;
	} });
	const submitStatus = taskStatusResponse?.status;
	useEffect$1(() => {
		let timer;
		if (submitStatus === TaskStatuses.PROCESSING) timer = setTimeout(() => {
			setHasTimedOut(true);
		}, timeoutMs);
		return () => {
			if (timer) clearTimeout(timer);
		};
	}, [submitStatus, timeoutMs]);
	const isLoading = submitStatus === TaskStatuses.PROCESSING && !hasTimedOut || submitStatus === void 0;
	const isErrorOrDetailsRequired = submitStatus === TaskStatuses.ERROR || submitStatus === TaskStatuses.DETAILS_REQUIRED;
	return {
		submitStatus,
		decisionMakerStatus: submitStatus ?? TaskStatuses.UNKNOWN,
		isLoading,
		isErrorOrDetailsRequired
	};
};
//#endregion
//#region src/components/Individual/tasks/DecisionMakers/hooks/useTrackSubmitStatus.ts
var statusToLabelMap = {
	[TaskStatuses.PROCESSING]: "invitedDecisionMakerSubmitProcessing",
	[TaskStatuses.FINISHED]: "invitedDecisionMakerSubmitSuccess",
	[TaskStatuses.ERROR]: "invitedDecisionMakerSubmitError",
	[TaskStatuses.DETAILS_REQUIRED]: "invitedDecisionMakerSubmitDetailsRequired"
};
var useTrackSubmitStatus = (isLoading, submitStatus) => {
	const userEvents = useAnalyticsContext();
	useEffect$1(() => {
		const label = isLoading ? "invitedDecisionMakerSubmitProcessing" : submitStatus ? statusToLabelMap[submitStatus] : void 0;
		if (label) userEvents.addPageEvent("Landed on page", {
			actionType: "navigate",
			label
		});
	}, [
		isLoading,
		submitStatus,
		userEvents
	]);
};
//#endregion
//#region src/components/Individual/tasks/DecisionMakers/InvitedDecisionMaker/InvitedDecisionMakerSubmitSuccess/InvitedDecisionMakerSubmitSuccess.tsx
var decisionMakerGroup = lazy(() => import("./decision-makers-group-CkP3dlRO.js"));
var InvitedDecisionMakerSubmitSuccess = ({ decisionMaker, handleEdit = noop, isInvitedEntity }) => {
	const { t } = useTranslation("individual");
	const [showDecisionMakerModal, setShowDecisionMakerModal] = useState$1(false);
	const { submitStatus, decisionMakerStatus, isLoading, isErrorOrDetailsRequired } = useTaskStatusWithTimeout("INVITED_INDIVIDUAL");
	useTrackSubmitStatus(isLoading, submitStatus);
	const landingLayoutProps = useMemo$1(() => getLandingLayoutProps(submitStatus, isErrorOrDetailsRequired, t), [
		submitStatus,
		isErrorOrDetailsRequired,
		t
	]);
	const handleOpenModal = useCallback$1(() => setShowDecisionMakerModal(true), []);
	const handleCloseModal = useCallback$1(() => setShowDecisionMakerModal(false), []);
	const decisionMakerWithStatus = useMemo$1(() => ({
		...decisionMaker,
		status: decisionMakerStatus
	}), [decisionMaker, decisionMakerStatus]);
	if (isLoading) return /* @__PURE__ */ jsx("div", {
		className: InvitedDecisionMaker_module_default.invitedDecisionMakersContainer,
		children: /* @__PURE__ */ jsxs(StackLayout, {
			align: "center",
			gap: "xSmall",
			children: [
				/* @__PURE__ */ jsx(Loader, {
					shortMessage: "",
					longMessage: ""
				}),
				/* @__PURE__ */ jsx(Typography, {
					variant: "title-l",
					el: "h1",
					children: t(($) => $["verifyingYourDetails"])
				}),
				/* @__PURE__ */ jsx(Typography, {
					variant: "body",
					el: "p",
					color: "secondary",
					children: t(($) => $["thisUsuallyTakesAbout15Seconds"])
				})
			]
		})
	});
	return /* @__PURE__ */ jsxs("div", {
		className: InvitedDecisionMaker_module_default.invitedDecisionMakersContainer,
		children: [
			/* @__PURE__ */ jsx(LandingLayout, {
				media: /* @__PURE__ */ jsx(Image, { lazyLoadedImage: decisionMakerGroup }),
				...landingLayoutProps
			}),
			(submitStatus === TaskStatuses.PROCESSING || isErrorOrDetailsRequired) && /* @__PURE__ */ jsxs(List, {
				variant: "grouped-primary",
				padding: "medium",
				dividers: false,
				children: [/* @__PURE__ */ jsx(ListItem, {
					accessory: /* @__PURE__ */ jsx(TaskVerificationStatus, { status: decisionMakerStatus }),
					avatar: {
						iconName: "user",
						circle: true
					},
					title: decisionMaker.name,
					description: getDecisionMakerDescription(decisionMaker.types, t)
				}), isErrorOrDetailsRequired && /* @__PURE__ */ jsx("div", {
					className: "u-margin-top-16",
					children: /* @__PURE__ */ jsx(Button, {
						fullWidth: true,
						onClick: handleOpenModal,
						children: t(($) => $["reviewDetails"])
					})
				})]
			}),
			isErrorOrDetailsRequired && showDecisionMakerModal && /* @__PURE__ */ jsx(DecisionMakerDetails, {
				handleClose: handleCloseModal,
				handleEdit,
				decisionMaker: decisionMakerWithStatus,
				isInvitedEntity
			})
		]
	});
};
//#endregion
//#region src/components/EmbeddedDropins/InvitedDecisionMakerComponent/InvitedDecisionMakerComponent.tsx
var InvitedDecisionMakerComponent_exports = /* @__PURE__ */ __exportAll({ InvitedDecisionMakerComponent: () => InvitedDecisionMakerComponent });
function InvitedDecisionMakerComponent({ invitedIndividualId }) {
	if (!invitedIndividualId) throw new Error("Must provide `invitedIndividualEntityId`");
	const { i18n } = useTranslation();
	addResourceBundles(i18n, [
		{
			ns: "common",
			importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({
				"../../../language/locales/bg-BG.json": () => import("./bg-BG-NwL6SZRu.js"),
				"../../../language/locales/cs-CZ.json": () => import("./cs-CZ-BZkot6xs.js"),
				"../../../language/locales/da-DK.json": () => import("./da-DK-Bc6oX5Ct.js"),
				"../../../language/locales/de-DE.json": () => import("./de-DE-JZBqb8ce.js"),
				"../../../language/locales/el-GR.json": () => import("./el-GR-C8jFvyDg.js"),
				"../../../language/locales/en-US.instructions.json": () => import("./en-US.instructions-DlxMDbRu.js"),
				"../../../language/locales/en-US.json": () => import("./en-US-Cq6Cl6Yl.js"),
				"../../../language/locales/es-ES.json": () => import("./es-ES-mdSA-CIT.js"),
				"../../../language/locales/et-EE.json": () => import("./et-EE-B4ZMHksf.js"),
				"../../../language/locales/fi-FI.json": () => import("./fi-FI-koFpyMaq.js"),
				"../../../language/locales/fr-FR.json": () => import("./fr-FR-B0eVVc8V.js"),
				"../../../language/locales/hr-HR.json": () => import("./hr-HR-D_X-RNUl.js"),
				"../../../language/locales/hu-HU.json": () => import("./hu-HU-3FpAw9b1.js"),
				"../../../language/locales/it-IT.json": () => import("./it-IT-BgULENxX.js"),
				"../../../language/locales/ja-JP.json": () => import("./ja-JP-BT70_5Cd.js"),
				"../../../language/locales/lt-LT.json": () => import("./lt-LT-CKltvr9j.js"),
				"../../../language/locales/lv-LV.json": () => import("./lv-LV-DwsdNJrk.js"),
				"../../../language/locales/nl-NL.json": () => import("./nl-NL-CxlTSECX.js"),
				"../../../language/locales/no-NO.json": () => import("./no-NO-FtH9gIpv.js"),
				"../../../language/locales/pl-PL.json": () => import("./pl-PL-CK40GB3R.js"),
				"../../../language/locales/pt-BR.json": () => import("./pt-BR-zUBVM8_b.js"),
				"../../../language/locales/pt-PT.json": () => import("./pt-PT-CxnB9Jff.js"),
				"../../../language/locales/ro-RO.json": () => import("./ro-RO-Cuw1RmFc.js"),
				"../../../language/locales/sk-SK.json": () => import("./sk-SK-1i0L4zIs.js"),
				"../../../language/locales/sl-SI.json": () => import("./sl-SI-D3zK3MPP.js"),
				"../../../language/locales/sv-SE.json": () => import("./sv-SE-CVRa-6Y0.js")
			}), `../../../language/locales/${lang}.json`, 6)
		},
		{
			ns: "ui",
			importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({
				"../../ui/language/bg-BG.json": () => import("./bg-BG-IjNKw0Zu.js"),
				"../../ui/language/cs-CZ.json": () => import("./cs-CZ-B6AZX4nL.js"),
				"../../ui/language/da-DK.json": () => import("./da-DK-B8aHvZ1W.js"),
				"../../ui/language/de-DE.json": () => import("./de-DE-cPL-uSMG.js"),
				"../../ui/language/el-GR.json": () => import("./el-GR-BDXwftjw.js"),
				"../../ui/language/en-US.json": () => import("./en-US-_l9425V1.js"),
				"../../ui/language/es-ES.json": () => import("./es-ES-D67pkLVu.js"),
				"../../ui/language/et-EE.json": () => import("./et-EE-Dg93VJbx.js"),
				"../../ui/language/fi-FI.json": () => import("./fi-FI-BNtrKnDN.js"),
				"../../ui/language/fr-FR.json": () => import("./fr-FR-DYDmBWWT.js"),
				"../../ui/language/hr-HR.json": () => import("./hr-HR-DbebVQF9.js"),
				"../../ui/language/hu-HU.json": () => import("./hu-HU-e9KN8lp6.js"),
				"../../ui/language/it-IT.json": () => import("./it-IT-16IjDttL.js"),
				"../../ui/language/ja-JP.json": () => import("./ja-JP-CJY6uqPb.js"),
				"../../ui/language/lt-LT.json": () => import("./lt-LT-BVVTYN3z.js"),
				"../../ui/language/lv-LV.json": () => import("./lv-LV-BeobSRYx.js"),
				"../../ui/language/nl-NL.json": () => import("./nl-NL-DKpjFbpm.js"),
				"../../ui/language/no-NO.json": () => import("./no-NO-CG5RteG_.js"),
				"../../ui/language/pl-PL.json": () => import("./pl-PL-R6bNjSQB.js"),
				"../../ui/language/pt-BR.json": () => import("./pt-BR-VlNZLr8f.js"),
				"../../ui/language/pt-PT.json": () => import("./pt-PT-Dmor9x6o.js"),
				"../../ui/language/ro-RO.json": () => import("./ro-RO-BRtHlgch.js"),
				"../../ui/language/sk-SK.json": () => import("./sk-SK--ohjuOMW.js"),
				"../../ui/language/sl-SI.json": () => import("./sl-SI-DWJzi8r_.js"),
				"../../ui/language/sv-SE.json": () => import("./sv-SE-DTpqjuJd.js")
			}), `../../ui/language/${lang}.json`, 5)
		},
		{
			ns: "individual",
			importFn: (lang) => _rolldown_dynamic_import_helper_default(/* @__PURE__ */ Object.assign({
				"../../Individual/language/bg-BG.json": () => import("./bg-BG-CS6SQDE2.js"),
				"../../Individual/language/cs-CZ.json": () => import("./cs-CZ-C-nfIYKA.js"),
				"../../Individual/language/da-DK.json": () => import("./da-DK-DO88W3qD.js"),
				"../../Individual/language/de-DE.json": () => import("./de-DE-YX6rtv17.js"),
				"../../Individual/language/el-GR.json": () => import("./el-GR-Be15a5W8.js"),
				"../../Individual/language/en-US.instructions.json": () => import("./en-US.instructions-CXa3foCe.js"),
				"../../Individual/language/en-US.json": () => import("./en-US-BDZwHN0Y.js"),
				"../../Individual/language/es-ES.json": () => import("./es-ES-D1BkDJkz.js"),
				"../../Individual/language/et-EE.json": () => import("./et-EE-BZ26f0MN.js"),
				"../../Individual/language/fi-FI.json": () => import("./fi-FI-CeJPt0gg.js"),
				"../../Individual/language/fr-FR.json": () => import("./fr-FR-lfoSPY0e.js"),
				"../../Individual/language/hr-HR.json": () => import("./hr-HR-CMgsuYh2.js"),
				"../../Individual/language/hu-HU.json": () => import("./hu-HU-C0Y9wmOY.js"),
				"../../Individual/language/it-IT.json": () => import("./it-IT-Cm3ujfY_.js"),
				"../../Individual/language/ja-JP.json": () => import("./ja-JP-BbXt47jb.js"),
				"../../Individual/language/lt-LT.json": () => import("./lt-LT-CDdoDT7A.js"),
				"../../Individual/language/lv-LV.json": () => import("./lv-LV-DpfhFur0.js"),
				"../../Individual/language/nl-NL.json": () => import("./nl-NL-B0uwKjKV.js"),
				"../../Individual/language/no-NO.json": () => import("./no-NO-BlsDONGK.js"),
				"../../Individual/language/pl-PL.json": () => import("./pl-PL-Ct3cI8Sk.js"),
				"../../Individual/language/pt-BR.json": () => import("./pt-BR-CqDjOIYt.js"),
				"../../Individual/language/pt-PT.json": () => import("./pt-PT-Dl_yfKGH.js"),
				"../../Individual/language/ro-RO.json": () => import("./ro-RO-D9YjxrDi.js"),
				"../../Individual/language/sk-SK.json": () => import("./sk-SK-CQ1N3c8X.js"),
				"../../Individual/language/sl-SI.json": () => import("./sl-SI-B8-rZ169.js"),
				"../../Individual/language/sv-SE.json": () => import("./sv-SE-guJk9E1n.js")
			}), `../../Individual/language/${lang}.json`, 5)
		}
	]);
	const { step, setActiveStep, isTaskStatusLoading } = useInvitedDecisionMakerStep();
	const { data: invitedIndividualLe } = useLegalEntity(invitedIndividualId);
	const { data: invitedEntityAssociationData } = useInvitedEntityAssociationData(invitedIndividualId);
	const { data: rootCapabilities } = useInvitedEntityRootCapabilities();
	const invitedEntityDetails = useMemo$1(() => {
		if (!invitedEntityAssociationData) return { roles: [] };
		const { associations } = invitedEntityAssociationData;
		return {
			roles: Array.from(new Set(associations.map((a) => a.type))),
			jobTitle: associations.find((a) => a.jobTitle)?.jobTitle,
			rootCapabilities
		};
	}, [invitedEntityAssociationData, rootCapabilities]);
	const decisionMaker = useMemo$1(() => ({
		reference: invitedIndividualId,
		name: getIndividualLegalEntityName(invitedIndividualLe),
		types: invitedEntityDetails.roles,
		legalEntityType: invitedIndividualLe?.type
	}), [
		invitedIndividualId,
		invitedIndividualLe,
		invitedEntityDetails.roles
	]);
	if (!invitedIndividualLe || isTaskStatusLoading || step === void 0) return /* @__PURE__ */ jsx(Loader, {});
	const country = getLegalEntityCountry(invitedIndividualLe);
	const handleSubmitSuccess = () => setActiveStep("submitSuccessStep");
	switch (step) {
		case "landingStep": return /* @__PURE__ */ jsx(InvitedDecisionMakerGettingStarted, { addDecisionMakerOnClick: () => setActiveStep("provideDetailsStep") });
		case "provideDetailsStep": return /* @__PURE__ */ jsx(IndividualDropin, {
			taskType: TaskTypes.DECISION_MAKER,
			taskName: "decisionMakerDetails",
			legalEntityResponse: invitedIndividualLe,
			problems: void 0,
			country,
			asModal: true,
			handleHomeClick: () => setActiveStep("landingStep"),
			isInvitedEntity: true,
			invitedEntityDetails,
			onSubmit: handleSubmitSuccess
		});
		case "submitSuccessStep": return /* @__PURE__ */ jsx(InvitedDecisionMakerSubmitSuccess, {
			decisionMaker,
			handleEdit: () => setActiveStep("provideDetailsStep"),
			isInvitedEntity: true
		});
	}
}
//#endregion
export { InvitedDecisionMakerComponent_exports as n, InvitedDecisionMakerComponent as t };
