{"version":3,"file":"mosaic-design-infosec-components-components-coalesce-content.mjs","sources":["../../../libs/components/coalesce-content/src/lib/utils/is-non-empty-template-item/is-non-empty-template-item.ts","../../../libs/components/coalesce-content/src/lib/utils/is-non-empty-translate-item/is-non-empty-translate-item.ts","../../../libs/components/coalesce-content/src/lib/utils/find-content-item-to-render/find-content-item-to-render.ts","../../../libs/components/coalesce-content/src/lib/components/coalesce-content/coalesce-content.component.ts","../../../libs/components/coalesce-content/src/lib/components/coalesce-content/coalesce-content.component.html","../../../libs/components/coalesce-content/src/lib/coalesce-content.module.ts","../../../libs/components/coalesce-content/mosaic-design-infosec-components-components-coalesce-content.ts"],"sourcesContent":["import { TemplateRef } from '@angular/core';\n\nimport { isNonNullable } from '@mosaic-design/infosec-components/utils';\n\nimport { CoalesceContentItem, NonEmptyTemplateCoalesceContentItem } from '../../types';\n\nexport function isNonEmptyTemplateItem(item: CoalesceContentItem): item is NonEmptyTemplateCoalesceContentItem {\n    if ('template' in item) {\n        const template = item.template as unknown;\n\n        return isNonNullable(template) && template instanceof TemplateRef;\n    } else {\n        return false;\n    }\n}\n","import { isStringNotEmpty } from '@mosaic-design/infosec-components/utils';\n\nimport { CoalesceContentItem, TranslateCoalesceContentItem } from '../../types';\n\nexport function isNonEmptyTranslateItem(item: CoalesceContentItem): item is TranslateCoalesceContentItem {\n    if ('alias' in item && 'key' in item) {\n        return isStringNotEmpty(item.alias) && isStringNotEmpty(item.key);\n    } else {\n        return false;\n    }\n}\n","import { isArray, isNotEmptyArray } from '@mosaic-design/infosec-components/utils';\n\nimport { CoalesceContentItem } from '../../types';\nimport { isNonEmptyTemplateItem } from '../is-non-empty-template-item/is-non-empty-template-item';\nimport { isNonEmptyTranslateItem } from '../is-non-empty-translate-item/is-non-empty-translate-item';\n\nexport function findContentItemToRender(items: CoalesceContentItem[] | undefined): CoalesceContentItem | undefined {\n    if (isArray(items) && isNotEmptyArray(items)) {\n        return items.find((item) => isNonEmptyTemplateItem(item) || isNonEmptyTranslateItem(item));\n    } else {\n        return undefined;\n    }\n}\n","import { ChangeDetectionStrategy, Component, Input } from '@angular/core';\n\nimport { CoalesceContentItem } from '../../types';\nimport { findContentItemToRender, isNonEmptyTemplateItem, isNonEmptyTranslateItem } from '../../utils';\n\n@Component({\n    selector: 'ic-coalesce-content',\n    templateUrl: './coalesce-content.component.html',\n    styleUrls: ['./coalesce-content.component.scss'],\n    changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class CoalesceContentComponent {\n    protected isNonEmptyTemplateItem = isNonEmptyTemplateItem;\n    protected isNonEmptyTranslateItem = isNonEmptyTranslateItem;\n\n    @Input() set items(value: CoalesceContentItem[] | undefined) {\n        this.item = findContentItemToRender(value);\n    }\n\n    protected item: CoalesceContentItem | undefined;\n}\n","<ng-container *ngIf=\"item\">\n    <ng-container *ngIf=\"isNonEmptyTemplateItem(item)\">\n        <ng-container *ngTemplateOutlet=\"item.template; context: item.context ?? {}\"></ng-container>\n    </ng-container>\n\n    <ng-container *ngIf=\"isNonEmptyTranslateItem(item)\">\n        <ng-container *transloco=\"let translate; read: item.alias\">\n            <span>{{ translate(item.key, item.params) }}</span>\n        </ng-container>\n    </ng-container>\n</ng-container>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { TranslocoDirective } from '@jsverse/transloco';\n\nimport { CoalesceContentComponent } from './components';\n\n/**\n * @deprecated Будет удален в 19 версии. Компоненты будут standalone\n */\n@NgModule({\n    imports: [CommonModule, TranslocoDirective],\n    declarations: [CoalesceContentComponent],\n    exports: [CoalesceContentComponent]\n})\nexport class IcCoalesceContentModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAMM,SAAU,sBAAsB,CAAC,IAAyB,EAAA;AAC5D,IAAA,IAAI,UAAU,IAAI,IAAI,EAAE;AACpB,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAmB,CAAC;QAE1C,OAAO,aAAa,CAAC,QA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