{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { AccountGroupId, AccountWalletId } from '@metamask/account-api';\nimport type {\n  AccountId,\n  AccountsControllerAccountsAddedEvent,\n  AccountsControllerAccountsRemovedEvent,\n  AccountsControllerGetAccountAction,\n  AccountsControllerGetSelectedMultichainAccountAction,\n  AccountsControllerListMultichainAccountsAction,\n  AccountsControllerSelectedAccountChangeEvent,\n  AccountsControllerSetSelectedAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n  ControllerGetStateAction,\n  ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { KeyringControllerGetStateAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n  MultichainAccountServiceCreateMultichainAccountGroupAction,\n  MultichainAccountServiceCreateMultichainAccountGroupsAction,\n} from '@metamask/multichain-account-service';\nimport type { MultichainAccountServiceWalletStatusChangeEvent } from '@metamask/multichain-account-service';\nimport type {\n  AuthenticationController,\n  UserStorageController,\n} from '@metamask/profile-sync-controller';\nimport type { SnapControllerGetSnapAction } from '@metamask/snaps-controllers';\n\nimport type { controllerName } from './AccountTreeController';\nimport type { AccountTreeControllerMethodActions } from './AccountTreeController-method-action-types';\nimport type {\n  BackupAndSyncAnalyticsEventPayload,\n  BackupAndSyncEmitAnalyticsEventParams,\n} from './backup-and-sync/analytics';\nimport type {\n  AccountGroupObject,\n  AccountTreeGroupPersistedMetadata,\n} from './group';\nimport type {\n  AccountWalletObject,\n  AccountTreeWalletPersistedMetadata,\n} from './wallet';\n\n// Backward compatibility aliases using indexed access types\n/**\n * @deprecated Use AccountTreeGroupMetadata for tree objects or AccountTreeGroupPersistedMetadata for controller state\n */\nexport type AccountGroupMetadata = AccountGroupObject['metadata'];\n\n/**\n * @deprecated Use AccountTreeWalletMetadata for tree objects or AccountTreeWalletPersistedMetadata for controller state\n */\nexport type AccountWalletMetadata = AccountWalletObject['metadata'];\n\nexport type AccountTreeControllerState = {\n  accountTree: {\n    wallets: {\n      // Wallets:\n      [walletId: AccountWalletId]: AccountWalletObject;\n    };\n  };\n  selectedAccountGroup: AccountGroupId | '';\n  isAccountTreeSyncingInProgress: boolean;\n  hasAccountTreeSyncingSyncedAtLeastOnce: boolean;\n  /** Persistent metadata for account groups (names, pinning, hiding, sync timestamps) */\n  accountGroupsMetadata: Record<\n    AccountGroupId,\n    AccountTreeGroupPersistedMetadata\n  >;\n  /** Persistent metadata for account wallets (names, sync timestamps) */\n  accountWalletsMetadata: Record<\n    AccountWalletId,\n    AccountTreeWalletPersistedMetadata\n  >;\n};\n\nexport type AccountTreeControllerGetStateAction = ControllerGetStateAction<\n  typeof controllerName,\n  AccountTreeControllerState\n>;\n\nexport type AllowedActions =\n  | AccountsControllerGetAccountAction\n  | AccountsControllerGetSelectedMultichainAccountAction\n  | AccountsControllerListMultichainAccountsAction\n  | AccountsControllerSetSelectedAccountAction\n  | KeyringControllerGetStateAction\n  | SnapControllerGetSnapAction\n  | UserStorageController.UserStorageControllerGetStateAction\n  | UserStorageController.UserStorageControllerPerformGetStorageAction\n  | UserStorageController.UserStorageControllerPerformGetStorageAllFeatureEntriesAction\n  | UserStorageController.UserStorageControllerPerformSetStorageAction\n  | UserStorageController.UserStorageControllerPerformBatchSetStorageAction\n  | AuthenticationController.AuthenticationControllerGetSessionProfileAction\n  | MultichainAccountServiceCreateMultichainAccountGroupAction\n  | MultichainAccountServiceCreateMultichainAccountGroupsAction;\n\nexport type AccountTreeControllerActions =\n  | AccountTreeControllerGetStateAction\n  | AccountTreeControllerMethodActions;\n\nexport type AccountTreeControllerStateChangeEvent = ControllerStateChangeEvent<\n  typeof controllerName,\n  AccountTreeControllerState\n>;\n\n/**\n * Represents the `AccountTreeController:accountTreeChange` event.\n * This event is emitted when nodes (wallets, groups, or accounts) are added or removed.\n */\nexport type AccountTreeControllerAccountTreeChangeEvent = {\n  type: `${typeof controllerName}:accountTreeChange`;\n  payload: [AccountTreeControllerState['accountTree']];\n};\n\n/**\n * Represents the `AccountTreeController:selectedAccountGroupChange` event.\n * This event is emitted when the selected account group changes.\n */\nexport type AccountTreeControllerSelectedAccountGroupChangeEvent = {\n  type: `${typeof controllerName}:selectedAccountGroupChange`;\n  payload: [AccountGroupId | '', AccountGroupId | ''];\n};\n\n/**\n * Represents the `AccountTreeController:accountGroupCreated` event.\n * This event is emitted when a new account group is added to the tree\n * after the controller has been initialized.\n */\nexport type AccountTreeControllerAccountGroupCreatedEvent = {\n  type: `${typeof controllerName}:accountGroupCreated`;\n  payload: [AccountGroupObject];\n};\n\n/**\n * Represents the `AccountTreeController:accountGroupUpdated` event.\n * This event is emitted when an existing account group's metadata or\n * membership changes after the controller has been initialized.\n */\nexport type AccountTreeControllerAccountGroupUpdatedEvent = {\n  type: `${typeof controllerName}:accountGroupUpdated`;\n  payload: [AccountGroupObject];\n};\n\n/**\n * Represents the `AccountTreeController:accountGroupRemoved` event.\n * This event is emitted when an account group is pruned from the tree\n * (its last account was removed) after the controller has been initialized.\n */\nexport type AccountTreeControllerAccountGroupRemovedEvent = {\n  type: `${typeof controllerName}:accountGroupRemoved`;\n  payload: [AccountGroupId];\n};\n\nexport type AllowedEvents =\n  | AccountsControllerAccountsAddedEvent\n  | AccountsControllerAccountsRemovedEvent\n  | AccountsControllerSelectedAccountChangeEvent\n  | UserStorageController.UserStorageControllerStateChangeEvent\n  | MultichainAccountServiceWalletStatusChangeEvent;\n\nexport type AccountTreeControllerEvents =\n  | AccountTreeControllerStateChangeEvent\n  | AccountTreeControllerAccountTreeChangeEvent\n  | AccountTreeControllerSelectedAccountGroupChangeEvent\n  | AccountTreeControllerAccountGroupCreatedEvent\n  | AccountTreeControllerAccountGroupUpdatedEvent\n  | AccountTreeControllerAccountGroupRemovedEvent;\n\nexport type AccountTreeControllerMessenger = Messenger<\n  typeof controllerName,\n  AccountTreeControllerActions | AllowedActions,\n  AccountTreeControllerEvents | AllowedEvents\n>;\n\nexport type AccountTreeControllerConfig = {\n  trace?: TraceCallback;\n  backupAndSync?: {\n    onBackupAndSyncEvent?: (event: BackupAndSyncAnalyticsEventPayload) => void;\n  };\n  accountOrderCallbacks?: {\n    isHiddenAccount?: (accountId: AccountId) => boolean;\n    isPinnedAccount?: (accountId: AccountId) => boolean;\n  };\n};\n\nexport type AccountTreeControllerInternalBackupAndSyncConfig = {\n  emitAnalyticsEventFn: (event: BackupAndSyncEmitAnalyticsEventParams) => void;\n};\n"]}