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 d=w.type!=="keypress"&&a.hotkeys.specialKeys[w.which],f=String.fromCharCode(w.which).toLowerCase(),c="",m={};if(w.altKey&&d!=="alt")c+="alt+";if(w.ctrlKey&&d!=="ctrl")c+="ctrl+";if(w.metaKey&&!w.ctrlKey&&d!=="meta")c+="meta+";if(w.shiftKey&&d!=="shift")c+="shift+";if(d)m[c+d]= true;else{m[c+f]=true;m[c+a.hotkeys.shiftNums[f]]=true;if(c==="shift+")m[a.hotkeys.shiftNums[f]]=true}d=0;for(f=p.length;d","/":"?","\\":"|"}};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=c.call(arguments,1);return function(){return ca.apply(this,U.concat(c.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,m)}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 d(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,c=Array.prototype.slice,m=decodeURIComponent,v=a.param,C,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]=C=b(p,1,function(ca){return ca.replace(/^[^#]*#?(.*)$/,"$1")});C.noEscape=function(ca){ca=ca||"";ca=a.map(ca.split(""),encodeURIComponent);Ba=RegExp(ca.join("|"),"g")};C.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=m(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=m(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[d][f])};K=function(S,R){if(S!==R){var N=Q.document;N.open().close();N[d].hash="#"+S}};K(b())}}var q={},L,Q,K,I;q.start=function(){if(!L){var S=b();K||C();(function R(){var N=b(),ga=I(S);if(N!==S){K(S=N,ga);a(s).trigger("hashchange")}else if(ga!==S)s[d][f]=s[d][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||d()},500);else{Z=oa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";K=a(new Image).attr({src:Z,width:0,height:0}).appendTo("body").load(function(){d(true)}).error(function(){d()})}} function d(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:C,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&&d(false,p.fallback)} function c(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){d(this);Va=cb;S.mousemove(m).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:C.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&&d(Ea);return da}function d(ia){cb&&cb.setAttribute("stroke","#000");ia.setAttribute("stroke","blue");cb=ia;cb.parentNode.appendChild(cb)}function f(){S.unbind("mousemove",m);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 c(){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 m(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('

    '+C.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 C.newstop;if(ma==="string")switch(C.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,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);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",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;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;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(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&&c();break;case "angle":Sa=M;P=Sa/180;P+=0.5;P*=145;da&&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":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}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=(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:C.window.pickerTitle},images:{clientPath:C.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(),d=$("#"+g.menu);d.addClass("contextMenu");$(this).bind("mousedown",function(c){$(this).on("mouseup",function(m){var v=$(this);v.unbind("mouseup");$(".contextMenu").hide();if(c.button===2|| g.allowLeft||c.ctrlKey&&svgedit.browser.isMac())svgedit.browser.isTouch()||f(m,c,v)})});svgedit.browser.isTouch()&&$(this).bind("taphold",function(c){var m=$(this);m.unbind("mouseup");f(c,c,m)});var f=function(c,m,v){if(typeof m=="undefined")m=c;c.stopPropagation();if(p.hasClass("disabled")||m.altKey)return false;var C=c.pageX,q=c.pageY;if(svgedit.browser.isTouch()){C=c.originalEvent.touches[0].pageX;q=c.originalEvent.touches[0].pageY}c=a.width()-d.width();m=a.height()-d.height();if(C>c-15)C=c-15; if(q>m-30)q=m-30;if(svgedit.browser.isTouch())q-=d.height()/2;s.unbind("click");d.css({top:q,left:C}).fadeIn(g.inSpeed);d.find("A").mouseover(function(){d.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){d.find("LI.hover").removeClass("hover")});s.keypress(function(L){switch(L.keyCode){case 38:if(d.find("LI.hover").length){d.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover");d.find("LI.hover").length||d.find("LI:last").addClass("hover")}else d.find("LI:last").addClass("hover"); break;case 40:if(d.find("LI.hover").length==0)d.find("LI:first").addClass("hover");else{d.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");d.find("LI.hover").length||d.find("LI:first").addClass("hover")}break;case 13:d.find("LI.hover A").trigger("click");break;case 27:s.trigger("click")}});d.find("A").unbind("mouseup");d.find("LI:not(.disabled) A").mouseup(function(){s.unbind("click").unbind("keypress");$(".contextMenu").hide();b&&b($(this).attr("href").substr(1), $(v),{x:C-w.left,y:q-w.top,docX:C,docY:q});return false});setTimeout(function(){s.click(function(){s.unbind("click").unbind("keypress");d.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,d=s.indexOf("MSIE")>=0,f=s.indexOf("Chrome/")>=0,c=s.indexOf("Windows")>=0,m=s.indexOf("Macintosh")>= 0,v="ontouchstart"in window,C=!!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 d};svgedit.browser.isChrome=function(){return f};svgedit.browser.isWindows=function(){return c};svgedit.browser.isMac=function(){return m};svgedit.browser.isTouch=function(){return v};svgedit.browser.supportsSelectors=function(){return C};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),d=0;d1;)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 d={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;d=g(d.x,d.y,w);var c=p=d.x,m=d.y,v=d.y;f=g(f.x,f.y,w);p=Math.min(p,f.x);c=Math.max(c,f.x); m=Math.min(m,f.y);v=Math.max(v,f.y);s=g(s.x,s.y,w);p=Math.min(p,s.x);c=Math.max(c,s.x);m=Math.min(m,s.y);v=Math.max(v,s.y);b=g(b.x,b.y,w);p=Math.min(p,b.x);c=Math.max(c,b.x);m=Math.min(m,b.y);v=Math.max(v,b.y);return{tl:d,tr:f,bl:s,br:b,aabox:{x:p,y:m,width:c-p,height:v-m}}};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(d){b=d;d=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(d);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width","1em");f.setAttribute("height","1ex");f.setAttribute("x","1in");d.appendChild(f);f=f.getBBox();document.body.removeChild(d); d=f.x;p.em=f.width;p.ex=f.height;p["in"]=d;p.cm=d/2.54;p.mm=d/25.4;p.pt=d/72;p.pc=d/6;p["%"]=0};svgedit.units.getTypeMap=function(){return p};svgedit.units.shortFloat=function(d){var f=b.getRoundDigits();if(isNaN(d)){if($.isArray(d))return svgedit.units.shortFloat(d[0])+","+svgedit.units.shortFloat(d[1])}else return+(+d).toFixed(f);return parseFloat(d).toFixed(f)-0};svgedit.units.convertUnit=function(d,f){f=f||b.getBaseUnit();return svgedit.unit.shortFloat(d/p[f])};svgedit.units.setUnitAttr=function(d, f,c){isNaN(c)||d.getAttribute(f);d.setAttribute(f,c)};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(d){var f=d.tagName,c=b.getBaseUnit();if(f=w[f])for(var m=f.length,v=0;v=0?c*m:s.indexOf(d)>=0?c*v:c*Math.sqrt(m*m+v*v)/Math.sqrt(2)}else{m=f.substr(-2);c=f.substr(0,f.length-2);return c*p[m]}};svgedit.units.isValidUnit=function(d,f,c){var m=false;if(g.indexOf(d)>=0)if(isNaN(f)){f=f.toLowerCase();$.each(p,function(q){if(!m)if(RegExp("^-?[\\d\\.]+"+q+"$").test(f))m=true})}else m=true;else if(d=="id"){d=false;try{var v=b.getElement(f); d=v==null||v===c}catch(C){}return d}else m=true;return m}})();svgedit=svgedit||{}; (function(){function a(d){if(svgedit.browser.supportsHVLineContainerBBox())try{return d.getBBox()}catch(f){}var c=$.data(d,"ref"),m=null;if(c){var v=$(c).children().clone().attr("visibility","hidden");$(w).append(v);m=v.filter("line, path")}else m=$(d).find("line, path");var C=false;if(m.length){m.each(function(){var q=this.getBBox();if(!q.width||!q.height)C=true});if(C){d=c?v:$(d).children();ret=getStrokedBBox(d)}else ret=d.getBBox()}else ret=d.getBBox();c&&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(d){g=d;b=d.getDOMDocument();p=d.getDOMContainer();w=d.getSVGRoot()};svgedit.utilities.toXml=function(d){return $("

    ").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,v,C,q,L,Q=0,K=0;do{c=d.charCodeAt(Q++);m=d.charCodeAt(Q++);v=d.charCodeAt(Q++);C=c>>2;c=(c&3)<<4|m>>4;q=(m&15)<<2|v>>6;L=v&63;if(isNaN(m))q=L=64;else if(isNaN(v))L=64;f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(C);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(c);f[K++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q);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,v="",C,q="",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++));q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(d.charAt(L++)); c=c<<2|m>>4;m=(m&15)<<4|C>>2;v=(C&3)<<6|q;f+=String.fromCharCode(c);if(C!=64)f+=String.fromCharCode(m);if(q!=64)f+=String.fromCharCode(v)}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(v){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){if(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), v=[m.x,m.y];for(m=0;m=0){var m=c.split(":");d[m[1]]=s[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 w=p.parentNode;if(p.ownerDocument&&w){var d=g[p.nodeName],f=b[p.nodeName];if(d!= undefined){for(var c=[],m=p.attributes.length;m--;){var v=p.attributes.item(m),C=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])){C.indexOf("se:")==0&&c.push([C,v.nodeValue]);p.removeAttributeNS(L,q)}if(svgedit.browser.isGecko())switch(C){case "transform":case "gradientTransform":case "patternTransform":q=v.nodeValue.replace(/(\d)-/g,"$1 -");p.setAttribute(C,q)}if(C=="style"){v= v.nodeValue.split(";");for(C=v.length;C--;){q=v[C].split(":");d.indexOf(q[0])>=0&&p.setAttribute(q[0],q[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))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(m=p.childNodes.length;m--;)svgedit.sanitize.sanitizeSvg(p.childNodes.item(m))}}else{for(d=[];p.hasChildNodes();)d.push(w.insertBefore(p.firstChild,p));w.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,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 d=s[b];if(d!=null){w[b]=d;p[b]=d.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 d={};d[b]=s.oldValues[g];d[b]!=w.getAttribute(b)&&p.addSubCommand(new svgedit.history.ChangeElementCommand(w,d,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,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 v=d.tagName;if(v==="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(v==="g"&&!$.data(d,"gsvg"))if(v=a.getStrokedBBox(d.childNodes))C=v;v=C.x;var q=C.y,L=C.width;C=C.height;m*=c;c=svgedit.math.transformBox(v*c,q*c,L*c,C*c,f);f=c.aabox;v=f.x-m;q=f.y-m;L=f.width+m*2;var Q=f.height+m*2;f=v+L/2;C=q+Q/2;if(d=svgedit.utilities.getRotationAngle(d)){v=a.svgRoot().createSVGTransform(); v.setRotate(-d,f,C);v=v.matrix;c.tl=svgedit.math.transformPoint(c.tl.x,c.tl.y,v);c.tr=svgedit.math.transformPoint(c.tr.x,c.tr.y,v);c.bl=svgedit.math.transformPoint(c.bl.x,c.bl.y,v);c.br=svgedit.math.transformPoint(c.br.x,c.br.y,v);v=c.tl;L=v.x;Q=v.y;var K=v.x,I=v.y;v=Math.min;q=Math.max;L=v(L,v(c.tr.x,v(c.bl.x,c.br.x)))-m;Q=v(Q,v(c.tr.y,v(c.bl.y,c.br.y)))-m;K=q(K,q(c.tr.x,q(c.bl.x,c.br.x)))+m;I=q(I,q(c.tr.y,q(c.bl.y,c.br.y)))+m;v=L;q=Q;L=K-L;Q=I-Q}m=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",d?"rotate("+[d,f,C].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(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("+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"}}),d=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"}}), c=a.createSVGElement({element:"rect",attr:{x:5,y:5,width:5,height:5,fill:"#eee"}}),m=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(d);w.appendChild(f);w.appendChild(c);b.appendChild(m);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=[],d=null,f=false,c=0;c0||!f){for(c=1;w.indexOf("Layer "+c)>=0;)c++;w="Layer "+c;d=b.createElementNS("http://www.w3.org/2000/svg","g");f=b.createElementNS("http://www.w3.org/2000/svg","title");f.textContent=w; d.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,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){q=f[v];q.next=f[v+1];q.next.prev=q;q.addGrip()}v=m}else if(q&&q.type===1){C.next=f[v+1];C.next.prev=C;C.mate=f[v];C.addGrip();if(this.first_seg==null)this.first_seg=C}else if(q){if(C.type!== 1){C.addGrip();if(q&&q.type!==2){C.next=q;C.next.prev=C}}}else if(C.type!==1){q=f[v];q.next=f[v+1];q.next.prev=q;q.addGrip();C.addGrip();if(!this.first_seg)this.first_seg=f[v]}}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: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(c);var e=f.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");m.appendChild(e)})();var v="svg_";d.setIdPrefix= function(e){v=e};d.current_drawing_=new svgedit.draw.Drawing(m,v);var C=d.getCurrentDrawing=function(){return d.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 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,Y=d.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 m.getAttribute("height")/q},getWidth:function(){return m.getAttribute("width")/q},getRoundDigits:function(){return $a.round_digits}});var Ba=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, ca=d.getHref=svgedit.utilities.getHref,U=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,ya=svgedit.sanitize.getNSMap(),za=d.sanitizeSvg=svgedit.sanitize.sanitizeSvg,Ja=svgedit.history.MoveElementCommand,Ia=svgedit.history.InsertElementCommand, Ha=svgedit.history.RemoveElementCommand,Ma=svgedit.history.ChangeElementCommand,Da=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== Ia.type()||B==Ha.type()){h.parent==m&&d.identifyLayers();if(B==Ia.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 q},getStrokedBBox:function(e){return d.getStrokedBBox([e])}});var ra=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return q},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 u=k.getAttribute("rx"),E=k.getAttribute("ry");if(u||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(X){console.log(k,X)}},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 u=z(n);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(k,n){var o=F[k];if(o&&n.nodeType==1){var u=z(n);B=Math.max(B,o.x+o.width+u);A=Math.max(A,o.y+o.height+u)}});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,Y(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 Ea=this.recalculateAllSelectedDimensions=function(){for(var e=new Da(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&& 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=Y(e).matrix;D=ga(D.inverse(),l,D);h.x=parseFloat(h.x)+ D.e;h.y=parseFloat(h.y)+D.f}else{D=R(e);z=c.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=c.createSVGTransform();z.setMatrix(ga(Y(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=Ba("x",e.getAttribute("x"));z=Ba("x",l[G].getAttribute("x")); F=Ba("y",e.getAttribute("y"));k=Ba("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&&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 Da("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,X=h.getItem(E-1).matrix;F=e.childNodes;for(n=F.length;n--;){var ba=F.item(n);B=G=0;if(ba.nodeType==1){var T=R(ba);if(T){B=Y(T).matrix;G=na(ba);var fa=Sa,ha=[];Sa=ba.getAttribute("transform");if(G||oa(T)){var W=c.createSVGTransform();W.setMatrix(ga(J,O,X,B));T.clear();T.appendItem(W); ha.push(W)}else{G=ga(B.inverse(),X,B);W=c.createSVGMatrix();W.e=-G.e;W.f=-G.f;B=ga(W.inverse(),B.inverse(),J,O,X,B,G.inverse());var qa=c.createSVGTransform(),ua=c.createSVGTransform(),Aa=c.createSVGTransform();qa.setTranslate(G.e,G.f);ua.setScale(B.a,B.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}}}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=Y(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=Y(h).matrix;h.removeItem(0);B=Y(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--;){ba=F.item(n);if(ba.nodeType==1){if(ba.getAttribute("clip-path")){fa=ba.getAttribute("clip-path");if(E.indexOf(fa)===-1){nb(fa,G,B);E.push(fa)}}fa=Sa;Sa=ba.getAttribute("transform");if(T=R(ba)){J=c.createSVGTransform();J.setTranslate(G, B);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=c.createSVGTransform();X.setTranslate(-G,-B);R(O).insertItemBefore(X,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--;){ba=F.item(n);if(ba.nodeType==1){fa=Sa;Sa=ba.getAttribute("transform");if(T=R(ba)){G=ga(B,Y(T).matrix); E=c.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))}}}h.clear()}else{if(A){o=c.createSVGTransform();o.setRotate(A,u.x,u.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}h.numberOfItems==0&&e.removeAttribute("transform");return null}if(k==2){if(A){u={x:o.x+H.e,y:o.y+H.f};o=c.createSVGTransform(); o.setRotate(A,u.x,u.y);h.numberOfItems?h.insertItemBefore(o,0):h.appendItem(o)}}else if(k==3){B=Y(h).matrix;H=c.createSVGTransform();H.setRotate(A,o.x,o.y);H=H.matrix;o=c.createSVGTransform();o.setRotate(A,u.x,u.y);u=o.matrix.inverse();fa=B.inverse();u=ga(fa,u,H,B);G=u.e;B=u.f;if(G!=0||B!=0){F=e.childNodes;for(n=F.length;n--;){ba=F.item(n);if(ba.nodeType==1){fa=Sa;Sa=ba.getAttribute("transform");T=R(ba);J=c.createSVGTransform();J.setTranslate(G,B);T.numberOfItems?T.insertItemBefore(J,0):T.appendItem(J); l.addSubCommand(Ra(ba));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};u=N(A.x+A.width/2,A.y+A.height/2,Y(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=Y(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=Y(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=Y(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=Y(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){xa(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;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&&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:q);k=k.y*(isBotchedZoom?1:q);z.preventDefault();if(F)Ga="select";n=n/q;k=k/q;var o=Bb(z);if(o.tagName==="a"&&o.childNodes.length===1)o=o.firstChild;var u=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"){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!=c){if(I.indexOf(o)==-1){z.shiftKey||xa(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:q);k=k.y*(isBotchedZoom?1:q);var o=pa(aa()),u=x=n/q,E=y=k/q;if(p.gridSnapping){x=va(x);y=va(y)}z.preventDefault();switch(Ga){case "select":if(I[0]!==null){u=x-h;var H=y-l;if(p.gridSnapping){u=va(u);H=va(H)}if(z.shiftKey){var J=V(h,l,x,y);x=J.x;y=J.y}if(u!=0||H!=0){E=I.length;for(var O=0;O0&&d.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-h;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=c.createSVGTransform();H=c.createSVGTransform();ba=c.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(B*q,u),y:Math.min(A*q,E),width:Math.abs(u-B*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||c.suspendRedraw(1E3);if(p.gridSnapping){x=va(x);y=va(y)}E=x;J=y;if(z.shiftKey){J=V(h,l,E,J);E=J.x;J=J.y}o.setAttributeNS(null,"x2",E);o.setAttributeNS(null,"y2",J);window.opera||c.unsuspendRedraw(u);break;case "foreignObject":case "square":case "rect":case "image":u= Math.abs(x-h);J=Math.abs(y-l);if(Ga=="square"||z.shiftKey){u=J=Math.max(u,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(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);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=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(B*q,u),y:Math.min(A*q,E),width:Math.abs(u-B*q),height:Math.abs(E-A*q)},100)}La.mouseMove(z,x,y);break;case "textedit":x*= q;y*=q;bb.mouseMove(n,k);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;d.setRotationAngle(X< -180?360+X:X,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,k=Bb(z),n=k.tagName;if(F!==L){if(n==="text"&&Ga!=="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=I[0];xa(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*q;k=k.y*q;var o=n/q,u=k/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){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)}Ea();B=(n=svgedit.browser.isGecko())?B*q:B;A=n?A*q:A;n=Math.abs(u-A);if(n>1||n>1){z=I.length;for(n= 0;n=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,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;Ga="select";F=d.undoMgr.finishUndoableChange();F.isEmpty()||wa(F);Ea();M("changed",I)}n=ib("mouseUp",{event:z,mouse_x:n,mouse_y:k},true);$.each(n,function(X,ba){if(ba){H=ba.keep||H;E=ba.element;Ka=ba.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((Ga!="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(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=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(T){var fa=k.value==="";$(k).focus();if(!arguments.length)if(fa)T=0;else{if(k.selectionEnd!==k.selectionStart)return;T=k.selectionEnd}var ha;ha=E[T];fa||k.setSelectionRange(T,T);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)}u||(u=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(T,fa,ha){if(T===fa)e(fa);else{ha||k.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];n.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=c.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 B(T,fa,ha){var W=k.selectionStart;T=l(T,fa);h(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){h(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);h(W,(ha?ha[0].length:0)+fa);$(T.target).click(D); setTimeout(function(){$(T.target).unbind("click",D)},300)}}var F,k,n,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);k.focus();e(l(T.x,T.y));O=ha;X=W},mouseMove:function(T,fa){var ha=A(T,fa);B(ha.x,ha.y)},mouseUp:function(T,fa,ha){var W=A(fa,ha);B(W.x,W.y,true);T.target!==F&&faO-2&&haX-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");n&&$(n).attr("visibility","hidden");$(F).css("cursor","move");if(T){xa();$(F).css("cursor","move");M("selected",[F]);qb([F],true)}F&&!F.textContent.length&&d.deleteSelectedElements();$(k).blur();F=false}, setInputElem:function(T){k=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);k.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--;){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;this.lastCtrlPoint=[0,0];return{mouseDown:function(D,z,F,k){if(Ga==="path"){mouse_x=F;mouse_y=k;F=mouse_x/q;z=mouse_y/q;k=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(!k){k=document.createElementNS(b,"path");ma(k,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});k=pa("selectorParentGroup").appendChild(k)}k.setAttribute("display","inline");this.stretchy=k;var n=null;if(A){n=A.pathSegList;for(var o=n.numberOfItems,u=6/q,E=false;o;){o--;var H=n.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=n.numberOfItems;if(E){if(o<=1&&J>=2){F=n.getItem(0).x;z=n.getItem(0).y;o=svgedit.path.first_grip?svgedit.path.first_grip[0]/q:n.getItem(0).x;E=svgedit.path.first_grip?svgedit.path.first_grip[1]/q:n.getItem(0).y;D=k.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();n.appendItem(D);n.appendItem(F)}else if(J<3)return n=false;$(k).remove();element=u;A=null;Ka=false;if(e){svgedit.path.path.matrix&& Za(u,{},svgedit.path.path.matrix.inverse());F=u.getAttribute("d");k=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",k+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}n=A.pathSegList.numberOfItems;o=A.pathSegList.getItem(n-1);u=o.x;o=o.y;if(D.shiftKey){z=V(u,o,F,z); F=z.x;z=z.y}D=k.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;k.setAttribute("d",["M",F,z,F,z].join(" "));k=svgedit.path.addCtrlGrip("1c1");D=svgedit.path.addCtrlGrip("0c2");u=svgedit.path.getCtrlLine(1);o=svgedit.path.getCtrlLine(2);k.setAttribute("cx",F);k.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);k=n;if(e)k+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(k,F,z)}n=true}else{d_attr="M"+F+","+z+" ";A=S({element:"path",curStyles:true,attr:{d:d_attr,id:ka(),opacity:K.opacity/2}});k.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));k=e?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(k,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,k];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,k];D=u.split("_")[1].split("c");z=D[0]-0;n=D=D[1]-0;o=svgedit.path.path.segs[z];svgedit.path.path.selectPt(z,D);if(n==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"+n],y:o.item["y"+n]};n=n==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,n);D=D(o,n);z=Math.abs(Math.round(Math.atan2(z.y-n.y,z.x-n.x)*(180/Math.PI),0)-Math.round(Math.atan2(o.y- n.y,o.x-n.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:k*q,width:0,height:0,display:"inline"},100)}}},mouseMove:function(D,z,F){G=true;var k=!D.altKey;if(Ga==="path"){if(A){var n=A.pathSegList,o=n.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];n.getItem(o);var O=z/q,X=F/q;H=k?D+(D-O):H;k=k?u+(u-X):J;E.setAttribute("cx",H*q);E.setAttribute("cy",k*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:k*q,x2:D*q,y2:u*q,display:"inline"});if(o===0)B=[z,F];else{n=n.getItem(o- 1);z=n.x;F=n.y;if(n.pathSegType===6){z+=z-n.x2;F+=F-n.y2}else if(B){z=B[0]/q;F=B[1]/q}svgedit.path.replacePathSeg(6,o,[D,u,this.lastCtrlPoint[0]/q,this.lastCtrlPoint[1]/q,H,k],A)}}else if(k=this.stretchy){o=n.getItem(o);n=z;u=F;if(D.target.id==="pathpointgrip_0"&&svgedit.path.first_grip){n=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,n,u],k); else B?svgedit.path.replacePathSeg(6,1,[z,F,B[0],B[1],z,F],k):svgedit.path.replacePathSeg(4,1,[z,F],k)}}}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);D=svgedit.path.getPointFromGrip({x:z,y:F},svgedit.path.path);o=D.x-n.x;n=D.y-n.y;svgedit.path.path.dragging=[z,F];!k||!svgedit.path.is_linked?svgedit.path.setLinkControlPoints(false):svgedit.path.setLinkControlPoints(true);svgedit.path.path.dragctrl? svgedit.path.path.moveCtrl(o,n):svgedit.path.path.movePts(o,n)}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,k){var n=pa("ctrlpointgrip_1c1"),o=pa("ctrlpointgrip_0c2");this.lastCtrlPoint=n?[n.getAttribute("cx"),n.getAttribute("cy")]: [F,k];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;B=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);h=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(h===D){La.toEditMode(D);Ga="pathedit"}else h=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){h=null;if(A){var z=pa(aa());$(pa("path_stretch_line")).remove();D&&$(z).remove();$(pa("pathpointgrip_container")).find("*").attr("display","none");A=B=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 k=z.numberOfItems,n=0;n0){u=k.getItem(n-1).pathSegType;if(u===2){o(n-1,1);F();break}else if(u===1&&k.numberOfItems-1===n){o(n,1);F();break}}}return false};F();if(svgedit.path.path.elem.pathSegList.numberOfItems<= 1){d.setMode("select");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 u=z.getItem(o),E=z.getItem(o+1),H=z.getItem(o+2);if(n)if((k=svgedit.path.smoothControlPoints(n, u,k))&&k.length==2){u=D[D.length-1].split(",");u[2]=k[0].x;u[3]=k[0].y;D[D.length-1]=u.join(",");u=k[1]}D.push([u.x,u.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(!(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(">");h++;D=false;for(F=0;F");break;case 8:l.push("\n");l.push(Array(h+1).join(" "));l.push("