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.3.1 to 4.4.0

40

build/vega-scenegraph-schema.json

@@ -295,2 +295,17 @@ {

},
"cornerRadius": {
"type": "number"
},
"cornerRadiusTopLeft": {
"type": "number"
},
"cornerRadiusTopRight": {
"type": "number"
},
"cornerRadiusBottomRight": {
"type": "number"
},
"cornerRadiusBottomLeft": {
"type": "number"
},
"items": {

@@ -692,2 +707,6 @@ "type": "array",

},
"smooth": {
"type": "boolean",
"default": true
},
"align": {

@@ -971,4 +990,13 @@ "enum": [

"tooltip": {},
"angle": {
"type": "number"
},
"path": {
"$ref": "#/refs/path"
},
"scaleX": {
"type": "number"
},
"scaleY": {
"type": "number"
}

@@ -1090,2 +1118,14 @@ },

"type": "number"
},
"cornerRadiusTopLeft": {
"type": "number"
},
"cornerRadiusTopRight": {
"type": "number"
},
"cornerRadiusBottomRight": {
"type": "number"
},
"cornerRadiusBottomLeft": {
"type": "number"
}

@@ -1092,0 +1132,0 @@ },

2

build/vega-scenegraph.min.js

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

@@ -25,6 +25,6 @@ "license": "BSD-3-Clause",

"vega-canvas": "^1.2.1",
"vega-loader": "^4.1.2",
"vega-util": "^1.11.2"
"vega-loader": "^4.1.3",
"vega-util": "^1.12.0"
},
"gitHead": "b1337d09ced5f517d54c8ec17fdf849651f5c16c"
"gitHead": "8180e8ca9379dec7f1722ce0ebd2aa01083be7b2"
}

@@ -238,2 +238,7 @@ function duplicate(_) {

"clip": { "type": "boolean" },
"cornerRadius": { "type": "number" },
"cornerRadiusTopLeft": { "type": "number" },
"cornerRadiusTopRight": { "type": "number" },
"cornerRadiusBottomRight": { "type": "number" },
"cornerRadiusBottomLeft": { "type": "number" },
"items": { "type": "array", "items": { "$ref": "#/refs/mark" } }

@@ -264,2 +269,3 @@ }

"aspect": { "type": "boolean", "default": true },
"smooth": { "type": "boolean", "default": true },
"align": {

@@ -286,3 +292,6 @@ "enum": [ "left", "center", "right" ],

"properties": {
"path": { "$ref": "#/refs/path" }
"angle": { "type": "number" },
"path": { "$ref": "#/refs/path" },
"scaleX": { "type": "number" },
"scaleY": { "type": "number" }
}

@@ -292,3 +301,7 @@ },

"properties": {
"cornerRadius": { "type": "number" }
"cornerRadius": { "type": "number" },
"cornerRadiusTopLeft": { "type": "number" },
"cornerRadiusTopRight": { "type": "number" },
"cornerRadiusBottomRight": { "type": "number" },
"cornerRadiusBottomLeft": { "type": "number" }
}

@@ -295,0 +308,0 @@ },

@@ -1,6 +0,12 @@

