import * as i3$1 from '@angular/common';
import { DOCUMENT, CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Component, Inject, Injectable, EventEmitter, forwardRef, ViewEncapsulation, Input, HostBinding, Output, ViewChild, HostListener, SecurityContext, Attribute, ContentChild, NgModule } from '@angular/core';
import * as i2 from '@angular/forms';
import { NG_VALUE_ACCESSOR, FormsModule, ReactiveFormsModule } from '@angular/forms';
import * as i2$1 from '@angular/platform-browser';
import { aswEditorConfig } from '@asoftwareworld/form-builder-pro/api';
import { isDefined } from '@asoftwareworld/form-builder-pro/utils';
import * as i1 from '@angular/material/dialog';
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import * as i6$1 from '@asoftwareworld/form-builder-pro/common';
import { Icons, Constants, AswPipeModule, AswColorPickerModule } from '@asoftwareworld/form-builder-pro/common';
import * as i3 from '@angular/material/form-field';
import { MatFormFieldModule } from '@angular/material/form-field';
import * as i4 from '@angular/material/button';
import { MatButtonModule } from '@angular/material/button';
import * as i5 from '@angular/material/input';
import { MatInputModule } from '@angular/material/input';
import * as i6 from '@angular/material/tooltip';
import { MatTooltipModule } from '@angular/material/tooltip';
import * as i7 from '@angular/material/divider';
import { MatDividerModule } from '@angular/material/divider';
import * as i1$1 from '@angular/common/http';
import { AswTranslateModule } from '@asoftwareworld/form-builder-pro/core';

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */
class AswEditorDialog {
    dialogRef;
    data;
    icons = Icons;
    linkTo;
    constructor(dialogRef, data) {
        this.dialogRef = dialogRef;
        this.data = data;
    }
    ngOnInit() {
        this.linkTo = this.data.linkTo;
    }
    onNoClick() {
        this.dialogRef.close();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorDialog, deps: [{ token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswEditorDialog, selector: "asw-editor-dialog", ngImport: i0, template: "<div class=\"asw-dialog-header\">\r\n    <div class=\"asw-edit-row-dialog\">\r\n        <div class=\"asw-dialog-header clearfix\">\r\n            <div class=\"asw-dialog-about\">\r\n                <h1 mat-dialog-title class=\"asw-m-0\">Add Link</h1>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <button mat-icon-button (click)=\"onNoClick()\" aria-label=\"Close dialog\" class=\"asw-mt-2 asw-me-2\">\r\n        <div [innerHTML]=\"icons.close | aswSafeHtml\">add</div>\r\n    </button>\r\n</div>\r\n<mat-divider></mat-divider>\r\n<div mat-dialog-content class=\"mat-typography\">\r\n    <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n        <mat-label>Link to</mat-label>\r\n        <input matInput \r\n            type=\"text\"\r\n            placeholder=\"Link to\"\r\n            matTooltip=\"Link to\"\r\n            #input=\"ngModel\"\r\n            [(ngModel)]=\"linkTo\">\r\n    </mat-form-field>\r\n</div>\r\n<mat-divider></mat-divider>\r\n<div mat-dialog-actions align=\"end\">\r\n    <button id=\"no\"\r\n            type=\"button\"\r\n            class=\"asw-button asw-button-danger asw-mb-1 asw-me-2\"\r\n            (click)=\"onNoClick()\">\r\n        Cancel\r\n    </button>\r\n    <button type=\"button\"\r\n            id=\"yes\"\r\n            class=\"asw-button asw-button-primary asw-mb-1\"\r\n            [mat-dialog-close]=\"linkTo\"\r\n            cdkFocusInitial>\r\n        Ok\r\n    </button>\r\n</div>", dependencies: [{ kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl],      input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i7.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }, { kind: "pipe", type: i6$1.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorDialog, decorators: [{
            type: Component,
            args: [{ selector: 'asw-editor-dialog', template: "<div class=\"asw-dialog-header\">\r\n    <div class=\"asw-edit-row-dialog\">\r\n        <div class=\"asw-dialog-header clearfix\">\r\n            <div class=\"asw-dialog-about\">\r\n                <h1 mat-dialog-title class=\"asw-m-0\">Add Link</h1>\r\n            </div>\r\n        </div>\r\n    </div>\r\n    <button mat-icon-button (click)=\"onNoClick()\" aria-label=\"Close dialog\" class=\"asw-mt-2 asw-me-2\">\r\n        <div [innerHTML]=\"icons.close | aswSafeHtml\">add</div>\r\n    </button>\r\n</div>\r\n<mat-divider></mat-divider>\r\n<div mat-dialog-content class=\"mat-typography\">\r\n    <mat-form-field appearance=\"outline\" class=\"asw-width-100\">\r\n        <mat-label>Link to</mat-label>\r\n        <input matInput \r\n            type=\"text\"\r\n            placeholder=\"Link to\"\r\n            matTooltip=\"Link to\"\r\n            #input=\"ngModel\"\r\n            [(ngModel)]=\"linkTo\">\r\n    </mat-form-field>\r\n</div>\r\n<mat-divider></mat-divider>\r\n<div mat-dialog-actions align=\"end\">\r\n    <button id=\"no\"\r\n            type=\"button\"\r\n            class=\"asw-button asw-button-danger asw-mb-1 asw-me-2\"\r\n            (click)=\"onNoClick()\">\r\n        Cancel\r\n    </button>\r\n    <button type=\"button\"\r\n            id=\"yes\"\r\n            class=\"asw-button asw-button-primary asw-mb-1\"\r\n            [mat-dialog-close]=\"linkTo\"\r\n            cdkFocusInitial>\r\n        Ok\r\n    </button>\r\n</div>" }]
        }], ctorParameters: function () { return [{ type: i1.MatDialogRef }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [MAT_DIALOG_DATA]
                }] }]; } });

