UNPKG

design-token-inspector

Version:

UI components built for inspecting design tokens in a live application

1,695 lines (1,687 loc) 2.42 MB
var gN = Object.defineProperty; var p_ = (e) => { throw TypeError(e); }; var DN = (e, t, r) => t in e ? gN(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r; var Ge = (e, t, r) => DN(e, typeof t != "symbol" ? t + "" : t, r), Rb = (e, t, r) => t.has(e) || p_("Cannot " + r); var W = (e, t, r) => (Rb(e, t, "read from private field"), r ? r.call(e) : t.get(e)), St = (e, t, r) => t.has(e) ? p_("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), tt = (e, t, r, n) => (Rb(e, t, "write to private field"), n ? n.call(e, r) : t.set(e, r), r), mt = (e, t, r) => (Rb(e, t, "access private method"), r); var I1 = (e, t, r, n) => ({ set _(i) { tt(e, t, i, r); }, get _() { return W(e, t, n); } }); import * as qs from "react"; import ov, { createContext as bN, useContext as xN, useEffect as Hg, useState as Ff } from "react"; import { Form as kf, Row as A6, Col as Kg, Slider as vN, InputNumber as T6, ColorPicker as EN, Input as S6, Typography as C6, Flex as XE, Button as Vg, notification as _N } from "antd"; import Gg from "lodash"; import { createPortal as wN } from "react-dom"; function AN(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var B1 = { exports: {} }, md = {}; /** * @license React * react-jsx-runtime.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var f_; function TN() { if (f_) return md; f_ = 1; var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment"); function r(n, i, s) { var o = null; if (s !== void 0 && (o = "" + s), i.key !== void 0 && (o = "" + i.key), "key" in i) { s = {}; for (var l in i) l !== "key" && (s[l] = i[l]); } else s = i; return i = s.ref, { $$typeof: e, type: n, key: o, ref: i !== void 0 ? i : null, props: s }; } return md.Fragment = t, md.jsx = r, md.jsxs = r, md; } var yd = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var h_; function SN() { return h_ || (h_ = 1, process.env.NODE_ENV !== "production" && function() { function e(ne) { if (ne == null) return null; if (typeof ne == "function") return ne.$$typeof === ie ? null : ne.displayName || ne.name || null; if (typeof ne == "string") return ne; switch (ne) { case D: return "Fragment"; case E: return "Profiler"; case T: return "StrictMode"; case j: return "Suspense"; case k: return "SuspenseList"; case V: return "Activity"; } if (typeof ne == "object") switch (typeof ne.tag == "number" && console.error( "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue." ), ne.$$typeof) { case w: return "Portal"; case S: return (ne.displayName || "Context") + ".Provider"; case C: return (ne._context.displayName || "Context") + ".Consumer"; case F: var ue = ne.render; return ne = ne.displayName, ne || (ne = ue.displayName || ue.name || "", ne = ne !== "" ? "ForwardRef(" + ne + ")" : "ForwardRef"), ne; case M: return ue = ne.displayName || null, ue !== null ? ue : e(ne.type) || "Memo"; case O: ue = ne._payload, ne = ne._init; try { return e(ne(ue)); } catch { } } return null; } function t(ne) { return "" + ne; } function r(ne) { try { t(ne); var ue = !1; } catch { ue = !0; } if (ue) { ue = console; var K = ue.error, Z = typeof Symbol == "function" && Symbol.toStringTag && ne[Symbol.toStringTag] || ne.constructor.name || "Object"; return K.call( ue, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", Z ), t(ne); } } function n(ne) { if (ne === D) return "<>"; if (typeof ne == "object" && ne !== null && ne.$$typeof === O) return "<...>"; try { var ue = e(ne); return ue ? "<" + ue + ">" : "<...>"; } catch { return "<...>"; } } function i() { var ne = te.A; return ne === null ? null : ne.getOwner(); } function s() { return Error("react-stack-top-frame"); } function o(ne) { if (Fe.call(ne, "key")) { var ue = Object.getOwnPropertyDescriptor(ne, "key").get; if (ue && ue.isReactWarning) return !1; } return ne.key !== void 0; } function l(ne, ue) { function K() { Me || (Me = !0, console.error( "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", ue )); } K.isReactWarning = !0, Object.defineProperty(ne, "key", { get: K, configurable: !0 }); } function u() { var ne = e(this.type); return Ye[ne] || (Ye[ne] = !0, console.error( "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release." )), ne = this.props.ref, ne !== void 0 ? ne : null; } function y(ne, ue, K, Z, oe, ke, he, se) { return K = ke.ref, ne = { $$typeof: _, type: ne, key: ue, props: ke, _owner: oe }, (K !== void 0 ? K : null) !== null ? Object.defineProperty(ne, "ref", { enumerable: !1, get: u }) : Object.defineProperty(ne, "ref", { enumerable: !1, value: null }), ne._store = {}, Object.defineProperty(ne._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: 0 }), Object.defineProperty(ne, "_debugInfo", { configurable: !1, enumerable: !1, writable: !0, value: null }), Object.defineProperty(ne, "_debugStack", { configurable: !1, enumerable: !1, writable: !0, value: he }), Object.defineProperty(ne, "_debugTask", { configurable: !1, enumerable: !1, writable: !0, value: se }), Object.freeze && (Object.freeze(ne.props), Object.freeze(ne)), ne; } function h(ne, ue, K, Z, oe, ke, he, se) { var pe = ue.children; if (pe !== void 0) if (Z) if (Pe(pe)) { for (Z = 0; Z < pe.length; Z++) g(pe[Z]); Object.freeze && Object.freeze(pe); } else console.error( "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead." ); else g(pe); if (Fe.call(ue, "key")) { pe = e(ne); var De = Object.keys(ue).filter(function(Be) { return Be !== "key"; }); Z = 0 < De.length ? "{key: someKey, " + De.join(": ..., ") + ": ...}" : "{key: someKey}", Se[pe + Z] || (De = 0 < De.length ? "{" + De.join(": ..., ") + ": ...}" : "{}", console.error( `A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, Z, pe, De, pe ), Se[pe + Z] = !0); } if (pe = null, K !== void 0 && (r(K), pe = "" + K), o(ue) && (r(ue.key), pe = "" + ue.key), "key" in ue) { K = {}; for (var ge in ue) ge !== "key" && (K[ge] = ue[ge]); } else K = ue; return pe && l( K, typeof ne == "function" ? ne.displayName || ne.name || "Unknown" : ne ), y( ne, pe, ke, oe, i(), K, he, se ); } function g(ne) { typeof ne == "object" && ne !== null && ne.$$typeof === _ && ne._store && (ne._store.validated = 1); } var x = ov, _ = Symbol.for("react.transitional.element"), w = Symbol.for("react.portal"), D = Symbol.for("react.fragment"), T = Symbol.for("react.strict_mode"), E = Symbol.for("react.profiler"), C = Symbol.for("react.consumer"), S = Symbol.for("react.context"), F = Symbol.for("react.forward_ref"), j = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), M = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), V = Symbol.for("react.activity"), ie = Symbol.for("react.client.reference"), te = x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Fe = Object.prototype.hasOwnProperty, Pe = Array.isArray, Ae = console.createTask ? console.createTask : function() { return null; }; x = { "react-stack-bottom-frame": function(ne) { return ne(); } }; var Me, Ye = {}, re = x["react-stack-bottom-frame"].bind( x, s )(), le = Ae(n(s)), Se = {}; yd.Fragment = D, yd.jsx = function(ne, ue, K, Z, oe) { var ke = 1e4 > te.recentlyCreatedOwnerStacks++; return h( ne, ue, K, !1, Z, oe, ke ? Error("react-stack-top-frame") : re, ke ? Ae(n(ne)) : le ); }, yd.jsxs = function(ne, ue, K, Z, oe) { var ke = 1e4 > te.recentlyCreatedOwnerStacks++; return h( ne, ue, K, !0, Z, oe, ke ? Error("react-stack-top-frame") : re, ke ? Ae(n(ne)) : le ); }; }()), yd; } var d_; function CN() { return d_ || (d_ = 1, process.env.NODE_ENV === "production" ? B1.exports = TN() : B1.exports = SN()), B1.exports; } var Ar = CN(); const F6 = /* @__PURE__ */ bN({}); var $b = { exports: {} }; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ var m_; function FN() { return m_ || (m_ = 1, function(e) { (function() { var t = {}.hasOwnProperty; function r() { for (var s = "", o = 0; o < arguments.length; o++) { var l = arguments[o]; l && (s = i(s, n(l))); } return s; } function n(s) { if (typeof s == "string" || typeof s == "number") return s; if (typeof s != "object") return ""; if (Array.isArray(s)) return r.apply(null, s); if (s.toString !== Object.prototype.toString && !s.toString.toString().includes("[native code]")) return s.toString(); var o = ""; for (var l in s) t.call(s, l) && s[l] && (o = i(o, l)); return o; } function i(s, o) { return o ? s ? s + " " + o : s + o : s; } e.exports ? (r.default = r, e.exports = r) : window.classNames = r; })(); }($b)), $b.exports; } var kN = FN(); const PN = /* @__PURE__ */ AN(kN), NN = { aliceblue: "9ehhb", antiquewhite: "9sgk7", aqua: "1ekf", aquamarine: "4zsno", azure: "9eiv3", beige: "9lhp8", bisque: "9zg04", black: "0", blanchedalmond: "9zhe5", blue: "73", blueviolet: "5e31e", brown: "6g016", burlywood: "8ouiv", cadetblue: "3qba8", chartreuse: "4zshs", chocolate: "87k0u", coral: "9yvyo", cornflowerblue: "3xael", cornsilk: "9zjz0", crimson: "8l4xo", cyan: "1ekf", darkblue: "3v", darkcyan: "rkb", darkgoldenrod: "776yz", darkgray: "6mbhl", darkgreen: "jr4", darkgrey: "6mbhl", darkkhaki: "7ehkb", darkmagenta: "5f91n", darkolivegreen: "3bzfz", darkorange: "9yygw", darkorchid: "5z6x8", darkred: "5f8xs", darksalmon: "9441m", darkseagreen: "5lwgf", darkslateblue: "2th1n", darkslategray: "1ugcv", darkslategrey: "1ugcv", darkturquoise: "14up", darkviolet: "5rw7n", deeppink: "9yavn", deepskyblue: "11xb", dimgray: "442g9", dimgrey: "442g9", dodgerblue: "16xof", firebrick: "6y7tu", floralwhite: "9zkds", forestgreen: "1cisi", fuchsia: "9y70f", gainsboro: "8m8kc", ghostwhite: "9pq0v", goldenrod: "8j4f4", gold: "9zda8", gray: "50i2o", green: "pa8", greenyellow: "6senj", grey: "50i2o", honeydew: "9eiuo", hotpink: "9yrp0", indianred: "80gnw", indigo: "2xcoy", ivory: "9zldc", khaki: "9edu4", lavenderblush: "9ziet", lavender: "90c8q", lawngreen: "4vk74", lemonchiffon: "9zkct", lightblue: "6s73a", lightcoral: "9dtog", lightcyan: "8s1rz", lightgoldenrodyellow: "9sjiq", lightgray: "89jo3", lightgreen: "5nkwg", lightgrey: "89jo3", lightpink: "9z6wx", lightsalmon: "9z2ii", lightseagreen: "19xgq", lightskyblue: "5arju", lightslategray: "4nwk9", lightslategrey: "4nwk9", lightsteelblue: "6wau6", lightyellow: "9zlcw", lime: "1edc", limegreen: "1zcxe", linen: "9shk6", magenta: "9y70f", maroon: "4zsow", mediumaquamarine: "40eju", mediumblue: "5p", mediumorchid: "79qkz", mediumpurple: "5r3rv", mediumseagreen: "2d9ip", mediumslateblue: "4tcku", mediumspringgreen: "1di2", mediumturquoise: "2uabw", mediumvioletred: "7rn9h", midnightblue: "z980", mintcream: "9ljp6", mistyrose: "9zg0x", moccasin: "9zfzp", navajowhite: "9zest", navy: "3k", oldlace: "9wq92", olive: "50hz4", olivedrab: "472ub", orange: "9z3eo", orangered: "9ykg0", orchid: "8iu3a", palegoldenrod: "9bl4a", palegreen: "5yw0o", paleturquoise: "6v4ku", palevioletred: "8k8lv", papayawhip: "9zi6t", peachpuff: "9ze0p", peru: "80oqn", pink: "9z8wb", plum: "8nba5", powderblue: "6wgdi", purple: "4zssg", rebeccapurple: "3zk49", red: "9y6tc", rosybrown: "7cv4f", royalblue: "2jvtt", saddlebrown: "5fmkz", salmon: "9rvci", sandybrown: "9jn1c", seagreen: "1tdnb", seashell: "9zje6", sienna: "6973h", silver: "7ir40", skyblue: "5arjf", slateblue: "45e4t", slategray: "4e100", slategrey: "4e100", snow: "9zke2", springgreen: "1egv", steelblue: "2r1kk", tan: "87yx8", teal: "pds", thistle: "8ggk8", tomato: "9yqfb", turquoise: "2j4r4", violet: "9b10u", wheat: "9ld4j", white: "9zldr", whitesmoke: "9lhpx", yellow: "9zl6o", yellowgreen: "61fzm" }, Yn = Math.round; function Ub(e, t) { const r = e.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [], n = r.map((i) => parseFloat(i)); for (let i = 0; i < 3; i += 1) n[i] = t(n[i] || 0, r[i] || "", i); return r[3] ? n[3] = r[3].includes("%") ? n[3] / 100 : n[3] : n[3] = 1, n; } const y_ = (e, t, r) => r === 0 ? e : e / 100; function gd(e, t) { const r = t || 255; return e > r ? r : e < 0 ? 0 : e; } class gf { constructor(t) { /** * All FastColor objects are valid. So isValid is always true. This property is kept to be compatible with TinyColor. */ Ge(this, "isValid", !0); /** * Red, R in RGB */ Ge(this, "r", 0); /** * Green, G in RGB */ Ge(this, "g", 0); /** * Blue, B in RGB */ Ge(this, "b", 0); /** * Alpha/Opacity, A in RGBA/HSLA */ Ge(this, "a", 1); // HSV privates Ge(this, "_h"); Ge(this, "_s"); Ge(this, "_l"); Ge(this, "_v"); // intermediate variables to calculate HSL/HSV Ge(this, "_max"); Ge(this, "_min"); Ge(this, "_brightness"); function r(n) { return n[0] in t && n[1] in t && n[2] in t; } if (t) if (typeof t == "string") { let i = function(s) { return n.startsWith(s); }; const n = t.trim(); if (/^#?[A-F\d]{3,8}$/i.test(n)) this.fromHexString(n); else if (i("rgb")) this.fromRgbString(n); else if (i("hsl")) this.fromHslString(n); else if (i("hsv") || i("hsb")) this.fromHsvString(n); else { const s = NN[n.toLowerCase()]; s && this.fromHexString( // Convert 36 hex to 16 hex parseInt(s, 36).toString(16).padStart(6, "0") ); } } else if (t instanceof gf) this.r = t.r, this.g = t.g, this.b = t.b, this.a = t.a, this._h = t._h, this._s = t._s, this._l = t._l, this._v = t._v; else if (r("rgb")) this.r = gd(t.r), this.g = gd(t.g), this.b = gd(t.b), this.a = typeof t.a == "number" ? gd(t.a, 1) : 1; else if (r("hsl")) this.fromHsl(t); else if (r("hsv")) this.fromHsv(t); else throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(t)); } // ======================= Setter ======================= setR(t) { return this._sc("r", t); } setG(t) { return this._sc("g", t); } setB(t) { return this._sc("b", t); } setA(t) { return this._sc("a", t, 1); } setHue(t) { const r = this.toHsv(); return r.h = t, this._c(r); } // ======================= Getter ======================= /** * Returns the perceived luminance of a color, from 0-1. * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef */ getLuminance() { function t(s) { const o = s / 255; return o <= 0.03928 ? o / 12.92 : Math.pow((o + 0.055) / 1.055, 2.4); } const r = t(this.r), n = t(this.g), i = t(this.b); return 0.2126 * r + 0.7152 * n + 0.0722 * i; } getHue() { if (typeof this._h > "u") { const t = this.getMax() - this.getMin(); t === 0 ? this._h = 0 : this._h = Yn(60 * (this.r === this.getMax() ? (this.g - this.b) / t + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / t + 2 : (this.r - this.g) / t + 4)); } return this._h; } getSaturation() { if (typeof this._s > "u") { const t = this.getMax() - this.getMin(); t === 0 ? this._s = 0 : this._s = t / this.getMax(); } return this._s; } getLightness() { return typeof this._l > "u" && (this._l = (this.getMax() + this.getMin()) / 510), this._l; } getValue() { return typeof this._v > "u" && (this._v = this.getMax() / 255), this._v; } /** * Returns the perceived brightness of the color, from 0-255. * Note: this is not the b of HSB * @see http://www.w3.org/TR/AERT#color-contrast */ getBrightness() { return typeof this._brightness > "u" && (this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3), this._brightness; } // ======================== Func ======================== darken(t = 10) { const r = this.getHue(), n = this.getSaturation(); let i = this.getLightness() - t / 100; return i < 0 && (i = 0), this._c({ h: r, s: n, l: i, a: this.a }); } lighten(t = 10) { const r = this.getHue(), n = this.getSaturation(); let i = this.getLightness() + t / 100; return i > 1 && (i = 1), this._c({ h: r, s: n, l: i, a: this.a }); } /** * Mix the current color a given amount with another color, from 0 to 100. * 0 means no mixing (return current color). */ mix(t, r = 50) { const n = this._c(t), i = r / 100, s = (l) => (n[l] - this[l]) * i + this[l], o = { r: Yn(s("r")), g: Yn(s("g")), b: Yn(s("b")), a: Yn(s("a") * 100) / 100 }; return this._c(o); } /** * Mix the color with pure white, from 0 to 100. * Providing 0 will do nothing, providing 100 will always return white. */ tint(t = 10) { return this.mix({ r: 255, g: 255, b: 255, a: 1 }, t); } /** * Mix the color with pure black, from 0 to 100. * Providing 0 will do nothing, providing 100 will always return black. */ shade(t = 10) { return this.mix({ r: 0, g: 0, b: 0, a: 1 }, t); } onBackground(t) { const r = this._c(t), n = this.a + r.a * (1 - this.a), i = (s) => Yn((this[s] * this.a + r[s] * r.a * (1 - this.a)) / n); return this._c({ r: i("r"), g: i("g"), b: i("b"), a: n }); } // ======================= Status ======================= isDark() { return this.getBrightness() < 128; } isLight() { return this.getBrightness() >= 128; } // ======================== MISC ======================== equals(t) { return this.r === t.r && this.g === t.g && this.b === t.b && this.a === t.a; } clone() { return this._c(this); } // ======================= Format ======================= toHexString() { let t = "#"; const r = (this.r || 0).toString(16); t += r.length === 2 ? r : "0" + r; const n = (this.g || 0).toString(16); t += n.length === 2 ? n : "0" + n; const i = (this.b || 0).toString(16); if (t += i.length === 2 ? i : "0" + i, typeof this.a == "number" && this.a >= 0 && this.a < 1) { const s = Yn(this.a * 255).toString(16); t += s.length === 2 ? s : "0" + s; } return t; } /** CSS support color pattern */ toHsl() { return { h: this.getHue(), s: this.getSaturation(), l: this.getLightness(), a: this.a }; } /** CSS support color pattern */ toHslString() { const t = this.getHue(), r = Yn(this.getSaturation() * 100), n = Yn(this.getLightness() * 100); return this.a !== 1 ? `hsla(${t},${r}%,${n}%,${this.a})` : `hsl(${t},${r}%,${n}%)`; } /** Same as toHsb */ toHsv() { return { h: this.getHue(), s: this.getSaturation(), v: this.getValue(), a: this.a }; } toRgb() { return { r: this.r, g: this.g, b: this.b, a: this.a }; } toRgbString() { return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`; } toString() { return this.toRgbString(); } // ====================== Privates ====================== /** Return a new FastColor object with one channel changed */ _sc(t, r, n) { const i = this.clone(); return i[t] = gd(r, n), i; } _c(t) { return new this.constructor(t); } getMax() { return typeof this._max > "u" && (this._max = Math.max(this.r, this.g, this.b)), this._max; } getMin() { return typeof this._min > "u" && (this._min = Math.min(this.r, this.g, this.b)), this._min; } fromHexString(t) { const r = t.replace("#", ""); function n(i, s) { return parseInt(r[i] + r[s || i], 16); } r.length < 6 ? (this.r = n(0), this.g = n(1), this.b = n(2), this.a = r[3] ? n(3) / 255 : 1) : (this.r = n(0, 1), this.g = n(2, 3), this.b = n(4, 5), this.a = r[6] ? n(6, 7) / 255 : 1); } fromHsl({ h: t, s: r, l: n, a: i }) { if (this._h = t % 360, this._s = r, this._l = n, this.a = typeof i == "number" ? i : 1, r <= 0) { const x = Yn(n * 255); this.r = x, this.g = x, this.b = x; } let s = 0, o = 0, l = 0; const u = t / 60, y = (1 - Math.abs(2 * n - 1)) * r, h = y * (1 - Math.abs(u % 2 - 1)); u >= 0 && u < 1 ? (s = y, o = h) : u >= 1 && u < 2 ? (s = h, o = y) : u >= 2 && u < 3 ? (o = y, l = h) : u >= 3 && u < 4 ? (o = h, l = y) : u >= 4 && u < 5 ? (s = h, l = y) : u >= 5 && u < 6 && (s = y, l = h); const g = n - y / 2; this.r = Yn((s + g) * 255), this.g = Yn((o + g) * 255), this.b = Yn((l + g) * 255); } fromHsv({ h: t, s: r, v: n, a: i }) { this._h = t % 360, this._s = r, this._v = n, this.a = typeof i == "number" ? i : 1; const s = Yn(n * 255); if (this.r = s, this.g = s, this.b = s, r <= 0) return; const o = t / 60, l = Math.floor(o), u = o - l, y = Yn(n * (1 - r) * 255), h = Yn(n * (1 - r * u) * 255), g = Yn(n * (1 - r * (1 - u)) * 255); switch (l) { case 0: this.g = g, this.b = y; break; case 1: this.r = h, this.b = y; break; case 2: this.r = y, this.b = g; break; case 3: this.r = y, this.g = h; break; case 4: this.r = g, this.g = y; break; case 5: default: this.g = y, this.b = h; break; } } fromHsvString(t) { const r = Ub(t, y_); this.fromHsv({ h: r[0], s: r[1], v: r[2], a: r[3] }); } fromHslString(t) { const r = Ub(t, y_); this.fromHsl({ h: r[0], s: r[1], l: r[2], a: r[3] }); } fromRgbString(t) { const r = Ub(t, (n, i) => ( // Convert percentage to number. e.g. 50% -> 128 i.includes("%") ? Yn(n / 100 * 255) : n )); this.r = r[0], this.g = r[1], this.b = r[2], this.a = r[3]; } } const O1 = 2, g_ = 0.16, IN = 0.05, BN = 0.05, ON = 0.15, k6 = 5, P6 = 4, LN = [{ index: 7, amount: 15 }, { index: 6, amount: 25 }, { index: 5, amount: 30 }, { index: 5, amount: 45 }, { index: 5, amount: 65 }, { index: 5, amount: 85 }, { index: 4, amount: 90 }, { index: 3, amount: 95 }, { index: 2, amount: 97 }, { index: 1, amount: 98 }]; function D_(e, t, r) { let n; return Math.round(e.h) >= 60 && Math.round(e.h) <= 240 ? n = r ? Math.round(e.h) - O1 * t : Math.round(e.h) + O1 * t : n = r ? Math.round(e.h) + O1 * t : Math.round(e.h) - O1 * t, n < 0 ? n += 360 : n >= 360 && (n -= 360), n; } function b_(e, t, r) { if (e.h === 0 && e.s === 0) return e.s; let n; return r ? n = e.s - g_ * t : t === P6 ? n = e.s + g_ : n = e.s + IN * t, n > 1 && (n = 1), r && t === k6 && n > 0.1 && (n = 0.1), n < 0.06 && (n = 0.06), Math.round(n * 100) / 100; } function x_(e, t, r) { let n; return r ? n = e.v + BN * t : n = e.v - ON * t, n = Math.max(0, Math.min(1, n)), Math.round(n * 100) / 100; } function jN(e, t = {}) { const r = [], n = new gf(e), i = n.toHsv(); for (let s = k6; s > 0; s -= 1) { const o = new gf({ h: D_(i, s, !0), s: b_(i, s, !0), v: x_(i, s, !0) }); r.push(o); } r.push(n); for (let s = 1; s <= P6; s += 1) { const o = new gf({ h: D_(i, s), s: b_(i, s), v: x_(i, s) }); r.push(o); } return t.theme === "dark" ? LN.map(({ index: s, amount: o }) => new gf(t.backgroundColor || "#141414").mix(r[s], o).toHexString()) : r.map((s) => s.toHexString()); } const uv = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"]; uv.primary = uv[5]; function MN() { return !!(typeof window < "u" && window.document && window.document.createElement); } function RN(e, t) { if (!e) return !1; if (e.contains) return e.contains(t); let r = t; for (; r; ) { if (r === e) return !0; r = r.parentNode; } return !1; } const v_ = "data-rc-order", E_ = "data-rc-priority", $N = "rc-util-key", lv = /* @__PURE__ */ new Map(); function N6({ mark: e } = {}) { return e ? e.startsWith("data-") ? e : `data-${e}` : $N; } function YE(e) { return e.attachTo ? e.attachTo : document.querySelector("head") || document.body; } function UN(e) { return e === "queue" ? "prependQueue" : e ? "prepend" : "append"; } function QE(e) { return Array.from((lv.get(e) || e).children).filter((t) => t.tagName === "STYLE"); } function I6(e, t = {}) { if (!MN()) return null; const { csp: r, prepend: n, priority: i = 0 } = t, s = UN(n), o = s === "prependQueue", l = document.createElement("style"); l.setAttribute(v_, s), o && i && l.setAttribute(E_, `${i}`), r != null && r.nonce && (l.nonce = r == null ? void 0 : r.nonce), l.innerHTML = e; const u = YE(t), { firstChild: y } = u; if (n) { if (o) { const h = (t.styles || QE(u)).filter((g) => { if (!["prepend", "prependQueue"].includes(g.getAttribute(v_))) return !1; const x = Number(g.getAttribute(E_) || 0); return i >= x; }); if (h.length) return u.insertBefore(l, h[h.length - 1].nextSibling), l; } u.insertBefore(l, y); } else u.appendChild(l); return l; } function qN(e, t = {}) { let { styles: r } = t; return r || (r = QE(YE(t))), r.find((n) => n.getAttribute(N6(t)) === e); } function JN(e, t) { const r = lv.get(e); if (!r || !RN(document, r)) { const n = I6("", t), { parentNode: i } = n; lv.set(e, i), e.removeChild(n); } } function WN(e, t, r = {}) { var u, y, h; const n = YE(r), i = QE(n), s = { ...r, styles: i }; JN(n, s); const o = qN(t, s); if (o) return (u = s.csp) != null && u.nonce && o.nonce !== ((y = s.csp) == null ? void 0 : y.nonce) && (o.nonce = (h = s.csp) == null ? void 0 : h.nonce), o.innerHTML !== e && (o.innerHTML = e), o; const l = I6(e, s); return l.setAttribute(N6(s), t), l; } function B6(e) { var t; return (t = e == null ? void 0 : e.getRootNode) == null ? void 0 : t.call(e); } function zN(e) { return B6(e) instanceof ShadowRoot; } function HN(e) { return zN(e) ? B6(e) : null; } let cv = {}; const ZE = [], KN = (e) => { ZE.push(e); }; function VN(e, t) { if (process.env.NODE_ENV !== "production" && !e && console !== void 0) { const r = ZE.reduce((n, i) => i(n ?? "", "warning"), t); r && console.error(`Warning: ${r}`); } } function GN(e, t) { if (process.env.NODE_ENV !== "production" && !e && console !== void 0) { const r = ZE.reduce((n, i) => i(n ?? "", "note"), t); r && console.warn(`Note: ${r}`); } } function XN() { cv = {}; } function O6(e, t, r) { !t && !cv[r] && (e(!1, r), cv[r] = !0); } function B2(e, t) { O6(VN, e, t); } function YN(e, t) { O6(GN, e, t); } B2.preMessage = KN; B2.resetWarned = XN; B2.noteOnce = YN; function QN(e) { return e.replace(/-(.)/g, (t, r) => r.toUpperCase()); } function ZN(e, t) { B2(e, `[@ant-design/icons] ${t}`); } function __(e) { return typeof e == "object" && typeof e.name == "string" && typeof e.theme == "string" && (typeof e.icon == "object" || typeof e.icon == "function"); } function w_(e = {}) { return Object.keys(e).reduce((t, r) => { const n = e[r]; switch (r) { case "class": t.className = n, delete t.class; break; default: delete t[r], t[QN(r)] = n; } return t; }, {}); } function pv(e, t, r) { return r ? /* @__PURE__ */ ov.createElement(e.tag, { key: t, ...w_(e.attrs), ...r }, (e.children || []).map((n, i) => pv(n, `${t}-${e.tag}-${i}`))) : /* @__PURE__ */ ov.createElement(e.tag, { key: t, ...w_(e.attrs) }, (e.children || []).map((n, i) => pv(n, `${t}-${e.tag}-${i}`))); } function L6(e) { return jN(e)[0]; } function j6(e) { return e ? Array.isArray(e) ? e : [e] : []; } const eI = ` .anticon { display: inline-flex; align-items: center; color: inherit; font-style: normal; line-height: 0; text-align: center; text-transform: none; vertical-align: -0.125em; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .anticon > * { line-height: 1; } .anticon svg { display: inline-block; } .anticon::before { display: none; } .anticon .anticon-icon { display: block; } .anticon[tabindex] { cursor: pointer; } .anticon-spin::before, .anticon-spin { display: inline-block; -webkit-animation: loadingCircle 1s infinite linear; animation: loadingCircle 1s infinite linear; } @-webkit-keyframes loadingCircle { 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } @keyframes loadingCircle { 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } } `, tI = (e) => { const { csp: t, prefixCls: r, layer: n } = xN(F6); let i = eI; r && (i = i.replace(/anticon/g, r)), n && (i = `@layer ${n} { ${i} }`), Hg(() => { const s = e.current, o = HN(s); WN(i, "@ant-design-icons", { prepend: !n, csp: t, attachTo: o }); }, []); }, pm = { primaryColor: "#333", secondaryColor: "#E6E6E6", calculated: !1 }; function rI({ primaryColor: e, secondaryColor: t }) { pm.primaryColor = e, pm.secondaryColor = t || L6(e), pm.calculated = !!t; } function nI() { return { ...pm }; } const uh = (e) => { const { icon: t, className: r, onClick: n, style: i, primaryColor: s, secondaryColor: o, ...l } = e, u = qs.useRef(); let y = pm; if (s && (y = { primaryColor: s, secondaryColor: o || L6(s) }), tI(u), ZN(__(t), `icon should be icon definiton, but got ${t}`), !__(t)) return null; let h = t; return h && typeof h.icon == "function" && (h = { ...h, icon: h.icon(y.primaryColor, y.secondaryColor) }), pv(h.icon, `svg-${h.name}`, { className: r, onClick: n, style: i, "data-icon": h.name, width: "1em", height: "1em", fill: "currentColor", "aria-hidden": "true", ...l, ref: u }); }; uh.displayName = "IconReact"; uh.getTwoToneColors = nI; uh.setTwoToneColors = rI; function M6(e) { const [t, r] = j6(e); return uh.setTwoToneColors({ primaryColor: t, secondaryColor: r }); } function iI() { const e = uh.getTwoToneColors(); return e.calculated ? [e.primaryColor, e.secondaryColor] : e.primaryColor; } function fv() { return fv = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var r = arguments[t]; for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]); } return e; }, fv.apply(this, arguments); } M6(uv.primary); const Xc = /* @__PURE__ */ qs.forwardRef((e, t) => { const { // affect outter <i>...</i> className: r, // affect inner <svg>...</svg> icon: n, spin: i, rotate: s, tabIndex: o, onClick: l, // other twoToneColor: u, ...y } = e, { prefixCls: h = "anticon", rootClassName: g } = qs.useContext(F6), x = PN(g, h, { [`${h}-${n.name}`]: !!n.name, [`${h}-spin`]: !!i || n.name === "loading" }, r); let _ = o; _ === void 0 && l && (_ = -1); const w = s ? { msTransform: `rotate(${s}deg)`, transform: `rotate(${s}deg)` } : void 0, [D, T] = j6(u); return /* @__PURE__ */ qs.createElement("span", fv({ role: "img", "aria-label": n.name }, y, { ref: t, tabIndex: _, onClick: l, className: x }), /* @__PURE__ */ qs.createElement(uh, { icon: n, primaryColor: D, secondaryColor: T, style: w })); }); Xc.displayName = "AntdIcon"; Xc.getTwoToneColor = iI; Xc.setTwoToneColor = M6; var sI = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z" } }] }, name: "down", theme: "outlined" }; function hv() { return hv = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var r = arguments[t]; for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]); } return e; }, hv.apply(this, arguments); } const aI = (e, t) => /* @__PURE__ */ qs.createElement(Xc, hv({}, e, { ref: t, icon: sI })), R6 = /* @__PURE__ */ qs.forwardRef(aI); process.env.NODE_ENV !== "production" && (R6.displayName = "DownOutlined"); var oI = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" } }] }, name: "left", theme: "outlined" }; function dv() { return dv = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var r = arguments[t]; for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]); } return e; }, dv.apply(this, arguments); } const uI = (e, t) => /* @__PURE__ */ qs.createElement(Xc, dv({}, e, { ref: t, icon: oI })), $6 = /* @__PURE__ */ qs.forwardRef(uI); process.env.NODE_ENV !== "production" && ($6.displayName = "LeftOutlined"); var lI = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z" } }] }, name: "right", theme: "outlined" }; function mv() { return mv = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var r = arguments[t]; for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]); } return e; }, mv.apply(this, arguments); } const cI = (e, t) => /* @__PURE__ */ qs.createElement(Xc, mv({}, e, { ref: t, icon: lI })), U6 = /* @__PURE__ */ qs.forwardRef(cI); process.env.NODE_ENV !== "production" && (U6.displayName = "RightOutlined"); var pI = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M890.5 755.3L537.9 269.2c-12.8-17.6-39-17.6-51.7 0L133.5 755.3A8 8 0 00140 768h75c5.1 0 9.9-2.5 12.9-6.6L512 369.8l284.1 391.6c3 4.1 7.8 6.6 12.9 6.6h75c6.5 0 10.3-7.4 6.5-12.7z" } }] }, name: "up", theme: "outlined" }; function yv() { return yv = Object.assign ? Object.assign.bind() : function(e) { for (var t = 1; t < arguments.length; t++) { var r = arguments[t]; for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]); } return e; }, yv.apply(this, arguments); } const fI = (e, t) => /* @__PURE__ */ qs.createElement(Xc, yv({}, e, { ref: t, icon: pI })), q6 = /* @__PURE__ */ qs.forwardRef(fI); process.env.NODE_ENV !== "production" && (q6.displayName = "UpOutlined"); const hI = (e) => { const t = document.styleSheets, r = []; let n = 0; for (const i in t) { const s = t[i].cssRules; for (const o in s) { const l = s[o]; (e.matches(l.selectorText) || e.closest(l.selectorText)) && (r.push({ rule: l, indexInStylesheet: n }), n += 1); } } return r; }, dI = ({ rule: e, indexInStylesheet: t }) => { if (!e.cssText || !e.cssText.includes("var(")) return null; const r = /([\w-]+)\s*:\s*var\((--[\w-]+)\)/g, n = [...e.cssText.matchAll(r)].map((i) => ({ property: i[1], variableName: i[2] })); return { rule: e, indexInStylesheet: t, variables: n, selectors: e.selectorText.split(",") }; }, mI = (e, t) => { const r = document.querySelector(t); return r ? getComputedStyle(r).getPropertyValue(e) : ""; }, yI = (e, t) => { const r = []; for (const n of e.variables) for (const i of e.selectors) if (t.matches(i) || t.closest(i)) { const s = mI(n.variableName, i); r.push({ name: n.variableName, value: s, property: n.property, selector: { text: i, index: e.indexInStylesheet } }); } return r; }; function gI(e) { const t = (e.match(/#/g) || []).length, r = (e.match(/\.[\w-]+/g) || []).length, n = (e.match(/\[[^\]]+\]/g) || []).length, i = (e.match(/:(?!:)[^(\s]+/g) || []).length, s = (e.match(/(^|[\s>+~])\w+/g) || []).length, o = (e.match(/::[^\s]+/g) || []).length; return t * 100 + (r + n + i) * 10 + (s + o) * 1; } const DI = (e, t) => { const r = [], n = getComputedStyle(t), i = Gg.groupBy(e, "property"); for (const [s, o] of Object.entries( i )) { let l = o; if (s.startsWith("--") || n.getPropertyValue(s) == "" || (l = l.filter((g) => !g.selector.text.includes(":")), l.length === 0)) continue; const h = l.map((g) => ({ ...g, specificity: gI(g.selector.text) })).sort(function(g, x) { return g.specificity - x.specificity === 0 ? x.selector.index - g.selector.index : x.specificity - g.specificity; }).map( (g) => Gg.omit(g, "specificity") )[0]; r.push(h); } return r; }, bI = (e) => { const t = [], r = Gg.groupBy(e, "name"); for (const [n, i] of Object.entries(r)) { const s = i.reduce( (o, l) => (o.value = l.value, o.property = o.property && o.property !== l.property ? `${o.property}, ${l.property}` : l.property, o), { name: n, value: "", property: "", selector: { text: "", index: 0 } } ); t.push(s); } return t; }, xI = (e) => { const r = hI(e).map(dI).filter((o) => o !== null).flat(); if (r.length <= 0) return []; const n = r.flatMap( (o) => yI(o, e) ), i = DI(n, e); return bI(i); }, vI = ({ name: e, defaultValue: t, onChange: r }) => { const n = kf.useFormInstance(), i = kf.useWatch(e, { form: n, preserve: !0 }), s = (h) => { const g = parseFloat(h.replace(/^[^\d.-]+/, "")), x = h.replace(/^[\d.-]+/, "").trim(); return { value: g, suffix: x }; }, { value: o, suffix: l } = s( i || t ), { value: u } = s(t), y = (h) => { if (h === null) return; const g = `${h}${l || ""}`; i !== g && n.setFieldValue(e, g), r && r(e, g); }; return /* @__PURE__ */ Ar.jsxs(A6, { children: [ /* @__PURE__ */ Ar.jsx(Kg, { span: 14, children: /* @__PURE__ */ Ar.jsx( vN, { min: u / 2, max: u * 2, step: (u * 2 - u / 2) / 100, value: o, onChange: y } ) }), /* @__PURE__ */ Ar.jsx(Kg, { span: 10, children: /* @__PURE__ */ Ar.jsx( T6, { style: { margin: "0 16px" }, addonAfter: l, value: o, onChange: y } ) }) ] }); }, EI = (e, t, r) => /* @__PURE__ */ Ar.jsx(kf.Item, { name: t, initialValue: r, noStyle: !0, children: e }), _I = (e, t) => { const { value: r } = e; let n = null; if (typeof r == "string") if (r.startsWith("#") || r.startsWith("rgb")) n = /* @__PURE__ */ Ar.jsx(EN, { showText: !0, size: "small" }); else { if (!isNaN(parseFloat(r)) || r.endsWith("px") || r.endsWith("em") || r.endsWith("rem") || r.endsWith("vh") || r.endsWith("vw")) return /* @__PURE__ */ Ar.jsx( vI, { defaultValue: r, name: e.name, onChange: t } ); n = /* @__PURE__ */ Ar.jsx(S6, { defaultValue: r }); } else typeof r == "number" && (n = /* @__PURE__ */ Ar.jsx(T6, {})); return EI(n, e.name, r); }, { Text: wI } = C6, AI = (e, t = !1, r) => { const n = /* @__PURE__ */ Ar.jsxs(Ar.Fragment, { children: [ "(used in ", /* @__PURE__ */ Ar.jsx(wI, { strong: !0, children: e.property }), ")" ] }); return /* @__PURE__ */ Ar.jsxs("div", { children: [ e.formattedName ?? e.name, ":", " ", t && r ? /* @__PURE__ */ Ar.jsxs(Ar.Fragment, { children: [ n, " ", /* @__PURE__ */ Ar.jsx("br", {}), _I(e, r) ] }) : /* @__PURE__ */ Ar.jsxs(Ar.Fragment, { children: [ /* @__PURE__ */ Ar.jsx("code", { children: e.value }), " ", n ] }) ] }); }, qb = (e, t) => { document.documentElement.style.setProperty(e, t); }, { Text: TI } = C6, SI = () => { const [e, t] = Ff(null), [r, n] = Ff(!1), [i, s] = Ff(!1), [o] = kf.useForm(), l = (h) => { for (const [g, x] of Object.entries(h)) { if (typeof x == "object" && "toCssString" in x) { qb(g, x.toCssString()); continue; } qb(g, x); } }, u = () => { s(!1), n(!1); }, y = (h) => { if (!h) return /* @__PURE__ */ Ar.jsx("h4", { children: "No target selected " }); try { const g = h.tagName, x = xI(h); return /* @__PURE__ */ Ar.jsxs(Ar.Fragment, { children: [ /* @__PURE__ */ Ar.jsx(TI, { strong: !0, children: Gg.lowerCase(g) }), /* @__PURE__ */ Ar.jsxs( kf, { form: o, name: "variableValues", onValuesChange: l, onFinish: u, style: i ? { display: "flex", flexDirection: "column", gap: "2px" } : {}, children: [ x.map( (_) => AI( _, i, (w, D) => { qb(w, D); } ) ), /* @__PURE__ */ Ar.jsx("br", {}), /* @__PURE__ */ Ar.jsx(XE, { gap: 8, children: i ? /* @__PURE__ */ Ar.jsx(kf.Item, { noStyle: !0, children: /* @__PURE__ */ Ar.jsx( Vg, { color: "cyan", variant: "solid", size: "small", htmlType: "submit", children: "Save" } ) }) : null }) ] } ), r ? wN(/* @__PURE__ */ Ar.jsx("div", { className: "frozen-indicator" }), document.body) : null ] }); } catch (g) { console.log(g); } }; return Hg(() => { e && (r ? e.classList.add("token-details__selected-target--frozen") : e.classList.remove("token-details__selected-target--frozen")); }, [e, r]), Hg(() => { const h = (w) => { if (w.target instanceof HTMLElement && !(w.target.matches(".tokenInspector *") || w.target.matches("#unfreeze-button *"))) { if (w.preventDefault(), w.stopPropagation(), r) { if (w.target.matches(".token-details__selected-target")) { n(!1), u(); return; } return; } n(!0), s(!0); } }, g = (w, D, T) => { T || (w && w.classList.remove("token-details__selected-target"), D && (D.classList.add("token-details__selected-target"), document.querySelectorAll(".token-details__selected-target").forEach((E) => { E !== D && E.classList.remove("token-details__selected-target"); }), t(D))); }, x = (w) => { const D = w.target; D && !D.matches(".tokenInspector") && !D.matches(".tokenInspector *") && g(e, D, r); }, _ = (w) => { const D = w.target; D && !D.matches(".tokenInspector") && !D.matches(".tokenInspector *") && g(e, null, r); }; return document.addEventListener("mouseover", x), document.addEventListener("mouseout", _), document.addEventListener("click", h), () => { document.removeEventListener("mouseover", x), document.removeEventListener("mouseout", _), document.removeEventListener("click", h); }; }, [r, e]), y(e); }, e3 = () => { var e; return typeof window == "object" ? ( // @ts-expect-error some browsers support userAgentData.platform, not all though... ((e = window.navigator.userAgentData) == null ? void 0 : e.platform) === "Windows" || window.navigator.userAgent.includes("Windows") ) : (process == null ? void 0 : process.platform) === "win32"; }, CI = 65, FI = 97, kI = 90, PI = 122, fm = 46, pu = 47, J6 = 92, O2 = 58; e3(); function Jb(e, t = "and") { switch (e.length) { case 0: return ""; case 1: return `${e[0]}`; case 2: return `${e[0]} ${t} ${e[1]}`; case 3: return `${e[0]}, ${e[1]}, ${t} ${e[2]}`; default: return `${e.slice(0, -1).join(", ")}, ${t} ${e[e.length - 1]}`; } } const NI = [ "string", "function", "number", "object", // Accept 'Function' and 'Object' as alternative to the lower cased version. "Function", "Object", "boolean", "bigint", "symbol" ], II = /^[A-Z][a-zA-Z0-9]*$/; function BI(e, t, r) { Array.isArray(t) || (t = [t]); let n = "The "; if (e.endsWith(" argument")) n += `${e} `; else { const l = e.includes(".") ? "property" : "argument"; n += `"${e}" ${l} `; } n += "must be "; const i = [], s = [], o = []; for (const l of t) NI.includes(l) ? i.push(l.toLowerCase()) : II.exec(l) !== null ? s.push(l) : o.push(l); if (s.length > 0) { const l = i.indexOf("object"); l !== -1 && (i.splice(l, 1), s.push("Object")); } return i.length > 0 && (n += `${i.length > 1 ? "one of type" : "of type"} ${Jb(i, "or")}`, (s.length > 0 || o.length > 0) && (n += " or ")), s.length > 0 && (n += `an instance of ${Jb(s, "or")}`, o.length > 0 && (n += " or ")), o.length > 0 && (o.length > 1 ? n += `one of ${Jb(o, "or")}` : (o[0].toLowerCase() !== o[0] && (n += "an "), n += `${o[0]}`)), n += `. Received ${typeof r}`, n; } class nf extends Error { /** * @param {string} name * @param {string|string[]} expected * @param {*} actual */ constructor(t, r, n) { const i = BI(t, r, n); super(i), this.name = "ERR_INVALID_ARG_TYPE"; } } const A_ = 0, OI = 1, LI = 2, jI = 4, MI = (e, t, r = A_) => { if (r === A_) { if (e === null || Array.isArray(e)) throw new nf(t, "Object", e); if (typeof e != "object") throw new nf(t, "Object", e); } else { if ((OI & r) === 0 && e === null) throw new nf(t, "Object", e); if ((LI & r) === 0 && Array.isArray(e)) throw new nf(t, "Object", e); const s = (jI & r) === 0, o = typeof e; if (o !== "object" && (s || o !== "function")) throw new nf(t, "Object", e); } }, So = (e, t) => { if (typeof e != "string") throw new nf(t, "string", e); }; typeof window == "object" && (window.process || (window.process = {}), window.process.cwd = () => "/"); const RI = e3(); function rn(e) { return e === pu || e === J6; } function t3(e) { return e === pu; } function L2(e) { return e >= CI && e <= kI || e >= FI && e <= PI; } function j2(e, t, r, n) { let i = "", s = 0, o = -1, l = 0, u = 0; for (let y = 0; y <= e.length; ++y) { if (y < e.length) u = e.char