export default function(bounds, item) {
export default function(bounds, item, miter) {
if (item.stroke && item.opacity !== 0 && item.strokeOpacity !== 0) {
bounds.expand(item.strokeWidth != null ? +item.strokeWidth : 1);
const sw = item.strokeWidth != null ? +item.strokeWidth : 1;
bounds.expand(sw + (miter ? miterAdjustment(item, sw) : 0));
}
return bounds;
}
function miterAdjustment(item, strokeWidth) {
// TODO: more sophisticated adjustment? Or miter support in boundContext?
return item.strokeJoin && item.strokeJoin !== 'miter' ? 0 : strokeWidth;
}

@@ -69,2 +69,8 @@ import Renderer from './Renderer';

function viewBounds(origin, width, height) {
return tempBounds
.set(0, 0, width, height)
.translate(-origin[0], -origin[1]);
}
function translate(bounds, group) {

@@ -90,5 +96,5 @@ if (group == null) return bounds;

this._redraw = false;
b = null;
b = viewBounds(o, w, h).expand(1);
} else {
b = clipToBounds(g, b, o);
b = clipToBounds(g, b.intersect(viewBounds(o, w, h)), o, w, h);
}

@@ -95,0 +101,0 @@

@@ -8,5 +8,5 @@ import {visit} from '../util/visit';

var image = item.image;
if (!image || image.url !== item.url) {
image = {loaded: false, width: 0, height: 0};
renderer.loadImage(item.url).then(function(image) {
if (!image || item.url && item.url !== image.url) {
image = {complete: false, width: 0, height: 0};
renderer.loadImage(item.url).then(image => {
item.image = image;

@@ -52,3 +52,7 @@ item.image.url = item.url;

emit('href', image.src || '', 'http://www.w3.org/1999/xlink', 'xlink:href');
if (!image.src && image.toDataURL) {
emit('href', image.toDataURL(), 'http://www.w3.org/1999/xlink', 'xlink:href');
} else {
emit('href', image.src || '', 'http://www.w3.org/1999/xlink', 'xlink:href');
}
emit('transform', translate(x, y));

@@ -105,4 +109,5 @@ emit('width', w);

if (image.loaded) {
if (image.complete || image.toDataURL) {
context.globalAlpha = (opacity = item.opacity) != null ? opacity : 1;
context.imageSmoothingEnabled = item.smooth !== false;
context.drawImage(image, x, y, w, h);

@@ -109,0 +114,0 @@ }

@@ -8,6 +8,12 @@ import boundStroke from '../bound/boundStroke';

import {pickPath} from '../util/canvas/pick';
import {translateItem} from '../util/svg/transform';
import {transformItem} from '../util/svg/transform';
import {DegToRad} from '../util/constants';
function attr(emit, item) {
emit('transform', translateItem(item));
var sx = item.scaleX || 1,
sy = item.scaleY || 1;
if (sx !== 1 || sy !== 1) {
emit('vector-effect', 'non-scaling-stroke');
}
emit('transform', transformItem(item));
emit('d', item.path);

@@ -20,13 +26,34 @@ }

var cache = item.pathCache;
var x = item.x || 0,
y = item.y || 0,
sx = item.scaleX || 1,
sy = item.scaleY || 1,
a = (item.angle || 0) * DegToRad,
cache = item.pathCache;
if (!cache || cache.path !== path) {
(item.pathCache = cache = pathParse(path)).path = path;
}
pathRender(context, cache, item.x, item.y);
if (a && context.rotate && context.translate) {
context.translate(x, y);
context.rotate(a);
pathRender(context, cache, 0, 0, sx, sy);
context.rotate(-a);
context.translate(-x, -y);
} else {
pathRender(context, cache, x, y, sx, sy);
}
}
function bound(bounds, item) {
return path(context(bounds), item)
path(context(bounds), item)
? bounds.set(0, 0, 0, 0)
: boundStroke(bounds, item);
: boundStroke(bounds, item, true);
if (item.angle) {
bounds.rotate(item.angle * DegToRad, item.x || 0, item.y || 0);
}
return bounds;
}

@@ -33,0 +60,0 @@

import {path} from 'd3-path';
// See http://spencermortensen.com/articles/bezier-circle/
const C = 0.448084975506; // C = 1 - c
function rectangleX(d) {

@@ -19,6 +22,10 @@ return d.x;

function constant(_) {
return function() { return _; };
function number(_) {
return typeof _ === 'function' ? _ : () => +_;
}
function clamp(value, min, max) {
return Math.max(min, Math.min(value, max));
}
export default function() {

@@ -29,3 +36,6 @@ var x = rectangleX,

height = rectangleHeight,
cornerRadius = constant(0),
crTL = number(0),
crTR = crTL,
crBL = crTL,
crBR = crTL,
context = null;

@@ -39,7 +49,11 @@

h = +height.call(this, _),
cr = +cornerRadius.call(this, _);
s = Math.min(w, h) / 2,
tl = clamp(+crTL.call(this, _), 0, s),
tr = clamp(+crTR.call(this, _), 0, s),
bl = clamp(+crBL.call(this, _), 0, s),
br = clamp(+crBR.call(this, _), 0, s);
if (!context) context = buffer = path();
if (cr <= 0) {
if (tl <= 0 && tr <= 0 && bl <= 0 && br <= 0) {
context.rect(x1, y1, w, h);

@@ -49,11 +63,11 @@ } else {

y2 = y1 + h;
context.moveTo(x1 + cr, y1);
context.lineTo(x2 - cr, y1);
context.quadraticCurveTo(x2, y1, x2, y1 + cr);
context.lineTo(x2, y2 - cr);
context.quadraticCurveTo(x2, y2, x2 - cr, y2);
context.lineTo(x1 + cr, y2);
context.quadraticCurveTo(x1, y2, x1, y2 - cr);
context.lineTo(x1, y1 + cr);
context.quadraticCurveTo(x1, y1, x1 + cr, y1);
context.moveTo(x1 + tl, y1);
context.lineTo(x2 - tr, y1);
context.bezierCurveTo(x2 - C * tr, y1, x2, y1 + C * tr, x2, y1 + tr);
context.lineTo(x2, y2 - br);
context.bezierCurveTo(x2, y2 - C * br, x2 - C * br, y2, x2 - br, y2);
context.lineTo(x1 + bl, y2);
context.bezierCurveTo(x1 + C * bl, y2, x1, y2 - C * bl, x1, y2 - bl);
context.lineTo(x1, y1 + tl);
context.bezierCurveTo(x1, y1 + C * tl, x1 + C * tl, y1, x1 + tl, y1);
context.closePath();

@@ -70,3 +84,3 @@ }

if (arguments.length) {
x = typeof _ === 'function' ? _ : constant(+_);
x = number(_);
return rectangle;

@@ -80,3 +94,3 @@ } else {

if (arguments.length) {
y = typeof _ === 'function' ? _ : constant(+_);
y = number(_);
return rectangle;

@@ -90,3 +104,3 @@ } else {

if (arguments.length) {
width = typeof _ === 'function' ? _ : constant(+_);
width = number(_);
return rectangle;

@@ -100,3 +114,3 @@ } else {

if (arguments.length) {
height = typeof _ === 'function' ? _ : constant(+_);
height = number(_);
return rectangle;

@@ -108,8 +122,11 @@ } else {

rectangle.cornerRadius = function(_) {
rectangle.cornerRadius = function(tl, tr, br, bl) {
if (arguments.length) {
cornerRadius = typeof _ === 'function' ? _ : constant(+_);
crTL = number(tl);
crTR = tr != null ? number(tr) : crTL;
crBR = br != null ? number(br) : crTL;
crBL = bl != null ? number(bl) : crTR;
return rectangle;
} else {
return cornerRadius;
return crTL;
}

@@ -116,0 +133,0 @@ };

@@ -5,15 +5,19 @@ import {bezier, segments} from './arc';

function scale(current, s) {
function scale(current, sX, sY) {
var c = (temp[0] = current[0]);
if (c === 'a' || c === 'A') {
temp[1] = s * current[1];
temp[2] = s * current[2];
temp[1] = sX * current[1];
temp[2] = sY * current[2];
temp[3] = current[3];
temp[4] = current[4];
temp[5] = current[5];
temp[6] = s * current[6];
temp[7] = s * current[7];
temp[6] = sX * current[6];
temp[7] = sY * current[7];
} else if (c === 'h' || c === 'H') {
temp[1] = sX * current[1];
} else if (c === 'v' || c === 'V') {
temp[1] = sY * current[1];
} else {
for (var i=1, n=current.length; i<n; ++i) {
temp[i] = s * current[i];
temp[i] = (i % 2 == 1 ? sX : sY) * current[i];
}

@@ -24,3 +28,3 @@ }

export default function(context, path, l, t, s) {
export default function(context, path, l, t, sX, sY) {
var current, // current instruction

@@ -39,3 +43,4 @@ previous = null,

if (t == null) t = 0;
if (s == null) s = 1;
if (sX == null) sX = 1;
if (sY == null) sY = sX;

@@ -46,3 +51,5 @@ if (context.beginPath) context.beginPath();

current = path[i];
if (s !== 1) current = scale(current, s);
if (sX !== 1 || sY !== 1) {
current = scale(current, sX, sY);
}

@@ -49,0 +56,0 @@ switch (current[0]) { // first letter

@@ -14,28 +14,37 @@ import curves from './curves';

function x(item) { return item.x || 0; }
function y(item) { return item.y || 0; }
function w(item) { return item.width || 0; }
function ts(item) { return item.size || 1; }
function h(item) { return item.height || 0; }
function xw(item) { return (item.x || 0) + (item.width || 0); }
function yh(item) { return (item.y || 0) + (item.height || 0); }
function sa(item) { return item.startAngle || 0; }
function ea(item) { return item.endAngle || 0; }
function pa(item) { return item.padAngle || 0; }
function ir(item) { return item.innerRadius || 0; }
function or(item) { return item.outerRadius || 0; }
function cr(item) { return item.cornerRadius || 0; }
function def(item) { return !(item.defined === false); }
function size(item) { return item.size == null ? 64 : item.size; }
function type(item) { return symbols(item.shape || 'circle'); }
function value(a, b) {
return a != null ? a : b;
}
var arcShape = d3_arc().startAngle(sa).endAngle(ea).padAngle(pa)
.innerRadius(ir).outerRadius(or).cornerRadius(cr),
areavShape = d3_area().x(x).y1(y).y0(yh).defined(def),
areahShape = d3_area().y(y).x1(x).x0(xw).defined(def),
lineShape = d3_line().x(x).y(y).defined(def),
rectShape = vg_rect().x(x).y(y).width(w).height(h).cornerRadius(cr),
symbolShape = d3_symbol().type(type).size(size),
trailShape = vg_trail().x(x).y(y).defined(def).size(ts);
const x = item => item.x || 0,
y = item => item.y || 0,
w = item => item.width || 0,
h = item => item.height || 0,
xw = item => (item.x || 0) + (item.width || 0),
yh = item => (item.y || 0) + (item.height || 0),
sa = item => item.startAngle || 0,
ea = item => item.endAngle || 0,
pa = item => item.padAngle || 0,
ir = item => item.innerRadius || 0,
or = item => item.outerRadius || 0,
cr = item => item.cornerRadius || 0,
tl = item => value(item.cornerRadiusTopLeft, item.cornerRadius) || 0,
tr = item => value(item.cornerRadiusTopRight, item.cornerRadius) || 0,
br = item => value(item.cornerRadiusBottomRight, item.cornerRadius) || 0,
bl = item => value(item.cornerRadiusBottomLeft, item.cornerRadius) || 0,
sz = item => value(item.size, 64),
ts = item => item.size || 1,
def = item => !(item.defined === false),
type = item => symbols(item.shape || 'circle');
const arcShape = d3_arc().startAngle(sa).endAngle(ea).padAngle(pa)
.innerRadius(ir).outerRadius(or).cornerRadius(cr),
areavShape = d3_area().x(x).y1(y).y0(yh).defined(def),
areahShape = d3_area().y(y).x1(x).x0(xw).defined(def),
lineShape = d3_line().x(x).y(y).defined(def),
rectShape = vg_rect().x(x).y(y).width(w).height(h)
.cornerRadius(tl, tr, br, bl),
symbolShape = d3_symbol().type(type).size(sz),
trailShape = vg_trail().x(x).y(y).defined(def).size(ts);
export function arc(context, item) {

@@ -42,0 +51,0 @@ return arcShape.context(context)(item);

@@ -53,3 +53,2 @@ import {image} from 'vega-canvas';

decrement(loader);
img.loaded = true;
};

@@ -59,3 +58,2 @@

decrement(loader);
img.loaded = false;
}

@@ -68,3 +66,3 @@

decrement(loader);
return {loaded: false, width: 0, height: 0, src: e && e.url || ''};
return {complete: false, width: 0, height: 0, src: e && e.url || ''};
});

@@ -71,0 +69,0 @@ };

@@ -429,2 +429,10 @@ import Renderer from './Renderer';

},
image: function(mdef, el, item) {
if (item.smooth === false) {
setStyle(el, 'image-rendering', 'optimizeSpeed');
setStyle(el, 'image-rendering', 'pixelated');
} else {
setStyle(el, 'image-rendering', null);
}
},
text: function(mdef, el, item) {

@@ -431,0 +439,0 @@ var tl = textLines(item),

@@ -291,2 +291,8 @@ import Renderer from './Renderer';

if (tag === 'image') {
if (o.smooth === false) {
s += 'image-rendering: optimizeSpeed; image-rendering: pixelated; ';
}
}
if (tag === 'text') {

@@ -293,0 +299,0 @@ s += 'font-family: ' + fontFamily(o) + '; ';

@@ -11,5 +11,7 @@ import boundMark from '../bound/boundMark';

'cornerRadius', 'padAngle', // arc, rect
'cornerRadiusTopLeft', 'cornerRadiusTopRight', // rect, group
'cornerRadiusBottomLeft', 'cornerRadiusBottomRight',
'interpolate', 'tension', 'orient', 'defined', // area, line
'url', // image
'path', // path
'url', 'aspect', 'smooth', // image
'path', 'scaleX', 'scaleY', // path
'x2', 'y2', // rule

@@ -16,0 +18,0 @@ 'size', 'shape', // symbol

@@ -9,2 +9,6 @@ export function translate(x, y) {

export function scale(scaleX, scaleY){
return 'scale('+ scaleX + ',' + scaleY+')';
}
export function translateItem(item) {

@@ -16,3 +20,4 @@ return translate(item.x || 0, item.y || 0);

return translate(item.x || 0, item.y || 0)
+ (item.angle ? ' ' + rotate(item.angle) : '');
+ (item.angle ? ' ' + rotate(item.angle) : '')
+ (item.scaleX || item.scaleY ? ' ' + scale(item.scaleX || 1, item.scaleY || 1) : '');
}

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