class AswEditorService {
    http;
    doc;
    savedSelection;
    selectedText;
    uploadUrl;
    uploadWithCredentials;
    constructor(http, doc) {
        this.http = http;
        this.doc = doc;
    }
    /**
     * Executed command from editor header buttons exclude toggleEditorMode
     * @param command string from triggerCommand
     */
    executeCommand(command, value) {
        const commands = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'pre'];
        if (commands.includes(command)) {
            this.doc.execCommand('formatBlock', false, command);
            return;
        }
        this.doc.execCommand(command, false, value);
    }
    /**
     * Create URL link
     * @param url string from UI prompt
     */
    createLink(url) {
        if (!url.includes('http')) {
            this.doc.execCommand('createlink', false, url);
        }
        else {
            const newUrl = `<a href='${url}' target='_blank'> ${this.selectedText} </a>`;
            this.insertHtml(newUrl);
        }
    }
    /**
     * insert color either font or background
     *
     * @param color color to be inserted
     * @param where where the color has to be inserted either text/background
     */
    insertColor(color, where) {
        const restored = this.restoreSelection();
        if (restored) {
            if (where === 'textColor') {
                this.doc.execCommand('foreColor', false, color);
            }
            else {
                this.doc.execCommand('hiliteColor', false, color);
            }
        }
    }
    /**
     * Set font name
     * @param fontName string
     */
    setFontName(fontName) {
        this.doc.execCommand('fontName', false, fontName);
    }
    /**
     * Set font size
     * @param fontSize string
     */
    setFontSize(fontSize) {
        this.doc.execCommand('fontSize', false, fontSize);
    }
    /**
     * Create raw HTML
     * @param html HTML string
     */
    insertHtml(html) {
        const isHTMLInserted = this.doc.execCommand('insertHTML', false, html);
        if (!isHTMLInserted) {
            throw new Error('Unable to perform the operation');
        }
    }
    /**
     * save selection when the editor is focussed out
     */
    saveSelection = () => {
        if (this.doc.getSelection) {
            const sel = this.doc.getSelection();
            if (sel.getRangeAt && sel.rangeCount) {
                this.savedSelection = sel.getRangeAt(0);
                this.selectedText = sel.toString();
            }
        }
        else if (this.doc.getSelection && this.doc.createRange) {
            this.savedSelection = document.createRange();
        }
        else {
            this.savedSelection = null;
        }
    };
    /**
     * restore selection when the editor is focused in
     *
     * saved selection when the editor is focused out
     */
    restoreSelection() {
        if (this.savedSelection) {
            if (this.doc.getSelection) {
                const sel = this.doc.getSelection();
                sel.removeAllRanges();
                sel.addRange(this.savedSelection);
                return true;
            }
            else if (this.doc.getSelection /*&& this.savedSelection.select*/) {
                // this.savedSelection.select();
                return true;
            }
            else {
                return false;
            }
        }
        else {
            return false;
        }
    }
    /**
     * setTimeout used for execute 'saveSelection' method in next event loop iteration
     */
    executeInNextQueueIteration(callbackFn, timeout = 1e2) {
        setTimeout(callbackFn, timeout);
    }
    /** check any selection is made or not */
    checkSelection() {
        const selectedText = this.savedSelection?.toString();
        if (selectedText?.length === 0) {
            throw new Error('No Selection Made');
        }
        return true;
    }
    /**
     * Upload file to uploadUrl
     * @param file The file
     */
    uploadImage(file) {
        const uploadData = new FormData();
        uploadData.append('file', file, file.name);
        return this.http.post(this.uploadUrl, uploadData, {
            reportProgress: true,
            observe: 'events',
            withCredentials: this.uploadWithCredentials
        });
    }
    /**
     * Insert image with Url
     * @param imageUrl The imageUrl.
     */
    insertImage(imageUrl) {
        this.doc.execCommand('insertImage', false, imageUrl);
    }
    setDefaultParagraphSeparator(separator) {
        this.doc.execCommand('defaultParagraphSeparator', false, separator);
    }
    createCustomClass(customClass) {
        let newTag = this.selectedText;
        if (customClass) {
            const tagName = customClass.tag ? customClass.tag : 'span';
            newTag = '<' + tagName + ' class="' + customClass.class + '">' + this.selectedText + '</' + tagName + '>';
        }
        this.insertHtml(newTag);
    }
    insertVideo(videoUrl) {
        if (videoUrl.match('www.youtube.com')) {
            this.insertYouTubeVideoTag(videoUrl);
        }
        if (videoUrl.match('vimeo.com')) {
            this.insertVimeoVideoTag(videoUrl);
        }
    }
    insertYouTubeVideoTag(videoUrl) {
        const id = videoUrl.split('v=')[1];
        const imageUrl = `https://img.youtube.com/vi/${id}/0.jpg`;
        const thumbnail = `
      <div style='position: relative'>
        <a href='${videoUrl}' target='_blank'>
          <img src="${imageUrl}" alt="click to watch"/>
          <img style='position: absolute; left:200px; top:140px'
          src="https://img.icons8.com/color/96/000000/youtube-play.png"/>
        </a>
      </div>`;
        this.insertHtml(thumbnail);
    }
    insertVimeoVideoTag(videoUrl) {
        const sub = this.http.get(`https://vimeo.com/api/oembed.json?url=${videoUrl}`).subscribe((data) => {
            const imageUrl = data.thumbnail_url_with_play_button;
            const thumbnail = `<div>
        <a href='${videoUrl}' target='_blank'>
          <img src="${imageUrl}" alt="${data.title}"/>
        </a>
      </div>`;
            this.insertHtml(thumbnail);
            sub.unsubscribe();
        });
    }
    nextNode(node) {
        if (node.hasChildNodes()) {
            return node.firstChild;
        }
        else {
            while (node && !node.nextSibling) {
                node = node.parentNode;
            }
            if (!node) {
                return null;
            }
            return node.nextSibling;
        }
    }
    getRangeSelectedNodes(range, includePartiallySelectedContainers) {
        let node = range.startContainer;
        const endNode = range.endContainer;
        let rangeNodes = [];
        // Special case for a range that is contained within a single node
        if (node === endNode) {
            rangeNodes = [node];
        }
        else {
            // Iterate nodes until we hit the end container
            while (node && node !== endNode) {
                rangeNodes.push((node = this.nextNode(node)));
            }
            // Add partially selected nodes at the start of the range
            node = range.startContainer;
            while (node && node !== range.commonAncestorContainer) {
                rangeNodes.unshift(node);
                node = node.parentNode;
            }
        }
        // Add ancestors of the range container, if required
        if (includePartiallySelectedContainers) {
            node = range.commonAncestorContainer;
            while (node) {
                rangeNodes.push(node);
                node = node.parentNode;
            }
        }
        return rangeNodes;
    }
    getSelectedNodes() {
        const nodes = [];
        if (this.doc.getSelection) {
            const sel = this.doc.getSelection();
            for (let i = 0, len = sel.rangeCount; i < len; ++i) {
                nodes.push.apply(nodes, this.getRangeSelectedNodes(sel.getRangeAt(i), true));
            }
        }
        return nodes;
    }
    replaceWithOwnChildren(el) {
        const parent = el.parentNode;
        while (el.hasChildNodes()) {
            parent.insertBefore(el.firstChild, el);
        }
        parent.removeChild(el);
    }
    removeSelectedElements(tagNames) {
        const tagNamesArray = tagNames.toLowerCase().split(',');
        this.getSelectedNodes().forEach((node) => {
            if (node.nodeType === 1 && tagNamesArray.indexOf(node.tagName.toLowerCase()) > -1) {
                // Remove the node and replace it with its children
                this.replaceWithOwnChildren(node);
            }
        });
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorService, deps: [{ token: i1$1.HttpClient }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
    static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorService });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorService, decorators: [{
            type: Injectable
        }], ctorParameters: function () { return [{ type: i1$1.HttpClient }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }]; } });

