UNPKG

mobile-select-mini

Version:
1,444 lines (1,439 loc) 46.9 kB
import { useCssVars as lt, useSlots as St, ref as K, onMounted as Ee, toRefs as pt, computed as Q, watch as ue, watchEffect as Qe, createElementBlock as ne, openBlock as U, normalizeStyle as ct, unref as Z, createElementVNode as _, createVNode as Bt, withKeys as $t, renderSlot as Ce, Transition as At, withCtx as Le, withDirectives as ut, createBlock as ft, createCommentVNode as Dt, createTextVNode as Re, toDisplayString as dt, vShow as Tt, reactive as Lt, nextTick as Rt, onBeforeUnmount as Pe, isRef as Mt, defineComponent as jt, mergeModels as Ze, useModel as Nt, normalizeClass as Ae, Fragment as zt, renderList as It } from "vue"; const Ht = typeof window < "u" && typeof window.document < "u", Wt = (e) => typeof Element > "u" ? !1 : e instanceof Element, J = /* @__PURE__ */ new Map(); if (Ht) { let e; document.addEventListener("mousedown", (t) => e = t), document.addEventListener("mouseup", (t) => { if (e) { for (const r of J.values()) for (const { documentHandler: n } of r) n(t, e); e = void 0; } }); } function et(e, t) { let r = []; return Array.isArray(t.arg) ? r = t.arg : Wt(t.arg) && r.push(t.arg), function(n, o) { const a = t.instance.popperRef, s = n.target, i = o == null ? void 0 : o.target, l = !t || !t.instance, u = !s || !i, p = e.contains(s) || e.contains(i), b = e === s, f = r.length && r.some((g) => g == null ? void 0 : g.contains(s)) || r.length && r.includes(i), v = a && (a.contains(s) || a.contains(i)); l || u || p || b || f || v || t.value(n, o); }; } const Vt = { beforeMount(e, t) { J.has(e) || J.set(e, []), J.get(e).push({ documentHandler: et(e, t), bindingFn: t.value }); }, updated(e, t) { J.has(e) || J.set(e, []); const r = J.get(e), n = r.findIndex((a) => a.bindingFn === t.oldValue), o = { documentHandler: et(e, t), bindingFn: t.value }; n >= 0 ? r.splice(n, 1, o) : r.push(o); }, unmounted(e) { J.delete(e); } }; function Me(e, t, r) { var n, o, a, s, i; t == null && (t = 100); function l() { var p = Date.now() - s; p < t && p >= 0 ? n = setTimeout(l, t - p) : (n = null, r || (i = e.apply(a, o), a = o = null)); } var u = function() { a = this, o = arguments, s = Date.now(); var p = r && !n; return n || (n = setTimeout(l, t)), p && (i = e.apply(a, o), a = o = null), i; }; return u.clear = function() { n && (clearTimeout(n), n = null); }, u.flush = function() { n && (i = e.apply(a, o), a = o = null, clearTimeout(n), n = null); }, u; } Me.debounce = Me; var De = Me; function Ft(e, t, r) { Mt(e) ? ue(e, (n, o) => { o == null || o.removeEventListener(t, r), n == null || n.addEventListener(t, r); }) : Ee(() => { e.addEventListener(t, r); }), Pe(() => { var n; (n = Z(e)) === null || n === void 0 || n.removeEventListener(t, r); }); } function qt(e, t) { const r = "pointerdown"; return typeof window > "u" || !window ? void 0 : Ft(window, r, (o) => { const a = Z(e); a && (a === o.target || o.composedPath().includes(a) || t(o)); }); } function Xt(e, t, r) { let n = null; const o = K(!1); Ee(() => { (e.content !== void 0 || r.value) && (o.value = !0), n = new MutationObserver(a), n.observe(t.value, { childList: !0, subtree: !0 }); }), Pe(() => n.disconnect()), ue(r, (s) => { s ? o.value = !0 : o.value = !1; }); const a = () => { e.content ? o.value = !0 : o.value = !1; }; return { hasContent: o }; } function ie(e, t) { var r = e.getBoundingClientRect(), n = 1, o = 1; return { width: r.width / n, height: r.height / o, top: r.top / o, right: r.right / n, bottom: r.bottom / o, left: r.left / n, x: r.left / n, y: r.top / o }; } function z(e) { if (e == null) return window; if (e.toString() !== "[object Window]") { var t = e.ownerDocument; return t && t.defaultView || window; } return e; } function Ne(e) { var t = z(e), r = t.pageXOffset, n = t.pageYOffset; return { scrollLeft: r, scrollTop: n }; } function fe(e) { var t = z(e).Element; return e instanceof t || e instanceof Element; } function L(e) { var t = z(e).HTMLElement; return e instanceof t || e instanceof HTMLElement; } function vt(e) { if (typeof ShadowRoot > "u") return !1; var t = z(e).ShadowRoot; return e instanceof t || e instanceof ShadowRoot; } function Yt(e) { return { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop }; } function _t(e) { return e === z(e) || !L(e) ? Ne(e) : Yt(e); } function W(e) { return e ? (e.nodeName || "").toLowerCase() : null; } function te(e) { return ((fe(e) ? e.ownerDocument : ( // $FlowFixMe[prop-missing] e.document )) || window.document).documentElement; } function ze(e) { return ie(te(e)).left + Ne(e).scrollLeft; } function G(e) { return z(e).getComputedStyle(e); } function Ie(e) { var t = G(e), r = t.overflow, n = t.overflowX, o = t.overflowY; return /auto|scroll|overlay|hidden/.test(r + o + n); } function Ut(e) { var t = e.getBoundingClientRect(), r = t.width / e.offsetWidth || 1, n = t.height / e.offsetHeight || 1; return r !== 1 || n !== 1; } function Kt(e, t, r) { r === void 0 && (r = !1); var n = L(t); L(t) && Ut(t); var o = te(t), a = ie(e), s = { scrollLeft: 0, scrollTop: 0 }, i = { x: 0, y: 0 }; return (n || !n && !r) && ((W(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078 Ie(o)) && (s = _t(t)), L(t) ? (i = ie(t), i.x += t.clientLeft, i.y += t.clientTop) : o && (i.x = ze(o))), { x: a.left + s.scrollLeft - i.x, y: a.top + s.scrollTop - i.y, width: a.width, height: a.height }; } function He(e) { var t = ie(e), r = e.offsetWidth, n = e.offsetHeight; return Math.abs(t.width - r) <= 1 && (r = t.width), Math.abs(t.height - n) <= 1 && (n = t.height), { x: e.offsetLeft, y: e.offsetTop, width: r, height: n }; } function Se(e) { return W(e) === "html" ? e : ( // this is a quicker (but less type safe) way to save quite some bytes from the bundle // $FlowFixMe[incompatible-return] // $FlowFixMe[prop-missing] e.assignedSlot || // step into the shadow DOM of the parent of a slotted node e.parentNode || // DOM Element detected (vt(e) ? e.host : null) || // ShadowRoot detected // $FlowFixMe[incompatible-call]: HTMLElement is a Node te(e) ); } function ht(e) { return ["html", "body", "#document"].indexOf(W(e)) >= 0 ? e.ownerDocument.body : L(e) && Ie(e) ? e : ht(Se(e)); } function ce(e, t) { var r; t === void 0 && (t = []); var n = ht(e), o = n === ((r = e.ownerDocument) == null ? void 0 : r.body), a = z(n), s = o ? [a].concat(a.visualViewport || [], Ie(n) ? n : []) : n, i = t.concat(s); return o ? i : ( // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here i.concat(ce(Se(s))) ); } function Gt(e) { return ["table", "td", "th"].indexOf(W(e)) >= 0; } function tt(e) { return !L(e) || // https://github.com/popperjs/popper-core/issues/837 G(e).position === "fixed" ? null : e.offsetParent; } function Jt(e) { var t = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, r = navigator.userAgent.indexOf("Trident") !== -1; if (r && L(e)) { var n = G(e); if (n.position === "fixed") return null; } for (var o = Se(e); L(o) && ["html", "body"].indexOf(W(o)) < 0; ) { var a = G(o); if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || t && a.willChange === "filter" || t && a.filter && a.filter !== "none") return o; o = o.parentNode; } return null; } function he(e) { for (var t = z(e), r = tt(e); r && Gt(r) && G(r).position === "static"; ) r = tt(r); return r && (W(r) === "html" || W(r) === "body" && G(r).position === "static") ? t : r || Jt(e) || t; } var R = "top", j = "bottom", N = "right", M = "left", We = "auto", me = [R, j, N, M], se = "start", de = "end", Qt = "clippingParents", mt = "viewport", pe = "popper", Zt = "reference", rt = /* @__PURE__ */ me.reduce(function(e, t) { return e.concat([t + "-" + se, t + "-" + de]); }, []), gt = /* @__PURE__ */ [].concat(me, [We]).reduce(function(e, t) { return e.concat([t, t + "-" + se, t + "-" + de]); }, []), er = "beforeRead", tr = "read", rr = "afterRead", nr = "beforeMain", or = "main", ar = "afterMain", ir = "beforeWrite", sr = "write", lr = "afterWrite", pr = [er, tr, rr, nr, or, ar, ir, sr, lr]; function cr(e) { var t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), n = []; e.forEach(function(a) { t.set(a.name, a); }); function o(a) { r.add(a.name); var s = [].concat(a.requires || [], a.requiresIfExists || []); s.forEach(function(i) { if (!r.has(i)) { var l = t.get(i); l && o(l); } }), n.push(a); } return e.forEach(function(a) { r.has(a.name) || o(a); }), n; } function ur(e) { var t = cr(e); return pr.reduce(function(r, n) { return r.concat(t.filter(function(o) { return o.phase === n; })); }, []); } function fr(e) { var t; return function() { return t || (t = new Promise(function(r) { Promise.resolve().then(function() { t = void 0, r(e()); }); })), t; }; } function H(e) { return e.split("-")[0]; } function dr(e) { var t = e.reduce(function(r, n) { var o = r[n.name]; return r[n.name] = o ? Object.assign({}, o, n, { options: Object.assign({}, o.options, n.options), data: Object.assign({}, o.data, n.data) }) : n, r; }, {}); return Object.keys(t).map(function(r) { return t[r]; }); } function vr(e) { var t = z(e), r = te(e), n = t.visualViewport, o = r.clientWidth, a = r.clientHeight, s = 0, i = 0; return n && (o = n.width, a = n.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (s = n.offsetLeft, i = n.offsetTop)), { width: o, height: a, x: s + ze(e), y: i }; } var ee = Math.max, ve = Math.min, we = Math.round; function hr(e) { var t, r = te(e), n = Ne(e), o = (t = e.ownerDocument) == null ? void 0 : t.body, a = ee(r.scrollWidth, r.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), s = ee(r.scrollHeight, r.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), i = -n.scrollLeft + ze(e), l = -n.scrollTop; return G(o || r).direction === "rtl" && (i += ee(r.clientWidth, o ? o.clientWidth : 0) - a), { width: a, height: s, x: i, y: l }; } function bt(e, t) { var r = t.getRootNode && t.getRootNode(); if (e.contains(t)) return !0; if (r && vt(r)) { var n = t; do { if (n && e.isSameNode(n)) return !0; n = n.parentNode || n.host; } while (n); } return !1; } function je(e) { return Object.assign({}, e, { left: e.x, top: e.y, right: e.x + e.width, bottom: e.y + e.height }); } function mr(e) { var t = ie(e); return t.top = t.top + e.clientTop, t.left = t.left + e.clientLeft, t.bottom = t.top + e.clientHeight, t.right = t.left + e.clientWidth, t.width = e.clientWidth, t.height = e.clientHeight, t.x = t.left, t.y = t.top, t; } function nt(e, t) { return t === mt ? je(vr(e)) : L(t) ? mr(t) : je(hr(te(e))); } function gr(e) { var t = ce(Se(e)), r = ["absolute", "fixed"].indexOf(G(e).position) >= 0, n = r && L(e) ? he(e) : e; return fe(n) ? t.filter(function(o) { return fe(o) && bt(o, n) && W(o) !== "body"; }) : []; } function br(e, t, r) { var n = t === "clippingParents" ? gr(e) : [].concat(t), o = [].concat(n, [r]), a = o[0], s = o.reduce(function(i, l) { var u = nt(e, l); return i.top = ee(u.top, i.top), i.right = ve(u.right, i.right), i.bottom = ve(u.bottom, i.bottom), i.left = ee(u.left, i.left), i; }, nt(e, a)); return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s; } function le(e) { return e.split("-")[1]; } function Ve(e) { return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y"; } function yt(e) { var t = e.reference, r = e.element, n = e.placement, o = n ? H(n) : null, a = n ? le(n) : null, s = t.x + t.width / 2 - r.width / 2, i = t.y + t.height / 2 - r.height / 2, l; switch (o) { case R: l = { x: s, y: t.y - r.height }; break; case j: l = { x: s, y: t.y + t.height }; break; case N: l = { x: t.x + t.width, y: i }; break; case M: l = { x: t.x - r.width, y: i }; break; default: l = { x: t.x, y: t.y }; } var u = o ? Ve(o) : null; if (u != null) { var p = u === "y" ? "height" : "width"; switch (a) { case se: l[u] = l[u] - (t[p] / 2 - r[p] / 2); break; case de: l[u] = l[u] + (t[p] / 2 - r[p] / 2); break; } } return l; } function wt() { return { top: 0, right: 0, bottom: 0, left: 0 }; } function xt(e) { return Object.assign({}, wt(), e); } function Ot(e, t) { return t.reduce(function(r, n) { return r[n] = e, r; }, {}); } function Fe(e, t) { t === void 0 && (t = {}); var r = t, n = r.placement, o = n === void 0 ? e.placement : n, a = r.boundary, s = a === void 0 ? Qt : a, i = r.rootBoundary, l = i === void 0 ? mt : i, u = r.elementContext, p = u === void 0 ? pe : u, b = r.altBoundary, f = b === void 0 ? !1 : b, v = r.padding, g = v === void 0 ? 0 : v, h = xt(typeof g != "number" ? g : Ot(g, me)), m = p === pe ? Zt : pe, x = e.rects.popper, O = e.elements[f ? m : p], d = br(fe(O) ? O : O.contextElement || te(e.elements.popper), s, l), c = ie(e.elements.reference), y = yt({ reference: c, element: x, placement: o }), w = je(Object.assign({}, x, y)), k = p === pe ? w : c, E = { top: d.top - k.top + h.top, bottom: k.bottom - d.bottom + h.bottom, left: d.left - k.left + h.left, right: k.right - d.right + h.right }, C = e.modifiersData.offset; if (p === pe && C) { var A = C[o]; Object.keys(E).forEach(function(D) { var V = [N, j].indexOf(D) >= 0 ? 1 : -1, P = [R, j].indexOf(D) >= 0 ? "y" : "x"; E[D] += A[P] * V; }); } return E; } var ot = { placement: "bottom", modifiers: [], strategy: "absolute" }; function at() { for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++) t[r] = arguments[r]; return !t.some(function(n) { return !(n && typeof n.getBoundingClientRect == "function"); }); } function yr(e) { e === void 0 && (e = {}); var t = e, r = t.defaultModifiers, n = r === void 0 ? [] : r, o = t.defaultOptions, a = o === void 0 ? ot : o; return function(i, l, u) { u === void 0 && (u = a); var p = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, ot, a), modifiersData: {}, elements: { reference: i, popper: l }, attributes: {}, styles: {} }, b = [], f = !1, v = { state: p, setOptions: function(x) { var O = typeof x == "function" ? x(p.options) : x; h(), p.options = Object.assign({}, a, p.options, O), p.scrollParents = { reference: fe(i) ? ce(i) : i.contextElement ? ce(i.contextElement) : [], popper: ce(l) }; var d = ur(dr([].concat(n, p.options.modifiers))); return p.orderedModifiers = d.filter(function(c) { return c.enabled; }), g(), v.update(); }, // Sync update – it will always be executed, even if not necessary. This // is useful for low frequency updates where sync behavior simplifies the // logic. // For high frequency updates (e.g. `resize` and `scroll` events), always // prefer the async Popper#update method forceUpdate: function() { if (!f) { var x = p.elements, O = x.reference, d = x.popper; if (at(O, d)) { p.rects = { reference: Kt(O, he(d), p.options.strategy === "fixed"), popper: He(d) }, p.reset = !1, p.placement = p.options.placement, p.orderedModifiers.forEach(function(A) { return p.modifiersData[A.name] = Object.assign({}, A.data); }); for (var c = 0; c < p.orderedModifiers.length; c++) { if (p.reset === !0) { p.reset = !1, c = -1; continue; } var y = p.orderedModifiers[c], w = y.fn, k = y.options, E = k === void 0 ? {} : k, C = y.name; typeof w == "function" && (p = w({ state: p, options: E, name: C, instance: v }) || p); } } } }, // Async and optimistically optimized update – it will not be executed if // not necessary (debounced to run at most once-per-tick) update: fr(function() { return new Promise(function(m) { v.forceUpdate(), m(p); }); }), destroy: function() { h(), f = !0; } }; if (!at(i, l)) return v; v.setOptions(u).then(function(m) { !f && u.onFirstUpdate && u.onFirstUpdate(m); }); function g() { p.orderedModifiers.forEach(function(m) { var x = m.name, O = m.options, d = O === void 0 ? {} : O, c = m.effect; if (typeof c == "function") { var y = c({ state: p, name: x, instance: v, options: d }), w = function() { }; b.push(y || w); } }); } function h() { b.forEach(function(m) { return m(); }), b = []; } return v; }; } var xe = { passive: !0 }; function wr(e) { var t = e.state, r = e.instance, n = e.options, o = n.scroll, a = o === void 0 ? !0 : o, s = n.resize, i = s === void 0 ? !0 : s, l = z(t.elements.popper), u = [].concat(t.scrollParents.reference, t.scrollParents.popper); return a && u.forEach(function(p) { p.addEventListener("scroll", r.update, xe); }), i && l.addEventListener("resize", r.update, xe), function() { a && u.forEach(function(p) { p.removeEventListener("scroll", r.update, xe); }), i && l.removeEventListener("resize", r.update, xe); }; } var xr = { name: "eventListeners", enabled: !0, phase: "write", fn: function() { }, effect: wr, data: {} }; function Or(e) { var t = e.state, r = e.name; t.modifiersData[r] = yt({ reference: t.rects.reference, element: t.rects.popper, placement: t.placement }); } var kr = { name: "popperOffsets", enabled: !0, phase: "read", fn: Or, data: {} }, Cr = { top: "auto", right: "auto", bottom: "auto", left: "auto" }; function Er(e) { var t = e.x, r = e.y, n = window, o = n.devicePixelRatio || 1; return { x: we(we(t * o) / o) || 0, y: we(we(r * o) / o) || 0 }; } function it(e) { var t, r = e.popper, n = e.popperRect, o = e.placement, a = e.variation, s = e.offsets, i = e.position, l = e.gpuAcceleration, u = e.adaptive, p = e.roundOffsets, b = p === !0 ? Er(s) : typeof p == "function" ? p(s) : s, f = b.x, v = f === void 0 ? 0 : f, g = b.y, h = g === void 0 ? 0 : g, m = s.hasOwnProperty("x"), x = s.hasOwnProperty("y"), O = M, d = R, c = window; if (u) { var y = he(r), w = "clientHeight", k = "clientWidth"; y === z(r) && (y = te(r), G(y).position !== "static" && i === "absolute" && (w = "scrollHeight", k = "scrollWidth")), y = y, (o === R || (o === M || o === N) && a === de) && (d = j, h -= y[w] - n.height, h *= l ? 1 : -1), (o === M || (o === R || o === j) && a === de) && (O = N, v -= y[k] - n.width, v *= l ? 1 : -1); } var E = Object.assign({ position: i }, u && Cr); if (l) { var C; return Object.assign({}, E, (C = {}, C[d] = x ? "0" : "", C[O] = m ? "0" : "", C.transform = (c.devicePixelRatio || 1) <= 1 ? "translate(" + v + "px, " + h + "px)" : "translate3d(" + v + "px, " + h + "px, 0)", C)); } return Object.assign({}, E, (t = {}, t[d] = x ? h + "px" : "", t[O] = m ? v + "px" : "", t.transform = "", t)); } function Pr(e) { var t = e.state, r = e.options, n = r.gpuAcceleration, o = n === void 0 ? !0 : n, a = r.adaptive, s = a === void 0 ? !0 : a, i = r.roundOffsets, l = i === void 0 ? !0 : i, u = { placement: H(t.placement), variation: le(t.placement), popper: t.elements.popper, popperRect: t.rects.popper, gpuAcceleration: o }; t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, it(Object.assign({}, u, { offsets: t.modifiersData.popperOffsets, position: t.options.strategy, adaptive: s, roundOffsets: l })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, it(Object.assign({}, u, { offsets: t.modifiersData.arrow, position: "absolute", adaptive: !1, roundOffsets: l })))), t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-placement": t.placement }); } var Sr = { name: "computeStyles", enabled: !0, phase: "beforeWrite", fn: Pr, data: {} }; function Br(e) { var t = e.state; Object.keys(t.elements).forEach(function(r) { var n = t.styles[r] || {}, o = t.attributes[r] || {}, a = t.elements[r]; !L(a) || !W(a) || (Object.assign(a.style, n), Object.keys(o).forEach(function(s) { var i = o[s]; i === !1 ? a.removeAttribute(s) : a.setAttribute(s, i === !0 ? "" : i); })); }); } function $r(e) { var t = e.state, r = { popper: { position: t.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} }; return Object.assign(t.elements.popper.style, r.popper), t.styles = r, t.elements.arrow && Object.assign(t.elements.arrow.style, r.arrow), function() { Object.keys(t.elements).forEach(function(n) { var o = t.elements[n], a = t.attributes[n] || {}, s = Object.keys(t.styles.hasOwnProperty(n) ? t.styles[n] : r[n]), i = s.reduce(function(l, u) { return l[u] = "", l; }, {}); !L(o) || !W(o) || (Object.assign(o.style, i), Object.keys(a).forEach(function(l) { o.removeAttribute(l); })); }); }; } var Ar = { name: "applyStyles", enabled: !0, phase: "write", fn: Br, effect: $r, requires: ["computeStyles"] }, Dr = [xr, kr, Sr, Ar], Tr = /* @__PURE__ */ yr({ defaultModifiers: Dr }); function Lr(e) { return e === "x" ? "y" : "x"; } function Oe(e, t, r) { return ee(e, ve(t, r)); } function Rr(e) { var t = e.state, r = e.options, n = e.name, o = r.mainAxis, a = o === void 0 ? !0 : o, s = r.altAxis, i = s === void 0 ? !1 : s, l = r.boundary, u = r.rootBoundary, p = r.altBoundary, b = r.padding, f = r.tether, v = f === void 0 ? !0 : f, g = r.tetherOffset, h = g === void 0 ? 0 : g, m = Fe(t, { boundary: l, rootBoundary: u, padding: b, altBoundary: p }), x = H(t.placement), O = le(t.placement), d = !O, c = Ve(x), y = Lr(c), w = t.modifiersData.popperOffsets, k = t.rects.reference, E = t.rects.popper, C = typeof h == "function" ? h(Object.assign({}, t.rects, { placement: t.placement })) : h, A = { x: 0, y: 0 }; if (w) { if (a || i) { var D = c === "y" ? R : M, V = c === "y" ? j : N, P = c === "y" ? "height" : "width", F = w[c], q = w[c] + m[D], T = w[c] - m[V], X = v ? -E[P] / 2 : 0, B = O === se ? k[P] : E[P], $ = O === se ? -E[P] : -k[P], S = t.elements.arrow, Y = v && S ? He(S) : { width: 0, height: 0 }, oe = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : wt(), ge = oe[D], re = oe[V], I = Oe(0, k[P], Y[P]), be = d ? k[P] / 2 - X - I - ge - C : B - I - ge - C, Be = d ? -k[P] / 2 + X + I + re + C : $ + I + re + C, ae = t.elements.arrow && he(t.elements.arrow), $e = ae ? c === "y" ? ae.clientTop || 0 : ae.clientLeft || 0 : 0, Xe = t.modifiersData.offset ? t.modifiersData.offset[t.placement][c] : 0, Ye = w[c] + be - Xe - $e, _e = w[c] + Be - Xe; if (a) { var Ue = Oe(v ? ve(q, Ye) : q, F, v ? ee(T, _e) : T); w[c] = Ue, A[c] = Ue - F; } if (i) { var Et = c === "x" ? R : M, Pt = c === "x" ? j : N, ye = w[y], Ke = ye + m[Et], Ge = ye - m[Pt], Je = Oe(v ? ve(Ke, Ye) : Ke, ye, v ? ee(Ge, _e) : Ge); w[y] = Je, A[y] = Je - ye; } } t.modifiersData[n] = A; } } var Mr = { name: "preventOverflow", enabled: !0, phase: "main", fn: Rr, requiresIfExists: ["offset"] }, jr = { left: "right", right: "left", bottom: "top", top: "bottom" }; function ke(e) { return e.replace(/left|right|bottom|top/g, function(t) { return jr[t]; }); } var Nr = { start: "end", end: "start" }; function st(e) { return e.replace(/start|end/g, function(t) { return Nr[t]; }); } function zr(e, t) { t === void 0 && (t = {}); var r = t, n = r.placement, o = r.boundary, a = r.rootBoundary, s = r.padding, i = r.flipVariations, l = r.allowedAutoPlacements, u = l === void 0 ? gt : l, p = le(n), b = p ? i ? rt : rt.filter(function(g) { return le(g) === p; }) : me, f = b.filter(function(g) { return u.indexOf(g) >= 0; }); f.length === 0 && (f = b); var v = f.reduce(function(g, h) { return g[h] = Fe(e, { placement: h, boundary: o, rootBoundary: a, padding: s })[H(h)], g; }, {}); return Object.keys(v).sort(function(g, h) { return v[g] - v[h]; }); } function Ir(e) { if (H(e) === We) return []; var t = ke(e); return [st(e), t, st(t)]; } function Hr(e) { var t = e.state, r = e.options, n = e.name; if (!t.modifiersData[n]._skip) { for (var o = r.mainAxis, a = o === void 0 ? !0 : o, s = r.altAxis, i = s === void 0 ? !0 : s, l = r.fallbackPlacements, u = r.padding, p = r.boundary, b = r.rootBoundary, f = r.altBoundary, v = r.flipVariations, g = v === void 0 ? !0 : v, h = r.allowedAutoPlacements, m = t.options.placement, x = H(m), O = x === m, d = l || (O || !g ? [ke(m)] : Ir(m)), c = [m].concat(d).reduce(function(re, I) { return re.concat(H(I) === We ? zr(t, { placement: I, boundary: p, rootBoundary: b, padding: u, flipVariations: g, allowedAutoPlacements: h }) : I); }, []), y = t.rects.reference, w = t.rects.popper, k = /* @__PURE__ */ new Map(), E = !0, C = c[0], A = 0; A < c.length; A++) { var D = c[A], V = H(D), P = le(D) === se, F = [R, j].indexOf(V) >= 0, q = F ? "width" : "height", T = Fe(t, { placement: D, boundary: p, rootBoundary: b, altBoundary: f, padding: u }), X = F ? P ? N : M : P ? j : R; y[q] > w[q] && (X = ke(X)); var B = ke(X), $ = []; if (a && $.push(T[V] <= 0), i && $.push(T[X] <= 0, T[B] <= 0), $.every(function(re) { return re; })) { C = D, E = !1; break; } k.set(D, $); } if (E) for (var S = g ? 3 : 1, Y = function(I) { var be = c.find(function(Be) { var ae = k.get(Be); if (ae) return ae.slice(0, I).every(function($e) { return $e; }); }); if (be) return C = be, "break"; }, oe = S; oe > 0; oe--) { var ge = Y(oe); if (ge === "break") break; } t.placement !== C && (t.modifiersData[n]._skip = !0, t.placement = C, t.reset = !0); } } var Wr = { name: "flip", enabled: !0, phase: "main", fn: Hr, requiresIfExists: ["offset"], data: { _skip: !1 } }; function Vr(e, t, r) { var n = H(e), o = [M, R].indexOf(n) >= 0 ? -1 : 1, a = typeof r == "function" ? r(Object.assign({}, t, { placement: e })) : r, s = a[0], i = a[1]; return s = s || 0, i = (i || 0) * o, [M, N].indexOf(n) >= 0 ? { x: i, y: s } : { x: s, y: i }; } function Fr(e) { var t = e.state, r = e.options, n = e.name, o = r.offset, a = o === void 0 ? [0, 0] : o, s = gt.reduce(function(p, b) { return p[b] = Vr(b, t.rects, a), p; }, {}), i = s[t.placement], l = i.x, u = i.y; t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += l, t.modifiersData.popperOffsets.y += u), t.modifiersData[n] = s; } var qr = { name: "offset", enabled: !0, phase: "main", requires: ["popperOffsets"], fn: Fr }, Xr = function(t, r) { return t = typeof t == "function" ? t(Object.assign({}, r.rects, { placement: r.placement })) : t, xt(typeof t != "number" ? t : Ot(t, me)); }; function Yr(e) { var t, r = e.state, n = e.name, o = e.options, a = r.elements.arrow, s = r.modifiersData.popperOffsets, i = H(r.placement), l = Ve(i), u = [M, N].indexOf(i) >= 0, p = u ? "height" : "width"; if (!(!a || !s)) { var b = Xr(o.padding, r), f = He(a), v = l === "y" ? R : M, g = l === "y" ? j : N, h = r.rects.reference[p] + r.rects.reference[l] - s[l] - r.rects.popper[p], m = s[l] - r.rects.reference[l], x = he(a), O = x ? l === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, d = h / 2 - m / 2, c = b[v], y = O - f[p] - b[g], w = O / 2 - f[p] / 2 + d, k = Oe(c, w, y), E = l; r.modifiersData[n] = (t = {}, t[E] = k, t.centerOffset = k - w, t); } } function _r(e) { var t = e.state, r = e.options, n = r.element, o = n === void 0 ? "[data-popper-arrow]" : n; o != null && (typeof o == "string" && (o = t.elements.popper.querySelector(o), !o) || bt(t.elements.popper, o) && (t.elements.arrow = o)); } var Ur = { name: "arrow", enabled: !0, phase: "main", fn: Yr, effect: _r, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] }; const Te = (e) => parseInt(e, 10); function Kr({ arrowPadding: e, emit: t, locked: r, offsetDistance: n, offsetSkid: o, placement: a, popperNode: s, triggerNode: i }) { const l = Lt({ isOpen: !1, popperInstance: null }), u = (h) => { var m; (m = l.popperInstance) === null || m === void 0 || m.setOptions((x) => ({ ...x, modifiers: [...x.modifiers, { name: "eventListeners", enabled: h }] })); }, p = () => u(!0), b = () => u(!1), f = () => { l.isOpen && (l.isOpen = !1, t("close:popper")); }, v = () => { l.isOpen || (l.isOpen = !0, t("open:popper")); }; ue([() => l.isOpen, a], async ([h]) => { h ? (await g(), p()) : b(); }); const g = async () => { await Rt(), l.popperInstance = Tr(i.value, s.value, { placement: a.value, modifiers: [Mr, Wr, { name: "flip", enabled: !r.value }, Ur, { name: "arrow", options: { padding: Te(e.value) } }, qr, { name: "offset", options: { offset: [Te(o.value), Te(n.value)] } }] }), l.popperInstance.update(); }; return Pe(() => { var h; (h = l.popperInstance) === null || h === void 0 || h.destroy(); }), { ...pt(l), open: v, close: f }; } const Gr = { id: "arrow", "data-popper-arrow": "" }; function Jr(e, t) { return U(), ne("div", Gr); } function kt(e, t) { t === void 0 && (t = {}); var r = t.insertAt; if (!(!e || typeof document > "u")) { var n = document.head || document.getElementsByTagName("head")[0], o = document.createElement("style"); o.type = "text/css", r === "top" && n.firstChild ? n.insertBefore(o, n.firstChild) : n.appendChild(o), o.styleSheet ? o.styleSheet.cssText = e : o.appendChild(document.createTextNode(e)); } } var Qr = ` #arrow[data-v-20b7fd4a], #arrow[data-v-20b7fd4a]::before { transition: background 250ms ease-in-out; position: absolute; width: calc(10px - var(--popper-theme-border-width, 0px)); height: calc(10px - var(--popper-theme-border-width, 0px)); box-sizing: border-box; background: var(--popper-theme-background-color); } #arrow[data-v-20b7fd4a] { visibility: hidden; } #arrow[data-v-20b7fd4a]::before { visibility: visible; content: ""; transform: rotate(45deg); } /* Top arrow */ .popper[data-popper-placement^="top"] > #arrow[data-v-20b7fd4a] { bottom: -5px; } .popper[data-popper-placement^="top"] > #arrow[data-v-20b7fd4a]::before { border-right: var(--popper-theme-border-width) var(--popper-theme-border-style) var(--popper-theme-border-color); border-bottom: var(--popper-theme-border-width) var(--popper-theme-border-style) var(--popper-theme-border-color); } /* Bottom arrow */ .popper[data-popper-placement^="bottom"] > #arrow[data-v-20b7fd4a] { top: -5px; } .popper[data-popper-placement^="bottom"] > #arrow[data-v-20b7fd4a]::before { border-left: var(--popper-theme-border-width) var(--popper-theme-border-style) var(--popper-theme-border-color); border-top: var(--popper-theme-border-width) var(--popper-theme-border-style) var(--popper-theme-border-color); } /* Left arrow */ .popper[data-popper-placement^="left"] > #arrow[data-v-20b7fd4a] { right: -5px; } .popper[data-popper-placement^="left"] > #arrow[data-v-20b7fd4a]::before { border-right: var(--popper-theme-border-width) var(--popper-theme-border-style) var(--popper-theme-border-color); border-top: var(--popper-theme-border-width) var(--popper-theme-border-style) var(--popper-theme-border-color); } /* Right arrow */ .popper[data-popper-placement^="right"] > #arrow[data-v-20b7fd4a] { left: -5px; } `; kt(Qr); const qe = {}; qe.render = Jr; qe.__scopeId = "data-v-20b7fd4a"; var Zr = qe; const en = ["onKeyup"]; var Ct = { props: { /** * Preferred placement (the "auto" placements will choose the side with most space.) */ placement: { type: String, default: "bottom", validator: function(e) { return ["auto", "auto-start", "auto-end", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"].includes(e); } }, /** * Disables automatically closing the popover when the user clicks away from it */ disableClickAway: { type: Boolean, default: !1 }, /** * Offset in pixels along the trigger element */ offsetSkid: { type: String, default: "0" }, /** * Offset in pixels away from the trigger element */ offsetDistance: { type: String, default: "12" }, /** * Trigger the popper on hover */ hover: { type: Boolean, default: !1 }, /** * Manually open/close the Popper, other events are ignored if this prop is set */ show: { type: Boolean, default: null }, /** * Disables the Popper. If it was already open, it will be closed. */ disabled: { type: Boolean, default: !1 }, /** * Open the Popper after a delay (ms). */ openDelay: { type: [Number, String], default: 0 }, /** * Close the Popper after a delay (ms). */ closeDelay: { type: [Number, String], default: 0 }, /** * The z-index of the Popper. */ zIndex: { type: [Number, String], default: 9999 }, /** * Display an arrow on the popper */ arrow: { type: Boolean, default: !1 }, /** * Stop arrow from reaching the edge of the popper */ arrowPadding: { type: String, default: "0" }, /** * If the Popper should be interactive, it will close when clicked/hovered if false */ interactive: { type: Boolean, default: !0 }, /** * Lock the Popper into place, it will not flip dynamically when it runs out of space if true */ locked: { type: Boolean, default: !1 }, /** * If the content is just a simple string, it can be passed in as a prop */ content: { type: String, default: null } }, emits: ["open:popper", "close:popper"], setup(e, { emit: t }) { const r = e; lt((B) => ({ c81fc0a4: e.zIndex })); const n = St(), o = K(null), a = K(null), s = K(null), i = K(!1); Ee(() => { const B = n.default(); if (B && B.length > 1) return console.error(`[Popper]: The <Popper> component expects only one child element at its root. You passed ${B.length} child nodes.`); }); const { arrowPadding: l, closeDelay: u, content: p, disableClickAway: b, disabled: f, interactive: v, locked: g, offsetDistance: h, offsetSkid: m, openDelay: x, placement: O, show: d } = pt(r), { isOpen: c, open: y, close: w } = Kr({ arrowPadding: l, emit: t, locked: g, offsetDistance: h, offsetSkid: m, placement: O, popperNode: a, triggerNode: s }), { hasContent: k } = Xt(n, a, p), E = Q(() => d.value !== null), C = Q(() => f.value || !k.value), A = Q(() => c.value && !C.value), D = Q(() => !b.value && !E.value), V = Q(() => v.value ? `border: ${h.value}px solid transparent; margin: -${h.value}px;` : null), P = De.debounce(y, x.value), F = De.debounce(w, u.value), q = async () => { C.value || E.value || (F.clear(), P()); }, T = async () => { E.value || (P.clear(), F()); }, X = () => { c.value ? T() : q(); }; return ue([k, f], ([B, $]) => { c.value && (!B || $) && w(); }), ue(c, (B) => { B ? i.value = !0 : De.debounce(() => { i.value = !1; }, 200); }), Qe(() => { E.value && (d.value ? P() : F()); }), Qe(() => { D.value && qt(o, T); }), (B, $) => (U(), ne("div", { class: "inline-block", style: ct(Z(V)), onMouseleave: $[2] || ($[2] = (S) => e.hover && T()), ref: (S, Y) => { Y.popperContainerNode = S, o.value = S; } }, [_("div", { ref: (S, Y) => { Y.triggerNode = S, s.value = S; }, onMouseover: $[0] || ($[0] = (S) => e.hover && q()), onClick: X, onFocus: q, onKeyup: $t(T, ["esc"]) }, [Ce(B.$slots, "default")], 40, en), Bt(At, { name: "fade" }, { default: Le(() => [ut(_("div", { onClick: $[1] || ($[1] = (S) => !Z(v) && T()), class: "popper", ref: (S, Y) => { Y.popperNode = S, a.value = S; } }, [Ce(B.$slots, "content", { close: Z(w), isOpen: i.value }, () => [Re(dt(Z(p)), 1)]), e.arrow ? (U(), ft(Zr, { key: 0 })) : Dt("", !0)], 512), [[Tt, Z(A)]])]), _: 3 })], 36)); } }, tn = ` .inline-block[data-v-5784ed69] { display: inline-block; } .popper[data-v-5784ed69] { transition: background 250ms ease-in-out; background: var(--popper-theme-background-color); padding: var(--popper-theme-padding); color: var(--popper-theme-text-color); border-radius: var(--popper-theme-border-radius); border-width: var(--popper-theme-border-width); border-style: var(--popper-theme-border-style); border-color: var(--popper-theme-border-color); box-shadow: var(--popper-theme-box-shadow); z-index: var(--c81fc0a4); } .popper[data-v-5784ed69]:hover, .popper:hover > #arrow[data-v-5784ed69]::before { background: var(--popper-theme-background-color-hover); } .inline-block[data-v-5784ed69] { display: inline-block; } .fade-enter-active[data-v-5784ed69], .fade-leave-active[data-v-5784ed69] { transition: opacity 0.2s ease; } .fade-enter-from[data-v-5784ed69], .fade-leave-to[data-v-5784ed69] { opacity: 0; } `; kt(tn); Ct.__scopeId = "data-v-5784ed69"; var rn = /* @__PURE__ */ (() => { const e = Ct; return e.install = (t) => { t.component("Popper", e); }, e; })(); const nn = ["onClick"], on = { key: 1, class: "empty-data flex" }, an = ["value", "placeholder"], sn = ["width", "height"], ln = ["width", "height"], pn = /* @__PURE__ */ jt({ name: "VueSelect", __name: "index", props: /* @__PURE__ */ Ze({ height: { default: 40 }, size: { default: 14 }, placeholder: { default: "请选择" }, clearable: { type: Boolean, default: !1 }, options: { default: () => [] }, multiple: { type: Boolean, default: !1 }, offset: { default: 10 }, activeColor: { default: "#3875C6" }, border: { type: Boolean, default: !0 }, separator: { default: "," } }, { modelValue: {}, modelModifiers: {} }), emits: /* @__PURE__ */ Ze(["change", "clear"], ["update:modelValue"]), setup(e, { emit: t }) { lt((d) => ({ "5d2ea3dc": n.height + "px", "5c436142": n.size + "px", "7ac165b3": n.activeColor, "133a81d2": n.size * 1.2 + "px" })); const r = { ...Vt }, n = e, o = t, a = K(null), s = K(null), i = K(0), l = K(!1), u = new ResizeObserver((d) => { for (const c of d) c.target === a.value && (i.value = c.contentRect.width); }), p = () => { l.value = !1; }, b = () => { l.value = !l.value; }, f = Nt(e, "modelValue"), v = (d, c) => Array.isArray(d) ? d.includes(c) : d === c; Ee(() => { u.observe(a.value), n.multiple && !Array.isArray(f.value) && (f.value = []); }), Pe(() => { u.unobserve(a.value); }); const g = Q(() => { var d; return n.multiple ? n.options.filter((c) => Array.isArray(f.value) && f.value.includes(c.value)).map((c) => c.label).join(n.separator) : ((d = n.options.find((c) => c.value === f.value)) == null ? void 0 : d.label) || ""; }), h = Q(() => n.clearable ? n.multiple ? f.value && f.value.length > 0 : f.value !== null && f.value !== void 0 && n.options.find((d) => d.value === f.value) : !1), m = Q(() => n.size + 2), x = (d) => { n.multiple ? (f.value.includes(d.value) ? f.value = f.value.filter((c) => d.value !== c) : f.value = [...f.value, d.value], o("change", f.value)) : (d.value !== f.value && (f.value = d.value, o("change", f.value)), b()); }, O = () => { n.multiple ? (f.value && f.value.length > 0 && o("change", []), f.value = []) : (f.value !== void 0 && o("change", void 0), f.value = void 0), o("clear"); }; return (d, c) => ut((U(), ft(Z(rn), { show: l.value, class: "select-popover", arrow: !0, offsetDistance: String(d.offset), ref_key: "select", ref: s }, { content: Le(() => [ _("div", { class: "select-options", style: ct({ width: i.value + "px" }) }, [ d.options && d.options.length ? (U(!0), ne(zt, { key: 0 }, It(d.options, (y, w) => (U(), ne("div", { class: Ae(["select-item", { "select-active": v(f.value, y.value) }]), key: w, onClick: (k) => x(y) }, [ Ce(d.$slots, "option", { option: y }, () => [ Re(dt(y.label), 1) ], !0) ], 10, nn))), 128)) : (U(), ne("div", on, [ Ce(d.$slots, "empty", {}, () => [ c[0] || (c[0] = Re("暂无数据")) ], !0) ])) ], 4) ]), default: Le(() => [ _("div", { class: Ae(["mobile-select flex", { "select-input-active": l.value, "select-input-border": !d.border }]), onClick: b, ref_key: "selectEl", ref: a }, [ _("input", { type: "text", value: g.value, readonly: "", autocomplete: "off", class: "select-input", placeholder: d.placeholder }, null, 8, an), _("div", { class: Ae(["icon-wrap flex", { "icon-active": l.value }]) }, [ h.value ? (U(), ne("svg", { key: 1, onClick: O, t: "1741159472813", class: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "p-id": "4677", width: m.value, height: m.value }, c[2] || (c[2] = [ _("path", { d: "M511.488511 972.851149c254.238434 0 460.33966-206.101227 460.339661-460.33966S765.726945 52.171828 511.488511 52.171828 51.148851 258.273055 51.148851 512.511489s206.101227 460.33966 460.33966 460.33966z m0 51.148851C229.00159 1024 0 794.99841 0 512.511489S229.00159 1.022977 511.488511 1.022977s511.488511 229.00159 511.488512 511.488512-229.00159 511.488511-511.488512 511.488511z", fill: "currentColor", "p-id": "4678" }, null, -1), _("path", { d: "M513.306342 478.160943l-162.755645-162.754621c-9.986302-9.987325-26.180028-9.987325-36.167352 0-9.987325 9.987325-9.987325 26.181051 0 36.168375l162.755644 162.754622-162.755644 162.754621c-9.987325 9.987325-9.987325 26.180028 0 36.167353 9.987325 9.987325 26.181051 9.987325 36.168375 0l162.754622-162.754622 162.754621 162.755645c9.987325 9.986302 26.180028 9.986302 36.167353 0 9.987325-9.988348 9.987325-26.181051 0-36.168376l-162.754622-162.755644 162.755645-162.753599c9.986302-9.987325 9.986302-26.181051 0-36.168375-9.988348-9.987325-26.181051-9.987325-36.168376 0l-162.755644 162.755644z", fill: "currentColor", "p-id": "4679" }, null, -1) ]), 8, ln)) : (U(), ne("svg", { key: 0, t: "1741137235306", class: "icon", viewBox: "0 0 1024 1024", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "p-id": "2543", width: m.value, height: m.value }, c[1] || (c[1] = [ _("path", { d: "M890.335 373.578c-12.576-12.416-32.801-12.353-45.248 0.193l-327.839 330.848-332.416-329.439c-12.576-12.447-32.801-12.353-45.281 0.193-12.447 12.576-12.353 32.832 0.193 45.281l353.312 350.112c0.544 0.544 1.247 0.673 1.792 1.183 0.127 0.127 0.16 0.287 0.287 0.416 6.239 6.176 14.4 9.28 22.528 9.28 8.224 0 16.48-3.169 22.72-9.471l350.112-353.312c12.48-12.58 12.385-32.835-0.16-45.284z", fill: "currentColor", "p-id": "2544" }, null, -1) ]), 8, sn)) ], 2) ], 2) ]), _: 3 }, 8, ["show", "offsetDistance"])), [ [r, p, "click-outside"] ]); } }), cn = (e, t) => { const r = e.__vccOpts || e; for (const [n, o] of t) r[n] = o; return r; }, fn = /* @__PURE__ */ cn(pn, [["__scopeId", "data-v-71eefbee"]]); export { fn as default, fn as mobileSelect };