File: /home/teamadsc/public_html/wp-content/plugins/arprice/js/jscolor.js
"use strict";window.jscolor||(window.jscolor=function(){var e={register:function(){e.attachDOMReadyEvent(e.init),e.attachEvent(document,"mousedown",e.onDocumentMouseDown),e.attachEvent(document,"touchstart",e.onDocumentTouchStart),e.attachEvent(window,"resize",e.onWindowResize)},init:function(){e.jscolor.lookupClass&&e.jscolor.installByClassName(e.jscolor.lookupClass)},tryInstallOnElements:function(t,r){for(var o=new RegExp("(^|\\s)("+r+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),n=0;n<t.length;n+=1)if(void 0===t[n].type||"color"!=t[n].type.toLowerCase()||!e.isColorAttrSupported){var i;if(!t[n].jscolor&&t[n].className&&(i=t[n].className.match(o))){var a=t[n],l=null,s=e.getDataAttr(a,"jscolor");null!==s?l=s:i[4]&&(l=i[4]);var c={};if(l)try{c=new Function("return ("+l+")")()}catch(d){e.warn("Error parsing jscolor options: "+d+":\n"+l)}a.jscolor=new e.jscolor(a,c)}}},isColorAttrSupported:function(){var e=document.createElement("input");return!(!e.setAttribute||(e.setAttribute("type","color"),"color"!=e.type.toLowerCase()))}(),isCanvasSupported:function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))}(),fetchElement:function(e){return"string"==typeof e?document.getElementById(e):e},isElementType:function(e,t){return e.nodeName.toLowerCase()===t.toLowerCase()},getDataAttr:function(e,t){var r="data-"+t,o=e.getAttribute(r);return null!==o?o:null},attachEvent:function(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent&&e.attachEvent("on"+t,r)},detachEvent:function(e,t,r){e.removeEventListener?e.removeEventListener(t,r,!1):e.detachEvent&&e.detachEvent("on"+t,r)},_attachedGroupEvents:{},attachGroupEvent:function(t,r,o,n){e._attachedGroupEvents.hasOwnProperty(t)||(e._attachedGroupEvents[t]=[]),e._attachedGroupEvents[t].push([r,o,n]),e.attachEvent(r,o,n)},detachGroupEvents:function(t){if(e._attachedGroupEvents.hasOwnProperty(t)){for(var r=0;r<e._attachedGroupEvents[t].length;r+=1){var o=e._attachedGroupEvents[t][r];e.detachEvent(o[0],o[1],o[2])}delete e._attachedGroupEvents[t]}},attachDOMReadyEvent:function(e){var t=!1,r=function(){t||(t=!0,e())};if("complete"===document.readyState)return void setTimeout(r,1);if(document.addEventListener)document.addEventListener("DOMContentLoaded",r,!1),window.addEventListener("load",r,!1);else if(document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&(document.detachEvent("onreadystatechange",arguments.callee),r())}),window.attachEvent("onload",r),document.documentElement.doScroll&&window==window.top)){var o=function(){if(document.body)try{document.documentElement.doScroll("left"),r()}catch(e){setTimeout(o,1)}};o()}},warn:function(e){window.console&&window.console.warn&&window.console.warn(e)},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(t){t.setCapture&&(e._capturedTarget=t,e._capturedTarget.setCapture())},releaseTarget:function(){e._capturedTarget&&(e._capturedTarget.releaseCapture(),e._capturedTarget=null)},fireEvent:function(e,t){if(e)if(document.createEvent){var r=document.createEvent("HTMLEvents");r.initEvent(t,!0,!0),e.dispatchEvent(r)}else if(document.createEventObject){var r=document.createEventObject();e.fireEvent("on"+t,r)}else e["on"+t]&&e["on"+t]()},classNameToList:function(e){return e.replace(/^\s+|\s+$/g,"").split(/\s+/)},hasClass:function(e,t){return t?-1!=(" "+e.className.replace(/\s+/g," ")+" ").indexOf(" "+t+" "):!1},setClass:function(t,r){for(var o=e.classNameToList(r),n=0;n<o.length;n+=1)e.hasClass(t,o[n])||(t.className+=(t.className?" ":"")+o[n])},unsetClass:function(t,r){for(var o=e.classNameToList(r),n=0;n<o.length;n+=1){var i=new RegExp("^\\s*"+o[n]+"\\s*|\\s*"+o[n]+"\\s*$|\\s+"+o[n]+"(\\s+)","g");t.className=t.className.replace(i,"$1")}},getStyle:function(e){return window.getComputedStyle?window.getComputedStyle(e):e.currentStyle},setStyle:function(){var e=document.createElement("div"),t=function(t){for(var r=0;r<t.length;r+=1)if(t[r]in e.style)return t[r]},r={borderRadius:t(["borderRadius","MozBorderRadius","webkitBorderRadius"]),boxShadow:t(["boxShadow","MozBoxShadow","webkitBoxShadow"])};return function(e,t,o){switch(t.toLowerCase()){case"opacity":var n=Math.round(100*parseFloat(o));e.style.opacity=o,e.style.filter="alpha(opacity="+n+")";break;default:e.style[r[t]]=o}}}(),setBorderRadius:function(t,r){e.setStyle(t,"borderRadius",r||"0")},setBoxShadow:function(t,r){e.setStyle(t,"boxShadow",r||"none")},getElementPos:function(t,r){var o=0,n=0,i=t.getBoundingClientRect();if(o=i.left,n=i.top,!r){var a=e.getViewPos();o+=a[0],n+=a[1]}return[o,n]},getElementSize:function(e){return[e.offsetWidth,e.offsetHeight]},getAbsPointerPos:function(e){e||(e=window.event);var t=0,r=0;return"undefined"!=typeof e.changedTouches&&e.changedTouches.length?(t=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY):"number"==typeof e.clientX&&(t=e.clientX,r=e.clientY),{x:t,y:r}},getRelPointerPos:function(e){e||(e=window.event);var t=e.target||e.srcElement,r=t.getBoundingClientRect(),o=0,n=0,i=0,a=0;return"undefined"!=typeof e.changedTouches&&e.changedTouches.length?(i=e.changedTouches[0].clientX,a=e.changedTouches[0].clientY):"number"==typeof e.clientX&&(i=e.clientX,a=e.clientY),o=i-r.left,n=a-r.top,{x:o,y:n}},getViewPos:function(){var e=document.documentElement;return[(window.pageXOffset||e.scrollLeft)-(e.clientLeft||0),(window.pageYOffset||e.scrollTop)-(e.clientTop||0)]},getViewSize:function(){var e=document.documentElement;return[window.innerWidth||e.clientWidth,window.innerHeight||e.clientHeight]},redrawPosition:function(){if(e.picker&&e.picker.owner){var t,r,o=e.picker.owner;o.fixed?(t=e.getElementPos(o.targetElement,!0),r=[0,0]):(t=e.getElementPos(o.targetElement),r=e.getViewPos());var n,i,a,l=e.getElementSize(o.targetElement),s=e.getViewSize(),c=e.getPickerOuterDims(o);switch(o.position.toLowerCase()){case"left":n=1,i=0,a=-1;break;case"right":n=1,i=0,a=1;break;case"top":n=0,i=1,a=-1;break;default:n=0,i=1,a=1}var d=(l[i]+c[i])/2;if(o.smartPosition)var p=[-r[n]+t[n]+c[n]>s[n]&&-r[n]+t[n]+l[n]/2>s[n]/2&&t[n]+l[n]-c[n]>=0?t[n]+l[n]-c[n]:t[n],-r[i]+t[i]+l[i]+c[i]-d+d*a>s[i]?-r[i]+t[i]+l[i]/2>s[i]/2&&t[i]+l[i]-d-d*a>=0?t[i]+l[i]-d-d*a:t[i]+l[i]-d+d*a:t[i]+l[i]-d+d*a>=0?t[i]+l[i]-d+d*a:t[i]+l[i]-d-d*a];else var p=[t[n],t[i]+l[i]-d+d*a];var h=p[n],u=p[i],m=o.fixed?"fixed":"absolute",v=(p[0]+c[0]>t[0]||p[0]<t[0]+l[0])&&p[1]+c[1]<t[1]+l[1];e._drawPosition(o,h,u,m,v)}},_drawPosition:function(t,r,o,n,i){var a=i?0:t.shadowBlur;e.picker.wrap.style.position=n,e.picker.wrap.style.left=r+"px",e.picker.wrap.style.top=o+"px";var l=jQuery(t.targetElement).attr("id");"arp_advanced_color_picker"===l&&(e.picker.wrap.style.top=o+35+"px");var s=parseInt(e.picker.wrap.style.height),c=parseInt(e.picker.wrap.style.top),d=jQuery(window).height()+10,p=d-c;s>p&&(e.picker.wrap.style.top=c-s-30+"px"),e.setBoxShadow(e.picker.boxS,t.shadow?new e.BoxShadow(0,a,t.shadowBlur,0,t.shadowColor):null)},getPickerDims:function(t){var r=!!e.getSliderComponent(t),o=[2*t.insetWidth+2*t.padding+t.width+(r?2*t.insetWidth+e.getPadToSliderPadding(t)+t.sliderSize:0),2*t.insetWidth+2*t.padding+t.height+(t.closable?2*t.insetWidth+t.padding+t.buttonHeight:0)];return o},getPickerOuterDims:function(t){var r=e.getPickerDims(t);return[r[0]+2*t.borderWidth,r[1]+2*t.borderWidth]},getPadToSliderPadding:function(e){return Math.max(e.padding,1.5*(2*e.pointerBorderWidth+e.pointerThickness))},getPadYComponent:function(e){switch(e.mode.charAt(1).toLowerCase()){case"v":return"v"}return"s"},getSliderComponent:function(e){if(e.mode.length>2)switch(e.mode.charAt(2).toLowerCase()){case"s":return"s";case"v":return"v"}return null},onDocumentMouseDown:function(t){t||(t=window.event);var r=t.target||t.srcElement;if(r._jscLinkedInstance)r._jscLinkedInstance.showOnClick&&r._jscLinkedInstance.show();else if(r._jscControlName)e.onControlPointerStart(t,r,r._jscControlName,"mouse");else{if(e.picker&&e.picker.owner&&"arp_advanced_color_picker"===jQuery(e.picker.owner.targetElement).attr("id")&&"arp_ribbon_colorpicker_wrapper"!==jQuery(r).attr("id"))return;!e.picker||!e.picker.owner||jQuery(r).hasClass("arp_add_favorite_color")||jQuery(r).parents().hasClass("arp_add_favorite_color")||jQuery(r).hasClass("arp_color_picker_input_div")||jQuery(r).parents().hasClass("arp_color_picker_input_div")||e.picker.owner.hide()}},onDocumentTouchStart:function(t){t||(t=window.event);var r=t.target||t.srcElement;r._jscLinkedInstance?r._jscLinkedInstance.showOnClick&&r._jscLinkedInstance.show():r._jscControlName?e.onControlPointerStart(t,r,r._jscControlName,"touch"):e.picker&&e.picker.owner&&e.picker.owner.hide()},onWindowResize:function(){e.redrawPosition()},onParentScroll:function(){e.picker&&e.picker.owner&&e.picker.owner.hide()},_pointerMoveEvent:{mouse:"mousemove",touch:"touchmove"},_pointerEndEvent:{mouse:"mouseup",touch:"touchend"},_pointerOrigin:null,_capturedTarget:null,onControlPointerStart:function(t,r,o,n){var i=r._jscInstance;e.preventDefault(t),e.captureTarget(r);var a=function(i,a){e.attachGroupEvent("drag",i,e._pointerMoveEvent[n],e.onDocumentPointerMove(t,r,o,n,a)),e.attachGroupEvent("drag",i,e._pointerEndEvent[n],e.onDocumentPointerEnd(t,r,o,n))};if(a(document,[0,0]),window.parent&&window.frameElement){var l=window.frameElement.getBoundingClientRect(),s=[-l.left,-l.top];a(window.parent.window.document,s)}var c=e.getAbsPointerPos(t),d=e.getRelPointerPos(t);switch(e._pointerOrigin={x:c.x-d.x,y:c.y-d.y},o){case"pad":switch(e.getSliderComponent(i)){case"s":0===i.hsv[1]&&i.fromHSV(null,100,null);break;case"v":0===i.hsv[2]&&i.fromHSV(null,null,100)}e.setPad(i,t,0,0);break;case"sld":e.setSld(i,t,0)}e.dispatchFineChange(i)},onDocumentPointerMove:function(t,r,o,n,i){return function(t){var n=r._jscInstance;switch(o){case"pad":t||(t=window.event),e.setPad(n,t,i[0],i[1]),e.dispatchFineChange(n);break;case"sld":t||(t=window.event),e.setSld(n,t,i[1]),e.dispatchFineChange(n)}}},onDocumentPointerEnd:function(t,r){return function(){var t=r._jscInstance;e.detachGroupEvents("drag"),e.releaseTarget(),e.dispatchChange(t)}},dispatchChange:function(t){t.valueElement&&e.isElementType(t.valueElement,"input")&&e.fireEvent(t.valueElement,"change")},dispatchFineChange:function(e){if(e.onFineChange){var t;t="string"==typeof e.onFineChange?new Function(e.onFineChange):e.onFineChange,t.call(e)}},setPad:function(t,r,o,n){var i=e.getAbsPointerPos(r),a=o+i.x-e._pointerOrigin.x-t.padding-t.insetWidth,l=n+i.y-e._pointerOrigin.y-t.padding-t.insetWidth,s=a*(360/(t.width-1)),c=100-l*(100/(t.height-1));switch(e.getPadYComponent(t)){case"s":t.fromHSV(s,c,null,e.leaveSld);break;case"v":t.fromHSV(s,null,c,e.leaveSld)}},setSld:function(t,r,o){var n=e.getAbsPointerPos(r),i=o+n.y-e._pointerOrigin.y-t.padding-t.insetWidth,a=100-i*(100/(t.height-1));switch(e.getSliderComponent(t)){case"s":t.fromHSV(null,a,null,e.leavePad);break;case"v":t.fromHSV(null,null,a,e.leavePad)}},_vmlNS:"jsc_vml_",_vmlCSS:"jsc_vml_css_",_vmlReady:!1,initVML:function(){if(!e._vmlReady){var t=document;if(t.namespaces[e._vmlNS]||t.namespaces.add(e._vmlNS,"urn:schemas-microsoft-com:vml"),!t.styleSheets[e._vmlCSS]){var r=["shape","shapetype","group","background","path","formulas","handles","fill","stroke","shadow","textbox","textpath","imagedata","line","polyline","curve","rect","roundrect","oval","arc","image"],o=t.createStyleSheet();o.owningElement.id=e._vmlCSS;for(var n=0;n<r.length;n+=1)o.addRule(e._vmlNS+"\\:"+r[n],"behavior:url(#default#VML);")}e._vmlReady=!0}},createPalette:function(){var t={elm:null,draw:null};if(e.isCanvasSupported){var r=document.createElement("canvas"),o=r.getContext("2d"),n=function(e,t,n){r.width=e,r.height=t,o.clearRect(0,0,r.width,r.height);var i=o.createLinearGradient(0,0,r.width,0);i.addColorStop(0,"#F00"),i.addColorStop(1/6,"#FF0"),i.addColorStop(2/6,"#0F0"),i.addColorStop(.5,"#0FF"),i.addColorStop(4/6,"#00F"),i.addColorStop(5/6,"#F0F"),i.addColorStop(1,"#F00"),o.fillStyle=i,o.fillRect(0,0,r.width,r.height);var a=o.createLinearGradient(0,0,0,r.height);switch(n.toLowerCase()){case"s":a.addColorStop(0,"rgba(255,255,255,0)"),a.addColorStop(1,"rgba(255,255,255,1)");break;case"v":a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)")}o.fillStyle=a,o.fillRect(0,0,r.width,r.height)};t.elm=r,t.draw=n}else{e.initVML();var i=document.createElement("div");i.style.position="relative",i.style.overflow="hidden";var a=document.createElement(e._vmlNS+":fill");a.type="gradient",a.method="linear",a.angle="90",a.colors="16.67% #F0F, 33.33% #00F, 50% #0FF, 66.67% #0F0, 83.33% #FF0";var l=document.createElement(e._vmlNS+":rect");l.style.position="absolute",l.style.left="-1px",l.style.top="-1px",l.stroked=!1,l.appendChild(a),i.appendChild(l);var s=document.createElement(e._vmlNS+":fill");s.type="gradient",s.method="linear",s.angle="180",s.opacity="0";var c=document.createElement(e._vmlNS+":rect");c.style.position="absolute",c.style.left="-1px",c.style.top="-1px",c.stroked=!1,c.appendChild(s),i.appendChild(c);var n=function(e,t,r){switch(i.style.width=e+"px",i.style.height=t+"px",l.style.width=c.style.width=e+1+"px",l.style.height=c.style.height=t+1+"px",a.color="#F00",a.color2="#F00",r.toLowerCase()){case"s":s.color=s.color2="#FFF";break;case"v":s.color=s.color2="#000"}};t.elm=i,t.draw=n}return t},createSliderGradient:function(){var t={elm:null,draw:null};if(e.isCanvasSupported){var r=document.createElement("canvas"),o=r.getContext("2d"),n=function(e,t,n,i){r.width=e,r.height=t,o.clearRect(0,0,r.width,r.height);var a=o.createLinearGradient(0,0,0,r.height);a.addColorStop(0,n),a.addColorStop(1,i),o.fillStyle=a,o.fillRect(0,0,r.width,r.height)};t.elm=r,t.draw=n}else{e.initVML();var i=document.createElement("div");i.style.position="relative",i.style.overflow="hidden";var a=document.createElement(e._vmlNS+":fill");a.type="gradient",a.method="linear",a.angle="180";var l=document.createElement(e._vmlNS+":rect");l.style.position="absolute",l.style.left="-1px",l.style.top="-1px",l.stroked=!1,l.appendChild(a),i.appendChild(l);var n=function(e,t,r,o){i.style.width=e+"px",i.style.height=t+"px",l.style.width=e+1+"px",l.style.height=t+1+"px",a.color=r,a.color2=o};t.elm=i,t.draw=n}return t},leaveValue:1,leaveStyle:2,leavePad:4,leaveSld:8,BoxShadow:function(){var e=function(e,t,r,o,n,i){this.hShadow=e,this.vShadow=t,this.blur=r,this.spread=o,this.color=n,this.inset=!!i};return e.prototype.toString=function(){var e=[Math.round(this.hShadow)+"px",Math.round(this.vShadow)+"px",Math.round(this.blur)+"px",Math.round(this.spread)+"px",this.color];return this.inset&&e.push("inset"),e.join(" ")},e}(),jscolor:function(t,r){function o(e,t,r){e/=255,t/=255,r/=255;var o=Math.min(Math.min(e,t),r),n=Math.max(Math.max(e,t),r),i=n-o;if(0===i)return[null,0,100*n];var a=e===o?3+(r-t)/i:t===o?5+(e-r)/i:1+(t-e)/i;return[60*(6===a?0:a),100*(i/n),100*n]}function n(e,t,r){var o=255*(r/100);if(null===e)return[o,o,o];e/=60,t/=100;var n=Math.floor(e),i=n%2?e-n:1-(e-n),a=o*(1-t),l=o*(1-t*i);switch(n){case 6:case 0:return[o,l,a];case 1:return[l,o,a];case 2:return[a,o,l];case 3:return[a,l,o];case 4:return[l,a,o];case 5:return[o,a,l]}}function i(){e.unsetClass(m.targetElement,m.activeClass),e.picker.wrap.parentNode.removeChild(e.picker.wrap),delete e.picker.owner}function a(){function t(){var e=m.insetColor.split(/\s+/),t=e.length<2?e[0]:e[1]+" "+e[0]+" "+e[0]+" "+e[1];d.btn.style.borderColor=t}m._processParentElementsInDOM(),setTimeout(function(){jQuery(".arp_add_favorite_color").remove(),jQuery(".arp_color_picker_input_div").remove(),jQuery(".color_input_hex_div").remove(),jQuery(".arp_color_picker_input").remove()},100),e.picker||(e.picker={owner:null,wrap:document.createElement("div"),box:document.createElement("div"),boxS:document.createElement("div"),boxB:document.createElement("div"),pad:document.createElement("div"),padB:document.createElement("div"),padM:document.createElement("div"),padPal:e.createPalette(),cross:document.createElement("div"),crossBY:document.createElement("div"),crossBX:document.createElement("div"),crossLY:document.createElement("div"),crossLX:document.createElement("div"),sld:document.createElement("div"),sldB:document.createElement("div"),sldM:document.createElement("div"),sldGrad:e.createSliderGradient(),sldPtrS:document.createElement("div"),sldPtrIB:document.createElement("div"),sldPtrMB:document.createElement("div"),sldPtrOB:document.createElement("div"),btn:document.createElement("div"),btnT:document.createElement("span"),temp:document.createElement("div")},e.picker.pad.appendChild(e.picker.padPal.elm),e.picker.padB.appendChild(e.picker.pad),e.picker.cross.appendChild(e.picker.crossBY),e.picker.cross.appendChild(e.picker.crossBX),e.picker.cross.appendChild(e.picker.crossLY),e.picker.cross.appendChild(e.picker.crossLX),e.picker.padB.appendChild(e.picker.cross),e.picker.box.appendChild(e.picker.padB),e.picker.box.appendChild(e.picker.padM),e.picker.sld.appendChild(e.picker.sldGrad.elm),e.picker.sldB.appendChild(e.picker.sld),e.picker.sldB.appendChild(e.picker.sldPtrOB),e.picker.sldPtrOB.appendChild(e.picker.sldPtrMB),e.picker.sldPtrMB.appendChild(e.picker.sldPtrIB),e.picker.sldPtrIB.appendChild(e.picker.sldPtrS),e.picker.box.appendChild(e.picker.sldB),e.picker.box.appendChild(e.picker.sldM),e.picker.btn.appendChild(e.picker.btnT),e.picker.box.appendChild(e.picker.btn),e.picker.boxB.appendChild(e.picker.box),e.picker.wrap.appendChild(e.picker.boxS),e.picker.wrap.appendChild(e.picker.boxB)),e.picker.color_input_hex_div=document.createElement("div"),e.picker.color_input_hex_div.setAttribute("class","color_input_hex_div"),e.picker.color_input_hex_div.innerHTML="#",e.picker.color_input=document.createElement("input"),e.picker.color_input.setAttribute("class","arp_color_picker_input"),e.picker.color_input.setAttribute("id","arp_color_picker_input"),e.picker.color_input.setAttribute("value",jQuery(m.valueElement).attr("value").replace("#","")),e.picker.color_input.setAttribute("data-value",jQuery(m.valueElement).attr("id")),e.picker.color_input.addEventListener("change",function(){var e=jQuery(this).val(),t=jQuery(this).attr("data-value");t.indexOf("_main_column_")>-1&&(t+="_wrapper");var r=(jQuery("#"+t),t.replace("_hidden",""));if("tooltip_bgcolor_hidden"===t&&(t="tooltip_bgcolor_div",r="tooltip_bgcolor_div"),"tooltip_txtcolor_hidden"===t&&(t="tooltip_txtcolor_div",r="tooltip_txtcolor_div"),"arp_shortcode_font_color"===r&&(r="arp_shortcode_font_custom_color"),"undefined"==typeof document.getElementById(t).jscolor&&"undefined"==typeof document.getElementById(r).jscolor){"arp_ribbon_txtcolor"===t&&document.getElementById("arp_advanced_color_picker").jscolor.fromString(e.replace("#","")),"arp_caption_border_color"===t&&(document.getElementById("arp_caption_border_color_div").jscolor.fromString(e.replace("#","")),arp_update_color(document.getElementById("arp_caption_border_color_div").jscolor,document.getElementById("arp_caption_border_color_div"))),"arp_caption_row_border_color"===t&&(document.getElementById("arp_caption_row_border_color_div").jscolor.fromString(e.replace("#","")),arp_update_color(document.getElementById("arp_caption_row_border_color_div").jscolor,document.getElementById("arp_caption_row_border_color_div")));var o=document.getElementById(t);"undefined"!=typeof __JSPICKER&&jQuery(__JSPICKER).each(function(t){var r=__JSPICKER[t],n=r.targetElement;o===n&&(__JSPICKER[t].fromString(e.replace("#","")),arp_update_color(__JSPICKER[t],n))})}else"undefined"==typeof document.getElementById(t).jscolor&&"undefined"!=typeof document.getElementById(r).jscolor?(document.getElementById(r).jscolor.fromString(e.replace("#","")),"arp_shortcode_font_custom_color"===r?(r="arp_shortcode_font_color",arp_update_color(document.getElementById("arp_shortcode_font_custom_color").jscolor,document.getElementById(r))):arp_update_color(document.getElementById(r).jscolor,document.getElementById(r))):"arp_ribbon_txtcolor"===t?document.getElementById("arp_advanced_color_picker").jscolor.fromString(e.replace("#","")):(document.getElementById(t).jscolor.fromString(e.replace("#","")),arp_update_color(document.getElementById(t).jscolor,document.getElementById(t)))}),e.picker.color_input.addEventListener("paste",function(e){e.preventDefault();var t=e.clipboardData.getData("text");t=t.replace("#",""),jQuery(this).val(t).trigger("change");var r=jQuery(this).attr("data-value"),o=jQuery(this).val(),r=jQuery(this).attr("data-value");r.indexOf("_main_column_")>-1&&(r+="_wrapper");var n=(jQuery("#"+r),r.replace("_hidden",""));if("tooltip_bgcolor_hidden"===r&&(r="tooltip_bgcolor_div",n="tooltip_bgcolor_div"),"tooltip_txtcolor_hidden"===r&&(r="tooltip_txtcolor_div",n="tooltip_txtcolor_div"),"arp_shortcode_font_color"===n&&(n="arp_shortcode_font_custom_color"),"undefined"==typeof document.getElementById(r).jscolor&&"undefined"==typeof document.getElementById(n).jscolor){"arp_ribbon_txtcolor"===r&&document.getElementById("arp_advanced_color_picker").jscolor.fromString(o.replace("#","")),"arp_caption_border_color"===r&&(document.getElementById("arp_caption_border_color_div").jscolor.fromString(o.replace("#","")),arp_update_color(document.getElementById("arp_caption_border_color_div").jscolor,document.getElementById("arp_caption_border_color_div"))),"arp_caption_row_border_color"===r&&(document.getElementById("arp_caption_row_border_color_div").jscolor.fromString(o.replace("#","")),arp_update_color(document.getElementById("arp_caption_row_border_color_div").jscolor,document.getElementById("arp_caption_row_border_color_div")));var i=document.getElementById(r);"undefined"!=typeof __JSPICKER&&jQuery(__JSPICKER).each(function(e){var t=__JSPICKER[e],r=t.targetElement;i===r&&(__JSPICKER[e].fromString(o.replace("#","")),arp_update_color(__JSPICKER[e],r))})}else"undefined"==typeof document.getElementById(r).jscolor&&"undefined"!=typeof document.getElementById(n).jscolor?(document.getElementById(n).jscolor.fromString(o.replace("#","")),"arp_shortcode_font_custom_color"===n?(n="arp_shortcode_font_color",arp_update_color(document.getElementById("arp_shortcode_font_custom_color").jscolor,document.getElementById(n))):arp_update_color(document.getElementById(n).jscolor,document.getElementById(n))):"arp_ribbon_txtcolor"===r?document.getElementById("arp_advanced_color_picker").jscolor.fromString(o.replace("#","")):(document.getElementById(r).jscolor.fromString(o.replace("#","")),arp_update_color(document.getElementById(r).jscolor,document.getElementById(r)))}),e.picker.color_input_div=document.createElement("div"),e.picker.color_input_div.setAttribute("class","arp_color_picker_input_div");var r=jQuery(m.targetElement).attr("id");e.picker.color_input_div.setAttribute("id","arp_color_picker_input_div"),e.picker.color_input_div.appendChild(e.picker.color_input_hex_div),e.picker.color_input_div.appendChild(e.picker.color_input),setTimeout(function(){e.picker.box.appendChild(e.picker.color_input_div)},200),e.picker.fav=document.createElement("div"),e.picker.favW=document.createElement("div"),e.picker.favB=document.createElement("div"),e.picker.favI=document.createElement("i"),e.picker.favB.setAttribute("data-value",jQuery(m.valueElement).attr("id")),e.picker.favI.setAttribute("class","fas fa-heart"),e.picker.favB.appendChild(e.picker.favI),e.picker.favW.setAttribute("class","arp_favorite_color_buttons"),e.picker.fav.appendChild(e.picker.favW),e.picker.favB.setAttribute("class","arp_add_favorite_color_btn arptooltipster tipso_style"),e.picker.favB.setAttribute("data-tipso","Add to Favourite"),e.picker.favB.setAttribute("title","Add to Favourite"),e.picker.favB.setAttribute("id","arp_add_favorite_color_btn");var r=jQuery(m.targetElement).attr("id");if("undefined"!=typeof Storage)var o=localStorage.getItem("arp_fav_color[colors]");else var o=getCookie("arp_fav_color[colors]");if(void 0!==o&&""!==o&&null!==o){var n=o.split(",");for(var i in n){var a=n[i],c=document.createElement("div");c.setAttribute("class","select_from_fav_color"),c.setAttribute("value",a),c.setAttribute("style","background:"+a),7>i&&e.picker.favW.appendChild(c)}}e.picker.fav.appendChild(e.picker.favB),e.picker.fav.setAttribute("class","arp_add_favorite_color"),e.picker.fav.setAttribute("id","arp_add_favorite_color"),setTimeout(function(){e.picker.box.appendChild(e.picker.fav)},200);var d=e.picker,p=!!e.getSliderComponent(m),h=e.getPickerDims(m),u=2*m.pointerBorderWidth+m.pointerThickness+2*m.crossSize,g=e.getPadToSliderPadding(m),y=Math.min(m.borderRadius,Math.round(m.padding*Math.PI)),f="crosshair";if(d.wrap.setAttribute("class","arprice_js_colorpicker"),"arp_advanced_color_picker"===r&&d.wrap.setAttribute("class","arprice_js_colorpicker arp_advanced"),d.wrap.style.clear="both",d.wrap.style.width=h[0]+2*m.borderWidth+"px",d.wrap.style.height=h[1]+2*m.borderWidth+65+"px",d.wrap.style.zIndex=m.zIndex,d.fav.style.top=h[1]+2*m.borderWidth-5+"px","arp_advanced_color_picker"===r&&(d.wrap.style.width=h[0]+2*m.borderWidth+3+"px",d.wrap.style.height=h[1]+2*m.borderWidth+102+"px"),d.box.style.width=h[0]+"px",d.box.style.height=h[1]+65+"px","arp_advanced_color_picker"===r&&(d.box.style.width=h[0]+3+"px",d.box.style.height=h[1]+102+"px"),d.boxS.style.position="absolute",d.boxS.style.left="0",d.boxS.style.top="0",d.boxS.style.width="100%",d.boxS.style.height="100%",e.setBorderRadius(d.boxS,y+"px"),"arp_advanced_color_picker"===r&&e.setBorderRadius(d.boxS,"0px"),"arp_advanced_color_picker"===r){setTimeout(function(){jQuery(".arp_close_colorpicker_advanced").remove()},100),e.picker.rbncls=document.createElement("input"),e.picker.rbncls.setAttribute("id","arp_close_colorpicker_advanced"),e.picker.rbncls.setAttribute("class","col_opt_btn arp_close_colorpicker_advanced");h[1]+2*m.borderWidth+60+"px;";e.picker.rbncls.setAttribute("type","button"),e.picker.rbncls.setAttribute("style","float:right;margin-right:10px;margin-top:10px;height:30px;"),e.picker.rbncls.setAttribute("value","OK"),setTimeout(function(){e.picker.box.appendChild(e.picker.rbncls)},200)}else"undefined"!=typeof e.picker.rbncls&&null!==e.picker.rbncls&&delete e.picker.rbncls;d.boxB.style.position="relative",d.boxB.style.border=m.borderWidth+"px solid",d.boxB.style.borderColor=m.borderColor,d.boxB.style.background=m.backgroundColor,e.setBorderRadius(d.boxB,y+"px"),"arp_advanced_color_picker"===r&&e.setBorderRadius(d.boxB,"0px"),d.padM.style.background=d.sldM.style.background="#FFF",e.setStyle(d.padM,"opacity","0"),e.setStyle(d.sldM,"opacity","0"),d.pad.style.position="relative",d.pad.style.width=m.width+"px",d.pad.style.height=m.height+"px",d.padPal.draw(m.width,m.height,e.getPadYComponent(m)),d.padB.style.position="absolute",d.padB.style.left=m.padding+"px",d.padB.style.top=m.padding+"px",d.padB.style.border=m.insetWidth+"px solid",d.padB.style.borderColor=m.insetColor,d.padM._jscInstance=m,d.padM._jscControlName="pad",d.padM.style.position="absolute",d.padM.style.left="0",d.padM.style.top="0",d.padM.style.width=m.padding+2*m.insetWidth+m.width+g/2+"px",d.padM.style.height=h[1]+"px",d.padM.style.cursor=f,d.cross.style.position="absolute",d.cross.style.left=d.cross.style.top="0",d.cross.style.width=d.cross.style.height=u+"px",d.crossBY.style.position=d.crossBX.style.position="absolute",d.crossBY.style.background=d.crossBX.style.background=m.pointerBorderColor,d.crossBY.style.width=d.crossBX.style.height=2*m.pointerBorderWidth+m.pointerThickness+"px",d.crossBY.style.height=d.crossBX.style.width=u+"px",d.crossBY.style.left=d.crossBX.style.top=Math.floor(u/2)-Math.floor(m.pointerThickness/2)-m.pointerBorderWidth+"px",d.crossBY.style.top=d.crossBX.style.left="0",d.crossLY.style.position=d.crossLX.style.position="absolute",d.crossLY.style.background=d.crossLX.style.background=m.pointerColor,d.crossLY.style.height=d.crossLX.style.width=u-2*m.pointerBorderWidth+"px",d.crossLY.style.width=d.crossLX.style.height=m.pointerThickness+"px",d.crossLY.style.left=d.crossLX.style.top=Math.floor(u/2)-Math.floor(m.pointerThickness/2)+"px",d.crossLY.style.top=d.crossLX.style.left=m.pointerBorderWidth+"px",d.sld.style.overflow="hidden",d.sld.style.width=m.sliderSize+"px",d.sld.style.height=m.height+"px",d.sldGrad.draw(m.sliderSize,m.height,"#000","#000"),d.sldB.style.display=p?"block":"none",d.sldB.style.position="absolute",d.sldB.style.right=m.padding+"px",d.sldB.style.top=m.padding+"px",d.sldB.style.border=m.insetWidth+"px solid",d.sldB.style.borderColor=m.insetColor,d.sldM._jscInstance=m,d.sldM._jscControlName="sld",d.sldM.style.display=p?"block":"none",d.sldM.style.position="absolute",d.sldM.style.right="0",d.sldM.style.top="0",d.sldM.style.width=m.sliderSize+g/2+m.padding+2*m.insetWidth+"px",d.sldM.style.height=h[1]+"px","arp_advanced_color_picker"===r&&(d.sldM.style.height=h[1]+20+"px"),d.sldM.style.cursor="default",d.sldPtrIB.style.border=d.sldPtrOB.style.border=m.pointerBorderWidth+"px solid "+m.pointerBorderColor,d.sldPtrOB.style.position="absolute",d.sldPtrOB.style.left=-(2*m.pointerBorderWidth+m.pointerThickness)+"px",d.sldPtrOB.style.top="0",d.sldPtrMB.style.border=m.pointerThickness+"px solid "+m.pointerColor,d.sldPtrS.style.width=m.sliderSize+"px",d.sldPtrS.style.height=_+"px",d.btn.style.display=m.closable?"block":"none",d.btn.style.position="absolute",d.btn.style.left=m.padding+"px",d.btn.style.bottom=m.padding+"px",d.btn.style.padding="0 15px",d.btn.style.height=m.buttonHeight+"px",d.btn.style.border=m.insetWidth+"px solid",t(),d.btn.style.color=m.buttonColor,d.btn.style.font="12px sans-serif",d.btn.style.textAlign="center";try{d.btn.style.cursor="pointer"}catch(b){d.btn.style.cursor="hand"}d.btn.onmousedown=function(){m.hide()},d.btnT.style.lineHeight=m.buttonHeight+"px",d.btnT.innerHTML="",d.btnT.appendChild(document.createTextNode(m.closeText)),l(),s(),e.picker.owner&&e.picker.owner!==m&&e.unsetClass(e.picker.owner.targetElement,m.activeClass),e.picker.owner=m,e.isElementType(v,"body")?e.redrawPosition():e._drawPosition(m,0,0,"relative",!1),d.wrap.parentNode!=v&&v.appendChild(d.wrap),e.setClass(m.targetElement,m.activeClass),jQuery.isFunction(jQuery().tipso)&&setTimeout(function(){jQuery(".arptooltipster").tipso({position:"bottom",background:"#61677f",width:"auto"})},250)}function l(){switch(e.getPadYComponent(m)){case"s":var t=1;break;case"v":var t=2}var r=Math.round(m.hsv[0]/360*(m.width-1)),o=Math.round((1-m.hsv[t]/100)*(m.height-1)),i=2*m.pointerBorderWidth+m.pointerThickness+2*m.crossSize,a=-Math.floor(i/2);switch(e.picker.cross.style.left=r+a+"px",e.picker.cross.style.top=o+a+"px",e.getSliderComponent(m)){case"s":var l=n(m.hsv[0],100,m.hsv[2]),s=n(m.hsv[0],0,m.hsv[2]),c="rgb("+Math.round(l[0])+","+Math.round(l[1])+","+Math.round(l[2])+")",d="rgb("+Math.round(s[0])+","+Math.round(s[1])+","+Math.round(s[2])+")";e.picker.sldGrad.draw(m.sliderSize,m.height,c,d),"arp_advanced_color_picker"===jQuery(m.styleElement).attr("id")&&e.picker.sldGrad.draw(m.sliderSize,m.height+20,c,d);break;case"v":var p=n(m.hsv[0],m.hsv[1],100),c="rgb("+Math.round(p[0])+","+Math.round(p[1])+","+Math.round(p[2])+")",d="#000";e.picker.sldGrad.draw(m.sliderSize,m.height,c,d),"arp_advanced_color_picker"===jQuery(m.styleElement).attr("id")&&e.picker.sldGrad.draw(m.sliderSize,m.height+20,c,d)}}function s(){var t=e.getSliderComponent(m);if(t){switch(t){case"s":var r=1;break;case"v":var r=2}var o=Math.round((1-m.hsv[r]/100)*(m.height-1));e.picker.sldPtrOB.style.top=o-(2*m.pointerBorderWidth+m.pointerThickness)-Math.floor(_/2)+"px"}}function c(){return e.picker&&e.picker.owner===m}function d(){m.importColor()}this.value=null,this.valueElement=t,this.styleElement=t,this.required=!0,this.refine=!0,this.hash=!1,this.uppercase=!0,this.onFineChange=null,this.activeClass="jscolor-active",this.minS=0,this.maxS=100,this.minV=0,this.maxV=100,this.hsv=[0,0,100],this.rgb=[255,255,255],this.width=181,this.height=101,this.showOnClick=!0,this.mode="HSV",this.position="bottom",this.smartPosition=!0,this.sliderSize=16,this.crossSize=8,this.closable=!1,this.closeText="Close",this.buttonColor="#000000",this.buttonHeight=18,this.padding=12,this.backgroundColor="#FFFFFF",this.borderWidth=1,this.borderColor="#BBBBBB",this.borderRadius=8,this.insetWidth=1,this.insetColor="#BBBBBB",this.shadow=!0,this.shadowBlur=15,this.shadowColor="rgba(0,0,0,0.2)",this.pointerColor="#4C4C4C",this.pointerBorderColor="#FFFFFF",this.pointerBorderWidth=1,this.pointerThickness=2,this.zIndex=1e3,this.container=null;for(var p in r)r.hasOwnProperty(p)&&(this[p]=r[p]);if(this.hide=function(){c()&&i()},this.show=function(){a()},this.redraw=function(){c()&&a()},this.importColor=function(){this.valueElement&&e.isElementType(this.valueElement,"input")?this.refine?!this.required&&/^\s*$/.test(this.valueElement.value)?(this.valueElement.value="",this.styleElement&&(this.styleElement.style.backgroundImage=this.styleElement._jscOrigStyle.backgroundImage,this.styleElement.style.backgroundColor=this.styleElement._jscOrigStyle.backgroundColor,this.styleElement.style.color=this.styleElement._jscOrigStyle.color),this.exportColor(e.leaveValue|e.leaveStyle)):this.fromString(this.valueElement.value)||this.exportColor():this.fromString(this.valueElement.value,e.leaveValue)||(this.styleElement&&(this.styleElement.style.backgroundImage=this.styleElement._jscOrigStyle.backgroundImage,this.styleElement.style.backgroundColor=this.styleElement._jscOrigStyle.backgroundColor,this.styleElement.style.color=this.styleElement._jscOrigStyle.color),this.exportColor(e.leaveValue|e.leaveStyle)):this.exportColor()},this.exportColor=function(t){if(!(t&e.leaveValue)&&this.valueElement){var r=this.toString();this.uppercase&&(r=r.toUpperCase()),this.hash&&(r="#"+r),e.isElementType(this.valueElement,"input")?this.valueElement.value=r:this.valueElement.innerHTML=r}t&e.leaveStyle||this.styleElement&&(this.styleElement.style.backgroundImage="none",this.styleElement.style.backgroundColor="#"+this.toString(),this.styleElement.style.color=this.isLight()?"#000":"#FFF"),t&e.leavePad||!c()||l(),t&e.leaveSld||!c()||s()},this.fromHSV=function(e,t,r,o){if(null!==e){if(isNaN(e))return!1;e=Math.max(0,Math.min(360,e))}if(null!==t){if(isNaN(t))return!1;t=Math.max(0,Math.min(100,this.maxS,t),this.minS)}if(null!==r){if(isNaN(r))return!1;r=Math.max(0,Math.min(100,this.maxV,r),this.minV)}this.rgb=n(null===e?this.hsv[0]:this.hsv[0]=e,null===t?this.hsv[1]:this.hsv[1]=t,null===r?this.hsv[2]:this.hsv[2]=r),this.exportColor(o)},this.fromRGB=function(e,t,r,i){if(null!==e){if(isNaN(e))return!1;e=Math.max(0,Math.min(255,e))}if(null!==t){if(isNaN(t))return!1;t=Math.max(0,Math.min(255,t))}if(null!==r){if(isNaN(r))return!1;r=Math.max(0,Math.min(255,r))}var a=o(null===e?this.rgb[0]:e,null===t?this.rgb[1]:t,null===r?this.rgb[2]:r);null!==a[0]&&(this.hsv[0]=Math.max(0,Math.min(360,a[0]))),0!==a[2]&&(this.hsv[1]=null===a[1]?null:Math.max(0,this.minS,Math.min(100,this.maxS,a[1]))),this.hsv[2]=null===a[2]?null:Math.max(0,this.minV,Math.min(100,this.maxV,a[2]));var l=n(this.hsv[0],this.hsv[1],this.hsv[2]);this.rgb[0]=l[0],this.rgb[1]=l[1],this.rgb[2]=l[2],this.exportColor(i)},this.fromString=function(e,t){var r;if(void 0===e)return!0;if(r=e.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i))return 6===r[1].length?this.fromRGB(parseInt(r[1].substr(0,2),16),parseInt(r[1].substr(2,2),16),parseInt(r[1].substr(4,2),16),t):this.fromRGB(parseInt(r[1].charAt(0)+r[1].charAt(0),16),parseInt(r[1].charAt(1)+r[1].charAt(1),16),parseInt(r[1].charAt(2)+r[1].charAt(2),16),t),!0;if(r=e.match(/^\W*rgba?\(([^)]*)\)\W*$/i)){var o,n,i,a=r[1].split(","),l=/^\s*(\d*)(\.\d+)?\s*$/;if(a.length>=3&&(o=a[0].match(l))&&(n=a[1].match(l))&&(i=a[2].match(l))){var s=parseFloat((o[1]||"0")+(o[2]||"")),c=parseFloat((n[1]||"0")+(n[2]||"")),d=parseFloat((i[1]||"0")+(i[2]||""));return this.fromRGB(s,c,d,t),!0}}return!1},this.toString=function(){return(256|Math.round(this.rgb[0])).toString(16).substr(1)+(256|Math.round(this.rgb[1])).toString(16).substr(1)+(256|Math.round(this.rgb[2])).toString(16).substr(1)},this.toHEXString=function(){return"#"+this.toString().toUpperCase()},this.toRGBString=function(){return"rgb("+Math.round(this.rgb[0])+","+Math.round(this.rgb[1])+","+Math.round(this.rgb[2])+")"},this.isLight=function(){return.213*this.rgb[0]+.715*this.rgb[1]+.072*this.rgb[2]>127.5},this._processParentElementsInDOM=function(){if(!this._linkedElementsProcessed){this._linkedElementsProcessed=!0;var t=this.targetElement;do{var r=e.getStyle(t);r&&"fixed"===r.position.toLowerCase()&&(this.fixed=!0),t!==this.targetElement&&(t._jscEventsAttached||(e.attachEvent(t,"scroll",e.onParentScroll),t._jscEventsAttached=!0))}while((t=t.parentNode)&&!e.isElementType(t,"body"))}},"string"==typeof t){var h=t,u=document.getElementById(h);u?this.targetElement=u:e.warn("Could not find target element with ID '"+h+"'")}else t?this.targetElement=t:e.warn("Invalid target element: '"+t+"'");if(this.targetElement._jscLinkedInstance)return void e.warn("Cannot link jscolor twice to the same element. Skipping.");this.targetElement._jscLinkedInstance=this,this.valueElement=e.fetchElement(this.valueElement),this.styleElement=e.fetchElement(this.styleElement);var m=this,v=this.container?e.fetchElement(this.container):document.getElementsByTagName("body")[0],_=3;if(e.isElementType(this.targetElement,"button"))if(this.targetElement.onclick){var g=this.targetElement.onclick;this.targetElement.onclick=function(e){return g.call(this,e),!1}}else this.targetElement.onclick=function(){return!1};if(this.valueElement&&e.isElementType(this.valueElement,"input")){var y=function(){m.fromString(m.valueElement.value,e.leaveValue),e.dispatchFineChange(m)};e.attachEvent(this.valueElement,"keyup",y),e.attachEvent(this.valueElement,"input",y),e.attachEvent(this.valueElement,"blur",d),this.valueElement.setAttribute("autocomplete","off")}this.styleElement&&(this.styleElement._jscOrigStyle={backgroundImage:this.styleElement.style.backgroundImage,backgroundColor:this.styleElement.style.backgroundColor,color:this.styleElement.style.color}),this.value?this.fromString(this.value)||this.exportColor():this.importColor()}};return e.jscolor.lookupClass="jscolor",e.jscolor.installByClassName=function(t){var r=document.getElementsByTagName("input"),o=document.getElementsByTagName("button");e.tryInstallOnElements(r,t),e.tryInstallOnElements(o,t);var n=document.getElementsByTagName("div");e.tryInstallOnElements(n,t)},e.register(),e.jscolor}());