lines-svg
Version:
LinesSvg is a financial chart library. Support formats are lineal, candlestick, sma & ema charts.
1 lines • 119 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Lines=e():t.Lines=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e){function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var s={init:{},line:{},candle:{},ema:{},sma:{}},l=JSON.parse(JSON.stringify(s)),u={save:function(t){arguments.length>1&&void 0!==arguments[1]&&arguments[1];var e=u.validate(t)?t:u.dataFormatter(t);u.mset({raw:e,labels:e.map((function(t){return t[4]})),data:e.map((function(t){return t[3]}))}),u.set("data",e.map((function(t){return t[3]})),"line")},all:function(){return l},get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"init";return l[e][t]},mget:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"init",n={};return t.forEach((function(t){n[t]=l[e][t]})),n},init:function(t){var e=o(t.split("."),2),n=e[0],r=e[1];return r?(!l[n]&&(l[n]={}),!l[n][r]&&(l[n][r]=[])):!l[n]&&(l[n]=[]),r?[n,r]:[n]},push:function(t,e){var n=u.init(t);n[1]?l[n[0]][n[1]].push(e):l[n[0]].push(e)},set:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"init";l[n][t]=e},mset:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"init";l[e]=r({},l[e],{},t)},validate:function(t){return t.every((function(t){return!t.date||!t.high}))},dataFormatter:function(t){return t.map((function(t){return[t.open,t.high,t.low,t.close,t.date]}))},reset:function(){l=JSON.parse(JSON.stringify(s))}};t.exports=u},function(t,e){function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var i,o;t.exports=(i=0,o=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?n(Object(i),!0).forEach((function(e){r(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):n(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},{f:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;return Math.abs(parseFloat(t).toFixed(e))},fDate:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"1d",n=new Date(t);return"15m"===e?"".concat(n.getHours(),":").concat(n.getMinutes()):"1h"===e?"".concat(n.getHours(),":00"):"4h"===e?"".concat(n.getDate()," ").concat(n.getHours(),":00"):"1d"===e?"".concat(o[n.getMonth()],"'").concat(n.getDate()):void 0},candle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body",n={body:["x","y","width","height","isWin"],shadow:["top","bottom","isWin"]};return Object.keys(t).filter((function(t){return n[e].includes(t)})).reduce((function(e,n){return e[n]=t[n],e}),{})},genId:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"line";return++i,"".concat(t,"-").concat(i)}}))},function(t,e){t.exports={config:{debug:!1,chart:{type:["line","candle","sma","ema"],paddingX:30,paddingY:30,enableGrid:!0,candleFill:.4,totalGrids:5,labelXskipLength:21},svg:{line:{stroke:"#505050",strokeWidth:3,class:"liveLine",cursor:"pointer"},path:{stroke:"#36a2eb"},rectGroup:{candleWin:{stroke:"#f00",fill:"#f00",id:"candleWin"},candleLose:{stroke:"#00f",fill:"#00f",id:"candleLose"}},rect:{lnav:{cursor:"pointer",fill:"#828282"}},circle:{cursor:{fill:"#388E3C",strokeWidth:9,stroke:"#00bcd480",id:"liveCursor"},lnav:{class:"lnav",r:6},lcir:{cursor:"pointer",fill:"#828282"}}},colors:{candleWin:"f00",candleLose:"00f",grid:"ddd",line:"36a2eb",sma:"ff9f40",ema:"9966ff",cursor:{fill:"388E3C",stroke:"00bcd480"},lline:"505050"},smaLength:5,emaLength:10,magnetMode:50,step:{x:50,xMin:20,xMax:100,yMax:20,arrow:50,zoom:9,offset:9,xLegend:100},timeUnit:"15m",timeUnits:["15m","1h","4h","1d","1w"],drawOrder:["drawLine","drawCandle","drawSMA","drawEMA"]},SVG:{line:"line",text:"text",rect:"rect",circle:"circle",path:"path",input:"input"},CHART:{axis:"axis",line:"line",candle:"candle",legend:"legend",debug:"debug",sinit:"sinit",init:"init",sma:"sma",ema:"ema"},DRAW:{line:"line",rect:"rect",text:"text",circle:"circle",pointer:"pointer",channel:"channel"}}},function(t,e,n){n(4),t.exports=n(5)},function(t,e,n){var r,i;(function(){var n,o,a,s,l,u,c,f,h,d,p,v,y;t.exports=0;a="hasOwnProperty",s=/[\.\/]/,l=/\s*,\s*/,u=function(t,e){return t-e},c={n:{}},f=function(){for(var t=0,e=this.length;t<e;t++)if(void 0!==this[t])return this[t]},h=function(){for(var t=this.length;--t;)if(void 0!==this[t])return this[t]},d=Object.prototype.toString,p=String,v=Array.isArray||function(t){return t instanceof Array||"[object Array]"==d.call(t)},eve=function(t,e){var r,i=o,a=Array.prototype.slice.call(arguments,2),s=eve.listeners(t),l=0,c=[],d={},p=[],g=n;p.firstDefined=f,p.lastDefined=h,n=t,o=0;for(var v=0,y=s.length;v<y;v++)"zIndex"in s[v]&&(c.push(s[v].zIndex),s[v].zIndex<0&&(d[s[v].zIndex]=s[v]));for(c.sort(u);c[l]<0;)if(r=d[c[l++]],p.push(r.apply(e,a)),o)return o=i,p;for(v=0;v<y;v++)if("zIndex"in(r=s[v]))if(r.zIndex==c[l]){if(p.push(r.apply(e,a)),o)break;do{if((r=d[c[++l]])&&p.push(r.apply(e,a)),o)break}while(r)}else d[r.zIndex]=r;else if(p.push(r.apply(e,a)),o)break;return o=i,n=g,p},eve._events=c,eve.listeners=function(t){var e,n,r,i,o,a,l,u,f=v(t)?t:t.split(s),h=c,d=[h],p=[];for(i=0,o=f.length;i<o;i++){for(u=[],a=0,l=d.length;a<l;a++)for(n=[(h=d[a].n)[f[i]],h["*"]],r=2;r--;)(e=n[r])&&(u.push(e),p=p.concat(e.f||[]));d=u}return p},eve.separator=function(t){t?(t="["+(t=p(t).replace(/(?=[\.\^\]\[\-])/g,"\\"))+"]",s=new RegExp(t)):s=/[\.\/]/},eve.on=function(t,e){if("function"!=typeof e)return function(){};for(var n=v(t)?v(t[0])?t:[t]:p(t).split(l),r=0,i=n.length;r<i;r++)!function(t){for(var n,r=v(t)?t:p(t).split(s),i=c,o=0,a=r.length;o<a;o++)i=(i=i.n).hasOwnProperty(r[o])&&i[r[o]]||(i[r[o]]={n:{}});for(i.f=i.f||[],o=0,a=i.f.length;o<a;o++)if(i.f[o]==e){n=!0;break}!n&&i.f.push(e)}(n[r]);return function(t){+t==+t&&(e.zIndex=+t)}},eve.f=function(t){var e=[].slice.call(arguments,1);return function(){eve.apply(null,[t,null].concat(e).concat([].slice.call(arguments,0)))}},eve.stop=function(){o=1},eve.nt=function(t){var e=v(n)?n.join("."):n;return t?new RegExp("(?:\\.|\\/|^)"+t+"(?:\\.|\\/|$)").test(e):e},eve.nts=function(){return v(n)?n:n.split(s)},eve.off=eve.unbind=function(t,e){if(t){var n=v(t)?v(t[0])?t:[t]:p(t).split(l);if(n.length>1)for(var r=0,i=n.length;r<i;r++)eve.off(n[r],e);else{n=v(t)?t:p(t).split(s);var o,u,f,h,d,g=[c],y=[];for(r=0,i=n.length;r<i;r++)for(h=0;h<g.length;h+=f.length-2){if(f=[h,1],o=g[h].n,"*"!=n[r])o[n[r]]&&(f.push(o[n[r]]),y.unshift({n:o,name:n[r]}));else for(u in o)o[a](u)&&(f.push(o[u]),y.unshift({n:o,name:u}));g.splice.apply(g,f)}for(r=0,i=g.length;r<i;r++)for(o=g[r];o.n;){if(e){if(o.f){for(h=0,d=o.f.length;h<d;h++)if(o.f[h]==e){o.f.splice(h,1);break}!o.f.length&&delete o.f}for(u in o.n)if(o.n[a](u)&&o.n[u].f){var m=o.n[u].f;for(h=0,d=m.length;h<d;h++)if(m[h]==e){m.splice(h,1);break}!m.length&&delete o.n[u].f}}else for(u in delete o.f,o.n)o.n[a](u)&&o.n[u].f&&delete o.n[u].f;o=o.n}t:for(r=0,i=y.length;r<i;r++){for(u in(o=y[r]).n[o.name].f)continue t;for(u in o.n[o.name].n)continue t;delete o.n[o.name]}}}else eve._events=c={n:{}}},eve.once=function(t,e){var n=function(){return eve.off(t,n),e.apply(this,arguments)};return eve.on(t,n)},eve.version="0.5.0",eve.toString=function(){return"You are running Eve 0.5.0"},t.exports?t.exports=eve:r=function(){return eve}.apply(e,[]),y=window||this,void 0===(i=function(t){return function(t,e){var n=function(e){var n,r={},i=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(t){return setTimeout(t,16,(new Date).getTime()),!0},o=Array.isArray||function(t){return t instanceof Array||"[object Array]"==Object.prototype.toString.call(t)},a=0,s="M"+(+new Date).toString(36),l=Date.now||function(){return+new Date},u=function(t){var e=this;if(null==t)return e.s;var n=e.s-t;e.b+=e.dur*n,e.B+=e.dur*n,e.s=t},c=function(t){if(null==t)return this.spd;this.spd=t},f=function(t){var e=this;if(null==t)return e.dur;e.s=e.s*t/e.dur,e.dur=t},h=function(){var t=this;delete r[t.id],t.update(),e("mina.stop."+t.id,t)},d=function(){var t=this;t.pdif||(delete r[t.id],t.update(),t.pdif=t.get()-t.b)},p=function(){var t=this;t.pdif&&(t.b=t.get()-t.pdif,delete t.pdif,r[t.id]=t,v())},g=function(){var t,e=this;if(o(e.start)){t=[];for(var n=0,r=e.start.length;n<r;n++)t[n]=+e.start[n]+(e.end[n]-e.start[n])*e.easing(e.s)}else t=+e.start+(e.end-e.start)*e.easing(e.s);e.set(t)},v=function(t){if(t){var o=0;for(var a in r)if(r.hasOwnProperty(a)){var s=r[a],l=s.get();o++,s.s=(l-s.b)/(s.dur/s.spd),s.s>=1&&(delete r[a],s.s=1,o--,function(t){setTimeout((function(){e("mina.finish."+t.id,t)}))}(s)),s.update()}n=!!o&&i(v)}else n||(n=i(v))},y=function(t,e,n,i,o,l,m){var b={id:s+(a++).toString(36),start:t,end:e,b:n,s:0,dur:i-n,spd:1,get:o,set:l,easing:m||y.linear,status:u,speed:c,duration:f,stop:h,pause:d,resume:p,update:g};r[b.id]=b;var x,w=0;for(x in r)if(r.hasOwnProperty(x)&&2==++w)break;return 1==w&&v(),b};return y.time=l,y.getById=function(t){return r[t]||null},y.linear=function(t){return t},y.easeout=function(t){return Math.pow(t,1.7)},y.easein=function(t){return Math.pow(t,.48)},y.easeinout=function(t){if(1==t)return 1;if(0==t)return 0;var e=.48-t/1.04,n=Math.sqrt(.1734+e*e),r=n-e,i=-n-e,o=Math.pow(Math.abs(r),1/3)*(r<0?-1:1)+Math.pow(Math.abs(i),1/3)*(i<0?-1:1)+.5;return 3*(1-o)*o*o+o*o*o},y.backin=function(t){if(1==t)return 1;var e=1.70158;return t*t*((e+1)*t-e)},y.backout=function(t){if(0==t)return 0;var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},y.elastic=function(t){return t==!!t?t:Math.pow(2,-10*t)*Math.sin((t-.075)*(2*Math.PI)/.3)+1},y.bounce=function(t){var e=7.5625,n=2.75;return t<1/n?e*t*t:t<2/n?e*(t-=1.5/n)*t+.75:t<2.5/n?e*(t-=2.25/n)*t+.9375:e*(t-=2.625/n)*t+.984375},t.mina=y,y}(void 0===e?function(){}:e),r=function(t){function n(t,e){if(t){if(t.nodeType)return W(t);if(B(t,"array")&&n.set)return n.set.apply(n,t);if(t instanceof q)return t;if(null==e)return W(t=r.doc.querySelector(String(t)))}return new U(t=null==t?"100%":t,e=null==e?"100%":e)}n.version="0.5.1",n.toString=function(){return"Snap v"+this.version},n._={};var r={win:t.window,doc:t.window.document};n._.glob=r;var i,o,a="hasOwnProperty",s=String,l=parseFloat,u=parseInt,c=Math,f=c.max,h=c.min,d=c.abs,p=(c.pow,c.PI),v=(c.round,Object.prototype.toString),y=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?%?)\s*\))\s*$/i,m=(n._.separator=/[,\s]+/,/[\s]*,[\s]*/),b={hs:1,rg:1},x=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,w=/([rstm])[\s,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\s]*,?[\s]*)+)/gi,F=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\s]*,?[\s]*/gi,C=0,k="S"+(+new Date).toString(36),S=function(t){return(t&&t.type?t.type:"")+k+(C++).toString(36)},A="http://www.w3.org/1999/xlink",E="http://www.w3.org/2000/svg",O={};function D(t,e){if(e){if("#text"==t&&(t=r.doc.createTextNode(e.text||e["#text"]||"")),"#comment"==t&&(t=r.doc.createComment(e.text||e["#text"]||"")),"string"==typeof t&&(t=D(t)),"string"==typeof e)return 1==t.nodeType?"xlink:"==e.substring(0,6)?t.getAttributeNS(A,e.substring(6)):"xml:"==e.substring(0,4)?t.getAttributeNS(E,e.substring(4)):t.getAttribute(e):"text"==e?t.nodeValue:null;if(1==t.nodeType){for(var n in e)if(e[a](n)){var i=s(e[n]);i?"xlink:"==n.substring(0,6)?t.setAttributeNS(A,n.substring(6),i):"xml:"==n.substring(0,4)?t.setAttributeNS(E,n.substring(4),i):t.setAttribute(n,i):t.removeAttribute(n)}}else"text"in e&&(t.nodeValue=e.text)}else t=r.doc.createElementNS(E,t);return t}function B(t,e){return"finite"==(e=s.prototype.toLowerCase.call(e))?isFinite(t):!("array"!=e||!(t instanceof Array||Array.isArray&&Array.isArray(t)))||"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||v.call(t).slice(8,-1).toLowerCase()==e}function j(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return t.push(t.splice(n,1)[0])}function P(t,e,n){return function r(){var i=Array.prototype.slice.call(arguments,0),o=i.join("␀"),s=r.cache=r.cache||{},l=r.count=r.count||[];return s[a](o)?(j(l,o),n?n(s[o]):s[o]):(l.length>=1e3&&delete s[l.shift()],l.push(o),s[o]=t.apply(e,i),n?n(s[o]):s[o])}}function M(t){return t%360*p/180}n.url=function(t){return"url('#"+t+"')"},n._.$=D,n._.id=S,n.format=(i=/\{([^\}]+)\}/g,o=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,function(t,e){return s(t).replace(i,(function(t,n){return function(t,e,n){var r=n;return e.replace(o,(function(t,e,n,i,o){e=e||i,r&&(e in r&&(r=r[e]),"function"==typeof r&&o&&(r=r()))})),r=(null==r||r==n?t:r)+""}(t,n,e)}))}),n._.clone=function t(e){if("function"==typeof e||Object(e)!==e)return e;var n=new e.constructor;for(var r in e)e[a](r)&&(n[r]=t(e[r]));return n},n._.cacher=P,n.rad=M,n.deg=function(t){return 180*t/p%360},n.sin=function(t){return c.sin(n.rad(t))},n.tan=function(t){return c.tan(n.rad(t))},n.cos=function(t){return c.cos(n.rad(t))},n.asin=function(t){return n.deg(c.asin(t))},n.acos=function(t){return n.deg(c.acos(t))},n.atan=function(t){return n.deg(c.atan(t))},n.atan2=function(t){return n.deg(c.atan2(t))},n.angle=function t(e,n,r,i,o,a){if(null==o){var s=e-r,l=n-i;return s||l?(180+180*c.atan2(-l,-s)/p+360)%360:0}return t(e,n,o,a)-t(r,i,o,a)},n.len=function(t,e,r,i){return Math.sqrt(n.len2(t,e,r,i))},n.len2=function(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)},n.closestPoint=function(t,e,n){function r(t){var r=t.x-e,i=t.y-n;return r*r+i*i}for(var i,o,a,s,l=t.node,u=l.getTotalLength(),c=u/l.pathSegList.numberOfItems*.125,f=1/0,h=0;h<=u;h+=c)(s=r(a=l.getPointAtLength(h)))<f&&(i=a,o=h,f=s);for(c*=.5;c>.5;){var d,p,g,v,y,m;(g=o-c)>=0&&(y=r(d=l.getPointAtLength(g)))<f?(i=d,o=g,f=y):(v=o+c)<=u&&(m=r(p=l.getPointAtLength(v)))<f?(i=p,o=v,f=m):c*=.5}return i={x:i.x,y:i.y,length:o,distance:Math.sqrt(f)}},n.is=B,n.snapTo=function(t,e,n){if(n=B(n,"finite")?n:10,B(t,"array")){for(var r=t.length;r--;)if(d(t[r]-e)<=n)return t[r]}else{var i=e%(t=+t);if(i<n)return e-i;if(i>t-n)return e-i+t}return e},n.getRGB=P((function(t){if(!t||(t=s(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:I};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:I};if(!b[a](t.toLowerCase().substring(0,2))&&"#"!=t.charAt()&&(t=T(t)),!t)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:I};var e,r,i,o,d,p,g=t.match(y);return g?(g[2]&&(i=u(g[2].substring(5),16),r=u(g[2].substring(3,5),16),e=u(g[2].substring(1,3),16)),g[3]&&(i=u((d=g[3].charAt(3))+d,16),r=u((d=g[3].charAt(2))+d,16),e=u((d=g[3].charAt(1))+d,16)),g[4]&&(p=g[4].split(m),e=l(p[0]),"%"==p[0].slice(-1)&&(e*=2.55),r=l(p[1]),"%"==p[1].slice(-1)&&(r*=2.55),i=l(p[2]),"%"==p[2].slice(-1)&&(i*=2.55),"rgba"==g[1].toLowerCase().slice(0,4)&&(o=l(p[3])),p[3]&&"%"==p[3].slice(-1)&&(o/=100)),g[5]?(p=g[5].split(m),e=l(p[0]),"%"==p[0].slice(-1)&&(e/=100),r=l(p[1]),"%"==p[1].slice(-1)&&(r/=100),i=l(p[2]),"%"==p[2].slice(-1)&&(i/=100),("deg"==p[0].slice(-3)||"°"==p[0].slice(-1))&&(e/=360),"hsba"==g[1].toLowerCase().slice(0,4)&&(o=l(p[3])),p[3]&&"%"==p[3].slice(-1)&&(o/=100),n.hsb2rgb(e,r,i,o)):g[6]?(p=g[6].split(m),e=l(p[0]),"%"==p[0].slice(-1)&&(e/=100),r=l(p[1]),"%"==p[1].slice(-1)&&(r/=100),i=l(p[2]),"%"==p[2].slice(-1)&&(i/=100),("deg"==p[0].slice(-3)||"°"==p[0].slice(-1))&&(e/=360),"hsla"==g[1].toLowerCase().slice(0,4)&&(o=l(p[3])),p[3]&&"%"==p[3].slice(-1)&&(o/=100),n.hsl2rgb(e,r,i,o)):(e=h(c.round(e),255),r=h(c.round(r),255),i=h(c.round(i),255),o=h(f(o,0),1),(g={r:e,g:r,b:i,toString:I}).hex="#"+(16777216|i|r<<8|e<<16).toString(16).slice(1),g.opacity=B(o,"finite")?o:1,g)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:I}}),n),n.hsb=P((function(t,e,r){return n.hsb2rgb(t,e,r).hex})),n.hsl=P((function(t,e,r){return n.hsl2rgb(t,e,r).hex})),n.rgb=P((function(t,e,n,r){if(B(r,"finite")){var i=c.round;return"rgba("+[i(t),i(e),i(n),+r.toFixed(2)]+")"}return"#"+(16777216|n|e<<8|t<<16).toString(16).slice(1)}));var T=function(t){var e=r.doc.getElementsByTagName("head")[0]||r.doc.getElementsByTagName("svg")[0],n="rgb(255, 0, 0)";return(T=P((function(t){if("red"==t.toLowerCase())return n;e.style.color=n,e.style.color=t;var i=r.doc.defaultView.getComputedStyle(e,"").getPropertyValue("color");return i==n?null:i})))(t)},_=function(){return"hsb("+[this.h,this.s,this.b]+")"},L=function(){return"hsl("+[this.h,this.s,this.l]+")"},I=function(){return 1==this.opacity||null==this.opacity?this.hex:"rgba("+[this.r,this.g,this.b,this.opacity]+")"},N=function(t,e,r){if(null==e&&B(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,e=t.g,t=t.r),null==e&&B(t,string)){var i=n.getRGB(t);t=i.r,e=i.g,r=i.b}return(t>1||e>1||r>1)&&(t/=255,e/=255,r/=255),[t,e,r]},R=function(t,e,r,i){var o={r:t=c.round(255*t),g:e=c.round(255*e),b:r=c.round(255*r),opacity:B(i,"finite")?i:1,hex:n.rgb(t,e,r),toString:I};return B(i,"finite")&&(o.opacity=i),o};n.color=function(t){var e;return B(t,"object")&&"h"in t&&"s"in t&&"b"in t?(e=n.hsb2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.opacity=1,t.hex=e.hex):B(t,"object")&&"h"in t&&"s"in t&&"l"in t?(e=n.hsl2rgb(t),t.r=e.r,t.g=e.g,t.b=e.b,t.opacity=1,t.hex=e.hex):(B(t,"string")&&(t=n.getRGB(t)),B(t,"object")&&"r"in t&&"g"in t&&"b"in t&&!("error"in t)?(e=n.rgb2hsl(t),t.h=e.h,t.s=e.s,t.l=e.l,e=n.rgb2hsb(t),t.v=e.b):((t={hex:"none"}).r=t.g=t.b=t.h=t.s=t.v=t.l=-1,t.error=1)),t.toString=I,t},n.hsb2rgb=function(t,e,n,r){var i,o,a,s,l;return B(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(n=t.b,e=t.s,r=t.o,t=t.h),s=(l=n*e)*(1-d((t=(t*=360)%360/60)%2-1)),i=o=a=n-l,R(i+=[l,s,0,0,s,l][t=~~t],o+=[s,l,l,s,0,0][t],a+=[0,0,s,l,l,s][t],r)},n.hsl2rgb=function(t,e,n,r){var i,o,a,s,l;return B(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(n=t.l,e=t.s,t=t.h),(t>1||e>1||n>1)&&(t/=360,e/=100,n/=100),s=(l=2*e*(n<.5?n:1-n))*(1-d((t=(t*=360)%360/60)%2-1)),i=o=a=n-l/2,R(i+=[l,s,0,0,s,l][t=~~t],o+=[s,l,l,s,0,0][t],a+=[0,0,s,l,l,s][t],r)},n.rgb2hsb=function(t,e,n){var r,i;return t=(n=N(t,e,n))[0],e=n[1],n=n[2],{h:((0==(i=(r=f(t,e,n))-h(t,e,n))?null:r==t?(e-n)/i:r==e?(n-t)/i+2:(t-e)/i+4)+360)%6*60/360,s:0==i?0:i/r,b:r,toString:_}},n.rgb2hsl=function(t,e,n){var r,i,o,a;return t=(n=N(t,e,n))[0],e=n[1],n=n[2],r=((i=f(t,e,n))+(o=h(t,e,n)))/2,{h:((0==(a=i-o)?null:i==t?(e-n)/a:i==e?(n-t)/a+2:(t-e)/a+4)+360)%6*60/360,s:0==a?0:r<.5?a/(2*r):a/(2-2*r),l:r,toString:L}},n.parsePathString=function(t){if(!t)return null;var e=n.path(t);if(e.arr)return n.path.clone(e.arr);var r={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return B(t,"array")&&B(t[0],"array")&&(i=n.path.clone(t)),i.length||s(t).replace(x,(function(t,e,n){var o=[],a=e.toLowerCase();if(n.replace(F,(function(t,e){e&&o.push(+e)})),"m"==a&&o.length>2&&(i.push([e].concat(o.splice(0,2))),a="l",e="m"==e?"l":"L"),"o"==a&&1==o.length&&i.push([e,o[0]]),"r"==a)i.push([e].concat(o));else for(;o.length>=r[a]&&(i.push([e].concat(o.splice(0,r[a]))),r[a]););})),i.toString=n.path.toString,e.arr=n.path.clone(i),i};var Y=n.parseTransformString=function(t){if(!t)return null;var e=[];return B(t,"array")&&B(t[0],"array")&&(e=n.path.clone(t)),e.length||s(t).replace(w,(function(t,n,r){var i=[];n.toLowerCase(),r.replace(F,(function(t,e){e&&i.push(+e)})),e.push([n].concat(i))})),e.toString=n.path.toString,e};function z(t){return t.node.ownerSVGElement&&W(t.node.ownerSVGElement)||n.select("svg")}function X(t){B(t,"array")||(t=Array.prototype.slice.call(arguments,0));for(var e=0,n=0,r=this.node;this[e];)delete this[e++];for(e=0;e<t.length;e++)"set"==t[e].type?t[e].forEach((function(t){r.appendChild(t.node)})):r.appendChild(t[e].node);var i=r.childNodes;for(e=0;e<i.length;e++)this[n++]=W(i[e]);return this}function q(t){if(t.snap in O)return O[t.snap];var e;try{e=t.ownerSVGElement}catch(t){}this.node=t,e&&(this.paper=new U(e)),this.type=t.tagName||t.nodeName;var n=this.id=S(this);if(this.anims={},this._={transform:[]},t.snap=n,O[n]=this,"g"==this.type&&(this.add=X),this.type in{g:1,mask:1,pattern:1,symbol:1})for(var r in U.prototype)U.prototype[a](r)&&(this[r]=U.prototype[r])}function G(t){this.node=t}function V(t,e){var n=D(t);return e.appendChild(n),W(n)}function U(t,e){var n,i,o,s=U.prototype;if(t&&t.tagName&&"svg"==t.tagName.toLowerCase()){if(t.snap in O)return O[t.snap];var l=t.ownerDocument;for(var u in n=new q(t),i=t.getElementsByTagName("desc")[0],o=t.getElementsByTagName("defs")[0],i||((i=D("desc")).appendChild(l.createTextNode("Created with Snap")),n.node.appendChild(i)),o||(o=D("defs"),n.node.appendChild(o)),n.defs=o,s)s[a](u)&&(n[u]=s[u]);n.paper=n.root=n}else D((n=V("svg",r.doc.body)).node,{height:e,version:1.1,width:t,xmlns:E});return n}function W(t){return t?t instanceof q||t instanceof G?t:t.tagName&&"svg"==t.tagName.toLowerCase()?new U(t):t.tagName&&"object"==t.tagName.toLowerCase()&&"image/svg+xml"==t.type?new U(t.contentDocument.getElementsByTagName("svg")[0]):new q(t):t}n._.svgTransform2string=function(t){var e=[];return t=t.replace(/(?:^|\s)(\w+)\(([^)]+)\)/g,(function(t,n,r){return r=r.split(/\s*,\s*|\s+/),"rotate"==n&&1==r.length&&r.push(0,0),"scale"==n&&(r.length>2?r=r.slice(0,2):2==r.length&&r.push(0,0),1==r.length&&r.push(r[0],0,0)),"skewX"==n?e.push(["m",1,0,c.tan(M(r[0])),1,0,0]):"skewY"==n?e.push(["m",1,c.tan(M(r[0])),0,1,0,0]):e.push([n.charAt(0)].concat(r)),t})),e},n._.rgTransform=/^[a-z][\s]*-?\.?\d/i,n._.transform2matrix=function(t,e){var r=Y(t),i=new n.Matrix;if(r)for(var o=0,a=r.length;o<a;o++){var l,u,c,f,h,d=r[o],p=d.length,g=s(d[0]).toLowerCase(),v=d[0]!=g,y=v?i.invert():0;"t"==g&&2==p?i.translate(d[1],0):"t"==g&&3==p?v?(l=y.x(0,0),u=y.y(0,0),c=y.x(d[1],d[2]),f=y.y(d[1],d[2]),i.translate(c-l,f-u)):i.translate(d[1],d[2]):"r"==g?2==p?(h=h||e,i.rotate(d[1],h.x+h.width/2,h.y+h.height/2)):4==p&&(v?(c=y.x(d[2],d[3]),f=y.y(d[2],d[3]),i.rotate(d[1],c,f)):i.rotate(d[1],d[2],d[3])):"s"==g?2==p||3==p?(h=h||e,i.scale(d[1],d[p-1],h.x+h.width/2,h.y+h.height/2)):4==p?v?(c=y.x(d[2],d[3]),f=y.y(d[2],d[3]),i.scale(d[1],d[1],c,f)):i.scale(d[1],d[1],d[2],d[3]):5==p&&(v?(c=y.x(d[3],d[4]),f=y.y(d[3],d[4]),i.scale(d[1],d[2],c,f)):i.scale(d[1],d[2],d[3],d[4])):"m"==g&&7==p&&i.add(d[1],d[2],d[3],d[4],d[5],d[6])}return i},n._unit2px=function(t,e,n){var r=z(t).node,i={},o=r.querySelector(".svg---mgr");function a(t){if(null==t)return"";if(t==+t)return t;D(o,{width:t});try{return o.getBBox().width}catch(t){return 0}}function s(t){if(null==t)return"";if(t==+t)return t;D(o,{height:t});try{return o.getBBox().height}catch(t){return 0}}function l(r,o){null==e?i[r]=o(t.attr(r)||0):r==e&&(i=o(null==n?t.attr(r)||0:n))}switch(o||(o=D("rect"),D(o,{x:-9e9,y:-9e9,width:10,height:10,class:"svg---mgr",fill:"none"}),r.appendChild(o)),t.type){case"rect":l("rx",a),l("ry",s);case"image":l("width",a),l("height",s);case"text":l("x",a),l("y",s);break;case"circle":l("cx",a),l("cy",s),l("r",a);break;case"ellipse":l("cx",a),l("cy",s),l("rx",a),l("ry",s);break;case"line":l("x1",a),l("x2",a),l("y1",s),l("y2",s);break;case"marker":l("refX",a),l("markerWidth",a),l("refY",s),l("markerHeight",s);break;case"radialGradient":l("fx",a),l("fy",s);break;case"tspan":l("dx",a),l("dy",s);break;default:l(e,a)}return r.removeChild(o),i},r.doc.contains||r.doc.compareDocumentPosition,n._.getSomeDefs=function(t){var e=t.node.ownerSVGElement&&W(t.node.ownerSVGElement)||t.node.parentNode&&W(t.node.parentNode)||n.select("svg")||n(0,0),r=e.select("defs"),i=null!=r&&r.node;return i||(i=V("defs",e.node).node),i},n._.getSomeSVG=z,n.select=function(t){return t=s(t).replace(/([^\\]):/g,"$1\\:"),W(r.doc.querySelector(t))},n.selectAll=function(t){for(var e=r.doc.querySelectorAll(t),i=(n.set||Array)(),o=0;o<e.length;o++)i.push(W(e[o]));return i},setInterval((function(){for(var t in O)if(O[a](t)){var e=O[t],n=e.node;("svg"!=e.type&&!n.ownerSVGElement||"svg"==e.type&&(!n.parentNode||"ownerSVGElement"in n.parentNode&&!n.ownerSVGElement))&&delete O[t]}}),1e4),q.prototype.attr=function(t,n){var r=this,i=r.node;if(!t){if(1!=i.nodeType)return{text:i.nodeValue};for(var o=i.attributes,s={},l=0,u=o.length;l<u;l++)s[o[l].nodeName]=o[l].nodeValue;return s}if(B(t,"string")){if(!(arguments.length>1))return e("snap.util.getattr."+t,r).firstDefined();var c={};c[t]=n,t=c}for(var f in t)t[a](f)&&e("snap.util.attr."+f,r,t[f]);return r},n.parse=function(t){var e=r.doc.createDocumentFragment(),n=!0,i=r.doc.createElement("div");if((t=s(t)).match(/^\s*<\s*svg(?:\s|>)/)||(t="<svg>"+t+"</svg>",n=!1),i.innerHTML=t,t=i.getElementsByTagName("svg")[0])if(n)e=t;else for(;t.firstChild;)e.appendChild(t.firstChild);return new G(e)},n.fragment=function(){for(var t=Array.prototype.slice.call(arguments,0),e=r.doc.createDocumentFragment(),i=0,o=t.length;i<o;i++){var a=t[i];a.node&&a.node.nodeType&&e.appendChild(a.node),a.nodeType&&e.appendChild(a),"string"==typeof a&&e.appendChild(n.parse(a).node)}return new G(e)},n._.make=V,n._.wrap=W,U.prototype.el=function(t,e){var n=V(t,this.node);return e&&n.attr(e),n},q.prototype.children=function(){for(var t=[],e=this.node.childNodes,r=0,i=e.length;r<i;r++)t[r]=n(e[r]);return t},q.prototype.toJSON=function(){var t=[];return function t(e,n){for(var r=0,i=e.length;r<i;r++){var o={type:e[r].type,attr:e[r].attr()},a=e[r].children();n.push(o),a.length&&t(a,o.childNodes=[])}}([this],t),t[0]},e.on("snap.util.getattr",(function(){var t=e.nt(),n=(t=t.substring(t.lastIndexOf(".")+1)).replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));return $[a](n)?this.node.ownerDocument.defaultView.getComputedStyle(this.node,null).getPropertyValue(n):D(this.node,t)}));var $={"alignment-baseline":0,"baseline-shift":0,clip:0,"clip-path":0,"clip-rule":0,color:0,"color-interpolation":0,"color-interpolation-filters":0,"color-profile":0,"color-rendering":0,cursor:0,direction:0,display:0,"dominant-baseline":0,"enable-background":0,fill:0,"fill-opacity":0,"fill-rule":0,filter:0,"flood-color":0,"flood-opacity":0,font:0,"font-family":0,"font-size":0,"font-size-adjust":0,"font-stretch":0,"font-style":0,"font-variant":0,"font-weight":0,"glyph-orientation-horizontal":0,"glyph-orientation-vertical":0,"image-rendering":0,kerning:0,"letter-spacing":0,"lighting-color":0,marker:0,"marker-end":0,"marker-mid":0,"marker-start":0,mask:0,opacity:0,overflow:0,"pointer-events":0,"shape-rendering":0,"stop-color":0,"stop-opacity":0,stroke:0,"stroke-dasharray":0,"stroke-dashoffset":0,"stroke-linecap":0,"stroke-linejoin":0,"stroke-miterlimit":0,"stroke-opacity":0,"stroke-width":0,"text-anchor":0,"text-decoration":0,"text-rendering":0,"unicode-bidi":0,visibility:0,"word-spacing":0,"writing-mode":0};return e.on("snap.util.attr",(function(t){var n=e.nt(),r={};r[n=n.substring(n.lastIndexOf(".")+1)]=t;var i=n.replace(/-(\w)/gi,(function(t,e){return e.toUpperCase()})),o=n.replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}));$[a](o)?this.node.style[i]=null==t?"":t:D(this.node,r)})),U.prototype,n.ajax=function(t,n,r,i){var o=new XMLHttpRequest,a=S();if(o){if(B(n,"function"))i=r,r=n,n=null;else if(B(n,"object")){var s=[];for(var l in n)n.hasOwnProperty(l)&&s.push(encodeURIComponent(l)+"="+encodeURIComponent(n[l]));n=s.join("&")}return o.open(n?"POST":"GET",t,!0),n&&(o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.setRequestHeader("Content-type","application/x-www-form-urlencoded")),r&&(e.once("snap.ajax."+a+".0",r),e.once("snap.ajax."+a+".200",r),e.once("snap.ajax."+a+".304",r)),o.onreadystatechange=function(){4==o.readyState&&e("snap.ajax."+a+"."+o.status,i,o)},4==o.readyState||o.send(n),o}},n.load=function(t,e,r){n.ajax(t,(function(t){var i=n.parse(t.responseText);r?e.call(r,i):e(i)}))},n.getElementByPoint=function(t,e){this.canvas;var n,i,o,a,s,l,u,c=r.doc.elementFromPoint(t,e);if(r.win.opera&&"svg"==c.tagName){var f=(i=(n=c).getBoundingClientRect(),o=n.ownerDocument,a=o.body,s=o.documentElement,l=s.clientTop||a.clientTop||0,u=s.clientLeft||a.clientLeft||0,{y:i.top+(g.win.pageYOffset||s.scrollTop||a.scrollTop)-l,x:i.left+(g.win.pageXOffset||s.scrollLeft||a.scrollLeft)-u}),h=c.createSVGRect();h.x=t-f.x,h.y=e-f.y,h.width=h.height=1;var d=c.getIntersectionList(h,null);d.length&&(c=d[d.length-1])}return c?W(c):null},n.plugin=function(t){t(n,q,U,r,G)},r.win.Snap=n,n}(t||this);return r.plugin((function(n,r,i,o,a){var s=r.prototype,l=n.is,u=String,c=n._unit2px,f=n._.$,h=n._.make,d=n._.getSomeDefs,p="hasOwnProperty",g=n._.wrap;s.getBBox=function(t){if("tspan"==this.type)return n._.box(this.node.getClientRects().item(0));if(!n.Matrix||!n.path)return this.node.getBBox();var e=this,r=new n.Matrix;if(e.removed)return n._.box();for(;"use"==e.type;)if(t||(r=r.add(e.transform().localMatrix.translate(e.attr("x")||0,e.attr("y")||0))),e.original)e=e.original;else{var i=e.attr("xlink:href");e=e.original=e.node.ownerDocument.getElementById(i.substring(i.indexOf("#")+1))}var o=e._,a=n.path.get[e.type]||n.path.get.deflt;try{return t?(o.bboxwt=a?n.path.getBBox(e.realPath=a(e)):n._.box(e.node.getBBox()),n._.box(o.bboxwt)):(e.realPath=a(e),e.matrix=e.transform().localMatrix,o.bbox=n.path.getBBox(n.path.map(e.realPath,r.add(e.matrix))),n._.box(o.bbox))}catch(t){return n._.box()}};var v=function(){return this.string};function y(t,e){if(null==e){var r=!0;if(!(e="linearGradient"==t.type||"radialGradient"==t.type?t.node.getAttribute("gradientTransform"):"pattern"==t.type?t.node.getAttribute("patternTransform"):t.node.getAttribute("transform")))return new n.Matrix;e=n._.svgTransform2string(e)}else e=n._.rgTransform.test(e)?u(e).replace(/\.{3}|\u2026/g,t._.transform||""):n._.svgTransform2string(e),l(e,"array")&&(e=n.path?n.path.toString.call(e):u(e)),t._.transform=e;var i=n._.transform2matrix(e,t.getBBox(1));if(r)return i;t.matrix=i}s.transform=function(t){var e=this._;if(null==t){for(var r,i=this,o=new n.Matrix(this.node.getCTM()),a=y(this),s=[a],l=new n.Matrix,c=a.toTransformString(),h=u(a)==u(this.matrix)?u(e.transform):c;"svg"!=i.type&&(i=i.parent());)s.push(y(i));for(r=s.length;r--;)l.add(s[r]);return{string:h,globalMatrix:o,totalMatrix:l,localMatrix:a,diffMatrix:o.clone().add(a.invert()),global:o.toTransformString(),total:l.toTransformString(),local:c,toString:v}}return t instanceof n.Matrix?(this.matrix=t,this._.transform=t.toTransformString()):y(this,t),this.node&&("linearGradient"==this.type||"radialGradient"==this.type?f(this.node,{gradientTransform:this.matrix}):"pattern"==this.type?f(this.node,{patternTransform:this.matrix}):f(this.node,{transform:this.matrix})),this},s.parent=function(){return g(this.node.parentNode)},s.append=s.add=function(t){if(t){if("set"==t.type){var e=this;return t.forEach((function(t){e.add(t)})),this}t=g(t),this.node.appendChild(t.node),t.paper=this.paper}return this},s.appendTo=function(t){return t&&(t=g(t)).append(this),this},s.prepend=function(t){if(t){if("set"==t.type){var e,n=this;return t.forEach((function(t){e?e.after(t):n.prepend(t),e=t})),this}var r=(t=g(t)).parent();this.node.insertBefore(t.node,this.node.firstChild),this.add&&this.add(),t.paper=this.paper,this.parent()&&this.parent().add(),r&&r.add()}return this},s.prependTo=function(t){return(t=g(t)).prepend(this),this},s.before=function(t){if("set"==t.type){var e=this;return t.forEach((function(t){var n=t.parent();e.node.parentNode.insertBefore(t.node,e.node),n&&n.add()})),this.parent().add(),this}var n=(t=g(t)).parent();return this.node.parentNode.insertBefore(t.node,this.node),this.parent()&&this.parent().add(),n&&n.add(),t.paper=this.paper,this},s.after=function(t){var e=(t=g(t)).parent();return this.node.nextSibling?this.node.parentNode.insertBefore(t.node,this.node.nextSibling):this.node.parentNode.appendChild(t.node),this.parent()&&this.parent().add(),e&&e.add(),t.paper=this.paper,this},s.insertBefore=function(t){t=g(t);var e=this.parent();return t.node.parentNode.insertBefore(this.node,t.node),this.paper=t.paper,e&&e.add(),t.parent()&&t.parent().add(),this},s.insertAfter=function(t){t=g(t);var e=this.parent();return t.node.parentNode.insertBefore(this.node,t.node.nextSibling),this.paper=t.paper,e&&e.add(),t.parent()&&t.parent().add(),this},s.remove=function(){var t=this.parent();return this.node.parentNode&&this.node.parentNode.removeChild(this.node),delete this.paper,this.removed=!0,t&&t.add(),this},s.select=function(t){return g(this.node.querySelector(t))},s.selectAll=function(t){for(var e=this.node.querySelectorAll(t),r=(n.set||Array)(),i=0;i<e.length;i++)r.push(g(e[i]));return r},s.asPX=function(t,e){return null==e&&(e=this.attr(t)),+c(this,t,e)},s.use=function(){var t,e=this.node.id;return e||(e=this.id,f(this.node,{id:e})),t="linearGradient"==this.type||"radialGradient"==this.type||"pattern"==this.type?h(this.type,this.node.parentNode):h("use",this.node.parentNode),f(t.node,{"xlink:href":"#"+e}),t.original=this,t},s.clone=function(){var t=g(this.node.cloneNode(!0));return f(t.node,"id")&&f(t.node,{id:t.id}),function(t){var e,r=t.selectAll("*"),i=/^\s*url\(("|'|)(.*)\1\)\s*$/,o=[],a={};function s(t,e){var r=f(t.node,e);(r=(r=r&&r.match(i))&&r[2])&&"#"==r.charAt()&&(r=r.substring(1))&&(a[r]=(a[r]||[]).concat((function(r){var i={};i[e]=n.url(r),f(t.node,i)})))}function l(t){var e=f(t.node,"xlink:href");e&&"#"==e.charAt()&&(e=e.substring(1))&&(a[e]=(a[e]||[]).concat((function(e){t.attr("xlink:href","#"+e)})))}for(var u=0,c=r.length;u<c;u++){s(e=r[u],"fill"),s(e,"stroke"),s(e,"filter"),s(e,"mask"),s(e,"clip-path"),l(e);var h=f(e.node,"id");h&&(f(e.node,{id:e.id}),o.push({old:h,id:e.id}))}for(u=0,c=o.length;u<c;u++){var d=a[o[u].old];if(d)for(var p=0,g=d.length;p<g;p++)d[p](o[u].id)}}(t),t.insertAfter(this),t},s.toDefs=function(){return d(this).appendChild(this.node),this},s.pattern=s.toPattern=function(t,e,n,r){var i=h("pattern",d(this));return null==t&&(t=this.getBBox()),l(t,"object")&&"x"in t&&(e=t.y,n=t.width,r=t.height,t=t.x),f(i.node,{x:t,y:e,width:n,height:r,patternUnits:"userSpaceOnUse",id:i.id,viewBox:[t,e,n,r].join(" ")}),i.node.appendChild(this.node),i},s.marker=function(t,e,n,r,i,o){var a=h("marker",d(this));return null==t&&(t=this.getBBox()),l(t,"object")&&"x"in t&&(e=t.y,n=t.width,r=t.height,i=t.refX||t.cx,o=t.refY||t.cy,t=t.x),f(a.node,{viewBox:[t,e,n,r].join(" "),markerWidth:n,markerHeight:r,orient:"auto",refX:i||0,refY:o||0,id:a.id}),a.node.appendChild(this.node),a};var m={};function b(t){return function(){var e=t?"<"+this.type:"",n=this.node.attributes,r=this.node.childNodes;if(t)for(var i=0,o=n.length;i<o;i++)e+=" "+n[i].name+'="'+n[i].value.replace(/"/g,'\\"')+'"';if(r.length){for(t&&(e+=">"),i=0,o=r.length;i<o;i++)3==r[i].nodeType?e+=r[i].nodeValue:1==r[i].nodeType&&(e+=g(r[i]).toString());t&&(e+="</"+this.type+">")}else t&&(e+="/>");return e}}s.data=function(t,r){var i=m[this.id]=m[this.id]||{};if(0==arguments.length)return e("snap.data.get."+this.id,this,i,null),i;if(1==arguments.length){if(n.is(t,"object")){for(var o in t)t[p](o)&&this.data(o,t[o]);return this}return e("snap.data.get."+this.id,this,i[t],t),i[t]}return i[t]=r,e("snap.data.set."+this.id,this,r,t),this},s.removeData=function(t){return null==t?m[this.id]={}:m[this.id]&&delete m[this.id][t],this},s.outerSVG=s.toString=b(1),s.innerSVG=b(),s.toDataURL=function(){if(t&&t.btoa){var e=this.getBBox(),r=n.format('<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="{width}" height="{height}" viewBox="{x} {y} {width} {height}">{contents}</svg>',{x:+e.x.toFixed(3),y:+e.y.toFixed(3),width:+e.width.toFixed(3),height:+e.height.toFixed(3),contents:this.outerSVG()});return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(r)))}},a.prototype.select=s.select,a.prototype.selectAll=s.selectAll})),r.plugin((function(t,r,i,o,a){var s=r.prototype,l=t.is,u=String,c="hasOwnProperty";function f(t,e,n){return function(r){var i=r.slice(t,e);return 1==i.length&&(i=i[0]),n?n(i):i}}var h=function(t,e,r,i){"function"!=typeof r||r.length||(i=r,r=n.linear),this.attr=t,this.dur=e,r&&(this.easing=r),i&&(this.callback=i)};t._.Animation=h,t.animation=function(t,e,n,r){return new h(t,e,n,r)},s.inAnim=function(){var t=[];for(var e in this.anims)this.anims[c](e)&&function(e){t.push({anim:new h(e._attrs,e.dur,e.easing,e._callback),mina:e,curStatus:e.status(),status:function(t){return e.status(t)},stop:function(){e.stop()}})}(this.anims[e]);return t},t.animate=function(t,r,i,o,a,s){"function"!=typeof a||a.length||(s=a,a=n.linear);var l=n.time(),u=n(t,r,l,l+o,n.time,i,a);return s&&e.once("mina.finish."+u.id,s),u},s.stop=function(){for(var t=this.inAnim(),e=0,n=t.length;e<n;e++)t[e].stop();return this},s.animate=function(t,r,i,o){"function"!=typeof i||i.length||(o=i,i=n.linear),t instanceof h&&(o=t.callback,i=t.easing,r=t.dur,t=t.attr);var a,s,d,p,g=[],v=[],y={},m=this;for(var b in t)if(t[c](b)){m.equal?(a=(p=m.equal(b,u(t[b]))).from,s=p.to,d=p.f):(a=+m.attr(b),s=+t[b]);var x=l(a,"array")?a.length:1;y[b]=f(g.length,g.length+x,d),g=g.concat(a),v=v.concat(s)}var w=n.time(),F=n(g,v,w,w+r,n.time,(function(t){var e={};for(var n in y)y[c](n)&&(e[n]=y[n](t));m.attr(e)}),i);return m.anims[F.id]=F,F._attrs=t,F._callback=o,e("snap.animcreated."+m.id,F),e.once("mina.finish."+F.id,(function(){e.off("mina.*."+F.id),delete m.anims[F.id],o&&o.call(m)})),e.once("mina.stop."+F.id,(function(){e.off("mina.*."+F.id),delete m.anims[F.id]})),m}})),r.plugin((function(t,e,n,r,i){var o=Object.prototype.toString,a=String,s=Math;function l(t,e,n,r,i,a){if(null==e&&"[object SVGMatrix]"==o.call(t))return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.e=t.e,void(this.f=t.f);null!=t?(this.a=+t,this.b=+e,this.c=+n,this.d=+r,this.e=+i,this.f=+a):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}!function(e){function n(t){return t[0]*t[0]+t[1]*t[1]}function r(t){var e=s.sqrt(n(t));t[0]&&(t[0]/=e),t[1]&&(t[1]/=e)}e.add=function(t,e,n,r,i,o){if(t&&t instanceof l)return this.add(t.a,t.b,t.c,t.d,t.e,t.f);var a=t*this.a+e*this.c,s=t*this.b+e*this.d;return this.e+=i*this.a+o*this.c,this.f+=i*this.b+o*this.d,this.c=n*this.a+r*this.c,this.d=n*this.b+r*this.d,this.a=a,this.b=s,this},l.prototype.multLeft=function(t,e,n,r,i,o){if(t&&t instanceof l)return this.multLeft(t.a,t.b,t.c,t.d,t.e,t.f);var a=t*this.a+n*this.b,s=t*this.c+n*this.d,u=t*this.e+n*this.f+i;return this.b=e*this.a+r*this.b,this.d=e*this.c+r*this.d,this.f=e*this.e+r*this.f+o,this.a=a,this.c=s,this.e=u,this},e.invert=function(){var t=this,e=t.a*t.d-t.b*t.c;return new l(t.d/e,-t.b/e,-t.c/e,t.a/e,(t.c*t.f-t.d*t.e)/e,(t.b*t.e-t.a*t.f)/e)},e.clone=function(){return new l(this.a,this.b,this.c,this.d,this.e,this.f)},e.translate=function(t,e){return this.e+=t*this.a+e*this.c,this.f+=t*this.b+e*this.d,this},e.scale=function(t,e,n,r){return null==e&&(e=t),(n||r)&&this.translate(n,r),this.a*=t,this.b*=t,this.c*=e,this.d*=e,(n||r)&&this.translate(-n,-r),this},e.rotate=function(e,n,r){e=t.rad(e),n=n||0,r=r||0;var i=+s.cos(e).toFixed(9),o=+s.sin(e).toFixed(9);return this.add(i,o,-o,i,n,r),this.add(1,0,0,1,-n,-r)},e.skewX=function(t){return this.skew(t,0)},e.skewY=function(t){return this.skew(0,t)},e.skew=function(e,n){e=e||0,n=n||0,e=t.rad(e),n=t.rad(n);var r=s.tan(e).toFixed(9),i=s.tan(n).toFixed(9);return this.add(1,i,r,1,0,0)},e.x=function(t,e){return t*this.a+e*this.c+this.e},e.y=function(t,e){return t*this.b+e*this.d+this.f},e.get=function(t){return+this[a.fromCharCode(97+t)].toFixed(4)},e.toString=function(){return"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")"},e.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},e.determinant=function(){return this.a*this.d-this.b*this.c},e.split=function(){var e={};e.dx=this.e,e.dy=this.f;var i=[[this.a,this.b],[this.c,this.d]];e.scalex=s.sqrt(n(i[0])),r(i[0]),e.shear=i[0][0]*i[1][0]+i[0][1]*i[1][1],i[1]=[i[1][0]-i[0][0]*e.shear,i[1][1]-i[0][1]*e.shear],e.scaley=s.sqrt(n(i[1])),r(i[1]),e.shear/=e.scaley,this.determinant()<0&&(e.scalex=-e.scalex);var o=i[0][1],a=i[1][1];return a<0?(e.rotate=t.deg(s.acos(a)),o<0&&(e.rotate=360-e.rotate)):e.rotate=t.deg(s.asin(o)),e.isSimple=!(+e.shear.toFixed(9)||e.scalex.toFixed(9)!=e.scaley.toFixed(9)&&e.rotate),e.isSuperSimple=!+e.shear.toFixed(9)&&e.scalex.toFixed(9)==e.scaley.toFixed(9)&&!e.rotate,e.noRotation=!+e.shear.toFixed(9)&&!e.rotate,e},e.toTransformString=function(t){var e=t||this.split();return+e.shear.toFixed(9)?"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]:(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[+e.dx.toFixed(4),+e.dy.toFixed(4)]:"")+(e.rotate?"r"+[+e.rotate.toFixed(4),0,0]:"")+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:""))}}(l.prototype),t.Matrix=l,t.matrix=function(t,e,n,r,i,o){return new l(t,e,n,r,i,o)}})),r.plugin((function(t,n,r,i,o){var a,s=t._.make,l=t._.wrap,u=t.is,c=t._.getSomeDefs,f=/^url\((['"]?)([^)]+)\1\)$/,h=t._.$,d=t.url,p=String,g=t._.separator;function v(r){return function(i){if(e.stop(),i instanceof o&&1==i.node.childNodes.length&&("radialGradient"==i.node.firstChild.tagName||"linearGradient"==i.node.firstChild.tagName||"pattern"==i.node.firstChild.tagName)&&(i=i.node.firstChild,c(this).appendChild(i),i=l(i)),i instanceof n)if("radialGradient"==i.type||"linearGradient"==i.type||"pattern"==i.type){i.node.id||h(i.node,{id:i.id});var a=d(i.node.id)}else a=i.attr(r);else if((a=t.color(i)).error){var s=t(c(this).ownerSVGElement).gradient(i);s?(s.node.id||h(s.node,{id:s.id}),a=d(s.node.id)):a=i}else a=p(a);var u={};u[r]=a,h(this.node,u),this.node.style[r]=""}}t.deurl=function(t){var e=String(t).match(f);return e?e[2]:t},e.on("snap.util.attr.mask",(function(t){if(t instanceof n||t instanceof o){if(e.stop(),t instanceof o&&1==t.node.childNodes.length&&(t=t.node.firstChild,c(this).appendChild(t),t=l(t)),"mask"==t.type)var r=t;else(r=s("mask",c(this))).node.appendChild(t.node);!r.node.id&&h(r.node,{id:r.id}),h(this.node,{mask:d(r.id)})}})),a=function(t){if(t instanceof n||t instanceof o){e.stop();for(var r,i=t.node;i;){if("clipPath"===i.nodeName){r=new n(i);break}if("svg"===i.nodeName){r=void 0;break}i=i.parentNode}r||((r=s("clipPath",c(this))).node.appendChild(t.node),!r.node.id&&h(r.node,{id:r.id})),h(this.node,{"clip-path":d(r.node.id||r.id)})}},e.on("snap.util.attr.clip",a),e.on("snap.util.attr.clip-path",a),e.on("snap.util.attr.clipPath",a),e.on("snap.util.attr.fill",v("fill")),e.on("snap.util.attr.stroke",v("stroke"));var y=/^([lr])(?:\(([^)]*)\))?(.*)$/i;function m(t){e.stop(),t==+t&&(t+="px"),this.node.style.fontSize=t}function b(){return e.stop(),this.node.style.fontSize}e.on("snap.util.grad.parse",(function(t){var e=(t=p(t)).match(y);if(!e)return null;var n=e[1],r=e[2],i=e[3];1==(r=r.split(/\s*,\s*/).map((function(t){return+t==t?+t:t}))).length&&0==r[0]&&(r=[]);var o=(i=(i=i.split("-")).map((function(t){var e={color:(t=t.split(":"))[0]};return t[1]&&(e.offset=parseFloat(t[1])),e}))).length,a=0,s=0;function l(t,e){for(var n=(e-a)/(t-s),r=s;r<t;r++)i[r].offset=+(+a+n*(r-s)).toFixed(2);s=t,a=e}o--;for(var u=0;u<o;u++)"offset"in i[u]&&l(u,i[u].offset);return i[o].offset=i[o].offset||100,l(o,i[o].offset),{type:n,params:r,stops:i}})),e.on("snap.util.attr.d",(function(n){e.stop(),u(n,"array")&&u(n[0],"array")&&(n=t.path.toString.call(n)),(n=p(n)).match(/[ruo]/i)&&(n=t.path.toAbsolute(n)),h(this.node,{d:n})}))(-1),e.on("snap.util.attr.#text",(function(t){e.stop(),t=p(t);for(var n=i.doc.createTextNode(t);this.node.firstChild;)this.node.removeChild(this.node.firstChild);this.node.appendChild(n)}))(-1),e.on("snap.util.attr.path",(function(t){e.stop(),this.attr({d:t})}))(-1),e.on("snap.util.attr.class",(function(t){e.stop(),this.node.className.baseVal=t}))(-1),e.on("snap.util.attr.viewBox",(function(t){var n;n=u(t,"object")&&"x"in t?[t.x,t.y,t.width,t.height].join(" "):u(t,"array")?t.join(" "):t,h(this.node,{viewBox:n}),e.stop()}))(-1),e.on("snap.util.attr.transform",(function(t){this.transform(t),e.stop()}))(-1),e.on("snap.util.attr.r",(function(t){"rect"==this.type&&(e.stop(),h(this.node,{rx:t,ry:t}))}))(-1),e.on("snap.util.attr.textpath",(function(t){if(e.stop(),"text"==this.type){var r,i,o;if(!t&&this.textPath){for(i=this.textPath;i.node.firstChild;)this.node.appendChild(i.node.firstChild);return i.remove(),void delete this.textPath}if(u(t,"string")){var a=c(this),s=l(a.parentNode).path(t);a.appendChild(s.node),r=s.id,s.attr({id:r})}else(t=l(t))instanceof n&&((r=t.attr("id"))||(r=t.id,t.attr({id:r})));if(r)if(i=this.textPath,o=this.node,i)i.attr({"xlink:href":"#"+r});else{for(i=h("textPath",{"xlink:href":"#"+r});o.firstChild;)i.appendChild(o.firstChild);o.appendChild(i),this.textPath=l(i)}}}))(-1),e.on("snap.util.attr.text",(function(t){if("text"==this.type){for(var n=this.node,r=function(t){var e=h("tspan");if(u(t,"array"))for(var n=0;n<t.length;n++)e.appendChild(r(t[n]));else e.appendChild(i.doc.createTextNode(t));return e.normalize&&e.normalize(),e};n.firstChild;)n.removeChild(n.firstChild);for(var o=r(t);o.firstChild;)n.appendChild(o.firstChild)}e.stop()}))(-1),e.on("snap.util.attr.fontSize",m)(-1),e.on("snap.util.attr.font-size",m)(-1),e.on("snap.util.getattr.transform",(function(){return e.stop(),this.transform()}))(-1),e.on("snap.util.getattr.textpath",(function(){return e.stop(),this.textPath}))(-1),function(){function n(n){return function(){e.stop();var r=i.doc.defaultView.getComputedStyle(this.node,null).getPropertyValue("marker-"+n);return"none"==r?r:t(i.doc.getElementById(r.match(f)[1]))}}function r(t){return function(n){e.stop();var r="marker"+t.charAt(0).toUpperCase()+t.substring(1);if(""!=n&&n){if("marker"==n.type){var i=n.node.id;return i||h(n.node,{id:n.id}),void(this.node.style[r]=d(i))}}else this.node.style[r]="none"}}e.on("snap.util.getattr.marker-end",n("end"))(-1),e.on("snap.util.getattr.markerEnd",n("end"))(-1),e.on("snap.util.getattr.marker-start",n("start"))(-1),e.on("snap.util.getattr.markerStart",n("start"))(-1),e.on("snap.util.getattr.marker-mid",n("mid"))(-1),e.on("snap.util.getattr.markerMid",n("mid"))(-1),e.on("snap.util.attr.marker-end",r("end"))(-1),e.on("snap.util.attr.markerEnd",r("end"))(-1),e.on("snap.util.attr.marker-start",r("start"))(-1),e.on("snap.util.attr.markerStart",r("start"))(-1),e.on("snap.util.attr.marker-mid",r("mid"))(-1),e.on("snap.util.attr.markerMid",r("mid"))(-1)}(),e.on("snap.util.getattr.r",(function(){if("rect"==this.type&&h(this.node,"rx")==h(this.node,"ry"))return e.stop(),h(this.node,"rx")}))(-1),e.on("snap.util.getattr.text",(function(){if("text"==this.type||"tspan"==this.type){e.stop();var t=function t(e){for(var n=[],r=e.childNodes,i=0,o=r.length;i<o;i++){var a=r[i];3==a.nodeType&&n.push(a.nodeValue),"tspan"==a.tagName&&(1==a.childNodes.length&&3==a.firstChild.nodeType?n.push(a.firstChild.nodeValue):n.push(t(a)))}return n}(this.node);return 1==t.length?t[0]:t}}))(-1),e.on("snap.util.getattr.#text",(function(){return this.node.textContent}))(-1),e.on("snap.util.getattr.fill",(function(n){if(!n){e.stop();var r=e("snap.util.getattr.fill",this,!0).firstDefined();return t(t.deurl(r))||r}}))(-1),e.on("snap.util.getattr.stroke",(function(n){if(!n){e.stop();var r=e("snap.util.getattr.stroke",this,!0).firstDefined();return t(t.deurl(r))||r}}))(-1),e.on("snap.util.getattr.viewBox",(function(){e.sto