import { __values, __assign, __spread, __decorate, __metadata } from 'tslib';
import { ENTER } from '@angular/cdk/keycodes';
import { HttpRequest, HttpHeaders, HttpEventType, HttpResponse, HttpClient } from '@angular/common/http';
import { ɵɵdirectiveInject, ElementRef, ɵɵdefineComponent, ɵɵviewQuery, ɵɵqueryRefresh, ɵɵloadQuery, ɵɵlistener, ɵɵattribute, ɵɵProvidersFeature, ɵɵNgOnChangesFeature, ɵɵprojectionDef, ɵɵelementStart, ɵɵelementEnd, ɵɵprojection, ɵɵproperty, ɵsetClassMetadata, Component, ViewEncapsulation, Optional, ViewChild, Input, HostListener, ɵɵtemplate, ɵɵnextContext, ɵɵreference, ɵɵclassProp, ɵɵadvance, ɵɵpureFunction1, ɵɵelement, ɵɵsanitizeUrl, ɵɵgetCurrentView, ɵɵrestoreView, ɵɵelementContainerStart, ɵɵelementContainerEnd, ɵɵtemplateRefExtractor, ɵɵtext, ɵɵtextInterpolate, ɵɵpropertyInterpolate, ɵɵclassMapInterpolate1, ɵɵpureFunction0, ɵɵclassMapInterpolate2, ChangeDetectorRef, NgZone, ChangeDetectionStrategy, Inject, ɵɵstyleProp, EventEmitter, Output, ɵɵdefineNgModule, ɵɵdefineInjector, ɵɵsetNgModuleScope, NgModule } from '@angular/core';
import { of, Observable, Subscription } from 'rxjs';
import { switchMap, map, filter } from 'rxjs/operators';
import { warn, NzUpdateHostClassService, toBoolean, InputNumber, InputBoolean } from 'ng-zorro-antd/core';
import { trigger, transition, style, animate } from '@angular/animations';
import { Platform, PlatformModule } from '@angular/cdk/platform';
import { DOCUMENT, NgForOf, NgTemplateOutlet, NgIf, NgSwitch, NgSwitchCase, NgSwitchDefault, NgClass, NgStyle, CommonModule } from '@angular/common';
import { NzTooltipDirective, NzToolTipModule } from 'ng-zorro-antd/tooltip';
import { NzIconDirective, NzIconModule } from 'ng-zorro-antd/icon';
import { NzProgressComponent, NzProgressModule } from 'ng-zorro-antd/progress';
import { NzI18nService, NzI18nModule } from 'ng-zorro-antd/i18n';
import { FormsModule } from '@angular/forms';

