UNPKG

@acrool/icon-symbols

Version:

Merge svg into svg symbols, and unpack svg symbols into individual svg

1,458 lines 50.5 kB
var O = 1e6, K = 1e6, _ = "[big.js] ", F = _ + "Invalid ", U = F + "decimal places", ge = F + "rounding mode", ne = _ + "Division by zero", b = {}, v = void 0; function S(e, t, r, s) { var n = e.c; if (r === v && (r = e.constructor.RM), r !== 0 && r !== 1 && r !== 2 && r !== 3) throw Error(ge); if (t < 1) s = r === 3 && (s || !!n[0]) || t === 0 && (r === 1 && n[0] >= 5 || r === 2 && (n[0] > 5 || n[0] === 5 && (s || n[1] !== v))), n.length = 1, s ? (e.e = e.e - t + 1, n[0] = 1) : n[0] = e.e = 0; else if (t < n.length) { if (s = r === 1 && n[t] >= 5 || r === 2 && (n[t] > 5 || n[t] === 5 && (s || n[t + 1] !== v || n[t - 1] & 1)) || r === 3 && (s || !!n[0]), n.length = t, s) { for (; ++n[--t] > 9; ) if (n[t] = 0, t === 0) { ++e.e, n.unshift(1); break; } } for (t = n.length; !n[--t]; ) n.pop(); } return e; } function M(e, t, r) { var s = e.e, n = e.c.join(""), i = n.length; if (t) n = n.charAt(0) + (i > 1 ? "." + n.slice(1) : "") + (s < 0 ? "e" : "e+") + s; else if (s < 0) { for (; ++s; ) n = "0" + n; n = "0." + n; } else if (s > 0) if (++s > i) for (s -= i; s--; ) n += "0"; else s < i && (n = n.slice(0, s) + "." + n.slice(s)); else i > 1 && (n = n.charAt(0) + "." + n.slice(1)); return e.s < 0 && r ? "-" + n : n; } b.abs = function() { var e = new this.constructor(this); return e.s = 1, e; }; b.cmp = function(e) { var t, r = this, s = r.c, n = (e = new r.constructor(e)).c, i = r.s, c = e.s, f = r.e, o = e.e; if (!s[0] || !n[0]) return s[0] ? i : n[0] ? -c : 0; if (i != c) return i; if (t = i < 0, f != o) return f > o ^ t ? 1 : -1; for (c = (f = s.length) < (o = n.length) ? f : o, i = -1; ++i < c; ) if (s[i] != n[i]) return s[i] > n[i] ^ t ? 1 : -1; return f == o ? 0 : f > o ^ t ? 1 : -1; }; b.div = function(e) { var t = this, r = t.constructor, s = t.c, n = (e = new r(e)).c, i = t.s == e.s ? 1 : -1, c = r.DP; if (c !== ~~c || c < 0 || c > O) throw Error(U); if (!n[0]) throw Error(ne); if (!s[0]) return e.s = i, e.c = [e.e = 0], e; var f, o, u, l, a, g = n.slice(), N = f = n.length, p = s.length, d = s.slice(0, f), h = d.length, E = e, m = E.c = [], I = 0, A = c + (E.e = t.e - e.e) + 1; for (E.s = i, i = A < 0 ? 0 : A, g.unshift(0); h++ < f; ) d.push(0); do { for (u = 0; u < 10; u++) { if (f != (h = d.length)) l = f > h ? 1 : -1; else for (a = -1, l = 0; ++a < f; ) if (n[a] != d[a]) { l = n[a] > d[a] ? 1 : -1; break; } if (l < 0) { for (o = h == f ? n : g; h; ) { if (d[--h] < o[h]) { for (a = h; a && !d[--a]; ) d[a] = 9; --d[a], d[h] += 10; } d[h] -= o[h]; } for (; !d[0]; ) d.shift(); } else break; } m[I++] = l ? u : ++u, d[0] && l ? d[h] = s[N] || 0 : d = [s[N]]; } while ((N++ < p || d[0] !== v) && i--); return !m[0] && I != 1 && (m.shift(), E.e--, A--), I > A && S(E, A, r.RM, d[0] !== v), E; }; b.eq = function(e) { return this.cmp(e) === 0; }; b.gt = function(e) { return this.cmp(e) > 0; }; b.gte = function(e) { return this.cmp(e) > -1; }; b.lt = function(e) { return this.cmp(e) < 0; }; b.lte = function(e) { return this.cmp(e) < 1; }; b.minus = b.sub = function(e) { var t, r, s, n, i = this, c = i.constructor, f = i.s, o = (e = new c(e)).s; if (f != o) return e.s = -o, i.plus(e); var u = i.c.slice(), l = i.e, a = e.c, g = e.e; if (!u[0] || !a[0]) return a[0] ? e.s = -o : u[0] ? e = new c(i) : e.s = 1, e; if (f = l - g) { for ((n = f < 0) ? (f = -f, s = u) : (g = l, s = a), s.reverse(), o = f; o--; ) s.push(0); s.reverse(); } else for (r = ((n = u.length < a.length) ? u : a).length, f = o = 0; o < r; o++) if (u[o] != a[o]) { n = u[o] < a[o]; break; } if (n && (s = u, u = a, a = s, e.s = -e.s), (o = (r = a.length) - (t = u.length)) > 0) for (; o--; ) u[t++] = 0; for (o = t; r > f; ) { if (u[--r] < a[r]) { for (t = r; t && !u[--t]; ) u[t] = 9; --u[t], u[r] += 10; } u[r] -= a[r]; } for (; u[--o] === 0; ) u.pop(); for (; u[0] === 0; ) u.shift(), --g; return u[0] || (e.s = 1, u = [g = 0]), e.c = u, e.e = g, e; }; b.mod = function(e) { var t, r = this, s = r.constructor, n = r.s, i = (e = new s(e)).s; if (!e.c[0]) throw Error(ne); return r.s = e.s = 1, t = e.cmp(r) == 1, r.s = n, e.s = i, t ? new s(r) : (n = s.DP, i = s.RM, s.DP = s.RM = 0, r = r.div(e), s.DP = n, s.RM = i, this.minus(r.times(e))); }; b.neg = function() { var e = new this.constructor(this); return e.s = -e.s, e; }; b.plus = b.add = function(e) { var t, r, s, n = this, i = n.constructor; if (e = new i(e), n.s != e.s) return e.s = -e.s, n.minus(e); var c = n.e, f = n.c, o = e.e, u = e.c; if (!f[0] || !u[0]) return u[0] || (f[0] ? e = new i(n) : e.s = n.s), e; if (f = f.slice(), t = c - o) { for (t > 0 ? (o = c, s = u) : (t = -t, s = f), s.reverse(); t--; ) s.push(0); s.reverse(); } for (f.length - u.length < 0 && (s = u, u = f, f = s), t = u.length, r = 0; t; f[t] %= 10) r = (f[--t] = f[t] + u[t] + r) / 10 | 0; for (r && (f.unshift(r), ++o), t = f.length; f[--t] === 0; ) f.pop(); return e.c = f, e.e = o, e; }; b.pow = function(e) { var t = this, r = new t.constructor("1"), s = r, n = e < 0; if (e !== ~~e || e < -K || e > K) throw Error(F + "exponent"); for (n && (e = -e); e & 1 && (s = s.times(t)), e >>= 1, !!e; ) t = t.times(t); return n ? r.div(s) : s; }; b.prec = function(e, t) { if (e !== ~~e || e < 1 || e > O) throw Error(F + "precision"); return S(new this.constructor(this), e, t); }; b.round = function(e, t) { if (e === v) e = 0; else if (e !== ~~e || e < -O || e > O) throw Error(U); return S(new this.constructor(this), e + this.e + 1, t); }; b.sqrt = function() { var e, t, r, s = this, n = s.constructor, i = s.s, c = s.e, f = new n("0.5"); if (!s.c[0]) return new n(s); if (i < 0) throw Error(_ + "No square root"); i = Math.sqrt(+M(s, !0, !0)), i === 0 || i === 1 / 0 ? (t = s.c.join(""), t.length + c & 1 || (t += "0"), i = Math.sqrt(t), c = ((c + 1) / 2 | 0) - (c < 0 || c & 1), e = new n((i == 1 / 0 ? "5e" : (i = i.toExponential()).slice(0, i.indexOf("e") + 1)) + c)) : e = new n(i + ""), c = e.e + (n.DP += 4); do r = e, e = f.times(r.plus(s.div(r))); while (r.c.slice(0, c).join("") !== e.c.slice(0, c).join("")); return S(e, (n.DP -= 4) + e.e + 1, n.RM); }; b.times = b.mul = function(e) { var t, r = this, s = r.constructor, n = r.c, i = (e = new s(e)).c, c = n.length, f = i.length, o = r.e, u = e.e; if (e.s = r.s == e.s ? 1 : -1, !n[0] || !i[0]) return e.c = [e.e = 0], e; for (e.e = o + u, c < f && (t = n, n = i, i = t, u = c, c = f, f = u), t = new Array(u = c + f); u--; ) t[u] = 0; for (o = f; o--; ) { for (f = 0, u = c + o; u > o; ) f = t[u] + i[o] * n[u - o - 1] + f, t[u--] = f % 10, f = f / 10 | 0; t[u] = f; } for (f ? ++e.e : t.shift(), o = t.length; !t[--o]; ) t.pop(); return e.c = t, e; }; b.toExponential = function(e, t) { var r = this, s = r.c[0]; if (e !== v) { if (e !== ~~e || e < 0 || e > O) throw Error(U); for (r = S(new r.constructor(r), ++e, t); r.c.length < e; ) r.c.push(0); } return M(r, !0, !!s); }; b.toFixed = function(e, t) { var r = this, s = r.c[0]; if (e !== v) { if (e !== ~~e || e < 0 || e > O) throw Error(U); for (r = S(new r.constructor(r), e + r.e + 1, t), e = e + r.e + 1; r.c.length < e; ) r.c.push(0); } return M(r, !1, !!s); }; b.toJSON = b.toString = function() { var e = this, t = e.constructor; return M(e, e.e <= t.NE || e.e >= t.PE, !!e.c[0]); }; typeof Symbol < "u" && (b[Symbol.for("nodejs.util.inspect.custom")] = b.toJSON); b.toNumber = function() { var e = +M(this, !0, !0); if (this.constructor.strict === !0 && !this.eq(e.toString())) throw Error(_ + "Imprecise conversion"); return e; }; b.toPrecision = function(e, t) { var r = this, s = r.constructor, n = r.c[0]; if (e !== v) { if (e !== ~~e || e < 1 || e > O) throw Error(F + "precision"); for (r = S(new s(r), e, t); r.c.length < e; ) r.c.push(0); } return M(r, e <= r.e || r.e <= s.NE || r.e >= s.PE, !!n); }; b.valueOf = function() { var e = this, t = e.constructor; if (t.strict === !0) throw Error(_ + "valueOf disallowed"); return M(e, e.e <= t.NE || e.e >= t.PE, !0); }; function se(e) { return /^0\.\d+$/.test(e) ? e.replace(/^0/, "") : /^\d*\.?\d+$/.test(e) ? e.replace(/^0+(?=\d)/, "") : e; } const pe = (e, t, r) => r.indexOf(e) === t, ie = (e) => e.reduce((t, r) => { var s, n, i; if (typeof r != "string" && r.type === "element") { if (r.tagName === "path") { const c = []; return (s = r.properties) != null && s.fill && c.push(r.properties.fill.toLocaleString()), (n = r.properties) != null && n["fill-opacity"] && c.push(se((i = r.properties) == null ? void 0 : i["fill-opacity"].toString())), t.push(c.join("_")), t; } else if (r.children && r.children.length > 0) return ie(r.children); } return t; }, []), Ot = (e) => ie(e).filter(pe).length > 1, oe = (e, t) => { var s; const r = []; if (t || e.fill === "none" || (s = e.fill) != null && s.startsWith("url(#") ? (e.fill && r.push(`fill="${e.fill.toLocaleString()}"`), e.stroke && r.push(`stroke="${e.stroke}"`)) : e.stroke && r.push('stroke="currentColor"'), e["fill-opacity"]) { const n = se(e["fill-opacity"].toString()); r.push(`fill-opacity="${n}"`); } return r; }, Ee = (e, t = !0) => e.reduce((r, s) => { var n; if (s && (s["#name"] === "path" || s.tagName === "path")) { const i = oe(s.properties || {}, t); if ((n = s.properties) != null && n.d) { const c = s.properties.d.toString().replace(/\n/g, "").replace(/\t/g, ""); i.push(`d="${c}"`); } return r.push(`<path ${i.join(" ")}/>`), r; } else if (s.children && s.children.length > 0) return Ee(s.children, t); return r; }, []), fe = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", be = fe + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", Ne = "[" + fe + "][" + be + "]*", ye = new RegExp("^" + Ne + "$"); function ce(e, t) { const r = []; let s = t.exec(e); for (; s; ) { const n = []; n.startIndex = t.lastIndex - s[0].length; const i = s.length; for (let c = 0; c < i; c++) n.push(s[c]); r.push(n), s = t.exec(e); } return r; } const G = function(e) { const t = ye.exec(e); return !(t === null || typeof t > "u"); }; function we(e) { return typeof e < "u"; } const Ae = { allowBooleanAttributes: !1, //A tag can have attributes without any value unpairedTags: [] }; function ve(e, t) { t = Object.assign({}, Ae, t); const r = []; let s = !1, n = !1; e[0] === "\uFEFF" && (e = e.substr(1)); for (let i = 0; i < e.length; i++) if (e[i] === "<" && e[i + 1] === "?") { if (i += 2, i = D(e, i), i.err) return i; } else if (e[i] === "<") { let c = i; if (i++, e[i] === "!") { i = ee(e, i); continue; } else { let f = !1; e[i] === "/" && (f = !0, i++); let o = ""; for (; i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== " " && e[i] !== ` ` && e[i] !== "\r"; i++) o += e[i]; if (o = o.trim(), o[o.length - 1] === "/" && (o = o.substring(0, o.length - 1), i--), !Me(o)) { let a; return o.trim().length === 0 ? a = "Invalid space after '<'." : a = "Tag '" + o + "' is an invalid name.", y("InvalidTag", a, w(e, i)); } const u = me(e, i); if (u === !1) return y("InvalidAttr", "Attributes for '" + o + "' have open quote.", w(e, i)); let l = u.value; if (i = u.index, l[l.length - 1] === "/") { const a = i - l.length; l = l.substring(0, l.length - 1); const g = te(l, t); if (g === !0) s = !0; else return y(g.err.code, g.err.msg, w(e, a + g.err.line)); } else if (f) if (u.tagClosed) { if (l.trim().length > 0) return y("InvalidTag", "Closing tag '" + o + "' can't have attributes or invalid starting.", w(e, c)); if (r.length === 0) return y("InvalidTag", "Closing tag '" + o + "' has not been opened.", w(e, c)); { const a = r.pop(); if (o !== a.tagName) { let g = w(e, a.tagStartPos); return y( "InvalidTag", "Expected closing tag '" + a.tagName + "' (opened in line " + g.line + ", col " + g.col + ") instead of closing tag '" + o + "'.", w(e, c) ); } r.length == 0 && (n = !0); } } else return y("InvalidTag", "Closing tag '" + o + "' doesn't have proper closing.", w(e, i)); else { const a = te(l, t); if (a !== !0) return y(a.err.code, a.err.msg, w(e, i - l.length + a.err.line)); if (n === !0) return y("InvalidXml", "Multiple possible root nodes found.", w(e, i)); t.unpairedTags.indexOf(o) !== -1 || r.push({ tagName: o, tagStartPos: c }), s = !0; } for (i++; i < e.length; i++) if (e[i] === "<") if (e[i + 1] === "!") { i++, i = ee(e, i); continue; } else if (e[i + 1] === "?") { if (i = D(e, ++i), i.err) return i; } else break; else if (e[i] === "&") { const a = Oe(e, i); if (a == -1) return y("InvalidChar", "char '&' is not expected.", w(e, i)); i = a; } else if (n === !0 && !x(e[i])) return y("InvalidXml", "Extra text at the end", w(e, i)); e[i] === "<" && i--; } } else { if (x(e[i])) continue; return y("InvalidChar", "char '" + e[i] + "' is not expected.", w(e, i)); } if (s) { if (r.length == 1) return y("InvalidTag", "Unclosed tag '" + r[0].tagName + "'.", w(e, r[0].tagStartPos)); if (r.length > 0) return y("InvalidXml", "Invalid '" + JSON.stringify(r.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }); } else return y("InvalidXml", "Start tag expected.", 1); return !0; } function x(e) { return e === " " || e === " " || e === ` ` || e === "\r"; } function D(e, t) { const r = t; for (; t < e.length; t++) if (e[t] == "?" || e[t] == " ") { const s = e.substr(r, t - r); if (t > 5 && s === "xml") return y("InvalidXml", "XML declaration allowed only at the start of the document.", w(e, t)); if (e[t] == "?" && e[t + 1] == ">") { t++; break; } else continue; } return t; } function ee(e, t) { if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") { for (t += 3; t < e.length; t++) if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") { t += 2; break; } } else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") { let r = 1; for (t += 8; t < e.length; t++) if (e[t] === "<") r++; else if (e[t] === ">" && (r--, r === 0)) break; } else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") { for (t += 8; t < e.length; t++) if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") { t += 2; break; } } return t; } const Ie = '"', Te = "'"; function me(e, t) { let r = "", s = "", n = !1; for (; t < e.length; t++) { if (e[t] === Ie || e[t] === Te) s === "" ? s = e[t] : s !== e[t] || (s = ""); else if (e[t] === ">" && s === "") { n = !0; break; } r += e[t]; } return s !== "" ? !1 : { value: r, index: t, tagClosed: n }; } const Pe = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g"); function te(e, t) { const r = ce(e, Pe), s = {}; for (let n = 0; n < r.length; n++) { if (r[n][1].length === 0) return y("InvalidAttr", "Attribute '" + r[n][2] + "' has no space in starting.", $(r[n])); if (r[n][3] !== void 0 && r[n][4] === void 0) return y("InvalidAttr", "Attribute '" + r[n][2] + "' is without value.", $(r[n])); if (r[n][3] === void 0 && !t.allowBooleanAttributes) return y("InvalidAttr", "boolean attribute '" + r[n][2] + "' is not allowed.", $(r[n])); const i = r[n][2]; if (!Se(i)) return y("InvalidAttr", "Attribute '" + i + "' is an invalid name.", $(r[n])); if (!s.hasOwnProperty(i)) s[i] = 1; else return y("InvalidAttr", "Attribute '" + i + "' is repeated.", $(r[n])); } return !0; } function Ce(e, t) { let r = /\d/; for (e[t] === "x" && (t++, r = /[\da-fA-F]/); t < e.length; t++) { if (e[t] === ";") return t; if (!e[t].match(r)) break; } return -1; } function Oe(e, t) { if (t++, e[t] === ";") return -1; if (e[t] === "#") return t++, Ce(e, t); let r = 0; for (; t < e.length; t++, r++) if (!(e[t].match(/\w/) && r < 20)) { if (e[t] === ";") break; return -1; } return t; } function y(e, t, r) { return { err: { code: e, msg: t, line: r.line || r, col: r.col } }; } function Se(e) { return G(e); } function Me(e) { return G(e); } function w(e, t) { const r = e.substring(0, t).split(/\r?\n/); return { line: r.length, // column number is last line's length + 1, because column numbering starts at 1: col: r[r.length - 1].length + 1 }; } function $(e) { return e.startIndex + e[1].length; } const $e = { preserveOrder: !1, attributeNamePrefix: "@_", attributesGroupName: !1, textNodeName: "#text", ignoreAttributes: !0, removeNSPrefix: !1, // remove NS from tag name or attribute name if true allowBooleanAttributes: !1, //a tag can have attributes without any value //ignoreRootElement : false, parseTagValue: !0, parseAttributeValue: !1, trimValues: !0, //Trim string values of tag and attributes cdataPropName: !1, numberParseOptions: { hex: !0, leadingZeros: !0, eNotation: !0 }, tagValueProcessor: function(e, t) { return t; }, attributeValueProcessor: function(e, t) { return t; }, stopNodes: [], //nested tags will not be parsed even for errors alwaysCreateTextNode: !1, isArray: () => !1, commentPropName: !1, unpairedTags: [], processEntities: !0, htmlEntities: !1, ignoreDeclaration: !1, ignorePiTags: !1, transformTagName: !1, transformAttributeName: !1, updateTag: function(e, t, r) { return e; }, // skipEmptyListItem: false captureMetaData: !1 }, ke = function(e) { return Object.assign({}, $e, e); }; let R; typeof Symbol != "function" ? R = "@@xmlMetadata" : R = Symbol("XML Node Metadata"); class P { constructor(t) { this.tagname = t, this.child = [], this[":@"] = {}; } add(t, r) { t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: r }); } addChild(t, r) { t.tagname === "__proto__" && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({ [t.tagname]: t.child, ":@": t[":@"] }) : this.child.push({ [t.tagname]: t.child }), r !== void 0 && (this.child[this.child.length - 1][R] = { startIndex: r }); } /** symbol used for metadata */ static getMetaDataSymbol() { return R; } } function _e(e, t) { const r = {}; if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") { t = t + 9; let s = 1, n = !1, i = !1, c = ""; for (; t < e.length; t++) if (e[t] === "<" && !i) { if (n && Re(e, t)) { t += 7; let f, o; [f, o, t] = Fe(e, t + 1), o.indexOf("&") === -1 && (r[f] = { regx: RegExp(`&${f};`, "g"), val: o }); } else if (n && Le(e, t)) { t += 8; const { index: f } = je(e, t + 1); t = f; } else if (n && Ze(e, t)) t += 8; else if (n && Ue(e, t)) { t += 9; const { index: f } = Ve(e, t + 1); t = f; } else if (Be) i = !0; else throw new Error("Invalid DOCTYPE"); s++, c = ""; } else if (e[t] === ">") { if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, s--) : s--, s === 0) break; } else e[t] === "[" ? n = !0 : c += e[t]; if (s !== 0) throw new Error("Unclosed DOCTYPE"); } else throw new Error("Invalid Tag instead of DOCTYPE"); return { entities: r, i: t }; } const T = (e, t) => { for (; t < e.length && /\s/.test(e[t]); ) t++; return t; }; function Fe(e, t) { t = T(e, t); let r = ""; for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; ) r += e[t], t++; if (W(r), t = T(e, t), e.substring(t, t + 6).toUpperCase() === "SYSTEM") throw new Error("External entities are not supported"); if (e[t] === "%") throw new Error("Parameter entities are not supported"); let s = ""; return [t, s] = j(e, t, "entity"), t--, [r, s, t]; } function Ve(e, t) { t = T(e, t); let r = ""; for (; t < e.length && !/\s/.test(e[t]); ) r += e[t], t++; W(r), t = T(e, t); const s = e.substring(t, t + 6).toUpperCase(); if (s !== "SYSTEM" && s !== "PUBLIC") throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`); t += s.length, t = T(e, t); let n = null, i = null; if (s === "PUBLIC") [t, n] = j(e, t, "publicIdentifier"), t = T(e, t), (e[t] === '"' || e[t] === "'") && ([t, i] = j(e, t, "systemIdentifier")); else if (s === "SYSTEM" && ([t, i] = j(e, t, "systemIdentifier"), !i)) throw new Error("Missing mandatory system identifier for SYSTEM notation"); return { notationName: r, publicIdentifier: n, systemIdentifier: i, index: --t }; } function j(e, t, r) { let s = ""; const n = e[t]; if (n !== '"' && n !== "'") throw new Error(`Expected quoted string, found "${n}"`); for (t++; t < e.length && e[t] !== n; ) s += e[t], t++; if (e[t] !== n) throw new Error(`Unterminated ${r} value`); return t++, [t, s]; } function je(e, t) { t = T(e, t); let r = ""; for (; t < e.length && !/\s/.test(e[t]); ) r += e[t], t++; if (!W(r)) throw new Error(`Invalid element name: "${r}"`); if (t = T(e, t), e[t] !== "(") throw new Error(`Expected '(', found "${e[t]}"`); t++; let s = ""; for (; t < e.length && e[t] !== ")"; ) s += e[t], t++; if (e[t] !== ")") throw new Error("Unterminated content model"); return { elementName: r, contentModel: s.trim(), index: t }; } function Be(e, t) { return e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-"; } function Re(e, t) { return e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "N" && e[t + 4] === "T" && e[t + 5] === "I" && e[t + 6] === "T" && e[t + 7] === "Y"; } function Le(e, t) { return e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "L" && e[t + 4] === "E" && e[t + 5] === "M" && e[t + 6] === "E" && e[t + 7] === "N" && e[t + 8] === "T"; } function Ze(e, t) { return e[t + 1] === "!" && e[t + 2] === "A" && e[t + 3] === "T" && e[t + 4] === "T" && e[t + 5] === "L" && e[t + 6] === "I" && e[t + 7] === "S" && e[t + 8] === "T"; } function Ue(e, t) { return e[t + 1] === "!" && e[t + 2] === "N" && e[t + 3] === "O" && e[t + 4] === "T" && e[t + 5] === "A" && e[t + 6] === "T" && e[t + 7] === "I" && e[t + 8] === "O" && e[t + 9] === "N"; } function W(e) { if (G(e)) return e; throw new Error(`Invalid entity name ${e}`); } const qe = /^[-+]?0x[a-fA-F0-9]+$/, Xe = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, Ye = { hex: !0, // oct: false, leadingZeros: !0, decimalPoint: ".", eNotation: !0 //skipLike: /regex/ }; function Ge(e, t = {}) { if (t = Object.assign({}, Ye, t), !e || typeof e != "string") return e; let r = e.trim(); if (t.skipLike !== void 0 && t.skipLike.test(r)) return e; if (e === "0") return 0; if (t.hex && qe.test(r)) return Je(r, 16); if (r.search(/[eE]/) !== -1) { const s = r.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/); if (s) { if (t.leadingZeros) r = (s[1] || "") + s[3]; else if (!(s[2] === "0" && s[3][0] === ".")) return e; return t.eNotation ? Number(r) : e; } else return e; } else { const s = Xe.exec(r); if (s) { const n = s[1], i = s[2]; let c = We(s[3]); if (!t.leadingZeros && i.length > 0 && n && r[2] !== ".") return e; if (!t.leadingZeros && i.length > 0 && !n && r[1] !== ".") return e; if (t.leadingZeros && i === e) return 0; { const f = Number(r), o = "" + f; return o.search(/[eE]/) !== -1 ? t.eNotation ? f : e : r.indexOf(".") !== -1 ? o === "0" && c === "" || o === c || n && o === "-" + c ? f : e : i ? c === o || n + c === o ? f : e : r === o || r === n + o ? f : e; } } else return e; } } function We(e) { return e && e.indexOf(".") !== -1 && (e = e.replace(/0+$/, ""), e === "." ? e = "0" : e[0] === "." ? e = "0" + e : e[e.length - 1] === "." && (e = e.substr(0, e.length - 1))), e; } function Je(e, t) { if (parseInt) return parseInt(e, t); if (Number.parseInt) return Number.parseInt(e, t); if (window && window.parseInt) return window.parseInt(e, t); throw new Error("parseInt, Number.parseInt, window.parseInt are not supported"); } function Qe(e) { return typeof e == "function" ? e : Array.isArray(e) ? (t) => { for (const r of e) if (typeof r == "string" && t === r || r instanceof RegExp && r.test(t)) return !0; } : () => !1; } class ze { constructor(t) { this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, // "lt" : { regex: /&(lt|#60);/g, val: "<" }, // "gt" : { regex: /&(gt|#62);/g, val: ">" }, // "amp" : { regex: /&(amp|#38);/g, val: "&" }, // "quot" : { regex: /&(quot|#34);/g, val: "\"" }, // "apos" : { regex: /&(apos|#39);/g, val: "'" }, cent: { regex: /&(cent|#162);/g, val: "¢" }, pound: { regex: /&(pound|#163);/g, val: "£" }, yen: { regex: /&(yen|#165);/g, val: "¥" }, euro: { regex: /&(euro|#8364);/g, val: "€" }, copyright: { regex: /&(copy|#169);/g, val: "©" }, reg: { regex: /&(reg|#174);/g, val: "®" }, inr: { regex: /&(inr|#8377);/g, val: "₹" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (r, s) => String.fromCodePoint(Number.parseInt(s, 10)) }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (r, s) => String.fromCodePoint(Number.parseInt(s, 16)) } }, this.addExternalEntities = He, this.parseXml = tt, this.parseTextData = Ke, this.resolveNameSpace = xe, this.buildAttributesMap = et, this.isItStopNode = it, this.replaceEntitiesValue = nt, this.readStopNodeData = ft, this.saveTextToParentTag = st, this.addChild = rt, this.ignoreAttributesFn = Qe(this.options.ignoreAttributes); } } function He(e) { const t = Object.keys(e); for (let r = 0; r < t.length; r++) { const s = t[r]; this.lastEntities[s] = { regex: new RegExp("&" + s + ";", "g"), val: e[s] }; } } function Ke(e, t, r, s, n, i, c) { if (e !== void 0 && (this.options.trimValues && !s && (e = e.trim()), e.length > 0)) { c || (e = this.replaceEntitiesValue(e)); const f = this.options.tagValueProcessor(t, e, r, n, i); return f == null ? e : typeof f != typeof e || f !== e ? f : this.options.trimValues ? Y(e, this.options.parseTagValue, this.options.numberParseOptions) : e.trim() === e ? Y(e, this.options.parseTagValue, this.options.numberParseOptions) : e; } } function xe(e) { if (this.options.removeNSPrefix) { const t = e.split(":"), r = e.charAt(0) === "/" ? "/" : ""; if (t[0] === "xmlns") return ""; t.length === 2 && (e = r + t[1]); } return e; } const De = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm"); function et(e, t, r) { if (this.options.ignoreAttributes !== !0 && typeof e == "string") { const s = ce(e, De), n = s.length, i = {}; for (let c = 0; c < n; c++) { const f = this.resolveNameSpace(s[c][1]); if (this.ignoreAttributesFn(f, t)) continue; let o = s[c][4], u = this.options.attributeNamePrefix + f; if (f.length) if (this.options.transformAttributeName && (u = this.options.transformAttributeName(u)), u === "__proto__" && (u = "#__proto__"), o !== void 0) { this.options.trimValues && (o = o.trim()), o = this.replaceEntitiesValue(o); const l = this.options.attributeValueProcessor(f, o, t); l == null ? i[u] = o : typeof l != typeof o || l !== o ? i[u] = l : i[u] = Y( o, this.options.parseAttributeValue, this.options.numberParseOptions ); } else this.options.allowBooleanAttributes && (i[u] = !0); } if (!Object.keys(i).length) return; if (this.options.attributesGroupName) { const c = {}; return c[this.options.attributesGroupName] = i, c; } return i; } } const tt = function(e) { e = e.replace(/\r\n?/g, ` `); const t = new P("!xml"); let r = t, s = "", n = ""; for (let i = 0; i < e.length; i++) if (e[i] === "<") if (e[i + 1] === "/") { const f = C(e, ">", i, "Closing Tag is not closed."); let o = e.substring(i + 2, f).trim(); if (this.options.removeNSPrefix) { const a = o.indexOf(":"); a !== -1 && (o = o.substr(a + 1)); } this.options.transformTagName && (o = this.options.transformTagName(o)), r && (s = this.saveTextToParentTag(s, r, n)); const u = n.substring(n.lastIndexOf(".") + 1); if (o && this.options.unpairedTags.indexOf(o) !== -1) throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`); let l = 0; u && this.options.unpairedTags.indexOf(u) !== -1 ? (l = n.lastIndexOf(".", n.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l = n.lastIndexOf("."), n = n.substring(0, l), r = this.tagsNodeStack.pop(), s = "", i = f; } else if (e[i + 1] === "?") { let f = X(e, i, !1, "?>"); if (!f) throw new Error("Pi Tag is not closed."); if (s = this.saveTextToParentTag(s, r, n), !(this.options.ignoreDeclaration && f.tagName === "?xml" || this.options.ignorePiTags)) { const o = new P(f.tagName); o.add(this.options.textNodeName, ""), f.tagName !== f.tagExp && f.attrExpPresent && (o[":@"] = this.buildAttributesMap(f.tagExp, n, f.tagName)), this.addChild(r, o, n, i); } i = f.closeIndex + 1; } else if (e.substr(i + 1, 3) === "!--") { const f = C(e, "-->", i + 4, "Comment is not closed."); if (this.options.commentPropName) { const o = e.substring(i + 4, f - 2); s = this.saveTextToParentTag(s, r, n), r.add(this.options.commentPropName, [{ [this.options.textNodeName]: o }]); } i = f; } else if (e.substr(i + 1, 2) === "!D") { const f = _e(e, i); this.docTypeEntities = f.entities, i = f.i; } else if (e.substr(i + 1, 2) === "![") { const f = C(e, "]]>", i, "CDATA is not closed.") - 2, o = e.substring(i + 9, f); s = this.saveTextToParentTag(s, r, n); let u = this.parseTextData(o, r.tagname, n, !0, !1, !0, !0); u == null && (u = ""), this.options.cdataPropName ? r.add(this.options.cdataPropName, [{ [this.options.textNodeName]: o }]) : r.add(this.options.textNodeName, u), i = f + 2; } else { let f = X(e, i, this.options.removeNSPrefix), o = f.tagName; const u = f.rawTagName; let l = f.tagExp, a = f.attrExpPresent, g = f.closeIndex; this.options.transformTagName && (o = this.options.transformTagName(o)), r && s && r.tagname !== "!xml" && (s = this.saveTextToParentTag(s, r, n, !1)); const N = r; N && this.options.unpairedTags.indexOf(N.tagname) !== -1 && (r = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), o !== t.tagname && (n += n ? "." + o : o); const p = i; if (this.isItStopNode(this.options.stopNodes, n, o)) { let d = ""; if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) o[o.length - 1] === "/" ? (o = o.substr(0, o.length - 1), n = n.substr(0, n.length - 1), l = o) : l = l.substr(0, l.length - 1), i = f.closeIndex; else if (this.options.unpairedTags.indexOf(o) !== -1) i = f.closeIndex; else { const E = this.readStopNodeData(e, u, g + 1); if (!E) throw new Error(`Unexpected end of ${u}`); i = E.i, d = E.tagContent; } const h = new P(o); o !== l && a && (h[":@"] = this.buildAttributesMap(l, n, o)), d && (d = this.parseTextData(d, o, n, !0, a, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), h.add(this.options.textNodeName, d), this.addChild(r, h, n, p); } else { if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) { o[o.length - 1] === "/" ? (o = o.substr(0, o.length - 1), n = n.substr(0, n.length - 1), l = o) : l = l.substr(0, l.length - 1), this.options.transformTagName && (o = this.options.transformTagName(o)); const d = new P(o); o !== l && a && (d[":@"] = this.buildAttributesMap(l, n, o)), this.addChild(r, d, n, p), n = n.substr(0, n.lastIndexOf(".")); } else { const d = new P(o); this.tagsNodeStack.push(r), o !== l && a && (d[":@"] = this.buildAttributesMap(l, n, o)), this.addChild(r, d, n, p), r = d; } s = "", i = g; } } else s += e[i]; return t.child; }; function rt(e, t, r, s) { this.options.captureMetaData || (s = void 0); const n = this.options.updateTag(t.tagname, r, t[":@"]); n === !1 || (typeof n == "string" && (t.tagname = n), e.addChild(t, s)); } const nt = function(e) { if (this.options.processEntities) { for (let t in this.docTypeEntities) { const r = this.docTypeEntities[t]; e = e.replace(r.regx, r.val); } for (let t in this.lastEntities) { const r = this.lastEntities[t]; e = e.replace(r.regex, r.val); } if (this.options.htmlEntities) for (let t in this.htmlEntities) { const r = this.htmlEntities[t]; e = e.replace(r.regex, r.val); } e = e.replace(this.ampEntity.regex, this.ampEntity.val); } return e; }; function st(e, t, r, s) { return e && (s === void 0 && (s = t.child.length === 0), e = this.parseTextData( e, t.tagname, r, !1, t[":@"] ? Object.keys(t[":@"]).length !== 0 : !1, s ), e !== void 0 && e !== "" && t.add(this.options.textNodeName, e), e = ""), e; } function it(e, t, r) { const s = "*." + r; for (const n in e) { const i = e[n]; if (s === i || t === i) return !0; } return !1; } function ot(e, t, r = ">") { let s, n = ""; for (let i = t; i < e.length; i++) { let c = e[i]; if (s) c === s && (s = ""); else if (c === '"' || c === "'") s = c; else if (c === r[0]) if (r[1]) { if (e[i + 1] === r[1]) return { data: n, index: i }; } else return { data: n, index: i }; else c === " " && (c = " "); n += c; } } function C(e, t, r, s) { const n = e.indexOf(t, r); if (n === -1) throw new Error(s); return n + t.length - 1; } function X(e, t, r, s = ">") { const n = ot(e, t + 1, s); if (!n) return; let i = n.data; const c = n.index, f = i.search(/\s/); let o = i, u = !0; f !== -1 && (o = i.substring(0, f), i = i.substring(f + 1).trimStart()); const l = o; if (r) { const a = o.indexOf(":"); a !== -1 && (o = o.substr(a + 1), u = o !== n.data.substr(a + 1)); } return { tagName: o, tagExp: i, closeIndex: c, attrExpPresent: u, rawTagName: l }; } function ft(e, t, r) { const s = r; let n = 1; for (; r < e.length; r++) if (e[r] === "<") if (e[r + 1] === "/") { const i = C(e, ">", r, `${t} is not closed`); if (e.substring(r + 2, i).trim() === t && (n--, n === 0)) return { tagContent: e.substring(s, r), i }; r = i; } else if (e[r + 1] === "?") r = C(e, "?>", r + 1, "StopNode is not closed."); else if (e.substr(r + 1, 3) === "!--") r = C(e, "-->", r + 3, "StopNode is not closed."); else if (e.substr(r + 1, 2) === "![") r = C(e, "]]>", r, "StopNode is not closed.") - 2; else { const i = X(e, r, ">"); i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && n++, r = i.closeIndex); } } function Y(e, t, r) { if (t && typeof e == "string") { const s = e.trim(); return s === "true" ? !0 : s === "false" ? !1 : Ge(e, r); } else return we(e) ? e : ""; } const q = P.getMetaDataSymbol(); function ct(e, t) { return ue(e, t); } function ue(e, t, r) { let s; const n = {}; for (let i = 0; i < e.length; i++) { const c = e[i], f = ut(c); let o = ""; if (r === void 0 ? o = f : o = r + "." + f, f === t.textNodeName) s === void 0 ? s = c[f] : s += "" + c[f]; else { if (f === void 0) continue; if (c[f]) { let u = ue(c[f], t, o); const l = at(u, t); c[q] !== void 0 && (u[q] = c[q]), c[":@"] ? lt(u, c[":@"], o, t) : Object.keys(u).length === 1 && u[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? u = u[t.textNodeName] : Object.keys(u).length === 0 && (t.alwaysCreateTextNode ? u[t.textNodeName] = "" : u = ""), n[f] !== void 0 && n.hasOwnProperty(f) ? (Array.isArray(n[f]) || (n[f] = [n[f]]), n[f].push(u)) : t.isArray(f, o, l) ? n[f] = [u] : n[f] = u; } } } return typeof s == "string" ? s.length > 0 && (n[t.textNodeName] = s) : s !== void 0 && (n[t.textNodeName] = s), n; } function ut(e) { const t = Object.keys(e); for (let r = 0; r < t.length; r++) { const s = t[r]; if (s !== ":@") return s; } } function lt(e, t, r, s) { if (t) { const n = Object.keys(t), i = n.length; for (let c = 0; c < i; c++) { const f = n[c]; s.isArray(f, r + "." + f, !0, !0) ? e[f] = [t[f]] : e[f] = t[f]; } } } function at(e, t) { const { textNodeName: r } = t, s = Object.keys(e).length; return !!(s === 0 || s === 1 && (e[r] || typeof e[r] == "boolean" || e[r] === 0)); } class le { constructor(t) { this.externalEntities = {}, this.options = ke(t); } /** * Parse XML dats to JS object * @param {string|Buffer} xmlData * @param {boolean|Object} validationOption */ parse(t, r) { if (typeof t != "string") if (t.toString) t = t.toString(); else throw new Error("XML data is accepted in String or Bytes[] form."); if (r) { r === !0 && (r = {}); const i = ve(t, r); if (i !== !0) throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`); } const s = new ze(this.options); s.addExternalEntities(this.externalEntities); const n = s.parseXml(t); return this.options.preserveOrder || n === void 0 ? n : ct(n, this.options); } /** * Add Entity which is not by default supported by this library * @param {string} key * @param {string} value */ addEntity(t, r) { if (r.indexOf("&") !== -1) throw new Error("Entity value can't have '&'"); if (t.indexOf("&") !== -1 || t.indexOf(";") !== -1) throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'"); if (r === "&") throw new Error("An entity with value '&' is not permitted"); this.externalEntities[t] = r; } /** * Returns a Symbol that can be used to access the metadata * property on a node. * * If Symbol is not available in the environment, an ordinary property is used * and the name of the property is here returned. * * The XMLMetaData property is only present when `captureMetaData` * is true in the options. */ static getMetaDataSymbol() { return P.getMetaDataSymbol(); } } const dt = new le({ ignoreAttributes: !1, attributeNamePrefix: "", allowBooleanAttributes: !0, parseTagValue: !1, parseAttributeValue: !1 }), St = (e) => { var c; const t = [], s = (c = dt.parse(`<root>${e}</root>`).root) == null ? void 0 : c.symbol, n = Array.isArray(s) ? s : s ? [s] : [], i = "icon_"; return n.forEach((f) => { const o = f.id; if (o) { const u = f.viewBox || "0 0 1024"; let l = e; const a = new RegExp(`<symbol[^>]*id=["']${o}["'][^>]*>([\\s\\S]*?)<\\/symbol>`, "i"), g = e.match(a); g && g[1] ? l = g[1].trim().replace(" ", "") : l = "", t.push({ code: o.replace(i, ""), viewBox: u, content: l }); } }), t; }; function B(e) { var t = new Error(e); return t.source = "ulid", t; } var J = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", k = J.length, re = Math.pow(2, 48) - 1, ht = 10, gt = 16; function pt(e) { var t = Math.floor(e() * k); return t === k && (t = k - 1), J.charAt(t); } function Et(e, t) { if (isNaN(e)) throw new Error(e + " must be a number"); if (e > re) throw B("cannot encode time greater than " + re); if (e < 0) throw B("time must be positive"); if (Number.isInteger(e) === !1) throw B("time must be an integer"); for (var r = void 0, s = ""; t > 0; t--) r = e % k, s = J.charAt(r) + s, e = (e - r) / k; return s; } function bt(e, t) { for (var r = ""; e > 0; e--) r = pt(t) + r; return r; } function Nt() { var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, t = arguments[1]; t || (t = typeof window < "u" ? window : null); var r = t && (t.crypto || t.msCrypto); if (r) return function() { var n = new Uint8Array(1); return r.getRandomValues(n), n[0] / 255; }; try { var s = require("crypto"); return function() { return s.randomBytes(1).readUInt8() / 255; }; } catch { } if (e) { try { console.error("secure crypto unusable, falling back to insecure Math.random()!"); } catch { } return function() { return Math.random(); }; } throw B("secure crypto unusable, insecure Math.random not allowed"); } function yt(e) { return e || (e = Nt()), function(r) { return isNaN(r) && (r = Date.now()), Et(r, ht) + bt(gt, e); }; } var ae = yt(); function wt(e, t) { const r = { isZero: (t == null ? void 0 : t.isZero) ?? !0, isFalse: (t == null ? void 0 : t.isFalse) ?? !0 }; return e == null || r.isFalse && (e === !1 || e === "false") || r.isZero && (e === 0 || e === "0") || !(e instanceof Date) && typeof e == "object" && Object.keys(e).length === 0 || typeof e == "string" && e.trim().length === 0; } function At(e, t) { const r = { isZero: (t == null ? void 0 : t.isZero) ?? !0, isFalse: (t == null ? void 0 : t.isFalse) ?? !0 }; return !wt(e, r); } function vt(e) { return e.replace(/([A-Z])/g, "-$1").toLowerCase(); } const L = (e) => { const t = /url\(#([^)]+)\)/, r = e.match(t); return r ? r[1] : void 0; }, Mt = (e) => { const t = /id="([^"]+)"/, r = e.match(t); return r ? r[1] : void 0; }, Q = (e, t) => e === "gradientUnits" ? `${e}="${t}"` : `${vt(e)}="${t}"`, Z = (e, t, r) => r && r.length > 0 ? [ `<${e} ${t.join(" ")}>`, ...r, `</${e}>` ] : [`<${e} ${t.join(" ")}/>`], It = new le({ ignoreAttributes: !1, attributeNamePrefix: "", allowBooleanAttributes: !0, parseTagValue: !1, parseAttributeValue: !1 }), Tt = (e) => { const r = It.parse(e).svg, s = r == null ? void 0 : r.viewBox, n = (r == null ? void 0 : r.fill) === "none", i = [], c = ["ellipse", "path", "circle", "g", "stop", "rect"], f = ["clipPath", "linearGradient"], o = /* @__PURE__ */ new Map(), u = []; r != null && r.defs && (Array.isArray(r.defs) ? r.defs : [r.defs]).forEach((N) => { N && f.forEach((p) => { const d = N[p]; if (!d) return; (Array.isArray(d) ? d : [d]).forEach((E) => { if (!E) return; const m = E.id, I = m ? `svg_def_${ae().toLowerCase()}` : void 0; o.set(m, I); const A = { tag: p, attr: { ...E, id: I }, children: [] }; c.forEach((H) => { const V = E[H]; V && (Array.isArray(V) ? V : [V]).forEach((he) => { A.children || (A.children = []), A.children.push({ tag: H, attr: { ...he } }); }); }), u.push(A); }); }); }); const l = (g) => { const N = g ? g["#name"] || g.tagName || Object.keys(g).find((h) => c.includes(h)) : void 0; if (!N) return { tag: "", attr: {} }; const p = { ...g }; if (delete p["#name"], delete p.tagName, c.forEach((h) => { p.hasOwnProperty(h) && delete p[h]; }), p.fill) if (p.fill.startsWith("url(#")) { const h = L(p.fill), E = o.get(h) ?? h; p.fill = `url(#${E})`; } else i.includes(p.fill) || i.push(p.fill); if (p["clip-path"] && p["clip-path"].startsWith("url(#")) { const h = L(p["clip-path"]), E = o.get(h) ?? h; p["clip-path"] = `url(#${E})`; } const d = []; return c.forEach((h) => { const E = g[h]; E && (Array.isArray(E) ? E : [E]).forEach((I) => { d.push(l({ ...I, "#name": h })); }); }), { tag: N, attr: p, ...d.length > 0 && { children: d } }; }, a = []; return r && c.forEach((g) => { const N = r[g]; N && (Array.isArray(N) ? N : [N]).forEach((d) => { const h = l({ ...d, "#name": g }); h.tag === "g" && !At(h.attr) ? a.push(...h.children || []) : a.push(h); }); }), { fillDiffColor: i, viewBox: s, content: a, defs: u, fillNone: n }; }; function z(e) { return Object.keys(e); } const de = (e, t) => e.flatMap((r) => { const { fillOpacity: s, stroke: n, ...i } = r.attr, c = z(i).map((o) => Q(o, i[o])), f = []; return t ? (s && f.push(`fill-opacity="${s}"`), n && f.push(`stroke="${n}"`)) : n && f.push('stroke="currentColor"'), Z(r.tag, [...c, ...f]); }), mt = (e, t) => e.flatMap((r) => { const { stop: s, rect: n, ...i } = r.attr, c = z(i).filter((o) => i[o] !== void 0 && i[o] !== null).map((o) => Q(String(o), i[o])), f = r.children ? de(r.children, t) : void 0; return Z(r.tag, c, f); }), $t = (e) => { const { fillDiffColor: t, content: r, defs: s, fillNone: n, viewBox: i } = Tt(e), f = t.filter((u, l, a) => u && a.indexOf(u) === l).length >= 2, o = r.flatMap((u) => { const { fill: l, fillOpacity: a, stroke: g, ...N } = u.attr, p = z(N).map((E) => Q(E, N[E])), d = oe(u.attr, f), h = u.children ? de(u.children, f) : void 0; return u.tag === "path" && g && n ? Z(u.tag, [...p, ...d, 'fill="none"'], h) : Z(u.tag, [...p, ...d], h); }); return { viewBox: i, defs: mt(s, f), content: o }; }, kt = (e, t) => { const r = ["clipPath", "linearGradient"], s = /* @__PURE__ */ new Map(), n = []; return e && (Array.isArray(e) ? e : [e]).forEach((c) => { c && r.forEach((f) => { const o = c[f]; if (!o) return; (Array.isArray(o) ? o : [o]).forEach((l) => { if (!l) return; const a = l.id, g = a ? `svg_def_${ae().toLowerCase()}` : void 0; s.set(a, g); const N = { tag: f, attr: { ...l, id: g }, children: [] }; t.forEach((p) => { const d = l[p]; d && (Array.isArray(d) ? d : [d]).forEach((E) => { N.children || (N.children = []), N.children.push({ tag: p, attr: { ...E } }); }); }), n.push(N); }); }); }), { defIdMap: s, defsContent: n }; }, Pt = (e, t, r) => { const s = e ? e["#name"] || e.tagName || Object.keys(e).find((c) => t.includes(c)) : void 0; if (!s) return { tag: "", attr: {} }; const n = { ...e }; if (delete n["#name"], delete n.tagName, t.forEach((c) => { n.hasOwnProperty(c) && delete n[c]; }), n.fill && typeof n.fill == "string" && n.fill.startsWith("url(#")) { const c = L(n.fill), f = r.get(c) ?? c; n.fill = `url(#${f})`; } if (n["clip-path"] && typeof n["clip-path"] == "string" && n["clip-path"].startsWith("url(#")) { const c = L(n["clip-path"]), f = r.get(c) ?? c; n["clip-path"] = `url(#${f})`; } const i = []; return t.forEach((c) => { const f = e[c]