(function(a){function n(f){if(typeof f.data==="string"){var c=f.handler,m=f.data.toLowerCase().split(" ");f.handler=function(o){if(!(this!==o.target&&(/textarea|select/i.test(o.target.nodeName)||o.target.type==="text"))){var b=o.type!=="keypress"&&a.hotkeys.specialKeys[o.which],d=String.fromCharCode(o.which).toLowerCase(),e="",l={};if(o.altKey&&b!=="alt")e+="alt+";if(o.ctrlKey&&b!=="ctrl")e+="ctrl+";if(o.metaKey&&!o.ctrlKey&&b!=="meta")e+="meta+";if(o.shiftKey&&b!=="shift")e+="shift+";if(b)l[e+b]= true;else{l[e+d]=true;l[e+a.hotkeys.shiftNums[d]]=true;if(e==="shift+")l[a.hotkeys.shiftNums[d]]=true}b=0;for(d=m.length;b","/":"?","\\":"|"}};a.each(["keydown","keyup","keypress"],function(){a.event.special[this]={add:n}})})(jQuery);(function(a,n){function f(ba){return typeof ba==="string"}function c(ba){var S=e.call(arguments,1);return function(){return ba.apply(this,S.concat(e.call(arguments)))}}function m(ba,S,U,sa,la){var oa;if(sa!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(sa))sa=sa.replace(ba?ea:ca,"");else{oa=p(S[2]);sa=f(sa)?p[ba?ga:O](sa):sa;sa=la===2?sa:la===1?a.extend({},sa,oa):a.extend({},oa,sa);sa=u(sa);if(ba)sa=sa.replace(ra,l)}ba=S[1]+(ba?"#":sa||!S[1]?"?":"")+sa+U}else ba= S(U!==d?U:n[ta][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?ga:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,sa){if(!f(U)&&typeof U!=="object"){sa=U;U=S;S=d}return this.each(function(){var la=a(this),oa=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=oa&&la.attr(oa)||"";la.attr(oa,u[ba](Z,U,sa))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,w,p,L,T=a.bbq=a.bbq||{},M,J,da,V=a.event.special,O="querystring",ga="fragment", ta="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,ra,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[ga]=w=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});w.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);ra=RegExp(ba.join("|"),"g")};w.noEscape(",/");a.deparam=p=function(ba,S){var U={},sa={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,oa){var Z=oa.split("="),Aa=l(Z[0]),Ka=U, Ra=0,Na=Aa.split("]["),Sa=Na.length-1;if(/\[/.test(Na[0])&&/\]$/.test(Na[Sa])){Na[Sa]=Na[Sa].replace(/\]$/,"");Na=Na.shift().split("[").concat(Na);Sa=Na.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:sa[Z]!==d?sa[Z]:Z;if(Sa)for(;Ra<=Sa;Ra++){Aa=Na[Ra]===""?Ka.length:Na[Ra];Ka=Ka[Aa]=Ra').hide().insertAfter("body")[0].contentWindow; J=function(){return c(T.document[b][d])};M=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};M(c())}}var p={},L,T,M,J;p.start=function(){if(!L){var da=c();M||w();(function V(){var O=c(),ga=J(da);if(O!==da){M(da=O,ga);a(n).trigger("hashchange")}else if(ga!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+ga;L=setTimeout(V,a.hashchangeDelay)})()}};p.stop=function(){if(!T){L&&clearTimeout(L);L=0}};return p}()})(jQuery,this);(function(a){var n={},f;a.svgIcons=function(c,m){function o(ba,S){if(ba!=="ajax"){if(da)return;var U=(T=ha[0].contentDocument)&&T.getElementById("svg_eof");if(!U&&!(S&&U)){V++;if(V<50)setTimeout(o,20);else{d();da=true}return}da=true}L=a(T.firstChild).children();if(m.no_img)setTimeout(function(){J||b()},500);else{U=ta+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";M=a(new Image).attr({src:U,width:0,height:0}).appendTo("body").load(function(){b(true)}).error(function(){b()})}} function b(ba,S){if(!J){if(m.no_img)ba=false;if(ba){var U=a(document.createElement("div"));U.hide().appendTo("body")}if(S){var sa=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Wa){a("#"+Sa);var Oa=a(new Image).attr({"class":"svg_icon",src:sa+Wa,width:w,height:p,alt:"icon"});pa(Oa,Sa)})}else for(var la=L.length,oa=0;oa0&&!ba)Ia=f(Ia,Oa,true);ra(a(this),Ia,Wa)})});if(!S){ba&&U.remove();ha&&ha.remove();M&&M.remove()}m.resize&&a.resizeSvgIcons(m.resize);J=true;m.callback&&m.callback(n)}}function d(){if(c.indexOf(".svgz")!=-1){var ba=c.replace(".svgz",".svg");window.console&&console.log(".svgz failed, trying with .svg");a.svgIcons(ba,m)}else m.fallback&&b(false,m.fallback)}function e(ba){if(window.btoa)return window.btoa(ba); var S=Array(Math.floor((ba.length+2)/3)*4),U,sa,la,oa,Z,Aa,Ka=0,Ra=0;do{U=ba.charCodeAt(Ka++);sa=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);oa=U>>2;U=(U&3)<<4|sa>>4;Z=(sa&15)<<2|la>>6;Aa=la&63;if(isNaN(sa))Z=Aa=64;else if(isNaN(la))Aa=64;S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(oa);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Ra++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Ra++]= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Aa)}while(Ka-1&&O.indexOf("Chrome/");var ta="data:image/svg+xml;charset=utf-8;base64,";if(m.svgz){var ha=a('').appendTo("body").hide();try{T=ha[0].contentDocument;ha.load(o); o(0,true)}catch(ca){d()}}else{var ea=new DOMParser;a.ajax({url:c,dataType:"string",success:function(ba){if(ba){T=ea.parseFromString(ba,"text/xml");a(function(){o("ajax")})}else a(d)},error:function(ba){if(window.opera)a(function(){d()});else if(ba.responseText){T=ea.parseFromString(ba.responseText,"text/xml");T.childNodes.length||a(d);a(function(){o("ajax")})}else a(d)}})}var ra=function(ba,S,U,sa){ga&&S.css("visibility","hidden");if(m.replace){sa&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class", "svg_icon "+U);ba.replaceWith(S)}else ba.append(S);ga&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)ra(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=ga?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var sa=ba[0].getElementsByTagName("*"),la=sa.length;U.each(function(oa){var Z=this.id;a(T).find("#"+Z);this.id=oa="x"+Z+S+oa;Z="url(#"+Z+")";var Aa="url(#"+oa+")";for(oa=0;oa< la;oa++){var Ka=sa[oa];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",Aa);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",Aa);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",Aa)}});return ba}};a.getSvgIcon=function(c,m){var o=n[c];if(m&&o)o=f(o,0,true).clone(true);return o};a.resizeSvgIcons=function(c){var m=!a(".svg_icon:first").length;a.each(c,function(o,b){var d=a.isArray(b),e=d?b[0]:b,l=d?b[1]:b;if(m)o=o.replace(/\.svg_icon/g,"svg");a(o).each(function(){this.setAttribute("width", e);this.setAttribute("height",l);if(window.opera&&window.widget){this.parentNode.style.width=e+"px";this.parentNode.style.height=l+"px"}})})}})(jQuery);(function(){function a(c,m,o){c=document.createElementNS(n.svg,c);if(f)for(var b in m)c.setAttribute(b,m[b]);else for(b in m){var d=m[b],e=c[b];if(e&&e.constructor==="SVGLength")e.baseVal.value=d;else c.setAttribute(b,d)}o&&o.appendChild(c);return c}var n={svg:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink"};if(!window.console)window.console=new function(){this.log=function(){};this.dir=function(){}};$.jGraduate={Paint:function(c){c=c||{};this.alpha=isNaN(c.alpha)?100:c.alpha;if(c.copy){this.type= c.copy.type;this.alpha=c.copy.alpha;this.radialGradient=this.linearGradient=this.solidColor=null;switch(this.type){case "solidColor":this.solidColor=c.copy.solidColor;break;case "linearGradient":this.linearGradient=c.copy.linearGradient.cloneNode(true);break;case "radialGradient":this.radialGradient=c.copy.radialGradient.cloneNode(true)}}else if(c.linearGradient){this.type="linearGradient";this.radialGradient=this.solidColor=null;this.linearGradient=c.linearGradient.cloneNode(true)}else if(c.radialGradient){this.type= "radialGradient";this.linearGradient=this.solidColor=null;this.radialGradient=c.radialGradient.cloneNode(true)}else if(c.solidColor){this.type="solidColor";this.solidColor=c.solidColor}else{this.type="none";this.radialGradient=this.linearGradient=this.solidColor=null}}};jQuery.fn.jGraduateDefaults={paint:new $.jGraduate.Paint,window:{pickerTitle:"Drag markers to pick a paint"},images:{clientPath:"images/"},newstop:"inverse"};var f=navigator.userAgent.indexOf("Gecko/")>=0;jQuery.fn.jGraduate=function(c){var m= arguments;return this.each(function(){function o(ma,Y,na,K,N){var aa=N||a("stop",{"stop-color":Y,"stop-opacity":na,offset:ma},ea);if(N){Y=N.getAttribute("stop-color");na=N.getAttribute("stop-opacity");ma=N.getAttribute("offset")}else ea.appendChild(aa);if(na===null)na=1;N=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+ma*ga)+", 26)"},Cb);var Pa= 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:Y,"fill-opacity":na,transform:"translate("+(10+ma*ga)+", 26)",stroke:"#000","stroke-width":1.5},Cb);$(Pa).mousedown(function(Xa){b(this);Ya=nb;da.mousemove(l).mouseup(d);Ea=Kb.offset();Xa.preventDefault();return false}).data("stop",aa).data("bg",N).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Xa=this,hb=+aa.getAttribute("stop-opacity")|| 1,pb=aa.getAttribute("stop-color")||1,Db=(parseFloat(hb)*255).toString(16);Db.length<2;)Db="0"+Db;Y=pb.substr(1)+Db;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:w.images.clientPath},color:{active:Y,alphaSupport:true}},function(cb){pb=cb.val("hex")?"#"+cb.val("hex"):"none";hb=cb.val("a")!==null?cb.val("a")/256:1;Xa.setAttribute("fill",pb);Xa.setAttribute("fill-opacity",hb);aa.setAttribute("stop-color", pb);aa.setAttribute("stop-opacity",hb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Xa=$(this);if(+this.getAttribute("offset")>ma){if(!Y){var hb=this.getAttribute("stop-color"),pb=this.getAttribute("stop-opacity");aa.setAttribute("stop-color",hb);Pa.setAttribute("fill",hb);aa.setAttribute("stop-opacity",pb===null?1:pb);Pa.setAttribute("fill-opacity", pb===null?1:pb)}Xa.before(aa);return false}});K&&b(Pa);return aa}function b(ma){nb&&nb.setAttribute("stroke","#000");ma.setAttribute("stroke","blue");nb=ma;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var ma=$(nb),Y=ma.data("stop");ma=ma.data("bg");$([nb,Y,ma]).remove()}Ya=null}function e(){var ma=Za?"rotate("+Za+","+Ma+","+ob+") ":"";qb===1&&Ja===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", ma+"translate("+-Ma*(qb-1)+","+-ob*(Ja-1)+") scale("+qb+","+Ja+")")}function l(ma){var Y=ma.pageX-Ea.left;ma=ma.pageY-Ea.top;Y=Y<10?10:Y>ga+10?ga+10:Y;var na="translate("+Y+", 26)";if(ma<-60||ma>130){La.setAttribute("display","block");La.setAttribute("transform",na)}else La.setAttribute("display","none");Ya.setAttribute("transform",na);$.data(Ya,"bg").setAttribute("transform",na);$.data(Ya,"stop").setAttribute("offset",(Y-10)/ga);var K=0;$(ea).find("stop").each(function(){var N=this.getAttribute("offset"), aa=$(this);if(N
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('

    '+w.window.pickerTitle+'


    ');var ga=256,ta=ga-0,ha=ga-0,ca,ea,ra,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:ga,height:ga,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],sa=u.paint.alpha,la=ca==="solidColor";switch(ca){case "solidColor":case "linearGradient":if(!la){ea.id=p+"_lg_jgraduate_grad"; U=ea=S.appendChild(ea)}a("radialGradient",{id:p+"_rg_jgraduate_grad"},S);if(ca==="linearGradient")break;case "radialGradient":if(!la){ea.id=p+"_rg_jgraduate_grad";U=ea=S.appendChild(ea)}a("linearGradient",{id:p+"_lg_jgraduate_grad"},S)}if(la){U=ea=$("#"+p+"_lg_jgraduate_grad")[0];J=u.paint[ca];o(0,"#"+J,1);var oa=typeof w.newstop;if(oa==="string")switch(w.newstop){case "same":o(1,"#"+J,1);break;case "inverse":oa="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var Aa=(255-parseInt(J.substr(Z,2),16)).toString(16); if(Aa.length<2)Aa=0+Aa;oa+=Aa}o(1,"#"+oa,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(oa==="object")o(1,w.newstop.color||"#"+J,"opac"in w.newstop?w.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);oa=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);Aa=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Ra=parseFloat(U.getAttribute("cy")||0.5),Na=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")|| Ra);ra=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:ta,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":sa/100},S);var Wa=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:oa*ga,left:J*ga}).data("coord","start").appendTo(ba),Oa=Wa.clone().text(2).css({top:Aa*ga,left:Z*ga}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Ra*ga,left:Ka* ga}).data("coord","center").appendTo(ba),Qa=Ia.clone().text("F").css({top:Sa*ga,left:Na*ga,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Qa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(ma,Y){var na=ea.getAttribute(Y),K=isNaN(Y[1]);na||(na=K?"0.5":Y==="x2"?"1.0":"0.0");pa[Y]=$("#"+p+"_jGraduate_"+Y).val(na).change(function(){if(isNaN(parseFloat(this.value))||this.value<0)this.value=0;else if(this.value> 1)this.value=1;if(!(Y[0]==="f"&&!rb))if(K&&ca==="radialGradient"||!K&&ca==="linearGradient")ea.setAttribute(Y,this.value);var N=K?Y[0]==="c"?Ia:Qa:Y[1]==="1"?Wa:Oa,aa=Y.indexOf("x")>=0?"left":"top";N.css(aa,this.value*ga)}).change()});var Ga,Cb,Kb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Ya,La=a("path",{d:"m9.75,-6l-19.5,19.5m0,-19.5l19.5,19.5",fill:"none",stroke:"#D00","stroke-width":5,display:"none"},ab),Ea,qb=1,Ja=1,Za=0,Ma=Ka,ob=Ra;ab=a("svg",{width:"100%",height:45},Kb[0]);ba=a("pattern",{width:16, height:16,patternUnits:"userSpaceOnUse",id:"jGraduate_trans"},ab);a("image",{width:16,height:16},ba).setAttributeNS(n.xlink,"xlink:href",w.images.clientPath+"map-opacity.png");$(ab).click(function(ma){Ea=Kb.offset();if(ma.target.tagName!=="path"){var Y=ma.pageX-Ea.left-8;Y=Y<10?10:Y>ga+10?ga+10:Y;o(Y/ga,0,0,true);ma.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Cb=a("g",{},ab);a("line",{x1:10,y1:15,x2:ga+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var xb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod", $(this).val())}),fb=null,ib=function(ma){var Y=ma.pageX-ub.left,na=ma.pageY-ub.top;Y=Y<0?0:Y>ga?ga:Y;na=na<0?0:na>ga?ga:na;fb.css("left",Y).css("top",na);Y/=ta;na/=ha;var K=fb.data("coord"),N=ea;switch(K){case "start":pa.x1.val(Y);pa.y1.val(na);N.setAttribute("x1",Y);N.setAttribute("y1",na);break;case "end":pa.x2.val(Y);pa.y2.val(na);N.setAttribute("x2",Y);N.setAttribute("y2",na);break;case "center":pa.cx.val(Y);pa.cy.val(na);N.setAttribute("cx",Y);N.setAttribute("cy",na);Ma=Y;ob=na;e();break;case "focus":pa.fx.val(Y); pa.fy.val(na);N.setAttribute("fx",Y);N.setAttribute("fy",na);e()}ma.preventDefault()},Lb=function(){fb=null;da.unbind("mousemove",ib).unbind("mouseup",Lb)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(xa<2){for(;xa<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++xa}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var xa=Ga.length;for(Z=0;Z99.5)K=99.5;if(K>0)Ja=1-K/100;else qb=-(K/100)-1;N=145*((K+100)/2)/100;aa&&e();break;case "angle":Za=K;N=Za/180;N+=0.5;N*=145;aa&&e()}if(N>145)N=145;else if(N<0)N=0;na.css({"margin-left":N-5})}).change()});var Gb=function(ma){var Y=ma.pageX- mb.offset.left-parseInt(mb.parent.css("border-left-width"));if(Y>145)Y=145;if(Y<=0)Y=0;var na=Y-5;Y/=145;switch(mb.type){case "radius":Y=Math.pow(Y*2,2.5);if(Y>0.98&&Y<1.02)Y=1;if(Y<=0.01)Y=0.01;ea.setAttribute("r",Y);break;case "opacity":u.paint.alpha=parseInt(Y*100);ra.setAttribute("fill-opacity",Y);break;case "ellip":Ja=qb=1;if(Y<0.5){Y/=0.5;qb=Y<=0?0.01:Y}else if(Y>0.5){Y/=0.5;Y=2-Y;Ja=Y<=0?0.01:Y}e();Y-=1;if(Ja===Y+1)Y=Math.abs(Y);break;case "angle":Y-=0.5;Za=Y*=180;e();Y/=100}mb.elem.css({"margin-left":na}); Y=Math.round(Y*100);mb.input.val(Y);ma.preventDefault()},Hb=function(){da.unbind("mousemove",Gb).unbind("mouseup",Hb);mb=null};for(O=(u.paint.alpha*255/100).toString(16);O.length<2;)O="0"+O;O=O.split(".")[0];J=u.paint.solidColor=="none"?"":u.paint.solidColor+O;la||(J=Ga[0].getAttribute("stop-color"));$.extend($.fn.jPicker.defaults.window,{alphaSupport:true,effects:{type:"show",speed:0}});V.jPicker({window:{title:w.window.pickerTitle},images:{clientPath:w.images.clientPath},color:{active:J,alphaSupport:true}}, function(ma){u.paint.type="solidColor";u.paint.alpha=ma.val("ahex")?Math.round(ma.val("a")/255*100):100;u.paint.solidColor=ma.val("hex")?ma.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){M()});var Mb=$(L+" .jGraduate_tabs li");Mb.click(function(){Mb.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current");$(L+" > div").hide();var ma=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(ma==="rg"||ma==="lg"){$(".jGraduate_"+ma+"_field").show();$(".jGraduate_"+ (ma==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+ma+"_jgraduate_grad)");ca=ma==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var Y=$("#"+p+"_"+ma+"_jgraduate_grad")[0];if(ea!==Y){var na=$(ea).find("stop");$(Y).empty().append(na);ea=Y;Y=xb.val();ea.setAttribute("spreadMethod",Y)}rb=ma==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Na&&Ra==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(rb);if(rb)$("#"+ p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Mb.removeClass("jGraduate_tab_current");var Nb;switch(u.paint.type){case "linearGradient":Nb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Nb=$(L+" .jGraduate_tab_radgrad");break;default:Nb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Nb.addClass("jGraduate_tab_current").click()},10)}else alert("Container element must have an id attribute to maintain unique id strings for sub-elements.")})}})();$.fn.SpinButton=function(a){function n(f,c){for(var m=f[c],o=document.body;(f=f.offsetParent)&&f!=o;)if(!$.browser.msie||f.currentStyle.position!="relative")m+=f[c];return m}return this.each(function(){this.repeating=false;this.spinCfg={min:a&&!isNaN(parseFloat(a.min))?Number(a.min):null,max:a&&!isNaN(parseFloat(a.max))?Number(a.max):null,step:a&&a.step?Number(a.step):1,stepfunc:a&&a.stepfunc?a.stepfunc:false,page:a&&a.page?Number(a.page):10,upClass:a&&a.upClass?a.upClass:"up",downClass:a&&a.downClass? a.downClass:"down",reset:a&&a.reset?a.reset:this.value,delay:a&&a.delay?Number(a.delay):500,interval:a&&a.interval?Number(a.interval):100,_btn_width:20,_direction:null,_delay:null,_repeat:null,callback:a&&a.callback?a.callback:null};this.spinCfg.smallStep=a&&a.smallStep?a.smallStep:this.spinCfg.step/2;this.adjustValue=function(f){f=isNaN(this.value)?this.spinCfg.reset:$.isFunction(this.spinCfg.stepfunc)?this.spinCfg.stepfunc(this,f):Number((Number(this.value)+Number(f)).toFixed(5));if(this.spinCfg.min!== null)f=Math.max(f,this.spinCfg.min);if(this.spinCfg.max!==null)f=Math.min(f,this.spinCfg.max);this.value=f;$.isFunction(this.spinCfg.callback)&&this.spinCfg.callback(this)};$(this).addClass(a&&a.spinClass?a.spinClass:"spin-button").mousemove(function(f){var c=f.pageX||f.x,m=f.pageY||f.y;f=f.target||f.srcElement;var o=svgEditor.tool_scale||1,b=$(f).height()/2;c=c>n(f,"offsetLeft")+f.offsetWidth*o-this.spinCfg._btn_width?m=120)this.adjustValue(this.spinCfg.step);else f.wheelDelta<=-120&&this.adjustValue(-this.spinCfg.step);f.preventDefault()}).change(function(){this.adjustValue(0)});this.addEventListener&&this.addEventListener("DOMMouseScroll",function(f){if(f.detail>0)this.adjustValue(-this.spinCfg.step);else f.detail<0&&this.adjustValue(this.spinCfg.step);f.preventDefault()},false)})};function touchHandler(a){var n=a.changedTouches,f=n[0],c="";switch(a.type){case "touchstart":c="mousedown";break;case "touchmove":c="mousemove";break;case "touchend":c="mouseup";break;default:return}var m=document.createEvent("MouseEvent");m.initMouseEvent(c,true,true,window,1,f.screenX,f.screenY,f.clientX,f.clientY,false,false,false,false,0,null);if(n.length<2){f.target.dispatchEvent(m);a.preventDefault()}};jQuery&&function(){var a=$(window),n=$(document);$.extend($.fn,{contextMenu:function(f,c){if(f.menu==undefined)return false;if(f.inSpeed==undefined)f.inSpeed=150;if(f.outSpeed==undefined)f.outSpeed=75;if(f.inSpeed==0)f.inSpeed=-1;if(f.outSpeed==0)f.outSpeed=-1;$(this).each(function(){var m=$(this),o=$(m).offset(),b=$("#"+f.menu);b.addClass("contextMenu");$(this).bind("mousedown",function(d){$(this).mouseup(function(e){var l=$(this);l.unbind("mouseup");$(".contextMenu").hide();if(d.button===2||f.allowLeft|| d.ctrlKey&&svgedit.browser.isMac()){e.stopPropagation();if(m.hasClass("disabled")||d.altKey)return false;var u=e.pageX,w=e.pageY;e=a.width()-b.width();var p=a.height()-b.height();if(u>e-15)u=e-15;if(w>p-30)w=p-30;n.unbind("click");b.css({top:w,left:u}).fadeIn(f.inSpeed);b.find("A").mouseover(function(){b.find("LI.hover").removeClass("hover");$(this).parent().addClass("hover")}).mouseout(function(){b.find("LI.hover").removeClass("hover")});n.keypress(function(L){switch(L.keyCode){case 38:if(b.find("LI.hover").length){b.find("LI.hover").removeClass("hover").prevAll("LI:not(.disabled)").eq(0).addClass("hover"); b.find("LI.hover").length||b.find("LI:last").addClass("hover")}else b.find("LI:last").addClass("hover");break;case 40:if(b.find("LI.hover").length==0)b.find("LI:first").addClass("hover");else{b.find("LI.hover").removeClass("hover").nextAll("LI:not(.disabled)").eq(0).addClass("hover");b.find("LI.hover").length||b.find("LI:first").addClass("hover")}break;case 13:b.find("LI.hover A").trigger("click");break;case 27:n.trigger("click")}});b.find("A").unbind("mouseup");b.find("LI:not(.disabled) A").mouseup(function(){n.unbind("click").unbind("keypress"); $(".contextMenu").hide();c&&c($(this).attr("href").substr(1),$(l),{x:u-o.left,y:w-o.top,docX:u,docY:w});return false});setTimeout(function(){n.click(function(){n.unbind("click").unbind("keypress");b.fadeOut(f.outSpeed);return false})},0)}})});if($.browser.mozilla)$("#"+f.menu).each(function(){$(this).css({MozUserSelect:"none"})});else $.browser.msie?$("#"+f.menu).each(function(){$(this).bind("selectstart.disableTextSelect",function(){return false})}):$("#"+f.menu).each(function(){$(this).bind("mousedown.disableTextSelect", function(){return false})});$(m).add($("UL.contextMenu")).bind("contextmenu",function(){return false})});return $(this)},disableContextMenuItems:function(f){if(f==undefined){$(this).find("LI").addClass("disabled");return $(this)}$(this).each(function(){if(f!=undefined)for(var c=f.split(","),m=0;m=0,o=n.indexOf("Gecko/")>=0,b=n.indexOf("MSIE")>=0,d=n.indexOf("Chrome/")>=0,e=n.indexOf("Windows")>=0,l=n.indexOf("Macintosh")>= 0,u="ontouchstart"in window,w=!!f.querySelector,p=!!document.evaluate,L=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(ta,0);return true}catch(ca){}return false}(),T=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","path");ta.setAttribute("d","M0,0 10,10");var ha=ta.pathSegList;ta=ta.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(ta, 0);return true}catch(ca){}return false}(),M=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);ha.setAttribute("x",5);ta.appendChild(ha);var ca=document.createElementNS("http://www.w3.org/2000/svg","text");ca.textContent="a";ha.appendChild(ca);ha=ca.getStartPositionOfChar(0).x;document.documentElement.removeChild(ta);return ha===0}(),J=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg", "svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");ta.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(ta);return ha.height>4&&ha.height<5}(),da=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(ta);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 10,0");var ca= document.createElementNS("http://www.w3.org/2000/svg","path");ca.setAttribute("d","M5,0 15,0");var ea=document.createElementNS("http://www.w3.org/2000/svg","g");ea.appendChild(ha);ea.appendChild(ca);ta.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(ta);return ha.width==15}(),V=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("x",0.1);(ta=ta.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 ta}(),O=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect");ta.setAttribute("style","vector-effect:non-scaling-stroke");return ta.style.vectorEffect==="non-scaling-stroke"}(),ga=function(){var ta=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();ta.appendItem(ha);return ta.getItem(0)==ha}();svgedit.browser.isOpera=function(){return c};svgedit.browser.isWebkit=function(){return m};svgedit.browser.isGecko=function(){return o}; svgedit.browser.isIE=function(){return b};svgedit.browser.isChrome=function(){return d};svgedit.browser.isWindows=function(){return e};svgedit.browser.isMac=function(){return l};svgedit.browser.isTouch=function(){return u};svgedit.browser.supportsSelectors=function(){return w};svgedit.browser.supportsXpath=function(){return p};svgedit.browser.supportsPathReplaceItem=function(){return L};svgedit.browser.supportsPathInsertItemBefore=function(){return T};svgedit.browser.supportsPathBBox=function(){return J}; svgedit.browser.supportsHVLineContainerBBox=function(){return da};svgedit.browser.supportsGoodTextCharPos=function(){return M};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};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"),n={};svgedit.transformlist.SVGTransformList=function(f){this._elem=f||null;this._xforms=[];this._update=function(){var c="";a.createSVGMatrix();for(var m=0;m=0)return this._xforms[c];throw{code:1};};this.insertItemBefore=function(c,m){var o=null;if(m>=0)if(m=0){this._removeFromOtherLists(c);o=this._xforms[m]=c;this._list._update()}return o};this.removeItem=function(c){if(c=0){for(var m=this._xforms[c],o=Array(this.numberOfItems- 1),b=0;b1;)c=n[f-1].multiply(c);if(Math.abs(c.a)<1.0E-14)c.a=0;if(Math.abs(c.b)<1.0E-14)c.b=0;if(Math.abs(c.c)<1.0E-14)c.c=0;if(Math.abs(c.d)< 1.0E-14)c.d=0;if(Math.abs(c.e)<1.0E-14)c.e=0;if(Math.abs(c.f)<1.0E-14)c.f=0;return c};svgedit.math.hasMatrixTransform=function(n){if(!n)return false;for(var f=n.numberOfItems;f--;){var c=n.getItem(f);if(c.type==1&&!svgedit.math.isIdentity(c.matrix))return true}return false};svgedit.math.transformBox=function(n,f,c,m,o){var b={x:n,y:f},d={x:n+c,y:f};c={x:n+c,y:f+m};n={x:n,y:f+m};f=svgedit.math.transformPoint;b=f(b.x,b.y,o);var e=m=b.x,l=b.y,u=b.y;d=f(d.x,d.y,o);m=Math.min(m,d.x);e=Math.max(e,d.x); l=Math.min(l,d.y);u=Math.max(u,d.y);n=f(n.x,n.y,o);m=Math.min(m,n.x);e=Math.max(e,n.x);l=Math.min(l,n.y);u=Math.max(u,n.y);c=f(c.x,c.y,o);m=Math.min(m,c.x);e=Math.max(e,c.x);l=Math.min(l,c.y);u=Math.max(u,c.y);return{tl:b,tr:d,bl:n,br:c,aabox:{x:m,y:l,width:e-m,height:u-l}}};svgedit.math.transformListToTransform=function(n,f,c){if(n==null)return a.createSVGTransformFromMatrix(a.createSVGMatrix());f=f==undefined?0:f;c=c==undefined?n.numberOfItems-1:c;f=parseInt(f);c=parseInt(c);if(f>c){var m=c;c=f; f=m}m=a.createSVGMatrix();for(f=f;f<=c;++f){var o=f>=0&&fn.x&&f.yn.y}})();svgedit=svgedit||{}; (function(){if(!svgedit.units)svgedit.units={};var a=["x","x1","cx","rx","width"],n=["y","y1","cy","ry","height"],f=$.merge(["r","radius"],a);$.merge(f,n);var c,m={px:1};svgedit.units.init=function(b){c=b;b=document.createElementNS("http://www.w3.org/2000/svg","svg");document.body.appendChild(b);var d=document.createElementNS("http://www.w3.org/2000/svg","rect");d.setAttribute("width","1em");d.setAttribute("height","1ex");d.setAttribute("x","1in");b.appendChild(d);d=d.getBBox();document.body.removeChild(b); b=d.x;m.em=d.width;m.ex=d.height;m["in"]=b;m.cm=b/2.54;m.mm=b/25.4;m.pt=b/72;m.pc=b/6;m["%"]=0};svgedit.units.getTypeMap=function(){return m};svgedit.units.shortFloat=function(b){var d=c.getRoundDigits();if(isNaN(b)){if($.isArray(b))return svgedit.units.shortFloat(b[0])+","+svgedit.units.shortFloat(b[1])}else return+(+b).toFixed(d);return parseFloat(b).toFixed(d)-0};svgedit.units.convertUnit=function(b,d){d=d||c.getBaseUnit();return svgedit.unit.shortFloat(b/m[d])};svgedit.units.setUnitAttr=function(b, d,e){isNaN(e)||b.getAttribute(d);b.setAttribute(d,e)};var o={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(b){var d=b.tagName,e=c.getBaseUnit();if(d=o[d])for(var l=d.length,u=0;u=0?e*l:n.indexOf(b)>=0?e*u:e*Math.sqrt(l*l+u*u)/Math.sqrt(2)}else{l=d.substr(-2);e=d.substr(0,d.length-2);return e*m[l]}};svgedit.units.isValidUnit=function(b,d,e){var l=false;if(f.indexOf(b)>=0)if(isNaN(d)){d=d.toLowerCase();$.each(m,function(p){if(!l)if(RegExp("^-?[\\d\\.]+"+p+"$").test(d))l=true})}else l=true;else if(b=="id"){b=false;try{var u=c.getElement(d); b=u==null||u===e}catch(w){}return b}else l=true;return l}})();svgedit=svgedit||{}; (function(){function a(b){if(svgedit.browser.supportsHVLineContainerBBox())try{return b.getBBox()}catch(d){}var e=$.data(b,"ref"),l=null;if(e){var u=$(e).children().clone().attr("visibility","hidden");$(o).append(u);l=u.filter("line, path")}else l=$(b).find("line, path");var w=false;if(l.length){l.each(function(){var p=this.getBBox();if(!p.width||!p.height)w=true});if(w){b=e?u:$(b).children();ret=getStrokedBBox(b)}else ret=b.getBBox()}else ret=b.getBBox();e&&u.remove();return ret}if(!svgedit.utilities)svgedit.utilities= {};var n="a,circle,ellipse,foreignObject,g,image,line,path,polygon,polyline,rect,svg,text,tspan,use".split(","),f=null,c=null,m=null,o=null;svgedit.utilities.init=function(b){f=b;c=b.getDOMDocument();m=b.getDOMContainer();o=b.getSVGRoot()};svgedit.utilities.toXml=function(b){return $("

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

    ").html(b).text()};svgedit.utilities.encode64=function(b){b=svgedit.utilities.convertToXMLReferences(b);if(window.btoa)return window.btoa(b); var d=Array(Math.floor((b.length+2)/3)*4),e,l,u,w,p,L,T=0,M=0;do{e=b.charCodeAt(T++);l=b.charCodeAt(T++);u=b.charCodeAt(T++);w=e>>2;e=(e&3)<<4|l>>4;p=(l&15)<<2|u>>6;L=u&63;if(isNaN(l))p=L=64;else if(isNaN(u))L=64;d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(w);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);d[M++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(L)}while(T< b.length);return d.join("")};svgedit.utilities.decode64=function(b){if(window.atob)return window.atob(b);var d="",e,l,u="",w,p="",L=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++)); e=e<<2|l>>4;l=(l&15)<<4|w>>2;u=(w&3)<<6|p;d+=String.fromCharCode(e);if(w!=64)d+=String.fromCharCode(l);if(p!=64)d+=String.fromCharCode(u)}while(L127)d+="&#"+l+";"}return d};svgedit.utilities.text2xml=function(b){if(b.indexOf("=0)b=b.replace(/<(\/?)svg:/g,"<$1").replace("xmlns:svg","xmlns");var d;try{var e=window.DOMParser? new DOMParser:new ActiveXObject("Microsoft.XMLDOM");e.async=false}catch(l){throw Error("XML Parser could not be instantiated");}try{d=e.loadXML?e.loadXML(b)?e:false:e.parseFromString(b,"text/xml")}catch(u){throw Error("Error parsing XML string");}return d};svgedit.utilities.bboxToObj=function(b){return{x:b.x,y:b.y,width:b.width,height:b.height}};svgedit.utilities.walkTree=function(b,d){if(b&&b.nodeType==1){d(b);for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d)}}; svgedit.utilities.walkTreePost=function(b,d){if(b&&b.nodeType==1){for(var e=b.childNodes.length;e--;)svgedit.utilities.walkTree(b.childNodes.item(e),d);d(b)}};svgedit.utilities.getUrlFromAttr=function(b){if(b)if(b.indexOf('url("')===0)return b.substring(5,b.indexOf('"',6));else if(b.indexOf("url('")===0)return b.substring(5,b.indexOf("'",6));else if(b.indexOf("url(")===0)return b.substring(4,b.indexOf(")"));return null};svgedit.utilities.getHref=function(b){return b.getAttributeNS("http://www.w3.org/1999/xlink", "href")};svgedit.utilities.setHref=function(b,d){b.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d)};svgedit.utilities.findDefs=function(b){b=f.getSVGContent().documentElement;var d=b.getElementsByTagNameNS("http://www.w3.org/2000/svg","defs");return d=d.length>0?d[0]:b.insertBefore(b.ownerDocument.createElementNS("http://www.w3.org/2000/svg","defs"),b.firstChild.nextSibling)};svgedit.utilities.getPathBBox=function(b){var d=b.pathSegList,e=d.numberOfItems;b=[[],[]];var l=d.getItem(0), u=[l.x,l.y];for(l=0;l= 0){var l=e.split(":");b[l[1]]=n[l[0]]}else b[e]=e=="xmlns"?"http://www.w3.org/2000/xmlns/":null});c[m]=b});svgedit.sanitize.getNSMap=function(){return a};svgedit.sanitize.sanitizeSvg=function(m){if(m.nodeType==3){m.nodeValue=m.nodeValue.replace(/^\s+|\s+$/g,"");m.nodeValue.length||m.parentNode.removeChild(m)}if(m.nodeType==1){var o=m.parentNode;if(m.ownerDocument&&o){var b=f[m.nodeName],d=c[m.nodeName];if(b!=undefined){for(var e=[],l=m.attributes.length;l--;){var u=m.attributes.item(l),w=u.nodeName, p=u.localName,L=u.namespaceURI;if(!(d.hasOwnProperty(p)&&L==d[p]&&L!="http://www.w3.org/2000/xmlns/")&&!(L=="http://www.w3.org/2000/xmlns/"&&a[u.nodeValue])){w.indexOf("se:")==0&&e.push([w,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(w){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(w,p)}if(w=="style"){u=u.nodeValue.split(";");for(w=u.length;w--;){p=u[w].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0], p[1])}m.removeAttribute("style")}}$.each(e,function(T,M){m.setAttributeNS("http://svg-edit.googlecode.com",M[0],M[1])});if((l=svgedit.utilities.getHref(m))&&["filter","linearGradient","pattern","radialGradient","textPath","use"].indexOf(m.nodeName)>=0)if(l[0]!="#"){svgedit.utilities.setHref(m,"");m.removeAttributeNS("http://www.w3.org/1999/xlink","href")}if(m.nodeName=="use"&&!svgedit.utilities.getHref(m))o.removeChild(m);else{$.each(["clip-path","fill","filter","marker-end","marker-mid","marker-start", "mask","stroke"],function(T,M){var J=m.getAttribute(M);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){m.setAttribute(M,"");m.removeAttribute(M)}});for(l=m.childNodes.length;l--;)svgedit.sanitize.sanitizeSvg(m.childNodes.item(l))}}else{for(b=[];m.hasChildNodes();)b.push(o.insertBefore(m.firstChild,m));o.removeChild(m);for(l=b.length;l--;)svgedit.sanitize.sanitizeSvg(b[l])}}}}})();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,n,f,c){this.elem=a;this.text=c?"Move "+a.tagName+" to "+c:"Move "+a.tagName;this.oldNextSibling=n;this.oldParent=f;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,n){this.elem=a;this.text=n||"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,n,f,c){this.elem=a;this.text=c||"Delete "+a.tagName;this.nextSibling=n;this.parent=f;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,n,f){this.elem=a;this.text=f?"Change "+a.tagName+" "+f:"Change "+a.tagName;this.newValues={};this.oldValues=n;for(var c in n)this.newValues[c]=c=="#text"?a.textContent:c=="#href"?svgedit.utilities.getHref(a):a.getAttribute(c)};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 n=false,f;for(f in this.newValues){if(this.newValues[f])if(f=="#text")this.elem.textContent=this.newValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.newValues[f]):this.elem.setAttribute(f,this.newValues[f]);else if(f=="#text")this.elem.textContent="";else{this.elem.setAttribute(f,"");this.elem.removeAttribute(f)}if(f== "transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();n=["rotate(",n," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}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 n=false,f;for(f in this.oldValues){if(this.oldValues[f])if(f== "#text")this.elem.textContent=this.oldValues[f];else f=="#href"?svgedit.utilities.setHref(this.elem,this.oldValues[f]):this.elem.setAttribute(f,this.oldValues[f]);else if(f=="#text")this.elem.textContent="";else this.elem.removeAttribute(f);if(f=="transform")n=true}if(!n)if(n=svgedit.utilities.getRotationAngle(this.elem)){f=elem.getBBox();n=["rotate(",n," ",f.x+f.width/2,",",f.y+f.height/2,")"].join("");n!=elem.getAttribute("transform")&&elem.setAttribute("transform",n)}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 n=this.stack.length,f=0;f=0;n--)this.stack[n].unapply(a);a&&a.handleHistoryEvent(svgedit.history.HistoryEventTypes.AFTER_UNAPPLY, this)};svgedit.history.BatchCommand.prototype.elements=function(){for(var a=[],n=this.stack.length;n--;)for(var f=this.stack[n].elements(),c=f.length;c--;)a.indexOf(f[c])==-1&&a.push(f[c]);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,n){for(var f=++this.undoChangeStackPointer,c=n.length,m=Array(c),o=Array(c);c--;){var b=n[c];if(b!=null){o[c]=b;m[c]=b.getAttribute(a)}}this.undoableChangeStack[f]= {attrName:a,oldValues:m,elements:o}};svgedit.history.UndoManager.prototype.finishUndoableChange=function(){for(var a=this.undoChangeStackPointer--,n=this.undoableChangeStack[a],f=n.elements.length,c=n.attrName,m=new svgedit.history.BatchCommand("Change "+c);f--;){var o=n.elements[f];if(o!=null){var b={};b[c]=n.oldValues[f];b[c]!=o.getAttribute(c)&&m.addSubCommand(new svgedit.history.ChangeElementCommand(o,b,c))}}this.undoableChangeStack[a]=null;return m}})();svgedit=svgedit||{}; (function(){if(!svgedit.select)svgedit.select={};var a,n,f;svgedit.select.Selector=function(c,m){this.id=c;this.selectedElement=m;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"}}));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(c){this.locked=true;this.selectedElement=c;this.resize();this.selectorGroup.setAttribute("display","inline")};svgedit.select.Selector.prototype.updateGripCursors=function(c){var m=[];c=Math.round(c/45);if(c<0)c+=8;for(var o in f.selectorGrips)m.push(o);for(;c>0;){m.push(m.shift());c--}c=0;for(o in f.selectorGrips){f.selectorGrips[o].setAttribute("style","cursor:"+m[c]+"-resize");c++}}; svgedit.select.Selector.prototype.showGrips=function(c){f.selectorGripsGroup.setAttribute("display",c?"inline":"none");var m=this.selectedElement;this.hasGrips=c;if(m&&c){this.selectorGroup.appendChild(f.selectorGripsGroup);this.updateGripCursors(svgedit.utilities.getRotationAngle(m))}};svgedit.select.Selector.prototype.resize=function(){var c=this.selectorRect,m=f,o=m.selectorGrips,b=this.selectedElement,d=b.getAttribute("stroke-width"),e=a.currentZoom(),l=1/e;if(b.getAttribute("stroke")!=="none"&& !isNaN(d))l+=d/2;var u=b.tagName;if(u==="text")l+=2/e;d=svgedit.transformlist.getTransformList(b);d=svgedit.math.transformListToTransform(d).matrix;d.e*=e;d.f*=e;var w=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))w=u;u=w.x;var p=w.y,L=w.width;w=w.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,w*e,d);d=e.aabox;u=d.x-l;p=d.y-l;L=d.width+l*2;var T=d.height+l*2;d=u+L/2;w=p+T/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); u.setRotate(-b,d,w);u=u.matrix;e.tl=svgedit.math.transformPoint(e.tl.x,e.tl.y,u);e.tr=svgedit.math.transformPoint(e.tr.x,e.tr.y,u);e.bl=svgedit.math.transformPoint(e.bl.x,e.bl.y,u);e.br=svgedit.math.transformPoint(e.br.x,e.br.y,u);u=e.tl;L=u.x;T=u.y;var M=u.x,J=u.y;u=Math.min;p=Math.max;L=u(L,u(e.tr.x,u(e.bl.x,e.br.x)))-l;T=u(T,u(e.tr.y,u(e.bl.y,e.br.y)))-l;M=p(M,p(e.tr.x,p(e.bl.x,e.br.x)))+l;J=p(J,p(e.tr.y,p(e.bl.y,e.br.y)))+l;u=L;p=T;L=M-L;T=J-T}l=a.svgRoot().suspendRedraw(100);c.setAttribute("d", "M"+u+","+p+" L"+(u+L)+","+p+" "+(u+L)+","+(p+T)+" "+u+","+(p+T)+"z");this.selectorGroup.setAttribute("transform",b?"rotate("+[b,d,w].join(",")+")":"");u-=3.5;p-=3.5;this.gripCoords={nw:[u,p],ne:[u+L,p],sw:[u,p+T],se:[u+L,p+T],n:[u+L/2,p],w:[u,p+T/2],e:[u+L,p+T/2],s:[u+L/2,p+T]};for(var da in this.gripCoords){c=this.gripCoords[da];o[da].setAttribute("x",c[0]);o[da].setAttribute("y",c[1])}this.rotateCoords={nw:[u,p],ne:[u+L+8,p],sw:[u,p+T+8],se:[u+L+8,p+T+8]};for(da in this.rotateCoords){c=this.rotateCoords[da]; m.rotateGrips[da].setAttribute("cx",c[0]);m.rotateGrips[da].setAttribute("cy",c[1])}a.svgRoot().unsuspendRedraw(l)};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 c in this.rotateGrips){var m=a.createSVGElement({element:"circle", attr:{id:"selectorGrip_rotate_"+c,fill:"#000",r:8,stroke:"#000","fill-opacity":0,"stroke-opacity":0,"stroke-width":0,style:"cursor:url("+n.imgPath+"rotate.png) 12 12, auto;"}});$.data(m,"dir",c);$.data(m,"type","rotate");this.rotateGrips[c]=this.selectorGripsGroup.appendChild(m)}for(c in this.selectorGrips){m=a.createSVGElement({element:"rect",attr:{id:"selectorGrip_resize_"+c,width:7,height:7,fill:"#4F80FF",stroke:"transparent","stroke-width":2,style:"cursor:"+c+"-resize","pointer-events":"all"}}); $.data(m,"dir",c);$.data(m,"type","resize");this.selectorGrips[c]=this.selectorGripsGroup.appendChild(m)}if(!$("#canvasBackground").length){c=n.dimensions;c=a.createSVGElement({element:"svg",attr:{id:"canvasBackground",width:c[0],height:c[1],x:0,y:0,overflow:svgedit.browser.isWebkit()?"none":"visible",style:"pointer-events:none"}});m=a.createSVGElement({element:"rect",attr:{width:"100%",height:"100%",x:0,y:0,"stroke-width":1,stroke:"#000",fill:"#FFF",style:"pointer-events:none"}});c.appendChild(m); a.svgRoot().insertBefore(c,a.svgContent())}};svgedit.select.SelectorManager.prototype.requestSelector=function(c){if(c==null)return null;var m=this.selectors.length;if(typeof this.selectorMap[c.id]=="object"){this.selectorMap[c.id].locked=true;return this.selectorMap[c.id]}for(var o=0;o element";this.svgElem_=c;this.obj_num=0;this.idPrefix=m||"svg_";this.releasedNums=[];this.all_layers=[];this.current_layer=null;this.nonce_= "";var o=this.svgElem_.getAttributeNS("http://svg-edit.googlecode.com","nonce");if(o&&f!=n.NEVER_RANDOMIZE)this.nonce_=o;else f==n.ALWAYS_RANDOMIZE&&this.setNonce(Math.floor(Math.random()*100001))};svgedit.draw.Drawing.prototype.getElem_=function(c){return this.svgElem_.querySelector?this.svgElem_.querySelector("#"+c):$(this.svgElem_).find("[id="+c+"]")[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(c){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",c);this.nonce_=c};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 c= this.obj_num,m=false;if(this.releasedNums.length>0){this.obj_num=this.releasedNums.pop();m=true}else this.obj_num++;for(var o=this.getId();this.getElem_(o);){if(m){this.obj_num=c;m=false}this.obj_num++;o=this.getId()}if(m)this.obj_num=c;return o};svgedit.draw.Drawing.prototype.releaseId=function(c){var m=this.idPrefix+(this.nonce_?this.nonce_+"_":"");if(typeof c!="string"||c.indexOf(m)!=0)return false;c=parseInt(c.substr(m.length));if(typeof c!="number"||c<=0||this.releasedNums.indexOf(c)!=-1)return false; this.releasedNums.push(c);return true};svgedit.draw.Drawing.prototype.getNumLayers=function(){return this.all_layers.length};svgedit.draw.Drawing.prototype.hasLayer=function(c){for(var m=0;m=0&&c1){var c=this.current_layer.parentNode.removeChild(this.current_layer);this.identifyLayers();return c}return null};svgedit.draw.Drawing.prototype.identifyLayers=function(){this.all_layers=[];for(var c=this.svgElem_.childNodes.length,m=[],o=[],b=null,d=false,e=0;e0||!d){for(e=1;o.indexOf("Layer "+e)>=0;)e++;o="Layer "+e;b=c.createElementNS("http://www.w3.org/2000/svg","g");d=c.createElementNS("http://www.w3.org/2000/svg","title");d.textContent=o; b.appendChild(d);for(d=0;d1))for(var o=0;o0){d=T element";this.elem=d;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 d= this.elem.pathSegList,e=d.numberOfItems;this.segs=[];this.selected_pts=[];this.first_seg=null;for(var l=0;l=e?null:d[l+1],L=l-1<0?null:d[l-1];if(w.type===2){if(L&&L.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip()}u=l}else if(p&&p.type===1){w.next=d[u+1];w.next.prev=w;w.mate=d[u];w.addGrip();if(this.first_seg==null)this.first_seg=w}else if(p){if(w.type!== 1){w.addGrip();if(p&&p.type!==2){w.next=p;w.next.prev=w}}}else if(w.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip();w.addGrip();if(!this.first_seg)this.first_seg=d[u]}}return this};svgedit.path.Path.prototype.eachSeg=function(d){for(var e=this.segs.length,l=0;l').documentElement, true);a.appendChild(e);var l=d.createElementNS(c,"svg");(b.clearSvgContentElement=function(){for(;l.firstChild;)l.removeChild(l.firstChild);$(l).attr({id:"svgcontent",width:o[0],height:o[1],x:o[0],y:o[1],overflow:m.show_outside_canvas?"visible":"hidden",xmlns:c,"xmlns:se":"http://svg-edit.googlecode.com","xmlns:xlink":"http://www.w3.org/1999/xlink"}).appendTo(e);var g=d.createComment(" Created with Method Draw - http://github.com/duopixel/Method-Draw/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix= function(g){u=g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var w=b.getCurrentDrawing=function(){return b.current_drawing_},p=1,L=null,T={shape:{fill:(m.initFill.color=="none"?"":"#")+m.initFill.color,fill_paint:null,fill_opacity:m.initFill.opacity,stroke:"#"+m.initStroke.color,stroke_paint:null,stroke_opacity:m.initStroke.opacity,stroke_width:m.initStroke.width,stroke_dasharray:"none",stroke_linejoin:"miter",stroke_linecap:"butt",opacity:m.initOpacity}};T.text=$.extend(true,{},T.shape);$.extend(T.text, {fill:"#000000",stroke_width:0,font_size:24,font_family:"Junction"});var M=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=w().getCurrentLayer();if(h&&g.element!=h.tagName){k.removeChild(h);h=null}if(!h){h=d.createElementNS(c,g.element);if(k)(L||k).appendChild(h)}g.curStyles&&svgedit.utilities.assignAttributes(h,{fill:M.fill,stroke:M.stroke,"stroke-width":M.stroke_width,"stroke-dasharray":M.stroke_dasharray,"stroke-linejoin":M.stroke_linejoin, "stroke-linecap":M.stroke_linecap,"stroke-opacity":M.stroke_opacity,"fill-opacity":M.fill_opacity,opacity:M.opacity/2,style:"pointer-events:inherit"},100);svgedit.utilities.assignAttributes(h,g.attr,100);svgedit.utilities.cleanupElement(h);return h},V=b.getTransformList=svgedit.transformlist.getTransformList,O=svgedit.math.transformPoint,ga=b.matrixMultiply=svgedit.math.matrixMultiply,ta=b.hasMatrixTransform=svgedit.math.hasMatrixTransform,ha=b.transformListToTransform=svgedit.math.transformListToTransform, ca=svgedit.math.snapToAngle,ea=svgedit.math.getMatrix;svgedit.units.init({getBaseUnit:function(){return m.baseUnit},getElement:svgedit.utilities.getElem,getHeight:function(){return l.getAttribute("height")/p},getWidth:function(){return l.getAttribute("width")/p},getRoundDigits:function(){return qb.round_digits}});var ra=b.convertToNum=svgedit.units.convertToNum;svgedit.utilities.init({getDOMDocument:function(){return d},getDOMContainer:function(){return a},getSVGRoot:function(){return e},getSelectedElements:function(){return J}, getSVGContent:function(){return l}});var pa=b.getUrlFromAttr=svgedit.utilities.getUrlFromAttr,ba=b.getHref=svgedit.utilities.getHref,S=b.setHref=svgedit.utilities.setHref,U=svgedit.utilities.getPathBBox;b.getBBox=svgedit.utilities.getBBox;var sa=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,oa=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,Aa=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, Ra=svgedit.history.MoveElementCommand,Na=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Wa=svgedit.history.ChangeElementCommand,Oa=svgedit.history.BatchCommand;b.undoMgr=new svgedit.history.UndoManager({handleHistoryEvent:function(g,h){var k=svgedit.history.HistoryEventTypes;if(g==k.BEFORE_UNAPPLY||g==k.BEFORE_APPLY)b.clearSelection();else if(g==k.AFTER_APPLY||g==k.AFTER_UNAPPLY){var v=h.elements();b.pathActions.clear();K("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v== Ra.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Na.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Na.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&cc(h.elem)}else if(v==Wa.type()){h.elem.tagName=="title"&&h.elem.parentNode.parentNode==l&&b.identifyLayers();k=k?h.newValues:h.oldValues;k.stdDeviation&&b.setBlurOffsets(h.elem.parentNode,k.stdDeviation);if(h.elem.tagName==="use"&&svgedit.browser.isWebkit()){v=h.elem;if(!v.getAttribute("x")&&!v.getAttribute("y")){k= v.parentNode;var s=v.nextSibling;k.removeChild(v);k.insertBefore(v,s)}}}}}});var Ia=function(g){b.undoMgr.addCommandToHistory(g)};svgedit.select.init(m,{createSVGElement:function(g){return b.addSvgElementFromJson(g)},svgRoot:function(){return e},svgContent:function(){return l},currentZoom:function(){return p},getStrokedBBox:function(g){return b.getStrokedBBox([g])}});var Qa=this.selectorManager=svgedit.select.getSelectorManager();svgedit.path.init({getCurrentZoom:function(){return p},getSVGRoot:function(){return e}}); svgedit.utilities.snapToGrid=function(g){var h=m.snappingStep,k=m.baseUnit;if(k!=="px")h*=svgedit.units.getTypeMap()[k];return g=Math.round(g/h)*h};var Ga=svgedit.utilities.snapToGrid,Cb={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"},Kb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data, ab=function(g){var h=$(g).attr(Kb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){vb().appendChild(yb[v]);delete yb[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)B=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var H=F.getAttribute("rx"),G=F.getAttribute("ry");if(H||G)B=D=b.convertToPath(F,true)}if(!D){var P=F.cloneNode(true),Q=document.createElementNS(c,"g"),W=F.parentNode;W.appendChild(Q);Q.appendChild(P);B=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return B}catch(ua){console.log(F,ua);return null}},k;$.each(g,function(){if(!k)if(this.parentNode)k=h(this)}); if(k==null)return null;var v=k.x+k.width,s=k.y+k.height,E=k.x,z=k.y,t=function(F){var B=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(B))D+=B/2;return D},C=[];$.each(g,function(F,B){var D=h(B);if(D){var H=t(B);E=Math.min(E,D.x-H);z=Math.min(z,D.y-H);C.push(D)}});k.x=E;k.y=z;$.each(g,function(F,B){var D=C[F];if(D&&B.nodeType==1){var H=t(B);v=Math.max(v,D.x+D.width+H);s=Math.max(s,D.y+D.height+H)}});k.width=v-E;k.height=s-z;return k};var Hb=this.getVisibleElements=function(g){g|| (g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(s){}});return h.reverse()},Mb=this.getVisibleElementsAndBBoxes=function(g){g||(g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push({elem:v,bbox:getStrokedBBox([v])})}catch(s){}});return h.reverse()},Nb=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=na()},ma=function(g){var h=document.createElementNS(g.namespaceURI, g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,s){s.localName!="-moz-math-font-style"&&h.setAttributeNS(s.namespaceURI,s.nodeName,s.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,s){switch(s.nodeType){case 1:h.appendChild(ma(s));break;case 3:h.textContent=s.nodeValue}});if($(g).data("gsvg"))$(h).data("gsvg",h.firstChild);else if($(g).data("symbol")){g=$(g).data("symbol");$(h).data("ref", g).data("symbol",g)}else h.tagName=="image"&&Zb(h);h.id=na();return h},Y,na,K;(function(g){var h={};Y=g.getId=function(){return w().getId()};na=g.getNextId=function(){return w().getNextId()};K=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var s=h[k];h[k]=v;return s}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h0&&s.getItem(0).type==4&&s.removeItem(0);if(g!=0){E=O(E,z,ha(s).matrix); z=e.createSVGTransform();z.setRotate(g,E.x,E.y);s.numberOfItems?s.insertItemBefore(z,0):s.appendItem(z)}else s.numberOfItems==0&&k.removeAttribute("transform");if(!h){s=k.getAttribute("transform");k.setAttribute("transform",v);db("transform",s,J);K("changed",J)}la("pathpointgrip_container");k=Qa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Pa=this.recalculateAllSelectedDimensions=function(){for(var g=new Oa(ob=="none"?"position":"size"),h=J.length;h--;){var k=cb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g); K("changed",J)}},Xa=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],hb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},pb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",s=function(){if(v)for(var D in h)h[D]=Ga(h[D]);oa(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var z=E===0?"fill":"stroke",t=g.getAttribute(z);if(t&&t.indexOf("url(")===0)if(k.a<0||k.d<0){t=N(t).cloneNode(true);if(k.a<0){var C= t.getAttribute("x1"),F=t.getAttribute("x2");t.setAttribute("x1",-(C-1));t.setAttribute("x2",-(F-1))}if(k.d<0){C=t.getAttribute("y1");F=t.getAttribute("y2");t.setAttribute("y1",-(C-1));t.setAttribute("y2",-(F-1))}t.id=na();vb().appendChild(t);g.setAttribute(z,"url(#"+t.id+")")}}E=g.tagName;if(E==="g"||E==="text"||E==="use")if(k.a==1&&k.b==0&&k.c==0&&k.d==1&&(k.e!=0||k.f!=0)){z=ha(g).matrix;z=ga(z.inverse(),k,z);h.x=parseFloat(h.x)+z.e;h.y=parseFloat(h.y)+z.f}else{z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix, k));z.clear();z.appendItem(t)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){z=V(g);t=e.createSVGTransform();t.setMatrix(ga(ha(z).matrix,k));z.clear();z.appendItem(t)}else{z=O(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=z.x+Math.min(0,h.width);h.y=z.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}s();break;case "ellipse":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;h.rx=k.a*h.rx;h.ry=k.d*h.ry;h.rx=Math.abs(h.rx);h.ry=Math.abs(h.ry); s();break;case "circle":E=O(h.cx,h.cy,k);h.cx=E.x;h.cy=E.y;E=svgedit.math.transformBox(box.x,box.y,box.width,box.height,k);h.r=Math.min((E.tr.x-E.tl.x)/2,(E.bl.y-E.tl.y)/2);if(h.r)h.r=Math.abs(h.r);s();break;case "line":z=O(h.x1,h.y1,k);C=O(h.x2,h.y2,k);h.x1=z.x;h.y1=z.y;h.x2=C.x;h.y2=C.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){z=ra("x",g.getAttribute("x"));t=ra("x",k[E].getAttribute("x"));C=ra("y",g.getAttribute("y"));F=ra("y",k[E].getAttribute("y"));var B={};if(!isNaN(z)&& !isNaN(t)&&z!=0&&t!=0&&h.x)B.x=h.x-(z-t);if(!isNaN(C)&&!isNaN(F)&&C!=0&&F!=0&&h.y)B.y=h.y-(C-F);if(B.x||B.y)oa(k[E],B,1E3,true)}s();break;case "use":s();break;case "g":(s=$(g).data("gsvg"))&&oa(s,h,1E3,true);break;case "polyline":case "polygon":s=h.points.length;for(E=0;E0){for(var k=h.numberOfItems;k--;){var v=h.getItem(k);if(v.type===0)h.removeItem(k);else if(v.type===1)svgedit.math.isIdentity(v.matrix)&&h.removeItem(k);else v.type===4&&v.angle===0&&h.removeItem(k)}if(h.numberOfItems===1&&sa(g))return null}if(!h|| h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var s=[];k--;){v=h.getItem(k);if(v.type===1)s.push([v.matrix,k]);else if(s.length)s=[]}if(s.length===2){k=e.createSVGTransformFromMatrix(ga(s[1][0],s[0][0]));h.removeItem(s[0][1]);h.removeItem(s[1][1]);h.insertItemBefore(k,s[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){s=e.createSVGTransform();v=ga(h.getItem(k-2).matrix,h.getItem(k-1).matrix);s.setMatrix(v);h.removeItem(k- 2);h.removeItem(k-2);h.appendItem(s)}}switch(g.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 E=$(g).data("gsvg");k=new Oa("Transform");var z={},t=null;v=[];switch(g.tagName){case "line":v=["x1","y1","x2","y2"];break;case "circle":v=["cx","cy","r"];break;case "ellipse":v=["cx","cy","rx","ry"];break;case "foreignObject":case "rect":case "image":v= ["width","height","x","y"];break;case "use":case "text":case "tspan":v=["x","y"];break;case "polygon":case "polyline":t={};t.points=g.getAttribute("points");s=g.points;var C=s.numberOfItems;z.points=Array(C);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;var Q=h.getItem(G-3).matrix,W=h.getItem(G-2).matrix,ua=h.getItem(G-1).matrix;C=g.childNodes;for(B=C.length;B--;){var wa=C.item(B);v=E=0;if(wa.nodeType==1){var fa=V(wa);if(fa){v=ha(fa).matrix;E=sa(wa);var ka=Za,qa=[];Za=wa.getAttribute("transform");if(E||ta(fa)){var za=e.createSVGTransform();za.setMatrix(ga(Q,W,ua,v));fa.clear();fa.appendItem(za);qa.push(za)}else{E=ga(v.inverse(),ua,v);za=e.createSVGMatrix(); za.e=-E.e;za.f=-E.f;v=ga(za.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),zb=e.createSVGTransform(),Qb=e.createSVGTransform();jb.setTranslate(E.e,E.f);zb.setScale(v.a,v.d);Qb.setTranslate(za.e,za.f);fa.appendItem(Qb);fa.appendItem(zb);fa.appendItem(jb);qa.push(Qb);qa.push(zb);qa.push(jb)}k.addSubCommand(cb(wa));Za=ka}}}h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G>=3&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix;za=e.createSVGTransform();za.setMatrix(v); h.clear();h.appendItem(za)}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;E=ha(h).matrix;h.removeItem(0);v=ha(h).matrix.inverse();v=ga(v,E);E=v.e;v=v.f;if(E!=0||v!=0){C=g.childNodes;B=C.length;for(G=[];B--;){wa=C.item(B);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(G.indexOf(ka)===-1){Db(ka,E,v);G.push(ka)}}ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q, 0):fa.appendItem(Q);k.addSubCommand(cb(wa));fa=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=fa.length;Q--;){W=fa.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(cb(W))}}Za=ka}}}G=[];Za=ka}}else if(G==1&&h.getItem(0).type==1&&!s){F=1;v=h.getItem(0).matrix;C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");if(fa=V(wa)){E=ga(v,ha(fa).matrix);G=e.createSVGTransform();G.setMatrix(E); fa.clear();fa.appendItem(G,0);k.addSubCommand(cb(wa));Za=ka;ka=wa.getAttribute("stroke-width");wa.getAttribute("stroke")!=="none"&&!isNaN(ka)&&wa.setAttribute("stroke-width",ka*((Math.abs(E.a)+Math.abs(E.d))/2))}}}h.clear()}else{if(s){D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(s){H={x:D.x+P.e,y:D.y+P.f};D=e.createSVGTransform();D.setRotate(s,H.x,H.y);h.numberOfItems? h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(s,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(s,H.x,H.y);H=D.matrix.inverse();ka=v.inverse();H=ga(ka,H,P,v);E=H.e;v=H.f;if(E!=0||v!=0){C=g.childNodes;for(B=C.length;B--;){wa=C.item(B);if(wa.nodeType==1){ka=Za;Za=wa.getAttribute("transform");fa=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);fa.numberOfItems?fa.insertItemBefore(Q,0):fa.appendItem(Q);k.addSubCommand(cb(wa));Za= ka}}}if(s)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{s=svgedit.utilities.getBBox(g);if(!s&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=sa(g)){D={x:s.x+s.width/2,y:s.y+s.height/2};H=O(s.x+s.width/2,s.y+s.height/2,ha(h).matrix);F=E*Math.PI/180;C=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(G-2).type==3&&h.getItem(G-3).type==2&&h.getItem(G-1).type==2){F=3;v=ha(h,G-3,G-1).matrix;h.removeItem(G-1);h.removeItem(G-2);h.removeItem(G-3)}else if(G==4&&h.getItem(G-1).type==1){F=3;v=ha(h).matrix; za=e.createSVGTransform();za.setMatrix(v);h.clear();h.appendItem(za);v=e.createSVGMatrix()}else if((G==1||G>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;s=ka.inverse();v=ga(s,P,ka);h.removeItem(0)}else if(G==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":z=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":z.points=g.getAttribute("points");if(z.points){s=g.points;C=s.numberOfItems;z.points=Array(C);for(F=0;F1&&s.showGrips(false)}}}K("selected",J);h||J.length==1?Qa.requestSelector(J[0]).showGrips(true):Qa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,z){if(E&&z&&E.compareDocumentPosition)return 3-(z.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]== null;)J.shift(0)}},Pb=this.selectOnly=function(g,h){$a(true);Fb(g,h)};this.removeFromSelection=function(g){if(J[0]!=null)if(g.length!=0){var h=Array(J.length);j=0;len=J.length;for(var k=0;k=0&&g.id!="svgcanvas")for(;g.nodeName!="foreignObject";){g=g.parentNode;if(!g)return e}var h=w().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Qa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v=null,s=null,E={},z={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(t){if(!(b.spaceKey|| t.button===1)){var C=t.button===2;t.altKey&&svgCanvas.cloneSelectedElements(0,0);Eb=l.getScreenCTM().inverse();var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;t.preventDefault();if(C)Ma="select";B=B/p;F=F/p;var D=$b(t);if(D.tagName==="a"&&D.childNodes.length===1)D=D.firstChild;var H=v=h=B,G=s=k=F;if(m.gridSnapping){B=Ga(B);F=Ga(F);h=Ga(h);k=Ga(k)}if(D==Qa.selectorParentGroup&&J[0]!=null){D=t.target;var P=nb(D,"type");if(P=="rotate"){Ma="rotate";current_rotate_mode=nb(D,"dir")}else if(P=="resize"){Ma= "resize";ob=nb(D,"dir")}D=J[0]}Za=D.getAttribute("transform");P=V(D);switch(Ma){case "select":Ja=true;ob="none";if(C)Ja=false;if(D!=e){if(J.indexOf(D)==-1){t.shiftKey||$a(true);Fb([D]);Lb=D;Ua.clear()}if(!C)for(C=0;C0&&b.removeFromSelection(D);H.length>0&&Fb(H);break;case "resize":D=V(C);H=(Q=ta(D))?E:svgedit.utilities.getBBox(C);G=H.x;W=H.y;var ua=H.width,wa=H.height;H=x-h;P=y-k;if(m.gridSnapping){H=Ga(H);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var fa=sa(C);if(fa){var ka=Math.sqrt(H*H+P*P);P=Math.atan2(P,H)-fa*Math.PI/180;H=ka*Math.cos(P);P=ka*Math.sin(P)}if(ob.indexOf("n")==-1&&ob.indexOf("s")==-1)P=0;if(ob.indexOf("e")==-1&&ob.indexOf("w")== -1)H=0;var qa=ka=0,za=wa?(wa+P)/wa:1,jb=ua?(ua+H)/ua:1;if(ob.indexOf("n")>=0){za=wa?(wa-P)/wa:1;qa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-H)/ua:1;ka=ua}H=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){G=Ga(G);ka=Ga(ka);W=Ga(W);qa=Ga(qa)}H.setTranslate(-(G+ka),-(W+qa));if(t.shiftKey)if(jb==1)jb=za;else za=jb;P.setScale(jb,za);ua.setTranslate(G+ka,W+qa);if(Q){Q=fa?1:0;D.replaceItem(H,2+Q);D.replaceItem(P,1+Q);D.replaceItem(ua,0+Q)}else{Q=D.numberOfItems;D.replaceItem(ua, Q-3);D.replaceItem(P,Q-2);D.replaceItem(H,Q-1)}Qa.requestSelector(C).resize();K("transition",J);break;case "zoom":H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100);break;case "text":oa(D,{x:x,y:y},1E3);break;case "line":H=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x=Ga(x);y=Ga(y)}G=x;Q=y;if(t.shiftKey){Q=ca(h,k,G,Q);G=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",G);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(H);break; case "foreignObject":case "square":case "rect":case "image":H=Math.abs(x-h);Q=Math.abs(y-k);if(Ma=="square"||t.shiftKey){H=Q=Math.max(H,Q);G=hk?k+W:k-W}if(t.altKey){Q=h;G=k;W=Math.abs(x-Q);P=t.shiftKey?W:Math.abs(y-G)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P);D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",G);window.opera||e.unsuspendRedraw(H);break;case "fhellipse":case "fhrect":z.minx=Math.min(H,z.minx);z.maxx=Math.max(H, z.maxx);z.miny=Math.min(G,z.miny);z.maxy=Math.max(G,z.maxy);case "fhpath":g+=+H+","+G+" ";D.setAttributeNS(null,"points",g);break;case "path":case "pathedit":x*=p;y*=p;if(m.gridSnapping){x=Ga(x);y=Ga(y);h=Ga(h);k=Ga(k)}if(t.shiftKey){if(Q=svgedit.path.path){D=Q.dragging?Q.dragging[0]:h;Q=Q.dragging?Q.dragging[1]:k}else{D=h;Q=k}Q=ca(D,Q,x,y);x=Q.x;y=Q.y}if(xa&&xa.getAttribute("display")!=="none"){H*=p;G*=p;oa(xa,{x:Math.min(v*p,H),y:Math.min(s*p,G),width:Math.abs(H-v*p),height:Math.abs(G-s*p)},100)}Ua.mouseMove(t, x,y);break;case "textedit":x*=p;y*=p;gb.mouseMove(B,F);break;case "rotate":H=svgedit.utilities.getBBox(C);Q=H.x+H.width/2;G=H.y+H.height/2;D=ea(C);D=O(Q,G,D);Q=D.x;G=D.y;D=H.x;W=H.y;if(current_rotate_mode=="nw")D=H.x+H.width;if(current_rotate_mode=="se")W=H.y+H.height;if(current_rotate_mode=="sw"){D=H.x+H.width;W=H.y+H.height}compensation_angle=(Math.atan2(G-W,Q-D)*(180/Math.PI)-90)%360;fa=(Math.atan2(G-y,Q-x)*(180/Math.PI)-90)%360;fa+=compensation_angle;if(m.gridSnapping)fa=Ga(fa);if(t.shiftKey)fa= Math.round(fa/45)*45;b.setRotationAngle(fa<-180?360+fa:fa,true);K("transition",J)}sb("mouseMove",{event:t,mouse_x:B,mouse_y:F,selected:C})}}).click(function(t){t.preventDefault();return false}).dblclick(function(t){var C=t.target.parentNode;if(C!==L){var F=$b(t),B=F.tagName;if(B==="text"&&Ma!=="textedit"){t=O(t.pageX,t.pageY,Eb);gb.select(F,t.x,t.y)}if((B==="g"||B==="a")&&sa(F)){dc(F);F=J[0];$a(true)}L&&Sb();C.tagName!=="g"&&C.tagName!=="a"||C===w().getCurrentLayer()||F===Qa.selectorParentGroup|| mc(F)}}).mouseup(function(t){if(t.button!==2){var C=Lb;Lb=null;if(Ja){var F=O(t.pageX,t.pageY,Eb),B=F.x*p;F=F.y*p;var D=B/p,H=F/p,G=la(Y()),P=false;Ja=false;switch(Ma){case "resize":case "multiselect":if(xa!=null){xa.setAttribute("display","none");ub=[]}Ma="select";case "select":if(J[0]!=null){if(J[1]==null){B=J[0];switch(B.tagName){case "g":case "use":case "image":case "foreignObject":break;default:ib.fill=B.getAttribute("fill");ib.fill_opacity=B.getAttribute("fill-opacity");ib.stroke=B.getAttribute("stroke"); ib.stroke_opacity=B.getAttribute("stroke-opacity");ib.stroke_width=B.getAttribute("stroke-width");ib.stroke_dasharray=B.getAttribute("stroke-dasharray");ib.stroke_linejoin=B.getAttribute("stroke-linejoin");ib.stroke_linecap=B.getAttribute("stroke-linecap")}if(B.tagName=="text"){fb.font_size=B.getAttribute("font-size");fb.font_family=B.getAttribute("font-family")}Qa.requestSelector(B).showGrips(true)}Pa();if(D!=v||H!=s){t=J.length;for(B=0;B=0?C.indexOf(",",D+1)>=0:C.indexOf(" ",C.indexOf(" ")+1)>=0)G=Ua.smoothPolylineIntoPath(G);break;case "line":C=$(G).attr(["x1","x2","y1","y2"]);P=C.x1!=C.x2||C.y1!=C.y2;break;case "foreignObject":case "square":case "rect":case "image":C=$(G).attr(["width","height"]);P=C.width!=0||C.height!=0||Ma==="image";break;case "circle":P=G.getAttribute("r")!=0;break;case "ellipse":C=$(G).attr(["rx","ry"]);P=C.rx!=null||C.ry!=null;break;case "fhellipse":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"ellipse", curStyles:true,attr:{cx:(z.minx+z.maxx)/2,cy:(z.miny+z.maxy)/2,rx:(z.maxx-z.minx)/2,ry:(z.maxy-z.miny)/2,id:Y()}});K("changed",[G]);P=true}break;case "fhrect":if(z.maxx-z.minx>0&&z.maxy-z.miny>0){G=da({element:"rect",curStyles:true,attr:{x:z.minx,y:z.miny,width:z.maxx-z.minx,height:z.maxy-z.miny,id:Y()}});K("changed",[G]);P=true}break;case "text":P=true;Pb([G]);gb.start(G);break;case "path":G=null;Ja=true;C=Ua.mouseUp(t,G,B,F);G=C.element;P=C.keep;break;case "pathedit":P=true;G=null;Ua.mouseUp(t); break;case "textedit":P=false;G=null;gb.mouseUp(t,B,F);break;case "rotate":P=true;G=null;Ma="select";C=b.undoMgr.finishUndoableChange();C.isEmpty()||Ia(C);Pa();K("changed",J)}B=sb("mouseUp",{event:t,mouse_x:B,mouse_y:F},true);$.each(B,function(ua,wa){if(wa){P=wa.keep||P;G=wa.element;Ja=wa.started||Ja}});if(!P&&G!=null){w().releaseId(Y());G.parentNode.removeChild(G);G=null;for(B=t.target;B.parentNode.parentNode.tagName=="g";)B=B.parentNode;if((Ma!="path"||!drawn_path)&&B.parentNode.id!="selectorParentGroup"&& B.id!="svgcanvas"&&B.id!="svgroot"){b.setMode("select");Pb([B],true)}}else if(G!=null){b.addedNew=true;t=0.2;var Q;if(false.beginElement&&G.getAttribute("opacity")!=M.opacity){Q=$(false).clone().attr({to:M.opacity,dur:t}).appendTo(G);try{Q[0].beginElement()}catch(W){}}else t=0;setTimeout(function(){Q&&Q.remove();G.setAttribute("opacity",M.opacity);G.setAttribute("style","pointer-events:inherit");Z(G);if(Ma==="path")Ua.toEditMode(G);else m.selectNew&&Pb([G],true);Ia(new Na(G));K("changed",[G])},t* 1E3)}Za=null}}});$(a).bind("mousewheel DOMMouseScroll",function(t){if(t.shiftKey){t.preventDefault();Eb=l.getScreenCTM().inverse();var C=O(t.pageX,t.pageY,Eb);C={x:C.x,y:C.y,width:0,height:0};if(t.wheelDelta)if(t.wheelDelta>=120)C.factor=2;else{if(t.wheelDelta<=-120)C.factor=0.5}else if(t.detail)if(t.detail>0)C.factor=0.5;else if(t.detail<0)C.factor=2;C.factor&&K("zoomed",C)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})},gb=b.textActions=function(){function g(fa){var ka=F.value=== "";$(F).focus();if(!arguments.length)if(ka)fa=0;else{if(F.selectionEnd!==F.selectionStart)return;fa=F.selectionEnd}var qa;qa=G[fa];ka||F.setSelectionRange(fa,fa);B=la("text_cursor");if(!B){B=document.createElementNS(c,"line");oa(B,{id:"text_cursor",stroke:"#333","stroke-width":1});B=la("selectorParentGroup").appendChild(B)}H||(H=setInterval(function(){var za=B.getAttribute("display")==="none";B.setAttribute("display",za?"inline":"none")},600));ka=E(qa.x,P.y);qa=E(qa.x,P.y+P.height);oa(B,{x1:ka.x, y1:ka.y,x2:qa.x,y2:qa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(fa,ka,qa){if(fa===ka)g(ka);else{qa||F.setSelectionRange(fa,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");oa(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}fa=G[fa];var za=G[ka];B.setAttribute("visibility","hidden");ka=E(fa.x,P.y);qa=E(fa.x+(za.x-fa.x),P.y);var jb=E(fa.x,P.y+P.height);fa=E(fa.x+(za.x- fa.x),P.y+P.height);oa(D,{d:"M"+ka.x+","+ka.y+" L"+qa.x+","+qa.y+" "+fa.x+","+fa.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(fa,ka){var qa=e.createSVGPoint();qa.x=fa;qa.y=ka;if(G.length==1)return 0;qa=C.getCharNumAtPosition(qa);if(qa<0){qa=G.length-2;if(fa<=G[0].x)qa=0}else if(qa>=G.length-2)qa=G.length-2;var za=G[qa];fa>za.x+za.width/2&&qa++;return qa}function v(fa,ka,qa){var za=F.selectionStart;fa=k(fa,ka);h(Math.min(za,fa),Math.max(za,fa),!qa)}function s(fa,ka){var qa={x:fa,y:ka};qa.x/= p;qa.y/=p;if(Q){var za=O(qa.x,qa.y,Q.inverse());qa.x=za.x;qa.y=za.y}return qa}function E(fa,ka){var qa={x:fa,y:ka};if(Q){var za=O(qa.x,qa.y,Q);qa.x=za.x;qa.y=za.y}qa.x*=p;qa.y*=p;return qa}function z(fa){h(0,C.textContent.length);$(this).unbind(fa)}function t(fa){if(wa&&C){var ka=O(fa.pageX,fa.pageY,Eb);ka=s(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var qa=C.textContent,za=qa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;qa=qa.substr(ka).match(/^[a-z0-9]+/i);h(za,(qa?qa[0].length:0)+ka);$(fa.target).click(z); setTimeout(function(){$(fa.target).unbind("click",z)},300)}}var C,F,B,D,H,G=[],P,Q,W,ua,wa;return{select:function(fa,ka,qa){C=fa;gb.toEditMode(ka,qa)},start:function(fa){C=fa;gb.toEditMode()},mouseDown:function(fa,ka,qa,za){fa=s(qa,za);F.focus();g(k(fa.x,fa.y));W=qa;ua=za},mouseMove:function(fa,ka){var qa=s(fa,ka);v(qa.x,qa.y)},mouseUp:function(fa,ka,qa){var za=s(ka,qa);v(za.x,za.y,true);fa.target!==C&&kaW-2&&qaua-2&&gb.toSelectMode(true)},setCursor:g,toEditMode:function(fa,ka){wa= false;Ma="textedit";Qa.requestSelector(C).showGrips(false);Qa.requestSelector(C);gb.init();$(C).css("cursor","text");if(arguments.length){var qa=s(fa,ka);g(k(qa.x,qa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(fa){Ma="select";clearInterval(H);H=null;D&&$(D).attr("display","none");B&&$(B).attr("visibility","hidden");$(C).css("cursor","move");if(fa){$a();$(C).css("cursor","move");K("selected",[C]);Fb([C],true)}C&&!C.textContent.length&&b.deleteSelectedElements();$(F).blur(); C=false},setInputElem:function(fa){F=fa},clear:function(){Ma=="textedit"&&gb.toSelectMode()},init:function(){if(C){if(!C.parentNode){C=J[0];Qa.requestSelector(C).showGrips(false)}var fa=C.textContent.length,ka=C.getAttribute("transform");P=svgedit.utilities.getBBox(C);Q=ka?ea(C):null;G=Array(fa);F.focus();$(C).unbind("dblclick",t).dblclick(t);if(!fa)var qa={x:P.x+P.width/2,width:0};for(ka=0;ka=0&&this.selected_pts.push(C)}this.selected_pts.sort();t=this.selected_pts.length;for(z=Array(t);t--;){F=this.segs[this.selected_pts[t]];F.select(true);z[t]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);K("selected",z)};var s=h=null,E=false;return{mouseDown:function(z,t,C,F){if(Ma==="path"){mouse_x=C;mouse_y=F;F=mouse_x/p;t=mouse_y/p;C=la("path_stretch_line"); k=[F,t];if(m.gridSnapping){F=Ga(F);t=Ga(t);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!C){C=document.createElementNS(c,"path");oa(C,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});C=la("selectorParentGroup").appendChild(C)}C.setAttribute("display","inline");var B=null;if(s){B=s.pathSegList;for(var D=B.numberOfItems,H=6/p,G=false;D;){D--;var P=B.getItem(D),Q=P.x;P=P.y;if(F>=Q-H&&F<=Q+H&&t>=P-H&&t<=P+H){G=true;break}}H=Y();svgedit.path.removePath_(H);H=la(H);Q=B.numberOfItems; if(G){if(D<=1&&Q>=2){F=B.getItem(0).x;t=B.getItem(0).y;z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(F,t):s.createSVGPathSegCurvetoCubicAbs(F,t,z.x1/p,z.y1/p,F,t);F=s.createSVGPathSegClosePath();B.appendItem(z);B.appendItem(F)}else if(Q<3)return B=false;$(C).remove();element=H;s=null;Ja=false;if(g){svgedit.path.path.matrix&&pb(H,{},svgedit.path.path.matrix.inverse());C=H.getAttribute("d");z=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d",z+C);$(H).remove(); svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();svgedit.path.path.init();Ua.toEditMode(svgedit.path.path.elem);svgedit.path.path.selectPt();return false}}else{if(!$.contains(a,$b(z))){console.log("Clicked outside canvas");return false}B=s.pathSegList.numberOfItems;D=s.pathSegList.getItem(B-1);H=D.x;D=D.y;if(z.shiftKey){z=ca(H,D,F,t);F=z.x;t=z.y}z=C.pathSegList.getItem(1);z=z.pathSegType===4?s.createSVGPathSegLinetoAbs(mb(F),mb(t)):s.createSVGPathSegCurvetoCubicAbs(mb(F),mb(t),z.x1/p,z.y1/ p,z.x2/p,z.y2/p);s.pathSegList.appendItem(z);F*=p;t*=p;C.setAttribute("d",["M",F,t,F,t].join(" "));C=B;if(g)C+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(C,F,t)}}else{d_attr="M"+F+","+t+" ";s=da({element:"path",curStyles:true,attr:{d:d_attr,id:na(),opacity:M.opacity/2}});C.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));C=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(C,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD();H=z.target.id; if(H.substr(0,14)=="pathpointgrip_"){t=svgedit.path.path.cur_pt=parseInt(H.substr(14));svgedit.path.path.dragging=[C,F];B=svgedit.path.path.segs[t];if(z.shiftKey)B.selected?svgedit.path.path.removePtFromSelection(t):svgedit.path.path.addPtsToSelection(t);else{if(svgedit.path.path.selected_pts.length<=1||!B.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(t)}}else if(H.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[C,F];z=H.split("_")[1].split("c");t=z[0]- 0;svgedit.path.path.selectPt(t,z[1]-0)}if(!svgedit.path.path.dragging){if(xa==null)xa=Qa.getRubberBandBox();oa(xa,{x:C*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(z,t,C){E=true;if(Ma==="path"){if(s){var F=s.pathSegList;z=F.numberOfItems-1;if(k){var B=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");B.setAttribute("cx",t);B.setAttribute("cy",C);B.setAttribute("display","inline");B=k[0];var H=k[1];F.getItem(z);var G= B+(B-t/p),P=H+(H-C/p);D.setAttribute("cx",G*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);oa(D,{x1:t,y1:C,x2:B*p,y2:H*p,display:"inline"});oa(Q,{x1:G*p,y1:P*p,x2:B*p,y2:H*p,display:"inline"});if(z===0)v=[t,C];else{F=F.getItem(z-1);t=F.x;C=F.y;if(F.pathSegType===6){t+=t-F.x2;C+=C-F.y2}else if(v){t=v[0]/p;C=v[1]/p}svgedit.path.replacePathSeg(6,z,[B,H,t,C,G,P],s)}}else if(B=la("path_stretch_line")){z=F.getItem(z);if(z.pathSegType=== 6)svgedit.path.replacePathSeg(6,1,[t,C,(z.x+(z.x-z.x2))*p,(z.y+(z.y-z.y2))*p,t,C],B);else v?svgedit.path.replacePathSeg(6,1,[t,C,v[0],v[1],t,C],B):svgedit.path.replacePathSeg(4,1,[t,C],B)}}}else if(svgedit.path.path.dragging){B=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);H=svgedit.path.getPointFromGrip({x:t,y:C},svgedit.path.path);z=H.x-B.x;B=H.y-B.y;svgedit.path.path.dragging=[t,C];svgedit.path.path.dragctrl?svgedit.path.path.moveCtrl(z, B):svgedit.path.path.movePts(z,B)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=xa.getBBox(),ua=svgedit.path.getGripPt(this);W=svgedit.math.rectsIntersect(W,{x:ua.x,y:ua.y,width:0,height:0});this.select(W);W&&svgedit.path.path.selected_pts.push(this.index)}})}},mouseUp:function(z,t){if(Ma==="path"){k=null;if(!s){t=la(Y());Ja=false;v=null}return{keep:true,element:t}}if(svgedit.path.path.dragging){var C=svgedit.path.path.cur_pt;svgedit.path.path.dragging= false;svgedit.path.path.dragctrl=false;svgedit.path.path.update();E&&svgedit.path.path.endChanges("Move path point(s)");!z.shiftKey&&!E&&svgedit.path.path.selectPt(C)}else if(xa&&xa.getAttribute("display")!="none"){xa.setAttribute("display","none");xa.getAttribute("width")<=2&&xa.getAttribute("height")<=2&&Ua.toSelectMode(z.target)}else Ua.toSelectMode(z.target);E=false},toEditMode:function(z){svgedit.path.path=svgedit.path.getPath_(z);Ma="pathedit";$a();svgedit.path.path.show(true).update();svgedit.path.path.oldbbox= svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(z){var t=z==svgedit.path.path.elem;Ma="select";svgedit.path.path.show(false);h=false;$a();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(t){K("selected",[z]);Fb([z],true)}},addSubPath:function(z){if(z){Ma="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(z){if(h===z){Ua.toEditMode(z);Ma="pathedit"}else h=z},reorient:function(){var z=J[0];if(z)if(sa(z)!=0){var t=new Oa("Reorient path"), C={d:z.getAttribute("d"),transform:z.getAttribute("transform")};t.addSubCommand(new Wa(z,C));$a();this.resetOrientation(z);Ia(t);svgedit.path.getPath_(z).show(false).matrix=null;this.clear();Fb([z],true);K("changed",J)}},clear:function(){h=null;if(s){var z=la(Y());$(la("path_stretch_line")).remove();$(z).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");s=v=null;Ja=false}else Ma=="pathedit"&&this.toSelectMode();svgedit.path.path&&svgedit.path.path.init().show(false)},resetOrientation:function(z){if(z== null||z.nodeName!="path")return false;var t=V(z),C=ha(t).matrix;t.clear();z.removeAttribute("transform");t=z.pathSegList;for(var F=t.numberOfItems,B=0;B0){H=F.getItem(B-1).pathSegType;if(H===2){D(B-1,1);C();break}else if(H=== 1&&F.numberOfItems-1===B){D(B,1);C();break}}}return false};C();if(svgedit.path.path.elem.pathSegList.numberOfItems<=1){Ua.toSelectMode(svgedit.path.path.elem);b.deleteSelectedElements()}else{svgedit.path.path.init();svgedit.path.path.clearSelection();if(window.opera){z=$(svgedit.path.path.elem);z.attr("d",z.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}},smoothPolylineIntoPath:function(z){var t=z.points,C=t.numberOfItems;if(C>=4){var F=t.getItem(0),B=null;z=[];z.push(["M",F.x,",", F.y," C"].join(""));for(var D=1;D<=C-4;D+=3){var H=t.getItem(D),G=t.getItem(D+1),P=t.getItem(D+2);if(B)if((F=svgedit.path.smoothControlPoints(B,H,F))&&F.length==2){H=z[z.length-1].split(",");H[2]=F[0].x;H[3]=F[0].y;z[z.length-1]=H.join(",");H=F[1]}z.push([H.x,H.y,G.x,G.y,P.x,P.y].join(","));F=P;B=G}for(z.push("L");D0;);Ua.clear(true);$.each(l.childNodes,function(k,v){k&&v.nodeType===8&&v.data.indexOf("Created with")>=0&&l.insertBefore(v,l.firstChild)});if(L){Sb();Pb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,s=0;s=0;C--){t=z.item(C); D=v(t.nodeValue);if(!(H.indexOf(t.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(t.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(t.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+s}else D=svgedit.units.shortFloat(D);if(qb.apply&&g.nodeName==="image"&&t.localName==="href"&&qb.images&&qb.images==="embed"){var G=Ya[D];if(G)D=G}if(!t.namespaceURI||t.namespaceURI==c||Aa[t.namespaceURI]){k.push(t.nodeName);k.push('="');k.push(D); k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;z=false;for(C=0;C");break;case 8:k.push("\n");k.push(Array(h+1).join(" "));k.push("