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] = "df48b41f-ac7c-41da-a94e-2f92ef105cf3", e._sentryDebugIdIdentifier = "sentry-dbid-df48b41f-ac7c-41da-a94e-2f92ef105cf3");
} catch (e) {}
import { r as useTranslation } from "./translation-Br5wIPO-.js";
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { o as objectsDeepEqual } from "./AnalyticsContext-C0HNdPss.js";
import { t as useToggleContext } from "./useToggleContext-CLfowItk.js";
import "./Header-B_MIsVov.js";
import { t as CountryCodes } from "./country-code-D3oCpE4i.js";
import { n as translateTranslatable } from "./utils-g_Wl4-9Z.js";
import "./Address-CHpJLi-Q.js";
import "./ErrorPanel-5g1eTEVD.js";
import { a as alphanumericInputs, c as nonInputs, i as alphaInputs, l as numericInputs, s as makeMask, t as MaskedInput, u as spacer } from "./MaskedInput-uN8G9HRq.js";
import "./validate-DlG5LXuM.js";
import { r as MemoizedDocumentUpload } from "./TaxInformationField-CJyqFS0F.js";
import { t as uppercase } from "./uppercase-DKruhEuk.js";
import { a as validateNotEmptyOnBlur, o as validatePatternOnBlur } from "./patternValidators-DMnU4iGe.js";
import { t as resolveFieldMetadata } from "./fieldConfigurations-B3oqm4GC.js";
import { t as Field } from "./Field-BEqknhTe.js";
import { t as Checkbox } from "./Checkbox-BJJIXNHL.js";
import "./useForm-DzG9tJAE.js";
import { t as InputText } from "./InputText-CadVntiC.js";
import { t as RadioGroup } from "./RadioGroup-XuCtbRrH.js";
import "./ContextGuidance-CxOv00_a.js";
import { i as getCompanyRegistrationNumberOptions, l as registrationNumberDefaultFieldConfig, n as getDefaultRegistrationNumberType, t as CompanyRegistrationNumberTypeSelector, u as registrationNumberDefaultFieldMetadata } from "./CompanyRegistrationNumberTypeSelector-CeRtLSxc.js";
import { memo } from "preact/compat";
import { useCallback as useCallback$1, useEffect as useEffect$1, useMemo as useMemo$1 } from "preact/hooks";
import { Fragment as Fragment$1, jsx, jsxs } from "preact/jsx-runtime";
import "preact";
//#region src/components/Shared/fields/BusinessRegistrationNumberField/BusinessRegistrationNumberField.tsx
var BUSINESS_REGISTRATION_NUMBER_FIELD = [
	"registrationNumber",
	"registrationNumberType",
	"exemptedFromRegistrationNumber"
];
function BusinessRegistrationNumberField({ data, valid, errors, labels, mask, helperText, readonly, shouldValidate, optional, handleChangeFor, country, state, canExempt, companyType, invertCompanyTypeFilter }) {
	const { t } = useTranslation("common");
	const registrationNumberOptions = getCompanyRegistrationNumberOptions(country, companyType, invertCompanyTypeFilter);
	const defaultType = getDefaultRegistrationNumberType(data.registrationNumber, country, companyType, invertCompanyTypeFilter);
	const showExemptedOption = canExempt && !!registrationNumberOptions && registrationNumberOptions.length > 1;
	const registrationNumberType = data.exemptedFromRegistrationNumber ? "exempted" : data.registrationNumberType ? data.registrationNumberType : defaultType;
	const fieldMetadata = resolveFieldMetadata(registrationNumberDefaultFieldConfig[country], {
		registrationNumberType: registrationNumberType === "exempted" ? void 0 : registrationNumberType,
		state
	}, registrationNumberDefaultFieldMetadata);
	const handleRegistrationNumberChange = (e, mode) => {
		const value = typeof e === "string" ? e : e.currentTarget.value;
		handleChangeFor("registrationNumber", mode)(value);
		handleChangeFor("registrationNumberType")(registrationNumberType);
	};
	const handleExemptedFromRegistrationNumber = (exempt) => {
		if (exempt) handleChangeFor("registrationNumber")("");
		handleChangeFor("exemptedFromRegistrationNumber")(exempt);
	};
	const handleCompanyRegistrationNumberTypeChange = (regNumberType) => {
		if (regNumberType === "exempted") {
			if (!canExempt) throw Error(`${country} does not allow tax exemptions`);
			handleChangeFor("registrationNumber")("");
			handleChangeFor("exemptedFromRegistrationNumber")(true);
			handleChangeFor("registrationNumberType")(void 0);
			return;
		}
		if (canExempt && data.exemptedFromRegistrationNumber === true) handleChangeFor("exemptedFromRegistrationNumber")(false);
		handleChangeFor("registrationNumber")("");
		handleChangeFor("registrationNumberType")(regNumberType);
	};
	if (registrationNumberType && registrationNumberType !== "exempted") {
		if (!registrationNumberOptions?.find((option) => option.id === registrationNumberType)) handleChangeFor("registrationNumberType")(defaultType);
	}
	return /* @__PURE__ */ jsxs("div", { children: [
		/* @__PURE__ */ jsx(CompanyRegistrationNumberTypeSelector, {
			companyType,
			country,
			invertCompanyTypeFilter,
			setSelected: handleCompanyRegistrationNumberTypeChange,
			selected: registrationNumberType,
			exemptedOptionLabel: showExemptedOption ? labels.exemptedFromRegistrationNumber : void 0
		}),
		/* @__PURE__ */ jsx(MaskedInput, {
			"aria-required": true,
			"aria-invalid": !valid.registrationNumber,
			name: "registrationNumber",
			type: "text",
			value: data?.registrationNumber ?? "",
			label: labels.registrationNumber ?? "",
			formatGuidance: translateTranslatable(t, fieldMetadata.guidanceText),
			errorMessage: errors.registrationNumber,
			isValid: Boolean(valid.registrationNumber),
			onInput: (e) => handleRegistrationNumberChange(e, "input"),
			onBlur: (e) => handleRegistrationNumberChange(e, "blur"),
			disabled: data.exemptedFromRegistrationNumber,
			optional,
			readonly,
			shouldValidate: !optional && shouldValidate,
			helper: helperText,
			...mask
		}),
		canExempt && !showExemptedOption && /* @__PURE__ */ jsx(Field, {
			name: "exemptedFromRegistrationNumber",
			children: (childProps) => /* @__PURE__ */ jsx(Checkbox, {
				...childProps,
				"aria-required": false,
				"aria-invalid": false,
				name: "exemptedFromRegistrationNumber",
				value: "exemptedFromRegistrationNumber",
				checked: Boolean(data.exemptedFromRegistrationNumber),
				label: labels?.exemptedFromRegistrationNumber,
				readonly,
				onChange: handleExemptedFromRegistrationNumber
			})
		})
	] });
}
//#endregion
//#region src/components/Shared/fields/DBANameField/DBANameField.tsx
var DBA_NAME_FIELD = ["hasDoingBusinessAs", "doingBusinessAs"];
function DBANameField({ data, valid, errors, readonly, handleChangeFor }) {
	const { t } = useTranslation("common");
	const hasDoingBusinessAsValue = useMemo$1(() => {
		if (typeof data.hasDoingBusinessAs !== "boolean") return void 0;
		return data.hasDoingBusinessAs ? "yes" : "no";
	}, [data.hasDoingBusinessAs]);
	const handleHasDoingBusinessAsChange = (val) => {
		handleChangeFor("hasDoingBusinessAs")(val === "yes" ? true : false);
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Field, {
		el: "fieldset",
		name: "hasDoingBusinessAsName",
		label: t(($) => $["hasDba"]),
		helper: t(($) => $["hasDba__helperText"]),
		isValid: valid.hasDoingBusinessAs,
		errorMessage: errors.hasDoingBusinessAs,
		children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, {
			...childProps,
			name: "hasDoingBusinessAs",
			items: [{
				id: "yes",
				name: "yes"
			}, {
				id: "no",
				name: "no"
			}],
			value: hasDoingBusinessAsValue,
			onChange: handleHasDoingBusinessAsChange,
			horizontal: true
		})
	}), data.hasDoingBusinessAs && /* @__PURE__ */ jsx(Field, {
		name: "doingBusinessAs",
		label: t(($) => $["doingBusinessAs"]),
		errorMessage: errors.doingBusinessAs,
		isValid: valid.doingBusinessAs,
		children: (childProps) => /* @__PURE__ */ jsx(InputText, {
			...childProps,
			"aria-required": true,
			"aria-invalid": !valid.doingBusinessAs,
			name: "doingBusinessAs",
			value: data.doingBusinessAs,
			readonly,
			onInput: handleChangeFor("doingBusinessAs", "input"),
			onBlur: handleChangeFor("doingBusinessAs", "blur")
		})
	})] });
}
//#endregion
//#region src/components/Shared/fields/DBANameField/fieldConfig.ts
var doingBusinessAsAbsentFieldMetadata = { validators: [validateNotEmptyOnBlur] };
var doingBusinessAsFieldMetadata = { validators: [validateNotEmptyOnBlur] };
//#endregion
//#region src/components/Shared/fields/VatNumberField/fieldConfig.ts
var vatAbsenceReasonMetadata = { validators: [validateNotEmptyOnBlur] };
var defaultFieldMetadata = { label: "vatNumber" };
var defaultFieldConfig = {
	[CountryCodes.Austria]: {
		label: "UST-ID",
		validators: validatePatternOnBlur(/^ATU\d{8}$/),
		mask: { mask: makeMask(...nonInputs("ATU", { includeInValue: true }), spacer, ...numericInputs(8)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "8",
				example: "ATU51507409"
			}
		}
	},
	[CountryCodes.Belgium]: {
		label: "euVatNumber",
		validators: validatePatternOnBlur(/^BE[10]\d{9}$/),
		mask: { mask: makeMask(...nonInputs("BE", { includeInValue: true }), spacer, ...numericInputs(10)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "10",
				example: "BE1234567890"
			}
		}
	},
	[CountryCodes.Bulgaria]: {
		label: "identifikacionenNomerDDS",
		validators: validatePatternOnBlur(/^BG\d{9,10}$/),
		mask: { mask: makeMask(...nonInputs("BG", { includeInValue: true }), spacer, ...numericInputs(9), ...numericInputs(1, true)) },
		guidanceText: {
			key: "enterTheRemainingXToYDigitsForExample",
			values: {
				minDigits: "9",
				maxDigits: "10",
				example: "BG1234567890"
			}
		}
	},
	[CountryCodes.Croatia]: {
		label: "PDVIdBrojOIB",
		validators: validatePatternOnBlur(/^HR\d{11}$/),
		mask: { mask: makeMask(...nonInputs("HR", { includeInValue: true }), spacer, ...numericInputs(11)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "11",
				example: "HR94577403194"
			}
		}
	},
	[CountryCodes.Cyprus]: {
		label: "arithmosEngraphes",
		validators: validatePatternOnBlur(/^CY[A-Z0-9]{9}$/),
		mask: {
			mask: makeMask(...nonInputs("CY", { includeInValue: true }), spacer, ...alphanumericInputs(9)),
			transformOnType: uppercase
		},
		guidanceText: {
			key: "enterTheRemainingNCharactersForExample",
			values: {
				numChars: "9",
				example: "CY12345678X"
			}
		}
	},
	[CountryCodes.CzechRepublic]: {
		label: "DIC",
		validators: validatePatternOnBlur(/^CZ\d{8,10}$/),
		mask: { mask: makeMask(...nonInputs("CZ", { includeInValue: true }), spacer, ...numericInputs(8), ...numericInputs(2, true)) },
		guidanceText: {
			key: "enterTheRemainingXToYDigitsForExample",
			values: {
				minDigits: "8",
				maxDigits: "10",
				example: "CZ00177041"
			}
		}
	},
	[CountryCodes.Denmark]: ({ vatNumberType }) => {
		switch (vatNumberType) {
			case "stamregister": return {
				label: "stamregister",
				validators: validatePatternOnBlur(/^SE\d{8}$/),
				mask: { mask: makeMask(...nonInputs("SE", { includeInValue: true }), spacer, ...numericInputs(8)) },
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "8",
						example: "SE12345678"
					}
				}
			};
			default: return {
				label: "momsregistreringsnummerCVR",
				validators: validatePatternOnBlur(/^DK\d{8}$/),
				mask: { mask: makeMask(...nonInputs("DK", { includeInValue: true }), spacer, ...numericInputs(8)) },
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "8",
						example: "DK12345678"
					}
				}
			};
		}
	},
	[CountryCodes.Estonia]: {
		label: "kaibemaksukohustuslaseNumber",
		validators: validatePatternOnBlur(/^EE\d{9}$/),
		mask: { mask: makeMask(...nonInputs("EE", { includeInValue: true }), spacer, ...numericInputs(9)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "EE100254507"
			}
		}
	},
	[CountryCodes.Finland]: {
		label: "arvonlisaveronumeroMervardesskattenummer",
		validators: validatePatternOnBlur(/^FI\d{8}$/),
		mask: { mask: makeMask(...nonInputs("FI", { includeInValue: true }), spacer, ...numericInputs(8)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "FI12345678"
			}
		}
	},
	[CountryCodes.France]: ({ vatNumberType }) => {
		const sharedMetadata = {
			validators: validatePatternOnBlur(/^FR\d{11}$/),
			mask: { mask: makeMask(...nonInputs("FR", { includeInValue: true }), spacer, ...numericInputs(11)) }
		};
		switch (vatNumberType) {
			case "NumeroDeTVA": return {
				...sharedMetadata,
				label: "NumeroDeTVA",
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "11",
						example: "FR12999999999"
					}
				}
			};
			default: return {
				...sharedMetadata,
				label: "numeroDIdentificationALATaxe",
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "11",
						example: "FR12345678901"
					}
				}
			};
		}
	},
	[CountryCodes.Germany]: {
		label: "USt-IdNr",
		validators: validatePatternOnBlur(/^DE\d{9}$/),
		mask: { mask: makeMask(...nonInputs("DE", { includeInValue: true }), spacer, ...numericInputs(9)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "DE115235681"
			}
		}
	},
	[CountryCodes.Greece]: {
		label: "grTaxId",
		validators: validatePatternOnBlur(/^EL\d{9}$/),
		mask: { mask: makeMask(...nonInputs("EL", { includeInValue: true }), spacer, ...numericInputs(9)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "EL123456789"
			}
		}
	},
	[CountryCodes.Hungary]: {
		label: "huTaxId",
		validators: validatePatternOnBlur(/^HU\d{8}$/),
		mask: { mask: makeMask(...nonInputs("HU", { includeInValue: true }), spacer, ...numericInputs(8)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "8",
				example: "HU12345678"
			}
		}
	},
	[CountryCodes.Ireland]: {
		label: "vatNumber",
		validators: validatePatternOnBlur(/^IE[A-Z0-9]{8,9}$/),
		mask: {
			mask: makeMask(...nonInputs("IE", { includeInValue: true }), spacer, ...alphanumericInputs(8), ...alphanumericInputs(1, true)),
			transformOnType: uppercase
		},
		guidanceText: {
			key: "enterTheRemainingXToYCharactersForExample",
			values: {
				minChars: "8",
				maxChars: "9",
				example: "IE999999XX"
			}
		}
	},
	[CountryCodes.Italy]: {
		label: "vatNumber",
		validators: validatePatternOnBlur(/^IT\d{11}$/),
		mask: { mask: makeMask(...nonInputs("IT", { includeInValue: true }), spacer, ...numericInputs(11)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "11",
				example: "IT47040001100"
			}
		}
	},
	[CountryCodes.Latvia]: {
		label: "lvTaxId",
		validators: validatePatternOnBlur(/^LV\d{11}$/),
		mask: { mask: makeMask(...nonInputs("LV", { includeInValue: true }), spacer, ...numericInputs(11)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "11",
				example: "LV43603021620"
			}
		}
	},
	[CountryCodes.Liechtenstein]: {
		label: "vatRegistrationNumber",
		validators: validatePatternOnBlur(/^[0-9]{1,6}$/),
		mask: { mask: makeMask(...numericInputs(1), ...numericInputs(5, true)) },
		guidanceText: {
			key: "enterAMaximumOfNDigitsForExample",
			values: {
				maxDigits: "6",
				example: "123456"
			}
		}
	},
	[CountryCodes.Lithuania]: {
		label: "PVMmoketojoKodas",
		validators: validatePatternOnBlur(/^LT\d{9,12}$/),
		mask: { mask: makeMask(...nonInputs("LT", { includeInValue: true }), spacer, ...numericInputs(9), ...numericInputs(3, true)) },
		guidanceText: {
			key: "enterTheRemainingXToYDigitsForExample",
			values: {
				minDigits: "9",
				maxDigits: "12",
				example: "LT664517219"
			}
		}
	},
	[CountryCodes.Luxembourg]: {
		label: "numeroDIdentificationALATaxe",
		validators: validatePatternOnBlur(/^LU\d{8}$/),
		mask: { mask: makeMask(...nonInputs("LU", { includeInValue: true }), spacer, ...numericInputs(8)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "8",
				example: "LU18928066"
			}
		}
	},
	[CountryCodes.Malaysia]: {
		label: "SST",
		validators: validatePatternOnBlur(/^([A-Z]\d{2}[-]\d{4}[-]\d{8}|\d{12})$/),
		guidanceText: {
			key: "enterXOrYCharactersForExample",
			values: {
				xChars: "12",
				yChars: "14",
				example: "123456789012, D11-1808-20032117"
			}
		}
	},
	[CountryCodes.Malta]: {
		label: "vatNumber",
		validators: validatePatternOnBlur(/^MT\d{8}$/),
		mask: { mask: makeMask(...nonInputs("MT", { includeInValue: true }), spacer, ...numericInputs(8)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "8",
				example: "MT12345678"
			}
		}
	},
	[CountryCodes.Monaco]: {
		label: "numeroDIdentificationALATaxe",
		validators: validatePatternOnBlur(/^FR[0-9]{11}$/),
		mask: { mask: makeMask(...nonInputs("FR", { includeInValue: true }), spacer, ...numericInputs(11)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "11",
				example: "FR12345678999"
			}
		}
	},
	[CountryCodes.Netherlands]: {
		label: "btwNummer",
		validators: validatePatternOnBlur(/^NL\d{9}B\d{2}$/),
		mask: {
			mask: makeMask(...nonInputs("NL", { includeInValue: true }), spacer, ...numericInputs(9), spacer, ...nonInputs("B", { includeInValue: true }), spacer, ...numericInputs(2)),
			transformOnType: uppercase
		},
		guidanceText: {
			key: "enterTheRemainingNCharactersForExample",
			values: {
				numChars: "12",
				example: "NL123456789B01"
			}
		}
	},
	[CountryCodes.Norway]: {
		label: "mvanummer",
		validators: validatePatternOnBlur(/^\d{9}MVA$/),
		mask: { mask: makeMask(...numericInputs(9), ...nonInputs("MVA", {
			includeInValue: true,
			displayEagerly: true
		})) },
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "9",
				example: "123456789MVA"
			}
		}
	},
	[CountryCodes.Poland]: {
		label: "NIP",
		validators: validatePatternOnBlur(/^PL\d{10}$/),
		mask: { mask: makeMask(...nonInputs("PL", { includeInValue: true }), spacer, ...numericInputs(10)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "10",
				example: "PL1234567890"
			}
		}
	},
	[CountryCodes.Portugal]: {
		label: "numerodeIVA",
		validators: validatePatternOnBlur(/^PT\d{9}$/),
		mask: { mask: makeMask(...nonInputs("PT", { includeInValue: true }), spacer, ...numericInputs(9)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "PT123456789"
			}
		}
	},
	[CountryCodes.Romania]: {
		label: "codulDeIdentificareFiscala",
		validators: validatePatternOnBlur(/^RO\d{2,12}$/),
		mask: { mask: makeMask(...nonInputs("RO", { includeInValue: true }), spacer, ...numericInputs(2), ...numericInputs(8, true)) },
		guidanceText: {
			key: "enterTheRemainingXToYDigitsForExample",
			values: {
				minDigits: "2",
				maxDigits: "10",
				example: "RO12345678"
			}
		}
	},
	[CountryCodes.Slovakia]: {
		label: "skTaxId",
		validators: validatePatternOnBlur(/^SK\d{10}$/),
		mask: { mask: makeMask(...nonInputs("SK", { includeInValue: true }), spacer, ...numericInputs(10)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "10",
				example: "SK1234567890"
			}
		}
	},
	[CountryCodes.Slovenia]: {
		label: "siTaxId",
		validators: validatePatternOnBlur(/^SI\d{8}$/),
		mask: { mask: makeMask(...nonInputs("SI", { includeInValue: true }), spacer, ...numericInputs(8)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "8",
				example: "SI12345678"
			}
		}
	},
	[CountryCodes.Spain]: {
		label: "NIFdeIVA",
		validators: validatePatternOnBlur(/^ES[A-Z0-9]\d{7}[A-Z0-9]$/),
		mask: {
			mask: makeMask(...nonInputs("ES", { includeInValue: true }), spacer, ...alphanumericInputs(9)),
			transformOnType: uppercase
		},
		guidanceText: {
			key: "enterTheRemainingNCharactersForExample",
			values: {
				numChars: "9",
				example: "ES12345678X"
			}
		}
	},
	[CountryCodes.Sweden]: {
		label: "vatNummerMomsregistreringsnummerOrMomsnummer",
		validators: validatePatternOnBlur(/^SE\d{12}$/),
		mask: { mask: makeMask(...nonInputs("SE", { includeInValue: true }), spacer, ...numericInputs(12)) },
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "12",
				example: "SE123456789001"
			}
		}
	},
	[CountryCodes.Switzerland]: {
		label: "Mehrwertsteuernummer",
		validators: validatePatternOnBlur(/^CHE\d{9}(TVA|MWST|IVA)$/),
		mask: {
			mask: makeMask(...nonInputs("CHE", { includeInValue: true }), ...nonInputs(" - "), ...numericInputs(3), ...nonInputs(" . "), ...numericInputs(3), ...nonInputs(" . "), ...numericInputs(3), spacer, ...alphaInputs(3), ...alphaInputs(1, true)),
			transformOnType: uppercase
		},
		guidanceText: {
			key: "enterTheRemainingNDigitsThenXToYLettersForExample",
			values: {
				numDigits: "9",
				minLetters: "3",
				maxLetters: "4",
				example: "CHE-123.456.789 TVA"
			}
		}
	},
	[CountryCodes.UnitedArabEmirates]: {
		label: "vatRegistrationNumber",
		validators: validateNotEmptyOnBlur
	},
	[CountryCodes.UnitedKingdom]: {
		label: "vatRegistrationNumber",
		validators: validatePatternOnBlur(/^GB\d{9,12}$/),
		mask: { mask: makeMask(...nonInputs("GB", { includeInValue: true }), spacer, ...numericInputs(9), ...numericInputs(3, true)) },
		guidanceText: {
			key: "enterTheRemainingXToYDigitsForExample",
			values: {
				minDigits: "9",
				maxDigits: "12",
				example: "GB1234567890"
			}
		}
	},
	/**
	* NOT YET SUPPORTED
	* These are brought over from the old pattern files. We have no idea if they are accurate or not.
	* See https://en.wikipedia.org/wiki/VAT_identification_number
	*/
	[CountryCodes.Albania]: { validators: validatePatternOnBlur(/^[JKLM][A-Z0-9]{8}[A-Z]$/) },
	[CountryCodes.Belarus]: { validators: validatePatternOnBlur(/^\d{9}$/) },
	[CountryCodes.RussianFederation]: { validators: validatePatternOnBlur(/^(\d{10}|\d{12})$/) },
	[CountryCodes.SanMarino]: { validators: validatePatternOnBlur(/^\d{5}$/) },
	[CountryCodes.Serbia]: { validators: validatePatternOnBlur(/^\d{9}$/) },
	[CountryCodes.Turkey]: { validators: validatePatternOnBlur(/^\d{10}$/) },
	[CountryCodes.Ukraine]: { validators: validatePatternOnBlur(/^\d{12}$/) },
	[CountryCodes.Argentina]: { validators: validatePatternOnBlur(/^\d{11}$/) },
	[CountryCodes.Chile]: { validators: validatePatternOnBlur(/^\d{9}$/) },
	[CountryCodes.Colombia]: { validators: validatePatternOnBlur(/^\d{10}$/) },
	[CountryCodes.CostaRica]: { validators: validatePatternOnBlur(/^\d{9,12}$/) },
	[CountryCodes.Ecuador]: { validators: validatePatternOnBlur(/^\d{13}$/) },
	[CountryCodes.Guatemala]: { validators: validatePatternOnBlur(/^\d{8}$/) },
	[CountryCodes.Peru]: { validators: validatePatternOnBlur(/^\d{11}$/) },
	[CountryCodes.Venezuela]: { validators: validatePatternOnBlur(/^[JGVE]-\d{8}-?\d$/) }
};
//#endregion
//#region src/components/Shared/fields/VatNumberField/vatNumberTypes.ts
var vatNumberOptions = {
	[CountryCodes.Austria]: [{
		id: "UST-ID",
		name: "UST-ID"
	}],
	[CountryCodes.Belgium]: [{
		id: "euVatNumber",
		name: "euVatNumber"
	}],
	[CountryCodes.Bulgaria]: [{
		id: "identifikacionenNomerDDS",
		name: "identifikacionenNomerDDS"
	}],
	[CountryCodes.Croatia]: [{
		id: "PDVIdBrojOIB",
		name: "PDVIdBrojOIB"
	}],
	[CountryCodes.Cyprus]: [{
		id: "arithmosEngraphes",
		name: "arithmosEngraphes"
	}],
	[CountryCodes.CzechRepublic]: [{
		id: "DIC",
		name: "DIC"
	}],
	[CountryCodes.Denmark]: [{
		id: "momsregistreringsnummerCVR",
		name: "momsregistreringsnummerCVR"
	}, {
		id: "stamregister",
		name: "stamregister"
	}],
	[CountryCodes.Estonia]: [{
		id: "kaibemaksukohustuslaseNumber",
		name: "kaibemaksukohustuslaseNumber"
	}],
	[CountryCodes.Finland]: [{
		id: "arvonlisaveronumeroMervardesskattenummer",
		name: "arvonlisaveronumeroMervardesskattenummer"
	}],
	[CountryCodes.France]: [{
		id: "numeroDIdentificationALATaxe",
		name: "numeroDIdentificationALATaxe"
	}, {
		id: "NumeroDeTVA",
		name: "NumeroDeTVA"
	}],
	[CountryCodes.Germany]: [{
		id: "USt-IdNr",
		name: "USt-IdNr"
	}],
	[CountryCodes.Greece]: [{
		id: "grTaxId",
		name: "grTaxId"
	}],
	[CountryCodes.Hungary]: [{
		id: "huTaxId",
		name: "huTaxId"
	}],
	[CountryCodes.Ireland]: [{
		id: "vatNumber",
		name: "vatNumber"
	}],
	[CountryCodes.Italy]: [{
		id: "partitaIVA",
		name: "partitaIVA"
	}],
	[CountryCodes.Latvia]: [{
		id: "lvTaxId",
		name: "lvTaxId"
	}],
	[CountryCodes.Liechtenstein]: [{
		id: "vatRegistrationNumber",
		name: "vatRegistrationNumber"
	}],
	[CountryCodes.Lithuania]: [{
		id: "PVMmoketojoKodas",
		name: "PVMmoketojoKodas"
	}],
	[CountryCodes.Luxembourg]: [{
		id: "numeroDIdentificationALATaxe",
		name: "numeroDIdentificationALATaxe"
	}],
	[CountryCodes.Malaysia]: [{
		id: "SST",
		name: "SST"
	}],
	[CountryCodes.Malta]: [{
		id: "vatNumber",
		name: "vatNumber"
	}],
	[CountryCodes.Monaco]: [{
		id: "numeroDIdentificationALATaxe",
		name: "numeroDIdentificationALATaxe"
	}],
	[CountryCodes.Netherlands]: [{
		id: "btwNummer",
		name: "btwNummer"
	}],
	[CountryCodes.Norway]: [{
		id: "mvanummer",
		name: "mvanummer"
	}],
	[CountryCodes.Poland]: [{
		id: "NIP",
		name: "NIP"
	}],
	[CountryCodes.Portugal]: [{
		id: "numerodeIVA",
		name: "numerodeIVA"
	}],
	[CountryCodes.Romania]: [{
		id: "codulDeIdentificareFiscala",
		name: "codulDeIdentificareFiscala"
	}],
	[CountryCodes.Slovakia]: [{
		id: "skTaxId",
		name: "skTaxId"
	}],
	[CountryCodes.Slovenia]: [{
		id: "siTaxId",
		name: "siTaxId"
	}],
	[CountryCodes.Spain]: [{
		id: "NIFdeIVA",
		name: "NIFdeIVA"
	}],
	[CountryCodes.Sweden]: [{
		id: "vatNummerMomsregistreringsnummerOrMomsnummer",
		name: "vatNummerMomsregistreringsnummerOrMomsnummer"
	}],
	[CountryCodes.Switzerland]: [{
		id: "Mehrwertsteuernummer",
		name: "Mehrwertsteuernummer"
	}],
	[CountryCodes.UnitedArabEmirates]: [{
		id: "vatRegistrationNumber",
		name: "vatRegistrationNumber"
	}],
	[CountryCodes.UnitedKingdom]: [{
		id: "vatRegistrationNumber",
		name: "vatRegistrationNumber"
	}]
};
var getVatNumberOptions = (country, companyType) => {
	const optionsForCountry = vatNumberOptions[country];
	if (!companyType || !optionsForCountry) return optionsForCountry;
	return optionsForCountry.filter((option) => option.applicableOnlyFor?.includes(companyType) ?? true);
};
//#endregion
//#region src/components/Shared/fields/VatNumberField/VatNumberTypeSelector/inferVatNumberType.ts
var inferVatNumberType = (vatNumber, country) => {
	const optionsForCountry = vatNumberOptions[country];
	const metadataFn = defaultFieldConfig[country];
	if (!optionsForCountry || !metadataFn) return void 0;
	for (const option of optionsForCountry) {
		const fieldMetadata = typeof metadataFn === "function" ? metadataFn({ vatNumberType: option.id }) : metadataFn;
		if (!fieldMetadata.validators) continue;
		if ((Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators]).every((validator) => validator.validate(vatNumber))) return option.id;
	}
};
//#endregion
//#region src/components/Shared/fields/VatNumberField/VatNumberTypeSelector/getDefaultVatNumberType.ts
/**
* Determines the default VAT number type based on exisiting information and country.
* This function follows a priority order:
* 1. Infer the type from the number if possible
* 2. Otherwise, use the first available VAT number type for the country
*
* @param vatNumber - VAT number value
* @param country  - Country code to determine the VAT number type
* @returns The determined VAT number type or undefined if none can be determined
*/
function getDefaultVatNumberType(vatNumber, country) {
	return vatNumber ? inferVatNumberType(vatNumber, country) : vatNumberOptions[country]?.[0]?.id;
}
//#endregion
//#region src/components/Shared/fields/VatNumberField/VatNumberTypeSelector/VatNumberTypeSelector.tsx
function VatNumberTypeSelector({ country, companyType, selected, setSelected, exemptedOptionLabel }) {
	const { t } = useTranslation("common");
	const handleSelect = useCallback$1((selectedStr) => {
		const newSelected = selectedStr;
		if (newSelected === "exempted") {
			if (exemptedOptionLabel) setSelected(newSelected, true);
			return;
		}
		setSelected(newSelected, false);
	}, [exemptedOptionLabel, setSelected]);
	const options = useMemo$1(() => {
		const availableOptions = getVatNumberOptions(country, companyType) ?? [];
		if (availableOptions.length === 0 || !exemptedOptionLabel) return availableOptions;
		return [...availableOptions, {
			id: "exempted",
			name: exemptedOptionLabel
		}];
	}, [
		country,
		companyType,
		exemptedOptionLabel
	]);
	useEffect$1(() => {
		if (!selected && options.length > 0) handleSelect(options[0].id);
	}, [
		options,
		selected,
		handleSelect
	]);
	if (options.length <= 1) return null;
	return /* @__PURE__ */ jsx(Field, {
		el: "fieldset",
		name: "vatNumberType",
		label: t(($) => $["whichTypeOfTaxIdNumberDoYouHave"]),
		children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, {
			...childProps,
			name: "vatNumberType",
			items: options,
			value: selected,
			onChange: handleSelect
		})
	});
}
//#endregion
//#region src/components/Shared/fields/VatNumberField/VatNumberField.tsx
var VAT_NUMBER_FIELD = [
	"vatNumber",
	"vatNumberType",
	"exemptedFromVat",
	"vatAbsenceReason"
];
function VatNumberField({ data, valid, errors, labels, mask, readonly, optional, shouldValidate, handleChangeFor, canExempt, country }) {
	const { t } = useTranslation("common");
	const { isFeatureEnabled } = useToggleContext();
	const options = vatNumberOptions[country];
	const defaultType = getDefaultVatNumberType(data.vatNumber, country);
	const vatAbsenceReasons = isFeatureEnabled("ShowExtraTaxExemptionReasons") ? [
		"belowTaxThreshold",
		"industryExemption",
		"countryWithoutVatOrGstSystem"
	] : ["belowTaxThreshold", "industryExemption"];
	const showVatExemptedOptions = canExempt && options?.length > 1;
	const vatNumberType = data.exemptedFromVat ? "exempted" : data.vatNumberType ? data.vatNumberType : defaultType;
	const fieldMetadata = resolveFieldMetadata(defaultFieldConfig[country], { vatNumberType: vatNumberType === "exempted" ? void 0 : vatNumberType }, defaultFieldMetadata);
	const handleVatNumberChange = (e, mode) => {
		const value = typeof e === "string" ? e : e.currentTarget.value;
		handleChangeFor("vatNumber", mode)(value);
		handleChangeFor("vatNumberType")(vatNumberType);
	};
	const handleVatNumberTypeChange = (vatType, exemptValue) => {
		if (vatType === "exempted") {
			if (!canExempt) throw Error(`${country} does not allow VAT exemptions`);
			handleChangeFor("vatNumber")(null);
			handleChangeFor("vatNumberType")(void 0);
			handleChangeFor("exemptedFromVat")(exemptValue);
			return;
		}
		if (canExempt) handleChangeFor("exemptedFromVat")(exemptValue);
		handleChangeFor("vatNumberType")(vatType);
	};
	if (vatNumberType && vatNumberType !== "exempted") {
		if (!options?.find((option) => option.id === vatNumberType)) handleChangeFor("vatNumberType")(defaultType);
	}
	if (data.exemptedFromVat === false && data.vatAbsenceReason) handleChangeFor("vatAbsenceReason")(null);
	return /* @__PURE__ */ jsxs("div", { children: [
		/* @__PURE__ */ jsx(VatNumberTypeSelector, {
			country,
			setSelected: handleVatNumberTypeChange,
			selected: vatNumberType,
			exemptedOptionLabel: showVatExemptedOptions ? labels.exemptedFromVat : void 0
		}),
		/* @__PURE__ */ jsx(MaskedInput, {
			type: "text",
			"aria-required": true,
			"aria-invalid": !valid.vatNumber,
			name: "vatNumber",
			value: data?.vatNumber ?? "",
			label: labels.vatNumber ?? "",
			formatGuidance: translateTranslatable(t, fieldMetadata.guidanceText),
			errorMessage: errors.vatNumber,
			isValid: Boolean(valid.vatNumber),
			onInput: (e) => handleVatNumberChange(e, "input"),
			onBlur: (e) => handleVatNumberChange(e, "blur"),
			disabled: data.exemptedFromVat,
			readonly,
			optional,
			shouldValidate,
			...mask
		}),
		canExempt && !showVatExemptedOptions && /* @__PURE__ */ jsx(Field, {
			name: "exemptedFromVat",
			children: (childProps) => /* @__PURE__ */ jsx(Checkbox, {
				...childProps,
				"aria-required": false,
				"aria-invalid": false,
				name: "exemptedFromVat",
				label: labels?.exemptedFromVat,
				value: "exemptedFromVat",
				checked: Boolean(data.exemptedFromVat),
				onChange: (e) => handleVatNumberTypeChange("exempted", e)
			})
		}),
		data.exemptedFromVat && /* @__PURE__ */ jsx(Field, {
			el: "fieldset",
			name: "vatAbsenceReason",
			label: labels?.vatAbsenceReason,
			errorMessage: errors.vatAbsenceReason,
			isValid: valid.vatAbsenceReason,
			children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, {
				...childProps,
				name: "vatAbsenceReason",
				onChange: handleChangeFor("vatAbsenceReason"),
				value: data.vatAbsenceReason,
				items: vatAbsenceReasons.map((reason) => ({
					id: reason,
					name: reason
				}))
			})
		})
	] });
}
//#endregion
//#region src/components/Shared/forms/RegistrationAddress/types.ts
var operationalAddressIsSameIds = {
	OPERATIONAL_ADDRESS_IS_SAME: "OperationAddressAnswerYes",
	OPERATIONAL_ADDRESS_IS_NOT_SAME: "OperationAddressAnswerNo"
};
var operationalAddressIsSameItems = [{
	id: operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_SAME,
	name: "operationalAddressIsSameItemName"
}, {
	id: operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME,
	name: "operationalAddressIsNotSameItemName"
}];
//#endregion
//#region src/components/Shared/forms/RegistrationAddress/RegistrationAddress.tsx
var registrationAddressFields = [
	"registrationAddress",
	"operationalAddress",
	"operationalAddressIsSame"
];
var registrationAddressForms = {
	registrationAddress: {
		formId: "registrationAddress",
		formName: "registeredAddress",
		fields: ["address"]
	},
	operationalAddress: {
		formId: "operationalAddress",
		formName: "operationalAddressHeader",
		fields: ["address"]
	}
};
registrationAddressForms.registrationAddress.formId;
registrationAddressForms.operationalAddress.formId;
//#endregion
//#region src/components/Shared/forms/ConstitutionalDocument/types.ts
var ConstitutionalDocumentTypes = {
	BUSINESS_NAME_FILING: "doingBusinessAsNameFiling",
	TAX_FILING: "taxFiling",
	EMPLOYER_IDENTIFICATION_NUMBER_VERIFICATION_LETTER: "einVerificationLetter",
	BUSINESS_REGISTRATION_DOCUMENT: "businessRegistrationDocument",
	TRUST_DEED: "trustDeed",
	TRUST_INSTRUMENT: "trustInstrument",
	PARTNERSHIP_AGREEMENT: "partnershipAgreement",
	MEETING_MINUTES: "meetingMinutes"
};
//#endregion
//#region src/components/Shared/forms/ConstitutionalDocument/ConstitutionalDocument.tsx
var getConstitutionDocumentTypeOptionsMapping = (legalEntityType, country) => {
	switch (legalEntityType) {
		case LegalEntityTypes.SOLE_PROPRIETORSHIP: switch (country) {
			case "FR": return [
				{
					id: ConstitutionalDocumentTypes.BUSINESS_NAME_FILING,
					name: "doingBusinessAsNameFiling__FR"
				},
				{
					id: ConstitutionalDocumentTypes.TAX_FILING,
					name: "taxFiling"
				},
				{
					id: ConstitutionalDocumentTypes.BUSINESS_REGISTRATION_DOCUMENT,
					name: "businessRegistrationDocument__FR"
				}
			];
			case "US": return [
				{
					id: ConstitutionalDocumentTypes.BUSINESS_NAME_FILING,
					name: "doingBusinessAsNameFiling__US"
				},
				{
					id: ConstitutionalDocumentTypes.TAX_FILING,
					name: "taxFiling__US"
				},
				{
					id: ConstitutionalDocumentTypes.EMPLOYER_IDENTIFICATION_NUMBER_VERIFICATION_LETTER,
					name: "einVerificationLetter"
				}
			];
			default: return [{
				id: ConstitutionalDocumentTypes.BUSINESS_NAME_FILING,
				name: "doingBusinessAsNameFiling"
			}, {
				id: ConstitutionalDocumentTypes.TAX_FILING,
				name: "taxFiling"
			}];
		}
		case LegalEntityTypes.UNINCORPORATED_PARTNERSHIP: return [{
			id: ConstitutionalDocumentTypes.PARTNERSHIP_AGREEMENT,
			name: "partnershipAgreement"
		}, {
			id: ConstitutionalDocumentTypes.MEETING_MINUTES,
			name: "meetingMinutes"
		}];
		default: return [{
			id: ConstitutionalDocumentTypes.TRUST_DEED,
			name: "trustDeed"
		}, {
			id: ConstitutionalDocumentTypes.TRUST_INSTRUMENT,
			name: "trustInstrument"
		}];
	}
};
function getLegalEntityTypeBasedConstitutionalDocumentHeaderDescriptionTranslationkey(legalEntityType) {
	switch (legalEntityType) {
		case LegalEntityTypes.SOLE_PROPRIETORSHIP: return "constitutionalDocumentSoleProprietorshipHeaderDescription";
		case LegalEntityTypes.TRUST: return "constitutionalDocumentTrustHeaderDescription";
		case LegalEntityTypes.UNINCORPORATED_PARTNERSHIP: return "constitutionalDocumentUnincorporatedPartnershipDescription";
		default: return "constitutionalDocumentHeaderDescription";
	}
}
var unincorporatedPartnershipRequirementsVariants = [
	"Name",
	"Details",
	"UpToDate"
];
function ConstitutionalDocumentUpload({ id, legalEntityType, ...props }) {
	const { t } = useTranslation(["common"]);
	const isUnincorporatedPartnership = legalEntityType === LegalEntityTypes.UNINCORPORATED_PARTNERSHIP;
	const constitutionalDocumentRequirements = getConstitutionDocumentTypeOptionsMapping(legalEntityType, props.country);
	const guidanceContent = /* @__PURE__ */ jsxs("div", {
		className: "adyen-kyc-upload-field__guidance u-margin-bottom-24",
		children: [
			/* @__PURE__ */ jsx("strong", { children: t(($) => $["uploadOneOfTheseDocuments"]) }),
			/* @__PURE__ */ jsx("ul", { children: constitutionalDocumentRequirements?.map(({ name }, i) => /* @__PURE__ */ jsx("li", { children: t(($) => $[name]) }, i)) }),
			isUnincorporatedPartnership && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("strong", { children: t(($) => $["documentRequirements"]) }), /* @__PURE__ */ jsx("ul", { children: unincorporatedPartnershipRequirementsVariants.map((item, i) => /* @__PURE__ */ jsx("li", { children: t(($) => $[`documentRequirementsUnincorporatedPartnership${item}`], { ns: "common" }) }, i)) })] }),
			props.country !== "US" && !isUnincorporatedPartnership && /* @__PURE__ */ jsx("div", {
				className: "u-margin-y-16",
				children: /* @__PURE__ */ jsxs("span", { children: [t(($) => $["infoInUploadedDocumentIsTrue"]), " "] })
			})
		]
	});
	return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(MemoizedDocumentUpload, {
		...props,
		documentType: "constitutionalDocument",
		documentField: "constitutionalDocument",
		heading: t(($) => $["constitutionalDocumentHeader"]),
		description: t(($) => $[getLegalEntityTypeBasedConstitutionalDocumentHeaderDescriptionTranslationkey(legalEntityType)], { ns: "common" }),
		guidanceContent,
		id,
		hidePageCount: true
	}) });
}
var MemoizedConstitutionalDocument = memo(ConstitutionalDocumentUpload, (prevProps, nextProps) => objectsDeepEqual(prevProps.requiredFields, nextProps.requiredFields) && objectsDeepEqual(prevProps.data, nextProps.data) && objectsDeepEqual(prevProps.formVerificationErrors, nextProps.formVerificationErrors) && objectsDeepEqual(prevProps.fieldValidationErrors, nextProps.fieldValidationErrors) && prevProps.shouldValidate === nextProps.shouldValidate);
//#endregion
export { VAT_NUMBER_FIELD as a, defaultFieldConfig as c, doingBusinessAsAbsentFieldMetadata as d, doingBusinessAsFieldMetadata as f, BusinessRegistrationNumberField as g, BUSINESS_REGISTRATION_NUMBER_FIELD as h, operationalAddressIsSameItems as i, defaultFieldMetadata as l, DBA_NAME_FIELD as m, registrationAddressFields as n, VatNumberField as o, DBANameField as p, operationalAddressIsSameIds as r, getDefaultVatNumberType as s, MemoizedConstitutionalDocument as t, vatAbsenceReasonMetadata as u };
