@thednp/color-picker 2.0.0-alpha1 → 2.0.0-alpha3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,40 +1,40 @@
1
- const J = {}, he = (o) => {
1
+ const J = {}, ge = (o) => {
2
2
  const { type: t, currentTarget: e } = o;
3
- [...J[t]].forEach(([s, n]) => {
4
- e === s && [...n].forEach(([r, i]) => {
5
- r.apply(s, [o]), typeof i == "object" && i.once && Bt(s, t, r, i);
3
+ [...J[t]].forEach(([s, r]) => {
4
+ e === s && [...r].forEach(([n, i]) => {
5
+ n.apply(s, [o]), typeof i == "object" && i.once && jt(s, t, n, i);
6
6
  });
7
7
  });
8
- }, ge = (o, t, e, s) => {
8
+ }, ue = (o, t, e, s) => {
9
9
  J[t] || (J[t] = /* @__PURE__ */ new Map());
10
- const n = J[t];
11
- n.has(o) || n.set(o, /* @__PURE__ */ new Map());
12
- const r = n.get(o), { size: i } = r;
13
- r.set(e, s), i || o.addEventListener(t, he, s);
14
- }, Bt = (o, t, e, s) => {
15
- const n = J[t], r = n && n.get(o), i = r && r.get(e), a = i !== void 0 ? i : s;
16
- r && r.has(e) && r.delete(e), n && (!r || !r.size) && n.delete(o), (!n || !n.size) && delete J[t], (!r || !r.size) && o.removeEventListener(t, he, a);
17
- }, Gt = "aria-description", Nt = "aria-expanded", Me = "aria-hidden", Pt = "aria-selected", et = "aria-valuenow", ot = "aria-valuetext", Te = "change", Re = "DOMContentLoaded", De = "focusin", Oe = "focusout", Ut = "keydown", Fe = "keyup", Et = "click", Ie = "pointerdown", ue = "pointermove", Ke = "pointerup", Ve = "resize", Be = "scroll", je = "touchmove", j = "ArrowDown", st = "ArrowUp", ht = "ArrowLeft", G = "ArrowRight", qe = "Enter", ze = "Escape", _t = "Space", Ge = "transitionDuration", Ue = "transitionProperty", Y = "tabindex", _e = navigator.userAgentData, mt = _e, { userAgent: We } = navigator, vt = We, Wt = /iPhone|iPad|iPod|Android/i;
18
- mt ? mt.brands.some((o) => Wt.test(o.brand)) : Wt.test(vt);
19
- const Xt = /(iPhone|iPod|iPad)/;
20
- mt ? mt.brands.some((o) => Xt.test(o.brand)) : (
10
+ const r = J[t];
11
+ r.has(o) || r.set(o, /* @__PURE__ */ new Map());
12
+ const n = r.get(o), { size: i } = n;
13
+ n.set(e, s), i || o.addEventListener(t, ge, s);
14
+ }, jt = (o, t, e, s) => {
15
+ const r = J[t], n = r && r.get(o), i = n && n.get(e), a = i !== void 0 ? i : s;
16
+ n && n.has(e) && n.delete(e), r && (!n || !n.size) && r.delete(o), (!r || !r.size) && delete J[t], (!n || !n.size) && o.removeEventListener(t, ge, a);
17
+ }, Ut = "aria-description", Et = "aria-expanded", Me = "aria-hidden", St = "aria-selected", et = "aria-valuenow", ot = "aria-valuetext", Te = "change", Re = "DOMContentLoaded", Oe = "focusin", De = "focusout", _t = "keydown", Fe = "keyup", Mt = "click", Ie = "pointerdown", be = "pointermove", Ke = "pointerup", Ve = "resize", Be = "scroll", je = "touchmove", j = "ArrowDown", st = "ArrowUp", ht = "ArrowLeft", G = "ArrowRight", qe = "Enter", ze = "Escape", Wt = "Space", Ge = "transitionDuration", Ue = "transitionProperty", Y = "tabindex", _e = navigator.userAgentData, vt = _e, { userAgent: We } = navigator, wt = We, Xt = /iPhone|iPad|iPod|Android/i;
18
+ vt ? vt.brands.some((o) => Xt.test(o.brand)) : Xt.test(wt);
19
+ const Jt = /(iPhone|iPod|iPad)/;
20
+ vt ? vt.brands.some((o) => Jt.test(o.brand)) : (
21
21
  /* istanbul ignore next */
22
- Xt.test(vt)
22
+ Jt.test(wt)
23
23
  );
24
- vt && vt.includes("Firefox");
25
- const { head: kt } = document;
26
- ["webkitPerspective", "perspective"].some((o) => o in kt.style);
24
+ wt && wt.includes("Firefox");
25
+ const { head: yt } = document;
26
+ ["webkitPerspective", "perspective"].some((o) => o in yt.style);
27
27
  const Xe = (o, t, e, s) => {
28
- const n = s || !1;
29
- o.addEventListener(t, e, n);
28
+ const r = s || !1;
29
+ o.addEventListener(t, e, r);
30
30
  }, Je = (o, t, e, s) => {
31
- const n = s || !1;
32
- o.removeEventListener(t, e, n);
31
+ const r = s || !1;
32
+ o.removeEventListener(t, e, r);
33
33
  }, Ye = (o, t, e, s) => {
34
- const n = (r) => {
35
- (r.target === o || r.currentTarget === o) && (e.apply(o, [r]), Je(o, t, n, s));
34
+ const r = (n) => {
35
+ (n.target === o || n.currentTarget === o) && (e.apply(o, [n]), Je(o, t, r, s));
36
36
  };
37
- Xe(o, t, n, s);
37
+ Xe(o, t, r, s);
38
38
  }, Ze = () => {
39
39
  };
40
40
  (() => {
@@ -48,14 +48,14 @@ const Xe = (o, t, e, s) => {
48
48
  }
49
49
  return o;
50
50
  })();
51
- ["webkitTransform", "transform"].some((o) => o in kt.style);
52
- ["webkitAnimation", "animation"].some((o) => o in kt.style);
53
- ["webkitTransition", "transition"].some((o) => o in kt.style);
54
- const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), St = (o, t) => o.removeAttribute(t), q = (o, ...t) => {
51
+ ["webkitTransform", "transform"].some((o) => o in yt.style);
52
+ ["webkitAnimation", "animation"].some((o) => o in yt.style);
53
+ ["webkitTransition", "transition"].some((o) => o in yt.style);
54
+ const xt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), Ct = (o, t) => o.removeAttribute(t), q = (o, ...t) => {
55
55
  o.classList.add(...t);
56
- }, D = (o, ...t) => {
56
+ }, O = (o, ...t) => {
57
57
  o.classList.remove(...t);
58
- }, T = (o, t) => o.classList.contains(t), jt = (o) => o != null && typeof o == "object" || !1, Q = (o) => jt(o) && typeof o.nodeType == "number" && [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].some((t) => o.nodeType === t) || !1, at = (o) => Q(o) && o.nodeType === 1 || !1, W = /* @__PURE__ */ new Map(), ct = {
58
+ }, T = (o, t) => o.classList.contains(t), qt = (o) => o != null && typeof o == "object" || !1, Q = (o) => qt(o) && typeof o.nodeType == "number" && [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].some((t) => o.nodeType === t) || !1, at = (o) => Q(o) && o.nodeType === 1 || !1, W = /* @__PURE__ */ new Map(), ct = {
59
59
  data: W,
60
60
  /**
61
61
  * Sets web components data.
@@ -97,7 +97,7 @@ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), S
97
97
  const e = ct.getAllFor(t);
98
98
  !e || !at(o) || (e.delete(o), e.size === 0 && W.delete(t));
99
99
  }
100
- }, Qe = (o, t) => ct.get(o, t), V = (o) => typeof o == "string" || !1, to = (o) => jt(o) && o.constructor.name === "Window" || !1, be = (o) => Q(o) && o.nodeType === 9 || !1, K = (o) => to(o) ? o.document : be(o) ? o : Q(o) ? o.ownerDocument : window.document, B = (o, ...t) => Object.assign(o, ...t), x = (o) => {
100
+ }, Qe = (o, t) => ct.get(o, t), V = (o) => typeof o == "string" || !1, to = (o) => qt(o) && o.constructor.name === "Window" || !1, pe = (o) => Q(o) && o.nodeType === 9 || !1, K = (o) => to(o) ? o.document : pe(o) ? o : Q(o) ? o.ownerDocument : window.document, B = (o, ...t) => Object.assign(o, ...t), x = (o) => {
101
101
  if (!o)
102
102
  return;
103
103
  if (V(o))
@@ -107,52 +107,52 @@ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), S
107
107
  return;
108
108
  const s = { ...o };
109
109
  return delete s.tagName, B(e, s);
110
- }, Mt = (o, t) => {
110
+ }, Tt = (o, t) => {
111
111
  if (!o || !t)
112
112
  return;
113
113
  if (V(t))
114
114
  return K().createElementNS(o, t);
115
- const { tagName: e } = t, s = Mt(o, e);
115
+ const { tagName: e } = t, s = Tt(o, e);
116
116
  if (!s)
117
117
  return;
118
- const n = { ...t };
119
- return delete n.tagName, B(s, n);
120
- }, eo = (o, t) => o.dispatchEvent(t), Tt = (o, t) => {
118
+ const r = { ...t };
119
+ return delete r.tagName, B(s, r);
120
+ }, eo = (o, t) => o.dispatchEvent(t), Rt = (o, t) => {
121
121
  const e = getComputedStyle(o), s = t.replace("webkit", "Webkit").replace(/([A-Z])/g, "-$1").toLowerCase();
122
122
  return e.getPropertyValue(s);
123
123
  }, oo = (o) => {
124
- const t = Tt(o, Ue), e = Tt(o, Ge), s = e.includes("ms") ? (
124
+ const t = Rt(o, Ue), e = Rt(o, Ge), s = e.includes("ms") ? (
125
125
  /* istanbul ignore next */
126
126
  1
127
- ) : 1e3, n = t && t !== "none" ? parseFloat(e) * s : (
127
+ ) : 1e3, r = t && t !== "none" ? parseFloat(e) * s : (
128
128
  /* istanbul ignore next */
129
129
  0
130
130
  );
131
- return Number.isNaN(n) ? (
131
+ return Number.isNaN(r) ? (
132
132
  /* istanbul ignore next */
133
133
  0
134
- ) : n;
135
- }, U = (o, t) => o.focus(t), Jt = (o) => ["true", !0].includes(o) ? !0 : ["false", !1].includes(o) ? !1 : ["null", "", null, void 0].includes(o) ? null : o !== "" && !Number.isNaN(+o) ? +o : o, pt = (o) => Object.entries(o), so = (o) => o.toLowerCase(), no = (o, t, e, s) => {
136
- const n = { ...e }, r = { ...o.dataset }, i = { ...t }, a = {}, l = "title";
137
- return pt(r).forEach(([c, h]) => {
134
+ ) : r;
135
+ }, U = (o, t) => o.focus(t), Yt = (o) => ["true", !0].includes(o) ? !0 : ["false", !1].includes(o) ? !1 : ["null", "", null, void 0].includes(o) ? null : o !== "" && !Number.isNaN(+o) ? +o : o, pt = (o) => Object.entries(o), so = (o) => o.toLowerCase(), ro = (o, t, e, s) => {
136
+ const r = { ...e }, n = { ...o.dataset }, i = { ...t }, a = {}, l = "title";
137
+ return pt(n).forEach(([c, h]) => {
138
138
  const b = s && typeof c == "string" && c.includes(s) ? c.replace(s, "").replace(/[A-Z]/g, (u) => so(u)) : c;
139
- a[b] = Jt(h);
140
- }), pt(n).forEach(([c, h]) => {
141
- n[c] = Jt(h);
139
+ a[b] = Yt(h);
140
+ }), pt(r).forEach(([c, h]) => {
141
+ r[c] = Yt(h);
142
142
  }), pt(t).forEach(([c, h]) => {
143
- c in n ? i[c] = n[c] : c in a ? i[c] = a[c] : i[c] = c === l ? yt(o, l) : h;
143
+ c in r ? i[c] = r[c] : c in a ? i[c] = a[c] : i[c] = c === l ? xt(o, l) : h;
144
144
  }), i;
145
- }, ro = (o) => o.offsetHeight, O = (o, t) => {
145
+ }, no = (o) => o.offsetHeight, D = (o, t) => {
146
146
  pt(t).forEach(([e, s]) => {
147
147
  if (s && V(e) && e.includes("--"))
148
148
  o.style.setProperty(e, s);
149
149
  else {
150
- const n = {};
151
- n[e] = s, B(o.style, n);
150
+ const r = {};
151
+ r[e] = s, B(o.style, r);
152
152
  }
153
153
  });
154
- }, io = (o) => jt(o) && o.constructor.name === "Map" || !1, pe = (o) => o.toUpperCase(), gt = (o, t) => {
155
- const { width: e, height: s, top: n, right: r, bottom: i, left: a } = o.getBoundingClientRect();
154
+ }, io = (o) => qt(o) && o.constructor.name === "Map" || !1, de = (o) => o.toUpperCase(), gt = (o, t) => {
155
+ const { width: e, height: s, top: r, right: n, bottom: i, left: a } = o.getBoundingClientRect();
156
156
  let l = 1, c = 1;
157
157
  if (t && at(o)) {
158
158
  const { offsetWidth: h, offsetHeight: b } = o;
@@ -167,35 +167,35 @@ const yt = (o, t) => o.getAttribute(t), m = (o, t, e) => o.setAttribute(t, e), S
167
167
  return {
168
168
  width: e / l,
169
169
  height: s / c,
170
- top: n / c,
171
- right: r / l,
170
+ top: r / c,
171
+ right: n / l,
172
172
  bottom: i / c,
173
173
  left: a / l,
174
174
  x: a / l,
175
- y: n / c
175
+ y: r / c
176
176
  };
177
- }, Ct = (o) => K(o).documentElement;
178
- let Yt = 0, Zt = 0;
179
- const X = /* @__PURE__ */ new Map(), de = (o, t) => {
180
- let e = t ? Yt : Zt;
177
+ }, Lt = (o) => K(o).documentElement;
178
+ let Zt = 0, Qt = 0;
179
+ const X = /* @__PURE__ */ new Map(), fe = (o, t) => {
180
+ let e = t ? Zt : Qt;
181
181
  if (t) {
182
- const s = de(o), n = X.get(s) || /* @__PURE__ */ new Map();
183
- X.has(s) || X.set(s, n), io(n) && !n.has(t) ? (n.set(t, e), Yt += 1) : e = n.get(t);
182
+ const s = fe(o), r = X.get(s) || /* @__PURE__ */ new Map();
183
+ X.has(s) || X.set(s, r), io(r) && !r.has(t) ? (r.set(t, e), Zt += 1) : e = r.get(t);
184
184
  } else {
185
185
  const s = o.id || o;
186
- X.has(s) ? e = X.get(s) : (X.set(s, e), Zt += 1);
186
+ X.has(s) ? e = X.get(s) : (X.set(s, e), Qt += 1);
187
187
  }
188
188
  return e;
189
189
  }, ao = (o) => {
190
190
  var t;
191
- return o ? be(o) ? o.defaultView : Q(o) ? (t = o?.ownerDocument) == null ? void 0 : t.defaultView : o : window;
192
- }, Lt = (o) => Array.isArray(o) || !1, fe = (o, t) => o ? o.closest(t) || // break out of `ShadowRoot`
193
- fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).querySelector(o), nt = (o, t) => (t && Q(t) ? t : K()).getElementsByClassName(
191
+ return o ? pe(o) ? o.defaultView : Q(o) ? (t = o?.ownerDocument) == null ? void 0 : t.defaultView : o : window;
192
+ }, At = (o) => Array.isArray(o) || !1, me = (o, t) => o ? o.closest(t) || // break out of `ShadowRoot`
193
+ me(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).querySelector(o), rt = (o, t) => (t && Q(t) ? t : K()).getElementsByClassName(
194
194
  o
195
- ), qt = ["transparent", "currentColor", "inherit", "revert", "initial"], v = (o) => {
195
+ ), zt = ["transparent", "currentColor", "inherit", "revert", "initial"], v = (o) => {
196
196
  const t = Math.floor(o);
197
197
  return o - t < 0.5 ? t : Math.round(o);
198
- }, wt = [
198
+ }, $t = [
199
199
  [
200
200
  "aliceblue",
201
201
  {
@@ -1380,110 +1380,110 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1380
1380
  b: 50
1381
1381
  }
1382
1382
  ]
1383
- ], me = "deg|rad|grad|turn", ve = "[-\\+]?\\d+%?", we = "[-\\+]?\\d*\\.\\d+%?", $e = `[-\\+]?\\d*\\.?\\d+(?:${me})?`, dt = `(?:${we})|(?:${ve})`, Rt = `(?:${dt})|(?:${$e}?)`, lo = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", co = "(?:[\\s|\\)\\s]+)?", Qt = "(?:[,|\\s]+)", ho = "(?:[,|\\/\\s]*)?", rt = `${lo}(${Rt})${Qt}(${dt})${Qt}(${dt})${ho}(${dt})?${co}`, I = {
1384
- CSS_UNIT: new RegExp(Rt),
1385
- ANGLES: me,
1386
- CSS_ANGLE: $e,
1387
- CSS_INTEGER: ve,
1388
- CSS_NUMBER: we,
1389
- CSS_UNIT2: Rt,
1390
- PERMISSIVE_MATCH: rt,
1391
- hwb: new RegExp(`hwb${rt}`),
1392
- rgb: new RegExp(`rgb(?:a)?${rt}`),
1393
- hsl: new RegExp(`hsl(?:a)?${rt}`),
1394
- hsv: new RegExp(`hsv(?:a)?${rt}`),
1383
+ ], ve = "deg|rad|grad|turn", we = "[-\\+]?\\d+%?", $e = "[-\\+]?\\d*\\.\\d+%?", ke = `[-\\+]?\\d*\\.?\\d+(?:${ve})?`, dt = `(?:${$e})|(?:${we})`, Ot = `(?:${dt})|(?:${ke}?)`, lo = "(?:[\\s|\\(\\s|\\s\\(\\s]+)?", co = "(?:[\\s|\\)\\s]+)?", te = "(?:[,|\\s]+)", ho = "(?:[,|\\/\\s]*)?", nt = `${lo}(${Ot})${te}(${dt})${te}(${dt})${ho}(${dt})?${co}`, I = {
1384
+ CSS_UNIT: new RegExp(Ot),
1385
+ ANGLES: ve,
1386
+ CSS_ANGLE: ke,
1387
+ CSS_INTEGER: we,
1388
+ CSS_NUMBER: $e,
1389
+ CSS_UNIT2: Ot,
1390
+ PERMISSIVE_MATCH: nt,
1391
+ hwb: new RegExp(`hwb${nt}`),
1392
+ rgb: new RegExp(`rgb(?:a)?${nt}`),
1393
+ hsl: new RegExp(`hsl(?:a)?${nt}`),
1394
+ hsv: new RegExp(`hsv(?:a)?${nt}`),
1395
1395
  hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1396
1396
  hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
1397
1397
  hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
1398
1398
  hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
1399
- }, ke = (o) => qt.includes(o), it = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), ye = (o) => `${o}`.includes(".") && parseFloat(o) === 1, $t = (o) => typeof o == "string" && o.includes("%"), H = (o) => !!I.CSS_UNIT.exec(`${o}`), xe = ["rgb", "hex", "hsl", "hsv", "hwb"], Pe = (o) => qt.includes(o) || ["#", ...xe].some((t) => o.includes(t)) ? !1 : wt.some(([t]) => o === t), R = (o, t) => {
1399
+ }, ye = (o) => zt.includes(o), it = (o, t) => o !== null && typeof o == "object" && Object.keys(t).every((e) => e in o), xe = (o) => `${o}`.includes(".") && parseFloat(o) === 1, kt = (o) => typeof o == "string" && o.includes("%"), N = (o) => !!I.CSS_UNIT.exec(`${o}`), Pe = ["rgb", "hex", "hsl", "hsv", "hwb"], Se = (o) => zt.includes(o) || ["#", ...Pe].some((t) => o.includes(t)) ? !1 : $t.some(([t]) => o === t), R = (o, t) => {
1400
1400
  let e = o;
1401
1401
  if (typeof o == "number" && Math.min(o, 0) === 0 && // round values to 6 decimals Math.round(N * (10 ** 6)) / 10 ** 6
1402
1402
  Math.max(o, 1) === 1)
1403
1403
  return o;
1404
- ye(o) && (e = "100%");
1405
- const s = $t(e);
1404
+ xe(o) && (e = "100%");
1405
+ const s = kt(e);
1406
1406
  return e = t === 360 ? parseFloat(e) : Math.min(t, Math.max(0, parseFloat(e))), s && (e = e * t / 100), Math.abs(e - t) < 1e-6 ? 1 : (t === 360 ? e = (e < 0 ? e % t + t : e % t) / t : e = e % t / t, e);
1407
1407
  }, Dt = (o) => {
1408
1408
  let t = parseFloat(o);
1409
1409
  return (Number.isNaN(t) || t < 0 || t > 1) && (t = 1), t;
1410
- }, ut = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o), Se = (o) => {
1411
- const [[, t]] = wt.filter(([e]) => e === o.toLowerCase());
1410
+ }, ut = (o) => Math.min(1, Math.max(0, o)), z = (o) => o.length === 1 ? `0${o}` : String(o), Ce = (o) => {
1411
+ const [[, t]] = $t.filter(([e]) => e === o.toLowerCase());
1412
1412
  return t;
1413
- }, N = (o) => parseInt(o, 16), Ot = (o) => N(o) / 255, Ce = (o) => v(o * 255).toString(16), te = (o, t, e) => {
1414
- const s = Math.max(o, t, e), n = Math.min(o, t, e);
1415
- let r = 0, i = 0;
1416
- const a = (s + n) / 2;
1417
- if (s === n)
1418
- i = 0, r = 0;
1413
+ }, H = (o) => parseInt(o, 16), Ft = (o) => H(o) / 255, Le = (o) => v(o * 255).toString(16), ee = (o, t, e) => {
1414
+ const s = Math.max(o, t, e), r = Math.min(o, t, e);
1415
+ let n = 0, i = 0;
1416
+ const a = (s + r) / 2;
1417
+ if (s === r)
1418
+ i = 0, n = 0;
1419
1419
  else {
1420
- const l = s - n;
1421
- i = a > 0.5 ? l / (2 - s - n) : l / (s + n), s === o && (r = (t - e) / l + (t < e ? 6 : 0)), s === t && (r = (e - o) / l + 2), s === e && (r = (o - t) / l + 4), r /= 6;
1420
+ const l = s - r;
1421
+ i = a > 0.5 ? l / (2 - s - r) : l / (s + r), s === o && (n = (t - e) / l + (t < e ? 6 : 0)), s === t && (n = (e - o) / l + 2), s === e && (n = (o - t) / l + 4), n /= 6;
1422
1422
  }
1423
- return { h: r, s: i, l: a };
1423
+ return { h: n, s: i, l: a };
1424
1424
  }, ft = (o, t, e) => {
1425
1425
  let s = e;
1426
1426
  return s < 0 && (s += 1), s > 1 && (s -= 1), s < 1 / 6 ? o + (t - o) * (6 * s) : s < 1 / 2 ? t : s < 2 / 3 ? o + (t - o) * (2 / 3 - s) * 6 : o;
1427
1427
  }, lt = (o, t, e) => {
1428
- let s = 0, n = 0, r = 0;
1428
+ let s = 0, r = 0, n = 0;
1429
1429
  if (t === 0)
1430
- n = e, r = e, s = e;
1430
+ r = e, n = e, s = e;
1431
1431
  else if (e) {
1432
1432
  const i = e < 0.5 ? e * (1 + t) : e + t - e * t, a = 2 * e - i;
1433
- s = ft(a, i, o + 1 / 3), n = ft(a, i, o), r = ft(a, i, o - 1 / 3);
1433
+ s = ft(a, i, o + 1 / 3), r = ft(a, i, o), n = ft(a, i, o - 1 / 3);
1434
1434
  }
1435
- return { r: s, g: n, b: r };
1436
- }, ee = (o, t, e) => {
1437
- let s = 0, n = 0;
1438
- const r = Math.min(o, t, e), i = Math.max(o, t, e), a = 1 - i;
1439
- if (i === r)
1440
- return { h: 0, w: r, b: a };
1441
- o === r ? (s = t - e, n = 3) : (s = t === r ? e - o : o - t, n = t === r ? 5 : 1);
1442
- const l = (n - s / (i - r)) / 6;
1435
+ return { r: s, g: r, b: n };
1436
+ }, oe = (o, t, e) => {
1437
+ let s = 0, r = 0;
1438
+ const n = Math.min(o, t, e), i = Math.max(o, t, e), a = 1 - i;
1439
+ if (i === n)
1440
+ return { h: 0, w: n, b: a };
1441
+ o === n ? (s = t - e, r = 3) : (s = t === n ? e - o : o - t, r = t === n ? 5 : 1);
1442
+ const l = (r - s / (i - n)) / 6;
1443
1443
  return {
1444
1444
  h: l === 1 ? 0 : l,
1445
- w: r,
1445
+ w: n,
1446
1446
  b: a
1447
1447
  };
1448
- }, Le = (o, t, e) => {
1448
+ }, Ae = (o, t, e) => {
1449
1449
  if (t + e >= 1) {
1450
1450
  const i = t / (t + e);
1451
1451
  return { r: i, g: i, b: i };
1452
1452
  }
1453
- let { r: s, g: n, b: r } = lt(o, 1, 0.5);
1454
- return [s, n, r] = [s, n, r].map((i) => i * (1 - t - e) + t), { r: s, g: n, b: r };
1455
- }, oe = (o, t, e) => {
1456
- const s = Math.max(o, t, e), n = Math.min(o, t, e);
1457
- let r = 0;
1458
- const i = s, a = s - n, l = s === 0 ? 0 : a / s;
1459
- return s === n ? r = 0 : (o === s && (r = (t - e) / a + (t < e ? 6 : 0)), t === s && (r = (e - o) / a + 2), e === s && (r = (o - t) / a + 4), r /= 6), { h: r, s: l, v: i };
1460
- }, Ft = (o, t, e) => {
1461
- const s = o * 6, n = t, r = e, i = Math.floor(s), a = s - i, l = r * (1 - n), c = r * (1 - a * n), h = r * (1 - (1 - a) * n), b = i % 6, u = [r, c, l, l, h, r][b], d = [h, r, r, c, l, l][b], g = [l, l, h, r, r, c][b];
1453
+ let { r: s, g: r, b: n } = lt(o, 1, 0.5);
1454
+ return [s, r, n] = [s, r, n].map((i) => i * (1 - t - e) + t), { r: s, g: r, b: n };
1455
+ }, se = (o, t, e) => {
1456
+ const s = Math.max(o, t, e), r = Math.min(o, t, e);
1457
+ let n = 0;
1458
+ const i = s, a = s - r, l = s === 0 ? 0 : a / s;
1459
+ return s === r ? n = 0 : (o === s && (n = (t - e) / a + (t < e ? 6 : 0)), t === s && (n = (e - o) / a + 2), e === s && (n = (o - t) / a + 4), n /= 6), { h: n, s: l, v: i };
1460
+ }, It = (o, t, e) => {
1461
+ const s = o * 6, r = t, n = e, i = Math.floor(s), a = s - i, l = n * (1 - r), c = n * (1 - a * r), h = n * (1 - (1 - a) * r), b = i % 6, u = [n, c, l, l, h, n][b], d = [h, n, n, c, l, l][b], g = [l, l, h, n, n, c][b];
1462
1462
  return { r: u, g: d, b: g };
1463
- }, se = (o, t, e, s) => {
1464
- const n = [
1463
+ }, re = (o, t, e, s) => {
1464
+ const r = [
1465
1465
  z(v(o).toString(16)),
1466
1466
  z(v(t).toString(16)),
1467
1467
  z(v(e).toString(16))
1468
1468
  ];
1469
- return s && n[0].charAt(0) === n[0].charAt(1) && n[1].charAt(0) === n[1].charAt(1) && n[2].charAt(0) === n[2].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) : n.join("");
1470
- }, At = (o, t, e, s, n) => {
1471
- const r = [
1469
+ return s && r[0].charAt(0) === r[0].charAt(1) && r[1].charAt(0) === r[1].charAt(1) && r[2].charAt(0) === r[2].charAt(1) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) : r.join("");
1470
+ }, Nt = (o, t, e, s, r) => {
1471
+ const n = [
1472
1472
  z(v(o).toString(16)),
1473
1473
  z(v(t).toString(16)),
1474
1474
  z(v(e).toString(16)),
1475
- z(Ce(s))
1475
+ z(Le(s))
1476
1476
  ];
1477
- return n && r[0].charAt(0) === r[0].charAt(1) && r[1].charAt(0) === r[1].charAt(1) && r[2].charAt(0) === r[2].charAt(1) && r[3].charAt(0) === r[3].charAt(1) ? r[0].charAt(0) + r[1].charAt(0) + r[2].charAt(0) + r[3].charAt(0) : r.join("");
1478
- }, Ae = (o) => {
1477
+ return r && n[0].charAt(0) === n[0].charAt(1) && n[1].charAt(0) === n[1].charAt(1) && n[2].charAt(0) === n[2].charAt(1) && n[3].charAt(0) === n[3].charAt(1) ? n[0].charAt(0) + n[1].charAt(0) + n[2].charAt(0) + n[3].charAt(0) : n.join("");
1478
+ }, Ne = (o) => {
1479
1479
  const t = String(o).trim().toLowerCase();
1480
- if (Pe(t))
1481
- return Object.assign(Se(t), {
1480
+ if (Se(t))
1481
+ return Object.assign(Ce(t), {
1482
1482
  a: 1,
1483
1483
  format: "rgb",
1484
1484
  ok: !0
1485
1485
  });
1486
- if (ke(t))
1486
+ if (ye(t))
1487
1487
  return {
1488
1488
  r: 0,
1489
1489
  g: 0,
@@ -1492,60 +1492,60 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1492
1492
  format: "rgb",
1493
1493
  ok: !0
1494
1494
  };
1495
- let [, e, s, n, r] = I.rgb.exec(t) || [];
1496
- return e && s && n ? {
1495
+ let [, e, s, r, n] = I.rgb.exec(t) || [];
1496
+ return e && s && r ? {
1497
1497
  r: e,
1498
1498
  g: s,
1499
- b: n,
1500
- a: r !== void 0 ? r : 1,
1499
+ b: r,
1500
+ a: n !== void 0 ? n : 1,
1501
1501
  format: "rgb",
1502
1502
  ok: !0
1503
- } : ([, e, s, n, r] = I.hsl.exec(t) || [], e && s && n ? {
1503
+ } : ([, e, s, r, n] = I.hsl.exec(t) || [], e && s && r ? {
1504
1504
  h: e,
1505
1505
  s,
1506
- l: n,
1507
- a: r !== void 0 ? r : 1,
1506
+ l: r,
1507
+ a: n !== void 0 ? n : 1,
1508
1508
  format: "hsl",
1509
1509
  ok: !0
1510
- } : ([, e, s, n, r] = I.hsv.exec(t) || [], e && s && n ? {
1510
+ } : ([, e, s, r, n] = I.hsv.exec(t) || [], e && s && r ? {
1511
1511
  h: e,
1512
1512
  s,
1513
- v: n,
1514
- a: r !== void 0 ? r : 1,
1513
+ v: r,
1514
+ a: n !== void 0 ? n : 1,
1515
1515
  format: "hsv",
1516
1516
  ok: !0
1517
- } : ([, e, s, n, r] = I.hwb.exec(t) || [], e && s && n ? {
1517
+ } : ([, e, s, r, n] = I.hwb.exec(t) || [], e && s && r ? {
1518
1518
  h: e,
1519
1519
  w: s,
1520
- b: n,
1521
- a: r !== void 0 ? r : 1,
1520
+ b: r,
1521
+ a: n !== void 0 ? n : 1,
1522
1522
  format: "hwb",
1523
1523
  ok: !0
1524
- } : ([, e, s, n, r] = I.hex8.exec(t) || [], e && s && n && r ? {
1525
- r: N(e),
1526
- g: N(s),
1527
- b: N(n),
1528
- a: Ot(r),
1524
+ } : ([, e, s, r, n] = I.hex8.exec(t) || [], e && s && r && n ? {
1525
+ r: H(e),
1526
+ g: H(s),
1527
+ b: H(r),
1528
+ a: Ft(n),
1529
1529
  format: "hex",
1530
1530
  ok: !0
1531
- } : ([, e, s, n] = I.hex6.exec(t) || [], e && s && n ? {
1532
- r: N(e),
1533
- g: N(s),
1534
- b: N(n),
1531
+ } : ([, e, s, r] = I.hex6.exec(t) || [], e && s && r ? {
1532
+ r: H(e),
1533
+ g: H(s),
1534
+ b: H(r),
1535
1535
  a: 1,
1536
1536
  format: "hex",
1537
1537
  ok: !0
1538
- } : ([, e, s, n, r] = I.hex4.exec(t) || [], e && s && n && r ? {
1539
- r: N(e + e),
1540
- g: N(s + s),
1541
- b: N(n + n),
1542
- a: Ot(r + r),
1538
+ } : ([, e, s, r, n] = I.hex4.exec(t) || [], e && s && r && n ? {
1539
+ r: H(e + e),
1540
+ g: H(s + s),
1541
+ b: H(r + r),
1542
+ a: Ft(n + n),
1543
1543
  format: "hex",
1544
1544
  ok: !0
1545
- } : ([, e, s, n] = I.hex3.exec(t) || [], e && s && n ? {
1546
- r: N(e + e),
1547
- g: N(s + s),
1548
- b: N(n + n),
1545
+ } : ([, e, s, r] = I.hex3.exec(t) || [], e && s && r ? {
1546
+ r: H(e + e),
1547
+ g: H(s + s),
1548
+ b: H(r + r),
1549
1549
  a: 1,
1550
1550
  format: "hex",
1551
1551
  ok: !0
@@ -1558,8 +1558,8 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1558
1558
  ok: !o
1559
1559
  })))))));
1560
1560
  }, ne = (o) => {
1561
- let t = { r: 0, g: 0, b: 0 }, e = o, s = 1, n, r, i, a, l, c, h, b, u = "rgb", d = !1;
1562
- return (!e || typeof e == "string") && (e = Ae(e), d = e.ok), it(e, t) && H(e.r) && H(e.g) && H(e.b) && ({ r: h, g: b, b: l } = e, [h, b, l] = [h, b, l].map((g) => R(g, $t(g) ? 100 : 255)), t = { r: h, g: b, b: l }, u = "format" in e ? e.format : "rgb"), it(e, { h: 0, s: 0, v: 0 }) && H(e.h) && H(e.s) && H(e.v) && ({ h: c, s: n, v: r } = e, c = R(c, 360), n = R(n, 100), r = R(r, 100), t = Ft(c, n, r), u = "hsv"), it(e, { h: 0, s: 0, l: 0 }) && H(e.h) && H(e.s) && H(e.l) && ({ h: c, s: n, l: i } = e, c = R(c, 360), n = R(n, 100), i = R(i, 100), t = lt(c, n, i), u = "hsl"), it(e, { h: 0, w: 0, b: 0 }) && H(e.h) && H(e.w) && H(e.b) && ({ h: c, w: a, b: l } = e, c = R(c, 360), a = R(a, 100), l = R(l, 100), t = Le(c, a, l), u = "hwb"), H(e.a) && (s = e.a, s = $t(s) || parseFloat(`${s}`) > 1 ? R(s, 100) : s), {
1561
+ let t = { r: 0, g: 0, b: 0 }, e = o, s = 1, r, n, i, a, l, c, h, b, u = "rgb", d = !1;
1562
+ return (!e || typeof e == "string") && (e = Ne(e), d = e.ok), it(e, t) && N(e.r) && N(e.g) && N(e.b) && ({ r: h, g: b, b: l } = e, [h, b, l] = [h, b, l].map((g) => R(g, kt(g) ? 100 : 255)), t = { r: h, g: b, b: l }, u = "format" in e ? e.format : "rgb"), it(e, { h: 0, s: 0, v: 0 }) && N(e.h) && N(e.s) && N(e.v) && ({ h: c, s: r, v: n } = e, c = R(c, 360), r = R(r, 100), n = R(n, 100), t = It(c, r, n), u = "hsv"), it(e, { h: 0, s: 0, l: 0 }) && N(e.h) && N(e.s) && N(e.l) && ({ h: c, s: r, l: i } = e, c = R(c, 360), r = R(r, 100), i = R(i, 100), t = lt(c, r, i), u = "hsl"), it(e, { h: 0, w: 0, b: 0 }) && N(e.h) && N(e.w) && N(e.b) && ({ h: c, w: a, b: l } = e, c = R(c, 360), a = R(a, 100), l = R(l, 100), t = Ae(c, a, l), u = "hwb"), N(e.a) && (s = e.a, s = kt(s) || parseFloat(`${s}`) > 1 ? R(s, 100) : s), {
1563
1563
  r: t.r,
1564
1564
  g: t.g,
1565
1565
  b: t.b,
@@ -1567,38 +1567,38 @@ fe(o.getRootNode().host, t) : null, _ = (o, t) => at(o) ? o : (Q(t) ? t : K()).q
1567
1567
  format: u,
1568
1568
  ok: d
1569
1569
  };
1570
- }, go = "1.0.6";
1570
+ }, go = "1.0.7";
1571
1571
  class y {
1572
1572
  // bring main utilities to front
1573
1573
  static matchers = I;
1574
- static isOnePointZero = ye;
1575
- static isPercentage = $t;
1576
- static isValidCSSUnit = H;
1577
- static isNonColor = ke;
1578
- static isColorName = Pe;
1574
+ static isOnePointZero = xe;
1575
+ static isPercentage = kt;
1576
+ static isValidCSSUnit = N;
1577
+ static isNonColor = ye;
1578
+ static isColorName = Se;
1579
1579
  static isColorType = it;
1580
1580
  static pad2 = z;
1581
1581
  static clamp01 = ut;
1582
1582
  static bound01 = R;
1583
1583
  static boundAlpha = Dt;
1584
- static getRGBFromName = Se;
1585
- static convertHexToDecimal = Ot;
1586
- static convertDecimalToHex = Ce;
1587
- static rgbToHsl = te;
1588
- static rgbToHex = se;
1589
- static rgbToHsv = oe;
1590
- static rgbToHwb = ee;
1591
- static rgbaToHex = At;
1592
- static hslToRgb = Ft;
1593
- static hsvToRgb = Ft;
1584
+ static getRGBFromName = Ce;
1585
+ static convertHexToDecimal = Ft;
1586
+ static convertDecimalToHex = Le;
1587
+ static rgbToHsl = ee;
1588
+ static rgbToHex = re;
1589
+ static rgbToHsv = se;
1590
+ static rgbToHwb = oe;
1591
+ static rgbaToHex = Nt;
1592
+ static hslToRgb = It;
1593
+ static hsvToRgb = It;
1594
1594
  static hueToRgb = ft;
1595
- static hwbToRgb = Le;
1596
- static parseIntFromHex = N;
1597
- static stringInputToObject = Ae;
1595
+ static hwbToRgb = Ae;
1596
+ static parseIntFromHex = H;
1597
+ static stringInputToObject = Ne;
1598
1598
  static inputToRGB = ne;
1599
1599
  static roundPart = v;
1600
- static webColors = wt;
1601
- static nonColors = qt;
1600
+ static webColors = $t;
1601
+ static nonColors = zt;
1602
1602
  static version = go;
1603
1603
  // main public properties
1604
1604
  r;
@@ -1610,8 +1610,8 @@ class y {
1610
1610
  originalInput;
1611
1611
  // main public methods
1612
1612
  constructor(t, e) {
1613
- const s = e && xe.includes(e) ? e : "", { r: n, g: r, b: i, a, ok: l, format: c } = ne(t);
1614
- this.originalInput = t, this.r = n, this.g = r, this.b = i, this.a = a, this.ok = l, this.format = s || c;
1613
+ const s = e && Pe.includes(e) ? e : "", { r, g: n, b: i, a, ok: l, format: c } = ne(t);
1614
+ this.originalInput = t, this.r = r, this.g = n, this.b = i, this.a = a, this.ok = l, this.format = s || c;
1615
1615
  }
1616
1616
  /**
1617
1617
  * Checks if the current input value is a valid colour.
@@ -1632,8 +1632,8 @@ class y {
1632
1632
  */
1633
1633
  get luminance() {
1634
1634
  const { r: t, g: e, b: s } = this;
1635
- let n = 0, r = 0, i = 0;
1636
- return t <= 0.03928 ? n = t / 12.92 : n = ((t + 0.055) / 1.055) ** 2.4, e <= 0.03928 ? r = e / 12.92 : r = ((e + 0.055) / 1.055) ** 2.4, s <= 0.03928 ? i = s / 12.92 : i = ((s + 0.055) / 1.055) ** 2.4, 0.2126 * n + 0.7152 * r + 0.0722 * i;
1635
+ let r = 0, n = 0, i = 0;
1636
+ return t <= 0.03928 ? r = t / 12.92 : r = ((t + 0.055) / 1.055) ** 2.4, e <= 0.03928 ? n = e / 12.92 : n = ((e + 0.055) / 1.055) ** 2.4, s <= 0.03928 ? i = s / 12.92 : i = ((s + 0.055) / 1.055) ** 2.4, 0.2126 * r + 0.7152 * n + 0.0722 * i;
1637
1637
  }
1638
1638
  /**
1639
1639
  * Returns the perceived brightness of the colour.
@@ -1646,25 +1646,25 @@ class y {
1646
1646
  * Returns the web colour name closest to the current colour.
1647
1647
  */
1648
1648
  get name() {
1649
- const { r: t, g: e, b: s } = this.toRgb(), [n] = wt.map(([r, i]) => {
1649
+ const { r: t, g: e, b: s } = this.toRgb(), [r] = $t.map(([n, i]) => {
1650
1650
  const a = (
1651
1651
  // ((rgb.r - r) ** 2 + (rgb.g - g) ** 2 + (rgb.b - b) ** 2) ** 0.5; // standard
1652
1652
  (((i.r - t) * 0.3) ** 2 + ((i.g - e) * 0.6) ** 2 + ((i.b - s) * 0.1) ** 2) ** 0.5
1653
1653
  );
1654
- return [r, a];
1655
- }).find(([, r], i, a) => r === Math.min(...a.map(([, l]) => l)));
1656
- return n;
1654
+ return [n, a];
1655
+ }).find(([, n], i, a) => n === Math.min(...a.map(([, l]) => l)));
1656
+ return r;
1657
1657
  }
1658
1658
  /**
1659
1659
  * Returns the colour as an RGBA object.
1660
1660
  */
1661
1661
  toRgb() {
1662
- let { r: t, g: e, b: s, a: n } = this;
1663
- return [t, e, s] = [t, e, s].map((r) => v(r * 255 * 100) / 100), n = v(n * 100) / 100, {
1662
+ let { r: t, g: e, b: s, a: r } = this;
1663
+ return [t, e, s] = [t, e, s].map((n) => v(n * 255 * 100) / 100), r = v(r * 100) / 100, {
1664
1664
  r: t,
1665
1665
  g: e,
1666
1666
  b: s,
1667
- a: n
1667
+ a: r
1668
1668
  };
1669
1669
  }
1670
1670
  /**
@@ -1673,8 +1673,8 @@ class y {
1673
1673
  * * rgba(255,255,255,0.5)
1674
1674
  */
1675
1675
  toRgbString() {
1676
- const { r: t, g: e, b: s, a: n } = this.toRgb(), [r, i, a] = [t, e, s].map(v);
1677
- return n === 1 ? `rgb(${r}, ${i}, ${a})` : `rgba(${r}, ${i}, ${a}, ${n})`;
1676
+ const { r: t, g: e, b: s, a: r } = this.toRgb(), [n, i, a] = [t, e, s].map(v);
1677
+ return r === 1 ? `rgb(${n}, ${i}, ${a})` : `rgba(${n}, ${i}, ${a}, ${r})`;
1678
1678
  }
1679
1679
  /**
1680
1680
  * Returns the RGBA values concatenated into a CSS4 Module string format.
@@ -1682,16 +1682,16 @@ class y {
1682
1682
  * * rgb(255 255 255 / 50%)
1683
1683
  */
1684
1684
  toRgbCSS4String() {
1685
- const { r: t, g: e, b: s, a: n } = this.toRgb(), [r, i, a] = [t, e, s].map(v), l = n === 1 ? "" : ` / ${v(n * 100)}%`;
1686
- return `rgb(${r} ${i} ${a}${l})`;
1685
+ const { r: t, g: e, b: s, a: r } = this.toRgb(), [n, i, a] = [t, e, s].map(v), l = r === 1 ? "" : ` / ${v(r * 100)}%`;
1686
+ return `rgb(${n} ${i} ${a}${l})`;
1687
1687
  }
1688
1688
  /**
1689
1689
  * Returns the hexadecimal value of the colour. When the parameter is *true*
1690
1690
  * it will find a 3 characters shorthand of the decimal value.
1691
1691
  */
1692
1692
  toHex(t) {
1693
- const { r: e, g: s, b: n, a: r } = this.toRgb();
1694
- return r === 1 ? se(e, s, n, t) : At(e, s, n, r, t);
1693
+ const { r: e, g: s, b: r, a: n } = this.toRgb();
1694
+ return n === 1 ? re(e, s, r, t) : Nt(e, s, r, n, t);
1695
1695
  }
1696
1696
  /**
1697
1697
  * Returns the CSS valid hexadecimal vaue of the colour. When the parameter is *true*
@@ -1704,8 +1704,8 @@ class y {
1704
1704
  * Returns the HEX8 value of the colour.
1705
1705
  */
1706
1706
  toHex8(t) {
1707
- const { r: e, g: s, b: n, a: r } = this.toRgb();
1708
- return At(e, s, n, r, t);
1707
+ const { r: e, g: s, b: r, a: n } = this.toRgb();
1708
+ return Nt(e, s, r, n, t);
1709
1709
  }
1710
1710
  /**
1711
1711
  * Returns the HEX8 value of the colour.
@@ -1717,24 +1717,24 @@ class y {
1717
1717
  * Returns the colour as a HSVA object.
1718
1718
  */
1719
1719
  toHsv() {
1720
- const { r: t, g: e, b: s, a: n } = this, { h: r, s: i, v: a } = oe(t, e, s);
1720
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, v: a } = se(t, e, s);
1721
1721
  return {
1722
- h: r,
1722
+ h: n,
1723
1723
  s: i,
1724
1724
  v: a,
1725
- a: n
1725
+ a: r
1726
1726
  };
1727
1727
  }
1728
1728
  /**
1729
1729
  * Returns the colour as an HSLA object.
1730
1730
  */
1731
1731
  toHsl() {
1732
- const { r: t, g: e, b: s, a: n } = this, { h: r, s: i, l: a } = te(t, e, s);
1732
+ const { r: t, g: e, b: s, a: r } = this, { h: n, s: i, l: a } = ee(t, e, s);
1733
1733
  return {
1734
- h: r,
1734
+ h: n,
1735
1735
  s: i,
1736
1736
  l: a,
1737
- a: n
1737
+ a: r
1738
1738
  };
1739
1739
  }
1740
1740
  /**
@@ -1743,8 +1743,8 @@ class y {
1743
1743
  * * `hsla(150, 100%, 50%, 0.5)`
1744
1744
  */
1745
1745
  toHslString() {
1746
- let { h: t, s: e, l: s, a: n } = this.toHsl();
1747
- return t = v(t * 360), e = v(e * 100), s = v(s * 100), n = v(n * 100) / 100, n === 1 ? `hsl(${t}, ${e}%, ${s}%)` : `hsla(${t}, ${e}%, ${s}%, ${n})`;
1746
+ let { h: t, s: e, l: s, a: r } = this.toHsl();
1747
+ return t = v(t * 360), e = v(e * 100), s = v(s * 100), r = v(r * 100) / 100, r === 1 ? `hsl(${t}, ${e}%, ${s}%)` : `hsla(${t}, ${e}%, ${s}%, ${r})`;
1748
1748
  }
1749
1749
  /**
1750
1750
  * Returns the HSLA values concatenated into a CSS4 Module format string.
@@ -1752,31 +1752,31 @@ class y {
1752
1752
  * * `hsl(150deg 100% 50% / 50%)`
1753
1753
  */
1754
1754
  toHslCSS4String() {
1755
- let { h: t, s: e, l: s, a: n } = this.toHsl();
1756
- t = v(t * 360), e = v(e * 100), s = v(s * 100), n = v(n * 100);
1757
- const r = n < 100 ? ` / ${v(n)}%` : "";
1758
- return `hsl(${t}deg ${e}% ${s}%${r})`;
1755
+ let { h: t, s: e, l: s, a: r } = this.toHsl();
1756
+ t = v(t * 360), e = v(e * 100), s = v(s * 100), r = v(r * 100);
1757
+ const n = r < 100 ? ` / ${v(r)}%` : "";
1758
+ return `hsl(${t}deg ${e}% ${s}%${n})`;
1759
1759
  }
1760
1760
  /**
1761
1761
  * Returns the colour as an HWBA object.
1762
1762
  */
1763
1763
  toHwb() {
1764
- const { r: t, g: e, b: s, a: n } = this, { h: r, w: i, b: a } = ee(t, e, s);
1764
+ const { r: t, g: e, b: s, a: r } = this, { h: n, w: i, b: a } = oe(t, e, s);
1765
1765
  return {
1766
- h: r,
1766
+ h: n,
1767
1767
  w: i,
1768
1768
  b: a,
1769
- a: n
1769
+ a: r
1770
1770
  };
1771
1771
  }
1772
1772
  /**
1773
1773
  * Returns the HWBA values concatenated into a string.
1774
1774
  */
1775
1775
  toHwbString() {
1776
- let { h: t, w: e, b: s, a: n } = this.toHwb();
1777
- t = v(t * 360), e = v(e * 100), s = v(s * 100), n = v(n * 100);
1778
- const r = n < 100 ? ` / ${v(n)}%` : "";
1779
- return `hwb(${t}deg ${e}% ${s}%${r})`;
1776
+ let { h: t, w: e, b: s, a: r } = this.toHwb();
1777
+ t = v(t * 360), e = v(e * 100), s = v(s * 100), r = v(r * 100);
1778
+ const n = r < 100 ? ` / ${v(r)}%` : "";
1779
+ return `hwb(${t}deg ${e}% ${s}%${n})`;
1780
1780
  }
1781
1781
  /**
1782
1782
  * Sets the alpha value of the current colour.
@@ -1790,8 +1790,8 @@ class y {
1790
1790
  saturate(t) {
1791
1791
  if (typeof t != "number")
1792
1792
  return this;
1793
- const { h: e, s, l: n } = this.toHsl(), { r, g: i, b: a } = lt(e, ut(s + t / 100), n);
1794
- return Object.assign(this, { r, g: i, b: a }), this;
1793
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, ut(s + t / 100), r);
1794
+ return Object.assign(this, { r: n, g: i, b: a }), this;
1795
1795
  }
1796
1796
  /**
1797
1797
  * Desaturate the colour with a given amount.
@@ -1812,8 +1812,8 @@ class y {
1812
1812
  lighten(t) {
1813
1813
  if (typeof t != "number")
1814
1814
  return this;
1815
- const { h: e, s, l: n } = this.toHsl(), { r, g: i, b: a } = lt(e, s, ut(n + t / 100));
1816
- return Object.assign(this, { r, g: i, b: a }), this;
1815
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(e, s, ut(r + t / 100));
1816
+ return Object.assign(this, { r: n, g: i, b: a }), this;
1817
1817
  }
1818
1818
  /**
1819
1819
  * Decrease the colour lightness with a given amount.
@@ -1828,8 +1828,8 @@ class y {
1828
1828
  spin(t) {
1829
1829
  if (typeof t != "number")
1830
1830
  return this;
1831
- const { h: e, s, l: n } = this.toHsl(), { r, g: i, b: a } = lt(ut((e * 360 + t) % 360 / 360), s, n);
1832
- return Object.assign(this, { r, g: i, b: a }), this;
1831
+ const { h: e, s, l: r } = this.toHsl(), { r: n, g: i, b: a } = lt(ut((e * 360 + t) % 360 / 360), s, r);
1832
+ return Object.assign(this, { r: n, g: i, b: a }), this;
1833
1833
  }
1834
1834
  /** Returns a clone of the current `Color` instance. */
1835
1835
  clone() {
@@ -1843,7 +1843,7 @@ class y {
1843
1843
  return e === "hex" ? this.toHexString(t) : e === "hsl" ? this.toHslString() : e === "hwb" ? this.toHwbString() : this.toRgbString();
1844
1844
  }
1845
1845
  }
1846
- class It {
1846
+ class Kt {
1847
1847
  static Color = y;
1848
1848
  hue;
1849
1849
  hueSteps;
@@ -1858,36 +1858,36 @@ class It {
1858
1858
  * * `args.saturation` Saturation [0, 100]
1859
1859
  */
1860
1860
  constructor(...t) {
1861
- let e = 0, s = 12, n = 10, r = [0.5], i = 100;
1861
+ let e = 0, s = 12, r = 10, n = [0.5], i = 100;
1862
1862
  if (t.length === 4)
1863
- [e, s, n, i] = t;
1863
+ [e, s, r, i] = t;
1864
1864
  else if (t.length === 3)
1865
- [e, s, n] = t;
1866
- else if (t.length === 2 && ([s, n] = t, [s, n].some((g) => g < 1)))
1865
+ [e, s, r] = t;
1866
+ else if (t.length === 2 && ([s, r] = t, [s, r].some((g) => g < 1)))
1867
1867
  throw TypeError("ColorPalette: the two minimum arguments must be numbers higher than 0.");
1868
- const a = [], l = 360 / s, c = y.roundPart((n - (n % 2 ? 1 : 0)) / 2), h = [0.25, 0.2, 0.15, 0.11, 0.09, 0.075], b = [
1868
+ const a = [], l = 360 / s, c = y.roundPart((r - (r % 2 ? 1 : 0)) / 2), h = [0.25, 0.2, 0.15, 0.11, 0.09, 0.075], b = [
1869
1869
  [1, 2, 3],
1870
1870
  [4, 5],
1871
1871
  [6, 7],
1872
1872
  [8, 9],
1873
1873
  [10, 11],
1874
1874
  [12, 13]
1875
- ], u = b.find((g) => g.includes(n)), d = u ? h[b.indexOf(u)] : 100 / (n + (n % 2 ? 0 : 1)) / 100;
1875
+ ], u = b.find((g) => g.includes(r)), d = u ? h[b.indexOf(u)] : 100 / (r + (r % 2 ? 0 : 1)) / 100;
1876
1876
  for (let g = 1; g < c + 1; g += 1)
1877
- r = [...r, 0.5 + d * g];
1878
- for (let g = 1; g < n - c; g += 1)
1879
- r = [0.5 - d * g, ...r];
1877
+ n = [...n, 0.5 + d * g];
1878
+ for (let g = 1; g < r - c; g += 1)
1879
+ n = [0.5 - d * g, ...n];
1880
1880
  for (let g = 0; g < s; g += 1) {
1881
1881
  const p = (e + g * l) % 360 / 360;
1882
- r.forEach((f) => {
1882
+ n.forEach((f) => {
1883
1883
  const w = new y({ h: p, s: 1, l: f });
1884
1884
  a.push(i < 100 ? w.saturate(i - 100) : w);
1885
1885
  });
1886
1886
  }
1887
- this.hue = e, this.hueSteps = s, this.lightSteps = n, this.saturation = i, this.colors = a;
1887
+ this.hue = e, this.hueSteps = s, this.lightSteps = r, this.saturation = i, this.colors = a;
1888
1888
  }
1889
1889
  }
1890
- const He = {
1890
+ const Vt = {
1891
1891
  pickerLabel: "Colour Picker",
1892
1892
  appearanceLabel: "Colour Appearance",
1893
1893
  valueLabel: "Colour Value",
@@ -1905,7 +1905,7 @@ const He = {
1905
1905
  redLabel: "Red",
1906
1906
  greenLabel: "Green",
1907
1907
  blueLabel: "Blue"
1908
- }, Kt = [
1908
+ }, mt = [
1909
1909
  "white",
1910
1910
  "black",
1911
1911
  "grey",
@@ -1923,7 +1923,7 @@ const He = {
1923
1923
  "violet",
1924
1924
  "magenta",
1925
1925
  "pink"
1926
- ], re = (o) => {
1926
+ ], ie = (o) => {
1927
1927
  if (!V(o))
1928
1928
  return !1;
1929
1929
  try {
@@ -1932,14 +1932,14 @@ const He = {
1932
1932
  return !1;
1933
1933
  }
1934
1934
  return !0;
1935
- }, Vt = "v-hidden", uo = (o) => {
1936
- const { format: t, id: e, componentLabels: s } = o, n = x({
1935
+ }, Bt = "v-hidden", uo = (o) => {
1936
+ const { format: t, id: e, componentLabels: s } = o, r = x({
1937
1937
  tagName: "div",
1938
1938
  className: `color-form ${t}`
1939
1939
  });
1940
- let r = ["hex"];
1941
- return t === "rgb" ? r = ["red", "green", "blue", "alpha"] : t === "hsl" ? r = ["hue", "saturation", "lightness", "alpha"] : t === "hwb" && (r = ["hue", "whiteness", "blackness", "alpha"]), r.forEach((i) => {
1942
- const [a] = t === "hex" ? ["#"] : pe(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1940
+ let n = ["hex"];
1941
+ return t === "rgb" ? n = ["red", "green", "blue", "alpha"] : t === "hsl" ? n = ["hue", "saturation", "lightness", "alpha"] : t === "hwb" && (n = ["hue", "whiteness", "blackness", "alpha"]), n.forEach((i) => {
1942
+ const [a] = t === "hex" ? ["#"] : de(i).split(""), l = `color_${t}_${i}_${e}`, c = s[`${i}Label`], h = x({ tagName: "label" });
1943
1943
  m(h, "for", l), h.append(
1944
1944
  x({
1945
1945
  tagName: "span",
@@ -1948,7 +1948,7 @@ const He = {
1948
1948
  }),
1949
1949
  x({
1950
1950
  tagName: "span",
1951
- className: Vt,
1951
+ className: Bt,
1952
1952
  innerText: c
1953
1953
  })
1954
1954
  );
@@ -1967,11 +1967,11 @@ const He = {
1967
1967
  min: "0",
1968
1968
  max: u,
1969
1969
  step: d
1970
- }), n.append(h, b);
1971
- }), n;
1970
+ }), r.append(h, b);
1971
+ }), r;
1972
1972
  }, bo = (o) => {
1973
- const { format: t, componentLabels: e } = o, { hueLabel: s, alphaLabel: n, lightnessLabel: r, saturationLabel: i, whitenessLabel: a, blacknessLabel: l } = e, c = t === "hsl" ? 360 : 100, h = t === "hsl" ? 100 : 360, b = 100;
1974
- let u = t === "hsl" ? `${s} & ${r}` : `${r} & ${i}`;
1973
+ const { format: t, componentLabels: e } = o, { hueLabel: s, alphaLabel: r, lightnessLabel: n, saturationLabel: i, whitenessLabel: a, blacknessLabel: l } = e, c = t === "hsl" ? 360 : 100, h = t === "hsl" ? 100 : 360, b = 100;
1974
+ let u = t === "hsl" ? `${s} & ${n}` : `${n} & ${i}`;
1975
1975
  u = t === "hwb" ? `${a} & ${l}` : u;
1976
1976
  const d = t === "hsl" ? `${i}` : `${s}`, g = x({
1977
1977
  tagName: "div",
@@ -1995,7 +1995,7 @@ const He = {
1995
1995
  {
1996
1996
  i: 3,
1997
1997
  c: f,
1998
- l: n,
1998
+ l: r,
1999
1999
  min: 0,
2000
2000
  max: b
2001
2001
  }
@@ -2023,8 +2023,8 @@ const He = {
2023
2023
  });
2024
2024
  E.append(A), g.append(E);
2025
2025
  }), g;
2026
- }, ie = (o, t, e) => {
2027
- const { input: s, format: n, componentLabels: r } = o, { defaultsLabel: i, presetsLabel: a } = r, l = e === "color-options", c = t instanceof It, h = l ? a : i, b = c ? t.colors : t, u = b.length, { lightSteps: d } = c ? t : { lightSteps: null }, g = d || [9, 10].find((A) => u >= A * 2 && !(u % A)) || 5, p = l && u > g;
2026
+ }, ae = (o, t, e) => {
2027
+ const { input: s, format: r, componentLabels: n } = o, { defaultsLabel: i, presetsLabel: a } = n, l = e === "color-options", c = t instanceof Kt, h = l ? a : i, b = c ? t.colors : t, u = b.length, { lightSteps: d } = c ? t : { lightSteps: null }, g = d || [9, 10].find((A) => u >= A * 2 && !(u % A)) || 5, p = l && u > g;
2028
2028
  let f = 2;
2029
2029
  f = p && u > g * 2 ? 3 : f, f = p && u > g * 3 ? 4 : f, f = p && u > g * 4 ? 5 : f;
2030
2030
  const w = f - (u <= g * 3 ? 1 : 2), $ = p && u > w * g;
@@ -2039,7 +2039,7 @@ const He = {
2039
2039
  role: "listbox",
2040
2040
  ariaLabel: h
2041
2041
  });
2042
- return $ && O(E, {
2042
+ return $ && D(E, {
2043
2043
  "--grid-item-size": `${S}rem`,
2044
2044
  "--grid-fit": `${g}`,
2045
2045
  "--grid-gap": L,
@@ -2048,21 +2048,21 @@ const He = {
2048
2048
  }), b.forEach((A) => {
2049
2049
  let [F, tt] = typeof A == "string" ? A.trim().split(":") : [];
2050
2050
  A instanceof y && (F = A.toHexString(), tt = F);
2051
- const zt = new y(A instanceof y ? A : F, n).toString() === yt(s, "value"), xt = x({
2051
+ const Gt = new y(A instanceof y ? A : F, r).toString() === xt(s, "value"), Pt = x({
2052
2052
  tagName: "li",
2053
- className: `color-option${zt ? " active" : ""}`,
2053
+ className: `color-option${Gt ? " active" : ""}`,
2054
2054
  innerText: `${tt || F}`,
2055
2055
  tabIndex: 0,
2056
2056
  role: "option",
2057
- ariaSelected: zt ? "true" : "false"
2057
+ ariaSelected: Gt ? "true" : "false"
2058
2058
  });
2059
- m(xt, "data-value", `${F}`), l && O(xt, { backgroundColor: F }), E.append(xt);
2059
+ m(Pt, "data-value", `${F}`), l && D(Pt, { backgroundColor: F }), E.append(Pt);
2060
2060
  }), E;
2061
2061
  }, po = (o) => {
2062
- const { input: t, parent: e, format: s, id: n, componentLabels: r, colorKeywords: i, colorPresets: a } = o, l = yt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = r, g = c.includes(l) ? "#fff" : l;
2062
+ const { input: t, parent: e, format: s, id: r, componentLabels: n, colorKeywords: i, colorPresets: a } = o, l = xt(t, "value") || "#fff", { nonColors: c } = y, { toggleLabel: h, pickerLabel: b, formatLabel: u, hexLabel: d } = n, g = c.includes(l) ? "#fff" : l;
2063
2063
  o.color = new y(g, s);
2064
- const p = s === "hex" ? d : pe(s), f = x({
2065
- id: `picker-btn-${n}`,
2064
+ const p = s === "hex" ? d : de(s), f = x({
2065
+ id: `picker-btn-${r}`,
2066
2066
  tagName: "button",
2067
2067
  className: "picker-toggle btn-appearance",
2068
2068
  ariaExpanded: "false",
@@ -2071,7 +2071,7 @@ const He = {
2071
2071
  f.append(
2072
2072
  x({
2073
2073
  tagName: "span",
2074
- className: Vt,
2074
+ className: Bt,
2075
2075
  innerText: `${b}. ${u}: ${p}`
2076
2076
  })
2077
2077
  );
@@ -2079,70 +2079,72 @@ const He = {
2079
2079
  tagName: "div",
2080
2080
  className: "color-dropdown picker",
2081
2081
  role: "group",
2082
- ariaLabelledBy: `picker-btn-${n}`
2082
+ ariaLabelledBy: `picker-btn-${r}`
2083
2083
  }), $ = bo(o), P = uo(o);
2084
2084
  if (w.append($, P), t.before(f), e.append(w), i || a) {
2085
2085
  const L = x({
2086
2086
  tagName: "div",
2087
2087
  className: "color-dropdown scrollable menu"
2088
2088
  });
2089
- a && L.append(ie(o, a, "color-options")), i && i.length && L.append(ie(o, i, "color-defaults"));
2089
+ a && L.append(ae(o, a, "color-options")), i && i.length && L.append(ae(o, i, "color-defaults"));
2090
2090
  const S = x({
2091
2091
  tagName: "button",
2092
2092
  className: "menu-toggle btn-appearance",
2093
2093
  tabIndex: -1,
2094
2094
  ariaExpanded: "false",
2095
2095
  ariaHasPopup: "true"
2096
- }), C = encodeURI("http://www.w3.org/2000/svg"), M = Mt(C, {
2096
+ }), C = encodeURI("http://www.w3.org/2000/svg"), M = Tt(C, {
2097
2097
  tagName: "svg"
2098
2098
  });
2099
2099
  m(M, "xmlns", C), m(M, "viewBox", "0 0 512 512"), m(M, Me, "true");
2100
- const E = Mt(C, {
2100
+ const E = Tt(C, {
2101
2101
  tagName: "path"
2102
2102
  });
2103
2103
  m(E, "d", "M98,158l157,156L411,158l27,27L255,368L71,185L98,158z"), m(E, "fill", "#fff"), M.append(E), S.append(
2104
2104
  x({
2105
2105
  tagName: "span",
2106
- className: Vt,
2106
+ className: Bt,
2107
2107
  innerText: `${h}`
2108
2108
  }),
2109
2109
  M
2110
2110
  ), e.append(S, L);
2111
2111
  }
2112
2112
  i && c.includes(l) && (o.value = l), m(t, Y, "-1");
2113
- }, fo = "2.0.0-alpha1", Z = "color-picker", mo = `[data-function="${Z}"]`, ae = `.${Z}`, vo = {
2114
- componentLabels: He,
2115
- colorLabels: Kt,
2113
+ }, fo = "2.0.0-alpha3", Z = "color-picker", mo = `[data-function="${Z}"]`, le = `.${Z}`, vo = {
2114
+ componentLabels: Vt,
2115
+ colorLabels: mt,
2116
2116
  format: "rgb",
2117
2117
  colorPresets: !1,
2118
2118
  colorKeywords: !1
2119
- }, { roundPart: k, nonColors: bt } = y, wo = (o) => Qe(o, Z), $o = (o) => new ko(o), le = (o, t) => {
2120
- const e = t ? ge : Bt, { input: s, pickerToggle: n, menuToggle: r } = o;
2121
- e(s, De, o.showPicker), e(n, Et, o.togglePicker), r && e(r, Et, o.toggleMenu);
2122
- }, Ne = (o, t) => {
2123
- const e = t ? ge : Bt, { input: s, colorMenu: n, parent: r } = o, i = K(s), a = ao(i);
2124
- e(o.controls, Ie, o.pointerDown), o.controlKnobs.forEach((l) => e(l, Ut, o.handleKnobs)), e(a, Be, o.handleScroll), e(a, Ve, o.update), [s, ...o.inputs].forEach((l) => e(l, Te, o.changeHandler)), n && (e(n, Et, o.menuClickHandler), e(n, Ut, o.menuKeyHandler)), e(i, ue, o.pointerMove), e(i, Ke, o.pointerUp), e(r, Oe, o.handleFocusOut), e(i, Fe, o.handleDismiss);
2125
- }, ce = (o) => {
2119
+ }, { roundPart: k, nonColors: bt } = y, wo = (o) => Qe(o, Z), $o = (o) => new ko(o), ce = (o, t) => {
2120
+ const e = t ? ue : jt, { input: s, pickerToggle: r, menuToggle: n } = o;
2121
+ e(s, Oe, o.showPicker), e(r, Mt, o.togglePicker), n && e(n, Mt, o.toggleMenu);
2122
+ }, He = (o, t) => {
2123
+ const e = t ? ue : jt, { input: s, colorMenu: r, parent: n } = o, i = K(s), a = ao(i);
2124
+ e(o.controls, Ie, o.pointerDown), o.controlKnobs.forEach((l) => e(l, _t, o.handleKnobs)), e(a, Be, o.handleScroll), e(a, Ve, o.update), [s, ...o.inputs].forEach((l) => e(l, Te, o.changeHandler)), r && (e(r, Mt, o.menuClickHandler), e(r, _t, o.menuKeyHandler)), e(i, be, o.pointerMove), e(i, Ke, o.pointerUp), e(n, De, o.handleFocusOut), e(i, Fe, o.handleDismiss);
2125
+ }, he = (o) => {
2126
2126
  eo(o.input, new CustomEvent("colorpicker.change"));
2127
2127
  }, Ee = (o) => {
2128
- o && ["bottom", "top"].forEach((t) => D(o, t));
2128
+ o && ["bottom", "top"].forEach((t) => O(o, t));
2129
2129
  }, Ht = (o, t) => {
2130
- const { colorPicker: e, colorMenu: s, menuToggle: n, pickerToggle: r, parent: i } = o, a = t === e, l = a ? s : e, c = a ? n : r, h = a ? r : n;
2131
- T(i, "open") || q(i, "open"), l && (D(l, "show"), Ee(l)), q(t, "bottom"), ro(t), q(t, "show"), a && o.update(), o.isOpen || (Ne(o, !0), o.updateDropdownPosition(), o.isOpen = !0, m(o.input, Y, "0"), n && m(n, Y, "0")), m(h, Nt, "true"), c && m(c, Nt, "false");
2130
+ const { colorPicker: e, colorMenu: s, menuToggle: r, pickerToggle: n, parent: i } = o, a = t === e, l = a ? s : e, c = a ? r : n, h = a ? n : r;
2131
+ T(i, "open") || q(i, "open"), l && (O(l, "show"), Ee(l)), q(t, "bottom"), no(t), q(t, "show"), a && o.update(), o.isOpen || (He(o, !0), o.updateDropdownPosition(), o.isOpen = !0, m(o.input, Y, "0"), r && m(r, Y, "0")), m(h, Et, "true"), c && m(c, Et, "false");
2132
2132
  };
2133
2133
  class ko {
2134
2134
  // bring utils to staic
2135
2135
  static Color = y;
2136
- static ColorPalette = It;
2136
+ static ColorPalette = Kt;
2137
2137
  static getInstance = wo;
2138
2138
  static init = $o;
2139
2139
  static selector = mo;
2140
2140
  // utils important for render
2141
2141
  static roundPart = k;
2142
- static setElementStyle = O;
2142
+ static setElementStyle = D;
2143
2143
  static setAttribute = m;
2144
2144
  static getBoundingClientRect = gt;
2145
2145
  static version = fo;
2146
+ static colorNames = mt;
2147
+ static colorPickerLabels = Vt;
2146
2148
  id;
2147
2149
  input;
2148
2150
  color;
@@ -2177,37 +2179,37 @@ class ko {
2177
2179
  if (V(t) && !s)
2178
2180
  throw new TypeError(`ColorPicker target "${t}" cannot be found.`);
2179
2181
  this.input = s;
2180
- const n = fe(s, ae);
2181
- if (!n)
2182
+ const r = me(s, le);
2183
+ if (!r)
2182
2184
  throw new TypeError("ColorPicker requires a specific markup to work.");
2183
- this.parent = n, this.id = de(s, Z), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2185
+ this.parent = r, this.id = fe(s, Z), this.dragElement = void 0, this.isOpen = !1, this.controlPositions = {
2184
2186
  c1x: 0,
2185
2187
  c1y: 0,
2186
2188
  c2y: 0,
2187
2189
  c3y: 0
2188
2190
  }, this.colorLabels = {}, this.colorKeywords = !1, this.colorPresets = !1;
2189
- const { format: r, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = no(
2191
+ const { format: n, componentLabels: i, colorLabels: a, colorKeywords: l, colorPresets: c } = ro(
2190
2192
  s,
2191
2193
  vo,
2192
2194
  e || {}
2193
2195
  );
2194
- let h = Kt;
2195
- Lt(a) && a.length === 17 ? h = a : V(a) && a.split(",").length === 17 && (h = a.split(",")), Kt.forEach((p, f) => {
2196
+ let h = mt;
2197
+ At(a) && a.length === 17 ? h = a : V(a) && a.split(",").length === 17 && (h = a.split(",")), mt.forEach((p, f) => {
2196
2198
  this.colorLabels[p] = h[f].trim();
2197
2199
  });
2198
- const b = V(i) && re(i) ? JSON.parse(i) : i;
2199
- if (this.componentLabels = B({ ...He }, b), this.color = new y(s.value || "#fff", r), this.format = r, Lt(l) && l.length ? this.colorKeywords = l : V(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), Lt(c) && c.length)
2200
+ const b = V(i) && ie(i) ? JSON.parse(i) : i;
2201
+ if (this.componentLabels = B({ ...Vt }, b), this.color = new y(s.value || "#fff", n), this.format = n, At(l) && l.length ? this.colorKeywords = l : V(l) && l.length && (this.colorKeywords = l.split(",").map((p) => p.trim())), At(c) && c.length)
2200
2202
  this.colorPresets = c;
2201
- else if (c && re(c)) {
2203
+ else if (c && ie(c)) {
2202
2204
  const { hue: p, hueSteps: f, lightSteps: w, saturation: $ } = JSON.parse(c);
2203
- this.colorPresets = new It(p, f, w, $);
2205
+ this.colorPresets = new Kt(p, f, w, $);
2204
2206
  } else
2205
2207
  V(c) && (this.colorPresets = c.split(",").map((p) => p.trim()));
2206
- this.showPicker = this.showPicker.bind(this), this.togglePicker = this.togglePicker.bind(this), this.toggleMenu = this.toggleMenu.bind(this), this.menuClickHandler = this.menuClickHandler.bind(this), this.menuKeyHandler = this.menuKeyHandler.bind(this), this.pointerDown = this.pointerDown.bind(this), this.pointerMove = this.pointerMove.bind(this), this.pointerUp = this.pointerUp.bind(this), this.update = this.update.bind(this), this.handleScroll = this.handleScroll.bind(this), this.handleFocusOut = this.handleFocusOut.bind(this), this.changeHandler = this.changeHandler.bind(this), this.handleDismiss = this.handleDismiss.bind(this), this.handleKnobs = this.handleKnobs.bind(this), po(this);
2207
- const [u, d] = nt("color-dropdown", n);
2208
- this.pickerToggle = _(".picker-toggle", n), this.menuToggle = _(".menu-toggle", n), this.colorPicker = u, this.colorMenu = d, this.inputs = [...nt("color-input", n)];
2209
- const [g] = nt("color-controls", n);
2210
- this.controls = g, this.controlKnobs = [...nt("knob", g)], this.visuals = [...nt("visual-control", g)], this.update(), le(this, !0), ct.set(s, Z, this);
2208
+ po(this);
2209
+ const [u, d] = rt("color-dropdown", r);
2210
+ this.pickerToggle = _(".picker-toggle", r), this.menuToggle = _(".menu-toggle", r), this.colorPicker = u, this.colorMenu = d, this.inputs = [...rt("color-input", r)];
2211
+ const [g] = rt("color-controls", r);
2212
+ this.controls = g, this.controlKnobs = [...rt("knob", g)], this.visuals = [...rt("visual-control", g)], this.update(), ce(this, !0), ct.set(s, Z, this);
2211
2213
  }
2212
2214
  /** Returns the current colour value */
2213
2215
  get value() {
@@ -2265,7 +2267,7 @@ class ko {
2265
2267
  }
2266
2268
  /** Returns the colour appearance, usually the closest colour name for the current value. */
2267
2269
  get appearance() {
2268
- const { colorLabels: t, hsl: e, hsv: s, format: n } = this, r = k(e.h * 360), i = n === "hsl" ? e.s : s.s, a = k(i * 100), l = k(e.l * 100), c = s.v * 100;
2270
+ const { colorLabels: t, hsl: e, hsv: s, format: r } = this, n = k(e.h * 360), i = r === "hsl" ? e.s : s.s, a = k(i * 100), l = k(e.l * 100), c = s.v * 100;
2269
2271
  let h = "black";
2270
2272
  if (l === 100 && a === 0)
2271
2273
  h = t.white;
@@ -2273,20 +2275,20 @@ class ko {
2273
2275
  h = t.black;
2274
2276
  else if (a === 0)
2275
2277
  h = t.grey;
2276
- else if (r < 15 || r >= 345)
2278
+ else if (n < 15 || n >= 345)
2277
2279
  h = t.red;
2278
- else if (r >= 15 && r < 45)
2280
+ else if (n >= 15 && n < 45)
2279
2281
  h = c > 80 && a > 80 ? t.orange : t.brown;
2280
- else if (r >= 45 && r < 75) {
2281
- const b = r > 46 && r < 54 && c < 80 && a > 90, u = r >= 54 && r < 75 && c < 80;
2282
+ else if (n >= 45 && n < 75) {
2283
+ const b = n > 46 && n < 54 && c < 80 && a > 90, u = n >= 54 && n < 75 && c < 80;
2282
2284
  h = b ? t.gold : t.yellow, h = u ? t.olive : h;
2283
2285
  } else
2284
- r >= 75 && r < 155 ? h = c < 68 ? t.green : t.lime : r >= 155 && r < 175 ? h = t.teal : r >= 175 && r < 195 ? h = t.cyan : r >= 195 && r < 255 ? h = t.blue : r >= 255 && r < 270 ? h = t.violet : r >= 270 && r < 295 ? h = t.magenta : r >= 295 && r < 345 && (h = t.pink);
2286
+ n >= 75 && n < 155 ? h = c < 68 ? t.green : t.lime : n >= 155 && n < 175 ? h = t.teal : n >= 175 && n < 195 ? h = t.cyan : n >= 195 && n < 255 ? h = t.blue : n >= 255 && n < 270 ? h = t.violet : n >= 270 && n < 295 ? h = t.magenta : n >= 295 && n < 345 && (h = t.pink);
2285
2287
  return h;
2286
2288
  }
2287
2289
  /** Updates `ColorPicker` visuals. */
2288
2290
  updateVisuals() {
2289
- const { controlPositions: t, visuals: e } = this, [s, n, r] = e, { offsetHeight: i } = s, a = t.c2y / i, { r: l, g: c, b: h } = new y({ h: a, s: 1, l: 0.5 }).toRgb(), b = "linear-gradient(rgb(255,255,255) 0%, rgb(255,255,255) 100%)", u = 1 - t.c3y / i, d = k(u * 100) / 100, g = new y({
2291
+ const { controlPositions: t, visuals: e } = this, [s, r, n] = e, { offsetHeight: i } = s, a = t.c2y / i, { r: l, g: c, b: h } = new y({ h: a, s: 1, l: 0.5 }).toRgb(), b = "linear-gradient(rgb(255,255,255) 0%, rgb(255,255,255) 100%)", u = 1 - t.c3y / i, d = k(u * 100) / 100, g = new y({
2290
2292
  h: a,
2291
2293
  s: 1,
2292
2294
  l: 0.5,
@@ -2296,11 +2298,11 @@ class ko {
2296
2298
  rgb(0,255,0) 33.33%, rgb(0,255,255) 50%,
2297
2299
  rgb(0,0,255) 66.67%, rgb(255,0,255) 83.33%,
2298
2300
  rgb(255,0,0) 100%)`;
2299
- O(s, {
2301
+ D(s, {
2300
2302
  background: `linear-gradient(rgba(0,0,0,0) 0%, rgba(0,0,0,${d}) 100%),
2301
2303
  linear-gradient(to right, rgba(255,255,255,${d}) 0%, ${g} 100%),
2302
2304
  ${b}`
2303
- }), O(n, { background: p }), O(r, {
2305
+ }), D(r, { background: p }), D(n, {
2304
2306
  background: `linear-gradient(rgba(${l},${c},${h},1) 0%,rgba(${l},${c},${h},0) 100%)`
2305
2307
  });
2306
2308
  }
@@ -2310,49 +2312,49 @@ class ko {
2310
2312
  * @param e
2311
2313
  * @this {ColorPicker}
2312
2314
  */
2313
- handleFocusOut({ relatedTarget: t }) {
2315
+ handleFocusOut = ({ relatedTarget: t }) => {
2314
2316
  t && !this.parent.contains(t) && this.hide(!0);
2315
- }
2317
+ };
2316
2318
  /**
2317
2319
  * The `ColorPicker` *keyup* event listener when open.
2318
2320
  *
2319
2321
  * @param e
2320
2322
  * @this {ColorPicker}
2321
2323
  */
2322
- handleDismiss({ code: t }) {
2324
+ handleDismiss = ({ code: t }) => {
2323
2325
  this.isOpen && t === ze && this.hide();
2324
- }
2326
+ };
2325
2327
  /**
2326
2328
  * The `ColorPicker` *scroll* event listener when open.
2327
2329
  *
2328
2330
  * @param e
2329
2331
  * @this {ColorPicker}
2330
2332
  */
2331
- handleScroll(t) {
2333
+ handleScroll = (t) => {
2332
2334
  const { activeElement: e } = K(this.input);
2333
- this.updateDropdownPosition(), ([ue, je].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2334
- }
2335
+ this.updateDropdownPosition(), ([be, je].includes(t.type) && this.dragElement || e && this.controlKnobs.includes(e)) && (t.stopPropagation(), t.preventDefault());
2336
+ };
2335
2337
  /**
2336
2338
  * The `ColorPicker` keyboard event listener for menu navigation.
2337
2339
  *
2338
2340
  * @param e
2339
2341
  */
2340
- menuKeyHandler(t) {
2341
- const { target: e, code: s } = t, { previousElementSibling: n, nextElementSibling: r, parentElement: i } = e, a = i && T(i, "color-options"), l = i ? [...i.children] : [], c = a && Tt(i, "grid-template-columns").split(" ").length, h = l.indexOf(e), b = h > -1 && c && l[h - c], u = h > -1 && c && l[h + c];
2342
- [j, st, _t].includes(s) && t.preventDefault(), a ? b && s === st ? U(b) : u && s === j ? U(u) : n && s === ht ? U(n) : r && s === G && U(r) : n && [ht, st].includes(s) ? U(n) : r && [G, j].includes(s) && U(r), [qe, _t].includes(s) && this.menuClickHandler(t);
2343
- }
2342
+ menuKeyHandler = (t) => {
2343
+ const { target: e, code: s } = t, { previousElementSibling: r, nextElementSibling: n, parentElement: i } = e, a = i && T(i, "color-options"), l = i ? [...i.children] : [], c = a && Rt(i, "grid-template-columns").split(" ").length, h = l.indexOf(e), b = h > -1 && c && l[h - c], u = h > -1 && c && l[h + c];
2344
+ [j, st, Wt].includes(s) && t.preventDefault(), a ? b && s === st ? U(b) : u && s === j ? U(u) : r && s === ht ? U(r) : n && s === G && U(n) : r && [ht, st].includes(s) ? U(r) : n && [G, j].includes(s) && U(n), [qe, Wt].includes(s) && this.menuClickHandler(t);
2345
+ };
2344
2346
  /**
2345
2347
  * The `ColorPicker` click event listener for the colour menu presets / defaults.
2346
2348
  *
2347
2349
  * @param e
2348
2350
  * @this {ColorPicker}
2349
2351
  */
2350
- menuClickHandler(t) {
2351
- const { target: e } = t, { colorMenu: s } = this, n = (yt(e, "data-value") || "").trim();
2352
- if (!n.length)
2352
+ menuClickHandler = (t) => {
2353
+ const { target: e } = t, { colorMenu: s } = this, r = (xt(e, "data-value") || "").trim();
2354
+ if (!r.length)
2353
2355
  return;
2354
- const r = _("li.active", s);
2355
- let i = n;
2356
+ const n = _("li.active", s);
2357
+ let i = r;
2356
2358
  i = bt.includes(i) ? "white" : i, i = i === "transparent" ? "rgba(0,0,0,0)" : i;
2357
2359
  const { r: a, g: l, b: c, a: h } = new y(i);
2358
2360
  B(this.color, {
@@ -2360,54 +2362,54 @@ class ko {
2360
2362
  g: l,
2361
2363
  b: c,
2362
2364
  a: h
2363
- }), this.update(), r !== e && (r && (D(r, "active"), St(r, Pt)), q(e, "active"), m(e, Pt, "true"), bt.includes(n) && (this.value = n), ce(this));
2364
- }
2365
+ }), this.update(), n !== e && (n && (O(n, "active"), Ct(n, St)), q(e, "active"), m(e, St, "true"), bt.includes(r) && (this.value = r), he(this));
2366
+ };
2365
2367
  /**
2366
2368
  * The `ColorPicker` *touchstart* / *mousedown* events listener for control knobs.
2367
2369
  *
2368
2370
  * @param e
2369
2371
  */
2370
- pointerDown(t) {
2371
- const { target: e, pageX: s, pageY: n } = t, { colorMenu: r, visuals: i, controlKnobs: a } = this, [l, c, h] = i, [b, u, d] = a, g = a.includes(e) ? e.previousElementSibling : e, p = gt(g), f = Ct(l), w = s - f.scrollLeft - p.left, $ = n - f.scrollTop - p.top;
2372
- if (e === l || e === b ? (this.dragElement = g, this.changeControl1(w, $)) : e === c || e === u ? (this.dragElement = g, this.changeControl2($)) : (e === h || e === d) && (this.dragElement = g, this.changeAlpha($)), r) {
2373
- const P = _("li.active", r);
2374
- P && (D(P, "active"), St(P, Pt));
2372
+ pointerDown = (t) => {
2373
+ const { target: e, pageX: s, pageY: r } = t, { colorMenu: n, visuals: i, controlKnobs: a } = this, [l, c, h] = i, [b, u, d] = a, g = a.includes(e) ? e.previousElementSibling : e, p = gt(g), f = Lt(l), w = s - f.scrollLeft - p.left, $ = r - f.scrollTop - p.top;
2374
+ if (e === l || e === b ? (this.dragElement = g, this.changeControl1(w, $)) : e === c || e === u ? (this.dragElement = g, this.changeControl2($)) : (e === h || e === d) && (this.dragElement = g, this.changeAlpha($)), n) {
2375
+ const P = _("li.active", n);
2376
+ P && (O(P, "active"), Ct(P, St));
2375
2377
  }
2376
2378
  t.preventDefault();
2377
- }
2379
+ };
2378
2380
  /**
2379
2381
  * The `ColorPicker` *touchend* / *mouseup* events listener for control knobs.
2380
2382
  *
2381
2383
  * @param e
2382
2384
  * @this
2383
2385
  */
2384
- pointerUp({ target: t }) {
2385
- const { parent: e } = this, s = K(e), n = _(`${ae}.open`, s) !== null, r = s.getSelection();
2386
- !this.dragElement && (!r || !r.toString().length) && !e.contains(t) && this.hide(n), this.dragElement = void 0;
2387
- }
2386
+ pointerUp = ({ target: t }) => {
2387
+ const { parent: e } = this, s = K(e), r = _(`${le}.open`, s) !== null, n = s.getSelection();
2388
+ !this.dragElement && (!n || !n.toString().length) && !e.contains(t) && this.hide(r), this.dragElement = void 0;
2389
+ };
2388
2390
  /**
2389
2391
  * The `ColorPicker` *touchmove* / *mousemove* events listener for control knobs.
2390
2392
  *
2391
2393
  * @param {PointerEvent} e
2392
2394
  */
2393
- pointerMove(t) {
2394
- const { dragElement: e, visuals: s } = this, [n, r, i] = s, { pageX: a, pageY: l } = t;
2395
+ pointerMove = (t) => {
2396
+ const { dragElement: e, visuals: s } = this, [r, n, i] = s, { pageX: a, pageY: l } = t;
2395
2397
  if (!e)
2396
2398
  return;
2397
- const c = gt(e), h = Ct(n), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2398
- e === n && this.changeControl1(b, u), e === r && this.changeControl2(u), e === i && this.changeAlpha(u);
2399
- }
2399
+ const c = gt(e), h = Lt(r), b = a - h.scrollLeft - c.left, u = l - h.scrollTop - c.top;
2400
+ e === r && this.changeControl1(b, u), e === n && this.changeControl2(u), e === i && this.changeAlpha(u);
2401
+ };
2400
2402
  /**
2401
2403
  * The `ColorPicker` *keydown* event listener for control knobs.
2402
2404
  *
2403
2405
  * @param e
2404
2406
  */
2405
- handleKnobs(t) {
2407
+ handleKnobs = (t) => {
2406
2408
  const { target: e, code: s } = t;
2407
2409
  if (![st, j, ht, G].includes(s))
2408
2410
  return;
2409
2411
  t.preventDefault();
2410
- const { controlKnobs: n, visuals: r } = this, { offsetWidth: i, offsetHeight: a } = r[0], [l, c, h] = n, { activeElement: b } = K(l), u = n.find((g) => g === b), d = a / 360;
2412
+ const { controlKnobs: r, visuals: n } = this, { offsetWidth: i, offsetHeight: a } = n[0], [l, c, h] = r, { activeElement: b } = K(l), u = r.find((g) => g === b), d = a / 360;
2411
2413
  if (u) {
2412
2414
  let g = 0, p = 0;
2413
2415
  if (e === l) {
@@ -2417,13 +2419,13 @@ class ko {
2417
2419
  e === c ? (this.controlPositions.c2y += [j, G].includes(s) ? d : -d, p = this.controlPositions.c2y, this.changeControl2(p)) : e === h && (this.controlPositions.c3y += [j, G].includes(s) ? d : -d, p = this.controlPositions.c3y, this.changeAlpha(p));
2418
2420
  this.handleScroll(t);
2419
2421
  }
2420
- }
2422
+ };
2421
2423
  /** The event listener of the colour form inputs. */
2422
- changeHandler() {
2424
+ changeHandler = () => {
2423
2425
  let t;
2424
- const { inputs: e, format: s, value: n, input: r, controlPositions: i, visuals: a } = this, { activeElement: l } = K(r), { offsetHeight: c } = a[0], [h, , , b] = e, [u, d, g, p] = s === "rgb" ? e.map(($) => parseFloat($.value) / ($ === b ? 100 : 1)) : e.map(($) => parseFloat($.value) / ($ !== h ? 100 : 360)), f = this.hasNonColor && bt.includes(n), w = b ? p : 1 - i.c3y / c;
2425
- if (l === r || l && e.includes(l)) {
2426
- l === r ? f ? t = n === "transparent" ? "rgba(0,0,0,0)" : "rgb(0,0,0)" : t = n : s === "hex" ? t = h.value : s === "hsl" ? t = {
2426
+ const { inputs: e, format: s, value: r, input: n, controlPositions: i, visuals: a } = this, { activeElement: l } = K(n), { offsetHeight: c } = a[0], [h, , , b] = e, [u, d, g, p] = s === "rgb" ? e.map(($) => parseFloat($.value) / ($ === b ? 100 : 1)) : e.map(($) => parseFloat($.value) / ($ !== h ? 100 : 360)), f = this.hasNonColor && bt.includes(r), w = b ? p : 1 - i.c3y / c;
2427
+ if (l === n || l && e.includes(l)) {
2428
+ l === n ? f ? t = r === "transparent" ? "rgba(0,0,0,0)" : "rgb(0,0,0)" : t = r : s === "hex" ? t = h.value : s === "hsl" ? t = {
2427
2429
  h: u,
2428
2430
  s: d,
2429
2431
  l: g,
@@ -2445,9 +2447,9 @@ class ko {
2445
2447
  g: P,
2446
2448
  b: L,
2447
2449
  a: S
2448
- }), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l === r && f && (this.value = n);
2450
+ }), this.setControlPositions(), this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals(), l === n && f && (this.value = r);
2449
2451
  }
2450
- }
2452
+ };
2451
2453
  /**
2452
2454
  * Updates `ColorPicker` first control:
2453
2455
  * * `lightness` and `saturation` for HEX/RGB;
@@ -2457,10 +2459,10 @@ class ko {
2457
2459
  * @param Y the Y component of the offset
2458
2460
  */
2459
2461
  changeControl1(t, e) {
2460
- let [s, n] = [0, 0];
2461
- const { controlPositions: r, visuals: i } = this, { offsetHeight: a, offsetWidth: l } = i[0];
2462
- t > l ? s = l : t >= 0 && (s = t), e > a ? n = a : e >= 0 && (n = e);
2463
- const c = r.c2y / a, h = s / l, b = 1 - n / a, u = 1 - r.c3y / a, { r: d, g, b: p, a: f } = new y({
2462
+ let [s, r] = [0, 0];
2463
+ const { controlPositions: n, visuals: i } = this, { offsetHeight: a, offsetWidth: l } = i[0];
2464
+ t > l ? s = l : t >= 0 && (s = t), e > a ? r = a : e >= 0 && (r = e);
2465
+ const c = n.c2y / a, h = s / l, b = 1 - r / a, u = 1 - n.c3y / a, { r: d, g, b: p, a: f } = new y({
2464
2466
  h: c,
2465
2467
  s: h,
2466
2468
  v: b,
@@ -2471,7 +2473,7 @@ class ko {
2471
2473
  g,
2472
2474
  b: p,
2473
2475
  a: f
2474
- }), this.controlPositions.c1x = s, this.controlPositions.c1y = n, this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals();
2476
+ }), this.controlPositions.c1x = s, this.controlPositions.c1y = r, this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals();
2475
2477
  }
2476
2478
  /**
2477
2479
  * Updates `ColorPicker` second control:
@@ -2481,10 +2483,10 @@ class ko {
2481
2483
  * @param Y the Y offset
2482
2484
  */
2483
2485
  changeControl2(t) {
2484
- const { controlPositions: e, visuals: s } = this, { offsetHeight: n, offsetWidth: r } = s[0];
2486
+ const { controlPositions: e, visuals: s } = this, { offsetHeight: r, offsetWidth: n } = s[0];
2485
2487
  let i = 0;
2486
- t > n ? i = n : t >= 0 && (i = t);
2487
- const a = i / n, l = e.c1x / r, c = 1 - e.c1y / n, h = 1 - e.c3y / n, { r: b, g: u, b: d, a: g } = new y({
2488
+ t > r ? i = r : t >= 0 && (i = t);
2489
+ const a = i / r, l = e.c1x / n, c = 1 - e.c1y / r, h = 1 - e.c3y / r, { r: b, g: u, b: d, a: g } = new y({
2488
2490
  h: a,
2489
2491
  s: l,
2490
2492
  v: c,
@@ -2505,56 +2507,56 @@ class ko {
2505
2507
  */
2506
2508
  changeAlpha(t) {
2507
2509
  const { visuals: e } = this, { offsetHeight: s } = e[0];
2508
- let n = 0;
2509
- t > s ? n = s : t >= 0 && (n = t);
2510
- const r = 1 - n / s;
2511
- this.color.setAlpha(r), this.controlPositions.c3y = n, this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals();
2510
+ let r = 0;
2511
+ t > s ? r = s : t >= 0 && (r = t);
2512
+ const n = 1 - r / s;
2513
+ this.color.setAlpha(n), this.controlPositions.c3y = r, this.updateAppearance(), this.updateInputs(), this.updateControls(), this.updateVisuals();
2512
2514
  }
2513
2515
  /**
2514
2516
  * Updates `ColorPicker` control positions on:
2515
2517
  * * initialization
2516
2518
  * * window resize
2517
2519
  */
2518
- update() {
2520
+ update = () => {
2519
2521
  this.updateDropdownPosition(), this.updateAppearance(), this.setControlPositions(), this.updateInputs(!0), this.updateControls(), this.updateVisuals();
2520
- }
2522
+ };
2521
2523
  /** Updates the open dropdown position on *scroll* event. */
2522
2524
  updateDropdownPosition() {
2523
- const { input: t, colorPicker: e, colorMenu: s } = this, n = gt(t), { top: r, bottom: i } = n, { offsetHeight: a } = t, l = Ct(t).clientHeight, h = T(e, "show") ? e : s;
2525
+ const { input: t, colorPicker: e, colorMenu: s } = this, r = gt(t), { top: n, bottom: i } = r, { offsetHeight: a } = t, l = Lt(t).clientHeight, h = T(e, "show") ? e : s;
2524
2526
  if (!h)
2525
2527
  return;
2526
- const { offsetHeight: b } = h, u = l - i, d = r, g = r + b + a > l, p = r - b < 0;
2527
- (T(h, "bottom") || !p) && u < d && g ? (D(h, "bottom"), q(h, "top")) : (D(h, "top"), q(h, "bottom"));
2528
+ const { offsetHeight: b } = h, u = l - i, d = n, g = n + b + a > l, p = n - b < 0;
2529
+ (T(h, "bottom") || !p) && u < d && g ? (O(h, "bottom"), q(h, "top")) : (O(h, "top"), q(h, "bottom"));
2528
2530
  }
2529
2531
  /** Updates control knobs' positions. */
2530
2532
  setControlPositions() {
2531
- const { visuals: t, color: e, hsv: s } = this, { offsetHeight: n, offsetWidth: r } = t[0], i = e.a, a = s.h, l = s.s, c = s.v;
2532
- this.controlPositions.c1x = l * r, this.controlPositions.c1y = (1 - c) * n, this.controlPositions.c2y = a * n, this.controlPositions.c3y = (1 - i) * n;
2533
+ const { visuals: t, color: e, hsv: s } = this, { offsetHeight: r, offsetWidth: n } = t[0], i = e.a, a = s.h, l = s.s, c = s.v;
2534
+ this.controlPositions.c1x = l * n, this.controlPositions.c1y = (1 - c) * r, this.controlPositions.c2y = a * r, this.controlPositions.c3y = (1 - i) * r;
2533
2535
  }
2534
2536
  /** Update the visual appearance label and control knob labels. */
2535
2537
  updateAppearance() {
2536
- const { componentLabels: t, color: e, parent: s, hsv: n, hex: r, format: i, controlKnobs: a } = this, { appearanceLabel: l, hexLabel: c, valueLabel: h } = t;
2538
+ const { componentLabels: t, color: e, parent: s, hsv: r, hex: n, format: i, controlKnobs: a } = this, { appearanceLabel: l, hexLabel: c, valueLabel: h } = t;
2537
2539
  let { r: b, g: u, b: d } = e.toRgb();
2538
- const [g, p, f] = a, w = k(n.h * 360), $ = e.a, P = k(n.s * 100), L = k(n.v * 100), S = this.appearance;
2539
- let C = `${c} ${r.split("").join(" ")}`;
2540
+ const [g, p, f] = a, w = k(r.h * 360), $ = e.a, P = k(r.s * 100), L = k(r.v * 100), S = this.appearance;
2541
+ let C = `${c} ${n.split("").join(" ")}`;
2540
2542
  if (i === "hwb") {
2541
2543
  const { hwb: A } = this, F = k(A.w * 100), tt = k(A.b * 100);
2542
- C = `HWB: ${w}°, ${F}%, ${tt}%`, m(g, ot, `${F}% & ${tt}%`), m(g, et, `${F}`), m(p, Gt, `${h}: ${C}. ${l}: ${S}.`), m(p, ot, `${w}%`), m(p, et, `${w}`);
2544
+ C = `HWB: ${w}°, ${F}%, ${tt}%`, m(g, ot, `${F}% & ${tt}%`), m(g, et, `${F}`), m(p, Ut, `${h}: ${C}. ${l}: ${S}.`), m(p, ot, `${w}%`), m(p, et, `${w}`);
2543
2545
  } else
2544
- [b, u, d] = [b, u, d].map(k), C = i === "hsl" ? `HSL: ${w}°, ${P}%, ${L}%` : C, C = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : C, m(g, ot, `${L}% & ${P}%`), m(g, et, `${L}`), m(p, Gt, `${h}: ${C}. ${l}: ${S}.`), m(p, ot, `${w}°`), m(p, et, `${w}`);
2546
+ [b, u, d] = [b, u, d].map(k), C = i === "hsl" ? `HSL: ${w}°, ${P}%, ${L}%` : C, C = i === "rgb" ? `RGB: ${b}, ${u}, ${d}` : C, m(g, ot, `${L}% & ${P}%`), m(g, et, `${L}`), m(p, Ut, `${h}: ${C}. ${l}: ${S}.`), m(p, ot, `${w}°`), m(p, et, `${w}`);
2545
2547
  const M = k($ * 100);
2546
2548
  m(f, ot, `${M}%`), m(f, et, `${M}`);
2547
2549
  const E = e.toString();
2548
- O(this.input, { backgroundColor: E }), this.isDark ? (T(s, "txt-light") && D(s, "txt-light"), T(s, "txt-dark") || q(s, "txt-dark")) : (T(s, "txt-dark") && D(s, "txt-dark"), T(s, "txt-light") || q(s, "txt-light"));
2550
+ D(this.input, { backgroundColor: E }), this.isDark ? (T(s, "txt-light") && O(s, "txt-light"), T(s, "txt-dark") || q(s, "txt-dark")) : (T(s, "txt-dark") && O(s, "txt-dark"), T(s, "txt-light") || q(s, "txt-light"));
2549
2551
  }
2550
2552
  /** Updates the control knobs actual positions. */
2551
2553
  updateControls() {
2552
2554
  const { controlKnobs: t, controlPositions: e } = this;
2553
- let { c1x: s, c1y: n, c2y: r, c3y: i } = e;
2555
+ let { c1x: s, c1y: r, c2y: n, c3y: i } = e;
2554
2556
  const [a, l, c] = t;
2555
- [s, n, r, i] = [s, n, r, i].map(k), O(a, {
2556
- transform: `translate3d(${s - 4}px,${n - 4}px,0)`
2557
- }), O(l, { transform: `translate3d(0,${r - 4}px,0)` }), O(c, { transform: `translate3d(0,${i - 4}px,0)` });
2557
+ [s, r, n, i] = [s, r, n, i].map(k), D(a, {
2558
+ transform: `translate3d(${s - 4}px,${r - 4}px,0)`
2559
+ }), D(l, { transform: `translate3d(0,${n - 4}px,0)` }), D(c, { transform: `translate3d(0,${i - 4}px,0)` });
2558
2560
  }
2559
2561
  /**
2560
2562
  * Updates all color form inputs.
@@ -2562,8 +2564,8 @@ class ko {
2562
2564
  * @param isPrevented when `true`, the component original event is prevented
2563
2565
  */
2564
2566
  updateInputs(t) {
2565
- const { value: e, format: s, inputs: n, color: r, hsl: i } = this, [a, l, c, h] = n, b = k(r.a * 100), u = k(i.h * 360);
2566
- let d = r.toString();
2567
+ const { value: e, format: s, inputs: r, color: n, hsl: i } = this, [a, l, c, h] = r, b = k(n.a * 100), u = k(i.h * 360);
2568
+ let d = n.toString();
2567
2569
  if (s === "hex")
2568
2570
  d = this.color.toHexString(!0), a.value = this.hex;
2569
2571
  else if (s === "hsl") {
@@ -2576,34 +2578,34 @@ class ko {
2576
2578
  let { r: g, g: p, b: f } = this.rgb;
2577
2579
  [g, p, f] = [g, p, f].map(k), d = this.color.toRgbString(), a.value = `${g}`, l.value = `${p}`, c.value = `${f}`, h.value = `${b}`;
2578
2580
  }
2579
- this.value = d, !t && d !== e && ce(this);
2581
+ this.value = d, !t && d !== e && he(this);
2580
2582
  }
2581
2583
  /**
2582
2584
  * Toggle the `ColorPicker` dropdown visibility.
2583
2585
  *
2584
2586
  * @param e
2585
2587
  */
2586
- togglePicker(t) {
2588
+ togglePicker = (t) => {
2587
2589
  t && t.preventDefault();
2588
2590
  const { colorPicker: e } = this;
2589
2591
  this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
2590
- }
2592
+ };
2591
2593
  /** Shows the `ColorPicker` dropdown. */
2592
- showPicker() {
2594
+ showPicker = () => {
2593
2595
  const { colorPicker: t } = this;
2594
2596
  ["top", "bottom"].some((e) => T(t, e)) || Ht(this, t);
2595
- }
2597
+ };
2596
2598
  /**
2597
2599
  * Toggles the visibility of the `ColorPicker` presets menu.
2598
2600
  *
2599
2601
  * @param e
2600
2602
  * @this {ColorPicker}
2601
2603
  */
2602
- toggleMenu(t) {
2604
+ toggleMenu = (t) => {
2603
2605
  t && t.preventDefault();
2604
2606
  const { colorMenu: e } = this;
2605
2607
  this.isOpen && T(e, "show") ? this.hide(!0) : Ht(this, e);
2606
- }
2608
+ };
2607
2609
  /**
2608
2610
  * Hides the currently open `ColorPicker` dropdown.
2609
2611
  *
@@ -2611,18 +2613,18 @@ class ko {
2611
2613
  */
2612
2614
  hide(t) {
2613
2615
  if (this.isOpen) {
2614
- const { pickerToggle: e, menuToggle: s, colorPicker: n, colorMenu: r, parent: i, input: a } = this, l = T(n, "show"), c = l ? n : r, h = l ? e : s, b = c && oo(c);
2615
- this.value = this.color.toString(!0), c && (D(c, "show"), m(h, Nt, "false"), setTimeout(() => {
2616
- Ee(c), _(".show", i) || (D(i, "open"), Ne(this), this.isOpen = !1);
2616
+ const { pickerToggle: e, menuToggle: s, colorPicker: r, colorMenu: n, parent: i, input: a } = this, l = T(r, "show"), c = l ? r : n, h = l ? e : s, b = c && oo(c);
2617
+ this.value = this.color.toString(!0), c && (O(c, "show"), m(h, Et, "false"), setTimeout(() => {
2618
+ Ee(c), _(".show", i) || (O(i, "open"), He(this), this.isOpen = !1);
2617
2619
  }, b)), t || U(e), m(a, Y, "-1"), h === s && m(s, Y, "-1");
2618
2620
  }
2619
2621
  }
2620
2622
  /** Removes `ColorPicker` from target `<input>`. */
2621
2623
  dispose() {
2622
2624
  const { input: t, parent: e } = this;
2623
- this.hide(!0), le(this), [...e.children].forEach((s) => {
2625
+ this.hide(!0), ce(this), [...e.children].forEach((s) => {
2624
2626
  s !== t && s.remove();
2625
- }), St(t, Y), O(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => D(e, s)), ct.remove(t, Z);
2627
+ }), Ct(t, Y), D(t, { backgroundColor: "" }), ["txt-light", "txt-dark"].forEach((s) => O(e, s)), ct.remove(t, Z);
2626
2628
  }
2627
2629
  }
2628
2630
  export {