import { mutable } from "./chunk-VJPYMOVT.js"; import { useLocale } from "./chunk-APPTXKCZ.js"; import { ElIcon, entriesOf } from "./chunk-3DJYPQW6.js"; import { useFormDisabled, useVModel } from "./chunk-FYPMSKES.js"; import { debugWarn, throwError } from "./chunk-UFIWN4M6.js"; import { _export_sfc } from "./chunk-MUJDDH7P.js"; import { buildProps, cloneDeep_default, definePropType, isEqual_default, isNil_default, useNamespace, withInstall } from "./chunk-R2OGZABH.js"; import { check_default, circle_check_default, circle_close_default, close_default, delete_default, document_default, warning_filled_default, zoom_in_default } from "./chunk-3C23FNYW.js"; import { Fragment, TransitionGroup, computed, createBaseVNode, createBlock, createCommentVNode, createElementBlock, createSlots, createVNode, defineComponent, inject, mergeProps, onBeforeUnmount, openBlock, provide, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toRef, unref, watch, withCtx, withKeys, withModifiers } from "./chunk-AAHVYXXY.js"; import { NOOP, init_shared_esm_bundler, isArray, isFunction, isPlainObject, isString, normalizeClass, normalizeStyle, toDisplayString } from "./chunk-OWZYVOTZ.js"; // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/constants.mjs var uploadContextKey = Symbol("uploadContextKey"); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/progress/src/progress.mjs var progressProps = buildProps({ type: { type: String, default: "line", values: ["line", "circle", "dashboard"] }, percentage: { type: Number, default: 0, validator: (val) => val >= 0 && val <= 100 }, status: { type: String, default: "", values: ["", "success", "exception", "warning"] }, indeterminate: Boolean, duration: { type: Number, default: 3 }, strokeWidth: { type: Number, default: 6 }, strokeLinecap: { type: definePropType(String), default: "round" }, textInside: Boolean, width: { type: Number, default: 126 }, showText: { type: Boolean, default: true }, color: { type: definePropType([ String, Array, Function ]), default: "" }, striped: Boolean, stripedFlow: Boolean, format: { type: definePropType(Function), default: (percentage) => `${percentage}%` } }); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/progress/src/progress2.mjs init_shared_esm_bundler(); var __default__ = defineComponent({ name: "ElProgress" }); var _sfc_main = defineComponent({ ...__default__, props: progressProps, setup(__props) { const props = __props; const STATUS_COLOR_MAP = { success: "#13ce66", exception: "#ff4949", warning: "#e6a23c", default: "#20a0ff" }; const ns = useNamespace("progress"); const barStyle = computed(() => { const barStyle2 = { width: `${props.percentage}%`, animationDuration: `${props.duration}s` }; const color = getCurrentColor(props.percentage); if (color.includes("gradient")) { barStyle2.background = color; } else { barStyle2.backgroundColor = color; } return barStyle2; }); const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1)); const radius = computed(() => { if (["circle", "dashboard"].includes(props.type)) { return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10); } return 0; }); const trackPath = computed(() => { const r = radius.value; const isDashboard = props.type === "dashboard"; return ` M 50 50 m 0 ${isDashboard ? "" : "-"}${r} a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2} a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2} `; }); const perimeter = computed(() => 2 * Math.PI * radius.value); const rate = computed(() => props.type === "dashboard" ? 0.75 : 1); const strokeDashoffset = computed(() => { const offset = -1 * perimeter.value * (1 - rate.value) / 2; return `${offset}px`; }); const trailPathStyle = computed(() => ({ strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`, strokeDashoffset: strokeDashoffset.value })); const circlePathStyle = computed(() => ({ strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`, strokeDashoffset: strokeDashoffset.value, transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s" })); const stroke = computed(() => { let ret; if (props.color) { ret = getCurrentColor(props.percentage); } else { ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default; } return ret; }); const statusIcon = computed(() => { if (props.status === "warning") { return warning_filled_default; } if (props.type === "line") { return props.status === "success" ? circle_check_default : circle_close_default; } else { return props.status === "success" ? check_default : close_default; } }); const progressTextSize = computed(() => { return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2; }); const content = computed(() => props.format(props.percentage)); function getColors(color) { const span = 100 / color.length; const seriesColors = color.map((seriesColor, index) => { if (isString(seriesColor)) { return { color: seriesColor, percentage: (index + 1) * span }; } return seriesColor; }); return seriesColors.sort((a, b) => a.percentage - b.percentage); } const getCurrentColor = (percentage) => { var _a; const { color } = props; if (isFunction(color)) { return color(percentage); } else if (isString(color)) { return color; } else { const colors = getColors(color); for (const color2 of colors) { if (color2.percentage > percentage) return color2.color; } return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color; } }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass([ unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is(_ctx.status), { [unref(ns).m("without-text")]: !_ctx.showText, [unref(ns).m("text-inside")]: _ctx.textInside } ]), role: "progressbar", "aria-valuenow": _ctx.percentage, "aria-valuemin": "0", "aria-valuemax": "100" }, [ _ctx.type === "line" ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(unref(ns).b("bar")) }, [ createBaseVNode("div", { class: normalizeClass(unref(ns).be("bar", "outer")), style: normalizeStyle({ height: `${_ctx.strokeWidth}px` }) }, [ createBaseVNode("div", { class: normalizeClass([ unref(ns).be("bar", "inner"), { [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }, { [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped }, { [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow } ]), style: normalizeStyle(unref(barStyle)) }, [ (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(unref(ns).be("bar", "innerText")) }, [ renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [ createBaseVNode("span", null, toDisplayString(unref(content)), 1) ]) ], 2)) : createCommentVNode("v-if", true) ], 6) ], 6) ], 2)) : (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(unref(ns).b("circle")), style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` }) }, [ (openBlock(), createElementBlock("svg", { viewBox: "0 0 100 100" }, [ createBaseVNode("path", { class: normalizeClass(unref(ns).be("circle", "track")), d: unref(trackPath), stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`, "stroke-linecap": _ctx.strokeLinecap, "stroke-width": unref(relativeStrokeWidth), fill: "none", style: normalizeStyle(unref(trailPathStyle)) }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]), createBaseVNode("path", { class: normalizeClass(unref(ns).be("circle", "path")), d: unref(trackPath), stroke: unref(stroke), fill: "none", opacity: _ctx.percentage ? 1 : 0, "stroke-linecap": _ctx.strokeLinecap, "stroke-width": unref(relativeStrokeWidth), style: normalizeStyle(unref(circlePathStyle)) }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"]) ])) ], 6)), (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", { key: 2, class: normalizeClass(unref(ns).e("text")), style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` }) }, [ renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [ !_ctx.status ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon)))) ]), _: 1 })) ]) ], 6)) : createCommentVNode("v-if", true) ], 10, ["aria-valuenow"]); }; } }); var Progress = _export_sfc(_sfc_main, [["__file", "progress.vue"]]); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/progress/index.mjs var ElProgress = withInstall(Progress); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/ajax.mjs init_shared_esm_bundler(); var SCOPE = "ElUpload"; var UploadAjaxError = class extends Error { constructor(message, status, method, url) { super(message); this.name = "UploadAjaxError"; this.status = status; this.method = method; this.url = url; } }; function getError(action, option, xhr) { let msg; if (xhr.response) { msg = `${xhr.response.error || xhr.response}`; } else if (xhr.responseText) { msg = `${xhr.responseText}`; } else { msg = `fail to ${option.method} ${action} ${xhr.status}`; } return new UploadAjaxError(msg, xhr.status, option.method, action); } function getBody(xhr) { const text = xhr.responseText || xhr.response; if (!text) { return text; } try { return JSON.parse(text); } catch (e) { return text; } } var ajaxUpload = (option) => { if (typeof XMLHttpRequest === "undefined") throwError(SCOPE, "XMLHttpRequest is undefined"); const xhr = new XMLHttpRequest(); const action = option.action; if (xhr.upload) { xhr.upload.addEventListener("progress", (evt) => { const progressEvt = evt; progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0; option.onProgress(progressEvt); }); } const formData = new FormData(); if (option.data) { for (const [key, value] of Object.entries(option.data)) { if (isArray(value) && value.length) formData.append(key, ...value); else formData.append(key, value); } } formData.append(option.filename, option.file, option.file.name); xhr.addEventListener("error", () => { option.onError(getError(action, option, xhr)); }); xhr.addEventListener("load", () => { if (xhr.status < 200 || xhr.status >= 300) { return option.onError(getError(action, option, xhr)); } option.onSuccess(getBody(xhr)); }); xhr.open(option.method, action, true); if (option.withCredentials && "withCredentials" in xhr) { xhr.withCredentials = true; } const headers = option.headers || {}; if (headers instanceof Headers) { headers.forEach((value, key) => xhr.setRequestHeader(key, value)); } else { for (const [key, value] of Object.entries(headers)) { if (isNil_default(value)) continue; xhr.setRequestHeader(key, String(value)); } } xhr.send(formData); return xhr; }; // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload.mjs init_shared_esm_bundler(); var uploadListTypes = ["text", "picture", "picture-card"]; var fileId = 1; var genFileId = () => Date.now() + fileId++; var uploadBaseProps = buildProps({ action: { type: String, default: "#" }, headers: { type: definePropType(Object) }, method: { type: String, default: "post" }, data: { type: definePropType([Object, Function, Promise]), default: () => mutable({}) }, multiple: Boolean, name: { type: String, default: "file" }, drag: Boolean, withCredentials: Boolean, showFileList: { type: Boolean, default: true }, accept: { type: String, default: "" }, fileList: { type: definePropType(Array), default: () => mutable([]) }, autoUpload: { type: Boolean, default: true }, listType: { type: String, values: uploadListTypes, default: "text" }, httpRequest: { type: definePropType(Function), default: ajaxUpload }, disabled: Boolean, limit: Number }); var uploadProps = buildProps({ ...uploadBaseProps, beforeUpload: { type: definePropType(Function), default: NOOP }, beforeRemove: { type: definePropType(Function) }, onRemove: { type: definePropType(Function), default: NOOP }, onChange: { type: definePropType(Function), default: NOOP }, onPreview: { type: definePropType(Function), default: NOOP }, onSuccess: { type: definePropType(Function), default: NOOP }, onProgress: { type: definePropType(Function), default: NOOP }, onError: { type: definePropType(Function), default: NOOP }, onExceed: { type: definePropType(Function), default: NOOP }, crossorigin: { type: definePropType(String) } }); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload-list.mjs init_shared_esm_bundler(); var uploadListProps = buildProps({ files: { type: definePropType(Array), default: () => mutable([]) }, disabled: Boolean, handlePreview: { type: definePropType(Function), default: NOOP }, listType: { type: String, values: uploadListTypes, default: "text" }, crossorigin: { type: definePropType(String) } }); var uploadListEmits = { remove: (file) => !!file }; // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload-list2.mjs var __default__2 = defineComponent({ name: "ElUploadList" }); var _sfc_main2 = defineComponent({ ...__default__2, props: uploadListProps, emits: uploadListEmits, setup(__props, { emit }) { const props = __props; const { t } = useLocale(); const nsUpload = useNamespace("upload"); const nsIcon = useNamespace("icon"); const nsList = useNamespace("list"); const disabled = useFormDisabled(); const focusing = ref(false); const containerKls = computed(() => [ nsUpload.b("list"), nsUpload.bm("list", props.listType), nsUpload.is("disabled", props.disabled) ]); const handleRemove = (file) => { emit("remove", file); }; return (_ctx, _cache) => { return openBlock(), createBlock(TransitionGroup, { tag: "ul", class: normalizeClass(unref(containerKls)), name: unref(nsList).b() }, { default: withCtx(() => [ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file, index) => { return openBlock(), createElementBlock("li", { key: file.uid || file.name, class: normalizeClass([ unref(nsUpload).be("list", "item"), unref(nsUpload).is(file.status), { focusing: focusing.value } ]), tabindex: unref(disabled) ? void 0 : 0, "aria-disabled": unref(disabled), role: "button", onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]), onFocus: ($event) => focusing.value = true, onBlur: ($event) => focusing.value = false, onClick: ($event) => focusing.value = false }, [ renderSlot(_ctx.$slots, "default", { file, index }, () => [ _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", { key: 0, class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")), src: file.url, crossorigin: _ctx.crossorigin, alt: "" }, null, 10, ["src", "crossorigin"])) : createCommentVNode("v-if", true), file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", { key: 1, class: normalizeClass(unref(nsUpload).be("list", "item-info")) }, [ createBaseVNode("a", { class: normalizeClass(unref(nsUpload).be("list", "item-name")), onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"]) }, [ createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("document")) }, { default: withCtx(() => [ createVNode(unref(document_default)) ]), _: 1 }, 8, ["class"]), createBaseVNode("span", { class: normalizeClass(unref(nsUpload).be("list", "item-file-name")), title: file.name }, toDisplayString(file.name), 11, ["title"]) ], 10, ["onClick"]), file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), { key: 0, type: _ctx.listType === "picture-card" ? "circle" : "line", "stroke-width": _ctx.listType === "picture-card" ? 6 : 2, percentage: Number(file.percentage), style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem") }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true) ], 2)) : createCommentVNode("v-if", true), createBaseVNode("label", { class: normalizeClass(unref(nsUpload).be("list", "item-status-label")) }, [ _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), { key: 0, class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")]) }, { default: withCtx(() => [ createVNode(unref(circle_check_default)) ]), _: 1 }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), { key: 1, class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")]) }, { default: withCtx(() => [ createVNode(unref(check_default)) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true) ], 2), !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), { key: 2, class: normalizeClass(unref(nsIcon).m("close")), onClick: ($event) => handleRemove(file) }, { default: withCtx(() => [ createVNode(unref(close_default)) ]), _: 2 }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true), createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"), createCommentVNode(" This is a bug which needs to be fixed "), createCommentVNode(" TODO: Fix the incorrect navigation interaction "), !unref(disabled) ? (openBlock(), createElementBlock("i", { key: 3, class: normalizeClass(unref(nsIcon).m("close-tip")) }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true), _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", { key: 4, class: normalizeClass(unref(nsUpload).be("list", "item-actions")) }, [ createBaseVNode("span", { class: normalizeClass(unref(nsUpload).be("list", "item-preview")), onClick: ($event) => _ctx.handlePreview(file) }, [ createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("zoom-in")) }, { default: withCtx(() => [ createVNode(unref(zoom_in_default)) ]), _: 1 }, 8, ["class"]) ], 10, ["onClick"]), !unref(disabled) ? (openBlock(), createElementBlock("span", { key: 0, class: normalizeClass(unref(nsUpload).be("list", "item-delete")), onClick: ($event) => handleRemove(file) }, [ createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("delete")) }, { default: withCtx(() => [ createVNode(unref(delete_default)) ]), _: 1 }, 8, ["class"]) ], 10, ["onClick"])) : createCommentVNode("v-if", true) ], 2)) : createCommentVNode("v-if", true) ]) ], 42, ["tabindex", "aria-disabled", "onKeydown", "onFocus", "onBlur", "onClick"]); }), 128)), renderSlot(_ctx.$slots, "append") ]), _: 3 }, 8, ["class", "name"]); }; } }); var UploadList = _export_sfc(_sfc_main2, [["__file", "upload-list.vue"]]); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload-dragger.mjs init_shared_esm_bundler(); var uploadDraggerProps = buildProps({ disabled: Boolean }); var uploadDraggerEmits = { file: (file) => isArray(file) }; // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload-dragger2.mjs var COMPONENT_NAME = "ElUploadDrag"; var __default__3 = defineComponent({ name: COMPONENT_NAME }); var _sfc_main3 = defineComponent({ ...__default__3, props: uploadDraggerProps, emits: uploadDraggerEmits, setup(__props, { emit }) { const uploaderContext = inject(uploadContextKey); if (!uploaderContext) { throwError(COMPONENT_NAME, "usage: "); } const ns = useNamespace("upload"); const dragover = ref(false); const disabled = useFormDisabled(); const onDrop = (e) => { if (disabled.value) return; dragover.value = false; e.stopPropagation(); const files = Array.from(e.dataTransfer.files); const items = e.dataTransfer.items || []; files.forEach((file, index) => { var _a; const item = items[index]; const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item); if (entry) { file.isDirectory = entry.isDirectory; } }); emit("file", files); }; const onDragover = () => { if (!disabled.value) dragover.value = true; }; const onDragleave = (e) => { if (!e.currentTarget.contains(e.relatedTarget)) dragover.value = false; }; return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]), onDrop: withModifiers(onDrop, ["prevent"]), onDragover: withModifiers(onDragover, ["prevent"]), onDragleave: withModifiers(onDragleave, ["prevent"]) }, [ renderSlot(_ctx.$slots, "default") ], 42, ["onDrop", "onDragover", "onDragleave"]); }; } }); var UploadDragger = _export_sfc(_sfc_main3, [["__file", "upload-dragger.vue"]]); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload-content.mjs init_shared_esm_bundler(); var uploadContentProps = buildProps({ ...uploadBaseProps, beforeUpload: { type: definePropType(Function), default: NOOP }, onRemove: { type: definePropType(Function), default: NOOP }, onStart: { type: definePropType(Function), default: NOOP }, onSuccess: { type: definePropType(Function), default: NOOP }, onProgress: { type: definePropType(Function), default: NOOP }, onError: { type: definePropType(Function), default: NOOP }, onExceed: { type: definePropType(Function), default: NOOP } }); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload-content2.mjs init_shared_esm_bundler(); var __default__4 = defineComponent({ name: "ElUploadContent", inheritAttrs: false }); var _sfc_main4 = defineComponent({ ...__default__4, props: uploadContentProps, setup(__props, { expose }) { const props = __props; const ns = useNamespace("upload"); const disabled = useFormDisabled(); const requests = shallowRef({}); const inputRef = shallowRef(); const uploadFiles = (files) => { if (files.length === 0) return; const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props; if (limit && fileList.length + files.length > limit) { onExceed(files, fileList); return; } if (!multiple) { files = files.slice(0, 1); } for (const file of files) { const rawFile = file; rawFile.uid = genFileId(); onStart(rawFile); if (autoUpload) upload(rawFile); } }; const upload = async (rawFile) => { inputRef.value.value = ""; if (!props.beforeUpload) { return doUpload(rawFile); } let hookResult; let beforeData = {}; try { const originData = props.data; const beforeUploadPromise = props.beforeUpload(rawFile); beforeData = isPlainObject(props.data) ? cloneDeep_default(props.data) : props.data; hookResult = await beforeUploadPromise; if (isPlainObject(props.data) && isEqual_default(originData, beforeData)) { beforeData = cloneDeep_default(props.data); } } catch (e) { hookResult = false; } if (hookResult === false) { props.onRemove(rawFile); return; } let file = rawFile; if (hookResult instanceof Blob) { if (hookResult instanceof File) { file = hookResult; } else { file = new File([hookResult], rawFile.name, { type: rawFile.type }); } } doUpload(Object.assign(file, { uid: rawFile.uid }), beforeData); }; const resolveData = async (data, rawFile) => { if (isFunction(data)) { return data(rawFile); } return data; }; const doUpload = async (rawFile, beforeData) => { const { headers, data, method, withCredentials, name: filename, action, onProgress, onSuccess, onError, httpRequest } = props; try { beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile); } catch (e) { props.onRemove(rawFile); return; } const { uid } = rawFile; const options = { headers: headers || {}, withCredentials, file: rawFile, data: beforeData, method, filename, action, onProgress: (evt) => { onProgress(evt, rawFile); }, onSuccess: (res) => { onSuccess(res, rawFile); delete requests.value[uid]; }, onError: (err) => { onError(err, rawFile); delete requests.value[uid]; } }; const request = httpRequest(options); requests.value[uid] = request; if (request instanceof Promise) { request.then(options.onSuccess, options.onError); } }; const handleChange = (e) => { const files = e.target.files; if (!files) return; uploadFiles(Array.from(files)); }; const handleClick = () => { if (!disabled.value) { inputRef.value.value = ""; inputRef.value.click(); } }; const handleKeydown = () => { handleClick(); }; const abort = (file) => { const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true); _reqs.forEach(([uid, req]) => { if (req instanceof XMLHttpRequest) req.abort(); delete requests.value[uid]; }); }; expose({ abort, upload }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass([ unref(ns).b(), unref(ns).m(_ctx.listType), unref(ns).is("drag", _ctx.drag), unref(ns).is("disabled", unref(disabled)) ]), tabindex: unref(disabled) ? void 0 : 0, "aria-disabled": unref(disabled), role: "button", onClick: handleClick, onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"]) }, [ _ctx.drag ? (openBlock(), createBlock(UploadDragger, { key: 0, disabled: unref(disabled), onFile: uploadFiles }, { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }), createBaseVNode("input", { ref_key: "inputRef", ref: inputRef, class: normalizeClass(unref(ns).e("input")), name: _ctx.name, disabled: unref(disabled), multiple: _ctx.multiple, accept: _ctx.accept, type: "file", onChange: handleChange, onClick: withModifiers(() => { }, ["stop"]) }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"]) ], 42, ["tabindex", "aria-disabled", "onKeydown"]); }; } }); var UploadContent = _export_sfc(_sfc_main4, [["__file", "upload-content.vue"]]); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/use-handlers.mjs var SCOPE2 = "ElUpload"; var revokeFileObjectURL = (file) => { var _a; if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) { URL.revokeObjectURL(file.url); } }; var useHandlers = (props, uploadRef) => { const uploadFiles = useVModel(props, "fileList", void 0, { passive: true }); const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid); function abort(file) { var _a; (_a = uploadRef.value) == null ? void 0 : _a.abort(file); } function clearFiles(states = ["ready", "uploading", "success", "fail"]) { uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status)); } function removeFile(file) { uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid); } const handleError = (err, rawFile) => { const file = getFile(rawFile); if (!file) return; console.error(err); file.status = "fail"; removeFile(file); props.onError(err, file, uploadFiles.value); props.onChange(file, uploadFiles.value); }; const handleProgress = (evt, rawFile) => { const file = getFile(rawFile); if (!file) return; props.onProgress(evt, file, uploadFiles.value); file.status = "uploading"; file.percentage = Math.round(evt.percent); }; const handleSuccess = (response, rawFile) => { const file = getFile(rawFile); if (!file) return; file.status = "success"; file.response = response; props.onSuccess(response, file, uploadFiles.value); props.onChange(file, uploadFiles.value); }; const handleStart = (file) => { if (isNil_default(file.uid)) file.uid = genFileId(); const uploadFile = { name: file.name, percentage: 0, status: "ready", size: file.size, raw: file, uid: file.uid }; if (props.listType === "picture-card" || props.listType === "picture") { try { uploadFile.url = URL.createObjectURL(file); } catch (err) { debugWarn(SCOPE2, err.message); props.onError(err, uploadFile, uploadFiles.value); } } uploadFiles.value = [...uploadFiles.value, uploadFile]; props.onChange(uploadFile, uploadFiles.value); }; const handleRemove = async (file) => { const uploadFile = file instanceof File ? getFile(file) : file; if (!uploadFile) throwError(SCOPE2, "file to be removed not found"); const doRemove = (file2) => { abort(file2); removeFile(file2); props.onRemove(file2, uploadFiles.value); revokeFileObjectURL(file2); }; if (props.beforeRemove) { const before = await props.beforeRemove(uploadFile, uploadFiles.value); if (before !== false) doRemove(uploadFile); } else { doRemove(uploadFile); } }; function submit() { uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => { var _a; return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw)); }); } watch(() => props.listType, (val) => { if (val !== "picture-card" && val !== "picture") { return; } uploadFiles.value = uploadFiles.value.map((file) => { const { raw, url } = file; if (!url && raw) { try { file.url = URL.createObjectURL(raw); } catch (err) { props.onError(err, file, uploadFiles.value); } } return file; }); }); watch(uploadFiles, (files) => { for (const file of files) { file.uid || (file.uid = genFileId()); file.status || (file.status = "success"); } }, { immediate: true, deep: true }); return { uploadFiles, abort, clearFiles, handleError, handleProgress, handleStart, handleSuccess, handleRemove, submit, revokeFileObjectURL }; }; // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/src/upload2.mjs var __default__5 = defineComponent({ name: "ElUpload" }); var _sfc_main5 = defineComponent({ ...__default__5, props: uploadProps, setup(__props, { expose }) { const props = __props; const disabled = useFormDisabled(); const uploadRef = shallowRef(); const { abort, submit, clearFiles, uploadFiles, handleStart, handleError, handleRemove, handleSuccess, handleProgress, revokeFileObjectURL: revokeFileObjectURL2 } = useHandlers(props, uploadRef); const isPictureCard = computed(() => props.listType === "picture-card"); const uploadContentProps2 = computed(() => ({ ...props, fileList: uploadFiles.value, onStart: handleStart, onProgress: handleProgress, onSuccess: handleSuccess, onError: handleError, onRemove: handleRemove })); onBeforeUnmount(() => { uploadFiles.value.forEach(revokeFileObjectURL2); }); provide(uploadContextKey, { accept: toRef(props, "accept") }); expose({ abort, submit, clearFiles, handleStart, handleRemove }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", null, [ unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, { key: 0, disabled: unref(disabled), "list-type": _ctx.listType, files: unref(uploadFiles), crossorigin: _ctx.crossorigin, "handle-preview": _ctx.onPreview, onRemove: unref(handleRemove) }, createSlots({ append: withCtx(() => [ createVNode(UploadContent, mergeProps({ ref_key: "uploadRef", ref: uploadRef }, unref(uploadContentProps2)), { default: withCtx(() => [ _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true), !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true) ]), _: 3 }, 16) ]), _: 2 }, [ _ctx.$slots.file ? { name: "default", fn: withCtx(({ file, index }) => [ renderSlot(_ctx.$slots, "file", { file, index }) ]) } : void 0 ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true), !unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({ key: 1, ref_key: "uploadRef", ref: uploadRef }, unref(uploadContentProps2)), { default: withCtx(() => [ _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true), !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true) ]), _: 3 }, 16)) : createCommentVNode("v-if", true), _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "tip"), !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, { key: 3, disabled: unref(disabled), "list-type": _ctx.listType, files: unref(uploadFiles), crossorigin: _ctx.crossorigin, "handle-preview": _ctx.onPreview, onRemove: unref(handleRemove) }, createSlots({ _: 2 }, [ _ctx.$slots.file ? { name: "default", fn: withCtx(({ file, index }) => [ renderSlot(_ctx.$slots, "file", { file, index }) ]) } : void 0 ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true) ]); }; } }); var Upload = _export_sfc(_sfc_main5, [["__file", "upload.vue"]]); // ../node_modules/.pnpm/element-plus@2.11.7_vue@3.5.24_typescript@5.9.3_/node_modules/element-plus/es/components/upload/index.mjs var ElUpload = withInstall(Upload); export { progressProps, ElProgress, uploadContextKey, uploadListTypes, genFileId, uploadBaseProps, uploadProps, uploadListProps, uploadListEmits, uploadDraggerProps, uploadDraggerEmits, uploadContentProps, ElUpload }; //# sourceMappingURL=chunk-KGN7MWY2.js.map