class AswEditorSelect {
    elRef;
    r;
    options = [];
    // tslint:disable-next-line:no-input-rename
    isHidden;
    selectedOption;
    disabled = false;
    optionId = 0;
    get label() {
        return this.selectedOption && this.selectedOption.hasOwnProperty('label') ? this.selectedOption.label : 'Select';
    }
    opened = false;
    get value() {
        return this.selectedOption.value;
    }
    hidden = 'inline-block';
    changeEvent = new EventEmitter();
    labelButton;
    constructor(elRef, r) {
        this.elRef = elRef;
        this.r = r;
    }
    ngOnInit() {
        this.selectedOption = this.options[0];
        if (isDefined(this.isHidden) && this.isHidden) {
            this.hide();
        }
    }
    hide() {
        this.hidden = 'none';
    }
    optionSelect(option, event) {
        event.stopPropagation();
        this.setValue(option.value);
        this.onChange(this.selectedOption.value);
        this.changeEvent.emit(this.selectedOption.value);
        this.onTouched();
        this.opened = false;
    }
    toggleOpen(event) {
        // event.stopPropagation();
        if (this.disabled) {
            return;
        }
        this.opened = !this.opened;
    }
    onClick($event) {
        if (!this.elRef.nativeElement.contains($event.target)) {
            this.close();
        }
    }
    close() {
        this.opened = false;
    }
    get isOpen() {
        return this.opened;
    }
    writeValue(value) {
        if (!value || typeof value !== 'string') {
            return;
        }
        this.setValue(value);
    }
    setValue(value) {
        let index = 0;
        const selectedEl = this.options.find((el, i) => {
            index = i;
            return el.value === value;
        });
        if (selectedEl) {
            this.selectedOption = selectedEl;
            this.optionId = index;
        }
    }
    onChange = () => { };
    onTouched = () => { };
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    setDisabledState(isDisabled) {
        this.labelButton.nativeElement.disabled = isDisabled;
        const div = this.labelButton.nativeElement;
        const action = isDisabled ? 'addClass' : 'removeClass';
        this.r[action](div, 'disabled');
        this.disabled = isDisabled;
    }
    handleKeyDown($event) {
        if (!this.opened) {
            return;
        }
        // console.log($event.key);
        // if (KeyCode[$event.key]) {
        switch ($event.key) {
            case 'ArrowDown':
                this._handleArrowDown();
                break;
            case 'ArrowUp':
                this._handleArrowUp();
                break;
            case 'Space':
                this._handleSpace();
                break;
            case 'Enter':
                this._handleEnter($event);
                break;
            case 'Tab':
                this._handleTab();
                break;
            case 'Escape':
                this.close();
                $event.preventDefault();
                break;
            case 'Backspace':
                this._handleBackspace();
                break;
        }
        // } else if ($event.key && $event.key.length === 1) {
        // this._keyPress$.next($event.key.toLocaleLowerCase());
        // }
    }
    _handleArrowDown() {
        if (this.optionId < this.options.length - 1) {
            this.optionId++;
        }
    }
    _handleArrowUp() {
        if (this.optionId >= 1) {
            this.optionId--;
        }
    }
    _handleSpace() { }
    _handleEnter($event) {
        this.optionSelect(this.options[this.optionId], $event);
    }
    _handleTab() { }
    _handleBackspace() { }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorSelect, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswEditorSelect, selector: "asw-editor-select", inputs: { options: "options", isHidden: ["hidden", "isHidden"] }, outputs: { changeEvent: "change" }, host: { listeners: { "document:click": "onClick($event)", "keydown": "handleKeyDown($event)" }, properties: { "style.display": "this.hidden" } }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => AswEditorSelect),
                multi: true
            }
        ], viewQueries: [{ propertyName: "labelButton", first: true, predicate: ["labelButton"], descendants: true, static: true }], ngImport: i0, template: "<span class=\"asw-font asw-picker\" [ngClass]=\"{'asw-expanded':isOpen}\">\r\n    <button [tabIndex]=\"-1\" #labelButton tabindex=\"0\" type=\"button\" role=\"button\" class=\"asw-picker-label\" matTooltip=\"{{label}}\"\r\n        (click)=\"toggleOpen($event);\">{{label}}\r\n        <svg viewBox=\"0 0 18 18\">\r\n            <polygon class=\"asw-stroke\" points=\"7 11 9 13 11 11 7 11\"></polygon>\r\n            <polygon class=\"asw-stroke\" points=\"7 7 9 5 11 7 7 7\"></polygon>\r\n        </svg>\r\n    </button>\r\n    <span class=\"asw-picker-options\">\r\n        <button tabindex=\"-1\" type=\"button\" role=\"button\" class=\"asw-picker-item\"\r\n            *ngFor=\"let item of options; let i = index\"\r\n            [ngClass]=\"{'selected': item.value === value, 'focused': i === optionId}\"\r\n            (click)=\"optionSelect(item, $event)\">\r\n            {{item.label}}\r\n        </button>\r\n        <span class=\"dropdown-item\" *ngIf=\"!options.length\">No items for select</span>\r\n    </span>\r\n</span>", styles: [".asw-font.asw-picker{color:#1a73e8;display:inline-block;width:100%;position:relative;vertical-align:middle}.asw-font .asw-picker-label{cursor:pointer;display:inline-block;height:100%;padding-left:8px;padding-right:10px;position:relative;width:100%;line-height:26px;vertical-align:middle;font-size:100%;text-align:left;background-color:#fff;min-width:2rem;float:left;border:1px solid #ddd;text-overflow:clip;overflow:hidden;white-space:nowrap;min-height:2.4rem;color:#1a73e8;background-color:#e8f0fe}.asw-font .asw-picker-label:before{content:\"\";position:absolute;right:0;top:0;width:20px;height:100%}.asw-font .asw-picker-label:focus{outline:none}.asw-font .asw-picker-label:hover{cursor:pointer;background-color:#e8f0fe;transition:.2s ease}.asw-font .asw-picker-label:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.asw-font .asw-picker-label:disabled:before{background:linear-gradient(to right,#f5f5f5 100%,#ffffff 100%)}.asw-font .asw-picker-label svg{position:absolute;margin-top:-9px;right:0;top:50%;width:18px}.asw-font .asw-picker-label svg:not(:root){overflow:hidden}.asw-font .asw-picker-label svg .asw-stroke{fill:none;stroke:#1a73e8;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.asw-font .asw-picker-options{background-color:#fff;display:none;min-width:100%;position:absolute;white-space:nowrap;z-index:3;border:1px solid transparent;box-shadow:#0003 0 2px 8px}.asw-font .asw-picker-options .asw-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px;padding-left:5px;z-index:3;text-align:left;background-color:transparent;min-width:2rem;width:100%;border:0 solid #ddd}.asw-font .asw-picker-options .asw-picker-item.selected{color:#1a73e8;background-color:#e8f0fe}.asw-font.asw-expanded{display:block;margin-top:-1px;z-index:1}.asw-font.asw-expanded .asw-picker-label{color:#1a73e8;z-index:2}.asw-font.asw-expanded .asw-picker-label svg{color:#1a73e8;z-index:2}.asw-font.asw-expanded .asw-picker-label svg .asw-stroke{stroke:#1a73e8}.asw-font.asw-expanded .asw-picker-options{display:block;margin-top:-1px;top:100%;z-index:3;border-color:#ccc}\n"], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }], encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorSelect, decorators: [{
            type: Component,
            args: [{ selector: 'asw-editor-select', encapsulation: ViewEncapsulation.None, providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => AswEditorSelect),
                            multi: true
                        }
                    ], template: "<span class=\"asw-font asw-picker\" [ngClass]=\"{'asw-expanded':isOpen}\">\r\n    <button [tabIndex]=\"-1\" #labelButton tabindex=\"0\" type=\"button\" role=\"button\" class=\"asw-picker-label\" matTooltip=\"{{label}}\"\r\n        (click)=\"toggleOpen($event);\">{{label}}\r\n        <svg viewBox=\"0 0 18 18\">\r\n            <polygon class=\"asw-stroke\" points=\"7 11 9 13 11 11 7 11\"></polygon>\r\n            <polygon class=\"asw-stroke\" points=\"7 7 9 5 11 7 7 7\"></polygon>\r\n        </svg>\r\n    </button>\r\n    <span class=\"asw-picker-options\">\r\n        <button tabindex=\"-1\" type=\"button\" role=\"button\" class=\"asw-picker-item\"\r\n            *ngFor=\"let item of options; let i = index\"\r\n            [ngClass]=\"{'selected': item.value === value, 'focused': i === optionId}\"\r\n            (click)=\"optionSelect(item, $event)\">\r\n            {{item.label}}\r\n        </button>\r\n        <span class=\"dropdown-item\" *ngIf=\"!options.length\">No items for select</span>\r\n    </span>\r\n</span>", styles: [".asw-font.asw-picker{color:#1a73e8;display:inline-block;width:100%;position:relative;vertical-align:middle}.asw-font .asw-picker-label{cursor:pointer;display:inline-block;height:100%;padding-left:8px;padding-right:10px;position:relative;width:100%;line-height:26px;vertical-align:middle;font-size:100%;text-align:left;background-color:#fff;min-width:2rem;float:left;border:1px solid #ddd;text-overflow:clip;overflow:hidden;white-space:nowrap;min-height:2.4rem;color:#1a73e8;background-color:#e8f0fe}.asw-font .asw-picker-label:before{content:\"\";position:absolute;right:0;top:0;width:20px;height:100%}.asw-font .asw-picker-label:focus{outline:none}.asw-font .asw-picker-label:hover{cursor:pointer;background-color:#e8f0fe;transition:.2s ease}.asw-font .asw-picker-label:disabled{background-color:#f5f5f5;pointer-events:none;cursor:not-allowed}.asw-font .asw-picker-label:disabled:before{background:linear-gradient(to right,#f5f5f5 100%,#ffffff 100%)}.asw-font .asw-picker-label svg{position:absolute;margin-top:-9px;right:0;top:50%;width:18px}.asw-font .asw-picker-label svg:not(:root){overflow:hidden}.asw-font .asw-picker-label svg .asw-stroke{fill:none;stroke:#1a73e8;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}.asw-font .asw-picker-options{background-color:#fff;display:none;min-width:100%;position:absolute;white-space:nowrap;z-index:3;border:1px solid transparent;box-shadow:#0003 0 2px 8px}.asw-font .asw-picker-options .asw-picker-item{cursor:pointer;display:block;padding-bottom:5px;padding-top:5px;padding-left:5px;z-index:3;text-align:left;background-color:transparent;min-width:2rem;width:100%;border:0 solid #ddd}.asw-font .asw-picker-options .asw-picker-item.selected{color:#1a73e8;background-color:#e8f0fe}.asw-font.asw-expanded{display:block;margin-top:-1px;z-index:1}.asw-font.asw-expanded .asw-picker-label{color:#1a73e8;z-index:2}.asw-font.asw-expanded .asw-picker-label svg{color:#1a73e8;z-index:2}.asw-font.asw-expanded .asw-picker-label svg .asw-stroke{stroke:#1a73e8}.asw-font.asw-expanded .asw-picker-options{display:block;margin-top:-1px;top:100%;z-index:3;border-color:#ccc}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { options: [{
                type: Input
            }], isHidden: [{
                type: Input,
                args: ['hidden']
            }], hidden: [{
                type: HostBinding,
                args: ['style.display']
            }], changeEvent: [{
                type: Output,
                args: ['change']
            }], labelButton: [{
                type: ViewChild,
                args: ['labelButton', { static: true }]
            }], onClick: [{
                type: HostListener,
                args: ['document:click', ['$event']]
            }], handleKeyDown: [{
                type: HostListener,
                args: ['keydown', ['$event']]
            }] } });

