import * as _angular_core from '@angular/core';
import { TemplateRef, OnInit, ElementRef, OnChanges, AfterViewInit, EventEmitter } from '@angular/core';
import { Observable, Subscription } from 'rxjs';
import { NzSafeAny, IndexableObject, BooleanInput } from 'ng-zorro-antd/core/types';
import * as _angular_cdk_bidi from '@angular/cdk/bidi';
import { NzUploadI18nInterface } from 'ng-zorro-antd/i18n';

/**
 * 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
 */

/** Status */
type UploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
type NzUploadType = 'select' | 'drag';
/** Built-in styles of the uploading list. */
type NzUploadListType = 'text' | 'picture' | 'picture-card';
interface NzUploadFile {
    uid: string;
    size?: number;
    name: string;
    filename?: string;
    lastModified?: string;
    lastModifiedDate?: Date;
    url?: string;
    status?: UploadFileStatus;
    originFileObj?: File;
    percent?: number;
    thumbUrl?: string;
    response?: NzSafeAny;
    error?: NzSafeAny;
    linkProps?: {
        download: string;
    };
    type?: string;
    [key: string]: NzSafeAny;
}
interface NzUploadChangeParam {
    file: NzUploadFile;
    fileList: NzUploadFile[];
    event?: {
        percent: number;
    };
    /** Callback type. */
    type?: string;
}
type NzShowUploadListIcon = boolean | ((file: NzUploadFile) => boolean);
interface NzShowUploadList {
    showRemoveIcon?: NzShowUploadListIcon;
    showPreviewIcon?: NzShowUploadListIcon;
    showDownloadIcon?: NzShowUploadListIcon;
    extra?: TemplateRef<{
        $implicit: NzUploadFile;
    }>;
    downloadIcon?: TemplateRef<{
        $implicit: NzUploadFile;
    }>;
    removeIcon?: TemplateRef<{
        $implicit: NzUploadFile;
    }>;
    previewIcon?: TemplateRef<{
        $implicit: NzUploadFile;
    }>;
}
type NzBeforeUploadFileType = boolean | Observable<boolean | NzUploadFile | Blob | File | boolean> | Promise<boolean | NzUploadFile | Blob | File | boolean>;
interface ZipButtonOptions {
    disabled?: boolean;
    accept?: string | string[];
    action?: string | ((file: NzUploadFile) => string | Observable<string>);
    directory?: boolean;
    openFileDialogOnClick?: boolean;
    beforeUpload?(file: NzUploadFile, fileList: NzUploadFile[]): NzBeforeUploadFileType;
    customRequest?(item: NzSafeAny): Subscription;
    data?: {} | ((file: NzUploadFile) => {} | Observable<{}>);
    headers?: {} | ((file: NzUploadFile) => {} | Observable<{}>);
    name?: string;
    multiple?: boolean;
    withCredentials?: boolean;
    filters?: UploadFilter[];
    onStart?(file: NzUploadFile): void;
    onProgress?(e: NzSafeAny, file: NzUploadFile): void;
    onSuccess?(ret: NzSafeAny, file: NzUploadFile, xhr: NzSafeAny): void;
    onError?(err: NzSafeAny, file: NzUploadFile): void;
}
interface UploadFilter {
    name: string;
    fn(fileList: NzUploadFile[]): NzUploadFile[] | Observable<NzUploadFile[]>;
}
interface NzUploadXHRArgs {
    action?: string;
    name?: string;
    headers?: IndexableObject;
    file: NzUploadFile;
    postFile: string | Blob | File | NzUploadFile;
    data?: IndexableObject;
    withCredentials?: boolean;
    onProgress?(e: NzSafeAny, file: NzUploadFile): void;
    onSuccess?(ret: NzSafeAny, file: NzUploadFile, xhr: NzSafeAny): void;
    onError?(err: NzSafeAny, file: NzUploadFile): void;
}
type NzIconRenderTemplate = TemplateRef<{
    $implicit: NzUploadFile;
}>;

declare class NzUploadBtnComponent implements OnInit {
    reqs: Record<string, Subscription>;
    private destroyed;
    file: ElementRef<HTMLInputElement>;
    readonly nzId: _angular_core.InputSignal<string | undefined>;
    options: ZipButtonOptions;
    onClick(): void;
    onFileDrop(e: DragEvent): void;
    onChange(e: Event): void;
    private traverseFileTree;
    private attrAccept;
    private attachUid;
    uploadFiles(fileList: FileList | File[]): void;
    private upload;
    private post;
    private xhr;
    private clean;
    abort(file?: NzUploadFile): void;
    private http;
    private elementRef;
    private destroyRef;
    constructor();
    ngOnInit(): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<NzUploadBtnComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<NzUploadBtnComponent, "[nz-upload-btn]", ["nzUploadBtn"], { "nzId": { "alias": "nzId"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; }; }, {}, never, ["*"], true, never>;
}

