Solid ColorLinear GradientRadial Gradient');var R=$(L+"> .jGraduate_colPick"),N=$(L+"> .jGraduate_gradPick");N.html('
');var ga=256,na=ga-0,X=ga-0,U,ea,Aa,ja={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+s+"_jGraduate_GradContainer")[0],T=a("svg",{id:s+"_jgraduate_svg",width:ga,height:ga,xmlns:q.svg},ba);U=U||u.paint.type;var Z=ea=u.paint[U],oa=u.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ea.id=s+"_lg_jgraduate_grad";
-Z=ea=T.appendChild(ea)}a("radialGradient",{id:s+"_rg_jgraduate_grad"},T);if(U==="linearGradient")break;case "radialGradient":if(!pa){ea.id=s+"_rg_jgraduate_grad";Z=ea=T.appendChild(ea)}a("linearGradient",{id:s+"_lg_jgraduate_grad"},T)}if(pa){Z=ea=$("#"+s+"_lg_jgraduate_grad")[0];I=u.paint[U];v(0,"#"+I,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":v(1,"#"+I,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){I.substr(la,2);var xa=(255-parseInt(I.substr(la,2),16)).toString(16);
-if(xa.length<2)xa=0+xa;ma+=xa}v(1,"#"+ma,1);break;case "white":v(1,"#ffffff",1);break;case "black":v(1,"#000000",1)}else if(ma==="object")v(1,C.newstop.color||"#"+I,"opac"in C.newstop?C.newstop.opac:1)}I=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);xa=parseFloat(Z.getAttribute("y2")||0);var ya=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ha=parseFloat(Z.getAttribute("fx")||ya),Ga=parseFloat(Z.getAttribute("fy")||
-Ja);Aa=a("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:na,height:X,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":oa/100},T);var Ma=$("
").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ga,left:I*ga}).data("coord","start").appendTo(ba),Ca=Ma.clone().text(2).css({top:xa*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ba),wa=$("
").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:ya*
+s+'_jGraduate_Ok" class="jGraduate_Ok" value="OK"/>
');var ga=256,oa=ga-0,X=ga-0,U,ea,Aa,ja={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+s+"_jGraduate_GradContainer")[0],T=a("svg",{id:s+"_jgraduate_svg",width:ga,height:ga,xmlns:q.svg},ba);U=U||u.paint.type;var Z=ea=u.paint[U],na=u.paint.alpha,pa=U==="solidColor";switch(U){case "solidColor":case "linearGradient":if(!pa){ea.id=s+"_lg_jgraduate_grad";
+Z=ea=T.appendChild(ea)}a("radialGradient",{id:s+"_rg_jgraduate_grad"},T);if(U==="linearGradient")break;case "radialGradient":if(!pa){ea.id=s+"_rg_jgraduate_grad";Z=ea=T.appendChild(ea)}a("linearGradient",{id:s+"_lg_jgraduate_grad"},T)}if(pa){Z=ea=$("#"+s+"_lg_jgraduate_grad")[0];H=u.paint[U];v(0,"#"+H,1);var ma=typeof C.newstop;if(ma==="string")switch(C.newstop){case "same":v(1,"#"+H,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){H.substr(la,2);var xa=(255-parseInt(H.substr(la,2),16)).toString(16);
+if(xa.length<2)xa=0+xa;ma+=xa}v(1,"#"+ma,1);break;case "white":v(1,"#ffffff",1);break;case "black":v(1,"#000000",1)}else if(ma==="object")v(1,C.newstop.color||"#"+H,"opac"in C.newstop?C.newstop.opac:1)}H=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);xa=parseFloat(Z.getAttribute("y2")||0);var ya=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ha=parseFloat(Z.getAttribute("fx")||ya),Ga=parseFloat(Z.getAttribute("fy")||
+Ja);Aa=a("rect",{id:s+"_jgraduate_rect",x:0,y:0,width:oa,height:X,fill:"url(#"+s+"_jgraduate_grad)","fill-opacity":na/100},T);var Ma=$("
").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*ga,left:H*ga}).data("coord","start").appendTo(ba),Ca=Ma.clone().text(2).css({top:xa*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ba),wa=$("
").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:ya*
ga}).data("coord","center").appendTo(ba),ra=wa.clone().text("F").css({top:Ga*ga,left:Ha*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);ra[0].id=s+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ia,aa){var ka=ea.getAttribute(aa),M=isNaN(aa[1]);ka||(ka=M?"0.5":aa==="x2"?"1.0":"0.0");ja[aa]=$("#"+s+"_jGraduate_"+aa).val(ka).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value>
1)this.value=1;if(!(aa[0]==="f"&&!eb))if(M&&U==="radialGradient"||!M&&U==="linearGradient")ea.setAttribute(aa,this.value);var P=M?aa[0]==="c"?wa:ra:aa[1]==="1"?Ma:Ca,ca=aa.indexOf("x")>=0?"left":"top";P.css(ca,this.value*ga)}).change()});var va,kb,vb=$("#"+s+"_jGraduate_StopSlider"),cb,Ta,Va,Ea=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},Ta),ta,$a=1,Ka=1,Sa=0,Fa=ya,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);ba=a("pattern",{width:16,
height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ba).setAttributeNS(q.xlink,"xlink:href",C.images.clientPath+"map-opacity.png");$(Ta).on("click touchstart",function(ia){ta=vb.offset();if(ia.target.tagName!=="path"){var aa=ia.pageX-ta.left-8;aa=aa<10?10:aa>ga+10?ga+10:aa;v(aa/ga,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Ea)});kb=a("g",{},Ta);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},Ta);var lb=
-N.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod",$(this).val())}),Ua=null,Xa=function(ia){var aa=ia.pageX-hb.left,ka=ia.pageY-hb.top;aa=aa<0?0:aa>ga?ga:aa;ka=ka<0?0:ka>ga?ga:ka;Ua.css("left",aa).css("top",ka);aa=aa/na;ka=ka/X;var M=Ua.data("coord"),P=ea;switch(M){case "start":ja.x1.val(aa);ja.y1.val(ka);P.setAttribute("x1",aa);P.setAttribute("y1",ka);break;case "end":ja.x2.val(aa);ja.y2.val(ka);P.setAttribute("x2",aa);P.setAttribute("y2",ka);break;case "center":ja.cx.val(aa);
-ja.cy.val(ka);P.setAttribute("cx",aa);P.setAttribute("cy",ka);Fa=aa;db=ka;c();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);c()}ia.preventDefault()},wb=function(){Ua=null;Q.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(q.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var sa=va.length;for(la=0;la
ga?ga:aa;ka=ka<0?0:ka>ga?ga:ka;Ua.css("left",aa).css("top",ka);aa=aa/oa;ka=ka/X;var M=Ua.data("coord"),P=ea;switch(M){case "start":ja.x1.val(aa);ja.y1.val(ka);P.setAttribute("x1",aa);P.setAttribute("y1",ka);break;case "end":ja.x2.val(aa);ja.y2.val(ka);P.setAttribute("x2",aa);P.setAttribute("y2",ka);break;case "center":ja.cx.val(aa);
+ja.cy.val(ka);P.setAttribute("cx",aa);P.setAttribute("cy",ka);Fa=aa;db=ka;c();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);c()}ia.preventDefault()},wb=function(){Ua=null;S.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(q.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(q.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var sa=va.length;for(la=0;la99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/
+"stop"));++sa}va=ea.getElementsByTagNameNS(q.svg,"stop")}var ab;na=N=0;if(U==="radialGradient"){T=ea.gradientTransform.baseVal;if(T.numberOfItems===2){sa=T.getItem(0);T=T.getItem(1);if(sa.type===2&&T.type===3){sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==1)N=Math.round((1-sa.d)*100)}}else if(T.numberOfItems===3){ba=T.getItem(0);sa=T.getItem(1);T=T.getItem(2);if(ba.type===4&&sa.type===2&&T.type===3){na=Math.round(ba.angle);sa=T.matrix;if(sa.a!==1)N=Math.round(-(1-sa.a)*100);else if(sa.d!==
+1)N=Math.round((1-sa.d)*100)}}}N={radius:{handle:"#"+s+"_jGraduate_RadiusArrows",input:"#"+s+"_jGraduate_RadiusInput",val:(ea.getAttribute("r")||0.5)*100},opacity:{handle:"#"+s+"_jGraduate_OpacArrows",input:"#"+s+"_jGraduate_OpacInput",val:u.paint.alpha||100},ellip:{handle:"#"+s+"_jGraduate_EllipArrows",input:"#"+s+"_jGraduate_EllipInput",val:N},angle:{handle:"#"+s+"_jGraduate_AngleArrows",input:"#"+s+"_jGraduate_AngleInput",val:na}};$.each(N,function(ia,aa){var ka=$(aa.handle);ka.mousedown(function(M){var P=
+ka.parent();ab={type:ia,elem:ka,input:$(aa.input),parent:P,offset:P.offset()};S.mousemove(ob).mouseup(pb);M.preventDefault()});$(aa.input).val(aa.val).change(function(){var M=+this.value,P=0,ca=U==="radialGradient";switch(ia){case "radius":ca&&ea.setAttribute("r",M/100);P=Math.pow(M/100,0.4)/2*145;break;case "opacity":u.paint.alpha=M;Aa.setAttribute("fill-opacity",M/100);P=M*1.45;break;case "ellip":$a=Ka=1;if(M===0){P=72.5;break}if(M>99.5)M=99.5;if(M>0)Ka=1-M/100;else $a=-(M/100)-1;P=145*((M+100)/
2)/100;ca&&c();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;ca&&c()}if(P>145)P=145;else if(P<0)P=0;ka.css({"margin-left":P-5})}).change()});var ob=function(ia){var aa=ia.pageX-ab.offset.left-parseInt(ab.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ka=aa-5;aa/=145;switch(ab.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);Aa.setAttribute("fill-opacity",aa);break;
-case "ellip":Ka=$a=1;if(aa<0.5){aa/=0.5;$a=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;aa=2-aa;Ka=aa<=0?0.01:aa}c();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;c();aa/=100}ab.elem.css({"margin-left":ka});aa=Math.round(aa*100);ab.input.val(aa);ia.preventDefault()},pb=function(){Q.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(u.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];I=u.paint.solidColor=="none"?"":u.paint.solidColor+N;pa||(I=va[0].getAttribute("stop-color"));
-$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});S.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:I,alphaSupport:true}},function(ia){u.paint.type="solidColor";u.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;u.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";u.paint.radialGradient=null;R()},null,function(){K()});var fb=$(L+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current");
+case "ellip":Ka=$a=1;if(aa<0.5){aa/=0.5;$a=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5;aa=2-aa;Ka=aa<=0?0.01:aa}c();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;c();aa/=100}ab.elem.css({"margin-left":ka});aa=Math.round(aa*100);ab.input.val(aa);ia.preventDefault()},pb=function(){S.unbind("mousemove",ob).unbind("mouseup",pb);ab=null};for(N=(u.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];H=u.paint.solidColor=="none"?"":u.paint.solidColor+N;pa||(H=va[0].getAttribute("stop-color"));
+$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});R.jPicker({window:{title:C.window.pickerTitle},images:{clientPath:C.images.clientPath},color:{active:H,alphaSupport:true}},function(ia){u.paint.type="solidColor";u.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;u.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";u.paint.radialGradient=null;Q()},null,function(){K()});var fb=$(L+" .jGraduate_tabs li");fb.on("click touchstart",function(){fb.removeClass("jGraduate_tab_current");
$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ia=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ia==="rg"||ia==="lg"){$(".jGraduate_"+ia+"_field").show();$(".jGraduate_"+(ia==="lg"?"rg":"lg")+"_field").hide();$("#"+s+"_jgraduate_rect")[0].setAttribute("fill","url(#"+s+"_"+ia+"_jgraduate_grad)");U=ia==="lg"?"linearGradient":"radialGradient";$("#"+s+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+s+"_"+ia+"_jgraduate_grad")[0];if(ea!==aa){var ka=
$(ea).find("stop");$(aa).empty().append(ka);ea=aa;aa=lb.val();ea.setAttribute("spreadMethod",aa)}eb=ia==="rg"&&ea.getAttribute("fx")!=null&&!(ya==Ha&&Ja==Ga);$("#"+s+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+s+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();fb.removeClass("jGraduate_tab_current");var tb;switch(u.paint.type){case "linearGradient":tb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb=
$(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){tb.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(g,b){if(g.menu==undefined)return false;if(g.inSpeed==undefined)g.inSpeed=150;if(g.outSpeed==undefined)g.outSpeed=75;if(g.inSpeed==0)g.inSpeed=-1;if(g.outSpeed==0)g.outSpeed=-1;$(this).each(function(){var p=$(this),v=$(p).offset(),d=$("#"+g.menu);d.addClass("contextMenu");$(this).bind("mousedown",function(c){$(this).on("mouseup",function(m){var u=$(this);u.unbind("mouseup");$(".contextMenu").hide();if(c.button===2||
@@ -61,16 +61,16 @@ $(u),{x:C-v.left,y:s-v.top,docX:C,docY:s});return false});setTimeout(function(){
function(){return false})});return $(this)},disableContextMenuItems:function(g){if(g==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(g!=undefined)for(var b=g.split(","),p=0;p=0,v=q.indexOf("Gecko/")>=0,d=q.indexOf("MSIE")>=0,f=q.indexOf("Chrome/")>=0,c=q.indexOf("Windows")>=0,m=q.indexOf("Macintosh")>=
-0,u="ontouchstart"in window,C=!!g.querySelector,s=!!document.evaluate,L=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var X=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{X.replaceItem(na,0);return true}catch(U){}return false}(),R=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","path");na.setAttribute("d","M0,0 10,10");var X=na.pathSegList;na=na.createSVGPathSegLinetoAbs(5,5);try{X.insertItemBefore(na,
-0);return true}catch(U){}return false}(),K=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg"),X=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);X.setAttribute("x",5);na.appendChild(X);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";X.appendChild(U);X=U.getStartPositionOfChar(0);X=X.x;document.documentElement.removeChild(na);return X===0}(),I=function(){var na=document.createElementNS("http://www.w3.org/2000/svg",
-"svg");document.documentElement.appendChild(na);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 C0,0 10,10 10,0");na.appendChild(X);X=X.getBBox();document.documentElement.removeChild(na);return X.height>4&&X.height<5}(),Q=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(na);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 10,0");var U=document.createElementNS("http://www.w3.org/2000/svg",
-"path");U.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(X);ea.appendChild(U);na.appendChild(ea);X=ea.getBBox();document.documentElement.removeChild(na);return X.width==15}(),S=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}(),N=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"}(),ga=function(){var na=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,X=g.createSVGTransform();na.appendItem(X);return na.getItem(0)==X}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return v};
-svgedit.browser.isIE=function(){return d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return s};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return R};svgedit.browser.supportsPathBBox=function(){return I};
-svgedit.browser.supportsHVLineContainerBBox=function(){return Q};svgedit.browser.supportsGoodTextCharPos=function(){return K};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return S};svgedit.browser.supportsNonScalingStroke=function(){return N};svgedit.browser.supportsNativeTransformLists=function(){return ga}}else window.location="browser-not-supported.html"})();svgedit=svgedit||{};
+0,u="ontouchstart"in window,C=!!g.querySelector,s=!!document.evaluate,L=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var X=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{X.replaceItem(oa,0);return true}catch(U){}return false}(),Q=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var X=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{X.insertItemBefore(oa,
+0);return true}catch(U){}return false}(),K=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg"),X=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);X.setAttribute("x",5);oa.appendChild(X);var U=document.createElementNS("http://www.w3.org/2000/svg","text");U.textContent="a";X.appendChild(U);X=U.getStartPositionOfChar(0);X=X.x;document.documentElement.removeChild(oa);return X===0}(),H=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg",
+"svg");document.documentElement.appendChild(oa);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 C0,0 10,10 10,0");oa.appendChild(X);X=X.getBBox();document.documentElement.removeChild(oa);return X.height>4&&X.height<5}(),S=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);var X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d","M0,0 10,0");var U=document.createElementNS("http://www.w3.org/2000/svg",
+"path");U.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(X);ea.appendChild(U);oa.appendChild(ea);X=ea.getBBox();document.documentElement.removeChild(oa);return X.width==15}(),R=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("x",0.1);(oa=oa.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 oa}(),N=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect");oa.setAttribute("style","vector-effect:non-scaling-stroke");return oa.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,X=g.createSVGTransform();oa.appendItem(X);return oa.getItem(0)==X}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return v};
+svgedit.browser.isIE=function(){return d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return C};svgedit.browser.supportsXpath=function(){return s};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return Q};svgedit.browser.supportsPathBBox=function(){return H};
+svgedit.browser.supportsHVLineContainerBBox=function(){return S};svgedit.browser.supportsGoodTextCharPos=function(){return K};svgedit.browser.supportsEditableText=function(){return b};svgedit.browser.supportsGoodDecimals=function(){return R};svgedit.browser.supportsNonScalingStroke=function(){return N};svgedit.browser.supportsNativeTransformLists=function(){return ga}}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(g){this._elem=g||null;this._xforms=[];this._update=function(){var b="";a.createSVGMatrix();for(var p=0;p=0)return this._xforms[b];throw{code:1};};this.insertItemBefore=function(b,p){var v=null;if(p>=0)if(p=0){this._removeFromOtherLists(b);v=this._xforms[p]=b;this._list._update()}return v};this.removeItem=function(b){if(b=0){for(var p=this._xforms[b],v=Array(this.numberOfItems-
1),d=0;d").text(d).html()};svgedit.utilities.fromXml=function(d){return $("").html(d).text()};svgedit.utilities.encode64=function(d){d=svgedit.utilities.convertToXMLReferences(d);if(window.btoa)return window.btoa(d);
-var f=Array(Math.floor((d.length+2)/3)*4),c,m,u,C,s,L,R=0,K=0;do{c=d.charCodeAt(R++);m=d.charCodeAt(R++);u=d.charCodeAt(R++);C=c>>2;c=(c&3)<<4|m>>4;s=(m&15)<<2|u>>6;L=u&63;if(isNaN(m))s=L=64;else if(isNaN(u))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(s);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(R<
+var f=Array(Math.floor((d.length+2)/3)*4),c,m,u,C,s,L,Q=0,K=0;do{c=d.charCodeAt(Q++);m=d.charCodeAt(Q++);u=d.charCodeAt(Q++);C=c>>2;c=(c&3)<<4|m>>4;s=(m&15)<<2|u>>6;L=u&63;if(isNaN(m))s=L=64;else if(isNaN(u))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(s);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(Q<
d.length);return f.join("")};svgedit.utilities.decode64=function(d){if(window.atob)return window.atob(d);var f="",c,m,u="",C,s="",L=0;d=d.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++));
c=c<<2|m>>4;m=(m&15)<<4|C>>2;u=(C&3)<<6|s;f+=String.fromCharCode(c);if(C!=64)f+=String.fromCharCode(m);if(s!=64)f+=String.fromCharCode(u)}while(L127)f+=""+m+";"}return f};svgedit.utilities.text2xml=function(d){if(d.indexOf("=0)d=d.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var c=window.DOMParser?
new DOMParser:new ActiveXObject("Microsoft.XMLDOM");c.async=false}catch(m){throw Error("XML Parser could not be instantiated");}try{f=c.loadXML?c.loadXML(d)?c:false:c.parseFromString(d,"text/xml")}catch(u){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(d){return{x:d.x,y:d.y,width:d.width,height:d.height}};svgedit.utilities.walkTree=function(d,f){if(d&&d.nodeType==1){f(d);for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f)}};
svgedit.utilities.walkTreePost=function(d,f){if(d&&d.nodeType==1){for(var c=d.childNodes.length;c--;)svgedit.utilities.walkTree(d.childNodes.item(c),f);f(d)}};svgedit.utilities.getUrlFromAttr=function(d){if(d)if(d.indexOf('url("')===0)return d.substring(5,d.indexOf('"',6));else if(d.indexOf("url('")===0)return d.substring(5,d.indexOf("'",6));else if(d.indexOf("url(")===0)return d.substring(4,d.indexOf(")"));return null};svgedit.utilities.getHref=function(d){return d.getAttributeNS("http://www.w3.org/1999/xlink",
"href")};svgedit.utilities.setHref=function(d,f){d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(d){d=g.getSVGContent().documentElement;var f=d.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:d.insertBefore(d.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),d.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(d){var f=d.pathSegList,c=f.numberOfItems;d=[[],[]];var m=f.getItem(0),
-u=[m.x,m.y];for(m=0;m=0){var m=c.split(":");d[m[1]]=q[m[0]]}else d[c]=c=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[p]=d});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(p){if(p.nodeType==3){p.nodeValue=p.nodeValue.replace(/^\s+|\s+$/g,"");p.nodeValue.length||p.parentNode.removeChild(p)}if(p.nodeType==1){var v=p.parentNode;if(p.ownerDocument&&v){var d=g[p.nodeName],f=b[p.nodeName];if(d!=
undefined){for(var c=[],m=p.attributes.length;m--;){var u=p.attributes.item(m),C=u.nodeName,s=u.localName,L=u.namespaceURI;if(!(f.hasOwnProperty(s)&&L==f[s]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){C.indexOf("se:")==0&&c.push([C,u.nodeValue]);p.removeAttributeNS(L,s)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":s=u.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(C,s)}if(C=="style"){u=
-u.nodeValue.split(";");for(C=u.length;C--;){s=u[C].split(":");d.indexOf(s[0])>=0&&p.setAttribute(s[0],s[1])}p.removeAttribute("style")}}$.each(c,function(R,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((m=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))v.removeChild(p);
-else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(R,K){var I=p.getAttribute(K);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(v.insertBefore(p.firstChild,p));v.removeChild(p);for(m=d.length;m--;)svgedit.sanitize.sanitizeSvg(d[m])}}}}})();svgedit=svgedit||{};
+u.nodeValue.split(";");for(C=u.length;C--;){s=u[C].split(":");d.indexOf(s[0])>=0&&p.setAttribute(s[0],s[1])}p.removeAttribute("style")}}$.each(c,function(Q,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((m=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(m[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))v.removeChild(p);
+else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(Q,K){var H=p.getAttribute(K);if(H)if((H=svgedit.utilities.getUrlFromAttr(H))&&H[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(v.insertBefore(p.firstChild,p));v.removeChild(p);for(m=d.length;m--;)svgedit.sanitize.sanitizeSvg(d[m])}}}}})();svgedit=svgedit||{};
(function(){if(!svgedit.history)svgedit.history={};svgedit.history.HistoryEventTypes={BEFORE_APPLY:"before_apply",AFTER_APPLY:"after_apply",BEFORE_UNAPPLY:"before_unapply",AFTER_UNAPPLY:"after_unapply"};svgedit.history.MoveElementCommand=function(a,q,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=q;this.oldParent=g;this.newNextSibling=a.nextSibling;this.newParent=a.parentNode};svgedit.history.MoveElementCommand.type=function(){return"svgedit.history.MoveElementCommand"};svgedit.history.MoveElementCommand.prototype.type=
svgedit.history.MoveElementCommand.type;svgedit.history.MoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.MoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.newParent.insertBefore(this.elem,this.newNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.MoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,
this);this.elem=this.oldParent.insertBefore(this.elem,this.oldNextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.MoveElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.InsertElementCommand=function(a,q){this.elem=a;this.text=q||"Create "+a.tagName;this.parent=a.parentNode;this.nextSibling=this.elem.nextSibling};svgedit.history.InsertElementCommand.type=function(){return"svgedit.history.InsertElementCommand"};svgedit.history.InsertElementCommand.prototype.type=
@@ -139,10 +139,10 @@ svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.un
(function(){if(!svgedit.select)svgedit.select={};var a,q,g;svgedit.select.Selector=function(b,p){this.id=b;this.selectedElement=p;this.locked=true;this.selectorGroup=a.createSVGElement({element:"g",attr:{id:"selectorGroup"+this.id}});this.selectorRect=this.selectorGroup.appendChild(a.createSVGElement({element:"path",attr:{id:"selectedBox"+this.id,fill:"none",stroke:"#4F80FF","stroke-width":"1","shape-rendering":"crispEdges",style:"pointer-events:none"}}));svgedit.browser.isTouch()&&this.selectorRect.setAttribute("stroke-opacity",
0.3);this.gripCoords={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};this.reset(this.selectedElement)};svgedit.select.Selector.prototype.reset=function(b){this.locked=true;this.selectedElement=b;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(b){var p=[];b=Math.round(b/45);if(b<0)b+=8;for(var v in g.selectorGrips)p.push(v);for(;b>0;){p.push(p.shift());b--}b=0;for(v in g.selectorGrips){g.selectorGrips[v].setAttribute("style",
"cursor:"+p[b]+"-resize");b++}};svgedit.select.Selector.prototype.showGrips=function(b){g.selectorGripsGroup.setAttribute("display",b?"inline":"none");var p=this.selectedElement;this.hasGrips=b;if(p&&b){this.selectorGroup.appendChild(g.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(p))}};svgedit.select.Selector.prototype.resize=function(){var b=this.selectorRect,p=g,v=p.selectorGrips,d=this.selectedElement,f=d.getAttribute("stroke-width"),c=a.currentZoom(),m=1/c;if(d.getAttribute("stroke")!==
-"none"&&!isNaN(f))m+=f/2;var u=d.tagName;if(u==="text")m+=2/c;f=svgedit.transformlist.getTransformList(d);f=svgedit.math.transformListToTransform(f).matrix;f.e*=c;f.f*=c;var C=svgedit.utilities.getBBox(d);if(u==="g"&&!$.data(d,"gsvg"))if(u=a.getStrokedBBox(d.childNodes))C=u;u=C.x;var s=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(u*c,s*c,L*c,C*c,f);f=c.aabox;u=f.x-m;s=f.y-m;L=f.width+m*2;var R=f.height+m*2;f=u+L/2;C=s+R/2;if(d=svgedit.utilities.getRotationAngle(d)){u=a.svgRoot().createSVGTransform();
-u.setRotate(-d,f,C);u=u.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,u);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,u);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,u);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,u);u=c.tl;L=u.x;R=u.y;var K=u.x,I=u.y;u=Math.min;s=Math.max;L=u(L,u(c.tr.x,u(c.bl.x,c.br.x)))-m;R=u(R,u(c.tr.y,u(c.bl.y,c.br.y)))-m;K=s(K,s(c.tr.x,s(c.bl.x,c.br.x)))+m;I=s(I,s(c.tr.y,s(c.bl.y,c.br.y)))+m;u=L;s=R;L=K-L;R=I-R}m=a.svgRoot().suspendRedraw(100);b.setAttribute("d",
-"M"+u+","+s+" L"+(u+L)+","+s+" "+(u+L)+","+(s+R)+" "+u+","+(s+R)+"z");this.selectorGroup.setAttribute("transform",d?"rotate("+[d,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){u-=15.75;s-=15.75}else{u-=4;s-=4}this.gripCoords={nw:[u,s].map(Math.round),ne:[u+L,s].map(Math.round),sw:[u,s+R].map(Math.round),se:[u+L,s+R].map(Math.round),n:[u+L/2,s].map(Math.round),w:[u,s+R/2].map(Math.round),e:[u+L,s+R/2].map(Math.round),s:[u+L/2,s+R].map(Math.round)};for(var Q in this.gripCoords){b=this.gripCoords[Q];
-v[Q].setAttribute("x",b[0]);v[Q].setAttribute("y",b[1])}this.rotateCoords={nw:[u,s],ne:[u+L+8,s],sw:[u,s+R+8],se:[u+L+8,s+R+8]};for(Q in this.rotateCoords){b=this.rotateCoords[Q];p.rotateGrips[Q].setAttribute("cx",b[0]);p.rotateGrips[Q].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};
+"none"&&!isNaN(f))m+=f/2;var u=d.tagName;if(u==="text")m+=2/c;f=svgedit.transformlist.getTransformList(d);f=svgedit.math.transformListToTransform(f).matrix;f.e*=c;f.f*=c;var C=svgedit.utilities.getBBox(d);if(u==="g"&&!$.data(d,"gsvg"))if(u=a.getStrokedBBox(d.childNodes))C=u;u=C.x;var s=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(u*c,s*c,L*c,C*c,f);f=c.aabox;u=f.x-m;s=f.y-m;L=f.width+m*2;var Q=f.height+m*2;f=u+L/2;C=s+Q/2;if(d=svgedit.utilities.getRotationAngle(d)){u=a.svgRoot().createSVGTransform();
+u.setRotate(-d,f,C);u=u.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,u);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,u);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,u);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,u);u=c.tl;L=u.x;Q=u.y;var K=u.x,H=u.y;u=Math.min;s=Math.max;L=u(L,u(c.tr.x,u(c.bl.x,c.br.x)))-m;Q=u(Q,u(c.tr.y,u(c.bl.y,c.br.y)))-m;K=s(K,s(c.tr.x,s(c.bl.x,c.br.x)))+m;H=s(H,s(c.tr.y,s(c.bl.y,c.br.y)))+m;u=L;s=Q;L=K-L;Q=H-Q}m=a.svgRoot().suspendRedraw(100);b.setAttribute("d",
+"M"+u+","+s+" L"+(u+L)+","+s+" "+(u+L)+","+(s+Q)+" "+u+","+(s+Q)+"z");this.selectorGroup.setAttribute("transform",d?"rotate("+[d,f,C].join(",")+")":"");if(svgedit.browser.isTouch()){u-=15.75;s-=15.75}else{u-=4;s-=4}this.gripCoords={nw:[u,s].map(Math.round),ne:[u+L,s].map(Math.round),sw:[u,s+Q].map(Math.round),se:[u+L,s+Q].map(Math.round),n:[u+L/2,s].map(Math.round),w:[u,s+Q/2].map(Math.round),e:[u+L,s+Q/2].map(Math.round),s:[u+L/2,s+Q].map(Math.round)};for(var S in this.gripCoords){b=this.gripCoords[S];
+v[S].setAttribute("x",b[0]);v[S].setAttribute("y",b[1])}this.rotateCoords={nw:[u,s],ne:[u+L+8,s],sw:[u,s+Q+8],se:[u+L+8,s+Q+8]};for(S in this.rotateCoords){b=this.rotateCoords[S];p.rotateGrips[S].setAttribute("cx",b[0]);p.rotateGrips[S].setAttribute("cy",b[1])}a.svgRoot().unsuspendRedraw(m)};svgedit.select.SelectorManager=function(){this.rubberBandBox=this.selectorParentGroup=null;this.selectors=[];this.selectorMap={};this.selectorGrips={nw:null,n:null,ne:null,e:null,se:null,s:null,sw:null,w:null};
this.selectorGripsGroup=null;this.rotateGrips={nw:null,ne:null,se:null,sw:null};this.initGroup()};svgedit.select.SelectorManager.prototype.initGroup=function(){this.selectorParentGroup&&this.selectorParentGroup.parentNode&&this.selectorParentGroup.parentNode.removeChild(this.selectorParentGroup);this.selectorParentGroup=a.createSVGElement({element:"g",attr:{id:"selectorParentGroup"}});this.selectorGripsGroup=a.createSVGElement({element:"g",attr:{display:"none"}});this.selectorParentGroup.appendChild(this.selectorGripsGroup);
a.svgRoot().appendChild(this.selectorParentGroup);this.selectorMap={};this.selectors=[];this.rubberBandBox=null;for(var b in this.rotateGrips){var p=a.createSVGElement({element:"circle",attr:{id:"selectorGrip_rotate_"+b,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+q.imgPath+"rotate.png) 12 12, auto;"}});$.data(p,"dir",b);$.data(p,"type","rotate");this.rotateGrips[b]=this.selectorGripsGroup.appendChild(p)}for(b in this.selectorGrips){p=a.createSVGElement({element:"rect",
attr:{id:"selectorGrip_resize_"+b,width:8,height:8,fill:"#4F80FF",stroke:"rgba(0,0,0,0)","stroke-width":1,style:"cursor:"+b+"-resize","pointer-events":"all"}});if(svgedit.browser.isTouch()){p.setAttribute("width",30.5);p.setAttribute("height",30.5);p.setAttribute("fill-opacity",0.3)}$.data(p,"dir",b);$.data(p,"type","resize");this.selectorGrips[b]=this.selectorGripsGroup.appendChild(p)}if(!$("#canvasBackground").length){b=q.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",
@@ -171,11 +171,11 @@ return m};svgedit.path.addPointGrip=function(f,c,m){var u=svgedit.path.getGripCo
C=u.appendChild(C);$("#pathpointgrip_"+f).dblclick(function(){svgedit.path.path&&svgedit.path.path.setSegType()})}if(c&&m)svgedit.utilities.assignAttributes(C,{x:c-(svgedit.browser.isTouch()?15:2.5),y:m-(svgedit.browser.isTouch()?15:2.5),display:"inline"});return C};svgedit.path.getGripContainer=function(){var f=svgedit.utilities.getElem("pathpointgrip_container");if(!f){f=svgedit.utilities.getElem("selectorParentGroup").appendChild(document.createElementNS("http://www.w3.org/2000/svg","g"));f.id=
"pathpointgrip_container"}return f};svgedit.path.addCtrlGrip=function(f){var c=svgedit.utilities.getElem("ctrlpointgrip_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","circle");svgedit.utilities.assignAttributes(c,{id:"ctrlpointgrip_"+f,display:"none",r:svgedit.browser.isTouch()?15:3,fill:"#4F80FF",cursor:"move",style:"pointer-events:all","xlink:title":a.pathCtrlPtTooltip});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getCtrlLine=function(f){var c=
svgedit.utilities.getElem("ctrlLine_"+f);if(c)return c;c=document.createElementNS("http://www.w3.org/2000/svg","line");svgedit.utilities.assignAttributes(c,{id:"ctrlLine_"+f,stroke:"#4F80FF","stroke-width":1,style:"pointer-events:none"});svgedit.path.getGripContainer().appendChild(c);return c};svgedit.path.getPointGrip=function(f,c){var m=svgedit.path.addPointGrip(f.index);if(c){var u=svgedit.path.getGripPt(f);svgedit.utilities.assignAttributes(m,{x:u.x-(svgedit.browser.isTouch()?15:2.5),y:u.y-(svgedit.browser.isTouch()?
-15:2.5),display:"inline"})}return m};svgedit.path.getControlPoints=function(f){var c=f.item,m=f.index;if(!("x1"in c)||!("x2"in c))return null;var u={};svgedit.path.getGripContainer();for(var C=[svgedit.path.path.segs[m-1].item,c],s=1;s<3;s++){var L=m+"c"+s,R=u["c"+s+"_line"]=svgedit.path.getCtrlLine(L),K=svgedit.path.getGripPt(f,{x:c["x"+s],y:c["y"+s]}),I=svgedit.path.getGripPt(f,{x:C[s-1].x,y:C[s-1].y});svgedit.utilities.assignAttributes(R,{x1:K.x,y1:K.y,x2:I.x,y2:I.y,display:"inline"});u["c"+s+
-"_line"]=R;pointGrip=u["c"+s]=svgedit.path.addCtrlGrip(L);svgedit.utilities.assignAttributes(pointGrip,{cx:K.x,cy:K.y,display:"inline"});u["c"+s]=pointGrip}return u};svgedit.path.replacePathSeg=function(f,c,m,u){u=u||svgedit.path.path.elem;f=u["createSVGPathSeg"+g[f]].apply(u,m);if(svgedit.browser.supportsPathReplaceItem())u.pathSegList.replaceItem(f,c);else{m=u.pathSegList;u=m.numberOfItems;for(var C=[],s=0;s0){f=R0){f=Q element";this.elem=f;this.segs=[];this.selected_pts=[];svgedit.path.path=this;this.init()};svgedit.path.Path.prototype.init=function(){$(svgedit.path.getGripContainer()).find("*").attr("display","none");var f=this.elem.pathSegList,c=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var m=0;m=c?null:f[m+1],L=m-1<0?null:f[m-1];if(C.type===2){if(L&&L.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip()}u=m}else if(s&&s.type===1){C.next=f[u+1];C.next.prev=C;C.mate=f[u];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(s){if(C.type!==1){C.addGrip();if(s&&s.type!==2){C.next=s;C.next.prev=C}}}else if(C.type!==1){s=f[u];s.next=f[u+1];s.next.prev=s;s.addGrip();C.addGrip();if(!this.first_seg)this.first_seg=
-f[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var c=this.segs.length,m=0;m').documentElement,
true);a.appendChild(c);var m=f.createElementNS(b,"svg");(d.clearSvgContentElement=function(){for(;m.firstChild;)m.removeChild(m.firstChild);$(m).attr({id:"svgcontent",width:v[0],height:v[1],x:v[0],y:v[1],overflow:p.show_outside_canvas?"visible":"hidden",xmlns:b,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(c);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var u="svg_";d.setIdPrefix=
-function(e){u=e};d.current_drawing_=new svgedit.draw.Drawing(m,u);var C=d.getCurrentDrawing=function(){return d.current_drawing_},s=1,L=null,R={shape:{fill:(p.initFill.color=="none"?"":"#")+p.initFill.color,fill_paint:null,fill_opacity:p.initFill.opacity,stroke:"#"+p.initStroke.color,stroke_paint:null,stroke_opacity:p.initStroke.opacity,stroke_width:p.initStroke.width,stroke_dasharray:"none",opacity:p.initOpacity}};R.text=$.extend(true,{},R.shape);$.extend(R.text,{fill:"#000000",stroke_width:0,font_size:24,
-font_family:"Helvetica, Arial, sans-serif"});var K=R.shape,I=Array(1),Q=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=C().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(l)(L||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:K.fill,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,"stroke-opacity":K.stroke_opacity,"fill-opacity":K.fill_opacity,
-opacity:K.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},S=d.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=d.matrixMultiply=svgedit.math.matrixMultiply,na=d.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=d.transformListToTransform=svgedit.math.transformListToTransform,U=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit},
-getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/s},getWidth:function(){return m.getAttribute("width")/s},getRoundDigits:function(){return $a.round_digits}});var Aa=d.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return c},getSelectedElements:function(){return I},getSVGContent:function(){return m}});var ja=d.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,
-ba=d.getHref=svgedit.utilities.getHref,T=d.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;d.getBBox=svgedit.utilities.getBBox;var oa=d.getRotationAngle=svgedit.utilities.getRotationAngle,pa=d.getElem=svgedit.utilities.getElem,ma=d.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,xa=svgedit.sanitize.getNSMap(),ya=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ha=svgedit.history.InsertElementCommand,
+function(e){u=e};d.current_drawing_=new svgedit.draw.Drawing(m,u);var C=d.getCurrentDrawing=function(){return d.current_drawing_},s=1,L=null,Q={shape:{fill:(p.initFill.color=="none"?"":"#")+p.initFill.color,fill_paint:null,fill_opacity:p.initFill.opacity,stroke:"#"+p.initStroke.color,stroke_paint:null,stroke_opacity:p.initStroke.opacity,stroke_width:p.initStroke.width,stroke_dasharray:"none",opacity:p.initOpacity}};Q.text=$.extend(true,{},Q.shape);$.extend(Q.text,{fill:"#000000",stroke_width:0,font_size:24,
+font_family:"Helvetica, Arial, sans-serif"});var K=Q.shape,H=Array(1),S=this.addSvgElementFromJson=function(e){var h=svgedit.utilities.getElem(e.attr.id),l=C().getCurrentLayer();if(h&&e.element!=h.tagName){l.removeChild(h);h=null}if(!h){h=f.createElementNS(b,e.element);if(l)(L||l).appendChild(h)}e.curStyles&&svgedit.utilities.assignAttributes(h,{fill:K.fill,stroke:K.stroke,"stroke-width":K.stroke_width,"stroke-dasharray":K.stroke_dasharray,"stroke-opacity":K.stroke_opacity,"fill-opacity":K.fill_opacity,
+opacity:K.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,e.attr,100);svgedit.utilities.cleanupElement(h);return h},R=d.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=d.matrixMultiply=svgedit.math.matrixMultiply,oa=d.hasMatrixTransform=svgedit.math.hasMatrixTransform,X=d.transformListToTransform=svgedit.math.transformListToTransform,U=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit},
+getElement:svgedit.utilities.getElem,getHeight:function(){return m.getAttribute("height")/s},getWidth:function(){return m.getAttribute("width")/s},getRoundDigits:function(){return $a.round_digits}});var Aa=d.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return c},getSelectedElements:function(){return H},getSVGContent:function(){return m}});var ja=d.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,
+ba=d.getHref=svgedit.utilities.getHref,T=d.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;d.getBBox=svgedit.utilities.getBBox;var na=d.getRotationAngle=svgedit.utilities.getRotationAngle,pa=d.getElem=svgedit.utilities.getElem,ma=d.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,xa=svgedit.sanitize.getNSMap(),ya=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ha=svgedit.history.InsertElementCommand,
Ga=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Ca=svgedit.history.BatchCommand;d.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,h){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)d.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var B=h.elements();d.pathActions.clear();M("changed",B);B=h.type();l=e==l.AFTER_APPLY;if(B==Ja.type()){l=l?h.newParent:h.oldParent;l==m&&d.identifyLayers()}else if(B==
Ha.type()||B==Ga.type()){h.parent==m&&d.identifyLayers();if(B==Ha.type())l&&Ta(h.elem);else l||Ta(h.elem);h.elem.tagName==="use"&&Gb(h.elem)}else if(B==Ma.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==m&&d.identifyLayers();l=l?h.newValues:h.oldValues;l.stdDeviation&&d.setBlurOffsets(h.elem.parentNode,l.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){B=h.elem;if(!B.getAttribute("x")&&!B.getAttribute("y")){l=B.parentNode;var A=B.nextSibling;l.removeChild(B);l.insertBefore(B,
A)}}}}}});var wa=function(e){d.undoMgr.addCommandToHistory(e)};svgedit.select.init(p,{createSVGElement:function(e){return d.addSvgElementFromJson(e)},svgRoot:function(){return c},svgContent:function(){return m},currentZoom:function(){return s},getStrokedBBox:function(e){return d.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return s},getSVGRoot:function(){return c}});svgedit.utilities.snapToGrid=function(e){var h=
p.snappingStep,l=p.baseUnit;if(l!=="px")h*=svgedit.units.getTypeMap()[l];return e=Math.round(e/h)*h};var va=svgedit.utilities.snapToGrid,kb={exportNoBlur:"Blurred elements will appear as un-blurred",exportNoforeignObject:"foreignObject elements will not appear",exportNoDashArray:"Strokes will appear filled",exportNoText:"Text may not appear as expected"},vb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],cb=$.data,Ta=function(e){var h=$(e).attr(vb),l;for(l in h){var B=
-h[l];if(B&&B.indexOf("url(")===0){B=ja(B).substr(1);if(!pa(B)){gb().appendChild(sb[B]);delete sb[B]}}}e=e.getElementsByTagName("*");if(e.length){h=0;for(l=e.length;h=0)n=o=d.convertToPath(k,true);else if(k.tagName=="rect"){var w=k.getAttribute("rx"),E=k.getAttribute("ry");if(w||E)n=o=d.convertToPath(k,true)}if(!o){var H=k.cloneNode(true),J=document.createElementNS(b,"g"),O=k.parentNode;O.appendChild(J);J.appendChild(H);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(Y){console.log(k,Y);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)});if(l==null)return null;
+"path","line","polyline","polygon"].indexOf(k.tagName)>=0)n=o=d.convertToPath(k,true);else if(k.tagName=="rect"){var w=k.getAttribute("rx"),E=k.getAttribute("ry");if(w||E)n=o=d.convertToPath(k,true)}if(!o){var I=k.cloneNode(true),J=document.createElementNS(b,"g"),O=k.parentNode;O.appendChild(J);J.appendChild(I);n=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return n}catch(Y){console.log(k,Y);return null}},l;$.each(e,function(){if(!l)if(this.parentNode)l=h(this)});if(l==null)return null;
var B=l.x+l.width,A=l.y+l.height,G=l.x,D=l.y,z=function(k){var n=k.getAttribute("stroke-width"),o=0;if(k.getAttribute("stroke")!="none"&&!isNaN(n))o+=n/2;return o},F=[];$.each(e,function(k,n){var o=h(n);if(o){var w=z(n);G=Math.min(G,o.x-w);D=Math.min(D,o.y-w);F.push(o)}});l.x=G;l.y=D;$.each(e,function(k,n){var o=F[k];if(o&&n.nodeType==1){var w=z(n);B=Math.max(B,o.x+o.width+w);A=Math.max(A,o.y+o.height+w)}});l.width=B-G;l.height=A-D;return l};var pb=this.getVisibleElements=function(e){e||(e=$(m).children());
e.find("#canvas_background").length&&e.splice(0,1);var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push(B)}catch(A){}});return h.reverse()},fb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(m).children());var h=[];$(e).children().each(function(l,B){try{B.getBBox()&&h.push({elem:B,bbox:getStrokedBBox([B])})}catch(A){}});return h.reverse()},tb=this.groupSvgElem=function(e){var h=document.createElementNS(b,"g");e.parentNode.replaceChild(h,e);$(h).append(e).data("gsvg",e)[0].id=ka()},
ia=function(e){var h=document.createElementNS(e.namespaceURI,e.nodeName);h.removeAttribute("id");$.each(e.attributes,function(B,A){A.localName!="-moz-math-font-style"&&h.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName=="path"){var l=La.convertPath(e);h.setAttribute("d",l)}$.each(e.childNodes,function(B,A){switch(A.nodeType){case 1:h.appendChild(ia(A));break;case 3:h.textContent=A.nodeValue}});if($(e).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(e).data("symbol")){e=
$(e).data("symbol");$(h).data("ref",e).data("symbol",e)}else h.tagName=="image"&&Fb(h);h.id=ka();return h},aa,ka,M;(function(e){var h={};aa=e.getId=function(){return C().getId()};ka=e.getNextId=function(){return C().getNextId()};M=e.call=function(l,B){if(h[l])return h[l](this,B)};e.bind=function(l,B){var A=h[l];h[l]=B;return A}})(d);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var h=0,l=e.length;h0&&A.getItem(0).type==
-4&&A.removeItem(0);if(e!=0){G=N(G,D,X(A).matrix);D=c.createSVGTransform();D.setRotate(e,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&l.removeAttribute("transform");if(!h){A=l.getAttribute("transform");l.setAttribute("transform",B);Ya("transform",A,I);M("changed",I)}pa("pathpointgrip_container");l=ra.requestSelector(I[0]);l.resize();l.updateGripCursors(e)}};var Da=this.recalculateAllSelectedDimensions=function(){for(var e=new Ca(db=="none"?"position":"size"),
-h=I.length;h--;){var l=Ra(I[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){wa(e);M("changed",I)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Za=this.remapElement=function(e,h,l){var B=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var o in h)h[o]=va(h[o]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=e.getAttribute(D);if(z&&
+La.fixEnd(B)}};var P=this.getRefElem=function(e){return pa(ja(e).substr(1))},ca=function(e){if(!svgedit.browser.isGecko())return e;var h=e.cloneNode(true);e.parentNode.insertBefore(h,e);e.parentNode.removeChild(e);ra.releaseSelector(e);H[0]=h;ra.requestSelector(h).showGrips(true);return h};this.setRotationAngle=function(e,h){e=parseFloat(e);var l=H[0];if(l){var B=l.getAttribute("transform"),A=svgedit.utilities.getBBox(l),G=A.x+A.width/2,D=A.y+A.height/2;A=R(l);A.numberOfItems>0&&A.getItem(0).type==
+4&&A.removeItem(0);if(e!=0){G=N(G,D,X(A).matrix);D=c.createSVGTransform();D.setRotate(e,G.x,G.y);A.numberOfItems?A.insertItemBefore(D,0):A.appendItem(D)}else A.numberOfItems==0&&l.removeAttribute("transform");if(!h){A=l.getAttribute("transform");l.setAttribute("transform",B);Ya("transform",A,H);M("changed",H)}pa("pathpointgrip_container");l=ra.requestSelector(H[0]);l.resize();l.updateGripCursors(e)}};var Da=this.recalculateAllSelectedDimensions=function(){for(var e=new Ca(db=="none"?"position":"size"),
+h=H.length;h--;){var l=Ra(H[h]);l&&e.addSubCommand(l)}if(!e.isEmpty()){wa(e);M("changed",H)}},Oa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],Wa=function(e){console.log([e.a,e.b,e.c,e.d,e.e,e.f])},Za=this.remapElement=function(e,h,l){var B=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(B)for(var o in h)h[o]=va(h[o]);ma(e,h,1E3,true)};box=svgedit.utilities.getBBox(e);for(var G=0;G<2;G++){var D=G===0?"fill":"stroke",z=e.getAttribute(D);if(z&&
z.indexOf("url(")===0)if(l.a<0||l.d<0){z=P(z).cloneNode(true);if(l.a<0){var F=z.getAttribute("x1"),k=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(k-1))}if(l.d<0){F=z.getAttribute("y1");k=z.getAttribute("y2");z.setAttribute("y1",-(F-1));z.setAttribute("y2",-(k-1))}z.id=ka();gb().appendChild(z);e.setAttribute(D,"url(#"+z.id+")")}}G=e.tagName;if(G==="g"||G==="text"||G==="use")if(l.a==1&&l.b==0&&l.c==0&&l.d==1&&(l.e!=0||l.f!=0)){D=X(e).matrix;D=ga(D.inverse(),l,D);h.x=parseFloat(h.x)+
-D.e;h.y=parseFloat(h.y)+D.f}else{D=S(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(l.a<0||l.d<0)){D=S(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx,
+D.e;h.y=parseFloat(h.y)+D.f}else{D=R(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}switch(G){case "foreignObject":case "rect":case "image":if(G==="image"&&(l.a<0||l.d<0)){D=R(e);z=c.createSVGTransform();z.setMatrix(ga(X(D).matrix,l));D.clear();D.appendItem(z)}else{D=N(h.x,h.y,l);h.width=l.a*h.width;h.height=l.d*h.height;h.x=D.x+Math.min(0,h.width);h.y=D.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}A();break;case "ellipse":G=N(h.cx,
h.cy,l);h.cx=G.x;h.cy=G.y;h.rx=l.a*h.rx;h.ry=l.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry);A();break;case "circle":G=N(h.cx,h.cy,l);h.cx=G.x;h.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);h.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/2);if(h.r)h.r=Math.abs(h.r);A();break;case "line":D=N(h.x1,h.y1,l);F=N(h.x2,h.y2,l);h.x1=D.x;h.y1=D.y;h.x2=F.x;h.y2=F.y;case "text":l=e.querySelectorAll("tspan");for(G=l.length;G--;){D=Aa("x",e.getAttribute("x"));z=Aa("x",l[G].getAttribute("x"));
F=Aa("y",e.getAttribute("y"));k=Aa("y",l[G].getAttribute("y"));var n={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&h.x)n.x=h.x-(D-z);if(!isNaN(F)&&!isNaN(k)&&F!=0&&k!=0&&h.y)n.y=h.y-(F-k);if(n.x||n.y)ma(l[G],n,1E3,true)}A();break;case "use":A();break;case "g":(A=$(e).data("gsvg"))&&ma(A,h,1E3,true);break;case "polyline":case "polygon":A=h.points.length;for(G=0;G0){for(var l=h.numberOfItems;l--;){var B=h.getItem(l);if(B.type===0)h.removeItem(l);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(l);else B.type===
-4&&B.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&oa(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var A=[];l--;){B=h.getItem(l);if(B.type===1)A.push([B.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=c.createSVGTransformFromMatrix(ga(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(l,A[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l-2).type===1&&h.getItem(l-1).type===2){A=c.createSVGTransform();
+" "+ +z.sweepFlag+" "+z.x+","+z.y+" ";break;case 17:case 16:l+=z.x2+","+z.y2+" "+z.x+","+z.y+" "}}e.setAttribute("d",l)}},nb=function(e,h,l){e=P(e).firstChild;var B=R(e),A=c.createSVGTransform();A.setTranslate(h,l);B.appendItem(A);Ra(e)},Ra=this.recalculateDimensions=function(e){if(e==null)return null;var h=R(e);if(h&&h.numberOfItems>0){for(var l=h.numberOfItems;l--;){var B=h.getItem(l);if(B.type===0)h.removeItem(l);else if(B.type===1)svgedit.math.isIdentity(B.matrix)&&h.removeItem(l);else B.type===
+4&&B.angle===0&&h.removeItem(l)}if(h.numberOfItems===1&&na(e))return null}if(!h||h.numberOfItems==0){e.removeAttribute("transform");return null}if(h){l=h.numberOfItems;for(var A=[];l--;){B=h.getItem(l);if(B.type===1)A.push([B.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=c.createSVGTransformFromMatrix(ga(A[1][0],A[0][0]));h.removeItem(A[0][1]);h.removeItem(A[1][1]);h.insertItemBefore(l,A[1][1])}l=h.numberOfItems;if(l>=2&&h.getItem(l-2).type===1&&h.getItem(l-1).type===2){A=c.createSVGTransform();
B=ga(h.getItem(l-2).matrix,h.getItem(l-1).matrix);A.setMatrix(B);h.removeItem(l-2);h.removeItem(l-2);h.appendItem(A)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(h.numberOfItems===1&&h.getItem(0).type===1||h.numberOfItems===2&&h.getItem(0).type===1&&h.getItem(0).type===4)return null}var G=$(e).data("gsvg");l=new Ca("Transform");var D={},z=null;B=[];switch(e.tagName){case "line":B=["x1","y1","x2","y2"];break;case "circle":B=["cx","cy","r"];break;case "ellipse":B=
["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":B=["width","height","x","y"];break;case "use":case "text":case "tspan":B=["x","y"];break;case "polygon":case "polyline":z={};z.points=e.getAttribute("points");A=e.points;var F=A.numberOfItems;D.points=Array(F);for(var k=0;k1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var J=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,Y=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var da=F.item(n);B=G=0;if(da.nodeType==1){var V=S(da);if(V){B=X(V).matrix;G=oa(da);var fa=Sa,ha=[];Sa=da.getAttribute("transform");if(G||na(V)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,Y,B));V.clear();V.appendItem(W);
+{x:$(G).attr("x")||0,y:$(G).attr("y")||0};if(z==null){z=$.extend(true,{},D);$.each(z,function(Ba,Pa){z[Ba]=Aa(Ba,Pa)})}z.transform=Sa?Sa:"";if(e.tagName=="g"&&!G||e.tagName=="a"){A=svgedit.utilities.getBBox(e);var o={x:A.x+A.width/2,y:A.y+A.height/2},w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);B=c.createSVGMatrix();if(A=na(e)){k=A*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;var J=h.getItem(E-3).matrix,O=h.getItem(E-2).matrix,Y=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var da=F.item(n);B=G=0;if(da.nodeType==1){var V=R(da);if(V){B=X(V).matrix;G=na(da);var fa=Sa,ha=[];Sa=da.getAttribute("transform");if(G||oa(V)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,Y,B));V.clear();V.appendItem(W);
ha.push(W)}else{G=ga(B.inverse(),Y,B);W=c.createSVGMatrix();W.e=-G.e;W.f=-G.f;B=ga(W.inverse(),B.inverse(),J,O,Y,B,G.inverse());var qa=c.createSVGTransform(),ua=c.createSVGTransform(),za=c.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(B.a,B.d);za.setTranslate(W.e,W.f);V.appendItem(za);V.appendItem(ua);V.appendItem(qa);ha.push(za);ha.push(ua);ha.push(qa)}l.addSubCommand(Ra(da));Sa=fa}}}h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E>=3&&h.getItem(E-1).type==1){k=3;B=X(h).matrix;
-W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W)}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ga(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=e.childNodes;n=F.length;for(E=[];n--;){da=F.item(n);if(da.nodeType==1){if(da.getAttribute("clip-path")){fa=da.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=da.getAttribute("transform");if(V=S(da)){J=c.createSVGTransform();J.setTranslate(G,
-B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);l.addSubCommand(Ra(da));V=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(J=V.length;J--;){O=V.item(J);if(da==ba(O)){Y=c.createSVGTransform();Y.setTranslate(-G,-B);S(O).insertItemBefore(Y,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&h.getItem(0).type==1&&!A){k=1;B=h.getItem(0).matrix;F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");if(V=S(da)){G=ga(B,X(V).matrix);
-E=c.createSVGTransform();E.setMatrix(G);V.clear();V.appendItem(E,0);l.addSubCommand(Ra(da));Sa=fa;fa=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(fa)&&da.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){w={x:o.x+H.e,y:o.y+H.f};o=c.createSVGTransform();
-o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=X(h).matrix;H=c.createSVGTransform();H.setRotate(A,o.x,o.y);H=H.matrix;o=c.createSVGTransform();o.setRotate(A,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,H,B);G=w.e;B=w.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");V=S(da);J=c.createSVGTransform();J.setTranslate(G,B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);
-l.addSubCommand(Ra(da));Sa=fa}}}if(A)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;B=c.createSVGMatrix();if(G=oa(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E-
-1).type==1){k=3;B=X(h).matrix;W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W);B=c.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;H=h.getItem(0).matrix;fa=X(h,1).matrix;A=fa.inverse();B=ga(A,H,fa);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(e.tagName){case "line":D=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=e.getAttribute("points");if(D.points){A=e.points;F=A.numberOfItems;D.points=
-Array(F);for(k=0;k1&&A.showGrips(false)}}}M("selected",I);h||I.length==1?ra.requestSelector(I[0]).showGrips(true):ra.requestSelector(I[0]).showGrips(false);for(I.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3-
-(D.compareDocumentPosition(G)&6);else if(G==null)return 1});I[0]==null;)I.shift(0)}},rb=this.selectOnly=function(e,h){Ia(true);qb(e,h)};this.removeFromSelection=function(e){if(I[0]!=null)if(e.length!=0){var h=Array(I.length);j=0;len=I.length;for(var l=0;l1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;G=X(h).matrix;h.removeItem(0);B=X(h).matrix.inverse();B=ga(B,G);G=B.e;B=B.f;if(G!=0||B!=0){F=e.childNodes;n=F.length;for(E=[];n--;){da=F.item(n);if(da.nodeType==1){if(da.getAttribute("clip-path")){fa=da.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=da.getAttribute("transform");if(V=R(da)){J=c.createSVGTransform();J.setTranslate(G,
+B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);l.addSubCommand(Ra(da));V=e.getElementsByTagNameNS(b,"use");da="#"+da.id;for(J=V.length;J--;){O=V.item(J);if(da==ba(O)){Y=c.createSVGTransform();Y.setTranslate(-G,-B);R(O).insertItemBefore(Y,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&h.getItem(0).type==1&&!A){k=1;B=h.getItem(0).matrix;F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");if(V=R(da)){G=ga(B,X(V).matrix);
+E=c.createSVGTransform();E.setMatrix(G);V.clear();V.appendItem(E,0);l.addSubCommand(Ra(da));Sa=fa;fa=da.getAttribute("stroke-width");da.getAttribute("stroke")!=="none"&&!isNaN(fa)&&da.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){w={x:o.x+I.e,y:o.y+I.f};o=c.createSVGTransform();
+o.setRotate(A,w.x,w.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=X(h).matrix;I=c.createSVGTransform();I.setRotate(A,o.x,o.y);I=I.matrix;o=c.createSVGTransform();o.setRotate(A,w.x,w.y);w=o.matrix.inverse();fa=B.inverse();w=ga(fa,w,I,B);G=w.e;B=w.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){da=F.item(n);if(da.nodeType==1){fa=Sa;Sa=da.getAttribute("transform");V=R(da);J=c.createSVGTransform();J.setTranslate(G,B);V.numberOfItems?V.insertItemBefore(J,0):V.appendItem(J);
+l.addSubCommand(Ra(da));Sa=fa}}}if(A)h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;B=c.createSVGMatrix();if(G=na(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};w=N(A.x+A.width/2,A.y+A.height/2,X(h).matrix);k=G*Math.PI/180;F=Math.abs(k)>1.0E-10?Math.sin(k)/(1-Math.cos(k)):2/k;for(k=0;k=3&&h.getItem(E-2).type==3&&h.getItem(E-3).type==2&&h.getItem(E-1).type==2){k=3;B=X(h,E-3,E-1).matrix;h.removeItem(E-1);h.removeItem(E-2);h.removeItem(E-3)}else if(E==4&&h.getItem(E-
+1).type==1){k=3;B=X(h).matrix;W=c.createSVGTransform();W.setMatrix(B);h.clear();h.appendItem(W);B=c.createSVGMatrix()}else if((E==1||E>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){k=2;I=h.getItem(0).matrix;fa=X(h,1).matrix;A=fa.inverse();B=ga(A,I,fa);h.removeItem(0)}else if(E==1&&h.getItem(0).type==1&&!G){B=X(h).matrix;switch(e.tagName){case "line":D=$(e).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":D.points=e.getAttribute("points");if(D.points){A=e.points;F=A.numberOfItems;D.points=
+Array(F);for(k=0;k1&&A.showGrips(false)}}}M("selected",H);h||H.length==1?ra.requestSelector(H[0]).showGrips(true):ra.requestSelector(H[0]).showGrips(false);for(H.sort(function(G,D){if(G&&D&&G.compareDocumentPosition)return 3-
+(D.compareDocumentPosition(G)&6);else if(G==null)return 1});H[0]==null;)H.shift(0)}},rb=this.selectOnly=function(e,h){Ia(true);qb(e,h)};this.removeFromSelection=function(e){if(H[0]!=null)if(e.length!=0){var h=Array(H.length);j=0;len=H.length;for(var l=0;l=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return c}var h=C().getCurrentLayer();if([c,a,m,h].indexOf(e)>=0)return c;if($(e).closest("#selectorParentGroup").length)return ra.selectorParentGroup;for(;e.parentNode!==(L||h);)e=e.parentNode;return e};(function(){var e=null,h=null,l=null,B=
-null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!d.spaceKey){var F=z.button===2;mb=m.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);z.preventDefault();if(F)Fa="select";n=n/s;k=k/s;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var w=B=h=n,E=A=l=k;if(p.gridSnapping){n=va(n);k=va(k);h=va(h);l=va(l)}if(o==ra.selectorParentGroup&&I[0]!=null){o=
-z.target;var H=cb(o,"type");if(H=="rotate"){Fa="rotate";current_rotate_mode=cb(o,"dir")}else if(H=="resize"){Fa="resize";db=cb(o,"dir")}o=I[0]}Sa=o.getAttribute("transform");H=S(o);switch(Fa){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=c){if(I.indexOf(o)==-1){z.shiftKey||Ia(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F1))if(Ka)if(!(z.button===
-1||d.spaceKey)){var F=I[0],k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);var o=pa(aa()),w=x=n/s,E=y=k/s;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Fa){case "select":if(I[0]!==null){w=x-h;var H=y-l;if(p.gridSnapping){w=va(w);H=va(H)}if(z.shiftKey){var J=U(h,l,x,y);x=J.x;y=J.y}if(w!=0||H!=0){E=I.length;for(var O=0;O0&&d.removeFromSelection(o);w.length>0&&qb(w);break;case "resize":o=S(F);w=(J=na(o))?G:svgedit.utilities.getBBox(F);E=w.x;O=w.y;var da=w.width,V=w.height;w=x-h;H=y-l;if(p.gridSnapping){w=va(w);H=va(H);V=va(V);da=va(da)}if(Y=oa(F)){var fa=Math.sqrt(w*w+H*H);H=Math.atan2(H,w)-Y*Math.PI/180;w=fa*Math.cos(H);H=fa*Math.sin(H)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)H=0;if(db.indexOf("e")==-1&&db.indexOf("w")==
--1)w=0;var ha=fa=0,W=V?(V+H)/V:1,qa=da?(da+w)/da:1;if(db.indexOf("n")>=0){W=V?(V-H)/V:1;ha=V}if(db.indexOf("w")>=0){qa=da?(da-w)/da:1;fa=da}w=c.createSVGTransform();H=c.createSVGTransform();da=c.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}w.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;H.setScale(qa,W);da.setTranslate(E+fa,O+ha);if(J){J=Y?1:0;o.replaceItem(w,2+J);o.replaceItem(H,1+J);o.replaceItem(da,0+J)}else{J=o.numberOfItems;o.replaceItem(da,
-J-3);o.replaceItem(H,J-2);o.replaceItem(w,J-1)}ra.requestSelector(F).resize();M("transition",I);break;case "zoom":w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=U(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(w);break;case "foreignObject":case "square":case "rect":case "image":w=
+null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!d.spaceKey){var F=z.button===2;mb=m.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);z.preventDefault();if(F)Fa="select";n=n/s;k=k/s;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var w=B=h=n,E=A=l=k;if(p.gridSnapping){n=va(n);k=va(k);h=va(h);l=va(l)}if(o==ra.selectorParentGroup&&H[0]!=null){o=
+z.target;var I=cb(o,"type");if(I=="rotate"){Fa="rotate";current_rotate_mode=cb(o,"dir")}else if(I=="resize"){Fa="resize";db=cb(o,"dir")}o=H[0]}Sa=o.getAttribute("transform");I=R(o);switch(Fa){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=c){if(H.indexOf(o)==-1){z.shiftKey||Ia(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F1))if(Ka)if(!(z.button===
+1||d.spaceKey)){var F=H[0],k=N(z.pageX,z.pageY,mb),n=k.x*(isBotchedZoom?1:s);k=k.y*(isBotchedZoom?1:s);var o=pa(aa()),w=x=n/s,E=y=k/s;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Fa){case "select":if(H[0]!==null){w=x-h;var I=y-l;if(p.gridSnapping){w=va(w);I=va(I)}if(z.shiftKey){var J=U(h,l,x,y);x=J.x;y=J.y}if(w!=0||I!=0){E=H.length;for(var O=0;O0&&d.removeFromSelection(o);w.length>0&&qb(w);break;case "resize":o=R(F);w=(J=oa(o))?G:svgedit.utilities.getBBox(F);E=w.x;O=w.y;var da=w.width,V=w.height;w=x-h;I=y-l;if(p.gridSnapping){w=va(w);I=va(I);V=va(V);da=va(da)}if(Y=na(F)){var fa=Math.sqrt(w*w+I*I);I=Math.atan2(I,w)-Y*Math.PI/180;w=fa*Math.cos(I);I=fa*Math.sin(I)}if(db.indexOf("n")==-1&&db.indexOf("s")==-1)I=0;if(db.indexOf("e")==-1&&db.indexOf("w")==
+-1)w=0;var ha=fa=0,W=V?(V+I)/V:1,qa=da?(da+w)/da:1;if(db.indexOf("n")>=0){W=V?(V-I)/V:1;ha=V}if(db.indexOf("w")>=0){qa=da?(da-w)/da:1;fa=da}w=c.createSVGTransform();I=c.createSVGTransform();da=c.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}w.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;I.setScale(qa,W);da.setTranslate(E+fa,O+ha);if(J){J=Y?1:0;o.replaceItem(w,2+J);o.replaceItem(I,1+J);o.replaceItem(da,0+J)}else{J=o.numberOfItems;o.replaceItem(da,
+J-3);o.replaceItem(I,J-2);o.replaceItem(w,J-1)}ra.requestSelector(F).resize();M("transition",H);break;case "zoom":w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=U(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(w);break;case "foreignObject":case "square":case "rect":case "image":w=
Math.abs(x-h);J=Math.abs(y-l);if(Fa=="square"||z.shiftKey){w=J=Math.max(w,J);E=hl?l+O:l-O}if(z.altKey){J=h;E=l;O=Math.abs(x-J);H=z.shiftKey?O:Math.abs(y-E)}o.setAttributeNS(null,"rx",O);o.setAttributeNS(null,"ry",H);o.setAttributeNS(null,"cx",J);o.setAttributeNS(null,"cy",E);window.opera||c.unsuspendRedraw(w);break;case "fhellipse":case "fhrect":D.minx=Math.min(w,D.minx);D.maxx=Math.max(w,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=
+2);w=null;window.opera||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);J=va(J);y=va(y);E=va(E)}O=Math.abs(h-J);I=Math.abs(l-E);if(z.shiftKey){I=O;E=y>l?l+O:l-O}if(z.altKey){J=h;E=l;O=Math.abs(x-J);I=z.shiftKey?O:Math.abs(y-E)}o.setAttributeNS(null,"rx",O);o.setAttributeNS(null,"ry",I);o.setAttributeNS(null,"cx",J);o.setAttributeNS(null,"cy",E);window.opera||c.unsuspendRedraw(w);break;case "fhellipse":case "fhrect":D.minx=Math.min(w,D.minx);D.maxx=Math.max(w,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=
Math.max(E,D.maxy);case "fhpath":e+=+w+","+E+" ";o.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=s;y*=s;if(p.gridSnapping){x=va(x);y=va(y);h=va(h);l=va(l)}if(z.shiftKey){if(J=svgedit.path.path){o=J.dragging?J.dragging[0]:h;J=J.dragging?J.dragging[1]:l}else{o=h;J=l}J=U(o,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){w*=s;E*=s;ma(sa,{x:Math.min(B*s,w),y:Math.min(A*s,E),width:Math.abs(w-B*s),height:Math.abs(E-A*s)},100)}La.mouseMove(z,x,y);break;case "textedit":x*=
s;y*=s;bb.mouseMove(n,k);break;case "rotate":w=svgedit.utilities.getBBox(F);J=w.x+w.width/2;E=w.y+w.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=w.x;O=w.y;if(current_rotate_mode=="nw")o=w.x+w.width;if(current_rotate_mode=="se")O=w.y+w.height;if(current_rotate_mode=="sw"){o=w.x+w.width;O=w.y+w.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;Y=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;Y+=compensation_angle;if(p.gridSnapping)Y=va(Y);if(z.shiftKey)Y=Math.round(Y/45)*45;d.setRotationAngle(Y<
--180?360+Y:Y,true);M("transition",I)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode;if(F!==L){var k=Bb(z),n=k.tagName;if(n==="text"&&Fa!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&oa(k)){Db(k);k=I[0];Ia(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false;
-window.removeEventListener("keyup",d.removeClones);I=I.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*s;k=k.y*s;var o=n/s,w=k/s,E=pa(aa()),H=false;Ka=false;switch(Fa){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Fa="select";case "select":if(I[0]!=null){if(I.length==1){n=I[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");
-Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Da();if(o!=B||w!=A){z=I.length;for(n=0;n=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);H=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);H=F.width!=0||F.height!=0||Fa==="image";break;case "circle":H=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);H=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-
-D.minx>0&&D.maxy-D.miny>0){E=Q({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);H=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=Q({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;H=F.keep;
-break;case "pathedit":H=true;E=null;La.mouseUp(z);break;case "textedit":H=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":H=true;E=null;Fa="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Da();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(Y,da){if(da){H=da.keep||H;E=da.element;Ka=da.started||Ka}});if(!H&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Fa!=
+-180?360+Y:Y,true);M("transition",H)}ib("mouseMove",{event:z,mouse_x:n,mouse_y:k,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode;if(F!==L){var k=Bb(z),n=k.tagName;if(n==="text"&&Fa!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(k,z.x,z.y)}if((n==="g"||n==="a")&&na(k)){Db(k);k=H[0];Ia(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===C().getCurrentLayer()||k===ra.selectorParentGroup||Kb(k)}}).mouseup(function(z){d.addClones=false;
+window.removeEventListener("keyup",d.removeClones);H=H.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var k=N(z.pageX,z.pageY,mb),n=k.x*s;k=k.y*s;var o=n/s,w=k/s,E=pa(aa()),I=false;Ka=false;switch(Fa){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Fa="select";case "select":if(H[0]!=null){if(H.length==1){n=H[0];switch(n.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill=n.getAttribute("fill");Xa.fill_opacity=n.getAttribute("fill-opacity");
+Xa.stroke=n.getAttribute("stroke");Xa.stroke_opacity=n.getAttribute("stroke-opacity");Xa.stroke_width=n.getAttribute("stroke-width");Xa.stroke_dasharray=n.getAttribute("stroke-dasharray");Xa.stroke_linejoin=n.getAttribute("stroke-linejoin");Xa.stroke_linecap=n.getAttribute("stroke-linecap")}if(n.tagName=="text"){Ua.font_size=n.getAttribute("font-size");Ua.font_family=n.getAttribute("font-family")}ra.requestSelector(n).showGrips(true)}Da();if(o!=B||w!=A){z=H.length;for(n=0;n=0?F.indexOf(",",o+1)>=0:F.indexOf(" ",F.indexOf(" ")+1)>=0)E=La.smoothPolylineIntoPath(E);break;case "line":F=$(E).attr(["x1","x2","y1","y2"]);I=F.x1!=F.x2||F.y1!=F.y2;break;case "foreignObject":case "square":case "rect":case "image":F=$(E).attr(["width","height"]);I=F.width!=0||F.height!=0||Fa==="image";break;case "circle":I=E.getAttribute("r")!=0;break;case "ellipse":F=$(E).attr(["rx","ry"]);I=F.rx!=null||F.ry!=null;break;case "fhellipse":if(D.maxx-
+D.minx>0&&D.maxy-D.miny>0){E=S({element:"ellipse",curStyles:true,attr:{cx:(D.minx+D.maxx)/2,cy:(D.miny+D.maxy)/2,rx:(D.maxx-D.minx)/2,ry:(D.maxy-D.miny)/2,id:aa()}});M("changed",[E]);I=true}break;case "fhrect":if(D.maxx-D.minx>0&&D.maxy-D.miny>0){E=S({element:"rect",curStyles:true,attr:{x:D.minx,y:D.miny,width:D.maxx-D.minx,height:D.maxy-D.miny,id:aa()}});M("changed",[E]);I=true}break;case "text":I=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,n,k);E=F.element;I=F.keep;
+break;case "pathedit":I=true;E=null;La.mouseUp(z);break;case "textedit":I=false;E=null;bb.mouseUp(z,n,k);break;case "rotate":I=true;E=null;Fa="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Da();M("changed",H)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(Y,da){if(da){I=da.keep||I;E=da.element;Ka=da.started||Ka}});if(!I&&E!=null){C().releaseId(aa());E.parentNode.removeChild(E);E=null;for(n=z.target;n.parentNode.parentNode.tagName=="g";)n=n.parentNode;if((Fa!=
"path"||!drawn_path)&&n.parentNode.id!="selectorParentGroup"&&n.id!="svgcanvas"&&n.id!="svgroot"){d.setMode("select");rb([n],true)}}else if(E!=null){d.addedNew=true;z=0.2;var J;if(false.beginElement&&E.getAttribute("opacity")!=K.opacity){J=$(false).clone().attr({to:K.opacity,dur:z}).appendTo(E);try{J[0].beginElement()}catch(O){}}else z=0;setTimeout(function(){J&&J.remove();E.setAttribute("opacity",K.opacity);E.setAttribute("style","pointer-events:inherit");la(E);if(Fa==="path")La.toEditMode(E);else p.selectNew&&
rb([E],true);wa(new Ha(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=m.getScreenCTM().inverse();var F=N(z.pageX,z.pageY,mb);F={x:F.x,y:F.y,width:0,height:0};if(z.wheelDelta)if(z.wheelDelta>=120)F.factor=2;else{if(z.wheelDelta<=-120)F.factor=0.5}else if(z.detail)if(z.detail>0)F.factor=0.5;else if(z.detail<0)F.factor=2;F.factor&&M("zoomed",F)}})})();var Fb=function(e){$(e).click(function(h){h.preventDefault()})},bb=d.textActions=
-function(){function e(V){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)V=0;else{if(k.selectionEnd!==k.selectionStart)return;V=k.selectionEnd}var ha;ha=E[V];fa||k.setSelectionRange(V,V);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}w||(w=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,H.y);ha=
-G(ha.x,H.y+H.height);ma(n,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function h(V,fa,ha){if(V===fa)e(fa);else{ha||k.setSelectionRange(V,fa);o=pa("text_selectblock");if(!o){o=document.createElementNS(b,"path");ma(o,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(o)}V=E[V];var W=E[fa];n.setAttribute("visibility","hidden");fa=G(V.x,H.y);ha=G(V.x+(W.x-V.x),H.y);var qa=G(V.x,
-H.y+H.height);V=G(V.x+(W.x-V.x),H.y+H.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+V.x+","+V.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(V,fa){var ha=c.createSVGPoint();ha.x=V;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(V<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];V>W.x+W.width/2&&ha++;return ha}function B(V,fa,ha){var W=k.selectionStart;V=l(V,fa);h(Math.min(W,V),Math.max(W,V),!ha)}function A(V,fa){var ha={x:V,y:fa};
+function(){function e(V){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)V=0;else{if(k.selectionEnd!==k.selectionStart)return;V=k.selectionEnd}var ha;ha=E[V];fa||k.setSelectionRange(V,V);n=pa("text_cursor");if(!n){n=document.createElementNS(b,"line");ma(n,{id:"text_cursor",stroke:"#333","stroke-width":1});n=pa("selectorParentGroup").appendChild(n)}w||(w=setInterval(function(){var W=n.getAttribute("display")==="none";n.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,I.y);ha=
+G(ha.x,I.y+I.height);ma(n,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function h(V,fa,ha){if(V===fa)e(fa);else{ha||k.setSelectionRange(V,fa);o=pa("text_selectblock");if(!o){o=document.createElementNS(b,"path");ma(o,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});pa("selectorParentGroup").appendChild(o)}V=E[V];var W=E[fa];n.setAttribute("visibility","hidden");fa=G(V.x,I.y);ha=G(V.x+(W.x-V.x),I.y);var qa=G(V.x,
+I.y+I.height);V=G(V.x+(W.x-V.x),I.y+I.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+V.x+","+V.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(V,fa){var ha=c.createSVGPoint();ha.x=V;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(V<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];V>W.x+W.width/2&&ha++;return ha}function B(V,fa,ha){var W=k.selectionStart;V=l(V,fa);h(Math.min(W,V),Math.max(W,V),!ha)}function A(V,fa){var ha={x:V,y:fa};
ha.x/=s;ha.y/=s;if(J){var W=N(ha.x,ha.y,J.inverse());ha.x=W.x;ha.y=W.y}return ha}function G(V,fa){var ha={x:V,y:fa};if(J){var W=N(ha.x,ha.y,J);ha.x=W.x;ha.y=W.y}ha.x*=s;ha.y*=s;return ha}function D(V){h(0,F.textContent.length);$(this).unbind(V)}function z(V){if(da&&F){var fa=N(V.pageX,V.pageY,mb);fa=A(fa.x*s,fa.y*s);fa=l(fa.x,fa.y);var ha=F.textContent,W=ha.substr(0,fa).replace(/[a-z0-9]+$/i,"").length;ha=ha.substr(fa).match(/^[a-z0-9]+/i);h(W,(ha?ha[0].length:0)+fa);$(V.target).click(D);setTimeout(function(){$(V.target).unbind("click",
-D)},300)}}var F,k,n,o,w,E=[],H,J,O,Y,da;return{select:function(V,fa,ha){F=V;bb.toEditMode(fa,ha)},start:function(V){F=V;bb.toEditMode()},mouseDown:function(V,fa,ha,W){V=A(ha,W);k.focus();e(l(V.x,V.y));O=ha;Y=W},mouseMove:function(V,fa){var ha=A(V,fa);B(ha.x,ha.y)},mouseUp:function(V,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);V.target!==F&&faO-2&&haY-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(V,fa){rb([F],false);da=false;Fa="textedit";ra.requestSelector(F).showGrips(false);
+D)},300)}}var F,k,n,o,w,E=[],I,J,O,Y,da;return{select:function(V,fa,ha){F=V;bb.toEditMode(fa,ha)},start:function(V){F=V;bb.toEditMode()},mouseDown:function(V,fa,ha,W){V=A(ha,W);k.focus();e(l(V.x,V.y));O=ha;Y=W},mouseMove:function(V,fa){var ha=A(V,fa);B(ha.x,ha.y)},mouseUp:function(V,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);V.target!==F&&faO-2&&haY-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(V,fa){rb([F],false);da=false;Fa="textedit";ra.requestSelector(F).showGrips(false);
ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(V,fa);e(l(ha.x,ha.y))}else e();setTimeout(function(){da=true},300)},toSelectMode:function(V){Fa="select";clearInterval(w);w=null;o&&$(o).attr("display","none");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(V){Ia();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&d.deleteSelectedElements();$(k).blur();F=false},setInputElem:function(V){k=V},clear:function(){Fa==
-"textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=I[0];ra.requestSelector(F).showGrips(false)}var V=F.textContent.length,fa=F.getAttribute("transform");H=svgedit.utilities.getBBox(F);J=fa?ea(F):null;E=Array(V);k.focus();$(F).unbind("dblclick",z).dblclick(z);if(!V)var ha={x:H.x+H.width/2,width:0};for(fa=0;fa=0&&this.selected_pts.push(F)}this.selected_pts.sort();z=this.selected_pts.length;for(D=Array(z);z--;){k=this.segs[this.selected_pts[z]];k.select(true);D[z]=k.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=h=null,G=false;return{mouseDown:function(D,z,F,k){if(Fa==="path"){mouse_x=F;mouse_y=k;k=mouse_x/s;z=mouse_y/s;F=pa("path_stretch_line");l=[k,z];if(p.gridSnapping){k=va(k);z=va(z);mouse_x=
-va(mouse_x);mouse_y=va(mouse_y)}if(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=pa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,w=6/s,E=false;o;){o--;var H=n.getItem(o),J=H.x;H=H.y;if(k>=J-w&&k<=J+w&&z>=H-w&&z<=H+w){E=true;break}}w=aa();svgedit.path.removePath_(w);w=pa(w);J=n.numberOfItems;if(E){if(o<=1&&J>=2){k=n.getItem(0).x;z=n.getItem(0).y;
+va(mouse_x);mouse_y=va(mouse_y)}if(!F){F=document.createElementNS(b,"path");ma(F,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});F=pa("selectorParentGroup").appendChild(F)}F.setAttribute("display","inline");var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,w=6/s,E=false;o;){o--;var I=n.getItem(o),J=I.x;I=I.y;if(k>=J-w&&k<=J+w&&z>=I-w&&z<=I+w){E=true;break}}w=aa();svgedit.path.removePath_(w);w=pa(w);J=n.numberOfItems;if(E){if(o<=1&&J>=2){k=n.getItem(0).x;z=n.getItem(0).y;
D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(k,z):A.createSVGPathSegCurvetoCubicAbs(k,z,D.x1/s,D.y1/s,k,z);k=A.createSVGPathSegClosePath();n.appendItem(D);n.appendItem(k)}else if(J<3)return n=false;$(F).remove();element=w;A=null;Ka=false;if(e){svgedit.path.path.matrix&&Za(w,{},svgedit.path.path.matrix.inverse());F=w.getAttribute("d");D=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",D+F);$(w).remove();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();
svgedit.path.path.init();La.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,Bb(D))){console.log("Clicked outside canvas");return false}n=A.pathSegList.numberOfItems;o=A.pathSegList.getItem(n-1);w=o.x;o=o.y;if(D.shiftKey){D=U(w,o,k,z);k=D.x;z=D.y}D=F.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(k),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(k),ab(z),D.x1/s,D.y1/s,D.x2/s,D.y2/s);A.pathSegList.appendItem(D);k*=s;z*=s;F.setAttribute("d",
-["M",k,z,k,z].join(" "));F=n;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,k,z)}}else{d_attr="M"+k+","+z+" ";A=Q({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();w=D.target.id;if(w.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(w.substr(14));
+["M",k,z,k,z].join(" "));F=n;if(e)F+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(F,k,z)}}else{d_attr="M"+k+","+z+" ";A=S({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});F.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));F=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(F,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();w=D.target.id;if(w.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(w.substr(14));
svgedit.path.path.dragging=[F,k];n=svgedit.path.path.segs[z];if(D.shiftKey)n.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!n.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(w.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[F,k];D=w.split("_")[1].split("c");z=D[0]-0;svgedit.path.path.selectPt(z,D[1]-0)}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox();
-ma(sa,{x:F*s,y:k*s,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;if(Fa==="path"){if(A){var k=A.pathSegList;D=k.numberOfItems-1;if(l){var n=svgedit.path.addCtrlGrip("1c1"),o=svgedit.path.addCtrlGrip("0c2");o.getAttribute("cx");o.getAttribute("cy");n.setAttribute("cx",z);n.setAttribute("cy",F);n.setAttribute("display","inline");n=l[0];var w=l[1];k.getItem(D);var E=n+(n-z/s),H=w+(w-F/s);o.setAttribute("cx",E*s);o.setAttribute("cy",H*s);o.setAttribute("display","inline");
-o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,x2:n*s,y2:w*s,display:"inline"});ma(J,{x1:E*s,y1:H*s,x2:n*s,y2:w*s,display:"inline"});if(D===0)B=[z,F];else{k=k.getItem(D-1);z=k.x;F=k.y;if(k.pathSegType===6){z+=z-k.x2;F+=F-k.y2}else if(B){z=B[0]/s;F=B[1]/s}svgedit.path.replacePathSeg(6,D,[n,w,z,F,E,H],A)}}else if(n=pa("path_stretch_line")){D=k.getItem(D);if(D.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(D.x+(D.x-D.x2))*s,(D.y+(D.y-D.y2))*s,z,F],n);else B?svgedit.path.replacePathSeg(6,
+ma(sa,{x:F*s,y:k*s,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;if(Fa==="path"){if(A){var k=A.pathSegList;D=k.numberOfItems-1;if(l){var n=svgedit.path.addCtrlGrip("1c1"),o=svgedit.path.addCtrlGrip("0c2");o.getAttribute("cx");o.getAttribute("cy");n.setAttribute("cx",z);n.setAttribute("cy",F);n.setAttribute("display","inline");n=l[0];var w=l[1];k.getItem(D);var E=n+(n-z/s),I=w+(w-F/s);o.setAttribute("cx",E*s);o.setAttribute("cy",I*s);o.setAttribute("display","inline");
+o=svgedit.path.getCtrlLine(1);var J=svgedit.path.getCtrlLine(2);ma(o,{x1:z,y1:F,x2:n*s,y2:w*s,display:"inline"});ma(J,{x1:E*s,y1:I*s,x2:n*s,y2:w*s,display:"inline"});if(D===0)B=[z,F];else{k=k.getItem(D-1);z=k.x;F=k.y;if(k.pathSegType===6){z+=z-k.x2;F+=F-k.y2}else if(B){z=B[0]/s;F=B[1]/s}svgedit.path.replacePathSeg(6,D,[n,w,z,F,E,I],A)}}else if(n=pa("path_stretch_line")){D=k.getItem(D);if(D.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(D.x+(D.x-D.x2))*s,(D.y+(D.y-D.y2))*s,z,F],n);else B?svgedit.path.replacePathSeg(6,
1,[z,F,B[0],B[1],z,F],n):svgedit.path.replacePathSeg(4,1,[z,F],n)}}}else if(svgedit.path.path.dragging){n=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);w=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);D=w.x-n.x;n=w.y-n.y;svgedit.path.path.dragging=[z,F];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(D,n):svgedit.path.path.movePts(D,n)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||
this.prev){var O=sa.getBBox(),Y=svgedit.path.getGripPt(this);O=svgedit.math.rectsIntersect(O,{x:Y.x,y:Y.y,width:0,height:0});this.select(O);O&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z){if(Fa==="path"){l=null;if(!A){z=pa(aa());Ka=false;B=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){var F=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)");
!D.shiftKey&&!G&&svgedit.path.path.selectPt(F)}else if(sa&&sa.getAttribute("display")!="none"){sa.setAttribute("display","none");sa.getAttribute("width")<=2&&sa.getAttribute("height")<=2&&La.toSelectMode(D.target)}else La.toSelectMode(D.target);G=false},toEditMode:function(D){svgedit.path.path=svgedit.path.getPath_(D);Fa="pathedit";Ia();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);e=false},toSelectMode:function(D){var z=D==svgedit.path.path.elem;
-Fa="select";svgedit.path.path.show(false);h=false;Ia();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Fa="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(h===D){La.toEditMode(D);Fa="pathedit"}else h=D},reorient:function(){var D=I[0];if(D)if(oa(D)!=0){var z=new Ca("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));
-Ia();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed",I)}},clear:function(){h=null;if(A){var D=pa(aa());$(pa("path_stretch_line")).remove();$(D).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=null;Ka=false}else Fa=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(D){if(D==null||D.nodeName!="path")return false;var z=S(D),F=X(z).matrix;
-z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var k=z.numberOfItems,n=0;n0){w=k.getItem(n-1).pathSegType;if(w===2){o(n-1,1);F();break}else if(w===
+1)}else if(svgedit.path.path.segs[k].mate){F.removeItem(k);F.removeItem(k);svgedit.path.path.init().selectPt(k-1)}else{for(D=0;D0){w=k.getItem(n-1).pathSegType;if(w===2){o(n-1,1);F();break}else if(w===
1&&k.numberOfItems-1===n){o(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){La.toSelectMode(svgedit.path.path.elem);d.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){D=$(svgedit.path.path.elem);D.attr("d",D.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(D){var z=D.points,F=z.numberOfItems;if(F>=4){var k=z.getItem(0),n=null;D=[];D.push(["M",k.x,",",
-k.y," C"].join(""));for(var o=1;o<=F-4;o+=3){var w=z.getItem(o),E=z.getItem(o+1),H=z.getItem(o+2);if(n)if((k=svgedit.path.smoothControlPoints(n,w,k))&&k.length==2){w=D[D.length-1].split(",");w[2]=k[0].x;w[3]=k[0].y;D[D.length-1]=w.join(",");w=k[1]}D.push([w.x,w.y,E.x,E.y,H.x,H.y].join(","));k=H;n=E}for(D.push("L");o0;);La.clear(true);
$.each(m.childNodes,function(l,B){l&&B.nodeType===8&&B.data.indexOf("Created with")>=0&&m.insertBefore(B,m.firstChild)});if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var e=[];$(m).find("g:data(gsvg)").each(function(){for(var l=this.attributes,B=l.length,A=0;A=0;F--){z=D.item(F);
o=B(z.nodeValue);if(!(w.indexOf(z.localName)>=0))if(o!="")if(o.indexOf("pointer-events")!==0)if(!(z.localName==="class"&&o.indexOf("se_")===0)){l.push(" ");if(z.localName==="d")o=La.convertPath(e,true);if(isNaN(o)){if(G.test(o))o=svgedit.units.shortFloat(o)+A}else o=svgedit.units.shortFloat(o);if($a.apply&&e.nodeName==="image"&&z.localName==="href"&&$a.images&&$a.images==="embed"){var E=Va[o];if(E)o=E}if(!z.namespaceURI||z.namespaceURI==b||xa[z.namespaceURI]){l.push(z.nodeName);l.push('="');l.push(o);
l.push('"')}}}}if(e.hasChildNodes()){l.push(">");h++;D=false;for(F=0;F");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("