-/*! SVG.js v1.0.0-rc.10 MIT*/(function(){function t(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function e(t){return t.charAt(0).toUpperCase()+t.slice(1)}function n(t){return 4==t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}function i(t){var e=t.toString(16);return 1==e.length?"0"+e:e}function r(t,e,n){return(null==e||null==n)&&(null==n?n=t.height/t.width*e:null==e&&(e=t.width/t.height*n)),{width:e,height:n}}function s(t,e,n){return{x:e*t.a+n*t.c+0,y:e*t.b+n*t.d+0}}function h(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}function o(t,e){return"number"==typeof t.from?t.from+(t.to-t.from)*e:t instanceof d.Color||t instanceof d.Number?t.at(e):1>e?t.from:t.to}function a(t){for(var e=0,n=t.length,i="";n>e;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}function u(t){for(var e=t.childNodes.length-1;e>=0;e--)t.childNodes[e]instanceof SVGElement&&u(t.childNodes[e]);return d.adopt(t).id(d.eid(t.nodeName))}function l(t){return t.x2=t.x+t.width,t.y2=t.y+t.height,t.cx=t.x+t.width/2,t.cy=t.y+t.height/2,t}function c(t){var e=t.toString().match(d.regex.reference);return e?e[1]:void 0}function f(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}var d=this.SVG=function(t){return d.supported?(t=new d.Doc(t),d.parser||d.prepare(t),t):void 0};if(d.ns="http://www.w3.org/2000/svg",d.xmlns="http://www.w3.org/2000/xmlns/",d.xlink="http://www.w3.org/1999/xlink",d.did=1e3,d.eid=function(t){return"Svgjs"+e(t)+d.did++},d.create=function(t){var e=document.createElementNS(this.ns,t);return e.setAttribute("id",this.eid(t)),e},d.extend=function(){var t,e,n,i;for(t=[].slice.call(arguments),e=t.pop(),i=t.length-1;i>=0;i--)if(t[i])for(n in e)t[i].prototype[n]=e[n];d.Set&&d.Set.inherit&&d.Set.inherit()},d.prepare=function(t){var e=document.getElementsByTagName("body")[0],n=(e?new d.Doc(e):t.nested()).size(2,0),i=d.create("path");n.node.appendChild(i),d.parser={body:e||t.parent(),draw:n.style("opacity:0;position:fixed;left:100%;top:100%;overflow:hidden"),poly:n.polyline().node,path:i}},d.supported=function(){return!!document.createElementNS&&!!document.createElementNS(d.ns,"svg").createSVGRect}(),!d.supported)return!1;d.invent=function(t){var e="function"==typeof t.create?t.create:function(){this.constructor.call(this,d.create(t.create))};return t.inherit&&(e.prototype=new t.inherit),t.extend&&d.extend(e,t.extend),t.construct&&d.extend(t.parent||d.Container,t.construct),e},d.adopt=function(t){if(t.instance)return t.instance;var n;return n="svg"==t.nodeName?t.parentNode instanceof SVGElement?new d.Nested:new d.Doc:"lineairGradient"==t.nodeName?new d.Gradient("lineair"):"radialGradient"==t.nodeName?new d.Gradient("radial"):d[e(t.nodeName)]?new(d[e(t.nodeName)]):new d.Element(t),n.type=t.nodeName,n.node=t,t.instance=n,n instanceof d.Doc&&n.namespace().defs(),n},d.regex={unit:/^(-?[\d\.]+)([a-z%]{0,2})$/,hex:/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rgb:/rgb\((\d+),(\d+),(\d+)\)/,reference:/#([a-z0-9\-_]+)/i,isHex:/^#[a-f0-9]{3,6}$/i,isRgb:/^rgb\(/,isCss:/[^:]+:[^;]+;?/,isBlank:/^(\s+)?$/,isNumber:/^-?[\d\.]+$/,isPercent:/^-?[\d\.]+%$/,isImage:/\.(jpg|jpeg|png|gif)(\?[^=]+.*)?/i,isEvent:/^[\w]+:[\w]+$/},d.utils={map:function(t,e){var n,i=t.length,r=[];for(n=0;i>n;n++)r.push(e(t[n]));return r},radians:function(t){return t%360*Math.PI/180},degrees:function(t){return 180*t/Math.PI%360}},d.defaults={attrs:{"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"},trans:{x:0,y:0,scaleX:1,scaleY:1,rotation:0,skewX:0,skewY:0,matrix:this.matrix,a:1,b:0,c:0,d:1,e:0,f:0}},d.Color=function(t){var e;this.r=0,this.g=0,this.b=0,"string"==typeof t?d.regex.isRgb.test(t)?(e=d.regex.rgb.exec(t.replace(/\s/g,"")),this.r=parseInt(e[1]),this.g=parseInt(e[2]),this.b=parseInt(e[3])):d.regex.isHex.test(t)&&(e=d.regex.hex.exec(n(t)),this.r=parseInt(e[1],16),this.g=parseInt(e[2],16),this.b=parseInt(e[3],16)):"object"==typeof t&&(this.r=t.r,this.g=t.g,this.b=t.b)},d.extend(d.Color,{toString:function(){return this.toHex()},toHex:function(){return"#"+i(this.r)+i(this.g)+i(this.b)},toRgb:function(){return"rgb("+[this.r,this.g,this.b].join()+")"},brightness:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11},morph:function(t){return this.destination=new d.Color(t),this},at:function(t){return this.destination?(t=0>t?0:t>1?1:t,new d.Color({r:~~(this.r+(this.destination.r-this.r)*t),g:~~(this.g+(this.destination.g-this.g)*t),b:~~(this.b+(this.destination.b-this.b)*t)})):this}}),d.Color.test=function(t){return t+="",d.regex.isHex.test(t)||d.regex.isRgb.test(t)},d.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},d.Color.isColor=function(t){return d.Color.isRgb(t)||d.Color.test(t)},d.Array=function(t,e){t=(t||[]).valueOf(),0==t.length&&e&&(t=e.valueOf()),this.value=this.parse(t)},d.extend(d.Array,{morph:function(t){if(this.destination=this.parse(t),this.value.length!=this.destination.length){for(var e=this.value[this.value.length-1],n=this.destination[this.destination.length-1];this.value.length>this.destination.length;)this.destination.push(n);for(;this.value.length<this.destination.length;)this.value.push(e)}return this},settle:function(){for(var t=0,e=this.value.length,n=[];e>t;t++)-1==n.indexOf(this.value[t])&&n.push(this.value[t]);return this.value=n},at:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];n>e;e++)i.push(this.value[e]+(this.destination[e]-this.value[e])*t);return new d.Array(i)},toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(t){return t=t.valueOf(),Array.isArray(t)?t:this.split(t)},split:function(t){return t.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"").split(" ")},reverse:function(){return this.value.reverse(),this}}),d.PointArray=function(t,e){this.constructor.call(this,t,e||[[0,0]])},d.PointArray.prototype=new d.Array,d.extend(d.PointArray,{toString:function(){for(var t=0,e=this.value.length,n=[];e>t;t++)n.push(this.value[t].join(","));return n.join(" ")},toLine:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}},at:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];n>e;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new d.PointArray(i)},parse:function(t){if(t=t.valueOf(),Array.isArray(t))return t;t=this.split(t);for(var e,n=0,i=t.length,r=[];i>n;n++)e=t[n].split(","),r.push([parseFloat(e[0]),parseFloat(e[1])]);return r},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i=this.value.length-1;i>=0;i--)this.value[i]=[this.value[i][0]+t,this.value[i][1]+e];return this},size:function(t,e){var n,i=this.bbox();for(n=this.value.length-1;n>=0;n--)this.value[n][0]=(this.value[n][0]-i.x)*t/i.width+i.x,this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y;return this},bbox:function(){return d.parser.poly.setAttribute("points",this.toString()),d.parser.poly.getBBox()}}),d.PathArray=function(t,e){this.constructor.call(this,t,e||[["M",0,0]])},d.PathArray.prototype=new d.Array,d.extend(d.PathArray,{toString:function(){return a(this.value)},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i,r=this.value.length-1;r>=0;r--)i=this.value[r][0],"M"==i||"L"==i||"T"==i?(this.value[r][1]+=t,this.value[r][2]+=e):"H"==i?this.value[r][1]+=t:"V"==i?this.value[r][1]+=e:"C"==i||"S"==i||"Q"==i?(this.value[r][1]+=t,this.value[r][2]+=e,this.value[r][3]+=t,this.value[r][4]+=e,"C"==i&&(this.value[r][5]+=t,this.value[r][6]+=e)):"A"==i&&(this.value[r][6]+=t,this.value[r][7]+=e);return this},size:function(t,e){var n,i,r=this.bbox();for(n=this.value.length-1;n>=0;n--)i=this.value[n][0],"M"==i||"L"==i||"T"==i?(this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x,this.value[n][2]=(this.value[n][2]-r.y)*e/r.height+r.y):"H"==i?this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x:"V"==i?this.value[n][1]=(this.value[n][1]-r.y)*e/r.height+r.y:"C"==i||"S"==i||"Q"==i?(this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x,this.value[n][2]=(this.value[n][2]-r.y)*e/r.height+r.y,this.value[n][3]=(this.value[n][3]-r.x)*t/r.width+r.x,this.value[n][4]=(this.value[n][4]-r.y)*e/r.height+r.y,"C"==i&&(this.value[n][5]=(this.value[n][5]-r.x)*t/r.width+r.x,this.value[n][6]=(this.value[n][6]-r.y)*e/r.height+r.y)):"A"==i&&(this.value[n][1]=this.value[n][1]*t/r.width,this.value[n][2]=this.value[n][2]*e/r.height,this.value[n][6]=(this.value[n][6]-r.x)*t/r.width+r.x,this.value[n][7]=(this.value[n][7]-r.y)*e/r.height+r.y);return this},parse:function(t){if(t instanceof d.PathArray)return t.valueOf();var e,n,i,r,s,h,o,u,l,c,f,p=0,m=0;for(d.parser.path.setAttribute("d","string"==typeof t?t:a(t)),f=d.parser.path.pathSegList,e=0,n=f.numberOfItems;n>e;++e)c=f.getItem(e),l=c.pathSegTypeAsLetter,"M"==l||"L"==l||"H"==l||"V"==l||"C"==l||"S"==l||"Q"==l||"T"==l||"A"==l?("x"in c&&(p=c.x),"y"in c&&(m=c.y)):("x1"in c&&(s=p+c.x1),"x2"in c&&(o=p+c.x2),"y1"in c&&(h=m+c.y1),"y2"in c&&(u=m+c.y2),"x"in c&&(p+=c.x),"y"in c&&(m+=c.y),"m"==l?f.replaceItem(d.parser.path.createSVGPathSegMovetoAbs(p,m),e):"l"==l?f.replaceItem(d.parser.path.createSVGPathSegLinetoAbs(p,m),e):"h"==l?f.replaceItem(d.parser.path.createSVGPathSegLinetoHorizontalAbs(p),e):"v"==l?f.replaceItem(d.parser.path.createSVGPathSegLinetoVerticalAbs(m),e):"c"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoCubicAbs(p,m,s,h,o,u),e):"s"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoCubicSmoothAbs(p,m,o,u),e):"q"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoQuadraticAbs(p,m,s,h),e):"t"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoQuadraticSmoothAbs(p,m),e):"a"==l?f.replaceItem(d.parser.path.createSVGPathSegArcAbs(p,m,c.r1,c.r2,c.angle,c.largeArcFlag,c.sweepFlag),e):("z"==l||"Z"==l)&&(p=i,m=r)),("M"==l||"m"==l)&&(i=p,r=m);for(t=[],f=d.parser.path.pathSegList,e=0,n=f.numberOfItems;n>e;++e)c=f.getItem(e),l=c.pathSegTypeAsLetter,p=[l],"M"==l||"L"==l||"T"==l?p.push(c.x,c.y):"H"==l?p.push(c.x):"V"==l?p.push(c.y):"C"==l?p.push(c.x1,c.y1,c.x2,c.y2,c.x,c.y):"S"==l?p.push(c.x2,c.y2,c.x,c.y):"Q"==l?p.push(c.x1,c.y1,c.x,c.y):"A"==l&&p.push(c.r1,c.r2,c.angle,0|c.largeArcFlag,0|c.sweepFlag,c.x,c.y),t.push(p);return t},bbox:function(){return d.parser.path.setAttribute("d",this.toString()),d.parser.path.getBBox()}}),d.Number=function(t){if(this.value=0,this.unit="","number"==typeof t)this.value=isNaN(t)?0:isFinite(t)?t:0>t?-3.4e38:3.4e38;else if("string"==typeof t){var e=t.match(d.regex.unit);e&&(this.value=parseFloat(e[1]),"%"==e[2]?this.value/=100:"s"==e[2]&&(this.value*=1e3),this.unit=e[2])}else t instanceof d.Number&&(this.value=t.value,this.unit=t.unit)},d.extend(d.Number,{toString:function(){return("%"==this.unit?~~(1e8*this.value)/1e6:"s"==this.unit?this.value/1e3:this.value)+this.unit},valueOf:function(){return this.value},plus:function(t){return this.value=this+new d.Number(t),this},minus:function(t){return this.plus(-new d.Number(t))},times:function(t){return this.value=this*new d.Number(t),this},divide:function(t){return this.value=this/new d.Number(t),this},to:function(t){return"string"==typeof t&&(this.unit=t),this},morph:function(t){return this.destination=new d.Number(t),this},at:function(t){return this.destination?new d.Number(this.destination).minus(this).times(t).plus(this):this}}),d.ViewBox=function(t){var e,n,i,r,s=1,h=1,o=t.bbox(),a=(t.attr("viewBox")||"").match(/-?[\d\.]+/g),u=t,l=t;for(i=new d.Number(t.width()),r=new d.Number(t.height());"%"==i.unit;)s*=i.value,i=new d.Number(u instanceof d.Doc?u.parent().offsetWidth:u.parent().width()),u=u.parent();for(;"%"==r.unit;)h*=r.value,r=new d.Number(l instanceof d.Doc?l.parent().offsetHeight:l.parent().height()),l=l.parent();this.x=o.x,this.y=o.y,this.width=i*s,this.height=r*h,this.zoom=1,a&&(e=parseFloat(a[0]),n=parseFloat(a[1]),i=parseFloat(a[2]),r=parseFloat(a[3]),this.zoom=this.width/this.height>i/r?this.height/r:this.width/i,this.x=e,this.y=n,this.width=i,this.height=r)},d.extend(d.ViewBox,{toString:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}}),d.Element=d.invent({create:function(t){this._stroke=d.defaults.attrs.stroke,(this.node=t)&&(this.type=t.nodeName,this.node.instance=this,this._stroke=t.getAttribute("stroke")||this._stroke)},extend:{x:function(t){return null!=t&&(t=new d.Number(t),t.value/=this.transform("scaleX")),this.attr("x",t)},y:function(t){return null!=t&&(t=new d.Number(t),t.value/=this.transform("scaleY")),this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var n=r(this.bbox(),t,e);return this.width(new d.Number(n.width)).height(new d.Number(n.height))},clone:function(){return u(this.node.cloneNode(!0))},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(t){return this.after(t).remove(),t},addTo:function(t){return t.put(this)},putIn:function(t){return t.add(this)},id:function(t){return this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},show:function(){return this.style("display","")},hide:function(){return this.style("display","none")},visible:function(){return"none"!=this.style("display")},toString:function(){return this.attr("id")},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(/\s+/)},hasClass:function(t){return-1!=this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter(function(e){return e!=t}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return d.get(this.attr(t))},parent:function(t){var e=d.adopt(this.node.parentNode);if(t)for(;!(e instanceof t);)e=d.adopt(e.node.parentNode);return e},doc:function(t){return this.parent(t||d.Doc)},"native":function(){return this.node}}}),d.BBox=d.invent({create:function(t){var e;if(this.x=0,this.y=0,this.width=0,this.height=0,t){var n=new d.Matrix(t).extract();e=t.node.getBBox?t.node.getBBox():{x:t.node.clientLeft,y:t.node.clientTop,width:t.node.clientWidth,height:t.node.clientHeight},this.x=e.x+n.x,this.y=e.y+n.y,this.width=e.width*n.scaleX,this.height=e.height*n.scaleY}l(this)},parent:d.Element,construct:{bbox:function(){return new d.BBox(this)}}}),d.RBox=d.invent({create:function(t){var e={};if(this.x=0,this.y=0,this.width=0,this.height=0,t){var n=t.doc().parent(),i=1;for(e=t.node.getBoundingClientRect(),this.x=e.left,this.y=e.top,this.x-=n.offsetLeft,this.y-=n.offsetTop;n=n.offsetParent;)this.x-=n.offsetLeft,this.y-=n.offsetTop;for(n=t;n.parent&&(n=n.parent());)n.viewbox&&(i*=n.viewbox().zoom,this.x-=n.x()||0,this.y-=n.y()||0)}this.width=e.width/=i,this.height=e.height/=i,this.x+=window.scrollX,this.y+=window.scrollY,l(this)},parent:d.Element,construct:{rbox:function(){return new d.RBox(this)}}}),[d.BBox,d.RBox].forEach(function(t){d.extend(t,{merge:function(e){var n=new t;return n.x=Math.min(this.x,e.x),n.y=Math.min(this.y,e.y),n.width=Math.max(this.x+this.width,e.x+e.width)-n.x,n.height=Math.max(this.y+this.height,e.y+e.height)-n.y,l(n)}})}),d.Matrix=d.invent({create:function(t){var e,n=h([1,0,0,1,0,0]);for(t=t&&t.node&&t.node.getCTM?t.node.getCTM():"string"==typeof t?h(t.replace(/\s/g,"").split(",")):6==arguments.length?h([].slice.call(arguments)):"object"==typeof t?t:n,e=m.length-1;e>=0;e--)this[m[e]]="number"==typeof t[m[e]]?t[m[e]]:n[m[e]]},extend:{extract:function(){var t=s(this,0,1),e=s(this,1,0),n=180/Math.PI*Math.atan2(t.y,t.x)-90;return{x:this.e,y:this.f,skewX:n,skewY:180/Math.PI*Math.atan2(e.y,e.x),scaleX:Math.sqrt(this.a*this.a+this.b*this.b),scaleY:Math.sqrt(this.c*this.c+this.d*this.d),rotation:n}},multiply:function(t){return new d.Matrix(this.native().multiply(t.native()))},inverse:function(){return new d.Matrix(this.native().inverse())},translate:function(t,e){return new d.Matrix(this.native().translate(t||0,e||0))},scale:function(t,e,n,i){return(1==arguments.length||3==arguments.length)&&(e=t),3==arguments.length&&(i=n,n=e),this.multiply(new d.Matrix(1,0,0,1,n||0,i||0)).multiply(new d.Matrix(t,0,0,e,0,0)).multiply(new d.Matrix(1,0,0,1,-n||0,-i||0))},rotate:function(t,e,n){return t=d.utils.radians(t),this.multiply(new d.Matrix(1,0,0,1,e||0,n||0)).multiply(new d.Matrix(Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0)).multiply(new d.Matrix(1,0,0,1,-e||0,-n||0))},flip:function(t){return new d.Matrix(this.native()["flip"+t.toUpperCase()]())},skew:function(t,e){return new d.Matrix(this.native().skewX(t||0).skewY(e||0))},"native":function(){var t,e=d.parser.draw.node.createSVGMatrix();for(t=m.length-1;t>=0;t--)e[m[t]]=this[m[t]];return e},toString:function(){return"matrix("+[this.a,this.b,this.c,this.d,this.e,this.f].join()+")"}},parent:d.Element,construct:{ctm:function(){return new d.Matrix(this)}}}),d.extend(d.Element,{attr:function(t,e,n){if(null==t){for(t={},e=this.node.attributes,n=e.length-1;n>=0;n--)t[e[n].nodeName]=d.regex.isNumber.test(e[n].nodeValue)?parseFloat(e[n].nodeValue):e[n].nodeValue;return t}if("object"==typeof t)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return e=this.node.getAttribute(t),null==e?d.defaults.attrs[t]:d.regex.isNumber.test(e)?parseFloat(e):e;"stroke-width"==t?this.attr("stroke",parseFloat(e)>0?this._stroke:null):"stroke"==t&&(this._stroke=e),("fill"==t||"stroke"==t)&&(d.regex.isImage.test(e)&&(e=this.doc().defs().image(e,0,0)),e instanceof d.Image&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new d.Number(e):d.Color.isColor(e)?e=new d.Color(e):Array.isArray(e)&&(e=new d.Array(e)),"leading"==t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!=t&&"x"!=t||this.rebuild(t,e)}return this}}),d.extend(d.Element,{transform:function(t){if(null==t)return this.ctm().extract();if("string"==typeof t)return this.ctm().extract()[t];var e=new d.Matrix(this);return null!=t.a?e=e.multiply(new d.Matrix(t)):t.rotation?e=e.rotate(t.rotation,null==t.cx?this.bbox().cx:t.cx,null==t.cy?this.bbox().cy:t.cy):null!=t.scale||null!=t.scaleX||null!=t.scaleY?e=e.scale(null!=t.scale?t.scale:null!=t.scaleX?t.scaleX:1,null!=t.scale?t.scale:null!=t.scaleY?t.scaleY:1,null!=t.cx?t.cx:this.bbox().x,null!=t.cy?t.cy:this.bbox().y):t.skewX||t.skewY?e=e.skew(t.skewX,t.skewY):(t.x||t.y)&&(e=e.translate(t.x,t.y)),this.attr("transform",e)},untransform:function(){return this.attr("transform",null)}}),d.extend(d.Element,{style:function(e,n){if(0==arguments.length)return this.node.style.cssText||"";if(arguments.length<2)if("object"==typeof e)for(n in e)this.style(n,e[n]);else{if(!d.regex.isCss.test(e))return this.node.style[t(e)];e=e.split(";");for(var i=0;i<e.length;i++)n=e[i].split(":"),this.style(n[0].replace(/\s+/g,""),n[1])}else this.node.style[t(e)]=null===n||d.regex.isBlank.test(n)?"":n;return this}}),d.Parent=d.invent({create:function(t){this.constructor.call(this,t)},inherit:d.Element,extend:{children:function(){return d.utils.map(this.node.childNodes,function(t){return d.adopt(t)})},add:function(t,e){return this.has(t)||(e=null==e?this.children().length:e,this.node.insertBefore(t.node,this.node.childNodes[e]||null)),this},put:function(t,e){return this.add(t,e),t},has:function(t){return this.index(t)>=0},index:function(t){return this.children().indexOf(t)},get:function(t){return this.children()[t]},first:function(){return this.children()[0]},last:function(){return this.children()[this.children().length-1]},each:function(t,e){var n,i,r=this.children();for(n=0,i=r.length;i>n;n++)r[n]instanceof d.Element&&t.apply(r[n],[n,r]),e&&r[n]instanceof d.Container&&r[n].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},defs:function(){return this.doc().defs()}}}),d.Container=d.invent({create:function(t){this.constructor.call(this,t)},inherit:d.Parent,extend:{viewbox:function(t){return 0==arguments.length?new d.ViewBox(this):(t=1==arguments.length?[t.x,t.y,t.width,t.height]:[].slice.call(arguments),this.attr("viewBox",t))}}}),d.extend(d.Parent,d.Text,{svg:function(t){var e=document.createElement("div");if(t){t=t.replace(/\n/,"").replace(/<(\w+)([^<]+?)\/>/g,"<$1$2></$1>"),e.innerHTML="<svg>"+t+"</svg>";for(var n=e.firstChild.childNodes.length-1;n>=0;n--)1==e.firstChild.childNodes[n].nodeType&&this.node.appendChild(e.firstChild.childNodes[n]);return this}var i=this.node.cloneNode(!0);return e.appendChild(i),e.innerHTML}}),d.FX=d.invent({create:function(t){this.target=t},extend:{animate:function(t,e,n){var i,r,s,h,a=this.target,u=this;return"object"==typeof t&&(n=t.delay,e=t.ease,t=t.duration),t="="==t?t:null==t?1e3:new d.Number(t).valueOf(),e=e||"<>",u.to=function(t){var n;if(t=0>t?0:t>1?1:t,null==i){i=[];for(h in u.attrs)i.push(h);if(a.morphArray&&(u._plot||i.indexOf("points")>-1)){var l,c=new a.morphArray(u._plot||u.attrs.points||a.array);u._size&&c.size(u._size.width.to,u._size.height.to),l=c.bbox(),u._x?c.move(u._x.to,l.y):u._cx&&c.move(u._cx.to-l.width/2,l.y),l=c.bbox(),u._y?c.move(l.x,u._y.to):u._cy&&c.move(l.x,u._cy.to-l.height/2),delete u._x,delete u._y,delete u._cx,delete u._cy,delete u._size,u._plot=a.array.morph(c)}}if(null==r){r=[];for(h in u.trans)r.push(h)}if(null==s){s=[];for(h in u.styles)s.push(h)}for(t="<>"==e?-Math.cos(t*Math.PI)/2+.5:">"==e?Math.sin(t*Math.PI/2):"<"==e?-Math.cos(t*Math.PI/2)+1:"-"==e?t:"function"==typeof e?e(t):t,u._plot?a.plot(u._plot.at(t)):(u._x?a.x(u._x.at(t)):u._cx&&a.cx(u._cx.at(t)),u._y?a.y(u._y.at(t)):u._cy&&a.cy(u._cy.at(t)),u._size&&a.size(u._size.width.at(t),u._size.height.at(t))),u._viewbox&&a.viewbox(u._viewbox.x.at(t),u._viewbox.y.at(t),u._viewbox.width.at(t),u._viewbox.height.at(t)),u._leading&&a.leading(u._leading.at(t)),n=i.length-1;n>=0;n--)a.attr(i[n],o(u.attrs[i[n]],t));for(n=r.length-1;n>=0;n--)a.transform(r[n],o(u.trans[r[n]],t));for(n=s.length-1;n>=0;n--)a.style(s[n],o(u.styles[s[n]],t));u._during&&u._during.call(a,t,function(e,n){return o({from:e,to:n},t)})},"number"==typeof t&&(this.timeout=setTimeout(function(){var i=(new Date).getTime();u.situation={interval:1e3/60,start:i,play:!0,finish:i+t,duration:t},u.render=function(){if(u.situation.play===!0){var i=(new Date).getTime(),r=i>u.situation.finish?1:(i-u.situation.start)/t;u.to(r),i>u.situation.finish?(u._plot&&a.plot(new d.PointArray(u._plot.destination).settle()),u._loop===!0||"number"==typeof u._loop&&u._loop>1?("number"==typeof u._loop&&--u._loop,u.animate(t,e,n)):u._after?u._after.apply(a,[u]):u.stop()):requestAnimFrame(u.render)}else requestAnimFrame(u.render)},u.render()},new d.Number(n).valueOf())),this},bbox:function(){return this.target.bbox()},attr:function(t,e){if("object"==typeof t)for(var n in t)this.attr(n,t[n]);else{var i=this.target.attr(t);this.attrs[t]=d.Color.isColor(i)?new d.Color(i).morph(e):d.regex.unit.test(i)?new d.Number(i).morph(e):{from:i,to:e}}return this},transform:function(){},style:function(t,e){if("object"==typeof t)for(var n in t)this.style(n,t[n]);else this.styles[t]={from:this.target.style(t),to:e};return this},x:function(t){return this._x=new d.Number(this.target.x()).morph(t),this},y:function(t){return this._y=new d.Number(this.target.y()).morph(t),this},cx:function(t){return this._cx=new d.Number(this.target.cx()).morph(t),this},cy:function(t){return this._cy=new d.Number(this.target.cy()).morph(t),this},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){if(this.target instanceof d.Text)this.attr("font-size",t);else{var n=this.target.bbox();this._size={width:new d.Number(n.width).morph(t),height:new d.Number(n.height).morph(e)}}return this},plot:function(t){return this._plot=t,this},leading:function(t){return this.target._leading&&(this._leading=new d.Number(this.target._leading).morph(t)),this},viewbox:function(t,e,n,i){if(this.target instanceof d.Container){var r=this.target.viewbox();this._viewbox={x:new d.Number(r.x).morph(t),y:new d.Number(r.y).morph(e),width:new d.Number(r.width).morph(n),height:new d.Number(r.height).morph(i)}}return this},update:function(t){return this.target instanceof d.Stop&&(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new d.Number(t.offset))),this},during:function(t){return this._during=t,this},after:function(t){return this._after=t,this},loop:function(t){return this._loop=t||!0,this},stop:function(t){return t===!0?(this.animate(0),this._after&&this._after.apply(this.target,[this])):(clearTimeout(this.timeout),this.attrs={},this.trans={},this.styles={},this.situation={},delete this._x,delete this._y,delete this._cx,delete this._cy,delete this._size,delete this._plot,delete this._loop,delete this._after,delete this._during,delete this._leading,delete this._viewbox),this},pause:function(){return this.situation.play===!0&&(this.situation.play=!1,this.situation.pause=(new Date).getTime()),this},play:function(){if(this.situation.play===!1){var t=(new Date).getTime()-this.situation.pause;this.situation.finish+=t,this.situation.start+=t,this.situation.play=!0}return this}},parent:d.Element,construct:{animate:function(t,e,n){return(this.fx||(this.fx=new d.FX(this))).stop().animate(t,e,n)},stop:function(t){return this.fx&&this.fx.stop(t),this},pause:function(){return this.fx&&this.fx.pause(),this},play:function(){return this.fx&&this.fx.play(),this}}}),d.extend(d.Element,d.FX,{dx:function(t){return this.x((this.target||this).x()+t)},dy:function(t){return this.y((this.target||this).y()+t)},dmove:function(t,e){return this.dx(t).dy(e)}}),["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(t){d.Element.prototype[t]=function(e){var n=this;return this.node["on"+t]="function"==typeof e?function(){return e.apply(n,arguments)}:null,this}}),d.events={},d.listeners={},d.registerEvent=function(t){d.events[t]||(d.events[t]=new f(t))},d.on=function(t,e,n){var i=n.bind(t.instance||t);d.listeners[n]=i,t.addEventListener(e,i,!1)},d.off=function(t,e,n){t.removeEventListener(e,d.listeners[n],!1),delete d.listeners[n]},d.extend(d.Element,{on:function(t,e){return d.on(this.node,t,e),this},off:function(t,e){return d.off(this.node,t,e),this},fire:function(t,e){return d.events[t].detail=e,this.node.dispatchEvent(d.events[t]),delete d.events[t].detail,this}}),d.Defs=d.invent({create:"defs",inherit:d.Container}),d.G=d.invent({create:"g",inherit:d.Container,extend:{x:function(t){return this.transform(null==t?"x":{x:-this.x()+t})},y:function(t){return this.transform(null==t?"y":{y:-this.y()+t})},cx:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)},cy:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)}},construct:{group:function(){return this.put(new d.G)}}}),d.extend(d.Element,{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},previous:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),e instanceof d.Doc&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return t>0&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),t instanceof d.Doc&&t.node.appendChild(t.defs().node),this},back:function(){return this.position()>0&&this.parent().removeElement(this).add(this,0),this},before:function(t){t.remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){t.remove();var e=this.position();return this.parent().add(t,e+1),this}}),d.Mask=d.invent({create:function(){this.constructor.call(this,d.create("mask")),this.targets=[]},inherit:d.Container,extend:{remove:function(){for(var t=this.targets.length-1;t>=0;t--)this.targets[t]&&this.targets[t].unmask();return delete this.targets,this.parent().removeElement(this),this}},construct:{mask:function(){return this.defs().put(new d.Mask)}}}),d.extend(d.Element,{maskWith:function(t){return this.masker=t instanceof d.Mask?t:this.parent().mask().add(t),this.masker.targets.push(this),this.attr("mask",'url("#'+this.masker.attr("id")+'")')},unmask:function(){return delete this.masker,this.attr("mask",null)}}),d.ClipPath=d.invent({create:function(){this.constructor.call(this,d.create("clipPath")),this.targets=[]},inherit:d.Container,extend:{remove:function(){for(var t=this.targets.length-1;t>=0;t--)this.targets[t]&&this.targets[t].unclip();return delete this.targets,this.parent().removeElement(this),this}},construct:{clip:function(){return this.defs().put(new d.ClipPath)}}}),d.extend(d.Element,{clipWith:function(t){return this.clipper=t instanceof d.ClipPath?t:this.parent().clip().add(t),this.clipper.targets.push(this),this.attr("clip-path",'url("#'+this.clipper.attr("id")+'")')},unclip:function(){return delete this.clipper,this.attr("clip-path",null)}}),d.Gradient=d.invent({create:function(t){this.constructor.call(this,d.create(t+"Gradient")),this.type=t},inherit:d.Container,extend:{from:function(t,e){return this.attr("radial"==this.type?{fx:new d.Number(t),fy:new d.Number(e)}:{x1:new d.Number(t),y1:new d.Number(e)})},to:function(t,e){return this.attr("radial"==this.type?{cx:new d.Number(t),cy:new d.Number(e)}:{x2:new d.Number(t),y2:new d.Number(e)})},radius:function(t){return"radial"==this.type?this.attr({r:new d.Number(t)}):this},at:function(t,e,n){return this.put(new d.Stop).update(t,e,n)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},fill:function(){return"url(#"+this.id()+")"},toString:function(){return this.fill()}},construct:{gradient:function(t,e){return this.defs().gradient(t,e)}}}),d.extend(d.Defs,{gradient:function(t,e){return this.put(new d.Gradient(t)).update(e)}}),d.Stop=d.invent({create:"stop",inherit:d.Element,extend:{update:function(t){return("number"==typeof t||t instanceof d.Number)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new d.Number(t.offset)),this}}}),d.Pattern=d.invent({create:"pattern",inherit:d.Container,extend:{fill:function(){return"url(#"+this.id()+")"},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return this.fill()}},construct:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}}}),d.extend(d.Defs,{pattern:function(t,e,n){return this.put(new d.Pattern).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})
-}}),d.Doc=d.invent({create:function(t){t&&(t="string"==typeof t?document.getElementById(t):t,"svg"==t.nodeName?this.constructor.call(this,t):(this.constructor.call(this,d.create("svg")),t.appendChild(this.node)),this.namespace().size("100%","100%").defs())},inherit:d.Container,extend:{namespace:function(){return this.attr({xmlns:d.ns,version:"1.1"}).attr("xmlns:xlink",d.xlink,d.xmlns)},defs:function(){if(!this._defs){var t;this._defs=(t=this.node.getElementsByTagName("defs")[0])?d.adopt(t):new d.Defs,this.node.appendChild(this._defs.node)}return this._defs},parent:function(){return"#document"==this.node.parentNode.nodeName?null:this.node.parentNode}}}),d.extend(d.Doc,{spof:function(){if(this.doSpof){var t=this.node.getScreenCTM();t&&this.style("left",-t.e%1+"px").style("top",-t.f%1+"px")}return this},fixSubPixelOffset:function(){var t=this;return this.doSpof=!0,d.on(window,"resize",function(){t.spof()}),this.spof()}}),d.Shape=d.invent({create:function(t){this.constructor.call(this,t)},inherit:d.Element}),d.Symbol=d.invent({create:"symbol",inherit:d.Container,construct:{symbol:function(){return this.defs().put(new d.Symbol)}}}),d.Use=d.invent({create:"use",inherit:d.Shape,extend:{element:function(t){return this.target=t,this.attr("href","#"+t,d.xlink)}},construct:{use:function(t){return this.put(new d.Use).element(t)}}}),d.Rect=d.invent({create:"rect",inherit:d.Shape,construct:{rect:function(t,e){return this.put((new d.Rect).size(t,e))}}}),d.Circle=d.invent({create:"circle",inherit:d.Shape,construct:{circle:function(t){return this.put(new d.Circle).rx(new d.Number(t).divide(2)).move(0,0)}}}),d.extend(d.Circle,d.FX,{rx:function(t){return this.attr("r",t)},ry:function(t){return this.rx(t)}}),d.Ellipse=d.invent({create:"ellipse",inherit:d.Shape,construct:{ellipse:function(t,e){return this.put(new d.Ellipse).size(t,e).move(0,0)}}}),d.extend(d.Ellipse,d.Rect,d.FX,{rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)}}),d.extend(d.Circle,d.Ellipse,{x:function(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())},y:function(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())},cx:function(t){return null==t?this.attr("cx"):this.attr("cx",new d.Number(t).divide(this.transform("scaleX")))},cy:function(t){return null==t?this.attr("cy"):this.attr("cy",new d.Number(t).divide(this.transform("scaleY")))},width:function(t){return null==t?2*this.rx():this.rx(new d.Number(t).divide(2))},height:function(t){return null==t?2*this.ry():this.ry(new d.Number(t).divide(2))},size:function(t,e){var n=r(this.bbox(),t,e);return this.rx(new d.Number(n.width).divide(2)).ry(new d.Number(n.height).divide(2))}}),d.Line=d.invent({create:"line",inherit:d.Shape,extend:{array:function(){return new d.PointArray([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])},plot:function(t,e,n,i){return t=4==arguments.length?{x1:t,y1:e,x2:n,y2:i}:new d.PointArray(t).toLine(),this.attr(t)},move:function(t,e){return this.attr(this.array().move(t,e).toLine())},size:function(t,e){var n=r(this.bbox(),t,e);return this.attr(this.array().size(n.width,n.height).toLine())}},construct:{line:function(t,e,n,i){return this.put(new d.Line).plot(t,e,n,i)}}}),d.Polyline=d.invent({create:"polyline",inherit:d.Shape,construct:{polyline:function(t){return this.put(new d.Polyline).plot(t)}}}),d.Polygon=d.invent({create:"polygon",inherit:d.Shape,construct:{polygon:function(t){return this.put(new d.Polygon).plot(t)}}}),d.extend(d.Polyline,d.Polygon,{array:function(){return this._array||(this._array=new d.PointArray(this.attr("points")))},plot:function(t){return this.attr("points",this._array=new d.PointArray(t))},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=r(this.bbox(),t,e);return this.attr("points",this.array().size(n.width,n.height))}}),d.extend(d.Line,d.Polyline,d.Polygon,{morphArray:d.PointArray,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}}),d.Path=d.invent({create:"path",inherit:d.Shape,extend:{morphArray:d.PathArray,array:function(){return this._array||(this._array=new d.PathArray(this.attr("d")))},plot:function(t){return this.attr("d",this._array=new d.PathArray(t))},move:function(t,e){return this.attr("d",this.array().move(t,e))},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},size:function(t,e){var n=r(this.bbox(),t,e);return this.attr("d",this.array().size(n.width,n.height))},width:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)},height:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},construct:{path:function(t){return this.put(new d.Path).plot(t)}}}),d.Image=d.invent({create:"image",inherit:d.Shape,extend:{load:function(t){if(!t)return this;var e=this,n=document.createElement("img");return n.onload=function(){var i=e.doc(d.Pattern);0==e.width()&&0==e.height()&&e.size(n.width,n.height),i&&0==i.width()&&0==i.height()&&i.size(e.width(),e.height()),"function"==typeof e._loaded&&e._loaded.call(e,{width:n.width,height:n.height,ratio:n.width/n.height,url:t})},this.attr("href",n.src=this.src=t,d.xlink)},loaded:function(t){return this._loaded=t,this}},construct:{image:function(t,e,n){return this.put(new d.Image).load(t).size(e||0,n||e||0)}}}),d.Text=d.invent({create:function(){this.constructor.call(this,d.create("text")),this._leading=new d.Number(1.3),this._rebuild=!0,this._build=!1,this.attr("font-family",d.defaults.attrs["font-family"])},inherit:d.Shape,extend:{x:function(t){return null==t?this.attr("x"):(this.textPath||this.lines.each(function(){this.newLined&&this.x(t)}),this.attr("x",t))},y:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)},cx:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)},cy:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)},text:function(t){if("undefined"==typeof t)return this.content;if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else{t=(this.content=t).split("\n");for(var e=0,n=t.length;n>e;e++)this.tspan(t[e]).newLine()}return this.build(!1).rebuild()},size:function(t){return this.attr("font-size",t).rebuild()},leading:function(t){return null==t?this._leading:(this._leading=new d.Number(t),this.rebuild())},rebuild:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this;this.lines.each(function(){this.newLined&&(this.textPath||this.attr("x",e.attr("x")),this.attr("dy",e._leading*new d.Number(e.attr("font-size"))))}),this.fire("rebuild")}return this},build:function(t){return this._build=!!t,this}},construct:{text:function(t){return this.put(new d.Text).text(t)},plain:function(t){return this.put(new d.Text).plain(t)}}}),d.Tspan=d.invent({create:"tspan",inherit:d.Shape,extend:{text:function(t){return"function"==typeof t?t.call(this,this):this.plain(t),this},dx:function(t){return this.attr("dx",t)},dy:function(t){return this.attr("dy",t)},newLine:function(){var t=this.doc(d.Text);return this.newLined=!0,this.dy(t._leading*t.attr("font-size")).attr("x",t.x())}}}),d.extend(d.Text,d.Tspan,{plain:function(t){return this._build===!1&&this.clear(),this.node.appendChild(document.createTextNode(this.content=t)),this},tspan:function(t){var e=(this.textPath||this).node,n=new d.Tspan;return this._build===!1&&this.clear(),e.appendChild(n.node),this instanceof d.Text&&this.lines.add(n),n.text(t)},clear:function(){for(var t=(this.textPath||this).node;t.hasChildNodes();)t.removeChild(t.lastChild);return this instanceof d.Text&&(delete this.lines,this.lines=new d.Set,this.content=""),this},length:function(){return this.node.getComputedTextLength()}}),d.registerEvent("rebuild"),d.TextPath=d.invent({create:"textPath",inherit:d.Element,parent:d.Text,construct:{path:function(t){for(this.textPath=new d.TextPath;this.node.hasChildNodes();)this.textPath.node.appendChild(this.node.firstChild);return this.node.appendChild(this.textPath.node),this.track=this.doc().defs().path(t),this.textPath.parent=this,this.textPath.attr("href","#"+this.track,d.xlink),this},plot:function(t){return this.track&&this.track.plot(t),this}}}),d.Nested=d.invent({create:function(){this.constructor.call(this,d.create("svg")),this.style("overflow","visible")},inherit:d.Container,construct:{nested:function(){return this.put(new d.Nested)}}}),d.A=d.invent({create:"a",inherit:d.Container,extend:{to:function(t){return this.attr("href",t,d.xlink)},show:function(t){return this.attr("show",t,d.xlink)},target:function(t){return this.attr("target",t)}},construct:{link:function(t){return this.put(new d.A).to(t)}}}),d.extend(d.Element,{linkTo:function(t){var e=new d.A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}),d.Marker=d.invent({create:"marker",inherit:d.Container,extend:{width:function(t){return this.attr("markerWidth",t)},height:function(t){return this.attr("markerHeight",t)},ref:function(t,e){return this.attr("refX",t).attr("refY",e)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return"url(#"+this.id()+")"}},construct:{marker:function(t,e,n){return this.defs().marker(t,e,n)}}}),d.extend(d.Defs,{marker:function(t,e,n){return this.put(new d.Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)}}),d.extend(d.Line,d.Polyline,d.Polygon,d.Path,{marker:function(t,e,n,i){var r=["marker"];return"all"!=t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof d.Marker?arguments[1]:this.doc().marker(e,n,i),this.attr(r,t)}});var p={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"==e?t:t+"-"+e}};["fill","stroke"].forEach(function(t){var e,n={};n[t]=function(n){if("string"==typeof n||d.Color.isRgb(n)||n&&"function"==typeof n.fill)this.attr(t,n);else for(e=p[t].length-1;e>=0;e--)null!=n[p[t][e]]&&this.attr(p.prefix(t,p[t][e]),n[p[t][e]]);return this},d.extend(d.Element,d.FX,n)}),d.extend(d.Element,d.FX,{rotate:function(t,e,n){return this.transform({rotation:t,cx:e,cy:n})},skew:function(t,e){return this.transform({skewX:t,skewY:e})},scale:function(t,e,n,i){return this.transform(1==arguments.length||3==arguments.length?{scale:t,cx:e,cy:n}:{scaleX:t,scaleY:e,cx:n,cy:i})},translate:function(t,e){return this.transform({x:t,y:e})},matrix:function(t){return this.attr("transform",new d.Matrix(t))},opacity:function(t){return this.attr("opacity",t)}}),d.extend(d.Rect,d.Ellipse,d.Circle,d.FX,{radius:function(t,e){return this.rx(t).ry(null==e?t:e)}}),d.extend(d.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return this.node.getPointAtLength(t)}}),d.extend(d.Parent,d.Text,d.FX,{font:function(t){for(var e in t)"leading"==e?this.leading(t[e]):"anchor"==e?this.attr("text-anchor",t[e]):"size"==e||"family"==e||"weight"==e||"stretch"==e||"variant"==e||"style"==e?this.attr("font-"+e,t[e]):this.attr(e,t[e]);return this}}),d.Set=d.invent({create:function(t){Array.isArray(t)?this.members=t:this.clear()},extend:{add:function(){var t,e,n=[].slice.call(arguments);for(t=0,e=n.length;e>t;t++)this.members.push(n[t]);return this},remove:function(t){var e=this.index(t);return e>-1&&this.members.splice(e,1),this},each:function(t){for(var e=0,n=this.members.length;n>e;e++)t.apply(this.members[e],[e,this.members]);return this},clear:function(){return this.members=[],this},has:function(t){return this.index(t)>=0},index:function(t){return this.members.indexOf(t)},get:function(t){return this.members[t]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members},bbox:function(){var t=new d.BBox;if(0==this.members.length)return t;var e=this.members[0].rbox();return t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,this.each(function(){t=t.merge(this.rbox())}),t}},construct:{set:function(t){return new d.Set(t)}}}),d.SetFX=d.invent({create:function(t){this.set=t}}),d.Set.inherit=function(){var t,e=[];for(var t in d.Shape.prototype)"function"==typeof d.Shape.prototype[t]&&"function"!=typeof d.Set.prototype[t]&&e.push(t);e.forEach(function(t){d.Set.prototype[t]=function(){for(var e=0,n=this.members.length;n>e;e++)this.members[e]&&"function"==typeof this.members[e][t]&&this.members[e][t].apply(this.members[e],arguments);return"animate"==t?this.fx||(this.fx=new d.SetFX(this)):this}}),e=[];for(var t in d.FX.prototype)"function"==typeof d.FX.prototype[t]&&"function"!=typeof d.SetFX.prototype[t]&&e.push(t);e.forEach(function(t){d.SetFX.prototype[t]=function(){for(var e=0,n=this.set.members.length;n>e;e++)this.set.members[e].fx[t].apply(this.set.members[e].fx,arguments);return this}})},d.extend(d.Element,{data:function(t,e,n){if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(i){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:n===!0||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),d.extend(d.Element,{remember:function(t,e){if("object"==typeof arguments[0])for(var e in t)this.remember(e,t[e]);else{if(1==arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0==arguments.length)this._memory={};else for(var t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory||(this._memory={})}}),d.get=function(t){var e=document.getElementById(c(t)||t);return e?d.adopt(e):void 0},d.select=function(t,e){return new d.Set(d.utils.map((e||document).querySelectorAll(t),function(t){return d.adopt(t)}))},d.extend(d.Parent,{select:function(t){return d.select(t,this.node)}}),"function"==typeof define&&define.amd?define(function(){return d}):"undefined"!=typeof exports&&(exports.SVG=d);var m="abcdef".split("");window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}(),"function"!=typeof f&&(f.prototype=window.Event.prototype,window.CustomEvent=f)}).call(this);
\ No newline at end of file
+/*! SVG.js v1.0.0-rc.10 MIT*/(function(){function t(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function e(t){return t.charAt(0).toUpperCase()+t.slice(1)}function n(t){return 4==t.length?["#",t.substring(1,2),t.substring(1,2),t.substring(2,3),t.substring(2,3),t.substring(3,4),t.substring(3,4)].join(""):t}function i(t){var e=t.toString(16);return 1==e.length?"0"+e:e}function r(t,e,n){return(null==e||null==n)&&(null==n?n=t.height/t.width*e:null==e&&(e=t.width/t.height*n)),{width:e,height:n}}function s(t,e,n){return{x:e*t.a+n*t.c+0,y:e*t.b+n*t.d+0}}function h(t){return{a:t[0],b:t[1],c:t[2],d:t[3],e:t[4],f:t[5]}}function o(t,e){return"number"==typeof t.from?t.from+(t.to-t.from)*e:t instanceof d.Color||t instanceof d.Number?t.at(e):1>e?t.from:t.to}function a(t){for(var e=0,n=t.length,i="";n>e;e++)i+=t[e][0],null!=t[e][1]&&(i+=t[e][1],null!=t[e][2]&&(i+=" ",i+=t[e][2],null!=t[e][3]&&(i+=" ",i+=t[e][3],i+=" ",i+=t[e][4],null!=t[e][5]&&(i+=" ",i+=t[e][5],i+=" ",i+=t[e][6],null!=t[e][7]&&(i+=" ",i+=t[e][7])))));return i+" "}function u(t){for(var e=t.childNodes.length-1;e>=0;e--)t.childNodes[e]instanceof SVGElement&&u(t.childNodes[e]);return d.adopt(t).id(d.eid(t.nodeName))}function l(t){return t.x2=t.x+t.width,t.y2=t.y+t.height,t.cx=t.x+t.width/2,t.cy=t.y+t.height/2,t}function c(t){var e=t.toString().match(d.regex.reference);return e?e[1]:void 0}function f(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}var d=this.SVG=function(t){return d.supported?(t=new d.Doc(t),d.parser||d.prepare(t),t):void 0};if(d.ns="http://www.w3.org/2000/svg",d.xmlns="http://www.w3.org/2000/xmlns/",d.xlink="http://www.w3.org/1999/xlink",d.did=1e3,d.eid=function(t){return"Svgjs"+e(t)+d.did++},d.create=function(t){var e=document.createElementNS(this.ns,t);return e.setAttribute("id",this.eid(t)),e},d.extend=function(){var t,e,n,i;for(t=[].slice.call(arguments),e=t.pop(),i=t.length-1;i>=0;i--)if(t[i])for(n in e)t[i].prototype[n]=e[n];d.Set&&d.Set.inherit&&d.Set.inherit()},d.prepare=function(t){var e=document.getElementsByTagName("body")[0],n=(e?new d.Doc(e):t.nested()).size(2,0),i=d.create("path");n.node.appendChild(i),d.parser={body:e||t.parent(),draw:n.style("opacity:0;position:fixed;left:100%;top:100%;overflow:hidden"),poly:n.polyline().node,path:i}},d.supported=function(){return!!document.createElementNS&&!!document.createElementNS(d.ns,"svg").createSVGRect}(),!d.supported)return!1;d.invent=function(t){var e="function"==typeof t.create?t.create:function(){this.constructor.call(this,d.create(t.create))};return t.inherit&&(e.prototype=new t.inherit),t.extend&&d.extend(e,t.extend),t.construct&&d.extend(t.parent||d.Container,t.construct),e},d.adopt=function(t){if(t.instance)return t.instance;var n;return n="svg"==t.nodeName?t.parentNode instanceof SVGElement?new d.Nested:new d.Doc:"lineairGradient"==t.nodeName?new d.Gradient("lineair"):"radialGradient"==t.nodeName?new d.Gradient("radial"):d[e(t.nodeName)]?new(d[e(t.nodeName)]):new d.Element(t),n.type=t.nodeName,n.node=t,t.instance=n,n instanceof d.Doc&&n.namespace().defs(),n},d.regex={unit:/^(-?[\d\.]+)([a-z%]{0,2})$/,hex:/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rgb:/rgb\((\d+),(\d+),(\d+)\)/,reference:/#([a-z0-9\-_]+)/i,isHex:/^#[a-f0-9]{3,6}$/i,isRgb:/^rgb\(/,isCss:/[^:]+:[^;]+;?/,isBlank:/^(\s+)?$/,isNumber:/^-?[\d\.]+$/,isPercent:/^-?[\d\.]+%$/,isImage:/\.(jpg|jpeg|png|gif)(\?[^=]+.*)?/i,isEvent:/^[\w]+:[\w]+$/},d.utils={map:function(t,e){var n,i=t.length,r=[];for(n=0;i>n;n++)r.push(e(t[n]));return r},radians:function(t){return t%360*Math.PI/180},degrees:function(t){return 180*t/Math.PI%360}},d.defaults={attrs:{"fill-opacity":1,"stroke-opacity":1,"stroke-width":0,"stroke-linejoin":"miter","stroke-linecap":"butt",fill:"#000000",stroke:"#000000",opacity:1,x:0,y:0,cx:0,cy:0,width:0,height:0,r:0,rx:0,ry:0,offset:0,"stop-opacity":1,"stop-color":"#000000","font-size":16,"font-family":"Helvetica, Arial, sans-serif","text-anchor":"start"}},d.Color=function(t){var e;this.r=0,this.g=0,this.b=0,"string"==typeof t?d.regex.isRgb.test(t)?(e=d.regex.rgb.exec(t.replace(/\s/g,"")),this.r=parseInt(e[1]),this.g=parseInt(e[2]),this.b=parseInt(e[3])):d.regex.isHex.test(t)&&(e=d.regex.hex.exec(n(t)),this.r=parseInt(e[1],16),this.g=parseInt(e[2],16),this.b=parseInt(e[3],16)):"object"==typeof t&&(this.r=t.r,this.g=t.g,this.b=t.b)},d.extend(d.Color,{toString:function(){return this.toHex()},toHex:function(){return"#"+i(this.r)+i(this.g)+i(this.b)},toRgb:function(){return"rgb("+[this.r,this.g,this.b].join()+")"},brightness:function(){return this.r/255*.3+this.g/255*.59+this.b/255*.11},morph:function(t){return this.destination=new d.Color(t),this},at:function(t){return this.destination?(t=0>t?0:t>1?1:t,new d.Color({r:~~(this.r+(this.destination.r-this.r)*t),g:~~(this.g+(this.destination.g-this.g)*t),b:~~(this.b+(this.destination.b-this.b)*t)})):this}}),d.Color.test=function(t){return t+="",d.regex.isHex.test(t)||d.regex.isRgb.test(t)},d.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},d.Color.isColor=function(t){return d.Color.isRgb(t)||d.Color.test(t)},d.Array=function(t,e){t=(t||[]).valueOf(),0==t.length&&e&&(t=e.valueOf()),this.value=this.parse(t)},d.extend(d.Array,{morph:function(t){if(this.destination=this.parse(t),this.value.length!=this.destination.length){for(var e=this.value[this.value.length-1],n=this.destination[this.destination.length-1];this.value.length>this.destination.length;)this.destination.push(n);for(;this.value.length<this.destination.length;)this.value.push(e)}return this},settle:function(){for(var t=0,e=this.value.length,n=[];e>t;t++)-1==n.indexOf(this.value[t])&&n.push(this.value[t]);return this.value=n},at:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];n>e;e++)i.push(this.value[e]+(this.destination[e]-this.value[e])*t);return new d.Array(i)},toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(t){return t=t.valueOf(),Array.isArray(t)?t:this.split(t)},split:function(t){return t.replace(/\s+/g," ").replace(/^\s+|\s+$/g,"").split(" ")},reverse:function(){return this.value.reverse(),this}}),d.PointArray=function(t,e){this.constructor.call(this,t,e||[[0,0]])},d.PointArray.prototype=new d.Array,d.extend(d.PointArray,{toString:function(){for(var t=0,e=this.value.length,n=[];e>t;t++)n.push(this.value[t].join(","));return n.join(" ")},toLine:function(){return{x1:this.value[0][0],y1:this.value[0][1],x2:this.value[1][0],y2:this.value[1][1]}},at:function(t){if(!this.destination)return this;for(var e=0,n=this.value.length,i=[];n>e;e++)i.push([this.value[e][0]+(this.destination[e][0]-this.value[e][0])*t,this.value[e][1]+(this.destination[e][1]-this.value[e][1])*t]);return new d.PointArray(i)},parse:function(t){if(t=t.valueOf(),Array.isArray(t))return t;t=this.split(t);for(var e,n=0,i=t.length,r=[];i>n;n++)e=t[n].split(","),r.push([parseFloat(e[0]),parseFloat(e[1])]);return r},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i=this.value.length-1;i>=0;i--)this.value[i]=[this.value[i][0]+t,this.value[i][1]+e];return this},size:function(t,e){var n,i=this.bbox();for(n=this.value.length-1;n>=0;n--)this.value[n][0]=(this.value[n][0]-i.x)*t/i.width+i.x,this.value[n][1]=(this.value[n][1]-i.y)*e/i.height+i.y;return this},bbox:function(){return d.parser.poly.setAttribute("points",this.toString()),d.parser.poly.getBBox()}}),d.PathArray=function(t,e){this.constructor.call(this,t,e||[["M",0,0]])},d.PathArray.prototype=new d.Array,d.extend(d.PathArray,{toString:function(){return a(this.value)},move:function(t,e){var n=this.bbox();if(t-=n.x,e-=n.y,!isNaN(t)&&!isNaN(e))for(var i,r=this.value.length-1;r>=0;r--)i=this.value[r][0],"M"==i||"L"==i||"T"==i?(this.value[r][1]+=t,this.value[r][2]+=e):"H"==i?this.value[r][1]+=t:"V"==i?this.value[r][1]+=e:"C"==i||"S"==i||"Q"==i?(this.value[r][1]+=t,this.value[r][2]+=e,this.value[r][3]+=t,this.value[r][4]+=e,"C"==i&&(this.value[r][5]+=t,this.value[r][6]+=e)):"A"==i&&(this.value[r][6]+=t,this.value[r][7]+=e);return this},size:function(t,e){var n,i,r=this.bbox();for(n=this.value.length-1;n>=0;n--)i=this.value[n][0],"M"==i||"L"==i||"T"==i?(this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x,this.value[n][2]=(this.value[n][2]-r.y)*e/r.height+r.y):"H"==i?this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x:"V"==i?this.value[n][1]=(this.value[n][1]-r.y)*e/r.height+r.y:"C"==i||"S"==i||"Q"==i?(this.value[n][1]=(this.value[n][1]-r.x)*t/r.width+r.x,this.value[n][2]=(this.value[n][2]-r.y)*e/r.height+r.y,this.value[n][3]=(this.value[n][3]-r.x)*t/r.width+r.x,this.value[n][4]=(this.value[n][4]-r.y)*e/r.height+r.y,"C"==i&&(this.value[n][5]=(this.value[n][5]-r.x)*t/r.width+r.x,this.value[n][6]=(this.value[n][6]-r.y)*e/r.height+r.y)):"A"==i&&(this.value[n][1]=this.value[n][1]*t/r.width,this.value[n][2]=this.value[n][2]*e/r.height,this.value[n][6]=(this.value[n][6]-r.x)*t/r.width+r.x,this.value[n][7]=(this.value[n][7]-r.y)*e/r.height+r.y);return this},parse:function(t){if(t instanceof d.PathArray)return t.valueOf();var e,n,i,r,s,h,o,u,l,c,f,p=0,m=0;for(d.parser.path.setAttribute("d","string"==typeof t?t:a(t)),f=d.parser.path.pathSegList,e=0,n=f.numberOfItems;n>e;++e)c=f.getItem(e),l=c.pathSegTypeAsLetter,"M"==l||"L"==l||"H"==l||"V"==l||"C"==l||"S"==l||"Q"==l||"T"==l||"A"==l?("x"in c&&(p=c.x),"y"in c&&(m=c.y)):("x1"in c&&(s=p+c.x1),"x2"in c&&(o=p+c.x2),"y1"in c&&(h=m+c.y1),"y2"in c&&(u=m+c.y2),"x"in c&&(p+=c.x),"y"in c&&(m+=c.y),"m"==l?f.replaceItem(d.parser.path.createSVGPathSegMovetoAbs(p,m),e):"l"==l?f.replaceItem(d.parser.path.createSVGPathSegLinetoAbs(p,m),e):"h"==l?f.replaceItem(d.parser.path.createSVGPathSegLinetoHorizontalAbs(p),e):"v"==l?f.replaceItem(d.parser.path.createSVGPathSegLinetoVerticalAbs(m),e):"c"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoCubicAbs(p,m,s,h,o,u),e):"s"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoCubicSmoothAbs(p,m,o,u),e):"q"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoQuadraticAbs(p,m,s,h),e):"t"==l?f.replaceItem(d.parser.path.createSVGPathSegCurvetoQuadraticSmoothAbs(p,m),e):"a"==l?f.replaceItem(d.parser.path.createSVGPathSegArcAbs(p,m,c.r1,c.r2,c.angle,c.largeArcFlag,c.sweepFlag),e):("z"==l||"Z"==l)&&(p=i,m=r)),("M"==l||"m"==l)&&(i=p,r=m);for(t=[],f=d.parser.path.pathSegList,e=0,n=f.numberOfItems;n>e;++e)c=f.getItem(e),l=c.pathSegTypeAsLetter,p=[l],"M"==l||"L"==l||"T"==l?p.push(c.x,c.y):"H"==l?p.push(c.x):"V"==l?p.push(c.y):"C"==l?p.push(c.x1,c.y1,c.x2,c.y2,c.x,c.y):"S"==l?p.push(c.x2,c.y2,c.x,c.y):"Q"==l?p.push(c.x1,c.y1,c.x,c.y):"A"==l&&p.push(c.r1,c.r2,c.angle,0|c.largeArcFlag,0|c.sweepFlag,c.x,c.y),t.push(p);return t},bbox:function(){return d.parser.path.setAttribute("d",this.toString()),d.parser.path.getBBox()}}),d.Number=function(t){if(this.value=0,this.unit="","number"==typeof t)this.value=isNaN(t)?0:isFinite(t)?t:0>t?-3.4e38:3.4e38;else if("string"==typeof t){var e=t.match(d.regex.unit);e&&(this.value=parseFloat(e[1]),"%"==e[2]?this.value/=100:"s"==e[2]&&(this.value*=1e3),this.unit=e[2])}else t instanceof d.Number&&(this.value=t.value,this.unit=t.unit)},d.extend(d.Number,{toString:function(){return("%"==this.unit?~~(1e8*this.value)/1e6:"s"==this.unit?this.value/1e3:this.value)+this.unit},valueOf:function(){return this.value},plus:function(t){return this.value=this+new d.Number(t),this},minus:function(t){return this.plus(-new d.Number(t))},times:function(t){return this.value=this*new d.Number(t),this},divide:function(t){return this.value=this/new d.Number(t),this},to:function(t){return"string"==typeof t&&(this.unit=t),this},morph:function(t){return this.destination=new d.Number(t),this},at:function(t){return this.destination?new d.Number(this.destination).minus(this).times(t).plus(this):this}}),d.ViewBox=function(t){var e,n,i,r,s=1,h=1,o=t.bbox(),a=(t.attr("viewBox")||"").match(/-?[\d\.]+/g),u=t,l=t;for(i=new d.Number(t.width()),r=new d.Number(t.height());"%"==i.unit;)s*=i.value,i=new d.Number(u instanceof d.Doc?u.parent().offsetWidth:u.parent().width()),u=u.parent();for(;"%"==r.unit;)h*=r.value,r=new d.Number(l instanceof d.Doc?l.parent().offsetHeight:l.parent().height()),l=l.parent();this.x=o.x,this.y=o.y,this.width=i*s,this.height=r*h,this.zoom=1,a&&(e=parseFloat(a[0]),n=parseFloat(a[1]),i=parseFloat(a[2]),r=parseFloat(a[3]),this.zoom=this.width/this.height>i/r?this.height/r:this.width/i,this.x=e,this.y=n,this.width=i,this.height=r)},d.extend(d.ViewBox,{toString:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}}),d.Element=d.invent({create:function(t){this._stroke=d.defaults.attrs.stroke,(this.node=t)&&(this.type=t.nodeName,this.node.instance=this,this._stroke=t.getAttribute("stroke")||this._stroke)},extend:{x:function(t){return null!=t&&(t=new d.Number(t),t.value/=this.transform("scaleX")),this.attr("x",t)},y:function(t){return null!=t&&(t=new d.Number(t),t.value/=this.transform("scaleY")),this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var n=r(this.bbox(),t,e);return this.width(new d.Number(n.width)).height(new d.Number(n.height))},clone:function(){return u(this.node.cloneNode(!0))},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(t){return this.after(t).remove(),t},addTo:function(t){return t.put(this)},putIn:function(t){return t.add(this)},id:function(t){return this.attr("id",t)},inside:function(t,e){var n=this.bbox();return t>n.x&&e>n.y&&t<n.x+n.width&&e<n.y+n.height},show:function(){return this.style("display","")},hide:function(){return this.style("display","none")},visible:function(){return"none"!=this.style("display")},toString:function(){return this.attr("id")},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(/\s+/)},hasClass:function(t){return-1!=this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter(function(e){return e!=t}).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return d.get(this.attr(t))},parent:function(t){var e=d.adopt(this.node.parentNode);if(t)for(;!(e instanceof t);)e=d.adopt(e.node.parentNode);return e},doc:function(t){return this.parent(t||d.Doc)},"native":function(){return this.node}}}),d.BBox=d.invent({create:function(t){var e;if(this.x=0,this.y=0,this.width=0,this.height=0,t){var n=new d.Matrix(t).extract();e=t.node.getBBox?t.node.getBBox():{x:t.node.clientLeft,y:t.node.clientTop,width:t.node.clientWidth,height:t.node.clientHeight},this.x=e.x+n.x,this.y=e.y+n.y,this.width=e.width*n.scaleX,this.height=e.height*n.scaleY}l(this)},parent:d.Element,construct:{bbox:function(){return new d.BBox(this)}}}),d.RBox=d.invent({create:function(t){var e={};if(this.x=0,this.y=0,this.width=0,this.height=0,t){var n=t.doc().parent(),i=1;for(e=t.node.getBoundingClientRect(),this.x=e.left,this.y=e.top,this.x-=n.offsetLeft,this.y-=n.offsetTop;n=n.offsetParent;)this.x-=n.offsetLeft,this.y-=n.offsetTop;for(n=t;n.parent&&(n=n.parent());)n.viewbox&&(i*=n.viewbox().zoom,this.x-=n.x()||0,this.y-=n.y()||0)}this.width=e.width/=i,this.height=e.height/=i,this.x+=window.scrollX,this.y+=window.scrollY,l(this)},parent:d.Element,construct:{rbox:function(){return new d.RBox(this)}}}),[d.BBox,d.RBox].forEach(function(t){d.extend(t,{merge:function(e){var n=new t;return n.x=Math.min(this.x,e.x),n.y=Math.min(this.y,e.y),n.width=Math.max(this.x+this.width,e.x+e.width)-n.x,n.height=Math.max(this.y+this.height,e.y+e.height)-n.y,l(n)}})}),d.Matrix=d.invent({create:function(t){var e,n=h([1,0,0,1,0,0]);for(t=t&&t.node&&t.node.getCTM?t.node.getCTM():"string"==typeof t?h(t.replace(/\s/g,"").split(",")):6==arguments.length?h([].slice.call(arguments)):"object"==typeof t?t:n,e=m.length-1;e>=0;e--)this[m[e]]="number"==typeof t[m[e]]?t[m[e]]:n[m[e]]},extend:{extract:function(){var t=s(this,0,1),e=s(this,1,0),n=180/Math.PI*Math.atan2(t.y,t.x)-90;return{x:this.e,y:this.f,skewX:n,skewY:180/Math.PI*Math.atan2(e.y,e.x),scaleX:Math.sqrt(this.a*this.a+this.b*this.b),scaleY:Math.sqrt(this.c*this.c+this.d*this.d),rotation:n}},multiply:function(t){return new d.Matrix(this.native().multiply(t.native()))},inverse:function(){return new d.Matrix(this.native().inverse())},translate:function(t,e){return new d.Matrix(this.native().translate(t||0,e||0))},scale:function(t,e,n,i){return(1==arguments.length||3==arguments.length)&&(e=t),3==arguments.length&&(i=n,n=e),this.multiply(new d.Matrix(1,0,0,1,n||0,i||0)).multiply(new d.Matrix(t,0,0,e,0,0)).multiply(new d.Matrix(1,0,0,1,-n||0,-i||0))},rotate:function(t,e,n){return t=d.utils.radians(t),this.multiply(new d.Matrix(1,0,0,1,e||0,n||0)).multiply(new d.Matrix(Math.cos(t),Math.sin(t),-Math.sin(t),Math.cos(t),0,0)).multiply(new d.Matrix(1,0,0,1,-e||0,-n||0))},flip:function(t){return new d.Matrix(this.native()["flip"+t.toUpperCase()]())},skew:function(t,e){return new d.Matrix(this.native().skewX(t||0).skewY(e||0))},"native":function(){var t,e=d.parser.draw.node.createSVGMatrix();for(t=m.length-1;t>=0;t--)e[m[t]]=this[m[t]];return e},toString:function(){return"matrix("+[this.a,this.b,this.c,this.d,this.e,this.f].join()+")"}},parent:d.Element,construct:{ctm:function(){return new d.Matrix(this)}}}),d.extend(d.Element,{attr:function(t,e,n){if(null==t){for(t={},e=this.node.attributes,n=e.length-1;n>=0;n--)t[e[n].nodeName]=d.regex.isNumber.test(e[n].nodeValue)?parseFloat(e[n].nodeValue):e[n].nodeValue;return t}if("object"==typeof t)for(e in t)this.attr(e,t[e]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return e=this.node.getAttribute(t),null==e?d.defaults.attrs[t]:d.regex.isNumber.test(e)?parseFloat(e):e;"stroke-width"==t?this.attr("stroke",parseFloat(e)>0?this._stroke:null):"stroke"==t&&(this._stroke=e),("fill"==t||"stroke"==t)&&(d.regex.isImage.test(e)&&(e=this.doc().defs().image(e,0,0)),e instanceof d.Image&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new d.Number(e):d.Color.isColor(e)?e=new d.Color(e):Array.isArray(e)&&(e=new d.Array(e)),"leading"==t?this.leading&&this.leading(e):"string"==typeof n?this.node.setAttributeNS(n,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!=t&&"x"!=t||this.rebuild(t,e)}return this}}),d.extend(d.Element,{transform:function(t){if(null==t)return this.ctm().extract();if("string"==typeof t)return this.ctm().extract()[t];var e=new d.Matrix(this);return null!=t.a?e=e.multiply(new d.Matrix(t)):t.rotation?e=e.rotate(t.rotation,null==t.cx?this.bbox().cx:t.cx,null==t.cy?this.bbox().cy:t.cy):null!=t.scale||null!=t.scaleX||null!=t.scaleY?e=e.scale(null!=t.scale?t.scale:null!=t.scaleX?t.scaleX:1,null!=t.scale?t.scale:null!=t.scaleY?t.scaleY:1,null!=t.cx?t.cx:this.bbox().x,null!=t.cy?t.cy:this.bbox().y):t.skewX||t.skewY?e=e.skew(t.skewX,t.skewY):(t.x||t.y)&&(e=e.translate(t.x,t.y)),this.attr("transform",e)},untransform:function(){return this.attr("transform",null)}}),d.extend(d.Element,{style:function(e,n){if(0==arguments.length)return this.node.style.cssText||"";if(arguments.length<2)if("object"==typeof e)for(n in e)this.style(n,e[n]);else{if(!d.regex.isCss.test(e))return this.node.style[t(e)];e=e.split(";");for(var i=0;i<e.length;i++)n=e[i].split(":"),this.style(n[0].replace(/\s+/g,""),n[1])}else this.node.style[t(e)]=null===n||d.regex.isBlank.test(n)?"":n;return this}}),d.Parent=d.invent({create:function(t){this.constructor.call(this,t)},inherit:d.Element,extend:{children:function(){return d.utils.map(this.node.childNodes,function(t){return d.adopt(t)})},add:function(t,e){return this.has(t)||(e=null==e?this.children().length:e,this.node.insertBefore(t.node,this.node.childNodes[e]||null)),this},put:function(t,e){return this.add(t,e),t},has:function(t){return this.index(t)>=0},index:function(t){return this.children().indexOf(t)},get:function(t){return this.children()[t]},first:function(){return this.children()[0]},last:function(){return this.children()[this.children().length-1]},each:function(t,e){var n,i,r=this.children();for(n=0,i=r.length;i>n;n++)r[n]instanceof d.Element&&t.apply(r[n],[n,r]),e&&r[n]instanceof d.Container&&r[n].each(t,e);return this},removeElement:function(t){return this.node.removeChild(t.node),this},clear:function(){for(;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);return delete this._defs,this},defs:function(){return this.doc().defs()}}}),d.Container=d.invent({create:function(t){this.constructor.call(this,t)},inherit:d.Parent,extend:{viewbox:function(t){return 0==arguments.length?new d.ViewBox(this):(t=1==arguments.length?[t.x,t.y,t.width,t.height]:[].slice.call(arguments),this.attr("viewBox",t))}}}),d.extend(d.Parent,d.Text,{svg:function(t){var e=document.createElement("div");if(t){t=t.replace(/\n/,"").replace(/<(\w+)([^<]+?)\/>/g,"<$1$2></$1>"),e.innerHTML="<svg>"+t+"</svg>";for(var n=e.firstChild.childNodes.length-1;n>=0;n--)1==e.firstChild.childNodes[n].nodeType&&this.node.appendChild(e.firstChild.childNodes[n]);return this}var i=this.node.cloneNode(!0);return e.appendChild(i),e.innerHTML}}),d.FX=d.invent({create:function(t){this.target=t},extend:{animate:function(t,e,n){var i,r,s,h,a=this.target,u=this;return"object"==typeof t&&(n=t.delay,e=t.ease,t=t.duration),t="="==t?t:null==t?1e3:new d.Number(t).valueOf(),e=e||"<>",u.to=function(t){var n;if(t=0>t?0:t>1?1:t,null==i){i=[];for(h in u.attrs)i.push(h);if(a.morphArray&&(u._plot||i.indexOf("points")>-1)){var l,c=new a.morphArray(u._plot||u.attrs.points||a.array);u._size&&c.size(u._size.width.to,u._size.height.to),l=c.bbox(),u._x?c.move(u._x.to,l.y):u._cx&&c.move(u._cx.to-l.width/2,l.y),l=c.bbox(),u._y?c.move(l.x,u._y.to):u._cy&&c.move(l.x,u._cy.to-l.height/2),delete u._x,delete u._y,delete u._cx,delete u._cy,delete u._size,u._plot=a.array.morph(c)}}if(null==r){r=[];for(h in u.trans)r.push(h)}if(null==s){s=[];for(h in u.styles)s.push(h)}for(t="<>"==e?-Math.cos(t*Math.PI)/2+.5:">"==e?Math.sin(t*Math.PI/2):"<"==e?-Math.cos(t*Math.PI/2)+1:"-"==e?t:"function"==typeof e?e(t):t,u._plot?a.plot(u._plot.at(t)):(u._x?a.x(u._x.at(t)):u._cx&&a.cx(u._cx.at(t)),u._y?a.y(u._y.at(t)):u._cy&&a.cy(u._cy.at(t)),u._size&&a.size(u._size.width.at(t),u._size.height.at(t))),u._viewbox&&a.viewbox(u._viewbox.x.at(t),u._viewbox.y.at(t),u._viewbox.width.at(t),u._viewbox.height.at(t)),u._leading&&a.leading(u._leading.at(t)),n=i.length-1;n>=0;n--)a.attr(i[n],o(u.attrs[i[n]],t));for(n=r.length-1;n>=0;n--)a.transform(r[n],o(u.trans[r[n]],t));for(n=s.length-1;n>=0;n--)a.style(s[n],o(u.styles[s[n]],t));u._during&&u._during.call(a,t,function(e,n){return o({from:e,to:n},t)})},"number"==typeof t&&(this.timeout=setTimeout(function(){var i=(new Date).getTime();u.situation={interval:1e3/60,start:i,play:!0,finish:i+t,duration:t},u.render=function(){if(u.situation.play===!0){var i=(new Date).getTime(),r=i>u.situation.finish?1:(i-u.situation.start)/t;u.to(r),i>u.situation.finish?(u._plot&&a.plot(new d.PointArray(u._plot.destination).settle()),u._loop===!0||"number"==typeof u._loop&&u._loop>1?("number"==typeof u._loop&&--u._loop,u.animate(t,e,n)):u._after?u._after.apply(a,[u]):u.stop()):requestAnimFrame(u.render)}else requestAnimFrame(u.render)},u.render()},new d.Number(n).valueOf())),this},bbox:function(){return this.target.bbox()},attr:function(t,e){if("object"==typeof t)for(var n in t)this.attr(n,t[n]);else{var i=this.target.attr(t);this.attrs[t]=d.Color.isColor(i)?new d.Color(i).morph(e):d.regex.unit.test(i)?new d.Number(i).morph(e):{from:i,to:e}}return this},transform:function(){},style:function(t,e){if("object"==typeof t)for(var n in t)this.style(n,t[n]);else this.styles[t]={from:this.target.style(t),to:e};return this},x:function(t){return this._x=new d.Number(this.target.x()).morph(t),this},y:function(t){return this._y=new d.Number(this.target.y()).morph(t),this},cx:function(t){return this._cx=new d.Number(this.target.cx()).morph(t),this},cy:function(t){return this._cy=new d.Number(this.target.cy()).morph(t),this},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},size:function(t,e){if(this.target instanceof d.Text)this.attr("font-size",t);else{var n=this.target.bbox();this._size={width:new d.Number(n.width).morph(t),height:new d.Number(n.height).morph(e)}}return this},plot:function(t){return this._plot=t,this},leading:function(t){return this.target._leading&&(this._leading=new d.Number(this.target._leading).morph(t)),this},viewbox:function(t,e,n,i){if(this.target instanceof d.Container){var r=this.target.viewbox();this._viewbox={x:new d.Number(r.x).morph(t),y:new d.Number(r.y).morph(e),width:new d.Number(r.width).morph(n),height:new d.Number(r.height).morph(i)}}return this},update:function(t){return this.target instanceof d.Stop&&(null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new d.Number(t.offset))),this},during:function(t){return this._during=t,this},after:function(t){return this._after=t,this},loop:function(t){return this._loop=t||!0,this},stop:function(t){return t===!0?(this.animate(0),this._after&&this._after.apply(this.target,[this])):(clearTimeout(this.timeout),this.attrs={},this.trans={},this.styles={},this.situation={},delete this._x,delete this._y,delete this._cx,delete this._cy,delete this._size,delete this._plot,delete this._loop,delete this._after,delete this._during,delete this._leading,delete this._viewbox),this},pause:function(){return this.situation.play===!0&&(this.situation.play=!1,this.situation.pause=(new Date).getTime()),this},play:function(){if(this.situation.play===!1){var t=(new Date).getTime()-this.situation.pause;this.situation.finish+=t,this.situation.start+=t,this.situation.play=!0}return this}},parent:d.Element,construct:{animate:function(t,e,n){return(this.fx||(this.fx=new d.FX(this))).stop().animate(t,e,n)},stop:function(t){return this.fx&&this.fx.stop(t),this},pause:function(){return this.fx&&this.fx.pause(),this},play:function(){return this.fx&&this.fx.play(),this}}}),d.extend(d.Element,d.FX,{dx:function(t){return this.x((this.target||this).x()+t)},dy:function(t){return this.y((this.target||this).y()+t)},dmove:function(t,e){return this.dx(t).dy(e)}}),["click","dblclick","mousedown","mouseup","mouseover","mouseout","mousemove","mouseenter","mouseleave","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(t){d.Element.prototype[t]=function(e){var n=this;return this.node["on"+t]="function"==typeof e?function(){return e.apply(n,arguments)}:null,this}}),d.events={},d.listeners={},d.registerEvent=function(t){d.events[t]||(d.events[t]=new f(t))},d.on=function(t,e,n){var i=n.bind(t.instance||t);d.listeners[n]=i,t.addEventListener(e,i,!1)},d.off=function(t,e,n){t.removeEventListener(e,d.listeners[n],!1),delete d.listeners[n]},d.extend(d.Element,{on:function(t,e){return d.on(this.node,t,e),this},off:function(t,e){return d.off(this.node,t,e),this},fire:function(t,e){return d.events[t].detail=e,this.node.dispatchEvent(d.events[t]),delete d.events[t].detail,this}}),d.Defs=d.invent({create:"defs",inherit:d.Container}),d.G=d.invent({create:"g",inherit:d.Container,extend:{x:function(t){return this.transform(null==t?"x":{x:-this.x()+t})},y:function(t){return this.transform(null==t?"y":{y:-this.y()+t})},cx:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)},cy:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)}},construct:{group:function(){return this.put(new d.G)}}}),d.extend(d.Element,{siblings:function(){return this.parent().children()},position:function(){return this.parent().index(this)},next:function(){return this.siblings()[this.position()+1]},previous:function(){return this.siblings()[this.position()-1]},forward:function(){var t=this.position()+1,e=this.parent();return e.removeElement(this).add(this,t),e instanceof d.Doc&&e.node.appendChild(e.defs().node),this},backward:function(){var t=this.position();return t>0&&this.parent().removeElement(this).add(this,t-1),this},front:function(){var t=this.parent();return t.node.appendChild(this.node),t instanceof d.Doc&&t.node.appendChild(t.defs().node),this},back:function(){return this.position()>0&&this.parent().removeElement(this).add(this,0),this},before:function(t){t.remove();var e=this.position();return this.parent().add(t,e),this},after:function(t){t.remove();var e=this.position();return this.parent().add(t,e+1),this}}),d.Mask=d.invent({create:function(){this.constructor.call(this,d.create("mask")),this.targets=[]},inherit:d.Container,extend:{remove:function(){for(var t=this.targets.length-1;t>=0;t--)this.targets[t]&&this.targets[t].unmask();return delete this.targets,this.parent().removeElement(this),this}},construct:{mask:function(){return this.defs().put(new d.Mask)}}}),d.extend(d.Element,{maskWith:function(t){return this.masker=t instanceof d.Mask?t:this.parent().mask().add(t),this.masker.targets.push(this),this.attr("mask",'url("#'+this.masker.attr("id")+'")')},unmask:function(){return delete this.masker,this.attr("mask",null)}}),d.ClipPath=d.invent({create:function(){this.constructor.call(this,d.create("clipPath")),this.targets=[]},inherit:d.Container,extend:{remove:function(){for(var t=this.targets.length-1;t>=0;t--)this.targets[t]&&this.targets[t].unclip();return delete this.targets,this.parent().removeElement(this),this}},construct:{clip:function(){return this.defs().put(new d.ClipPath)}}}),d.extend(d.Element,{clipWith:function(t){return this.clipper=t instanceof d.ClipPath?t:this.parent().clip().add(t),this.clipper.targets.push(this),this.attr("clip-path",'url("#'+this.clipper.attr("id")+'")')},unclip:function(){return delete this.clipper,this.attr("clip-path",null)}}),d.Gradient=d.invent({create:function(t){this.constructor.call(this,d.create(t+"Gradient")),this.type=t},inherit:d.Container,extend:{from:function(t,e){return this.attr("radial"==this.type?{fx:new d.Number(t),fy:new d.Number(e)}:{x1:new d.Number(t),y1:new d.Number(e)})},to:function(t,e){return this.attr("radial"==this.type?{cx:new d.Number(t),cy:new d.Number(e)}:{x2:new d.Number(t),y2:new d.Number(e)})},radius:function(t){return"radial"==this.type?this.attr({r:new d.Number(t)}):this},at:function(t,e,n){return this.put(new d.Stop).update(t,e,n)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},fill:function(){return"url(#"+this.id()+")"},toString:function(){return this.fill()}},construct:{gradient:function(t,e){return this.defs().gradient(t,e)}}}),d.extend(d.Defs,{gradient:function(t,e){return this.put(new d.Gradient(t)).update(e)}}),d.Stop=d.invent({create:"stop",inherit:d.Element,extend:{update:function(t){return("number"==typeof t||t instanceof d.Number)&&(t={offset:arguments[0],color:arguments[1],opacity:arguments[2]}),null!=t.opacity&&this.attr("stop-opacity",t.opacity),null!=t.color&&this.attr("stop-color",t.color),null!=t.offset&&this.attr("offset",new d.Number(t.offset)),this}}}),d.Pattern=d.invent({create:"pattern",inherit:d.Container,extend:{fill:function(){return"url(#"+this.id()+")"},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return this.fill()}},construct:{pattern:function(t,e,n){return this.defs().pattern(t,e,n)}}}),d.extend(d.Defs,{pattern:function(t,e,n){return this.put(new d.Pattern).update(n).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}),d.Doc=d.invent({create:function(t){t&&(t="string"==typeof t?document.getElementById(t):t,"svg"==t.nodeName?this.constructor.call(this,t):(this.constructor.call(this,d.create("svg")),t.appendChild(this.node)),this.namespace().size("100%","100%").defs())
+},inherit:d.Container,extend:{namespace:function(){return this.attr({xmlns:d.ns,version:"1.1"}).attr("xmlns:xlink",d.xlink,d.xmlns)},defs:function(){if(!this._defs){var t;this._defs=(t=this.node.getElementsByTagName("defs")[0])?d.adopt(t):new d.Defs,this.node.appendChild(this._defs.node)}return this._defs},parent:function(){return"#document"==this.node.parentNode.nodeName?null:this.node.parentNode}}}),d.extend(d.Doc,{spof:function(){if(this.doSpof){var t=this.node.getScreenCTM();t&&this.style("left",-t.e%1+"px").style("top",-t.f%1+"px")}return this},fixSubPixelOffset:function(){var t=this;return this.doSpof=!0,d.on(window,"resize",function(){t.spof()}),this.spof()}}),d.Shape=d.invent({create:function(t){this.constructor.call(this,t)},inherit:d.Element}),d.Symbol=d.invent({create:"symbol",inherit:d.Container,construct:{symbol:function(){return this.defs().put(new d.Symbol)}}}),d.Use=d.invent({create:"use",inherit:d.Shape,extend:{element:function(t){return this.target=t,this.attr("href","#"+t,d.xlink)}},construct:{use:function(t){return this.put(new d.Use).element(t)}}}),d.Rect=d.invent({create:"rect",inherit:d.Shape,construct:{rect:function(t,e){return this.put((new d.Rect).size(t,e))}}}),d.Circle=d.invent({create:"circle",inherit:d.Shape,construct:{circle:function(t){return this.put(new d.Circle).rx(new d.Number(t).divide(2)).move(0,0)}}}),d.extend(d.Circle,d.FX,{rx:function(t){return this.attr("r",t)},ry:function(t){return this.rx(t)}}),d.Ellipse=d.invent({create:"ellipse",inherit:d.Shape,construct:{ellipse:function(t,e){return this.put(new d.Ellipse).size(t,e).move(0,0)}}}),d.extend(d.Ellipse,d.Rect,d.FX,{rx:function(t){return this.attr("rx",t)},ry:function(t){return this.attr("ry",t)}}),d.extend(d.Circle,d.Ellipse,{x:function(t){return null==t?this.cx()-this.rx():this.cx(t+this.rx())},y:function(t){return null==t?this.cy()-this.ry():this.cy(t+this.ry())},cx:function(t){return null==t?this.attr("cx"):this.attr("cx",new d.Number(t).divide(this.transform("scaleX")))},cy:function(t){return null==t?this.attr("cy"):this.attr("cy",new d.Number(t).divide(this.transform("scaleY")))},width:function(t){return null==t?2*this.rx():this.rx(new d.Number(t).divide(2))},height:function(t){return null==t?2*this.ry():this.ry(new d.Number(t).divide(2))},size:function(t,e){var n=r(this.bbox(),t,e);return this.rx(new d.Number(n.width).divide(2)).ry(new d.Number(n.height).divide(2))}}),d.Line=d.invent({create:"line",inherit:d.Shape,extend:{array:function(){return new d.PointArray([[this.attr("x1"),this.attr("y1")],[this.attr("x2"),this.attr("y2")]])},plot:function(t,e,n,i){return t=4==arguments.length?{x1:t,y1:e,x2:n,y2:i}:new d.PointArray(t).toLine(),this.attr(t)},move:function(t,e){return this.attr(this.array().move(t,e).toLine())},size:function(t,e){var n=r(this.bbox(),t,e);return this.attr(this.array().size(n.width,n.height).toLine())}},construct:{line:function(t,e,n,i){return this.put(new d.Line).plot(t,e,n,i)}}}),d.Polyline=d.invent({create:"polyline",inherit:d.Shape,construct:{polyline:function(t){return this.put(new d.Polyline).plot(t)}}}),d.Polygon=d.invent({create:"polygon",inherit:d.Shape,construct:{polygon:function(t){return this.put(new d.Polygon).plot(t)}}}),d.extend(d.Polyline,d.Polygon,{array:function(){return this._array||(this._array=new d.PointArray(this.attr("points")))},plot:function(t){return this.attr("points",this._array=new d.PointArray(t))},move:function(t,e){return this.attr("points",this.array().move(t,e))},size:function(t,e){var n=r(this.bbox(),t,e);return this.attr("points",this.array().size(n.width,n.height))}}),d.extend(d.Line,d.Polyline,d.Polygon,{morphArray:d.PointArray,x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},width:function(t){var e=this.bbox();return null==t?e.width:this.size(t,e.height)},height:function(t){var e=this.bbox();return null==t?e.height:this.size(e.width,t)}}),d.Path=d.invent({create:"path",inherit:d.Shape,extend:{morphArray:d.PathArray,array:function(){return this._array||(this._array=new d.PathArray(this.attr("d")))},plot:function(t){return this.attr("d",this._array=new d.PathArray(t))},move:function(t,e){return this.attr("d",this.array().move(t,e))},x:function(t){return null==t?this.bbox().x:this.move(t,this.bbox().y)},y:function(t){return null==t?this.bbox().y:this.move(this.bbox().x,t)},size:function(t,e){var n=r(this.bbox(),t,e);return this.attr("d",this.array().size(n.width,n.height))},width:function(t){return null==t?this.bbox().width:this.size(t,this.bbox().height)},height:function(t){return null==t?this.bbox().height:this.size(this.bbox().width,t)}},construct:{path:function(t){return this.put(new d.Path).plot(t)}}}),d.Image=d.invent({create:"image",inherit:d.Shape,extend:{load:function(t){if(!t)return this;var e=this,n=document.createElement("img");return n.onload=function(){var i=e.doc(d.Pattern);0==e.width()&&0==e.height()&&e.size(n.width,n.height),i&&0==i.width()&&0==i.height()&&i.size(e.width(),e.height()),"function"==typeof e._loaded&&e._loaded.call(e,{width:n.width,height:n.height,ratio:n.width/n.height,url:t})},this.attr("href",n.src=this.src=t,d.xlink)},loaded:function(t){return this._loaded=t,this}},construct:{image:function(t,e,n){return this.put(new d.Image).load(t).size(e||0,n||e||0)}}}),d.Text=d.invent({create:function(){this.constructor.call(this,d.create("text")),this._leading=new d.Number(1.3),this._rebuild=!0,this._build=!1,this.attr("font-family",d.defaults.attrs["font-family"])},inherit:d.Shape,extend:{x:function(t){return null==t?this.attr("x"):(this.textPath||this.lines.each(function(){this.newLined&&this.x(t)}),this.attr("x",t))},y:function(t){var e=this.attr("y"),n="number"==typeof e?e-this.bbox().y:0;return null==t?"number"==typeof e?e-n:e:this.attr("y","number"==typeof t?t+n:t)},cx:function(t){return null==t?this.bbox().cx:this.x(t-this.bbox().width/2)},cy:function(t){return null==t?this.bbox().cy:this.y(t-this.bbox().height/2)},text:function(t){if("undefined"==typeof t)return this.content;if(this.clear().build(!0),"function"==typeof t)t.call(this,this);else{t=(this.content=t).split("\n");for(var e=0,n=t.length;n>e;e++)this.tspan(t[e]).newLine()}return this.build(!1).rebuild()},size:function(t){return this.attr("font-size",t).rebuild()},leading:function(t){return null==t?this._leading:(this._leading=new d.Number(t),this.rebuild())},rebuild:function(t){if("boolean"==typeof t&&(this._rebuild=t),this._rebuild){var e=this;this.lines.each(function(){this.newLined&&(this.textPath||this.attr("x",e.attr("x")),this.attr("dy",e._leading*new d.Number(e.attr("font-size"))))}),this.fire("rebuild")}return this},build:function(t){return this._build=!!t,this}},construct:{text:function(t){return this.put(new d.Text).text(t)},plain:function(t){return this.put(new d.Text).plain(t)}}}),d.Tspan=d.invent({create:"tspan",inherit:d.Shape,extend:{text:function(t){return"function"==typeof t?t.call(this,this):this.plain(t),this},dx:function(t){return this.attr("dx",t)},dy:function(t){return this.attr("dy",t)},newLine:function(){var t=this.doc(d.Text);return this.newLined=!0,this.dy(t._leading*t.attr("font-size")).attr("x",t.x())}}}),d.extend(d.Text,d.Tspan,{plain:function(t){return this._build===!1&&this.clear(),this.node.appendChild(document.createTextNode(this.content=t)),this},tspan:function(t){var e=(this.textPath||this).node,n=new d.Tspan;return this._build===!1&&this.clear(),e.appendChild(n.node),this instanceof d.Text&&this.lines.add(n),n.text(t)},clear:function(){for(var t=(this.textPath||this).node;t.hasChildNodes();)t.removeChild(t.lastChild);return this instanceof d.Text&&(delete this.lines,this.lines=new d.Set,this.content=""),this},length:function(){return this.node.getComputedTextLength()}}),d.registerEvent("rebuild"),d.TextPath=d.invent({create:"textPath",inherit:d.Element,parent:d.Text,construct:{path:function(t){for(this.textPath=new d.TextPath;this.node.hasChildNodes();)this.textPath.node.appendChild(this.node.firstChild);return this.node.appendChild(this.textPath.node),this.track=this.doc().defs().path(t),this.textPath.parent=this,this.textPath.attr("href","#"+this.track,d.xlink),this},plot:function(t){return this.track&&this.track.plot(t),this}}}),d.Nested=d.invent({create:function(){this.constructor.call(this,d.create("svg")),this.style("overflow","visible")},inherit:d.Container,construct:{nested:function(){return this.put(new d.Nested)}}}),d.A=d.invent({create:"a",inherit:d.Container,extend:{to:function(t){return this.attr("href",t,d.xlink)},show:function(t){return this.attr("show",t,d.xlink)},target:function(t){return this.attr("target",t)}},construct:{link:function(t){return this.put(new d.A).to(t)}}}),d.extend(d.Element,{linkTo:function(t){var e=new d.A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent().put(e).put(this)}}),d.Marker=d.invent({create:"marker",inherit:d.Container,extend:{width:function(t){return this.attr("markerWidth",t)},height:function(t){return this.attr("markerHeight",t)},ref:function(t,e){return this.attr("refX",t).attr("refY",e)},update:function(t){return this.clear(),"function"==typeof t&&t.call(this,this),this},toString:function(){return"url(#"+this.id()+")"}},construct:{marker:function(t,e,n){return this.defs().marker(t,e,n)}}}),d.extend(d.Defs,{marker:function(t,e,n){return this.put(new d.Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(n)}}),d.extend(d.Line,d.Polyline,d.Polygon,d.Path,{marker:function(t,e,n,i){var r=["marker"];return"all"!=t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof d.Marker?arguments[1]:this.doc().marker(e,n,i),this.attr(r,t)}});var p={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"==e?t:t+"-"+e}};["fill","stroke"].forEach(function(t){var e,n={};n[t]=function(n){if("string"==typeof n||d.Color.isRgb(n)||n&&"function"==typeof n.fill)this.attr(t,n);else for(e=p[t].length-1;e>=0;e--)null!=n[p[t][e]]&&this.attr(p.prefix(t,p[t][e]),n[p[t][e]]);return this},d.extend(d.Element,d.FX,n)}),d.extend(d.Element,d.FX,{rotate:function(t,e,n){return this.transform({rotation:t,cx:e,cy:n})},skew:function(t,e){return this.transform({skewX:t,skewY:e})},scale:function(t,e,n,i){return this.transform(1==arguments.length||3==arguments.length?{scale:t,cx:e,cy:n}:{scaleX:t,scaleY:e,cx:n,cy:i})},translate:function(t,e){return this.transform({x:t,y:e})},matrix:function(t){return this.attr("transform",new d.Matrix(t))},opacity:function(t){return this.attr("opacity",t)}}),d.extend(d.Rect,d.Ellipse,d.Circle,d.FX,{radius:function(t,e){return this.rx(t).ry(null==e?t:e)}}),d.extend(d.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return this.node.getPointAtLength(t)}}),d.extend(d.Parent,d.Text,d.FX,{font:function(t){for(var e in t)"leading"==e?this.leading(t[e]):"anchor"==e?this.attr("text-anchor",t[e]):"size"==e||"family"==e||"weight"==e||"stretch"==e||"variant"==e||"style"==e?this.attr("font-"+e,t[e]):this.attr(e,t[e]);return this}}),d.Set=d.invent({create:function(t){Array.isArray(t)?this.members=t:this.clear()},extend:{add:function(){var t,e,n=[].slice.call(arguments);for(t=0,e=n.length;e>t;t++)this.members.push(n[t]);return this},remove:function(t){var e=this.index(t);return e>-1&&this.members.splice(e,1),this},each:function(t){for(var e=0,n=this.members.length;n>e;e++)t.apply(this.members[e],[e,this.members]);return this},clear:function(){return this.members=[],this},has:function(t){return this.index(t)>=0},index:function(t){return this.members.indexOf(t)},get:function(t){return this.members[t]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members},bbox:function(){var t=new d.BBox;if(0==this.members.length)return t;var e=this.members[0].rbox();return t.x=e.x,t.y=e.y,t.width=e.width,t.height=e.height,this.each(function(){t=t.merge(this.rbox())}),t}},construct:{set:function(t){return new d.Set(t)}}}),d.SetFX=d.invent({create:function(t){this.set=t}}),d.Set.inherit=function(){var t,e=[];for(var t in d.Shape.prototype)"function"==typeof d.Shape.prototype[t]&&"function"!=typeof d.Set.prototype[t]&&e.push(t);e.forEach(function(t){d.Set.prototype[t]=function(){for(var e=0,n=this.members.length;n>e;e++)this.members[e]&&"function"==typeof this.members[e][t]&&this.members[e][t].apply(this.members[e],arguments);return"animate"==t?this.fx||(this.fx=new d.SetFX(this)):this}}),e=[];for(var t in d.FX.prototype)"function"==typeof d.FX.prototype[t]&&"function"!=typeof d.SetFX.prototype[t]&&e.push(t);e.forEach(function(t){d.SetFX.prototype[t]=function(){for(var e=0,n=this.set.members.length;n>e;e++)this.set.members[e].fx[t].apply(this.set.members[e].fx,arguments);return this}})},d.extend(d.Element,{data:function(t,e,n){if("object"==typeof t)for(e in t)this.data(e,t[e]);else if(arguments.length<2)try{return JSON.parse(this.attr("data-"+t))}catch(i){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:n===!0||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),d.extend(d.Element,{remember:function(t,e){if("object"==typeof arguments[0])for(var e in t)this.remember(e,t[e]);else{if(1==arguments.length)return this.memory()[t];this.memory()[t]=e}return this},forget:function(){if(0==arguments.length)this._memory={};else for(var t=arguments.length-1;t>=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory||(this._memory={})}}),d.get=function(t){var e=document.getElementById(c(t)||t);return e?d.adopt(e):void 0},d.select=function(t,e){return new d.Set(d.utils.map((e||document).querySelectorAll(t),function(t){return d.adopt(t)}))},d.extend(d.Parent,{select:function(t){return d.select(t,this.node)}}),"function"==typeof define&&define.amd?define(function(){return d}):"undefined"!=typeof exports&&(exports.SVG=d);var m="abcdef".split("");window.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}(),"function"!=typeof f&&(f.prototype=window.Event.prototype,window.CustomEvent=f)}).call(this);
\ No newline at end of file