Socket
Socket
Sign inDemoInstall

vega-scenegraph

Package Overview
Dependencies
Maintainers
2
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-scenegraph - npm Package Compare versions

Comparing version 4.2.0 to 4.2.1

8

build/vega-scenegraph-schema.json

@@ -58,6 +58,6 @@ {

{
"$ref": "#/refs/gradientLinear"
"$ref": "#/refs/linearGradient"
},
{
"$ref": "#/refs/gradientRadial"
"$ref": "#/refs/radialGradient"
}

@@ -105,3 +105,3 @@ ]

},
"gradientLinear": {
"linearGradient": {
"type": "object",

@@ -142,3 +142,3 @@ "properties": {

},
"gradientRadial": {
"radialGradient": {
"type": "object",

@@ -145,0 +145,0 @@ "properties": {

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-canvas"),require("vega-loader"),require("d3-shape"),require("d3-path")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-canvas","vega-loader","d3-shape","d3-path"],e):e((t=t||self).vega={},t.vega,t.vega,t.vega,t.d3,t.d3)}(this,function(t,e,n,i,r,o){"use strict";function s(t){this.clear(),t&&this.union(t)}var a=s.prototype;a.clone=function(){return new s(this)},a.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},a.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},a.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},a.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},a.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},a.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},a.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},a.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},a.rotate=function(t,e,n){const i=this.rotatedPoints(t,e,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},a.rotatedPoints=function(t,e,n){var{x1:i,y1:r,x2:o,y2:s}=this,a=Math.cos(t),u=Math.sin(t),l=e-e*a+n*u,h=n-e*u-n*a;return[a*i-u*r+l,u*i+a*r+h,a*i-u*s+l,u*i+a*s+h,a*o-u*r+l,u*o+a*r+h,a*o-u*s+l,u*o+a*s+h]},a.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},a.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},a.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},a.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},a.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},a.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},a.width=function(){return this.x2-this.x1},a.height=function(){return this.y2-this.y1};var u=0;const l="p_";function h(t){return t&&t.gradient}function c(t,e,n){let i=t.id,r=t.gradient,o="radial"===r?l:"";return i||(i=t.id="gradient_"+u++,"radial"===r?(t.x1=f(t.x1,.5),t.y1=f(t.y1,.5),t.r1=f(t.r1,0),t.x2=f(t.x2,.5),t.y2=f(t.y2,.5),t.r2=f(t.r2,.5),o=l):(t.x1=f(t.x1,0),t.y1=f(t.y1,0),t.x2=f(t.x2,1),t.y2=f(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function f(t,e){return null!=t?t:e}function d(t){this.mark=t,this.bounds=this.bounds||new s}function v(t){d.call(this,t),this.items=this.items||[]}function g(t){this._pending=0,this._loader=t||i.loader()}e.inherits(v,d);var p=g.prototype;function y(t){t._pending+=1}function _(t){t._pending-=1}p.pending=function(){return this._pending},p.sanitizeURL=function(t){var e=this;return y(e),e._loader.sanitize(t,{context:"href"}).then(function(t){return _(e),t}).catch(function(){return _(e),null})},p.loadImage=function(t){var e=this,i=n.image();return y(e),e._loader.sanitize(t,{context:"image"}).then(function(t){var n=t.href;if(!n||!i)throw{url:n};var r=new i;return r.onload=function(){_(e),r.loaded=!0},r.onerror=function(){_(e),r.loaded=!1},r.src=n,r}).catch(function(t){return _(e),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},p.ready=function(){var t=this;return new Promise(function(e){!function n(i){t.pending()?setTimeout(function(){n(!0)},10):e(i)}(!1)})};var m={basis:{curve:r.curveBasis},"basis-closed":{curve:r.curveBasisClosed},"basis-open":{curve:r.curveBasisOpen},bundle:{curve:r.curveBundle,tension:"beta",value:.85},cardinal:{curve:r.curveCardinal,tension:"tension",value:0},"cardinal-open":{curve:r.curveCardinalOpen,tension:"tension",value:0},"cardinal-closed":{curve:r.curveCardinalClosed,tension:"tension",value:0},"catmull-rom":{curve:r.curveCatmullRom,tension:"alpha",value:.5},"catmull-rom-closed":{curve:r.curveCatmullRomClosed,tension:"alpha",value:.5},"catmull-rom-open":{curve:r.curveCatmullRomOpen,tension:"alpha",value:.5},linear:{curve:r.curveLinear},"linear-closed":{curve:r.curveLinearClosed},monotone:{horizontal:r.curveMonotoneY,vertical:r.curveMonotoneX},natural:{curve:r.curveNatural},step:{curve:r.curveStep},"step-after":{curve:r.curveStepAfter},"step-before":{curve:r.curveStepBefore}};function x(t,e,n){var i=m.hasOwnProperty(t)&&m[t],r=null;return i&&(r=i.curve||i[e||"vertical"],i.tension&&null!=n&&(r=r[i.tension](n))),r}var b={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},k=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function w(t){var e,n,i,r,o,s,a,u,l,h,c,f=[];for(u=0,h=(e=t.slice().replace(k[0],"###$1").split(k[1]).slice(1)).length;u<h;++u){for(i=(n=e[u]).slice(1).trim().replace(k[2],"$1###$2").split(k[3]),r=[s=n.charAt(0)],l=0,c=i.length;l<c;++l)(o=+i[l])===o&&r.push(o);if(a=b[s.toLowerCase()],r.length-1>a)for(l=1,c=r.length;l<c;l+=a)f.push([s].concat(r.slice(l,l+a)));else f.push(r)}return f}var T=Math.PI/180,A=Math.PI/2,M=2*Math.PI,z=Math.sqrt(3)/2,C={},P={},S=[].join;function R(t){var e=S.call(t);if(P[e])return P[e];var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],u=t[6],l=t[7],h=l*s,c=-u*a,f=u*s,d=l*a,v=Math.cos(r),g=Math.sin(r),p=Math.cos(o),y=Math.sin(o),_=.5*(o-r),m=Math.sin(.5*_),x=8/3*m*m/Math.sin(_),b=n+v-x*g,k=i+g+x*v,w=n+p,T=i+y,A=w+x*y,M=T-x*p;return P[e]=[h*b+c*k,f*b+d*k,h*A+c*M,f*A+d*M,h*w+c*T,f*w+d*T]}var L=["l",0,0,0,0,0,0,0];function q(t,e){var n=L[0]=t[0];if("a"===n||"A"===n)L[1]=e*t[1],L[2]=e*t[2],L[3]=t[3],L[4]=t[4],L[5]=t[5],L[6]=e*t[6],L[7]=e*t[7];else for(var i=1,r=t.length;i<r;++i)L[i]=e*t[i];return L}function N(t,e,n,i,r){var o,s,a,u,l,h=null,c=0,f=0,d=0,v=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),t.beginPath&&t.beginPath();for(var g=0,p=e.length;g<p;++g){switch(o=e[g],1!==r&&(o=q(o,r)),o[0]){case"l":c+=o[1],f+=o[2],t.lineTo(c+n,f+i);break;case"L":c=o[1],f=o[2],t.lineTo(c+n,f+i);break;case"h":c+=o[1],t.lineTo(c+n,f+i);break;case"H":c=o[1],t.lineTo(c+n,f+i);break;case"v":f+=o[1],t.lineTo(c+n,f+i);break;case"V":f=o[1],t.lineTo(c+n,f+i);break;case"m":c+=o[1],f+=o[2],t.moveTo(c+n,f+i);break;case"M":c=o[1],f=o[2],t.moveTo(c+n,f+i);break;case"c":s=c+o[5],a=f+o[6],d=c+o[3],v=f+o[4],t.bezierCurveTo(c+o[1]+n,f+o[2]+i,d+n,v+i,s+n,a+i),c=s,f=a;break;case"C":c=o[5],f=o[6],d=o[3],v=o[4],t.bezierCurveTo(o[1]+n,o[2]+i,d+n,v+i,c+n,f+i);break;case"s":s=c+o[3],a=f+o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,c+o[1]+n,f+o[2]+i,s+n,a+i),d=c+o[1],v=f+o[2],c=s,f=a;break;case"S":s=o[3],a=o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"q":s=c+o[3],a=f+o[4],d=c+o[1],v=f+o[2],t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"Q":s=o[3],a=o[4],t.quadraticCurveTo(o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"t":s=c+o[1],a=f+o[2],null===h[0].match(/[QqTt]/)?(d=c,v=f):"t"===h[0]?(d=2*c-u,v=2*f-l):"q"===h[0]&&(d=2*c-d,v=2*f-v),u=d,l=v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),f=a,d=(c=s)+o[1],v=f+o[2];break;case"T":s=o[1],a=o[2],d=2*c-d,v=2*f-v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"a":O(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+c+n,o[7]+f+i]),c+=o[6],f+=o[7];break;case"A":O(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),c=o[6],f=o[7];break;case"z":case"Z":t.closePath()}h=o}}function O(t,e,n,i){for(var r=function(t,e,n,i,r,o,s,a,u){var l=S.call(arguments);if(C[l])return C[l];var h=s*T,c=Math.sin(h),f=Math.cos(h),d=f*(a-t)*.5+c*(u-e)*.5,v=f*(u-e)*.5-c*(a-t)*.5,g=d*d/((n=Math.abs(n))*n)+v*v/((i=Math.abs(i))*i);g>1&&(n*=g=Math.sqrt(g),i*=g);var p=f/n,y=c/n,_=-c/i,m=f/i,x=p*a+y*u,b=_*a+m*u,k=p*t+y*e,w=_*t+m*e,z=1/((k-x)*(k-x)+(w-b)*(w-b))-.25;z<0&&(z=0);var P=Math.sqrt(z);o==r&&(P=-P);var R=.5*(x+k)-P*(w-b),L=.5*(b+w)+P*(k-x),q=Math.atan2(b-L,x-R),N=Math.atan2(w-L,k-R)-q;N<0&&1===o?N+=M:N>0&&0===o&&(N-=M);for(var O=Math.ceil(Math.abs(N/(A+.001))),E=[],I=0;I<O;++I){var D=q+I*N/O,V=q+(I+1)*N/O;E[I]=[R,L,D,V,n,i,c,f]}return C[l]=E}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,n),o=0;o<r.length;++o){var s=R(r[o]);t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}var E={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,M)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/2.5;t.moveTo(-n,-i),t.lineTo(-n,i),t.lineTo(-i,i),t.lineTo(-i,n),t.lineTo(i,n),t.lineTo(i,i),t.lineTo(n,i),t.lineTo(n,-i),t.lineTo(i,-i),t.lineTo(i,-n),t.lineTo(-i,-n),t.lineTo(-i,-i),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),i=-n/2;t.rect(i,i,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/7,r=n/2.5,o=n/8;t.moveTo(-i,n),t.lineTo(i,n),t.lineTo(i,-o),t.lineTo(r,-o),t.lineTo(0,-n),t.lineTo(-r,-o),t.lineTo(-i,-o),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n,r=i-.5773502691896257*n,o=n/4;t.moveTo(0,-i-r),t.lineTo(-o,i-r),t.lineTo(o,i-r),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n,r=i-.5773502691896257*n;t.moveTo(0,-i-r),t.lineTo(-n,i-r),t.lineTo(n,i-r),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(0,-i),t.lineTo(-n,i),t.lineTo(n,i),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(0,i),t.lineTo(-n,-i),t.lineTo(n,-i),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(i,0),t.lineTo(-i,-n),t.lineTo(-i,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(-i,0),t.lineTo(i,-n),t.lineTo(i,n),t.closePath()}},stroke:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function I(t){return E.hasOwnProperty(t)?E[t]:function(t){if(!D.hasOwnProperty(t)){var e=w(t);D[t]={draw:function(t,n){N(t,e,0,0,Math.sqrt(n)/2)}}}return D[t]}(t)}var D={};function V(t){return t.x}function H(t){return t.y}function B(t){return t.width}function G(t){return t.height}function W(t){return function(){return t}}function j(){var t=V,e=H,n=B,i=G,r=W(0),s=null;function a(a,u,l){var h,c=null!=u?u:+t.call(this,a),f=null!=l?l:+e.call(this,a),d=+n.call(this,a),v=+i.call(this,a),g=+r.call(this,a);if(s||(s=h=o.path()),g<=0)s.rect(c,f,d,v);else{var p=c+d,y=f+v;s.moveTo(c+g,f),s.lineTo(p-g,f),s.quadraticCurveTo(p,f,p,f+g),s.lineTo(p,y-g),s.quadraticCurveTo(p,y,p-g,y),s.lineTo(c+g,y),s.quadraticCurveTo(c,y,c,y-g),s.lineTo(c,f+g),s.quadraticCurveTo(c,f,c+g,f),s.closePath()}if(h)return s=null,h+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:W(+t),a):e},a.width=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),a):n},a.height=function(t){return arguments.length?(i="function"==typeof t?t:W(+t),a):i},a.cornerRadius=function(t){return arguments.length?(r="function"==typeof t?t:W(+t),a):r},a.context=function(t){return arguments.length?(s=null==t?null:t,a):s},a}function U(){var t,e,n,i,r,s,a,u,l=null;function h(t,e,n){var i=n/2;if(r){var o=a-e,h=t-s;if(o||h){var c=Math.sqrt(o*o+h*h),f=(o/=c)*u,d=(h/=c)*u,v=Math.atan2(h,o);l.moveTo(s-f,a-d),l.lineTo(t-o*i,e-h*i),l.arc(t,e,i,v-Math.PI,v),l.lineTo(s+f,a+d),l.arc(s,a,u,v,v+Math.PI)}else l.arc(t,e,i,0,M);l.closePath()}else r=1;s=t,a=e,u=i}function c(s){var a,u,c,f=s.length,d=!1;for(null==l&&(l=c=o.path()),a=0;a<=f;++a)!(a<f&&i(u=s[a],a,s))===d&&(d=!d)&&(r=0),d&&h(+t(u,a,s),+e(u,a,s),+n(u,a,s));if(c)return l=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(i=t,c):i},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}function X(t){return t.x||0}function J(t){return t.y||0}function F(t){return t.cornerRadius||0}function Y(t){return!(!1===t.defined)}var Q=r.arc().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(F),Z=r.area().x(X).y1(J).y0(function(t){return(t.y||0)+(t.height||0)}).defined(Y),$=r.area().y(J).x1(X).x0(function(t){return(t.x||0)+(t.width||0)}).defined(Y),K=r.line().x(X).y(J).defined(Y),tt=j().x(X).y(J).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(F),et=r.symbol().type(function(t){return I(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),nt=U().x(X).y(J).defined(Y).size(function(t){return t.size||1});function it(t,e,n,i){return tt.context(t)(e,n,i)}function rt(t,e){return e.stroke&&0!==e.opacity&&0!==e.strokeOpacity&&t.expand(null!=e.strokeWidth?+e.strokeWidth:1),t}var ot,st=M-1e-8;function at(t){return ot=t,at}function ut(){}function lt(t,e){ot.add(t,e)}at.beginPath=ut,at.closePath=ut,at.moveTo=lt,at.lineTo=lt,at.rect=function(t,e,n,i){lt(t,e),lt(t+n,e+i)},at.quadraticCurveTo=function(t,e,n,i){lt(t,e),lt(n,i)},at.bezierCurveTo=function(t,e,n,i,r,o){lt(t,e),lt(n,i),lt(r,o)},at.arc=function(t,e,n,i,r,o){if(Math.abs(r-i)>st)return lt(t-n,e-n),void lt(t+n,e+n);var s,a,u,l,h=1/0,c=-1/0,f=1/0,d=-1/0;function v(t){u=n*Math.cos(t),l=n*Math.sin(t),u<h&&(h=u),u>c&&(c=u),l<f&&(f=l),l>d&&(d=l)}if(v(i),v(r),r!==i)if((i%=M)<0&&(i+=M),(r%=M)<0&&(r+=M),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=M,s=i-i%A,a=0;a<4&&s>r;++a,s-=A)v(s);else for(s=i-i%A+A,a=0;a<4&&s<r;++a,s+=A)v(s);lt(t+h,e+f),lt(t+c,e+d)};var ht=(ht=n.canvas(1,1))?ht.getContext("2d"):null;const ct=new s;function ft(t){return function(e,n){if(!ht)return!0;t(ht,e),ct.clear().union(e.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=ct;for(let t=r;t<=s;++t)for(let e=i;e<=o;++e)if(ht.isPointInPath(e,t))return!0;return!1}}function dt(t,e){return e.contains(t.x||0,t.y||0)}function vt(t,e){const n=t.x||0,i=t.y||0,r=t.width||0,o=t.height||0;return e.intersects(ct.set(n,i,n+r,i+o))}function gt(t,e){const n=t.x||0,i=t.y||0;return pt(e,n,i,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i)}function pt(t,e,n,i,r){const{x1:o,y1:s,x2:a,y2:u}=t,l=i-e,h=r-n;let c,f,d,v,g=0,p=1;for(v=0;v<4;++v){if(0===v&&(c=-l,f=-(o-e)),1===v&&(c=l,f=a-e),2===v&&(c=-h,f=-(s-n)),3===v&&(c=h,f=u-n),Math.abs(c)<1e-10&&f<0)return!1;if(d=f/c,c<0){if(d>p)return!1;d>g&&(g=d)}else if(c>0){if(d<g)return!1;d<p&&(p=d)}}return!0}function yt(t,e,n){return h(n)?function(t,e,n){const i=n.width(),r=n.height(),o=e.stops,s=o.length,a="radial"===e.gradient?t.createRadialGradient(n.x1+(e.x1||.5)*i,n.y1+(e.y1||.5)*r,Math.max(i,r)*(e.r1||0),n.x1+(e.x2||.5)*i,n.y1+(e.y2||.5)*r,Math.max(i,r)*(e.r2||.5)):t.createLinearGradient(n.x1+(e.x1||0)*i,n.y1+(e.y1||0)*r,n.x1+(e.x2||1)*i,n.y1+(e.y2||0)*r);for(let t=0;t<s;++t)a.addColorStop(o[t].offset,o[t].color);return a}(t,n,e.bounds):n}function _t(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=yt(t,e,e.fill),!0)}var mt=[];function xt(t,e,n){var i=null!=(i=e.strokeWidth)?i:1;return!(i<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=yt(t,e,e.stroke),t.lineWidth=i,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||mt),t.lineDashOffset=e.strokeDashOffset||0),!0))}function bt(t,e){return t.zindex-e.zindex||t.index-e.index}function kt(t){if(!t.zdirty)return t.zitems;var e,n,i,r=t.items,o=[];for(n=0,i=r.length;n<i;++n)(e=r[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(bt)}function wt(t,e){var n,i,r=t.items;if(r&&r.length){var o=kt(t);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||e(r[n]);r=o}for(n=0,i=r.length;n<i;++n)e(r[n])}}function Tt(t,e){var n,i,r=t.items;if(!r||!r.length)return null;var o=kt(t);for(o&&o.length&&(r=o),i=r.length;--i>=0;)if(n=e(r[i]))return n;if(r===o)for(i=(r=t.items).length;--i>=0;)if(!r[i].zindex&&(n=e(r[i])))return n;return null}function At(t){return function(e,n,i){wt(n,function(n){i&&!i.intersects(n.bounds)||Mt(t,e,n,n)})}}function Mt(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(n.fill&&_t(e,n,r)&&e.fill(),n.stroke&&xt(e,n,r)&&e.stroke()))}function zt(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,Tt(n,function(n){var a=n.bounds;if((!a||a.contains(o,s))&&a)return t(e,n,i,r,o,s)?n:void 0})}}function Ct(t,e){return function(n,i,r,o){var s,a,u=Array.isArray(i)?i[0]:i,l=null==e?u.fill:e,h=u.stroke&&n.isPointInStroke;return h&&(s=u.strokeWidth,a=u.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=a?a:"butt"),!t(n,i)&&(l&&n.isPointInPath(r,o)||h&&n.isPointInStroke(r,o))}}function Pt(t){return zt(Ct(t))}function St(t,e){return"translate("+t+","+e+")"}function Rt(t){return"rotate("+t+")"}function Lt(t){return St(t.x||0,t.y||0)}function qt(t,e,n){function i(t,n){var i=n.x||0,r=n.y||0,o=n.angle||0;t.translate(i,r),o&&t.rotate(o*=T),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-i,-r)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return St(t.x||0,t.y||0)+(t.angle?" "+Rt(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(at(t),n),rt(t,n).translate(i,r),n.angle&&t.rotate(n.angle*T,i,r),t},draw:At(i),pick:Pt(i),isect:n||ft(i)}}var Nt=qt("arc",function(t,e){return Q.context(t)(e)});function Ot(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r,o=Ct(i);return{type:t,tag:"path",nested:!0,attr:function(t,n){var i=n.mark.items;i.length&&t("d",e(null,i))},bound:function(t,n){var i=n.items;return 0===i.length?t:(e(at(t),i),rt(t,i[0]))},draw:(r=i,function(t,e,n){!e.items.length||n&&!n.intersects(e.bounds)||Mt(r,t,e.items[0],e.items)}),pick:function(t,e,n,i,r,s){var a=e.items,u=e.bounds;return!a||!a.length||u&&!u.contains(r,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,o(t,a,n,i)?a[0]:null)},isect:dt,tip:n}}var Et=Ot("area",function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?$:Z).curve(x(i,n.orient,n.tension)).context(t)(e)},function(t,e){for(var n,i,r="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",s=t.length,a=1/0;--s>=0;)!1!==t[s].defined&&(i=Math.abs(t[s][o]-r))<a&&(a=i,n=t[s]);return n}),It=1;function Dt(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+It++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}var Vt=.5;function Ht(t,e){var n=e.stroke?Vt:0;t.beginPath(),it(t,e,n,n)}var Bt=Ct(Ht);var Gt={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Lt(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,i=0,r=n.length;i<r;++i)t.union(n[i].bounds);return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),rt(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var i=this;wt(e,function(e){var r,o=e.x||0,s=e.y||0,a=e.width||0,u=e.height||0;t.save(),t.translate(o,s),(e.stroke||e.fill)&&(r=null==e.opacity?1:e.opacity)>0&&(Ht(t,e),e.fill&&_t(t,e,r)&&t.fill(),e.stroke&&xt(t,e,r)&&t.stroke()),e.clip&&(t.beginPath(),t.rect(0,0,a,u),t.clip()),n&&n.translate(-o,-s),wt(e,function(e){i.draw(t,e,n)}),n&&n.translate(o,s),t.restore()})},pick:function(t,e,n,i,r,o){if(e.bounds&&!e.bounds.contains(r,o)||!e.items)return null;var s=this,a=n*t.pixelRatio,u=i*t.pixelRatio;return Tt(e,function(l){var h,c,f,d;if(!(d=l.bounds)||d.contains(r,o))return c=l.x||0,f=l.y||0,t.save(),t.translate(c,f),c=r-c,f=o-f,!(h=Tt(l,function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?s.pick(t,n,i,c,f):null}))&&!1!==e.interactive&&(l.fill||l.stroke)&&Bt(t,l,a,u)&&(h=l),t.restore(),h||null})},isect:vt,background:function(t,e){var n=e.stroke?Vt:0;t("class","background"),t("d",it(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Dt(n,e,e):null)}};function Wt(t,e){var n=t.image;return n&&n.url===t.url||(n={loaded:!1,width:0,height:0},e.loadImage(t.url).then(function(e){t.image=e,t.image.url=t.url})),n}function jt(t,e){return"center"===t?e/2:"right"===t?e:0}function Ut(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Xt={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var i=Wt(e,n),r=e.x||0,o=e.y||0,s=(null!=e.width?e.width:i.width)||0,a=(null!=e.height?e.height:i.height)||0,u=!1===e.aspect?"none":"xMidYMid";r-=jt(e.align,s),o-=Ut(e.baseline,a),t("href",i.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",St(r,o)),t("width",s),t("height",a),t("preserveAspectRatio",u)},bound:function(t,e){var n=e.image,i=e.x||0,r=e.y||0,o=(null!=e.width?e.width:n&&n.width)||0,s=(null!=e.height?e.height:n&&n.height)||0;return i-=jt(e.align,o),r-=Ut(e.baseline,s),t.set(i,r,i+o,r+s)},draw:function(t,e,n){var i=this;wt(e,function(e){if(!n||n.intersects(e.bounds)){var r,o,s,a,u=Wt(e,i),l=e.x||0,h=e.y||0,c=(null!=e.width?e.width:u.width)||0,f=(null!=e.height?e.height:u.height)||0;l-=jt(e.align,c),h-=Ut(e.baseline,f),!1!==e.aspect&&(o=u.width/u.height,s=e.width/e.height,o==o&&s==s&&o!==s&&(s<o?(h+=(f-(a=c/o))/2,f=a):(l+=(c-(a=f*o))/2,c=a))),u.loaded&&(t.globalAlpha=null!=(r=e.opacity)?r:1,t.drawImage(u,l,h,c,f))}})},pick:zt(),isect:e.truthy,get:Wt,xOffset:jt,yOffset:Ut},Jt=Ot("line",function(t,e){var n=e[0],i=n.interpolate||"linear";return K.curve(x(i,n.orient,n.tension)).context(t)(e)},function(t,e){for(var n,i,r=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(i=t[o].y-e[1])*i<r)return t[o];return null});function Ft(t,e){var n=e.path;if(null==n)return!0;var i=e.pathCache;i&&i.path===n||((e.pathCache=i=w(n)).path=n),N(t,i,e.x,e.y)}var Yt={type:"path",tag:"path",nested:!1,attr:function(t,e){t("transform",Lt(e)),t("d",e.path)},bound:function(t,e){return Ft(at(t),e)?t.set(0,0,0,0):rt(t,e)},draw:At(Ft),pick:Pt(Ft),isect:ft(Ft)};function Qt(t,e){t.beginPath(),it(t,e)}var Zt={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",it(null,e))},bound:function(t,e){var n,i;return rt(t.set(n=e.x||0,i=e.y||0,n+e.width||0,i+e.height||0),e)},draw:At(Qt),pick:Pt(Qt),isect:vt};function $t(t,e,n){var i,r,o,s;return!(!e.stroke||!xt(t,e,n))&&(i=e.x||0,r=e.y||0,o=null!=e.x2?e.x2:i,s=null!=e.y2?e.y2:r,t.beginPath(),t.moveTo(i,r),t.lineTo(o,s),!0)}var Kt,te={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",Lt(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,i;return rt(t.set(n=e.x||0,i=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i),e)},draw:function(t,e,n){wt(e,function(e){if(!n||n.intersects(e.bounds)){var i=null==e.opacity?1:e.opacity;i&&$t(t,e,i)&&t.stroke()}})},pick:zt(function(t,e,n,i){return!!t.isPointInStroke&&$t(t,e,1)&&t.isPointInStroke(n,i)}),isect:gt},ee=qt("shape",function(t,e){return(e.mark.shape||e.shape).context(t)(e)}),ne=qt("symbol",function(t,e){return et.context(t)(e)},dt),ie={height:ue,measureWidth:se,estimateWidth:re,width:re,canvas:le};function re(t){return Kt=ue(t),oe(he(t))}function oe(t){return~~(.8*t.length*Kt)}function se(t){return ue(t)<=0?0:(ht.font=fe(t),ae(he(t)))}function ae(t){return ht.measureText(t).width}function ue(t){return null!=t.fontSize?t.fontSize:11}function le(t){ie.width=t&&ht?se:re}function he(t){var e=t.text;return null==e?"":t.limit>0?function(t){var e,n=+t.limit,i=t.text+"";ie.width===se?(ht.font=fe(t),e=ae):(Kt=ue(t),e=oe);if(e(i)<n)return i;var r,o=t.ellipsis||"…",s="rtl"===t.dir,a=0,u=i.length;if(n-=e(o),s){for(;a<u;)r=a+u>>>1,e(i.slice(r))>n?a=r+1:u=r;return o+i.slice(a)}for(;a<u;)r=1+(a+u>>>1),e(i.slice(0,r))<n?a=r:u=r-1;return i.slice(0,a)+o}(t):e+""}function ce(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function fe(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+ue(t)+"px "+ce(t,e)}function de(t){var e=t.baseline,n=ue(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}le(!0);var ve={left:"start",center:"middle",right:"end"},ge=new s;function pe(t){var e,n=t.x||0,i=t.y||0,r=t.radius||0;return r&&(e=(t.theta||0)-A,n+=r*Math.cos(e),i+=r*Math.sin(e)),ge.x1=n,ge.y1=i,ge}function ye(t,e,n){var i,r=ie.height(e),o=e.align,s=pe(e),a=s.x1,u=s.y1,l=e.dx||0,h=(e.dy||0)+de(e)-Math.round(.8*r);if(i=ie.width(e),"center"===o?l-=i/2:"right"===o&&(l-=i),t.set(l+=a,h+=u,l+i,h+r),e.angle&&!n)t.rotate(e.angle*T,a,u);else if(2===n)return t.rotatedPoints(e.angle*T,a,u);return t}var _e={arc:Nt,area:Et,group:Gt,image:Xt,line:Jt,path:Yt,rect:Zt,rule:te,shape:ee,symbol:ne,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+de(e),o=pe(e),s=o.x1,a=o.y1,u=e.angle||0;t("text-anchor",ve[e.align]||"start"),u?(n=St(s,a)+" "+Rt(u),(i||r)&&(n+=" "+St(i,r))):n=St(s+i,a+r),t("transform",n)},bound:ye,draw:function(t,e,n){wt(e,function(e){var i,r,o,s,a;n&&!n.intersects(e.bounds)||(a=he(e))&&(0===(i=null==e.opacity?1:e.opacity)||e.fontSize<=0||(t.font=fe(e),t.textAlign=e.align||"left",o=(r=pe(e)).x1,s=r.y1,e.angle&&(t.save(),t.translate(o,s),t.rotate(e.angle*T),o=s=0),o+=e.dx||0,s+=(e.dy||0)+de(e),e.fill&&_t(t,e,i)&&t.fillText(a,o,s),e.stroke&&xt(t,e,i)&&t.strokeText(a,o,s),e.angle&&t.restore()))})},pick:zt(function(t,e,n,i,r,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var s=pe(e),a=s.x1,u=s.y1,l=ye(ge,e,1),h=-e.angle*T,c=Math.cos(h),f=Math.sin(h),d=c*r-f*o+(a-c*a+f*u),v=f*r+c*o+(u-f*a-c*u);return l.contains(d,v)}),isect:function(t,e){var n=ye(ge,t,2);return pt(e,n[0],n[1],n[2],n[3])||pt(e,n[0],n[1],n[4],n[5])||pt(e,n[4],n[5],n[6],n[7])||pt(e,n[2],n[3],n[6],n[7])}},trail:Ot("trail",function(t,e){return nt.context(t)(e)},function(t,e){for(var n,i,r=t.length;--r>=0;)if(!1!==t[r].defined&&(n=t[r].x-e[0])*n+(i=t[r].y-e[1])*i<(n=t[r].size||1)*n)return t[r];return null})};function me(t,e,n){var i=_e[t.mark.marktype],r=e||i.bound;return i.nested&&(t=t.mark),r(t.bounds||(t.bounds=new s),t,n)}var xe={mark:null};function be(t,e,n){var i,r,o,a,u=_e[t.marktype],l=u.bound,h=t.items,c=h&&h.length;if(u.nested)return c?o=h[0]:(xe.mark=t,o=xe),a=me(o,l,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new s,c)for(i=0,r=h.length;i<r;++i)e.union(me(h[i],l,n));return t.bounds=e}var ke=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function we(t,e){return JSON.stringify(t,ke,e)}function Te(t){return function t(e){var n,i,r,o=e.marktype,s=e.items;if(s)for(i=0,r=s.length;i<r;++i)n=o?"mark":"group",s[i][n]=e,s[i].zindex&&(s[i][n].zdirty=!0),"group"===(o||n)&&t(s[i]);o&&be(e);return e}("string"==typeof t?JSON.parse(t):t)}function Ae(t){arguments.length?this.root=Te(t):(this.root=ze({marktype:"group",name:"root",role:"frame"}),this.root.items=[new v(this.root)])}var Me=Ae.prototype;function ze(t,e){return{bounds:new s,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Ce(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Pe(t,e){e=e.toLowerCase();for(var n=t.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===e)return n[i]}function Se(t,e,n,i){var r,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Ce(t.ownerDocument,n,i),t.insertBefore(o,r)),o}function Re(t,e){for(var n=t.childNodes,i=n.length;i>e;)t.removeChild(n[--i]);return t}function Le(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function qe(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Ne(t,e){this._active=null,this._handlers={},this._loader=t||i.loader(),this._tooltip=e||Oe}function Oe(t,e,n,i){t.element().setAttribute("title",i||"")}Me.toJSON=function(t){return we(this.root,t||0)},Me.mark=function(t,e,n){var i=ze(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};var Ee=Ne.prototype;function Ie(t){this._el=null,this._bgcolor=null,this._loader=new g(t)}Ee.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Ee.element=function(){return this._el},Ee.canvas=function(){return this._el&&this._el.firstChild},Ee.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Ee.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Ee.on=function(){},Ee.off=function(){},Ee._handlerIndex=function(t,e,n){for(var i=t?t.length:0;--i>=0;)if(t[i].type===e&&(!n||t[i].handler===n))return i;return-1},Ee.handlers=function(t){var e,n=this._handlers,i=[];if(t)i.push.apply(i,n[this.eventName(t)]);else for(e in n)i.push.apply(i,n[e]);return i},Ee.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Ee.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(function(e){var n=new MouseEvent(t.type,t),i=Ce(null,"a");for(var r in e)i.setAttribute(r,e[r]);i.dispatchEvent(n)}).catch(function(){})},Ee.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,i){var r,o,s=t&&t.mark;if(s&&(r=_e[s.marktype]).tip){for((o=qe(e,n))[0]-=i[0],o[1]-=i[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=r.tip(s.items,o)}return t}(e,t,this.canvas(),this._origin);var i=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,i)}},Ee.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),i=this._origin,r=t.bounds,o=r.x1+i[0]+n.left,s=r.y1+i[1]+n.top,a=r.width(),u=r.height();t.mark&&(t=t.mark.group);)o+=t.x||0,s+=t.y||0;return{x:o,y:s,width:a,height:u,left:o,top:s,right:o+a,bottom:s+u}}};var De=Ie.prototype;De.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},De.element=function(){return this._el},De.canvas=function(){return this._el&&this._el.firstChild},De.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},De.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},De.dirty=function(){},De.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},De._render=function(){},De.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then(function(){return e}):Promise.resolve(e)},De._load=function(t,e){var n=this,i=n._loader[t](e);if(!n._ready){var r=n._call;n._ready=n._loader.ready().then(function(t){t&&r(),n._ready=null})}return i},De.sanitizeURL=function(t){return this._load("sanitizeURL",t)},De.loadImage=function(t){return this._load("loadImage",t)};var Ve="mouseout";function He(t,e){Ne.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var Be=e.inherits(He,Ne);function Ge(t,e,n){return function(i){var r=this._active,o=this.pickEvent(i);o===r?this.fire(t,i):(r&&r.exit||this.fire(n,i),this._active=o,this.fire(e,i),this.fire(t,i))}}function We(t){return function(e){this.fire(t,e),this._active=null}}Be.initialize=function(t,e,n){var i=this._canvas=t&&Pe(t,"canvas");if(i){var r=this;this.events.forEach(function(t){i.addEventListener(t,function(e){Be[t]?Be[t].call(r,e):r.fire(t,e)})})}return Ne.prototype.initialize.call(this,t,e,n)},Be.canvas=function(){return this._canvas},Be.context=function(){return this._canvas.getContext("2d")},Be.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Be.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Be.mousemove=Ge("mousemove","mouseover","mouseout"),Be.dragover=Ge("dragover","dragenter","dragleave"),Be.mouseout=We("mouseout"),Be.dragleave=We("dragleave"),Be.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Be.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Be.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Be.touchmove=function(t){this.fire("touchmove",t,!0)},Be.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Be.fire=function(t,e,n){var i,r,o=n?this._touch:this._active,s=this._handlers[t];if(e.vegaType=t,"click"===t&&o&&o.href?this.handleHref(e,o,o.href):"mousemove"!==t&&t!==Ve||this.handleTooltip(e,o,t!==Ve),s)for(i=0,r=s.length;i<r;++i)s[i].handler.call(this._obj,e,o)},Be.on=function(t,e){var n=this.eventName(t),i=this._handlers;return this._handlerIndex(i[n],t,e)<0&&(i[n]||(i[n]=[])).push({type:t,handler:e}),this},Be.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&i.splice(r,1),this},Be.pickEvent=function(t){var e=qe(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Be.pick=function(t,e,n,i,r){var o=this.context();return _e[t.marktype].pick.call(this,o,t,e,n,i,r)};var je="undefined"!=typeof window&&window.devicePixelRatio||1;function Ue(t){Ie.call(this,t),this._redraw=!1,this._dirty=new s}var Xe=e.inherits(Ue,Ie),Je=Ie.prototype,Fe=new s;function Ye(t,e){Ne.call(this,t,e);var n=this;n._hrefHandler=Ze(n,function(t,e){e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=Ze(n,function(t,e){n.handleTooltip(t,e,t.type!==Ve)})}Xe.initialize=function(t,e,i,r,o,s){return this._options=s,this._canvas=n.canvas(1,1,s&&s.type),t&&(Re(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Je.initialize.call(this,t,e,i,r,o)},Xe.resize=function(t,e,n,i){return Je.resize.call(this,t,e,n,i),function(t,e,n,i,r,o){var s,a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),l=a?je:r;for(s in t.width=e*l,t.height=n*l,o)u[s]=o[s];a&&1!==l&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=l,u.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},Xe.canvas=function(){return this._canvas},Xe.context=function(){return this._canvas?this._canvas.getContext("2d"):null},Xe.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=Fe.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},Xe._render=function(t){var e=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty;return e.save(),this._redraw||o.empty()?(this._redraw=!1,o=null):o=function(t,e,n){return e.expand(1).round(),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o,n),this.clear(-n[0],-n[1],i,r),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},Xe.draw=function(t,n,i){var r=_e[n.marktype];n.clip&&function(t,n){var i=n.clip;if(t.save(),t.beginPath(),e.isFunction(i))i(t);else{var r=n.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},Xe.clear=function(t,e,n,i){var r=this.context();r.clearRect(t,e,n,i),null!=this._bgcolor&&(r.fillStyle=this._bgcolor,r.fillRect(t,e,n,i))};var Qe=e.inherits(Ye,Ne);function Ze(t,e){return function(n){var i=n.target.__data__;n.vegaType=n.type,i=Array.isArray(i)?i[0]:i,e.call(t._obj,n,i)}}function $e(t,e,n){var i,r,o="<"+t;if(e)for(i in e)null!=(r=e[i])&&(o+=" "+i+'="'+r+'"');return n&&(o+=" "+n),o+">"}function Ke(t){return"</"+t+">"}Qe.initialize=function(t,e,n){var i=this._svg;return i&&(i.removeEventListener("click",this._hrefHandler),i.removeEventListener("mousemove",this._tooltipHandler),i.removeEventListener(Ve,this._tooltipHandler)),this._svg=i=t&&Pe(t,"svg"),i&&(i.addEventListener("click",this._hrefHandler),i.addEventListener("mousemove",this._tooltipHandler),i.addEventListener(Ve,this._tooltipHandler)),Ne.prototype.initialize.call(this,t,e,n)},Qe.canvas=function(){return this._svg},Qe.on=function(t,e){var n=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[n],t,e)<0){var r={type:t,handler:e,listener:Ze(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},Qe.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this};var tn={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},en={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},nn=Object.keys(en),rn=tn.xmlns;function on(t){Ie.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var sn=e.inherits(on,Ie),an=Ie.prototype;function un(t,e,n){var i,r,o;if("radial"===e.gradient){var s=Se(t,n++,"pattern",rn);s.setAttribute("id",l+e.id),s.setAttribute("viewBox","0,0,1,1"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("preserveAspectRatio","xMidYMid slice"),(s=Se(s,0,"rect",rn)).setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","url("+yn()+"#"+e.id+")"),(t=Se(t,n++,"radialGradient",rn)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=Se(t,n++,"linearGradient",rn)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(i=0,r=e.stops.length;i<r;++i)(o=Se(t,i,"stop",rn)).setAttribute("offset",e.stops[i].offset),o.setAttribute("stop-color",e.stops[i].color);return Re(t,i),n}function ln(t,e,n){var i;return(t=Se(t,n,"clipPath",rn)).setAttribute("id",e.id),e.path?(i=Se(t,0,"path",rn)).setAttribute("d",e.path):((i=Se(t,0,"rect",rn)).setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.width),i.setAttribute("height",e.height)),n+1}function hn(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function cn(t,e,n,i,r){var o,s=t._svg;if(!s&&(s=Ce(o=e.ownerDocument,i,rn),t._svg=s,t.mark&&(s.__data__=t,s.__values__={fill:"default"},"g"===i))){var a=Ce(o,"path",rn);a.setAttribute("class","background"),s.appendChild(a),a.__data__=t;var u=Ce(o,"g",rn);s.appendChild(u),u.__data__=t}return(s.ownerSVGElement!==r||function(t){var e=t.mark||t.group;return e&&e.items.length>1}(t)&&s.previousSibling!==n)&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}sn.initialize=function(t,e,n,i){return t&&(this._svg=Se(t,0,"svg",rn),this._svg.setAttribute("class","marks"),Re(t,1),this._root=Se(this._svg,0,"g",rn),Re(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),an.initialize.call(this,t,e,n,i)},sn.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),an.background.apply(this,arguments)},sn.resize=function(t,e,n,i){return an.resize.call(this,t,e,n,i),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},sn.canvas=function(){return this._svg},sn.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in tn)t[e]=tn[e];var n=this._bgcolor?$e("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+Ke("rect"):"";return $e("svg",t)+n+this._svg.innerHTML+Ke("svg")},sn._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Re(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},sn.updateDefs=function(){var t,e=this._svg,n=this._defs,i=n.el,r=0;for(t in n.gradient)i||(n.el=i=Se(e,0,"defs",rn)),r=un(i,n.gradient[t],r);for(t in n.clipping)i||(n.el=i=Se(e,0,"defs",rn)),r=ln(i,n.clipping[t],r);i&&(0===r?(e.removeChild(i),n.el=null):Re(i,r))},sn._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},sn.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},sn.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},sn._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)return!0;var e,n,i,r,o,s,a,u=++this._dirtyID;for(o=0,s=t.length;o<s;++o)(n=(e=t[o]).mark).marktype!==i&&(i=n.marktype,r=_e[i]),n.zdirty&&n.dirty!==u&&(this._dirtyAll=!1,hn(e,u),n.items.forEach(function(t){t.dirty=u})),n.zdirty||(e.exit?(r.nested&&n.items.length?(a=n.items[0])._svg&&this._update(r,a._svg,a):e._svg&&(a=e._svg.parentNode)&&a.removeChild(e._svg),e._svg=null):(e=r.nested?n.items[0]:e)._update!==u&&(e._svg&&e._svg.ownerSVGElement?this._update(r,e._svg,e):(this._dirtyAll=!1,hn(e,u)),e._update=u));return!this._dirtyAll},sn.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var i,r=this,o=this._svg,s=_e[e.marktype],a=!1===e.interactive?"none":null,u="g"===s.tag,l=null,h=0;function c(t){var e=r.isDirty(t),n=cn(t,i,l,s.tag,o);e&&(r._update(s,n,t),u&&function(t,e,n){e=e.lastChild;var i,r=0;wt(n,function(n){i=t.draw(e,n,i),++r}),Re(e,1+r)}(r,n,t)),l=n,++h}return(i=cn(e,t,n,"g",o)).setAttribute("class",Le(e)),u||i.style.setProperty("pointer-events",a),e.clip?i.setAttribute("clip-path",Dt(r,e,e.group)):i.removeAttribute("clip-path"),s.nested?e.items.length&&c(e.items[0]):wt(e,c),Re(i,h),i};var fn=null,dn=null,vn={group:function(t,e,n){dn=e.__values__,fn=e.childNodes[1],t.foreground(pn,n,this),fn=e.childNodes[0],t.background(pn,n,this);var i=!1===n.mark.interactive?"none":null;i!==dn.events&&(fn.style.setProperty("pointer-events",i),dn.events=i)},text:function(t,e,n){var i;(i=he(n))!==dn.text&&(e.textContent=i,dn.text=i),gn(e,"font-family",ce(n)),gn(e,"font-size",ue(n)+"px"),gn(e,"font-style",n.fontStyle),gn(e,"font-variant",n.fontVariant),gn(e,"font-weight",n.fontWeight)}};function gn(t,e,n){n!==dn[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),dn[e]=n)}function pn(t,e,n){e!==dn[t]&&(null!=e?n?fn.setAttributeNS(n,t,e):fn.setAttribute(t,e):n?fn.removeAttributeNS(n,t):fn.removeAttribute(t),dn[t]=e)}function yn(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function _n(t){Ie.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}sn._update=function(t,e,n){fn=e,dn=e.__values__,t.attr(pn,n,this);var i=vn[t.type];i&&i.call(this,t,e,n),this.style(fn,n)},sn.style=function(t,e){var n,i,r,o,s;if(null!=e)for(n=0,i=nn.length;n<i;++n)s=e[r=nn[n]],"font"===r&&(s=ce(e)),s!==dn[r]&&(o=en[r],null==s?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(h(s)&&(s=c(s,this._defs.gradient,yn())),t.style.setProperty(o,s+"")),dn[r]=s)};var mn,xn=e.inherits(_n,Ie),bn=Ie.prototype;function kn(t,e,n,i){mn[i||t]=e}function wn(t,e,n,i){if(null==t)return"";var r,o,s,a,u,l="";for("bgrect"===n&&!1===e.interactive&&(l+="pointer-events: none; "),"text"===n&&(l+="font-family: "+ce(t)+"; ",l+="font-size: "+ue(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),r=0,o=nn.length;r<o;++r)s=nn[r],a=en[s],null==(u=t[s])?"fill"===a&&(l+="fill: none; "):"transparent"!==u||"fill"!==a&&"stroke"!==a?(h(u)&&(u=c(u,i.gradient,"")),l+=a+": "+u+"; "):l+=a+": none; ";return l?'style="'+l.trim()+'"':null}xn.resize=function(t,e,n,i){bn.resize.call(this,t,e,n,i);var r=this._origin,o=this._text,s={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var a in tn)s[a]=tn[a];o.head=$e("svg",s);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?$e("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+Ke("rect"):"",o.root=$e("g",{transform:"translate("+r+")"}),o.foot=Ke("g")+Ke("svg"),this},xn.background=function(){var t=bn.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},xn.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},xn._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},xn.buildDefs=function(){var t,e,n,i,r,o=this._defs,s="";for(e in o.gradient){for(r=(n=o.gradient[e]).stops,"radial"===n.gradient?(s+=$e(i="pattern",{id:l+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),s+=$e("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+Ke("rect"),s+=Ke(i),s+=$e(i="radialGradient",{id:e,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):s+=$e(i="linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<r.length;++t)s+=$e("stop",{offset:r[t].offset,"stop-color":r[t].color})+Ke("stop");s+=Ke(i)}for(e in o.clipping)n=o.clipping[e],s+=$e("clipPath",{id:e}),n.path?s+=$e("path",{d:n.path})+Ke("path"):s+=$e("rect",{x:0,y:0,width:n.width,height:n.height})+Ke("rect"),s+=Ke("clipPath");return s.length>0?$e("defs")+s+Ke("defs"):""},xn.attributes=function(t,e){return mn={},t(kn,e,this),mn},xn.href=function(t){var e,n=this,i=t.href;if(i){if(e=n._hrefs&&n._hrefs[i])return e;n.sanitizeURL(i).then(function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[i]=t})}return null},xn.mark=function(t){var e,n=this,i=_e[t.marktype],r=i.tag,o=this._defs,s="";function a(a){var u=n.href(a);u&&(s+=$e("a",u)),e="g"!==r?wn(a,t,r,o):null,s+=$e(r,n.attributes(i.attr,a),e),"text"===r?s+=he(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"g"===r&&(s+=$e("path",n.attributes(i.background,a),wn(a,t,"bgrect",o))+Ke("path"),s+=$e("g",n.attributes(i.foreground,a))+n.markGroup(a)+Ke("g")),s+=Ke(r),u&&(s+=Ke("a"))}return"g"!==r&&!1===t.interactive&&(e='style="pointer-events: none;"'),s+=$e("g",{class:Le(t),"clip-path":t.clip?Dt(n,t,t.group):null},e),i.nested?t.items&&t.items.length&&a(t.items[0]):wt(t,a),s+Ke("g")},xn.markGroup=function(t){var e=this,n="";return wt(t,function(t){n+=e.mark(t)}),n};var Tn={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},An={};function Mn(t,e,n,i){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const r=t.items,o=t.marktype,s=r.length;let a=0;if("group"===o)for(;a<s;++a)zn(r[a],e,n,i);else for(const t=_e[o].isect;a<s;++a){let n=r[a];Cn(n,e,t)&&i.push(n)}}return i}function zn(t,e,n,i){n&&n(t.mark)&&Cn(t,e,_e.group.isect)&&i.push(t);const r=t.items,o=r&&r.length;if(o){const s=t.x||0,a=t.y||0;e.translate(-s,-a);for(let t=0;t<o;++t)Mn(r[t],e,n,i);e.translate(s,a)}return i}function Cn(t,e,n){const i=t.bounds;return e.encloses(i)||e.intersects(i)&&n(t,e)}An.canvas=An.png={renderer:Ue,headless:Ue,handler:He},An.svg={renderer:on,headless:_n,handler:Ye},An.none={};var Pn=new s;var Sn=1e-9;function Rn(t,n,i){return t===n||("path"===i?Ln(t,n):t instanceof Date&&n instanceof Date?+t==+n:e.isNumber(t)&&e.isNumber(n)?Math.abs(t-n)<=Sn:t&&n&&(e.isObject(t)||e.isObject(n))?null!=t&&null!=n&&function(t,e){var n,i,r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(n=r[i],!Rn(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function Ln(t,e){return Rn(w(t),w(e))}t.Bounds=s,t.CanvasHandler=He,t.CanvasRenderer=Ue,t.Gradient=function(t,e){var n,i=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:i,stop:function(t,e){return i.push({offset:t,color:e}),n}}},t.GroupItem=v,t.Handler=Ne,t.Item=d,t.Marks=_e,t.RenderType=Tn,t.Renderer=Ie,t.ResourceLoader=g,t.SVGHandler=Ye,t.SVGRenderer=on,t.SVGStringRenderer=_n,t.Scenegraph=Ae,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(at(Pn.clear()));else{if(!n)return;Pn.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Pn)},t.boundContext=at,t.boundItem=me,t.boundMark=be,t.boundStroke=rt,t.closeTag=Ke,t.domChild=Se,t.domClear=Re,t.domCreate=Ce,t.domFind=Pe,t.font=fe,t.fontFamily=ce,t.fontSize=ue,t.intersect=function(t,n,i){const r=[],o=(new s).union(n),a=t.marktype;return a?Mn(t,o,i,r):"group"===a?zn(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.intersectBoxLine=pt,t.intersectPath=ft,t.intersectPoint=dt,t.intersectRule=gt,t.openTag=$e,t.pathCurves=x,t.pathEqual=Ln,t.pathParse=w,t.pathRectangle=j,t.pathRender=N,t.pathSymbols=I,t.pathTrail=U,t.point=qe,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(An[t]=e,this):An[t]},t.resetSVGClipId=function(){It=1},t.sceneEqual=Rn,t.sceneFromJSON=Te,t.scenePickVisit=Tt,t.sceneToJSON=we,t.sceneVisit=wt,t.sceneZOrder=kt,t.textMetrics=ie,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vega-util"),require("vega-canvas"),require("vega-loader"),require("d3-shape"),require("d3-path")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-canvas","vega-loader","d3-shape","d3-path"],e):e((t=t||self).vega={},t.vega,t.vega,t.vega,t.d3,t.d3)}(this,function(t,e,n,i,r,o){"use strict";function s(t){this.clear(),t&&this.union(t)}var a=s.prototype;a.clone=function(){return new s(this)},a.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},a.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},a.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},a.set=function(t,e,n,i){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),i<e?(this.y2=e,this.y1=i):(this.y1=e,this.y2=i),this},a.add=function(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},a.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},a.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},a.translate=function(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},a.rotate=function(t,e,n){const i=this.rotatedPoints(t,e,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},a.rotatedPoints=function(t,e,n){var{x1:i,y1:r,x2:o,y2:s}=this,a=Math.cos(t),u=Math.sin(t),l=e-e*a+n*u,h=n-e*u-n*a;return[a*i-u*r+l,u*i+a*r+h,a*i-u*s+l,u*i+a*s+h,a*o-u*r+l,u*o+a*r+h,a*o-u*s+l,u*o+a*s+h]},a.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},a.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},a.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},a.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},a.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},a.contains=function(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},a.width=function(){return this.x2-this.x1},a.height=function(){return this.y2-this.y1};var u=0;const l="p_";function h(t){return t&&t.gradient}function c(t,e,n){let i=t.id,r=t.gradient,o="radial"===r?l:"";return i||(i=t.id="gradient_"+u++,"radial"===r?(t.x1=f(t.x1,.5),t.y1=f(t.y1,.5),t.r1=f(t.r1,0),t.x2=f(t.x2,.5),t.y2=f(t.y2,.5),t.r2=f(t.r2,.5),o=l):(t.x1=f(t.x1,0),t.y1=f(t.y1,0),t.x2=f(t.x2,1),t.y2=f(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function f(t,e){return null!=t?t:e}function d(t){this.mark=t,this.bounds=this.bounds||new s}function v(t){d.call(this,t),this.items=this.items||[]}function g(t){this._pending=0,this._loader=t||i.loader()}e.inherits(v,d);var p=g.prototype;function y(t){t._pending+=1}function _(t){t._pending-=1}p.pending=function(){return this._pending},p.sanitizeURL=function(t){var e=this;return y(e),e._loader.sanitize(t,{context:"href"}).then(function(t){return _(e),t}).catch(function(){return _(e),null})},p.loadImage=function(t){var e=this,i=n.image();return y(e),e._loader.sanitize(t,{context:"image"}).then(function(t){var n=t.href;if(!n||!i)throw{url:n};var r=new i;return r.onload=function(){_(e),r.loaded=!0},r.onerror=function(){_(e),r.loaded=!1},r.src=n,r}).catch(function(t){return _(e),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},p.ready=function(){var t=this;return new Promise(function(e){!function n(i){t.pending()?setTimeout(function(){n(!0)},10):e(i)}(!1)})};var m={basis:{curve:r.curveBasis},"basis-closed":{curve:r.curveBasisClosed},"basis-open":{curve:r.curveBasisOpen},bundle:{curve:r.curveBundle,tension:"beta",value:.85},cardinal:{curve:r.curveCardinal,tension:"tension",value:0},"cardinal-open":{curve:r.curveCardinalOpen,tension:"tension",value:0},"cardinal-closed":{curve:r.curveCardinalClosed,tension:"tension",value:0},"catmull-rom":{curve:r.curveCatmullRom,tension:"alpha",value:.5},"catmull-rom-closed":{curve:r.curveCatmullRomClosed,tension:"alpha",value:.5},"catmull-rom-open":{curve:r.curveCatmullRomOpen,tension:"alpha",value:.5},linear:{curve:r.curveLinear},"linear-closed":{curve:r.curveLinearClosed},monotone:{horizontal:r.curveMonotoneY,vertical:r.curveMonotoneX},natural:{curve:r.curveNatural},step:{curve:r.curveStep},"step-after":{curve:r.curveStepAfter},"step-before":{curve:r.curveStepBefore}};function x(t,n,i){var r=e.hasOwnProperty(m,t)&&m[t],o=null;return r&&(o=r.curve||r[n||"vertical"],r.tension&&null!=i&&(o=o[r.tension](i))),o}var b={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},k=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function w(t){var e,n,i,r,o,s,a,u,l,h,c,f=[];for(u=0,h=(e=t.slice().replace(k[0],"###$1").split(k[1]).slice(1)).length;u<h;++u){for(i=(n=e[u]).slice(1).trim().replace(k[2],"$1###$2").split(k[3]),r=[s=n.charAt(0)],l=0,c=i.length;l<c;++l)(o=+i[l])===o&&r.push(o);if(a=b[s.toLowerCase()],r.length-1>a)for(l=1,c=r.length;l<c;l+=a)f.push([s].concat(r.slice(l,l+a)));else f.push(r)}return f}var T=Math.PI/180,A=Math.PI/2,M=2*Math.PI,z=Math.sqrt(3)/2,C={},P={},S=[].join;function R(t){var e=S.call(t);if(P[e])return P[e];var n=t[0],i=t[1],r=t[2],o=t[3],s=t[4],a=t[5],u=t[6],l=t[7],h=l*s,c=-u*a,f=u*s,d=l*a,v=Math.cos(r),g=Math.sin(r),p=Math.cos(o),y=Math.sin(o),_=.5*(o-r),m=Math.sin(.5*_),x=8/3*m*m/Math.sin(_),b=n+v-x*g,k=i+g+x*v,w=n+p,T=i+y,A=w+x*y,M=T-x*p;return P[e]=[h*b+c*k,f*b+d*k,h*A+c*M,f*A+d*M,h*w+c*T,f*w+d*T]}var L=["l",0,0,0,0,0,0,0];function q(t,e){var n=L[0]=t[0];if("a"===n||"A"===n)L[1]=e*t[1],L[2]=e*t[2],L[3]=t[3],L[4]=t[4],L[5]=t[5],L[6]=e*t[6],L[7]=e*t[7];else for(var i=1,r=t.length;i<r;++i)L[i]=e*t[i];return L}function N(t,e,n,i,r){var o,s,a,u,l,h=null,c=0,f=0,d=0,v=0;null==n&&(n=0),null==i&&(i=0),null==r&&(r=1),t.beginPath&&t.beginPath();for(var g=0,p=e.length;g<p;++g){switch(o=e[g],1!==r&&(o=q(o,r)),o[0]){case"l":c+=o[1],f+=o[2],t.lineTo(c+n,f+i);break;case"L":c=o[1],f=o[2],t.lineTo(c+n,f+i);break;case"h":c+=o[1],t.lineTo(c+n,f+i);break;case"H":c=o[1],t.lineTo(c+n,f+i);break;case"v":f+=o[1],t.lineTo(c+n,f+i);break;case"V":f=o[1],t.lineTo(c+n,f+i);break;case"m":c+=o[1],f+=o[2],t.moveTo(c+n,f+i);break;case"M":c=o[1],f=o[2],t.moveTo(c+n,f+i);break;case"c":s=c+o[5],a=f+o[6],d=c+o[3],v=f+o[4],t.bezierCurveTo(c+o[1]+n,f+o[2]+i,d+n,v+i,s+n,a+i),c=s,f=a;break;case"C":c=o[5],f=o[6],d=o[3],v=o[4],t.bezierCurveTo(o[1]+n,o[2]+i,d+n,v+i,c+n,f+i);break;case"s":s=c+o[3],a=f+o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,c+o[1]+n,f+o[2]+i,s+n,a+i),d=c+o[1],v=f+o[2],c=s,f=a;break;case"S":s=o[3],a=o[4],d=2*c-d,v=2*f-v,t.bezierCurveTo(d+n,v+i,o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"q":s=c+o[3],a=f+o[4],d=c+o[1],v=f+o[2],t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"Q":s=o[3],a=o[4],t.quadraticCurveTo(o[1]+n,o[2]+i,s+n,a+i),c=s,f=a,d=o[1],v=o[2];break;case"t":s=c+o[1],a=f+o[2],null===h[0].match(/[QqTt]/)?(d=c,v=f):"t"===h[0]?(d=2*c-u,v=2*f-l):"q"===h[0]&&(d=2*c-d,v=2*f-v),u=d,l=v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),f=a,d=(c=s)+o[1],v=f+o[2];break;case"T":s=o[1],a=o[2],d=2*c-d,v=2*f-v,t.quadraticCurveTo(d+n,v+i,s+n,a+i),c=s,f=a;break;case"a":O(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+c+n,o[7]+f+i]),c+=o[6],f+=o[7];break;case"A":O(t,c+n,f+i,[o[1],o[2],o[3],o[4],o[5],o[6]+n,o[7]+i]),c=o[6],f=o[7];break;case"z":case"Z":t.closePath()}h=o}}function O(t,e,n,i){for(var r=function(t,e,n,i,r,o,s,a,u){var l=S.call(arguments);if(C[l])return C[l];var h=s*T,c=Math.sin(h),f=Math.cos(h),d=f*(a-t)*.5+c*(u-e)*.5,v=f*(u-e)*.5-c*(a-t)*.5,g=d*d/((n=Math.abs(n))*n)+v*v/((i=Math.abs(i))*i);g>1&&(n*=g=Math.sqrt(g),i*=g);var p=f/n,y=c/n,_=-c/i,m=f/i,x=p*a+y*u,b=_*a+m*u,k=p*t+y*e,w=_*t+m*e,z=1/((k-x)*(k-x)+(w-b)*(w-b))-.25;z<0&&(z=0);var P=Math.sqrt(z);o==r&&(P=-P);var R=.5*(x+k)-P*(w-b),L=.5*(b+w)+P*(k-x),q=Math.atan2(b-L,x-R),N=Math.atan2(w-L,k-R)-q;N<0&&1===o?N+=M:N>0&&0===o&&(N-=M);for(var O=Math.ceil(Math.abs(N/(A+.001))),E=[],I=0;I<O;++I){var D=q+I*N/O,V=q+(I+1)*N/O;E[I]=[R,L,D,V,n,i,c,f]}return C[l]=E}(i[5],i[6],i[0],i[1],i[3],i[4],i[2],e,n),o=0;o<r.length;++o){var s=R(r[o]);t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}var E={circle:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,M)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/2.5;t.moveTo(-n,-i),t.lineTo(-n,i),t.lineTo(-i,i),t.lineTo(-i,n),t.lineTo(i,n),t.lineTo(i,i),t.lineTo(n,i),t.lineTo(n,-i),t.lineTo(i,-i),t.lineTo(i,-n),t.lineTo(-i,-n),t.lineTo(-i,-i),t.closePath()}},diamond:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),i=-n/2;t.rect(i,i,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,i=n/7,r=n/2.5,o=n/8;t.moveTo(-i,n),t.lineTo(i,n),t.lineTo(i,-o),t.lineTo(r,-o),t.lineTo(0,-n),t.lineTo(-r,-o),t.lineTo(-i,-o),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n,r=i-.5773502691896257*n,o=n/4;t.moveTo(0,-i-r),t.lineTo(-o,i-r),t.lineTo(o,i-r),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n,r=i-.5773502691896257*n;t.moveTo(0,-i-r),t.lineTo(-n,i-r),t.lineTo(n,i-r),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(0,-i),t.lineTo(-n,i),t.lineTo(n,i),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(0,i),t.lineTo(-n,-i),t.lineTo(n,-i),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(i,0),t.lineTo(-i,-n),t.lineTo(-i,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,i=z*n;t.moveTo(-i,0),t.lineTo(i,-n),t.lineTo(i,n),t.closePath()}},stroke:{draw:function(t,e){var n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function I(t){return e.hasOwnProperty(E,t)?E[t]:function(t){if(!e.hasOwnProperty(D,t)){var n=w(t);D[t]={draw:function(t,e){N(t,n,0,0,Math.sqrt(e)/2)}}}return D[t]}(t)}var D={};function V(t){return t.x}function H(t){return t.y}function B(t){return t.width}function G(t){return t.height}function W(t){return function(){return t}}function j(){var t=V,e=H,n=B,i=G,r=W(0),s=null;function a(a,u,l){var h,c=null!=u?u:+t.call(this,a),f=null!=l?l:+e.call(this,a),d=+n.call(this,a),v=+i.call(this,a),g=+r.call(this,a);if(s||(s=h=o.path()),g<=0)s.rect(c,f,d,v);else{var p=c+d,y=f+v;s.moveTo(c+g,f),s.lineTo(p-g,f),s.quadraticCurveTo(p,f,p,f+g),s.lineTo(p,y-g),s.quadraticCurveTo(p,y,p-g,y),s.lineTo(c+g,y),s.quadraticCurveTo(c,y,c,y-g),s.lineTo(c,f+g),s.quadraticCurveTo(c,f,c+g,f),s.closePath()}if(h)return s=null,h+""||null}return a.x=function(e){return arguments.length?(t="function"==typeof e?e:W(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:W(+t),a):e},a.width=function(t){return arguments.length?(n="function"==typeof t?t:W(+t),a):n},a.height=function(t){return arguments.length?(i="function"==typeof t?t:W(+t),a):i},a.cornerRadius=function(t){return arguments.length?(r="function"==typeof t?t:W(+t),a):r},a.context=function(t){return arguments.length?(s=null==t?null:t,a):s},a}function U(){var t,e,n,i,r,s,a,u,l=null;function h(t,e,n){var i=n/2;if(r){var o=a-e,h=t-s;if(o||h){var c=Math.sqrt(o*o+h*h),f=(o/=c)*u,d=(h/=c)*u,v=Math.atan2(h,o);l.moveTo(s-f,a-d),l.lineTo(t-o*i,e-h*i),l.arc(t,e,i,v-Math.PI,v),l.lineTo(s+f,a+d),l.arc(s,a,u,v,v+Math.PI)}else l.arc(t,e,i,0,M);l.closePath()}else r=1;s=t,a=e,u=i}function c(s){var a,u,c,f=s.length,d=!1;for(null==l&&(l=c=o.path()),a=0;a<=f;++a)!(a<f&&i(u=s[a],a,s))===d&&(d=!d)&&(r=0),d&&h(+t(u,a,s),+e(u,a,s),+n(u,a,s));if(c)return l=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(i=t,c):i},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}function X(t){return t.x||0}function J(t){return t.y||0}function F(t){return t.cornerRadius||0}function Y(t){return!(!1===t.defined)}var Q=r.arc().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(F),Z=r.area().x(X).y1(J).y0(function(t){return(t.y||0)+(t.height||0)}).defined(Y),$=r.area().y(J).x1(X).x0(function(t){return(t.x||0)+(t.width||0)}).defined(Y),K=r.line().x(X).y(J).defined(Y),tt=j().x(X).y(J).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(F),et=r.symbol().type(function(t){return I(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),nt=U().x(X).y(J).defined(Y).size(function(t){return t.size||1});function it(t,e,n,i){return tt.context(t)(e,n,i)}function rt(t,e){return e.stroke&&0!==e.opacity&&0!==e.strokeOpacity&&t.expand(null!=e.strokeWidth?+e.strokeWidth:1),t}var ot,st=M-1e-8;function at(t){return ot=t,at}function ut(){}function lt(t,e){ot.add(t,e)}at.beginPath=ut,at.closePath=ut,at.moveTo=lt,at.lineTo=lt,at.rect=function(t,e,n,i){lt(t,e),lt(t+n,e+i)},at.quadraticCurveTo=function(t,e,n,i){lt(t,e),lt(n,i)},at.bezierCurveTo=function(t,e,n,i,r,o){lt(t,e),lt(n,i),lt(r,o)},at.arc=function(t,e,n,i,r,o){if(Math.abs(r-i)>st)return lt(t-n,e-n),void lt(t+n,e+n);var s,a,u,l,h=1/0,c=-1/0,f=1/0,d=-1/0;function v(t){u=n*Math.cos(t),l=n*Math.sin(t),u<h&&(h=u),u>c&&(c=u),l<f&&(f=l),l>d&&(d=l)}if(v(i),v(r),r!==i)if((i%=M)<0&&(i+=M),(r%=M)<0&&(r+=M),r<i&&(o=!o,s=i,i=r,r=s),o)for(r-=M,s=i-i%A,a=0;a<4&&s>r;++a,s-=A)v(s);else for(s=i-i%A+A,a=0;a<4&&s<r;++a,s+=A)v(s);lt(t+h,e+f),lt(t+c,e+d)};var ht=(ht=n.canvas(1,1))?ht.getContext("2d"):null;const ct=new s;function ft(t){return function(e,n){if(!ht)return!0;t(ht,e),ct.clear().union(e.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=ct;for(let t=r;t<=s;++t)for(let e=i;e<=o;++e)if(ht.isPointInPath(e,t))return!0;return!1}}function dt(t,e){return e.contains(t.x||0,t.y||0)}function vt(t,e){const n=t.x||0,i=t.y||0,r=t.width||0,o=t.height||0;return e.intersects(ct.set(n,i,n+r,i+o))}function gt(t,e){const n=t.x||0,i=t.y||0;return pt(e,n,i,null!=t.x2?t.x2:n,null!=t.y2?t.y2:i)}function pt(t,e,n,i,r){const{x1:o,y1:s,x2:a,y2:u}=t,l=i-e,h=r-n;let c,f,d,v,g=0,p=1;for(v=0;v<4;++v){if(0===v&&(c=-l,f=-(o-e)),1===v&&(c=l,f=a-e),2===v&&(c=-h,f=-(s-n)),3===v&&(c=h,f=u-n),Math.abs(c)<1e-10&&f<0)return!1;if(d=f/c,c<0){if(d>p)return!1;d>g&&(g=d)}else if(c>0){if(d<g)return!1;d<p&&(p=d)}}return!0}function yt(t,e,n){return h(n)?function(t,e,n){const i=n.width(),r=n.height(),o=e.stops,s=o.length,a="radial"===e.gradient?t.createRadialGradient(n.x1+(e.x1||.5)*i,n.y1+(e.y1||.5)*r,Math.max(i,r)*(e.r1||0),n.x1+(e.x2||.5)*i,n.y1+(e.y2||.5)*r,Math.max(i,r)*(e.r2||.5)):t.createLinearGradient(n.x1+(e.x1||0)*i,n.y1+(e.y1||0)*r,n.x1+(e.x2||1)*i,n.y1+(e.y2||0)*r);for(let t=0;t<s;++t)a.addColorStop(o[t].offset,o[t].color);return a}(t,n,e.bounds):n}function _t(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=yt(t,e,e.fill),!0)}var mt=[];function xt(t,e,n){var i=null!=(i=e.strokeWidth)?i:1;return!(i<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=yt(t,e,e.stroke),t.lineWidth=i,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||mt),t.lineDashOffset=e.strokeDashOffset||0),!0))}function bt(t,e){return t.zindex-e.zindex||t.index-e.index}function kt(t){if(!t.zdirty)return t.zitems;var e,n,i,r=t.items,o=[];for(n=0,i=r.length;n<i;++n)(e=r[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(bt)}function wt(t,e){var n,i,r=t.items;if(r&&r.length){var o=kt(t);if(o&&o.length){for(n=0,i=r.length;n<i;++n)r[n].zindex||e(r[n]);r=o}for(n=0,i=r.length;n<i;++n)e(r[n])}}function Tt(t,e){var n,i,r=t.items;if(!r||!r.length)return null;var o=kt(t);for(o&&o.length&&(r=o),i=r.length;--i>=0;)if(n=e(r[i]))return n;if(r===o)for(i=(r=t.items).length;--i>=0;)if(!r[i].zindex&&(n=e(r[i])))return n;return null}function At(t){return function(e,n,i){wt(n,function(n){i&&!i.intersects(n.bounds)||zt(t,e,n,n)})}}function Mt(t){return function(e,n,i){!n.items.length||i&&!i.intersects(n.bounds)||zt(t,e,n.items[0],n.items)}}function zt(t,e,n,i){var r=null==n.opacity?1:n.opacity;0!==r&&(t(e,i)||(n.fill&&_t(e,n,r)&&e.fill(),n.stroke&&xt(e,n,r)&&e.stroke()))}function Ct(t){return t=t||e.truthy,function(e,n,i,r,o,s){return i*=e.pixelRatio,r*=e.pixelRatio,Tt(n,function(n){var a=n.bounds;if((!a||a.contains(o,s))&&a)return t(e,n,i,r,o,s)?n:void 0})}}function Pt(t,e){return function(n,i,r,o){var s,a,u=Array.isArray(i)?i[0]:i,l=null==e?u.fill:e,h=u.stroke&&n.isPointInStroke;return h&&(s=u.strokeWidth,a=u.strokeCap,n.lineWidth=null!=s?s:1,n.lineCap=null!=a?a:"butt"),!t(n,i)&&(l&&n.isPointInPath(r,o)||h&&n.isPointInStroke(r,o))}}function St(t){return Ct(Pt(t))}function Rt(t,e){return"translate("+t+","+e+")"}function Lt(t){return"rotate("+t+")"}function qt(t){return Rt(t.x||0,t.y||0)}function Nt(t,e,n){function i(t,n){var i=n.x||0,r=n.y||0,o=n.angle||0;t.translate(i,r),o&&t.rotate(o*=T),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-i,-r)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return Rt(t.x||0,t.y||0)+(t.angle?" "+Lt(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){var i=n.x||0,r=n.y||0;return e(at(t),n),rt(t,n).translate(i,r),n.angle&&t.rotate(n.angle*T,i,r),t},draw:At(i),pick:St(i),isect:n||ft(i)}}var Ot=Nt("arc",function(t,e){return Q.context(t)(e)});function Et(t,e,n){function i(t,n){t.beginPath(),e(t,n)}var r=Pt(i);return{type:t,tag:"path",nested:!0,attr:function(t,n){var i=n.mark.items;i.length&&t("d",e(null,i))},bound:function(t,n){var i=n.items;return 0===i.length?t:(e(at(t),i),rt(t,i[0]))},draw:Mt(i),pick:function(t,e,n,i,o,s){var a=e.items,u=e.bounds;return!a||!a.length||u&&!u.contains(o,s)?null:(n*=t.pixelRatio,i*=t.pixelRatio,r(t,a,n,i)?a[0]:null)},isect:dt,tip:n}}var It=Et("area",function(t,e){var n=e[0],i=n.interpolate||"linear";return("horizontal"===n.orient?$:Z).curve(x(i,n.orient,n.tension)).context(t)(e)},function(t,e){for(var n,i,r="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",s=t.length,a=1/0;--s>=0;)!1!==t[s].defined&&(i=Math.abs(t[s][o]-r))<a&&(a=i,n=t[s]);return n}),Dt=1;function Vt(t,n,i){var r=n.clip,o=t._defs,s=n.clip_id||(n.clip_id="clip"+Dt++),a=o.clipping[s]||(o.clipping[s]={id:s});return e.isFunction(r)?a.path=r(null):(a.width=i.width||0,a.height=i.height||0),"url(#"+s+")"}var Ht=.5;function Bt(t,e){var n=e.stroke?Ht:0;t.beginPath(),it(t,e,n,n)}var Gt=Pt(Bt);var Wt={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",qt(e))},bound:function(t,e){if(!e.clip&&e.items)for(var n=e.items,i=0,r=n.length;i<r;++i)t.union(n[i].bounds);return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),rt(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n){var i=this;wt(e,function(e){var r,o=e.x||0,s=e.y||0,a=e.width||0,u=e.height||0;t.save(),t.translate(o,s),(e.stroke||e.fill)&&(r=null==e.opacity?1:e.opacity)>0&&(Bt(t,e),e.fill&&_t(t,e,r)&&t.fill(),e.stroke&&xt(t,e,r)&&t.stroke()),e.clip&&(t.beginPath(),t.rect(0,0,a,u),t.clip()),n&&n.translate(-o,-s),wt(e,function(e){i.draw(t,e,n)}),n&&n.translate(o,s),t.restore()})},pick:function(t,e,n,i,r,o){if(e.bounds&&!e.bounds.contains(r,o)||!e.items)return null;var s=this,a=n*t.pixelRatio,u=i*t.pixelRatio;return Tt(e,function(l){var h,c,f,d;if(!(d=l.bounds)||d.contains(r,o))return c=l.x||0,f=l.y||0,t.save(),t.translate(c,f),c=r-c,f=o-f,!(h=Tt(l,function(t){return function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?s.pick(t,n,i,c,f):null}))&&!1!==e.interactive&&(l.fill||l.stroke)&&Gt(t,l,a,u)&&(h=l),t.restore(),h||null})},isect:vt,background:function(t,e){var n=e.stroke?Ht:0;t("class","background"),t("d",it(null,e,n,n))},foreground:function(t,e,n){t("clip-path",e.clip?Vt(n,e,e):null)}};function jt(t,e){var n=t.image;return n&&n.url===t.url||(n={loaded:!1,width:0,height:0},e.loadImage(t.url).then(function(e){t.image=e,t.image.url=t.url})),n}function Ut(t,e){return"center"===t?e/2:"right"===t?e:0}function Xt(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var Jt={type:"image",tag:"image",nested:!1,attr:function(t,e,n){var i=jt(e,n),r=e.x||0,o=e.y||0,s=(null!=e.width?e.width:i.width)||0,a=(null!=e.height?e.height:i.height)||0,u=!1===e.aspect?"none":"xMidYMid";r-=Ut(e.align,s),o-=Xt(e.baseline,a),t("href",i.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Rt(r,o)),t("width",s),t("height",a),t("preserveAspectRatio",u)},bound:function(t,e){var n=e.image,i=e.x||0,r=e.y||0,o=(null!=e.width?e.width:n&&n.width)||0,s=(null!=e.height?e.height:n&&n.height)||0;return i-=Ut(e.align,o),r-=Xt(e.baseline,s),t.set(i,r,i+o,r+s)},draw:function(t,e,n){var i=this;wt(e,function(e){if(!n||n.intersects(e.bounds)){var r,o,s,a,u=jt(e,i),l=e.x||0,h=e.y||0,c=(null!=e.width?e.width:u.width)||0,f=(null!=e.height?e.height:u.height)||0;l-=Ut(e.align,c),h-=Xt(e.baseline,f),!1!==e.aspect&&(o=u.width/u.height,s=e.width/e.height,o==o&&s==s&&o!==s&&(s<o?(h+=(f-(a=c/o))/2,f=a):(l+=(c-(a=f*o))/2,c=a))),u.loaded&&(t.globalAlpha=null!=(r=e.opacity)?r:1,t.drawImage(u,l,h,c,f))}})},pick:Ct(),isect:e.truthy,get:jt,xOffset:Ut,yOffset:Xt},Ft=Et("line",function(t,e){var n=e[0],i=n.interpolate||"linear";return K.curve(x(i,n.orient,n.tension)).context(t)(e)},function(t,e){for(var n,i,r=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(i=t[o].y-e[1])*i<r)return t[o];return null});function Yt(t,e){var n=e.path;if(null==n)return!0;var i=e.pathCache;i&&i.path===n||((e.pathCache=i=w(n)).path=n),N(t,i,e.x,e.y)}var Qt={type:"path",tag:"path",nested:!1,attr:function(t,e){t("transform",qt(e)),t("d",e.path)},bound:function(t,e){return Yt(at(t),e)?t.set(0,0,0,0):rt(t,e)},draw:At(Yt),pick:St(Yt),isect:ft(Yt)};function Zt(t,e){t.beginPath(),it(t,e)}var $t={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",it(null,e))},bound:function(t,e){var n,i;return rt(t.set(n=e.x||0,i=e.y||0,n+e.width||0,i+e.height||0),e)},draw:At(Zt),pick:St(Zt),isect:vt};function Kt(t,e,n){var i,r,o,s;return!(!e.stroke||!xt(t,e,n))&&(i=e.x||0,r=e.y||0,o=null!=e.x2?e.x2:i,s=null!=e.y2?e.y2:r,t.beginPath(),t.moveTo(i,r),t.lineTo(o,s),!0)}var te,ee={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",qt(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,i;return rt(t.set(n=e.x||0,i=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:i),e)},draw:function(t,e,n){wt(e,function(e){if(!n||n.intersects(e.bounds)){var i=null==e.opacity?1:e.opacity;i&&Kt(t,e,i)&&t.stroke()}})},pick:Ct(function(t,e,n,i){return!!t.isPointInStroke&&(Kt(t,e,1)&&t.isPointInStroke(n,i))}),isect:gt},ne=Nt("shape",function(t,e){return(e.mark.shape||e.shape).context(t)(e)}),ie=Nt("symbol",function(t,e){return et.context(t)(e)},dt),re={height:le,measureWidth:ae,estimateWidth:oe,width:oe,canvas:he};function oe(t){return te=le(t),se(ce(t))}function se(t){return~~(.8*t.length*te)}function ae(t){return le(t)<=0?0:(ht.font=de(t),ue(ce(t)))}function ue(t){return ht.measureText(t).width}function le(t){return null!=t.fontSize?t.fontSize:11}function he(t){re.width=t&&ht?ae:oe}function ce(t){var e=t.text;return null==e?"":t.limit>0?function(t){var e,n=+t.limit,i=t.text+"";re.width===ae?(ht.font=de(t),e=ue):(te=le(t),e=se);if(e(i)<n)return i;var r,o=t.ellipsis||"…",s="rtl"===t.dir,a=0,u=i.length;if(n-=e(o),s){for(;a<u;)r=a+u>>>1,e(i.slice(r))>n?a=r+1:u=r;return o+i.slice(a)}for(;a<u;)r=1+(a+u>>>1),e(i.slice(0,r))<n?a=r:u=r-1;return i.slice(0,a)+o}(t):e+""}function fe(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function de(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+le(t)+"px "+fe(t,e)}function ve(t){var e=t.baseline,n=le(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:0)}he(!0);var ge={left:"start",center:"middle",right:"end"},pe=new s;function ye(t){var e,n=t.x||0,i=t.y||0,r=t.radius||0;return r&&(e=(t.theta||0)-A,n+=r*Math.cos(e),i+=r*Math.sin(e)),pe.x1=n,pe.y1=i,pe}function _e(t,e,n){var i,r=re.height(e),o=e.align,s=ye(e),a=s.x1,u=s.y1,l=e.dx||0,h=(e.dy||0)+ve(e)-Math.round(.8*r);if(i=re.width(e),"center"===o?l-=i/2:"right"===o&&(l-=i),t.set(l+=a,h+=u,l+i,h+r),e.angle&&!n)t.rotate(e.angle*T,a,u);else if(2===n)return t.rotatedPoints(e.angle*T,a,u);return t}var me={arc:Ot,area:It,group:Wt,image:Jt,line:Ft,path:Qt,rect:$t,rule:ee,shape:ne,symbol:ie,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,i=e.dx||0,r=(e.dy||0)+ve(e),o=ye(e),s=o.x1,a=o.y1,u=e.angle||0;t("text-anchor",ge[e.align]||"start"),u?(n=Rt(s,a)+" "+Lt(u),(i||r)&&(n+=" "+Rt(i,r))):n=Rt(s+i,a+r),t("transform",n)},bound:_e,draw:function(t,e,n){wt(e,function(e){var i,r,o,s,a;n&&!n.intersects(e.bounds)||(a=ce(e))&&(0===(i=null==e.opacity?1:e.opacity)||e.fontSize<=0||(t.font=de(e),t.textAlign=e.align||"left",o=(r=ye(e)).x1,s=r.y1,e.angle&&(t.save(),t.translate(o,s),t.rotate(e.angle*T),o=s=0),o+=e.dx||0,s+=(e.dy||0)+ve(e),e.fill&&_t(t,e,i)&&t.fillText(a,o,s),e.stroke&&xt(t,e,i)&&t.strokeText(a,o,s),e.angle&&t.restore()))})},pick:Ct(function(t,e,n,i,r,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var s=ye(e),a=s.x1,u=s.y1,l=_e(pe,e,1),h=-e.angle*T,c=Math.cos(h),f=Math.sin(h),d=c*r-f*o+(a-c*a+f*u),v=f*r+c*o+(u-f*a-c*u);return l.contains(d,v)}),isect:function(t,e){var n=_e(pe,t,2);return pt(e,n[0],n[1],n[2],n[3])||pt(e,n[0],n[1],n[4],n[5])||pt(e,n[4],n[5],n[6],n[7])||pt(e,n[2],n[3],n[6],n[7])}},trail:Et("trail",function(t,e){return nt.context(t)(e)},function(t,e){for(var n,i,r=t.length;--r>=0;)if(!1!==t[r].defined&&(n=t[r].x-e[0])*n+(i=t[r].y-e[1])*i<(n=t[r].size||1)*n)return t[r];return null})};function xe(t,e,n){var i=me[t.mark.marktype],r=e||i.bound;return i.nested&&(t=t.mark),r(t.bounds||(t.bounds=new s),t,n)}var be={mark:null};function ke(t,e,n){var i,r,o,a,u=me[t.marktype],l=u.bound,h=t.items,c=h&&h.length;if(u.nested)return c?o=h[0]:(be.mark=t,o=be),a=xe(o,l,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new s,c)for(i=0,r=h.length;i<r;++i)e.union(xe(h[i],l,n));return t.bounds=e}var we=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function Te(t,e){return JSON.stringify(t,we,e)}function Ae(t){return function t(e){var n,i,r,o=e.marktype,s=e.items;if(s)for(i=0,r=s.length;i<r;++i)n=o?"mark":"group",s[i][n]=e,s[i].zindex&&(s[i][n].zdirty=!0),"group"===(o||n)&&t(s[i]);o&&ke(e);return e}("string"==typeof t?JSON.parse(t):t)}function Me(t){arguments.length?this.root=Ae(t):(this.root=Ce({marktype:"group",name:"root",role:"frame"}),this.root.items=[new v(this.root)])}var ze=Me.prototype;function Ce(t,e){return{bounds:new s,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Pe(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function Se(t,e){e=e.toLowerCase();for(var n=t.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===e)return n[i]}function Re(t,e,n,i){var r,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(r=o||null,o=Pe(t.ownerDocument,n,i),t.insertBefore(o,r)),o}function Le(t,e){for(var n=t.childNodes,i=n.length;i>e;)t.removeChild(n[--i]);return t}function qe(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Ne(t,e){var n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function Oe(t,e){this._active=null,this._handlers={},this._loader=t||i.loader(),this._tooltip=e||Ee}function Ee(t,e,n,i){t.element().setAttribute("title",i||"")}ze.toJSON=function(t){return Te(this.root,t||0)},ze.mark=function(t,e,n){var i=Ce(t,e=e||this.root.items[0]);return e.items[n]=i,i.zindex&&(i.group.zdirty=!0),i};var Ie=Oe.prototype;function De(t){this._el=null,this._bgcolor=null,this._loader=new g(t)}Ie.initialize=function(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},Ie.element=function(){return this._el},Ie.canvas=function(){return this._el&&this._el.firstChild},Ie.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},Ie.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},Ie.on=function(){},Ie.off=function(){},Ie._handlerIndex=function(t,e,n){for(var i=t?t.length:0;--i>=0;)if(t[i].type===e&&(!n||t[i].handler===n))return i;return-1},Ie.handlers=function(t){var e,n=this._handlers,i=[];if(t)i.push.apply(i,n[this.eventName(t)]);else for(e in n)i.push.apply(i,n[e]);return i},Ie.eventName=function(t){var e=t.indexOf(".");return e<0?t:t.slice(0,e)},Ie.handleHref=function(t,e,n){this._loader.sanitize(n,{context:"href"}).then(function(e){var n=new MouseEvent(t.type,t),i=Pe(null,"a");for(var r in e)i.setAttribute(r,e[r]);i.dispatchEvent(n)}).catch(function(){})},Ie.handleTooltip=function(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,i){var r,o,s=t&&t.mark;if(s&&(r=me[s.marktype]).tip){for((o=Ne(e,n))[0]-=i[0],o[1]-=i[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=r.tip(s.items,o)}return t}(e,t,this.canvas(),this._origin);var i=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,i)}},Ie.getItemBoundingClientRect=function(t){if(e=this.canvas()){for(var e,n=e.getBoundingClientRect(),i=this._origin,r=t.bounds,o=r.x1+i[0]+n.left,s=r.y1+i[1]+n.top,a=r.width(),u=r.height();t.mark&&(t=t.mark.group);)o+=t.x||0,s+=t.y||0;return{x:o,y:s,width:a,height:u,left:o,top:s,right:o+a,bottom:s+u}}};var Ve=De.prototype;Ve.initialize=function(t,e,n,i,r){return this._el=t,this.resize(e,n,i,r)},Ve.element=function(){return this._el},Ve.canvas=function(){return this._el&&this._el.firstChild},Ve.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},Ve.resize=function(t,e,n,i){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=i||1,this},Ve.dirty=function(){},Ve.render=function(t){var e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},Ve._render=function(){},Ve.renderAsync=function(t){var e=this.render(t);return this._ready?this._ready.then(function(){return e}):Promise.resolve(e)},Ve._load=function(t,e){var n=this,i=n._loader[t](e);if(!n._ready){var r=n._call;n._ready=n._loader.ready().then(function(t){t&&r(),n._ready=null})}return i},Ve.sanitizeURL=function(t){return this._load("sanitizeURL",t)},Ve.loadImage=function(t){return this._load("loadImage",t)};var He="mouseout";function Be(t,e){Oe.call(this,t,e),this._down=null,this._touch=null,this._first=!0}var Ge=e.inherits(Be,Oe);function We(t,e,n){return function(i){var r=this._active,o=this.pickEvent(i);o===r?this.fire(t,i):(r&&r.exit||this.fire(n,i),this._active=o,this.fire(e,i),this.fire(t,i))}}function je(t){return function(e){this.fire(t,e),this._active=null}}Ge.initialize=function(t,e,n){var i=this._canvas=t&&Se(t,"canvas");if(i){var r=this;this.events.forEach(function(t){i.addEventListener(t,function(e){Ge[t]?Ge[t].call(r,e):r.fire(t,e)})})}return Oe.prototype.initialize.call(this,t,e,n)},Ge.canvas=function(){return this._canvas},Ge.context=function(){return this._canvas.getContext("2d")},Ge.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Ge.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Ge.mousemove=We("mousemove","mouseover","mouseout"),Ge.dragover=We("dragover","dragenter","dragleave"),Ge.mouseout=je("mouseout"),Ge.dragleave=je("dragleave"),Ge.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Ge.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Ge.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Ge.touchmove=function(t){this.fire("touchmove",t,!0)},Ge.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Ge.fire=function(t,e,n){var i,r,o=n?this._touch:this._active,s=this._handlers[t];if(e.vegaType=t,"click"===t&&o&&o.href?this.handleHref(e,o,o.href):"mousemove"!==t&&t!==He||this.handleTooltip(e,o,t!==He),s)for(i=0,r=s.length;i<r;++i)s[i].handler.call(this._obj,e,o)},Ge.on=function(t,e){var n=this.eventName(t),i=this._handlers;return this._handlerIndex(i[n],t,e)<0&&(i[n]||(i[n]=[])).push({type:t,handler:e}),this},Ge.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&i.splice(r,1),this},Ge.pickEvent=function(t){var e=Ne(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},Ge.pick=function(t,e,n,i,r){var o=this.context();return me[t.marktype].pick.call(this,o,t,e,n,i,r)};var Ue="undefined"!=typeof window&&window.devicePixelRatio||1;function Xe(t){De.call(this,t),this._redraw=!1,this._dirty=new s}var Je=e.inherits(Xe,De),Fe=De.prototype,Ye=new s;function Qe(t,e){Oe.call(this,t,e);var n=this;n._hrefHandler=$e(n,function(t,e){e&&e.href&&n.handleHref(t,e,e.href)}),n._tooltipHandler=$e(n,function(t,e){n.handleTooltip(t,e,t.type!==He)})}Je.initialize=function(t,e,i,r,o,s){return this._options=s,this._canvas=n.canvas(1,1,s&&s.type),t&&(Le(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Fe.initialize.call(this,t,e,i,r,o)},Je.resize=function(t,e,n,i){return Fe.resize.call(this,t,e,n,i),function(t,e,n,i,r,o){var s,a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),l=a?Ue:r;for(s in t.width=e*l,t.height=n*l,o)u[s]=o[s];a&&1!==l&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=l,u.setTransform(l,0,0,l,l*i[0],l*i[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},Je.canvas=function(){return this._canvas},Je.context=function(){return this._canvas?this._canvas.getContext("2d"):null},Je.dirty=function(t){var e=function(t,e){if(null==e)return t;for(var n=Ye.clear().union(t);null!=e;e=e.mark.group)n.translate(e.x||0,e.y||0);return n}(t.bounds,t.mark.group);this._dirty.union(e)},Je._render=function(t){var e=this.context(),n=this._origin,i=this._width,r=this._height,o=this._dirty;return e.save(),this._redraw||o.empty()?(this._redraw=!1,o=null):o=function(t,e,n){return e.expand(1).round(),e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(e,o,n),this.clear(-n[0],-n[1],i,r),this.draw(e,t,o),e.restore(),this._dirty.clear(),this},Je.draw=function(t,n,i){var r=me[n.marktype];n.clip&&function(t,n){var i=n.clip;if(t.save(),t.beginPath(),e.isFunction(i))i(t);else{var r=n.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,n),r.draw.call(this,t,n,i),n.clip&&t.restore()},Je.clear=function(t,e,n,i){var r=this.context();r.clearRect(t,e,n,i),null!=this._bgcolor&&(r.fillStyle=this._bgcolor,r.fillRect(t,e,n,i))};var Ze=e.inherits(Qe,Oe);function $e(t,e){return function(n){var i=n.target.__data__;n.vegaType=n.type,i=Array.isArray(i)?i[0]:i,e.call(t._obj,n,i)}}function Ke(t,e,n){var i,r,o="<"+t;if(e)for(i in e)null!=(r=e[i])&&(o+=" "+i+'="'+r+'"');return n&&(o+=" "+n),o+">"}function tn(t){return"</"+t+">"}Ze.initialize=function(t,e,n){var i=this._svg;return i&&(i.removeEventListener("click",this._hrefHandler),i.removeEventListener("mousemove",this._tooltipHandler),i.removeEventListener(He,this._tooltipHandler)),this._svg=i=t&&Se(t,"svg"),i&&(i.addEventListener("click",this._hrefHandler),i.addEventListener("mousemove",this._tooltipHandler),i.addEventListener(He,this._tooltipHandler)),Oe.prototype.initialize.call(this,t,e,n)},Ze.canvas=function(){return this._svg},Ze.on=function(t,e){var n=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[n],t,e)<0){var r={type:t,handler:e,listener:$e(this,e)};(i[n]||(i[n]=[])).push(r),this._svg&&this._svg.addEventListener(n,r.listener)}return this},Ze.off=function(t,e){var n=this.eventName(t),i=this._handlers[n],r=this._handlerIndex(i,t,e);return r>=0&&(this._svg&&this._svg.removeEventListener(n,i[r].listener),i.splice(r,1)),this};var en={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},nn={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},rn=Object.keys(nn),on=en.xmlns;function sn(t){De.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var an=e.inherits(sn,De),un=De.prototype;function ln(t,e,n){var i,r,o;if("radial"===e.gradient){var s=Re(t,n++,"pattern",on);s.setAttribute("id",l+e.id),s.setAttribute("viewBox","0,0,1,1"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("preserveAspectRatio","xMidYMid slice"),(s=Re(s,0,"rect",on)).setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","url("+_n()+"#"+e.id+")"),(t=Re(t,n++,"radialGradient",on)).setAttribute("id",e.id),t.setAttribute("fx",e.x1),t.setAttribute("fy",e.y1),t.setAttribute("fr",e.r1),t.setAttribute("cx",e.x2),t.setAttribute("cy",e.y2),t.setAttribute("r",e.r2)}else(t=Re(t,n++,"linearGradient",on)).setAttribute("id",e.id),t.setAttribute("x1",e.x1),t.setAttribute("x2",e.x2),t.setAttribute("y1",e.y1),t.setAttribute("y2",e.y2);for(i=0,r=e.stops.length;i<r;++i)(o=Re(t,i,"stop",on)).setAttribute("offset",e.stops[i].offset),o.setAttribute("stop-color",e.stops[i].color);return Le(t,i),n}function hn(t,e,n){var i;return(t=Re(t,n,"clipPath",on)).setAttribute("id",e.id),e.path?(i=Re(t,0,"path",on)).setAttribute("d",e.path):((i=Re(t,0,"rect",on)).setAttribute("x",0),i.setAttribute("y",0),i.setAttribute("width",e.width),i.setAttribute("height",e.height)),n+1}function cn(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function fn(t,e,n,i,r){var o,s=t._svg;if(!s&&(s=Pe(o=e.ownerDocument,i,on),t._svg=s,t.mark&&(s.__data__=t,s.__values__={fill:"default"},"g"===i))){var a=Pe(o,"path",on);a.setAttribute("class","background"),s.appendChild(a),a.__data__=t;var u=Pe(o,"g",on);s.appendChild(u),u.__data__=t}return(s.ownerSVGElement!==r||function(t){var e=t.mark||t.group;return e&&e.items.length>1}(t)&&s.previousSibling!==n)&&e.insertBefore(s,n?n.nextSibling:e.firstChild),s}an.initialize=function(t,e,n,i){return t&&(this._svg=Re(t,0,"svg",on),this._svg.setAttribute("class","marks"),Le(t,1),this._root=Re(this._svg,0,"g",on),Le(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),un.initialize.call(this,t,e,n,i)},an.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),un.background.apply(this,arguments)},an.resize=function(t,e,n,i){return un.resize.call(this,t,e,n,i),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},an.canvas=function(){return this._svg},an.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var e in en)t[e]=en[e];var n=this._bgcolor?Ke("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+tn("rect"):"";return Ke("svg",t)+n+this._svg.innerHTML+tn("svg")},an._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Le(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},an.updateDefs=function(){var t,e=this._svg,n=this._defs,i=n.el,r=0;for(t in n.gradient)i||(n.el=i=Re(e,0,"defs",on)),r=ln(i,n.gradient[t],r);for(t in n.clipping)i||(n.el=i=Re(e,0,"defs",on)),r=hn(i,n.clipping[t],r);i&&(0===r?(e.removeChild(i),n.el=null):Le(i,r))},an._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},an.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},an.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},an._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)return!0;var e,n,i,r,o,s,a,u=++this._dirtyID;for(o=0,s=t.length;o<s;++o)(n=(e=t[o]).mark).marktype!==i&&(i=n.marktype,r=me[i]),n.zdirty&&n.dirty!==u&&(this._dirtyAll=!1,cn(e,u),n.items.forEach(function(t){t.dirty=u})),n.zdirty||(e.exit?(r.nested&&n.items.length?(a=n.items[0])._svg&&this._update(r,a._svg,a):e._svg&&(a=e._svg.parentNode)&&a.removeChild(e._svg),e._svg=null):(e=r.nested?n.items[0]:e)._update!==u&&(e._svg&&e._svg.ownerSVGElement?this._update(r,e._svg,e):(this._dirtyAll=!1,cn(e,u)),e._update=u));return!this._dirtyAll},an.draw=function(t,e,n){if(!this.isDirty(e))return e._svg;var i,r=this,o=this._svg,s=me[e.marktype],a=!1===e.interactive?"none":null,u="g"===s.tag,l=null,h=0;function c(t){var e=r.isDirty(t),n=fn(t,i,l,s.tag,o);e&&(r._update(s,n,t),u&&function(t,e,n){e=e.lastChild;var i,r=0;wt(n,function(n){i=t.draw(e,n,i),++r}),Le(e,1+r)}(r,n,t)),l=n,++h}return(i=fn(e,t,n,"g",o)).setAttribute("class",qe(e)),u||i.style.setProperty("pointer-events",a),e.clip?i.setAttribute("clip-path",Vt(r,e,e.group)):i.removeAttribute("clip-path"),s.nested?e.items.length&&c(e.items[0]):wt(e,c),Le(i,h),i};var dn=null,vn=null,gn={group:function(t,e,n){vn=e.__values__,dn=e.childNodes[1],t.foreground(yn,n,this),dn=e.childNodes[0],t.background(yn,n,this);var i=!1===n.mark.interactive?"none":null;i!==vn.events&&(dn.style.setProperty("pointer-events",i),vn.events=i)},text:function(t,e,n){var i;(i=ce(n))!==vn.text&&(e.textContent=i,vn.text=i),pn(e,"font-family",fe(n)),pn(e,"font-size",le(n)+"px"),pn(e,"font-style",n.fontStyle),pn(e,"font-variant",n.fontVariant),pn(e,"font-weight",n.fontWeight)}};function pn(t,e,n){n!==vn[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),vn[e]=n)}function yn(t,e,n){e!==vn[t]&&(null!=e?n?dn.setAttributeNS(n,t,e):dn.setAttribute(t,e):n?dn.removeAttributeNS(n,t):dn.removeAttribute(t),vn[t]=e)}function _n(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function mn(t){De.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}an._update=function(t,e,n){dn=e,vn=e.__values__,t.attr(yn,n,this);var i=gn[t.type];i&&i.call(this,t,e,n),this.style(dn,n)},an.style=function(t,e){var n,i,r,o,s;if(null!=e)for(n=0,i=rn.length;n<i;++n)s=e[r=rn[n]],"font"===r&&(s=fe(e)),s!==vn[r]&&(o=nn[r],null==s?"fill"===o?t.style.setProperty(o,"none"):t.style.removeProperty(o):(h(s)&&(s=c(s,this._defs.gradient,_n())),t.style.setProperty(o,s+"")),vn[r]=s)};var xn,bn=e.inherits(mn,De),kn=De.prototype;function wn(t,e,n,i){xn[i||t]=e}function Tn(t,e,n,i){if(null==t)return"";var r,o,s,a,u,l="";for("bgrect"===n&&!1===e.interactive&&(l+="pointer-events: none; "),"text"===n&&(l+="font-family: "+fe(t)+"; ",l+="font-size: "+le(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),r=0,o=rn.length;r<o;++r)s=rn[r],a=nn[s],null==(u=t[s])?"fill"===a&&(l+="fill: none; "):"transparent"!==u||"fill"!==a&&"stroke"!==a?(h(u)&&(u=c(u,i.gradient,"")),l+=a+": "+u+"; "):l+=a+": none; ";return l?'style="'+l.trim()+'"':null}bn.resize=function(t,e,n,i){kn.resize.call(this,t,e,n,i);var r=this._origin,o=this._text,s={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var a in en)s[a]=en[a];o.head=Ke("svg",s);var u=this._bgcolor;return"transparent"!==u&&"none"!==u||(u=null),o.bg=u?Ke("rect",{width:this._width,height:this._height,style:"fill: "+u+";"})+tn("rect"):"",o.root=Ke("g",{transform:"translate("+r+")"}),o.foot=tn("g")+tn("svg"),this},bn.background=function(){var t=kn.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},bn.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},bn._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},bn.buildDefs=function(){var t,e,n,i,r,o=this._defs,s="";for(e in o.gradient){for(r=(n=o.gradient[e]).stops,"radial"===n.gradient?(s+=Ke(i="pattern",{id:l+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),s+=Ke("rect",{width:"1",height:"1",fill:"url(#"+e+")"})+tn("rect"),s+=tn(i),s+=Ke(i="radialGradient",{id:e,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})):s+=Ke(i="linearGradient",{id:e,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2}),t=0;t<r.length;++t)s+=Ke("stop",{offset:r[t].offset,"stop-color":r[t].color})+tn("stop");s+=tn(i)}for(e in o.clipping)n=o.clipping[e],s+=Ke("clipPath",{id:e}),n.path?s+=Ke("path",{d:n.path})+tn("path"):s+=Ke("rect",{x:0,y:0,width:n.width,height:n.height})+tn("rect"),s+=tn("clipPath");return s.length>0?Ke("defs")+s+tn("defs"):""},bn.attributes=function(t,e){return xn={},t(wn,e,this),xn},bn.href=function(t){var e,n=this,i=t.href;if(i){if(e=n._hrefs&&n._hrefs[i])return e;n.sanitizeURL(i).then(function(t){t["xlink:href"]=t.href,t.href=null,(n._hrefs||(n._hrefs={}))[i]=t})}return null},bn.mark=function(t){var e,n=this,i=me[t.marktype],r=i.tag,o=this._defs,s="";function a(a){var u=n.href(a);u&&(s+=Ke("a",u)),e="g"!==r?Tn(a,t,r,o):null,s+=Ke(r,n.attributes(i.attr,a),e),"text"===r?s+=ce(a).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"):"g"===r&&(s+=Ke("path",n.attributes(i.background,a),Tn(a,t,"bgrect",o))+tn("path"),s+=Ke("g",n.attributes(i.foreground,a))+n.markGroup(a)+tn("g")),s+=tn(r),u&&(s+=tn("a"))}return"g"!==r&&!1===t.interactive&&(e='style="pointer-events: none;"'),s+=Ke("g",{class:qe(t),"clip-path":t.clip?Vt(n,t,t.group):null},e),i.nested?t.items&&t.items.length&&a(t.items[0]):wt(t,a),s+tn("g")},bn.markGroup=function(t){var e=this,n="";return wt(t,function(t){n+=e.mark(t)}),n};var An={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},Mn={};function zn(t,e,n,i){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const r=t.items,o=t.marktype,s=r.length;let a=0;if("group"===o)for(;a<s;++a)Cn(r[a],e,n,i);else for(const t=me[o].isect;a<s;++a){let n=r[a];Pn(n,e,t)&&i.push(n)}}return i}function Cn(t,e,n,i){n&&n(t.mark)&&Pn(t,e,me.group.isect)&&i.push(t);const r=t.items,o=r&&r.length;if(o){const s=t.x||0,a=t.y||0;e.translate(-s,-a);for(let t=0;t<o;++t)zn(r[t],e,n,i);e.translate(s,a)}return i}function Pn(t,e,n){const i=t.bounds;return e.encloses(i)||e.intersects(i)&&n(t,e)}Mn.canvas=Mn.png={renderer:Xe,headless:Xe,handler:Be},Mn.svg={renderer:sn,headless:mn,handler:Qe},Mn.none={};var Sn=new s;var Rn=1e-9;function Ln(t,n,i){return t===n||("path"===i?qn(t,n):t instanceof Date&&n instanceof Date?+t==+n:e.isNumber(t)&&e.isNumber(n)?Math.abs(t-n)<=Rn:t&&n&&(e.isObject(t)||e.isObject(n))?null!=t&&null!=n&&function(t,e){var n,i,r=Object.keys(t),o=Object.keys(e);if(r.length!==o.length)return!1;for(r.sort(),o.sort(),i=r.length-1;i>=0;i--)if(r[i]!=o[i])return!1;for(i=r.length-1;i>=0;i--)if(n=r[i],!Ln(t[n],e[n],n))return!1;return typeof t==typeof e}(t,n):t==n)}function qn(t,e){return Ln(w(t),w(e))}t.Bounds=s,t.CanvasHandler=Be,t.CanvasRenderer=Xe,t.Gradient=function(t,e){var n,i=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:i,stop:function(t,e){return i.push({offset:t,color:e}),n}}},t.GroupItem=v,t.Handler=Oe,t.Item=d,t.Marks=me,t.RenderType=An,t.Renderer=De,t.ResourceLoader=g,t.SVGHandler=Qe,t.SVGRenderer=sn,t.SVGStringRenderer=mn,t.Scenegraph=Me,t.boundClip=function(t){var n=t.clip;if(e.isFunction(n))n(at(Sn.clear()));else{if(!n)return;Sn.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Sn)},t.boundContext=at,t.boundItem=xe,t.boundMark=ke,t.boundStroke=rt,t.closeTag=tn,t.domChild=Re,t.domClear=Le,t.domCreate=Pe,t.domFind=Se,t.font=de,t.fontFamily=fe,t.fontSize=le,t.intersect=function(t,n,i){const r=[],o=(new s).union(n),a=t.marktype;return a?zn(t,o,i,r):"group"===a?Cn(t,o,i,r):e.error("Intersect scene must be mark node or group item.")},t.intersectBoxLine=pt,t.intersectPath=ft,t.intersectPoint=dt,t.intersectRule=gt,t.openTag=Ke,t.pathCurves=x,t.pathEqual=qn,t.pathParse=w,t.pathRectangle=j,t.pathRender=N,t.pathSymbols=I,t.pathTrail=U,t.point=Ne,t.renderModule=function(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(Mn[t]=e,this):Mn[t]},t.resetSVGClipId=function(){Dt=1},t.sceneEqual=Ln,t.sceneFromJSON=Ae,t.scenePickVisit=Tt,t.sceneToJSON=Te,t.sceneVisit=wt,t.sceneZOrder=kt,t.textMetrics=re,Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "vega-scenegraph",
"version": "4.2.0",
"version": "4.2.1",
"description": "Vega scenegraph and renderers.",

@@ -22,9 +22,9 @@ "license": "BSD-3-Clause",

"dependencies": {
"d3-path": "^1.0.7",
"d3-path": "^1.0.8",
"d3-shape": "^1.3.5",
"vega-canvas": "^1.2.1",
"vega-loader": "^4.0.0",
"vega-util": "^1.8.0"
"vega-loader": "^4.1.1",
"vega-util": "^1.11.0"
},
"gitHead": "d2576ca617d8165211ffe6c23582b9dc1b88db7d"
"gitHead": "b45fc90406ce2de167073b73d4ae5cf79c5e1705"
}

@@ -86,4 +86,4 @@ function duplicate(_) {

{ "$ref": "#/refs/color" },
{ "$ref": "#/refs/gradientLinear" },
{ "$ref": "#/refs/gradientRadial" }
{ "$ref": "#/refs/linearGradient" },
{ "$ref": "#/refs/radialGradient" }
]

@@ -123,3 +123,3 @@ },

},
"gradientLinear": {
"linearGradient": {
"type": "object",

@@ -141,3 +141,3 @@ "properties": {

},
"gradientRadial": {
"radialGradient": {
"type": "object",

@@ -144,0 +144,0 @@ "properties": {

@@ -0,1 +1,3 @@

import {hasOwnProperty} from 'vega-util';
import {

@@ -92,3 +94,3 @@ curveBasis,

export default function curves(type, orientation, tension) {
var entry = lookup.hasOwnProperty(type) && lookup[type],
var entry = hasOwnProperty(lookup, type) && lookup[type],
curve = null;

@@ -95,0 +97,0 @@

import pathParse from './parse';
import pathRender from './render';
import {Tau, HalfSqrt3} from '../util/constants';
import {hasOwnProperty} from 'vega-util';

@@ -140,3 +141,3 @@ var Tan30 = 0.5773502691896257;

export default function symbols(_) {
return builtins.hasOwnProperty(_) ? builtins[_] : customSymbol(_);
return hasOwnProperty(builtins, _) ? builtins[_] : customSymbol(_);
}

@@ -147,3 +148,3 @@

function customSymbol(path) {
if (!custom.hasOwnProperty(path)) {
if (!hasOwnProperty(custom, path)) {
var parsed = pathParse(path);

@@ -150,0 +151,0 @@ custom[path] = {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc