(function(){var n=/\s*[+-]\d*\.?\d+/,q=function(i,s){var r=Math.pow(10,parseInt(s)||0);return Math.round(i*r)/r},f=function(s,r,i){return Math.max(s,Math.min(r,i))},e=function(i){i._dec=parseInt(i._hex.substr(1),16)},l=function(i){var r=i._dec.toString(16);i._hex="#000000".substr(0,7-r.length)+r.toUpperCase()},d=function(i){i._rgb=[i._dec>>16,(i._dec>>8)&255,i._dec&255]},c=function(i){i._dec=i._rgb[0]<<16|(i._rgb[1]<<8)&65535|i._rgb[2]},m=function(u){var i=u._rgb[0]/255,x=u._rgb[1]/255,A=u._rgb[2]/255,v=Math.min(i,Math.min(x,A)),B=Math.max(i,Math.max(x,A)),y=B+v,z=B-v,t=y/2,C=t>0&&t<1?z/(t<.5?y:(2-y)):0,w=z>0?B==i?(x-A)/z+(x1?-1:0);return q((i*6<1?s+(r-s)*i*6:i*2<1?r:i*3<2?s+(r-s)*(2/3-i)*6:s)*255,2)},p=function(r){var u=r._hsl[0]/360,t=r._hsl[1]/100,i=r._hsl[2]/100;if(t==0){i=q(i*255);r._rgb=[i,i,i]}else{var v=i<.5?i*(1+t):i+t-i*t,w=2*i-v;r._rgb=[b(w,v,u+1/3),b(w,v,u),b(w,v,u-1/3)]}},k=function(s,i){if(i===undefined||i===null)return !1;switch(s){case"rgb":return f(0,parseInt(i),255);case"h":return((parseFloat(i)%360)+360)%360;case"sl":return f(0,parseFloat(i),100);case"hex":var r=i.match(/#([0-9a-f]{6}|[0-9a-f]{3})/i);if(r){r=r[1].toUpperCase();if(r.length==3){r=r.replace(/([0-9A-F])/g,"$1$1")}return"#"+r}}return !1},g=function(i,r){switch(r){case"rgb":c(i);l(i);m(i);break;case"hsl":p(i);c(i);l(i);break;case"hex":e(i);d(i);m(i);break}if(i._fn)i._fn.call(i);},j=["red","green","blue"],o=["hue","saturation","lightness"],a=function(i,r){this._rgb=[0,0,0];this._hsl=[0,0,0];this._hex="#000000";this._dec=0;this._fn=r;this.hex(i)};a.prototype.rgb=function(s){if(s==undefined||s==null){return this._rgb}var u=k("rgb",s[0]),t=k("rgb",s[1]),i=k("rgb",s[2]);if(u===!1||t===!1||i===!1)return this;if(this._rgb[0]!=u||this._rgb[1]!=t||this._rgb[2]!=i){this._rgb=[u,t,i];g(this,"rgb")}return this};a.prototype.hsl=function(r){if(r==undefined||r==null)return this._hsl;var u=k("h",r[0]),t=k("sl",r[1]),i=k("sl",r[2]);if(u===!1||t===!1||i===!1)return this;if(this._hsl[0]!=u||this._hsl[1]!=t||this._hsl[2]!=i){this._hsl=[u,t,i];g(this,"hsl")}return this};a.prototype.hex=function(r){if(r==undefined||r==null)return this._hex;var i=k("hex",r);if(i&&this._hex!=i){this._hex=i;g(this,"hex")}return this};for(var h=0;h<3;h++){a.prototype[j[h]]=(function(r){return function(i){if(i===undefined||i===null)return this._rgb[r];var s=i;if(typeof i=="string"&&i.match(n))s=this._rgb[r]+parseInt(i);s=k("rgb",s);if(s!==!1&&s!=this._rgb[r]){this._rgb[r]=s;g(this,"rgb")}return this}})(h);a.prototype[o[h]]=(function(r){return function(i){if(i===undefined||i===null)return this._hsl[r];var s=i;if(typeof i=="string"&&i.match(n)){s=this._hsl[r]+parseFloat(i)}s=k(r==0?"h":"sl",s);if(s!==!1&&this._hsl[r]!=s){this._hsl[r]=s;g(this,"hsl")}return this}})(h)}a.prototype.fn=function(){if(this._fn)return this._fn.apply(this,arguments);return this};a.prototype.toString=function(){return this._hex};window.kt_Color=a})(); (function(h){var d='
',b=84,g=100,c=97,f=!1,a=function(){var i=this.currentStyle.backgroundImage;if(i!="none")h(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+i.substring(5,i.length-2)+"')"});},e=function(k,w){var y=h(k).html(d),r=h(document),n=y.children(),v=n.children(".wheel"),o=n.children(".h-marker"),m=n.children(".sl-marker"),p=n.children(".color"),j=!1,q=new kt_Color("#000000",function(){var z=this._hsl[0]*6.28/360;o.css({left:Math.round(Math.sin(z)*b)+c,top:Math.round(-Math.cos(z)*b)+c});m.css({left:c-Math.round(g*(this._hsl[1]/100-.5)),top:c-Math.round(g*(this._hsl[2]/100-.5))});p.css("backgroundColor",i.hue(q._hsl[0]).hex());if(w)w.call(this);}),i=new kt_Color("#FF0000"),x=function(z){var A=v.offset();return{x:(z.pageX-A.left)-c,y:(z.pageY-A.top)-c}},l=function(z){if(z.which!=1)return !1;if(!f){r.on(u);f=!0}var A=x(z);j=Math.max(Math.abs(A.x),Math.abs(A.y))*2>g;t(z);return !1},t=function(z){var A=x(z);q.hsl(j?[Math.atan2(A.x,-A.y)*360/6.28,q._hsl[1],q._hsl[2]]:[q._hsl[0],-100*(A.x/g)+50,-100*(A.y/g)+50])},s=function(){r.off(u);f=!1},u={mousemove:t,mouseup:s};if(String(navigator.appVersion).match(/MSIE [0-6]\./))n.children().each(a);n.on("mousedown",l);return q};window.kt_Color_Picker=e})(jQuery); (function(b,a){b(function(){var C=b(document),y=b("#kt_editor"),c=b("#kt_colors"),z=b(a.replace(/%1\$s/g,"#000000").replace(/%2\$s/g,"").replace(/%3\$s/g,"x")),d=b("#kt_picker"),m=null,f=b(),t=kt_Color_Picker(d,function(){if(m){var D=this.hex();m.siblings(".hex").val(D);m.children(".preview").css("backgroundColor",D)}}),B=function(E){var D=String(E).toUpperCase().match(/([0-9A-F]{6}|[0-9A-F]{3})/);return D?D[1].length==3?"#"+D[1].replace(/([0-9A-F])/g,"$1$1"):"#"+D[1]:!1},k=function(){return d.attr("aria-hidden")=="true"},v=function(){d.attr("aria-hidden","true");C.off("mousedown",n)},n=function(D){if(!b(D.target).closest(m).length)v();},s=function(D){if(D.which==1){if(k()){C.on("mousedown",n);m=b(this);d.attr("aria-hidden","false").position({of:m,at:"left bottom",my:"left top-2px"})}else{v()}}},r=function(){var E=b(this),D=B(E.val());if(D){E.val(D).parent().find(".preview").css("backgroundColor",D)}},x=function(D){if(b(D.target).is(".picker"))if(D.type=="focusin"){f=b(this).attr("aria-grabbed","true").on("keydown",u)}else f.attr("aria-grabbed","false").off("keydown",u);},l=function(){if(f.prev().length){f.after(f.prev());return !1}},q=function(){if(f.next().length){f.before(f.next());return !1}},j=function(){if(f.next().length){f=f.next().trigger("focus");return !1}},i=function(){if(f.prev().length){f=f.prev().trigger("focus");return !1}},u=function(D){switch(D.which){case 33:return l();case 34:return q()}if(o(D)){switch(D.which){case 37:case 38:return l();case 39:case 40:return q()}}switch(D.which){case 13:f.children(".color").trigger("focus");return !1;case 37:case 38:return i();case 39:case 40:return j();case 35:f.appendTo(c).trigger("focus");return !1;case 36:f.prependTo(c).trigger("focus");return !1;case 46:g();break;case 27:f.trigger("blur");break}},g=function(){var D=f.next();if(!D.length)D=f.prev();f.remove();D.trigger("focus")},e=function(D){if(D.type=="focusin"){m=b(this).on("keydown",w);t.hex(m.siblings(".hex").val()).fn()}else{v();m.off("keydown",w);m=null}},w=function(F){var D=o(F)?5:2.5,E="+"+D,G="-"+D;switch(F.which){case 109:case 189:t.hue(G);return !1;case 107:case 187:t.hue(E);return !1;case 38:t.lightness(E);return !1;case 40:t.lightness(G);return !1;case 37:t.saturation(E);return !1;case 39:t.saturation(G);return !1;case 27:return A(m)}},A=function(D){k()?D.parent().trigger("focus"):v();return !1},h=function(F){if(F.type=="focusin"){var E=b(this);if(B(this.value)){E.data("lastValue",this.value)}var D=E.data("autoFill");if(D){clearTimeout(D);E.removeData("autoFill")}}else{if(!B(this.value)){v();var E=b(this);E.data("autoFill",setTimeout(function(){E.val(E.data("lastValue"));E.addClass("revert");setTimeout(function(){E.removeClass("revert")},500)},5000))}}},p=function(D){switch(D.which){case 27:b(this).parent().trigger("focus");break;case 13:D.preventDefault();break}},o=function(D){return D.ctrlKey||D.shiftKey||D.metaKey};b("#kt_custom").on("change",function(){y.attr("aria-hidden",this.checked?"false":"true")});b("#kt_add").on("click",function(E){var D=z.clone();D.appendTo(c);D.children(".hex").prop({selectionStart:1,selectionEnd:7}).trigger("focus");E.preventDefault()});c.on("click",".remove",function(D){f=b(this).parent();g();D.preventDefault()}).on("mousedown",".picker",function(D){if(b(D.target).is(".picker"))b(this).trigger("focus")}).on("focus blur",".picker",x).on("click",".color",s).on("focus blur",".color",e).on("change",".hex",r).on("focus blur",".hex",h).on("keydown","input",p).sortable({placeholder:"picker-placeholder",items:".picker",delay:b(document.body).hasClass("mobile")?200:0,distance:2,revert:130,stop:function(E,D){D.item.css("zIndex","").trigger("focus")}})})})(jQuery,kt_TinyMCE_color_picker);