type UploadListIconType = '' | 'uploading' | 'thumbnail';
interface UploadListFile extends NzUploadFile {
    isImageUrl?: boolean;
    isUploading?: boolean;
    iconType?: UploadListIconType;
    showDownload?: boolean;
    showRemove?: boolean;
    showPreview?: boolean;
}
declare class NzUploadListComponent implements OnChanges {
    list: UploadListFile[];
    readonly listType: _angular_core.InputSignal<NzUploadListType>;
    locale: NzSafeAny;
    set items(list: NzUploadFile[]);
    icons: NzShowUploadList;
    onPreview?: (file: NzUploadFile) => void;
    onRemove: (file: NzUploadFile) => void;
    onDownload?: (file: NzUploadFile) => void;
    previewFile?: (file: NzUploadFile) => Observable<string>;
    previewIsImage?: (file: NzUploadFile) => boolean;
    iconRender: NzIconRenderTemplate | null;
    private readonly document;
    private readonly destroyRef;
    private readonly ngZone;
    private readonly cdr;
    private readonly platform;
    private readonly dir;
    protected readonly class: _angular_core.Signal<string[]>;
    private readonly showPic;
    protected readonly itemAnimationEnter: _angular_core.Signal<string>;
    protected readonly itemAnimationLeave: _angular_core.Signal<string>;
    private genErr;
    private extname;
    isImageUrl(file: NzUploadFile): boolean;
    private getIconType;
    private previewImage;
    private genThumb;
    private resolveShowIcon;
    private fixData;
    handlePreview(file: NzUploadFile, e: Event): void;
    handleRemove(file: NzUploadFile, e: Event): void;
    handleDownload(file: NzUploadFile): void;
    detectChanges(): void;
    ngOnChanges(): void;
    private generateClass;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<NzUploadListComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<NzUploadListComponent, "nz-upload-list", ["nzUploadList"], { "listType": { "alias": "listType"; "required": false; "isSignal": true; }; "locale": { "alias": "locale"; "required": false; }; "items": { "alias": "items"; "required": false; }; "icons": { "alias": "icons"; "required": false; }; "onPreview": { "alias": "onPreview"; "required": false; }; "onRemove": { "alias": "onRemove"; "required": false; }; "onDownload": { "alias": "onDownload"; "required": false; }; "previewFile": { "alias": "previewFile"; "required": false; }; "previewIsImage": { "alias": "previewIsImage"; "required": false; }; "iconRender": { "alias": "iconRender"; "required": false; }; }, {}, never, never, true, never>;
}

