import { PdfViewer } from '@syncfusion/ej2-pdfviewer';
import { ComponentBase, getProps, gh, isExecute, vueDefineComponent } from '@syncfusion/ej2-vue-base';
import { getValue, isNullOrUndefined } from '@syncfusion/ej2-base';

const properties = ['isLazyUpdate', 'plugins', 'DropdownFieldSettings', 'ajaxRequestSettings', 'annotationSelectorSettings', 'annotationSettings', 'annotations', 'areaSettings', 'arrowSettings', 'checkBoxFieldSettings', 'circleSettings', 'commandManager', 'contextMenuOption', 'contextMenuSettings', 'currentPageNumber', 'customContextMenuItems', 'customStamp', 'customStampSettings', 'dateTimeFormat', 'designerMode', 'disableContextMenuItems', 'disableDefaultContextMenu', 'distanceSettings', 'documentPath', 'downloadFileName', 'drawingObject', 'enableAccessibilityTags', 'enableAnnotation', 'enableAnnotationToolbar', 'enableAutoComplete', 'enableBookmark', 'enableBookmarkStyles', 'enableCommentPanel', 'enableDesktopMode', 'enableDownload', 'enableFormDesigner', 'enableFormDesignerToolbar', 'enableFormFields', 'enableFormFieldsValidation', 'enableFreeText', 'enableHandwrittenSignature', 'enableHtmlSanitizer', 'enableHyperlink', 'enableImportAnnotationMeasurement', 'enableInkAnnotation', 'enableMagnification', 'enableMeasureAnnotation', 'enableMultiLineOverlap', 'enableMultiPageAnnotation', 'enableNavigation', 'enableNavigationToolbar', 'enablePageOrganizer', 'enablePersistence', 'enablePinchZoom', 'enablePrint', 'enablePrintRotation', 'enableRtl', 'enableShapeAnnotation', 'enableShapeLabel', 'enableStampAnnotations', 'enableStickyNotesAnnotation', 'enableTextMarkupAnnotation', 'enableTextMarkupResizer', 'enableTextSearch', 'enableTextSelection', 'enableThumbnail', 'enableToolbar', 'enableZoomOptimization', 'exportAnnotationFileName', 'formFieldCollections', 'formFields', 'freeTextSettings', 'handWrittenSignatureSettings', 'height', 'hideEmptyDigitalSignatureFields', 'hideSaveSignature', 'highlightSettings', 'hyperlinkOpenState', 'initialDialogSettings', 'initialFieldSettings', 'initialRenderPages', 'inkAnnotationSettings', 'interactionMode', 'isAnnotationToolbarOpen', 'isAnnotationToolbarVisible', 'isBookmarkPanelOpen', 'isCommandPanelOpen', 'isDocumentEdited', 'isExtractText', 'isFormDesignerToolbarVisible', 'isFormFieldDocument', 'isInitialFieldToolbarSelection', 'isMaintainSelection', 'isPageOrganizerOpen', 'isSignatureEditable', 'isThumbnailViewOpen', 'isValidFreeText', 'lineSettings', 'listBoxFieldSettings', 'locale', 'measurementSettings', 'pageCount', 'pageOrganizerSettings', 'passwordFieldSettings', 'perimeterSettings', 'polygonSettings', 'printMode', 'printScaleRatio', 'radioButtonFieldSettings', 'radiusSettings', 'rectangleSettings', 'resourceUrl', 'restrictZoomRequest', 'retryCount', 'retryStatusCodes', 'retryTimeout', 'scrollSettings', 'selectedItems', 'serverActionSettings', 'serviceUrl', 'shapeLabelSettings', 'showCustomContextMenuBottom', 'showDigitalSignatureAppearance', 'showNotificationDialog', 'signatureDialogSettings', 'signatureFieldSettings', 'signatureFitMode', 'stampSettings', 'stickyNotesSettings', 'strikethroughSettings', 'textFieldSettings', 'textSearchColorSettings', 'tileRenderingSettings', 'toolbarSettings', 'underlineSettings', 'volumeSettings', 'width', 'zoomMode', 'zoomValue', 'addSignature', 'ajaxRequestFailed', 'ajaxRequestInitiate', 'ajaxRequestSuccess', 'annotationAdd', 'annotationDoubleClick', 'annotationMouseLeave', 'annotationMouseover', 'annotationMove', 'annotationMoving', 'annotationPropertiesChange', 'annotationRemove', 'annotationResize', 'annotationSelect', 'annotationUnSelect', 'beforeAddFreeText', 'bookmarkClick', 'buttonFieldClick', 'commentAdd', 'commentDelete', 'commentEdit', 'commentSelect', 'commentStatusChanged', 'created', 'customContextMenuBeforeOpen', 'customContextMenuSelect', 'documentLoad', 'documentLoadFailed', 'documentUnload', 'downloadEnd', 'downloadStart', 'exportFailed', 'exportStart', 'exportSuccess', 'extractTextCompleted', 'formFieldAdd', 'formFieldClick', 'formFieldDoubleClick', 'formFieldFocusOut', 'formFieldMouseLeave', 'formFieldMouseover', 'formFieldMove', 'formFieldPropertiesChange', 'formFieldRemove', 'formFieldResize', 'formFieldSelect', 'formFieldUnselect', 'hyperlinkClick', 'hyperlinkMouseOver', 'importFailed', 'importStart', 'importSuccess', 'keyboardCustomCommands', 'moveSignature', 'pageChange', 'pageClick', 'pageMouseover', 'pageOrganizerSaveAs', 'pageRenderComplete', 'pageRenderInitiate', 'printEnd', 'printStart', 'removeSignature', 'resizeSignature', 'signaturePropertiesChange', 'signatureSelect', 'textSearchComplete', 'textSearchHighlight', 'textSearchStart', 'textSelectionEnd', 'textSelectionStart', 'thumbnailClick', 'toolbarClick', 'validateFormFields', 'zoomChange'];
const modelProps = [];
const testProp = getProps({ props: properties });
const props = testProp[0];
const watch = testProp[1];
const emitProbs = Object.keys(watch);
emitProbs.push('modelchanged', 'update:modelValue');
for (let props of modelProps) {
    emitProbs.push('update:' + props);
}
/**
 * `ejs-pdfviewer` represents the VueJS PdfViewer Component.
 * ```vue
 * <ejs-pdfviewer></ejs-pdfviewer>
 * ```
 */
