;
{
  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] = "324c8dab-549d-4b52-bd05-eaa614b7bb7f", e._sentryDebugIdIdentifier = "sentry-dbid-324c8dab-549d-4b52-bd05-eaa614b7bb7f");
  } catch (e) {
  }
}
;
import { matchRoute, useLocation } from "wouter-preact";
import { lazy } from "preact/compat";
import { j as TaskTypes } from "./StoreProvider-CqQrndhS.js";
const Introduction = lazy(
  async () => (await import("./Introduction-LhGtarGZ.js")).Introduction
);
const BusinessTypeSelectionPage = lazy(
  async () => (await import("./BusinessTypeSelectionPage-Bso2Y1at.js")).BusinessTypeSelectionPage
);
const SingpassSelection = lazy(
  async () => (await import("./SingpassSelection-U1M31huz.js")).SingpassSelection
);
const AccountSetupRejected = lazy(
  async () => (await import("./AccountSetupRejected-CF-cnCIb.js")).AccountSetupRejected
);
const DecisionMakers = lazy(
  async () => (await import("./DecisionMakers-CQbmNjWI.js")).DecisionMakers
);
const CustomerSupport = lazy(
  async () => (await import("./CustomerSupport-g91ZiWsN.js")).CustomerSupport
);
const Review = lazy(async () => (await import("./Review-D9Pf2WqV.js")).Review);
const SignPCIComponent = lazy(
  async () => (await import("./SignPCIComponent-BnLelZrT.js")).SignPCIComponent
);
const AcceptTermsOfService = lazy(
  async () => (await import("./AcceptTermsOfServiceComponent-Cj2GqvSw.js")).AcceptTermsOfServiceComponent
);
const TaxReportingDropin = lazy(
  async () => (await import("./TaxReportingDropin-BlvnRUyW.js")).TaxReportingDropin
);
const PayoutDetailsPage = lazy(
  async () => (await import("./PayoutDetailsDropin-DJtljNmL.js").then((n) => n.a)).PayoutDetailsPage
);
const RootBusinessDetailsPage = lazy(
  async () => (await import("./RootBusinessDetailsPage-BofA0JK8.js")).RootBusinessDetailsPage
);
const RootBusinessLinesPage = lazy(
  async () => (await import("./RootBusinessLinesPage-Cbf_4OUw.js")).RootBusinessLinesPage
);
const SoleProprietorshipPage = lazy(
  async () => (await import("./SoleProprietorshipPage-CRafL60c.js")).SoleProprietorshipPage
);
const TrustMemberCompanyPage = lazy(
  async () => (await import("./TrustMemberCompanyPage-BCe5Hvkz.js")).TrustMemberCompanyPage
);
const TrustMemberIndividualPage = lazy(
  async () => (await import("./TrustMemberIndividualPage-DhATu3iX.js")).TrustMemberIndividualPage
);
const TrustMemberRoleAndTypePage = lazy(
  async () => (await import("./TrustMemberRoleAndTypePage-Cq9O2kKQ.js")).TrustMemberRoleAndTypePage
);
const TrustMembersOverview = lazy(
  async () => (await import("./TrustMembersOverview-Bo-pRIXr.js")).TrustMembersOverview
);
const UnincorporatedPartnershipMemberCompanyPage = lazy(
  async () => (await import("./UnincorporatedPartnershipMemberCompanyPage-CA0ZPFJ3.js")).UnincorporatedPartnershipMemberCompanyPage
);
const UnincorporatedPartnershipIndividualPage = lazy(
  async () => (await import("./UnincorporatedPartnershipIndividualPage-VvjrqjuQ.js")).UnincorporatedPartnershipIndividualPage
);
const UnincorporatedPartnershipMemberRoleAndTypePage = lazy(
  async () => (await import("./UnincorporatedPartnershipMemberRoleAndTypePage-Dk9dXSxU.js")).UnincorporatedPartnershipMemberRoleAndTypePage
);
const UnincorporatedPartnershipMembersOverview = lazy(
  async () => (await import("./UnincorporatedPartnershipMembersOverview-9rhwNh5m.js")).UnincorporatedPartnershipMembersOverview
);
const BusinessFinancingPage = lazy(
  async () => (await import("./BusinessFinancingPage-BkLUaF32.js")).BusinessFinancingPage
);
const TrustDetailsPage = lazy(
  async () => (await import("./TrustDetailsPage-CV6E88JB.js")).TrustDetailsPage
);
const SourceOfFundsPage = lazy(
  async () => (await import("./SourceOfFundsPage-D4m8frOQ.js")).SourceOfFundsPage
);
const RootIndividualDetailsPage = lazy(
  async () => (await import("./RootIndividualDetailsPage-BQU3Z-KN.js")).RootIndividualDetailsPage
);
const LegalRepresentativeDetailsPage = lazy(
  async () => (await import("./LegalRepresentativeDetailsPage-ZUpjSnTW.js")).LegalRepresentativeDetailsPage
);
const DecisionMakerDetailsPage = lazy(
  async () => (await import("./DecisionMakerDetailsPage-BBlavxf7.js")).DecisionMakerDetailsPage
);
const ROUTE_CONFIG = {
  [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
  }
};
const ROUTE_PATHS = Object.fromEntries(
  Object.entries(ROUTE_CONFIG).map(([key, entry]) => [key, entry.path])
);
const buildPath = (task, params) => {
  const routePath = ROUTE_PATHS[task];
  const segments = routePath.split("/").filter(Boolean);
  const built = segments.map((seg) => {
    const isOptional = seg.endsWith("?");
    const isParam = seg.startsWith(":");
    if (!isParam) 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);
  return "/" + built.join("/");
};
const 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("/") : "/";
      }
    }
  }
  const trimmed = pathname.endsWith("/") ? pathname.slice(0, -1) : pathname;
  return trimmed || "/";
};
const 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 };
};
export {
  AccountSetupRejected as A,
  BusinessTypeSelectionPage as B,
  CustomerSupport as C,
  DecisionMakers as D,
  Introduction as I,
  LegalRepresentativeDetailsPage as L,
  PayoutDetailsPage as P,
  ROUTE_PATHS as R,
  SingpassSelection as S,
  TrustMembersOverview as T,
  UnincorporatedPartnershipMembersOverview as U,
  RootIndividualDetailsPage as a,
  RootBusinessDetailsPage as b,
  Review as c,
  DecisionMakerDetailsPage as d,
  TrustMemberRoleAndTypePage as e,
  TrustMemberIndividualPage as f,
  TrustMemberCompanyPage as g,
  TrustDetailsPage as h,
  UnincorporatedPartnershipMemberRoleAndTypePage as i,
  UnincorporatedPartnershipIndividualPage as j,
  UnincorporatedPartnershipMemberCompanyPage as k,
  SignPCIComponent as l,
  SoleProprietorshipPage as m,
  AcceptTermsOfService as n,
  SourceOfFundsPage as o,
  BusinessFinancingPage as p,
  TaxReportingDropin as q,
  RootBusinessLinesPage as r,
  detectBasePath as s,
  useNavigate as u
};
