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

    '+B.window.pickerTitle+'


    ');var ga=256,oa=ga-0,Y=ga-0,V,ea,Ba,ja={};$(".jGraduate_SliderBar").width(145);var ca=$("#"+q+"_jGraduate_GradContainer")[0],U=a("svg",{id:q+"_jgraduate_svg",width:ga,height:ga,xmlns:s.svg},ca);V=V||v.paint.type;var Z=ea=v.paint[V],na=v.paint.alpha,pa=V==="solidColor";switch(V){case "solidColor":case "linearGradient":if(!pa){ea.id=q+"_lg_jgraduate_grad"; Z=ea=U.appendChild(ea)}a("radialGradient",{id:q+"_rg_jgraduate_grad"},U);if(V==="linearGradient")break;case "radialGradient":if(!pa){ea.id=q+"_rg_jgraduate_grad";Z=ea=U.appendChild(ea)}a("linearGradient",{id:q+"_lg_jgraduate_grad"},U)}if(pa){Z=ea=$("#"+q+"_lg_jgraduate_grad")[0];I=v.paint[V];w(0,"#"+I,1);var ma=typeof B.newstop;if(ma==="string")switch(B.newstop){case "same":w(1,"#"+I,1);break;case "inverse":ma="";for(var la=0;la<6;la+=2){I.substr(la,2);var ya=(255-parseInt(I.substr(la,2),16)).toString(16); if(ya.length<2)ya=0+ya;ma+=ya}w(1,"#"+ma,1);break;case "white":w(1,"#ffffff",1);break;case "black":w(1,"#000000",1)}else if(ma==="object")w(1,B.newstop.color||"#"+I,"opac"in B.newstop?B.newstop.opac:1)}I=parseFloat(Z.getAttribute("x1")||0);ma=parseFloat(Z.getAttribute("y1")||0);la=parseFloat(Z.getAttribute("x2")||1);ya=parseFloat(Z.getAttribute("y2")||0);var za=parseFloat(Z.getAttribute("cx")||0.5),Ja=parseFloat(Z.getAttribute("cy")||0.5),Ia=parseFloat(Z.getAttribute("fx")||za),Ha=parseFloat(Z.getAttribute("fy")|| Ja);Ba=a("rect",{id:q+"_jgraduate_rect",x:0,y:0,width:oa,height:Y,fill:"url(#"+q+"_jgraduate_grad)","fill-opacity":na/100},U);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(ca),Da=Ma.clone().text(2).css({top:ya*ga,left:la*ga}).attr("title","End stop").data("coord","end").appendTo(ca),wa=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ja*ga,left:za* ga}).data("coord","center").appendTo(ca),ra=wa.clone().text("F").css({top:Ha*ga,left:Ia*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ca);ra[0].id=q+"_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]=$("#"+q+"_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&&V==="radialGradient"||!M&&V==="linearGradient")ea.setAttribute(aa,this.value);var P=M?aa[0]==="c"?wa:ra:aa[1]==="1"?Ma:Da,da=aa.indexOf("x")>=0?"left":"top";P.css(da,this.value*ga)}).change()});var va,kb,vb=$("#"+q+"_jGraduate_StopSlider"),cb,Ta,Va,Fa=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,Ga=za,db=Ja;Ta=a("svg",{width:"100%",height:45},vb[0]);ca=a("pattern",{width:16, height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},Ta);a("image",{width:16,height:16},ca).setAttributeNS(s.xlink,"xlink:href",B.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;w(aa/ga,0,0,true);ia.stopPropagation()}});$(Ta).mouseover(function(){Ta.appendChild(Fa)});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/oa;ka=ka/Y;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);Ga=aa;db=ka;d();break;case "focus":ja.fx.val(aa);ja.fy.val(ka);P.setAttribute("fx",aa);P.setAttribute("fy",ka);d()}ia.preventDefault()},wb=function(){Ua=null;S.unbind("mousemove",Xa).unbind("mouseup",wb)};va=ea.getElementsByTagNameNS(s.svg,"stop");if(sa<2){for(;sa<2;){ea.appendChild(document.createElementNS(s.svg,"stop"));++sa}va=ea.getElementsByTagNameNS(s.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)/ 2)/100;da&&d();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;da&&d()}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":v.paint.alpha=parseInt(aa*100);Ba.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}d();aa-=1;if(Ka===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;Sa=aa*=180;d();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=(v.paint.alpha*255/100).toString(16);N.length<2;)N="0"+N;N=N.split(".")[0];I=v.paint.solidColor=="none"?"":v.paint.solidColor+N;pa||(I=va[0].getAttribute("stop-color")); $.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});R.jPicker({window:{title:B.window.pickerTitle},images:{clientPath:B.images.clientPath},color:{active:I,alphaSupport:true}},function(ia){v.paint.type="solidColor";v.paint.alpha=ia.val("ahex")?Math.round(ia.val("a")/255*100):100;v.paint.solidColor=ia.val("hex")?ia.val("hex"):"none";v.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();$("#"+q+"_jgraduate_rect")[0].setAttribute("fill","url(#"+q+"_"+ia+"_jgraduate_grad)");V=ia==="lg"?"linearGradient":"radialGradient";$("#"+q+"_jGraduate_OpacInput").val(v.paint.alpha).change();var aa=$("#"+q+"_"+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&&!(za==Ia&&Ja==Ha);$("#"+q+"_jGraduate_focusCoord").toggle(eb);if(eb)$("#"+q+"_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(v.paint.type){case "linearGradient":tb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":tb= $(L+" .jGraduate_tab_radgrad");break;default:tb=$(L+" .jGraduate_tab_color")}v.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),s=$(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),w=$(p).offset(),c=$("#"+g.menu);c.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).on("mouseup",function(n){var v=$(this);v.unbind("mouseup");$(".contextMenu").hide();if(d.button===2|| g.allowLeft||d.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(n,d,v)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(d){var n=$(this);n.unbind("mouseup");f(d,d,n)});var f=function(d,n,v){if(typeof n=="undefined")n=d;d.stopPropagation();if(p.hasClass("disabled")||n.altKey)return false;var B=d.pageX,q=d.pageY;if(svgedit.browser.isTouch()){B=d.originalEvent.touches[0].pageX;q=d.originalEvent.touches[0].pageY}d=a.width()-c.width();n=a.height()-c.height();if(B>d-15)B=d-15; if(q>n-30)q=n-30;if(svgedit.browser.isTouch())q-=c.height()/2;s.unbind("click");c.css({top:q,left:B}).fadeIn(g.inSpeed);c.find("A").mouseover(function(){c.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){c.find("LI.hover").removeClass("hover")});s.keypress(function(L){switch(L.keyCode){case 38:if(c.find("LI.hover").length){c.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:last").addClass("hover")}else c.find("LI:last").addClass("hover"); break;case 40:if(c.find("LI.hover").length==0)c.find("LI:first").addClass("hover");else{c.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");c.find("LI.hover").length||c.find("LI:first").addClass("hover")}break;case 13:c.find("LI.hover A").trigger("click");break;case 27:s.trigger("click")}});c.find("A").unbind("mouseup");c.find("LI:not(.disabled) A").mouseup(function(){s.unbind("click").unbind("keypress");$(".contextMenu").hide();b&&b($(this).attr("href").substr(1), $(v),{x:B-w.left,y:q-w.top,docX:B,docY:q});return false});setTimeout(function(){s.click(function(){s.unbind("click").unbind("keypress");c.fadeOut(g.outSpeed);return false})},0)};if($.browser.mozilla)$("#"+g.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+g.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+g.menu).each(function(){$(this).bind("mousedown.disableTextSelect",function(){return false})});$(p).add($("UL.contextMenu")).bind("contextmenu", 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,w=s.indexOf("Gecko/")>=0,c=s.indexOf("MSIE")>=0,f=s.indexOf("Chrome/")>=0,d=s.indexOf("Windows")>=0,n=s.indexOf("Macintosh")>= 0,v="ontouchstart"in window,B=!!g.querySelector,q=!!document.evaluate,L=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var Y=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{Y.replaceItem(oa,0);return true}catch(V){}return false}(),Q=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","path");oa.setAttribute("d","M0,0 10,10");var Y=oa.pathSegList;oa=oa.createSVGPathSegLinetoAbs(5,5);try{Y.insertItemBefore(oa, 0);return true}catch(V){}return false}(),K=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg"),Y=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);Y.setAttribute("x",5);oa.appendChild(Y);var V=document.createElementNS("http://www.w3.org/2000/svg","text");V.textContent="a";Y.appendChild(V);Y=V.getStartPositionOfChar(0);Y=Y.x;document.documentElement.removeChild(oa);return Y===0}(),I=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg", "svg");document.documentElement.appendChild(oa);var Y=document.createElementNS("http://www.w3.org/2000/svg","path");Y.setAttribute("d","M0,0 C0,0 10,10 10,0");oa.appendChild(Y);Y=Y.getBBox();document.documentElement.removeChild(oa);return Y.height>4&&Y.height<5}(),S=function(){var oa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(oa);var Y=document.createElementNS("http://www.w3.org/2000/svg","path");Y.setAttribute("d","M0,0 10,0");var V=document.createElementNS("http://www.w3.org/2000/svg", "path");V.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(Y);ea.appendChild(V);oa.appendChild(ea);Y=ea.getBBox();document.documentElement.removeChild(oa);return Y.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,Y=g.createSVGTransform();oa.appendItem(Y);return oa.getItem(0)==Y}();svgedit.browser.isOpera=function(){return b};svgedit.browser.isWebkit=function(){return p};svgedit.browser.isGecko=function(){return w}; svgedit.browser.isIE=function(){return c};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return d};svgedit.browser.isMac=function(){return n};svgedit.browser.isTouch=function(){return v};svgedit.browser.supportsSelectors=function(){return B};svgedit.browser.supportsXpath=function(){return q};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return Q};svgedit.browser.supportsPathBBox=function(){return I}; 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"),s={};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 w=null;if(p>=0)if(p=0){this._removeFromOtherLists(b);w=this._xforms[p]=b;this._list._update()}return w};this.removeItem=function(b){if(b=0){for(var p=this._xforms[b],w=Array(this.numberOfItems- 1),c=0;c1;)b=s[g-1].multiply(b);if(Math.abs(b.a)<1.0E-14)b.a=0;if(Math.abs(b.b)<1.0E-14)b.b=0;if(Math.abs(b.c)<1.0E-14)b.c=0;if(Math.abs(b.d)< 1.0E-14)b.d=0;if(Math.abs(b.e)<1.0E-14)b.e=0;if(Math.abs(b.f)<1.0E-14)b.f=0;return b};svgedit.math.hasMatrixTransform=function(s){if(!s)return false;for(var g=s.numberOfItems;g--;){var b=s.getItem(g);if(b.type==1&&!svgedit.math.isIdentity(b.matrix))return true}return false};svgedit.math.transformBox=function(s,g,b,p,w){var c={x:s,y:g},f={x:s+b,y:g};b={x:s+b,y:g+p};s={x:s,y:g+p};g=svgedit.math.transformPoint;c=g(c.x,c.y,w);var d=p=c.x,n=c.y,v=c.y;f=g(f.x,f.y,w);p=Math.min(p,f.x);d=Math.max(d,f.x); n=Math.min(n,f.y);v=Math.max(v,f.y);s=g(s.x,s.y,w);p=Math.min(p,s.x);d=Math.max(d,s.x);n=Math.min(n,s.y);v=Math.max(v,s.y);b=g(b.x,b.y,w);p=Math.min(p,b.x);d=Math.max(d,b.x);n=Math.min(n,b.y);v=Math.max(v,b.y);return{tl:c,tr:f,bl:s,br:b,aabox:{x:p,y:n,width:d-p,height:v-n}}};svgedit.math.transformListToTransform=function(s,g,b){if(s==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());g=g==undefined?0:g;b=b==undefined?s.numberOfItems-1:b;g=parseInt(g);b=parseInt(b);if(g>b){var p=b;b=g; g=p}p=a.createSVGMatrix();for(g=g;g<=b;++g){var w=g>=0&&gs.x&&g.ys.y}})();svgedit=svgedit||{}; (function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],s=["y","y1","cy","ry","height"],g=$.merge(["r","radius"],a);$.merge(g,s);var b,p={px:1};svgedit.units.init=function(c){b=c;c=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(c);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");c.appendChild(f);f=f.getBBox();document.body.removeChild(c); c=f.x;p.em=f.width;p.ex=f.height;p["in"]=c;p.cm=c/2.54;p.mm=c/25.4;p.pt=c/72;p.pc=c/6;p["%"]=0};svgedit.units.getTypeMap=function(){return p};svgedit.units.shortFloat=function(c){var f=b.getRoundDigits();if(isNaN(c)){if($.isArray(c))return svgedit.units.shortFloat(c[0])+","+svgedit.units.shortFloat(c[1])}else return+(+c).toFixed(f);return parseFloat(c).toFixed(f)-0};svgedit.units.convertUnit=function(c,f){f=f||b.getBaseUnit();return svgedit.unit.shortFloat(c/p[f])};svgedit.units.setUnitAttr=function(c, f,d){isNaN(d)||c.getAttribute(f);c.setAttribute(f,d)};var w={line:["x1","x2","y1","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],foreignObject:["x","y","width","height"],rect:["x","y","width","height"],image:["x","y","width","height"],use:["x","y","width","height"],text:["x","y"]};svgedit.units.convertAttrs=function(c){var f=c.tagName,d=b.getBaseUnit();if(f=w[f])for(var n=f.length,v=0;v=0?d*n:s.indexOf(c)>=0?d*v:d*Math.sqrt(n*n+v*v)/Math.sqrt(2)}else{n=f.substr(-2);d=f.substr(0,f.length-2);return d*p[n]}};svgedit.units.isValidUnit=function(c,f,d){var n=false;if(g.indexOf(c)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(p,function(q){if(!n)if(RegExp("^-?[\\d\\.]+"+q+"$").test(f))n=true})}else n=true;else if(c=="id"){c=false;try{var v=b.getElement(f); c=v==null||v===d}catch(B){}return c}else n=true;return n}})();svgedit=svgedit||{}; (function(){function a(c){if(svgedit.browser.supportsHVLineContainerBBox())try{return c.getBBox()}catch(f){}var d=$.data(c,"ref"),n=null;if(d){var v=$(d).children().clone().attr("visibility","hidden");$(w).append(v);n=v.filter("line, path")}else n=$(c).find("line, path");var B=false;if(n.length){n.each(function(){var q=this.getBBox();if(!q.width||!q.height)B=true});if(B){c=d?v:$(c).children();ret=getStrokedBBox(c)}else ret=c.getBBox()}else ret=c.getBBox();d&&v.remove();return ret}if(!svgedit.utilities)svgedit.utilities= {};var s="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),g=null,b=null,p=null,w=null;svgedit.utilities.init=function(c){g=c;b=c.getDOMDocument();p=c.getDOMContainer();w=c.getSVGRoot()};svgedit.utilities.toXml=function(c){return $("

    ").text(c).html()};svgedit.utilities.fromXml=function(c){return $("

    ").html(c).text()};svgedit.utilities.encode64=function(c){c=svgedit.utilities.convertToXMLReferences(c);if(window.btoa)return window.btoa(c); var f=Array(Math.floor((c.length+2)/3)*4),d,n,v,B,q,L,Q=0,K=0;do{d=c.charCodeAt(Q++);n=c.charCodeAt(Q++);v=c.charCodeAt(Q++);B=d>>2;d=(d&3)<<4|n>>4;q=(n&15)<<2|v>>6;L=v&63;if(isNaN(n))q=L=64;else if(isNaN(v))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(B);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(d);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(Q< c.length);return f.join("")};svgedit.utilities.decode64=function(c){if(window.atob)return window.atob(c);var f="",d,n,v="",B,q="",L=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(c.charAt(L++)); d=d<<2|n>>4;n=(n&15)<<4|B>>2;v=(B&3)<<6|q;f+=String.fromCharCode(d);if(B!=64)f+=String.fromCharCode(n);if(q!=64)f+=String.fromCharCode(v)}while(L127)f+="&#"+n+";"}return f};svgedit.utilities.text2xml=function(c){if(c.indexOf("=0)c=c.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var f;try{var d=window.DOMParser? new DOMParser:new ActiveXObject("Microsoft.XMLDOM");d.async=false}catch(n){throw Error("XML Parser could not be instantiated");}try{f=d.loadXML?d.loadXML(c)?d:false:d.parseFromString(c,"text/xml")}catch(v){throw Error("Error parsing XML string");}return f};svgedit.utilities.bboxToObj=function(c){return{x:c.x,y:c.y,width:c.width,height:c.height}};svgedit.utilities.walkTree=function(c,f){if(c&&c.nodeType==1){f(c);for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f)}}; svgedit.utilities.walkTreePost=function(c,f){if(c&&c.nodeType==1){for(var d=c.childNodes.length;d--;)svgedit.utilities.walkTree(c.childNodes.item(d),f);f(c)}};svgedit.utilities.getUrlFromAttr=function(c){if(c)if(c.indexOf('url("')===0)return c.substring(5,c.indexOf('"',6));else if(c.indexOf("url('")===0)return c.substring(5,c.indexOf("'",6));else if(c.indexOf("url(")===0)return c.substring(4,c.indexOf(")"));return null};svgedit.utilities.getHref=function(c){if(c)return c.getAttributeNS("http://www.w3.org/1999/xlink", "href")};svgedit.utilities.setHref=function(c,f){c.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f)};svgedit.utilities.findDefs=function(c){c=g.getSVGContent().documentElement;var f=c.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return f=f.length>0?f[0]:c.insertBefore(c.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),c.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(c){var f=c.pathSegList,d=f.numberOfItems;c=[[],[]];var n=f.getItem(0), v=[n.x,n.y];for(n=0;n=0){var n=d.split(":");c[n[1]]=s[n[0]]}else c[d]=d=="xmlns"?"http://www.w3.org/2000/xmlns/":null});b[p]=c});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 w=p.parentNode;if(p.ownerDocument&&w){var c=g[p.nodeName],f=b[p.nodeName];if(c!= undefined){for(var d=[],n=p.attributes.length;n--;){var v=p.attributes.item(n),B=v.nodeName,q=v.localName,L=v.namespaceURI;if(!(f.hasOwnProperty(q)&&L==f[q]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[v.nodeValue])){B.indexOf("se:")==0&&d.push([B,v.nodeValue]);p.removeAttributeNS(L,q)}if(svgedit.browser.isGecko())switch(B){case "transform":case "gradientTransform":case "patternTransform":q=v.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(B,q)}if(B=="style"){v= v.nodeValue.split(";");for(B=v.length;B--;){q=v[B].split(":");c.indexOf(q[0])>=0&&p.setAttribute(q[0],q[1])}p.removeAttribute("style")}}$.each(d,function(Q,K){p.setAttributeNS("http://svg-edit.googlecode.com",K[0],K[1])});if((n=svgedit.utilities.getHref(p))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(p.nodeName)>=0)if(n[0]!="#"){svgedit.utilities.setHref(p,"");p.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(p.nodeName=="use"&&!svgedit.utilities.getHref(p))w.removeChild(p); else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],function(Q,K){var I=p.getAttribute(K);if(I)if((I=svgedit.utilities.getUrlFromAttr(I))&&I[0]!=="#"){p.setAttribute(K,"");p.removeAttribute(K)}});for(n=p.childNodes.length;n--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(n))}}else{for(c=[];p.hasChildNodes();)c.push(w.insertBefore(p.firstChild,p));w.removeChild(p);for(n=c.length;n--;)svgedit.sanitize.sanitizeSvg(c[n])}}}}})();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,s,g,b){this.elem=a;this.text=b?"Move "+a.tagName+" to "+b:"Move "+a.tagName;this.oldNextSibling=s;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,s){this.elem=a;this.text=s||"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= svgedit.history.InsertElementCommand.type;svgedit.history.InsertElementCommand.prototype.getText=function(){return this.text};svgedit.history.InsertElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);this.elem=this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this)};svgedit.history.InsertElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY, this);this.parent=this.elem.parentNode;this.elem=this.elem.parentNode.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.InsertElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.RemoveElementCommand=function(a,s,g,b){this.elem=a;this.text=b||"Delete "+a.tagName;this.nextSibling=s;this.parent=g;svgedit.transformlist.removeElementFromListMap(a)};svgedit.history.RemoveElementCommand.type=function(){return"svgedit.history.RemoveElementCommand"}; svgedit.history.RemoveElementCommand.prototype.type=svgedit.history.RemoveElementCommand.type;svgedit.history.RemoveElementCommand.prototype.getText=function(){return this.text};svgedit.history.RemoveElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.parent=this.elem.parentNode;this.elem=this.parent.removeChild(this.elem);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY, this)};svgedit.history.RemoveElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);svgedit.transformlist.removeElementFromListMap(this.elem);this.nextSibling==null&&window.console&&console.log("Error: reference element was lost");this.parent.insertBefore(this.elem,this.nextSibling);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this)};svgedit.history.RemoveElementCommand.prototype.elements=function(){return[this.elem]}; svgedit.history.ChangeElementCommand=function(a,s,g){this.elem=a;this.text=g?"Change "+a.tagName+" "+g:"Change "+a.tagName;this.newValues={};this.oldValues=s;for(var b in s)this.newValues[b]=b=="#text"?a.textContent:b=="#href"?svgedit.utilities.getHref(a):a.getAttribute(b)};svgedit.history.ChangeElementCommand.type=function(){return"svgedit.history.ChangeElementCommand"};svgedit.history.ChangeElementCommand.prototype.type=svgedit.history.ChangeElementCommand.type;svgedit.history.ChangeElementCommand.prototype.getText= function(){return this.text};svgedit.history.ChangeElementCommand.prototype.apply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);var s=false,g;for(g in this.newValues){if(this.newValues[g])if(g=="#text")this.elem.textContent=this.newValues[g];else g=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[g]):this.elem.setAttribute(g,this.newValues[g]);else if(g=="#text")this.elem.textContent="";else{this.elem.setAttribute(g,"");this.elem.removeAttribute(g)}if(g== "transform")s=true}if(!s)if(s=svgedit.utilities.getRotationAngle(this.elem)){g=elem.getBBox();s=["rotate(",s," ",g.x+g.width/2,",",g.y+g.height/2,")"].join("");s!=elem.getAttribute("transform")&&elem.setAttribute("transform",s)}a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_APPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.unapply=function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_UNAPPLY,this);var s=false,g;for(g in this.oldValues){if(this.oldValues[g])if(g== "#text")this.elem.textContent=this.oldValues[g];else g=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[g]):this.elem.setAttribute(g,this.oldValues[g]);else if(g=="#text")this.elem.textContent="";else this.elem.removeAttribute(g);if(g=="transform")s=true}if(!s)if(s=svgedit.utilities.getRotationAngle(this.elem)){g=this.elem.getBBox();s=["rotate(",s," ",g.x+g.width/2,",",g.y+g.height/2,")"].join("");s!=this.elem.getAttribute("transform")&&this.elem.setAttribute("transform",s)}svgedit.transformlist.removeElementFromListMap(this.elem); a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY,this);return true};svgedit.history.ChangeElementCommand.prototype.elements=function(){return[this.elem]};svgedit.history.BatchCommand=function(a){this.text=a||"Batch Command";this.stack=[]};svgedit.history.BatchCommand.type=function(){return"svgedit.history.BatchCommand"};svgedit.history.BatchCommand.prototype.type=svgedit.history.BatchCommand.type;svgedit.history.BatchCommand.prototype.getText=function(){return this.text};svgedit.history.BatchCommand.prototype.apply= function(a){a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.BEFORE_APPLY,this);for(var s=this.stack.length,g=0;g=0;s--)this.stack[s].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],s=this.stack.length;s--;)for(var g=this.stack[s].elements(),b=g.length;b--;)a.indexOf(g[b])==-1&&a.push(g[b]);return a};svgedit.history.BatchCommand.prototype.addSubCommand=function(a){this.stack.push(a)};svgedit.history.BatchCommand.prototype.isEmpty=function(){return this.stack.length==0};svgedit.history.UndoManager=function(a){this.handler_=a||null;this.undoStackPointer=0;this.undoStack=[];this.undoChangeStackPointer= -1;this.undoableChangeStack=[]};svgedit.history.UndoManager.prototype.resetUndoStack=function(){this.undoStack=[];this.undoStackPointer=0};svgedit.history.UndoManager.prototype.getUndoStackSize=function(){return this.undoStackPointer};svgedit.history.UndoManager.prototype.getRedoStackSize=function(){return this.undoStack.length-this.undoStackPointer};svgedit.history.UndoManager.prototype.getNextUndoCommandText=function(){return this.undoStackPointer>0?this.undoStack[this.undoStackPointer-1].getText(): ""};svgedit.history.UndoManager.prototype.getNextRedoCommandText=function(){return this.undoStackPointer0&&this.undoStack[--this.undoStackPointer].unapply(this.handler_)};svgedit.history.UndoManager.prototype.redo=function(){this.undoStackPointer0&&this.undoStack[this.undoStackPointer++].apply(this.handler_)}; svgedit.history.UndoManager.prototype.addCommandToHistory=function(a){if(this.undoStackPointer0)this.undoStack=this.undoStack.splice(0,this.undoStackPointer);this.undoStack.push(a);this.undoStackPointer=this.undoStack.length};svgedit.history.UndoManager.prototype.beginUndoableChange=function(a,s){for(var g=++this.undoChangeStackPointer,b=s.length,p=Array(b),w=Array(b);b--;){var c=s[b];if(c!=null){w[b]=c;p[b]=c.getAttribute(a)}}this.undoableChangeStack[g]= {attrName:a,oldValues:p,elements:w}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,s=this.undoableChangeStack[a],g=s.elements.length,b=s.attrName,p=new svgedit.history.BatchCommand("Change "+b);g--;){var w=s.elements[g];if(w!=null){var c={};c[b]=s.oldValues[g];c[b]!=w.getAttribute(b)&&p.addSubCommand(new svgedit.history.ChangeElementCommand(w,c,b))}}this.undoableChangeStack[a]=null;return p}})();svgedit=svgedit||{}; (function(){if(!svgedit.select)svgedit.select={};var a,s,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 w in g.selectorGrips)p.push(w);for(;b>0;){p.push(p.shift());b--}b=0;for(w in g.selectorGrips){g.selectorGrips[w].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,w=p.selectorGrips,c=this.selectedElement,f=c.getAttribute("stroke-width"),d=a.currentZoom(),n=1/d;if(c.getAttribute("stroke")!== "none"&&!isNaN(f))n+=f/2;var v=c.tagName;if(v==="text")n+=2/d;f=svgedit.transformlist.getTransformList(c);f=svgedit.math.transformListToTransform(f).matrix;f.e*=d;f.f*=d;var B=svgedit.utilities.getBBox(c);if(v==="g"&&!$.data(c,"gsvg"))if(v=a.getStrokedBBox(c.childNodes))B=v;v=B.x;var q=B.y,L=B.width;B=B.height;n*=d;d=svgedit.math.transformBox(v*d,q*d,L*d,B*d,f);f=d.aabox;v=f.x-n;q=f.y-n;L=f.width+n*2;var Q=f.height+n*2;f=v+L/2;B=q+Q/2;if(c=svgedit.utilities.getRotationAngle(c)){v=a.svgRoot().createSVGTransform(); v.setRotate(-c,f,B);v=v.matrix;d.tl=svgedit.math.transformPoint(d.tl.x,d.tl.y,v);d.tr=svgedit.math.transformPoint(d.tr.x,d.tr.y,v);d.bl=svgedit.math.transformPoint(d.bl.x,d.bl.y,v);d.br=svgedit.math.transformPoint(d.br.x,d.br.y,v);v=d.tl;L=v.x;Q=v.y;var K=v.x,I=v.y;v=Math.min;q=Math.max;L=v(L,v(d.tr.x,v(d.bl.x,d.br.x)))-n;Q=v(Q,v(d.tr.y,v(d.bl.y,d.br.y)))-n;K=q(K,q(d.tr.x,q(d.bl.x,d.br.x)))+n;I=q(I,q(d.tr.y,q(d.bl.y,d.br.y)))+n;v=L;q=Q;L=K-L;Q=I-Q}n=a.svgRoot().suspendRedraw(100);b.setAttribute("d", "M"+v+","+q+" L"+(v+L)+","+q+" "+(v+L)+","+(q+Q)+" "+v+","+(q+Q)+"z");this.selectorGroup.setAttribute("transform",c?"rotate("+[c,f,B].join(",")+")":"");if(svgedit.browser.isTouch()){v-=15.75;q-=15.75}else{v-=4;q-=4}this.gripCoords={nw:[v,q].map(Math.round),ne:[v+L,q].map(Math.round),sw:[v,q+Q].map(Math.round),se:[v+L,q+Q].map(Math.round),n:[v+L/2,q].map(Math.round),w:[v,q+Q/2].map(Math.round),e:[v+L,q+Q/2].map(Math.round),s:[v+L/2,q+Q].map(Math.round)};for(var S in this.gripCoords){b=this.gripCoords[S]; w[S].setAttribute("x",b[0]);w[S].setAttribute("y",b[1])}this.rotateCoords={nw:[v,q],ne:[v+L+8,q],sw:[v,q+Q+8],se:[v+L+8,q+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(n)};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("+s.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=s.dimensions;b=a.createSVGElement({element:"svg",attr:{id:"canvasBackground", width:b[0],height:b[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});p=a.createSVGElement({element:"defs",attr:{id:"placeholder_defs"}});var w=a.createSVGElement({element:"pattern",attr:{id:"checkerPattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:20,height:20,viewBox:"0 0 10 10"}}),c=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:10,height:10,fill:"#fff"}}),f=a.createSVGElement({element:"rect",attr:{x:0,y:0,width:5,height:5,fill:"#eee"}}), d=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),n=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"url(#checkerPattern)",style:"pointer-events:none"}});b.appendChild(p);p.appendChild(w);w.appendChild(c);w.appendChild(f);w.appendChild(d);b.appendChild(n);a.svgRoot().insertBefore(b,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(b){if(b==null)return null;var p=this.selectors.length; if(typeof this.selectorMap[b.id]=="object"){this.selectorMap[b.id].locked=true;return this.selectorMap[b.id]}for(var w=0;w element";this.svgElem_=b;this.obj_num=0;this.idPrefix=p||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= "";var w=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(w&&g!=s.NEVER_RANDOMIZE)this.nonce_=w;else g==s.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(b){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+b):$(this.svgElem_).find("[id="+b+"]")[0]};svgedit.draw.Drawing.prototype.getSvgElem=function(){return this.svgElem_};svgedit.draw.Drawing.prototype.getNonce=function(){return this.nonce_}; svgedit.draw.Drawing.prototype.setNonce=function(b){this.svgElem_.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:se","http://svg-edit.googlecode.com");this.svgElem_.setAttributeNS("http://svg-edit.googlecode.com","se:nonce",b);this.nonce_=b};svgedit.draw.Drawing.prototype.clearNonce=function(){this.nonce_=""};svgedit.draw.Drawing.prototype.getId=function(){return this.nonce_?this.idPrefix+this.nonce_+"_"+this.obj_num:this.idPrefix+this.obj_num};svgedit.draw.Drawing.prototype.getNextId=function(){var b= this.obj_num,p=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();p=true}else this.obj_num++;for(var w=this.getId();this.getElem_(w);){if(p){this.obj_num=b;p=false}this.obj_num++;w=this.getId()}if(p)this.obj_num=b;return w};svgedit.draw.Drawing.prototype.releaseId=function(b){var p=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof b!="string"||b.indexOf(p)!=0)return false;b=parseInt(b.substr(p.length));if(typeof b!="number"||b<=0||this.releasedNums.indexOf(b)!=-1)return false; this.releasedNums.push(b);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(b){for(var p=0;p=0&&b1){var b=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return b}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var b=this.svgElem_.childNodes.length,p=[],w=[],c=null,f=false,d=0;d0||!f){for(d=1;w.indexOf("Layer "+d)>=0;)d++;w="Layer "+d;c=b.createElementNS("http://www.w3.org/2000/svg","g");f=b.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=w; c.appendChild(f);for(f=0;f1))for(var w= 0;w0){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,d=f.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var n=0;n=d?null:f[n+1],L=n-1<0?null:f[n-1];if(B.type===2){if(L&&L.type!==1){q=f[v];q.next=f[v+1];q.next.prev=q;q.addGrip()}v=n}else if(q&&q.type===1){B.next=f[v+1];B.next.prev=B;B.mate=f[v];B.addGrip();if(this.first_seg==null)this.first_seg=B}else if(q){if(B.type!== 1){B.addGrip();if(q&&q.type!==2){B.next=q;B.next.prev=B}}}else if(B.type!==1){q=f[v];q.next=f[v+1];q.next.prev=q;q.addGrip();B.addGrip();if(!this.first_seg)this.first_seg=f[v]}}return this};svgedit.path.Path.prototype.eachSeg=function(f){for(var d=this.segs.length,n=0;n').documentElement, true);a.appendChild(d);var n=f.createElementNS(b,"svg");(c.clearSvgContentElement=function(){for(;n.firstChild;)n.removeChild(n.firstChild);$(n).attr({id:"svgcontent",width:w[0],height:w[1],x:w[0],y:w[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(d);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");n.appendChild(e)})();var v="svg_";c.setIdPrefix= function(e){v=e};c.current_drawing_=new svgedit.draw.Drawing(n,v);var B=c.getCurrentDrawing=function(){return c.current_drawing_},q=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,I=Array(1),S=this.addSvgElementFromJson=function(e){var k=svgedit.utilities.getElem(e.attr.id),l=B().getCurrentLayer();if(k&&e.element!=k.tagName){l.removeChild(k);k=null}if(!k){k=f.createElementNS(b,e.element);if(l)(L||l).appendChild(k)}e.curStyles&&svgedit.utilities.assignAttributes(k,{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(k,e.attr,100);svgedit.utilities.cleanupElement(k);return k},R=c.getTransformList=svgedit.transformlist.getTransformList,N=svgedit.math.transformPoint,ga=c.matrixMultiply=svgedit.math.matrixMultiply,oa=c.hasMatrixTransform=svgedit.math.hasMatrixTransform,Y=c.transformListToTransform=svgedit.math.transformListToTransform,V=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return p.baseUnit}, getElement:svgedit.utilities.getElem,getHeight:function(){return n.getAttribute("height")/q},getWidth:function(){return n.getAttribute("width")/q},getRoundDigits:function(){return $a.round_digits}});var Ba=c.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return f},getDOMContainer:function(){return a},getSVGRoot:function(){return d},getSelectedElements:function(){return I},getSVGContent:function(){return n}});var ja=c.getUrlFromAttr=svgedit.utilities.getUrlFromAttr, ca=c.getHref=svgedit.utilities.getHref,U=c.setHref=svgedit.utilities.setHref,Z=svgedit.utilities.getPathBBox;c.getBBox=svgedit.utilities.getBBox;var na=c.getRotationAngle=svgedit.utilities.getRotationAngle,pa=c.getElem=svgedit.utilities.getElem,ma=c.assignAttributes=svgedit.utilities.assignAttributes,la=this.cleanupElement=svgedit.utilities.cleanupElement,ya=svgedit.sanitize.getNSMap(),za=c.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ia=svgedit.history.InsertElementCommand, Ha=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Da=svgedit.history.BatchCommand;c.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(e,k){var l=svgedit.history.HistoryEventTypes;if(e==l.BEFORE_UNAPPLY||e==l.BEFORE_APPLY)c.clearSelection();else if(e==l.AFTER_APPLY||e==l.AFTER_UNAPPLY){var C=k.elements();c.pathActions.clear();M("changed",C);C=k.type();l=e==l.AFTER_APPLY;if(C==Ja.type())(l?k.newParent:k.oldParent)==n&&c.identifyLayers();else if(C==Ia.type()|| C==Ha.type()){k.parent==n&&c.identifyLayers();if(C==Ia.type())l&&Ta(k.elem);else l||Ta(k.elem);k.elem.tagName==="use"&&Gb(k.elem)}else if(C==Ma.type()){k.elem.tagName=="title"&&k.elem.parentNode.parentNode==n&&c.identifyLayers();l=l?k.newValues:k.oldValues;l.stdDeviation&&c.setBlurOffsets(k.elem.parentNode,l.stdDeviation)}}}});var wa=function(e){c.undoMgr.addCommandToHistory(e)};svgedit.select.init(p,{createSVGElement:function(e){return c.addSvgElementFromJson(e)},svgRoot:function(){return d},svgContent:function(){return n}, currentZoom:function(){return q},getStrokedBBox:function(e){return c.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return q},getSVGRoot:function(){return d}});svgedit.utilities.snapToGrid=function(e){var k=p.snappingStep,l=p.baseUnit;if(l!=="px")k*=svgedit.units.getTypeMap()[l];return e=Math.round(e/k)*k};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 k=$(e).attr(vb),l;for(l in k){var C=k[l];if(C&&C.indexOf("url(")===0){C=ja(C).substr(1);if(!pa(C)){gb().appendChild(sb[C]);delete sb[C]}}}e=e.getElementsByTagName("*");if(e.length){k=0;for(l=e.length;k=0)m=o=c.convertToPath(h,true);else if(h.tagName=="rect"){var u=h.getAttribute("rx"),E=h.getAttribute("ry");if(u||E)m=o=c.convertToPath(h,true)}if(!o){var H=h.cloneNode(true),J=document.createElementNS(b, "g"),O=h.parentNode;O.appendChild(J);J.appendChild(H);m=svgedit.utilities.bboxToObj(J.getBBox());O.removeChild(J)}}return m}catch(X){console.log(h,X)}},l;$.each(e,function(){if(!l)if(this.parentNode)l=k(this)});if(l==null)return null;var C=l.x+l.width,A=l.y+l.height,G=l.x,D=l.y,z=function(h){var m=h.getAttribute("stroke-width"),o=0;if(h.getAttribute("stroke")!="none"&&!isNaN(m))o+=m/2;return o},F=[];$.each(e,function(h,m){var o=k(m);if(o){var u=z(m);G=Math.min(G,o.x-u);D=Math.min(D,o.y-u);F.push(o)}}); l.x=G;l.y=D;$.each(e,function(h,m){var o=F[h];if(o&&m.nodeType==1){var u=z(m);C=Math.max(C,o.x+o.width+u);A=Math.max(A,o.y+o.height+u)}});l.width=C-G;l.height=A-D;return l};var pb=this.getVisibleElements=function(e){e||(e=$(n).children());e.find("#canvas_background").length&&e.splice(0,1);var k=[];$(e).children().each(function(l,C){try{C.getBBox()&&k.push(C)}catch(A){}});return k.reverse()},fb=this.getVisibleElementsAndBBoxes=function(e){e||(e=$(n).children());var k=[];$(e).children().each(function(l, C){try{C.getBBox()&&k.push({elem:C,bbox:getStrokedBBox([C])})}catch(A){}});return k.reverse()},tb=this.groupSvgElem=function(e){var k=document.createElementNS(b,"g");e.parentNode.replaceChild(k,e);$(k).append(e).data("gsvg",e)[0].id=ka()},ia=function(e){var k=document.createElementNS(e.namespaceURI,e.nodeName);k.removeAttribute("id");$.each(e.attributes,function(C,A){A.localName!="-moz-math-font-style"&&k.setAttributeNS(A.namespaceURI,A.nodeName,A.nodeValue)});if(svgedit.browser.isWebkit()&&e.nodeName== "path"){var l=La.convertPath(e);k.setAttribute("d",l)}$.each(e.childNodes,function(C,A){switch(A.nodeType){case 1:k.appendChild(ia(A));break;case 3:k.textContent=A.nodeValue}});if($(e).data("gsvg"))$(k).data("gsvg",k.firstChild);else if($(e).data("symbol")){e=$(e).data("symbol");$(k).data("ref",e).data("symbol",e)}else k.tagName=="image"&&Fb(k);k.id=ka();return k},aa,ka,M;(function(e){var k={};aa=e.getId=function(){return B().getId()};ka=e.getNextId=function(){return B().getNextId()};M=e.call=function(l, C){if(k[l])return k[l](this,C)};e.bind=function(l,C){var A=k[l];k[l]=C;return A}})(c);this.prepareSvg=function(e){this.sanitizeSvg(e.documentElement);e=e.getElementsByTagNameNS(b,"path");for(var k=0,l=e.length;k0&&A.getItem(0).type==4&&A.removeItem(0);if(e!=0){G=N(G,D,Y(A).matrix);D=d.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(!k){A=l.getAttribute("transform"); l.setAttribute("transform",C);Ya("transform",A,I);M("changed",I)}pa("pathpointgrip_container");l=ra.requestSelector(I[0]);l.resize();l.updateGripCursors(e)}};var Ea=this.recalculateAllSelectedDimensions=function(){for(var e=new Da(db=="none"?"position":"size"),k=I.length;k--;){var l=Ra(I[k]);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,k,l){var C=p.gridSnapping&&e.parentNode.parentNode.localName==="svg",A=function(){if(C)for(var o in k)k[o]=va(k[o]);ma(e,k,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"),h=z.getAttribute("x2");z.setAttribute("x1",-(F-1));z.setAttribute("x2",-(h-1))}if(l.d<0){F=z.getAttribute("y1");h=z.getAttribute("y2");z.setAttribute("y1", -(F-1));z.setAttribute("y2",-(h-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=Y(e).matrix;D=ga(D.inverse(),l,D);k.x=parseFloat(k.x)+D.e;k.y=parseFloat(k.y)+D.f}else{D=R(e);z=d.createSVGTransform();z.setMatrix(ga(Y(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=d.createSVGTransform();z.setMatrix(ga(Y(D).matrix, l));D.clear();D.appendItem(z)}else{D=N(k.x,k.y,l);k.width=l.a*k.width;k.height=l.d*k.height;k.x=D.x+Math.min(0,k.width);k.y=D.y+Math.min(0,k.height);k.width=Math.abs(k.width);k.height=Math.abs(k.height)}A();break;case "ellipse":G=N(k.cx,k.cy,l);k.cx=G.x;k.cy=G.y;k.rx=l.a*k.rx;k.ry=l.d*k.ry;k.rx=Math.abs(k.rx);k.ry=Math.abs(k.ry);A();break;case "circle":G=N(k.cx,k.cy,l);k.cx=G.x;k.cy=G.y;G=svgedit.math.transformBox(box.x,box.y,box.width,box.height,l);k.r=Math.min((G.tr.x-G.tl.x)/2,(G.bl.y-G.tl.y)/ 2);if(k.r)k.r=Math.abs(k.r);A();break;case "line":D=N(k.x1,k.y1,l);F=N(k.x2,k.y2,l);k.x1=D.x;k.y1=D.y;k.x2=F.x;k.y2=F.y;case "text":l=e.querySelectorAll("tspan");for(G=l.length;G--;){D=Ba("x",e.getAttribute("x"));z=Ba("x",l[G].getAttribute("x"));F=Ba("y",e.getAttribute("y"));h=Ba("y",l[G].getAttribute("y"));var m={};if(!isNaN(D)&&!isNaN(z)&&D!=0&&z!=0&&k.x)m.x=k.x-(D-z);if(!isNaN(F)&&!isNaN(h)&&F!=0&&h!=0&&k.y)m.y=k.y-(F-h);if(m.x||m.y)ma(l[G],m,1E3,true)}A();break;case "use":A();break;case "g":(A= $(e).data("gsvg"))&&ma(A,k,1E3,true);break;case "polyline":case "polygon":A=k.points.length;for(G=0;G0){for(var l=k.numberOfItems;l--;){var C=k.getItem(l);if(C.type===0)k.removeItem(l);else if(C.type===1)svgedit.math.isIdentity(C.matrix)&&k.removeItem(l);else C.type===4&&C.angle===0&&k.removeItem(l)}if(k.numberOfItems===1&&na(e))return null}if(!k||k.numberOfItems==0){e.removeAttribute("transform");return null}if(k){l=k.numberOfItems;for(var A=[];l--;){C=k.getItem(l);if(C.type===1)A.push([C.matrix,l]);else if(A.length)A=[]}if(A.length===2){l=d.createSVGTransformFromMatrix(ga(A[1][0], A[0][0]));k.removeItem(A[0][1]);k.removeItem(A[1][1]);k.insertItemBefore(l,A[1][1])}l=k.numberOfItems;if(l>=2&&k.getItem(l-2).type===1&&k.getItem(l-1).type===2){A=d.createSVGTransform();C=ga(k.getItem(l-2).matrix,k.getItem(l-1).matrix);A.setMatrix(C);k.removeItem(l-2);k.removeItem(l-2);k.appendItem(A)}}switch(e.tagName){case "line":case "polyline":case "polygon":case "path":break;default:if(k.numberOfItems===1&&k.getItem(0).type===1||k.numberOfItems===2&&k.getItem(0).type===1&&k.getItem(0).type=== 4)return null}var G=$(e).data("gsvg");l=new Da("Transform");var D={},z=null;C=[];switch(e.tagName){case "line":C=["x1","y1","x2","y2"];break;case "circle":C=["cx","cy","r"];break;case "ellipse":C=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":C=["width","height","x","y"];break;case "use":case "text":case "tspan":C=["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 h=0;h1.0E-10?Math.sin(h)/(1-Math.cos(h)):2/h;for(h=0;h=3&&k.getItem(E-2).type==3&&k.getItem(E-3).type==2&&k.getItem(E-1).type==2){h=3;var J=k.getItem(E-3).matrix,O=k.getItem(E-2).matrix,X=k.getItem(E-1).matrix;F=e.childNodes;for(m=F.length;m--;){var ba=F.item(m);C=G=0;if(ba.nodeType== 1){var T=R(ba);if(T){C=Y(T).matrix;G=na(ba);var fa=Sa,ha=[];Sa=ba.getAttribute("transform");if(G||oa(T)){var W=d.createSVGTransform();W.setMatrix(ga(J,O,X,C));T.clear();T.appendItem(W);ha.push(W)}else{G=ga(C.inverse(),X,C);W=d.createSVGMatrix();W.e=-G.e;W.f=-G.f;C=ga(W.inverse(),C.inverse(),J,O,X,C,G.inverse());var qa=d.createSVGTransform(),ua=d.createSVGTransform(),Aa=d.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(C.a,C.d);Aa.setTranslate(W.e,W.f);T.appendItem(Aa);T.appendItem(ua);T.appendItem(qa); ha.push(Aa);ha.push(ua);ha.push(qa)}l.addSubCommand(Ra(ba));Sa=fa}}}k.removeItem(E-1);k.removeItem(E-2);k.removeItem(E-3)}else if(E>=3&&k.getItem(E-1).type==1){h=3;C=Y(k).matrix;W=d.createSVGTransform();W.setMatrix(C);k.clear();k.appendItem(W)}else if((E==1||E>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){h=2;G=Y(k).matrix;k.removeItem(0);C=Y(k).matrix.inverse();C=ga(C,G);G=C.e;C=C.f;if(G!=0||C!=0){F=e.childNodes;m=F.length;for(E=[];m--;){ba=F.item(m);if(ba.nodeType==1){if(ba.getAttribute("clip-path")){fa= ba.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,C);E.push(fa)}}fa=Sa;Sa=ba.getAttribute("transform");if(T=R(ba)){J=d.createSVGTransform();J.setTranslate(G,C);T.numberOfItems?T.insertItemBefore(J,0):T.appendItem(J);l.addSubCommand(Ra(ba));T=e.getElementsByTagNameNS(b,"use");ba="#"+ba.id;for(J=T.length;J--;){O=T.item(J);if(ba==ca(O)){X=d.createSVGTransform();X.setTranslate(-G,-C);R(O).insertItemBefore(X,0);l.addSubCommand(Ra(O))}}Sa=fa}}}E=[];Sa=fa}}else if(E==1&&k.getItem(0).type==1&&!A){h= 1;C=k.getItem(0).matrix;F=e.childNodes;for(m=F.length;m--;){ba=F.item(m);if(ba.nodeType==1){fa=Sa;Sa=ba.getAttribute("transform");if(T=R(ba)){G=ga(C,Y(T).matrix);E=d.createSVGTransform();E.setMatrix(G);T.clear();T.appendItem(E,0);l.addSubCommand(Ra(ba));Sa=fa;fa=ba.getAttribute("stroke-width");ba.getAttribute("stroke")!=="none"&&!isNaN(fa)&&ba.setAttribute("stroke-width",fa*((Math.abs(G.a)+Math.abs(G.d))/2))}}}k.clear()}else{if(A){o=d.createSVGTransform();o.setRotate(A,u.x,u.y);k.numberOfItems?k.insertItemBefore(o, 0):k.appendItem(o)}k.numberOfItems==0&&e.removeAttribute("transform");return null}if(h==2){if(A){u={x:o.x+H.e,y:o.y+H.f};o=d.createSVGTransform();o.setRotate(A,u.x,u.y);k.numberOfItems?k.insertItemBefore(o,0):k.appendItem(o)}}else if(h==3){C=Y(k).matrix;H=d.createSVGTransform();H.setRotate(A,o.x,o.y);H=H.matrix;o=d.createSVGTransform();o.setRotate(A,u.x,u.y);u=o.matrix.inverse();fa=C.inverse();u=ga(fa,u,H,C);G=u.e;C=u.f;if(G!=0||C!=0){F=e.childNodes;for(m=F.length;m--;){ba=F.item(m);if(ba.nodeType== 1){fa=Sa;Sa=ba.getAttribute("transform");T=R(ba);J=d.createSVGTransform();J.setTranslate(G,C);T.numberOfItems?T.insertItemBefore(J,0):T.appendItem(J);l.addSubCommand(Ra(ba));Sa=fa}}}if(A)k.numberOfItems?k.insertItemBefore(o,0):k.appendItem(o)}}else{A=svgedit.utilities.getBBox(e);if(!A&&e.tagName!="path")return null;C=d.createSVGMatrix();if(G=na(e)){o={x:A.x+A.width/2,y:A.y+A.height/2};u=N(A.x+A.width/2,A.y+A.height/2,Y(k).matrix);h=G*Math.PI/180;F=Math.abs(h)>1.0E-10?Math.sin(h)/(1-Math.cos(h)):2/ h;for(h=0;h=3&&k.getItem(E-2).type== 3&&k.getItem(E-3).type==2&&k.getItem(E-1).type==2){h=3;C=Y(k,E-3,E-1).matrix;k.removeItem(E-1);k.removeItem(E-2);k.removeItem(E-3)}else if(E==4&&k.getItem(E-1).type==1){h=3;C=Y(k).matrix;W=d.createSVGTransform();W.setMatrix(C);k.clear();k.appendItem(W);C=d.createSVGMatrix()}else if((E==1||E>1&&k.getItem(1).type!=3)&&k.getItem(0).type==2){h=2;H=k.getItem(0).matrix;fa=Y(k,1).matrix;A=fa.inverse();C=ga(A,H,fa);k.removeItem(0)}else if(E==1&&k.getItem(0).type==1&&!G){C=Y(k).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(h=0;h1&&A.showGrips(false)}}}M("selected",I);k||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,k){xa(true);qb(e,k)};this.removeFromSelection=function(e){if(I[0]!=null)if(e.length!=0){var k=Array(I.length);j=0;len=I.length;for(var l=0;l=0&&e.id!="svgcanvas")for(;e.nodeName!="foreignObject";){e=e.parentNode;if(!e)return d}var k=B().getCurrentLayer();if([d,a,n,k].indexOf(e)>=0)return d;if($(e).closest("#selectorParentGroup").length)return ra.selectorParentGroup; for(;e.parentNode&&e.parentNode!==(L||k);)e=e.parentNode;return e};(function(){var e=null,k=null,l=null,C=null,A=null,G={},D={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(z){if(!c.spaceKey){var F=z.button===2;mb=n.getScreenCTM().inverse();isBotchedZoom=svgedit.browser.isGecko();var h=N(z.pageX,z.pageY,mb),m=h.x*(isBotchedZoom?1:q);h=h.y*(isBotchedZoom?1:q);z.preventDefault();if(F)Ga="select";m=m/q;h=h/q;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var u= C=k=m,E=A=l=h;if(p.gridSnapping){m=va(m);h=va(h);k=va(k);l=va(l)}if(o==ra.selectorParentGroup&&I[0]!=null){o=z.target;var H=cb(o,"type");if(H=="rotate"){Ga="rotate";current_rotate_mode=cb(o,"dir")}else if(H=="resize"){Ga="resize";db=cb(o,"dir")}o=I[0]}Sa=o.getAttribute("transform");H=R(o);switch(Ga){case "select":Ka=true;db="none";if(F)Ka=false;if(o!=d){if(I.indexOf(o)==-1){z.shiftKey||xa(true);qb([o]);wb=o;La.clear()}if(!F)for(F=0;F 1))if(Ka)if(!(z.button===1||c.spaceKey)){var F=I[0],h=N(z.pageX,z.pageY,mb),m=h.x*(isBotchedZoom?1:q);h=h.y*(isBotchedZoom?1:q);var o=pa(aa()),u=x=m/q,E=y=h/q;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Ga){case "select":if(I[0]!==null){u=x-k;var H=y-l;if(p.gridSnapping){u=va(u);H=va(H)}if(z.shiftKey){var J=V(k,l,x,y);x=J.x;y=J.y}if(u!=0||H!=0){E=I.length;for(var O=0;O0&&c.removeFromSelection(o);u.length>0&&qb(u);break;case "resize":o=R(F);u=(J=oa(o))?G:svgedit.utilities.getBBox(F);E=u.x;O=u.y;var ba=u.width,T=u.height;u=x-k;H=y-l;if(p.gridSnapping){u=va(u);H=va(H);T=va(T);ba=va(ba)}if(X=na(F)){var fa=Math.sqrt(u*u+H*H);H=Math.atan2(H,u)-X*Math.PI/180;u=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)u=0;var ha=fa=0,W=T?(T+H)/T:1,qa=ba?(ba+u)/ba:1;if(db.indexOf("n")>=0){W=T?(T-H)/T:1;ha=T}if(db.indexOf("w")>=0){qa=ba?(ba-u)/ba:1;fa=ba}u=d.createSVGTransform();H=d.createSVGTransform();ba=d.createSVGTransform();if(p.gridSnapping){E=va(E);fa=va(fa);O=va(O);ha=va(ha)}u.setTranslate(-(E+fa),-(O+ha));if(z.shiftKey)if(qa==1)qa=W;else W=qa;H.setScale(qa,W);ba.setTranslate(E+fa,O+ha);if(J){J=X?1:0;o.replaceItem(u,2+J);o.replaceItem(H,1+J);o.replaceItem(ba,0+J)}else{J=o.numberOfItems; o.replaceItem(ba,J-3);o.replaceItem(H,J-2);o.replaceItem(u,J-1)}ra.requestSelector(F).resize();M("transition",I);break;case "zoom":u*=q;E*=q;ma(sa,{x:Math.min(C*q,u),y:Math.min(A*q,E),width:Math.abs(u-C*q),height:Math.abs(E-A*q)},100);break;case "text":ma(o,{x:x,y:y},1E3);break;case "line":u=null;window.opera||d.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=V(k,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||d.unsuspendRedraw(u); break;case "foreignObject":case "square":case "rect":case "image":u=Math.abs(x-k);J=Math.abs(y-l);if(Ga=="square"||z.shiftKey){u=J=Math.max(u,J);E=kl?l+O:l-O}if(z.altKey){J=k;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||d.unsuspendRedraw(u);break;case "fhellipse":case "fhrect":D.minx=Math.min(u, D.minx);D.maxx=Math.max(u,D.maxx);D.miny=Math.min(E,D.miny);D.maxy=Math.max(E,D.maxy);case "fhpath":e+=+u+","+E+" ";o.setAttributeNS(null,"points",e);break;case "path":case "pathedit":x*=q;y*=q;if(p.gridSnapping){x=va(x);y=va(y);k=va(k);l=va(l)}if(z.shiftKey){if(J=svgedit.path.path){o=J.dragging?J.dragging[0]:k;J=J.dragging?J.dragging[1]:l}else{o=k;J=l}J=V(o,J,x,y);x=J.x;y=J.y}if(sa&&sa.getAttribute("display")!=="none"){u*=q;E*=q;ma(sa,{x:Math.min(C*q,u),y:Math.min(A*q,E),width:Math.abs(u-C*q),height:Math.abs(E- A*q)},100)}La.mouseMove(z,x,y);break;case "textedit":x*=q;y*=q;bb.mouseMove(m,h);break;case "rotate":u=svgedit.utilities.getBBox(F);J=u.x+u.width/2;E=u.y+u.height/2;o=ea(F);o=N(J,E,o);J=o.x;E=o.y;o=u.x;O=u.y;if(current_rotate_mode=="nw")o=u.x+u.width;if(current_rotate_mode=="se")O=u.y+u.height;if(current_rotate_mode=="sw"){o=u.x+u.width;O=u.y+u.height}compensation_angle=(Math.atan2(E-O,J-o)*(180/Math.PI)-90)%360;X=(Math.atan2(E-y,J-x)*(180/Math.PI)-90)%360;X+=compensation_angle;if(p.gridSnapping)X= va(X);if(z.shiftKey)X=Math.round(X/45)*45;c.setRotationAngle(X<-180?360+X:X,true);M("transition",I)}ib("mouseMove",{event:z,mouse_x:m,mouse_y:h,selected:F})}}).click(function(z){z.preventDefault();return false}).dblclick(function(z){var F=z.target.parentNode,h=Bb(z),m=h.tagName;if(F!==L){if(m==="text"&&Ga!=="textedit"){z=N(z.pageX,z.pageY,mb);bb.select(h,z.x,z.y)}if((m==="g"||m==="a")&&na(h)){Db(h);h=I[0];xa(true)}L&&Eb();F.tagName!=="g"&&F.tagName!=="a"||F===B().getCurrentLayer()||h===ra.selectorParentGroup|| Kb(h)}}).mouseup(function(z){c.addClones=false;window.removeEventListener("keyup",c.removeClones);I=I.filter(Boolean);if(z.button!==2){var F=wb;wb=null;if(Ka){var h=N(z.pageX,z.pageY,mb),m=h.x*q;h=h.y*q;var o=m/q,u=h/q,E=pa(aa()),H=false;Ka=false;switch(Ga){case "resize":case "multiselect":if(sa!=null){sa.setAttribute("display","none");hb=[]}Ga="select";case "select":if(I[0]!=null){if(I.length==1){m=I[0];switch(m.tagName){case "g":case "use":case "image":case "foreignObject":break;default:Xa.fill= m.getAttribute("fill");Xa.fill_opacity=m.getAttribute("fill-opacity");Xa.stroke=m.getAttribute("stroke");Xa.stroke_opacity=m.getAttribute("stroke-opacity");Xa.stroke_width=m.getAttribute("stroke-width");Xa.stroke_dasharray=m.getAttribute("stroke-dasharray");Xa.stroke_linejoin=m.getAttribute("stroke-linejoin");Xa.stroke_linecap=m.getAttribute("stroke-linecap")}if(m.tagName=="text"){Ua.font_size=m.getAttribute("font-size");Ua.font_family=m.getAttribute("font-family")}ra.requestSelector(m).showGrips(true)}Ea(); C=(m=svgedit.browser.isGecko())?C*q:C;A=m?A*q:A;m=Math.abs(u-A);if(m>1||m>1){z=I.length;for(m=0;m=0?F.indexOf(",",u+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||Ga==="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=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]);H=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]);H=true}break;case "text":H=true;rb([E]);bb.start(E);break;case "path":E=null;Ka=true;F=La.mouseUp(z,E,m,h);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,m,h);break;case "rotate":H=true;E=null;Ga="select";F=c.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}m=ib("mouseUp",{event:z,mouse_x:m,mouse_y:h},true);$.each(m,function(X,ba){if(ba){H=ba.keep||H;E=ba.element;Ka=ba.started||Ka}});if(!H&& E!=null){B().releaseId(aa());E.parentNode.removeChild(E);E=null;for(m=z.target;m.parentNode.parentNode.tagName=="g";)m=m.parentNode;if((Ga!="path"||!drawn_path)&&m.parentNode.id!="selectorParentGroup"&&m.id!="svgcanvas"&&m.id!="svgroot"){c.setMode("select");rb([m],true)}}else if(E!=null){c.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(Ga==="path")La.toEditMode(E);else p.selectNew&&rb([E],true);wa(new Ia(E));M("changed",[E])},z*1E3)}Sa=null}}});$(a).bind("mousewheel DOMMouseScroll",function(z){if(z.shiftKey){z.preventDefault();mb=n.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(k){k.preventDefault()})},bb=c.textActions=function(){function e(T){var fa=h.value==="";$(h).focus();if(!arguments.length)if(fa)T=0;else{if(h.selectionEnd!==h.selectionStart)return;T=h.selectionEnd}var ha;ha=E[T];fa||h.setSelectionRange(T,T);m=pa("text_cursor");if(!m){m=document.createElementNS(b,"line");ma(m,{id:"text_cursor",stroke:"#333","stroke-width":1});m=pa("selectorParentGroup").appendChild(m)}u|| (u=setInterval(function(){var W=m.getAttribute("display")==="none";m.setAttribute("display",W?"inline":"none")},600));fa=G(ha.x,H.y);ha=G(ha.x,H.y+H.height);ma(m,{x1:fa.x,y1:fa.y,x2:ha.x,y2:ha.y,visibility:"visible",display:"inline"});o&&o.setAttribute("d","M 0 0")}function k(T,fa,ha){if(T===fa)e(fa);else{ha||h.setSelectionRange(T,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)}T= E[T];var W=E[fa];m.setAttribute("visibility","hidden");fa=G(T.x,H.y);ha=G(T.x+(W.x-T.x),H.y);var qa=G(T.x,H.y+H.height);T=G(T.x+(W.x-T.x),H.y+H.height);ma(o,{d:"M"+fa.x+","+fa.y+" L"+ha.x+","+ha.y+" "+T.x+","+T.y+" "+qa.x+","+qa.y+"z",display:"inline"})}}function l(T,fa){var ha=d.createSVGPoint();ha.x=T;ha.y=fa;if(E.length==1)return 0;ha=F.getCharNumAtPosition(ha);if(ha<0){ha=E.length-2;if(T<=E[0].x)ha=0}else if(ha>=E.length-2)ha=E.length-2;var W=E[ha];T>W.x+W.width/2&&ha++;return ha}function C(T, fa,ha){var W=h.selectionStart;T=l(T,fa);k(Math.min(W,T),Math.max(W,T),!ha)}function A(T,fa){var ha={x:T,y:fa};ha.x/=q;ha.y/=q;if(J){var W=N(ha.x,ha.y,J.inverse());ha.x=W.x;ha.y=W.y}return ha}function G(T,fa){var ha={x:T,y:fa};if(J){var W=N(ha.x,ha.y,J);ha.x=W.x;ha.y=W.y}ha.x*=q;ha.y*=q;return ha}function D(T){k(0,F.textContent.length);$(this).unbind(T)}function z(T){if(ba&&F){var fa=N(T.pageX,T.pageY,mb);fa=A(fa.x*q,fa.y*q);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);k(W,(ha?ha[0].length:0)+fa);$(T.target).click(D);setTimeout(function(){$(T.target).unbind("click",D)},300)}}var F,h,m,o,u,E=[],H,J,O,X,ba;return{select:function(T,fa,ha){F=T;bb.toEditMode(fa,ha)},start:function(T){F=T;bb.toEditMode()},mouseDown:function(T,fa,ha,W){T=A(ha,W);h.focus();e(l(T.x,T.y));O=ha;X=W},mouseMove:function(T,fa){var ha=A(T,fa);C(ha.x,ha.y)},mouseUp:function(T,fa,ha){var W=A(fa,ha);C(W.x,W.y,true);T.target!==F&&faO-2&&ha< X+2&&ha>X-2&&bb.toSelectMode(true)},setCursor:e,toEditMode:function(T,fa){rb([F],false);ba=false;Ga="textedit";ra.requestSelector(F).showGrips(false);ra.requestSelector(F);bb.init();$(F).css("cursor","text");if(arguments.length){var ha=A(T,fa);e(l(ha.x,ha.y))}else e();setTimeout(function(){ba=true},300)},toSelectMode:function(T){Ga="select";clearInterval(u);u=null;o&&$(o).attr("display","none");m&&$(m).attr("visibility","hidden");$(F).css("cursor","move");if(T){xa();$(F).css("cursor","move");M("selected", [F]);qb([F],true)}F&&!F.textContent.length&&c.deleteSelectedElements();$(h).blur();F=false},setInputElem:function(T){h=T},clear:function(){Ga=="textedit"&&bb.toSelectMode()},init:function(){if(F){if(!F.parentNode){F=I[0];ra.requestSelector(F).showGrips(false)}var T=F.textContent.length,fa=F.getAttribute("transform");H=svgedit.utilities.getBBox(F);J=fa?ea(F):null;E=Array(T);h.focus();$(F).unbind("dblclick",z).dblclick(z);if(!T)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--;){h=this.segs[this.selected_pts[z]];h.select(true);D[z]=h.ptgrip}La.canDeleteNodes=true;La.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);M("selected",D)};var A=k=null,G=false;this.lastCtrlPoint=[0,0];return{mouseDown:function(D, z,F,h){if(Ga==="path"){mouse_x=F;mouse_y=h;F=mouse_x/q;z=mouse_y/q;h=pa("path_stretch_line");l=[F,z];if(p.gridSnapping){F=va(F);z=va(z);mouse_x=va(mouse_x);mouse_y=va(mouse_y)}if(!h){h=document.createElementNS(b,"path");ma(h,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});h=pa("selectorParentGroup").appendChild(h)}h.setAttribute("display","inline");this.stretchy=h;var m=null;if(A){m=A.pathSegList;for(var o=m.numberOfItems,u=6/q,E=false;o;){o--;var H=m.getItem(o),J=H.x;H=H.y; if(F>=J-u&&F<=J+u&&z>=H-u&&z<=H+u){E=true;break}}u=aa();svgedit.path.removePath_(u);u=pa(u);J=m.numberOfItems;if(E){if(o<=1&&J>=2){F=m.getItem(0).x;z=m.getItem(0).y;o=svgedit.path.first_grip?svgedit.path.first_grip[0]/q:m.getItem(0).x;E=svgedit.path.first_grip?svgedit.path.first_grip[1]/q:m.getItem(0).y;D=h.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(F,z):A.createSVGPathSegCurvetoCubicAbs(F,z,D.x1/q,D.y1/q,o,E);F=A.createSVGPathSegClosePath();m.appendItem(D);m.appendItem(F)}else if(J< 3)return m=false;$(h).remove();element=u;A=null;Ka=false;if(e){svgedit.path.path.matrix&&Za(u,{},svgedit.path.path.matrix.inverse());F=u.getAttribute("d");h=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",h+F);$(u).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}m=A.pathSegList.numberOfItems; o=A.pathSegList.getItem(m-1);u=o.x;o=o.y;if(D.shiftKey){z=V(u,o,F,z);F=z.x;z=z.y}D=h.pathSegList.getItem(1);D=D.pathSegType===4?A.createSVGPathSegLinetoAbs(ab(F),ab(z)):A.createSVGPathSegCurvetoCubicAbs(ab(F),ab(z),D.x1/q,D.y1/q,D.x2/q,D.y2/q);A.pathSegList.appendItem(D);F*=q;z*=q;h.setAttribute("d",["M",F,z,F,z].join(" "));h=svgedit.path.addCtrlGrip("1c1");D=svgedit.path.addCtrlGrip("0c2");u=svgedit.path.getCtrlLine(1);o=svgedit.path.getCtrlLine(2);h.setAttribute("cx",F);h.setAttribute("cy",z);D.setAttribute("cx", F);D.setAttribute("cy",z);u.setAttribute("x1",F);u.setAttribute("x2",F);u.setAttribute("y1",z);u.setAttribute("y2",z);o.setAttribute("x1",F);o.setAttribute("x2",F);o.setAttribute("y1",z);o.setAttribute("y2",z);h=m;if(e)h+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(h,F,z)}m=true}else{d_attr="M"+F+","+z+" ";A=S({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});h.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));h=e?svgedit.path.path.segs.length: 0;svgedit.path.addPointGrip(h,mouse_x,mouse_y);svgedit.path.first_grip=null}}else if(svgedit.path.path){svgedit.path.path.storeD();u=D.target.id;if(u.substr(0,14)=="pathpointgrip_"){z=svgedit.path.path.cur_pt=parseInt(u.substr(14));svgedit.path.path.dragging=[F,h];u=svgedit.path.path.segs[z];if(D.shiftKey)u.selected?svgedit.path.path.removePtFromSelection(z):svgedit.path.path.addPtsToSelection(z);else{if(svgedit.path.path.selected_pts.length<=1||!u.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(z)}}else if(u.indexOf("ctrlpointgrip_")== 0){svgedit.path.path.dragging=[F,h];D=u.split("_")[1].split("c");z=D[0]-0;m=D=D[1]-0;o=svgedit.path.path.segs[z];svgedit.path.path.selectPt(z,D);if(m==2){E=1;u=o.next}else{E=2;u=o.prev}if(!u)return;D=function(O,X){return Math.sqrt(Math.pow(O.x-X.x,2)+Math.pow(O.y-X.y,2))};z={x:o.item["x"+m],y:o.item["y"+m]};m=m==2?{x:o.item.x,y:o.item.y}:{x:u.item.x,y:u.item.y};o={x:u.item["x"+E],y:u.item["y"+E]};u=D(z,m);D=D(o,m);z=Math.abs(Math.round(Math.atan2(z.y-m.y,z.x-m.x)*(180/Math.PI),0)-Math.round(Math.atan2(o.y- m.y,o.x-m.x)*(180/Math.PI),0))==180;if(Math.abs(u-D)<5&&z){svgedit.path.setLinkControlPoints(true);svgedit.path.is_linked=true}else{svgedit.path.setLinkControlPoints(false);svgedit.path.is_linked=false}}if(!svgedit.path.path.dragging){if(sa==null)sa=ra.getRubberBandBox();ma(sa,{x:F*q,y:h*q,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;var h=!D.altKey;if(Ga==="path"){if(A){var m=A.pathSegList,o=m.numberOfItems-1,u=svgedit.path.addCtrlGrip("1c1"),E=svgedit.path.addCtrlGrip("0c2"); if(l){var H=E.getAttribute("cx")/q||0,J=E.getAttribute("cy")/q||0;u.setAttribute("cx",z);u.setAttribute("cy",F);u.setAttribute("display","inline");D=l[0];u=l[1];m.getItem(o);var O=z/q,X=F/q;H=h?D+(D-O):H;h=h?u+(u-X):J;E.setAttribute("cx",H*q);E.setAttribute("cy",h*q);E.setAttribute("display","inline");E=svgedit.path.getCtrlLine(1);J=svgedit.path.getCtrlLine(2);ma(E,{x1:z,y1:F,x2:D*q,y2:u*q,display:"inline"});ma(J,{x1:H*q,y1:h*q,x2:D*q,y2:u*q,display:"inline"});if(o===0)C=[z,F];else{m=m.getItem(o- 1);z=m.x;F=m.y;if(m.pathSegType===6){z+=z-m.x2;F+=F-m.y2}else if(C){z=C[0]/q;F=C[1]/q}svgedit.path.replacePathSeg(6,o,[D,u,this.lastCtrlPoint[0]/q,this.lastCtrlPoint[1]/q,H,h],A)}}else if(h=this.stretchy){o=m.getItem(o);m=z;u=F;if(D.target.id==="pathpointgrip_0"&&svgedit.path.first_grip){m=svgedit.path.first_grip[0];u=svgedit.path.first_grip[1]}if(o.pathSegType===6)svgedit.path.replacePathSeg(6,1,[z,F,(this.lastCtrlPoint[0]/q||o.x+(o.x-o.x2))*q,(this.lastCtrlPoint[1]/q||o.y+(o.y-o.y2))*q,m,u],h); else C?svgedit.path.replacePathSeg(6,1,[z,F,C[0],C[1],z,F],h):svgedit.path.replacePathSeg(4,1,[z,F],h)}}}else if(svgedit.path.path.dragging){m=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);D=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);o=D.x-m.x;m=D.y-m.y;svgedit.path.path.dragging=[z,F];!h||!svgedit.path.is_linked?svgedit.path.setLinkControlPoints(false):svgedit.path.setLinkControlPoints(true);svgedit.path.path.dragctrl? svgedit.path.path.moveCtrl(o,m):svgedit.path.path.movePts(o,m)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var ba=sa.getBBox(),T=svgedit.path.getGripPt(this);ba=svgedit.math.rectsIntersect(ba,{x:T.x,y:T.y,width:0,height:0});this.select(ba);ba&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(D,z,F,h){var m=pa("ctrlpointgrip_1c1"),o=pa("ctrlpointgrip_0c2");this.lastCtrlPoint=m?[m.getAttribute("cx"),m.getAttribute("cy")]: [F,h];if(!svgedit.path.first_grip&&o)svgedit.path.first_grip=[o.getAttribute("cx"),o.getAttribute("cy")];if(Ga==="path"){l=null;if(!A){z=pa(aa());Ka=false;C=null}return{keep:true,element:z}}if(svgedit.path.path.dragging){z=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(z)}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);Ga="pathedit";xa();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;Ga="select";svgedit.path.path.show(false);k=false;xa();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath(); if(z){M("selected",[D]);qb([D],true)}},addSubPath:function(D){if(D){Ga="path";e=true}else{La.clear(true);La.toEditMode(svgedit.path.path.elem)}},select:function(D){if(k===D){La.toEditMode(D);Ga="pathedit"}else k=D},reorient:function(){var D=I[0];if(D)if(na(D)!=0){var z=new Da("Reorient path"),F={d:D.getAttribute("d"),transform:D.getAttribute("transform")};z.addSubCommand(new Ma(D,F));xa();this.resetOrientation(D);wa(z);svgedit.path.getPath_(D).show(false).matrix=null;this.clear();qb([D],true);M("changed", I)}},clear:function(D){k=null;if(A){var z=pa(aa());$(pa("path_stretch_line")).remove();D&&$(z).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=C=null;Ka=false}else Ga=="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=R(D),F=Y(z).matrix;z.clear();D.removeAttribute("transform");z=D.pathSegList;for(var h=z.numberOfItems,m=0;m0){u=h.getItem(m-1).pathSegType;if(u===2){o(m-1,1);F();break}else if(u===1&&h.numberOfItems-1===m){o(m,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<= 1){c.setMode("select");c.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 h=z.getItem(0),m=null;D=[];D.push(["M",h.x,",",h.y," C"].join(""));for(var o=1;o<=F-4;o+=3){var u=z.getItem(o),E=z.getItem(o+1),H=z.getItem(o+2);if(m)if((h=svgedit.path.smoothControlPoints(m, u,h))&&h.length==2){u=D[D.length-1].split(",");u[2]=h[0].x;u[3]=h[0].y;D[D.length-1]=u.join(",");u=h[1]}D.push([u.x,u.y,E.x,E.y,H.x,H.y].join(","));h=H;m=E}for(D.push("L");o0;);La.clear(true);$.each(n.childNodes,function(l,C){l&&C.nodeType===8&&C.data.indexOf("Created with")>=0&&n.insertBefore(C,n.firstChild)}); if(L){Eb();rb([L])}$("#canvasGrid").attr("display","none");var e=[];$(n).find("g:data(gsvg)").each(function(){for(var l=this.attributes,C=l.length,A=0;A=0;F--){z=D.item(F);o=C(z.nodeValue);if(!(u.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||ya[z.namespaceURI]){l.push(z.nodeName);l.push('="');l.push(o);l.push('"')}}}}if(e.hasChildNodes()){l.push(">");k++;D=false;for(F=0;F");break;case 8:l.push("\n");l.push(Array(k+1).join(" "));l.push("