class AswEditorToolbar {
    renderer;
    aswEditorService;
    doc;
    dialog;
    elementDOM;
    htmlMode = false;
    linkSelected = false;
    block = 'default';
    fontSize = '3';
    foreColour;
    backColor;
    icons = Icons;
    colorsName = [];
    constant = Constants;
    textColor = '#000105';
    backgroundColor = '#ffffff';
    selectedColor;
    show = false;
    headings = [
        {
            label: 'Heading 1',
            value: 'h1'
        },
        {
            label: 'Heading 2',
            value: 'h2'
        },
        {
            label: 'Heading 3',
            value: 'h3'
        },
        {
            label: 'Heading 4',
            value: 'h4'
        },
        {
            label: 'Heading 5',
            value: 'h5'
        },
        {
            label: 'Heading 6',
            value: 'h6'
        },
        {
            label: 'Heading 7',
            value: 'h7'
        },
        {
            label: 'Paragraph',
            value: 'p'
        },
        {
            label: 'Predefined',
            value: 'pre'
        },
        {
            label: 'Standard',
            value: 'div'
        },
        {
            label: 'default',
            value: 'default'
        }
    ];
    fontSizes = [
        {
            label: '1',
            value: '1'
        },
        {
            label: '2',
            value: '2'
        },
        {
            label: '3',
            value: '3'
        },
        {
            label: '4',
            value: '4'
        },
        {
            label: '5',
            value: '5'
        },
        {
            label: '6',
            value: '6'
        },
        {
            label: '7',
            value: '7'
        }
    ];
    customClassId = '-1';
    customClasses$ = [];
    customClassList = [{ label: '', value: '' }];
    // uploadUrl: string;
    tagMap = {
        BLOCKQUOTE: 'indent',
        A: 'link'
    };
    select = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'P', 'PRE', 'DIV'];
    buttons = ['bold', 'italic', 'underline', 'strikeThrough', 'subscript', 'superscript', 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull', 'indent', 'outdent', 'insertUnorderedList', 'insertOrderedList', 'link'];
    id;
    uploadUrl;
    upload;
    showToolbar;
    fonts = [{ label: '', value: '' }];
    set customClasses(classes) {
        if (classes) {
            this.customClasses$ = classes;
            this.customClassList = this.customClasses$.map((x, i) => ({ label: x.name, value: i.toString() }));
            this.customClassList.unshift({ label: 'Clear Class', value: '-1' });
        }
    }
    set defaultFontSize(value) {
        if (value) {
            this.fontSize = value;
        }
    }
    hiddenButtons;
    execute = new EventEmitter();
    myInputFile;
    get isLinkButtonDisabled() {
        return this.htmlMode || !Boolean(this.aswEditorService.selectedText);
    }
    constructor(renderer, aswEditorService, doc, dialog, elementDOM) {
        this.renderer = renderer;
        this.aswEditorService = aswEditorService;
        this.doc = doc;
        this.dialog = dialog;
        this.elementDOM = elementDOM;
    }
    ngOnInit() {
        this.colorsName = Object.keys(this.constant.colors);
    }
    /**
     * Trigger command from editor header buttons
     * @param command string from toolbar buttons
     */
    triggerCommand(command) {
        this.execute.emit(command);
    }
    /**
     * highlight editor buttons when cursor moved or positioning
     */
    triggerButtons() {
        if (!this.showToolbar) {
            return;
        }
        this.buttons.forEach((e) => {
            const result = this.doc.queryCommandState(e);
            const elementById = this.getChildById(e + '-' + this.id);
            if (result) {
                this.renderer.addClass(elementById, 'active');
            }
            else {
                this.renderer.removeClass(elementById, 'active');
            }
        });
    }
    getChildById(id) {
        return this.elementDOM.nativeElement.querySelector(`#${id}`);
    }
    /**
     * trigger highlight editor buttons when cursor moved or positioning in block
     */
    triggerBlocks(nodes) {
        if (!this.showToolbar) {
            return;
        }
        this.linkSelected = nodes.findIndex((x) => x.nodeName === 'A') > -1;
        let found = false;
        this.select.forEach((y) => {
            const node = nodes.find((x) => x.nodeName === y);
            if (node !== undefined && y === node.nodeName) {
                if (found === false) {
                    this.block = node.nodeName.toLowerCase();
                    found = true;
                }
            }
            else if (found === false) {
                this.block = 'default';
            }
        });
        found = false;
        if (this.customClasses$) {
            this.customClasses$.forEach((y, index) => {
                const node = nodes.find((x) => {
                    if (x instanceof Element) {
                        return x.className === y.class;
                    }
                });
                if (node !== undefined) {
                    if (found === false) {
                        this.customClassId = index.toString();
                        found = true;
                    }
                }
                else if (found === false) {
                    this.customClassId = '-1';
                }
            });
        }
        Object.keys(this.tagMap).map((e) => {
            const elementById = this.getChildById(this.tagMap[e] + '-' + this.id);
            const node = nodes.find((x) => x.nodeName === e);
            if (node !== undefined && e === node.nodeName) {
                this.renderer.addClass(elementById, 'active');
            }
            else {
                this.renderer.removeClass(elementById, 'active');
            }
        });
        this.foreColour = this.doc.queryCommandValue('ForeColor');
        this.fontSize = this.doc.queryCommandValue('FontSize');
        // this.fontName = this.doc.queryCommandValue('FontName').replace(/"/g, '');
        this.backColor = this.doc.queryCommandValue('backColor');
    }
    /**
     * insert URL link
     */
    insertUrl() {
        let url = 'https://';
        const selection = this.aswEditorService.savedSelection;
        if (selection && selection.commonAncestorContainer.parentElement?.nodeName === 'A') {
            const parent = selection.commonAncestorContainer.parentElement;
            if (parent.href !== '') {
                url = parent.href;
            }
        }
        const dialogRef = this.dialog.open(AswEditorDialog, {
            width: '450px',
            data: { linkTo: url }
        });
        dialogRef.afterClosed().subscribe((result) => {
            if (result !== undefined) {
                url = result;
                this.aswEditorService.createLink(url);
            }
        });
        // url = prompt('Insert URL link', url);
        // if (url && url !== '' && url !== 'https://') {
        //     this.aswEditorService.createLink(url);
        // }
    }
    /**
     * insert Video link
     */
    insertVideo() {
        this.execute.emit('');
        const dialogRef = this.dialog.open(AswEditorDialog, {
            width: '450px',
            data: { linkTo: `https://` }
        });
        dialogRef.afterClosed().subscribe((result) => {
            if (result !== undefined) {
                const url = result;
                if (url && url !== '' && url !== `https://`) {
                    this.aswEditorService.insertVideo(url);
                }
            }
        });
    }
    /** insert color */
    insertColor(color, where) {
        if (where === 'textColor') {
            this.textColor = color;
        }
        else {
            this.backgroundColor = color;
        }
        this.aswEditorService.insertColor(color, where);
        this.execute.emit('');
        this.show = false;
    }
    /**
     * Change status of visibility to color picker
     */
    toggleColors(where) {
        this.show = !this.show;
        this.selectedColor = where;
    }
    /**
     * Change color from input
     */
    setColor(data) {
        this.insertColor(data.colorCode, data.where);
    }
    /**
     * set font Name/family
     * @param foreColor string
     */
    setFontName(foreColor) {
        this.aswEditorService.setFontName(foreColor);
        this.execute.emit('');
    }
    /**
     * set font Size
     * @param fontSize string
     */
    setFontSize(fontSize) {
        this.aswEditorService.setFontSize(fontSize);
        this.execute.emit('');
    }
    /**
     * toggle editor mode (WYSIWYG or SOURCE)
     * @param m boolean
     */
    setEditorMode(m) {
        const toggleEditorModeButton = this.getChildById('toggleEditorMode' + '-' + this.id);
        if (m) {
            this.renderer.addClass(toggleEditorModeButton, 'active');
        }
        else {
            this.renderer.removeClass(toggleEditorModeButton, 'active');
        }
        this.htmlMode = m;
    }
    /**
     * Upload image when file is selected.
     */
    onFileChanged(event) {
        const file = event.target.files[0];
        if (file.type.includes('image/')) {
            if (this.upload) {
                this.upload(file).subscribe((response) => this.watchUploadImage(response, event));
            }
            else if (this.uploadUrl) {
                this.aswEditorService.uploadImage(file).subscribe((response) => this.watchUploadImage(response, event));
            }
            else {
                const reader = new FileReader();
                reader.onload = (e) => {
                    const fr = e.currentTarget;
                    if (fr.result) {
                        this.aswEditorService.insertImage(fr.result.toString());
                    }
                };
                reader.readAsDataURL(file);
            }
        }
    }
    watchUploadImage(response, event) {
        const { imageUrl } = response.body;
        this.aswEditorService.insertImage(imageUrl);
        event.srcElement.value = null;
    }
    /**
     * Set custom class
     */
    setCustomClass(classId) {
        if (classId === '-1') {
            this.execute.emit('clear');
        }
        else {
            this.aswEditorService.createCustomClass(this.customClasses$[+classId]);
        }
    }
    isButtonHidden(name) {
        if (!name) {
            return false;
        }
        if (!(this.hiddenButtons instanceof Array)) {
            return false;
        }
        let result;
        for (const arr of this.hiddenButtons) {
            if (arr instanceof Array) {
                result = arr.find((item) => item === name);
            }
            if (result) {
                break;
            }
        }
        return result !== undefined;
    }
    focus() {
        this.execute.emit('focus');
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorToolbar, deps: [{ token: i0.Renderer2 }, { token: AswEditorService }, { token: DOCUMENT }, { token: i1.MatDialog }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswEditorToolbar, selector: "asw-editor-toolbar", inputs: { id: "id", uploadUrl: "uploadUrl", upload: "upload", showToolbar: "showToolbar", fonts: "fonts", customClasses: "customClasses", defaultFontSize: "defaultFontSize", hiddenButtons: "hiddenButtons" }, outputs: { execute: "execute" }, viewQueries: [{ propertyName: "myInputFile", first: true, predicate: ["fileInput"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"asw-editor-toolbar\" *ngIf=\"showToolbar\">\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button type=\"button\" matTooltip=\"Undo (Ctrl+Z)\" class=\"asw-editor-button\" (click)=\"triggerCommand('undo')\"\r\n            [hidden]=\"isButtonHidden('undo')\" tabindex=\"-1\">\r\n            <div [innerHTML]=\"icons.undo | aswSafeHtml\"></div>\r\n        </button>\r\n        <button type=\"button\" matTooltip=\"Redo (Ctrl+Y)\" class=\"asw-editor-button\" (click)=\"triggerCommand('redo')\"\r\n            [hidden]=\"isButtonHidden('redo')\" tabindex=\"-1\">\r\n            <div [innerHTML]=\"icons.redo | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'bold-'+id\" type=\"button\" matTooltip=\"Bold (Ctrl+B)\" class=\"asw-editor-button\" (click)=\"triggerCommand('bold')\"\r\n            [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('bold')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.bold | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'italic-'+id\" type=\"button\" matTooltip=\"Italic (Ctrl+I)\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('italic')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('italic')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.italic | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'underline-'+id\" type=\"button\" matTooltip=\"Underline (Ctrl+U)\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('underline')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('underline')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.underline | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'strikeThrough-'+id\" type=\"button\" matTooltip=\"Strikethrough\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('strikeThrough')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('strikeThrough')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.strikeThrough | aswSafeHtml\"></div>\r\n        </button>\r\n        <!-- <button [id]=\"'subscript-'+id\" type=\"button\" matTooltip=\"Subscript\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('subscript')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('subscript')\"\r\n            tabindex=\"-1\">\r\n            <mat-icon [ngClass]=\"{'asw-icon-disabled': htmlMode }\">subscript</mat-icon>\r\n        </button>\r\n        <button [id]=\"'superscript-'+id\" type=\"button\" matTooltip=\"Superscript\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('superscript')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('superscript')\"\r\n            tabindex=\"-1\">\r\n            <mat-icon [ngClass]=\"{'asw-icon-disabled': htmlMode }\">superscript</mat-icon>\r\n        </button> -->\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'foregroundColorPicker-'+id\" type=\"button\" class=\"asw-editor-button\"\r\n            (click)=\"toggleColors('textColor')\" matTooltip=\"Text color\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('textColor')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatColorText | aswSafeHtml\"></div>\r\n        </button>\r\n        <ng-container *ngIf=\"show\">\r\n            <asw-color-picker [textColor]=\"textColor\"\r\n                [isEditor]=\"true\"\r\n                [backgroundColor]=\"backgroundColor\"\r\n                (colorChange)=\"setColor($event)\"></asw-color-picker>\r\n        </ng-container>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'alignLeft-'+id\" type=\"button\" matTooltip=\"Align left\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyLeft')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyLeft')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyLeft | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'alignCenter-'+id\" type=\"button\" matTooltip=\"Align center\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyCenter')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyCenter')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyCenter | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'alignRight-'+id\" type=\"button\" matTooltip=\"Align right\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyRight')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyRight')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyRight | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'justifyFull-'+id\" type=\"button\" matTooltip=\"Justify Full\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyFull')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyFull')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyFull | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'indent-'+id\" type=\"button\" matTooltip=\"Indent\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('indent')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('indent')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.indent | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'outdent-'+id\" type=\"button\" matTooltip=\"Outdent\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('outdent')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('outdent')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.outdent | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'insertUnorderedList-'+id\" type=\"button\" matTooltip=\"Unordered List\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('insertUnorderedList')\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('insertUnorderedList')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatListBulleted | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'insertOrderedList-'+id\" type=\"button\" matTooltip=\"Ordered List\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('insertOrderedList')\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('insertOrderedList')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatListNumbered | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-heading\" [options]=\"headings\" [(ngModel)]=\"block\"\r\n            (change)=\"triggerCommand(block)\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('heading')\" tabindex=\"-1\">\r\n        </asw-editor-select>\r\n    </div>\r\n    <!-- <div class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-font\" [options]=\"fonts\" [(ngModel)]=\"fontName\" (change)=\"setFontName(fontName)\"\r\n            [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('fontName')\" tabindex=\"-1\"></asw-editor-select>\r\n    </div> -->\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-font-size\" [options]=\"fontSizes\" [(ngModel)]=\"fontSize\"\r\n            (change)=\"setFontSize(fontSize)\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('fontSize')\" tabindex=\"-1\">\r\n        </asw-editor-select>\r\n    </div>\r\n    \r\n    <div *ngIf=\"customClasses$\" class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-custom-style\" [options]=\"customClassList\" [(ngModel)]=\"customClassId\"\r\n            (change)=\"setCustomClass(customClassId)\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('customClasses')\"\r\n            tabindex=\"-1\"></asw-editor-select>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'link-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"insertUrl()\" matTooltip=\"Insert Link\"\r\n            [disabled]=\"isLinkButtonDisabled\" [hidden]=\"isButtonHidden('link')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.link | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'unlink-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"triggerCommand('unlink')\"\r\n            matTooltip=\"Unlink\" [disabled]=\"htmlMode || !linkSelected\" [hidden]=\"isButtonHidden('unlink')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.unlink | aswSafeHtml\"></div>\r\n        </button>\r\n        <!-- ToDO: need to improve for image and video upload -->\r\n        <!-- <input style=\"display: none\" accept=\"image/*\" type=\"file\" (change)=\"onFileChanged($event)\" #fileInput>\r\n        <button [id]=\"'insertImage-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"focus(); fileInput.click()\"\r\n            matTooltip=\"Insert Image\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('insertImage')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.image | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'insertVideo-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"insertVideo()\"\r\n            matTooltip=\"Insert Video\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('insertVideo')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.videoCam | aswSafeHtml\"></div>\r\n        </button> -->\r\n        <button [id]=\"'insertHorizontalRule-'+id\" type=\"button\" matTooltip=\"Horizontal Line\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('insertHorizontalRule')\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('insertHorizontalRule')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.remove | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'clearFormatting-'+id\" type=\"button\" matTooltip=\"Remove formatting\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('removeFormat')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('removeFormat')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatClear | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'toggleEditorMode-'+id\" type=\"button\" matTooltip=\"HTML Code\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('toggleEditorMode')\" [hidden]=\"isButtonHidden('toggleEditorMode')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.code | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <ng-content></ng-content>\r\n</div>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i3$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i6$1.AswColorPicker, selector: "asw-color-picker", inputs: ["isEditor", "textColor", "backgroundColor"], outputs: ["colorChange"] }, { kind: "component", type: AswEditorSelect, selector: "asw-editor-select", inputs: ["options", "hidden"], outputs: ["change"] }, { kind: "pipe", type: i6$1.AswSafeHtmlPipe, name: "aswSafeHtml" }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorToolbar, decorators: [{
            type: Component,
            args: [{ selector: 'asw-editor-toolbar', template: "<div class=\"asw-editor-toolbar\" *ngIf=\"showToolbar\">\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button type=\"button\" matTooltip=\"Undo (Ctrl+Z)\" class=\"asw-editor-button\" (click)=\"triggerCommand('undo')\"\r\n            [hidden]=\"isButtonHidden('undo')\" tabindex=\"-1\">\r\n            <div [innerHTML]=\"icons.undo | aswSafeHtml\"></div>\r\n        </button>\r\n        <button type=\"button\" matTooltip=\"Redo (Ctrl+Y)\" class=\"asw-editor-button\" (click)=\"triggerCommand('redo')\"\r\n            [hidden]=\"isButtonHidden('redo')\" tabindex=\"-1\">\r\n            <div [innerHTML]=\"icons.redo | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'bold-'+id\" type=\"button\" matTooltip=\"Bold (Ctrl+B)\" class=\"asw-editor-button\" (click)=\"triggerCommand('bold')\"\r\n            [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('bold')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.bold | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'italic-'+id\" type=\"button\" matTooltip=\"Italic (Ctrl+I)\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('italic')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('italic')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.italic | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'underline-'+id\" type=\"button\" matTooltip=\"Underline (Ctrl+U)\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('underline')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('underline')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.underline | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'strikeThrough-'+id\" type=\"button\" matTooltip=\"Strikethrough\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('strikeThrough')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('strikeThrough')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.strikeThrough | aswSafeHtml\"></div>\r\n        </button>\r\n        <!-- <button [id]=\"'subscript-'+id\" type=\"button\" matTooltip=\"Subscript\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('subscript')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('subscript')\"\r\n            tabindex=\"-1\">\r\n            <mat-icon [ngClass]=\"{'asw-icon-disabled': htmlMode }\">subscript</mat-icon>\r\n        </button>\r\n        <button [id]=\"'superscript-'+id\" type=\"button\" matTooltip=\"Superscript\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('superscript')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('superscript')\"\r\n            tabindex=\"-1\">\r\n            <mat-icon [ngClass]=\"{'asw-icon-disabled': htmlMode }\">superscript</mat-icon>\r\n        </button> -->\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'foregroundColorPicker-'+id\" type=\"button\" class=\"asw-editor-button\"\r\n            (click)=\"toggleColors('textColor')\" matTooltip=\"Text color\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('textColor')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatColorText | aswSafeHtml\"></div>\r\n        </button>\r\n        <ng-container *ngIf=\"show\">\r\n            <asw-color-picker [textColor]=\"textColor\"\r\n                [isEditor]=\"true\"\r\n                [backgroundColor]=\"backgroundColor\"\r\n                (colorChange)=\"setColor($event)\"></asw-color-picker>\r\n        </ng-container>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'alignLeft-'+id\" type=\"button\" matTooltip=\"Align left\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyLeft')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyLeft')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyLeft | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'alignCenter-'+id\" type=\"button\" matTooltip=\"Align center\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyCenter')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyCenter')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyCenter | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'alignRight-'+id\" type=\"button\" matTooltip=\"Align right\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyRight')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyRight')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyRight | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'justifyFull-'+id\" type=\"button\" matTooltip=\"Justify Full\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('justifyFull')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('justifyFull')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.justifyFull | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'indent-'+id\" type=\"button\" matTooltip=\"Indent\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('indent')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('indent')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.indent | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'outdent-'+id\" type=\"button\" matTooltip=\"Outdent\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('outdent')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('outdent')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.outdent | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'insertUnorderedList-'+id\" type=\"button\" matTooltip=\"Unordered List\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('insertUnorderedList')\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('insertUnorderedList')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatListBulleted | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'insertOrderedList-'+id\" type=\"button\" matTooltip=\"Ordered List\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('insertOrderedList')\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('insertOrderedList')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatListNumbered | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-heading\" [options]=\"headings\" [(ngModel)]=\"block\"\r\n            (change)=\"triggerCommand(block)\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('heading')\" tabindex=\"-1\">\r\n        </asw-editor-select>\r\n    </div>\r\n    <!-- <div class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-font\" [options]=\"fonts\" [(ngModel)]=\"fontName\" (change)=\"setFontName(fontName)\"\r\n            [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('fontName')\" tabindex=\"-1\"></asw-editor-select>\r\n    </div> -->\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-font-size\" [options]=\"fontSizes\" [(ngModel)]=\"fontSize\"\r\n            (change)=\"setFontSize(fontSize)\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('fontSize')\" tabindex=\"-1\">\r\n        </asw-editor-select>\r\n    </div>\r\n    \r\n    <div *ngIf=\"customClasses$\" class=\"asw-editor-toolbar-set\">\r\n        <asw-editor-select class=\"select-custom-style\" [options]=\"customClassList\" [(ngModel)]=\"customClassId\"\r\n            (change)=\"setCustomClass(customClassId)\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('customClasses')\"\r\n            tabindex=\"-1\"></asw-editor-select>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'link-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"insertUrl()\" matTooltip=\"Insert Link\"\r\n            [disabled]=\"isLinkButtonDisabled\" [hidden]=\"isButtonHidden('link')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.link | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'unlink-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"triggerCommand('unlink')\"\r\n            matTooltip=\"Unlink\" [disabled]=\"htmlMode || !linkSelected\" [hidden]=\"isButtonHidden('unlink')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.unlink | aswSafeHtml\"></div>\r\n        </button>\r\n        <!-- ToDO: need to improve for image and video upload -->\r\n        <!-- <input style=\"display: none\" accept=\"image/*\" type=\"file\" (change)=\"onFileChanged($event)\" #fileInput>\r\n        <button [id]=\"'insertImage-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"focus(); fileInput.click()\"\r\n            matTooltip=\"Insert Image\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('insertImage')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.image | aswSafeHtml\"></div>\r\n        </button>\r\n        <button [id]=\"'insertVideo-'+id\" type=\"button\" class=\"asw-editor-button\" (click)=\"insertVideo()\"\r\n            matTooltip=\"Insert Video\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('insertVideo')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.videoCam | aswSafeHtml\"></div>\r\n        </button> -->\r\n        <button [id]=\"'insertHorizontalRule-'+id\" type=\"button\" matTooltip=\"Horizontal Line\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('insertHorizontalRule')\" [disabled]=\"htmlMode\"\r\n            [hidden]=\"isButtonHidden('insertHorizontalRule')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.remove | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'clearFormatting-'+id\" type=\"button\" matTooltip=\"Remove formatting\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('removeFormat')\" [disabled]=\"htmlMode\" [hidden]=\"isButtonHidden('removeFormat')\"\r\n            tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.formatClear | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <div class=\"asw-editor-toolbar-set\">\r\n        <button [id]=\"'toggleEditorMode-'+id\" type=\"button\" matTooltip=\"HTML Code\" class=\"asw-editor-button\"\r\n            (click)=\"triggerCommand('toggleEditorMode')\" [hidden]=\"isButtonHidden('toggleEditorMode')\" tabindex=\"-1\">\r\n            <div [ngClass]=\"{'asw-icon-disabled': htmlMode }\" [innerHTML]=\"icons.code | aswSafeHtml\"></div>\r\n        </button>\r\n    </div>\r\n    <ng-content></ng-content>\r\n</div>\r\n" }]
        }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: AswEditorService }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }, { type: i1.MatDialog }, { type: i0.ElementRef }]; }, propDecorators: { id: [{
                type: Input
            }], uploadUrl: [{
                type: Input
            }], upload: [{
                type: Input
            }], showToolbar: [{
                type: Input
            }], fonts: [{
                type: Input
            }], customClasses: [{
                type: Input
            }], defaultFontSize: [{
                type: Input
            }], hiddenButtons: [{
                type: Input
            }], execute: [{
                type: Output
            }], myInputFile: [{
                type: ViewChild,
                args: ['fileInput', { static: true }]
            }] } });

