import * as i0 from '@angular/core';
import { Directive, NgModule } from '@angular/core';
import * as i2 from '@wm/components/input/file-upload';
import { hasCordova } from '@wm/core';
import * as i1 from '@wm/mobile/components/basic';
import { CommonModule } from '@angular/common';
import { WmComponentsModule } from '@wm/components/base';

class FileUploadDirective {
    constructor(fileSelectorService, fileUploadComponent) {
        this.fileSelectorService = fileSelectorService;
        this.fileUploadComponent = fileUploadComponent;
        fileUploadComponent._isMobileType = true;
        fileUploadComponent._isCordova = 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.ɵɵdirectiveInject(i1.FileSelectorService), i0.ɵɵdirectiveInject(i2.FileUploadComponent)); }; }
    static { this.ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: FileUploadDirective, selectors: [["", "wmFileUpload", ""]] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FileUploadDirective, [{
        type: Directive,
        args: [{
                selector: '[wmFileUpload]'
            }]
    }], () => [{ type: i1.FileSelectorService }, { type: i2.FileUploadComponent }], null); })();

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

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

export { FileUploadDirective, FileUploadModule };
//# sourceMappingURL=index.mjs.map
