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] = "d1e50d37-0cb3-443c-95b2-d137fcbbb738", e._sentryDebugIdIdentifier = "sentry-dbid-d1e50d37-0cb3-443c-95b2-d137fcbbb738");
} catch (e) {}
import { t as TaskTypes } from "./taskTypes-DWaxzvnQ.js";
import { lazy } from "preact/compat";
import { matchRoute, useLocation } from "wouter-preact";
//#region src/router/getDefaultTask.ts
var getDefaultTask = ({ legalEntity, canSeeEntitySelection, canChangeEntityType, showIntroduction, shouldShowSingpassSelection, showServiceAgreementsFirst, showBusinessFinancingFirst }) => {
	const hasLegalEntityProgressedBeyondEntitySelection = hasProgressedBeyondEntitySelection(legalEntity);
	if (showServiceAgreementsFirst) return TaskTypes.SERVICE_AGREEMENT;
	if (showBusinessFinancingFirst) return TaskTypes.BUSINESS_FINANCING;
	if (canChangeEntityType && canSeeEntitySelection && !hasLegalEntityProgressedBeyondEntitySelection) return TaskTypes.BUSINESS_TYPE_SELECTION;
	if (showIntroduction) return TaskTypes.INTRODUCTION;
	if (shouldShowSingpassSelection) return TaskTypes.SINGPASS_SELECTION;
	return TaskTypes.TASKS_OVERVIEW;
};
/**
* Determine if the LE has data beyond entity selection.
*/
var hasProgressedBeyondEntitySelection = (legalEntity) => {
	const hasOwnEntityAssocation = legalEntity.entityAssociations?.some((ea) => ea.associatorId === legalEntity.id);
	const hasOrganizationType = legalEntity.organization?.type;
	return hasOwnEntityAssocation || !!hasOrganizationType;
};
//#endregion
//#region src/router/routeConfig.ts
var Introduction = lazy(async () => (await import("./Introduction-DtL0bA4R.js")).Introduction);
var Adaptive = lazy(async () => (await import("./AdaptiveWorkflow-D3WOUCtY.js")).AdaptiveWorkflow);
var BusinessTypeSelectionPage = lazy(async () => (await import("./BusinessTypeSelectionPage-D-Mbk28l.js")).BusinessTypeSelectionPage);
var SingpassSelection = lazy(async () => (await import("./SingpassSelection-Bksn6t52.js")).SingpassSelection);
var AccountSetupRejected = lazy(async () => (await import("./AccountSetupRejected-_VNh1Xj4.js")).AccountSetupRejected);
var DecisionMakers = lazy(async () => (await import("./DecisionMakers-c0L12DVq.js").then((n) => n.n)).DecisionMakers);
var CustomerSupport = lazy(async () => (await import("./CustomerSupport-Cq2yBN4K.js")).CustomerSupport);
var Review = lazy(async () => (await import("./Review-BjMmCI8_.js")).Review);
var SignPCIComponent = lazy(async () => (await import("./SignPCIComponent-C91NFrWs.js").then((n) => n.n)).SignPCIComponent);
var AcceptTermsOfService = lazy(async () => (await import("./AcceptTermsOfServiceComponent-BIYgOoqa.js").then((n) => n.n)).AcceptTermsOfServiceComponent);
var TaxReportingDropin = lazy(async () => (await import("./TaxReportingDropin-BMYbiHlX.js").then((n) => n.n)).TaxReportingDropin);
var PayoutDetailsPage = lazy(async () => (await import("./PayoutDetailsPage-V8DC6v5K.js")).PayoutDetailsPage);
var RootBusinessDetailsPage = lazy(async () => (await import("./RootBusinessDetailsPage-rqDMn2Ek.js")).RootBusinessDetailsPage);
var RootBusinessLinesPage = lazy(async () => (await import("./RootBusinessLinesPage-vX2RdR1q.js")).RootBusinessLinesPage);
var SoleProprietorshipPage = lazy(async () => (await import("./SoleProprietorshipPage-Bmawn9Hl.js")).SoleProprietorshipPage);
var TrustMemberCompanyPage = lazy(async () => (await import("./TrustMemberCompanyPage-H5BUSK-l.js")).TrustMemberCompanyPage);
var TrustMemberIndividualPage = lazy(async () => (await import("./TrustMemberIndividualPage-DpbgH2PJ.js")).TrustMemberIndividualPage);
var TrustMemberRoleAndTypePage = lazy(async () => (await import("./TrustMemberRoleAndTypePage-B6CAPw_I.js")).TrustMemberRoleAndTypePage);
var TrustMembersOverview = lazy(async () => (await import("./TrustMembersOverview-sPSvGI74.js")).TrustMembersOverview);
var UnincorporatedPartnershipMemberCompanyPage = lazy(async () => (await import("./UnincorporatedPartnershipMemberCompanyPage-rPLWCL6f.js")).UnincorporatedPartnershipMemberCompanyPage);
var UnincorporatedPartnershipIndividualPage = lazy(async () => (await import("./UnincorporatedPartnershipIndividualPage-BHzho70s.js")).UnincorporatedPartnershipIndividualPage);
var UnincorporatedPartnershipMemberRoleAndTypePage = lazy(async () => (await import("./UnincorporatedPartnershipMemberRoleAndTypePage-DvhPYL9l.js")).UnincorporatedPartnershipMemberRoleAndTypePage);
var UnincorporatedPartnershipMembersOverview = lazy(async () => (await import("./UnincorporatedPartnershipMembersOverview-MeqDhQz7.js")).UnincorporatedPartnershipMembersOverview);
var BusinessFinancingPage = lazy(async () => (await import("./BusinessFinancingPage-CRPspsfV.js")).BusinessFinancingPage);
var TrustDetailsPage = lazy(async () => (await import("./TrustDetailsPage-ByWKgzze.js")).TrustDetailsPage);
var SourceOfFundsPage = lazy(async () => (await import("./SourceOfFundsPage-GTMmyUv0.js").then((n) => n.n)).SourceOfFundsPage);
var RootIndividualDetailsPage = lazy(async () => (await import("./RootIndividualDetailsPage-Der3LFsF.js")).RootIndividualDetailsPage);
var LegalRepresentativeDetailsPage = lazy(async () => (await import("./LegalRepresentativeDetailsPage-DKAjE1nh.js")).LegalRepresentativeDetailsPage);
var DecisionMakerDetailsPage = lazy(async () => (await import("./DecisionMakerDetailsPage-CPz3zBFp.js")).DecisionMakerDetailsPage);
lazy(async () => (await import("./InvitedDecisionMakerComponent-CHAwNzUH.js").then((n) => n.n)).InvitedDecisionMakerComponent);
var ROUTE_CONFIG = {
	[TaskTypes.ADAPTIVE]: {
		path: "/adaptive",
		Component: Adaptive
	},
	[TaskTypes.TASKS_OVERVIEW]: { path: "/tasks" },
	[TaskTypes.INTRODUCTION]: {
		path: "/introduction",
		Component: Introduction
	},
	[TaskTypes.BUSINESS_TYPE_SELECTION]: {
		path: "/business-type-selection",
		Component: BusinessTypeSelectionPage
	},
	[TaskTypes.SINGPASS_SELECTION]: {
		path: "/singpass-selection",
		Component: SingpassSelection
	},
	[TaskTypes.INDIVIDUAL]: {
		path: "/individual",
		Component: RootIndividualDetailsPage
	},
	[TaskTypes.BUSINESS_DETAILS]: {
		path: "/business",
		Component: RootBusinessDetailsPage
	},
	[TaskTypes.ACQUIRING_BUSINESS_LINE]: {
		path: "/business-lines",
		Component: RootBusinessLinesPage
	},
	[TaskTypes.DECISION_MAKER_OVERVIEW]: {
		path: "/decision-makers",
		Component: DecisionMakers
	},
	[TaskTypes.DECISION_MAKER]: {
		path: "/decision-maker/:parentId/:decisionMakerId?",
		Component: DecisionMakerDetailsPage
	},
	[TaskTypes.PAYOUT]: {
		path: "/payout/:transferInstrumentId?",
		Component: PayoutDetailsPage
	},
	[TaskTypes.PAYIN]: {
		path: "/payin/:transferInstrumentId?",
		Component: PayoutDetailsPage
	},
	[TaskTypes.SERVICE_AGREEMENT]: {
		path: "/service-agreement",
		Component: AcceptTermsOfService
	},
	[TaskTypes.PCI_DSS]: {
		path: "/pci-dss",
		Component: SignPCIComponent
	},
	[TaskTypes.REVIEW]: {
		path: "/review",
		Component: Review
	},
	[TaskTypes.CUSTOMER_SUPPORT]: {
		path: "/customer-support",
		Component: CustomerSupport
	},
	[TaskTypes.CAPABILITY_REJECTED]: {
		path: "/capability-rejected",
		Component: AccountSetupRejected
	},
	[TaskTypes.LEGAL_REPRESENTATIVE_DETAILS]: {
		path: "/legal-representative",
		Component: LegalRepresentativeDetailsPage
	},
	[TaskTypes.SOURCE_OF_FUNDS]: {
		path: "/source-of-funds",
		Component: SourceOfFundsPage
	},
	[TaskTypes.BUSINESS_FINANCING]: {
		path: "/business-financing",
		Component: BusinessFinancingPage
	},
	[TaskTypes.TAX_REPORTING]: {
		path: "/tax-reporting",
		Component: TaxReportingDropin
	},
	[TaskTypes.SOLE_PROPRIETOR_COMPANY]: {
		path: "/sole-proprietor",
		Component: SoleProprietorshipPage
	},
	[TaskTypes.TRUST]: {
		path: "/trust",
		Component: TrustDetailsPage
	},
	[TaskTypes.TRUST_MEMBER]: { path: "/trust/member" },
	[TaskTypes.TRUST_MEMBER_OVERVIEW]: {
		path: "/trust/members",
		Component: TrustMembersOverview
	},
	[TaskTypes.TRUST_MEMBER_ROLE_AND_TYPE]: {
		path: "/trust/member/role-and-type/:memberId?",
		Component: TrustMemberRoleAndTypePage
	},
	[TaskTypes.TRUST_MEMBER_INDIVIDUAL]: {
		path: "/trust/member/:memberId?/individual",
		Component: TrustMemberIndividualPage
	},
	[TaskTypes.TRUST_MEMBER_COMPANY]: {
		path: "/trust/member/:memberId?/company",
		Component: TrustMemberCompanyPage
	},
	[TaskTypes.TRUST_MEMBER_COMPANY_OWNER]: {
		path: "/trust/member/:memberId/company-owner/:parentId/:decisionMakerId?",
		Component: DecisionMakerDetailsPage
	},
	[TaskTypes.UNINCORPORATED_PARTNERSHIP]: {
		path: "/partnership",
		Component: TrustDetailsPage
	},
	[TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_OVERVIEW]: {
		path: "/partnership/members",
		Component: UnincorporatedPartnershipMembersOverview
	},
	[TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_ROLE_AND_TYPE]: {
		path: "/partnership/member/role-and-type/:memberId?",
		Component: UnincorporatedPartnershipMemberRoleAndTypePage
	},
	[TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_INDIVIDUAL]: {
		path: "/partnership/member/:memberId?/individual",
		Component: UnincorporatedPartnershipIndividualPage
	},
	[TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_COMPANY]: {
		path: "/partnership/member/:memberId?/company",
		Component: UnincorporatedPartnershipMemberCompanyPage
	},
	[TaskTypes.UNINCORPORATED_PARTNERSHIP_MEMBER_COMPANY_OWNER]: {
		path: "/partnership/member/:memberId/company-owner/:parentId/:decisionMakerId?",
		Component: DecisionMakerDetailsPage
	}
};
/**
* Maps each TaskType to its URL path pattern.
* Derived from ROUTE_CONFIG — do not edit directly.
*/
var ROUTE_PATHS = Object.fromEntries(Object.entries(ROUTE_CONFIG).map(([key, entry]) => [key, entry.path]));
/**
* Build a concrete URL path from a TaskType and optional params.
* Replaces `:paramName` placeholders with actual values.
* Optional params (`:paramName?`) are omitted if not provided.
*/
var buildPath = (task, params) => {
	return "/" + ROUTE_PATHS[task].split("/").filter(Boolean).map((seg) => {
		const isOptional = seg.endsWith("?");
		if (!seg.startsWith(":")) return seg;
		const paramName = seg.slice(1, isOptional ? -1 : void 0);
		const value = params?.[paramName];
		if (!value && isOptional) return null;
		if (!value) throw new Error(`Missing required param "${paramName}" for route "${task}"`);
		return value;
	}).filter((s) => s !== null).join("/");
};
/**
* Detect the base path by stripping any known route suffix from the current
* `window.location.pathname`. This lets deep-links and reloads work correctly
* because the base is the host-page mount point, not the full URL.
*
* Examples (playground):
*   `/onboardingDropinComponent`            → base `/onboardingDropinComponent`
*   `/onboardingDropinComponent/individual` → base `/onboardingDropinComponent`
*
* Examples (production — /balanceplatform/uo/form/{legalEntityId}/{sessionToken}):
*   `/balanceplatform/uo/form/xtl-LE123/TOKEN`            → base `/balanceplatform/uo/form/xtl-LE123/TOKEN`
*   `/balanceplatform/uo/form/xtl-LE123/TOKEN/individual` → base `/balanceplatform/uo/form/xtl-LE123/TOKEN`
*   `/balanceplatform/uo/form/xtl-LE123/TOKEN/tasks`      → base `/balanceplatform/uo/form/xtl-LE123/TOKEN`
*/
var detectBasePath = (parser, pathname = window.location.pathname) => {
	const pathSegments = pathname.split("/").filter(Boolean);
	const sortedRoutes = Object.values(ROUTE_PATHS).sort((a, b) => b.split("/").filter(Boolean).length - a.split("/").filter(Boolean).length);
	for (let i = 0; i < pathSegments.length; i++) {
		const candidatePath = "/" + pathSegments.slice(i).join("/");
		for (const routePath of sortedRoutes) {
			const [match] = matchRoute(parser, routePath, candidatePath);
			if (match) {
				const baseSegments = pathSegments.slice(0, i);
				return baseSegments.length > 0 ? "/" + baseSegments.join("/") : "/";
			}
		}
	}
	return (pathname.endsWith("/") ? pathname.slice(0, -1) : pathname) || "/";
};
//#endregion
//#region src/router/useNavigate.ts
var useNavigate = () => {
	const [, setLocation] = useLocation();
	const withSearch = (path) => path + window.location.search;
	const to = (task, params) => {
		if (task === "default") {
			setLocation(withSearch("/"));
			return;
		}
		setLocation(withSearch(buildPath(task, params)));
	};
	const back = (stepCount = 1) => {
		window.history.go(-stepCount);
	};
	const replace = (task, params) => {
		setLocation(withSearch(buildPath(task, params)), { replace: true });
	};
	return {
		to,
		back,
		replace
	};
};
//#endregion
export { UnincorporatedPartnershipMembersOverview as A, TrustMemberCompanyPage as C, UnincorporatedPartnershipIndividualPage as D, TrustMembersOverview as E, getDefaultTask as M, UnincorporatedPartnershipMemberCompanyPage as O, TrustDetailsPage as S, TrustMemberRoleAndTypePage as T, SignPCIComponent as _, BusinessTypeSelectionPage as a, SourceOfFundsPage as b, DecisionMakers as c, PayoutDetailsPage as d, ROUTE_PATHS as f, RootIndividualDetailsPage as g, RootBusinessLinesPage as h, BusinessFinancingPage as i, detectBasePath as j, UnincorporatedPartnershipMemberRoleAndTypePage as k, Introduction as l, RootBusinessDetailsPage as m, AcceptTermsOfService as n, CustomerSupport as o, Review as p, AccountSetupRejected as r, DecisionMakerDetailsPage as s, useNavigate as t, LegalRepresentativeDetailsPage as u, SingpassSelection as v, TrustMemberIndividualPage as w, TaxReportingDropin as x, SoleProprietorshipPage as y };