declare class NzUploadComponent implements OnInit, AfterViewInit, OnChanges {
    static ngAcceptInputType_nzShowUploadList: BooleanInput | NzShowUploadList;
    private readonly cdr;
    private readonly i18n;
    private readonly destroyRef;
    private readonly document;
    private readonly platform;
    protected readonly dir: _angular_core.WritableSignal<_angular_cdk_bidi.Direction>;
    uploadComp: NzUploadBtnComponent;
    listComp: NzUploadListComponent;
    locale: NzUploadI18nInterface;
    readonly nzId: _angular_core.InputSignal<string | undefined>;
    nzType: NzUploadType;
    nzLimit: number;
    nzSize: number;
    nzFileType?: string;
    nzAccept?: string | string[];
    nzAction?: string | ((file: NzUploadFile) => string | Observable<string>);
    nzDirectory: boolean;
    nzOpenFileDialogOnClick: boolean;
    nzBeforeUpload?: (file: NzUploadFile, fileList: NzUploadFile[]) => NzBeforeUploadFileType;
    nzCustomRequest?: (item: NzUploadXHRArgs) => Subscription;
    nzData?: {} | ((file: NzUploadFile) => {} | Observable<{}>);
    nzFilter: UploadFilter[];
    nzFileList: NzUploadFile[];
    nzDisabled: boolean;
    nzHeaders?: {} | ((file: NzUploadFile) => {} | Observable<{}>);
    nzListType: NzUploadListType;
    nzMultiple: boolean;
    nzName: string;
    private _showUploadList;
    set nzShowUploadList(value: boolean | NzShowUploadList);
    get nzShowUploadList(): boolean | NzShowUploadList;
    nzShowButton: boolean;
    nzWithCredentials: boolean;
    nzRemove?: (file: NzUploadFile) => boolean | Observable<boolean>;
    nzPreview?: (file: NzUploadFile) => void;
    nzPreviewFile?: (file: NzUploadFile) => Observable<string>;
    nzPreviewIsImage?: (file: NzUploadFile) => boolean;
    nzDownload?: (file: NzUploadFile) => void;
    nzIconRender: NzIconRenderTemplate | null;
    nzFileListRender: TemplateRef<{
        $implicit: NzUploadFile[];
    }> | null;
    readonly nzMaxCount: _angular_core.InputSignal<number | undefined>;
    readonly nzChange: EventEmitter<NzUploadChangeParam>;
    readonly nzFileListChange: EventEmitter<NzUploadFile[]>;
    _btnOptions?: ZipButtonOptions;
    private zipOptions;
    private fileToObject;
    private getFileItem;
    private removeFileItem;
    private onStart;
    private onProgress;
    private onSuccess;
    private onError;
    private dragState?;
    fileDrop(e: DragEvent): void;
    private detectChangesList;
    onRemove: (file: NzUploadFile) => void;
    protected readonly classList: _angular_core.WritableSignal<string[]>;
    private setClassMap;
    ngOnInit(): void;
    ngAfterViewInit(): void;
    ngOnChanges(): void;
    private generateClass;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<NzUploadComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<NzUploadComponent, "nz-upload", ["nzUpload"], { "nzId": { "alias": "nzId"; "required": false; "isSignal": true; }; "nzType": { "alias": "nzType"; "required": false; }; "nzLimit": { "alias": "nzLimit"; "required": false; }; "nzSize": { "alias": "nzSize"; "required": false; }; "nzFileType": { "alias": "nzFileType"; "required": false; }; "nzAccept": { "alias": "nzAccept"; "required": false; }; "nzAction": { "alias": "nzAction"; "required": false; }; "nzDirectory": { "alias": "nzDirectory"; "required": false; }; "nzOpenFileDialogOnClick": { "alias": "nzOpenFileDialogOnClick"; "required": false; }; "nzBeforeUpload": { "alias": "nzBeforeUpload"; "required": false; }; "nzCustomRequest": { "alias": "nzCustomRequest"; "required": false; }; "nzData": { "alias": "nzData"; "required": false; }; "nzFilter": { "alias": "nzFilter"; "required": false; }; "nzFileList": { "alias": "nzFileList"; "required": false; }; "nzDisabled": { "alias": "nzDisabled"; "required": false; }; "nzHeaders": { "alias": "nzHeaders"; "required": false; }; "nzListType": { "alias": "nzListType"; "required": false; }; "nzMultiple": { "alias": "nzMultiple"; "required": false; }; "nzName": { "alias": "nzName"; "required": false; }; "nzShowUploadList": { "alias": "nzShowUploadList"; "required": false; }; "nzShowButton": { "alias": "nzShowButton"; "required": false; }; "nzWithCredentials": { "alias": "nzWithCredentials"; "required": false; }; "nzRemove": { "alias": "nzRemove"; "required": false; }; "nzPreview": { "alias": "nzPreview"; "required": false; }; "nzPreviewFile": { "alias": "nzPreviewFile"; "required": false; }; "nzPreviewIsImage": { "alias": "nzPreviewIsImage"; "required": false; }; "nzDownload": { "alias": "nzDownload"; "required": false; }; "nzIconRender": { "alias": "nzIconRender"; "required": false; }; "nzFileListRender": { "alias": "nzFileListRender"; "required": false; }; "nzMaxCount": { "alias": "nzMaxCount"; "required": false; "isSignal": true; }; }, { "nzChange": "nzChange"; "nzFileListChange": "nzFileListChange"; }, never, ["*"], true, never>;
    static ngAcceptInputType_nzLimit: unknown;
    static ngAcceptInputType_nzSize: unknown;
    static ngAcceptInputType_nzDirectory: unknown;
    static ngAcceptInputType_nzOpenFileDialogOnClick: unknown;
    static ngAcceptInputType_nzDisabled: unknown;
    static ngAcceptInputType_nzMultiple: unknown;
    static ngAcceptInputType_nzShowButton: unknown;
    static ngAcceptInputType_nzWithCredentials: unknown;
}

declare class NzUploadModule {
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<NzUploadModule, never>;
    static ɵmod: _angular_core.ɵɵNgModuleDeclaration<NzUploadModule, never, [typeof NzUploadComponent, typeof NzUploadBtnComponent, typeof NzUploadListComponent], [typeof NzUploadComponent]>;
    static ɵinj: _angular_core.ɵɵInjectorDeclaration<NzUploadModule>;
}

export { NzUploadBtnComponent, NzUploadComponent, NzUploadListComponent, NzUploadModule };
export type { NzBeforeUploadFileType, NzIconRenderTemplate, NzShowUploadList, NzShowUploadListIcon, NzUploadChangeParam, NzUploadFile, NzUploadListType, NzUploadType, NzUploadXHRArgs, UploadFileStatus, UploadFilter, ZipButtonOptions };
