import { Component, Input } from '@angular/core';
import { shuffle } from 'lodash';
import * as i0 from "@angular/core";
import * as i1 from "../../../../../ui-kit/formgroup/cs-select/cs-select.component";
export class PreviewDropdownComponent {
    constructor() {
        this.choicesForPreviewMode = [];
    }
    ngOnInit() {
        this.choicesForPreviewMode = [...this.question.choices];
        if (this.question.randomize === true) {
            this.randomize();
        }
        if (this.question.hasOther === true && this.choicesForPreviewMode.findIndex((x) => x.title === "Other") < 0) {
            this.choicesForPreviewMode.push({ title: 'Other' });
        }
    }
    randomize() {
        this.choicesForPreviewMode = shuffle(this.choicesForPreviewMode);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PreviewDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PreviewDropdownComponent, selector: "app-preview-dropdown", inputs: { question: "question" }, ngImport: i0, template: "<div class=\"preview-list\">\n    <div class=\"dropdown-area\">\n        <app-cs-select  [dataList]='choicesForPreviewMode' [valueKey]=\"'title'\" [displayProperty]=\"'title'\" [selectedValue]=\"'Select an option'\"></app-cs-select>\n    </div>\n</div>", styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";@import\"https://cdn.v-comply.com/design-system/css/mixin/mixin.css\";@import\"https://cdn.v-comply.com/design-system/css/display/display.css\";@import\"https://cdn.v-comply.com/design-system/css/alignment/alignment.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.css\";@import\"https://cdn.v-comply.com/design-system/css/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/width/width.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-top.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-left.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-right.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-top.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-left.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-right.css\";::ng-deep .preview-list .dropdown-area{width:37.5rem}\n"], dependencies: [{ kind: "component", type: i1.CsSelectComponentUI, selector: "app-cs-select", inputs: ["dataList", "dropdownLabel", "displayProperty", "selectedValue", "isRequired", "dropdownSubLabel", "disabled", "placeholder", "stylex", "valueKey", "multipleSelect", "colorProperty", "colorSelected"], outputs: ["selectedData", "selectedValueChange"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PreviewDropdownComponent, decorators: [{
            type: Component,
            args: [{ selector: 'app-preview-dropdown', template: "<div class=\"preview-list\">\n    <div class=\"dropdown-area\">\n        <app-cs-select  [dataList]='choicesForPreviewMode' [valueKey]=\"'title'\" [displayProperty]=\"'title'\" [selectedValue]=\"'Select an option'\"></app-cs-select>\n    </div>\n</div>", styles: ["@import\"https://cdn.v-comply.com/design-system/css/icons/icons.css\";@import\"https://cdn.v-comply.com/design-system/css/mixin/mixin.css\";@import\"https://cdn.v-comply.com/design-system/css/display/display.css\";@import\"https://cdn.v-comply.com/design-system/css/alignment/alignment.css\";@import\"https://cdn.v-comply.com/design-system/css/color/color.css\";@import\"https://cdn.v-comply.com/design-system/css/text/text.css\";@import\"https://cdn.v-comply.com/design-system/css/width/width.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-top.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-left.css\";@import\"https://cdn.v-comply.com/design-system/css/margin/margin-right.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-top.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-bottom.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-left.css\";@import\"https://cdn.v-comply.com/design-system/css/padding/padding-right.css\";::ng-deep .preview-list .dropdown-area{width:37.5rem}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { question: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJldmlldy1kcm9wZG93bi5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wcm9qZWN0cy92eC13b3JrZmxvdy1lbmdpbmUvc3JjL2xpYi9zaGFyZWRDb21wb25lbnRzL2Fzc2Vzc21lbnQtZWRpdG9yL2NvbXBvbmVudHMvcHJldmlldy9wcmV2aWV3LWRyb3Bkb3duL3ByZXZpZXctZHJvcGRvd24uY29tcG9uZW50LnRzIiwiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvdngtd29ya2Zsb3ctZW5naW5lL3NyYy9saWIvc2hhcmVkQ29tcG9uZW50cy9hc3Nlc3NtZW50LWVkaXRvci9jb21wb25lbnRzL3ByZXZpZXcvcHJldmlldy1kcm9wZG93bi9wcmV2aWV3LWRyb3Bkb3duLmNvbXBvbmVudC5odG1sIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxTQUFTLEVBQUUsS0FBSyxFQUFVLE1BQU0sZUFBZSxDQUFDO0FBQ3pELE9BQU8sRUFBRSxPQUFPLEVBQUUsTUFBTSxRQUFRLENBQUM7OztBQU9qQyxNQUFNLE9BQU8sd0JBQXdCO0lBS25DO1FBREEsMEJBQXFCLEdBQVMsRUFBRSxDQUFDO0lBQ2pCLENBQUM7SUFFakIsUUFBUTtRQUNOLElBQUksQ0FB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