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] = "05298611-0ff4-446c-8333-7546eaa1f8e0", e._sentryDebugIdIdentifier = "sentry-dbid-05298611-0ff4-446c-8333-7546eaa1f8e0");
} catch (e) {}
import { n as httpGet, s as useApiContext } from "./http-CHTzpXCd.js";
import { n as SettingsContext } from "./useSettingsContext-DzwVt0W0.js";
import { t as CountryCodes } from "./country-code-D3oCpE4i.js";
import { t as useCapabilities } from "./useCapabilities-DN0V0pML.js";
import { useContext } from "preact/hooks";
import { useQuery } from "@tanstack/preact-query";
//#region src/api/configurations/useSupportedCountries.ts
/**
* Retrieves from the backend information about supported countries
* linked to the legalEntityId
*
* @param id legalEntityId
* @param options additional options passed to Tanstack Query, eg; refetchInterval for polling
*/
var getSupportedCountries = async (legalEntityId, baseUrl) => {
	return httpGet({
		baseUrl,
		path: `legalEntities/${legalEntityId}/configurations/supportedCountries`
	});
};
var useSupportedCountries = (options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	return useQuery({
		queryKey: ["supportedCountries"],
		queryFn: () => getSupportedCountries(rootLegalEntityId.value, baseUrl.value),
		...options
	});
};
//#endregion
//#region src/context/SettingsContext/useSetting.ts
var useSetting = (settingName) => {
	const { getSetting } = useContext(SettingsContext);
	return getSetting(settingName);
};
//#endregion
//#region src/hooks/useAllowedCountries.ts
var businessAccountCountries = [
	CountryCodes.Austria,
	CountryCodes.Belgium,
	CountryCodes.Croatia,
	CountryCodes.Cyprus,
	CountryCodes.Estonia,
	CountryCodes.Finland,
	CountryCodes.France,
	CountryCodes.Germany,
	CountryCodes.Greece,
	CountryCodes.Ireland,
	CountryCodes.Italy,
	CountryCodes.Latvia,
	CountryCodes.Lithuania,
	CountryCodes.Luxembourg,
	CountryCodes.Malta,
	CountryCodes.Netherlands,
	CountryCodes.Portugal,
	CountryCodes.Slovakia,
	CountryCodes.Slovenia,
	CountryCodes.Spain,
	CountryCodes.UnitedKingdom,
	CountryCodes.UnitedStates
];
var useAllowedCountries = () => {
	const isLimitCountryBusinessAccountCustomersEnabled = Object.keys(useCapabilities() ?? {}).includes("issueBankAccount");
	const acceptedCountriesSetting = useSetting("acceptedCountries");
	const { data } = useSupportedCountries({ enabled: !acceptedCountriesSetting });
	const allowedCountries = acceptedCountriesSetting ?? data?.countries;
	if (!allowedCountries) return;
	return isLimitCountryBusinessAccountCustomersEnabled ? businessAccountCountries.filter((country) => allowedCountries.includes(country)) : allowedCountries;
};
//#endregion
export { useSetting as n, useAllowedCountries as t };