class AswEditor {
    renderer;
    aswEditorService;
    doc;
    sanitizer;
    cdRef;
    autoFocus;
    elementDOM;
    onChange;
    onTouched;
    modeVisual = true;
    showPlaceholder = false;
    disabled = false;
    focused = false;
    touched = false;
    changed = false;
    focusInstance;
    blurInstance;
    id = '';
    config = aswEditorConfig;
    placeholder = '';
    tabIndex;
    html;
    textArea;
    editorWrapper;
    editorToolbar;
    customButtonsTemplateRef;
    executeCommandFn = this.executeCommand.bind(this);
    viewMode = new EventEmitter();
    /** emits `blur` event when focused out from the textarea */
    blurEvent = new EventEmitter();
    /** emits `focus` event when focused in to the textarea */
    // eslint-disable-next-line @angular-eslint/no-output-rename, @angular-eslint/no-output-native
    focusEvent = new EventEmitter();
    tabindex = -1;
    onFocus() {
        this.focus();
    }
    constructor(renderer, aswEditorService, doc, sanitizer, cdRef, defaultTabIndex, autoFocus, elementDOM) {
        this.renderer = renderer;
        this.aswEditorService = aswEditorService;
        this.doc = doc;
        this.sanitizer = sanitizer;
        this.cdRef = cdRef;
        this.autoFocus = autoFocus;
        this.elementDOM = elementDOM;
        const parsedTabIndex = Number(defaultTabIndex);
        this.tabIndex = parsedTabIndex || parsedTabIndex === 0 ? parsedTabIndex : null;
    }
    ngOnInit() {
        this.config.toolbarPosition = this.config.toolbarPosition ? this.config.toolbarPosition : aswEditorConfig.toolbarPosition;
    }
    ngAfterViewInit() {
        if (isDefined(this.autoFocus)) {
            this.focus();
        }
    }
    onPaste(event) {
        if (this.config.rawPaste) {
            event.preventDefault();
            const text = event.clipboardData?.getData('text/plain');
            document.execCommand('insertHTML', false, text);
            return text;
        }
    }
    /**
     * Executed command from editor header buttons
     * @param command string from triggerCommand
     */
    executeCommand(command, value) {
        this.focus();
        if (command === 'focus') {
            return;
        }
        if (command === 'toggleEditorMode') {
            this.toggleEditorMode(this.modeVisual);
        }
        else if (command !== '') {
            if (command === 'clear') {
                this.aswEditorService.removeSelectedElements(this.getCustomTags());
                this.onContentChange(this.textArea.nativeElement);
            }
            else if (command === 'default') {
                this.aswEditorService.removeSelectedElements('h1,h2,h3,h4,h5,h6,p,pre');
                this.onContentChange(this.textArea.nativeElement);
            }
            else {
                this.aswEditorService.executeCommand(command, value);
            }
            this.exec();
        }
    }
    /**
     * focus event
     */
    onTextAreaFocus(event) {
        if (this.focused) {
            event.stopPropagation();
            return;
        }
        this.focused = true;
        this.focusEvent.emit(event);
        if (!this.touched || !this.changed) {
            this.aswEditorService.executeInNextQueueIteration(() => {
                this.configure();
                this.touched = true;
            });
        }
    }
    /**
     * @description fires when cursor leaves textarea
     */
    onTextAreaMouseOut(event) {
        this.aswEditorService.saveSelection();
    }
    /**
     * blur event
     */
    onTextAreaBlur(event) {
        /**
         * save selection if focussed out
         */
        this.aswEditorService.executeInNextQueueIteration(this.aswEditorService.saveSelection);
        if (typeof this.onTouched === 'function') {
            this.onTouched();
        }
        if (event.relatedTarget !== null) {
            const parent = event.relatedTarget.parentElement;
            if (parent?.classList.contains('asw-editor-toolbar-set') && parent.classList.contains('asw-picker')) {
                this.blurEvent.emit(event);
                this.focused = false;
            }
        }
    }
    /**
     *  focus the text area when the editor is focused
     */
    focus() {
        if (this.modeVisual) {
            this.textArea.nativeElement.focus();
        }
        else {
            const sourceText = this.getChildById('sourceText' + this.id);
            sourceText.focus();
            this.focused = true;
        }
    }
    /**
     * Executed from the contenteditable section while the input property changes
     * @param element html element from contenteditable
     */
    onContentChange(element) {
        element = element.target ? element.target : element;
        let html = '';
        if (this.modeVisual) {
            html = element.innerHTML;
        }
        else {
            html = element.innerText;
        }
        if (!html || html === '<br>') {
            html = '';
        }
        if (typeof this.onChange === 'function') {
            this.onChange(this.config.sanitize || this.config.sanitize === undefined ? this.sanitizer.sanitize(SecurityContext.HTML, html) : html);
            if (!html !== this.showPlaceholder) {
                this.togglePlaceholder(this.showPlaceholder);
            }
        }
        this.changed = true;
    }
    /**
     * Set the function to be called
     * when the control receives a change event.
     *
     * @param fn a function
     */
    registerOnChange(fn) {
        this.onChange = (e) => (e === '<br>' ? fn('') : fn(e));
    }
    /**
     * Set the function to be called
     * when the control receives a touch event.
     *
     * @param fn a function
     */
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    /**
     * Write a new value to the element.
     *
     * @param value value to be executed when there is a change in contenteditable
     */
    writeValue(value) {
        if ((!value || value === '<br>' || value === '') !== this.showPlaceholder) {
            this.togglePlaceholder(this.showPlaceholder);
        }
        if (value === undefined || value === '' || value === '<br>') {
            value = null;
        }
        this.refreshView(value);
    }
    /**
     * refresh view/HTML of the editor
     *
     * @param value html string from the editor
     */
    refreshView(value) {
        const normalizedValue = value === null ? '' : value;
        this.renderer.setProperty(this.textArea.nativeElement, 'innerHTML', normalizedValue);
        return;
    }
    /**
     * toggles placeholder based on input string
     *
     * @param value A HTML string from the editor
     */
    togglePlaceholder(value) {
        if (!value) {
            this.renderer.addClass(this.editorWrapper.nativeElement, 'show-placeholder');
            this.showPlaceholder = true;
        }
        else {
            this.renderer.removeClass(this.editorWrapper.nativeElement, 'show-placeholder');
            this.showPlaceholder = false;
        }
    }
    /**
     * Implements disabled state for this element
     *
     * @param isDisabled Disabled flag
     */
    setDisabledState(isDisabled) {
        const div = this.textArea.nativeElement;
        const action = isDisabled ? 'addClass' : 'removeClass';
        this.renderer[action](div, 'disabled');
        this.disabled = isDisabled;
    }
    /**
     * toggles editor mode based on bToSource bool
     *
     * @param bToSource A boolean value from the editor
     */
    toggleEditorMode(bToSource) {
        let oContent;
        const editableElement = this.textArea.nativeElement;
        if (bToSource) {
            oContent = this.renderer.createText(editableElement.innerHTML);
            this.renderer.setProperty(editableElement, 'innerHTML', '');
            this.renderer.setProperty(editableElement, 'contentEditable', false);
            const oPre = this.renderer.createElement('pre');
            this.renderer.setStyle(oPre, 'margin', '0');
            this.renderer.setStyle(oPre, 'outline', 'none');
            const oCode = this.renderer.createElement('code');
            this.renderer.setProperty(oCode, 'id', 'sourceText' + this.id);
            this.renderer.setStyle(oCode, 'display', 'block');
            this.renderer.setStyle(oCode, 'white-space', 'pre-wrap');
            this.renderer.setStyle(oCode, 'word-break', 'keep-all');
            this.renderer.setStyle(oCode, 'outline', 'none');
            this.renderer.setStyle(oCode, 'margin', '0');
            this.renderer.setStyle(oCode, 'background-color', '#e8f0fe');
            this.renderer.setProperty(oCode, 'contentEditable', true);
            this.renderer.appendChild(oCode, oContent);
            this.focusInstance = this.renderer.listen(oCode, 'focus', (event) => this.onTextAreaFocus(event));
            this.blurInstance = this.renderer.listen(oCode, 'blur', (event) => this.onTextAreaBlur(event));
            this.renderer.appendChild(oPre, oCode);
            this.renderer.appendChild(editableElement, oPre);
            // ToDo move to service
            this.doc.execCommand('defaultParagraphSeparator', false, 'div');
            this.modeVisual = false;
            this.viewMode.emit(false);
            oCode.focus();
        }
        else {
            if (this.doc.querySelectorAll) {
                this.renderer.setProperty(editableElement, 'innerHTML', editableElement.innerText);
            }
            else {
                oContent = this.doc.createRange();
                oContent.selectNodeContents(editableElement.firstChild);
                this.renderer.setProperty(editableElement, 'innerHTML', oContent.toString());
            }
            this.renderer.setProperty(editableElement, 'contentEditable', true);
            this.modeVisual = true;
            this.viewMode.emit(true);
            this.onContentChange(editableElement);
            editableElement.focus();
        }
        this.editorToolbar?.setEditorMode(!this.modeVisual);
    }
    /**
     * toggles editor buttons when cursor moved or positioning
     *
     * Send a node array from the contentEditable of the editor
     */
    exec() {
        this.editorToolbar?.triggerButtons();
        let userSelection;
        if (this.doc.getSelection) {
            userSelection = this.doc.getSelection();
            this.aswEditorService.executeInNextQueueIteration(this.aswEditorService.saveSelection);
        }
        let a = userSelection.focusNode;
        const els = [];
        while (a && a.id !== 'editor') {
            els.unshift(a);
            a = a.parentNode;
        }
        this.editorToolbar?.triggerBlocks(els);
    }
    configure() {
        this.aswEditorService.uploadUrl = this.config.uploadUrl;
        this.aswEditorService.uploadWithCredentials = this.config.uploadWithCredentials;
        if (this.config.defaultParagraphSeparator) {
            this.aswEditorService.setDefaultParagraphSeparator(this.config.defaultParagraphSeparator);
        }
        if (this.config.defaultFontName) {
            this.aswEditorService.setFontName(this.config.defaultFontName);
        }
        if (this.config.defaultFontSize) {
            this.aswEditorService.setFontSize(this.config.defaultFontSize);
        }
    }
    getCustomTags() {
        const tags = ['span'];
        this.config.customClasses?.forEach((x) => {
            if (x.tag !== undefined) {
                if (!tags.includes(x.tag)) {
                    tags.push(x.tag);
                }
            }
        });
        return tags.join(',');
    }
    ngOnDestroy() {
        if (this.blurInstance) {
            this.blurInstance();
        }
        if (this.focusInstance) {
            this.focusInstance();
        }
    }
    filterStyles(html) {
        html = html.replace('position: fixed;', '');
        return html;
    }
    getChildById(id) {
        return this.elementDOM.nativeElement.querySelector(`#${id}`);
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditor, deps: [{ token: i0.Renderer2 }, { token: AswEditorService }, { token: DOCUMENT }, { token: i2$1.DomSanitizer }, { token: i0.ChangeDetectorRef }, { token: 'tabindex', attribute: true }, { token: 'autofocus', attribute: true }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswEditor, selector: "asw-editor", inputs: { id: "id", config: "config", placeholder: "placeholder", tabIndex: "tabIndex" }, outputs: { html: "html", viewMode: "viewMode", blurEvent: "blur", focusEvent: "focus" }, host: { listeners: { "focus": "onFocus()" }, properties: { "attr.tabindex": "this.tabindex" } }, providers: [
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => AswEditor),
                multi: true
            }
        ], queries: [{ propertyName: "customButtonsTemplateRef", first: true, predicate: ["customButtons"], descendants: true }], viewQueries: [{ propertyName: "textArea", first: true, predicate: ["editor"], descendants: true, static: true }, { propertyName: "editorWrapper", first: true, predicate: ["editorWrapper"], descendants: true, static: true }, { propertyName: "editorToolbar", first: true, predicate: ["editorToolbar"], descendants: true }], ngImport: i0, template: "<div\r\n     class=\"asw-editor\"\r\n     #aswEditor\r\n     [style.width]=\"config.width\"\r\n     [style.minWidth]=\"config.minWidth\"\r\n>\r\n     <asw-editor-toolbar\r\n          *ngIf=\"config.toolbarPosition === 'top'\"\r\n          #editorToolbar\r\n          [id]=\"id\"\r\n          [uploadUrl]=\"config.uploadUrl\"\r\n          [upload]=\"config.upload\"\r\n          [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\r\n          [customClasses]=\"config.customClasses\"\r\n          [defaultFontSize]=\"config.defaultFontSize\"\r\n          [hiddenButtons]=\"config.toolbarHiddenButtons\"\r\n          (execute)=\"executeCommand($event)\"\r\n     >\r\n       <ng-container\r\n         [ngTemplateOutlet]=\"customButtonsTemplateRef\"\r\n         [ngTemplateOutletContext]=\"{ executeCommandFn: this.executeCommandFn}\"\r\n       >\r\n       </ng-container>\r\n     </asw-editor-toolbar>\r\n\r\n     <div\r\n          class=\"asw-editor-wrapper\"\r\n          #editorWrapper\r\n     >\r\n          <div\r\n               #editor\r\n               class=\"asw-editor-textarea\"\r\n               [attr.contenteditable]=\"config.editable\"\r\n               [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n               [attr.translate]=\"config.translate\"\r\n               [attr.spellcheck]=\"config.spellcheck\"\r\n               [style.height]=\"config.height\"\r\n               [style.minHeight]=\"config.minHeight\"\r\n               [style.maxHeight]=\"config.maxHeight\"\r\n               [style.outline]=\"config.outline === false ? 'none': undefined\"\r\n               (input)=\"onContentChange($event)\"\r\n               (focus)=\"onTextAreaFocus($event)\"\r\n               (blur)=\"onTextAreaBlur($event)\"\r\n               (click)=\"exec()\"\r\n               (keyup)=\"exec()\"\r\n               (mouseout)=\"onTextAreaMouseOut($event)\"\r\n               (paste)=\"onPaste($event)\"\r\n          >\r\n          </div>\r\n          <span class=\"asw-editor-placeholder\">{{ placeholder || config['placeholder'] }}</span>\r\n     </div>\r\n     <asw-editor-toolbar\r\n          *ngIf=\"config.toolbarPosition === 'bottom'\"\r\n          #editorToolbar\r\n          [id]=\"id\"\r\n          [uploadUrl]=\"config.uploadUrl\"\r\n          [upload]=\"config.upload\"\r\n          [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\r\n          [customClasses]=\"config.customClasses\"\r\n          [defaultFontSize]=\"config.defaultFontSize\"\r\n          [hiddenButtons]=\"config.toolbarHiddenButtons\"\r\n          (execute)=\"executeCommand($event)\"\r\n     ></asw-editor-toolbar>\r\n</div>", styles: [".asw-editor{position:relative}.asw-editor ::ng-deep [contenteditable=true]:empty:before{content:attr(placeholder);color:#868e96;opacity:1}.asw-editor .asw-editor-wrapper{position:relative}.asw-editor .asw-editor-wrapper .asw-editor-textarea{min-height:10rem;padding:.5rem .8rem 1rem;border:1px solid #ddd;background-color:transparent;overflow-x:hidden;overflow-y:auto;position:relative}.asw-editor .asw-editor-wrapper .asw-editor-textarea ::ng-deep blockquote{margin-left:1rem;border-left:.2em solid #dfe2e5;padding-left:.5rem}.asw-editor .asw-editor-wrapper ::ng-deep p{margin-bottom:0}.asw-editor .asw-editor-wrapper .asw-editor-placeholder{display:none;position:absolute;top:0;padding:.5rem .8rem 1rem .9rem;color:#6c757d;opacity:.75}.asw-editor .asw-editor-wrapper.show-placeholder .asw-editor-placeholder{display:block}.asw-editor .asw-editor-wrapper.disabled{cursor:not-allowed;opacity:.5;pointer-events:none}\n"], dependencies: [{ kind: "directive", type: i3$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: AswEditorToolbar, selector: "asw-editor-toolbar", inputs: ["id", "uploadUrl", "upload", "showToolbar", "fonts", "customClasses", "defaultFontSize", "hiddenButtons"], outputs: ["execute"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditor, decorators: [{
            type: Component,
            args: [{ selector: 'asw-editor', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => AswEditor),
                            multi: true
                        }
                    ], template: "<div\r\n     class=\"asw-editor\"\r\n     #aswEditor\r\n     [style.width]=\"config.width\"\r\n     [style.minWidth]=\"config.minWidth\"\r\n>\r\n     <asw-editor-toolbar\r\n          *ngIf=\"config.toolbarPosition === 'top'\"\r\n          #editorToolbar\r\n          [id]=\"id\"\r\n          [uploadUrl]=\"config.uploadUrl\"\r\n          [upload]=\"config.upload\"\r\n          [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\r\n          [customClasses]=\"config.customClasses\"\r\n          [defaultFontSize]=\"config.defaultFontSize\"\r\n          [hiddenButtons]=\"config.toolbarHiddenButtons\"\r\n          (execute)=\"executeCommand($event)\"\r\n     >\r\n       <ng-container\r\n         [ngTemplateOutlet]=\"customButtonsTemplateRef\"\r\n         [ngTemplateOutletContext]=\"{ executeCommandFn: this.executeCommandFn}\"\r\n       >\r\n       </ng-container>\r\n     </asw-editor-toolbar>\r\n\r\n     <div\r\n          class=\"asw-editor-wrapper\"\r\n          #editorWrapper\r\n     >\r\n          <div\r\n               #editor\r\n               class=\"asw-editor-textarea\"\r\n               [attr.contenteditable]=\"config.editable\"\r\n               [attr.tabindex]=\"disabled ? -1 : tabIndex\"\r\n               [attr.translate]=\"config.translate\"\r\n               [attr.spellcheck]=\"config.spellcheck\"\r\n               [style.height]=\"config.height\"\r\n               [style.minHeight]=\"config.minHeight\"\r\n               [style.maxHeight]=\"config.maxHeight\"\r\n               [style.outline]=\"config.outline === false ? 'none': undefined\"\r\n               (input)=\"onContentChange($event)\"\r\n               (focus)=\"onTextAreaFocus($event)\"\r\n               (blur)=\"onTextAreaBlur($event)\"\r\n               (click)=\"exec()\"\r\n               (keyup)=\"exec()\"\r\n               (mouseout)=\"onTextAreaMouseOut($event)\"\r\n               (paste)=\"onPaste($event)\"\r\n          >\r\n          </div>\r\n          <span class=\"asw-editor-placeholder\">{{ placeholder || config['placeholder'] }}</span>\r\n     </div>\r\n     <asw-editor-toolbar\r\n          *ngIf=\"config.toolbarPosition === 'bottom'\"\r\n          #editorToolbar\r\n          [id]=\"id\"\r\n          [uploadUrl]=\"config.uploadUrl\"\r\n          [upload]=\"config.upload\"\r\n          [showToolbar]=\"config.showToolbar !== undefined ? config.showToolbar : true\"\r\n          [customClasses]=\"config.customClasses\"\r\n          [defaultFontSize]=\"config.defaultFontSize\"\r\n          [hiddenButtons]=\"config.toolbarHiddenButtons\"\r\n          (execute)=\"executeCommand($event)\"\r\n     ></asw-editor-toolbar>\r\n</div>", styles: [".asw-editor{position:relative}.asw-editor ::ng-deep [contenteditable=true]:empty:before{content:attr(placeholder);color:#868e96;opacity:1}.asw-editor .asw-editor-wrapper{position:relative}.asw-editor .asw-editor-wrapper .asw-editor-textarea{min-height:10rem;padding:.5rem .8rem 1rem;border:1px solid #ddd;background-color:transparent;overflow-x:hidden;overflow-y:auto;position:relative}.asw-editor .asw-editor-wrapper .asw-editor-textarea ::ng-deep blockquote{margin-left:1rem;border-left:.2em solid #dfe2e5;padding-left:.5rem}.asw-editor .asw-editor-wrapper ::ng-deep p{margin-bottom:0}.asw-editor .asw-editor-wrapper .asw-editor-placeholder{display:none;position:absolute;top:0;padding:.5rem .8rem 1rem .9rem;color:#6c757d;opacity:.75}.asw-editor .asw-editor-wrapper.show-placeholder .asw-editor-placeholder{display:block}.asw-editor .asw-editor-wrapper.disabled{cursor:not-allowed;opacity:.5;pointer-events:none}\n"] }]
        }], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: AswEditorService }, { type: undefined, decorators: [{
                    type: Inject,
                    args: [DOCUMENT]
                }] }, { type: i2$1.DomSanitizer }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
                    type: Attribute,
                    args: ['tabindex']
                }] }, { type: undefined, decorators: [{
                    type: Attribute,
                    args: ['autofocus']
                }] }, { type: i0.ElementRef }]; }, propDecorators: { id: [{
                type: Input
            }], config: [{
                type: Input
            }], placeholder: [{
                type: Input
            }], tabIndex: [{
                type: Input
            }], html: [{
                type: Output
            }], textArea: [{
                type: ViewChild,
                args: ['editor', { static: true }]
            }], editorWrapper: [{
                type: ViewChild,
                args: ['editorWrapper', { static: true }]
            }], editorToolbar: [{
                type: ViewChild,
                args: ['editorToolbar']
            }], customButtonsTemplateRef: [{
                type: ContentChild,
                args: ['customButtons']
            }], viewMode: [{
                type: Output
            }], blurEvent: [{
                type: Output,
                args: ['blur']
            }], focusEvent: [{
                type: Output,
                args: ['focus']
            }], tabindex: [{
                type: HostBinding,
                args: ['attr.tabindex']
            }], onFocus: [{
                type: HostListener,
                args: ['focus']
            }] } });

