/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/@simonwep/pickr/dist/pickr.min.js var require_pickr_min = __commonJS({ "node_modules/@simonwep/pickr/dist/pickr.min.js"(exports, module2) { !function(t, e) { "object" == typeof exports && "object" == typeof module2 ? module2.exports = e() : "function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? exports.Pickr = e() : t.Pickr = e(); }(self, function() { return (() => { "use strict"; var t = { d: (e2, o2) => { for (var n2 in o2) t.o(o2, n2) && !t.o(e2, n2) && Object.defineProperty(e2, n2, { enumerable: true, get: o2[n2] }); }, o: (t2, e2) => Object.prototype.hasOwnProperty.call(t2, e2), r: (t2) => { "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(t2, "__esModule", { value: true }); } }, e = {}; t.d(e, { default: () => L }); var o = {}; function n(t2, e2, o2, n2, i2 = {}) { e2 instanceof HTMLCollection || e2 instanceof NodeList ? e2 = Array.from(e2) : Array.isArray(e2) || (e2 = [e2]), Array.isArray(o2) || (o2 = [o2]); for (const s2 of e2) for (const e3 of o2) s2[t2](e3, n2, { capture: false, ...i2 }); return Array.prototype.slice.call(arguments, 1); } t.r(o), t.d(o, { adjustableInputNumbers: () => p, createElementFromString: () => r, createFromTemplate: () => a, eventPath: () => l, off: () => s, on: () => i, resolveElement: () => c }); const i = n.bind(null, "addEventListener"), s = n.bind(null, "removeEventListener"); function r(t2) { const e2 = document.createElement("div"); return e2.innerHTML = t2.trim(), e2.firstElementChild; } function a(t2) { const e2 = (t3, e3) => { const o3 = t3.getAttribute(e3); return t3.removeAttribute(e3), o3; }, o2 = (t3, n2 = {}) => { const i2 = e2(t3, ":obj"), s2 = e2(t3, ":ref"), r2 = i2 ? n2[i2] = {} : n2; s2 && (n2[s2] = t3); for (const n3 of Array.from(t3.children)) { const t4 = e2(n3, ":arr"), i3 = o2(n3, t4 ? {} : r2); t4 && (r2[t4] || (r2[t4] = [])).push(Object.keys(i3).length ? i3 : n3); } return n2; }; return o2(r(t2)); } function l(t2) { let e2 = t2.path || t2.composedPath && t2.composedPath(); if (e2) return e2; let o2 = t2.target.parentElement; for (e2 = [t2.target, o2]; o2 = o2.parentElement; ) e2.push(o2); return e2.push(document, window), e2; } function c(t2) { return t2 instanceof Element ? t2 : "string" == typeof t2 ? t2.split(/>>/g).reduce((t3, e2, o2, n2) => (t3 = t3.querySelector(e2), o2 < n2.length - 1 ? t3.shadowRoot : t3), document) : null; } function p(t2, e2 = (t3) => t3) { function o2(o3) { const n2 = [1e-3, 0.01, 0.1][Number(o3.shiftKey || 2 * o3.ctrlKey)] * (o3.deltaY < 0 ? 1 : -1); let i2 = 0, s2 = t2.selectionStart; t2.value = t2.value.replace(/[\d.]+/g, (t3, o4) => o4 <= s2 && o4 + t3.length >= s2 ? (s2 = o4, e2(Number(t3), n2, i2)) : (i2++, t3)), t2.focus(), t2.setSelectionRange(s2, s2), o3.preventDefault(), t2.dispatchEvent(new Event("input")); } i(t2, "focus", () => i(window, "wheel", o2, { passive: false })), i(t2, "blur", () => s(window, "wheel", o2)); } const { min: u, max: h, floor: d, round: m } = Math; function f(t2, e2, o2) { e2 /= 100, o2 /= 100; const n2 = d(t2 = t2 / 360 * 6), i2 = t2 - n2, s2 = o2 * (1 - e2), r2 = o2 * (1 - i2 * e2), a2 = o2 * (1 - (1 - i2) * e2), l2 = n2 % 6; return [255 * [o2, r2, s2, s2, a2, o2][l2], 255 * [a2, o2, o2, r2, s2, s2][l2], 255 * [s2, s2, a2, o2, o2, r2][l2]]; } function v(t2, e2, o2) { const n2 = (2 - (e2 /= 100)) * (o2 /= 100) / 2; return 0 !== n2 && (e2 = 1 === n2 ? 0 : n2 < 0.5 ? e2 * o2 / (2 * n2) : e2 * o2 / (2 - 2 * n2)), [t2, 100 * e2, 100 * n2]; } function b(t2, e2, o2) { const n2 = u(t2 /= 255, e2 /= 255, o2 /= 255), i2 = h(t2, e2, o2), s2 = i2 - n2; let r2, a2; if (0 === s2) r2 = a2 = 0; else { a2 = s2 / i2; const n3 = ((i2 - t2) / 6 + s2 / 2) / s2, l2 = ((i2 - e2) / 6 + s2 / 2) / s2, c2 = ((i2 - o2) / 6 + s2 / 2) / s2; t2 === i2 ? r2 = c2 - l2 : e2 === i2 ? r2 = 1 / 3 + n3 - c2 : o2 === i2 && (r2 = 2 / 3 + l2 - n3), r2 < 0 ? r2 += 1 : r2 > 1 && (r2 -= 1); } return [360 * r2, 100 * a2, 100 * i2]; } function y(t2, e2, o2, n2) { e2 /= 100, o2 /= 100; return [...b(255 * (1 - u(1, (t2 /= 100) * (1 - (n2 /= 100)) + n2)), 255 * (1 - u(1, e2 * (1 - n2) + n2)), 255 * (1 - u(1, o2 * (1 - n2) + n2)))]; } function g(t2, e2, o2) { e2 /= 100; const n2 = 2 * (e2 *= (o2 /= 100) < 0.5 ? o2 : 1 - o2) / (o2 + e2) * 100, i2 = 100 * (o2 + e2); return [t2, isNaN(n2) ? 0 : n2, i2]; } function _(t2) { return b(...t2.match(/.{2}/g).map((t3) => parseInt(t3, 16))); } function w(t2) { t2 = t2.match(/^[a-zA-Z]+$/) ? function(t3) { if ("black" === t3.toLowerCase()) return "#000"; const e3 = document.createElement("canvas").getContext("2d"); return e3.fillStyle = t3, "#000" === e3.fillStyle ? null : e3.fillStyle; }(t2) : t2; const e2 = { cmyk: /^cmyk[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)/i, rgba: /^((rgba)|rgb)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i, hsla: /^((hsla)|hsl)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i, hsva: /^((hsva)|hsv)[\D]+([\d.]+)[\D]+([\d.]+)[\D]+([\d.]+)[\D]*?([\d.]+|$)/i, hexa: /^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i }, o2 = (t3) => t3.map((t4) => /^(|\d+)\.\d+|\d+$/.test(t4) ? Number(t4) : void 0); let n2; t: for (const i2 in e2) { if (!(n2 = e2[i2].exec(t2))) continue; const s2 = (t3) => !!n2[2] == ("number" == typeof t3); switch (i2) { case "cmyk": { const [, t3, e3, s3, r2] = o2(n2); if (t3 > 100 || e3 > 100 || s3 > 100 || r2 > 100) break t; return { values: y(t3, e3, s3, r2), type: i2 }; } case "rgba": { const [, , , t3, e3, r2, a2] = o2(n2); if (t3 > 255 || e3 > 255 || r2 > 255 || a2 < 0 || a2 > 1 || !s2(a2)) break t; return { values: [...b(t3, e3, r2), a2], a: a2, type: i2 }; } case "hexa": { let [, t3] = n2; 4 !== t3.length && 3 !== t3.length || (t3 = t3.split("").map((t4) => t4 + t4).join("")); const e3 = t3.substring(0, 6); let o3 = t3.substring(6); return o3 = o3 ? parseInt(o3, 16) / 255 : void 0, { values: [..._(e3), o3], a: o3, type: i2 }; } case "hsla": { const [, , , t3, e3, r2, a2] = o2(n2); if (t3 > 360 || e3 > 100 || r2 > 100 || a2 < 0 || a2 > 1 || !s2(a2)) break t; return { values: [...g(t3, e3, r2), a2], a: a2, type: i2 }; } case "hsva": { const [, , , t3, e3, r2, a2] = o2(n2); if (t3 > 360 || e3 > 100 || r2 > 100 || a2 < 0 || a2 > 1 || !s2(a2)) break t; return { values: [t3, e3, r2, a2], a: a2, type: i2 }; } } } return { values: null, type: null }; } function A(t2 = 0, e2 = 0, o2 = 0, n2 = 1) { const i2 = (t3, e3) => (o3 = -1) => e3(~o3 ? t3.map((t4) => Number(t4.toFixed(o3))) : t3), s2 = { h: t2, s: e2, v: o2, a: n2, toHSVA() { const t3 = [s2.h, s2.s, s2.v, s2.a]; return t3.toString = i2(t3, (t4) => `hsva(${t4[0]}, ${t4[1]}%, ${t4[2]}%, ${s2.a})`), t3; }, toHSLA() { const t3 = [...v(s2.h, s2.s, s2.v), s2.a]; return t3.toString = i2(t3, (t4) => `hsla(${t4[0]}, ${t4[1]}%, ${t4[2]}%, ${s2.a})`), t3; }, toRGBA() { const t3 = [...f(s2.h, s2.s, s2.v), s2.a]; return t3.toString = i2(t3, (t4) => `rgba(${t4[0]}, ${t4[1]}, ${t4[2]}, ${s2.a})`), t3; }, toCMYK() { const t3 = function(t4, e3, o3) { const n3 = f(t4, e3, o3), i3 = n3[0] / 255, s3 = n3[1] / 255, r2 = n3[2] / 255, a2 = u(1 - i3, 1 - s3, 1 - r2); return [100 * (1 === a2 ? 0 : (1 - i3 - a2) / (1 - a2)), 100 * (1 === a2 ? 0 : (1 - s3 - a2) / (1 - a2)), 100 * (1 === a2 ? 0 : (1 - r2 - a2) / (1 - a2)), 100 * a2]; }(s2.h, s2.s, s2.v); return t3.toString = i2(t3, (t4) => `cmyk(${t4[0]}%, ${t4[1]}%, ${t4[2]}%, ${t4[3]}%)`), t3; }, toHEXA() { const t3 = function(t4, e4, o3) { return f(t4, e4, o3).map((t5) => m(t5).toString(16).padStart(2, "0")); }(s2.h, s2.s, s2.v), e3 = s2.a >= 1 ? "" : Number((255 * s2.a).toFixed(0)).toString(16).toUpperCase().padStart(2, "0"); return e3 && t3.push(e3), t3.toString = () => `#${t3.join("").toUpperCase()}`, t3; }, clone: () => A(s2.h, s2.s, s2.v, s2.a) }; return s2; } const C = (t2) => Math.max(Math.min(t2, 1), 0); function $(t2) { const e2 = { options: Object.assign({ lock: null, onchange: () => 0, onstop: () => 0 }, t2), _keyboard(t3) { const { options: o3 } = e2, { type: n3, key: i2 } = t3; if (document.activeElement === o3.wrapper) { const { lock: o4 } = e2.options, s2 = "ArrowUp" === i2, r3 = "ArrowRight" === i2, a2 = "ArrowDown" === i2, l2 = "ArrowLeft" === i2; if ("keydown" === n3 && (s2 || r3 || a2 || l2)) { let n4 = 0, i3 = 0; "v" === o4 ? n4 = s2 || r3 ? 1 : -1 : "h" === o4 ? n4 = s2 || r3 ? -1 : 1 : (i3 = s2 ? -1 : a2 ? 1 : 0, n4 = l2 ? -1 : r3 ? 1 : 0), e2.update(C(e2.cache.x + 0.01 * n4), C(e2.cache.y + 0.01 * i3)), t3.preventDefault(); } else i2.startsWith("Arrow") && (e2.options.onstop(), t3.preventDefault()); } }, _tapstart(t3) { i(document, ["mouseup", "touchend", "touchcancel"], e2._tapstop), i(document, ["mousemove", "touchmove"], e2._tapmove), t3.cancelable && t3.preventDefault(), e2._tapmove(t3); }, _tapmove(t3) { const { options: o3, cache: n3 } = e2, { lock: i2, element: s2, wrapper: r3 } = o3, a2 = r3.getBoundingClientRect(); let l2 = 0, c2 = 0; if (t3) { const e3 = t3 && t3.touches && t3.touches[0]; l2 = t3 ? (e3 || t3).clientX : 0, c2 = t3 ? (e3 || t3).clientY : 0, l2 < a2.left ? l2 = a2.left : l2 > a2.left + a2.width && (l2 = a2.left + a2.width), c2 < a2.top ? c2 = a2.top : c2 > a2.top + a2.height && (c2 = a2.top + a2.height), l2 -= a2.left, c2 -= a2.top; } else n3 && (l2 = n3.x * a2.width, c2 = n3.y * a2.height); "h" !== i2 && (s2.style.left = `calc(${l2 / a2.width * 100}% - ${s2.offsetWidth / 2}px)`), "v" !== i2 && (s2.style.top = `calc(${c2 / a2.height * 100}% - ${s2.offsetHeight / 2}px)`), e2.cache = { x: l2 / a2.width, y: c2 / a2.height }; const p2 = C(l2 / a2.width), u2 = C(c2 / a2.height); switch (i2) { case "v": return o3.onchange(p2); case "h": return o3.onchange(u2); default: return o3.onchange(p2, u2); } }, _tapstop() { e2.options.onstop(), s(document, ["mouseup", "touchend", "touchcancel"], e2._tapstop), s(document, ["mousemove", "touchmove"], e2._tapmove); }, trigger() { e2._tapmove(); }, update(t3 = 0, o3 = 0) { const { left: n3, top: i2, width: s2, height: r3 } = e2.options.wrapper.getBoundingClientRect(); "h" === e2.options.lock && (o3 = t3), e2._tapmove({ clientX: n3 + s2 * t3, clientY: i2 + r3 * o3 }); }, destroy() { const { options: t3, _tapstart: o3, _keyboard: n3 } = e2; s(document, ["keydown", "keyup"], n3), s([t3.wrapper, t3.element], "mousedown", o3), s([t3.wrapper, t3.element], "touchstart", o3, { passive: false }); } }, { options: o2, _tapstart: n2, _keyboard: r2 } = e2; return i([o2.wrapper, o2.element], "mousedown", n2), i([o2.wrapper, o2.element], "touchstart", n2, { passive: false }), i(document, ["keydown", "keyup"], r2), e2; } function k(t2 = {}) { t2 = Object.assign({ onchange: () => 0, className: "", elements: [] }, t2); const e2 = i(t2.elements, "click", (e3) => { t2.elements.forEach((o2) => o2.classList[e3.target === o2 ? "add" : "remove"](t2.className)), t2.onchange(e3), e3.stopPropagation(); }); return { destroy: () => s(...e2) }; } const S = { variantFlipOrder: { start: "sme", middle: "mse", end: "ems" }, positionFlipOrder: { top: "tbrl", right: "rltb", bottom: "btrl", left: "lrbt" }, position: "bottom", margin: 8 }, O = (t2, e2, o2) => { const { container: n2, margin: i2, position: s2, variantFlipOrder: r2, positionFlipOrder: a2 } = { container: document.documentElement.getBoundingClientRect(), ...S, ...o2 }, { left: l2, top: c2 } = e2.style; e2.style.left = "0", e2.style.top = "0"; const p2 = t2.getBoundingClientRect(), u2 = e2.getBoundingClientRect(), h2 = { t: p2.top - u2.height - i2, b: p2.bottom + i2, r: p2.right + i2, l: p2.left - u2.width - i2 }, d2 = { vs: p2.left, vm: p2.left + p2.width / 2 + -u2.width / 2, ve: p2.left + p2.width - u2.width, hs: p2.top, hm: p2.bottom - p2.height / 2 - u2.height / 2, he: p2.bottom - u2.height }, [m2, f2 = "middle"] = s2.split("-"), v2 = a2[m2], b2 = r2[f2], { top: y2, left: g2, bottom: _2, right: w2 } = n2; for (const t3 of v2) { const o3 = "t" === t3 || "b" === t3, n3 = h2[t3], [i3, s3] = o3 ? ["top", "left"] : ["left", "top"], [r3, a3] = o3 ? [u2.height, u2.width] : [u2.width, u2.height], [l3, c3] = o3 ? [_2, w2] : [w2, _2], [p3, m3] = o3 ? [y2, g2] : [g2, y2]; if (!(n3 < p3 || n3 + r3 > l3)) for (const r4 of b2) { const l4 = d2[(o3 ? "v" : "h") + r4]; if (!(l4 < m3 || l4 + a3 > c3)) return e2.style[s3] = l4 - u2[s3] + "px", e2.style[i3] = n3 - u2[i3] + "px", t3 + r4; } } return e2.style.left = l2, e2.style.top = c2, null; }; function E(t2, e2, o2) { return e2 in t2 ? Object.defineProperty(t2, e2, { value: o2, enumerable: true, configurable: true, writable: true }) : t2[e2] = o2, t2; } class L { constructor(t2) { E(this, "_initializingActive", true), E(this, "_recalc", true), E(this, "_nanopop", null), E(this, "_root", null), E(this, "_color", A()), E(this, "_lastColor", A()), E(this, "_swatchColors", []), E(this, "_setupAnimationFrame", null), E(this, "_eventListener", { init: [], save: [], hide: [], show: [], clear: [], change: [], changestop: [], cancel: [], swatchselect: [] }), this.options = t2 = Object.assign({ ...L.DEFAULT_OPTIONS }, t2); const { swatches: e2, components: o2, theme: n2, sliders: i2, lockOpacity: s2, padding: r2 } = t2; ["nano", "monolith"].includes(n2) && !i2 && (t2.sliders = "h"), o2.interaction || (o2.interaction = {}); const { preview: a2, opacity: l2, hue: c2, palette: p2 } = o2; o2.opacity = !s2 && l2, o2.palette = p2 || a2 || l2 || c2, this._preBuild(), this._buildComponents(), this._bindEvents(), this._finalBuild(), e2 && e2.length && e2.forEach((t3) => this.addSwatch(t3)); const { button: u2, app: h2 } = this._root; this._nanopop = ((t3, e3, o3) => { const n3 = "object" != typeof t3 || t3 instanceof HTMLElement ? { reference: t3, popper: e3, ...o3 } : t3; return { update(t4 = n3) { const { reference: e4, popper: o4 } = Object.assign(n3, t4); if (!o4 || !e4) throw new Error("Popper- or reference-element missing."); return O(e4, o4, n3); } }; })(u2, h2, { margin: r2 }), u2.setAttribute("role", "button"), u2.setAttribute("aria-label", this._t("btn:toggle")); const d2 = this; this._setupAnimationFrame = requestAnimationFrame(function e3() { if (!h2.offsetWidth) return requestAnimationFrame(e3); d2.setColor(t2.default), d2._rePositioningPicker(), t2.defaultRepresentation && (d2._representation = t2.defaultRepresentation, d2.setColorRepresentation(d2._representation)), t2.showAlways && d2.show(), d2._initializingActive = false, d2._emit("init"); }); } _preBuild() { const { options: t2 } = this; for (const e2 of ["el", "container"]) t2[e2] = c(t2[e2]); this._root = ((t3) => { const { components: e2, useAsButton: o2, inline: n2, appClass: i2, theme: s2, lockOpacity: r2 } = t3.options, l2 = (t4) => t4 ? "" : 'style="display:none" hidden', c2 = (e3) => t3._t(e3), p2 = a(`
${o2 ? "" : ''}
`), u2 = p2.interaction; return u2.options.find((t4) => !t4.hidden && !t4.classList.add("active")), u2.type = () => u2.options.find((t4) => t4.classList.contains("active")), p2; })(this), t2.useAsButton && (this._root.button = t2.el), t2.container.appendChild(this._root.root); } _finalBuild() { const t2 = this.options, e2 = this._root; if (t2.container.removeChild(e2.root), t2.inline) { const o2 = t2.el.parentElement; t2.el.nextSibling ? o2.insertBefore(e2.app, t2.el.nextSibling) : o2.appendChild(e2.app); } else t2.container.appendChild(e2.app); t2.useAsButton ? t2.inline && t2.el.remove() : t2.el.parentNode.replaceChild(e2.root, t2.el), t2.disabled && this.disable(), t2.comparison || (e2.button.style.transition = "none", t2.useAsButton || (e2.preview.lastColor.style.transition = "none")), this.hide(); } _buildComponents() { const t2 = this, e2 = this.options.components, o2 = (t2.options.sliders || "v").repeat(2), [n2, i2] = o2.match(/^[vh]+$/g) ? o2 : [], s2 = () => this._color || (this._color = this._lastColor.clone()), r2 = { palette: $({ element: t2._root.palette.picker, wrapper: t2._root.palette.palette, onstop: () => t2._emit("changestop", "slider", t2), onchange(o3, n3) { if (!e2.palette) return; const i3 = s2(), { _root: r3, options: a2 } = t2, { lastColor: l2, currentColor: c2 } = r3.preview; t2._recalc && (i3.s = 100 * o3, i3.v = 100 - 100 * n3, i3.v < 0 && (i3.v = 0), t2._updateOutput("slider")); const p2 = i3.toRGBA().toString(0); this.element.style.background = p2, this.wrapper.style.background = ` linear-gradient(to top, rgba(0, 0, 0, ${i3.a}), transparent), linear-gradient(to left, hsla(${i3.h}, 100%, 50%, ${i3.a}), rgba(255, 255, 255, ${i3.a})) `, a2.comparison ? a2.useAsButton || t2._lastColor || l2.style.setProperty("--pcr-color", p2) : (r3.button.style.setProperty("--pcr-color", p2), r3.button.classList.remove("clear")); const u2 = i3.toHEXA().toString(); for (const { el: e3, color: o4 } of t2._swatchColors) e3.classList[u2 === o4.toHEXA().toString() ? "add" : "remove"]("pcr-active"); c2.style.setProperty("--pcr-color", p2); } }), hue: $({ lock: "v" === i2 ? "h" : "v", element: t2._root.hue.picker, wrapper: t2._root.hue.slider, onstop: () => t2._emit("changestop", "slider", t2), onchange(o3) { if (!e2.hue || !e2.palette) return; const n3 = s2(); t2._recalc && (n3.h = 360 * o3), this.element.style.backgroundColor = `hsl(${n3.h}, 100%, 50%)`, r2.palette.trigger(); } }), opacity: $({ lock: "v" === n2 ? "h" : "v", element: t2._root.opacity.picker, wrapper: t2._root.opacity.slider, onstop: () => t2._emit("changestop", "slider", t2), onchange(o3) { if (!e2.opacity || !e2.palette) return; const n3 = s2(); t2._recalc && (n3.a = Math.round(100 * o3) / 100), this.element.style.background = `rgba(0, 0, 0, ${n3.a})`, r2.palette.trigger(); } }), selectable: k({ elements: t2._root.interaction.options, className: "active", onchange(e3) { t2._representation = e3.target.getAttribute("data-type").toUpperCase(), t2._recalc && t2._updateOutput("swatch"); } }) }; this._components = r2; } _bindEvents() { const { _root: t2, options: e2 } = this, o2 = [i(t2.interaction.clear, "click", () => this._clearColor()), i([t2.interaction.cancel, t2.preview.lastColor], "click", () => { this.setHSVA(...(this._lastColor || this._color).toHSVA(), true), this._emit("cancel"); }), i(t2.interaction.save, "click", () => { !this.applyColor() && !e2.showAlways && this.hide(); }), i(t2.interaction.result, ["keyup", "input"], (t3) => { this.setColor(t3.target.value, true) && !this._initializingActive && (this._emit("change", this._color, "input", this), this._emit("changestop", "input", this)), t3.stopImmediatePropagation(); }), i(t2.interaction.result, ["focus", "blur"], (t3) => { this._recalc = "blur" === t3.type, this._recalc && this._updateOutput(null); }), i([t2.palette.palette, t2.palette.picker, t2.hue.slider, t2.hue.picker, t2.opacity.slider, t2.opacity.picker], ["mousedown", "touchstart"], () => this._recalc = true, { passive: true })]; if (!e2.showAlways) { const n2 = e2.closeWithKey; o2.push(i(t2.button, "click", () => this.isOpen() ? this.hide() : this.show()), i(document, "keyup", (t3) => this.isOpen() && (t3.key === n2 || t3.code === n2) && this.hide()), i(document, ["touchstart", "mousedown"], (e3) => { this.isOpen() && !l(e3).some((e4) => e4 === t2.app || e4 === t2.button) && this.hide(); }, { capture: true })); } if (e2.adjustableNumbers) { const e3 = { rgba: [255, 255, 255, 1], hsva: [360, 100, 100, 1], hsla: [360, 100, 100, 1], cmyk: [100, 100, 100, 100] }; p(t2.interaction.result, (t3, o3, n2) => { const i2 = e3[this.getColorRepresentation().toLowerCase()]; if (i2) { const e4 = i2[n2], s2 = t3 + (e4 >= 100 ? 1e3 * o3 : o3); return s2 <= 0 ? 0 : Number((s2 < e4 ? s2 : e4).toPrecision(3)); } return t3; }); } if (e2.autoReposition && !e2.inline) { let t3 = null; const n2 = this; o2.push(i(window, ["scroll", "resize"], () => { n2.isOpen() && (e2.closeOnScroll && n2.hide(), null === t3 ? (t3 = setTimeout(() => t3 = null, 100), requestAnimationFrame(function e3() { n2._rePositioningPicker(), null !== t3 && requestAnimationFrame(e3); })) : (clearTimeout(t3), t3 = setTimeout(() => t3 = null, 100))); }, { capture: true })); } this._eventBindings = o2; } _rePositioningPicker() { const { options: t2 } = this; if (!t2.inline) { if (!this._nanopop.update({ container: document.body.getBoundingClientRect(), position: t2.position })) { const t3 = this._root.app, e2 = t3.getBoundingClientRect(); t3.style.top = (window.innerHeight - e2.height) / 2 + "px", t3.style.left = (window.innerWidth - e2.width) / 2 + "px"; } } } _updateOutput(t2) { const { _root: e2, _color: o2, options: n2 } = this; if (e2.interaction.type()) { const t3 = `to${e2.interaction.type().getAttribute("data-type")}`; e2.interaction.result.value = "function" == typeof o2[t3] ? o2[t3]().toString(n2.outputPrecision) : ""; } !this._initializingActive && this._recalc && this._emit("change", o2, t2, this); } _clearColor(t2 = false) { const { _root: e2, options: o2 } = this; o2.useAsButton || e2.button.style.setProperty("--pcr-color", "rgba(0, 0, 0, 0.15)"), e2.button.classList.add("clear"), o2.showAlways || this.hide(), this._lastColor = null, this._initializingActive || t2 || (this._emit("save", null), this._emit("clear")); } _parseLocalColor(t2) { const { values: e2, type: o2, a: n2 } = w(t2), { lockOpacity: i2 } = this.options, s2 = void 0 !== n2 && 1 !== n2; return e2 && 3 === e2.length && (e2[3] = void 0), { values: !e2 || i2 && s2 ? null : e2, type: o2 }; } _t(t2) { return this.options.i18n[t2] || L.I18N_DEFAULTS[t2]; } _emit(t2, ...e2) { this._eventListener[t2].forEach((t3) => t3(...e2, this)); } on(t2, e2) { return this._eventListener[t2].push(e2), this; } off(t2, e2) { const o2 = this._eventListener[t2] || [], n2 = o2.indexOf(e2); return ~n2 && o2.splice(n2, 1), this; } addSwatch(t2) { const { values: e2 } = this._parseLocalColor(t2); if (e2) { const { _swatchColors: t3, _root: o2 } = this, n2 = A(...e2), s2 = r(`