import { X as He, Y as qe, Z as We, $ as Ge, n as Ve, _ as O, a0 as Ke, i as ve, a1 as Q, a2 as J, j as se, a3 as B, f as V, a4 as w, d as S, u as he, a5 as Je, a6 as Ye, a7 as Ze, a8 as Qe, a9 as ke, aa as et, ab as tt, ac as nt, ad as ot, ae as rt, N as be, af as it, p as at, U as $e, ag as Re, t as Pe, ah as De, ai as lt, g as st, m as ct, aj as dt, r as ut, E as pt, I as ft, z as mt, h as ue, ak as gt, al as vt, c as k, am as ht } from "./index2.js"; import { defineComponent as Y, ref as ne, onMounted as ce, onBeforeUnmount as Oe, createVNode as m, shallowRef as te, watch as Te, computed as oe, Transition as wt, withDirectives as _e, vShow as Ue, watchEffect as yt, triggerRef as bt, TransitionGroup as $t, toRef as It } from "vue"; import { P as Ct } from "./index6.js"; function St(e, t, n, o) { for (var i = -1, a = e == null ? 0 : e.length; ++i < a; ) { var r = e[i]; t(o, r, n(r), e); } return o; } function xt(e) { return function(t, n, o) { for (var i = -1, a = Object(t), r = o(t), s = r.length; s--; ) { var y = r[++i]; if (n(a[y], y, a) === !1) break; } return t; }; } var Ft = xt(); function Rt(e, t) { return e && Ft(e, t, He); } function Pt(e, t) { return function(n, o) { if (n == null) return n; if (!qe(n)) return e(n, o); for (var i = n.length, a = -1, r = Object(n); ++a < i && o(r[a], a, r) !== !1; ) ; return n; }; } var Dt = Pt(Rt); function Ot(e, t, n, o) { return Dt(e, function(i, a, r) { t(o, i, n(i), r); }), o; } function Tt(e, t) { return function(n, o) { var i = Ge(n) ? St : Ot, a = t ? t() : {}; return i(n, e, We(o), a); }; } var _t = Tt(function(e, t, n) { e[n ? 0 : 1].push(t); }, function() { return [[], []]; }); function Ut(e, t) { const n = `cannot ${e.method} ${e.action} ${t.status}'`, o = new Error(n); return o.status = t.status, o.method = e.method, o.url = e.action, o; } function Ie(e) { const t = e.responseText || e.response; if (!t) return t; try { return JSON.parse(t); } catch (n) { return t; } } function At(e) { const t = new XMLHttpRequest(); e.onProgress && t.upload && (t.upload.onprogress = function(a) { a.total > 0 && (a.percent = a.loaded / a.total * 100), e.onProgress(a); }); const n = new FormData(); e.data && Object.keys(e.data).forEach((i) => { const a = e.data[i]; if (Array.isArray(a)) { a.forEach((r) => { n.append(`${i}[]`, r); }); return; } n.append(i, a); }), e.file instanceof Blob ? n.append(e.filename, e.file, e.file.name) : n.append(e.filename, e.file), t.onerror = function(a) { e.onError(a); }, t.onload = function() { return t.status < 200 || t.status >= 300 ? e.onError(Ut(e, t), Ie(t)) : e.onSuccess(Ie(t), t); }, t.open(e.method, e.action, !0), e.withCredentials && "withCredentials" in t && (t.withCredentials = !0); const o = e.headers || {}; return o["X-Requested-With"] !== null && t.setRequestHeader("X-Requested-With", "XMLHttpRequest"), Object.keys(o).forEach((i) => { o[i] !== null && t.setRequestHeader(i, o[i]); }), t.send(n), { abort() { t.abort(); } }; } const Lt = +/* @__PURE__ */ new Date(); let Et = 0; function pe() { return `vc-upload-${Lt}-${++Et}`; } const fe = (e, t) => { if (e && t) { const n = Array.isArray(t) ? t : t.split(","), o = e.name || "", i = e.type || "", a = i.replace(/\/.*$/, ""); return n.some((r) => { const s = r.trim(); if (/^\*(\/\*)?$/.test(r)) return !0; if (s.charAt(0) === ".") { const y = o.toLowerCase(), F = s.toLowerCase(); let g = [F]; return (F === ".jpg" || F === ".jpeg") && (g = [".jpg", ".jpeg"]), g.some((T) => y.endsWith(T)); } return /\/\*$/.test(s) ? a === s.replace(/\/.*$/, "") : i === s ? !0 : /^\w+$/.test(s) ? (Ve(!1, `Upload takes an invalidate 'accept' type '${s}'.Skip for check.`), !0) : !1; }); } return !0; }; function jt(e, t) { const n = e.createReader(); let o = []; function i() { n.readEntries((a) => { const r = Array.prototype.slice.apply(a); o = o.concat(r), !r.length ? t(o) : i(); }); } i(); } const Mt = (e, t, n) => { const o = (i, a) => { i.path = a || "", i.isFile ? i.file((r) => { n(r) && (i.fullPath && !r.webkitRelativePath && (Object.defineProperties(r, { webkitRelativePath: { writable: !0 } }), r.webkitRelativePath = i.fullPath.replace(/^\//, ""), Object.defineProperties(r, { webkitRelativePath: { writable: !1 } })), t([r])); }) : i.isDirectory && jt(i, (r) => { r.forEach((s) => { o(s, `${a}${i.name}/`); }); }); }; e.forEach((i) => { o(i.webkitGetAsEntry()); }); }, Ae = () => ({ capture: [Boolean, String], multipart: { type: Boolean, default: void 0 }, name: String, disabled: { type: Boolean, default: void 0 }, componentTag: String, action: [String, Function], method: String, directory: { type: Boolean, default: void 0 }, data: [Object, Function], headers: Object, accept: String, multiple: { type: Boolean, default: void 0 }, onBatchStart: Function, onReject: Function, onStart: Function, onError: Function, onSuccess: Function, onProgress: Function, beforeUpload: Function, customRequest: Function, withCredentials: { type: Boolean, default: void 0 }, openFileDialogOnClick: { type: Boolean, default: void 0 }, prefixCls: String, id: String, onMouseenter: Function, onMouseleave: Function, onClick: Function }); var Bt = function(e, t, n, o) { function i(a) { return a instanceof n ? a : new n(function(r) { r(a); }); } return new (n || (n = Promise))(function(a, r) { function s(g) { try { F(o.next(g)); } catch (T) { r(T); } } function y(g) { try { F(o.throw(g)); } catch (T) { r(T); } } function F(g) { g.done ? a(g.value) : i(g.value).then(s, y); } F((o = o.apply(e, t || [])).next()); }); }, zt = function(e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++) t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]); return n; }; const Nt = Y({ compatConfig: { MODE: 3 }, name: "AjaxUploader", inheritAttrs: !1, props: Ae(), setup(e, t) { let { slots: n, attrs: o, expose: i } = t; const a = ne(pe()), r = {}, s = ne(); let y = !1; const F = (d, v) => Bt(this, void 0, void 0, function* () { const { beforeUpload: $ } = e; let I = d; if ($) { try { I = yield $(d, v); } catch (p) { I = !1; } if (I === !1) return { origin: d, parsedFile: null, action: null, data: null }; } const { action: P } = e; let U; typeof P == "function" ? U = yield P(d) : U = P; const { data: j } = e; let A; typeof j == "function" ? A = yield j(d) : A = j; const M = ( // string type is from legacy `transformFile`. // Not sure if this will work since no related test case works with it (typeof I == "object" || typeof I == "string") && I ? I : d ); let c; M instanceof File ? c = M : c = new File([M], d.name, { type: d.type }); const u = c; return u.uid = d.uid, { origin: d, data: A, parsedFile: u, action: U }; }), g = (d) => { let { data: v, origin: $, action: I, parsedFile: P } = d; if (!y) return; const { onStart: U, customRequest: j, name: A, headers: M, withCredentials: c, method: u } = e, { uid: p } = $, f = j || At, h = { action: I, filename: A, data: v, file: P, headers: M, withCredentials: c, method: u || "post", onProgress: (C) => { const { onProgress: D } = e; D == null || D(C, P); }, onSuccess: (C, D) => { const { onSuccess: x } = e; x == null || x(C, P, D), delete r[p]; }, onError: (C, D) => { const { onError: x } = e; x == null || x(C, D, P), delete r[p]; } }; U($), r[p] = f(h); }, T = () => { a.value = pe(); }, R = (d) => { if (d) { const v = d.uid ? d.uid : d; r[v] && r[v].abort && r[v].abort(), delete r[v]; } else Object.keys(r).forEach((v) => { r[v] && r[v].abort && r[v].abort(), delete r[v]; }); }; ce(() => { y = !0; }), Oe(() => { y = !1, R(); }); const _ = (d) => { const v = [...d], $ = v.map((I) => (I.uid = pe(), F(I, v))); Promise.all($).then((I) => { const { onBatchStart: P } = e; P == null || P(I.map((U) => { let { origin: j, parsedFile: A } = U; return { file: j, parsedFile: A }; })), I.filter((U) => U.parsedFile !== null).forEach((U) => { g(U); }); }); }, z = (d) => { const { accept: v, directory: $ } = e, { files: I } = d.target, P = [...I].filter((U) => !$ || fe(U, v)); _(P), T(); }, l = (d) => { const v = s.value; if (!v) return; const { onClick: $ } = e; v.click(), $ && $(d); }, b = (d) => { d.key === "Enter" && l(d); }, L = (d) => { const { multiple: v } = e; if (d.preventDefault(), d.type !== "dragover") if (e.directory) Mt(Array.prototype.slice.call(d.dataTransfer.items), _, ($) => fe($, e.accept)); else { const $ = _t(Array.prototype.slice.call(d.dataTransfer.files), (U) => fe(U, e.accept)); let I = $[0]; const P = $[1]; v === !1 && (I = I.slice(0, 1)), _(I), P.length && e.onReject && e.onReject(P); } }; return i({ abort: R }), () => { var d; const { componentTag: v, prefixCls: $, disabled: I, id: P, multiple: U, accept: j, capture: A, directory: M, openFileDialogOnClick: c, onMouseenter: u, onMouseleave: p } = e, f = zt(e, ["componentTag", "prefixCls", "disabled", "id", "multiple", "accept", "capture", "directory", "openFileDialogOnClick", "onMouseenter", "onMouseleave"]), h = { [$]: !0, [`${$}-disabled`]: I, [o.class]: !!o.class }, C = M ? { directory: "directory", webkitdirectory: "webkitdirectory" } : {}; return m(v, O(O({}, I ? {} : { onClick: c ? l : () => { }, onKeydown: c ? b : () => { }, onMouseenter: u, onMouseleave: p, onDrop: L, onDragover: L, tabindex: "0" }), {}, { class: h, role: "button", style: o.style }), { default: () => [m("input", O(O(O({}, Ke(f, { aria: !0, data: !0 })), {}, { id: P, type: "file", ref: s, onClick: (x) => x.stopPropagation(), onCancel: (x) => x.stopPropagation(), key: a.value, style: { display: "none" }, accept: j }, C), {}, { multiple: U, onChange: z }, A != null ? { capture: A } : {}), null), (d = n.default) === null || d === void 0 ? void 0 : d.call(n)] }); }; } }); function me() { } const Ce = Y({ compatConfig: { MODE: 3 }, name: "Upload", inheritAttrs: !1, props: ve(Ae(), { componentTag: "span", prefixCls: "rc-upload", data: {}, headers: {}, name: "file", multipart: !1, onStart: me, onError: me, onSuccess: me, multiple: !1, beforeUpload: null, customRequest: null, withCredentials: !1, openFileDialogOnClick: !0 }), setup(e, t) { let { slots: n, attrs: o, expose: i } = t; const a = ne(); return i({ abort: (s) => { var y; (y = a.value) === null || y === void 0 || y.abort(s); } }), () => m(Nt, O(O(O({}, e), o), {}, { ref: a }), n); } }); function Le() { return { capture: Q([Boolean, String]), type: J(), name: String, defaultFileList: se(), fileList: se(), action: Q([String, Function]), directory: B(), data: Q([Object, Function]), method: J(), headers: V(), showUploadList: Q([Boolean, Object]), multiple: B(), accept: String, beforeUpload: w(), onChange: w(), "onUpdate:fileList": w(), onDrop: w(), listType: J(), onPreview: w(), onDownload: w(), onReject: w(), onRemove: w(), /** @deprecated Please use `onRemove` directly */ remove: w(), supportServerRender: B(), disabled: B(), prefixCls: String, customRequest: w(), withCredentials: B(), openFileDialogOnClick: B(), locale: V(), id: String, previewFile: w(), /** @deprecated Please use `beforeUpload` directly */ transformFile: w(), iconRender: w(), isImageUrl: w(), progress: V(), itemRender: w(), /** Config max count of `fileList`. Will replace current one when `maxCount` is 1 */ maxCount: Number, height: Q([Number, String]), removeIcon: w(), downloadIcon: w(), previewIcon: w() }; } function Xt() { return { listType: J(), onPreview: w(), onDownload: w(), onRemove: w(), items: se(), progress: V(), prefixCls: J(), showRemoveIcon: B(), showDownloadIcon: B(), showPreviewIcon: B(), removeIcon: w(), downloadIcon: w(), previewIcon: w(), locale: V(void 0), previewFile: w(), iconRender: w(), isImageUrl: w(), appendAction: w(), appendActionVisible: B(), itemRender: w() }; } function re(e) { return S(S({}, e), { lastModified: e.lastModified, lastModifiedDate: e.lastModifiedDate, name: e.name, size: e.size, type: e.type, uid: e.uid, percent: 0, originFileObj: e }); } function ie(e, t) { const n = [...t], o = n.findIndex((i) => { let { uid: a } = i; return a === e.uid; }); return o === -1 ? n.push(e) : n[o] = e, n; } function ge(e, t) { const n = e.uid !== void 0 ? "uid" : "name"; return t.filter((o) => o[n] === e[n])[0]; } function Ht(e, t) { const n = e.uid !== void 0 ? "uid" : "name", o = t.filter((i) => i[n] !== e[n]); return o.length === t.length ? null : o; } const qt = function() { const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "").split("/"), o = t[t.length - 1].split(/#|\?/)[0]; return (/\.[^./\\]*$/.exec(o) || [""])[0]; }, Ee = (e) => e.indexOf("image/") === 0, Wt = (e) => { if (e.type && !e.thumbUrl) return Ee(e.type); const t = e.thumbUrl || e.url || "", n = qt(t); return /^data:image\//.test(t) || /(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico)$/i.test(n) ? !0 : !(/^data:/.test(t) || n); }, G = 200; function Gt(e) { return new Promise((t) => { if (!e.type || !Ee(e.type)) { t(""); return; } const n = document.createElement("canvas"); n.width = G, n.height = G, n.style.cssText = `position: fixed; left: 0; top: 0; width: ${G}px; height: ${G}px; z-index: 9999; display: none;`, document.body.appendChild(n); const o = n.getContext("2d"), i = new Image(); if (i.onload = () => { const { width: a, height: r } = i; let s = G, y = G, F = 0, g = 0; a > r ? (y = r * (G / a), g = -(y - s) / 2) : (s = a * (G / r), F = -(s - y) / 2), o.drawImage(i, F, g, s, y); const T = n.toDataURL(); document.body.removeChild(n), t(T); }, i.crossOrigin = "anonymous", e.type.startsWith("image/svg+xml")) { const a = new FileReader(); a.addEventListener("load", () => { a.result && (i.src = a.result); }), a.readAsDataURL(e); } else i.src = window.URL.createObjectURL(e); }); } const Vt = () => ({ prefixCls: String, locale: V(void 0), file: V(), items: se(), listType: J(), isImgUrl: w(), showRemoveIcon: B(), showDownloadIcon: B(), showPreviewIcon: B(), removeIcon: w(), downloadIcon: w(), previewIcon: w(), iconRender: w(), actionIconRender: w(), itemRender: w(), onPreview: w(), onClose: w(), onDownload: w(), progress: V() }), Kt = Y({ compatConfig: { MODE: 3 }, name: "ListItem", inheritAttrs: !1, props: Vt(), setup(e, t) { let { slots: n, attrs: o } = t; var i; const a = te(!1), r = te(); ce(() => { r.value = setTimeout(() => { a.value = !0; }, 300); }), Oe(() => { clearTimeout(r.value); }); const s = te((i = e.file) === null || i === void 0 ? void 0 : i.status); Te(() => { var g; return (g = e.file) === null || g === void 0 ? void 0 : g.status; }, (g) => { g !== "removed" && (s.value = g); }); const { rootPrefixCls: y } = he("upload", e), F = oe(() => Je(`${y.value}-fade`)); return () => { var g, T; const { prefixCls: R, locale: _, listType: z, file: l, items: b, progress: L, iconRender: d = n.iconRender, actionIconRender: v = n.actionIconRender, itemRender: $ = n.itemRender, isImgUrl: I, showPreviewIcon: P, showRemoveIcon: U, showDownloadIcon: j, previewIcon: A = n.previewIcon, removeIcon: M = n.removeIcon, downloadIcon: c = n.downloadIcon, onPreview: u, onDownload: p, onClose: f } = e, { class: h, style: C } = o, D = d({ file: l }); let x = m("div", { class: `${R}-text-icon` }, [D]); if (z === "picture" || z === "picture-card") if (s.value === "uploading" || !l.thumbUrl && !l.url) { const N = { [`${R}-list-item-thumbnail`]: !0, [`${R}-list-item-file`]: s.value !== "uploading" }; x = m("div", { class: N }, [D]); } else { const N = I != null && I(l) ? m("img", { src: l.thumbUrl || l.url, alt: l.name, class: `${R}-list-item-image`, crossorigin: l.crossOrigin }, null) : D, Ne = { [`${R}-list-item-thumbnail`]: !0, [`${R}-list-item-file`]: I && !I(l) }; x = m("a", { class: Ne, onClick: (Xe) => u(l, Xe), href: l.url || l.thumbUrl, target: "_blank", rel: "noopener noreferrer" }, [N]); } const E = { [`${R}-list-item`]: !0, [`${R}-list-item-${s.value}`]: !0 }, q = typeof l.linkProps == "string" ? JSON.parse(l.linkProps) : l.linkProps, K = U ? v({ customIcon: M ? M({ file: l }) : m(Ye, null, null), callback: () => f(l), prefixCls: R, title: _.removeFile }) : null, X = j && s.value === "done" ? v({ customIcon: c ? c({ file: l }) : m(Ze, null, null), callback: () => p(l), prefixCls: R, title: _.downloadFile }) : null, H = z !== "picture-card" && m("span", { key: "download-delete", class: [`${R}-list-item-actions`, { picture: z === "picture" }] }, [X, K]), W = `${R}-list-item-name`, Z = l.url ? [m("a", O(O({ key: "view", target: "_blank", rel: "noopener noreferrer", class: W, title: l.name }, q), {}, { href: l.url, onClick: (N) => u(l, N) }), [l.name]), H] : [m("span", { key: "view", class: W, onClick: (N) => u(l, N), title: l.name }, [l.name]), H], de = { pointerEvents: "none", opacity: 0.5 }, je = P ? m("a", { href: l.url || l.thumbUrl, target: "_blank", rel: "noopener noreferrer", style: l.url || l.thumbUrl ? void 0 : de, onClick: (N) => u(l, N), title: _.previewFile }, [A ? A({ file: l }) : m(Qe, null, null)]) : null, Me = z === "picture-card" && s.value !== "uploading" && m("span", { class: `${R}-list-item-actions` }, [je, s.value === "done" && X, K]), we = m("div", { class: E }, [x, Z, Me, a.value && m(wt, F.value, { default: () => [_e(m("div", { class: `${R}-list-item-progress` }, ["percent" in l ? m(Ct, O(O({}, L), {}, { type: "line", percent: l.percent }), null) : null]), [[Ue, s.value === "uploading"]])] })]), Be = { [`${R}-list-item-container`]: !0, [`${h}`]: !!h }, ze = l.response && typeof l.response == "string" ? l.response : ((g = l.error) === null || g === void 0 ? void 0 : g.statusText) || ((T = l.error) === null || T === void 0 ? void 0 : T.message) || _.uploadError, ye = s.value === "error" ? m(ke, { title: ze, getPopupContainer: (N) => N.parentNode }, { default: () => [we] }) : we; return m("div", { class: Be, style: C }, [$ ? $({ originNode: ye, file: l, fileList: b, actions: { download: p.bind(null, l), preview: u.bind(null, l), remove: f.bind(null, l) } }) : ye]); }; } }), Jt = (e, t) => { let { slots: n } = t; var o; return nt((o = n.default) === null || o === void 0 ? void 0 : o.call(n))[0]; }, Yt = Y({ compatConfig: { MODE: 3 }, name: "AUploadList", props: ve(Xt(), { listType: "text", progress: { strokeWidth: 2, showInfo: !1 }, showRemoveIcon: !0, showDownloadIcon: !1, showPreviewIcon: !0, previewFile: Gt, isImageUrl: Wt, items: [], appendActionVisible: !0 }), setup(e, t) { let { slots: n, expose: o } = t; const i = te(!1); ce(() => { i.value == !0; }); const a = te([]); Te(() => e.items, function() { let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []; a.value = l.slice(); }, { immediate: !0, deep: !0 }), yt(() => { if (e.listType !== "picture" && e.listType !== "picture-card") return; let l = !1; (e.items || []).forEach((b, L) => { typeof document == "undefined" || typeof window == "undefined" || !window.FileReader || !window.File || !(b.originFileObj instanceof File || b.originFileObj instanceof Blob) || b.thumbUrl !== void 0 || (b.thumbUrl = "", e.previewFile && e.previewFile(b.originFileObj).then((d) => { const v = d || ""; v !== b.thumbUrl && (a.value[L].thumbUrl = v, l = !0); })); }), l && bt(a); }); const r = (l, b) => { if (e.onPreview) return b == null || b.preventDefault(), e.onPreview(l); }, s = (l) => { typeof e.onDownload == "function" ? e.onDownload(l) : l.url && window.open(l.url); }, y = (l) => { var b; (b = e.onRemove) === null || b === void 0 || b.call(e, l); }, F = (l) => { let { file: b } = l; const L = e.iconRender || n.iconRender; if (L) return L({ file: b, listType: e.listType }); const d = b.status === "uploading", v = e.isImageUrl && e.isImageUrl(b) ? m(ot, null, null) : m(rt, null, null); let $ = d ? m(be, null, null) : m(it, null, null); return e.listType === "picture" ? $ = d ? m(be, null, null) : v : e.listType === "picture-card" && ($ = d ? e.locale.uploading : v), $; }, g = (l) => { const { customIcon: b, callback: L, prefixCls: d, title: v } = l, $ = { type: "text", size: "small", title: v, onClick: () => { L(); }, class: `${d}-list-item-action` }; return at(b) ? m($e, $, { icon: () => b }) : m($e, $, { default: () => [m("span", null, [b])] }); }; o({ handlePreview: r, handleDownload: s }); const { prefixCls: T, rootPrefixCls: R } = he("upload", e), _ = oe(() => ({ [`${T.value}-list`]: !0, [`${T.value}-list-${e.listType}`]: !0 })), z = oe(() => { const l = S({}, et(`${R.value}-motion-collapse`)); delete l.onAfterAppear, delete l.onAfterEnter, delete l.onAfterLeave; const b = S(S({}, tt(`${T.value}-${e.listType === "picture-card" ? "animate-inline" : "animate"}`)), { class: _.value, appear: i.value }); return e.listType !== "picture-card" ? S(S({}, l), b) : b; }); return () => { const { listType: l, locale: b, isImageUrl: L, showPreviewIcon: d, showRemoveIcon: v, showDownloadIcon: $, removeIcon: I, previewIcon: P, downloadIcon: U, progress: j, appendAction: A, itemRender: M, appendActionVisible: c } = e, u = A == null ? void 0 : A(), p = a.value; return m($t, O(O({}, z.value), {}, { tag: "div" }), { default: () => [p.map((f) => { const { uid: h } = f; return m(Kt, { key: h, locale: b, prefixCls: T.value, file: f, items: p, progress: j, listType: l, isImgUrl: L, showPreviewIcon: d, showRemoveIcon: v, showDownloadIcon: $, onPreview: r, onDownload: s, onClose: y, removeIcon: I, previewIcon: P, downloadIcon: U, itemRender: M }, S(S({}, n), { iconRender: F, actionIconRender: g })); }), A ? _e(m(Jt, { key: "__ant_upload_appendAction" }, { default: () => u }), [[Ue, !!c]]) : null] }); }; } }), Zt = (e) => { const { componentCls: t, iconCls: n } = e; return { [`${t}-wrapper`]: { [`${t}-drag`]: { position: "relative", width: "100%", height: "100%", textAlign: "center", background: e.colorFillAlter, border: `${e.lineWidth}px dashed ${e.colorBorder}`, borderRadius: e.borderRadiusLG, cursor: "pointer", transition: `border-color ${e.motionDurationSlow}`, [t]: { padding: `${e.padding}px 0` }, [`${t}-btn`]: { display: "table", width: "100%", height: "100%", outline: "none" }, [`${t}-drag-container`]: { display: "table-cell", verticalAlign: "middle" }, [`&:not(${t}-disabled):hover`]: { borderColor: e.colorPrimaryHover }, [`p${t}-drag-icon`]: { marginBottom: e.margin, [n]: { color: e.colorPrimary, fontSize: e.uploadThumbnailSize } }, [`p${t}-text`]: { margin: `0 0 ${e.marginXXS}px`, color: e.colorTextHeading, fontSize: e.fontSizeLG }, [`p${t}-hint`]: { color: e.colorTextDescription, fontSize: e.fontSize }, // ===================== Disabled ===================== [`&${t}-disabled`]: { cursor: "not-allowed", [`p${t}-drag-icon ${n}, p${t}-text, p${t}-hint `]: { color: e.colorTextDisabled } } } } }; }, Qt = (e) => { const { componentCls: t, antCls: n, iconCls: o, fontSize: i, lineHeight: a } = e, r = `${t}-list-item`, s = `${r}-actions`, y = `${r}-action`, F = Math.round(i * a); return { [`${t}-wrapper`]: { [`${t}-list`]: S(S({}, Re()), { lineHeight: e.lineHeight, [r]: { position: "relative", height: e.lineHeight * i, marginTop: e.marginXS, fontSize: i, display: "flex", alignItems: "center", transition: `background-color ${e.motionDurationSlow}`, "&:hover": { backgroundColor: e.controlItemBgHover }, [`${r}-name`]: S(S({}, Pe), { padding: `0 ${e.paddingXS}px`, lineHeight: a, flex: "auto", transition: `all ${e.motionDurationSlow}` }), [s]: { [y]: { opacity: 0 }, [`${y}${n}-btn-sm`]: { height: F, border: 0, lineHeight: 1, // FIXME: should not override small button "> span": { transform: "scale(1)" } }, [` ${y}:focus, &.picture ${y} `]: { opacity: 1 }, [o]: { color: e.colorTextDescription, transition: `all ${e.motionDurationSlow}` }, [`&:hover ${o}`]: { color: e.colorText } }, [`${t}-icon ${o}`]: { color: e.colorTextDescription, fontSize: i }, [`${r}-progress`]: { position: "absolute", bottom: -e.uploadProgressOffset, width: "100%", paddingInlineStart: i + e.paddingXS, fontSize: i, lineHeight: 0, pointerEvents: "none", "> div": { margin: 0 } } }, [`${r}:hover ${y}`]: { opacity: 1, color: e.colorText }, [`${r}-error`]: { color: e.colorError, [`${r}-name, ${t}-icon ${o}`]: { color: e.colorError }, [s]: { [`${o}, ${o}:hover`]: { color: e.colorError }, [y]: { opacity: 1 } } }, [`${t}-list-item-container`]: { transition: `opacity ${e.motionDurationSlow}, height ${e.motionDurationSlow}`, // For smooth removing animation "&::before": { display: "table", width: 0, height: 0, content: '""' } } }) } }; }, Se = new De("uploadAnimateInlineIn", { from: { width: 0, height: 0, margin: 0, padding: 0, opacity: 0 } }), xe = new De("uploadAnimateInlineOut", { to: { width: 0, height: 0, margin: 0, padding: 0, opacity: 0 } }), kt = (e) => { const { componentCls: t } = e, n = `${t}-animate-inline`; return [{ [`${t}-wrapper`]: { [`${n}-appear, ${n}-enter, ${n}-leave`]: { animationDuration: e.motionDurationSlow, animationTimingFunction: e.motionEaseInOutCirc, animationFillMode: "forwards" }, [`${n}-appear, ${n}-enter`]: { animationName: Se }, [`${n}-leave`]: { animationName: xe } } }, Se, xe]; }, en = (e) => { const { componentCls: t, iconCls: n, uploadThumbnailSize: o, uploadProgressOffset: i } = e, a = `${t}-list`, r = `${a}-item`; return { [`${t}-wrapper`]: { // ${listCls} 增加优先级 [`${a}${a}-picture, ${a}${a}-picture-card`]: { [r]: { position: "relative", height: o + e.lineWidth * 2 + e.paddingXS * 2, padding: e.paddingXS, border: `${e.lineWidth}px ${e.lineType} ${e.colorBorder}`, borderRadius: e.borderRadiusLG, "&:hover": { background: "transparent" }, [`${r}-thumbnail`]: S(S({}, Pe), { width: o, height: o, lineHeight: `${o + e.paddingSM}px`, textAlign: "center", flex: "none", [n]: { fontSize: e.fontSizeHeading2, color: e.colorPrimary }, img: { display: "block", width: "100%", height: "100%", overflow: "hidden" } }), [`${r}-progress`]: { bottom: i, width: `calc(100% - ${e.paddingSM * 2}px)`, marginTop: 0, paddingInlineStart: o + e.paddingXS } }, [`${r}-error`]: { borderColor: e.colorError, // Adjust the color of the error icon : https://github.com/ant-design/ant-design/pull/24160 [`${r}-thumbnail ${n}`]: { "svg path[fill='#e6f7ff']": { fill: e.colorErrorBg }, "svg path[fill='#1890ff']": { fill: e.colorError } } }, [`${r}-uploading`]: { borderStyle: "dashed", [`${r}-name`]: { marginBottom: i } } } } }; }, tn = (e) => { const { componentCls: t, iconCls: n, fontSizeLG: o, colorTextLightSolid: i } = e, a = `${t}-list`, r = `${a}-item`, s = e.uploadPicCardSize; return { [`${t}-wrapper${t}-picture-card-wrapper`]: S(S({}, Re()), { display: "inline-block", width: "100%", [`${t}${t}-select`]: { width: s, height: s, marginInlineEnd: e.marginXS, marginBottom: e.marginXS, textAlign: "center", verticalAlign: "top", backgroundColor: e.colorFillAlter, border: `${e.lineWidth}px dashed ${e.colorBorder}`, borderRadius: e.borderRadiusLG, cursor: "pointer", transition: `border-color ${e.motionDurationSlow}`, [`> ${t}`]: { display: "flex", alignItems: "center", justifyContent: "center", height: "100%", textAlign: "center" }, [`&:not(${t}-disabled):hover`]: { borderColor: e.colorPrimary } }, // list [`${a}${a}-picture-card`]: { [`${a}-item-container`]: { display: "inline-block", width: s, height: s, marginBlock: `0 ${e.marginXS}px`, marginInline: `0 ${e.marginXS}px`, verticalAlign: "top" }, "&::after": { display: "none" }, [r]: { height: "100%", margin: 0, "&::before": { position: "absolute", zIndex: 1, width: `calc(100% - ${e.paddingXS * 2}px)`, height: `calc(100% - ${e.paddingXS * 2}px)`, backgroundColor: e.colorBgMask, opacity: 0, transition: `all ${e.motionDurationSlow}`, content: '" "' } }, [`${r}:hover`]: { [`&::before, ${r}-actions`]: { opacity: 1 } }, [`${r}-actions`]: { position: "absolute", insetInlineStart: 0, zIndex: 10, width: "100%", whiteSpace: "nowrap", textAlign: "center", opacity: 0, transition: `all ${e.motionDurationSlow}`, [`${n}-eye, ${n}-download, ${n}-delete`]: { zIndex: 10, width: o, margin: `0 ${e.marginXXS}px`, fontSize: o, cursor: "pointer", transition: `all ${e.motionDurationSlow}` } }, [`${r}-actions, ${r}-actions:hover`]: { [`${n}-eye, ${n}-download, ${n}-delete`]: { color: new lt(i).setAlpha(0.65).toRgbString(), "&:hover": { color: i } } }, [`${r}-thumbnail, ${r}-thumbnail img`]: { position: "static", display: "block", width: "100%", height: "100%", objectFit: "contain" }, [`${r}-name`]: { display: "none", textAlign: "center" }, [`${r}-file + ${r}-name`]: { position: "absolute", bottom: e.margin, display: "block", width: `calc(100% - ${e.paddingXS * 2}px)` }, [`${r}-uploading`]: { [`&${r}`]: { backgroundColor: e.colorFillAlter }, [`&::before, ${n}-eye, ${n}-download, ${n}-delete`]: { display: "none" } }, [`${r}-progress`]: { bottom: e.marginXL, width: `calc(100% - ${e.paddingXS * 2}px)`, paddingInlineStart: 0 } } }) }; }, nn = (e) => { const { componentCls: t } = e; return { [`${t}-rtl`]: { direction: "rtl" } }; }, on = (e) => { const { componentCls: t, colorTextDisabled: n } = e; return { [`${t}-wrapper`]: S(S({}, ut(e)), { [t]: { outline: 0, "input[type='file']": { cursor: "pointer" } }, [`${t}-select`]: { display: "inline-block" }, [`${t}-disabled`]: { color: n, cursor: "not-allowed" } }) }; }, rn = st("Upload", (e) => { const { fontSizeHeading3: t, fontSize: n, lineHeight: o, lineWidth: i, controlHeightLG: a } = e, r = Math.round(n * o), s = ct(e, { uploadThumbnailSize: t * 2, uploadProgressOffset: r / 2 + i, uploadPicCardSize: a * 2.55 }); return [on(s), Zt(s), en(s), tn(s), Qt(s), kt(s), nn(s), dt(s)]; }); var an = function(e, t, n, o) { function i(a) { return a instanceof n ? a : new n(function(r) { r(a); }); } return new (n || (n = Promise))(function(a, r) { function s(g) { try { F(o.next(g)); } catch (T) { r(T); } } function y(g) { try { F(o.throw(g)); } catch (T) { r(T); } } function F(g) { g.done ? a(g.value) : i(g.value).then(s, y); } F((o = o.apply(e, t || [])).next()); }); }, ln = function(e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++) t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]); return n; }; const ee = `__LIST_IGNORE_${Date.now()}__`, ae = Y({ compatConfig: { MODE: 3 }, name: "AUpload", inheritAttrs: !1, props: ve(Le(), { type: "select", multiple: !1, action: "", data: {}, accept: "", showUploadList: !0, listType: "text", supportServerRender: !0 }), setup(e, t) { let { slots: n, attrs: o, expose: i } = t; const a = pt(), { prefixCls: r, direction: s, disabled: y } = he("upload", e), [F, g] = rn(r), T = ft(), R = oe(() => { var c; return (c = y.value) !== null && c !== void 0 ? c : T.value; }), [_, z] = mt(e.defaultFileList || [], { value: It(e, "fileList"), postState: (c) => { const u = Date.now(); return (c != null ? c : []).map((p, f) => (!p.uid && !Object.isFrozen(p) && (p.uid = `__AUTO__${u}_${f}__`), p)); } }), l = ne("drop"), b = ne(null); ce(() => { ue(e.fileList !== void 0 || o.value === void 0, "Upload", "`value` is not a valid prop, do you mean `fileList`?"), ue(e.transformFile === void 0, "Upload", "`transformFile` is deprecated. Please use `beforeUpload` directly."), ue(e.remove === void 0, "Upload", "`remove` props is deprecated. Please use `remove` event."); }); const L = (c, u, p) => { var f, h; let C = [...u]; e.maxCount === 1 ? C = C.slice(-1) : e.maxCount && (C = C.slice(0, e.maxCount)), z(C); const D = { file: c, fileList: C }; p && (D.event = p), (f = e["onUpdate:fileList"]) === null || f === void 0 || f.call(e, D.fileList), (h = e.onChange) === null || h === void 0 || h.call(e, D), a.onFieldChange(); }, d = (c, u) => an(this, void 0, void 0, function* () { const { beforeUpload: p, transformFile: f } = e; let h = c; if (p) { const C = yield p(c, u); if (C === !1) return !1; if (delete c[ee], C === ee) return Object.defineProperty(c, ee, { value: !0, configurable: !0 }), !1; typeof C == "object" && C && (h = C); } return f && (h = yield f(h)), h; }), v = (c) => { const u = c.filter((h) => !h.file[ee]); if (!u.length) return; const p = u.map((h) => re(h.file)); let f = [..._.value]; p.forEach((h) => { f = ie(h, f); }), p.forEach((h, C) => { let D = h; if (u[C].parsedFile) h.status = "uploading"; else { const { originFileObj: x } = h; let E; try { E = new File([x], x.name, { type: x.type }); } catch (q) { E = new Blob([x], { type: x.type }), E.name = x.name, E.lastModifiedDate = /* @__PURE__ */ new Date(), E.lastModified = (/* @__PURE__ */ new Date()).getTime(); } E.uid = h.uid, D = E; } L(D, f); }); }, $ = (c, u, p) => { try { typeof c == "string" && (c = JSON.parse(c)); } catch (C) { } if (!ge(u, _.value)) return; const f = re(u); f.status = "done", f.percent = 100, f.response = c, f.xhr = p; const h = ie(f, _.value); L(f, h); }, I = (c, u) => { if (!ge(u, _.value)) return; const p = re(u); p.status = "uploading", p.percent = c.percent; const f = ie(p, _.value); L(p, f, c); }, P = (c, u, p) => { if (!ge(p, _.value)) return; const f = re(p); f.error = c, f.response = u, f.status = "error"; const h = ie(f, _.value); L(f, h); }, U = (c) => { let u; const p = e.onRemove || e.remove; Promise.resolve(typeof p == "function" ? p(c) : p).then((f) => { var h, C; if (f === !1) return; const D = Ht(c, _.value); D && (u = S(S({}, c), { status: "removed" }), (h = _.value) === null || h === void 0 || h.forEach((x) => { const E = u.uid !== void 0 ? "uid" : "name"; x[E] === u[E] && !Object.isFrozen(x) && (x.status = "removed"); }), (C = b.value) === null || C === void 0 || C.abort(u), L(u, D)); }); }, j = (c) => { var u; l.value = c.type, c.type === "drop" && ((u = e.onDrop) === null || u === void 0 || u.call(e, c)); }; i({ onBatchStart: v, onSuccess: $, onProgress: I, onError: P, fileList: _, upload: b }); const [A] = gt("Upload", vt.Upload, oe(() => e.locale)), M = (c, u) => { const { removeIcon: p, previewIcon: f, downloadIcon: h, previewFile: C, onPreview: D, onDownload: x, isImageUrl: E, progress: q, itemRender: K, iconRender: X, showUploadList: H } = e, { showDownloadIcon: W, showPreviewIcon: Z, showRemoveIcon: de } = typeof H == "boolean" ? {} : H; return H ? m(Yt, { prefixCls: r.value, listType: e.listType, items: _.value, previewFile: C, onPreview: D, onDownload: x, onRemove: U, showRemoveIcon: !R.value && de, showPreviewIcon: Z, showDownloadIcon: W, removeIcon: p, previewIcon: f, downloadIcon: h, iconRender: X, locale: A.value, isImageUrl: E, progress: q, itemRender: K, appendActionVisible: u, appendAction: c }, S({}, n)) : c == null ? void 0 : c(); }; return () => { var c, u, p; const { listType: f, type: h } = e, { class: C, style: D } = o, x = ln(o, ["class", "style"]), E = S(S(S({ onBatchStart: v, onError: P, onProgress: I, onSuccess: $ }, x), e), { id: (c = e.id) !== null && c !== void 0 ? c : a.id.value, prefixCls: r.value, beforeUpload: d, onChange: void 0, disabled: R.value }); delete E.remove, (!n.default || R.value) && delete E.id; const q = { [`${r.value}-rtl`]: s.value === "rtl" }; if (h === "drag") { const W = k(r.value, { [`${r.value}-drag`]: !0, [`${r.value}-drag-uploading`]: _.value.some((Z) => Z.status === "uploading"), [`${r.value}-drag-hover`]: l.value === "dragover", [`${r.value}-disabled`]: R.value, [`${r.value}-rtl`]: s.value === "rtl" }, o.class, g.value); return F(m("span", O(O({}, o), {}, { class: k(`${r.value}-wrapper`, q, C, g.value) }), [m("div", { class: W, onDrop: j, onDragover: j, onDragleave: j, style: o.style }, [m(Ce, O(O({}, E), {}, { ref: b, class: `${r.value}-btn` }), O({ default: () => [m("div", { class: `${r.value}-drag-container` }, [(u = n.default) === null || u === void 0 ? void 0 : u.call(n)])] }, n))]), M()])); } const K = k(r.value, { [`${r.value}-select`]: !0, [`${r.value}-select-${f}`]: !0, [`${r.value}-disabled`]: R.value, [`${r.value}-rtl`]: s.value === "rtl" }), X = ht((p = n.default) === null || p === void 0 ? void 0 : p.call(n)), H = (W) => m("div", { class: K, style: W }, [m(Ce, O(O({}, E), {}, { ref: b }), n)]); return F(f === "picture-card" ? m("span", O(O({}, o), {}, { class: k(`${r.value}-wrapper`, `${r.value}-picture-card-wrapper`, q, o.class, g.value) }), [M(H, !!(X && X.length))]) : m("span", O(O({}, o), {}, { class: k(`${r.value}-wrapper`, q, o.class, g.value) }), [H(X && X.length ? void 0 : { display: "none" }), M()])); }; } }); var Fe = function(e, t) { var n = {}; for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]); if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, o = Object.getOwnPropertySymbols(e); i < o.length; i++) t.indexOf(o[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[i]) && (n[o[i]] = e[o[i]]); return n; }; const le = Y({ compatConfig: { MODE: 3 }, name: "AUploadDragger", inheritAttrs: !1, props: Le(), setup(e, t) { let { slots: n, attrs: o } = t; return () => { const { height: i } = e, a = Fe(e, ["height"]), { style: r } = o, s = Fe(o, ["style"]), y = S(S(S({}, a), s), { type: "drag", style: S(S({}, r), { height: typeof i == "number" ? `${i}px` : i }) }); return m(ae, y, n); }; } }), un = le, pn = S(ae, { Dragger: le, LIST_IGNORE: ee, install(e) { return e.component(ae.name, ae), e.component(le.name, le), e; } }); export { un as U, pn as _ };