class AswEditorButton {
    iconClass = '';
    title = '';
    buttonClick = new EventEmitter();
    constructor() { }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswEditorButton, selector: "asw-editor-button", inputs: { iconClass: "iconClass", title: "title" }, outputs: { buttonClick: "buttonClick" }, ngImport: i0, template: "<button type=\"button\" [title]=\"title\" class=\"asw-editor-button\" (click)=\"buttonClick.emit()\" tabindex=\"-1\">\r\n    <i [class]=\"iconClass\"></i>\r\n</button>", styles: [".select-button{display:inline-block}.select-button.disabled{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}\n"], encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorButton, decorators: [{
            type: Component,
            args: [{ selector: 'asw-editor-button', encapsulation: ViewEncapsulation.None, template: "<button type=\"button\" [title]=\"title\" class=\"asw-editor-button\" (click)=\"buttonClick.emit()\" tabindex=\"-1\">\r\n    <i [class]=\"iconClass\"></i>\r\n</button>", styles: [".select-button{display:inline-block}.select-button.disabled{cursor:pointer;background-color:#f1f1f1;transition:.2s ease}\n"] }]
        }], ctorParameters: function () { return []; }, propDecorators: { iconClass: [{
                type: Input
            }], title: [{
                type: Input
            }], buttonClick: [{
                type: Output
            }] } });

