{"version":3,"file":"ngxtension-create-repeat.mjs","sources":["../../../../libs/ngxtension/create-repeat/src/create-repeat.ts","../../../../libs/ngxtension/create-repeat/src/ngxtension-create-repeat.ts"],"sourcesContent":["import { assertInInjectionContext, DestroyRef, inject } from '@angular/core';\nimport { repeat, Subject, type MonoTypeOperatorFunction } from 'rxjs';\n\ntype CreateRepeat = (<T>(count?: number) => MonoTypeOperatorFunction<T>) & {\n\temit: () => void;\n};\n\nexport function createRepeat(destroyRef?: DestroyRef): CreateRepeat;\nexport function createRepeat(\n\tgeneralCount?: number,\n\tdestroyRef?: DestroyRef,\n): CreateRepeat;\nexport function createRepeat(\n\tgeneralCountOrDestroyRef?: number | DestroyRef,\n\tdestroyRef?: DestroyRef,\n) {\n\tconst [generalCount, _destroyRef] = parseArgs(\n\t\tgeneralCountOrDestroyRef,\n\t\tdestroyRef,\n\t);\n\n\tconst repeat$ = new Subject<void>();\n\n\t_destroyRef.onDestroy(() => repeat$.complete());\n\n\tconst repeatFn = <T>(count?: number) =>\n\t\trepeat<T>({ count: count ?? generalCount, delay: () => repeat$ });\n\n\trepeatFn.emit = () => repeat$.next();\n\n\treturn repeatFn;\n}\n\nfunction parseArgs(\n\tgeneralCountOrDestroyRef?: number | DestroyRef,\n\tdestroyRef?: DestroyRef,\n) {\n\tconst isGeneralCount = typeof generalCountOrDestroyRef === 'number';\n\n\tconst generalCount = isGeneralCount ? generalCountOrDestroyRef : undefined;\n\n\tdestroyRef ??= !isGeneralCount ? generalCountOrDestroyRef : undefined;\n\n\tif (!destroyRef) assertInInjectionContext(createRepeat);\n\tdestroyRef ??= inject(DestroyRef);\n\n\treturn [generalCount, destroyRef] as const;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAYgB,SAAA,YAAY,CAC3B,wBAA8C,EAC9C,UAAuB,EAAA;AAEvB,IAAA,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,GAAG,SAAS,CAC5C,wBAAwB,EACxB,UAAU,CACV,CAAC;AAEF,IAAA,MAAM,OAAO,GAAG,IAAI,OAAO,EAAQ,CAAC;IAEpC,WAAW,CAAC,SAAS,CAAC,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAEhD,MAAM,QAAQ,GAAG,CAAI,KAAc,KAClC,MAAM,CAAI,EAAE,KAAK,EAAE,KAAK,IAAI,YAAY,EAAE,KAAK,EAAE,MAAM,OAAO,EAAE,CAAC,CAAC;IAEnE,QAAQ,CAAC,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;AAErC,IAAA,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED,SAAS,SAAS,CACjB,wBAA8C,EAC9C,UAAuB,EAAA;AAEvB,IAAA,MAAM,cAAc,GAAG,OAAO,wBAAwB,KAAK,QAAQ,CAAC;IAEpE,MAAM,YAAY,GAAG,cAAc,GAAG,wBAAwB,GAAG,SAAS,CAAC;IAE3E,UAAU,KAAK,CAAC,cAAc,GAAG,wBAAwB,GAAG,SAAS,CAAC;AAEtE,IAAA,IAAI,CAAC,UAAU;QAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;AACxD,IAAA,UAAU,KAAK,MAAM,CAAC,UAAU,CAAC,CAAC;AAElC,IAAA,OAAO,CAAC,YAAY,EAAE,UAAU,CAAU,CAAC;AAC5C;;AC/CA;;AAEG;;;;"}