text: /**
   * Wheel Color Picker 3.0.5
   * (c) 2011-2018 Fajar Chandra. Released under MIT License.
   * https://raffer.one/projects/jquery-wheelcolorpicker
   */
  !function(e){e.fn.wheelColorPicker=function(){var r=this;if(arguments.length>0)var i="string"==typeof(s=[].shift.apply(arguments))?s.charAt(0).toUpperCase()+s.slice(1):s;else{var s=void 0;i=void 0}var a=arguments;return this.each(function(){var o=e(this).data("jQWCP.instance");if(null==o||null==o){var n={};"object"==typeof s&&(n=s),o=new t.ColorPicker(this,n),e(this).data("jQWCP.instance",o)}if(void 0===s||"object"==typeof s);else if("function"==typeof o[s]){if((l=o[s].apply(o,a))!==o)return r=l,!1}else if("function"==typeof o["set"+i]&&a.length>0){if((l=o["set"+i].apply(o,a))!==o)return r=l,!1}else if("function"==typeof o["get"+i]){var l;if((l=o["get"+i].apply(o,a))!==o)return r=l,!1}else if(void 0!==o.options[s]&&a.length>0)o.options[s]=a[0];else{if(void 0!==o.options[s])return r=o.options[s],!1;e.error("Method/option named "+s+" does not exist on jQuery.wheelColorPicker")}}),r};var t=e.fn.wheelColorPicker;t.defaults={format:"hex",preview:!1,live:!0,userinput:!0,validate:!0,autoResize:!0,autoFormat:!0,preserveWheel:null,cssClass:"",layout:"popup",animDuration:200,quality:1,sliders:null,rounding:2,mobile:!0,mobileWidth:480,hideKeyboard:!1,htmlOptions:!0,snap:!1,snapTolerance:.05},t.BUG_RELATIVE_PAGE_ORIGIN=!1,t.ORIGIN={left:0,top:0},t.colorToStr=function(e,t){var r="";switch(t){case"css":r="#";case"hex":1==(i=Math.round(255*e.r).toString(16)).length&&(i="0"+i),1==(s=Math.round(255*e.g).toString(16)).length&&(s="0"+s),1==(a=Math.round(255*e.b).toString(16)).length&&(a="0"+a),r+=i+s+a;break;case"cssa":r="#";case"hexa":var i,s,a;1==(i=Math.round(255*e.r).toString(16)).length&&(i="0"+i),1==(s=Math.round(255*e.g).toString(16)).length&&(s="0"+s),1==(a=Math.round(255*e.b).toString(16)).length&&(a="0"+a);var o=Math.round(255*e.a).toString(16);1==o.length&&(o="0"+o),r+=i+s+a+o;break;case"rgb":r="rgb("+Math.round(255*e.r)+","+Math.round(255*e.g)+","+Math.round(255*e.b)+")";break;case"rgb%":r="rgb("+100*e.r+"%,"+100*e.g+"%,"+100*e.b+"%)";break;case"rgba":r="rgba("+Math.round(255*e.r)+","+Math.round(255*e.g)+","+Math.round(255*e.b)+","+e.a+")";break;case"rgba%":r="rgba("+100*e.r+"%,"+100*e.g+"%,"+100*e.b+"%,"+100*e.a+"%)";break;case"hsv":r="hsv("+360*e.h+","+e.s+","+e.v+")";break;case"hsv%":r="hsv("+100*e.h+"%,"+100*e.s+"%,"+100*e.v+"%)";break;case"hsva":r="hsva("+360*e.h+","+e.s+","+e.v+","+e.a+")";break;case"hsva%":r="hsva("+100*e.h+"%,"+100*e.s+"%,"+100*e.v+"%,"+100*e.a+"%)";break;case"hsb":r="hsb("+e.h+","+e.s+","+e.v+")";break;case"hsb%":r="hsb("+100*e.h+"%,"+100*e.s+"%,"+100*e.v+"%)";break;case"hsba":r="hsba("+e.h+","+e.s+","+e.v+","+e.a+")";break;case"hsba%":r="hsba("+100*e.h+"%,"+100*e.s+"%,"+100*e.v+"%,"+100*e.a+"%)"}return r},t.strToColor=function(e){var t,r,i={a:1};if(null!=e.match(/^#[0-9a-f]{3}$/i)||e.match(/^#[0-9a-f]{4}$/i)){if(isNaN(i.r=17*parseInt(e.substr(1,1),16)/255))return!1;if(isNaN(i.g=17*parseInt(e.substr(2,1),16)/255))return!1;if(isNaN(i.b=17*parseInt(e.substr(3,1),16)/255))return!1;if(5==e.length&&isNaN(i.a=17*parseInt(e.substr(4,1),16)/255))return!1}else if(null!=e.match(/^[0-9a-f]{3}$/i)||null!=e.match(/^[0-9a-f]{4}$/i)){if(isNaN(i.r=17*parseInt(e.substr(0,1),16)/255))return!1;if(isNaN(i.g=17*parseInt(e.substr(1,1),16)/255))return!1;if(isNaN(i.b=17*parseInt(e.substr(2,1),16)/255))return!1;if(4==e.length&&isNaN(i.a=17*parseInt(e.substr(3,1),16)/255))return!1}else if(null!=e.match(/^#[0-9a-f]{6}$/i)||null!=e.match(/^#[0-9a-f]{8}$/i)){if(isNaN(i.r=parseInt(e.substr(1,2),16)/255))return!1;if(isNaN(i.g=parseInt(e.substr(3,2),16)/255))return!1;if(isNaN(i.b=parseInt(e.substr(5,2),16)/255))return!1;if(9==e.length&&isNaN(i.a=parseInt(e.substr(7,2),16)/255))return!1}else if(null!=e.match(/^[0-9a-f]{6}$/i)||null!=e.match(/^[0-9a-f]{8}$/i)){if(isNaN(i.r=parseInt(e.substr(0,2),16)/255))return!1;if(isNaN(i.g=parseInt(e.substr(2,2),16)/255))return!1;if(isNaN(i.b=parseInt(e.substr(4,2),16)/255))return!1;if(8==e.length&&isNaN(i.a=parseInt(e.substr(6,2),16)/255))return!1}else if(null!=e.match(/^rgba\s*\(\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*\)$/i)||null!=e.match(/^rgb\s*\(\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*\)$/i)){if(r=null!=e.match(/a/i),"%"==(t=e.substring(e.indexOf("(")+1,e.indexOf(","))).charAt(t.length-1)){if(isNaN(i.r=parseFloat(t)/100))return!1}else if(isNaN(i.r=parseInt(t)/255))return!1;if("%"==(t=e.substring(e.indexOf(",")+1,e.indexOf(",",e.indexOf(",")+1))).charAt(t.length-1)){if(isNaN(i.g=parseFloat(t)/100))return!1}else if(isNaN(i.g=parseInt(t)/255))return!1;if("%"==(t=r?e.substring(e.indexOf(",",e.indexOf(",")+1)+1,e.lastIndexOf(",")):e.substring(e.lastIndexOf(",")+1,e.lastIndexOf(")"))).charAt(t.length-1)){if(isNaN(i.b=parseFloat(t)/100))return!1}else if(isNaN(i.b=parseInt(t)/255))return!1;if(r)if("%"==(t=e.substring(e.lastIndexOf(",")+1,e.lastIndexOf(")"))).charAt(t.length-1)){if(isNaN(i.a=parseFloat(t)/100))return!1}else if(isNaN(i.a=parseFloat(t)))return!1}else{if(null==e.match(/^hsva\s*\(\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*\)$/i)&&null==e.match(/^hsv\s*\(\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*\)$/i)&&null==e.match(/^hsba\s*\(\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*\)$/i)&&null==e.match(/^hsb\s*\(\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*,\s*([0-9\.]+%|[01]?\.?[0-9]*)\s*\)$/i))return!1;if(r=null!=e.match(/a/i),"%"==(t=e.substring(e.indexOf("(")+1,e.indexOf(","))).charAt(t.length-1)){if(isNaN(i.h=parseFloat(t)/100))return!1}else if(isNaN(i.h=parseFloat(t)/360))return!1;if("%"==(t=e.substring(e.indexOf(",")+1,e.indexOf(",",e.indexOf(",")+1))).charAt(t.length-1)){if(isNaN(i.s=parseFloat(t)/100))return!1}else if(isNaN(i.s=parseFloat(t)))return!1;if("%"==(t=r?e.substring(e.indexOf(",",e.indexOf(",")+1)+1,e.lastIndexOf(",")):e.substring(e.lastIndexOf(",")+1,e.lastIndexOf(")"))).charAt(t.length-1)){if(isNaN(i.v=parseFloat(t)/100))return!1}else if(isNaN(i.v=parseFloat(t)))return!1;if(r)if("%"==(t=e.substring(e.lastIndexOf(",")+1,e.lastIndexOf(")"))).charAt(t.length-1)){if(isNaN(i.a=parseFloat(t)/100))return!1}else if(isNaN(i.a=parseFloat(t)))return!1}return i},t.hsvToRgb=function(e,t,r){var i=e<=1/6||e>=5/6?1:e<1/3?1-6*(e-1/6):e>4/6?6*(e-4/6):0,s=e>=1/6&&e<=.5?1:e<1/6?6*e:e<4/6?1-6*(e-.5):0,a=e>=.5&&e<=5/6?1:e>2/6&&e<.5?6*(e-2/6):e>5/6?1-6*(e-5/6):0;return{r:(i+(1-i)*(1-t))*r,g:(s+(1-s)*(1-t))*r,b:(a+(1-a)*(1-t))*r}},t.rgbToHsv=function(e,t,r){var i,s=Math.max(e,t,r),a=s-Math.min(e,t,r);return i=0==a?0:e==s?(6+(t-r)/a)%6:t==s?2+(r-e)/a:r==s?4+(e-t)/a:0,{h:i/=6,s:0!=s?a/s:0,v:s}},t.ColorPicker=function(r,i){this.input=r,this.color={h:0,s:0,v:1,r:1,g:1,b:1,a:1},this.setValue(this.input.value),this.options=e.extend(!0,{},t.defaults),this.setOptions(i),null==this.options.sliders&&(this.options.sliders="wvp"+(this.options.format.indexOf("a")>=0?"a":"")),this.init()},t.ColorPicker.widget=null,t.ColorPicker.overlay=null,t.ColorPicker.init=function(){if(1!=t.ColorPicker.init.hasInit){t.ColorPicker.init.hasInit=!0;var r=e('<div class="jQWCP-overlay" style="display: none;"></div>');r.on("click",t.Handler.overlay_click),t.ColorPicker.overlay=r.get(0),e("body").append(r);var i=t.ColorPicker.getWheelDataUrl(200);e("head").append('<style type="text/css">.jQWCP-wWheel {background-image: url('+i+");}</style>"),e("html").on("mouseup.wheelColorPicker",t.Handler.html_mouseup),e("html").on("touchend.wheelColorPicker",t.Handler.html_mouseup),e("html").on("mousemove.wheelColorPicker",t.Handler.html_mousemove),e("html").on("touchmove.wheelColorPicker",t.Handler.html_mousemove),e(window).on("resize.wheelColorPicker",t.Handler.window_resize)}},t.ColorPicker.createWidget=function(){var r=e("<div class='jQWCP-wWidget'><div class='jQWCP-wWheel'><div class='jQWCP-wWheelOverlay'></div><span class='jQWCP-wWheelCursor'></span></div><div class='jQWCP-wHue jQWCP-slider-wrapper'><canvas class='jQWCP-wHueSlider jQWCP-slider' width='1' height='50' title='Hue'></canvas><span class='jQWCP-wHueCursor jQWCP-scursor'></span></div><div class='jQWCP-wSat jQWCP-slider-wrapper'><canvas class='jQWCP-wSatSlider jQWCP-slider' width='1' height='50' title='Saturation'></canvas><span class='jQWCP-wSatCursor jQWCP-scursor'></span></div><div class='jQWCP-wVal jQWCP-slider-wrapper'><canvas class='jQWCP-wValSlider jQWCP-slider' width='1' height='50' title='Value'></canvas><span class='jQWCP-wValCursor jQWCP-scursor'></span></div><div class='jQWCP-wRed jQWCP-slider-wrapper'><canvas class='jQWCP-wRedSlider jQWCP-slider' width='1' height='50' title='Red'></canvas><span class='jQWCP-wRedCursor jQWCP-scursor'></span></div><div class='jQWCP-wGreen jQWCP-slider-wrapper'><canvas class='jQWCP-wGreenSlider jQWCP-slider' width='1' height='50' title='Green'></canvas><span class='jQWCP-wGreenCursor jQWCP-scursor'></span></div><div class='jQWCP-wBlue jQWCP-slider-wrapper'><canvas class='jQWCP-wBlueSlider jQWCP-slider' width='1' height='50' title='Blue'></canvas><span class='jQWCP-wBlueCursor jQWCP-scursor'></span></div><div class='jQWCP-wAlpha jQWCP-slider-wrapper'><canvas class='jQWCP-wAlphaSlider jQWCP-slider' width='1' height='50' title='Alpha'></canvas><span class='jQWCP-wAlphaCursor jQWCP-scursor'></span></div><div class='jQWCP-wPreview'><canvas class='jQWCP-wPreviewBox' width='1' height='1' title='Selected Color'></canvas></div></div>");return r.find(".jQWCP-wWheel, .jQWCP-slider-wrapper, .jQWCP-scursor, .jQWCP-slider").attr("unselectable","on").css("-moz-user-select","none").css("-webkit-user-select","none").css("user-select","none").css("-webkit-touch-callout","none"),r.on("contextmenu.wheelColorPicker",function(){return!1}),r.on("mousedown.wheelColorPicker",".jQWCP-wWheel",t.Handler.wheel_mousedown),r.on("touchstart.wheelColorPicker",".jQWCP-wWheel",t.Handler.wheel_mousedown),r.on("mousedown.wheelColorPicker",".jQWCP-wWheelCursor",t.Handler.wheelCursor_mousedown),r.on("touchstart.wheelColorPicker",".jQWCP-wWheelCursor",t.Handler.wheelCursor_mousedown),r.on("mousedown.wheelColorPicker",".jQWCP-slider",t.Handler.slider_mousedown),r.on("touchstart.wheelColorPicker",".jQWCP-slider",t.Handler.slider_mousedown),r.on("mousedown.wheelColorPicker",".jQWCP-scursor",t.Handler.sliderCursor_mousedown),r.on("touchstart.wheelColorPicker",".jQWCP-scursor",t.Handler.sliderCursor_mousedown),r.get(0)},t.ColorPicker.getWheelDataUrl=function(e){var t=e/2,r=t,i=document.createElement("canvas");i.width=e,i.height=e;for(var s=i.getContext("2d"),a=0;a<e;a++)for(var o=0;o<e;o++){var n=Math.sqrt(Math.pow(o-r,2)+Math.pow(a-r,2));if(!(n>t+2)){var l=((o-r==0?a<r?90:270:Math.atan((r-a)/(o-r))/Math.PI*180)+(o<r?180:0)+360)%360,d=n/t,h=(Math.abs(l+360)+60)%360<120?1:l>240?(120-Math.abs(l-360))/60:l<120?(120-l)/60:0,u=Math.abs(l-120)<60?1:Math.abs(l-120)<120?(120-Math.abs(l-120))/60:0,c=Math.abs(l-240)<60?1:Math.abs(l-240)<120?(120-Math.abs(l-240))/60:0,p=Math.round(255*(h+(1-h)*(1-d))),C=Math.round(255*(u+(1-u)*(1-d))),f=Math.round(255*(c+(1-c)*(1-d)));s.fillStyle="rgb("+p+","+C+","+f+")",s.fillRect(o,a,1,1)}}return i.toDataURL()},t.ColorPicker.prototype.options=null,t.ColorPicker.prototype.input=null,t.ColorPicker.prototype.widget=null,t.ColorPicker.prototype.color=null,t.ColorPicker.prototype.lastValue=null,t.ColorPicker.prototype.setOptions=function(r){if(r=e.extend(!0,{},r),this.options.htmlOptions)for(var i in t.defaults)this.input.hasAttribute("data-wcp-"+i)&&void 0===r[i]&&(r[i]=this.input.getAttribute("data-wcp-"+i),"true"==r[i]?r[i]=!0:"false"==r[i]&&(r[i]=!1));for(var i in r)if(void 0!==this.options[i]){var s=i.charAt(0).toUpperCase()+i.slice(1);"function"==typeof this["set"+s]?this["set"+s](r[i]):this.options[i]=r[i]}return this},t.ColorPicker.prototype.init=function(){if(t.ColorPicker.init(),1!=this.hasInit){this.hasInit=!0;var r=e(this.input),i=null;"block"==this.options.layout?(this.widget=t.ColorPicker.createWidget(),(i=e(this.widget)).data("jQWCP.instance",this),i.insertAfter(this.input),"inline"==r.css("display")?i.css("display","inline-block"):i.css("display",r.css("display")),i.append(this.input),r.hide(),null!=r.attr("tabindex")?i.attr("tabindex",r.attr("tabindex")):i.attr("tabindex",0),this.refreshWidget(),this.redrawSliders(!0),this.updateSliders(),i.on("focus.wheelColorPicker",t.Handler.widget_focus_block),i.on("blur.wheelColorPicker",t.Handler.widget_blur_block)):(null==t.ColorPicker.widget&&(t.ColorPicker.widget=t.ColorPicker.createWidget(),(i=e(t.ColorPicker.widget)).hide(),e("body").append(i),i.on("mousedown.wheelColorPicker",t.Handler.widget_mousedown_popup)),this.widget=t.ColorPicker.widget,r.on("focus.wheelColorPicker",t.Handler.input_focus_popup),r.on("blur.wheelColorPicker",t.Handler.input_blur_popup)),r.on("keyup.wheelColorPicker",t.Handler.input_keyup),r.on("change.wheelColorPicker",t.Handler.input_change),"object"==typeof this.options.color?(this.setColor(this.options.color),this.options.color=void 0):"string"==typeof this.options.color&&(this.setValue(this.options.color),this.options.color=void 0),this.options.userinput?r.removeAttr("readonly"):r.attr("readonly",!0)}},t.ColorPicker.prototype.destroy=function(){var t=e(this.widget),r=e(this.input);if("block"==this.options.layout){var i=e(e("body").data("jQWCP.activeControl"));if(i.length){var s=i.closest(".jQWCP-wWidget");t.is(s)&&e("body").data("jQWCP.activeControl",null)}t.before(this.input),t.remove(),r.show()}r.off("focus.wheelColorPicker"),r.off("blur.wheelColorPicker"),r.off("keyup.wheelColorPicker"),r.off("change.wheelColorPicker"),r.data("jQWCP.instance",null)},t.ColorPicker.prototype.refreshWidget=function(){var t=e(this.widget),r=this.options,i=!1;for(var s in t.attr("class","jQWCP-wWidget"),"block"==r.layout&&t.addClass("jQWCP-block"),t.addClass(r.cssClass),window.innerWidth<=r.mobileWidth&&"block"!=r.layout&&r.mobile&&(i=!0,t.addClass("jQWCP-mobile")),t.find(".jQWCP-wWheel, .jQWCP-slider-wrapper, .jQWCP-wPreview").hide().addClass("hidden"),r.sliders){var a=null;switch(this.options.sliders[s]){case"w":a=t.find(".jQWCP-wWheel");break;case"h":a=t.find(".jQWCP-wHue");break;case"s":a=t.find(".jQWCP-wSat");break;case"v":a=t.find(".jQWCP-wVal");break;case"r":a=t.find(".jQWCP-wRed");break;case"g":a=t.find(".jQWCP-wGreen");break;case"b":a=t.find(".jQWCP-wBlue");break;case"a":a=t.find(".jQWCP-wAlpha");break;case"p":a=t.find(".jQWCP-wPreview")}null!=a&&(a.appendTo(this.widget),a.show().removeClass("hidden"))}var o=50*r.quality;t.find(".jQWCP-slider").attr("height",o);var n=t.find(".jQWCP-wWheel, .jQWCP-slider-wrapper, .jQWCP-wPreview").not(".hidden");if(r.autoResize&&!i){var l=0;n.css({width:"",height:""}),n.each(function(t,r){var i=e(r);l+=parseFloat(i.css("margin-left").replace("px",""))+parseFloat(i.css("margin-right").replace("px",""))+i.outerWidth()}),t.css({width:l+"px"})}else{t.css({width:""});var d=t.find(".jQWCP-wWheel").not(".hidden"),h=t.find(".jQWCP-slider-wrapper, .jQWCP-wPreview").not(".hidden");if(d.css({height:t.height()+"px",width:t.height()}),d.length>0)var u=t.width()-d.outerWidth()-parseFloat(d.css("margin-left").replace("px",""))-parseFloat(d.css("margin-right").replace("px",""));else u=t.width();if(h.length>0){var c=parseFloat(h.css("margin-left").replace("px",""))+parseFloat(h.css("margin-right").replace("px",""));h.css({height:t.height()+"px",width:(u-(h.length-1)*c)/h.length+"px"})}}return this},t.ColorPicker.prototype.redrawSliders=function(t){if(null==this.widget)return this;var r=e(this.widget);if("string"==typeof arguments[0]&&(t=arguments[1]),this!=r.data("jQWCP.instance"))return this;var i=this.options,s=this.color,a=50*i.quality,o=1,n=0,l=0,d=0,h=0,u=0,c=1;i.live&&(o=s.a,n=Math.round(255*s.r),l=Math.round(255*s.g),d=Math.round(255*s.b),h=s.h,u=s.s,c=s.v);var p=r.find(".jQWCP-wPreviewBox");if(!p.hasClass("hidden")){var C=p.get(0).getContext("2d");C.fillStyle="rgba("+n+","+l+","+d+","+o+")",C.clearRect(0,0,1,1),C.fillRect(0,0,1,1)}if(!this.options.live&&!t)return this;var f=r.find(".jQWCP-wAlphaSlider");if(!f.hasClass("hidden")||t){var g=f.get(0).getContext("2d"),v=g.createLinearGradient(0,0,0,a);v.addColorStop(0,"rgba("+n+","+l+","+d+",1)"),v.addColorStop(1,"rgba("+n+","+l+","+d+",0)"),g.fillStyle=v,g.clearRect(0,0,1,a),g.fillRect(0,0,1,a)}var w=r.find(".jQWCP-wRedSlider");if(!w.hasClass("hidden")||t){var P=w.get(0).getContext("2d"),W=P.createLinearGradient(0,0,0,a);W.addColorStop(0,"rgb(255,"+l+","+d+")"),W.addColorStop(1,"rgb(0,"+l+","+d+")"),P.fillStyle=W,P.fillRect(0,0,1,a)}var b=r.find(".jQWCP-wGreenSlider");if(!b.hasClass("hidden")||t){var j=b.get(0).getContext("2d"),Q=j.createLinearGradient(0,0,0,a);Q.addColorStop(0,"rgb("+n+",255,"+d+")"),Q.addColorStop(1,"rgb("+n+",0,"+d+")"),j.fillStyle=Q,j.fillRect(0,0,1,a)}var k=r.find(".jQWCP-wBlueSlider");if(!k.hasClass("hidden")||t){var y=k.get(0).getContext("2d"),m=y.createLinearGradient(0,0,0,a);m.addColorStop(0,"rgb("+n+","+l+",255)"),m.addColorStop(1,"rgb("+n+","+l+",0)"),y.fillStyle=m,y.fillRect(0,0,1,a)}var S=r.find(".jQWCP-wHueSlider");if(!S.hasClass("hidden")||t){var N=S.get(0).getContext("2d"),I=N.createLinearGradient(0,0,0,a);I.addColorStop(0,"#f00"),I.addColorStop(.166666667,"#ff0"),I.addColorStop(.333333333,"#0f0"),I.addColorStop(.5,"#0ff"),I.addColorStop(.666666667,"#00f"),I.addColorStop(.833333333,"#f0f"),I.addColorStop(1,"#f00"),N.fillStyle=I,N.fillRect(0,0,1,a)}var x=r.find(".jQWCP-wSatSlider");if(!x.hasClass("hidden")||t){var H=e.fn.wheelColorPicker.hsvToRgb(h,1,c);H.r=Math.round(255*H.r),H.g=Math.round(255*H.g),H.b=Math.round(255*H.b);var _=x.get(0).getContext("2d"),R=_.createLinearGradient(0,0,0,a);R.addColorStop(0,"rgb("+H.r+","+H.g+","+H.b+")"),R.addColorStop(1,"rgb("+Math.round(255*c)+","+Math.round(255*c)+","+Math.round(255*c)+")"),_.fillStyle=R,_.fillRect(0,0,1,a)}var M=r.find(".jQWCP-wValSlider");if(!M.hasClass("hidden")||t){var O=e.fn.wheelColorPicker.hsvToRgb(h,u,1);O.r=Math.round(255*O.r),O.g=Math.round(255*O.g),O.b=Math.round(255*O.b);var A=M.get(0).getContext("2d"),G=A.createLinearGradient(0,0,0,a);G.addColorStop(0,"rgb("+O.r+","+O.g+","+O.b+")"),G.addColorStop(1,"#000"),A.fillStyle=G,A.fillRect(0,0,1,a)}return this},t.ColorPicker.prototype.updateSliders=function(){if(null==this.widget)return this;var t=e(this.widget),r=this.color;if(this!=t.data("jQWCP.instance"))return this;var i=t.find(".jQWCP-wWheel");if(!i.hasClass("hidden")){var s=t.find(".jQWCP-wWheelCursor"),a=t.find(".jQWCP-wWheelOverlay"),o=Math.cos(2*Math.PI*r.h)*r.s,n=Math.sin(2*Math.PI*r.h)*r.s,l=i.width()/2,d=i.height()/2;s.css("left",l+o*i.width()/2+"px"),s.css("top",d-n*i.height()/2+"px"),1==this.options.preserveWheel||null==this.options.preserveWheel&&0==this.options.live?a.css("opacity",0):a.css("opacity",1-(r.v<.2?.2:r.v))}var h=t.find(".jQWCP-wHueSlider");h.hasClass("hidden")||t.find(".jQWCP-wHueCursor").css("top",r.h*h.height()+"px");var u=t.find(".jQWCP-wSatSlider");u.hasClass("hidden")||t.find(".jQWCP-wSatCursor").css("top",(1-r.s)*u.height()+"px");var c=t.find(".jQWCP-wValSlider");c.hasClass("hidden")||t.find(".jQWCP-wValCursor").css("top",(1-r.v)*c.height()+"px");var p=t.find(".jQWCP-wRedSlider");p.hasClass("hidden")||t.find(".jQWCP-wRedCursor").css("top",(1-r.r)*p.height()+"px");var C=t.find(".jQWCP-wGreenSlider");C.hasClass("hidden")||t.find(".jQWCP-wGreenCursor").css("top",(1-r.g)*C.height()+"px");var f=t.find(".jQWCP-wBlueSlider");f.hasClass("hidden")||t.find(".jQWCP-wBlueCursor").css("top",(1-r.b)*f.height()+"px");var g=t.find(".jQWCP-wAlphaSlider");g.hasClass("hidden")||t.find(".jQWCP-wAlphaCursor").css("top",(1-r.a)*g.height()+"px");return this},t.ColorPicker.prototype.updateSelection=function(){return this.redrawSliders(),this.updateSliders(),this},t.ColorPicker.prototype.updateInput=function(){if(null==this.widget)return this;var r=e(this.input);this.input.value!=this.getValue()&&(this.input.value=this.getValue()),this.options.preview&&(r.css("background",t.colorToStr(this.color,"rgba")),this.color.v>.5?r.css("color","black"):r.css("color","white"))},t.ColorPicker.prototype.updateActiveControl=function(r){var i=e(e("body").data("jQWCP.activeControl"));if(0!=i.length){e(this.input);var s=this.options,a=this.color;if(null==r.pageX&&r.originalEvent.touches.length>0&&(r.pageX=r.originalEvent.touches[0].pageX,r.pageY=r.originalEvent.touches[0].pageY),i.hasClass("jQWCP-wWheel")){var o=i.find(".jQWCP-wWheelCursor"),n=(i.find(".jQWCP-wWheelOverlay"),(r.pageX-i.offset().left-i.width()/2)/(i.width()/2)),l=-(r.pageY-i.offset().top-i.height()/2)/(i.height()/2);if(t.BUG_RELATIVE_PAGE_ORIGIN)n=(r.pageX-(i.get(0).getBoundingClientRect().left-t.ORIGIN.left)-i.width()/2)/(i.width()/2),l=-(r.pageY-(i.get(0).getBoundingClientRect().top-t.ORIGIN.top)-i.height()/2)/(i.height()/2);var d=Math.sqrt(Math.pow(n,2)+Math.pow(l,2));d>1&&(d=1),s.snap&&d<s.snapTolerance&&(d=0);var h=0==n&&0==l?0:Math.atan(l/n)/(2*Math.PI);h<0&&(h+=.5),l<0&&(h+=.5),this.setHsv(h,d,a.v)}else if(i.hasClass("jQWCP-slider-wrapper")){o=i.find(".jQWCP-scursor"),l=(r.pageY-i.offset().top)/i.height();if(t.BUG_RELATIVE_PAGE_ORIGIN)l=(r.pageY-(i.get(0).getBoundingClientRect().top-t.ORIGIN.top))/i.height();var u=l<0?0:l>1?1:l;s.snap&&u<s.snapTolerance?u=0:s.snap&&u>1-s.snapTolerance&&(u=1),s.snap&&u>.5-s.snapTolerance&&u<.5+s.snapTolerance&&(u=.5),o.css("top",u*i.height()+"px"),i.hasClass("jQWCP-wRed")&&this.setRgb(1-u,a.g,a.b),i.hasClass("jQWCP-wGreen")&&this.setRgb(a.r,1-u,a.b),i.hasClass("jQWCP-wBlue")&&this.setRgb(a.r,a.g,1-u),i.hasClass("jQWCP-wHue")&&this.setHsv(u,a.s,a.v),i.hasClass("jQWCP-wSat")&&this.setHsv(a.h,1-u,a.v),i.hasClass("jQWCP-wVal")&&this.setHsv(a.h,a.s,1-u),i.hasClass("jQWCP-wAlpha")&&this.setAlpha(1-u)}}},t.ColorPicker.prototype.getColor=function(){return this.color},t.ColorPicker.prototype.getValue=function(e){var r=this.options;return null==e&&(e=r.format),r.rounding>=0&&(this.color.a=Math.round(this.color.a*Math.pow(10,r.rounding))/Math.pow(10,r.rounding)),t.colorToStr(this.color,e)},t.ColorPicker.prototype.setValue=function(e,r){var i=t.strToColor(e);return i?this.setColor(i,r):this},t.ColorPicker.prototype.setColor=function(e,t){return"string"==typeof e?this.setValue(e,t):null!=e.r?this.setRgba(e.r,e.g,e.b,e.a,t):null!=e.h?this.setHsva(e.h,e.s,e.v,e.a,t):null!=e.a?this.setAlpha(e.a,t):this},t.ColorPicker.prototype.setRgba=function(e,r,i,s,a){void 0===a&&(a=!0);var o=this.color;o.r=e,o.g=r,o.b=i,null!=s&&(o.a=s);var n=t.rgbToHsv(e,r,i);return o.h=n.h,o.s=n.s,o.v=n.v,this.updateSliders(),this.redrawSliders(),a&&this.updateInput(),this},t.ColorPicker.prototype.setRgb=function(e,t,r,i){return this.setRgba(e,t,r,null,i)},t.ColorPicker.prototype.setHsva=function(e,r,i,s,a){void 0===a&&(a=!0);var o=this.color;o.h=e,o.s=r,o.v=i,null!=s&&(o.a=s);var n=t.hsvToRgb(e,r,i);return o.r=n.r,o.g=n.g,o.b=n.b,this.updateSliders(),this.redrawSliders(),a&&this.updateInput(),this},t.ColorPicker.prototype.setHsv=function(e,t,r,i){return this.setHsva(e,t,r,null,i)},t.ColorPicker.prototype.setAlpha=function(e,t){return void 0===t&&(t=!0),this.color.a=e,this.updateSliders(),this.redrawSliders(),t&&this.updateInput(),this},t.ColorPicker.prototype.show=function(){var r=this.input,i=e(r),s=e(this.widget),a=this.options;if("popup"==a.layout&&(s.data("jQWCP.instance",this),s.stop(!0,!0),s.css({top:r.getBoundingClientRect().top-t.ORIGIN.top+i.outerHeight()+"px",left:r.getBoundingClientRect().left-t.ORIGIN.left+"px"}),this.refreshWidget(),this.redrawSliders(),this.updateSliders(),this.lastValue=r.value,s.fadeIn(a.animDuration),a.hideKeyboard&&(i.blur(),e(t.ColorPicker.overlay).show()),s.hasClass("jQWCP-mobile"))){var o=e("html").scrollTop(),n=r.getBoundingClientRect().top-t.ORIGIN.top;n<o?e("html").animate({scrollTop:n}):n+i.outerHeight()>o+window.innerHeight-s.outerHeight()&&e("html").animate({scrollTop:n+i.outerHeight()-window.innerHeight+s.outerHeight()})}},t.ColorPicker.prototype.hide=function(){var r=e(this.widget);this==r.data("jQWCP.instance")&&(r.fadeOut(this.options.animDuration),e(t.ColorPicker.overlay).hide())},t.Handler={},t.Handler.input_focus_popup=function(t){var r=e(this).data("jQWCP.instance");r.show(),null==e(this).attr("readonly")&&(e(this).attr("readonly",!0),setTimeout(function(){e(r.input).removeAttr("readonly")}),null!=navigator.userAgent.match(/Android .* Firefox/)&&setTimeout(function(){e(r.input).attr("readonly",!0),e(r.input).one("blur",function(){e(r.input).removeAttr("readonly")})}))},t.Handler.input_blur_popup=function(t){var r=e(this).data("jQWCP.instance");r.options.hideKeyboard||(r.hide(),r.lastValue!=this.value&&e(this).trigger("change"))},t.Handler.input_keyup=function(r){var i=e(this).data("jQWCP.instance"),s=t.strToColor(this.value);s&&i.setColor(s,!1)},t.Handler.input_change=function(r){var i=e(this).data("jQWCP.instance"),s=t.strToColor(this.value);i.options.autoFormat&&s?i.setColor(s,!0):i.options.validate&&!s&&""!=this.value&&(this.value=i.getValue())},t.Handler.widget_focus_block=function(t){var r=e(this).data("jQWCP.instance"),i=e(r.input);r.lastValue=r.input.value,i.triggerHandler("focus")},t.Handler.widget_mousedown_popup=function(t){var r=e(this).data("jQWCP.instance"),i=e(r.input);if(i.off("focus.wheelColorPicker"),i.off("blur.wheelColorPicker"),null!=i.data("events"))var s=i.data("events").blur;else s=void 0;var a={blur:[]};if(null!=s)for(var o=0;o<s.length;o++)a.blur.push(s[o]);i.data("jQWCP.suspendedEvents",a)},t.Handler.widget_blur_block=function(t){var r=e(this).data("jQWCP.instance"),i=e(r.input);r.lastValue!=r.input.value&&i.trigger("change"),i.triggerHandler("blur")},t.Handler.wheelCursor_mousedown=function(t){var r=e(this),i=r.closest(".jQWCP-wWidget").data("jQWCP.instance"),s=e(i.input);e("body").data("jQWCP.activeControl",r.parent().get(0)),s.trigger("sliderdown")},t.Handler.wheel_mousedown=function(t){var r=e(this),i=r.closest(".jQWCP-wWidget").data("jQWCP.instance"),s=e(i.input);e("body").data("jQWCP.activeControl",r.get(0)),s.trigger("sliderdown")},t.Handler.slider_mousedown=function(t){var r=e(this),i=r.closest(".jQWCP-wWidget").data("jQWCP.instance"),s=e(i.input);e("body").data("jQWCP.activeControl",r.parent().get(0)),s.trigger("sliderdown")},t.Handler.sliderCursor_mousedown=function(t){var r=e(this),i=r.closest(".jQWCP-wWidget").data("jQWCP.instance"),s=e(i.input);e("body").data("jQWCP.activeControl",r.parent().get(0)),s.trigger("sliderdown")},t.Handler.html_mouseup=function(r){var i=e(e("body").data("jQWCP.activeControl"));if(0!=i.length){var s=i.closest(".jQWCP-wWidget").data("jQWCP.instance"),a=e(s.input);if("popup"==s.options.layout){s.options.hideKeyboard||a.trigger("focus.jQWCP_DONT_TRIGGER_EVENTS"),a.on("focus.wheelColorPicker",t.Handler.input_focus_popup),a.on("blur.wheelColorPicker",t.Handler.input_blur_popup);var o=a.data("jQWCP.suspendedEvents");if(null!=o)for(var n=o.blur,l=0;l<n.length;l++)a.on("blur"+(""==n[l].namespace?"":"."+n[l].namespace),n[l].handler)}0!=i.length&&(null!=r.pageX&&s.updateActiveControl(r),e("body").data("jQWCP.activeControl",null),a.trigger("sliderup"))}},t.Handler.html_mousemove=function(t){var r=e(e("body").data("jQWCP.activeControl"));if(0!=r.length){t.preventDefault();var i=r.closest(".jQWCP-wWidget").data("jQWCP.instance"),s=e(i.input);return i.updateActiveControl(t),s.trigger("slidermove"),!1}},t.Handler.window_resize=function(t){e("body .jQWCP-wWidget.jQWCP-block").each(function(){var t=e(this).data("jQWCP.instance");t.refreshWidget(),t.redrawSliders()})},t.Handler.overlay_click=function(r){if(null!=t.ColorPicker.widget){var i=e(t.ColorPicker.widget).data("jQWCP.instance");if(null!=i){var s=e(i.input);i.lastValue!=i.input.value&&s.trigger("change"),i.hide()}}},e(document).ready(function(){e("[data-wheelcolorpicker]").wheelColorPicker({htmlOptions:!0})}),e(document).ready(function(){e("body").append('<div id="jQWCP-PageOrigin" style="position: absolute; top: 0; left: 0; height: 0; width: 0;"></div>');var r=document.getElementById("jQWCP-PageOrigin").getBoundingClientRect();t.ORIGIN=r,e(window).on("scroll.jQWCP_RelativePageOriginBugFix",function(){var e=document.getElementById("jQWCP-PageOrigin").getBoundingClientRect();t.ORIGIN=e,0==e.left&&0==e.top||(t.BUG_RELATIVE_PAGE_ORIGIN=!0)})})}(jQuery);
  