var _c0 = ["file"];
var _c1 = ["nz-upload-btn", ""];
var _c2 = ["*"];
var NzUploadBtnComponent = /** @class */ (function () {
    // #endregion
    function NzUploadBtnComponent(http, el, updateHostClassService) {
        this.http = http;
        this.el = el;
        this.updateHostClassService = updateHostClassService;
        this.reqs = {};
        this.inited = false;
        this.destroy = false;
        // #region fields
        this.classes = {};
        // #region styles
        this.prefixCls = 'ant-upload';
        if (!http) {
            throw new Error("Not found 'HttpClient', You can import 'HttpClientModule' in your root module.");
        }
    }
    // #endregion
    NzUploadBtnComponent.prototype.onClick = function () {
        if (this.options.disabled || !this.options.openFileDialogOnClick) {
            return;
        }
        this.file.nativeElement.click();
    };
    NzUploadBtnComponent.prototype.onKeyDown = function (e) {
        if (this.options.disabled) {
            return;
        }
        if (e.key === 'Enter' || e.keyCode === ENTER) {
            this.onClick();
        }
    };
    // skip safari bug
    NzUploadBtnComponent.prototype.onFileDrop = function (e) {
        var _this = this;
        if (this.options.disabled || e.type === 'dragover') {
            e.preventDefault();
            return;
        }
        if (this.options.directory) {
            this.traverseFileTree(e.dataTransfer.items);
        }
        else {
            var files = Array.prototype.slice
                .call(e.dataTransfer.files)
                .filter(function (file) { return _this.attrAccept(file, _this.options.accept); });
            if (files.length) {
                this.uploadFiles(files);
            }
        }
        e.preventDefault();
    };
    NzUploadBtnComponent.prototype.onChange = function (e) {
        if (this.options.disabled) {
            return;
        }
        var hie = e.target;
        this.uploadFiles(hie.files);
        hie.value = '';
    };
    NzUploadBtnComponent.prototype.traverseFileTree = function (files) {
        var e_1, _a;
        var _this = this;
        // tslint:disable-next-line:no-any
        var _traverseFileTree = function (item, path) {
            if (item.isFile) {
                item.file(function (file) {
                    if (_this.attrAccept(file, _this.options.accept)) {
                        _this.uploadFiles([file]);
                    }
                });
            }
            else if (item.isDirectory) {
                var dirReader = item.createReader();
                // tslint:disable-next-line:no-any
                dirReader.readEntries(function (entries) {
                    var e_2, _a;
                    try {
                        for (var entries_1 = __values(entries), entries_1_1 = entries_1.next(); !entries_1_1.done; entries_1_1 = entries_1.next()) {
                            var entrieItem = entries_1_1.value;
                            _traverseFileTree(entrieItem, "" + path + item.name + "/");
                        }
                    }
                    catch (e_2_1) { e_2 = { error: e_2_1 }; }
                    finally {
                        try {
                            if (entries_1_1 && !entries_1_1.done && (_a = entries_1.return)) _a.call(entries_1);
                        }
                        finally { if (e_2) throw e_2.error; }
                    }
                });
            }
        };
        try {
            // tslint:disable-next-line:no-any
            for (var _b = __values(files), _c = _b.next(); !_c.done; _c = _b.next()) {
                var file = _c.value;
                _traverseFileTree(file.webkitGetAsEntry(), '');
            }
        }
        catch (e_1_1) { e_1 = { error: e_1_1 }; }
        finally {
            try {
                if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
            }
            finally { if (e_1) throw e_1.error; }
        }
    };
    NzUploadBtnComponent.prototype.attrAccept = function (file, acceptedFiles) {
        if (file && acceptedFiles) {
            var acceptedFilesArray = Array.isArray(acceptedFiles) ? acceptedFiles : acceptedFiles.split(',');
            var fileName_1 = '' + file.name;
            var mimeType_1 = '' + file.type;
            var baseMimeType_1 = mimeType_1.replace(/\/.*$/, '');
            return acceptedFilesArray.some(function (type) {
                var validType = type.trim();
                if (validType.charAt(0) === '.') {
                    return (fileName_1.toLowerCase().indexOf(validType.toLowerCase(), fileName_1.toLowerCase().length - validType.toLowerCase().length) !== -1);
                }
                else if (/\/\*$/.test(validType)) {
                    // This is something like a image/* mime type
                    return baseMimeType_1 === validType.replace(/\/.*$/, '');
                }
                return mimeType_1 === validType;
            });
        }
        return true;
    };
    NzUploadBtnComponent.prototype.attachUid = function (file) {
        if (!file.uid) {
            file.uid = Math.random()
                .toString(36)
                .substring(2);
        }
        return file;
    };
    NzUploadBtnComponent.prototype.uploadFiles = function (fileList) {
        var _this = this;
        var filters$ = of(Array.prototype.slice.call(fileList));
        if (this.options.filters) {
            this.options.filters.forEach(function (f) {
                filters$ = filters$.pipe(switchMap(function (list) {
                    var fnRes = f.fn(list);
                    return fnRes instanceof Observable ? fnRes : of(fnRes);
                }));
            });
        }
        filters$.subscribe(function (list) {
            list.forEach(function (file) {
                _this.attachUid(file);
                _this.upload(file, list);
            });
        }, function (e) {
            warn("Unhandled upload filter error", e);
        });
    };
    NzUploadBtnComponent.prototype.upload = function (file, fileList) {
        var _this = this;
        if (!this.options.beforeUpload) {
            return this.post(file);
        }
        var before = this.options.beforeUpload(file, fileList);
        if (before instanceof Observable) {
            before.subscribe(function (processedFile) {
                var processedFileType = Object.prototype.toString.call(processedFile);
                if (processedFileType === '[object File]' || processedFileType === '[object Blob]') {
                    _this.attachUid(processedFile);
                    _this.post(processedFile);
                }
                else if (typeof processedFile === 'boolean' && processedFile !== false) {
                    _this.post(file);
                }
            }, function (e) {
                warn("Unhandled upload beforeUpload error", e);
            });
        }
        else if (before !== false) {
            return this.post(file);
        }
    };
    NzUploadBtnComponent.prototype.post = function (file) {
        var _this = this;
        if (this.destroy) {
            return;
        }
        var process$ = of(file);
        var opt = this.options;
        var uid = file.uid;
        var action = opt.action, data = opt.data, headers = opt.headers, transformFile = opt.transformFile;
        var args = {
            action: typeof action === 'string' ? action : '',
            name: opt.name,
            headers: headers,
            file: file,
            postFile: file,
            data: data,
            withCredentials: opt.withCredentials,
            onProgress: opt.onProgress
                ? function (e) {
                    opt.onProgress(e, file);
                }
                : undefined,
            onSuccess: function (ret, xhr) {
                _this.clean(uid);
                opt.onSuccess(ret, file, xhr);
            },
            onError: function (xhr) {
                _this.clean(uid);
                opt.onError(xhr, file);
            }
        };
        if (typeof action === 'function') {
            var actionResult_1 = action(file);
            if (actionResult_1 instanceof Observable) {
                process$ = process$.pipe(switchMap(function () { return actionResult_1; }), map(function (res) {
                    args.action = res;
                    return file;
                }));
            }
            else {
                args.action = actionResult_1;
            }
        }
        if (typeof transformFile === 'function') {
            var transformResult_1 = transformFile(file);
            process$ = process$.pipe(switchMap(function () { return (transformResult_1 instanceof Observable ? transformResult_1 : of(transformResult_1)); }));
        }
        if (typeof data === 'function') {
            var dataResult_1 = data(file);
            if (dataResult_1 instanceof Observable) {
                process$ = process$.pipe(switchMap(function () { return dataResult_1; }), map(function (res) {
                    args.data = res;
                    return file;
                }));
            }
            else {
                args.data = dataResult_1;
            }
        }
        if (typeof headers === 'function') {
            var headersResult_1 = headers(file);
            if (headersResult_1 instanceof Observable) {
                process$ = process$.pipe(switchMap(function () { return headersResult_1; }), map(function (res) {
                    args.headers = res;
                    return file;
                }));
            }
            else {
                args.headers = headersResult_1;
            }
        }
        process$.subscribe(function (newFile) {
            args.postFile = newFile;
            var req$ = (opt.customRequest || _this.xhr).call(_this, args);
            if (!(req$ instanceof Subscription)) {
                warn("Must return Subscription type in '[nzCustomRequest]' property");
            }
            _this.reqs[uid] = req$;
            opt.onStart(file);
        });
    };
    NzUploadBtnComponent.prototype.xhr = function (args) {
        var _this = this;
        var formData = new FormData();
        if (args.data) {
            Object.keys(args.data).map(function (key) {
                formData.append(key, args.data[key]);
            });
        }
        // tslint:disable-next-line:no-any
        formData.append(args.name, args.postFile);
        if (!args.headers) {
            args.headers = {};
        }
        if (args.headers['X-Requested-With'] !== null) {
            args.headers['X-Requested-With'] = "XMLHttpRequest";
        }
        else {
            delete args.headers['X-Requested-With'];
        }
        var req = new HttpRequest('POST', args.action, formData, {
            reportProgress: true,
            withCredentials: args.withCredentials,
            headers: new HttpHeaders(args.headers)
        });
        return this.http.request(req).subscribe(
        // tslint:disable-next-line no-any
        function (event) {
            if (event.type === HttpEventType.UploadProgress) {
                if (event.total > 0) {
                    // tslint:disable-next-line:no-any
                    event.percent = (event.loaded / event.total) * 100;
                }
                args.onProgress(event, args.file);
            }
            else if (event instanceof HttpResponse) {
                args.onSuccess(event.body, args.file, event);
            }
        }, function (err) {
            _this.abort(args.file);
            args.onError(err, args.file);
        });
    };
    NzUploadBtnComponent.prototype.clean = function (uid) {
        var req$ = this.reqs[uid];
        if (req$ instanceof Subscription) {
            req$.unsubscribe();
        }
        delete this.reqs[uid];
    };
    NzUploadBtnComponent.prototype.abort = function (file) {
        var _this = this;
        if (file) {
            this.clean(file && file.uid);
        }
        else {
            Object.keys(this.reqs).forEach(function (uid) { return _this.clean(uid); });
        }
    };
    NzUploadBtnComponent.prototype.setClassMap = function () {
        var _a;
        var classMap = __assign((_a = {}, _a[this.prefixCls] = true, _a[this.prefixCls + "-disabled"] = this.options.disabled, _a), this.classes);
        this.updateHostClassService.updateHostClass(this.el.nativeElement, classMap);
    };
    NzUploadBtnComponent.prototype.ngOnInit = function () {
        this.inited = true;
        this.setClassMap();
    };
    NzUploadBtnComponent.prototype.ngOnChanges = function () {
        if (this.inited) {
            this.setClassMap();
        }
    };
    NzUploadBtnComponent.prototype.ngOnDestroy = function () {
        this.destroy = true;
        this.abort();
    };
    /** @nocollapse */ NzUploadBtnComponent.ɵfac = function NzUploadBtnComponent_Factory(t) { return new (t || NzUploadBtnComponent)(ɵɵdirectiveInject(HttpClient, 8), ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(NzUpdateHostClassService)); };
    /** @nocollapse */ NzUploadBtnComponent.ɵcmp = ɵɵdefineComponent({ type: NzUploadBtnComponent, selectors: [["", "nz-upload-btn", ""]], viewQuery: function NzUploadBtnComponent_Query(rf, ctx) { if (rf & 1) {
            ɵɵviewQuery(_c0, true);
        } if (rf & 2) {
            var _t;
            ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.file = _t.first);
        } }, hostVars: 2, hostBindings: function NzUploadBtnComponent_HostBindings(rf, ctx) { if (rf & 1) {
            ɵɵlistener("click", function NzUploadBtnComponent_click_HostBindingHandler() { return ctx.onClick(); })("keydown", function NzUploadBtnComponent_keydown_HostBindingHandler($event) { return ctx.onKeyDown($event); })("drop", function NzUploadBtnComponent_drop_HostBindingHandler($event) { return ctx.onFileDrop($event); })("dragover", function NzUploadBtnComponent_dragover_HostBindingHandler($event) { return ctx.onFileDrop($event); });
        } if (rf & 2) {
            ɵɵattribute("tabindex", "0")("role", "button");
        } }, inputs: { classes: "classes", options: "options" }, exportAs: ["nzUploadBtn"], features: [ɵɵProvidersFeature([NzUpdateHostClassService]), ɵɵNgOnChangesFeature], attrs: _c1, ngContentSelectors: _c2, decls: 3, vars: 4, consts: [["type", "file", 2, "display", "none", 3, "multiple", "change"], ["file", ""]], template: function NzUploadBtnComponent_Template(rf, ctx) { if (rf & 1) {
            ɵɵprojectionDef();
            ɵɵelementStart(0, "input", 0, 1);
            ɵɵlistener("change", function NzUploadBtnComponent_Template_input_change_0_listener($event) { return ctx.onChange($event); });
            ɵɵelementEnd();
            ɵɵprojection(2);
        } if (rf & 2) {
            ɵɵproperty("multiple", ctx.options.multiple);
            ɵɵattribute("accept", ctx.options.accept)("directory", ctx.options.directory ? "directory" : null)("webkitdirectory", ctx.options.directory ? "webkitdirectory" : null);
        } }, encapsulation: 2 });
    return NzUploadBtnComponent;
}());
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzUploadBtnComponent, [{
        type: Component,
        args: [{
                selector: '[nz-upload-btn]',
                exportAs: 'nzUploadBtn',
                templateUrl: './upload-btn.component.html',
                host: {
                    '[attr.tabindex]': '"0"',
                    '[attr.role]': '"button"'
                },
                providers: [NzUpdateHostClassService],
                preserveWhitespaces: false,
                encapsulation: ViewEncapsulation.None
            }]
    }], function () { return [{ type: HttpClient, decorators: [{
                type: Optional
            }] }, { type: ElementRef }, { type: NzUpdateHostClassService }]; }, { file: [{
            type: ViewChild,
            args: ['file', { static: false }]
        }], classes: [{
            type: Input
        }], options: [{
            type: Input
        }], onClick: [{
            type: HostListener,
            args: ['click']
        }], onKeyDown: [{
            type: HostListener,
            args: ['keydown', ['$event']]
        }], onFileDrop: [{
            type: HostListener,
            args: ['drop', ['$event']]
        }, {
            type: HostListener,
            args: ['dragover', ['$event']]
        }] }); })();

