diff --git a/editor/browser.js b/editor/browser.js index 09a30c1..52709cd 100644 --- a/editor/browser.js +++ b/editor/browser.js @@ -75,19 +75,19 @@ var supportsPathInsertItemBefore_ = (function() { // text character positioning (for IE9) var supportsGoodTextCharPos_ = (function() { - var retValue = false; - var svgroot = document.createElementNS(svgns, 'svg'); - var svgcontent = document.createElementNS(svgns, 'svg'); - document.documentElement.appendChild(svgroot); - svgcontent.setAttribute('x', 5); - svgroot.appendChild(svgcontent); - var text = document.createElementNS(svgns,'text'); - text.textContent = 'a'; - svgcontent.appendChild(text); - var pos = text.getStartPositionOfChar(0) - pos = pos.x; //if you put it on one line it fails when compiled - document.documentElement.removeChild(svgroot); - return (pos === 0); + // var retValue = false; + // var svgroot = document.createElementNS(svgns, 'svg'); + // var svgcontent = document.createElementNS(svgns, 'svg'); + // document.documentElement.appendChild(svgroot); + // svgcontent.setAttribute('x', 5); + // svgroot.appendChild(svgcontent); + // var text = document.createElementNS(svgns,'text'); + // text.textContent = 'a'; + // svgcontent.appendChild(text); + // var pos = text.getStartPositionOfChar(0) + // pos = pos.x; //if you put it on one line it fails when compiled + // document.documentElement.removeChild(svgroot); + // return (pos === 0); })(); var supportsPathBBox_ = (function() { diff --git a/editor/svgedit.compiled.js b/editor/svgedit.compiled.js index b4a7be7..4e7f240 100644 --- a/editor/svgedit.compiled.js +++ b/editor/svgedit.compiled.js @@ -1,31 +1,31 @@ function touchHandler(a){var q=a.changedTouches,h=q[0],b="";switch(a.type){case "touchstart":b="mousedown";break;case "touchmove":b="mousemove";break;case "touchend":b="mouseup";break;default:return}var n=document.createEvent("MouseEvent");n.initMouseEvent(b,true,true,window,1,h.screenX,h.screenY,h.clientX,h.clientY,false,false,false,false,0,null);if(q.length<2){h.target.dispatchEvent(n);a.preventDefault()}};(function(a){function q(h){if(typeof h.data==="string"){var b=h.handler,n=h.data.toLowerCase().split(" ");h.handler=function(u){if(!(this!==u.target&&(/textarea|select/i.test(u.target.nodeName)||u.target.type==="text"))){var c=u.type!=="keypress"&&a.hotkeys.specialKeys[u.which],f=String.fromCharCode(u.which).toLowerCase(),d="",l={};if(u.altKey&&c!=="alt")d+="alt+";if(u.ctrlKey&&c!=="ctrl")d+="ctrl+";if(u.metaKey&&!u.ctrlKey&&c!=="meta")d+="meta+";if(u.shiftKey&&c!=="shift")d+="shift+";if(c)l[d+c]= true;else{l[d+f]=true;l[d+a.hotkeys.shiftNums[f]]=true;if(d==="shift+")l[a.hotkeys.shiftNums[f]]=true}c=0;for(f=n.length;c","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(da){return typeof da==="string"}function b(da){var U=d.call(arguments,1);return function(){return da.apply(this,U.concat(d.call(arguments)))}}function n(da,U,Y,oa,pa){var la;if(oa!==f){U=Y.match(da?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(pa===2&&h(oa))oa=oa.replace(da?V:aa,"");else{la=p(U[2]);oa=h(oa)?p[da?ha:M](oa):oa;oa=pa===2?oa:pa===1?a.extend({},oa,la):a.extend({},la,oa);oa=s(oa);if(da)oa=oa.replace(ra,l)}da=U[1]+(da?"#":oa||!U[1]?"?":"")+oa+Y}else da= -U(Y!==f?Y:q[na][fa]);return da}function u(da,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[da?ha:M]()}else U=h(U)?U.replace(da?V:aa,""):U;return p(U,Y)}function c(da,U,Y,oa){if(!h(Y)&&typeof Y!=="object"){oa=Y;Y=U;U=f}return this.each(function(){var pa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&pa.attr(la)||"";pa.attr(la,s[da](ma,Y,oa))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",ha="fragment",na= -"location",fa="href",aa=/^.*\?|#.*$/g,V=/^.*\#/,ra,ia={};s[M]=b(n,0,function(da){return da.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[ha]=C=b(n,1,function(da){return da.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(da){da=da||"";da=a.map(da.split(""),encodeURIComponent);ra=RegExp(da.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(da,U){var Y={},oa={"true":true,"false":false,"null":null};a.each(da.replace(/\+/g," ").split("&"),function(pa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia= -0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:oa[ma]!==f?oa[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:q}})})(jQuery);(function(a,q){function h(ea){return typeof ea==="string"}function b(ea){var U=d.call(arguments,1);return function(){return ea.apply(this,U.concat(d.call(arguments)))}}function n(ea,U,Y,na,oa){var la;if(na!==f){U=Y.match(ea?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);Y=U[3]||"";if(oa===2&&h(na))na=na.replace(ea?W:ca,"");else{la=p(U[2]);na=h(na)?p[ea?aa:M](na):na;na=oa===2?na:oa===1?a.extend({},na,la):a.extend({},la,na);na=s(na);if(ea)na=na.replace(ra,l)}ea=U[1]+(ea?"#":na||!U[1]?"?":"")+na+Y}else ea= +U(Y!==f?Y:q[qa][ha]);return ea}function u(ea,U,Y){if(U===f||typeof U==="boolean"){Y=U;U=s[ea?aa:M]()}else U=h(U)?U.replace(ea?W:ca,""):U;return p(U,Y)}function c(ea,U,Y,na){if(!h(Y)&&typeof Y!=="object"){na=Y;Y=U;U=f}return this.each(function(){var oa=a(this),la=U||P()[(this.nodeName||"").toLowerCase()]||"",ma=la&&oa.attr(la)||"";oa.attr(la,s[ea](ma,Y,na))})}var f,d=Array.prototype.slice,l=decodeURIComponent,s=a.param,C,p,L,R=a.bbq=a.bbq||{},O,K,P,T=a.event.special,M="querystring",aa="fragment",qa= +"location",ha="href",ca=/^.*\?|#.*$/g,W=/^.*\#/,ra,ia={};s[M]=b(n,0,function(ea){return ea.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});s[aa]=C=b(n,1,function(ea){return ea.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ea){ea=ea||"";ea=a.map(ea.split(""),encodeURIComponent);ra=RegExp(ea.join("|"),"g")};C.noEscape(",/");a.deparam=p=function(ea,U){var Y={},na={"true":true,"false":false,"null":null};a.each(ea.replace(/\+/g," ").split("&"),function(oa,la){var ma=la.split("="),Ba=l(ma[0]),Ea=Y,Ia= +0,za=Ba.split("]["),Ka=za.length-1;if(/\[/.test(za[0])&&/\]$/.test(za[Ka])){za[Ka]=za[Ka].replace(/\]$/,"");za=za.shift().split("[").concat(za);Ka=za.length-1}else Ka=0;if(ma.length===2){ma=l(ma[1]);if(U)ma=ma&&!isNaN(ma)?+ma:ma==="undefined"?f:na[ma]!==f?na[ma]:ma;if(Ka)for(;Ia<=Ka;Ia++){Ba=za[Ia]===""?Ea.length:za[Ia];Ea=Ea[Ba]=Ia').hide().insertAfter("body")[0].contentWindow; -K=function(){return b(R.document[c][f])};O=function(P,T){if(P!==T){var M=R.document;M.open().close();M[c].hash="#"+P}};O(b())}}var p={},L,R,O,K;p.start=function(){if(!L){var P=b();O||C();(function T(){var M=b(),ha=K(P);if(M!==P){O(P=M,ha);a(q).trigger("hashchange")}else if(ha!==P)q[c][f]=q[c][f].replace(/#.*/,"")+"#"+ha;L=setTimeout(T,a.hashchangeDelay)})()}};p.stop=function(){if(!R){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var q={},h;a.svgIcons=function(b,n){function u(da,U){if(da!=="ajax"){if(P)return;var Y=(R=fa[0].contentDocument)&&R.getElementById("svg_eof");if(!Y&&!(U&&Y)){T++;if(T<50)setTimeout(u,20);else{f();P=true}return}P=true}L=a(R.firstChild).children();if(n.no_img)setTimeout(function(){K||c()},500);else{Y=na+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";O=a(new Image).attr({src:Y,width:0,height:0}).appendTo("body").load(function(){c(true)}).error(function(){c()})}} -function c(da,U){if(!K){if(n.no_img)da=false;if(da){var Y=a(document.createElement("div"));Y.hide().appendTo("body")}if(U){var oa=n.fallback_path?n.fallback_path:"";a.each(U,function(Ka,Na){a("#"+Ka);var Aa=a(new Image).attr({"class":"svg_icon",src:oa+Na,width:C,height:p,alt:"icon"});ia(Aa,Ka)})}else for(var pa=L.length,la=0;la0&&!da)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){da&&Y.remove();fa&&fa.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var da=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(da,n)}else n.fallback&&c(false,n.fallback)} -function d(da){if(window.btoa)return window.btoa(da);var U=Array(Math.floor((da.length+2)/3)*4),Y,oa,pa,la,ma,Ba,Ea=0,Ia=0;do{Y=da.charCodeAt(Ea++);oa=da.charCodeAt(Ea++);pa=da.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|oa>>4;ma=(oa&15)<<2|pa>>6;Ba=pa&63;if(isNaN(oa))ma=Ba=64;else if(isNaN(pa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); -U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea-1&&M.indexOf("Chrome/");var na="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var fa=a('').appendTo("body").hide();try{R=fa[0].contentDocument;fa.load(u); -u(0,true)}catch(aa){f()}}else{var V=new DOMParser;a.ajax({url:b,dataType:"string",success:function(da){if(da){R=V.parseFromString(da,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(da){if(window.opera)a(function(){f()});else if(da.responseText){R=V.parseFromString(da.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(da,U,Y,oa){ha&&U.css("visibility","hidden");if(n.replace){oa&&U.attr("id",Y);(Y=da.attr("class"))&&U.attr("class", -"svg_icon "+Y);da.replaceWith(U)}else da.append(U);ha&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(da,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,da,U,true);q[U]=da};h=function(da,U){var Y=da.find("defs");if(!Y.length)return da;Y=ha?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var oa=da[0].getElementsByTagName("*"),pa=oa.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la= -0;la0&&!ea)ya=h(ya,Aa,true);ra(a(this),ya,Na)})});if(!U){ea&&Y.remove();ha&&ha.remove();O&&O.remove()}n.resize&&a.resizeSvgIcons(n.resize);K=true;n.callback&&n.callback(q)}}function f(){if(b.indexOf(".svgz")!=-1){var ea=b.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ea,n)}else n.fallback&&c(false,n.fallback)} +function d(ea){if(window.btoa)return window.btoa(ea);var U=Array(Math.floor((ea.length+2)/3)*4),Y,na,oa,la,ma,Ba,Ea=0,Ia=0;do{Y=ea.charCodeAt(Ea++);na=ea.charCodeAt(Ea++);oa=ea.charCodeAt(Ea++);la=Y>>2;Y=(Y&3)<<4|na>>4;ma=(na&15)<<2|oa>>6;Ba=oa&63;if(isNaN(na))ma=Ba=64;else if(isNaN(oa))Ba=64;U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(la);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Y);U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma); +U[Ia++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Ba)}while(Ea-1&&M.indexOf("Chrome/");var qa="data:image/svg+xml;charset=utf-8;base64,";if(n.svgz){var ha=a('').appendTo("body").hide();try{R=ha[0].contentDocument;ha.load(u); +u(0,true)}catch(ca){f()}}else{var W=new DOMParser;a.ajax({url:b,dataType:"string",success:function(ea){if(ea){R=W.parseFromString(ea,"text/xml");a(function(){u("ajax")})}else a(f)},error:function(ea){if(window.opera)a(function(){f()});else if(ea.responseText){R=W.parseFromString(ea.responseText,"text/xml");R.childNodes.length||a(f);a(function(){u("ajax")})}else a(f)}})}var ra=function(ea,U,Y,na){aa&&U.css("visibility","hidden");if(n.replace){na&&U.attr("id",Y);(Y=ea.attr("class"))&&U.attr("class", +"svg_icon "+Y);ea.replaceWith(U)}else ea.append(U);aa&&setTimeout(function(){U.removeAttr("style")},1)},ia=function(ea,U){if(n.id_match===undefined||n.id_match!==false)ra(holder,ea,U,true);q[U]=ea};h=function(ea,U){var Y=ea.find("defs");if(!Y.length)return ea;Y=aa?Y.find("*").filter(function(){return!!this.id}):Y.find("[id]");var na=ea[0].getElementsByTagName("*"),oa=na.length;Y.each(function(la){var ma=this.id;a(R).find("#"+ma);this.id=la="x"+ma+U+la;ma="url(#"+ma+")";var Ba="url(#"+la+")";for(la= +0;la=0;jQuery.fn.jGraduate=function(b){var n= -arguments;return this.each(function(){function u(ja,ba,ka,N,Q){var ea=Q||a("stop",{"stop-color":ba,"stop-opacity":ka,offset:ja},V);if(Q){ba=Q.getAttribute("stop-color");ka=Q.getAttribute("stop-opacity");ja=Q.getAttribute("offset")}else V.appendChild(ea);if(ka===null)ka=1;Q=a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:"url(#jGraduate_trans)",transform:"translate("+(10+ja*ha)+", 26)"},nb);var Fa= -a("path",{d:"M-6.2,0.9c3.6-4,6.7-4.3,6.7-12.4c-0.2,7.9,3.1,8.8,6.5,12.4c3.5,3.8,2.9,9.6,0,12.3c-3.1,2.8-10.4,2.7-13.2,0C-9.6,9.9-9.4,4.4-6.2,0.9z",fill:ba,"fill-opacity":ka,transform:"translate("+(10+ja*ha)+", 26)",stroke:"#000","stroke-width":1.5},nb);$(Fa).mousedown(function(Oa){c(this);Wa=fb;P.mousemove(l).mouseup(f);wa=Ya.offset();Oa.preventDefault();return false}).data("stop",ea).data("bg",Q).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Oa=this,Va=+ea.getAttribute("stop-opacity")|| -1,$a=ea.getAttribute("stop-color")||1,qb=(parseFloat(Va)*255).toString(16);qb.length<2;)qb="0"+qb;ba=$a.substr(1)+qb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:C.images.clientPath},color:{active:ba,alphaSupport:true}},function(Qa){$a=Qa.val("hex")?"#"+Qa.val("hex"):"none";Va=Qa.val("a")!==null?Qa.val("a")/256:1;Oa.setAttribute("fill",$a);Oa.setAttribute("fill-opacity",Va);ea.setAttribute("stop-color", -$a);ea.setAttribute("stop-opacity",Va);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(V).find("stop").each(function(){var Oa=$(this);if(+this.getAttribute("offset")>ja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");ea.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);ea.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity", -$a===null?1:$a)}Oa.before(ea);return false}});N&&c(Fa);return ea}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?V.removeAttribute("gradientTransform"):V.setAttribute("gradientTransform", -ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>ha+10?ha+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/ha);var N=0;$(V).find("stop").each(function(){var Q=this.getAttribute("offset"), -ea=$(this);if(Qja){if(!ba){var Va=this.getAttribute("stop-color"),$a=this.getAttribute("stop-opacity");fa.setAttribute("stop-color",Va);Fa.setAttribute("fill",Va);fa.setAttribute("stop-opacity",$a===null?1:$a);Fa.setAttribute("fill-opacity", +$a===null?1:$a)}Oa.before(fa);return false}});N&&c(Fa);return fa}function c(ja){fb&&fb.setAttribute("stroke","#000");ja.setAttribute("stroke","blue");fb=ja;fb.parentNode.appendChild(fb)}function f(){P.unbind("mousemove",l);if(Ca.getAttribute("display")!=="none"){Ca.setAttribute("display","none");var ja=$(fb),ba=ja.data("stop");ja=ja.data("bg");$([fb,ba,ja]).remove()}Wa=null}function d(){var ja=Ra?"rotate("+Ra+","+Da+","+gb+") ":"";db===1&&La===1?W.removeAttribute("gradientTransform"):W.setAttribute("gradientTransform", +ja+"translate("+-Da*(db-1)+","+-gb*(La-1)+") scale("+db+","+La+")")}function l(ja){var ba=ja.pageX-wa.left;ja=ja.pageY-wa.top;ba=ba<10?10:ba>aa+10?aa+10:ba;var ka="translate("+ba+", 26)";if(ja<-60||ja>130){Ca.setAttribute("display","block");Ca.setAttribute("transform",ka)}else Ca.setAttribute("display","none");Wa.setAttribute("transform",ka);$.data(Wa,"bg").setAttribute("transform",ka);$.data(Wa,"stop").setAttribute("offset",(ba-10)/aa);var N=0;$(W).find("stop").each(function(){var Q=this.getAttribute("offset"), +fa=$(this);if(Q
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var T=$(L+"> .jGraduate_colPick"),M=$(L+"> .jGraduate_gradPick");M.html('

    '+C.window.pickerTitle+'


    ');var ha=256,na=ha-0,fa=ha-0,aa,V,ra,ia={};$(".jGraduate_SliderBar").width(145);var da=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:ha,height:ha,xmlns:q.svg},da);aa=aa||s.paint.type;var Y=V=s.paint[aa],oa=s.paint.alpha,pa=aa==="solidColor";switch(aa){case "solidColor":case "linearGradient":if(!pa){V.id=p+"_lg_jgraduate_grad"; -Y=V=U.appendChild(V)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(aa==="linearGradient")break;case "radialGradient":if(!pa){V.id=p+"_rg_jgraduate_grad";Y=V=U.appendChild(V)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(pa){Y=V=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[aa];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16); +p+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/>');var aa=256,qa=aa-0,ha=aa-0,ca,W,ra,ia={};$(".jGraduate_SliderBar").width(145);var ea=$("#"+p+"_jGraduate_GradContainer")[0],U=a("svg",{id:p+"_jgraduate_svg",width:aa,height:aa,xmlns:q.svg},ea);ca=ca||s.paint.type;var Y=W=s.paint[ca],na=s.paint.alpha,oa=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!oa){W.id=p+"_lg_jgraduate_grad"; +Y=W=U.appendChild(W)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},U);if(ca==="linearGradient")break;case "radialGradient":if(!oa){W.id=p+"_rg_jgraduate_grad";Y=W=U.appendChild(W)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},U)}if(oa){Y=W=$("#"+p+"_lg_jgraduate_grad")[0];K=s.paint[ca];u(0,"#"+K,1);var la=typeof C.newstop;if(la==="string")switch(C.newstop){case "same":u(1,"#"+K,1);break;case "inverse":la="";for(var ma=0;ma<6;ma+=2){K.substr(ma,2);var Ba=(255-parseInt(K.substr(ma,2),16)).toString(16); if(Ba.length<2)Ba=0+Ba;la+=Ba}u(1,"#"+la,1);break;case "white":u(1,"#ffffff",1);break;case "black":u(1,"#000000",1)}else if(la==="object")u(1,C.newstop.color||"#"+K,"opac"in C.newstop?C.newstop.opac:1)}K=parseFloat(Y.getAttribute("x1")||0);la=parseFloat(Y.getAttribute("y1")||0);ma=parseFloat(Y.getAttribute("x2")||1);Ba=parseFloat(Y.getAttribute("y2")||0);var Ea=parseFloat(Y.getAttribute("cx")||0.5),Ia=parseFloat(Y.getAttribute("cy")||0.5),za=parseFloat(Y.getAttribute("fx")||Ea),Ka=parseFloat(Y.getAttribute("fy")|| -Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:na,height:fa,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":oa/100},U);var Na=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*ha,left:K*ha}).data("coord","start").appendTo(da),Aa=Na.clone().text(2).css({top:Ba*ha,left:ma*ha}).attr("title","End stop").data("coord","end").appendTo(da),ya=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*ha,left:Ea* -ha}).data("coord","center").appendTo(da),Ga=ya.clone().text("F").css({top:Ka*ha,left:za*ha,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(da);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=V.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> -1)this.value=1;if(!(ba[0]==="f"&&!hb))if(N&&aa==="radialGradient"||!N&&aa==="linearGradient")V.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,ea=ba.indexOf("x")>=0?"left":"top";Q.css(ea,this.value*ha)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);da=a("pattern",{width:16, -height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},da).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>ha+10?ha+10:ba;u(ba/ha,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:ha+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb= -M.find(".jGraduate_spreadMethod").change(function(){V.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>ha?ha:ba;ka=ka<0?0:ka>ha?ha:ka;Xa.css("left",ba).css("top",ka);ba=ba/na;ka=ka/fa;var N=Xa.data("coord"),Q=V;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba); -ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=V.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){V.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=V.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/ -2)/100;ea&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;ea&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;V.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break; -case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;pa||(K=xa[0].getAttribute("stop-color")); +Ia);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:qa,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":na/100},U);var Na=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:la*aa,left:K*aa}).data("coord","start").appendTo(ea),Aa=Na.clone().text(2).css({top:Ba*aa,left:ma*aa}).attr("title","End stop").data("coord","end").appendTo(ea),ya=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ia*aa,left:Ea* +aa}).data("coord","center").appendTo(ea),Ga=ya.clone().text("F").css({top:Ka*aa,left:za*aa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ea);Ga[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ja,ba){var ka=W.getAttribute(ba),N=isNaN(ba[1]);ka||(ka=N?"0.5":ba==="x2"?"1.0":"0.0");ia[ba]=$("#"+p+"_jGraduate_"+ba).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> +1)this.value=1;if(!(ba[0]==="f"&&!hb))if(N&&ca==="radialGradient"||!N&&ca==="linearGradient")W.setAttribute(ba,this.value);var Q=N?ba[0]==="c"?ya:Ga:ba[1]==="1"?Na:Aa,fa=ba.indexOf("x")>=0?"left":"top";Q.css(fa,this.value*aa)}).change()});var xa,nb,Ya=$("#"+p+"_jGraduate_StopSlider"),fb,Sa,Wa,Ca=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Sa),wa,db=1,La=1,Ra=0,Da=Ea,gb=Ia;Sa=a("svg",{width:"100%",height:45},Ya[0]);ea=a("pattern",{width:16, +height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Sa);a("image",{width:16,height:16},ea).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Sa).on("click touchstart",function(ja){wa=Ya.offset();if(ja.target.tagName!=="path"){var ba=ja.pageX-wa.left-8;ba=ba<10?10:ba>aa+10?aa+10:ba;u(ba/aa,0,0,true);ja.stopPropagation()}});$(Sa).mouseover(function(){Sa.appendChild(Ca)});nb=a("g",{},Sa);a("line",{x1:10,y1:15,x2:aa+10,y2:15,"stroke-width":2,stroke:"#000"},Sa);var rb= +M.find(".jGraduate_spreadMethod").change(function(){W.setAttribute("spreadMethod",$(this).val())}),Xa=null,ab=function(ja){var ba=ja.pageX-jb.left,ka=ja.pageY-jb.top;ba=ba<0?0:ba>aa?aa:ba;ka=ka<0?0:ka>aa?aa:ka;Xa.css("left",ba).css("top",ka);ba=ba/qa;ka=ka/ha;var N=Xa.data("coord"),Q=W;switch(N){case "start":ia.x1.val(ba);ia.y1.val(ka);Q.setAttribute("x1",ba);Q.setAttribute("y1",ka);break;case "end":ia.x2.val(ba);ia.y2.val(ka);Q.setAttribute("x2",ba);Q.setAttribute("y2",ka);break;case "center":ia.cx.val(ba); +ia.cy.val(ka);Q.setAttribute("cx",ba);Q.setAttribute("cy",ka);Da=ba;gb=ka;d();break;case "focus":ia.fx.val(ba);ia.fy.val(ka);Q.setAttribute("fx",ba);Q.setAttribute("fy",ka);d()}ja.preventDefault()},xb=function(){Xa=null;P.unbind("mousemove",ab).unbind("mouseup",xb)};xa=W.getElementsByTagNameNS(q.svg,"stop");if(ua<2){for(;ua<2;){W.appendChild(document.createElementNS(q.svg,"stop"));++ua}xa=W.getElementsByTagNameNS(q.svg,"stop")}var ua=xa.length;for(ma=0;ma99.5)N=99.5;if(N>0)La=1-N/100;else db=-(N/100)-1;Q=145*((N+100)/ +2)/100;fa&&d();break;case "angle":Ra=N;Q=Ra/180;Q+=0.5;Q*=145;fa&&d()}if(Q>145)Q=145;else if(Q<0)Q=0;ka.css({"margin-left":Q-5})}).change()});var sb=function(ja){var ba=ja.pageX-eb.offset.left-parseInt(eb.parent.css("border-left-width"));if(ba>145)ba=145;if(ba<=0)ba=0;var ka=ba-5;ba/=145;switch(eb.type){case "radius":ba=Math.pow(ba*2,2.5);if(ba>0.98&&ba<1.02)ba=1;if(ba<=0.01)ba=0.01;W.setAttribute("r",ba);break;case "opacity":s.paint.alpha=parseInt(ba*100);ra.setAttribute("fill-opacity",ba);break; +case "ellip":La=db=1;if(ba<0.5){ba/=0.5;db=ba<=0?0.01:ba}else if(ba>0.5){ba/=0.5;ba=2-ba;La=ba<=0?0.01:ba}d();ba-=1;if(La===ba+1)ba=Math.abs(ba);break;case "angle":ba-=0.5;Ra=ba*=180;d();ba/=100}eb.elem.css({"margin-left":ka});ba=Math.round(ba*100);eb.input.val(ba);ja.preventDefault()},ob=function(){P.unbind("mousemove",sb).unbind("mouseup",ob);eb=null};for(M=(s.paint.alpha*255/100).toString(16);M.length<2;)M="0"+M;M=M.split(".")[0];K=s.paint.solidColor=="none"?"":s.paint.solidColor+M;oa||(K=xa[0].getAttribute("stop-color")); $.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});T.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:K,alphaSupport:true}},function(ja){s.paint.type="solidColor";s.paint.alpha=ja.val("ahex")?Math.round(ja.val("a")/255*100):100;s.paint.solidColor=ja.val("hex")?ja.val("hex"):"none";s.paint.radialGradient=null;R()},null,function(){O()});var yb=$(L+" .jGraduate_tabs li");yb.on("click touchstart",function(){yb.removeClass("jGraduate_tab_current"); -$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");aa=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(V!==ba){var ka= -$(V).find("stop");$(ba).empty().append(ka);V=ba;ba=rb.val();V.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&V.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb= +$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ja=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ja==="rg"||ja==="lg"){$(".jGraduate_"+ja+"_field").show();$(".jGraduate_"+(ja==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ja+"_jgraduate_grad)");ca=ja==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(s.paint.alpha).change();var ba=$("#"+p+"_"+ja+"_jgraduate_grad")[0];if(W!==ba){var ka= +$(W).find("stop");$(ba).empty().append(ka);W=ba;ba=rb.val();W.setAttribute("spreadMethod",ba)}hb=ja==="rg"&&W.getAttribute("fx")!=null&&!(Ea==za&&Ia==Ka);$("#"+p+"_jGraduate_focusCoord").toggle(hb);if(hb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();yb.removeClass("jGraduate_tab_current");var zb;switch(s.paint.type){case "linearGradient":zb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":zb= $(L+" .jGraduate_tab_radgrad");break;default:zb=$(L+" .jGraduate_tab_color")}s.show();setTimeout(function(){zb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();jQuery&&function(){var a=$(window),q=$(document);$.extend($.fn,{contextMenu:function(h,b){if(h.menu==undefined)return false;if(h.inSpeed==undefined)h.inSpeed=150;if(h.outSpeed==undefined)h.outSpeed=75;if(h.inSpeed==0)h.inSpeed=-1;if(h.outSpeed==0)h.outSpeed=-1;$(this).each(function(){var n=$(this),u=$(n).offset(),c=$("#"+h.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(l){var s=$(this);s.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| h.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(l,d,s)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var l=$(this);l.unbind("mouseup");f(d,d,l)});var f=function(d,l,s){if(typeof l=="undefined")l=d;d.stopPropagation();if(n.hasClass("disabled")||l.altKey)return false;var C=d.pageX,p=d.pageY;if(svgedit.browser.isTouch()){C=d.originalEvent.touches[0].pageX;p=d.originalEvent.touches[0].pageY}d=a.width()-c.width();l=a.height()-c.height();if(C>d-15)C=d-15; if(p>l-30)p=l-30;if(svgedit.browser.isTouch())p-=c.height()/2;q.unbind("click");c.css({top:p,left:C}).fadeIn(h.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});q.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover"); @@ -61,13 +61,13 @@ $(s),{x:C-u.left,y:p-u.top,docX:C,docY:p});return false});setTimeout(function(){ function(){return false})});return $(this)},disableContextMenuItems:function(h){if(h==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(h!=undefined)for(var b=h.split(","),n=0;n=0,u=q.indexOf("Gecko/")>=0,c=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,d=q.indexOf("Windows")>=0,l=q.indexOf("Macintosh")>= -0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.replaceItem(na,0);return true}catch(aa){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var fa=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{fa.insertItemBefore(na, -0);return true}catch(aa){}return false}(),O=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),fa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);fa.setAttribute("x",5);na.appendChild(fa);var aa=document.createElementNS("http://www.w3.org/2000/svg","text");aa.textContent="a";fa.appendChild(aa);fa=aa.getStartPositionOfChar(0);fa=fa.x;document.documentElement.removeChild(na);return fa===0}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg", -"svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(fa);fa=fa.getBBox();document.documentElement.removeChild(na);return fa.height>4&&fa.height<5}(),P=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var fa=document.createElementNS("http://www.w3.org/2000/svg","path");fa.setAttribute("d","M0,0 10,0");var aa= -document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M5,0 15,0");var V=document.createElementNS("http://www.w3.org/2000/svg","g");V.appendChild(fa);V.appendChild(aa);na.appendChild(V);fa=V.getBBox();document.documentElement.removeChild(na);return fa.width==15}(),T=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("x",0.1);(na=na.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed."); -return na}(),M=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect");na.setAttribute("style","vector-effect:non-scaling-stroke");return na.style.vectorEffect==="non-scaling-stroke"}(),ha=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,fa=h.createSVGTransform();na.appendItem(fa);return na.getItem(0)==fa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u}; -svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return K}; -svgedit.browser.supportsHVLineContainerBBox=function(){return P};svgedit.browser.supportsGoodTextCharPos=function(){return O};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return T};svgedit.browser.supportsNonScalingStroke=function(){return M};svgedit.browser.supportsNativeTransformLists=function(){return ha}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; +0,s="ontouchstart"in window,C=!!h.querySelector,p=!!document.evaluate,L=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M0,0 10,10");var qa=aa.pathSegList;aa=aa.createSVGPathSegLinetoAbs(5,5);try{qa.replaceItem(aa,0);return true}catch(ha){}return false}(),R=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","path");aa.setAttribute("d","M0,0 10,10");var qa=aa.pathSegList;aa=aa.createSVGPathSegLinetoAbs(5,5);try{qa.insertItemBefore(aa, +0);return true}catch(ha){}return false}(),O=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(aa);var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 C0,0 10,10 10,0");aa.appendChild(qa);qa=qa.getBBox();document.documentElement.removeChild(aa);return qa.height>4&&qa.height<5}(),K=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(aa); +var qa=document.createElementNS("http://www.w3.org/2000/svg","path");qa.setAttribute("d","M0,0 10,0");var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M5,0 15,0");var ca=document.createElementNS("http://www.w3.org/2000/svg","g");ca.appendChild(qa);ca.appendChild(ha);aa.appendChild(ca);qa=ca.getBBox();document.documentElement.removeChild(aa);return qa.width==15}(),P=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","rect");aa.setAttribute("x", +0.1);(aa=aa.cloneNode(false).getAttribute("x").indexOf(",")==-1)||$.alert("NOTE: This version of Opera is known to contain bugs in SVG-edit.\n\t\tPlease upgrade to the latest version in which the problems have been fixed.");return aa}(),T=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg","rect");aa.setAttribute("style","vector-effect:non-scaling-stroke");return aa.style.vectorEffect==="non-scaling-stroke"}(),M=function(){var aa=document.createElementNS("http://www.w3.org/2000/svg", +"rect").transform.baseVal,qa=h.createSVGTransform();aa.appendItem(qa);return aa.getItem(0)==qa}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return n};svgedit.browser.isGecko=function(){return u};svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return s};svgedit.browser.supportsSelectors=function(){return C}; +svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return O};svgedit.browser.supportsHVLineContainerBBox=function(){return K};svgedit.browser.supportsGoodTextCharPos=function(){};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return P};svgedit.browser.supportsNonScalingStroke= +function(){return T};svgedit.browser.supportsNativeTransformLists=function(){return M}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{}; (function(){if(!svgedit.transformlist)svgedit.transformlist={};var a=document.createElementNS("http://www.w3.org/2000/svg","svg"),q={};svgedit.transformlist.SVGTransformList=function(h){this._elem=h||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var n=0;n>4;l=(l&15)<<4|C>>2;s=(C&3)<<6|p;f+=String.fromCharCode(d);if(C!=64)f+= new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(s){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}}; svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){return c.getAttributeNS("http://www.w3.org/1999/xlink", "href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=h.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var l=f.getItem(0), -s=[l.x,l.y];for(l=0;l=0)F=g=c.convertToPath(I,true);else if(I.tagName=="rect"){var o=I.getAttribute("rx"),v=I.getAttribute("ry");if(o||v)F=g=c.convertToPath(I,true)}if(!g){var D=I.cloneNode(true),H=document.createElementNS(b,"g"),J=I.parentNode;J.appendChild(H);H.appendChild(D);F=svgedit.utilities.bboxToObj(H.getBBox());J.removeChild(H)}}return F}catch(X){console.log(I,X);return null}},m;$.each(e,function(){if(!m)if(this.parentNode)m=k(this)}); @@ -214,81 +214,81 @@ if(m==null)return null;var A=m.x+m.width,z=m.y+m.height,G=m.x,B=m.y,w=function(I (e=$(l).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push(A)}catch(z){}});return k.reverse()},yb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(l).children());var k=[];$(e).children().each(function(m,A){try{A.getBBox()&&k.push({elem:A,bbox:getStrokedBBox([A])})}catch(z){}});return k.reverse()},zb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg", e)[0].id=ka()},ja=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(A,z){z.localName!="-moz-math-font-style"&&k.setAttributeNS(z.namespaceURI,z.nodeName,z.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var m=Ja.convertPath(e);k.setAttribute("d",m)}$.each(e.childNodes,function(A,z){switch(z.nodeType){case 1:k.appendChild(ja(z));break;case 3:k.textContent=z.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild); else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Gb(k);k.id=ka();return k},ba,ka,N;(function(e){var k={};ba=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};N=e.call=function(m,A){if(k[m])return k[m](this,A)};e.bind=function(m,A){var z=k[m];k[m]=A;return z}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,m=e.length;k -0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,fa(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}pa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb== +e[k];A.setAttribute("d",Ja.convertPath(A));Ja.fixEnd(A)}};var Q=this.getRefElem=function(e){return oa(ia(e).substr(1))},fa=function(e){if(!svgedit.browser.isGecko())return e;var k=e.cloneNode(true);e.parentNode.insertBefore(k,e);e.parentNode.removeChild(e);Ga.releaseSelector(e);K[0]=k;Ga.requestSelector(k).showGrips(true);return k};this.setRotationAngle=function(e,k){e=parseFloat(e);var m=K[0],A=m.getAttribute("transform"),z=svgedit.utilities.getBBox(m),G=z.x+z.width/2,B=z.y+z.height/2;z=T(m);z.numberOfItems> +0&&z.getItem(0).type==4&&z.removeItem(0);if(e!=0){G=M(G,B,ha(z).matrix);B=d.createSVGTransform();B.setRotate(e,G.x,G.y);z.numberOfItems?z.insertItemBefore(B,0):z.appendItem(B)}else z.numberOfItems==0&&m.removeAttribute("transform");if(!k){z=m.getAttribute("transform");m.setAttribute("transform",A);ib("transform",z,K);N("changed",K)}oa("pathpointgrip_container");m=Ga.requestSelector(K[0]);m.resize();m.updateGripCursors(e)};var Fa=this.recalculateAllSelectedDimensions=function(){for(var e=new Aa(gb== "none"?"position":"size"),k=K.length;k--;){var m=Qa(K[k]);m&&e.addSubCommand(m)}if(!e.isEmpty()){ya(e);N("changed",K)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Va=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},$a=this.remapElement=function(e,k,m){var A=n.gridSnapping&&e.parentNode.parentNode.localName==="svg",z=function(){if(A)for(var g in k)k[g]=xa(k[g]);la(e,k,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var B=G===0?"fill":"stroke", -w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=fa(e).matrix;B=ha(B.inverse(), -m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(ha(fa(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z(); +w=e.getAttribute(B);if(w&&w.indexOf("url(")===0)if(m.a<0||m.d<0){w=Q(w).cloneNode(true);if(m.a<0){var E=w.getAttribute("x1"),I=w.getAttribute("x2");w.setAttribute("x1",-(E-1));w.setAttribute("x2",-(I-1))}if(m.d<0){E=w.getAttribute("y1");I=w.getAttribute("y2");w.setAttribute("y1",-(E-1));w.setAttribute("y2",-(I-1))}w.id=ka();kb().appendChild(w);e.setAttribute(B,"url(#"+w.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(m.a==1&&m.b==0&&m.c==0&&m.d==1&&(m.e!=0||m.f!=0)){B=ha(e).matrix;B=aa(B.inverse(), +m,B);k.x=parseFloat(k.x)+B.e;k.y=parseFloat(k.y)+B.f}else{B=T(e);w=d.createSVGTransform();w.setMatrix(aa(ha(B).matrix,m));B.clear();B.appendItem(w)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(m.a<0||m.d<0)){B=T(e);w=d.createSVGTransform();w.setMatrix(aa(ha(B).matrix,m));B.clear();B.appendItem(w)}else{B=M(k.x,k.y,m);k.width=m.a*k.width;k.height=m.d*k.height;k.x=B.x+Math.min(0,k.width);k.y=B.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}z(); break;case "ellipse":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;k.rx=m.a*k.rx;k.ry=m.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);z();break;case "circle":G=M(k.cx,k.cy,m);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,m);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(k.r)k.r=Math.abs(k.r);z();break;case "line":B=M(k.x1,k.y1,m);E=M(k.x2,k.y2,m);k.x1=B.x;k.y1=B.y;k.x2=E.x;k.y2=E.y;case "text":m=e.querySelectorAll("tspan");for(G=m.length;G--;){B=ra("x",e.getAttribute("x")); w=ra("x",m[G].getAttribute("x"));E=ra("y",e.getAttribute("y"));I=ra("y",m[G].getAttribute("y"));var F={};if(!isNaN(B)&&!isNaN(w)&&B!=0&&w!=0&&k.x)F.x=k.x-(B-w);if(!isNaN(E)&&!isNaN(I)&&E!=0&&I!=0&&k.y)F.y=k.y-(E-I);if(F.x||F.y)la(m[G],F,1E3,true)}z();break;case "use":z();break;case "g":(z=$(e).data("gsvg"))&&la(z,k,1E3,true);break;case "polyline":case "polygon":z=k.points.length;for(G=0;G0){for(var m=k.numberOfItems;m--;){var A=k.getItem(m);if(A.type===0)k.removeItem(m);else if(A.type=== -1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&oa(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(ha(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m- -2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=ha(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1", +1)svgedit.math.isIdentity(A.matrix)&&k.removeItem(m);else A.type===4&&A.angle===0&&k.removeItem(m)}if(k.numberOfItems===1&&na(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){m=k.numberOfItems;for(var z=[];m--;){A=k.getItem(m);if(A.type===1)z.push([A.matrix,m]);else if(z.length)z=[]}if(z.length===2){m=d.createSVGTransformFromMatrix(aa(z[1][0],z[0][0]));k.removeItem(z[0][1]);k.removeItem(z[1][1]);k.insertItemBefore(m,z[1][1])}m=k.numberOfItems;if(m>=2&&k.getItem(m- +2).type===1&&k.getItem(m-1).type===2){z=d.createSVGTransform();A=aa(k.getItem(m-2).matrix,k.getItem(m-1).matrix);z.setMatrix(A);k.removeItem(m-2);k.removeItem(m-2);k.appendItem(z)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type===4)return null}var G=$(e).data("gsvg");m=new Aa("Transform");var B={},w=null;A=[];switch(e.tagName){case "line":A=["x1","y1", "x2","y2"];break;case "circle":A=["cx","cy","r"];break;case "ellipse":A=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":A=["width","height","x","y"];break;case "use":case "text":case "tspan":A=["x","y"];break;case "polygon":case "polyline":w={};w.points=e.getAttribute("points");z=e.points;var E=z.numberOfItems;B.points=Array(E);for(var I=0;I1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var ca=E.item(F);A=G=0;if(ca.nodeType==1){var S=T(ca);if(S){A=fa(S).matrix;G=oa(ca);var W=Ra,Z=[];Ra=ca.getAttribute("transform");if(G||na(S)){var qa= -d.createSVGTransform();qa.setMatrix(ha(H,J,X,A));S.clear();S.appendItem(qa);Z.push(qa)}else{G=ha(A.inverse(),X,A);qa=d.createSVGMatrix();qa.e=-G.e;qa.f=-G.f;A=ha(qa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(qa.e,qa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(ca));Ra=W}}}k.removeItem(v-1);k.removeItem(v- -2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=fa(k).matrix;k.removeItem(0);A=fa(k).matrix.inverse();A=ha(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){ca=E.item(F);if(ca.nodeType==1){if(ca.getAttribute("clip-path")){W=ca.getAttribute("clip-path");if(v.indexOf(W)===-1){qb(W,G,A);v.push(W)}}W=Ra;Ra=ca.getAttribute("transform"); -if(S=T(ca)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(ca));S=e.getElementsByTagNameNS(b,"use");ca="#"+ca.id;for(H=S.length;H--;){J=S.item(H);if(ca==da(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=W}}}v=[];Ra=W}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform"); -if(S=T(ca)){G=ha(A,fa(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(ca));Ra=W;W=ca.getAttribute("stroke-width");ca.getAttribute("stroke")!=="none"&&!isNaN(W)&&ca.setAttribute("stroke-width",W*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+ -D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=fa(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();W=A.inverse();o=ha(W,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){ca=E.item(F);if(ca.nodeType==1){W=Ra;Ra=ca.getAttribute("transform");S=T(ca);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H, -0):S.appendItem(H);m.addSubCommand(Qa(ca));Ra=W}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=oa(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,fa(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=fa(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v== -4&&k.getItem(v-1).type==1){I=3;A=fa(k).matrix;qa=d.createSVGTransform();qa.setMatrix(A);k.clear();k.appendItem(qa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;W=fa(k,1).matrix;z=W.inverse();A=ha(z,D,W);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=fa(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems; -B.points=Array(E);for(I=0;I1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;var H=k.getItem(v-3).matrix,J=k.getItem(v-2).matrix,X=k.getItem(v-1).matrix;E=e.childNodes;for(F=E.length;F--;){var da=E.item(F);A=G=0;if(da.nodeType==1){var S=T(da);if(S){A=ha(S).matrix;G=na(da);var V=Ra,Z=[];Ra=da.getAttribute("transform");if(G||qa(S)){var pa= +d.createSVGTransform();pa.setMatrix(aa(H,J,X,A));S.clear();S.appendItem(pa);Z.push(pa)}else{G=aa(A.inverse(),X,A);pa=d.createSVGMatrix();pa.e=-G.e;pa.f=-G.f;A=aa(pa.inverse(),A.inverse(),H,J,X,A,G.inverse());var ta=d.createSVGTransform(),ga=d.createSVGTransform(),Ta=d.createSVGTransform();ta.setTranslate(G.e,G.f);ga.setScale(A.a,A.d);Ta.setTranslate(pa.e,pa.f);S.appendItem(Ta);S.appendItem(ga);S.appendItem(ta);Z.push(Ta);Z.push(ga);Z.push(ta)}m.addSubCommand(Qa(da));Ra=V}}}k.removeItem(v-1);k.removeItem(v- +2);k.removeItem(v-3)}else if(v>=3&&k.getItem(v-1).type==1){I=3;A=ha(k).matrix;pa=d.createSVGTransform();pa.setMatrix(A);k.clear();k.appendItem(pa)}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;G=ha(k).matrix;k.removeItem(0);A=ha(k).matrix.inverse();A=aa(A,G);G=A.e;A=A.f;if(G!=0||A!=0){E=e.childNodes;F=E.length;for(v=[];F--;){da=E.item(F);if(da.nodeType==1){if(da.getAttribute("clip-path")){V=da.getAttribute("clip-path");if(v.indexOf(V)===-1){qb(V,G,A);v.push(V)}}V=Ra;Ra=da.getAttribute("transform"); +if(S=T(da)){H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H,0):S.appendItem(H);m.addSubCommand(Qa(da));S=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(H=S.length;H--;){J=S.item(H);if(da==ea(J)){X=d.createSVGTransform();X.setTranslate(-G,-A);T(J).insertItemBefore(X,0);m.addSubCommand(Qa(J))}}Ra=V}}}v=[];Ra=V}}else if(v==1&&k.getItem(0).type==1&&!z){I=1;A=k.getItem(0).matrix;E=e.childNodes;for(F=E.length;F--;){da=E.item(F);if(da.nodeType==1){V=Ra;Ra=da.getAttribute("transform"); +if(S=T(da)){G=aa(A,ha(S).matrix);v=d.createSVGTransform();v.setMatrix(G);S.clear();S.appendItem(v,0);m.addSubCommand(Qa(da));Ra=V;V=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(V)&&da.setAttribute("stroke-width",V*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(z){g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(I==2){if(z){o={x:g.x+D.e,y:g.y+ +D.f};g=d.createSVGTransform();g.setRotate(z,o.x,o.y);k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else if(I==3){A=ha(k).matrix;D=d.createSVGTransform();D.setRotate(z,g.x,g.y);D=D.matrix;g=d.createSVGTransform();g.setRotate(z,o.x,o.y);o=g.matrix.inverse();V=A.inverse();o=aa(V,o,D,A);G=o.e;A=o.f;if(G!=0||A!=0){E=e.childNodes;for(F=E.length;F--;){da=E.item(F);if(da.nodeType==1){V=Ra;Ra=da.getAttribute("transform");S=T(da);H=d.createSVGTransform();H.setTranslate(G,A);S.numberOfItems?S.insertItemBefore(H, +0):S.appendItem(H);m.addSubCommand(Qa(da));Ra=V}}}if(z)k.numberOfItems?k.insertItemBefore(g,0):k.appendItem(g)}}else{z=svgedit.utilities.getBBox(e);if(!z&&e.tagName!="path")return null;A=d.createSVGMatrix();if(G=na(e)){g={x:z.x+z.width/2,y:z.y+z.height/2};o=M(z.x+z.width/2,z.y+z.height/2,ha(k).matrix);I=G*Math.PI/180;E=Math.abs(I)>1.0E-10?Math.sin(I)/(1-Math.cos(I)):2/I;for(I=0;I=3&&k.getItem(v-2).type==3&&k.getItem(v-3).type==2&&k.getItem(v-1).type==2){I=3;A=ha(k,v-3,v-1).matrix;k.removeItem(v-1);k.removeItem(v-2);k.removeItem(v-3)}else if(v== +4&&k.getItem(v-1).type==1){I=3;A=ha(k).matrix;pa=d.createSVGTransform();pa.setMatrix(A);k.clear();k.appendItem(pa);A=d.createSVGMatrix()}else if((v==1||v>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){I=2;D=k.getItem(0).matrix;V=ha(k,1).matrix;z=V.inverse();A=aa(z,D,V);k.removeItem(0)}else if(v==1&&k.getItem(0).type==1&&!G){A=ha(k).matrix;switch(e.tagName){case "line":B=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":B.points=e.getAttribute("points");if(B.points){z=e.points;E=z.numberOfItems; +B.points=Array(E);for(I=0;I1&&z.showGrips(false)}}}N("selected",K);k||K.length==1?Ga.requestSelector(K[0]).showGrips(true):Ga.requestSelector(K[0]).showGrips(false);for(K.sort(function(G,B){if(G&&B&&G.compareDocumentPosition)return 3- (B.compareDocumentPosition(G)&6);else if(G==null)return 1});K[0]==null;)K.shift(0)}},vb=this.selectOnly=function(e,k){Pa(true);tb(e,k)};this.removeFromSelection=function(e){if(K[0]!=null)if(e.length!=0){var k=Array(K.length);j=0;len=K.length;for(var m=0;m=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=C().getCurrentLayer();if([d,a,l,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return Ga.selectorParentGroup;for(;e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,m=null,A= null,z=null,G={},B={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(w){if(!(w.originalEvent.touches&&w.originalEvent.touches>1)){var E=w.button===2;pb=l.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);w.preventDefault();if(E)Da="select";F=F/p;I=I/p;var g=mb(w);if(g.tagName==="a"&&g.childNodes.length===1)g=g.firstChild;var o=A=k=F,v=z=m=I;if(n.gridSnapping){F=xa(F);I=xa(I);k=xa(k);m=xa(m)}if(g== Ga.selectorParentGroup&&K[0]!=null){g=w.target;var D=fb(g,"type");if(D=="rotate"){Da="rotate";current_rotate_mode=fb(g,"dir")}else if(D=="resize"){Da="resize";gb=fb(g,"dir")}g=K[0]}Ra=g.getAttribute("transform");D=T(g);switch(Da){case "select":La=true;gb="none";if(E)La=false;if(g!=d){if(K.indexOf(g)==-1){w.shiftKey||Pa(true);tb([g]);xb=g;Ja.clear()}if(!E)for(E=0;E1))if(La)if(!(w.button=== -1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=pa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=aa(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v1))if(La)if(!(w.button=== +1||c.spaceKey)){var E=K[0],I=M(w.pageX,w.pageY,pb),F=I.x*(isBotchedZoom?1:p);I=I.y*(isBotchedZoom?1:p);var g=oa(ba()),o=x=F/p,v=y=I/p;if(n.gridSnapping){x=xa(x);y=xa(y)}w.preventDefault();switch(Da){case "select":if(K[0]!==null){o=x-k;var D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D)}if(w.shiftKey){var H=ca(k,m,x,y);x=H.x;y=H.y}if(o!=0||D!=0){H=K.length;for(v=0;v0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=na(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,ca=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);ca=xa(ca);X=xa(X)}var S=oa(E);if(S){var W=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=W*Math.cos(D);D=W*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=W=0,qa=ca?(ca+D)/ca:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){qa=ca? -(ca-D)/ca:1;Z=ca}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;W=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);W=xa(W);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+W),-(v+Z));if(w.shiftKey)if(ta==1)ta=qa;else qa=ta;D.setScale(ta,qa);X.setTranslate(H+W,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition", -K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=aa(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da== +g.length>0&&c.removeFromSelection(g);o.length>0&&tb(o);break;case "resize":g=T(E);o=(J=qa(g))?G:svgedit.utilities.getBBox(E);H=o.x;v=o.y;var X=o.width,da=o.height;o=x-k;D=y-m;if(n.gridSnapping){o=xa(o);D=xa(D);da=xa(da);X=xa(X)}var S=na(E);if(S){var V=Math.sqrt(o*o+D*D);D=Math.atan2(D,o)-S*Math.PI/180;o=V*Math.cos(D);D=V*Math.sin(D)}if(gb.indexOf("n")==-1&&gb.indexOf("s")==-1)D=0;if(gb.indexOf("e")==-1&&gb.indexOf("w")==-1)o=0;var Z=V=0,pa=da?(da+D)/da:1,ta=X?(X+o)/X:1;if(gb.indexOf("n")>=0){pa=da? +(da-D)/da:1;Z=da}if(gb.indexOf("w")>=0){ta=X?(X-o)/X:1;V=X}o=d.createSVGTransform();D=d.createSVGTransform();X=d.createSVGTransform();if(n.gridSnapping){H=xa(H);V=xa(V);v=xa(v);Z=xa(Z)}o.setTranslate(-(H+V),-(v+Z));if(w.shiftKey)if(ta==1)ta=pa;else pa=ta;D.setScale(ta,pa);X.setTranslate(H+V,v+Z);if(J){J=S?1:0;g.replaceItem(o,2+J);g.replaceItem(D,1+J);g.replaceItem(X,0+J)}else{J=g.numberOfItems;g.replaceItem(X,J-3);g.replaceItem(D,J-2);g.replaceItem(o,J-1)}Ga.requestSelector(E).resize();N("transition", +K);break;case "zoom":o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100);break;case "text":la(g,{x:x,y:y},1E3);break;case "line":o=null;window.opera||d.suspendRedraw(1E3);if(n.gridSnapping){x=xa(x);y=xa(y)}J=x;H=y;if(w.shiftKey){H=ca(k,m,J,H);J=H.x;H=H.y}g.setAttributeNS(null,"x2",J);g.setAttributeNS(null,"y2",H);window.opera||d.unsuspendRedraw(o);break;case "foreignObject":case "square":case "rect":case "image":o=Math.abs(x-k);J=Math.abs(y-m);if(Da== "square"||w.shiftKey){o=J=Math.max(o,J);H=km?m+v:m-v}if(w.altKey){J=k;H=m;v=Math.abs(x-J);D=w.shiftKey?v:Math.abs(y-H)}g.setAttributeNS(null,"rx",v);g.setAttributeNS(null,"ry",D);g.setAttributeNS(null,"cx",J);g.setAttributeNS(null,"cy",H);window.opera||d.unsuspendRedraw(o);break;case "fhellipse":case "fhrect":B.minx=Math.min(o,B.minx);B.maxx=Math.max(o,B.maxx);B.miny=Math.min(v,B.miny);B.maxy=Math.max(v,B.maxy);case "fhpath":e+=+o+","+ -v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=aa(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o= -svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=V(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove", -{event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&oa(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones); -K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=pa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke"); +v+" ";g.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=p;y*=p;if(n.gridSnapping){x=xa(x);y=xa(y);k=xa(k);m=xa(m)}if(w.shiftKey){if(J=svgedit.path.path){g=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:m}else{g=k;J=m}H=ca(g,J,x,y);x=H.x;y=H.y}if(ua&&ua.getAttribute("display")!=="none"){o*=p;v*=p;la(ua,{x:Math.min(A*p,o),y:Math.min(z*p,v),width:Math.abs(o-A*p),height:Math.abs(v-z*p)},100)}Ja.mouseMove(w,x,y);break;case "textedit":x*=p;y*=p;cb.mouseMove(F,I);break;case "rotate":o= +svgedit.utilities.getBBox(E);J=o.x+o.width/2;H=o.y+o.height/2;g=W(E);g=M(J,H,g);J=g.x;H=g.y;g=o.x;v=o.y;if(current_rotate_mode=="nw")g=o.x+o.width;if(current_rotate_mode=="se")v=o.y+o.height;if(current_rotate_mode=="sw"){g=o.x+o.width;v=o.y+o.height}compensation_angle=(Math.atan2(H-v,J-g)*(180/Math.PI)-90)%360;S=(Math.atan2(H-y,J-x)*(180/Math.PI)-90)%360;S+=compensation_angle;if(n.gridSnapping)S=xa(S);if(w.shiftKey)S=Math.round(S/45)*45;c.setRotationAngle(S<-180?360+S:S,true);N("transition",K)}lb("mouseMove", +{event:w,mouse_x:F,mouse_y:I,selected:E})}}).click(function(w){w.preventDefault();return false}).dblclick(function(w){var E=w.target.parentNode;if(E!==L){var I=mb(w),F=I.tagName;if(F==="text"&&Da!=="textedit"){w=M(w.pageX,w.pageY,pb);cb.select(I,w.x,w.y)}if((F==="g"||F==="a")&&na(I)){Kb(I);I=K[0];Pa(true)}L&&Hb();E.tagName!=="g"&&E.tagName!=="a"||E===C().getCurrentLayer()||I===Ga.selectorParentGroup||Pb(I)}}).mouseup(function(w){c.addClones=false;window.removeEventListener("keyup",c.removeClones); +K=K.filter(Boolean);if(w.button!==2){var E=xb;xb=null;if(La){var I=M(w.pageX,w.pageY,pb),F=I.x*p;I=I.y*p;var g=F/p,o=I/p,v=oa(ba()),D=false;La=false;switch(Da){case "resize":case "multiselect":if(ua!=null){ua.setAttribute("display","none");jb=[]}Da="select";case "select":if(K[0]!=null){if(K.length==1){F=K[0];switch(F.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ab.fill=F.getAttribute("fill");ab.fill_opacity=F.getAttribute("fill-opacity");ab.stroke=F.getAttribute("stroke"); ab.stroke_opacity=F.getAttribute("stroke-opacity");ab.stroke_width=F.getAttribute("stroke-width");ab.stroke_dasharray=F.getAttribute("stroke-dasharray");ab.stroke_linejoin=F.getAttribute("stroke-linejoin");ab.stroke_linecap=F.getAttribute("stroke-linecap")}if(F.tagName=="text"){Xa.font_size=F.getAttribute("font-size");Xa.font_family=F.getAttribute("font-family")}Ga.requestSelector(F).showGrips(true)}Fa();if(g!=A||o!=z){w=K.length;for(F=0;F=0?E.indexOf(",",g+1)>=0:E.indexOf(" ",E.indexOf(" ")+1)>=0)v=Ja.smoothPolylineIntoPath(v);break;case "line":E=$(v).attr(["x1","x2","y1","y2"]);D=E.x1!=E.x2||E.y1!=E.y2;break;case "foreignObject":case "square":case "rect":case "image":E=$(v).attr(["width","height"]);D=E.width!=0||E.height!=0||Da==="image";break;case "circle":D=v.getAttribute("r")!=0;break;case "ellipse":E=$(v).attr(["rx","ry"]);D=E.rx!=null||E.ry!=null;break;case "fhellipse":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"ellipse", curStyles:true,attr:{cx:(B.minx+B.maxx)/2,cy:(B.miny+B.maxy)/2,rx:(B.maxx-B.minx)/2,ry:(B.maxy-B.miny)/2,id:ba()}});N("changed",[v]);D=true}break;case "fhrect":if(B.maxx-B.minx>0&&B.maxy-B.miny>0){v=P({element:"rect",curStyles:true,attr:{x:B.minx,y:B.miny,width:B.maxx-B.minx,height:B.maxy-B.miny,id:ba()}});N("changed",[v]);D=true}break;case "text":D=true;vb([v]);cb.start(v);break;case "path":v=null;La=true;E=Ja.mouseUp(w,v,F,I);v=E.element;D=E.keep;break;case "pathedit":D=true;v=null;Ja.mouseUp(w); -break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,ca){if(ca){D=ca.keep||D;v=ca.element;La=ca.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&& +break;case "textedit":D=false;v=null;cb.mouseUp(w,F,I);break;case "rotate":D=true;v=null;Da="select";E=c.undoMgr.finishUndoableChange();E.isEmpty()||ya(E);Fa();N("changed",K)}F=lb("mouseUp",{event:w,mouse_x:F,mouse_y:I},true);$.each(F,function(X,da){if(da){D=da.keep||D;v=da.element;La=da.started||La}});if(!D&&v!=null){C().releaseId(ba());v.parentNode.removeChild(v);v=null;for(F=w.target;F.parentNode.parentNode.tagName=="g";)F=F.parentNode;if((Da!="path"||!drawn_path)&&F.parentNode.id!="selectorParentGroup"&& F.id!="svgcanvas"&&F.id!="svgroot"){c.setMode("select");vb([F],true)}}else if(v!=null){c.addedNew=true;w=0.2;var H;if(false.beginElement&&v.getAttribute("opacity")!=O.opacity){H=$(false).clone().attr({to:O.opacity,dur:w}).appendTo(v);try{H[0].beginElement()}catch(J){}}else w=0;setTimeout(function(){H&&H.remove();v.setAttribute("opacity",O.opacity);v.setAttribute("style","pointer-events:inherit");ma(v);if(Da==="path")Ja.toEditMode(v);else n.selectNew&&vb([v],true);ya(new za(v));N("changed",[v])},w* -1E3)}Ra=null}}});$(a).bind("mousewheel DOMMouseScroll",function(w){if(w.shiftKey){w.preventDefault();pb=l.getScreenCTM().inverse();var E=M(w.pageX,w.pageY,pb);E={x:E.x,y:E.y,width:0,height:0};if(w.wheelDelta)if(w.wheelDelta>=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var W=I.value=== -"";$(I).focus();if(!arguments.length)if(W)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];W||I.setSelectionRange(S,S);F=pa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=pa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var qa=F.getAttribute("display")==="none";F.setAttribute("display",qa?"inline":"none")},600));W=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:W.x,y1:W.y,x2:Z.x, -y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,W,Z){if(S===W)e(W);else{Z||I.setSelectionRange(S,W);g=pa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(g)}S=v[S];var qa=v[W];F.setAttribute("visibility","hidden");W=G(S.x,D.y);Z=G(S.x+(qa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(qa.x-S.x),D.y+D.height);la(g,{d:"M"+W.x+ -","+W.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,W){var Z=d.createSVGPoint();Z.x=S;Z.y=W;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var qa=v[Z];S>qa.x+qa.width/2&&Z++;return Z}function A(S,W,Z){var qa=I.selectionStart;S=m(S,W);k(Math.min(qa,S),Math.max(qa,S),!Z)}function z(S,W){var Z={x:S,y:W};Z.x/=p;Z.y/=p;if(H){var qa=M(Z.x,Z.y,H.inverse());Z.x=qa.x;Z.y=qa.y}return Z} -function G(S,W){var Z={x:S,y:W};if(H){var qa=M(Z.x,Z.y,H);Z.x=qa.x;Z.y=qa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(ca&&E){var W=M(S.pageX,S.pageY,pb);W=z(W.x*p,W.y*p);W=m(W.x,W.y);var Z=E.textContent,qa=Z.substr(0,W).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(W).match(/^[a-z0-9]+/i);k(qa,(Z?Z[0].length:0)+W);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,ca;return{select:function(S, -W,Z){E=S;cb.toEditMode(W,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,W,Z,qa){S=z(Z,qa);I.focus();e(m(S.x,S.y));J=Z;X=qa},mouseMove:function(S,W){var Z=z(S,W);A(Z.x,Z.y)},mouseUp:function(S,W,Z){var qa=z(W,Z);A(qa.x,qa.y,true);S.target!==E&&WJ-2&&ZX-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,W){vb([E],false);ca=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z= -z(S,W);e(m(Z.x,Z.y))}else e();setTimeout(function(){ca=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S= -E.textContent.length,W=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=W?V(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(W=0;W=120)E.factor=2;else{if(w.wheelDelta<=-120)E.factor=0.5}else if(w.detail)if(w.detail>0)E.factor=0.5;else if(w.detail<0)E.factor=2;E.factor&&N("zoomed",E)}})})();var Gb=function(e){$(e).click(function(k){k.preventDefault()})},cb=c.textActions=function(){function e(S){var V=I.value=== +"";$(I).focus();if(!arguments.length)if(V)S=0;else{if(I.selectionEnd!==I.selectionStart)return;S=I.selectionEnd}var Z;Z=v[S];V||I.setSelectionRange(S,S);F=oa("text_cursor");if(!F){F=document.createElementNS(b,"line");la(F,{id:"text_cursor",stroke:"#333","stroke-width":1});F=oa("selectorParentGroup").appendChild(F)}o||(o=setInterval(function(){var pa=F.getAttribute("display")==="none";F.setAttribute("display",pa?"inline":"none")},600));V=G(Z.x,D.y);Z=G(Z.x,D.y+D.height);la(F,{x1:V.x,y1:V.y,x2:Z.x, +y2:Z.y,visibility:"visible",display:"inline"});g&&g.setAttribute("d","")}function k(S,V,Z){if(S===V)e(V);else{Z||I.setSelectionRange(S,V);g=oa("text_selectblock");if(!g){g=document.createElementNS(b,"path");la(g,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});oa("selectorParentGroup").appendChild(g)}S=v[S];var pa=v[V];F.setAttribute("visibility","hidden");V=G(S.x,D.y);Z=G(S.x+(pa.x-S.x),D.y);var ta=G(S.x,D.y+D.height);S=G(S.x+(pa.x-S.x),D.y+D.height);la(g,{d:"M"+V.x+ +","+V.y+" L"+Z.x+","+Z.y+" "+S.x+","+S.y+" "+ta.x+","+ta.y+"z",display:"inline"})}}function m(S,V){var Z=d.createSVGPoint();Z.x=S;Z.y=V;if(v.length==1)return 0;Z=E.getCharNumAtPosition(Z);if(Z<0){Z=v.length-2;if(S<=v[0].x)Z=0}else if(Z>=v.length-2)Z=v.length-2;var pa=v[Z];S>pa.x+pa.width/2&&Z++;return Z}function A(S,V,Z){var pa=I.selectionStart;S=m(S,V);k(Math.min(pa,S),Math.max(pa,S),!Z)}function z(S,V){var Z={x:S,y:V};Z.x/=p;Z.y/=p;if(H){var pa=M(Z.x,Z.y,H.inverse());Z.x=pa.x;Z.y=pa.y}return Z} +function G(S,V){var Z={x:S,y:V};if(H){var pa=M(Z.x,Z.y,H);Z.x=pa.x;Z.y=pa.y}Z.x*=p;Z.y*=p;return Z}function B(S){k(0,E.textContent.length);$(this).unbind(S)}function w(S){if(da&&E){var V=M(S.pageX,S.pageY,pb);V=z(V.x*p,V.y*p);V=m(V.x,V.y);var Z=E.textContent,pa=Z.substr(0,V).replace(/[a-z0-9]+$/i,"").length;Z=Z.substr(V).match(/^[a-z0-9]+/i);k(pa,(Z?Z[0].length:0)+V);$(S.target).click(B);setTimeout(function(){$(S.target).unbind("click",B)},300)}}var E,I,F,g,o,v=[],D,H,J,X,da;return{select:function(S, +V,Z){E=S;cb.toEditMode(V,Z)},start:function(S){E=S;cb.toEditMode()},mouseDown:function(S,V,Z,pa){S=z(Z,pa);I.focus();e(m(S.x,S.y));J=Z;X=pa},mouseMove:function(S,V){var Z=z(S,V);A(Z.x,Z.y)},mouseUp:function(S,V,Z){var pa=z(V,Z);A(pa.x,pa.y,true);S.target!==E&&VJ-2&&ZX-2&&cb.toSelectMode(true)},setCursor:e,toEditMode:function(S,V){vb([E],false);da=false;Da="textedit";Ga.requestSelector(E).showGrips(false);Ga.requestSelector(E);cb.init();$(E).css("cursor","text");if(arguments.length){var Z= +z(S,V);e(m(Z.x,Z.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(S){Da="select";clearInterval(o);o=null;g&&$(g).attr("display","none");F&&$(F).attr("visibility","hidden");$(E).css("cursor","move");if(S){Pa();$(E).css("cursor","move");N("selected",[E]);tb([E],true)}E&&!E.textContent.length&&c.deleteSelectedElements();$(I).blur();E=false},setInputElem:function(S){I=S},clear:function(){Da=="textedit"&&cb.toSelectMode()},init:function(){if(E){if(!E.parentNode){E=K[0];Ga.requestSelector(E).showGrips(false)}var S= +E.textContent.length,V=E.getAttribute("transform");D=svgedit.utilities.getBBox(E);H=V?W(E):null;v=Array(S);I.focus();$(E).unbind("dblclick",w).dblclick(w);if(!S)var Z={x:D.x+D.width/2,width:0};for(V=0;V=0&&this.selected_pts.push(E)}this.selected_pts.sort();w=this.selected_pts.length;for(B= -Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=pa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", -fill:"none"});E=pa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=pa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p, +Array(w);w--;){I=this.segs[this.selected_pts[w]];I.select(true);B[w]=I.ptgrip}Ja.canDeleteNodes=true;Ja.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);N("selected",B)};var z=k=null,G=false;return{mouseDown:function(B,w,E,I){if(Da==="path"){mouse_x=E;mouse_y=I;I=mouse_x/p;w=mouse_y/p;E=oa("path_stretch_line");m=[I,w];if(n.gridSnapping){I=xa(I);w=xa(w);mouse_x=xa(mouse_x);mouse_y=xa(mouse_y)}if(!E){E=document.createElementNS(b,"path");la(E,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5", +fill:"none"});E=oa("selectorParentGroup").appendChild(E)}E.setAttribute("display","inline");var F=null;if(z){F=z.pathSegList;for(var g=F.numberOfItems,o=6/p,v=false;g;){g--;var D=F.getItem(g),H=D.x;D=D.y;if(I>=H-o&&I<=H+o&&w>=D-o&&w<=D+o){v=true;break}}o=ba();svgedit.path.removePath_(o);o=oa(o);H=F.numberOfItems;if(v){if(g<=1&&H>=2){I=F.getItem(0).x;w=F.getItem(0).y;B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(I,w):z.createSVGPathSegCurvetoCubicAbs(I,w,B.x1/p,B.y1/p, I,w);I=z.createSVGPathSegClosePath();F.appendItem(B);F.appendItem(I)}else if(H<3)return F=false;$(E).remove();element=o;z=null;La=false;if(e){svgedit.path.path.matrix&&$a(o,{},svgedit.path.path.matrix.inverse());E=o.getAttribute("d");B=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",B+E);$(o).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ja.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a, -mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=aa(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr= +mb(B))){console.log("Clicked outside canvas");return false}F=z.pathSegList.numberOfItems;g=z.pathSegList.getItem(F-1);o=g.x;g=g.y;if(B.shiftKey){B=ca(o,g,I,w);I=B.x;w=B.y}B=E.pathSegList.getItem(1);B=B.pathSegType===4?z.createSVGPathSegLinetoAbs(eb(I),eb(w)):z.createSVGPathSegCurvetoCubicAbs(eb(I),eb(w),B.x1/p,B.y1/p,B.x2/p,B.y2/p);z.pathSegList.appendItem(B);I*=p;w*=p;E.setAttribute("d",["M",I,w,I,w].join(" "));E=F;if(e)E+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(E,I,w)}}else{d_attr= "M"+I+","+w+" ";z=P({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:O.opacity/2}});E.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));E=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(E,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();o=B.target.id;if(o.substr(0,14)=="pathpointgrip_"){w=svgedit.path.path.cur_pt=parseInt(o.substr(14));svgedit.path.path.dragging=[E,I];F=svgedit.path.path.segs[w];if(B.shiftKey)F.selected?svgedit.path.path.removePtFromSelection(w): svgedit.path.path.addPtsToSelection(w);else{if(svgedit.path.path.selected_pts.length<=1||!F.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(w)}}else if(o.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[E,I];B=o.split("_")[1].split("c");w=B[0]-0;svgedit.path.path.selectPt(w,B[1]-0)}if(!svgedit.path.path.dragging){if(ua==null)ua=Ga.getRubberBandBox();la(ua,{x:E*p,y:I*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(B,w,E){G=true;if(Da==="path"){if(z){var I= z.pathSegList;B=I.numberOfItems-1;if(m){var F=svgedit.path.addCtrlGrip("1c1"),g=svgedit.path.addCtrlGrip("0c2");g.getAttribute("cx");g.getAttribute("cy");F.setAttribute("cx",w);F.setAttribute("cy",E);F.setAttribute("display","inline");F=m[0];var o=m[1];I.getItem(B);var v=F+(F-w/p),D=o+(o-E/p);g.setAttribute("cx",v*p);g.setAttribute("cy",D*p);g.setAttribute("display","inline");g=svgedit.path.getCtrlLine(1);var H=svgedit.path.getCtrlLine(2);la(g,{x1:w,y1:E,x2:F*p,y2:o*p,display:"inline"});la(H,{x1:v* -p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=pa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F= +p,y1:D*p,x2:F*p,y2:o*p,display:"inline"});if(B===0)A=[w,E];else{I=I.getItem(B-1);w=I.x;E=I.y;if(I.pathSegType===6){w+=w-I.x2;E+=E-I.y2}else if(A){w=A[0]/p;E=A[1]/p}svgedit.path.replacePathSeg(6,B,[F,o,w,E,v,D],z)}}else if(F=oa("path_stretch_line")){B=I.getItem(B);if(B.pathSegType===6)svgedit.path.replacePathSeg(6,1,[w,E,(B.x+(B.x-B.x2))*p,(B.y+(B.y-B.y2))*p,w,E],F);else A?svgedit.path.replacePathSeg(6,1,[w,E,A[0],A[1],w,E],F):svgedit.path.replacePathSeg(4,1,[w,E],F)}}}else if(svgedit.path.path.dragging){F= svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);o=svgedit.path.getPointFromGrip({x:w,y:E},svgedit.path.path);B=o.x-F.x;F=o.y-F.y;svgedit.path.path.dragging=[w,E];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(B,F):svgedit.path.path.movePts(B,F)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var J=ua.getBBox(),X=svgedit.path.getGripPt(this);J=svgedit.math.rectsIntersect(J, -{x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=pa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!= +{x:X.x,y:X.y,width:0,height:0});this.select(J);J&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(B,w){if(Da==="path"){m=null;if(!z){w=oa(ba());La=false;A=null}return{keep:true,element:w}}if(svgedit.path.path.dragging){var E=svgedit.path.path.cur_pt;svgedit.path.path.dragging=false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();G&&svgedit.path.path.endChanges("Move path point(s)");!B.shiftKey&&!G&&svgedit.path.path.selectPt(E)}else if(ua&&ua.getAttribute("display")!= "none"){ua.setAttribute("display","none");ua.getAttribute("width")<=2&&ua.getAttribute("height")<=2&&Ja.toSelectMode(B.target)}else Ja.toSelectMode(B.target);G=false},toEditMode:function(B){svgedit.path.path=svgedit.path.getPath_(B);Da="pathedit";Pa();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(B){var w=B==svgedit.path.path.elem;Da="select";svgedit.path.path.show(false);k=false;Pa();svgedit.path.path.matrix&& -svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(oa(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null; -this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=pa(ba());$(pa("path_stretch_line")).remove();$(B).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=fa(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems, +svgedit.path.recalcRotatedPath();if(w){N("selected",[B]);tb([B],true)}},addSubPath:function(B){if(B){Da="path";e=true}else{Ja.clear(true);Ja.toEditMode(svgedit.path.path.elem)}},select:function(B){if(k===B){Ja.toEditMode(B);Da="pathedit"}else k=B},reorient:function(){var B=K[0];if(B)if(na(B)!=0){var w=new Aa("Reorient path"),E={d:B.getAttribute("d"),transform:B.getAttribute("transform")};w.addSubCommand(new Na(B,E));Pa();this.resetOrientation(B);ya(w);svgedit.path.getPath_(B).show(false).matrix=null; +this.clear();tb([B],true);N("changed",K)}},clear:function(){k=null;if(z){var B=oa(ba());$(oa("path_stretch_line")).remove();$(B).remove();$(oa("pathpointgrip_container")).find("*").attr("display","none");z=A=null;La=false}else Da=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(B){if(B==null||B.nodeName!="path")return false;var w=T(B),E=ha(w).matrix;w.clear();B.removeAttribute("transform");w=B.pathSegList;for(var I=w.numberOfItems, F=0;F=4){var I=w.getItem(0),F=null;B=[];B.push(["M",I.x,",",I.y," C"].join(""));for(var g=1;g<=E-4;g+=3){var o=w.getItem(g),v=w.getItem(g+1),D=w.getItem(g+2);if(F)if((I=svgedit.path.smoothControlPoints(F, o,I))&&I.length==2){o=B[B.length-1].split(",");o[2]=I[0].x;o[3]=I[0].y;B[B.length-1]=o.join(",");o=I[1]}B.push([o.x,o.y,v.x,v.y,D.x,D.y].join(","));I=D;F=v}for(B.push("L");g0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb(); +F=0,g=0,o="",v=null,D=0;D0;);Ja.clear(true);$.each(l.childNodes,function(m,A){m&&A.nodeType===8&&A.data.indexOf("Created with")>=0&&l.insertBefore(A,l.firstChild)});if(L){Hb(); vb([L])}var e=[];$(l).find("g:data(gsvg)").each(function(){for(var m=this.attributes,A=m.length,z=0;z=0;E--){w=B.item(E);g=A(w.nodeValue);if(!(o.indexOf(w.localName)>=0))if(g!="")if(g.indexOf("pointer-events")!==0)if(!(w.localName==="class"&&g.indexOf("se_")===0)){m.push(" ");if(w.localName=== @@ -309,13 +309,13 @@ k));break;case 3:z=z.nodeValue.replace(/^\s+|\s+$/g,"");if(z!=""){B=true;m.push( m.width=this.width;m.height=this.height;m.getContext("2d").drawImage(this,0,0);try{var A=";svgedit_url="+encodeURIComponent(e);A=m.toDataURL().replace(";base64",A+";base64");Wa[e]=A}catch(z){Wa[e]=false}Ca=e;k&&k(Wa[e])}).attr("src",e)};this.setGoodImage=function(e){Ca=e};this.open=function(){};this.save=function(e){Pa();e&&$.extend(db,e);db.apply=true;e=this.svgCanvasToString();N("saved",e)};this.rasterExport=function(){Pa();var e=[],k={feGaussianBlur:nb.exportNoBlur,foreignObject:nb.exportNoforeignObject, "[stroke-dasharray]":nb.exportNoDashArray},m=$(l);if(!("font"in $("")[0].getContext("2d")))k.text=nb.exportNoText;$.each(k,function(A,z){m.find(A).length&&e.push(z)});k=this.svgCanvasToString();N("exported",{svg:k,issues:e})};this.getSvgString=function(){db.apply=false;return this.svgCanvasToString()};this.randomizeIds=function(){arguments.length>0&&arguments[0]==false?svgedit.draw.randomizeIds(false,C()):svgedit.draw.randomizeIds(true,C())};var Lb=this.uniquifyElems=function(e){var k={}, m=["filter","linearGradient","pattern","radialGradient","symbol","textPath","use"];svgedit.utilities.walkTree(e,function(w){if(w.nodeType==1){if(w.id){w.id in k||(k[w.id]={elem:null,attrs:[],hrefs:[]});k[w.id].elem=w}$.each(Ya,function(I,F){var g=w.getAttributeNode(F);if(g){var o=svgedit.utilities.getUrlFromAttr(g.value);if(o=o?o.substr(1):null){o in k||(k[o]={elem:null,attrs:[],hrefs:[]});k[o].attrs.push(g)}}});var E=svgedit.utilities.getHref(w);if(E&&m.indexOf(w.nodeName)>=0)if(E=E.substr(1)){E in -k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=da(this).substr(1);if(m=pa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol", +k||(k[E]={elem:null,attrs:[],hrefs:[]});k[E].hrefs.push(w)}}});for(var A in k)if(A){var z=k[A].elem;if(z){e=ka();z.id=e;z=k[A].attrs;for(var G=z.length;G--;){var B=z[G];B.ownerElement.setAttribute(B.name,"url(#"+e+")")}z=k[A].hrefs;for(G=z.length;G--;)svgedit.utilities.setHref(z[G],"#"+e)}}},Jb=this.setUseData=function(e){var k=$(e);if(e.tagName!=="use")k=k.find("use");k.each(function(){var m=ea(this).substr(1);if(m=oa(m)){$(this).data("ref",m);if(m.tagName=="symbol"||m.tagName=="svg")$(this).data("symbol", m).data("ref",m)}})},Bb=this.convertGradients=function(e){var k=$(e).find("linearGradient, radialGradient");if(!k.length&&svgedit.browser.isWebkit())k=$(e).find("*").filter(function(){return this.tagName.indexOf("Gradient")>=0});k.each(function(){if($(this).attr("gradientUnits")==="userSpaceOnUse"){var m=$(l).find('[fill="url(#'+this.id+')"],[stroke="url(#'+this.id+')"]');if(m.length)if(m=svgedit.utilities.getBBox(m[0]))if(this.tagName==="linearGradient"){var A=$(this).attr(["x1","y1","x2","y2"]), -z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=fa(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg"); +z=this.gradientTransform.baseVal;if(z&&z.numberOfItems>0){var G=ha(z).matrix;z=M(A.x1,A.y1,G);G=M(A.x2,A.y2,G);A.x1=z.x;A.y1=z.y;A.x2=G.x;A.y2=G.y;this.removeAttribute("gradientTransform")}$(this).attr({x1:(A.x1-m.x)/m.width,y1:(A.y1-m.y)/m.height,x2:(A.x2-m.x)/m.width,y2:(A.y2-m.y)/m.height});this.removeAttribute("gradientUnits")}}})},Ob=this.convertToGroup=function(e){e||(e=K[0]);var k=$(e),m=new Aa,A;if(k.data("gsvg")){m=$(e.firstChild).attr(["x","y"]);$(e.firstChild.firstChild).unwrap();$(e).removeData("gsvg"); A=T(e);var z=d.createSVGTransform();z.setTranslate(m.x,m.y);A.appendItem(z);Qa(e);N("selected",[e])}else if(k.data("symbol")){e=k.data("symbol");A=k.attr("transform");z=k.attr(["x","y"]);var G=e.getAttribute("viewBox");if(G){G=G.split(" ");z.x-=+G[0];z.y-=+G[1]}A+=" translate("+(z.x||0)+","+(z.y||0)+")";z=k.prev();m.addSubCommand(new Ka(k[0],k[0].nextSibling,k[0].parentNode));k.remove();G=$(l).find("use:data(symbol)").length;k=f.createElementNS(b,"g");for(var B=e.childNodes,w=0;wm){if(e1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k1;)e.addSubCommand(c.mergeLayer(true));Pa();Db();N("changed",[l]);ya(e)};var Hb=this.leaveContext=function(){var e=wa.length;if(e){for(var k=0;k=0)c.setStrokeWidth(1);else{ab.stroke_width=e;for(var k=[],m=K.length;m--;){var A=K[m];if(A)A.tagName=="g"?svgedit.utilities.walkTree(A,function(z){z.nodeName!="g"&&k.push(z)}):k.push(A)}if(k.length>0){ib("stroke-width",e,k);N("changed",K)}}};this.setStrokeAttr=function(e,k){O[e.replace("-","_")]=k;for(var m=[],A=K.length;A--;){var z=K[A];if(z)z.tagName=="g"?svgedit.utilities.walkTree(z, function(G){G.nodeName!="g"&&m.push(G)}):m.push(z)}if(m.length>0){ib(e,k,m);N("changed",K)}};this.getStyle=function(){return O};this.getOpacity=function(){return O.opacity};this.setOpacity=function(e){O.opacity=e;ib("opacity",e)};this.getFillOpacity=function(){return O.fill_opacity};this.getStrokeOpacity=function(){return O.stroke_opacity};this.setPaintOpacity=function(e,k,m){O[e+"_opacity"]=k;m?Cb(e+"-opacity",k):ib(e+"-opacity",k)};this.getBlur=function(e){var k=0;if(e)if(e.getAttribute("filter"))if(e= -pa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets= -function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=pa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I= +oa(e.id+"_blur"))k=e.firstChild.getAttribute("stdDeviation");return k};(function(){function e(){var z=c.undoMgr.finishUndoableChange();k.addSubCommand(z);ya(k);m=k=null}var k=null,m=null,A=false;c.setBlurNoUndo=function(z){if(m)if(z===0){Cb("filter","");A=true}else{var G=K[0];A&&Cb("filter","url(#"+G.id+"_blur)");if(svgedit.browser.isWebkit()){G.removeAttribute("filter");G.setAttribute("filter","url(#"+G.id+"_blur)")}Cb("stdDeviation",z,[m.firstChild]);c.setBlurOffsets(m,z)}else c.setBlur(z)};c.setBlurOffsets= +function(z,G){if(G>3)la(z,{x:"-50%",y:"-50%",width:"200%",height:"200%"},100);else if(!svgedit.browser.isWebkit()){z.removeAttribute("x");z.removeAttribute("y");z.removeAttribute("width");z.removeAttribute("height")}};c.setBlur=function(z,G){if(k)e();else{var B=K[0],w=B.id;m=oa(w+"_blur");z-=0;var E=new Aa;if(m){if(z===0)m=null}else{var I=P({element:"feGaussianBlur",attr:{"in":"SourceGraphic",stdDeviation:z}});m=P({element:"filter",attr:{id:w+"_blur"}});m.appendChild(I);kb().appendChild(m);E.addSubCommand(new za(m))}I= {filter:B.getAttribute("filter")};if(z===0){B.removeAttribute("filter");E.addSubCommand(new Na(B,I))}else{ib("filter","url(#"+w+"_blur)");E.addSubCommand(new Na(B,I));c.setBlurOffsets(m,z);k=E;c.undoMgr.beginUndoableChange("stdDeviation",[m?m.firstChild:null]);if(G){c.setBlurNoUndo(z);e()}}}}})();this.getBold=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-weight")=="bold";return false};this.setBold=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&& K[1]==null)ib("font-weight",e?"bold":"normal");K[0].textContent||cb.setCursor()};this.getItalic=function(){var e=K[0];if(e!=null&&e.tagName=="text"&&K[1]==null)return e.getAttribute("font-style")=="italic";return false};this.setItalic=function(e){var k=K[0];if(k!=null&&k.tagName=="text"&&K[1]==null)ib("font-style",e?"italic":"normal");K[0].textContent||cb.setCursor()};this.getFontFamily=function(){return Xa.font_family};this.setFontFamily=function(e){Xa.font_family=e;ib("font-family",e);K[0]&&!K[0].textContent&& cb.setCursor()};this.setFontColor=function(e){Xa.fill=e;ib("fill",e)};this.getFontSize=function(){return Xa.fill};this.getFontSize=function(){return Xa.font_size};this.setFontSize=function(e){Xa.font_size=e;ib("font-size",e);K[0].textContent||cb.setCursor()};this.getText=function(){var e=K[0];if(e==null)return"";return e.textContent};this.setTextContent=function(e){ib("#text",e);cb.init(e);cb.setCursor()};this.setImageURL=function(e){var k=K[0];if(k){var m=$(k).attr(["width","height"]);m=!m.width|| -!m.height;var A=da(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=da(k);if(m!==e){var A= +!m.height;var A=ea(k);if(A!==e)m=true;else if(!m)return;var z=new Aa("Change Image URL");U(k,e);z.addSubCommand(new Na(k,{"#href":A}));m?$(new Image).load(function(){var G=$(k).attr(["width","height"]);$(k).attr({width:this.width,height:this.height});Ga.requestSelector(k).resize();z.addSubCommand(new Na(k,G));ya(z);N("changed",[k])}).attr("src",e):ya(z)}};this.setLinkURL=function(e){var k=K[0];if(k){if(k.tagName!=="a"){k=$(k).parents("a");if(k.length)k=k[0];else return}var m=ea(k);if(m!==e){var A= new Aa("Change Link URL");U(k,e);A.addSubCommand(new Na(k,{"#href":m}));ya(A)}}};this.elementsAreSame=function(e){return!e.length||e[0]==null?null:K.every(function(k){return k&&K[0]?k.nodeName==K[0].nodeName:null})};this.setRectRadius=function(e){c.elementsAreSame(K)&&K[0].tagName=="rect"&&K.forEach(function(k){var m=k.getAttribute("rx");if(m!=e){k.setAttribute("rx",e);k.setAttribute("ry",e);ya(new Na(k,{rx:m,ry:m},"Radius"));N("changed",[k])}})};this.makeHyperlink=function(e){c.groupSelectedElements("a", -e)};this.removeHyperlink=function(){c.ungroupSelectedElement()};this.setSegType=function(e){Ja.setSegType(e)};this.convertToPath=function(e,k){if(e==null)$.each(K,function(ca,S){S&&c.convertToPath(S)});else{if(!k)var m=new Aa("Convert element to Path");var A=k?{}:{fill:O.fill,"fill-opacity":O.fill_opacity,stroke:O.stroke,"stroke-width":O.stroke_width,"stroke-dasharray":O.stroke_dasharray,"stroke-linejoin":O.stroke_linejoin,"stroke-linecap":O.stroke_linecap,"stroke-opacity":O.stroke_opacity,opacity:O.opacity, -visibility:"hidden"};$.each(["marker-start","marker-end","marker-mid","filter","clip-path"],function(){if(e.getAttribute(this))A[this]=e.getAttribute(this)});var z=P({element:"path",attr:A}),G=e.getAttribute("transform");G&&z.setAttribute("transform",G);var B=e.id,w=e.parentNode;e.nextSibling?w.insertBefore(z,e):w.appendChild(z);var E="",I=function(ca){$.each(ca,function(S,W){var Z=W[1];E+=W[0];for(var qa=0;qa=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=oa(B);if(w!=0&& -e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,fa(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"), +m=false;try{m=z.getBBox()}catch(X){}z.parentNode.removeChild(z);return m}else{if(G){G=T(z);qa(G)&&Ja.resetOrientation(z)}m.addSubCommand(new Ka(e,e.nextSibling,w));m.addSubCommand(new za(z));Pa();e.parentNode.removeChild(e);z.setAttribute("id",B);z.removeAttribute("visibility");tb([z],true);ya(m)}}};var Cb=this.changeSelectedAttributeNoUndo=function(e,k,m){var A=d.suspendRedraw(1E3);Da=="pathedit"&&Ja.moveNode(e,k);m=m||K;for(var z=m.length,G=["g","polyline","path"];z--;){var B=m[z];if(B!=null){Da=== +"textedit"&&e!=="#text"&&B.textContent.length&&cb.toSelectMode(B);if((e==="x"||e==="y")&&G.indexOf(B.tagName)>=0){var w=getStrokedBBox([B]);c.moveSelectedElements((e==="x"?k-w.x:0)*p,(e==="y"?k-w.y:0)*p,true)}else{w=e==="#text"?B.textContent:B.getAttribute(e);if(w==null)w="";if(w!==String(k)){if(e=="#text"){svgedit.utilities.getBBox(B);B.textContent=k}else e=="#href"?U(B,k):B.setAttribute(e,k);K.indexOf(B)>=0&&setTimeout(function(){B.parentNode&&Ga.requestSelector(B).resize()},0);w=na(B);if(w!=0&& +e!="transform")for(var E=T(B),I=E.numberOfItems;I--;)if(E.getItem(I).type==4){E.removeItem(I);var F=svgedit.utilities.getBBox(B),g=M(F.x+F.width/2,F.y+F.height/2,ha(E).matrix);F=g.x;g=g.y;var o=d.createSVGTransform();o.setRotate(w,F,g);E.insertItemBefore(o,I);break}}}}}d.unsuspendRedraw(A)},ib=this.changeSelectedAttribute=function(e,k,m){m=m||K;c.undoMgr.beginUndoableChange(e,m);Cb(e,k,m);e=c.undoMgr.finishUndoableChange();e.isEmpty()||ya(e)};this.deleteSelectedElements=function(){for(var e=new Aa("Delete Elements"), k=K.length,m=[],A=0;A1)m=arguments[1];break;default:e="g";k="Group Elements"}k=new Aa(k);var A=P({element:e,attr:{id:ka()}});e==="a"&&U(A,m);k.addSubCommand(new za(A));for(m=K.length;m--;){var z=K[m];if(z!=null){if(z.parentNode.tagName==="a"&&z.parentNode.childNodes.length===1)z=z.parentNode;var G=z.nextSibling,B=z.parentNode;A.appendChild(z);k.addSubCommand(new Ia(z, -G,B))}}k.isEmpty()||ya(k);vb([A],true)};var Kb=this.pushGroupProperties=function(e,k){var m=e.childNodes,A=m.length,z=e.getAttribute("transform"),G=T(e),B=fa(G).matrix,w=new Aa("Push group properties"),E=0,I=oa(e),F=$(e).attr(["filter","opacity"]),g,o;for(E=0;Em[F].width)||(e=="t"||e=="m"||e=="b")&&(E==Number.MIN_VALUE||E>m[F].height)){A=m[F].x;G=m[F].y;z=m[F].x+m[F].width; B=m[F].y+m[F].height;w=m[F].width;E=m[F].height}break;case "largest":if((e=="l"||e=="c"||e=="r")&&(w==Number.MIN_VALUE||wz)z=m[F].x+m[F].width;if(m[F].y+m[F].height>B)B=m[F].y+m[F].height}}if(k=="page"){G=A=0;z=c.contentW;B=c.contentH}w=Array(I);E=Array(I);for(F= 0;F=A.length)e=0;else if(e<0)e=A.length-1;m=A[e]; -break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:ea,findDefs:kb,findDuplicateGradient:Ib,getElem:pa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:na,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:ha, -MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:fa,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400], +G=e/2-this.contentW*p/2,B=k/2-this.contentH*p/2;la(l,{width:this.contentW*p,height:this.contentH*p,x:G,y:B,viewBox:"0 0 "+this.contentW+" "+this.contentH});la(m,{width:l.getAttribute("width"),height:l.getAttribute("height"),x:G,y:B});(m=oa("background_image"))&&la(m,{width:"100%",height:"100%"});Ga.selectorParentGroup.setAttribute("transform","translate("+G+","+B+")");return{x:G,y:B,old_x:A,old_y:z,d_x:G-A,d_y:B-z}};this.setBackground=function(e,k){var m=oa("canvasBackground"),A=$(m).find("rect")[0], +z=oa("background_image");A.setAttribute("fill",e);if(k){if(!z){z=f.createElementNS(b,"image");la(z,{id:"background_image",width:"100%",height:"100%",preserveAspectRatio:"xMinYMin",style:"pointer-events:none"})}U(z,k);m.appendChild(z)}else z&&z.parentNode.removeChild(z)};this.cycleElement=function(e){var k=K[0],m=false,A=ob(L||C().getCurrentLayer());if(A.length){if(k==null){e=e?A.length-1:0;m=A[e]}else for(var z=A.length;z--;)if(A[z]==k){e=e?z-1:z+1;if(e>=A.length)e=0;else if(e<0)e=A.length-1;m=A[e]; +break}vb([m],true);N("selected",K)}};this.clear();this.getPrivateMethods=function(){return{addCommandToHistory:ya,setGradient:Mb,addSvgElementFromJson:P,assignAttributes:la,BatchCommand:Aa,call:N,ChangeElementCommand:Na,copyElem:ja,ffClone:fa,findDefs:kb,findDuplicateGradient:Ib,getElem:oa,getId:ba,getIntersectionList:sb,getMouseTarget:mb,getNextId:ka,getPathBBox:Y,getUrlFromAttr:ia,hasMatrixTransform:qa,identifyLayers:Db,InsertElementCommand:za,isIdentity:svgedit.math.isIdentity,logMatrix:Va,matrixMultiply:aa, +MoveElementCommand:Ia,preventClickDefault:Gb,recalculateAllSelectedDimensions:Fa,recalculateDimensions:Qa,remapElement:$a,RemoveElementCommand:Ka,removeUnusedDefElems:Nb,round:eb,runExtensions:lb,sanitizeSvg:Ea,SVGEditTransformList:svgedit.transformlist.SVGTransformList,toString:toString,transformBox:svgedit.math.transformBox,transformListToTransform:ha,transformPoint:M,walkTree:svgedit.utilities.walkTree}}};(function(){document.addEventListener("touchstart",touchHandler,true);document.addEventListener("touchmove",touchHandler,true);document.addEventListener("touchend",touchHandler,true);document.addEventListener("touchcancel",touchHandler,true);if(!window.svgEditor)window.svgEditor=function(a){function q(d,l){var s=h.setSvgString(d)!==false;l=l||a.noop;s?l(true):a.alert(uiStrings.notification.errorLoadingSVG,function(){l(false)})}var h,b={},n=false;curConfig={canvas_expansion:1,dimensions:[580,400], initFill:{color:"fff",opacity:1},initStroke:{width:1.5,color:"000",opacity:1},initOpacity:1,imgPath:"images/",extPath:"extensions/",jGraduatePath:"jgraduate/images/",extensions:[],initTool:"select",wireframe:false,colorPickerCSS:false,gridSnapping:false,gridColor:"#000",baseUnit:"px",snappingStep:10,showRulers:svgedit.browser.isTouch()?false:true,show_outside_canvas:false,no_save_warning:true,initFont:"Helvetica, Arial, sans-serif"};uiStrings=b.uiStrings={common:{ok:"OK",cancel:"Cancel",key_up:"Up", key_down:"Down",key_backspace:"Backspace",key_del:"Del"},layers:{layer:"Layer"},notification:{invalidAttrValGiven:"Invalid value given",noContentToFitTo:"No content to fit to",dupeLayerName:"There is already a layer named that!",enterUniqueLayerName:"Please enter a unique layer name",enterNewLayerName:"Please enter the new layer name",layerHasThatName:"Layer already has that name",QmoveElemsToLayer:'Move selected elements to layer "%s"?',QwantToClear:"Do you want to clear the drawing?\nThis will also erase your undo history!", QwantToOpen:"Do you want to open a new file?\nThis will also erase your undo history!",QerrorsRevertToSource:"There were parsing errors in your SVG source.\nRevert back to original SVG source?",QignoreSourceChanges:"Ignore changes made to SVG source?",featNotSupported:"Feature not supported",enterNewImgURL:"Enter the new image URL",defsFailOnSave:"NOTE: Due to a bug in your browser, this image may appear wrong (missing gradients or elements). It will however appear correct once actually saved.",loadingImage:"Loading image, please wait...", saveFromBrowser:'Select "Save As..." in your browser to save this image as a %s file.',noteTheseIssues:"Also note the following issues: ",unsavedChanges:"There are unsaved changes.",enterNewLinkURL:"Enter the new hyperlink URL",errorLoadingSVG:"Error: Unable to load SVG data",URLloadFail:"Unable to load from URL",retrieving:'Retrieving "%s" ...'}};var u={},c={};b.curConfig=curConfig;b.tool_scale=1;b.setConfig=function(d){a.extend(true,curConfig,d);if(d.extensions)curConfig.extensions=d.extensions}; b.setCustomHandlers=function(d){b.ready(function(){if(d.open){a('#tool_open > input[type="file"]').remove();a("#tool_open").show();h.open=d.open}if(d.save){b.show_save_warning=false;h.bind("saved",d.save)}d.pngsave&&h.bind("exported",d.pngsave);c=d})};b.randomizeIds=function(){h.randomizeIds(arguments)};b.init=function(){function d(g,o){var v=g.id,D=v.split("_"),H=D[0];D=D[1];o&&h.setStrokeAttr("stroke-"+H,D);nb();Ib("#cur_"+H,v,20);a(g).addClass("current").siblings().removeClass("current")}function l(g, o){var v=document.getElementById("ruler_x_cursor"),D=document.getElementById("ruler_y_cursor"),H=document.getElementById("workarea");document.getElementById("title_show");svgedit.browser.isTouch()&&a("#workarea").unbind("mousemove.rulers").bind("mousemove.rulers",function(Qb){Qb.stopPropagation();v.style.left=Qb.pageX-66+H.scrollLeft+"px";D.style.top=Qb.pageY-48+H.scrollTop+"px"});o||(o=h.getZoom());g||(g=a("#svgcanvas"));for(var J=h.getContentElem(),X=svgedit.units.getTypeMap()[curConfig.baseUnit], -ca=0;ca<2;ca++){var S=ca===0,W=S?"x":"y",Z=S?"width":"height",qa=J.getAttribute(W)-0;W=a("#ruler_"+W+" canvas:first");$hcanv=W.clone();W.replaceWith($hcanv);var ta=$hcanv[0];var ga=W=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(W>=3E4){var Ma=parseInt(W/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va, -bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;vaW){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event"); +da=0;da<2;da++){var S=da===0,V=S?"x":"y",Z=S?"width":"height",pa=J.getAttribute(V)-0;V=a("#ruler_"+V+" canvas:first");$hcanv=V.clone();V.replaceWith($hcanv);var ta=$hcanv[0];var ga=V=g[Z]()*2;ta.parentNode.style[Z]=ga+"px";var Ta=0,Ha,sa=ta.getContext("2d");sa.fillStyle="rgb(200,0,0)";sa.fillRect(0,0,ta.width,ta.height);$hcanv.siblings().remove();if(V>=3E4){var Ma=parseInt(V/3E4)+1;Ha=Array(Ma);Ha[0]=sa;for(var va=1;va=1)va=Math.round(Ma);else{va=(ta+"").split(".")[1].length;va=Ma.toFixed(va)-0}if(va!==0&&va!==1E3&&va%1E3===0)va=va/1E3+"K";if(S){sa.fillText(va, +bb+2,8);sa.fillStyle="#777"}else{Ma=(va+"").split("");for(va=0;vaV){Ta++;sa.stroke();if(Ta>=Ha.length){va=10;bb=ga;continue}sa=Ha[Ta];bb-=3E4;wb=Math.round(bb+Ma*va)+0.5}var Eb=va%2?12:10;if(S){sa.moveTo(wb,15);sa.lineTo(wb,Eb)}else{sa.moveTo(15,wb);sa.lineTo(Eb,wb)}}}sa.strokeStyle="#666";sa.stroke()}}(function(){var g=window.opener;if(g)try{var o=g.document.createEvent("Event"); o.initEvent("svgEditorReady",true,true);g.document.documentElement.dispatchEvent(o)}catch(v){}})();(function(){a("#canvas_width").val(curConfig.dimensions[0]);a("#canvas_height").val(curConfig.dimensions[1]);a("body").toggleClass("touch",svgedit.browser.isTouch());var g=a.deparam.querystring(true);if(!a.isEmptyObject(g)){if(g.dimensions)g.dimensions=g.dimensions.split(",");if(g.extensions)g.extensions=g.extensions.split(",");if(g.bkgd_color)g.bkgd_color="#"+g.bkgd_color;svgEditor.setConfig(g);var o= g.source,v=a.param.querystring();if(!o)if(v.indexOf("source=data:")>=0)o=v.match(/source=(data:[^&]*)/)[1];if(o)if(o.indexOf("data:")===0){o=o.replace(/ /g,"+");b.loadFromDataURI(o)}else b.loadFromString(o);else if(v.indexOf("paramurl=")!==-1)svgEditor.loadFromURL(v.substr(9));else g.url&&svgEditor.loadFromURL(g.url)}})();var s=function(){a.each(curConfig.extensions,function(){var g=this;a.getScript(curConfig.extPath+g,function(o){if(!o){o=document.createElement("script");o.src=curConfig.extPath+ g;document.querySelector("head").appendChild(o)}})})};document.location.protocol==="file:"?setTimeout(s,100):s();a.svgIcons(curConfig.imgPath+"svg_edit_icons.svg",{w:27,h:27,id_match:false,no_img:true,fallback_path:curConfig.imgPath,fallback:{logo:"logo.png",select:"select.png",select_node:"select_node.png",pencil:"pencil.png",pen:"line.png",rect:"square.png",ellipse:"ellipse.png",path:"path.png",text:"text.png",image:"image.png",zoom:"zoom.png","delete":"delete.png",spapelib:"shapelib.png",node_delete:"node_delete.png", @@ -391,45 +391,45 @@ align_left:"align-left.png",align_center:"align-center.png",align_right:"align-r resize:{"#logo .svg_icon":15,".flyout_arrow_horiz .svg_icon":5,"#fill_bg .svg_icon, #stroke_bg .svg_icon":svgedit.browser.isTouch()?24:24,".palette_item:first .svg_icon":svgedit.browser.isTouch()?30:16,"#zoomLabel .svg_icon":16,"#zoom_dropdown .svg_icon":7},callback:function(){a(".toolbar_button button > svg, .toolbar_button button > img").each(function(){a(this).parent().prepend(this)});a(".tool_button, .tool_button_current").addClass("loaded");var g=a("#tools_left");if(g.length!=0){g.offset();g.outerHeight()}a(".tools_flyout").each(function(){var o= a("#"+this.id+"_show"),v=o.attr("data-curopt");if(!o.children("svg, img").length){v=a(v).children().clone();if(v.length){v[0].removeAttribute("style");o.append(v)}}});svgEditor.runCallbacks();setTimeout(function(){a(".flyout_arrow_horiz:empty").each(function(){a(this).append(a.getSvgIcon("arrow_right").width(5).height(5))})},1)}});a("#rulers").on("dblclick",function(g){a("#base_unit_container").css({top:g.pageY-10,left:g.pageX-50,display:"block"})});a("#base_unit_container").on("mouseleave mouseenter", function(){t=setTimeout(function(){a("#base_unit_container").fadeOut(500)},200);event.type=="mouseover"&&clearTimeout(t)});a("#base_unit").on("change",function(){savePreferences()});b.canvas=h=new a.SvgCanvas(document.getElementById("svgcanvas"),curConfig);b.show_save_warning=false;b.paintBox={fill:null,stroke:null,canvas:null};s=navigator.platform.indexOf("Mac")>=0;var C=navigator.userAgent.indexOf("AppleWebKit")>=0,p=s?"meta+":"ctrl+",L=h.pathActions,R=h.undoMgr,O=svgedit.utilities,K=curConfig.imgPath+ -"placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,ha=1,na="toolbars",fa="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("

    "+H.replace(/\n/g,"

    ")+"

    ").toggleClass("prompt",D=="prompt");o.empty();var ca=a('').appendTo(o);D!="alert"&&a('').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){ca.trigger("click touchstart")})}D=="process"&&ca.hide();g.show();ca.on("click touchstart",function(){g.hide();var W=D=="prompt"?S.val():true;J&&J(W)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert", -D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var aa=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},V=null,ra=false,ia=false,da="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o, -P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var ca=v.zoom,S=function(W){W=(W-J)/500;W=Math.pow(W-1,3)+1;h.setZoom(ca+X*W);w();if(W<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now()); -h.getMode()=="zoom"&&D.width&&aa();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},oa={},pa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(W){var Z=v[W];oa[Z.sel]=Z.fn;if(Z.isDefault)X=W;W=function(qa){var ta=Z;if(qa.type=== -"keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!qa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt", -ta.sel)};a(this).mouseup(W);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],W)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var ca,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(W){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),qa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")? -200:0;ca=setTimeout(function(){J.data("isLibrary")?Z.css("left",qa).show():Z.css("left",ta).show().animate({left:qa},50);Z.data("shown_popop",true)},ga);W.preventDefault()}).mouseup(function(){clearTimeout(ca);var W=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&W in oa&&oa[W]()})});Ba()},la=function(g,o){return a("
    ",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g= -a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*ha,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}: +"placeholder.svg",P=a("#workarea"),T=a("#cmenu_canvas"),M=null,aa=1,qa="toolbars",ha="";s||a(".shortcut").each(function(){var g=a(this).text();a(this).text(g.split("\u2318").join("Ctrl+"))});(function(){a("#dialog_container").draggable({cancel:"#dialog_content, #dialog_buttons *",containment:"window"});var g=a("#dialog_box"),o=a("#dialog_buttons"),v=function(D,H,J,X){a("#dialog_content").html("

    "+H.replace(/\n/g,"

    ")+"

    ").toggleClass("prompt",D=="prompt");o.empty();var da=a('').appendTo(o);D!="alert"&&a('').appendTo(o).on("click, touchstart",function(){g.hide();J(false)});if(D=="prompt"){var S=a('').prependTo(o);S.val(X||"");S.bind("keydown","return",function(){da.trigger("click touchstart")})}D=="process"&&da.hide();g.show();da.on("click touchstart",function(){g.hide();var V=D=="prompt"?S.val():true;J&&J(V)}).focus();D=="prompt"&&S.focus()};a.alert=function(D,H){v("alert", +D,H)};a.confirm=function(D,H){v("confirm",D,H)};a.process_cancel=function(D,H){v("process",D,H)};a.prompt=function(D,H,J){v("prompt",D,J,H)}})();var ca=function(){var g=a(".tool_button_current");if(g.length&&g[0].id!=="tool_select"){g.removeClass("tool_button_current").addClass("tool_button");a("#tool_select").addClass("tool_button_current").removeClass("tool_button")}h.setMode("select")},W=null,ra=false,ia=false,ea="",U=function(g,o){var v=h.getResolution();a("#svgcanvas").position();var D=h.setBBoxZoom(o, +P.width()-15,P.height()-15);if(D){var H=D.zoom;D=D.bbox;if(H<0.0010)xa({value:0.1});else{typeof animatedZoom!="undefined"&&g.cancelAnimationFrame(animatedZoom);var J=Date.now(),X=H-v.zoom;a("#zoom");var da=v.zoom,S=function(V){V=(V-J)/500;V=Math.pow(V-1,3)+1;h.setZoom(da+X*V);w();if(V<1)g.animatedZoom=requestAnimationFrame(S);else{a("#zoom").val(parseInt(H*100));a("option","#zoom_select").removeAttr("selected");a("option[value="+parseInt(H*100)+"]","#zoom_select").attr("selected","selected")}};S(Date.now()); +h.getMode()=="zoom"&&D.width&&ca();Ab()}}};a("#cur_context_panel").delegate("a","click",function(){var g=a(this);g.attr("data-root")?h.leaveContext():h.setContext(g.text());return false});var Y=function(){b.paintBox.fill.prep();b.paintBox.stroke.prep()},na={},oa=function(g){a.each(g,function(o,v){var D=a(o).children(),H=o+"_show",J=a(H),X=false;D.addClass("tool_button").unbind("click mousedown mouseup").each(function(V){var Z=v[V];na[Z.sel]=Z.fn;if(Z.isDefault)X=V;V=function(pa){var ta=Z;if(pa.type=== +"keydown"){var ga=a(ta.parent+"_show").hasClass("tool_button_current"),Ta=a(ta.parent+"_show").attr("data-curopt");a.each(g[Z.parent],function(sa,Ma){if(Ma.sel==Ta)ta=!pa.shiftKey||!ga?Ma:g[Z.parent][sa+1]||g[Z.parent][0]})}if(a(this).hasClass("disabled"))return false;Ya(H)&&ta.fn();var Ha=ta.icon?a.getSvgIcon(ta.icon,true):a(ta.sel).children().eq(0).clone();Ha[0].setAttribute("width",J.width());Ha[0].setAttribute("height",J.height());J.children(":not(.flyout_arrow_horiz)").remove();J.append(Ha).attr("data-curopt", +ta.sel)};a(this).mouseup(V);Z.key&&a(document).bind("keydown",Z.key[0]+" shift+"+Z.key[0],V)});if(X)J.attr("data-curopt",v[X].sel);else J.attr("data-curopt")||J.attr("data-curopt",v[0].sel);var da,S=a(H).position();a(o).css({left:S.left+34,top:S.top+77});J.mousedown(function(V){a("#workarea").one("mousedown",function(){a("#tools_shapelib").hide()});a("#tools_shapelib").is(":visible")&&Ya(H,false);if(J.hasClass("disabled"))return false;var Z=a(o),pa=S.left+34,ta=Z.width()*-1,ga=Z.data("shown_popop")? +200:0;da=setTimeout(function(){J.data("isLibrary")?Z.css("left",pa).show():Z.css("left",ta).show().animate({left:pa},50);Z.data("shown_popop",true)},ga);V.preventDefault()}).mouseup(function(){clearTimeout(da);var V=a(this).attr("data-curopt");if(J.data("isLibrary")&&a(H.replace("_show","")).is(":visible"))Ya(H,true);else Ya(H)&&V in na&&na[V]()})});Ba()},la=function(g,o){return a("
    ",{"class":"tools_flyout",id:g}).appendTo("#svg_editor").append(o)},ma=function(){a(".tools_flyout").each(function(){var g= +a("#"+this.id+"_show"),o=g.offset();g=g.outerWidth();a(this).css({left:(o.left+g)*aa,top:o.top})})},Ba=function(){a(".tools_flyout").each(function(){var g=a("#"+this.id+"_show");if(!g.data("isLibrary")){var o=[];a(this).children().each(function(){o.push(this.title)});g[0].title=o.join(" / ")}})},Ea,Ia=function(g,o,v){var D=null;if(g.indexOf("url(#")===0){g=(g=h.getRefElem(g))?g.cloneNode(true):a("#"+v+"_color defs *")[0];D={alpha:o};D[g.tagName]=g}else D=g.indexOf("#")===0?{alpha:o,solidColor:g.substr(1)}: {alpha:o,solidColor:"none"};return new a.jGraduate.Paint(D)},za=h.getResolution();if(curConfig.baseUnit!=="px"){za.w=svgedit.units.convertUnit(za.w)+curConfig.baseUnit;za.h=svgedit.units.convertUnit(za.h)+curConfig.baseUnit}var Ka=function(g){h.createLayer("background");cur_shape=h.addSvgElementFromJson({element:"rect",attr:{x:-1,y:-1,width:za.w+2,height:za.h+2,stroke:"none",id:"canvas_background",opacity:1,fill:g||"#fff",style:"pointer-events:none"}});h.setCurrentLayer("Layer 1");h.setCurrentLayerPosition("1")}; -document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=V;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide(); +document.getElementById("canvas_background")||Ka();document.getElementById("canvas_background").getAttribute("fill");var Na=b.setImageURL=function(g){g||(g=K);h.setImageURL(g);a("#image_url").val(g)},Aa=function(){var g=W;if(g!=null&&!g.parentNode)g=null;if(ra&&ra[0]!=null&&!ra[0].parentNode)ra=false;var o=h.getCurrentDrawing().getCurrentLayerName(),v=h.getMode(),D=curConfig.baseUnit!=="px"?curConfig.baseUnit:null,H=v=="pathedit";if(H){a(".context_panel").hide();a("#path_node_panel").show();a("#stroke_panel").hide(); o=L.getNodePoint();a("#tool_add_subpath").removeClass("push_button_pressed").addClass("tool_button");a("#tool_node_delete").toggleClass("disabled",!L.canDeleteNodes);Ib("#tool_openclose_path",L.closed_subpath?"open_path":"close_path");if(o){H=a("#seg_type");if(D){o.x=svgedit.units.convertUnit(o.x);o.y=svgedit.units.convertUnit(o.y)}a("#path_node_x").val(Math.round(o.x));a("#path_node_y").val(Math.round(o.y));o.type?H.val(o.type).removeAttr("disabled"):H.val(4).attr("disabled","disabled")}a("#tools_top").removeClass("multiselected"); -a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,ca=h.getRotationAngle(g); -a("#angle").val(Math.round(ca));ca=h.getBlur(g);a("#blur").val(ca);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,W;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;W=v.y}if(D){S=svgedit.units.convertUnit(S);W=svgedit.units.convertUnit(W)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(W));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(W))}["image","text","path","g","use"].indexOf(X)== +a("#stroke_panel").hide();a("#canvas_panel").hide()}else{var J=a("#cmenu_canvas li");a(".context_panel").hide();a(".menu_item","#edit_menu").addClass("disabled");a(".menu_item","#object_menu").addClass("disabled");if(ra){ra=ra.filter(Boolean);(g=h.elementsAreSame(ra)?ra[0]:null)&&a("#tools_top").addClass("multiselected")}if(!g&&!ra){a("#tools_top").removeClass("multiselected");a("#stroke_panel").hide();a("#canvas_panel").show()}if(g!=null){a("#stroke_panel").show();var X=g.nodeName,da=h.getRotationAngle(g); +a("#angle").val(Math.round(da));da=h.getBlur(g);a("#blur").val(da);if(!H&&v!="pathedit"){a("#selected_panel").show();a(".action_selected").removeClass("disabled");var S,V;if(["g","polyline","path"].indexOf(X)>=0)if(v=h.getStrokedBBox([g])){S=v.x;V=v.y}if(D){S=svgedit.units.convertUnit(S);V=svgedit.units.convertUnit(V)}a("#"+X+"_x").val(Math.round(S));a("#"+X+"_y").val(Math.round(V));if(X==="polyline"){a("#path_x").val(Math.round(S));a("#path_y").val(Math.round(V))}["image","text","path","g","use"].indexOf(X)== -1&&a(".action_path_convert_selected").removeClass("disabled");X==="path"&&a(".action_path_selected").removeClass("disabled")}D=null;if(Z==="a"){D=h.getHref(g);a("#g_panel").show()}if(g.parentNode.tagName==="a")if(!a(g).siblings().length){a("#a_panel").show();D=h.getHref(g.parentNode)}a("#tool_make_link, #tool_make_link").toggle(!D);D&&a("#link_url").val(D);D={g:[],a:[],rect:["rx","width","height","x","y"],image:["width","height","x","y"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],line:["x1", -"y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(qa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")=== +"y1","x2","y2"],text:["x","y"],use:[],path:[]};var Z=g.tagName;a(g).data("gsvg")&&a("#g_panel").show();if(Z=="path"||Z=="polyline")a("#path_panel").show();if(D[Z]){D=D[Z];a("#"+Z+"_panel").show();Z=="rect"?a("#cornerRadiusLabel").show():a("#cornerRadiusLabel").hide();a.each(D,function(pa,ta){var ga=g.getAttribute(ta);if(curConfig.baseUnit!=="px"&&g[ta])ga=svgedit.units.convertUnit(g[ta].baseVal.value);var Ta=document.getElementById(Z+"_"+ta);Ta.value=Math.round(ga)||0;Ta.getAttribute("data-cursor")=== "true"&&a.fn.dragInput.updateCursor(Ta)});if(Z=="text"){D=g.getAttribute("font-family");document.getElementById("font_family_dropdown").selectedIndex=3;a("#text_panel").css("display","inline");a("#tool_italic").toggleClass("active",h.getItalic());a("#tool_bold").toggleClass("active",h.getBold());a("#font_family").val(D);a("#font_size").val(g.getAttribute("font-size"));a("#text").val(g.textContent);a("#preview_font").text(D.split(",")[0].replace(/'/g,"")).css("font-family",D);h.addedNew&&setTimeout(function(){a("#text").focus().select()}, 100)}else if(Z=="image")Na(h.getHref(g));else if(Z==="g"||Z==="use"){a("#container_panel").show();a(".action_group_selected").removeClass("disabled");h.getTitle()}}J[(Z==="g"?"en":"dis")+"ableContextMenuItems"]("#ungroup");J[(Z==="g"||!ra?"dis":"en")+"ableContextMenuItems"]("#group")}if(ra){a("#multiselected_panel").show();a(".action_multi_selected").removeClass("disabled");J.enableContextMenuItems("#group").disableContextMenuItems("#ungroup")}g||J.disableContextMenuItems("#delete,#cut,#copy,#group,#ungroup,#move_front,#move_up,#move_down,#move_back"); R.getUndoStackSize()>0?a("#tool_undo").removeClass("disabled"):a("#tool_undo").addClass("disabled");R.getRedoStackSize()>0?a("#tool_redo").removeClass("disabled"):a("#tool_redo").addClass("disabled");h.addedNew=false;if(g&&!H||ra){a("#selLayerNames").removeAttr("disabled").val(o);T.enableContextMenuItems("#delete,#cut,#copy,#move_front,#move_up,#move_down,#move_back")}}};a("#text").on("focus",function(){});a("#text").on("blur",function(){});h.bind("selected",function(g,o){var v=h.getMode();v==="select"&& -aa();if(v==="pathedit")return Aa();V=o.length==1||o[1]==null?o[0]:null;o=o.filter(Boolean);ra=o.length>=2?o:false;if(h.elementsAreSame(ra))V=ra[0];if(V!=null){a("#multiselected_panel").hide();if(V!=null)switch(V.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=V.getElementsByTagName("*"),H=0,J=D.length;H=2&&o[1]!= -null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&aa();for(var D=0;D=2?o:false;if(h.elementsAreSame(ra))W=ra[0];if(W!=null){a("#multiselected_panel").hide();if(W!=null)switch(W.tagName){case "use":case "image":case "foreignObject":break;case "g":case "a":v=null;for(var D=W.getElementsByTagName("*"),H=0,J=D.length;H=2&&o[1]!= +null?o:null;if(!ra)switch(v){case "rotate":v=h.getRotationAngle(D);a("#angle").val(Math.round(v));rotateCursor(v);a("#tool_reorient").toggleClass("disabled",v==0)}h.runExtensions("elementTransition",{elems:o})}});h.bind("changed",function(g,o){var v=h.getMode();v==="select"&&ca();for(var D=0;D\n'+o;var v=navigator.userAgent;if(~v.indexOf("Chrome")&&a.browser.version>=533||~v.indexOf("MSIE"))kb(0,true);else{var D=g.open("data:image/svg+xml;base64,"+O.encode64(o)),H=a.pref("save_notice_done");if(H!=="all"){var J=uiStrings.notification.saveFromBrowser.replace("%s","SVG");if(v.indexOf("Gecko/")!==-1)if(o.indexOf("",{id:"export_canvas"}).hide().appendTo("body");var D=a("#export_canvas")[0];D.width=h.contentW;D.height=h.contentH;canvg(D,o.svg,{renderCallback:function(){var H=D.toDataURL("image/png");M.location.href=H;if(a.pref("export_notice_done")!=="all"){H=uiStrings.notification.saveFromBrowser.replace("%s", -"PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v=''+h.getCurrentDrawing().getCurrentLayerName()+"";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > '+this.id+"":" > "+this.id}});da=D}else da=null;a("#cur_context_panel").toggle(!!o).html(v)}); -h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},ca=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("
    ",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='
    '+ +"PNG");if(v.length)H+="\n\n"+uiStrings.notification.noteTheseIssues+"\n \u2022 "+v.join("\n \u2022 ");a.pref("export_notice_done","all");M.alert(H)}}})});h.bind("zoomed",U);h.bind("contextset",function(g,o){var v="";if(o){var D="";v=''+h.getCurrentDrawing().getCurrentLayerName()+"";a(o).parentsUntil("#svgcontent > g").andSelf().each(function(){if(this.id){D+=" > "+this.id;v+=this!==o?' > '+this.id+"":" > "+this.id}});ea=D}else ea=null;a("#cur_context_panel").toggle(!!o).html(v)}); +h.bind("extension_added",function(g,o){function v(){if(Ea){clearTimeout(Ea);Ea=null}H||(Ea=setTimeout(function(){H=true;Kb(u.iconsize)},50))}var D=false,H=false,J=true,X=function(){if(o.callback&&!D&&J){D=true;o.callback()}},da=[];o.context_tools&&a.each(o.context_tools,function(ta,ga){var Ta=ga.container_id?' id="'+ga.container_id+'"':"",Ha=a("#"+ga.panel);Ha.length||(Ha=a("
    ",{id:ga.panel}).appendTo("#tools_top").hide());switch(ga.type){case "tool_button":var sa='
    '+ ga.id+"
    ",Ma=a(sa).appendTo(Ha);ga.events&&a.each(ga.events,function(Ua,bb){a(Ma).bind(Ua,bb)});break;case "select":sa="";var va=a(sa).appendTo(Ha).find("select");a.each(ga.events,function(Ua,bb){a(va).bind(Ua,bb)});break;case "button-select":sa='';Ta=a('
      ').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();ca.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="'+ga.label+':'; -var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},W={},Z=o.svgicons,qa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")W["#"+Ha+" > div"]=sa;else W["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma= +ga.id+'" class="icon_label">
      ';Ta=a('
        ').appendTo("#option_lists");ga.colnum&&Ta.addClass("optcols"+ga.colnum);a(sa).appendTo(Ha).children();da.push({elem:"#"+ga.id,list:"#"+ga.id+"_opts",title:ga.title,callback:ga.events.change,cur:"#cur_"+ga.id});break;case "input":sa="'+ga.label+':'; +var Za=a(sa).appendTo(Ha).find("input");ga.spindata&&Za.SpinButton(ga.spindata);ga.events&&a.each(ga.events,function(Ua,bb){Za.bind(Ua,bb)})}});if(o.buttons){var S={},V={},Z=o.svgicons,pa={};a.each(o.buttons,function(ta,ga){for(var Ta,Ha=ga.id,sa=ta;a("#"+Ha).length;)Ha=ga.id+"_"+ ++sa;if(Z){S[Ha]=ga.icon;sa=ga.svgicon?ga.svgicon:ga.id;if(ga.type=="app_menu")V["#"+Ha+" > div"]=sa;else V["#"+Ha]=sa}else Ta=ga.type=="menu"?"":a('');var Ma,va;switch(ga.type){case "mode_flyout":case "mode":Ma= "tool_button";if(ga.cls)Ma+=" "+ga.cls;va="#tools_left";break;case "context":Ma="tool_button";va="#"+ga.panel;a(va).length||a("
        ",{id:ga.panel}).appendTo("#tools_top");break;case "menu":Ma="menu_item tool_button";va="#"+(ga.after||ga.panel);break;case "app_menu":Ma="";va=ga.parent||"#main_menu ul";a(va).length||a("
        ",{id:ga.panel}).appendTo("#tools_top")}var Za=a(ga.list||ga.type=="app_menu"?"
      • ":"
        ").attr("id",Ha).attr("title",ga.title).addClass(Ma);if(!ga.includeWith&&!ga.list){if("position"in -ga)a(va).children().eq(ga.position).before(Za);else ga.type!="menu"||!ga.after?Za.appendTo(va):a(va).after(Za);if(ga.type=="mode_flyout"){sa=a(Za);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){var Ua=sa[0].id.replace("tool_","tools_"),bb=sa.clone().attr("id",Ua+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true}, -Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;W["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"})); -sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)W["#"+Ua+"_show"]=ga.id;Ha=qa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua",{"class":"flyout_arrow_horiz"}));sa.before(bb);Ma=la(Ua,sa);Ma.data("isLibrary",true);bb.data("isLibrary",true)}V["#"+Ua+"_show"]=ga.id;Ha=pa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,isDefault:true}, +Fb]}else if(ga.type=="app_menu"||ga.type=="menu")Za.append(ga.title)}else if(ga.list){Za.addClass("push_button");a("#"+ga.list+"_opts").append(Za);if(ga.isDefault){a("#cur_"+ga.list).append(Za.children().clone());sa=ga.svgicon?ga.svgicon:ga.id;V["#cur_"+ga.list]=sa}}else if(ga.includeWith){va=ga.includeWith;sa=a(va.button);Ma=sa.parent();if(!sa.parent().hasClass("tools_flyout")){Ua=sa[0].id.replace("tool_","tools_");bb=sa.clone().attr("id",Ua+"_show").append(a("
        ",{"class":"flyout_arrow_horiz"})); +sa.before(bb);Ma=la(Ua,sa)}var Fb=B.getButtonData(va.button);if(va.isDefault)V["#"+Ua+"_show"]=ga.id;Ha=pa["#"+Ma[0].id]=[{sel:"#"+Ha,fn:ga.events.click,icon:ga.id,key:ga.key,isDefault:ga.includeWith?ga.includeWith.isDefault:0},Fb];Ua="position"in va?va.position:"last";Fb=Ma.children().length;if(!isNaN(Ua)&&Ua>=0&&Ua
        '});a("#palette").append(ya); var Ga=a("#tool_angle_indicator");a("#tool_reorient");rotateCursor=function(g){g="rotate("+g+"deg)";Ga.css({"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g})};var xa=function(g){var o=g.value/100;if(o<0.0010)g.value=0.1;else{g=h.getZoom();U(window,{width:0,height:0,x:(P[0].scrollLeft+P.width()/2)/g,y:(P[0].scrollTop+P.height()/2)/g,zoom:o},true)}},nb=function(){window.opera&&a("

        ").hide().appendTo("body").remove()};a("#stroke_style").change(function(){h.setStrokeAttr("stroke-dasharray", a(this).val());a("#stroke_style_label").html(this.options[this.selectedIndex].text);nb()});a("#seg_type").change(function(){h.setSegType(a(this).val());a("#seg_type_label").html(this.options[this.selectedIndex].text)});a("select").change(function(){a(this).blur()});a("#font_family").change(function(){h.setFontFamily(this.value)});a("#text").keyup(function(){h.setTextContent(this.value)});changeAttribute=function(g){var o=g.getAttribute("data-attr"),v=g.getAttribute("data-multiplier")||1;v=parseFloat(v); -v=g.value*v;if(!svgedit.units.isValidUnit(o,v,V)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=V.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v= +v=g.value*v;if(!svgedit.units.isValidUnit(o,v,W)){a.alert(uiStrings.notification.invalidAttrValGiven);g.value=W.getAttribute(o);return false}h.changeSelectedAttributeNoUndo(o,v)};a("#palette").mouseover(function(){var g=a('');a(this).append(g);g.focus().remove()});a(".palette_item").on("mousedown touchstart touchmove",function(){var g=a("#tool_stroke").hasClass("active"),o=g?"stroke":"fill",v=a(this).attr("data-rgb"),D=null;if(v==="transparent"||v==="initial"||v==="#none"){v= "none";D=new a.jGraduate.Paint}else D=new a.jGraduate.Paint({alpha:100,solidColor:v.substr(1)});b.paintBox[o].setPaint(D);if(g){h.setColor("stroke",v);v!="none"&&h.getStrokeOpacity()!=1&&h.setPaintOpacity("stroke",1)}else{h.setColor("fill",v);v!="none"&&h.getFillOpacity()!=1&&h.setPaintOpacity("fill",1)}}).bind("contextmenu",function(g){g.preventDefault()});a("#toggle_stroke_tools").toggle(function(){a(".stroke_tool").css("display","table-cell");a(this).addClass("expanded");m()},function(){a(".stroke_tool").css("display", "none");a(this).removeClass("expanded");m()});var Ya=function(g,o){if(a(g).hasClass("disabled"))return false;if(a(g).parent().hasClass("tools_flyout"))return true;var v=v||"normal";o||a(".tools_flyout").fadeOut(v);a("#styleoverrides").text("");a(".tool_button_current").removeClass("tool_button_current").addClass("tool_button");a(g).addClass("tool_button_current").removeClass("tool_button");return true};(function(){var g=null,o=null,v=P[0],D=false,H=false;a("#svgcanvas").bind("mousemove mouseup touchend", function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J.clientX;o=J.clientY;if(J.type==="mouseup"||J.type==="touchend")D=false;return false}}).on("mousedown touchmove",function(J){if(J.button===1||H===true||J.originalEvent.touches&&J.originalEvent.touches.length>=2){D=true;g=J.clientX;o=J.clientY;return false}});a(window).mouseup(function(){D=false;a("body").removeClass("dragging")});a(document).bind("keydown","space",function(J){J.preventDefault();h.spaceKey=H=true}).bind("keyup", @@ -437,63 +437,63 @@ function(J){if(D!==false){v.scrollLeft-=J.clientX-g;v.scrollTop-=J.clientY-o;g=J ""},200);setTimeout(function(){a("#menu_bar").removeClass("active")},220);return false};a(".menu_item").on("mousedown touchstart",function(g){Sa(g)});a("svg, body").on("mousedown touchstart",function(g){if(g.target.nodeName.toLowerCase()!=="input")if(!a(g.target).hasClass("menu_title")&&!a(g.target).parent().hasClass("menu_title"))!a(g.target).hasClass("disabled")&&a(g.target).hasClass("menu_item")?Sa(g):a("#menu_bar").removeClass("active")});a("#workarea").on("mousewheel",function(g,o,v,D){if(g.altKey){g.preventDefault(); zoom=parseInt(a("#zoom").val());a("#zoom").val(parseInt(zoom+D*10)).change()}});a(".menu_title").on("mousedown",function(){a("#tools_shapelib").hide();a("#menu_bar").toggleClass("active");fb.removeClass("open");a(this).parent().addClass("open")}).on("mouseover",function(){fb.removeClass("open");a(this).parent().addClass("open")});b.addDropDown=function(g,o,v){if(a(g).length!=0){var D=a(g).find("button"),H=a(g).find("ul").attr("id",a(g)[0].id+"-list");v||a("#option_lists").append(H);var J=false;v&& a(g).addClass("dropup");H.find("li").bind("mouseup",o);a(window).mouseup(function(){if(!J){D.removeClass("down");H.hide()}J=false});D.bind("mousedown",function(){if(D.hasClass("down")){D.removeClass("down");H.hide()}else{D.addClass("down");if(!v){var X=a(g).offset();H.css({top:X.top,left:X.left-110})}H.show();J=true}}).hover(function(){J=true}).mouseout(function(){J=false})}};var Wa=function(g,o,v,D){var H=a(g);o=a(o);var J=false,X=D.dropUp;X&&a(g).addClass("dropup");o.find("li").bind("mouseup",function(){if(D.seticon){Ib("#cur_"+ -H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var ca=a(g).offset();if(X){ca.top-=o.height();ca.left+=8}else ca.top+=a(g).height();a(o).offset(ca);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J= +H[0].id,a(this).children());a(this).addClass("current").siblings().removeClass("current")}v.apply(this,arguments)});a(window).mouseup(function(){if(!J){H.removeClass("down");o.hide();o.css({top:0,left:0})}J=false});o.height();a(g).bind("mousedown",function(){var da=a(g).offset();if(X){da.top-=o.height();da.left+=8}else da.top+=a(g).height();a(o).offset(da);if(H.hasClass("down")){H.removeClass("down");o.hide();o.css({top:0,left:0})}else{H.addClass("down");o.show();J=true;return false}}).hover(function(){J= true}).mouseout(function(){J=false});D.multiclick&&o.mousedown(function(){J=true})};a("#font_family_dropdown").change(function(){var g=this.options[this.selectedIndex].value,o=this.options[this.selectedIndex].text;a("#preview_font").html(o).css("font-family",g);a("#font_family").val(g).change()});a("div","#position_opts").each(function(){this.addEventListener("mouseup",function(){var g=this.id.replace("tool_pos","").charAt(0);h.alignSelectedElements(g,"page")})});(function(){var g,o=function(){a(g).blur()}; -a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;na="toolbars";P.mousedown(o)}).blur(function(){na="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&& -h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();aa()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(V!=null||ra)h.deleteSelectedElements()},ua=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(V!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type=== -"keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb= -function(){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(V!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(V!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}}, -zb=function(){V!=null&&L.reorient()},ja=function(){if(V!=null||ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(V!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked", -false);L.linkControlPoints(g)},N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},ea=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(V==null||ra)){g||(o*=-1); -var v=a("#angle").val()*1+o;h.setRotationAngle(v);Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){aa();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,"+g+"

        "+g+"

        ")}window.canvg? +a("#svg_editor").find("button, select, input:not(#text)").focus(function(){g=this;qa="toolbars";P.mousedown(o)}).blur(function(){qa="canvas";P.unbind("mousedown",o);h.getMode()=="textedit"&&a("#text").focus()})})();var Ca=function(){Ya("#tool_select")&&h.setMode("select")},wa=function(){Ya("#tool_fhpath")&&h.setMode("fhpath")},db=function(){Ya("#tool_line")&&h.setMode("line")},La=function(){Ya("#tool_rect")&&h.setMode("rect")},Ra=function(){Ya("#tool_ellipse")&&h.setMode("ellipse")},Da=function(){Ya("#tool_image")&& +h.setMode("image")},gb=function(){Ya("#tool_zoom")&&h.setMode("zoom")},rb=function(){if(Ya("#tool_zoom")){Bb();ca()}},Xa=function(){Ya("#tool_text")&&h.setMode("text")},ab=function(){Ya("#tool_path")&&h.setMode("path")},xb=function(){if(W!=null||ra)h.deleteSelectedElements()},ua=function(){if(W!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cutSelectedElements()}},jb=function(){if(W!=null||ra){window.event.type==="keydown"&&mb(a("#edit_menu"));h.copySelectedElements()}},hb=function(){window.event.type=== +"keydown"&&mb(a("#edit_menu"));var g=h.getZoom(),o=(P[0].scrollLeft+P.width()/2)/g-h.contentW;g=(P[0].scrollTop+P.height()/2)/g-h.contentH;h.pasteElements("point",o,g)},ub=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToTopSelectedElement()}},lb=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveToBottomSelectedElement()}},eb=function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Up")}},sb= +function(){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected("Down")}},ob=function(g){if(W!=null){window.event.type==="keydown"&&mb(a("#object_menu"));h.moveUpDownSelected(g)}},yb=function(){if(W!=null){h.convertToPath();elems=h.getSelectedElems();h.selectorManager.requestSelector(elems[0]).reset(elems[0]);h.selectorManager.requestSelector(elems[0]).selectorRect.setAttribute("display","none");h.setMode("pathedit");L.toEditMode(elems[0]);h.clearSelection();Aa()}}, +zb=function(){W!=null&&L.reorient()},ja=function(){if(W!=null||ra)a.prompt(uiStrings.notification.enterNewLinkURL,"http://",function(g){g&&h.makeHyperlink(g)})},ba=function(g,o){if(W!=null||ra){if(curConfig.gridSnapping){var v=h.getZoom()*curConfig.snappingStep;g*=v;o*=v}a("input").blur();h.moveSelectedElements(g,o)}},ka=function(){var g=!a("#tool_node_link").hasClass("checked");g?a("#tool_node_link").addClass("checked").find("input").attr("checked",true):a("#tool_node_link").removeClass("checked").find("input").attr("checked", +false);L.linkControlPoints(g)},N=function(){L.getNodePoint()&&L.clonePathNode()},Q=function(){L.getNodePoint()&&L.deletePathNode()},fa=function(){var g=a("#tool_add_subpath"),o=!g.hasClass("push_button_pressed");o?g.addClass("push_button_pressed").removeClass("tool_button"):g.removeClass("push_button_pressed").addClass("tool_button");L.addSubPath(o)},Fa=function(){L.opencloseSubPath()},Oa=function(){h.cycleElement(1)},Va=function(){h.cycleElement(0)},$a=function(g,o){if(!(W==null||ra)){g||(o*=-1); +var v=a("#angle").val()*1+o;h.setRotationAngle(v);Aa()}},qb=function(){var g=curConfig.dimensions;a.confirm(uiStrings.notification.QwantToClear,function(o){if(o){ca();h.clear();h.setResolution(g[0],g[1]);w(true);Bb();Aa();Y();h.runExtensions("onNewDocument")}})},Qa=function(){h.setBold(!h.getBold());Aa()},pb=function(){h.setItalic(!h.getItalic());Aa()},Pa=function(){if(!c.pngsave){var g=uiStrings.notification.loadingImage;M=window.open("data:text/html;charset=utf-8,"+g+"

        "+g+"

        ")}window.canvg? h.rasterExport():a.getScript("canvg/rgbcolor.js",function(){a.getScript("canvg/canvg.js",function(){h.rasterExport()})})},tb=function(){h.open()},vb=function(){},mb=function(g){var o=g.prev();o.css("background","#09f");setTimeout(function(){o.css("background","")},200)},Gb=function(){if(R.getUndoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.undo()}},cb=function(){if(R.getRedoStackSize()>0){window.event.type==="keydown"&&mb(a("#edit_menu"));R.redo()}},Ja=function(){if(ra)h.groupSelectedElements(); -else V&&h.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity")); +else W&&h.ungroupSelectedElement()},Nb=function(){window.event.type==="keydown"&&mb(a("#edit_menu"));h.cloneSelectedElements(20,20)},Lb=function(){var g=this.id.replace("tool_align","").charAt(0);h.alignSelectedElements(g,a("#align_relative_to").val())},Jb=function(){var g=document.querySelector("#tool_stroke rect"),o=document.querySelector("#tool_fill rect"),v=o.getAttribute("fill"),D=g.getAttribute("fill");g=parseFloat(g.getAttribute("stroke-opacity"));if(isNaN(g))g=100;o=parseFloat(o.getAttribute("fill-opacity")); if(isNaN(o))o=100;D=Ia(D,g,"stroke");v=Ia(v,o,"fill");b.paintBox.fill.setPaint(D,true);b.paintBox.stroke.setPaint(v,true)},Bb=function(g){var o=h.getResolution();g=g?o.zoom*g:1;a("#zoom").val(g*100);h.setZoom(g);Ab();w(true)},Ob=function(){!a("#tool_wireframe").hasClass("push_button_pressed")?a("#tool_wireframe").addClass("push_button_pressed"):a("#tool_wireframe").removeClass("push_button_pressed");P.toggleClass("wireframe");if(!z){var g=a("#wireframe_rules");g.length?g.empty():a('').appendTo("head"); Ab()}},Db=function(){var g=!a("#tool_snap").hasClass("push_button_pressed");g?a("#tool_snap").addClass("push_button_pressed"):a("#tool_snap").removeClass("push_button_pressed");curConfig.gridSnapping=g},Hb=function(){window.self!=window.top&&top.exit_fullscreen()},Pb=function(){if(a("#tool_rulers").hasClass("push_button_pressed")){a("#tool_rulers").removeClass("push_button_pressed");a("#show_rulers").attr("checked",false);curConfig.showRulers=false}else{a("#tool_rulers").addClass("push_button_pressed"); -a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=fa=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}}, -Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});aa()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0], -v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var ca=v[X],S=D.data("orig_margin-"+ca);if(S==null){S=parseInt(D.css("margin-"+ca));D.data("orig_margin-"+ca,S)}S=S*o;if(ca==="right")S+=H;else if(ca==="bottom")S+=J;D.css("margin-"+ -ca,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=ha=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty(); -else v=a('').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,ca){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(ca,function(S,W){if(typeof W==="number")var Z=W*D+"px";else if(W[g]||W.all)Z=W[g]||W.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ -H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)fa!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else da&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); -var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(V);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke": +a("#show_rulers").attr("checked",true);curConfig.showRulers=true}a("#rulers").toggle(!!curConfig.showRulers)},Ab=function(){if(!z){var g="#workarea.wireframe #svgcontent * { stroke-width: "+1/h.getZoom()+"px; }";a("#wireframe_rules").text(P.hasClass("wireframe")?g:"")}},kb=function(g,o){if(!ia){ia=true;a("#save_output_btns").toggle(!!o);a("#tool_source_back").toggle(!o);var v=ha=h.getSvgString();a("#svg_source_textarea").val(v);a("#svg_source_editor").fadeIn();a("#svg_source_textarea").focus().select()}}, +Mb=function(){if(ia){if(h.setSvgString(a("#svg_source_textarea").val())){h.clearSelection();k();Bb();Y()}else a.confirm(uiStrings.notification.QerrorsRevertToSource,function(g){if(!g)return false;h.clearSelection();k();Bb();Y()});ca()}},Ib=b.setIcon=function(g,o){var v=typeof o==="string"?a.getSvgIcon(o,true):o.clone();v?a(g).find("img").replaceWith(v):console.log("NOTE: Icon image missing: "+o)},Cb;Cb=function(){var g=/^(Moz|Webkit|Khtml|O|ms|Icab)(?=[A-Z])/,o=document.getElementsByTagName("script")[0], +v;for(v in o.style)if(g.test(v))return v.match(g)[0];if("WebkitOpacity"in o.style)return"Webkit";if("KhtmlOpacity"in o.style)return"Khtml";return""}();var ib=function(g,o){Cb.toLowerCase();var v=["top","left","bottom","right"];g.each(function(){for(var D=a(this),H=D.outerWidth()*(o-1),J=D.outerHeight()*(o-1),X=0;X<4;X++){var da=v[X],S=D.data("orig_margin-"+da);if(S==null){S=parseInt(D.css("margin-"+da));D.data("orig_margin-"+da,S)}S=S*o;if(da==="right")S+=H;else if(da==="bottom")S+=J;D.css("margin-"+ +da,S)}})},Kb=b.setIconSize=function(g,o){if(!(g==u.size&&!o)){var v=a("#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout"),D=1;D=typeof g=="number"?g:{s:0.75,m:1,l:1.25,xl:1.5}[g];b.tool_scale=aa=D;ma();var H=v.parents(":hidden");H.css("visibility","hidden").show();ib(v,D);H.css("visibility","visible").hide();v=a("#tool_size_rules");if(v.length)v.empty(); +else v=a('').appendTo("head");if(g!="m"){var J="";a.each(cssResizeRules,function(X,da){X="#svg_editor "+X.replace(/,/g,", #svg_editor");J+=X+"{";a.each(da,function(S,V){if(typeof V==="number")var Z=V*D+"px";else if(V[g]||V.all)Z=V[g]||V.all;J+=S+":"+Z+";"});J+="}"});H="-"+Cb.toLowerCase()+"-";J+="#tools_top .toolset, #editor_panel > *, #history_panel > *,\t\t\t\t#main_button, #tools_left > *, #path_node_panel > *, #multiselected_panel > *,\t\t\t\t#g_panel > *, #tool_font_size > *, .tools_flyout{"+ +H+"transform: scale("+D+");} #svg_editor div.toolset .toolset {"+H+"transform: scale(1); margin: 1px !important;} #svg_editor .ui-slider {"+H+"transform: scale("+1/D+");}";v.text(J)}ma()}},e=function(){a("#dialog_box").hide();if(ia){if(ia)ha!==a("#svg_source_textarea").val()?a.confirm(uiStrings.notification.QignoreSourceChanges,function(g){g&&k()}):k();m()}else ea&&h.leaveContext()},k=function(){a("#svg_source_editor").hide();ia=false;a("#svg_source_textarea").blur()};a(window).width();a(window).height(); +var m=a.noop;a(window).resize(function(){w()});(function(){P.scroll(function(){if(a("#ruler_x").length!=0)a("#ruler_x")[0].scrollLeft=P[0].scrollLeft;if(a("#ruler_y").length!=0)a("#ruler_y")[0].scrollTop=P[0].scrollTop})})();a("#url_notice").click(function(){a.alert(this.title)});a("#change_image_url").click(function(){var g=h.getHref(W);g=g.indexOf("data:")===0?"":g;a.prompt(uiStrings.notification.enterNewImgURL,g,function(o){o&&Na(o)})});var A=function(g){var o=g[0].id=="stroke_color"?"stroke": "fill",v=g[0].id=="canvas_color";if(v)o="canvas";var D=b.paintBox[o].paint;g=o=="stroke"?"Pick a Stroke Paint and Opacity":"Pick a Fill Paint and Opacity";v=v?{right:175,top:50}:{left:50,bottom:50};a("#color_picker").draggable({cancel:".jGraduate_tabs, .jGraduate_colPick, .jGraduate_gradPick, .jPicker",containment:"window"}).removeAttr("style").css(v).jGraduate({paint:D,window:{pickerTitle:g},images:{clientPath:curConfig.jGraduatePath},newstop:"inverse"},function(H){D=new a.jGraduate.Paint(H);b.paintBox[o].setPaint(D); h.setPaint(o,D);a("#color_picker").hide()},function(){a("#color_picker").hide()})};s=function(g,o){var v=document.getElementById("canvas_background"),D={color:"fff",opacity:1};if(o=="stroke")D=curConfig.initStroke;if(o=="fill")D=curConfig.initFill;if(o=="canvas"&&v)if(v=v.getAttribute("fill").match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/))D={color:("0"+parseInt(v[1],10).toString(16)).slice(-2)+("0"+parseInt(v[2],10).toString(16)).slice(-2)+("0"+parseInt(v[3],10).toString(16)).slice(-2),opacity:1};v=(new DOMParser).parseFromString('\t\t\t\t\t',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",ca=H.type,S=H.alpha/100;switch(ca){case "solidColor":X= -H[ca]=="none"||H[ca]=="one"?"none":"#"+H[ca];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[ca]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(ca=document.getElementById("canvas_background")){za=h.getResolution();ca.setAttribute("x",-1);ca.setAttribute("y",-1); -ca.setAttribute("width",za.w+2);ca.setAttribute("height",za.h+2);ca.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(V){var J=this.type;switch(V.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,ca=V.getElementsByTagName("*"),S=0,W=ca.length;S\t\t\t\t\t',"text/xml").documentElement;v=a(g)[0].appendChild(document.importNode(v,true));o==="canvas"?v.setAttribute("width",60.5):v.setAttribute("width","100%");this.rect=v.firstChild;this.defs=v.getElementsByTagName("defs")[0];this.grad=this.defs.firstChild;this.paint=new a.jGraduate.Paint({solidColor:D.color});this.type=o;this.setPaint=function(H,J){this.paint=H;var X="none",da=H.type,S=H.alpha/100;switch(da){case "solidColor":X= +H[da]=="none"||H[da]=="one"?"none":"#"+H[da];break;case "linearGradient":case "radialGradient":this.defs.removeChild(this.grad);this.grad=this.defs.appendChild(H[da]);X="url(#"+(this.grad.id="gradbox_"+this.type)+")"}this.rect.setAttribute("fill",X);this.rect.setAttribute("opacity",S);if(J){h.setColor(this.type,X,true);h.setPaintOpacity(this.type,S,true)}if(this.type=="canvas")if(da=document.getElementById("canvas_background")){za=h.getResolution();da.setAttribute("x",-1);da.setAttribute("y",-1); +da.setAttribute("width",za.w+2);da.setAttribute("height",za.h+2);da.setAttribute("fill",X)}else Ka(X)};this.update=function(H){if(W){var J=this.type;switch(W.tagName){case "use":case "image":case "foreignObject":return;case "g":case "a":for(var X=null,da=W.getElementsByTagName("*"),S=0,V=da.length;S=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("
        "+S.w+"\u00d7
        "+ -S.h+"
        ")}else requestAnimationFrame(ca)};ca(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click", +"content"){g.value="fit";o.value="fit";G();var v=h.getResolution();g.value=v.w;o.value=v.h}else{var D=this.value.split("x");D[0]=parseInt(D[0]);D[1]=parseInt(D[1]);var H=D[0]-g.value,J=D[1]-o.value,X=Date.now(),da=function(S){S=(S-X)/1E3;S=Math.pow(S-1,3)+1;g.value=(D[0]-H+S*H).toFixed(0);o.value=(D[1]-J+S*J).toFixed(0);G();if(S>=1){S=h.getResolution();a("#canvas_width").val(S.w.toFixed());a("#canvas_height").val(S.h.toFixed());a("#resolution_label").html("
        "+S.w+"\u00d7
        "+ +S.h+"
        ")}else requestAnimationFrame(da)};da(Date.now())}else{a("#resolution_label").html("Custom");g.removeAttribute("readonly");g.focus();g.select();if(g.value=="fit"){g.value=100;o.value=100}}});a("#zoom").change(function(){xa(this)});a("input,select").attr("autocomplete","off");var B=function(){var g=[{sel:"#tool_select",fn:Ca,evt:"click",key:["V",true]},{sel:"#tool_fhpath",fn:wa,evt:"click",key:["Q",true]},{sel:"#tool_line",fn:db,evt:"click",key:["L",true]},{sel:"#tool_rect",fn:La,evt:"click", key:["R",true],icon:"rect"},{sel:"#tool_ellipse",fn:Ra,evt:"mouseup",key:["C",true],icon:"ellipse"},{sel:"#tool_path",fn:ab,evt:"click",key:["P",true]},{sel:"#tool_text",fn:Xa,evt:"click",key:["T",true]},{sel:"#tool_image",fn:Da,evt:"mouseup"},{sel:"#tool_zoom",fn:gb,evt:"mouseup",key:["Z",true]},{sel:"#tool_clear",fn:qb,evt:"mouseup",key:[p+"N",true]},{sel:"#tool_save",fn:function(){ia?Mb():h.save({images:u.img_save,round_digits:6})},evt:"mouseup",key:[p+"S",true]},{sel:"#tool_export",fn:Pa,evt:"mouseup"}, {sel:"#tool_open",fn:tb,evt:"mouseup"},{sel:"#tool_import",fn:vb,evt:"mouseup"},{sel:"#tool_source",fn:kb,evt:"click",key:[p+"U",true]},{sel:"#tool_wireframe",fn:Ob,evt:"click"},{sel:"#tool_snap",fn:Db,evt:"click"},{sel:"#tool_rulers",fn:Pb,evt:"click"},{sel:"#tool_source_cancel,#svg_source_overlay,#tool_docprops_cancel,#tool_prefs_cancel",fn:e,evt:"click",key:["esc",false,false],hidekey:true},{sel:"#tool_source_save",fn:Mb,evt:"click"},{sel:"#tool_delete,#tool_delete_multi",fn:xb,evt:"click",key:["del/backspace", -true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:ea,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]}, +true]},{sel:"#tool_reorient",fn:zb,evt:"click"},{sel:"#tool_node_link",fn:ka,evt:"click"},{sel:"#tool_node_clone",fn:N,evt:"click"},{sel:"#tool_node_delete",fn:Q,evt:"click"},{sel:"#tool_openclose_path",fn:Fa,evt:"click"},{sel:"#tool_add_subpath",fn:fa,evt:"click"},{sel:"#tool_move_top",fn:ub,evt:"click",key:p+"shift+up"},{sel:"#tool_move_bottom",fn:lb,evt:"click",key:p+"shift+down"},{sel:"#tool_move_up",fn:eb,evt:"click",key:[p+"up",true]},{sel:"#tool_move_down",fn:sb,evt:"click",key:[p+"down",true]}, {sel:"#tool_topath",fn:yb,evt:"click"},{sel:"#tool_make_link,#tool_make_link_multi",fn:ja,evt:"click"},{sel:"#tool_clone,#tool_clone_multi",fn:Nb,evt:"click",key:[p+"D",true]},{sel:"#tool_group",fn:Ja,evt:"click",key:[p+"G",true]},{sel:"#tool_ungroup",fn:Ja,evt:"click",key:p+"shift+G"},{sel:"#tool_unlink_use",fn:Ja,evt:"click"},{sel:"[id^=tool_align]",fn:Lb,evt:"click"},{sel:"#tool_undo",fn:Gb,evt:"click",key:p+"z"},{sel:"#tool_redo",fn:cb,evt:"click",key:["y",true]},{sel:"#tool_cut",fn:ua,evt:"click", key:[p+"x",true]},{sel:"#tool_copy",fn:jb,evt:"click",key:p+"c"},{sel:"#tool_paste",fn:hb,evt:"click",key:p+"v"},{sel:"#tool_switch",fn:Jb,evt:"click",key:["x",true]},{sel:"#tool_bold",fn:Qa,evt:"mousedown",key:[p+"B",true]},{sel:"#tool_italic",fn:pb,evt:"mousedown",key:[p+"I",true]},{sel:"#copy_save_done",fn:e,evt:"click"},{key:"ctrl+left",fn:function(){$a(0,1)}},{key:"ctrl+right",fn:function(){$a(1,1)}},{key:"ctrl+shift+left",fn:function(){$a(0,5)}},{key:"ctrl+shift+right",fn:function(){$a(1,5)}}, {key:"shift+O",fn:Va},{key:"shift+P",fn:Oa},{key:[p+"+",true],fn:function(){Bb(2)}},{key:[p+"-",true],fn:function(){Bb(0.5)}},{key:["up",true],fn:function(){ba(0,-1)}},{key:["down",true],fn:function(){ba(0,1)}},{key:["left",true],fn:function(){ba(-1,0)}},{key:["right",true],fn:function(){ba(1,0)}},{key:"shift+up",fn:function(){ba(0,-10)}},{key:"shift+down",fn:function(){ba(0,10)}},{key:"shift+left",fn:function(){ba(-10,0)}},{key:"shift+right",fn:function(){ba(10,0)}},{key:["alt+up",true],fn:function(){h.cloneSelectedElements(0, -1)}},{key:["alt+down",true],fn:function(){h.cloneSelectedElements(0,1)}},{key:["alt+left",true],fn:function(){h.cloneSelectedElements(-1,0)}},{key:["alt+right",true],fn:function(){h.cloneSelectedElements(1,0)}},{key:["alt+shift+up",true],fn:function(){h.cloneSelectedElements(0,-10)}},{key:["alt+shift+down",true],fn:function(){h.cloneSelectedElements(0,10)}},{key:["alt+shift+left",true],fn:function(){h.cloneSelectedElements(-10,0)}},{key:["alt+shift+right",true],fn:function(){h.cloneSelectedElements(10, 0)}},{key:p+"A",fn:function(){h.selectAllInCurrentLayer()}},{key:"I",fn:function(){var v=a(".tool_button_current");if(v.length&&v[0].id!=="tool_eyedropper"){v.removeClass("tool_button_current").addClass("tool_button");a("#tool_eyedropper").addClass("tool_button_current").removeClass("tool_button")}h.setMode("eyedropper")}},{key:p+"shift+z",fn:cb},{key:"esc",fn:Hb}],o={"4/Shift+4":"#tools_rect_show","5/Shift+5":"#tools_ellipse_show"};return{setAll:function(){var v={};a.each(g,function(D,H){if(H.sel){var J= -a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var ca=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"), -function(Z,qa){a(document).bind("keydown",qa,function(ta){ca();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var W=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",W)}}});pa(v);a(window).bind("keydown","tab",function(D){if(na==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(na==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v, -D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(ca,S){var W=S.split("+"),Z="";if(W.length>1){Z=W[0]+"+";S=W[1]}X+=(ca?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"), +a(H.sel);if(J.length==0)return true;if(H.evt){if(svgedit.browser.isTouch()&&H.evt==="click")H.evt="mousedown";J[H.evt](H.fn)}if(H.parent&&a(H.parent+"_show").length!=0){var X=a(H.parent);X.length||(X=la(H.parent.substr(1)));X.append(J);a.isArray(v[H.parent])||(v[H.parent]=[]);v[H.parent].push(H)}}if(H.key){var da=H.fn,S=false;if(a.isArray(H.key)){X=H.key[0];if(H.key.length>1)S=H.key[1]}else X=H.key;X+="";svgedit.browser.isMac&&X.indexOf("+")!=-1&&X.split("+")[0]=="ctrl"&&X.replace("ctrl","cmd");a.each(X.split("/"), +function(Z,pa){a(document).bind("keydown",pa,function(ta){da();S&&ta.preventDefault();return false})});if(H.sel&&!H.hidekey&&J.attr("title")){var V=J.attr("title").split("[")[0]+" ("+X+")";o[X]=H.sel;J.parents("#main_menu").length||J.attr("title",V)}}});oa(v);a(window).bind("keydown","tab",function(D){if(qa==="canvas"){D.preventDefault();Oa()}}).bind("keydown","shift+tab",function(D){if(qa==="canvas"){D.preventDefault();Va()}});a("#tool_zoom").dblclick(rb)},setTitles:function(){a.each(o,function(v, +D){var H=a(D).parents("#main_menu").length;a(D).each(function(){var J=H?a(this).text().split(" [")[0]:this.title.split(" [")[0],X="";a.each(v.split("/"),function(da,S){var V=S.split("+"),Z="";if(V.length>1){Z=V[0]+"+";S=V[1]}X+=(da?"/":"")+Z+(uiStrings["key_"+S]||S)});if(H)this.lastChild.textContent=J+" ["+X+"]";else this.title=J+" ["+X+"]"})})},getButtonData:function(v){var D;a.each(g,function(H,J){if(J.sel===v)D=J});return D}}}();B.setAll();b.ready(function(){var g=curConfig.initTool,o=a("#tools_left, #svg_editor .tools_flyout"), v=o.find("#tool_"+g);g=o.find("#"+g);(v.length?v:g.length?g:a("#tool_select")).click().mouseup();curConfig.wireframe&&a("#tool_wireframe").click();curConfig.showlayers&&toggleSidePanel();a("#rulers").toggle(!!curConfig.showRulers)});a("#canvas_height").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#canvas_width").dragInput({min:10,max:null,step:10,callback:G,cursor:false,dragAdjust:0.1});a("#rect_width").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false}); a("#rect_height").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_rx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#ellipse_ry").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:1,max:null,step:1, callback:changeAttribute,cursor:false});a("#circle_cx").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_cy").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#circle_r").dragInput({min:1,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_height").dragInput({min:0,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#selected_y").dragInput({min:null, max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_node_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_width").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_x2").dragInput({min:null,max:null,step:1,callback:changeAttribute, cursor:false});a("#line_y1").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#line_y2").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#path_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_y").dragInput({min:null,max:null, step:1,callback:changeAttribute,cursor:false});a("#g_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#g_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_y").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#text_x").dragInput({min:null,max:null,step:1,callback:changeAttribute,cursor:false});a("#image_y").dragInput({min:null, -max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&V&&["line","polyline"].indexOf(V.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled", +max:null,step:1,callback:changeAttribute,cursor:false});a("#rect_rx").dragInput({min:0,max:100,step:1,callback:changeAttribute,cursor:true});a("#stroke_width").dragInput({min:0,max:99,step:1,callback:function(g){var o=g.value;if(o==0&&W&&["line","polyline"].indexOf(W.nodeName)>=0)o=g.value=1;h.setStrokeWidth(o)},cursor:true,smallStep:0.1,start:1.5});a("#angle").dragInput({min:-180,max:180,step:1,callback:function(g){h.setRotationAngle(g.value);rotateCursor(g.value);a("#tool_reorient").toggleClass("disabled", g.value==0)},cursor:false,dragAdjust:0.5});a("#font_size").dragInput({min:1,max:250,step:1,callback:function(g){h.setFontSize(g.value)},cursor:true,stepfunc:function(g,o){var v=g.value-0,D=v+o,H=D>=v;if(o===0)return v;return v>=24?H?Math.round(v*1.1):Math.round(v/1.1):v<=1?H?v*2:v/2:D},dragAdjust:0.15});a("#group_opacity").dragInput({min:0,max:100,step:5,callback:changeAttribute,cursor:true,start:100});a("#blur").dragInput({min:0,max:10,step:0.1,callback:function(g){val=g.value;a("#blur").val(val); h.setBlur(val,true)},cursor:true,start:0});a("#zoom").val(h.getZoom()*100);a("#workarea").contextMenu({menu:"cmenu_canvas",inSpeed:0},function(g){switch(g){case "delete":xb();break;case "cut":ua();break;case "copy":jb();break;case "paste":h.pasteElements();break;case "paste_in_place":h.pasteElements("in_place");break;case "group":h.groupSelectedElements();break;case "ungroup":h.ungroupSelectedElement();break;case "move_front":ub();break;case "move_up":ob("Up");break;case "move_down":ob("Down");break; case "move_back":lb();break;default:svgedit.contextmenu&&svgedit.contextmenu.hasCustomHandler(g)&&svgedit.contextmenu.getCustomHandler(g).call()}});a(".contextMenu li").mousedown(function(g){g.preventDefault()});a("#cmenu_canvas li").disableContextMenu();T.enableContextMenuItems("#delete,#cut,#copy");window.onbeforeunload=function(){if(R.getUndoStackSize()===0)b.show_save_warning=false;if(!curConfig.no_save_warning&&b.show_save_warning)return uiStrings.notification.unsavedChanges};b.openPrep=function(g){a("#main_menu").hide(); R.getUndoStackSize()===0?g(true):a.confirm(uiStrings.notification.QwantToOpen,g)};if(window.FileReader){s=a('').change(function(){var g=this;b.openPrep(function(o){if(o){h.clear();if(g.files.length==1){o=new FileReader;o.onloadend=function(v){q(v.target.result);w()};o.readAsText(g.files[0])}}})});a("#tool_open").show().prepend(s);s=a('').change(function(){a("#main_menu").hide();if(this.files.length==1){var g=new FileReader;g.onloadend=function(o){h.importSvgString(o.target.result, -true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),ca=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},W=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*W);D=Math.max(J,h.contentH*X*W);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");W=ca.height()/2;var Z=ca.width()/2;ca.width(v).height(D);var qa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/ -2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:qa+(S.y-W)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(ca,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+ +true);w()};g.readAsText(this.files[0])}});a("#tool_import").show().prepend(s)}var w=b.updateCanvas=function(g,o){var v=P.width(),D=P.height(),H=v,J=D,X=h.getZoom(),da=a("#svgcanvas"),S={x:P[0].scrollLeft+H/2,y:P[0].scrollTop+J/2},V=curConfig.canvas_expansion;v=Math.max(H,h.contentW*X*V);D=Math.max(J,h.contentH*X*V);v==H&&D==J?P.css("overflow","hidden"):P.css("overflow","scroll");V=da.height()/2;var Z=da.width()/2;da.width(v).height(D);var pa=D/2,ta=v/2,ga=h.updateCanvas(v,D),Ta=ta/Z;v=v/2-H/2;D=D/ +2-J/2;if(o){o.x+=ga.x;o.y+=ga.y}else o={x:ta+(S.x-Z)*Ta,y:pa+(S.y-V)*Ta};if(g)if(h.contentW>P.width()){P[0].scrollLeft=ga.x-10;P[0].scrollTop=ga.y-10}else{P[0].scrollLeft=v;P[0].scrollTop=D}else{P[0].scrollLeft=o.x-H/2;P[0].scrollTop=o.y-J/2}if(curConfig.showRulers){l(da,X);P.scroll()}},E=[];for(s=0.1;s<1E5;s*=10){E.push(1*s);E.push(2*s);E.push(5*s)}w(true);try{var I=function(g){if(window.JSON&&JSON.stringify)return JSON.stringify(g);var o=arguments.callee;if(typeof g=="boolean"||typeof g=="number")return g+ "";else if(typeof g=="string")return'"'+g.replace(/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,function(H){return"\\u"+("0000"+H.charCodeAt(0).toString(16)).slice(-4)})+'"';else if(g.length){for(var v=0;v0?(c-u)/f:200,l=d/n*f,s=0,C=this.getAttribute("data-attr"),p=svgEditor.canvas,L=p.getSelectedElems(),R=svgedit.browser.isTouch(),O=true,K=d&&this.dragCfg.cursor?$("
        ").appendTo(h):false;b.attr("readonly","readonly");K&&!isNaN(this.dragCfg.start)&&K.css("top",this.dragCfg.start* -1/l+n);this.adjustValue=function(P,T){var M;P=parseFloat(P);if(isNaN(this.value))M=this.dragCfg.reset;else if($.isFunction(this.dragCfg.stepfunc)){M=this.dragCfg.stepfunc(this,P);console.log(M)}else M=Number((Number(this.value)+Number(P)).toFixed(5));if(c!==null)M=Math.min(M,c);if(u!==null)M=Math.max(M,u);K&&this.updateCursor(M);this.value=M;h.attr("data-value",M);$.isFunction(this.dragCfg.callback)&&this.dragCfg.callback(this,T)};h.toggleClass("draginput",h.is("label"));this.move=function(P,T,M){if(R)P= P.originalEvent.touches[0];if(s===0)s=T;T=(P.pageY-s)*-1;s=P.pageY;M=T*l*q;this.adjustValue(M.toFixed(f<1?1:0))};this.stop=function(){$("body").removeClass("dragging");h.removeClass("active");O=true;$(window).unbind("mousemove.draginput touchmove.draginput mouseup.draginput touchend.draginput");s=0;if(L[0]){var P=p.undoMgr.finishUndoableChange();P.isEmpty()||p.undoMgr.addCommandToHistory(P)}this.adjustValue(0,O)};this.updateCursor=function(){var P=parseFloat(this.value)*-1/l+n;K.css("top",P)};this.start= -function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,ha=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(na){ha.move(na,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){ha.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur(); -this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,ha){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){na.stop()}, -1E3);var na=this;if(ha>0)this.adjustValue(this.dragCfg.step);else ha<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{}; +function(P){if(R)P=P.originalEvent.touches[0];var T=P.pageY,M=this.value,aa=this;p.undoMgr.beginUndoableChange(C,L);$("body").addClass("dragging");h.addClass("active");$(window).bind("mousemove.draginput touchmove.draginput",function(qa){aa.move(qa,T,parseFloat(M))});$(window).bind("mouseup.draginput touchend.draginput",function(){aa.stop()})};$(this).attr("readonly","readonly").attr("data-scale",l).attr("data-domain",n).attr("data-cursor",K!=false).bind("mousedown touchstart",function(P){this.blur(); +this.start(P)}).bind("dblclick taphold",function(){this.removeAttribute("readonly","readonly");this.focus();this.select()}).keydown(function(P){switch(P.keyCode){case 13:this.adjustValue(0);this.blur()}}).focus(function(){this.getAttribute("readonly")==="readonly"&&this.blur()}).blur(function(){this.setAttribute("readonly","readonly")}).bind("mousewheel",function(P,T,M,aa){O&&p.undoMgr.beginUndoableChange(C,L);O=false;clearTimeout(window.undoTimeout);window.undoTimeout=setTimeout(function(){qa.stop()}, +1E3);var qa=this;if(aa>0)this.adjustValue(this.dragCfg.step);else aa<0&&this.adjustValue(-this.dragCfg.step);P.preventDefault()})})};$.fn.dragInput.updateCursor=function(a){var q=parseFloat(a.value),h=parseFloat(a.getAttribute("data-scale")),b=parseFloat(a.getAttribute("data-domain"));q=q*-1/h+b+"px";a=a.parentNode.lastChild;if(a.className=="draginput_cursor")a.style.top=q};svgedit=svgedit||{}; (function(){var a=this;if(!svgedit.contextmenu)svgedit.contextmenu={};a.contextMenuExtensions={};svgEditor.ready(function(){for(menuItem in contextMenuExtensions){var q=contextMenuExtensions[menuItem];Object.keys(a.contextMenuExtensions).length==0&&$("#cmenu_canvas").append("
      • ");var h=q.shortcut||"";$("#cmenu_canvas").append("
      • "+q.label+""+h+"
      • ")}});svgedit.contextmenu.resetCustomMenus=function(){a.contextMenuExtensions= {}};svgedit.contextmenu.add=function(q){if(q&&q.id&&q.label&&q.action&&typeof q.action=="function")if(q.id in a.contextMenuExtensions)console.error('Cannot add extension "'+q.id+'", an extension by that name already exists"');else{console.log("Registed contextmenu item: {id:"+q.id+", label:"+q.label+"}");a.contextMenuExtensions[q.id]=q}else console.error("Menu items must be defined and have at least properties: id, label, action, where action must be a function")};svgedit.contextmenu.hasCustomHandler= function(q){return a.contextMenuExtensions[q]&&true};svgedit.contextmenu.getCustomHandler=function(q){return a.contextMenuExtensions[q].action}})();(function(a,q){function h(n){return!a(n).parents().andSelf().filter(function(){return a.curCSS(this,"visibility")==="hidden"||a.expr.filters.hidden(this)}).length}function b(n,u){var c=n.nodeName.toLowerCase();if("area"===c){c=n.parentNode;var f=c.name;if(!n.href||!f||c.nodeName.toLowerCase()!=="map")return false;c=a("img[usemap=#"+f+"]")[0];return!!c&&h(c)}return(/input|select|textarea|button|object/.test(c)?!n.disabled:"a"==c?n.href||u:u)&&h(n)}a.ui=a.ui||{};a.ui.version||(a.extend(a.ui,{version:"1.8.17", @@ -580,73 +580,73 @@ this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui return h=this._trimAlignValue(h)}h=this.options.values.slice();for(b=0;b=this._valueMax())return this._valueMax();var h=this.options.step>0?this.options.step:1,b=(q-this._valueMin())%h;q=q-b;Math.abs(b)*2>=h&&(q+=b>0?h:-h);return parseFloat(q.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var q= this.options.range,h=this.options,b=this,n=this._animateOff?false:h.animate,u,c={},f,d,l,s;this.options.values&&this.options.values.length?this.handles.each(function(C){u=(b.values(C)-b._valueMin())/(b._valueMax()-b._valueMin())*100;c[b.orientation==="horizontal"?"left":"bottom"]=u+"%";a(this).stop(1,1)[n?"animate":"css"](c,h.animate);b.options.range===true&&(b.orientation==="horizontal"?(C===0&&b.range.stop(1,1)[n?"animate":"css"]({left:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({width:u- f+"%"},{queue:false,duration:h.animate})):(C===0&&b.range.stop(1,1)[n?"animate":"css"]({bottom:u+"%"},h.animate),C===1&&b.range[n?"animate":"css"]({height:u-f+"%"},{queue:false,duration:h.animate})));f=u}):(d=this.value(),l=this._valueMin(),s=this._valueMax(),u=s!==l?(d-l)/(s-l)*100:0,c[b.orientation==="horizontal"?"left":"bottom"]=u+"%",this.handle.stop(1,1)[n?"animate":"css"](c,h.animate),q==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[n?"animate":"css"]({width:u+"%"},h.animate), -q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,ha=[],na=function(U){for(var Y=0;Yoa)Y=oa;if(U<0)U=0;else if(U>pa)U=pa;ia.call(d,"xy",{x:Y/oa*p+s,y:U/pa*O+L})},ia=function(U,Y,oa){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(oa!= -null&&oa==d)){var pa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(laC)la=C;if(K!=la){K=la;pa=true}}if(ma!=null){if(maR)ma=R;if(P!=ma){P=ma;pa=true}}pa&&na.call(d,oa||d)}},da=function(U){a.isFunction(U)&&ha.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all"; -switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var oa,pa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":oa=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":pa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la= -Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:oa=Y&&Y.minX&&Y.minX|0||0;pa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(oa!=null&&s!=oa){s=oa;p=C-s}if(pa!=null&&C!=pa){C=pa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:da,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,ha))!=-1;)ha.splice(Y,1)},destroy:function(){a(document).unbind("mouseup", -V).unbind("mousemove",aa);c.unbind("mousedown",fa);ha=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",fa);da.call(d,function(){var U=0,Y=0,oa=c.w,pa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?oa:K/p*oa|0;if(O>0)Y=P==R?pa:P/O*pa|0;if(la>=oa)U=(oa>>1)-(la>>1);else U-=la>>1;if(ma>=pa)Y=(pa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px", -top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,ha=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(V.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(V.call(s, -(C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(V.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(V.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(V.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(V.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break; -case R&&R.get(0):switch(ia.keyCode){case 38:R.val(V.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(V.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(V.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(V.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(V.call(s, -(K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(V.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(V.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(V.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},na=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!aa(ia))return ia;switch(ia.target){case C.get(0):C.val(V.call(s, -C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(V.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(V.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(V.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(V.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(V.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(V.call(s, +q==="max"&&this.orientation==="horizontal"&&this.range[n?"animate":"css"]({width:100-u+"%"},{queue:false,duration:h.animate}),q==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[n?"animate":"css"]({height:u+"%"},h.animate),q==="max"&&this.orientation==="vertical"&&this.range[n?"animate":"css"]({height:100-u+"%"},{queue:false,duration:h.animate}))}});a.extend(a.ui.slider,{version:"1.8.17"})})(jQuery);(function(a){Math.precision=function(c,f){if(f===undefined)f=0;return Math.round(c*Math.pow(10,f))/Math.pow(10,f)};var q=function(c,f){var d=this,l=c.find("img:first"),s=0,C=100,p=100,L=0,R=100,O=100,K=0,P=0,T,M,aa=[],qa=function(U){for(var Y=0;Yna)Y=na;if(U<0)U=0;else if(U>oa)U=oa;ia.call(d,"xy",{x:Y/na*p+s,y:U/oa*O+L})},ia=function(U,Y,na){if(Y===undefined){if(U===undefined||U==null)U="xy";switch(U.toLowerCase()){case "x":return K;case "y":return P;default:return{x:K,y:P}}}if(!(na!= +null&&na==d)){var oa=false,la,ma;if(U==null)U="xy";switch(U.toLowerCase()){case "x":la=Y&&(Y.x&&Y.x|0||Y|0)||0;break;case "y":ma=Y&&(Y.y&&Y.y|0||Y|0)||0;break;default:la=Y&&Y.x&&Y.x|0||0;ma=Y&&Y.y&&Y.y|0||0}if(la!=null){if(laC)la=C;if(K!=la){K=la;oa=true}}if(ma!=null){if(maR)ma=R;if(P!=ma){P=ma;oa=true}}oa&&qa.call(d,na||d)}},ea=function(U){a.isFunction(U)&&aa.push(U)};a.extend(true,d,{val:ia,range:function(U,Y){if(Y===undefined){if(U===undefined||U==null)U="all"; +switch(U.toLowerCase()){case "minx":return s;case "maxx":return C;case "rangex":return{minX:s,maxX:C,rangeX:p};case "miny":return L;case "maxy":return R;case "rangey":return{minY:L,maxY:R,rangeY:O};default:return{minX:s,maxX:C,rangeX:p,minY:L,maxY:R,rangeY:O}}}var na,oa,la,ma;if(U==null)U="all";switch(U.toLowerCase()){case "minx":na=Y&&(Y.minX&&Y.minX|0||Y|0)||0;break;case "maxx":oa=Y&&(Y.maxX&&Y.maxX|0||Y|0)||0;break;case "rangex":na=Y&&Y.minX&&Y.minX|0||0;oa=Y&&Y.maxX&&Y.maxX|0||0;break;case "miny":la= +Y&&(Y.minY&&Y.minY|0||Y|0)||0;break;case "maxy":ma=Y&&(Y.maxY&&Y.maxY|0||Y|0)||0;break;case "rangey":la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0;break;default:na=Y&&Y.minX&&Y.minX|0||0;oa=Y&&Y.maxX&&Y.maxX|0||0;la=Y&&Y.minY&&Y.minY|0||0;ma=Y&&Y.maxY&&Y.maxY|0||0}if(na!=null&&s!=na){s=na;p=C-s}if(oa!=null&&C!=oa){C=oa;p=C-s}if(la!=null&&L!=la){L=la;O=R-L}if(ma!=null&&R!=ma){R=ma;O=R-L}},bind:ea,unbind:function(U){if(a.isFunction(U))for(var Y;(Y=a.inArray(U,aa))!=-1;)aa.splice(Y,1)},destroy:function(){a(document).unbind("mouseup", +W).unbind("mousemove",ca);c.unbind("mousedown",ha);aa=l=c=null}});l.src=f.arrow&&f.arrow.image;l.w=f.arrow&&f.arrow.width||l.width();l.h=f.arrow&&f.arrow.height||l.height();c.w=f.map&&f.map.width||c.width();c.h=f.map&&f.map.height||c.height();c.bind("mousedown",ha);ea.call(d,function(){var U=0,Y=0,na=c.w,oa=c.h,la=l.w,ma=l.h;setTimeout(function(){if(p>0)U=K==C?na:K/p*na|0;if(O>0)Y=P==R?oa:P/O*oa|0;if(la>=na)U=(na>>1)-(la>>1);else U-=la>>1;if(ma>=oa)Y=(oa>>1)-(ma>>1);else Y-=ma>>1;l.css({left:U+"px", +top:Y+"px"})},0)})},h=function(c,f,d,l){var s=this;c=c.find("td.Text input");var C=c.eq(3),p=c.eq(4),L=c.eq(5),R=c.length>7?c.eq(6):null,O=c.eq(0),K=c.eq(1),P=c.eq(2),T=c.eq(c.length>7?7:6),M=c.length>7?c.eq(8):null,aa=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!ca(ia))return ia;switch(ia.target){case C.get(0):switch(ia.keyCode){case 38:C.val(W.call(s,(C.val()<<0)+1,0,255));f.val("r",C.val(),ia.target);return false;case 40:C.val(W.call(s, +(C.val()<<0)-1,0,255));f.val("r",C.val(),ia.target);return false}break;case p.get(0):switch(ia.keyCode){case 38:p.val(W.call(s,(p.val()<<0)+1,0,255));f.val("g",p.val(),ia.target);return false;case 40:p.val(W.call(s,(p.val()<<0)-1,0,255));f.val("g",p.val(),ia.target);return false}break;case L.get(0):switch(ia.keyCode){case 38:L.val(W.call(s,(L.val()<<0)+1,0,255));f.val("b",L.val(),ia.target);return false;case 40:L.val(W.call(s,(L.val()<<0)-1,0,255));f.val("b",L.val(),ia.target);return false}break; +case R&&R.get(0):switch(ia.keyCode){case 38:R.val(W.call(s,parseFloat(R.val())+1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false;case 40:R.val(W.call(s,parseFloat(R.val())-1,0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);return false}break;case O.get(0):switch(ia.keyCode){case 38:O.val(W.call(s,(O.val()<<0)+1,0,360));f.val("h",O.val(),ia.target);return false;case 40:O.val(W.call(s,(O.val()<<0)-1,0,360));f.val("h",O.val(),ia.target);return false}break;case K.get(0):switch(ia.keyCode){case 38:K.val(W.call(s, +(K.val()<<0)+1,0,100));f.val("s",K.val(),ia.target);return false;case 40:K.val(W.call(s,(K.val()<<0)-1,0,100));f.val("s",K.val(),ia.target);return false}break;case P.get(0):switch(ia.keyCode){case 38:P.val(W.call(s,(P.val()<<0)+1,0,100));f.val("v",P.val(),ia.target);return false;case 40:P.val(W.call(s,(P.val()<<0)-1,0,100));f.val("v",P.val(),ia.target);return false}}}},qa=function(ia){if(!(ia.target.value==""&&ia.target!=T.get(0)&&(d!=null&&ia.target!=d.get(0)||d==null))){if(!ca(ia))return ia;switch(ia.target){case C.get(0):C.val(W.call(s, +C.val(),0,255));f.val("r",C.val(),ia.target);break;case p.get(0):p.val(W.call(s,p.val(),0,255));f.val("g",p.val(),ia.target);break;case L.get(0):L.val(W.call(s,L.val(),0,255));f.val("b",L.val(),ia.target);break;case R&&R.get(0):R.val(W.call(s,R.val(),0,100));f.val("a",Math.precision(R.val()*255/100,l),ia.target);break;case O.get(0):O.val(W.call(s,O.val(),0,360));f.val("h",O.val(),ia.target);break;case K.get(0):K.val(W.call(s,K.val(),0,100));f.val("s",K.val(),ia.target);break;case P.get(0):P.val(W.call(s, P.val(),0,100));f.val("v",P.val(),ia.target);break;case T.get(0):T.val(T.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));d&&d.val(T.val());f.val("hex",T.val()!=""?T.val():null,ia.target);break;case d&&d.get(0):d.val(d.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6));T.val(d.val());f.val("hex",d.val()!=""?d.val():null,ia.target);break;case M&&M.get(0):M.val(M.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2));f.val("a",M.val()!=null?parseInt(M.val(),16): -null,ia.target)}}},fa=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},aa= -function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},V=function(ia,da,U){if(ia==""||isNaN(ia))return da;if(ia>U)return U;if(ia255)aa.r=255;if(d!=aa.r){d=aa.r;fa=true}break;case "g":if(ra)continue;V=true;aa.g=M&&M.g&&M.g|0||M&&M|0||0;if(aa.g<0)aa.g=0;else if(aa.g>255)aa.g=255;if(l!=aa.g){l=aa.g;fa=true}break;case "b":if(ra)continue;V=true;aa.b=M&&M.b&&M.b|0||M&&M|0||0;if(aa.b<0)aa.b=0;else if(aa.b>255)aa.b=255;if(s!=aa.b){s=aa.b;fa=true}break;case "a":aa.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(aa.a<0)aa.a=0;else if(aa.a>255)aa.a=255;if(C!=aa.a){C=aa.a;fa=true}break;case "h":if(V)continue;ra=true;aa.h=M&&M.h&& -M.h|0||M&&M|0||0;if(aa.h<0)aa.h=0;else if(aa.h>360)aa.h=360;if(p!=aa.h){p=aa.h;fa=true}break;case "s":if(V)continue;ra=true;aa.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(aa.s<0)aa.s=0;else if(aa.s>100)aa.s=100;if(L!=aa.s){L=aa.s;fa=true}break;case "v":if(V)continue;ra=true;aa.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(aa.v<0)aa.v=0;else if(aa.v>100)aa.v=100;if(R!=aa.v){R=aa.v;fa=true}}if(fa){if(V){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!= -null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,ha||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!= +null,ia.target)}}},ha=function(ia){if(f.val()!=null)switch(ia.target){case C.get(0):C.val(f.val("r"));break;case p.get(0):p.val(f.val("g"));break;case L.get(0):L.val(f.val("b"));break;case R&&R.get(0):R.val(Math.precision(f.val("a")*100/255,l));break;case O.get(0):O.val(f.val("h"));break;case K.get(0):K.val(f.val("s"));break;case P.get(0):P.val(f.val("v"));break;case T.get(0):case d&&d.get(0):T.val(f.val("hex"));d&&d.val(f.val("hex"));break;case M&&M.get(0):M.val(f.val("ahex").substring(6))}},ca= +function(ia){switch(ia.keyCode){case 9:case 16:case 29:case 37:case 39:return false;case "c".charCodeAt():case "v".charCodeAt():if(ia.ctrlKey)return false}return true},W=function(ia,ea,U){if(ia==""||isNaN(ia))return ea;if(ia>U)return U;if(ia255)ca.r=255;if(d!=ca.r){d=ca.r;ha=true}break;case "g":if(ra)continue;W=true;ca.g=M&&M.g&&M.g|0||M&&M|0||0;if(ca.g<0)ca.g=0;else if(ca.g>255)ca.g=255;if(l!=ca.g){l=ca.g;ha=true}break;case "b":if(ra)continue;W=true;ca.b=M&&M.b&&M.b|0||M&&M|0||0;if(ca.b<0)ca.b=0;else if(ca.b>255)ca.b=255;if(s!=ca.b){s=ca.b;ha=true}break;case "a":ca.a=M&&M.a!=null?M.a|0:M!=null?M|0:255;if(ca.a<0)ca.a=0;else if(ca.a>255)ca.a=255;if(C!=ca.a){C=ca.a;ha=true}break;case "h":if(W)continue;ra=true;ca.h=M&&M.h&& +M.h|0||M&&M|0||0;if(ca.h<0)ca.h=0;else if(ca.h>360)ca.h=360;if(p!=ca.h){p=ca.h;ha=true}break;case "s":if(W)continue;ra=true;ca.s=M&&M.s!=null?M.s|0:M!=null?M|0:100;if(ca.s<0)ca.s=0;else if(ca.s>100)ca.s=100;if(L!=ca.s){L=ca.s;ha=true}break;case "v":if(W)continue;ra=true;ca.v=M&&M.v!=null?M.v|0:M!=null?M|0:100;if(ca.v<0)ca.v=0;else if(ca.v>100)ca.v=100;if(R!=ca.v){R=ca.v;ha=true}}if(ha){if(W){d=d||0;l=l||0;s=s||0;M=u.rgbToHsv({r:d,g:l,b:s});p=M.h;L=M.s;R=M.v}else if(ra){p=p||0;L=L!=null?L:100;R=R!= +null?R:100;M=u.hsvToRgb({h:p,s:L,v:R});d=M.r;l=M.g;s=M.b}C=C!=null?C:255;K.call(f,aa||f)}}}};a.extend(true,f,{val:P,bind:function(T){a.isFunction(T)&&O.push(T)},unbind:function(T){if(a.isFunction(T))for(var M;(M=a.inArray(T,O))!=-1;)O.splice(M,1)},destroy:function(){O=null}});if(c)if(c.ahex!=null)P("ahex",c);else if(c.hex!=null)P((c.a!=null?"a":"")+"hex",c.a!=null?{ahex:c.hex+u.intToHex(c.a)}:c);else if(c.r!=null&&c.g!=null&&c.b!=null)P("rgb"+(c.a!=null?"a":""),c);else if(c.h!=null&&c.s!=null&&c.v!= null)P("hsv"+(c.a!=null?"a":""),c)},ColorMethods:{hexToRgba:function(c){c=this.validateHex(c);if(c=="")return{r:null,g:null,b:null,a:null};var f="00",d="00",l="00",s="255";if(c.length==6)c+="ff";if(c.length>6){f=c.substring(0,2);d=c.substring(2,4);l=c.substring(4,6);s=c.substring(6,c.length)}else{if(c.length>4){f=c.substring(4,c.length);c=c.substring(0,4)}if(c.length>2){d=c.substring(2,c.length);c=c.substring(0,2)}if(c.length>0)l=c.substring(0,c.length)}return{r:this.hexToInt(f),g:this.hexToInt(d), b:this.hexToInt(l),a:this.hexToInt(s)}},validateHex:function(c){if(typeof c=="object")return"";c=c.toLowerCase().replace(/[^a-f0-9]/g,"");if(c.length>8)c=c.substring(0,8);return c},rgbaToHex:function(c){return this.intToHex(c.r)+this.intToHex(c.g)+this.intToHex(c.b)+this.intToHex(c.a)},intToHex:function(c){c=(c|0).toString(16);if(c.length==1)c="0"+c;return c.toLowerCase()},hexToInt:function(c){return parseInt(c,16)},rgbToHsv:function(c){var f=c.r/255,d=c.g/255;c=c.b/255;var l={h:0,s:0,v:0},s=0,C= 0;if(f>=d&&f>=c){C=f;s=d>c?c:d}else if(d>=c&&d>=f){C=d;s=f>c?c:f}else{C=c;s=d>f?f:d}l.v=C;l.s=C?(C-s)/C:0;if(l.s){s=C-s;l.h=f==C?(d-c)/s:d==C?2+(c-f)/s:4+(f-d)/s;l.h=parseInt(l.h*60);if(l.h<0)l.h+=360}else l.h=0;l.s=l.s*100|0;l.v=l.v*100|0;return l},hsvToRgb:function(c){var f={r:0,g:0,b:0,a:100},d=c.h,l=c.s;c=c.v;if(l==0)f.r=c==0?f.g=f.b=0:f.g=f.b=c*255/100|0;else{if(d==360)d=0;d/=60;l/=100;c/=100;var s=d|0,C=d-s;d=c*(1-l);var p=c*(1-l*C);l=c*(1-l*(1-C));switch(s){case 0:f.r=c;f.g=l;f.b=d;break;case 1:f.r= p;f.g=c;f.b=d;break;case 2:f.r=d;f.g=c;f.b=l;break;case 3:f.r=d;f.g=p;f.b=c;break;case 4:f.r=l;f.g=d;f.b=c;break;case 5:f.r=c;f.g=d;f.b=p}f.r=f.r*255|0;f.g=f.g*255|0;f.b=f.b*255|0}return f}}};var b=a.jPicker.Color,n=a.jPicker.List,u=a.jPicker.ColorMethods;a.fn.jPicker=function(c){var f=arguments;return this.each(function(){var d=this,l=a.extend(true,{},a.fn.jPicker.defaults,c);if(a(d).get(0).nodeName.toLowerCase()=="input"){a.extend(true,l,{window:{bindToInput:true,expandable:true,input:a(d)}});if(a(d).val()== ""){l.color.active=new b({hex:null});l.color.current=new b({hex:null})}else if(u.validateHex(a(d).val())){l.color.active=new b({hex:a(d).val(),a:l.color.active.val("a")});l.color.current=new b({hex:a(d).val(),a:l.color.active.val("a")})}}if(l.window.expandable)a(d).after('    '); -else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,ha=null,na=null,fa=null,aa=null,V=null,ra=null,ia=null,da=null,U=null,Y=null,oa=null,pa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,ea=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d, -O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:100,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("s"),y:100-Q.val("v")},aa);V.val("y",360-Q.val("h"),V);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d, -O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",100-Q.val("s"),V);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,ea);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,260);wa.call(d,fa,100)},0);aa.range("all",{minX:0,maxX:360, -minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("s")},aa);V.val("y",100-Q.val("v"),V);break;case "r":Fa=-1040;Oa=-780;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("r"),V);break;case "g":Fa=-1560;Oa=-1820;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255}); -if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("b"),y:255-Q.val("r")},aa);V.val("y",255-Q.val("g"),V);break;case "b":Fa=-2080;Oa=-2860;aa.range("all",{minX:0,maxX:255,minY:0,maxY:255});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("r"),y:255-Q.val("g")},aa);V.val("y",255-Q.val("b"),V);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,fa,0);wa.call(d, -fa,100)},0);aa.range("all",{minX:0,maxX:360,minY:0,maxY:100});V.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;aa.val("xy",{x:Q.val("h"),y:100-Q.val("v")},aa);V.val("y",255-Q.val("a"),V);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent"); -wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,ha,Oa-260);Ca.call(d,fa,260);wa.call(d,fa,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=V&&Q!=aa)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var ea=ka.active;if(!(Q!=aa&&ea.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":ea.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":ea.val("hv", -{h:Fa.x,v:100-Fa.y},Q);break;case "v":ea.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":ea.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":ea.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":ea.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var ea=ka.active;if(!(Q!=V&&ea.val()==null))switch(l.color.mode){case "h":ea.val("h",{h:360-N.val("y")},Q);break;case "s":ea.val("s",{s:100-N.val("y")},Q);break;case "v":ea.val("v",{v:100-N.val("y")},Q);break;case "r":ea.val("r",{r:255-N.val("y")},Q);break;case "g":ea.val("g", -{g:255-N.val("y")},Q);break;case "b":ea.val("b",{b:255-N.val("y")},Q);break;case "a":ea.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=aa)switch(l.color.mode){case "h":var ea=N.val("sv");aa.val("xy",{x:ea!=null?ea.s:100,y:100-(ea!=null?ea.v:100)},Q);break;case "s":case "a":ea=N.val("hv");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.v:100)},Q);break;case "v":ea=N.val("hs");aa.val("xy",{x:ea&&ea.h||0,y:100-(ea!=null?ea.s:100)},Q);break;case "r":ea=N.val("bg");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&& -ea.g||0)},Q);break;case "g":ea=N.val("br");aa.val("xy",{x:ea&&ea.b||0,y:255-(ea&&ea.r||0)},Q);break;case "b":ea=N.val("rg");aa.val("xy",{x:ea&&ea.r||0,y:255-(ea&&ea.g||0)},Q)}if(Q!=V)switch(l.color.mode){case "h":V.val("y",360-(N.val("h")||0),Q);break;case "s":ea=N.val("s");V.val("y",100-(ea!=null?ea:100),Q);break;case "v":ea=N.val("v");V.val("y",100-(ea!=null?ea:100),Q);break;case "r":V.val("y",255-(N.val("r")||0),Q);break;case "g":V.val("y",255-(N.val("g")||0),Q);break;case "b":V.val("y",255-(N.val("b")|| -0),Q);break;case "a":ea=N.val("a");V.val("y",255-(ea!=null?ea:255),Q)}},nb=function(N){try{var Q=N.val("all");oa.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,oa,Q&&Math.precision(Q.a*100/255,4)||0)}catch(ea){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")|| -0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,na,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var ea=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,na,Math.precision((255- -(Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");ea=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,ea.val("hex"));wa.call(d,na,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":ea=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;ea=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;ea=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;ea=N&&N.g||0}var Fa=ea>Q?Q:ea;wa.call(d,T,Q>ea?Math.precision((Q-ea)/(255-ea)*100,4):0);wa.call(d,M,ea>Q?Math.precision((ea- -Q)/(255-Q)*100,4):0);wa.call(d,ha,Math.precision(Fa/255*100,4));wa.call(d,na,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,na,Q!=null?0:100);wa.call(d,fa,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ -Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/ -100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){ea=N.attr("pngSrc");ea!=null&&(ea.indexOf("AlphaBar.png")!=-1||ea.indexOf("Bars.png")!=-1||ea.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ea+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+ -N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");pa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,pa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va"); -Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));da=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:da-(Y-N.pageY)+"px"});l.window.expandable&& +else l.window.liveUpdate=false;var s=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,C=null,p=null,L=null,R=null,O=null,K=null,P=null,T=null,M=null,aa=null,qa=null,ha=null,ca=null,W=null,ra=null,ia=null,ea=null,U=null,Y=null,na=null,oa=null,la=null,ma=null,Ba=null,Ea=null,Ia=null,za=null,Ka=null,Na=function(N){var Q=ka.active,fa=Q.val("hex"),Fa,Oa;l.color.mode=N;switch(N){case "h":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,0);wa.call(d,R,100);Ca.call(d, +O,260);wa.call(d,O,100);Sa.call(d,L,"transparent");Ca.call(d,P,0);wa.call(d,P,100);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,aa,260);wa.call(d,aa,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:100,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:360});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("s"),y:100-Q.val("v")},ca);W.val("y",360-Q.val("h"),W);break;case "s":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d, +O,-520);Ca.call(d,P,-260);Ca.call(d,T,-520);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("v")},ca);W.val("y",100-Q.val("s"),W);break;case "v":setTimeout(function(){Sa.call(d,p,"000000");Ca.call(d,R,-780);Ca.call(d,O,260);Sa.call(d,L,fa);Ca.call(d,P,-520);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,ha,260);wa.call(d,ha,100)},0);ca.range("all",{minX:0,maxX:360, +minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:100});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("s")},ca);W.val("y",100-Q.val("v"),W);break;case "r":Fa=-1040;Oa=-780;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("b"),y:255-Q.val("g")},ca);W.val("y",255-Q.val("r"),W);break;case "g":Fa=-1560;Oa=-1820;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255}); +if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("b"),y:255-Q.val("r")},ca);W.val("y",255-Q.val("g"),W);break;case "b":Fa=-2080;Oa=-2860;ca.range("all",{minX:0,maxX:255,minY:0,maxY:255});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("r"),y:255-Q.val("g")},ca);W.val("y",255-Q.val("b"),W);break;case "a":setTimeout(function(){Sa.call(d,p,"transparent");Ca.call(d,R,-260);Ca.call(d,O,-520);Ca.call(d,P,260);Ca.call(d,T,260);wa.call(d,T,100);Ca.call(d,ha,0);wa.call(d, +ha,100)},0);ca.range("all",{minX:0,maxX:360,minY:0,maxY:100});W.range("rangeY",{minY:0,maxY:255});if(Q.val("ahex")==null)break;ca.val("xy",{x:Q.val("h"),y:100-Q.val("v")},ca);W.val("y",255-Q.val("a"),W);break;default:throw"Invalid Mode";}switch(N){case "s":case "v":case "a":setTimeout(function(){wa.call(d,R,100);wa.call(d,P,100);Ca.call(d,M,260);wa.call(d,M,100);Ca.call(d,aa,260);wa.call(d,aa,100)},0);break;case "r":case "g":case "b":setTimeout(function(){Sa.call(d,p,"transparent");Sa.call(d,L,"transparent"); +wa.call(d,P,100);wa.call(d,R,100);Ca.call(d,R,Fa);Ca.call(d,O,Fa-260);Ca.call(d,P,Oa-780);Ca.call(d,T,Oa-520);Ca.call(d,M,Oa);Ca.call(d,aa,Oa-260);Ca.call(d,ha,260);wa.call(d,ha,100)},0)}Q.val("ahex")!=null&&Aa.call(d,Q)},Aa=function(N,Q){if(Q==null||Q!=W&&Q!=ca)xa.call(d,N,Q);setTimeout(function(){nb.call(d,N);Ya.call(d,N);fb.call(d,N)},0)},ya=function(N,Q){var fa=ka.active;if(!(Q!=ca&&fa.val()==null)){var Fa=N.val("all");switch(l.color.mode){case "h":fa.val("sv",{s:Fa.x,v:100-Fa.y},Q);break;case "s":case "a":fa.val("hv", +{h:Fa.x,v:100-Fa.y},Q);break;case "v":fa.val("hs",{h:Fa.x,s:100-Fa.y},Q);break;case "r":fa.val("gb",{g:255-Fa.y,b:Fa.x},Q);break;case "g":fa.val("rb",{r:255-Fa.y,b:Fa.x},Q);break;case "b":fa.val("rg",{r:Fa.x,g:255-Fa.y},Q)}}},Ga=function(N,Q){var fa=ka.active;if(!(Q!=W&&fa.val()==null))switch(l.color.mode){case "h":fa.val("h",{h:360-N.val("y")},Q);break;case "s":fa.val("s",{s:100-N.val("y")},Q);break;case "v":fa.val("v",{v:100-N.val("y")},Q);break;case "r":fa.val("r",{r:255-N.val("y")},Q);break;case "g":fa.val("g", +{g:255-N.val("y")},Q);break;case "b":fa.val("b",{b:255-N.val("y")},Q);break;case "a":fa.val("a",255-N.val("y"),Q)}},xa=function(N,Q){if(Q!=ca)switch(l.color.mode){case "h":var fa=N.val("sv");ca.val("xy",{x:fa!=null?fa.s:100,y:100-(fa!=null?fa.v:100)},Q);break;case "s":case "a":fa=N.val("hv");ca.val("xy",{x:fa&&fa.h||0,y:100-(fa!=null?fa.v:100)},Q);break;case "v":fa=N.val("hs");ca.val("xy",{x:fa&&fa.h||0,y:100-(fa!=null?fa.s:100)},Q);break;case "r":fa=N.val("bg");ca.val("xy",{x:fa&&fa.b||0,y:255-(fa&& +fa.g||0)},Q);break;case "g":fa=N.val("br");ca.val("xy",{x:fa&&fa.b||0,y:255-(fa&&fa.r||0)},Q);break;case "b":fa=N.val("rg");ca.val("xy",{x:fa&&fa.r||0,y:255-(fa&&fa.g||0)},Q)}if(Q!=W)switch(l.color.mode){case "h":W.val("y",360-(N.val("h")||0),Q);break;case "s":fa=N.val("s");W.val("y",100-(fa!=null?fa:100),Q);break;case "v":fa=N.val("v");W.val("y",100-(fa!=null?fa:100),Q);break;case "r":W.val("y",255-(N.val("r")||0),Q);break;case "g":W.val("y",255-(N.val("g")||0),Q);break;case "b":W.val("y",255-(N.val("b")|| +0),Q);break;case "a":fa=N.val("a");W.val("y",255-(fa!=null?fa:255),Q)}},nb=function(N){try{var Q=N.val("all");na.css({backgroundColor:Q&&"#"+Q.hex||"transparent"});wa.call(d,na,Q&&Math.precision(Q.a*100/255,4)||0)}catch(fa){}},Ya=function(N){switch(l.color.mode){case "h":Sa.call(d,p,(new b({h:N.val("h")||0,s:100,v:100})).val("hex"));break;case "s":case "a":var Q=N.val("s");wa.call(d,O,100-(Q!=null?Q:100));break;case "v":Q=N.val("v");wa.call(d,R,Q!=null?Q:100);break;case "r":wa.call(d,O,Math.precision((N.val("r")|| +0)/255*100,4));break;case "g":wa.call(d,O,Math.precision((N.val("g")||0)/255*100,4));break;case "b":wa.call(d,O,Math.precision((N.val("b")||0)/255*100))}N=N.val("a");wa.call(d,K,Math.precision((255-(N||0))*100/255,4))},fb=function(N){switch(l.color.mode){case "h":var Q=N.val("a");wa.call(d,qa,Math.precision((255-(Q||0))*100/255,4));break;case "s":Q=N.val("hva");var fa=new b({h:Q&&Q.h||0,s:100,v:Q!=null?Q.v:100});Sa.call(d,L,fa.val("hex"));wa.call(d,T,100-(Q!=null?Q.v:100));wa.call(d,qa,Math.precision((255- +(Q&&Q.a||0))*100/255,4));break;case "v":Q=N.val("hsa");fa=new b({h:Q&&Q.h||0,s:Q!=null?Q.s:100,v:100});Sa.call(d,L,fa.val("hex"));wa.call(d,qa,Math.precision((255-(Q&&Q.a||0))*100/255,4));break;case "r":case "g":case "b":fa=Q=0;N=N.val("rgba");if(l.color.mode=="r"){Q=N&&N.b||0;fa=N&&N.g||0}else if(l.color.mode=="g"){Q=N&&N.b||0;fa=N&&N.r||0}else if(l.color.mode=="b"){Q=N&&N.r||0;fa=N&&N.g||0}var Fa=fa>Q?Q:fa;wa.call(d,T,Q>fa?Math.precision((Q-fa)/(255-fa)*100,4):0);wa.call(d,M,fa>Q?Math.precision((fa- +Q)/(255-Q)*100,4):0);wa.call(d,aa,Math.precision(Fa/255*100,4));wa.call(d,qa,Math.precision((255-(N&&N.a||0))*100/255,4));break;case "a":Q=N.val("a");Sa.call(d,L,N.val("hex")||"000000");wa.call(d,qa,Q!=null?0:100);wa.call(d,ha,Q!=null?100:0)}},Sa=function(N,Q){N.css({backgroundColor:Q&&Q.length==6&&"#"+Q||"transparent"})},Wa=function(N,Q){if(s&&(Q.indexOf("AlphaBar.png")!=-1||Q.indexOf("Bars.png")!=-1||Q.indexOf("Maps.png")!=-1)){N.attr("pngSrc",Q);N.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ +Q+"', sizingMethod='scale')"})}else N.css({backgroundImage:"url('"+Q+"')"})},Ca=function(N,Q){N.css({top:Q+"px"})},wa=function(N,Q){N.css({visibility:Q>0?"visible":"hidden"});if(Q>0&&Q<100)if(s){var fa=N.attr("pngSrc");fa!=null&&(fa.indexOf("AlphaBar.png")!=-1||fa.indexOf("Bars.png")!=-1||fa.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+fa+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+Q+")"}):N.css({opacity:Math.precision(Q/ +100,4)})}else N.css({opacity:Math.precision(Q/100,4)});else if(Q==0||Q==100)if(s){fa=N.attr("pngSrc");fa!=null&&(fa.indexOf("AlphaBar.png")!=-1||fa.indexOf("Bars.png")!=-1||fa.indexOf("Maps.png")!=-1)?N.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+fa+"', sizingMethod='scale')"}):N.css({opacity:""})}else N.css({opacity:""})},db=function(){ka.active.val("ahex",ka.current.val("ahex"))},La=function(){ka.current.val("ahex",ka.active.val("ahex"))},Ra=function(N){a(this).parents("tbody:first").find('input:radio[value!="'+ +N.target.value+'"]').removeAttr("checked");Na.call(d,N.target.value)},Da=function(){db.call(d)},gb=function(){db.call(d);l.window.expandable&&yb.call(d);a.isFunction(sb)&&sb.call(d,ka.active,ma)},rb=function(){La.call(d);l.window.expandable&&yb.call(d);a.isFunction(lb)&&lb.call(d,ka.active,la)},Xa=function(){ob.call(d)},ab=function(N){var Q=N.val("hex");oa.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,oa,Math.precision((N.val("a")||0)*100/255,4))},xb=function(N){var Q=N.val("hex");N=N.val("va"); +Ea.css({backgroundColor:Q&&"#"+Q||"transparent"});wa.call(d,Ia,Math.precision((255-(N&&N.a||0))*100/255,4));if(l.window.bindToInput&&l.window.updateInputColor)l.window.input.css({backgroundColor:Q&&"#"+Q||"transparent",color:N==null||N.v>75?"#000000":"#ffffff"})},ua=function(N){ia=parseInt(C.css("left"));ea=parseInt(C.css("top"));U=N.pageX;Y=N.pageY;a(document).bind("mousemove",jb).bind("mouseup",hb);N.preventDefault()},jb=function(N){C.css({left:ia-(U-N.pageX)+"px",top:ea-(Y-N.pageY)+"px"});l.window.expandable&& !a.support.boxModel&&C.prev().css({left:C.css("left"),top:C.css("top")});N.stopPropagation();N.preventDefault();return false},hb=function(N){a(document).unbind("mousemove",jb).unbind("mouseup",hb);N.stopPropagation();N.preventDefault();return false},ub=function(N){N.preventDefault();N.stopPropagation();ka.active.val("ahex",a(this).attr("title")||null,N.target);return false},lb=a.isFunction(f[1])&&f[1]||null,eb=a.isFunction(f[2])&&f[2]||null,sb=a.isFunction(f[3])&&f[3]||null,ob=function(){ka.current.val("ahex", ka.active.val("ahex"));var N=function(){if(!(!l.window.expandable||a.support.boxModel)){var Q=C.find("table:first");C.before("