import type { App , ComputedRef , DeepReadonly , } from 'vue' ; type UnionToIntersection < U > = ( U extends any ? ( arg : U ) => any : never ) extends ( ( arg : infer I ) => void ) ? I : never ; export type BaseState = object ; export type StoreProvider < TState extends BaseState > = keyof StoreProviders < TState > ; export type ReadState < TState extends BaseState > = DeepReadonly < TState > ; export type WriteState < TState extends BaseState > = TState ; export type StoreRegistrations = Record < string , Map < string , StoreRegistration > > ; export type RegistrationType = 'ref' | 'reactive' | 'computed' | 'other' ; export type RegistrationValueProducer = ( ) => unknown ; export type Getter < TState extends BaseState , TResult > = ( state : ReadState < TState > ) => TResult ; export type Mutator < TState extends BaseState , TPayload , TResult = void > = ( state : WriteState < TState > , payload : TPayload ) => TResult ; export type Mutation < TPayload , TResult = void > = undefined extends TPayload ? ( payload ? : TPayload ) => TResult : ( payload : TPayload ) => TResult ; export type InternalStores = Map < string , InternalStore < any > > ; export type EventHandler < TData = any > = ( payload ? : EventPayload < TData > ) => void ; export type MutationTriggerHandler < TPayload , TResult > = ( data : MutationEventData < TPayload , TResult > ) => void ; export type Extension < TState extends BaseState > = ( store : InternalStore < TState > ) => Record < string , any > ; export type ExtendedStore < TExtensions extends Extension < any > [ ] > = UnionToIntersection < ReturnType < TExtensions [ number ] > > ; export interface Emittable { on ( event , handler ) : EventListener ; once ( event , handler ) : EventListener ; off ( event , handler ) : void ; emit ( event , payload ? ) : void ; } export interface EventListener { dispose ( ) : void ; } export interface EventPayload < TData = any > { sender : string ; store : string ; data : TData ; } export interface MutationEventData < TPayload = any , TResult = any > { mutation : string ; payload : TPayload ; result ? : TResult ; } export interface StoreRegistration { type : RegistrationType ; producer : RegistrationValueProducer ; } export interface StoreBase < TState extends BaseState > { param name param getter getter < TResult > ( name , getter ) : ComputedRef < TResult > ; param name param mutator mutation < TPayload , TResult = void > ( name , mutator ) : Mutation < TPayload , TResult > ; param event param handler on ( event , handler ) : EventListener ; param event param handler once ( event , handler ) : EventListener ; param callback suppress < TResult = void > ( callback ) : TResult ; /**
     * Destroy this store
     */ destroy ( ) : void ; } export interface StoreProviders < TState extends BaseState > { param state read ( state ) : ReadState < TState > ; param state write ( state ) : WriteState < TState > ; param payload payload < TPayload > ( payload ) : TPayload ; } export interface InternalStore < TState extends BaseState = any > extends StoreBase < TState > { /**
     * A boolean indicating whether this store allows overwriting duplicate registrations
     */ readonly allowsOverwrite : boolean ; /**
     * A set of providers used by this store
     */ readonly providers : StoreProviders < TState > ; /**
     * The current (readonly) state object
     */ readonly state : ReadState < TState > ; /**
     * The name of this store
     */ name : string ; /**
     * A list of items registered on this store
     */ registrations : StoreRegistrations ; param group param name hasRegistration ( group , name ) : boolean ; param group param name getRegistration ( group , name ) : StoreRegistration | undefined ; param group param name param valueProducer param type register ( group , name , valueProducer , type ? ) : void ; param group param name unregister ( group , name ) : void ; param event param sender param data emit ( event , sender , data ) : void ; param callback track < TResult > ( callback ) : TResult ; param key param value provider < TKey extends StoreProvider < TState > > ( key , value ) : void ; param name param sender param mutator param suppress write < TResult = void > ( name , sender , mutator , suppress ? ) : TResult ; } export interface InternalStoreOptions < TState extends BaseState > { /**
     * A boolean indicating whether this store allows overwriting duplicate registrations
     */ allowOverwrite : boolean ; /**
     * A set of providers used by this store
     */ providers : Partial < StoreProviders < TState > > ; } export interface StoreOptions < TState extends BaseState , TExtensions extends Extension < TState > [ ] > extends InternalStoreOptions < TState > { /**
     * An optional array of extensions to extend this store with
     */ extensions ? : TExtensions ; } export interface Store < TState extends BaseState > extends StoreBase < TState > { /**
     * The current (readonly) state object
     */ state : ReadState < TState > ; param mutationName param handler onBeforeMutation < TPayload = any , TResult = any > ( mutationName , handler ) : EventListener ; param mutationName param handler onAfterMutation < TPayload = any , TResult = any > ( mutationName , handler ) : EventListener ; param mutationName param handler onMutationSuccess < TPayload = any , TResult = any > ( mutationName , handler ) : EventListener ; param mutationName param handler onMutationError < TPayload = any , TResult = any > ( mutationName , handler ) : EventListener ; } export interface HarlemPlugin { /**
     * The name of this plugin
     */ name : string ; param app param eventEmitter param stores install ( app , eventEmitter , stores ) : void ; } export interface PluginOptions { /**
     * An optional array of plugins to register with Harlem
     */ plugins ? : HarlemPlugin [ ] ; }