Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.8.2 to 4.8.3

src/util/value.js

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

@@ -29,3 +29,3 @@ "license": "BSD-3-Clause",

},
"gitHead": "8a45e2a1ef1716b51b076ca3c868405528ab41a7"
"gitHead": "8fe8d36961c128df8300e6bc4fe6aac1e537bbe0"
}

@@ -195,3 +195,3 @@ function duplicate(_) {

'color',
'luminosity',
'luminosity'
];

@@ -225,3 +225,3 @@

'ariaRole': { 'type': 'string' },
'ariaRoleDescription': { 'type': 'string' },
'ariaRoleDescription': { 'type': 'string' }
}

@@ -228,0 +228,0 @@ };

import {hasCornerRadius, rectangle} from '../path/shapes';
import boundStroke from '../bound/boundStroke';
import {intersectRect} from '../util/intersect';
import value from '../util/value';
import {pickVisit, visit} from '../util/visit';

@@ -14,3 +15,3 @@ import blend from '../util/canvas/blend';

function offset(item) {
var sw = (sw = item.strokeWidth) != null ? sw : 1;
const sw = value(item.strokeWidth, 1);
return item.strokeOffset != null ? item.strokeOffset

@@ -26,3 +27,3 @@ : item.stroke && sw > 0.5 && sw < 1.5 ? 0.5 - Math.abs(sw - 1)

function emitRectangle(emit, item) {
var off = offset(item);
const off = offset(item);
emit('d', rectangle(null, item, off, off));

@@ -48,3 +49,3 @@ }

function content(emit, item, renderer) {
var url = item.clip ? clip(renderer, item, item) : null;
const url = item.clip ? clip(renderer, item, item) : null;
emit('clip-path', url);

@@ -55,4 +56,4 @@ }

if (!group.clip && group.items) {
var items = group.items;
for (var j=0, m=items.length; j<m; ++j) {
const items = group.items, m = items.length;
for (let j=0; j<m; ++j) {
bounds.union(items[j].bounds);

@@ -72,3 +73,3 @@ }

function rectanglePath(context, group, x, y) {
var off = offset(group);
const off = offset(group);
context.beginPath();

@@ -78,14 +79,12 @@ rectangle(context, group, (x || 0) + off, (y || 0) + off);

var hitBackground = hitPath(rectanglePath);
var hitForeground = hitPath(rectanglePath, false);
const hitBackground = hitPath(rectanglePath);
const hitForeground = hitPath(rectanglePath, false);
function draw(context, scene, bounds) {
var renderer = this;
visit(scene, group => {
const gx = group.x || 0,
gy = group.y || 0,
fore = group.strokeForeground,
opacity = group.opacity == null ? 1 : group.opacity;
visit(scene, function(group) {
var gx = group.x || 0,
gy = group.y || 0,
fore = group.strokeForeground,
opacity = group.opacity == null ? 1 : group.opacity;
// draw group background

@@ -110,4 +109,4 @@ if ((group.stroke || group.fill) && opacity) {

// draw group contents
visit(group, function(item) {
renderer.draw(context, item, bounds);
visit(group, item => {
this.draw(context, item, bounds);
});

@@ -135,8 +134,7 @@

var handler = this,
cx = x * context.pixelRatio,
cy = y * context.pixelRatio;
const cx = x * context.pixelRatio,
cy = y * context.pixelRatio;
return pickVisit(scene, function(group) {
var hit, fore, ix, dx, dy, dw, dh, b, c;
return pickVisit(scene, group => {
let hit, fore, ix, dx, dy, dw, dh, b, c;

@@ -153,3 +151,3 @@ // first hit test bounding box

c = group.clip;
if (c && (gx < dx || gx > dw || gy < dx || gy > dh)) return;
if (c && (gx < dx || gx > dw || gy < dy || gy > dh)) return;

@@ -179,7 +177,6 @@ // adjust coordinate system

// hit test against contained marks
hit = pickVisit(group, function(mark) {
return pickMark(mark, dx, dy)
? handler.pick(mark, x, y, dx, dy)
: null;
});
hit = pickVisit(group, mark => pickMark(mark, dx, dy)
? this.pick(mark, x, y, dx, dy)
: null
);

@@ -186,0 +183,0 @@ // hit test against group background

import {visit} from '../util/visit';
import blend from '../util/canvas/blend';
import {pick} from '../util/canvas/pick';
import metadata from '../util/svg/metadata';
import {translate} from '../util/svg/transform';

@@ -42,33 +43,23 @@ import {truthy} from 'vega-util';

function attr(emit, item, renderer) {
var image = getImage(item, renderer),
x = item.x || 0,
y = item.y || 0,
w = imageWidth(item, image),
h = imageHeight(item, image),
a = item.aspect === false ? 'none' : 'xMidYMid';
const img = getImage(item, renderer),
w = imageWidth(item, img),
h = imageHeight(item, img),
x = (item.x || 0) - imageXOffset(item.align, w),
y = (item.y || 0) - imageYOffset(item.baseline, h),
i = !img.src && img.toDataURL ? img.toDataURL() : img.src || '';
x -= imageXOffset(item.align, w);
y -= imageYOffset(item.baseline, h);
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('href', i, metadata['xmlns:xlink'], 'xlink:href');
emit('transform', translate(x, y));
emit('width', w);
emit('height', h);
emit('preserveAspectRatio', a);
emit('preserveAspectRatio', item.aspect === false ? 'none' : 'xMidYMid');
}
function bound(bounds, item) {
var image = item.image,
x = item.x || 0,
y = item.y || 0,
w = imageWidth(item, image),
h = imageHeight(item, image);
const img = item.image,
w = imageWidth(item, img),
h = imageHeight(item, img),
x = (item.x || 0) - imageXOffset(item.align, w),
y = (item.y || 0) - imageYOffset(item.baseline, h);
x -= imageXOffset(item.align, w);
y -= imageYOffset(item.baseline, h);
return bounds.set(x, y, x + w, y + h);

@@ -78,19 +69,14 @@ }

function draw(context, scene, bounds) {
var renderer = this;
visit(scene, function(item) {
visit(scene, item => {
if (bounds && !bounds.intersects(item.bounds)) return; // bounds check
var image = getImage(item, renderer),
x = item.x || 0,
y = item.y || 0,
w = imageWidth(item, image),
h = imageHeight(item, image),
let img = getImage(item, this),
w = imageWidth(item, img),
h = imageHeight(item, img),
x = (item.x || 0) - imageXOffset(item.align, w),
y = (item.y || 0) - imageYOffset(item.baseline, h),
opacity, ar0, ar1, t;
x -= imageXOffset(item.align, w);
y -= imageYOffset(item.baseline, h);
if (item.aspect !== false) {
ar0 = image.width / image.height;
ar0 = img.width / img.height;
ar1 = item.width / item.height;

@@ -110,7 +96,7 @@ if (ar0 === ar0 && ar1 === ar1 && ar0 !== ar1) {

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

@@ -117,0 +103,0 @@ });

@@ -42,3 +42,3 @@ import Bounds from './Bounds';

role: def.role || undefined,
zindex: def.zindex || 0,
zindex: def.zindex || 0
};

@@ -45,0 +45,0 @@

@@ -11,6 +11,6 @@ import Renderer from './Renderer';

import metadata from './util/svg/metadata';
import {defaultCSS, styles, svgRootClass} from './util/svg/styles';
import {rootAttributes, styles} from './util/svg/styles';
import {inherits, isArray} from 'vega-util';
const RootIndex = 1,
const RootIndex = 0,
ns = metadata.xmlns;

@@ -42,12 +42,7 @@

// create SVG defs element
this._defs.el = domChild(this._svg, 0, 'defs', ns);
// set svg default styles
const style = domChild(this._defs.el, 0, 'style');
style.textContent = defaultCSS;
// set the svg root group
this._root = domChild(this._svg, RootIndex, 'g', ns);
this._root.setAttribute('class', svgRootClass);
for (const attr in rootAttributes) {
this._root.setAttribute(attr, rootAttributes[attr]);
}

@@ -107,7 +102,7 @@ // ensure no additional child elements

height: this._height,
style: 'fill: ' + this._bgcolor + ';'
fill: this._bgcolor
}) + closeTag('rect'));
return openTag('svg', attr)
+ this._defs.el.outerHTML
+ (this._defs.el ? this._defs.el.outerHTML : '')
+ bg

@@ -140,11 +135,15 @@ + this._root.outerHTML

prototype.updateDefs = function() {
var defs = this._defs,
el = defs.el,
index = 1, id;
const svg = this._svg,
defs = this._defs;
for (id in defs.gradient) {
let el = defs.el,
index = 0;
for (const id in defs.gradient) {
if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns));
index = updateGradient(el, defs.gradient[id], index);
}
for (id in defs.clipping) {
for (const id in defs.clipping) {
if (!el) defs.el = (el = domChild(svg, RootIndex, 'defs', ns));
index = updateClipping(el, defs.clipping[id], index);

@@ -154,3 +153,7 @@ }

// clean-up
domClear(el, index);
if (el) {
index === 0
? (svg.removeChild(el), defs.el = null)
: domClear(el, index);
}
};

@@ -176,3 +179,3 @@

pt.setAttribute('height', '1');
pt.setAttribute('style', 'fill: url(' + href() + '#' + grad.id + ');');
pt.setAttribute('fill', 'url(' + href() + '#' + grad.id + ')');

@@ -320,4 +323,3 @@ el = domChild(el, index++, 'radialGradient', ns);

var renderer = this,
svg = this._svg,
var svg = this._svg,
mdef = marks[scene.marktype],

@@ -338,14 +340,14 @@ events = scene.interactive === false ? 'none' : null,

if (!isGroup) {
parent.style.setProperty('pointer-events', events);
setAttribute(parent, 'pointer-events', events);
}
setAttribute(parent, 'clip-path', scene.clip
? clip(renderer, scene, scene.group) : null);
setAttribute(parent, 'clip-path',
scene.clip ? clip(this, scene, scene.group) : null);
function process(item) {
var dirty = renderer.isDirty(item),
node = bind(item, parent, sibling, mdef.tag, svg);
const process = item => {
const dirty = this.isDirty(item),
node = bind(item, parent, sibling, mdef.tag, svg);
if (dirty) {
renderer._update(mdef, node, item);
if (isGroup) recurse(renderer, node, item);
this._update(mdef, node, item);
if (isGroup) recurse(this, node, item);
}

@@ -355,3 +357,3 @@

++i;
}
};

@@ -371,5 +373,5 @@ if (mdef.nested) {

el = el.lastChild.previousSibling;
var prev, idx = 0;
let prev, idx = 0;
visit(group, function(item) {
visit(group, item => {
prev = renderer.draw(el, item, prev);

@@ -386,3 +388,3 @@ ++idx;

function bind(item, el, sibling, tag, svg) {
var node = item._svg, doc;
let node = item._svg, doc;

@@ -401,11 +403,11 @@ // create a new dom node if needed

if (tag === 'g') {
var bg = domCreate(doc, 'path', ns);
const bg = domCreate(doc, 'path', ns);
node.appendChild(bg);
bg.__data__ = item;
var cg = domCreate(doc, 'g', ns);
const cg = domCreate(doc, 'g', ns);
node.appendChild(cg);
cg.__data__ = item;
var fg = domCreate(doc, 'path', ns);
const fg = domCreate(doc, 'path', ns);
node.appendChild(fg);

@@ -441,5 +443,3 @@ fg.__data__ = item;

group: function(mdef, el, item) {
var fg, bg;
element = fg = el.childNodes[2];
const fg = element = el.childNodes[2];
values = fg.__values__;

@@ -452,9 +452,9 @@ mdef.foreground(emit, item, this);

element = bg = el.childNodes[0];
const bg = element = el.childNodes[0];
mdef.background(emit, item, this);
var value = item.mark.interactive === false ? 'none' : null;
const value = item.mark.interactive === false ? 'none' : null;
if (value !== values.events) {
fg.style.setProperty('pointer-events', value);
bg.style.setProperty('pointer-events', value);
setAttribute(fg, 'pointer-events', value);
setAttribute(bg, 'pointer-events', value);
values.events = value;

@@ -465,7 +465,7 @@ }

const fill = item.fill;
fg.style.removeProperty('display');
setAttribute(fg, 'display', null);
// set style of background
this.style(bg, item);
bg.style.removeProperty('stroke');
setAttribute(bg, 'stroke', null);

@@ -482,3 +482,3 @@ // set style of foreground

// ensure foreground is ignored
fg.style.setProperty('display', 'none');
setAttribute(fg, 'display', 'none');
}

@@ -495,3 +495,3 @@ },

text: function(mdef, el, item) {
var tl = textLines(item),
let tl = textLines(item),
key, value, doc, lh;

@@ -529,7 +529,7 @@

setStyle(el, 'font-family', fontFamily(item));
setStyle(el, 'font-size', fontSize(item) + 'px');
setStyle(el, 'font-style', item.fontStyle);
setStyle(el, 'font-variant', item.fontVariant);
setStyle(el, 'font-weight', item.fontWeight);
setAttribute(el, 'font-family', fontFamily(item));
setAttribute(el, 'font-size', fontSize(item) + 'px');
setAttribute(el, 'font-style', item.fontStyle);
setAttribute(el, 'font-variant', item.fontVariant);
setAttribute(el, 'font-weight', item.fontWeight);
}

@@ -562,6 +562,6 @@ };

// some marks need special treatment
var extra = mark_extras[mdef.type];
const extra = mark_extras[mdef.type];
if (extra) extra.call(this, mdef, el, item);
// apply svg css styles
// apply svg style attributes
// note: element may be modified by 'extra' method

@@ -615,3 +615,3 @@ if (element) this.style(element, item);

if (value == null) {
el.style.removeProperty(name);
el.removeAttribute(name);
} else {

@@ -621,3 +621,3 @@ if (isGradient(value)) {

}
el.style.setProperty(name, value + '');
el.setAttribute(name, value + '');
}

@@ -630,3 +630,3 @@

function href() {
var loc;
let loc;
return typeof window === 'undefined' ? ''

@@ -633,0 +633,0 @@ : (loc = window.location).hash ? loc.href.slice(0, -loc.hash.length)

@@ -11,4 +11,4 @@ import Renderer from './Renderer';

import metadata from './util/svg/metadata';
import {defaultCSS, styles, svgRootClass} from './util/svg/styles';
import {inherits, isArray} from 'vega-util';
import {rootAttributes, styles} from './util/svg/styles';
import {extend, inherits, isArray} from 'vega-util';

@@ -60,3 +60,3 @@ export default function SVGStringRenderer(loader) {

height: this._height,
style: 'fill: ' + bg + ';'
fill: bg
}) + closeTag('rect');

@@ -67,6 +67,5 @@ } else {

t.root = openTag('g', {
class: svgRootClass,
transform: 'translate(' + o + ')'
});
t.root = openTag('g', extend(
{}, rootAttributes, {transform: 'translate(' + o + ')'}
));

@@ -98,9 +97,7 @@ t.foot = closeTag('g') + closeTag('svg');

prototype.buildDefs = function() {
var all = this._defs,
defs = openTag('style') + defaultCSS + closeTag('style'),
i, id, def, tag, stops;
let defs = '', tag;
for (id in all.gradient) {
def = all.gradient[id];
stops = def.stops;
for (const id in this._defs.gradient) {
const def = this._defs.gradient[id],
stops = def.stops;

@@ -122,5 +119,5 @@ if (def.gradient === 'radial') {

defs += openTag('rect', {
width: '1',
width: '1',
height: '1',
style: 'fill: url(#' + id + ');'
fill: 'url(#' + id + ')'
}) + closeTag('rect');

@@ -149,3 +146,3 @@

for (i=0; i<stops.length; ++i) {
for (let i = 0; i < stops.length; ++i) {
defs += openTag('stop', {

@@ -160,4 +157,4 @@ offset: stops[i].offset,

for (id in all.clipping) {
def = all.clipping[id];
for (const id in this._defs.clipping) {
const def = this._defs.clipping[id];

@@ -182,18 +179,23 @@ defs += openTag('clipPath', {id: id});

return openTag('defs') + defs + closeTag('defs');
return defs ? (openTag('defs') + defs + closeTag('defs')) : '';
};
var object;
prototype.attr = function(scene, item, attrs, tag) {
const object = {},
emit = (name, value, ns, prefixed) => {
object[prefixed || name] = value;
};
function emit(name, value, ns, prefixed) {
object[prefixed || name] = value;
}
prototype.attributes = function(attr, item) {
object = {};
if (Array.isArray(attr)) {
attr.forEach(fn => fn(emit, item, this));
// apply mark specific attributes
if (Array.isArray(attrs)) {
attrs.forEach(fn => fn(emit, item, this));
} else {
attr(emit, item, this);
attrs(emit, item, this);
}
// apply style attributes
if (tag) {
applyStyles(object, item, scene, tag, this._defs);
}
return object;

@@ -224,29 +226,28 @@ };

prototype.mark = function(scene) {
var renderer = this,
mdef = marks[scene.marktype],
tag = mdef.tag,
defs = this._defs,
str = '',
style;
const mdef = marks[scene.marktype],
tag = mdef.tag,
attrList = [ariaItemAttributes, mdef.attr];
if (tag !== 'g' && scene.interactive === false) {
style = 'style="pointer-events: none;"';
}
let str = '';
// render opening group tag
str += openTag('g', Object.assign({
'class': cssClass(scene),
'clip-path': scene.clip ? clip(renderer, scene, scene.group) : null
}, ariaMarkAttributes(scene)), style);
str += openTag('g', extend(
{
'class': cssClass(scene),
'clip-path': scene.clip ? clip(this, scene, scene.group) : null
},
ariaMarkAttributes(scene),
{
'pointer-events': tag !== 'g' && scene.interactive === false ? 'none' : null
}
));
// render contained elements
function process(item) {
var href = renderer.href(item);
const process = item => {
const href = this.href(item);
if (href) str += openTag('a', href);
style = (tag !== 'g') ? applyStyles(item, scene, tag, defs) : null;
str += openTag(
tag,
renderer.attributes([ariaItemAttributes, mdef.attr], item),
style
this.attr(scene, item, attrList, tag !== 'g' ? tag : null)
);

@@ -277,7 +278,9 @@

str += openTag('path', renderer.attributes(mdef.background, item),
applyStyles(item, scene, 'bgrect', defs)) + closeTag('path');
str += openTag(
'path',
this.attr(scene, item, mdef.background, 'bgrect')
) + closeTag('path');
str += openTag('g', renderer.attributes(mdef.content, item))
+ renderer.markGroup(item)
str += openTag('g', this.attr(scene, item, mdef.content))
+ this.markGroup(item)
+ closeTag('g');

@@ -289,9 +292,13 @@

str += openTag('path', renderer.attributes(mdef.foreground, item),
applyStyles(item, scene, 'bgrect', defs)) + closeTag('path');
str += openTag(
'path',
this.attr(scene, item, mdef.foreground, 'bgrect')
) + closeTag('path');
if (fill) item.fill = fill;
} else {
str += openTag('path', renderer.attributes(mdef.foreground, item),
applyStyles({}, scene, 'bgfore', defs)) + closeTag('path');
str += openTag(
'path',
this.attr(scene, item, mdef.foreground, 'bgfore')
) + closeTag('path');
}

@@ -302,3 +309,3 @@ }

if (href) str += closeTag('a');
}
};

@@ -316,43 +323,36 @@ if (mdef.nested) {

prototype.markGroup = function(scene) {
var renderer = this,
str = '';
visit(scene, function(item) {
str += renderer.mark(item);
});
let str = '';
visit(scene, item => { str += this.mark(item); });
return str;
};
function applyStyles(o, mark, tag, defs) {
if (o == null) return '';
let s = '';
function applyStyles(s, item, scene, tag, defs) {
if (item == null) return s;
if (tag === 'bgrect' && mark.interactive === false) {
s += 'pointer-events: none; ';
if (tag === 'bgrect' && scene.interactive === false) {
s['pointer-events'] = 'none';
}
if (tag === 'bgfore') {
if (mark.interactive === false) {
s += 'pointer-events: none; ';
if (scene.interactive === false) {
s['pointer-events'] = 'none';
}
s += 'display: none; ';
s.display = 'none';
if (item.fill !== null) return s;
}
if (tag === 'image') {
if (o.smooth === false) {
s += 'image-rendering: optimizeSpeed; image-rendering: pixelated; ';
}
if (tag === 'image' && item.smooth === false) {
s.style = 'image-rendering: optimizeSpeed; image-rendering: pixelated;';
}
if (tag === 'text') {
s += 'font-family: ' + fontFamily(o) + '; ';
s += 'font-size: ' + fontSize(o) + 'px; ';
if (o.fontStyle) s += 'font-style: ' + o.fontStyle + '; ';
if (o.fontVariant) s += 'font-variant: ' + o.fontVariant + '; ';
if (o.fontWeight) s += 'font-weight: ' + o.fontWeight + '; ';
s['font-family'] = fontFamily(item);
s['font-size'] = fontSize(item) + 'px';
if (item.fontStyle) s['font-style'] = item.fontStyle;
if (item.fontVariant) s['font-variant'] = item.fontVariant;
if (item.fontWeight) s['font-weight'] = item.fontWeight;
}
for (const prop in styles) {
let value = o[prop];
let value = item[prop];
const name = styles[prop];

@@ -367,7 +367,7 @@

}
s += name + ': ' + value + '; ';
s[name] = value;
}
}
return s ? 'style="' + s.trim() + '"' : null;
return s;
}

@@ -374,0 +374,0 @@

@@ -0,7 +1,4 @@

import value from '../value';
import {canvas} from 'vega-canvas';
function v(value, dflt) {
return value == null ? dflt : value;
}
function addStops(gradient, stops) {

@@ -23,14 +20,14 @@ const n = stops.length;

gradient = context.createRadialGradient(
bounds.x1 + v(spec.x1, 0.5) * w,
bounds.y1 + v(spec.y1, 0.5) * h,
Math.max(w, h) * v(spec.r1, 0),
bounds.x1 + v(spec.x2, 0.5) * w,
bounds.y1 + v(spec.y2, 0.5) * h,
Math.max(w, h) * v(spec.r2, 0.5)
bounds.x1 + value(spec.x1, 0.5) * w,
bounds.y1 + value(spec.y1, 0.5) * h,
Math.max(w, h) * value(spec.r1, 0),
bounds.x1 + value(spec.x2, 0.5) * w,
bounds.y1 + value(spec.y2, 0.5) * h,
Math.max(w, h) * value(spec.r2, 0.5)
);
} else { // linear gradient
const x1 = v(spec.x1, 0),
y1 = v(spec.y1, 0),
x2 = v(spec.x2, 1),
y2 = v(spec.y2, 0);
const x1 = value(spec.x1, 0),
y1 = value(spec.y1, 0),
x2 = value(spec.x2, 1),
y2 = value(spec.y2, 0);

@@ -37,0 +34,0 @@ if (x1 === x2 || y1 === y2 || w === h) {

@@ -22,3 +22,3 @@ import boundMark from '../bound/boundMark';

'font', 'fontSize', 'fontWeight', 'fontStyle', 'fontVariant', // font
'description', 'aria', 'ariaRole', 'ariaRoleDescription', // aria
'description', 'aria', 'ariaRole', 'ariaRoleDescription' // aria
];

@@ -25,0 +25,0 @@

export const styles = {
'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',
'blend': 'mix-blend-mode'
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',
blend: 'mix-blend-mode'
};
export const svgRootClass = 'vega-svg-root';
// ensure miter limit default is consistent with canvas (#2498)
export const defaultCSS = [
`.${svgRootClass} * { fill: none; }`,
`.${svgRootClass} tspan { fill: inherit; }`,
`.${svgRootClass} path { stroke-miterlimit: 10; }`
].join(' ');
export const rootAttributes = {
'fill': 'none',
'stroke-miterlimit': 10
};

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