;
{
  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] = "1f9a5001-7b22-4104-8182-f73d5b934064", e._sentryDebugIdIdentifier = "sentry-dbid-1f9a5001-7b22-4104-8182-f73d5b934064");
  } catch (e) {
  }
}
;
import { u as useTranslation, c as useLegalEntity, a as addResourceBundles, L as Loader, g as getLegalEntityCountry, j as TaskTypes, a8 as EntityTypes, _ as __variableDynamicImportRuntimeHelper } from "./StoreProvider-CqQrndhS.js";
import { jsx } from "preact/jsx-runtime";
import { skipToken } from "@tanstack/preact-query";
import { useParams } from "wouter-preact";
import { u as useTrustMembers } from "./useTrustMembers-Bu1X3sQq.js";
import { u as useCapabilityProblems, g as getProblemsForEntity } from "./getProblemsForEntity-C1PgQbDM.js";
import { u as useBusinessDetailsData, B as BusinessDetailsDropin } from "./useBusinessDetailsData-CoYJKPS2.js";
function TrustMemberCompanyPage({
  trustId,
  trustMemberCompanyId: trustMemberCompanyIdProp,
  newMember,
  onSubmit,
  handleHomeClick
}) {
  const routeParams = useParams();
  const trustMemberCompanyId = trustMemberCompanyIdProp ?? routeParams.memberId;
  const { i18n } = useTranslation();
  const { data: trustLe } = useLegalEntity(trustId ?? skipToken);
  const { data: trustMemberCompanyLe } = useLegalEntity(trustMemberCompanyId ?? skipToken);
  const trustMembers = useTrustMembers();
  const capabilityProblems = useCapabilityProblems();
  const { data, isLoading } = useBusinessDetailsData(
    TaskTypes.TRUST_MEMBER_COMPANY,
    trustLe,
    trustMemberCompanyLe
  );
  addResourceBundles(i18n, [
    { ns: "business", importFn: (lang) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../Business/language/bg-BG.json": () => import("./bg-BG-CFuVZnaC.js"), "../../Business/language/cs-CZ.json": () => import("./cs-CZ-CYsR__kj.js"), "../../Business/language/da-DK.json": () => import("./da-DK-B3Pg-MWO.js"), "../../Business/language/de-DE.json": () => import("./de-DE-S6qDey1L.js"), "../../Business/language/el-GR.json": () => import("./el-GR-DoS_Va-n.js"), "../../Business/language/en-US.json": () => import("./en-US-DLY20x1O.js"), "../../Business/language/es-ES.json": () => import("./es-ES-BYl5-PFR.js"), "../../Business/language/et-EE.json": () => import("./et-EE-4fHYOoff.js"), "../../Business/language/fi-FI.json": () => import("./fi-FI-DFxljML-.js"), "../../Business/language/fr-FR.json": () => import("./fr-FR-DPehHVb6.js"), "../../Business/language/hr-HR.json": () => import("./hr-HR-Bjx-KdVs.js"), "../../Business/language/hu-HU.json": () => import("./hu-HU-B-lUkFnQ.js"), "../../Business/language/it-IT.json": () => import("./it-IT-DOBp2-MP.js"), "../../Business/language/ja-JP.json": () => import("./ja-JP-Bv3ru9Xq.js"), "../../Business/language/lt-LT.json": () => import("./lt-LT-WRulV980.js"), "../../Business/language/lv-LV.json": () => import("./lv-LV-C9Dhkruv.js"), "../../Business/language/nl-NL.json": () => import("./nl-NL-SjOGmGk5.js"), "../../Business/language/no-NO.json": () => import("./no-NO-BAWVf0GX.js"), "../../Business/language/pl-PL.json": () => import("./pl-PL-DEMxxz7h.js"), "../../Business/language/pt-BR.json": () => import("./pt-BR-BfDe_8iW.js"), "../../Business/language/pt-PT.json": () => import("./pt-PT-F1qPZJ2c.js"), "../../Business/language/ro-RO.json": () => import("./ro-RO-0vx6ZLWV.js"), "../../Business/language/sk-SK.json": () => import("./sk-SK-DuLm2CVx.js"), "../../Business/language/sl-SI.json": () => import("./sl-SI-BAIm-qBe.js"), "../../Business/language/sv-SE.json": () => import("./sv-SE-BZNey_8S.js") }), `../../Business/language/${lang}.json`, 5) },
    { ns: "trust", importFn: (lang) => __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../language/bg-BG.json": () => import("./bg-BG-DMNRRZZE.js"), "../language/cs-CZ.json": () => import("./cs-CZ-DXSMRqPu.js"), "../language/da-DK.json": () => import("./da-DK-Cd5IQPv3.js"), "../language/de-DE.json": () => import("./de-DE-C9NH2zMh.js"), "../language/el-GR.json": () => import("./el-GR-DTHQslLc.js"), "../language/en-US.json": () => import("./en-US-DYP6rAvA.js"), "../language/es-ES.json": () => import("./es-ES-DK-7qtDf.js"), "../language/et-EE.json": () => import("./et-EE-DNC4hcxm.js"), "../language/fi-FI.json": () => import("./fi-FI-BJLU1JHw.js"), "../language/fr-FR.json": () => import("./fr-FR-B2je0smB.js"), "../language/hr-HR.json": () => import("./hr-HR-C0NLgF1r.js"), "../language/hu-HU.json": () => import("./hu-HU-DU-5ujQK.js"), "../language/it-IT.json": () => import("./it-IT-Dhwa9Ecj.js"), "../language/ja-JP.json": () => import("./ja-JP-Bc4U0S8-.js"), "../language/lt-LT.json": () => import("./lt-LT-C8n1GZoU.js"), "../language/lv-LV.json": () => import("./lv-LV-BZN4-Xat.js"), "../language/nl-NL.json": () => import("./nl-NL-B0fvINJj.js"), "../language/no-NO.json": () => import("./no-NO-Jw7Gae-a.js"), "../language/pl-PL.json": () => import("./pl-PL-Bmaq3IC3.js"), "../language/pt-BR.json": () => import("./pt-BR-BaTE6BB_.js"), "../language/pt-PT.json": () => import("./pt-PT-c0ap84_F.js"), "../language/ro-RO.json": () => import("./ro-RO-BPOHV6Wp.js"), "../language/sk-SK.json": () => import("./sk-SK-3_SoEn6P.js"), "../language/sl-SI.json": () => import("./sl-SI-DbfswGh0.js"), "../language/sv-SE.json": () => import("./sv-SE-D_Efxy3s.js") }), `../language/${lang}.json`, 3) }
  ]);
  if (isLoading || !trustLe || trustMemberCompanyId && !trustMemberCompanyLe) {
    return /* @__PURE__ */ jsx(Loader, {});
  }
  const { rootLe, efpBusinessLines, documents } = data;
  const problems = capabilityProblems && trustMemberCompanyId ? getProblemsForEntity(capabilityProblems, EntityTypes.LEGAL_ENTITY, trustMemberCompanyId) : void 0;
  const country = getLegalEntityCountry(trustMemberCompanyLe ?? trustLe);
  const trustMember = newMember ?? trustMembers.find(
    (tm) => tm.trustMemberType !== "undefinedBeneficiary" && tm.legalEntityId === trustMemberCompanyId
  );
  return /* @__PURE__ */ jsx(
    BusinessDetailsDropin,
    {
      taskType: TaskTypes.TRUST_MEMBER_COMPANY,
      legalEntityResponse: rootLe,
      efpBusinessLines,
      documents,
      associatedLegalArrangement: trustLe,
      nestedLegalEntity: trustMemberCompanyLe,
      nestedLegalEntityDetails: trustMember,
      problems,
      country,
      onSubmit,
      handleHomeClick
    }
  );
}
export {
  TrustMemberCompanyPage
};