/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
function NzUploadListComponent_div_0_ng_template_1_div_1_ng_template_1_Template(rf, ctx) { }
var _c0$1 = function (a0) { return { $implicit: a0 }; };
function NzUploadListComponent_div_0_ng_template_1_div_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "div", 17);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_div_1_ng_template_1_Template, 0, 0, "ng-template", 18);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    var _r2500 = ɵɵreference(4);
    ɵɵclassProp("ant-upload-list-item-file", !file_r2497.isUploading);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2500)("ngTemplateOutletContext", ɵɵpureFunction1(4, _c0$1, file_r2497));
} }
function NzUploadListComponent_div_0_ng_template_1_a_2_img_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "img", 21);
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(3).$implicit;
    ɵɵproperty("src", file_r2497.thumbUrl || file_r2497.url, ɵɵsanitizeUrl);
    ɵɵattribute("alt", file_r2497.name);
} }
function NzUploadListComponent_div_0_ng_template_1_a_2_Template(rf, ctx) { if (rf & 1) {
    var _r2525 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "a", 19);
    ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_1_a_2_Template_a_click_0_listener($event) { ɵɵrestoreView(_r2525); var file_r2497 = ɵɵnextContext(2).$implicit; var ctx_r2523 = ɵɵnextContext(); return ctx_r2523.handlePreview(file_r2497, $event); });
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_a_2_img_1_Template, 1, 2, "img", 20);
    ɵɵelementEnd();
} if (rf & 2) {
    ɵɵnextContext();
    var _r2517 = ɵɵreference(5);
    var file_r2497 = ɵɵnextContext().$implicit;
    ɵɵclassProp("ant-upload-list-item-file", !file_r2497.isImageUrl);
    ɵɵproperty("href", file_r2497.url || file_r2497.thumbUrl, ɵɵsanitizeUrl);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", file_r2497.isImageUrl)("ngIfElse", _r2517);
} }
function NzUploadListComponent_div_0_ng_template_1_span_3_ng_template_1_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_1_span_3_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "span", 22);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_span_3_ng_template_1_Template, 0, 0, "ng-template", 18);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    var _r2500 = ɵɵreference(4);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2500)("ngTemplateOutletContext", ɵɵpureFunction1(2, _c0$1, file_r2497));
} }
function NzUploadListComponent_div_0_ng_template_1_ng_template_4_ng_template_0_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_1_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_1_ng_template_4_ng_template_0_Template, 0, 0, "ng-template", 18);
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    var _r2500 = ɵɵreference(4);
    ɵɵproperty("ngTemplateOutlet", _r2500)("ngTemplateOutletContext", ɵɵpureFunction1(2, _c0$1, file_r2497));
} }
function NzUploadListComponent_div_0_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0, 12);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_div_1_Template, 2, 6, "div", 13);
    ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_1_a_2_Template, 2, 5, "a", 14);
    ɵɵtemplate(3, NzUploadListComponent_div_0_ng_template_1_span_3_Template, 2, 4, "span", 15);
    ɵɵelementContainerEnd();
    ɵɵtemplate(4, NzUploadListComponent_div_0_ng_template_1_ng_template_4_Template, 1, 4, "ng-template", null, 16, ɵɵtemplateRefExtractor);
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext().$implicit;
    ɵɵproperty("ngSwitch", file_r2497.iconType);
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "uploading");
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "thumbnail");
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵelement(1, "i", 27);
    ɵɵelementContainerEnd();
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_ng_container_1_Template, 2, 0, "ng-container", 23);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    var file_r2532 = ɵɵnextContext(2).$implicit;
    var _r2534 = ɵɵreference(2);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", file_r2532.isUploading)("ngIfElse", _r2534);
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_ng_container_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵtext(1);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r2541 = ɵɵnextContext(5);
    ɵɵadvance(1);
    ɵɵtextInterpolate(ctx_r2541.locale.uploading);
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_ng_container_1_Template, 2, 1, "ng-container", 23);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    var file_r2532 = ɵɵnextContext(2).$implicit;
    var _r2534 = ɵɵreference(2);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", file_r2532.isUploading)("ngIfElse", _r2534);
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_i_4_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 28);
} if (rf & 2) {
    var file_r2532 = ɵɵnextContext(2).$implicit;
    ɵɵproperty("nzType", file_r2532.isUploading ? "loading" : "paper-clip");
} }
function NzUploadListComponent_div_0_ng_template_3_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵelementContainerStart(1, 12);
    ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_2_Template, 2, 2, "ng-container", 25);
    ɵɵtemplate(3, NzUploadListComponent_div_0_ng_template_3_ng_container_0_ng_container_3_Template, 2, 2, "ng-container", 25);
    ɵɵtemplate(4, NzUploadListComponent_div_0_ng_template_3_ng_container_0_i_4_Template, 1, 1, "i", 26);
    ɵɵelementContainerEnd();
    ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r2533 = ɵɵnextContext(3);
    ɵɵadvance(1);
    ɵɵproperty("ngSwitch", ctx_r2533.listType);
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "picture");
    ɵɵadvance(1);
    ɵɵproperty("ngSwitchCase", "picture-card");
} }
function NzUploadListComponent_div_0_ng_template_3_ng_template_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "i", 29);
} if (rf & 2) {
    var file_r2532 = ɵɵnextContext().$implicit;
    ɵɵproperty("nzType", file_r2532.isImageUrl ? "picture" : "file");
} }
function NzUploadListComponent_div_0_ng_template_3_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_3_ng_container_0_Template, 5, 3, "ng-container", 23);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_3_ng_template_1_Template, 1, 1, "ng-template", null, 24, ɵɵtemplateRefExtractor);
} if (rf & 2) {
    var ctx_r2501 = ɵɵnextContext(2);
    ɵɵproperty("ngIf", !ctx_r2501.iconRender)("ngIfElse", ctx_r2501.iconRender);
} }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_1_ng_template_1_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_1_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "a", 32);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_5_span_0_a_1_ng_template_1_Template, 0, 0, "ng-template", 9);
    ɵɵelementEnd();
} if (rf & 2) {
    ɵɵnextContext(3);
    var _r2508 = ɵɵreference(12);
    var ctx_r2546 = ɵɵnextContext();
    ɵɵpropertyInterpolate("title", ctx_r2546.locale.downloadFile);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2508);
} }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_2_ng_template_1_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_5_span_0_a_2_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "a", 32);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_5_span_0_a_2_ng_template_1_Template, 0, 0, "ng-template", 9);
    ɵɵelementEnd();
} if (rf & 2) {
    ɵɵnextContext(3);
    var _r2506 = ɵɵreference(10);
    var ctx_r2547 = ɵɵnextContext();
    ɵɵpropertyInterpolate("title", ctx_r2547.locale.removeFile);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2506);
} }
function NzUploadListComponent_div_0_ng_template_5_span_0_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "span");
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_5_span_0_a_1_Template, 2, 2, "a", 31);
    ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_5_span_0_a_2_Template, 2, 2, "a", 31);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    var ctx_r2545 = ɵɵnextContext();
    ɵɵclassMapInterpolate1("ant-upload-list-item-card-actions ", ctx_r2545.listType === "picture" ? "picture" : "", "");
    ɵɵadvance(1);
    ɵɵproperty("ngIf", file_r2497.showDownload);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", ctx_r2545.icons.showRemoveIcon);
} }
function NzUploadListComponent_div_0_ng_template_5_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_5_span_0_Template, 3, 5, "span", 30);
} if (rf & 2) {
    var ctx_r2503 = ɵɵnextContext(2);
    ɵɵproperty("ngIf", ctx_r2503.listType !== "picture-card");
} }
function NzUploadListComponent_div_0_ng_template_7_a_0_Template(rf, ctx) { if (rf & 1) {
    var _r2556 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "a", 35);
    ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_7_a_0_Template_a_click_0_listener($event) { ɵɵrestoreView(_r2556); var file_r2497 = ɵɵnextContext(2).$implicit; var ctx_r2554 = ɵɵnextContext(); return ctx_r2554.handlePreview(file_r2497, $event); });
    ɵɵtext(1);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    ɵɵpropertyInterpolate("title", file_r2497.name);
    ɵɵproperty("ngClass", file_r2497.listItemNameCls)("href", file_r2497.url, ɵɵsanitizeUrl);
    ɵɵattribute("download", file_r2497.linkProps && file_r2497.linkProps.download);
    ɵɵadvance(1);
    ɵɵtextInterpolate(file_r2497.name);
} }
function NzUploadListComponent_div_0_ng_template_7_span_1_Template(rf, ctx) { if (rf & 1) {
    var _r2560 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "span", 36);
    ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_7_span_1_Template_span_click_0_listener($event) { ɵɵrestoreView(_r2560); var file_r2497 = ɵɵnextContext(2).$implicit; var ctx_r2558 = ɵɵnextContext(); return ctx_r2558.handlePreview(file_r2497, $event); });
    ɵɵtext(1);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    ɵɵpropertyInterpolate("title", file_r2497.name);
    ɵɵproperty("ngClass", file_r2497.listItemNameCls);
    ɵɵadvance(1);
    ɵɵtextInterpolate(file_r2497.name);
} }
function NzUploadListComponent_div_0_ng_template_7_ng_template_2_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_7_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_7_a_0_Template, 2, 5, "a", 33);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_7_span_1_Template, 2, 3, "span", 34);
    ɵɵtemplate(2, NzUploadListComponent_div_0_ng_template_7_ng_template_2_Template, 0, 0, "ng-template", 9);
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext().$implicit;
    var _r2502 = ɵɵreference(6);
    ɵɵproperty("ngIf", file_r2497.url);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", !file_r2497.url);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2502);
} }
function NzUploadListComponent_div_0_ng_template_9_i_0_Template(rf, ctx) { if (rf & 1) {
    var _r2566 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "i", 38);
    ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_9_i_0_Template_i_click_0_listener($event) { ɵɵrestoreView(_r2566); var file_r2497 = ɵɵnextContext(2).$implicit; var ctx_r2564 = ɵɵnextContext(); return ctx_r2564.handleRemove(file_r2497, $event); });
    ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2563 = ɵɵnextContext(3);
    ɵɵpropertyInterpolate("title", ctx_r2563.locale.removeFile);
} }
function NzUploadListComponent_div_0_ng_template_9_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_9_i_0_Template, 1, 1, "i", 37);
} if (rf & 2) {
    var ctx_r2507 = ɵɵnextContext(2);
    ɵɵproperty("ngIf", ctx_r2507.icons.showRemoveIcon);
} }
function NzUploadListComponent_div_0_ng_template_11_i_0_Template(rf, ctx) { if (rf & 1) {
    var _r2570 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "i", 40);
    ɵɵlistener("click", function NzUploadListComponent_div_0_ng_template_11_i_0_Template_i_click_0_listener() { ɵɵrestoreView(_r2570); var file_r2497 = ɵɵnextContext(2).$implicit; var ctx_r2568 = ɵɵnextContext(); return ctx_r2568.handleDownload(file_r2497); });
    ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2567 = ɵɵnextContext(3);
    ɵɵpropertyInterpolate("title", ctx_r2567.locale.downloadFile);
} }
function NzUploadListComponent_div_0_ng_template_11_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadListComponent_div_0_ng_template_11_i_0_Template, 1, 1, "i", 39);
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext().$implicit;
    ɵɵproperty("ngIf", file_r2497.showDownload);
} }
function NzUploadListComponent_div_0_ng_template_15_Template(rf, ctx) { }
function NzUploadListComponent_div_0_ng_template_16_Template(rf, ctx) { }
var _c1$1 = function () { return { opacity: 0.5, "pointer-events": "none" }; };
function NzUploadListComponent_div_0_span_17_a_1_Template(rf, ctx) { if (rf & 1) {
    var _r2577 = ɵɵgetCurrentView();
    ɵɵelementStart(0, "a", 43);
    ɵɵlistener("click", function NzUploadListComponent_div_0_span_17_a_1_Template_a_click_0_listener($event) { ɵɵrestoreView(_r2577); var file_r2497 = ɵɵnextContext(2).$implicit; var ctx_r2575 = ɵɵnextContext(); return ctx_r2575.handlePreview(file_r2497, $event); });
    ɵɵelement(1, "i", 44);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext(2).$implicit;
    var ctx_r2572 = ɵɵnextContext();
    ɵɵpropertyInterpolate("title", ctx_r2572.locale.previewFile);
    ɵɵproperty("href", file_r2497.url || file_r2497.thumbUrl, ɵɵsanitizeUrl)("ngStyle", !(file_r2497.url || file_r2497.thumbUrl) && ɵɵpureFunction0(3, _c1$1));
} }
function NzUploadListComponent_div_0_span_17_ng_template_2_Template(rf, ctx) { }
function NzUploadListComponent_div_0_span_17_ng_template_3_Template(rf, ctx) { }
function NzUploadListComponent_div_0_span_17_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "span", 41);
    ɵɵtemplate(1, NzUploadListComponent_div_0_span_17_a_1_Template, 2, 4, "a", 42);
    ɵɵtemplate(2, NzUploadListComponent_div_0_span_17_ng_template_2_Template, 0, 0, "ng-template", 9);
    ɵɵtemplate(3, NzUploadListComponent_div_0_span_17_ng_template_3_Template, 0, 0, "ng-template", 9);
    ɵɵelementEnd();
} if (rf & 2) {
    ɵɵnextContext();
    var _r2508 = ɵɵreference(12);
    var _r2506 = ɵɵreference(10);
    var ctx_r2512 = ɵɵnextContext();
    ɵɵadvance(1);
    ɵɵproperty("ngIf", ctx_r2512.icons.showPreviewIcon);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2508);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2506);
} }
function NzUploadListComponent_div_0_div_18_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "div", 45);
    ɵɵelement(1, "nz-progress", 46);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ɵɵnextContext().$implicit;
    ɵɵadvance(1);
    ɵɵproperty("nzPercent", file_r2497.percent)("nzShowInfo", false)("nzStrokeWidth", 2);
} }
function NzUploadListComponent_div_0_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "div", 1);
    ɵɵtemplate(1, NzUploadListComponent_div_0_ng_template_1_Template, 6, 3, "ng-template", null, 2, ɵɵtemplateRefExtractor);
    ɵɵtemplate(3, NzUploadListComponent_div_0_ng_template_3_Template, 3, 2, "ng-template", null, 3, ɵɵtemplateRefExtractor);
    ɵɵtemplate(5, NzUploadListComponent_div_0_ng_template_5_Template, 1, 1, "ng-template", null, 4, ɵɵtemplateRefExtractor);
    ɵɵtemplate(7, NzUploadListComponent_div_0_ng_template_7_Template, 3, 3, "ng-template", null, 5, ɵɵtemplateRefExtractor);
    ɵɵtemplate(9, NzUploadListComponent_div_0_ng_template_9_Template, 1, 1, "ng-template", null, 6, ɵɵtemplateRefExtractor);
    ɵɵtemplate(11, NzUploadListComponent_div_0_ng_template_11_Template, 1, 1, "ng-template", null, 7, ɵɵtemplateRefExtractor);
    ɵɵelementStart(13, "div", 8);
    ɵɵelementStart(14, "span");
    ɵɵtemplate(15, NzUploadListComponent_div_0_ng_template_15_Template, 0, 0, "ng-template", 9);
    ɵɵtemplate(16, NzUploadListComponent_div_0_ng_template_16_Template, 0, 0, "ng-template", 9);
    ɵɵelementEnd();
    ɵɵelementEnd();
    ɵɵtemplate(17, NzUploadListComponent_div_0_span_17_Template, 4, 3, "span", 10);
    ɵɵtemplate(18, NzUploadListComponent_div_0_div_18_Template, 2, 3, "div", 11);
    ɵɵelementEnd();
} if (rf & 2) {
    var file_r2497 = ctx.$implicit;
    var _r2498 = ɵɵreference(2);
    var _r2504 = ɵɵreference(8);
    var ctx_r2496 = ɵɵnextContext();
    ɵɵclassMapInterpolate2("ant-upload-list-item ant-upload-list-item-", file_r2497.status, " ant-upload-list-item-list-type-", ctx_r2496.listType, "");
    ɵɵproperty("@itemState", undefined)("nzTooltipTitle", file_r2497.status === "error" ? file_r2497.message : null);
    ɵɵattribute("data-key", file_r2497.key);
    ɵɵadvance(15);
    ɵɵproperty("ngTemplateOutlet", _r2498);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2504);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", ctx_r2496.listType === "picture-card" && !file_r2497.isUploading);
    ɵɵadvance(1);
    ɵɵproperty("ngIf", file_r2497.isUploading);
} }
var isImageFileType = function (type) { return !!type && type.indexOf('image/') === 0; };
var MEASURE_SIZE = 200;
var NzUploadListComponent = /** @class */ (function () {
    // #endregion
    function NzUploadListComponent(el, cdr, updateHostClassService, doc, // tslint:disable-line no-any
    ngZone, platform) {
        this.el = el;
        this.cdr = cdr;
        this.updateHostClassService = updateHostClassService;
        this.doc = doc;
        this.ngZone = ngZone;
        this.platform = platform;
        // #region fields
        // tslint:disable-next-line:no-any
        this.locale = {};
        // #endregion
        // #region styles
        this.prefixCls = 'ant-upload-list';
    }
    Object.defineProperty(NzUploadListComponent.prototype, "showPic", {
        get: function () {
            return this.listType === 'picture' || this.listType === 'picture-card';
        },
        enumerable: true,
        configurable: true
    });
    Object.defineProperty(NzUploadListComponent.prototype, "items", {
        set: function (list) {
            this.list = list;
        },
        enumerable: true,
        configurable: true
    });
    NzUploadListComponent.prototype.setClassMap = function () {
        var _a;
        var classMap = (_a = {},
            _a[this.prefixCls] = true,
            _a[this.prefixCls + "-" + this.listType] = true,
            _a);
        this.updateHostClassService.updateHostClass(this.el.nativeElement, classMap);
        return this;
    };
    // #endregion
    // #region render
    NzUploadListComponent.prototype.genErr = function (file) {
        if (file.response && typeof file.response === 'string') {
            return file.response;
        }
        return (file.error && file.error.statusText) || this.locale.uploadError;
    };
    NzUploadListComponent.prototype.extname = function (url) {
        var temp = url.split('/');
        var filename = temp[temp.length - 1];
        var filenameWithoutSuffix = filename.split(/#|\?/)[0];
        return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
    };
    NzUploadListComponent.prototype.isImageUrl = function (file) {
        if (isImageFileType(file.type)) {
            return true;
        }
        var url = (file.thumbUrl || file.url || '');
        if (!url) {
            return false;
        }
        var extension = this.extname(url);
        if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg)$/i.test(extension)) {
            return true;
        }
        else if (/^data:/.test(url)) {
            // other file types of base64
            return false;
        }
        else if (extension) {
            // other file types which have extension
            return false;
        }
        return true;
    };
    NzUploadListComponent.prototype.getIconType = function (file) {
        if (!this.showPic) {
            return '';
        }
        if (file.isUploading || (!file.thumbUrl && !file.url)) {
            return 'uploading';
        }
        else {
            return 'thumbnail';
        }
    };
    NzUploadListComponent.prototype.previewImage = function (file) {
        var _this = this;
        return new Promise(function (resolve) {
            if (!isImageFileType(file.type)) {
                resolve('');
                return;
            }
            _this.ngZone.runOutsideAngular(function () {
                var canvas = _this.doc.createElement('canvas');
                canvas.width = MEASURE_SIZE;
                canvas.height = MEASURE_SIZE;
                canvas.style.cssText = "position: fixed; left: 0; top: 0; width: " + MEASURE_SIZE + "px; height: " + MEASURE_SIZE + "px; z-index: 9999; display: none;";
                _this.doc.body.appendChild(canvas);
                var ctx = canvas.getContext('2d');
                var img = new Image();
                img.onload = function () {
                    var width = img.width, height = img.height;
                    var drawWidth = MEASURE_SIZE;
                    var drawHeight = MEASURE_SIZE;
                    var offsetX = 0;
                    var offsetY = 0;
                    if (width < height) {
                        drawHeight = height * (MEASURE_SIZE / width);
                        offsetY = -(drawHeight - drawWidth) / 2;
                    }
                    else {
                        drawWidth = width * (MEASURE_SIZE / height);
                        offsetX = -(drawWidth - drawHeight) / 2;
                    }
                    try {
                        ctx.drawImage(img, offsetX, offsetY, drawWidth, drawHeight);
                    }
                    catch (_a) { }
                    var dataURL = canvas.toDataURL();
                    _this.doc.body.removeChild(canvas);
                    resolve(dataURL);
                };
                img.src = window.URL.createObjectURL(file);
            });
        });
    };
    NzUploadListComponent.prototype.genThumb = function () {
        var _this = this;
        if (!this.platform.isBrowser) {
            return;
        }
        // tslint:disable-next-line:no-any
        var win = window;
        if (!this.showPic || typeof document === 'undefined' || typeof win === 'undefined' || !win.FileReader || !win.File) {
            return;
        }
        this.list
            .filter(function (file) { return file.originFileObj instanceof File && file.thumbUrl === undefined; })
            .forEach(function (file) {
            file.thumbUrl = '';
            (_this.previewFile ? _this.previewFile(file).toPromise() : _this.previewImage(file.originFileObj)).then(function (dataUrl) {
                file.thumbUrl = dataUrl;
                _this.detectChanges();
            });
        });
    };
    NzUploadListComponent.prototype.listItemNameCls = function (file) {
        var _a;
        var count = [this.showDownload(file), this.icons.showRemoveIcon].filter(function (x) { return x; }).length;
        return _a = {},
            _a[this.prefixCls + "-item-name"] = true,
            _a[this.prefixCls + "-item-name-icon-count-" + count] = true,
            _a;
    };
    NzUploadListComponent.prototype.showDownload = function (file) {
        return this.icons.showDownloadIcon && file.status === 'done' ? true : false;
    };
    NzUploadListComponent.prototype.fixData = function () {
        var _this = this;
        this.list.forEach(function (file) {
            file.message = _this.genErr(file);
            file.linkProps = typeof file.linkProps === 'string' ? JSON.parse(file.linkProps) : file.linkProps;
            file.isImageUrl = _this.isImageUrl(file);
            file.iconType = _this.getIconType(file);
            file.isUploading = file.status === 'uploading';
            file.listItemNameCls = _this.listItemNameCls(file);
            file.showDownload = _this.showDownload(file);
        });
        return this;
    };
    NzUploadListComponent.prototype.handlePreview = function (file, e) {
        if (!this.onPreview) {
            return;
        }
        e.preventDefault();
        return this.onPreview(file);
    };
    NzUploadListComponent.prototype.handleRemove = function (file, e) {
        e.preventDefault();
        if (this.onRemove) {
            this.onRemove(file);
        }
        return;
    };
    NzUploadListComponent.prototype.handleDownload = function (file) {
        if (typeof this.onDownload === 'function') {
            this.onDownload(file);
        }
        else if (file.url) {
            window.open(file.url);
        }
    };
    NzUploadListComponent.prototype.detectChanges = function () {
        this.fixData();
        this.cdr.detectChanges();
    };
    NzUploadListComponent.prototype.ngOnChanges = function () {
        this.fixData()
            .setClassMap()
            .genThumb();
    };
    /** @nocollapse */ NzUploadListComponent.ɵfac = function NzUploadListComponent_Factory(t) { return new (t || NzUploadListComponent)(ɵɵdirectiveInject(ElementRef), ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(NzUpdateHostClassService), ɵɵdirectiveInject(DOCUMENT), ɵɵdirectiveInject(NgZone), ɵɵdirectiveInject(Platform)); };
    /** @nocollapse */ NzUploadListComponent.ɵcmp = ɵɵdefineComponent({ type: NzUploadListComponent, selectors: [["nz-upload-list"]], inputs: { locale: "locale", listType: "listType", items: "items", icons: "icons", onPreview: "onPreview", onRemove: "onRemove", onDownload: "onDownload", previewFile: "previewFile", iconRender: "iconRender" }, exportAs: ["nzUploadList"], features: [ɵɵProvidersFeature([NzUpdateHostClassService]), ɵɵNgOnChangesFeature], decls: 1, vars: 1, consts: [["nz-tooltip", "", 3, "class", "nzTooltipTitle", 4, "ngFor", "ngForOf"], ["nz-tooltip", "", 3, "nzTooltipTitle"], ["icon", ""], ["iconNode", ""], ["downloadOrDelete", ""], ["preview", ""], ["removeIcon", ""], ["downloadIcon", ""], [1, "ant-upload-list-item-info"], [3, "ngTemplateOutlet"], ["class", "ant-upload-list-item-actions", 4, "ngIf"], ["class", "ant-upload-list-item-progress", 4, "ngIf"], [3, "ngSwitch"], ["class", "ant-upload-list-item-thumbnail", 3, "ant-upload-list-item-file", 4, "ngSwitchCase"], ["class", "ant-upload-list-item-thumbnail", "target", "_blank", "rel", "noopener noreferrer", 3, "ant-upload-list-item-file", "href", "click", 4, "ngSwitchCase"], ["class", "ant-upload-text-icon", 4, "ngSwitchDefault"], ["noImageThumbTpl", ""], [1, "ant-upload-list-item-thumbnail"], [3, "ngTemplateOutlet", "ngTemplateOutletContext"], ["target", "_blank", "rel", "noopener noreferrer", 1, "ant-upload-list-item-thumbnail", 3, "href", "click"], ["class", "ant-upload-list-item-image", 3, "src", 4, "ngIf", "ngIfElse"], [1, "ant-upload-list-item-image", 3, "src"], [1, "ant-upload-text-icon"], [4, "ngIf", "ngIfElse"], ["iconNodeFileIcon", ""], [4, "ngSwitchCase"], ["nz-icon", "", 3, "nzType", 4, "ngSwitchDefault"], ["nz-icon", "", "nzType", "loading"], ["nz-icon", "", 3, "nzType"], ["nz-icon", "", "nzTheme", "twotone", 3, "nzType"], [3, "class", 4, "ngIf"], [3, "title", 4, "ngIf"], [3, "title"], ["target", "_blank", "rel", "noopener noreferrer", 3, "ngClass", "title", "href", "click", 4, "ngIf"], [3, "ngClass", "title", "click", 4, "ngIf"], ["target", "_blank", "rel", "noopener noreferrer", 3, "ngClass", "title", "href", "click"], [3, "ngClass", "title", "click"], ["nz-icon", "", "nzType", "delete", 3, "title", "click", 4, "ngIf"], ["nz-icon", "", "nzType", "delete", 3, "title", "click"], ["nz-icon", "", "nzType", "download", 3, "title", "click", 4, "ngIf"], ["nz-icon", "", "nzType", "download", 3, "title", "click"], [1, "ant-upload-list-item-actions"], ["target", "_blank", "rel", "noopener noreferrer", 3, "href", "title", "ngStyle", "click", 4, "ngIf"], ["target", "_blank", "rel", "noopener noreferrer", 3, "href", "title", "ngStyle", "click"], ["nz-icon", "", "nzType", "eye"], [1, "ant-upload-list-item-progress"], ["nzType", "line", 3, "nzPercent", "nzShowInfo", "nzStrokeWidth"]], template: function NzUploadListComponent_Template(rf, ctx) { if (rf & 1) {
            ɵɵtemplate(0, NzUploadListComponent_div_0_Template, 19, 11, "div", 0);
        } if (rf & 2) {
            ɵɵproperty("ngForOf", ctx.list);
        } }, directives: [NgForOf, NzTooltipDirective, NgTemplateOutlet, NgIf, NgSwitch, NgSwitchCase, NgSwitchDefault, NzIconDirective, NgClass, NgStyle, NzProgressComponent], encapsulation: 2, data: { animation: [
                trigger('itemState', [
                    transition(':enter', [style({ height: '0', width: '0', opacity: 0 }), animate(150, style({ height: '*', width: '*', opacity: 1 }))]),
                    transition(':leave', [animate(150, style({ height: '0', width: '0', opacity: 0 }))])
                ])
            ] }, changeDetection: 0 });
    return NzUploadListComponent;
}());
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzUploadListComponent, [{
        type: Component,
        args: [{
                selector: 'nz-upload-list',
                exportAs: 'nzUploadList',
                templateUrl: './upload-list.component.html',
                providers: [NzUpdateHostClassService],
                animations: [
                    trigger('itemState', [
                        transition(':enter', [style({ height: '0', width: '0', opacity: 0 }), animate(150, style({ height: '*', width: '*', opacity: 1 }))]),
                        transition(':leave', [animate(150, style({ height: '0', width: '0', opacity: 0 }))])
                    ])
                ],
                preserveWhitespaces: false,
                encapsulation: ViewEncapsulation.None,
                changeDetection: ChangeDetectionStrategy.OnPush
            }]
    }], function () { return [{ type: ElementRef }, { type: ChangeDetectorRef }, { type: NzUpdateHostClassService }, { type: undefined, decorators: [{
                type: Inject,
                args: [DOCUMENT]
            }] }, { type: NgZone }, { type: Platform }]; }, { locale: [{
            type: Input
        }], listType: [{
            type: Input
        }], items: [{
            type: Input
        }], icons: [{
            type: Input
        }], onPreview: [{
            type: Input
        }], onRemove: [{
            type: Input
        }], onDownload: [{
            type: Input
        }], previewFile: [{
            type: Input
        }], iconRender: [{
            type: Input
        }] }); })();

