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] = "8938bdb9-7793-4ee5-81ef-4767a8546cb0", e._sentryDebugIdIdentifier = "sentry-dbid-8938bdb9-7793-4ee5-81ef-4767a8546cb0");
} catch (e) {}
import { r as useTranslation } from "./translation-Br5wIPO-.js";
import { t as CountryCodes } from "./country-code-D3oCpE4i.js";
import { t as CompanyTypesValues } from "./company-types-value-B-nraMaa.js";
import { l as numericInputs, s as makeMask, u as spacer } from "./MaskedInput-uN8G9HRq.js";
import { a as validateNotEmptyOnBlur, o as validatePatternOnBlur } from "./patternValidators-DMnU4iGe.js";
import { C as businessRegistrationNumberPatterns, T as stateFormatGuidanceText, w as businessRegistrationNumberMasks } from "./utils-CkQJVYhR.js";
import { t as Field } from "./Field-BEqknhTe.js";
import { t as RadioGroup } from "./RadioGroup-XuCtbRrH.js";
import { useCallback, useEffect, useMemo } from "preact/hooks";
import { jsx } from "preact/jsx-runtime";
//#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: "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
		]
	}, {
		id: "charity",
		name: "charityNumber",
		applicableOnlyFor: [CompanyTypesValues.NON_PROFIT_OR_CHARITABLE]
	}]
};
/**
* 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/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/RegistrationNumberTypeSelector/CompanyRegistrationNumberTypeSelector.tsx
function CompanyRegistrationNumberTypeSelector({ country, companyType, invertCompanyTypeFilter, selected, setSelected, exemptedOptionLabel }) {
	const { t } = useTranslation("common");
	const options = useMemo(() => {
		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((selectedStr) => {
		const newSelected = selectedStr;
		if (newSelected === "exempted") {
			if (exemptedOptionLabel) setSelected(newSelected);
			return;
		}
		setSelected(newSelected);
	}, [exemptedOptionLabel, setSelected]);
	useEffect(() => {
		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
export { getValidCompanyTypesForRegistrationNumberType as a, getRegistrationNumberHelperText as c, getCompanyRegistrationNumberOptions as i, registrationNumberDefaultFieldConfig as l, getDefaultRegistrationNumberType as n, exemptFromRegistrationNumberDefaultFieldConfig as o, inferCompanyRegistrationNumberType as r, exemptFromRegistrationNumberDefaultFieldMetadata as s, CompanyRegistrationNumberTypeSelector as t, registrationNumberDefaultFieldMetadata as u };
