@poupe/vue
Version:
Vue component library for Poupe UI framework with theme customization and accessibility support
1,188 lines (1,187 loc) • 28.5 kB
JavaScript
import { defineComponent as ye, ref as R, shallowRef as xe, onMounted as be, watch as ve, onUnmounted as we, h as B, nextTick as Ie } from "vue";
const re = /^[a-z0-9]+(-[a-z0-9]+)*$/, M = (e, o, n, i = "") => {
const t = e.split(":");
if (e.slice(0, 1) === "@") {
if (t.length < 2 || t.length > 3)
return null;
i = t.shift().slice(1);
}
if (t.length > 3 || !t.length)
return null;
if (t.length > 1) {
const l = t.pop(), f = t.pop(), c = {
// Allow provider without '@': "provider:prefix:name"
provider: t.length > 0 ? t[0] : i,
prefix: f,
name: l
};
return o && !E(c) ? null : c;
}
const s = t[0], r = s.split("-");
if (r.length > 1) {
const l = {
provider: i,
prefix: r.shift(),
name: r.join("-")
};
return o && !E(l) ? null : l;
}
if (n && i === "") {
const l = {
provider: i,
prefix: "",
name: s
};
return o && !E(l, n) ? null : l;
}
return null;
}, E = (e, o) => e ? !!// Check prefix: cannot be empty, unless allowSimpleName is enabled
// Check name: cannot be empty
((o && e.prefix === "" || e.prefix) && e.name) : !1, ce = Object.freeze(
{
left: 0,
top: 0,
width: 16,
height: 16
}
), L = Object.freeze({
rotate: 0,
vFlip: !1,
hFlip: !1
}), D = Object.freeze({
...ce,
...L
}), U = Object.freeze({
...D,
body: "",
hidden: !1
});
function Se(e, o) {
const n = {};
!e.hFlip != !o.hFlip && (n.hFlip = !0), !e.vFlip != !o.vFlip && (n.vFlip = !0);
const i = ((e.rotate || 0) + (o.rotate || 0)) % 4;
return i && (n.rotate = i), n;
}
function K(e, o) {
const n = Se(e, o);
for (const i in U)
i in L ? i in e && !(i in n) && (n[i] = L[i]) : i in o ? n[i] = o[i] : i in e && (n[i] = e[i]);
return n;
}
function ke(e, o) {
const n = e.icons, i = e.aliases || /* @__PURE__ */ Object.create(null), t = /* @__PURE__ */ Object.create(null);
function s(r) {
if (n[r])
return t[r] = [];
if (!(r in t)) {
t[r] = null;
const l = i[r] && i[r].parent, f = l && s(l);
f && (t[r] = [l].concat(f));
}
return t[r];
}
return Object.keys(n).concat(Object.keys(i)).forEach(s), t;
}
function Te(e, o, n) {
const i = e.icons, t = e.aliases || /* @__PURE__ */ Object.create(null);
let s = {};
function r(l) {
s = K(
i[l] || t[l],
s
);
}
return r(o), n.forEach(r), K(e, s);
}
function le(e, o) {
const n = [];
if (typeof e != "object" || typeof e.icons != "object")
return n;
e.not_found instanceof Array && e.not_found.forEach((t) => {
o(t, null), n.push(t);
});
const i = ke(e);
for (const t in i) {
const s = i[t];
s && (o(t, Te(e, t, s)), n.push(t));
}
return n;
}
const Ce = {
provider: "",
aliases: {},
not_found: {},
...ce
};
function z(e, o) {
for (const n in o)
if (n in e && typeof e[n] != typeof o[n])
return !1;
return !0;
}
function ue(e) {
if (typeof e != "object" || e === null)
return null;
const o = e;
if (typeof o.prefix != "string" || !e.icons || typeof e.icons != "object" || !z(e, Ce))
return null;
const n = o.icons;
for (const t in n) {
const s = n[t];
if (
// Name cannot be empty
!t || // Must have body
typeof s.body != "string" || // Check other props
!z(
s,
U
)
)
return null;
}
const i = o.aliases || /* @__PURE__ */ Object.create(null);
for (const t in i) {
const s = i[t], r = s.parent;
if (
// Name cannot be empty
!t || // Parent must be set and point to existing icon
typeof r != "string" || !n[r] && !i[r] || // Check other props
!z(
s,
U
)
)
return null;
}
return o;
}
const W = /* @__PURE__ */ Object.create(null);
function Pe(e, o) {
return {
provider: e,
prefix: o,
icons: /* @__PURE__ */ Object.create(null),
missing: /* @__PURE__ */ new Set()
};
}
function k(e, o) {
const n = W[e] || (W[e] = /* @__PURE__ */ Object.create(null));
return n[o] || (n[o] = Pe(e, o));
}
function fe(e, o) {
return ue(o) ? le(o, (n, i) => {
i ? e.icons[n] = i : e.missing.add(n);
}) : [];
}
function je(e, o, n) {
try {
if (typeof n.body == "string")
return e.icons[o] = { ...n }, !0;
} catch {
}
return !1;
}
let j = !1;
function ae(e) {
return typeof e == "boolean" && (j = e), j;
}
function Fe(e) {
const o = typeof e == "string" ? M(e, !0, j) : e;
if (o) {
const n = k(o.provider, o.prefix), i = o.name;
return n.icons[i] || (n.missing.has(i) ? null : void 0);
}
}
function Ee(e, o) {
const n = M(e, !0, j);
if (!n)
return !1;
const i = k(n.provider, n.prefix);
return o ? je(i, n.name, o) : (i.missing.add(n.name), !0);
}
function Oe(e, o) {
if (typeof e != "object")
return !1;
if (typeof o != "string" && (o = e.provider || ""), j && !o && !e.prefix) {
let t = !1;
return ue(e) && (e.prefix = "", le(e, (s, r) => {
Ee(s, r) && (t = !0);
})), t;
}
const n = e.prefix;
if (!E({
prefix: n,
name: "a"
}))
return !1;
const i = k(o, n);
return !!fe(i, e);
}
const de = Object.freeze({
width: null,
height: null
}), pe = Object.freeze({
// Dimensions
...de,
// Transformations
...L
}), Ae = /(-?[0-9.]*[0-9]+[0-9.]*)/g, Le = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function J(e, o, n) {
if (o === 1)
return e;
if (n = n || 100, typeof e == "number")
return Math.ceil(e * o * n) / n;
if (typeof e != "string")
return e;
const i = e.split(Ae);
if (i === null || !i.length)
return e;
const t = [];
let s = i.shift(), r = Le.test(s);
for (; ; ) {
if (r) {
const l = parseFloat(s);
isNaN(l) ? t.push(s) : t.push(Math.ceil(l * o * n) / n);
} else
t.push(s);
if (s = i.shift(), s === void 0)
return t.join("");
r = !r;
}
}
function Me(e, o = "defs") {
let n = "";
const i = e.indexOf("<" + o);
for (; i >= 0; ) {
const t = e.indexOf(">", i), s = e.indexOf("</" + o);
if (t === -1 || s === -1)
break;
const r = e.indexOf(">", s);
if (r === -1)
break;
n += e.slice(t + 1, s).trim(), e = e.slice(0, i).trim() + e.slice(r + 1);
}
return {
defs: n,
content: e
};
}
function De(e, o) {
return e ? "<defs>" + e + "</defs>" + o : o;
}
function Ne(e, o, n) {
const i = Me(e);
return De(i.defs, o + i.content + n);
}
const Re = (e) => e === "unset" || e === "undefined" || e === "none";
function ze(e, o) {
const n = {
...D,
...e
}, i = {
...pe,
...o
}, t = {
left: n.left,
top: n.top,
width: n.width,
height: n.height
};
let s = n.body;
[n, i].forEach((m) => {
const a = [], S = m.hFlip, w = m.vFlip;
let v = m.rotate;
S ? w ? v += 2 : (a.push(
"translate(" + (t.width + t.left).toString() + " " + (0 - t.top).toString() + ")"
), a.push("scale(-1 1)"), t.top = t.left = 0) : w && (a.push(
"translate(" + (0 - t.left).toString() + " " + (t.height + t.top).toString() + ")"
), a.push("scale(1 -1)"), t.top = t.left = 0);
let x;
switch (v < 0 && (v -= Math.floor(v / 4) * 4), v = v % 4, v) {
case 1:
x = t.height / 2 + t.top, a.unshift(
"rotate(90 " + x.toString() + " " + x.toString() + ")"
);
break;
case 2:
a.unshift(
"rotate(180 " + (t.width / 2 + t.left).toString() + " " + (t.height / 2 + t.top).toString() + ")"
);
break;
case 3:
x = t.width / 2 + t.left, a.unshift(
"rotate(-90 " + x.toString() + " " + x.toString() + ")"
);
break;
}
v % 2 === 1 && (t.left !== t.top && (x = t.left, t.left = t.top, t.top = x), t.width !== t.height && (x = t.width, t.width = t.height, t.height = x)), a.length && (s = Ne(
s,
'<g transform="' + a.join(" ") + '">',
"</g>"
));
});
const r = i.width, l = i.height, f = t.width, c = t.height;
let u, d;
r === null ? (d = l === null ? "1em" : l === "auto" ? c : l, u = J(d, f / c)) : (u = r === "auto" ? f : r, d = l === null ? J(u, c / f) : l === "auto" ? c : l);
const p = {}, g = (m, a) => {
Re(a) || (p[m] = a.toString());
};
g("width", u), g("height", d);
const y = [t.left, t.top, f, c];
return p.viewBox = y.join(" "), {
attributes: p,
viewBox: y,
body: s
};
}
const Qe = /\sid="(\S+)"/g, Ue = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
let qe = 0;
function He(e, o = Ue) {
const n = [];
let i;
for (; i = Qe.exec(e); )
n.push(i[1]);
if (!n.length)
return e;
const t = "suffix" + (Math.random() * 16777216 | Date.now()).toString(16);
return n.forEach((s) => {
const r = typeof o == "function" ? o(s) : o + (qe++).toString(), l = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
e = e.replace(
// Allowed characters before id: [#;"]
// Allowed characters after id: [)"], .[a-z]
new RegExp('([#;"])(' + l + ')([")]|\\.[a-z])', "g"),
"$1" + r + t + "$3"
);
}), e = e.replace(new RegExp(t, "g"), ""), e;
}
const q = /* @__PURE__ */ Object.create(null);
function $e(e, o) {
q[e] = o;
}
function H(e) {
return q[e] || q[""];
}
function V(e) {
let o;
if (typeof e.resources == "string")
o = [e.resources];
else if (o = e.resources, !(o instanceof Array) || !o.length)
return null;
return {
// API hosts
resources: o,
// 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 G = /* @__PURE__ */ Object.create(null), C = [
"https://api.simplesvg.com",
"https://api.unisvg.com"
], O = [];
for (; C.length > 0; )
C.length === 1 || Math.random() > 0.5 ? O.push(C.shift()) : O.push(C.pop());
G[""] = V({
resources: ["https://api.iconify.design"].concat(O)
});
function Ve(e, o) {
const n = V(o);
return n === null ? !1 : (G[e] = n, !0);
}
function _(e) {
return G[e];
}
const Ge = () => {
let e;
try {
if (e = fetch, typeof e == "function")
return e;
} catch {
}
};
let X = Ge();
function _e(e, o) {
const n = _(e);
if (!n)
return 0;
let i;
if (!n.maxURL)
i = 0;
else {
let t = 0;
n.resources.forEach((r) => {
t = Math.max(t, r.length);
});
const s = o + ".json?icons=";
i = n.maxURL - t - n.path.length - s.length;
}
return i;
}
function Be(e) {
return e === 404;
}
const Ke = (e, o, n) => {
const i = [], t = _e(e, o), s = "icons";
let r = {
type: s,
provider: e,
prefix: o,
icons: []
}, l = 0;
return n.forEach((f, c) => {
l += f.length + 1, l >= t && c > 0 && (i.push(r), r = {
type: s,
provider: e,
prefix: o,
icons: []
}, l = f.length), r.icons.push(f);
}), i.push(r), i;
};
function We(e) {
if (typeof e == "string") {
const o = _(e);
if (o)
return o.path;
}
return "/";
}
const Je = (e, o, n) => {
if (!X) {
n("abort", 424);
return;
}
let i = We(o.provider);
switch (o.type) {
case "icons": {
const s = o.prefix, l = o.icons.join(","), f = new URLSearchParams({
icons: l
});
i += s + ".json?" + f.toString();
break;
}
case "custom": {
const s = o.uri;
i += s.slice(0, 1) === "/" ? s.slice(1) : s;
break;
}
default:
n("abort", 400);
return;
}
let t = 503;
X(e + i).then((s) => {
const r = s.status;
if (r !== 200) {
setTimeout(() => {
n(Be(r) ? "abort" : "next", r);
});
return;
}
return t = 501, s.json();
}).then((s) => {
if (typeof s != "object" || s === null) {
setTimeout(() => {
s === 404 ? n("abort", s) : n("next", t);
});
return;
}
setTimeout(() => {
n("success", s);
});
}).catch(() => {
n("next", t);
});
}, Xe = {
prepare: Ke,
send: Je
};
function Ye(e) {
const o = {
loaded: [],
missing: [],
pending: []
}, n = /* @__PURE__ */ Object.create(null);
e.sort((t, s) => t.provider !== s.provider ? t.provider.localeCompare(s.provider) : t.prefix !== s.prefix ? t.prefix.localeCompare(s.prefix) : t.name.localeCompare(s.name));
let i = {
provider: "",
prefix: "",
name: ""
};
return e.forEach((t) => {
if (i.name === t.name && i.prefix === t.prefix && i.provider === t.provider)
return;
i = t;
const s = t.provider, r = t.prefix, l = t.name, f = n[s] || (n[s] = /* @__PURE__ */ Object.create(null)), c = f[r] || (f[r] = k(s, r));
let u;
l in c.icons ? u = o.loaded : r === "" || c.missing.has(l) ? u = o.missing : u = o.pending;
const d = {
provider: s,
prefix: r,
name: l
};
u.push(d);
}), o;
}
function he(e, o) {
e.forEach((n) => {
const i = n.loaderCallbacks;
i && (n.loaderCallbacks = i.filter((t) => t.id !== o));
});
}
function Ze(e) {
e.pendingCallbacksFlag || (e.pendingCallbacksFlag = !0, setTimeout(() => {
e.pendingCallbacksFlag = !1;
const o = e.loaderCallbacks ? e.loaderCallbacks.slice(0) : [];
if (!o.length)
return;
let n = !1;
const i = e.provider, t = e.prefix;
o.forEach((s) => {
const r = s.icons, l = r.pending.length;
r.pending = r.pending.filter((f) => {
if (f.prefix !== t)
return !0;
const c = f.name;
if (e.icons[c])
r.loaded.push({
provider: i,
prefix: t,
name: c
});
else if (e.missing.has(c))
r.missing.push({
provider: i,
prefix: t,
name: c
});
else
return n = !0, !0;
return !1;
}), r.pending.length !== l && (n || he([e], s.id), s.callback(
r.loaded.slice(0),
r.missing.slice(0),
r.pending.slice(0),
s.abort
));
});
}));
}
let et = 0;
function tt(e, o, n) {
const i = et++, t = he.bind(null, n, i);
if (!o.pending.length)
return t;
const s = {
id: i,
icons: o,
callback: e,
abort: t
};
return n.forEach((r) => {
(r.loaderCallbacks || (r.loaderCallbacks = [])).push(s);
}), t;
}
function nt(e, o = !0, n = !1) {
const i = [];
return e.forEach((t) => {
const s = typeof t == "string" ? M(t, o, n) : t;
s && i.push(s);
}), i;
}
var ot = {
resources: [],
index: 0,
timeout: 2e3,
rotate: 750,
random: !1,
dataAfterTimeout: !1
};
function it(e, o, n, i) {
const t = e.resources.length, s = e.random ? Math.floor(Math.random() * t) : e.index;
let r;
if (e.random) {
let h = e.resources.slice(0);
for (r = []; h.length > 1; ) {
const b = Math.floor(Math.random() * h.length);
r.push(h[b]), h = h.slice(0, b).concat(h.slice(b + 1));
}
r = r.concat(h);
} else
r = e.resources.slice(s).concat(e.resources.slice(0, s));
const l = Date.now();
let f = "pending", c = 0, u, d = null, p = [], g = [];
typeof i == "function" && g.push(i);
function y() {
d && (clearTimeout(d), d = null);
}
function m() {
f === "pending" && (f = "aborted"), y(), p.forEach((h) => {
h.status === "pending" && (h.status = "aborted");
}), p = [];
}
function a(h, b) {
b && (g = []), typeof h == "function" && g.push(h);
}
function S() {
return {
startTime: l,
payload: o,
status: f,
queriesSent: c,
queriesPending: p.length,
subscribe: a,
abort: m
};
}
function w() {
f = "failed", g.forEach((h) => {
h(void 0, u);
});
}
function v() {
p.forEach((h) => {
h.status === "pending" && (h.status = "aborted");
}), p = [];
}
function x(h, b, T) {
const F = b !== "success";
switch (p = p.filter((I) => I !== h), f) {
case "pending":
break;
case "failed":
if (F || !e.dataAfterTimeout)
return;
break;
default:
return;
}
if (b === "abort") {
u = T, w();
return;
}
if (F) {
u = T, p.length || (r.length ? N() : w());
return;
}
if (y(), v(), !e.random) {
const I = e.resources.indexOf(h.resource);
I !== -1 && I !== e.index && (e.index = I);
}
f = "completed", g.forEach((I) => {
I(T);
});
}
function N() {
if (f !== "pending")
return;
y();
const h = r.shift();
if (h === void 0) {
if (p.length) {
d = setTimeout(() => {
y(), f === "pending" && (v(), w());
}, e.timeout);
return;
}
w();
return;
}
const b = {
status: "pending",
resource: h,
callback: (T, F) => {
x(b, T, F);
}
};
p.push(b), c++, d = setTimeout(N, e.rotate), n(h, o, b.callback);
}
return setTimeout(N), S;
}
function ge(e) {
const o = {
...ot,
...e
};
let n = [];
function i() {
n = n.filter((l) => l().status === "pending");
}
function t(l, f, c) {
const u = it(
o,
l,
f,
(d, p) => {
i(), c && c(d, p);
}
);
return n.push(u), u;
}
function s(l) {
return n.find((f) => l(f)) || null;
}
return {
query: t,
find: s,
setIndex: (l) => {
o.index = l;
},
getIndex: () => o.index,
cleanup: i
};
}
function Y() {
}
const Q = /* @__PURE__ */ Object.create(null);
function st(e) {
if (!Q[e]) {
const o = _(e);
if (!o)
return;
const n = ge(o), i = {
config: o,
redundancy: n
};
Q[e] = i;
}
return Q[e];
}
function rt(e, o, n) {
let i, t;
if (typeof e == "string") {
const s = H(e);
if (!s)
return n(void 0, 424), Y;
t = s.send;
const r = st(e);
r && (i = r.redundancy);
} else {
const s = V(e);
if (s) {
i = ge(s);
const r = e.resources ? e.resources[0] : "", l = H(r);
l && (t = l.send);
}
}
return !i || !t ? (n(void 0, 424), Y) : i.query(o, t, n)().abort;
}
function Z() {
}
function ct(e) {
e.iconsLoaderFlag || (e.iconsLoaderFlag = !0, setTimeout(() => {
e.iconsLoaderFlag = !1, Ze(e);
}));
}
function lt(e) {
const o = [], n = [];
return e.forEach((i) => {
(i.match(re) ? o : n).push(i);
}), {
valid: o,
invalid: n
};
}
function P(e, o, n) {
function i() {
const t = e.pendingIcons;
o.forEach((s) => {
t && t.delete(s), e.icons[s] || e.missing.add(s);
});
}
if (n && typeof n == "object")
try {
if (!fe(e, n).length) {
i();
return;
}
} catch (t) {
console.error(t);
}
i(), ct(e);
}
function ee(e, o) {
e instanceof Promise ? e.then((n) => {
o(n);
}).catch(() => {
o(null);
}) : o(e);
}
function ut(e, o) {
e.iconsToLoad ? e.iconsToLoad = e.iconsToLoad.concat(o).sort() : e.iconsToLoad = o, e.iconsQueueFlag || (e.iconsQueueFlag = !0, setTimeout(() => {
e.iconsQueueFlag = !1;
const { provider: n, prefix: i } = e, t = e.iconsToLoad;
if (delete e.iconsToLoad, !t || !t.length)
return;
const s = e.loadIcon;
if (e.loadIcons && (t.length > 1 || !s)) {
ee(
e.loadIcons(t, i, n),
(u) => {
P(e, t, u);
}
);
return;
}
if (s) {
t.forEach((u) => {
const d = s(u, i, n);
ee(d, (p) => {
const g = p ? {
prefix: i,
icons: {
[u]: p
}
} : null;
P(e, [u], g);
});
});
return;
}
const { valid: r, invalid: l } = lt(t);
if (l.length && P(e, l, null), !r.length)
return;
const f = i.match(re) ? H(n) : null;
if (!f) {
P(e, r, null);
return;
}
f.prepare(n, i, r).forEach((u) => {
rt(n, u, (d) => {
P(e, u.icons, d);
});
});
}));
}
const ft = (e, o) => {
const n = nt(e, !0, ae()), i = Ye(n);
if (!i.pending.length) {
let f = !0;
return o && setTimeout(() => {
f && o(
i.loaded,
i.missing,
i.pending,
Z
);
}), () => {
f = !1;
};
}
const t = /* @__PURE__ */ Object.create(null), s = [];
let r, l;
return i.pending.forEach((f) => {
const { provider: c, prefix: u } = f;
if (u === l && c === r)
return;
r = c, l = u, s.push(k(c, u));
const d = t[c] || (t[c] = /* @__PURE__ */ Object.create(null));
d[u] || (d[u] = []);
}), i.pending.forEach((f) => {
const { provider: c, prefix: u, name: d } = f, p = k(c, u), g = p.pendingIcons || (p.pendingIcons = /* @__PURE__ */ new Set());
g.has(d) || (g.add(d), t[c][u].push(d));
}), s.forEach((f) => {
const c = t[f.provider][f.prefix];
c.length && ut(f, c);
}), o ? tt(o, i, s) : Z;
};
function at(e, o) {
const n = {
...e
};
for (const i in o) {
const t = o[i], s = typeof t;
i in de ? (t === null || t && (s === "string" || s === "number")) && (n[i] = t) : s === typeof n[i] && (n[i] = i === "rotate" ? t % 4 : t);
}
return n;
}
const dt = /[\s,]+/;
function pt(e, o) {
o.split(dt).forEach((n) => {
switch (n.trim()) {
case "horizontal":
e.hFlip = !0;
break;
case "vertical":
e.vFlip = !0;
break;
}
});
}
function ht(e, o = 0) {
const n = e.replace(/^-?[0-9.]*/, "");
function i(t) {
for (; t < 0; )
t += 4;
return t % 4;
}
if (n === "") {
const t = parseInt(e);
return isNaN(t) ? 0 : i(t);
} else if (n !== e) {
let t = 0;
switch (n) {
case "%":
t = 25;
break;
case "deg":
t = 90;
}
if (t) {
let s = parseFloat(e.slice(0, e.length - n.length));
return isNaN(s) ? 0 : (s = s / t, s % 1 === 0 ? i(s) : 0);
}
}
return o;
}
function gt(e, o) {
let n = e.indexOf("xlink:") === -1 ? "" : ' xmlns:xlink="http://www.w3.org/1999/xlink"';
for (const i in o)
n += " " + i + '="' + o[i] + '"';
return '<svg xmlns="http://www.w3.org/2000/svg"' + n + ">" + e + "</svg>";
}
function mt(e) {
return e.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ");
}
function yt(e) {
return "data:image/svg+xml," + mt(e);
}
function xt(e) {
return 'url("' + yt(e) + '")';
}
const te = {
...pe,
inline: !1
}, bt = {
xmlns: "http://www.w3.org/2000/svg",
"xmlns:xlink": "http://www.w3.org/1999/xlink",
"aria-hidden": !0,
role: "img"
}, vt = {
display: "inline-block"
}, $ = {
backgroundColor: "currentColor"
}, me = {
backgroundColor: "transparent"
}, ne = {
Image: "var(--svg)",
Repeat: "no-repeat",
Size: "100% 100%"
}, oe = {
webkitMask: $,
mask: $,
background: me
};
for (const e in oe) {
const o = oe[e];
for (const n in ne)
o[e + n] = ne[n];
}
const A = {};
["horizontal", "vertical"].forEach((e) => {
const o = e.slice(0, 1) + "Flip";
A[e + "-flip"] = o, A[e.slice(0, 1) + "-flip"] = o, A[e + "Flip"] = o;
});
function ie(e) {
return e + (e.match(/^[-0-9.]+$/) ? "px" : "");
}
const se = (e, o) => {
const n = at(te, o), i = { ...bt }, t = o.mode || "svg", s = {}, r = o.style, l = typeof r == "object" && !(r instanceof Array) ? r : {};
for (let m in o) {
const a = o[m];
if (a !== void 0)
switch (m) {
// Properties to ignore
case "icon":
case "style":
case "onLoad":
case "mode":
case "ssr":
break;
// Boolean attributes
case "inline":
case "hFlip":
case "vFlip":
n[m] = a === !0 || a === "true" || a === 1;
break;
// Flip as string: 'horizontal,vertical'
case "flip":
typeof a == "string" && pt(n, a);
break;
// Color: override style
case "color":
s.color = a;
break;
// Rotation as string
case "rotate":
typeof a == "string" ? n[m] = ht(a) : typeof a == "number" && (n[m] = a);
break;
// Remove aria-hidden
case "ariaHidden":
case "aria-hidden":
a !== !0 && a !== "true" && delete i["aria-hidden"];
break;
default: {
const S = A[m];
S ? (a === !0 || a === "true" || a === 1) && (n[S] = !0) : te[m] === void 0 && (i[m] = a);
}
}
}
const f = ze(e, n), c = f.attributes;
if (n.inline && (s.verticalAlign = "-0.125em"), t === "svg") {
i.style = {
...s,
...l
}, Object.assign(i, c);
let m = 0, a = o.id;
return typeof a == "string" && (a = a.replace(/-/g, "_")), i.innerHTML = He(f.body, a ? () => a + "ID" + m++ : "iconifyVue"), B("svg", i);
}
const { body: u, width: d, height: p } = e, g = t === "mask" || (t === "bg" ? !1 : u.indexOf("currentColor") !== -1), y = gt(u, {
...c,
width: d + "",
height: p + ""
});
return i.style = {
...s,
"--svg": xt(y),
width: ie(c.width),
height: ie(c.height),
...vt,
...g ? $ : me,
...l
}, B("span", i);
};
ae(!0);
$e("", Xe);
if (typeof document < "u" && typeof window < "u") {
const e = window;
if (e.IconifyPreload !== void 0) {
const o = e.IconifyPreload, n = "Invalid IconifyPreload syntax.";
typeof o == "object" && o !== null && (o instanceof Array ? o : [o]).forEach((i) => {
try {
// Check if item is an object and not null/array
(typeof i != "object" || i === null || i instanceof Array || // Check for 'icons' and 'prefix'
typeof i.icons != "object" || typeof i.prefix != "string" || // Add icon set
!Oe(i)) && console.error(n);
} catch {
console.error(n);
}
});
}
if (e.IconifyProviders !== void 0) {
const o = e.IconifyProviders;
if (typeof o == "object" && o !== null)
for (let n in o) {
const i = "IconifyProviders[" + n + "] is invalid.";
try {
const t = o[n];
if (typeof t != "object" || !t || t.resources === void 0)
continue;
Ve(n, t) || console.error(i);
} catch {
console.error(i);
}
}
}
}
const wt = {
...D,
body: ""
}, St = ye((e, { emit: o }) => {
const n = R(null);
function i() {
var c, u;
n.value && ((u = (c = n.value).abort) == null || u.call(c), n.value = null);
}
const t = R(!!e.ssr), s = R(""), r = xe(null);
function l() {
const c = e.icon;
if (typeof c == "object" && c !== null && typeof c.body == "string")
return s.value = "", {
data: c
};
let u;
if (typeof c != "string" || (u = M(c, !1, !0)) === null)
return null;
let d = Fe(u);
if (!d) {
const y = n.value;
return (!y || y.name !== c) && (d === null ? n.value = {
name: c
} : n.value = {
name: c,
abort: ft([u], f)
}), null;
}
i(), s.value !== c && (s.value = c, Ie(() => {
o("load", c);
}));
const p = e.customise;
if (p) {
d = Object.assign({}, d);
const y = p(d.body, u.name, u.prefix, u.provider);
typeof y == "string" && (d.body = y);
}
const g = ["iconify"];
return u.prefix !== "" && g.push("iconify--" + u.prefix), u.provider !== "" && g.push("iconify--" + u.provider), { data: d, classes: g };
}
function f() {
var u;
const c = l();
c ? c.data !== ((u = r.value) == null ? void 0 : u.data) && (r.value = c) : r.value = null;
}
return t.value ? f() : be(() => {
t.value = !0, f();
}), ve(() => e.icon, f), we(i), () => {
const c = r.value;
if (!c)
return se(wt, e);
let u = e;
return c.classes && (u = {
...e,
class: c.classes.join(" ")
}), se({
...D,
...c.data
}, u);
};
}, {
props: [
// Icon and render mode
"icon",
"mode",
"ssr",
// Layout and style
"width",
"height",
"style",
"color",
"inline",
// Transformations
"rotate",
"hFlip",
"horizontalFlip",
"vFlip",
"verticalFlip",
"flip",
// Misc
"id",
"ariaHidden",
"customise",
"title"
],
emits: ["load"]
});
export {
St as I
};