import { InjectionToken, EventEmitter, Component, ChangeDetectionStrategy, NgZone, ChangeDetectorRef, Inject, Optional, ViewChild, Input, Output, ContentChild, NgModule } from '@angular/core';
import { QuillModule } from 'ngx-quill';
import { FormControl, Validators, NgForm, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { __classPrivateFieldSet, __classPrivateFieldGet } from 'tslib';
import { v4 } from 'uuid';
import { Subscription } from 'rxjs';
import 'quill-mention';
import { SdLabelDefDirective } from '@sd-angular/core/common';
import { CommonModule } from '@angular/common';
import { SdTranslateModule } from '@sd-angular/core/translate';
import { SdButtonModule } from '@sd-angular/core/button';
import { SdTextareaModule } from '@sd-angular/core/textarea';
import { SdApiModule } from '@sd-angular/core/api';

const EDITOR_CONFIG = new InjectionToken('editor.configuration');

const Constants = {
    ARE_YOU_WANT_TO_DELETE: 'Are you sure you want to delete?',
    ACTIVE: 'active',
    IN_ACTIVE: 'inactive',
    APPROVE: 'approve',
    UN_APPROVE: 'unapprove',
    ACCEPT_SIZE_IMAGE: 'Logo only accept image with size <= 2MB',
    ACCEPT_TYPE_IMAGE: 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon',
    PAGE_TYPE_NEW: 'new',
    PAGE_TYPE_EDIT: 'edit',
    SAVE: 'saveOb',
    SAVE_AND_CONTINUE: 'saveAndContOb',
    IMAGE_SIZE: 2048000,
    SUCCESS: 'Success',
    IMPORT_SUCCESSFULLY: 'Import successfully!',
    ERROR: 'Error',
    FAILED: 'fail',
    FILE: 'file',
    NONE: 'none',
    NOT_EXIST_ID_OR_LINK: 'This ID/Link is not existing',
    FEATURE_IS_PENDING: 'This feature is pending',
    NOT_SUPPORT_FILE_IMAGE: 'File upload is not supported.',
    NOT_SUPPORT_FILE_IMPORT: 'File import is not supported.',
    NETWORK_ERROR: 'Network Error',
    SORT_BY: [
        {
            value: 0,
            name: 'Created Date'
        },
        {
            value: 1,
            name: 'Title'
        }
    ],
    DESC: [
        {
            value: true,
            name: 'Descending'
        },
        {
            value: false,
            name: 'Ascending'
        }
    ],
    FORM_ERRORS: {
        Id: '',
        textSearch: '',
        ImportLogId: '',
        SortBy: '',
        Reverse: '',
    },
    VALIDATION_MESSAGES: {}
};
const PROMOTION_PERMISSIONS = ['ListPromotion', 'AddNewPromotion', 'EditPromotion',
    'ActiveOrInactivePromotion', 'RemovePromotion', 'ImportPromotion', 'ExportPromotion'];
const ValidateMessageConstants = {
    TITLE_REQUIRED: 'Title is required',
    TITLE_MAXLENGTH: 'Title is not more than 55 characters',
    TITLE_PATTERN: 'Title is required',
    CREATED_AT_REQUIRED: 'Created At is required',
    SHOW_ON_HOME_REQUIRED: 'Show On Home is required',
    DISPLAY_NUMBER_REQUIRED: 'Display Number is required',
    CONTENT_TYPE_REQUIRED: 'Content Type is required',
    DISCOUNT_PERCENT_REQUIRED: 'Discount percent is required',
    DISCOUNT_PERCENT_MAX: 'Max discount percent is 100, cannot input greater',
    DISCOUNT_PERCENT_MIN: 'Min discount percent is 0, cannot input lower'
};
const PROMOTION_FORM = {
    FORM_ERRORS: {
        title: '',
        createdAt: '',
        displayNumber: '',
        showOnHome: '',
        discountPercent: '',
        isActive: '',
        ctaLabelName: '',
        ctaDeepLink: '',
        tags: ''
    },
    VALIDATION_MESSAGES: {
        title: {
            required: ValidateMessageConstants.TITLE_REQUIRED,
            maxlength: ValidateMessageConstants.TITLE_MAXLENGTH,
            pattern: ValidateMessageConstants.TITLE_PATTERN
        },
        createdAt: {
            required: ValidateMessageConstants.CREATED_AT_REQUIRED
        },
        showOnHome: {
            required: ValidateMessageConstants.SHOW_ON_HOME_REQUIRED
        },
        displayNumber: {
            required: ValidateMessageConstants.DISPLAY_NUMBER_REQUIRED
        },
        discountPercent: {
            required: ValidateMessageConstants.DISCOUNT_PERCENT_REQUIRED,
            max: ValidateMessageConstants.DISCOUNT_PERCENT_MAX,
            min: ValidateMessageConstants.DISCOUNT_PERCENT_MIN
        },
        tags: {
            required: ValidateMessageConstants.CONTENT_TYPE_REQUIRED
        }
    }
};

var _name, _subscription, _model, _form, _updateValidator, _quill, _initUploadImage;
class SdEditor {
    constructor(ngZone, ref, configuration) {
        this.ngZone = ngZone;
        this.ref = ref;
        this.configuration = configuration;
        _name.set(this, `N${v4()}`);
        this.id = `I${v4()}`;
        _subscription.set(this, new Subscription());
        _model.set(this, void 0);
        this.required = false;
        this.modelChange = new EventEmitter();
        this.placeholder = '';
        this.styles = { height: '250px' };
        this.formControl = new FormControl();
        this.domain = '';
        _form.set(this, void 0);
        this.enableHTMLButton = false;
        this.showHtmlEditor = false;
        this.quillConfig = {
            // toolbar: '.toolbar',
            toolbar: {
                container: [
                    ['bold', 'italic', 'underline', 'strike'],
                    ['blockquote', 'code-block'],
                    [{ 'header': 1 }, { 'header': 2 }],
                    [{ 'list': 'ordered' }, { 'list': 'bullet' }],
                    [{ 'script': 'sub' }, { 'script': 'super' }],
                    [{ 'indent': '-1' }, { 'indent': '+1' }],
                    [{ 'direction': 'rtl' }],
                    [{ 'size': ['small', false, 'large', 'huge'] }],
                    [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
                    [{ 'color': [] }, { 'background': [] }],
                    [{ 'font': [] }],
                    [{ 'align': [] }],
                    ['clean'],
                    ['link', 'image', 'video'] // link and image, video
                ]
            },
            mention: {
                allowedChars: /^[A-Za-z0-9\sÅÄÖåäö._-]*$/,
                mentionDenotationChars: ['@', '#'],
                source: (searchTerm, renderList, mentionChar) => {
                    if ((this.mentionValues && mentionChar === '@') || (this.hashTagValues && mentionChar === '#')) {
                        let values;
                        if (mentionChar === '@') {
                            values = this.mentionValues;
                        }
                        else if (mentionChar === '#') {
                            values = this.hashTagValues;
                        }
                        else {
                            values = [];
                        }
                        if (searchTerm.length === 0) {
                            renderList(values, searchTerm);
                        }
                        else {
                            const matches = [];
                            // tslint:disable-next-line:prefer-for-of
                            for (let i = 0; i < values.length; i++) {
                                // tslint:disable-next-line:no-bitwise
                                if (~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase())) {
                                    matches.push(values[i]);
                                }
                            }
                            renderList(matches, searchTerm);
                        }
                    }
                },
            },
            keyboard: {
                bindings: {
                    enter: {
                        key: 13,
                        handler: (range, context) => {
                            return true;
                        }
                    }
                }
            }
        };
        this.sdChange = new EventEmitter();
        this.timerLoadQuillToolbar = null;
        _updateValidator.set(this, () => {
            this.formControl.clearValidators();
            this.formControl.clearAsyncValidators();
            const validators = [];
            if (this.required) {
                validators.push(Validators.required);
            }
            if (this.minlength > 0) {
                validators.push(Validators.minLength(this.minlength));
            }
            if (this.maxlength > 0) {
                validators.push(Validators.maxLength(this.maxlength));
            }
            this.formControl.setValidators(validators);
            this.formControl.updateValueAndValidity();
            this.ref.markForCheck();
        });
        _quill.set(this, void 0);
        this.editorInit = (quill) => {
            __classPrivateFieldSet(this, _quill, quill);
            this.quillEvent = quill;
            // const txtArea = document.createElement('textarea');
            // txtArea.style.cssText =
            //   'width: 100%;margin: 0px;background: rgb(29, 29, 29);' +
            //   'box-sizing: border-box;color: rgb(204, 204, 204);' +
            //   'font-size: 15px;outline: none;padding: 20px;' +
            //   'line-height: 24px;font-family: Consolas, Menlo, Monaco, &quot;Courier New&quot;, monospace;' +
            //   'position: absolute;top: 0;bottom: 0;border: none;display:none';
            // const htmlEditor = quill.addContainer('ql-custom');
            // htmlEditor.appendChild(txtArea);
            // const myEditor = quill.container;
            // quill.on('text-change', (delta, oldDelta, source) => {
            //   const html = myEditor.children[0].innerHTML;
            //   txtArea.value = html;
            //   // if (quill.getLength() > this.maxlength) {
            //   //   quill.deleteText(this.maxlength, quill.getLength());
            //   // }
            //   // this.formControl.setValue(html);
            // });
            const self = this;
            __classPrivateFieldGet(this, _initUploadImage).call(this, quill);
            // this.ngZone.runOutsideAngular(() => {
            //   quill.getModule('toolbar').addHandler('image', function () {
            //     let fileInput = this.container.querySelector('input.ql-image[type=file]');
            //     if (fileInput == null) {
            //       fileInput = document.createElement('input');
            //       fileInput.setAttribute('type', Constants.FILE);
            //       fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
            //       fileInput.classList.add('ql-image');
            //       fileInput.addEventListener('change', () => {
            //         const files = fileInput.files;
            //         const range = this.quill.getSelection(true);
            //         if (!files || !files.length) {
            //           return;
            //         }
            //         const formData = new FormData();
            //         formData.append(Constants.FILE, files[0]);
            //         this.quill.enable(false);
            //         self.#uploadImage(formData, quill, range, fileInput);
            //       });
            //       this.container.appendChild(fileInput);
            //     }
            //     fileInput.click();
            //   });
            // });
            this.ref.markForCheck();
        };
        _initUploadImage.set(this, (quill) => {
            const self = this;
            this.ngZone.runOutsideAngular(() => {
                quill.getModule('toolbar').addHandler('image', function () {
                    let fileInput = this.container.querySelector('input.ql-image[type=file]');
                    if (fileInput == null) {
                        fileInput = document.createElement('input');
                        fileInput.setAttribute('type', Constants.FILE);
                        fileInput.setAttribute('accept', '.jpg,.jpeg,.png');
                        fileInput.classList.add('ql-image');
                        fileInput.addEventListener('change', () => {
                            var _a;
                            const files = fileInput.files;
                            const range = this.quill.getSelection(true);
                            if (!files || !files.length) {
                                return;
                            }
                            const fileName = files[0].name;
                            const idxDot = fileName.lastIndexOf('.') + 1;
                            const extFile = fileName.substr(idxDot, fileName.length).toLowerCase();
                            if (extFile === 'jpg' || extFile === 'jpeg' || extFile === 'png') {
                                // TO DO
                            }
                            else {
                                alert('Vui lòng chọn file đúng định dạng cho phép');
                                return;
                            }
                            const formData = new FormData();
                            formData.append(Constants.FILE, files[0]);
                            this.quill.enable(false);
                            // self.#uploadImage(formData, quill, range, fileInput);
                            (_a = self.configuration) === null || _a === void 0 ? void 0 : _a.uploadImage(formData, self.args).then(url => {
                                self.ngZone.runOutsideAngular(() => {
                                    quill.enable(true);
                                    // quill.editor.insertEmbed(range.index, 'image', resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '');
                                    quill.getModule('clipboard').dangerouslyPasteHTML(range.index, '<a target="_blank" href="' + (url || '')
                                        + '"><img src="' + (url || '') + '" alt="c-image-editor-quill"></a>', 'user');
                                    // quill.insertText();
                                    const content = quill.getContents();
                                    quill.setContents(content);
                                    quill.setSelection(range.index + 1, 'user');
                                    fileInput.value = '';
                                });
                            });
                        });
                        this.container.appendChild(fileInput);
                    }
                    fileInput.click();
                });
            });
        });
        this.onModelChange = (val) => {
            this.formControl.setValue(val);
            this.modelHTML = val;
            this.ref.markForCheck();
        };
        this.onClickShowHtmlEditor = () => {
            this.showHtmlEditor = !this.showHtmlEditor;
            this.ref.markForCheck();
        };
    }
    set model(val) {
        __classPrivateFieldSet(this, _model, val);
        this.modelHTML = val;
        this.formControl.setValue(__classPrivateFieldGet(this, _model), {
            emitEvent: false
        });
        this.ref.detectChanges();
    }
    set disabled(val) {
        val = (val === '') || val;
        if (val) {
            this.formControl.disable();
        }
        else {
            this.formControl.enable();
        }
    }
    set pRequired(val) {
        this.required = (val === '') || val;
        __classPrivateFieldGet(this, _updateValidator).call(this);
    }
    set _minlength(val) {
        this.minlength = +val;
        __classPrivateFieldGet(this, _updateValidator).call(this);
    }
    set _maxlength(val) {
        this.maxlength = +val;
        __classPrivateFieldGet(this, _updateValidator).call(this);
    }
    set form(val) {
        if (val) {
            if (val instanceof NgForm) {
                __classPrivateFieldSet(this, _form, val.form);
            }
            else {
                __classPrivateFieldSet(this, _form, val);
            }
        }
    }
    ngOnInit() {
        var _a, _b;
        (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.addControl(__classPrivateFieldGet(this, _name), this.formControl);
        if (this.toolbar) {
            this.quillConfig.toolbar.container = this.toolbar;
        }
        for (const action of (((_b = this.configuration) === null || _b === void 0 ? void 0 : _b.actions) || [])) {
            if (this.quillConfig.toolbar.container.toString().includes(action.key)) {
                const qlKey = `button.ql-${action.key}`;
                const interval = setInterval(() => {
                    if (document.querySelector(qlKey)) {
                        clearInterval(interval);
                        document.querySelector(qlKey).innerHTML = action.icon;
                        const customAction = document.querySelector(qlKey);
                        if (customAction.getAttribute('listener') !== '1') {
                            customAction.setAttribute('listener', '1');
                            if (action.tooltip) {
                                customAction.setAttribute('title', action.tooltip);
                            }
                            customAction.addEventListener('click', (e) => {
                                const cursorPosition = localStorage.getItem('quillRange');
                                const element = e.currentTarget; // Lấy element của action được click
                                const toolbar = element.closest('.ql-formats').closest('.ql-toolbar'); // Lấy toolbar element
                                const id = toolbar.closest('quill-editor').id; // Lấy id của editor để phục vụ loading
                                const loadingId = `#box-${id}`; // id của editor;
                                action.click(e, {
                                    qlKey,
                                    element,
                                    loadingId,
                                    cursorPosition: JSON.parse(cursorPosition),
                                    quill: __classPrivateFieldGet(this, _quill),
                                    args: this.args
                                });
                            });
                        }
                    }
                }, 1000);
            }
        }
        // if (this.quillConfig.toolbar.container.toString().includes('customFile')) {
        //   this.timerLoadQuillToolbar = setInterval(() => {
        //     if (document.querySelector('button.ql-customFile')) {
        //       clearInterval(this.timerLoadQuillToolbar);
        //       document.querySelector('button.ql-customFile').innerHTML = this.customButtonFileSVG;
        //       const customButton = document.querySelector('button.ql-customFile');
        //       if (customButton.getAttribute('listener') !== '1') {
        //         customButton.setAttribute('listener', '1');
        //         customButton.addEventListener('click', this.customFileHandler);
        //       }
        //     }
        //   }, 1000);
        // }
        this.ref.markForCheck();
    }
    // customFileHandler = (e) => {
    //   const customButton = e.currentTarget;
    //   const quillToolbar = customButton.closest('.ql-formats').closest('.ql-toolbar');
    //   const quillBox = quillToolbar.closest('.ql-formats')
    //   let fileInput: HTMLInputElement = quillToolbar.querySelector('input.ql-customFile[type=file]');
    //   if (fileInput == null) {
    //     fileInput = document.createElement('input');
    //     fileInput.setAttribute('type', Constants.FILE);
    //     fileInput.setAttribute('accept', '*');
    //     fileInput.classList.add('ql-customFile');
    //     fileInput.addEventListener('change', () => {
    //       const files = fileInput.files;
    //       if (!files || !files.length) {
    //         return;
    //       }
    //       const formData = new FormData();
    //       formData.append(Constants.FILE, files[0]);
    //       let range = localStorage.getItem('quillRange');
    //       if (range) {
    //         range = JSON.parse(range);
    //       }
    //       this.quillEvent.enable(false);
    //       this.#uploadFile(formData, this.quillEvent, range, fileInput, quillToolbar.closest('quill-editor').id);
    //     });
    //     quillToolbar.appendChild(fileInput);
    //   }
    //   fileInput.click();
    // }
    ngAfterViewInit() {
        __classPrivateFieldGet(this, _subscription).add(this.formControl.valueChanges.subscribe((val) => {
            this.modelChange.emit(val);
            this.sdChange.emit(val);
        }));
    }
    ngOnDestroy() {
        var _a;
        (_a = __classPrivateFieldGet(this, _form)) === null || _a === void 0 ? void 0 : _a.removeControl(__classPrivateFieldGet(this, _name));
        __classPrivateFieldGet(this, _subscription).unsubscribe();
    }
    // #uploadImage = (formData, quill, range, fileInput) => {
    //   if (!this.urlUploadImage) {
    //     this.urlUploadImage = '/partner/v2/merchandise/file/uploaduserfile';
    //   }
    //   // this.domain = 'https://api-commerce-qc.vinid.dev';
    //   this.sdApiService.post(this.urlUploadImage, formData).then((resp: any) => {
    //     this.ngZone.runOutsideAngular(() => {
    //       quill.enable(true);
    //       // quill.editor.insertEmbed(range.index, 'image', resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '');
    //       quill.getModule('clipboard').dangerouslyPasteHTML(range.index, '<a target="_blank" href="' + (resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '')
    //         + '"><img src="' + (resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '') + '" alt="c-image-editor-quill"></a>', 'user');
    //       // quill.insertText();
    //       const content = quill.getContents();
    //       quill.setContents(content);
    //       quill.setSelection(range.index + 1, 'user');
    //       fileInput.value = '';
    //     });
    //   });
    //   this.ref.markForCheck();
    // }
    // #uploadFile = (formData, quill, range, fileInput, loadingID) => {
    //   if (!this.urlUploadFile) {
    //     this.urlUploadFile = '/partner/v2/merchandise/file/uploaduserfile';
    //   }
    //   // this.domain = 'https://api-commerce-qc.vinid.dev';
    //   this.loadingService.start('#box-' + loadingID);
    //   this.sdApiService.post(this.urlUploadFile, formData).then((resp: any) => {
    //     this.ngZone.runOutsideAngular(() => {
    //       quill.enable(true);
    //       // quill.editor.insertEmbed(range.index, 'image', resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '');
    //       quill.getModule('clipboard').dangerouslyPasteHTML(range.index, '<a target="_blank" href="' + (resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '')
    //         + '">' + (resp?.data?.imageUrl || resp?.data?.publish_url || resp?.url || '') + '</a>', 'user');
    //       // quill.insertText();
    //       const content = quill.getContents();
    //       quill.setContents(content);
    //       quill.setSelection(range.index + 1, 'user');
    //       fileInput.value = '';
    //     });
    //     this.loadingService.stop('#box-' + loadingID);
    //   }).catch((er) => {
    //     this.loadingService.stop('#box-' + loadingID);
    //   });
    //   this.ref.markForCheck();
    // }
    onSelectionChanged(e) {
        // localStorage.setItem('quillRange', e.range ? JSON.stringify(e.range) : (e.oldRange ? JSON.stringify(e.oldRange) : null));
        localStorage.setItem('quillRange', e.editor.getSelection() ? JSON.stringify(e.editor.getSelection()) : null);
    }
    onContentChanged(e) {
        localStorage.setItem('quillRange', JSON.stringify({
            index: (e.editor.getLength() ? e.editor.getLength() - 1 : 0),
            length: 0
        }));
    }
}
_name = new WeakMap(), _subscription = new WeakMap(), _model = new WeakMap(), _form = new WeakMap(), _updateValidator = new WeakMap(), _quill = new WeakMap(), _initUploadImage = new WeakMap();
SdEditor.decorators = [
    { type: Component, args: [{
                selector: 'sd-editor',
                template: "<div id=\"box-{{ id }}\">\r\n  <ng-container *ngIf=\"sdLabelDef?.templateRef\">\r\n    <ng-container *ngTemplateOutlet=\"sdLabelDef.templateRef\"> </ng-container>\r\n  </ng-container>\r\n  <label *ngIf=\"label && !sdLabelDef?.templateRef\" class=\"d-block T14M\"\r\n    >{{ label }} <span class=\"text-danger mb-2\" *ngIf=\"required\">*</span></label\r\n  >\r\n  <ng-container *ngIf=\"!formControl.disabled && !showHtmlEditor\">\r\n    <quill-editor\r\n      #editor\r\n      [styles]=\"styles\"\r\n      (onEditorCreated)=\"editorInit($event)\"\r\n      [ngModel]=\"formControl.value\"\r\n      (onSelectionChanged)=\"onSelectionChanged($event)\"\r\n      (onContentChanged)=\"onContentChanged($event)\"\r\n      (ngModelChange)=\"onModelChange($event)\"\r\n      [id]=\"id\"\r\n      [modules]=\"quillConfig\"\r\n      [placeholder]=\"placeholder\"\r\n      [maxLength]=\"maxlength\">\r\n    </quill-editor>\r\n    <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.required\">\r\n      {{ 'This field is required' | sdTranslate }}\r\n    </span>\r\n    <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.minlength\">\r\n      {{ 'Max length' | sdTranslate }} <strong>{{ minlength }}</strong>\r\n    </span>\r\n    <span class=\"d-block text-danger mt-5\" *ngIf=\"formControl.errors?.maxlength\">\r\n      {{ 'Max length' | sdTranslate }} <strong>{{ maxlength }}</strong>\r\n    </span>\r\n  </ng-container>\r\n  <ng-container *ngIf=\"formControl.disabled\">\r\n    <div [innerHtml]=\"formControl.value\"></div>\r\n  </ng-container>\r\n  <ng-container *ngIf=\"enableHTMLButton\">\r\n    <sd-textarea [(model)]=\"modelHTML\" *ngIf=\"showHtmlEditor\" rows=\"20\" (modelChange)=\"onModelChange($event)\"></sd-textarea>\r\n    <sd-button\r\n      title=\"{{ showHtmlEditor ? '\u1EA8n' : 'Hi\u1EC7n' }} m\u00E3 HTML\"\r\n      class=\"mr-8\"\r\n      fontSet=\"material-icons-outlined\"\r\n      (action)=\"onClickShowHtmlEditor()\"\r\n      type=\"light\"></sd-button>\r\n  </ng-container>\r\n</div>\r\n",
                changeDetection: ChangeDetectionStrategy.OnPush,
                styles: ["::ng-deep .c-image-editor-quill-box{background:#000;display:inline-block;position:relative}::ng-deep .c-image-editor-quill-box:hover:after{background:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAA7EAAAOxAGVKw4bAAACoklEQVRIia2WzUtVURTF1748RCQkHIhEiIiINJAGDqMcRYRNQgqiSCKoUUVE/0FIQ2lYJtGgQUhUUA36IIIggkD6HgU6iJz0IZpmrl+Dd67c7nv6hNqTe+5dZ++19zr7bG6oZEAmqU/SQUk7JHVLqgCzEfFK0i1JjyNisezb0Gx3AJeBOWAZ+AJM2X4JfALm0/cXwCCw8eBAJ/Caqj0Dhmy35UGAJmA7MAb8tD0PjNjeUPAO229tL9k+b7vSYP8A8DHtH24UPAPGU+bnbGcFTLb32z4DtJb8epOEM8DW9Qj6gXnbT9MBFzEBj2wDdJV9bR8DVmxfWI9g1PYysKcOJttPEkF3HbwFeG/7czm53DJJgxExCzyvh0eEIiLf+5dFxIKkhxHRoWpr11hF1T6fzrLsR8pqWNLR1D2ZpH5AETEOLKQ901mWnUjrtymBbknv6hE0AauXBuiRNFR4z5c783VEfChUsZi+N69VwWxEtNuuZFn2OyKuSLqTss8iYlzSgKR9ETGdSIsJbUkVzNYjEHDD9hzQW8Zsrx6y7Z46vgLup9u9uV78TNKkpBZJR8pgyqxmXbB+VefVw4j4tlYFm9KI+A70lTABN9Ic6iphFeAusGS7psX/Mtt7bS8BU0BnHZLiYefBLybpbgLrjpZ8XJwClm3PAAdsN62RzDbbt1NwbL+3fRI4BNT4rAqbbuIIMBoRbZLeSHqQ+vwXsDUidkkaBJoj4h6wPSJy6QxcjYjT6QKuKVeP7Uu2v1JrK2k2DSWZzuZAGicrtq81lCxV1JTG8gHbh23vBtpLe46noDlB/rwOtDQk2UASLanLaiq1PWH730lst9q+lVdQlAsY+2cCqSpnTlKUC/j6XwgSSSswWWqIif9GIK3KNUH1r+QasOkPpU8FJ4KtSqcAAAAASUVORK5CYII=\") 50% no-repeat;background-size:16px;bottom:0;content:\"\";left:0;position:absolute;top:0;width:100%}::ng-deep .c-image-editor-quill-box:hover img{opacity:.4}::ng-deep .ql-toolbar input.ql-customFile[type=file]{display:none}"]
            },] }
];
SdEditor.ctorParameters = () => [
    { type: NgZone },
    { type: ChangeDetectorRef },
    { type: undefined, decorators: [{ type: Inject, args: [EDITOR_CONFIG,] }, { type: Optional }] }
];
SdEditor.propDecorators = {
    editor: [{ type: ViewChild, args: ['editor',] }],
    label: [{ type: Input }],
    model: [{ type: Input }],
    disabled: [{ type: Input }],
    pRequired: [{ type: Input }],
    _minlength: [{ type: Input, args: ['minlength',] }],
    _maxlength: [{ type: Input, args: ['maxlength',] }],
    modelChange: [{ type: Output }],
    placeholder: [{ type: Input }],
    styles: [{ type: Input }],
    args: [{ type: Input }],
    domain: [{ type: Input }],
    form: [{ type: Input }],
    toolbar: [{ type: Input }],
    enableHTMLButton: [{ type: Input }],
    mentionValues: [{ type: Input }],
    hashTagValues: [{ type: Input }],
    sdLabelDef: [{ type: ContentChild, args: [SdLabelDefDirective,] }],
    sdChange: [{ type: Output }]
};

class SdEditorModule {
}
SdEditorModule.decorators = [
    { type: NgModule, args: [{
                declarations: [SdEditor],
                imports: [
                    CommonModule,
                    FormsModule,
                    ReactiveFormsModule,
                    QuillModule.forRoot(),
                    SdTranslateModule,
                    SdButtonModule,
                    SdTextareaModule,
                    SdApiModule
                ],
                exports: [SdEditor],
                providers: [],
            },] }
];

/*
 * Public API Surface of superdev-angular-core
 */

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

export { Constants, EDITOR_CONFIG, PROMOTION_FORM, PROMOTION_PERMISSIONS, SdEditor, SdEditorModule, ValidateMessageConstants };
//# sourceMappingURL=sd-angular-core-editor.js.map
