{"version":3,"file":"patron.min.mjs","sources":["../src/Guest/Guest.ts","../src/Guest/GuestCast.ts","../src/Patron/PatronPool.ts","../src/Guest/GuestPool.ts","../src/Guest/GuestSync.ts","../src/Guest/GuestObject.ts","../src/Guest/GuestDisposable.ts","../src/Guest/GuestApplied.ts","../src/Guest/GuestExecutorApplied.ts","../src/Patron/Patron.ts","../src/Patron/PatronOnce.ts","../src/Patron/PatronApplied.ts","../src/Patron/PatronExecutorApplied.ts","../src/Source/SourceWithPool.ts","../src/Source/SourceAll.ts","../src/Source/Source.ts","../src/Source/SourceSequence.ts","../src/Source/SourceMap.ts","../src/Source/SourceRace.ts","../src/Source/SourceActive.ts","../src/Source/SourceDynamic.ts","../src/Source/SourceApplied.ts","../src/Source/SourceExecutorApplied.ts","../src/Source/SourceOnce.ts","../src/Private/PrivateClass.ts","../src/Private/Private.ts"],"sourcesContent":["type GuestIntroduction = \"guest\" | \"patron\";\n\nexport type GuestExecutorType<T = any, This = void> = (value: T) => This;\n\nexport interface GuestObjectType<T = any> {\n  give(value: T): this;\n  introduction?(): GuestIntroduction;\n}\n\nexport type GuestType<T = any> = GuestExecutorType<T> | GuestObjectType<T>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/give\n */\nexport function give<T>(data: T, guest: GuestType<T>) {\n  if (data === undefined) {\n    throw new Error(\"give didnt receive data argument\");\n  }\n  if (guest === undefined) {\n    throw new Error(\"give didnt receive guest argument\");\n  }\n  if (typeof guest === \"function\") {\n    guest(data);\n  } else {\n    guest.give(data);\n  }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-guest\n */\nexport function isGuest(mbGuest: any): mbGuest is GuestType {\n  if (mbGuest === undefined) {\n    throw new Error(\"isGuest didnt receive mbGuest argument\");\n  }\n  return typeof mbGuest === \"function\" || typeof mbGuest?.give === \"function\";\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest\n */\nexport class Guest<T> implements GuestObjectType<T> {\n  public constructor(private receiver: GuestExecutorType<T>) {\n    if (!receiver) {\n      throw new Error(\"reseiver function was not passed to Guest constructor\");\n    }\n  }\n\n  public give(value: T) {\n    this.receiver(value);\n    return this;\n  }\n}\n","import { give, GuestType } from \"./Guest\";\nimport { GuestDisposableType, MaybeDisposableType } from \"./GuestDisposable\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-cast\n */\nexport class GuestCast<T> implements GuestDisposableType<T> {\n  public constructor(\n    private sourceGuest: GuestType<any>,\n    private targetGuest: GuestType<T>,\n  ) {\n    if (sourceGuest === undefined) {\n      throw new Error(\"GuestCast didnt receive sourceGuest argument\");\n    }\n    if (targetGuest === undefined) {\n      throw new Error(\"GuestCast didnt receive targetGuest argument\");\n    }\n  }\n\n  public introduction() {\n    if (typeof this.sourceGuest === \"function\") {\n      return \"guest\";\n    }\n    if (!this.sourceGuest.introduction) {\n      return \"guest\";\n    }\n    return this.sourceGuest.introduction();\n  }\n\n  public give(value: T): this {\n    give(value, this.targetGuest);\n    return this;\n  }\n\n  public disposed(value: T | null): boolean {\n    const maybeDisposable = this.sourceGuest as MaybeDisposableType;\n    return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n  }\n}\n","import { give, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestDisposableType } from \"../Guest/GuestDisposable\";\n\nconst poolSets = new Map<PoolType, Set<GuestObjectType>>();\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/patron-pools\n */\nexport const patronPools = (patron: GuestObjectType) => {\n  const pools: PoolType[] = [];\n  poolSets.forEach((pool, poolInstance) => {\n    if (pool.has(patron)) {\n      pools.push(poolInstance);\n    }\n  });\n  return pools;\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/remove-patron-from-pools\n */\nexport const removePatronFromPools = (patron: GuestObjectType) => {\n  if (patron === undefined) {\n    throw new Error(\"removePatronFromPools didnt receive patron argument\");\n  }\n  poolSets.forEach((pool) => {\n    pool.delete(patron);\n  });\n};\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-patron-in-pools\n */\nexport const isPatronInPools = (patron: GuestObjectType) => {\n  if (patron === undefined) {\n    throw new Error(\"isPatronInPools didnt receive patron argument\");\n  }\n  let inPool = false;\n  poolSets.forEach((pool) => {\n    if (!inPool) {\n      inPool = pool.has(patron);\n    }\n  });\n  return inPool;\n};\n\nexport interface PoolType<T = any> extends GuestObjectType<T> {\n  add(guest: GuestObjectType<T>): this;\n  distribute(receiving: T, possiblePatron: GuestObjectType<T>): this;\n  remove(patron: GuestObjectType<T>): this;\n  size(): number;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-pool\n */\nexport class PatronPool<T> implements PoolType<T> {\n  private patrons: Set<GuestObjectType<T>>;\n\n  public give: (value: T) => this;\n\n  public constructor(private initiator: unknown) {\n    this.patrons = new Set<GuestObjectType<T>>();\n    poolSets.set(this, this.patrons);\n    const doReceive = (value: T) => {\n      this.patrons.forEach((target) => {\n        this.sendValueToGuest(value, target);\n      });\n    };\n    this.give = (value: T) => {\n      doReceive(value);\n      return this;\n    };\n  }\n\n  public size(): number {\n    return this.patrons.size;\n  }\n\n  public add(shouldBePatron: GuestType<T>) {\n    if (!shouldBePatron) {\n      throw new Error(\"PatronPool add method received nothing!\");\n    }\n    if (\n      typeof shouldBePatron !== \"function\" &&\n      shouldBePatron.introduction &&\n      shouldBePatron.introduction() === \"patron\"\n    ) {\n      this.patrons.add(shouldBePatron);\n    }\n    return this;\n  }\n\n  public remove(patron: GuestObjectType<T>) {\n    this.patrons.delete(patron);\n    return this;\n  }\n\n  public distribute(receiving: T, possiblePatron: GuestType<T>): this {\n    this.add(possiblePatron);\n    this.sendValueToGuest(receiving, possiblePatron);\n    return this;\n  }\n\n  private sendValueToGuest(value: T, guest: GuestType<T>) {\n    const isDisposed = this.guestDisposed(value, guest);\n\n    if (!isDisposed) {\n      give(value, guest);\n    }\n  }\n\n  private guestDisposed(value: T, guest: GuestType<T>) {\n    if ((guest as GuestDisposableType).disposed?.(value)) {\n      this.remove(guest as GuestObjectType);\n      return true;\n    }\n\n    return false;\n  }\n}\n","import { PatronPool, PoolType } from \"../Patron/PatronPool\";\nimport { give, GuestObjectType, GuestType } from \"./Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-pool\n */\nexport class GuestPool<T> implements GuestObjectType<T>, PoolType<T> {\n  private guests = new Set<GuestType<T>>();\n\n  private patronPool: PatronPool<T>;\n\n  public constructor(initiator: unknown) {\n    this.patronPool = new PatronPool(initiator);\n  }\n\n  public give(value: T): this {\n    this.deliverToGuests(value);\n    this.patronPool.give(value);\n    return this;\n  }\n\n  public add(guest: GuestType<T>): this {\n    if (\n      typeof guest === \"function\" ||\n      !guest.introduction ||\n      guest.introduction() === \"guest\"\n    ) {\n      this.guests.add(guest);\n    }\n    this.patronPool.add(guest);\n    return this;\n  }\n\n  public remove(patron: GuestObjectType<T>): this {\n    this.guests.delete(patron);\n    this.patronPool.remove(patron);\n    return this;\n  }\n\n  public distribute(receiving: T, possiblePatron: GuestObjectType<T>): this {\n    this.add(possiblePatron);\n    this.give(receiving);\n    return this;\n  }\n\n  public size() {\n    return this.patronPool.size() + this.guests.size;\n  }\n\n  private deliverToGuests(value: T) {\n    this.guests.forEach((target) => {\n      give(value, target);\n    });\n    this.guests.clear();\n  }\n}\n","import { GuestObjectType } from \"./Guest\";\n\nexport interface GuestValueType<T = any> extends GuestObjectType<T> {\n  value(): T;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-sync\n */\nexport class GuestSync<T> implements GuestValueType<T> {\n  public constructor(private theValue: T) {\n    if (theValue === undefined) {\n      throw new Error(\"GuestSync didnt receive theValue argument\");\n    }\n  }\n\n  public give(value: T): this {\n    this.theValue = value;\n    return this;\n  }\n\n  public value() {\n    return this.theValue;\n  }\n}\n","import { Guest, GuestType } from \"./Guest\";\nimport { GuestDisposableType, MaybeDisposableType } from \"./GuestDisposable\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-object\n */\nexport class GuestObject<T> implements GuestDisposableType<T> {\n  public constructor(private baseGuest: GuestType<T>) {\n    if (baseGuest === undefined) {\n      throw new Error(\"GuestObject didnt receive baseGuest argument\");\n    }\n  }\n\n  public give(value: T): this {\n    let guest = this.baseGuest;\n    if (typeof guest === \"function\") {\n      guest = new Guest(guest);\n    }\n    guest.give(value);\n    return this;\n  }\n\n  public introduction() {\n    if (typeof this.baseGuest === \"function\" || !this.baseGuest.introduction) {\n      return \"guest\";\n    }\n    return this.baseGuest.introduction();\n  }\n\n  public disposed(value: T | null): boolean {\n    const maybeDisposable = this.baseGuest as MaybeDisposableType;\n    return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n  }\n}\n","import { give, GuestObjectType, GuestType } from \"./Guest\";\n\nexport interface GuestDisposableType<T = any> extends GuestObjectType<T> {\n  disposed(value: T | null): boolean;\n}\n\nexport type MaybeDisposableType<T = any> = Partial<GuestDisposableType<T>>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-disposable\n */\nexport class GuestDisposable<T> implements GuestDisposableType<T> {\n  public constructor(\n    private guest: GuestType,\n    private disposeCheck: (value: T | null) => boolean,\n  ) {\n    if (guest === undefined) {\n      throw new Error(\"GuestDisposable didnt receive guest argument\");\n    }\n    if (disposeCheck === undefined) {\n      throw new Error(\"GuestDisposable didnt receive disposeCheck argument\");\n    }\n  }\n\n  public disposed(value: T | null): boolean {\n    return this.disposeCheck(value);\n  }\n\n  public give(value: T): this {\n    give(value, this.guest);\n    return this;\n  }\n}\n","import { give, GuestObjectType, GuestType } from \"../Guest/Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-applied\n */\nexport class GuestApplied<T, R> implements GuestObjectType<T> {\n  public constructor(\n    private baseGuest: GuestType<R>,\n    private applier: (value: T) => R,\n  ) {}\n\n  public give(value: T): this {\n    give(this.applier(value), this.baseGuest);\n    return this;\n  }\n}\n","import {\n  give,\n  GuestExecutorType,\n  GuestObjectType,\n  GuestType,\n} from \"../Guest/Guest\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/guest-executor-applied\n */\nexport class GuestExecutorApplied<T> implements GuestObjectType<T> {\n  public give: GuestExecutorType<T, this>;\n\n  public constructor(\n    baseGuest: GuestType<T>,\n    applier: (executor: GuestExecutorType) => GuestExecutorType,\n  ) {\n    this.give = applier((v) => give(v, baseGuest)) as GuestExecutorType<\n      T,\n      this\n    >;\n  }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { GuestDisposableType } from \"../Guest/GuestDisposable\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron\n */\nexport class Patron<T> implements GuestDisposableType<T> {\n  public constructor(private willBePatron: GuestType<T>) {\n    if (willBePatron === undefined) {\n      throw new Error(\"Patron didnt receive willBePatron argument\");\n    }\n  }\n\n  public introduction() {\n    return \"patron\" as const;\n  }\n\n  public give(value: T): this {\n    give(value, this.willBePatron);\n    return this;\n  }\n\n  public disposed(value: T | null): boolean {\n    const maybeDisposable = this.willBePatron as GuestDisposableType;\n    return maybeDisposable?.disposed?.(value) || false;\n  }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-patron\n */\nexport const isPatron = (guest: GuestType): guest is Patron<unknown> =>\n  typeof guest === \"object\" &&\n  guest !== null &&\n  guest?.introduction?.() === \"patron\";\n","import { give, GuestType } from \"../Guest/Guest\";\nimport {\n  GuestDisposableType,\n  MaybeDisposableType,\n} from \"../Guest/GuestDisposable\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-once\n */\nexport class PatronOnce<T> implements GuestDisposableType<T> {\n  private received = false;\n\n  public constructor(private baseGuest: GuestType<T>) {\n    if (baseGuest === undefined) {\n      throw new Error(\"PatronOnce didnt receive baseGuest argument\");\n    }\n  }\n\n  public introduction() {\n    return \"patron\" as const;\n  }\n\n  public give(value: T): this {\n    if (!this.received) {\n      this.received = true;\n      give(value, this.baseGuest);\n    }\n    return this;\n  }\n\n  public disposed(value: T | null): boolean {\n    if (this.received) {\n      return true;\n    }\n    const maybeDisposable = this.baseGuest as MaybeDisposableType;\n    return maybeDisposable.disposed ? maybeDisposable.disposed(value) : false;\n  }\n}\n","import { GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestApplied } from \"../Guest/GuestApplied\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-applied\n */\nexport class PatronApplied<T, R> implements GuestObjectType<T> {\n  private guestApplied: GuestApplied<T, R>;\n\n  public constructor(baseGuest: GuestType<R>, applier: (value: T) => R) {\n    this.guestApplied = new GuestApplied(baseGuest, applier);\n  }\n\n  public give(value: T): this {\n    this.guestApplied.give(value);\n    return this;\n  }\n\n  public introduction(): \"guest\" | \"patron\" {\n    return \"patron\";\n  }\n}\n","import { GuestExecutorType, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestExecutorApplied } from \"../Guest/GuestExecutorApplied\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/patron/patron-executor-applied\n */\nexport class PatronExecutorApplied<T> implements GuestObjectType<T> {\n  private guestApplied: GuestExecutorApplied<T>;\n\n  public constructor(\n    baseGuest: GuestType<T>,\n    applier: (executor: GuestExecutorType) => GuestExecutorType,\n  ) {\n    this.guestApplied = new GuestExecutorApplied(baseGuest, applier);\n  }\n\n  public give(value: T): this {\n    this.guestApplied.give(value);\n    return this;\n  }\n\n  public introduction(): \"guest\" | \"patron\" {\n    return \"patron\";\n  }\n}\n","import { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { SourceObjectType } from \"./Source\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { isPatron } from \"../Patron/Patron\";\n\nexport interface PoolAwareType<T = any> {\n  pool(): PatronPool<T>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source-with-pool\n */\nexport type SourceWithPoolType<T = any> = SourceObjectType<T> &\n  GuestObjectType<T> &\n  PoolAwareType<T>;\n\nexport class SourceWithPool<T> implements SourceWithPoolType<T> {\n  private thePool = new PatronPool(this);\n  private theEmptyPool = new PatronPool(this);\n  private isEmpty: boolean;\n\n  public constructor(private sourceDocument?: T) {\n    this.isEmpty = sourceDocument === undefined;\n  }\n\n  public pool() {\n    return this.thePool;\n  }\n\n  public give(value: T): this {\n    this.isEmpty = false;\n    this.sourceDocument = value;\n    this.thePool.give(this.sourceDocument);\n    this.theEmptyPool.give(this.sourceDocument);\n    return this;\n  }\n\n  public value(guest: GuestType<T>): this {\n    if (this.isEmpty) {\n      if (isPatron(guest)) {\n        this.theEmptyPool.add(guest);\n      }\n      return this;\n    }\n\n    if (typeof guest === \"function\") {\n      this.thePool.distribute(this.sourceDocument, new Guest(guest));\n    } else {\n      this.thePool.distribute(this.sourceDocument, guest);\n    }\n\n    return this;\n  }\n\n  public filled() {\n    return !this.isEmpty;\n  }\n}\n","import { SourceObjectType } from \"./Source\";\nimport { SourceWithPool } from \"./SourceWithPool\";\nimport { Guest, GuestObjectType, GuestType } from \"../Guest/Guest\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { GuestObject } from \"../Guest/GuestObject\";\nimport { GuestPool } from \"../Guest/GuestPool\";\n\nexport interface SourceAllType<T = any> extends SourceObjectType<T> {\n  valueArray(guest: GuestObjectType<T>): this;\n  guestKey<R>(key: string): GuestObjectType<R>;\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/source-all\n */\nexport class SourceAll<T> implements SourceAllType<T> {\n  private theAll: SourceWithPool<Record<string, unknown>>;\n\n  private keysKnown: Set<string>;\n\n  private keysFilled = new Set();\n\n  private filledAllPool = new GuestPool(this);\n\n  public constructor(initialKnownKeys: string[] = []) {\n    this.theAll = new SourceWithPool<Record<string, unknown>>({});\n    this.keysKnown = new Set(initialKnownKeys);\n  }\n\n  public valueArray(guest: GuestType<T>) {\n    const guestObject = new GuestObject(guest);\n    this.filledAllPool.add(\n      new GuestCast(guestObject, (value: Record<string, unknown>) => {\n        guestObject.give(Object.values(value) as T);\n      }),\n    );\n    if (this.isAllFilled()) {\n      this.theAll.value(\n        new Guest((all: Record<string, unknown>) => {\n          this.filledAllPool.give(Object.values(all));\n        }),\n      );\n    }\n    return this;\n  }\n\n  public value(guest: GuestType<T>) {\n    const guestObject = new GuestObject(guest);\n    if (this.isAllFilled()) {\n      this.filledAllPool.add(guestObject);\n      this.theAll.value(\n        new Guest((all) => {\n          this.filledAllPool.give(all);\n        }),\n      );\n    } else {\n      this.filledAllPool.add(guestObject);\n    }\n    return this;\n  }\n\n  public guestKey<R>(key: string): GuestObjectType<R> {\n    this.keysKnown.add(key);\n    return new Guest((value) => {\n      this.theAll.value(\n        new Guest((all: Record<string, unknown>) => {\n          this.keysFilled.add(key);\n          const lastAll = {\n            ...all,\n            [key]: value,\n          };\n          this.theAll.give(lastAll);\n          if (this.isAllFilled()) {\n            this.filledAllPool.give(lastAll);\n          }\n        }),\n      );\n    });\n  }\n\n  private isAllFilled() {\n    return (\n      this.keysFilled.size > 0 && this.keysFilled.size === this.keysKnown.size\n    );\n  }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\n\nexport type SourceExecutorType<T> = (guest: GuestType<T>) => unknown;\n\nexport interface SourceObjectType<T> {\n  value: SourceExecutorType<T>;\n}\n\nexport type SourceType<T = any> = SourceExecutorType<T> | SourceObjectType<T>;\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/value\n */\nexport function value<T>(source: SourceType<T>, guest: GuestType<T>) {\n  if (source === undefined) {\n    throw new Error(\"value didnt receive source argument\");\n  }\n  if (guest === undefined) {\n    throw new Error(\"value didnt receive guest argument\");\n  }\n  if (typeof source === \"function\") {\n    return source(guest);\n  } else {\n    return source.value(guest);\n  }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/is-source\n */\nexport function isSource(mbSource: any): mbSource is SourceType {\n  if (mbSource === undefined) {\n    throw new Error(\"isSource didnt receive mbSource argument\");\n  }\n  return (\n    typeof mbSource === \"function\" || typeof mbSource?.value === \"function\"\n  );\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/source\n */\nexport class Source<T = any> implements SourceObjectType<T> {\n  public constructor(private source: SourceType<T>) {\n    if (source === undefined) {\n      throw new Error(\"Source constructor didnt receive executor function\");\n    }\n  }\n\n  public value(guest: GuestType<T>): GuestType<T> {\n    value(this.source, guest);\n    return guest;\n  }\n}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/source-of\n */\nexport const sourceOf = <T>(value: T) => new Source<T>((g) => give(value, g));\n","import { SourceWithPool } from \"../Source/SourceWithPool\";\nimport { give, GuestType } from \"../Guest/Guest\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { PatronOnce } from \"../Patron/PatronOnce\";\nimport { PrivateType } from \"../Private/Private\";\nimport { isSource, SourceObjectType, SourceType, value } from \"./Source\";\nimport { SourceAll } from \"./SourceAll\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/source-sequence\n */\nexport class SourceSequence<T, TG> implements SourceObjectType<TG[]> {\n  public constructor(\n    private baseSource: SourceType<T[]>,\n    private targetSource: PrivateType<SourceType<TG>>,\n  ) {\n    if (baseSource === undefined) {\n      throw new Error(\"SourceSequence didnt receive baseSource argument\");\n    }\n    if (targetSource === undefined) {\n      throw new Error(\"SourceSequence didnt receive targetSource argument\");\n    }\n  }\n\n  public value(guest: GuestType<TG[]>) {\n    const all = new SourceAll<TG[]>();\n    const sequenceSource = new SourceWithPool();\n    const targetSource = this.targetSource.get(sequenceSource);\n\n    value(\n      this.baseSource,\n      new GuestCast(guest, (theValue) => {\n        let index = 0;\n\n        const nextItemHandle = () => {\n          if (theValue[index + 1] !== undefined) {\n            index = index + 1;\n            handle();\n          } else {\n            all.valueArray(guest);\n          }\n        };\n\n        function handle() {\n          sequenceSource.give(null);\n          const nextValue = theValue[index];\n          if (isSource(nextValue)) {\n            value(\n              nextValue,\n              new PatronOnce((theNextValue) => {\n                sequenceSource.give(theNextValue);\n                value(targetSource, all.guestKey(index.toString()));\n                nextItemHandle();\n              }),\n            );\n          } else {\n            sequenceSource.give(nextValue);\n            value(targetSource, all.guestKey(index.toString()));\n            nextItemHandle();\n          }\n        }\n\n        if (theValue[index] !== undefined) {\n          handle();\n        } else {\n          give([], guest);\n        }\n      }),\n    );\n    return this;\n  }\n}\n","import { PrivateType } from \"../Private/Private\";\nimport { give, GuestType } from \"../Guest/Guest\";\nimport {\n  Source,\n  SourceObjectType,\n  SourceType,\n  isSource,\n  value,\n} from \"./Source\";\nimport { SourceAll } from \"./SourceAll\";\nimport { GuestCast } from \"../Guest/GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/source-map\n */\nexport class SourceMap<T, TG> implements SourceObjectType<TG[]> {\n  public constructor(\n    private baseSource: SourceType<T[]>,\n    private targetSource: PrivateType<SourceType<TG>>,\n  ) {\n    if (baseSource === undefined) {\n      throw new Error(\"SourceMap didnt receive baseSource argument\");\n    }\n    if (targetSource === undefined) {\n      throw new Error(\"SourceMap didnt receive targetSource argument\");\n    }\n  }\n\n  public value(guest: GuestType<TG[]>) {\n    const all = new SourceAll();\n    value(\n      this.baseSource,\n      new GuestCast(<GuestType>guest, (theValue) => {\n        theValue.forEach((val, index) => {\n          const valueSource = isSource(val)\n            ? val\n            : new Source((innerGuest) => {\n                give(val, innerGuest);\n              });\n          const targetSource = this.targetSource.get(valueSource);\n          value(targetSource, all.guestKey(index.toString()));\n        });\n      }),\n    );\n    all.valueArray(<GuestType>guest);\n    return this;\n  }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { SourceObjectType, SourceType, value } from \"./Source\";\nimport { GuestCast } from \"../Guest/GuestCast\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/source-race\n */\nexport class SourceRace<T> implements SourceObjectType<T> {\n  public constructor(private sources: SourceType<T>[]) {\n    if (sources === undefined) {\n      throw new Error(\"SourceRace didnt receive sources argument\");\n    }\n  }\n\n  public value(guest: GuestType<T>): this {\n    let connectedWithSource: SourceType | null = null;\n    this.sources.forEach((source) => {\n      value(\n        source,\n        new GuestCast(<GuestType>guest, (value) => {\n          if (!connectedWithSource || connectedWithSource === source) {\n            give(value as T, guest);\n            connectedWithSource = source;\n          }\n        }),\n      );\n    });\n    return this;\n  }\n}\n","import { GuestType } from \"../Guest/Guest\";\nimport { SourceObjectType } from \"./Source\";\nimport { SourceWithPool, SourceWithPoolType } from \"./SourceWithPool\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/utils/action-type\n */\nexport interface ActionType<P = any> {\n  do(config: P): this;\n}\n\nexport interface SourceAcitveType<R = unknown, T = unknown>\n  extends SourceObjectType<T>,\n    ActionType<R> {}\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/guest/source-active\n */\nexport class SourceActive<R, T> implements SourceAcitveType<R, T> {\n  private source = new SourceWithPool<T>();\n\n  public constructor(\n    private configExecutor: (config: R, source: SourceWithPoolType<T>) => void,\n  ) {\n    if (configExecutor === undefined) {\n      throw new Error(\n        \"SourceActive constructor didnt receive executor function\",\n      );\n    }\n  }\n\n  public do(config: R): this {\n    this.configExecutor(config, this.source);\n    return this;\n  }\n\n  public value(guest: GuestType<T>): this {\n    this.source.value(guest);\n    return this;\n  }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { SourceType, value } from \"./Source\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { SourceWithPoolType } from \"./SourceWithPool\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source-dynamic\n */\nexport class SourceDynamic<T = unknown> implements SourceWithPoolType<T> {\n  public constructor(\n    private baseGuest: GuestType<T>,\n    private baseSource: SourceType<T>,\n  ) {\n    if (baseGuest === undefined) {\n      throw new Error(\"SourceDynamic didnt receive baseGuest argument\");\n    }\n    if (baseSource === undefined) {\n      throw new Error(\"SourceDynamic didnt receive baseSource argument\");\n    }\n  }\n\n  public value(guest: GuestType<T>) {\n    value(this.baseSource, guest);\n    return this;\n  }\n\n  public give(value: T) {\n    give(value, this.baseGuest);\n    return this;\n  }\n\n  public pool(): PatronPool<T> {\n    throw Error(\"No pool in SourceDynamic\");\n  }\n}\n","import { give, GuestType } from \"../Guest/Guest\";\nimport { GuestCast } from \"../Guest/GuestCast\";\nimport { SourceObjectType, SourceType, value } from \"../Source/Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-applied\n */\nexport class SourceApplied<T, R> implements SourceObjectType<R> {\n  public constructor(\n    private baseSource: SourceType<T>,\n    private applier: (v: T) => R,\n  ) {}\n\n  public value(g: GuestType<R>) {\n    value(\n      this.baseSource,\n      new GuestCast(g, (v) => {\n        give(this.applier(v), g);\n      }),\n    );\n    return this;\n  }\n}\n","import {\n  SourceExecutorType,\n  SourceObjectType,\n  SourceType,\n  value,\n} from \"../Source/Source\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-executor-applied\n */\nexport class SourceExecutorApplied<T> implements SourceObjectType<T> {\n  public value: SourceExecutorType<T>;\n\n  public constructor(\n    source: SourceType<T>,\n    applier: (executor: SourceExecutorType<T>) => SourceExecutorType<T>,\n  ) {\n    this.value = applier((g) => {\n      value(source, g);\n    });\n  }\n}\n","import { GuestType } from \"../Guest/Guest\";\nimport { PatronPool } from \"../Patron/PatronPool\";\nimport { value } from \"./Source\";\nimport { SourceWithPool, SourceWithPoolType } from \"./SourceWithPool\";\n\n/**\n * @url https://kosukhin.github.io/patron.site/#/source/source-once\n */\nexport class SourceOnce<T> implements SourceWithPoolType<T> {\n  private source: SourceWithPool<T>;\n\n  public constructor(initialValue?: T) {\n    this.source = new SourceWithPool(initialValue);\n  }\n\n  public value(guest: GuestType<T>) {\n    value(this.source, guest);\n    return this;\n  }\n\n  public give(value: T): this {\n    if (!this.source.filled()) {\n      this.source.give(value);\n    }\n    return this;\n  }\n\n  public pool(): PatronPool<T> {\n    return this.source.pool();\n  }\n}\n","import { PrivateType } from \"./Private\";\n\ninterface Constructable<T> {\n  new (...args: unknown[]): T;\n}\n\ninterface Prototyped<T> {\n  prototype: T;\n}\n\nexport class PrivateClass<T> implements PrivateType<T> {\n  public constructor(\n    private constructorFn: Prototyped<T>,\n    private modules: Record<string, unknown> = {},\n  ) {\n    if (constructorFn === undefined) {\n      throw new Error(\"PrivateClass didnt receive constructorFn argument\");\n    }\n  }\n\n  public get<R extends unknown[], CT = null>(\n    ...args: R\n  ): CT extends null ? T : CT {\n    return new (this.constructorFn as Constructable<T>)(\n      ...args,\n      this.modules,\n    ) as CT extends null ? T : CT;\n  }\n}\n","/**\n * @url https://kosukhin.github.io/patron.site/#/utils/private\n */\nexport interface PrivateType<T> {\n  get<R extends unknown[], CT = null>(...args: R): CT extends null ? T : CT;\n}\n\nexport class Private<T> implements PrivateType<T> {\n  public constructor(private buildingFn: (...args: any[]) => T) {\n    if (buildingFn === undefined) {\n      throw new Error(\"Private didnt receive buildingFn argument\");\n    }\n  }\n\n  public get<R extends unknown[], CT = null>(\n    ...args: R\n  ): CT extends null ? T : CT {\n    return this.buildingFn(...args) as CT extends null ? T : CT;\n  }\n}\n"],"names":["give","data","guest","Error","isGuest","mbGuest","Guest","constructor","receiver","this","value","GuestCast","sourceGuest","targetGuest","introduction","disposed","maybeDisposable","poolSets","Map","patronPools","patron","pools","forEach","pool","poolInstance","has","push","removePatronFromPools","delete","isPatronInPools","inPool","PatronPool","initiator","__publicField","patrons","Set","set","doReceive","target","sendValueToGuest","size","add","shouldBePatron","remove","distribute","receiving","possiblePatron","guestDisposed","GuestPool","patronPool","deliverToGuests","guests","clear","GuestSync","theValue","GuestObject","baseGuest","GuestDisposable","disposeCheck","GuestApplied","applier","GuestExecutorApplied","v","Patron","willBePatron","isPatron","PatronOnce","received","PatronApplied","guestApplied","PatronExecutorApplied","SourceWithPool","sourceDocument","isEmpty","thePool","theEmptyPool","filled","SourceAll","initialKnownKeys","theAll","keysKnown","valueArray","guestObject","filledAllPool","Object","values","isAllFilled","all","guestKey","key","keysFilled","lastAll","source","isSource","mbSource","Source","sourceOf","g","SourceSequence","baseSource","targetSource","sequenceSource","get","index","nextItemHandle","handle","nextValue","theNextValue","toString","SourceMap","val","valueSource","innerGuest","SourceRace","sources","connectedWithSource","SourceActive","configExecutor","config","SourceDynamic","SourceApplied","SourceExecutorApplied","SourceOnce","initialValue","PrivateClass","constructorFn","modules","args","Private","buildingFn"],"mappings":"AAcgB,SAAAA,EAAQC,EAASC,GAC/B,QAAa,IAATD,EACI,MAAA,IAAIE,MAAM,oCAElB,QAAc,IAAVD,EACI,MAAA,IAAIC,MAAM,qCAEG,mBAAVD,EACTA,EAAMD,GAENC,EAAMF,KAAKC,EAEf,CAKO,SAASG,EAAQC,GACtB,QAAgB,IAAZA,EACI,MAAA,IAAIF,MAAM,0CAElB,MAA0B,mBAAZE,GAAmD,mBAAlBA,GAASL,IAC1D,CAKO,MAAMM,EACJ,WAAAC,CAAoBC,GACzB,GADyBC,KAAAD,SAAAA,GACpBA,EACG,MAAA,IAAIL,MAAM,wDAClB,CAGK,IAAAH,CAAKU,GAEH,OADPD,KAAKD,SAASE,GACPD,IAAA,EC5CJ,MAAME,EACJ,WAAAJ,CACGK,EACAC,GAER,GAHQJ,KAAAG,YAAAA,EACAH,KAAAI,YAAAA,OAEY,IAAhBD,EACI,MAAA,IAAIT,MAAM,gDAElB,QAAoB,IAAhBU,EACI,MAAA,IAAIV,MAAM,+CAClB,CAGK,YAAAW,GACD,MAA4B,mBAArBL,KAAKG,YACP,QAEJH,KAAKG,YAAYE,aAGfL,KAAKG,YAAYE,eAFf,OAE4B,CAGhC,IAAAd,CAAKU,GAEH,OADFV,EAAAU,EAAOD,KAAKI,aACVJ,IAAA,CAGF,QAAAM,CAASL,GACd,MAAMM,EAAkBP,KAAKG,YAC7B,QAAOI,EAAgBD,UAAWC,EAAgBD,SAASL,EAAS,4JCjCxE,MAAMO,MAAeC,IAKRC,EAAeC,IAC1B,MAAMC,EAAoB,GAMnB,OALEJ,EAAAK,SAAQ,CAACC,EAAMC,KAClBD,EAAKE,IAAIL,IACXC,EAAMK,KAAKF,EAAY,I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