import { b as buildAssetsURL } from '../../handlers/renderer.mjs'; import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createVNode, Transition, withCtx, withDirectives, createElementVNode, toDisplayString, vShow, h, inject, normalizeStyle, createBlock, resolveDynamicComponent, createCommentVNode, useSlots, ref, provide, Teleport, mergeProps, createSlots, shallowReactive, watch, Fragment, withModifiers, getCurrentInstance, nextTick, useSSRContext, isRef, onScopeDispose, isVNode, createTextVNode, renderList, watchEffect, render, reactive, createApp, toRefs } from 'vue'; import { b as buildProps, l as isNumber, c as withInstall, d as definePropType, i as iconPropType, u as useLocale, F as FOCUS_TRAP_INJECTION_KEY, E as ElIcon, m as useDeprecated, n as ElFocusTrap, p as useGlobalComponentSettings, q as TypeComponentsMap, s as withInstallFunction, _ as _export_sfc, C as CloseComponents, U as UPDATE_MODEL_EVENT, e as isBoolean, t as useZIndex, v as useGlobalConfig, a as addUnit, x as mutable, y as TypeComponents, z as EVENT_CODE, A as hasClass, B as getStyle, D as addClass, G as messageConfig, f as _imports_1$3, I as removeClass, J as isElement, K as changeAnonymousHttp, L as MyUserDeleteCollectHttp, N as MyUserCollectHttp, O as MyUserPublishHttp } from './cross-icon-1e091146.mjs'; import { d as useNamespace, f as useId, g as defaultNamespace, t as throwError, u as useRouter, e as useRoute } from '../server.mjs'; import { NOOP, isObject, isFunction, isString, hyphenate } from '@vue/shared'; import { useEventListener, useResizeObserver, isClient, useTimeoutFn } from '@vueuse/core'; import { isUndefined } from 'lodash-unified'; import { computed as computed$1 } from '@vue/reactivity'; import { ssrRenderAttrs, ssrRenderAttr, ssrInterpolate, ssrRenderComponent, ssrRenderClass, ssrGetDirectiveProps, ssrRenderList } from 'vue/server-renderer'; import { _ as _export_sfc$1 } from './_plugin-vue_export-helper-e3874580.mjs'; import { useRoute as useRoute$1 } from 'vue-router'; let scrollBarWidth; const getScrollBarWidth = (namespace) => { var _a; if (!isClient) return 0; if (scrollBarWidth !== void 0) return scrollBarWidth; const outer = document.createElement("div"); outer.className = `${namespace}-scrollbar__wrap`; outer.style.visibility = "hidden"; outer.style.width = "100px"; outer.style.position = "absolute"; outer.style.top = "-9999px"; document.body.appendChild(outer); const widthNoScroll = outer.offsetWidth; outer.style.overflow = "scroll"; const inner = document.createElement("div"); inner.style.width = "100%"; outer.appendChild(inner); const widthWithScroll = inner.offsetWidth; (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer); scrollBarWidth = widthNoScroll - widthWithScroll; return scrollBarWidth; }; const composeRefs = (...refs) => { return (el) => { refs.forEach((ref2) => { if (isFunction(ref2)) { ref2(el); } else { ref2.value = el; } }); }; }; var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => { PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT"; PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS"; PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE"; PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS"; PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS"; PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS"; PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT"; PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT"; PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT"; PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH"; PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS"; PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED"; PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL"; return PatchFlags2; })(PatchFlags || {}); const useLockscreen = (trigger, options = {}) => { if (!isRef(trigger)) { throwError("[useLockscreen]", "You need to pass a ref param to this function"); } const ns = options.ns || useNamespace("popup"); const hiddenCls = computed$1(() => ns.bm("parent", "hidden")); if (!isClient || hasClass(document.body, hiddenCls.value)) { return; } let scrollBarWidth2 = 0; let withoutHiddenClass = false; let bodyWidth = "0"; const cleanup = () => { setTimeout(() => { removeClass(document == null ? void 0 : document.body, hiddenCls.value); if (withoutHiddenClass && document) { document.body.style.width = bodyWidth; } }, 200); }; watch(trigger, (val) => { if (!val) { cleanup(); return; } withoutHiddenClass = !hasClass(document.body, hiddenCls.value); if (withoutHiddenClass) { bodyWidth = document.body.style.width; } scrollBarWidth2 = getScrollBarWidth(ns.namespace.value); const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight; const bodyOverflowY = getStyle(document.body, "overflowY"); if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) { document.body.style.width = `calc(100% - ${scrollBarWidth2}px)`; } addClass(document.body, hiddenCls.value); }); onScopeDispose(() => cleanup()); }; const useSameTarget = (handleClick) => { if (!handleClick) { return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP }; } let mousedownTarget = false; let mouseupTarget = false; const onClick = (e) => { if (mousedownTarget && mouseupTarget) { handleClick(e); } mousedownTarget = mouseupTarget = false; }; const onMousedown = (e) => { mousedownTarget = e.target === e.currentTarget; }; const onMouseup = (e) => { mouseupTarget = e.target === e.currentTarget; }; return { onClick, onMousedown, onMouseup }; }; const badgeProps = buildProps({ value: { type: [String, Number], default: "" }, max: { type: Number, default: 99 }, isDot: Boolean, hidden: Boolean, type: { type: String, values: ["primary", "success", "warning", "info", "danger"], default: "danger" } }); const _hoisted_1$3 = ["textContent"]; const __default__$3 = defineComponent({ name: "ElBadge" }); const _sfc_main$6 = /* @__PURE__ */ defineComponent({ ...__default__$3, props: badgeProps, setup(__props, { expose }) { const props = __props; const ns = useNamespace("badge"); const content = computed(() => { if (props.isDot) return ""; if (isNumber(props.value) && isNumber(props.max)) { return props.max < props.value ? `${props.max}+` : `${props.value}`; } return `${props.value}`; }); expose({ content }); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [ renderSlot(_ctx.$slots, "default"), createVNode(Transition, { name: `${unref(ns).namespace.value}-zoom-in-center`, persisted: "" }, { default: withCtx(() => [ withDirectives(createElementVNode("sup", { class: normalizeClass([ unref(ns).e("content"), unref(ns).em("content", _ctx.type), unref(ns).is("fixed", !!_ctx.$slots.default), unref(ns).is("dot", _ctx.isDot) ]), textContent: toDisplayString(unref(content)) }, null, 10, _hoisted_1$3), [ [vShow, !_ctx.hidden && (unref(content) || _ctx.isDot)] ]) ]), _: 1 }, 8, ["name"]) ], 2); }; } }); var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]); const ElBadge = withInstall(Badge); const overlayProps = buildProps({ mask: { type: Boolean, default: true }, customMaskEvent: { type: Boolean, default: false }, overlayClass: { type: definePropType([ String, Array, Object ]) }, zIndex: { type: definePropType([String, Number]) } }); const overlayEmits = { click: (evt) => evt instanceof MouseEvent }; const BLOCK = "overlay"; var Overlay = defineComponent({ name: "ElOverlay", props: overlayProps, emits: overlayEmits, setup(props, { slots, emit }) { const ns = useNamespace(BLOCK); const onMaskClick = (e) => { emit("click", e); }; const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick); return () => { return props.mask ? createVNode("div", { class: [ns.b(), props.overlayClass], style: { zIndex: props.zIndex }, onClick, onMousedown, onMouseup }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h("div", { class: props.overlayClass, style: { zIndex: props.zIndex, position: "fixed", top: "0px", right: "0px", bottom: "0px", left: "0px" } }, [renderSlot(slots, "default")]); }; } }); const ElOverlay = Overlay; const dialogInjectionKey = Symbol("dialogInjectionKey"); const dialogContentProps = buildProps({ center: Boolean, alignCenter: Boolean, closeIcon: { type: iconPropType }, customClass: { type: String, default: "" }, draggable: Boolean, fullscreen: Boolean, showClose: { type: Boolean, default: true }, title: { type: String, default: "" }, ariaLevel: { type: String, default: "2" } }); const dialogContentEmits = { close: () => true }; const _hoisted_1$2 = ["aria-level"]; const _hoisted_2$1 = ["aria-label"]; const _hoisted_3 = ["id"]; const __default__$2 = defineComponent({ name: "ElDialogContent" }); const _sfc_main$5 = /* @__PURE__ */ defineComponent({ ...__default__$2, props: dialogContentProps, emits: dialogContentEmits, setup(__props) { const props = __props; const { t } = useLocale(); const { Close } = CloseComponents; const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey); const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY); const dialogKls = computed(() => [ ns.b(), ns.is("fullscreen", props.fullscreen), ns.is("draggable", props.draggable), ns.is("align-center", props.alignCenter), { [ns.m("center")]: props.center }, props.customClass ]); const composedDialogRef = composeRefs(focusTrapRef, dialogRef); computed(() => props.draggable); return (_ctx, _cache) => { return openBlock(), createElementBlock("div", { ref: unref(composedDialogRef), class: normalizeClass(unref(dialogKls)), style: normalizeStyle(unref(style)), tabindex: "-1" }, [ createElementVNode("header", { ref_key: "headerRef", ref: headerRef, class: normalizeClass(unref(ns).e("header")) }, [ renderSlot(_ctx.$slots, "header", {}, () => [ createElementVNode("span", { role: "heading", "aria-level": _ctx.ariaLevel, class: normalizeClass(unref(ns).e("title")) }, toDisplayString(_ctx.title), 11, _hoisted_1$2) ]), _ctx.showClose ? (openBlock(), createElementBlock("button", { key: 0, "aria-label": unref(t)("el.dialog.close"), class: normalizeClass(unref(ns).e("headerbtn")), type: "button", onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close")) }, [ createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close)))) ]), _: 1 }, 8, ["class"]) ], 10, _hoisted_2$1)) : createCommentVNode("v-if", true) ], 2), createElementVNode("div", { id: unref(bodyId), class: normalizeClass(unref(ns).e("body")) }, [ renderSlot(_ctx.$slots, "default") ], 10, _hoisted_3), _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", { key: 0, class: normalizeClass(unref(ns).e("footer")) }, [ renderSlot(_ctx.$slots, "footer") ], 2)) : createCommentVNode("v-if", true) ], 6); }; } }); var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]); const dialogProps = buildProps({ ...dialogContentProps, appendToBody: Boolean, appendTo: { type: definePropType(String), default: "body" }, beforeClose: { type: definePropType(Function) }, destroyOnClose: Boolean, closeOnClickModal: { type: Boolean, default: true }, closeOnPressEscape: { type: Boolean, default: true }, lockScroll: { type: Boolean, default: true }, modal: { type: Boolean, default: true }, openDelay: { type: Number, default: 0 }, closeDelay: { type: Number, default: 0 }, top: { type: String }, modelValue: Boolean, modalClass: String, width: { type: [String, Number] }, zIndex: { type: Number }, trapFocus: { type: Boolean, default: false }, headerAriaLevel: { type: String, default: "2" } }); const dialogEmits = { open: () => true, opened: () => true, close: () => true, closed: () => true, [UPDATE_MODEL_EVENT]: (value) => isBoolean(value), openAutoFocus: () => true, closeAutoFocus: () => true }; const useDialog = (props, targetRef) => { var _a; const instance = getCurrentInstance(); const emit = instance.emit; const { nextZIndex } = useZIndex(); let lastPosition = ""; const titleId = useId(); const bodyId = useId(); const visible = ref(false); const closed = ref(false); const rendered = ref(false); const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex()); let openTimer = void 0; let closeTimer = void 0; const namespace = useGlobalConfig("namespace", defaultNamespace); const style = computed(() => { const style2 = {}; const varPrefix = `--${namespace.value}-dialog`; if (!props.fullscreen) { if (props.top) { style2[`${varPrefix}-margin-top`] = props.top; } if (props.width) { style2[`${varPrefix}-width`] = addUnit(props.width); } } return style2; }); const overlayDialogStyle = computed(() => { if (props.alignCenter) { return { display: "flex" }; } return {}; }); function afterEnter() { emit("opened"); } function afterLeave() { emit("closed"); emit(UPDATE_MODEL_EVENT, false); if (props.destroyOnClose) { rendered.value = false; } } function beforeLeave() { emit("close"); } function open() { closeTimer == null ? void 0 : closeTimer(); openTimer == null ? void 0 : openTimer(); if (props.openDelay && props.openDelay > 0) { ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay)); } else { doOpen(); } } function close() { openTimer == null ? void 0 : openTimer(); closeTimer == null ? void 0 : closeTimer(); if (props.closeDelay && props.closeDelay > 0) { ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay)); } else { doClose(); } } function handleClose() { function hide(shouldCancel) { if (shouldCancel) return; closed.value = true; visible.value = false; } if (props.beforeClose) { props.beforeClose(hide); } else { close(); } } function onModalClick() { if (props.closeOnClickModal) { handleClose(); } } function doOpen() { if (!isClient) return; visible.value = true; } function doClose() { visible.value = false; } function onOpenAutoFocus() { emit("openAutoFocus"); } function onCloseAutoFocus() { emit("closeAutoFocus"); } function onFocusoutPrevented(event) { var _a2; if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") { event.preventDefault(); } } if (props.lockScroll) { useLockscreen(visible); } function onCloseRequested() { if (props.closeOnPressEscape) { handleClose(); } } watch(() => props.modelValue, (val) => { if (val) { closed.value = false; open(); rendered.value = true; zIndex.value = isUndefined(props.zIndex) ? nextZIndex() : zIndex.value++; nextTick(() => { emit("open"); if (targetRef.value) { targetRef.value.scrollTop = 0; } }); } else { if (visible.value) { close(); } } }); watch(() => props.fullscreen, (val) => { if (!targetRef.value) return; if (val) { lastPosition = targetRef.value.style.transform; targetRef.value.style.transform = ""; } else { targetRef.value.style.transform = lastPosition; } }); return { afterEnter, afterLeave, beforeLeave, handleClose, onModalClick, close, doClose, onOpenAutoFocus, onCloseAutoFocus, onCloseRequested, onFocusoutPrevented, titleId, bodyId, closed, style, overlayDialogStyle, rendered, visible, zIndex }; }; const _hoisted_1$1 = ["aria-label", "aria-labelledby", "aria-describedby"]; const __default__$1 = defineComponent({ name: "ElDialog", inheritAttrs: false }); const _sfc_main$4 = /* @__PURE__ */ defineComponent({ ...__default__$1, props: dialogProps, emits: dialogEmits, setup(__props, { expose }) { const props = __props; const slots = useSlots(); useDeprecated({ scope: "el-dialog", from: "the title slot", replacement: "the header slot", version: "3.0.0", ref: "https://element-plus.org/en-US/component/dialog.html#slots" }, computed(() => !!slots.title)); useDeprecated({ scope: "el-dialog", from: "custom-class", replacement: "class", version: "2.3.0", ref: "https://element-plus.org/en-US/component/dialog.html#attributes", type: "Attribute" }, computed(() => !!props.customClass)); const ns = useNamespace("dialog"); const dialogRef = ref(); const headerRef = ref(); const dialogContentRef = ref(); const { visible, titleId, bodyId, style, overlayDialogStyle, rendered, zIndex, afterEnter, afterLeave, beforeLeave, handleClose, onModalClick, onOpenAutoFocus, onCloseAutoFocus, onCloseRequested, onFocusoutPrevented } = useDialog(props, dialogRef); provide(dialogInjectionKey, { dialogRef, headerRef, bodyId, ns, rendered, style }); const overlayEvent = useSameTarget(onModalClick); const draggable = computed(() => props.draggable && !props.fullscreen); expose({ visible, dialogContentRef }); return (_ctx, _cache) => { return openBlock(), createBlock(Teleport, { to: _ctx.appendTo, disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody }, [ createVNode(Transition, { name: "dialog-fade", onAfterEnter: unref(afterEnter), onAfterLeave: unref(afterLeave), onBeforeLeave: unref(beforeLeave), persisted: "" }, { default: withCtx(() => [ withDirectives(createVNode(unref(ElOverlay), { "custom-mask-event": "", mask: _ctx.modal, "overlay-class": _ctx.modalClass, "z-index": unref(zIndex) }, { default: withCtx(() => [ createElementVNode("div", { role: "dialog", "aria-modal": "true", "aria-label": _ctx.title || void 0, "aria-labelledby": !_ctx.title ? unref(titleId) : void 0, "aria-describedby": unref(bodyId), class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`), style: normalizeStyle(unref(overlayDialogStyle)), onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)), onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)), onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args)) }, [ createVNode(unref(ElFocusTrap), { loop: "", trapped: unref(visible), "focus-start-el": "container", onFocusAfterTrapped: unref(onOpenAutoFocus), onFocusAfterReleased: unref(onCloseAutoFocus), onFocusoutPrevented: unref(onFocusoutPrevented), onReleaseRequested: unref(onCloseRequested) }, { default: withCtx(() => [ unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({ key: 0, ref_key: "dialogContentRef", ref: dialogContentRef }, _ctx.$attrs, { "custom-class": _ctx.customClass, center: _ctx.center, "align-center": _ctx.alignCenter, "close-icon": _ctx.closeIcon, draggable: unref(draggable), fullscreen: _ctx.fullscreen, "show-close": _ctx.showClose, title: _ctx.title, "aria-level": _ctx.headerAriaLevel, onClose: unref(handleClose) }), createSlots({ header: withCtx(() => [ !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", { key: 0, close: unref(handleClose), titleId: unref(titleId), titleClass: unref(ns).e("title") }) : renderSlot(_ctx.$slots, "title", { key: 1 }) ]), default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 2 }, [ _ctx.$slots.footer ? { name: "footer", fn: withCtx(() => [ renderSlot(_ctx.$slots, "footer") ]) } : void 0 ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : createCommentVNode("v-if", true) ]), _: 3 }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"]) ], 46, _hoisted_1$1) ]), _: 3 }, 8, ["mask", "overlay-class", "z-index"]), [ [vShow, unref(visible)] ]) ]), _: 3 }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"]) ], 8, ["to", "disabled"]); }; } }); var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]); const ElDialog = withInstall(Dialog); function createLoadingComponent(options) { let afterLeaveTimer; const afterLeaveFlag = ref(false); const data = reactive({ ...options, originalPosition: "", originalOverflow: "", visible: false }); function setText(text) { data.text = text; } function destroySelf() { const target = data.parent; const ns = vm.ns; if (!target.vLoadingAddClassList) { let loadingNumber = target.getAttribute("loading-number"); loadingNumber = Number.parseInt(loadingNumber) - 1; if (!loadingNumber) { removeClass(target, ns.bm("parent", "relative")); target.removeAttribute("loading-number"); } else { target.setAttribute("loading-number", loadingNumber.toString()); } removeClass(target, ns.bm("parent", "hidden")); } removeElLoadingChild(); loadingInstance.unmount(); } function removeElLoadingChild() { var _a, _b; (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el); } function close() { var _a; if (options.beforeClose && !options.beforeClose()) return; afterLeaveFlag.value = true; clearTimeout(afterLeaveTimer); afterLeaveTimer = window.setTimeout(handleAfterLeave, 400); data.visible = false; (_a = options.closed) == null ? void 0 : _a.call(options); } function handleAfterLeave() { if (!afterLeaveFlag.value) return; const target = data.parent; afterLeaveFlag.value = false; target.vLoadingAddClassList = void 0; destroySelf(); } const elLoadingComponent = defineComponent({ name: "ElLoading", setup(_, { expose }) { const { ns, zIndex } = useGlobalComponentSettings("loading"); expose({ ns, zIndex }); return () => { const svg = data.spinner || data.svg; const spinner = h("svg", { class: "circular", viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50", ...svg ? { innerHTML: svg } : {} }, [ h("circle", { class: "path", cx: "25", cy: "25", r: "20", fill: "none" }) ]); const spinnerText = data.text ? h("p", { class: ns.b("text") }, [data.text]) : void 0; return h(Transition, { name: ns.b("fade"), onAfterLeave: handleAfterLeave }, { default: withCtx(() => [ withDirectives(createVNode("div", { style: { backgroundColor: data.background || "" }, class: [ ns.b("mask"), data.customClass, data.fullscreen ? "is-fullscreen" : "" ] }, [ h("div", { class: ns.b("spinner") }, [spinner, spinnerText]) ]), [[vShow, data.visible]]) ]) }); }; } }); const loadingInstance = createApp(elLoadingComponent); const vm = loadingInstance.mount(document.createElement("div")); return { ...toRefs(data), setText, removeElLoadingChild, close, handleAfterLeave, vm, get $el() { return vm.$el; } }; } let fullscreenInstance = void 0; const Loading = function(options = {}) { if (!isClient) return void 0; const resolved = resolveOptions(options); if (resolved.fullscreen && fullscreenInstance) { return fullscreenInstance; } const instance = createLoadingComponent({ ...resolved, closed: () => { var _a; (_a = resolved.closed) == null ? void 0 : _a.call(resolved); if (resolved.fullscreen) fullscreenInstance = void 0; } }); addStyle(resolved, resolved.parent, instance); addClassList(resolved, resolved.parent, instance); resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance); let loadingNumber = resolved.parent.getAttribute("loading-number"); if (!loadingNumber) { loadingNumber = "1"; } else { loadingNumber = `${Number.parseInt(loadingNumber) + 1}`; } resolved.parent.setAttribute("loading-number", loadingNumber); resolved.parent.appendChild(instance.$el); nextTick(() => instance.visible.value = resolved.visible); if (resolved.fullscreen) { fullscreenInstance = instance; } return instance; }; const resolveOptions = (options) => { var _a, _b, _c, _d; let target; if (isString(options.target)) { target = (_a = document.querySelector(options.target)) != null ? _a : document.body; } else { target = options.target || document.body; } return { parent: target === document.body || options.body ? document.body : target, background: options.background || "", svg: options.svg || "", svgViewBox: options.svgViewBox || "", spinner: options.spinner || false, text: options.text || "", fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true), lock: (_c = options.lock) != null ? _c : false, customClass: options.customClass || "", visible: (_d = options.visible) != null ? _d : true, target }; }; const addStyle = async (options, parent, instance) => { const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex; const maskStyle = {}; if (options.fullscreen) { instance.originalPosition.value = getStyle(document.body, "position"); instance.originalOverflow.value = getStyle(document.body, "overflow"); maskStyle.zIndex = nextZIndex(); } else if (options.parent === document.body) { instance.originalPosition.value = getStyle(document.body, "position"); await nextTick(); for (const property of ["top", "left"]) { const scroll = property === "top" ? "scrollTop" : "scrollLeft"; maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`; } for (const property of ["height", "width"]) { maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`; } } else { instance.originalPosition.value = getStyle(parent, "position"); } for (const [key, value] of Object.entries(maskStyle)) { instance.$el.style[key] = value; } }; const addClassList = (options, parent, instance) => { const ns = instance.vm.ns || instance.vm._.exposed.ns; if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) { addClass(parent, ns.bm("parent", "relative")); } else { removeClass(parent, ns.bm("parent", "relative")); } if (options.fullscreen && options.lock) { addClass(parent, ns.bm("parent", "hidden")); } else { removeClass(parent, ns.bm("parent", "hidden")); } }; const INSTANCE_KEY = Symbol("ElLoading"); const createInstance = (el, binding) => { var _a, _b, _c, _d; const vm = binding.instance; const getBindingProp = (key) => isObject(binding.value) ? binding.value[key] : void 0; const resolveExpression = (key) => { const data = isString(key) && (vm == null ? void 0 : vm[key]) || key; if (data) return ref(data); else return data; }; const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`)); const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen; const options = { text: getProp("text"), svg: getProp("svg"), svgViewBox: getProp("svgViewBox"), spinner: getProp("spinner"), background: getProp("background"), customClass: getProp("customClass"), fullscreen, target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el, body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body, lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock }; el[INSTANCE_KEY] = { options, instance: Loading(options) }; }; const updateOptions = (newOptions, originalOptions) => { for (const key of Object.keys(originalOptions)) { if (isRef(originalOptions[key])) originalOptions[key].value = newOptions[key]; } }; const vLoading = { mounted(el, binding) { if (binding.value) { createInstance(el, binding); } }, updated(el, binding) { const instance = el[INSTANCE_KEY]; if (binding.oldValue !== binding.value) { if (binding.value && !binding.oldValue) { createInstance(el, binding); } else if (binding.value && binding.oldValue) { if (isObject(binding.value)) updateOptions(binding.value, instance.options); } else { instance == null ? void 0 : instance.instance.close(); } } }, unmounted(el) { var _a; (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close(); } }; const messageTypes = ["success", "info", "warning", "error"]; const messageDefaults = mutable({ customClass: "", center: false, dangerouslyUseHTMLString: false, duration: 3e3, icon: void 0, id: "", message: "", onClose: void 0, showClose: false, type: "info", offset: 16, zIndex: 0, grouping: false, repeatNum: 1, appendTo: isClient ? document.body : void 0 }); const messageProps = buildProps({ customClass: { type: String, default: messageDefaults.customClass }, center: { type: Boolean, default: messageDefaults.center }, dangerouslyUseHTMLString: { type: Boolean, default: messageDefaults.dangerouslyUseHTMLString }, duration: { type: Number, default: messageDefaults.duration }, icon: { type: iconPropType, default: messageDefaults.icon }, id: { type: String, default: messageDefaults.id }, message: { type: definePropType([ String, Object, Function ]), default: messageDefaults.message }, onClose: { type: definePropType(Function), required: false }, showClose: { type: Boolean, default: messageDefaults.showClose }, type: { type: String, values: messageTypes, default: messageDefaults.type }, offset: { type: Number, default: messageDefaults.offset }, zIndex: { type: Number, default: messageDefaults.zIndex }, grouping: { type: Boolean, default: messageDefaults.grouping }, repeatNum: { type: Number, default: messageDefaults.repeatNum } }); const messageEmits = { destroy: () => true }; const instances = shallowReactive([]); const getInstance = (id) => { const idx = instances.findIndex((instance) => instance.id === id); const current = instances[idx]; let prev; if (idx > 0) { prev = instances[idx - 1]; } return { current, prev }; }; const getLastOffset = (id) => { const { prev } = getInstance(id); if (!prev) return 0; return prev.vm.exposed.bottom.value; }; const getOffsetOrSpace = (id, offset) => { const idx = instances.findIndex((instance) => instance.id === id); return idx > 0 ? 20 : offset; }; const _hoisted_1 = ["id"]; const _hoisted_2 = ["innerHTML"]; const __default__ = defineComponent({ name: "ElMessage" }); const _sfc_main$3 = /* @__PURE__ */ defineComponent({ ...__default__, props: messageProps, emits: messageEmits, setup(__props, { expose }) { const props = __props; const { Close } = TypeComponents; const { ns, zIndex } = useGlobalComponentSettings("message"); const { currentZIndex, nextZIndex } = zIndex; const messageRef = ref(); const visible = ref(false); const height = ref(0); let stopTimer = void 0; const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info"); const typeClass = computed(() => { const type = props.type; return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] }; }); const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || ""); const lastOffset = computed(() => getLastOffset(props.id)); const offset = computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value); const bottom = computed(() => height.value + offset.value); const customStyle = computed(() => ({ top: `${offset.value}px`, zIndex: currentZIndex.value })); function startTimer() { if (props.duration === 0) return; ({ stop: stopTimer } = useTimeoutFn(() => { close(); }, props.duration)); } function clearTimer() { stopTimer == null ? void 0 : stopTimer(); } function close() { visible.value = false; } function keydown({ code }) { if (code === EVENT_CODE.esc) { close(); } } watch(() => props.repeatNum, () => { clearTimer(); startTimer(); }); useEventListener(document, "keydown", keydown); useResizeObserver(messageRef, () => { height.value = messageRef.value.getBoundingClientRect().height; }); expose({ visible, bottom, close }); return (_ctx, _cache) => { return openBlock(), createBlock(Transition, { name: unref(ns).b("fade"), onBeforeLeave: _ctx.onClose, onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")), persisted: "" }, { default: withCtx(() => [ withDirectives(createElementVNode("div", { id: _ctx.id, ref_key: "messageRef", ref: messageRef, class: normalizeClass([ unref(ns).b(), { [unref(ns).m(_ctx.type)]: _ctx.type && !_ctx.icon }, unref(ns).is("center", _ctx.center), unref(ns).is("closable", _ctx.showClose), _ctx.customClass ]), style: normalizeStyle(unref(customStyle)), role: "alert", onMouseenter: clearTimer, onMouseleave: startTimer }, [ _ctx.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), { key: 0, value: _ctx.repeatNum, type: unref(badgeType), class: normalizeClass(unref(ns).e("badge")) }, null, 8, ["value", "type", "class"])) : createCommentVNode("v-if", true), unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), { key: 1, class: normalizeClass([unref(ns).e("icon"), unref(typeClass)]) }, { default: withCtx(() => [ (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent)))) ]), _: 1 }, 8, ["class"])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", {}, () => [ !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", { key: 0, class: normalizeClass(unref(ns).e("content")) }, toDisplayString(_ctx.message), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [ createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), createElementVNode("p", { class: normalizeClass(unref(ns).e("content")), innerHTML: _ctx.message }, null, 10, _hoisted_2) ], 2112)) ]), _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), { key: 2, class: normalizeClass(unref(ns).e("closeBtn")), onClick: withModifiers(close, ["stop"]) }, { default: withCtx(() => [ createVNode(unref(Close)) ]), _: 1 }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true) ], 46, _hoisted_1), [ [vShow, visible.value] ]) ]), _: 3 }, 8, ["name", "onBeforeLeave"]); }; } }); var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]); let seed = 1; const normalizeOptions = (params) => { const options = !params || isString(params) || isVNode(params) || isFunction(params) ? { message: params } : params; const normalized = { ...messageDefaults, ...options }; if (!normalized.appendTo) { normalized.appendTo = document.body; } else if (isString(normalized.appendTo)) { let appendTo = document.querySelector(normalized.appendTo); if (!isElement(appendTo)) { appendTo = document.body; } normalized.appendTo = appendTo; } return normalized; }; const closeMessage = (instance) => { const idx = instances.indexOf(instance); if (idx === -1) return; instances.splice(idx, 1); const { handler } = instance; handler.close(); }; const createMessage = ({ appendTo, ...options }, context) => { const id = `message_${seed++}`; const userOnClose = options.onClose; const container = document.createElement("div"); const props = { ...options, id, onClose: () => { userOnClose == null ? void 0 : userOnClose(); closeMessage(instance); }, onDestroy: () => { render(null, container); } }; const vnode = createVNode(MessageConstructor, props, isFunction(props.message) || isVNode(props.message) ? { default: isFunction(props.message) ? props.message : () => props.message } : null); vnode.appContext = context || message._context; render(vnode, container); appendTo.appendChild(container.firstElementChild); const vm = vnode.component; const handler = { close: () => { vm.exposed.visible.value = false; } }; const instance = { id, vnode, vm, handler, props: vnode.component.props }; return instance; }; const message = (options = {}, context) => { if (!isClient) return { close: () => void 0 }; if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) { return { close: () => void 0 }; } const normalized = normalizeOptions(options); if (normalized.grouping && instances.length) { const instance2 = instances.find(({ vnode: vm }) => { var _a; return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message; }); if (instance2) { instance2.props.repeatNum += 1; instance2.props.type = normalized.type; return instance2.handler; } } const instance = createMessage(normalized, context); instances.push(instance); return instance.handler; }; messageTypes.forEach((type) => { message[type] = (options = {}, appContext) => { const normalized = normalizeOptions(options); return message({ ...normalized, type }, appContext); }; }); function closeAll(type) { for (const instance of instances) { if (!type || type === instance.props.type) { instance.handler.close(); } } } message.closeAll = closeAll; message._context = null; const ElMessage = withInstallFunction(message, "$message"); const _imports_0$1 = "" + buildAssetsURL("dot-yellow.4b5e135b.svg"); const _imports_1$2 = "" + buildAssetsURL("dot-gray.86cdd7b5.svg"); const _imports_2$2 = "" + buildAssetsURL("empty-icon.24a01ae2.svg"); const _sfc_main$2 = { __name: "Empty", __ssrInlineRender: true, props: { hint: String }, setup(__props) { return (_ctx, _push, _parent, _attrs) => { _push(`