import { Component, EventEmitter, Input, Output } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { JOURNAL_POST_PRIVACY_OPTIONS, JOURNAL_POST_TITLE, JOURNAL_POST_PRIVACY_STYLE_CLASS, EMPTY_COMMUNITY_LIST_TEXT, MAX_COMMUNITY_TO_SHOW, MIN_COMMUNITY_TO_SHOW_FILTER } from '../inspire-library.const';
import { CommentPolicy, PostType } from '../inspire-library.enum';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "../rte/rte.component";
import * as i4 from "../add-media/add-media.component";
import * as i5 from "../click-outside.directive";
import * as i6 from "../select/select.component";
import * as i7 from "../journal-preview/journal-preview.component";
function JournalPostComponent_ng_container_0_div_16_div_1_figure_1_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "figure", 40);
    i0.ɵɵelement(1, "img", 41);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const community_r7 = i0.ɵɵnextContext().$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("src", community_r7 == null ? null : community_r7.logo, i0.ɵɵsanitizeUrl);
} }
function JournalPostComponent_ng_container_0_div_16_div_1_Template(rf, ctx) { if (rf & 1) {
    const _r11 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 35);
    i0.ɵɵtemplate(1, JournalPostComponent_ng_container_0_div_16_div_1_figure_1_Template, 2, 1, "figure", 36);
    i0.ɵɵelementStart(2, "div", 37);
    i0.ɵɵelementStart(3, "div", 38);
    i0.ɵɵtext(4);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(5, "a", 39);
    i0.ɵɵlistener("click", function JournalPostComponent_ng_container_0_div_16_div_1_Template_a_click_5_listener() { i0.ɵɵrestoreView(_r11); const community_r7 = ctx.$implicit; const ctx_r10 = i0.ɵɵnextContext(3); return ctx_r10.onRemoveSelectedCommunity(community_r7); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const community_r7 = ctx.$implicit;
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", community_r7 == null ? null : community_r7.logo);
    i0.ɵɵadvance(3);
    i0.ɵɵtextInterpolate1("", (community_r7 == null ? null : community_r7.name) || "", " ");
} }
function JournalPostComponent_ng_container_0_div_16_a_2_Template(rf, ctx) { if (rf & 1) {
    const _r13 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "a", 42);
    i0.ɵɵlistener("click", function JournalPostComponent_ng_container_0_div_16_a_2_Template_a_click_0_listener($event) { i0.ɵɵrestoreView(_r13); const ctx_r12 = i0.ɵɵnextContext(3); return ctx_r12.onToggleCommunityList($event); });
    i0.ɵɵelementStart(1, "span");
    i0.ɵɵtext(2);
    i0.ɵɵelementEnd();
    i0.ɵɵelement(3, "i", 43);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r6 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(2);
    i0.ɵɵtextInterpolate1("see ", (ctx_r6.journalPostForm.controls == null ? null : ctx_r6.journalPostForm.controls.communities == null ? null : ctx_r6.journalPostForm.controls.communities.value == null ? null : ctx_r6.journalPostForm.controls.communities.value.length) - ctx_r6.maxCommunityToShow, " more communities");
} }
function JournalPostComponent_ng_container_0_div_16_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 32);
    i0.ɵɵtemplate(1, JournalPostComponent_ng_container_0_div_16_div_1_Template, 6, 2, "div", 33);
    i0.ɵɵtemplate(2, JournalPostComponent_ng_container_0_div_16_a_2_Template, 4, 1, "a", 34);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r2 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r2.journalPostForm == null ? null : ctx_r2.journalPostForm.controls == null ? null : ctx_r2.journalPostForm.controls.communities == null ? null : ctx_r2.journalPostForm.controls.communities.value == null ? null : ctx_r2.journalPostForm.controls.communities.value.slice(0, 3));
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", (ctx_r2.journalPostForm.controls == null ? null : ctx_r2.journalPostForm.controls.communities == null ? null : ctx_r2.journalPostForm.controls.communities.value == null ? null : ctx_r2.journalPostForm.controls.communities.value.length) > ctx_r2.maxCommunityToShow);
} }
function JournalPostComponent_ng_container_0_ng_container_17_Template(rf, ctx) { if (rf & 1) {
    const _r15 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "ins-select", 44);
    i0.ɵɵlistener("addItem", function JournalPostComponent_ng_container_0_ng_container_17_Template_ins_select_addItem_1_listener($event) { i0.ɵɵrestoreView(_r15); const ctx_r14 = i0.ɵɵnextContext(2); return ctx_r14.onCommunitySelection($event); })("clickOutside", function JournalPostComponent_ng_container_0_ng_container_17_Template_ins_select_clickOutside_1_listener() { i0.ɵɵrestoreView(_r15); const ctx_r16 = i0.ɵɵnextContext(2); return ctx_r16.setShowCommunityList(false); })("close", function JournalPostComponent_ng_container_0_ng_container_17_Template_ins_select_close_1_listener() { i0.ɵɵrestoreView(_r15); const ctx_r17 = i0.ɵɵnextContext(2); return ctx_r17.onToggleCommunityList(); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r3 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("preSelectedItem", ctx_r3.journalPostForm.value == null ? null : ctx_r3.journalPostForm.value.communities)("list", ctx_r3.myCommunities)("isMultiSelect", true)("autoSelection", false)("emptyListText", ctx_r3.emptyCommunityListText)("showFilter", (ctx_r3.myCommunities == null ? null : ctx_r3.myCommunities.length) > ctx_r3.minCommunityToShowFilter);
} }
function JournalPostComponent_ng_container_0_div_33_div_1_Template(rf, ctx) { if (rf & 1) {
    const _r21 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementStart(0, "div", 47);
    i0.ɵɵlistener("click", function JournalPostComponent_ng_container_0_div_33_div_1_Template_div_click_0_listener() { i0.ɵɵrestoreView(_r21); const privacyOption_r19 = ctx.$implicit; const ctx_r20 = i0.ɵɵnextContext(3); return ctx_r20.onSelectPrivacyOption(privacyOption_r19); });
    i0.ɵɵtext(1);
    i0.ɵɵelementStart(2, "div", 48);
    i0.ɵɵtext(3);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const privacyOption_r19 = ctx.$implicit;
    const ctx_r18 = i0.ɵɵnextContext(3);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", privacyOption_r19 == null ? null : privacyOption_r19.description, " ");
    i0.ɵɵadvance(1);
    i0.ɵɵclassMap(ctx_r18.privacyStyle[privacyOption_r19 == null ? null : privacyOption_r19.value]);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate(privacyOption_r19 == null ? null : privacyOption_r19.label);
} }
function JournalPostComponent_ng_container_0_div_33_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "div", 45);
    i0.ɵɵtemplate(1, JournalPostComponent_ng_container_0_div_33_div_1_Template, 4, 4, "div", 46);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r4 = i0.ɵɵnextContext(2);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngForOf", ctx_r4.privacyOptions);
} }
function JournalPostComponent_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    const _r23 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0, 2);
    i0.ɵɵelementStart(1, "div", 3);
    i0.ɵɵelementStart(2, "div", 4);
    i0.ɵɵelementStart(3, "div", 5);
    i0.ɵɵlistener("click", function JournalPostComponent_ng_container_0_Template_div_click_3_listener() { i0.ɵɵrestoreView(_r23); const ctx_r22 = i0.ɵɵnextContext(); return ctx_r22.onBackClick(); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(4, "h1", 6);
    i0.ɵɵtext(5);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(6, "form", 7);
    i0.ɵɵlistener("ngSubmit", function JournalPostComponent_ng_container_0_Template_form_ngSubmit_6_listener() { i0.ɵɵrestoreView(_r23); const ctx_r24 = i0.ɵɵnextContext(); return ctx_r24.onPublishPost(); });
    i0.ɵɵelement(7, "input", 8);
    i0.ɵɵelementStart(8, "div", 9);
    i0.ɵɵelement(9, "ins-rte", 10);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(10, "div", 11);
    i0.ɵɵelementStart(11, "div", 12);
    i0.ɵɵelementStart(12, "a", 13);
    i0.ɵɵlistener("click", function JournalPostComponent_ng_container_0_Template_a_click_12_listener($event) { i0.ɵɵrestoreView(_r23); const ctx_r25 = i0.ɵɵnextContext(); return ctx_r25.onToggleCommunityList($event); });
    i0.ɵɵelement(13, "i", 14);
    i0.ɵɵelementStart(14, "span", 15);
    i0.ɵɵtext(15, "Community");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(16, JournalPostComponent_ng_container_0_div_16_Template, 3, 2, "div", 16);
    i0.ɵɵtemplate(17, JournalPostComponent_ng_container_0_ng_container_17_Template, 2, 6, "ng-container", 1);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(18, "div", 17);
    i0.ɵɵelementStart(19, "ins-add-media", 18);
    i0.ɵɵlistener("setAttachedMedia", function JournalPostComponent_ng_container_0_Template_ins_add_media_setAttachedMedia_19_listener($event) { i0.ɵɵrestoreView(_r23); const ctx_r26 = i0.ɵɵnextContext(); return ctx_r26.setAttachedMedia($event); })("updateMediaMetaData", function JournalPostComponent_ng_container_0_Template_ins_add_media_updateMediaMetaData_19_listener($event) { i0.ɵɵrestoreView(_r23); const ctx_r27 = i0.ɵɵnextContext(); return ctx_r27.onUpdateMediaMetaData($event); })("uploadFile", function JournalPostComponent_ng_container_0_Template_ins_add_media_uploadFile_19_listener($event) { i0.ɵɵrestoreView(_r23); const ctx_r28 = i0.ɵɵnextContext(); return ctx_r28.onUpload($event); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(20, "div", 19);
    i0.ɵɵelement(21, "i", 20);
    i0.ɵɵelementStart(22, "span", 15);
    i0.ɵɵtext(23, "Allow Comments");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(24, "div", 21);
    i0.ɵɵelement(25, "input", 22);
    i0.ɵɵelement(26, "label", 23);
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(27, "div", 24);
    i0.ɵɵlistener("clickOutside", function JournalPostComponent_ng_container_0_Template_div_clickOutside_27_listener() { i0.ɵɵrestoreView(_r23); const ctx_r29 = i0.ɵɵnextContext(); return ctx_r29.showPrivacyOption = false; })("click", function JournalPostComponent_ng_container_0_Template_div_click_27_listener() { i0.ɵɵrestoreView(_r23); const ctx_r30 = i0.ɵɵnextContext(); return ctx_r30.onTogglePrivacyOption(); });
    i0.ɵɵelementStart(28, "div", 25);
    i0.ɵɵtext(29, " Privacy: ");
    i0.ɵɵelementStart(30, "span", 26);
    i0.ɵɵtext(31);
    i0.ɵɵelementEnd();
    i0.ɵɵelement(32, "i", 27);
    i0.ɵɵelementEnd();
    i0.ɵɵtemplate(33, JournalPostComponent_ng_container_0_div_33_Template, 2, 1, "div", 28);
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(34, "div", 29);
    i0.ɵɵelementStart(35, "button", 30);
    i0.ɵɵlistener("click", function JournalPostComponent_ng_container_0_Template_button_click_35_listener() { i0.ɵɵrestoreView(_r23); const ctx_r31 = i0.ɵɵnextContext(); return ctx_r31.togglePreview(); });
    i0.ɵɵtext(36, "Preview");
    i0.ɵɵelementEnd();
    i0.ɵɵelementStart(37, "button", 31);
    i0.ɵɵtext(38, "Publish");
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance(5);
    i0.ɵɵtextInterpolate(ctx_r0.title);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("formGroup", ctx_r0.journalPostForm);
    i0.ɵɵadvance(3);
    i0.ɵɵproperty("inputControl", ctx_r0.journalPostForm == null ? null : ctx_r0.journalPostForm.controls == null ? null : ctx_r0.journalPostForm.controls.body);
    i0.ɵɵadvance(7);
    i0.ɵɵproperty("ngIf", ctx_r0.journalPostForm.controls == null ? null : ctx_r0.journalPostForm.controls.communities == null ? null : ctx_r0.journalPostForm.controls.communities.value == null ? null : ctx_r0.journalPostForm.controls.communities.value.length);
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("ngIf", ctx_r0.showCommunityList);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("media", ctx_r0.photos)("attachedMedia", ctx_r0.journalPostForm == null ? null : ctx_r0.journalPostForm.controls == null ? null : ctx_r0.journalPostForm.controls.photos == null ? null : ctx_r0.journalPostForm.controls.photos.value)("isMobile", ctx_r0.isMobile);
    i0.ɵɵadvance(11);
    i0.ɵɵclassMap(ctx_r0.privacyStyle[ctx_r0.journalPostForm == null ? null : ctx_r0.journalPostForm.controls == null ? null : ctx_r0.journalPostForm.controls.privacy == null ? null : ctx_r0.journalPostForm.controls.privacy.value]);
    i0.ɵɵadvance(1);
    i0.ɵɵtextInterpolate1(" ", ctx_r0.selectedPrivacyLabel, " ");
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r0.showPrivacyOption);
    i0.ɵɵadvance(4);
    i0.ɵɵproperty("disabled", !(ctx_r0.journalPostForm == null ? null : ctx_r0.journalPostForm.valid));
} }
function JournalPostComponent_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    const _r33 = i0.ɵɵgetCurrentView();
    i0.ɵɵelementContainerStart(0);
    i0.ɵɵelementStart(1, "ins-journal-preview", 49);
    i0.ɵɵlistener("editPost", function JournalPostComponent_ng_container_1_Template_ins_journal_preview_editPost_1_listener() { i0.ɵɵrestoreView(_r33); const ctx_r32 = i0.ɵɵnextContext(); return ctx_r32.togglePreview(); })("publishPost", function JournalPostComponent_ng_container_1_Template_ins_journal_preview_publishPost_1_listener() { i0.ɵɵrestoreView(_r33); const ctx_r34 = i0.ɵɵnextContext(); return ctx_r34.onPublishPost(); });
    i0.ɵɵelementEnd();
    i0.ɵɵelementContainerEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵadvance(1);
    i0.ɵɵproperty("postBody", ctx_r1.journalPostForm.controls == null ? null : ctx_r1.journalPostForm.controls.body == null ? null : ctx_r1.journalPostForm.controls.body.value)("authorName", ctx_r1.authorName)("authorAvatar", ctx_r1.authorAvatar)("postDate", ctx_r1.postDate)("postTitle", ctx_r1.journalPostForm.controls == null ? null : ctx_r1.journalPostForm.controls.title == null ? null : ctx_r1.journalPostForm.controls.title.value)("selectedCommunities", ctx_r1.journalPostForm.controls == null ? null : ctx_r1.journalPostForm.controls.communities == null ? null : ctx_r1.journalPostForm.controls.communities.value)("disablePublish", !(ctx_r1.journalPostForm == null ? null : ctx_r1.journalPostForm.valid))("photos", ctx_r1.journalPostForm.get("photos").value);
} }
export class JournalPostComponent {
    constructor() {
        this.backClick = new EventEmitter();
        this.publishPost = new EventEmitter();
        this.updatePhotoMetaData = new EventEmitter();
        this.uploadFile = new EventEmitter();
        this.myCommunities = [];
        this.title = JOURNAL_POST_TITLE;
        this.authorName = '';
        this.authorAvatar = '';
        this.photos = [];
        this.isMobile = false;
        this.defaultCommunityId = '';
        this.isPreview = false;
        this.showCommunityList = false;
        this.showPrivacyOption = false;
        this.selectedCommunities = [];
        this.privacyOptions = JOURNAL_POST_PRIVACY_OPTIONS;
        this.privacyStyle = JOURNAL_POST_PRIVACY_STYLE_CLASS;
        this.postDate = new Date();
        this.emptyCommunityListText = EMPTY_COMMUNITY_LIST_TEXT;
        this.maxCommunityToShow = MAX_COMMUNITY_TO_SHOW;
        this.minCommunityToShowFilter = MIN_COMMUNITY_TO_SHOW_FILTER;
    }
    initForm() {
        const defaultCommunity = this.getDefaultCommunity();
        this.journalPostForm = new FormGroup({
            title: new FormControl('', [Validators.required]),
            photos: new FormControl([]),
            body: new FormControl('', [Validators.required]),
            communities: new FormControl(defaultCommunity),
            privacy: new FormControl(this.privacyOptions[0].value, [Validators.required]),
            allowComment: new FormControl(true),
            postType: new FormControl(PostType.Journal),
            commentPolicy: new FormControl(CommentPolicy.Open),
        });
        this.allowCommentSubscription = this.journalPostForm.get('allowComment').valueChanges
            .subscribe((value) => this.onChangeAllowComment(value));
    }
    getDefaultCommunity() {
        return this.myCommunities.filter(community => community.name_id === this.defaultCommunityId);
    }
    ngOnInit() {
        this.tweakMyCommunities();
        this.initForm();
    }
    tweakMyCommunities() {
        this.myCommunities = this.myCommunities.map(x => { var _a; return (Object.assign(Object.assign({}, x), { logo: ((_a = x === null || x === void 0 ? void 0 : x.assets) === null || _a === void 0 ? void 0 : _a.logo_image) || '' })); });
    }
    onBackClick() {
        this.backClick.emit();
    }
    onPublishPost() {
        if (this.journalPostForm.valid) {
            this.publishPost.emit(this.journalPostForm.value);
        }
    }
    togglePreview() {
        this.isPreview = !this.isPreview;
    }
    onToggleCommunityList(event) {
        this.showCommunityList = !this.showCommunityList;
        if (event) {
            event.stopPropagation();
        }
    }
    setShowCommunityList(value) {
        this.showCommunityList = value;
    }
    onCommunitySelection(selectedCommunities) {
        this.journalPostForm.controls.communities.setValue(selectedCommunities);
    }
    onTogglePrivacyOption() {
        this.showPrivacyOption = !this.showPrivacyOption;
    }
    onSelectPrivacyOption(privacyOption) {
        this.journalPostForm.controls.privacy.setValue(privacyOption.value);
        this.showPrivacyOption = false;
    }
    setAttachedMedia(photos) {
        this.journalPostForm.controls.photos.setValue(photos);
    }
    get selectedPrivacyLabel() {
        const privacy = this.privacyOptions.find(privacy => privacy.value === this.journalPostForm.get('privacy').value);
        if (privacy) {
            return privacy.label;
        }
        return '';
    }
    onUpdateMediaMetaData(photos) {
        this.updatePhotoMetaData.emit(photos);
    }
    onUpload(files) {
        this.uploadFile.emit(files);
    }
    onChangeAllowComment(hasAllowComment) {
        const commentPolicyControl = this.journalPostForm.get('commentPolicy');
        commentPolicyControl.setValue(hasAllowComment ? CommentPolicy.Open : CommentPolicy.Closed);
    }
    ngOnDestroy() {
        if (this.allowCommentSubscription) {
            this.allowCommentSubscription.unsubscribe();
        }
    }
    onRemoveSelectedCommunity(selectedCommunity) {
        var _a, _b, _c, _d, _e;
        const filteredCommunities = (_c = (_b = (_a = this.journalPostForm.controls) === null || _a === void 0 ? void 0 : _a.communities) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.filter((community) => community.name_id !== selectedCommunity.name_id);
        (_e = (_d = this.journalPostForm.controls) === null || _d === void 0 ? void 0 : _d.communities) === null || _e === void 0 ? void 0 : _e.setValue(filteredCommunities);
    }
}
JournalPostComponent.ɵfac = function JournalPostComponent_Factory(t) { return new (t || JournalPostComponent)(); };
JournalPostComponent.ɵcmp = i0.ɵɵdefineComponent({ type: JournalPostComponent, selectors: [["ins-journal-post"]], inputs: { myCommunities: "myCommunities", title: "title", authorName: "authorName", authorAvatar: "authorAvatar", photos: "photos", isMobile: "isMobile", defaultCommunityId: "defaultCommunityId" }, outputs: { backClick: "backClick", publishPost: "publishPost", updatePhotoMetaData: "updatePhotoMetaData", uploadFile: "uploadFile" }, decls: 2, vars: 2, consts: [["class", "container", 4, "ngIf"], [4, "ngIf"], [1, "container"], [1, "create-journal-post"], [1, "cjp-head"], ["id", "go_back", 1, "cjp-back", "icn-arrow-left", 3, "click"], ["id", "journal_title", 1, "cjp-title"], [1, "cjp-body", 3, "formGroup", "ngSubmit"], ["type", "text", "placeholder", "What would you like to write about? Give your journal post a title.", "formControlName", "title", 1, "cjp-input"], [1, "cjp-editor"], [3, "inputControl"], [1, "cjp-settings"], [1, "cjp-communities"], ["id", "community-add", 1, "cjp-action", 3, "click"], [1, "icn-plus-o"], [1, "cjp-a-label"], ["class", "cjp-c-selected", 4, "ngIf"], [1, "cjp-media"], [3, "media", "attachedMedia", "isMobile", "setAttachedMedia", "updateMediaMetaData", "uploadFile"], ["id", "allow_comment", 1, "cjp-action", "cjp-comments"], [1, "icn-discussion"], [1, "toggle-switch-control"], ["id", "allowComment", "type", "checkbox", "formControlName", "allowComment", 1, "tsc-input"], ["for", "allowComment", 1, "tsc-bttn"], [1, "cjp-privacy", 3, "clickOutside", "click"], [1, "cjp-p-btn"], [1, "cjp-p-selected"], [1, "icn-arrow-down", "cjp-p-arrow"], ["class", "cjp-p-menu", 4, "ngIf"], [1, "cjp-foot"], ["type", "button", "id", "preview_post", 1, "btn-preview", 3, "click"], ["type", "submit", 1, "btn-publish", 3, "disabled"], [1, "cjp-c-selected"], ["class", "avatar-block", "id", "selected_community", 4, "ngFor", "ngForOf"], ["class", "cjp-c-action", "id", "toggle_see_more_community", 3, "click", 4, "ngIf"], ["id", "selected_community", 1, "avatar-block"], ["class", "ab-fig", 4, "ngIf"], [1, "ab-meta"], ["id", "selected_community_name", 1, "ab-label"], ["id", "remove_selected_community", 1, "icn-cross-o", "ab-close", 3, "click"], [1, "ab-fig"], ["alt", "", 3, "src"], ["id", "toggle_see_more_community", 1, "cjp-c-action", 3, "click"], [1, "icn-edit"], ["id", "group_id", "text", "name", "uniqueProp", "group_id", "selectClass", "bright-blue", "placeholder", "Search Communities", "itemThumbnail", "logo", "addButtonText", "Done", "title", "Select Communities:", 3, "preSelectedItem", "list", "isMultiSelect", "autoSelection", "emptyListText", "showFilter", "addItem", "clickOutside", "close"], [1, "cjp-p-menu"], ["class", "cjp-p-item", "id", "privacy_option", 3, "click", 4, "ngFor", "ngForOf"], ["id", "privacy_option", 1, "cjp-p-item", 3, "click"], [1, "cjp-p-option"], [3, "postBody", "authorName", "authorAvatar", "postDate", "postTitle", "selectedCommunities", "disablePublish", "photos", "editPost", "publishPost"]], template: function JournalPostComponent_Template(rf, ctx) { if (rf & 1) {
        i0.ɵɵtemplate(0, JournalPostComponent_ng_container_0_Template, 39, 13, "ng-container", 0);
        i0.ɵɵtemplate(1, JournalPostComponent_ng_container_1_Template, 2, 8, "ng-container", 1);
    } if (rf & 2) {
        i0.ɵɵproperty("ngIf", !ctx.isPreview);
        i0.ɵɵadvance(1);
        i0.ɵɵproperty("ngIf", ctx.isPreview);
    } }, directives: [i1.NgIf, i2.ɵangular_packages_forms_forms_y, i2.NgControlStatusGroup, i2.FormGroupDirective, i2.DefaultValueAccessor, i2.NgControlStatus, i2.FormControlName, i3.RteComponent, i4.AddMediaComponent, i2.CheckboxControlValueAccessor, i5.ClickOutsideDirective, i1.NgForOf, i6.SelectComponent, i7.JournalPreviewComponent], styles: ["a[_ngcontent-%COMP%]{text-decoration:none}*[_ngcontent-%COMP%]{font-family:Lato,sans-serif;outline:0}@font-face{font-family:ins-icons;src:url(/assets/fonts/icons/ins-icons.ttf?nf14g1) format(\"truetype\"),url(/assets/fonts/icons/ins-icons.woff?nf14g1) format(\"woff\"),url(/assets/fonts/icons/ins-icons.svg?nf14g1#ins-icons) format(\"svg\");font-weight:400;font-style:normal;font-display:block}.ins-icon[_ngcontent-%COMP%], [class*=\" icn-\"][_ngcontent-%COMP%], [class^=icn-][_ngcontent-%COMP%]{font-family:ins-icons!important;speak:never;font-style:normal;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icn-minus-o[_ngcontent-%COMP%]:before{content:\"\\e93a\"}.icn-disclaimer[_ngcontent-%COMP%]:before{content:\"\\e934\"}.icn-leave-community[_ngcontent-%COMP%]:before{content:\"\\e935\"}.icn-stethoscope[_ngcontent-%COMP%]:before{content:\"\\e936\"}.icn-join-community[_ngcontent-%COMP%]:before{content:\"\\e937\"}.icn-resources[_ngcontent-%COMP%]:before{content:\"\\e938\"}.icn-help[_ngcontent-%COMP%]:before{content:\"\\e939\"}.icn-checked[_ngcontent-%COMP%]:before{content:\"\\e933\"}.icn-plus[_ngcontent-%COMP%]:before{content:\"\\e932\"}.icn-expand[_ngcontent-%COMP%]:before{content:\"\\e931\"}.icn-Invite[_ngcontent-%COMP%]:before{content:\"\\e930\"}.icn-report[_ngcontent-%COMP%]:before{content:\"\\e92f\"}.icn-unfollow[_ngcontent-%COMP%]:before{content:\"\\e92e\"}.icn-block[_ngcontent-%COMP%]:before{content:\"\\e92d\"}.icn-trash[_ngcontent-%COMP%]:before{content:\"\\e92b\"}.icn-follow[_ngcontent-%COMP%]:before{content:\"\\e92c\"}.icn-lock[_ngcontent-%COMP%]:before{content:\"\\e92a\"}.icn-bolt-left[_ngcontent-%COMP%]:before{content:\"\\e925\"}.icn-bolt-right[_ngcontent-%COMP%]:before{content:\"\\e926\"}.icn-bolt-down[_ngcontent-%COMP%]:before{content:\"\\e927\"}.icn-bolt-up[_ngcontent-%COMP%]:before{content:\"\\e928\"}.icn-img-o[_ngcontent-%COMP%]:before{content:\"\\e929\"}.icn-tick[_ngcontent-%COMP%]:before{content:\"\\e924\"}.icn-tick-o[_ngcontent-%COMP%]:before{content:\"\\e923\"}.icn-cross-o[_ngcontent-%COMP%]:before{content:\"\\e922\"}.icn-plus-o[_ngcontent-%COMP%]:before{content:\"\\e921\"}.icn-hide[_ngcontent-%COMP%]:before{content:\"\\e920\"}.icn-menu[_ngcontent-%COMP%]:before{content:\"\\e900\"}.icn-more[_ngcontent-%COMP%]:before{content:\"\\e901\"}.icn-msgs[_ngcontent-%COMP%]:before{content:\"\\e902\"}.icn-pin[_ngcontent-%COMP%]:before{content:\"\\e903\"}.icn-reply[_ngcontent-%COMP%]:before{content:\"\\e904\"}.icn-search[_ngcontent-%COMP%]:before{content:\"\\e905\"}.icn-settings[_ngcontent-%COMP%]:before{content:\"\\e906\"}.icn-treatment[_ngcontent-%COMP%]:before{content:\"\\e907\"}.icn-aid[_ngcontent-%COMP%]:before{content:\"\\e908\"}.icn-apple[_ngcontent-%COMP%]:before{content:\"\\e909\"}.icn-arrow-down[_ngcontent-%COMP%]:before{content:\"\\e90a\"}.icn-arrow-up[_ngcontent-%COMP%]:before{content:\"\\e91d\"}.icn-arrow-left[_ngcontent-%COMP%]:before{content:\"\\e91e\"}.icn-arrow-right[_ngcontent-%COMP%]:before{content:\"\\e91f\"}.icn-bell[_ngcontent-%COMP%]:before{content:\"\\e90b\"}.icn-bookmark-o[_ngcontent-%COMP%]:before{content:\"\\e90c\"}.icn-calendar[_ngcontent-%COMP%]:before{content:\"\\e90d\"}.icn-check[_ngcontent-%COMP%]:before{content:\"\\e90e\"}.icn-community[_ngcontent-%COMP%]:before{content:\"\\e90f\"}.icn-d-arrow-up[_ngcontent-%COMP%]:before{content:\"\\e910\"}.icn-discussion[_ngcontent-%COMP%]:before{content:\"\\e911\"}.icn-edit[_ngcontent-%COMP%]:before{content:\"\\e912\"}.icn-facebook[_ngcontent-%COMP%]:before{content:\"\\e913\"}.icn-filters[_ngcontent-%COMP%]:before{content:\"\\e914\"}.icn-friends[_ngcontent-%COMP%]:before{content:\"\\e915\"}.icn-google[_ngcontent-%COMP%]:before{content:\"\\e916\"}.icn-heart[_ngcontent-%COMP%]:before{content:\"\\e917\"}.icn-home[_ngcontent-%COMP%]:before{content:\"\\e918\"}.icn-img[_ngcontent-%COMP%]:before{content:\"\\e919\"}.icn-inspire[_ngcontent-%COMP%]:before{content:\"\\e91a\"}.icn-journal[_ngcontent-%COMP%]:before{content:\"\\e91b\"}.icn-like[_ngcontent-%COMP%]:before{content:\"\\e91c\"}.btn-preview[_ngcontent-%COMP%], .btn-publish[_ngcontent-%COMP%]{border:none;border-radius:.5rem;font-size:1rem;line-height:1;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;padding:0 1rem;height:2.25rem;transition:.3s ease-in-out}.btn-preview[_ngcontent-%COMP%]:hover, .btn-publish[_ngcontent-%COMP%]:hover{background:#f8f9fb}.btn-preview[disabled][_ngcontent-%COMP%], .btn-publish[disabled][_ngcontent-%COMP%]{background:#c6cbc9;color:#6e6f70;cursor:default}.btn-publish[_ngcontent-%COMP%]{background:#009dfc;color:#fff}.btn-publish[_ngcontent-%COMP%]:not([disabled]):hover{background:#008de3}.btn-preview[_ngcontent-%COMP%]{background:#005cc9;color:#fff}.btn-preview[_ngcontent-%COMP%]:not([disabled]):hover{background:#0050b0}.tsc-input[_ngcontent-%COMP%]{display:none}.tsc-input[_ngcontent-%COMP%]:checked + .tsc-bttn[_ngcontent-%COMP%]:after{left:50%}.tsc-input[_ngcontent-%COMP%]:checked + .tsc-bttn[_ngcontent-%COMP%]{background:#005cc9}.tsc-bttn[_ngcontent-%COMP%]{outline:0;display:block;width:3.5rem;height:1.75rem;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:#f8f9fb;border-radius:1.25rem;padding:.125rem;transition:.4s;border:1px solid #e2e5e4}.tsc-bttn[_ngcontent-%COMP%]:after{position:relative;display:block;content:\"\";width:50%;height:100%;left:0;border-radius:1.75rem;background:#fff;transition:left .3s cubic-bezier(.175,.885,.32,1.275),padding .3s,margin .3s;box-shadow:0 0 0 1px rgba(0,0,0,.1),0 4px 0 rgba(0,0,0,.08)}.avatar-block[_ngcontent-%COMP%]{display:flex;align-items:center}.avatar-block[_ngcontent-%COMP%]   .ab-fig[_ngcontent-%COMP%]{margin:0 .75rem 0 0;flex:0 0 auto;position:relative;overflow:hidden;border:1px solid #e2e5e4;background:#fff}.avatar-block[_ngcontent-%COMP%]   .ab-fig[_ngcontent-%COMP%]   img[_ngcontent-%COMP%]{display:block;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;image-rendering:auto}.avatar-block[_ngcontent-%COMP%]   .ab-meta[_ngcontent-%COMP%]{flex:1 1 auto}.avatar-block[_ngcontent-%COMP%]   .ab-label[_ngcontent-%COMP%]{font-size:.875rem;color:#000;line-height:1.3}.avatar-block[_ngcontent-%COMP%]   .ab-stamp[_ngcontent-%COMP%]{flex:0 0 auto;font-size:.75rem;color:#e1e3e2;margin-left:.625rem}.pill-block[_ngcontent-%COMP%]{font-size:.875rem;color:#000;padding:.5rem 1.25rem;border-radius:3.125rem;background:#f8f9fb;display:inline-block}.cjp-p-arrow[_ngcontent-%COMP%]{margin-left:auto}.cjp-head[_ngcontent-%COMP%]{display:flex;align-items:center;margin-bottom:2.1875rem}.cjp-back[_ngcontent-%COMP%]{margin-right:1rem;font-size:1.375rem;margin-top:.25rem;cursor:pointer}.cjp-title[_ngcontent-%COMP%]{font-family:Palanquin,sans-serif;color:#000;font-size:1.6875rem;font-weight:500;margin:0}.cjp-input[_ngcontent-%COMP%]{border:1px solid #e2e5e4;border-radius:.625rem;height:3.75rem;font-size:1rem;padding:0 1rem;width:100%;outline:0}.cjp-input[_ngcontent-%COMP%]::-webkit-input-placeholder{color:#c6cbc9}.cjp-input[_ngcontent-%COMP%]:-moz-placeholder{color:#c6cbc9}.cjp-input[_ngcontent-%COMP%]::-moz-placeholder{color:#c6cbc9}.cjp-input[_ngcontent-%COMP%]:-ms-input-placeholder{color:#c6cbc9}.cjp-editor[_ngcontent-%COMP%]{margin-top:2.5rem;border-bottom:none}.cjp-settings[_ngcontent-%COMP%]{border:1px solid #e2e5e4;border-radius:0 0 .625rem .625rem;padding:1.875rem}[_nghost-%COMP%]     .cjp-action{font-size:.875rem;color:#000;display:flex;align-items:center}[_nghost-%COMP%]     .cjp-action [class^=icn-]{color:#005cc9;font-size:1.375rem;margin-right:.625rem;text-decoration:none!important}[_nghost-%COMP%]     .select-community-dropdown{position:absolute;left:0;top:30px;width:100%;z-index:1;box-shadow:0 .125rem .3125rem 0 rgba(208,208,208,.5)}[_nghost-%COMP%]     a{cursor:pointer}[_nghost-%COMP%]     a:hover .cjp-a-label{text-decoration:underline}.toggle-switch-control[_ngcontent-%COMP%]{margin-left:1.25rem}.cjp-foot[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:flex-end;margin-top:3.125rem}.cjp-communities[_ngcontent-%COMP%]{position:relative;display:flex;align-items:flex-start;min-height:1.875rem}@media (max-width:575px){.cjp-settings[_ngcontent-%COMP%]{padding:1rem}[_nghost-%COMP%]     .cjp-action{width:100%;margin-bottom:10px}.cjp-communities[_ngcontent-%COMP%]{flex-wrap:wrap}}.cjp-c-selected[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;flex:1 1 auto;margin-left:30px}@media (min-width:576px){.cjp-c-selected[_ngcontent-%COMP%]{margin-left:26px}}.cjp-c-action[_ngcontent-%COMP%]{color:#6e6f70;font-size:14px}.cjp-c-action[_ngcontent-%COMP%]   [class^=icn-][_ngcontent-%COMP%]{font-size:10px;margin-left:5px}.cjp-c-action[_ngcontent-%COMP%]:hover   span[_ngcontent-%COMP%]{text-decoration:underline}.cjp-comments[_ngcontent-%COMP%], .cjp-communities[_ngcontent-%COMP%], .cjp-media[_ngcontent-%COMP%]{margin-bottom:1.25rem}.avatar-block[_ngcontent-%COMP%]{background:#f8f9fb;border-radius:3.125rem;padding:3px 6px 3px 3px;margin-bottom:10px}.avatar-block[_ngcontent-%COMP%]   .ab-fig[_ngcontent-%COMP%]{width:1.5rem;height:1.5rem;border-radius:50%}.avatar-block[_ngcontent-%COMP%]   .ab-close[_ngcontent-%COMP%]{font-size:14px;margin-left:10px;opacity:.5;color:#000}.avatar-block[_ngcontent-%COMP%]   .ab-close[_ngcontent-%COMP%]:hover{opacity:1}.cjp-privacy[_ngcontent-%COMP%]{font-size:.875rem;position:relative}.cjp-p-btn[_ngcontent-%COMP%]{border:1px solid #e2e5e4;height:2.625rem;padding:0 1.25rem;display:flex;align-items:center;cursor:pointer}.cjp-p-menu[_ngcontent-%COMP%]{border:1px solid #e2e5e4;border-bottom:none;bottom:100%;left:0;width:100%;z-index:1;position:absolute;background:#fff;padding:5px 0;box-shadow:0 .125rem .3125rem 0 rgba(208,208,208,.5)}.cjp-p-item[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;padding:.625rem 1.25rem;cursor:pointer}.cjp-p-item[_ngcontent-%COMP%]:hover{background:#f8f9fb}@media (max-width:575px){.avatar-block[_ngcontent-%COMP%]{margin-left:0}.cjp-p-item[_ngcontent-%COMP%]{align-items:flex-start}}.cjp-p-option[_ngcontent-%COMP%], .cjp-p-selected[_ngcontent-%COMP%]{font-weight:700;flex:0 0 auto}.cjp-p-selected[_ngcontent-%COMP%]{margin-left:.3125rem}.cjp-p-member[_ngcontent-%COMP%]{color:#007a48}.cjp-p-friends[_ngcontent-%COMP%]{color:#943585}.cjp-p-public[_ngcontent-%COMP%]{color:#005cc9}.btn-publish[_ngcontent-%COMP%]{margin-left:1rem}.btn-preview[_ngcontent-%COMP%], .btn-publish[_ngcontent-%COMP%]{width:6.25rem}"] });
/*@__PURE__*/ (function () { i0.ɵsetClassMetadata(JournalPostComponent, [{
        type: Component,
        args: [{
                selector: 'ins-journal-post',
                templateUrl: './journal-post.component.html',
                styleUrls: ['./journal-post.component.scss']
            }]
    }], function () { return []; }, { backClick: [{
            type: Output
        }], publishPost: [{
            type: Output
        }], updatePhotoMetaData: [{
            type: Output
        }], uploadFile: [{
            type: Output
        }], myCommunities: [{
            type: Input
        }], title: [{
            type: Input
        }], authorName: [{
            type: Input
        }], authorAvatar: [{
            type: Input
        }], photos: [{
            type: Input
        }], isMobile: [{
            type: Input
        }], defaultCommunityId: [{
            type: Input
        }] }); })();
//# sourceMappingURL=data:application/json;base64, 