;
{
  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] = "eee07a94-1be4-4807-96d2-cfabcec16785", e._sentryDebugIdIdentifier = "sentry-dbid-eee07a94-1be4-4807-96d2-cfabcec16785");
  } catch (e) {
  }
}
;
import { aQ as hasOwnEntityAssociationOfType, o as LegalEntityTypes, bh as isEmptyEntity } from "./StoreProvider-CqQrndhS.js";
const capabilitiesToPreventTypeChange = [
  "receivePayments",
  "issueCard",
  "useCard",
  "withdrawFromAtm",
  "withdrawFromAtmInRestrictedCountries",
  "useCardInRestrictedCountries",
  "useCardInRestrictedIndustries",
  "issueBankAccount",
  "sendToThirdParty",
  "receiveFromThirdParty",
  "getGrantOffers",
  "receiveGrants"
];
const entityTypeToCorrespondingAccountHolderOption = {
  [LegalEntityTypes.INDIVIDUAL]: "myName",
  [LegalEntityTypes.ORGANIZATION]: "theCompanyIWorkFor",
  [LegalEntityTypes.SOLE_PROPRIETORSHIP]: "mySoleProprietorName",
  [LegalEntityTypes.TRUST]: "aTrust",
  [LegalEntityTypes.UNINCORPORATED_PARTNERSHIP]: "anUnincorporatedPartnership"
};
const getDefaultAccountHolderType = (legalEntityResponse, isTypeChanging = false, accountHolder) => {
  if (!legalEntityResponse?.type) return void 0;
  if (hasOwnEntityAssociationOfType(
    LegalEntityTypes.SOLE_PROPRIETORSHIP,
    legalEntityResponse.entityAssociations,
    legalEntityResponse.id
  )) {
    return "mySoleProprietorName";
  }
  if (hasOwnEntityAssociationOfType(
    LegalEntityTypes.TRUST,
    legalEntityResponse.entityAssociations,
    legalEntityResponse.id
  )) {
    return "aTrust";
  }
  if (hasOwnEntityAssociationOfType(
    LegalEntityTypes.UNINCORPORATED_PARTNERSHIP,
    legalEntityResponse.entityAssociations,
    legalEntityResponse.id
  )) {
    return "anUnincorporatedPartnership";
  }
  if (accountHolder) {
    return accountHolder;
  }
  if (isTypeChanging || !isEmptyEntity(legalEntityResponse)) {
    return entityTypeToCorrespondingAccountHolderOption[legalEntityResponse.type];
  }
};
const allowIndividualWithoutSoleProp = (capabilities) => !capabilities?.map((c) => c.replace("Commercial", "").replace("Consumer", "")).some((c) => capabilitiesToPreventTypeChange.includes(c));
export {
  allowIndividualWithoutSoleProp as a,
  getDefaultAccountHolderType as g
};
