@wfrog/vc
Version:
`自用` 的基于 `element-plus` 二次封装的 `vue3` 组件库。追求在业务场景中,尽可能使用更少的代码量来实现需求。 因此在组件封装上,以 `方便` 为主,打包仅 `esm` 模式。
1,440 lines • 108 kB
JavaScript
import { defineComponent as D, onMounted as ne, openBlock as v, createElementBlock as E, normalizeClass as w, isRef as z, ref as S, unref as e, getCurrentScope as Rt, onScopeDispose as Ft, getCurrentInstance as jt, nextTick as J, computed as b, shallowRef as be, watch as q, provide as Ze, inject as Qe, resolveComponent as Lt, createBlock as C, withCtx as _, resolveDynamicComponent as Le, createElementVNode as U, createVNode as M, mergeProps as K, createCommentVNode as A, renderSlot as j, withDirectives as H, Fragment as le, renderList as pe, createTextVNode as I, toDisplayString as G, useCssModule as he, createSlots as _e, vShow as te, onUnmounted as Ht, normalizeStyle as Q, useCssVars as Ee, onBeforeMount as He, reactive as zt, Transition as Gt, withKeys as Be, useSlots as ct, onBeforeUnmount as Wt } from "vue";
import { defaultWindow as L, loader as oe, storage as ke, file as Ve, tree as qt } from "@wfrog/utils";
import { ElIcon as Pe, ElPopconfirm as dt, ElButton as W, ElMessageBox as Kt, vLoading as ue, ElRadioGroup as Yt, ElRadioButton as Zt, ElCheckboxGroup as Qt, ElCheckboxButton as Jt, ElDialog as Xt, ElScrollbar as Me, ElSpace as Ne, ElLink as el, ElInput as Te, ElSelect as ze, ElOption as Ge, ElDatePicker as tl, ElUpload as pt, ElImage as ge, ElAlert as ft, ElDrawer as ll, ElTooltip as mt, ElInputNumber as nl, ElSlider as Je, ElSwitch as Xe, ElTag as et, ElPopover as vt, ElTree as ol, ElCascaderPanel as al } from "element-plus";
import * as sl from "@element-plus/icons-vue";
import { CopyDocument as ul, FullScreen as il, Close as rl, Camera as cl, Upload as dl, Search as pl } from "@element-plus/icons-vue";
import { debounce as fl, isEqual as ml, isBoolean as vl, get as yl } from "lodash-es";
import yt from "vuedraggable";
const Oe = /* @__PURE__ */ D({
__name: "index",
props: {
name: { type: String, default: "" },
mode: { type: String, default: "css" }
},
setup(l) {
const o = l, t = async () => {
const n = o.mode === "svg" ? "fontawesomeJs" : "fontawesomeCss";
await oe.loadCdnSingle(n);
};
return ne(() => {
L && (L.ElementPlusComponents?.isAwesomeIconLock || (L.ElementPlusComponents = { ...L.ElementPlusComponents, isAwesomeIconLock: !0 }, t()));
}), (n, s) => (v(), E("i", {
class: w(["awesome-icon", o.name])
}, null, 2));
}
}), gl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Oe
}, Symbol.toStringTag, { value: "Module" }));
var tt;
const We = typeof window < "u", _l = (l) => typeof l == "string", Ae = () => {
};
We && ((tt = window?.navigator) == null ? void 0 : tt.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function xe(l) {
return typeof l == "function" ? l() : e(l);
}
function bl(l, o) {
function t(...n) {
l(() => o.apply(this, n), { fn: o, thisArg: this, args: n });
}
return t;
}
function hl(l, o = !0, t = !0) {
let n = 0, s, u = !0;
const a = () => {
s && (clearTimeout(s), s = void 0);
};
return (d) => {
const c = xe(l), h = Date.now() - n;
if (a(), c <= 0)
return n = Date.now(), d();
h > c && (t || !u) ? (n = Date.now(), d()) : o && (s = setTimeout(() => {
n = Date.now(), u = !0, a(), d();
}, c)), !t && !s && (s = setTimeout(() => u = !0, c)), u = !1;
};
}
function $l(l) {
return l;
}
function Sl(l) {
let o;
function t() {
return o || (o = l()), o;
}
return t.reset = async () => {
const n = o;
o = void 0, n && await n;
}, t;
}
function Cl(l) {
return Rt() ? (Ft(l), !0) : !1;
}
function Ue(l, o = 200, t = !1, n = !0) {
return bl(hl(o, t, n), l);
}
function wl(l, o = !0) {
jt() ? ne(l) : o ? l() : J(l);
}
function Re(l = !1, o = {}) {
const {
truthyValue: t = !0,
falsyValue: n = !1
} = o, s = z(l), u = S(l);
function a(r) {
if (arguments.length)
return u.value = r, u.value;
{
const d = xe(t);
return u.value = u.value === d ? xe(n) : d, u.value;
}
}
return s ? a : [u, a];
}
function ve(l) {
var o;
const t = xe(l);
return (o = t?.$el) != null ? o : t;
}
const gt = We ? window : void 0, qe = We ? window.navigator : void 0;
function de(...l) {
let o, t, n, s;
if (_l(l[0]) ? ([t, n, s] = l, o = gt) : [o, t, n, s] = l, !o)
return Ae;
let u = Ae;
const a = q(() => ve(o), (d) => {
u(), d && (d.addEventListener(t, n, s), u = () => {
d.removeEventListener(t, n, s), u = Ae;
});
}, { immediate: !0, flush: "post" }), r = () => {
a(), u();
};
return Cl(r), r;
}
function kl(l, o, t = {}) {
const { window: n = gt, ignore: s, capture: u = !0, detectIframe: a = !1 } = t;
if (!n)
return;
const r = S(!0);
let d;
const c = (p) => {
n.clearTimeout(d);
const i = ve(l);
!i || i === p.target || p.composedPath().includes(i) || !r.value || o(p);
}, h = (p) => s && s.some((i) => {
const $ = ve(i);
return $ && (p.target === $ || p.composedPath().includes($));
}), f = [
de(n, "click", c, { passive: !0, capture: u }),
de(n, "pointerdown", (p) => {
const i = ve(l);
r.value = !!i && !p.composedPath().includes(i) && !h(p);
}, { passive: !0 }),
de(n, "pointerup", (p) => {
if (p.button === 0) {
const i = p.composedPath();
p.composedPath = () => i, d = n.setTimeout(() => c(p), 50);
}
}, { passive: !0 }),
a && de(n, "blur", (p) => {
var i;
const $ = ve(l);
((i = document.activeElement) == null ? void 0 : i.tagName) === "IFRAME" && !$?.contains(document.activeElement) && o(p);
})
].filter(Boolean);
return () => f.forEach((p) => p());
}
function Ke(l, o = !1) {
const t = S(), n = () => t.value = Boolean(l());
return n(), wl(n, o), t;
}
const Fe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, je = "__vueuse_ssr_handlers__";
Fe[je] = Fe[je] || {};
Fe[je];
function Vl(l, o = {}) {
const {
controls: t = !1,
navigator: n = qe
} = o, s = Ke(() => n && "permissions" in n);
let u;
const a = typeof l == "string" ? { name: l } : l, r = S(), d = () => {
u && (r.value = u.state);
}, c = Sl(async () => {
if (!!s.value) {
if (!u)
try {
u = await n.permissions.query(a), de(u, "change", d), d();
} catch {
r.value = "prompt";
}
return u;
}
});
return c(), t ? {
state: r,
isSupported: s,
query: c
} : r;
}
function Ml(l = {}) {
const {
navigator: o = qe,
requestPermissions: t = !1,
constraints: n = { audio: !0, video: !0 },
onUpdated: s
} = l, u = S([]), a = b(() => u.value.filter((p) => p.kind === "videoinput")), r = b(() => u.value.filter((p) => p.kind === "audioinput")), d = b(() => u.value.filter((p) => p.kind === "audiooutput")), c = Ke(() => o && o.mediaDevices && o.mediaDevices.enumerateDevices), h = S(!1);
async function f() {
!c.value || (u.value = await o.mediaDevices.enumerateDevices(), s?.(u.value));
}
async function m() {
if (!c.value)
return !1;
if (h.value)
return !0;
const { state: p, query: i } = Vl("camera", { controls: !0 });
return await i(), p.value !== "granted" && ((await o.mediaDevices.getUserMedia(n)).getTracks().forEach((g) => g.stop()), f()), h.value = !0, h.value;
}
return c.value && (t && m(), de(o.mediaDevices, "devicechange", f), f()), {
devices: u,
ensurePermissions: m,
permissionGranted: h,
videoInputs: a,
audioInputs: r,
audioOutputs: d,
isSupported: c
};
}
var lt;
(function(l) {
l.UP = "UP", l.RIGHT = "RIGHT", l.DOWN = "DOWN", l.LEFT = "LEFT", l.NONE = "NONE";
})(lt || (lt = {}));
var Tl = Object.defineProperty, nt = Object.getOwnPropertySymbols, Ol = Object.prototype.hasOwnProperty, xl = Object.prototype.propertyIsEnumerable, ot = (l, o, t) => o in l ? Tl(l, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[o] = t, El = (l, o) => {
for (var t in o || (o = {}))
Ol.call(o, t) && ot(l, t, o[t]);
if (nt)
for (var t of nt(o))
xl.call(o, t) && ot(l, t, o[t]);
return l;
};
const Al = {
easeInSine: [0.12, 0, 0.39, 0],
easeOutSine: [0.61, 1, 0.88, 1],
easeInOutSine: [0.37, 0, 0.63, 1],
easeInQuad: [0.11, 0, 0.5, 0],
easeOutQuad: [0.5, 1, 0.89, 1],
easeInOutQuad: [0.45, 0, 0.55, 1],
easeInCubic: [0.32, 0, 0.67, 0],
easeOutCubic: [0.33, 1, 0.68, 1],
easeInOutCubic: [0.65, 0, 0.35, 1],
easeInQuart: [0.5, 0, 0.75, 0],
easeOutQuart: [0.25, 1, 0.5, 1],
easeInOutQuart: [0.76, 0, 0.24, 1],
easeInQuint: [0.64, 0, 0.78, 0],
easeOutQuint: [0.22, 1, 0.36, 1],
easeInOutQuint: [0.83, 0, 0.17, 1],
easeInExpo: [0.7, 0, 0.84, 0],
easeOutExpo: [0.16, 1, 0.3, 1],
easeInOutExpo: [0.87, 0, 0.13, 1],
easeInCirc: [0.55, 0, 1, 0.45],
easeOutCirc: [0, 0.55, 0.45, 1],
easeInOutCirc: [0.85, 0, 0.15, 1],
easeInBack: [0.36, 0, 0.66, -0.56],
easeOutBack: [0.34, 1.56, 0.64, 1],
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
};
El({
linear: $l
}, Al);
function Dl(l = {}) {
var o, t;
const n = S((o = l.enabled) != null ? o : !1), s = S((t = l.autoSwitch) != null ? t : !0), u = S(l.videoDeviceId), a = S(l.audioDeviceId), { navigator: r = qe } = l, d = Ke(() => {
var g;
return (g = r?.mediaDevices) == null ? void 0 : g.getUserMedia;
}), c = be();
function h(g) {
return g.value === "none" || g.value === !1 ? !1 : g.value == null ? !0 : {
deviceId: g.value
};
}
async function f() {
if (!(!d.value || c.value))
return c.value = await r.mediaDevices.getUserMedia({
video: h(u),
audio: h(a)
}), c.value;
}
async function m() {
var g;
(g = c.value) == null || g.getTracks().forEach((k) => k.stop()), c.value = void 0;
}
function p() {
m(), n.value = !1;
}
async function i() {
return await f(), c.value && (n.value = !0), c.value;
}
async function $() {
return m(), await i();
}
return q(n, (g) => {
g ? f() : m();
}, { immediate: !0 }), q([u, a], () => {
s.value && c.value && $();
}, { immediate: !0 }), {
isSupported: d,
stream: c,
start: i,
stop: p,
restart: $,
videoDeviceId: u,
audioDeviceId: a,
enabled: n,
autoSwitch: s
};
}
function Il(l, o) {
const t = {};
return Object.keys(o).forEach((n) => {
const s = Symbol(n);
t[n] = s, Ze(s, o[n]);
}), Ze(l, t), t;
}
function Bl(l) {
const o = Qe(l, {}), t = {};
return Object.keys(o).forEach((n) => {
t[n] = Qe(o[n]);
}), t;
}
const Pl = {
button: { type: Object }
}, _t = Symbol("VCConfig"), Nl = () => Bl(_t), Ul = D({
components: { ...sl, ElIcon: Pe },
props: {
name: { type: String, required: !0 },
color: { type: String, default: "" },
size: { type: [Number, String], default: "" }
}
}), Rl = "_icon_1iurh_1", Fl = {
icon: Rl
}, P = (l, o) => {
const t = l.__vccOpts || l;
for (const [n, s] of o)
t[n] = s;
return t;
};
function jl(l, o, t, n, s, u) {
const a = Lt("ElIcon");
return v(), C(a, {
size: l.size,
color: l.color,
class: w(l.$style.icon)
}, {
default: _(() => [
(v(), C(Le(l.name)))
]),
_: 1
}, 8, ["size", "color", "class"]);
}
const Ll = {
$style: Fl
}, se = /* @__PURE__ */ P(Ul, [["render", jl], ["__cssModules", Ll]]), Hl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: se
}, Symbol.toStringTag, { value: "Module" })), zl = ["xlink:href"], Gl = /* @__PURE__ */ D({
__name: "index",
props: {
name: { type: String, required: !0 }
},
setup(l) {
const o = l;
return (t, n) => (v(), E("svg", {
class: w(["svg-icon", [t.$style.icon]]),
"aria-hidden": "true"
}, [
U("use", {
"xlink:href": `#icon-${o.name}`
}, null, 8, zl)
], 2));
}
}), Wl = "_icon_15t6e_1", ql = {
icon: Wl
}, Kl = {
$style: ql
}, bt = /* @__PURE__ */ P(Gl, [["__cssModules", Kl]]), Yl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: bt
}, Symbol.toStringTag, { value: "Module" })), Zl = D({
components: { HEl: se, HSvg: bt, HAwesome: Oe },
props: {
name: { type: String, required: !0 },
type: { type: String, required: !0 }
}
}), Ql = "_box_1wvpk_1", Jl = {
box: Ql
};
function Xl(l, o, t, n, s, u) {
return v(), E("i", {
class: w(["svg-icon-box", [l.$style.box]])
}, [
(v(), C(Le(`h-${l.type}`), {
name: l.name,
class: "site-icon"
}, null, 8, ["name"]))
], 2);
}
const en = {
$style: Jl
}, ye = /* @__PURE__ */ P(Zl, [["render", Xl], ["__cssModules", en]]), tn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: ye
}, Symbol.toStringTag, { value: "Module" })), ln = { key: 1 }, nn = { key: 1 }, on = /* @__PURE__ */ D({
__name: "index",
props: {
icon: null,
time: { default: 800 },
type: { default: "" },
confirm: { default: void 0 },
confirmInfo: null
},
emits: ["click"],
setup(l, { emit: o }) {
const t = l, { button: n } = Nl(), s = { title: "\u63D0\u793A", confirmButtonText: "\u786E\u5B9A", cancelButtonText: "\u53D6\u6D88", msg: "\u786E\u8BA4\u8981\u5220\u9664\u8FD9\u6761\u6570\u636E\u5417\uFF1F" }, u = b(() => n?.confirm !== void 0 ? n?.confirm : t.confirm !== void 0 ? t.confirm : ["danger", "warning"].includes(t.type) ? "messagebox" : void 0), { name: a, type: r = "el", position: d = "left" } = t.icon || {}, { msg: c, title: h, confirmButtonText: f, cancelButtonText: m } = { ...s, ...n?.confirmInfo, ...t.confirmInfo }, p = async () => {
try {
return await Kt.confirm(c, h, { confirmButtonText: f, cancelButtonText: m, type: "warning", dangerouslyUseHTMLString: !0 });
} catch {
return !1;
}
}, i = Ue(async (g) => {
if (u.value === "messagebox") {
await p() && o("click", g);
return;
}
u.value !== "popconfirm" && o("click", g);
}, t.time), $ = Ue(async (g) => {
o("click", g);
}, t.time);
return (g, k) => e(u) === "popconfirm" ? (v(), C(e(dt), {
key: 0,
title: e(c),
"confirm-button-text": e(f),
"cancel-button-text": e(m),
"popper-class": `${g.$style.popper} el-popover`,
onConfirm: e($)
}, {
reference: _(() => [
M(e(W), K(g.$attrs, {
type: l.type,
class: g.$style.button,
onClick: e(i)
}), {
default: _(() => [
e(d) === "left" && e(a) ? (v(), C(ye, {
key: 0,
type: e(r),
name: e(a)
}, null, 8, ["type", "name"])) : A("", !0),
g.$slots.default ? (v(), E("span", ln, [
j(g.$slots, "default")
])) : A("", !0),
e(d) === "right" && e(a) ? (v(), C(ye, {
key: 2,
type: e(r),
name: e(a)
}, null, 8, ["type", "name"])) : A("", !0)
]),
_: 3
}, 16, ["type", "class", "onClick"])
]),
_: 3
}, 8, ["title", "confirm-button-text", "cancel-button-text", "popper-class", "onConfirm"])) : (v(), C(e(W), K({ key: 1 }, g.$attrs, {
type: l.type,
class: g.$style.button,
onClick: e(i)
}), {
default: _(() => [
e(d) === "left" && e(a) ? (v(), C(ye, {
key: 0,
type: e(r),
name: e(a)
}, null, 8, ["type", "name"])) : A("", !0),
g.$slots.default ? (v(), E("span", nn, [
j(g.$slots, "default")
])) : A("", !0),
e(d) === "right" && e(a) ? (v(), C(ye, {
key: 2,
type: e(r),
name: e(a)
}, null, 8, ["type", "name"])) : A("", !0)
]),
_: 3
}, 16, ["type", "class", "onClick"]));
}
}), an = "_button_1dzv7_1", sn = "_popper_1dzv7_5", un = {
button: an,
popper: sn
}, rn = {
$style: un
}, $e = /* @__PURE__ */ P(on, [["__cssModules", rn]]), cn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: $e
}, Symbol.toStringTag, { value: "Module" })), ht = {
name: { type: String, default: "" },
multiple: { type: Boolean, default: !1 },
modelValue: { type: [String, Number, Boolean, Array], default: "", required: !0 },
options: { type: [Array, Function], default: () => [] },
props: { type: Object, default: () => {
} },
expires: { type: [Date, Number], default: 60 * 60 * 2 },
loadingText: { type: String, default: "\u52A0\u8F7D\u4E2D" }
}, $t = ["update:modelValue", "init"], St = ({ props: l, emits: o }, t) => {
const n = S(!1), s = S(), u = b({
get: () => n.value ? l.loadingText : l.modelValue,
set: (c) => o("update:modelValue", c)
}), a = b(() => ({ label: "label", value: "value", key: "value", ...l.props })), r = b(() => {
const c = Array.isArray(l.options) ? l.options : s.value || [], [h] = c;
return typeof h == "string" || typeof h == "number" ? c.map((f) => ({ [a.value.label]: f, [a.value.value]: f })) : c;
}), d = async () => {
if (Array.isArray(l.options))
return;
const c = `${t}-${l.name}`;
if (l.name) {
const h = ke.get(c);
if (h) {
s.value = h, setTimeout(() => {
o("init", h);
}, 0);
return;
}
}
n.value = !0;
try {
s.value = await l.options(), l.name && ke.set(c, s.value, { expires: l.expires }), setTimeout(() => {
o("init", s.value);
}, 0);
} finally {
n.value = !1;
}
};
return ne(() => d()), { loading: n, myOptions: r, myProps: a, myValue: u, init: d };
}, dn = /* @__PURE__ */ D({
__name: "index",
props: ht,
emits: $t,
setup(l, { emit: o }) {
const t = l, { loading: n, myOptions: s, myProps: u, myValue: a } = St({ props: t, emits: o }, "choice");
return (r, d) => e(n) ? H((v(), E("span", {
key: 0,
class: w(r.$style.loading)
}, null, 2)), [
[e(ue), e(n)]
]) : (v(), E(le, { key: 1 }, [
t.multiple ? (v(), C(e(Qt), K({
key: 1,
modelValue: e(a),
"onUpdate:modelValue": d[1] || (d[1] = (c) => z(a) ? a.value = c : null)
}, r.$attrs), {
default: _(() => [
(v(!0), E(le, null, pe(e(s), (c) => (v(), C(e(Jt), {
key: c[e(u).key] || c[e(u).label],
label: c[e(u).value]
}, {
default: _(() => [
I(G(c[e(u).label]), 1)
]),
_: 2
}, 1032, ["label"]))), 128))
]),
_: 1
}, 16, ["modelValue"])) : (v(), C(e(Yt), K({
key: 0,
modelValue: e(a),
"onUpdate:modelValue": d[0] || (d[0] = (c) => z(a) ? a.value = c : null)
}, r.$attrs, {
class: r.$style.radio
}), {
default: _(() => [
(v(!0), E(le, null, pe(e(s), (c) => (v(), C(e(Zt), {
key: c[e(u).key] || c[e(u).label],
label: c[e(u).value]
}, {
default: _(() => [
I(G(c[e(u).label]), 1)
]),
_: 2
}, 1032, ["label"]))), 128))
]),
_: 1
}, 16, ["modelValue", "class"]))
], 64));
}
}), pn = "_loading_b67q3_1", fn = "_radio_b67q3_6", mn = {
loading: pn,
radio: fn
}, vn = {
$style: mn
}, Ct = /* @__PURE__ */ P(dn, [["__cssModules", vn]]), yn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Ct
}, Symbol.toStringTag, { value: "Module" })), gn = /* @__PURE__ */ D({
__name: "index",
props: {
modelValue: { type: [Boolean, Array], default: !1 },
text: { default: () => ["\u662F", "\u5426"] }
},
emits: ["update:modelValue"],
setup(l, { emit: o }) {
const t = l, [n, s] = t.text, u = [
{ label: n, value: !0 },
{ label: s, value: !1 }
], a = b({
get: () => t.modelValue,
set: (r) => o("update:modelValue", r)
});
return (r, d) => (v(), C(Ct, K({
modelValue: e(a),
"onUpdate:modelValue": d[0] || (d[0] = (c) => z(a) ? a.value = c : null),
options: u
}, r.$attrs), null, 16, ["modelValue"]));
}
}), _n = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: gn
}, Symbol.toStringTag, { value: "Module" })), bn = /* @__PURE__ */ D({
__name: "index",
props: Pl,
setup(l) {
return Il(_t, l), (t, n) => j(t.$slots, "default");
}
}), hn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: bn
}, Symbol.toStringTag, { value: "Module" })), $n = ["id"], Sn = /* @__PURE__ */ D({
__name: "index",
props: {
modelValue: { type: Boolean, default: !1 },
title: { default: "\u5BF9\u8BDD\u6846" },
showFullscreen: { type: Boolean, default: !0 },
showDefaultFooter: { type: Boolean, default: !1 },
lazy: { type: Boolean, default: !0 },
height: null,
maxHeight: null,
fullscreenHeight: { default: "calc(100vh - 146px)" },
flex: { type: Boolean, default: !1 }
},
emits: ["update:modelValue", "closed"],
setup(l, { emit: o }) {
const t = l, n = he(), s = b({
get: () => t.modelValue,
set: (f) => o("update:modelValue", f)
}), u = S(!1), a = S(!1), r = Re(a), d = b(() => a.value ? ul : il), c = b(() => ({
[n.scrollbar]: !0,
[n.flex]: t.flex
}));
q(s, (f) => {
f && (u.value = !0);
});
const h = () => {
u.value = !1, o("closed");
};
return (f, m) => u.value || !l.lazy ? (v(), C(e(Xt), K({
key: 0,
modelValue: e(s),
"onUpdate:modelValue": m[2] || (m[2] = (p) => z(s) ? s.value = p : null)
}, f.$attrs, {
"align-center": "",
"show-close": !1,
fullscreen: a.value,
class: e(n).main,
onClosed: h
}), _e({
header: _(({ close: p, titleId: i, titleClass: $ }) => [
U("div", {
class: w(e(n).header)
}, [
U("span", {
id: i,
class: w([$, e(n).title])
}, [
j(f.$slots, "header", { close: p }, () => [
I(G(l.title), 1)
])
], 10, $n),
U("span", {
class: w(e(n).buttons)
}, [
H(M(e(W), {
icon: e(d),
plain: "",
onClick: m[0] || (m[0] = () => e(r)())
}, null, 8, ["icon"]), [
[te, l.showFullscreen]
]),
M(e(W), {
icon: e(rl),
plain: "",
onClick: p
}, null, 8, ["icon", "onClick"])
], 2)
], 2)
]),
default: _(() => [
!a.value && (l.height || l.maxHeight) ? (v(), C(e(Me), {
key: 0,
class: w(e(c)),
height: l.height,
"max-height": l.maxHeight
}, {
default: _(() => [
j(f.$slots, "default")
]),
_: 3
}, 8, ["class", "height", "max-height"])) : (v(), C(e(Me), {
key: 1,
class: w(e(c)),
"max-height": l.fullscreenHeight
}, {
default: _(() => [
j(f.$slots, "default")
]),
_: 3
}, 8, ["class", "max-height"]))
]),
_: 2
}, [
l.showDefaultFooter || f.$slots.footer ? {
name: "footer",
fn: _(() => [
j(f.$slots, "footer", {}, () => [
l.showDefaultFooter ? (v(), C($e, {
key: 0,
onClick: m[1] || (m[1] = (p) => s.value = !1)
}, {
default: _(() => [
I("\u5173\u95ED")
]),
_: 1
})) : A("", !0)
])
]),
key: "0"
} : void 0
]), 1040, ["modelValue", "fullscreen", "class"])) : A("", !0);
}
}), Cn = "_main_um8p3_1", wn = "_header_um8p3_19", kn = "_title_um8p3_29", Vn = "_scrollbar_um8p3_34", Mn = "_flex_um8p3_42", Tn = "_buttons_um8p3_47", On = {
main: Cn,
header: wn,
title: kn,
scrollbar: Vn,
flex: Mn,
buttons: Tn
}, xn = {
$style: On
}, Se = /* @__PURE__ */ P(Sn, [["__cssModules", xn]]), En = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Se
}, Symbol.toStringTag, { value: "Module" })), An = /* @__PURE__ */ D({
__name: "index",
props: {
dialog: { type: Boolean, default: !1 },
visible: { type: Boolean, default: !1 },
image: { type: [String, Object], required: !0 },
option: { type: Object, default: () => {
} },
imageSmoothingQuality: { type: String, default: "high" },
containerWidth: { type: String, default: "600px" },
containerHeight: { type: String, default: "450px" },
cropperWidth: { type: Number, default: 400 },
cropperHeight: { type: Number, default: 300 }
},
emits: ["init", "update:visible", "cancel", "finished"],
setup(l, { expose: o, emit: t }) {
const n = l, s = S(!1), u = S(), a = be(), r = S(""), d = S(!1), c = b({
get: () => n.visible,
set: (y) => {
t("update:visible", y);
}
}), h = b(() => ({
width: n.containerWidth,
height: n.containerHeight
})), f = b(() => `${parseInt(n.containerWidth) + 40}px`), m = b(() => {
if (typeof n.image == "string") {
const V = new Image();
return V.src = n.image, V;
}
const y = n.image;
if (L && y?.size) {
const V = new Image(), R = L.URL.createObjectURL(y);
return V.src = R, V;
}
return n.image;
}), p = () => {
if (!a.value || !n.dialog)
return;
const y = a.value.getCroppedCanvas();
r.value = y?.toDataURL() || "";
}, i = async () => {
if (!u.value)
return;
a.value?.destroy(), s.value = !0, d.value = !1, u.value.childNodes.forEach((V) => u.value?.removeChild(V)), u.value.appendChild(m.value);
const y = await oe.loadCdnSingle("cropper");
a.value = new y(m.value, {
dragMode: "move",
viewMode: 1,
aspectRatio: n.cropperWidth / n.cropperHeight,
toggleDragModeOnDblclick: !1,
guides: !0,
cropmove: n.dialog ? fl(p, 1e3) : () => {
},
...n.option,
ready() {
s.value = !1, p(), J(() => t("init"));
}
});
}, $ = () => {
s.value || (c.value = !1, t("cancel"));
}, g = () => {
if (!(s.value || !a.value))
return a.value.getCroppedCanvas({
width: n.cropperWidth,
height: n.cropperHeight,
imageSmoothingQuality: n.imageSmoothingQuality
});
}, k = () => {
const y = g();
if (!!y)
return Ve.canvasToBlob(y);
}, B = () => {
const y = g(), V = k();
c.value = !1, t("finished", y, V);
};
return q(() => n.option, () => {
d.value = !0;
}), q(m, () => {
d.value = !0;
}), q(c, () => {
n.visible && (!a.value || d.value) && J(() => i());
}), o({ instance: a, getCroppedCanvas: g, getBlobData: k }), ne(() => !n.dialog && i()), Ht(() => a.value?.destroy()), (y, V) => l.dialog ? (v(), C(Se, {
key: 0,
modelValue: e(c),
"onUpdate:modelValue": V[0] || (V[0] = (R) => z(c) ? c.value = R : null),
title: "\u56FE\u7247\u88C1\u526A",
width: e(f),
"append-to-body": "",
"close-on-click-modal": !1,
"before-close": $,
"show-fullscreen": !1,
lazy: !1
}, {
footer: _(() => [
M(e(Ne), null, {
default: _(() => [
M(e(W), {
loading: s.value,
onClick: $
}, {
default: _(() => [
I("\u53D6\u6D88")
]),
_: 1
}, 8, ["loading"]),
M(e(el), {
href: r.value,
download: "cropper.jpg",
underline: !1
}, {
default: _(() => [
M(e(W), { type: "primary" }, {
default: _(() => [
I("\u4E0B\u8F7D\u5207\u7247")
]),
_: 1
})
]),
_: 1
}, 8, ["href"]),
M(e(W), {
loading: s.value,
type: "primary",
onClick: B
}, {
default: _(() => [
I("\u786E\u5B9A")
]),
_: 1
}, 8, ["loading"])
]),
_: 1
})
]),
default: _(() => [
H(U("div", {
ref_key: "workbench",
ref: u,
class: w(y.$style.workbench),
style: Q(e(h))
}, null, 6), [
[e(ue), s.value]
])
]),
_: 1
}, 8, ["modelValue", "width"])) : H((v(), E("div", {
key: 1,
ref_key: "workbench",
ref: u,
class: w(y.$style.workbench),
style: Q(e(h))
}, null, 6)), [
[e(ue), s.value]
]);
}
}), Dn = "_workbench_ja7q1_1", In = {
workbench: Dn
}, Bn = {
$style: In
}, Ye = /* @__PURE__ */ P(An, [["__cssModules", Bn]]), Pn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Ye
}, Symbol.toStringTag, { value: "Module" })), Nn = /* @__PURE__ */ D({
__name: "index",
props: {
block: { type: Boolean, default: !1 },
width: null
},
setup(l) {
const o = l;
Ee((u) => ({
eec40bb2: e(s)
}));
const t = he(), n = b(() => ({
[t.input]: !0,
[t.block]: o.block
})), s = b(() => o.width || (o.block ? "100%" : "214px"));
return (u, a) => (v(), C(e(Te), {
class: w(e(n))
}, _e({ _: 2 }, [
u.$slots.prefix ? {
name: "prefix",
fn: _(() => [
j(u.$slots, "prefix")
]),
key: "0"
} : void 0,
u.$slots.suffix ? {
name: "suffix",
fn: _(() => [
j(u.$slots, "suffix")
]),
key: "1"
} : void 0,
u.$slots.prepend ? {
name: "prepend",
fn: _(() => [
j(u.$slots, "prepend")
]),
key: "2"
} : void 0,
u.$slots.append ? {
name: "append",
fn: _(() => [
j(u.$slots, "append")
]),
key: "3"
} : void 0
]), 1032, ["class"]));
}
}), Un = "_input_1hm4f_1", Rn = "_block_1hm4f_5", Fn = {
input: Un,
block: Rn
}, jn = {
$style: Fn
}, wt = /* @__PURE__ */ P(Nn, [["__cssModules", jn]]), Ln = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: wt
}, Symbol.toStringTag, { value: "Module" })), Hn = {
mounted: async (l, o) => {
const t = l.getElementsByTagName("input")[o.value?.elInputIndex || 0] || l.getElementsByTagName("input")[0], n = t.disabled;
t.disabled = !0, l.classList.add("is-disabled");
const s = await oe.loadCdnSingle("cleave"), u = { decimalScale: 2, integerScale: 0, prefix: "", ...o.value };
t.cleave = new s(t, {
numeral: !0,
numeralThousandsGroupStyle: "thousand",
numeralDecimalScale: u.decimalScale,
numeralIntegerScale: u.integerScale,
prefix: u.prefix
}), t.style.textAlign = "right", t.style.fontFamily = "Pathway Gothic One", t.value = t.cleave?.properties?.result || "", l.classList.remove("is-disabled"), t.disabled = n;
},
updated: (l, o) => {
setTimeout(() => {
const t = new Event("input", { bubbles: !0 }), n = l.getElementsByTagName("input")[o.value?.elInputIndex || 0] || l.getElementsByTagName("input")[0];
n.dispatchEvent(t), n.cleave && (n.value = n.cleave?.properties?.result || "");
}, 0);
}
}, zn = /* @__PURE__ */ D({
__name: "index",
props: {
modelValue: { type: String, default: "" },
formatValue: { type: String, default: "" },
option: { type: Object, default: () => ({ decimalScale: 2, integerScale: 12 }) },
padDecimal: { type: Boolean, default: !0 }
},
emits: ["update:modelValue", "update:formatValue", "change"],
setup(l, { emit: o }) {
const t = l, n = (f) => {
if (f === "" || f === void 0)
return "";
let m = f.replace(/[^\d\.]/g, "").replace(/^0(\d{1,}\.?)+?/, "$1").replace(/^\./, "").replace(/\.{1,}/g, ".");
const p = m.split(".");
if (p.length > 1) {
const [i, $] = p;
m = `${i}.${$}`;
}
return m;
}, s = (f) => {
if (t.padDecimal && t.option.decimalScale > 0 && f !== t.option.prefix) {
const [m, p = ""] = f.split(".");
return `${m}.${p.padEnd(t.option.decimalScale, "0")}`;
}
return f;
}, u = () => {
const { modelValue: f } = t, m = t.option.prefix || "";
if (f === "")
return o("update:formatValue", m), m;
const p = f.toString().charAt(f.length - 1) === "." ? "." : "", i = m + (+n(t.modelValue)).toLocaleString("en-US") + p, $ = s(i);
return o("update:formatValue", $), i;
}, a = S(), r = b({
get: () => u(),
set: (f) => {
o("update:modelValue", n(f));
}
}), d = (f) => {
const m = n(f).replace(/\.$/, "");
r.value = m, o("change", [m, s(f).replace(/\.$/, "")]);
}, c = S(!0), h = b(() => ({ ...t.option, padDecimal: t.padDecimal }));
return q(h, (f, m) => {
ml(f, m) || (c.value = !1, J(() => {
c.value = !0, setTimeout(() => {
r.value = a.value.input?.value, J(() => {
d(u());
});
}, 100);
}));
}), (f, m) => c.value ? H((v(), C(wt, K({
key: 0,
ref_key: "elInput",
ref: a,
modelValue: e(r),
"onUpdate:modelValue": m[0] || (m[0] = (p) => z(r) ? r.value = p : null)
}, f.$attrs, {
class: f.$style.main,
onChange: d
}), _e({ _: 2 }, [
f.$slots.prepend ? {
name: "prepend",
fn: _(() => [
j(f.$slots, "prepend")
]),
key: "0"
} : void 0,
f.$slots.append ? {
name: "append",
fn: _(() => [
j(f.$slots, "append")
]),
key: "1"
} : void 0
]), 1040, ["modelValue", "class"])), [
[e(Hn), l.option]
]) : A("", !0);
}
}), Gn = "_main_m3b07_1", Wn = {
main: Gn
}, qn = {
$style: Wn
}, kt = /* @__PURE__ */ P(zn, [["__cssModules", qn]]), Kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: kt
}, Symbol.toStringTag, { value: "Module" })), Yn = { AFG: "AF", ALB: "AL", DZA: "DZ", ASM: "AS", AND: "AD", AGO: "AO", AIA: "AI", ATA: "AQ", ATG: "AG", ARG: "AR", ARM: "AM", ABW: "AW", AUS: "AU", AUT: "AT", AZE: "AZ", BHS: "BS", BHR: "BH", BGD: "BD", BRB: "BB", BLR: "BY", BEL: "BE", BLZ: "BZ", BEN: "BJ", BMU: "BM", BTN: "BT", BOL: "BO", BES: "BQ", BIH: "BA", BWA: "BW", BVT: "BV", BRA: "BR", IOT: "IO", BRN: "BN", BGR: "BG", BFA: "BF", BDI: "BI", CPV: "CV", KHM: "KH", CMR: "CM", CAN: "CA", CYM: "KY", CAF: "CF", TCD: "TD", CHL: "CL", CHN: "CN", CXR: "CX", CCK: "CC", COL: "CO", COM: "KM", COD: "CD", COG: "CG", COK: "CK", CRI: "CR", HRV: "HR", CUB: "CU", CUW: "CW", CYP: "CY", CZE: "CZ", CIV: "CI", DNK: "DK", DJI: "DJ", DMA: "DM", DOM: "DO", ECU: "EC", EGY: "EG", SLV: "SV", GNQ: "GQ", ERI: "ER", EST: "EE", SWZ: "SZ", ETH: "ET", FLK: "FK", FRO: "FO", FJI: "FJ", FIN: "FI", FRA: "FR", GUF: "GF", PYF: "PF", ATF: "TF", GAB: "GA", GMB: "GM", GEO: "GE", DEU: "DE", GHA: "GH", GIB: "GI", GRC: "GR", GRL: "GL", GRD: "GD", GLP: "GP", GUM: "GU", GTM: "GT", GGY: "GG", GIN: "GN", GNB: "GW", GUY: "GY", HTI: "HT", HMD: "HM", VAT: "VA", HND: "HN", HKG: "HK", HUN: "HU", ISL: "IS", IND: "IN", IDN: "ID", IRN: "IR", IRQ: "IQ", IRL: "IE", IMN: "IM", ISR: "IL", ITA: "IT", JAM: "JM", JPN: "JP", JEY: "JE", JOR: "JO", KAZ: "KZ", KEN: "KE", KIR: "KI", PRK: "KP", KOR: "KR", KWT: "KW", KGZ: "KG", LAO: "LA", LVA: "LV", LBN: "LB", LSO: "LS", LBR: "LR", LBY: "LY", LIE: "LI", LTU: "LT", LUX: "LU", MAC: "MO", MDG: "MG", MWI: "MW", MYS: "MY", MDV: "MV", MLI: "ML", MLT: "MT", MHL: "MH", MTQ: "MQ", MRT: "MR", MUS: "MU", MYT: "YT", MEX: "MX", FSM: "FM", MDA: "MD", MCO: "MC", MNG: "MN", MNE: "ME", MSR: "MS", MAR: "MA", MOZ: "MZ", MMR: "MM", NAM: "NA", NRU: "NR", NPL: "NP", NLD: "NL", NCL: "NC", NZL: "NZ", NIC: "NI", NER: "NE", NGA: "NG", NIU: "NU", NFK: "NF", MKD: "MK", MNP: "MP", NOR: "NO", OMN: "OM", PAK: "PK", PLW: "PW", PSE: "PS", PAN: "PA", PNG: "PG", PRY: "PY", PER: "PE", PHL: "PH", PCN: "PN", POL: "PL", PRT: "PT", PRI: "PR", QAT: "QA", ROU: "RO", RUS: "RU", RWA: "RW", REU: "RE", BLM: "BL", SHN: "SH", KNA: "KN", LCA: "LC", MAF: "MF", SPM: "PM", VCT: "VC", WSM: "WS", SMR: "SM", STP: "ST", SAU: "SA", SEN: "SN", SRB: "RS", SYC: "SC", SLE: "SL", SGP: "SG", SXM: "SX", SVK: "SK", SVN: "SI", SLB: "SB", SOM: "SO", ZAF: "ZA", SGS: "GS", SSD: "SS", ESP: "ES", LKA: "LK", SDN: "SD", SUR: "SR", SJM: "SJ", SWE: "SE", CHE: "CH", SYR: "SY", TJK: "TJ", TZA: "TZ", THA: "TH", TLS: "TL", TGO: "TG", TKL: "TK", TON: "TO", TTO: "TT", TUN: "TN", TKM: "TM", TCA: "TC", TUV: "TV", TUR: "TR", UGA: "UG", UKR: "UA", ARE: "AE", GBR: "GB", UMI: "UM", USA: "US", URY: "UY", UZB: "UZ", VUT: "VU", VEN: "VE", VNM: "VN", VGB: "VG", VIR: "VI", WLF: "WF", ESH: "EH", YEM: "YE", ZMB: "ZM", ZWE: "ZW", ALA: "AX" }, Zn = /* @__PURE__ */ D({
__name: "index",
props: {
code: { type: String, required: !0 },
squared: { type: Boolean, default: !1 }
},
setup(l) {
const o = l, t = b(() => {
let n = o.code.toLocaleUpperCase();
return n.length === 3 && (n = Yn[n]), {
fi: !0,
fis: o.squared,
[`fi-${n.toLocaleLowerCase()}`]: !0
};
});
return He(async () => {
await oe.loadCdnSingle("flagIcons");
}), (n, s) => (v(), E("span", {
class: w(e(t))
}, null, 2));
}
}), Qn = "_main_cnnq4_1", Jn = {
main: Qn
}, Xn = {
$style: Jn
}, we = /* @__PURE__ */ P(Zn, [["__cssModules", Xn]]), eo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: we
}, Symbol.toStringTag, { value: "Module" })), De = [
{
code: "CNY",
flag: "CHN",
option: { prefix: "\xA5", decimalScale: 2, integerScale: 20 }
},
{
code: "USD",
flag: "USA",
option: { prefix: "$", decimalScale: 2, integerScale: 20 }
},
{
code: "JPY",
flag: "JPN",
option: { prefix: "\xA5", decimalScale: 0, integerScale: 20 }
},
{
code: "EUR",
flag: "EU",
option: { prefix: "\u20AC", decimalScale: 2, integerScale: 20 }
},
{
code: "TWD",
flag: "CHN",
option: { prefix: "NT$", decimalScale: 0, integerScale: 20 }
},
{
code: "KRW",
flag: "KOR",
option: { prefix: "\u20A9", decimalScale: 0, integerScale: 20 }
}
], to = { key: 0 }, lo = { key: 1 }, no = /* @__PURE__ */ D({
__name: "index",
props: {
modelValue: { type: String, required: !0 },
code: { type: [Array, String], required: !0 },
flag: { type: Boolean, default: !1 },
prefix: { type: Boolean, default: !0 },
prepend: { type: Boolean, default: !0 },
append: { type: Boolean, default: !1 }
},
emits: ["update:modelValue", "change"],
setup(l, { emit: o }) {
const t = l, n = b({
get: () => t.modelValue,
set: (m) => o("update:modelValue", m)
}), s = b(() => ({ width: t.flag ? "7.5em" : "6em" })), u = S(""), a = S(), r = b(() => De.find((m) => m.code === a.value)), d = b(() => ({
...r.value?.option,
prefix: t.prefix ? r.value?.option.prefix : "",
elInputIndex: Array.isArray(t.code) ? 1 : 0
})), c = b(() => Array.isArray(t.code) ? De.filter((m) => t.code.includes(m.code)) : De.find((m) => m.code === t.code)), h = (m) => {
o("change", [...m, a.value]);
}, f = (m) => {
h([n.value, u.value]);
};
return He(() => {
Array.isArray(c.value) && c.value.length > 0 ? a.value = c.value[0].code : Array.isArray(c.value) || (a.value = c.value?.code);
}), (m, p) => (v(), C(kt, K({
modelValue: e(n),
"onUpdate:modelValue": p[1] || (p[1] = (i) => z(n) ? n.value = i : null),
"format-value": u.value,
"onUpdate:format-value": p[2] || (p[2] = (i) => u.value = i),
option: e(d)
}, m.$attrs, { onChange: h }), _e({ _: 2 }, [
l.prepend ? {
name: "prepend",
fn: _(() => [
Array.isArray(e(c)) ? (v(), C(e(ze), {
key: 0,
modelValue: a.value,
"onUpdate:modelValue": p[0] || (p[0] = (i) => a.value = i),
style: Q(e(s)),
onChange: f
}, _e({
default: _(() => [
(v(!0), E(le, null, pe(e(c), (i) => (v(), C(e(Ge), {
key: i.code,
value: i.code
}, {
default: _(() => [
l.flag ? (v(), C(we, {
key: 0,
code: i.flag,
class: w(m.$style.flag)
}, null, 8, ["code", "class"])) : A("", !0),
I(G(i.code), 1)
]),
_: 2
}, 1032, ["value"]))), 128))
]),
_: 2
}, [
l.flag ? {
name: "prefix",
fn: _(() => [
e(r) ? (v(), C(we, {
key: 0,
code: e(r)?.flag
}, null, 8, ["code"])) : A("", !0)
]),
key: "0"
} : void 0
]), 1032, ["modelValue", "style"])) : (v(), E(le, { key: 1 }, [
l.flag ? (v(), C(we, {
key: 0,
code: e(c).flag,
class: w(m.$style.flag)
}, null, 8, ["code", "class"])) : A("", !0),
I(G(e(c).code), 1)
], 64))
]),
key: "0"
} : void 0,
l.append ? {
name: "append",
fn: _(() => [
Array.isArray(e(c)) ? (v(), E("span", to, G(e(r).code), 1)) : (v(), E("span", lo, G(e(c).code), 1))
]),
key: "1"
} : void 0
]), 1040, ["modelValue", "format-value", "option"]));
}
}), oo = "_flag_8zrzb_1", ao = {
flag: oo
}, so = {
$style: ao
}, uo = /* @__PURE__ */ P(no, [["__cssModules", so]]), io = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: uo
}, Symbol.toStringTag, { value: "Module" })), ro = /* @__PURE__ */ D({
__name: "index",
props: {
modelValue: { type: Array, default: () => [] },
valueFormat: { type: String, default: "YYYY-MM-DD" },
limitDays: { type: Number, default: 3 },
includeToday: { type: Boolean, default: !1 }
},
emits: ["update:modelValue", "change"],
setup(l, { emit: o }) {
const t = l, n = (a) => {
const r = Date.now(), d = a.getTime(), c = 3600 * 1e3 * 24, h = c * t.limitDays;
let f = 0;
return t.limitDays > 0 ? f = t.includeToday ? c : 0 : f = t.includeToday ? 0 : c, t.limitDays < 0 ? d + f > r || d + f < r + h : d + f > r + h || d + f < r;
}, s = b({
get: () => t.modelValue,
set: (a) => {
o("update:modelValue", a);
}
}), u = (a) => {
o("change", a);
};
return (a, r) => (v(), C(e(tl), K(a.$attrs, {
modelValue: e(s),
"onUpdate:modelValue": r[0] || (r[0] = (d) => z(s) ? s.value = d : null),
"disabled-date": n,
type: "daterange",
"value-format": l.valueFormat,
onChange: u
}), null, 16, ["modelValue", "value-format"]));
}
}), co = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: ro
}, Symbol.toStringTag, { value: "Module" })), Vt = {
width: "200px",
height: "100px",
src: "",
fit: "contain",
icon: "Plus",
iconSize: 30
}, Mt = {
icon: "Upload",
type: "primary",
size: "",
text: "\u4E0A\u4F20\u56FE\u7247"
}, po = {
accept: { type: String, default: ".jpg,.jpeg,.png" },
type: { type: String, default: "image" },
imageOptions: {
type: Object,
default: () => Vt
},
buttonOptions: {
type: Object,
default: () => Mt
},
maxSize: { type: Number, default: 2 * 1024 * 1024 },
httpRequest: { type: Function },
beforeUpload: { type: Function },
cropper: { type: Boolean, default: !1 },
cropperOption: { type: Object, default: () => {
} }
}, fo = /* @__PURE__ */ D({
__name: "index",
props: po,
emits: ["error"],
setup(l, { emit: o }) {
const t = l, n = S(!1), s = S(""), u = S(!1), a = S(), r = b(() => {
const y = { ...Vt, ...t.imageOptions };
return s.value && (y.src = s.value), y;
}), d = b(() => ({ ...Mt, ...t.buttonOptions })), c = b(() => !!r.value.src), h = b(() => {
const y = r.value;
return {
width: y.width,
height: y.height,
"line-height": y.height
};
}), f = b(() => {
const y = r.value;
return {
width: y.width,
height: y.height,
"line-height": y.height,
"font-size": `${y.iconSize}px`
};
}), m = b(() => t.type === "image"), p = b(() => t.type === "button"), i = (y) => {
if (y.size > t.maxSize) {
const V = `\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${t.maxSize / 1024 / 1024}M`;
return o("error", V), !1;
}
return t.beforeUpload ? t.beforeUpload(y) ? (n.value = !0, !0) : !1 : (n.value = !0, !0);
}, $ = (y) => {
const V = i(y);
return V && t.cropper ? (a.value = y, J(() => {
u.value = !0;
}), !1) : V;
}, g = ({ file: y }) => {
if (!!L && t.httpRequest) {
const V = L.URL.createObjectURL(y), R = () => {
s.value = V, n.value = !1;
};
t.httpRequest(y, R, V);
}
}, k = () => {
n.value = !1;
}, B = (y, V) => {
const R = Ve.blobToFile(V, "cropper.jpg");
g({ file: R });
};
return (y, V) => H((v(), C(e(pt), {
class: w([y.$style.uploader, `upload-type-${y.type}`]),
action: "",
"show-file-list": !1,
accept: y.accept,
"http-request": g,
"before-upload": $
}, {
default: _(() => [
e(m) ? (v(), E(le, { key: 0 }, [
e(c) ? (v(), C(e(ge), {
key: 0,
src: e(r).src,
fit: e(r).fit,
style: Q(e(h)),
class: w(y.$style.photo)
}, {
placeholder: _(() => [
I("\u52A0\u8F7D\u4E2D")
]),
_: 1
}, 8, ["src", "fit", "style", "class"])) : (v(), C(se, {
key: 1,
name: e(r).icon,
class: w([y.$style.icon]),
style: Q(e(f))
}, null, 8, ["name", "class", "style"]))
], 64)) : A("", !0),
e(p) ? j(y.$slots, "default", { key: 1 }, () => [
M($e, {
size: e(d).size,
type: e(d).type,
icon: { name: e(d).icon }
}, {
default: _(() => [
I(G(e(d).text), 1)
]),
_: 1
}, 8, ["size", "type", "icon"])
]) : A("", !0),
y.cropper && a.value ? (v(), C(Ye, {
key: 2,
visible: u.value,
"onUpdate:visible": V[0] || (V[0] = (R) => u.value = R),
image: a.value,
option: y.cropperOption,
dialog: "",
onFinished: B,
onCancel: k
}, null, 8, ["visible", "image", "option"])) : A("", !0)
]),
_: 3
}, 8, ["class", "accept"])), [
[e(ue), n.value]
]);
}
}), mo = "_uploader_e7qei_1", vo = "_icon_e7qei_18", yo = "_photo_e7qei_26", go = {
uploader: mo,
icon: vo,
photo: yo
}, _o = {
$style: go
}, Tt = /* @__PURE__ */ P(fo, [["__cssModules", _o]]), bo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
default: Tt
}, Symbol.toStringTag, { value: "Module" })), at = "upload", st = "camera", me = "image", ut = "video", Ie = "canvas", Ce = "placeholder", ho = ["width", "height"], $o = ["width", "height"], So = { key: 1 }, Co = /* @__PURE__ */ D({
__name: "index",
props: {
visible: { type: Boolean, required: !0 },
type: { type: Array, default: () => [at, st] },
width: { type: Number, default: 600 },
fixWidth: { type: Number, default: 32 },
height: { type: Number, default: 400 },
accept: { type: String, default: ".jpg,.jpeg,.png" },
cropper: { type: Boolean, default: !0 },
cropperOption: { type: Object, default: () => {
} }
},
emits: ["update:visible", "close", "error", "save"],
setup(l, { emit: o }) {
const t = l, n = "\u7167\u7247\u62CD\u6444\u6210\u529F", s = S(), { videoInputs: u } = Ml({
requestPermissions: !0,
onUpdated() {
u.value.find((N) => N.deviceId && N.deviceId === s.value) || (s.value = u.value[0]?.deviceId);
}
}), { stream: a, start: r, stop: d, enabled: c } = Dl({ videoDeviceId: s, audioDeviceId: !1 }), h = S(), f = S(), m = S(""), p = S(""), i = S(!1), $ = S(!1), g = zt({ visible: !1, type: "success", description: "" });
let k;
const B = b(() => `${t.width + t.fixWidth}px`), y = b(() => ({ width: `${t.width}px`, height: `${t.height}px` })), V = b(() => t.type.includes(st) && s.value), R = b(() => t.type.includes(at)), X = b(() => m.value === me), ie = b(() => m.value === Ie), ee = b(() => m.value === ut), ce = b(() => m.value === Ce || X.value || ie.value), fe = b(() => m.value === Ce), re = b(() => {
const N = !!p.value, Y = [Ie, me].includes(m.value);
return N && Y;
});
q(a, () => {
h.value && a.value && (h.value.srcObject = a.value, h.value.play(), i.value = !1);
});
const x = b({
get: () => t.visible,
set: (N) => {
o("update:visible", N), N || o("close");
}
}), O = (N, Y) => {
g.visible = !0, g.description = Y, g.type = N, setTimeout(() => {
g.visible = !1;
}, 1500);
}, T = () => {
x.value = !1;
}, F = (N) => {
m.value = N;
}, ae = () => {
F(Ce), p.value = "";
};
q(x, (N) => {
N ? ae() : d();
});
const Et = () => {
if (p.value) {
F(me);
return;
}
F(Ce)