From 169230cfd56be37861bb873eeecb45dfc22b6477 Mon Sep 17 00:00:00 2001 From: "Paulo F. Silva" Date: Wed, 2 Mar 2016 17:14:38 +0000 Subject: [PATCH] Backports commit dd7cc2f5104d488b0ba85366e14fae57edb767b7 to v1.x branch Backports commit dd2ad7824d546242468992436d9a631a60294e28 to v1.x branch --- dist/svg.js | 36 ++++++++++++++++++++++++++---------- dist/svg.min.js | 4 ++-- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/dist/svg.js b/dist/svg.js index ab7d820..8fb6b38 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js 1.1.0-2-g73992b2 - svg selector inventor polyfill regex default color array pointarray patharray number viewbox bbox rbox element parent container fx relative event defs group arrange mask clip gradient pattern doc shape symbol use rect ellipse line poly path image text textpath nested hyperlink marker sugar set data memory helpers - svgjs.com/license */ +/* svg.js 1.1.0-5-gc66d24a - svg selector inventor polyfill regex default color array pointarray patharray number viewbox bbox rbox element parent container fx relative event defs group arrange mask clip gradient pattern doc shape symbol use rect ellipse line poly path image text textpath nested hyperlink marker sugar set data memory helpers - svgjs.com/license */ ;(function(root, factory) { if (typeof define === 'function' && define.amd) { define(factory); @@ -573,15 +573,16 @@ } // Move path string , move: function(x, y) { - /* get bounding box of current situation */ - var box = this.bbox() + // get bounding box of current situation + var box = this.bbox() /* get relative offset */ x -= box.x y -= box.y + // get relative offset if (!isNaN(x) && !isNaN(y)) { - /* move every point */ + // move every point for (var l, i = this.value.length - 1; i >= 0; i--) { l = this.value[i][0] @@ -618,10 +619,10 @@ } // Resize path string , size: function(width, height) { - /* get bounding box of current situation */ - var i, l, box = this.bbox() + // get bounding box of current situation + var i, l, box = this.bbox() - /* recalculate position of all points according to new size */ + // recalculate position of all points according to new size for (i = this.value.length - 1; i >= 0; i--) { l = this.value[i][0] @@ -647,11 +648,11 @@ } } else if (l == 'A') { - /* resize radii */ + // resize radii this.value[i][1] = (this.value[i][1] * width) / box.width this.value[i][2] = (this.value[i][2] * height) / box.height - /* move position values */ + // move position values this.value[i][6] = ((this.value[i][6] - box.x) * width) / box.width + box.x this.value[i][7] = ((this.value[i][7] - box.y) * height) / box.height + box.y } @@ -682,6 +683,16 @@ .trim() // trim .split(SVG.regex.whitespaces) // split into array + // at this place there could be parts like ['3.124.854.32'] because we could not determine the point as seperator till now + // we fix this elements in the next loop + for(i = array.length; --i;){ + if(array[i].indexOf('.') != array[i].lastIndexOf('.')){ + var split = array[i].split('.') // split at the point + var first = [split.shift(), split.shift()].join('.') // join the first number together + array.splice.apply(array, [i, 1].concat(first, split.map(function(el){ return '.'+el }))) // add first and all other entries back to array + } + } + }else{ array = array.reduce(function(prev, curr){ return [].concat.apply(prev, curr) @@ -699,8 +710,10 @@ s = array[0] array.shift() // If last letter was a move command and we got no new, it defaults to [L]ine - }else if(s.toUpperCase() == 'M'){ + }else if(s == 'M'){ s = 'L' + }else if(s == 'm'){ + s = 'l' } // add path letter as first element @@ -790,6 +803,7 @@ }) + SVG.Number = function(value) { /* initialize defaults */ @@ -3256,6 +3270,8 @@ , extend: { // Set text content text: function(text) { + if(text == null) return this.node.textContent + (this.dom.newLined ? '\n' : '') + typeof text === 'function' ? text.call(this, this) : this.plain(text) return this diff --git a/dist/svg.min.js b/dist/svg.min.js index feaa5e3..dc64167 100644 --- a/dist/svg.min.js +++ b/dist/svg.min.js @@ -1,2 +1,2 @@ -!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.SVG=e()}(this,function(){function t(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function e(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 n(t,e,i){return(null==e||null==i)&&(null==i?i=t.height/t.width*e:null==e&&(e=t.width/t.height*i)),{width:e,height:i}}function r(t,e){return"number"==typeof t.from?t.from+(t.to-t.from)*e:t instanceof u.Color||t instanceof u.Number?t.at(e):1>e?t.from:t.to}function s(t){for(var e=0,i=t.length,n="";i>e;e++)n+=t[e][0],null!=t[e][1]&&(n+=t[e][1],null!=t[e][2]&&(n+=" ",n+=t[e][2],null!=t[e][3]&&(n+=" ",n+=t[e][3],n+=" ",n+=t[e][4],null!=t[e][5]&&(n+=" ",n+=t[e][5],n+=" ",n+=t[e][6],null!=t[e][7]&&(n+=" ",n+=t[e][7])))));return n+" "}function h(t){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}function o(t){if(t.matrix){var e=t.matrix.replace(/\s/g,"").split(",");6==e.length&&(t.a=parseFloat(e[0]),t.b=parseFloat(e[1]),t.c=parseFloat(e[2]),t.d=parseFloat(e[3]),t.e=parseFloat(e[4]),t.f=parseFloat(e[5]))}return t}function a(t){var e=t.toString().match(u.regex.reference);return e?e[1]:void 0}var u=this.SVG=function(t){return u.supported?(t=new u.Doc(t),u.parser||u.prepare(t),t):void 0};if(u.ns="http://www.w3.org/2000/svg",u.xmlns="http://www.w3.org/2000/xmlns/",u.xlink="http://www.w3.org/1999/xlink",u.did=1e3,u.eid=function(t){return"Svgjs"+t.charAt(0).toUpperCase()+t.slice(1)+u.did++},u.create=function(t){var e=document.createElementNS(this.ns,t);return e.setAttribute("id",this.eid(t)),e},u.extend=function(){var t,e,i,n;for(t=[].slice.call(arguments),e=t.pop(),n=t.length-1;n>=0;n--)if(t[n])for(i in e)t[n].prototype[i]=e[i];u.Set&&u.Set.inherit&&u.Set.inherit()},u.prepare=function(t){var e=document.getElementsByTagName("body")[0],i=(e?new u.Doc(e):t.nested()).size(2,0),n=u.create("path");i.node.appendChild(n),u.parser={body:e||t.parent,draw:i.style("opacity:0;position:fixed;left:100%;top:100%;overflow:hidden"),poly:i.polyline().node,path:n}},u.supported=function(){return!!document.createElementNS&&!!document.createElementNS(u.ns,"svg").createSVGRect}(),!u.supported)return!1;if(u.get=function(t){var e=document.getElementById(a(t)||t);return e?e.instance:void 0},u.invent=function(t){var e="function"==typeof t.create?t.create:function(){this.constructor.call(this,u.create(t.create))};return t.inherit&&(e.prototype=new t.inherit),t.extend&&u.extend(e,t.extend),t.construct&&u.extend(t.parent||u.Container,t.construct),e},"function"!=typeof l){var l=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};l.prototype=window.Event.prototype,window.CustomEvent=l}!function(t){for(var e=0,i=["moz","webkit"],n=0;nt?0:t>1?1:t,new u.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}}),u.Color.test=function(t){return t+="",u.regex.isHex.test(t)||u.regex.isRgb.test(t)},u.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},u.Color.isColor=function(t){return u.Color.isRgb(t)||u.Color.test(t)},u.Array=function(t,e){t=(t||[]).valueOf(),0==t.length&&e&&(t=e.valueOf()),this.value=this.parse(t)},u.extend(u.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],i=this.destination[this.destination.length-1];this.value.length>this.destination.length;)this.destination.push(i);for(;this.value.lengtht;t++)-1==i.indexOf(this.value[t])&&i.push(this.value[t]);return this.value=i},at:function(t){if(!this.destination)return this;for(var e=0,i=this.value.length,n=[];i>e;e++)n.push(this.value[e]+(this.destination[e]-this.value[e])*t);return new u.Array(n)},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}}),u.PointArray=function(){this.constructor.apply(this,arguments)},u.PointArray.prototype=new u.Array,u.extend(u.PointArray,{toString:function(){for(var t=0,e=this.value.length,i=[];e>t;t++)i.push(this.value[t].join(","));return i.join(" ")},at:function(t){if(!this.destination)return this;for(var e=0,i=this.value.length,n=[];i>e;e++)n.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 u.PointArray(n)},parse:function(t){if(t=t.valueOf(),Array.isArray(t))return t;t=this.split(t);for(var e,i=0,n=t.length,r=[];n>i;i++)e=t[i].split(","),r.push([parseFloat(e[0]),parseFloat(e[1])]);return r},move:function(t,e){var i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(var n=this.value.length-1;n>=0;n--)this.value[n]=[this.value[n][0]+t,this.value[n][1]+e];return this},size:function(t,e){var i,n=this.bbox();for(i=this.value.length-1;i>=0;i--)this.value[i][0]=(this.value[i][0]-n.x)*t/n.width+n.x,this.value[i][1]=(this.value[i][1]-n.y)*e/n.height+n.y;return this},bbox:function(){return u.parser.poly.setAttribute("points",this.toString()),u.parser.poly.getBBox()}}),u.PathArray=function(t,e){this.constructor.call(this,t,e)},u.PathArray.prototype=new u.Array,u.extend(u.PathArray,{toString:function(){return s(this.value)},move:function(t,e){var i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(var n,r=this.value.length-1;r>=0;r--)n=this.value[r][0],"M"==n||"L"==n||"T"==n?(this.value[r][1]+=t,this.value[r][2]+=e):"H"==n?this.value[r][1]+=t:"V"==n?this.value[r][1]+=e:"C"==n||"S"==n||"Q"==n?(this.value[r][1]+=t,this.value[r][2]+=e,this.value[r][3]+=t,this.value[r][4]+=e,"C"==n&&(this.value[r][5]+=t,this.value[r][6]+=e)):"A"==n&&(this.value[r][6]+=t,this.value[r][7]+=e);return this},size:function(t,e){var i,n,r=this.bbox();for(i=this.value.length-1;i>=0;i--)n=this.value[i][0],"M"==n||"L"==n||"T"==n?(this.value[i][1]=(this.value[i][1]-r.x)*t/r.width+r.x,this.value[i][2]=(this.value[i][2]-r.y)*e/r.height+r.y):"H"==n?this.value[i][1]=(this.value[i][1]-r.x)*t/r.width+r.x:"V"==n?this.value[i][1]=(this.value[i][1]-r.y)*e/r.height+r.y:"C"==n||"S"==n||"Q"==n?(this.value[i][1]=(this.value[i][1]-r.x)*t/r.width+r.x,this.value[i][2]=(this.value[i][2]-r.y)*e/r.height+r.y,this.value[i][3]=(this.value[i][3]-r.x)*t/r.width+r.x,this.value[i][4]=(this.value[i][4]-r.y)*e/r.height+r.y,"C"==n&&(this.value[i][5]=(this.value[i][5]-r.x)*t/r.width+r.x,this.value[i][6]=(this.value[i][6]-r.y)*e/r.height+r.y)):"A"==n&&(this.value[i][1]=this.value[i][1]*t/r.width,this.value[i][2]=this.value[i][2]*e/r.height,this.value[i][6]=(this.value[i][6]-r.x)*t/r.width+r.x,this.value[i][7]=(this.value[i][7]-r.y)*e/r.height+r.y);return this},parse:function(t){if(t instanceof u.PathArray)return t.valueOf();var e,i,n,r,s,h,o=0,a=0,l={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7};t="string"==typeof t?t.replace(u.regex.negExp,"X").replace(u.regex.pathLetters," $& ").replace(u.regex.hyphen," -").replace(u.regex.comma," ").replace(u.regex.X,"e-").trim().split(u.regex.whitespaces):t.reduce(function(t,e){return[].concat.apply(t,e)},[]);var h=[];do{for(u.regex.isPathLetter.test(t[0])?(r=t[0],t.shift()):"M"==r.toUpperCase()&&(r="L"),s=[r.toUpperCase()],e=0;et?-3.4e38:3.4e38;else if("string"==typeof t){var e=t.match(u.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 u.Number&&(this.value=t.value,this.unit=t.unit)},u.extend(u.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 u.Number(t),this},minus:function(t){return this.plus(-new u.Number(t))},times:function(t){return this.value=this*new u.Number(t),this},divide:function(t){return this.value=this/new u.Number(t),this},to:function(t){return"string"==typeof t&&(this.unit=t),this},morph:function(t){return this.destination=new u.Number(t),this},at:function(t){return this.destination?new u.Number(this.destination).minus(this).times(t).plus(this):this}}),u.ViewBox=function(t){var e,i,n,r,s=1,h=1,o=t.bbox(),a=(t.attr("viewBox")||"").match(/-?[\d\.]+/g),l=t,c=t;for(n=new u.Number(t.width()),r=new u.Number(t.height());"%"==n.unit;)s*=n.value,n=new u.Number(l instanceof u.Doc?l.parent.offsetWidth:l.parent.width()),l=l.parent;for(;"%"==r.unit;)h*=r.value,r=new u.Number(c instanceof u.Doc?c.parent.offsetHeight:c.parent.height()),c=c.parent;this.x=o.x,this.y=o.y,this.width=n*s,this.height=r*h,this.zoom=1,a&&(e=parseFloat(a[0]),i=parseFloat(a[1]),n=parseFloat(a[2]),r=parseFloat(a[3]),this.zoom=this.width/this.height>n/r?this.height/r:this.width/n,this.x=e,this.y=i,this.width=n,this.height=r)},u.extend(u.ViewBox,{toString:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}}),u.BBox=function(t){var e;if(this.x=0,this.y=0,this.width=0,this.height=0,t){try{e=t.node.getBBox()}catch(i){e={x:t.node.clientLeft,y:t.node.clientTop,width:t.node.clientWidth,height:t.node.clientHeight}}this.x=e.x+t.trans.x,this.y=e.y+t.trans.y,this.width=e.width*t.trans.scaleX,this.height=e.height*t.trans.scaleY}h(this)},u.extend(u.BBox,{merge:function(t){var e=new u.BBox;return e.x=Math.min(this.x,t.x),e.y=Math.min(this.y,t.y),e.width=Math.max(this.x+this.width,t.x+t.width)-e.x,e.height=Math.max(this.y+this.height,t.y+t.height)-e.y,h(e),e}}),u.RBox=function(t){var e,i,n={};if(this.x=0,this.y=0,this.width=0,this.height=0,t){for(e=t.doc().parent,i=t.doc().viewbox().zoom,n=t.node.getBoundingClientRect(),this.x=n.left,this.y=n.top,this.x-=e.offsetLeft,this.y-=e.offsetTop;e=e.offsetParent;)this.x-=e.offsetLeft,this.y-=e.offsetTop;for(e=t;e=e.parent;)"svg"==e.type&&e.viewbox&&(i*=e.viewbox().zoom,this.x-=e.x()||0,this.y-=e.y()||0)}this.x/=i,this.y/=i,this.width=n.width/=i,this.height=n.height/=i,this.x+="number"==typeof window.scrollX?window.scrollX:window.pageXOffset,this.y+="number"==typeof window.scrollY?window.scrollY:window.pageYOffset,h(this)},u.extend(u.RBox,{merge:function(t){var e=new u.RBox;return e.x=Math.min(this.x,t.x),e.y=Math.min(this.y,t.y),e.width=Math.max(this.x+this.width,t.x+t.width)-e.x,e.height=Math.max(this.y+this.height,t.y+t.height)-e.y,h(e),e}}),u.Element=u.invent({create:function(t){this._stroke=u.defaults.attrs.stroke,this.trans=u.defaults.trans(),(this.node=t)&&(this.type=t.nodeName,this.node.instance=this)},extend:{x:function(t){return null!=t&&(t=new u.Number(t),t.value/=this.trans.scaleX),this.attr("x",t)},y:function(t){return null!=t&&(t=new u.Number(t),t.value/=this.trans.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 i=n(this.bbox(),t,e);return this.width(new u.Number(i.width)).height(new u.Number(i.height))},clone:function(){var t,e,i=this.type;return t="rect"==i||"ellipse"==i?this.parent[i](0,0):"line"==i?this.parent[i](0,0,0,0):"image"==i?this.parent[i](this.src):"text"==i?this.parent[i](this.content):"path"==i?this.parent[i](this.attr("d")):"polyline"==i||"polygon"==i?this.parent[i](this.attr("points")):"g"==i?this.parent.group():this.parent[i](),e=this.attr(),delete e.id,t.attr(e),t.trans=this.trans,t.transform({})},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)},doc:function(t){return this._parent(t||u.Doc)},attr:function(t,e,i){if(null==t){for(t={},e=this.node.attributes,i=e.length-1;i>=0;i--)t[e[i].nodeName]=u.regex.isNumber.test(e[i].nodeValue)?parseFloat(e[i].nodeValue):e[i].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.attributes[t],null==e?u.defaults.attrs[t]:u.regex.isNumber.test(e.nodeValue)?parseFloat(e.nodeValue):e.nodeValue;if("style"==t)return this.style(e);"stroke-width"==t?this.attr("stroke",parseFloat(e)>0?this._stroke:null):"stroke"==t&&(this._stroke=e),("fill"==t||"stroke"==t)&&(u.regex.isImage.test(e)&&(e=this.doc().defs().image(e,0,0)),e instanceof u.Image&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new u.Number(e):u.Color.isColor(e)?e=new u.Color(e):Array.isArray(e)&&(e=new u.Array(e)),"leading"==t?this.leading&&this.leading(e):"string"==typeof i?this.node.setAttributeNS(i,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!=t&&"x"!=t||this.rebuild(t,e)}return this},transform:function(t,e){if(0==arguments.length)return this.trans;if("string"==typeof t){if(arguments.length<2)return this.trans[t];var i={};return i[t]=e,this.transform(i)}var i=[];t=o(t);for(e in t)null!=t[e]&&(this.trans[e]=t[e]);return this.trans.matrix=this.trans.a+" "+this.trans.b+" "+this.trans.c+" "+this.trans.d+" "+this.trans.e+" "+this.trans.f,t=this.trans,t.matrix!=u.defaults.matrix&&i.push("matrix("+t.matrix+")"),0!=t.rotation&&i.push("rotate("+t.rotation+" "+(null==t.cx?this.bbox().cx:t.cx)+" "+(null==t.cy?this.bbox().cy:t.cy)+")"),(1!=t.scaleX||1!=t.scaleY)&&i.push("scale("+t.scaleX+" "+t.scaleY+")"),0!=t.skewX&&i.push("skewX("+t.skewX+")"),0!=t.skewY&&i.push("skewY("+t.skewY+")"),(0!=t.x||0!=t.y)&&i.push("translate("+new u.Number(t.x/t.scaleX)+" "+new u.Number(t.y/t.scaleY)+")"),0==i.length?this.node.removeAttribute("transform"):this.node.setAttribute("transform",i.join(" ")),this},style:function(e,i){if(0==arguments.length)return this.node.style.cssText||"";if(arguments.length<2)if("object"==typeof e)for(i in e)this.style(i,e[i]);else{if(!u.regex.isCss.test(e))return this.node.style[t(e)];e=e.split(";");for(var n=0;ni.x&&e>i.y&&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 i,n,r=this.children();for(i=0,n=r.length;n>i;i++)r[i]instanceof u.Element&&t.apply(r[i],[i,r]),e&&r[i]instanceof u.Container&&r[i].each(t,e);return this},removeElement:function(t){return this.children().splice(this.index(t),1),this.node.removeChild(t.node),t.parent=null,this},clear:function(){for(var t=this.children().length-1;t>=0;t--)this.removeElement(this.children()[t]);return this._defs&&this._defs.clear(),this},defs:function(){return this.doc().defs()}}}),u.Container=u.invent({create:function(t){this.constructor.call(this,t)},inherit:u.Parent,extend:{viewbox:function(t){return 0==arguments.length?new u.ViewBox(this):(t=1==arguments.length?[t.x,t.y,t.width,t.height]:[].slice.call(arguments),this.attr("viewBox",t))}}}),u.FX=u.invent({create:function(t){this.target=t},extend:{animate:function(t,e,i){var n,s,h,o,a=this.target,l=this;return"object"==typeof t&&(i=t.delay,e=t.ease,t=t.duration),t="="==t?t:null==t?1e3:new u.Number(t).valueOf(),e=e||"<>",l.to=function(t){var i;if(t=0>t?0:t>1?1:t,null==n){n=[];for(o in l.attrs)n.push(o);if(a.morphArray&&(l._plot||n.indexOf("points")>-1)){var u,c=new a.morphArray(l._plot||l.attrs.points||a.array);l._size&&c.size(l._size.width.to,l._size.height.to),u=c.bbox(),l._x?c.move(l._x.to,u.y):l._cx&&c.move(l._cx.to-u.width/2,u.y),u=c.bbox(),l._y?c.move(u.x,l._y.to):l._cy&&c.move(u.x,l._cy.to-u.height/2),delete l._x,delete l._y,delete l._cx,delete l._cy,delete l._size,l._plot=a.array.morph(c)}}if(null==s){s=[];for(o in l.trans)s.push(o)}if(null==h){h=[];for(o in l.styles)h.push(o)}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,l._plot?a.plot(l._plot.at(t)):(l._x?a.x(l._x.at(t)):l._cx&&a.cx(l._cx.at(t)),l._y?a.y(l._y.at(t)):l._cy&&a.cy(l._cy.at(t)),l._size&&a.size(l._size.width.at(t),l._size.height.at(t))),l._viewbox&&a.viewbox(l._viewbox.x.at(t),l._viewbox.y.at(t),l._viewbox.width.at(t),l._viewbox.height.at(t)),l._leading&&a.leading(l._leading.at(t)),i=n.length-1;i>=0;i--)a.attr(n[i],r(l.attrs[n[i]],t));for(i=s.length-1;i>=0;i--)a.transform(s[i],r(l.trans[s[i]],t));for(i=h.length-1;i>=0;i--)a.style(h[i],r(l.styles[h[i]],t));l._during&&l._during.call(a,t,function(e,i){return r({from:e,to:i},t)})},"number"==typeof t&&(this.timeout=setTimeout(function(){var n=(new Date).getTime();l.situation={interval:1e3/60,start:n,play:!0,finish:n+t,duration:t},l.render=function(){if(l.situation.play===!0){var n=(new Date).getTime(),r=n>l.situation.finish?1:(n-l.situation.start)/t;l.to(r),n>l.situation.finish?(l._plot&&a.plot(new u.PointArray(l._plot.destination).settle()),l._loop===!0||"number"==typeof l._loop&&l._loop>1?("number"==typeof l._loop&&--l._loop,l.animate(t,e,i)):l._after?l._after.apply(a,[l]):l.stop()):l.animationFrame=requestAnimationFrame(l.render)}else l.animationFrame=requestAnimationFrame(l.render)},l.render()},new u.Number(i).valueOf())),this},bbox:function(){return this.target.bbox()},attr:function(t,e){if("object"==typeof t)for(var i in t)this.attr(i,t[i]);else{var n=this.target.attr(t);this.attrs[t]=u.Color.isColor(n)?new u.Color(n).morph(e):u.regex.unit.test(n)?new u.Number(n).morph(e):{from:n,to:e}}return this},transform:function(t,e){if(1==arguments.length){t=o(t),delete t.matrix,this.target.trans.cx=t.cx||null,this.target.trans.cy=t.cy||null,delete t.cx,delete t.cy;for(e in t)this.trans[e]={from:this.target.trans[e],to:t[e]}}else{var i={};i[t]=e,this.transform(i)}return this},style:function(t,e){if("object"==typeof t)for(var i in t)this.style(i,t[i]);else this.styles[t]={from:this.target.style(t),to:e};return this},x:function(t){return this._x=new u.Number(this.target.x()).morph(t),this},y:function(t){return this._y=new u.Number(this.target.y()).morph(t),this},cx:function(t){return this._cx=new u.Number(this.target.cx()).morph(t),this},cy:function(t){return this._cy=new u.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 u.Text)this.attr("font-size",t);else{var i=this.target.bbox();this._size={width:new u.Number(i.width).morph(t),height:new u.Number(i.height).morph(e)}}return this},plot:function(t){return this._plot=t,this},leading:function(t){return this.target._leading&&(this._leading=new u.Number(this.target._leading).morph(t)),this},viewbox:function(t,e,i,n){if(this.target instanceof u.Container){var r=this.target.viewbox();this._viewbox={x:new u.Number(r.x).morph(t),y:new u.Number(r.y).morph(e),width:new u.Number(r.width).morph(i),height:new u.Number(r.height).morph(n)}}return this},update:function(t){return this.target instanceof u.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 u.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),cancelAnimationFrame(this.animationFrame),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:u.Element,construct:{animate:function(t,e,i){return(this.fx||(this.fx=new u.FX(this))).stop().animate(t,e,i)},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}}}),u.extend(u.Element,u.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","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(t){u.Element.prototype[t]=function(e){var i=this;return this.node["on"+t]="function"==typeof e?function(){return e.apply(i,arguments)}:null,this}}),u.listeners=[],u.handlerMap=[],u.registerEvent=function(){},u.on=function(t,e,i){var n=i.bind(t.instance||t),r=(u.handlerMap.indexOf(t)+1||u.handlerMap.push(t))-1,s=e.split(".")[0],h=e.split(".")[1]||"*";u.listeners[r]=u.listeners[r]||{},u.listeners[r][s]=u.listeners[r][s]||{},u.listeners[r][s][h]=u.listeners[r][s][h]||{},u.listeners[r][s][h][i]=n,t.addEventListener(s,n,!1)},u.off=function(t,e,i){var n=u.handlerMap.indexOf(t),r=e&&e.split(".")[0],s=e&&e.split(".")[1];if(-1!=n)if(i)u.listeners[n][r]&&u.listeners[n][r][s||"*"]&&(t.removeEventListener(r,u.listeners[n][r][s||"*"][i],!1),delete u.listeners[n][r][s||"*"][i]);else if(s){if(u.listeners[n][r]&&u.listeners[n][r][s]){for(i in u.listeners[n][r][s])u.off(t,[r,s].join("."),i);delete u.listeners[n][r][s]}}else if(r){if(u.listeners[n][r]){for(namespace in u.listeners[n][r])u.off(t,[r,namespace].join("."));delete u.listeners[n][r]}}else{for(e in u.listeners[n])u.off(t,e);delete u.listeners[n]}},u.extend(u.Element,{on:function(t,e){return u.on(this.node,t,e),this},off:function(t,e){return u.off(this.node,t,e),this},fire:function(t,e){return this.node.dispatchEvent(new l(t,{detail:e})),this}}),u.Defs=u.invent({create:"defs",inherit:u.Container}),u.G=u.invent({create:"g",inherit:u.Container,extend:{x:function(t){return null==t?this.trans.x:this.transform("x",t)},y:function(t){return null==t?this.trans.y:this.transform("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 u.G)}}}),u.extend(u.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();return this.parent.removeElement(this).put(this,t+1)},backward:function(){var t=this.position();return t>0&&this.parent.removeElement(this).add(this,t-1),this},front:function(){return this.parent.removeElement(this).put(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}}),u.Mask=u.invent({create:function(){this.constructor.call(this,u.create("mask")),this.targets=[]},inherit:u.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 u.Mask)}}}),u.extend(u.Element,{maskWith:function(t){return this.masker=t instanceof u.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)}}),u.Clip=u.invent({create:function(){this.constructor.call(this,u.create("clipPath")),this.targets=[]},inherit:u.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 u.Clip)}}}),u.extend(u.Element,{clipWith:function(t){return this.clipper=t instanceof u.Clip?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)}}),u.Gradient=u.invent({create:function(t){this.constructor.call(this,u.create(t+"Gradient")),this.type=t},inherit:u.Container,extend:{from:function(t,e){return"radial"==this.type?this.attr({fx:new u.Number(t),fy:new u.Number(e)}):this.attr({x1:new u.Number(t),y1:new u.Number(e)})},to:function(t,e){return"radial"==this.type?this.attr({cx:new u.Number(t),cy:new u.Number(e)}):this.attr({x2:new u.Number(t),y2:new u.Number(e)})},radius:function(t){return"radial"==this.type?this.attr({r:new u.Number(t)}):this},at:function(t,e,i){return this.put(new u.Stop).update(t,e,i)},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)}}}),u.extend(u.Defs,{gradient:function(t,e){return this.put(new u.Gradient(t)).update(e)}}),u.Stop=u.invent({create:"stop",inherit:u.Element,extend:{update:function(t){return("number"==typeof t||t instanceof u.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 u.Number(t.offset)),this}}}),u.Pattern=u.invent({create:"pattern",inherit:u.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,i){return this.defs().pattern(t,e,i)}}}),u.extend(u.Defs,{pattern:function(t,e,i){return this.put(new u.Pattern).update(i).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}),u.Doc=u.invent({create:function(t){this.parent="string"==typeof t?document.getElementById(t):t,this.constructor.call(this,"svg"==this.parent.nodeName?this.parent:u.create("svg")),this.attr({xmlns:u.ns,version:"1.1",width:"100%",height:"100%"}).attr("xmlns:xlink",u.xlink,u.xmlns),this._defs=new u.Defs,this._defs.parent=this,this.node.appendChild(this._defs.node),this.doSpof=!1,this.parent!=this.node&&this.stage()},inherit:u.Container,extend:{stage:function(){var t=this;return this.parent.appendChild(this.node),t.spof(),u.on(window,"resize",function(){t.spof()}),this},defs:function(){return this._defs},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(){return this.doSpof=!0,this},remove:function(){return this.parent&&(this.parent.removeChild(this.node),this.parent=null),this}}}),u.Shape=u.invent({create:function(t){this.constructor.call(this,t)},inherit:u.Element}),u.Symbol=u.invent({create:"symbol",inherit:u.Container,construct:{symbol:function(){return this.defs().put(new u.Symbol)}}}),u.Use=u.invent({create:"use",inherit:u.Shape,extend:{element:function(t,e){return this.target=t,this.attr("href",(e||"")+"#"+t,u.xlink)}},construct:{use:function(t,e){return this.put(new u.Use).element(t,e)}}}),u.Rect=u.invent({create:"rect",inherit:u.Shape,construct:{rect:function(t,e){return this.put((new u.Rect).size(t,e))}}}),u.Ellipse=u.invent({create:"ellipse",inherit:u.Shape,extend:{x:function(t){return null==t?this.cx()-this.attr("rx"):this.cx(t+this.attr("rx")); -},y:function(t){return null==t?this.cy()-this.attr("ry"):this.cy(t+this.attr("ry"))},cx:function(t){return null==t?this.attr("cx"):this.attr("cx",new u.Number(t).divide(this.trans.scaleX))},cy:function(t){return null==t?this.attr("cy"):this.attr("cy",new u.Number(t).divide(this.trans.scaleY))},width:function(t){return null==t?2*this.attr("rx"):this.attr("rx",new u.Number(t).divide(2))},height:function(t){return null==t?2*this.attr("ry"):this.attr("ry",new u.Number(t).divide(2))},size:function(t,e){var i=n(this.bbox(),t,e);return this.attr({rx:new u.Number(i.width).divide(2),ry:new u.Number(i.height).divide(2)})}},construct:{circle:function(t){return this.ellipse(t,t)},ellipse:function(t,e){return this.put(new u.Ellipse).size(t,e).move(0,0)}}}),u.Line=u.invent({create:"line",inherit:u.Shape,extend:{x:function(t){var e=this.bbox();return null==t?e.x:this.attr({x1:this.attr("x1")-e.x+t,x2:this.attr("x2")-e.x+t})},y:function(t){var e=this.bbox();return null==t?e.y:this.attr({y1:this.attr("y1")-e.y+t,y2:this.attr("y2")-e.y+t})},cx:function(t){var e=this.bbox().width/2;return null==t?this.x()+e:this.x(t-e)},cy:function(t){var e=this.bbox().height/2;return null==t?this.y()+e:this.y(t-e)},width:function(t){var e=this.bbox();return null==t?e.width:this.attr(this.attr("x1")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 u.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 u.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 u.Text).text(t)},plain:function(t){return this.put(new u.Text).plain(t)}}}),u.TSpan=u.invent({create:"tspan",inherit:u.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(u.Text);return this.newLined=!0,this.dy(t._leading*t.attr("font-size")).attr("x",t.x())}}}),u.extend(u.Text,u.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,i=new u.TSpan;return this._build===!1&&this.clear(),e.appendChild(i.node),i.parent=this,this instanceof u.Text&&this.lines.add(i),i.text(t)},clear:function(){for(var t=(this.textPath||this).node;t.hasChildNodes();)t.removeChild(t.lastChild);return this instanceof u.Text&&(delete this.lines,this.lines=new u.Set,this.content=""),this},length:function(){return this.node.getComputedTextLength()}}),u.TextPath=u.invent({create:"textPath",inherit:u.Element,parent:u.Text,construct:{path:function(t){for(this.textPath=new u.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,u.xlink),this},plot:function(t){return this.track&&this.track.plot(t),this}}}),u.Nested=u.invent({create:function(){this.constructor.call(this,u.create("svg")),this.style("overflow","visible")},inherit:u.Container,construct:{nested:function(){return this.put(new u.Nested)}}}),u.A=u.invent({create:"a",inherit:u.Container,extend:{to:function(t){return this.attr("href",t,u.xlink)},show:function(t){return this.attr("show",t,u.xlink)},target:function(t){return this.attr("target",t)}},construct:{link:function(t){return this.put(new u.A).to(t)}}}),u.extend(u.Element,{linkTo:function(t){var e=new u.A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent.put(e).put(this)}}),u.Marker=u.invent({create:"marker",inherit:u.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,i){return this.defs().marker(t,e,i)}}}),u.extend(u.Defs,{marker:function(t,e,i){return this.put(new u.Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(i)}}),u.extend(u.Line,u.Polyline,u.Polygon,u.Path,{marker:function(t,e,i,n){var r=["marker"];return"all"!=t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof u.Marker?arguments[1]:this.doc().marker(e,i,n),this.attr(r,t)}});var c={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"==e?t:t+"-"+e}};return["fill","stroke"].forEach(function(t){var e,i={};i[t]=function(i){if("string"==typeof i||u.Color.isRgb(i)||i&&"function"==typeof i.fill)this.attr(t,i);else for(e=c[t].length-1;e>=0;e--)null!=i[c[t][e]]&&this.attr(c.prefix(t,c[t][e]),i[c[t][e]]);return this},u.extend(u.Element,u.FX,i)}),u.extend(u.Element,u.FX,{rotate:function(t,e,i){return this.transform({rotation:t||0,cx:e,cy:i})},skew:function(t,e){return this.transform({skewX:t||0,skewY:e||0})},scale:function(t,e){return this.transform({scaleX:t,scaleY:null==e?t:e})},translate:function(t,e){return this.transform({x:t,y:e})},matrix:function(t){return this.transform({matrix:t})},opacity:function(t){return this.attr("opacity",t)}}),u.extend(u.Rect,u.Ellipse,u.FX,{radius:function(t,e){return this.attr({rx:t,ry:e||t})}}),u.extend(u.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return this.node.getPointAtLength(t)}}),u.extend(u.Parent,u.Text,u.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}}),u.Set=u.invent({create:function(){this.clear()},extend:{add:function(){var t,e,i=[].slice.call(arguments);for(t=0,e=i.length;e>t;t++)this.members.push(i[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,i=this.members.length;i>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 u.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(){return new u.Set}}}),u.SetFX=u.invent({create:function(t){this.set=t}}),u.Set.inherit=function(){var t,e=[];for(var t in u.Shape.prototype)"function"==typeof u.Shape.prototype[t]&&"function"!=typeof u.Set.prototype[t]&&e.push(t);e.forEach(function(t){u.Set.prototype[t]=function(){for(var e=0,i=this.members.length;i>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 u.SetFX(this)):this}}),e=[];for(var t in u.FX.prototype)"function"==typeof u.FX.prototype[t]&&"function"!=typeof u.SetFX.prototype[t]&&e.push(t);e.forEach(function(t){u.SetFX.prototype[t]=function(){for(var e=0,i=this.set.members.length;i>e;e++)this.set.members[e].fx[t].apply(this.set.members[e].fx,arguments);return this}})},u.extend(u.Element,{data:function(t,e,i){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(n){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:i===!0||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),u.extend(u.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={})}}),u}); \ No newline at end of file +!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.SVG=e()}(this,function(){function t(t){return t.toLowerCase().replace(/-(.)/g,function(t,e){return e.toUpperCase()})}function e(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 n(t,e,i){return(null==e||null==i)&&(null==i?i=t.height/t.width*e:null==e&&(e=t.width/t.height*i)),{width:e,height:i}}function r(t,e){return"number"==typeof t.from?t.from+(t.to-t.from)*e:t instanceof u.Color||t instanceof u.Number?t.at(e):1>e?t.from:t.to}function s(t){for(var e=0,i=t.length,n="";i>e;e++)n+=t[e][0],null!=t[e][1]&&(n+=t[e][1],null!=t[e][2]&&(n+=" ",n+=t[e][2],null!=t[e][3]&&(n+=" ",n+=t[e][3],n+=" ",n+=t[e][4],null!=t[e][5]&&(n+=" ",n+=t[e][5],n+=" ",n+=t[e][6],null!=t[e][7]&&(n+=" ",n+=t[e][7])))));return n+" "}function h(t){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}function o(t){if(t.matrix){var e=t.matrix.replace(/\s/g,"").split(",");6==e.length&&(t.a=parseFloat(e[0]),t.b=parseFloat(e[1]),t.c=parseFloat(e[2]),t.d=parseFloat(e[3]),t.e=parseFloat(e[4]),t.f=parseFloat(e[5]))}return t}function a(t){var e=t.toString().match(u.regex.reference);return e?e[1]:void 0}var u=this.SVG=function(t){return u.supported?(t=new u.Doc(t),u.parser||u.prepare(t),t):void 0};if(u.ns="http://www.w3.org/2000/svg",u.xmlns="http://www.w3.org/2000/xmlns/",u.xlink="http://www.w3.org/1999/xlink",u.did=1e3,u.eid=function(t){return"Svgjs"+t.charAt(0).toUpperCase()+t.slice(1)+u.did++},u.create=function(t){var e=document.createElementNS(this.ns,t);return e.setAttribute("id",this.eid(t)),e},u.extend=function(){var t,e,i,n;for(t=[].slice.call(arguments),e=t.pop(),n=t.length-1;n>=0;n--)if(t[n])for(i in e)t[n].prototype[i]=e[i];u.Set&&u.Set.inherit&&u.Set.inherit()},u.prepare=function(t){var e=document.getElementsByTagName("body")[0],i=(e?new u.Doc(e):t.nested()).size(2,0),n=u.create("path");i.node.appendChild(n),u.parser={body:e||t.parent,draw:i.style("opacity:0;position:fixed;left:100%;top:100%;overflow:hidden"),poly:i.polyline().node,path:n}},u.supported=function(){return!!document.createElementNS&&!!document.createElementNS(u.ns,"svg").createSVGRect}(),!u.supported)return!1;if(u.get=function(t){var e=document.getElementById(a(t)||t);return e?e.instance:void 0},u.invent=function(t){var e="function"==typeof t.create?t.create:function(){this.constructor.call(this,u.create(t.create))};return t.inherit&&(e.prototype=new t.inherit),t.extend&&u.extend(e,t.extend),t.construct&&u.extend(t.parent||u.Container,t.construct),e},"function"!=typeof l){var l=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};l.prototype=window.Event.prototype,window.CustomEvent=l}!function(t){for(var e=0,i=["moz","webkit"],n=0;nt?0:t>1?1:t,new u.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}}),u.Color.test=function(t){return t+="",u.regex.isHex.test(t)||u.regex.isRgb.test(t)},u.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},u.Color.isColor=function(t){return u.Color.isRgb(t)||u.Color.test(t)},u.Array=function(t,e){t=(t||[]).valueOf(),0==t.length&&e&&(t=e.valueOf()),this.value=this.parse(t)},u.extend(u.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],i=this.destination[this.destination.length-1];this.value.length>this.destination.length;)this.destination.push(i);for(;this.value.lengtht;t++)-1==i.indexOf(this.value[t])&&i.push(this.value[t]);return this.value=i},at:function(t){if(!this.destination)return this;for(var e=0,i=this.value.length,n=[];i>e;e++)n.push(this.value[e]+(this.destination[e]-this.value[e])*t);return new u.Array(n)},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}}),u.PointArray=function(){this.constructor.apply(this,arguments)},u.PointArray.prototype=new u.Array,u.extend(u.PointArray,{toString:function(){for(var t=0,e=this.value.length,i=[];e>t;t++)i.push(this.value[t].join(","));return i.join(" ")},at:function(t){if(!this.destination)return this;for(var e=0,i=this.value.length,n=[];i>e;e++)n.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 u.PointArray(n)},parse:function(t){if(t=t.valueOf(),Array.isArray(t))return t;t=this.split(t);for(var e,i=0,n=t.length,r=[];n>i;i++)e=t[i].split(","),r.push([parseFloat(e[0]),parseFloat(e[1])]);return r},move:function(t,e){var i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(var n=this.value.length-1;n>=0;n--)this.value[n]=[this.value[n][0]+t,this.value[n][1]+e];return this},size:function(t,e){var i,n=this.bbox();for(i=this.value.length-1;i>=0;i--)this.value[i][0]=(this.value[i][0]-n.x)*t/n.width+n.x,this.value[i][1]=(this.value[i][1]-n.y)*e/n.height+n.y;return this},bbox:function(){return u.parser.poly.setAttribute("points",this.toString()),u.parser.poly.getBBox()}}),u.PathArray=function(t,e){this.constructor.call(this,t,e)},u.PathArray.prototype=new u.Array,u.extend(u.PathArray,{toString:function(){return s(this.value)},move:function(t,e){var i=this.bbox();if(t-=i.x,e-=i.y,!isNaN(t)&&!isNaN(e))for(var n,r=this.value.length-1;r>=0;r--)n=this.value[r][0],"M"==n||"L"==n||"T"==n?(this.value[r][1]+=t,this.value[r][2]+=e):"H"==n?this.value[r][1]+=t:"V"==n?this.value[r][1]+=e:"C"==n||"S"==n||"Q"==n?(this.value[r][1]+=t,this.value[r][2]+=e,this.value[r][3]+=t,this.value[r][4]+=e,"C"==n&&(this.value[r][5]+=t,this.value[r][6]+=e)):"A"==n&&(this.value[r][6]+=t,this.value[r][7]+=e);return this},size:function(t,e){var i,n,r=this.bbox();for(i=this.value.length-1;i>=0;i--)n=this.value[i][0],"M"==n||"L"==n||"T"==n?(this.value[i][1]=(this.value[i][1]-r.x)*t/r.width+r.x,this.value[i][2]=(this.value[i][2]-r.y)*e/r.height+r.y):"H"==n?this.value[i][1]=(this.value[i][1]-r.x)*t/r.width+r.x:"V"==n?this.value[i][1]=(this.value[i][1]-r.y)*e/r.height+r.y:"C"==n||"S"==n||"Q"==n?(this.value[i][1]=(this.value[i][1]-r.x)*t/r.width+r.x,this.value[i][2]=(this.value[i][2]-r.y)*e/r.height+r.y,this.value[i][3]=(this.value[i][3]-r.x)*t/r.width+r.x,this.value[i][4]=(this.value[i][4]-r.y)*e/r.height+r.y,"C"==n&&(this.value[i][5]=(this.value[i][5]-r.x)*t/r.width+r.x,this.value[i][6]=(this.value[i][6]-r.y)*e/r.height+r.y)):"A"==n&&(this.value[i][1]=this.value[i][1]*t/r.width,this.value[i][2]=this.value[i][2]*e/r.height,this.value[i][6]=(this.value[i][6]-r.x)*t/r.width+r.x,this.value[i][7]=(this.value[i][7]-r.y)*e/r.height+r.y);return this},parse:function(t){if(t instanceof u.PathArray)return t.valueOf();var e,i,n,r,s,h,o=0,a=0,l={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7};if("string"==typeof t){for(t=t.replace(u.regex.negExp,"X").replace(u.regex.pathLetters," $& ").replace(u.regex.hyphen," -").replace(u.regex.comma," ").replace(u.regex.X,"e-").trim().split(u.regex.whitespaces),e=t.length;--e;)if(t[e].indexOf(".")!=t[e].lastIndexOf(".")){var c=t[e].split("."),f=[c.shift(),c.shift()].join(".");t.splice.apply(t,[e,1].concat(f,c.map(function(t){return"."+t})))}}else t=t.reduce(function(t,e){return[].concat.apply(t,e)},[]);var h=[];do{for(u.regex.isPathLetter.test(t[0])?(r=t[0],t.shift()):"M"==r?r="L":"m"==r&&(r="l"),s=[r.toUpperCase()],e=0;et?-3.4e38:3.4e38;else if("string"==typeof t){var e=t.match(u.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 u.Number&&(this.value=t.value,this.unit=t.unit)},u.extend(u.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 u.Number(t),this},minus:function(t){return this.plus(-new u.Number(t))},times:function(t){return this.value=this*new u.Number(t),this},divide:function(t){return this.value=this/new u.Number(t),this},to:function(t){return"string"==typeof t&&(this.unit=t),this},morph:function(t){return this.destination=new u.Number(t),this},at:function(t){return this.destination?new u.Number(this.destination).minus(this).times(t).plus(this):this}}),u.ViewBox=function(t){var e,i,n,r,s=1,h=1,o=t.bbox(),a=(t.attr("viewBox")||"").match(/-?[\d\.]+/g),l=t,c=t;for(n=new u.Number(t.width()),r=new u.Number(t.height());"%"==n.unit;)s*=n.value,n=new u.Number(l instanceof u.Doc?l.parent.offsetWidth:l.parent.width()),l=l.parent;for(;"%"==r.unit;)h*=r.value,r=new u.Number(c instanceof u.Doc?c.parent.offsetHeight:c.parent.height()),c=c.parent;this.x=o.x,this.y=o.y,this.width=n*s,this.height=r*h,this.zoom=1,a&&(e=parseFloat(a[0]),i=parseFloat(a[1]),n=parseFloat(a[2]),r=parseFloat(a[3]),this.zoom=this.width/this.height>n/r?this.height/r:this.width/n,this.x=e,this.y=i,this.width=n,this.height=r)},u.extend(u.ViewBox,{toString:function(){return this.x+" "+this.y+" "+this.width+" "+this.height}}),u.BBox=function(t){var e;if(this.x=0,this.y=0,this.width=0,this.height=0,t){try{e=t.node.getBBox()}catch(i){e={x:t.node.clientLeft,y:t.node.clientTop,width:t.node.clientWidth,height:t.node.clientHeight}}this.x=e.x+t.trans.x,this.y=e.y+t.trans.y,this.width=e.width*t.trans.scaleX,this.height=e.height*t.trans.scaleY}h(this)},u.extend(u.BBox,{merge:function(t){var e=new u.BBox;return e.x=Math.min(this.x,t.x),e.y=Math.min(this.y,t.y),e.width=Math.max(this.x+this.width,t.x+t.width)-e.x,e.height=Math.max(this.y+this.height,t.y+t.height)-e.y,h(e),e}}),u.RBox=function(t){var e,i,n={};if(this.x=0,this.y=0,this.width=0,this.height=0,t){for(e=t.doc().parent,i=t.doc().viewbox().zoom,n=t.node.getBoundingClientRect(),this.x=n.left,this.y=n.top,this.x-=e.offsetLeft,this.y-=e.offsetTop;e=e.offsetParent;)this.x-=e.offsetLeft,this.y-=e.offsetTop;for(e=t;e=e.parent;)"svg"==e.type&&e.viewbox&&(i*=e.viewbox().zoom,this.x-=e.x()||0,this.y-=e.y()||0)}this.x/=i,this.y/=i,this.width=n.width/=i,this.height=n.height/=i,this.x+="number"==typeof window.scrollX?window.scrollX:window.pageXOffset,this.y+="number"==typeof window.scrollY?window.scrollY:window.pageYOffset,h(this)},u.extend(u.RBox,{merge:function(t){var e=new u.RBox;return e.x=Math.min(this.x,t.x),e.y=Math.min(this.y,t.y),e.width=Math.max(this.x+this.width,t.x+t.width)-e.x,e.height=Math.max(this.y+this.height,t.y+t.height)-e.y,h(e),e}}),u.Element=u.invent({create:function(t){this._stroke=u.defaults.attrs.stroke,this.trans=u.defaults.trans(),(this.node=t)&&(this.type=t.nodeName,this.node.instance=this)},extend:{x:function(t){return null!=t&&(t=new u.Number(t),t.value/=this.trans.scaleX),this.attr("x",t)},y:function(t){return null!=t&&(t=new u.Number(t),t.value/=this.trans.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 i=n(this.bbox(),t,e);return this.width(new u.Number(i.width)).height(new u.Number(i.height))},clone:function(){var t,e,i=this.type;return t="rect"==i||"ellipse"==i?this.parent[i](0,0):"line"==i?this.parent[i](0,0,0,0):"image"==i?this.parent[i](this.src):"text"==i?this.parent[i](this.content):"path"==i?this.parent[i](this.attr("d")):"polyline"==i||"polygon"==i?this.parent[i](this.attr("points")):"g"==i?this.parent.group():this.parent[i](),e=this.attr(),delete e.id,t.attr(e),t.trans=this.trans,t.transform({})},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)},doc:function(t){return this._parent(t||u.Doc)},attr:function(t,e,i){if(null==t){for(t={},e=this.node.attributes,i=e.length-1;i>=0;i--)t[e[i].nodeName]=u.regex.isNumber.test(e[i].nodeValue)?parseFloat(e[i].nodeValue):e[i].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.attributes[t],null==e?u.defaults.attrs[t]:u.regex.isNumber.test(e.nodeValue)?parseFloat(e.nodeValue):e.nodeValue;if("style"==t)return this.style(e);"stroke-width"==t?this.attr("stroke",parseFloat(e)>0?this._stroke:null):"stroke"==t&&(this._stroke=e),("fill"==t||"stroke"==t)&&(u.regex.isImage.test(e)&&(e=this.doc().defs().image(e,0,0)),e instanceof u.Image&&(e=this.doc().defs().pattern(0,0,function(){this.add(e)}))),"number"==typeof e?e=new u.Number(e):u.Color.isColor(e)?e=new u.Color(e):Array.isArray(e)&&(e=new u.Array(e)),"leading"==t?this.leading&&this.leading(e):"string"==typeof i?this.node.setAttributeNS(i,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!=t&&"x"!=t||this.rebuild(t,e)}return this},transform:function(t,e){if(0==arguments.length)return this.trans;if("string"==typeof t){if(arguments.length<2)return this.trans[t];var i={};return i[t]=e,this.transform(i)}var i=[];t=o(t);for(e in t)null!=t[e]&&(this.trans[e]=t[e]);return this.trans.matrix=this.trans.a+" "+this.trans.b+" "+this.trans.c+" "+this.trans.d+" "+this.trans.e+" "+this.trans.f,t=this.trans,t.matrix!=u.defaults.matrix&&i.push("matrix("+t.matrix+")"),0!=t.rotation&&i.push("rotate("+t.rotation+" "+(null==t.cx?this.bbox().cx:t.cx)+" "+(null==t.cy?this.bbox().cy:t.cy)+")"),(1!=t.scaleX||1!=t.scaleY)&&i.push("scale("+t.scaleX+" "+t.scaleY+")"),0!=t.skewX&&i.push("skewX("+t.skewX+")"),0!=t.skewY&&i.push("skewY("+t.skewY+")"),(0!=t.x||0!=t.y)&&i.push("translate("+new u.Number(t.x/t.scaleX)+" "+new u.Number(t.y/t.scaleY)+")"),0==i.length?this.node.removeAttribute("transform"):this.node.setAttribute("transform",i.join(" ")),this},style:function(e,i){if(0==arguments.length)return this.node.style.cssText||"";if(arguments.length<2)if("object"==typeof e)for(i in e)this.style(i,e[i]);else{if(!u.regex.isCss.test(e))return this.node.style[t(e)];e=e.split(";");for(var n=0;ni.x&&e>i.y&&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 i,n,r=this.children();for(i=0,n=r.length;n>i;i++)r[i]instanceof u.Element&&t.apply(r[i],[i,r]),e&&r[i]instanceof u.Container&&r[i].each(t,e);return this},removeElement:function(t){return this.children().splice(this.index(t),1),this.node.removeChild(t.node),t.parent=null,this},clear:function(){for(var t=this.children().length-1;t>=0;t--)this.removeElement(this.children()[t]);return this._defs&&this._defs.clear(),this},defs:function(){return this.doc().defs()}}}),u.Container=u.invent({create:function(t){this.constructor.call(this,t)},inherit:u.Parent,extend:{viewbox:function(t){return 0==arguments.length?new u.ViewBox(this):(t=1==arguments.length?[t.x,t.y,t.width,t.height]:[].slice.call(arguments),this.attr("viewBox",t))}}}),u.FX=u.invent({create:function(t){this.target=t},extend:{animate:function(t,e,i){var n,s,h,o,a=this.target,l=this;return"object"==typeof t&&(i=t.delay,e=t.ease,t=t.duration),t="="==t?t:null==t?1e3:new u.Number(t).valueOf(),e=e||"<>",l.to=function(t){var i;if(t=0>t?0:t>1?1:t,null==n){n=[];for(o in l.attrs)n.push(o);if(a.morphArray&&(l._plot||n.indexOf("points")>-1)){var u,c=new a.morphArray(l._plot||l.attrs.points||a.array);l._size&&c.size(l._size.width.to,l._size.height.to),u=c.bbox(),l._x?c.move(l._x.to,u.y):l._cx&&c.move(l._cx.to-u.width/2,u.y),u=c.bbox(),l._y?c.move(u.x,l._y.to):l._cy&&c.move(u.x,l._cy.to-u.height/2),delete l._x,delete l._y,delete l._cx,delete l._cy,delete l._size,l._plot=a.array.morph(c)}}if(null==s){s=[];for(o in l.trans)s.push(o)}if(null==h){h=[];for(o in l.styles)h.push(o)}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,l._plot?a.plot(l._plot.at(t)):(l._x?a.x(l._x.at(t)):l._cx&&a.cx(l._cx.at(t)),l._y?a.y(l._y.at(t)):l._cy&&a.cy(l._cy.at(t)),l._size&&a.size(l._size.width.at(t),l._size.height.at(t))),l._viewbox&&a.viewbox(l._viewbox.x.at(t),l._viewbox.y.at(t),l._viewbox.width.at(t),l._viewbox.height.at(t)),l._leading&&a.leading(l._leading.at(t)),i=n.length-1;i>=0;i--)a.attr(n[i],r(l.attrs[n[i]],t));for(i=s.length-1;i>=0;i--)a.transform(s[i],r(l.trans[s[i]],t));for(i=h.length-1;i>=0;i--)a.style(h[i],r(l.styles[h[i]],t));l._during&&l._during.call(a,t,function(e,i){return r({from:e,to:i},t)})},"number"==typeof t&&(this.timeout=setTimeout(function(){var n=(new Date).getTime();l.situation={interval:1e3/60,start:n,play:!0,finish:n+t,duration:t},l.render=function(){if(l.situation.play===!0){var n=(new Date).getTime(),r=n>l.situation.finish?1:(n-l.situation.start)/t;l.to(r),n>l.situation.finish?(l._plot&&a.plot(new u.PointArray(l._plot.destination).settle()),l._loop===!0||"number"==typeof l._loop&&l._loop>1?("number"==typeof l._loop&&--l._loop,l.animate(t,e,i)):l._after?l._after.apply(a,[l]):l.stop()):l.animationFrame=requestAnimationFrame(l.render)}else l.animationFrame=requestAnimationFrame(l.render)},l.render()},new u.Number(i).valueOf())),this},bbox:function(){return this.target.bbox()},attr:function(t,e){if("object"==typeof t)for(var i in t)this.attr(i,t[i]);else{var n=this.target.attr(t);this.attrs[t]=u.Color.isColor(n)?new u.Color(n).morph(e):u.regex.unit.test(n)?new u.Number(n).morph(e):{from:n,to:e}}return this},transform:function(t,e){if(1==arguments.length){t=o(t),delete t.matrix,this.target.trans.cx=t.cx||null,this.target.trans.cy=t.cy||null,delete t.cx,delete t.cy;for(e in t)this.trans[e]={from:this.target.trans[e],to:t[e]}}else{var i={};i[t]=e,this.transform(i)}return this},style:function(t,e){if("object"==typeof t)for(var i in t)this.style(i,t[i]);else this.styles[t]={from:this.target.style(t),to:e};return this},x:function(t){return this._x=new u.Number(this.target.x()).morph(t),this},y:function(t){return this._y=new u.Number(this.target.y()).morph(t),this},cx:function(t){return this._cx=new u.Number(this.target.cx()).morph(t),this},cy:function(t){return this._cy=new u.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 u.Text)this.attr("font-size",t);else{var i=this.target.bbox();this._size={width:new u.Number(i.width).morph(t),height:new u.Number(i.height).morph(e)}}return this},plot:function(t){return this._plot=t,this},leading:function(t){return this.target._leading&&(this._leading=new u.Number(this.target._leading).morph(t)),this},viewbox:function(t,e,i,n){if(this.target instanceof u.Container){var r=this.target.viewbox();this._viewbox={x:new u.Number(r.x).morph(t),y:new u.Number(r.y).morph(e),width:new u.Number(r.width).morph(i),height:new u.Number(r.height).morph(n)}}return this},update:function(t){return this.target instanceof u.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 u.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),cancelAnimationFrame(this.animationFrame),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:u.Element,construct:{animate:function(t,e,i){return(this.fx||(this.fx=new u.FX(this))).stop().animate(t,e,i)},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}}}),u.extend(u.Element,u.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","touchstart","touchmove","touchleave","touchend","touchcancel"].forEach(function(t){u.Element.prototype[t]=function(e){var i=this;return this.node["on"+t]="function"==typeof e?function(){return e.apply(i,arguments)}:null,this}}),u.listeners=[],u.handlerMap=[],u.registerEvent=function(){},u.on=function(t,e,i){var n=i.bind(t.instance||t),r=(u.handlerMap.indexOf(t)+1||u.handlerMap.push(t))-1,s=e.split(".")[0],h=e.split(".")[1]||"*";u.listeners[r]=u.listeners[r]||{},u.listeners[r][s]=u.listeners[r][s]||{},u.listeners[r][s][h]=u.listeners[r][s][h]||{},u.listeners[r][s][h][i]=n,t.addEventListener(s,n,!1)},u.off=function(t,e,i){var n=u.handlerMap.indexOf(t),r=e&&e.split(".")[0],s=e&&e.split(".")[1];if(-1!=n)if(i)u.listeners[n][r]&&u.listeners[n][r][s||"*"]&&(t.removeEventListener(r,u.listeners[n][r][s||"*"][i],!1),delete u.listeners[n][r][s||"*"][i]);else if(s){if(u.listeners[n][r]&&u.listeners[n][r][s]){for(i in u.listeners[n][r][s])u.off(t,[r,s].join("."),i);delete u.listeners[n][r][s]}}else if(r){if(u.listeners[n][r]){for(namespace in u.listeners[n][r])u.off(t,[r,namespace].join("."));delete u.listeners[n][r]}}else{for(e in u.listeners[n])u.off(t,e);delete u.listeners[n]}},u.extend(u.Element,{on:function(t,e){return u.on(this.node,t,e),this},off:function(t,e){return u.off(this.node,t,e),this},fire:function(t,e){return this.node.dispatchEvent(new l(t,{detail:e})),this}}),u.Defs=u.invent({create:"defs",inherit:u.Container}),u.G=u.invent({create:"g",inherit:u.Container,extend:{x:function(t){return null==t?this.trans.x:this.transform("x",t)},y:function(t){return null==t?this.trans.y:this.transform("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 u.G)}}}),u.extend(u.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();return this.parent.removeElement(this).put(this,t+1)},backward:function(){var t=this.position();return t>0&&this.parent.removeElement(this).add(this,t-1),this},front:function(){return this.parent.removeElement(this).put(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}}),u.Mask=u.invent({create:function(){this.constructor.call(this,u.create("mask")),this.targets=[]},inherit:u.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 u.Mask)}}}),u.extend(u.Element,{maskWith:function(t){return this.masker=t instanceof u.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)}}),u.Clip=u.invent({create:function(){this.constructor.call(this,u.create("clipPath")),this.targets=[]},inherit:u.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 u.Clip)}}}),u.extend(u.Element,{clipWith:function(t){return this.clipper=t instanceof u.Clip?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)}}),u.Gradient=u.invent({create:function(t){this.constructor.call(this,u.create(t+"Gradient")),this.type=t},inherit:u.Container,extend:{from:function(t,e){return"radial"==this.type?this.attr({fx:new u.Number(t),fy:new u.Number(e)}):this.attr({x1:new u.Number(t),y1:new u.Number(e)})},to:function(t,e){return"radial"==this.type?this.attr({cx:new u.Number(t),cy:new u.Number(e)}):this.attr({x2:new u.Number(t),y2:new u.Number(e)})},radius:function(t){return"radial"==this.type?this.attr({r:new u.Number(t)}):this},at:function(t,e,i){return this.put(new u.Stop).update(t,e,i)},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)}}}),u.extend(u.Defs,{gradient:function(t,e){return this.put(new u.Gradient(t)).update(e)}}),u.Stop=u.invent({create:"stop",inherit:u.Element,extend:{update:function(t){return("number"==typeof t||t instanceof u.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 u.Number(t.offset)),this}}}),u.Pattern=u.invent({create:"pattern",inherit:u.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,i){return this.defs().pattern(t,e,i)}}}),u.extend(u.Defs,{pattern:function(t,e,i){return this.put(new u.Pattern).update(i).attr({x:0,y:0,width:t,height:e,patternUnits:"userSpaceOnUse"})}}),u.Doc=u.invent({create:function(t){this.parent="string"==typeof t?document.getElementById(t):t,this.constructor.call(this,"svg"==this.parent.nodeName?this.parent:u.create("svg")),this.attr({xmlns:u.ns,version:"1.1",width:"100%",height:"100%"}).attr("xmlns:xlink",u.xlink,u.xmlns),this._defs=new u.Defs,this._defs.parent=this,this.node.appendChild(this._defs.node),this.doSpof=!1,this.parent!=this.node&&this.stage()},inherit:u.Container,extend:{stage:function(){var t=this;return this.parent.appendChild(this.node),t.spof(),u.on(window,"resize",function(){t.spof()}),this},defs:function(){return this._defs},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(){return this.doSpof=!0,this},remove:function(){return this.parent&&(this.parent.removeChild(this.node),this.parent=null),this}}}),u.Shape=u.invent({create:function(t){this.constructor.call(this,t)},inherit:u.Element}),u.Symbol=u.invent({create:"symbol",inherit:u.Container,construct:{symbol:function(){return this.defs().put(new u.Symbol)}}}),u.Use=u.invent({create:"use",inherit:u.Shape,extend:{element:function(t,e){return this.target=t,this.attr("href",(e||"")+"#"+t,u.xlink)}},construct:{use:function(t,e){return this.put(new u.Use).element(t,e)}}}),u.Rect=u.invent({create:"rect", +inherit:u.Shape,construct:{rect:function(t,e){return this.put((new u.Rect).size(t,e))}}}),u.Ellipse=u.invent({create:"ellipse",inherit:u.Shape,extend:{x:function(t){return null==t?this.cx()-this.attr("rx"):this.cx(t+this.attr("rx"))},y:function(t){return null==t?this.cy()-this.attr("ry"):this.cy(t+this.attr("ry"))},cx:function(t){return null==t?this.attr("cx"):this.attr("cx",new u.Number(t).divide(this.trans.scaleX))},cy:function(t){return null==t?this.attr("cy"):this.attr("cy",new u.Number(t).divide(this.trans.scaleY))},width:function(t){return null==t?2*this.attr("rx"):this.attr("rx",new u.Number(t).divide(2))},height:function(t){return null==t?2*this.attr("ry"):this.attr("ry",new u.Number(t).divide(2))},size:function(t,e){var i=n(this.bbox(),t,e);return this.attr({rx:new u.Number(i.width).divide(2),ry:new u.Number(i.height).divide(2)})}},construct:{circle:function(t){return this.ellipse(t,t)},ellipse:function(t,e){return this.put(new u.Ellipse).size(t,e).move(0,0)}}}),u.Line=u.invent({create:"line",inherit:u.Shape,extend:{x:function(t){var e=this.bbox();return null==t?e.x:this.attr({x1:this.attr("x1")-e.x+t,x2:this.attr("x2")-e.x+t})},y:function(t){var e=this.bbox();return null==t?e.y:this.attr({y1:this.attr("y1")-e.y+t,y2:this.attr("y2")-e.y+t})},cx:function(t){var e=this.bbox().width/2;return null==t?this.x()+e:this.x(t-e)},cy:function(t){var e=this.bbox().height/2;return null==t?this.y()+e:this.y(t-e)},width:function(t){var e=this.bbox();return null==t?e.width:this.attr(this.attr("x1")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 u.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 u.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 u.Text).text(t)},plain:function(t){return this.put(new u.Text).plain(t)}}}),u.TSpan=u.invent({create:"tspan",inherit:u.Shape,extend:{text:function(t){return null==t?this.node.textContent+(this.dom.newLined?"\n":""):("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(u.Text);return this.newLined=!0,this.dy(t._leading*t.attr("font-size")).attr("x",t.x())}}}),u.extend(u.Text,u.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,i=new u.TSpan;return this._build===!1&&this.clear(),e.appendChild(i.node),i.parent=this,this instanceof u.Text&&this.lines.add(i),i.text(t)},clear:function(){for(var t=(this.textPath||this).node;t.hasChildNodes();)t.removeChild(t.lastChild);return this instanceof u.Text&&(delete this.lines,this.lines=new u.Set,this.content=""),this},length:function(){return this.node.getComputedTextLength()}}),u.TextPath=u.invent({create:"textPath",inherit:u.Element,parent:u.Text,construct:{path:function(t){for(this.textPath=new u.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,u.xlink),this},plot:function(t){return this.track&&this.track.plot(t),this}}}),u.Nested=u.invent({create:function(){this.constructor.call(this,u.create("svg")),this.style("overflow","visible")},inherit:u.Container,construct:{nested:function(){return this.put(new u.Nested)}}}),u.A=u.invent({create:"a",inherit:u.Container,extend:{to:function(t){return this.attr("href",t,u.xlink)},show:function(t){return this.attr("show",t,u.xlink)},target:function(t){return this.attr("target",t)}},construct:{link:function(t){return this.put(new u.A).to(t)}}}),u.extend(u.Element,{linkTo:function(t){var e=new u.A;return"function"==typeof t?t.call(e,e):e.to(t),this.parent.put(e).put(this)}}),u.Marker=u.invent({create:"marker",inherit:u.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,i){return this.defs().marker(t,e,i)}}}),u.extend(u.Defs,{marker:function(t,e,i){return this.put(new u.Marker).size(t,e).ref(t/2,e/2).viewbox(0,0,t,e).attr("orient","auto").update(i)}}),u.extend(u.Line,u.Polyline,u.Polygon,u.Path,{marker:function(t,e,i,n){var r=["marker"];return"all"!=t&&r.push(t),r=r.join("-"),t=arguments[1]instanceof u.Marker?arguments[1]:this.doc().marker(e,i,n),this.attr(r,t)}});var c={stroke:["color","width","opacity","linecap","linejoin","miterlimit","dasharray","dashoffset"],fill:["color","opacity","rule"],prefix:function(t,e){return"color"==e?t:t+"-"+e}};return["fill","stroke"].forEach(function(t){var e,i={};i[t]=function(i){if("string"==typeof i||u.Color.isRgb(i)||i&&"function"==typeof i.fill)this.attr(t,i);else for(e=c[t].length-1;e>=0;e--)null!=i[c[t][e]]&&this.attr(c.prefix(t,c[t][e]),i[c[t][e]]);return this},u.extend(u.Element,u.FX,i)}),u.extend(u.Element,u.FX,{rotate:function(t,e,i){return this.transform({rotation:t||0,cx:e,cy:i})},skew:function(t,e){return this.transform({skewX:t||0,skewY:e||0})},scale:function(t,e){return this.transform({scaleX:t,scaleY:null==e?t:e})},translate:function(t,e){return this.transform({x:t,y:e})},matrix:function(t){return this.transform({matrix:t})},opacity:function(t){return this.attr("opacity",t)}}),u.extend(u.Rect,u.Ellipse,u.FX,{radius:function(t,e){return this.attr({rx:t,ry:e||t})}}),u.extend(u.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return this.node.getPointAtLength(t)}}),u.extend(u.Parent,u.Text,u.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}}),u.Set=u.invent({create:function(){this.clear()},extend:{add:function(){var t,e,i=[].slice.call(arguments);for(t=0,e=i.length;e>t;t++)this.members.push(i[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,i=this.members.length;i>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 u.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(){return new u.Set}}}),u.SetFX=u.invent({create:function(t){this.set=t}}),u.Set.inherit=function(){var t,e=[];for(var t in u.Shape.prototype)"function"==typeof u.Shape.prototype[t]&&"function"!=typeof u.Set.prototype[t]&&e.push(t);e.forEach(function(t){u.Set.prototype[t]=function(){for(var e=0,i=this.members.length;i>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 u.SetFX(this)):this}}),e=[];for(var t in u.FX.prototype)"function"==typeof u.FX.prototype[t]&&"function"!=typeof u.SetFX.prototype[t]&&e.push(t);e.forEach(function(t){u.SetFX.prototype[t]=function(){for(var e=0,i=this.set.members.length;i>e;e++)this.set.members[e].fx[t].apply(this.set.members[e].fx,arguments);return this}})},u.extend(u.Element,{data:function(t,e,i){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(n){return this.attr("data-"+t)}else this.attr("data-"+t,null===e?null:i===!0||"string"==typeof e||"number"==typeof e?e:JSON.stringify(e));return this}}),u.extend(u.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={})}}),u}); \ No newline at end of file -- 2.39.5