(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,ra,la){var ma;if(ra!==d){S=U.match(ba?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);U=S[3]||"";if(la===2&&f(ra))ra=ra.replace(ba?ea:ca,"");else{ma=p(S[2]);ra=f(ra)?p[ba?fa:O](ra):ra;ra=la===2?ra:la===1?a.extend({},ra,ma):a.extend({},ma,ra);ra=u(ra);if(ba)ra=ra.replace(qa,l)}ba=S[1]+(ba?"#":ra||!S[1]?"?":"")+ra+U}else ba= S(U!==d?U:n[sa][ha]);return ba}function o(ba,S,U){if(S===d||typeof S==="boolean"){U=S;S=u[ba?fa:O]()}else S=f(S)?S.replace(ba?ea:ca,""):S;return p(S,U)}function b(ba,S,U,ra){if(!f(U)&&typeof U!=="object"){ra=U;U=S;S=d}return this.each(function(){var la=a(this),ma=S||da()[(this.nodeName||"").toLowerCase()]||"",Z=ma&&la.attr(ma)||"";la.attr(ma,u[ba](Z,U,ra))})}var d,e=Array.prototype.slice,l=decodeURIComponent,u=a.param,z,p,L,T=a.bbq=a.bbq||{},N,J,da,V=a.event.special,O="querystring",fa="fragment", sa="location",ha="href",ca=/^.*\?|#.*$/g,ea=/^.*\#/,qa,pa={};u[O]=c(m,0,function(ba){return ba.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")});u[fa]=z=c(m,1,function(ba){return ba.replace(/^[^#]*#?(.*)$/,"$1")});z.noEscape=function(ba){ba=ba||"";ba=a.map(ba.split(""),encodeURIComponent);qa=RegExp(ba.join("|"),"g")};z.noEscape(",/");a.deparam=p=function(ba,S){var U={},ra={"true":true,"false":false,"null":null};a.each(ba.replace(/\+/g," ").split("&"),function(la,ma){var Z=ma.split("="),za=l(Z[0]),Ka=U, Qa=0,Ma=za.split("]["),Sa=Ma.length-1;if(/\[/.test(Ma[0])&&/\]$/.test(Ma[Sa])){Ma[Sa]=Ma[Sa].replace(/\]$/,"");Ma=Ma.shift().split("[").concat(Ma);Sa=Ma.length-1}else Sa=0;if(Z.length===2){Z=l(Z[1]);if(S)Z=Z&&!isNaN(Z)?+Z:Z==="undefined"?d:ra[Z]!==d?ra[Z]:Z;if(Sa)for(;Qa<=Sa;Qa++){za=Ma[Qa]===""?Ka.length:Ma[Qa];Ka=Ka[za]=Qa').hide().insertAfter("body")[0].contentWindow; J=function(){return c(T.document[b][d])};N=function(da,V){if(da!==V){var O=T.document;O.open().close();O[b].hash="#"+da}};N(c())}}var p={},L,T,N,J;p.start=function(){if(!L){var da=c();N||z();(function V(){var O=c(),fa=J(da);if(O!==da){N(da=O,fa);a(n).trigger("hashchange")}else if(fa!==da)n[b][d]=n[b][d].replace(/#.*/,"")+"#"+fa;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=sa+"PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNzUiIGhlaWdodD0iMjc1Ij48L3N2Zz4%3D";N=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 ra=m.fallback_path?m.fallback_path:"";a.each(S,function(Sa,Ya){a("#"+Sa);var Na=a(new Image).attr({"class":"svg_icon",src:ra+Ya,width:z,height:p,alt:"icon"});pa(Na,Sa)})}else for(var la=L.length,ma=0;ma0&&!ba)Ia=f(Ia,Na,true);qa(a(this),Ia,Ya)})});if(!S){ba&&U.remove();ha&&ha.remove();N&&N.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,ra,la,ma,Z,za,Ka=0,Qa=0;do{U=ba.charCodeAt(Ka++);ra=ba.charCodeAt(Ka++);la=ba.charCodeAt(Ka++);ma=U>>2;U=(U&3)<<4|ra>>4;Z=(ra&15)<<2|la>>6;za=la&63;if(isNaN(ra))Z=za=64;else if(isNaN(la))za=64;S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(ma);S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(U);S[Qa++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(Z);S[Qa++]= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(za)}while(Ka-1&&O.indexOf("Chrome/");var sa="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 qa=function(ba,S,U,ra){fa&&S.css("visibility","hidden");if(m.replace){ra&&S.attr("id",U);(U=ba.attr("class"))&&S.attr("class", "svg_icon "+U);ba.replaceWith(S)}else ba.append(S);fa&&setTimeout(function(){S.removeAttr("style")},1)},pa=function(ba,S){if(m.id_match===undefined||m.id_match!==false)qa(holder,ba,S,true);n[S]=ba};f=function(ba,S){var U=ba.find("defs");if(!U.length)return ba;U=fa?U.find("*").filter(function(){return!!this.id}):U.find("[id]");var ra=ba[0].getElementsByTagName("*"),la=ra.length;U.each(function(ma){var Z=this.id;a(T).find("#"+Z);this.id=ma="x"+Z+S+ma;Z="url(#"+Z+")";var za="url(#"+ma+")";for(ma=0;ma< la;ma++){var Ka=ra[ma];Ka.getAttribute("fill")===Z&&Ka.setAttribute("fill",za);Ka.getAttribute("stroke")===Z&&Ka.setAttribute("stroke",za);Ka.getAttribute("filter")===Z&&Ka.setAttribute("filter",za)}});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(na,aa,ta,M,I){var Y=I||a("stop",{"stop-color":aa,"stop-opacity":ta,offset:na},ea);if(I){aa=I.getAttribute("stop-color");ta=I.getAttribute("stop-opacity");na=I.getAttribute("offset")}else ea.appendChild(Y);if(ta===null)ta=1;I=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+na*fa)+", 26)"},Gb);var Oa= 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":ta,transform:"translate("+(10+na*fa)+", 26)",stroke:"#000","stroke-width":1.5},Gb);$(Oa).mousedown(function(Wa){b(this);Xa=nb;da.mousemove(l).mouseup(d);Fa=Pb.offset();Wa.preventDefault();return false}).data("stop",Y).data("bg",I).dblclick(function(){$("div.jGraduate_LightBox").show();for(var Wa=this,fb=+Y.getAttribute("stop-opacity")|| 1,tb=Y.getAttribute("stop-color")||1,wb=(parseFloat(fb)*255).toString(16);wb.length<2;)wb="0"+wb;aa=tb.substr(1)+wb;$("#"+p+"_jGraduate_stopPicker").css({left:100,bottom:15}).jPicker({window:{title:"Pick the start color and opacity for the gradient"},images:{clientPath:z.images.clientPath},color:{active:aa,alphaSupport:true}},function(Hb){tb=Hb.val("hex")?"#"+Hb.val("hex"):"none";fb=Hb.val("a")!==null?Hb.val("a")/256:1;Wa.setAttribute("fill",tb);Wa.setAttribute("fill-opacity",fb);Y.setAttribute("stop-color", tb);Y.setAttribute("stop-opacity",fb);$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()},null,function(){$("div.jGraduate_LightBox").hide();$("#"+p+"_jGraduate_stopPicker").hide()})});$(ea).find("stop").each(function(){var Wa=$(this);if(+this.getAttribute("offset")>na){if(!aa){var fb=this.getAttribute("stop-color"),tb=this.getAttribute("stop-opacity");Y.setAttribute("stop-color",fb);Oa.setAttribute("fill",fb);Y.setAttribute("stop-opacity",tb===null?1:tb);Oa.setAttribute("fill-opacity", tb===null?1:tb)}Wa.before(Y);return false}});M&&b(Oa);return Y}function b(na){nb&&nb.setAttribute("stroke","#000");na.setAttribute("stroke","blue");nb=na;nb.parentNode.appendChild(nb)}function d(){da.unbind("mousemove",l);if(La.getAttribute("display")!=="none"){La.setAttribute("display","none");var na=$(nb),aa=na.data("stop");na=na.data("bg");$([nb,aa,na]).remove()}Xa=null}function e(){var na=$a?"rotate("+$a+","+Ja+","+ob+") ":"";Za===1&&Ra===1?ea.removeAttribute("gradientTransform"):ea.setAttribute("gradientTransform", na+"translate("+-Ja*(Za-1)+","+-ob*(Ra-1)+") scale("+Za+","+Ra+")")}function l(na){var aa=na.pageX-Fa.left;na=na.pageY-Fa.top;aa=aa<10?10:aa>fa+10?fa+10:aa;var ta="translate("+aa+", 26)";if(na<-60||na>130){La.setAttribute("display","block");La.setAttribute("transform",ta)}else La.setAttribute("display","none");Xa.setAttribute("transform",ta);$.data(Xa,"bg").setAttribute("transform",ta);$.data(Xa,"stop").setAttribute("offset",(aa-10)/fa);var M=0;$(ea).find("stop").each(function(){var I=this.getAttribute("offset"), Y=$(this);if(I
  • Solid Color
  • Linear Gradient
  • Radial Gradient
  • ');var V=$(L+"> .jGraduate_colPick"),O=$(L+"> .jGraduate_gradPick");O.html('

    '+z.window.pickerTitle+'


    ');var fa=256,sa=fa-0,ha=fa-0,ca,ea,qa,pa={};$(".jGraduate_SliderBar").width(145);var ba=$("#"+p+"_jGraduate_GradContainer")[0],S=a("svg",{id:p+"_jgraduate_svg",width:fa,height:fa,xmlns:n.svg},ba);ca=ca||u.paint.type;var U=ea=u.paint[ca],ra=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 ma=typeof z.newstop;if(ma==="string")switch(z.newstop){case "same":o(1,"#"+J,1);break;case "inverse":ma="";for(var Z=0;Z<6;Z+=2){J.substr(Z,2);var za=(255-parseInt(J.substr(Z,2),16)).toString(16); if(za.length<2)za=0+za;ma+=za}o(1,"#"+ma,1);break;case "white":o(1,"#ffffff",1);break;case "black":o(1,"#000000",1)}else if(ma==="object")o(1,z.newstop.color||"#"+J,"opac"in z.newstop?z.newstop.opac:1)}J=parseFloat(U.getAttribute("x1")||0);ma=parseFloat(U.getAttribute("y1")||0);Z=parseFloat(U.getAttribute("x2")||1);za=parseFloat(U.getAttribute("y2")||0);var Ka=parseFloat(U.getAttribute("cx")||0.5),Qa=parseFloat(U.getAttribute("cy")||0.5),Ma=parseFloat(U.getAttribute("fx")||Ka),Sa=parseFloat(U.getAttribute("fy")|| Qa);qa=a("rect",{id:p+"_jgraduate_rect",x:0,y:0,width:sa,height:ha,fill:"url(#"+p+"_jgraduate_grad)","fill-opacity":ra/100},S);var Ya=$("
    ").attr({"class":"grad_coord jGraduate_lg_field",title:"Begin Stop"}).text(1).css({top:ma*fa,left:J*fa}).data("coord","start").appendTo(ba),Na=Ya.clone().text(2).css({top:za*fa,left:Z*fa}).attr("title","End stop").data("coord","end").appendTo(ba),Ia=$("
    ").attr({"class":"grad_coord jGraduate_rg_field",title:"Center stop"}).text("C").css({top:Qa*fa,left:Ka* fa}).data("coord","center").appendTo(ba),Pa=Ia.clone().text("F").css({top:Sa*fa,left:Ma*fa,display:"none"}).attr("title","Focus point").data("coord","focus").appendTo(ba);Pa[0].id=p+"_jGraduate_focusCoord";$(L+" .grad_coord");$.each(["x1","y1","x2","y2","cx","cy","fx","fy"],function(na,aa){var ta=ea.getAttribute(aa),M=isNaN(aa[1]);ta||(ta=M?"0.5":aa==="x2"?"1.0":"0.0");pa[aa]=$("#"+p+"_jGraduate_"+aa).val(ta).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"&&!mb))if(M&&ca==="radialGradient"||!M&&ca==="linearGradient")ea.setAttribute(aa,this.value);var I=M?aa[0]==="c"?Ia:Pa:aa[1]==="1"?Ya:Na,Y=aa.indexOf("x")>=0?"left":"top";I.css(Y,this.value*fa)}).change()});var Ga,Gb,Pb=$("#"+p+"_jGraduate_StopSlider"),nb,ab,Xa,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),Fa,Za=1,Ra=1,$a=0,Ja=Ka,ob=Qa;ab=a("svg",{width:"100%",height:45},Pb[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",z.images.clientPath+"map-opacity.png");$(ab).click(function(na){Fa=Pb.offset();if(na.target.tagName!=="path"){var aa=na.pageX-Fa.left-8;aa=aa<10?10:aa>fa+10?fa+10:aa;o(aa/fa,0,0,true);na.stopPropagation()}});$(ab).mouseover(function(){ab.appendChild(La)});Gb=a("g",{},ab);a("line",{x1:10,y1:15,x2:fa+10,y2:15,"stroke-width":2,stroke:"#000"},ab);var Cb=O.find(".jGraduate_spreadMethod").change(function(){ea.setAttribute("spreadMethod", $(this).val())}),eb=null,hb=function(na){var aa=na.pageX-xb.left,ta=na.pageY-xb.top;aa=aa<0?0:aa>fa?fa:aa;ta=ta<0?0:ta>fa?fa:ta;eb.css("left",aa).css("top",ta);aa/=sa;ta/=ha;var M=eb.data("coord"),I=ea;switch(M){case "start":pa.x1.val(aa);pa.y1.val(ta);I.setAttribute("x1",aa);I.setAttribute("y1",ta);break;case "end":pa.x2.val(aa);pa.y2.val(ta);I.setAttribute("x2",aa);I.setAttribute("y2",ta);break;case "center":pa.cx.val(aa);pa.cy.val(ta);I.setAttribute("cx",aa);I.setAttribute("cy",ta);Ja=aa;ob=ta; e();break;case "focus":pa.fx.val(aa);pa.fy.val(ta);I.setAttribute("fx",aa);I.setAttribute("fy",ta);e()}na.preventDefault()},ib=function(){eb=null;da.unbind("mousemove",hb).unbind("mouseup",ib)};Ga=ea.getElementsByTagNameNS(n.svg,"stop");if(Da<2){for(;Da<2;){ea.appendChild(document.createElementNS(n.svg,"stop"));++Da}Ga=ea.getElementsByTagNameNS(n.svg,"stop")}var Da=Ga.length;for(Z=0;Z99.5)M=99.5;if(M>0)Ra=1-M/100;else Za=-(M/100)-1;I=145*((M+100)/2)/100;Y&&e();break;case "angle":$a=M;I=$a/180;I+=0.5;I*=145;Y&&e()}if(I>145)I= 145;else if(I<0)I=0;ta.css({"margin-left":I-5})}).change()});var Eb=function(na){var aa=na.pageX-pb.offset.left-parseInt(pb.parent.css("border-left-width"));if(aa>145)aa=145;if(aa<=0)aa=0;var ta=aa-5;aa/=145;switch(pb.type){case "radius":aa=Math.pow(aa*2,2.5);if(aa>0.98&&aa<1.02)aa=1;if(aa<=0.01)aa=0.01;ea.setAttribute("r",aa);break;case "opacity":u.paint.alpha=parseInt(aa*100);qa.setAttribute("fill-opacity",aa);break;case "ellip":Ra=Za=1;if(aa<0.5){aa/=0.5;Za=aa<=0?0.01:aa}else if(aa>0.5){aa/=0.5; aa=2-aa;Ra=aa<=0?0.01:aa}e();aa-=1;if(Ra===aa+1)aa=Math.abs(aa);break;case "angle":aa-=0.5;$a=aa*=180;e();aa/=100}pb.elem.css({"margin-left":ta});aa=Math.round(aa*100);pb.input.val(aa);na.preventDefault()},Kb=function(){da.unbind("mousemove",Eb).unbind("mouseup",Kb);pb=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:z.window.pickerTitle},images:{clientPath:z.images.clientPath},color:{active:J,alphaSupport:true}},function(na){u.paint.type="solidColor";u.paint.alpha=na.val("ahex")?Math.round(na.val("a")/255*100):100;u.paint.solidColor=na.val("hex")?na.val("hex"):"none";u.paint.radialGradient=null;T()},null,function(){N()});var Ib=$(L+" .jGraduate_tabs li");Ib.click(function(){Ib.removeClass("jGraduate_tab_current");$(this).addClass("jGraduate_tab_current"); $(L+" > div").hide();var na=$(this).attr("data-type");$(L+" .jGraduate_gradPick").show();if(na==="rg"||na==="lg"){$(".jGraduate_"+na+"_field").show();$(".jGraduate_"+(na==="lg"?"rg":"lg")+"_field").hide();$("#"+p+"_jgraduate_rect")[0].setAttribute("fill","url(#"+p+"_"+na+"_jgraduate_grad)");ca=na==="lg"?"linearGradient":"radialGradient";$("#"+p+"_jGraduate_OpacInput").val(u.paint.alpha).change();var aa=$("#"+p+"_"+na+"_jgraduate_grad")[0];if(ea!==aa){var ta=$(ea).find("stop");$(aa).empty().append(ta); ea=aa;aa=Cb.val();ea.setAttribute("spreadMethod",aa)}mb=na==="rg"&&ea.getAttribute("fx")!=null&&!(Ka==Ma&&Qa==Sa);$("#"+p+"_jGraduate_focusCoord").toggle(mb);if(mb)$("#"+p+"_jGraduate_match_ctr")[0].checked=false}else{$(L+" .jGraduate_gradPick").hide();$(L+" .jGraduate_colPick").show()}});$(L+" > div").hide();Ib.removeClass("jGraduate_tab_current");var Qb;switch(u.paint.type){case "linearGradient":Qb=$(L+" .jGraduate_tab_lingrad");break;case "radialGradient":Qb=$(L+" .jGraduate_tab_radgrad");break; default:Qb=$(L+" .jGraduate_tab_color")}u.show();setTimeout(function(){Qb.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,z=e.pageY;e=a.width()-b.width();var p=a.height()-b.height();if(u>e-15)u=e-15;if(z>p-30)z=p-30;n.unbind("click");b.css({top:z,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:z-o.top,docX:u,docY:z});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,z=!!f.querySelector,p=!!document.evaluate,L=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ha=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ha.replaceItem(sa,0);return true}catch(ca){}return false}(),T=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","path");sa.setAttribute("d","M0,0 10,10");var ha=sa.pathSegList;sa=sa.createSVGPathSegLinetoAbs(5,5);try{ha.insertItemBefore(sa, 0);return true}catch(ca){}return false}(),N=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg"),ha=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);ha.setAttribute("x",5);sa.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(sa);return ha===0}(),J=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg", "svg");document.documentElement.appendChild(sa);var ha=document.createElementNS("http://www.w3.org/2000/svg","path");ha.setAttribute("d","M0,0 C0,0 10,10 10,0");sa.appendChild(ha);ha=ha.getBBox();document.documentElement.removeChild(sa);return ha.height>4&&ha.height<5}(),da=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","svg");document.documentElement.appendChild(sa);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);sa.appendChild(ea);ha=ea.getBBox();document.documentElement.removeChild(sa);return ha.width==15}(),V=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("x",0.1);(sa=sa.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 sa}(),O=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect");sa.setAttribute("style","vector-effect:non-scaling-stroke");return sa.style.vectorEffect==="non-scaling-stroke"}(),fa=function(){var sa=document.createElementNS("http://www.w3.org/2000/svg","rect").transform.baseVal,ha=f.createSVGTransform();sa.appendItem(ha);return sa.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 z};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 N};svgedit.browser.supportsEditableText=function(){return c};svgedit.browser.supportsGoodDecimals=function(){return V};svgedit.browser.supportsNonScalingStroke=function(){return O};svgedit.browser.supportsNativeTransformLists=function(){return fa}}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(z){}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 z=false;if(l.length){l.each(function(){var p=this.getBBox();if(!p.width||!p.height)z=true});if(z){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,z,p,L,T=0,N=0;do{e=b.charCodeAt(T++);l=b.charCodeAt(T++);u=b.charCodeAt(T++);z=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[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(z);d[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e);d[N++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(p);d[N++]="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="",z,p="",L=0;b=b.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++));p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(b.charAt(L++)); e=e<<2|l>>4;l=(l&15)<<4|z>>2;u=(z&3)<<6|p;d+=String.fromCharCode(e);if(z!=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),z=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])){z.indexOf("se:")==0&&e.push([z,u.nodeValue]);m.removeAttributeNS(L,p)}if(svgedit.browser.isGecko())switch(z){case "transform":case "gradientTransform":case "patternTransform":p=u.nodeValue.replace(/(\d)-/g,"$1 -");m.setAttribute(z,p)}if(z=="style"){u=u.nodeValue.split(";");for(z=u.length;z--;){p=u[z].split(":");b.indexOf(p[0])>=0&&m.setAttribute(p[0], p[1])}m.removeAttribute("style")}}$.each(e,function(T,N){m.setAttributeNS("http://svg-edit.googlecode.com",N[0],N[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,N){var J=m.getAttribute(N);if(J)if((J=svgedit.utilities.getUrlFromAttr(J))&&J[0]!=="#"){m.setAttribute(N,"");m.removeAttribute(N)}});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 z=svgedit.utilities.getBBox(b);if(u==="g"&&!$.data(b,"gsvg"))if(u=a.getStrokedBBox(b.childNodes))z=u;u=z.x;var p=z.y,L=z.width;z=z.height;l*=e;e=svgedit.math.transformBox(u*e,p*e,L*e,z*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;z=p+T/2;if(b=svgedit.utilities.getRotationAngle(b)){u=a.svgRoot().createSVGTransform(); u.setRotate(-b,d,z);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 N=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;N=p(N,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=N-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,z].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:"transparent",r:8,stroke:"transparent","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(z.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){z.next=d[u+1];z.next.prev=z;z.mate=d[u];z.addGrip();if(this.first_seg==null)this.first_seg=z}else if(p){if(z.type!== 1){z.addGrip();if(p&&p.type!==2){z.next=p;z.next.prev=z}}}else if(z.type!==1){p=d[u];p.next=d[u+1];p.next.prev=p;p.addGrip();z.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 SVG-edit - http://svg-edit.googlecode.com/ ");l.appendChild(g)})();var u="svg_";b.setIdPrefix=function(g){u= g};b.current_drawing_=new svgedit.draw.Drawing(l,u);var z=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 N=T.shape,J=Array(1),da=this.addSvgElementFromJson=function(g){var h=svgedit.utilities.getElem(g.attr.id),k=z().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:N.fill,stroke:N.stroke,"stroke-width":N.stroke_width,"stroke-dasharray":N.stroke_dasharray,"stroke-linejoin":N.stroke_linejoin,"stroke-linecap":N.stroke_linecap, "stroke-opacity":N.stroke_opacity,"fill-opacity":N.fill_opacity,opacity:N.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,fa=b.matrixMultiply=svgedit.math.matrixMultiply,sa=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 Za.round_digits}});var qa=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 ra=b.getRotationAngle=svgedit.utilities.getRotationAngle,la=b.getElem=svgedit.utilities.getElem,ma=b.assignAttributes=svgedit.utilities.assignAttributes,Z=this.cleanupElement=svgedit.utilities.cleanupElement,za=svgedit.sanitize.getNSMap(),Ka=b.sanitizeSvg=svgedit.sanitize.sanitizeSvg, Qa=svgedit.history.MoveElementCommand,Ma=svgedit.history.InsertElementCommand,Sa=svgedit.history.RemoveElementCommand,Ya=svgedit.history.ChangeElementCommand,Na=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();I("changed",v);v=h.type();k=g==k.AFTER_APPLY;if(v== Qa.type()){k=k?h.newParent:h.oldParent;k==l&&b.identifyLayers()}else if(v==Ma.type()||v==Sa.type()){h.parent==l&&b.identifyLayers();if(v==Ma.type())k&&ab(h.elem);else k||ab(h.elem);h.elem.tagName==="use"&&Yb(h.elem)}else if(v==Ya.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 t=v.nextSibling;k.removeChild(v);k.insertBefore(v,t)}}}}}});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 Pa=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,Gb={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"},Pb=["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"],nb=$.data, ab=function(g){var h=$(g).attr(Pb),k;for(k in h){var v=h[k];if(v&&v.indexOf("url(")===0){v=pa(v).substr(1);if(!la(v)){Ab().appendChild(Db[v]);delete Db[v]}}}g=g.getElementsByTagName("*");if(g.length){h=0;for(k=g.length;h=0)C=D=b.convertToPath(F,true);else if(F.tagName=="rect"){var G=F.getAttribute("rx"),H=F.getAttribute("ry");if(G||H)C=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);C=svgedit.utilities.bboxToObj(Q.getBBox());W.removeChild(Q)}}return C}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,t=k.y+k.height,E=k.x,w=k.y,s=function(F){var C=F.getAttribute("stroke-width"),D=0;if(F.getAttribute("stroke")!="none"&&!isNaN(C))D+=C/2;return D},A=[];$.each(g,function(F,C){var D=h(C);if(D){var G=s(C);E=Math.min(E,D.x-G);w=Math.min(w,D.y-G);A.push(D)}});k.x=E;k.y=w;$.each(g,function(F,C){var D=A[F];if(D&&C.nodeType==1){var G=s(C);v=Math.max(v,D.x+D.width+G);t=Math.max(t,D.y+D.height+G)}});k.width=v-E;k.height=t-w;return k};var Ib=this.getVisibleElements=function(g){g|| (g=$(l).children());var h=[];$(g).children().each(function(k,v){try{v.getBBox()&&h.push(v)}catch(t){}});return h.reverse()},Qb=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(t){}});return h.reverse()},na=this.groupSvgElem=function(g){var h=document.createElementNS(c,"g");g.parentNode.replaceChild(h,g);$(h).append(g).data("gsvg",g)[0].id=M()},aa=function(g){var h=document.createElementNS(g.namespaceURI, g.nodeName);h.removeAttribute("id");$.each(g.attributes,function(v,t){t.localName!="-moz-math-font-style"&&h.setAttributeNS(t.namespaceURI,t.nodeName,t.nodeValue)});if(svgedit.browser.isWebkit()&&g.nodeName=="path"){var k=Ua.convertPath(g);h.setAttribute("d",k)}$.each(g.childNodes,function(v,t){switch(t.nodeType){case 1:h.appendChild(aa(t));break;case 3:h.textContent=t.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=M();console.log(h);return h},ta,M,I;(function(g){var h={};ta=g.getId=function(){return z().getId()};M=g.getNextId=function(){return z().getNextId()};I=g.call=function(k,v){if(h[k])return h[k](this,v)};g.bind=function(k,v){var t=h[k];h[k]=v;return t}})(b);this.prepareSvg=function(g){this.sanitizeSvg(g.documentElement);g=g.getElementsByTagNameNS(c,"path");for(var h=0,k=g.length;h0&&t.getItem(0).type==4&&t.removeItem(0);if(g!= 0){E=O(E,w,ha(t).matrix);w=e.createSVGTransform();w.setRotate(g,E.x,E.y);t.numberOfItems?t.insertItemBefore(w,0):t.appendItem(w)}else t.numberOfItems==0&&k.removeAttribute("transform");if(!h){t=k.getAttribute("transform");k.setAttribute("transform",v);qb("transform",t,J);I("changed",J)}la("pathpointgrip_container");k=Pa.requestSelector(J[0]);k.resize();k.updateGripCursors(g)};var Wa=this.recalculateAllSelectedDimensions=function(){for(var g=new Na(ob=="none"?"position":"size"),h=J.length;h--;){var k= rb(J[h]);k&&g.addSubCommand(k)}if(!g.isEmpty()){Ia(g);I("changed",J)}},fb=[0,"z","M","m","L","l","C","c","Q","q","A","a","H","h","V","v","S","s","T","t"],tb=function(g){console.log([g.a,g.b,g.c,g.d,g.e,g.f])},wb=this.remapElement=function(g,h,k){var v=m.gridSnapping&&g.parentNode.parentNode.localName==="svg",t=function(){if(v)for(var D in h)h[D]=Ga(h[D]);ma(g,h,1E3,true)};box=svgedit.utilities.getBBox(g);for(var E=0;E<2;E++){var w=E===0?"fill":"stroke",s=g.getAttribute(w);if(s&&s.indexOf("url(")=== 0)if(k.a<0||k.d<0){s=Y(s).cloneNode(true);if(k.a<0){var A=s.getAttribute("x1"),F=s.getAttribute("x2");s.setAttribute("x1",-(A-1));s.setAttribute("x2",-(F-1))}if(k.d<0){A=s.getAttribute("y1");F=s.getAttribute("y2");s.setAttribute("y1",-(A-1));s.setAttribute("y2",-(F-1))}s.id=M();Ab().appendChild(s);g.setAttribute(w,"url(#"+s.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)){w=ha(g).matrix;w=fa(w.inverse(),k,w);h.x=parseFloat(h.x)+w.e;h.y=parseFloat(h.y)+ w.f}else{w=V(g);s=e.createSVGTransform();s.setMatrix(fa(ha(w).matrix,k));w.clear();w.appendItem(s)}switch(E){case "foreignObject":case "rect":case "image":if(E==="image"&&(k.a<0||k.d<0)){w=V(g);s=e.createSVGTransform();s.setMatrix(fa(ha(w).matrix,k));w.clear();w.appendItem(s)}else{w=O(h.x,h.y,k);h.width=k.a*h.width;h.height=k.d*h.height;h.x=w.x+Math.min(0,h.width);h.y=w.y+Math.min(0,h.height);h.width=Math.abs(h.width);h.height=Math.abs(h.height)}t();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);t();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);t();break;case "line":w=O(h.x1,h.y1,k);A=O(h.x2,h.y2,k);h.x1=w.x;h.y1=w.y;h.x2=A.x;h.y2=A.y;case "text":k=g.querySelectorAll("tspan");for(E=k.length;E--;){w=qa("x",g.getAttribute("x"));s=qa("x",k[E].getAttribute("x"));A=qa("y", g.getAttribute("y"));F=qa("y",k[E].getAttribute("y"));var C={};if(!isNaN(w)&&!isNaN(s)&&w!=0&&s!=0&&h.x)C.x=h.x-(w-s);if(!isNaN(A)&&!isNaN(F)&&A!=0&&F!=0&&h.y)C.y=h.y-(A-F);if(C.x||C.y)ma(k[E],C,1E3,true)}t();break;case "use":t();break;case "g":(t=$(g).data("gsvg"))&&ma(t,h,1E3,true);break;case "polyline":case "polygon":t=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&&ra(g))return null}if(!h||h.numberOfItems==0){g.removeAttribute("transform");return null}if(h){k=h.numberOfItems;for(var t=[];k--;){v=h.getItem(k);if(v.type===1)t.push([v.matrix,k]);else if(t.length)t=[]}if(t.length===2){k=e.createSVGTransformFromMatrix(fa(t[1][0],t[0][0]));h.removeItem(t[0][1]);h.removeItem(t[1][1]);h.insertItemBefore(k,t[1][1])}k=h.numberOfItems;if(k>=2&&h.getItem(k-2).type===1&&h.getItem(k-1).type===2){t=e.createSVGTransform(); v=fa(h.getItem(k-2).matrix,h.getItem(k-1).matrix);t.setMatrix(v);h.removeItem(k-2);h.removeItem(k-2);h.appendItem(t)}}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 Na("Transform");var w={},s=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":s={};s.points=g.getAttribute("points");t=g.points;var A=t.numberOfItems;w.points=Array(A);for(var F=0;F1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;var Q=h.getItem(H-3).matrix,W=h.getItem(H-2).matrix,ua=h.getItem(H-1).matrix;A=g.childNodes;for(C=A.length;C--;){var wa=A.item(C);v=E=0;if(wa.nodeType==1){var ga=V(wa);if(ga){v=ha(ga).matrix;E=ra(wa);var ka=$a,oa=[];$a=wa.getAttribute("transform");if(E||sa(ga)){var ya=e.createSVGTransform();ya.setMatrix(fa(Q,W,ua,v));ga.clear(); ga.appendItem(ya);oa.push(ya)}else{E=fa(v.inverse(),ua,v);ya=e.createSVGMatrix();ya.e=-E.e;ya.f=-E.f;v=fa(ya.inverse(),v.inverse(),Q,W,ua,v,E.inverse());var jb=e.createSVGTransform(),ub=e.createSVGTransform(),Mb=e.createSVGTransform();jb.setTranslate(E.e,E.f);ub.setScale(v.a,v.d);Mb.setTranslate(ya.e,ya.f);ga.appendItem(Mb);ga.appendItem(ub);ga.appendItem(jb);oa.push(Mb);oa.push(ub);oa.push(jb)}k.addSubCommand(rb(wa));$a=ka}}}h.removeItem(H-1);h.removeItem(H-2);h.removeItem(H-3)}else if(H>=3&&h.getItem(H- 1).type==1){F=3;v=ha(h).matrix;ya=e.createSVGTransform();ya.setMatrix(v);h.clear();h.appendItem(ya)}else if((H==1||H>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=fa(v,E);E=v.e;v=v.f;if(E!=0||v!=0){A=g.childNodes;C=A.length;for(H=[];C--;){wa=A.item(C);if(wa.nodeType==1){if(wa.getAttribute("clip-path")){ka=wa.getAttribute("clip-path");if(H.indexOf(ka)===-1){Hb(ka,E,v);H.push(ka)}}ka=$a;$a=wa.getAttribute("transform");if(ga=V(wa)){Q=e.createSVGTransform(); Q.setTranslate(E,v);ga.numberOfItems?ga.insertItemBefore(Q,0):ga.appendItem(Q);k.addSubCommand(rb(wa));ga=g.getElementsByTagNameNS(c,"use");wa="#"+wa.id;for(Q=ga.length;Q--;){W=ga.item(Q);if(wa==ba(W)){ua=e.createSVGTransform();ua.setTranslate(-E,-v);V(W).insertItemBefore(ua,0);k.addSubCommand(rb(W))}}$a=ka}}}H=[];$a=ka}}else if(H==1&&h.getItem(0).type==1&&!t){F=1;v=h.getItem(0).matrix;A=g.childNodes;for(C=A.length;C--;){wa=A.item(C);if(wa.nodeType==1){ka=$a;$a=wa.getAttribute("transform");if(ga= V(wa)){E=fa(v,ha(ga).matrix);H=e.createSVGTransform();H.setMatrix(E);ga.clear();ga.appendItem(H,0);k.addSubCommand(rb(wa));$a=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(t){D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}h.numberOfItems==0&&g.removeAttribute("transform");return null}if(F==2){if(t){G={x:D.x+P.e,y:D.y+ P.f};D=e.createSVGTransform();D.setRotate(t,G.x,G.y);h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else if(F==3){v=ha(h).matrix;P=e.createSVGTransform();P.setRotate(t,D.x,D.y);P=P.matrix;D=e.createSVGTransform();D.setRotate(t,G.x,G.y);G=D.matrix.inverse();ka=v.inverse();G=fa(ka,G,P,v);E=G.e;v=G.f;if(E!=0||v!=0){A=g.childNodes;for(C=A.length;C--;){wa=A.item(C);if(wa.nodeType==1){ka=$a;$a=wa.getAttribute("transform");ga=V(wa);Q=e.createSVGTransform();Q.setTranslate(E,v);ga.numberOfItems? ga.insertItemBefore(Q,0):ga.appendItem(Q);k.addSubCommand(rb(wa));$a=ka}}}if(t)h.numberOfItems?h.insertItemBefore(D,0):h.appendItem(D)}}else{t=svgedit.utilities.getBBox(g);if(!t&&g.tagName!="path")return null;v=e.createSVGMatrix();if(E=ra(g)){D={x:t.x+t.width/2,y:t.y+t.height/2};G=O(t.x+t.width/2,t.y+t.height/2,ha(h).matrix);F=E*Math.PI/180;A=Math.abs(F)>1.0E-10?Math.sin(F)/(1-Math.cos(F)):2/F;for(F=0;F=3&&h.getItem(H-2).type==3&&h.getItem(H-3).type==2&&h.getItem(H-1).type==2){F=3;v=ha(h,H-3,H-1).matrix;h.removeItem(H-1);h.removeItem(H- 2);h.removeItem(H-3)}else if(H==4&&h.getItem(H-1).type==1){F=3;v=ha(h).matrix;ya=e.createSVGTransform();ya.setMatrix(v);h.clear();h.appendItem(ya);v=e.createSVGMatrix()}else if((H==1||H>1&&h.getItem(1).type!=3)&&h.getItem(0).type==2){F=2;P=h.getItem(0).matrix;ka=ha(h,1).matrix;t=ka.inverse();v=fa(t,P,ka);h.removeItem(0)}else if(H==1&&h.getItem(0).type==1&&!E){v=ha(h).matrix;switch(g.tagName){case "line":w=$(g).attr(["x1","y1","x2","y2"]);case "polyline":case "polygon":w.points=g.getAttribute("points"); if(w.points){t=g.points;A=t.numberOfItems;w.points=Array(A);for(F=0;F1&&t.showGrips(false)}}}I("selected",J);h||J.length==1?Pa.requestSelector(J[0]).showGrips(true):Pa.requestSelector(J[0]).showGrips(false);for(J.sort(function(E,w){if(E&&w&&E.compareDocumentPosition)return 3- (w.compareDocumentPosition(E)&6);else if(E==null)return 1});J[0]==null;)J.shift(0)}},vb=this.selectOnly=function(g,h){bb(true);Jb(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=z().getCurrentLayer();if([e,a,l,h].indexOf(g)>=0)return e;if($(g).closest("#selectorParentGroup").length)return Pa.selectorParentGroup;for(;g.parentNode!==(L||h);)g=g.parentNode;return g};(function(){var g=null,h=null,k=null,v= null,t=null,E={},w={minx:null,miny:null,maxx:null,maxy:null};$(a).mousedown(function(s){if(!(b.spaceKey||s.button===1)){var A=s.button===2;s.altKey&&svgCanvas.cloneSelectedElements(0,0);Nb=l.getScreenCTM().inverse();var F=O(s.pageX,s.pageY,Nb),C=F.x*p,D=F.y*p;s.preventDefault();if(A){Ja="select";zb=F}F=C/p;D=D/p;var G=$b(s);if(G.tagName==="a"&&G.childNodes.length===1)G=G.firstChild;C=v=h=F;var H=t=k=D;if(m.gridSnapping){F=Ga(F);D=Ga(D);h=Ga(h);k=Ga(k)}if(G==Pa.selectorParentGroup&&J[0]!=null){G=s.target; var P=nb(G,"type");if(P=="rotate"){Ja="rotate";current_rotate_mode=nb(G,"dir")}else if(P=="resize"){Ja="resize";ob=nb(G,"dir")}G=J[0]}$a=G.getAttribute("transform");P=V(G);switch(Ja){case "select":Ra=true;ob="none";if(A)Ra=false;if(G!=e){if(J.indexOf(G)==-1){s.shiftKey||bb(true);Jb([G]);ib=G;Ua.clear()}if(!A)for(A=0;A0&&b.removeFromSelection(D);G.length>0&&Jb(G);break;case "resize":D=V(A);G=(Q=sa(D))?E:svgedit.utilities.getBBox(A);H=G.x;W=G.y;var ua=G.width,wa=G.height;G=x-h;P=y-k;if(m.gridSnapping){G=Ga(G);P=Ga(P);wa=Ga(wa);ua=Ga(ua)}var ga=ra(A);if(ga){var ka=Math.sqrt(G*G+P*P); P=Math.atan2(P,G)-ga*Math.PI/180;G=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)G=0;var oa=ka=0,ya=wa?(wa+P)/wa:1,jb=ua?(ua+G)/ua:1;if(ob.indexOf("n")>=0){ya=wa?(wa-P)/wa:1;oa=wa}if(ob.indexOf("w")>=0){jb=ua?(ua-G)/ua:1;ka=ua}G=e.createSVGTransform();P=e.createSVGTransform();ua=e.createSVGTransform();if(m.gridSnapping){H=Ga(H);ka=Ga(ka);W=Ga(W);oa=Ga(oa)}G.setTranslate(-(H+ka),-(W+oa));if(s.shiftKey)if(jb==1)jb=ya;else ya= jb;P.setScale(jb,ya);ua.setTranslate(H+ka,W+oa);if(Q){Q=ga?1:0;D.replaceItem(G,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(G,Q-1)}Pa.requestSelector(A).resize();I("transition",J);break;case "zoom":G*=p;H*=p;ma(Da,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100);break;case "text":ma(D,{x:x,y:y},1E3);break;case "line":G=null;window.opera||e.suspendRedraw(1E3);if(m.gridSnapping){x= Ga(x);y=Ga(y)}H=x;Q=y;if(s.shiftKey){Q=ca(h,k,H,Q);H=Q.x;Q=Q.y}D.setAttributeNS(null,"x2",H);D.setAttributeNS(null,"y2",Q);window.opera||e.unsuspendRedraw(G);break;case "foreignObject":case "square":case "rect":case "image":G=Math.abs(x-h);Q=Math.abs(y-k);if(Ja=="square"||s.shiftKey){G=Q=Math.max(G,Q);H=hk?k+W:k-W}if(s.altKey){Q=h;H=k;W=Math.abs(x-Q);P=s.shiftKey?W:Math.abs(y-H)}D.setAttributeNS(null,"rx",W);D.setAttributeNS(null,"ry",P); D.setAttributeNS(null,"cx",Q);D.setAttributeNS(null,"cy",H);window.opera||e.unsuspendRedraw(G);break;case "fhellipse":case "fhrect":w.minx=Math.min(G,w.minx);w.maxx=Math.max(G,w.maxx);w.miny=Math.min(H,w.miny);w.maxy=Math.max(H,w.maxy);case "fhpath":g+=+G+","+H+" ";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(s.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(Da&&Da.getAttribute("display")!=="none"){G*=p;H*=p;ma(Da,{x:Math.min(v*p,G),y:Math.min(t*p,H),width:Math.abs(G-v*p),height:Math.abs(H-t*p)},100)}Ua.mouseMove(s,x,y);break;case "textedit":x*=p;y*=p;sb.mouseMove(C,F);break;case "rotate":G=svgedit.utilities.getBBox(A);Q=G.x+G.width/2;H=G.y+G.height/2;D=ea(A);D=O(Q,H,D);Q=D.x;H=D.y;D=G.x;W=G.y;if(current_rotate_mode=="nw")D=G.x+G.width;if(current_rotate_mode=="se")W=G.y+G.height;if(current_rotate_mode=="sw"){D=G.x+G.width; W=G.y+G.height}compensation_angle=(Math.atan2(H-W,Q-D)*(180/Math.PI)-90)%360;ga=(Math.atan2(H-y,Q-x)*(180/Math.PI)-90)%360;ga+=compensation_angle;if(m.gridSnapping)ga=Ga(ga);if(s.shiftKey)ga=Math.round(ga/45)*45;b.setRotationAngle(ga<-180?360+ga:ga,true);I("transition",J)}pb("mouseMove",{event:s,mouse_x:C,mouse_y:F,selected:A})}}).click(function(s){s.preventDefault();return false}).dblclick(function(s){var A=s.target.parentNode;if(A!==L){var F=$b(s),C=F.tagName;if(C==="text"&&Ja!=="textedit"){s=O(s.pageX, s.pageY,Nb);sb.select(F,s.x,s.y)}if((C==="g"||C==="a")&&ra(F)){ec(F);F=J[0];bb(true)}L&&ac();A.tagName!=="g"&&A.tagName!=="a"||A===z().getCurrentLayer()||F===Pa.selectorParentGroup||mc(F)}}).mouseup(function(s){if(s.button!==2){var A=ib;ib=null;if(Ra){var F=O(s.pageX,s.pageY,Nb),C=F.x*p;F=F.y*p;var D=C/p,G=F/p,H=la(ta()),P=false;Ra=false;switch(Ja){case "resize":case "multiselect":if(Da!=null){Da.setAttribute("display","none");xb=[]}Ja="select";case "select":if(J[0]!=null){if(J[1]==null){C=J[0];switch(C.tagName){case "g":case "use":case "image":case "foreignObject":break; default:hb.fill=C.getAttribute("fill");hb.fill_opacity=C.getAttribute("fill-opacity");hb.stroke=C.getAttribute("stroke");hb.stroke_opacity=C.getAttribute("stroke-opacity");hb.stroke_width=C.getAttribute("stroke-width");hb.stroke_dasharray=C.getAttribute("stroke-dasharray");hb.stroke_linejoin=C.getAttribute("stroke-linejoin");hb.stroke_linecap=C.getAttribute("stroke-linecap")}if(C.tagName=="text"){eb.font_size=C.getAttribute("font-size");eb.font_family=C.getAttribute("font-family")}Pa.requestSelector(C).showGrips(true)}Wa(); if(D!=v||G!=t){s=J.length;for(C=0;C=0?A.indexOf(",",D+1)>=0:A.indexOf(" ",A.indexOf(" ")+1)>=0)H=Ua.smoothPolylineIntoPath(H);break;case "line":A=$(H).attr(["x1","x2","y1","y2"]);P=A.x1!=A.x2||A.y1!=A.y2;break;case "foreignObject":case "square":case "rect":case "image":A=$(H).attr(["width","height"]);P=A.width!=0||A.height!=0||Ja==="image";break;case "circle":P=H.getAttribute("r")!=0;break;case "ellipse":A=$(H).attr(["rx", "ry"]);P=A.rx!=null||A.ry!=null;break;case "fhellipse":if(w.maxx-w.minx>0&&w.maxy-w.miny>0){H=da({element:"ellipse",curStyles:true,attr:{cx:(w.minx+w.maxx)/2,cy:(w.miny+w.maxy)/2,rx:(w.maxx-w.minx)/2,ry:(w.maxy-w.miny)/2,id:ta()}});I("changed",[H]);P=true}break;case "fhrect":if(w.maxx-w.minx>0&&w.maxy-w.miny>0){H=da({element:"rect",curStyles:true,attr:{x:w.minx,y:w.miny,width:w.maxx-w.minx,height:w.maxy-w.miny,id:ta()}});I("changed",[H]);P=true}break;case "text":P=true;vb([H]);sb.start(H);break;case "path":H= null;Ra=true;A=Ua.mouseUp(s,H,C,F);H=A.element;P=A.keep;break;case "pathedit":P=true;H=null;Ua.mouseUp(s);break;case "textedit":P=false;H=null;sb.mouseUp(s,C,F);break;case "rotate":P=true;H=null;Ja="select";A=b.undoMgr.finishUndoableChange();A.isEmpty()||Ia(A);Wa();I("changed",J)}C=pb("mouseUp",{event:s,mouse_x:C,mouse_y:F},true);$.each(C,function(ua,wa){if(wa){P=wa.keep||P;H=wa.element;Ra=wa.started||Ra}});if(!P&&H!=null){z().releaseId(ta());H.parentNode.removeChild(H);H=null;for(C=s.target;C.parentNode.parentNode.tagName== "g";)C=C.parentNode;if((Ja!="path"||!drawn_path)&&C.parentNode.id!="selectorParentGroup"&&C.id!="svgcanvas"&&C.id!="svgroot"){b.setMode("select");vb([C],true)}}else if(H!=null){b.addedNew=true;s=0.2;var Q;if(false.beginElement&&H.getAttribute("opacity")!=N.opacity){Q=$(false).clone().attr({to:N.opacity,dur:s}).appendTo(H);try{Q[0].beginElement()}catch(W){}}else s=0;setTimeout(function(){Q&&Q.remove();H.setAttribute("opacity",N.opacity);H.setAttribute("style","pointer-events:inherit");Z(H);if(Ja=== "path")Ua.toEditMode(H);else m.selectNew&&vb([H],true);Ia(new Ma(H));I("changed",[H])},s*1E3)}$a=null}}});$(a).bind("mousewheel DOMMouseScroll",function(s){if(s.shiftKey){s.preventDefault();Nb=l.getScreenCTM().inverse();var A=O(s.pageX,s.pageY,Nb);A={x:A.x,y:A.y,width:0,height:0};if(s.wheelDelta)if(s.wheelDelta>=120)A.factor=2;else{if(s.wheelDelta<=-120)A.factor=0.5}else if(s.detail)if(s.detail>0)A.factor=0.5;else if(s.detail<0)A.factor=2;A.factor&&I("zoomed",A)}})})();var Zb=function(g){$(g).click(function(h){h.preventDefault()})}, sb=b.textActions=function(){function g(ga){var ka=F.value==="";$(F).focus();if(!arguments.length)if(ka)ga=0;else{if(F.selectionEnd!==F.selectionStart)return;ga=F.selectionEnd}var oa;oa=H[ga];ka||F.setSelectionRange(ga,ga);C=la("text_cursor");if(!C){C=document.createElementNS(c,"line");ma(C,{id:"text_cursor",stroke:"#333","stroke-width":1});C=la("selectorParentGroup").appendChild(C)}G||(G=setInterval(function(){var ya=C.getAttribute("display")==="none";C.setAttribute("display",ya?"inline":"none")}, 600));ka=E(oa.x,P.y);oa=E(oa.x,P.y+P.height);ma(C,{x1:ka.x,y1:ka.y,x2:oa.x,y2:oa.y,visibility:"visible",display:"inline"});D&&D.setAttribute("d","")}function h(ga,ka,oa){if(ga===ka)g(ka);else{oa||F.setSelectionRange(ga,ka);D=la("text_selectblock");if(!D){D=document.createElementNS(c,"path");ma(D,{id:"text_selectblock",fill:"green",opacity:0.5,style:"pointer-events:none"});la("selectorParentGroup").appendChild(D)}ga=H[ga];var ya=H[ka];C.setAttribute("visibility","hidden");ka=E(ga.x,P.y);oa=E(ga.x+ (ya.x-ga.x),P.y);var jb=E(ga.x,P.y+P.height);ga=E(ga.x+(ya.x-ga.x),P.y+P.height);ma(D,{d:"M"+ka.x+","+ka.y+" L"+oa.x+","+oa.y+" "+ga.x+","+ga.y+" "+jb.x+","+jb.y+"z",display:"inline"})}}function k(ga,ka){var oa=e.createSVGPoint();oa.x=ga;oa.y=ka;if(H.length==1)return 0;oa=A.getCharNumAtPosition(oa);if(oa<0){oa=H.length-2;if(ga<=H[0].x)oa=0}else if(oa>=H.length-2)oa=H.length-2;var ya=H[oa];ga>ya.x+ya.width/2&&oa++;return oa}function v(ga,ka,oa){var ya=F.selectionStart;ga=k(ga,ka);h(Math.min(ya,ga), Math.max(ya,ga),!oa)}function t(ga,ka){var oa={x:ga,y:ka};oa.x/=p;oa.y/=p;if(Q){var ya=O(oa.x,oa.y,Q.inverse());oa.x=ya.x;oa.y=ya.y}return oa}function E(ga,ka){var oa={x:ga,y:ka};if(Q){var ya=O(oa.x,oa.y,Q);oa.x=ya.x;oa.y=ya.y}oa.x*=p;oa.y*=p;return oa}function w(ga){h(0,A.textContent.length);$(this).unbind(ga)}function s(ga){if(wa&&A){var ka=O(ga.pageX,ga.pageY,Nb);ka=t(ka.x*p,ka.y*p);ka=k(ka.x,ka.y);var oa=A.textContent,ya=oa.substr(0,ka).replace(/[a-z0-9]+$/i,"").length;oa=oa.substr(ka).match(/^[a-z0-9]+/i); h(ya,(oa?oa[0].length:0)+ka);$(ga.target).click(w);setTimeout(function(){$(ga.target).unbind("click",w)},300)}}var A,F,C,D,G,H=[],P,Q,W,ua,wa;return{select:function(ga,ka,oa){A=ga;sb.toEditMode(ka,oa)},start:function(ga){A=ga;sb.toEditMode()},mouseDown:function(ga,ka,oa,ya){ga=t(oa,ya);F.focus();g(k(ga.x,ga.y));W=oa;ua=ya},mouseMove:function(ga,ka){var oa=t(ga,ka);v(oa.x,oa.y)},mouseUp:function(ga,ka,oa){var ya=t(ka,oa);v(ya.x,ya.y,true);ga.target!==A&&kaW-2&&oaua-2&&sb.toSelectMode(true)}, setCursor:g,toEditMode:function(ga,ka){wa=false;Ja="textedit";Pa.requestSelector(A).showGrips(false);Pa.requestSelector(A);sb.init();$(A).css("cursor","text");if(arguments.length){var oa=t(ga,ka);g(k(oa.x,oa.y))}else g();setTimeout(function(){wa=true},300)},toSelectMode:function(ga){Ja="select";clearInterval(G);G=null;D&&$(D).attr("display","none");C&&$(C).attr("visibility","hidden");$(A).css("cursor","move");if(ga){bb();$(A).css("cursor","move");I("selected",[A]);Jb([A],true)}A&&!A.textContent.length&& b.deleteSelectedElements();$(F).blur();A=false},setInputElem:function(ga){F=ga},clear:function(){Ja=="textedit"&&sb.toSelectMode()},init:function(){if(A){if(!A.parentNode){A=J[0];Pa.requestSelector(A).showGrips(false)}var ga=A.textContent.length,ka=A.getAttribute("transform");P=svgedit.utilities.getBBox(A);Q=ka?ea(A):null;H=Array(ga);F.focus();$(A).unbind("dblclick",s).dblclick(s);if(!ga)var oa={x:P.x+P.width/2,width:0};for(ka=0;ka=0&&this.selected_pts.push(A)}this.selected_pts.sort();s=this.selected_pts.length;for(w=Array(s);s--;){F=this.segs[this.selected_pts[s]];F.select(true);w[s]=F.ptgrip}Ua.canDeleteNodes=true;Ua.closed_subpath=this.subpathIsClosed(this.selected_pts[0]);I("selected",w)};var t=h=null,E=false;return{mouseDown:function(w,s,A,F){if(Ja==="path"){mouse_x=A;mouse_y=F;F=mouse_x/ p;s=mouse_y/p;A=la("path_stretch_line");k=[F,s];if(m.gridSnapping){F=Ga(F);s=Ga(s);mouse_x=Ga(mouse_x);mouse_y=Ga(mouse_y)}if(!A){A=document.createElementNS(c,"path");ma(A,{id:"path_stretch_line",stroke:"#22C","stroke-width":"0.5",fill:"none"});A=la("selectorParentGroup").appendChild(A)}A.setAttribute("display","inline");var C=null;if(t){C=t.pathSegList;for(var D=C.numberOfItems,G=6/p,H=false;D;){D--;var P=C.getItem(D),Q=P.x;P=P.y;if(F>=Q-G&&F<=Q+G&&s>=P-G&&s<=P+G){H=true;break}}G=ta();svgedit.path.removePath_(G); G=la(G);Q=C.numberOfItems;if(H){if(D<=1&&Q>=2){F=C.getItem(0).x;s=C.getItem(0).y;w=A.pathSegList.getItem(1);w=w.pathSegType===4?t.createSVGPathSegLinetoAbs(F,s):t.createSVGPathSegCurvetoCubicAbs(F,s,w.x1/p,w.y1/p,F,s);F=t.createSVGPathSegClosePath();C.appendItem(w);C.appendItem(F)}else if(Q<3)return C=false;$(A).remove();element=G;t=null;Ra=false;if(g){svgedit.path.path.matrix&&wb(G,{},svgedit.path.path.matrix.inverse());A=G.getAttribute("d");w=$(svgedit.path.path.elem).attr("d");$(svgedit.path.path.elem).attr("d", w+A);$(G).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(w))){console.log("Clicked outside canvas");return false}C=t.pathSegList.numberOfItems;D=t.pathSegList.getItem(C-1);G=D.x;D=D.y;if(w.shiftKey){w=ca(G,D,F,s);F=w.x;s=w.y}w=A.pathSegList.getItem(1);w=w.pathSegType===4?t.createSVGPathSegLinetoAbs(Eb(F),Eb(s)):t.createSVGPathSegCurvetoCubicAbs(Eb(F), Eb(s),w.x1/p,w.y1/p,w.x2/p,w.y2/p);t.pathSegList.appendItem(w);F*=p;s*=p;A.setAttribute("d",["M",F,s,F,s].join(" "));A=C;if(g)A+=svgedit.path.path.segs.length;svgedit.path.addPointGrip(A,F,s)}}else{d_attr="M"+F+","+s+" ";t=da({element:"path",curStyles:true,attr:{d:d_attr,id:M(),opacity:N.opacity/2}});A.setAttribute("d",["M",mouse_x,mouse_y,mouse_x,mouse_y].join(" "));A=g?svgedit.path.path.segs.length:0;svgedit.path.addPointGrip(A,mouse_x,mouse_y)}}else if(svgedit.path.path){svgedit.path.path.storeD(); G=w.target.id;if(G.substr(0,14)=="pathpointgrip_"){s=svgedit.path.path.cur_pt=parseInt(G.substr(14));svgedit.path.path.dragging=[A,F];C=svgedit.path.path.segs[s];if(w.shiftKey)C.selected?svgedit.path.path.removePtFromSelection(s):svgedit.path.path.addPtsToSelection(s);else{if(svgedit.path.path.selected_pts.length<=1||!C.selected)svgedit.path.path.clearSelection();svgedit.path.path.addPtsToSelection(s)}}else if(G.indexOf("ctrlpointgrip_")==0){svgedit.path.path.dragging=[A,F];w=G.split("_")[1].split("c"); s=w[0]-0;svgedit.path.path.selectPt(s,w[1]-0)}if(!svgedit.path.path.dragging){if(Da==null)Da=Pa.getRubberBandBox();ma(Da,{x:A*p,y:F*p,width:0,height:0,display:"inline"},100)}}},mouseMove:function(w,s,A){E=true;if(Ja==="path"){if(t){var F=t.pathSegList;w=F.numberOfItems-1;if(k){var C=svgedit.path.addCtrlGrip("1c1"),D=svgedit.path.addCtrlGrip("0c2");D.getAttribute("cx");D.getAttribute("cy");C.setAttribute("cx",s);C.setAttribute("cy",A);C.setAttribute("display","inline");C=k[0];var G=k[1];F.getItem(w); var H=C+(C-s/p),P=G+(G-A/p);D.setAttribute("cx",H*p);D.setAttribute("cy",P*p);D.setAttribute("display","inline");D=svgedit.path.getCtrlLine(1);var Q=svgedit.path.getCtrlLine(2);ma(D,{x1:s,y1:A,x2:C*p,y2:G*p,display:"inline"});ma(Q,{x1:H*p,y1:P*p,x2:C*p,y2:G*p,display:"inline"});if(w===0)v=[s,A];else{F=F.getItem(w-1);s=F.x;A=F.y;if(F.pathSegType===6){s+=s-F.x2;A+=A-F.y2}else if(v){s=v[0]/p;A=v[1]/p}svgedit.path.replacePathSeg(6,w,[C,G,s,A,H,P],t)}}else if(C=la("path_stretch_line")){w=F.getItem(w); if(w.pathSegType===6)svgedit.path.replacePathSeg(6,1,[s,A,(w.x+(w.x-w.x2))*p,(w.y+(w.y-w.y2))*p,s,A],C);else v?svgedit.path.replacePathSeg(6,1,[s,A,v[0],v[1],s,A],C):svgedit.path.replacePathSeg(4,1,[s,A],C)}}}else if(svgedit.path.path.dragging){C=svgedit.path.getPointFromGrip({x:svgedit.path.path.dragging[0],y:svgedit.path.path.dragging[1]},svgedit.path.path);G=svgedit.path.getPointFromGrip({x:s,y:A},svgedit.path.path);w=G.x-C.x;C=G.y-C.y;svgedit.path.path.dragging=[s,A];svgedit.path.path.dragctrl? svgedit.path.path.moveCtrl(w,C):svgedit.path.path.movePts(w,C)}else{svgedit.path.path.selected_pts=[];svgedit.path.path.eachSeg(function(){if(this.next||this.prev){var W=Da.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(w,s){if(Ja==="path"){k=null;if(!t){s=la(ta());Ra=false;v=null}return{keep:true,element:s}}if(svgedit.path.path.dragging){var A=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)");!w.shiftKey&&!E&&svgedit.path.path.selectPt(A)}else if(Da&&Da.getAttribute("display")!="none"){Da.setAttribute("display","none");Da.getAttribute("width")<=2&&Da.getAttribute("height")<=2&&Ua.toSelectMode(w.target)}else Ua.toSelectMode(w.target);E=false},toEditMode:function(w){svgedit.path.path=svgedit.path.getPath_(w);Ja="pathedit";bb();svgedit.path.path.show(true).update(); svgedit.path.path.oldbbox=svgedit.utilities.getBBox(svgedit.path.path.elem);g=false},toSelectMode:function(w){var s=w==svgedit.path.path.elem;Ja="select";svgedit.path.path.show(false);h=false;bb();svgedit.path.path.matrix&&svgedit.path.recalcRotatedPath();if(s){I("selected",[w]);Jb([w],true)}},addSubPath:function(w){if(w){Ja="path";g=true}else{Ua.clear(true);Ua.toEditMode(svgedit.path.path.elem)}},select:function(w){if(h===w){Ua.toEditMode(w);Ja="pathedit"}else h=w},reorient:function(){var w=J[0]; if(w)if(ra(w)!=0){var s=new Na("Reorient path"),A={d:w.getAttribute("d"),transform:w.getAttribute("transform")};s.addSubCommand(new Ya(w,A));bb();this.resetOrientation(w);Ia(s);svgedit.path.getPath_(w).show(false).matrix=null;this.clear();Jb([w],true);I("changed",J)}},clear:function(){h=null;if(t){var w=la(ta());$(la("path_stretch_line")).remove();$(w).remove();$(la("pathpointgrip_container")).find("*").attr("display","none");t=v=null;Ra=false}else Ja=="pathedit"&&this.toSelectMode();svgedit.path.path&& svgedit.path.path.init().show(false)},resetOrientation:function(w){if(w==null||w.nodeName!="path")return false;var s=V(w),A=ha(s).matrix;s.clear();w.removeAttribute("transform");s=w.pathSegList;for(var F=s.numberOfItems,C=0;C0){G=F.getItem(C-1).pathSegType;if(G===2){D(C-1,1);A();break}else if(G===1&&F.numberOfItems-1===C){D(C,1);A();break}}}return false};A();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){w=$(svgedit.path.path.elem);w.attr("d",w.attr("d"))}svgedit.path.path.endChanges("Delete path node(s)")}}}, smoothPolylineIntoPath:function(w){var s=w.points,A=s.numberOfItems;if(A>=4){var F=s.getItem(0),C=null;w=[];w.push(["M",F.x,",",F.y," C"].join(""));for(var D=1;D<=A-4;D+=3){var G=s.getItem(D),H=s.getItem(D+1),P=s.getItem(D+2);if(C)if((F=svgedit.path.smoothControlPoints(C,G,F))&&F.length==2){G=w[w.length-1].split(",");G[2]=F[0].x;G[3]=F[0].y;w[w.length-1]=G.join(",");G=F[1]}w.push([G.x,G.y,H.x,H.y,P.x,P.y].join(","));F=P;C=H}for(w.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){ac();vb([L])}var g=[];$(l).find("g:data(gsvg)").each(function(){for(var k=this.attributes,v=k.length,t=0;t=0;A--){s=w.item(A);D=v(s.nodeValue);if(!(G.indexOf(s.localName)>=0))if(D!="")if(D.indexOf("pointer-events")!==0)if(!(s.localName==="class"&&D.indexOf("se_")===0)){k.push(" ");if(s.localName==="d")D=Ua.convertPath(g,true);if(isNaN(D)){if(E.test(D))D=svgedit.units.shortFloat(D)+t}else D=svgedit.units.shortFloat(D);if(Za.apply&&g.nodeName==="image"&&s.localName==="href"&&Za.images&&Za.images==="embed"){var H= Xa[D];if(H)D=H}if(!s.namespaceURI||s.namespaceURI==c||za[s.namespaceURI]){k.push(s.nodeName);k.push('="');k.push(D);k.push('"')}}}}if(g.hasChildNodes()){k.push(">");h++;w=false;for(A=0;A");break;case 8:k.push("\n"); k.push(Array(h+1).join(" "));k.push("