var _c0$2 = ["uploadComp"];
var _c1$2 = ["listComp"];
var _c2$1 = function () { return []; };
function NzUploadComponent_ng_template_0_Template(rf, ctx) { if (rf & 1) {
    ɵɵelement(0, "nz-upload-list", 6, 7);
} if (rf & 2) {
    var ctx_r2581 = ɵɵnextContext();
    ɵɵstyleProp("display", ctx_r2581.nzShowUploadList ? "" : "none");
    ɵɵproperty("locale", ctx_r2581.locale)("listType", ctx_r2581.nzListType)("items", ctx_r2581.nzFileList || ɵɵpureFunction0(11, _c2$1))("icons", ctx_r2581.nzShowUploadList)("iconRender", ctx_r2581.nzIconRender)("previewFile", ctx_r2581.nzPreviewFile)("onPreview", ctx_r2581.nzPreview)("onRemove", ctx_r2581.onRemove)("onDownload", ctx_r2581.nzDownload);
} }
function NzUploadComponent_ng_template_2_Template(rf, ctx) { if (rf & 1) {
    ɵɵprojection(0);
} }
function NzUploadComponent_ng_template_4_ng_template_3_Template(rf, ctx) { }
function NzUploadComponent_ng_template_4_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementStart(0, "div", 8);
    ɵɵelementStart(1, "div", 9, 10);
    ɵɵtemplate(3, NzUploadComponent_ng_template_4_ng_template_3_Template, 0, 0, "ng-template", 11);
    ɵɵelementEnd();
    ɵɵelementEnd();
} if (rf & 2) {
    var ctx_r2585 = ɵɵnextContext();
    var _r2582 = ɵɵreference(3);
    ɵɵstyleProp("display", ctx_r2585.nzShowButton ? "" : "none");
    ɵɵproperty("ngClass", ctx_r2585.classList);
    ɵɵadvance(1);
    ɵɵproperty("options", ctx_r2585._btnOptions);
    ɵɵadvance(2);
    ɵɵproperty("ngTemplateOutlet", _r2582);
} }
function NzUploadComponent_ng_container_6_ng_template_5_Template(rf, ctx) { }
function NzUploadComponent_ng_container_6_ng_template_6_Template(rf, ctx) { }
var _c3 = function () { return { "ant-upload-btn": true }; };
function NzUploadComponent_ng_container_6_Template(rf, ctx) { if (rf & 1) {
    var _r2598 = ɵɵgetCurrentView();
    ɵɵelementContainerStart(0);
    ɵɵelementStart(1, "div", 12);
    ɵɵlistener("drop", function NzUploadComponent_ng_container_6_Template_div_drop_1_listener($event) { ɵɵrestoreView(_r2598); var ctx_r2597 = ɵɵnextContext(); return ctx_r2597.fileDrop($event); })("dragover", function NzUploadComponent_ng_container_6_Template_div_dragover_1_listener($event) { ɵɵrestoreView(_r2598); var ctx_r2599 = ɵɵnextContext(); return ctx_r2599.fileDrop($event); })("dragleave", function NzUploadComponent_ng_container_6_Template_div_dragleave_1_listener($event) { ɵɵrestoreView(_r2598); var ctx_r2600 = ɵɵnextContext(); return ctx_r2600.fileDrop($event); });
    ɵɵelementStart(2, "div", 13, 10);
    ɵɵelementStart(4, "div", 14);
    ɵɵtemplate(5, NzUploadComponent_ng_container_6_ng_template_5_Template, 0, 0, "ng-template", 11);
    ɵɵelementEnd();
    ɵɵelementEnd();
    ɵɵelementEnd();
    ɵɵtemplate(6, NzUploadComponent_ng_container_6_ng_template_6_Template, 0, 0, "ng-template", 11);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    var ctx_r2586 = ɵɵnextContext();
    var _r2582 = ɵɵreference(3);
    var _r2580 = ɵɵreference(1);
    ɵɵadvance(1);
    ɵɵproperty("ngClass", ctx_r2586.classList);
    ɵɵadvance(1);
    ɵɵproperty("options", ctx_r2586._btnOptions)("classes", ɵɵpureFunction0(5, _c3));
    ɵɵadvance(3);
    ɵɵproperty("ngTemplateOutlet", _r2582);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2580);
} }
function NzUploadComponent_ng_template_7_ng_container_0_ng_template_1_Template(rf, ctx) { }
function NzUploadComponent_ng_template_7_ng_container_0_ng_template_2_Template(rf, ctx) { }
function NzUploadComponent_ng_template_7_ng_container_0_Template(rf, ctx) { if (rf & 1) {
    ɵɵelementContainerStart(0);
    ɵɵtemplate(1, NzUploadComponent_ng_template_7_ng_container_0_ng_template_1_Template, 0, 0, "ng-template", 11);
    ɵɵtemplate(2, NzUploadComponent_ng_template_7_ng_container_0_ng_template_2_Template, 0, 0, "ng-template", 11);
    ɵɵelementContainerEnd();
} if (rf & 2) {
    ɵɵnextContext(2);
    var _r2580 = ɵɵreference(1);
    var _r2584 = ɵɵreference(5);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2580);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2584);
} }
function NzUploadComponent_ng_template_7_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadComponent_ng_template_7_ng_container_0_Template, 3, 2, "ng-container", 3);
} if (rf & 2) {
    var ctx_r2588 = ɵɵnextContext();
    var _r2589 = ɵɵreference(10);
    ɵɵproperty("ngIf", ctx_r2588.nzListType === "picture-card")("ngIfElse", _r2589);
} }
function NzUploadComponent_ng_template_9_ng_template_0_Template(rf, ctx) { }
function NzUploadComponent_ng_template_9_ng_template_1_Template(rf, ctx) { }
function NzUploadComponent_ng_template_9_Template(rf, ctx) { if (rf & 1) {
    ɵɵtemplate(0, NzUploadComponent_ng_template_9_ng_template_0_Template, 0, 0, "ng-template", 11);
    ɵɵtemplate(1, NzUploadComponent_ng_template_9_ng_template_1_Template, 0, 0, "ng-template", 11);
} if (rf & 2) {
    ɵɵnextContext();
    var _r2584 = ɵɵreference(5);
    var _r2580 = ɵɵreference(1);
    ɵɵproperty("ngTemplateOutlet", _r2584);
    ɵɵadvance(1);
    ɵɵproperty("ngTemplateOutlet", _r2580);
} }
var _c4 = ["*"];
var NzUploadComponent = /** @class */ (function () {
    // #endregion
    function NzUploadComponent(cdr, i18n) {
        var _this = this;
        this.cdr = cdr;
        this.i18n = i18n;
        // tslint:disable-next-line:no-any
        this.locale = {};
        // #region fields
        this.nzType = 'select';
        this.nzLimit = 0;
        this.nzSize = 0;
        this.nzDirectory = false;
        this.nzOpenFileDialogOnClick = true;
        this.nzFilter = [];
        this.nzFileList = [];
        this.nzDisabled = false;
        this.nzListType = 'text';
        this.nzMultiple = false;
        this.nzName = 'file';
        this._showUploadList = true;
        this.nzShowButton = true;
        this.nzWithCredentials = false;
        this.nzChange = new EventEmitter();
        this.nzFileListChange = new EventEmitter();
        this.onStart = function (file) {
            if (!_this.nzFileList) {
                _this.nzFileList = [];
            }
            var targetItem = _this.fileToObject(file);
            targetItem.status = 'uploading';
            _this.nzFileList = _this.nzFileList.concat(targetItem);
            _this.nzFileListChange.emit(_this.nzFileList);
            _this.nzChange.emit({ file: targetItem, fileList: _this.nzFileList, type: 'start' });
            _this.detectChangesList();
        };
        this.onProgress = function (e, file) {
            var fileList = _this.nzFileList;
            var targetItem = _this.getFileItem(file, fileList);
            targetItem.percent = e.percent;
            _this.nzChange.emit({
                event: e,
                file: __assign({}, targetItem),
                fileList: _this.nzFileList,
                type: 'progress'
            });
            _this.detectChangesList();
        };
        this.onSuccess = function (res, file) {
            var fileList = _this.nzFileList;
            var targetItem = _this.getFileItem(file, fileList);
            targetItem.status = 'done';
            targetItem.response = res;
            _this.nzChange.emit({
                file: __assign({}, targetItem),
                fileList: fileList,
                type: 'success'
            });
            _this.detectChangesList();
        };
        this.onError = function (err, file) {
            var fileList = _this.nzFileList;
            var targetItem = _this.getFileItem(file, fileList);
            targetItem.error = err;
            targetItem.status = 'error';
            _this.nzChange.emit({
                file: __assign({}, targetItem),
                fileList: fileList,
                type: 'error'
            });
            _this.detectChangesList();
        };
        this.onRemove = function (file) {
            _this.uploadComp.abort(file);
            file.status = 'removed';
            var fnRes = typeof _this.nzRemove === 'function' ? _this.nzRemove(file) : _this.nzRemove == null ? true : _this.nzRemove;
            (fnRes instanceof Observable ? fnRes : of(fnRes)).pipe(filter(function (res) { return res; })).subscribe(function () {
                _this.nzFileList = _this.removeFileItem(file, _this.nzFileList);
                _this.nzChange.emit({
                    file: file,
                    fileList: _this.nzFileList,
                    type: 'removed'
                });
                _this.nzFileListChange.emit(_this.nzFileList);
                _this.cdr.detectChanges();
            });
        };
        // #endregion
        // #region styles
        this.prefixCls = 'ant-upload';
        this.classList = [];
    }
    Object.defineProperty(NzUploadComponent.prototype, "nzShowUploadList", {
        get: function () {
            return this._showUploadList;
        },
        set: function (value) {
            this._showUploadList = typeof value === 'boolean' ? toBoolean(value) : value;
        },
        enumerable: true,
        configurable: true
    });
    NzUploadComponent.prototype.zipOptions = function () {
        var _this = this;
        if (typeof this.nzShowUploadList === 'boolean' && this.nzShowUploadList) {
            this.nzShowUploadList = {
                showPreviewIcon: true,
                showRemoveIcon: true,
                showDownloadIcon: true
            };
        }
        // filters
        var filters = this.nzFilter.slice();
        if (this.nzMultiple && this.nzLimit > 0 && filters.findIndex(function (w) { return w.name === 'limit'; }) === -1) {
            filters.push({
                name: 'limit',
                fn: function (fileList) { return fileList.slice(-_this.nzLimit); }
            });
        }
        if (this.nzSize > 0 && filters.findIndex(function (w) { return w.name === 'size'; }) === -1) {
            filters.push({
                name: 'size',
                fn: function (fileList) { return fileList.filter(function (w) { return w.size / 1024 <= _this.nzSize; }); }
            });
        }
        if (this.nzFileType && this.nzFileType.length > 0 && filters.findIndex(function (w) { return w.name === 'type'; }) === -1) {
            var types_1 = this.nzFileType.split(',');
            filters.push({
                name: 'type',
                fn: function (fileList) { return fileList.filter(function (w) { return ~types_1.indexOf(w.type); }); }
            });
        }
        this._btnOptions = {
            disabled: this.nzDisabled,
            accept: this.nzAccept,
            action: this.nzAction,
            directory: this.nzDirectory,
            openFileDialogOnClick: this.nzOpenFileDialogOnClick,
            beforeUpload: this.nzBeforeUpload,
            customRequest: this.nzCustomRequest,
            data: this.nzData,
            headers: this.nzHeaders,
            name: this.nzName,
            multiple: this.nzMultiple,
            withCredentials: this.nzWithCredentials,
            filters: filters,
            transformFile: this.nzTransformFile,
            onStart: this.onStart,
            onProgress: this.onProgress,
            onSuccess: this.onSuccess,
            onError: this.onError
        };
        return this;
    };
    // #region upload
    NzUploadComponent.prototype.fileToObject = function (file) {
        return {
            lastModified: file.lastModified,
            lastModifiedDate: file.lastModifiedDate,
            name: file.filename || file.name,
            size: file.size,
            type: file.type,
            uid: file.uid,
            response: file.response,
            error: file.error,
            percent: 0,
            // tslint:disable-next-line:no-any
            originFileObj: file
        };
    };
    NzUploadComponent.prototype.getFileItem = function (file, fileList) {
        return fileList.filter(function (item) { return item.uid === file.uid; })[0];
    };
    NzUploadComponent.prototype.removeFileItem = function (file, fileList) {
        return fileList.filter(function (item) { return item.uid !== file.uid; });
    };
    // skip safari bug
    NzUploadComponent.prototype.fileDrop = function (e) {
        if (e.type === this.dragState) {
            return;
        }
        this.dragState = e.type;
        this.setClassMap();
    };
    // #endregion
    // #region list
    NzUploadComponent.prototype.detectChangesList = function () {
        this.cdr.detectChanges();
        this.listComp.detectChanges();
    };
    NzUploadComponent.prototype.setClassMap = function () {
        var subCls = [];
        if (this.nzType === 'drag') {
            if (this.nzFileList.some(function (file) { return file.status === 'uploading'; })) {
                subCls.push(this.prefixCls + "-drag-uploading");
            }
            if (this.dragState === 'dragover') {
                subCls.push(this.prefixCls + "-drag-hover");
            }
        }
        else {
            subCls = [this.prefixCls + "-select-" + this.nzListType];
        }
        this.classList = __spread([
            this.prefixCls,
            this.prefixCls + "-" + this.nzType
        ], subCls, [
            (this.nzDisabled && this.prefixCls + "-disabled") || ''
        ]).filter(function (item) { return !!item; });
        this.cdr.detectChanges();
    };
    // #endregion
    NzUploadComponent.prototype.ngOnInit = function () {
        var _this = this;
        this.i18n$ = this.i18n.localeChange.subscribe(function () {
            _this.locale = _this.i18n.getLocaleData('Upload');
            _this.detectChangesList();
        });
    };
    NzUploadComponent.prototype.ngOnChanges = function () {
        this.zipOptions().setClassMap();
    };
    NzUploadComponent.prototype.ngOnDestroy = function () {
        this.i18n$.unsubscribe();
    };
    /** @nocollapse */ NzUploadComponent.ɵfac = function NzUploadComponent_Factory(t) { return new (t || NzUploadComponent)(ɵɵdirectiveInject(ChangeDetectorRef), ɵɵdirectiveInject(NzI18nService)); };
    /** @nocollapse */ NzUploadComponent.ɵcmp = ɵɵdefineComponent({ type: NzUploadComponent, selectors: [["nz-upload"]], viewQuery: function NzUploadComponent_Query(rf, ctx) { if (rf & 1) {
            ɵɵviewQuery(_c0$2, true);
            ɵɵviewQuery(_c1$2, true);
        } if (rf & 2) {
            var _t;
            ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.uploadComp = _t.first);
            ɵɵqueryRefresh(_t = ɵɵloadQuery()) && (ctx.listComp = _t.first);
        } }, hostVars: 2, hostBindings: function NzUploadComponent_HostBindings(rf, ctx) { if (rf & 2) {
            ɵɵclassProp("ant-upload-picture-card-wrapper", ctx.nzListType === "picture-card");
        } }, inputs: { nzType: "nzType", nzLimit: "nzLimit", nzSize: "nzSize", nzFileType: "nzFileType", nzAccept: "nzAccept", nzAction: "nzAction", nzDirectory: "nzDirectory", nzOpenFileDialogOnClick: "nzOpenFileDialogOnClick", nzBeforeUpload: "nzBeforeUpload", nzCustomRequest: "nzCustomRequest", nzData: "nzData", nzFilter: "nzFilter", nzFileList: "nzFileList", nzDisabled: "nzDisabled", nzHeaders: "nzHeaders", nzListType: "nzListType", nzMultiple: "nzMultiple", nzName: "nzName", nzShowUploadList: "nzShowUploadList", nzShowButton: "nzShowButton", nzWithCredentials: "nzWithCredentials", nzRemove: "nzRemove", nzPreview: "nzPreview", nzPreviewFile: "nzPreviewFile", nzTransformFile: "nzTransformFile", nzDownload: "nzDownload", nzIconRender: "nzIconRender" }, outputs: { nzChange: "nzChange", nzFileListChange: "nzFileListChange" }, exportAs: ["nzUpload"], features: [ɵɵNgOnChangesFeature], ngContentSelectors: _c4, decls: 11, vars: 2, consts: [["list", ""], ["con", ""], ["btn", ""], [4, "ngIf", "ngIfElse"], ["select", ""], ["pic", ""], [3, "locale", "listType", "items", "icons", "iconRender", "previewFile", "onPreview", "onRemove", "onDownload"], ["listComp", ""], [3, "ngClass"], ["nz-upload-btn", "", 3, "options"], ["uploadComp", ""], [3, "ngTemplateOutlet"], [3, "ngClass", "drop", "dragover", "dragleave"], ["nz-upload-btn", "", 3, "options", "classes"], [1, "ant-upload-drag-container"]], template: function NzUploadComponent_Template(rf, ctx) { if (rf & 1) {
            ɵɵprojectionDef();
            ɵɵtemplate(0, NzUploadComponent_ng_template_0_Template, 2, 12, "ng-template", null, 0, ɵɵtemplateRefExtractor);
            ɵɵtemplate(2, NzUploadComponent_ng_template_2_Template, 1, 0, "ng-template", null, 1, ɵɵtemplateRefExtractor);
            ɵɵtemplate(4, NzUploadComponent_ng_template_4_Template, 4, 5, "ng-template", null, 2, ɵɵtemplateRefExtractor);
            ɵɵtemplate(6, NzUploadComponent_ng_container_6_Template, 7, 6, "ng-container", 3);
            ɵɵtemplate(7, NzUploadComponent_ng_template_7_Template, 1, 2, "ng-template", null, 4, ɵɵtemplateRefExtractor);
            ɵɵtemplate(9, NzUploadComponent_ng_template_9_Template, 2, 2, "ng-template", null, 5, ɵɵtemplateRefExtractor);
        } if (rf & 2) {
            var _r2587 = ɵɵreference(8);
            ɵɵadvance(6);
            ɵɵproperty("ngIf", ctx.nzType === "drag")("ngIfElse", _r2587);
        } }, directives: [NgIf, NzUploadListComponent, NgClass, NzUploadBtnComponent, NgTemplateOutlet], encapsulation: 2, changeDetection: 0 });
    __decorate([
        InputNumber(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzLimit", void 0);
    __decorate([
        InputNumber(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzSize", void 0);
    __decorate([
        InputBoolean(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzDirectory", void 0);
    __decorate([
        InputBoolean(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzOpenFileDialogOnClick", void 0);
    __decorate([
        InputBoolean(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzDisabled", void 0);
    __decorate([
        InputBoolean(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzMultiple", void 0);
    __decorate([
        InputBoolean(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzShowButton", void 0);
    __decorate([
        InputBoolean(),
        __metadata("design:type", Object)
    ], NzUploadComponent.prototype, "nzWithCredentials", void 0);
    return NzUploadComponent;
}());
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzUploadComponent, [{
        type: Component,
        args: [{
                selector: 'nz-upload',
                exportAs: 'nzUpload',
                templateUrl: './upload.component.html',
                preserveWhitespaces: false,
                encapsulation: ViewEncapsulation.None,
                changeDetection: ChangeDetectionStrategy.OnPush,
                host: {
                    '[class.ant-upload-picture-card-wrapper]': 'nzListType === "picture-card"'
                }
            }]
    }], function () { return [{ type: ChangeDetectorRef }, { type: NzI18nService }]; }, { uploadComp: [{
            type: ViewChild,
            args: ['uploadComp', { static: false }]
        }], listComp: [{
            type: ViewChild,
            args: ['listComp', { static: false }]
        }], nzType: [{
            type: Input
        }], nzLimit: [{
            type: Input
        }], nzSize: [{
            type: Input
        }], nzFileType: [{
            type: Input
        }], nzAccept: [{
            type: Input
        }], nzAction: [{
            type: Input
        }], nzDirectory: [{
            type: Input
        }], nzOpenFileDialogOnClick: [{
            type: Input
        }], nzBeforeUpload: [{
            type: Input
        }], nzCustomRequest: [{
            type: Input
        }], nzData: [{
            type: Input
        }], nzFilter: [{
            type: Input
        }], nzFileList: [{
            type: Input
        }], nzDisabled: [{
            type: Input
        }], nzHeaders: [{
            type: Input
        }], nzListType: [{
            type: Input
        }], nzMultiple: [{
            type: Input
        }], nzName: [{
            type: Input
        }], nzShowUploadList: [{
            type: Input
        }], nzShowButton: [{
            type: Input
        }], nzWithCredentials: [{
            type: Input
        }], nzRemove: [{
            type: Input
        }], nzPreview: [{
            type: Input
        }], nzPreviewFile: [{
            type: Input
        }], nzTransformFile: [{
            type: Input
        }], nzDownload: [{
            type: Input
        }], nzIconRender: [{
            type: Input
        }], nzChange: [{
            type: Output
        }], nzFileListChange: [{
            type: Output
        }] }); })();

/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */
var NzUploadModule = /** @class */ (function () {
    function NzUploadModule() {
    }
    /** @nocollapse */ NzUploadModule.ɵmod = ɵɵdefineNgModule({ type: NzUploadModule });
    /** @nocollapse */ NzUploadModule.ɵinj = ɵɵdefineInjector({ factory: function NzUploadModule_Factory(t) { return new (t || NzUploadModule)(); }, imports: [[CommonModule, FormsModule, PlatformModule, NzToolTipModule, NzProgressModule, NzI18nModule, NzIconModule]] });
    return NzUploadModule;
}());
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵɵsetNgModuleScope(NzUploadModule, { declarations: [NzUploadComponent, NzUploadBtnComponent, NzUploadListComponent], imports: [CommonModule, FormsModule, PlatformModule, NzToolTipModule, NzProgressModule, NzI18nModule, NzIconModule], exports: [NzUploadComponent] }); })();
/*@__PURE__*/ (function () { ɵsetClassMetadata(NzUploadModule, [{
        type: NgModule,
        args: [{
                imports: [CommonModule, FormsModule, PlatformModule, NzToolTipModule, NzProgressModule, NzI18nModule, NzIconModule],
                declarations: [NzUploadComponent, NzUploadBtnComponent, NzUploadListComponent],
                exports: [NzUploadComponent]
            }]
    }], null, null); })();

/**
 * @license
 * Copyright Alibaba.com All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
 */

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

export { NzUploadBtnComponent, NzUploadComponent, NzUploadListComponent, NzUploadModule };
//# sourceMappingURL=ng-zorro-antd-upload.js.map
