import { a as e, n as t } from './chunk-BneVvdWh.js';
import { S as n, n as r, r as i, t as a } from './iframe-B-AKBcwT.js';
import { r as o, t as s } from './chunk-CYSK6WYR-Dl8mvjKA.js';
import { a as c, c as l } from './theming-ugaMF2e3.js';
import { F as u, H as d, d as f, n as p, o as m, x as h } from './components-8pEjesIr.js';
function ee(e, t, { signal: n, edges: r } = {}) {
    let i,
        a = null,
        o = r != null && r.includes(`leading`),
        s = r == null || r.includes(`trailing`),
        c = () => {
            a !== null && (e.apply(i, a), (i = void 0), (a = null));
        },
        l = () => {
            (s && c(), p());
        },
        u = null,
        d = () => {
            (u != null && clearTimeout(u),
                (u = setTimeout(() => {
                    ((u = null), l());
                }, t)));
        },
        f = () => {
            u !== null && (clearTimeout(u), (u = null));
        },
        p = () => {
            (f(), (i = void 0), (a = null));
        },
        m = () => {
            c();
        },
        h = function (...e) {
            if (n?.aborted) return;
            ((i = this), (a = e));
            let t = u == null;
            (d(), o && t && c());
        };
    return (
        (h.schedule = d),
        (h.cancel = p),
        (h.flush = m),
        n?.addEventListener(`abort`, p, { once: !0 }),
        h
    );
}
function te(e, ...t) {
    return g(e, w, ...t);
}
function g(e, t, ...n) {
    let r = function (...r) {
        let i = 0,
            a = n.slice().map((e) => (e === t ? r[i++] : e)),
            o = r.slice(i);
        return e.apply(this, a.concat(o));
    };
    return (e.prototype && (r.prototype = Object.create(e.prototype)), r);
}
function ne(e, ...t) {
    return re(e, T, ...t);
}
function re(e, t, ...n) {
    let r = function (...r) {
        let i = n.filter((e) => e === t).length,
            a = Math.max(r.length - i, 0),
            o = r.slice(0, a),
            s = a,
            c = n.slice().map((e) => (e === t ? r[s++] : e));
        return e.apply(this, o.concat(c));
    };
    return (e.prototype && (r.prototype = Object.create(e.prototype)), r);
}
function _() {
    return (_ =
        Object.assign ||
        function (e) {
            for (var t = 1; t < arguments.length; t++) {
                var n = arguments[t];
                for (var r in n)
                    Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
            }
            return e;
        }).apply(this, arguments);
}
function v(e, t) {
    if (e == null) return {};
    var n,
        r,
        i = {},
        a = Object.keys(e);
    for (r = 0; r < a.length; r++) t.indexOf((n = a[r])) >= 0 || (i[n] = e[n]);
    return i;
}
function y(e) {
    var t = (0, x.useRef)(e),
        n = (0, x.useRef)(function (e) {
            t.current && t.current(e);
        });
    return ((t.current = e), n.current);
}
function ie(e, t, n) {
    var r = y(n),
        i = (0, x.useState)(function () {
            return e.toHsva(t);
        }),
        a = i[0],
        o = i[1],
        s = (0, x.useRef)({ color: t, hsva: a });
    return (
        (0, x.useEffect)(
            function () {
                if (!e.equal(t, s.current.color)) {
                    var n = e.toHsva(t);
                    ((s.current = { hsva: n, color: t }), o(n));
                }
            },
            [t, e],
        ),
        (0, x.useEffect)(
            function () {
                var t;
                H(a, s.current.hsva) ||
                    e.equal((t = e.fromHsva(a)), s.current.color) ||
                    ((s.current = { hsva: a, color: t }), r(t));
            },
            [a, e, r],
        ),
        [
            a,
            (0, x.useCallback)(function (e) {
                o(function (t) {
                    return Object.assign({}, t, e);
                });
            }, []),
        ]
    );
}
var b,
    x,
    ae,
    S,
    oe,
    C,
    w,
    T,
    E,
    D,
    O,
    se,
    ce,
    k,
    A,
    j,
    M,
    le,
    ue,
    N,
    de,
    fe,
    pe,
    me,
    P,
    F,
    I,
    L,
    he,
    R,
    ge,
    z,
    B,
    V,
    H,
    U,
    _e,
    ve,
    ye,
    be,
    W,
    G,
    xe,
    Se,
    Ce,
    we,
    K,
    Te,
    Ee,
    De,
    Oe,
    ke,
    Ae,
    je,
    Me,
    q,
    Ne,
    Pe,
    Fe,
    J,
    Y,
    Ie,
    Le,
    Re,
    X,
    ze,
    Be,
    Z,
    Ve,
    He,
    Ue,
    We,
    Q,
    Ge,
    Ke,
    $,
    qe,
    Je,
    Ye;