class AswEditorToolbarSet {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorToolbarSet, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.2", type: AswEditorToolbarSet, selector: "asw-editor-toolbar-set", ngImport: i0, template: "<div class=\"asw-editor-toolbar-set\">\r\n    <ng-content></ng-content>\r\n</div>", encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorToolbarSet, decorators: [{
            type: Component,
            args: [{ selector: 'asw-editor-toolbar-set', encapsulation: ViewEncapsulation.None, template: "<div class=\"asw-editor-toolbar-set\">\r\n    <ng-content></ng-content>\r\n</div>" }]
        }] });

class AswEditorModule {
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
    static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.2", ngImport: i0, type: AswEditorModule, declarations: [AswEditorButton, AswEditorSelect, AswEditorToolbarSet, AswEditorToolbar, AswEditor, AswEditorDialog], imports: [CommonModule, FormsModule, ReactiveFormsModule, MatDialogModule, MatFormFieldModule, MatButtonModule, MatInputModule, MatTooltipModule, AswPipeModule, AswTranslateModule, AswColorPickerModule, MatDividerModule], exports: [AswEditorButton, AswEditorSelect, AswEditorToolbarSet, AswEditorToolbar, AswEditor, AswEditorDialog] });
    static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorModule, providers: [AswEditorService], imports: [CommonModule, FormsModule, ReactiveFormsModule, MatDialogModule, MatFormFieldModule, MatButtonModule, MatInputModule, MatTooltipModule, AswPipeModule, AswTranslateModule, AswColorPickerModule, MatDividerModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.2", ngImport: i0, type: AswEditorModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, FormsModule, ReactiveFormsModule, MatDialogModule, MatFormFieldModule, MatButtonModule, MatInputModule, MatTooltipModule, AswPipeModule, AswTranslateModule, AswColorPickerModule, MatDividerModule],
                    declarations: [AswEditorButton, AswEditorSelect, AswEditorToolbarSet, AswEditorToolbar, AswEditor, AswEditorDialog],
                    exports: [AswEditorButton, AswEditorSelect, AswEditorToolbarSet, AswEditorToolbar, AswEditor, AswEditorDialog],
                    providers: [AswEditorService]
                }]
        }] });

/**
 * @license
 * Copyright ASW (A Software World) All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file
 */

/**
 * Generated bundle index. Do not edit.
 */

export { AswEditor, AswEditorButton, AswEditorDialog, AswEditorModule, AswEditorSelect, AswEditorService, AswEditorToolbar, AswEditorToolbarSet };
//# sourceMappingURL=asoftwareworld-form-builder-pro-editor.mjs.map