let PdfViewerComponent = vueDefineComponent({
    name: 'PdfViewerComponent',
    mixins: [ComponentBase],
    props: props,
    watch: watch,
    emits: emitProbs,
    provide() { return { custom: this.custom }; },
    data() {
        return {
            ej2Instances: new PdfViewer({}),
            propKeys: properties,
            models: modelProps,
            hasChildDirective: false,
            hasInjectedModules: true,
            tagMapper: {},
            tagNameMapper: {},
            isVue3: !isExecute,
            templateCollection: {},
        };
    },
    created() {
        this.bindProperties();
        this.ej2Instances._setProperties = this.ej2Instances.setProperties;
        this.ej2Instances.setProperties = this.setProperties;
        this.ej2Instances.clearTemplate = this.clearTemplate;
        this.updated = this.updated;
    },
    render(createElement) {
        let h = !isExecute ? gh : createElement;
        let slots = null;
        if (!isNullOrUndefined(this.$slots.default)) {
            slots = !isExecute ? this.$slots.default() : this.$slots.default;
        }
        return h('div', slots);
    },
    methods: {
        clearTemplate(templateNames) {
            if (!templateNames) {
                templateNames = Object.keys(this.templateCollection || {});
            }
            if (templateNames.length && this.templateCollection) {
                for (let tempName of templateNames) {
                    let elementCollection = this.templateCollection[tempName];
                    if (elementCollection && elementCollection.length) {
                        for (let ele of elementCollection) {
                            let destroy = getValue('__vue__.$destroy', ele);
                            if (destroy) {
                                ele.__vue__.$destroy();
                            }
                            if (ele.innerHTML) {
                                ele.innerHTML = '';
                            }
                        }
                        delete this.templateCollection[tempName];
                    }
                }
            }
        },
        setProperties(prop, muteOnChange) {
            if (this.isVue3) {
                this.models = !this.models ? this.ej2Instances.referModels : this.models;
            }
            if (this.ej2Instances && this.ej2Instances._setProperties) {
                this.ej2Instances._setProperties(prop, muteOnChange);
            }
            if (prop && this.models && this.models.length) {
                Object.keys(prop).map((key) => {
                    this.models.map((model) => {
                        if ((key === model) && !(/datasource/i.test(key))) {
                            if (this.isVue3) {
                                this.ej2Instances.vueInstance.$emit('update:' + key, prop[key]);
                            }
                            else {
                                this.$emit('update:' + key, prop[key]);
                                this.$emit('modelchanged', prop[key]);
                            }
                        }
                    });
                });
            }
        },
        custom() {
            this.updated();
        },
        addAnnotation(annotation) {
            return this.ej2Instances.addAnnotation(annotation);
        },
        addCustomMenu(menuItems, disableDefaultItems, appendToEnd) {
            return this.ej2Instances.addCustomMenu(menuItems, disableDefaultItems, appendToEnd);
        },
        clearFormFields(formField) {
            return this.ej2Instances.clearFormFields(formField);
        },
        convertClientPointToPagePoint(clientPoint, pageNumber) {
            return this.ej2Instances.convertClientPointToPagePoint(clientPoint, pageNumber);
        },
        convertPagePointToClientPoint(pagePoint, pageNumber) {
            return this.ej2Instances.convertPagePointToClientPoint(pagePoint, pageNumber);
        },
        convertPagePointToScrollingPoint(pagePoint, pageNumber) {
            return this.ej2Instances.convertPagePointToScrollingPoint(pagePoint, pageNumber);
        },
        deleteAnnotations() {
            return this.ej2Instances.deleteAnnotations();
        },
        download() {
            return this.ej2Instances.download();
        },
        exportAnnotation(annotationDataFormat) {
            return this.ej2Instances.exportAnnotation(annotationDataFormat);
        },
        exportAnnotationsAsBase64String(annotationDataFormat) {
            return this.ej2Instances.exportAnnotationsAsBase64String(annotationDataFormat);
        },
        exportAnnotationsAsObject(annotationDataFormat) {
            return this.ej2Instances.exportAnnotationsAsObject(annotationDataFormat);
        },
        exportFormFields(data, formFieldDataFormat) {
            return this.ej2Instances.exportFormFields(data, formFieldDataFormat);
        },
        exportFormFieldsAsObject(formFieldDataFormat) {
            return this.ej2Instances.exportFormFieldsAsObject(formFieldDataFormat);
        },
        focusFormField(field) {
            return this.ej2Instances.focusFormField(field);
        },
        getPageNumberFromClientPoint(clientPoint) {
            return this.ej2Instances.getPageNumberFromClientPoint(clientPoint);
        },
        importAnnotation(importData, annotationDataFormat) {
            return this.ej2Instances.importAnnotation(importData, annotationDataFormat);
        },
        importFormFields(data, formFieldDataFormat) {
            return this.ej2Instances.importFormFields(data, formFieldDataFormat);
        },
        load(document, password) {
            return this.ej2Instances.load(document, password);
        },
        redo() {
            return this.ej2Instances.redo();
        },
        requiredModules() {
            return this.ej2Instances.requiredModules();
        },
        resetFormFields() {
            return this.ej2Instances.resetFormFields();
        },
        retrieveFormFields() {
            return this.ej2Instances.retrieveFormFields();
        },
        saveAsBlob() {
            return this.ej2Instances.saveAsBlob();
        },
        setJsonData(jsonData) {
            return this.ej2Instances.setJsonData(jsonData);
        },
        showNotificationPopup(errorString) {
            return this.ej2Instances.showNotificationPopup(errorString);
        },
        undo() {
            return this.ej2Instances.undo();
        },
        unload() {
            return this.ej2Instances.unload();
        },
        updateFormFields(formFields) {
            return this.ej2Instances.updateFormFields(formFields);
        },
        updateFormFieldsValue(fieldValue) {
            return this.ej2Instances.updateFormFieldsValue(fieldValue);
        },
        updateViewerContainer() {
            return this.ej2Instances.updateViewerContainer();
        },
        zoomToRect(rectangle) {
            return this.ej2Instances.zoomToRect(rectangle);
        },
    }
});
const PdfViewerPlugin = {
    name: 'ejs-pdfviewer',
    install(Vue) {
        Vue.component(PdfViewerPlugin.name, PdfViewerComponent);
    }
};

export { PdfViewerComponent, PdfViewerPlugin };
export * from '@syncfusion/ej2-pdfviewer';
//# sourceMappingURL=ej2-vue-pdfviewer.es2015.js.map
