vega-functions
Advanced tools
Comparing version 5.13.2 to 5.14.0
@@ -682,2 +682,6 @@ (function (global, factory) { | ||
const geoCentroid = geoMethod('centroid', centroid); | ||
function geoScale(projection, group) { | ||
const p = getScale(projection, (group || this).context); | ||
return p && p.scale(); | ||
} | ||
@@ -1686,2 +1690,3 @@ function inScope (item) { | ||
expressionFunction('geoShape', geoShape, scaleVisitor); | ||
expressionFunction('geoScale', geoScale, scaleVisitor); | ||
expressionFunction('indata', indata, indataVisitor); | ||
@@ -1765,2 +1770,3 @@ expressionFunction('data', data, dataVisitor); | ||
exports.geoCentroid = geoCentroid; | ||
exports.geoScale = geoScale; | ||
exports.geoShape = geoShape; | ||
@@ -1767,0 +1773,0 @@ exports.inScope = inScope; |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("vega-expression"),require("vega-scale"),require("vega-dataflow"),require("vega-scenegraph"),require("vega-selections"),require("vega-statistics"),require("vega-time")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-scale","vega-dataflow","vega-scenegraph","vega-selections","vega-statistics","vega-time"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega)}(this,(function(t,n,e,r,i,o,a,s,u){"use strict";function c(t){const n=this.context.data[t];return n?n.values.value:[]}function l(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}function h(t,e){const r=this.context.dataflow,i=this.context.data[t].input;return r.pulse(i,r.changeset().remove(n.truthy).insert(e)),1}function f(t,n,e){if(t){const e=this.context.dataflow,r=t.mark.source;e.pulse(r,e.changeset().encode(t,n))}return void 0!==e?e:t}const d=t=>function(n,e){return this.context.dataflow.locale()[t](e)(n)},g=d("format"),p=d("timeFormat"),m=d("utcFormat"),y=d("timeParse"),v=d("utcParse"),b=new Date(2e3,0,1);function w(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(b.setYear(2e3),b.setMonth(t),b.setDate(n),p.call(this,b,e)):""}function x(t){return w.call(this,t,1,"%B")}function N(t){return w.call(this,t,1,"%b")}function S(t){return w.call(this,0,2+t,"%A")}function $(t){return w.call(this,0,2+t,"%a")}const k=":",E="@",M="%",q="$";function A(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to data functions must be a string literal.");const a=r[0].value,s=k+a;if(!n.hasOwnProperty(s,o))try{o[s]=i.getData(a).tuplesRef()}catch(t){}}function P(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to indata must be a string literal."),r[1].type!==e.Literal&&n.error("Second argument to indata must be a string literal.");const a=r[0].value,s=r[1].value,u=E+s;n.hasOwnProperty(u,o)||(o[u]=i.getData(a).indataRef(i,s))}function _(t,n,r,i){if(n[0].type===e.Literal)F(r,i,n[0].value);else for(t in r.scales)F(r,i,t)}function F(t,e,r){const i=M+r;if(!n.hasOwnProperty(e,i))try{e[i]=t.scaleRef(r)}catch(t){}}function R(t,e){if(n.isFunction(t))return t;if(n.isString(t)){const n=e.scales[t];return n&&r.isRegisteredScale(n.value)?n.value:void 0}}function L(t,r,i){r.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,i._bandwidth=_,i._range=_,i._scale=_;const o=r=>"_["+(r.type===e.Literal?n.stringValue(M+r.value):n.stringValue(M)+"+"+t(r))+"]";return{_bandwidth:t=>`this.__bandwidth(${o(t[0])})`,_range:t=>`${o(t[0])}.range()`,_scale:n=>`${o(n[0])}(${t(n[1])})`}}class O{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}var I=1e-6,T=1e-12,z=Math.PI,D=z/2,V=z/4,j=2*z,H=180/z,B=z/180,U=Math.abs,G=Math.atan2,C=Math.cos,X=Math.hypot,Y=Math.sin,W=Math.sqrt;function Z(t){return t>1?D:t<-1?-D:Math.asin(t)}function J(){}function K(t,n){t&&tt.hasOwnProperty(t.type)&&tt[t.type](t,n)}var Q={Feature:function(t,n){K(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)K(e[r].geometry,n)}},tt={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){nt(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)nt(e[r],n,0)},Polygon:function(t,n){et(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)et(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)K(e[r],n)}};function nt(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function et(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)nt(t[e],n,1);n.polygonEnd()}function rt(t,n){t&&Q.hasOwnProperty(t.type)?Q[t.type](t,n):K(t,n)}var it,ot,at,st,ut,ct,lt,ht,ft,dt,gt,pt,mt,yt,vt,bt,wt=new O,xt=new O,Nt={point:J,lineStart:J,lineEnd:J,polygonStart:function(){wt=new O,Nt.lineStart=St,Nt.lineEnd=$t},polygonEnd:function(){var t=+wt;xt.add(t<0?j+t:t),this.lineStart=this.lineEnd=this.point=J},sphere:function(){xt.add(j)}};function St(){Nt.point=kt}function $t(){Et(it,ot)}function kt(t,n){Nt.point=Et,it=t,ot=n,at=t*=B,st=C(n=(n*=B)/2+V),ut=Y(n)}function Et(t,n){var e=(t*=B)-at,r=e>=0?1:-1,i=r*e,o=C(n=(n*=B)/2+V),a=Y(n),s=ut*a,u=st*o+s*C(i),c=s*r*Y(i);wt.add(G(c,u)),at=t,st=o,ut=a}function Mt(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}var qt,At,Pt,_t,Ft,Rt,Lt,Ot,It,Tt,zt,Dt,Vt,jt,Ht,Bt,Ut={point:Gt,lineStart:Xt,lineEnd:Yt,polygonStart:function(){Ut.point=Wt,Ut.lineStart=Zt,Ut.lineEnd=Jt,yt=new O,Nt.polygonStart()},polygonEnd:function(){Nt.polygonEnd(),Ut.point=Gt,Ut.lineStart=Xt,Ut.lineEnd=Yt,wt<0?(ct=-(ht=180),lt=-(ft=90)):yt>I?ft=90:yt<-I&&(lt=-90),bt[0]=ct,bt[1]=ht},sphere:function(){ct=-(ht=180),lt=-(ft=90)}};function Gt(t,n){vt.push(bt=[ct=t,ht=t]),n<lt&&(lt=n),n>ft&&(ft=n)}function Ct(t,n){var e,r,i=function(t){var n=t[0],e=t[1],r=C(e);return[r*C(n),r*Y(n),Y(e)]}([t*B,n*B]);if(mt){var o=Mt(mt,i),a=Mt([o[1],-o[0],0],o);r=W((e=a)[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=r,e[1]/=r,e[2]/=r,a=function(t){return[G(t[1],t[0]),Z(t[2])]}(a);var s,u=t-dt,c=u>0?1:-1,l=a[0]*H*c,h=U(u)>180;h^(c*dt<l&&l<c*t)?(s=a[1]*H)>ft&&(ft=s):h^(c*dt<(l=(l+360)%360-180)&&l<c*t)?(s=-a[1]*H)<lt&&(lt=s):(n<lt&&(lt=n),n>ft&&(ft=n)),h?t<dt?Kt(ct,t)>Kt(ct,ht)&&(ht=t):Kt(t,ht)>Kt(ct,ht)&&(ct=t):ht>=ct?(t<ct&&(ct=t),t>ht&&(ht=t)):t>dt?Kt(ct,t)>Kt(ct,ht)&&(ht=t):Kt(t,ht)>Kt(ct,ht)&&(ct=t)}else vt.push(bt=[ct=t,ht=t]);n<lt&&(lt=n),n>ft&&(ft=n),mt=i,dt=t}function Xt(){Ut.point=Ct}function Yt(){bt[0]=ct,bt[1]=ht,Ut.point=Gt,mt=null}function Wt(t,n){if(mt){var e=t-dt;yt.add(U(e)>180?e+(e>0?360:-360):e)}else gt=t,pt=n;Nt.point(t,n),Ct(t,n)}function Zt(){Nt.lineStart()}function Jt(){Wt(gt,pt),Nt.lineEnd(),U(yt)>I&&(ct=-(ht=180)),bt[0]=ct,bt[1]=ht,mt=null}function Kt(t,n){return(n-=t)<0?n+360:n}function Qt(t,n){return t[0]-n[0]}function tn(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var nn={sphere:J,point:en,lineStart:on,lineEnd:un,polygonStart:function(){nn.lineStart=cn,nn.lineEnd=ln},polygonEnd:function(){nn.lineStart=on,nn.lineEnd=un}};function en(t,n){t*=B;var e=C(n*=B);rn(e*C(t),e*Y(t),Y(n))}function rn(t,n,e){++qt,Pt+=(t-Pt)/qt,_t+=(n-_t)/qt,Ft+=(e-Ft)/qt}function on(){nn.point=an}function an(t,n){t*=B;var e=C(n*=B);jt=e*C(t),Ht=e*Y(t),Bt=Y(n),nn.point=sn,rn(jt,Ht,Bt)}function sn(t,n){t*=B;var e=C(n*=B),r=e*C(t),i=e*Y(t),o=Y(n),a=G(W((a=Ht*o-Bt*i)*a+(a=Bt*r-jt*o)*a+(a=jt*i-Ht*r)*a),jt*r+Ht*i+Bt*o);At+=a,Rt+=a*(jt+(jt=r)),Lt+=a*(Ht+(Ht=i)),Ot+=a*(Bt+(Bt=o)),rn(jt,Ht,Bt)}function un(){nn.point=en}function cn(){nn.point=hn}function ln(){fn(Dt,Vt),nn.point=en}function hn(t,n){Dt=t,Vt=n,t*=B,n*=B,nn.point=fn;var e=C(n);jt=e*C(t),Ht=e*Y(t),Bt=Y(n),rn(jt,Ht,Bt)}function fn(t,n){t*=B;var e=C(n*=B),r=e*C(t),i=e*Y(t),o=Y(n),a=Ht*o-Bt*i,s=Bt*r-jt*o,u=jt*i-Ht*r,c=X(a,s,u),l=Z(c),h=c&&-l/c;It.add(h*a),Tt.add(h*s),zt.add(h*u),At+=l,Rt+=l*(jt+(jt=r)),Lt+=l*(Ht+(Ht=i)),Ot+=l*(Bt+(Bt=o)),rn(jt,Ht,Bt)}function dn(t,n){return function(e,r,i){if(e){const n=R(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const gn=dn("area",(function(t){return xt=new O,rt(t,Nt),2*xt})),pn=dn("bounds",(function(t){var n,e,r,i,o,a,s;if(ft=ht=-(ct=lt=1/0),vt=[],rt(t,Ut),e=vt.length){for(vt.sort(Qt),n=1,o=[r=vt[0]];n<e;++n)tn(r,(i=vt[n])[0])||tn(r,i[1])?(Kt(r[0],i[1])>Kt(r[0],r[1])&&(r[1]=i[1]),Kt(i[0],r[1])>Kt(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(s=Kt(r[1],i[0]))>a&&(a=s,ct=i[0],ht=r[1])}return vt=bt=null,ct===1/0||lt===1/0?[[NaN,NaN],[NaN,NaN]]:[[ct,lt],[ht,ft]]})),mn=dn("centroid",(function(t){qt=At=Pt=_t=Ft=Rt=Lt=Ot=0,It=new O,Tt=new O,zt=new O,rt(t,nn);var n=+It,e=+Tt,r=+zt,i=X(n,e,r);return i<T&&(n=Rt,e=Lt,r=Ot,At<I&&(n=Pt,e=_t,r=Ft),(i=X(n,e,r))<T)?[NaN,NaN]:[G(e,n)*H,Z(r/i)*H]}));function yn(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e}function vn(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function bn(){return vn(this.context.dataflow,"warn",arguments)}function wn(){return vn(this.context.dataflow,"info",arguments)}function xn(){return vn(this.context.dataflow,"debug",arguments)}function Nn(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Sn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function $n(){}var kn=.7,En=1/kn,Mn="\\s*([+-]?\\d+)\\s*",qn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",An="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Pn=/^#([0-9a-f]{3,8})$/,_n=new RegExp(`^rgb\\(${Mn},${Mn},${Mn}\\)$`),Fn=new RegExp(`^rgb\\(${An},${An},${An}\\)$`),Rn=new RegExp(`^rgba\\(${Mn},${Mn},${Mn},${qn}\\)$`),Ln=new RegExp(`^rgba\\(${An},${An},${An},${qn}\\)$`),On=new RegExp(`^hsl\\(${qn},${An},${An}\\)$`),In=new RegExp(`^hsla\\(${qn},${An},${An},${qn}\\)$`),Tn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function zn(){return this.rgb().formatHex()}function Dn(){return this.rgb().formatRgb()}function Vn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Pn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?jn(n):3===e?new Gn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Hn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Hn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=_n.exec(t))?new Gn(n[1],n[2],n[3],1):(n=Fn.exec(t))?new Gn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Rn.exec(t))?Hn(n[1],n[2],n[3],n[4]):(n=Ln.exec(t))?Hn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=On.exec(t))?Jn(n[1],n[2]/100,n[3]/100,1):(n=In.exec(t))?Jn(n[1],n[2]/100,n[3]/100,n[4]):Tn.hasOwnProperty(t)?jn(Tn[t]):"transparent"===t?new Gn(NaN,NaN,NaN,0):null}function jn(t){return new Gn(t>>16&255,t>>8&255,255&t,1)}function Hn(t,n,e,r){return r<=0&&(t=n=e=NaN),new Gn(t,n,e,r)}function Bn(t){return t instanceof $n||(t=Vn(t)),t?new Gn((t=t.rgb()).r,t.g,t.b,t.opacity):new Gn}function Un(t,n,e,r){return 1===arguments.length?Bn(t):new Gn(t,n,e,null==r?1:r)}function Gn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Cn(){return`#${Zn(this.r)}${Zn(this.g)}${Zn(this.b)}`}function Xn(){const t=Yn(this.opacity);return`${1===t?"rgb(":"rgba("}${Wn(this.r)}, ${Wn(this.g)}, ${Wn(this.b)}${1===t?")":`, ${t})`}`}function Yn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Wn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Zn(t){return((t=Wn(t))<16?"0":"")+t.toString(16)}function Jn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new te(t,n,e,r)}function Kn(t){if(t instanceof te)return new te(t.h,t.s,t.l,t.opacity);if(t instanceof $n||(t=Vn(t)),!t)return new te;if(t instanceof te)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new te(a,s,u,t.opacity)}function Qn(t,n,e,r){return 1===arguments.length?Kn(t):new te(t,n,e,null==r?1:r)}function te(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function ne(t){return(t=(t||0)%360)<0?t+360:t}function ee(t){return Math.max(0,Math.min(1,t||0))}function re(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Nn($n,Vn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:zn,formatHex:zn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Kn(this).formatHsl()},formatRgb:Dn,toString:Dn}),Nn(Gn,Un,Sn($n,{brighter(t){return t=null==t?En:Math.pow(En,t),new Gn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?kn:Math.pow(kn,t),new Gn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Gn(Wn(this.r),Wn(this.g),Wn(this.b),Yn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Cn,formatHex:Cn,formatHex8:function(){return`#${Zn(this.r)}${Zn(this.g)}${Zn(this.b)}${Zn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Xn,toString:Xn})),Nn(te,Qn,Sn($n,{brighter(t){return t=null==t?En:Math.pow(En,t),new te(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?kn:Math.pow(kn,t),new te(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Gn(re(t>=240?t-240:t+120,i,r),re(t,i,r),re(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new te(ne(this.h),ee(this.s),ee(this.l),Yn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Yn(this.opacity);return`${1===t?"hsl(":"hsla("}${ne(this.h)}, ${100*ee(this.s)}%, ${100*ee(this.l)}%${1===t?")":`, ${t})`}`}}));const ie=Math.PI/180,oe=180/Math.PI,ae=.96422,se=1,ue=.82521,ce=4/29,le=6/29,he=3*le*le,fe=le*le*le;function de(t){if(t instanceof pe)return new pe(t.l,t.a,t.b,t.opacity);if(t instanceof xe)return Ne(t);t instanceof Gn||(t=Bn(t));var n,e,r=be(t.r),i=be(t.g),o=be(t.b),a=me((.2225045*r+.7168786*i+.0606169*o)/se);return r===i&&i===o?n=e=a:(n=me((.4360747*r+.3850649*i+.1430804*o)/ae),e=me((.0139322*r+.0971045*i+.7141733*o)/ue)),new pe(116*a-16,500*(n-a),200*(a-e),t.opacity)}function ge(t,n,e,r){return 1===arguments.length?de(t):new pe(t,n,e,null==r?1:r)}function pe(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function me(t){return t>fe?Math.pow(t,1/3):t/he+ce}function ye(t){return t>le?t*t*t:he*(t-ce)}function ve(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function be(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function we(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof xe)return new xe(t.h,t.c,t.l,t.opacity);if(t instanceof pe||(t=de(t)),0===t.a&&0===t.b)return new xe(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*oe;return new xe(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new xe(t,n,e,null==r?1:r)}function xe(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Ne(t){if(isNaN(t.h))return new pe(t.l,0,0,t.opacity);var n=t.h*ie;return new pe(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}function Se(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function $e(t){const n=Un(t);return.2126*Se(n.r)+.7152*Se(n.g)+.0722*Se(n.b)}function ke(t,n){const e=$e(t),r=$e(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)}function Ee(){const t=[].slice.call(arguments);return t.unshift({}),n.extend(...t)}function Me(t,e){return t===e||t!=t&&e!=e||(n.isArray(t)?!(!n.isArray(e)||t.length!==e.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!Me(t[e],n[e]))return!1;return!0}(t,e):!(!n.isObject(t)||!n.isObject(e))&&qe(t,e))}function qe(t,n){for(const e in t)if(!Me(t[e],n[e]))return!1;return!0}function Ae(t){return n=>qe(t,n)}function Pe(t,e,r,o,a,s){const u=this.context.dataflow,c=this.context.data[t],l=c.input,h=u.stamp();let f,d,g=c.changes;if(!1===u._trigger||!(l.value.length||e||o))return 0;if((!g||g.stamp<h)&&(c.changes=g=u.changeset(),g.stamp=h,u.runAfter((()=>{c.modified=!0,u.pulse(l,g).run()}),!0,1)),r&&(f=!0===r?n.truthy:n.isArray(r)||i.isTuple(r)?r:Ae(r),g.remove(f)),e&&g.insert(e),o&&(f=Ae(o),l.value.some(f)?g.remove(f):g.insert(o)),a)for(d in s)g.modify(a,d,s[d]);return 1}function _e(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.hypot(e,r)}function Fe(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)}Nn(pe,ge,Sn($n,{brighter(t){return new pe(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new pe(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Gn(ve(3.1338561*(n=ae*ye(n))-1.6168667*(t=se*ye(t))-.4906146*(e=ue*ye(e))),ve(-.9787684*n+1.9161415*t+.033454*e),ve(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Nn(xe,we,Sn($n,{brighter(t){return new xe(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new xe(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Ne(this).rgb()}}));const Re={};function Le(t,e){const r=Re[e]||(Re[e]=n.field(e));return n.isArray(t)?t.map(r):r(t)}function Oe(t){return n.isArray(t)||ArrayBuffer.isView(t)?t:null}function Ie(t){return Oe(t)||(n.isString(t)?t:null)}function Te(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Oe(t).join(...e)}function ze(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Ie(t).indexOf(...e)}function De(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Ie(t).lastIndexOf(...e)}function Ve(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Ie(t).slice(...e)}function je(t,e,r){return n.isFunction(r)&&n.error("Function argument passed to replace."),String(t).replace(e,r)}function He(t){return Oe(t).slice().reverse()}function Be(t,n,e){return r.bandSpace(t||0,n||0,e||0)}function Ue(t,n){const e=R(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}function Ge(t,n){const e=R(t,(n||this).context);return e?e.copy():void 0}function Ce(t,n){const e=R(t,(n||this).context);return e?e.domain():[]}function Xe(t,e,r){const i=R(t,(r||this).context);return i?n.isArray(e)?(i.invertRange||i.invert)(e):(i.invert||i.invertExtent)(e):void 0}function Ye(t,n){const e=R(t,(n||this).context);return e&&e.range?e.range():[]}function We(t,n,e){const r=R(t,(e||this).context);return r?r(n):void 0}function Ze(t,e,i,a,s){t=R(t,(s||this).context);const u=o.Gradient(e,i);let c=t.domain(),l=c[0],h=n.peek(c),f=n.identity;return h-l?f=r.scaleFraction(t,l,h):t=(t.interpolator?r.scale("sequential")().interpolator(t.interpolator()):r.scale("linear")().interpolate(t.interpolate()).range(t.range())).domain([l=0,h=1]),t.ticks&&(c=t.ticks(+a||15),l!==c[0]&&c.unshift(l),h!==n.peek(c)&&c.push(h)),c.forEach((n=>u.stop(f(n),t(n)))),u}function Je(t,n,e){const r=R(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}function Ke(t){let n=null;return function(e){return e?o.pathRender(e,n=n||o.pathParse(t)):t}}const Qe=t=>t.data;function tr(t,n){const e=c.call(n,t);return e.root&&e.root.lookup||{}}function nr(t,n,e){const r=tr(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(Qe):void 0}function er(t,n){const e=tr(t,this)[n];return e?e.ancestors().map(Qe):void 0}const rr=()=>"undefined"!=typeof window&&window||null;function ir(){const t=rr();return t?t.screen:{}}function or(){const t=rr();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]}function ar(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]}function sr(t,e,r){if(!t)return[];const[i,a]=t,s=(new o.Bounds).set(i[0],i[1],a[0],a[1]),u=r||this.context.dataflow.scenegraph().root;return o.intersect(u,s,function(t){let e=null;if(t){const r=n.array(t.marktype),i=n.array(t.markname);e=t=>(!r.length||r.some((n=>t.marktype===n)))&&(!i.length||i.some((n=>t.name===n)))}return e}(e))}const ur={random:()=>s.random(),cumulativeNormal:s.cumulativeNormal,cumulativeLogNormal:s.cumulativeLogNormal,cumulativeUniform:s.cumulativeUniform,densityNormal:s.densityNormal,densityLogNormal:s.densityLogNormal,densityUniform:s.densityUniform,quantileNormal:s.quantileNormal,quantileLogNormal:s.quantileLogNormal,quantileUniform:s.quantileUniform,sampleNormal:s.sampleNormal,sampleLogNormal:s.sampleLogNormal,sampleUniform:s.sampleUniform,isArray:n.isArray,isBoolean:n.isBoolean,isDate:n.isDate,isDefined:t=>void 0!==t,isNumber:n.isNumber,isObject:n.isObject,isRegExp:n.isRegExp,isString:n.isString,isTuple:i.isTuple,isValid:t=>null!=t&&t==t,toBoolean:n.toBoolean,toDate:t=>n.toDate(t),toNumber:n.toNumber,toString:n.toString,indexof:ze,join:Te,lastindexof:De,replace:je,reverse:He,slice:Ve,flush:n.flush,lerp:n.lerp,merge:Ee,pad:n.pad,peek:n.peek,pluck:Le,span:n.span,inrange:n.inrange,truncate:n.truncate,rgb:Un,lab:ge,hcl:we,hsl:Qn,luminance:$e,contrast:ke,sequence:function(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o},format:g,utcFormat:m,utcParse:v,utcOffset:u.utcOffset,utcSequence:u.utcSequence,timeFormat:p,timeParse:y,timeOffset:u.timeOffset,timeSequence:u.timeSequence,timeUnitSpecifier:u.timeUnitSpecifier,monthFormat:x,monthAbbrevFormat:N,dayFormat:S,dayAbbrevFormat:$,quarter:n.quarter,utcquarter:n.utcquarter,week:u.week,utcweek:u.utcweek,dayofyear:u.dayofyear,utcdayofyear:u.utcdayofyear,warn:bn,info:wn,debug:xn,extent:t=>n.extent(t),inScope:yn,intersect:sr,clampRange:n.clampRange,pinchDistance:_e,pinchAngle:Fe,screen:ir,containerSize:ar,windowSize:or,bandspace:Be,setdata:h,pathShape:Ke,panLinear:n.panLinear,panLog:n.panLog,panPow:n.panPow,panSymlog:n.panSymlog,zoomLinear:n.zoomLinear,zoomLog:n.zoomLog,zoomPow:n.zoomPow,zoomSymlog:n.zoomSymlog,encode:f,modify:Pe,lassoAppend:function(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const o=(t=n.array(t))[t.length-1];return void 0===o||Math.hypot(o[0]-e,o[1]-r)>i?[...t,[e,r]]:t},lassoPath:function(t){return n.array(t).reduce(((n,e,r)=>{let[i,o]=e;return n+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:a}=e,s=(new o.Bounds).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<s.x1&&(s.x1=t),t>s.x2&&(s.x2=t),e<s.y1&&(s.y1=e),e>s.y2&&(s.y2=e);return s.translate(r,i),sr([[s.x1,s.y1],[s.x2,s.y2]],t,a).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,s]=e[o],[u,c]=e[i];c>n!=s>n&&t<(a-u)*(n-c)/(s-c)+u&&r++}return 1&r}(t.x,t.y,n)))}},cr=["view","item","group","xy","x","y"],lr="event.vega.",hr="this.",fr={},dr={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${n.stringValue(q+t)}]`,functions:function(t){const r=e.functions(t);cr.forEach((t=>r[t]=lr+t));for(const t in ur)r[t]=hr+t;return n.extend(r,L(t,ur,fr)),r},constants:e.constants,visitors:fr},gr=e.codegenExpression(dr);function pr(t,n,e){return 1===arguments.length?ur[t]:(ur[t]=n,e&&(fr[t]=e),gr&&(gr.functions[t]=hr+t),this)}pr("bandwidth",Ue,_),pr("copy",Ge,_),pr("domain",Ce,_),pr("range",Ye,_),pr("invert",Xe,_),pr("scale",We,_),pr("gradient",Ze,_),pr("geoArea",gn,_),pr("geoBounds",pn,_),pr("geoCentroid",mn,_),pr("geoShape",Je,_),pr("indata",l,P),pr("data",c,A),pr("treePath",nr,A),pr("treeAncestors",er,A),pr("vlSelectionTest",a.selectionTest,a.selectionVisitor),pr("vlSelectionIdTest",a.selectionIdTest,a.selectionVisitor),pr("vlSelectionResolve",a.selectionResolve,a.selectionVisitor),pr("vlSelectionTuples",a.selectionTuples),t.DataPrefix=k,t.IndexPrefix=E,t.ScalePrefix=M,t.SignalPrefix=q,t.bandspace=Be,t.bandwidth=Ue,t.codeGenerator=gr,t.codegenParams=dr,t.containerSize=ar,t.contrast=ke,t.copy=Ge,t.data=c,t.dataVisitor=A,t.dayAbbrevFormat=$,t.dayFormat=S,t.debug=xn,t.domain=Ce,t.encode=f,t.expressionFunction=pr,t.format=g,t.functionContext=ur,t.geoArea=gn,t.geoBounds=pn,t.geoCentroid=mn,t.geoShape=Je,t.inScope=yn,t.indata=l,t.indataVisitor=P,t.indexof=ze,t.info=wn,t.invert=Xe,t.join=Te,t.lastindexof=De,t.luminance=$e,t.merge=Ee,t.modify=Pe,t.monthAbbrevFormat=N,t.monthFormat=x,t.parseExpression=function(t,r){const i={};let o;try{t=n.isString(t)?t:n.stringValue(t)+"",o=e.parseExpression(t)}catch(e){n.error("Expression parse error: "+t)}o.visit((t=>{if(t.type!==e.CallExpression)return;const n=t.callee.name,o=dr.visitors[n];o&&o(n,t.arguments,r,i)}));const a=gr(o);return a.globals.forEach((t=>{const e=q+t;!n.hasOwnProperty(i,e)&&r.getSignal(t)&&(i[e]=r.signalRef(t))})),{$expr:n.extend({code:a.code},r.options.ast?{ast:o}:null),$fields:a.fields,$params:i}},t.pathShape=Ke,t.pinchAngle=Fe,t.pinchDistance=_e,t.pluck=Le,t.range=Ye,t.replace=je,t.reverse=He,t.scale=We,t.scaleGradient=Ze,t.scaleVisitor=_,t.screen=ir,t.setdata=h,t.slice=Ve,t.timeFormat=p,t.timeParse=y,t.treeAncestors=er,t.treePath=nr,t.utcFormat=m,t.utcParse=v,t.warn=bn,t.windowSize=or})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("vega-expression"),require("vega-scale"),require("vega-dataflow"),require("vega-scenegraph"),require("vega-selections"),require("vega-statistics"),require("vega-time")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-expression","vega-scale","vega-dataflow","vega-scenegraph","vega-selections","vega-statistics","vega-time"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).vega={},t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega,t.vega)}(this,(function(t,n,e,r,i,o,a,s,u){"use strict";function c(t){const n=this.context.data[t];return n?n.values.value:[]}function l(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}function h(t,e){const r=this.context.dataflow,i=this.context.data[t].input;return r.pulse(i,r.changeset().remove(n.truthy).insert(e)),1}function f(t,n,e){if(t){const e=this.context.dataflow,r=t.mark.source;e.pulse(r,e.changeset().encode(t,n))}return void 0!==e?e:t}const g=t=>function(n,e){return this.context.dataflow.locale()[t](e)(n)},d=g("format"),p=g("timeFormat"),m=g("utcFormat"),y=g("timeParse"),v=g("utcParse"),b=new Date(2e3,0,1);function w(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(b.setYear(2e3),b.setMonth(t),b.setDate(n),p.call(this,b,e)):""}function x(t){return w.call(this,t,1,"%B")}function N(t){return w.call(this,t,1,"%b")}function S(t){return w.call(this,0,2+t,"%A")}function $(t){return w.call(this,0,2+t,"%a")}const k="%";function E(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to data functions must be a string literal.");const a=r[0].value,s=":"+a;if(!n.hasOwnProperty(s,o))try{o[s]=i.getData(a).tuplesRef()}catch(t){}}function M(t,r,i,o){r[0].type!==e.Literal&&n.error("First argument to indata must be a string literal."),r[1].type!==e.Literal&&n.error("Second argument to indata must be a string literal.");const a=r[0].value,s=r[1].value,u="@"+s;n.hasOwnProperty(u,o)||(o[u]=i.getData(a).indataRef(i,s))}function q(t,n,r,i){if(n[0].type===e.Literal)A(r,i,n[0].value);else for(t in r.scales)A(r,i,t)}function A(t,e,r){const i=k+r;if(!n.hasOwnProperty(e,i))try{e[i]=t.scaleRef(r)}catch(t){}}function P(t,e){if(n.isFunction(t))return t;if(n.isString(t)){const n=e.scales[t];return n&&r.isRegisteredScale(n.value)?n.value:void 0}}function _(t,r,i){r.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,i._bandwidth=q,i._range=q,i._scale=q;const o=r=>"_["+(r.type===e.Literal?n.stringValue(k+r.value):n.stringValue(k)+"+"+t(r))+"]";return{_bandwidth:t=>`this.__bandwidth(${o(t[0])})`,_range:t=>`${o(t[0])}.range()`,_scale:n=>`${o(n[0])}(${t(n[1])})`}}class F{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}var R=1e-6,L=Math.PI,O=L/2,I=L/4,T=2*L,z=180/L,D=L/180,V=Math.abs,j=Math.atan2,H=Math.cos,B=Math.hypot,U=Math.sin,G=Math.sqrt;function C(t){return t>1?O:t<-1?-O:Math.asin(t)}function X(){}function Y(t,n){t&&Z.hasOwnProperty(t.type)&&Z[t.type](t,n)}var W={Feature:function(t,n){Y(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Y(e[r].geometry,n)}},Z={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){J(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)J(e[r],n,0)},Polygon:function(t,n){K(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)K(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Y(e[r],n)}};function J(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function K(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)J(t[e],n,1);n.polygonEnd()}function Q(t,n){t&&W.hasOwnProperty(t.type)?W[t.type](t,n):Y(t,n)}var tt,nt,et,rt,it,ot,at,st,ut,ct,lt,ht,ft,gt,dt,pt,mt=new F,yt=new F,vt={point:X,lineStart:X,lineEnd:X,polygonStart:function(){mt=new F,vt.lineStart=bt,vt.lineEnd=wt},polygonEnd:function(){var t=+mt;yt.add(t<0?T+t:t),this.lineStart=this.lineEnd=this.point=X},sphere:function(){yt.add(T)}};function bt(){vt.point=xt}function wt(){Nt(tt,nt)}function xt(t,n){vt.point=Nt,tt=t,nt=n,et=t*=D,rt=H(n=(n*=D)/2+I),it=U(n)}function Nt(t,n){var e=(t*=D)-et,r=e>=0?1:-1,i=r*e,o=H(n=(n*=D)/2+I),a=U(n),s=it*a,u=rt*o+s*H(i),c=s*r*U(i);mt.add(j(c,u)),et=t,rt=o,it=a}function St(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}var $t,kt,Et,Mt,qt,At,Pt,_t,Ft,Rt,Lt,Ot,It,Tt,zt,Dt,Vt={point:jt,lineStart:Bt,lineEnd:Ut,polygonStart:function(){Vt.point=Gt,Vt.lineStart=Ct,Vt.lineEnd=Xt,gt=new F,vt.polygonStart()},polygonEnd:function(){vt.polygonEnd(),Vt.point=jt,Vt.lineStart=Bt,Vt.lineEnd=Ut,mt<0?(ot=-(st=180),at=-(ut=90)):gt>R?ut=90:gt<-R&&(at=-90),pt[0]=ot,pt[1]=st},sphere:function(){ot=-(st=180),at=-(ut=90)}};function jt(t,n){dt.push(pt=[ot=t,st=t]),n<at&&(at=n),n>ut&&(ut=n)}function Ht(t,n){var e,r,i=function(t){var n=t[0],e=t[1],r=H(e);return[r*H(n),r*U(n),U(e)]}([t*D,n*D]);if(ft){var o=St(ft,i),a=St([o[1],-o[0],0],o);r=G((e=a)[0]*e[0]+e[1]*e[1]+e[2]*e[2]),e[0]/=r,e[1]/=r,e[2]/=r,a=function(t){return[j(t[1],t[0]),C(t[2])]}(a);var s,u=t-ct,c=u>0?1:-1,l=a[0]*z*c,h=V(u)>180;h^(c*ct<l&&l<c*t)?(s=a[1]*z)>ut&&(ut=s):h^(c*ct<(l=(l+360)%360-180)&&l<c*t)?(s=-a[1]*z)<at&&(at=s):(n<at&&(at=n),n>ut&&(ut=n)),h?t<ct?Yt(ot,t)>Yt(ot,st)&&(st=t):Yt(t,st)>Yt(ot,st)&&(ot=t):st>=ot?(t<ot&&(ot=t),t>st&&(st=t)):t>ct?Yt(ot,t)>Yt(ot,st)&&(st=t):Yt(t,st)>Yt(ot,st)&&(ot=t)}else dt.push(pt=[ot=t,st=t]);n<at&&(at=n),n>ut&&(ut=n),ft=i,ct=t}function Bt(){Vt.point=Ht}function Ut(){pt[0]=ot,pt[1]=st,Vt.point=jt,ft=null}function Gt(t,n){if(ft){var e=t-ct;gt.add(V(e)>180?e+(e>0?360:-360):e)}else lt=t,ht=n;vt.point(t,n),Ht(t,n)}function Ct(){vt.lineStart()}function Xt(){Gt(lt,ht),vt.lineEnd(),V(gt)>R&&(ot=-(st=180)),pt[0]=ot,pt[1]=st,ft=null}function Yt(t,n){return(n-=t)<0?n+360:n}function Wt(t,n){return t[0]-n[0]}function Zt(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var Jt={sphere:X,point:Kt,lineStart:tn,lineEnd:rn,polygonStart:function(){Jt.lineStart=on,Jt.lineEnd=an},polygonEnd:function(){Jt.lineStart=tn,Jt.lineEnd=rn}};function Kt(t,n){t*=D;var e=H(n*=D);Qt(e*H(t),e*U(t),U(n))}function Qt(t,n,e){++$t,Et+=(t-Et)/$t,Mt+=(n-Mt)/$t,qt+=(e-qt)/$t}function tn(){Jt.point=nn}function nn(t,n){t*=D;var e=H(n*=D);Tt=e*H(t),zt=e*U(t),Dt=U(n),Jt.point=en,Qt(Tt,zt,Dt)}function en(t,n){t*=D;var e=H(n*=D),r=e*H(t),i=e*U(t),o=U(n),a=j(G((a=zt*o-Dt*i)*a+(a=Dt*r-Tt*o)*a+(a=Tt*i-zt*r)*a),Tt*r+zt*i+Dt*o);kt+=a,At+=a*(Tt+(Tt=r)),Pt+=a*(zt+(zt=i)),_t+=a*(Dt+(Dt=o)),Qt(Tt,zt,Dt)}function rn(){Jt.point=Kt}function on(){Jt.point=sn}function an(){un(Ot,It),Jt.point=Kt}function sn(t,n){Ot=t,It=n,t*=D,n*=D,Jt.point=un;var e=H(n);Tt=e*H(t),zt=e*U(t),Dt=U(n),Qt(Tt,zt,Dt)}function un(t,n){t*=D;var e=H(n*=D),r=e*H(t),i=e*U(t),o=U(n),a=zt*o-Dt*i,s=Dt*r-Tt*o,u=Tt*i-zt*r,c=B(a,s,u),l=C(c),h=c&&-l/c;Ft.add(h*a),Rt.add(h*s),Lt.add(h*u),kt+=l,At+=l*(Tt+(Tt=r)),Pt+=l*(zt+(zt=i)),_t+=l*(Dt+(Dt=o)),Qt(Tt,zt,Dt)}function cn(t,n){return function(e,r,i){if(e){const n=P(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const ln=cn("area",(function(t){return yt=new F,Q(t,vt),2*yt})),hn=cn("bounds",(function(t){var n,e,r,i,o,a,s;if(ut=st=-(ot=at=1/0),dt=[],Q(t,Vt),e=dt.length){for(dt.sort(Wt),n=1,o=[r=dt[0]];n<e;++n)Zt(r,(i=dt[n])[0])||Zt(r,i[1])?(Yt(r[0],i[1])>Yt(r[0],r[1])&&(r[1]=i[1]),Yt(i[0],r[1])>Yt(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)i=o[n],(s=Yt(r[1],i[0]))>a&&(a=s,ot=i[0],st=r[1])}return dt=pt=null,ot===1/0||at===1/0?[[NaN,NaN],[NaN,NaN]]:[[ot,at],[st,ut]]})),fn=cn("centroid",(function(t){$t=kt=Et=Mt=qt=At=Pt=_t=0,Ft=new F,Rt=new F,Lt=new F,Q(t,Jt);var n=+Ft,e=+Rt,r=+Lt,i=B(n,e,r);return i<1e-12&&(n=At,e=Pt,r=_t,kt<R&&(n=Et,e=Mt,r=qt),(i=B(n,e,r))<1e-12)?[NaN,NaN]:[j(e,n)*z,C(r/i)*z]}));function gn(t,n){const e=P(t,(n||this).context);return e&&e.scale()}function dn(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e}function pn(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function mn(){return pn(this.context.dataflow,"warn",arguments)}function yn(){return pn(this.context.dataflow,"info",arguments)}function vn(){return pn(this.context.dataflow,"debug",arguments)}function bn(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function wn(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function xn(){}var Nn=.7,Sn=1/Nn,$n="\\s*([+-]?\\d+)\\s*",kn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",En="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mn=/^#([0-9a-f]{3,8})$/,qn=new RegExp(`^rgb\\(${$n},${$n},${$n}\\)$`),An=new RegExp(`^rgb\\(${En},${En},${En}\\)$`),Pn=new RegExp(`^rgba\\(${$n},${$n},${$n},${kn}\\)$`),_n=new RegExp(`^rgba\\(${En},${En},${En},${kn}\\)$`),Fn=new RegExp(`^hsl\\(${kn},${En},${En}\\)$`),Rn=new RegExp(`^hsla\\(${kn},${En},${En},${kn}\\)$`),Ln={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function On(){return this.rgb().formatHex()}function In(){return this.rgb().formatRgb()}function Tn(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Mn.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?zn(n):3===e?new Hn(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Dn(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Dn(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=qn.exec(t))?new Hn(n[1],n[2],n[3],1):(n=An.exec(t))?new Hn(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Pn.exec(t))?Dn(n[1],n[2],n[3],n[4]):(n=_n.exec(t))?Dn(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Fn.exec(t))?Yn(n[1],n[2]/100,n[3]/100,1):(n=Rn.exec(t))?Yn(n[1],n[2]/100,n[3]/100,n[4]):Ln.hasOwnProperty(t)?zn(Ln[t]):"transparent"===t?new Hn(NaN,NaN,NaN,0):null}function zn(t){return new Hn(t>>16&255,t>>8&255,255&t,1)}function Dn(t,n,e,r){return r<=0&&(t=n=e=NaN),new Hn(t,n,e,r)}function Vn(t){return t instanceof xn||(t=Tn(t)),t?new Hn((t=t.rgb()).r,t.g,t.b,t.opacity):new Hn}function jn(t,n,e,r){return 1===arguments.length?Vn(t):new Hn(t,n,e,null==r?1:r)}function Hn(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Bn(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}`}function Un(){const t=Gn(this.opacity);return`${1===t?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${1===t?")":`, ${t})`}`}function Gn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Cn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Xn(t){return((t=Cn(t))<16?"0":"")+t.toString(16)}function Yn(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Jn(t,n,e,r)}function Wn(t){if(t instanceof Jn)return new Jn(t.h,t.s,t.l,t.opacity);if(t instanceof xn||(t=Tn(t)),!t)return new Jn;if(t instanceof Jn)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=n===o?(e-r)/s+6*(e<r):e===o?(r-n)/s+2:(n-e)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Jn(a,s,u,t.opacity)}function Zn(t,n,e,r){return 1===arguments.length?Wn(t):new Jn(t,n,e,null==r?1:r)}function Jn(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Kn(t){return(t=(t||0)%360)<0?t+360:t}function Qn(t){return Math.max(0,Math.min(1,t||0))}function te(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}bn(xn,Tn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:On,formatHex:On,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Wn(this).formatHsl()},formatRgb:In,toString:In}),bn(Hn,jn,wn(xn,{brighter(t){return t=null==t?Sn:Math.pow(Sn,t),new Hn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Nn:Math.pow(Nn,t),new Hn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Hn(Cn(this.r),Cn(this.g),Cn(this.b),Gn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Bn,formatHex:Bn,formatHex8:function(){return`#${Xn(this.r)}${Xn(this.g)}${Xn(this.b)}${Xn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Un,toString:Un})),bn(Jn,Zn,wn(xn,{brighter(t){return t=null==t?Sn:Math.pow(Sn,t),new Jn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Nn:Math.pow(Nn,t),new Jn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new Hn(te(t>=240?t-240:t+120,i,r),te(t,i,r),te(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Jn(Kn(this.h),Qn(this.s),Qn(this.l),Gn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Gn(this.opacity);return`${1===t?"hsl(":"hsla("}${Kn(this.h)}, ${100*Qn(this.s)}%, ${100*Qn(this.l)}%${1===t?")":`, ${t})`}`}}));const ne=Math.PI/180,ee=180/Math.PI,re=.96422,ie=1,oe=.82521,ae=4/29,se=6/29,ue=3*se*se,ce=se*se*se;function le(t){if(t instanceof fe)return new fe(t.l,t.a,t.b,t.opacity);if(t instanceof ve)return be(t);t instanceof Hn||(t=Vn(t));var n,e,r=me(t.r),i=me(t.g),o=me(t.b),a=ge((.2225045*r+.7168786*i+.0606169*o)/ie);return r===i&&i===o?n=e=a:(n=ge((.4360747*r+.3850649*i+.1430804*o)/re),e=ge((.0139322*r+.0971045*i+.7141733*o)/oe)),new fe(116*a-16,500*(n-a),200*(a-e),t.opacity)}function he(t,n,e,r){return 1===arguments.length?le(t):new fe(t,n,e,null==r?1:r)}function fe(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function ge(t){return t>ce?Math.pow(t,1/3):t/ue+ae}function de(t){return t>se?t*t*t:ue*(t-ae)}function pe(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ye(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof ve)return new ve(t.h,t.c,t.l,t.opacity);if(t instanceof fe||(t=le(t)),0===t.a&&0===t.b)return new ve(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*ee;return new ve(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new ve(t,n,e,null==r?1:r)}function ve(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function be(t){if(isNaN(t.h))return new fe(t.l,0,0,t.opacity);var n=t.h*ne;return new fe(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}function we(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function xe(t){const n=jn(t);return.2126*we(n.r)+.7152*we(n.g)+.0722*we(n.b)}function Ne(t,n){const e=xe(t),r=xe(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)}function Se(){const t=[].slice.call(arguments);return t.unshift({}),n.extend(...t)}function $e(t,e){return t===e||t!=t&&e!=e||(n.isArray(t)?!(!n.isArray(e)||t.length!==e.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!$e(t[e],n[e]))return!1;return!0}(t,e):!(!n.isObject(t)||!n.isObject(e))&&ke(t,e))}function ke(t,n){for(const e in t)if(!$e(t[e],n[e]))return!1;return!0}function Ee(t){return n=>ke(t,n)}function Me(t,e,r,o,a,s){const u=this.context.dataflow,c=this.context.data[t],l=c.input,h=u.stamp();let f,g,d=c.changes;if(!1===u._trigger||!(l.value.length||e||o))return 0;if((!d||d.stamp<h)&&(c.changes=d=u.changeset(),d.stamp=h,u.runAfter((()=>{c.modified=!0,u.pulse(l,d).run()}),!0,1)),r&&(f=!0===r?n.truthy:n.isArray(r)||i.isTuple(r)?r:Ee(r),d.remove(f)),e&&d.insert(e),o&&(f=Ee(o),l.value.some(f)?d.remove(f):d.insert(o)),a)for(g in s)d.modify(a,g,s[g]);return 1}function qe(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.hypot(e,r)}function Ae(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)}bn(fe,he,wn(xn,{brighter(t){return new fe(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new fe(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new Hn(pe(3.1338561*(n=re*de(n))-1.6168667*(t=ie*de(t))-.4906146*(e=oe*de(e))),pe(-.9787684*n+1.9161415*t+.033454*e),pe(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),bn(ve,ye,wn(xn,{brighter(t){return new ve(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new ve(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return be(this).rgb()}}));const Pe={};function _e(t,e){const r=Pe[e]||(Pe[e]=n.field(e));return n.isArray(t)?t.map(r):r(t)}function Fe(t){return n.isArray(t)||ArrayBuffer.isView(t)?t:null}function Re(t){return Fe(t)||(n.isString(t)?t:null)}function Le(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Fe(t).join(...e)}function Oe(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Re(t).indexOf(...e)}function Ie(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Re(t).lastIndexOf(...e)}function Te(t){for(var n=arguments.length,e=new Array(n>1?n-1:0),r=1;r<n;r++)e[r-1]=arguments[r];return Re(t).slice(...e)}function ze(t,e,r){return n.isFunction(r)&&n.error("Function argument passed to replace."),String(t).replace(e,r)}function De(t){return Fe(t).slice().reverse()}function Ve(t,n,e){return r.bandSpace(t||0,n||0,e||0)}function je(t,n){const e=P(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}function He(t,n){const e=P(t,(n||this).context);return e?e.copy():void 0}function Be(t,n){const e=P(t,(n||this).context);return e?e.domain():[]}function Ue(t,e,r){const i=P(t,(r||this).context);return i?n.isArray(e)?(i.invertRange||i.invert)(e):(i.invert||i.invertExtent)(e):void 0}function Ge(t,n){const e=P(t,(n||this).context);return e&&e.range?e.range():[]}function Ce(t,n,e){const r=P(t,(e||this).context);return r?r(n):void 0}function Xe(t,e,i,a,s){t=P(t,(s||this).context);const u=o.Gradient(e,i);let c=t.domain(),l=c[0],h=n.peek(c),f=n.identity;return h-l?f=r.scaleFraction(t,l,h):t=(t.interpolator?r.scale("sequential")().interpolator(t.interpolator()):r.scale("linear")().interpolate(t.interpolate()).range(t.range())).domain([l=0,h=1]),t.ticks&&(c=t.ticks(+a||15),l!==c[0]&&c.unshift(l),h!==n.peek(c)&&c.push(h)),c.forEach((n=>u.stop(f(n),t(n)))),u}function Ye(t,n,e){const r=P(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}function We(t){let n=null;return function(e){return e?o.pathRender(e,n=n||o.pathParse(t)):t}}const Ze=t=>t.data;function Je(t,n){const e=c.call(n,t);return e.root&&e.root.lookup||{}}function Ke(t,n,e){const r=Je(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(Ze):void 0}function Qe(t,n){const e=Je(t,this)[n];return e?e.ancestors().map(Ze):void 0}const tr=()=>"undefined"!=typeof window&&window||null;function nr(){const t=tr();return t?t.screen:{}}function er(){const t=tr();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]}function rr(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]}function ir(t,e,r){if(!t)return[];const[i,a]=t,s=(new o.Bounds).set(i[0],i[1],a[0],a[1]),u=r||this.context.dataflow.scenegraph().root;return o.intersect(u,s,function(t){let e=null;if(t){const r=n.array(t.marktype),i=n.array(t.markname);e=t=>(!r.length||r.some((n=>t.marktype===n)))&&(!i.length||i.some((n=>t.name===n)))}return e}(e))}const or={random:()=>s.random(),cumulativeNormal:s.cumulativeNormal,cumulativeLogNormal:s.cumulativeLogNormal,cumulativeUniform:s.cumulativeUniform,densityNormal:s.densityNormal,densityLogNormal:s.densityLogNormal,densityUniform:s.densityUniform,quantileNormal:s.quantileNormal,quantileLogNormal:s.quantileLogNormal,quantileUniform:s.quantileUniform,sampleNormal:s.sampleNormal,sampleLogNormal:s.sampleLogNormal,sampleUniform:s.sampleUniform,isArray:n.isArray,isBoolean:n.isBoolean,isDate:n.isDate,isDefined:t=>void 0!==t,isNumber:n.isNumber,isObject:n.isObject,isRegExp:n.isRegExp,isString:n.isString,isTuple:i.isTuple,isValid:t=>null!=t&&t==t,toBoolean:n.toBoolean,toDate:t=>n.toDate(t),toNumber:n.toNumber,toString:n.toString,indexof:Oe,join:Le,lastindexof:Ie,replace:ze,reverse:De,slice:Te,flush:n.flush,lerp:n.lerp,merge:Se,pad:n.pad,peek:n.peek,pluck:_e,span:n.span,inrange:n.inrange,truncate:n.truncate,rgb:jn,lab:he,hcl:ye,hsl:Zn,luminance:xe,contrast:Ne,sequence:function(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o},format:d,utcFormat:m,utcParse:v,utcOffset:u.utcOffset,utcSequence:u.utcSequence,timeFormat:p,timeParse:y,timeOffset:u.timeOffset,timeSequence:u.timeSequence,timeUnitSpecifier:u.timeUnitSpecifier,monthFormat:x,monthAbbrevFormat:N,dayFormat:S,dayAbbrevFormat:$,quarter:n.quarter,utcquarter:n.utcquarter,week:u.week,utcweek:u.utcweek,dayofyear:u.dayofyear,utcdayofyear:u.utcdayofyear,warn:mn,info:yn,debug:vn,extent:t=>n.extent(t),inScope:dn,intersect:ir,clampRange:n.clampRange,pinchDistance:qe,pinchAngle:Ae,screen:nr,containerSize:rr,windowSize:er,bandspace:Ve,setdata:h,pathShape:We,panLinear:n.panLinear,panLog:n.panLog,panPow:n.panPow,panSymlog:n.panSymlog,zoomLinear:n.zoomLinear,zoomLog:n.zoomLog,zoomPow:n.zoomPow,zoomSymlog:n.zoomSymlog,encode:f,modify:Me,lassoAppend:function(t,e,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5;const o=(t=n.array(t))[t.length-1];return void 0===o||Math.hypot(o[0]-e,o[1]-r)>i?[...t,[e,r]]:t},lassoPath:function(t){return n.array(t).reduce(((n,e,r)=>{let[i,o]=e;return n+(0==r?`M ${i},${o} `:r===t.length-1?" Z":`L ${i},${o} `)}),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:a}=e,s=(new o.Bounds).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<s.x1&&(s.x1=t),t>s.x2&&(s.x2=t),e<s.y1&&(s.y1=e),e>s.y2&&(s.y2=e);return s.translate(r,i),ir([[s.x1,s.y1],[s.x2,s.y2]],t,a).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,s]=e[o],[u,c]=e[i];c>n!=s>n&&t<(a-u)*(n-c)/(s-c)+u&&r++}return 1&r}(t.x,t.y,n)))}},ar=["view","item","group","xy","x","y"],sr="this.",ur={},cr={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${n.stringValue("$"+t)}]`,functions:function(t){const r=e.functions(t);ar.forEach((t=>r[t]="event.vega."+t));for(const t in or)r[t]=sr+t;return n.extend(r,_(t,or,ur)),r},constants:e.constants,visitors:ur},lr=e.codegenExpression(cr);function hr(t,n,e){return 1===arguments.length?or[t]:(or[t]=n,e&&(ur[t]=e),lr&&(lr.functions[t]=sr+t),this)}hr("bandwidth",je,q),hr("copy",He,q),hr("domain",Be,q),hr("range",Ge,q),hr("invert",Ue,q),hr("scale",Ce,q),hr("gradient",Xe,q),hr("geoArea",ln,q),hr("geoBounds",hn,q),hr("geoCentroid",fn,q),hr("geoShape",Ye,q),hr("geoScale",gn,q),hr("indata",l,M),hr("data",c,E),hr("treePath",Ke,E),hr("treeAncestors",Qe,E),hr("vlSelectionTest",a.selectionTest,a.selectionVisitor),hr("vlSelectionIdTest",a.selectionIdTest,a.selectionVisitor),hr("vlSelectionResolve",a.selectionResolve,a.selectionVisitor),hr("vlSelectionTuples",a.selectionTuples),t.DataPrefix=":",t.IndexPrefix="@",t.ScalePrefix=k,t.SignalPrefix="$",t.bandspace=Ve,t.bandwidth=je,t.codeGenerator=lr,t.codegenParams=cr,t.containerSize=rr,t.contrast=Ne,t.copy=He,t.data=c,t.dataVisitor=E,t.dayAbbrevFormat=$,t.dayFormat=S,t.debug=vn,t.domain=Be,t.encode=f,t.expressionFunction=hr,t.format=d,t.functionContext=or,t.geoArea=ln,t.geoBounds=hn,t.geoCentroid=fn,t.geoScale=gn,t.geoShape=Ye,t.inScope=dn,t.indata=l,t.indataVisitor=M,t.indexof=Oe,t.info=yn,t.invert=Ue,t.join=Le,t.lastindexof=Ie,t.luminance=xe,t.merge=Se,t.modify=Me,t.monthAbbrevFormat=N,t.monthFormat=x,t.parseExpression=function(t,r){const i={};let o;try{t=n.isString(t)?t:n.stringValue(t)+"",o=e.parseExpression(t)}catch(e){n.error("Expression parse error: "+t)}o.visit((t=>{if(t.type!==e.CallExpression)return;const n=t.callee.name,o=cr.visitors[n];o&&o(n,t.arguments,r,i)}));const a=lr(o);return a.globals.forEach((t=>{const e="$"+t;!n.hasOwnProperty(i,e)&&r.getSignal(t)&&(i[e]=r.signalRef(t))})),{$expr:n.extend({code:a.code},r.options.ast?{ast:o}:null),$fields:a.fields,$params:i}},t.pathShape=We,t.pinchAngle=Ae,t.pinchDistance=qe,t.pluck=_e,t.range=Ge,t.replace=ze,t.reverse=De,t.scale=Ce,t.scaleGradient=Xe,t.scaleVisitor=q,t.screen=nr,t.setdata=h,t.slice=Te,t.timeFormat=p,t.timeParse=y,t.treeAncestors=Qe,t.treePath=Ke,t.utcFormat=m,t.utcParse=v,t.warn=mn,t.windowSize=er})); | ||
//# sourceMappingURL=vega-functions.min.js.map |
@@ -166,2 +166,6 @@ import { truthy, error, hasOwnProperty, isFunction, isString, stringValue, extend, isArray, isObject, field, peek, identity, array as array$1, isBoolean, isDate, isNumber, isRegExp, toBoolean, toDate, toNumber, toString, flush, lerp, pad, span, inrange, truncate, quarter, utcquarter, extent, clampRange, panLinear, panLog, panPow, panSymlog, zoomLinear, zoomLog, zoomPow, zoomSymlog } from 'vega-util'; | ||
const geoCentroid = geoMethod('centroid', geoCentroid$1); | ||
function geoScale(projection, group) { | ||
const p = getScale(projection, (group || this).context); | ||
return p && p.scale(); | ||
} | ||
@@ -724,2 +728,3 @@ function inScope (item) { | ||
expressionFunction('geoShape', geoShape, scaleVisitor); | ||
expressionFunction('geoScale', geoScale, scaleVisitor); | ||
expressionFunction('indata', indata, indataVisitor); | ||
@@ -779,2 +784,2 @@ expressionFunction('data', data, dataVisitor); | ||
export { DataPrefix, IndexPrefix, ScalePrefix, SignalPrefix, bandspace, bandwidth, codeGenerator, codegenParams, containerSize, contrast, copy, data, dataVisitor, dayAbbrevFormat, dayFormat, debug, domain, encode, expressionFunction, format, functionContext, geoArea, geoBounds, geoCentroid, geoShape, inScope, indata, indataVisitor, indexof, info, invert, join, lastindexof, luminance, merge, modify, monthAbbrevFormat, monthFormat, parser as parseExpression, pathShape, pinchAngle, pinchDistance, pluck, range, replace, reverse, scale, scaleGradient, scaleVisitor, screen, setdata, slice, timeFormat, timeParse, treeAncestors, treePath, utcFormat, utcParse, warn, windowSize }; | ||
export { DataPrefix, IndexPrefix, ScalePrefix, SignalPrefix, bandspace, bandwidth, codeGenerator, codegenParams, containerSize, contrast, copy, data, dataVisitor, dayAbbrevFormat, dayFormat, debug, domain, encode, expressionFunction, format, functionContext, geoArea, geoBounds, geoCentroid, geoScale, geoShape, inScope, indata, indataVisitor, indexof, info, invert, join, lastindexof, luminance, merge, modify, monthAbbrevFormat, monthFormat, parser as parseExpression, pathShape, pinchAngle, pinchDistance, pluck, range, replace, reverse, scale, scaleGradient, scaleVisitor, screen, setdata, slice, timeFormat, timeParse, treeAncestors, treePath, utcFormat, utcParse, warn, windowSize }; |
@@ -26,3 +26,4 @@ export { | ||
geoBounds, | ||
geoCentroid | ||
geoCentroid, | ||
geoScale | ||
} from './src/functions/geo'; | ||
@@ -29,0 +30,0 @@ |
{ | ||
"name": "vega-functions", | ||
"version": "5.13.2", | ||
"version": "5.14.0", | ||
"description": "Custom functions for the Vega expression language.", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"vega-scenegraph": "^4.10.2", | ||
"vega-selections": "^5.4.1", | ||
"vega-selections": "^5.4.2", | ||
"vega-statistics": "^1.8.1", | ||
@@ -40,3 +40,3 @@ "vega-time": "^2.1.1", | ||
}, | ||
"gitHead": "a7a312ebe9db675ae03bd354f193ed34a976d21f" | ||
"gitHead": "3580b28ec9b89d0a042707c168080931e7745fb3" | ||
} |
@@ -105,2 +105,3 @@ # vega-functions | ||
- [geoCentroid](https://vega.github.io/vega/docs/expressions/#geoCentroid) | ||
- [geoScale](https://vega.github.io/vega/docs/expressions/#geoScale) | ||
@@ -107,0 +108,0 @@ **Shape Functions** |
@@ -121,3 +121,4 @@ import { | ||
geoBounds, | ||
geoCentroid | ||
geoCentroid, | ||
geoScale | ||
} from './functions/geo'; | ||
@@ -362,2 +363,3 @@ | ||
expressionFunction('geoShape', geoShape, scaleVisitor); | ||
expressionFunction('geoScale', geoScale, scaleVisitor); | ||
expressionFunction('indata', indata, indataVisitor); | ||
@@ -364,0 +366,0 @@ expressionFunction('data', data, dataVisitor); |
@@ -24,1 +24,6 @@ import {getScale} from '../scales'; | ||
export const geoCentroid = geoMethod('centroid', centroid); | ||
export function geoScale(projection, group) { | ||
const p = getScale(projection, (group || this).context); | ||
return p && p.scale(); | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256141
3594
139
Updatedvega-selections@^5.4.2