/************************************************************************** * tp-color-picker.js - Color Picker Plugin for Revolution Slider * @version: 1.0.4 (7.9.2017) * @author ThemePunch **************************************************************************/ window.RevColor={defaultValue:"#ffffff",isColor:/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,get:function(e){return e?RevColor.process(e,!0)[0]:"transparent"},parse:function(e,r,a){e=RevColor.process(e,!0);var t=[];return t[0]=r?r+": "+e[0]+";":e[0],a&&(t[1]=e[1]),t},convert:function(e,r){if(!e||"string"!=typeof e)return RevColor.defaultValue;if("transparent"===e)return e;if(-1!==e.search(/\[\{/)||-1!==e.search("gradient"))return RevColor.process(e,!0)[0];if(void 0===r||isNaN(r))return RevColor.process(e,!0)[0];if((r=parseFloat(r))<=1&&(r*=100),0===(r=Math.max(Math.min(parseInt(r,10),100),0)))return"transparent";try{return-1!==e.search("#")||e.length<8?(RevColor.isColor.test(e)||(e=e.replace(/[^A-Za-z0-9#]/g,"")),RevColor.processRgba(RevColor.sanitizeHex(e),r)):(e=RevColor.rgbValues(e,3),RevColor.rgbaString(e[0],e[1],e[2],.01*r))}catch(e){return RevColor.defaultValue}},process:function(e,r){if("string"!=typeof e)return r&&(e=RevColor.sanitizeGradient(e)),[RevColor.processGradient(e),"gradient",e];if("transparent"===e.trim())return["transparent","transparent"];if(-1===e.search(/\[\{/))return-1!==e.search("#")?[RevColor.sanitizeHex(e),"hex"]:-1!==e.search("rgba")?[e.replace(/\s/g,"").replace(/false/g,"1"),"rgba"]:-1!==e.search("rgb")?[e.replace(/\s/g,""),"rgb"]:RevColor.isColor.test(e)?[e,"hex"]:["transparent","transparent",!0];try{return e=JSON.parse(e.replace(/\&/g,'"')),r&&(e=RevColor.sanitizeGradient(e)),[RevColor.processGradient(e),"gradient",e]}catch(e){return console.log("RevColor.process() failed to parse JSON string"),["linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(0, 0, 0, 1) 100%)","gradient",{type:"linear",angle:"0",colors:[{r:"255",g:"255",b:"255",a:"1",position:"0",align:"bottom"},{r:"0",g:"0",b:"0",a:"1",position:"100",align:"bottom"}]}]}},transparentRgba:function(e,r){return!(!r&&"rgba"!==RevColor.process(e)[1])&&"0"===RevColor.rgbValues(e,4)[3]},rgbValues:function(e,r){3===(e=e.substring(e.indexOf("(")+1,e.lastIndexOf(")")).split(",")).length&&4===r&&(e[3]="1");for(var a=0;a0&&(n+=", "),n+="rgba("+(r=o[s]).r+", "+r.g+", "+r.b+", "+r.a+") "+r.position+"%";return t+i+n+")"},sanitizeHex:function(e){if(3===(e=e.replace("#","").trim()).length){var r=e.charAt(0),a=e.charAt(1),t=e.charAt(2);e=r+r+a+a+t+t}return"#"+e},sanitizeGradient:function(e){for(var r,a=e.colors,t=a.length,i=[],o=0;o';return a||(v+=''),v+="",n=e(v),c&&n.data("gradient",c),n[0]}return n=document.createElement("span"),n.className="rev-cpicker-color blank",n}function l(){var r=c(this,"data-color").toLowerCase(),a=!kr&&r===pr.toLowerCase();if(r===ir||a){var t=e(this);return t.closest(".rev-cpicker-presets-group").find(".rev-cpicker-color.selected").removeClass("selected"),Cr=t,kr&&!De&&d(Cr.data("gradient"),!0),Cr.addClass("selected"),!1}}function p(e,r){for(var a=document.createDocumentFragment(),t=-1!==e.search("core"),i=t?"":" rev-picker-color-custom",o=r.length,c=-1!==e.search("colors")?Ar:Mr,n=Math.max(Math.ceil(o/Hr),c),l=0;lr)return a}function b(r,a){var t=g(r,a).color,i=u(t,r,!0),o=h(r,a,f(t,!0),i);xe&&xe.removeClass("active"),xe=e(o).addClass("active").appendTo(Ze).draggable(Er),He=xe.children(".rev-cpicker-point-square")[0],Se=xe.children(".rev-cpicker-point-triangle")[0],Ue=Ze.children();var c=k(a);N(o),"bottom"===r&&he.val(c[1]).change()}function k(e){void 0===e&&(e=ee[Je].x);var r=xe.attr("data-color"),a=xe.hasClass("rev-cpicker-point-bottom");if(a)hr.hasClass("active")&&(Qe.attr("disabled","disabled"),Ye.attr("disabled","disabled"),hr.removeClass("active")),r=RevColor.rgbaToHex(r)[0],ke.css("background",r),me.removeAttr("disabled").val(e+"%"),ce.find(".rev-cpicker-point-bottom").length>2&&er.addClass("active"),ce.addClass("open");else{er.hasClass("active")&&(ke.css("background",""),me.attr("disabled","disabled"),er.removeClass("active"));var t=RevColor.getOpacity(r);Qe.attr("data-opacity",t).val(t).removeAttr("disabled"),Ye.val(e+"%").removeAttr("disabled"),ce.find(".rev-cpicker-point-top").length>2&&hr.addClass("active"),ce.removeClass("open")}return[a,r]}function u(e,r,a){return"bottom"===r?"rgb("+e.r+","+e.g+","+e.b+")":"rgba(0, 0, 0, "+(a?"1":e.a)+")"}function f(e,r){var a=r?"1":e.a;return"rgba("+e.r+","+e.g+","+e.b+","+a+")"}function m(e){for(var r,a,t=document.createDocumentFragment(),i=e.length,o=0;o':'',o}function C(e){return e&&"radial"!==e||(e="0"),Ae.innerHTML=e+"°",Ae.value}function x(){xe&&(xe.removeClass("active"),xe=!1),me.attr("disabled","disabled"),Qe.attr("disabled","disabled"),Ye.attr("disabled","disabled"),hr.removeClass("active"),er.removeClass("active"),ke.css("background",""),ce.removeClass("open")}function y(e,r){ce.removeClass("active is-basic").hide(),Z.removeClass("rev-colorpicker-open"),mr.css({left:"",top:""}),ye&&(ye.remove(),ye=!1),Cr?(Cr.hasClass("selected")?(r&&or.data("hex",Cr.attr("data-color").toLowerCase()),Cr.removeClass("selected")):or.removeData("hex"),Cr=!1):or.removeData("hex"),r||(Re&&Re(),lr&&"transparent"!==lr?dr[0].style.background=lr:dr.css("background",""),X.trigger("revcolorpickerupdate",[or,lr])),dr=!1,or=!1}function w(){var r=e(this).children(".rev-cpicker-color").not(".blank").length;return r>Hr?e("#"+this.id+"-btn").addClass("multiplerows"):e("#"+this.id+"-btn").removeClass("multiplerows"),r}function R(){var r,a=e(this),t=-1!==this.id.search("colors")?Ar:Mr,i=a.children(".rev-cpicker-color"),o=i.length,c=Math.ceil(o/Hr),n=t*Hr;o+=1;for(var s=0;s=n&&(p.remove(),r=!0)}return r}function _(){if(-1===this.className.search("blank"))return Ce=!1,!1}function I(r){var a=r.angle;"radial"===r.type&&(a="radial"),$e.removeClass("selected"),e('.rev-cpicker-orientation[data-direction="'+a+'"]').addClass("selected"),Q.val(C(a)),O(a),m(r.colors)}function N(e,r,t){Oe=r,V(),Oe=!1;for(var i,o,c,n=[],s=ee.length,l=0;lr.x?1:0}function E(e){var r=RevColor.rgbValues(c(this,"data-color"),4),a=-1!==this.className.search("bottom")?"bottom":"top",t=r[3].replace(/\.?0*$/,"")||0,i=parseInt(this.style.left,10);Oe&&(i<50?i+=2*(50-i):i-=2*(i-50),this.style.left=i+"%",this.setAttribute("data-location",i)),ee[e]={el:this,x:i,alpha:t,align:a,color:{r:parseInt(r[0],10),g:parseInt(r[1],10),b:parseInt(r[2],10),a:t,position:i,align:a}},xe&&xe[0]!==this&&("bottom"===a?je[je.length]=i:Fe[Fe.length]=i)}function O(e){e=void 0!==e?e:parseInt(Q.val(),10),Be[0].style.transform="rotate("+e+"deg)"}function P(r,a,t){var i,o,c=void 0!==t,n=c?t:parseInt(Q.val(),10);if(r&&"keyup"===r.type)i=!isNaN(n)&&n>=-360&&n<=360,o=n;else{var s=parseInt(Q.data("orig-value"),10);n||(n="0"),(isNaN(n)||n<-360||n>360)&&(n=s),n!==s&&(o=n,i=!0,Q.val(C(n)),c||(n=a||n,$e.removeClass("selected"),e('.rev-cpicker-orientation[data-direction="'+n+'"]').addClass("selected")))}(i||a)&&(o&&O(o),N())}function z(){var r=e(this);-1!==this.className.search("down")?(r.parent().addClass("active"),r.closest(".rev-cpicker-presets").addClass("active"),e(this.id.replace("-btn","")).addClass("active"),ur=ce.hasClass("gradient-view")):(r.parent().removeClass("active"),r.closest(".rev-cpicker-presets").removeClass("active"),e(this.id.replace("-btn","")).removeClass("active"),ur=!1)}function D(e,r){var a=parseInt(100*(Math.round(r.position.left)/(Nr-2)).toFixed(2),10);"bottom"===Ne?me.val(a+"%").trigger("keyup"):Ye.val(a+"%").trigger("keyup")}function L(){var r=e(this);Ne=r.hasClass("rev-cpicker-point-bottom")?"bottom":"top",r.click()}function B(){"bottom"===Ne?me.trigger("focusout"):Ye.trigger("focusout")}function G(e){yr=!0,xr.slider("value",Math.round(.01*e*Tr)),yr=!1}function q(e){var r=Le.offset(),a=e.pageX-r.left,t=e.pageY-r.top;if(!isNaN(a)&&!isNaN(t)){var i=Math.atan2(t-jr,a-jr)*(180/Math.PI)+90;i<0&&(i+=360),i=Math.max(0,Math.min(360,Math.round(i))),i=5*Math.round(i/5),br=!0,P(!1,!1,i),br=!1}}function $(e){e.stopImmediatePropagation()}function J(){ne||e.tpColorPicker(),wr=document.getElementById("rev-cpicker-current-edit"),Ge=document.getElementById("rev-cpicker-gradient-output"),Ee=document.getElementById("rev-cpicker-gradient-input"),ze=document.getElementById("rev-cpicker-edit-title"),Ae=document.createElement("textarea"),hr=e("#rev-cpicker-opacity-delete"),Ze=e("#rev-cpciker-point-container"),Ye=e("#rev-cpicker-opacity-location"),cr=e(".rev-cpicker-presets-group"),sr=e("#rev-cpicker-color-opacity"),re=e("#rev-cpicker-orientation-radial"),er=e("#rev-cpicker-color-delete"),Qe=e("#rev-cpicker-grad-opacity"),me=e("#rev-cpicker-color-location"),we=e("#rev-cpicker-gradients-core"),$e=e(".rev-cpicker-orientation"),he=e("#rev-cpicker-iris-gradient"),Be=e("#rev-cpicker-wheel-point"),Ke=e("#rev-cpicker-gradients"),Ve=e("#rev-cpicker-iris-color"),le=e("#rev-cpicker-gradient-btn"),pe=e("#rev-cpicker-gradient-hex"),qe=e("#rev-cpciker-clear-hex"),se=e("#rev-cpicker-meta-reverse"),Me=e("#rev-cpicker-hit-bottom"),xr=e("#rev-cpicker-scroll"),nr=e("#rev-cpicker-colors"),fe=e("#rev-cpicker-color-hex"),ue=e("#rev-cpicker-color-btn"),ke=e("#rev-cpicker-color-box"),Q=e("#rev-cpicker-meta-angle"),Le=e("#rev-cpicker-wheel"),ae=e("#rev-cpicker-hit-top"),mr=e("#rev-cpicker"),X=e(document),Er.drag=D,Er.stop=B,Er.start=L,ue.data("state",nr.find(".rev-cpicker-color").eq(0).attr("data-color")||"#ffffff"),le.data("state",Ke.find(".rev-cpicker-color").eq(0).attr("data-color")||"linear-gradient(0deg, rgba(255, 255, 255, 1) 0%, rgba(0, 0, 0, 1) 100%)"),mr.draggable({containment:"window",handle:".rev-cpicker-draggable",stop:function(){mr.css("height","auto")}}),cr.perfectScrollbar({wheelPropagation:!1,suppressScrollX:!0}),Le.on("mousedown.revcpicker",function(e){$e.removeClass("selected"),Pe=!0,q(e)}).on("mousemove.revcpicker",function(e){Pe&&q(e)}).on("mouseleave.revcpicker mouseup.revcpicker",function(){Pe=!1}),e(".rev-cpicker-main-btn").on("click.revcpicker",function(){var r;if(De=-1===this.id.search("gradient"),dr&&(r=e(this).data("state")),De?(dr&&(ir=fe.val()),ce.removeClass("gradient-view").addClass("color-view")):(dr&&(ir=r),ce.removeClass("color-view").addClass("gradient-view"),We||we.children(".rev-cpicker-color").not(".blank").eq(0).click()),cr.perfectScrollbar("update"),r){var a="transparent"===r,t=a?"":r;a?dr.css("background",t):dr[0].style.background=t,kr=!0,e(".rev-cpicker-color").not(".blank").each(l),kr=!1,X.trigger("revcolorpickerupdate",[or,r])}}),e("#rev-cpicker-check").on("click.revcipicker",function(){var r,a,t;if(ce.hasClass("color-view")){var i=fe.val(),o=sr.val();or.removeData("gradient"),a="transparent"===i?"transparent":"100%"===o?RevColor.sanitizeHex(i):RevColor.processRgba(i,o),r=[or,a,!1]}else{x();var c=N(!1,!1,!0),n=e.extend({},c[0]),s=c[1];or.data("gradient",s),a=JSON.stringify(n).replace(/\"/g,"&"),r=[or,s,n]}(t=r[1]!==lr)&&(or.attr("data-color",r[1]).val(a).change(),X.trigger("revcolorpicker",r),_r&&_r(r[0],r[1],r[2])),y(!1,t)}),ce.on("click.revcpicker",function(r){if(ce.hasClass("open")){var a=r.target,t=e(a),i=a.id,o=-1!==a.className.search("rev-cpicker-point")||"rev-cpicker-section-right"===i||-1!==i.search("hit")||t.closest("#rev-cpicker-section-right, #rev-cpicker-point-wrap").length;o&&("text"===t.attr("type")?o=!t.attr("disabled"):"rev-cpicker-check-gradient"===i&&(o=!1)),o||x()}else Xe&&!1===/wheel|angle|reverse/.test(r.target.id)&&(-1===r.target.id.search("radial")&&e('.rev-cpicker-orientation[data-direction="'+parseInt(Q.val())+'"]').addClass("selected"),Le.removeClass("active"),Xe=!1)}),e(".rev-cpicker-close").on("click.revcpicker",y),Ve.wpColorPicker({palettes:!1,width:267,border:!1,hide:!1,change:function(e,r){var a=r.color.toString();if(this.value=a,fe.val(a),!gr){var t=sr.val();0===parseInt(t,10)&&(a="transparent"),v(!1,a,t),Cr&&(Cr.removeClass("selected"),Cr=!1)}}}),he.wpColorPicker({palettes:!1,height:250,border:!1,hide:!1,change:function(e,r){var a=r.color.toString();this.value=a,pe.val(a),ke.css("background",a),He.style.backgroundColor=a,Se.style.borderBottomColor=a;var t=RevColor.processRgba(a,100),i=RevColor.rgbValues(t,4),o=Ir.colors[Je];o.r=i[0],o.g=i[1],o.b=i[2],o.a=i[3],xe.attr("data-color",t),N()}}),xr.slider({orientation:"vertical",max:Tr,value:Tr,start:function(){fr="transparent"===fe.val()},slide:function(e,r){if(!yr){var a,t=parseInt(100*(r.value/Tr).toFixed(2),10);fr&&(a=t?"#ffffff":"transparent",fe.val(a)),0===t&&(a="transparent"),v(!1,a,t||"transparent"),sr.val(t+"%")}}}),e(".rev-cpicker-point-location").on("keyup.revcpicker focusout.revcpicker",function(e){if(xe){var r,a=xe.hasClass("rev-cpicker-point-bottom")?"bottom":"top",t="bottom"===a?je:Fe,i="bottom"===a?me:Ye,o=i.val().replace("%","")||"0",c=e.type;for(isNaN(o)&&(o="keyup"===c?"0":xe.attr("data-location")),r=(o=Math.max(0,Math.min(100,parseInt(o,10))))<50?1:-1;-1!==t.indexOf(o);)o+=r;"focusout"===c&&(i.val(o+"%"),xe.attr("data-location",o)),xe.css("left",o+"%"),N()}}).on("focusin.revcpicker",$),e("body").on("click.revcpicker",".rev-cpicker-point",function(){Ze.find(".rev-cpicker-point.active").removeClass("active"),xe=e(this).addClass("active"),He=xe.children(".rev-cpicker-point-square")[0],Se=xe.children(".rev-cpicker-point-triangle")[0],N(this),Cr=!1;var r=k();r[0]&&he.val(r[1]).change()}).on("mousedown.revcpicker",".rev-cpicker-point",function(r){xe=e(this).data("mousestart",r.pageY)}).on("mousemove.revcpicker",function(e){if(xe&&xe.data("mousestart")){var r=xe.data("mousestart"),a=e.pageY;xe.hasClass("rev-cpicker-point-bottom")?a>r&&a-r>Vr&&er.hasClass("active")?xe.addClass("warning"):xe.removeClass("warning"):r>a&&r-a>Vr&&hr.hasClass("active")?xe.addClass("warning"):xe.removeClass("warning")}}).on("mouseup.revcpicker",function(e){if(xe&&xe.data("mousestart")){var r=xe.data("mousestart"),a=e.pageY;xe.removeData("mousestart"),xe.hasClass("rev-cpicker-point-bottom")?a>r&&a-r>Sr&&er.hasClass("active")?er.click():xe.removeClass("warning"):r>a&&r-a>Sr&&hr.hasClass("active")?hr.click():xe.removeClass("warning")}}).on("change.revcpicker",".rev-cpicker-component",function(){var r=e(this),a=r.data("gradient")||r.val()||"transparent";("transparent"===a||RevColor.transparentRgba(a))&&(a=""),r.data("tpcp").css("background",a)}).on("keypress.revcpicker",function(e){if(ce.hasClass("active")){var r=e.which;27==r?y():13==r&&de&&de.blur()}}).on("click.revcpicker",".rev-cpicker-color:not(.blank)",function(){if(Cr){if(Cr[0]===this&&Cr.hasClass("selected"))return;Cr.removeClass("selected")}var r=(Cr=e(this)).parent()[0].id,a=-1!==r.search("core")?"core":"custom",t=-1!==r.search("colors")?"colors":"gradients",i=e("#rev-cpicker-"+t+"-"+a+"-btn");if(i.hasClass("active")&&i.find(".rev-cpicker-arrow-up").click(),ce.hasClass("color-view")){var o=Cr.attr("data-color");gr=!0,Ve.val(o).change(),"transparent"===fe.val()&&fe.val(o.toLowerCase()),gr=!1;var c=sr.val();0===parseInt(c,10)&&(o="transparent"),v(!1,o,c)}else ae.removeClass("full"),Me.removeClass("full"),d(Cr.data("gradient"),!0),se.removeClass("checked"),we.find(".rev-cpicker-color.selected").removeClass("selected");Cr.addClass("selected")}).on("mouseover.revcpicker",".rev-cpicker-color:not(.blank)",function(){ur&&(Ge.style.background=c(this,"data-color"))}).on("mouseout.revcpicker",".rev-cpicker-color:not(.blank)",function(){ur&&N()}).on("click.revcpicker",".rev-cpicker-delete",function(){if(oe){if(window.confirm(document.getElementById("rev-cpicker-remove-delete").innerHTML)){ce.addClass("onajax onajaxdelete");var r=e(this),a=r.parent(),t=a.attr("data-title")||"";if(!t)return void console.log("Preset does not have a name/title");var i=r.closest(".rev-cpicker-presets-group")[0].id,o=-1!==i.search("colors")?"colors":"gradients";X.off("revcpicker_onajax_delete.revcpicker").on("revcpicker_onajax_delete.revcpicker",function(t,o){o&&console.log(o);var c=r.closest(".rev-cpicker-presets-group"),n=c.find(".ps-scrollbar-x-rail"),s=e("#"+i+"-btn");a.remove(),R.call(c[0])?c.perfectScrollbar("update"):e('').insertBefore(n),w.call(c[0])').insertBefore(n),s.hasClass("active")&&s.children(".rev-cpicker-arrow-up").click()),ce.removeClass("onajax onajaxdelete")}),t=e.trim(t.replace(/\W+/g,"_")).replace(/^\_|\_$/g,"").toLowerCase(),oe("delete",t,o,"revcpicker_onajax_delete",or)}return!1}console.log("Ajax callback not defined")}),e(".rev-cpicker-save-preset-btn").on("click.revcpicker",function(){if(oe){var r,a,t=e(this),i=t.closest(".rev-cpicker-presets-save-as").find(".rev-cpicker-preset-save").val();if(i&&isNaN(i)){if(r=ce.hasClass("color-view")?"colors":"gradients",i=e.trim(i.replace(/\W+/g,"_")).replace(/^\_|\_$/g,"").toLowerCase(),e("#rev-cpicker-"+r+"-custom").find(".rev-cpicker-color").not(".blank").each(function(){if(e.trim(c(this,"data-title").replace(/\W+/g,"_")).replace(/^\_|\_$/g,"").toLowerCase()===i)return alert(t.attr("data-message")),a=!0,!1}),!a){ce.addClass("onajax onajaxsave");var o,n,l={};if("colors"===r){var p=fe.val(),v=sr.val();o="transparent"===p?"transparent":"100%"===v?RevColor.sanitizeHex(p):RevColor.processRgba(p,v)}else n=Ge.style.background,o=e.extend({},N(!1,!1,!0)[0]);l[i]=o,X.off("revcpicker_onajax_save.revcpicker").on("revcpicker_onajax_save.revcpicker",function(a,i){if(i)return ce.removeClass("onajax onajaxsave"),void alert(t.attr("data-message"));var o=e(s(l,!1," rev-picker-color-custom",n)),c=e("#rev-cpicker-"+r+"-custom"),p=c.find(".rev-cpicker-color.blank"),v=e("#"+c[0].id+"-btn");p.length?o.insertBefore(p.eq(0)):o.insertBefore(c.find(".ps-scrollbar-x-rail")),e("#rev-cpicker-"+r+"-custom-btn").click(),w.call(c[0])>6&&(p.length&&p.last().remove(),v.addClass("active").children(".rev-cpicker-arrow-down").click(),c.perfectScrollbar("update")),o.click(),ce.removeClass("onajax onajaxsave")}),oe("save",l,r,"revcpicker_onajax_save",or)}}else alert(t.attr("data-message"))}else console.log("Ajax callback not defined")}),e(".rev-cpicker-preset-title").on("click.revcpicker",function(){var r=e(this),a=r.parent(),t=r.hasClass("active")?"down":"up";z.call(r.find(".rev-cpicker-arrow-"+t)[0]),a.find(".rev-cpicker-preset-title").removeClass("selected"),r.addClass("selected"),a.find(".rev-cpicker-presets-group").hide(),document.getElementById(this.id.replace("-btn","")).style.display="block",cr.perfectScrollbar("update")}),qe.on("click.revcpicker",function(){sr.val("0%"),G(0),Ve.val(RevColor.defaultValue).change(),fe.val("transparent"),v(!1,"transparent")}),ce.find('input[type="text"]').on("focusin.revcpicker",function(){de=this}).on("focusout.revcpicker",function(){de=!1}),e(".rev-cpicker-input").on("focusin.revcpicker",function(){var r=e(this);r.data("orig-value",r.val())}),e(".rev-cpicker-hex").on("focusout.revcpicker",function(){var r,a,t;if("rev-cpicker-color-hex"===this.id){if(t=fe.val())if(t=RevColor.sanitizeHex(t),RevColor.isColor.test(t))fe.val(t);else{if(r=e(this),!(a=r.data("orig-value")))return void qe.click();t=a,fe.val(t)}else t="transparent";Ve.val(t).change()}else t=pe.val()||RevColor.defaultValue,t=RevColor.sanitizeHex(t),RevColor.isColor.test(t)||(t=(a=(r=e(this)).data("orig-value"))||RevColor.defaultValue),pe.val(t),he.val(t).change()}).on("focusin.revcpicker",$),e("#rev-cpciker-clear-gradient").on("click.revcpicker",function(){he.val(RevColor.defaultValue).change()}),Q.on("keyup.revcpicker focusout.revcpicker",P).on("focusin.revcpicker",function(){Xe=!0,Le.addClass("active")}).on("focusin.revcpicker",$),$e.on("click.revcpicker",function(){var r=e(this),a=r.attr("data-direction");$e.removeClass("selected"),r.addClass("selected"),"radial"!==a?Q.removeAttr("disabled").val(C(a)):Q.attr("disabled","disabled"),P(!1,a)}),e(".rev-cpicker-point-delete").on("click.revcpicker",function(){if(-1!==this.className.search("active")){var e=xe.hasClass("rev-cpicker-point-bottom")?"bottom":"top",r=ce.find(".rev-cpicker-point-"+e).length;r>2&&(xe.draggable("destroy").remove(),Ue=Ze.children(),ce.click(),N()),r<=Fr&&("bottom"===e?Me.removeClass("full"):ae.removeClass("full"))}}),e(".rev-cpicker-preset-save").on("focusin.revcpicker",$),e(".rev-cpicker-opacity-input").on("keyup.revcpicker focusout.revcpicker",function(r){var a,t=-1===this.id.search("grad"),i=t?sr:Qe,o=i.val().replace("%",""),c=r.type;if(isNaN(o)&&(o="keyup"===c?"0":e(this).data("orig-value")),o=Math.max(0,Math.min(100,o)),"focusout"===c&&(i.val(o+"%"),t||xe.attr("data-opacity",o)),t)v(!1,0===parseInt(o,10)&&"transparent",o),G(o);else{var n=RevColor.rgbValues(xe.attr("data-color"),3),s=Ir.colors[Je];o=(.01*parseInt(o,10)).toFixed(2).replace(/\.?0*$/,""),s.r=n[0],s.g=n[1],s.b=n[2],s.a=o,a=RevColor.rgbaString(s.r,s.g,s.b,o),xe.attr("data-color",a),N(),a="rgba(0, 0, 0, "+o+")",He.style.backgroundColor=a,Se.style.borderTopColor=a}}).on("focusin.revcpicker",$),e(".rev-cpicker-builder-hit").on("click.revcpicker",function(e){ee||V();for(var r=parseInt(100*((e.pageX-ae.offset().left)/Nr).toFixed(2),10),a=-1!==this.id.search("bottom")?"bottom":"top",t="bottom"===a?je:Fe,i=r<50?1:-1;-1!==t.indexOf(r);)r+=i;"bottom"===a?ce.find(".rev-cpicker-point-bottom").length
\t



\t
{{delete}}
{{delete}}
').appendTo(Z)),r||(r={}),r.core&&(r.core.colors&&(Pr=r.core.colors),r.core.gradients&&(zr=r.core.gradients)),Y(r),ne?(cr.perfectScrollbar("update"),r.mode&&(ve=r.mode),r.language&&n(r.language)):(n(r.language||Or),ve=r.mode||"full"),r.init&&(ie=r.init),r.onAjax&&(be=r.onAjax),r.onEdit&&(ge=r.onEdit),r.change&&(Ie=r.change),r.cancel&&(_e=r.cancel),r.widgetId&&(tr=r.widgetId),r.defaultValue&&(RevColor.defaultValue=r.defaultValue),r.wrapClasses&&(Rr=r.wrapClasses),r.appendedHtml&&(vr=r.appendedHtml),ne=!0};var Dr={refresh:function(){var r=e(this);if(r.hasClass("rev-cpicker-component")){var a=r.data("revcp")||{},t=r.val()||a.defaultValue||RevColor.defaultValue,i=RevColor.process(t);t=i[0],i="rgba"===i[1]&&RevColor.transparentRgba(t,!0)?"":t,"transparent"!==t?r.data("tpcp")[0].style.background=i:r.data("tpcp").css("background",""),r.attr("data-color",t).data("hex",t)}},destroy:function(){e(this).removeData().closest(".rev-cpicker-master-wrap").removeData().remove()}};e.fn.tpColorPicker=function(r){return r&&"string"==typeof r?this.each(Dr[r]):this.each(function(){var a=e(this);if(a.hasClass("rev-cpicker-component"))a.tpColorPicker("refresh");else{var t,i,o=e('').data("revcolorinput",a),c=e(''),n=e(''),s=a.attr("data-wrap-classes"),l=a.attr("data-wrapper"),p=a.attr("data-wrap-id"),v=a.attr("data-title"),d=a.attr("data-skin"),g=a.val()||"",b=W(g);if(b&&(g=b,a.val(b)),o.insertBefore(a).append([c,n,a]),r&&e.isPlainObject(r)){l||(l=r.wrapper),s||(s=r.wrapClasses),d||(d=r.skin),p||(p=r.wrapId),v||(v=r.title),i=r.defaultValue;var k=a.data("revcp");k&&(r=e.extend({},k,r)),a.data("revcp",r)}s||(s=Rr),s&&o.addClass(s),p&&o.attr("id",p),g||(g=i||RevColor.defaultValue,a.val(g)),g=(t=RevColor.process(g))[0],3===t.length&&a.val(g),"transparent"!==(t="rgba"===t[1]&&RevColor.transparentRgba(g,!0)?"":g)&&(c[0].style.background=t),n[0].innerHTML=v||Te||Or.color,a.attr({type:"hidden","data-color":g}).data("tpcp",c).addClass("rev-cpicker-component"),d&&o.addClass(d),l?(l=e(l).addClass("rev-cpicker-master-wrap"),o.wrap(l)):o.addClass("rev-cpicker-master-wrap");var u=!!r&&(r.init||ie);u&&u(o,a,g,r)}})},e(function(){e("body").on("click.revcpicker",".rev-colorpicker",function(){U||J();var r,a,t,i,o,c,s,p,v,g,b,k,u,f=(or=e(this).data("revcolorinput")).attr("data-widget-id"),m=or.attr("data-appended-html"),h=or.attr("data-editing"),C=or.attr("data-colors"),x=or.attr("data-mode"),y=or.data("revcp"),R=or.attr("data-lang");if(C&&((C=JSON.parse(C.replace(/\&/g,'"'))).colors&&(c=C.colors),C.gradients&&(i=C.gradients)),y){var _=y.colors;_&&(_.core&&(t=_.core.colors,r=_.core.gradients),_.custom&&(o=_.custom.colors,a=_.custom.gradients)),b=y.onEdit,k=y.onAjax,p=y.change,v=y.cancel,R||(R=y.lang),x||(x=y.mode),m||(m=y.appendedHtml),h||(h=y.editing),f||(f=y.widgetId)}(r||t||a||o||i||c)&&(s={},(r||t||i||c)&&(s.core={colors:c||t||Pr,gradients:i||r||zr}),(a||o)&&(s.custom={colors:o||Pr,gradients:a||zr}),Y(s)),f||(f=tr),f&&(ce[0].id=f),m||(m=vr),m&&(ye=e(m).appendTo(mr)),R&&n(R),x||(x=ve),h?ze.style.visibility="visible":(h="",ze.style.visibility="hidden"),wr.innerHTML=h,"single"===x||"basic"===x?(K=!1,le.hide(),ue.show(),"basic"===x&&ce.addClass("is-basic")):(K=!0,le.show(),ue.show()),(u=or.val()||or.attr("data-color")||RevColor.defaultValue).split("||").length>1&&(u=RevColor.joinToRgba(u),or.val(u)),g=d(u),lr=g[0],te=b||ge,oe=k||be,Re=v||_e,_r=p||Ie,"gradient"!==g[1]?ue.data("state",lr):le.data("state",lr),Z.addClass("rev-colorpicker-open"),dr=or.data("tpcp"),ce.data("revcpickerinput",or).addClass("active").show(),cr.each(w).perfectScrollbar("update"),pr=or.attr("data-color"),ir=or.data("hex"),e(".rev-cpicker-color").not(".blank").each(l)})})}("undefined"!==jQuery&&jQuery);