t(() => {
    (o(),
        i(),
        (b = e(n(), 1)),
        h(),
        d(),
        (x = e(n(), 1)),
        c(),
        (ae = a({
            '../../../node_modules/color-name/index.js'(e, t) {
                t.exports = {
                    aliceblue: [240, 248, 255],
                    antiquewhite: [250, 235, 215],
                    aqua: [0, 255, 255],
                    aquamarine: [127, 255, 212],
                    azure: [240, 255, 255],
                    beige: [245, 245, 220],
                    bisque: [255, 228, 196],
                    black: [0, 0, 0],
                    blanchedalmond: [255, 235, 205],
                    blue: [0, 0, 255],
                    blueviolet: [138, 43, 226],
                    brown: [165, 42, 42],
                    burlywood: [222, 184, 135],
                    cadetblue: [95, 158, 160],
                    chartreuse: [127, 255, 0],
                    chocolate: [210, 105, 30],
                    coral: [255, 127, 80],
                    cornflowerblue: [100, 149, 237],
                    cornsilk: [255, 248, 220],
                    crimson: [220, 20, 60],
                    cyan: [0, 255, 255],
                    darkblue: [0, 0, 139],
                    darkcyan: [0, 139, 139],
                    darkgoldenrod: [184, 134, 11],
                    darkgray: [169, 169, 169],
                    darkgreen: [0, 100, 0],
                    darkgrey: [169, 169, 169],
                    darkkhaki: [189, 183, 107],
                    darkmagenta: [139, 0, 139],
                    darkolivegreen: [85, 107, 47],
                    darkorange: [255, 140, 0],
                    darkorchid: [153, 50, 204],
                    darkred: [139, 0, 0],
                    darksalmon: [233, 150, 122],
                    darkseagreen: [143, 188, 143],
                    darkslateblue: [72, 61, 139],
                    darkslategray: [47, 79, 79],
                    darkslategrey: [47, 79, 79],
                    darkturquoise: [0, 206, 209],
                    darkviolet: [148, 0, 211],
                    deeppink: [255, 20, 147],
                    deepskyblue: [0, 191, 255],
                    dimgray: [105, 105, 105],
                    dimgrey: [105, 105, 105],
                    dodgerblue: [30, 144, 255],
                    firebrick: [178, 34, 34],
                    floralwhite: [255, 250, 240],
                    forestgreen: [34, 139, 34],
                    fuchsia: [255, 0, 255],
                    gainsboro: [220, 220, 220],
                    ghostwhite: [248, 248, 255],
                    gold: [255, 215, 0],
                    goldenrod: [218, 165, 32],
                    gray: [128, 128, 128],
                    green: [0, 128, 0],
                    greenyellow: [173, 255, 47],
                    grey: [128, 128, 128],
                    honeydew: [240, 255, 240],
                    hotpink: [255, 105, 180],
                    indianred: [205, 92, 92],
                    indigo: [75, 0, 130],
                    ivory: [255, 255, 240],
                    khaki: [240, 230, 140],
                    lavender: [230, 230, 250],
                    lavenderblush: [255, 240, 245],
                    lawngreen: [124, 252, 0],
                    lemonchiffon: [255, 250, 205],
                    lightblue: [173, 216, 230],
                    lightcoral: [240, 128, 128],
                    lightcyan: [224, 255, 255],
                    lightgoldenrodyellow: [250, 250, 210],
                    lightgray: [211, 211, 211],
                    lightgreen: [144, 238, 144],
                    lightgrey: [211, 211, 211],
                    lightpink: [255, 182, 193],
                    lightsalmon: [255, 160, 122],
                    lightseagreen: [32, 178, 170],
                    lightskyblue: [135, 206, 250],
                    lightslategray: [119, 136, 153],
                    lightslategrey: [119, 136, 153],
                    lightsteelblue: [176, 196, 222],
                    lightyellow: [255, 255, 224],
                    lime: [0, 255, 0],
                    limegreen: [50, 205, 50],
                    linen: [250, 240, 230],
                    magenta: [255, 0, 255],
                    maroon: [128, 0, 0],
                    mediumaquamarine: [102, 205, 170],
                    mediumblue: [0, 0, 205],
                    mediumorchid: [186, 85, 211],
                    mediumpurple: [147, 112, 219],
                    mediumseagreen: [60, 179, 113],
                    mediumslateblue: [123, 104, 238],
                    mediumspringgreen: [0, 250, 154],
                    mediumturquoise: [72, 209, 204],
                    mediumvioletred: [199, 21, 133],
                    midnightblue: [25, 25, 112],
                    mintcream: [245, 255, 250],
                    mistyrose: [255, 228, 225],
                    moccasin: [255, 228, 181],
                    navajowhite: [255, 222, 173],
                    navy: [0, 0, 128],
                    oldlace: [253, 245, 230],
                    olive: [128, 128, 0],
                    olivedrab: [107, 142, 35],
                    orange: [255, 165, 0],
                    orangered: [255, 69, 0],
                    orchid: [218, 112, 214],
                    palegoldenrod: [238, 232, 170],
                    palegreen: [152, 251, 152],
                    paleturquoise: [175, 238, 238],
                    palevioletred: [219, 112, 147],
                    papayawhip: [255, 239, 213],
                    peachpuff: [255, 218, 185],
                    peru: [205, 133, 63],
                    pink: [255, 192, 203],
                    plum: [221, 160, 221],
                    powderblue: [176, 224, 230],
                    purple: [128, 0, 128],
                    rebeccapurple: [102, 51, 153],
                    red: [255, 0, 0],
                    rosybrown: [188, 143, 143],
                    royalblue: [65, 105, 225],
                    saddlebrown: [139, 69, 19],
                    salmon: [250, 128, 114],
                    sandybrown: [244, 164, 96],
                    seagreen: [46, 139, 87],
                    seashell: [255, 245, 238],
                    sienna: [160, 82, 45],
                    silver: [192, 192, 192],
                    skyblue: [135, 206, 235],
                    slateblue: [106, 90, 205],
                    slategray: [112, 128, 144],
                    slategrey: [112, 128, 144],
                    snow: [255, 250, 250],
                    springgreen: [0, 255, 127],
                    steelblue: [70, 130, 180],
                    tan: [210, 180, 140],
                    teal: [0, 128, 128],
                    thistle: [216, 191, 216],
                    tomato: [255, 99, 71],
                    turquoise: [64, 224, 208],
                    violet: [238, 130, 238],
                    wheat: [245, 222, 179],
                    white: [255, 255, 255],
                    whitesmoke: [245, 245, 245],
                    yellow: [255, 255, 0],
                    yellowgreen: [154, 205, 50],
                };
            },
        })),
        (S = a({
            '../../../node_modules/color-convert/conversions.js'(e, t) {
                var n = ae(),
                    r = {};
                for (let e of Object.keys(n)) r[n[e]] = e;
                var i = {
                    rgb: { channels: 3, labels: `rgb` },
                    hsl: { channels: 3, labels: `hsl` },
                    hsv: { channels: 3, labels: `hsv` },
                    hwb: { channels: 3, labels: `hwb` },
                    cmyk: { channels: 4, labels: `cmyk` },
                    xyz: { channels: 3, labels: `xyz` },
                    lab: { channels: 3, labels: `lab` },
                    lch: { channels: 3, labels: `lch` },
                    hex: { channels: 1, labels: [`hex`] },
                    keyword: { channels: 1, labels: [`keyword`] },
                    ansi16: { channels: 1, labels: [`ansi16`] },
                    ansi256: { channels: 1, labels: [`ansi256`] },
                    hcg: { channels: 3, labels: [`h`, `c`, `g`] },
                    apple: { channels: 3, labels: [`r16`, `g16`, `b16`] },
                    gray: { channels: 1, labels: [`gray`] },
                };
                t.exports = i;
                for (let e of Object.keys(i)) {
                    if (!(`channels` in i[e]))
                        throw Error(`missing channels property: ` + e);
                    if (!(`labels` in i[e]))
                        throw Error(`missing channel labels property: ` + e);
                    if (i[e].labels.length !== i[e].channels)
                        throw Error(`channel and label counts mismatch: ` + e);
                    let { channels: t, labels: n } = i[e];
                    (delete i[e].channels,
                        delete i[e].labels,
                        Object.defineProperty(i[e], `channels`, { value: t }),
                        Object.defineProperty(i[e], `labels`, { value: n }));
                }
                ((i.rgb.hsl = function (e) {
                    let t = e[0] / 255,
                        n = e[1] / 255,
                        r = e[2] / 255,
                        i = Math.min(t, n, r),
                        a = Math.max(t, n, r),
                        o = a - i,
                        s,
                        c;
                    (a === i
                        ? (s = 0)
                        : t === a
                          ? (s = (n - r) / o)
                          : n === a
                            ? (s = 2 + (r - t) / o)
                            : r === a && (s = 4 + (t - n) / o),
                        (s = Math.min(s * 60, 360)),
                        s < 0 && (s += 360));
                    let l = (i + a) / 2;
                    return (
                        (c = a === i ? 0 : l <= 0.5 ? o / (a + i) : o / (2 - a - i)),
                        [s, c * 100, l * 100]
                    );
                }),
                    (i.rgb.hsv = function (e) {
                        let t,
                            n,
                            r,
                            i,
                            a,
                            o = e[0] / 255,
                            s = e[1] / 255,
                            c = e[2] / 255,
                            l = Math.max(o, s, c),
                            u = l - Math.min(o, s, c),
                            d = function (e) {
                                return (l - e) / 6 / u + 1 / 2;
                            };
                        return (
                            u === 0
                                ? ((i = 0), (a = 0))
                                : ((a = u / l),
                                  (t = d(o)),
                                  (n = d(s)),
                                  (r = d(c)),
                                  o === l
                                      ? (i = r - n)
                                      : s === l
                                        ? (i = 1 / 3 + t - r)
                                        : c === l && (i = 2 / 3 + n - t),
                                  i < 0 ? (i += 1) : i > 1 && --i),
                            [i * 360, a * 100, l * 100]
                        );
                    }),
                    (i.rgb.hwb = function (e) {
                        let t = e[0],
                            n = e[1],
                            r = e[2],
                            a = i.rgb.hsl(e)[0],
                            o = (1 / 255) * Math.min(t, Math.min(n, r));
                        return (
                            (r = 1 - (1 / 255) * Math.max(t, Math.max(n, r))),
                            [a, o * 100, r * 100]
                        );
                    }),
                    (i.rgb.cmyk = function (e) {
                        let t = e[0] / 255,
                            n = e[1] / 255,
                            r = e[2] / 255,
                            i = Math.min(1 - t, 1 - n, 1 - r),
                            a = (1 - t - i) / (1 - i) || 0,
                            o = (1 - n - i) / (1 - i) || 0,
                            s = (1 - r - i) / (1 - i) || 0;
                        return [a * 100, o * 100, s * 100, i * 100];
                    }));
                function a(e, t) {
                    return (e[0] - t[0]) ** 2 + (e[1] - t[1]) ** 2 + (e[2] - t[2]) ** 2;
                }
                ((i.rgb.keyword = function (e) {
                    let t = r[e];
                    if (t) return t;
                    let i = 1 / 0,
                        o;
                    for (let t of Object.keys(n)) {
                        let r = n[t],
                            s = a(e, r);
                        s < i && ((i = s), (o = t));
                    }
                    return o;
                }),
                    (i.keyword.rgb = function (e) {
                        return n[e];
                    }),
                    (i.rgb.xyz = function (e) {
                        let t = e[0] / 255,
                            n = e[1] / 255,
                            r = e[2] / 255;
                        ((t = t > 0.04045 ? ((t + 0.055) / 1.055) ** 2.4 : t / 12.92),
                            (n = n > 0.04045 ? ((n + 0.055) / 1.055) ** 2.4 : n / 12.92),
                            (r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92));
                        let i = t * 0.4124 + n * 0.3576 + r * 0.1805,
                            a = t * 0.2126 + n * 0.7152 + r * 0.0722,
                            o = t * 0.0193 + n * 0.1192 + r * 0.9505;
                        return [i * 100, a * 100, o * 100];
                    }),
                    (i.rgb.lab = function (e) {
                        let t = i.rgb.xyz(e),
                            n = t[0],
                            r = t[1],
                            a = t[2];
                        return (
                            (n /= 95.047),
                            (r /= 100),
                            (a /= 108.883),
                            (n = n > 0.008856 ? n ** (1 / 3) : 7.787 * n + 16 / 116),
                            (r = r > 0.008856 ? r ** (1 / 3) : 7.787 * r + 16 / 116),
                            (a = a > 0.008856 ? a ** (1 / 3) : 7.787 * a + 16 / 116),
                            [116 * r - 16, 500 * (n - r), 200 * (r - a)]
                        );
                    }),
                    (i.hsl.rgb = function (e) {
                        let t = e[0] / 360,
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i,
                            a,
                            o;
                        if (n === 0) return ((o = r * 255), [o, o, o]);
                        i = r < 0.5 ? r * (1 + n) : r + n - r * n;
                        let s = 2 * r - i,
                            c = [0, 0, 0];
                        for (let e = 0; e < 3; e++)
                            ((a = t + (1 / 3) * -(e - 1)),
                                a < 0 && a++,
                                a > 1 && a--,
                                (o =
                                    6 * a < 1
                                        ? s + (i - s) * 6 * a
                                        : 2 * a < 1
                                          ? i
                                          : 3 * a < 2
                                            ? s + (i - s) * (2 / 3 - a) * 6
                                            : s),
                                (c[e] = o * 255));
                        return c;
                    }),
                    (i.hsl.hsv = function (e) {
                        let t = e[0],
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i = n,
                            a = Math.max(r, 0.01);
                        ((r *= 2), (n *= r <= 1 ? r : 2 - r), (i *= a <= 1 ? a : 2 - a));
                        let o = (r + n) / 2;
                        return [
                            t,
                            (r === 0 ? (2 * i) / (a + i) : (2 * n) / (r + n)) * 100,
                            o * 100,
                        ];
                    }),
                    (i.hsv.rgb = function (e) {
                        let t = e[0] / 60,
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i = Math.floor(t) % 6,
                            a = t - Math.floor(t),
                            o = 255 * r * (1 - n),
                            s = 255 * r * (1 - n * a),
                            c = 255 * r * (1 - n * (1 - a));
                        switch (((r *= 255), i)) {
                            case 0:
                                return [r, c, o];
                            case 1:
                                return [s, r, o];
                            case 2:
                                return [o, r, c];
                            case 3:
                                return [o, s, r];
                            case 4:
                                return [c, o, r];
                            case 5:
                                return [r, o, s];
                        }
                    }),
                    (i.hsv.hsl = function (e) {
                        let t = e[0],
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i = Math.max(r, 0.01),
                            a,
                            o;
                        o = (2 - n) * r;
                        let s = (2 - n) * i;
                        return (
                            (a = n * i),
                            (a /= s <= 1 ? s : 2 - s),
                            (a ||= 0),
                            (o /= 2),
                            [t, a * 100, o * 100]
                        );
                    }),
                    (i.hwb.rgb = function (e) {
                        let t = e[0] / 360,
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i = n + r,
                            a;
                        i > 1 && ((n /= i), (r /= i));
                        let o = Math.floor(6 * t),
                            s = 1 - r;
                        ((a = 6 * t - o), o & 1 && (a = 1 - a));
                        let c = n + a * (s - n),
                            l,
                            u,
                            d;
                        switch (o) {
                            default:
                            case 6:
                            case 0:
                                ((l = s), (u = c), (d = n));
                                break;
                            case 1:
                                ((l = c), (u = s), (d = n));
                                break;
                            case 2:
                                ((l = n), (u = s), (d = c));
                                break;
                            case 3:
                                ((l = n), (u = c), (d = s));
                                break;
                            case 4:
                                ((l = c), (u = n), (d = s));
                                break;
                            case 5:
                                ((l = s), (u = n), (d = c));
                                break;
                        }
                        return [l * 255, u * 255, d * 255];
                    }),
                    (i.cmyk.rgb = function (e) {
                        let t = e[0] / 100,
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i = e[3] / 100,
                            a = 1 - Math.min(1, t * (1 - i) + i),
                            o = 1 - Math.min(1, n * (1 - i) + i),
                            s = 1 - Math.min(1, r * (1 - i) + i);
                        return [a * 255, o * 255, s * 255];
                    }),
                    (i.xyz.rgb = function (e) {
                        let t = e[0] / 100,
                            n = e[1] / 100,
                            r = e[2] / 100,
                            i,
                            a,
                            o;
                        return (
                            (i = t * 3.2406 + n * -1.5372 + r * -0.4986),
                            (a = t * -0.9689 + n * 1.8758 + r * 0.0415),
                            (o = t * 0.0557 + n * -0.204 + r * 1.057),
                            (i =
                                i > 0.0031308
                                    ? 1.055 * i ** (1 / 2.4) - 0.055
                                    : i * 12.92),
                            (a =
                                a > 0.0031308
                                    ? 1.055 * a ** (1 / 2.4) - 0.055
                                    : a * 12.92),
                            (o =
                                o > 0.0031308
                                    ? 1.055 * o ** (1 / 2.4) - 0.055
                                    : o * 12.92),
                            (i = Math.min(Math.max(0, i), 1)),
                            (a = Math.min(Math.max(0, a), 1)),
                            (o = Math.min(Math.max(0, o), 1)),
                            [i * 255, a * 255, o * 255]
                        );
                    }),
                    (i.xyz.lab = function (e) {
                        let t = e[0],
                            n = e[1],
                            r = e[2];
                        return (
                            (t /= 95.047),
                            (n /= 100),
                            (r /= 108.883),
                            (t = t > 0.008856 ? t ** (1 / 3) : 7.787 * t + 16 / 116),
                            (n = n > 0.008856 ? n ** (1 / 3) : 7.787 * n + 16 / 116),
                            (r = r > 0.008856 ? r ** (1 / 3) : 7.787 * r + 16 / 116),
                            [116 * n - 16, 500 * (t - n), 200 * (n - r)]
                        );
                    }),
                    (i.lab.xyz = function (e) {
                        let t = e[0],
                            n = e[1],
                            r = e[2],
                            i,
                            a,
                            o;
                        ((a = (t + 16) / 116), (i = n / 500 + a), (o = a - r / 200));
                        let s = a ** 3,
                            c = i ** 3,
                            l = o ** 3;
                        return (
                            (a = s > 0.008856 ? s : (a - 16 / 116) / 7.787),
                            (i = c > 0.008856 ? c : (i - 16 / 116) / 7.787),
                            (o = l > 0.008856 ? l : (o - 16 / 116) / 7.787),
                            (i *= 95.047),
                            (a *= 100),
                            (o *= 108.883),
                            [i, a, o]
                        );
                    }),
                    (i.lab.lch = function (e) {
                        let t = e[0],
                            n = e[1],
                            r = e[2],
                            i;
                        return (
                            (i = (Math.atan2(r, n) * 360) / 2 / Math.PI),
                            i < 0 && (i += 360),
                            [t, Math.sqrt(n * n + r * r), i]
                        );
                    }),
                    (i.lch.lab = function (e) {
                        let t = e[0],
                            n = e[1],
                            r = (e[2] / 360) * 2 * Math.PI;
                        return [t, n * Math.cos(r), n * Math.sin(r)];
                    }),
                    (i.rgb.ansi16 = function (e, t = null) {
                        let [n, r, a] = e,
                            o = t === null ? i.rgb.hsv(e)[2] : t;
                        if (((o = Math.round(o / 50)), o === 0)) return 30;
                        let s =
                            30 +
                            ((Math.round(a / 255) << 2) |
                                (Math.round(r / 255) << 1) |
                                Math.round(n / 255));
                        return (o === 2 && (s += 60), s);
                    }),
                    (i.hsv.ansi16 = function (e) {
                        return i.rgb.ansi16(i.hsv.rgb(e), e[2]);
                    }),
                    (i.rgb.ansi256 = function (e) {
                        let t = e[0],
                            n = e[1],
                            r = e[2];
                        return t === n && n === r
                            ? t < 8
                                ? 16
                                : t > 248
                                  ? 231
                                  : Math.round(((t - 8) / 247) * 24) + 232
                            : 16 +
                                  36 * Math.round((t / 255) * 5) +
                                  6 * Math.round((n / 255) * 5) +
                                  Math.round((r / 255) * 5);
                    }),
                    (i.ansi16.rgb = function (e) {
                        let t = e % 10;
                        if (t === 0 || t === 7)
                            return (
                                e > 50 && (t += 3.5), (t = (t / 10.5) * 255), [t, t, t]
                            );
                        let n = (~~(e > 50) + 1) * 0.5;
                        return [
                            (t & 1) * n * 255,
                            ((t >> 1) & 1) * n * 255,
                            ((t >> 2) & 1) * n * 255,
                        ];
                    }),
                    (i.ansi256.rgb = function (e) {
                        if (e >= 232) {
                            let t = (e - 232) * 10 + 8;
                            return [t, t, t];
                        }
                        e -= 16;
                        let t;
                        return [
                            (Math.floor(e / 36) / 5) * 255,
                            (Math.floor((t = e % 36) / 6) / 5) * 255,
                            ((t % 6) / 5) * 255,
                        ];
                    }),
                    (i.rgb.hex = function (e) {
                        let t = (
                            ((Math.round(e[0]) & 255) << 16) +
                            ((Math.round(e[1]) & 255) << 8) +
                            (Math.round(e[2]) & 255)
                        )
                            .toString(16)
                            .toUpperCase();
                        return `000000`.substring(t.length) + t;
                    }),
                    (i.hex.rgb = function (e) {
                        let t = e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
                        if (!t) return [0, 0, 0];
                        let n = t[0];
                        t[0].length === 3 &&
                            (n = n
                                .split(``)
                                .map((e) => e + e)
                                .join(``));
                        let r = parseInt(n, 16);
                        return [(r >> 16) & 255, (r >> 8) & 255, r & 255];
                    }),
                    (i.rgb.hcg = function (e) {
                        let t = e[0] / 255,
                            n = e[1] / 255,
                            r = e[2] / 255,
                            i = Math.max(Math.max(t, n), r),
                            a = Math.min(Math.min(t, n), r),
                            o = i - a,
                            s,
                            c;
                        return (
                            (s = o < 1 ? a / (1 - o) : 0),
                            (c =
                                o <= 0
                                    ? 0
                                    : i === t
                                      ? ((n - r) / o) % 6
                                      : i === n
                                        ? 2 + (r - t) / o
                                        : 4 + (t - n) / o),
                            (c /= 6),
                            (c %= 1),
                            [c * 360, o * 100, s * 100]
                        );
                    }),
                    (i.hsl.hcg = function (e) {
                        let t = e[1] / 100,
                            n = e[2] / 100,
                            r = n < 0.5 ? 2 * t * n : 2 * t * (1 - n),
                            i = 0;
                        return (
                            r < 1 && (i = (n - 0.5 * r) / (1 - r)),
                            [e[0], r * 100, i * 100]
                        );
                    }),
                    (i.hsv.hcg = function (e) {
                        let t = e[1] / 100,
                            n = e[2] / 100,
                            r = t * n,
                            i = 0;
                        return (
                            r < 1 && (i = (n - r) / (1 - r)), [e[0], r * 100, i * 100]
                        );
                    }),
                    (i.hcg.rgb = function (e) {
                        let t = e[0] / 360,
                            n = e[1] / 100,
                            r = e[2] / 100;
                        if (n === 0) return [r * 255, r * 255, r * 255];
                        let i = [0, 0, 0],
                            a = (t % 1) * 6,
                            o = a % 1,
                            s = 1 - o,
                            c = 0;
                        switch (Math.floor(a)) {
                            case 0:
                                ((i[0] = 1), (i[1] = o), (i[2] = 0));
                                break;
                            case 1:
                                ((i[0] = s), (i[1] = 1), (i[2] = 0));
                                break;
                            case 2:
                                ((i[0] = 0), (i[1] = 1), (i[2] = o));
                                break;
                            case 3:
                                ((i[0] = 0), (i[1] = s), (i[2] = 1));
                                break;
                            case 4:
                                ((i[0] = o), (i[1] = 0), (i[2] = 1));
                                break;
                            default:
                                ((i[0] = 1), (i[1] = 0), (i[2] = s));
                        }
                        return (
                            (c = (1 - n) * r),
                            [
                                (n * i[0] + c) * 255,
                                (n * i[1] + c) * 255,
                                (n * i[2] + c) * 255,
                            ]
                        );
                    }),
                    (i.hcg.hsv = function (e) {
                        let t = e[1] / 100,
                            n = t + (e[2] / 100) * (1 - t),
                            r = 0;
                        return (n > 0 && (r = t / n), [e[0], r * 100, n * 100]);
                    }),
                    (i.hcg.hsl = function (e) {
                        let t = e[1] / 100,
                            n = (e[2] / 100) * (1 - t) + 0.5 * t,
                            r = 0;
                        return (
                            n > 0 && n < 0.5
                                ? (r = t / (2 * n))
                                : n >= 0.5 && n < 1 && (r = t / (2 * (1 - n))),
                            [e[0], r * 100, n * 100]
                        );
                    }),
                    (i.hcg.hwb = function (e) {
                        let t = e[1] / 100,
                            n = t + (e[2] / 100) * (1 - t);
                        return [e[0], (n - t) * 100, (1 - n) * 100];
                    }),
                    (i.hwb.hcg = function (e) {
                        let t = e[1] / 100,
                            n = 1 - e[2] / 100,
                            r = n - t,
                            i = 0;
                        return (
                            r < 1 && (i = (n - r) / (1 - r)), [e[0], r * 100, i * 100]
                        );
                    }),
                    (i.apple.rgb = function (e) {
                        return [
                            (e[0] / 65535) * 255,
                            (e[1] / 65535) * 255,
                            (e[2] / 65535) * 255,
                        ];
                    }),
                    (i.rgb.apple = function (e) {
                        return [
                            (e[0] / 255) * 65535,
                            (e[1] / 255) * 65535,
                            (e[2] / 255) * 65535,
                        ];
                    }),
                    (i.gray.rgb = function (e) {
                        return [
                            (e[0] / 100) * 255,
                            (e[0] / 100) * 255,
                            (e[0] / 100) * 255,
                        ];
                    }),
                    (i.gray.hsl = function (e) {
                        return [0, 0, e[0]];
                    }),
                    (i.gray.hsv = i.gray.hsl),
                    (i.gray.hwb = function (e) {
                        return [0, 100, e[0]];
                    }),
                    (i.gray.cmyk = function (e) {
                        return [0, 0, 0, e[0]];
                    }),
                    (i.gray.lab = function (e) {
                        return [e[0], 0, 0];
                    }),
                    (i.gray.hex = function (e) {
                        let t = Math.round((e[0] / 100) * 255) & 255,
                            n = ((t << 16) + (t << 8) + t).toString(16).toUpperCase();
                        return `000000`.substring(n.length) + n;
                    }),
                    (i.rgb.gray = function (e) {
                        return [((e[0] + e[1] + e[2]) / 3 / 255) * 100];
                    }));
            },
        })),
        (oe = a({
            '../../../node_modules/color-convert/route.js'(e, t) {
                var n = S();
                function r() {
                    let e = {},
                        t = Object.keys(n);
                    for (let n = t.length, r = 0; r < n; r++)
                        e[t[r]] = { distance: -1, parent: null };
                    return e;
                }
                function i(e) {
                    let t = r(),
                        i = [e];
                    for (t[e].distance = 0; i.length; ) {
                        let e = i.pop(),
                            r = Object.keys(n[e]);
                        for (let n = r.length, a = 0; a < n; a++) {
                            let n = r[a],
                                o = t[n];
                            o.distance === -1 &&
                                ((o.distance = t[e].distance + 1),
                                (o.parent = e),
                                i.unshift(n));
                        }
                    }
                    return t;
                }
                function a(e, t) {
                    return function (n) {
                        return t(e(n));
                    };
                }
                function o(e, t) {
                    let r = [t[e].parent, e],
                        i = n[t[e].parent][e],
                        o = t[e].parent;
                    for (; t[o].parent; )
                        (r.unshift(t[o].parent),
                            (i = a(n[t[o].parent][o], i)),
                            (o = t[o].parent));
                    return ((i.conversion = r), i);
                }
                t.exports = function (e) {
                    let t = i(e),
                        n = {},
                        r = Object.keys(t);
                    for (let e = r.length, i = 0; i < e; i++) {
                        let e = r[i];
                        t[e].parent !== null && (n[e] = o(e, t));
                    }
                    return n;
                };
            },
        })),
        (C = r(
            a({
                '../../../node_modules/color-convert/index.js'(e, t) {
                    var n = S(),
                        r = oe(),
                        i = {},
                        a = Object.keys(n);
                    function o(e) {
                        let t = function (...t) {
                            let n = t[0];
                            return n == null ? n : (n.length > 1 && (t = n), e(t));
                        };
                        return (`conversion` in e && (t.conversion = e.conversion), t);
                    }
                    function s(e) {
                        let t = function (...t) {
                            let n = t[0];
                            if (n == null) return n;
                            n.length > 1 && (t = n);
                            let r = e(t);
                            if (typeof r == `object`)
                                for (let e = r.length, t = 0; t < e; t++)
                                    r[t] = Math.round(r[t]);
                            return r;
                        };
                        return (`conversion` in e && (t.conversion = e.conversion), t);
                    }
                    (a.forEach((e) => {
                        ((i[e] = {}),
                            Object.defineProperty(i[e], `channels`, {
                                value: n[e].channels,
                            }),
                            Object.defineProperty(i[e], `labels`, {
                                value: n[e].labels,
                            }));
                        let t = r(e);
                        Object.keys(t).forEach((n) => {
                            let r = t[n];
                            ((i[e][n] = s(r)), (i[e][n].raw = o(r)));
                        });
                    }),
                        (t.exports = i));
                },
            })(),
            1,
        )),
        (w = Symbol(`partial.placeholder`)),
        (te.placeholder = w),
        (T = Symbol(`partialRight.placeholder`)),
        (ne.placeholder = T),
        (E = function (e, t, n) {
            return (
                t === void 0 && (t = 0),
                n === void 0 && (n = 1),
                e > n ? n : e < t ? t : e
            );
        }),
        (D = function (e) {
            return `touches` in e;
        }),
        (O = function (e) {
            return (e && e.ownerDocument.defaultView) || self;
        }),
        (se = function (e, t, n) {
            var r = e.getBoundingClientRect(),
                i = D(t)
                    ? (function (e, t) {
                          for (var n = 0; n < e.length; n++)
                              if (e[n].identifier === t) return e[n];
                          return e[0];
                      })(t.touches, n)
                    : t;
            return {
                left: E((i.pageX - (r.left + O(e).pageXOffset)) / r.width),
                top: E((i.pageY - (r.top + O(e).pageYOffset)) / r.height),
            };
        }),
        (ce = function (e) {
            !D(e) && e.preventDefault();
        }),
        (k = x.memo(function (e) {
            var t = e.onMove,
                n = e.onKey,
                r = v(e, [`onMove`, `onKey`]),
                i = (0, x.useRef)(null),
                a = y(t),
                o = y(n),
                s = (0, x.useRef)(null),
                c = (0, x.useRef)(!1),
                l = (0, x.useMemo)(
                    function () {
                        var e = function (e) {
                                (ce(e),
                                    (D(e) ? e.touches.length > 0 : e.buttons > 0) &&
                                    i.current
                                        ? a(se(i.current, e, s.current))
                                        : n(!1));
                            },
                            t = function () {
                                return n(!1);
                            };
                        function n(n) {
                            var r = c.current,
                                a = O(i.current),
                                o = n ? a.addEventListener : a.removeEventListener;
                            (o(r ? `touchmove` : `mousemove`, e),
                                o(r ? `touchend` : `mouseup`, t));
                        }
                        return [
                            function (e) {
                                var t = e.nativeEvent,
                                    r = i.current;
                                if (
                                    r &&
                                    (ce(t),
                                    !(function (e, t) {
                                        return t && !D(e);
                                    })(t, c.current) && r)
                                ) {
                                    if (D(t)) {
                                        c.current = !0;
                                        var o = t.changedTouches || [];
                                        o.length && (s.current = o[0].identifier);
                                    }
                                    (r.focus(), a(se(r, t, s.current)), n(!0));
                                }
                            },
                            function (e) {
                                var t = e.which || e.keyCode;
                                t < 37 ||
                                    t > 40 ||
                                    (e.preventDefault(),
                                    o({
                                        left: t === 39 ? 0.05 : t === 37 ? -0.05 : 0,
                                        top: t === 40 ? 0.05 : t === 38 ? -0.05 : 0,
                                    }));
                            },
                            n,
                        ];
                    },
                    [o, a],
                ),
                u = l[0],
                d = l[1],
                f = l[2];
            return (
                (0, x.useEffect)(
                    function () {
                        return f;
                    },
                    [f],
                ),
                x.createElement(
                    `div`,
                    _({}, r, {
                        onTouchStart: u,
                        onMouseDown: u,
                        className: `react-colorful__interactive`,
                        ref: i,
                        onKeyDown: d,
                        tabIndex: 0,
                        role: `slider`,
                    }),
                )
            );
        })),
        (A = function (e) {
            return e.filter(Boolean).join(` `);
        }),
        (j = function (e) {
            var t = e.color,
                n = e.left,
                r = e.top,
                i = r === void 0 ? 0.5 : r,
                a = A([`react-colorful__pointer`, e.className]);
            return x.createElement(
                `div`,
                { className: a, style: { top: 100 * i + `%`, left: 100 * n + `%` } },
                x.createElement(`div`, {
                    className: `react-colorful__pointer-fill`,
                    style: { backgroundColor: t },
                }),
            );
        }),
        (M = function (e, t, n) {
            return (
                t === void 0 && (t = 0),
                n === void 0 && (n = 10 ** t),
                Math.round(n * e) / n
            );
        }),
        (le = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }),
        (ue = function (e) {
            return z(N(e));
        }),
        (N = function (e) {
            return (
                e[0] === `#` && (e = e.substring(1)),
                e.length < 6
                    ? {
                          r: parseInt(e[0] + e[0], 16),
                          g: parseInt(e[1] + e[1], 16),
                          b: parseInt(e[2] + e[2], 16),
                          a: e.length === 4 ? M(parseInt(e[3] + e[3], 16) / 255, 2) : 1,
                      }
                    : {
                          r: parseInt(e.substring(0, 2), 16),
                          g: parseInt(e.substring(2, 4), 16),
                          b: parseInt(e.substring(4, 6), 16),
                          a:
                              e.length === 8
                                  ? M(parseInt(e.substring(6, 8), 16) / 255, 2)
                                  : 1,
                      }
            );
        }),
        (de = function (e, t) {
            return (t === void 0 && (t = `deg`), Number(e) * (le[t] || 1));
        }),
        (fe = function (e) {
            var t =
                /hsla?\(?\s*(-?\d*\.?\d+)(deg|rad|grad|turn)?[,\s]+(-?\d*\.?\d+)%?[,\s]+(-?\d*\.?\d+)%?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(
                    e,
                );
            return t
                ? pe({
                      h: de(t[1], t[2]),
                      s: Number(t[3]),
                      l: Number(t[4]),
                      a: t[5] === void 0 ? 1 : Number(t[5]) / (t[6] ? 100 : 1),
                  })
                : { h: 0, s: 0, v: 0, a: 1 };
        }),
        (pe = function (e) {
            var t = e.s,
                n = e.l;
            return {
                h: e.h,
                s:
                    (t *= (n < 50 ? n : 100 - n) / 100) > 0
                        ? ((2 * t) / (n + t)) * 100
                        : 0,
                v: n + t,
                a: e.a,
            };
        }),
        (me = function (e) {
            return ge(L(e));
        }),
        (P = function (e) {
            var t = e.s,
                n = e.v,
                r = e.a,
                i = ((200 - t) * n) / 100;
            return {
                h: M(e.h),
                s: M(
                    i > 0 && i < 200
                        ? ((t * n) / 100 / (i <= 100 ? i : 200 - i)) * 100
                        : 0,
                ),
                l: M(i / 2),
                a: M(r, 2),
            };
        }),
        (F = function (e) {
            var t = P(e);
            return `hsl(` + t.h + `, ` + t.s + `%, ` + t.l + `%)`;
        }),
        (I = function (e) {
            var t = P(e);
            return `hsla(` + t.h + `, ` + t.s + `%, ` + t.l + `%, ` + t.a + `)`;
        }),
        (L = function (e) {
            var t = e.h,
                n = e.s,
                r = e.v,
                i = e.a;
            ((t = (t / 360) * 6), (n /= 100), (r /= 100));
            var a = Math.floor(t),
                o = r * (1 - n),
                s = r * (1 - (t - a) * n),
                c = r * (1 - (1 - t + a) * n),
                l = a % 6;
            return {
                r: M(255 * [r, s, o, o, c, r][l]),
                g: M(255 * [c, r, r, s, o, o][l]),
                b: M(255 * [o, o, c, r, r, s][l]),
                a: M(i, 2),
            };
        }),
        (he = function (e) {
            var t =
                /rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(
                    e,
                );
            return t
                ? z({
                      r: Number(t[1]) / (t[2] ? 100 / 255 : 1),
                      g: Number(t[3]) / (t[4] ? 100 / 255 : 1),
                      b: Number(t[5]) / (t[6] ? 100 / 255 : 1),
                      a: t[7] === void 0 ? 1 : Number(t[7]) / (t[8] ? 100 : 1),
                  })
                : { h: 0, s: 0, v: 0, a: 1 };
        }),
        (R = function (e) {
            var t = e.toString(16);
            return t.length < 2 ? `0` + t : t;
        }),
        (ge = function (e) {
            var t = e.r,
                n = e.g,
                r = e.b,
                i = e.a,
                a = i < 1 ? R(M(255 * i)) : ``;
            return `#` + R(t) + R(n) + R(r) + a;
        }),
        (z = function (e) {
            var t = e.r,
                n = e.g,
                r = e.b,
                i = e.a,
                a = Math.max(t, n, r),
                o = a - Math.min(t, n, r),
                s = o
                    ? a === t
                        ? (n - r) / o
                        : a === n
                          ? 2 + (r - t) / o
                          : 4 + (t - n) / o
                    : 0;
            return {
                h: M(60 * (s < 0 ? s + 6 : s)),
                s: M(a ? (o / a) * 100 : 0),
                v: M((a / 255) * 100),
                a: i,
            };
        }),
        (B = x.memo(function (e) {
            var t = e.hue,
                n = e.onChange,
                r = A([`react-colorful__hue`, e.className]);
            return x.createElement(
                `div`,
                { className: r },
                x.createElement(
                    k,
                    {
                        onMove: function (e) {
                            n({ h: 360 * e.left });
                        },
                        onKey: function (e) {
                            n({ h: E(t + 360 * e.left, 0, 360) });
                        },
                        'aria-label': `Hue`,
                        'aria-valuenow': M(t),
                        'aria-valuemax': `360`,
                        'aria-valuemin': `0`,
                    },
                    x.createElement(j, {
                        className: `react-colorful__hue-pointer`,
                        left: t / 360,
                        color: F({ h: t, s: 100, v: 100, a: 1 }),
                    }),
                ),
            );
        })),
        (V = x.memo(function (e) {
            var t = e.hsva,
                n = e.onChange,
                r = { backgroundColor: F({ h: t.h, s: 100, v: 100, a: 1 }) };
            return x.createElement(
                `div`,
                { className: `react-colorful__saturation`, style: r },
                x.createElement(
                    k,
                    {
                        onMove: function (e) {
                            n({ s: 100 * e.left, v: 100 - 100 * e.top });
                        },
                        onKey: function (e) {
                            n({
                                s: E(t.s + 100 * e.left, 0, 100),
                                v: E(t.v - 100 * e.top, 0, 100),
                            });
                        },
                        'aria-label': `Color`,
                        'aria-valuetext':
                            `Saturation ` + M(t.s) + `%, Brightness ` + M(t.v) + `%`,
                    },
                    x.createElement(j, {
                        className: `react-colorful__saturation-pointer`,
                        top: 1 - t.v / 100,
                        left: t.s / 100,
                        color: F(t),
                    }),
                ),
            );
        })),
        (H = function (e, t) {
            if (e === t) return !0;
            for (var n in e) if (e[n] !== t[n]) return !1;
            return !0;
        }),
        (U = function (e, t) {
            return e.replace(/\s/g, ``) === t.replace(/\s/g, ``);
        }),
        (_e = function (e, t) {
            return e.toLowerCase() === t.toLowerCase() || H(N(e), N(t));
        }),
        (ye = typeof window < `u` ? x.useLayoutEffect : x.useEffect),
        (be = function () {
            return ve || (typeof __webpack_nonce__ < `u` ? __webpack_nonce__ : void 0);
        }),
        (W = new Map()),
        (G = function (e) {
            ye(function () {
                var t = e.current ? e.current.ownerDocument : document;
                if (t !== void 0 && !W.has(t)) {
                    var n = t.createElement(`style`);
                    ((n.innerHTML = `.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`),
                        W.set(t, n));
                    var r = be();
                    (r && n.setAttribute(`nonce`, r), t.head.appendChild(n));
                }
            }, []);
        }),
        (xe = function (e) {
            var t = e.className,
                n = e.colorModel,
                r = e.color,
                i = r === void 0 ? n.defaultColor : r,
                a = e.onChange,
                o = v(e, [`className`, `colorModel`, `color`, `onChange`]),
                s = (0, x.useRef)(null);
            G(s);
            var c = ie(n, i, a),
                l = c[0],
                u = c[1],
                d = A([`react-colorful`, t]);
            return x.createElement(
                `div`,
                _({}, o, { ref: s, className: d }),
                x.createElement(V, { hsva: l, onChange: u }),
                x.createElement(B, {
                    hue: l.h,
                    onChange: u,
                    className: `react-colorful__last-control`,
                }),
            );
        }),
        (Se = {
            defaultColor: `000`,
            toHsva: ue,
            fromHsva: function (e) {
                return me({ h: e.h, s: e.s, v: e.v, a: 1 });
            },
            equal: _e,
        }),
        (Ce = function (e) {
            return x.createElement(xe, _({}, e, { colorModel: Se }));
        }),
        (we = function (e) {
            var t = e.className,
                n = e.hsva,
                r = e.onChange,
                i = {
                    backgroundImage:
                        `linear-gradient(90deg, ` +
                        I(Object.assign({}, n, { a: 0 })) +
                        `, ` +
                        I(Object.assign({}, n, { a: 1 })) +
                        `)`,
                },
                a = A([`react-colorful__alpha`, t]),
                o = M(100 * n.a);
            return x.createElement(
                `div`,
                { className: a },
                x.createElement(`div`, {
                    className: `react-colorful__alpha-gradient`,
                    style: i,
                }),
                x.createElement(
                    k,
                    {
                        onMove: function (e) {
                            r({ a: e.left });
                        },
                        onKey: function (e) {
                            r({ a: E(n.a + e.left) });
                        },
                        'aria-label': `Alpha`,
                        'aria-valuetext': o + `%`,
                        'aria-valuenow': o,
                        'aria-valuemin': `0`,
                        'aria-valuemax': `100`,
                    },
                    x.createElement(j, {
                        className: `react-colorful__alpha-pointer`,
                        left: n.a,
                        color: I(n),
                    }),
                ),
            );
        }),
        (K = function (e) {
            var t = e.className,
                n = e.colorModel,
                r = e.color,
                i = r === void 0 ? n.defaultColor : r,
                a = e.onChange,
                o = v(e, [`className`, `colorModel`, `color`, `onChange`]),
                s = (0, x.useRef)(null);
            G(s);
            var c = ie(n, i, a),
                l = c[0],
                u = c[1],
                d = A([`react-colorful`, t]);
            return x.createElement(
                `div`,
                _({}, o, { ref: s, className: d }),
                x.createElement(V, { hsva: l, onChange: u }),
                x.createElement(B, { hue: l.h, onChange: u }),
                x.createElement(we, {
                    hsva: l,
                    onChange: u,
                    className: `react-colorful__last-control`,
                }),
            );
        }),
        (Te = { defaultColor: `hsla(0, 0%, 0%, 1)`, toHsva: fe, fromHsva: I, equal: U }),
        (Ee = function (e) {
            return x.createElement(K, _({}, e, { colorModel: Te }));
        }),
        (De = {
            defaultColor: `rgba(0, 0, 0, 1)`,
            toHsva: he,
            fromHsva: function (e) {
                var t = L(e);
                return `rgba(` + t.r + `, ` + t.g + `, ` + t.b + `, ` + t.a + `)`;
            },
            equal: U,
        }),
        (Oe = function (e) {
            return x.createElement(K, _({}, e, { colorModel: De }));
        }),
        (ke = l.div({ position: `relative`, maxWidth: 250 })),
        (Ae = l.div({
            width: 200,
            margin: 5,
            '.react-colorful__saturation': { borderRadius: `4px 4px 0 0` },
            '.react-colorful__hue': { boxShadow: `inset 0 0 0 1px rgb(0 0 0 / 5%)` },
            '.react-colorful__last-control': { borderRadius: `0 0 4px 4px` },
        })),
        (je = l.div({
            display: `grid`,
            gridTemplateColumns: `repeat(9, 16px)`,
            gap: 6,
            padding: 3,
            marginTop: 5,
            width: 200,
        })),
        (Me = (e) =>
            `url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity="0.05" fill="${e ? `white` : `black`}"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')`),
        (q = l(p)(({ value: e, selected: t, theme: n }) => ({
            width: 16,
            height: 16,
            boxShadow: t
                ? `${n.appBorderColor} 0 0 0 1px inset, ${n.textMutedColor}50 0 0 0 4px`
                : `${n.appBorderColor} 0 0 0 1px inset`,
            border: `none`,
            borderRadius: n.appBorderRadius,
            '&, &:hover': {
                background: `unset`,
                backgroundColor: `unset`,
                backgroundImage: `linear-gradient(${e}, ${e}), ${Me(n.base === `dark`)}`,
            },
        }))),
        (Ne = l(m.Input)(({ theme: e }) => ({
            width: `100%`,
            paddingLeft: 30,
            paddingRight: 30,
            boxSizing: `border-box`,
            fontFamily: e.typography.fonts.base,
            '[aria-readonly="true"] > &': {
                background: e.base === `light` ? e.color.lighter : `transparent`,
            },
        }))),
        (Pe = l(q)(({ disabled: e }) => ({
            position: `absolute`,
            top: 4,
            left: 4,
            zIndex: 1,
            cursor: e ? `not-allowed` : `pointer`,
        }))),
        (Fe = l(p)(({ theme: e }) => ({
            position: `absolute`,
            zIndex: 1,
            top: 6,
            right: 7,
            width: 20,
            height: 20,
            padding: 4,
            boxSizing: `border-box`,
            cursor: `pointer`,
            color: e.input.color,
        }))),
        (J = ((e) => ((e.RGB = `rgb`), (e.HSL = `hsl`), (e.HEX = `hex`), e))(J || {})),
        (Y = Object.values(J)),
        (Ie = /\(([0-9]+),\s*([0-9]+)%?,\s*([0-9]+)%?,?\s*([0-9.]+)?\)/),
        (Le = /^\s*rgba?\(([0-9]+),\s*([0-9]+),\s*([0-9]+),?\s*([0-9.]+)?\)\s*$/i),
        (Re = /^\s*hsla?\(([0-9]+),\s*([0-9]+)%,\s*([0-9]+)%,?\s*([0-9.]+)?\)\s*$/i),
        (X = /^\s*#?([0-9a-f]{3}|[0-9a-f]{6})\s*$/i),
        (ze = /^\s*#?([0-9a-f]{3})\s*$/i),
        (Be = { hex: Ce, rgb: Oe, hsl: Ee }),
        (Z = { hex: `transparent`, rgb: `rgba(0, 0, 0, 0)`, hsl: `hsla(0, 0%, 0%, 0)` }),
        (Ve = (e) => {
            let t = e?.match(Ie);
            if (!t) return [0, 0, 0, 1];
            let [, n, r, i, a = 1] = t;
            return [n, r, i, a].map(Number);
        }),
        (He = (e) => {
            let [t, n, r, i] = Ve(e),
                [a, o, s] = C.default.rgb.hsl([t, n, r]) || [0, 0, 0];
            return {
                valid: !0,
                value: e,
                keyword: C.default.rgb.keyword([t, n, r]),
                colorSpace: `rgb`,
                rgb: e,
                hsl: `hsla(${a}, ${o}%, ${s}%, ${i})`,
                hex: `#${C.default.rgb.hex([t, n, r]).toLowerCase()}`,
            };
        }),
        (Ue = (e) => {
            let [t, n, r, i] = Ve(e),
                [a, o, s] = C.default.hsl.rgb([t, n, r]) || [0, 0, 0];
            return {
                valid: !0,
                value: e,
                keyword: C.default.hsl.keyword([t, n, r]),
                colorSpace: `hsl`,
                rgb: `rgba(${a}, ${o}, ${s}, ${i})`,
                hsl: e,
                hex: `#${C.default.hsl.hex([t, n, r]).toLowerCase()}`,
            };
        }),
        (We = (e) => {
            let t = e.replace(`#`, ``),
                n = C.default.keyword.rgb(t) || C.default.hex.rgb(t),
                r = C.default.rgb.hsl(n),
                i = e;
            /[^#a-f0-9]/i.test(e) ? (i = t) : X.test(e) && (i = `#${t}`);
            let a = !0;
            if (i.startsWith(`#`)) a = X.test(i);
            else
                try {
                    C.default.keyword.hex(i);
                } catch {
                    a = !1;
                }
            return {
                valid: a,
                value: i,
                keyword: C.default.rgb.keyword(n),
                colorSpace: `hex`,
                rgb: `rgba(${n[0]}, ${n[1]}, ${n[2]}, 1)`,
                hsl: `hsla(${r[0]}, ${r[1]}%, ${r[2]}%, 1)`,
                hex: i,
            };
        }),
        (Q = (e) => {
            if (e) return Le.test(e) ? He(e) : Re.test(e) ? Ue(e) : We(e);
        }),
        (Ge = (e, t, n) => {
            if (!e || !t?.valid) return Z[n];
            if (n !== `hex`) return t?.[n] || Z[n];
            if (!t.hex.startsWith(`#`))
                try {
                    return `#${C.default.keyword.hex(t.hex)}`;
                } catch {
                    return Z.hex;
                }
            let r = t.hex.match(ze);
            if (!r) return X.test(t.hex) ? t.hex : Z.hex;
            let [i, a, o] = r[1].split(``);
            return `#${i}${i}${a}${a}${o}${o}`;
        }),
        (Ke = (e, t) => {
            let [n, r] = (0, b.useState)(e || ``),
                [i, a] = (0, b.useState)(() => Q(n)),
                [o, s] = (0, b.useState)(i?.colorSpace || `hex`);
            return (
                (0, b.useEffect)(() => {
                    let t = e || ``,
                        n = Q(t);
                    (r(t), a(n), s(n?.colorSpace || `hex`));
                }, [e]),
                {
                    value: n,
                    realValue: (0, b.useMemo)(() => Ge(n, i, o).toLowerCase(), [n, i, o]),
                    updateValue: (0, b.useCallback)(
                        (e) => {
                            let n = Q(e),
                                i = n?.value || e || ``;
                            (r(i),
                                i === `` && (a(void 0), t(void 0)),
                                n && (a(n), s(n.colorSpace), t(n.value)));
                        },
                        [t],
                    ),
                    color: i,
                    colorSpace: o,
                    cycleColorSpace: (0, b.useCallback)(() => {
                        let e = Y[(Y.indexOf(o) + 1) % Y.length];
                        s(e);
                        let n = i?.[e] || ``;
                        (r(n), t(n));
                    }, [i, o, t]),
                }
            );
        }),
        ($ = (e) => e.replace(/\s*/, ``).toLowerCase()),
        (qe = (e, t, n) => {
            let [r, i] = (0, b.useState)(t?.valid ? [t] : []);
            (0, b.useEffect)(() => {
                t === void 0 && i([]);
            }, [t]);
            let a = (0, b.useMemo)(
                () =>
                    (e || [])
                        .map((e) =>
                            typeof e == `string`
                                ? Q(e)
                                : e.title
                                  ? { ...Q(e.color), keyword: e.title }
                                  : Q(e.color),
                        )
                        .concat(r)
                        .filter(Boolean)
                        .slice(-27),
                [e, r],
            );
            return {
                presets: a,
                addPreset: (0, b.useCallback)(
                    (e) => {
                        e?.valid &&
                            (a.some(
                                (t) => t && t[n] && $(t[n] || ``) === $(e[n] || ``),
                            ) ||
                                i((t) => t.concat(e)));
                    },
                    [n, a],
                ),
            };
        }),
        (Je = ({
            name: e,
            value: t,
            onChange: n,
            onFocus: r,
            onBlur: i,
            presetColors: a,
            startOpen: o = !1,
            argType: c,
        }) => {
            let {
                    value: l,
                    realValue: d,
                    updateValue: p,
                    color: m,
                    colorSpace: h,
                    cycleColorSpace: te,
                } = Ke(t, (0, b.useCallback)(ee(n, 200), [n])),
                { presets: g, addPreset: ne } = qe(a ?? [], m, h),
                re = Be[h],
                _ = !!c?.table?.readonly,
                v = s(e);
            return b.createElement(
                ke,
                null,
                b.createElement(`label`, { htmlFor: v, className: `sb-sr-only` }, e),
                b.createElement(Ne, {
                    id: v,
                    value: l,
                    onChange: (e) => p(e.target.value),
                    onFocus: (e) => e.target.select(),
                    readOnly: _,
                    placeholder: `Choose color...`,
                }),
                b.createElement(
                    f,
                    {
                        ariaLabel: `Color picker`,
                        defaultVisible: o,
                        visible: _ ? !1 : void 0,
                        onVisibleChange: () => m && ne(m),
                        popover: b.createElement(
                            Ae,
                            null,
                            b.createElement(re, {
                                color: d === `transparent` ? `#000000` : d,
                                onChange: p,
                                onFocus: r,
                                onBlur: i,
                            }),
                            g.length > 0 &&
                                b.createElement(
                                    je,
                                    null,
                                    g.map((e, t) =>
                                        b.createElement(q, {
                                            key: `${e?.value || t}-${t}`,
                                            variant: `ghost`,
                                            padding: `small`,
                                            size: `small`,
                                            ariaLabel: `Pick this color`,
                                            tooltip: e?.keyword || e?.value || ``,
                                            value: e?.value || ``,
                                            selected: !!(
                                                m &&
                                                e &&
                                                e[h] &&
                                                $(e[h] || ``) === $(m[h])
                                            ),
                                            onClick: () => e && p(e.value || ``),
                                        }),
                                    ),
                                ),
                        ),
                    },
                    b.createElement(Pe, {
                        variant: `ghost`,
                        padding: `small`,
                        size: `small`,
                        ariaLabel: `Open color picker`,
                        value: d,
                        style: { margin: 4 },
                        disabled: _,
                    }),
                ),
                l
                    ? b.createElement(
                          Fe,
                          {
                              variant: `ghost`,
                              padding: `small`,
                              size: `small`,
                              ariaLabel: `Cycle through color spaces`,
                              disabled: _,
                              onClick: _ ? void 0 : te,
                          },
                          b.createElement(u, null),
                      )
                    : null,
            );
        }),
        (Ye = Je));
})();
export { Je as ColorControl, Ye as default };
