{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/js/utils/utils.js","webpack:///./src/js/utils/color.js","webpack:///./src/js/utils/hsvacolor.js","webpack:///./src/js/libs/moveable.js","webpack:///./src/js/libs/selectable.js","webpack:///./src/js/template.js","webpack:///../src/NanoPop.ts","webpack:///./src/js/pickr.js"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","eventListener","method","elements","events","fn","options","HTMLCollection","NodeList","Array","from","isArray","el","ev","capture","slice","arguments","on","bind","off","createElementFromString","html","div","document","createElement","innerHTML","trim","firstElementChild","createFromTemplate","str","removeAttribute","name","getAttribute","resolve","element","base","con","subtree","child","children","arr","sub","push","keys","length","eventPath","evt","path","composedPath","target","parentElement","window","resolveElement","val","Element","split","reduce","pv","cv","ci","a","querySelector","shadowRoot","adjustableInputNumbers","mapper","v","handleScroll","e","inc","Number","shiftKey","ctrlKey","deltaY","index","selectionStart","replace","i","focus","setSelectionRange","preventDefault","dispatchEvent","Event","passive","min","max","floor","round","Math","hsvToRgb","h","s","f","p","q","t","mod","hsvToHsl","l","rgbToHsv","r","g","b","minVal","maxVal","delta","dr","dg","db","cmykToHsv","c","m","y","k","hslToHsv","ns","isNaN","hexToHsv","hex","match","map","parseInt","parseToHSVA","toLowerCase","ctx","getContext","fillStyle","standardizeColor","regex","cmyk","rgba","hsla","hsva","hexa","numarize","array","test","undefined","invalid","type","exec","alphaValid","values","join","raw","substring","HSVaColor","original","next","precision","toFixed","that","toHSVA","toString","toHSLA","toRGBA","toCMYK","rgb","hsvToCmyk","toHEXA","padStart","hsvToHex","alpha","toUpperCase","clone","clamp","Moveable","opt","assign","lock","onchange","onstop","_keyboard","activeElement","wrapper","up","right","down","left","xm","ym","update","cache","x","startsWith","_tapstart","_","_tapstop","_tapmove","cancelable","getBoundingClientRect","touch","touches","clientX","clientY","width","top","height","style","offsetWidth","offsetHeight","cx","cy","trigger","destroy","Selectable","className","onTap","forEach","classList","stopPropagation","defaults","variantFlipOrder","start","middle","end","positionFlipOrder","bottom","position","margin","reposition","reference","popper","container","documentElement","originalLeft","originalTop","refBox","popBox","positionStore","variantStore","vs","vm","ve","hs","hm","he","posKey","varKey","positions","variants","vertical","positionVal","positionKey","variantKey","positionSize","variantSize","positionMaximum","variantMaximum","positionMinimum","variantMinimum","variantVal","Pickr","constructor","init","save","hide","show","clear","change","changestop","cancel","swatchselect","this","DEFAULT_OPTIONS","swatches","components","theme","sliders","lockOpacity","padding","includes","interaction","preview","opacity","hue","palette","_preBuild","_buildComponents","_bindEvents","_finalBuild","color","addSwatch","button","app","_root","_nanopop","baseOptions","HTMLElement","[object Object]","Error","createPopper","setAttribute","_t","_setupAnimationFrame","requestAnimationFrame","cb","setColor","default","_rePositioningPicker","defaultRepresentation","_representation","setColorRepresentation","showAlways","_initializingActive","_emit","instance","useAsButton","inline","appClass","hidden","input","int","find","add","contains","buildPickr","appendChild","removeChild","parent","nextSibling","insertBefore","remove","parentNode","replaceChild","disabled","disable","comparison","transition","lastColor","inst","cs","repeat","so","sh","getColor","_color","_lastColor","picker","currentColor","_recalc","_updateOutput","cssRGBaString","background","setProperty","_swatchColors","slider","backgroundColor","selectable","_components","eventBindings","_clearColor","setHSVA","applyColor","result","stopImmediatePropagation","ck","closeWithKey","isOpen","code","some","adjustableNumbers","ranges","step","range","getColorRepresentation","nv","toPrecision","autoReposition","timeout","closeOnScroll","setTimeout","rs","clearTimeout","_eventBindings","body","eb","innerHeight","innerWidth","eventSource","outputPrecision","silent","_parseLocalColor","alphaMakesAChange","i18n","I18N_DEFAULTS","event","args","_eventListener","callBacks","indexOf","splice","removeSwatch","swatchColor","cancelAnimationFrame","destroyAndRemove","recalc","string","utype","click","getSelectedColor","getRoot","enable","VERSION"],"mappings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zBnD,KAMX2I,SAGI,OAFA3I,KAAKhQ,QAAQ8T,UAAW,EACxB9D,KAAKsB,MAAMF,OAAO1E,UAAUiH,OAAO,YAC5B3D,M,SA74BMX,E,QAGFlE,G,EAHEkE,E,UAMAuJ,S,EANAvJ,E,gBASM,CAGnB,YAAa,sBACb,aAAc,6BACd,aAAc,eACd,iBAAkB,qBAClB,WAAY,OACZ,aAAc,SACd,YAAa,QAGb,gBAAiB,iBACjB,kBAAmB,mBACnB,iBAAkB,kBAClB,aAAc,oBACd,eAAgB,uBAChB,WAAY,uBACZ,eAAgB,qB,EA3BHA,E,kBA+BQ,CACrByD,SAAU,KACV1C,MAAO,UACPwC,aAAa,EACbrC,QAAS,EACTuD,UAAU,EACVE,YAAY,EACZ2C,eAAe,EACfU,gBAAiB,EACjB/G,aAAa,EACbmG,gBAAgB,EAChBjJ,UAAW,OAEX2C,WAAY,CACRM,YAAa,IAGjBgH,KAAM,GACNvH,SAAU,KACV2C,QAAQ,EACRxC,QAAS,KAET8B,QAAS,UACTE,sBAAuB,KACvBlF,SAAU,gBACV+I,mBAAmB,EACnB1D,YAAY,EAEZsD,aAAc,W,EA3DDzG,E,UAuKDrP,GAAW,IAAIqP,EAAMrP,K","file":"pickr.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Pickr\"] = factory();\n\telse\n\t\troot[\"Pickr\"] = factory();\n})(self, function() {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* eslint-disable prefer-rest-params */\r\nfunction eventListener(method, elements, events, fn, options = {}) {\r\n\r\n // Normalize array\r\n if (elements instanceof HTMLCollection || elements instanceof NodeList) {\r\n elements = Array.from(elements);\r\n } else if (!Array.isArray(elements)) {\r\n elements = [elements];\r\n }\r\n\r\n if (!Array.isArray(events)) {\r\n events = [events];\r\n }\r\n\r\n for (const el of elements) {\r\n for (const ev of events) {\r\n el[method](ev, fn, {capture: false, ...options});\r\n }\r\n }\r\n\r\n return Array.prototype.slice.call(arguments, 1);\r\n}\r\n\r\n/**\r\n * Add event(s) to element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const on = eventListener.bind(null, 'addEventListener');\r\n\r\n/**\r\n * Remove event(s) from element(s).\r\n * @param elements DOM-Elements\r\n * @param events Event names\r\n * @param fn Callback\r\n * @param options Optional options\r\n * @return Array passed arguments\r\n */\r\nexport const off = eventListener.bind(null, 'removeEventListener');\r\n\r\n/**\r\n * Creates an DOM-Element out of a string (Single element).\r\n * @param html HTML representing a single element\r\n * @returns {Element | null} The element.\r\n */\r\nexport function createElementFromString(html) {\r\n const div = document.createElement('div');\r\n div.innerHTML = html.trim();\r\n return div.firstElementChild;\r\n}\r\n\r\n/**\r\n * Creates a new html element, every element which has\r\n * a ':ref' attribute will be saved in a object (which will be returned)\r\n * where the value of ':ref' is the object-key and the value the HTMLElement.\r\n *\r\n * It's possible to create a hierarchy if you add a ':obj' attribute. Every\r\n * sibling will be added to the object which will get the name from the 'data-con' attribute.\r\n *\r\n * If you want to create an Array out of multiple elements, you can use the ':arr' attribute,\r\n * the value defines the key and all elements, which has the same parent and the same 'data-arr' attribute,\r\n * would be added to it.\r\n *\r\n * @param str - The HTML String.\r\n */\r\n\r\nexport function createFromTemplate(str) {\r\n\r\n // Removes an attribute from a HTMLElement and returns the value.\r\n const removeAttribute = (el, name) => {\r\n const value = el.getAttribute(name);\r\n el.removeAttribute(name);\r\n return value;\r\n };\r\n\r\n // Recursive function to resolve template\r\n const resolve = (element, base = {}) => {\r\n\r\n // Check key and container attribute\r\n const con = removeAttribute(element, ':obj');\r\n const key = removeAttribute(element, ':ref');\r\n const subtree = con ? (base[con] = {}) : base;\r\n\r\n // Check and save element\r\n key && (base[key] = element);\r\n for (const child of Array.from(element.children)) {\r\n const arr = removeAttribute(child, ':arr');\r\n const sub = resolve(child, arr ? {} : subtree);\r\n\r\n if (arr) {\r\n\r\n // Check if there is already an array and add element\r\n (subtree[arr] || (subtree[arr] = []))\r\n .push(Object.keys(sub).length ? sub : child);\r\n }\r\n }\r\n\r\n return base;\r\n };\r\n\r\n return resolve(createElementFromString(str));\r\n}\r\n\r\n/**\r\n * Polyfill for safari & firefox for the eventPath event property.\r\n * @param evt The event object.\r\n * @return [String] event path.\r\n */\r\nexport function eventPath(evt) {\r\n let path = evt.path || (evt.composedPath && evt.composedPath());\r\n if (path) {\r\n return path;\r\n }\r\n\r\n let el = evt.target.parentElement;\r\n path = [evt.target, el];\r\n while (el = el.parentElement) {\r\n path.push(el);\r\n }\r\n\r\n path.push(document, window);\r\n return path;\r\n}\r\n\r\n/**\r\n * Resolves a HTMLElement by query.\r\n * @param val\r\n * @returns {null|Document|Element}\r\n */\r\nexport function resolveElement(val) {\r\n if (val instanceof Element) {\r\n return val;\r\n } else if (typeof val === 'string') {\r\n return val.split(/>>/g).reduce((pv, cv, ci, a) => {\r\n pv = pv.querySelector(cv);\r\n return ci < a.length - 1 ? pv.shadowRoot : pv;\r\n }, document);\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/**\r\n * Creates the ability to change numbers in an input field with the scroll-wheel.\r\n * @param el\r\n * @param mapper\r\n */\r\nexport function adjustableInputNumbers(el, mapper = v => v) {\r\n\r\n function handleScroll(e) {\r\n const inc = ([0.001, 0.01, 0.1])[Number(e.shiftKey || e.ctrlKey * 2)] * (e.deltaY < 0 ? 1 : -1);\r\n\r\n let index = 0;\r\n let off = el.selectionStart;\r\n el.value = el.value.replace(/[\\d.]+/g, (v, i) => {\r\n\r\n // Check if number is in cursor range and increase it\r\n if (i <= off && i + v.length >= off) {\r\n off = i;\r\n return mapper(Number(v), inc, index);\r\n }\r\n\r\n index++;\r\n return v;\r\n });\r\n\r\n el.focus();\r\n el.setSelectionRange(off, off);\r\n\r\n // Prevent default and trigger input event\r\n e.preventDefault();\r\n el.dispatchEvent(new Event('input'));\r\n }\r\n\r\n // Bind events\r\n on(el, 'focus', () => on(window, 'wheel', handleScroll, {passive: false}));\r\n on(el, 'blur', () => off(window, 'wheel', handleScroll));\r\n}\r\n","// Shorthands\r\nconst {min, max, floor, round} = Math;\r\n\r\n/**\r\n * Tries to convert a color name to rgb/a hex representation\r\n * @param name\r\n * @returns {string | CanvasGradient | CanvasPattern}\r\n */\r\nfunction standardizeColor(name) {\r\n\r\n // Since invalid color's will be parsed as black, filter them out\r\n if (name.toLowerCase() === 'black') {\r\n return '#000';\r\n }\r\n\r\n const ctx = document.createElement('canvas').getContext('2d');\r\n ctx.fillStyle = name;\r\n return ctx.fillStyle === '#000' ? null : ctx.fillStyle;\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to RGB.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} Array with rgb values.\r\n */\r\nexport function hsvToRgb(h, s, v) {\r\n h = (h / 360) * 6;\r\n s /= 100;\r\n v /= 100;\r\n\r\n const i = floor(h);\r\n\r\n const f = h - i;\r\n const p = v * (1 - s);\r\n const q = v * (1 - f * s);\r\n const t = v * (1 - (1 - f) * s);\r\n\r\n const mod = i % 6;\r\n const r = [v, q, p, p, t, v][mod];\r\n const g = [t, v, v, q, p, p][mod];\r\n const b = [p, p, t, v, v, q][mod];\r\n\r\n return [\r\n r * 255,\r\n g * 255,\r\n b * 255\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to Hex.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {string[]} Hex values\r\n */\r\nexport function hsvToHex(h, s, v) {\r\n return hsvToRgb(h, s, v).map(v =>\r\n round(v).toString(16).padStart(2, '0')\r\n );\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to CMYK.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} CMYK values\r\n */\r\nexport function hsvToCmyk(h, s, v) {\r\n const rgb = hsvToRgb(h, s, v);\r\n const r = rgb[0] / 255;\r\n const g = rgb[1] / 255;\r\n const b = rgb[2] / 255;\r\n\r\n const k = min(1 - r, 1 - g, 1 - b);\r\n const c = k === 1 ? 0 : (1 - r - k) / (1 - k);\r\n const m = k === 1 ? 0 : (1 - g - k) / (1 - k);\r\n const y = k === 1 ? 0 : (1 - b - k) / (1 - k);\r\n\r\n return [\r\n c * 100,\r\n m * 100,\r\n y * 100,\r\n k * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert HSV spectrum to HSL.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param v Value\r\n * @returns {number[]} HSL values\r\n */\r\nexport function hsvToHsl(h, s, v) {\r\n s /= 100;\r\n v /= 100;\r\n\r\n const l = (2 - s) * v / 2;\r\n\r\n if (l !== 0) {\r\n if (l === 1) {\r\n s = 0;\r\n } else if (l < 0.5) {\r\n s = s * v / (l * 2);\r\n } else {\r\n s = s * v / (2 - l * 2);\r\n }\r\n }\r\n\r\n return [\r\n h,\r\n s * 100,\r\n l * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert RGB to HSV.\r\n * @param r Red\r\n * @param g Green\r\n * @param b Blue\r\n * @return {number[]} HSV values.\r\n */\r\nfunction rgbToHsv(r, g, b) {\r\n r /= 255;\r\n g /= 255;\r\n b /= 255;\r\n\r\n const minVal = min(r, g, b);\r\n const maxVal = max(r, g, b);\r\n const delta = maxVal - minVal;\r\n\r\n let h, s;\r\n const v = maxVal;\r\n if (delta === 0) {\r\n h = s = 0;\r\n } else {\r\n s = delta / maxVal;\r\n const dr = (((maxVal - r) / 6) + (delta / 2)) / delta;\r\n const dg = (((maxVal - g) / 6) + (delta / 2)) / delta;\r\n const db = (((maxVal - b) / 6) + (delta / 2)) / delta;\r\n\r\n if (r === maxVal) {\r\n h = db - dg;\r\n } else if (g === maxVal) {\r\n h = (1 / 3) + dr - db;\r\n } else if (b === maxVal) {\r\n h = (2 / 3) + dg - dr;\r\n }\r\n\r\n if (h < 0) {\r\n h += 1;\r\n } else if (h > 1) {\r\n h -= 1;\r\n }\r\n }\r\n\r\n return [\r\n h * 360,\r\n s * 100,\r\n v * 100\r\n ];\r\n}\r\n\r\n/**\r\n * Convert CMYK to HSV.\r\n * @param c Cyan\r\n * @param m Magenta\r\n * @param y Yellow\r\n * @param k Key (Black)\r\n * @return {number[]} HSV values.\r\n */\r\nfunction cmykToHsv(c, m, y, k) {\r\n c /= 100;\r\n m /= 100;\r\n y /= 100;\r\n k /= 100;\r\n\r\n const r = (1 - min(1, c * (1 - k) + k)) * 255;\r\n const g = (1 - min(1, m * (1 - k) + k)) * 255;\r\n const b = (1 - min(1, y * (1 - k) + k)) * 255;\r\n\r\n return [...rgbToHsv(r, g, b)];\r\n}\r\n\r\n/**\r\n * Convert HSL to HSV.\r\n * @param h Hue\r\n * @param s Saturation\r\n * @param l Lightness\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hslToHsv(h, s, l) {\r\n s /= 100;\r\n l /= 100;\r\n s *= l < 0.5 ? l : 1 - l;\r\n\r\n const ns = (2 * s / (l + s)) * 100;\r\n const v = (l + s) * 100;\r\n return [h, isNaN(ns) ? 0 : ns, v];\r\n}\r\n\r\n/**\r\n * Convert HEX to HSV.\r\n * @param hex Hexadecimal string of rgb colors, can have length 3 or 6.\r\n * @return {number[]} HSV values.\r\n */\r\nfunction hexToHsv(hex) {\r\n return rgbToHsv(...hex.match(/.{2}/g).map(v => parseInt(v, 16)));\r\n}\r\n\r\n/**\r\n * Try's to parse a string which represents a color to a HSV array.\r\n * Current supported types are cmyk, rgba, hsla and hexadecimal.\r\n * @param str\r\n * @return {*}\r\n */\r\nexport function parseToHSVA(str) {\r\n\r\n // Check if string is a color-name\r\n str = str.match(/^[a-zA-Z]+$/) ? standardizeColor(str) : str;\r\n\r\n // Regular expressions to match different types of color represention\r\n const regex = {\r\n cmyk: /^cmyk[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]+([\\d.]+)/i,\r\n rgba: /^((rgba)|rgb)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]*?([\\d.]+|$)/i,\r\n hsla: /^((hsla)|hsl)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]*?([\\d.]+|$)/i,\r\n hsva: /^((hsva)|hsv)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]+([\\d.]+)[\\D]*?([\\d.]+|$)/i,\r\n hexa: /^#?(([\\dA-Fa-f]{3,4})|([\\dA-Fa-f]{6})|([\\dA-Fa-f]{8}))$/i\r\n };\r\n\r\n /**\r\n * Takes an Array of any type, convert strings which represents\r\n * a number to a number an anything else to undefined.\r\n * @param array\r\n * @return {*}\r\n */\r\n const numarize = array => array.map(v => /^(|\\d+)\\.\\d+|\\d+$/.test(v) ? Number(v) : undefined);\r\n\r\n let match;\r\n invalid: for (const type in regex) {\r\n\r\n // Check if current scheme passed\r\n if (!(match = regex[type].exec(str))) {\r\n continue;\r\n }\r\n\r\n // Match[2] does only contain a truly value if rgba, hsla, or hsla got matched\r\n const alphaValid = a => (!!match[2] === (typeof a === 'number'));\r\n\r\n // Try to convert\r\n switch (type) {\r\n case 'cmyk': {\r\n const [, c, m, y, k] = numarize(match);\r\n\r\n if (c > 100 || m > 100 || y > 100 || k > 100) {\r\n break invalid;\r\n }\r\n\r\n return {values: cmykToHsv(c, m, y, k), type};\r\n }\r\n case 'rgba': {\r\n const [, , , r, g, b, a] = numarize(match);\r\n\r\n if (r > 255 || g > 255 || b > 255 || a < 0 || a > 1 || !alphaValid(a)) {\r\n break invalid;\r\n }\r\n\r\n return {values: [...rgbToHsv(r, g, b), a], a, type};\r\n }\r\n case 'hexa': {\r\n let [, hex] = match;\r\n\r\n if (hex.length === 4 || hex.length === 3) {\r\n hex = hex.split('').map(v => v + v).join('');\r\n }\r\n\r\n const raw = hex.substring(0, 6);\r\n let a = hex.substring(6);\r\n\r\n // Convert 0 - 255 to 0 - 1 for opacity\r\n a = a ? (parseInt(a, 16) / 255) : undefined;\r\n\r\n return {values: [...hexToHsv(raw), a], a, type};\r\n }\r\n case 'hsla': {\r\n const [, , , h, s, l, a] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || l > 100 || a < 0 || a > 1 || !alphaValid(a)) {\r\n break invalid;\r\n }\r\n\r\n return {values: [...hslToHsv(h, s, l), a], a, type};\r\n }\r\n case 'hsva': {\r\n const [, , , h, s, v, a] = numarize(match);\r\n\r\n if (h > 360 || s > 100 || v > 100 || a < 0 || a > 1 || !alphaValid(a)) {\r\n break invalid;\r\n }\r\n\r\n return {values: [h, s, v, a], a, type};\r\n }\r\n }\r\n }\r\n\r\n return {values: null, type: null};\r\n}\r\n","import {hsvToCmyk, hsvToHex, hsvToHsl, hsvToRgb} from './color';\r\n\r\n/**\r\n * Simple class which holds the properties\r\n * of the color represention model hsla (hue saturation lightness alpha)\r\n */\r\nexport function HSVaColor(h = 0, s = 0, v = 0, a = 1) {\r\n const mapper = (original, next) => (precision = -1) => {\r\n return next(~precision ? original.map(v => Number(v.toFixed(precision))) : original);\r\n };\r\n\r\n const that = {\r\n h, s, v, a,\r\n\r\n toHSVA() {\r\n const hsva = [that.h, that.s, that.v, that.a];\r\n hsva.toString = mapper(hsva, arr => `hsva(${arr[0]}, ${arr[1]}%, ${arr[2]}%, ${that.a})`);\r\n return hsva;\r\n },\r\n\r\n toHSLA() {\r\n const hsla = [...hsvToHsl(that.h, that.s, that.v), that.a];\r\n hsla.toString = mapper(hsla, arr => `hsla(${arr[0]}, ${arr[1]}%, ${arr[2]}%, ${that.a})`);\r\n return hsla;\r\n },\r\n\r\n toRGBA() {\r\n const rgba = [...hsvToRgb(that.h, that.s, that.v), that.a];\r\n rgba.toString = mapper(rgba, arr => `rgba(${arr[0]}, ${arr[1]}, ${arr[2]}, ${that.a})`);\r\n return rgba;\r\n },\r\n\r\n toCMYK() {\r\n const cmyk = hsvToCmyk(that.h, that.s, that.v);\r\n cmyk.toString = mapper(cmyk, arr => `cmyk(${arr[0]}%, ${arr[1]}%, ${arr[2]}%, ${arr[3]}%)`);\r\n return cmyk;\r\n },\r\n\r\n toHEXA() {\r\n const hex = hsvToHex(that.h, that.s, that.v);\r\n\r\n // Check if alpha channel make sense, convert it to 255 number space, convert\r\n // To hex and pad it with zeros if needet.\r\n const alpha = that.a >= 1 ? '' : Number((that.a * 255).toFixed(0))\r\n .toString(16)\r\n .toUpperCase().padStart(2, '0');\r\n\r\n alpha && hex.push(alpha);\r\n hex.toString = () => `#${hex.join('').toUpperCase()}`;\r\n return hex;\r\n },\r\n\r\n clone: () => HSVaColor(that.h, that.s, that.v, that.a)\r\n };\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\r\n\r\nconst clamp = v => Math.max(Math.min(v, 1), 0);\r\nexport default function Moveable(opt) {\r\n\r\n const that = {\r\n\r\n // Assign default values\r\n options: Object.assign({\r\n lock: null,\r\n onchange: () => 0,\r\n onstop: () => 0\r\n }, opt),\r\n\r\n _keyboard(e) {\r\n const {options} = that;\r\n const {type, key} = e;\r\n\r\n // Check to see if the Movable is focused and then move it based on arrow key inputs\r\n // For improved accessibility\r\n if (document.activeElement === options.wrapper) {\r\n const {lock} = that.options;\r\n const up = key === 'ArrowUp';\r\n const right = key === 'ArrowRight';\r\n const down = key === 'ArrowDown';\r\n const left = key === 'ArrowLeft';\r\n\r\n if (type === 'keydown' && (up || right || down || left)) {\r\n let xm = 0;\r\n let ym = 0;\r\n\r\n if (lock === 'v') {\r\n xm = (up || right) ? 1 : -1;\r\n } else if (lock === 'h') {\r\n xm = (up || right) ? -1 : 1;\r\n } else {\r\n ym = up ? -1 : (down ? 1 : 0);\r\n xm = left ? -1 : (right ? 1 : 0);\r\n }\r\n\r\n that.update(\r\n clamp(that.cache.x + (0.01 * xm)),\r\n clamp(that.cache.y + (0.01 * ym))\r\n );\r\n e.preventDefault();\r\n } else if (key.startsWith('Arrow')) {\r\n that.options.onstop();\r\n e.preventDefault();\r\n }\r\n }\r\n },\r\n\r\n _tapstart(evt) {\r\n _.on(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.on(document, ['mousemove', 'touchmove'], that._tapmove);\r\n\r\n if (evt.cancelable) {\r\n evt.preventDefault();\r\n }\r\n\r\n // Trigger\r\n that._tapmove(evt);\r\n },\r\n\r\n _tapmove(evt) {\r\n const {options, cache} = that;\r\n const {lock, element, wrapper} = options;\r\n const b = wrapper.getBoundingClientRect();\r\n\r\n let x = 0, y = 0;\r\n if (evt) {\r\n const touch = evt && evt.touches && evt.touches[0];\r\n x = evt ? (touch || evt).clientX : 0;\r\n y = evt ? (touch || evt).clientY : 0;\r\n\r\n // Reset to bounds\r\n if (x < b.left) {\r\n x = b.left;\r\n } else if (x > b.left + b.width) {\r\n x = b.left + b.width;\r\n }\r\n if (y < b.top) {\r\n y = b.top;\r\n } else if (y > b.top + b.height) {\r\n y = b.top + b.height;\r\n }\r\n\r\n // Normalize\r\n x -= b.left;\r\n y -= b.top;\r\n } else if (cache) {\r\n x = cache.x * b.width;\r\n y = cache.y * b.height;\r\n }\r\n\r\n if (lock !== 'h') {\r\n element.style.left = `calc(${x / b.width * 100}% - ${element.offsetWidth / 2}px)`;\r\n }\r\n\r\n if (lock !== 'v') {\r\n element.style.top = `calc(${y / b.height * 100}% - ${element.offsetHeight / 2}px)`;\r\n }\r\n\r\n that.cache = {x: x / b.width, y: y / b.height};\r\n const cx = clamp(x / b.width);\r\n const cy = clamp(y / b.height);\r\n\r\n switch (lock) {\r\n case 'v':\r\n return options.onchange(cx);\r\n case 'h':\r\n return options.onchange(cy);\r\n default:\r\n return options.onchange(cx, cy);\r\n }\r\n },\r\n\r\n _tapstop() {\r\n that.options.onstop();\r\n _.off(document, ['mouseup', 'touchend', 'touchcancel'], that._tapstop);\r\n _.off(document, ['mousemove', 'touchmove'], that._tapmove);\r\n },\r\n\r\n trigger() {\r\n that._tapmove();\r\n },\r\n\r\n update(x = 0, y = 0) {\r\n const {left, top, width, height} = that.options.wrapper.getBoundingClientRect();\r\n\r\n if (that.options.lock === 'h') {\r\n y = x;\r\n }\r\n\r\n that._tapmove({\r\n clientX: left + width * x,\r\n clientY: top + height * y\r\n });\r\n },\r\n\r\n destroy() {\r\n const {options, _tapstart, _keyboard} = that;\r\n _.off(document, ['keydown', 'keyup'], _keyboard);\r\n _.off([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.off([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n }\r\n };\r\n\r\n // Initilize\r\n const {options, _tapstart, _keyboard} = that;\r\n _.on([options.wrapper, options.element], 'mousedown', _tapstart);\r\n _.on([options.wrapper, options.element], 'touchstart', _tapstart, {\r\n passive: false\r\n });\r\n\r\n _.on(document, ['keydown', 'keyup'], _keyboard);\r\n\r\n return that;\r\n}\r\n","import * as _ from '../utils/utils';\n\nexport default function Selectable(opt = {}) {\n opt = Object.assign({\n onchange: () => 0,\n className: '',\n elements: []\n }, opt);\n\n const onTap = _.on(opt.elements, 'click', evt => {\n opt.elements.forEach(e =>\n e.classList[evt.target === e ? 'add' : 'remove'](opt.className)\n );\n\n opt.onchange(evt);\n\n // Fix for https://github.com/Simonwep/pickr/issues/243\n evt.stopPropagation();\n });\n\n return {\n destroy: () => _.off(...onTap)\n };\n}\n","import * as _ from './utils/utils';\r\n\r\nexport default instance => {\r\n\r\n const {\r\n components,\r\n useAsButton,\r\n inline,\r\n appClass,\r\n theme,\r\n lockOpacity\r\n } = instance.options;\r\n\r\n // Utils\r\n const hidden = con => con ? '' : 'style=\"display:none\" hidden';\r\n const t = str => instance._t(str);\r\n\r\n const root = _.createFromTemplate(`\r\n
\r\n\r\n ${useAsButton ? '' : ''}\r\n\r\n
\r\n
\r\n
\r\n \r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n
\r\n\r\n
\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n `);\r\n\r\n const int = root.interaction;\r\n\r\n // Select option which is not hidden\r\n int.options.find(o => !o.hidden && !o.classList.add('active'));\r\n\r\n // Append method to find currently active option\r\n int.type = () => int.options.find(e => e.classList.contains('active'));\r\n return root;\r\n};\r\n","type Direction = 'top' | 'left' | 'bottom' | 'right';\n\nexport type VariantFlipOrder = {\n start: string;\n middle: string;\n end: string;\n};\n\nexport type PositionFlipOrder = {\n top: string;\n right: string;\n bottom: string;\n left: string;\n};\n\nexport type NanoPopPosition =\n 'top-start' | 'top-middle' | 'top-end' |\n 'left-start' | 'left-middle' | 'left-end' |\n 'right-start' | 'right-middle' | 'right-end' |\n 'bottom-start' | 'bottom-middle' | 'bottom-end' | Direction;\n\nexport type NanoPopOptions = {\n container: DOMRect;\n position: NanoPopPosition;\n variantFlipOrder: VariantFlipOrder;\n positionFlipOrder: PositionFlipOrder;\n margin: number;\n reference?: HTMLElement;\n popper?: HTMLElement;\n};\n\ntype AvailablePositions = {\n t: number;\n b: number;\n l: number;\n r: number;\n};\n\ntype AvailableVariants = {\n vs: number;\n vm: number;\n ve: number;\n hs: number;\n hm: number;\n he: number;\n};\n\ntype PositionPairs = [Direction, Direction];\nexport type PositionMatch = 'ts' | 'tm' | 'te' | 'bs' | 'bm' | 'be' | 'ls' | 'lm' | 'le' | 'rs' | 'rm' | 're';\n\nexport interface NanoPop {\n update(updatedOptions?: Partial): PositionMatch | null;\n}\n\nexport interface NanoPopConstructor {\n\n /**\n * @param reference Reference element\n * @param popper Actual popper element\n * @param options Optional options\n */\n (reference: HTMLElement, popper: HTMLElement, options?: Partial): NanoPop;\n\n /**\n * @param options Partial options which get merged with the current one\n */\n (options?: Partial): NanoPop;\n}\n\n// Export current version\nexport const version = VERSION;\n\n// Export default\nexport const defaults = {\n variantFlipOrder: {start: 'sme', middle: 'mse', end: 'ems'},\n positionFlipOrder: {top: 'tbrl', right: 'rltb', bottom: 'btrl', left: 'lrbt'},\n position: 'bottom',\n margin: 8\n};\n\n/**\n * Repositions an element once using the provided options and elements.\n * @param reference Reference element\n * @param popper Popper element\n * @param opt Optional, additional options\n */\nexport const reposition = (\n reference: HTMLElement,\n popper: HTMLElement,\n opt?: Partial\n): PositionMatch | null => {\n const {\n container,\n margin,\n position,\n variantFlipOrder,\n positionFlipOrder\n } = {\n container: document.documentElement.getBoundingClientRect(),\n ...defaults,\n ...opt\n };\n\n /**\n * Reset position to resolve viewport\n * See https://developer.mozilla.org/en-US/docs/Web/CSS/position#fixed\n */\n const {left: originalLeft, top: originalTop} = popper.style;\n popper.style.left = '0';\n popper.style.top = '0';\n\n const refBox = reference.getBoundingClientRect();\n const popBox = popper.getBoundingClientRect();\n\n /**\n * Holds coordinates of top, left, bottom and right alignment\n */\n const positionStore: AvailablePositions = {\n t: refBox.top - popBox.height - margin,\n b: refBox.bottom + margin,\n r: refBox.right + margin,\n l: refBox.left - popBox.width - margin\n };\n\n /**\n * Holds corresponding variants (start, middle, end).\n * The values depend on horizontal / vertical orientation\n */\n const variantStore: AvailableVariants = {\n vs: refBox.left,\n vm: refBox.left + refBox.width / 2 + -popBox.width / 2,\n ve: refBox.left + refBox.width - popBox.width,\n hs: refBox.top,\n hm: refBox.bottom - refBox.height / 2 - popBox.height / 2,\n he: refBox.bottom - popBox.height\n };\n\n // Extract position and variant\n // Top-start -> top is \"position\" and \"start\" is the variant\n const [posKey, varKey = 'middle'] = position.split('-');\n const positions = positionFlipOrder[posKey as keyof PositionFlipOrder];\n const variants = variantFlipOrder[varKey as keyof VariantFlipOrder];\n\n // Try out all possible combinations, starting with the preferred one.\n const {top, left, bottom, right} = container;\n\n for (const p of positions) {\n const vertical = (p === 't' || p === 'b');\n\n // The position-value\n const positionVal = positionStore[p as keyof AvailablePositions];\n\n // Which property has to be changes.\n const [positionKey, variantKey] = (vertical ? ['top', 'left'] : ['left', 'top']) as PositionPairs;\n\n /**\n * box refers to the size of the popper element. Depending on the orientation this is width or height.\n * The limit is the corresponding, maximum value for this position.\n */\n const [positionSize, variantSize] = vertical ? [popBox.height, popBox.width] : [popBox.width, popBox.height];\n const [positionMaximum, variantMaximum] = vertical ? [bottom, right] : [right, bottom];\n const [positionMinimum, variantMinimum] = vertical ? [top, left] : [left, top];\n\n // Skip pre-clipped values\n if (positionVal < positionMinimum || (positionVal + positionSize) > positionMaximum) {\n continue;\n }\n\n for (const v of variants) {\n\n // The position-value, the related size value of the popper and the limit\n const variantVal = variantStore[((vertical ? 'v' : 'h') + v) as keyof AvailableVariants];\n\n if (variantVal < variantMinimum || (variantVal + variantSize) > variantMaximum) {\n continue;\n }\n\n // Apply styles and normalize viewport\n popper.style[variantKey] = `${variantVal - popBox[variantKey]}px`;\n popper.style[positionKey] = `${positionVal - popBox[positionKey]}px`;\n return (p + v) as PositionMatch;\n }\n }\n\n // Revert style values (won't work with styled-elements or similar systems)\n // \"Fix\" for https://github.com/Simonwep/nanopop/issues/7\n popper.style.left = originalLeft;\n popper.style.top = originalTop;\n\n return null;\n};\n\n/**\n * Creates a stateful popper.\n * You can either...\n * ... pass an options object: createPopper()\n * ... pass both the reference and popper: create(, , )\n * ... pass nothing, in this case you'll have to set at least both a reference and a popper in update.\n *\n * @param reference | options Reference element or options\n * @param popper Popper element\n * @param options Optional additional options\n */\nexport const createPopper: NanoPopConstructor = (\n reference?: HTMLElement | Partial,\n popper?: HTMLElement,\n options?: Partial\n): NanoPop => {\n\n // Resolve options\n const baseOptions: Partial = typeof reference === 'object' && !(reference instanceof HTMLElement) ?\n reference : {reference, popper, ...options};\n\n return {\n\n /**\n * Repositions the current popper.\n * @param options Optional options which get merged with the current ones.\n */\n update(options: Partial = baseOptions): PositionMatch | null {\n const {reference, popper} = Object.assign(baseOptions, options);\n\n if (!popper || !reference) {\n throw new Error('Popper- or reference-element missing.');\n }\n\n return reposition(reference, popper, baseOptions);\n }\n };\n};\n","import * as _ from './utils/utils';\nimport {parseToHSVA} from './utils/color';\nimport {HSVaColor} from './utils/hsvacolor';\nimport Moveable from './libs/moveable';\nimport Selectable from './libs/selectable';\nimport buildPickr from './template';\nimport {createPopper} from 'nanopop';\n\nexport default class Pickr {\n\n // Expose pickr utils\n static utils = _;\n\n // Assign version and export\n static version = VERSION;\n\n // Default strings\n static I18N_DEFAULTS = {\n\n // Strings visible in the UI\n 'ui:dialog': 'color picker dialog',\n 'btn:toggle': 'toggle color picker dialog',\n 'btn:swatch': 'color swatch',\n 'btn:last-color': 'use previous color',\n 'btn:save': 'Save',\n 'btn:cancel': 'Cancel',\n 'btn:clear': 'Clear',\n\n // Strings used for aria-labels\n 'aria:btn:save': 'save and close',\n 'aria:btn:cancel': 'cancel and close',\n 'aria:btn:clear': 'clear and close',\n 'aria:input': 'color input field',\n 'aria:palette': 'color selection area',\n 'aria:hue': 'hue selection slider',\n 'aria:opacity': 'selection slider'\n };\n\n // Default options\n static DEFAULT_OPTIONS = {\n appClass: null,\n theme: 'classic',\n useAsButton: false,\n padding: 8,\n disabled: false,\n comparison: true,\n closeOnScroll: false,\n outputPrecision: 0,\n lockOpacity: false,\n autoReposition: true,\n container: 'body',\n\n components: {\n interaction: {}\n },\n\n i18n: {},\n swatches: null,\n inline: false,\n sliders: null,\n\n default: '#42445a',\n defaultRepresentation: null,\n position: 'bottom-middle',\n adjustableNumbers: true,\n showAlways: false,\n\n closeWithKey: 'Escape'\n };\n\n // Will be used to prevent specific actions during initilization\n _initializingActive = true;\n\n // If the current color value should be recalculated\n _recalc = true;\n\n // Positioning engine and DOM-Tree\n _nanopop = null;\n _root = null;\n\n // Current and last color for comparison\n _color = HSVaColor();\n _lastColor = HSVaColor();\n _swatchColors = [];\n\n // Animation frame used for setup.\n // Will be cancelled in case of destruction.\n _setupAnimationFrame = null;\n\n // Evenlistener name: [callbacks]\n _eventListener = {\n init: [],\n save: [],\n hide: [],\n show: [],\n clear: [],\n change: [],\n changestop: [],\n cancel: [],\n swatchselect: []\n };\n\n constructor(opt) {\n\n // Assign default values\n this.options = opt = Object.assign({...Pickr.DEFAULT_OPTIONS}, opt);\n\n const {swatches, components, theme, sliders, lockOpacity, padding} = opt;\n\n if (['nano', 'monolith'].includes(theme) && !sliders) {\n opt.sliders = 'h';\n }\n\n // Check interaction section\n if (!components.interaction) {\n components.interaction = {};\n }\n\n // Overwrite palette if preview, opacity or hue are true\n const {preview, opacity, hue, palette} = components;\n components.opacity = (!lockOpacity && opacity);\n components.palette = palette || preview || opacity || hue;\n\n // Initialize picker\n this._preBuild();\n this._buildComponents();\n this._bindEvents();\n this._finalBuild();\n\n // Append pre-defined swatch colors\n if (swatches && swatches.length) {\n swatches.forEach(color => this.addSwatch(color));\n }\n\n // Initialize positioning engine\n const {button, app} = this._root;\n this._nanopop = createPopper(button, app, {\n margin: padding\n });\n\n // Initialize accessibility\n button.setAttribute('role', 'button');\n button.setAttribute('aria-label', this._t('btn:toggle'));\n\n // Initilization is finish, pickr is visible and ready for usage\n const that = this;\n this._setupAnimationFrame = requestAnimationFrame((function cb() {\n\n // TODO: Performance issue due to high call-rate?\n if (!app.offsetWidth) {\n return requestAnimationFrame(cb);\n }\n\n // Apply default color\n that.setColor(opt.default);\n that._rePositioningPicker();\n\n // Initialize color representation\n if (opt.defaultRepresentation) {\n that._representation = opt.defaultRepresentation;\n that.setColorRepresentation(that._representation);\n }\n\n // Show pickr if locked\n if (opt.showAlways) {\n that.show();\n }\n\n // Initialization is done - pickr is usable, fire init event\n that._initializingActive = false;\n that._emit('init');\n }));\n }\n\n // Create instance via method\n static create = options => new Pickr(options);\n\n // Does only the absolutly basic thing to initialize the components\n _preBuild() {\n const {options} = this;\n\n // Resolve elements\n for (const type of ['el', 'container']) {\n options[type] = _.resolveElement(options[type]);\n }\n\n // Create element and append it to body to\n // Prevent initialization errors\n this._root = buildPickr(this);\n\n // Check if a custom button is used\n if (options.useAsButton) {\n this._root.button = options.el; // Replace button with customized button\n }\n\n options.container.appendChild(this._root.root);\n }\n\n _finalBuild() {\n const opt = this.options;\n const root = this._root;\n\n // Remove from body\n opt.container.removeChild(root.root);\n\n if (opt.inline) {\n const parent = opt.el.parentElement;\n\n if (opt.el.nextSibling) {\n parent.insertBefore(root.app, opt.el.nextSibling);\n } else {\n parent.appendChild(root.app);\n }\n } else {\n opt.container.appendChild(root.app);\n }\n\n // Don't replace the the element if a custom button is used\n if (!opt.useAsButton) {\n\n // Replace element with actual color-picker\n opt.el.parentNode.replaceChild(root.root, opt.el);\n } else if (opt.inline) {\n opt.el.remove();\n }\n\n // Check if it should be immediatly disabled\n if (opt.disabled) {\n this.disable();\n }\n\n // Check if color comparison is disabled, if yes - remove transitions so everything keeps smoothly\n if (!opt.comparison) {\n root.button.style.transition = 'none';\n\n if (!opt.useAsButton) {\n root.preview.lastColor.style.transition = 'none';\n }\n }\n\n this.hide();\n }\n\n _buildComponents() {\n\n // Instance reference\n const inst = this;\n const cs = this.options.components;\n const sliders = (inst.options.sliders || 'v').repeat(2);\n const [so, sh] = sliders.match(/^[vh]+$/g) ? sliders : [];\n\n // Re-assign if null\n const getColor = () =>\n this._color || (this._color = this._lastColor.clone());\n\n const components = {\n\n palette: Moveable({\n element: inst._root.palette.picker,\n wrapper: inst._root.palette.palette,\n\n onstop: () => inst._emit('changestop', 'slider', inst),\n onchange(x, y) {\n if (!cs.palette) {\n return;\n }\n\n const color = getColor();\n const {_root, options} = inst;\n const {lastColor, currentColor} = _root.preview;\n\n // Update the input field only if the user is currently not typing\n if (inst._recalc) {\n\n // Calculate saturation based on the position\n color.s = x * 100;\n\n // Calculate the value\n color.v = 100 - y * 100;\n\n // Prevent falling under zero\n color.v < 0 ? color.v = 0 : 0;\n inst._updateOutput('slider');\n }\n\n // Set picker and gradient color\n const cssRGBaString = color.toRGBA().toString(0);\n this.element.style.background = cssRGBaString;\n this.wrapper.style.background = `\n linear-gradient(to top, rgba(0, 0, 0, ${color.a}), transparent),\n linear-gradient(to left, hsla(${color.h}, 100%, 50%, ${color.a}), rgba(255, 255, 255, ${color.a}))\n `;\n\n // Check if color is locked\n if (!options.comparison) {\n _root.button.style.setProperty('--pcr-color', cssRGBaString);\n\n // If the user changes the color, remove the cleared icon\n _root.button.classList.remove('clear');\n } else if (!options.useAsButton && !inst._lastColor) {\n\n // Apply color to both the last and current color since the current state is cleared\n lastColor.style.setProperty('--pcr-color', cssRGBaString);\n }\n\n // Check if there's a swatch which color matches the current one\n const hexa = color.toHEXA().toString();\n for (const {el, color} of inst._swatchColors) {\n el.classList[hexa === color.toHEXA().toString() ? 'add' : 'remove']('pcr-active');\n }\n\n // Change current color\n currentColor.style.setProperty('--pcr-color', cssRGBaString);\n }\n }),\n\n hue: Moveable({\n lock: sh === 'v' ? 'h' : 'v',\n element: inst._root.hue.picker,\n wrapper: inst._root.hue.slider,\n\n onstop: () => inst._emit('changestop', 'slider', inst),\n onchange(v) {\n if (!cs.hue || !cs.palette) {\n return;\n }\n\n const color = getColor();\n\n // Calculate hue\n if (inst._recalc) {\n color.h = v * 360;\n }\n\n // Update color\n this.element.style.backgroundColor = `hsl(${color.h}, 100%, 50%)`;\n components.palette.trigger();\n }\n }),\n\n opacity: Moveable({\n lock: so === 'v' ? 'h' : 'v',\n element: inst._root.opacity.picker,\n wrapper: inst._root.opacity.slider,\n\n onstop: () => inst._emit('changestop', 'slider', inst),\n onchange(v) {\n if (!cs.opacity || !cs.palette) {\n return;\n }\n\n const color = getColor();\n\n // Calculate opacity\n if (inst._recalc) {\n color.a = Math.round(v * 1e2) / 100;\n }\n\n // Update color\n this.element.style.background = `rgba(0, 0, 0, ${color.a})`;\n components.palette.trigger();\n }\n }),\n\n selectable: Selectable({\n elements: inst._root.interaction.options,\n className: 'active',\n\n onchange(e) {\n inst._representation = e.target.getAttribute('data-type').toUpperCase();\n inst._recalc && inst._updateOutput('swatch');\n }\n })\n };\n\n this._components = components;\n }\n\n _bindEvents() {\n const {_root, options} = this;\n\n const eventBindings = [\n\n // Clear color\n _.on(_root.interaction.clear, 'click', () => this._clearColor()),\n\n // Select last color on click\n _.on([\n _root.interaction.cancel,\n _root.preview.lastColor\n ], 'click', () => {\n this.setHSVA(...(this._lastColor || this._color).toHSVA(), true);\n this._emit('cancel');\n }),\n\n // Save color\n _.on(_root.interaction.save, 'click', () => {\n !this.applyColor() && !options.showAlways && this.hide();\n }),\n\n // User input\n _.on(_root.interaction.result, ['keyup', 'input'], e => {\n\n // Fire listener if initialization is finish and changed color was valid\n if (this.setColor(e.target.value, true) && !this._initializingActive) {\n this._emit('change', this._color, 'input', this);\n this._emit('changestop', 'input', this);\n }\n\n e.stopImmediatePropagation();\n }),\n\n // Detect user input and disable auto-recalculation\n _.on(_root.interaction.result, ['focus', 'blur'], e => {\n this._recalc = e.type === 'blur';\n this._recalc && this._updateOutput(null);\n }),\n\n // Cancel input detection on color change\n _.on([\n _root.palette.palette,\n _root.palette.picker,\n _root.hue.slider,\n _root.hue.picker,\n _root.opacity.slider,\n _root.opacity.picker\n ], ['mousedown', 'touchstart'], () => this._recalc = true, {passive: true})\n ];\n\n // Provide hiding / showing abilities only if showAlways is false\n if (!options.showAlways) {\n const ck = options.closeWithKey;\n\n eventBindings.push(\n\n // Save and hide / show picker\n _.on(_root.button, 'click', () => this.isOpen() ? this.hide() : this.show()),\n\n // Close with escape key\n _.on(document, 'keyup', e => this.isOpen() && (e.key === ck || e.code === ck) && this.hide()),\n\n // Cancel selecting if the user taps behind the color picker\n _.on(document, ['touchstart', 'mousedown'], e => {\n if (this.isOpen() && !_.eventPath(e).some(el => el === _root.app || el === _root.button)) {\n this.hide();\n }\n }, {capture: true})\n );\n }\n\n // Make input adjustable if enabled\n if (options.adjustableNumbers) {\n const ranges = {\n rgba: [255, 255, 255, 1],\n hsva: [360, 100, 100, 1],\n hsla: [360, 100, 100, 1],\n cmyk: [100, 100, 100, 100]\n };\n\n _.adjustableInputNumbers(_root.interaction.result, (o, step, index) => {\n const range = ranges[this.getColorRepresentation().toLowerCase()];\n\n if (range) {\n const max = range[index];\n\n // Calculate next reasonable number\n const nv = o + (max >= 100 ? step * 1000 : step);\n\n // Apply range of zero up to max, fix floating-point issues\n return nv <= 0 ? 0 : Number((nv < max ? nv : max).toPrecision(3));\n }\n\n return o;\n });\n }\n\n if (options.autoReposition && !options.inline) {\n let timeout = null;\n const that = this;\n\n // Re-calc position on window resize, scroll and wheel\n eventBindings.push(\n _.on(window, ['scroll', 'resize'], () => {\n if (that.isOpen()) {\n\n if (options.closeOnScroll) {\n that.hide();\n }\n\n if (timeout === null) {\n timeout = setTimeout(() => timeout = null, 100);\n\n // Update position on every frame\n requestAnimationFrame(function rs() {\n that._rePositioningPicker();\n (timeout !== null) && requestAnimationFrame(rs);\n });\n } else {\n clearTimeout(timeout);\n timeout = setTimeout(() => timeout = null, 100);\n }\n }\n }, {capture: true})\n );\n }\n\n // Save bindings\n this._eventBindings = eventBindings;\n }\n\n _rePositioningPicker() {\n const {options} = this;\n\n // No repositioning needed if inline\n if (!options.inline) {\n const success = this._nanopop.update({\n container: document.body.getBoundingClientRect(),\n position: options.position\n });\n\n if (!success) {\n const el = this._root.app;\n const eb = el.getBoundingClientRect();\n el.style.top = `${(window.innerHeight - eb.height) / 2}px`;\n el.style.left = `${(window.innerWidth - eb.width) / 2}px`;\n }\n }\n }\n\n _updateOutput(eventSource) {\n const {_root, _color, options} = this;\n\n // Check if component is present\n if (_root.interaction.type()) {\n\n // Construct function name and call if present\n const method = `to${_root.interaction.type().getAttribute('data-type')}`;\n _root.interaction.result.value = typeof _color[method] === 'function' ?\n _color[method]().toString(options.outputPrecision) : '';\n }\n\n // Fire listener if initialization is finish\n if (!this._initializingActive && this._recalc) {\n this._emit('change', _color, eventSource, this);\n }\n }\n\n _clearColor(silent = false) {\n const {_root, options} = this;\n\n // Change only the button color if it isn't customized\n if (!options.useAsButton) {\n _root.button.style.setProperty('--pcr-color', 'rgba(0, 0, 0, 0.15)');\n }\n\n _root.button.classList.add('clear');\n\n if (!options.showAlways) {\n this.hide();\n }\n\n this._lastColor = null;\n if (!this._initializingActive && !silent) {\n\n // Fire listener\n this._emit('save', null);\n this._emit('clear');\n }\n }\n\n _parseLocalColor(str) {\n const {values, type, a} = parseToHSVA(str);\n const {lockOpacity} = this.options;\n const alphaMakesAChange = a !== undefined && a !== 1;\n\n // If no opacity is applied, add undefined at the very end which gets\n // Set to 1 in setHSVA\n if (values && values.length === 3) {\n values[3] = undefined;\n }\n\n return {\n values: (!values || (lockOpacity && alphaMakesAChange)) ? null : values,\n type\n };\n }\n\n _t(key) {\n return this.options.i18n[key] || Pickr.I18N_DEFAULTS[key];\n }\n\n _emit(event, ...args) {\n this._eventListener[event].forEach(cb => cb(...args, this));\n }\n\n on(event, cb) {\n this._eventListener[event].push(cb);\n return this;\n }\n\n off(event, cb) {\n const callBacks = (this._eventListener[event] || []);\n const index = callBacks.indexOf(cb);\n\n if (~index) {\n callBacks.splice(index, 1);\n }\n\n return this;\n }\n\n /**\n * Appends a color to the swatch palette\n * @param color\n * @returns {boolean}\n */\n addSwatch(color) {\n const {values} = this._parseLocalColor(color);\n\n if (values) {\n const {_swatchColors, _root} = this;\n const color = HSVaColor(...values);\n\n // Create new swatch HTMLElement\n const el = _.createElementFromString(\n `