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] = "c8961d40-3a86-4153-956b-fafa4c30da17", e._sentryDebugIdIdentifier = "sentry-dbid-c8961d40-3a86-4153-956b-fafa4c30da17");
} catch (e) {}
import { r as useTranslation } from "./translation-DYpZlvOH.js";
import { t as LegalEntityTypes } from "./legal-entity-type-VIfNYnJP.js";
import { o as objectsDeepEqual } from "./AnalyticsContext-zvlAxIPp.js";
import { t as useToggleContext } from "./useToggleContext-CLfowItk.js";
import { t as Header } from "./Header-Drk8jcMl.js";
import { t as CountryCodes } from "./country-code-D3oCpE4i.js";
import { t as CompanyTypesValues } from "./company-types-value-B-1b0hXg.js";
import { n as translateTranslatable } from "./utils-g_Wl4-9Z.js";
import { t as Address } from "./Address-D2EKewPn.js";
import { t as ErrorPanel } from "./ErrorPanel-DyFneBRY.js";
import { t as createFormUtils } from "./formUtils-C0FUvDnF.js";
import { i as uppercase } from "./mapExistingFile-BEE4qhIN.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-0y7JZlsR.js";
import { a as StateContextSetter } from "./validate-DLW4vluD.js";
import { C as businessRegistrationNumberMasks, S as businessRegistrationNumberPatterns, h as MemoizedDocumentUpload, w as stateFormatGuidanceText } from "./TaxInformationField-2wqZkJOR.js";
import { a as validateNotEmptyOnBlur, o as validatePatternOnBlur } from "./patternValidators-ks8sIhG3.js";
import { t as resolveFieldMetadata } from "./fieldConfigurations-B3oqm4GC.js";
import { t as Field } from "./Field-vd1QJYeY.js";
import { t as Checkbox } from "./Checkbox-AGwtvVdU.js";
import { t as useForm } from "./useForm-C8kbnwo-.js";
import { n as getFormProps } from "./getProps-Bf3NN9L_.js";
import { t as InputText } from "./InputText-3ttUBosb.js";
import { t as RadioGroup } from "./RadioGroup-CTYNPvx5.js";
import { t as ContextGuidance } from "./ContextGuidance-CAhlQo0A.js";
import { memo } from "preact/compat";
import { useCallback as useCallback$1, useEffect as useEffect$1, useMemo as useMemo$1, useRef as useRef$1 } from "preact/hooks";
import { Fragment as Fragment$1, jsx, jsxs } from "preact/jsx-runtime";
import { createElement as createElement$1 } from "preact";
//#region src/components/Shared/fields/BusinessRegistrationNumberField/fieldConfig.ts
var registrationNumberDefaultFieldMetadata = { label: "registrationNumber" };
var registrationNumberDefaultFieldConfig = {
	[CountryCodes.Australia]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "incorporatedAssociationRegistrationNumber": return {
				label: "incorporatedAssociationRegistrationNumber",
				mask: businessRegistrationNumberMasks[CountryCodes.Australia].associationIncorporated,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Australia].associationIncorporated),
				guidanceText: {
					key: "enterXToYCharactersForExample",
					values: {
						minChars: "3",
						maxChars: "20",
						example: "200312345A"
					}
				}
			};
			default: return {
				label: "australianBusinessNumberAcn",
				mask: businessRegistrationNumberMasks[CountryCodes.Australia].default,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Australia].default),
				guidanceText: {
					key: "enterNDigitsForExample",
					values: {
						numDigits: "9",
						example: "123 456 789"
					}
				}
			};
		}
	},
	[CountryCodes.Austria]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "ZVR": return {
				label: "zentralesVereinsregisterId",
				mask: businessRegistrationNumberMasks[CountryCodes.Austria].ZVR,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Austria].ZVR),
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "9-10",
						example: "AT-ZVR-555769679"
					}
				}
			};
			default: return {
				label: "firmenbuchnummer",
				mask: businessRegistrationNumberMasks[CountryCodes.Austria].firmenbuchnummer,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Austria].firmenbuchnummer),
				guidanceText: {
					key: "enterAMaximumOfNCharactersWithAMixForExample",
					values: {
						maxChars: "9",
						example: "T1001a, FN89060n"
					}
				}
			};
		}
	},
	[CountryCodes.Belgium]: {
		label: "enterpriseNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Belgium].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Belgium].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "10",
				example: "1234567890"
			}
		}
	},
	[CountryCodes.Brazil]: {
		label: "CNPJ",
		mask: businessRegistrationNumberMasks[CountryCodes.Brazil].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Brazil].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "14",
				example: "28.773.626/8318-21"
			}
		}
	},
	[CountryCodes.Bulgaria]: {
		label: "uniqueIdentificationCode",
		mask: businessRegistrationNumberMasks[CountryCodes.Bulgaria].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Bulgaria].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "9",
				example: "812114069"
			}
		}
	},
	[CountryCodes.Canada]: {
		label: "businessIncorporationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Canada].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Canada].default),
		guidanceText: {
			key: "enterXToYCharactersForExample",
			values: {
				minChars: "5",
				maxChars: "10",
				example: "BC1234567"
			}
		}
	},
	[CountryCodes.Croatia]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "MBO": return {
				label: "MBO",
				mask: businessRegistrationNumberMasks[CountryCodes.Croatia].soleProprietorship,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Croatia].soleProprietorship),
				guidanceText: {
					key: "enterNDigitsForExample",
					values: {
						numDigits: "8",
						example: "12345678"
					}
				}
			};
			default: return {
				label: "MBS",
				mask: businessRegistrationNumberMasks[CountryCodes.Croatia].default,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Croatia].default),
				guidanceText: {
					key: "enterNDigitsForExample",
					values: {
						numDigits: "9",
						example: "080020970"
					}
				}
			};
		}
	},
	[CountryCodes.Cyprus]: {
		label: "cyRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Cyprus].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Cyprus].default),
		guidanceText: {
			key: "enterEnglishLetterFollowedByXtoYDigitsForExample",
			values: {
				minDigits: "1",
				maxDigits: "8",
				example: "C12345678"
			}
		}
	},
	[CountryCodes.CzechRepublic]: {
		label: "ICO",
		mask: businessRegistrationNumberMasks[CountryCodes.CzechRepublic].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.CzechRepublic].default),
		guidanceText: {
			key: "enterXToYDigitsForExample",
			values: {
				minDigits: "8",
				maxDigits: "10",
				example: "12345678"
			}
		}
	},
	[CountryCodes.Denmark]: {
		label: "CVR-nummer",
		mask: businessRegistrationNumberMasks[CountryCodes.Denmark].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Denmark].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "8",
				example: "22756214"
			}
		}
	},
	[CountryCodes.Estonia]: {
		label: "registrikood",
		mask: businessRegistrationNumberMasks[CountryCodes.Estonia].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Estonia].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "8",
				example: "10345833"
			}
		}
	},
	[CountryCodes.Finland]: {
		label: "YTunnus",
		mask: businessRegistrationNumberMasks[CountryCodes.Finland].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Finland].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "8",
				example: "1234567-8"
			}
		}
	},
	[CountryCodes.France]: ({ registrationNumberType }) => registrationNumberType === "RNA" ? {
		label: "rnaNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.France].RNA,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.France].RNA),
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "W123456789 or W9M1234567"
			}
		}
	} : {
		label: "siret",
		mask: businessRegistrationNumberMasks[CountryCodes.France].SIRET,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.France].SIRET),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "14",
				example: "542051180-00066"
			}
		}
	},
	[CountryCodes.Germany]: {
		label: "handelsregisternummerOrVereinsregisternummer",
		mask: businessRegistrationNumberMasks[CountryCodes.Germany].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Germany].default),
		guidanceText: {
			key: "enterAMaximumOfNCharactersWithAMixForExample",
			values: {
				maxChars: "20",
				example: "HRB100484, HRA123456ABCDE-A1234, VR350378A"
			}
		}
	},
	[CountryCodes.Gibraltar]: {
		label: "companyRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Gibraltar].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Gibraltar].default),
		guidanceText: {
			key: "enterAMaximumOfNCharactersForExample",
			values: {
				maxChars: "8",
				example: "04366849"
			}
		}
	},
	[CountryCodes.Greece]: {
		label: "GEMI-number",
		mask: businessRegistrationNumberMasks[CountryCodes.Greece].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Greece].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "12",
				example: "757001000000"
			}
		}
	},
	[CountryCodes.Guernsey]: {
		label: "registrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Guernsey].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Guernsey].default),
		guidanceText: {
			key: "enterAMaximumOfNDigitsForExample",
			values: {
				maxDigits: "9",
				example: "123456"
			}
		}
	},
	[CountryCodes.HongKong]: {
		label: "companyRegistrationNumber__HK",
		mask: businessRegistrationNumberMasks[CountryCodes.HongKong].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.HongKong].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "7",
				example: "1234567"
			}
		}
	},
	[CountryCodes.Hungary]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "nyilvantartasiSzam": return {
				label: "huRegistrationNumberForSoleProp",
				mask: businessRegistrationNumberMasks[CountryCodes.Hungary].nyilvantartasiSzam,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Hungary].nyilvantartasiSzam),
				guidanceText: {
					key: "enterXToYDigitsForExample",
					values: {
						minDigits: "7",
						maxDigits: "10",
						example: "06123456"
					}
				}
			};
			default: return {
				label: "huRegistrationNumber",
				mask: businessRegistrationNumberMasks[CountryCodes.Hungary].default,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Hungary].default),
				guidanceText: {
					key: "enterNDigitsForExample",
					values: {
						numDigits: "10",
						example: "06-12-345678"
					}
				}
			};
		}
	},
	[CountryCodes.Ireland]: {
		label: "companyNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Ireland].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Ireland].default),
		guidanceText: {
			key: "enterAMaximumOfNDigitsForExample",
			values: {
				maxDigits: "8",
				example: "10123456"
			}
		}
	},
	[CountryCodes.IsleOfMan]: {
		label: "registrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.IsleOfMan].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.IsleOfMan].default),
		guidanceText: {
			key: "enterNDigitsAndThen1LetterForExample",
			values: {
				numDigits: "6",
				example: "114293C"
			}
		}
	},
	[CountryCodes.Italy]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "CCIAA": return {
				label: "CCIAA",
				mask: businessRegistrationNumberMasks[CountryCodes.Italy].CCIAA,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Italy].CCIAA),
				guidanceText: {
					key: "enterNLettersAndThenXToYDigitsForExample",
					values: {
						numLetters: "2",
						minDigits: "6",
						maxDigits: "7",
						example: "TO0091712"
					}
				}
			};
			case "partitaIVA": return {
				label: "partitaIVA",
				validators: validatePatternOnBlur(/^\d{11}$/),
				mask: { mask: makeMask(spacer, ...numericInputs(11)) },
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "11",
						example: "47040001100"
					}
				}
			};
			default: return {
				label: "codiceFiscalePartitaIVA",
				validators: validatePatternOnBlur(/^\d{11}$/),
				mask: { mask: makeMask(spacer, ...numericInputs(11)) },
				guidanceText: {
					key: "enterTheRemainingNDigitsForExample",
					values: {
						numDigits: "11",
						example: "47040001100"
					}
				}
			};
		}
	},
	[CountryCodes.Japan]: {
		label: "corporateRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Japan].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Japan].default),
		guidanceText: {
			key: "enterAMaximumOfNCharactersForExample",
			values: {
				maxChars: "12",
				example: "224863141686"
			}
		}
	},
	[CountryCodes.Jersey]: {
		label: "registrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Jersey].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Jersey].default),
		guidanceText: {
			key: "enterAMaximumOfNCharactersForExample",
			values: {
				maxChars: "9",
				example: "123722"
			}
		}
	},
	[CountryCodes.Latvia]: {
		label: "lvRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Latvia].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Latvia].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "11",
				example: "50003251661"
			}
		}
	},
	[CountryCodes.Liechtenstein]: {
		label: "liRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Liechtenstein].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Liechtenstein].default),
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "11",
				example: "FL-0001.012.124-5"
			}
		}
	},
	[CountryCodes.Lithuania]: {
		label: "ltRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Lithuania].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Lithuania].default),
		guidanceText: {
			key: "enterXToYDigitsForExample",
			values: {
				minDigits: "6",
				maxDigits: "9",
				example: "123456789"
			}
		}
	},
	[CountryCodes.Luxembourg]: {
		label: "luRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Luxembourg].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Luxembourg].default),
		guidanceText: {
			key: "enter1LetterAndThenNDigitsForExample",
			values: { example: "C127766" }
		}
	},
	[CountryCodes.Malta]: {
		label: "companyRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Malta].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Malta].default),
		guidanceText: {
			key: "enterTheRemainingXToYDigitsForExample",
			values: {
				minDigits: "4",
				maxDigits: "6",
				example: "C 43070, P 1234"
			}
		}
	},
	[CountryCodes.Malaysia]: {
		label: "SSM",
		mask: businessRegistrationNumberMasks[CountryCodes.Malaysia].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Malaysia].default),
		guidanceText: {
			key: "enterXOrYDigitsForExample",
			values: {
				xDigits: "7",
				yDigits: "12",
				example: "1234567, 201901000005"
			}
		}
	},
	[CountryCodes.Mexico]: {
		label: "RFC",
		mask: businessRegistrationNumberMasks[CountryCodes.Mexico].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Mexico].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "12",
				example: "LFM200817DGA"
			}
		}
	},
	[CountryCodes.Monaco]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "mcRegistrationNumberSoleProp": return {
				label: "mcRegistrationNumberSoleProp",
				mask: businessRegistrationNumberMasks[CountryCodes.Monaco].soleProprietorship,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Monaco].soleProprietorship),
				guidanceText: {
					key: "enterXToYCharactersWithAMixForExample",
					values: {
						minChars: "8",
						maxChars: "11",
						example: "8732P92873"
					}
				}
			};
			default: return {
				label: "mcRegistrationNumber",
				mask: businessRegistrationNumberMasks[CountryCodes.Monaco].default,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Monaco].default),
				guidanceText: {
					key: "enterXToYCharactersWithAMixForExample",
					values: {
						minChars: "8",
						maxChars: "11",
						example: "84SB02071"
					}
				}
			};
		}
	},
	[CountryCodes.Netherlands]: {
		label: "chamberOfCommerceRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Netherlands].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Netherlands].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "8",
				example: "34179503"
			}
		}
	},
	[CountryCodes.NewZealand]: ({ registrationNumberType }) => registrationNumberType === "NZBN" ? {
		label: "NZBN",
		mask: businessRegistrationNumberMasks[CountryCodes.NewZealand].NZBN,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.NewZealand].NZBN),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "13",
				example: "1234567890123"
			}
		}
	} : {
		label: "companyNumberNZ",
		mask: businessRegistrationNumberMasks[CountryCodes.NewZealand].companyNumberNZ,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.NewZealand].companyNumberNZ),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "7",
				example: "1234567"
			}
		}
	},
	[CountryCodes.Norway]: {
		label: "organisasjonsnummer",
		mask: businessRegistrationNumberMasks[CountryCodes.Norway].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Norway].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "9",
				example: "923609016"
			}
		}
	},
	[CountryCodes.Poland]: ({ registrationNumberType }) => registrationNumberType === "krsNumber" ? {
		label: "krsNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Poland].krsNumber,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Poland].krsNumber),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "10",
				example: "1234567890"
			}
		}
	} : {
		label: "regon",
		mask: businessRegistrationNumberMasks[CountryCodes.Poland].regon,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Poland].regon),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "9",
				example: "123456789"
			}
		}
	},
	[CountryCodes.Portugal]: {
		label: "NIPC",
		mask: businessRegistrationNumberMasks[CountryCodes.Portugal].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Portugal].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "9",
				example: "123456789"
			}
		}
	},
	[CountryCodes.PuertoRico]: {},
	[CountryCodes.Romania]: ({ registrationNumberType }) => registrationNumberType === "roRegNumberOldFormat" ? {
		label: "roRegNumberOldFormat_label",
		mask: businessRegistrationNumberMasks[CountryCodes.Romania].roRegNumberOldFormat,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Romania].roRegNumberOldFormat),
		guidanceText: "roRegNumberOldFormat_maskGuidance"
	} : {
		label: "roRegNumberNewFormat_label",
		mask: businessRegistrationNumberMasks[CountryCodes.Romania].roRegNumberNewFormat,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Romania].roRegNumberNewFormat),
		guidanceText: "roRegNumberNewFormat_maskGuidance"
	},
	[CountryCodes.Singapore]: {
		label: "uen",
		mask: businessRegistrationNumberMasks[CountryCodes.Singapore].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Singapore].default),
		guidanceText: {
			key: "enterXToYCharactersWithAMixForExample",
			values: {
				minChars: "9",
				maxChars: "10",
				example: "200312345A"
			}
		}
	},
	[CountryCodes.Slovakia]: {
		label: "skRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Slovakia].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Slovakia].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "8",
				example: "12345678"
			}
		}
	},
	[CountryCodes.Slovenia]: {
		label: "siRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Slovenia].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Slovenia].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "10",
				example: "1006500006"
			}
		}
	},
	[CountryCodes.Spain]: {
		label: "NIF",
		mask: businessRegistrationNumberMasks[CountryCodes.Spain].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Spain].default),
		guidanceText: {
			key: "enter1LetterAndThenNDigitsForExample",
			values: {
				numDigits: "8",
				example: "A39000013"
			}
		}
	},
	[CountryCodes.Sweden]: {
		label: "organisationsnummer",
		mask: businessRegistrationNumberMasks[CountryCodes.Sweden].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Sweden].default),
		guidanceText: {
			key: "enterNDigitsForExample",
			values: {
				numDigits: "10",
				example: "202100-5489"
			}
		}
	},
	[CountryCodes.Switzerland]: {
		label: "chRegistrationNumber",
		mask: businessRegistrationNumberMasks[CountryCodes.Switzerland].default,
		validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.Switzerland].default),
		guidanceText: {
			key: "enterTheRemainingNDigitsForExample",
			values: {
				numDigits: "9",
				example: "CHE-123.456.789"
			}
		}
	},
	[CountryCodes.UnitedArabEmirates]: {
		label: "commercialLicence",
		validators: validateNotEmptyOnBlur
	},
	[CountryCodes.UnitedKingdom]: ({ registrationNumberType }) => {
		switch (registrationNumberType) {
			case "charity": return {
				label: "charityNumber",
				mask: businessRegistrationNumberMasks[CountryCodes.UnitedKingdom].nonProfit,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedKingdom].nonProfit),
				guidanceText: {
					key: "enterThreeDifferingOptionsForExample",
					values: {
						firstOption: "6, 7 or 8 digits",
						secondOption: "6 digits with a 2-letter prefix",
						thirdOption: "6 digits with a suffix like -0",
						firstExample: "123456",
						secondExample: "SC012345",
						thirdExample: "123456-0"
					}
				}
			};
			default: return {
				label: "companyNumber",
				mask: businessRegistrationNumberMasks[CountryCodes.UnitedKingdom].default,
				validators: validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedKingdom].default),
				guidanceText: {
					key: "enterNCharactersForExample",
					values: {
						numChars: "8",
						example: "43668490"
					}
				}
			};
		}
	},
	[CountryCodes.UnitedStates]: ({ state }) => ({
		label: "registrationNumber__US",
		mask: state ? businessRegistrationNumberMasks[CountryCodes.UnitedStates][state] : businessRegistrationNumberMasks[CountryCodes.UnitedStates].default,
		validators: state ? validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedStates][state]) : validatePatternOnBlur(businessRegistrationNumberPatterns[CountryCodes.UnitedStates].default),
		guidanceText: state ? stateFormatGuidanceText[state] : stateFormatGuidanceText.default
	})
};
var exemptFromRegistrationNumberDefaultFieldMetadata = { label: "iDontHaveARegistrationNumber" };
var exemptFromRegistrationNumberDefaultFieldConfig = {
	[CountryCodes.Australia]: { label: "doNotHaveAcn" },
	[CountryCodes.Austria]: { label: "doNotHaveFirmenbuchnummer" },
	[CountryCodes.Finland]: { label: "doNotHaveYTunnus" },
	[CountryCodes.HongKong]: { label: "iDoNotHaveCompanyRegistrationNumber" },
	[CountryCodes.Germany]: { label: "doNotHaveHandelsregisternummerOrVereinsregisternummer" },
	[CountryCodes.Lithuania]: { label: "doNotHaveLtRegistrationNumber" },
	[CountryCodes.Luxembourg]: { label: "doNotHaveLuRegistrationNumber" },
	[CountryCodes.Poland]: { label: "doNotHaveRegonKrsNumber" },
	[CountryCodes.PuertoRico]: { label: "doNotHaveEIN" },
	[CountryCodes.Sweden]: { label: "doNotHaveOrganisationsnummer" },
	[CountryCodes.Switzerland]: { label: "doNotHaveChRegistrationNumber" }
};
/**
* Returns the helper text for the business registration number field.
*/
var getRegistrationNumberHelperText = (t, { country, companyType }) => {
	if (country === CountryCodes.Australia && companyType === CompanyTypesValues.INCORPORATED_ASSOCIATION) return t(($) => $["findYourIncorporatedAssociationNumberInThePublicRegistryForYourState"]);
};
//#endregion
//#region src/components/Shared/fields/BusinessRegistrationNumberField/registrationNumberTypes.ts
var restrictedCompanyTypes = [
	CompanyTypesValues.SOLE_PROPRIETORSHIP,
	CompanyTypesValues.UNINCORPORATED_PARTNERSHIP,
	CompanyTypesValues.INCORPORATED_PARTNERSHIP,
	CompanyTypesValues.INCORPORATED_ASSOCIATION,
	"trust"
];
var isRestrictedCompanyType = (companyType) => Boolean(companyType && restrictedCompanyTypes.includes(companyType));
var isApplicableOnlyForSingleRestrictedType = (option) => {
	if (!option.applicableOnlyFor || option.applicableOnlyFor.length !== 1) return false;
	return restrictedCompanyTypes.includes(option.applicableOnlyFor[0]);
};
var companyRegistrationNumberOptions = {
	[CountryCodes.Australia]: [{
		id: "incorporatedAssociationRegistrationNumber",
		name: "incorporatedAssociationRegistrationNumber",
		applicableOnlyFor: [CompanyTypesValues.INCORPORATED_ASSOCIATION]
	}, {
		id: "australianBusinessNumberAcn",
		name: "australianBusinessNumberAcn",
		applicableOnlyFor: [
			CompanyTypesValues.PRIVATE_COMPANY,
			CompanyTypesValues.PUBLIC_COMPANY,
			CompanyTypesValues.UNLISTED_PUBLIC_COMPANY,
			CompanyTypesValues.UNINCORPORATED_PARTNERSHIP,
			CompanyTypesValues.INCORPORATED_PARTNERSHIP,
			CompanyTypesValues.GOVERNMENTAL_ORGANIZATION,
			CompanyTypesValues.NON_PROFIT_OR_CHARITABLE,
			CompanyTypesValues.SOLE_PROPRIETORSHIP
		]
	}],
	[CountryCodes.Austria]: [{
		id: "firmenbuchnummer",
		name: "firmenbuchnummer"
	}, {
		id: "ZVR",
		name: "zentralesVereinsregisterId",
		applicableOnlyFor: [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE, CompanyTypesValues.INCORPORATED_ASSOCIATION]
	}],
	[CountryCodes.Croatia]: [{
		id: "MBO",
		name: "MBO",
		applicableOnlyFor: [CompanyTypesValues.SOLE_PROPRIETORSHIP]
	}, {
		id: "MBS",
		name: "MBS",
		applicableOnlyFor: [
			CompanyTypesValues.PRIVATE_COMPANY,
			CompanyTypesValues.PUBLIC_COMPANY,
			CompanyTypesValues.UNLISTED_PUBLIC_COMPANY,
			CompanyTypesValues.UNINCORPORATED_PARTNERSHIP,
			CompanyTypesValues.INCORPORATED_PARTNERSHIP,
			CompanyTypesValues.GOVERNMENTAL_ORGANIZATION,
			CompanyTypesValues.NON_PROFIT_OR_CHARITABLE
		]
	}],
	[CountryCodes.France]: [{
		id: "SIRET",
		name: "siret"
	}, {
		id: "RNA",
		name: "rnaNumber",
		applicableOnlyFor: [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]
	}],
	[CountryCodes.Hungary]: [{
		id: "nyilvantartasiSzam",
		name: "huRegistrationNumberForSoleProp",
		applicableOnlyFor: [CompanyTypesValues.SOLE_PROPRIETORSHIP]
	}],
	[CountryCodes.Italy]: [
		{
			id: "partitaIVA",
			name: "partitaIVA",
			applicableOnlyFor: [CompanyTypesValues.SOLE_PROPRIETORSHIP]
		},
		{
			id: "codiceFiscalePartitaIVA",
			name: "codiceFiscalePartitaIVA",
			applicableOnlyFor: [
				CompanyTypesValues.PRIVATE_COMPANY,
				CompanyTypesValues.PUBLIC_COMPANY,
				CompanyTypesValues.UNLISTED_PUBLIC_COMPANY,
				CompanyTypesValues.UNINCORPORATED_PARTNERSHIP,
				CompanyTypesValues.INCORPORATED_PARTNERSHIP,
				CompanyTypesValues.INCORPORATED_ASSOCIATION,
				CompanyTypesValues.GOVERNMENTAL_ORGANIZATION,
				CompanyTypesValues.NON_PROFIT_OR_CHARITABLE
			]
		},
		{
			id: "CCIAA",
			name: "CCIAA"
		}
	],
	[CountryCodes.Monaco]: [{
		id: "mcRegistrationNumberSoleProp",
		name: "mcRegistrationNumberSoleProp",
		applicableOnlyFor: [CompanyTypesValues.SOLE_PROPRIETORSHIP]
	}, {
		id: "mcRegistrationNumber",
		name: "mcRegistrationNumber",
		applicableOnlyFor: [
			CompanyTypesValues.PRIVATE_COMPANY,
			CompanyTypesValues.GOVERNMENTAL_ORGANIZATION,
			CompanyTypesValues.INCORPORATED_ASSOCIATION,
			CompanyTypesValues.INCORPORATED_PARTNERSHIP,
			CompanyTypesValues.NON_PROFIT_OR_CHARITABLE,
			CompanyTypesValues.UNINCORPORATED_PARTNERSHIP,
			CompanyTypesValues.UNLISTED_PUBLIC_COMPANY
		]
	}],
	[CountryCodes.NewZealand]: [{
		id: "NZBN",
		name: "NZBN"
	}, {
		id: "companyNumberNZ",
		name: "companyNumberNZ",
		applicableOnlyFor: [
			CompanyTypesValues.PRIVATE_COMPANY,
			CompanyTypesValues.PUBLIC_COMPANY,
			CompanyTypesValues.UNLISTED_PUBLIC_COMPANY
		]
	}],
	[CountryCodes.Romania]: [{
		id: "roRegNumberNewFormat",
		name: "roRegNumberNewFormat_label"
	}, {
		id: "roRegNumberOldFormat",
		name: "roRegNumberOldFormat_label"
	}],
	[CountryCodes.Poland]: [{
		id: "regon",
		name: "regon"
	}, {
		id: "krsNumber",
		name: "krsNumber"
	}],
	[CountryCodes.UnitedKingdom]: [{
		id: "charity",
		name: "charityNumber",
		applicableOnlyFor: [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]
	}, {
		id: "companyNumber",
		name: "companyNumber",
		applicableOnlyFor: [
			CompanyTypesValues.PRIVATE_COMPANY,
			CompanyTypesValues.GOVERNMENTAL_ORGANIZATION,
			CompanyTypesValues.INCORPORATED_ASSOCIATION,
			CompanyTypesValues.INCORPORATED_PARTNERSHIP,
			CompanyTypesValues.NON_PROFIT_OR_CHARITABLE,
			CompanyTypesValues.UNINCORPORATED_PARTNERSHIP,
			CompanyTypesValues.UNLISTED_PUBLIC_COMPANY,
			CompanyTypesValues.PUBLIC_COMPANY
		]
	}]
};
/**
* Returns the company registration number options for a given country and company type.
* If ignoreApplicableOnlyFor is true, options specific to legal arrangements are excluded
* for non-legal-arrangement entities.
*/
var getCompanyRegistrationNumberOptions = (country, companyType, invertCompanyTypeFilter = false) => {
	const optionsForCountry = companyRegistrationNumberOptions[country];
	if (!optionsForCountry) return optionsForCountry;
	if (invertCompanyTypeFilter) {
		if (isRestrictedCompanyType(companyType)) return optionsForCountry.filter((option) => option.applicableOnlyFor?.includes(companyType) ?? true);
		return optionsForCountry.filter((option) => !isApplicableOnlyForSingleRestrictedType(option));
	}
	if (!companyType) return optionsForCountry;
	return optionsForCountry.filter((option) => option.applicableOnlyFor?.includes(companyType) ?? true);
};
/**
* Returns the valid company types for a given registration number type and country.
* @param country The country code
* @param registrationNumberType The registration number type
* @returns The valid company types for the given registration number type and country
*/
function getValidCompanyTypesForRegistrationNumberType(country, registrationNumberType) {
	if (!registrationNumberType) return void 0;
	const registrationNumberOption = companyRegistrationNumberOptions[country]?.find((option) => option.id === registrationNumberType);
	if (!registrationNumberOption?.applicableOnlyFor) return void 0;
	return registrationNumberOption.applicableOnlyFor.filter((companyType) => companyType !== "trust");
}
//#endregion
//#region src/components/Shared/fields/BusinessRegistrationNumberField/RegistrationNumberTypeSelector/CompanyRegistrationNumberTypeSelector.tsx
function CompanyRegistrationNumberTypeSelector({ country, companyType, invertCompanyTypeFilter, selected, setSelected, exemptedOptionLabel }) {
	const { t } = useTranslation("common");
	const options = useMemo$1(() => {
		const availableOptions = getCompanyRegistrationNumberOptions(country, companyType, invertCompanyTypeFilter) ?? [];
		if (availableOptions.length === 0 || !exemptedOptionLabel) return availableOptions;
		return [...availableOptions, {
			id: "exempted",
			name: exemptedOptionLabel
		}];
	}, [
		companyType,
		country,
		exemptedOptionLabel,
		invertCompanyTypeFilter
	]);
	const handleSelect = useCallback$1((selectedStr) => {
		const newSelected = selectedStr;
		if (newSelected === "exempted") {
			if (exemptedOptionLabel) setSelected(newSelected);
			return;
		}
		setSelected(newSelected);
	}, [exemptedOptionLabel, setSelected]);
	useEffect$1(() => {
		if (options.length > 0 && (!selected || !options.some((option) => option.id === selected))) {
			if (selected === "exempted") return;
			setSelected(options[0].id);
		}
	}, [
		options,
		selected,
		setSelected
	]);
	if (options.length <= 1) return null;
	return /* @__PURE__ */ jsx(Field, {
		el: "fieldset",
		name: "companyRegistrationNumberType",
		label: t(($) => $["whichTypeOfRegistrationNumberDoYouHave"]),
		children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, {
			...childProps,
			name: "companyRegistrationNumberType",
			items: options,
			value: selected,
			onChange: handleSelect
		})
	});
}
//#endregion
//#region src/components/Shared/fields/BusinessRegistrationNumberField/RegistrationNumberTypeSelector/inferCompanyRegistrationNumberType.ts
/**
* For existing data, we need to infer the company registration number type from the existing data.
* Otherwise, the incorrect mask will be applied.
* We don't store this choice in the API.
* @param registrationNumber the existing company registration number
* @param country the country of the LE
* @param companyType the company type, e.g. `nonProfit`
*/
var inferCompanyRegistrationNumberType = (registrationNumber, country, companyType, invertCompanyTypeFilter = false) => {
	const optionsForCountry = getCompanyRegistrationNumberOptions(country, companyType, invertCompanyTypeFilter);
	const metadataFn = registrationNumberDefaultFieldConfig[country];
	if (!optionsForCountry) return void 0;
	if (optionsForCountry.length === 1) return optionsForCountry[0].id;
	if (!optionsForCountry || !metadataFn) return void 0;
	const allMetaData = optionsForCountry.reduce((acc, option) => {
		const meta = typeof metadataFn === "function" ? metadataFn({ registrationNumberType: option.id }) : metadataFn;
		if (meta.label && !acc[meta.label]) acc[meta.label] = meta;
		return acc;
	}, {});
	for (const option of optionsForCountry) {
		const fieldMetadata = allMetaData[option.name];
		if (!fieldMetadata?.validators) continue;
		if ((Array.isArray(fieldMetadata.validators) ? fieldMetadata.validators : [fieldMetadata.validators]).every((validator) => validator.validate(registrationNumber))) return option.id;
	}
};
//#endregion
//#region src/components/Shared/fields/BusinessRegistrationNumberField/RegistrationNumberTypeSelector/getDefaultRegistrationNumberType.ts
/**
* Determines the default business registration number type based on exisiting information, country, and company/entity type.
* This function follows a priority order:
* 1. Infer the type from the number if possible
* 2. Otherwise, use the first available business registration number type for the country
*
* @param registrationNumber - business registration number value
* @param country - Country code to determine the business registration number type
* @param companyType - The company type or entity type (i.e. Trust) of the business
* @returns The determined business registration number type or undefined if none can be determined
*/
function getDefaultRegistrationNumberType(registrationNumber, country, companyType, invertCompanyTypeFilter) {
	return registrationNumber ? inferCompanyRegistrationNumberType(registrationNumber, country, companyType, invertCompanyTypeFilter) : getCompanyRegistrationNumberOptions(country, companyType, invertCompanyTypeFilter)?.[0]?.id;
}
//#endregion
//#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"
			}
		}
	},
	[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/validate.ts
var registrationAddressValidationRules = { operationalAddressIsSame: {
	modes: ["blur"],
	validate: (operationalAddressIsSame) => !!operationalAddressIsSame,
	errorMessage: "fieldIsRequired"
} };
//#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"]
	}
};
var registrationAddressFormID = registrationAddressForms.registrationAddress.formId;
var operationalAddressFormID = registrationAddressForms.operationalAddress.formId;
function RegistrationAddress(props) {
	const { t } = useTranslation("common");
	const { id, heading, description, country, data, validators, problems } = props;
	const { requiredFields: registrationAddressRequiredFields, optionalFields: registrationAddressOptionalFields, readOnlyFields: registrationAddressReadOnlyFields, obscuredFields: registrationAddressObscuredFields, verifyFields: registrationAddressVerifyFields, trustedFields: registrationAddressTrustedFields } = getFormProps(props, registrationAddressFormID);
	const { data: formData, valid: formValid, errors: formErrors, fieldProblems: formFieldProblems, handleChangeFor, setValid } = useForm({
		...props,
		schema: ["operationalAddressIsSame"],
		defaultData: data,
		rules: validators || registrationAddressValidationRules,
		obscuredFields: [],
		optionalFields: registrationAddressOptionalFields,
		trustedFields: registrationAddressTrustedFields
	});
	const formUtils = createFormUtils({
		...props,
		requiredFields: registrationAddressRequiredFields,
		optionalFields: registrationAddressOptionalFields,
		readOnlyFields: registrationAddressReadOnlyFields,
		obscuredFields: registrationAddressObscuredFields,
		verifyFields: registrationAddressVerifyFields,
		trustedFields: registrationAddressTrustedFields
	}, t);
	const stateRef = useRef$1({ setState: null });
	useEffect$1(() => {
		stateRef?.current?.setState?.({
			type: "addToState",
			value: {
				data: formData,
				valid: formValid,
				errors: formErrors,
				fieldProblems: formFieldProblems,
				dataStoreId: id,
				schema: [
					"registrationAddress",
					"operationalAddressIsSame",
					...isOperationAddressNotSame() ? ["operationalAddress"] : []
				]
			}
		});
	}, [
		formData,
		formValid,
		formErrors,
		formFieldProblems
	]);
	const isOperationAddressNotSame = () => formData.operationalAddressIsSame === operationalAddressIsSameIds.OPERATIONAL_ADDRESS_IS_NOT_SAME;
	const registrationAddressFormProps = getFormProps(props, registrationAddressFormID);
	const operationalAddressFormProps = getFormProps(props, operationalAddressFormID);
	const handleRegistrationAddressChange = (state) => {
		handleChangeFor("registrationAddress")(state.data);
		setValid("registrationAddress", Boolean(state.isValid));
	};
	const handleOperationalAddressChange = (state) => {
		handleChangeFor("operationalAddress")(state.data);
		setValid("operationalAddress", Boolean(state.isValid));
	};
	const handleOperationalAddressIsSameChange = (value) => {
		handleChangeFor("operationalAddressIsSame")(value);
		if (value === "OperationAddressAnswerYes") setValid("operationalAddress", true);
	};
	return /* @__PURE__ */ jsxs(Fragment$1, { children: [
		/* @__PURE__ */ jsx(StateContextSetter, {
			owner: id,
			stateRef
		}),
		heading && /* @__PURE__ */ jsx(Header, {
			title: heading,
			description
		}),
		/* @__PURE__ */ jsx(ErrorPanel, {
			verificationErrors: id ? problems?.verificationErrors?.[id] : void 0,
			validationErrors: id ? problems?.validationErrors?.[id] : void 0,
			formUtils,
			id: "ariaErrorField"
		}),
		/* @__PURE__ */ jsx(ContextGuidance, {
			titleId: "whyDoINeedToFillInThisInformation",
			contentId: "reasonForFillingCompanyAddressDetails",
			title: t(($) => $["whyDoINeedToFillInThisInformation"]),
			content: t(($) => $["reasonForFillingCompanyAddressDetails"])
		}),
		/* @__PURE__ */ jsx(Address, {
			...registrationAddressFormProps,
			data: {
				...registrationAddressFormProps?.data,
				country
			},
			hideCountry: true,
			id,
			addressType: "registrationAddress",
			optionalFields: ["otherAddressInformation"],
			onChange: handleRegistrationAddressChange
		}),
		/* @__PURE__ */ jsx(Header, {
			title: t(($) => $["operationalAddressHeader"]),
			secondary: true
		}),
		/* @__PURE__ */ jsx(Field, {
			el: "fieldset",
			name: "operationalAddressIsSame",
			label: formUtils.getLabel("operationalAddressIsSame"),
			errorMessage: formErrors.operationalAddressIsSame?.errorMessage,
			children: (childProps) => /* @__PURE__ */ jsx(RadioGroup, {
				...childProps,
				name: "operationalAddressIsSame",
				items: operationalAddressIsSameItems,
				value: formData.operationalAddressIsSame,
				disabled: formUtils.isReadOnly("operationalAddressIsSame"),
				onChange: handleOperationalAddressIsSameChange,
				"aria-required": true,
				"aria-invalid": !formValid.operationalAddressIsSame
			})
		}),
		isOperationAddressNotSame() && /* @__PURE__ */ createElement$1(Address, {
			...operationalAddressFormProps,
			key: "operationalAddress",
			data: {
				...operationalAddressFormProps?.data,
				country
			},
			hideCountry: true,
			id,
			optionalFields: ["otherAddressInformation"],
			addressType: "operationalAddress",
			onChange: handleOperationalAddressChange
		})
	] });
}
//#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 adyen-kyc-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: "adyen-kyc-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 { exemptFromRegistrationNumberDefaultFieldMetadata as C, registrationNumberDefaultFieldMetadata as E, exemptFromRegistrationNumberDefaultFieldConfig as S, registrationNumberDefaultFieldConfig as T, BusinessRegistrationNumberField as _, operationalAddressIsSameItems as a, getCompanyRegistrationNumberOptions as b, getDefaultVatNumberType as c, vatAbsenceReasonMetadata as d, doingBusinessAsAbsentFieldMetadata as f, BUSINESS_REGISTRATION_NUMBER_FIELD as g, DBA_NAME_FIELD as h, operationalAddressIsSameIds as i, defaultFieldConfig as l, DBANameField as m, RegistrationAddress as n, VAT_NUMBER_FIELD as o, doingBusinessAsFieldMetadata as p, registrationAddressFields as r, VatNumberField as s, MemoizedConstitutionalDocument as t, defaultFieldMetadata as u, getDefaultRegistrationNumberType as v, getRegistrationNumberHelperText as w, getValidCompanyTypesForRegistrationNumberType as x, inferCompanyRegistrationNumberType as y };
