All Downloads are FREE. Search and download functionalities are using the official Maven repository.

[email protected] Maven / Gradle / Ivy

There is a newer version: 3.0.0-beta-1
Show newest version
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={})}(this,(function(t){"use strict";var e="5.19.1";function n(t,e,n){return t.fields=e||[],t.fname=n,t}function r(t){return null==t?null:t.fname}function i(t){return null==t?null:t.fields}function o(t){return 1===t.length?a(t[0]):u(t)}const a=t=>function(e){return e[t]},u=t=>{const e=t.length;return function(n){for(let r=0;rr&&c(),u=r=i+1):"]"===o&&(u||s("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&s("Access path missing closing bracket: "+t),a&&s("Access path missing closing quote: "+t),i>r&&(i++,c()),e}function c(t,e,r){const i=l(t);return t=1===i.length?i[0]:t,n((r&&r.get||o)(i),[t],e||t)}const f=c("id"),h=n((t=>t),[],"identity"),d=n((()=>0),[],"zero"),p=n((()=>1),[],"one"),g=n((()=>!0),[],"true"),m=n((()=>!1),[],"false");function y(t,e,n){const r=[e].concat([].slice.call(n));console[t].apply(console,r)}function v(t,e){let n=t||0;return{level(t){return arguments.length?(n=+t,this):n},error(){return n>=1&&y(e||"error","ERROR",arguments),this},warn(){return n>=2&&y(e||"warn","WARN",arguments),this},info(){return n>=3&&y(e||"log","INFO",arguments),this},debug(){return n>=4&&y(e||"log","DEBUG",arguments),this}}}var _=Array.isArray;function x(t){return t===Object(t)}const b=t=>"__proto__"!==t;function w(...t){return t.reduce(((t,e)=>{for(const n in e)if("signals"===n)t.signals=A(t.signals,e.signals);else{const r="legend"===n?{layout:1}:"style"===n||null;k(t,n,e[n],r)}return t}),{})}function k(t,e,n,r){if(!b(e))return;let i,o;if(x(n)&&!_(n))for(i in o=x(t[e])?t[e]:t[e]={},n)r&&(!0===r||r[i])?k(o,i,n[i]):b(i)&&(o[i]=n[i]);else t[e]=n}function A(t,e){if(null==t)return e;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function M(t){return t[t.length-1]}function E(t){return null==t||""===t?null:+t}const D=t=>e=>t*Math.exp(e),C=t=>e=>Math.log(t*e),F=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),S=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,B=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t);function T(t,e,n,r){const i=n(t[0]),o=n(M(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function z(t,e){return T(t,e,E,h)}function N(t,e){var n=Math.sign(t[0]);return T(t,e,C(n),D(n))}function O(t,e,n){return T(t,e,B(n),B(1/n))}function R(t,e,n){return T(t,e,F(n),S(n))}function L(t,e,n,r,i){const o=r(t[0]),a=r(M(t)),u=null!=e?r(e):(o+a)/2;return[i(u+(o-u)*n),i(u+(a-u)*n)]}function U(t,e,n){return L(t,e,n,E,h)}function q(t,e,n){const r=Math.sign(t[0]);return L(t,e,n,C(r),D(r))}function P(t,e,n,r){return L(t,e,n,B(r),B(1/r))}function j(t,e,n,r){return L(t,e,n,F(r),S(r))}function I(t){return 1+~~(new Date(t).getMonth()/3)}function $(t){return 1+~~(new Date(t).getUTCMonth()/3)}function W(t){return null!=t?_(t)?t:[t]:[]}function H(t,e,n){let r,i=t[0],o=t[1];return o=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function Y(t){return"function"==typeof t}function V(t,e,r){r=r||{},e=W(e)||[];const o=[],a=[],u={},s=r.comparator||X;return W(t).forEach(((t,n)=>{null!=t&&(o.push("descending"===e[n]?-1:1),a.push(t=Y(t)?t:c(t,null,r)),(i(t)||[]).forEach((t=>u[t]=1)))})),0===a.length?null:n(s(a,o),Object.keys(u))}const G=(t,e)=>(te||null==e)&&null!=t?1:(e=e instanceof Date?+e:e,(t=t instanceof Date?+t:t)!==t&&e==e?-1:e!=e&&t==t?1:0),X=(t,e)=>1===t.length?J(t[0],e[0]):Z(t,e,t.length),J=(t,e)=>function(n,r){return G(t(n),t(r))*e},Z=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++ut}function K(t,e){let n;return r=>{n&&clearTimeout(n),n=setTimeout((()=>(e(r),n=null)),t)}}function tt(t){for(let e,n,r=1,i=arguments.length;ro&&(o=r))}else{for(r=e(t[a]);ao&&(o=r))}return[i,o]}function nt(t,e){const n=t.length;let r,i,o,a,u,s=-1;if(null==e){for(;++s=i){r=o=i;break}if(s===n)return[-1,-1];for(a=u=s;++si&&(r=i,a=s),o=i){r=o=i;break}if(s===n)return[-1,-1];for(a=u=s;++si&&(r=i,a=s),or(t)?n[t]:void 0,set(t,e){return r(t)||(++i.size,n[t]===ot&&--i.empty),n[t]=e,this},delete(t){return r(t)&&(--i.size,++i.empty,n[t]=ot),this},clear(){i.size=i.empty=0,i.object=n={}},test(t){return arguments.length?(e=t,i):e},clean(){const t={};let r=0;for(const i in n){const o=n[i];o===ot||e&&e(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=n=t}};return t&&Object.keys(t).forEach((e=>{i.set(e,t[e])})),i}function ut(t,e,n,r,i,o){if(!n&&0!==n)return o;const a=+n;let u,s=t[0],l=M(t);la&&(i=o,o=a,a=i),r=void 0===r||r,((n=void 0===n||n)?o<=t:ot.replace(/\\(.)/g,"$1"))):W(t));const i=t&&t.length,a=r&&r.get||o,u=t=>a(e?[t]:l(t));let s;if(i)if(1===i){const e=u(t[0]);s=function(t){return""+e(t)}}else{const e=t.map(u);s=function(t){let n=""+e[0](t),r=0;for(;++r{e={},n={},r=0},o=(i,o)=>(++r>t&&(n=e,e={},r=1),e[i]=o);return i(),{clear:i,has:t=>it(e,t)||it(n,t),get:t=>it(e,t)?e[t]:it(n,t)?o(t,n[t]):void 0,set:(t,n)=>it(e,t)?e[t]=n:o(t,n)}}function _t(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=r||new e.constructor(i+o);let u=0,s=0,l=0;for(;u0?n[s++]:e[u++];for(;u=0;)n+=t;return n}function bt(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?xt(i,a)+o:"center"===r?xt(i,~~(a/2))+o+xt(i,Math.ceil(a/2)):o+xt(i,a)}function wt(t){return t&&M(t)-t[0]||0}function kt(t){return _(t)?"["+t.map(kt)+"]":x(t)||gt(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function At(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}const Mt=t=>dt(t)||ft(t)?t:Date.parse(t);function Et(t,e){return e=e||Mt,null==t||""===t?null:e(t)}function Dt(t){return null==t||""===t?null:t+""}function Ct(t){const e={},n=t.length;for(let r=0;rnew Promise(((n,r)=>{t.readFile(e,((t,e)=>{t?r(t):n(e)}))})):Ut}async function Ut(){s("No file system access.")}function qt(t){return t?async function(e,n){const r=tt({},this.options.http,n),i=n&&n.response,o=await t(e,r);return o.ok?Y(o[i])?o[i]():o.text():s(o.status+""+o.statusText)}:Pt}async function Pt(){s("No HTTP fetch method available.")}const jt=t=>!(Number.isNaN(+t)||t instanceof Date),It={boolean:At,integer:E,number:E,date:Et,string:Dt,unknown:h},$t=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>jt(t)&&Number.isInteger(+t),jt,t=>!Number.isNaN(Date.parse(t))],Wt=["boolean","integer","number","date"];function Ht(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=$t.length,i=$t.map(((t,e)=>e+1));for(let a,u,s=0,l=0;s0===t?e:t),0)-1]}function Yt(t,e){return e.reduce(((e,n)=>(e[n]=Ht(t,n),e)),{})}var Vt={},Gt={};function Xt(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Jt(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Zt(t,e){var n=t+"",r=n.length;return r9999?"+"+Zt(t,6):Zt(t,4)}(t.getUTCFullYear())+"-"+Zt(t.getUTCMonth()+1,2)+"-"+Zt(t.getUTCDate(),2)+(i?"T"+Zt(e,2)+":"+Zt(n,2)+":"+Zt(r,2)+"."+Zt(i,3)+"Z":r?"T"+Zt(e,2)+":"+Zt(n,2)+":"+Zt(r,2)+"Z":n||e?"T"+Zt(e,2)+":"+Zt(n,2)+"Z":"")}function Kt(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,u=0,s=o<=0,l=!1;function c(){if(s)return Gt;if(l)return l=!1,Vt;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++=o?s=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a1)r=ce(t,e,n);else for(i=0,r=new Array(o=t.arcs.length);it!==e,exterior:(t,e)=>t===e};function he(t,e){let n,r,i,o;return t=ne(t,e),e&&e.feature?(n=ie,i=e.feature):e&&e.mesh?(n=se,i=e.mesh,o=fe[e.filter]):s("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,o):s("Invalid TopoJSON object: "+i),r&&r.features||[r]}he.responseType="json";const de={dsv:ee,csv:te(","),tsv:te("\t"),json:ne,topojson:he};function pe(t,e){return arguments.length>1?(de[t]=e,this):it(de,t)?de[t]:null}function ge(t){const e=pe(t);return e&&e.responseType||"text"}function me(t,e){return te?1:t>=e?0:NaN}function ye(t){let e=t,n=t;function r(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;n(t[o],e)<0?r=o+1:i=o}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=function(t){return(e,n)=>me(t(e),n)}(t)),{left:r,center:function(t,n,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,n,i,o-1);return a>i&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}function ve(t){return null===t?NaN:+t}const _e=ye(me),xe=_e.right,be=_e.left;ye(ve).center;class we{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}var ke=Math.sqrt(50),Ae=Math.sqrt(10),Me=Math.sqrt(2);function Ee(t,e,n){var r,i,o,a,u=-1;if(n=+n,(t=+t)===(e=+e)&&n>0)return[t];if((r=e0)for(t=Math.ceil(t/a),e=Math.floor(e/a),o=new Array(i=Math.ceil(e-t+1));++u=0?(o>=ke?10:o>=Ae?5:o>=Me?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=ke?10:o>=Ae?5:o>=Me?2:1)}function Ce(t,e,n){var r=Math.abs(e-t)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=ke?i*=10:o>=Ae?i*=5:o>=Me&&(i*=2),e=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n=i)&&(n=i)}return n}function Se(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function Be(t,e,n=0,r=t.length-1,i=me){for(;r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,u=Math.log(o),s=.5*Math.exp(2*u/3),l=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);Be(t,e,Math.max(n,Math.floor(e-a*s/o+l)),Math.min(r,Math.floor(e+(o-a)*s/o+l)),i)}const o=t[e];let a=n,u=r;for(Te(t,n,e),i(t[r],o)>0&&Te(t,n,r);a0;)--u}0===i(t[n],o)?Te(t,n,u):(++u,Te(t,u,r)),u<=e&&(n=u+1),e<=u&&(r=u-1)}return t}function Te(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ze(t,e,n){if(r=(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length){if((e=+e)<=0||r<2)return Se(t);if(e>=1)return Fe(t);var r,i=(r-1)*e,o=Math.floor(i),a=Fe(Be(t,o).subarray(0,o+1));return a+(Se(t.subarray(o+1))-a)*(i-o)}}function Ne(t,e,n=ve){if(r=t.length){if((e=+e)<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function Oe(t,e){return ze(t,.5,e)}function Re(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function Le(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Pe(t){return(t=qe(Math.abs(t)))?t[1]:NaN}var je,Ie=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $e(t){if(!(e=Ie.exec(t)))throw new Error("invalid format: "+t);var e;return new We({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function We(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function He(t,e){var n=qe(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}$e.prototype=We.prototype,We.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Ye={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>He(100*t,e),r:He,s:function(t,e){var n=qe(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(je=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+qe(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ve(t){return t}var Ge,Xe,Je,Ze=Array.prototype.map,Qe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ke(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ve:(e=Ze.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=e[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ve:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Ze.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t){var e=(t=$e(t)).fill,n=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,y=t.trim,v=t.type;"n"===v?(g=!0,v="g"):Ye[v]||(void 0===m&&(m=12),y=!0,v="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",x="$"===h?o:/[%p]/.test(v)?s:"",b=Ye[v],w=/[defgprs%]/.test(v);function k(t){var i,o,s,h=_,k=x;if("c"===v)k=b(t)+k,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:b(Math.abs(t),m),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==f&&(A=!1),h=(A?"("===f?f:l:"-"===f||"("===f?"":f)+h,k=("s"===v?Qe[8+je/3]:"")+k+(A&&"("===f?")":""),w)for(i=-1,o=t.length;++i(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+k.length,E=M>1)+h+t+k+E.slice(M);break;default:t=E+h+t+k}return u(t)}return m=void 0===m?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,e){var n=f(((t=$e(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Pe(e)/3))),i=Math.pow(10,-r),o=Qe[8+r/3];return function(t){return n(i*t)+o}}}}function tn(t){return Math.max(0,-Pe(Math.abs(t)))}function en(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Pe(e)/3)))-Pe(Math.abs(t)))}function nn(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Pe(e)-Pe(t))+1}!function(t){Ge=Ke(t),Xe=Ge.format,Je=Ge.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});var rn=new Date,on=new Date;function an(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e0))return u;do{u.push(a=new Date(+n)),e(n,o),t(n)}while(a=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return rn.setTime(+e),on.setTime(+r),t(rn),t(on),Math.floor(n(rn,on))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var un=an((function(){}),(function(t,e){t.setTime(+t+e)}),(function(t,e){return e-t}));un.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?an((function(e){e.setTime(Math.floor(e/t)*t)}),(function(e,n){e.setTime(+e+n*t)}),(function(e,n){return(n-e)/t})):un:null};var sn=1e3,ln=6e4,cn=36e5,fn=864e5,hn=6048e5,dn=an((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,e){t.setTime(+t+e*sn)}),(function(t,e){return(e-t)/sn}),(function(t){return t.getUTCSeconds()})),pn=an((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*sn)}),(function(t,e){t.setTime(+t+e*ln)}),(function(t,e){return(e-t)/ln}),(function(t){return t.getMinutes()})),gn=an((function(t){t.setTime(t-t.getMilliseconds()-t.getSeconds()*sn-t.getMinutes()*ln)}),(function(t,e){t.setTime(+t+e*cn)}),(function(t,e){return(e-t)/cn}),(function(t){return t.getHours()})),mn=an((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ln)/fn),(t=>t.getDate()-1));function yn(t){return an((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ln)/hn}))}var vn=yn(0),_n=yn(1),xn=(yn(2),yn(3),yn(4)),bn=(yn(5),yn(6),an((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,e){t.setMonth(t.getMonth()+e)}),(function(t,e){return e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),wn=an((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));wn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var kn=an((function(t){t.setUTCSeconds(0,0)}),(function(t,e){t.setTime(+t+e*ln)}),(function(t,e){return(e-t)/ln}),(function(t){return t.getUTCMinutes()})),An=an((function(t){t.setUTCMinutes(0,0,0)}),(function(t,e){t.setTime(+t+e*cn)}),(function(t,e){return(e-t)/cn}),(function(t){return t.getUTCHours()})),Mn=an((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/fn}),(function(t){return t.getUTCDate()-1}));function En(t){return an((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/hn}))}var Dn=En(0),Cn=En(1),Fn=(En(2),En(3),En(4)),Sn=(En(5),En(6),an((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCMonth(t.getUTCMonth()+e)}),(function(t,e){return e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),Bn=an((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};const Tn="year",zn="quarter",Nn="month",On="week",Rn="date",Ln="day",Un="dayofyear",qn="hours",Pn="minutes",jn="seconds",In="milliseconds",$n=[Tn,zn,Nn,On,Rn,Ln,Un,qn,Pn,jn,In],Wn=$n.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function Hn(t){const e=W(t).slice(),n={};e.length||s("Missing time unit."),e.forEach((t=>{it(Wn,t)?n[t]=1:s("Invalid time unit: ".concat(t,"."))}));return(n.week||n.day?1:0)+(n.quarter||n.month||n.date?1:0)+(n.dayofyear?1:0)>1&&s("Incompatible time units: ".concat(t)),e.sort(((t,e)=>Wn[t]-Wn[e])),e}const Yn={[Tn]:"%Y ",[zn]:"Q%q ",[Nn]:"%b ",[Rn]:"%d ",[On]:"W%U ",[Ln]:"%a ",[Un]:"%j ",[qn]:"%H:00",[Pn]:"00:%M",[jn]:":%S",[In]:".%L",["".concat(Tn,"-").concat(Nn)]:"%Y-%m ",["".concat(Tn,"-").concat(Nn,"-").concat(Rn)]:"%Y-%m-%d ",["".concat(qn,"-").concat(Pn)]:"%H:%M"};function Vn(t,e){const n=tt({},Yn,e),r=Hn(t),i=r.length;let o,a,u="",s=0;for(s=0;ss;--o)if(a=r.slice(s,o).join("-"),null!=n[a]){u+=n[a],s=o;break}return u.trim()}const Gn=new Date;function Xn(t){return Gn.setFullYear(t),Gn.setMonth(0),Gn.setDate(1),Gn.setHours(0,0,0,0),Gn}function Jn(t){return Qn(new Date(t))}function Zn(t){return Kn(new Date(t))}function Qn(t){return mn.count(Xn(t.getFullYear())-1,t)}function Kn(t){return vn.count(Xn(t.getFullYear())-1,t)}function tr(t){return Xn(t).getDay()}function er(t,e,n,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,e,n,r,i,o,a);return u.setFullYear(t),u}return new Date(t,e,n,r,i,o,a)}function nr(t){return ir(new Date(t))}function rr(t){return or(new Date(t))}function ir(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Mn.count(e-1,t)}function or(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return Dn.count(e-1,t)}function ar(t){return Gn.setTime(Date.UTC(t,0,1)),Gn.getUTCDay()}function ur(t,e,n,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,e,n,r,i,o,a));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(t,e,n,r,i,o,a))}function sr(t,e,n,r,i){const o=e||1,a=M(t),u=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===a&&o,e),s=new Date,l=Ct(t),c=l.year?u(Tn):Q(2012),f=l.month?u(Nn):l.quarter?u(zn):d,h=l.week&&l.day?u(Ln,1,On+Ln):l.week?u(On,1):l.day?u(Ln,1):l.date?u(Rn,1):l.dayofyear?u(Un,1):p,g=l.hours?u(qn):d,m=l.minutes?u(Pn):d,y=l.seconds?u(jn):d,v=l.milliseconds?u(In):d;return function(t){s.setTime(+t);const e=c(s);return i(e,f(s),h(s,e),g(s),m(s),y(s),v(s))}}function lr(t,e,n){return e+7*t-(n+6)%7}const cr={[Tn]:t=>t.getFullYear(),[zn]:t=>Math.floor(t.getMonth()/3),[Nn]:t=>t.getMonth(),[Rn]:t=>t.getDate(),[qn]:t=>t.getHours(),[Pn]:t=>t.getMinutes(),[jn]:t=>t.getSeconds(),[In]:t=>t.getMilliseconds(),[Un]:t=>Qn(t),[On]:t=>Kn(t),[On+Ln]:(t,e)=>lr(Kn(t),t.getDay(),tr(e)),[Ln]:(t,e)=>lr(1,t.getDay(),tr(e))},fr={[zn]:t=>3*t,[On]:(t,e)=>lr(t,0,tr(e))};function hr(t,e){return sr(t,e||1,cr,fr,er)}const dr={[Tn]:t=>t.getUTCFullYear(),[zn]:t=>Math.floor(t.getUTCMonth()/3),[Nn]:t=>t.getUTCMonth(),[Rn]:t=>t.getUTCDate(),[qn]:t=>t.getUTCHours(),[Pn]:t=>t.getUTCMinutes(),[jn]:t=>t.getUTCSeconds(),[In]:t=>t.getUTCMilliseconds(),[Un]:t=>ir(t),[On]:t=>or(t),[Ln]:(t,e)=>lr(1,t.getUTCDay(),ar(e)),[On+Ln]:(t,e)=>lr(or(t),t.getUTCDay(),ar(e))},pr={[zn]:t=>3*t,[On]:(t,e)=>lr(t,0,ar(e))};function gr(t,e){return sr(t,e||1,dr,pr,ur)}const mr={[Tn]:wn,[zn]:bn.every(3),[Nn]:bn,[On]:vn,[Rn]:mn,[Ln]:mn,[Un]:mn,[qn]:gn,[Pn]:pn,[jn]:dn,[In]:un},yr={[Tn]:Bn,[zn]:Sn.every(3),[Nn]:Sn,[On]:Dn,[Rn]:Mn,[Ln]:Mn,[Un]:Mn,[qn]:An,[Pn]:kn,[jn]:dn,[In]:un};function vr(t){return mr[t]}function _r(t){return yr[t]}function xr(t,e,n){return t?t.offset(e,n):void 0}function br(t,e,n){return xr(vr(t),e,n)}function wr(t,e,n){return xr(_r(t),e,n)}function kr(t,e,n,r){return t?t.range(e,n,r):void 0}function Ar(t,e,n,r){return kr(vr(t),e,n,r)}function Mr(t,e,n,r){return kr(_r(t),e,n,r)}const Er=1e3,Dr=6e4,Cr=36e5,Fr=864e5,Sr=2592e6,Br=31536e6,Tr=[Tn,Nn,Rn,qn,Pn,jn,In],zr=Tr.slice(0,-1),Nr=zr.slice(0,-1),Or=Nr.slice(0,-1),Rr=Or.slice(0,-1),Lr=[Tn,Nn],Ur=[Tn],qr=[[zr,1,Er],[zr,5,5e3],[zr,15,15e3],[zr,30,3e4],[Nr,1,Dr],[Nr,5,3e5],[Nr,15,9e5],[Nr,30,18e5],[Or,1,Cr],[Or,3,108e5],[Or,6,216e5],[Or,12,432e5],[Rr,1,Fr],[[Tn,On],1,6048e5],[Lr,1,Sr],[Lr,3,7776e6],[Ur,1,Br]];function Pr(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(wt(e))/n;let i,o,a=ye((t=>t[2])).right(qr,r);return a===qr.length?(i=Ur,o=Ce(e[0]/Br,e[1]/Br,n)):a?(a=qr[r/qr[a-1][2]=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:fo,s:ho,S:Ti,u:zi,U:Ni,V:Ri,w:Li,W:Ui,x:null,X:null,y:qi,Y:ji,Z:$i,"%":co},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Wi,e:Wi,f:Xi,g:ao,G:so,H:Hi,I:Yi,j:Vi,L:Gi,m:Ji,M:Zi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:fo,s:ho,S:Qi,u:Ki,U:to,V:no,w:ro,W:io,x:null,X:null,y:oo,Y:uo,Z:lo,"%":co},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:pi,e:pi,f:xi,g:ci,G:li,H:mi,I:mi,j:gi,L:_i,m:di,M:yi,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:hi,Q:wi,s:ki,S:vi,u:oi,U:ai,V:ui,w:ii,W:si,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:ci,Y:li,Z:fi,"%":bi};function w(t,e){return function(n){var r,i,o,a=[],u=-1,s=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++u53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Ir($r(o.y,0,1))).getUTCDay(),r=i>4||0===i?Cn.ceil(r):Cn(r),r=Mn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=jr($r(o.y,0,1))).getDay(),r=i>4||0===i?_n.ceil(r):_n(r),r=mn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Ir($r(o.y,0,1)).getUTCDay():jr($r(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Ir(o)):jr(o)}}function A(t,e,n,r){for(var i,o,a=0,u=e.length,s=n.length;a=s)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=b[i in Jr?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=k(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=k(t+="",!0);return e.toString=function(){return t},e}}}var Hr,Yr,Vr,Gr,Xr,Jr={"-":"",_:" ",0:"0"},Zr=/^\s*\d+/,Qr=/^%/,Kr=/[\\^$*+?|[\]().{}]/g;function ti(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[t.toLowerCase(),e])))}function ii(t,e,n){var r=Zr.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function oi(t,e,n){var r=Zr.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function ai(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function ui(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function si(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function li(t,e,n){var r=Zr.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function ci(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function fi(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function hi(t,e,n){var r=Zr.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function di(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function pi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function gi(t,e,n){var r=Zr.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function mi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function yi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function vi(t,e,n){var r=Zr.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function _i(t,e,n){var r=Zr.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function xi(t,e,n){var r=Zr.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function bi(t,e,n){var r=Qr.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function wi(t,e,n){var r=Zr.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function ki(t,e,n){var r=Zr.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ai(t,e){return ti(t.getDate(),e,2)}function Mi(t,e){return ti(t.getHours(),e,2)}function Ei(t,e){return ti(t.getHours()%12||12,e,2)}function Di(t,e){return ti(1+mn.count(wn(t),t),e,3)}function Ci(t,e){return ti(t.getMilliseconds(),e,3)}function Fi(t,e){return Ci(t,e)+"000"}function Si(t,e){return ti(t.getMonth()+1,e,2)}function Bi(t,e){return ti(t.getMinutes(),e,2)}function Ti(t,e){return ti(t.getSeconds(),e,2)}function zi(t){var e=t.getDay();return 0===e?7:e}function Ni(t,e){return ti(vn.count(wn(t)-1,t),e,2)}function Oi(t){var e=t.getDay();return e>=4||0===e?xn(t):xn.ceil(t)}function Ri(t,e){return t=Oi(t),ti(xn.count(wn(t),t)+(4===wn(t).getDay()),e,2)}function Li(t){return t.getDay()}function Ui(t,e){return ti(_n.count(wn(t)-1,t),e,2)}function qi(t,e){return ti(t.getFullYear()%100,e,2)}function Pi(t,e){return ti((t=Oi(t)).getFullYear()%100,e,2)}function ji(t,e){return ti(t.getFullYear()%1e4,e,4)}function Ii(t,e){var n=t.getDay();return ti((t=n>=4||0===n?xn(t):xn.ceil(t)).getFullYear()%1e4,e,4)}function $i(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ti(e/60|0,"0",2)+ti(e%60,"0",2)}function Wi(t,e){return ti(t.getUTCDate(),e,2)}function Hi(t,e){return ti(t.getUTCHours(),e,2)}function Yi(t,e){return ti(t.getUTCHours()%12||12,e,2)}function Vi(t,e){return ti(1+Mn.count(Bn(t),t),e,3)}function Gi(t,e){return ti(t.getUTCMilliseconds(),e,3)}function Xi(t,e){return Gi(t,e)+"000"}function Ji(t,e){return ti(t.getUTCMonth()+1,e,2)}function Zi(t,e){return ti(t.getUTCMinutes(),e,2)}function Qi(t,e){return ti(t.getUTCSeconds(),e,2)}function Ki(t){var e=t.getUTCDay();return 0===e?7:e}function to(t,e){return ti(Dn.count(Bn(t)-1,t),e,2)}function eo(t){var e=t.getUTCDay();return e>=4||0===e?Fn(t):Fn.ceil(t)}function no(t,e){return t=eo(t),ti(Fn.count(Bn(t),t)+(4===Bn(t).getUTCDay()),e,2)}function ro(t){return t.getUTCDay()}function io(t,e){return ti(Cn.count(Bn(t)-1,t),e,2)}function oo(t,e){return ti(t.getUTCFullYear()%100,e,2)}function ao(t,e){return ti((t=eo(t)).getUTCFullYear()%100,e,2)}function uo(t,e){return ti(t.getUTCFullYear()%1e4,e,4)}function so(t,e){var n=t.getUTCDay();return ti((t=n>=4||0===n?Fn(t):Fn.ceil(t)).getUTCFullYear()%1e4,e,4)}function lo(){return"+0000"}function co(){return"%"}function fo(t){return+t}function ho(t){return Math.floor(+t/1e3)}function po(t){const e={};return n=>e[n]||(e[n]=t(n))}function go(t){const e=po(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=$e(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),i=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(i);if(n<0)return e;let o=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const a=on;)if("0"!==e[o]){++o;break}return e.slice(0,o)+a}}return e(n);var r,i},formatSpan(t,r,i,o){o=$e(null==o?",f":o);const a=Ce(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=en(a,u))||(o.precision=s),n(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=nn(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=tn(a))||(o.precision=s-2*("%"===o.type))}return e(o)}}}let mo,yo;function vo(){return mo=go({format:Xe,formatPrefix:Je})}function _o(t){return go(Ke(t))}function xo(t){return arguments.length?mo=_o(t):mo}function bo(t,e,n){x(n=n||{})||s("Invalid time multi-format specifier: ".concat(n));const r=e(jn),i=e(Pn),o=e(qn),a=e(Rn),u=e(On),l=e(Nn),c=e(zn),f=e(Tn),h=t(n.milliseconds||".%L"),d=t(n.seconds||":%S"),p=t(n.minutes||"%I:%M"),g=t(n.hours||"%I %p"),m=t(n.date||n.day||"%a %d"),y=t(n.week||"%b %d"),v=t(n.month||"%B"),_=t(n.quarter||"%B"),b=t(n.year||"%Y");return t=>(r(t)gt(t)?e(t):bo(e,vr,t),utcFormat:t=>gt(t)?n(t):bo(n,_r,t),timeParse:po(t.parse),utcParse:po(t.utcParse)}}function ko(){return yo=wo({format:Yr,parse:Vr,utcFormat:Gr,utcParse:Xr})}function Ao(t){return wo(Wr(t))}function Mo(t){return arguments.length?yo=Ao(t):yo}!function(t){Hr=Wr(t),Yr=Hr.format,Vr=Hr.parse,Gr=Hr.utcFormat,Xr=Hr.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),vo(),ko();const Eo=(t,e)=>tt({},t,e);function Do(t,e){const n=t?_o(t):xo(),r=e?Ao(e):Mo();return Eo(n,r)}function Co(t,e){const n=arguments.length;return n&&2!==n&&s("defaultLocale expects either zero or two arguments."),n?Eo(xo(t),Mo(e)):Eo(xo(),Mo())}function Fo(t,e,n,r){const i=pe((e=e||{}).type||"json");return i||s("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=Mo();n=n||i.timeParse,r=r||i.utcParse;let o,a,u,s,l,c,f=t.columns||Object.keys(t[0]);"auto"===e&&(e=Yt(t,f));f=Object.keys(e);const h=f.map((t=>{const i=e[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:"))){o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===o[0]?r:n)(a)}if(!It[i])throw Error("Illegal format pattern: "+t+":"+i);return It[i]}));for(u=0,l=t.length,c=f.length;u({options:n||{},sanitize:Rt,load:Ot,fileAccess:!!e,file:Lt(e),http:qt(t)})}("undefined"!=typeof fetch&&fetch,null);function Bo(t){const e=t||h,n=[],r={};return n.add=t=>{const i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=t=>{const i=e(t);if(r[i]){r[i]=0;const e=n.indexOf(t);e>=0&&n.splice(e,1)}return n},n}async function To(t,e){try{await e(t)}catch(e){t.error(e)}}const zo=Symbol("vega_id");let No=1;function Oo(t){return!(!t||!Ro(t))}function Ro(t){return t[zo]}function Lo(t,e){return t[zo]=e,t}function Uo(t){const e=t===Object(t)?t:{data:t};return Ro(e)?e:Lo(e,No++)}function qo(t){return Po(t,Uo({}))}function Po(t,e){for(const n in t)e[n]=t[n];return e}function jo(t,e){return Lo(e,Ro(t))}function Io(t,e){return t?e?(n,r)=>t(n,r)||Ro(e(n))-Ro(e(r)):(e,n)=>t(e,n)||Ro(e)-Ro(n):null}function $o(t){return t&&t.constructor===Wo}function Wo(){const t=[],e=[],n=[],r=[],i=[];let o=null,a=!1;return{constructor:Wo,insert(e){const n=W(e),r=n.length;for(let e=0;e{p(t)&&(l[Ro(t)]=-1)}));for(f=0,h=t.length;f0&&(y(g,p,d.value),u.modifies(p));for(f=0,h=i.length;f{p(t)&&l[Ro(t)]>0&&y(t,d.field,d.value)})),u.modifies(d.field);if(a)u.mod=e.length||r.length?s.filter((t=>l[Ro(t)]>0)):s.slice();else for(m in c)u.mod.push(c[m]);return(o||null==o&&(e.length||r.length))&&u.clean(!0),u}}}const Ho="_:mod:_";function Yo(){Object.defineProperty(this,Ho,{writable:!0,value:{}})}Yo.prototype={set(t,e,n,r){const i=this,o=i[t],a=i[Ho];return null!=e&&e>=0?(o[e]!==n||r)&&(o[e]=n,a[e+":"+t]=-1,a[t]=-1):(o!==n||r)&&(i[t]=n,a[t]=_(n)?1+n.length:-1),i},modified(t,e){const n=this[Ho];if(!arguments.length){for(const t in n)if(n[t])return!0;return!1}if(_(t)){for(let e=0;e=0?e+1{a instanceof Xo?(a!==this&&(e&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:n})):r.set(t,n,a)};for(a in t)if(u=t[a],"pulse"===a)W(u).forEach((t=>{t instanceof Xo?t!==this&&(t.targets().add(this),o.push(t)):s("Pulse parameters must be operator instances.")})),this.source=u;else if(_(u))for(r.set(a,-1,Array(l=u.length)),c=0;c{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const e=Ko();return this.targets().add(Ko(null,null,K(t,(t=>{const n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},between(t,e){let n=!1;return t.targets().add(Ko(null,null,(()=>n=!0))),e.targets().add(Ko(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){}};const ta={skip:!0};function ea(t,e,n,r,i,o){const a=tt({},o,ta);let u,s;Y(n)||(n=Q(n)),void 0===r?u=e=>t.touch(n(e)):Y(r)?(s=new Xo(null,r,i,!1),u=e=>{s.evaluate(e);const r=n(e),i=s.value;$o(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=e=>t.update(n(e),r,a),e.apply(u)}function na(t,e,n,r,i,o){if(void 0===r)e.targets().add(n);else{const a=o||{},u=new Xo(null,function(t,e){return e=Y(e)?e:Q(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);u.modified(a.force),u.rank=e.rank,e.targets().add(u),n&&(u.skip(!0),u.value=n.value,u.targets().add(n),t.connect(n,[u]))}}const ra={};function ia(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function oa(t,e){const n=[];return St(t,e,(t=>n.push(t))),n}function aa(t,e){const n={};return t.visit(e,(t=>{n[Ro(t)]=1})),t=>n[Ro(t)]?null:t}function ua(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function sa(t,e,n,r){const i=this,o=n.length;let a=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(let t=0;te[t]=!0)):e[t]=!0,this},modified(t,e){const n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?_(t)?t.some((t=>n[t])):n[t]:!!n)},filter(t,e){const n=this;return 1&t&&(n.addF=ua(n.addF,e)),2&t&&(n.remF=ua(n.remF,e)),4&t&&(n.modF=ua(n.modF,e)),16&t&&(n.srcF=ua(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=oa(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=oa(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=oa(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,e){const n=this,r=e;if(16&t)return St(n.source,n.srcF,r),n;1&t&&St(n.add,n.addF,r),2&t&&St(n.rem,n.remF,r),4&t&&St(n.mod,n.modF,r);const i=n.source;if(8&t&&i){const t=n.add.length+n.mod.length;t===i.length||St(i,t?aa(n,5):n.srcF,r)}return n}},st(sa,ia,{fork(t){const e=new ia(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(t=>e.add.push(t))),t&e.REM&&this.visit(e.REM,(t=>e.rem.push(t))),t&e.MOD&&this.visit(e.MOD,(t=>e.mod.push(t)))),e},changed(t){return this.changes&t},modified(t){const e=this,n=e.fields;return n&&e.changes&e.MOD?_(t)?t.some((t=>n[t])):n[t]:0},filter(){s("MultiPulse does not support filtering.")},materialize(){s("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,i=r.length;let o=0;if(t&n.SOURCE)for(;oe=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),ha(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,i=t.length,o=t[e];let a,u=1+(e<<1);for(;u=0&&(u=a),t[e]=t[u],u=1+((e=u)<<1);t[e]=o,ha(t,r,e,n)}(e,0,t)):r=n,r}}}function ha(t,e,n,r){let i,o;const a=t[n];for(;n>e&&(o=n-1>>1,i=t[o],r(a,i)<0);)t[n]=i,n=o;return t[n]=a}function da(){this.logger(v()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Co();try{this._loader=So()}catch(t){}this._touched=Bo(f),this._input={},this._pulse=null,this._heap=fa(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function pa(t){return function(){return this._log[t].apply(this,arguments)}}function ga(t,e){Xo.call(this,t,null,e)}da.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:pa("error"),warn:pa("warn"),info:pa("info"),debug:pa("debug"),logLevel:pa("level"),cleanThreshold:1e4,add:function(t,e,n,r){let i,o=1;return t instanceof Xo?i=t:t&&t.prototype instanceof Xo?i=new t:Y(t)?i=new Xo(null,t):(o=0,i=new Xo(t,e)),this.rank(i),o&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let i=0;i=0;)e.push(n=r[i]),n===t&&s("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||ca);const r=new ia(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},touch:function(t,e){const n=e||ca;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||ca;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:Wo,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const n=this.locale();return Fo(t,e,n.timeParse,n.utcParse)},preload:async function(t,e,n){const r=this,i=r._pending||function(t){let e;const n=new Promise((t=>e=t));return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const o=await r.request(e,n);return r.pulse(t,r.changeset().remove(g).insert(o.data||[])),i.done(),o},request:async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:ge(e&&e.type)});try{r=n.parse(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},events:function(t,e,n,r){const i=this,o=Ko(n,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):W(t);const s=u.length;for(let t=0;tr._enqueue(t,!0))),r._touched=Bo(f);let a,u,s,l=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=ra),u!==ra&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++l):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug("Pulse ".concat(o,": ").concat(l," operators")),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,e)=>e.priority-t.priority));r._postrun=[];for(let e=0;er.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,e,n){return this._pulse?la(this):(this.evaluate(t,e,n),this)},runAsync:async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},runAfter:function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,e){const n=t.stampt.pulse)),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==ra&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)}},st(ga,Xo,{run(t){if(t.stampthis.pulse=t)):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const ma={};function ya(t){const e=va(t);return e&&e.Definition||null}function va(t){return t=t&&t.toLowerCase(),it(ma,t)?ma[t]:null}function*_a(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function xa(t,e,n){const r=Float64Array.from(_a(t,n));return r.sort(me),e.map((t=>Ne(r,t)))}function ba(t,e){return xa(t,[.25,.5,.75],e)}function wa(t,e){const n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let u of t)null!=(u=e(u,++a,t))&&(u=+u)>=u&&(n=u-i,i+=n/++r,o+=n*(u-i))}if(r>1)return o/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=ba(t,e),o=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function ka(t){const e=t.maxbins||20,n=t.base||10,r=Math.log(n),i=t.divide||[5,2];let o,a,u,s,l,c,f=t.extent[0],h=t.extent[1];const d=t.span||h-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(s=d/e,l=0,c=t.steps.length;le;)o*=n;for(l=0,c=i.length;l=u&&d/s<=e&&(o=s)}s=Math.log(o);const p=s>=0?0:1+~~(-s/r),g=Math.pow(n,-p-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(f/o+g)*o,f=ft);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,l=r(t[0]),c=l,f=l+e;for(;s=f){for(c=(l+c)/2;u>1);ia;)t[i--]=t[o]}o=a,a=r}return t}(o,e+e/4):o}t.random=Math.random;const Ea=Math.sqrt(2*Math.PI),Da=Math.SQRT2;let Ca=NaN;function Fa(e,n){e=e||0,n=null==n?1:n;let r,i,o=0,a=0;if(Ca==Ca)o=Ca,Ca=NaN;else{do{o=2*t.random()-1,a=2*t.random()-1,r=o*o+a*a}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),o*=i,Ca=a*i}return e+o*n}function Sa(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*Ea)}function Ba(t,e,n){const r=(t-(e=e||0))/(n=null==n?1:n),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let e;i<7.07106781186547?(e=.0352624965998911*i+.700383064443688,e=e*i+6.37396220353165,e=e*i+33.912866078383,e=e*i+112.079291497871,e=e*i+221.213596169931,e=e*i+220.206867912376,o=t*e,e=.0883883476483184*i+1.75566716318264,e=e*i+16.064177579207,e=e*i+86.7807322029461,e=e*i+296.564248779674,e=e*i+637.333633378831,e=e*i+793.826512519948,e=e*i+440.413735824752,o/=e):(e=i+.65,e=i+4/e,e=i+3/e,e=i+2/e,e=i+1/e,o=t/e/2.506628274631)}return r>0?1-o:o}function Ta(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*Da*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function za(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Fa(n,r),pdf:t=>Sa(t,n,r),cdf:t=>Ba(t,n,r),icdf:t=>Ta(t,n,r)};return i.mean(t).stdev(e)}function Na(e,n){const r=za();let i=0;const o={data(t){return arguments.length?(e=t,i=t?t.length:0,o.bandwidth(n)):e},bandwidth(t){return arguments.length?(!(n=t)&&e&&(n=wa(e)),o):n},sample:()=>e[~~(t.random()*i)]+n*r.sample(),pdf(t){let o=0,a=0;for(;aOa(n,r),pdf:t=>Ra(t,n,r),cdf:t=>La(t,n,r),icdf:t=>Ua(t,n,r)};return i.mean(t).stdev(e)}function Pa(e,n){let r,i=0;const o={weights(t){return arguments.length?(r=function(t){const e=[];let n,r=0;for(n=0;n=e&&t<=n?1/(n-e):0}function $a(t,e,n){return null==n&&(n=null==e?1:e,e=0),tn?1:(t-e)/(n-e)}function Wa(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Ha(t,e){let n,r;const i={min(t){return arguments.length?(n=t||0,i):n},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>ja(n,r),pdf:t=>Ia(t,n,r),cdf:t=>$a(t,n,r),icdf:t=>Wa(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Ya(t,e,n,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-o*t,o]}function Va(t,e,n,r){t=t.filter((t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,n)=>e(t)-e(n)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,l,c=0,f=0,h=0;for(l of t)o[c]=u=+e(l),a[c]=s=+n(l),++c,f+=(u-f)/c,h+=(s-h)/c;for(c=0;c=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function Xa(t,e,n,r,i){let o=0,a=0;return Ga(t,e,n,((t,e)=>{const n=e-i(t),u=e-r;o+=n*n,a+=u*u})),1-o/a}function Ja(t,e,n){let r=0,i=0,o=0,a=0,u=0;Ga(t,e,n,((t,e)=>{++u,r+=(t-r)/u,i+=(e-i)/u,o+=(t*e-o)/u,a+=(t*t-a)/u}));const s=Ya(r,i,o,a),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:Xa(t,e,n,i,l)}}function Za(t,e,n){let r=0,i=0,o=0,a=0,u=0;Ga(t,e,n,((t,e)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(e-i)/u,o+=(t*e-o)/u,a+=(t*t-a)/u}));const s=Ya(r,i,o,a),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:Xa(t,e,n,i,l)}}function Qa(t,e,n){const[r,i,o,a]=Va(t,e,n);let u,s,l,c=0,f=0,h=0,d=0,p=0;Ga(t,e,n,((t,e)=>{u=r[p++],s=Math.log(e),l=u*e,c+=(e*s-c)/p,f+=(l-f)/p,h+=(l*s-h)/p,d+=(u*l-d)/p}));const[g,m]=Ya(f/a,c/a,h/a,d/a),y=t=>Math.exp(g+m*(t-o));return{coef:[Math.exp(g-m*o),m],predict:y,rSquared:Xa(t,e,n,a,y)}}function Ka(t,e,n){let r=0,i=0,o=0,a=0,u=0,s=0;Ga(t,e,n,((t,e)=>{const n=Math.log(t),l=Math.log(e);++s,r+=(n-r)/s,i+=(l-i)/s,o+=(n*l-o)/s,a+=(n*n-a)/s,u+=(e-u)/s}));const l=Ya(r,i,o,a),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Xa(t,e,n,u,c)}}function tu(t,e,n){const[r,i,o,a]=Va(t,e,n),u=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s_*(t-=o)*t+x*t+b+a;return{coef:[b-x*o+_*o*o+a,x-2*_*o,_],predict:w,rSquared:Xa(t,e,n,a,w)}}function eu(t,e,n,r){if(1===r)return Ja(t,e,n);if(2===r)return tu(t,e,n);const[i,o,a,u]=Va(t,e,n),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;hMath.abs(t[r][a])&&(a=i);for(o=r;o=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(u=0,o=i+1;o{t-=a;let e=u+y[0]+y[1]*t+y[2]*t*t;for(h=3;h=0;--o)for(u=e[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(n,a)*s;return i[0]+=r,i}function ru(t,e,n,r){const[i,o,a,u]=Va(t,e,n,!0),s=i.length,l=Math.max(2,~~(r*s)),c=new Float64Array(s),f=new Float64Array(s),h=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;ti[a]-n?r:a;let s=0,l=0,d=0,p=0,g=0;const m=1/Math.abs(i[u]-n||1);for(let t=r;t<=a;++t){const e=i[t],r=o[t],a=iu(Math.abs(n-e)*m)*h[t],u=e*a;s+=a,l+=u,d+=r*a,p+=r*u,g+=e*u}const[y,v]=Ya(l/s,d/s,p/s,g/s);c[t]=y+v*n,f[t]=Math.abs(o[t]-c[t]),ou(i,t+1,e)}if(2===t)break;const n=Oe(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,o=[];let a,u=0,s=0,l=[];for(;u=t.length))for(;e>i&&t[o]-r<=r-t[i];)n[0]=++i,n[1]=o,++o}const au=.1*Math.PI/180;function uu(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],o=e[0],a=e[1],u=a-o,s=u/r,l=[i(o)],c=[];if(n===r){for(let t=1;t0;)c.push(i(o+t/n*u));let f=l[0],h=c[c.length-1];for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&su(f,t,h)>au?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function su(t,e,n){const r=Math.atan2(n[1]-t[1],n[0]-t[0]),i=Math.atan2(e[1]-t[1],e[0]-t[0]);return Math.abs(r-i)}function lu(t){return t&&t.length?1===t.length?t[0]:(e=t,t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r{},hu={init:fu,add:fu,rem:fu,idx:0},du={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.sum,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3}},pu=Object.keys(du);function gu(t,e){return du[t](e)}function mu(t,e){return t.idx-e.idx}function yu(){this.valid=0,this.missing=0,this._ops.forEach((t=>t.init(this)))}function vu(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((n=>n.add(this,t,e)))):++this.missing}function _u(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((n=>n.rem(this,t,e)))):--this.missing}function xu(t){return this._out.forEach((e=>t[e.out]=e.value(this))),t}function bu(t,e){const n=e||h,r=function(t){const e={};t.forEach((t=>e[t.name]=t));const n=t=>{t.req&&t.req.forEach((t=>{e[t]||n(e[t]=du[t]())}))};return t.forEach(n),Object.values(e).sort(mu)}(t),i=t.slice().sort(mu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=yu,o.prototype.add=vu,o.prototype.rem=_u,o.prototype.set=xu,o.prototype.get=n,o.fields=t.map((t=>t.out)),o}function wu(t){this._key=t?c(t):Ro,this.reset()}pu.forEach((t=>{du[t]=function(t,e){return n=>tt({name:t,out:n||t},hu,e)}(t,du[t])}));const ku=wu.prototype;function Au(t){ga.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}ku.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},ku.add=function(t){this._add.push(t)},ku.rem=function(t){this._rem.push(t)},ku.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,e=this._rem,n=this._key,r=t.length,i=e.length,o=Array(r-i),a={};let u,s,l;for(u=0;u=0;)r=t(e[i])+"",it(n,r)||(n[r]=1,++o);return o},ku.extent=function(t){if(this._get!==t||!this._ext){const e=this.values(),n=nt(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},ku.argmin=function(t){return this.extent(t)[0]||{}},ku.argmax=function(t){return this.extent(t)[1]||{}},ku.min=function(t){const e=this.extent(t)[0];return null!=e?t(e):void 0},ku.max=function(t){const e=this.extent(t)[1];return null!=e?t(e):void 0},ku.quartile=function(t){return this._get===t&&this._q||(this._q=ba(this.values(),t),this._get=t),this._q},ku.q1=function(t){return this.quartile(t)[0]},ku.q2=function(t){return this.quartile(t)[1]},ku.q3=function(t){return this.quartile(t)[2]},ku.ci=function(t){return this._get===t&&this._ci||(this._ci=Aa(this.values(),1e3,.05,t),this._get=t),this._ci},ku.ci0=function(t){return this.ci(t)[0]},ku.ci1=function(t){return this.ci(t)[1]},Au.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:pu},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},st(Au,ga,{transform(t,e){const n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):{},e.visit(e.SOURCE,(t=>n.add(t)))):(n.value=n.value||n.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),e.clean()&&n._drop&&r.clean(!0).runAfter((()=>this.clean())),n.changes(r)},cross(){const t=this,e=t.value,n=t._dnames,r=n.map((()=>({}))),i=n.length;function o(t){let e,o,a,u;for(e in t)for(a=t[e].tuple,o=0;o{const e=r(t);return a(t),n.push(e),e})),this.cellkey=t.key?t.key:lu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const u=t.fields||[null],l=t.ops||["count"],c=t.as||[],f=u.length,h={};let d,p,g,m,y,v;for(f!==l.length&&s("Unmatched number of fields and aggregate ops."),v=0;vbu(t,t.field))),{}},cellkey:lu(),cell(t,e){let n=this.value[t];return n?0===n.num&&this._drop&&n.stampo.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,e)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),e&&t&&i.sort(t),o.length&&(i=t?_t(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Du(t){ga.call(this,[],t)}function Cu(t){Xo.call(this,null,Fu,t)}function Fu(t){return this.value&&!t.modified()?this.value:V(t.fields,t.orders)}function Su(t){ga.call(this,null,t)}function Bu(t){ga.call(this,null,t)}Mu.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},st(Mu,ga,{transform(t,e){const n=!1!==t.interval,r=this._bins(t),o=r.start,a=r.step,u=t.as||["bin0","bin1"],s=u[0],l=u[1];let c;return c=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(i(t.field))?e.ADD_MOD:e.ADD,e.visit(c,n?t=>{const e=r(t);t[s]=e,t[l]=null==e?null:o+a*(1+(e-o)/a)}:t=>t[s]=r(t)),e.modifies(n?u:s)},_bins(t){if(this.value&&!t.modified())return this.value;const e=t.field,o=ka(t),a=o.step;let u,s,l=o.start,c=l+Math.ceil((o.stop-l)/a)*a;null!=(u=t.anchor)&&(s=u-(l+a*Math.floor((u-l)/a)),l+=s,c+=s);const f=function(t){let n=E(e(t));return null==n?null:nc?1/0:(n=Math.max(l,Math.min(n,c-a)),l+a*Math.floor(1e-14+(n-l)/a))};return f.start=l,f.stop=o.stop,f.step=a,this.value=n(f,i(e),t.name||"bin_"+r(e))}}),Du.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},st(Du,ga,{transform(t,e){const n=e.fork(e.ALL),r=Eu(Ro,this.value,n.materialize(n.ADD).add),i=t.sort,o=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(Io(i),o),e.source&&e.source.root&&(this.value.root=e.source.root),n}}),st(Cu,Xo),Su.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]},st(Su,ga,{transform(t,e){const n=e=>n=>{for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(u(n),t.case,o)||[],s=0,l=i.length;si[t]=1+(i[t]||0))),c=n((t=>i[t]-=1));return r?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,c)),this._finish(e,s)},_parameterCheck(t,e){let n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(t,e){const n=this._counts,r=this._tuples||(this._tuples={}),i=e[0],o=e[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,l;for(u in n)s=r[u],l=n[u]||0,!s&&l?(r[u]=s=Uo({}),s[i]=u,s[o]=l,a.add.push(s)):0===l?(s&&a.rem.push(s),n[u]=null,r[u]=null):s[o]!==l&&(s[o]=l,a.mod.push(s));return a.modifies(e)}}),Bu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},st(Bu,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(n.rem=u),u=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,o,a=[],u={},s=t.length,l=0;lNu(t,e)))):typeof r[n]===zu&&r[n](t[n]);return r}function Ou(t){ga.call(this,null,t)}const Ru=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Lu={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Ru},{name:"weights",type:"number",array:!0}]};function Uu(t,e){return t?t.map(((t,n)=>e[n]||r(t))):null}function qu(t,e,n){const r=[],i=t=>t(s);let o,a,u,s,l,c;if(null==e)r.push(t.map(n));else for(o={},a=0,u=t.length;at.materialize(t.SOURCE).source}(e)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&s("Invalid density method: "+a),t.extent||r.data||s("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],l=uu(a,t.extent||et(r.data()),i,o).map((t=>{const e={};return e[u[0]]=t[0],e[u[1]]=t[1],Uo(e)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function Pu(t){ga.call(this,null,t)}Pu.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function ju(t){Xo.call(this,null,Iu,t),this.modified(!0)}function Iu(t){const e=t.expr;return this.value&&!t.modified("expr")?this.value:n((n=>e(n,t)),i(e),r(e))}function $u(t){ga.call(this,[void 0,void 0],t)}function Wu(t,e){Xo.call(this,t),this.parent=e,this.count=0}function Hu(t){ga.call(this,{},t),this._keys=at();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;nc(t))):c(t.name,t.as)}function Gu(t){ga.call(this,at(),t)}function Xu(t){ga.call(this,[],t)}function Ju(t){ga.call(this,[],t)}function Zu(t){ga.call(this,null,t)}function Qu(t){ga.call(this,[],t)}st(Pu,ga,{transform(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=qu(e.source,t.groupby,h),i=t.smooth||!1,o=t.field,a=t.step||((t,e)=>wt(et(t,e))/30)(n,o),u=Io(((t,e)=>o(t)-o(e))),s=t.as||"bin",l=r.length;let c,f=1/0,d=-1/0,p=0;for(;pd&&(d=e),t[++c][s]=e}return this.value={start:f,stop:d,step:a},e.reflow(!0).modifies(s)}}),st(ju,Xo),$u.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},st($u,ga,{transform(t,e){const n=this.value,i=t.field,o=e.changed()||e.modified(i.fields)||t.modified("field");let a=n[0],u=n[1];if((o||null==a)&&(a=1/0,u=-1/0),e.visit(o?e.SOURCE:e.ADD,(t=>{const e=E(i(t));null!=e&&(eu&&(u=e))})),!Number.isFinite(a)||!Number.isFinite(u)){let t=r(i);t&&(t=' for field "'.concat(t,'"')),e.dataflow.warn("Infinite extent".concat(t,": [").concat(a,", ").concat(u,"]")),a=u=void 0}this.value=[a,u]}}),st(Wu,Xo,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),st(Hu,ga,{activate(t){this._targets[this._targets.active++]=t},subflow(t,e,n,r){const i=this.value;let o,a,u=it(i,t)&&i[t];return u?u.value.stampthis.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,(t=>{const e=Ro(t),n=o.get(e);void 0!==n&&(o.delete(e),u(n).rem(t))})),e.visit(e.ADD,(t=>{const e=r(t);o.set(Ro(t),e),u(e).add(t)})),a||e.modified(r.fields)?e.visit(e.MOD,(t=>{const e=Ro(t),n=o.get(e),i=r(t);n===i?u(i).mod(t):(o.set(e,i),u(n).rem(t),u(i).add(t))})):e.changed(e.MOD)&&e.visit(e.MOD,(t=>{u(o.get(Ro(t))).mod(t)})),a&&e.visit(e.REFLOW,(t=>{const e=Ro(t),n=o.get(e),i=r(t);n!==i&&(o.set(e,i),u(n).rem(t),u(i).add(t))})),e.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),e}}),st(Yu,Xo),Gu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},st(Gu,ga,{transform(t,e){const n=e.dataflow,r=this.value,i=e.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let l=!0;function c(e){const n=Ro(e),i=s(e,t),c=r.get(n);i&&c?(r.delete(n),o.push(e)):i||c?l&&i&&!c&&u.push(e):(r.set(n,1),a.push(e))}return e.visit(e.REM,(t=>{const e=Ro(t);r.has(e)?r.delete(e):a.push(t)})),e.visit(e.ADD,(e=>{s(e,t)?o.push(e):r.set(Ro(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),Xu.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},st(Xu,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Uu(r,t.as||[]),o=t.index||null,a=i.length;return n.rem=this.value,e.visit(e.SOURCE,(t=>{const e=r.map((e=>e(t))),u=e.reduce(((t,e)=>Math.max(t,e.length)),0);let s,l,c,f=0;for(;f{for(let e,r=0;re[r]=n(e,t)))}}),st(Qu,ga,{transform(t,e){const n=e.fork(e.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=Uo(r(t))),u.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(i):i}else o=u.slice(0,-s),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,u=u.slice(-s);return n.source=this.value=u,n}});const Ku={value:"value",median:Oe,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:Se,max:Fe},ts=[];function es(t){ga.call(this,[],t)}function ns(t){Au.call(this,t)}function rs(t){ga.call(this,null,t)}function is(t){Xo.call(this,null,os,t)}function os(t){return this.value&&!t.modified()?this.value:mt(t.fields,t.flat)}function as(t){ga.call(this,[],t),this._pending=null}function us(t,e,n){n.forEach(Uo);const r=e.fork(e.NO_FIELDS&e.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=n,t._pending=null,r.rem.length&&r.clean(!0),r}function ss(t){ga.call(this,{},t)}function ls(t){Xo.call(this,null,cs,t)}function cs(t){if(this.value&&!t.modified())return this.value;const e=t.extents,n=e.length;let r,i,o=1/0,a=-1/0;for(r=0;ra&&(a=i[1]);return[o,a]}function fs(t){Xo.call(this,null,hs,t)}function hs(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,e)=>t.concat(e)),[])}function ds(t){ga.call(this,null,t)}function ps(t){Au.call(this,t)}function gs(t){Hu.call(this,t)}function ms(t){ga.call(this,null,t)}function ys(t){ga.call(this,null,t)}function vs(t){ga.call(this,null,t)}es.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},st(es,ga,{transform(t,e){var n,i,o,a,u,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||Ku.value;if(null!=Ku[n])return n===Ku.value?(e=void 0!==t.value?t.value:0,()=>e):Ku[n];s("Unrecognized imputation method: "+n)}(t),m=function(t){const e=t.field;return t=>t?e(t):NaN}(t),y=r(t.field),v=r(t.key),_=(t.groupby||[]).map(r),x=function(t,e,n,r){var i,o,a,u,s,l,c,f,h=t=>t(f),d=[],p=r?r.slice():[],g={},m={};for(p.forEach(((t,e)=>g[t]=e+1)),u=0,c=t.length;un.add(t)))):(i=n.value=n.value||this.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),n.changes(),e.visit(e.SOURCE,(t=>{tt(t,i[n.cellkey(t)].tuple)})),e.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,e=this._mods;let n,r;for(n=0,r=this._alen;n{const n=Na(e,u)[l],r=t.counts?e.length:1;uu(n,h||et(e),d,p).forEach((t=>{const n={};for(let t=0;t(this._pending=W(t.data),t=>t.touch(this))))}}return n.request(t.url,t.format).then((t=>us(this,e,W(t.data))))}}),ss.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},st(ss,ga,{transform(t,e){const n=t.fields,i=t.index,o=t.values,a=null==t.default?null:t.default,u=t.modified(),l=n.length;let c,f,h,d=u?e.SOURCE:e.ADD,p=e,g=t.as;return o?(f=o.length,l>1&&!g&&s('Multi-field lookup requires explicit "as" parameter.'),g&&g.length!==l*f&&s('The "as" parameter has too few output field names.'),g=g||o.map(r),c=function(t){for(var e,r,u=0,s=0;ue.modified(t.fields))),d|=h?e.MOD:0),e.visit(d,c),p.modifies(g)}}),st(ls,Xo),st(fs,Xo),st(ds,ga,{transform(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),ps.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:pu,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},st(ps,Au,{_transform:Au.prototype.transform,transform(t,e){return this._transform(function(t,e){const r=t.field,o=t.value,a=("count"===t.op?"__count__":t.op)||"sum",u=i(r).concat(i(o)),s=function(t,e,n){const r={},i=[];return n.visit(n.SOURCE,(e=>{const n=t(e);r[n]||(r[n]=1,i.push(n))})),i.sort(G),e?i.slice(0,e):i}(r,t.limit||0,e);e.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((()=>a)),fields:s.map((t=>function(t,e,r,i){return n((n=>e(n)===t?r(n):NaN),i,t+"")}(t,r,o,u))),as:s.map((t=>t+"")),modified:t.modified.bind(t)}}(t,e),e)}}),st(gs,Hu,{transform(t,e){const n=t.subflow,r=t.field,o=t=>this.subflow(Ro(t),n,e,t);return(t.modified("field")||r&&e.modified(i(r)))&&s("PreFacet does not support field modification."),this.initTargets(),r?(e.visit(e.MOD,(t=>{const e=o(t);r(t).forEach((t=>e.mod(t)))})),e.visit(e.ADD,(t=>{const e=o(t);r(t).forEach((t=>e.add(Uo(t))))})),e.visit(e.REM,(t=>{const e=o(t);r(t).forEach((t=>e.rem(t)))}))):(e.visit(e.MOD,(t=>o(t).mod(t))),e.visit(e.ADD,(t=>o(t).add(t))),e.visit(e.REM,(t=>o(t).rem(t)))),e.clean()&&e.runAfter((()=>this.clean())),e}}),ms.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},st(ms,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Uu(t.fields,t.as||[]),o=r?(t,e)=>function(t,e,n,r){for(let i=0,o=n.length;i{const e=Ro(t);n.rem.push(a[e]),a[e]=null})),e.visit(e.ADD,(t=>{const e=o(t,Uo({}));a[Ro(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{n.mod.push(o(t,a[Ro(t)]))})),n}}),st(ys,ga,{transform(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}}),vs.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function _s(t){ga.call(this,null,t)}function xs(t){ga.call(this,[],t),this.count=0}function bs(t){ga.call(this,null,t)}function ws(t){ga.call(this,null,t),this.modified(!0)}function ks(t){ga.call(this,null,t)}st(vs,ga,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!e.changed())return n.source=this.value,n;const o=qu(e.materialize(e.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(r),u=[],s=t.step||.01,l=t.probs||Le(s/2,1-1e-14,s),c=l.length;return o.forEach((t=>{const e=xa(t,l);for(let n=0;n{const e=Ro(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(t=>{const e=qo(t);r[Ro(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{const e=r[Ro(t)];for(const r in t)e[r]=t[r],n.modifies(r);n.mod.push(e)}))),n}}),xs.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},st(xs,ga,{transform(e,n){const r=n.fork(n.NO_SOURCE),i=e.modified("size"),o=e.size,a=this.value.reduce(((t,e)=>(t[Ro(e)]=1,t)),{});let u=this.value,s=this.count,l=0;function c(e){let n,i;u.length=l&&(n=u[i],a[Ro(n)]&&r.rem.push(n),u[i]=e)),++s}if(n.rem.length&&(n.visit(n.REM,(t=>{const e=Ro(t);a[e]&&(a[e]=-1,r.rem.push(t)),--s})),u=u.filter((t=>-1!==a[Ro(t)]))),(n.rem.length||i)&&u.length{a[Ro(t)]||c(t)})),l=-1),i&&u.length>o){const t=u.length-o;for(let e=0;e{a[Ro(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||l<0)&&(r.add=u.filter((t=>!a[Ro(t)]))),this.count=s,this.value=r.source=u,r}}),bs.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},st(bs,ga,{transform(t,e){if(this.value&&!t.modified())return;const n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=Le(t.start,t.stop,t.step||1).map((t=>{const e={};return e[r]=t,Uo(e)})),n.add=e.add.concat(this.value),n}}),st(ws,ga,{transform(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}});const As=["unit0","unit1"];function Ms(t){ga.call(this,at(),t)}function Es(t){ga.call(this,null,t)}ks.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:$n,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:As}]},st(ks,ga,{transform(t,e){const n=t.field,r=!1!==t.interval,o="utc"===t.timezone,a=this._floor(t,e),u=(o?_r:vr)(a.unit).offset,s=t.as||As,l=s[0],c=s[1],f=a.step;let h=a.start||1/0,d=a.stop||-1/0,p=e.ADD;return(t.modified()||e.modified(i(n)))&&(p=(e=e.reflow(!0)).SOURCE,h=1/0,d=-1/0),e.visit(p,(t=>{const e=n(t);let i,o;null==e?(t[l]=null,r&&(t[c]=null)):(t[l]=i=o=a(e),r&&(t[c]=o=u(i,f)),id&&(d=o))})),a.start=h,a.stop=d,e.modifies(r?s:l)},_floor(t,e){const n="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Pr({extent:t.extent||et(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins}),o=Hn(r),a=this.value||{},u=(n?gr:hr)(o,i);return u.unit=M(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),st(Ms,ga,{transform(t,e){const n=e.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(t=>i.delete(r(t)))),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()}}),st(Es,ga,{transform(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(Io(t.sort)):e.source).map(t.field))}});const Ds={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){const t=Ds.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{const n=e.data,r=e.compare;let i=e.index;if(t0||s("ntile num must be greater than zero.");const n=Ds.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{const r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{const r=n.index+e,i=n.data;return rt(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||s("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(e-1);return re=null,next:n=>{const r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{const i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;nc[t]=1))}m(t.sort),e.forEach(((t,e)=>{const i=n[e],c=r(i),y=cu(t,c,a[e]);if(m(i),u.push(y),it(Ds,t))l.push(function(t,e,n,r){const i=Ds[t](e,n);return{init:i.init||d,update:function(t,e){e[r]=i.next(t)}}}(t,n[e],o[e],y));else{if(null==i&&"count"!==t&&s("Null aggregate field specified."),"count"===t)return void h.push(y);g=!1;let e=f[c];e||(e=f[c]=[],e.field=i,p.push(e)),e.push(gu(t,y))}})),(h.length||p.length)&&(this.cell=function(t,e,n){t=t.map((t=>bu(t,t.field)));const r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,o=r.agg=Array(i),a=0;a0&&!i(o[n],o[n-1])&&(t.i0=e.left(o,o[n])),rt.init())),this.cell&&this.cell.init()},Ss.update=function(t,e){const n=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(n){for(a=t.p0;athis.group(i(t));let a=this.state;a&&!n||(a=this.state=new Fs(t)),n||e.modified(a.inputs)?(this.value={},e.visit(e.SOURCE,(t=>o(t).add(t)))):(e.visit(e.REM,(t=>o(t).remove(t))),e.visit(e.ADD,(t=>o(t).add(t))));for(let e=0,n=this._mlen;eUs)if(Math.abs(c*u-s*l)>Us&&i){var h=n-o,d=r-a,p=u*u+s*s,g=h*h+d*d,m=Math.sqrt(p),y=Math.sqrt(f),v=i*Math.tan((Rs-Math.acos((p+f-g)/(2*m*y)))/2),_=v/y,x=v/m;Math.abs(_-1)>Us&&(this._+="L"+(t+_*l)+","+(e+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*u)+","+(this._y1=e+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,r,i,o){t=+t,e=+e,o=!!o;var a=(n=+n)*Math.cos(r),u=n*Math.sin(r),s=t+a,l=e+u,c=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>Us||Math.abs(this._y1-l)>Us)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%Ls+Ls),f>qs?this._+="A"+n+","+n+",0,1,"+c+","+(t-a)+","+(e-u)+"A"+n+","+n+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>Us&&(this._+="A"+n+","+n+",0,"+ +(f>=Rs)+","+c+","+(this._x1=t+n*Math.cos(i))+","+(this._y1=e+n*Math.sin(i))))},rect:function(t,e,n,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var $s=Math.abs,Ws=Math.atan2,Hs=Math.cos,Ys=Math.max,Vs=Math.min,Gs=Math.sin,Xs=Math.sqrt,Js=1e-12,Zs=Math.PI,Qs=Zs/2,Ks=2*Zs;function tl(t){return t>1?0:t<-1?Zs:Math.acos(t)}function el(t){return t>=1?Qs:t<=-1?-Qs:Math.asin(t)}function nl(t){return t.innerRadius}function rl(t){return t.outerRadius}function il(t){return t.startAngle}function ol(t){return t.endAngle}function al(t){return t&&t.padAngle}function ul(t,e,n,r,i,o,a,u){var s=n-t,l=r-e,c=a-i,f=u-o,h=f*s-c*l;if(!(h*hS*S+B*B&&(A=E,M=D),{cx:A,cy:M,x01:-c,y01:-f,x11:A*(i/b-1),y11:M*(i/b-1)}}function ll(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function cl(t){this._context=t}function fl(t){return new cl(t)}function hl(t){return t[0]}function dl(t){return t[1]}function pl(t,e){var n=Is(!0),r=null,i=fl,o=null;function a(a){var u,s,l,c=(a=ll(a)).length,f=!1;for(null==r&&(o=i(l=js())),u=0;u<=c;++u)!(u=c;--f)u.point(m[f],y[f]);u.lineEnd(),u.areaEnd()}g&&(m[l]=+t(h,l,s),y[l]=+e(h,l,s),u.point(r?+r(h,l,s):m[l],n?+n(h,l,s):y[l]))}if(d)return u=null,d+""||null}function l(){return pl().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?hl:Is(+t),e="function"==typeof e?e:Is(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?dl:Is(+n),s.x=function(e){return arguments.length?(t="function"==typeof e?e:Is(+e),r=null,s):t},s.x0=function(e){return arguments.length?(t="function"==typeof e?e:Is(+e),s):t},s.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Is(+t),s):r},s.y=function(t){return arguments.length?(e="function"==typeof t?t:Is(+t),n=null,s):e},s.y0=function(t){return arguments.length?(e="function"==typeof t?t:Is(+t),s):e},s.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Is(+t),s):n},s.lineX0=s.lineY0=function(){return l().x(t).y(e)},s.lineY1=function(){return l().x(t).y(n)},s.lineX1=function(){return l().x(r).y(e)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:Is(!!t),s):i},s.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),s):a},s.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),s):o},s}cl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var ml={draw:function(t,e){var n=Math.sqrt(e/Zs);t.moveTo(n,0),t.arc(0,0,n,0,Ks)}};function yl(){}function vl(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function _l(t){this._context=t}function xl(t){this._context=t}function bl(t){this._context=t}function wl(t,e){this._basis=new _l(t),this._beta=e}_l.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:vl(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:vl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},xl.prototype={areaStart:yl,areaEnd:yl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:vl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},bl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:vl(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},wl.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,u=e[n]-o,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*a),this._beta*e[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var kl=function t(e){function n(t){return 1===e?new _l(t):new wl(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Al(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function Ml(t,e){this._context=t,this._k=(1-e)/6}Ml.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Al(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Al(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var El=function t(e){function n(t){return new Ml(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Dl(t,e){this._context=t,this._k=(1-e)/6}Dl.prototype={areaStart:yl,areaEnd:yl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Al(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Cl=function t(e){function n(t){return new Dl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Fl(t,e){this._context=t,this._k=(1-e)/6}Fl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Al(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Sl=function t(e){function n(t){return new Fl(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Bl(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Js){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>Js){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Tl(t,e){this._context=t,this._alpha=e}Tl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Bl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var zl=function t(e){function n(t){return e?new Tl(t,e):new Ml(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Nl(t,e){this._context=t,this._alpha=e}Nl.prototype={areaStart:yl,areaEnd:yl,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Bl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ol=function t(e){function n(t){return e?new Nl(t,e):new Dl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Rl(t,e){this._context=t,this._alpha=e}Rl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bl(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ll=function t(e){function n(t){return e?new Rl(t,e):new Fl(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Ul(t){this._context=t}function ql(t){return t<0?-1:1}function Pl(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(ql(o)+ql(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function jl(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Il(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,u=(o-r)/3;t._context.bezierCurveTo(r+u,i+u*e,o-u,a-u*n,o,a)}function $l(t){this._context=t}function Wl(t){this._context=new Hl(t)}function Hl(t){this._context=t}function Yl(t){this._context=t}function Vl(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};const Jl=()=>"undefined"!=typeof Image?Image:null;function Zl(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Ql(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Kl=Symbol("implicit");function tc(){var t=new Map,e=[],n=[],r=Kl;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==Kl)return r;t.set(o,a=e.push(i))}return n[(a-1)%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new Map;for(const r of n){const n=r+"";t.has(n)||t.set(n,e.push(r))}return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return tc(e,n).unknown(r)},Zl.apply(i,arguments),i}function ec(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function nc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function rc(){}var ic=.7,oc=1/ic,ac="\\s*([+-]?\\d+)\\s*",uc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",sc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lc=/^#([0-9a-f]{3,8})$/,cc=new RegExp("^rgb\\("+[ac,ac,ac]+"\\)$"),fc=new RegExp("^rgb\\("+[sc,sc,sc]+"\\)$"),hc=new RegExp("^rgba\\("+[ac,ac,ac,uc]+"\\)$"),dc=new RegExp("^rgba\\("+[sc,sc,sc,uc]+"\\)$"),pc=new RegExp("^hsl\\("+[uc,sc,sc]+"\\)$"),gc=new RegExp("^hsla\\("+[uc,sc,sc,uc]+"\\)$"),mc={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 yc(){return this.rgb().formatHex()}function vc(){return this.rgb().formatRgb()}function _c(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=lc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?xc(e):3===n?new Ac(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?bc(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?bc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=cc.exec(t))?new Ac(e[1],e[2],e[3],1):(e=fc.exec(t))?new Ac(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=hc.exec(t))?bc(e[1],e[2],e[3],e[4]):(e=dc.exec(t))?bc(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=pc.exec(t))?Cc(e[1],e[2]/100,e[3]/100,1):(e=gc.exec(t))?Cc(e[1],e[2]/100,e[3]/100,e[4]):mc.hasOwnProperty(t)?xc(mc[t]):"transparent"===t?new Ac(NaN,NaN,NaN,0):null}function xc(t){return new Ac(t>>16&255,t>>8&255,255&t,1)}function bc(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ac(t,e,n,r)}function wc(t){return t instanceof rc||(t=_c(t)),t?new Ac((t=t.rgb()).r,t.g,t.b,t.opacity):new Ac}function kc(t,e,n,r){return 1===arguments.length?wc(t):new Ac(t,e,n,null==r?1:r)}function Ac(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Mc(){return"#"+Dc(this.r)+Dc(this.g)+Dc(this.b)}function Ec(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function Dc(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Cc(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Bc(t,e,n,r)}function Fc(t){if(t instanceof Bc)return new Bc(t.h,t.s,t.l,t.opacity);if(t instanceof rc||(t=_c(t)),!t)return new Bc;if(t instanceof Bc)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=e===o?(n-r)/u+6*(n0&&s<1?0:a,new Bc(a,u,s,t.opacity)}function Sc(t,e,n,r){return 1===arguments.length?Fc(t):new Bc(t,e,n,null==r?1:r)}function Bc(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Tc(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}ec(rc,_c,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:yc,formatHex:yc,formatHsl:function(){return Fc(this).formatHsl()},formatRgb:vc,toString:vc}),ec(Ac,kc,nc(rc,{brighter:function(t){return t=null==t?oc:Math.pow(oc,t),new Ac(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?ic:Math.pow(ic,t),new Ac(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){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:Mc,formatHex:Mc,formatRgb:Ec,toString:Ec})),ec(Bc,Sc,nc(rc,{brighter:function(t){return t=null==t?oc:Math.pow(oc,t),new Bc(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?ic:Math.pow(ic,t),new Bc(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ac(Tc(t>=240?t-240:t+120,i,r),Tc(t,i,r),Tc(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));const zc=Math.PI/180,Nc=180/Math.PI,Oc=.96422,Rc=.82521,Lc=4/29,Uc=6/29,qc=3*Uc*Uc;function Pc(t){if(t instanceof Ic)return new Ic(t.l,t.a,t.b,t.opacity);if(t instanceof Xc)return Jc(t);t instanceof Ac||(t=wc(t));var e,n,r=Yc(t.r),i=Yc(t.g),o=Yc(t.b),a=$c((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=$c((.4360747*r+.3850649*i+.1430804*o)/Oc),n=$c((.0139322*r+.0971045*i+.7141733*o)/Rc)),new Ic(116*a-16,500*(e-a),200*(a-n),t.opacity)}function jc(t,e,n,r){return 1===arguments.length?Pc(t):new Ic(t,e,n,null==r?1:r)}function Ic(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function $c(t){return t>.008856451679035631?Math.pow(t,1/3):t/qc+Lc}function Wc(t){return t>Uc?t*t*t:qc*(t-Lc)}function Hc(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Yc(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Vc(t){if(t instanceof Xc)return new Xc(t.h,t.c,t.l,t.opacity);if(t instanceof Ic||(t=Pc(t)),0===t.a&&0===t.b)return new Xc(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,u=r()=>t;function df(t,e){return function(n){return t+n*e}}function pf(t,e){var n=e-t;return n?df(t,n>180||n<-180?n-360*Math.round(n/360):n):hf(isNaN(t)?e:t)}function gf(t){return 1==(t=+t)?mf:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):hf(isNaN(e)?n:e)}}function mf(t,e){var n=e-t;return n?df(t,n):hf(isNaN(t)?e:t)}var yf=function t(e){var n=gf(e);function r(t,e){var r=n((t=kc(t)).r,(e=kc(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=mf(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function vf(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),u=new Array(i);for(n=0;no&&(i=e.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(n=n[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Mf(n,r)})),o=Cf.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Mf(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,u,s),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Mf(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,u,s),function(t,e,n,r,o,a){if(t!==n||e!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Mf(t,n)},{i:u-2,x:Mf(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var e,n=-1,r=s.length;++ne&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?rh:nh,i=o=null,f}function f(e){return isNaN(e=+e)?n:(i||(i=r(a.map(t),u,s)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(u,a.map(t),Mf)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Qf),c()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),c()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),s=Bf,c()},f.clamp=function(t){return arguments.length?(l=!!t||th,c()):l!==th},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function ah(){return oh()(th,th)}function uh(t,e,n,r){var i,o=Ce(t,e,n);switch((r=$e(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=en(o,a))||(r.precision=i),Je(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=nn(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=tn(o))||(r.precision=i-2*("%"===r.type))}return Xe(r)}function sh(t){var e=t.domain;return t.ticks=function(t){var n=e();return Ee(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return uh(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,u=o.length-1,s=o[a],l=o[u],c=10;for(l0;){if((i=De(s,l,n))===r)return o[a]=s,o[u]=l,e(o);if(i>0)s=Math.floor(s/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function lh(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a0){for(;h<=d;++h)for(c=1,l=n(h);cs)break;g.push(f)}}else for(;h<=d;++h)for(c=o-1,l=n(h);c>=1;--c)if(!((f=l*c)s)break;g.push(f)}2*g.length0?r:1:0}const jh="linear",Ih="log",$h="pow",Wh="sqrt",Hh="symlog",Yh="time",Vh="utc",Gh="sequential",Xh="diverging",Jh="quantile",Zh="quantize",Qh="threshold",Kh="ordinal",td="point",ed="band",nd="bin-ordinal",rd="continuous",id="discrete",od="discretizing",ad="interpolating",ud="temporal";function sd(){const t=tc().unknown(void 0),e=t.domain,n=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,l=.5;function c(){const t=e().length,c=o[1]d+r*t));return n(c?p.reverse():p)}return delete t.unknown,t.domain=function(t){return arguments.length?(e(t),c()):e()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],c()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,c()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,c()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),c()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},t.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]o[1-r])?void 0:(s=Math.max(0,xe(a,f)-1),l=f===h?s:xe(a,h)-1,f-a[s]>i+1e-10&&++s,r&&(c=s,s=u-l,l=u-c),s>l?void 0:e().slice(s,l+1))},t.invert=function(e){const n=t.invertRange([e,e]);return n?n[0]:n},t.copy=function(){return sd().domain(e()).range(o).round(a).paddingInner(u).paddingOuter(s).align(l)},c()}function ld(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return ld(e())},t}var cd=Array.prototype.map;function fd(t){return cd.call(t,E)}const hd=Array.prototype.slice;const dd={};function pd(t,e,n){const r=function(){const n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){let n,r=e[0],i=e[1];return i=u&&n[o]<=s&&(l<0&&(l=o),r=o);if(!(l<0))return u=t.invertExtent(n[l]),s=t.invertExtent(n[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(n):void 0),n.type=t,n};return r.metadata=Ct(W(n)),r}function gd(t,e,n){return arguments.length>1?(dd[t]=pd(t,e,n),this):md(t)?dd[t]:void 0}function md(t){return it(dd,t)}function yd(t,e){const n=dd[t];return n&&n.metadata[e]}function vd(t){return yd(t,rd)}function _d(t){return yd(t,id)}function xd(t){return yd(t,od)}function bd(t){return yd(t,Ih)}function wd(t){return yd(t,ad)}function kd(t){return yd(t,Jh)}gd("identity",(function t(e){var n;function r(t){return isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Qf),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Qf):[0,1],sh(r)})),gd(jh,(function t(){var e=ah();return e.copy=function(){return ih(e,t())},Zl.apply(e,arguments),sh(e)}),rd),gd(Ih,(function t(){var e=mh(oh()).domain([1,10]);return e.copy=function(){return ih(e,t()).base(e.base())},Zl.apply(e,arguments),e}),[rd,Ih]),gd($h,Ah,rd),gd(Wh,(function(){return Ah.apply(null,arguments).exponent(.5)}),rd),gd(Hh,(function t(){var e=_h(oh());return e.copy=function(){return ih(e,t()).constant(e.constant())},Zl.apply(e,arguments)}),rd),gd(Yh,(function(){return Zl.apply(zh(wn,bn,vn,mn,gn,pn,dn,un,Yr).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[rd,ud]),gd(Vh,(function(){return Zl.apply(zh(Bn,Sn,Dn,Mn,An,kn,dn,un,Gr).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[rd,ud]),gd(Gh,Rh,[rd,ad]),gd("".concat(Gh,"-").concat(jh),Rh,[rd,ad]),gd("".concat(Gh,"-").concat(Ih),(function t(){var e=mh(Nh()).domain([1,10]);return e.copy=function(){return Oh(e,t()).base(e.base())},Ql.apply(e,arguments)}),[rd,ad,Ih]),gd("".concat(Gh,"-").concat($h),Lh,[rd,ad]),gd("".concat(Gh,"-").concat(Wh),(function(){return Lh.apply(null,arguments).exponent(.5)}),[rd,ad]),gd("".concat(Gh,"-").concat(Hh),(function t(){var e=_h(Nh());return e.copy=function(){return Oh(e,t()).constant(e.constant())},Ql.apply(e,arguments)}),[rd,ad]),gd("".concat(Xh,"-").concat(jh),(function t(){var e=sh(Uh()(th));return e.copy=function(){return Oh(e,t())},Ql.apply(e,arguments)}),[rd,ad]),gd("".concat(Xh,"-").concat(Ih),(function t(){var e=mh(Uh()).domain([.1,1,10]);return e.copy=function(){return Oh(e,t()).base(e.base())},Ql.apply(e,arguments)}),[rd,ad,Ih]),gd("".concat(Xh,"-").concat($h),qh,[rd,ad]),gd("".concat(Xh,"-").concat(Wh),(function(){return qh.apply(null,arguments).exponent(.5)}),[rd,ad]),gd("".concat(Xh,"-").concat(Hh),(function t(){var e=_h(Uh());return e.copy=function(){return Oh(e,t()).constant(e.constant())},Ql.apply(e,arguments)}),[rd,ad]),gd(Jh,(function t(){var e,n=[],r=[],i=[];function o(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t0?i[e-1]:n[0],e=i?[o[i-1],r]:[o[e-1],o[e]]},u.unknown=function(t){return arguments.length?(e=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([n,r]).range(a).unknown(e)},Zl.apply(sh(u),arguments)}),od),gd(Qh,(function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return t<=t?r[xe(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Zl.apply(o,arguments)}),od),gd(nd,(function t(){let e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(xe(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=fd(t),r):e.slice()},r.range=function(t){return arguments.length?(n=hd.call(t),r):n.slice()},r.tickFormat=function(t,n){return uh(e[0],M(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[id,od]),gd(Kh,tc,id),gd(ed,sd,id),gd(td,(function(){return ld(sd().paddingInner(1))}),id);const Ad=["clamp","base","constant","exponent"];function Md(t,e){const n=e[0],r=M(e)-n;return function(e){return t(n+e*r)}}function Ed(t,e,n){return Jf(Fd(e||"rgb",n),t)}function Dd(t,e){const n=new Array(e),r=e+1;for(let i=0;it[e]?a[e](t[e]()):0)),a):Q(.5)}function Fd(t,e){const n=Zf[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function Sd(t){const e=t.length/6|0,n=new Array(e);for(let r=0;r1?(Td[t]=e,this):Td[t]}Bd({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Sd),Bd({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(t=>Ed(Sd(t))));const Nd="symbol",Od=t=>_(t)?t.map((t=>String(t))):String(t),Rd=(t,e)=>t[1]-e[1],Ld=(t,e)=>e[1]-t[1];function Ud(t,e,n){let r;return dt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n&&(e=Math.min(e,Math.floor(wt(t.domain())/n||1)))),x(e)&&(r=e.step,e=e.interval),gt(e)&&(e=t.type===Yh?vr(e):t.type==Vh?_r(e):s("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function qd(t,e,n){let r=t.range(),i=r[0],o=M(r),a=Rd;if(i>o&&(r=o,o=i,i=r,a=Ld),i=Math.floor(i),o=Math.ceil(o),e=e.map((e=>[e,t(e)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),n>0&&e.length>1){const t=[e[0],M(e)];for(;e.length>n&&e.length>=3;)e=e.filter(((t,e)=>!(e%2)));e.length<3&&(e=t)}return e}function Pd(t,e){return t.bins?qd(t,t.bins):t.ticks?t.ticks(e):t.domain()}function jd(t,e,n,r,i,o){const a=e.type;let u=Od;if(a===Yh||i===Yh)u=t.timeFormat(r);else if(a===Vh||i===Vh)u=t.utcFormat(r);else if(bd(a)){const i=t.formatFloat(r);if(o||e.bins)u=i;else{const t=Id(e,n,!1);u=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();u=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(u=t.format(r));return u}function Id(t,e,n){const r=Pd(t,e),i=t.base(),o=Math.log(i),a=Math.max(1,i*e/r.length),u=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/o));return e*i1?r[1]-r[0]:r[0];for(o=1;o$d[t.type]||t.bins)(e)?Vd(u):"discrete"===r?Xd(u):Jd(u)}const Vd=t=>(e,n,r)=>{const i=Gd(r[n+1],Gd(r.max,1/0)),o=Zd(e,t),a=Zd(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Gd=(t,e)=>null!=t?t:e,Xd=t=>(e,n)=>n?t(e):null,Jd=t=>e=>t(e),Zd=(t,e)=>Number.isFinite(t)?e(t):null;function Qd(t,e,n,r){const i=r||e.type;return gt(n)&&function(t){return yd(t,ud)}(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==Yh?n||i!==Vh?Yd(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}function Kd(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=Qd(t,e,n.format,n.formatType);if(xd(e.type)){const t=Hd(e).slice(1).map(i),n=t.length;return"".concat(n," boundar").concat(1===n?"y":"ies",": ").concat(t.join(", "))}if(_d(e.type)){const t=e.domain(),n=t.length,o=n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ");return"".concat(n," value").concat(1===n?"":"s",": ").concat(o)}{const t=e.domain();return"values from ".concat(i(t[0])," to ").concat(i(M(t)))}}let tp=0;const ep="p_";function np(t){return t&&t.gradient}function rp(t,e,n){const r=t.gradient;let i=t.id,o="radial"===r?ep:"";return i||(i=t.id="gradient_"+tp++,"radial"===r?(t.x1=ip(t.x1,.5),t.y1=ip(t.y1,.5),t.r1=ip(t.r1,0),t.x2=ip(t.x2,.5),t.y2=ip(t.y2,.5),t.r2=ip(t.r2,.5),o=ep):(t.x1=ip(t.x1,0),t.y1=ip(t.y1,0),t.x2=ip(t.x2,1),t.y2=ip(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function ip(t,e){return null!=t?t:e}function op(t,e){var n,r=[];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:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}}const ap={basis:{curve:function(t){return new _l(t)}},"basis-closed":{curve:function(t){return new xl(t)}},"basis-open":{curve:function(t){return new bl(t)}},bundle:{curve:kl,tension:"beta",value:.85},cardinal:{curve:El,tension:"tension",value:0},"cardinal-open":{curve:Sl,tension:"tension",value:0},"cardinal-closed":{curve:Cl,tension:"tension",value:0},"catmull-rom":{curve:zl,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ol,tension:"alpha",value:.5},"catmull-rom-open":{curve:Ll,tension:"alpha",value:.5},linear:{curve:fl},"linear-closed":{curve:function(t){return new Ul(t)}},monotone:{horizontal:function(t){return new Wl(t)},vertical:function(t){return new $l(t)}},natural:{curve:function(t){return new Yl(t)}},step:{curve:function(t){return new Gl(t,.5)}},"step-after":{curve:function(t){return new Gl(t,1)}},"step-before":{curve:function(t){return new Gl(t,0)}}};function up(t,e,n){var r=it(ap,t)&&ap[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}const sp={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},lp=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\.\d+)(\.\d)/g,/(\d)([-+])/g,/\s|,|###/];function cp(t){const e=[];let n,r,i,o,a,u,s,l,c,f;const h=t.slice().replace(lp[0],"###$1").split(lp[1]).slice(1);for(s=0,c=h.length;su){const t=i.length;for(l=1,e.push([a].concat(i.slice(l,l+=u))),a="M"===a?"L":"m"===a?"l":a;l1&&(g=Math.sqrt(g),n*=g,r*=g);const m=h/n,y=f/n,v=-f/r,_=h/r,x=m*u+y*s,b=v*u+_*s,w=m*t+y*e,k=v*t+_*e;let A=1/((w-x)*(w-x)+(k-b)*(k-b))-.25;A<0&&(A=0);let M=Math.sqrt(A);o==i&&(M=-M);const E=.5*(x+w)-M*(k-b),D=.5*(b+k)+M*(w-x),C=Math.atan2(b-D,x-E);let F=Math.atan2(k-D,w-E)-C;F<0&&1===o?F+=dp:F>0&&0===o&&(F-=dp);const S=Math.ceil(Math.abs(F/(hp+.001))),B=[];for(let t=0;t+t}function zp(t,e,n){return Math.max(e,Math.min(t,n))}function Np(){var t=Cp,e=Fp,n=Sp,r=Bp,i=Tp(0),o=i,a=i,u=i,s=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),y=Math.min(g,m)/2,v=zp(+i.call(this,l),0,y),_=zp(+o.call(this,l),0,y),x=zp(+a.call(this,l),0,y),b=zp(+u.call(this,l),0,y);if(s||(s=h=js()),v<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,k=p+m;s.moveTo(d+v,p),s.lineTo(w-_,p),s.bezierCurveTo(w-Dp*_,p,w,p+Dp*_,w,p+_),s.lineTo(w,k-b),s.bezierCurveTo(w,k-Dp*b,w-Dp*b,k,w-b,k),s.lineTo(d+x,k),s.bezierCurveTo(d+Dp*x,k,d,k-Dp*x,d,k-x),s.lineTo(d,p+v),s.bezierCurveTo(d,p+Dp*v,d+Dp*v,p,d+v,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(e){return arguments.length?(t=Tp(e),l):t},l.y=function(t){return arguments.length?(e=Tp(t),l):e},l.width=function(t){return arguments.length?(n=Tp(t),l):n},l.height=function(t){return arguments.length?(r=Tp(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Tp(t),o=null!=e?Tp(e):i,u=null!=n?Tp(n):i,a=null!=r?Tp(r):o,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Op(){var t,e,n,r,i,o,a,u,s=null;function l(t,e,n){const r=n/2;if(i){var l=a-e,c=t-o;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*u,d=(c/=f)*u,p=Math.atan2(c,l);s.moveTo(o-h,a-d),s.lineTo(t-l*r,e-c*r),s.arc(t,e,r,p-Math.PI,p),s.lineTo(o+h,a+d),s.arc(o,a,u,p,p+Math.PI)}else s.arc(t,e,r,0,dp);s.closePath()}else i=1;o=t,a=e,u=r}function c(o){var a,u,c,f=o.length,h=!1;for(null==s&&(s=c=js()),a=0;a<=f;++a)!(at.x||0,Up=t=>t.y||0,qp=t=>!(!1===t.defined),Pp=function(){var t=nl,e=rl,n=Is(0),r=null,i=il,o=ol,a=al,u=null;function s(){var s,l,c=+t.apply(this,arguments),f=+e.apply(this,arguments),h=i.apply(this,arguments)-Qs,d=o.apply(this,arguments)-Qs,p=$s(d-h),g=d>h;if(u||(u=s=js()),fJs)if(p>Ks-Js)u.moveTo(f*Hs(h),f*Gs(h)),u.arc(0,0,f,h,d,!g),c>Js&&(u.moveTo(c*Hs(d),c*Gs(d)),u.arc(0,0,c,d,h,g));else{var m,y,v=h,_=d,x=h,b=d,w=p,k=p,A=a.apply(this,arguments)/2,M=A>Js&&(r?+r.apply(this,arguments):Xs(c*c+f*f)),E=Vs($s(f-c)/2,+n.apply(this,arguments)),D=E,C=E;if(M>Js){var F=el(M/c*Gs(A)),S=el(M/f*Gs(A));(w-=2*F)>Js?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(k-=2*S)>Js?(v+=S*=g?1:-1,_-=S):(k=0,v=_=(h+d)/2)}var B=f*Hs(v),T=f*Gs(v),z=c*Hs(b),N=c*Gs(b);if(E>Js){var O,R=f*Hs(_),L=f*Gs(_),U=c*Hs(x),q=c*Gs(x);if(pJs?C>Js?(m=sl(U,q,B,T,f,C,g),y=sl(R,L,z,N,f,C,g),u.moveTo(m.cx+m.x01,m.cy+m.y01),CJs&&w>Js?D>Js?(m=sl(z,N,R,L,c,-D,g),y=sl(B,T,U,q,c,-D,g),u.lineTo(m.cx+m.x01,m.cy+m.y01),Dt.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)),jp=gl().x(Lp).y1(Up).y0((t=>(t.y||0)+(t.height||0))).defined(qp),Ip=gl().y(Up).x1(Lp).x0((t=>(t.x||0)+(t.width||0))).defined(qp),$p=pl().x(Lp).y(Up).defined(qp),Wp=Np().x(Lp).y(Up).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Rp(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Rp(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Rp(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Rp(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),Hp=function(t,e){var n=null;function r(){var r;if(n||(n=r=js()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),r)return n=null,r+""||null}return t="function"==typeof t?t:Is(t||ml),e="function"==typeof e?e:Is(void 0===e?64:+e),r.type=function(e){return arguments.length?(t="function"==typeof e?e:Is(e),r):t},r.size=function(t){return arguments.length?(e="function"==typeof t?t:Is(+t),r):e},r.context=function(t){return arguments.length?(n=null==t?null:t,r):n},r}().type((t=>Mp(t.shape||"circle"))).size((t=>Rp(t.size,64))),Yp=Op().x(Lp).y(Up).defined(qp).size((t=>t.size||1));function Vp(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Gp(t,e,n,r){return Wp.context(t)(e,n,r)}var Xp=1;function Jp(){Xp=1}function Zp(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+Xp++),a=i.clipping[o]||(i.clipping[o]={id:o});return Y(r)?a.path=r(null):Vp(n)?a.path=Gp(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function Qp(t){this.clear(),t&&this.union(t)}function Kp(t){this.mark=t,this.bounds=this.bounds||new Qp}function tg(t){Kp.call(this,t),this.items=this.items||[]}function eg(t){this._pending=0,this._loader=t||So()}function ng(t){t._pending+=1}function rg(t){t._pending-=1}function ig(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;t.expand(r+(n?function(t,e){return t.strokeJoin&&"miter"!==t.strokeJoin?0:e}(e,r):0))}return t}Qp.prototype={clone(){return new Qp(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,e,n,r){return nthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){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},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},rotate(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,e,n){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),l=e-e*u+n*s,c=n-e*s-n*u;return[u*r-s*i+l,s*r+u*i+c,u*r-s*a+l,s*r+u*a+c,u*o-s*i+l,s*o+u*i+c,u*o-s*a+l,s*o+u*a+c]},union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)},contains(t,e){return!(tthis.x2||ethis.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},st(tg,Kp),eg.prototype={pending(){return this._pending},sanitizeURL(t){const e=this;return ng(e),e._loader.sanitize(t,{context:"href"}).then((t=>(rg(e),t))).catch((()=>(rg(e),null)))},loadImage(t){const e=this,n=Jl();return ng(e),e._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!n)throw{url:r};const i=new n,o=it(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>rg(e),i.onerror=()=>rg(e),i.src=r,i})).catch((t=>(rg(e),{complete:!1,width:0,height:0,src:t&&t.url||""})))},ready(){const t=this;return new Promise((e=>{!function n(r){t.pending()?setTimeout((()=>{n(!0)}),10):e(r)}(!1)}))}};const og=dp-1e-8;let ag,ug,sg,lg,cg,fg,hg,dg;const pg=(t,e)=>ag.add(t,e),gg=(t,e)=>pg(ug=t,sg=e),mg=t=>pg(t,ag.y1),yg=t=>pg(ag.x1,t),vg=(t,e)=>cg*t+hg*e,_g=(t,e)=>fg*t+dg*e,xg=(t,e)=>pg(vg(t,e),_g(t,e)),bg=(t,e)=>gg(vg(t,e),_g(t,e));function wg(t,e){return ag=t,e?(lg=e*fp,cg=dg=Math.cos(lg),fg=Math.sin(lg),hg=-fg):(cg=dg=1,lg=fg=hg=0),kg}const kg={beginPath(){},closePath(){},moveTo:bg,lineTo:bg,rect(t,e,n,r){lg?(xg(t+n,e),xg(t+n,e+r),xg(t,e+r),bg(t,e)):(pg(t+n,e+r),gg(t,e))},quadraticCurveTo(t,e,n,r){const i=vg(t,e),o=_g(t,e),a=vg(n,r),u=_g(n,r);Ag(ug,i,a,mg),Ag(sg,o,u,yg),gg(a,u)},bezierCurveTo(t,e,n,r,i,o){const a=vg(t,e),u=_g(t,e),s=vg(n,r),l=_g(n,r),c=vg(i,o),f=_g(i,o);Mg(ug,a,s,c,mg),Mg(sg,u,l,f,yg),gg(c,f)},arc(t,e,n,r,i,o){if(r+=lg,i+=lg,ug=n*Math.cos(i)+t,sg=n*Math.sin(i)+e,Math.abs(i-r)>og)pg(t-n,e-n),pg(t+n,e+n);else{const a=r=>pg(n*Math.cos(r)+t,n*Math.sin(r)+e);let u,s;if(a(r),a(i),i!==r)if((r%=dp)<0&&(r+=dp),(i%=dp)<0&&(i+=dp),ii;++s,u-=hp)a(u);else for(u=r-r%hp+hp,s=0;s<4&&u1e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),l=(-a+s)/o,c=(-a-s)/o)):l=.5*u/a,0m)return!1;d>g&&(g=d)}else if(f>0){if(d0&&(t.globalAlpha=n,t.fillStyle=Lg(t,e,e.fill),!0)}var qg=[];function Pg(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Lg(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=e.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(e.strokeDash||qg),t.lineDashOffset=e.strokeDashOffset||0),!0))}function jg(t,e){return t.zindex-e.zindex||t.index-e.index}function Ig(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,o=[];for(n=0,r=i.length;n=0;)if(n=e(i[r]))return n;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Hg(t){return function(e,n,r){$g(n,(n=>{r&&!r.intersects(n.bounds)||Vg(t,e,n,n)}))}}function Yg(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Vg(t,e,n.items[0],n.items)}}function Vg(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Ng(e,n),n.fill&&Ug(e,n,i)&&e.fill(),n.stroke&&Pg(e,n,i)&&e.stroke()))}function Gg(t){return t=t||g,function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,Wg(n,(n=>{const u=n.bounds;if((!u||u.contains(o,a))&&u)return t(e,n,r,i,o,a)?n:void 0}))}}function Xg(t,e){return function(n,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,l=null==e?s.fill:e,c=s.stroke&&n.isPointInStroke;return c&&(a=s.strokeWidth,u=s.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=u?u:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function Jg(t){return Gg(Xg(t))}function Zg(t,e){return"translate("+t+","+e+")"}function Qg(t){return"rotate("+t+")"}function Kg(t){return Zg(t.x||0,t.y||0)}function tm(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,o=n.angle||0;t.translate(r,i),o&&t.rotate(o*=fp),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return Zg(t.x||0,t.y||0)+(t.angle?" "+Qg(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){return e(wg(t,n.angle),n),ig(t,n).translate(n.x||0,n.y||0)},draw:Hg(r),pick:Jg(r),isect:n||Fg(r)}}var em=tm("arc",(function(t,e){return Pp.context(t)(e)}));function nm(t,e,n){function r(t,n){t.beginPath(),e(t,n)}const i=Xg(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(wg(t),r),ig(t,r[0]))},draw:Yg(r),pick:function(t,e,n,r,o,a){var u=e.items,s=e.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,u,n,r)?u[0]:null)},isect:Sg,tip:n}}var rm=nm("area",(function(t,e){const n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Ip:jp).curve(up(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i)).5&&e<1.5?.5-Math.abs(e-1):0}function am(t,e){const n=om(e);t("d",Gp(null,e,n,n))}function um(t,e,n,r){const i=om(e);t.beginPath(),Gp(t,e,(n||0)+i,(r||0)+i)}const sm=Xg(um),lm=Xg(um,!1),cm=Xg(um,!0);var fm={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",Kg(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e{const r=e.x||0,i=e.y||0,o=e.strokeForeground,a=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&a&&(um(t,e,r,i),Ng(t,e),e.fill&&Ug(t,e,a)&&t.fill(),e.stroke&&!o&&Pg(t,e,a)&&t.stroke()),t.save(),t.translate(r,i),e.clip&&im(t,e),n&&n.translate(-r,-i),$g(e,(e=>{this.draw(t,e,n)})),n&&n.translate(r,i),t.restore(),o&&e.stroke&&a&&(um(t,e,r,i),Ng(t,e),Pg(t,e,a)&&t.stroke())}))},pick:function(t,e,n,r,i,o){if(e.bounds&&!e.bounds.contains(i,o)||!e.items)return null;const a=n*t.pixelRatio,u=r*t.pixelRatio;return Wg(e,(s=>{let l,c,f;const h=s.bounds;if(h&&!h.contains(i,o))return;c=s.x||0,f=s.y||0;const d=c+(s.width||0),p=f+(s.height||0),g=s.clip;if(g&&(id||op))return;if(t.save(),t.translate(c,f),c=i-c,f=o-f,g&&Vp(s)&&!cm(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,y=!1!==e.interactive;return y&&m&&s.stroke&&lm(t,s,a,u)?(t.restore(),s):(l=Wg(s,(t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?this.pick(t,n,r,c,f):null)),!l&&y&&(s.fill||!m&&s.stroke)&&sm(t,s,a,u)&&(l=s),t.restore(),l||null)}))},isect:Bg,content:function(t,e,n){t("clip-path",e.clip?Zp(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),am(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?am(t,e):t("d","")}},hm={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function dm(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 pm(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 gm(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 mm(t,e){return"center"===t?e/2:"right"===t?e:0}function ym(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var vm={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=dm(e,n),i=pm(e,r),o=gm(e,r),a=(e.x||0)-mm(e.align,i),u=(e.y||0)-ym(e.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",hm["xmlns:xlink"],"xlink:href"),t("transform",Zg(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=pm(e,n),i=gm(e,n),o=(e.x||0)-mm(e.align,r),a=(e.y||0)-ym(e.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,e,n){$g(e,(e=>{if(n&&!n.intersects(e.bounds))return;const r=dm(e,this);let i,o,a,u,s=pm(e,r),l=gm(e,r),c=(e.x||0)-mm(e.align,s),f=(e.y||0)-ym(e.baseline,l);!1!==e.aspect&&(o=r.width/r.height,a=e.width/e.height,o==o&&a==a&&o!==a&&(a=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(r=t[o].y-e[1])*r{if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&Am(t,e,r)&&(Ng(t,e),t.stroke())}}))},pick:Gg((function(t,e,n,r){return!!t.isPointInStroke&&(Am(t,e,1)&&t.isPointInStroke(n,r))})),isect:Tg},Em=tm("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),Dm=tm("symbol",(function(t,e){return Hp.context(t)(e)}),Sg);const Cm=vt();var Fm={height:Om,measureWidth:zm,estimateWidth:Bm,width:Bm,canvas:Sm};function Sm(t){Fm.width=t&&Dg?zm:Bm}function Bm(t,e){return Tm(qm(t,e),Om(t))}function Tm(t,e){return~~(.8*t.length*e)}function zm(t,e){return Om(t)<=0||!(e=qm(t,e))?0:Nm(e,jm(t))}function Nm(t,e){const n="(".concat(e,") ").concat(t);let r=Cm.get(n);return void 0===r&&(Dg.font=e,r=Dg.measureText(t).width,Cm.set(n,r)),r}function Om(t){return null!=t.fontSize?+t.fontSize||0:11}function Rm(t){return null!=t.lineHeight?t.lineHeight:Om(t)+2}function Lm(t){return e=t.lineBreak&&t.text&&!_(t.text)?t.text.split(t.lineBreak):t.text,_(e)?e.length>1?e:e[0]:e;var e}function Um(t){const e=Lm(t);return(_(e)?e.length-1:0)*Rm(t)}function qm(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(Fm.width===zm){const e=jm(t);return t=>Nm(t,e)}{const e=Om(t);return t=>Tm(t,e)}}(t);if(r(e)>>1,r(e.slice(i))>n?u=i+1:s=i;return o+e.slice(u)}for(;u>>1),r(e.slice(0,i))Math.max(t,Fm.width(e,n))),0)):r=Fm.width(e,f),"center"===o?l-=r/2:"right"===o&&(l-=r),t.set(l+=u,c+=s,l+r,c+i),e.angle&&!n)t.rotate(e.angle*fp,u,s);else if(2===n)return t.rotatedPoints(e.angle*fp,u,s);return t}var Vm={arc:em,area:rm,group:fm,image:vm,line:_m,path:bm,rect:km,rule:Mm,shape:Em,symbol:Dm,text:{type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Im(e),o=Hm(e),a=o.x1,u=o.y1,s=e.angle||0;t("text-anchor",$m[e.align]||"start"),s?(n=Zg(a,u)+" "+Qg(s),(r||i)&&(n+=" "+Zg(r,i))):n=Zg(a+r,u+i),t("transform",n)},bound:Ym,draw:function(t,e,n){$g(e,(e=>{var r,i,o,a,u,s,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=jm(e),t.textAlign=e.align||"left",i=(r=Hm(e)).x1,o=r.y1,e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*fp),i=o=0),i+=e.dx||0,o+=(e.dy||0)+Im(e),s=Lm(e),Ng(t,e),_(s))for(u=Rm(e),a=0;a=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null}))};function Gm(t,e,n){var r=Vm[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Qp),t,n)}var Xm={mark:null};function Jm(t,e,n){var r,i,o,a,u=Vm[t.marktype],s=u.bound,l=t.items,c=l&&l.length;if(u.nested)return c?o=l[0]:(Xm.mark=t,o=Xm),a=Gm(o,s,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new Qp,c)for(r=0,i=l.length;re;)t.removeChild(n[--r]);return t}function uy(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function sy(t,e){const n=e.getBoundingClientRect();return[t.clientX-n.left-(e.clientLeft||0),t.clientY-n.top-(e.clientTop||0)]}function ly(t,e){this._active=null,this._handlers={},this._loader=t||So(),this._tooltip=e||cy}function cy(t,e,n,r){t.element().setAttribute("title",r||"")}function fy(t){this._el=null,this._bgcolor=null,this._loader=new eg(t)}ey.prototype={toJSON(t){return Qm(this.root,t||0)},mark(t,e,n){const r=ny(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r}},ly.prototype={initialize(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},scene(t){return arguments.length?(this._scene=t,this):this._scene},on(){},off(){},_handlerIndex(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1},handlers(t){const e=this._handlers,n=[];if(t)n.push(...e[this.eventName(t)]);else for(const t in e)n.push(...e[t]);return n},eventName(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)},handleHref(t,e,n){this._loader.sanitize(n,{context:"href"}).then((e=>{const n=new MouseEvent(t.type,t),r=ry(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)})).catch((()=>{}))},handleTooltip(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,o,a=t&&t.mark;if(a&&(i=Vm[a.marktype]).tip){for((o=sy(e,n))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}},getItemBoundingClientRect(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+n.left,s=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}},fy.prototype={initialize(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)},element(){return this._el},canvas(){return this._el&&this._el.firstChild},background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},resize(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this},dirty(){},render(t){const e=this;return e._call=function(){e._render(t)},e._call(),e._call=null,e},_render(){},renderAsync(t){const e=this.render(t);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)},_load(t,e){var n=this,r=n._loader[t](e);if(!n._ready){const t=n._call;n._ready=n._loader.ready().then((e=>{e&&t(),n._ready=null}))}return r},sanitizeURL(t){return this._load("sanitizeURL",t)},loadImage(t){return this._load("loadImage",t)}};const hy="dragenter",dy="dragleave",py="dragover",gy="mousedown",my="mousemove",yy="mouseout",vy="mouseover",_y="click",xy="mousewheel",by="touchstart",wy="touchmove",ky="touchend",Ay=my,My=yy,Ey=_y;function Dy(t,e){ly.call(this,t,e),this._down=null,this._touch=null,this._first=!0,this._events={}}function Cy(t,e){(t=>t===by||t===wy||t===ky?[by,wy,ky]:[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 Fy(t,e,n){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||this.fire(n,r),this._active=o,this.fire(e,r)),this.fire(t,r)}}function Sy(t){return function(e){this.fire(t,e),this._active=null}}st(Dy,ly,{initialize(t,e,n){return this._canvas=t&&iy(t,"canvas"),[_y,gy,my,yy,dy].forEach((t=>Cy(this,t))),ly.prototype.initialize.call(this,t,e,n)},canvas(){return this._canvas},context(){return this._canvas.getContext("2d")},events:["keydown","keypress","keyup",hy,dy,py,gy,"mouseup",my,yy,vy,_y,"dblclick","wheel",xy,by,wy,ky],DOMMouseScroll(t){this.fire(xy,t)},mousemove:Fy(my,vy,yy),dragover:Fy(py,hy,dy),mouseout:Sy(yy),dragleave:Sy(dy),mousedown(t){this._down=this._active,this.fire(gy,t)},click(t){this._down===this._active&&(this.fire(_y,t),this._down=null)},touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(by,t,!0)},touchmove(t){this.fire(wy,t,!0)},touchend(t){this.fire(ky,t,!0),this._touch=null},fire(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===Ey&&r&&r.href?this.handleHref(e,r,r.href):t!==Ay&&t!==My||this.handleTooltip(e,r,t!==My),i)for(let t=0,n=i.length;t=0&&r.splice(i,1),this},pickEvent(t){const e=sy(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])},pick(t,e,n,r,i){const o=this.context();return Vm[t.marktype].pick.call(this,o,t,e,n,r,i)}});var By="undefined"!=typeof window&&window.devicePixelRatio||1;function Ty(t){fy.call(this,t),this._options={},this._redraw=!1,this._dirty=new Qp,this._tempb=new Qp}const zy=fy.prototype;function Ny(t,e){ly.call(this,t,e);const n=this;n._hrefHandler=Oy(n,((t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=Oy(n,((t,e)=>{n.handleTooltip(t,e,t.type!==My)}))}st(Ty,fy,{initialize(t,e,n,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:Xl(1,1,this._options.type),t&&this._canvas&&(ay(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),zy.initialize.call(this,t,e,n,r,i)},resize(t,e,n,r){if(zy.resize.call(this,t,e,n,r),this._canvas)!function(t,e,n,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?By:i;t.width=e*s,t.height=n*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=e+"px",t.style.height=n+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||s("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},canvas(){return this._canvas},context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)},dirty(t){const e=this._tempb.clear().union(t.bounds);let n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)},_render(t){const e=this.context(),n=this._origin,r=this._width,i=this._height,o=this._dirty,a=((t,e,n)=>(new Qp).set(0,0,e,n).translate(-t[0],-t[1]))(n,r,i);e.save();const u=this._redraw||o.empty()?(this._redraw=!1,a.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,a.intersect(o),n);return this.clear(-n[0],-n[1],r,i),this.draw(e,t,u),e.restore(),o.clear(),this},draw(t,e,n){const r=Vm[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),Y(n)?(t.beginPath(),n(t),t.clip()):im(t,e.group)}(t,e),r.draw.call(this,t,e,n),e.clip&&t.restore()},clear(t,e,n,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,e,n,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,e,n,r))}});const Oy=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)};st(Ny,ly,{initialize(t,e,n){let r=this._svg;return r&&(r.removeEventListener(Ey,this._hrefHandler),r.removeEventListener(Ay,this._tooltipHandler),r.removeEventListener(My,this._tooltipHandler)),this._svg=r=t&&iy(t,"svg"),r&&(r.addEventListener(Ey,this._hrefHandler),r.addEventListener(Ay,this._tooltipHandler),r.addEventListener(My,this._tooltipHandler)),ly.prototype.initialize.call(this,t,e,n)},canvas(){return this._svg},on(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:Oy(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this},off(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}});const Ry="aria-hidden",Ly="aria-label",Uy="role",qy="aria-roledescription",Py="graphics-object",jy="graphics-symbol",Iy=(t,e,n)=>({[Uy]:t,[qy]:e,[Ly]:n||void 0}),$y=Ct(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Wy={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?Xy(t):null,i=t.context,o=i.scales[e.scale].value,a=i.dataflow.locale(),u=o.type;return"".concat("left"===n||"right"===n?"Y":"X","-axis")+(r?" titled '".concat(r,"'"):"")+" for a ".concat(_d(u)?"discrete":u," scale")+" with ".concat(Kd(a,o,t))}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?Xy(t):null,r="".concat(e.type||""," legend").trim(),i=e.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?" titled '".concat(n,"'"):"")+" for ".concat(function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+M(t)}(o))+" with ".concat(Kd(s,u,t));var l}},"title-text":{desc:"title",caption:t=>"Title text '".concat(Gy(t),"'")},"title-subtitle":{desc:"subtitle",caption:t=>"Subtitle text '".concat(Gy(t),"'")}},Hy={ariaRole:Uy,ariaRoleDescription:qy,description:Ly};function Yy(t,e){const n=!1===e.aria;if(t(Ry,n||void 0),n||null==e.description)for(const e in Hy)t(Hy[e],void 0);else{const n=e.mark.marktype;t(Ly,e.description),t(Uy,e.ariaRole||("group"===n?Py:jy)),t(qy,e.ariaRoleDescription||"".concat(n," mark"))}}function Vy(t){return!1===t.aria?{[Ry]:!0}:$y[t.role]?null:Wy[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return Iy(e.role||jy,e.desc,n.description||r(n))}catch(t){return null}}(t,Wy[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some((t=>null!=t.description&&!1!==t.aria));return Iy(n?Py:jy,"".concat(e," mark container"),t.description)}(t)}function Gy(t){return W(t.text).join(" ")}function Xy(t){try{return W(M(t.items).items[0].text).join(" ")}catch(t){return null}}const Jy=t=>(t+"").replace(/&/g,"&").replace(//g,">");function Zy(){let t="",e="",n="";const r=[],i=()=>e=n="",o=(t,n)=>(null!=n&&(e+=" ".concat(t,'="').concat(Jy(n).replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
"),'"')),a),a={open(u,...s){(o=>{e&&(t+="".concat(e,">").concat(n),i()),r.push(o)})(u),e="<"+u;for(const t of s)for(const e in t)o(e,t[e]);return a},close(){const o=r.pop();return t+=e?e+(n?">".concat(n,""):"/>"):""),i(),a},attr:o,text:t=>(n+=Jy(t),a),toString:()=>t};return a}const Qy=t=>Ky(Zy(),t)+"";function Ky(t,e){if(t.open(e.tagName),e.hasAttributes()){const n=e.attributes,r=n.length;for(let e=0;e1&&t.previousSibling!=e}(a,n))&&e.insertBefore(a,n?n.nextSibling:e.firstChild),a}st(iv,fy,{initialize(t,e,n,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=oy(t,0,"svg",rv),this._svg.setAttributeNS(nv,"xmlns",rv),this._svg.setAttributeNS(nv,"xmlns:xlink",hm["xmlns:xlink"]),this._svg.setAttribute("version",hm.version),this._svg.setAttribute("class","marks"),ay(t,1),this._root=oy(this._svg,0,"g",rv),gv(this._root,ev),ay(this._svg,1)),this.background(this._bgcolor),ov.initialize.call(this,t,e,n,r,i)},background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),ov.background.apply(this,arguments)},resize(t,e,n,r){return ov.resize.call(this,t,e,n,r),this._svg&&(gv(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(this._height)}),this._root.setAttribute("transform","translate(".concat(this._origin,")"))),this._dirty=[],this},canvas(){return this._svg},svg(){const t=this._svg,e=this._bgcolor;if(!t)return null;let n;e&&(t.removeAttribute("style"),n=oy(t,0,"rect",rv),gv(n,{width:this._width,height:this._height,fill:e}));const r=Qy(t);return e&&(t.removeChild(n),this._svg.style.setProperty("background-color",e)),r},_render(t){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t),ay(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this},dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},isDirty(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const e=++this._dirtyID;let n,r,i,o,a,u,s;for(a=0,u=t.length;a{t.dirty=e}))),r.zdirty||(n.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):n._svg&&(s=n._svg.parentNode,s&&s.removeChild(n._svg)),n._svg=null):(n=o.nested?r.items[0]:n,n._update!==e&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,av(n,e)),n._update=e)));return!this._dirtyAll},mark(t,e,n){if(!this.isDirty(e))return e._svg;const r=this._svg,i=Vm[e.marktype],o=!1===e.interactive?"none":null,a="g"===i.tag;let u=null,s=0;const l=lv(e,t,n,"g",r);l.setAttribute("class",uy(e));const c=Vy(e);for(const t in c)mv(l,t,c[t]);a||mv(l,"pointer-events",o),mv(l,"clip-path",e.clip?Zp(this,e,e.group):null);const f=t=>{const e=this.isDirty(t),n=lv(t,l,u,i.tag,r);e&&(this._update(i,n,t),a&&function(t,e,n){e=e.lastChild.previousSibling;let r,i=0;$g(n,(n=>{r=t.mark(e,n,r),++i})),ay(e,1+i)}(this,n,t)),u=n,++s};return i.nested?e.items.length&&f(e.items[0]):$g(e,f),ay(l,s),l},_update(t,e,n){cv=e,fv=e.__values__,Yy(dv,n),t.attr(dv,n,this);const r=hv[t.type];r&&r.call(this,t,e,n),cv&&this.style(cv,n)},style(t,e){if(null!=e)for(const n in tv){let r="font"===n?Pm(e):e[n];if(r===fv[n])continue;const i=tv[n];null==r?t.removeAttribute(i):(np(r)&&(r=rp(r,this._defs.gradient,yv())),t.setAttribute(i,r+"")),fv[n]=r}},defs(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=oy(t,1,"defs",rv)),r=uv(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=oy(t,1,"defs",rv)),r=sv(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):ay(n,r))},_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}});let cv=null,fv=null;const hv={group(t,e,n){const r=cv=e.childNodes[2];fv=r.__values__,t.foreground(dv,n,this),fv=e.__values__,cv=e.childNodes[1],t.content(dv,n,this);const i=cv=e.childNodes[0];t.background(dv,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==fv.events&&(mv(r,"pointer-events",o),mv(i,"pointer-events",o),fv.events=o),n.strokeForeground&&n.stroke){const t=n.fill;mv(r,"display",null),this.style(i,n),mv(i,"stroke",null),t&&(n.fill=null),fv=r.__values__,this.style(r,n),t&&(n.fill=t),cv=null}else mv(r,"display","none")},image(t,e,n){!1===n.smooth?(pv(e,"image-rendering","optimizeSpeed"),pv(e,"image-rendering","pixelated")):pv(e,"image-rendering",null)},text(t,e,n){const r=Lm(n);let i,o,a,u;_(r)?(o=r.map((t=>qm(n,t))),i=o.join("\n"),i!==fv.text&&(ay(e,0),a=e.ownerDocument,u=Rm(n),o.forEach(((t,r)=>{const i=ry(a,"tspan",rv);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),e.appendChild(i)})),fv.text=i)):(o=qm(n,r),o!==fv.text&&(e.textContent=o,fv.text=o)),mv(e,"font-family",Pm(n)),mv(e,"font-size",Om(n)+"px"),mv(e,"font-style",n.fontStyle),mv(e,"font-variant",n.fontVariant),mv(e,"font-weight",n.fontWeight)}};function dv(t,e,n){e!==fv[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(cv,t,e,n):mv(cv,t,e),fv[t]=e)}function pv(t,e,n){n!==fv[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),fv[e]=n)}function gv(t,e){for(const n in e)mv(t,n,e[n])}function mv(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function yv(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function vv(t){fy.call(this,t),this._text=null,this._defs={gradient:{},clipping:{}}}st(vv,fy,{svg(){return this._text},_render(t){const e=Zy();e.open("svg",tt({},hm,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 ".concat(this._width," ").concat(this._height)}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&e.open("rect",{width:this._width,height:this._height,fill:n}).close(),e.open("g",ev,{transform:"translate("+this._origin+")"}),this.mark(e,t),e.close(),this.defs(e),this._text=e.close()+"",this},mark(t,e){const n=Vm[e.marktype],r=n.tag,i=[Yy,n.attr];t.open("g",{class:uy(e),"clip-path":e.clip?Zp(this,e,e.group):null},Vy(e),{"pointer-events":"g"!==r&&!1===e.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(e,o,i,"g"!==r?r:null)),"text"===r){const e=Lm(o);if(_(e)){const n={x:0,dy:Rm(o)};for(let r=0;rthis.mark(t,e))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(e,o,n.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(e,o,n.foreground,"bgfore")).close()}t.close(),a&&t.close()};return n.nested?e.items&&e.items.length&&o(e.items[0]):$g(e,o),t.close()},href(t){const e=t.href;let n;if(e){if(n=this._hrefs&&this._hrefs[e])return n;this.sanitizeURL(e).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[e]=t}))}return null},attr(t,e,n,r){const i={},o=(t,e,n,r)=>{i[r||t]=e};return Array.isArray(n)?n.forEach((t=>t(o,e,this))):n(o,e,this),r&&function(t,e,n,r,i){if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(t.style="image-rendering: optimizeSpeed; image-rendering: pixelated;");"text"===r&&(t["font-family"]=Pm(e),t["font-size"]=Om(e)+"px",t["font-style"]=e.fontStyle,t["font-variant"]=e.fontVariant,t["font-weight"]=e.fontWeight);for(const n in tv){let r=e[n];const o=tv[n];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(np(r)&&(r=rp(r,i.gradient,"")),t[o]=r)}}(i,e,t,r,this._defs),i},defs(t){const e=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(e).length+Object.keys(n).length){t.open("defs");for(const n in e){const r=e[n],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:ep+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),t.close(),t.open("radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let e=0;e1?(wv[t]=e,this):wv[t]}function Av(t,e,n){const r=[],i=(new Qp).union(e),o=t.marktype;return o?Mv(t,i,n,r):"group"===o?Ev(t,i,n,r):s("Intersect scene must be mark node or group item.")}function Mv(t,e,n,r){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 i=t.items,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!Sv(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function Bv(t,e){return Sv(cp(t),cp(e))}const Tv="top",zv="left",Nv="right",Ov="bottom",Rv="start",Lv="middle",Uv="end",qv="group",Pv="axis",jv="title",Iv="frame",$v="scope",Wv="legend",Hv="row-header",Yv="row-footer",Vv="row-title",Gv="column-header",Xv="column-footer",Jv="column-title",Zv="padding",Qv="fit",Kv="fit-x",t_="fit-y",e_="none",n_="all",r_="each",i_="flush",o_="column",a_="row";function u_(t){ga.call(this,null,t)}function s_(t,e,n){return e(t.bounds.clear(),t,n)}st(u_,ga,{transform(t,e){const n=e.dataflow,r=t.mark,i=r.marktype,o=Vm[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&n.dirty(r.items[0]),s=s_(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===qv||t.modified())switch(e.visit(e.MOD,(t=>n.dirty(t))),s.clear(),r.items.forEach((t=>s.union(s_(t,a)))),r.role){case Pv:case Wv:case jv:e.reflow()}else u=e.changed(e.REM),e.visit(e.ADD,(t=>{s.union(s_(t,a))})),e.visit(e.MOD,(t=>{u=u||s.alignsWith(t.bounds),n.dirty(t),s.union(s_(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Fv(r),e.modifies("bounds")}});const l_=":vega_identifier:";function c_(t){ga.call(this,0,t)}function f_(t){ga.call(this,null,t)}function h_(t){ga.call(this,null,t)}c_.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},st(c_,ga,{transform(t,e){const n=(i=e.dataflow)._signals[l_]||(i._signals[l_]=i.add(0)),r=t.as;var i;let o=n.value;return e.visit(e.ADD,(t=>t[r]=t[r]||++o)),n.set(this.value=o),e}}),st(f_,ga,{transform(t,e){let n=this.value;n||(n=e.dataflow.scenegraph().mark(t.markdef,function(t){const e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index),n.group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);const r=n.marktype===qv?tg:Kp;return e.visit(e.ADD,(t=>r.call(t,n))),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e}});const d_={parity:t=>t.filter(((t,e)=>e%2?t.opacity=0:1)),greedy:(t,e)=>{let n;return t.filter(((t,r)=>r&&p_(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)))}},p_=(t,e,n)=>n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),g_=(t,e)=>{for(var n,r=1,i=t.length,o=t[0].bounds;r{const e=t.bounds;return e.width()>1&&e.height()>1},y_=t=>(t.forEach((t=>t.opacity=1)),t),v_=(t,e)=>t.reflow(e.modified()).modifies("opacity");function __(t){ga.call(this,null,t)}st(h_,ga,{transform(t,e){const n=d_[t.method]||d_.parity,r=t.separation||0;let i,o,a=e.materialize(e.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(y_(a),e=v_(e,t)),e;if(a=a.filter(m_),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=y_(a),e=v_(e,t),i.length>=3&&g_(i,r)){do{i=n(i,r)}while(i.length>=3&&g_(i,r));i.length<3&&!M(a).opacity&&(i.length>1&&(M(i).opacity=0),M(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,e,n)=>{var r=t.range(),i=new Qp;return e===Tv||e===Ov?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),e}}),st(__,ga,{transform(t,e){const n=e.dataflow;if(e.visit(e.ALL,(t=>n.dirty(t))),e.fields&&e.fields.zindex){const t=e.source&&e.source[0];t&&(t.mark.zdirty=!0)}}});const x_=new Qp;function b_(t,e,n){return t[e]===n?0:(t[e]=n,1)}function w_(t){var e=t.items[0].orient;return e===zv||e===Nv}function k_(t,e,n,r){var i,o,a=e.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,l=a.orient,c=function(t){let e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(u),f=a.range,h=a.offset,d=a.position,p=a.minExtent,g=a.maxExtent,m=u.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,_=m&&Um(m),x=0,b=0;switch(x_.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(a.items[i].bounds),(i=c[1])>-1&&v.union(a.items[i].bounds),l){case Tv:x=d||0,b=-h,o=Math.max(p,Math.min(g,-v.y1)),v.add(0,-o).add(f,0),m&&A_(t,m,o,y,_,0,-1,v);break;case zv:x=-h,b=d||0,o=Math.max(p,Math.min(g,-v.x1)),v.add(-o,0).add(0,f),m&&A_(t,m,o,y,_,1,-1,v);break;case Nv:x=n+h,b=d||0,o=Math.max(p,Math.min(g,v.x2)),v.add(0,0).add(o,f),m&&A_(t,m,o,y,_,1,1,v);break;case Ov:x=d||0,b=r+h,o=Math.max(p,Math.min(g,v.y2)),v.add(0,0).add(f,o),m&&A_(t,m,o,y,0,0,1,v);break;default:x=a.x,b=a.y}return ig(v.translate(x,b),a),b_(a,"x",x+s)|b_(a,"y",b+s)&&(a.bounds=x_,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function A_(t,e,n,r,i,o,a,u){const s=e.bounds;if(e.auto){const u=a*(n+i+r);let l=0,c=0;t.dirty(e),o?l=(e.x||0)-(e.x=u):c=(e.y||0)-(e.y=u),e.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(e)}u.union(s)}const M_=(t,e)=>Math.floor(Math.min(t,e)),E_=(t,e)=>Math.ceil(Math.max(t,e));function D_(t){return(new Qp).set(0,0,t.width||0,t.height||0)}function C_(t){const e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function F_(t,e,n){const r=x(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function S_(t){return t<0?Math.ceil(-t):0}function B_(t,e,n){var r,i,o,a,u,s,l,c,f,h,d,p=!n.nodirty,g=n.bounds===i_?D_:C_,m=x_.set(0,0,0,0),y=F_(n.align,o_),v=F_(n.align,a_),_=F_(n.padding,o_),x=F_(n.padding,a_),b=n.columns||e.length,w=b<=0?1:Math.ceil(e.length/b),k=e.length,A=Array(k),M=Array(b),E=0,D=Array(k),C=Array(w),F=0,S=Array(k),B=Array(k),T=Array(k);for(i=0;i1)for(i=0;i0&&(S[i]+=f/2);if(v&&F_(n.center,a_)&&1!==b)for(i=0;i0&&(B[i]+=h/2);for(i=0;ii&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),A+=o,g=0,y=e.length;g=0&&null==(x=n[m]);m-=h);u?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=A):(b=A,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),v.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=a(M,v[l])}return M}function R_(t,e,n,r,i,o){if(e){t.dirty(e);var a=n,u=n;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),e.bounds.translate(a-(e.x||0),u-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=a,e.y=u,t.dirty(e)}}function L_(t,e,n,r,i,o,a){const u=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),s=function(t,e){let n=-1/0;return t.forEach((t=>{null!=t.offset&&(n=Math.max(n,t.offset))})),n>-1/0?n:e}(t,u("offset",0)),l=u("anchor",Rv),c=l===Uv?1:l===Lv?.5:0,f={align:r_,bounds:u("bounds",i_),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(e){case zv:f.anchor={x:Math.floor(r.x1)-s,column:Uv,y:c*(a||r.height()+2*r.y1),row:l};break;case Nv:f.anchor={x:Math.ceil(r.x2)+s,y:c*(a||r.height()+2*r.y1),row:l};break;case Tv:f.anchor={y:Math.floor(i.y1)-s,row:Uv,x:c*(o||i.width()+2*i.x1),column:l};break;case Ov:f.anchor={y:Math.ceil(i.y2)+s,x:c*(o||i.width()+2*i.x1),column:l};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:o-s,y:s,column:Uv};break;case"bottom-left":f.anchor={x:s,y:a-s,row:Uv};break;case"bottom-right":f.anchor={x:o-s,y:a-s,column:Uv,row:Uv}}return f}function U_(t,e){var n,r,i=e.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,l=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,e,n){var r=e.padding,i=r-n.x,o=r-n.y;if(e.datum.title){var a=e.items[1].items[0],u=a.anchor,s=e.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case zv:i+=Math.ceil(a.bounds.width())+s;break;case Nv:case Ov:break;default:o+=a.bounds.height()+s}switch((i||o)&&P_(t,n,i,o),a.orient){case zv:c+=q_(e,n,a,u,1,1);break;case Nv:l+=q_(e,n,a,Uv,0,0)+s,c+=q_(e,n,a,u,1,1);break;case Ov:l+=q_(e,n,a,u,0,0),c+=q_(e,n,a,Uv,-1,0,1)+s;break;default:l+=q_(e,n,a,u,0,0)}(l||c)&&P_(t,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(P_(t,n,-l,0),P_(t,a,-l,0))}else(i||o)&&P_(t,n,i,o)}(t,i,i.items[0].items[0]),u=function(t,e){return t.items.forEach((t=>e.union(t.bounds))),e.x1=t.padding,e.y1=t.padding,e}(i,u),n=2*i.padding,r=2*i.padding,u.empty()||(n=Math.ceil(u.width()+n),r=Math.ceil(u.height()+r)),"symbol"===o.type&&function(t){const e=t.reduce(((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t)),{});t.forEach((t=>{t.width=e[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==e_&&(i.x=s=0,i.y=l=0),i.width=n,i.height=r,ig(u.set(s,l,s+n,l+r),i),i.mark.bounds.clear().union(u),i}function q_(t,e,n,r,i,o,a){const u="symbol"!==t.datum.type,s=n.datum.vgrad,l=(!u||!o&&s||a?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&o?l:0,f=s&&o?0:l,h=i<=0?0:Um(n);return Math.round(r===Rv?c:r===Uv?f-h:.5*(l-h))}function P_(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function j_(t){ga.call(this,null,t)}st(j_,ga,{transform(t,e){const n=e.dataflow;return t.mark.items.forEach((e=>{t.layout&&T_(n,e,t.layout),function(t,e,n){var r,i,o,a,u,s=e.items,l=Math.max(0,e.width||0),c=Math.max(0,e.height||0),f=(new Qp).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(a=0,u=s.length;a{(o=t.orient||Nv)!==e_&&(e[o]||(e[o]=[])).push(t)}));for(const r in e){const i=e[r];B_(t,i,L_(i,r,n.legends,h,d,l,c))}p.forEach((e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),n.autosize&&n.autosize.type===Qv)switch(e.orient){case zv:case Nv:f.add(r.x1,0).add(r.x2,0);break;case Tv:case Ov:f.add(0,r.y1).add(0,r.y2)}else f.union(r)}))}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var o,a=e.items[0],u=a.frame,s=a.orient,l=a.anchor,c=a.offset,f=a.padding,h=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],p=s===zv||s===Nv?r:n,g=0,m=0,y=0,v=0,_=0;if(u!==qv?s===zv?(g=i.y2,p=i.y1):s===Nv?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===zv&&(g=r,p=0),o=l===Rv?g:l===Uv?p:(g+p)/2,d&&d.text){switch(s){case Tv:case Ov:_=h.bounds.height()+f;break;case zv:v=h.bounds.width()+f;break;case Nv:v=-h.bounds.width()-f}x_.clear().union(d.bounds),x_.translate(v-(d.x||0),_-(d.y||0)),b_(d,"x",v)|b_(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(x_),d.mark.bounds.clear().union(x_),t.dirty(d)),x_.clear().union(d.bounds)}else x_.clear();switch(x_.union(h.bounds),s){case Tv:m=o,y=i.y1-x_.height()-c;break;case zv:m=i.x1-x_.width()-c,y=o;break;case Nv:m=i.x2+x_.width()+c,y=o;break;case Ov:m=o,y=i.y2+c;break;default:m=a.x,y=a.y}return b_(a,"x",m)|b_(a,"y",y)&&(x_.translate(m,y),t.dirty(a),a.bounds.clear().union(x_),e.bounds.clear().union(x_),t.dirty(a)),a.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,e.height||0),f=Math.max(0,Math.ceil(-n.y1));const h=Math.max(0,Math.ceil(n.x2-s)),d=Math.max(0,Math.ceil(n.y2-c));if(i.contains===Zv){const e=t.padding();a-=e.left+e.right,u-=e.top+e.bottom}o===e_?(l=0,f=0,s=a,c=u):o===Qv?(s=Math.max(0,a-l-h),c=Math.max(0,u-f-d)):o===Kv?(s=Math.max(0,a-l-h),u=c+f+d):o===t_?(a=s+l+h,c=Math.max(0,u-f-d)):"pad"===o&&(a=s+l+h,u=c+f+d);t._resizeView(a,u,s,c,[l,f],i.resize)}(t,e,f,n)}(n,e,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e}});var I_=Object.freeze({__proto__:null,bound:u_,identifier:c_,mark:f_,overlap:h_,render:__,viewlayout:j_});function $_(t){ga.call(this,null,t)}function W_(t){ga.call(this,null,t)}function H_(){return Uo({})}function Y_(t){ga.call(this,null,t)}function V_(t){ga.call(this,[],t)}st($_,ga,{transform(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,o=t.scale,a=Ud(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||jd(n,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?qd(o,t.values,a):Pd(o,a);return i&&(r.rem=i),i=s.map(((t,e)=>Uo({index:e/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(Uo({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),st(W_,ga,{transform(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||H_,o=t.key||Ro,a=this.value;return _(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&s("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=function(t){const e=at().test((t=>t.exit));return e.lookup=n=>e.get(t(n)),e}(o)),e.visit(e.ADD,(t=>{const e=o(t);let n=a.get(e);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),a.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(t=>{const e=o(t),n=a.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(t=>{const e=o(t),n=a.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),r}}),st(Y_,ga,{transform(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,o=e.encode;if(_(o)){if(!n.changed()&&!o.every((t=>i[t])))return e.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,u=i.update||m,s=i.enter||m,l=i.exit||m,c=(o&&!a?i[o]:u)||m;if(e.changed(e.ADD)&&(e.visit(e.ADD,(e=>{s(e,t),u(e,t)})),n.modifies(s.output),n.modifies(u.output),c!==m&&c!==u&&(e.visit(e.ADD,(e=>{c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==m&&(e.visit(e.REM,(e=>{l(e,t)})),n.modifies(l.output)),a||c!==m){const i=e.MOD|(t.modified()?e.REFLOW:0);a?(e.visit(i,(e=>{const i=s(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(s.output)):e.visit(i,(e=>{(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation}}),st(V_,ga,{transform(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,o,a,u=e.dataflow.locale(),s=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||Nd,f=t.scale,h=+t.limit,d=Ud(f,null==t.count?5:t.count,t.minstep),p=!!t.values||c===Nd,g=t.format||Yd(u,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||Hd(f,d);return l&&(s.rem=l),c===Nd?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),a=!0):l=m,Y(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),o=l.reduce(((e,n)=>Math.max(e,i(n,t))),0)):i=Q(o=i||8),l=l.map(((e,n)=>Uo({index:n,label:g(e,n,l),value:e,offset:o,size:i(e,t)}))),a&&(a=m[l.length],l.push(Uo({index:l.length,label:"…".concat(m.length-l.length," entries"),value:a,offset:o,size:i(a,t)})))):"gradient"===c?(n=f.domain(),r=Cd(f,n[0],M(n)),m.length<3&&!t.values&&n[0]!==M(n)&&(m=[n[0],M(n)]),l=m.map(((t,e)=>Uo({index:e,label:g(t,e,m),value:t,perc:r(t)})))):(i=m.length-1,r=function(t){const e=t.domain(),n=e.length-1;let r=+e[0],i=+M(e),o=i-r;if(t.type===Qh){const t=n?o/n:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),l=m.map(((t,e)=>Uo({index:e,label:g(t,e,m),value:t,perc:e?r(t):0,perc2:e===i?1:r(m[e+1])})))),s.source=l,s.add=l,this.value=l,s}});const G_=t=>t.source.x,X_=t=>t.source.y,J_=t=>t.target.x,Z_=t=>t.target.y;function Q_(t){ga.call(this,{},t)}Q_.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},st(Q_,ga,{transform(t,e){var n=t.sourceX||G_,r=t.sourceY||X_,i=t.targetX||J_,o=t.targetY||Z_,a=t.as||"path",u=t.orient||"vertical",l=t.shape||"line",c=nx.get(l+"-"+u)||nx.get(l);return c||s("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(t=>{t[a]=c(n(t),r(t),i(t),o(t))})),e.reflow(t.modified()).modifies(a)}});const K_=(t,e,n,r)=>"M"+t+","+e+"L"+n+","+r,tx=(t,e,n,r)=>{var i=n-t,o=r-e,a=Math.sqrt(i*i+o*o)/2;return"M"+t+","+e+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r},ex=(t,e,n,r)=>{const i=n-t,o=r-e,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+e+"C"+(t+a)+","+(e+u)+" "+(n+u)+","+(r-a)+" "+n+","+r},nx=at({line:K_,"line-radial":(t,e,n,r)=>K_(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),arc:tx,"arc-radial":(t,e,n,r)=>tx(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),curve:ex,"curve-radial":(t,e,n,r)=>ex(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(t,e,n,r)=>"M"+t+","+e+"V"+r+"H"+n,"orthogonal-vertical":(t,e,n,r)=>"M"+t+","+e+"H"+n+"V"+r,"orthogonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),u=Math.sin(n);return"M"+e*i+","+e*o+"A"+e+","+e+" 0 0,"+((Math.abs(n-t)>Math.PI?n<=t:n>t)?1:0)+" "+e*a+","+e*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,e,n,r)=>{const i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(t,e,n,r)=>{const i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),u=Math.sin(n),s=(e+r)/2;return"M"+e*i+","+e*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function rx(t){ga.call(this,null,t)}rx.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},st(rx,ga,{transform(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.field||p,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(s),d=h.length,g=l,m=(c-l)/Ue(h),y=Le(d);for(t.sort&&y.sort(((t,e)=>h[t]-h[e])),n=0;nt+(e<0?-1:e>0?1:0)),0))!==e.length&&n.warn("Log scale domain includes zero: "+kt(e)));return e}function sx(t,e,n){return Y(t)&&(e||n)?Md(t,lx(e||[0,1],n)):t}function lx(t,e){return e?t.slice().reverse():t}function cx(t){ga.call(this,null,t)}st(ax,ga,{transform(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if(n===Gh)return"sequential-linear";(function(t){const e=t.type;return vd(e)&&e!==Yh&&e!==Vh&&(t.scheme||t.range&&t.range.length&&t.range.every(gt))})(t)&&(r=2===(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?"sequential-":3===e?"diverging-":"");return(r+n||jh).toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=gd(i)()),t)if(!ox[i]){if("padding"===i&&ix(r.type))continue;Y(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){t!==ed&&t!==td&&s("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===td?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Ph(n,i,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,i=e.schemeExtent;_(e.scheme)?r=Ed(e.scheme,e.interpolate,e.interpolateGamma):(r=zd(e.scheme.toLowerCase()))||s("Unrecognized scheme name: ".concat(e.scheme));return n=t===Qh?n+1:t===nd?n-1:t===Jh||t===Zh?+e.schemeCount||5:n,wd(t)?sx(r,i,e.reverse):Y(r)?Dd(sx(r,i),n):t===Kh?r:r.slice(0,n)}(r,e,n),Y(o))){if(t.interpolator)return t.interpolator(o);s("Scale type ".concat(r," does not support interpolating color schemes."))}if(o&&wd(r))return t.interpolator(Ed(lx(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate(Fd(e.interpolate,e.interpolateGamma)):Y(t.round)?t.round(i):Y(t.rangeRound)&&t.interpolate(i?Bf:Sf);o&&t.range(lx(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!_(r)){const e=t.domain(),n=e[0],i=M(e),o=r.step;let a=null==r.start?n:r.start,u=null==r.stop?i:r.stop;o||s("Scale bins parameter missing step property."),ai&&(u=o*Math.floor(i/o)),r=Le(a,u+o/2,o)}r?t.bins=r:t.bins&&delete t.bins;t.type===nd&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){const r=function(t,e,n){return e?(t.domain(ux(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,o,a=e.domain,u=t.type,s=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&(e===jh||e===$h||e===Wh)}(t);if(!a)return 0;ix(u)&&e.padding&&a[0]!==M(a)&&(a=function(t,e,n,r,i,o){var a=Math.abs(M(n)-n[0]),u=a/(a-2*r),s=t===Ih?q(e,null,u):t===Wh?P(e,null,u,.5):t===$h?P(e,null,u,i||1):t===Hh?j(e,null,u,o||1):U(e,null,u);return(e=e.slice())[0]=s[0],e[e.length-1]=s[1],e}(u,a,e.range,e.padding,e.exponent,e.constant));if((s||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=e.domainMin&&(a[0]=e.domainMin),null!=e.domainMax&&(a[i]=e.domainMax),null!=e.domainMid)){const t=(o=e.domainMid)>a[i]?i+1:ot(s);if(null==e)d.push(t.slice());else for(i={},o=0,a=t.length;oh&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,o=n.max;r0?1:t<0?-1:0},qx=Math.sqrt,Px=Math.tan;function jx(t){return t>1?0:t<-1?wx:Math.acos(t)}function Ix(t){return t>1?kx:t<-1?-kx:Math.asin(t)}function $x(){}function Wx(t,e){t&&Yx.hasOwnProperty(t.type)&&Yx[t.type](t,e)}var Hx={Feature:function(t,e){Wx(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=Bx(e=(e*=Dx)/2+Ax),a=Lx(e),u=tb*a,s=Kx*o+u*Bx(i),l=u*r*Lx(i);hb.add(Sx(l,s)),Qx=t,Kx=o,tb=a}function _b(t){return[Sx(t[1],t[0]),Ix(t[2])]}function xb(t){var e=t[0],n=t[1],r=Bx(n);return[r*Bx(e),r*Lx(e),Lx(n)]}function bb(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function wb(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function kb(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ab(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Mb(t){var e=qx(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Eb,Db,Cb,Fb,Sb,Bb,Tb,zb,Nb,Ob,Rb,Lb,Ub,qb,Pb,jb,Ib={point:$b,lineStart:Hb,lineEnd:Yb,polygonStart:function(){Ib.point=Vb,Ib.lineStart=Gb,Ib.lineEnd=Xb,lb=new we,pb.polygonStart()},polygonEnd:function(){pb.polygonEnd(),Ib.point=$b,Ib.lineStart=Hb,Ib.lineEnd=Yb,hb<0?(eb=-(rb=180),nb=-(ib=90)):lb>xx?ib=90:lb<-1e-6&&(nb=-90),fb[0]=eb,fb[1]=rb},sphere:function(){eb=-(rb=180),nb=-(ib=90)}};function $b(t,e){cb.push(fb=[eb=t,rb=t]),eib&&(ib=e)}function Wb(t,e){var n=xb([t*Dx,e*Dx]);if(sb){var r=wb(sb,n),i=wb([r[1],-r[0],0],r);Mb(i),i=_b(i);var o,a=t-ob,u=a>0?1:-1,s=i[0]*Ex*u,l=Cx(a)>180;l^(u*obib&&(ib=o):l^(u*ob<(s=(s+360)%360-180)&&sib&&(ib=e)),l?tJb(eb,rb)&&(rb=t):Jb(t,rb)>Jb(eb,rb)&&(eb=t):rb>=eb?(trb&&(rb=t)):t>ob?Jb(eb,t)>Jb(eb,rb)&&(rb=t):Jb(t,rb)>Jb(eb,rb)&&(eb=t)}else cb.push(fb=[eb=t,rb=t]);eib&&(ib=e),sb=n,ob=t}function Hb(){Ib.point=Wb}function Yb(){fb[0]=eb,fb[1]=rb,Ib.point=$b,sb=null}function Vb(t,e){if(sb){var n=t-ob;lb.add(Cx(n)>180?n+(n>0?360:-360):n)}else ab=t,ub=e;pb.point(t,e),Wb(t,e)}function Gb(){pb.lineStart()}function Xb(){Vb(ab,ub),pb.lineEnd(),Cx(lb)>xx&&(eb=-(rb=180)),fb[0]=eb,fb[1]=rb,sb=null}function Jb(t,e){return(e-=t)<0?e+360:e}function Zb(t,e){return t[0]-e[0]}function Qb(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:ewx?t+Math.round(-t/Mx)*Mx:t,e]}function hw(t,e,n){return(t%=Mx)?e||n?cw(pw(t),gw(e,n)):pw(t):e||n?gw(e,n):fw}function dw(t){return function(e,n){return[(e+=t)>wx?e-Mx:e<-wx?e+Mx:e,n]}}function pw(t){var e=dw(t);return e.invert=dw(-t),e}function gw(t,e){var n=Bx(t),r=Lx(t),i=Bx(e),o=Lx(e);function a(t,e){var a=Bx(e),u=Bx(t)*a,s=Lx(t)*a,l=Lx(e),c=l*n+u*r;return[Sx(s*i-c*o,u*n-l*r),Ix(c*i+s*o)]}return a.invert=function(t,e){var a=Bx(e),u=Bx(t)*a,s=Lx(t)*a,l=Lx(e),c=l*i-s*o;return[Sx(s*i+l*o,u*n+c*r),Ix(c*n-u*r)]},a}function mw(t,e){(e=xb(e))[0]-=t,Mb(e);var n=jx(-e[1]);return((-e[2]<0?-n:n)+Mx-xx)%Mx}function yw(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:$x,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vw(t,e){return Cx(t[0]-e[0])=0;--o)i.point((c=l[o])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function bw(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r=0?1:-1,E=M*A,D=E>wx,C=m*w;if(s.add(Sx(C*M*Lx(E),y*k+C*Bx(E))),a+=D?A+M*Mx:A,D^p>=n^x>=n){var F=wb(xb(d),xb(_));Mb(F);var S=wb(o,F);Mb(S);var B=(D^A>=0?-1:1)*Ix(S[2]);(r>B||r===B&&(F[0]||F[1]))&&(u+=D^A>=0?1:-1)}}return(a<-1e-6||a0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t1&&2&s&&h.push(h.pop().concat(h.shift())),a.push(h.filter(Aw))}return h}}function Aw(t){return t.length>1}function Mw(t,e){return((t=t.x)[0]<0?t[1]-kx-xx:kx-t[1])-((e=e.x)[0]<0?e[1]-kx-xx:kx-e[1])}fw.invert=fw;var Ew=kw((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var u=o>0?wx:-wx,s=Cx(o-n);Cx(s-wx)0?kx:-kx),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),e=0):i!==u&&s>=wx&&(Cx(n-i)xx?Fx((Lx(e)*(o=Bx(r))*Lx(n)-Lx(r)*(i=Bx(e))*Lx(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),e=0),t.point(n=o,r=a),i=u},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*kx,r.point(-wx,i),r.point(0,i),r.point(wx,i),r.point(wx,0),r.point(wx,-i),r.point(0,-i),r.point(-wx,-i),r.point(-wx,0),r.point(-wx,i);else if(Cx(t[0]-e[0])>xx){var o=t[0]0,i=Cx(e)>xx;function o(t,n){return Bx(t)*Bx(n)>e}function a(t,n,r){var i=[1,0,0],o=wb(xb(t),xb(n)),a=bb(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var l=e*a/s,c=-e*u/s,f=wb(i,o),h=Ab(i,l);kb(h,Ab(o,c));var d=f,p=bb(h,d),g=bb(d,d),m=p*p-g*(bb(h,h)-1);if(!(m<0)){var y=qx(m),v=Ab(d,(-p-y)/g);if(kb(v,h),v=_b(v),!r)return v;var _,x=t[0],b=n[0],w=t[1],k=n[1];b0^v[1]<(Cx(v[0]-x)wx^(x<=v[0]&&v[0]<=b)){var E=Ab(d,(-p+y)/g);return kb(E,h),[v,_b(E)]}}}function u(e,n){var i=r?t:wx-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return kw(o,(function(t){var e,n,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=o(f,h),m=r?g?0:u(f,h):g?u(f+(f<0?wx:-wx),h):0;if(!e&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=a(e,p))||vw(e,d)||vw(p,d))&&(p[2]=1),g!==s)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;m&n||!(y=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&vw(e,p)||t.point(p[0],p[1]),e=p,s=g,n=m},lineEnd:function(){s&&t.lineEnd(),e=null},clean:function(){return c|(l&&s)<<1}}}),(function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var a=Bx(e),u=Lx(e),s=r*n;null==i?(i=e+r*Mx,o=e-s/2):(i=mw(a,i),o=mw(a,o),(r>0?io)&&(i+=r*Mx));for(var l,c=i;r>0?c>o:c0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+u+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return Cx(r[0]-t)0?0:3:Cx(r[0]-n)0?2:1:Cx(r[1]-e)0?1:0:i>0?3:2}function u(t,e){return s(t.x,e.x)}function s(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var s,l,c,f,h,d,p,g,m,y,v,_=a,x=yw(),b={point:w,lineStart:function(){b.point=k,l&&l.push(c=[]);y=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(k(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(h-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=v&&e,i=(s=Re(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&xw(s,u,e,o,a),a.polygonEnd());_=a,s=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function k(o,a){var u=i(o,a);if(l&&c.push([o,a]),y)f=o,h=a,d=u,y=!1,u&&(_.lineStart(),_.point(o,a));else if(u&&m)_.point(o,a);else{var s=[p=Math.max(Fw,Math.min(Cw,p)),g=Math.max(Fw,Math.min(Cw,g))],x=[o=Math.max(Fw,Math.min(Cw,o)),a=Math.max(Fw,Math.min(Cw,a))];!function(t,e,n,r,i,o){var a,u=t[0],s=t[1],l=0,c=1,f=e[0]-u,h=e[1]-s;if(a=n-u,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-u,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=h,h<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-s,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a0&&(t[0]=u+l*f,t[1]=s+l*h),c<1&&(e[0]=u+c*f,e[1]=s+c*h),!0}}}}}(s,x,t,e,n,r)?u&&(_.lineStart(),_.point(o,a),v=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),u||_.lineEnd(),v=!1)}p=o,g=a,m=u}return b}}function Bw(t,e,n){var r=Le(t,e-xx,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function Tw(t,e,n){var r=Le(t,e-xx,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}var zw,Nw,Ow,Rw,Lw=t=>t,Uw=new we,qw=new we,Pw={point:$x,lineStart:$x,lineEnd:$x,polygonStart:function(){Pw.lineStart=jw,Pw.lineEnd=Ww},polygonEnd:function(){Pw.lineStart=Pw.lineEnd=Pw.point=$x,Uw.add(Cx(qw)),qw=new we},result:function(){var t=Uw/2;return Uw=new we,t}};function jw(){Pw.point=Iw}function Iw(t,e){Pw.point=$w,zw=Ow=t,Nw=Rw=e}function $w(t,e){qw.add(Rw*t-Ow*e),Ow=t,Rw=e}function Ww(){$w(zw,Nw)}var Hw=1/0,Yw=Hw,Vw=-Hw,Gw=Vw,Xw={point:function(t,e){tVw&&(Vw=t);eGw&&(Gw=e)},lineStart:$x,lineEnd:$x,polygonStart:$x,polygonEnd:$x,result:function(){var t=[[Hw,Yw],[Vw,Gw]];return Vw=Gw=-(Yw=Hw=1/0),t}};var Jw,Zw,Qw,Kw,tk=0,ek=0,nk=0,rk=0,ik=0,ok=0,ak=0,uk=0,sk=0,lk={point:ck,lineStart:fk,lineEnd:pk,polygonStart:function(){lk.lineStart=gk,lk.lineEnd=mk},polygonEnd:function(){lk.point=ck,lk.lineStart=fk,lk.lineEnd=pk},result:function(){var t=sk?[ak/sk,uk/sk]:ok?[rk/ok,ik/ok]:nk?[tk/nk,ek/nk]:[NaN,NaN];return tk=ek=nk=rk=ik=ok=ak=uk=sk=0,t}};function ck(t,e){tk+=t,ek+=e,++nk}function fk(){lk.point=hk}function hk(t,e){lk.point=dk,ck(Qw=t,Kw=e)}function dk(t,e){var n=t-Qw,r=e-Kw,i=qx(n*n+r*r);rk+=i*(Qw+t)/2,ik+=i*(Kw+e)/2,ok+=i,ck(Qw=t,Kw=e)}function pk(){lk.point=ck}function gk(){lk.point=yk}function mk(){vk(Jw,Zw)}function yk(t,e){lk.point=vk,ck(Jw=Qw=t,Zw=Kw=e)}function vk(t,e){var n=t-Qw,r=e-Kw,i=qx(n*n+r*r);rk+=i*(Qw+t)/2,ik+=i*(Kw+e)/2,ok+=i,ak+=(i=Kw*t-Qw*e)*(Qw+t),uk+=i*(Kw+e),sk+=3*i,ck(Qw=t,Kw=e)}function _k(t){this._context=t}_k.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mx)}},result:$x};var xk,bk,wk,kk,Ak,Mk=new we,Ek={point:$x,lineStart:function(){Ek.point=Dk},lineEnd:function(){xk&&Ck(bk,wk),Ek.point=$x},polygonStart:function(){xk=!0},polygonEnd:function(){xk=null},result:function(){var t=+Mk;return Mk=new we,t}};function Dk(t,e){Ek.point=Ck,bk=kk=t,wk=Ak=e}function Ck(t,e){kk-=t,Ak-=e,Mk.add(qx(kk*kk+Ak*Ak)),kk=t,Ak=e}function Fk(){this._string=[]}function Sk(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Bk(t,e){var n,r,i=4.5;function o(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),Xx(t,n(r))),r.result()}return o.area=function(t){return Xx(t,n(Pw)),Pw.result()},o.measure=function(t){return Xx(t,n(Ek)),Ek.result()},o.bounds=function(t){return Xx(t,n(Xw)),Xw.result()},o.centroid=function(t){return Xx(t,n(lk)),lk.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,Lw):(t=e).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(e=null,new Fk):new _k(e=t),"function"!=typeof i&&r.pointRadius(i),o):e},o.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),o):i},o.projection(t).context(e)}function Tk(t){return function(e){var n=new zk;for(var r in t)n[r]=t[r];return n.stream=e,n}}function zk(){}function Nk(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Xx(n,t.stream(Xw)),e(Xw.result()),null!=r&&t.clipExtent(r),t}function Ok(t,e,n){return Nk(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,u=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,u])}),n)}function Rk(t,e,n){return Ok(t,[[0,0],e],n)}function Lk(t,e,n){return Nk(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function Uk(t,e,n){return Nk(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}Fk.prototype={_radius:4.5,_circle:Sk(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Sk(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},zk.prototype={constructor:zk,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var qk=Bx(30*Dx);function Pk(t,e){return+e?function(t,e){function n(r,i,o,a,u,s,l,c,f,h,d,p,g,m){var y=l-r,v=c-i,_=y*y+v*v;if(_>4*e&&g--){var x=a+h,b=u+d,w=s+p,k=qx(x*x+b*b+w*w),A=Ix(w/=k),M=Cx(Cx(w)-1)e||Cx((y*F+v*S)/_-.5)>.3||a*h+u*d+s*p2?t[2]%360*Dx:0,F()):[m*Ex,y*Ex,v*Ex]},D.angle=function(t){return arguments.length?(_=t%360*Dx,F()):_*Ex},D.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},D.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},D.precision=function(t){return arguments.length?(a=Pk(u,E=t*t),S()):qx(E)},D.fitExtent=function(t,e){return Ok(D,t,e)},D.fitSize=function(t,e){return Rk(D,t,e)},D.fitWidth=function(t,e){return Lk(D,t,e)},D.fitHeight=function(t,e){return Uk(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function Hk(t){var e=0,n=wx/3,r=Wk(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Dx,n=t[1]*Dx):[e*Ex,n*Ex]},i}function Yk(t,e){var n=Lx(t),r=(n+Lx(e))/2;if(Cx(r)2?t[2]*Dx:0),e.invert=function(e){return(e=t.invert(e[0]*Dx,e[1]*Dx))[0]*=Ex,e[1]*=Ex,e},e}(i.rotate()).invert([0,0]));return s(null==l?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===Kk?[[Math.max(u[0]-o,l),e],[Math.min(u[0]+o,n),r]]:[[l,Math.max(u[1]-o,e)],[n,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),c()):a()},i.translate=function(t){return arguments.length?(u(t),c()):u()},i.center=function(t){return arguments.length?(o(t),c()):o()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function eA(t){return Px((kx+t)/2)}function nA(t,e){var n=Bx(t),r=t===e?Lx(t):Ox(n/Bx(e))/Ox(eA(e)/eA(t)),i=n*Rx(eA(t),r)/r;if(!r)return Kk;function o(t,e){i>0?e<-kx+xx&&(e=-kx+xx):e>kx-xx&&(e=kx-xx);var n=i/Rx(eA(e),r);return[n*Lx(r*t),i-n*Bx(r*t)]}return o.invert=function(t,e){var n=i-e,o=Ux(r)*qx(t*t+n*n),a=Sx(t,Cx(n))*Ux(n);return n*r<0&&(a-=wx*Ux(t)*Ux(n)),[a/r,2*Fx(Rx(i/o,1/r))-kx]},o}function rA(t,e){return[t,e]}function iA(t,e){var n=Bx(t),r=t===e?Lx(t):(n-Bx(e))/(e-t),i=n/r+t;if(Cx(r)xx&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},dA.invert=Jk(Ix),pA.invert=Jk((function(t){return 2*Fx(t)})),gA.invert=function(t,e){return[-e,2*Fx(zx(t))-kx]};var mA=Math.abs,yA=Math.cos,vA=Math.sin,_A=Math.PI,xA=_A/2,bA=function(t){return t>0?Math.sqrt(t):0}(2);function wA(t){return t>1?xA:t<-1?-xA:Math.asin(t)}function kA(t,e){var n,r=t*vA(e),i=30;do{e-=n=(e+vA(e)-r)/(1+yA(e))}while(mA(n)>1e-6&&--i>0);return e/2}var AA=function(t,e,n){function r(r,i){return[t*r*yA(i=kA(n,i)),e*vA(i)]}return r.invert=function(r,i){return i=wA(i/e),[r/(t*yA(i)),wA((2*i+vA(2*i))/n)]},r}(bA/xA,bA,_A);const MA=Bk(),EA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function DA(t,e){return function n(){const r=e();return r.type=t,r.path=Bk().projection(r),r.copy=r.copy||function(){const t=n();return EA.forEach((e=>{r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}function CA(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(SA[t]=DA(t,e),this):SA[t]||null}function FA(t){return t&&t.path||MA}const SA={albers:Gk,albersusa:function(){var t,e,n,r,i,o,a=Gk(),u=Vk().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=Vk().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){o=[t,e]}};function c(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function f(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),u.stream(n),s.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(const t in SA)CA(t,SA[t]);function BA(){}const TA=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function zA(){var t=1,e=1,n=a;function r(t,e){return e.map((e=>i(t,e)))}function i(r,i){var a=[],u=[];return function(n,r,i){var a,u,s,l,c,f,h=new Array,d=new Array;a=u=-1,l=n[0]>=r,TA[l<<1].forEach(p);for(;++a=r,TA[s|l<<1].forEach(p);TA[l<<0].forEach(p);for(;++u=r,c=n[u*t]>=r,TA[l<<1|c<<2].forEach(p);++a=r,f=c,c=n[u*t+a+1]>=r,TA[s|l<<1|c<<2|f<<3].forEach(p);TA[l|c<<3].forEach(p)}a=-1,c=n[u*t]>=r,TA[c<<2].forEach(p);for(;++a=r,TA[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],l=o(r),c=o(s);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(s),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(s),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(s),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,s]}}TA[c<<3].forEach(p)}(r,i,(t=>{n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var e,n=0,r=a.length;n{var o,a=n[0],u=n[1],s=0|a,l=0|u,c=r[l*t+s];a>0&&a0&&u=0&&o>=0||s("invalid size"),t=i,e=o,r},r.smooth=function(t){return arguments.length?(n=t?a:BA,r):n===a},r}function NA(t,e){for(var n,r=-1,i=e.length;++rr!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function RA(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function LA(t,e,n){return function(r){var i=et(r),o=n?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=e?Ce(o,a,t):u/(t+1);return Le(o+s,a,s)}}function UA(t){ga.call(this,null,t)}function qA(t,e,n,r,i){const o=t.x1||0,a=t.y1||0,u=e*n<0;function s(t){t.forEach(l)}function l(t){u&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-o)*e+r,t[1]=(t[1]-a)*n+i}return function(t){return t.coordinates.forEach(s),t}}function PA(t,e,n){const r=t>=0?t:wa(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function jA(t){return Y(t)?t:Q(+t)}function IA(){var t=t=>t[0],e=t=>t[1],n=p,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const l=PA(r[0],u,t)>>a,c=PA(r[1],u,e)>>a,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>a),p=2*h+(o>>a),g=new Float32Array(d*p),m=new Float32Array(d*p);let y=g;u.forEach((r=>{const i=f+(+t(r)>>a),o=h+(+e(r)>>a);i>=0&&i=0&&o0&&c>0?($A(d,p,g,m,l),WA(d,p,m,g,c),$A(d,p,g,m,l),WA(d,p,m,g,c),$A(d,p,g,m,l),WA(d,p,m,g,c)):l>0?($A(d,p,g,m,l),$A(d,p,m,g,l),$A(d,p,g,m,l),y=m):c>0&&(WA(d,p,g,m,c),WA(d,p,m,g,c),WA(d,p,g,m,c),y=m);const v=s?Math.pow(2,-2*a):1/Ue(y);for(let t=0,e=d*p;t>a),y2:h+(o>>a)}}return u.x=function(e){return arguments.length?(t=jA(e),u):t},u.y=function(t){return arguments.length?(e=jA(t),u):e},u.weight=function(t){return arguments.length?(n=jA(t),u):n},u.size=function(t){if(!arguments.length)return[i,o];var e=+t[0],n=+t[1];return e>=0&&n>=0||s("invalid size"),i=e,o=n,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||s("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<=i&&(e>=o&&(u-=n[e-o+a*t]),r[e-i+a*t]=u/Math.min(e+1,t-1+o-e,o))}function WA(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a=i&&(u>=o&&(s-=n[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,e-1+o-u,o))}function HA(t){ga.call(this,null,t)}UA.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},st(UA,ga,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||h,o=zA().smooth(!1!==t.smooth),a=t.thresholds||function(t,e,n){const r=LA(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map((t=>Fe(e(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((e=>{const n=i(e),r=o.size([n.width,n.height])(n.values,_(a)?a:a(n.values));!function(t,e,n,r){let i=r.scale||e.scale,o=r.translate||e.translate;Y(i)&&(i=i(n,r));Y(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(dt(i)?i:i[0])||1,u=(dt(i)?i:i[1])||1,s=o&&o[0]||0,l=o&&o[1]||0;t.forEach(qA(e,a,u,s,l))}(r,n,e,t),r.forEach((t=>{s.push(Po(e,Uo(null!=u?{[u]:t}:t)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=s,n}}),HA.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const YA=["x","y","weight","size","cellSize","bandwidth"];function VA(t,e){return YA.forEach((n=>null!=e[n]?t[n](e[n]):0)),t}function GA(t){ga.call(this,null,t)}st(HA,ga,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=function(t,e){var n,r,i,o,a,u,s=[],l=t=>t(o);if(null==e)s.push(t);else for(n={},r=0,i=t.length;rUo(function(t,e){for(let n=0;nxx})).map(s)).concat(Le(Tx(o/d)*d,i,d).filter((function(t){return Cx(t%g)>xx})).map(l))}return y.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(u).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],u=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),u>a&&(t=u,u=a,a=t),y.precision(m)):[[r,u],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(m)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],y):[h,d]},y.precision=function(h){return arguments.length?(m=+h,s=Bw(o,i,90),l=Tw(e,t,m),c=Bw(u,a,90),f=Tw(r,n,m),y):m},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function nM(t){ga.call(this,null,t)}function rM(t){if(!Y(t))return!1;const e=Ct(i(t));return e.$x||e.$y||e.$value||e.$max}function iM(t){ga.call(this,null,t),this.modified(!0)}function oM(t,e,n){Y(t[e])&&t[e](n)}ZA.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},st(ZA,ga,{transform(t,e){var n,r=this._features,o=this._points,a=t.fields,u=a&&a[0],s=a&&a[1],l=t.geojson||!a&&h,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(i(l))||u&&e.modified(i(u))||s&&e.modified(i(s)),this.value&&!n||(c=e.SOURCE,this._features=r=[],this._points=o=[]),l&&e.visit(c,(t=>r.push(l(t)))),u&&s&&(e.visit(c,(t=>{var e=u(t),n=s(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&o.push([e,n])})),r=r.concat({type:XA,geometry:{type:"MultiPoint",coordinates:o}})),this.value={type:JA,features:r}}}),QA.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},st(QA,ga,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||h,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=FA(t.projection),n.materialize().reflow()):a=i===h||e.modified(i.fields)?n.ADD_MOD:n.ADD;const u=function(t,e){const n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),n.modifies(o)}}),KA.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},st(KA,ga,{transform(t,e){var n,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function l(t){const e=r([i(t),o(t)]);e?(t[u]=e[0],t[s]=e[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(o.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(a)}}),tM.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},st(tM,ga,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",o=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){const r=null==n?n=>t(e(n)):r=>{var i=t.pointRadius(),o=t.pointRadius(n)(e(r));return t.pointRadius(i),o};return r.context=e=>(t.context(e),r),r}(FA(t.projection),t.field||c("datum"),t.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(t=>t[i]=r)),n.modifies(i)}}),eM.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},st(eM,ga,{transform(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(const e in t)Y(i[e])&&i[e](t[e]);return n=i(),r.length?e.mod.push(jo(r[0],n)):e.add.push(Uo(n)),r[0]=n,e}}),nM.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},st(nM,ga,{transform(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||h,o=function(t,e){let n;Y(t)?(n=n=>t(n,e),n.dep=rM(t)):t?n=Q(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),a=function(t,e){let n;Y(t)?(n=n=>kc(t(n,e)),n.dep=rM(t)):n=Q(kc(t||"#888"));return n}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?Fe(n.map((t=>Fe(i(t).values)))):0};return n.forEach((t=>{const e=i(t),n=tt({},t,s);r||(n.$max=Fe(e.values||[])),t[u]=function(t,e,n,r){const i=t.width,o=t.height,a=t.x1||0,u=t.y1||0,s=t.x2||i,l=t.y2||o,c=t.values,f=c?t=>c[t]:d,h=Xl(s-a,l-u),p=h.getContext("2d"),g=p.getImageData(0,0,s-a,l-u),m=g.data;for(let t=u,o=0;t{null!=t[e]&&oM(n,e,t[e])}))):EA.forEach((e=>{t.modified(e)&&oM(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){const n=function(t){return 1===(t=W(t)).length?t[0]:{type:JA,features:t.reduce(((t,e)=>t.concat(function(t){return t.type===JA?t.features:W(t).filter((t=>null!=t)).map((t=>t.type===XA?t:{type:XA,geometry:t}))}(e))),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)}});var aM=Object.freeze({__proto__:null,contour:GA,geojson:ZA,geopath:QA,geopoint:KA,geoshape:tM,graticule:eM,heatmap:nM,isocontour:UA,kde2d:HA,projection:iM});function uM(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,y=t._x1,v=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(u=+t._x.call(null,d.data),s=+t._y.call(null,d.data),e===u&&n===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a}while((f=c<<1|l)==(h=(s>=a)<<1|u>=o));return i[h]=d,i[f]=p,t}function sM(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function lM(t){return t[0]}function cM(t){return t[1]}function fM(t,e,n){var r=new hM(null==e?lM:e,null==n?cM:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function hM(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function dM(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var pM=fM.prototype=hM.prototype;function gM(t){return function(){return t}}function mM(t){return 1e-6*(t()-.5)}function yM(t){return t.x+t.vx}function vM(t){return t.y+t.vy}function _M(t){return t.index}function xM(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}pM.copy=function(){var t,e,n=new hM(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=dM(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=dM(e));return n},pM.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return uM(this.cover(e,n),e,n,t)},pM.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;nc&&(c=r),if&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),n=0;nt||t>=i||r>e||e>=o;)switch(u=(eh||(o=s.y0)>d||(a=s.x1)=y)<<1|t>=m)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=v*v+_*_;if(x=(u=(p+m)/2))?p=u:m=u,(c=a>=(s=(g+y)/2))?g=s:y=s,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},pM.removeAll=function(t){for(var e=0,n=t.length;e{}};function wM(){for(var t,e=0,n=arguments.length,r={};e=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function MM(t,e){for(var n,r=0,i=t.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(null,t),e=e._next;--FM}()}finally{FM=0,function(){var t,e,n=DM,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:DM=e);CM=t,$M(r)}(),zM=0}}function IM(){var t=OM.now(),e=t-TM;e>1e3&&(NM-=e,TM=t)}function $M(t){FM||(SM&&(SM=clearTimeout(SM)),t-zM>24?(t<1/0&&(SM=setTimeout(jM,t-OM.now()-NM)),BM&&(BM=clearInterval(BM))):(BM||(TM=OM.now(),BM=setInterval(IM,1e3)),FM=1,RM(jM)))}qM.prototype=PM.prototype={constructor:qM,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?LM():+n)+(null==e?0:+e),this._next||CM===this||(CM?CM._next=this:DM=this,CM=this),this._call=t,this._time=n,$M()},stop:function(){this._call&&(this._call=null,this._time=1/0,$M())}};const WM=4294967296;function HM(t){return t.x}function YM(t){return t.y}var VM=Math.PI*(3-Math.sqrt(5));function GM(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=PM(f),l=wM("tick","end"),c=function(){let t=1;return()=>(t=(1664525*t+1013904223)%WM)/WM}();function f(){h(),l.call("tick",e),n1?(null==n?u.delete(t):u.set(t,p(n)),e):u.get(t)},find:function(e,n,r){var i,o,a,u,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(t,n),e):l.on(t)}}}const XM={center:function(t,e){var n,r=1;function i(){var i,o,a=n.length,u=0,s=0;for(i=0;il+p||oc+p||as.index){var g=l-u.x-u.vx,m=c-u.y-u.vy,y=g*g+m*m;yt.r&&(t.r=t[e].r)}function s(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r=u)){(t.data!==e||t.next)&&(0===f&&(p+=(f=mM(n))*f),0===h&&(p+=(h=mM(n))*h),p[u(t,e,r),t])));for(a=0,i=new Array(l);ae(t,n):e)}tE.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:KM}]},st(tE,ga,{transform(t,e){var n,r,i=this.value,o=e.changed(e.ADD_REM),a=t.modified(ZM),u=t.iterations||300;if(i?(o&&(e.modifies("index"),i.nodes(e.source)),(a||e.changed(e.MOD))&&eE(i,t,0,e)):(this.value=i=function(t,e){const n=GM(t),r=n.stop,i=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,i()),n.stop=()=>(o=!0,r()),eE(n,e,!0).on("end",(()=>o=!0))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,()=>n.touch(r).run())),t.static||(o=!0,i.tick()),e.modifies("index")),a||o||t.modified(QM)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return e.StopPropagation;return this.finish(t,e)},finish(t,e){const n=e.dataflow;for(let t,e=this._argops,u=0,s=e.length;u=0;)e+=n[r].value;else e=1;t.value=e}function cE(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=hE)):void 0===e&&(e=fE);for(var n,r,i,o,a,u=new gE(t),s=[u];n=s.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new gE(i[o])),r.parent=n,r.depth=n.depth+1;return u.eachBefore(pE)}function fE(t){return t.children}function hE(t){return Array.isArray(t)?t[1]:null}function dE(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function pE(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function gE(t){this.data=t,this.depth=this.height=0,this.parent=null}function mE(t){for(var e,n,r=0,i=(t=function(t){for(var e,n,r=t.length;r;)n=Math.random()*r--|0,e=t[r],t[r]=t[n],t[n]=e;return t}(Array.from(t))).length,o=[];r0&&n*n>r*r+i*i}function xE(t,e){for(var n=0;n(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=t.x-r*u-o*s,n.y=t.y-r*s+o*u):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*u-o*s,n.y=e.y+r*s+o*u)):(n.x=e.x+n.r,n.y=e.y)}function ME(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function EE(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function DE(t){this._=t,this.next=null,this.previous=null}function CE(t){if(!(i=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,n,r,i,o,a,u,s,l,c,f;if((e=t[0]).x=0,e.y=0,!(i>1))return e.r;if(n=t[1],e.x=-n.r,n.x=e.r,n.y=0,!(i>2))return e.r+n.r;AE(n,e,r=t[2]),e=new DE(e),n=new DE(n),r=new DE(r),e.next=r.previous=n,n.next=e.previous=r,r.next=n.previous=e;t:for(u=3;u=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return cE(this).eachBefore(dE)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n0)throw new Error("cycle");return o}return n.id=function(e){return arguments.length?(t=SE(e),n):t},n.parentId=function(t){return arguments.length?(e=SE(t),n):e},n}function WE(t,e){return t.parent===e.parent?1:2}function HE(t){var e=t.children;return e?e[0]:t.t}function YE(t){var e=t.children;return e?e[e.length-1]:t.t}function VE(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function GE(t,e,n){return t.a.parent===e.parent?t.a:n}function XE(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function JE(t,e,n,r,i){for(var o,a=t.children,u=-1,s=a.length,l=t.value&&(i-n)/t.value;++uh&&(h=u),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=u;break}p=d}y.push(a={value:c,dice:s1?e:1)},n}(ZE);var tD=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,u,s,l,c,f=-1,h=a.length,d=t.value;++f1?e:1)},n}(ZE);function eD(t,e,n){const r={};return t.each((t=>{const i=t.data;n(i)&&(r[e(i)]=t)})),t.lookup=r,t}function nD(t){ga.call(this,null,t)}nD.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const rD=t=>t.values;function iD(){const t=[],e={entries:t=>r(n(t,0),0),key:n=>(t.push(n),e)};function n(e,r){if(r>=t.length)return e;const i=e.length,o=t[r++],a={},u={};let s,l,c,f=-1;for(;++ft.length)return e;const i=[];for(const t in e)i.push({key:t,values:r(e[t],n)});return i}return e}function oD(t){ga.call(this,null,t)}st(nD,ga,{transform(t,e){e.source||s("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),o=this.value;return(!o||r||e.changed())&&(o&&o.each((t=>{t.children&&Oo(t.data)&&i.rem.push(t.data)})),this.value=o=cE({values:W(t.keys).reduce(((t,e)=>(t.key(e),t)),iD()).entries(i.source)},rD),n&&o.each((t=>{t.children&&(t=Uo(t.data),i.add.push(t),i.source.push(t))})),eD(o,Ro,Ro)),i.source.root=o,i}});const aD=(t,e)=>t.parent===e.parent?1:2;st(oD,ga,{transform(t,e){e.source&&e.source.root||s(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(t.method),r=this.fields,i=e.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(Io(t.sort,(t=>t.data))),function(t,e,n){for(let r,i=0,o=e.length;ifunction(t,e,n){const r=t.data,i=e.length-1;for(let o=0;o=0;--i)u.push(n=e.children[i]=new XE(r[i],i)),n.parent=e;return(a.parent=new XE(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.xc.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,u=n,s=o.parent.children[0],l=o.m,c=a.m,f=u.m,h=s.m;u=YE(u),o=HE(o),u&&o;)s=HE(s),(a=YE(a)).a=e,(i=u.z+f-o.z-l+t(u._,o._))>0&&(VE(GE(u,e,r),e,i),l+=i,c+=i),f+=u.m,l+=o.m,h+=s.m,c+=a.m;u&&!YE(a)&&(a.t=u,a.m+=f-c),o&&!HE(s)&&(s.t=o,s.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=aE,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(uE,0)/t.length}(n),e.y=function(t){return 1+t.reduce(sE,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)}));var u=function(t){for(var e;e=t.children;)t=e[0];return t}(i),s=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=u.x-t(u,s)/2,c=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},dD=["x","y","depth","children"];function pD(t){oD.call(this,t)}function gD(t){ga.call(this,[],t)}pD.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:dD.length,default:dD}]},st(pD,oD,{layout(t){const e=t||"tidy";if(it(hD,e))return hD[e]();s("Unrecognized Tree layout method: "+e)},params:["size","nodeSize"],fields:dD}),gD.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},st(gD,ga,{transform(t,e){const n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),o={};return r||s("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,(t=>o[Ro(t)]=1)),r.each((t=>{const e=t.data,n=t.parent&&t.parent.data;n&&o[Ro(e)]&&o[Ro(n)]&&i.add.push(Uo({source:n,target:e}))})),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,(t=>o[Ro(t)]=1)),n.forEach((t=>{(o[Ro(t.source)]||o[Ro(t.target)])&&i.mod.push(t)}))),i}});const mD={binary:function(t,e,n,r,i){var o,a,u=t.children,s=u.length,l=new Array(s+1);for(l[0]=a=o=0;o=n-1){var c=u[e];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=s)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d>>1;l[g]s-o){var v=r?(i*y+a*m)/r:a;t(e,d,m,i,o,v,s),t(d,n,y,v,o,a,s)}else{var _=r?(o*y+s*m)/r:s;t(e,d,m,i,o,a,_),t(d,n,y,i,_,a,s)}}(0,s,t.value,e,n,r,i)},dice:UE,slice:JE,slicedice:function(t,e,n,r,i){(1&t.depth?JE:UE)(t,e,n,r,i)},squarify:KE,resquarify:tD},yD=["x0","y0","x1","y1","depth","children"];function vD(t){oD.call(this,t)}vD.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:yD.length,default:yD}]},st(vD,oD,{layout(){const t=function(){var t=KE,e=!1,n=1,r=1,i=[0],o=BE,a=BE,u=BE,s=BE,l=BE;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(LE),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f{const n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=e=>{it(mD,e)?t.tile(mD[e]):s("Unrecognized Treemap layout method: "+e)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:yD});var _D=Object.freeze({__proto__:null,nest:nD,pack:sD,partition:cD,stratify:fD,tree:pD,treelinks:gD,treemap:vD});function xD(t,e,n,r){const i=t.width,o=t.height,a=n||r,u=Xl(i,o).getContext("2d");e.forEach((t=>bD(u,t,a)));const s=new Uint32Array(u.getImageData(0,0,i,o).data.buffer),l=t.bitmap(),c=a&&t.bitmap();let f,h,d,p,g;for(h=0;h{e.items.forEach((e=>bD(t,e.items,n)))})):Vm[r].draw(t,{items:n?e.map(wD):e})}function wD(t){const e=Po(t,{});return e.stroke&&(e.strokeOpacity=1),e.fill&&(e.fillOpacity=.0625,e.stroke="#000",e.strokeOpacity=1,e.strokeWidth=2),e}const kD=31,AD=new Uint32Array(33),MD=new Uint32Array(33);MD[0]=0,AD[0]=~MD[0];for(let t=1;t<=32;++t)MD[t]=MD[t-1]<<1|1,AD[t]=~MD[t];function ED(t,e,n){const r=Math.max(1,Math.sqrt(t*e/1e6)),i=~~((t+2*n+r)/r),o=~~((e+2*n+r)/r),a=t=>~~((t+n)/r);return a.invert=t=>t*r-n,a.bitmap=()=>function(t,e){const n=new Uint32Array(~~((t*e+32)/32));function r(t,e){n[t]|=e}function i(t,e){n[t]&=e}return{array:n,get:(e,r)=>{const i=r*t+e;return n[i>>>5]&1<<(i&kD)},set:(e,n)=>{const i=n*t+e;r(i>>>5,1<<(i&kD))},clear:(e,n)=>{const r=n*t+e;i(r>>>5,~(1<<(r&kD)))},getRange:(e,r,i,o)=>{let a,u,s,l,c=o;for(;c>=r;--c)if(a=c*t+e,u=c*t+i,s=a>>>5,l=u>>>5,s===l){if(n[s]&AD[a&kD]&MD[1+(u&kD)])return!0}else{if(n[s]&AD[a&kD])return!0;if(n[l]&MD[1+(u&kD)])return!0;for(let t=s+1;t{let a,u,s,l,c;for(;n<=o;++n)if(a=n*t+e,u=n*t+i,s=a>>>5,l=u>>>5,s===l)r(s,AD[a&kD]&MD[1+(u&kD)]);else for(r(s,AD[a&kD]),r(l,MD[1+(u&kD)]),c=s+1;c{let a,u,s,l,c;for(;n<=o;++n)if(a=n*t+e,u=n*t+r,s=a>>>5,l=u>>>5,s===l)i(s,MD[a&kD]|AD[1+(u&kD)]);else for(i(s,MD[a&kD]),i(l,AD[1+(u&kD)]),c=s+1;cn<0||r<0||o>=e||i>=t}}(i,o),a.ratio=r,a.padding=n,a.width=t,a.height=e,a}function DD(t,e,n,r,i,o){let a=n/2;return t-a<0||t+a>i||e-(a=r/2)<0||e+a>o}function CD(t,e,n,r,i,o,a,u){const s=i*o/(2*r),l=t(e-s),c=t(e+s),f=t(n-(o/=2)),h=t(n+o);return a.outOfBounds(l,f,c,h)||a.getRange(l,f,c,h)||u&&u.getRange(l,f,c,h)}const FD=[-1,-1,1,1],SD=[-1,1,-1,1];const BD=["right","center","left"],TD=["bottom","middle","top"];function zD(t,e,n,r,i,o,a,u,s,l,c,f){return!(i.outOfBounds(t,n,e,r)||(f&&o?o.getRange(t,n,e,r)||!function(t,e,n,r,i){return i[0]<=t&&n<=i[2]&&i[3]<=e&&r<=i[5]}(a,s,u,l,c):i.getRange(t,n,e,r)))}const ND={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},OD={naive:function(t,e,n,r){const i=t.width,o=t.height;return function(t){const e=t.datum.datum.items[r].items,n=e.length,a=t.datum.fontSize,u=Fm.width(t.datum,t.datum.text);let s,l,c,f,h,d,p,g=0;for(let r=0;r=g&&(g=p,t.x=h,t.y=d);return h=u/2,d=a/2,s=t.x-h,l=t.x+h,c=t.y-d,f=t.y+d,t.align="center",s<0&&l<=i?t.align="left":0<=s&&i=1;)h=(d+p)/2,CD(t,c,f,l,s,h,a,u)?p=h:d=h;if(d>r)return[c,f,d,!0]}}return function(e){const u=e.datum.datum.items[r].items,l=u.length,c=e.datum.fontSize,f=Fm.width(e.datum,e.datum.text);let h,d,p,g,m,y,v,_,x,b,w,k,A,M,E,D,C,F=n?c:0,S=!1,B=!1,T=0;for(let r=0;rd&&(C=h,h=d,d=C),p>g&&(C=p,p=g,g=C),x=t(h),w=t(d),b=~~((x+w)/2),k=t(p),M=t(g),A=~~((k+M)/2),v=b;v>=x;--v)for(_=A;_>=k;--_)D=s(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);for(v=b;v<=w;++v)for(_=A;_<=M;++_)D=s(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);S||n||(E=Math.abs(d-h+g-p),m=(h+d)/2,y=(p+g)/2,E>=T&&!DD(m,y,f,c,i,o)&&!CD(t,m,y,c,f,c,a,null)&&(T=E,e.x=m,e.y=y,B=!0))}return!(!S&&!B)&&(m=f/2,y=c/2,a.setRange(t(e.x-m),t(e.y-y),t(e.x+m),t(e.y+y)),e.align="center",e.baseline="middle",!0)}},floodfill:function(t,e,n,r){const i=t.width,o=t.height,a=e[0],u=e[1],s=t.bitmap();return function(e){const l=e.datum.datum.items[r].items,c=l.length,f=e.datum.fontSize,h=Fm.width(e.datum,e.datum.text),d=[];let p,g,m,y,v,_,x,b,w,k,A,M,E=n?f:0,D=!1,C=!1,F=0;for(let r=0;r=1;)A=(w+k)/2,CD(t,v,_,f,h,A,a,u)?k=A:w=A;w>E&&(e.x=v,e.y=_,E=w,D=!0)}}D||n||(M=Math.abs(g-p+y-m),v=(p+g)/2,_=(m+y)/2,M>=F&&!DD(v,_,h,f,i,o)&&!CD(t,v,_,f,h,f,a,null)&&(F=M,e.x=v,e.y=_,C=!0))}return!(!D&&!C)&&(v=h/2,_=f/2,a.setRange(t(e.x-v),t(e.y-_),t(e.x+v),t(e.y+_)),e.align="center",e.baseline="middle",!0)}}};function RD(t,e,n,r,i,o,a,u,s,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),h=function(t,e){const n=new Float64Array(e),r=t.length;for(let e=0;e[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===e?t=>{const e=t.datum.items[r].items;return i(e.length?e["start"===n?0:e.length-1]:{x:NaN,y:NaN})}:t=>{const e=t.datum.bounds;return[e.x1,(e.x1+e.x2)/2,e.x2,e.y1,(e.y1+e.y2)/2,e.y2]}:i}(p,g,u,s),v=ED(e[0],e[1],l),_=m&&"naive"===c;var x;const b=t.map((t=>({datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(t)})));let w;if(!_){n&&b.sort(((t,e)=>n(t.datum,e.datum)));let e=!1;for(let t=0;tt.datum))].concat(o)),w=o.length?xD(v,o,e,m):function(t,e){const n=t.bitmap();return(e||[]).forEach((e=>n.set(t(e.boundary[0]),t(e.boundary[3])))),[n,void 0]}(v,a&&b)}const k=m?OD[c](v,w,a,s):function(t,e,n,r){const i=t.width,o=t.height,a=e[0],u=e[1],s=r.length;return function(e){const l=e.boundary,c=e.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>o)return!1;let f,h,d,p,g,m,y,v,_,x,b,w,k,A,M,E=0;for(let i=0;i>>2&3)-1,d=0===f&&0===h||r[i]<0,p=f&&h?Math.SQRT1_2:1,g=r[i]<0?-1:1,m=l[1+f]+r[i]*f*p,b=l[4+h]+g*c*h/2+r[i]*h*p,v=b-c/2,_=b+c/2,w=t(m),A=t(v),M=t(_),!E){if(!zD(w,w,A,M,a,u,m,m,v,_,l,d))continue;E=Fm.width(e.datum,e.datum.text)}if(x=m+g*E*f/2,m=x-E/2,y=x+E/2,w=t(m),k=t(y),zD(w,k,A,M,a,u,m,y,v,_,l,d))return e.x=f?f*g<0?y:m:x,e.y=h?h*g<0?_:v:b,e.align=BD[f*g+1],e.baseline=TD[h*g+1],a.setRange(w,A,k,M),!0}return!1}}(v,w,d,h);return b.forEach((t=>t.opacity=+k(t))),b}const LD=["x","y","opacity","align","baseline"],UD=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function qD(t){ga.call(this,null,t)}qD.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:UD},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:LD.length,default:LD}]},st(qD,ga,{transform(t,e){const n=t.modified();if(!(n||e.changed(e.ADD_REM)||function(n){const r=t[n];return Y(r)&&e.modified(r.fields)}("sort")))return;t.size&&2===t.size.length||s("Size parameter should be specified as a [width, height] array.");const r=t.as||LD;return RD(e.materialize(e.SOURCE).source,t.size,t.sort,W(t.offset||1),W(t.anchor||UD),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,t.padding||0,t.method||"naive").forEach((t=>{const e=t.datum;e[r[0]]=t.x,e[r[1]]=t.y,e[r[2]]=t.opacity,e[r[3]]=t.align,e[r[4]]=t.baseline})),e.reflow(n).modifies(r)}});var PD=Object.freeze({__proto__:null,label:qD});function jD(t,e){var n,r,i,o,a,u,s=[],l=function(t){return t(o)};if(null==e)s.push(t);else for(n={},r=0,i=t.length;r{ru(e,t.x,t.y,t.bandwidth||.3).forEach((t=>{const n={};for(let t=0;t"poly"===t?e:"quad"===t?2:1)(a,u),c=t.as||[r(t.x),r(t.y)],f=$D[a],h=[];let d=t.extent;it($D,a)||s("Invalid regression method: "+a),null!=d&&"log"===a&&d[0]<=0&&(e.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach((n=>{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,u);if(t.params)return void h.push(Uo({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||et(n,t.x),s=t=>{const e={};for(let t=0;ts([t,r.predict(t)]))):uu(r.predict,i,25,200).forEach(s)})),this.value&&(n.rem=this.value),this.value=n.add=n.source=h}return n}});var HD=Object.freeze({__proto__:null,loess:ID,regression:WD});const YD=Math.pow(2,-52),VD=new Uint32Array(512);class GD{static from(t,e=nC,n=rC){const r=t.length,i=new Float64Array(2*r);for(let o=0;o>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,l=-1/0;for(let e=0;es&&(s=n),r>l&&(l=r),this._ids[e]=e}const c=(a+s)/2,f=(u+l)/2;let h,d,p,g=1/0;for(let e=0;e0&&(d=e,g=n)}let v=t[2*d],_=t[2*d+1],x=1/0;for(let e=0;er&&(e[n++]=i,r=this._dists[i])}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ZD(m,y,v,_,b,w)){const t=d,e=v,n=_;d=p,v=b,_=w,p=t,b=e,w=n}const k=function(t,e,n,r,i,o){const a=n-t,u=r-e,s=i-t,l=o-e,c=a*a+u*u,f=s*s+l*l,h=.5/(a*l-u*s);return{x:t+(l*c-u*f)*h,y:e+(a*f-s*c)*h}}(m,y,v,_,b,w);this._cx=k.x,this._cy=k.y;for(let e=0;e0&&Math.abs(l-o)<=YD&&Math.abs(c-a)<=YD)continue;if(o=l,a=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=VD[--i];continue}const s=a-a%3,l=u+(t+1)%3,c=s+(a+2)%3,f=e[o],h=e[t],d=e[l],p=e[c];if(QD(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,c);const u=s+(a+1)%3;i=33306690738754716e-32*Math.abs(a+u)?a-u:0}function ZD(t,e,n,r,i,o){return(JD(i,o,t,e,n,r)||JD(t,e,n,r,i,o)||JD(n,r,i,o,t,e))<0}function QD(t,e,n,r,i,o,a,u){const s=t-a,l=e-u,c=n-a,f=r-u,h=i-a,d=o-u,p=c*c+f*f,g=h*h+d*d;return s*(f*g-p*d)-l*(c*g-p*h)+(s*s+l*l)*(c*d-f*h)<0}function KD(t,e,n,r,i,o){const a=n-t,u=r-e,s=i-t,l=o-e,c=a*a+u*u,f=s*s+l*l,h=.5/(a*l-u*s),d=(l*c-u*f)*h,p=(a*f-s*c)*h;return d*d+p*p}function tC(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;eC(t,n+r>>1,i),e[t[n]]>e[t[r]]&&eC(t,n,r),e[t[i]]>e[t[r]]&&eC(t,i,r),e[t[n]]>e[t[i]]&&eC(t,n,i);const a=t[i],u=e[a];for(;;){do{i++}while(e[t[i]]u);if(o=o-n?(tC(t,e,i,r),tC(t,e,n,o-1)):(tC(t,e,n,o-1),tC(t,e,i,r))}}function eC(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function nC(t){return t[0]}function rC(t){return t[1]}const iC=1e-6;class oC{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+="M".concat(this._x0=this._x1=+t,",").concat(this._y0=this._y1=+e)}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+="L".concat(this._x1=+t,",").concat(this._y1=+e)}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+="M".concat(r,",").concat(i):(Math.abs(this._x1-r)>iC||Math.abs(this._y1-i)>iC)&&(this._+="L"+r+","+i),n&&(this._+="A".concat(n,",").concat(n,",0,1,1,").concat(t-n,",").concat(e,"A").concat(n,",").concat(n,",0,1,1,").concat(this._x1=r,",").concat(this._y1=i))}rect(t,e,n,r){this._+="M".concat(this._x0=this._x1=+t,",").concat(this._y0=this._y1=+e,"h").concat(+n,"v").concat(+r,"h").concat(-n,"Z")}value(){return this._||null}}class aC{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}class uC{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let e,r,o=0,a=0,u=n.length;o1;)i-=2;for(let t=2;t4)for(let t=0;t0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)this.xmax?2:0)|(ethis.ymax?8:0)}}const sC=2*Math.PI,lC=Math.pow;function cC(t){return t[0]}function fC(t){return t[1]}function hC(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class dC{static from(t,e=cC,n=fC,r){return new dC("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],this.triangles[1]=r[1],this.triangles[2]=r[1],o[r[0]]=1,2===r.length&&(o[r[1]]=0))}voronoi(t){return new uC(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=lC(e-s[2*t],2)+lC(n-s[2*t+1],2);const f=r[t];let h=f;do{let r=u[h];const f=lC(e-s[2*r],2)+lC(n-s[2*r+1],2);if(f=f));)if(e.x=a+i,e.y=l+o,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>u[0]||e.y+e.y1>u[1])&&(!n||!wC(e,t,u[0]))&&(!n||AC(e,n))){for(var g,m=e.sprite,y=e.width>>5,v=u[0]>>5,_=e.x-(y<<4),x=127&_,b=32-x,w=e.y1-e.y0,k=(e.y+e.y0)*v+(_>>5),A=0;A>>x:0);k+=v}return e.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=_C/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(Xl()),f=function(t){var e=[],n=-1;for(;++n>5)*u[1]),d=null,p=l.length,g=-1,m=[],y=l.map((u=>({text:t(u),font:e(u),style:r(u),weight:i(u),rotate:o(u),size:~~(n(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,e)=>e.size-t.size));++g>1,v.y=u[1]*(c()+.5)>>1,bC(s,v,y,g),v.hasText&&h(f,v,d)&&(m.push(v),d?kC(d,v):d=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=u[0]>>1,v.y-=u[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(e=EC(t),f):e},f.fontStyle=function(t){return arguments.length?(r=EC(t),f):r},f.fontWeight=function(t){return arguments.length?(i=EC(t),f):i},f.rotate=function(t){return arguments.length?(o=EC(t),f):o},f.text=function(e){return arguments.length?(t=EC(e),f):t},f.spiral=function(t){return arguments.length?(s=DC[t]||t,f):s},f.fontSize=function(t){return arguments.length?(n=EC(t),f):n},f.padding=function(t){return arguments.length?(a=EC(t),f):a},f.random=function(t){return arguments.length?(c=t,f):c},f}function bC(t,e,n,r){if(!e.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,_C/o);var a,u,s,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r>5<<5,s=~~Math.max(Math.abs(v+_),Math.abs(v-_))}else a=a+31>>5<<5;if(s>d&&(d=s),f+a>=2048&&(f=0,h+=d,d=0),h+s>=_C)break;i.translate((f+(a>>1))/o,(h+(s>>1))/o),e.rotate&&i.rotate(e.rotate*vC),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=a,e.height=s,e.xoff=f,e.yoff=h,e.x1=a>>1,e.y1=s>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=a}for(var b=i.getImageData(0,0,2048/o,_C/o).data,w=[];--r>=0;)if((e=n[r]).hasText){for(u=(a=e.width)>>5,s=e.y1-e.y0,l=0;l>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,k|=E}k?A=c:(e.y0++,s--,c--,h++)}e.y1=e.y0+A,e.sprite=w.slice(0,(e.y1-e.y0)*u)}}}function wC(t,e,n){n>>=5;for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,l=t.y1-t.y0,c=(t.y+t.y0)*n+(a>>5),f=0;f>>u:0))&e[c+h])return!0;c+=n}return!1}function kC(t,e){var n=t[0],r=t[1];e.x+e.x0r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function AC(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0e(t(n))}i.forEach((t=>{t[a[0]]=NaN,t[a[1]]=NaN,t[a[3]]=0}));const c=o.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(t.random).layout(),f=o.size(),h=f[0]>>1,d=f[1]>>1,p=c.length;for(let t,e,n=0;nnew Uint8Array(t),zC=t=>new Uint16Array(t),NC=t=>new Uint32Array(t);function OC(t,e,n){const r=(e<257?TC:e<65537?zC:NC)(t);return n&&r.set(n),r}function RC(t,e,n){const r=1<{const r=t[e],i=t[n];return ri?1:0})),function(t,e){return Array.from(e,(e=>t[e]))}(t,e)}(h,s),a)l=e,c=t,e=Array(a+u),t=NC(a+u),function(t,e,n,r,i,o,a,u,s){let l,c=0,f=0;for(l=0;c0)for(f=0;ft,size:()=>n}}function UC(t){ga.call(this,function(){let t=8,e=[],n=NC(0),r=OC(0,t),i=OC(0,t);return{data:()=>e,seen:()=>n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length),add(t){for(let n,r=0,i=e.length,o=t.length;re.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,e){r[t]|=e},clear(t,e){r[t]&=~e},resize(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=OC(e,t,r),i=OC(e,t))}}}(),t),this._indices=null,this._dims=null}function qC(t){ga.call(this,null,t)}UC.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},st(UC,ga,{transform(t,e){return this._dims?t.modified("fields")||t.fields.some((t=>e.modified(t.fields)))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},init(t,e){const n=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,l=0;for(;l{const t=i.remove(e,n);for(const e in r)r[e].reindex(t)}))},update(t,e,n){const r=this._dims,i=t.query,o=e.stamp,a=r.length;let u,s,l=0;for(n.filters=0,s=0;sd)for(m=d,y=Math.min(f,p);mp)for(m=Math.max(f,p),y=h;mc)for(d=c,p=Math.min(s,f);df)for(d=Math.max(s,f),p=l;du[t]&n?null:a[t];return o.filter(o.MOD,l),i&i-1?(o.filter(o.ADD,(t=>{const e=u[t]&n;return!e&&e^s[t]&n?a[t]:null})),o.filter(o.REM,(t=>{const e=u[t]&n;return e&&!(e^e^s[t]&n)?a[t]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(t=>(u[t]&n)===i?a[t]:null))),o.filter(o.SOURCE,(t=>l(t._index)))}});var PC=Object.freeze({__proto__:null,crossfilter:UC,resolvefilter:qC});const jC="RawCode",IC="Literal",$C="Property",WC="Identifier",HC="ArrayExpression",YC="BinaryExpression",VC="CallExpression",GC="ConditionalExpression",XC="LogicalExpression",JC="MemberExpression",ZC="ObjectExpression",QC="UnaryExpression";function KC(t){this.type=t}var tF,eF,nF,rF,iF;KC.prototype.visit=function(t){let e,n,r;if(t(this))return 1;for(e=function(t){switch(t.type){case HC:return t.elements;case YC:case XC:return[t.left,t.right];case VC:return[t.callee].concat(t.arguments);case GC:return[t.test,t.consequent,t.alternate];case JC:return[t.object,t.property];case ZC:return t.properties;case $C:return[t.key,t.value];case QC:return[t.argument];case WC:case IC:case jC:default:return[]}}(this),n=0,r=e.length;n",tF[3]="Identifier",tF[4]="Keyword",tF[5]="Null",tF[6]="Numeric",tF[7]="Punctuator",tF[8]="String",tF[9]="RegularExpression";var oF="Identifier",aF="Unexpected token %0",uF="Invalid regular expression",sF="Invalid regular expression: missing /",lF="Octal literals are not allowed in strict mode.",cF="ILLEGAL",fF="Disabled.",hF=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),dF=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function pF(t,e){if(!t)throw new Error("ASSERT: "+e)}function gF(t){return t>=48&&t<=57}function mF(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function yF(t){return"01234567".indexOf(t)>=0}function vF(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function _F(t){return 10===t||13===t||8232===t||8233===t}function xF(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&hF.test(String.fromCharCode(t))}function bF(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&dF.test(String.fromCharCode(t))}const wF={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function kF(){for(;nF1114111||"}"!==t)&&PF({},aF,cF),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function EF(){var t,e;for(t=eF.charCodeAt(nF++),e=String.fromCharCode(t),92===t&&(117!==eF.charCodeAt(nF)&&PF({},aF,cF),++nF,(t=AF("u"))&&"\\"!==t&&xF(t.charCodeAt(0))||PF({},aF,cF),e=t);nF>>="===(r=eF.substr(nF,4))?{type:7,value:r,start:i,end:nF+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:nF+=3}:a===(e=n.substr(0,2))[1]&&"+-<>&|".indexOf(a)>=0||"=>"===e?{type:7,value:e,start:i,end:nF+=2}:("//"===e&&PF({},aF,cF),"<>=!+-*%&|^/".indexOf(a)>=0?{type:7,value:a,start:i,end:++nF}:void PF({},aF,cF))}function FF(){var t,e,n;if(pF(gF((n=eF[nF]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=nF,t="","."!==n){if(t=eF[nF++],n=eF[nF],"0"===t){if("x"===n||"X"===n)return++nF,function(t){let e="";for(;nF=0&&PF({},uF,n),{value:n,literal:e}}(),r=function(t,e){let n=t;e.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,e)=>{if(parseInt(e,16)<=1114111)return"x";PF({},uF)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){PF({},uF)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:nF}}function BF(){if(kF(),nF>=rF)return{type:2,start:nF,end:nF};const t=eF.charCodeAt(nF);return xF(t)?DF():40===t||41===t||59===t?CF():39===t||34===t?function(){var t,e,n,r,i="",o=!1;for(pF("'"===(t=eF[nF])||'"'===t,"String literal must starts with a quote"),e=nF,++nF;nF=0&&nF(pF(e":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function rS(){var t,e;return t=function(){var t,e,n,r,i,o,a,u,s,l;if(t=iF,s=eS(),0===(i=nS(r=iF)))return s;for(r.prec=i,TF(),e=[t,iF],o=[s,r,a=eS()];(i=nS(iF))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),e.pop(),n=NF(u,s,a),o.push(n);(r=TF()).prec=i,o.push(r),e.push(iF),n=eS(),o.push(n)}for(n=o[l=o.length-1],e.pop();l>1;)e.pop(),n=NF(o[l-1].value,o[l-2],n),l-=2;return n}(),$F("?")&&(TF(),e=rS(),IF(":"),t=function(t,e,n){const r=new KC("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,rS())),t}function iS(){const t=rS();if($F(","))throw new Error(fF);return t}var oS={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function aS(t){function e(e,n,r){return i=>function(e,n,r,i){let o=t(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}const n="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&s("Missing arguments to clamp function."),e.length>3&&s("Too many arguments to clamp function.");const n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase",r,0),lower:e("toLowerCase",r,0),substring:e("substring",r),split:e("split",r),trim:e("trim",r,0),regexp:i,test:e("test",i),if:function(e){e.length<3&&s("Missing arguments to if function."),e.length>3&&s("Too many arguments to if function.");const n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}const uS="intersect",sS="union",lS="index:unit";function cS(t,e){for(var n,r,i=e.fields,o=e.values,a=i.length,u=0;u>>1;n(t[o],e)<0?r=o+1:i=o}return r}return 1===t.length&&(e=(e,n)=>t(e)-n,n=function(t){return(e,n)=>function(t,e){return te?1:t>=e?0:NaN}(t(e),n)}(t)),{left:r,center:function(t,n,i,o){null==i&&(i=0),null==o&&(o=t.length);const a=r(t,n,i,o-1);return a>i&&e(t[a-1],n)>-e(t[a],n)?a-1:a},right:function(t,e,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;n(t[o],e)>0?i=o:r=o+1}return r}}}(fS),dS=hS.left,pS=hS.right;var gS={E_union:function(t,e){if(!t.length)return e;for(var n=0,r=e.length;ne.indexOf(t)>=0)):e},R_union:function(t,e){var n=E(e[0]),r=E(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]r&&(n=e[1],r=e[0]),t.length?rr&&(t[1]=r),t):[n,r]}};function mS(t,e,n,r){e[0].type!==IC&&s("First argument to selection functions must be a string literal.");const i=e[0].value,o="unit",a="@unit",u=":"+i;(e.length>=2&&M(e).value)!==uS||it(r,a)||(r["@unit"]=n.getData(i).indataRef(n,o)),it(r,u)||(r[u]=n.getData(i).tuplesRef())}function yS(t){const e=this.context.data[t];return e?e.values.value:[]}const vS=t=>function(e,n){return this.context.dataflow.locale()[t](n)(e)},_S=vS("format"),xS=vS("timeFormat"),bS=vS("utcFormat"),wS=vS("timeParse"),kS=vS("utcParse"),AS=new Date(2e3,0,1);function MS(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(AS.setYear(2e3),AS.setMonth(t),AS.setDate(e),xS.call(this,AS,n)):""}function ES(t,e,n,r){e[0].type!==IC&&s("First argument to data functions must be a string literal.");const i=e[0].value,o=":"+i;if(!it(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(t){}}function DS(t,e,n,r){if(e[0].type===IC)CS(n,r,e[0].value);else for(t in n.scales)CS(n,r,t)}function CS(t,e,n){const r="%"+n;if(!it(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function FS(t,e){let n;return Y(t)?t:gt(t)?(n=e.scales[t])&&n.value:void 0}function SS(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=DS,n._range=DS,n._scale=DS;const r=e=>"_["+(e.type===IC?kt("%"+e.value):kt("%")+"+"+t(e))+"]";return{_bandwidth:t=>"this.__bandwidth(".concat(r(t[0]),")"),_range:t=>"".concat(r(t[0]),".range()"),_scale:e=>"".concat(r(e[0]),"(").concat(t(e[1]),")")}}function BS(t,e){return function(n,r,i){if(n){const e=FS(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const TS=BS("area",(function(t){return db=new we,Xx(t,pb),2*db})),zS=BS("bounds",(function(t){var e,n,r,i,o,a,u;if(ib=rb=-(eb=nb=1/0),cb=[],Xx(t,Ib),n=cb.length){for(cb.sort(Zb),e=1,o=[r=cb[0]];eJb(r[0],r[1])&&(r[1]=i[1]),Jb(i[0],r[1])>Jb(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(u=Jb(r[1],i[0]))>a&&(a=u,eb=i[0],rb=r[1])}return cb=fb=null,eb===1/0||nb===1/0?[[NaN,NaN],[NaN,NaN]]:[[eb,nb],[rb,ib]]})),NS=BS("centroid",(function(t){Eb=Db=Cb=Fb=Sb=Bb=Tb=zb=0,Nb=new we,Ob=new we,Rb=new we,Xx(t,Kb);var e=+Nb,n=+Ob,r=+Rb,i=Nx(e,n,r);return iqS(t,e)}const jS={};function IS(t){return _(t)||ArrayBuffer.isView(t)?t:null}function $S(t){return IS(t)||(gt(t)?t:null)}const WS=t=>t.data;function HS(t,e){const n=yS.call(e,t);return n.root&&n.root.lookup||{}}const YS=()=>"undefined"!=typeof window&&window||null;const VS={random:()=>t.random(),cumulativeNormal:Ba,cumulativeLogNormal:La,cumulativeUniform:$a,densityNormal:Sa,densityLogNormal:Ra,densityUniform:Ia,quantileNormal:Ta,quantileLogNormal:Ua,quantileUniform:Wa,sampleNormal:Fa,sampleLogNormal:Oa,sampleUniform:ja,isArray:_,isBoolean:ct,isDate:ft,isDefined:t=>void 0!==t,isNumber:dt,isObject:x,isRegExp:pt,isString:gt,isTuple:Oo,isValid:t=>null!=t&&t==t,toBoolean:At,toDate:Et,toNumber:E,toString:Dt,indexof:function(t,...e){return $S(t).indexOf(...e)},join:function(t,...e){return IS(t).join(...e)},lastindexof:function(t,...e){return $S(t).lastIndexOf(...e)},replace:function(t,e,n){return Y(n)&&s("Function argument passed to replace."),String(t).replace(e,n)},reverse:function(t){return IS(t).slice().reverse()},slice:function(t,...e){return $S(t).slice(...e)},flush:ut,lerp:yt,merge:function(){const t=[].slice.call(arguments);return t.unshift({}),tt(...t)},pad:bt,peek:M,pluck:function(t,e){const n=jS[e]||(jS[e]=c(e));return _(t)?t.map(n):n(t)},span:wt,inrange:lt,truncate:Ft,rgb:kc,lab:jc,hcl:Gc,hsl:Sc,luminance:LS,contrast:function(t,e){const n=LS(t),r=LS(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:Le,format:_S,utcFormat:bS,utcParse:kS,utcOffset:wr,utcSequence:Mr,timeFormat:xS,timeParse:wS,timeOffset:br,timeSequence:Ar,timeUnitSpecifier:Vn,monthFormat:function(t){return MS.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return MS.call(this,t,1,"%b")},dayFormat:function(t){return MS.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return MS.call(this,0,2+t,"%a")},quarter:I,utcquarter:$,week:Zn,utcweek:rr,dayofyear:Jn,utcdayofyear:nr,warn:function(){return OS(this.context.dataflow,"warn",arguments)},info:function(){return OS(this.context.dataflow,"info",arguments)},debug:function(){return OS(this.context.dataflow,"debug",arguments)},extent:et,inScope:function(t){const e=this.context.group;let n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:function(t,e,n){if(!t)return[];const[r,i]=t,o=(new Qp).set(r[0],r[1],i[0],i[1]);return Av(n||this.context.dataflow.scenegraph().root,o,function(t){let e=null;if(t){const n=W(t.marktype),r=W(t.markname);e=t=>(!n.length||n.some((e=>t.marktype===e)))&&(!r.length||r.some((e=>t.name===e)))}return e}(e))},clampRange:H,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.sqrt(n*n+r*r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=YS();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=YS();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return Ph(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(g).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?bp(n,e=e||cp(t)):t}},panLinear:z,panLog:N,panPow:O,panSymlog:R,zoomLinear:U,zoomLog:q,zoomPow:P,zoomSymlog:j,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,l=a.stamp();let c,f,h=u.changes;if(!1===a._trigger||!(s.value.length||e||r))return 0;if((!h||h.stamp{u.modified=!0,a.pulse(s,h).run()}),!0,1)),n&&(c=!0===n?g:_(n)||Oo(n)?n:PS(n),h.remove(c)),e&&h.insert(e),r&&(c=PS(r),s.value.some(c)?h.remove(c):h.insert(r)),i)for(f in o)h.modify(i,f,o[f]);return 1}},GS=["view","item","group","xy","x","y"],XS="this.",JS={},ZS={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>"_[".concat(kt("$"+t),"]"),functions:function(t){const e=aS(t);GS.forEach((t=>e[t]="event.vega."+t));for(const t in VS)e[t]=XS+t;return tt(e,SS(t,VS,JS)),e},constants:oS,visitors:JS},QS=function(t){const e=(t=t||{}).allowed?Ct(t.allowed):{},n=t.forbidden?Ct(t.forbidden):{},r=t.constants||oS,i=(t.functions||aS)(h),o=t.globalvar,a=t.fieldvar,u=Y(o)?o:t=>"".concat(o,'["').concat(t,'"]');let l={},c={},f=0;function h(t){if(gt(t))return t;const e=d[t.type];return null==e&&s("Unsupported type: "+t.type),e(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:it(n,i)?s("Illegal identifier: "+i):it(r,i)?r[i]:it(e,i)?i:(l[i]=1,u(i))},MemberExpression:t=>{const e=!t.computed,n=h(t.object);e&&(f+=1);const r=h(t.property);return n===a&&(c[function(t){const e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&s("Illegal callee type: "+t.callee.type);const e=t.callee.name,n=t.arguments,r=it(i,e)&&i[e];return r||s("Unrecognized function: "+e),Y(r)?r(n):r+"("+n.map(h).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(h).join(",")+"]",BinaryExpression:t=>"("+h(t.left)+" "+t.operator+" "+h(t.right)+")",UnaryExpression:t=>"("+t.operator+h(t.argument)+")",ConditionalExpression:t=>"("+h(t.test)+"?"+h(t.consequent)+":"+h(t.alternate)+")",LogicalExpression:t=>"("+h(t.left)+t.operator+h(t.right)+")",ObjectExpression:t=>"{"+t.properties.map(h).join(",")+"}",Property:t=>{f+=1;const e=h(t.key);return f-=1,e+":"+h(t.value)}};function p(t){const e={code:h(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return p.functions=i,p.constants=r,p}(ZS);function KS(t,e,n){return 1===arguments.length?VS[t]:(VS[t]=e,n&&(JS[t]=n),QS&&(QS.functions[t]=XS+t),this)}function tB(t,e){const n={};let r;try{r=function(t){nF=0,rF=(eF=t).length,iF=null,zF();const e=iS();if(2!==iF.type)throw new Error("Unexpect token after expression.");return e}(t=gt(t)?t:kt(t)+"")}catch(e){s("Expression parse error: "+t)}r.visit((t=>{if(t.type!==VC)return;const r=t.callee.name,i=ZS.visitors[r];i&&i(r,t.arguments,e,n)}));const i=QS(r);return i.globals.forEach((t=>{const r="$"+t;!it(n,r)&&e.getSignal(t)&&(n[r]=e.signalRef(t))})),{$expr:tt({code:i.code},e.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}KS("bandwidth",(function(t,e){const n=FS(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}),DS),KS("copy",(function(t,e){const n=FS(t,(e||this).context);return n?n.copy():void 0}),DS),KS("domain",(function(t,e){const n=FS(t,(e||this).context);return n?n.domain():[]}),DS),KS("range",(function(t,e){const n=FS(t,(e||this).context);return n&&n.range?n.range():[]}),DS),KS("invert",(function(t,e,n){const r=FS(t,(n||this).context);return r?_(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}),DS),KS("scale",(function(t,e,n){const r=FS(t,(n||this).context);return r?r(e):void 0}),DS),KS("gradient",(function(t,e,n,r,i){t=FS(t,(i||this).context);const o=op(e,n);let a=t.domain(),u=a[0],s=M(a),l=h;return s-u?l=Cd(t,u,s):t=(t.interpolator?gd("sequential")().interpolator(t.interpolator()):gd("linear")().interpolate(t.interpolate()).range(t.range())).domain([u=0,s=1]),t.ticks&&(a=t.ticks(+r||15),u!==a[0]&&a.unshift(u),s!==M(a)&&a.push(s)),a.forEach((e=>o.stop(l(e),t(e)))),o}),DS),KS("geoArea",TS,DS),KS("geoBounds",zS,DS),KS("geoCentroid",NS,DS),KS("geoShape",(function(t,e,n){const r=FS(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),DS),KS("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){e[0].type!==IC&&s("First argument to indata must be a string literal."),e[1].type!==IC&&s("Second argument to indata must be a string literal.");const i=e[0].value,o=e[1].value,a="@"+o;it(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),KS("data",yS,ES),KS("treePath",(function(t,e,n){const r=HS(t,this),i=r[e],o=r[n];return i&&o?i.path(o).map(WS):void 0}),ES),KS("treeAncestors",(function(t,e){const n=HS(t,this)[e];return n?n.ancestors().map(WS):void 0}),ES),KS("vlSelectionTest",(function(t,e,n){for(var r,i,o,a,u,s=this.context.data[t],l=s?s.values.value:[],c=s?s[lS]&&s[lS].value:void 0,f=n===uS,h=l.length,d=0;d(t[o[n].field]=e,t)),{}))}if(e=e||sS,Object.keys(y).forEach((t=>{y[t]=Object.keys(y[t]).map((e=>y[t][e])).reduce(((n,r)=>void 0===n?r:gS[_[t]+"_"+e](n,r)))})),m=Object.keys(v),n&&m.length){y[r?"vlPoint":"vlMulti"]=e===sS?{or:m.reduce(((t,e)=>(t.push(...v[e]),t)),[])}:{and:m.map((t=>({or:v[t]})))}}return y}),mS),KS("vlSelectionTuples",(function(t,e){return t.map((t=>tt({values:e.fields.map((e=>(e.getter||(e.getter=c(e.field)))(t.datum)))},e)))}));const eB=Ct(["rule"]),nB=Ct(["group","image","rect"]);function rB(t){return(t+"").toLowerCase()}function iB(t,e,n){";"!==n[n.length-1]&&(n="return("+n+");");const r=Function(...e.concat(n));return t&&t.functions?r.bind(t.functions):r}var oB={operator:(t,e)=>iB(t,["_"],e.code),parameter:(t,e)=>iB(t,["datum","_"],e.code),event:(t,e)=>iB(t,["event"],e.code),handler:(t,e)=>iB(t,["_","event"],"var datum=event.item&&event.item.datum;return ".concat(e.code,";")),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+kt(t)+"]";i+="$=".concat(r[t].code,";if(").concat(e,"!==$)").concat(e,"=$,m=1;")}return i+=function(t,e){let n="";return eB[e]||(t.x2&&(t.x?(nB[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(nB[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",iB(t,["item","_"],i)},codegen:{get(t){const e="[".concat(t.map(kt).join("]["),"]"),n=Function("_","return _".concat(e,";"));return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=e[r];let o,a;return t.path?(o="a".concat(t.path),a="b".concat(t.path)):((n=n||{})["f"+r]=t,o="this.f".concat(r,"(a)"),a="this.f".concat(r,"(b)")),function(t,e,n,r){return"((u = ".concat(t,") < (v = ").concat(e,") || u == null) && v != null ? ").concat(n,"\n  : (u > v || v == null) && u != null ? ").concat(r,"\n  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ").concat(n,"\n  : v !== v && u === u ? ").concat(r," : ")}(o,a,-i,i)})).join("")+"0;");return n?r.bind(n):r}}};function aB(t,e,n){if(!t||!x(t))return t;for(let r,i=0,o=uB.length;it&&t.$tupleid?Ro:t));return e.fn[n]||(e.fn[n]=V(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const o=e.fork().parse(n),a=o.get(n.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>e.detach(o),a}}},{key:"$tupleid",parse:function(){return Ro}}];const sB={skip:!0};function lB(t,e,n,r){return new cB(t,e,n,r)}function cB(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||oB,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function fB(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function hB(t,e){t&&(null==e?t.removeAttribute("aria-label"):t.setAttribute("aria-label",e))}cB.prototype=fB.prototype={fork(){const t=new fB(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((e=>e!==t));const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===rB(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){let i=n.get(t.parent.$ref);i?(r.connect(i,[e]),e.targets().add(i)):(n.unresolved=n.unresolved||[]).push((()=>{i=n.get(t.parent.$ref),r.connect(i,[e]),e.targets().add(i)}))}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach((t=>i[t]=e))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[rB(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach((t=>e.parseOperator(t))),n.forEach((t=>e.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>e.parseStream(t))),(t.updates||[]).forEach((t=>e.parseUpdate(t))),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===rB(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||s("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=_(i)?i.map((t=>aB(t,n,e))):aB(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map((t=>n.get(t))))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map((t=>n.get(t))),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&s("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=this,r=x(r=t.source)?r.$ref:r,i=n.get(r),o=t.update,a=void 0;i||s("Source not defined: "+t.source),e=t.target&&t.target.$expr?n.eventExpression(t.target.$expr):n.get(t.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(t,i,e,o,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach((n=>{const i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)}))}if(t.data){var i=n.data={};Object.keys(e.data).forEach((n=>{const r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)}))}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map((e=>e.getState(t)))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{n.update(e.signals[t],i[t],sB)})),Object.keys(r||{}).forEach((t=>{n.pulse(e.data[t].input,n.changeset().remove(g).insert(r[t]))})),(t.subcontext||[]).forEach(((t,n)=>{const r=e.subcontext[n];r&&r.setState(t)}))}};const dB="default";function pB(t,e){const n=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(n)return null==e?n.style.removeProperty("cursor"):n.style.cursor=e}function gB(t,e){var n=t._runtime.data;return it(n,e)||s("Unrecognized data set: "+e),n[e]}function mB(t,e){$o(e)||s("Second argument to changes must be a changeset.");const n=gB(this,t);return n.modified=!0,this.pulse(n.input,e)}function yB(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function vB(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function _B(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}function xB(t,e,n){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=_B(t),(r=sy(e.changedTouches?e.changedTouches[0]:e,a))[0]-=i[0],r[1]-=i[1]),e.dataflow=t,e.item=n,e.vega=function(t,e,n){const r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return n;gt(t)&&(t=i(t));const e=n.slice();for(;t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:Q(t),item:Q(e||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,n,r),e}const bB="view",wB={trap:!1};function kB(t,e,n){const r=t._eventConfig&&t._eventConfig[e];return!(!1===r||x(r)&&!r[n])||(t.warn("Blocked ".concat(e," ").concat(n," event listener.")),!1)}function AB(t){return t.item}function MB(t){return t.item.mark.source}function EB(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}function DB(t,e,n){const r=document.createElement(t);for(const t in e)r.setAttribute(t,e[t]);return null!=n&&(r.textContent=n),r}const CB="vega-bind",FB="vega-bind-name";function SB(t,e,n){if(!e)return;const r=n.param;let i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:e=>{e!==t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=K(r.debounce,i.update))),function(t,e,n,r){const i=DB("div",{class:CB}),o="radio"===n.input?i:i.appendChild(DB("label"));o.appendChild(DB("span",{class:FB},n.name||n.signal)),e.appendChild(i);let a=BB;switch(n.input){case"checkbox":a=TB;break;case"select":a=zB;break;case"radio":a=NB;break;case"range":a=OB}a(t,o,n,r)}(i,e,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0),i}function BB(t,e,n,r){const i=DB("input");for(const t in n)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,n[t]);i.setAttribute("name",n.signal),i.value=r,e.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function TB(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const o=DB("input",i);e.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function zB(t,e,n,r){const i=DB("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((t,e)=>{const n={value:t};RB(t,r)&&(n.selected=!0),i.appendChild(DB("option",n,(o[e]||t)+""))})),e.appendChild(i),i.addEventListener("change",(()=>{t.update(n.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e{const u={type:"radio",name:n.signal,value:e};RB(e,r)&&(u.checked=!0);const s=DB("input",u);s.addEventListener("change",(()=>t.update(e)));const l=DB("label",{},(o[a]||e)+"");return l.prepend(s),i.appendChild(l),s})),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",l),u.addEventListener("change",l),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function RB(t,e){return t===e||t+""==e+""}function LB(t,e,n,r,i,o){return(e=e||new r(t.loader())).initialize(n,yB(t),vB(t),_B(t),i,o).background(t.background())}function UB(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function qB(t,e){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e)try{e.innerHTML=""}catch(n){e=null,t.error(n)}return e}const PB=t=>+t||0;function jB(t){return x(t)?{top:PB(t.top),bottom:PB(t.bottom),left:PB(t.left),right:PB(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(PB(t))}async function IB(t,e,n,r){const i=kv(e),o=i&&i.headless;return o||s("Unrecognized renderer type: "+e),await t.runAsync(),LB(t,null,null,o,n,r).renderAsync(t._scenegraph.root)}var $B="width",WB="height",HB="padding",YB={skip:!0};function VB(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===HB?r.left+r.right:0)}function GB(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===HB?r.top+r.bottom:0)}function XB(t,e){return e.modified&&_(e.input.value)&&t.indexOf("_:vega:_")}function JB(t,e){return!("parent"===t||e instanceof ma.proxy)}function ZB(t,e,n,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":_(t)?QB(t):x(t)&&!ft(t)?(e=t,Object.keys(e).map((t=>{const n=e[t];return t+": "+(_(n)?QB(n):KB(n))})).join("\n")):t+"";var e}(r))}function QB(t){return"["+t.map(KB).join(", ")+"]"}function KB(t){return _(t)?"[…]":x(t)&&!ft(t)?"{…}":t}function tT(t,e){const n=this;if(e=e||{},da.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=tt({},t.locale,e.locale);n.locale(Do(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||bv.Canvas,n._scenegraph=new ey;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||ZB,n._redraw=!0,n._handler=(new Dy).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=function(t){const e=tt({defaults:{}},t),n=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=Ct(t[e]))}))};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return lB(t,ma,VS,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map((t=>({state:null,param:tt({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=VB(n,n._width),n._viewHeight=GB(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e.width,r=e.height,i=e.padding;function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(e=>{t._width=e.size,t._viewWidth=VB(t,e.size),o()}),{size:n}),t._resizeHeight=t.add(null,(e=>{t._height=e.size,t._viewHeight=GB(t,e.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(n),function(t){t.add(null,(e=>(t._background=e.bg,t._resize=1,e.bg)),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:dB,item:null}));t.on(t.events("view","mousemove"),e,((t,n)=>{const r=e.value,i=r?gt(r)?r:r.user:dB,o=n.item&&n.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return gt(n)||(r=n.item,n=n.user),pB(t,n&&n!==dB?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind)}function eT(t,e){return it(t._signals,e)?t._signals[e]:s("Unrecognized signal name: "+kt(e))}function nT(t,e){const n=(t._targets||[]).filter((t=>t._update&&t._update.handler===e));return n.length?n[0]:null}function rT(t,e,n,r){let i=nT(n,r);return i||(i=UB(t,(()=>r(e,n.value))),i.handler=r,t.on(n,null,i)),t}function iT(t,e,n){const r=nT(e,n);return r&&e._targets.remove(r),t}st(tT,da,{async evaluate(t,e,n){if(await da.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=_B(t),n=yB(t),r=vB(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((e=>{try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&To(this,n),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&hB(this._el,this._desc=e),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,e,n){const r=eT(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",jB(t)):jB(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(kv(t)||s("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(da.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(eT(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,e,n,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==n&&(u=1,a.signal($B,n,YB),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(WB,r,YB),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==e&&(a._resize=1,a._viewHeight=e),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,e,n){let r=e;return n&&!1===n.trap||(r=UB(this,e),r.raw=e),this._handler.on(t,r),this},removeEventListener(t,e){for(var n,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},addResizeListener(t){const e=this._resizeListeners;return e.indexOf(t)<0&&e.push(t),this},removeResizeListener(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},addSignalListener(t,e){return rT(this,t,eT(this,t),e)},removeSignalListener(t,e){return iT(this,eT(this,t),e)},addDataListener(t,e){return rT(this,t,gB(this,t).values,e)},removeDataListener(t,e){return iT(this,gB(this,t).values,e)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=pB(this,null);this._globalCursor=!!t,e&&pB(this,e)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,e){this._timers.push(function(t,e,n){var r=new qM,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?LM():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},events:function(t,e,n){var r,i=this,o=new Qo(n),a=function(n,r){i.runAsync(null,(()=>{t===bB&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),o.receive(xB(i,n,r))}))};if("timer"===t)kB(i,"timer",e)&&i.timer(a,e);else if(t===bB)kB(i,"view",e)&&i.addEventListener(e,a,wB);else if("window"===t?kB(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&kB(i,"selector",e)&&(r=document.querySelectorAll(t)),r){for(var u=0,s=r.length;u=0;)i[t].stop();for(t=o.length;--t>=0;)for(e=(n=o[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);return r&&r.call(this,this._handler,null,null,null),this},hover:function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",AB),MB,EB(t)),this.on(this.events("view","mouseout",AB),MB,EB(e)),this},data:function(t,e){return arguments.length<2?gB(this,t).values.value:mB.call(this,t,Wo().remove(g).insert(e))},change:mB,insert:function(t,e){return mB.call(this,t,Wo().insert(e))},remove:function(t,e){return mB.call(this,t,Wo().remove(e))},scale:function(t){var e=this._runtime.scales;return it(e,t)||s("Unrecognized scale or projection: "+t),e[t].value},initialize:function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,o=kv(r);t=n._el=t?qB(n,t):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),hB(e,t.description()))}(n),o||n.error("Unrecognized renderer type: "+r);const a=o.handler||Dy,u=t?o.renderer:o.headless;return n._renderer=u?LB(n,n._renderer,t,u):null,n._handler=function(t,e,n,r){const i=new r(t.loader(),UB(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,_B(t),t);return e&&e.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(n,n._handler,t,a),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=qB(n,e):t.appendChild(DB("form",{class:"vega-bindings"})),n._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=qB(n,t.param.element))})),n._bind.forEach((t=>{SB(n,t.element||e,t)}))),n},toImageURL:async function(t,e){t!==bv.Canvas&&t!==bv.SVG&&t!==bv.PNG&&s("Unrecognized image type: "+t);const n=await IB(this,t,e);return t===bv.SVG?function(t,e){const n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(t,e){return(await IB(this,bv.Canvas,t,e)).canvas()},toSVG:async function(t){return(await IB(this,bv.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:XB,signals:JB,recurse:!0})},setState:function(t){return this.runAsync(null,(e=>{e._trigger=!1,e._runtime.setState(t)}),(t=>{t._trigger=!0})),this}});const oT="[",aT="]",uT=/[[\]{}]/,sT={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let lT,cT;function fT(t,e,n,r,i){const o=t.length;let a,u=0;for(;e=0?--u:r&&r.indexOf(a)>=0&&++u}return e}function hT(t){const e=[],n=t.length;let r=0,i=0;for(;i"!==(t=t.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+t;n=n.map(dT);const i=dT(t.slice(1).trim());if(i.between)return{between:n,stream:i};i.between=n;return i}(t):function(t){const e={source:lT},n=[];let r,i,o=[0,0],a=0,u=0,s=t.length,l=0;if("}"===t[s-1]){if(l=t.lastIndexOf("{"),!(l>=0))throw"Unmatched right brace: "+t;try{o=function(t){const e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((e=>{const n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,s-1))}catch(e){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,l).trim()).length,l=0}if(!s)throw t;"@"===t[0]&&(a=++l);r=fT(t,l,":"),r1?(e.type=n[1],a?e.markname=n[0].slice(1):!function(t){return cT[t]}(n[0])?e.source=n[0]:e.marktype=n[0]):e.type=n[0];"!"===e.type.slice(-1)&&(e.consume=!0,e.type=e.type.slice(0,-1));null!=i&&(e.filter=i);o[0]&&(e.throttle=o[0]);o[1]&&(e.debounce=o[1]);return e}(t)}function pT(t){return x(t)?t:{type:t||"pad"}}const gT=t=>+t||0;function mT(t){return x(t)?t.signal?t:{top:gT(t.top),bottom:gT(t.bottom),left:gT(t.left),right:gT(t.right)}:{top:e=gT(t),bottom:e,left:e,right:e};var e}const yT=t=>x(t)&&!_(t)?tt({},t):{value:t};function vT(t,e,n,r){if(null!=n){return x(n)&&!_(n)||_(n)&&n.length&&x(n[0])?t.update[e]=n:t[r||"enter"][e]={value:n},1}return 0}function _T(t,e,n){for(const n in e)vT(t,n,e[n]);for(const e in n)vT(t,e,n[e],"update")}function xT(t,e,n){for(const r in e)n&&it(n,r)||(t[r]=tt(t[r]||{},e[r]));return t}function bT(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}const wT="mark",kT="frame",AT="scope",MT="legend-label",ET="title-text",DT="title-subtitle";function CT(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const FT=t=>gt(t)?kt(t):t.signal?"(".concat(t.signal,")"):zT(t);function ST(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map((t=>null==t?null:kt(t)));for(;e.length&&null==M(e);)e.pop();return e.unshift(FT(t.gradient)),"gradient(".concat(e.join(","),")")}(t);let e=t.signal?"(".concat(t.signal,")"):t.color?function(t){return t.c?BT("hcl",t.h,t.c,t.l):t.h||t.s?BT("hsl",t.h,t.s,t.l):t.l||t.a?BT("lab",t.l,t.a,t.b):t.r||t.g||t.b?BT("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?zT(t.field):void 0!==t.value?kt(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=FT(t.scale);null!=t.range?e="lerp(_range(".concat(n,"), ").concat(+t.range,")"):(void 0!==e&&(e="_scale(".concat(n,", ").concat(e,")")),t.band&&(e=(e?e+"+":"")+"_bandwidth(".concat(n,")")+(1==+t.band?"":"*"+TT(t.band)),t.extra&&(e="(datum.extra ? _scale(".concat(n,", datum.extra.value) : ").concat(e,")"))),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e="pow(".concat(e,",").concat(TT(t.exponent),")")),null!=t.mult&&(e+="*".concat(TT(t.mult))),null!=t.offset&&(e+="+".concat(TT(t.offset))),t.round&&(e="round(".concat(e,")")),e}const BT=(t,e,n,r)=>"(".concat(t,"(").concat([e,n,r].map(ST).join(","),")+'')");function TT(t){return x(t)?"("+ST(t)+")":t}function zT(t){return NT(x(t)?t:{datum:t})}function NT(t){let e,n,r;if(t.signal)e="datum",r=t.signal;else if(t.group||t.parent){for(n=Math.max(1,t.level||1),e="item";n-- >0;)e+=".mark.group";t.parent?(r=t.parent,e+=".datum"):r=t.group}else t.datum?(e="datum",r=t.datum):s("Invalid field reference: "+kt(t));return t.signal||(r=gt(r)?l(r).map(kt).join("]["):NT(r)),e+"["+r+"]"}function OT(t,e,n,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,e,n,r,i){const o={},a={};let u,s,l,c;for(s in s="lineBreak","text"!==e||null==i[s]||bT(s,t)||CT(o,s,i[s]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===kT?i.group:n===wT?tt({},i.mark,i[e]):null,c)l=bT(s,t)||("fill"===s||"stroke"===s)&&(bT("fill",t)||bT("stroke",t)),l||CT(o,s,c[s]);for(s in W(r).forEach((e=>{const n=i.style&&i.style[e];for(const e in n)bT(e,t)||CT(o,e,n[e])})),t=tt({},t),o)c=o[s],c.signal?(u=u||{})[s]=c:a[s]=c;return t.enter=tt(a,t.enter),u&&(t.update=tt(u,t.update)),t}(t,e,n,r,i.config);for(const n in t)a[n]=RT(t[n],e,o,i);return o}function RT(t,e,n,r){const i={},o={};for(const e in t)null!=t[e]&&(i[e]=LT((a=t[e],_(a)?function(t){let e="";return t.forEach((t=>{const n=ST(t);e+=t.test?"(".concat(t.test,")?").concat(n,":"):n})),":"===M(e)&&(e+="null"),e}(a):ST(a)),r,n,o));var a;return{$expr:{marktype:e,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function LT(t,e,n,r){const i=tB(t,e);return i.$fields.forEach((t=>r[t]=1)),tt(n,i.$params),i.$expr}const UT=["value","update","init","react","bind"];function qT(t,e){s(t+' for "outer" push: '+kt(e))}function PT(t,e){const n=t.name;if("outer"===t.push)e.signals[n]||qT("No prior signal definition",n),UT.forEach((e=>{void 0!==t[e]&&qT("Invalid property ",e)}));else{const r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function jT(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function IT(t,e,n,r){return new jT(t,e,n,r)}function $T(t,e){return IT("operator",t,e)}function WT(t){const e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function HT(t,e){return e?{$field:t,$name:e}:{$field:t}}const YT=HT("key");function VT(t,e){return{$compare:t,$order:e}}function GT(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e||"")}const XT="scope",JT="view";function ZT(t){return t&&t.signal}function QT(t){if(ZT(t))return!0;if(x(t))for(const e in t)if(QT(t[e]))return!0;return!1}function KT(t,e){return null!=t?t:e}function tz(t){return t&&t.signal||t}const ez="timer";function nz(t,e){return(t.merge?rz:t.stream?iz:t.type?oz:s("Invalid stream specification: "+kt(t)))(t,e)}function rz(t,e){const n=az({merge:t.merge.map((t=>nz(t,e)))},t,e);return e.addStream(n).id}function iz(t,e){const n=az({stream:nz(t.stream,e)},t,e);return e.addStream(n).id}function oz(t,e){let n;t.type===ez?(n=e.event(ez,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return t===XT?JT:t||JT}(t.source),t.type);const r=az({stream:n},t,e);return 1===Object.keys(r).length?n:e.addStream(r).id}function az(t,e,n){let r=e.between;return r&&(2!==r.length&&s('Stream "between" parameter must have 2 entries: '+kt(e)),t.between=[nz(r[0],n),nz(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),e.source===XT&&r.push("inScope(event.item)"),r.length&&(t.filter=tB("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}const uz={code:"_.$value",ast:{type:"Identifier",value:"value"}};function sz(t,e,n){const r=t.encode,i={target:n};let o=t.events,a=t.update,u=[];o||s("Signal update missing events specification."),gt(o)&&(o=function(t,e,n){return lT=e||"view",cT=n||sT,hT(t.trim()).map(dT)}(o,e.isSubscope()?XT:JT)),o=W(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[lz(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&s("Signal encode and update are mutually exclusive."),a="encode(item(),"+kt(r)+")"),i.update=gt(a)?tB(a,e):null!=a.expr?tB(a.expr,e):null!=a.value?a.value:null!=a.signal?{$expr:uz,$params:{$value:e.signalRef(a.signal)}}:s("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>e.addUpdate(tt(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):nz(t,e)}}(t,e),i))))}function lz(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const cz=t=>(e,n,r)=>IT(t,n,e||void 0,r),fz=cz("aggregate"),hz=cz("axisticks"),dz=cz("bound"),pz=cz("collect"),gz=cz("compare"),mz=cz("datajoin"),yz=cz("encode"),vz=cz("expression"),_z=cz("facet"),xz=cz("field"),bz=cz("key"),wz=cz("legendentries"),kz=cz("load"),Az=cz("mark"),Mz=cz("multiextent"),Ez=cz("multivalues"),Dz=cz("overlap"),Cz=cz("params"),Fz=cz("prefacet"),Sz=cz("projection"),Bz=cz("proxy"),Tz=cz("relay"),zz=cz("render"),Nz=cz("scale"),Oz=cz("sieve"),Rz=cz("sortitems"),Lz=cz("viewlayout"),Uz=cz("values");let qz=0;const Pz={min:"min",max:"max",count:"sum"};function jz(t,e){const n=e.getScale(t.name).params;let r;for(r in n.domain=Hz(t.domain,t,e),null!=t.range&&(n.range=Kz(t,e,n)),null!=t.interpolate&&function(t,e){e.interpolate=Iz(t.type||t),null!=t.gamma&&(e.interpolateGamma=Iz(t.gamma))}(t.interpolate,n),null!=t.nice&&(n.nice=function(t){return x(t)?{interval:Iz(t.interval),step:Iz(t.step)}:Iz(t)}(t.nice)),null!=t.bins&&(n.bins=function(t,e){return t.signal||_(t)?$z(t,e):e.objectProperty(t)}(t.bins,e)),t)it(n,r)||"name"===r||(n[r]=Iz(t[r],e))}function Iz(t,e){return x(t)?t.signal?e.signalRef(t.signal):s("Unsupported object: "+kt(t)):t}function $z(t,e){return t.signal?e.signalRef(t.signal):t.map((t=>Iz(t,e)))}function Wz(t){s("Can not find data set: "+kt(t))}function Hz(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(_(t)?Yz:t.fields?Gz:Vz)(t,e,n);null==e.domainMin&&null==e.domainMax||s("No scale domain defined for domainMin/domainMax to override.")}function Yz(t,e,n){return t.map((t=>Iz(t,n)))}function Vz(t,e,n){const r=n.getData(t.data);return r||Wz(t.data),_d(e.type)?r.valuesRef(n,t.field,Jz(t.sort,!1)):kd(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function Gz(t,e,n){const r=t.data,i=t.fields.reduce(((t,e)=>(e=gt(e)?{data:r,field:e}:_(e)||e.signal?function(t,e){const n="_:vega:_"+qz++,r=pz({});if(_(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+kt(n)+","+t.signal+")";r.params.input=e.signalRef(i)}return e.addDataPipeline(n,[r,Oz({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t)),[]);return(_d(e.type)?Xz:kd(e.type)?Zz:Qz)(t,n,i)}function Xz(t,e,n){const r=Jz(t.sort,!0);let i,o;const a=n.map((t=>{const n=e.getData(t.data);return n||Wz(t.data),n.countsRef(e,t.field,r)})),u={groupby:YT,pulse:a};r&&(i=r.op||"count",o=r.field?GT(i,r.field):"count",u.ops=[Pz[i]],u.fields=[e.fieldRef(o)],u.as=[o]),i=e.add(fz(u));const s=e.add(pz({pulse:WT(i)}));return o=e.add(Uz({field:YT,sort:e.sortRef(r),pulse:WT(s)})),WT(o)}function Jz(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!Pz[t.op]&&s("Multiple domain scales can not be sorted using "+t.op):s("No field provided for sort aggregate op: "+t.op):x(t)?t.field="key":t={field:"key"}),t}function Zz(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||Wz(t.data),n.domainRef(e,t.field)}));return WT(e.add(Ez({values:r})))}function Qz(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||Wz(t.data),n.extentRef(e,t.field)}));return WT(e.add(Mz({extents:r})))}function Kz(t,e,n){const r=e.config.range;let i=t.range;if(i.signal)return e.signalRef(i.signal);if(gt(i)){if(r&&it(r,i))return Kz(t=tt({},t,{range:r[i]}),e,n);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=_d(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:s("Unrecognized scale range value: "+kt(i))}else{if(i.scheme)return n.scheme=_(i.scheme)?$z(i.scheme,e):Iz(i.scheme,e),i.extent&&(n.schemeExtent=$z(i.extent,e)),void(i.count&&(n.schemeCount=Iz(i.count,e)));if(i.step)return void(n.rangeStep=Iz(i.step,e));if(_d(t.type)&&!_(i))return Hz(i,t,e);_(i)||s("Unsupported range type: "+kt(i))}return i.map((t=>(_(t)?$z:Iz)(t,e)))}function tN(t,e,n){return _(t)?t.map((t=>tN(t,e,n))):x(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:s("Unsupported parameter object: "+kt(t)):t}const eN="top",nN="left",rN="right",iN="bottom",oN="center",aN="index",uN="label",sN="perc",lN="value",cN="guide-label",fN="guide-title",hN="group-title",dN="group-subtitle",pN="symbol",gN="gradient",mN="discrete",yN="size",vN=[yN,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],_N={name:1,style:1,interactive:1},xN={value:0},bN={value:1},wN="group",kN="rect",AN="rule",MN="text";function EN(t){return t.type=wN,t.interactive=t.interactive||!1,t}function DN(t,e){const n=(n,r)=>KT(t[n],KT(e[n],r));return n.isVertical=n=>"vertical"===KT(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>KT(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>KT(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>KT(t.columns,KT(e.columns,+n.isVertical(!0))),n}function CN(t,e){const n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function FN(t,e,n){return"item.anchor === '".concat("start","' ? ").concat(t," : item.anchor === '").concat("end","' ? ").concat(e," : ").concat(n)}const SN=FN(kt(nN),kt(rN),kt(oN));function BN(t,e){return e?t?x(t)?Object.assign({},t,{offset:BN(t.offset,e)}):{value:t,offset:e}:e:t}function TN(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=xT(t.encode,e,_N)):t.interactive=!1,t}function zN(t,e,n,r){const i=DN(t,n),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,l,c,f,h;o?(l=[0,1],c=[0,0],f=a,h=u):(l=[0,0],c=[1,0],f=u,h=a);const d={enter:s={opacity:xN,x:xN,y:xN,width:yT(f),height:yT(h)},update:tt({},s,{opacity:bN,fill:{gradient:e,start:l,stop:c}}),exit:{opacity:xN}};return _T(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),TN({type:kN,role:"legend-gradient",encode:d},r)}function NN(t,e,n,r,i){const o=DN(t,n),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let l,c,f,h,d="";a?(l="y",f="y2",c="x",h="width",d="1-"):(l="x",f="x2",c="y",h="height");const p={opacity:xN,fill:{scale:e,field:lN}};p[l]={signal:d+"datum."+sN,mult:s},p[c]=xN,p[f]={signal:d+"datum.perc2",mult:s},p[h]=yT(u);const g={enter:p,update:tt({},p,{opacity:bN}),exit:{opacity:xN}};return _T(g,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),TN({type:kN,role:"legend-band",key:lN,from:i,encode:g},r)}const ON="datum.".concat(sN,'<=0?"').concat(nN,'":datum.').concat(sN,'>=1?"').concat(rN,'":"').concat(oN,'"'),RN="datum.".concat(sN,'<=0?"').concat(iN,'":datum.').concat(sN,'>=1?"').concat(eN,'":"').concat("middle",'"');function LN(t,e,n,r){const i=DN(t,e),o=i.isVertical(),a=yT(i.gradientThickness()),u=i.gradientLength();let s,l,c,f,h=i("labelOverlap"),d="";const p={enter:s={opacity:xN},update:l={opacity:bN,text:{field:uN}},exit:{opacity:xN}};return _T(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:KT(t.labelLimit,e.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=l.baseline={signal:RN},c="y",f="x",d="1-"):(s.align=l.align={signal:ON},s.baseline={value:"top"},c="x",f="y"),s[c]=l[c]={signal:d+"datum."+sN,mult:u},s[f]=l[f]=a,a.offset=KT(t.labelOffset,e.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum.index"}:void 0,TN({type:MN,role:MT,style:cN,key:lN,from:r,encode:p,overlap:h},n)}function UN(t,e,n,r,i){const o=DN(t,e),a=n.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},h="(".concat(i,") ? datum.").concat("offset"," : datum.").concat(yN),d=l?yT(l):{field:yN},p="datum.".concat(aN),g="max(1, ".concat(i,")");let m,y,v,_,x;d.mult=.5,m={enter:y={opacity:xN,x:{signal:h,mult:.5,offset:c},y:d},update:v={opacity:bN,x:y.x,y:y.y},exit:{opacity:xN}};let b=null,w=null;t.fill||(b=e.symbolBaseFillColor,w=e.symbolBaseStrokeColor),_T(m,{fill:o("symbolFillColor",b),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),vN.forEach((e=>{t[e]&&(v[e]=y[e]={scale:t[e],field:lN})}));const k=TN({type:"symbol",role:"legend-symbol",key:lN,from:f,clip:!!l||void 0,encode:m},n.symbols),A=yT(c);A.offset=o("labelOffset"),m={enter:y={opacity:xN,x:{signal:h,offset:A},y:d},update:v={opacity:bN,text:{field:uN},x:y.x,y:y.y},exit:{opacity:xN}},_T(m,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const M=TN({type:MN,role:MT,style:cN,key:lN,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:xN,height:l?yT(l):xN,opacity:xN},exit:{opacity:xN},update:v={opacity:bN,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(_="ceil(item.mark.items.length / ".concat(g,")"),v.row.signal="".concat(p,"%").concat(_),v.column.signal="floor(".concat(p," / ").concat(_,")"),x={field:["row",p]}):(v.row.signal="floor(".concat(p," / ").concat(g,")"),v.column.signal="".concat(p," % ").concat(g),x={field:p}),v.column.signal="(".concat(i,")?").concat(v.column.signal,":").concat(p),EN({role:AT,from:r={facet:{data:r,name:"value",groupby:aN}},encode:xT(m,a,_N),marks:[k,M],name:s,interactive:u,sort:x})}const qN='item.orient === "left"',PN='item.orient === "right"',jN="(".concat(qN," || ").concat(PN,")"),IN="datum.vgrad && ".concat(jN),$N=FN('"top"','"bottom"','"middle"'),WN=FN('"right"','"left"','"center"'),HN="datum.vgrad && ".concat(PN," ? (").concat(WN,") : (").concat(jN," && !(datum.vgrad && ").concat(qN,')) ? "left" : ').concat(SN),YN="item._anchor || (".concat(jN,' ? "middle" : "start")'),VN="".concat(IN," ? (").concat(qN," ? -90 : 90) : 0"),GN="".concat(jN," ? (datum.vgrad ? (").concat(PN,' ? "bottom" : "top") : ').concat($N,') : "top"');function XN(t,e){let n;return x(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+JN(t.path)+")":t.sphere&&(n="geoShape("+JN(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function JN(t){return x(t)&&t.signal?t.signal:kt(t)}function ZN(t){const e=t.role||"";return e.indexOf("axis")&&e.indexOf("legend")&&e.indexOf("title")?t.type===wN?AT:e||wT:e}function QN(t){return{marktype:t.type,name:t.name||void 0,role:t.role||ZN(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function KN(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function tO(t,e){const n=ya(t.type);n||s("Unrecognized transform type: "+kt(t.type));const r=IT(n.type.toLowerCase(),null,eO(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function eO(t,e,n){const r={},i=t.params.length;for(let o=0;oiO(t,e,n)))):iO(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!ZT(i)?i.map((e=>rO(t,e,n))):rO(t,i,n):void(t.required&&s("Missing required "+kt(e.type)+" parameter: "+kt(t.name)))}function rO(t,e,n){const r=t.type;if(ZT(e))return sO(r)?s("Expression references can not be signals."):lO(r)?n.fieldRef(e):cO(r)?n.compareRef(e):n.signalRef(e.signal);{const i=t.expr||lO(r);return i&&oO(e)?n.exprRef(e.expr,e.as):i&&aO(e)?HT(e.field,e.as):sO(r)?tB(e,n):uO(r)?WT(n.getData(e).values):lO(r)?HT(e):cO(r)?n.compareRef(e):e}}function iO(t,e,n){const r=t.params.length;let i;for(let n=0;nt&&t.expr,aO=t=>t&&t.field,uO=t=>"data"===t,sO=t=>"expr"===t,lO=t=>"field"===t,cO=t=>"compare"===t;function fO(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:WT(e.getData(t.data).output)}function hO(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}function dO(t){return gt(t)?t:null}function pO(t,e,n){const r=GT(n.op,n.field);let i;if(e.ops){for(let t=0,n=e.as.length;tnull==t?"null":t)).join(",")+"),0)",e);s.update=l.$expr,s.params=l.$params}function yO(t,e){const n=ZN(t),r=t.type===wN,i=t.from&&t.from.facet,o=t.overlap;let a,u,l,c,f,h,d,p=t.layout||n===AT||n===kT;const g=n===wT||p||i,m=function(t,e,n){let r,i,o,a,u;return t?(r=t.facet)&&(e||s("Only group marks can be faceted."),null!=r.field?a=u=fO(r,n):(t.data?u=WT(n.getData(t.data).aggregate):(o=tO(tt({type:"aggregate",groupby:W(r.groupby)},r.aggregate),n),o.params.key=n.keyRef(r.groupby),o.params.pulse=fO(r,n),a=u=WT(n.add(o))),i=n.keyRef(r.groupby,!0))):a=WT(n.add(pz(null,[{}]))),a||(a=fO(t,n)),{key:i,pulse:a,parent:u}}(t.from,r,e);u=e.add(mz({key:m.key||(t.key?HT(t.key):void 0),pulse:m.pulse,clean:!r}));const y=WT(u);u=l=e.add(pz({pulse:y})),u=e.add(Az({markdef:QN(t),interactive:KN(t.interactive,e),clip:XN(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:WT(u)}));const v=WT(u);u=c=e.add(yz(OT(t.encode,t.type,n,t.style,e,{mod:!1,pulse:v}))),u.params.parent=e.encode(),t.transform&&t.transform.forEach((t=>{const n=tO(t,e),r=n.metadata;(r.generates||r.changes)&&s("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),n.params.pulse=WT(u),e.add(u=n)})),t.sort&&(u=e.add(Rz({sort:e.compareRef(t.sort),pulse:WT(u)})));const _=WT(u);(i||p)&&(p=e.add(Lz({layout:e.objectProperty(t.layout),legends:e.legends,mark:v,pulse:_})),h=WT(p));const x=e.add(dz({mark:v,pulse:h||_}));d=WT(x),r&&(g&&(a=e.operators,a.pop(),p&&a.pop()),e.pushState(_,h||d,y),i?function(t,e,n){const r=t.from.facet,i=r.name,o=fO(r,e);let a;r.name||s("Facet must have a name: "+kt(r)),r.data||s("Facet must reference a data set: "+kt(r)),r.field?a=e.add(Fz({field:e.fieldRef(r.field),pulse:o})):r.groupby?a=e.add(_z({key:e.keyRef(r.groupby),group:WT(e.proxy(n.parent)),pulse:o})):s("Facet must specify groupby or field: "+kt(r));const u=e.fork(),l=u.add(pz()),c=u.add(Oz({pulse:WT(l)}));u.addData(i,new hO(u,l,l,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,e,m):g?function(t,e,n){const r=e.add(Fz({pulse:n.pulse})),i=e.fork();i.add(Oz()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,e,m):e.parse(t),e.popState(),g&&(p&&a.push(p),a.push(x))),o&&(d=function(t,e,n){const r=t.method,i=t.bound,o=t.separation,a={separation:ZT(o)?n.signalRef(o.signal):o,method:ZT(r)?n.signalRef(r.signal):r,pulse:e};t.order&&(a.sort=n.compareRef({field:t.order}));if(i){const t=i.tolerance;a.boundTolerance=ZT(t)?n.signalRef(t.signal):+t,a.boundScale=n.scaleRef(i.scale),a.boundOrient=i.orient}return WT(n.add(Dz(a)))}(o,d,e));const b=e.add(zz({pulse:d})),w=e.add(Oz({pulse:WT(b)},void 0,e.parent()));null!=t.name&&(f=t.name,e.addData(f,new hO(e,l,b,w)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&s("Marks only support modify triggers."),mO(t,e,f)})))}function vO(t,e){const n=e.config.legend,r=t.encode||{},i=DN(t,n),o=r.legend||{},a=o.name||void 0,u=o.interactive,l=o.style,c={};let f,h,d,p=0;vN.forEach((e=>t[e]?(c[e]=t[e],p=p||t[e]):0)),p||s("Missing valid scale for legend.");const g=function(t,e){let n=t.type||pN;t.type||1!==function(t){return vN.reduce(((e,n)=>e+(t[n]?1:0)),0)}(t)||!t.fill&&!t.stroke||(n=vd(e)?gN:xd(e)?mN:pN);return n!==gN?n:xd(e)?mN:gN}(t,e.scaleType(p)),m={title:null!=t.title,scales:c,type:g,vgrad:"symbol"!==g&&i.isVertical()},y=WT(e.add(pz(null,[m]))),v=WT(e.add(wz(h={type:g,scale:e.scaleRef(p),count:e.objectProperty(i("tickCount")),limit:e.property(i("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)})));return g===gN?(d=[zN(t,p,n,r.gradient),LN(t,n,r.labels,v)],h.count=h.count||e.signalRef("max(2,2*floor((".concat(tz(i.gradientLength()),")/100))"))):g===mN?d=[NN(t,p,n,r.gradient,v),LN(t,n,r.labels,v)]:(f=function(t,e){const n=DN(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,n),d=[UN(t,n,r,v,tz(f.columns))],h.size=function(t,e,n){const r=tz(xO("size",t,n)),i=tz(xO("strokeWidth",t,n)),o=tz(function(t,e,n){return CN("fontSize",t)||function(t,e,n){const r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,cN));return tB("max(ceil(sqrt(".concat(r,")+").concat(i,"),").concat(o,")"),e)}(t,e,d[0].marks)),d=[EN({role:"legend-entry",from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:f,interactive:u})],m.title&&d.push(function(t,e,n,r){const i=DN(t,e),o={enter:{opacity:xN},update:{opacity:bN,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:xN}};return _T(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:YN},angle:{signal:VN},align:{signal:HN},baseline:{signal:GN},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),TN({type:MN,role:"legend-title",style:fN,from:r,encode:o},n)}(t,n,r.title,y)),yO(EN({role:"legend",from:y,encode:xT(_O(i,t,n),o,_N),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:l}),e)}function _O(t,e,n){const r={enter:{},update:{}};return _T(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}function xO(t,e,n){return e[t]?'scale("'.concat(e[t],'",datum)'):CN(t,n[0].encode)}hO.fromEntries=function(t,e){const n=e.length,r=e[n-1],i=e[n-2];let o=e[0],a=null,u=1;for(o&&"load"===o.type&&(o=e[1]),t.add(e[0]);u{n.push(tO(t,e))})),t.on&&t.on.forEach((n=>{mO(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){const r=[];let i,o,a,u,s,l=null,c=!1,f=!1;t.values?ZT(t.values)||QT(t.format)?(r.push(EO(e,t)),r.push(l=MO())):r.push(l=MO({$ingest:t.values,$format:t.format})):t.url?QT(t.url)||QT(t.format)?(r.push(EO(e,t)),r.push(l=MO())):r.push(l=MO({$request:t.url,$format:t.format})):t.source&&(l=i=W(t.source).map((t=>WT(e.getData(t).output))),r.push(null));for(o=0,a=n.length;ot===iN||t===eN,CO=(t,e,n)=>ZT(t)?NO(t.signal,e,n):t===nN||t===eN?e:n,FO=(t,e,n)=>ZT(t)?TO(t.signal,e,n):DO(t)?e:n,SO=(t,e,n)=>ZT(t)?zO(t.signal,e,n):DO(t)?n:e,BO=(t,e,n)=>ZT(t)?OO(t.signal,e,n):t===eN?{value:e}:{value:n},TO=(t,e,n)=>LO("".concat(t," === '").concat(eN,"' || ").concat(t," === '").concat(iN,"'"),e,n),zO=(t,e,n)=>LO("".concat(t," !== '").concat(eN,"' && ").concat(t," !== '").concat(iN,"'"),e,n),NO=(t,e,n)=>qO("".concat(t," === '").concat(nN,"' || ").concat(t," === '").concat(eN,"'"),e,n),OO=(t,e,n)=>qO("".concat(t," === '").concat(eN,"'"),e,n),RO=(t,e,n)=>qO("".concat(t," === '").concat(rN,"'"),e,n),LO=(t,e,n)=>(e=null!=e?yT(e):e,n=null!=n?yT(n):n,UO(e)&&UO(n)?(e=e?e.signal||kt(e.value):null,n=n?n.signal||kt(n.value):null,{signal:"".concat(t," ? (").concat(e,") : (").concat(n,")")}):[tt({test:t},e)].concat(n||[])),UO=t=>null==t||1===Object.keys(t).length,qO=(t,e,n)=>({signal:"".concat(t," ? (").concat(jO(e),") : (").concat(jO(n),")")}),PO=(t,e,n,r,i)=>({signal:(null!=r?"".concat(t," === '").concat(nN,"' ? (").concat(jO(r),") : "):"")+(null!=n?"".concat(t," === '").concat(iN,"' ? (").concat(jO(n),") : "):"")+(null!=i?"".concat(t," === '").concat(rN,"' ? (").concat(jO(i),") : "):"")+(null!=e?"".concat(t," === '").concat(eN,"' ? (").concat(jO(e),") : "):"")+"(null)"}),jO=t=>ZT(t)?t.signal:null==t?null:kt(t),IO=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function $O(t,e,n,r){let i;if(e&&it(e,t))return e[t];if(it(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r["guide-title"][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r["guide-label"][i]}return null}function WO(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function HO(t,e){return{scale:t.scale,range:e}}function YO(t,e,n,r,i){const o=DN(t,e),a=t.orient,u=t.gridScale,s=CO(a,1,-1),l=function(t,e){if(1===e);else if(x(t)){let n=t=tt({},t);for(;null!=n.mult;){if(!x(n.mult))return n.mult=ZT(e)?{signal:"(".concat(n.mult,") * (").concat(e.signal,")")}:n.mult*e,t;n=n.mult=tt({},n.mult)}n.mult=e}else t=ZT(e)?{signal:"(".concat(e.signal,") * (").concat(t||0,")")}:e*(t||0);return t}(t.offset,s);let c,f,h;const d={enter:c={opacity:xN},update:h={opacity:bN},exit:f={opacity:xN}};_T(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:t.scale,field:lN,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},g=FO(a,{signal:"height"},{signal:"width"}),m=u?{scale:u,range:0,mult:s,offset:l}:{value:0,offset:l},y=u?{scale:u,range:1,mult:s,offset:l}:tt(g,{mult:s,offset:l});return c.x=h.x=FO(a,p,m),c.y=h.y=SO(a,p,m),c.x2=h.x2=SO(a,y),c.y2=h.y2=FO(a,y),f.x=FO(a,p),f.y=SO(a,p),TN({type:AN,role:"axis-grid",key:lN,from:r,encode:d},n)}function VO(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function GO(t,e,n,r,i,o){const a=DN(t,e),u=t.orient,s=t.scale,l=CO(u,-1,1),c=tz(a("labelFlush")),f=tz(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let p,g=0===c||!!c;const m=yT(i);m.mult=l,m.offset=yT(a("labelPadding")||0),m.offset.mult=l;const y={scale:s,field:lN,band:.5,offset:BN(o.offset,a("labelOffset"))},v=FO(u,g?VO(s,c,'"left"','"right"','"center"'):{value:"center"},((t,e,n)=>ZT(t)?RO(t.signal,e,n):t===rN?{value:e}:{value:n})(u,"left","right")),_=FO(u,BO(u,"bottom","top"),g?VO(s,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=VO(s,c,"-(".concat(f,")"),f,0);g=g&&f;const b={opacity:xN,x:FO(u,y,m),y:SO(u,y,m)},w={enter:b,update:p={opacity:bN,text:{field:uN},x:b.x,y:b.y,align:v,baseline:_},exit:{opacity:xN,x:b.x,y:b.y}};_T(w,{dx:!h&&g?FO(u,x):null,dy:!d&&g?SO(u,x):null}),_T(w,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const k=a("labelBound");let A=a("labelOverlap");return A=A||k?{separation:a("labelSeparation"),method:A,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,p.align!==v&&(p.align=IO(p.align,v)),p.baseline!==_&&(p.baseline=IO(p.baseline,_)),TN({type:MN,role:"axis-label",style:cN,key:lN,from:r,encode:w,overlap:A},n)}function XO(t,e,n,r){const i=DN(t,e),o=t.orient,a=CO(o,-1,1);let u,s;const l={enter:u={opacity:xN,anchor:yT(i("titleAnchor",null)),align:{signal:SN}},update:s=tt({},u,{opacity:bN,text:yT(t.title)}),exit:{opacity:xN}},c={signal:'lerp(range("'.concat(t.scale,'"), ').concat(FN(0,1,.5),")")};return s.x=FO(o,c),s.y=SO(o,c),u.angle=FO(o,xN,((t,e)=>0===e?0:ZT(t)?{signal:"(".concat(t.signal,") * ").concat(e)}:{value:t*e})(a,90)),u.baseline=FO(o,BO(o,iN,eN),{value:iN}),s.angle=u.angle,s.baseline=u.baseline,_T(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=IO(yT(t),n.update[e]),!1):!bT(e,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");n.enter.auto=a===o?yT(a):FO(e,yT(a),yT(o))}(i,o,l,n),l.update.align=IO(l.update.align,u.align),l.update.angle=IO(l.update.angle,u.angle),l.update.baseline=IO(l.update.baseline,u.baseline),TN({type:MN,role:"axis-title",style:fN,from:r,encode:l},n)}function JO(t,e){const n=function(t,e){var n,r,i,o=e.config,a=o.style,u=o.axis,s="band"===e.scaleType(t.scale)&&o.axisBand,l=t.orient;if(ZT(l)){const t=WO([o.axisX,o.axisY]),e=WO([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(n={},t))n[i]=FO(l,$O(i,o.axisX,u,a),$O(i,o.axisY,u,a));for(i of(r={},e))r[i]=PO(l.signal,$O(i,o.axisTop,u,a),$O(i,o.axisBottom,u,a),$O(i,o.axisLeft,u,a),$O(i,o.axisRight,u,a))}else n=l===eN||l===iN?o.axisX:o.axisY,r=o["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||s?tt({},u,n,r,s):u}(t,e),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=DN(t,n),l=function(t){const e=t("tickBand");let n,r,i=t("tickOffset");return e?e.signal?(n={signal:"(".concat(e.signal,") === 'extent' ? 1 : 0.5")},r={signal:"(".concat(e.signal,") === 'extent'")},x(i)||(i={signal:"(".concat(e.signal,") === 'extent' ? 0 : ").concat(i)})):"extent"===e?(n=1,r=!0,i=0):(n=.5,r=!1):(n=t("bandPosition"),r=t("tickExtra")),{extra:r,band:n,offset:i}}(s),c={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},f=WT(e.add(pz({},[c]))),h=WT(e.add(hz({scale:e.scaleRef(t.scale),extra:e.property(l.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),d=[];let p;return c.grid&&d.push(YO(t,n,r.grid,h,l)),c.ticks&&(p=s("tickSize"),d.push(function(t,e,n,r,i,o){const a=DN(t,e),u=t.orient,s=CO(u,-1,1);let l,c,f;const h={enter:l={opacity:xN},update:f={opacity:bN},exit:c={opacity:xN}};_T(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=yT(i);d.mult=s;const p={scale:t.scale,field:lN,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=FO(u,xN,p),f.y2=l.y2=FO(u,d),c.x=FO(u,p),f.x=l.x=SO(u,xN,p),f.x2=l.x2=SO(u,d),c.y=SO(u,p),TN({type:AN,role:"axis-tick",key:lN,from:r,encode:h},n)}(t,n,r.ticks,h,p,l))),c.labels&&(p=c.ticks?p:0,d.push(GO(t,n,r.labels,h,p,l))),c.domain&&d.push(function(t,e,n,r){const i=DN(t,e),o=t.orient;let a,u;const s={enter:a={opacity:xN},update:u={opacity:bN},exit:{opacity:xN}};_T(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=HO(t,0),c=HO(t,1);return a.x=u.x=FO(o,l,xN),a.x2=u.x2=FO(o,c),a.y=u.y=SO(o,l,xN),a.y2=u.y2=SO(o,c),TN({type:AN,role:"axis-domain",from:r,encode:s},n)}(t,n,r.domain,f)),c.title&&d.push(XO(t,n,r.title,f)),yO(EN({role:"axis",from:f,encode:xT(ZO(s,t),i,_N),marks:d,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),e)}function ZO(t,e){const n={enter:{},update:{}};return _T(n,{orient:t("orient"),offset:t("offset")||0,position:KT(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:'abs(span(range("'.concat(e.scale,'")))')},translate:t("translate"),format:e.format,formatType:e.formatType}),n}function QO(t,e,n){const r=W(t.signals),i=W(t.scales);return n||r.forEach((t=>PT(t,e))),W(t.projections).forEach((t=>function(t,e){const n=e.config.projection||{},r={};for(const n in t)"name"!==n&&(r[n]=tN(t[n],n,e));for(const t in n)null==r[t]&&(r[t]=tN(n[t],t,e));e.addProjection(t.name,r)}(t,e))),i.forEach((t=>function(t,e){const n=t.type||"linear";md(n)||s("Unrecognized scale type: "+kt(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e))),W(t.data).forEach((t=>AO(t,e))),i.forEach((t=>jz(t,e))),(n||r).forEach((t=>function(t,e){const n=e.getSignal(t.name);let r=t.update;t.init&&(r?s("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=tB(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((t=>sz(t,e,n.id)))}(t,e))),W(t.axes).forEach((t=>JO(t,e))),W(t.marks).forEach((t=>yO(t,e))),W(t.legends).forEach((t=>vO(t,e))),t.title&&wO(t.title,e),e.parseLambdas(),e}function KO(t,e){const n=e.config,r=WT(e.root=e.add($T())),i=function(t,e){const n=n=>KT(t[n],e[n]),r=[tR("background",n("background")),tR("autosize",pT(n("autosize"))),tR("padding",mT(n("padding"))),tR("width",n("width")||0),tR("height",n("height")||0)],i=r.reduce(((t,e)=>(t[e.name]=e,t)),{}),o={};return W(t.signals).forEach((t=>{it(i,t.name)?t=tt(i[t.name],t):r.push(t),o[t.name]=t})),W(e.signals).forEach((t=>{it(o,t.name)||it(i,t.name)||r.push(t)})),r}(t,n);i.forEach((t=>PT(t,e))),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const o=e.add(pz()),a=e.add(yz(OT((t=>xT({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),wN,kT,t.style,e,{pulse:WT(o)}))),u=e.add(Lz({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:WT(a)}));e.operators.pop(),e.pushState(WT(a),WT(u),null),QO(t,e,i),e.operators.push(u);let s=e.add(dz({mark:r,pulse:WT(u)}));return s=e.add(zz({pulse:WT(s)})),s=e.add(Oz({pulse:WT(s)})),e.addData("root",new hO(e,o,o,s)),e}function tR(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function eR(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function nR(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function rR(t){return(_(t)?iR:oR)(t)}function iR(t){const e=t.length;let n="[";for(let r=0;r0?",":"")+(x(e)?e.signal||rR(e):kt(e))}return n+"]"}function oR(t){let e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+kt(e)+":"+(x(n)?n.signal||rR(n):kt(n));return r+"}"}eR.prototype=nR.prototype={parse(t){return QO(t,this)},fork(){return new nR(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((e=>{e.$ref=t.id})),t.refs=null),t},proxy(t){const e=t instanceof jT?WT(t):t;return this.add(Bz({value:e}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){let r,i;t&&(r=t.data||(t.data={}),i=r[e]||(r[e]=[]),i.push(n))}for(t in this.data){e=this.data[t],n(e.input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values");for(const r in e.index)n(e.index[r],t,"index:"+r)}return this},pushState(t,e,n){this._encode.push(WT(this.add(Oz({pulse:t})))),this._parent.push(e),this._lookup.push(n?WT(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return M(this._parent)},encode(){return M(this._encode)},lookup(){return M(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,e){if(gt(t))return HT(t,e);t.signal||s("Unsupported field reference: "+kt(t));const n=t.signal;let r=this.field[n];if(!r){const t={name:this.signalRef(n)};e&&(t.as=e),this.field[n]=r=WT(this.add(xz(t)))}return r},compareRef(t){let e=!1;const n=t=>ZT(t)?(e=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(e=!0,this.exprRef(t.expr)):t,r=W(t.field).map(n),i=W(t.order).map(n);return e?WT(this.add(gz({fields:r,orders:i}))):VT(r,i)},keyRef(t,e){let n=!1;const r=this.signals;return t=W(t).map((t=>ZT(t)?(n=!0,WT(r[t.signal])):t)),n?WT(this.add(bz({fields:t,flat:e}))):function(t,e){const n={$key:t};return e&&(n.$flat=!0),n}(t,e)},sortRef(t){if(!t)return t;const e=GT(t.op,t.field),n=t.order||"ascending";return n.signal?WT(this.add(gz({fields:e,orders:this.signalRef(n.signal)}))):VT(e,n)},event(t,e){const n=t+":"+e;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},hasOwnSignal(t){return it(this.signals,t)},addSignal(t,e){this.hasOwnSignal(t)&&s("Duplicate signal name: "+kt(t));const n=e instanceof jT?e:this.add($T(e));return this.signals[t]=n},getSignal(t){return this.signals[t]||s("Unrecognized signal name: "+kt(t)),this.signals[t]},signalRef(t){return this.signals[t]?WT(this.signals[t]):(it(this.lambdas,t)||(this.lambdas[t]=this.add($T(null))),WT(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let e=0,n=t.length;er+Math.floor(o*t.random()),pdf:t=>t===Math.floor(t)&&t>=r&&t=i?1:(e-r+1)/o},icdf:t=>t>=0&&t<=1?r-1+Math.floor(t*o):NaN};return a.min(e).max(n)},t.randomKDE=Na,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=qa,t.randomMixture=Pa,t.randomNormal=za,t.randomUniform=Ha,t.read=Fo,t.regressionExp=Qa,t.regressionLinear=Ja,t.regressionLoess=ru,t.regressionLog=Za,t.regressionPoly=eu,t.regressionPow=Ka,t.regressionQuad=tu,t.renderModule=kv,t.repeat=xt,t.resetDefaultLocale=function(){return vo(),ko(),Co()},t.resetSVGClipId=Jp,t.resetSVGDefIds=function(){Jp(),tp=0},t.responseType=ge,t.runtimeContext=lB,t.sampleCurve=uu,t.sampleLogNormal=Oa,t.sampleNormal=Fa,t.sampleUniform=ja,t.scale=gd,t.sceneEqual=Sv,t.sceneFromJSON=Km,t.scenePickVisit=Wg,t.sceneToJSON=Qm,t.sceneVisit=$g,t.sceneZOrder=Ig,t.scheme=zd,t.serializeXML=Qy,t.setRandom=function(e){t.random=e},t.span=wt,t.splitAccessPath=l,t.stringValue=kt,t.textMetrics=Fm,t.timeBin=Pr,t.timeFloor=hr,t.timeFormatLocale=Mo,t.timeInterval=vr,t.timeOffset=br,t.timeSequence=Ar,t.timeUnitSpecifier=Vn,t.timeUnits=Hn,t.toBoolean=At,t.toDate=Et,t.toNumber=E,t.toSet=Ct,t.toString=Dt,t.transform=va,t.transforms=ma,t.truncate=Ft,t.truthy=g,t.tupleid=Ro,t.typeParsers=It,t.utcFloor=gr,t.utcInterval=_r,t.utcOffset=wr,t.utcSequence=Mr,t.utcdayofyear=nr,t.utcquarter=$,t.utcweek=rr,t.version=aR,t.visitArray=St,t.week=Zn,t.writeConfig=k,t.zero=d,t.zoomLinear=U,t.zoomLog=q,t.zoomPow=P,t.zoomSymlog=j,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=vega.min.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy