!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pickr=e():t.Pickr=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="dist/",n(n.s=7)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t};e.createElementFromString=s,e.removeAttribute=c,e.createFromTemplate=function(t){return function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=c(e,"data-con"),r=c(e,"data-key");r&&(n[r]=e);var i=Array.from(e.children),a=o?n[o]={}:n,s=!0,u=!1,l=void 0;try{for(var p,d=i[Symbol.iterator]();!(s=(p=d.next()).done);s=!0){var f=p.value,h=c(f,"data-arr");h?(a[h]||(a[h]=[])).push(f):t(f,a)}}catch(t){u=!0,l=t}finally{try{!s&&d.return&&d.return()}finally{if(u)throw l}}return n}(s(t))},e.eventPath=function(t){var e=t.path||t.composedPath&&t.composedPath();if(e)return e;var n=t.target.parentElement;for(e=[t.target,n];n=n.parentElement;)e.push(n);return e.push(document,window),e},e.bindClassUnderscoreFunctions=function(t){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(t)),n=!0,o=!1,r=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var s=i.value;"_"===s.charAt(0)&&"function"==typeof t[s]&&(t[s]=t[s].bind(t))}}catch(t){o=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(o)throw r}}},e.adjustableInputNumbers=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=function(t){return t>="0"&&t<="9"||"-"===t||"."===t};function o(o){for(var r=t.value,i=t.selectionStart,a=i,s="",c=i-1;c>0&&n(r[c]);c--)s=r[c]+s,a--;for(var u=i,l=r.length;u<l&&n(r[u]);u++)s+=r[u];if(s.length>0&&!isNaN(s)&&isFinite(s)){var p=o.deltaY<0?1:-1,d=o.ctrlKey?5*p:p,f=Number(s)+d;!e&&f<0&&(f=0);var h=r.substr(0,a)+f+r.substring(a+s.length,r.length),v=a+String(f).length;t.value=h,t.focus(),t.setSelectionRange(v,v)}o.preventDefault(),t.dispatchEvent(new Event("input"))}r(t,"focus",function(){return r(window,"wheel",o)}),r(t,"blur",function(){return i(window,"wheel",o)})},e.once=function(t,e,n,o){return r(t,e,function t(){n.apply(this,arguments),this.removeEventListener(e,t)},o)};var r=e.on=a.bind(null,"addEventListener"),i=e.off=a.bind(null,"removeEventListener");function a(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};return e instanceof HTMLCollection||e instanceof NodeList?e=Array.from(e):Array.isArray(e)||(e=[e]),Array.isArray(n)||(n=[n]),e.forEach(function(e){return n.forEach(function(n){return e[t](n,r,o({capture:!1},i))})}),Array.prototype.slice.call(arguments,1)}function s(t){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}function c(t,e){var n=t.getAttribute(e);return t.removeAttribute(e),n}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(t){r=!0,i=t}finally{try{!o&&s.return&&s.return()}finally{if(r)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}e.hsvToRgb=s,e.hsvToHex=function(t,e,n){return s(t,e,n).map(function(t){return Math.ceil(t).toString(16).padStart(2,"0")})},e.hsvToCmyk=function(t,e,n){var o,r=s(t,e,n),a=r[0]/255,c=r[1]/255,u=r[2]/255;return[100*(1===(o=i(1-a,1-c,1-u))?0:(1-a-o)/(1-o)),100*(1===o?0:(1-c-o)/(1-o)),100*(1===o?0:(1-u-o)/(1-o)),100*o]},e.hsvToHsl=function(t,e,n){var o=(2-(e/=100))*(n/=100)/2;return 0!==o&&(e=1===o?0:o<.5?e*n/(2*o):e*n/(2-2*o)),[t,100*e,100*o]},e.parseToHSV=function(t){var e={cmyk:/^cmyk[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)/i,rgba:/^(rgb|rgba)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsla:/^(hsl|hsla)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hsva:/^(hsv|hsva)[\D]+(\d+)[\D]+(\d+)[\D]+(\d+)[\D]*?([\d.]+|$)/i,hex:/^#?(([\dA-Fa-f]{3,4})|([\dA-Fa-f]{6})|([\dA-Fa-f]{8}))$/i},n=function(t){return t.map(function(t){return/^(|\d+)\.\d+|\d+$/.test(t)?Number(t):void 0})},i=void 0;for(var a in e)if(i=e[a].exec(t))switch(a){case"cmyk":var s=n(i),d=o(s,5),f=d[1],h=d[2],v=d[3],y=d[4];return f>100||h>100||v>100||y>100?null:[].concat(r(u(f,h,v,y)),[1]);case"rgba":var g=n(i),m=o(g,6),b=m[2],_=m[3],w=m[4],k=m[5],A=void 0===k?1:k;return b>255||_>255||w>255||A<0||A>1?null:[].concat(r(c(b,_,w)),[A]);case"hex":var C=function(t,e){return[t.substring(0,e),t.substring(e,t.length)]},S=o(i,2)[1];3===S.length?S+="F":6===S.length&&(S+="FF");var O=void 0;if(4===S.length){var j=C(S,3).map(function(t){return t+t}),x=o(j,2);S=x[0],O=x[1]}else if(8===S.length){var H=C(S,6),P=o(H,2);S=P[0],O=P[1]}return O=parseInt(O,16)/255,[].concat(r(p(S)),[O]);case"hsla":var B=n(i),R=o(B,6),E=R[2],M=R[3],T=R[4],L=R[5],F=void 0===L?1:L;return E>360||M>100||T>100||F<0||F>1?null:[].concat(r(l(E,M,T)),[F]);case"hsva":var D=n(i),N=o(D,6),V=N[2],X=N[3],I=N[4],Y=N[5],K=void 0===Y?1:Y;return V>360||X>100||I>100||K<0||K>1?null:[V,X,I,K]}return null};var i=Math.min,a=Math.max;function s(t,e,n){t=t/360*6,e/=100,n/=100;var o=Math.floor(t),r=t-o,i=n*(1-e),a=n*(1-r*e),s=n*(1-(1-r)*e),c=o%6;return[255*[n,a,i,i,s,n][c],255*[s,n,n,a,i,i][c],255*[i,i,s,n,n,a][c]]}function c(t,e,n){var o,r=void 0,s=void 0,c=i(t/=255,e/=255,n/=255),u=a(t,e,n),l=u-c;if(o=u,0===l)r=s=0;else{s=l/u;var p=((u-t)/6+l/2)/l,d=((u-e)/6+l/2)/l,f=((u-n)/6+l/2)/l;t===u?r=f-d:e===u?r=1/3+p-f:n===u&&(r=2/3+d-p),r<0?r+=1:r>1&&(r-=1)}return[360*r,100*s,100*o]}function u(t,e,n,o){e/=100,n/=100;var a=255*(1-i(1,(t/=100)*(1-(o/=100))+o)),s=255*(1-i(1,e*(1-o)+o)),u=255*(1-i(1,n*(1-o)+o));return[].concat(r(c(a,s,u)))}function l(t,e,n){return e/=100,[t,2*(e*=(n/=100)<.5?n:1-n)/(n+e)*100,100*(n+e)]}function p(t){return c.apply(void 0,r(t.match(/.{2}/g).map(function(t){return parseInt(t,16)})))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={options:Object.assign({onchange:function(){return 0},className:"",elements:[]},t),_ontap:function(t){var n=e.options;n.elements.forEach(function(e){return e.classList[t.target===e?"add":"remove"](n.className)}),n.onchange(t)},destroy:function(){o.off(e.options.elements,"click",this._ontap)}};return o.on(e.options.elements,"click",e._ontap),e};var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){var e={options:Object.assign({lockX:!1,lockY:!1,onchange:function(){return 0}},t),_tapstart:function(t){o.on(document,["mouseup","touchend","touchcancel"],e._tapstop),o.on(document,["mousemove","touchmove"],e._tapmove),t.preventDefault(),e.wrapperRect=e.options.wrapper.getBoundingClientRect()},_tapmove:function(t){var n=e.options,o=e.cache,r=n.element,i=e.wrapperRect,a=0,s=0;if(t){var c=t&&t.touches&&t.touches[0];a=t?(c||t).clientX:0,s=t?(c||t).clientY:0,a<i.left?a=i.left:a>i.left+i.width&&(a=i.left+i.width),s<i.top?s=i.top:s>i.top+i.height&&(s=i.top+i.height),a-=i.left,s-=i.top}else o&&(a=o.x,s=o.y);n.lockX||(r.style.left=a-r.offsetWidth/2+"px"),n.lockY||(r.style.top=s-r.offsetHeight/2+"px"),e.cache={x:a,y:s},n.onchange(a,s)},_tapstop:function(){o.off(document,["mouseup","touchend","touchcancel"],e._tapstop),o.off(document,["mousemove","touchmove"],e._tapmove)},trigger:function(){e.wrapperRect=e.options.wrapper.getBoundingClientRect(),e._tapmove()},update:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;e.wrapperRect=e.options.wrapper.getBoundingClientRect(),e._tapmove(new MouseEvent("mousemove",{clientX:e.wrapperRect.left+t,clientY:e.wrapperRect.top+n}))},destroy:function(){var t=e.options,n=e._tapstart;o.off([t.wrapper,t.element],"mousedown",n),o.off([t.wrapper,t.element],"touchstart",n,{passive:!1})}};e.wrapperRect=e.options.wrapper.getBoundingClientRect();var n=e.options,r=e._tapstart;return o.on([n.wrapper,n.element],"mousedown",r),o.on([n.wrapper,n.element],"touchstart",r,{passive:!1}),e};var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(0))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.HSVaColor=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a=Math.ceil,s={h:e,s:n,v:r,a:i,toHSVA:function(){var t=[s.h,s.s,s.v],e=t.map(a);return t.toString=function(){return"hsva("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+s.a.toFixed(1)+")"},t},toHSLA:function(){var t=o.hsvToHsl(s.h,s.s,s.v),e=t.map(a);return t.toString=function(){return"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+s.a.toFixed(1)+")"},t},toRGBA:function(){var t=o.hsvToRgb(s.h,s.s,s.v),e=t.map(a);return t.toString=function(){return"rgba("+e[0]+", "+e[1]+", "+e[2]+", "+s.a.toFixed(1)+")"},t},toCMYK:function(){var t=o.hsvToCmyk(s.h,s.s,s.v),e=t.map(a);return t.toString=function(){return"cmyk("+e[0]+"%, "+e[1]+"%, "+e[2]+"%, "+e[3]+"%)"},t},toHEX:function(){var t=o.hsvToHex.apply(o,[s.h,s.s,s.v]);return t.toString=function(){var e=s.a>=1?"":Number((255*s.a).toFixed(0)).toString(16).toUpperCase().padStart(2,"0");return"#"+(t.join("").toUpperCase()+e)},t},clone:function(){return t(s.h,s.s,s.v,s.a)}};return s};var o=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(n(1))},,function(t,e,n){},function(t,e,n){"use strict";var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();n(6);var r=l(n(0)),i=l(n(1)),a=n(4),s=u(n(3)),c=u(n(2));function u(t){return t&&t.__esModule?t:{default:t}}function l(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function p(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var d=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=Object.assign({useAsButton:!1,disabled:!1,comparison:!0,components:{interaction:{}},strings:{},default:"fff",defaultRepresentation:"HEX",position:"middle",adjustableNumbers:!0,showAlways:!1,appendToBody:!1,closeWithKey:"Escape",onChange:function(){return 0},onSave:function(){return 0}},e),this.options.components.interaction||(this.options.components.interaction={}),r.bindClassUnderscoreFunctions(this),this._initializingActive=!0,this._recalc=!0,this._color=new a.HSVaColor,this._lastColor=new a.HSVaColor,this._preBuild(),this._rePositioningPicker(),this._buildComponents(),this._bindEvents(),this.setColor(this.options.default),this._representation=this.options.defaultRepresentation,this.setColorRepresentation(this._representation),this._initializingActive=!1,this._finalBuild()}return o(t,[{key:"_preBuild",value:function(){var t=this.options;"string"==typeof t.el&&(t.el=document.querySelector(t.el)),this._root=function(t){var e=t.components,n=t.strings,o=t.useAsButton,i=function(t){return t?"":'style="display:none" hidden'},a=r.createFromTemplate('\n        <div data-key="root" class="pickr">\n        \n            '+(o?"":'<div data-key="button" class="pcr-button"></div>')+'\n\n            <div data-key="app" class="pcr-app">\n                <div class="pcr-selection">\n                    <div data-con="preview" class="pcr-color-preview" '+i(e.preview)+'>\n                        <div data-key="lastColor" class="pcr-last-color"></div>\n                        <div data-key="currentColor" class="pcr-current-color"></div>\n                    </div>\n\n                    <div data-con="palette" class="pcr-color-palette">\n                        <div data-key="picker" class="pcr-picker"></div>\n                        <div data-key="palette" class="pcr-palette"></div>\n                    </div>\n\n                    <div data-con="hue" class="pcr-color-chooser" '+i(e.hue)+'>\n                        <div data-key="picker" class="pcr-picker"></div>\n                        <div data-key="slider" class="pcr-hue pcr-slider"></div>\n                    </div>\n\n                    <div data-con="opacity" class="pcr-color-opacity" '+i(e.opacity)+'>\n                        <div data-key="picker" class="pcr-picker"></div>\n                        <div data-key="slider" class="pcr-opacity pcr-slider"></div>\n                    </div>\n                </div>\n\n                <div data-con="interaction" class="pcr-interaction" '+i(e.interaction)+'>\n                    <input data-key="result" class="pcr-result" type="text" spellcheck="false" '+i(e.interaction.input)+'>\n\n                    <input data-arr="options" class="pcr-type" data-type="HEX" value="HEX" type="button" '+i(e.interaction.hex)+'>\n                    <input data-arr="options" class="pcr-type" data-type="RGBA" value="RGBa" type="button" '+i(e.interaction.rgba)+'>\n                    <input data-arr="options" class="pcr-type" data-type="HSLA" value="HSLa" type="button" '+i(e.interaction.hsla)+'>\n                    <input data-arr="options" class="pcr-type" data-type="HSVA" value="HSVa" type="button" '+i(e.interaction.hsva)+'>\n                    <input data-arr="options" class="pcr-type" data-type="CMYK" value="CMYK" type="button" '+i(e.interaction.cmyk)+'>\n\n                    <input data-key="save" class="pcr-save" value="'+(n.save||"Save")+'" type="button" '+i(e.interaction.save)+'>\n                    <input data-key="clear" class="pcr-clear" value="'+(n.clear||"Clear")+'" type="button" '+i(e.interaction.clear)+">\n                </div>\n            </div>\n        </div>\n    "),s=a.interaction;return s.options.find(function(t){return!t.hidden&&!t.classList.add("active")}),s.type=function(){return s.options.find(function(t){return t.classList.contains("active")})},a}(t),t.useAsButton&&(t.appendToBody=!0,this._root.button=t.el),document.body.appendChild(this._root.root)}},{key:"_finalBuild",value:function(){var t=this.options,e=this._root;document.body.removeChild(e.root),t.appendToBody&&document.body.appendChild(e.app),t.useAsButton||t.el.parentElement.replaceChild(e.root,t.el),t.disabled&&this.disable(),t.comparison||(e.button.style.transition="none",t.useAsButton||(e.preview.lastColor.style.transition="none")),t.showAlways?e.app.classList.add("visible"):this.hide()}},{key:"_buildComponents",value:function(){var t=this,e=this.options.components,n={palette:(0,s.default)({element:t._root.palette.picker,wrapper:t._root.palette.palette,onchange:function(e,n){var o=t._color,r=t._root,i=t.options;o.s=e/this.wrapper.offsetWidth*100,o.v=100-n/this.wrapper.offsetHeight*100;var a=o.toRGBA().toString();this.element.style.background=a,this.wrapper.style.background="\n                        linear-gradient(to top, rgba(0, 0, 0, "+o.a+"), transparent), \n                        linear-gradient(to left, hsla("+o.h+", 100%, 50%, "+o.a+"), rgba(255, 255, 255, "+o.a+"))\n                    ",i.comparison||(r.button.style.background=a,i.useAsButton||(r.preview.lastColor.style.background=a)),r.preview.currentColor.style.background=a,t._recalc&&t._updateOutput(),r.button.classList.remove("clear")}}),hue:(0,s.default)({lockX:!0,element:t._root.hue.picker,wrapper:t._root.hue.slider,onchange:function(o,r){e.hue&&(t._color.h=r/this.wrapper.offsetHeight*360,this.element.style.backgroundColor="hsl("+t._color.h+", 100%, 50%)",n.palette.trigger())}}),opacity:(0,s.default)({lockX:!0,element:t._root.opacity.picker,wrapper:t._root.opacity.slider,onchange:function(n,o){e.opacity&&(t._color.a=Math.round(o/this.wrapper.offsetHeight*100)/100,this.element.style.background="rgba(0, 0, 0, "+t._color.a+")",t.components.palette.trigger())}}),selectable:(0,c.default)({elements:t._root.interaction.options,className:"active",onchange:function(e){t._representation=e.target.getAttribute("data-type").toUpperCase(),t._updateOutput()}})};this.components=n}},{key:"_bindEvents",value:function(){var t=this,e=this._root,n=this.options,o=[r.on(e.interaction.clear,"click",function(){n.useAsButton||(e.button.style.background="rgba(255, 255, 255, 0.4)"),e.button.classList.add("clear"),n.showAlways||t.hide(),n.onSave(null,t)}),r.on(e.preview.lastColor,"click",function(){return t.setHSVA.apply(t,p(t._lastColor.toHSVA()))}),r.on(e.interaction.save,"click",function(){!t._saveColor()&&!n.showAlways&&t.hide()}),r.on(e.interaction.result,"input",function(e){t._recalc=!1,t.setColor(e.target.value,!0)}),r.on([e.palette.palette,e.palette.picker,e.hue.slider,e.hue.picker,e.opacity.slider,e.opacity.picker],"mousedown",function(){return t._recalc=!0}),r.on(window,"resize",this._rePositioningPicker)];if(!n.showAlways){o.push(r.on(e.button,"click",function(){return t.isOpen()?t.hide():t.show()}));var i=n.closeWithKey;o.push(r.on(document,"keyup",function(e){return t.isOpen()&&(e.key===i||e.code===i)&&t.hide()})),o.push(r.on(document,"mousedown",function(n){r.eventPath(n).includes(e.app)||r.once(document,"mouseup",function(){return t.hide()})}))}n.adjustableNumbers&&r.adjustableInputNumbers(e.interaction.result,!1),this._eventBindings=o}},{key:"_rePositioningPicker",value:function(){var t=this._root,e=this._root.app;if(this.options.appendToBody){var n=t.button.getBoundingClientRect();e.style.position="fixed",e.style.marginLeft=n.left+"px",e.style.marginTop=n.top+"px"}var o=t.button.getBoundingClientRect(),r=e.getBoundingClientRect(),i=e.style;function a(t){switch(t){case"left":return-r.width+o.width;case"middle":return-r.width/2+o.width/2;case"right":return 0}}r.bottom>window.innerHeight?i.top=-r.height-5+"px":o.bottom+r.height<window.innerHeight&&(i.top=o.height+5+"px");var s=parseInt(getComputedStyle(e).left,10),c=a(this.options.position);r.left-s+c<0?c=a("right"):r.left-s-c>window.innerWidth&&(c=a("left")),i.left=c+"px"}},{key:"_updateOutput",value:function(){var t=this;this._root.interaction.type()&&(this._root.interaction.result.value=function(){var e="to"+t._root.interaction.type().getAttribute("data-type");return"function"==typeof t._color[e]?t._color[e]().toString():""}()),this._initializingActive||this.options.onChange(this._color,this)}},{key:"_saveColor",value:function(){var t=this._root,e=t.preview,n=t.button,o=this._color.toRGBA().toString();e.lastColor.style.background=o,this.options.useAsButton||(n.style.background=o),n.classList.remove("clear"),this._lastColor=this._color.clone(),this._initializingActive||this.options.onSave(this._color,this)}},{key:"destroy",value:function(){var t=this;this._eventBindings.forEach(function(t){return r.off.apply(r,p(t))}),Object.keys(this.components).forEach(function(e){return t.components[e].destroy()})}},{key:"destroyAndRemove",value:function(){this.destroy();var t=this._root.root;t.parentElement.removeChild(t)}},{key:"hide",value:function(){return this._root.app.classList.remove("visible"),this}},{key:"show",value:function(){if(!this.options.disabled)return this._root.app.classList.add("visible"),this._rePositioningPicker(),this}},{key:"isOpen",value:function(){return this._root.app.classList.contains("visible")}},{key:"setHSVA",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:360,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=this._recalc;if(this._recalc=!1,t<0||t>360||e<0||e>100||n<0||n>100||o<0||o>1)return!1;var s=this.components,c=s.hue,u=s.opacity,l=s.palette,p=c.options.wrapper.offsetHeight*(t/360);c.update(0,p);var d=u.options.wrapper.offsetHeight*o;u.update(0,d);var f=l.options.wrapper,h=f.offsetWidth*(e/100),v=f.offsetHeight*(1-n/100);return l.update(h,v),this._color=new a.HSVaColor(t,e,n,o),this._recalc=i,this._recalc&&this._updateOutput(),r||this._saveColor(),!0}},{key:"setColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=i.parseToHSV(t);if(n)return this.setHSVA.apply(this,p(n).concat([e]))}},{key:"setColorRepresentation",value:function(t){return t=t.toUpperCase(),!!this._root.interaction.options.find(function(e){return e.getAttribute("data-type")===t&&!e.click()})}},{key:"getColorRepresentation",value:function(){return this._representation}},{key:"getColor",value:function(){return this._color}},{key:"getRoot",value:function(){return this._root}},{key:"disable",value:function(){return this.hide(),this.options.disabled=!0,this._root.button.classList.add("disabled"),this}},{key:"enable",value:function(){return this.options.disabled=!1,this._root.button.classList.remove("disabled"),this}}]),t}();d.utils={once:r.once,on:r.on,off:r.off,eventPath:r.eventPath,createElementFromString:r.createElementFromString,adjustableInputNumbers:r.adjustableInputNumbers,removeAttribute:r.removeAttribute,createFromTemplate:r.createFromTemplate},d.create=function(t){return new d(t)},d.version="0.2.4",t.exports=d}])});