{"version":3,"file":"ngx-until-destroy.mjs","sources":["../../../projects/until-destroy/src/lib/until-destroy.ts","../../../projects/until-destroy/src/lib/with-destroy.ts","../../../projects/until-destroy/src/public-api.ts","../../../projects/until-destroy/src/ngx-until-destroy.ts"],"sourcesContent":["import { OperatorFunction, Subject, takeUntil } from 'rxjs';\n\nexport function untilDestroy$<T>(\n  componentInstance: any\n): OperatorFunction<T, T> {\n  if (!componentInstance.destroy$) {\n    componentInstance.destroy$ = new Subject<void>();\n  }\n\n  return takeUntil(componentInstance.destroy$);\n}\n","import { Subject } from 'rxjs';\n\nexport function WithDestroy$(options?: { id: string }): ClassDecorator {\n  return (componentClass: any) => {\n    if (options?.id) {\n      console.log(\n        `WithDestroy$ got activated with the following id: `,\n        options?.id\n      );\n    }\n\n    const ngOnDestroy = componentClass.prototype.ngOnDestroy;\n    componentClass.prototype.ngOnDestroy = function (this: any) {\n      // Call the original ngOnDestroy\n      ngOnDestroy && ngOnDestroy.call(this);\n\n      // Look for destroy$ subject on the instance\n      if (this.destroy$) {\n        this.destroy$.next();\n        this.destroy$.complete();\n      }\n    };\n  };\n}\n\nexport class ClassWithDestroy$ {\n  destroy$? = new Subject<void>();\n}\n","/*\n * Public API Surface of until-destroy\n */\n\nexport * from './lib/until-destroy';\nexport * from './lib/with-destroy';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;AAEM,SAAU,aAAa,CAC3B,iBAAsB,EAAA;AAEtB,IAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;AAC/B,QAAA,iBAAiB,CAAC,QAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;AAClD,KAAA;AAED,IAAA,OAAO,SAAS,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC/C;;ACRM,SAAU,YAAY,CAAC,OAAwB,EAAA;IACnD,OAAO,CAAC,cAAmB,KAAI;QAC7B,IAAI,OAAO,EAAE,EAAE,EAAE;YACf,OAAO,CAAC,GAAG,CACT,CAAA,kDAAA,CAAoD,EACpD,OAAO,EAAE,EAAE,CACZ,CAAC;AACH,SAAA;AAED,QAAA,MAAM,WAAW,GAAG,cAAc,CAAC,SAAS,CAAC,WAAW,CAAC;AACzD,QAAA,cAAc,CAAC,SAAS,CAAC,WAAW,GAAG,YAAA;;AAErC,YAAA,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;YAGtC,IAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,gBAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AACrB,gBAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;AAC1B,aAAA;AACH,SAAC,CAAC;AACJ,KAAC,CAAC;AACJ,CAAC;MAEY,iBAAiB,CAAA;AAA9B,IAAA,WAAA,GAAA;AACE,QAAA,IAAA,CAAA,QAAQ,GAAI,IAAI,OAAO,EAAQ,CAAC;KACjC;AAAA;;AC3BD;;AAEG;;ACFH;;AAEG;;;;"}