@dolusoft/vue3-datatable
Version:
Vue3 Datatable - fully customizable & easy to use datatable library
1,539 lines • 137 kB
JavaScript
import { onMounted as Ee, nextTick as _e, getCurrentScope as Kn, onScopeDispose as Xn, unref as Q, getCurrentInstance as Mt, computed as Z, ref as q, watch as le, defineComponent as xe, useCssVars as Yn, shallowRef as be, onUnmounted as tt, openBlock as c, createElementBlock as v, Fragment as H, withDirectives as me, createElementVNode as y, normalizeClass as E, normalizeStyle as U, withModifiers as pe, setBlockTracking as qt, vShow as gt, createCommentVNode as T, mergeProps as Jn, renderSlot as oe, renderList as ue, createVNode as te, reactive as Zn, watchEffect as el, useSlots as pn, onBeforeUnmount as Pt, provide as Se, createBlock as he, resolveDynamicComponent as tl, inject as Fe, h as bt, toRef as nl, toDisplayString as G, createTextVNode as Ae, vModelText as ft, vModelSelect as vn, withCtx as ze, vModelCheckbox as jt } from "vue";
function ll(e) {
return Kn() ? (Xn(e), !0) : !1;
}
function ol(e) {
return typeof e == "function" ? e() : Q(e);
}
const il = typeof window < "u" && typeof document < "u";
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
function rl(e) {
return Mt();
}
function sl(e, l = !0, n) {
rl() ? Ee(e, n) : l ? e() : _e(e);
}
function Ie(e) {
var l;
const n = ol(e);
return (l = n == null ? void 0 : n.$el) != null ? l : n;
}
const mn = il ? window : void 0;
function al() {
const e = q(!1), l = Mt();
return l && Ee(() => {
e.value = !0;
}, l), e;
}
function ul(e) {
const l = al();
return Z(() => (l.value, !!e()));
}
function cl(e, l, n = {}) {
const { window: o = mn, ...t } = n;
let i;
const a = ul(() => o && "ResizeObserver" in o), r = () => {
i && (i.disconnect(), i = void 0);
}, u = Z(() => Array.isArray(e) ? e.map((g) => Ie(g)) : [Ie(e)]), f = le(
u,
(g) => {
if (r(), a.value && o) {
i = new ResizeObserver(l);
for (const P of g)
P && i.observe(P, t);
}
},
{ immediate: !0, flush: "post" }
), h = () => {
r(), f();
};
return ll(h), {
isSupported: a,
stop: h
};
}
function dl(e, l = { width: 0, height: 0 }, n = {}) {
const { window: o = mn, box: t = "content-box" } = n, i = Z(() => {
var g, P;
return (P = (g = Ie(e)) == null ? void 0 : g.namespaceURI) == null ? void 0 : P.includes("svg");
}), a = q(l.width), r = q(l.height), { stop: u } = cl(
e,
([g]) => {
const P = t === "border-box" ? g.borderBoxSize : t === "content-box" ? g.contentBoxSize : g.devicePixelContentBoxSize;
if (o && i.value) {
const I = Ie(e);
if (I) {
const _ = I.getBoundingClientRect();
a.value = _.width, r.value = _.height;
}
} else if (P) {
const I = Array.isArray(P) ? P : [P];
a.value = I.reduce((_, { inlineSize: A }) => _ + A, 0), r.value = I.reduce((_, { blockSize: A }) => _ + A, 0);
} else
a.value = g.contentRect.width, r.value = g.contentRect.height;
},
n
);
sl(() => {
const g = Ie(e);
g && (a.value = "offsetWidth" in g ? g.offsetWidth : l.width, r.value = "offsetHeight" in g ? g.offsetHeight : l.height);
});
const f = le(
() => Ie(e),
(g) => {
a.value = g ? l.width : 0, r.value = g ? l.height : 0;
}
);
function h() {
u(), f();
}
return {
width: a,
height: r,
stop: h
};
}
var fl = typeof global == "object" && global && global.Object === Object && global, hl = typeof self == "object" && self && self.Object === Object && self, gn = fl || hl || Function("return this")(), nt = gn.Symbol, bn = Object.prototype, pl = bn.hasOwnProperty, vl = bn.toString, $e = nt ? nt.toStringTag : void 0;
function ml(e) {
var l = pl.call(e, $e), n = e[$e];
try {
e[$e] = void 0;
var o = !0;
} catch {
}
var t = vl.call(e);
return o && (l ? e[$e] = n : delete e[$e]), t;
}
var gl = Object.prototype, bl = gl.toString;
function yl(e) {
return bl.call(e);
}
var wl = "[object Null]", xl = "[object Undefined]", Ut = nt ? nt.toStringTag : void 0;
function kl(e) {
return e == null ? e === void 0 ? xl : wl : Ut && Ut in Object(e) ? ml(e) : yl(e);
}
function Cl(e) {
return e != null && typeof e == "object";
}
var Sl = "[object Symbol]";
function zl(e) {
return typeof e == "symbol" || Cl(e) && kl(e) == Sl;
}
var Ll = /\s/;
function El(e) {
for (var l = e.length; l-- && Ll.test(e.charAt(l)); )
;
return l;
}
var Ml = /^\s+/;
function Pl(e) {
return e && e.slice(0, El(e) + 1).replace(Ml, "");
}
function lt(e) {
var l = typeof e;
return e != null && (l == "object" || l == "function");
}
var Vt = NaN, Tl = /^[-+]0x[0-9a-f]+$/i, Fl = /^0b[01]+$/i, Il = /^0o[0-7]+$/i, _l = parseInt;
function Ne(e) {
if (typeof e == "number")
return e;
if (zl(e))
return Vt;
if (lt(e)) {
var l = typeof e.valueOf == "function" ? e.valueOf() : e;
e = lt(l) ? l + "" : l;
}
if (typeof e != "string")
return e === 0 ? e : +e;
e = Pl(e);
var n = Fl.test(e);
return n || Il.test(e) ? _l(e.slice(2), n ? 2 : 8) : Tl.test(e) ? Vt : +e;
}
function Ol(e, l, n) {
return e === e && (n !== void 0 && (e = e <= n ? e : n), l !== void 0 && (e = e >= l ? e : l)), e;
}
function Ke(e, l, n) {
return n === void 0 && (n = l, l = void 0), n !== void 0 && (n = Ne(n), n = n === n ? n : 0), l !== void 0 && (l = Ne(l), l = l === l ? l : 0), Ol(Ne(e), l, n);
}
var ht = function() {
return gn.Date.now();
}, $l = "Expected a function", Rl = Math.max, Al = Math.min;
function yn(e, l, n) {
var o, t, i, a, r, u, f = 0, h = !1, g = !1, P = !0;
if (typeof e != "function")
throw new TypeError($l);
l = Ne(l) || 0, lt(n) && (h = !!n.leading, g = "maxWait" in n, i = g ? Rl(Ne(n.maxWait) || 0, l) : i, P = "trailing" in n ? !!n.trailing : P);
function I(S) {
var z = o, B = t;
return o = t = void 0, f = S, a = e.apply(B, z), a;
}
function _(S) {
return f = S, r = setTimeout(D, l), h ? I(S) : a;
}
function A(S) {
var z = S - u, B = S - f, Y = l - z;
return g ? Al(Y, i - B) : Y;
}
function k(S) {
var z = S - u, B = S - f;
return u === void 0 || z >= l || z < 0 || g && B >= i;
}
function D() {
var S = ht();
if (k(S))
return j(S);
r = setTimeout(D, A(S));
}
function j(S) {
return r = void 0, P && o ? I(S) : (o = t = void 0, a);
}
function X() {
r !== void 0 && clearTimeout(r), f = 0, o = u = t = r = void 0;
}
function N() {
return r === void 0 ? a : j(ht());
}
function ee() {
var S = ht(), z = k(S);
if (o = arguments, t = this, u = S, z) {
if (r === void 0)
return _(u);
if (g)
return clearTimeout(r), r = setTimeout(D, l), I(u);
}
return r === void 0 && (r = setTimeout(D, l)), a;
}
return ee.cancel = X, ee.flush = N, ee;
}
var Nl = "Expected a function";
function wn(e, l, n) {
var o = !0, t = !0;
if (typeof e != "function")
throw new TypeError(Nl);
return lt(n) && (o = "leading" in n ? !!n.leading : o, t = "trailing" in n ? !!n.trailing : t), yn(e, l, {
leading: o,
maxWait: l,
trailing: t
});
}
var Wl = Object.defineProperty, Dl = Object.defineProperties, Hl = Object.getOwnPropertyDescriptors, Gt = Object.getOwnPropertySymbols, Bl = Object.prototype.hasOwnProperty, ql = Object.prototype.propertyIsEnumerable, Qt = (e, l, n) => l in e ? Wl(e, l, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[l] = n, ot = (e, l) => {
for (var n in l || (l = {}))
Bl.call(l, n) && Qt(e, n, l[n]);
if (Gt)
for (var n of Gt(l))
ql.call(l, n) && Qt(e, n, l[n]);
return e;
}, xn = (e, l) => Dl(e, Hl(l));
const jl = ["onPointerdown"], Ul = {
name: "ScrollbarThumb"
};
function Vl(e, { expose: l }) {
const n = e;
Yn((z) => ({
"1fb98f78": Q(o)
}));
const o = Z(() => {
var z;
return `${(z = n.thumbWidth) != null ? z : 12}px`;
});
let t = null, i = be(null);
const a = { pageX: 0, pageY: 0, scrollPos: 0 };
let r = null;
const u = () => {
t = setTimeout(() => {
i.value && i.value.classList.remove("scrollbar__thumbPlaceholder--scrolling"), t = null;
}, n.autoHideDelay);
}, f = () => {
t !== null && clearTimeout(t);
};
tt(f);
const h = wn((z) => {
z.stopPropagation(), z.preventDefault();
const B = n.type === "horizontal" ? "pageX" : "pageY", Y = (z[B] - a[B]) / n.scrollInfo.wrapperMainSize * n.scrollInfo.contentMainSize;
n.wrapperEl.scrollTo({ [n.type === "horizontal" ? "left" : "top"]: a.scrollPos + Y, behavior: "auto" });
}, 16), g = () => {
u(), i.value.removeEventListener("pointermove", h), i.value.removeEventListener("pointerup", g), i.value.removeEventListener("pointercancel", g), i.value.removeEventListener("mousewheel", g), document.removeEventListener("mousewheel", g), typeof r == "number" && i.value.releasePointerCapture(r), r = null;
}, P = (z) => {
z.ctrlKey || z.button !== 0 || (f(), a.pageX = z.pageX, a.pageY = z.pageY, a.scrollPos = n.wrapperEl[n.type === "horizontal" ? "scrollLeft" : "scrollTop"], r = z == null ? void 0 : z.pointerId, i.value.setPointerCapture(r), i.value.addEventListener("pointermove", h), i.value.addEventListener("pointerup", g), i.value.addEventListener("pointercancel", g), i.value.addEventListener("mousewheel", g, { passive: !1 }), document.addEventListener("mousewheel", g, { passive: !1 }), i.value.classList.add("scrollbar__thumbPlaceholder--scrolling"));
};
l({
autoHideAfterScroll: () => {
f(), i.value && i.value.classList.add("scrollbar__thumbPlaceholder--scrolling"), u();
}
});
let _ = be(!1), A = be(!1), k = be(null), D = null, j = null, X = Z(() => n.fixedThumb && !A.value);
const N = ([z]) => A.value = z.isIntersecting, ee = ([z]) => _.value = z.isIntersecting, S = () => {
D && (D.disconnect(), D = null), j && (j.disconnect(), j = null);
};
return le(() => [n.fixedThumb, n.wrapperEl], () => {
if (!n.fixedThumb || !n.wrapperEl)
return S();
S(), j = new IntersectionObserver(ee, { threshold: [0, 0.5] }), j.observe(n.wrapperEl), D = new IntersectionObserver(N), D.observe(k.value);
}), tt(S), (z, B) => (c(), v(H, null, [
me(y("div", {
class: E([
"scrollbar__thumbPlaceholder",
`scrollbar__thumbPlaceholder--${e.type}`,
{
"scrollbar__thumbPlaceholder--autoHide": e.autoHide,
"scrollbar__thumbPlaceholder--autoExpand": e.autoExpand
}
]),
style: U({
width: e.type === "horizontal" ? `${e.scrollInfo.thumbSize}px` : "",
height: e.type === "vertical" ? `${e.scrollInfo.thumbSize}px` : "",
position: X.value ? "fixed" : "absolute",
[e.type === "vertical" ? "top" : "left"]: X.value ? `${e.scrollInfo.boundaryDistance + 3}px` : "3px"
}),
ref: (Y, ne) => {
ne.thumbEl = Y, i.value = Y;
},
onPointerdown: pe(P, ["stop"])
}, [
B[0] || (qt(-1), B[0] = y("div", {
class: E(["scrollbar__thumb", `scrollbar__thumb--${e.type}`])
}, null, 2), qt(1), B[0])
], 46, jl), [
[gt, !!e.scrollInfo.thumbSize && (e.fixedThumb ? _.value : !0)]
]),
n.fixedThumb ? me((c(), v("div", {
key: 0,
ref: (Y, ne) => {
ne.shepherdEl = Y, k.value = Y;
},
class: E(["scrollbar__shepherd", `scrollbar__shepherd--${e.type}`])
}, null, 2)), [
[gt, !!e.scrollInfo.thumbSize]
]) : T("", !0)
], 64));
}
const Gl = /* @__PURE__ */ xe(xn(ot({}, Ul), {
props: {
type: null,
autoExpand: null,
autoHide: null,
autoHideDelay: null,
fixedThumb: null,
scrollInfo: null,
thumbWidth: null,
wrapperEl: null
},
setup: Vl
})), Ql = {
wait: 333,
type: "debounce"
};
function Kt(...e) {
const l = "value" in (e == null ? void 0 : e[0]);
let n;
l ? n = e == null ? void 0 : e[1] : n = e == null ? void 0 : e[0];
const { wait: o, type: t, callback: i } = ot(ot({}, Ql), n), a = l ? e[0] : be(null), r = Zn({ left: 0, top: 0, right: 0, bottom: 0, width: 0, height: 0, x: 0, y: 0 }), u = () => {
const P = a.value.getBoundingClientRect();
r.left = P.left, r.top = P.top, r.right = P.right, r.bottom = P.bottom, r.width = P.width, r.height = P.height, r.x = P.x, r.y = P.y, i == null || i();
};
let f = null, h = null;
const g = () => {
f && window.removeEventListener("resize", f), h && (h.disconnect(), h = null);
};
return el(() => {
a.value && (g(), f = u, t === "throttle" && o >= 4 ? f = wn(f, o) : t === "debounce" && o >= 4 && (f = yn(f, o)), window.addEventListener("resize", f), h = new ResizeObserver(f), h.observe(a.value));
}), tt(g), l ? r : [a, r];
}
const Kl = {
name: "CustomScrollbar",
inheritAttrs: !1
};
function Xl(e, { expose: l, emit: n }) {
const o = e, t = {
horizontal: { el: null, instance: null },
vertical: { el: null, instance: null }
}, i = (N, ee) => {
t[ee].instance || (t[ee].instance = N);
};
let a = be(null), r = be(null);
Ee(() => {
var N;
const ee = Array.from((N = a.value.parentElement) == null ? void 0 : N.childNodes);
for (const S in t)
t[S].el = ee.find((z) => {
var B;
return (B = z == null ? void 0 : z.classList) == null ? void 0 : B.contains(`scrollbar__thumbPlaceholder--${S}`);
});
});
const u = Kt(a, { wait: o.throttleWait, type: o.throttleType, callback: P }), f = Kt(r, { wait: o.throttleWait, type: o.throttleType, callback: P });
let h = be(0), g = be(0);
function P() {
h.value = Math.max(a.value.scrollHeight - u.height | 0, 0), g.value = Math.max(a.value.scrollWidth - u.width | 0, 0);
}
let I = Z(() => ({
thumbSize: g.value ? Ke(u.width / a.value.scrollWidth * u.width, o.thumbMinSize > u.width ? 48 : o.thumbMinSize, o.thumbMaxSize) : 0,
contentMainSize: f.width,
wrapperMainSize: u.width,
boundaryDistance: Math.abs(u.left)
})), _ = Z(() => ({
thumbSize: h.value ? Ke(u.height / a.value.scrollHeight * u.height, o.thumbMinSize > u.height ? 48 : o.thumbMinSize, o.thumbMaxSize) : 0,
contentMainSize: f.height,
wrapperMainSize: u.height,
boundaryDistance: Math.abs(u.top)
})), A = Z(() => u.height - _.value.thumbSize - 5), k = Z(() => u.width - I.value.thumbSize - 5);
const D = () => {
g.value && (t.horizontal.el.style.transform = `translate3d(${a.value.scrollLeft / g.value * k.value}px, 0, 0)`, t.horizontal.instance.autoHideAfterScroll()), h.value && (t.vertical.el.style.transform = `translate3d(0, ${a.value.scrollTop / h.value * A.value}px, 0)`, t.vertical.instance.autoHideAfterScroll());
};
le(() => [g.value, h.value], D);
const j = (N) => {
N.stopPropagation();
const ee = a.value.scrollLeft, S = a.value.scrollTop, z = Ke(ee + ((N == null ? void 0 : N.deltaX) || 0), 0, g.value) | 0, B = Ke(S + ((N == null ? void 0 : N.deltaY) || 0), 0, h.value) | 0;
a.value.scrollLeft = z, a.value.scrollTop = B, g.value && (t.horizontal.el.style.transform = `translate3d(${z / g.value * k.value}px, 0, 0)`, t.horizontal.instance.autoHideAfterScroll()), h.value && (t.vertical.el.style.transform = `translate3d(0, ${B / h.value * A.value}px, 0)`, t.vertical.instance.autoHideAfterScroll()), n("scroll", { target: a.value, scrollLeft: z, scrollTop: B });
}, X = (N) => {
o.simulateScroll ? j(N) : D();
};
return le(u, () => n("wrapperResize", u)), le(f, () => n("contentResize", f)), l({
scrollEl: a
}), (N, ee) => (c(), v("div", {
class: E(["scrollbar__wrapper", e.wrapperClass]),
style: U(e.wrapperStyle)
}, [
y("div", Jn({
ref: (S, z) => {
z.wrapperEl = S, a.value = S;
},
class: "scrollbar__scroller"
}, N.$attrs, {
onWheel: X,
onScroll: X
}), [
y("div", {
ref: (S, z) => {
z.contentEl = S, r.value = S;
},
class: E(["scrollbar__content", e.contentClass, { "scrollbar__content--fixedThumb": e.fixedThumb, [`scrollbar__content--${e.direction}`]: e.direction }]),
style: U(e.contentStyle)
}, [
oe(N.$slots, "default")
], 6)
], 16),
(c(), v(H, null, ue(t, (S, z) => te(Gl, {
ref: (B) => i(B, z),
key: z,
autoExpand: e.autoExpand,
autoHide: e.autoHide,
autoHideDelay: e.autoHideDelay,
fixedThumb: z === e.direction ? !1 : e.fixedThumb,
type: z,
scrollInfo: z === "vertical" ? _.value : I.value,
thumbWidth: e.thumbWidth,
wrapperEl: a.value
}, null, 8, ["autoExpand", "autoHide", "autoHideDelay", "fixedThumb", "type", "scrollInfo", "thumbWidth", "wrapperEl"])), 64))
], 6));
}
const Xt = /* @__PURE__ */ xe(xn(ot({}, Kl), {
props: {
wrapperClass: null,
wrapperStyle: null,
contentClass: null,
contentStyle: null,
direction: { default: "vertical" },
thumbMinSize: { default: 48 },
thumbMaxSize: { default: 1 / 0 },
thumbWidth: { default: 12 },
autoHide: { default: !0 },
autoHideDelay: { default: 900 },
autoExpand: { default: !0 },
fixedThumb: null,
throttleType: { default: "debounce" },
throttleWait: { default: 333 },
simulateScroll: null
},
emits: ["wrapperResize", "contentResize", "scroll"],
setup: Xl
})), Yt = {
__name: "splitpanes",
props: {
horizontal: { type: Boolean, default: !1 },
pushOtherPanes: { type: Boolean, default: !0 },
maximizePanes: { type: Boolean, default: !0 },
// Maximize pane on splitter double click/tap.
rtl: { type: Boolean, default: !1 },
// Right to left direction.
firstSplitter: { type: Boolean, default: !1 }
},
emits: [
"ready",
"resize",
"resized",
"pane-click",
"pane-maximize",
"pane-add",
"pane-remove",
"splitter-click",
"splitter-dblclick"
],
setup(e, { emit: l }) {
const n = l, o = e, t = pn(), i = q([]), a = Z(() => i.value.reduce((d, w) => (d[~~w.id] = w) && d, {})), r = Z(() => i.value.length), u = q(null), f = q(!1), h = q({
mouseDown: !1,
dragging: !1,
activeSplitter: null,
cursorOffset: 0
// Cursor offset within the splitter.
}), g = q({
// Used to detect double click on touch devices.
splitter: null,
timeoutId: null
}), P = Z(() => ({
[`splitpanes splitpanes--${o.horizontal ? "horizontal" : "vertical"}`]: !0,
"splitpanes--dragging": h.value.dragging
})), I = () => {
document.addEventListener("mousemove", k, { passive: !1 }), document.addEventListener("mouseup", D), "ontouchstart" in window && (document.addEventListener("touchmove", k, { passive: !1 }), document.addEventListener("touchend", D));
}, _ = () => {
document.removeEventListener("mousemove", k, { passive: !1 }), document.removeEventListener("mouseup", D), "ontouchstart" in window && (document.removeEventListener("touchmove", k, { passive: !1 }), document.removeEventListener("touchend", D));
}, A = (d, w) => {
const L = d.target.closest(".splitpanes__splitter");
if (L) {
const { left: x, top: C } = L.getBoundingClientRect(), { clientX: M, clientY: W } = "ontouchstart" in window && d.touches ? d.touches[0] : d;
h.value.cursorOffset = o.horizontal ? W - C : M - x;
}
I(), h.value.mouseDown = !0, h.value.activeSplitter = w;
}, k = (d) => {
h.value.mouseDown && (d.preventDefault(), h.value.dragging = !0, requestAnimationFrame(() => {
z(ee(d)), ae("resize", { event: d }, !0);
}));
}, D = (d) => {
h.value.dragging && ae("resized", { event: d }, !0), h.value.mouseDown = !1, h.value.activeSplitter = null, setTimeout(() => {
h.value.dragging = !1, _();
}, 100);
}, j = (d, w) => {
"ontouchstart" in window && (d.preventDefault(), g.value.splitter === w ? (clearTimeout(g.value.timeoutId), g.value.timeoutId = null, X(d, w), g.value.splitter = null) : (g.value.splitter = w, g.value.timeoutId = setTimeout(() => g.value.splitter = null, 500))), h.value.dragging || ae("splitter-click", { event: d, index: w }, !0);
}, X = (d, w) => {
if (ae("splitter-dblclick", { event: d, index: w }, !0), o.maximizePanes) {
let L = 0;
i.value = i.value.map((x, C) => (x.size = C === w ? x.max : x.min, C !== w && (L += x.min), x)), i.value[w].size -= L, ae("pane-maximize", { event: d, index: w, pane: i.value[w] }), ae("resized", { event: d, index: w }, !0);
}
}, N = (d, w) => {
ae("pane-click", {
event: d,
index: a.value[w].index,
pane: a.value[w]
});
}, ee = (d) => {
const w = u.value.getBoundingClientRect(), { clientX: L, clientY: x } = "ontouchstart" in window && d.touches ? d.touches[0] : d;
return {
x: L - (o.horizontal ? 0 : h.value.cursorOffset) - w.left,
y: x - (o.horizontal ? h.value.cursorOffset : 0) - w.top
};
}, S = (d) => {
d = d[o.horizontal ? "y" : "x"];
const w = u.value[o.horizontal ? "clientHeight" : "clientWidth"];
return o.rtl && !o.horizontal && (d = w - d), d * 100 / w;
}, z = (d) => {
const w = h.value.activeSplitter;
let L = {
prevPanesSize: Y(w),
nextPanesSize: ne(w),
prevReachedMinPanes: 0,
nextReachedMinPanes: 0
};
const x = 0 + (o.pushOtherPanes ? 0 : L.prevPanesSize), C = 100 - (o.pushOtherPanes ? 0 : L.nextPanesSize), M = Math.max(Math.min(S(d), C), x);
let W = [w, w + 1], ie = i.value[W[0]] || null, O = i.value[W[1]] || null;
const ke = ie.max < 100 && M >= ie.max + L.prevPanesSize, Te = O.max < 100 && M <= 100 - (O.max + ne(w + 1));
if (ke || Te) {
ke ? (ie.size = ie.max, O.size = Math.max(100 - ie.max - L.prevPanesSize - L.nextPanesSize, 0)) : (ie.size = Math.max(100 - O.max - L.prevPanesSize - ne(w + 1), 0), O.size = O.max);
return;
}
if (o.pushOtherPanes) {
const ge = B(L, M);
if (!ge) return;
({ sums: L, panesToResize: W } = ge), ie = i.value[W[0]] || null, O = i.value[W[1]] || null;
}
ie !== null && (ie.size = Math.min(Math.max(M - L.prevPanesSize - L.prevReachedMinPanes, ie.min), ie.max)), O !== null && (O.size = Math.min(Math.max(100 - M - L.nextPanesSize - L.nextReachedMinPanes, O.min), O.max));
}, B = (d, w) => {
const L = h.value.activeSplitter, x = [L, L + 1];
return w < d.prevPanesSize + i.value[x[0]].min && (x[0] = ut(L).index, d.prevReachedMinPanes = 0, x[0] < L && i.value.forEach((C, M) => {
M > x[0] && M <= L && (C.size = C.min, d.prevReachedMinPanes += C.min);
}), d.prevPanesSize = Y(x[0]), x[0] === void 0) ? (d.prevReachedMinPanes = 0, i.value[0].size = i.value[0].min, i.value.forEach((C, M) => {
M > 0 && M <= L && (C.size = C.min, d.prevReachedMinPanes += C.min);
}), i.value[x[1]].size = 100 - d.prevReachedMinPanes - i.value[0].min - d.prevPanesSize - d.nextPanesSize, null) : w > 100 - d.nextPanesSize - i.value[x[1]].min && (x[1] = re(L).index, d.nextReachedMinPanes = 0, x[1] > L + 1 && i.value.forEach((C, M) => {
M > L && M < x[1] && (C.size = C.min, d.nextReachedMinPanes += C.min);
}), d.nextPanesSize = ne(x[1] - 1), x[1] === void 0) ? (d.nextReachedMinPanes = 0, i.value.forEach((C, M) => {
M < r.value - 1 && M >= L + 1 && (C.size = C.min, d.nextReachedMinPanes += C.min);
}), i.value[x[0]].size = 100 - d.prevPanesSize - ne(x[0] - 1), null) : { sums: d, panesToResize: x };
}, Y = (d) => i.value.reduce((w, L, x) => w + (x < d ? L.size : 0), 0), ne = (d) => i.value.reduce((w, L, x) => w + (x > d + 1 ? L.size : 0), 0), ut = (d) => [...i.value].reverse().find((w) => w.index < d && w.size > w.min) || {}, re = (d) => i.value.find((w) => w.index > d + 1 && w.size > w.min) || {}, qe = () => {
var d;
const w = Array.from(((d = u.value) == null ? void 0 : d.children) || []);
for (const L of w) {
const x = L.classList.contains("splitpanes__pane"), C = L.classList.contains("splitpanes__splitter");
!x && !C && (L.remove(), console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."));
}
}, K = (d, w, L = !1) => {
const x = d - 1, C = document.createElement("div");
C.classList.add("splitpanes__splitter"), L || (C.onmousedown = (M) => A(M, x), typeof window < "u" && "ontouchstart" in window && (C.ontouchstart = (M) => A(M, x)), C.onclick = (M) => j(M, x + 1)), C.ondblclick = (M) => X(M, x + 1), w.parentNode.insertBefore(C, w);
}, de = (d) => {
d.onmousedown = void 0, d.onclick = void 0, d.ondblclick = void 0, d.remove();
}, ye = () => {
var d;
const w = Array.from(((d = u.value) == null ? void 0 : d.children) || []);
for (const x of w)
x.className.includes("splitpanes__splitter") && de(x);
let L = 0;
for (const x of w)
x.className.includes("splitpanes__pane") && (!L && o.firstSplitter ? K(L, x, !0) : L && K(L, x), L++);
}, Oe = ({ uid: d, ...w }) => {
const L = a.value[d];
for (const [x, C] of Object.entries(w)) L[x] = C;
}, je = (d) => {
var w;
let L = -1;
Array.from(((w = u.value) == null ? void 0 : w.children) || []).some((x) => (x.className.includes("splitpanes__pane") && L++, x.isSameNode(d.el))), i.value.splice(L, 0, { ...d, index: L }), i.value.forEach((x, C) => x.index = C), f.value && _e(() => {
ye(), ce({ addedPane: i.value[L] }), ae("pane-add", { pane: i.value[L] });
});
}, Ue = (d) => {
const w = i.value.findIndex((x) => x.id === d);
i.value[w].el = null;
const L = i.value.splice(w, 1)[0];
i.value.forEach((x, C) => x.index = C), _e(() => {
ye(), ae("pane-remove", { pane: L }), ce({ removedPane: { ...L } });
});
}, ce = (d = {}) => {
!d.addedPane && !d.removedPane ? Me() : i.value.some((w) => w.givenSize !== null || w.min || w.max < 100) ? Ve(d) : ve(), f.value && ae("resized");
}, ve = () => {
const d = 100 / r.value;
let w = 0;
const L = [], x = [];
for (const C of i.value)
C.size = Math.max(Math.min(d, C.max), C.min), w -= C.size, C.size >= C.max && L.push(C.id), C.size <= C.min && x.push(C.id);
w > 0.1 && Pe(w, L, x);
}, Me = () => {
let d = 100;
const w = [], L = [];
let x = 0;
for (const M of i.value)
d -= M.size, M.givenSize !== null && x++, M.size >= M.max && w.push(M.id), M.size <= M.min && L.push(M.id);
let C = 100;
if (d > 0.1) {
for (const M of i.value)
M.givenSize === null && (M.size = Math.max(Math.min(d / (r.value - x), M.max), M.min)), C -= M.size;
C > 0.1 && Pe(C, w, L);
}
}, Ve = ({ addedPane: d, removedPane: w } = {}) => {
let L = 100 / r.value, x = 0;
const C = [], M = [];
((d == null ? void 0 : d.givenSize) ?? null) !== null && (L = (100 - d.givenSize) / (r.value - 1));
for (const W of i.value)
x -= W.size, W.size >= W.max && C.push(W.id), W.size <= W.min && M.push(W.id);
if (!(Math.abs(x) < 0.1)) {
for (const W of i.value)
(d == null ? void 0 : d.givenSize) !== null && (d == null ? void 0 : d.id) === W.id || (W.size = Math.max(Math.min(L, W.max), W.min)), x -= W.size, W.size >= W.max && C.push(W.id), W.size <= W.min && M.push(W.id);
x > 0.1 && Pe(x, C, M);
}
}, Pe = (d, w, L) => {
let x;
d > 0 ? x = d / (r.value - w.length) : x = d / (r.value - L.length), i.value.forEach((C, M) => {
if (d > 0 && !w.includes(C.id)) {
const W = Math.max(Math.min(C.size + x, C.max), C.min), ie = W - C.size;
d -= ie, C.size = W;
} else if (!L.includes(C.id)) {
const W = Math.max(Math.min(C.size + x, C.max), C.min), ie = W - C.size;
d -= ie, C.size = W;
}
}), Math.abs(d) > 0.1 && _e(() => {
f.value && console.warn("Splitpanes: Could not resize panes correctly due to their constraints.");
});
}, ae = (d, w = void 0, L = !1) => {
const x = (w == null ? void 0 : w.index) ?? h.value.activeSplitter ?? null;
n(d, {
...w,
...x !== null && { index: x },
...L && x !== null && {
prevPane: i.value[x - (o.firstSplitter ? 1 : 0)],
nextPane: i.value[x + (o.firstSplitter ? 0 : 1)]
},
panes: i.value.map((C) => ({ min: C.min, max: C.max, size: C.size }))
});
};
le(() => o.firstSplitter, () => ye()), Ee(() => {
qe(), ye(), ce(), ae("ready"), f.value = !0;
}), Pt(() => f.value = !1);
const Rt = () => {
var d;
return bt(
"div",
{ ref: u, class: P.value },
(d = t.default) == null ? void 0 : d.call(t)
);
};
return Se("panes", i), Se("indexedPanes", a), Se("horizontal", Z(() => o.horizontal)), Se("requestUpdate", Oe), Se("onPaneAdd", je), Se("onPaneRemove", Ue), Se("onPaneClick", N), (d, w) => (c(), he(tl(Rt)));
}
}, pt = {
__name: "pane",
props: {
size: { type: [Number, String] },
minSize: { type: [Number, String], default: 0 },
maxSize: { type: [Number, String], default: 100 }
},
setup(e) {
var l;
const n = e, o = Fe("requestUpdate"), t = Fe("onPaneAdd"), i = Fe("horizontal"), a = Fe("onPaneRemove"), r = Fe("onPaneClick"), u = (l = Mt()) == null ? void 0 : l.uid, f = Fe("indexedPanes"), h = Z(() => f.value[u]), g = q(null), P = Z(() => {
const k = isNaN(n.size) || n.size === void 0 ? 0 : parseFloat(n.size);
return Math.max(Math.min(k, _.value), I.value);
}), I = Z(() => {
const k = parseFloat(n.minSize);
return isNaN(k) ? 0 : k;
}), _ = Z(() => {
const k = parseFloat(n.maxSize);
return isNaN(k) ? 100 : k;
}), A = Z(() => {
var k;
return `${i.value ? "height" : "width"}: ${(k = h.value) == null ? void 0 : k.size}%`;
});
return le(() => P.value, (k) => o({ uid: u, size: k })), le(() => I.value, (k) => o({ uid: u, min: k })), le(() => _.value, (k) => o({ uid: u, max: k })), Ee(() => {
t({
id: u,
el: g.value,
min: I.value,
max: _.value,
// The given size (useful to know the user intention).
givenSize: n.size === void 0 ? null : P.value,
size: P.value
// The computed current size at any time.
});
}), Pt(() => a(u)), (k, D) => (c(), v("div", {
ref_key: "paneEl",
ref: g,
class: "splitpanes__pane",
onClick: D[0] || (D[0] = (j) => Q(r)(j, k._.uid)),
style: U(A.value)
}, [
oe(k.$slots, "default")
], 4));
}
}, We = /^[a-z0-9]+(-[a-z0-9]+)*$/, rt = (e, l, n, o = "") => {
const t = e.split(":");
if (e.slice(0, 1) === "@") {
if (t.length < 2 || t.length > 3)
return null;
o = t.shift().slice(1);
}
if (t.length > 3 || !t.length)
return null;
if (t.length > 1) {
const r = t.pop(), u = t.pop(), f = {
// Allow provider without '@': "provider:prefix:name"
provider: t.length > 0 ? t[0] : o,
prefix: u,
name: r
};
return l && !Je(f) ? null : f;
}
const i = t[0], a = i.split("-");
if (a.length > 1) {
const r = {
provider: o,
prefix: a.shift(),
name: a.join("-")
};
return l && !Je(r) ? null : r;
}
if (n && o === "") {
const r = {
provider: o,
prefix: "",
name: i
};
return l && !Je(r, n) ? null : r;
}
return null;
}, Je = (e, l) => e ? !!((e.provider === "" || e.provider.match(We)) && (l && e.prefix === "" || e.prefix.match(We)) && e.name.match(We)) : !1, kn = Object.freeze(
{
left: 0,
top: 0,
width: 16,
height: 16
}
), it = Object.freeze({
rotate: 0,
vFlip: !1,
hFlip: !1
}), st = Object.freeze({
...kn,
...it
}), yt = Object.freeze({
...st,
body: "",
hidden: !1
});
function Yl(e, l) {
const n = {};
!e.hFlip != !l.hFlip && (n.hFlip = !0), !e.vFlip != !l.vFlip && (n.vFlip = !0);
const o = ((e.rotate || 0) + (l.rotate || 0)) % 4;
return o && (n.rotate = o), n;
}
function Jt(e, l) {
const n = Yl(e, l);
for (const o in yt)
o in it ? o in e && !(o in n) && (n[o] = it[o]) : o in l ? n[o] = l[o] : o in e && (n[o] = e[o]);
return n;
}
function Jl(e, l) {
const n = e.icons, o = e.aliases || /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
function i(a) {
if (n[a])
return t[a] = [];
if (!(a in t)) {
t[a] = null;
const r = o[a] && o[a].parent, u = r && i(r);
u && (t[a] = [r].concat(u));
}
return t[a];
}
return Object.keys(n).concat(Object.keys(o)).forEach(i), t;
}
function Zl(e, l, n) {
const o = e.icons, t = e.aliases || /* @__PURE__ */ Object.create(null);
let i = {};
function a(r) {
i = Jt(
o[r] || t[r],
i
);
}
return a(l), n.forEach(a), Jt(e, i);
}
function Cn(e, l) {
const n = [];
if (typeof e != "object" || typeof e.icons != "object")
return n;
e.not_found instanceof Array && e.not_found.forEach((t) => {
l(t, null), n.push(t);
});
const o = Jl(e);
for (const t in o) {
const i = o[t];
i && (l(t, Zl(e, t, i)), n.push(t));
}
return n;
}
const eo = {
provider: "",
aliases: {},
not_found: {},
...kn
};
function vt(e, l) {
for (const n in l)
if (n in e && typeof e[n] != typeof l[n])
return !1;
return !0;
}
function Sn(e) {
if (typeof e != "object" || e === null)
return null;
const l = e;
if (typeof l.prefix != "string" || !e.icons || typeof e.icons != "object" || !vt(e, eo))
return null;
const n = l.icons;
for (const t in n) {
const i = n[t];
if (!t.match(We) || typeof i.body != "string" || !vt(
i,
yt
))
return null;
}
const o = l.aliases || /* @__PURE__ */ Object.create(null);
for (const t in o) {
const i = o[t], a = i.parent;
if (!t.match(We) || typeof a != "string" || !n[a] && !o[a] || !vt(
i,
yt
))
return null;
}
return l;
}
const Zt = /* @__PURE__ */ Object.create(null);
function to(e, l) {
return {
provider: e,
prefix: l,
icons: /* @__PURE__ */ Object.create(null),
missing: /* @__PURE__ */ new Set()
};
}
function Le(e, l) {
const n = Zt[e] || (Zt[e] = /* @__PURE__ */ Object.create(null));
return n[l] || (n[l] = to(e, l));
}
function Tt(e, l) {
return Sn(l) ? Cn(l, (n, o) => {
o ? e.icons[n] = o : e.missing.add(n);
}) : [];
}
function no(e, l, n) {
try {
if (typeof n.body == "string")
return e.icons[l] = { ...n }, !0;
} catch {
}
return !1;
}
let De = !1;
function zn(e) {
return typeof e == "boolean" && (De = e), De;
}
function lo(e) {
const l = typeof e == "string" ? rt(e, !0, De) : e;
if (l) {
const n = Le(l.provider, l.prefix), o = l.name;
return n.icons[o] || (n.missing.has(o) ? null : void 0);
}
}
function oo(e, l) {
const n = rt(e, !0, De);
if (!n)
return !1;
const o = Le(n.provider, n.prefix);
return no(o, n.name, l);
}
function io(e, l) {
if (typeof e != "object")
return !1;
if (typeof l != "string" && (l = e.provider || ""), De && !l && !e.prefix) {
let t = !1;
return Sn(e) && (e.prefix = "", Cn(e, (i, a) => {
a && oo(i, a) && (t = !0);
})), t;
}
const n = e.prefix;
if (!Je({
provider: l,
prefix: n,
name: "a"
}))
return !1;
const o = Le(l, n);
return !!Tt(o, e);
}
const Ln = Object.freeze({
width: null,
height: null
}), En = Object.freeze({
// Dimensions
...Ln,
// Transformations
...it
}), ro = /(-?[0-9.]*[0-9]+[0-9.]*)/g, so = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function en(e, l, n) {
if (l === 1)
return e;
if (n = n || 100, typeof e == "number")
return Math.ceil(e * l * n) / n;
if (typeof e != "string")
return e;
const o = e.split(ro);
if (o === null || !o.length)
return e;
const t = [];
let i = o.shift(), a = so.test(i);
for (; ; ) {
if (a) {
const r = parseFloat(i);
isNaN(r) ? t.push(i) : t.push(Math.ceil(r * l * n) / n);
} else
t.push(i);
if (i = o.shift(), i === void 0)
return t.join("");
a = !a;
}
}
function ao(e, l = "defs") {
let n = "";
const o = e.indexOf("<" + l);
for (; o >= 0; ) {
const t = e.indexOf(">", o), i = e.indexOf("</" + l);
if (t === -1 || i === -1)
break;
const a = e.indexOf(">", i);
if (a === -1)
break;
n += e.slice(t + 1, i).trim(), e = e.slice(0, o).trim() + e.slice(a + 1);
}
return {
defs: n,
content: e
};
}
function uo(e, l) {
return e ? "<defs>" + e + "</defs>" + l : l;
}
function co(e, l, n) {
const o = ao(e);
return uo(o.defs, l + o.content + n);
}
const fo = (e) => e === "unset" || e === "undefined" || e === "none";
function ho(e, l) {
const n = {
...st,
...e
}, o = {
...En,
...l
}, t = {
left: n.left,
top: n.top,
width: n.width,
height: n.height
};
let i = n.body;
[n, o].forEach((A) => {
const k = [], D = A.hFlip, j = A.vFlip;
let X = A.rotate;
D ? j ? X += 2 : (k.push(
"translate(" + (t.width + t.left).toString() + " " + (0 - t.top).toString() + ")"
), k.push("scale(-1 1)"), t.top = t.left = 0) : j && (k.push(
"translate(" + (0 - t.left).toString() + " " + (t.height + t.top).toString() + ")"
), k.push("scale(1 -1)"), t.top = t.left = 0);
let N;
switch (X < 0 && (X -= Math.floor(X / 4) * 4), X = X % 4, X) {
case 1:
N = t.height / 2 + t.top, k.unshift(
"rotate(90 " + N.toString() + " " + N.toString() + ")"
);
break;
case 2:
k.unshift(
"rotate(180 " + (t.width / 2 + t.left).toString() + " " + (t.height / 2 + t.top).toString() + ")"
);
break;
case 3:
N = t.width / 2 + t.left, k.unshift(
"rotate(-90 " + N.toString() + " " + N.toString() + ")"
);
break;
}
X % 2 === 1 && (t.left !== t.top && (N = t.left, t.left = t.top, t.top = N), t.width !== t.height && (N = t.width, t.width = t.height, t.height = N)), k.length && (i = co(
i,
'<g transform="' + k.join(" ") + '">',
"</g>"
));
});
const a = o.width, r = o.height, u = t.width, f = t.height;
let h, g;
a === null ? (g = r === null ? "1em" : r === "auto" ? f : r, h = en(g, u / f)) : (h = a === "auto" ? u : a, g = r === null ? en(h, f / u) : r === "auto" ? f : r);
const P = {}, I = (A, k) => {
fo(k) || (P[A] = k.toString());
};
I("width", h), I("height", g);
const _ = [t.left, t.top, u, f];
return P.viewBox = _.join(" "), {
attributes: P,
viewBox: _,
body: i
};
}
const po = /\sid="(\S+)"/g, vo = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
let mo = 0;
function go(e, l = vo) {
const n = [];
let o;
for (; o = po.exec(e); )
n.push(o[1]);
if (!n.length)
return e;
const t = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
return n.forEach((i) => {
const a = typeof l == "function" ? l(i) : l + (mo++).toString(), r = i.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
e = e.replace(
// Allowed characters before id: [#;"]
// Allowed characters after id: [)"], .[a-z]
new RegExp('([#;"])(' + r + ')([")]|\\.[a-z])', "g"),
"$1" + a + t + "$3"
);
}), e = e.replace(new RegExp(t, "g"), ""), e;
}
const wt = /* @__PURE__ */ Object.create(null);
function bo(e, l) {
wt[e] = l;
}
function xt(e) {
return wt[e] || wt[""];
}
function Ft(e) {
let l;
if (typeof e.resources == "string")
l = [e.resources];
else if (l = e.resources, !(l instanceof Array) || !l.length)
return null;
return {
// API hosts
resources: l,
// Root path
path: e.path || "/",
// URL length limit
maxURL: e.maxURL || 500,
// Timeout before next host is used.
rotate: e.rotate || 750,
// Timeout before failing query.
timeout: e.timeout || 5e3,
// Randomise default API end point.
random: e.random === !0,
// Start index
index: e.index || 0,
// Receive data after time out (used if time out kicks in first, then API module sends data anyway).
dataAfterTimeout: e.dataAfterTimeout !== !1
};
}
const It = /* @__PURE__ */ Object.create(null), Re = [
"https://api.simplesvg.com",
"https://api.unisvg.com"
], Ze = [];
for (; Re.length > 0; )
Re.length === 1 || Math.random() > 0.5 ? Ze.push(Re.shift()) : Ze.push(Re.pop());
It[""] = Ft({
resources: ["https://api.iconify.design"].concat(Ze)
});
function yo(e, l) {
const n = Ft(l);
return n === null ? !1 : (It[e] = n, !0);
}
function _t(e) {
return It[e];
}
const wo = () => {
let e;
try {
if (e = fetch, typeof e == "function")
return e;
} catch {
}
};
let tn = wo();
function xo(e, l) {
const n = _t(e);
if (!n)
return 0;
let o;
if (!n.maxURL)
o = 0;
else {
let t = 0;
n.resources.forEach((a) => {
t = Math.max(t, a.length);
});
const i = l + ".json?icons=";
o = n.maxURL - t - n.path.length - i.length;
}
return o;
}
function ko(e) {
return e === 404;
}
const Co = (e, l, n) => {
const o = [], t = xo(e, l), i = "icons";
let a = {
type: i,
provider: e,
prefix: l,
icons: []
}, r = 0;
return n.forEach((u, f) => {
r += u.length + 1, r >= t && f > 0 && (o.push(a), a = {
type: i,
provider: e,
prefix: l,
icons: []
}, r = u.length), a.icons.push(u);
}), o.push(a), o;
};
function So(e) {
if (typeof e == "string") {
const l = _t(e);
if (l)
return l.path;
}
return "/";
}
const zo = (e, l, n) => {
if (!tn) {
n("abort", 424);
return;
}
let o = So(l.provider);
switch (l.type) {
case "icons": {
const i = l.prefix, r = l.icons.join(","), u = new URLSearchParams({
icons: r
});
o += i + ".json?" + u.toString();
break;
}
case "custom": {
const i = l.uri;
o += i.slice(0, 1) === "/" ? i.slice(1) : i;
break;
}
default:
n("abort", 400);
return;
}
let t = 503;
tn(e + o).then((i) => {
const a = i.status;
if (a !== 200) {
setTimeout(() => {
n(ko(a) ? "abort" : "next", a);
});
return;
}
return t = 501, i.json();
}).then((i) => {
if (typeof i != "object" || i === null) {
setTimeout(() => {
i === 404 ? n("abort", i) : n("next", t);
});
return;
}
setTimeout(() => {
n("success", i);
});
}).catch(() => {
n("next", t);
});
}, Lo = {
prepare: Co,
send: zo
};
function Eo(e) {
const l = {
loaded: [],
missing: [],
pending: []
}, n = /* @__PURE__ */ Object.create(null);
e.sort((t, i) => t.provider !== i.provider ? t.provider.localeCompare(i.provider) : t.prefix !== i.prefix ? t.prefix.localeCompare(i.prefix) : t.name.localeCompare(i.name));
let o = {
provider: "",
prefix: "",
name: ""
};
return e.forEach((t) => {
if (o.name === t.name && o.prefix === t.prefix && o.provider === t.provider)
return;
o = t;
const i = t.provider, a = t.prefix, r = t.name, u = n[i] || (n[i] = /* @__PURE__ */ Object.create(null)), f = u[a] || (u[a] = Le(i, a));
let h;
r in f.icons ? h = l.loaded : a === "" || f.missing.has(r) ? h = l.missing : h = l.pending;
const g = {
provider: i,
prefix: a,
name: r
};
h.push(g);
}), l;
}
function Mn(e, l) {
e.forEach((n) => {
const o = n.loaderCallbacks;
o && (n.loaderCallbacks = o.filter((t) => t.id !== l));
});
}
function Mo(e) {
e.pendingCallbacksFlag || (e.pendingCallbacksFlag = !0, setTimeout(() => {
e.pendingCallbacksFlag = !1;
const l = e.loaderCallbacks ? e.loaderCallbacks.slice(0) : [];
if (!l.length)
return;
let n = !1;
const o = e.provider, t = e.prefix;
l.forEach((i) => {
const a = i.icons, r = a.pending.length;
a.pending = a.pending.filter((u) => {
if (u.prefix !== t)
return !0;
const f = u.name;
if (e.icons[f])
a.loaded.push({
provider: o,
prefix: t,
name: f
});
else if (e.missing.has(f))
a.missing.push({
provider: o,
prefix: t,
name: f
});
else
return n = !0, !0;
return !1;
}), a.pending.length !== r && (n || Mn([e], i.id), i.callback(
a.loaded.slice(0),
a.missing.slice(0),
a.pending.slice(0),
i.abort
));
});
}));
}
let Po = 0;
function To(e, l, n) {
const o = Po++, t = Mn.bind(null, n, o);
if (!l.pending.length)
return t;
const i = {
id: o,
icons: l,
callback: e,
abort: t
};
return n.forEach((a) => {
(a.loaderCallbacks || (a.loaderCallbacks = [])).push(i);
}), t;
}
function Fo(e, l = !0, n = !1) {
const o = [];
return e.forEach((t) => {
const i = typeof t == "string" ? rt(t, l, n) : t;
i && o.push(i);
}), o;
}
var Io = {
resources: [],
index: 0,
timeout: 2e3,
rotate: 750,
random: !1,
dataAfterTimeout: !1
};
function _o(e, l, n, o) {
const t = e.resources.length, i = e.random ? Math.floor(Math.random() * t) : e.index;
let a;
if (e.random) {
let S = e.resources.slice(0);
for (a = []; S.length > 1; ) {
const z = Math.floor(Math.random() * S.length);
a.push(S[z]), S = S.slice(0, z).concat(S.slice(z + 1));
}
a = a.concat(S);
} else
a = e.resources.slice(i).concat(e.resources.slice(0, i));
const r = Date.now();
let u = "pending", f = 0, h, g = null, P = [], I = [];
typeof o == "function" && I.push(o);
function _() {
g && (clearTimeout(g), g = null);
}
function A() {
u === "pending" && (u = "aborted"), _(), P.forEach((S) => {
S.status === "pending" && (S.status = "aborted");
}), P = [];
}
function k(S, z) {
z && (I = []), typeof S == "function" && I.push(S);
}
function D() {
return {
startTime: r,
payload: l,
status: u,
queriesSent: f,
queriesPending: P.length,
subscribe: k,
abort: A
};
}
function j() {
u = "failed", I.forEach((S) => {
S(void 0, h);
});
}
function X() {
P.forEach((S) => {
S.status === "pending" && (S.status = "aborted");
}), P = [];
}
function N(S, z, B) {
const Y = z !== "success";
switch (P = P.filter((ne) => ne !== S), u) {
case "pending":
break;
case "failed":
if (Y || !e.dataAfterTimeout)
return;
break;
default:
return;
}
if (z === "abort") {
h = B, j();
return;
}
if (Y) {
h = B, P.length || (a.length ? ee() : j());
return;
}
if (_(), X(), !e.random) {
const ne = e.resources.indexOf(S.resource);
ne !== -1 && ne !== e.index && (e.index = ne);
}
u = "completed", I.forEach((ne) => {
ne(B);
});
}
function ee() {
if (u !== "pending")
return;
_();
const S = a.shift();
if (S === void 0) {
if (P.length) {
g = setTimeout(() => {
_(), u === "pending" && (X(), j());
}, e.timeout);
return;
}
j();
return;
}
const z = {
status: "pending",
resource: S,
callback: (B, Y) => {
N(z, B, Y);
}
};
P.push(z), f++, g = setTimeout(ee, e.rotate), n(S, l, z.callback);
}
return setTimeout(ee), D;
}
function Pn(e) {
const l = {
...Io,
...e
};
let n = [];
function o() {
n = n.filter((r) => r().status === "pending");
}
function t(r, u, f) {
const h = _o(
l,
r,
u,
(g, P) => {
o(), f && f(g, P);
}
);
return n.push(h), h;
}
function i(r) {
return n.find((u) => r(u)) || null;
}
return {
query: t,
find: i,
setIndex: (r) => {
l.index = r;
},
getIndex: () => l.index,
cleanup: o
};
}
function nn() {
}
const mt = /* @__PURE__ */ Object.create(null);
function Oo(e) {
if (!mt[e]) {
const l = _t(e);
if (!l)
return;
const n = Pn(l), o = {
config: l,
redundancy: n
};
mt[e] = o;
}
return mt[e];
}
function $o(e, l, n) {
let o, t;
if (typeof e == "string") {
const i = xt(e);
if (!i)
return n(void 0, 424), nn;
t = i.send;
const a = Oo(e);
a && (o = a.redundancy);
} else {
const i = Ft(e);
if (i) {
o = Pn(i);
const a = e.resources ? e.resources[0] : "", r = xt(a);
r && (t = r.send);
}
}
return !o || !t ? (n(void 0, 424), nn) : o.query(l, t, n)().abort;
}
const ln = "iconify2", He = "iconify", Tn = He + "-count", on = He + "-version", Fn = 36e5, Ro = 168, Ao = 50;
function kt(e, l) {
try {
return e.getItem(l);
} catch {
}
}
function Ot(e, l, n) {
try {
return e.setItem(l, n), !0;
} catch {
}
}
function rn(e, l) {
try {
e.removeItem(l);
} catch {
}
}
function Ct(e, l) {
return Ot(e, Tn, l.toString());
}
function St(e) {
return parseInt(kt(e, Tn)) || 0;
}
const at = {
local: !0,
session: !0
}, In = {
local: /* @__PURE__ */ new Set(),
session: /* @__PURE__ */ new Set()
};
let $t = !1;
function No(e) {
$t = e;
}
let Xe = typeof window > "u" ? {} : window;
function _n(e) {
const l = e + "Storage";
try {
if (Xe && Xe[l] && typeof Xe[l].length == "number")
return Xe[l];
} catch {
}
at[e] = !1;
}
function On(e, l) {
const n = _n(e);
if (!n)
return;
const o = kt(n, on);
if (o !== ln) {
if (o) {
const r = St(n);
for (let u = 0; u < r; u++)
rn(n, He + u.toString());
}
Ot(n, on, ln), Ct(n, 0);
return;
}
const t = Math.floor(Date.now() / Fn) - Ro, i = (r) => {
const u = He + r.toString(), f = kt(n, u);
if (typeof f == "string") {
try {
const h = JSON.parse(f);
if (typeof h == "object" && typeof h.cached == "number" && h.cached > t && typeof h.provider == "string