(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@wm/components/input/file-upload'), require('@wm/core'), require('@wm/mobile/components/basic'), require('@angular/common'), require('@wm/components/base')) :
    typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@wm/components/input/file-upload', '@wm/core', '@wm/mobile/components/basic', '@angular/common', '@wm/components/base'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.mobile = global.wm.mobile || {}, global.wm.mobile.components = global.wm.mobile.components || {}, global.wm.mobile.components.input = global.wm.mobile.components.input || {}, global.wm.mobile.components.input.fileupload = {}), global.ng.core, global.wm.components.input.fileupload, global.wm.core, global.wm.mobile.components.basic, global.ng.common, global.wm.components.base));
})(this, (function (exports, i0, i2, core, i1, common, base) { 'use strict';

    function _interopNamespaceDefault(e) {
        var n = Object.create(null);
        if (e) {
            Object.keys(e).forEach(function (k) {
                if (k !== 'default') {
                    var d = Object.getOwnPropertyDescriptor(e, k);
                    Object.defineProperty(n, k, d.get ? d : {
                        enumerable: true,
                        get: function () { return e[k]; }
                    });
                }
            });
        }
        n.default = e;
        return Object.freeze(n);
    }

    var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
    var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);
    var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);

    class FileUploadDirective {
        constructor(fileSelectorService, fileUploadComponent) {
            this.fileSelectorService = fileSelectorService;
            this.fileUploadComponent = fileUploadComponent;
            fileUploadComponent._isMobileType = true;
            fileUploadComponent._isCordova = core.hasCordova();
            fileUploadComponent['openFileSelector'] = () => {
                this.openFileSelector(fileUploadComponent.multiple).then((contents) => {
                    this.fileUploadComponent.onFileSelect({}, contents);
                });
            };
        }
        openFileSelector(multiple) {
            switch (this.fileUploadComponent['contenttype']) {
                case 'image':
                    return this.fileSelectorService.selectImages(multiple);
                case 'video':
                    return this.fileSelectorService.selectVideos(multiple);
                case 'audio':
                    return this.fileSelectorService.selectAudio(multiple);
                default:
                    return this.fileSelectorService.selectFiles(multiple);
            }
        }
        static { this.ɵfac = function FileUploadDirective_Factory(t) { return new (t || FileUploadDirective)(i0__namespace.ɵɵdirectiveInject(i1__namespace.FileSelectorService), i0__namespace.ɵɵdirectiveInject(i2__namespace.FileUploadComponent)); }; }
        static { this.ɵdir = /*@__PURE__*/ i0__namespace.ɵɵdefineDirective({ type: FileUploadDirective, selectors: [["", "wmFileUpload", ""]] }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(FileUploadDirective, [{
            type: i0.Directive,
            args: [{
                    selector: '[wmFileUpload]'
                }]
        }], () => [{ type: i1__namespace.FileSelectorService }, { type: i2__namespace.FileUploadComponent }], null); })();

    const components = [
        FileUploadDirective
    ];
    class FileUploadModule {
        static { this.ɵfac = function FileUploadModule_Factory(t) { return new (t || FileUploadModule)(); }; }
        static { this.ɵmod = /*@__PURE__*/ i0__namespace.ɵɵdefineNgModule({ type: FileUploadModule }); }
        static { this.ɵinj = /*@__PURE__*/ i0__namespace.ɵɵdefineInjector({ imports: [common.CommonModule,
                base.WmComponentsModule] }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(FileUploadModule, [{
            type: i0.NgModule,
            args: [{
                    imports: [
                        common.CommonModule,
                        base.WmComponentsModule
                    ],
                    declarations: [...components],
                    exports: [...components]
                }]
        }], null, null); })();
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(FileUploadModule, { declarations: [FileUploadDirective], imports: [common.CommonModule,
            base.WmComponentsModule], exports: [FileUploadDirective] }); })();

    exports.FileUploadDirective = FileUploadDirective;
    exports.FileUploadModule = FileUploadModule;

}));
