import { ChangeDetectionStrategy, Component } from '@angular/core';
import { BasePollComponent } from '../base-poll.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "../poll-header/poll-header.component";
import * as i3 from "../poll-options-list/poll-options-list.component";
import * as i4 from "../poll-actions/poll-actions.component";
/**
 *
 */
export class PollComponent extends BasePollComponent {
    constructor() {
        super(...arguments);
        this.isClosed = false;
    }
    stateStoreSelector(poll, markForCheck) {
        const unsubscribe = poll.state.subscribeWithSelector((state) => {
            return {
                is_closed: state.is_closed,
            };
        }, (state) => {
            this.isClosed = state.is_closed ?? false;
            markForCheck();
        });
        return unsubscribe;
    }
}
PollComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PollComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
PollComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: PollComponent, selector: "stream-poll", usesInheritance: true, ngImport: i0, template: "<div class=\"str-chat__poll\" [class.str-chat__poll--closed]=\"isClosed\">\n  <div #header><ng-content select=\"[poll-header]\"></ng-content></div>\n  <ng-container *ngIf=\"!header.hasChildNodes()\">\n    <stream-poll-header [pollId]=\"pollId\" [messageId]=\"messageId\">\n    </stream-poll-header>\n  </ng-container>\n  <div #options><ng-content select=\"[poll-options-list]\"></ng-content></div>\n  <ng-container *ngIf=\"!options.hasChildNodes()\">\n    <stream-poll-options-list [pollId]=\"pollId\" [messageId]=\"messageId\">\n    </stream-poll-options-list>\n  </ng-container>\n  <div #actions><ng-content select=\"[poll-actions]\"></ng-content></div>\n  <ng-container *ngIf=\"!actions.hasChildNodes()\">\n    <stream-poll-actions [pollId]=\"pollId\" [messageId]=\"messageId\">\n    </stream-poll-actions>\n  </ng-container>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2.PollHeaderComponent, selector: "stream-poll-header" }, { kind: "component", type: i3.PollOptionsListComponent, selector: "stream-poll-options-list", inputs: ["maxOptionsDisplayed"] }, { kind: "component", type: i4.PollActionsComponent, selector: "stream-poll-actions", inputs: ["maxOptionsDisplayed", "maxPollOptions"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PollComponent, decorators: [{
            type: Component,
            args: [{ selector: 'stream-poll', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"str-chat__poll\" [class.str-chat__poll--closed]=\"isClosed\">\n  <div #header><ng-content select=\"[poll-header]\"></ng-content></div>\n  <ng-container *ngIf=\"!header.hasChildNodes()\">\n    <stream-poll-header [pollId]=\"pollId\" [messageId]=\"messageId\">\n    </stream-poll-header>\n  </ng-container>\n  <div #options><ng-content select=\"[poll-options-list]\"></ng-content></div>\n  <ng-container *ngIf=\"!options.hasChildNodes()\">\n    <stream-poll-options-list [pollId]=\"pollId\" [messageId]=\"messageId\">\n    </stream-poll-options-list>\n  </ng-container>\n  <div #actions><ng-content select=\"[poll-actions]\"></ng-content></div>\n  <ng-container *ngIf=\"!actions.hasChildNodes()\">\n    <stream-poll-actions [pollId]=\"pollId\" [messageId]=\"messageId\">\n    </stream-poll-actions>\n  </ng-container>\n</div>\n" }]
        }] });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9sbC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy9zdHJlYW0tY2hhdC1hbmd1bGFyL3NyYy9saWIvcG9sbHMvcG9sbC9wb2xsLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3N0cmVhbS1jaGF0LWFuZ3VsYXIvc3JjL2xpYi9wb2xscy9wb2xsL3BvbGwuY29tcG9uZW50Lmh0bWwi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