Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
<title>VegaLite plot</title>
<meta charset="UTF-8">
<script>!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).vega={})}(this,(function(t){"use strict";function n(t,n,e){return t.fields=n||[],t.fname=e,t}function e(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){throw Error(t)}function a(t){var n,e,r,a=[],u=null,o=0,s=t.length,l="";function c(){a.push(l+t.substring(n,e)),l="",n=e+1}for(t+="",n=e=0;e<s;++e)if("\\"===(r=t[e]))l+=t.substring(n,e),n=++e;else if(r===u)c(),u=null,o=-1;else{if(u)continue;n===o&&'"'===r?(n=e+1,u=r):n===o&&"'"===r?(n=e+1,u=r):"."!==r||o?"["===r?(e>n&&c(),o=n=e+1):"]"===r&&(o||i("Access path missing open bracket: "+t),o>0&&c(),o=0,n=e+1):e>n?c():n=e+1}return o&&i("Access path missing closing bracket: "+t),u&&i("Access path missing closing quote: "+t),e>n&&(e++,c()),a}var u=Array.isArray;function o(t){return t===Object(t)}function s(t){return"string"==typeof t}function l(t){return u(t)?"["+t.map(l)+"]":o(t)||s(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function c(t,e){var r=a(t),i="return _["+r.map(l).join("][")+"];";return n(Function("_",i),[t=1===r.length?r[0]:t],e||t)}var f=[],h=c("id"),d=n((function(t){return t}),f,"identity"),p=n((function(){return 0}),f,"zero"),g=n((function(){return 1}),f,"one"),m=n((function(){return!0}),f,"true"),v=n((function(){return!1}),f,"false");function y(t,n,e){var r=[n].concat([].slice.call(e));console[t].apply(console,r)}var _=0,x=1,b=2,w=3,A=4;function k(t,n){var e=t||_;return{level:function(t){return arguments.length?(e=+t,this):e},error:function(){return e>=x&&y(n||"error","ERROR",arguments),this},warn:function(){return e>=b&&y(n||"warn","WARN",arguments),this},info:function(){return e>=w&&y(n||"log","INFO",arguments),this},debug:function(){return e>=A&&y(n||"log","DEBUG",arguments),this}}}function M(...t){return t.reduce((t,n)=>{for(var e in n)if("signals"===e)t.signals=D(t.signals,n.signals);else{var r="legend"===e?{layout:1}:"style"===e||null;E(t,e,n[e],r)}return t},{})}function E(t,n,e,r){var i,a;if(o(e)&&!u(e))for(i in a=o(t[n])?t[n]:t[n]={},e)r&&(!0===r||r[i])?E(a,i,e[i]):a[i]=e[i];else t[n]=e}function D(t,n){if(null==t)return n;const e={},r=[];function i(t){e[t.name]||(e[t.name]=1,r.push(t))}return n.forEach(i),t.forEach(i),r}function C(t){return t[t.length-1]}function F(t){return null==t||""===t?null:+t}function S(t){return function(n){return t*Math.exp(n)}}function B(t){return function(n){return Math.log(t*n)}}function T(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function z(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function N(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function O(t,n,e,r){var i=e(t[0]),a=e(C(t)),u=(a-i)*n;return[r(i-u),r(a-u)]}function R(t,n){return O(t,n,F,d)}function q(t,n){var e=Math.sign(t[0]);return O(t,n,B(e),S(e))}function L(t,n,e){return O(t,n,N(e),N(1/e))}function U(t,n,e){return O(t,n,T(e),z(e))}function $(t,n,e,r,i){var a=r(t[0]),u=r(C(t)),o=null!=n?r(n):(a+u)/2;return[i(o+(a-o)*e),i(o+(u-o)*e)]}function P(t,n,e){return $(t,n,e,F,d)}function j(t,n,e){var r=Math.sign(t[0]);return $(t,n,e,B(r),S(r))}function I(t,n,e,r){return $(t,n,e,N(r),N(1/r))}function H(t,n,e,r){return $(t,n,e,T(r),z(r))}function W(t){return 1+~~(new Date(t).getMonth()/3)}function Y(t){return 1+~~(new Date(t).getUTCMonth()/3)}function V(t){return null!=t?u(t)?t:[t]:[]}function G(t,n,e){var r,i=t[0],a=t[1];return a<i&&(r=a,a=i,i=r),(r=a-i)>=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function X(t){return"function"==typeof t}function J(t,e){var i,u,o,s,c,f,h,d,p,g=[],m=(t=V(t)).map((function(t,n){return null==t?null:(g.push(n),X(t)?t:a(t).map(l).join("]["))})),v=g.length-1,y=V(e),_="var u,v;return ";if(v<0)return null;for(u=0;u<=v;++u)X(o=m[i=g[u]])?(s="(u=this."+(f="f"+i)+"(a))",c="(v=this."+f+"(b))",(h=h||{})[f]=o):(s="(u=a["+o+"])",c="(v=b["+o+"])"),f="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==y[i]?(p=1,d=-1):(p=-1,d=1),_+="("+s+"<"+c+"||u==null)&&v!=null?"+d+":(u>v||v==null)&&u!=null?"+p+":"+f+"!==u&&v===v?"+d+":v!==v&&u===u?"+p+(i<v?":":":0");return o=Function("a","b",_+";"),h&&(o=o.bind(h)),t=t.reduce((function(t,n){return X(n)?(r(n)||[]).forEach((function(n){t[n]=1})):null!=n&&(t[n+""]=1),t}),{}),n(o,Object.keys(t))}function Z(t){return X(t)?t:function(){return t}}function Q(t,n){var e,r;function i(){n(r),e=r=null}return function(n){r=n,e&&clearTimeout(e),e=setTimeout(i,t)}}function K(t){for(var n,e,r=1,i=arguments.length;r<i;++r)for(e in n=arguments[r])t[e]=n[e];return t}function tt(t,n){var e,r,i,a,u=0;if(t&&(e=t.length))if(null==n){for(r=t[u];u<e&&(null==r||r!=r);r=t[++u]);for(i=a=r;u<e;++u)null!=(r=t[u])&&(r<i&&(i=r),r>a&&(a=r))}else{for(r=n(t[u]);u<e&&(null==r||r!=r);r=n(t[++u]));for(i=a=r;u<e;++u)null!=(r=n(t[u]))&&(r<i&&(i=r),r>a&&(a=r))}return[i,a]}function nt(t,n){var e,r,i,a,u,o=-1,s=t.length;if(null==n){for(;++o<s;)if(null!=(r=t[o])&&r>=r){e=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++o<s;)null!=(r=t[o])&&(e>r&&(e=r,a=o),i<r&&(i=r,u=o))}else{for(;++o<s;)if(null!=(r=n(t[o],o,t))&&r>=r){e=i=r;break}if(o===s)return[-1,-1];for(a=u=o;++o<s;)null!=(r=n(t[o],o,t))&&(e>r&&(e=r,a=o),i<r&&(i=r,u=o))}return[a,u]}const et=Object.prototype.hasOwnProperty;function rt(t,n){return et.call(t,n)}var it={};function at(t){var n,e,r={};function i(t){return rt(r,t)&&r[t]!==it}return n={size:0,empty:0,object:r,has:i,get:function(t){return i(t)?r[t]:void 0},set:function(t,e){return i(t)||(++n.size,r[t]===it&&--n.empty),r[t]=e,this},delete:function(t){return i(t)&&(--n.size,++n.empty,r[t]=it),this},clear:function(){n.size=n.empty=0,n.object=r={}},test:function(t){return arguments.length?(e=t,n):e},clean:function(){var t,i,a={},u=0;for(t in r)(i=r[t])===it||e&&e(i)||(a[t]=i,++u);n.size=u,n.empty=0,n.object=r=a}},t&&Object.keys(t).forEach((function(e){n.set(e,t[e])})),n}function ut(t,n,e,r,i,a){if(!e&&0!==e)return a;var u,o,s=t[0],l=C(t),c=+e;return l<s&&(u=s,s=l,l=u),(u=Math.abs(n-s))<(o=Math.abs(l-n))&&u<=c?r:o<=c?i:a}function ot(t,n){var e=t.prototype=Object.create(n.prototype);return e.constructor=t,e}function st(t,n,e,r){var i,a=n[0],u=n[n.length-1];return a>u&&(i=a,a=u,u=i),r=void 0===r||r,((e=void 0===e||e)?a<=t:a<t)&&(r?t<=u:t<u)}function lt(t){return"boolean"==typeof t}function ct(t){return"[object Date]"===Object.prototype.toString.call(t)}function ft(t){return"number"==typeof t}function ht(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function dt(t,e){return t&&(t=e?V(t).map((function(t){return t.replace(/\\(.)/g,"$1")})):V(t)),n(t&&t.length?Function("_","return ''+"+t.map((function(t){return"_["+(e?l(t):a(t).map(l).join("]["))+"]"})).join("+'|'+")+";"):function(){return""},t,"key")}function pt(t,n){const e=t[0],r=C(t),i=+n;return i?1===i?r:e+i*(r-e):e}function gt(t,n,e,r){var i=n.length,a=e.length;if(!a)return n;if(!i)return e;for(var u=r||new n.constructor(i+a),o=0,s=0,l=0;o<i&&s<a;++l)u[l]=t(n[o],e[s])>0?e[s++]:n[o++];for(;o<i;++o,++l)u[l]=n[o];for(;s<a;++s,++l)u[l]=e[s];return u}function mt(t,n){for(var e="";--n>=0;)e+=t;return e}function vt(t,n,e,r){var i=e||" ",a=t+"",u=n-a.length;return u<=0?a:"left"===r?mt(i,u)+a:"center"===r?mt(i,~~(u/2))+a+mt(i,Math.ceil(u/2)):a+mt(i,u)}function yt(t){return t&&C(t)-t[0]||0}function _t(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function xt(t){return ft(t)?t:ct(t)?t:Date.parse(t)}function bt(t,n){return n=n||xt,null==t||""===t?null:n(t)}function wt(t){return null==t||""===t?null:t+""}function At(t){for(var n={},e=0,r=t.length;e<r;++e)n[t[e]]=!0;return n}function kt(t,n,e,r){var i=null!=r?r:"…",a=t+"",u=a.length,o=Math.max(0,n-i.length);return u<=n?a:"left"===e?i+a.slice(u-o):"center"===e?a.slice(0,Math.ceil(o/2))+i+a.slice(u-~~(o/2)):a.slice(0,o)+i}function Mt(t,n,e){if(t){var r,i=0,a=t.length;if(n)for(;i<a;++i)(r=n(t[i]))&&e(r,i,t);else t.forEach(e)}}function Et(t){var n=t||d,e=[],r={};return e.add=function(t){var i=n(t);return r[i]||(r[i]=1,e.push(t)),e},e.remove=function(t){var i,a=n(t);return r[a]&&(r[a]=0,(i=e.indexOf(t))>=0&&e.splice(i,1)),e},e}async function Dt(t,n){try{await n(t)}catch(n){t.error(n)}}var Ct=Symbol("vega_id"),Ft=1;function St(t){return!(!t||!Bt(t))}function Bt(t){return t[Ct]}function Tt(t,n){return t[Ct]=n,t}function zt(t){var n=t===Object(t)?t:{data:t};return Bt(n)?n:Tt(n,Ft++)}function Nt(t){return Ot(t,zt({}))}function Ot(t,n){for(var e in t)n[e]=t[e];return n}function Rt(t,n){return Tt(n,Bt(t))}function qt(t,n){return t?n?(e,r)=>t(e,r)||Bt(n(e))-Bt(n(r)):(n,e)=>t(n,e)||Bt(n)-Bt(e):null}function Lt(t){return t&&t.constructor===Ut}function Ut(){var t=[],n=[],e=[],r=[],i=[],a=!1;return{constructor:Ut,insert:function(n){for(var e=V(n),r=0,i=e.length;r<i;++r)t.push(e[r]);return this},remove:function(t){for(var e=X(t)?r:n,i=V(t),a=0,u=i.length;a<u;++a)e.push(i[a]);return this},modify:function(t,n,r){var a={field:n,value:Z(r)};return X(t)?(a.filter=t,i.push(a)):(a.tuple=t,e.push(a)),this},encode:function(t,n){return X(t)?i.push({filter:t,field:n}):e.push({tuple:t,field:n}),this},reflow:function(){return a=!0,this},pulse:function(u,o){var s,l,c,f,h,d,p={},g={};for(s=0,l=o.length;s<l;++s)p[Bt(o[s])]=1;for(s=0,l=n.length;s<l;++s)p[Bt(h=n[s])]=-1;for(s=0,l=r.length;s<l;++s)f=r[s],o.forEach((function(t){f(t)&&(p[Bt(t)]=-1)}));for(s=0,l=t.length;s<l;++s)d=Bt(h=t[s]),p[d]?p[d]=1:u.add.push(zt(t[s]));for(s=0,l=o.length;s<l;++s)h=o[s],p[Bt(h)]<0&&u.rem.push(h);function m(t,n,e){e?t[n]=e(t):u.encode=n,a||(g[Bt(t)]=t)}for(s=0,l=e.length;s<l;++s)h=(c=e[s]).tuple,f=c.field,(d=p[Bt(h)])>0&&(m(h,f,c.value),u.modifies(f));for(s=0,l=i.length;s<l;++s)c=i[s],f=c.filter,o.forEach((function(t){f(t)&&p[Bt(t)]>0&&m(t,c.field,c.value)})),u.modifies(c.field);if(a)u.mod=n.length||r.length?o.filter((function(t){return p[Bt(t)]>0})):o.slice();else for(d in g)u.mod.push(g[d]);return u}}}var $t="_:mod:_";function Pt(){Object.defineProperty(this,$t,{writable:!0,value:{}})}var jt=Pt.prototype;jt.set=function(t,n,e,r){var i=this,a=i[t],o=i[$t];return null!=n&&n>=0?(a[n]!==e||r)&&(a[n]=e,o[n+":"+t]=-1,o[t]=-1):(a!==e||r)&&(i[t]=e,o[t]=u(e)?1+e.length:-1),i},jt.modified=function(t,n){var e,r=this[$t];if(!arguments.length){for(e in r)if(r[e])return!0;return!1}if(u(t)){for(e=0;e<t.length;++e)if(r[t[e]])return!0;return!1}return null!=n&&n>=0?n+1<r[t]||!!r[n+":"+t]:!!r[t]},jt.clear=function(){return this[$t]={},this};var It=0,Ht=new Pt;function Wt(t,n,e,r){this.id=++It,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,n&&(this._update=n),e&&this.parameters(e,r)}var Yt=Wt.prototype;function Vt(t){return function(n){var e=this.flags;return 0===arguments.length?!!(e&t):(this.flags=n?e|t:e&~t,this)}}Yt.targets=function(){return this._targets||(this._targets=Et(h))},Yt.set=function(t){return this.value!==t?(this.value=t,1):0},Yt.skip=Vt(1),Yt.modified=Vt(2),Yt.parameters=function(t,n,e){n=!1!==n;var r,a,o,s,l=this,c=l._argval=l._argval||new Pt,f=l._argops=l._argops||[],h=[];function d(t,e,r){r instanceof Wt?(r!==l&&(n&&r.targets().add(l),h.push(r)),f.push({op:r,name:t,index:e})):c.set(t,e,r)}for(r in t)if(a=t[r],"pulse"===r)V(a).forEach((function(t){t instanceof Wt?t!==l&&(t.targets().add(l),h.push(t)):i("Pulse parameters must be operator instances.")})),l.source=a;else if(u(a))for(c.set(r,-1,Array(o=a.length)),s=0;s<o;++s)d(r,s,a[s]);else d(r,-1,a);return this.marshall().clear(),e&&(f.initonly=!0),h},Yt.marshall=function(t){var n,e,r,i,a,u=this._argval||Ht,o=this._argops;if(o){for(e=0,r=o.length;e<r;++e)a=(i=(n=o[e]).op).modified()&&i.stamp===t,u.set(n.name,n.index,i.value,a);if(o.initonly){for(e=0;e<r;++e)(n=o[e]).op.targets().remove(this);this._argops=null,this._update=null}}return u},Yt.evaluate=function(t){var n=this._update;if(n){var e=this.marshall(t.stamp),r=n.call(this,e,t);if(e.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},Yt.run=function(t){return t.stamp<this.stamp?t.StopPropagation:(this.skip()?(this.skip(!1),n=0):n=this.evaluate(t),this.pulse=n||t);var n};var Gt=0;function Xt(t,n,e){this.id=++Gt,this.value=null,e&&(this.receive=e),t&&(this._filter=t),n&&(this._apply=n)}function Jt(t,n,e){return new Xt(t,n,e)}var Zt=Xt.prototype;Zt._filter=m,Zt._apply=d,Zt.targets=function(){return this._targets||(this._targets=Et(h))},Zt.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},Zt.receive=function(t){if(this._filter(t)){for(var n=this.value=this._apply(t),e=this._targets,r=e?e.length:0,i=0;i<r;++i)e[i].receive(n);this._consume&&(t.preventDefault(),t.stopPropagation())}},Zt.filter=function(t){var n=Jt(t);return this.targets().add(n),n},Zt.apply=function(t){var n=Jt(null,t);return this.targets().add(n),n},Zt.merge=function(){var t=Jt();this.targets().add(t);for(var n=0,e=arguments.length;n<e;++n)arguments[n].targets().add(t);return t},Zt.throttle=function(t){var n=-1;return this.filter((function(){var e=Date.now();return e-n>t?(n=e,1):0}))},Zt.debounce=function(t){var n=Jt();return this.targets().add(Jt(null,null,Q(t,(function(t){var e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},Zt.between=function(t,n){var e=!1;return t.targets().add(Jt(null,null,(function(){e=!0}))),n.targets().add(Jt(null,null,(function(){e=!1}))),this.filter((function(){return e}))};const Qt=/^([A-Za-z]+:)?\/\//,Kt=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,tn=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,nn="file://";async function en(t,n){const e=await this.sanitize(t,n),r=e.href;return e.localFile?this.file(r):this.http(r,n)}async function rn(t,n){n=K({},this.options,n);const e=this.fileAccess,r={href:null};let a,u,o;const s=Kt.test(t.replace(tn,""));null!=t&&"string"==typeof t&&s||i("Sanitize failure, invalid URI: "+l(t));const c=Qt.test(t);return(o=n.baseURL)&&!c&&(t.startsWith("/")||"/"===o[o.length-1]||(t="/"+t),t=o+t),u=(a=t.startsWith(nn))||"file"===n.mode||"http"!==n.mode&&!c&&e,a?t=t.slice(nn.length):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),u=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!u}),r.href=t,n.target&&(r.target=n.target+""),n.rel&&(r.rel=n.rel+""),r}function an(t){return t?function(n){return new Promise((function(e,r){t.readFile(n,(function(t,n){t?r(t):e(n)}))}))}:un}async function un(){i("No file system access.")}function on(t){return t?async function(n,e){const r=K({},this.options.http,e),a=e&&e.response,u=await t(n,r);return u.ok?X(u[a])?u[a]():u.text():i(u.status+""+u.statusText)}:sn}async function sn(){i("No HTTP fetch method available.")}var ln={boolean:_t,integer:F,number:F,date:bt,string:wt,unknown:d},cn=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return pn(t)&&Number.isInteger(+t)},pn,function(t){return!Number.isNaN(Date.parse(t))}],fn=["boolean","integer","number","date"];function hn(t,n){if(!t||!t.length)return"unknown";var e,r,i,a,u=0,o=t.length,s=cn.length,l=cn.map((function(t,n){return n+1}));for(r=0,o=t.length;r<o;++r)for(e=n?t[r][n]:t[r],i=0;i<s;++i)if(l[i]&&(null!=(a=e)&&a==a)&&!cn[i](e)&&(l[i]=0,++u===cn.length))return"string";return u=l.reduce((function(t,n){return 0===t?n:t}),0)-1,fn[u]}function dn(t,n){return n.reduce((function(n,e){return n[e]=hn(t,e),n}),{})}function pn(t){return!(Number.isNaN(+t)||t instanceof Date)}var gn={},mn={},vn=34,yn=10,_n=13;function xn(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function bn(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}function wn(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function An(t){var n=t.getUTCHours(),e=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+wn(-t,6):t>9999?"+"+wn(t,6):wn(t,4)}(t.getUTCFullYear())+"-"+wn(t.getUTCMonth()+1,2)+"-"+wn(t.getUTCDate(),2)+(i?"T"+wn(n,2)+":"+wn(e,2)+":"+wn(r,2)+"."+wn(i,3)+"Z":r?"T"+wn(n,2)+":"+wn(e,2)+":"+wn(r,2)+"Z":e||n?"T"+wn(n,2)+":"+wn(e,2)+"Z":"")}function kn(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],a=t.length,u=0,o=0,s=a<=0,l=!1;function c(){if(s)return mn;if(l)return l=!1,gn;var n,r,i=u;if(t.charCodeAt(i)===vn){for(;u++<a&&t.charCodeAt(u)!==vn||t.charCodeAt(++u)===vn;);return(n=u)>=a?s=!0:(r=t.charCodeAt(u++))===yn?l=!0:r===_n&&(l=!0,t.charCodeAt(u)===yn&&++u),t.slice(i+1,n-1).replace(/""/g,'"')}for(;u<a;){if((r=t.charCodeAt(n=u++))===yn)l=!0;else if(r===_n)l=!0,t.charCodeAt(u)===yn&&++u;else if(r!==e)continue;return t.slice(i,n)}return s=!0,t.slice(i,a)}for(t.charCodeAt(a-1)===yn&&--a,t.charCodeAt(a-1)===_n&&--a;(r=c())!==mn;){for(var f=[];r!==gn&&r!==mn;)f.push(r),r=c();n&&null==(f=n(f,o++))||i.push(f)}return i}function i(n,e){return n.map((function(n){return e.map((function(t){return u(n[t])})).join(t)}))}function a(n){return n.map(u).join(t)}function u(t){return null==t?"":t instanceof Date?An(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,a=r(t,(function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=xn(t);return function(r,i){return n(e(r),i,t)}}(t,n):xn(t)}));return a.columns=i||[],a},parseRows:r,format:function(n,e){return null==e&&(e=bn(n)),[e.map(u).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=bn(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(a).join("\n")},formatRow:a,formatValue:u}}function Mn(t){const n=function(n,e){const r={delimiter:t};return En(n,e?K(e,r):r)};return n.responseType="text",n}function En(t,n){return n.header&&(t=n.header.map(l).join(n.delimiter)+"\n"+t),kn(n.delimiter).parse(t+"")}function Dn(t,n){const e=n&&n.property?c(n.property):d;return!o(t)||(r=t,"function"==typeof Buffer&&X(Buffer.isBuffer)&&Buffer.isBuffer(r))?e(JSON.parse(t)):function(t,n){return n&&n.copy?JSON.parse(JSON.stringify(t)):t}(e(t));var r}function Cn(t){return t}function Fn(t,n){return"string"==typeof n&&(n=t.objects[n]),"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map((function(n){return Sn(t,n)}))}:Sn(t,n)}function Sn(t,n){var e=n.id,r=n.bbox,i=null==n.properties?{}:n.properties,a=Bn(t,n);return null==e&&null==r?{type:"Feature",properties:i,geometry:a}:null==r?{type:"Feature",id:e,properties:i,geometry:a}:{type:"Feature",id:e,bbox:r,properties:i,geometry:a}}function Bn(t,n){var e=function(t){if(null==t)return Cn;var n,e,r=t.scale[0],i=t.scale[1],a=t.translate[0],u=t.translate[1];return function(t,o){o||(n=e=0);var s=2,l=t.length,c=new Array(l);for(c[0]=(n+=t[0])*r+a,c[1]=(e+=t[1])*i+u;s<l;)c[s]=t[s],++s;return c}}(t.transform),r=t.arcs;function i(t,n){n.length&&n.pop();for(var i=r[t<0?~t:t],a=0,u=i.length;a<u;++a)n.push(e(i[a],a));t<0&&function(t,n){for(var e,r=t.length,i=r-n;i<--r;)e=t[i],t[i++]=t[r],t[r]=e}(n,u)}function a(t){return e(t)}function u(t){for(var n=[],e=0,r=t.length;e<r;++e)i(t[e],n);return n.length<2&&n.push(n[0]),n}function o(t){for(var n=u(t);n.length<4;)n.push(n[0]);return n}function s(t){return t.map(o)}return function t(n){var e,r=n.type;switch(r){case"GeometryCollection":return{type:r,geometries:n.geometries.map(t)};case"Point":e=a(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(a);break;case"LineString":e=u(n.arcs);break;case"MultiLineString":e=n.arcs.map(u);break;case"Polygon":e=s(n.arcs);break;case"MultiPolygon":e=n.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}(n)}function Tn(t,n){var e={},r={},i={},a=[],u=-1;function o(t,n){for(var r in t){var i=t[r];delete n[i.start],delete i.start,delete i.end,i.forEach((function(t){e[t<0?~t:t]=1})),a.push(i)}}return n.forEach((function(e,r){var i,a=t.arcs[e<0?~e:e];a.length<3&&!a[1][0]&&!a[1][1]&&(i=n[++u],n[u]=e,n[r]=i)})),n.forEach((function(n){var e,a,u=function(n){var e,r=t.arcs[n<0?~n:n],i=r[0];t.transform?(e=[0,0],r.forEach((function(t){e[0]+=t[0],e[1]+=t[1]}))):e=r[r.length-1];return n<0?[e,i]:[i,e]}(n),o=u[0],s=u[1];if(e=i[o])if(delete i[e.end],e.push(n),e.end=s,a=r[s]){delete r[a.start];var l=a===e?e:e.concat(a);r[l.start=e.start]=i[l.end=a.end]=l}else r[e.start]=i[e.end]=e;else if(e=r[s])if(delete r[e.start],e.unshift(n),e.start=o,a=i[o]){delete i[a.end];var c=a===e?e:a.concat(e);r[c.start=a.start]=i[c.end=e.end]=c}else r[e.start]=i[e.end]=e;else r[(e=[n]).start=o]=i[e.end=s]=e})),o(i,r),o(r,i),n.forEach((function(t){e[t<0?~t:t]||a.push([t])})),a}function zn(t){return Bn(t,Nn.apply(this,arguments))}function Nn(t,n,e){var r,i,a;if(arguments.length>1)r=function(t,n,e){var r,i=[],a=[];function u(t){var n=t<0?~t:t;(a[n]||(a[n]=[])).push({i:t,g:r})}function o(t){t.forEach(u)}function s(t){t.forEach(o)}return function t(n){switch(r=n,n.type){case"GeometryCollection":n.geometries.forEach(t);break;case"LineString":o(n.arcs);break;case"MultiLineString":case"Polygon":s(n.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(n.arcs)}}(n),a.forEach(null==e?function(t){i.push(t[0].i)}:function(t){e(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,n,e);else for(i=0,r=new Array(a=t.arcs.length);i<a;++i)r[i]=i;return{type:"MultiLineString",arcs:Tn(t,r)}}En.responseType="text",Dn.responseType="json";const On={interior:(t,n)=>t!==n,exterior:(t,n)=>t===n};function Rn(t,n){let e,r,a,u;return t=Dn(t,n),n&&n.feature?(e=Fn,a=n.feature):n&&n.mesh?(e=zn,a=n.mesh,u=On[n.filter]):i("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[a])?e(t,r,u):i("Invalid TopoJSON object: "+a),r&&r.features||[r]}Rn.responseType="json";const qn={dsv:En,csv:Mn(","),tsv:Mn("\t"),json:Dn,topojson:Rn};function Ln(t,n){return arguments.length>1?(qn[t]=n,this):rt(qn,t)?qn[t]:null}function Un(t){const n=Ln(t);return n&&n.responseType||"text"}var $n=new Date,Pn=new Date;function jn(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,a){var u,o=[];if(e=i.ceil(e),a=null==a?1:Math.floor(a),!(e<r&&a>0))return o;do{o.push(u=new Date(+e)),n(e,a),t(e)}while(u<e&&e<r);return o},i.filter=function(e){return jn((function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return $n.setTime(+n),Pn.setTime(+r),t($n),t(Pn),Math.floor(e($n,Pn))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var In=jn((function(){}),(function(t,n){t.setTime(+t+n)}),(function(t,n){return n-t}));In.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?jn((function(n){n.setTime(Math.floor(n/t)*t)}),(function(n,e){n.setTime(+n+e*t)}),(function(n,e){return(e-n)/t})):In:null};var Hn=6e4,Wn=6048e5,Yn=jn((function(t){t.setTime(t-t.getMilliseconds())}),(function(t,n){t.setTime(+t+1e3*n)}),(function(t,n){return(n-t)/1e3}),(function(t){return t.getUTCSeconds()})),Vn=jn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())}),(function(t,n){t.setTime(+t+n*Hn)}),(function(t,n){return(n-t)/Hn}),(function(t){return t.getMinutes()})),Gn=jn((function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*Hn)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getHours()})),Xn=jn((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Hn)/864e5}),(function(t){return t.getDate()-1}));function Jn(t){return jn((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Hn)/Wn}))}var Zn=Jn(0),Qn=Jn(1),Kn=(Jn(2),Jn(3),Jn(4)),te=(Jn(5),Jn(6),jn((function(t){t.setDate(1),t.setHours(0,0,0,0)}),(function(t,n){t.setMonth(t.getMonth()+n)}),(function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())}),(function(t){return t.getMonth()}))),ne=jn((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));ne.every=function(t){return isFinite(t=Math.floor(t))&&t>0?jn((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var ee=jn((function(t){t.setUTCSeconds(0,0)}),(function(t,n){t.setTime(+t+n*Hn)}),(function(t,n){return(n-t)/Hn}),(function(t){return t.getUTCMinutes()})),re=jn((function(t){t.setUTCMinutes(0,0,0)}),(function(t,n){t.setTime(+t+36e5*n)}),(function(t,n){return(n-t)/36e5}),(function(t){return t.getUTCHours()})),ie=jn((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/864e5}),(function(t){return t.getUTCDate()-1}));function ae(t){return jn((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/Wn}))}var ue=ae(0),oe=ae(1),se=(ae(2),ae(3),ae(4)),le=(ae(5),ae(6),jn((function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCMonth(t.getUTCMonth()+n)}),(function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())}),(function(t){return t.getUTCMonth()}))),ce=jn((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function fe(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function he(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function de(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}ce.every=function(t){return isFinite(t=Math.floor(t))&&t>0?jn((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var pe,ge,me,ve,ye,_e={"-":"",_:" ",0:"0"},xe=/^\s*\d+/,be=/^%/,we=/[\\^$*+?|[\]().{}]/g;function Ae(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<e?new Array(e-a+1).join(n)+i:i)}function ke(t){return t.replace(we,"\\$&")}function Me(t){return new RegExp("^(?:"+t.map(ke).join("|")+")","i")}function Ee(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function De(t,n,e){var r=xe.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Ce(t,n,e){var r=xe.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Fe(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Se(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function Be(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function Te(t,n,e){var r=xe.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function ze(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Ne(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Oe(t,n,e){var r=xe.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function Re(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function qe(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Le(t,n,e){var r=xe.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Ue(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function $e(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Pe(t,n,e){var r=xe.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function je(t,n,e){var r=xe.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Ie(t,n,e){var r=xe.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function He(t,n,e){var r=be.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function We(t,n,e){var r=xe.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function Ye(t,n,e){var r=xe.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function Ve(t,n){return Ae(t.getDate(),n,2)}function Ge(t,n){return Ae(t.getHours(),n,2)}function Xe(t,n){return Ae(t.getHours()%12||12,n,2)}function Je(t,n){return Ae(1+Xn.count(ne(t),t),n,3)}function Ze(t,n){return Ae(t.getMilliseconds(),n,3)}function Qe(t,n){return Ze(t,n)+"000"}function Ke(t,n){return Ae(t.getMonth()+1,n,2)}function tr(t,n){return Ae(t.getMinutes(),n,2)}function nr(t,n){return Ae(t.getSeconds(),n,2)}function er(t){var n=t.getDay();return 0===n?7:n}function rr(t,n){return Ae(Zn.count(ne(t)-1,t),n,2)}function ir(t,n){var e=t.getDay();return t=e>=4||0===e?Kn(t):Kn.ceil(t),Ae(Kn.count(ne(t),t)+(4===ne(t).getDay()),n,2)}function ar(t){return t.getDay()}function ur(t,n){return Ae(Qn.count(ne(t)-1,t),n,2)}function or(t,n){return Ae(t.getFullYear()%100,n,2)}function sr(t,n){return Ae(t.getFullYear()%1e4,n,4)}function lr(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Ae(n/60|0,"0",2)+Ae(n%60,"0",2)}function cr(t,n){return Ae(t.getUTCDate(),n,2)}function fr(t,n){return Ae(t.getUTCHours(),n,2)}function hr(t,n){return Ae(t.getUTCHours()%12||12,n,2)}function dr(t,n){return Ae(1+ie.count(ce(t),t),n,3)}function pr(t,n){return Ae(t.getUTCMilliseconds(),n,3)}function gr(t,n){return pr(t,n)+"000"}function mr(t,n){return Ae(t.getUTCMonth()+1,n,2)}function vr(t,n){return Ae(t.getUTCMinutes(),n,2)}function yr(t,n){return Ae(t.getUTCSeconds(),n,2)}function _r(t){var n=t.getUTCDay();return 0===n?7:n}function xr(t,n){return Ae(ue.count(ce(t)-1,t),n,2)}function br(t,n){var e=t.getUTCDay();return t=e>=4||0===e?se(t):se.ceil(t),Ae(se.count(ce(t),t)+(4===ce(t).getUTCDay()),n,2)}function wr(t){return t.getUTCDay()}function Ar(t,n){return Ae(oe.count(ce(t)-1,t),n,2)}function kr(t,n){return Ae(t.getUTCFullYear()%100,n,2)}function Mr(t,n){return Ae(t.getUTCFullYear()%1e4,n,4)}function Er(){return"+0000"}function Dr(){return"%"}function Cr(t){return+t}function Fr(t){return Math.floor(+t/1e3)}function Sr(t){return pe=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,a=t.days,u=t.shortDays,o=t.months,s=t.shortMonths,l=Me(i),c=Ee(i),f=Me(a),h=Ee(a),d=Me(u),p=Ee(u),g=Me(o),m=Ee(o),v=Me(s),y=Ee(s),_={a:function(t){return u[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Ve,e:Ve,f:Qe,H:Ge,I:Xe,j:Je,L:Ze,m:Ke,M:tr,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:Cr,s:Fr,S:nr,u:er,U:rr,V:ir,w:ar,W:ur,x:null,X:null,y:or,Y:sr,Z:lr,"%":Dr},x={a:function(t){return u[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:cr,e:cr,f:gr,H:fr,I:hr,j:dr,L:pr,m:mr,M:vr,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:Cr,s:Fr,S:yr,u:_r,U:xr,V:br,w:wr,W:Ar,x:null,X:null,y:kr,Y:Mr,Z:Er,"%":Dr},b={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=g.exec(n.slice(e));return r?(t.m=m[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return k(t,n,e,r)},d:qe,e:qe,f:Ie,H:Ue,I:Ue,j:Le,L:je,m:Re,M:$e,p:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.p=c[r[0].toLowerCase()],e+r[0].length):-1},q:Oe,Q:We,s:Ye,S:Pe,u:Ce,U:Fe,V:Se,w:De,W:Be,x:function(t,n,r){return k(t,e,n,r)},X:function(t,n,e){return k(t,r,n,e)},y:ze,Y:Te,Z:Ne,"%":He};function w(t,n){return function(e){var r,i,a,u=[],o=-1,s=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++o<l;)37===t.charCodeAt(o)&&(u.push(t.slice(s,o)),null!=(i=_e[r=t.charAt(++o)])?r=t.charAt(++o):i="e"===r?" ":"0",(a=n[r])&&(r=a(e,i)),u.push(r),s=o+1);return u.push(t.slice(s,o)),u.join("")}}function A(t,n){return function(e){var r,i,a=de(1900,void 0,1);if(k(a,t,e+="",0)!=e.length)return null;if("Q"in a)return new Date(a.Q);if("s"in a)return new Date(1e3*a.s+("L"in a?a.L:0));if(!n||"Z"in a||(a.Z=0),"p"in a&&(a.H=a.H%12+12*a.p),void 0===a.m&&(a.m="q"in a?a.q:0),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=he(de(a.y,0,1))).getUTCDay(),r=i>4||0===i?oe.ceil(r):oe(r),r=ie.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=fe(de(a.y,0,1))).getDay(),r=i>4||0===i?Qn.ceil(r):Qn(r),r=Xn.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?he(de(a.y,0,1)).getUTCDay():fe(de(a.y,0,1)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,he(a)):fe(a)}}function k(t,n,e,r){for(var i,a,u=0,o=n.length,s=e.length;u<o;){if(r>=s)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=b[i in _e?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return(_.x=w(e,_),_.X=w(r,_),_.c=w(n,_),x.x=w(e,x),x.X=w(r,x),x.c=w(n,x),{format:function(t){var n=w(t+="",_);return n.toString=function(){return t},n},parse:function(t){var n=A(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=A(t+="",!0);return n.toString=function(){return t},n}})}(t),ge=pe.format,me=pe.parse,ve=pe.utcFormat,ye=pe.utcParse,pe}function Br(t,n,e){const r=Ln((n=n||{}).type||"json");return r||i("Unknown data format type: "+n.type),t=r(t,n),n.parse&&function(t,n,e){if(!t.length)return;e=e||me;var r,i,a,u,o,s,l,c=t.columns||Object.keys(t[0]);"auto"===n&&(n=dn(t,c));for(c=Object.keys(n),r=c.map((function(t){var r,i,a=n[t];if(a&&(0===a.indexOf("date:")||0===a.indexOf("utc:")))return("'"===(i=(r=a.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?ye(i):e(i);if(!ln[a])throw Error("Illegal format pattern: "+t+":"+a);return ln[a]})),u=0,s=t.length,l=c.length;u<s;++u)for(i=t[u],o=0;o<l;++o)a=c[o],i[a]=r[o](i[a])}(t,n.parse,e),rt(t,"columns")&&delete t.columns,t}Sr({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"]});var Tr=function(t,n){return function(e){return{options:e||{},sanitize:rn,load:en,fileAccess:!!n,file:an(n),http:on(t)}}}("undefined"!=typeof fetch&&fetch,null);const zr=Br;var Nr={skip:!0};function Or(t,n,e,r,i,a){var u,o,s=K({},a,Nr);X(e)||(e=Z(e)),void 0===r?u=n=>t.touch(e(n)):X(r)?(o=new Wt(null,r,i,!1),u=n=>{o.evaluate(n);const r=e(n),i=o.value;Lt(i)?t.pulse(r,i,a):t.update(r,i,s)}):u=n=>t.update(e(n),r,s),n.apply(u)}function Rr(t,n,e,r,i,a){if(void 0===r)n.targets().add(e);else{const u=a||{},o=new Wt(null,function(t,n){return n=X(n)?n:Z(n),t?function(e,r){const i=n(e,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:n}(e,r),i,!1);o.modified(u.force),o.rank=n.rank,n.targets().add(o),e&&(o.skip(!0),o.value=e.value,o.targets().add(e),t.connect(e,[o]))}}var qr={};function Lr(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}var Ur=Lr.prototype;function $r(t,n){return t?function(e,r){return t(e,r)&&n(e,r)}:n}function Pr(t,n){var e=[];return Mt(t,n,(function(t){e.push(t)})),e}function jr(t,n){var e={};return t.visit(n,(function(t){e[Bt(t)]=1})),function(t){return e[Bt(t)]?null:t}}function Ir(t,n,e,r){var i,a,u,o,s,l=this,c=0;for(this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e,u=0,o=e.length;u<o;++u)if((i=e[u]).stamp===n){if(i.fields)for(s in a=l.fields||(l.fields={}),i.fields)a[s]=1;i.changed(l.ADD)&&(c|=l.ADD),i.changed(l.REM)&&(c|=l.REM),i.changed(l.MOD)&&(c|=l.MOD)}this.changes=c}Ur.StopPropagation=qr,Ur.ADD=1,Ur.REM=2,Ur.MOD=4,Ur.ADD_REM=3,Ur.ADD_MOD=5,Ur.ALL=7,Ur.REFLOW=8,Ur.SOURCE=16,Ur.NO_SOURCE=32,Ur.NO_FIELDS=64,Ur.fork=function(t){return new Lr(this.dataflow).init(this,t)},Ur.clone=function(){var t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},Ur.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length?((t=new Lr(this.dataflow).init(this)).add=t.source,t):t},Ur.init=function(t,n){var e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source),e},Ur.runAfter=function(t){this.dataflow.runAfter(t)},Ur.changed=function(t){var n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},Ur.reflow=function(t){if(t)return this.fork(7).reflow();var n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,jr(this,1))),this},Ur.modifies=function(t){var n=this.fields||(this.fields={});return u(t)?t.forEach(t=>n[t]=!0):n[t]=!0,this},Ur.modified=function(t,n){var e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?u(t)?t.some((function(t){return e[t]})):e[t]:!!e)},Ur.filter=function(t,n){var e=this;return 1&t&&(e.addF=$r(e.addF,n)),2&t&&(e.remF=$r(e.remF,n)),4&t&&(e.modF=$r(e.modF,n)),16&t&&(e.srcF=$r(e.srcF,n)),e},Ur.materialize=function(t){var n=this;return 1&(t=t||7)&&n.addF&&(n.add=Pr(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=Pr(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=Pr(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},Ur.visit=function(t,n){var e,r,i=this,a=n;return 16&t?(Mt(i.source,i.srcF,a),i):(1&t&&Mt(i.add,i.addF,a),2&t&&Mt(i.rem,i.remF,a),4&t&&Mt(i.mod,i.modF,a),8&t&&(e=i.source)&&((r=i.add.length+i.mod.length)===e.length||Mt(e,r?jr(i,5):i.srcF,a)),i)};var Hr=ot(Ir,Lr);function Wr(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Hr.fork=function(t){var n=new Lr(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,(function(t){return n.add.push(t)})),t&n.REM&&this.visit(n.REM,(function(t){return n.rem.push(t)})),t&n.MOD&&this.visit(n.MOD,(function(t){return n.mod.push(t)}))),n},Hr.changed=function(t){return this.changes&t},Hr.modified=function(t){var n=this,e=n.fields;return e&&n.changes&n.MOD?u(t)?t.some((function(t){return e[t]})):e[t]:0},Hr.filter=function(){i("MultiPulse does not support filtering.")},Hr.materialize=function(){i("MultiPulse does not support materialization.")},Hr.visit=function(t,n){var e=this,r=e.pulses,i=r.length,a=0;if(t&e.SOURCE)for(;a<i;++a)r[a].visit(t,n);else for(;a<i;++a)r[a].stamp===e.stamp&&r[a].visit(t,n);return e};var Yr={skip:!1,force:!1};function Vr(t){var n=[];return{clear:()=>n=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),Gr(n,0,n.length-1,t)),pop:()=>{var e,r=n.pop();return n.length?(e=n[0],n[0]=r,function(t,n,e){var r,i=n,a=t.length,u=t[n],o=1+(n<<1);for(;o<a;)(r=o+1)<a&&e(t[o],t[r])>=0&&(o=r),t[n]=t[o],o=1+((n=o)<<1);t[n]=u,Gr(t,i,n,e)}(n,0,t)):e=r,e}}}function Gr(t,n,e,r){var i,a,u;for(i=t[e];e>n&&r(i,a=t[u=e-1>>1])<0;)t[e]=a,e=u;return t[e]=i}function Xr(){this.logger(k()),this.logLevel(x),this._clock=0,this._rank=0;try{this._loader=Tr()}catch(t){}this._touched=Et(h),this._input={},this._pulse=null,this._heap=Vr((t,n)=>t.qrank-n.qrank),this._postrun=[]}var Jr=Xr.prototype;function Zr(t){return function(){return this._log[t].apply(this,arguments)}}function Qr(t,n){Wt.call(this,t,null,n)}Jr.stamp=function(){return this._clock},Jr.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},Jr.cleanThreshold=1e4,Jr.add=function(t,n,e,r){var i,a=1;return t instanceof Wt?i=t:t&&t.prototype instanceof Wt?i=new t:X(t)?i=new Wt(null,t):(a=0,i=new Wt(t,n)),this.rank(i),a&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},Jr.connect=function(t,n){var e,r,i=t.rank;for(e=0,r=n.length;e<r;++e)if(i<n[e].rank)return void this.rerank(t)},Jr.rank=function(t){t.rank=++this._rank},Jr.rerank=function(t){for(var n,e,r,a=[t];a.length;)if(this.rank(n=a.pop()),e=n._targets)for(r=e.length;--r>=0;)a.push(n=e[r]),n===t&&i("Cycle detected in dataflow graph.")},Jr.pulse=function(t,n,e){this.touch(t,e||Yr);var r=new Lr(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},Jr.touch=function(t,n){var e=n||Yr;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},Jr.update=function(t,n,e){var r=e||Yr;return(t.set(n)||r.force)&&this.touch(t,r),this},Jr.changeset=Ut,Jr.ingest=function(t,n,e){return this.pulse(t,this.changeset().insert(zr(n,e)))},Jr.parse=zr,Jr.preload=async function(t,n,e){const r=this,i=r._pending||function(t){var n,e=new Promise((function(t){n=t}));return e.requests=0,e.done=function(){0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(r);i.requests+=1;const a=await r.request(n,e);return r.pulse(t,r.changeset().remove(m).insert(a.data||[])),i.done(),a},Jr.request=async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Un(n&&n.type)});try{r=zr(r,n)}catch(n){i=-2,e.warn("Data ingestion failed",t,n)}}catch(n){i=-1,e.warn("Loading failed",t,n)}return{data:r,status:i}},Jr.events=function(t,n,e,r){for(var i,a=this,u=Jt(e,r),o=function(t){t.dataflow=a;try{u.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):V(t)).length;s<l;++s)i[s].addEventListener(n,o);return u},Jr.on=function(t,n,e,r,i){return(t instanceof Wt?Rr:Or)(this,t,n,e,r,i),this},Jr.evaluate=async function(t,n,e){const r=this,i=r.logLevel(),a=[];if(r._pulse)return Wr(r);if(r._pending&&await r._pending,n&&await Dt(r,n),!r._touched.length)return r.info("Dataflow invoked, but nothing to do."),r;let u,o,s,l,c=++r._clock,f=0;r._pulse=new Lr(r,c,t),i>=w&&(s=Date.now(),r.debug("-- START PROPAGATION ("+c+") -----")),r._touched.forEach(t=>r._enqueue(t,!0)),r._touched=Et(h);try{for(;r._heap.size()>0;)u=r._heap.pop(),u.rank===u.qrank?(o=u.run(r._getPulse(u,t)),o.then?o=await o:o.async&&(a.push(o.async),o=qr),i>=A&&r.debug(u.id,o===qr?"STOP":o,u),o!==qr&&u._targets&&u._targets.forEach(t=>r._enqueue(t)),++f):r._enqueue(u,!0)}catch(t){r._heap.clear(),l=t}if(r._input={},r._pulse=null,i>=w&&(s=Date.now()-s,r.info("> Pulse "+c+": "+f+" operators; "+s+"ms")),l&&(r._postrun=[],r.error(l)),r._postrun.length){const t=r._postrun.sort((t,n)=>n.priority-t.priority);r._postrun=[];for(let n=0;n<t.length;++n)await Dt(r,t[n].callback)}return e&&await Dt(r,e),a.length&&Promise.all(a).then(t=>r.runAsync(null,()=>{t.forEach(t=>{try{t(r)}catch(t){r.error(t)}})})),r},Jr.run=function(t,n,e){return this._pulse?Wr(this):(this.evaluate(t,n,e),this)},Jr.runAsync=async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},Jr.runAfter=function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},Jr._enqueue=function(t,n){var e=t.stamp<this._clock;e&&(t.stamp=this._clock),(e||n)&&(t.qrank=t.rank,this._heap.push(t))},Jr._getPulse=function(t,n){var e=t.source,r=this._clock;return e&&u(e)?new Ir(this,r,e.map(t=>t.pulse),n):this._input[t.id]||function(t,n){if(n&&n.stamp===t.stamp)return n;t=t.fork(),n&&n!==qr&&(t.source=n.source);return t}(this._pulse,e&&e.pulse)},Jr.logger=function(t){return arguments.length?(this._log=t,this):this._log},Jr.error=Zr("error"),Jr.warn=Zr("warn"),Jr.info=Zr("info"),Jr.debug=Zr("debug"),Jr.logLevel=Zr("level");var Kr=ot(Qr,Wt);Kr.run=function(t){return t.stamp<this.stamp?t.StopPropagation:(this.skip()?this.skip(!1):n=this.evaluate(t),(n=n||t).then?n=n.then(t=>this.pulse=t):n!==t.StopPropagation&&(this.pulse=n),n);var n},Kr.evaluate=function(t){var n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},Kr.transform=function(){};var ti={};function ni(t){var n=ei(t);return n&&n.Definition||null}function ei(t){return t=t&&t.toLowerCase(),rt(ti,t)?ti[t]:null}function ri(t){return t&&t.length?1===t.length?t[0]:(n=t,function(t){for(var e=n.length,r=1,i=String(n[0](t));r<e;++r)i+="|"+n[r](t);return i}):function(){return""};var n}function ii(t,n,e){return e||t+(n?"_"+n:"")}var ai={values:si({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:si({name:"count",set:"cell.num"}),__count__:si({name:"count",set:"this.missing + this.valid"}),missing:si({name:"missing",set:"this.missing"}),valid:si({name:"valid",set:"this.valid"}),sum:si({name:"sum",init:"this.sum = 0;",add:"this.sum += +v;",rem:"this.sum -= v;",set:"this.sum"}),mean:si({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.valid ? this.mean : undefined"}),average:si({name:"average",set:"this.valid ? this.mean : undefined",req:["mean"],idx:1}),variance:si({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:si({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:si({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:si({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:si({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:si({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:si({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:si({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:si({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:si({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:si({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:si({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:si({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:si({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (Number.isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:si({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (Number.isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},ui=Object.keys(ai);function oi(t,n){return ai[t](n)}function si(t){return function(n){var e=K({init:"",add:"",rem:"",idx:0},t);return e.out=n||t.name,e}}function li(t,n){return t.idx-n.idx}function ci(t,n){var e=n||d,r=function(t,n){var e,r=t.reduce((function t(e,r){function i(n){e[n]||t(e,e[n]=ai[n]())}return r.req&&r.req.forEach(i),n&&r.str&&r.str.forEach(i),e}),t.reduce((function(t,n){return t[n.name]=n,t}),{})),i=[];for(e in r)i.push(r[e]);return i.sort(li)}(t,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",a="this.cell = cell; this.init();",u="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",o="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach((function(t){i+=t.init,u+=t.add,o+=t.rem})),t.slice().sort(li).forEach((function(t){s+="t["+l(t.out)+"]="+t.set+";"})),s+="return t;",(a=Function("cell",a)).prototype.init=Function(i),a.prototype.add=Function("v","t",u),a.prototype.rem=Function("v","t",o),a.prototype.set=Function("t",s),a.prototype.get=e,a.fields=t.map((function(t){return t.out})),a}function*fi(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}function hi(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function di(t){var n;return 1===t.length&&(n=t,t=function(t,e){return hi(n(t),e)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var a=r+i>>>1;t(n[a],e)<0?r=a+1:i=a}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var a=r+i>>>1;t(n[a],e)>0?i=a:r=a+1}return r}}}var pi=di(hi),gi=pi.right,mi=pi.left;function vi(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r<i;)a[r]=t+r*e;return a}var yi=Math.sqrt(50),_i=Math.sqrt(10),xi=Math.sqrt(2);function bi(t,n,e){var r,i,a,u,o=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(u=wi(t,n,e))||!isFinite(u))return[];if(u>0)for(t=Math.ceil(t/u),n=Math.floor(n/u),a=new Array(i=Math.ceil(n-t+1));++o<i;)a[o]=(t+o)*u;else for(t=Math.floor(t*u),n=Math.ceil(n*u),a=new Array(i=Math.ceil(t-n+1));++o<i;)a[o]=(t-o)/u;return r&&a.reverse(),a}function wi(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=yi?10:a>=_i?5:a>=xi?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=yi?10:a>=_i?5:a>=xi?2:1)}function Ai(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=yi?i*=10:a>=_i?i*=5:a>=xi&&(i*=2),n<t?-i:i}function ki(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function Mi(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function Ei(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function Di(t){return null===t?NaN:+t}function Ci(t,n,e){if(r=(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e))).length){if((n=+n)<=0||r<2)return Mi(t);if(n>=1)return ki(t);var r,i=(r-1)*n,a=Math.floor(i),u=ki(function t(n,e,r=0,i=n.length-1,a=hi){for(;i>r;){if(i-r>600){const u=i-r+1,o=e-r+1,s=Math.log(u),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(u-l)/u)*(o-u/2<0?-1:1);t(n,e,Math.max(r,Math.floor(e-o*l/u+c)),Math.min(i,Math.floor(e+(u-o)*l/u+c)),a)}const u=n[e];let o=r,s=i;for(Ei(n,r,e),a(n[i],u)>0&&Ei(n,r,i);o<s;){for(Ei(n,o,s),++o,--s;a(n[o],u)<0;)++o;for(;a(n[s],u)>0;)--s}0===a(n[r],u)?Ei(n,r,s):(++s,Ei(n,s,i)),s<=e&&(r=s+1),e<=s&&(i=s-1)}return n}(t,a).subarray(0,a+1));return u+(Mi(t.subarray(a+1))-u)*(i-a)}}function Fi(t,n){return Ci(t,.5,n)}function Si(t,n){let e=0;if(void 0===n)for(let n of t)(n=+n)&&(e+=n);else{let r=-1;for(let i of t)(i=+n(i,++r,t))&&(e+=i)}return e}function Bi(t,n,e){var r=Float64Array.from(fi(t,e));return r.sort(hi),n.map(t=>(function(t,n,e=Di){if(r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}})(r,t))}function Ti(t,n){return Bi(t,[.25,.5,.75],n)}function zi(t,n){var e=t.length,r=function(t,n){const e=function(t,n){let e,r=0,i=0,a=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,a+=e*(n-i));else{let u=-1;for(let o of t)null!=(o=n(o,++u,t))&&(o=+o)>=o&&(e=o-i,i+=e/++r,a+=e*(o-i))}if(r>1)return a/(r-1)}(t,n);return e?Math.sqrt(e):e}(t,n),i=Ti(t,n),a=(i[2]-i[0])/1.34;return 1.06*(r=Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function Ni(t){var n,e,r,i,a,u,o,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],g=t.span||p-d||Math.abs(d)||1;if(t.step)n=t.step;else if(t.steps){for(a=g/l,u=0,o=t.steps.length;u<o&&t.steps[u]<a;++u);n=t.steps[Math.max(0,u-1)]}else{for(e=Math.ceil(Math.log(l)/f),r=t.minstep||0,n=Math.max(r,Math.pow(c,Math.round(Math.log(g)/f)-e));Math.ceil(g/n)>l;)n*=c;for(u=0,o=h.length;u<o;++u)(a=n/h[u])>=r&&g/a<=l&&(n=a)}return i=(a=Math.log(n))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/n+s)*n)?a-n:a,p=Math.ceil(p/n)*n),{start:d,stop:p===d?d+n:p,step:n}}function Oi(n,e,r,i){if(!n.length)return[void 0,void 0];var a,u,o,s,l=Float64Array.from(fi(n,i)),c=l.length,f=e;for(o=0,s=Array(f);o<f;++o){for(a=0,u=0;u<c;++u)a+=l[~~(t.random()*c)];s[o]=a/c}return s.sort(hi),[Ci(s,r/2),Ci(s,1-r/2)]}function Ri(t,n,e,r){r=r||(t=>t);let i,a=0,u=1,o=t.length,s=new Float64Array(o),l=r(t[0]),c=l,f=l+n;for(;u<o;++u){if(i=r(t[u]),i>=f){for(c=(l+c)/2;a<u;++a)s[a]=c;f=i+n,l=i}c=i}for(c=(l+c)/2;a<u;++a)s[a]=c;return e?function(t,n){let e,r,i=t.length,a=0,u=1;for(;t[a]===t[u];)++u;for(;u<i;){for(e=u+1;t[u]===t[e];)++e;if(t[u]-t[u-1]<n){for(r=u+(a+e-u-u>>1);r<u;)t[r++]=t[u];for(;r>u;)t[r--]=t[a]}a=u,u=e}return t}(s,n+n/4):s}t.random=Math.random;const qi=Math.sqrt(2*Math.PI),Li=Math.SQRT2;let Ui=NaN;function $i(n,e){n=n||0,e=null==e?1:e;let r,i,a=0,u=0;if(Ui==Ui)a=Ui,Ui=NaN;else{do{a=2*t.random()-1,u=2*t.random()-1,r=a*a+u*u}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),a*=i,Ui=u*i}return n+a*e}function Pi(t,n,e){const r=(t-(n||0))/(e=null==e?1:e);return Math.exp(-.5*r*r)/(e*qi)}function ji(t,n,e){let r,i=(t-(n=n||0))/(e=null==e?1:e),a=Math.abs(i);if(a>37)r=0;else{let t,n=Math.exp(-a*a/2);a<7.07106781186547?(t=.0352624965998911*a+.700383064443688,t=t*a+6.37396220353165,t=t*a+33.912866078383,t=t*a+112.079291497871,t=t*a+221.213596169931,t=t*a+220.206867912376,r=n*t,t=.0883883476483184*a+1.75566716318264,t=t*a+16.064177579207,t=t*a+86.7807322029461,t=t*a+296.564248779674,t=t*a+637.333633378831,t=t*a+793.826512519948,t=t*a+440.413735824752,r/=t):(t=a+.65,t=a+4/t,t=a+3/t,t=a+2/t,t=a+1/t,r=n/t/2.506628274631)}return i>0?1-r:r}function Ii(t,n,e){return t<0||t>1?NaN:(n||0)+(null==e?1:e)*Li*function(t){let n,e=-Math.log((1-t)*(1+t));e<6.25?(e-=3.125,n=-364441206401782e-35,n=n*e-16850591381820166e-35,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=n*e-1333171662854621e-31,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=n*e-4054566272975207e-29,n=n*e-8151934197605472e-29,n=26335093153082323e-28+n*e,n=n*e-12975133253453532e-27,n=n*e-5415412054294628e-26,n=1.0512122733215323e-9+n*e,n=n*e-4.112633980346984e-9,n=n*e-2.9070369957882005e-8,n=4.2347877827932404e-7+n*e,n=n*e-13654692000834679e-22,n=n*e-13882523362786469e-21,n=.00018673420803405714+n*e,n=n*e-.000740702534166267,n=n*e-.006033670871430149,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*e,n=n*e-2.7517406297064545e-7,n=1.8239629214389228e-8+n*e,n=15027403968909828e-22+n*e,n=n*e-4013867526981546e-21,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=n*e-47318229009055734e-21,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=n*e-.0003550375203628475,n=.0009532893797373805+n*e,n=n*e-.0016882755560235047,n=.002491442096107851+n*e,n=n*e-.003751208507569241,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=n*e-2.555641816996525e-10,n=1.5076572693500548e-9+n*e,n=n*e-3.789465440126737e-9,n=7.61570120807834e-9+n*e,n=n*e-1.496002662714924e-8,n=2.914795345090108e-8+n*e,n=n*e-6.771199775845234e-8,n=2.2900482228026655e-7+n*e,n=n*e-9.9298272942317e-7,n=4526062597223154e-21+n*e,n=n*e-1968177810553167e-20,n=7599527703001776e-20+n*e,n=n*e-.00021503011930044477,n=n*e-.00013871931833623122,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0;return n*t}(2*t-1)}function Hi(t,n){var e,r,i={mean:function(t){return arguments.length?(e=t||0,i):e},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>$i(e,r),pdf:t=>Pi(t,e,r),cdf:t=>ji(t,e,r),icdf:t=>Ii(t,e,r)};return i.mean(t).stdev(n)}function Wi(n,e){var r=Hi(),i={},a=0;return i.data=function(t){return arguments.length?(n=t,a=t?t.length:0,i.bandwidth(e)):n},i.bandwidth=function(t){return arguments.length?(!(e=t)&&n&&(e=zi(n)),i):e},i.sample=function(){return n[~~(t.random()*a)]+e*r.sample()},i.pdf=function(t){for(var i=0,u=0;u<a;++u)i+=r.pdf((t-n[u])/e);return i/e/a},i.cdf=function(t){for(var i=0,u=0;u<a;++u)i+=r.cdf((t-n[u])/e);return i/a},i.icdf=function(){throw Error("KDE icdf not supported.")},i.data(n)}function Yi(t,n){return t=t||0,n=null==n?1:n,Math.exp(t+$i()*n)}function Vi(t,n,e){if(t<=0)return 0;n=n||0,e=null==e?1:e;const r=(Math.log(t)-n)/e;return Math.exp(-.5*r*r)/(e*qi*t)}function Gi(t,n,e){return ji(Math.log(t),n,e)}function Xi(t,n,e){return Math.exp(Ii(t,n,e))}function Ji(t,n){var e,r,i={mean:function(t){return arguments.length?(e=t||0,i):e},stdev:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Yi(e,r),pdf:t=>Vi(t,e,r),cdf:t=>Gi(t,e,r),icdf:t=>Xi(t,e,r)};return i.mean(t).stdev(n)}function Zi(n,e){var r,i={},a=0;function u(t){var n,e=[],r=0;for(n=0;n<a;++n)r+=e[n]=null==t[n]?1:+t[n];for(n=0;n<a;++n)e[n]/=r;return e}return i.weights=function(t){return arguments.length?(r=u(e=t||[]),i):e},i.distributions=function(t){return arguments.length?(t?(a=t.length,n=t):(a=0,n=[]),i.weights(e)):n},i.sample=function(){for(var e=t.random(),i=n[a-1],u=r[0],o=0;o<a-1;u+=r[++o])if(e<u){i=n[o];break}return i.sample()},i.pdf=function(t){for(var e=0,i=0;i<a;++i)e+=r[i]*n[i].pdf(t);return e},i.cdf=function(t){for(var e=0,i=0;i<a;++i)e+=r[i]*n[i].cdf(t);return e},i.icdf=function(){throw Error("Mixture icdf not supported.")},i.distributions(n).weights(e)}function Qi(n,e){return null==e&&(e=null==n?1:n,n=0),n+(e-n)*t.random()}function Ki(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=n&&t<=e?1/(e-n):0}function ta(t,n,e){return null==e&&(e=null==n?1:n,n=0),t<n?0:t>e?1:(t-n)/(e-n)}function na(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function ea(t,n){var e,r,i={min:function(t){return arguments.length?(e=t||0,i):e},max:function(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Qi(e,r),pdf:t=>Ki(t,e,r),cdf:t=>ta(t,e,r),icdf:t=>na(t,e,r)};return null==n&&(n=null==t?1:t,t=0),i.min(t).max(n)}function ra(t,n,e,r){const i=r-t*t,a=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-a*t,a]}function ia(t,n,e,r){t=t.filter(t=>{let r=n(t),i=e(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i}),r&&t.sort((t,e)=>n(t)-n(e));const i=t.length,a=new Float64Array(i),u=new Float64Array(i);let o,s,l,c=0,f=0,h=0;for(l of t)a[c]=o=+n(l),u[c]=s=+e(l),++c,f+=(o-f)/c,h+=(s-h)/c;for(c=0;c<i;++c)a[c]-=f,u[c]-=h;return[a,u,f,h]}function aa(t,n,e,r){let i,a,u=-1;for(let o of t)i=n(o),a=e(o),null!=i&&(i=+i)>=i&&null!=a&&(a=+a)>=a&&r(i,a,++u)}function ua(t,n,e,r,i){let a=0,u=0;return aa(t,n,e,(t,n)=>{const e=n-i(t),o=n-r;a+=e*e,u+=o*o}),1-a/u}function oa(t,n,e){let r=0,i=0,a=0,u=0,o=0;aa(t,n,e,(t,n)=>{++o,r+=(t-r)/o,i+=(n-i)/o,a+=(t*n-a)/o,u+=(t*t-u)/o});const s=ra(r,i,a,u),l=t=>s[0]+s[1]*t;return{coef:s,predict:l,rSquared:ua(t,n,e,i,l)}}function sa(t,n,e){let r=0,i=0,a=0,u=0,o=0;aa(t,n,e,(t,n)=>{++o,t=Math.log(t),r+=(t-r)/o,i+=(n-i)/o,a+=(t*n-a)/o,u+=(t*t-u)/o});const s=ra(r,i,a,u),l=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:l,rSquared:ua(t,n,e,i,l)}}function la(t,n,e){let r=0,i=0,a=0,u=0,o=0,s=0;aa(t,n,e,(t,n)=>{const e=Math.log(n),l=t*n;++s,r+=(n-r)/s,a+=(l-a)/s,o+=(t*l-o)/s,i+=(n*e-i)/s,u+=(l*e-u)/s});const l=ra(a/r,i/r,u/r,o/r),c=t=>l[0]*Math.exp(l[1]*t);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:ua(t,n,e,r,c)}}function ca(t,n,e){let r=0,i=0,a=0,u=0,o=0,s=0;aa(t,n,e,(t,n)=>{const e=Math.log(t),l=Math.log(n);++s,r+=(e-r)/s,i+=(l-i)/s,a+=(e*l-a)/s,u+=(e*e-u)/s,o+=(n-o)/s});const l=ra(r,i,a,u),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:ua(t,n,e,o,c)}}function fa(t,n,e){const[r,i,a,u]=ia(t,n,e),o=r.length;let s,l,c,f,h=0,d=0,p=0,g=0,m=0;for(s=0;s<o;)l=r[s],c=i[s++],f=l*l,h+=(f-h)/s,d+=(f*l-d)/s,p+=(f*f-p)/s,g+=(l*c-g)/s,m+=(f*c-m)/s;const v=p-h*h,y=h*v-d*d,_=(m*h-g*d)/y,x=(g*v-m*d)/y,b=-_*h,w=t=>_*(t-=a)*t+x*t+b+u;return{coef:[b-x*a+_*a*a+u,x-2*_*a,_],predict:w,rSquared:ua(t,n,e,0,w)}}function ha(t,n,e,r){if(1===r)return oa(t,n,e);if(2===r)return fa(t,n,e);const[i,a,u,o]=ia(t,n,e),s=i.length,l=[],c=[],f=r+1;let h,d,p,g,m;for(h=0;h<f;++h){for(p=0,g=0;p<s;++p)g+=Math.pow(i[p],h)*a[p];for(l.push(g),m=new Float64Array(f),d=0;d<f;++d){for(p=0,g=0;p<s;++p)g+=Math.pow(i[p],h+d);m[d]=g}c.push(m)}c.push(l);const v=function(t){const n=t.length-1,e=[];let r,i,a,u,o;for(r=0;r<n;++r){for(u=r,i=r+1;i<n;++i)Math.abs(t[r][i])>Math.abs(t[r][u])&&(u=i);for(a=r;a<n+1;++a)o=t[a][r],t[a][r]=t[a][u],t[a][u]=o;for(i=r+1;i<n;++i)for(a=n;a>=r;a--)t[a][i]-=t[a][r]*t[r][i]/t[r][r]}for(i=n-1;i>=0;--i){for(o=0,a=i+1;a<n;++a)o+=t[a][i]*e[a];e[i]=(t[n][i]-o)/t[i][i]}return e}(c),y=t=>{t-=u;let n=o+v[0]+v[1]*t+v[2]*t*t;for(h=3;h<f;++h)n+=v[h]*Math.pow(t,h);return n};return{coef:da(f,v,-u,o),predict:y,rSquared:ua(t,n,e,0,y)}}function da(t,n,e,r){const i=Array(t);let a,u,o,s;for(a=0;a<t;++a)i[a]=0;for(a=t-1;a>=0;--a)for(o=n[a],s=1,i[a]+=o,u=1;u<=a;++u)s*=(a+1-u)/u,i[a-u]+=o*Math.pow(e,u)*s;return i[0]+=r,i}const pa=2,ga=1e-12;function ma(t,n,e,r){const[i,a,u,o]=ia(t,n,e,!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<=pa;){const n=[0,l-1];for(let t=0;t<s;++t){const e=i[t],r=n[0],u=n[1],o=e-i[r]>i[u]-e?r:u;let s=0,l=0,d=0,p=0,g=0,m=1/Math.abs(i[o]-e||1);for(let t=r;t<=u;++t){const n=i[t],r=a[t],u=va(Math.abs(e-n)*m)*h[t],o=n*u;s+=u,l+=o,d+=r*u,p+=r*o,g+=n*o}const[v,y]=ra(l/s,d/s,p/s,g/s);c[t]=v+y*e,f[t]=Math.abs(a[t]-c[t]),ya(i,t+1,n)}if(t===pa)break;const e=Fi(f);if(Math.abs(e)<ga)break;for(let t,n,r=0;r<s;++r)t=f[r]/(6*e),h[r]=t>=1?ga:(n=1-t*t)*n}return function(t,n,e,r){const i=t.length,a=[];let u,o=0,s=0,l=[];for(;o<i;++o)u=t[o]+e,l[0]===u?l[1]+=(n[o]-l[1])/++s:(s=0,l[1]+=r,l=[u,n[o]],a.push(l));return l[1]+=r,a}(i,c,u,o)}function va(t){return(t=1-t*t*t)*t*t}function ya(t,n,e){let r=t[n],i=e[0],a=e[1]+1;if(!(a>=t.length))for(;n>i&&t[a]-r<=r-t[i];)e[0]=++i,e[1]=a,++a}const _a=.1*Math.PI/180;function xa(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=n=>[n,t(n)],a=n[0],u=n[1],o=u-a,s=o/r,l=[i(a)],c=[];if(e===r){for(let t=1;t<r;++t)l.push(i(a+t/e*o));return l.push(i(u)),l}c.push(i(u));for(let t=e;--t>0;)c.push(i(a+t/e*o));let f=l[0],h=c[c.length-1];for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=s&&ba(f,t,h)>_a?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function ba(t,n,e){const r=Math.atan2(e[1]-t[1],e[0]-t[0]),i=Math.atan2(n[1]-t[1],n[0]-t[0]);return Math.abs(r-i)}function wa(t){this._key=t?c(t):Bt,this.reset()}var Aa=wa.prototype;function ka(t){Qr.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}Aa.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Aa.add=function(t){this._add.push(t)},Aa.rem=function(t){this._rem.push(t)},Aa.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,n,e,r=this._add,i=this._rem,a=this._key,u=r.length,o=i.length,s=Array(u-o),l={};for(t=0;t<o;++t)l[a(i[t])]=1;for(t=0,n=0;t<u;++t)l[a(e=r[t])]?l[a(e)]=0:s[n++]=e;return this._rem=[],this._add=s},Aa.distinct=function(t){for(var n,e=this.values(),r=e.length,i={},a=0;--r>=0;)rt(i,n=t(e[r])+"")||(i[n]=1,++a);return a},Aa.extent=function(t){if(this._get!==t||!this._ext){var n=this.values(),e=nt(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},Aa.argmin=function(t){return this.extent(t)[0]||{}},Aa.argmax=function(t){return this.extent(t)[1]||{}},Aa.min=function(t){var n=this.extent(t)[0];return null!=n?t(n):void 0},Aa.max=function(t){var n=this.extent(t)[1];return null!=n?t(n):void 0},Aa.quartile=function(t){return this._get===t&&this._q||(this._q=Ti(this.values(),t),this._get=t),this._q},Aa.q1=function(t){return this.quartile(t)[0]},Aa.q2=function(t){return this.quartile(t)[1]},Aa.q3=function(t){return this.quartile(t)[2]},Aa.ci=function(t){return this._get===t&&this._ci||(this._ci=Oi(this.values(),1e3,.05,t),this._get=t),this._ci},Aa.ci0=function(t){return this.ci(t)[0]},Aa.ci1=function(t){return this.ci(t)[1]},ka.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:ui},{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"}]};var Ma=ot(ka,Qr);Ma.transform=function(t,n){var e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):{},n.visit(n.SOURCE,t=>e.add(t))):(e.value=e.value||e.init(t),n.visit(n.REM,t=>e.rem(t)),n.visit(n.ADD,t=>e.add(t))),r.modifies(e._outputs),e._drop=!1!==t.drop,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),e.changes(r)},Ma.cross=function(){var t=this,n=t.value,e=t._dnames,r=e.map((function(){return{}})),i=e.length;function a(t){var n,a,u,o;for(n in t)for(u=t[n].tuple,a=0;a<i;++a)r[a][o=u[e[a]]]=o}a(t._prev),a(n),function a(u,o,s){var l,c,f=e[s],h=r[s++];for(l in h)o[f]=h[l],c=u?u+"|"+l:l,s<i?a(c,o,s):n[c]||t.cell(c,o)}("",{},0)},Ma.init=function(t){var n=this._inputs=[],a=this._outputs=[],u={};function o(t){for(var e,i=V(r(t)),a=0,o=i.length;a<o;++a)u[e=i[a]]||(u[e]=1,n.push(e))}this._dims=V(t.groupby),this._dnames=this._dims.map((function(t){var n=e(t);return o(t),a.push(n),n})),this.cellkey=t.key?t.key:ri(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];var s,l,c,f,h,d,p=t.fields||[null],g=t.ops||["count"],m=t.as||[],v=p.length,y={};for(v!==g.length&&i("Unmatched number of fields and aggregate ops."),d=0;d<v;++d)s=p[d],l=g[d],null==s&&"count"!==l&&i("Null aggregate field specified."),h=ii(l,f=e(s),m[d]),a.push(h),"count"!==l?((c=y[f])||(o(s),(c=y[f]=[]).field=s,this._measures.push(c)),"count"!==l&&(this._countOnly=!1),c.push(oi(l,h))):this._counts.push(h);return this._measures=this._measures.map((function(t){return ci(t,t.field)})),{}},Ma.cellkey=ri(),Ma.cell=function(t,n){var e=this.value[t];return e?0===e.num&&this._drop&&e.stamp<this.stamp?(e.stamp=this.stamp,this._adds[this._alen++]=e):e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e):(e=this.value[t]=this.newcell(t,n),this._adds[this._alen++]=e),e},Ma.newcell=function(t,n){var e={key:t,num:0,agg:null,tuple:this.newtuple(n,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var r,i=this._measures,a=i.length;for(e.agg=Array(a),r=0;r<a;++r)e.agg[r]=new i[r](e)}return e.store&&(e.data=new wa),e},Ma.newtuple=function(t,n){var e,r,i=this._dnames,a=this._dims,u={};for(e=0,r=a.length;e<r;++e)u[i[e]]=a[e](t);return n?Rt(n.tuple,u):zt(u)},Ma.add=function(t){var n,e,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num+=1,!this._countOnly)for(a.store&&a.data.add(t),e=0,r=(n=a.agg).length;e<r;++e)n[e].add(n[e].get(t),t)},Ma.rem=function(t){var n,e,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num-=1,!this._countOnly)for(a.store&&a.data.rem(t),e=0,r=(n=a.agg).length;e<r;++e)n[e].rem(n[e].get(t),t)},Ma.celltuple=function(t){var n,e,r,i=t.tuple,a=this._counts;for(t.store&&t.data.values(),e=0,r=a.length;e<r;++e)i[a[e]]=t.num;if(!this._countOnly)for(e=0,r=(n=t.agg).length;e<r;++e)n[e].set(i);return i},Ma.changes=function(t){var n,e,r,i,a=this._adds,u=this._mods,o=this._prev,s=this._drop,l=t.add,c=t.rem,f=t.mod;if(o)for(e in o)n=o[e],s&&!n.num||c.push(n.tuple);for(r=0,i=this._alen;r<i;++r)l.push(this.celltuple(a[r])),a[r]=null;for(r=0,i=this._mlen;r<i;++r)(0===(n=u[r]).num&&s?c:f).push(this.celltuple(n)),u[r]=null;return this._alen=this._mlen=0,this._prev=null,t};function Ea(t){Qr.call(this,null,t)}Ea.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"]}]};var Da=ot(Ea,Qr);function Ca(t,n,e){var r=t,i=n||[],a=e||[],u={},o=0;return{add:function(t){a.push(t)},remove:function(t){u[r(t)]=++o},size:function(){return i.length},data:function(t,n){return o&&(i=i.filter((function(t){return!u[r(t)]})),u={},o=0),n&&t&&i.sort(t),a.length&&(i=t?gt(t,i,a.sort(t)):i.concat(a),a=[]),i}}}function Fa(t){Qr.call(this,[],t)}function Sa(t){Wt.call(this,null,Ba,t)}function Ba(t){return this.value&&!t.modified()?this.value:J(t.fields,t.orders)}function Ta(t){Qr.call(this,null,t)}Da.transform=function(t,n){var e,i=!1!==t.interval,a=this._bins(t),u=a.start,o=a.step,s=t.as||["bin0","bin1"],l=s[0],c=s[1];return e=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(r(t.field))?n.ADD_MOD:n.ADD,n.visit(e,i?function(t){var n=a(t);t[l]=n,t[c]=null==n?null:u+o*(1+(n-u)/o)}:function(t){t[l]=a(t)}),n.modifies(i?s:l)},Da._bins=function(t){if(this.value&&!t.modified())return this.value;var i,a,u=t.field,o=Ni(t),s=o.step,l=o.start,c=l+Math.ceil((o.stop-l)/s)*s;null!=(i=t.anchor)&&(a=i-(l+s*Math.floor((i-l)/s)),l+=a,c+=a);var f=function(t){var n=u(t);return null==n?null:n<l?-1/0:n>c?1/0:(n=Math.max(l,Math.min(+n,c-s)),l+s*Math.floor(1e-14+(n-l)/s))};return f.start=l,f.stop=o.stop,f.step=s,this.value=n(f,r(u),t.name||"bin_"+e(u))},Fa.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ot(Fa,Qr).transform=function(t,n){var e=n.fork(n.ALL),r=Ca(Bt,this.value,e.materialize(e.ADD).add),i=t.sort,a=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(a),this.value=e.source=r.data(qt(i),a),n.source&&n.source.root&&(this.value.root=n.source.root),e},ot(Sa,Wt),Ta.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"]}]};var za=ot(Ta,Qr);function Na(t){Qr.call(this,null,t)}za.transform=function(t,n){function e(n){return function(e){for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(o(e),t.case,a)||[],s=0,l=i.length;s<l;++s)u.test(r=i[s])||n(r)}}var r=this._parameterCheck(t,n),i=this._counts,a=this._match,u=this._stop,o=t.field,s=t.as||["text","count"],l=e((function(t){i[t]=1+(i[t]||0)})),c=e((function(t){i[t]-=1}));return r?n.visit(n.SOURCE,l):(n.visit(n.ADD,l),n.visit(n.REM,c)),this._finish(n,s)},za._parameterCheck=function(t,n){var e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},za._finish=function(t,n){var e,r,i,a=this._counts,u=this._tuples||(this._tuples={}),o=n[0],s=n[1],l=t.fork(t.NO_SOURCE|t.NO_FIELDS);for(e in a)r=u[e],i=a[e]||0,!r&&i?(u[e]=r=zt({}),r[o]=e,r[s]=i,l.add.push(r)):0===i?(r&&l.rem.push(r),a[e]=null,u[e]=null):r[s]!==i&&(r[s]=i,l.mod.push(r));return l.modifies(n)},Na.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ot(Na,Qr).transform=function(t,n){var e=n.fork(n.NO_SOURCE),r=this.value,i=t.as||["a","b"],a=i[0],u=i[1];return!r||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter")?(r&&(e.rem=r),r=n.materialize(n.SOURCE).source,e.add=this.value=function(t,n,e,r){for(var i,a,u=[],o={},s=t.length,l=0;l<s;++l)for(o[n]=a=t[l],i=0;i<s;++i)o[e]=t[i],r(o)&&(u.push(zt(o)),(o={})[n]=a);return u}(r,a,u,t.filter||m)):e.mod=r,e.source=this.value,e.modifies(i)};var Oa={kde:Wi,mixture:Zi,normal:Hi,lognormal:Ji,uniform:ea},Ra="distributions",qa="function",La="field";function Ua(t){Qr.call(this,null,t)}var $a=[{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}]}],Pa={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:$a},{name:"weights",type:"number",array:!0}]};function ja(t,n){return t?t.map((function(t,r){return n[r]||e(t)})):null}function Ia(t,n,e){var r,i,a,u,o,s,l=[],c=function(t){return t(u)};if(null==n)l.push(t.map(e));else for(r={},i=0,a=t.length;i<a;++i)u=t[i],(s=r[o=n.map(c)])||(r[o]=s=[],s.dims=o,l.push(s)),s.push(e(u));return l}Ua.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:$a.concat(Pa)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ot(Ua,Qr).transform=function(t,n){var e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){var r=function t(n,e){var r=n[qa];rt(Oa,r)||i("Unknown distribution function: "+r);var a=Oa[r]();for(var u in n)u===La?a.data((n.from||e()).map(n[u])):u===Ra?a[u](n[u].map((function(n){return t(n,e)}))):typeof a[u]===qa&&a[u](n[u]);return a}(t.distribution,function(t){return function(){return t.materialize(t.SOURCE).source}}(n)),a=t.steps||t.minsteps||25,u=t.steps||t.maxsteps||200,o=t.method||"pdf";"pdf"!==o&&"cdf"!==o&&i("Invalid density method: "+o),t.extent||r.data||i("Missing density extent parameter."),o=r[o];var s=t.as||["value","density"],l=xa(o,t.extent||tt(r.data()),a,u).map(t=>{var n={};return n[s[0]]=t[0],n[s[1]]=t[1],zt(n)});this.value&&(e.rem=this.value),this.value=e.add=e.source=l}return e};function Ha(t){Qr.call(this,null,t)}function Wa(t){Wt.call(this,null,Ya,t),this.modified(!0)}function Ya(t){var i=t.expr;return this.value&&!t.modified("expr")?this.value:n(n=>i(n,t),r(i),e(i))}function Va(t){Qr.call(this,[void 0,void 0],t)}function Ga(t,n){Wt.call(this,t),this.parent=n}Ha.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"}]},ot(Ha,Qr).transform=function(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=Ia(n.source,t.groupby,d),i=t.smooth||!1,a=t.field,u=t.step||function(t,n){return yt(tt(t,n))/30}(e,a),o=qt((t,n)=>a(t)-a(n)),s=t.as||"bin",l=r.length;let c,f=1/0,h=-1/0,p=0;for(;p<l;++p){const t=r[p].sort(o);c=-1;for(const n of Ri(t,u,i,a))n<f&&(f=n),n>h&&(h=n),t[++c][s]=n}return this.value={start:f,stop:h,step:u},n.reflow(!0).modifies(s)},ot(Wa,Wt),Va.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ot(Va,Qr).transform=function(t,n){var r,i=this.value,a=t.field,u=i[0],o=i[1];if(((r=n.changed()||n.modified(a.fields)||t.modified("field"))||null==u)&&(u=1/0,o=-1/0),n.visit(r?n.SOURCE:n.ADD,(function(t){var n=a(t);null!=n&&((n=+n)<u&&(u=n),n>o&&(o=n))})),!Number.isFinite(u)||!Number.isFinite(o)){let t=e(a);t&&(t=` for field "${t}"`),n.dataflow.warn(`Infinite extent${t}: [${u}, ${o}]`),u=o=void 0}this.value=[u,o]};var Xa=ot(Ga,Wt);function Ja(t){Qr.call(this,{},t),this._keys=at();var n=this._targets=[];n.active=0,n.forEach=function(t){for(var e=0,r=n.active;e<r;++e)t(n[e],e,n)}}Xa.connect=function(t){return this.targets().add(t),t.source=this},Xa.add=function(t){this.value.add.push(t)},Xa.rem=function(t){this.value.rem.push(t)},Xa.mod=function(t){this.value.mod.push(t)},Xa.init=function(t){this.value.init(t,t.NO_SOURCE)},Xa.evaluate=function(){return this.value};var Za=ot(Ja,Qr);function Qa(t){Wt.call(this,null,Ka,t)}function Ka(t){return this.value&&!t.modified()?this.value:u(t.name)?V(t.name).map((function(t){return c(t)})):c(t.name,t.as)}function tu(t){Qr.call(this,at(),t)}function nu(t){Qr.call(this,[],t)}function eu(t){Qr.call(this,[],t)}function ru(t){Qr.call(this,null,t)}function iu(t){Qr.call(this,[],t)}Za.activate=function(t){this._targets[this._targets.active++]=t},Za.subflow=function(t,n,e,r){var i,a,u=this.value,o=rt(u,t)&&u[t];return o?o.value.stamp<e.stamp&&(o.init(e),this.activate(o)):(a=r||(a=this._group[t])&&a.tuple,o=(i=e.dataflow).add(new Ga(e.fork(e.NO_SOURCE),this)).connect(n(i,t,a)),u[t]=o,this.activate(o)),o},Za.transform=function(t,n){var e=n.dataflow,r=this,i=t.key,a=t.subflow,u=this._keys,o=t.modified("key");function s(t){return r.subflow(t,a,n)}return this._group=t.group||{},this._targets.active=0,n.visit(n.REM,(function(t){var n=Bt(t),e=u.get(n);void 0!==e&&(u.delete(n),s(e).rem(t))})),n.visit(n.ADD,(function(t){var n=i(t);u.set(Bt(t),n),s(n).add(t)})),o||n.modified(i.fields)?n.visit(n.MOD,(function(t){var n=Bt(t),e=u.get(n),r=i(t);e===r?s(r).mod(t):(u.set(n,r),s(e).rem(t),s(r).add(t))})):n.changed(n.MOD)&&n.visit(n.MOD,(function(t){s(u.get(Bt(t))).mod(t)})),o&&n.visit(n.REFLOW,(function(t){var n=Bt(t),e=u.get(n),r=i(t);e!==r&&(u.set(n,r),s(e).rem(t),s(r).add(t))})),u.empty>e.cleanThreshold&&e.runAfter(u.clean),n},ot(Qa,Wt),tu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ot(tu,Qr).transform=function(t,n){var e=n.dataflow,r=this.value,i=n.fork(),a=i.add,u=i.rem,o=i.mod,s=t.expr,l=!0;function c(n){var e=Bt(n),i=s(n,t),c=r.get(e);i&&c?(r.delete(e),a.push(n)):i||c?l&&i&&!c&&o.push(n):(r.set(e,1),u.push(n))}return n.visit(n.REM,(function(t){var n=Bt(t);r.has(n)?r.delete(n):u.push(t)})),n.visit(n.ADD,(function(n){s(n,t)?a.push(n):r.set(Bt(n),1)})),n.visit(n.MOD,c),t.modified()&&(l=!1,n.visit(n.REFLOW,c)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i},nu.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}]},ot(nu,Qr).transform=function(t,n){var e=n.fork(n.NO_SOURCE),r=t.fields,i=ja(r,t.as||[]),a=t.index||null,u=i.length;return e.rem=this.value,n.visit(n.SOURCE,(function(t){for(var n,o,s,l=r.map(n=>n(t)),c=l.reduce((t,n)=>Math.max(t,n.length),0),f=0;f<c;++f){for(o=Nt(t),n=0;n<u;++n)o[i[n]]=null==(s=l[n][f])?null:s;a&&(o[a]=f),e.add.push(o)}})),this.value=e.source=e.add,a&&e.modifies(a),e.modifies(i)},eu.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},ot(eu,Qr).transform=function(t,n){var r=n.fork(n.NO_SOURCE),i=t.fields,a=i.map(e),u=t.as||["key","value"],o=u[0],s=u[1],l=i.length;return r.rem=this.value,n.visit(n.SOURCE,(function(t){for(var n,e=0;e<l;++e)(n=Nt(t))[o]=a[e],n[s]=i[e](t),r.add.push(n)})),this.value=r.source=r.add,r.modifies(u)},ru.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},ot(ru,Qr).transform=function(t,n){var e=t.expr,r=t.as,i=t.modified(),a=t.initonly?n.ADD:i?n.SOURCE:n.modified(e.fields)||n.modified(r)?n.ADD_MOD:n.ADD;return i&&(n=n.materialize().reflow(!0)),t.initonly||n.modifies(r),n.visit(a,n=>n[r]=e(n,t))},ot(iu,Qr).transform=function(t,n){var e,r,i,a=this.value,u=n.fork(n.ALL),o=t.size-a.length,s=t.generator;if(o>0){for(e=[];--o>=0;)e.push(i=zt(s(t))),a.push(i);u.add=u.add.length?u.materialize(u.ADD).add.concat(e):e}else r=a.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(r):r,a=a.slice(-o);return u.source=this.value=a,u};var au={value:"value",median:Fi,mean:function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let a of t)null!=(a=n(a,++i,t))&&(a=+a)>=a&&(++e,r+=a)}if(e)return r/e},min:Mi,max:ki},uu=[];function ou(t){Qr.call(this,[],t)}function su(t){ka.call(this,t)}ou.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}]},ot(ou,Qr).transform=function(t,n){var r,a,u,o,s,l,c,f,h,d,p=n.fork(n.ALL),g=function(t){var n,e=t.method||au.value;if(null!=au[e])return e===au.value?(n=void 0!==t.value?t.value:0,function(){return n}):au[e];i("Unrecognized imputation method: "+e)}(t),m=function(t){var n=t.field;return function(t){return t?n(t):NaN}}(t),v=e(t.field),y=e(t.key),_=(t.groupby||[]).map(e),x=function(t,n,e,r){var i,a,u,o,s,l,c,f,h=function(t){return t(f)},d=[],p=r?r.slice():[],g={},m={};for(p.forEach((function(t,n){g[t]=n+1})),o=0,c=t.length;o<c;++o)f=t[o],l=e(f),s=g[l]||(g[l]=p.push(l)),a=(i=n?n.map(h):uu)+"",(u=m[a])||(u=m[a]=[],d.push(u),u.values=i),u[s-1]=f;return d.domain=p,d}(n.source,t.groupby,t.key,t.keyvals),b=[],w=this.value,A=x.domain.length;for(s=0,f=x.length;s<f;++s)for(u=(r=x[s]).values,a=NaN,c=0;c<A;++c)if(null==r[c]){for(o=x.domain[c],d={_impute:!0},l=0,h=u.length;l<h;++l)d[_[l]]=u[l];d[y]=o,d[v]=Number.isNaN(a)?a=g(r,m):a,b.push(zt(d))}return b.length&&(p.add=p.materialize(p.ADD).add.concat(b)),w.length&&(p.rem=p.materialize(p.REM).rem.concat(w)),this.value=b,p},su.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:ui},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]};var lu=ot(su,ka);function cu(t){Qr.call(this,null,t)}function fu(t){Wt.call(this,null,hu,t)}function hu(t){return this.value&&!t.modified()?this.value:dt(t.fields,t.flat)}function du(t){Qr.call(this,[],t),this._pending=null}function pu(t,n,e){e.forEach(zt);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r}function gu(t){Qr.call(this,{},t)}function mu(t){Wt.call(this,null,vu,t)}function vu(t){if(this.value&&!t.modified())return this.value;var n,e,r,i=1/0,a=-1/0,u=t.extents;for(n=0,e=u.length;n<e;++n)(r=u[n])[0]<i&&(i=r[0]),r[1]>a&&(a=r[1]);return[i,a]}function yu(t){Wt.call(this,null,_u,t)}function _u(t){return this.value&&!t.modified()?this.value:t.values.reduce((function(t,n){return t.concat(n)}),[])}function xu(t){Qr.call(this,null,t)}function bu(t){ka.call(this,t)}lu.transform=function(t,n){var e,r=this,i=t.modified();return r.value&&(i||n.modified(r._inputs,!0))?(e=r.value=i?r.init(t):{},n.visit(n.SOURCE,(function(t){r.add(t)}))):(e=r.value=r.value||this.init(t),n.visit(n.REM,(function(t){r.rem(t)})),n.visit(n.ADD,(function(t){r.add(t)}))),r.changes(),n.visit(n.SOURCE,(function(t){K(t,e[r.cellkey(t)].tuple)})),n.reflow(i).modifies(this._outputs)},lu.changes=function(){var t,n,e=this._adds,r=this._mods;for(t=0,n=this._alen;t<n;++t)this.celltuple(e[t]),e[t]=null;for(t=0,n=this._mlen;t<n;++t)this.celltuple(r[t]),r[t]=null;this._alen=this._mlen=0},cu.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},ot(cu,Qr).transform=function(t,n){var r=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const a=n.materialize(n.SOURCE).source,u=Ia(a,t.groupby,t.field),o=(t.groupby||[]).map(e),s=t.bandwidth,l=t.cumulative?"cdf":"pdf",c=t.as||["value","density"],f=[];let h=t.extent,d=t.steps||t.minsteps||25,p=t.steps||t.maxsteps||200;"pdf"!==l&&"cdf"!==l&&i("Invalid density method: "+l),"shared"===t.resolve&&(h||(h=tt(a,t.field)),d=p=t.steps||p),u.forEach(n=>{const e=Wi(n,s)[l],r=t.counts?n.length:1;xa(e,h||tt(n),d,p).forEach(t=>{const e={};for(let t=0;t<o.length;++t)e[o[t]]=n.dims[t];e[c[0]]=t[0],e[c[1]]=t[1]*r,f.push(zt(e))})}),this.value&&(r.rem=this.value),this.value=r.add=r.source=f}return r},ot(fu,Wt),ot(du,Qr).transform=function(t,n){const e=n.dataflow;if(this._pending)return pu(this,n,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return n.StopPropagation;if(t.values)return pu(this,n,e.parse(t.values,t.format));if(t.async){return{async:e.request(t.url,t.format).then(t=>(this._pending=V(t.data),t=>t.touch(this)))}}return e.request(t.url,t.format).then(t=>pu(this,n,V(t.data)))},gu.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}]},ot(gu,Qr).transform=function(t,n){var r,a,u=n,o=t.as,s=t.fields,l=t.index,c=t.values,f=null==t.default?null:t.default,h=t.modified(),d=h?n.SOURCE:n.ADD,p=s.length;return c?(a=c.length,p>1&&!o&&i('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==p*a&&i('The "as" parameter has too few output field names.'),o=o||c.map(e),r=function(t){for(var n,e,r=0,i=0;r<p;++r)if(null==(e=l.get(s[r](t))))for(n=0;n<a;++n,++i)t[o[i]]=f;else for(n=0;n<a;++n,++i)t[o[i]]=c[n](e)}):(o||i("Missing output field names."),r=function(t){for(var n,e=0;e<p;++e)n=l.get(s[e](t)),t[o[e]]=null==n?f:n}),h?u=n.reflow(!0):d|=s.some((function(t){return n.modified(t.fields)}))?n.MOD:0,n.visit(d,r),u.modifies(o)},ot(mu,Wt),ot(yu,Wt),ot(xu,Qr),xu.prototype.transform=function(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)},bu.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:ui,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};var wu=ot(bu,ka);function Au(t){Ja.call(this,t)}function ku(t){Qr.call(this,null,t)}function Mu(t){Qr.call(this,null,t)}function Eu(t){Qr.call(this,null,t)}wu._transform=wu.transform,wu.transform=function(t,e){return this._transform(function(t,e){var i=t.field,a=t.value,u=("count"===t.op?"__count__":t.op)||"sum",o=r(i).concat(r(a)),s=function(t,n,e){var r={},i=[];return e.visit(e.SOURCE,(function(n){var e=t(n);r[e]||(r[e]=1,i.push(e))})),i.sort((function(t,n){return(t<n||null==t)&&null!=n?-1:(t>n||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0)})),n?i.slice(0,n):i}(i,t.limit||0,e);e.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:s.map((function(){return u})),fields:s.map((function(t){return function(t,e,r,i){return n((function(n){return e(n)===t?r(n):NaN}),i,t+"")}(t,i,a,o)})),as:s.map((function(t){return t+""})),modified:t.modified.bind(t)}}(t,e),e)},ot(Au,Ja).transform=function(t,n){var e=this,a=t.subflow,u=t.field;return(t.modified("field")||u&&n.modified(r(u)))&&i("PreFacet does not support field modification."),this._targets.active=0,n.visit(n.MOD,(function(t){var r=e.subflow(Bt(t),a,n,t);u?u(t).forEach((function(t){r.mod(t)})):r.mod(t)})),n.visit(n.ADD,(function(t){var r=e.subflow(Bt(t),a,n,t);u?u(t).forEach((function(t){r.add(zt(t))})):r.add(t)})),n.visit(n.REM,(function(t){var r=e.subflow(Bt(t),a,n,t);u?u(t).forEach((function(t){r.rem(t)})):r.rem(t)})),n},ku.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ot(ku,Qr).transform=function(t,n){var e,r,i=t.fields,a=ja(t.fields,t.as||[]),u=i?function(t,n){return function(t,n,e,r){for(var i=0,a=e.length;i<a;++i)n[r[i]]=e[i](t);return n}(t,n,i,a)}:Ot;return this.value?r=this.value:(n=n.addAll(),r=this.value={}),e=n.fork(n.NO_SOURCE),n.visit(n.REM,(function(t){var n=Bt(t);e.rem.push(r[n]),r[n]=null})),n.visit(n.ADD,(function(t){var n=u(t,zt({}));r[Bt(t)]=n,e.add.push(n)})),n.visit(n.MOD,(function(t){e.mod.push(u(t,r[Bt(t)]))})),e},ot(Mu,Qr).transform=function(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation},Eu.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"]}]};var Du=ot(Eu,Qr);function Cu(t){Qr.call(this,null,t)}function Fu(t){Qr.call(this,[],t),this.count=0}function Su(t){Qr.call(this,null,t)}function Bu(t){Qr.call(this,null,t),this.modified(!0)}Du.transform=function(t,n){var r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return r.source=this.value,r;const a=Ia(n.materialize(n.SOURCE).source,t.groupby,t.field),u=(t.groupby||[]).map(e),o=[],s=t.step||.01,l=t.probs||vi(s/2,1-1e-14,s),c=l.length;return a.forEach(t=>{const n=Bi(t,l);for(let e=0;e<c;++e){const r={};for(let n=0;n<u.length;++n)r[u[n]]=t.dims[n];r[i[0]]=l[e],r[i[1]]=n[e],o.push(zt(r))}}),this.value&&(r.rem=this.value),this.value=r.add=r.source=o,r},ot(Cu,Qr).transform=function(t,n){var e,r;return this.value?r=this.value:(e=n=n.addAll(),r=this.value={}),t.derive&&(e=n.fork(n.NO_SOURCE),n.visit(n.REM,t=>{var n=Bt(t);e.rem.push(r[n]),r[n]=null}),n.visit(n.ADD,t=>{var n=Nt(t);r[Bt(t)]=n,e.add.push(n)}),n.visit(n.MOD,t=>{var n,i=r[Bt(t)];for(n in t)i[n]=t[n],e.modifies(n);e.mod.push(i)})),e},Fu.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ot(Fu,Qr).transform=function(n,e){var r=e.fork(e.NO_SOURCE),i=n.modified("size"),a=n.size,u=this.value,o=this.count,s=0,l=u.reduce((function(t,n){return t[Bt(n)]=1,t}),{});function c(n){var e,i;u.length<a?u.push(n):(i=~~((o+1)*t.random()))<u.length&&i>=s&&(e=u[i],l[Bt(e)]&&r.rem.push(e),u[i]=n),++o}if(e.rem.length&&(e.visit(e.REM,(function(t){var n=Bt(t);l[n]&&(l[n]=-1,r.rem.push(t)),--o})),u=u.filter((function(t){return-1!==l[Bt(t)]}))),(e.rem.length||i)&&u.length<a&&e.source&&(s=o=u.length,e.visit(e.SOURCE,(function(t){l[Bt(t)]||c(t)})),s=-1),i&&u.length>a){for(var f=0,h=u.length-a;f<h;++f)l[Bt(u[f])]=-1,r.rem.push(u[f]);u=u.slice(h)}return e.mod.length&&e.visit(e.MOD,(function(t){l[Bt(t)]&&r.mod.push(t)})),e.add.length&&e.visit(e.ADD,c),(e.add.length||s<0)&&(r.add=u.filter((function(t){return!l[Bt(t)]}))),this.count=o,this.value=r.source=u,r},Su.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"}]},ot(Su,Qr).transform=function(t,n){if(!this.value||t.modified()){var e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=vi(t.start,t.stop,t.step||1).map((function(t){var n={};return n[r]=t,zt(n)})),e.add=n.add.concat(this.value),e}},ot(Bu,Qr).transform=function(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation};const Tu="year",zu="quarter",Nu="month",Ou="week",Ru="date",qu="day",Lu="hours",Uu="minutes",$u="seconds",Pu="milliseconds",ju=[Tu,zu,Nu,Ou,Ru,qu,Lu,Uu,$u,Pu].reduce((t,n,e)=>(t[n]=1+e,t),{});function Iu(t){const n=V(t).slice(),e={};return n.length||i("Missing time unit."),n.forEach(t=>{rt(ju,t)?e[t]=1:i(`Invalid time unit: ${t}.`)}),(e[Ou]||e[qu])&&(e[zu]||e[Nu]||e[Ru])&&i(`Incompatible time units: ${t}`),n.sort((t,n)=>ju[t]-ju[n]),n}const Hu=new Date;function Wu(t,n,e,r){const i=n||1,a=C(t),u=(t,n,r)=>(function(t,n,e){return n<=1?t:e?(r,i)=>e+n*Math.floor((t(r,i)-e)/n):(e,r)=>n*Math.floor(t(e,r)/n)})(e[r||t],t===a&&i,n),o=new Date,s=At(t),l=s[Tu]?u(Tu):Z(2012),c=s[Nu]?u(Nu):s[zu]?u(zu):p,f=s[Ou]&&s[qu]?u(qu,1,Ou+qu):s[Ou]?u(Ou,1):s[qu]?u(qu,1):s[Ru]?u(Ru,1):g,h=s[Lu]?u(Lu):p,d=s[Uu]?u(Uu):p,m=s[$u]?u($u):p,v=s[Pu]?u(Pu):p;return function(t){o.setTime(+t);const n=l(o);return r(n,c(o),f(o,n),h(o),d(o),m(o),v(o))}}function Yu(t,n,e){return n+7*t-(e+6)%7}const Vu={[Tu]:t=>t.getFullYear(),[zu]:t=>3*~~(t.getMonth()/3),[Nu]:t=>t.getMonth(),[Ru]:t=>t.getDate(),[Lu]:t=>t.getHours(),[Uu]:t=>t.getMinutes(),[$u]:t=>t.getSeconds(),[Pu]:t=>t.getMilliseconds(),[qu]:(t,n)=>Yu(1,t.getDay(),Ju(n)),[Ou]:(t,n)=>Yu(Xu(t),0,Ju(n)),[Ou+qu]:(t,n)=>Yu(Xu(t),t.getDay(),Ju(n))};function Gu(t){return Hu.setFullYear(t),Hu.setMonth(0),Hu.setDate(1),Hu.setHours(0,0,0,0),Hu}function Xu(t){return Zn.count(Gu(t.getFullYear())-1,t)}function Ju(t){return Gu(t).getDay()}function Zu(t,n,e,r,i,a,u){if(0<=t&&t<100){var o=new Date(-1,n,e,r,i,a,u);return o.setFullYear(t),o}return new Date(t,n,e,r,i,a,u)}function Qu(t,n){return Wu(t,n||1,Vu,Zu)}const Ku={[Tu]:t=>t.getUTCFullYear(),[zu]:t=>3*~~(t.getUTCMonth()/3),[Nu]:t=>t.getUTCMonth(),[Ru]:t=>t.getUTCDate(),[Lu]:t=>t.getUTCHours(),[Uu]:t=>t.getUTCMinutes(),[$u]:t=>t.getUTCSeconds(),[Pu]:t=>t.getUTCMilliseconds(),[qu]:(t,n)=>Yu(1,t.getUTCDay(),no(n)),[Ou]:(t,n)=>Yu(to(t),0,no(n)),[Ou+qu]:(t,n)=>Yu(to(t),t.getUTCDay(),no(n))};function to(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return ue.count(n-1,t)}function no(t){return Hu.setTime(Date.UTC(t,0,1)),Hu.getUTCDay()}function eo(t,n,e,r,i,a,u){if(0<=t&&t<100){var o=new Date(Date.UTC(-1,n,e,r,i,a,u));return o.setUTCFullYear(e.y),o}return new Date(Date.UTC(t,n,e,r,i,a,u))}function ro(t,n){return Wu(t,n||1,Ku,eo)}const io={[Tu]:ne,[zu]:te.every(3),[Nu]:te,[Ou]:Zn,[Ru]:Xn,[qu]:Xn,[Lu]:Gn,[Uu]:Vn,[$u]:Yn,[Pu]:In},ao={[Tu]:ce,[zu]:le.every(3),[Nu]:le,[Ou]:ue,[Ru]:ie,[qu]:ie,[Lu]:re,[Uu]:ee,[$u]:Yn,[Pu]:In};function uo(t){return io[t]}function oo(t){return ao[t]}function so(t,n,e){return t?t.offset(n,e):void 0}function lo(t,n,e){return so(uo(t),n,e)}function co(t,n,e){return so(oo(t),n,e)}function fo(t,n,e,r){return t?t.range(n,e,r):void 0}function ho(t,n,e,r){return fo(uo(t),n,e,r)}function po(t,n,e,r){return fo(oo(t),n,e,r)}const go={[Tu]:"%Y ",[zu]:"Q%q ",[Nu]:"%b ",[Ru]:"%d ",[Ou]:"W%U ",[qu]:"%a ",[Lu]:"%H:00",[Uu]:"00:%M",[$u]:":%S",[Pu]:".%L",[`${Tu}-${Nu}`]:"%Y-%m ",[`${Tu}-${Nu}-${Ru}`]:"%Y-%m-%d ",[`${Lu}-${Uu}`]:"%H:%M"};function mo(t,n){const e=K({},go,n),r=Iu(t),i=r.length;let a,u,o="",s=0;for(s=0;s<i;)for(a=r.length;a>s;--a)if(u=r.slice(s,a).join("-"),null!=e[u]){o+=e[u],s=a;break}return o.trim()}function vo(t){return _o(ge,uo,t)}function yo(t){return _o(ve,oo,t)}function _o(t,n,e){return s(e)?t(e):function(t,n,e){o(e=e||{})||i(`Invalid time multi-format specifier: ${e}`);const r=n($u),a=n(Uu),u=n(Lu),s=n(Ru),l=n(Ou),c=n(Nu),f=n(zu),h=n(Tu),d=t(e[Pu]||".%L"),p=t(e[$u]||":%S"),g=t(e[Uu]||"%I:%M"),m=t(e[Lu]||"%I %p"),v=t(e[Ru]||e[qu]||"%a %d"),y=t(e[Ou]||"%b %d"),_=t(e[Nu]||"%B"),x=t(e[zu]||"%B"),b=t(e[Tu]||"%Y");return function(t){return(r(t)<t?d:a(t)<t?p:u(t)<t?g:s(t)<t?m:c(t)<t?l(t)<t?v:y:h(t)<t?f(t)<t?_:x:b)(t)}}(t,n,e)}const xo=31536e6,bo=[Tu,Nu,Ru,Lu,Uu,$u,Pu],wo=bo.slice(0,-1),Ao=wo.slice(0,-1),ko=Ao.slice(0,-1),Mo=ko.slice(0,-1),Eo=[Tu,Nu],Do=[Tu],Co=[[wo,1,1e3],[wo,5,5e3],[wo,15,15e3],[wo,30,3e4],[Ao,1,6e4],[Ao,5,3e5],[Ao,15,9e5],[Ao,30,18e5],[ko,1,36e5],[ko,3,108e5],[ko,6,216e5],[ko,12,432e5],[Mo,1,864e5],[[Tu,Ou],1,6048e5],[Eo,1,2592e6],[Eo,3,7776e6],[Do,1,xo]];function Fo(t){const n=t.extent,e=t.maxbins||40,r=Math.abs(yt(n))/e;let i,a,u=di(t=>t[2]).right(Co,r);return u===Co.length?(i=Do,a=Ai(n[0]/xo,n[1]/xo,e)):u?(u=Co[r/Co[u-1][2]<Co[u][2]/r?u-1:u],i=u[0],a=u[1]):(i=bo,a=Math.max(Ai(n[0],n[1],e),1)),{units:i,step:a}}function So(t){Qr.call(this,null,t)}const Bo=["unit0","unit1"];So.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"string",array:!0},{name:"step",type:"number",default:1},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:Bo}]};var To=ot(So,Qr);function zo(t){Qr.call(this,at(),t)}function No(t){Qr.call(this,null,t)}To.transform=function(t,n){var e=t.field,i=!1!==t.interval,a="utc"===t.timezone,u=this._floor(t,n),o=(a?oo:uo)(u.unit).offset,s=t.as||Bo,l=s[0],c=s[1],f=u.start||1/0,h=u.stop||-1/0,d=u.step,p=n.ADD;return(t.modified()||n.modified(r(t.field)))&&(p=(n=n.reflow(!0)).SOURCE,f=1/0,h=-1/0),n.visit(p,(function(t){var n,r,a=e(t);null==a?(t[l]=null,i&&(t[c]=null)):(t[l]=n=r=u(a),i&&(t[c]=r=o(n,d)),n<f&&(f=n),r>h&&(h=r))})),u.start=f,u.stop=h,n.modifies(i?s:l)},To._floor=function(t,n){const e="utc"===t.timezone;let{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:Fo({extent:tt(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins});r=Iu(r);const a=this.value||{},u=(e?ro:Qu)(r,i);return u.unit=C(r),u.units=r,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u},ot(zo,Qr).transform=function(t,n){var e=n.dataflow,r=t.field,i=this.value,a=!0;function u(t){i.set(r(t),t)}return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,u)):n.changed()?(n.visit(n.REM,(function(t){i.delete(r(t))})),n.visit(n.ADD,u)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()},ot(No,Qr).transform=function(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(qt(t.sort)):n.source).map(t.field))};const Oo={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{let e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{let e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){let t=Oo.rank(),n=t.next;return{init:t.init,next:t=>(n(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{let e=n.index,r=n.data,i=n.compare;if(t<e){for(;e+1<r.length&&!i(r[e],r[e+1]);)++e;t=e}return(1+t)/r.length}}},ntile:function(t,n){(n=+n)>0||i("ntile num must be greater than zero.");let e=Oo.cume_dist(),r=e.next;return{init:e.init,next:t=>Math.ceil(n*r(t))}},lag:function(t,n){return n=+n||1,{next:e=>{let r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{let r=e.index+n,i=e.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:n=>t(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||i("nth_value nth must be greater than zero."),{next:e=>{let r=e.i0+(n-1);return r<e.i1?t(e.data[r]):null}}},prev_value:function(t){let n=null;return{next:e=>{let r=t(e.data[e.index]);return null!=r?n=r:n}}},next_value:function(t){let n=null,e=-1;return{next:r=>{let i=r.data;return r.index<=e?n:(e=function(t,n,e){for(let r=n.length;e<r;++e){if(null!=t(n[e]))return e}return-1}(t,i,r.index))<0?(e=i.length,n=null):n=t(i[e])}}}};var Ro=Object.keys(Oo);function qo(t){let n=this,a=V(t.ops),u=V(t.fields),o=V(t.params),s=V(t.as),l=n.outputs=[],c=n.windows=[],f={},h={},d=!0,g=[],m=[];function v(t){V(r(t)).forEach(t=>f[t]=1)}v(t.sort),a.forEach((function(t,n){let r=u[n],a=e(r),f=ii(t,a,s[n]);if(v(r),l.push(f),rt(Oo,t))c.push(function(t,n,e,r){let i=Oo[t](n,e);return{init:i.init||p,update:function(t,n){n[r]=i.next(t)}}}(t,u[n],o[n],f));else{if(null==r&&"count"!==t&&i("Null aggregate field specified."),"count"===t)return void g.push(f);d=!1;let n=h[a];n||(n=h[a]=[],n.field=r,m.push(n)),n.push(oi(t,f))}})),(g.length||m.length)&&(n.cell=function(t,n,e){t=t.map(t=>ci(t,t.field));let r={num:0,agg:null,store:!1,count:n};if(!e)for(var i=t.length,a=r.agg=Array(i),u=0;u<i;++u)a[u]=new t[u](r);if(r.store)var o=r.data=new wa;return r.add=function(t){if(r.num+=1,!e){o&&o.add(t);for(let n=0;n<i;++n)a[n].add(a[n].get(t),t)}},r.rem=function(t){if(r.num-=1,!e){o&&o.rem(t);for(let n=0;n<i;++n)a[n].rem(a[n].get(t),t)}},r.set=function(t){let i,u;for(o&&o.values(),i=0,u=n.length;i<u;++i)t[n[i]]=r.num;if(!e)for(i=0,u=a.length;i<u;++i)a[i].set(t)},r.init=function(){r.num=0,o&&o.reset();for(let t=0;t<i;++t)a[t].init()},r}(m,g,d)),n.inputs=Object.keys(f)}const Lo=qo.prototype;function Uo(t){Qr.call(this,{},t),this._mlen=0,this._mods=[]}Lo.init=function(){this.windows.forEach(t=>t.init()),this.cell&&this.cell.init()},Lo.update=function(t,n){let e,r=this.cell,i=this.windows,a=t.data,u=i&&i.length;if(r){for(e=t.p0;e<t.i0;++e)r.rem(a[e]);for(e=t.p1;e<t.i1;++e)r.add(a[e]);r.set(n)}for(e=0;e<u;++e)i[e].update(t,n)},Uo.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ro.concat(ui)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]};var $o=ot(Uo,Qr);function Po(t,n,e,r){var i=r.sort,a=i&&!r.ignorePeers,u=r.frame||[null,0],o=t.data(e),s=o.length,l=0,c=a?di(i):null,f={i0:0,i1:0,p0:0,p1:0,index:0,data:o,compare:i||Z(-1)};for(n.init();l<s;++l)jo(f,u,l,s),a&&Io(f,c),n.update(f,o[l])}function jo(t,n,e,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==n[0]?0:Math.max(0,e-Math.abs(n[0])),t.i1=null==n[1]?r:Math.min(r,e+Math.abs(n[1])+1),t.index=e}function Io(t,n){var e=t.i0,r=t.i1-1,i=t.compare,a=t.data,u=a.length-1;e>0&&!i(a[e],a[e-1])&&(t.i0=n.left(a,a[e])),r<u&&!i(a[r],a[r+1])&&(t.i1=n.right(a,a[r]))}$o.transform=function(t,n){var e,r,i=this,a=i.state,u=t.modified(),o=qt(t.sort);this.stamp=n.stamp,a&&!u||(a=i.state=new qo(t));var s=ri(t.groupby);function l(t){return i.group(s(t))}for(u||n.modified(a.inputs)?(i.value={},n.visit(n.SOURCE,(function(t){l(t).add(t)}))):(n.visit(n.REM,(function(t){l(t).remove(t)})),n.visit(n.ADD,(function(t){l(t).add(t)}))),e=0,r=i._mlen;e<r;++e)Po(i._mods[e],a,o,t);return i._mlen=0,i._mods=[],n.reflow(u).modifies(a.outputs)},$o.group=function(t){var n=this.value[t];return n||((n=this.value[t]=Ca(Bt)).stamp=-1),n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n),n};var Ho=Object.freeze({__proto__:null,aggregate:ka,bin:Ea,collect:Fa,compare:Sa,countpattern:Ta,cross:Na,density:Ua,dotbin:Ha,expression:Wa,extent:Va,facet:Ja,field:Qa,filter:tu,flatten:nu,fold:eu,formula:ru,generate:iu,impute:ou,joinaggregate:su,kde:cu,key:fu,load:du,lookup:gu,multiextent:mu,multivalues:yu,params:xu,pivot:bu,prefacet:Au,project:ku,proxy:Mu,quantile:Eu,relay:Cu,sample:Fu,sequence:Su,sieve:Bu,subflow:Ga,timeunit:So,tupleindex:zo,values:No,window:Uo});const Wo="top",Yo="left",Vo="right",Go="bottom",Xo="top-left",Jo="top-right",Zo="bottom-left",Qo="bottom-right",Ko="start",ts="middle",ns="end",es="x",rs="y",is="group",as="axis",us="title",os="frame",ss="scope",ls="legend",cs="row-header",fs="row-footer",hs="row-title",ds="column-header",ps="column-footer",gs="column-title",ms="padding",vs="symbol",ys="fit",_s="fit-x",xs="fit-y",bs="pad",ws="none",As="all",ks="each",Ms="flush",Es="column",Ds="row";function Cs(t){this.clear(),t&&this.union(t)}var Fs=Cs.prototype;Fs.clone=function(){return new Cs(this)},Fs.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},Fs.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},Fs.equals=function(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},Fs.set=function(t,n,e,r){return e<t?(this.x2=t,this.x1=e):(this.x1=t,this.x2=e),r<n?(this.y2=n,this.y1=r):(this.y1=n,this.y2=r),this},Fs.add=function(t,n){return t<this.x1&&(this.x1=t),n<this.y1&&(this.y1=n),t>this.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},Fs.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},Fs.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},Fs.translate=function(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},Fs.rotate=function(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},Fs.rotatedPoints=function(t,n,e){var{x1:r,y1:i,x2:a,y2:u}=this,o=Math.cos(t),s=Math.sin(t),l=n-n*o+e*s,c=e-n*s-e*o;return[o*r-s*i+l,s*r+o*i+c,o*r-s*u+l,s*r+o*u+c,o*a-s*i+l,s*a+o*i+c,o*a-s*u+l,s*a+o*u+c]},Fs.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},Fs.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},Fs.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},Fs.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},Fs.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},Fs.contains=function(t,n){return!(t<this.x1||t>this.x2||n<this.y1||n>this.y2)},Fs.width=function(){return this.x2-this.x1},Fs.height=function(){return this.y2-this.y1};var Ss=0;const Bs="p_";function Ts(t){return t&&t.gradient}function zs(t,n,e){let r=t.id,i=t.gradient,a="radial"===i?Bs:"";return r||(r=t.id="gradient_"+Ss++,"radial"===i?(t.x1=Ns(t.x1,.5),t.y1=Ns(t.y1,.5),t.r1=Ns(t.r1,0),t.x2=Ns(t.x2,.5),t.y2=Ns(t.y2,.5),t.r2=Ns(t.r2,.5),a=Bs):(t.x1=Ns(t.x1,0),t.y1=Ns(t.y1,0),t.x2=Ns(t.x2,1),t.y2=Ns(t.y2,0))),n[r]=t,"url("+(e||"")+"#"+a+r+")"}function Ns(t,n){return null!=t?t:n}function Os(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(t,n){return r.push({offset:t,color:n}),e}}}function Rs(t){this.mark=t,this.bounds=this.bounds||new Cs}function qs(t){Rs.call(this,t),this.items=this.items||[]}function Ls(t,n){if("undefined"!=typeof document&&document.createElement){var e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}function Us(){return"undefined"!=typeof Image?Image:null}function $s(t){this._pending=0,this._loader=t||Tr()}ot(qs,Rs);var Ps=$s.prototype;function js(t){t._pending+=1}function Is(t){t._pending-=1}Ps.pending=function(){return this._pending},Ps.sanitizeURL=function(t){var n=this;return js(n),n._loader.sanitize(t,{context:"href"}).then((function(t){return Is(n),t})).catch((function(){return Is(n),null}))},Ps.loadImage=function(t){var n=this,e=Us();return js(n),n._loader.sanitize(t,{context:"image"}).then((function(t){var r=t.href;if(!r||!e)throw{url:r};var i=new e;return i.onload=function(){Is(n)},i.onerror=function(){Is(n)},i.src=r,i})).catch((function(t){return Is(n),{complete:!1,width:0,height:0,src:t&&t.url||""}}))},Ps.ready=function(){var t=this;return new Promise((function(n){!function e(r){t.pending()?setTimeout((function(){e(!0)}),10):n(r)}(!1)}))};var Hs=Math.PI,Ws=2*Hs,Ys=Ws-1e-6;function Vs(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Gs(){return new Vs}function Xs(t){return function(){return t}}Vs.prototype=Gs.prototype={constructor:Vs,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,a){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var a=this._x1,u=this._y1,o=e-t,s=r-n,l=a-t,c=u-n,f=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(f>1e-6)if(Math.abs(c*o-s*l)>1e-6&&i){var h=e-a,d=r-u,p=o*o+s*s,g=h*h+d*d,m=Math.sqrt(p),v=Math.sqrt(f),y=i*Math.tan((Hs-Math.acos((p+f-g)/(2*m*v)))/2),_=y/v,x=y/m;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(n+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*o)+","+(this._y1=n+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,a){t=+t,n=+n,a=!!a;var u=(e=+e)*Math.cos(r),o=e*Math.sin(r),s=t+u,l=n+o,c=1^a,f=a?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),e&&(f<0&&(f=f%Ws+Ws),f>Ys?this._+="A"+e+","+e+",0,1,"+c+","+(t-u)+","+(n-o)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+e+","+e+",0,"+ +(f>=Hs)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Js=Math.abs,Zs=Math.atan2,Qs=Math.cos,Ks=Math.max,tl=Math.min,nl=Math.sin,el=Math.sqrt,rl=1e-12,il=Math.PI,al=il/2,ul=2*il;function ol(t){return t>=1?al:t<=-1?-al:Math.asin(t)}function sl(t){return t.innerRadius}function ll(t){return t.outerRadius}function cl(t){return t.startAngle}function fl(t){return t.endAngle}function hl(t){return t&&t.padAngle}function dl(t,n,e,r,i,a,u){var o=t-e,s=n-r,l=(u?a:-a)/el(o*o+s*s),c=l*s,f=-l*o,h=t+c,d=n+f,p=e+c,g=r+f,m=(h+p)/2,v=(d+g)/2,y=p-h,_=g-d,x=y*y+_*_,b=i-a,w=h*g-p*d,A=(_<0?-1:1)*el(Ks(0,b*b*x-w*w)),k=(w*_-y*A)/x,M=(-w*y-_*A)/x,E=(w*_+y*A)/x,D=(-w*y+_*A)/x,C=k-m,F=M-v,S=E-m,B=D-v;return C*C+F*F>S*S+B*B&&(k=E,M=D),{cx:k,cy:M,x01:-c,y01:-f,x11:k*(i/b-1),y11:M*(i/b-1)}}function pl(t){this._context=t}function gl(t){return new pl(t)}function ml(t){return t[0]}function vl(t){return t[1]}function yl(){var t=ml,n=vl,e=Xs(!0),r=null,i=gl,a=null;function u(u){var o,s,l,c=u.length,f=!1;for(null==r&&(a=i(l=Gs())),o=0;o<=c;++o)!(o<c&&e(s=u[o],o,u))===f&&((f=!f)?a.lineStart():a.lineEnd()),f&&a.point(+t(s,o,u),+n(s,o,u));if(l)return a=null,l+""||null}return u.x=function(n){return arguments.length?(t="function"==typeof n?n:Xs(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:Xs(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:Xs(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(a=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=a=null:a=i(r=t),u):r},u}function _l(){var t=ml,n=null,e=Xs(0),r=vl,i=Xs(!0),a=null,u=gl,o=null;function s(s){var l,c,f,h,d,p=s.length,g=!1,m=new Array(p),v=new Array(p);for(null==a&&(o=u(d=Gs())),l=0;l<=p;++l){if(!(l<p&&i(h=s[l],l,s))===g)if(g=!g)c=l,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),f=l-1;f>=c;--f)o.point(m[f],v[f]);o.lineEnd(),o.areaEnd()}g&&(m[l]=+t(h,l,s),v[l]=+e(h,l,s),o.point(n?+n(h,l,s):m[l],r?+r(h,l,s):v[l]))}if(d)return o=null,d+""||null}function l(){return yl().defined(i).curve(u).context(a)}return s.x=function(e){return arguments.length?(t="function"==typeof e?e:Xs(+e),n=null,s):t},s.x0=function(n){return arguments.length?(t="function"==typeof n?n:Xs(+n),s):t},s.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Xs(+t),s):n},s.y=function(t){return arguments.length?(e="function"==typeof t?t:Xs(+t),r=null,s):e},s.y0=function(t){return arguments.length?(e="function"==typeof t?t:Xs(+t),s):e},s.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Xs(+t),s):r},s.lineX0=s.lineY0=function(){return l().x(t).y(e)},s.lineY1=function(){return l().x(t).y(r)},s.lineX1=function(){return l().x(n).y(e)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:Xs(!!t),s):i},s.curve=function(t){return arguments.length?(u=t,null!=a&&(o=u(a)),s):u},s.context=function(t){return arguments.length?(null==t?a=o=null:o=u(a=t),s):a},s}pl.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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var xl={draw:function(t,n){var e=Math.sqrt(n/il);t.moveTo(e,0),t.arc(0,0,e,0,ul)}};function bl(){}function wl(t,n,e){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+n)/6,(t._y0+4*t._y1+e)/6)}function Al(t){this._context=t}function kl(t){this._context=t}function Ml(t){this._context=t}function El(t,n){this._basis=new Al(t),this._beta=n}Al.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:wl(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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);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:wl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},kl.prototype={areaStart:bl,areaEnd:bl,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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:wl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Ml.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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:wl(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},El.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],a=n[0],u=t[e]-i,o=n[e]-a,s=-1;++s<=e;)r=s/e,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*u),this._beta*n[s]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Dl=function t(n){function e(t){return 1===n?new Al(t):new El(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function Cl(t,n,e){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-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Fl(t,n){this._context=t,this._k=(1-n)/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(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Cl(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:Cl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Sl=function t(n){function e(t){return new Fl(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Bl(t,n){this._context=t,this._k=(1-n)/6}Bl.prototype={areaStart:bl,areaEnd:bl,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,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Cl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Tl=function t(n){function e(t){return new Bl(t,n)}return e.tension=function(n){return t(+n)},e}(0);function zl(t,n){this._context=t,this._k=(1-n)/6}zl.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,n){switch(t=+t,n=+n,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:Cl(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Nl=function t(n){function e(t){return new zl(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Ol(t,n,e){var r=t._x1,i=t._y1,a=t._x2,u=t._y2;if(t._l01_a>rl){var o=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*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>rl){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);a=(a*l+t._x1*t._l23_2a-n*t._l12_2a)/c,u=(u*l+t._y1*t._l23_2a-e*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,u,t._x2,t._y2)}function Rl(t,n){this._context=t,this._alpha=n}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(){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,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Ol(this,t,n)}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=n}};var ql=function t(n){function e(t){return n?new Rl(t,n):new Fl(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Ll(t,n){this._context=t,this._alpha=n}Ll.prototype={areaStart:bl,areaEnd:bl,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,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Ol(this,t,n)}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=n}};var Ul=function t(n){function e(t){return n?new Ll(t,n):new Bl(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function $l(t,n){this._context=t,this._alpha=n}$l.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,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+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:Ol(this,t,n)}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=n}};var Pl=function t(n){function e(t){return n?new $l(t,n):new zl(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function jl(t){this._context=t}function Il(t){return t<0?-1:1}function Hl(t,n,e){var r=t._x1-t._x0,i=n-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),o=(a*i+u*r)/(r+i);return(Il(a)+Il(u))*Math.min(Math.abs(a),Math.abs(u),.5*Math.abs(o))||0}function Wl(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function Yl(t,n,e){var r=t._x0,i=t._y0,a=t._x1,u=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*n,a-o,u-o*e,a,u)}function Vl(t){this._context=t}function Gl(t){this._context=new Xl(t)}function Xl(t){this._context=t}function Jl(t){this._context=t}function Zl(t){var n,e,r=t.length-1,i=new Array(r),a=new Array(r),u=new Array(r);for(i[0]=0,a[0]=2,u[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,a[n]=4,u[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,a[r-1]=7,u[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/a[n-1],a[n]-=e,u[n]-=e*u[n-1];for(i[r-1]=u[r-1]/a[r-1],n=r-2;n>=0;--n)i[n]=(u[n]-i[n+1])/a[n];for(a[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)a[n]=2*t[n+1]-i[n+1];return[i,a]}function Ql(t,n){this._context=t,this._t=n}jl.prototype={areaStart:bl,areaEnd:bl,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},Vl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Yl(this,this._t0,Wl(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,Yl(this,Wl(this,e=Hl(this,t,n)),e);break;default:Yl(this,this._t0,e=Hl(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Gl.prototype=Object.create(Vl.prototype)).point=function(t,n){Vl.prototype.point.call(this,n,t)},Xl.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,a){this._context.bezierCurveTo(n,t,r,e,a,i)}},Jl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=Zl(t),i=Zl(n),a=0,u=1;u<e;++a,++u)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[u],n[u]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},Ql.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};var Kl={basis:{curve:function(t){return new Al(t)}},"basis-closed":{curve:function(t){return new kl(t)}},"basis-open":{curve:function(t){return new Ml(t)}},bundle:{curve:Dl,tension:"beta",value:.85},cardinal:{curve:Sl,tension:"tension",value:0},"cardinal-open":{curve:Nl,tension:"tension",value:0},"cardinal-closed":{curve:Tl,tension:"tension",value:0},"catmull-rom":{curve:ql,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Ul,tension:"alpha",value:.5},"catmull-rom-open":{curve:Pl,tension:"alpha",value:.5},linear:{curve:gl},"linear-closed":{curve:function(t){return new jl(t)}},monotone:{horizontal:function(t){return new Gl(t)},vertical:function(t){return new Vl(t)}},natural:{curve:function(t){return new Jl(t)}},step:{curve:function(t){return new Ql(t,.5)}},"step-after":{curve:function(t){return new Ql(t,1)}},"step-before":{curve:function(t){return new Ql(t,0)}}};function tc(t,n,e){var r=rt(Kl,t)&&Kl[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}var nc={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},ec=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function rc(t){var n,e,r,i,a,u,o,s,l,c,f,h=[];for(s=0,c=(n=t.slice().replace(ec[0],"###$1").split(ec[1]).slice(1)).length;s<c;++s){for(r=(e=n[s]).slice(1).trim().replace(ec[2],"$1###$2").split(ec[3]),i=[u=e.charAt(0)],l=0,f=r.length;l<f;++l)(a=+r[l])===a&&i.push(a);if(o=nc[u.toLowerCase()],i.length-1>o)for(l=1,f=i.length;l<f;l+=o)h.push([u].concat(i.slice(l,l+o)));else h.push(i)}return h}const ic=Math.PI/180,ac=1e-14,uc=Math.PI/2,oc=2*Math.PI,sc=Math.sqrt(3)/2;var lc={},cc={},fc=[].join;function hc(t){var n=fc.call(t);if(cc[n])return cc[n];var e=t[0],r=t[1],i=t[2],a=t[3],u=t[4],o=t[5],s=t[6],l=t[7],c=l*u,f=-s*o,h=s*u,d=l*o,p=Math.cos(i),g=Math.sin(i),m=Math.cos(a),v=Math.sin(a),y=.5*(a-i),_=Math.sin(.5*y),x=8/3*_*_/Math.sin(y),b=e+p-x*g,w=r+g+x*p,A=e+m,k=r+v,M=A+x*v,E=k-x*m;return cc[n]=[c*b+f*w,h*b+d*w,c*M+f*E,h*M+d*E,c*A+f*k,h*A+d*k]}var dc=["l",0,0,0,0,0,0,0];function pc(t,n,e){var r=dc[0]=t[0];if("a"===r||"A"===r)dc[1]=n*t[1],dc[2]=e*t[2],dc[3]=t[3],dc[4]=t[4],dc[5]=t[5],dc[6]=n*t[6],dc[7]=e*t[7];else if("h"===r||"H"===r)dc[1]=n*t[1];else if("v"===r||"V"===r)dc[1]=e*t[1];else for(var i=1,a=t.length;i<a;++i)dc[i]=(i%2==1?n:e)*t[i];return dc}function gc(t,n,e,r,i,a){var u,o,s,l,c,f=null,h=0,d=0,p=0,g=0;null==e&&(e=0),null==r&&(r=0),null==i&&(i=1),null==a&&(a=i),t.beginPath&&t.beginPath();for(var m=0,v=n.length;m<v;++m){switch(u=n[m],1===i&&1===a||(u=pc(u,i,a)),u[0]){case"l":h+=u[1],d+=u[2],t.lineTo(h+e,d+r);break;case"L":h=u[1],d=u[2],t.lineTo(h+e,d+r);break;case"h":h+=u[1],t.lineTo(h+e,d+r);break;case"H":h=u[1],t.lineTo(h+e,d+r);break;case"v":d+=u[1],t.lineTo(h+e,d+r);break;case"V":d=u[1],t.lineTo(h+e,d+r);break;case"m":h+=u[1],d+=u[2],t.moveTo(h+e,d+r);break;case"M":h=u[1],d=u[2],t.moveTo(h+e,d+r);break;case"c":o=h+u[5],s=d+u[6],p=h+u[3],g=d+u[4],t.bezierCurveTo(h+u[1]+e,d+u[2]+r,p+e,g+r,o+e,s+r),h=o,d=s;break;case"C":h=u[5],d=u[6],p=u[3],g=u[4],t.bezierCurveTo(u[1]+e,u[2]+r,p+e,g+r,h+e,d+r);break;case"s":o=h+u[3],s=d+u[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+e,g+r,h+u[1]+e,d+u[2]+r,o+e,s+r),p=h+u[1],g=d+u[2],h=o,d=s;break;case"S":o=u[3],s=u[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+e,g+r,u[1]+e,u[2]+r,o+e,s+r),h=o,d=s,p=u[1],g=u[2];break;case"q":o=h+u[3],s=d+u[4],p=h+u[1],g=d+u[2],t.quadraticCurveTo(p+e,g+r,o+e,s+r),h=o,d=s;break;case"Q":o=u[3],s=u[4],t.quadraticCurveTo(u[1]+e,u[2]+r,o+e,s+r),h=o,d=s,p=u[1],g=u[2];break;case"t":o=h+u[1],s=d+u[2],null===f[0].match(/[QqTt]/)?(p=h,g=d):"t"===f[0]?(p=2*h-l,g=2*d-c):"q"===f[0]&&(p=2*h-p,g=2*d-g),l=p,c=g,t.quadraticCurveTo(p+e,g+r,o+e,s+r),d=s,p=(h=o)+u[1],g=d+u[2];break;case"T":o=u[1],s=u[2],p=2*h-p,g=2*d-g,t.quadraticCurveTo(p+e,g+r,o+e,s+r),h=o,d=s;break;case"a":mc(t,h+e,d+r,[u[1],u[2],u[3],u[4],u[5],u[6]+h+e,u[7]+d+r]),h+=u[6],d+=u[7];break;case"A":mc(t,h+e,d+r,[u[1],u[2],u[3],u[4],u[5],u[6]+e,u[7]+r]),h=u[6],d=u[7];break;case"z":case"Z":t.closePath()}f=u}}function mc(t,n,e,r){for(var i=function(t,n,e,r,i,a,u,o,s){var l=fc.call(arguments);if(lc[l])return lc[l];var c=u*ic,f=Math.sin(c),h=Math.cos(c),d=h*(o-t)*.5+f*(s-n)*.5,p=h*(s-n)*.5-f*(o-t)*.5,g=d*d/((e=Math.abs(e))*e)+p*p/((r=Math.abs(r))*r);g>1&&(e*=g=Math.sqrt(g),r*=g);var m=h/e,v=f/e,y=-f/r,_=h/r,x=m*o+v*s,b=y*o+_*s,w=m*t+v*n,A=y*t+_*n,k=1/((w-x)*(w-x)+(A-b)*(A-b))-.25;k<0&&(k=0);var M=Math.sqrt(k);a==i&&(M=-M);var E=.5*(x+w)-M*(A-b),D=.5*(b+A)+M*(w-x),C=Math.atan2(b-D,x-E),F=Math.atan2(A-D,w-E)-C;F<0&&1===a?F+=oc:F>0&&0===a&&(F-=oc);for(var S=Math.ceil(Math.abs(F/(uc+.001))),B=[],T=0;T<S;++T){var z=C+T*F/S,N=C+(T+1)*F/S;B[T]=[E,D,z,N,e,r,f,h]}return lc[l]=B}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],n,e),a=0;a<i.length;++a){var u=hc(i[a]);t.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5])}}var vc={circle:{draw:function(t,n){var e=Math.sqrt(n)/2;t.moveTo(e,0),t.arc(0,0,e,0,oc)}},cross:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/2.5;t.moveTo(-e,-r),t.lineTo(-e,r),t.lineTo(-r,r),t.lineTo(-r,e),t.lineTo(r,e),t.lineTo(r,r),t.lineTo(e,r),t.lineTo(e,-r),t.lineTo(r,-r),t.lineTo(r,-e),t.lineTo(-r,-e),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,n){var e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.closePath()}},square:{draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},arrow:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/7,i=e/2.5,a=e/8;t.moveTo(-r,e),t.lineTo(r,e),t.lineTo(r,-a),t.lineTo(i,-a),t.lineTo(0,-e),t.lineTo(-i,-a),t.lineTo(-r,-a),t.closePath()}},wedge:{draw:function(t,n){var e=Math.sqrt(n)/2,r=sc*e,i=r-.5773502691896257*e,a=e/4;t.moveTo(0,-r-i),t.lineTo(-a,r-i),t.lineTo(a,r-i),t.closePath()}},triangle:{draw:function(t,n){var e=Math.sqrt(n)/2,r=sc*e,i=r-.5773502691896257*e;t.moveTo(0,-r-i),t.lineTo(-e,r-i),t.lineTo(e,r-i),t.closePath()}},"triangle-up":{draw:function(t,n){var e=Math.sqrt(n)/2,r=sc*e;t.moveTo(0,-r),t.lineTo(-e,r),t.lineTo(e,r),t.closePath()}},"triangle-down":{draw:function(t,n){var e=Math.sqrt(n)/2,r=sc*e;t.moveTo(0,r),t.lineTo(-e,-r),t.lineTo(e,-r),t.closePath()}},"triangle-right":{draw:function(t,n){var e=Math.sqrt(n)/2,r=sc*e;t.moveTo(r,0),t.lineTo(-r,-e),t.lineTo(-r,e),t.closePath()}},"triangle-left":{draw:function(t,n){var e=Math.sqrt(n)/2,r=sc*e;t.moveTo(-r,0),t.lineTo(r,-e),t.lineTo(r,e),t.closePath()}},stroke:{draw:function(t,n){var e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(e,0)}}};function yc(t){return rt(vc,t)?vc[t]:function(t){if(!rt(_c,t)){var n=rc(t);_c[t]={draw:function(t,e){gc(t,n,0,0,Math.sqrt(e)/2)}}}return _c[t]}(t)}var _c={};const xc=.448084975506;function bc(t){return t.x}function wc(t){return t.y}function Ac(t){return t.width}function kc(t){return t.height}function Mc(t){return"function"==typeof t?t:()=>+t}function Ec(t,n,e){return Math.max(n,Math.min(t,e))}function Dc(){var t=bc,n=wc,e=Ac,r=kc,i=Mc(0),a=i,u=i,o=i,s=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+n.call(this,l),g=+e.call(this,l),m=+r.call(this,l),v=Math.min(g,m)/2,y=Ec(+i.call(this,l),0,v),_=Ec(+a.call(this,l),0,v),x=Ec(+u.call(this,l),0,v),b=Ec(+o.call(this,l),0,v);if(s||(s=h=Gs()),y<=0&&_<=0&&x<=0&&b<=0)s.rect(d,p,g,m);else{var w=d+g,A=p+m;s.moveTo(d+y,p),s.lineTo(w-_,p),s.bezierCurveTo(w-xc*_,p,w,p+xc*_,w,p+_),s.lineTo(w,A-b),s.bezierCurveTo(w,A-xc*b,w-xc*b,A,w-b,A),s.lineTo(d+x,A),s.bezierCurveTo(d+xc*x,A,d,A-xc*x,d,A-x),s.lineTo(d,p+y),s.bezierCurveTo(d,p+xc*y,d+xc*y,p,d+y,p),s.closePath()}if(h)return s=null,h+""||null}return l.x=function(n){return arguments.length?(t=Mc(n),l):t},l.y=function(t){return arguments.length?(n=Mc(t),l):n},l.width=function(t){return arguments.length?(e=Mc(t),l):e},l.height=function(t){return arguments.length?(r=Mc(t),l):r},l.cornerRadius=function(t,n,e,r){return arguments.length?(i=Mc(t),a=null!=n?Mc(n):i,o=null!=e?Mc(e):i,u=null!=r?Mc(r):a,l):i},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Cc(){var t,n,e,r,i,a,u,o,s=null;function l(t,n,e){var r=e/2;if(i){var l=u-n,c=t-a;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*o,d=(c/=f)*o,p=Math.atan2(c,l);s.moveTo(a-h,u-d),s.lineTo(t-l*r,n-c*r),s.arc(t,n,r,p-Math.PI,p),s.lineTo(a+h,u+d),s.arc(a,u,o,p,p+Math.PI)}else s.arc(t,n,r,0,oc);s.closePath()}else i=1;a=t,u=n,o=r}function c(a){var u,o,c,f=a.length,h=!1;for(null==s&&(s=c=Gs()),u=0;u<=f;++u)!(u<f&&r(o=a[u],u,a))===h&&(h=!h)&&(i=0),h&&l(+t(o,u,a),+n(o,u,a),+e(o,u,a));if(c)return s=null,c+""||null}return c.x=function(n){return arguments.length?(t=n,c):t},c.y=function(t){return arguments.length?(n=t,c):n},c.size=function(t){return arguments.length?(e=t,c):e},c.defined=function(t){return arguments.length?(r=t,c):r},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function Fc(t,n){return null!=t?t:n}const Sc=t=>t.x||0,Bc=t=>t.y||0,Tc=t=>!(!1===t.defined),zc=function(){var t=sl,n=ll,e=Xs(0),r=null,i=cl,a=fl,u=hl,o=null;function s(){var s,l,c=+t.apply(this,arguments),f=+n.apply(this,arguments),h=i.apply(this,arguments)-al,d=a.apply(this,arguments)-al,p=Js(d-h),g=d>h;if(o||(o=s=Gs()),f<c&&(l=f,f=c,c=l),f>rl)if(p>ul-rl)o.moveTo(f*Qs(h),f*nl(h)),o.arc(0,0,f,h,d,!g),c>rl&&(o.moveTo(c*Qs(d),c*nl(d)),o.arc(0,0,c,d,h,g));else{var m,v,y=h,_=d,x=h,b=d,w=p,A=p,k=u.apply(this,arguments)/2,M=k>rl&&(r?+r.apply(this,arguments):el(c*c+f*f)),E=tl(Js(f-c)/2,+e.apply(this,arguments)),D=E,C=E;if(M>rl){var F=ol(M/c*nl(k)),S=ol(M/f*nl(k));(w-=2*F)>rl?(x+=F*=g?1:-1,b-=F):(w=0,x=b=(h+d)/2),(A-=2*S)>rl?(y+=S*=g?1:-1,_-=S):(A=0,y=_=(h+d)/2)}var B=f*Qs(y),T=f*nl(y),z=c*Qs(b),N=c*nl(b);if(E>rl){var O,R=f*Qs(_),q=f*nl(_),L=c*Qs(x),U=c*nl(x);if(p<il&&(O=function(t,n,e,r,i,a,u,o){var s=e-t,l=r-n,c=u-i,f=o-a,h=f*s-c*l;if(!(h*h<rl))return[t+(h=(c*(n-a)-f*(t-i))/h)*s,n+h*l]}(B,T,L,U,R,q,z,N))){var $=B-O[0],P=T-O[1],j=R-O[0],I=q-O[1],H=1/nl(function(t){return t>1?0:t<-1?il:Math.acos(t)}(($*j+P*I)/(el($*$+P*P)*el(j*j+I*I)))/2),W=el(O[0]*O[0]+O[1]*O[1]);D=tl(E,(c-W)/(H-1)),C=tl(E,(f-W)/(H+1))}}A>rl?C>rl?(m=dl(L,U,B,T,f,C,g),v=dl(R,q,z,N,f,C,g),o.moveTo(m.cx+m.x01,m.cy+m.y01),C<E?o.arc(m.cx,m.cy,C,Zs(m.y01,m.x01),Zs(v.y01,v.x01),!g):(o.arc(m.cx,m.cy,C,Zs(m.y01,m.x01),Zs(m.y11,m.x11),!g),o.arc(0,0,f,Zs(m.cy+m.y11,m.cx+m.x11),Zs(v.cy+v.y11,v.cx+v.x11),!g),o.arc(v.cx,v.cy,C,Zs(v.y11,v.x11),Zs(v.y01,v.x01),!g))):(o.moveTo(B,T),o.arc(0,0,f,y,_,!g)):o.moveTo(B,T),c>rl&&w>rl?D>rl?(m=dl(z,N,R,q,c,-D,g),v=dl(B,T,L,U,c,-D,g),o.lineTo(m.cx+m.x01,m.cy+m.y01),D<E?o.arc(m.cx,m.cy,D,Zs(m.y01,m.x01),Zs(v.y01,v.x01),!g):(o.arc(m.cx,m.cy,D,Zs(m.y01,m.x01),Zs(m.y11,m.x11),!g),o.arc(0,0,c,Zs(m.cy+m.y11,m.cx+m.x11),Zs(v.cy+v.y11,v.cx+v.x11),g),o.arc(v.cx,v.cy,D,Zs(v.y11,v.x11),Zs(v.y01,v.x01),!g))):o.arc(0,0,c,b,x,g):o.lineTo(z,N)}else o.moveTo(0,0);if(o.closePath(),s)return o=null,s+""||null}return s.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-il/2;return[Qs(r)*e,nl(r)*e]},s.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:Xs(+n),s):t},s.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Xs(+t),s):n},s.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Xs(+t),s):e},s.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Xs(+t),s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Xs(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Xs(+t),s):a},s.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:Xs(+t),s):u},s.context=function(t){return arguments.length?(o=null==t?null:t,s):o},s}().startAngle(t=>t.startAngle||0).endAngle(t=>t.endAngle||0).padAngle(t=>t.padAngle||0).innerRadius(t=>t.innerRadius||0).outerRadius(t=>t.outerRadius||0).cornerRadius(t=>t.cornerRadius||0),Nc=_l().x(Sc).y1(Bc).y0(t=>(t.y||0)+(t.height||0)).defined(Tc),Oc=_l().y(Bc).x1(Sc).x0(t=>(t.x||0)+(t.width||0)).defined(Tc),Rc=yl().x(Sc).y(Bc).defined(Tc),qc=Dc().x(Sc).y(Bc).width(t=>t.width||0).height(t=>t.height||0).cornerRadius(t=>Fc(t.cornerRadiusTopLeft,t.cornerRadius)||0,t=>Fc(t.cornerRadiusTopRight,t.cornerRadius)||0,t=>Fc(t.cornerRadiusBottomRight,t.cornerRadius)||0,t=>Fc(t.cornerRadiusBottomLeft,t.cornerRadius)||0),Lc=function(){var t=Xs(xl),n=Xs(64),e=null;function r(){var r;if(e||(e=r=Gs()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"==typeof n?n:Xs(n),r):t},r.size=function(t){return arguments.length?(n="function"==typeof t?t:Xs(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r}().type(t=>yc(t.shape||"circle")).size(t=>Fc(t.size,64)),Uc=Cc().x(Sc).y(Bc).defined(Tc).size(t=>t.size||1);function $c(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Pc(t,n,e,r){return qc.context(t)(n,e,r)}function jc(t,n,e){if(n.stroke&&0!==n.opacity&&0!==n.strokeOpacity){const r=null!=n.strokeWidth?+n.strokeWidth:1;t.expand(r+(e?function(t,n){return t.strokeJoin&&"miter"!==t.strokeJoin?0:n}(n,r):0))}return t}var Ic,Hc,Wc,Yc=oc-1e-8;function Vc(t){return Ic=t,Vc}function Gc(){}function Xc(t,n){Ic.add(t,n)}function Jc(t,n){Xc(Hc=t,Wc=n)}function Zc(t){Xc(t,Ic.y1)}function Qc(t){Xc(Ic.x1,t)}function Kc(t,n,e,r){const i=(t-n)/(t+e-2*n);0<i&&i<1&&r(t+(n-t)*i)}function tf(t,n,e,r,i){const a=r-t+3*n-3*e,u=t+e-2*n,o=t-n;let s,l=0,c=0;Math.abs(a)>ac?(s=u*u+o*a,s>=0&&(s=Math.sqrt(s),l=(-u+s)/a,c=(-u-s)/a)):l=.5*o/u,0<l&&l<1&&i(nf(l,t,n,e,r)),0<c&&c<1&&i(nf(c,t,n,e,r))}function nf(t,n,e,r,i){const a=1-t,u=a*a,o=t*t;return u*a*n+3*u*t*e+3*a*o*r+o*t*i}Vc.beginPath=Gc,Vc.closePath=Gc,Vc.moveTo=Jc,Vc.lineTo=Jc,Vc.rect=function(t,n,e,r){Xc(t+e,n+r),Jc(t,n)},Vc.quadraticCurveTo=function(t,n,e,r){Kc(Hc,t,e,Zc),Kc(Wc,n,r,Qc),Jc(e,r)},Vc.bezierCurveTo=function(t,n,e,r,i,a){tf(Hc,t,e,i,Zc),tf(Wc,n,r,a,Qc),Jc(i,a)},Vc.arc=function(t,n,e,r,i,a){if(Hc=e*Math.cos(i)+t,Wc=e*Math.sin(i)+n,Math.abs(i-r)>Yc)Xc(t-e,n-e),Xc(t+e,n+e);else{const u=r=>Xc(e*Math.cos(r)+t,e*Math.sin(r)+n);let o,s;if(u(r),u(i),i!==r)if((r%=oc)<0&&(r+=oc),(i%=oc)<0&&(i+=oc),i<r&&(a=!a,o=r,r=i,i=o),a)for(i-=oc,o=r-r%uc,s=0;s<4&&o>i;++s,o-=uc)u(o);else for(o=r-r%uc+uc,s=0;s<4&&o<i;++s,o+=uc)u(o)}};var ef=(ef=Ls(1,1))?ef.getContext("2d"):null;const rf=new Cs;function af(t){return function(n,e){if(!ef)return!0;t(ef,n),rf.clear().union(n.bounds).intersect(e).round();const{x1:r,y1:i,x2:a,y2:u}=rf;for(let t=i;t<=u;++t)for(let n=r;n<=a;++n)if(ef.isPointInPath(n,t))return!0;return!1}}function uf(t,n){return n.contains(t.x||0,t.y||0)}function of(t,n){const e=t.x||0,r=t.y||0,i=t.width||0,a=t.height||0;return n.intersects(rf.set(e,r,e+i,r+a))}function sf(t,n){const e=t.x||0,r=t.y||0;return lf(n,e,r,null!=t.x2?t.x2:e,null!=t.y2?t.y2:r)}function lf(t,n,e,r,i){const{x1:a,y1:u,x2:o,y2:s}=t,l=r-n,c=i-e;let f,h,d,p,g=0,m=1;for(p=0;p<4;++p){if(0===p&&(f=-l,h=-(a-n)),1===p&&(f=l,h=o-n),2===p&&(f=-c,h=-(u-e)),3===p&&(f=c,h=s-e),Math.abs(f)<1e-10&&h<0)return!1;if(d=h/f,f<0){if(d>m)return!1;d>g&&(g=d)}else if(f>0){if(d<g)return!1;d<m&&(m=d)}}return!0}function cf(t,n){return null==t?n:t}function ff(t,n,e){return Ts(e)?function(t,n,e){const r=e.width(),i=e.height(),a=n.stops,u=a.length,o="radial"===n.gradient?t.createRadialGradient(e.x1+cf(n.x1,.5)*r,e.y1+cf(n.y1,.5)*i,Math.max(r,i)*cf(n.r1,0),e.x1+cf(n.x2,.5)*r,e.y1+cf(n.y2,.5)*i,Math.max(r,i)*cf(n.r2,.5)):t.createLinearGradient(e.x1+cf(n.x1,0)*r,e.y1+cf(n.y1,0)*i,e.x1+cf(n.x2,1)*r,e.y1+cf(n.y2,0)*i);for(let t=0;t<u;++t)o.addColorStop(a[t].offset,a[t].color);return o}(t,e,n.bounds):e}function hf(t,n,e){return(e*=null==n.fillOpacity?1:n.fillOpacity)>0&&(t.globalAlpha=e,t.fillStyle=ff(t,n,n.fill),!0)}var df=[];function pf(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&((e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=ff(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||df),t.lineDashOffset=n.strokeDashOffset||0),!0))}function gf(t,n){return t.zindex-n.zindex||t.index-n.index}function mf(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,a=[];for(e=0,r=i.length;e<r;++e)(n=i[e]).index=e,n.zindex&&a.push(n);return t.zdirty=!1,t.zitems=a.sort(gf)}function vf(t,n){var e,r,i=t.items;if(i&&i.length){var a=mf(t);if(a&&a.length){for(e=0,r=i.length;e<r;++e)i[e].zindex||n(i[e]);i=a}for(e=0,r=i.length;e<r;++e)n(i[e])}}function yf(t,n){var e,r,i=t.items;if(!i||!i.length)return null;var a=mf(t);for(a&&a.length&&(i=a),r=i.length;--r>=0;)if(e=n(i[r]))return e;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function _f(t){return function(n,e,r){vf(e,(function(e){r&&!r.intersects(e.bounds)||bf(t,n,e,e)}))}}function xf(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||bf(t,n,e.items[0],e.items)}}function bf(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||(e.fill&&hf(n,e,i)&&n.fill(),e.stroke&&pf(n,e,i)&&n.stroke()))}function wf(t){return t=t||m,function(n,e,r,i,a,u){return r*=n.pixelRatio,i*=n.pixelRatio,yf(e,(function(e){var o=e.bounds;if((!o||o.contains(a,u))&&o)return t(n,e,r,i,a,u)?e:void 0}))}}function Af(t,n){return function(e,r,i,a){var u,o,s=Array.isArray(r)?r[0]:r,l=null==n?s.fill:n,c=s.stroke&&e.isPointInStroke;return c&&(u=s.strokeWidth,o=s.strokeCap,e.lineWidth=null!=u?u:1,e.lineCap=null!=o?o:"butt"),!t(e,r)&&(l&&e.isPointInPath(i,a)||c&&e.isPointInStroke(i,a))}}function kf(t){return wf(Af(t))}function Mf(t,n){return"translate("+t+","+n+")"}function Ef(t){return"rotate("+t+")"}function Df(t){return Mf(t.x||0,t.y||0)}function Cf(t){return Mf(t.x||0,t.y||0)+(t.angle?" "+Ef(t.angle):"")+(t.scaleX||t.scaleY?" "+(n=t.scaleX||1,e=t.scaleY||1,"scale("+n+","+e+")"):"");var n,e}function Ff(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,a=e.angle||0;t.translate(r,i),a&&t.rotate(a*=ic),t.beginPath(),n(t,e),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",Cf(e)),t("d",n(null,e))},bound:function(t,e){var r=e.x||0,i=e.y||0;return n(Vc(t),e),jc(t,e).translate(r,i),e.angle&&t.rotate(e.angle*ic,r,i),t},draw:_f(r),pick:kf(r),isect:e||af(r)}}var Sf=Ff("arc",(function(t,n){return zc.context(t)(n)}));function Bf(t,n,e){function r(t,e){t.beginPath(),n(t,e)}var i=Af(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(Vc(t),r),jc(t,r[0]))},draw:xf(r),pick:function(t,n,e,r,a,u){var o=n.items,s=n.bounds;return!o||!o.length||s&&!s.contains(a,u)?null:(e*=t.pixelRatio,r*=t.pixelRatio,i(t,o,e,r)?o[0]:null)},isect:uf,tip:e}}var Tf=Bf("area",(function(t,n){var e=n[0],r=e.interpolate||"linear";return("horizontal"===e.orient?Oc:Nc).curve(tc(r,e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],a="horizontal"===t[0].orient?"y":"x",u=t.length,o=1/0;--u>=0;)!1!==t[u].defined&&(r=Math.abs(t[u][a]-i))<o&&(o=r,e=t[u]);return e}));function zf(t,n){t.beginPath(),$c(n)?Pc(t,n,0,0):t.rect(0,0,n.width||0,n.height||0),t.clip()}var Nf=1;function Of(t,n,e){var r=n.clip,i=t._defs,a=n.clip_id||(n.clip_id="clip"+Nf++),u=i.clipping[a]||(i.clipping[a]={id:a});return X(r)?u.path=r(null):$c(e)?u.path=Pc(null,e,0,0):(u.width=e.width||0,u.height=e.height||0),"url(#"+a+")"}function Rf(t){var n=null!=(n=t.strokeWidth)?n:1;return null!=t.strokeOffset?t.strokeOffset:t.stroke&&n>.5&&n<1.5?.5-Math.abs(n-1):0}function qf(t,n){var e=Rf(n);t("d",Pc(null,n,e,e))}function Lf(t,n,e,r){var i=Rf(n);t.beginPath(),Pc(t,n,(e||0)+i,(r||0)+i)}var Uf=Af(Lf),$f=Af(Lf,!1);var Pf={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",Df(n))},bound:function(t,n){if(!n.clip&&n.items)for(var e=n.items,r=0,i=e.length;r<i;++r)t.union(e[r].bounds);return(n.clip||n.width||n.height)&&!n.noBound&&t.add(0,0).add(n.width||0,n.height||0),jc(t,n),t.translate(n.x||0,n.y||0)},draw:function(t,n,e){var r=this;vf(n,(function(n){var i=n.x||0,a=n.y||0,u=n.strokeForeground,o=null==n.opacity?1:n.opacity;(n.stroke||n.fill)&&o&&(Lf(t,n,i,a),n.fill&&hf(t,n,o)&&t.fill(),n.stroke&&!u&&pf(t,n,o)&&t.stroke()),t.save(),t.translate(i,a),n.clip&&zf(t,n),e&&e.translate(-i,-a),vf(n,(function(n){r.draw(t,n,e)})),e&&e.translate(i,a),t.restore(),u&&n.stroke&&o&&(Lf(t,n,i,a),pf(t,n,o)&&t.stroke())}))},pick:function(t,n,e,r,i,a){if(n.bounds&&!n.bounds.contains(i,a)||!n.items)return null;var u=this,o=e*t.pixelRatio,s=r*t.pixelRatio;return yf(n,(function(l){var c,f,h,d,p,g,m,v,y;if((!(v=l.bounds)||v.contains(i,a))&&(d=l.x||0,p=l.y||0,g=d+(l.width||0),m=p+(l.height||0),!(y=l.clip)||!(i<d||i>g||a<d||a>m)))return t.save(),t.translate(d,p),d=i-d,p=a-p,y&&$c(l)&&!Uf(t,l,o,s)?(t.restore(),null):(f=l.strokeForeground,(h=!1!==n.interactive)&&f&&l.stroke&&$f(t,l,o,s)?(t.restore(),l):(!(c=yf(l,(function(t){return function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,d,p)?u.pick(t,e,r,d,p):null})))&&h&&(l.fill||!f&&l.stroke)&&Uf(t,l,o,s)&&(c=l),t.restore(),c||null))}))},isect:of,content:function(t,n,e){t("clip-path",n.clip?Of(e,n,n):null)},background:function(t,n){t("class","background"),qf(t,n)},foreground:function(t,n){t("class","foreground"),n.strokeForeground?qf(t,n):t("d","")}};function jf(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then(n=>{t.image=n,t.image.url=t.url})),e}function If(t,n){return null!=t.width?t.width:n&&n.width?!1!==t.aspect&&t.height?t.height*n.width/n.height:n.width:0}function Hf(t,n){return null!=t.height?t.height:n&&n.height?!1!==t.aspect&&t.width?t.width*n.height/n.width:n.height:0}function Wf(t,n){return"center"===t?n/2:"right"===t?n:0}function Yf(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var Vf={type:"image",tag:"image",nested:!1,attr:function(t,n,e){var r=jf(n,e),i=n.x||0,a=n.y||0,u=If(n,r),o=Hf(n,r),s=!1===n.aspect?"none":"xMidYMid";i-=Wf(n.align,u),a-=Yf(n.baseline,o),!r.src&&r.toDataURL?t("href",r.toDataURL(),"http://www.w3.org/1999/xlink","xlink:href"):t("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Mf(i,a)),t("width",u),t("height",o),t("preserveAspectRatio",s)},bound:function(t,n){var e=n.image,r=n.x||0,i=n.y||0,a=If(n,e),u=Hf(n,e);return r-=Wf(n.align,a),i-=Yf(n.baseline,u),t.set(r,i,r+a,i+u)},draw:function(t,n,e){var r=this;vf(n,(function(n){if(!e||e.intersects(n.bounds)){var i,a,u,o,s=jf(n,r),l=n.x||0,c=n.y||0,f=If(n,s),h=Hf(n,s);l-=Wf(n.align,f),c-=Yf(n.baseline,h),!1!==n.aspect&&(a=s.width/s.height,u=n.width/n.height,a==a&&u==u&&a!==u&&(u<a?(c+=(h-(o=f/a))/2,h=o):(l+=(f-(o=h*a))/2,f=o))),(s.complete||s.toDataURL)&&(t.globalAlpha=null!=(i=n.opacity)?i:1,t.imageSmoothingEnabled=!1!==n.smooth,t.drawImage(s,l,c,f,h))}}))},pick:wf(),isect:m,get:jf,xOffset:Wf,yOffset:Yf},Gf=Bf("line",(function(t,n){var e=n[0],r=e.interpolate||"linear";return Rc.curve(tc(r,e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i=Math.pow(t[0].strokeWidth||1,2),a=t.length;--a>=0;)if(!1!==t[a].defined&&(e=t[a].x-n[0])*e+(r=t[a].y-n[1])*r<i)return t[a];return null}));function Xf(t,n){var e=n.path;if(null==e)return!0;var r=n.x||0,i=n.y||0,a=n.scaleX||1,u=n.scaleY||1,o=(n.angle||0)*ic,s=n.pathCache;s&&s.path===e||((n.pathCache=s=rc(e)).path=e),o&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(o),gc(t,s,0,0,a,u),t.rotate(-o),t.translate(-r,-i)):gc(t,s,r,i,a,u)}var Jf={type:"path",tag:"path",nested:!1,attr:function(t,n){var e=n.scaleX||1,r=n.scaleY||1;1===e&&1===r||t("vector-effect","non-scaling-stroke"),t("transform",Cf(n)),t("d",n.path)},bound:function(t,n){return Xf(Vc(t),n)?t.set(0,0,0,0):jc(t,n,!0),n.angle&&t.rotate(n.angle*ic,n.x||0,n.y||0),t},draw:_f(Xf),pick:kf(Xf),isect:af(Xf)};function Zf(t,n){t.beginPath(),Pc(t,n)}var Qf={type:"rect",tag:"path",nested:!1,attr:function(t,n){t("d",Pc(null,n))},bound:function(t,n){var e,r;return jc(t.set(e=n.x||0,r=n.y||0,e+n.width||0,r+n.height||0),n)},draw:_f(Zf),pick:kf(Zf),isect:of};function Kf(t,n,e){var r,i,a,u;return!(!n.stroke||!pf(t,n,e))&&(r=n.x||0,i=n.y||0,a=null!=n.x2?n.x2:r,u=null!=n.y2?n.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(a,u),!0)}var th,nh={type:"rule",tag:"line",nested:!1,attr:function(t,n){t("transform",Df(n)),t("x2",null!=n.x2?n.x2-(n.x||0):0),t("y2",null!=n.y2?n.y2-(n.y||0):0)},bound:function(t,n){var e,r;return jc(t.set(e=n.x||0,r=n.y||0,null!=n.x2?n.x2:e,null!=n.y2?n.y2:r),n)},draw:function(t,n,e){vf(n,(function(n){if(!e||e.intersects(n.bounds)){var r=null==n.opacity?1:n.opacity;r&&Kf(t,n,r)&&t.stroke()}}))},pick:wf((function(t,n,e,r){return!!t.isPointInStroke&&(Kf(t,n,1)&&t.isPointInStroke(e,r))})),isect:sf},eh=Ff("shape",(function(t,n){return(n.mark.shape||n.shape).context(t)(n)})),rh=Ff("symbol",(function(t,n){return Lc.context(t)(n)}),uf),ih={height:lh,measureWidth:oh,estimateWidth:ah,width:ah,canvas:ch};function ah(t,n){return th=lh(t),uh(ph(t,n))}function uh(t){return~~(.8*t.length*th)}function oh(t,n){return lh(t)<=0?0:(ef.font=mh(t),sh(ph(t,n)))}function sh(t){return ef.measureText(t).width}function lh(t){return null!=t.fontSize?t.fontSize:11}function ch(t){ih.width=t&&ef?oh:ah}function fh(t){return null!=t.lineHeight?t.lineHeight:lh(t)+2}function hh(t){return n=t.lineBreak&&t.text&&!u(t.text)?t.text.split(t.lineBreak):t.text,u(n)?n.length>1?n:n[0]:n;var n}function dh(t){const n=hh(t);return(u(n)?n.length-1:0)*fh(t)}function ph(t,n){return null==n?"":t.limit>0?function(t,n){var e,r=+t.limit,i=n+"";ih.width===oh?(ef.font=mh(t),e=sh):(th=lh(t),e=uh);if(e(i)<r)return i;var a,u=t.ellipsis||"…",o="rtl"===t.dir,s=0,l=i.length;if(r-=e(u),o){for(;s<l;)a=s+l>>>1,e(i.slice(a))>r?s=a+1:l=a;return u+i.slice(s)}for(;s<l;)a=1+(s+l>>>1),e(i.slice(0,a))<r?s=a:l=a-1;return i.slice(0,s)+u}(t,n):n+""}function gh(t,n){var e=t.font;return(n&&e?String(e).replace(/"/g,"'"):e)||"sans-serif"}function mh(t,n){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+lh(t)+"px "+gh(t,n)}function vh(t){var n=t.baseline,e=lh(t);return Math.round("top"===n?.79*e:"middle"===n?.3*e:"bottom"===n?-.21*e:0)}ch(!0);var yh={left:"start",center:"middle",right:"end"},_h=new Cs;function xh(t){var n,e=t.x||0,r=t.y||0,i=t.radius||0;return i&&(n=(t.theta||0)-uc,e+=i*Math.cos(n),r+=i*Math.sin(n)),_h.x1=e,_h.y1=r,_h}function bh(t,n,e){var r,i=ih.height(n),a=n.align,o=xh(n),s=o.x1,l=o.y1,c=n.dx||0,f=(n.dy||0)+vh(n)-Math.round(.8*i),h=hh(n);if(u(h)?(i+=fh(n)*(h.length-1),r=h.reduce((t,e)=>Math.max(t,ih.width(n,e)),0)):r=ih.width(n,h),"center"===a?c-=r/2:"right"===a&&(c-=r),t.set(c+=s,f+=l,c+r,f+i),n.angle&&!e)t.rotate(n.angle*ic,s,l);else if(2===e)return t.rotatedPoints(n.angle*ic,s,l);return t}var wh={arc:Sf,area:Tf,group:Pf,image:Vf,line:Gf,path:Jf,rect:Qf,rule:nh,shape:eh,symbol:rh,text:{type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+vh(n),a=xh(n),u=a.x1,o=a.y1,s=n.angle||0;t("text-anchor",yh[n.align]||"start"),s?(e=Mf(u,o)+" "+Ef(s),(r||i)&&(e+=" "+Mf(r,i))):e=Mf(u+r,o+i),t("transform",e)},bound:bh,draw:function(t,n,e){vf(n,(function(n){var r,i,a,o,s,l,c,f=null==n.opacity?1:n.opacity;if(!(e&&!e.intersects(n.bounds)||0===f||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=mh(n),t.textAlign=n.align||"left",i=(r=xh(n)).x1,a=r.y1,n.angle&&(t.save(),t.translate(i,a),t.rotate(n.angle*ic),i=a=0),i+=n.dx||0,a+=(n.dy||0)+vh(n),l=hh(n),u(l))for(s=fh(n),o=0;o<l.length;++o)c=ph(n,l[o]),n.fill&&hf(t,n,f)&&t.fillText(c,i,a),n.stroke&&pf(t,n,f)&&t.strokeText(c,i,a),a+=s;else c=ph(n,l),n.fill&&hf(t,n,f)&&t.fillText(c,i,a),n.stroke&&pf(t,n,f)&&t.strokeText(c,i,a);n.angle&&t.restore()}}))},pick:wf((function(t,n,e,r,i,a){if(n.fontSize<=0)return!1;if(!n.angle)return!0;var u=xh(n),o=u.x1,s=u.y1,l=bh(_h,n,1),c=-n.angle*ic,f=Math.cos(c),h=Math.sin(c),d=f*i-h*a+(o-f*o+h*s),p=h*i+f*a+(s-h*o-f*s);return l.contains(d,p)})),isect:function(t,n){var e=bh(_h,t,2);return lf(n,e[0],e[1],e[2],e[3])||lf(n,e[0],e[1],e[4],e[5])||lf(n,e[4],e[5],e[6],e[7])||lf(n,e[2],e[3],e[6],e[7])}},trail:Bf("trail",(function(t,n){return Uc.context(t)(n)}),(function(t,n){for(var e,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null}))};function Ah(t,n,e){var r=wh[t.mark.marktype],i=n||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new Cs),t,e)}var kh={mark:null};function Mh(t,n,e){var r,i,a,u,o=wh[t.marktype],s=o.bound,l=t.items,c=l&&l.length;if(o.nested)return c?a=l[0]:(kh.mark=t,a=kh),u=Ah(a,s,e),n=n&&n.union(u)||u;if(n=n||t.bounds&&t.bounds.clear()||new Cs,c)for(r=0,i=l.length;r<i;++r)n.union(Ah(l[r],s,e));return t.bounds=n}var Eh=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant"];function Dh(t,n){return JSON.stringify(t,Eh,n)}function Ch(t){return function t(n){var e,r,i,a=n.marktype,u=n.items;if(u)for(r=0,i=u.length;r<i;++r)e=a?"mark":"group",u[r][e]=n,u[r].zindex&&(u[r][e].zdirty=!0),"group"===(a||e)&&t(u[r]);a&&Mh(n);return n}("string"==typeof t?JSON.parse(t):t)}function Fh(t){arguments.length?this.root=Ch(t):(this.root=Bh({marktype:"group",name:"root",role:"frame"}),this.root.items=[new qs(this.root)])}var Sh=Fh.prototype;function Bh(t,n){return{bounds:new Cs,clip:!!t.clip,group:n,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Th(t,n,e){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?e?t.createElementNS(e,n):t.createElement(n):null}function zh(t,n){n=n.toLowerCase();for(var e=t.childNodes,r=0,i=e.length;r<i;++r)if(e[r].tagName.toLowerCase()===n)return e[r]}function Nh(t,n,e,r){var i,a=t.childNodes[n];return a&&a.tagName.toLowerCase()===e.toLowerCase()||(i=a||null,a=Th(t.ownerDocument,e,r),t.insertBefore(a,i)),a}function Oh(t,n){for(var e=t.childNodes,r=e.length;r>n;)t.removeChild(e[--r]);return t}function Rh(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function qh(t,n){var e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}function Lh(t,n){this._active=null,this._handlers={},this._loader=t||Tr(),this._tooltip=n||Uh}function Uh(t,n,e,r){t.element().setAttribute("title",r||"")}Sh.toJSON=function(t){return Dh(this.root,t||0)},Sh.mark=function(t,n,e){var r=Bh(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r};var $h=Lh.prototype;function Ph(t){this._el=null,this._bgcolor=null,this._loader=new $s(t)}$h.initialize=function(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)},$h.element=function(){return this._el},$h.canvas=function(){return this._el&&this._el.firstChild},$h.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},$h.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},$h.on=function(){},$h.off=function(){},$h._handlerIndex=function(t,n,e){for(var r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1},$h.handlers=function(t){var n,e=this._handlers,r=[];if(t)r.push.apply(r,e[this.eventName(t)]);else for(n in e)r.push.apply(r,e[n]);return r},$h.eventName=function(t){var n=t.indexOf(".");return n<0?t:t.slice(0,n)},$h.handleHref=function(t,n,e){this._loader.sanitize(e,{context:"href"}).then((function(n){var e=new MouseEvent(t.type,t),r=Th(null,"a");for(var i in n)r.setAttribute(i,n[i]);r.dispatchEvent(e)})).catch((function(){}))},$h.handleTooltip=function(t,n,e){if(n&&null!=n.tooltip){n=function(t,n,e,r){var i,a,u=t&&t.mark;if(u&&(i=wh[u.marktype]).tip){for((a=qh(n,e))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(u.items,a)}return t}(n,t,this.canvas(),this._origin);var r=e&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,r)}},$h.getItemBoundingClientRect=function(t){if(n=this.canvas()){for(var n,e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.x1+r[0]+e.left,u=i.y1+r[1]+e.top,o=i.width(),s=i.height();t.mark&&(t=t.mark.group);)a+=t.x||0,u+=t.y||0;return{x:a,y:u,width:o,height:s,left:a,top:u,right:a+o,bottom:u+s}}};var jh=Ph.prototype;jh.initialize=function(t,n,e,r,i){return this._el=t,this.resize(n,e,r,i)},jh.element=function(){return this._el},jh.canvas=function(){return this._el&&this._el.firstChild},jh.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},jh.resize=function(t,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this},jh.dirty=function(){},jh.render=function(t){var n=this;return n._call=function(){n._render(t)},n._call(),n._call=null,n},jh._render=function(){},jh.renderAsync=function(t){var n=this.render(t);return this._ready?this._ready.then((function(){return n})):Promise.resolve(n)},jh._load=function(t,n){var e=this,r=e._loader[t](n);if(!e._ready){var i=e._call;e._ready=e._loader.ready().then((function(t){t&&i(),e._ready=null}))}return r},jh.sanitizeURL=function(t){return this._load("sanitizeURL",t)},jh.loadImage=function(t){return this._load("loadImage",t)};var Ih="mouseout";function Hh(t,n){Lh.call(this,t,n),this._down=null,this._touch=null,this._first=!0}var Wh=ot(Hh,Lh);function Yh(t,n,e){return function(r){var i=this._active,a=this.pickEvent(r);a===i?this.fire(t,r):(i&&i.exit||this.fire(e,r),this._active=a,this.fire(n,r),this.fire(t,r))}}function Vh(t){return function(n){this.fire(t,n),this._active=null}}Wh.initialize=function(t,n,e){var r=this._canvas=t&&zh(t,"canvas");if(r){var i=this;this.events.forEach((function(t){r.addEventListener(t,(function(n){Wh[t]?Wh[t].call(i,n):i.fire(t,n)}))}))}return Lh.prototype.initialize.call(this,t,n,e)},Wh.canvas=function(){return this._canvas},Wh.context=function(){return this._canvas.getContext("2d")},Wh.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],Wh.DOMMouseScroll=function(t){this.fire("mousewheel",t)},Wh.mousemove=Yh("mousemove","mouseover","mouseout"),Wh.dragover=Yh("dragover","dragenter","dragleave"),Wh.mouseout=Vh("mouseout"),Wh.dragleave=Vh("dragleave"),Wh.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},Wh.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},Wh.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},Wh.touchmove=function(t){this.fire("touchmove",t,!0)},Wh.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},Wh.fire=function(t,n,e){var r,i,a=e?this._touch:this._active,u=this._handlers[t];if(n.vegaType=t,"click"===t&&a&&a.href?this.handleHref(n,a,a.href):"mousemove"!==t&&t!==Ih||this.handleTooltip(n,a,t!==Ih),u)for(r=0,i=u.length;r<i;++r)u[r].handler.call(this._obj,n,a)},Wh.on=function(t,n){var e=this.eventName(t),r=this._handlers;return this._handlerIndex(r[e],t,n)<0&&(r[e]||(r[e]=[])).push({type:t,handler:n}),this},Wh.off=function(t,n){var e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&r.splice(i,1),this},Wh.pickEvent=function(t){var n=qh(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])},Wh.pick=function(t,n,e,r,i){var a=this.context();return wh[t.marktype].pick.call(this,a,t,n,e,r,i)};var Gh="undefined"!=typeof window&&window.devicePixelRatio||1;function Xh(t){Ph.call(this,t),this._redraw=!1,this._dirty=new Cs}var Jh=ot(Xh,Ph),Zh=Ph.prototype,Qh=new Cs;function Kh(t,n,e){return Qh.set(0,0,n,e).translate(-t[0],-t[1])}function td(t,n){Lh.call(this,t,n);var e=this;e._hrefHandler=ed(e,(function(t,n){n&&n.href&&e.handleHref(t,n,n.href)})),e._tooltipHandler=ed(e,(function(t,n){e.handleTooltip(t,n,t.type!==Ih)}))}Jh.initialize=function(t,n,e,r,i,a){return this._options=a,this._canvas=Ls(1,1,a&&a.type),t&&(Oh(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),Zh.initialize.call(this,t,n,e,r,i)},Jh.resize=function(t,n,e,r){return Zh.resize.call(this,t,n,e,r),function(t,n,e,r,i,a){var u,o="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,s=t.getContext("2d"),l=o?Gh:i;for(u in t.width=n*l,t.height=e*l,a)s[u]=a[u];o&&1!==l&&(t.style.width=n+"px",t.style.height=e+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*r[0],l*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},Jh.canvas=function(){return this._canvas},Jh.context=function(){return this._canvas?this._canvas.getContext("2d"):null},Jh.dirty=function(t){var n=function(t,n){if(null==n)return t;for(var e=Qh.clear().union(t);null!=n;n=n.mark.group)e.translate(n.x||0,n.y||0);return e}(t.bounds,t.mark.group);this._dirty.union(n)},Jh._render=function(t){var n=this.context(),e=this._origin,r=this._width,i=this._height,a=this._dirty;return n.save(),this._redraw||a.empty()?(this._redraw=!1,a=Kh(e,r,i).expand(1)):a=function(t,n,e){return n.expand(1).round(),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(n,a.intersect(Kh(e,r,i)),e),this.clear(-e[0],-e[1],r,i),this.draw(n,t,a),n.restore(),this._dirty.clear(),this},Jh.draw=function(t,n,e){var r=wh[n.marktype];n.clip&&function(t,n){var e=n.clip;t.save(),X(e)?(t.beginPath(),e(t),t.clip()):zf(t,n.group)}(t,n),r.draw.call(this,t,n,e),n.clip&&t.restore()},Jh.clear=function(t,n,e,r){var i=this.context();i.clearRect(t,n,e,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,n,e,r))};var nd=ot(td,Lh);function ed(t,n){return function(e){var r=e.target.__data__;e.vegaType=e.type,r=Array.isArray(r)?r[0]:r,n.call(t._obj,e,r)}}function rd(t,n,e){var r,i,a="<"+t;if(n)for(r in n)null!=(i=n[r])&&(a+=" "+r+'="'+i+'"');return e&&(a+=" "+e),a+">"}function id(t){return"</"+t+">"}nd.initialize=function(t,n,e){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener(Ih,this._tooltipHandler)),this._svg=r=t&&zh(t,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener(Ih,this._tooltipHandler)),Lh.prototype.initialize.call(this,t,n,e)},nd.canvas=function(){return this._svg},nd.on=function(t,n){var e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){var i={type:t,handler:n,listener:ed(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this},nd.off=function(t,n){var e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this};var ad={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},ud={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},od=Object.keys(ud),sd=ad.xmlns;function ld(t){Ph.call(this,t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var cd=ot(ld,Ph),fd=Ph.prototype;function hd(t,n,e){var r,i,a;if("radial"===n.gradient){var u=Nh(t,e++,"pattern",sd);u.setAttribute("id",Bs+n.id),u.setAttribute("viewBox","0,0,1,1"),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("preserveAspectRatio","xMidYMid slice"),(u=Nh(u,0,"rect",sd)).setAttribute("width","1"),u.setAttribute("height","1"),u.setAttribute("fill","url("+bd()+"#"+n.id+")"),(t=Nh(t,e++,"radialGradient",sd)).setAttribute("id",n.id),t.setAttribute("fx",n.x1),t.setAttribute("fy",n.y1),t.setAttribute("fr",n.r1),t.setAttribute("cx",n.x2),t.setAttribute("cy",n.y2),t.setAttribute("r",n.r2)}else(t=Nh(t,e++,"linearGradient",sd)).setAttribute("id",n.id),t.setAttribute("x1",n.x1),t.setAttribute("x2",n.x2),t.setAttribute("y1",n.y1),t.setAttribute("y2",n.y2);for(r=0,i=n.stops.length;r<i;++r)(a=Nh(t,r,"stop",sd)).setAttribute("offset",n.stops[r].offset),a.setAttribute("stop-color",n.stops[r].color);return Oh(t,r),e}function dd(t,n,e){var r;return(t=Nh(t,e,"clipPath",sd)).setAttribute("id",n.id),n.path?(r=Nh(t,0,"path",sd)).setAttribute("d",n.path):((r=Nh(t,0,"rect",sd)).setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",n.width),r.setAttribute("height",n.height)),Oh(t,1),e+1}function pd(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function gd(t,n,e,r,i){var a,u=t._svg;if(!u&&(u=Th(a=n.ownerDocument,r,sd),t._svg=u,t.mark&&(u.__data__=t,u.__values__={fill:"default"},"g"===r))){var o=Th(a,"path",sd);u.appendChild(o),o.__data__=t;var s=Th(a,"g",sd);u.appendChild(s),s.__data__=t;var l=Th(a,"path",sd);u.appendChild(l),l.__data__=t,l.__values__={fill:"default"}}return(u.ownerSVGElement!==i||function(t,n){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=n}(u,e))&&n.insertBefore(u,e?e.nextSibling:n.firstChild),u}cd.initialize=function(t,n,e,r){return t&&(this._svg=Nh(t,0,"svg",sd),this._svg.setAttribute("class","marks"),Oh(t,1),this._root=Nh(this._svg,0,"g",sd),Oh(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),fd.initialize.call(this,t,n,e,r)},cd.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),fd.background.apply(this,arguments)},cd.resize=function(t,n,e,r){return fd.resize.call(this,t,n,e,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},cd.canvas=function(){return this._svg},cd.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var n in ad)t[n]=ad[n];var e=this._bgcolor?rd("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+id("rect"):"";return rd("svg",t)+e+this._svg.innerHTML+id("svg")},cd._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),Oh(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},cd.updateDefs=function(){var t,n=this._svg,e=this._defs,r=e.el,i=0;for(t in e.gradient)r||(e.el=r=Nh(n,0,"defs",sd)),i=hd(r,e.gradient[t],i);for(t in e.clipping)r||(e.el=r=Nh(n,0,"defs",sd)),i=dd(r,e.clipping[t],i);r&&(0===i?(n.removeChild(r),e.el=null):Oh(r,i))},cd._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},cd.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},cd.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},cd._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length||!this._dirtyID)return!0;var n,e,r,i,a,u,o,s=++this._dirtyID;for(a=0,u=t.length;a<u;++a)(e=(n=t[a]).mark).marktype!==r&&(r=e.marktype,i=wh[r]),e.zdirty&&e.dirty!==s&&(this._dirtyAll=!1,pd(n,s),e.items.forEach((function(t){t.dirty=s}))),e.zdirty||(n.exit?(i.nested&&e.items.length?(o=e.items[0])._svg&&this._update(i,o._svg,o):n._svg&&(o=n._svg.parentNode)&&o.removeChild(n._svg),n._svg=null):(n=i.nested?e.items[0]:n)._update!==s&&(n._svg&&n._svg.ownerSVGElement?this._update(i,n._svg,n):(this._dirtyAll=!1,pd(n,s)),n._update=s));return!this._dirtyAll},cd.draw=function(t,n,e){if(!this.isDirty(n))return n._svg;var r,i=this,a=this._svg,u=wh[n.marktype],o=!1===n.interactive?"none":null,s="g"===u.tag,l=null,c=0;function f(t){var n=i.isDirty(t),e=gd(t,r,l,u.tag,a);n&&(i._update(u,e,t),s&&function(t,n,e){n=n.lastChild.previousSibling;var r,i=0;vf(e,(function(e){r=t.draw(n,e,r),++i})),Oh(n,1+i)}(i,e,t)),l=e,++c}return(r=gd(n,t,e,"g",a)).setAttribute("class",Rh(n)),s||r.style.setProperty("pointer-events",o),n.clip?r.setAttribute("clip-path",Of(i,n,n.group)):r.removeAttribute("clip-path"),u.nested?n.items.length&&f(n.items[0]):vf(n,f),Oh(r,c),r};var md=null,vd=null,yd={group:function(t,n,e){var r,i;md=r=n.childNodes[2],vd=r.__values__,t.foreground(xd,e,this),vd=n.__values__,md=n.childNodes[1],t.content(xd,e,this),md=i=n.childNodes[0],t.background(xd,e,this);var a=!1===e.mark.interactive?"none":null;if(a!==vd.events&&(r.style.setProperty("pointer-events",a),i.style.setProperty("pointer-events",a),vd.events=a),e.strokeForeground&&e.stroke){const t=e.fill;r.style.removeProperty("display"),this.style(i,e),i.style.removeProperty("stroke"),t&&(e.fill=null),vd=r.__values__,this.style(r,e),t&&(e.fill=t),md=null}else r.style.setProperty("display","none"),r.style.setProperty("fill","none")},image:function(t,n,e){!1===e.smooth?(_d(n,"image-rendering","optimizeSpeed"),_d(n,"image-rendering","pixelated")):_d(n,"image-rendering",null)},text:function(t,n,e){var r,i,a,o,s=hh(e);u(s)?(r=(i=s.map(t=>ph(e,t))).join("\n"))!==vd.text&&(Oh(n,0),a=n.ownerDocument,o=fh(e),i.forEach((t,r)=>{const i=Th(a,"tspan",sd);i.__data__=e,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",o)),n.appendChild(i)}),vd.text=r):(i=ph(e,s))!==vd.text&&(n.textContent=i,vd.text=i),_d(n,"font-family",gh(e)),_d(n,"font-size",lh(e)+"px"),_d(n,"font-style",e.fontStyle),_d(n,"font-variant",e.fontVariant),_d(n,"font-weight",e.fontWeight)}};function _d(t,n,e){e!==vd[n]&&(null==e?t.style.removeProperty(n):t.style.setProperty(n,e+""),vd[n]=e)}function xd(t,n,e){n!==vd[t]&&(null!=n?e?md.setAttributeNS(e,t,n):md.setAttribute(t,n):e?md.removeAttributeNS(e,t):md.removeAttribute(t),vd[t]=n)}function bd(){var t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}function wd(t){Ph.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}cd._update=function(t,n,e){md=n,vd=n.__values__,t.attr(xd,e,this);var r=yd[t.type];r&&r.call(this,t,n,e),md&&this.style(md,e)},cd.style=function(t,n){var e,r,i,a,u;if(null!=n)for(e=0,r=od.length;e<r;++e)u=n[i=od[e]],"font"===i&&(u=gh(n)),u!==vd[i]&&(a=ud[i],null==u?"fill"===a?t.style.setProperty(a,"none"):t.style.removeProperty(a):(Ts(u)&&(u=zs(u,this._defs.gradient,bd())),t.style.setProperty(a,u+"")),vd[i]=u)};var Ad,kd=ot(wd,Ph),Md=Ph.prototype;function Ed(t,n,e,r){Ad[r||t]=n}function Dd(t,n,e,r){if(null==t)return"";var i,a,u,o,s,l="";for("bgrect"===e&&!1===n.interactive&&(l+="pointer-events: none; "),"bgfore"===e&&(!1===n.interactive&&(l+="pointer-events: none; "),l+="display: none; "),"image"===e&&!1===t.smooth&&(l+="image-rendering: optimizeSpeed; image-rendering: pixelated; "),"text"===e&&(l+="font-family: "+gh(t)+"; ",l+="font-size: "+lh(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),i=0,a=od.length;i<a;++i)u=od[i],o=ud[u],null==(s=t[u])?"fill"===o&&(l+="fill: none; "):"transparent"!==s||"fill"!==o&&"stroke"!==o?(Ts(s)&&(s=zs(s,r.gradient,"")),l+=o+": "+s+"; "):l+=o+": none; ";return l?'style="'+l.trim()+'"':null}function Cd(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}kd.resize=function(t,n,e,r){Md.resize.call(this,t,n,e,r);var i=this._origin,a=this._text,u={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var o in ad)u[o]=ad[o];a.head=rd("svg",u);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?rd("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+id("rect"):"",a.root=rd("g",{transform:"translate("+i+")"}),a.foot=id("g")+id("svg"),this},kd.background=function(){var t=Md.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},kd.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},kd._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},kd.buildDefs=function(){var t,n,e,r,i,a=this._defs,u="";for(n in a.gradient){for(i=(e=a.gradient[n]).stops,"radial"===e.gradient?(u+=rd(r="pattern",{id:Bs+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),u+=rd("rect",{width:"1",height:"1",fill:"url(#"+n+")"})+id("rect"),u+=id(r),u+=rd(r="radialGradient",{id:n,fx:e.x1,fy:e.y1,fr:e.r1,cx:e.x2,cy:e.y2,r:e.r2})):u+=rd(r="linearGradient",{id:n,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2}),t=0;t<i.length;++t)u+=rd("stop",{offset:i[t].offset,"stop-color":i[t].color})+id("stop");u+=id(r)}for(n in a.clipping)e=a.clipping[n],u+=rd("clipPath",{id:n}),e.path?u+=rd("path",{d:e.path})+id("path"):u+=rd("rect",{x:0,y:0,width:e.width,height:e.height})+id("rect"),u+=id("clipPath");return u.length>0?rd("defs")+u+id("defs"):""},kd.attributes=function(t,n){return Ad={},t(Ed,n,this),Ad},kd.href=function(t){var n,e=this,r=t.href;if(r){if(n=e._hrefs&&e._hrefs[r])return n;e.sanitizeURL(r).then((function(t){t["xlink:href"]=t.href,t.href=null,(e._hrefs||(e._hrefs={}))[r]=t}))}return null},kd.mark=function(t){var n,e=this,r=wh[t.marktype],i=r.tag,a=this._defs,o="";function s(s){var l=e.href(s);if(l&&(o+=rd("a",l)),n="g"!==i?Dd(s,t,i,a):null,o+=rd(i,e.attributes(r.attr,s),n),"text"===i){const t=hh(s);if(u(t)){const n={x:0,dy:fh(s)};for(let e=0;e<t.length;++e)o+=rd("tspan",e?n:null)+Cd(ph(s,t[e]))+id("tspan")}else o+=Cd(ph(s,t))}else if("g"===i){const n=s.strokeForeground,i=s.fill,u=s.stroke;n&&u&&(s.stroke=null),o+=rd("path",e.attributes(r.background,s),Dd(s,t,"bgrect",a))+id("path"),o+=rd("g",e.attributes(r.content,s))+e.markGroup(s)+id("g"),n&&u?(i&&(s.fill=null),s.stroke=u,o+=rd("path",e.attributes(r.foreground,s),Dd(s,t,"bgrect",a))+id("path"),i&&(s.fill=i)):o+=rd("path",e.attributes(r.foreground,s),Dd({},t,"bgfore",a))+id("path")}o+=id(i),l&&(o+=id("a"))}return"g"!==i&&!1===t.interactive&&(n='style="pointer-events: none;"'),o+=rd("g",{class:Rh(t),"clip-path":t.clip?Of(e,t,t.group):null},n),r.nested?t.items&&t.items.length&&s(t.items[0]):vf(t,s),o+id("g")},kd.markGroup=function(t){var n=this,e="";return vf(t,(function(t){e+=n.mark(t)})),e};var Fd={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},Sd={};function Bd(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?(Sd[t]=n,this):Sd[t]}function Td(t,n,e){const r=[],a=(new Cs).union(n),u=t.marktype;return u?zd(t,a,e,r):"group"===u?Nd(t,a,e,r):i("Intersect scene must be mark node or group item.")}function zd(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){const i=t.items,a=t.marktype,u=i.length;let o=0;if("group"===a)for(;o<u;++o)Nd(i[o],n,e,r);else for(const t=wh[a].isect;o<u;++o){let e=i[o];Od(e,n,t)&&r.push(e)}}return r}function Nd(t,n,e,r){e&&e(t.mark)&&Od(t,n,wh.group.isect)&&r.push(t);const i=t.items,a=i&&i.length;if(a){const u=t.x||0,o=t.y||0;n.translate(-u,-o);for(let t=0;t<a;++t)zd(i[t],n,e,r);n.translate(u,o)}return r}function Od(t,n,e){const r=t.bounds;return n.encloses(r)||n.intersects(r)&&e(t,n)}Sd.canvas=Sd.png={renderer:Xh,headless:Xh,handler:Hh},Sd.svg={renderer:ld,headless:wd,handler:td},Sd.none={};var Rd=new Cs;function qd(t){var n=t.clip;if(X(n))n(Vc(Rd.clear()));else{if(!n)return;Rd.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Rd)}var Ld=1e-9;function Ud(t,n,e){return t===n||("path"===e?$d(t,n):t instanceof Date&&n instanceof Date?+t==+n:ft(t)&&ft(n)?Math.abs(t-n)<=Ld:t&&n&&(o(t)||o(n))?null!=t&&null!=n&&function(t,n){var e,r,i=Object.keys(t),a=Object.keys(n);if(i.length!==a.length)return!1;for(i.sort(),a.sort(),r=i.length-1;r>=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(e=i[r],!Ud(t[e],n[e],e))return!1;return typeof t==typeof n}(t,n):t==n)}function $d(t,n){return Ud(rc(t),rc(n))}function Pd(t){Qr.call(this,null,t)}function jd(t,n,e){return n(t.bounds.clear(),t,e)}ot(Pd,Qr).transform=function(t,n){var e,r=n.dataflow,i=t.mark,a=i.marktype,u=wh[a],o=u.bound,s=i.bounds;if(u.nested)i.items.length&&r.dirty(i.items[0]),s=jd(i,o),i.items.forEach((function(t){t.bounds.clear().union(s)}));else if(a===is||t.modified())switch(n.visit(n.MOD,(function(t){r.dirty(t)})),s.clear(),i.items.forEach((function(t){s.union(jd(t,o))})),i.role){case as:case ls:case us:n.reflow()}else e=n.changed(n.REM),n.visit(n.ADD,(function(t){s.union(jd(t,o))})),n.visit(n.MOD,(function(t){e=e||s.alignsWith(t.bounds),r.dirty(t),s.union(jd(t,o))})),e&&(s.clear(),i.items.forEach((function(t){s.union(t.bounds)})));return qd(i),n.modifies("bounds")};var Id=":vega_identifier:";function Hd(t){Qr.call(this,0,t)}function Wd(t){Qr.call(this,null,t)}function Yd(t){Qr.call(this,null,t)}Hd.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ot(Hd,Qr).transform=function(t,n){var e=function(t){var n=t._signals[Id];n||(t._signals[Id]=n=t.add(0));return n}(n.dataflow),r=e.value,i=t.as;return n.visit(n.ADD,(function(t){t[i]||(t[i]=++r)})),e.set(this.value=r),n},ot(Wd,Qr).transform=function(t,n){var e=this.value;e||((e=n.dataflow.scenegraph().mark(t.markdef,function(t){var n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);var r=e.marktype===is?qs:Rs;return n.visit(n.ADD,(function(t){r.call(t,e)})),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n};var Vd=ot(Yd,Qr),Gd={parity:function(t){return t.filter((t,n)=>n%2?t.opacity=0:1)},greedy:function(t,n){var e;return t.filter((t,r)=>r&&Xd(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1))}};function Xd(t,n,e){return e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2)}function Jd(t,n){for(var e,r=1,i=t.length,a=t[0].bounds;r<i;a=e,++r)if(Xd(a,e=t[r].bounds,n))return!0}function Zd(t){var n=t.bounds;return n.width()>1&&n.height()>1}function Qd(t){return t.forEach(t=>t.opacity=1),t}function Kd(t,n){return t.reflow(n.modified()).modifies("opacity")}function tp(t){Qr.call(this,null,t)}Vd.transform=function(t,n){var e,r,i,a=Gd[t.method]||Gd.parity,u=n.materialize(n.SOURCE).source,o=t.separation||0;if(u&&u.length){if(!t.method)return t.modified("method")&&(Qd(u),n=Kd(n,t)),n;if(t.sort&&(u=u.slice().sort(t.sort)),e=Qd(u=u.filter(Zd)),n=Kd(n,t),e.length>=3&&Jd(e,o)){do{e=a(e,o)}while(e.length>=3&&Jd(e,o));e.length<3&&!C(u).opacity&&(e.length>1&&(C(e).opacity=0),C(u).opacity=1)}return t.boundScale&&t.boundTolerance>=0&&(r=function(t,n,e){var r=t.range(),i=new Cs;return n===Wo||n===Go?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(e||1),t=>i.encloses(t.bounds)}(t.boundScale,t.boundOrient,+t.boundTolerance),u.forEach(t=>{r(t)||(t.opacity=0)})),i=e[0].mark.bounds.clear(),u.forEach(t=>{t.opacity&&i.union(t.bounds)}),n}},ot(tp,Qr).transform=function(t,n){var e=n.dataflow;if(n.visit(n.ALL,(function(t){e.dirty(t)})),n.fields&&n.fields.zindex){var r=n.source&&n.source[0];r&&(r.mark.zdirty=!0)}};const np=new Cs;function ep(t,n,e){return t[n]===e?0:(t[n]=e,1)}function rp(t){var n=t.items[0].datum.orient;return n===Yo||n===Vo}function ip(t,n,e,r){var i,a,u=n.items[0],o=u.datum,s=o.orient,l=null!=o.translate?o.translate:.5,c=function(t){var n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(o),f=u.range,h=u.offset,d=u.position,p=u.minExtent,g=u.maxExtent,m=o.title&&u.items[c[2]].items[0],v=u.titlePadding,y=u.bounds,_=m&&dh(m),x=0,b=0;switch(np.clear().union(y),y.clear(),(i=c[0])>-1&&y.union(u.items[i].bounds),(i=c[1])>-1&&y.union(u.items[i].bounds),s){case Wo:x=d||0,b=-h,a=Math.max(p,Math.min(g,-y.y1)),m&&(a=ap(t,m,a,v,_,0,-1,y)),y.add(0,-a).add(f,0);break;case Yo:x=-h,b=d||0,a=Math.max(p,Math.min(g,-y.x1)),m&&(a=ap(t,m,a,v,_,1,-1,y)),y.add(-a,0).add(0,f);break;case Vo:x=e+h,b=d||0,a=Math.max(p,Math.min(g,y.x2)),m&&(a=ap(t,m,a,v,_,1,1,y)),y.add(0,0).add(a,f);break;case Go:x=d||0,b=r+h,a=Math.max(p,Math.min(g,y.y2)),m&&(a=ap(t,m,a,v,0,0,1,y)),y.add(0,0).add(f,a);break;default:x=u.x,b=u.y}return jc(y.translate(x,b),u),ep(u,"x",x+l)|ep(u,"y",b+l)&&(u.bounds=np,t.dirty(u),u.bounds=y,t.dirty(u)),u.mark.bounds.clear().union(y)}function ap(t,n,e,r,i,a,u,o){var s=n.bounds,l=0,c=0;return n.auto?(t.dirty(n),e+=r,a?l=(n.x||0)-(n.x=u*(e+i)):c=(n.y||0)-(n.y=u*(e+i)),n.mark.bounds.clear().union(s.translate(-l,-c)),t.dirty(n),a?(o.add(0,s.y1).add(0,s.y2),e+=s.width()):(o.add(s.x1,0).add(s.x2,0),e+=s.height())):o.union(s),e}function up(t){return(new Cs).set(0,0,t.width||0,t.height||0)}function op(t){var n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function sp(t,n,e){var r=o(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function lp(t){return t<0?Math.ceil(-t):0}function cp(t,n,e){var r,i,a,u,o,s,l,c,f,h,d,p=!e.nodirty,g=e.bounds===Ms?up:op,m=np.set(0,0,0,0),v=sp(e.align,Es),y=sp(e.align,Ds),_=sp(e.padding,Es),x=sp(e.padding,Ds),b=e.columns||n.length,w=b<0?1:Math.ceil(n.length/b),A=n.length,k=Array(A),M=Array(b),E=0,D=Array(A),C=Array(w),F=0,S=Array(A),B=Array(A),T=Array(A);for(i=0;i<b;++i)M[i]=0;for(i=0;i<w;++i)C[i]=0;for(i=0;i<A;++i)s=n[i],o=T[i]=g(s),s.x=s.x||0,S[i]=0,s.y=s.y||0,B[i]=0,a=i%b,u=~~(i/b),E=Math.max(E,l=Math.ceil(o.x2)),F=Math.max(F,c=Math.ceil(o.y2)),M[a]=Math.max(M[a],l),C[u]=Math.max(C[u],c),k[i]=_+lp(o.x1),D[i]=x+lp(o.y1),p&&t.dirty(n[i]);for(i=0;i<A;++i)i%b==0&&(k[i]=0),i<b&&(D[i]=0);if(v===ks)for(a=1;a<b;++a){for(d=0,i=a;i<A;i+=b)d<k[i]&&(d=k[i]);for(i=a;i<A;i+=b)k[i]=d+M[a-1]}else if(v===As){for(d=0,i=0;i<A;++i)i%b&&d<k[i]&&(d=k[i]);for(i=0;i<A;++i)i%b&&(k[i]=d+E)}else for(v=!1,a=1;a<b;++a)for(i=a;i<A;i+=b)k[i]+=M[a-1];if(y===ks)for(u=1;u<w;++u){for(d=0,r=(i=u*b)+b;i<r;++i)d<D[i]&&(d=D[i]);for(i=u*b;i<r;++i)D[i]=d+C[u-1]}else if(y===As){for(d=0,i=b;i<A;++i)d<D[i]&&(d=D[i]);for(i=b;i<A;++i)D[i]=d+F}else for(y=!1,u=1;u<w;++u)for(r=(i=u*b)+b;i<r;++i)D[i]+=C[u-1];for(f=0,i=0;i<A;++i)f=k[i]+(i%b?f:0),S[i]+=f-n[i].x;for(a=0;a<b;++a)for(h=0,i=a;i<A;i+=b)h+=D[i],B[i]+=h-n[i].y;if(v&&sp(e.center,Es)&&w>1)for(i=0;i<A;++i)(f=(o=v===As?E:M[i%b])-T[i].x2-n[i].x-S[i])>0&&(S[i]+=f/2);if(y&&sp(e.center,Ds)&&1!==b)for(i=0;i<A;++i)(h=(o=y===As?F:C[~~(i/b)])-T[i].y2-n[i].y-B[i])>0&&(B[i]+=h/2);for(i=0;i<A;++i)m.union(T[i].translate(S[i],B[i]));switch(f=sp(e.anchor,es),h=sp(e.anchor,rs),sp(e.anchor,Es)){case ns:f-=m.width();break;case ts:f-=m.width()/2}switch(sp(e.anchor,Ds)){case ns:h-=m.height();break;case ts:h-=m.height()/2}for(f=Math.round(f),h=Math.round(h),m.clear(),i=0;i<A;++i)n[i].mark.bounds.clear();for(i=0;i<A;++i)(s=n[i]).x+=S[i]+=f,s.y+=B[i]+=h,m.union(s.mark.bounds.union(s.bounds.translate(S[i],B[i]))),p&&t.dirty(s);return m}function fp(t,n,e){var r,i,a,u,o,s,l,c=function(t){for(var n,e,r=t.items,i=r.length,a=0,u={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a<i;++a)if(e=(n=r[a]).items,n.marktype===is)switch(n.role){case as:case ls:case us:break;case cs:u.rowheaders.push(...e);break;case fs:u.rowfooters.push(...e);break;case ds:u.colheaders.push(...e);break;case ps:u.colfooters.push(...e);break;case hs:u.rowtitle=e[0];break;case gs:u.coltitle=e[0];break;default:u.marks.push(...e)}return u}(n),f=c.marks,h=e.bounds===Ms?hp:dp,d=e.offset,p=e.columns||f.length,g=p<0?1:Math.ceil(f.length/p),m=g*p;const v=cp(t,f,e);c.rowheaders&&(s=sp(e.headerBand,Ds,null),r=mp(t,c.rowheaders,f,p,g,-sp(d,"rowHeader"),pp,0,h,"x1",0,p,1,s)),c.colheaders&&(s=sp(e.headerBand,Es,null),i=mp(t,c.colheaders,f,p,p,-sp(d,"columnHeader"),pp,1,h,"y1",0,1,p,s)),c.rowfooters&&(s=sp(e.footerBand,Ds,null),a=mp(t,c.rowfooters,f,p,g,sp(d,"rowFooter"),gp,0,h,"x2",p-1,p,1,s)),c.colfooters&&(s=sp(e.footerBand,Es,null),u=mp(t,c.colfooters,f,p,p,sp(d,"columnFooter"),gp,1,h,"y2",m-p,1,p,s)),c.rowtitle&&(o=sp(e.titleAnchor,Ds),l=sp(d,"rowTitle"),l=o===ns?a+l:r-l,s=sp(e.titleBand,Ds,.5),vp(t,c.rowtitle,l,0,v,s)),c.coltitle&&(o=sp(e.titleAnchor,Es),l=sp(d,"columnTitle"),l=o===ns?u+l:i-l,s=sp(e.titleBand,Es,.5),vp(t,c.coltitle,l,1,v,s))}function hp(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function dp(t,n){return t.bounds[n]}function pp(t,n){return Math.floor(Math.min(t,n))}function gp(t,n){return Math.ceil(Math.max(t,n))}function mp(t,n,e,r,i,a,u,o,s,l,c,f,h,d){var p,g,m,v,y,_,x,b,w,A=e.length,k=0,M=0;if(!A)return k;for(p=c;p<A;p+=f)e[p]&&(k=u(k,s(e[p],l)));if(!n.length)return k;for(n.length>i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),k+=a,g=0,v=n.length;g<v;++g)t.dirty(n[g]),n[g].mark.bounds.clear();for(p=c,g=0,v=n.length;g<v;++g,p+=f){for(y=(_=n[g]).mark.bounds,m=p;m>=0&&null==(x=e[m]);m-=h);o?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=k):(b=k,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),y.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),M=u(M,y[l])}return M}function vp(t,n,e,r,i,a){if(n){t.dirty(n);var u=e,o=e;r?u=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),n.bounds.translate(u-(n.x||0),o-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=u,n.y=o,t.dirty(n)}}function yp(t,n,e,r,i,a,u){const o=function(t,n){const e=t[n]||{};return(n,r)=>null!=e[n]?e[n]:null!=t[n]?t[n]:r}(e,n),s=function(t,n){var e=-1/0;return t.forEach(t=>{null!=t.offset&&(e=Math.max(e,t.offset))}),e>-1/0?e:n}(t,o("offset",0)),l=o("anchor",Ko),c=l===ns?1:l===ts?.5:0,f={align:ks,bounds:o("bounds",Ms),columns:"vertical"===o("direction")?1:t.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(n){case Yo:f.anchor={x:Math.floor(r.x1)-s,column:ns,y:c*(u||r.height()+2*r.y1),row:l};break;case Vo:f.anchor={x:Math.ceil(r.x2)+s,y:c*(u||r.height()+2*r.y1),row:l};break;case Wo:f.anchor={y:Math.floor(i.y1)-s,row:ns,x:c*(a||i.width()+2*i.x1),column:l};break;case Go:f.anchor={y:Math.ceil(i.y2)+s,x:c*(a||i.width()+2*i.x1),column:l};break;case Xo:f.anchor={x:s,y:s};break;case Jo:f.anchor={x:a-s,y:s,column:ns};break;case Zo:f.anchor={x:s,y:u-s,row:ns};break;case Qo:f.anchor={x:a-s,y:u-s,column:ns,row:ns}}return f}function _p(t,n){var e,r,i,a,u=n.items[0],o=u.datum,s=u.orient,l=u.bounds,c=u.x,f=u.y;return u._bounds?u._bounds.clear().union(l):u._bounds=l.clone(),l.clear(),function(t,n,e){var r=n.padding,i=r-e.x,a=r-e.y;if(n.datum.title){var u=n.items[1].items[0],o=u.anchor,s=n.titlePadding||0,l=r-u.x,c=r-u.y;switch(u.orient){case Yo:i+=Math.ceil(u.bounds.width())+s;break;case Vo:case Go:break;default:a+=u.bounds.height()+s}switch((i||a)&&bp(t,e,i,a),u.orient){case Yo:c+=xp(n,e,u,o,1,1);break;case Vo:l+=xp(n,e,u,ns,0,0)+s,c+=xp(n,e,u,o,1,1);break;case Go:l+=xp(n,e,u,o,0,0),c+=xp(n,e,u,ns,-1,0,1)+s;break;default:l+=xp(n,e,u,o,0,0)}(l||c)&&bp(t,u,l,c),(l=Math.round(u.bounds.x1-r))<0&&(bp(t,e,-l,0),bp(t,u,-l,0))}else(i||a)&&bp(t,e,i,a)}(t,u,u.items[0].items[0]),l=function(t,n){return t.items.forEach(t=>n.union(t.bounds)),n.x1=t.padding,n.y1=t.padding,n}(u,l),e=2*u.padding,r=2*u.padding,l.empty()||(e=Math.ceil(l.width()+e),r=Math.ceil(l.height()+r)),o.type===vs&&(i=u.items[0].items[0].items[0].items,a=i.reduce((function(t,n){return t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t}),{}),i.forEach((function(t){t.width=a[t.column],t.height=t.bounds.y2-t.y}))),s!==ws&&(u.x=c=0,u.y=f=0),u.width=e,u.height=r,jc(l.set(c,f,c+e,f+r),u),u.mark.bounds.clear().union(l),u}function xp(t,n,e,r,i,a,u){const o="symbol"!==t.datum.type,s=e.datum.vgrad,l=(!o||!a&&s||u?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=s&&a?l:0,f=s&&a?0:l,h=i<=0?0:dh(e);return Math.round(r===Ko?c:r===ns?f-h:.5*(l-h))}function bp(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function wp(t){Qr.call(this,null,t)}ot(wp,Qr).transform=function(t,n){var e=n.dataflow;return t.mark.items.forEach((function(n){t.layout&&fp(e,n,t.layout),function(t,n,e){var r,i,a,u,o,s=n.items,l=Math.max(0,n.width||0),c=Math.max(0,n.height||0),f=(new Cs).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(u=0,o=s.length;u<o;++u)switch((i=s[u]).role){case as:(rp(i)?h:d).union(ip(t,i,l,c));break;case us:r=i;break;case ls:p.push(_p(t,i));break;case os:case ss:case cs:case fs:case hs:case ds:case ps:case gs:h.union(i.bounds),d.union(i.bounds);break;default:f.union(i.bounds)}if(p.length){const n={};p.forEach(t=>{(a=t.orient||Vo)!==ws&&(n[a]||(n[a]=[])).push(t)});for(let r in n){const i=n[r];cp(t,i,yp(i,r,e.legends,h,d,l,c))}p.forEach(n=>{const r=n.bounds;if(r.equals(n._bounds)||(n.bounds=n._bounds,t.dirty(n),n.bounds=r,t.dirty(n)),e.autosize&&e.autosize.type===ys)switch(n.orient){case Yo:case Vo:f.add(r.x1,0).add(r.x2,0);break;case Wo:case Go:f.add(0,r.y1).add(0,r.y2)}else f.union(r)})}f.union(h).union(d),r&&f.union(function(t,n,e,r,i){var a,u=n.items[0],o=u.frame,s=u.orient,l=u.anchor,c=u.offset,f=u.padding,h=u.items[0].items[0],d=u.items[1]&&u.items[1].items[0],p=s===Yo||s===Vo?r:e,g=0,m=0,v=0,y=0,_=0;if(o!==is?s===Yo?(g=i.y2,p=i.y1):s===Vo?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):s===Yo&&(g=r,p=0),a=l===Ko?g:l===ns?p:(g+p)/2,d&&d.text){switch(s){case Wo:case Go:_=h.bounds.height()+f;break;case Yo:y=h.bounds.width()+f;break;case Vo:y=-h.bounds.width()-f}np.clear().union(d.bounds),np.translate(y-(d.x||0),_-(d.y||0)),ep(d,"x",y)|ep(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(np),d.mark.bounds.clear().union(np),t.dirty(d)),np.clear().union(d.bounds)}else np.clear();switch(np.union(h.bounds),s){case Wo:m=a,v=i.y1-np.height()-c;break;case Yo:m=i.x1-np.width()-c,v=a;break;case Vo:m=i.x2+np.width()+c,v=a;break;case Go:m=a,v=i.y2+c;break;default:m=u.x,v=u.y}return ep(u,"x",m)|ep(u,"y",v)&&(np.translate(m,v),t.dirty(u),u.bounds.clear().union(np),n.bounds.clear().union(np),t.dirty(u)),u.bounds}(t,r,l,c,f));n.clip&&f.set(0,0,n.width||0,n.height||0);!function(t,n,e,r){var i=r.autosize||{},a=i.type,u=t._width,o=t._height,s=t.padding();if(t._autosize<1||!a)return;var l=Math.max(0,n.width||0),c=Math.max(0,Math.ceil(-e.x1)),f=Math.max(0,Math.ceil(e.x2-l)),h=Math.max(0,n.height||0),d=Math.max(0,Math.ceil(-e.y1)),p=Math.max(0,Math.ceil(e.y2-h));i.contains===ms&&(u-=s.left+s.right,o-=s.top+s.bottom);a===ws?(c=0,d=0,l=u,h=o):a===ys?(l=Math.max(0,u-c-f),h=Math.max(0,o-d-p)):a===_s?(l=Math.max(0,u-c-f),o=h+d+p):a===xs?(u=l+c+f,h=Math.max(0,o-d-p)):a===bs&&(u=l+c+f,o=h+d+p);t._resizeView(u,o,l,h,[c,d],i.resize)}(t,n,f,e)}(e,n,t)})),t.modified()&&n.reflow(),n};var Ap=Object.freeze({__proto__:null,bound:Pd,identifier:Hd,mark:Wd,overlap:Yd,render:tp,viewlayout:wp});function kp(t,n,e){var r=t-n+2*e;return t?r>0?r:1:0}const Mp="linear",Ep="log",Dp="pow",Cp="sqrt",Fp="symlog",Sp="time",Bp="utc",Tp="sequential",zp="diverging",Np="quantile",Op="quantize",Rp="threshold",qp="ordinal",Lp="point",Up="band",$p="bin-ordinal",Pp="continuous",jp="discrete",Ip="discretizing",Hp="interpolating";function Wp(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Yp(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const Vp=Symbol("implicit");function Gp(){var t=new Map,n=[],e=[],r=Vp;function i(i){var a=i+"",u=t.get(a);if(!u){if(r!==Vp)return r;t.set(a,u=n.push(i))}return e[(u-1)%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new Map;for(const r of e){const e=r+"";t.has(e)||t.set(e,n.push(r))}return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Gp(n,e).unknown(r)},Wp.apply(i,arguments),i}function Xp(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Jp(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Zp(){}var Qp="\\s*([+-]?\\d+)\\s*",Kp="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",tg="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",ng=/^#([0-9a-f]{3,8})$/,eg=new RegExp("^rgb\\("+[Qp,Qp,Qp]+"\\)$"),rg=new RegExp("^rgb\\("+[tg,tg,tg]+"\\)$"),ig=new RegExp("^rgba\\("+[Qp,Qp,Qp,Kp]+"\\)$"),ag=new RegExp("^rgba\\("+[tg,tg,tg,Kp]+"\\)$"),ug=new RegExp("^hsl\\("+[Kp,tg,tg]+"\\)$"),og=new RegExp("^hsla\\("+[Kp,tg,tg,Kp]+"\\)$"),sg={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 lg(){return this.rgb().formatHex()}function cg(){return this.rgb().formatRgb()}function fg(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=ng.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?hg(n):3===e?new mg(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?new mg(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?new mg(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=eg.exec(t))?new mg(n[1],n[2],n[3],1):(n=rg.exec(t))?new mg(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=ig.exec(t))?dg(n[1],n[2],n[3],n[4]):(n=ag.exec(t))?dg(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=ug.exec(t))?xg(n[1],n[2]/100,n[3]/100,1):(n=og.exec(t))?xg(n[1],n[2]/100,n[3]/100,n[4]):sg.hasOwnProperty(t)?hg(sg[t]):"transparent"===t?new mg(NaN,NaN,NaN,0):null}function hg(t){return new mg(t>>16&255,t>>8&255,255&t,1)}function dg(t,n,e,r){return r<=0&&(t=n=e=NaN),new mg(t,n,e,r)}function pg(t){return t instanceof Zp||(t=fg(t)),t?new mg((t=t.rgb()).r,t.g,t.b,t.opacity):new mg}function gg(t,n,e,r){return 1===arguments.length?pg(t):new mg(t,n,e,null==r?1:r)}function mg(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function vg(){return"#"+_g(this.r)+_g(this.g)+_g(this.b)}function yg(){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 _g(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function xg(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Ag(t,n,e,r)}function bg(t){if(t instanceof Ag)return new Ag(t.h,t.s,t.l,t.opacity);if(t instanceof Zp||(t=fg(t)),!t)return new Ag;if(t instanceof Ag)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),a=Math.max(n,e,r),u=NaN,o=a-i,s=(a+i)/2;return o?(u=n===a?(e-r)/o+6*(e<r):e===a?(r-n)/o+2:(n-e)/o+4,o/=s<.5?a+i:2-a-i,u*=60):o=s>0&&s<1?0:u,new Ag(u,o,s,t.opacity)}function wg(t,n,e,r){return 1===arguments.length?bg(t):new Ag(t,n,e,null==r?1:r)}function Ag(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function kg(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}Xp(Zp,fg,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:lg,formatHex:lg,formatHsl:function(){return bg(this).formatHsl()},formatRgb:cg,toString:cg}),Xp(mg,gg,Jp(Zp,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new mg(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new mg(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:vg,formatHex:vg,formatRgb:yg,toString:yg})),Xp(Ag,wg,Jp(Zp,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Ag(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Ag(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new mg(kg(t>=240?t-240:t+120,i,r),kg(t,i,r),kg(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+")")}}));var Mg=Math.PI/180,Eg=180/Math.PI,Dg=.96422,Cg=1,Fg=.82521,Sg=4/29,Bg=6/29,Tg=3*Bg*Bg,zg=Bg*Bg*Bg;function Ng(t){if(t instanceof Rg)return new Rg(t.l,t.a,t.b,t.opacity);if(t instanceof jg)return Ig(t);t instanceof mg||(t=pg(t));var n,e,r=$g(t.r),i=$g(t.g),a=$g(t.b),u=qg((.2225045*r+.7168786*i+.0606169*a)/Cg);return r===i&&i===a?n=e=u:(n=qg((.4360747*r+.3850649*i+.1430804*a)/Dg),e=qg((.0139322*r+.0971045*i+.7141733*a)/Fg)),new Rg(116*u-16,500*(n-u),200*(u-e),t.opacity)}function Og(t,n,e,r){return 1===arguments.length?Ng(t):new Rg(t,n,e,null==r?1:r)}function Rg(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function qg(t){return t>zg?Math.pow(t,1/3):t/Tg+Sg}function Lg(t){return t>Bg?t*t*t:Tg*(t-Sg)}function Ug(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function $g(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Pg(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof jg)return new jg(t.h,t.c,t.l,t.opacity);if(t instanceof Rg||(t=Ng(t)),0===t.a&&0===t.b)return new jg(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*Eg;return new jg(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new jg(t,n,e,null==r?1:r)}function jg(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function Ig(t){if(isNaN(t.h))return new Rg(t.l,0,0,t.opacity);var n=t.h*Mg;return new Rg(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}Xp(Rg,Og,Jp(Zp,{brighter:function(t){return new Rg(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new Rg(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new mg(Ug(3.1338561*(n=Dg*Lg(n))-1.6168667*(t=Cg*Lg(t))-.4906146*(e=Fg*Lg(e))),Ug(-.9787684*n+1.9161415*t+.033454*e),Ug(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),Xp(jg,Pg,Jp(Zp,{brighter:function(t){return new jg(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new jg(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return Ig(this).rgb()}}));var Hg=-.14861,Wg=1.78277,Yg=-.29227,Vg=-.90649,Gg=1.97294,Xg=Gg*Vg,Jg=Gg*Wg,Zg=Wg*Yg-Vg*Hg;function Qg(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Kg)return new Kg(t.h,t.s,t.l,t.opacity);t instanceof mg||(t=pg(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Zg*r+Xg*n-Jg*e)/(Zg+Xg-Jg),a=r-i,u=(Gg*(e-i)-Yg*a)/Vg,o=Math.sqrt(u*u+a*a)/(Gg*i*(1-i)),s=o?Math.atan2(u,a)*Eg-120:NaN;return new Kg(s<0?s+360:s,o,i,t.opacity)}(t):new Kg(t,n,e,null==r?1:r)}function Kg(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function tm(t,n,e,r,i){var a=t*t,u=a*t;return((1-3*t+3*a-u)*n+(4-6*a+3*u)*e+(1+3*t+3*a-3*u)*r+u*i)/6}function nm(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],a=t[r+1],u=r>0?t[r-1]:2*i-a,o=r<n-1?t[r+2]:2*a-i;return tm((e-r/n)*n,u,i,a,o)}}function em(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],a=t[r%n],u=t[(r+1)%n],o=t[(r+2)%n];return tm((e-r/n)*n,i,a,u,o)}}function rm(t){return function(){return t}}function im(t,n){return function(e){return t+e*n}}function am(t,n){var e=n-t;return e?im(t,e>180||e<-180?e-360*Math.round(e/360):e):rm(isNaN(t)?n:t)}function um(t){return 1==(t=+t)?om:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):rm(isNaN(n)?e:n)}}function om(t,n){var e=n-t;return e?im(t,e):rm(isNaN(t)?n:t)}Xp(Kg,Qg,Jp(Zp,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Kg(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Kg(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*Mg,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new mg(255*(n+e*(Hg*r+Wg*i)),255*(n+e*(Yg*r+Vg*i)),255*(n+e*(Gg*r)),this.opacity)}}));var sm=function t(n){var e=um(n);function r(t,n){var r=e((t=gg(t)).r,(n=gg(n)).r),i=e(t.g,n.g),a=e(t.b,n.b),u=om(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=a(n),t.opacity=u(n),t+""}}return r.gamma=t,r}(1);function lm(t){return function(n){var e,r,i=n.length,a=new Array(i),u=new Array(i),o=new Array(i);for(e=0;e<i;++e)r=gg(n[e]),a[e]=r.r||0,u[e]=r.g||0,o[e]=r.b||0;return a=t(a),u=t(u),o=t(o),r.opacity=1,function(t){return r.r=a(t),r.g=u(t),r.b=o(t),r+""}}}var cm=lm(nm),fm=lm(em);function hm(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(a){for(e=0;e<r;++e)i[e]=t[e]*(1-a)+n[e]*a;return i}}function dm(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function pm(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),u=new Array(r);for(e=0;e<i;++e)a[e]=bm(t[e],n[e]);for(;e<r;++e)u[e]=n[e];return function(t){for(e=0;e<i;++e)u[e]=a[e](t);return u}}function gm(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function mm(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function vm(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=bm(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var ym=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_m=new RegExp(ym.source,"g");function xm(t,n){var e,r,i,a=ym.lastIndex=_m.lastIndex=0,u=-1,o=[],s=[];for(t+="",n+="";(e=ym.exec(t))&&(r=_m.exec(n));)(i=r.index)>a&&(i=n.slice(a,i),o[u]?o[u]+=i:o[++u]=i),(e=e[0])===(r=r[0])?o[u]?o[u]+=r:o[++u]=r:(o[++u]=null,s.push({i:u,x:mm(e,r)})),a=_m.lastIndex;return a<n.length&&(i=n.slice(a),o[u]?o[u]+=i:o[++u]=i),o.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)o[(e=s[r]).i]=e.x(t);return o.join("")})}function bm(t,n){var e,r=typeof n;return null==n||"boolean"===r?rm(n):("number"===r?mm:"string"===r?(e=fg(n))?(n=e,sm):xm:n instanceof fg?sm:n instanceof Date?gm:dm(n)?hm:Array.isArray(n)?pm:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?vm:mm)(t,n)}function wm(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Am,km,Mm,Em,Dm=180/Math.PI,Cm={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fm(t,n,e,r,i,a){var u,o,s;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(o=Math.sqrt(e*e+r*r))&&(e/=o,r/=o,s/=o),t*r<n*e&&(t=-t,n=-n,s=-s,u=-u),{translateX:i,translateY:a,rotate:Math.atan2(n,t)*Dm,skewX:Math.atan(s)*Dm,scaleX:u,scaleY:o}}function Sm(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(a,u){var o=[],s=[];return a=t(a),u=t(u),function(t,r,i,a,u,o){if(t!==i||r!==a){var s=u.push("translate(",null,n,null,e);o.push({i:s-4,x:mm(t,i)},{i:s-2,x:mm(r,a)})}else(i||a)&&u.push("translate("+i+n+a+e)}(a.translateX,a.translateY,u.translateX,u.translateY,o,s),function(t,n,e,a){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(i(e)+"rotate(",null,r)-2,x:mm(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(a.rotate,u.rotate,o,s),function(t,n,e,a){t!==n?a.push({i:e.push(i(e)+"skewX(",null,r)-2,x:mm(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(a.skewX,u.skewX,o,s),function(t,n,e,r,a,u){if(t!==e||n!==r){var o=a.push(i(a)+"scale(",null,",",null,")");u.push({i:o-4,x:mm(t,e)},{i:o-2,x:mm(n,r)})}else 1===e&&1===r||a.push(i(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,u.scaleX,u.scaleY,o,s),a=u=null,function(t){for(var n,e=-1,r=s.length;++e<r;)o[(n=s[e]).i]=n.x(t);return o.join("")}}}var Bm=Sm((function(t){return"none"===t?Cm:(Am||(Am=document.createElement("DIV"),km=document.documentElement,Mm=document.defaultView),Am.style.transform=t,t=Mm.getComputedStyle(km.appendChild(Am),null).getPropertyValue("transform"),km.removeChild(Am),Fm(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))}),"px, ","px)","deg)"),Tm=Sm((function(t){return null==t?Cm:(Em||(Em=document.createElementNS("http://www.w3.org/2000/svg","g")),Em.setAttribute("transform",t),(t=Em.transform.baseVal.consolidate())?Fm((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Cm)}),", ",")",")"),zm=Math.SQRT2,Nm=2,Om=4,Rm=1e-12;function qm(t){return((t=Math.exp(t))+1/t)/2}function Lm(t){return function(n,e){var r=t((n=wg(n)).h,(e=wg(e)).h),i=om(n.s,e.s),a=om(n.l,e.l),u=om(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=a(t),n.opacity=u(t),n+""}}}var Um=Lm(am),$m=Lm(om);function Pm(t){return function(n,e){var r=t((n=Pg(n)).h,(e=Pg(e)).h),i=om(n.c,e.c),a=om(n.l,e.l),u=om(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=a(t),n.opacity=u(t),n+""}}}var jm=Pm(am),Im=Pm(om);function Hm(t){return function n(e){function r(n,r){var i=t((n=Qg(n)).h,(r=Qg(r)).h),a=om(n.s,r.s),u=om(n.l,r.l),o=om(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=a(t),n.l=u(Math.pow(t,e)),n.opacity=o(t),n+""}}return e=+e,r.gamma=n,r}(1)}var Wm=Hm(am),Ym=Hm(om);function Vm(t,n){for(var e=0,r=n.length-1,i=n[0],a=new Array(r<0?0:r);e<r;)a[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return a[n](t-n)}}var Gm=Object.freeze({__proto__:null,interpolate:bm,interpolateArray:function(t,n){return(dm(n)?hm:pm)(t,n)},interpolateBasis:nm,interpolateBasisClosed:em,interpolateDate:gm,interpolateDiscrete:function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},interpolateHue:function(t,n){var e=am(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},interpolateNumber:mm,interpolateNumberArray:hm,interpolateObject:vm,interpolateRound:wm,interpolateString:xm,interpolateTransformCss:Bm,interpolateTransformSvg:Tm,interpolateZoom:function(t,n){var e,r,i=t[0],a=t[1],u=t[2],o=n[0],s=n[1],l=n[2],c=o-i,f=s-a,h=c*c+f*f;if(h<Rm)r=Math.log(l/u)/zm,e=function(t){return[i+t*c,a+t*f,u*Math.exp(zm*t*r)]};else{var d=Math.sqrt(h),p=(l*l-u*u+Om*h)/(2*u*Nm*d),g=(l*l-u*u-Om*h)/(2*l*Nm*d),m=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(g*g+1)-g);r=(v-m)/zm,e=function(t){var n=t*r,e=qm(m),o=u/(Nm*d)*(e*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(zm*n+m)-function(t){return((t=Math.exp(t))-1/t)/2}(m));return[i+o*c,a+o*f,u*e/qm(zm*n+m)]}}return e.duration=1e3*r,e},interpolateRgb:sm,interpolateRgbBasis:cm,interpolateRgbBasisClosed:fm,interpolateHsl:Um,interpolateHslLong:$m,interpolateLab:function(t,n){var e=om((t=Og(t)).l,(n=Og(n)).l),r=om(t.a,n.a),i=om(t.b,n.b),a=om(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=a(n),t+""}},interpolateHcl:jm,interpolateHclLong:Im,interpolateCubehelix:Wm,interpolateCubehelixLong:Ym,piecewise:Vm,quantize:function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e}});function Xm(t){return+t}var Jm=[0,1];function Zm(t){return t}function Qm(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function Km(t,n,e){var r=t[0],i=t[1],a=n[0],u=n[1];return i<r?(r=Qm(i,r),a=e(u,a)):(r=Qm(r,i),a=e(a,u)),function(t){return a(r(t))}}function tv(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),a=new Array(r),u=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<r;)i[u]=Qm(t[u],t[u+1]),a[u]=e(n[u],n[u+1]);return function(n){var e=gi(t,n,1,r)-1;return a[e](i[e](n))}}function nv(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ev(){var t,n,e,r,i,a,u=Jm,o=Jm,s=bm,l=Zm;function c(){var t=Math.min(u.length,o.length);return l!==Zm&&(l=function(t,n){var e;return t>n&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(u[0],u[t-1])),r=t>2?tv:Km,i=a=null,f}function f(n){return isNaN(n=+n)?e:(i||(i=r(u.map(t),o,s)))(t(l(n)))}return f.invert=function(e){return l(n((a||(a=r(o,u.map(t),mm)))(e)))},f.domain=function(t){return arguments.length?(u=Array.from(t,Xm),c()):u.slice()},f.range=function(t){return arguments.length?(o=Array.from(t),c()):o.slice()},f.rangeRound=function(t){return o=Array.from(t),s=wm,c()},f.clamp=function(t){return arguments.length?(l=!!t||Zm,c()):l!==Zm},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(e=t,f):e},function(e,r){return t=e,n=r,c()}}function rv(){return ev()(Zm,Zm)}function iv(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function av(t){return(t=iv(Math.abs(t)))?t[1]:NaN}var uv,ov=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function sv(t){if(!(n=ov.exec(t)))throw new Error("invalid format: "+t);var n;return new lv({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function lv(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 cv(t,n){var e=iv(t,n);if(!e)return t+"";var r=e[0],i=e[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")}sv.prototype=lv.prototype,lv.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 fv={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return cv(100*t,n)},r:cv,s:function(t,n){var e=iv(t,n);if(!e)return t+"";var r=e[0],i=e[1],a=i-(uv=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return a===u?r:a>u?r+new Array(a-u+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+iv(t,Math.max(0,n+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function hv(t){return t}var dv,pv,gv,mv=Array.prototype.map,vv=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function yv(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?hv:(n=mv.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,a=[],u=0,o=n[0],s=0;i>0&&o>0&&(s+o+1>r&&(o=Math.max(1,r-s)),a.push(t.substring(i-=o,i+o)),!((s+=o+1)>r));)o=n[u=(u+1)%n.length];return a.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",a=void 0===t.currency?"":t.currency[1]+"",u=void 0===t.decimal?".":t.decimal+"",o=void 0===t.numerals?hv:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(mv.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 n=(t=sv(t)).fill,e=t.align,f=t.sign,h=t.symbol,d=t.zero,p=t.width,g=t.comma,m=t.precision,v=t.trim,y=t.type;"n"===y?(g=!0,y="g"):fv[y]||(void 0===m&&(m=12),v=!0,y="g"),(d||"0"===n&&"="===e)&&(d=!0,n="0",e="=");var _="$"===h?i:"#"===h&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",x="$"===h?a:/[%p]/.test(y)?s:"",b=fv[y],w=/[defgprs%]/.test(y);function A(t){var i,a,s,h=_,A=x;if("c"===y)A=b(t)+A,t="";else{var k=(t=+t)<0;if(t=isNaN(t)?c:b(Math.abs(t),m),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),k&&0==+t&&(k=!1),h=(k?"("===f?f:l:"-"===f||"("===f?"":f)+h,A=("s"===y?vv[8+uv/3]:"")+A+(k&&"("===f?")":""),w)for(i=-1,a=t.length;++i<a;)if(48>(s=t.charCodeAt(i))||s>57){A=(46===s?u+t.slice(i+1):t.slice(i))+A,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var M=h.length+t.length+A.length,E=M<p?new Array(p-M+1).join(n):"";switch(g&&d&&(t=r(E+t,E.length?p-A.length:1/0),E=""),e){case"<":t=h+t+A+E;break;case"=":t=h+E+t+A;break;case"^":t=E.slice(0,M=E.length>>1)+h+t+A+E.slice(M);break;default:t=E+h+t+A}return o(t)}return m=void 0===m?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,m)):Math.max(0,Math.min(20,m)),A.toString=function(){return t+""},A}return{format:f,formatPrefix:function(t,n){var e=f(((t=sv(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(av(n)/3))),i=Math.pow(10,-r),a=vv[8+r/3];return function(t){return e(i*t)+a}}}}function _v(t){return dv=yv(t),pv=dv.format,gv=dv.formatPrefix,dv}function xv(t,n,e,r){var i,a=Ai(t,n,e);switch((r=sv(null==r?",f":r)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(av(n)/3)))-av(Math.abs(t)))}(a,u))||(r.precision=i),gv(r,u);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,av(n)-av(t))+1}(a,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-av(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return pv(r)}function bv(t){var n=t.domain;return t.ticks=function(t){var e=n();return bi(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return xv(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),a=0,u=i.length-1,o=i[a],s=i[u];return s<o&&(r=o,o=s,s=r,r=a,a=u,u=r),(r=wi(o,s,e))>0?r=wi(o=Math.floor(o/r)*r,s=Math.ceil(s/r)*r,e):r<0&&(r=wi(o=Math.ceil(o*r)/r,s=Math.floor(s*r)/r,e)),r>0?(i[a]=Math.floor(o/r)*r,i[u]=Math.ceil(s/r)*r,n(i)):r<0&&(i[a]=Math.ceil(o*r)/r,i[u]=Math.floor(s*r)/r,n(i)),t},t}function wv(t,n){var e,r=0,i=(t=t.slice()).length-1,a=t[r],u=t[i];return u<a&&(e=r,r=i,i=e,e=a,a=u,u=e),t[r]=n.floor(a),t[i]=n.ceil(u),t}function Av(t){return Math.log(t)}function kv(t){return Math.exp(t)}function Mv(t){return-Math.log(-t)}function Ev(t){return-Math.exp(-t)}function Dv(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Cv(t){return function(n){return-t(-n)}}function Fv(t){var n,e,r=t(Av,kv),i=r.domain,a=10;function u(){return n=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}(a),e=function(t){return 10===t?Dv:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}(a),i()[0]<0?(n=Cv(n),e=Cv(e),t(Mv,Ev)):t(Av,kv),r}return r.base=function(t){return arguments.length?(a=+t,u()):a},r.domain=function(t){return arguments.length?(i(t),u()):i()},r.ticks=function(t){var r,u=i(),o=u[0],s=u[u.length-1];(r=s<o)&&(h=o,o=s,s=h);var l,c,f,h=n(o),d=n(s),p=null==t?10:+t,g=[];if(!(a%1)&&d-h<p){if(h=Math.floor(h),d=Math.ceil(d),o>0){for(;h<=d;++h)for(c=1,l=e(h);c<a;++c)if(!((f=l*c)<o)){if(f>s)break;g.push(f)}}else for(;h<=d;++h)for(c=a-1,l=e(h);c>=1;--c)if(!((f=l*c)<o)){if(f>s)break;g.push(f)}2*g.length<p&&(g=bi(o,s,p))}else g=bi(h,d,Math.min(d-h,p)).map(e);return r?g.reverse():g},r.tickFormat=function(t,i){if(null==i&&(i=10===a?".0e":","),"function"!=typeof i&&(i=pv(i)),t===1/0)return i;null==t&&(t=10);var u=Math.max(1,a*t/r.ticks().length);return function(t){var r=t/e(Math.round(n(t)));return r*a<a-.5&&(r*=a),r<=u?i(t):""}},r.nice=function(){return i(wv(i(),{floor:function(t){return e(Math.floor(n(t)))},ceil:function(t){return e(Math.ceil(n(t)))}}))},r}function Sv(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Bv(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function Tv(t){var n=1,e=t(Sv(n),Bv(n));return e.constant=function(e){return arguments.length?t(Sv(n=+e),Bv(n)):n},bv(e)}function zv(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function Nv(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Ov(t){return t<0?-t*t:t*t}function Rv(t){var n=t(Zm,Zm),e=1;function r(){return 1===e?t(Zm,Zm):.5===e?t(Nv,Ov):t(zv(e),zv(1/e))}return n.exponent=function(t){return arguments.length?(e=+t,r()):e},bv(n)}function qv(){var t=Rv(ev());return t.copy=function(){return nv(t,qv()).exponent(t.exponent())},Wp.apply(t,arguments),t}_v({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"});var Lv=1e3,Uv=60*Lv,$v=60*Uv,Pv=24*$v,jv=7*Pv,Iv=30*Pv,Hv=365*Pv;function Wv(t){return new Date(t)}function Yv(t){return t instanceof Date?+t:+new Date(+t)}function Vv(t,n,e,r,i,a,u,o,s){var l=rv(),c=l.invert,f=l.domain,h=s(".%L"),d=s(":%S"),p=s("%I:%M"),g=s("%I %p"),m=s("%a %d"),v=s("%b %d"),y=s("%B"),_=s("%Y"),x=[[u,1,Lv],[u,5,5*Lv],[u,15,15*Lv],[u,30,30*Lv],[a,1,Uv],[a,5,5*Uv],[a,15,15*Uv],[a,30,30*Uv],[i,1,$v],[i,3,3*$v],[i,6,6*$v],[i,12,12*$v],[r,1,Pv],[r,2,2*Pv],[e,1,jv],[n,1,Iv],[n,3,3*Iv],[t,1,Hv]];function b(o){return(u(o)<o?h:a(o)<o?d:i(o)<o?p:r(o)<o?g:n(o)<o?e(o)<o?m:v:t(o)<o?y:_)(o)}function w(n,e,r){if(null==n&&(n=10),"number"==typeof n){var i,a=Math.abs(r-e)/n,u=di((function(t){return t[2]})).right(x,a);return u===x.length?(i=Ai(e/Hv,r/Hv,n),n=t):u?(i=(u=x[a/x[u-1][2]<x[u][2]/a?u-1:u])[1],n=u[0]):(i=Math.max(Ai(e,r,n),1),n=o),n.every(i)}return n}return l.invert=function(t){return new Date(c(t))},l.domain=function(t){return arguments.length?f(Array.from(t,Yv)):f().map(Wv)},l.ticks=function(t){var n,e=f(),r=e[0],i=e[e.length-1],a=i<r;return a&&(n=r,r=i,i=n),n=(n=w(t,r,i))?n.range(r,i+1):[],a?n.reverse():n},l.tickFormat=function(t,n){return null==n?b:s(n)},l.nice=function(t){var n=f();return(t=w(t,n[0],n[n.length-1]))?f(wv(n,t)):l},l.copy=function(){return nv(l,Vv(t,n,e,r,i,a,u,o,s))},l}function Gv(){var t,n,e,r,i,a=0,u=1,o=Zm,s=!1;function l(n){return isNaN(n=+n)?i:o(0===e?.5:(n=(r(n)-t)*e,s?Math.max(0,Math.min(1,n)):n))}function c(t){return function(n){var e,r;return arguments.length?([e,r]=n,o=t(e,r),l):[o(0),o(1)]}}return l.domain=function(i){return arguments.length?([a,u]=i,t=r(a=+a),n=r(u=+u),e=t===n?0:1/(n-t),l):[a,u]},l.clamp=function(t){return arguments.length?(s=!!t,l):s},l.interpolator=function(t){return arguments.length?(o=t,l):o},l.range=c(bm),l.rangeRound=c(wm),l.unknown=function(t){return arguments.length?(i=t,l):i},function(i){return r=i,t=i(a),n=i(u),e=t===n?0:1/(n-t),l}}function Xv(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Jv(){var t=bv(Gv()(Zm));return t.copy=function(){return Xv(t,Jv())},Yp.apply(t,arguments)}function Zv(){var t=Rv(Gv());return t.copy=function(){return Xv(t,Zv()).exponent(t.exponent())},Yp.apply(t,arguments)}function Qv(){var t,n,e,r,i,a,u,o=0,s=.5,l=1,c=1,f=Zm,h=!1;function d(t){return isNaN(t=+t)?u:(t=.5+((t=+a(t))-n)*(c*t<c*n?r:i),f(h?Math.max(0,Math.min(1,t)):t))}function p(t){return function(n){var e,r,i;return arguments.length?([e,r,i]=n,f=Vm(t,[e,r,i]),d):[f(0),f(.5),f(1)]}}return d.domain=function(u){return arguments.length?([o,s,l]=u,t=a(o=+o),n=a(s=+s),e=a(l=+l),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),c=n<t?-1:1,d):[o,s,l]},d.clamp=function(t){return arguments.length?(h=!!t,d):h},d.interpolator=function(t){return arguments.length?(f=t,d):f},d.range=p(bm),d.rangeRound=p(wm),d.unknown=function(t){return arguments.length?(u=t,d):u},function(u){return a=u,t=u(o),n=u(s),e=u(l),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),c=n<t?-1:1,d}}function Kv(){var t=Rv(Qv());return t.copy=function(){return Xv(t,Kv()).exponent(t.exponent())},Yp.apply(t,arguments)}function ty(){var t,n,e=Gp().unknown(void 0),r=e.domain,i=e.range,a=[0,1],u=!1,o=0,s=0,l=.5;function c(){var e=r().length,c=a[1]<a[0],f=a[c-0],h=a[1-c],d=kp(e,o,s);t=(h-f)/(d||1),u&&(t=Math.floor(t)),f+=(h-f-t*(e-o))*l,n=t*(1-o),u&&(f=Math.round(f),n=Math.round(n));var p=vi(e).map((function(n){return f+t*n}));return i(c?p.reverse():p)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),c()):r()},e.range=function(t){return arguments.length?(a=[+t[0],+t[1]],c()):a.slice()},e.rangeRound=function(t){return a=[+t[0],+t[1]],u=!0,c()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(u=!!t,c()):u},e.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),o=s,c()):o},e.paddingInner=function(t){return arguments.length?(o=Math.max(0,Math.min(1,t)),c()):o},e.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},e.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},e.invertRange=function(t){if(null!=t[0]&&null!=t[1]){var e,u,o,s=+t[0],l=+t[1],c=a[1]<a[0],f=c?i().reverse():i(),h=f.length-1;if(s==s&&l==l&&(l<s&&(o=s,s=l,l=o),!(l<f[0]||s>a[1-c])))return e=Math.max(0,gi(f,s)-1),u=s===l?e:gi(f,l)-1,s-f[e]>n+1e-10&&++e,c&&(o=e,e=h-u,u=h-o),e>u?void 0:r().slice(e,u+1)}},e.invert=function(t){var n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return ty().domain(r()).range(a).round(u).paddingInner(o).paddingOuter(s).align(l)},c()}var ny=Array.prototype.map;function ey(t){return ny.call(t,(function(t){return+t}))}var ry=Array.prototype.slice;const iy={};function ay(t,n,e){return arguments.length>1?(iy[t]=function(t,n,e){const r=function(){var e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){var e,r=n[0],i=n[1];return i<r&&(e=r,r=i,i=e),[t.invert(r),t.invert(i)]}}(e):e.invertExtent?function(t){return function(n){var e,r,i,a,u=t.range(),o=n[0],s=n[1],l=-1;for(s<o&&(r=o,o=s,s=r),i=0,a=u.length;i<a;++i)u[i]>=o&&u[i]<=s&&(l<0&&(l=i),e=i);if(!(l<0))return o=t.invertExtent(u[l]),s=t.invertExtent(u[e]),[void 0===o[0]?o[1]:o[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,e};return r.metadata=At(V(e)),r}(t,n,e),this):uy(t)?iy[t]:void 0}function uy(t){return rt(iy,t)}function oy(t,n){const e=iy[t];return e&&e.metadata[n]}function sy(t){return oy(t,Pp)}function ly(t){return oy(t,jp)}function cy(t){return oy(t,Ip)}function fy(t){return oy(t,Ep)}function hy(t){return oy(t,Hp)}function dy(t){return oy(t,Np)}ay("identity",(function t(n){var e;function r(t){return isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,Xm),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,Xm):[0,1],bv(r)})),ay(Mp,(function t(){var n=rv();return n.copy=function(){return nv(n,t())},Wp.apply(n,arguments),bv(n)}),Pp),ay(Ep,(function t(){var n=Fv(ev()).domain([1,10]);return n.copy=function(){return nv(n,t()).base(n.base())},Wp.apply(n,arguments),n}),[Pp,Ep]),ay(Dp,qv,Pp),ay(Cp,(function(){return qv.apply(null,arguments).exponent(.5)}),Pp),ay(Fp,(function t(){var n=Tv(ev());return n.copy=function(){return nv(n,t()).constant(n.constant())},Wp.apply(n,arguments)}),Pp),ay(Sp,(function(){return Wp.apply(Vv(ne,te,Zn,Xn,Gn,Vn,Yn,In,ge).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[Pp,"temporal"]),ay(Bp,(function(){return Wp.apply(Vv(ce,le,ue,ie,re,ee,Yn,In,ve).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[Pp,"temporal"]),ay(Tp,Jv,[Pp,Hp]),ay(`${Tp}-${Mp}`,Jv,[Pp,Hp]),ay(`${Tp}-${Ep}`,(function t(){var n=Fv(Gv()).domain([1,10]);return n.copy=function(){return Xv(n,t()).base(n.base())},Yp.apply(n,arguments)}),[Pp,Hp,Ep]),ay(`${Tp}-${Dp}`,Zv,[Pp,Hp]),ay(`${Tp}-${Cp}`,(function(){return Zv.apply(null,arguments).exponent(.5)}),[Pp,Hp]),ay(`${Tp}-${Fp}`,(function t(){var n=Tv(Gv());return n.copy=function(){return Xv(n,t()).constant(n.constant())},Yp.apply(n,arguments)}),[Pp,Hp]),ay(`${zp}-${Mp}`,(function t(){var n=bv(Qv()(Zm));return n.copy=function(){return Xv(n,t())},Yp.apply(n,arguments)}),[Pp,Hp]),ay(`${zp}-${Ep}`,(function t(){var n=Fv(Qv()).domain([.1,1,10]);return n.copy=function(){return Xv(n,t()).base(n.base())},Yp.apply(n,arguments)}),[Pp,Hp,Ep]),ay(`${zp}-${Dp}`,Kv,[Pp,Hp]),ay(`${zp}-${Cp}`,(function(){return Kv.apply(null,arguments).exponent(.5)}),[Pp,Hp]),ay(`${zp}-${Fp}`,(function t(){var n=Tv(Qv());return n.copy=function(){return Xv(n,t()).constant(n.constant())},Yp.apply(n,arguments)}),[Pp,Hp]),ay(Np,(function t(){var n,e=[],r=[],i=[];function a(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t<n;)i[t-1]=Ci(e,t/n);return u}function u(t){return isNaN(t=+t)?n:r[gi(i,t)]}return u.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?i[n-1]:e[0],n<i.length?i[n]:e[e.length-1]]},u.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(hi),a()},u.range=function(t){return arguments.length?(r=Array.from(t),a()):r.slice()},u.unknown=function(t){return arguments.length?(n=t,u):n},u.quantiles=function(){return i.slice()},u.copy=function(){return t().domain(e).range(r).unknown(n)},Wp.apply(u,arguments)}),[Ip,Np]),ay(Op,(function t(){var n,e=0,r=1,i=1,a=[.5],u=[0,1];function o(t){return t<=t?u[gi(a,t,0,i)]:n}function s(){var t=-1;for(a=new Array(i);++t<i;)a[t]=((t+1)*r-(t-i)*e)/(i+1);return o}return o.domain=function(t){return arguments.length?([e,r]=t,e=+e,r=+r,s()):[e,r]},o.range=function(t){return arguments.length?(i=(u=Array.from(t)).length-1,s()):u.slice()},o.invertExtent=function(t){var n=u.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,a[0]]:n>=i?[a[i-1],r]:[a[n-1],a[n]]},o.unknown=function(t){return arguments.length?(n=t,o):o},o.thresholds=function(){return a.slice()},o.copy=function(){return t().domain([e,r]).range(u).unknown(n)},Wp.apply(bv(o),arguments)}),Ip),ay(Rp,(function t(){var n,e=[.5],r=[0,1],i=1;function a(t){return t<=t?r[gi(e,t,0,i)]:n}return a.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},a.unknown=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},Wp.apply(a,arguments)}),Ip),ay($p,(function t(){var n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(gi(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=ey(t),r):n.slice()},r.range=function(t){return arguments.length?(e=ry.call(t),r):e.slice()},r.tickFormat=function(t,e){return xv(n[0],C(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[jp,Ip]),ay(qp,Gp,jp),ay(Up,ty,jp),ay(Lp,(function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,n.copy=function(){return t(e())},n}(ty().paddingInner(1))}),jp);const py=["clamp","base","constant","exponent"];function gy(t,n){var e=n[0],r=C(n)-e;return function(n){return t(e+n*r)}}function my(t,n,e){return Vm(_y(n||"rgb",e),t)}function vy(t,n){for(var e=new Array(n),r=n+1,i=0;i<n;)e[i]=t(++i/r);return e}function yy(t,n,e){var r,i,a,u=e-n;return u&&Number.isFinite(u)?(r=(i=t.type).indexOf("-"),i=r<0?i:i.slice(r+1),a=ay(i)().domain([n,e]).range([0,1]),py.forEach(n=>t[n]?a[n](t[n]()):0),a):Z(.5)}function _y(t,n){var e=Gm[function(t){return"interpolate"+t.toLowerCase().split("-").map((function(t){return t[0].toUpperCase()+t.slice(1)})).join("")}(t)];return null!=n&&e&&e.gamma?e.gamma(n):e}function xy(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}function by(t,n){for(let e in t)Ay(e,n(t[e]))}const wy={};function Ay(t,n){return t=t&&t.toLowerCase(),arguments.length>1?(wy[t]=n,this):wy[t]}function ky(t,n,e){var r;return ft(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),null!=e&&(n=Math.min(n,~~(yt(t.domain())/e)||1))),o(n)&&(r=n.step,n=n.interval),s(n)&&(n=t.type===Sp?uo(n):t.type==Bp?oo(n):i("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function My(t,n,e){var r=t.range(),i=Math.floor(r[0]),a=Math.ceil(C(r));if(i>a&&(r=a,a=i,i=r),n=n.filter((function(n){return n=t(n),i<=n&&n<=a})),e>0&&n.length>1){for(var u=[n[0],C(n)];n.length>e&&n.length>=3;)n=n.filter((function(t,n){return!(n%2)}));n.length<3&&(n=u)}return n}function Ey(t,n){return t.bins?My(t,t.bins):t.ticks?t.ticks(n):t.domain()}function Dy(t,n,e,r,i){var a,u,o=t.type,s=o===Sp||r===Sp?vo(e):o===Bp||r===Bp?yo(e):t.tickFormat?t.tickFormat(n,e):e?pv(e):String;if(fy(o)){var l=function(t){var n=sv(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return function(t,n){return function(e){var r,i,a=t(e),u=a.indexOf(n);if(u<0)return a;for(i=(r=function(t,n){var e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if((e=t.charCodeAt(r))>=48&&e<=57)return r+1}(a,u))<a.length?a.slice(r):"";--r>u;)if("0"!==a[r]){++r;break}return a.slice(0,r)+i}}(pv(n),pv(".1f")(1)[1])}return pv(n)}(e);s=i||t.bins?l:(a=s,u=l,t=>a(t)?u(t):"")}return s}function Cy(t){Qr.call(this,null,t)}function Fy(t){Qr.call(this,null,t)}function Sy(){return zt({})}function By(t){return t.exit}function Ty(t){Qr.call(this,null,t)}by({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"},xy),by({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",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",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=>my(xy(t))),ot(Cy,Qr).transform=function(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=this.value,i=t.scale,a=ky(i,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Dy(i,a,t.formatSpecifier,t.formatType,!!t.values),o=t.values?My(i,t.values,a):Ey(i,a);return r&&(e.rem=r),r=o.map((function(t,n){return zt({index:n/(o.length-1||1),value:t,label:u(t)})})),t.extra&&r.length&&r.push(zt({index:-1,extra:{value:r[0].value},label:""})),e.source=r,e.add=r,this.value=r,e},ot(Fy,Qr).transform=function(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),a=t.item||Sy,o=t.key||Bt,s=this.value;return u(r.encode)&&(r.encode=null),s&&(t.modified("key")||n.modified(o))&&i("DataJoin does not support modified key function or fields."),s||(n=n.addAll(),this.value=s=at().test(By),s.lookup=function(t){return s.get(o(t))}),n.visit(n.ADD,(function(t){var n=o(t),e=s.get(n);e?e.exit?(s.empty--,r.add.push(e)):r.mod.push(e):(s.set(n,e=a(t)),r.add.push(e)),e.datum=t,e.exit=!1})),n.visit(n.MOD,(function(t){var n=o(t),e=s.get(n);e&&(e.datum=t,r.mod.push(e))})),n.visit(n.REM,(function(t){var n=o(t),e=s.get(n);t!==e.datum||e.exit||(r.rem.push(e),e.exit=!0,++s.empty)})),n.changed(n.ADD_MOD)&&r.modifies("datum"),t.clean&&s.empty>e.cleanThreshold&&e.runAfter(s.clean),r},ot(Ty,Qr).transform=function(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,a=n.encode;if(u(a)){if(!e.changed()&&!a.every((function(t){return i[t]})))return n.StopPropagation;a=a[0],e.encode=null}var o="enter"===a,s=i.update||v,l=i.enter||v,c=i.exit||v,f=(a&&!o?i[a]:s)||v;if(n.changed(n.ADD)&&(n.visit(n.ADD,(function(n){l(n,t),s(n,t)})),e.modifies(l.output),e.modifies(s.output),f!==v&&f!==s&&(n.visit(n.ADD,(function(n){f(n,t)})),e.modifies(f.output))),n.changed(n.REM)&&c!==v&&(n.visit(n.REM,(function(n){c(n,t)})),e.modifies(c.output)),o||f!==v){var h=n.MOD|(t.modified()?n.REFLOW:0);o?(n.visit(h,(function(n){var i=l(n,t)||r;(f(n,t)||i)&&e.mod.push(n)})),e.mod.length&&e.modifies(l.output)):n.visit(h,(function(n){(f(n,t)||r)&&e.mod.push(n)})),e.mod.length&&e.modifies(f.output)}return e.changed()?e:n.StopPropagation};var zy="symbol",Ny="discrete";const Oy={[Np]:"quantiles",[Op]:"thresholds",[Rp]:"domain"},Ry={[Np]:"quantiles",[Op]:"domain"};function qy(t,n){return t.bins?function(t){const n=t.slice(0,-1);return n.max=C(t),n}(t.bins):Oy[t.type]?function(t){const n=[-1/0].concat(t);return n.max=1/0,n}(t[Oy[t.type]]()):Ey(t,n)}function Ly(t,n,e,r,i,a){const u=Ry[t.type]&&i!==Sp&&i!==Bp?function(t,n){var e,r=t[Ry[t.type]](),i=r.length,a=i>1?r[1]-r[0]:r[0];for(e=1;e<i;++e)a=Math.min(a,r[e]-r[e-1]);return xv(0,a,30,n)}(t,r):Dy(t,n,r,i,a);return e===zy&&function(t){return Oy[t.type]||t.bins}(t)?function(t){return function(n,e,r){var i=Uy(r[e+1],Uy(r.max,1/0)),a=$y(n,t),u=$y(i,t);return a&&u?a+" – "+u:u?"< "+u:"≥ "+a}}(u):e===Ny?function(t){return function(n,e){return e?t(n):null}}(u):function(t){return function(n){return t(n)}}(u)}function Uy(t,n){return null!=t?t:n}function $y(t,n){return Number.isFinite(t)?n(t):null}function Py(t){Qr.call(this,[],t)}ot(Py,Qr).transform=function(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,a,u,o=n.fork(n.NO_SOURCE|n.NO_FIELDS),s=this.value,l=t.type||zy,c=t.scale,f=+t.limit,h=ky(c,null==t.count?5:t.count,t.minstep),d=t.format||Ly(c,h,l,t.formatSpecifier,t.formatType,!!t.values),p=t.values||qy(c,h);return s&&(o.rem=s),l===zy?(f&&p.length>f?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),s=p.slice(0,f-1),u=!0):s=p,X(i=t.size)?(t.values||0!==c(s[0])||(s=s.slice(1)),a=s.reduce((function(n,e){return Math.max(n,i(e,t))}),0)):i=Z(a=i||8),s=s.map((function(n,e){return zt({index:e,label:d(n,e,s),value:n,offset:a,size:i(n,t)})})),u&&(u=p[s.length],s.push(zt({index:s.length,label:`…${p.length-s.length} entries`,value:u,offset:a,size:i(u,t)})))):"gradient"===l?(e=c.domain(),r=yy(c,e[0],C(e)),p.length<3&&!t.values&&e[0]!==C(e)&&(p=[e[0],C(e)]),s=p.map((function(t,n){return zt({index:n,label:d(t,n,p),value:t,perc:r(t)})}))):(i=p.length-1,r=function(t){var n=t.domain(),e=n.length-1,r=+n[0],i=+C(n),a=i-r;if(t.type===Rp){var u=e?a/e:.1;a=(i+=u)-(r-=u)}return function(t){return(t-r)/a}}(c),s=p.map((function(t,n){return zt({index:n,label:d(t,n,p),value:t,perc:n?r(t):0,perc2:n===i?1:r(p[n+1])})}))),o.source=s,o.add=s,this.value=s,o};var jy=at({line:Gy,"line-radial":function(t,n,e,r){return Gy(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},arc:Xy,"arc-radial":function(t,n,e,r){return Xy(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},curve:Jy,"curve-radial":function(t,n,e,r){return Jy(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},"orthogonal-horizontal":function(t,n,e,r){return"M"+t+","+n+"V"+r+"H"+e},"orthogonal-vertical":function(t,n,e,r){return"M"+t+","+n+"H"+e+"V"+r},"orthogonal-radial":function(t,n,e,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(e),o=Math.sin(e),s=Math.abs(e-t)>Math.PI?e<=t:e>t;return"M"+n*i+","+n*a+"A"+n+","+n+" 0 0,"+(s?1:0)+" "+n*u+","+n*o+"L"+r*u+","+r*o},"diagonal-horizontal":function(t,n,e,r){var i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":function(t,n,e,r){var i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":function(t,n,e,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(e),o=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*a+"C"+s*i+","+s*a+" "+s*u+","+s*o+" "+r*u+","+r*o}});function Iy(t){return t.source.x}function Hy(t){return t.source.y}function Wy(t){return t.target.x}function Yy(t){return t.target.y}function Vy(t){Qr.call(this,{},t)}function Gy(t,n,e,r){return"M"+t+","+n+"L"+e+","+r}function Xy(t,n,e,r){var i=e-t,a=r-n,u=Math.sqrt(i*i+a*a)/2;return"M"+t+","+n+"A"+u+","+u+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+e+","+r}function Jy(t,n,e,r){var i=e-t,a=r-n,u=.2*(i+a),o=.2*(a-i);return"M"+t+","+n+"C"+(t+u)+","+(n+o)+" "+(e+o)+","+(r-u)+" "+e+","+r}function Zy(t){Qr.call(this,null,t)}Vy.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"}]},ot(Vy,Qr).transform=function(t,n){var e=t.sourceX||Iy,r=t.sourceY||Hy,a=t.targetX||Wy,u=t.targetY||Yy,o=t.as||"path",s=t.orient||"vertical",l=t.shape||"line",c=jy.get(l+"-"+s)||jy.get(l);return c||i("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,(function(t){t[o]=c(e(t),r(t),a(t),u(t))})),n.reflow(t.modified()).modifies(o)},Zy.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"]}]},ot(Zy,Qr).transform=function(t,n){var e,r,i,a=t.as||["startAngle","endAngle"],u=a[0],o=a[1],s=t.field||g,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=n.source,h=f.map(s),d=h.length,p=l,m=(c-l)/Si(h),v=vi(d);for(t.sort&&v.sort((function(t,n){return h[t]-h[n]})),e=0;e<d;++e)i=h[v[e]],(r=f[v[e]])[u]=p,r[o]=p+=i*m;return this.value=h,n.reflow(t.modified()).modifies(a)};var Qy=5;function Ky(t){return sy(t)&&t!==Tp}var t_=At(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function n_(t){Qr.call(this,null,t),this.modified(!0)}function e_(t,n,e){fy(t)&&(Math.abs(n.reduce((function(t,n){return t+(n<0?-1:n>0?1:0)}),0))!==n.length&&e.warn("Log scale domain includes zero: "+l(n)));return n}function r_(t,n,e){return X(t)&&(n||e)?gy(t,i_(n||[0,1],e)):t}function i_(t,n){return n?t.slice().reverse():t}function a_(t){Qr.call(this,null,t)}ot(n_,Qr).transform=function(t,n){var e=n.dataflow,r=this.value,a=function(t){var n,e=t.type,r="";if(e===Tp)return Tp+"-"+Mp;(function(t){const n=t.type;return sy(n)&&n!==Sp&&n!==Bp&&(t.scheme||t.range&&t.range.length&&t.range.every(s))})(t)&&(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===n?Tp+"-":3===n?zp+"-":"");return(r+e||Mp).toLowerCase()}(t);for(a in r&&a===r.type||(this.value=r=ay(a)()),t)if(!t_[a]){if("padding"===a&&Ky(r.type))continue;X(r[a])?r[a](t[a]):e.warn("Unsupported scale property: "+a)}return function(t,n,e){var r=t.type,a=n.round||!1,o=n.range;if(null!=n.rangeStep)o=function(t,n,e){t!==Up&&t!==Lp&&i("Only band and point scales support rangeStep.");var r=(null!=n.paddingOuter?n.paddingOuter:n.padding)||0,a=t===Lp?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0;return[0,n.rangeStep*kp(e,a,r)]}(r,n,e);else if(n.scheme&&(o=function(t,n,e){var r,a,o=n.schemeExtent;u(n.scheme)?a=my(n.scheme,n.interpolate,n.interpolateGamma):(r=n.scheme.toLowerCase(),(a=Ay(r))||i(`Unrecognized scheme name: ${n.scheme}`));return e=t===Rp?e+1:t===$p?e-1:t===Np||t===Op?+n.schemeCount||Qy:e,hy(t)?r_(a,o,n.reverse):X(a)?vy(r_(a,o),e):t===qp?a:a.slice(0,e)}(r,n,e),X(o))){if(t.interpolator)return t.interpolator(o);i(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&hy(r))return t.interpolator(my(i_(o,n.reverse),n.interpolate,n.interpolateGamma));o&&n.interpolate&&t.interpolate?t.interpolate(_y(n.interpolate,n.interpolateGamma)):X(t.round)?t.round(a):X(t.rangeRound)&&t.interpolate(a?wm:bm);o&&t.range(i_(o,n.reverse))}(r,t,function(t,n,e){let r=n.bins;if(r&&!u(r)){let n=t.domain(),e=n[0],a=C(n),u=null==r.start?e:r.start,o=null==r.stop?a:r.stop,s=r.step;s||i("Scale bins parameter missing step property."),u<e&&(u=s*Math.ceil(e/s)),o>a&&(o=s*Math.floor(a/s)),r=vi(u,o+s/2,s)}r?t.bins=r:t.bins&&delete t.bins;t.type===$p&&(r?n.domain||n.domainRaw||(t.domain(r),e=r.length):t.bins=t.domain());return e}(r,t,function(t,n,e){var r=function(t,n,e){return n?(t.domain(e_(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,a,u=n.domain,o=t.type,s=n.zero||void 0===n.zero&&function(t){const n=t.type;return!t.bins&&(n===Mp||n===Dp||n===Cp)}(t);if(!u)return 0;Ky(o)&&n.padding&&u[0]!==C(u)&&(u=function(t,n,e,r,i,a){var u=Math.abs(C(e)-e[0]),o=u/(u-2*r),s=t===Ep?j(n,null,o):t===Cp?I(n,null,o,.5):t===Dp?I(n,null,o,i||1):t===Fp?H(n,null,o,a||1):P(n,null,o);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(o,u,n.range,n.padding,n.exponent,n.constant));(s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(u=u.slice()).length-1||1,s&&(u[0]>0&&(u[0]=0),u[i]<0&&(u[i]=0)),null!=n.domainMin&&(u[0]=n.domainMin),null!=n.domainMax&&(u[i]=n.domainMax),null!=n.domainMid&&(((a=n.domainMid)<u[0]||a>u[i])&&e.warn("Scale domainMid exceeds domain min or max.",a),u.splice(i,0,a)));t.domain(e_(o,u,e)),o===qp&&t.unknown(n.domainImplicit?Vp:void 0);n.nice&&t.nice&&t.nice(!0!==n.nice&&ky(t,n.nice)||null);return u.length}(r,t,e))),n.fork(n.NO_SOURCE|n.NO_FIELDS)},ot(a_,Qr).transform=function(t,n){var e=t.modified("sort")||n.changed(n.ADD)||n.modified(t.sort.fields)||n.modified("datum");return e&&n.source.sort(qt(t.sort)),this.modified(e),n};var u_=["y0","y1"];function o_(t){Qr.call(this,null,t)}function s_(t,n,e,r,i){for(var a,u=(n-t.sum)/2,o=t.length,s=0;s<o;++s)(a=t[s])[r]=u,a[i]=u+=Math.abs(e(a))}function l_(t,n,e,r,i){for(var a,u=1/t.sum,o=0,s=t.length,l=0,c=0;l<s;++l)(a=t[l])[r]=o,a[i]=o=u*(c+=Math.abs(e(a)))}function c_(t,n,e,r,i){for(var a,u,o=0,s=0,l=t.length,c=0;c<l;++c)(a=+e(u=t[c]))<0?(u[r]=s,u[i]=s+=a):(u[r]=o,u[i]=o+=a)}o_.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:"zero",values:["zero","center","normalize"]},{name:"as",type:"string",array:!0,length:2,default:u_}]},ot(o_,Qr).transform=function(t,n){var e,r,i,a,u=t.as||u_,o=u[0],s=u[1],l=qt(t.sort),c=t.field||g,f="center"===t.offset?s_:"normalize"===t.offset?l_:c_;for(e=function(t,n,e,r){var i,a,u,o,s,l,c,f,h,d=[],p=function(t){return t(s)};if(null==n)d.push(t.slice());else for(i={},a=0,u=t.length;a<u;++a)s=t[a],l=n.map(p),(c=i[l])||(i[l]=c=[],d.push(c)),c.push(s);for(l=0,h=0,o=d.length;l<o;++l){for(c=d[l],a=0,f=0,u=c.length;a<u;++a)f+=Math.abs(r(c[a]));c.sum=f,f>h&&(h=f),e&&c.sort(e)}return d.max=h,d}(n.source,t.groupby,l,c),r=0,i=e.length,a=e.max;r<i;++r)f(e[r],a,c,o,s);return n.reflow(t.modified()).modifies(u)};var f_=Object.freeze({__proto__:null,axisticks:Cy,datajoin:Fy,encode:Ty,legendentries:Py,linkpath:Vy,pie:Zy,scale:n_,sortitems:a_,stack:o_,validTicks:My});function h_(){}const d_=[[],[[[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 p_(){var t=1,n=1,e=o;function r(t,n){return n.map(n=>a(t,n))}function a(r,i){var a=[],o=[];return function(e,r,i){var a,o,s,l,c,f,h=new Array,d=new Array;a=o=-1,l=e[0]>=r,d_[l<<1].forEach(p);for(;++a<t-1;)s=l,l=e[a+1]>=r,d_[s|l<<1].forEach(p);d_[l<<0].forEach(p);for(;++o<n-1;){for(a=-1,l=e[o*t+t]>=r,c=e[o*t]>=r,d_[l<<1|c<<2].forEach(p);++a<t-1;)s=l,l=e[o*t+t+a+1]>=r,f=c,c=e[o*t+a+1]>=r,d_[s|l<<1|c<<2|f<<3].forEach(p);d_[l|c<<3].forEach(p)}a=-1,c=e[o*t]>=r,d_[c<<2].forEach(p);for(;++a<t-1;)f=c,c=e[o*t+a+1]>=r,d_[c<<2|f<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+a,t[0][1]+o],s=[t[1][0]+a,t[1][1]+o],l=u(r),c=u(s);(n=d[l])?(e=h[c])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(s),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(s),d[n.end=c]=n):(n=h[c])?(e=d[l])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(s),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=l]=n):h[l]=d[c]={start:l,end:c,ring:[r,s]}}d_[c<<3].forEach(p)}(r,i,(function(t){e(t,r,i),function(t){var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];for(;++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?a.push([t]):o.push(t)})),o.forEach((function(t){for(var n,e=0,r=a.length;e<r;++e)if(-1!==g_((n=a[e])[0],t))return void n.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function u(n){return 2*n[0]+n[1]*(t+1)*4}function o(e,r,i){e.forEach((function(e){var a,u=e[0],o=e[1],s=0|u,l=0|o,c=r[l*t+s];u>0&&u<t&&s===u&&(a=r[l*t+s-1],e[0]=u+(i-a)/(c-a)-.5),o>0&&o<n&&l===o&&(a=r[(l-1)*t+s],e[1]=o+(i-a)/(c-a)-.5)}))}return r.contour=a,r.size=function(e){if(!arguments.length)return[t,n];var a=Math.ceil(e[0]),u=Math.ceil(e[1]);return a>0&&u>0||i("invalid size"),t=a,n=u,r},r.smooth=function(t){return arguments.length?(e=t?o:h_,r):e===o},r}function g_(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=m_(t,n[r]))return e;return 0}function m_(t,n){for(var e=n[0],r=n[1],i=-1,a=0,u=t.length,o=u-1;a<u;o=a++){var s=t[a],l=s[0],c=s[1],f=t[o],h=f[0],d=f[1];if(v_(s,f,n))return 0;c>r!=d>r&&e<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function v_(t,n,e){var r,i,a,u;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=e[r],u=n[r],i<=a&&a<=u||u<=a&&a<=i)}function y_(t,n,e){return function(r){var i=tt(r),a=e?Math.min(i[0],0):i[0],u=i[1],o=u-a,s=n?Ai(a,u,t):o/(t+1);return vi(s,u,s)}}function __(t){Qr.call(this,null,t)}function x_(t,n,e,r,i){const a=t.x1||0,u=t.y1||0,o=n*e<0;function s(t){t.forEach(l)}function l(t){o&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-a)*n+r,t[1]=(t[1]-u)*e+i}return function(t){return t.coordinates.forEach(s),t}}function b_(t,n,e){const r=t>=0?t:zi(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function w_(t){return X(t)?t:Z(+t)}function A_(){var t=t=>t[0],n=t=>t[1],e=g,r=[-1,-1],a=960,u=500,o=2;function s(i,s){const l=b_(r[0],i,t)>>o,c=b_(r[1],i,n)>>o,f=l?l+2:0,h=c?c+2:0,d=2*f+(a>>o),p=2*h+(u>>o),g=new Float32Array(d*p),m=new Float32Array(d*p);let v=g;i.forEach(r=>{const i=f+(+t(r)>>o),a=h+(+n(r)>>o);i>=0&&i<d&&a>=0&&a<p&&(g[i+a*d]+=+e(r))}),l>0&&c>0?(k_(d,p,g,m,l),M_(d,p,m,g,c),k_(d,p,g,m,l),M_(d,p,m,g,c),k_(d,p,g,m,l),M_(d,p,m,g,c)):l>0?(k_(d,p,g,m,l),k_(d,p,m,g,l),k_(d,p,g,m,l),v=m):c>0&&(M_(d,p,g,m,c),M_(d,p,m,g,c),M_(d,p,g,m,c),v=m);let y=s?Math.pow(2,-2*o):1/Si(v);for(let t=0,n=d*p;t<n;++t)v[t]*=y;return{values:v,scale:1<<o,width:d,height:p,x1:f,y1:h,x2:f+(a>>o),y2:h+(u>>o)}}return s.x=function(n){return arguments.length?(t=w_(n),s):t},s.y=function(t){return arguments.length?(n=w_(t),s):n},s.weight=function(t){return arguments.length?(e=w_(t),s):e},s.size=function(t){if(!arguments.length)return[a,u];var n=Math.ceil(t[0]),e=Math.ceil(t[1]);return n>=0||n>=0||i("invalid size"),a=n,u=e,s},s.cellSize=function(t){return arguments.length?((t=+t)>=1||i("invalid cell size"),o=Math.floor(Math.log(t)/Math.LN2),s):1<<o},s.bandwidth=function(t){return arguments.length?(1===(t=V(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&i("invalid bandwidth"),r=t,s):r},s}function k_(t,n,e,r,i){const a=1+(i<<1);for(let u=0;u<n;++u)for(let n=0,o=0;n<t+i;++n)n<t&&(o+=e[n+u*t]),n>=i&&(n>=a&&(o-=e[n-a+u*t]),r[n-i+u*t]=o/Math.min(n+1,t-1+a-n,a))}function M_(t,n,e,r,i){const a=1+(i<<1);for(let u=0;u<t;++u)for(let o=0,s=0;o<n+i;++o)o<n&&(s+=e[u+o*t]),o>=i&&(o>=a&&(s-=e[u+(o-a)*t]),r[u+(o-i)*t]=s/Math.min(o+1,n-1+a-o,a))}function E_(t){Qr.call(this,null,t)}__.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"}]},ot(__,Qr).transform=function(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||d,a=p_().smooth(!1!==t.smooth),o=t.thresholds||function(t,n,e){const r=y_(e.levels||10,e.nice,!1!==e.zero);return"shared"!==e.resolve?r:r(t.map(t=>ki(n(t).values)))}(r,i,t),s=null===t.as?null:t.as||"contour",l=[];return r.forEach(n=>{const e=i(n),r=a.size([e.width,e.height])(e.values,u(o)?o:o(e.values));!function(t,n,e,r){let i=r.scale||n.scale,a=r.translate||n.translate;X(i)&&(i=i(e,r));X(a)&&(a=a(e,r));if((1===i||null==i)&&!a)return;const u=(ft(i)?i:i[0])||1,o=(ft(i)?i:i[1])||1,s=a&&a[0]||0,l=a&&a[1]||0;t.forEach(x_(n,u,o,s,l))}(r,e,n,t),r.forEach(t=>{l.push(Ot(n,zt(null!=s?{[s]:t}:t)))})}),this.value&&(e.rem=this.value),this.value=e.source=e.add=l,e},E_.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"}]};var D_=ot(E_,Qr);const C_=["x","y","weight","size","cellSize","bandwidth"];function F_(t,n){return C_.forEach(e=>null!=n[e]?t[e](n[e]):0),t}function S_(t){Qr.call(this,null,t)}D_.transform=function(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var r,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),a=function(t,n){var e,r,i,a,u,o,s=[],l=t=>t(a);if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)a=t[r],u=n.map(l),(o=e[u])||(e[u]=o=[],o.dims=u,s.push(o)),o.push(a);return s}(n.materialize(n.SOURCE).source,t.groupby),u=(t.groupby||[]).map(e),o=F_(A_(),t),s=t.as||"grid";return r=a.map(n=>zt(function(t,n){for(let e=0;e<u.length;++e)t[u[e]]=n[e];return t}({[s]:o(n,t.counts)},n.dims))),this.value&&(i.rem=this.value),this.value=i.source=i.add=r,i},S_.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},ot(S_,Qr).transform=function(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),a=p_().smooth(!1!==t.smooth),o=t.values,s=t.thresholds||y_(t.count||10,t.nice,!!o),l=t.size;return o||(o=n.materialize(n.SOURCE).source,r=x_(e=F_(A_(),t)(o,!0),e.scale||1,e.scale||1,0,0),l=[e.width,e.height],o=e.values),s=u(s)?s:s(o),o=a.size(l)(o,s),r&&o.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(o||[]).map(zt),i};var B_="Feature",T_="FeatureCollection";function z_(t){Qr.call(this,null,t)}function N_(){return new O_}function O_(){this.reset()}z_.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ot(z_,Qr).transform=function(t,n){var e,i=this._features,a=this._points,u=t.fields,o=u&&u[0],s=u&&u[1],l=t.geojson||!u&&d,c=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(r(l))||o&&n.modified(r(o))||s&&n.modified(r(s)),this.value&&!e||(c=n.SOURCE,this._features=i=[],this._points=a=[]),l&&n.visit(c,(function(t){i.push(l(t))})),o&&s&&(n.visit(c,(function(t){var n=o(t),e=s(t);null!=n&&null!=e&&(n=+n)===n&&(e=+e)===e&&a.push([n,e])})),i=i.concat({type:B_,geometry:{type:"MultiPoint",coordinates:a}})),this.value={type:T_,features:i}},O_.prototype={constructor:O_,reset:function(){this.s=this.t=0},add:function(t){q_(R_,t,this.t),q_(this,R_.s,this.s),this.s?this.t+=R_.t:this.s=R_.t},valueOf:function(){return this.s}};var R_=new O_;function q_(t,n,e){var r=t.s=n+e,i=r-n,a=r-i;t.t=n-a+(e-i)}var L_=1e-6,U_=1e-12,$_=Math.PI,P_=$_/2,j_=$_/4,I_=2*$_,H_=180/$_,W_=$_/180,Y_=Math.abs,V_=Math.atan,G_=Math.atan2,X_=Math.cos,J_=Math.ceil,Z_=Math.exp,Q_=Math.log,K_=Math.pow,tx=Math.sin,nx=Math.sign||function(t){return t>0?1:t<0?-1:0},ex=Math.sqrt,rx=Math.tan;function ix(t){return t>1?0:t<-1?$_:Math.acos(t)}function ax(t){return t>1?P_:t<-1?-P_:Math.asin(t)}function ux(){}function ox(t,n){t&&lx.hasOwnProperty(t.type)&&lx[t.type](t,n)}var sx={Feature:function(t,n){ox(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)ox(e[r].geometry,n)}},lx={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){cx(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)cx(e[r],n,0)},Polygon:function(t,n){fx(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)fx(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)ox(e[r],n)}};function cx(t,n,e){var r,i=-1,a=t.length-e;for(n.lineStart();++i<a;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function fx(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)cx(t[e],n,1);n.polygonEnd()}function hx(t,n){t&&sx.hasOwnProperty(t.type)?sx[t.type](t,n):ox(t,n)}var dx,px,gx,mx,vx,yx=N_(),_x=N_(),xx={point:ux,lineStart:ux,lineEnd:ux,polygonStart:function(){yx.reset(),xx.lineStart=bx,xx.lineEnd=wx},polygonEnd:function(){var t=+yx;_x.add(t<0?I_+t:t),this.lineStart=this.lineEnd=this.point=ux},sphere:function(){_x.add(I_)}};function bx(){xx.point=Ax}function wx(){kx(dx,px)}function Ax(t,n){xx.point=kx,dx=t,px=n,gx=t*=W_,mx=X_(n=(n*=W_)/2+j_),vx=tx(n)}function kx(t,n){var e=(t*=W_)-gx,r=e>=0?1:-1,i=r*e,a=X_(n=(n*=W_)/2+j_),u=tx(n),o=vx*u,s=mx*a+o*X_(i),l=o*r*tx(i);yx.add(G_(l,s)),gx=t,mx=a,vx=u}function Mx(t){return[G_(t[1],t[0]),ax(t[2])]}function Ex(t){var n=t[0],e=t[1],r=X_(e);return[r*X_(n),r*tx(n),tx(e)]}function Dx(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Cx(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function Fx(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function Sx(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function Bx(t){var n=ex(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var Tx,zx,Nx,Ox,Rx,qx,Lx,Ux,$x,Px,jx,Ix,Hx,Wx,Yx,Vx,Gx,Xx,Jx,Zx,Qx,Kx,tb,nb,eb,rb,ib=N_(),ab={point:ub,lineStart:sb,lineEnd:lb,polygonStart:function(){ab.point=cb,ab.lineStart=fb,ab.lineEnd=hb,ib.reset(),xx.polygonStart()},polygonEnd:function(){xx.polygonEnd(),ab.point=ub,ab.lineStart=sb,ab.lineEnd=lb,yx<0?(Tx=-(Nx=180),zx=-(Ox=90)):ib>L_?Ox=90:ib<-L_&&(zx=-90),Px[0]=Tx,Px[1]=Nx},sphere:function(){Tx=-(Nx=180),zx=-(Ox=90)}};function ub(t,n){$x.push(Px=[Tx=t,Nx=t]),n<zx&&(zx=n),n>Ox&&(Ox=n)}function ob(t,n){var e=Ex([t*W_,n*W_]);if(Ux){var r=Cx(Ux,e),i=Cx([r[1],-r[0],0],r);Bx(i),i=Mx(i);var a,u=t-Rx,o=u>0?1:-1,s=i[0]*H_*o,l=Y_(u)>180;l^(o*Rx<s&&s<o*t)?(a=i[1]*H_)>Ox&&(Ox=a):l^(o*Rx<(s=(s+360)%360-180)&&s<o*t)?(a=-i[1]*H_)<zx&&(zx=a):(n<zx&&(zx=n),n>Ox&&(Ox=n)),l?t<Rx?db(Tx,t)>db(Tx,Nx)&&(Nx=t):db(t,Nx)>db(Tx,Nx)&&(Tx=t):Nx>=Tx?(t<Tx&&(Tx=t),t>Nx&&(Nx=t)):t>Rx?db(Tx,t)>db(Tx,Nx)&&(Nx=t):db(t,Nx)>db(Tx,Nx)&&(Tx=t)}else $x.push(Px=[Tx=t,Nx=t]);n<zx&&(zx=n),n>Ox&&(Ox=n),Ux=e,Rx=t}function sb(){ab.point=ob}function lb(){Px[0]=Tx,Px[1]=Nx,ab.point=ub,Ux=null}function cb(t,n){if(Ux){var e=t-Rx;ib.add(Y_(e)>180?e+(e>0?360:-360):e)}else qx=t,Lx=n;xx.point(t,n),ob(t,n)}function fb(){xx.lineStart()}function hb(){cb(qx,Lx),xx.lineEnd(),Y_(ib)>L_&&(Tx=-(Nx=180)),Px[0]=Tx,Px[1]=Nx,Ux=null}function db(t,n){return(n-=t)<0?n+360:n}function pb(t,n){return t[0]-n[0]}function gb(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var mb={sphere:ux,point:vb,lineStart:_b,lineEnd:wb,polygonStart:function(){mb.lineStart=Ab,mb.lineEnd=kb},polygonEnd:function(){mb.lineStart=_b,mb.lineEnd=wb}};function vb(t,n){t*=W_;var e=X_(n*=W_);yb(e*X_(t),e*tx(t),tx(n))}function yb(t,n,e){++jx,Hx+=(t-Hx)/jx,Wx+=(n-Wx)/jx,Yx+=(e-Yx)/jx}function _b(){mb.point=xb}function xb(t,n){t*=W_;var e=X_(n*=W_);nb=e*X_(t),eb=e*tx(t),rb=tx(n),mb.point=bb,yb(nb,eb,rb)}function bb(t,n){t*=W_;var e=X_(n*=W_),r=e*X_(t),i=e*tx(t),a=tx(n),u=G_(ex((u=eb*a-rb*i)*u+(u=rb*r-nb*a)*u+(u=nb*i-eb*r)*u),nb*r+eb*i+rb*a);Ix+=u,Vx+=u*(nb+(nb=r)),Gx+=u*(eb+(eb=i)),Xx+=u*(rb+(rb=a)),yb(nb,eb,rb)}function wb(){mb.point=vb}function Ab(){mb.point=Mb}function kb(){Eb(Kx,tb),mb.point=vb}function Mb(t,n){Kx=t,tb=n,t*=W_,n*=W_,mb.point=Eb;var e=X_(n);nb=e*X_(t),eb=e*tx(t),rb=tx(n),yb(nb,eb,rb)}function Eb(t,n){t*=W_;var e=X_(n*=W_),r=e*X_(t),i=e*tx(t),a=tx(n),u=eb*a-rb*i,o=rb*r-nb*a,s=nb*i-eb*r,l=ex(u*u+o*o+s*s),c=ax(l),f=l&&-c/l;Jx+=f*u,Zx+=f*o,Qx+=f*s,Ix+=c,Vx+=c*(nb+(nb=r)),Gx+=c*(eb+(eb=i)),Xx+=c*(rb+(rb=a)),yb(nb,eb,rb)}function Db(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function Cb(t,n){return[Y_(t)>$_?t+Math.round(-t/I_)*I_:t,n]}function Fb(t,n,e){return(t%=I_)?n||e?Db(Bb(t),Tb(n,e)):Bb(t):n||e?Tb(n,e):Cb}function Sb(t){return function(n,e){return[(n+=t)>$_?n-I_:n<-$_?n+I_:n,e]}}function Bb(t){var n=Sb(t);return n.invert=Sb(-t),n}function Tb(t,n){var e=X_(t),r=tx(t),i=X_(n),a=tx(n);function u(t,n){var u=X_(n),o=X_(t)*u,s=tx(t)*u,l=tx(n),c=l*e+o*r;return[G_(s*i-c*a,o*e-l*r),ax(c*i+s*a)]}return u.invert=function(t,n){var u=X_(n),o=X_(t)*u,s=tx(t)*u,l=tx(n),c=l*i-s*a;return[G_(s*i+l*a,o*e+c*r),ax(c*e-o*r)]},u}function zb(t,n){(n=Ex(n))[0]-=t,Bx(n);var e=ix(-n[1]);return((-n[2]<0?-e:e)+I_-L_)%I_}function Nb(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:ux,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Ob(t,n){return Y_(t[0]-n[0])<L_&&Y_(t[1]-n[1])<L_}function Rb(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function qb(t,n,e,r,i){var a,u,o=[],s=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],u=t[n];if(Ob(r,u)){for(i.lineStart(),a=0;a<n;++a)i.point((r=t[a])[0],r[1]);i.lineEnd()}else o.push(e=new Rb(r,t,null,!0)),s.push(e.o=new Rb(r,null,e,!1)),o.push(e=new Rb(u,t,null,!1)),s.push(e.o=new Rb(u,null,e,!0))}})),o.length){for(s.sort(n),Lb(o),Lb(s),a=0,u=s.length;a<u;++a)s[a].e=e=!e;for(var l,c,f=o[0];;){for(var h=f,d=!0;h.v;)if((h=h.n)===f)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,u=l.length;a<u;++a)i.point((c=l[a])[0],c[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(l=h.p.z,a=l.length-1;a>=0;--a)i.point((c=l[a])[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 Lb(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}Cb.invert=Cb;var Ub=N_();function $b(t){return Y_(t[0])<=$_?t[0]:nx(t[0])*((Y_(t[0])+$_)%I_-$_)}function Pb(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}!function(t){var n;1===t.length&&(n=t,t=function(t,e){return Pb(n(t),e)})}(Pb);function jb(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r<i;)a[r]=t+r*e;return a}function Ib(t){for(var n,e,r,i=t.length,a=-1,u=0;++a<i;)u+=t[a].length;for(e=new Array(u);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--u]=r[n];return e}function Hb(t,n,e,r){return function(i){var a,u,o,s=n(i),l=Nb(),c=n(l),f=!1,h={point:d,lineStart:g,lineEnd:m,polygonStart:function(){h.point=v,h.lineStart=y,h.lineEnd=_,u=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=m,u=Ib(u);var t=function(t,n){var e=$b(n),r=n[1],i=tx(r),a=[tx(e),-X_(e),0],u=0,o=0;Ub.reset(),1===i?r=P_+L_:-1===i&&(r=-P_-L_);for(var s=0,l=t.length;s<l;++s)if(f=(c=t[s]).length)for(var c,f,h=c[f-1],d=$b(h),p=h[1]/2+j_,g=tx(p),m=X_(p),v=0;v<f;++v,d=_,g=b,m=w,h=y){var y=c[v],_=$b(y),x=y[1]/2+j_,b=tx(x),w=X_(x),A=_-d,k=A>=0?1:-1,M=k*A,E=M>$_,D=g*b;if(Ub.add(G_(D*k*tx(M),m*w+D*X_(M))),u+=E?A+k*I_:A,E^d>=e^_>=e){var C=Cx(Ex(h),Ex(y));Bx(C);var F=Cx(a,C);Bx(F);var S=(E^A>=0?-1:1)*ax(F[2]);(r>S||r===S&&(C[0]||C[1]))&&(o+=E^A>=0?1:-1)}}return(u<-L_||u<L_&&Ub<-L_)^1&o}(a,r);u.length?(f||(i.polygonStart(),f=!0),qb(u,Yb,t,e,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),u=a=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){s.point(t,n)}function g(){h.point=p,s.lineStart()}function m(){h.point=d,s.lineEnd()}function v(t,n){o.push([t,n]),c.point(t,n)}function y(){c.lineStart(),o=[]}function _(){v(o[0][0],o[0][1]),c.lineEnd();var t,n,e,r,s=c.clean(),h=l.result(),d=h.length;if(o.pop(),a.push(o),o=null,d)if(1&s){if((n=(e=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&s&&h.push(h.pop().concat(h.shift())),u.push(h.filter(Wb))}return h}}function Wb(t){return t.length>1}function Yb(t,n){return((t=t.x)[0]<0?t[1]-P_-L_:P_-t[1])-((n=n.x)[0]<0?n[1]-P_-L_:P_-n[1])}var Vb=Hb((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,u){var o=a>0?$_:-$_,s=Y_(a-e);Y_(s-$_)<L_?(t.point(e,r=(r+u)/2>0?P_:-P_),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(a,r),n=0):i!==o&&s>=$_&&(Y_(e-i)<L_&&(e-=i*L_),Y_(a-o)<L_&&(a-=o*L_),r=function(t,n,e,r){var i,a,u=tx(t-e);return Y_(u)>L_?V_((tx(n)*(a=X_(r))*tx(e)-tx(r)*(i=X_(n))*tx(t))/(i*a*u)):(n+r)/2}(e,r,a,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),n=0),t.point(e=a,r=u),i=o},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)i=e*P_,r.point(-$_,i),r.point(0,i),r.point($_,i),r.point($_,0),r.point($_,-i),r.point(0,-i),r.point(-$_,-i),r.point(-$_,0),r.point(-$_,i);else if(Y_(t[0]-n[0])>L_){var a=t[0]<n[0]?$_:-$_;i=e*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(n[0],n[1])}),[-$_,-P_]);function Gb(t){var n=X_(t),e=6*W_,r=n>0,i=Y_(n)>L_;function a(t,e){return X_(t)*X_(e)>n}function u(t,e,r){var i=[1,0,0],a=Cx(Ex(t),Ex(e)),u=Dx(a,a),o=a[0],s=u-o*o;if(!s)return!r&&t;var l=n*u/s,c=-n*o/s,f=Cx(i,a),h=Sx(i,l);Fx(h,Sx(a,c));var d=f,p=Dx(h,d),g=Dx(d,d),m=p*p-g*(Dx(h,h)-1);if(!(m<0)){var v=ex(m),y=Sx(d,(-p-v)/g);if(Fx(y,h),y=Mx(y),!r)return y;var _,x=t[0],b=e[0],w=t[1],A=e[1];b<x&&(_=x,x=b,b=_);var k=b-x,M=Y_(k-$_)<L_;if(!M&&A<w&&(_=w,w=A,A=_),M||k<L_?M?w+A>0^y[1]<(Y_(y[0]-x)<L_?w:A):w<=y[1]&&y[1]<=A:k>$_^(x<=y[0]&&y[0]<=b)){var E=Sx(d,(-p+v)/g);return Fx(E,h),[y,Mx(E)]}}}function o(n,e){var i=r?t:$_-t,a=0;return n<-i?a|=1:n>i&&(a|=2),e<-i?a|=4:e>i&&(a|=8),a}return Hb(a,(function(t){var n,e,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=a(f,h),m=r?g?0:o(f,h):g?o(f+(f<0?$_:-$_),h):0;if(!n&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=u(n,p))||Ob(n,d)||Ob(p,d))&&(p[0]+=L_,p[1]+=L_,g=a(p[0],p[1])),g!==s)c=0,g?(t.lineStart(),d=u(p,n),t.point(d[0],d[1])):(d=u(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(i&&n&&r^g){var v;m&e||!(v=u(p,n,!0))||(c=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!g||n&&Ob(n,p)||t.point(p[0],p[1]),n=p,s=g,e=m},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}}),(function(n,r,i,a){!function(t,n,e,r,i,a){if(e){var u=X_(n),o=tx(n),s=r*e;null==i?(i=n+r*I_,a=n-s/2):(i=zb(u,i),a=zb(u,a),(r>0?i<a:i>a)&&(i+=r*I_));for(var l,c=i;r>0?c>a:c<a;c-=s)l=Mx([u,-o*X_(c),-o*tx(c)]),t.point(l[0],l[1])}}(a,t,e,i,n,r)}),r?[0,-t]:[-$_,t-$_])}var Xb=1e9,Jb=-Xb;function Zb(t,n,e,r){function i(i,a){return t<=i&&i<=e&&n<=a&&a<=r}function a(i,a,o,l){var c=0,f=0;if(null==i||(c=u(i,o))!==(f=u(a,o))||s(i,a)<0^o>0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+o+4)%4)!==f);else l.point(a[0],a[1])}function u(r,i){return Y_(r[0]-t)<L_?i>0?0:3:Y_(r[0]-e)<L_?i>0?2:1:Y_(r[1]-n)<L_?i>0?1:0:i>0?3:2}function o(t,n){return s(t.x,n.x)}function s(t,n){var e=u(t,1),r=u(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(u){var s,l,c,f,h,d,p,g,m,v,y,_=u,x=Nb(),b={point:w,lineStart:function(){b.point=A,l&&l.push(c=[]);v=!0,m=!1,p=g=NaN},lineEnd:function(){s&&(A(f,h),d&&m&&x.rejoin(),s.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=l.length;e<i;++e)for(var a,u,o=l[e],s=1,c=o.length,f=o[0],h=f[0],d=f[1];s<c;++s)a=h,u=d,f=o[s],h=f[0],d=f[1],u<=r?d>r&&(h-a)*(r-u)>(d-u)*(t-a)&&++n:d<=r&&(h-a)*(r-u)<(d-u)*(t-a)&&--n;return n}(),e=y&&n,i=(s=Ib(s)).length;(e||i)&&(u.polygonStart(),e&&(u.lineStart(),a(null,null,1,u),u.lineEnd()),i&&qb(s,o,n,a,u),u.polygonEnd());_=u,s=l=c=null}};function w(t,n){i(t,n)&&_.point(t,n)}function A(a,u){var o=i(a,u);if(l&&c.push([a,u]),v)f=a,h=u,d=o,v=!1,o&&(_.lineStart(),_.point(a,u));else if(o&&m)_.point(a,u);else{var s=[p=Math.max(Jb,Math.min(Xb,p)),g=Math.max(Jb,Math.min(Xb,g))],x=[a=Math.max(Jb,Math.min(Xb,a)),u=Math.max(Jb,Math.min(Xb,u))];!function(t,n,e,r,i,a){var u,o=t[0],s=t[1],l=0,c=1,f=n[0]-o,h=n[1]-s;if(u=e-o,f||!(u>0)){if(u/=f,f<0){if(u<l)return;u<c&&(c=u)}else if(f>0){if(u>c)return;u>l&&(l=u)}if(u=i-o,f||!(u<0)){if(u/=f,f<0){if(u>c)return;u>l&&(l=u)}else if(f>0){if(u<l)return;u<c&&(c=u)}if(u=r-s,h||!(u>0)){if(u/=h,h<0){if(u<l)return;u<c&&(c=u)}else if(h>0){if(u>c)return;u>l&&(l=u)}if(u=a-s,h||!(u<0)){if(u/=h,h<0){if(u>c)return;u>l&&(l=u)}else if(h>0){if(u<l)return;u<c&&(c=u)}return l>0&&(t[0]=o+l*f,t[1]=s+l*h),c<1&&(n[0]=o+c*f,n[1]=s+c*h),!0}}}}}(s,x,t,n,e,r)?o&&(_.lineStart(),_.point(a,u),y=!1):(m||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),o||_.lineEnd(),y=!1)}p=a,g=u,m=o}return b}}function Qb(t,n,e){var r=jb(t,n-L_,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function Kb(t,n,e){var r=jb(t,n-L_,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}function tw(t){return t}var nw,ew,rw,iw,aw=N_(),uw=N_(),ow={point:ux,lineStart:ux,lineEnd:ux,polygonStart:function(){ow.lineStart=sw,ow.lineEnd=fw},polygonEnd:function(){ow.lineStart=ow.lineEnd=ow.point=ux,aw.add(Y_(uw)),uw.reset()},result:function(){var t=aw/2;return aw.reset(),t}};function sw(){ow.point=lw}function lw(t,n){ow.point=cw,nw=rw=t,ew=iw=n}function cw(t,n){uw.add(iw*t-rw*n),rw=t,iw=n}function fw(){cw(nw,ew)}var hw=1/0,dw=hw,pw=-hw,gw=pw,mw={point:function(t,n){t<hw&&(hw=t);t>pw&&(pw=t);n<dw&&(dw=n);n>gw&&(gw=n)},lineStart:ux,lineEnd:ux,polygonStart:ux,polygonEnd:ux,result:function(){var t=[[hw,dw],[pw,gw]];return pw=gw=-(dw=hw=1/0),t}};var vw,yw,_w,xw,bw=0,ww=0,Aw=0,kw=0,Mw=0,Ew=0,Dw=0,Cw=0,Fw=0,Sw={point:Bw,lineStart:Tw,lineEnd:Ow,polygonStart:function(){Sw.lineStart=Rw,Sw.lineEnd=qw},polygonEnd:function(){Sw.point=Bw,Sw.lineStart=Tw,Sw.lineEnd=Ow},result:function(){var t=Fw?[Dw/Fw,Cw/Fw]:Ew?[kw/Ew,Mw/Ew]:Aw?[bw/Aw,ww/Aw]:[NaN,NaN];return bw=ww=Aw=kw=Mw=Ew=Dw=Cw=Fw=0,t}};function Bw(t,n){bw+=t,ww+=n,++Aw}function Tw(){Sw.point=zw}function zw(t,n){Sw.point=Nw,Bw(_w=t,xw=n)}function Nw(t,n){var e=t-_w,r=n-xw,i=ex(e*e+r*r);kw+=i*(_w+t)/2,Mw+=i*(xw+n)/2,Ew+=i,Bw(_w=t,xw=n)}function Ow(){Sw.point=Bw}function Rw(){Sw.point=Lw}function qw(){Uw(vw,yw)}function Lw(t,n){Sw.point=Uw,Bw(vw=_w=t,yw=xw=n)}function Uw(t,n){var e=t-_w,r=n-xw,i=ex(e*e+r*r);kw+=i*(_w+t)/2,Mw+=i*(xw+n)/2,Ew+=i,Dw+=(i=xw*t-_w*n)*(_w+t),Cw+=i*(xw+n),Fw+=3*i,Bw(_w=t,xw=n)}function $w(t){this._context=t}$w.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,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,I_)}},result:ux};var Pw,jw,Iw,Hw,Ww,Yw=N_(),Vw={point:ux,lineStart:function(){Vw.point=Gw},lineEnd:function(){Pw&&Xw(jw,Iw),Vw.point=ux},polygonStart:function(){Pw=!0},polygonEnd:function(){Pw=null},result:function(){var t=+Yw;return Yw.reset(),t}};function Gw(t,n){Vw.point=Xw,jw=Hw=t,Iw=Ww=n}function Xw(t,n){Hw-=t,Ww-=n,Yw.add(ex(Hw*Hw+Ww*Ww)),Hw=t,Ww=n}function Jw(){this._string=[]}function Zw(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Qw(t,n){var e,r,i=4.5;function a(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),hx(t,e(r))),r.result()}return a.area=function(t){return hx(t,e(ow)),ow.result()},a.measure=function(t){return hx(t,e(Vw)),Vw.result()},a.bounds=function(t){return hx(t,e(mw)),mw.result()},a.centroid=function(t){return hx(t,e(Sw)),Sw.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,tw):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new Jw):new $w(n=t),"function"!=typeof i&&r.pointRadius(i),a):n},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),a):i},a.projection(t).context(n)}function Kw(t){return function(n){var e=new tA;for(var r in t)e[r]=t[r];return e.stream=n,e}}function tA(){}function nA(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),hx(e,t.stream(mw)),n(mw.result()),null!=r&&t.clipExtent(r),t}function eA(t,n,e){return nA(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],a=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),u=+n[0][0]+(r-a*(e[1][0]+e[0][0]))/2,o=+n[0][1]+(i-a*(e[1][1]+e[0][1]))/2;t.scale(150*a).translate([u,o])}),e)}function rA(t,n,e){return eA(t,[[0,0],n],e)}function iA(t,n,e){return nA(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),a=(r-i*(e[1][0]+e[0][0]))/2,u=-i*e[0][1];t.scale(150*i).translate([a,u])}),e)}function aA(t,n,e){return nA(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),a=-i*e[0][0],u=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([a,u])}),e)}Jw.prototype={_radius:4.5,_circle:Zw(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,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=Zw(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},tA.prototype={constructor:tA,point:function(t,n){this.stream.point(t,n)},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 uA=16,oA=X_(30*W_);function sA(t,n){return+n?function(t,n){function e(r,i,a,u,o,s,l,c,f,h,d,p,g,m){var v=l-r,y=c-i,_=v*v+y*y;if(_>4*n&&g--){var x=u+h,b=o+d,w=s+p,A=ex(x*x+b*b+w*w),k=ax(w/=A),M=Y_(Y_(w)-1)<L_||Y_(a-f)<L_?(a+f)/2:G_(b,x),E=t(M,k),D=E[0],C=E[1],F=D-r,S=C-i,B=y*F-v*S;(B*B/_>n||Y_((v*F+y*S)/_-.5)>.3||u*h+o*d+s*p<oA)&&(e(r,i,a,u,o,s,D,C,M,x/=A,b/=A,w,g,m),m.point(D,C),e(D,C,M,x,b,w,l,c,f,h,d,p,g,m))}}return function(n){var r,i,a,u,o,s,l,c,f,h,d,p,g={point:m,lineStart:v,lineEnd:_,polygonStart:function(){n.polygonStart(),g.lineStart=x},polygonEnd:function(){n.polygonEnd(),g.lineStart=v}};function m(e,r){e=t(e,r),n.point(e[0],e[1])}function v(){c=NaN,g.point=y,n.lineStart()}function y(r,i){var a=Ex([r,i]),u=t(r,i);e(c,f,l,h,d,p,c=u[0],f=u[1],l=r,h=a[0],d=a[1],p=a[2],uA,n),n.point(c,f)}function _(){g.point=m,n.lineEnd()}function x(){v(),g.point=b,g.lineEnd=w}function b(t,n){y(r=t,n),i=c,a=f,u=h,o=d,s=p,g.point=y}function w(){e(c,f,l,h,d,p,i,a,r,u,o,s,uA,n),g.lineEnd=_,_()}return g}}(t,n):function(t){return Kw({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var lA=Kw({point:function(t,n){this.stream.point(t*W_,n*W_)}});function cA(t,n,e){function r(r,i){return[n+t*r,e-t*i]}return r.invert=function(r,i){return[(r-n)/t,(e-i)/t]},r}function fA(t,n,e,r){var i=X_(r),a=tx(r),u=i*t,o=a*t,s=i/t,l=a/t,c=(a*e-i*n)/t,f=(a*n+i*e)/t;function h(t,r){return[u*t-o*r+n,e-o*t-u*r]}return h.invert=function(t,n){return[s*t-l*n+c,f-l*t-s*n]},h}function hA(t){return dA((function(){return t}))()}function dA(t){var n,e,r,i,a,u,o,s,l,c,f=150,h=480,d=250,p=0,g=0,m=0,v=0,y=0,_=0,x=null,b=Vb,w=null,A=tw,k=.5;function M(t){return s(t[0]*W_,t[1]*W_)}function E(t){return(t=s.invert(t[0],t[1]))&&[t[0]*H_,t[1]*H_]}function D(){var t=fA(f,0,0,_).apply(null,n(p,g)),r=(_?fA:cA)(f,h-t[0],d-t[1],_);return e=Fb(m,v,y),o=Db(n,r),s=Db(e,o),u=sA(o,k),C()}function C(){return l=c=null,M}return M.stream=function(t){return l&&c===t?l:l=lA(function(t){return Kw({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(b(u(A(c=t)))))},M.preclip=function(t){return arguments.length?(b=t,x=void 0,C()):b},M.postclip=function(t){return arguments.length?(A=t,w=r=i=a=null,C()):A},M.clipAngle=function(t){return arguments.length?(b=+t?Gb(x=t*W_):(x=null,Vb),C()):x*H_},M.clipExtent=function(t){return arguments.length?(A=null==t?(w=r=i=a=null,tw):Zb(w=+t[0][0],r=+t[0][1],i=+t[1][0],a=+t[1][1]),C()):null==w?null:[[w,r],[i,a]]},M.scale=function(t){return arguments.length?(f=+t,D()):f},M.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],D()):[h,d]},M.center=function(t){return arguments.length?(p=t[0]%360*W_,g=t[1]%360*W_,D()):[p*H_,g*H_]},M.rotate=function(t){return arguments.length?(m=t[0]%360*W_,v=t[1]%360*W_,y=t.length>2?t[2]%360*W_:0,D()):[m*H_,v*H_,y*H_]},M.angle=function(t){return arguments.length?(_=t%360*W_,D()):_*H_},M.precision=function(t){return arguments.length?(u=sA(o,k=t*t),C()):ex(k)},M.fitExtent=function(t,n){return eA(M,t,n)},M.fitSize=function(t,n){return rA(M,t,n)},M.fitWidth=function(t,n){return iA(M,t,n)},M.fitHeight=function(t,n){return aA(M,t,n)},function(){return n=t.apply(this,arguments),M.invert=n.invert&&E,D()}}function pA(t){var n=0,e=$_/3,r=dA(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*W_,e=t[1]*W_):[n*H_,e*H_]},i}function gA(t,n){var e=tx(t),r=(e+tx(n))/2;if(Y_(r)<L_)return function(t){var n=X_(t);function e(t,e){return[t*n,tx(e)/n]}return e.invert=function(t,e){return[t/n,ax(e*n)]},e}(t);var i=1+e*(2*r-e),a=ex(i)/r;function u(t,n){var e=ex(i-2*r*tx(n))/r;return[e*tx(t*=r),a-e*X_(t)]}return u.invert=function(t,n){var e=a-n;return[G_(t,Y_(e))/r*nx(e),ax((i-(t*t+e*e)*r*r)/(2*r))]},u}function mA(){return pA(gA).scale(155.424).center([0,33.6442])}function vA(){return mA().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function yA(t){return function(n,e){var r=X_(n),i=X_(e),a=t(r*i);return[a*i*tx(n),a*tx(e)]}}function _A(t){return function(n,e){var r=ex(n*n+e*e),i=t(r),a=tx(i),u=X_(i);return[G_(n*a,r*u),ax(r&&e*a/r)]}}var xA=yA((function(t){return ex(2/(1+t))}));xA.invert=_A((function(t){return 2*ax(t/2)}));var bA=yA((function(t){return(t=ix(t))&&t/tx(t)}));function wA(t,n){return[t,Q_(rx((P_+n)/2))]}function AA(t){var n,e,r,i=hA(t),a=i.center,u=i.scale,o=i.translate,s=i.clipExtent,l=null;function c(){var a=$_*u(),o=i(function(t){function n(n){return(n=t(n[0]*W_,n[1]*W_))[0]*=H_,n[1]*=H_,n}return t=Fb(t[0]*W_,t[1]*W_,t.length>2?t[2]*W_:0),n.invert=function(n){return(n=t.invert(n[0]*W_,n[1]*W_))[0]*=H_,n[1]*=H_,n},n}(i.rotate()).invert([0,0]));return s(null==l?[[o[0]-a,o[1]-a],[o[0]+a,o[1]+a]]:t===wA?[[Math.max(o[0]-a,l),n],[Math.min(o[0]+a,e),r]]:[[l,Math.max(o[1]-a,n)],[e,Math.min(o[1]+a,r)]])}return i.scale=function(t){return arguments.length?(u(t),c()):u()},i.translate=function(t){return arguments.length?(o(t),c()):o()},i.center=function(t){return arguments.length?(a(t),c()):a()},i.clipExtent=function(t){return arguments.length?(null==t?l=n=e=r=null:(l=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,n],[e,r]]},c()}function kA(t){return rx((P_+t)/2)}function MA(t,n){var e=X_(t),r=t===n?tx(t):Q_(e/X_(n))/Q_(kA(n)/kA(t)),i=e*K_(kA(t),r)/r;if(!r)return wA;function a(t,n){i>0?n<-P_+L_&&(n=-P_+L_):n>P_-L_&&(n=P_-L_);var e=i/K_(kA(n),r);return[e*tx(r*t),i-e*X_(r*t)]}return a.invert=function(t,n){var e=i-n,a=nx(r)*ex(t*t+e*e);return[G_(t,Y_(e))/r*nx(e),2*V_(K_(i/a,1/r))-P_]},a}function EA(t,n){return[t,n]}function DA(t,n){var e=X_(t),r=t===n?tx(t):(e-X_(n))/(n-t),i=e/r+t;if(Y_(r)<L_)return EA;function a(t,n){var e=i-n,a=r*t;return[e*tx(a),i-e*X_(a)]}return a.invert=function(t,n){var e=i-n;return[G_(t,Y_(e))/r*nx(e),i-nx(r)*ex(t*t+e*e)]},a}bA.invert=_A((function(t){return t})),wA.invert=function(t,n){return[t,2*V_(Z_(n))-P_]},EA.invert=EA;var CA=1.340264,FA=-.081106,SA=893e-6,BA=.003796,TA=ex(3)/2;function zA(t,n){var e=ax(TA*tx(n)),r=e*e,i=r*r*r;return[t*X_(e)/(TA*(CA+3*FA*r+i*(7*SA+9*BA*r))),e*(CA+FA*r+i*(SA+BA*r))]}function NA(t,n){var e=X_(n),r=X_(t)*e;return[e*tx(t)/r,tx(n)/r]}function OA(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?tw:Kw({point:function(i,a){this.stream.point(i*t+e,a*n+r)}})}function RA(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function qA(t,n){return[X_(n)*tx(t),tx(n)]}function LA(t,n){var e=X_(n),r=1+X_(t)*e;return[e*tx(t)/r,tx(n)/r]}function UA(t,n){return[Q_(rx((P_+n)/2)),-t]}zA.invert=function(t,n){for(var e,r=n,i=r*r,a=i*i*i,u=0;u<12&&(a=(i=(r-=e=(r*(CA+FA*i+a*(SA+BA*i))-n)/(CA+3*FA*i+a*(7*SA+9*BA*i)))*r)*i*i,!(Y_(e)<U_));++u);return[TA*t*(CA+3*FA*i+a*(7*SA+9*BA*i))/X_(r),ax(tx(r)/TA)]},NA.invert=_A(V_),RA.invert=function(t,n){var e,r=n,i=25;do{var a=r*r,u=a*a;r-=e=(r*(1.007226+a*(.015085+u*(.028874*a-.044475-.005916*u)))-n)/(1.007226+a*(.045255+u*(.259866*a-.311325-.005916*11*u)))}while(Y_(e)>L_&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},qA.invert=_A(ax),LA.invert=_A((function(t){return 2*V_(t)})),UA.invert=function(t,n){return[-n,2*V_(Z_(t))-P_]};var $A=Math.abs,PA=Math.cos,jA=Math.sin,IA=1e-6,HA=Math.PI,WA=HA/2,YA=function(t){return t>0?Math.sqrt(t):0}(2);function VA(t){return t>1?WA:t<-1?-WA:Math.asin(t)}function GA(t,n){var e,r=t*jA(n),i=30;do{n-=e=(n+jA(n)-r)/(1+PA(n))}while($A(e)>IA&&--i>0);return n/2}var XA=function(t,n,e){function r(r,i){return[t*r*PA(i=GA(e,i)),n*jA(i)]}return r.invert=function(r,i){return i=VA(i/n),[r/(t*PA(i)),VA((2*i+jA(2*i))/e)]},r}(YA/WA,YA,HA);var JA=Qw(),ZA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function QA(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(tk[t]=function(t,n){return function e(){var r=n();return r.type=t,r.path=Qw().projection(r),r.copy=r.copy||function(){var t=e();return ZA.forEach((function(n){r[n]&&t[n](r[n]())})),t.path.pointRadius(r.path.pointRadius()),t},r}}(t,n),this):tk[t]||null}function KA(t){return t&&t.path||JA}var tk={albers:vA,albersusa:function(){var t,n,e,r,i,a,u=vA(),o=mA().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=mA().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){a=[t,n]}};function c(t){var n=t[0],u=t[1];return a=null,e.point(n,u),a||(r.point(n,u),a)||(i.point(n,u),a)}function f(){return t=n=null,c}return c.invert=function(t){var n=u.scale(),e=u.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:u).invert(t)},c.stream=function(e){return t&&n===e?t:(r=[u.stream(n=e),o.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},c.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),s.precision(t),f()):u.precision()},c.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),s.scale(t),c.translate(u.translate())):u.scale()},c.translate=function(t){if(!arguments.length)return u.translate();var n=u.scale(),a=+t[0],c=+t[1];return e=u.translate(t).clipExtent([[a-.455*n,c-.238*n],[a+.455*n,c+.238*n]]).stream(l),r=o.translate([a-.307*n,c+.201*n]).clipExtent([[a-.425*n+L_,c+.12*n+L_],[a-.214*n-L_,c+.234*n-L_]]).stream(l),i=s.translate([a-.205*n,c+.212*n]).clipExtent([[a-.214*n+L_,c+.166*n+L_],[a-.115*n-L_,c+.234*n-L_]]).stream(l),f()},c.fitExtent=function(t,n){return eA(c,t,n)},c.fitSize=function(t,n){return rA(c,t,n)},c.fitWidth=function(t,n){return iA(c,t,n)},c.fitHeight=function(t,n){return aA(c,t,n)},c.scale(1070)},azimuthalequalarea:function(){return hA(xA).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return hA(bA).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return pA(MA).scale(109.5).parallels([30,30])},conicequalarea:mA,conicequidistant:function(){return pA(DA).scale(131.154).center([0,13.9389])},equalEarth:function(){return hA(zA).scale(177.158)},equirectangular:function(){return hA(EA).scale(152.63)},gnomonic:function(){return hA(NA).scale(144.049).clipAngle(60)},identity:function(){var t,n,e,r,i,a,u=1,o=0,s=0,l=1,c=1,f=tw,h=null,d=tw;function p(){return r=i=null,a}return a={stream:function(t){return r&&i===t?r:r=f(d(i=t))},postclip:function(r){return arguments.length?(d=r,h=t=n=e=null,p()):d},clipExtent:function(r){return arguments.length?(d=null==r?(h=t=n=e=null,tw):Zb(h=+r[0][0],t=+r[0][1],n=+r[1][0],e=+r[1][1]),p()):null==h?null:[[h,t],[n,e]]},scale:function(t){return arguments.length?(f=OA((u=+t)*l,u*c,o,s),p()):u},translate:function(t){return arguments.length?(f=OA(u*l,u*c,o=+t[0],s=+t[1]),p()):[o,s]},reflectX:function(t){return arguments.length?(f=OA(u*(l=t?-1:1),u*c,o,s),p()):l<0},reflectY:function(t){return arguments.length?(f=OA(u*l,u*(c=t?-1:1),o,s),p()):c<0},fitExtent:function(t,n){return eA(a,t,n)},fitSize:function(t,n){return rA(a,t,n)},fitWidth:function(t,n){return iA(a,t,n)},fitHeight:function(t,n){return aA(a,t,n)}}},mercator:function(){return AA(wA).scale(961/I_)},mollweide:function(){return hA(XA).scale(169.529)},naturalEarth1:function(){return hA(RA).scale(175.295)},orthographic:function(){return hA(qA).scale(249.5).clipAngle(90+L_)},stereographic:function(){return hA(LA).scale(250).clipAngle(142)},transversemercator:function(){var t=AA(UA),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(var nk in tk)QA(nk,tk[nk]);function ek(t){Qr.call(this,null,t)}function rk(t){Qr.call(this,null,t)}function ik(t){Qr.call(this,null,t)}function ak(t){Qr.call(this,[],t),this.generator=function(){var t,n,e,r,i,a,u,o,s,l,c,f,h=10,d=h,p=90,g=360,m=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return jb(J_(r/p)*p,e,p).map(c).concat(jb(J_(o/g)*g,u,g).map(f)).concat(jb(J_(n/h)*h,t,h).filter((function(t){return Y_(t%p)>L_})).map(s)).concat(jb(J_(a/d)*d,i,d).filter((function(t){return Y_(t%g)>L_})).map(l))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(u).slice(1),c(e).reverse().slice(1),f(o).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),o>u&&(t=o,o=u,u=t),v.precision(m)):[[r,o],[e,u]]},v.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],a=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),a>i&&(e=a,a=i,i=e),v.precision(m)):[[n,a],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],v):[p,g]},v.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],v):[h,d]},v.precision=function(h){return arguments.length?(m=+h,s=Qb(a,i,90),l=Kb(n,t,m),c=Qb(o,u,90),f=Kb(r,e,m),v):m},v.extentMajor([[-180,-90+L_],[180,90-L_]]).extentMinor([[-180,-80-L_],[180,80+L_]])}()}function uk(t){Qr.call(this,null,t)}function ok(t){if(!X(t))return!1;const n=At(r(t));return n.$x||n.$y||n.$value||n.$max}function sk(t){Qr.call(this,null,t),this.modified(!0)}function lk(t,n,e){X(t[n])&&t[n](e)}ek.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"}]},ot(ek,Qr).transform=function(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||d,a=t.as||"path",u=e.SOURCE;!r||t.modified()?(this.value=r=KA(t.projection),e.materialize().reflow()):u=i===d||n.modified(i.fields)?e.ADD_MOD:e.ADD;var o=function(t,n){var e=t.pointRadius();t.context(null),null!=n&&t.pointRadius(n);return e}(r,t.pointRadius);return e.visit(u,(function(t){t[a]=r(i(t))})),r.pointRadius(o),e.modifies(a)},rk.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"]}]},ot(rk,Qr).transform=function(t,n){var e,r=t.projection,i=t.fields[0],a=t.fields[1],u=t.as||["x","y"],o=u[0],s=u[1];function l(t){var n=r([i(t),a(t)]);n?(t[o]=n[0],t[s]=n[1]):(t[o]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,l):(e=n.modified(i.fields)||n.modified(a.fields),n.visit(e?n.ADD_MOD:n.ADD,l)),n.modifies(u)},ik.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"}]},ot(ik,Qr).transform=function(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",a=e.ADD;return r&&!t.modified()||(this.value=r=function(t,n,e){var r=null==e?function(e){return t(n(e))}:function(r){var i=t.pointRadius(),a=t.pointRadius(e)(n(r));return t.pointRadius(i),a};return r.context=function(n){return t.context(n),r},r}(KA(t.projection),t.field||c("datum"),t.pointRadius),e.materialize().reflow(),a=e.SOURCE),e.visit(a,(function(t){t[i]=r})),e.modifies(i)},ak.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}]},ot(ak,Qr).transform=function(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)X(i[a])&&i[a](t[a]);return e=i(),r.length?n.mod.push(Rt(r[0],e)):n.add.push(zt(e)),r[0]=e,n},uk.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"}]},ot(uk,Qr).transform=function(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r="shared"===t.resolve,i=t.field||d,a=function(t,n){let e;X(t)?(e=e=>t(e,n),e.dep=ok(t)):t?e=Z(t):(e=t=>t.$value/t.$max||0,e.dep=!0);return e}(t.opacity,t),u=function(t,n){let e;X(t)?(e=e=>gg(t(e,n)),e.dep=ok(t)):e=Z(gg(t||"#888"));return e}(t.color,t),o=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?ki(e.map(t=>ki(i(t).values))):0};return e.forEach(t=>{const n=i(t),e=K({},t,s);r||(e.$max=ki(n.values||[])),t[o]=function(t,n,e,r){const i=t.width,a=t.height,u=t.x1||0,o=t.y1||0,s=t.x2||i,l=t.y2||a,c=t.values,f=c?t=>c[t]:p,h=Ls(s-u,l-o),d=h.getContext("2d"),g=d.getImageData(0,0,s-u,l-o),m=g.data;for(let t=o,a=0;t<l;++t){n.$y=t-o;for(let o=u,l=t*i;o<s;++o,a+=4){n.$x=o-u,n.$value=f(o+l);const t=e(n);m[a+0]=t.r,m[a+1]=t.g,m[a+2]=t.b,m[a+3]=~~(255*r(n))}}return d.putImageData(g,0,0),h}(n,e,u.dep?u:Z(u(e)),a.dep?a:Z(a(e)))}),n.reflow(!0).modifies(o)},ot(sk,Qr).transform=function(t,n){var e=this.value;return!e||t.modified("type")?(this.value=e=function(t){var n=QA((t||"mercator").toLowerCase());n||i("Unrecognized projection type: "+t);return n()}(t.type),ZA.forEach((function(n){null!=t[n]&&lk(e,n,t[n])}))):ZA.forEach((function(n){t.modified(n)&&lk(e,n,t[n])})),null!=t.pointRadius&&e.path.pointRadius(t.pointRadius),t.fit&&function(t,n){var e=function(t){return 1===(t=V(t)).length?t[0]:{type:T_,features:t.reduce((t,n)=>t.concat(function(t){return t.type===T_?t.features:V(t).filter(t=>null!=t).map(t=>t.type===B_?t:{type:B_,geometry:t})}(n)),[])}}(n.fit);n.extent?t.fitExtent(n.extent,e):n.size&&t.fitSize(n.size,e)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)};var ck=Object.freeze({__proto__:null,contour:S_,geojson:z_,geopath:ek,geopoint:rk,geoshape:ik,graticule:ak,heatmap:uk,isocontour:__,kde2d:E_,projection:sk});function fk(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,a,u,o,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=n>=(a=(g+v)/2))?g=a:v=a,(c=e>=(u=(m+y)/2))?m=u:y=u,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(o=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===o&&e===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=n>=(a=(g+v)/2))?g=a:v=a,(c=e>=(u=(m+y)/2))?m=u:y=u}while((f=c<<1|l)==(h=(s>=u)<<1|o>=a));return i[h]=d,i[f]=p,t}function hk(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function dk(t){return t[0]}function pk(t){return t[1]}function gk(t,n,e){var r=new mk(null==n?dk:n,null==e?pk:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function mk(t,n,e,r,i,a){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function vk(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var yk=gk.prototype=mk.prototype;function _k(t){return function(){return t}}function xk(){return 1e-6*(Math.random()-.5)}function bk(t){return t.x+t.vx}function wk(t){return t.y+t.vy}function Ak(t){return t.index}function kk(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}yk.copy=function(){var t,n,e=new mk(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=vk(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=vk(n));return e},yk.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return fk(this.cover(n,e),n,e,t)},yk.addAll=function(t){var n,e,r,i,a=t.length,u=new Array(a),o=new Array(a),s=1/0,l=1/0,c=-1/0,f=-1/0;for(e=0;e<a;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(u[e]=r,o[e]=i,r<s&&(s=r),r>c&&(c=r),i<l&&(l=i),i>f&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),e=0;e<a;++e)fk(this,u[e],o[e],t[e]);return this},yk.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,a=(r=Math.floor(n))+1;else{for(var u,o,s=i-e,l=this._root;e>t||t>=i||r>n||n>=a;)switch(o=(n<r)<<1|t<e,(u=new Array(4))[o]=l,l=u,s*=2,o){case 0:i=e+s,a=r+s;break;case 1:e=i-s,a=r+s;break;case 2:i=e+s,r=a-s;break;case 3:e=i-s,r=a-s}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=r,this._x1=i,this._y1=a,this},yk.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},yk.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},yk.find=function(t,n,e){var r,i,a,u,o,s,l,c=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new hk(g,c,f,h,d)),null==e?e=1/0:(c=t-e,f=n-e,h=t+e,d=n+e,e*=e);s=p.pop();)if(!(!(g=s.node)||(i=s.x0)>h||(a=s.y0)>d||(u=s.x1)<c||(o=s.y1)<f))if(g.length){var m=(i+u)/2,v=(a+o)/2;p.push(new hk(g[3],m,v,u,o),new hk(g[2],i,v,m,o),new hk(g[1],m,a,u,v),new hk(g[0],i,a,m,v)),(l=(n>=v)<<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 y=t-+this._x.call(null,g.data),_=n-+this._y.call(null,g.data),x=y*y+_*_;if(x<e){var b=Math.sqrt(e=x);c=t-b,f=n-b,h=t+b,d=n+b,r=g.data}}return r},yk.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(u=+this._y.call(null,t)))return this;var n,e,r,i,a,u,o,s,l,c,f,h,d=this._root,p=this._x0,g=this._y0,m=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((l=a>=(o=(p+m)/2))?p=o:m=o,(c=u>=(s=(g+v)/2))?g=s:v=s,n=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,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):n?(i?n[f]=i:delete n[f],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},yk.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},yk.root=function(){return this._root},yk.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},yk.visit=function(t){var n,e,r,i,a,u,o=[],s=this._root;for(s&&o.push(new hk(s,this._x0,this._y0,this._x1,this._y1));n=o.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,a=n.x1,u=n.y1)&&s.length){var l=(r+a)/2,c=(i+u)/2;(e=s[3])&&o.push(new hk(e,l,c,a,u)),(e=s[2])&&o.push(new hk(e,r,c,l,u)),(e=s[1])&&o.push(new hk(e,l,i,a,c)),(e=s[0])&&o.push(new hk(e,r,i,l,c))}return this},yk.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new hk(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var a,u=n.x0,o=n.y0,s=n.x1,l=n.y1,c=(u+s)/2,f=(o+l)/2;(a=i[0])&&e.push(new hk(a,u,o,c,f)),(a=i[1])&&e.push(new hk(a,c,o,s,f)),(a=i[2])&&e.push(new hk(a,u,f,c,l)),(a=i[3])&&e.push(new hk(a,c,f,s,l))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},yk.x=function(t){return arguments.length?(this._x=t,this):this._x},yk.y=function(t){return arguments.length?(this._y=t,this):this._y};var Mk={value:function(){}};function Ek(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new Dk(r)}function Dk(t){this._=t}function Ck(t,n){return t.trim().split(/^|\s+/).map((function(t){var e="",r=t.indexOf(".");if(r>=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))}function Fk(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function Sk(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=Mk,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}Dk.prototype=Ek.prototype={constructor:Dk,on:function(t,n){var e,r=this._,i=Ck(t+"",r),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=i[a]).type)r[e]=Sk(r[e],t.name,n);else if(null==n)for(e in r)r[e]=Sk(r[e],t.name,null);return this}for(;++a<u;)if((e=(t=i[a]).type)&&(e=Fk(r[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new Dk(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),a=0;a<e;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,e=(r=this._[t]).length;a<e;++a)r[a].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(n,e)}};var Bk,Tk,zk=0,Nk=0,Ok=0,Rk=1e3,qk=0,Lk=0,Uk=0,$k="object"==typeof performance&&performance.now?performance:Date,Pk="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function jk(){return Lk||(Pk(Ik),Lk=$k.now()+Uk)}function Ik(){Lk=0}function Hk(){this._call=this._time=this._next=null}function Wk(t,n,e){var r=new Hk;return r.restart(t,n,e),r}function Yk(){Lk=(qk=$k.now())+Uk,zk=Nk=0;try{!function(){jk(),++zk;for(var t,n=Bk;n;)(t=Lk-n._time)>=0&&n._call.call(null,t),n=n._next;--zk}()}finally{zk=0,function(){var t,n,e=Bk,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Bk=n);Tk=t,Gk(r)}(),Lk=0}}function Vk(){var t=$k.now(),n=t-qk;n>Rk&&(Uk-=n,qk=t)}function Gk(t){zk||(Nk&&(Nk=clearTimeout(Nk)),t-Lk>24?(t<1/0&&(Nk=setTimeout(Yk,t-$k.now()-Uk)),Ok&&(Ok=clearInterval(Ok))):(Ok||(qk=$k.now(),Ok=setInterval(Vk,Rk)),zk=1,Pk(Yk)))}function Xk(t){return t.x}function Jk(t){return t.y}Hk.prototype=Wk.prototype={constructor:Hk,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?jk():+e)+(null==n?0:+n),this._next||Tk===this||(Tk?Tk._next=this:Bk=this,Tk=this),this._call=t,this._time=e,Gk()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gk())}};var Zk=10,Qk=Math.PI*(3-Math.sqrt(5));var Kk={center:function(t,n){var e;function r(){var r,i,a=e.length,u=0,o=0;for(r=0;r<a;++r)u+=(i=e[r]).x,o+=i.y;for(u=u/a-t,o=o/a-n,r=0;r<a;++r)(i=e[r]).x-=u,i.y-=o}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r},collide:function(t){var n,e,r=1,i=1;function a(){for(var t,a,o,s,l,c,f,h=n.length,d=0;d<i;++d)for(a=gk(n,bk,wk).visitAfter(u),t=0;t<h;++t)o=n[t],c=e[o.index],f=c*c,s=o.x+o.vx,l=o.y+o.vy,a.visit(p);function p(t,n,e,i,a){var u=t.data,h=t.r,d=c+h;if(!u)return n>s+d||i<s-d||e>l+d||a<l-d;if(u.index>o.index){var p=s-u.x-u.vx,g=l-u.y-u.vy,m=p*p+g*g;m<d*d&&(0===p&&(m+=(p=xk())*p),0===g&&(m+=(g=xk())*g),m=(d-(m=Math.sqrt(m)))/m*r,o.vx+=(p*=m)*(d=(h*=h)/(f+h)),o.vy+=(g*=m)*d,u.vx-=p*(d=1-d),u.vy-=g*d)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function o(){if(n){var r,i,a=n.length;for(e=new Array(a),r=0;r<a;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=_k(null==t?1:+t)),a.initialize=function(t){n=t,o()},a.iterations=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:_k(+n),o(),a):t},a},nbody:function(){var t,n,e,r,i=_k(-30),a=1,u=1/0,o=.81;function s(r){var i,a=t.length,u=gk(t,Xk,Jk).visitAfter(c);for(e=r,i=0;i<a;++i)n=t[i],u.visit(f)}function l(){if(t){var n,e,a=t.length;for(r=new Array(a),n=0;n<a;++n)e=t[n],r[e.index]=+i(e,n,t)}}function c(t){var n,e,i,a,u,o=0,s=0;if(t.length){for(i=a=u=0;u<4;++u)(n=t[u])&&(e=Math.abs(n.value))&&(o+=n.value,s+=e,i+=e*n.x,a+=e*n.y);t.x=i/s,t.y=a/s}else{(n=t).x=n.data.x,n.y=n.data.y;do{o+=r[n.data.index]}while(n=n.next)}t.value=o}function f(t,i,s,l){if(!t.value)return!0;var c=t.x-n.x,f=t.y-n.y,h=l-i,d=c*c+f*f;if(h*h/o<d)return d<u&&(0===c&&(d+=(c=xk())*c),0===f&&(d+=(f=xk())*f),d<a&&(d=Math.sqrt(a*d)),n.vx+=c*t.value*e/d,n.vy+=f*t.value*e/d),!0;if(!(t.length||d>=u)){(t.data!==n||t.next)&&(0===c&&(d+=(c=xk())*c),0===f&&(d+=(f=xk())*f),d<a&&(d=Math.sqrt(a*d)));do{t.data!==n&&(h=r[t.data.index]*e/d,n.vx+=c*h,n.vy+=f*h)}while(t=t.next)}}return s.initialize=function(n){t=n,l()},s.strength=function(t){return arguments.length?(i="function"==typeof t?t:_k(+t),l(),s):i},s.distanceMin=function(t){return arguments.length?(a=t*t,s):Math.sqrt(a)},s.distanceMax=function(t){return arguments.length?(u=t*t,s):Math.sqrt(u)},s.theta=function(t){return arguments.length?(o=t*t,s):Math.sqrt(o)},s},link:function(t){var n,e,r,i,a,u=Ak,o=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},s=_k(30),l=1;function c(r){for(var i=0,u=t.length;i<l;++i)for(var o,s,c,f,h,d,p,g=0;g<u;++g)s=(o=t[g]).source,f=(c=o.target).x+c.vx-s.x-s.vx||xk(),h=c.y+c.vy-s.y-s.vy||xk(),f*=d=((d=Math.sqrt(f*f+h*h))-e[g])/d*r*n[g],h*=d,c.vx-=f*(p=a[g]),c.vy-=h*p,s.vx+=f*(p=1-p),s.vy+=h*p}function f(){if(r){var o,s,l=r.length,c=t.length,f=new Map(r.map((t,n)=>[u(t,n,r),t]));for(o=0,i=new Array(l);o<c;++o)(s=t[o]).index=o,"object"!=typeof s.source&&(s.source=kk(f,s.source)),"object"!=typeof s.target&&(s.target=kk(f,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(o=0,a=new Array(c);o<c;++o)s=t[o],a[o]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);n=new Array(c),h(),e=new Array(c),d()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+o(t[e],e,t)}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+s(t[n],n,t)}return null==t&&(t=[]),c.initialize=function(t){r=t,f()},c.links=function(n){return arguments.length?(t=n,f(),c):t},c.id=function(t){return arguments.length?(u=t,c):u},c.iterations=function(t){return arguments.length?(l=+t,c):l},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:_k(+t),h(),c):o},c.distance=function(t){return arguments.length?(s="function"==typeof t?t:_k(+t),d(),c):s},c},x:function(t){var n,e,r,i=_k(.1);function a(t){for(var i,a=0,u=n.length;a<u;++a)(i=n[a]).vx+=(r[a]-i.x)*e[a]*t}function u(){if(n){var a,u=n.length;for(e=new Array(u),r=new Array(u),a=0;a<u;++a)e[a]=isNaN(r[a]=+t(n[a],a,n))?0:+i(n[a],a,n)}}return"function"!=typeof t&&(t=_k(null==t?0:+t)),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(i="function"==typeof t?t:_k(+t),u(),a):i},a.x=function(n){return arguments.length?(t="function"==typeof n?n:_k(+n),u(),a):t},a},y:function(t){var n,e,r,i=_k(.1);function a(t){for(var i,a=0,u=n.length;a<u;++a)(i=n[a]).vy+=(r[a]-i.y)*e[a]*t}function u(){if(n){var a,u=n.length;for(e=new Array(u),r=new Array(u),a=0;a<u;++a)e[a]=isNaN(r[a]=+t(n[a],a,n))?0:+i(n[a],a,n)}}return"function"!=typeof t&&(t=_k(null==t?0:+t)),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(i="function"==typeof t?t:_k(+t),u(),a):i},a.y=function(n){return arguments.length?(t="function"==typeof n?n:_k(+n),u(),a):t},a}},tM="forces",nM=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],eM=["static","iterations"],rM=["x","y","vx","vy"];function iM(t){Qr.call(this,null,t)}iM.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:rM}]};var aM=ot(iM,Qr);function uM(t,n,e,r){var i,a,u,o,s=V(n.forces);for(i=0,a=nM.length;i<a;++i)(u=nM[i])!==tM&&n.modified(u)&&t[u](n[u]);for(i=0,a=s.length;i<a;++i)o=tM+i,(u=e||n.modified(tM,i)?sM(s[i]):r&&oM(s[i],r)?t.force(o):null)&&t.force(o,u);for(a=t.numForces||0;i<a;++i)t.force(tM+i,null);return t.numForces=s.length,t}function oM(t,n){var e,i;for(e in t)if(X(i=t[e])&&n.modified(r(i)))return 1;return 0}function sM(t){var n,e;for(e in rt(Kk,t.force)||i("Unrecognized force: "+t.force),n=Kk[t.force](),t)X(n[e])&&lM(n[e],t[e],t);return n}function lM(t,n,e){t(X(n)?function(t){return n(t,e)}:n)}aM.transform=function(t,n){var e,r,i=this.value,a=n.changed(n.ADD_REM),u=t.modified(nM),o=t.iterations||300;if(i?(a&&(n.modifies("index"),i.nodes(n.source)),(u||n.changed(n.MOD))&&uM(i,t,0,n)):(this.value=i=function(t,n){var e=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),a=0,u=.6,o=new Map,s=Wk(c),l=Ek("tick","end");function c(){f(),l.call("tick",n),e<r&&(s.stop(),l.call("end",n))}function f(r){var s,l,c=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(e+=(a-e)*i,o.forEach((function(t){t(e)})),s=0;s<c;++s)null==(l=t[s]).fx?l.x+=l.vx*=u:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=u:(l.y=l.fy,l.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=Zk*Math.sqrt(e),a=e*Qk;n.x=i*Math.cos(a),n.y=i*Math.sin(a)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function d(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:f,restart:function(){return s.restart(c),n},stop:function(){return s.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),o.forEach(d),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(a=+t,n):a},velocityDecay:function(t){return arguments.length?(u=1-t,n):1-u},force:function(t,e){return arguments.length>1?(null==e?o.delete(t):o.set(t,d(e)),n):o.get(t)},find:function(n,e,r){var i,a,u,o,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l<c;++l)(u=(i=n-(o=t[l]).x)*i+(a=e-o.y)*a)<r&&(s=o,r=u);return s},on:function(t,e){return arguments.length>1?(l.on(t,e),n):l.on(t)}}}(t),r=!1,i=e.stop,a=e.restart;return e.stopped=function(){return r},e.restart=function(){return r=!1,a()},e.stop=function(){return r=!0,i()},uM(e,n,!0).on("end",(function(){r=!0}))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,function(){e.touch(r).run()})),t.static||(a=!0,i.tick()),n.modifies("index")),u||a||t.modified(eM)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/o)),t.static)for(i.stop();--o>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return n.StopPropagation;return this.finish(t,n)},aM.finish=function(t,n){for(var e,r=n.dataflow,i=this._argops,a=0,u=i.length;a<u;++a)if((e=i[a]).name===tM&&"link"===e.op._argval.force)for(var o,s=e.op._argops,l=0,c=s.length;l<c;++l)if("links"===s[l].name&&(o=s[l].op.source)){r.pulse(o,r.changeset().reflow());break}return n.reflow(t.modified()).modifies(rM)};var cM=Object.freeze({__proto__:null,force:iM});function fM(t,n,e){var r={};return t.each((function(t){var i=t.data;e(i)&&(r[n(i)]=t)})),t.lookup=r,t}function hM(t,n){return t.parent===n.parent?1:2}function dM(t,n){return t+n.x}function pM(t,n){return Math.max(t,n.y)}function gM(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function mM(t,n){var e,r,i,a,u,o=new xM(t),s=+t.value&&(o.value=t.value),l=[o];for(null==n&&(n=vM);e=l.pop();)if(s&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),a=u-1;a>=0;--a)l.push(r=e.children[a]=new xM(i[a])),r.parent=e,r.depth=e.depth+1;return o.eachBefore(_M)}function vM(t){return t.children}function yM(t){t.data=t.data.data}function _M(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function xM(t){this.data=t,this.depth=this.height=0,this.parent=null}xM.prototype=mM.prototype={constructor:xM,count:function(){return this.eachAfter(gM)},each:function(t){var n,e,r,i,a=this,u=[a];do{for(n=u.reverse(),u=[];a=n.pop();)if(t(a),e=a.children)for(r=0,i=e.length;r<i;++r)u.push(e[r])}while(u.length);return this},eachAfter:function(t){for(var n,e,r,i=this,a=[i],u=[];i=a.pop();)if(u.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)a.push(n[e]);for(;i=u.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;t=e.pop(),n=r.pop();for(;t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each((function(n){t.push(n)})),t},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return mM(this).eachBefore(yM)}};var bM=Array.prototype.slice;function wM(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(bM.call(t))).length,a=[];r<i;)n=t[r],e&&MM(e,n)?++r:(e=DM(a=AM(a,n)),r=0);return e}function AM(t,n){var e,r;if(EM(n,t))return[n];for(e=0;e<t.length;++e)if(kM(n,t[e])&&EM(CM(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(kM(CM(t[e],t[r]),n)&&kM(CM(t[e],n),t[r])&&kM(CM(t[r],n),t[e])&&EM(FM(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function kM(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function MM(t,n){var e=t.r-n.r+1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function EM(t,n){for(var e=0;e<n.length;++e)if(!MM(t,n[e]))return!1;return!0}function DM(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return CM(t[0],t[1]);case 3:return FM(t[0],t[1],t[2])}var n}function CM(t,n){var e=t.x,r=t.y,i=t.r,a=n.x,u=n.y,o=n.r,s=a-e,l=u-r,c=o-i,f=Math.sqrt(s*s+l*l);return{x:(e+a+s/f*c)/2,y:(r+u+l/f*c)/2,r:(f+i+o)/2}}function FM(t,n,e){var r=t.x,i=t.y,a=t.r,u=n.x,o=n.y,s=n.r,l=e.x,c=e.y,f=e.r,h=r-u,d=r-l,p=i-o,g=i-c,m=s-a,v=f-a,y=r*r+i*i-a*a,_=y-u*u-o*o+s*s,x=y-l*l-c*c+f*f,b=d*p-h*g,w=(p*x-g*_)/(2*b)-r,A=(g*m-p*v)/b,k=(d*_-h*x)/(2*b)-i,M=(h*v-d*m)/b,E=A*A+M*M-1,D=2*(a+w*A+k*M),C=w*w+k*k-a*a,F=-(E?(D+Math.sqrt(D*D-4*E*C))/(2*E):C/D);return{x:r+w+A*F,y:i+k+M*F,r:F}}function SM(t,n,e){var r,i,a,u,o=t.x-n.x,s=t.y-n.y,l=o*o+s*s;l?(i=n.r+e.r,i*=i,u=t.r+e.r,i>(u*=u)?(r=(l+u-i)/(2*l),a=Math.sqrt(Math.max(0,u/l-r*r)),e.x=t.x-r*o-a*s,e.y=t.y-r*s+a*o):(r=(l+i-u)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),e.x=n.x+r*o-a*s,e.y=n.y+r*s+a*o)):(e.x=n.x+e.r,e.y=n.y)}function BM(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function TM(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,a=(n.y*e.r+e.y*n.r)/r;return i*i+a*a}function zM(t){this._=t,this.next=null,this.previous=null}function NM(t){return null==t?null:OM(t)}function OM(t){if("function"!=typeof t)throw new Error;return t}function RM(){return 0}function qM(t){return function(){return t}}function LM(t){return Math.sqrt(t.value)}function UM(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function $M(t,n){return function(e){if(r=e.children){var r,i,a,u=r.length,o=t(e)*n||0;if(o)for(i=0;i<u;++i)r[i].r+=o;if(a=function(t){if(!(i=t.length))return 0;var n,e,r,i,a,u,o,s,l,c,f;if((n=t[0]).x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;SM(e,n,r=t[2]),n=new zM(n),e=new zM(e),r=new zM(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(o=3;o<i;++o){SM(n._,e._,r=t[o]),r=new zM(r),s=e.next,l=n.previous,c=e._.r,f=n._.r;do{if(c<=f){if(BM(s._,r._)){e=s,n.next=e,e.previous=n,--o;continue t}c+=s._.r,s=s.next}else{if(BM(l._,r._)){(n=l).next=e,e.previous=n,--o;continue t}f+=l._.r,l=l.previous}}while(s!==l.next);for(r.previous=n,r.next=e,n.next=e.previous=e=r,a=TM(n);(r=r.next)!==e;)(u=TM(r))<a&&(n=r,a=u);e=n.next}for(n=[e._],r=e;(r=r.next)!==e;)n.push(r._);for(r=wM(n),o=0;o<i;++o)(n=t[o]).x-=r.x,n.y-=r.y;return r.r}(r),o)for(i=0;i<u;++i)r[i].r-=o;e.r=a+o}}}function PM(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function jM(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function IM(t,n,e,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(r-n)/t.value;++o<s;)(a=u[o]).y0=e,a.y1=i,a.x0=n,a.x1=n+=a.value*l}var HM="$",WM={depth:-1},YM={};function VM(t){return t.id}function GM(t){return t.parentId}function XM(){var t=VM,n=GM;function e(e){var r,i,a,u,o,s,l,c=e.length,f=new Array(c),h={};for(i=0;i<c;++i)r=e[i],o=f[i]=new xM(r),null!=(s=t(r,i,e))&&(s+="")&&(h[l=HM+(o.id=s)]=l in h?YM:o);for(i=0;i<c;++i)if(o=f[i],null!=(s=n(e[i],i,e))&&(s+="")){if(!(u=h[HM+s]))throw new Error("missing: "+s);if(u===YM)throw new Error("ambiguous: "+s);u.children?u.children.push(o):u.children=[o],o.parent=u}else{if(a)throw new Error("multiple roots");a=o}if(!a)throw new Error("no root");if(a.parent=WM,a.eachBefore((function(t){t.depth=t.parent.depth+1,--c})).eachBefore(_M),a.parent=null,c>0)throw new Error("cycle");return a}return e.id=function(n){return arguments.length?(t=OM(n),e):t},e.parentId=function(t){return arguments.length?(n=OM(t),e):n},e}function JM(t,n){return t.parent===n.parent?1:2}function ZM(t){var n=t.children;return n?n[0]:t.t}function QM(t){var n=t.children;return n?n[n.length-1]:t.t}function KM(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function tE(t,n,e){return t.a.parent===n.parent?t.a:e}function nE(t,n){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=n}function eE(t,n,e,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(i-e)/t.value;++o<s;)(a=u[o]).x0=n,a.x1=r,a.y0=e,a.y1=e+=a.value*l}nE.prototype=Object.create(xM.prototype);var rE=(1+Math.sqrt(5))/2;function iE(t,n,e,r,i,a){for(var u,o,s,l,c,f,h,d,p,g,m,v=[],y=n.children,_=0,x=0,b=y.length,w=n.value;_<b;){s=i-e,l=a-r;do{c=y[x++].value}while(!c&&x<b);for(f=h=c,m=c*c*(g=Math.max(l/s,s/l)/(w*t)),p=Math.max(h/m,m/f);x<b;++x){if(c+=o=y[x].value,o<f&&(f=o),o>h&&(h=o),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=o;break}p=d}v.push(u={value:c,dice:s<l,children:y.slice(_,x)}),u.dice?IM(u,e,r,i,w?r+=l*c/w:a):eE(u,e,r,w?e+=s*c/w:i,a),w-=c,_=x}return v}var aE=function t(n){function e(t,e,r,i,a){iE(n,t,e,r,i,a)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(rE);var uE=function t(n){function e(t,e,r,i,a){if((u=t._squarify)&&u.ratio===n)for(var u,o,s,l,c,f=-1,h=u.length,d=t.value;++f<h;){for(s=(o=u[f]).children,l=o.value=0,c=s.length;l<c;++l)o.value+=s[l].value;o.dice?IM(o,e,r,i,r+=(a-r)*o.value/d):eE(o,e,r,e+=(i-e)*o.value/d,a),d-=o.value}else t._squarify=u=iE(n,t,e,r,i,a),u.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(rE);function oE(t){Qr.call(this,null,t)}function sE(t){return t.values}function lE(){var t,n=[];return t={entries:t=>(function t(e,r){if(++r>n.length)return e;var i,a=[];for(i in e)a.push({key:i,values:t(e[i],r)});return a})(function t(e,r){if(r>=n.length)return e;for(var i,a,u,o=-1,s=e.length,l=n[r++],c={},f={};++o<s;)(u=c[i=l(a=e[o])+""])?u.push(a):c[i]=[a];for(i in c)f[i]=t(c[i],r);return f}(t,0),0),key:e=>(n.push(e),t)}}function cE(t){Qr.call(this,null,t)}function fE(t,n){return t.parent===n.parent?1:2}oE.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},ot(oE,Qr).transform=function(t,n){n.source||i("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),a=n.clone(),u=this.value;return(!u||r||n.changed())&&(u&&u.each(t=>{t.children&&St(t.data)&&a.rem.push(t.data)}),this.value=u=mM({values:V(t.keys).reduce((t,n)=>(t.key(n),t),lE()).entries(a.source)},sE),e&&u.each(t=>{t.children&&(t=zt(t.data),a.add.push(t),a.source.push(t))}),fM(u,Bt,Bt)),a.source.root=u,a},ot(cE,Qr).transform=function(t,n){n.source&&n.source.root||i(this.constructor.name+" transform requires a backing tree data source.");var e=this.layout(t.method),r=this.fields,a=n.source.root,u=t.as||r;t.field?a.sum(t.field):a.count(),t.sort&&a.sort(qt(t.sort,t=>t.data)),function(t,n,e){for(var r,i=0,a=n.length;i<a;++i)(r=n[i])in e&&t[r](e[r])}(e,this.params,t),e.separation&&e.separation(!1!==t.separation?fE:g);try{this.value=e(a)}catch(t){i(t)}return a.each((function(t){!function(t,n,e){for(var r=t.data,i=0,a=n.length-1;i<a;++i)r[e[i]]=t[n[i]];r[e[a]]=t.children?t.children.length:0}(t,r,u)})),n.reflow(t.modified()).modifies(u).modifies("leaf")};var hE=["x","y","r","depth","children"];function dE(t){cE.call(this,t)}dE.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:hE.length,default:hE}]};var pE=ot(dE,cE);pE.layout=function(){var t=null,n=1,e=1,r=RM;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(UM(t)).eachAfter($M(r,.5)).eachBefore(PM(1)):i.eachBefore(UM(LM)).eachAfter($M(RM,1)).eachAfter($M(r,i.r/Math.min(n,e))).eachBefore(PM(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=NM(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:qM(+t),i):r},i},pE.params=["radius","size","padding"],pE.fields=hE;var gE=["x0","y0","x1","y1","depth","children"];function mE(t){cE.call(this,t)}mE.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:gE.length,default:gE}]};var vE=ot(mE,cE);function yE(t){Qr.call(this,null,t)}vE.layout=function(){var t=1,n=1,e=0,r=!1;function i(i){var a=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/a,i.eachBefore(function(t,n){return function(r){r.children&&IM(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,a=r.y0,u=r.x1-e,o=r.y1-e;u<i&&(i=u=(i+u)/2),o<a&&(a=o=(a+o)/2),r.x0=i,r.y0=a,r.x1=u,r.y1=o}}(n,a)),r&&i.eachBefore(jM),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},vE.params=["size","round","padding"],vE.fields=gE,yE.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},ot(yE,Qr).transform=function(t,n){n.source||i("Stratify transform requires an upstream data source.");var e=this.value,r=t.modified(),a=n.fork(n.ALL).materialize(n.SOURCE),u=!this.value||r||n.changed(n.ADD_REM)||n.modified(t.key.fields)||n.modified(t.parentKey.fields);return a.source=a.source.slice(),u&&(e=a.source.length?fM(XM().id(t.key).parentId(t.parentKey)(a.source),t.key,m):fM(XM()([{}]),t.key,t.key)),a.source.root=this.value=e,a};var _E={tidy:function(){var t=JM,n=1,e=1,r=null;function i(i){var s=function(t){for(var n,e,r,i,a,u=new nE(t,0),o=[u];n=o.pop();)if(r=n._.children)for(n.children=new Array(a=r.length),i=a-1;i>=0;--i)o.push(e=n.children[i]=new nE(r[i],i)),e.parent=n;return(u.parent=new nE(null,0)).children=[u],u}(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(u),r)i.eachBefore(o);else{var l=i,c=i,f=i;i.eachBefore((function(t){t.x<l.x&&(l=t),t.x>c.x&&(c=t),t.depth>f.depth&&(f=t)}));var h=l===c?1:t(l,c)/2,d=h-l.x,p=n/(c.x+h+d),g=e/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function a(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,a=i.length;--a>=0;)(n=i[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var a=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-a):n.z=a}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,a=n,u=n,o=e,s=a.parent.children[0],l=a.m,c=u.m,f=o.m,h=s.m;o=QM(o),a=ZM(a),o&&a;)s=ZM(s),(u=QM(u)).a=n,(i=o.z+f-a.z-l+t(o._,a._))>0&&(KM(tE(o,n,r),n,i),l+=i,c+=i),f+=o.m,l+=a.m,h+=s.m,c+=u.m;o&&!QM(u)&&(u.t=o,u.m+=f-c),a&&!ZM(s)&&(s.t=a,s.m+=l-h,r=n)}return r}(n,i,n.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function o(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=hM,n=1,e=1,r=!1;function i(i){var a,u=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(dM,0)/t.length}(e),n.y=function(t){return 1+t.reduce(pM,0)}(e)):(n.x=a?u+=t(n,a):0,n.y=0,a=n)}));var o=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),l=o.x-t(o,s)/2,c=s.x+t(s,o)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-l)/(c-l)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},xE=["x","y","depth","children"];function bE(t){cE.call(this,t)}bE.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:xE.length,default:xE}]};var wE=ot(bE,cE);function AE(t){Qr.call(this,[],t)}wE.layout=function(t){var n=t||"tidy";if(rt(_E,n))return _E[n]();i("Unrecognized Tree layout method: "+n)},wE.params=["size","nodeSize"],wE.fields=xE,AE.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ot(AE,Qr).transform=function(t,n){var e=this.value,r=n.source&&n.source.root,a=n.fork(n.NO_SOURCE),u={};return r||i("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(a.rem=e,n.visit(n.SOURCE,(function(t){u[Bt(t)]=1})),r.each((function(t){var n=t.data,e=t.parent&&t.parent.data;e&&u[Bt(n)]&&u[Bt(e)]&&a.add.push(zt({source:e,target:n}))})),this.value=a.add):n.changed(n.MOD)&&(n.visit(n.MOD,(function(t){u[Bt(t)]=1})),e.forEach((function(t){(u[Bt(t.source)]||u[Bt(t.target)])&&a.mod.push(t)}))),a};var kE={binary:function(t,n,e,r,i){var a,u,o=t.children,s=o.length,l=new Array(s+1);for(l[0]=u=a=0;a<s;++a)l[a+1]=u+=o[a].value;!function t(n,e,r,i,a,u,s){if(n>=e-1){var c=o[n];return c.x0=i,c.y0=a,c.x1=u,void(c.y1=s)}var f=l[n],h=r/2+f,d=n+1,p=e-1;for(;d<p;){var g=d+p>>>1;l[g]<h?d=g+1:p=g}h-l[d-1]<l[d]-h&&n+1<d&&--d;var m=l[d]-f,v=r-m;if(u-i>s-a){var y=(i*v+u*m)/r;t(n,d,m,i,a,y,s),t(d,e,v,y,a,u,s)}else{var _=(a*v+s*m)/r;t(n,d,m,i,a,u,_),t(d,e,v,i,_,u,s)}}(0,s,t.value,n,e,r,i)},dice:IM,slice:eE,slicedice:function(t,n,e,r,i){(1&t.depth?eE:IM)(t,n,e,r,i)},squarify:aE,resquarify:uE},ME=["x0","y0","x1","y1","depth","children"];function EE(t){cE.call(this,t)}EE.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:ME.length,default:ME}]};var DE=ot(EE,cE);DE.layout=function(){var t=function(){var t=aE,n=!1,e=1,r=1,i=[0],a=RM,u=RM,o=RM,s=RM,l=RM;function c(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(jM),t}function f(n){var e=i[n.depth],r=n.x0+e,c=n.y0+e,f=n.x1-e,h=n.y1-e;f<r&&(r=f=(r+f)/2),h<c&&(c=h=(c+h)/2),n.x0=r,n.y0=c,n.x1=f,n.y1=h,n.children&&(e=i[n.depth+1]=a(n)/2,r+=l(n)-e,c+=u(n)-e,(f-=o(n)-e)<r&&(r=f=(r+f)/2),(h-=s(n)-e)<c&&(c=h=(c+h)/2),t(n,r,c,f,h))}return c.round=function(t){return arguments.length?(n=!!t,c):n},c.size=function(t){return arguments.length?(e=+t[0],r=+t[1],c):[e,r]},c.tile=function(n){return arguments.length?(t=OM(n),c):t},c.padding=function(t){return arguments.length?c.paddingInner(t).paddingOuter(t):c.paddingInner()},c.paddingInner=function(t){return arguments.length?(a="function"==typeof t?t:qM(+t),c):a},c.paddingOuter=function(t){return arguments.length?c.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):c.paddingTop()},c.paddingTop=function(t){return arguments.length?(u="function"==typeof t?t:qM(+t),c):u},c.paddingRight=function(t){return arguments.length?(o="function"==typeof t?t:qM(+t),c):o},c.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:qM(+t),c):s},c.paddingLeft=function(t){return arguments.length?(l="function"==typeof t?t:qM(+t),c):l},c}();return t.ratio=function(n){var e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=function(n){rt(kE,n)?t.tile(kE[n]):i("Unrecognized Treemap layout method: "+n)},t},DE.params=["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],DE.fields=ME;var CE=Object.freeze({__proto__:null,nest:oE,pack:dE,partition:mE,stratify:yE,tree:bE,treelinks:AE,treemap:EE});function FE(t,n){var e,r,i,a,u,o,s=[],l=function(t){return t(a)};if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)a=t[r],(o=e[u=n.map(l)])||(e[u]=o=[],o.dims=u,s.push(o)),o.push(a);return s}function SE(t){Qr.call(this,null,t)}SE.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},ot(SE,Qr).transform=function(t,n){var r=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const i=FE(n.materialize(n.SOURCE).source,t.groupby),a=(t.groupby||[]).map(e),u=a.length,o=t.as||[e(t.x),e(t.y)],s=[];i.forEach(n=>{ma(n,t.x,t.y,t.bandwidth||.3).forEach(t=>{const e={};for(let t=0;t<u;++t)e[a[t]]=n.dims[t];e[o[0]]=t[0],e[o[1]]=t[1],s.push(zt(e))})}),this.value&&(r.rem=this.value),this.value=r.add=r.source=s}return r};const BE={linear:oa,log:sa,exp:la,pow:ca,quad:fa,poly:ha};function TE(t){Qr.call(this,null,t)}TE.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(BE)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},ot(TE,Qr).transform=function(t,n){var r=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const a=FE(n.materialize(n.SOURCE).source,t.groupby),u=(t.groupby||[]).map(e),o=t.method||"linear",s=t.order||3,l=function(t,n){return"poly"===t?n:"quad"===t?2:1}(o,s),c=t.as||[e(t.x),e(t.y)],f=BE[o],h=[];let d=t.extent;rt(BE,o)||i("Invalid regression method: "+o),null!=d&&"log"===o&&d[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),a.forEach(e=>{if(e.length<=l)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(e,t.x,t.y,s);if(t.params)return void h.push(zt({keys:e.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||tt(e,t.x),a=t=>{const n={};for(let t=0;t<u.length;++t)n[u[t]]=e.dims[t];n[c[0]]=t[0],n[c[1]]=t[1],h.push(zt(n))};"linear"===o?i.forEach(t=>a([t,r.predict(t)])):xa(r.predict,i,25,200).forEach(a)}),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r};var zE=Object.freeze({__proto__:null,loess:SE,regression:TE});const NE=Math.pow(2,-52),OE=new Uint32Array(512);class RE{static from(t,n=HE,e=WE){const r=t.length,i=new Float64Array(2*r);for(let a=0;a<r;a++){const r=t[a];i[2*a]=n(r),i[2*a+1]=e(r)}return new RE(i)}constructor(t){const n=t.length>>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,a=t.length>>1;let u=1/0,o=1/0,s=-1/0,l=-1/0;for(let n=0;n<a;n++){const e=t[2*n],r=t[2*n+1];e<u&&(u=e),r<o&&(o=r),e>s&&(s=e),r>l&&(l=r),this._ids[n]=n}const c=(u+s)/2,f=(o+l)/2;let h,d,p,g=1/0;for(let n=0;n<a;n++){const e=qE(c,f,t[2*n],t[2*n+1]);e<g&&(h=n,g=e)}const m=t[2*h],v=t[2*h+1];g=1/0;for(let n=0;n<a;n++){if(n===h)continue;const e=qE(m,v,t[2*n],t[2*n+1]);e<g&&e>0&&(d=n,g=e)}let y=t[2*d],_=t[2*d+1],x=1/0;for(let n=0;n<a;n++){if(n===h||n===d)continue;const e=PE(m,v,y,_,t[2*n],t[2*n+1]);e<x&&(p=n,x=e)}let b=t[2*p],w=t[2*p+1];if(x===1/0){for(let n=0;n<a;n++)this._dists[n]=t[2*n]-t[0]||t[2*n+1]-t[1];jE(this._ids,this._dists,0,a-1);const n=new Uint32Array(a);let e=0;for(let t=0,r=-1/0;t<a;t++){const i=this._ids[t];this._dists[i]>r&&(n[e++]=i,r=this._dists[i])}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(UE(m,v,y,_,b,w)){const t=d,n=y,e=_;d=p,y=b,_=w,p=t,b=n,w=e}const A=function(t,n,e,r,i,a){const u=e-t,o=r-n,s=i-t,l=a-n,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s);return{x:t+(l*c-o*f)*h,y:n+(u*f-s*c)*h}}(m,v,y,_,b,w);this._cx=A.x,this._cy=A.y;for(let n=0;n<a;n++)this._dists[n]=qE(t[2*n],t[2*n+1],A.x,A.y);jE(this._ids,this._dists,0,a-1),this._hullStart=h;let k=3;e[h]=n[p]=d,e[d]=n[h]=p,e[p]=n[d]=h,r[h]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(m,v)]=h,i[this._hashKey(y,_)]=d,i[this._hashKey(b,w)]=p,this.trianglesLen=0,this._addTriangle(h,d,p,-1,-1,-1);for(let a,u,o=0;o<this._ids.length;o++){const s=this._ids[o],l=t[2*s],c=t[2*s+1];if(o>0&&Math.abs(l-a)<=NE&&Math.abs(c-u)<=NE)continue;if(a=l,u=c,s===h||s===d||s===p)continue;let f=0;for(let t=0,n=this._hashKey(l,c);t<this._hashSize&&(f=i[(n+t)%this._hashSize],-1===f||f===e[f]);t++);f=n[f];let g,m=f;for(;g=e[m],!UE(l,c,t[2*m],t[2*m+1],t[2*g],t[2*g+1]);)if(m=g,m===f){m=-1;break}if(-1===m)continue;let v=this._addTriangle(m,s,e[m],-1,-1,r[m]);r[s]=this._legalize(v+2),r[m]=v,k++;let y=e[m];for(;g=e[y],UE(l,c,t[2*y],t[2*y+1],t[2*g],t[2*g+1]);)v=this._addTriangle(y,s,g,r[s],-1,r[y]),r[s]=this._legalize(v+2),e[y]=y,k--,y=g;if(m===f)for(;g=n[m],UE(l,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1]);)v=this._addTriangle(g,s,m,-1,r[m],r[g]),this._legalize(v+2),r[g]=v,e[m]=m,k--,m=g;this._hullStart=n[s]=m,e[m]=n[y]=s,e[s]=y,i[this._hashKey(l,c)]=s,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(k);for(let t=0,n=this._hullStart;t<k;t++)this.hull[t]=n,n=e[n];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(function(t,n){const e=t/(Math.abs(t)+Math.abs(n));return(n>0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,a=0;for(;;){const u=e[t],o=t-t%3;if(a=o+(t+2)%3,-1===u){if(0===i)break;t=OE[--i];continue}const s=u-u%3,l=o+(t+1)%3,c=s+(u+2)%3,f=n[a],h=n[t],d=n[l],p=n[c];if($E(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])){n[t]=p,n[u]=f;const r=e[c];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===c){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(u,e[a]),this._link(a,c);const o=s+(u+1)%3;i<OE.length&&(OE[i++]=o)}else{if(0===i)break;t=OE[--i]}}return a}_link(t,n){this._halfedges[t]=n,-1!==n&&(this._halfedges[n]=t)}_addTriangle(t,n,e,r,i,a){const u=this.trianglesLen;return this._triangles[u]=t,this._triangles[u+1]=n,this._triangles[u+2]=e,this._link(u,r),this._link(u+1,i),this._link(u+2,a),this.trianglesLen+=3,u}}function qE(t,n,e,r){const i=t-e,a=n-r;return i*i+a*a}function LE(t,n,e,r,i,a){const u=(r-n)*(i-t),o=(e-t)*(a-n);return Math.abs(u-o)>=33306690738754716e-32*Math.abs(u+o)?u-o:0}function UE(t,n,e,r,i,a){return(LE(i,a,t,n,e,r)||LE(t,n,e,r,i,a)||LE(e,r,i,a,t,n))<0}function $E(t,n,e,r,i,a,u,o){const s=t-u,l=n-o,c=e-u,f=r-o,h=i-u,d=a-o,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 PE(t,n,e,r,i,a){const u=e-t,o=r-n,s=i-t,l=a-n,c=u*u+o*o,f=s*s+l*l,h=.5/(u*l-o*s),d=(l*c-o*f)*h,p=(u*f-s*c)*h;return d*d+p*p}function jE(t,n,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const r=t[i],a=n[r];let u=i-1;for(;u>=e&&n[t[u]]>a;)t[u+1]=t[u--];t[u+1]=r}else{let i=e+1,a=r;IE(t,e+r>>1,i),n[t[e]]>n[t[r]]&&IE(t,e,r),n[t[i]]>n[t[r]]&&IE(t,i,r),n[t[e]]>n[t[i]]&&IE(t,e,i);const u=t[i],o=n[u];for(;;){do{i++}while(n[t[i]]<o);do{a--}while(n[t[a]]>o);if(a<i)break;IE(t,i,a)}t[e+1]=t[a],t[a]=u,r-i+1>=a-e?(jE(t,n,i,r),jE(t,n,e,a-1)):(jE(t,n,e,a-1),jE(t,n,i,r))}}function IE(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function HE(t){return t[0]}function WE(t){return t[1]}const YE=1e-6;class VE{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>YE||Math.abs(this._y1-i)>YE)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class GE{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}class XE{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))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=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this,i=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let n,r,a=0,u=0,o=e.length;a<o;a+=3,u+=2){const o=2*e[a],s=2*e[a+1],l=2*e[a+2],c=t[o],f=t[o+1],h=t[s],d=t[s+1],p=t[l],g=t[l+1],m=h-c,v=d-f,y=p-c,_=g-f,x=m*m+v*v,b=y*y+_*_,w=2*(m*_-v*y);if(w)if(Math.abs(w)<1e-8)n=(c+p)/2,r=(f+g)/2;else{const t=1/w;n=c+(_*x-v*b)*t,r=f+(m*b-y*x)*t}else n=(c+p)/2-1e8*_,r=(f+g)/2+1e8*y;i[u]=n,i[u+1]=r}let a,u,o,s=n[n.length-1],l=4*s,c=t[2*s],f=t[2*s+1];r.fill(0);for(let e=0;e<n.length;++e)s=n[e],a=l,u=c,o=f,l=4*s,c=t[2*s],f=t[2*s+1],r[a+2]=r[l]=o-f,r[a+3]=r[l+1]=c-u}render(t){const n=null==t?t=new VE:void 0,{delaunay:{halfedges:e,inedges:r,hull:i},circumcenters:a,vectors:u}=this;if(i.length<=1)return null;for(let n=0,r=e.length;n<r;++n){const r=e[n];if(r<n)continue;const i=2*Math.floor(n/3),u=2*Math.floor(r/3),o=a[i],s=a[i+1],l=a[u],c=a[u+1];this._renderSegment(o,s,l,c,t)}let o,s=i[i.length-1];for(let n=0;n<i.length;++n){o=s,s=i[n];const e=2*Math.floor(r[s]/3),l=a[e],c=a[e+1],f=4*o,h=this._project(l,c,u[f+2],u[f+3]);h&&this._renderSegment(l,c,h[0],h[1],t)}return n&&n.value()}renderBounds(t){const n=null==t?t=new VE:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const e=null==n?n=new VE:void 0,r=this._clip(t);if(null===r)return;n.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||n.lineTo(r[t],r[t+1]);return n.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,e=t.length/2;n<e;++n){const t=this.cellPolygon(n);t&&(yield t)}}cellPolygon(t){const n=new GE;return this.renderCell(t,n),n.value()}_renderSegment(t,n,e,r,i){let a;const u=this._regioncode(t,n),o=this._regioncode(e,r);0===u&&0===o?(i.moveTo(t,n),i.lineTo(e,r)):(a=this._clipSegment(t,n,e,r,u,o))&&(i.moveTo(a[0],a[1]),i.lineTo(a[2],a[3]))}contains(t,n,e){return(n=+n)==n&&(e=+e)==e&&this.delaunay._step(t,n,e)===t}_cell(t){const{circumcenters:n,delaunay:{inedges:e,halfedges:r,triangles:i}}=this,a=e[t];if(-1===a)return null;const u=[];let o=a;do{const e=Math.floor(o/3);if(u.push(n[2*e],n[2*e+1]),o=o%3==2?o-2:o+1,i[o]!==t)break;o=r[o]}while(o!==a&&-1!==o);return u}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(null===n)return null;const{vectors:e}=this,r=4*t;return e[r]||e[r+1]?this._clipInfinite(t,n,e[r],e[r+1],e[r+2],e[r+3]):this._clipFinite(t,n)}_clipFinite(t,n){const e=n.length;let r,i,a,u,o,s=null,l=n[e-2],c=n[e-1],f=this._regioncode(l,c);for(let h=0;h<e;h+=2)if(r=l,i=c,l=n[h],c=n[h+1],a=f,f=this._regioncode(l,c),0===a&&0===f)u=o,o=0,s?s.push(l,c):s=[l,c];else{let n,e,h,d,p;if(0===a){if(null===(n=this._clipSegment(r,i,l,c,a,f)))continue;[e,h,d,p]=n}else{if(null===(n=this._clipSegment(l,c,r,i,f,a)))continue;[d,p,e,h]=n,u=o,o=this._edgecode(e,h),u&&o&&this._edge(t,u,o,s,s.length),s?s.push(e,h):s=[e,h]}u=o,o=this._edgecode(d,p),u&&o&&this._edge(t,u,o,s,s.length),s?s.push(d,p):s=[d,p]}if(s)u=o,o=this._edgecode(s[0],s[1]),u&&o&&this._edge(t,u,o,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,n,e,r,i,a){for(;;){if(0===i&&0===a)return[t,n,e,r];if(i&a)return null;let u,o,s=i||a;8&s?(u=t+(e-t)*(this.ymax-n)/(r-n),o=this.ymax):4&s?(u=t+(e-t)*(this.ymin-n)/(r-n),o=this.ymin):2&s?(o=n+(r-n)*(this.xmax-t)/(e-t),u=this.xmax):(o=n+(r-n)*(this.xmin-t)/(e-t),u=this.xmin),i?(t=u,n=o,i=this._regioncode(t,n)):(e=u,r=o,a=this._regioncode(e,r))}}_clipInfinite(t,n,e,r,i,a){let u,o=Array.from(n);if((u=this._project(o[0],o[1],e,r))&&o.unshift(u[0],u[1]),(u=this._project(o[o.length-2],o[o.length-1],i,a))&&o.push(u[0],u[1]),o=this._clipFinite(t,o))for(let n,e=0,r=o.length,i=this._edgecode(o[r-2],o[r-1]);e<r;e+=2)n=i,i=this._edgecode(o[e],o[e+1]),n&&i&&(e=this._edge(t,n,i,o,e),r=o.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(o=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return o}_edge(t,n,e,r,i){for(;n!==e;){let e,a;switch(n){case 5:n=4;continue;case 4:n=6,e=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,e=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,e=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,e=this.xmin,a=this.ymin}r[i]===e&&r[i+1]===a||!this.contains(t,e,a)||(r.splice(i,0,e,a),i+=2)}if(r.length>4)for(let t=0;t<r.length;t+=2){const n=(t+2)%r.length,e=(t+4)%r.length;(r[t]===r[n]&&r[n]===r[e]||r[t+1]===r[n+1]&&r[n+1]===r[e+1])&&(r.splice(n,2),t-=2)}return i}_project(t,n,e,r){let i,a,u,o=1/0;if(r<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/r)<o&&(u=this.ymin,a=t+(o=i)*e)}else if(r>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)<o&&(u=this.ymax,a=t+(o=i)*e)}if(e>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)<o&&(a=this.xmax,u=n+(o=i)*r)}else if(e<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/e)<o&&(a=this.xmin,u=n+(o=i)*r)}return[a,u]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}}const JE=2*Math.PI;function ZE(t){return t[0]}function QE(t){return t[1]}function KE(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class tD{constructor(t){this._delaunator=new RE(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t<n.length;t+=3){const r=2*n[t],i=2*n[t+1],a=2*n[t+2];if((e[a]-e[r])*(e[i+1]-e[r+1])-(e[i]-e[r])*(e[a+1]-e[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},(t,n)=>n).sort((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]);const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.sqrt((r[3]-r[1])**2+(r[2]-r[0])**2);for(let t=0,e=n.length/2;t<e;++t){const e=KE(n[2*t],n[2*t+1],i);n[2*t]=e[0],n[2*t+1]=e[1]}this._delaunator=new RE(n)}else delete this.collinear;const e=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,a=this.inedges.fill(-1),u=this._hullIndex.fill(-1);for(let t=0,n=e.length;t<n;++t){const n=i[t%3==2?t-2:t+1];-1!==e[t]&&-1!==a[n]||(a[n]=t)}for(let t=0,n=r.length;t<n;++t)u[r[t]]=t;r.length<=2&&r.length>0&&(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],a[r[0]]=1,2===r.length&&(a[r[1]]=0))}voronoi(t){return new XE(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:a}=this;if(this.collinear){const n=this.collinear.indexOf(t);return n>0&&(yield this.collinear[n-1]),void(n<this.collinear.length-1&&(yield this.collinear[n+1]))}const u=n[t];if(-1===u)return;let o=u,s=-1;do{if(yield s=a[o],o=o%3==2?o-2:o+1,a[o]!==t)return;if(o=i[o],-1===o){const n=e[(r[t]+1)%e.length];return void(n!==s&&(yield n))}}while(o!==u)}find(t,n,e=0){if((t=+t)!=t||(n=+n)!=n)return-1;const r=e;let i;for(;(i=this._step(e,t,n))>=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:a,halfedges:u,triangles:o,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let l=t,c=(n-s[2*t])**2+(e-s[2*t+1])**2;const f=r[t];let h=f;do{let r=o[h];const f=(n-s[2*r])**2+(e-s[2*r+1])**2;if(f<c&&(c=f,l=r),h=h%3==2?h-2:h+1,o[h]!==t)break;if(h=u[h],-1===h){if(h=i[(a[t]+1)%i.length],h!==r&&(n-s[2*h])**2+(e-s[2*h+1])**2<c)return h;break}}while(h!==f);return l}render(t){const n=null==t?t=new VE:void 0,{points:e,halfedges:r,triangles:i}=this;for(let n=0,a=r.length;n<a;++n){const a=r[n];if(a<n)continue;const u=2*i[n],o=2*i[a];t.moveTo(e[u],e[u+1]),t.lineTo(e[o],e[o+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n=2){const e=null==t?t=new VE:void 0,{points:r}=this;for(let e=0,i=r.length;e<i;e+=2){const i=r[e],a=r[e+1];t.moveTo(i+n,a),t.arc(i,a,n,0,JE)}return e&&e.value()}renderHull(t){const n=null==t?t=new VE:void 0,{hull:e,points:r}=this,i=2*e[0],a=e.length;t.moveTo(r[i],r[i+1]);for(let n=1;n<a;++n){const i=2*e[n];t.lineTo(r[i],r[i+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new GE;return this.renderHull(t),t.value()}renderTriangle(t,n){const e=null==n?n=new VE:void 0,{points:r,triangles:i}=this,a=2*i[t*=3],u=2*i[t+1],o=2*i[t+2];return n.moveTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.lineTo(r[o],r[o+1]),n.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,e=t.length/3;n<e;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new GE;return this.renderTriangle(t,n),n.value()}}function nD(t){Qr.call(this,null,t)}tD.from=function(t,n=ZE,e=QE,r){return new tD("length"in t?function(t,n,e,r){const i=t.length,a=new Float64Array(2*i);for(let u=0;u<i;++u){const i=t[u];a[2*u]=n.call(r,i,u,t),a[2*u+1]=e.call(r,i,u,t)}return a}(t,n,e,r):Float64Array.from(function*(t,n,e,r){let i=0;for(const a of t)yield n.call(r,a,i,t),yield e.call(r,a,i,t),++i}(t,n,e,r)))},nD.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const eD=ot(nD,Qr),rD=[-1e5,-1e5,1e5,1e5];function iD(t){const n=t[0][0],e=t[0][1];let r=t.length-1;for(;t[r][0]===n&&t[r][1]===e;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}eD.transform=function(t,n){const e=t.as||"path",r=n.source;if(!r||!r.length)return n;let i=t.size;i=i?[0,0,i[0],i[1]]:(i=t.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:rD;const a=this.value=tD.from(r,t.x,t.y).voronoi(i);for(let t=0,n=r.length;t<n;++t){const n=a.cellPolygon(t);r[t][e]=n?iD(n):null}return n.reflow(t.modified()).modifies(e)};var aD=Object.freeze({__proto__:null,voronoi:nD}),uD=Math.PI/180,oD=64,sD=2048;function lD(){var t,n,e,r,i,a,u,o=[256,256],s=pD,l=[],c=Math.random,f={};function h(t,n,e){for(var r,i,a,u=n.x,l=n.y,f=Math.sqrt(o[0]*o[0]+o[1]*o[1]),h=s(o),d=c()<.5?1:-1,p=-d;(r=h(p+=d))&&(i=~~r[0],a=~~r[1],!(Math.min(Math.abs(i),Math.abs(a))>=f));)if(n.x=u+i,n.y=l+a,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>o[0]||n.y+n.y1>o[1])&&(!e||!fD(n,t,o[0]))&&(!e||dD(n,e))){for(var g,m=n.sprite,v=n.width>>5,y=o[0]>>5,_=n.x-(v<<4),x=127&_,b=32-x,w=n.y1-n.y0,A=(n.y+n.y0)*y+(_>>5),k=0;k<w;k++){g=0;for(var M=0;M<=v;M++)t[A+M]|=g<<b|(M<v?(g=m[k*v+M])>>>x:0);A+=y}return n.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=(oD<<5)/n,t.height=sD/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(Ls()),f=function(t){var n=[],e=-1;for(;++e<t;)n[e]=0;return n}((o[0]>>5)*o[1]),d=null,p=l.length,g=-1,m=[],v=l.map((function(o){return{text:t(o),font:n(o),style:r(o),weight:i(o),rotate:a(o),size:~~(e(o)+1e-14),padding:u(o),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:o}})).sort((function(t,n){return n.size-t.size}));++g<p;){var y=v[g];y.x=o[0]*(c()+.5)>>1,y.y=o[1]*(c()+.5)>>1,cD(s,y,v,g),y.hasText&&h(f,y,d)&&(m.push(y),d?hD(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=o[0]>>1,y.y-=o[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(o=[+t[0],+t[1]],f):o},f.font=function(t){return arguments.length?(n=gD(t),f):n},f.fontStyle=function(t){return arguments.length?(r=gD(t),f):r},f.fontWeight=function(t){return arguments.length?(i=gD(t),f):i},f.rotate=function(t){return arguments.length?(a=gD(t),f):a},f.text=function(n){return arguments.length?(t=gD(n),f):t},f.spiral=function(t){return arguments.length?(s=mD[t]||t,f):s},f.fontSize=function(t){return arguments.length?(e=gD(t),f):e},f.padding=function(t){return arguments.length?(u=gD(t),f):u},f.random=function(t){return arguments.length?(c=t,f):c},f}function cD(t,n,e,r){if(!n.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,(oD<<5)/a,sD/a);var u,o,s,l,c,f=0,h=0,d=0,p=e.length;for(--r;++r<p;){if(n=e[r],i.save(),i.font=n.style+" "+n.weight+" "+~~((n.size+1)/a)+"px "+n.font,u=i.measureText(n.text+"m").width*a,s=n.size<<1,n.rotate){var g=Math.sin(n.rotate*uD),m=Math.cos(n.rotate*uD),v=u*m,y=u*g,_=s*m,x=s*g;u=Math.max(Math.abs(v+x),Math.abs(v-x))+31>>5<<5,s=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else u=u+31>>5<<5;if(s>d&&(d=s),f+u>=oD<<5&&(f=0,h+=d,d=0),h+s>=sD)break;i.translate((f+(u>>1))/a,(h+(s>>1))/a),n.rotate&&i.rotate(n.rotate*uD),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=u,n.height=s,n.xoff=f,n.yoff=h,n.x1=u>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=u}for(var b=i.getImageData(0,0,(oD<<5)/a,sD/a).data,w=[];--r>=0;)if((n=e[r]).hasText){for(o=(u=n.width)>>5,s=n.y1-n.y0,l=0;l<s*o;l++)w[l]=0;if(null==(f=n.xoff))return;h=n.yoff;var A=0,k=-1;for(c=0;c<s;c++){for(l=0;l<u;l++){var M=o*c+(l>>5),E=b[(h+c)*(oD<<5)+(f+l)<<2]?1<<31-l%32:0;w[M]|=E,A|=E}A?k=c:(n.y0++,s--,c--,h++)}n.y1=n.y0+k,n.sprite=w.slice(0,(n.y1-n.y0)*o)}}}function fD(t,n,e){e>>=5;for(var r,i=t.sprite,a=t.width>>5,u=t.x-(a<<4),o=127&u,s=32-o,l=t.y1-t.y0,c=(t.y+t.y0)*e+(u>>5),f=0;f<l;f++){r=0;for(var h=0;h<=a;h++)if((r<<s|(h<a?(r=i[f*a+h])>>>o:0))&n[c+h])return!0;c+=e}return!1}function hD(t,n){var e=t[0],r=t[1];n.x+n.x0<e.x&&(e.x=n.x+n.x0),n.y+n.y0<e.y&&(e.y=n.y+n.y0),n.x+n.x1>r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function dD(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0<n[1].x&&t.y+t.y1>n[0].y&&t.y+t.y0<n[1].y}function pD(t){var n=t[0]/t[1];return function(t){return[n*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function gD(t){return"function"==typeof t?t:function(){return t}}var mD={archimedean:pD,rectangular:function(t){var n=4*t[0]/t[1],e=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:e+=n;break;case 1:r+=4;break;case 2:e-=n;break;default:r-=4}return[e,r]}}},vD=["x","y","font","fontSize","fontStyle","fontWeight","angle"],yD=["text","font","rotate","fontSize","fontStyle","fontWeight"];function _D(t){Qr.call(this,lD(),t)}_D.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:vD}]},ot(_D,Qr).transform=function(n,e){!n.size||n.size[0]&&n.size[1]||i("Wordcloud size dimensions must be non-zero.");var r=n.modified();if(r||e.changed(e.ADD_REM)||yD.some((function(t){var r=n[t];return X(r)&&e.modified(r.fields)}))){var a,u=e.materialize(e.SOURCE).source,o=this.value,s=n.as||vD,l=n.fontSize||14;if(X(l)?a=n.fontSizeRange:l=Z(l),a){var c=l,f=ay("sqrt")().domain(tt(u,c)).range(a);l=function(t){return f(c(t))}}u.forEach((function(t){t[s[0]]=NaN,t[s[1]]=NaN,t[s[3]]=0}));for(var h,d,p=o.words(u).text(n.text).size(n.size||[500,500]).padding(n.padding||1).spiral(n.spiral||"archimedean").rotate(n.rotate||0).font(n.font||"sans-serif").fontStyle(n.fontStyle||"normal").fontWeight(n.fontWeight||"normal").fontSize(l).random(t.random).layout(),g=o.size(),m=g[0]>>1,v=g[1]>>1,y=0,_=p.length;y<_;++y)(d=(h=p[y]).datum)[s[0]]=h.x+m,d[s[1]]=h.y+v,d[s[2]]=h.font,d[s[3]]=h.size,d[s[4]]=h.style,d[s[5]]=h.weight,d[s[6]]=h.rotate;return e.reflow(r).modifies(s)}};var xD=Object.freeze({__proto__:null,wordcloud:_D});function bD(t){return new Uint8Array(t)}function wD(t){return new Uint16Array(t)}function AD(t){return new Uint32Array(t)}function kD(t,n,e){var r=(n<257?bD:n<65537?wD:AD)(t);return e&&r.set(e),r}function MD(t,n,e){var r=1<<n;return{one:r,zero:~r,range:e.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd:function(t,n){var e,i=this.bisect(this.range,t.value),a=t.index,u=i[0],o=i[1],s=a.length;for(e=0;e<u;++e)n[a[e]]|=r;for(e=o;e<s;++e)n[a[e]]|=r;return this}}}function ED(){var t=AD(0),n=[],e=0;return{insert:function(r,i,a){if(!i.length)return[];var u,o,s,l=e,c=i.length,f=Array(c),h=AD(c);for(s=0;s<c;++s)f[s]=r(i[s]),h[s]=s;if(f=function(t,n){return t.sort.call(n,(function(n,e){var r=t[n],i=t[e];return r<i?-1:r>i?1:0})),function(t,n){return Array.from(n,n=>t[n])}(t,n)}(f,h),l)u=n,o=t,n=Array(l+c),t=AD(l+c),function(t,n,e,r,i,a,u,o,s){var l,c=0,f=0;for(l=0;c<r&&f<u;++l)n[c]<i[f]?(o[l]=n[c],s[l]=e[c++]):(o[l]=i[f],s[l]=a[f++]+t);for(;c<r;++c,++l)o[l]=n[c],s[l]=e[c];for(;f<u;++f,++l)o[l]=i[f],s[l]=a[f]+t}(a,u,o,l,f,h,c,n,t);else{if(a>0)for(s=0;s<c;++s)h[s]+=a;n=f,t=h}return e=l+c,{index:h,value:f}},remove:function(r,i){var a,u,o,s=e;for(u=0;!i[t[u]]&&u<s;++u);for(o=u;u<s;++u)i[a=t[u]]||(t[o]=a,n[o]=n[u],++o);e=s-r},bisect:function(t,r){var i;return r?i=r.length:(r=n,i=e),[mi(r,t[0],0,i),gi(r,t[1],0,i)]},reindex:function(n){for(var r=0,i=e;r<i;++r)t[r]=n[t[r]]},index:function(){return t},size:function(){return e}}}function DD(t){Qr.call(this,function(){var t=8,n=[],e=AD(0),r=kD(0,t),i=kD(0,t);return{data:function(){return n},seen:function(){return e=function(t,n,e){return t.length>=n?t:((e=e||new t.constructor(n)).set(t),e)}(e,n.length)},add:function(t){for(var e,r=0,i=n.length,a=t.length;r<a;++r)(e=t[r])._index=i++,n.push(e)},remove:function(t,e){var a,u,o,s=n.length,l=Array(s-t),c=n;for(u=0;!e[u]&&u<s;++u)l[u]=n[u],c[u]=u;for(o=u;u<s;++u)a=n[u],e[u]?c[u]=-1:(c[u]=o,r[o]=r[u],i[o]=i[u],l[o]=a,a._index=o++),r[u]=0;return n=l,c},size:function(){return n.length},curr:function(){return r},prev:function(){return i},reset:function(t){i[t]=r[t]},all:function(){return t<257?255:t<65537?65535:4294967295},set:function(t,n){r[t]|=n},clear:function(t,n){r[t]&=~n},resize:function(n,e){(n>r.length||e>t)&&(t=Math.max(e,t),r=kD(n,t,r),i=kD(n,t))}}}(),t),this._indices=null,this._dims=null}DD.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}}]};var CD=ot(DD,Qr);function FD(t){Qr.call(this,null,t)}CD.transform=function(t,n){return this._dims?t.modified("fields")||t.fields.some((function(t){return n.modified(t.fields)}))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},CD.init=function(t,n){for(var e,r,i=t.fields,a=t.query,u=this._indices={},o=this._dims=[],s=a.length,l=0;l<s;++l)r=u[e=i[l].fname]||(u[e]=ED()),o.push(MD(r,l,a[l]));return this.eval(t,n)},CD.reinit=function(t,n){var e,r,i,a,u,o,s,l,c,f=n.materialize().fork(),h=t.fields,d=t.query,p=this._indices,g=this._dims,m=this.value,v=m.curr(),y=m.prev(),_=m.all(),x=f.rem=f.add,b=f.mod,w=d.length,A={};if(y.set(v),n.rem.length&&(u=this.remove(t,n,f)),n.add.length&&m.add(n.add),n.mod.length)for(o={},s=0,l=(a=n.mod).length;s<l;++s)o[a[s]._index]=1;for(s=0;s<w;++s)c=h[s],(!g[s]||t.modified("fields",s)||n.modified(c.fields))&&((e=A[i=c.fname])||(p[i]=r=ED(),A[i]=e=r.insert(c,n.source,0)),g[s]=MD(r,s,d[s]).onAdd(e,v));for(s=0,l=m.data().length;s<l;++s)u[s]||(y[s]!==v[s]?x.push(s):o[s]&&v[s]!==_&&b.push(s));return m.mask=(1<<w)-1,f},CD.eval=function(t,n){var e=n.materialize().fork(),r=this._dims.length,i=0;return n.rem.length&&(this.remove(t,n,e),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,n,e)),n.add.length&&(this.insert(t,n,e),i|=(1<<r)-1),n.mod.length&&(this.modify(n,e),i|=(1<<r)-1),this.value.mask=i,e},CD.insert=function(t,n,e){var r,i,a,u=n.add,o=this.value,s=this._dims,l=this._indices,c=t.fields,f={},h=e.add,d=o.size(),p=d+u.length,g=s.length;o.resize(p,g),o.add(u);var m=o.curr(),v=o.prev(),y=o.all();for(r=0;r<g;++r)a=f[i=c[r].fname]||(f[i]=l[i].insert(c[r],u,d)),s[r].onAdd(a,m);for(;d<p;++d)v[d]=y,m[d]!==y&&h.push(d)},CD.modify=function(t,n){var e,r,i,a=n.mod,u=this.value,o=u.curr(),s=u.all(),l=t.mod;for(e=0,r=l.length;e<r;++e)o[i=l[e]._index]!==s&&a.push(i)},CD.remove=function(t,n,e){var r,i,a,u,o=this._indices,s=this.value,l=s.curr(),c=s.prev(),f=s.all(),h={},d=e.rem,p=n.rem;for(r=0,i=p.length;r<i;++r)h[a=p[r]._index]=1,c[a]=u=l[a],l[a]=f,u!==f&&d.push(a);for(a in o)o[a].remove(i,h);return this.reindex(n,i,h),h},CD.reindex=function(t,n,e){var r=this._indices,i=this.value;t.runAfter((function(){var t=i.remove(n,e);for(var a in r)r[a].reindex(t)}))},CD.update=function(t,n,e){var r,i,a=this._dims,u=t.query,o=n.stamp,s=a.length,l=0;for(e.filters=0,i=0;i<s;++i)t.modified("query",i)&&(r=i,++l);if(1===l)l=a[r].one,this.incrementOne(a[r],u[r],e.add,e.rem);else for(i=0,l=0;i<s;++i)t.modified("query",i)&&(l|=a[i].one,this.incrementAll(a[i],u[i],o,e.add),e.rem=e.add);return l},CD.incrementAll=function(t,n,e,r){var i,a,u,o=this.value,s=o.seen(),l=o.curr(),c=o.prev(),f=t.index(),h=t.bisect(t.range),d=t.bisect(n),p=d[0],g=d[1],m=h[0],v=h[1],y=t.one;if(p<m)for(i=p,a=Math.min(m,g);i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;else if(p>m)for(i=m,a=Math.min(p,v);i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;if(g>v)for(i=Math.max(p,v),a=g;i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;else if(g<v)for(i=Math.max(m,g),a=v;i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;t.range=n.slice()},CD.incrementOne=function(t,n,e,r){var i,a,u,o=this.value.curr(),s=t.index(),l=t.bisect(t.range),c=t.bisect(n),f=c[0],h=c[1],d=l[0],p=l[1],g=t.one;if(f<d)for(i=f,a=Math.min(d,h);i<a;++i)o[u=s[i]]^=g,e.push(u);else if(f>d)for(i=d,a=Math.min(f,p);i<a;++i)o[u=s[i]]^=g,r.push(u);if(h>p)for(i=Math.max(f,p),a=h;i<a;++i)o[u=s[i]]^=g,e.push(u);else if(h<p)for(i=Math.max(d,h),a=p;i<a;++i)o[u=s[i]]^=g,r.push(u);t.range=n.slice()},FD.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},ot(FD,Qr).transform=function(t,n){var e=~(t.ignore||0),r=t.filter,i=r.mask;if(0==(i&e))return n.StopPropagation;var a=n.fork(n.ALL),u=r.data(),o=r.curr(),s=r.prev(),l=function(t){return o[t]&e?null:u[t]};return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,(function(t){var n=o[t]&e;return!n&&n^s[t]&e?u[t]:null})),a.filter(a.REM,(function(t){var n=o[t]&e;return n&&!(n^n^s[t]&e)?u[t]:null}))):(a.filter(a.ADD,l),a.filter(a.REM,(function(t){return(o[t]&e)===i?u[t]:null}))),a.filter(a.SOURCE,(function(t){return l(t._index)}))};var SD=Object.freeze({__proto__:null,crossfilter:DD,resolvefilter:FD}),BD="default";function TD(t){var n=t._signals.cursor;n||(t._signals.cursor=n=t.add({user:BD,item:null})),t.on(t.events("view","mousemove"),n,(function(t,e){var r=n.value,i=r?s(r)?r:r.user:BD,a=e.item&&e.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}})),t.add(null,(function(t){var n=t.cursor,e=this.value;return s(n)||(e=n.item,n=n.user),function(t){"undefined"!=typeof document&&document.body&&(document.body.style.cursor=t)}(n&&n!==BD?n:e||n),e}),{cursor:n})}function zD(t,n){var e=t._runtime.data;return rt(e,n)||i("Unrecognized data set: "+n),e[n]}function ND(t,n){Lt(n)||i("Second argument to changes must be a changeset.");var e=zD(this,t);return e.modified=!0,this.pulse(e.input,n)}function OD(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function RD(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function qD(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}function LD(t,n,e){var r,i,a=t._renderer,u=a&&a.canvas();return u&&(i=qD(t),(r=qh(n.changedTouches?n.changedTouches[0]:n,u))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(t,n,e){var r=n?"group"===n.mark.marktype?n:n.mark.group:null;function i(t){var e,i=r;if(t)for(e=n;e;e=e.mark.group)if(e.mark.name===t){i=e;break}return i&&i.mark&&i.mark.interactive?i:{}}function a(t){if(!t)return e;s(t)&&(t=i(t));for(var n=e.slice();t;)n[0]-=t.x||0,n[1]-=t.y||0,t=t.mark&&t.mark.group;return n}return{view:Z(t),item:Z(n||{}),group:i,xy:a,x:function(t){return a(t)[0]},y:function(t){return a(t)[1]}}}(t,e,r),n}const UD="view",$D="timer",PD="window",jD={trap:!1};function ID(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(!1===r||o(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function HD(t){return t.item}function WD(t){return t.item.mark.source}function YD(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function VD(t,n,e){var r=document.createElement(t);for(var i in n)r.setAttribute(i,n[i]);return null!=e&&(r.textContent=e),r}var GD="vega-bind",XD="vega-bind-name",JD="vega-bind-radio",ZD="vega-option-";function QD(t,n,e){if(n){var r=e.param,i=e.state;return i||(i=e.state={elements:null,active:!1,set:null,update:function(n){n!==t.signal(r.signal)&&t.runAsync(null,(function(){i.source=!0,t.signal(r.signal,n)}))}},r.debounce&&(i.update=Q(r.debounce,i.update))),function(t,n,e,r){var i=VD("div",{class:GD});i.appendChild(VD("span",{class:XD},e.name||e.signal)),n.appendChild(i);var a=KD;switch(e.input){case"checkbox":a=tC;break;case"select":a=nC;break;case"radio":a=eC;break;case"range":a=rC}a(t,i,e,r)}(i,n,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,(function(){i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0),i}}function KD(t,n,e,r){var i=VD("input");for(var a in e)"signal"!==a&&"element"!==a&&i.setAttribute("input"===a?"type":a,e[a]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",(function(){t.update(i.value)})),t.elements=[i],t.set=function(t){i.value=t}}function tC(t,n,e,r){var i={type:"checkbox",name:e.signal};r&&(i.checked=!0);var a=VD("input",i);n.appendChild(a),a.addEventListener("change",(function(){t.update(a.checked)})),t.elements=[a],t.set=function(t){a.checked=!!t||null}}function nC(t,n,e,r){var i=VD("select",{name:e.signal}),a=e.labels||[];e.options.forEach((function(t,n){var e={value:t};iC(t,r)&&(e.selected=!0),i.appendChild(VD("option",e,(a[n]||t)+""))})),n.appendChild(i),i.addEventListener("change",(function(){t.update(e.options[i.selectedIndex])})),t.elements=[i],t.set=function(t){for(var n=0,r=e.options.length;n<r;++n)if(iC(e.options[n],t))return void(i.selectedIndex=n)}}function eC(t,n,e,r){var i=VD("span",{class:JD}),a=e.labels||[];n.appendChild(i),t.elements=e.options.map((function(n,u){var o=ZD+e.signal+"-"+n,s={id:o,type:"radio",name:e.signal,value:n};iC(n,r)&&(s.checked=!0);var l=VD("input",s);return l.addEventListener("change",(function(){t.update(n)})),i.appendChild(l),i.appendChild(VD("label",{for:o},(a[u]||n)+"")),l})),t.set=function(n){for(var e=t.elements,r=0,i=e.length;r<i;++r)iC(e[r].value,n)&&(e[r].checked=!0)}}function rC(t,n,e,r){r=void 0!==r?r:(+e.max+ +e.min)/2;var i=null!=e.max?e.max:Math.max(100,+r)||100,a=e.min||Math.min(0,i,+r)||0,u=e.step||Ai(a,i,100),o=VD("input",{type:"range",name:e.signal,min:a,max:i,step:u});o.value=r;var s=VD("label",{},+r);function l(){s.textContent=o.value,t.update(+o.value)}n.appendChild(o),n.appendChild(s),o.addEventListener("input",l),o.addEventListener("change",l),t.elements=[o],t.set=function(t){o.value=t,s.textContent=t}}function iC(t,n){return t===n||t+""==n+""}function aC(t,n,e,r,i,a){return(n=n||new r(t.loader())).initialize(e,OD(t),RD(t),qD(t),i,a).background(t._background)}function uC(t,n){return n?function(){try{n.apply(this,arguments)}catch(n){t.error(n)}}:null}function oC(t,n){if("string"==typeof n){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n)try{n.innerHTML=""}catch(e){n=null,t.error(e)}return n}async function sC(t,n,e,r){const a=Bd(n),u=a&&a.headless;return u||i("Unrecognized renderer type: "+n),await t.runAsync(),aC(t,null,null,u,e,r).renderAsync(t._scenegraph.root)}var lC,cC,fC,hC,dC,pC="RawCode",gC="Literal",mC="Property",vC="Identifier",yC="ArrayExpression",_C="BinaryExpression",xC="CallExpression",bC="ConditionalExpression",wC="LogicalExpression",AC="MemberExpression",kC="ObjectExpression",MC="UnaryExpression";function EC(t){this.type=t}EC.prototype.visit=function(t){var n,e,r;if(t(this))return 1;for(e=0,r=(n=function(t){switch(t.type){case yC:return t.elements;case _C:case wC:return[t.left,t.right];case xC:var n=t.arguments.slice();return n.unshift(t.callee),n;case bC:return[t.test,t.consequent,t.alternate];case AC:return[t.object,t.property];case kC:return t.properties;case mC:return[t.key,t.value];case MC:return[t.argument];case vC:case gC:case pC:default:return[]}}(this)).length;e<r;++e)if(n[e].visit(t))return 1};var DC=1,CC=2,FC=3,SC=4,BC=5,TC=6,zC=7,NC=8;(lC={})[DC]="Boolean",lC[CC]="<end>",lC[FC]="Identifier",lC[SC]="Keyword",lC[BC]="Null",lC[TC]="Numeric",lC[zC]="Punctuator",lC[NC]="String",lC[9]="RegularExpression";var OC="ArrayExpression",RC="BinaryExpression",qC="CallExpression",LC="ConditionalExpression",UC="Identifier",$C="Literal",PC="LogicalExpression",jC="MemberExpression",IC="ObjectExpression",HC="Property",WC="UnaryExpression",YC="Unexpected token %0",VC="Unexpected number",GC="Unexpected string",XC="Unexpected identifier",JC="Unexpected reserved word",ZC="Unexpected end of input",QC="Invalid regular expression",KC="Invalid regular expression: missing /",tF="Octal literals are not allowed in strict mode.",nF="Duplicate data property in object literal not allowed in strict mode",eF="ILLEGAL",rF="Disabled.",iF=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]"),aF=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 uF(t,n){if(!t)throw new Error("ASSERT: "+n)}function oF(t){return t>=48&&t<=57}function sF(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function lF(t){return"01234567".indexOf(t)>=0}function cF(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 fF(t){return 10===t||13===t||8232===t||8233===t}function hF(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&iF.test(String.fromCharCode(t))}function dF(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&aF.test(String.fromCharCode(t))}var pF={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 gF(){for(var t;fC<hC&&(cF(t=cC.charCodeAt(fC))||fF(t));)++fC}function mF(t){var n,e,r,i=0;for(e="u"===t?4:2,n=0;n<e;++n)fC<hC&&sF(cC[fC])?(r=cC[fC++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):TF({},YC,eF);return String.fromCharCode(i)}function vF(){var t,n,e,r;for(n=0,"}"===(t=cC[fC])&&TF({},YC,eF);fC<hC&&sF(t=cC[fC++]);)n=16*n+"0123456789abcdef".indexOf(t.toLowerCase());return(n>1114111||"}"!==t)&&TF({},YC,eF),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function yF(){var t,n;for(t=cC.charCodeAt(fC++),n=String.fromCharCode(t),92===t&&(117!==cC.charCodeAt(fC)&&TF({},YC,eF),++fC,(t=mF("u"))&&"\\"!==t&&hF(t.charCodeAt(0))||TF({},YC,eF),n=t);fC<hC&&dF(t=cC.charCodeAt(fC));)++fC,n+=String.fromCharCode(t),92===t&&(n=n.substr(0,n.length-1),117!==cC.charCodeAt(fC)&&TF({},YC,eF),++fC,(t=mF("u"))&&"\\"!==t&&dF(t.charCodeAt(0))||TF({},YC,eF),n+=t);return n}function _F(){var t,n;return t=fC,{type:1===(n=92===cC.charCodeAt(fC)?yF():function(){var t,n;for(t=fC++;fC<hC;){if(92===(n=cC.charCodeAt(fC)))return fC=t,yF();if(!dF(n))break;++fC}return cC.slice(t,fC)}()).length?FC:pF.hasOwnProperty(n)?SC:"null"===n?BC:"true"===n||"false"===n?DC:FC,value:n,start:t,end:fC}}function xF(){var t,n,e,r,i=fC,a=cC.charCodeAt(fC),u=cC[fC];switch(a){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++fC,{type:zC,value:String.fromCharCode(a),start:i,end:fC};default:if(61===(t=cC.charCodeAt(fC+1)))switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return fC+=2,{type:zC,value:String.fromCharCode(a)+String.fromCharCode(t),start:i,end:fC};case 33:case 61:return fC+=2,61===cC.charCodeAt(fC)&&++fC,{type:zC,value:cC.slice(i,fC),start:i,end:fC}}}return">>>="===(r=cC.substr(fC,4))?{type:zC,value:r,start:i,end:fC+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:zC,value:e,start:i,end:fC+=3}:u===(n=e.substr(0,2))[1]&&"+-<>&|".indexOf(u)>=0||"=>"===n?{type:zC,value:n,start:i,end:fC+=2}:"<>=!+-*%&|^/".indexOf(u)>=0?(++fC,{type:zC,value:u,start:i,end:fC}):void TF({},YC,eF)}function bF(){var t,n,e;if(uF(oF((e=cC[fC]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=fC,t="","."!==e){if(t=cC[fC++],e=cC[fC],"0"===t){if("x"===e||"X"===e)return++fC,function(t){for(var n="";fC<hC&&sF(cC[fC]);)n+=cC[fC++];return 0===n.length&&TF({},YC,eF),hF(cC.charCodeAt(fC))&&TF({},YC,eF),{type:TC,value:parseInt("0x"+n,16),start:t,end:fC}}(n);if(lF(e))return function(t){for(var n="0"+cC[fC++];fC<hC&&lF(cC[fC]);)n+=cC[fC++];return(hF(cC.charCodeAt(fC))||oF(cC.charCodeAt(fC)))&&TF({},YC,eF),{type:TC,value:parseInt(n,8),octal:!0,start:t,end:fC}}(n);e&&oF(e.charCodeAt(0))&&TF({},YC,eF)}for(;oF(cC.charCodeAt(fC));)t+=cC[fC++];e=cC[fC]}if("."===e){for(t+=cC[fC++];oF(cC.charCodeAt(fC));)t+=cC[fC++];e=cC[fC]}if("e"===e||"E"===e)if(t+=cC[fC++],"+"!==(e=cC[fC])&&"-"!==e||(t+=cC[fC++]),oF(cC.charCodeAt(fC)))for(;oF(cC.charCodeAt(fC));)t+=cC[fC++];else TF({},YC,eF);return hF(cC.charCodeAt(fC))&&TF({},YC,eF),{type:TC,value:parseFloat(t),start:n,end:fC}}function wF(){var t,n,e,r;return dC=null,gF(),t=fC,n=function(){var t,n,e,r;for(uF("/"===(t=cC[fC]),"Regular expression literal must start with a slash"),n=cC[fC++],e=!1,r=!1;fC<hC;)if(n+=t=cC[fC++],"\\"===t)fF((t=cC[fC++]).charCodeAt(0))&&TF({},KC),n+=t;else if(fF(t.charCodeAt(0)))TF({},KC);else if(e)"]"===t&&(e=!1);else{if("/"===t){r=!0;break}"["===t&&(e=!0)}return r||TF({},KC),{value:n.substr(1,n.length-2),literal:n}}(),e=function(){var t,n,e;for(n="",e="";fC<hC&&dF((t=cC[fC]).charCodeAt(0));)++fC,"\\"===t&&fC<hC?TF({},YC,eF):(e+=t,n+=t);return e.search(/[^gimuy]/g)>=0&&TF({},QC,e),{value:e,literal:n}}(),r=function(t,n){var e=t;n.indexOf("u")>=0&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(t,n){if(parseInt(n,16)<=1114111)return"x";TF({},QC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(e)}catch(t){TF({},QC)}try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:fC}}function AF(){var t;return gF(),fC>=hC?{type:CC,start:fC,end:fC}:hF(t=cC.charCodeAt(fC))?_F():40===t||41===t||59===t?xF():39===t||34===t?function(){var t,n,e,r,i="",a=!1;for(uF("'"===(t=cC[fC])||'"'===t,"String literal must starts with a quote"),n=fC,++fC;fC<hC;){if((e=cC[fC++])===t){t="";break}if("\\"===e)if((e=cC[fC++])&&fF(e.charCodeAt(0)))"\r"===e&&"\n"===cC[fC]&&++fC;else switch(e){case"u":case"x":"{"===cC[fC]?(++fC,i+=vF()):i+=mF(e);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:lF(e)?(0!==(r="01234567".indexOf(e))&&(a=!0),fC<hC&&lF(cC[fC])&&(a=!0,r=8*r+"01234567".indexOf(cC[fC++]),"0123".indexOf(e)>=0&&fC<hC&&lF(cC[fC])&&(r=8*r+"01234567".indexOf(cC[fC++]))),i+=String.fromCharCode(r)):i+=e}else{if(fF(e.charCodeAt(0)))break;i+=e}}return""!==t&&TF({},YC,eF),{type:NC,value:i,octal:a,start:n,end:fC}}():46===t?oF(cC.charCodeAt(fC+1))?bF():xF():oF(t)?bF():xF()}function kF(){var t;return fC=(t=dC).end,dC=AF(),fC=t.end,t}function MF(){var t;t=fC,dC=AF(),fC=t}function EF(t,n,e){var r=new EC("||"===t||"&&"===t?PC:RC);return r.operator=t,r.left=n,r.right=e,r}function DF(t,n){var e=new EC(qC);return e.callee=t,e.arguments=n,e}function CF(t){var n=new EC(UC);return n.name=t,n}function FF(t){var n=new EC($C);return n.value=t.value,n.raw=cC.slice(t.start,t.end),t.regex&&("//"===n.raw&&(n.raw="/(?:)/"),n.regex=t.regex),n}function SF(t,n,e){var r=new EC(jC);return r.computed="["===t,r.object=n,r.property=e,r.computed||(e.member=!0),r}function BF(t,n,e){var r=new EC(HC);return r.key=n,r.value=e,r.kind=t,r}function TF(t,n){var e,r=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,(function(t,n){return uF(n<r.length,"Message reference must be in range"),r[n]}));throw(e=new Error(i)).index=fC,e.description=i,e}function zF(t){t.type===CC&&TF(t,ZC),t.type===TC&&TF(t,VC),t.type===NC&&TF(t,GC),t.type===FC&&TF(t,XC),t.type===SC&&TF(t,JC),TF(t,YC,t.value)}function NF(t){var n=kF();n.type===zC&&n.value===t||zF(n)}function OF(t){return dC.type===zC&&dC.value===t}function RF(t){return dC.type===SC&&dC.value===t}function qF(){var t=[];for(fC=dC.start,NF("[");!OF("]");)OF(",")?(kF(),t.push(null)):(t.push(XF()),OF("]")||NF(","));return kF(),function(t){var n=new EC(OC);return n.elements=t,n}(t)}function LF(){var t;return fC=dC.start,(t=kF()).type===NC||t.type===TC?(t.octal&&TF(t,tF),FF(t)):CF(t.value)}function UF(){var t,n,e;return fC=dC.start,(t=dC).type===FC?(e=LF(),NF(":"),BF("init",e,XF())):t.type!==CC&&t.type!==zC?(n=LF(),NF(":"),BF("init",n,XF())):void zF(t)}function $F(){var t,n,e=[],r={},i=String;for(fC=dC.start,NF("{");!OF("}");)n="$"+((t=UF()).key.type===UC?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,n)?TF({},nF):r[n]=!0,e.push(t),OF("}")||NF(",");return NF("}"),function(t){var n=new EC(IC);return n.properties=t,n}(e)}var PF={if:1,this:1};function jF(){var t,n,e;if(OF("("))return function(){var t;return NF("("),t=JF(),NF(")"),t}();if(OF("["))return qF();if(OF("{"))return $F();if(t=dC.type,fC=dC.start,t===FC||PF[dC.value])e=CF(kF().value);else if(t===NC||t===TC)dC.octal&&TF(dC,tF),e=FF(kF());else{if(t===SC)throw new Error(rF);t===DC?((n=kF()).value="true"===n.value,e=FF(n)):t===BC?((n=kF()).value=null,e=FF(n)):OF("/")||OF("/=")?(e=FF(wF()),MF()):zF(kF())}return e}function IF(){var t=[];if(NF("("),!OF(")"))for(;fC<hC&&(t.push(XF()),!OF(")"));)NF(",");return NF(")"),t}function HF(){var t;return fC=dC.start,function(t){return t.type===FC||t.type===SC||t.type===DC||t.type===BC}(t=kF())||zF(t),CF(t.value)}function WF(){var t;return NF("["),t=JF(),NF("]"),t}function YF(){var t=function(){var t;for(t=jF();;)if(OF("."))NF("."),t=SF(".",t,HF());else if(OF("("))t=DF(t,IF());else{if(!OF("["))break;t=SF("[",t,WF())}return t}();if(dC.type===zC&&(OF("++")||OF("--")))throw new Error(rF);return t}function VF(){var t,n;if(dC.type!==zC&&dC.type!==SC)n=YF();else{if(OF("++")||OF("--"))throw new Error(rF);if(OF("+")||OF("-")||OF("~")||OF("!"))t=kF(),n=VF(),n=function(t,n){var e=new EC(WC);return e.operator=t,e.argument=n,e.prefix=!0,e}(t.value,n);else{if(RF("delete")||RF("void")||RF("typeof"))throw new Error(rF);n=YF()}}return n}function GF(t){var n=0;if(t.type!==zC&&t.type!==SC)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function XF(){var t,n;return t=function(){var t,n,e,r,i,a,u,o,s,l;if(t=dC,s=VF(),0===(i=GF(r=dC)))return s;for(r.prec=i,kF(),n=[t,dC],a=[s,r,u=VF()];(i=GF(dC))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)u=a.pop(),o=a.pop().value,s=a.pop(),n.pop(),e=EF(o,s,u),a.push(e);(r=kF()).prec=i,a.push(r),n.push(dC),e=VF(),a.push(e)}for(e=a[l=a.length-1],n.pop();l>1;)n.pop(),e=EF(a[l-1].value,a[l-2],e),l-=2;return e}(),OF("?")&&(kF(),n=XF(),NF(":"),t=function(t,n,e){var r=new EC(LC);return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,XF())),t}function JF(){var t=XF();if(OF(","))throw new Error(rF);return t}var ZF={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 QF(t){function n(n,e,r){return function(i){return function(n,e,r,i){var a=t(e[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}}var e="new Date";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(n){n.length<3&&i("Missing arguments to clamp function."),n.length>3&&i("Too many arguments to clamp function.");var e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),join:n("join",null),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),slice:n("slice",null),reverse:function(n){return"("+t(n[0])+").slice().reverse()"},parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase","String",0),lower:n("toLowerCase","String",0),substring:n("substring","String"),split:n("split","String"),replace:n("replace","String"),trim:n("trim","String",0),regexp:"RegExp",test:n("test","RegExp"),if:function(n){n.length<3&&i("Missing arguments to if function."),n.length>3&&i("Too many arguments to if function.");var e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}const KF="intersect",tS="union",nS="vlMulti",eS="or",rS="and";var iS="E",aS="R",uS="R-E",oS="R-LE",sS="R-RE",lS="index:unit";function cS(t,n){for(var e,r,i=n.fields,a=n.values,o=i.length,s=0;s<o;++s)if((r=i[s]).getter=c.getter||c(r.field),ct(e=r.getter(t))&&(e=F(e)),ct(a[s])&&(a[s]=F(a[s])),ct(a[s][0])&&(a[s]=a[s].map(F)),r.type===iS){if(u(a[s])?a[s].indexOf(e)<0:e!==a[s])return!1}else if(r.type===aS){if(!st(e,a[s]))return!1}else if(r.type===sS){if(!st(e,a[s],!0,!1))return!1}else if(r.type===uS){if(!st(e,a[s],!1,!1))return!1}else if(r.type===oS&&!st(e,a[s],!1,!0))return!1;return!0}var fS={E_union:function(t,n){if(!t.length)return n;for(var e=0,r=n.length;e<r;++e)t.indexOf(n[e])<0&&t.push(n[e]);return t},E_intersect:function(t,n){return t.length?t.filter((function(t){return n.indexOf(t)>=0})):n},R_union:function(t,n){var e=F(n[0]),r=F(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]<r&&(t[1]=r),t):[e,r]},R_intersect:function(t,n){var e=F(n[0]),r=F(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?r<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>r&&(t[1]=r),t):[e,r]}};const hS=":",dS="@";function pS(t,n,e,r){n[0].type!==gC&&i("First argument to selection functions must be a string literal.");const a=n[0].value,u=n.length>=2&&C(n).value,o=dS+"unit",s=hS+a;u!==KF||rt(r,o)||(r[o]=e.getData(a).indataRef(e,"unit")),rt(r,s)||(r[s]=e.getData(a).tuplesRef())}function gS(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function mS(t){const n=gg(t);return.2126*gS(n.r)+.7152*gS(n.g)+.0722*gS(n.b)}function vS(t){const n=this.context.data[t];return n?n.values.value:[]}const yS={};function _S(t,n,e){let r=t+":"+e,i=yS[r];return i&&i[0]===n||(yS[r]=i=[n,n(e)]),i[1]}function xS(t,n){return _S("timeFormat",vo,n)(t)}var bS=new Date(2e3,0,1);function wS(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(bS.setYear(2e3),bS.setMonth(t),bS.setDate(n),xS(bS,e)):""}function AS(t,n){let e;return X(t)?t:s(t)?(e=n.scales[t])&&e.value:void 0}function kS(t,n){return function(e,r,i){if(e){const n=AS(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const MS=kS("area",(function(t){return _x.reset(),hx(t,xx),2*_x})),ES=kS("bounds",(function(t){var n,e,r,i,a,u,o;if(Ox=Nx=-(Tx=zx=1/0),$x=[],hx(t,ab),e=$x.length){for($x.sort(pb),n=1,a=[r=$x[0]];n<e;++n)gb(r,(i=$x[n])[0])||gb(r,i[1])?(db(r[0],i[1])>db(r[0],r[1])&&(r[1]=i[1]),db(i[0],r[1])>db(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(u=-1/0,n=0,r=a[e=a.length-1];n<=e;r=i,++n)i=a[n],(o=db(r[1],i[0]))>u&&(u=o,Tx=i[0],Nx=r[1])}return $x=Px=null,Tx===1/0||zx===1/0?[[NaN,NaN],[NaN,NaN]]:[[Tx,zx],[Nx,Ox]]})),DS=kS("centroid",(function(t){jx=Ix=Hx=Wx=Yx=Vx=Gx=Xx=Jx=Zx=Qx=0,hx(t,mb);var n=Jx,e=Zx,r=Qx,i=n*n+e*e+r*r;return i<U_&&(n=Vx,e=Gx,r=Xx,Ix<L_&&(n=Hx,e=Wx,r=Yx),(i=n*n+e*e+r*r)<U_)?[NaN,NaN]:[G_(e,n)*H_,ax(r/ex(i))*H_]}));function CS(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function FS(t,n){return t===n||t!=t&&n!=n||(u(t)?!(!u(n)||t.length!==n.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!FS(t[e],n[e]))return!1;return!0}(t,n):!(!o(t)||!o(n))&&SS(t,n))}function SS(t,n){for(let e in t)if(!FS(t[e],n[e]))return!1;return!0}function BS(t){return n=>SS(t,n)}const TS={};function zS(t){return t.data}function NS(t,n){const e=vS.call(n,t);return e.root&&e.root.lookup||TS}const OS="undefined"!=typeof window&&window||null;const RS=":",qS="@",LS="%",US="$";function $S(t,n,e,r){n[0].type!==gC&&i("First argument to data functions must be a string literal.");const a=n[0].value,u=RS+a;if(!rt(u,r))try{r[u]=e.getData(a).tuplesRef()}catch(t){}}function PS(t,n,e,r){if(n[0].type===gC)jS(e,r,n[0].value);else if(n[0].type===vC)for(t in e.scales)jS(e,r,t)}function jS(t,n,e){const r=LS+e;if(!rt(n,r))try{n[r]=t.scaleRef(e)}catch(t){}}const IS={random:function(){return t.random()},cumulativeNormal:ji,cumulativeLogNormal:Gi,cumulativeUniform:ta,densityNormal:Pi,densityLogNormal:Vi,densityUniform:Ki,quantileNormal:Ii,quantileLogNormal:Xi,quantileUniform:na,sampleNormal:$i,sampleLogNormal:Yi,sampleUniform:Qi,isArray:u,isBoolean:lt,isDate:ct,isDefined:function(t){return void 0!==t},isNumber:ft,isObject:o,isRegExp:ht,isString:s,isTuple:St,isValid:function(t){return null!=t&&t==t},toBoolean:_t,toDate:bt,toNumber:F,toString:wt,flush:ut,lerp:pt,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),K.apply(null,t)},pad:vt,peek:C,span:yt,inrange:st,truncate:kt,rgb:gg,lab:Og,hcl:Pg,hsl:wg,luminance:mS,contrast:function(t,n){const e=mS(t),r=mS(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)},sequence:vi,format:function(t,n){return _S("format",pv,n)(t)},utcFormat:function(t,n){return _S("utcFormat",yo,n)(t)},utcParse:function(t,n){return _S("utcParse",ye,n)(t)},utcOffset:co,utcSequence:po,timeFormat:xS,timeParse:function(t,n){return _S("timeParse",me,n)(t)},timeOffset:lo,timeSequence:ho,timeUnitSpecifier:mo,monthFormat:function(t){return wS(t,1,"%B")},monthAbbrevFormat:function(t){return wS(t,1,"%b")},dayFormat:function(t){return wS(0,2+t,"%A")},dayAbbrevFormat:function(t){return wS(0,2+t,"%a")},quarter:W,utcquarter:Y,warn:function(){return CS(this.context.dataflow,"warn",arguments)},info:function(){return CS(this.context.dataflow,"info",arguments)},debug:function(){return CS(this.context.dataflow,"debug",arguments)},extent:tt,inScope:function(t){let n=this.context.group,e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:function(t,n,e){if(!t)return[];const[r,i]=t,a=(new Cs).set(r[0],r[1],i[0],i[1]);return Td(e||this.context.dataflow.scenegraph().root,a,function(t){let n=null;if(t){const e=V(t.marktype),r=V(t.markname);n=t=>(!e.length||e.some(n=>t.marktype===n))&&(!r.length||r.some(n=>t.name===n))}return n}(n))},clampRange:G,pinchDistance:function(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.sqrt(e*e+r*r)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){return OS?OS.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){return OS?[OS.innerWidth,OS.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return kp(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow,r=this.context.data[t].input;return e.pulse(r,e.changeset().remove(m).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?gc(e,n=n||rc(t)):t}},panLinear:R,panLog:q,panPow:L,panSymlog:U,zoomLinear:P,zoomLog:j,zoomPow:I,zoomSymlog:H,encode:function(t,n,e){if(t){const e=this.context.dataflow,r=t.mark.source;e.pulse(r,e.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,a){let o,s,l=this.context.dataflow,c=this.context.data[t],f=c.input,h=c.changes,d=l.stamp();if(!1===l._trigger||!(f.value.length||n||r))return 0;if((!h||h.stamp<d)&&(c.changes=h=l.changeset(),h.stamp=d,l.runAfter((function(){c.modified=!0,l.pulse(f,h).run()}),!0,1)),e&&(o=!0===e?m:u(e)||St(e)?e:BS(e),h.remove(o)),n&&h.insert(n),r&&(o=BS(r),f.value.some(o)?h.remove(o):h.insert(r)),i)for(s in a)h.modify(i,s,a[s]);return 1}},HS=["view","item","group","xy","x","y"],WS="event.vega.",YS="this.",VS={};function GS(t,n,e){return 1===arguments.length?IS[t]:(IS[t]=n,e&&(VS[t]=e),JS&&(JS.functions[t]=YS+t),this)}GS("bandwidth",(function(t,n){const e=AS(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}),PS),GS("copy",(function(t,n){const e=AS(t,(n||this).context);return e?e.copy():void 0}),PS),GS("domain",(function(t,n){const e=AS(t,(n||this).context);return e?e.domain():[]}),PS),GS("range",(function(t,n){const e=AS(t,(n||this).context);return e&&e.range?e.range():[]}),PS),GS("invert",(function(t,n,e){const r=AS(t,(e||this).context);return r?u(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}),PS),GS("scale",(function(t,n,e){const r=AS(t,(e||this).context);return r&&void 0!==n?r(n):void 0}),PS),GS("gradient",(function(t,n,e,r,i){t=AS(t,(i||this).context);const a=Os(n,e);let u=t.domain(),o=u[0],s=C(u),l=d;return s-o?l=yy(t,o,s):t=(t.interpolator?ay("sequential")().interpolator(t.interpolator()):ay("linear")().interpolate(t.interpolate()).range(t.range())).domain([o=0,s=1]),t.ticks&&(u=t.ticks(+r||15),o!==u[0]&&u.unshift(o),s!==C(u)&&u.push(s)),u.forEach(n=>a.stop(l(n),t(n))),a}),PS),GS("geoArea",MS,PS),GS("geoBounds",ES,PS),GS("geoCentroid",DS,PS),GS("geoShape",(function(t,n,e){const r=AS(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}),PS),GS("indata",(function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}),(function(t,n,e,r){n[0].type!==gC&&i("First argument to indata must be a string literal."),n[1].type!==gC&&i("Second argument to indata must be a string literal.");const a=n[0].value,u=n[1].value,o=qS+u;rt(o,r)||(r[o]=e.getData(a).indataRef(e,u))})),GS("data",vS,$S),GS("treePath",(function(t,n,e){const r=NS(t,this),i=r[n],a=r[e];return i&&a?i.path(a).map(zS):void 0}),$S),GS("treeAncestors",(function(t,n){const e=NS(t,this)[n];return e?e.ancestors().map(zS):void 0}),$S),GS("vlSelectionTest",(function(t,n,e){for(var r,i,a,u,o,s=this.context.data[t],l=s?s.values.value:[],c=s?s[lS]&&s[lS].value:void 0,f=e===KF,h=l.length,d=0;d<h;++d)if(r=l[d],c&&f){if(-1===(a=(i=i||{})[u=r.unit]||0))continue;if(o=cS(n,r),i[u]=o?-1:++a,o&&1===c.size)return!0;if(!o&&a===c.get(u).count)return!1}else if(f^(o=cS(n,r)))return o;return h&&f}),pS),GS("vlSelectionResolve",(function(t,n,e){for(var r,i,a,u,o,s,l,c,f,h,d,p=this.context.data[t],g=p?p.values.value:[],m={},v={},y={},_=g.length,x=0;x<_;++x){for(u=(r=g[x]).unit,i=r.fields,a=r.values,h=0,d=i.length;h<d;++h)o=i[h],l=(s=m[o.field]||(m[o.field]={}))[u]||(s[u]=[]),y[o.field]=c=o.type.charAt(0),f=fS[c+"_union"],s[u]=f(l,V(a[h]));e&&(l=v[u]||(v[u]=[])).push(V(a).reduce((t,n,e)=>(t[i[e].field]=n,t),{}))}return n=n||tS,Object.keys(m).forEach((function(t){m[t]=Object.keys(m[t]).map(n=>m[t][n]).reduce((e,r)=>void 0===e?r:fS[y[t]+"_"+n](e,r))})),g=Object.keys(v),e&&g.length&&(m[nS]=n===tS?{[eS]:g.reduce((t,n)=>(t.push.apply(t,v[n]),t),[])}:{[rS]:g.map(t=>({[eS]:v[t]}))}),m}),pS);const XS={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+l(US+t)+"]"},functions:function(t){const n=QF(t);HS.forEach(t=>n[t]=WS+t);for(let t in IS)n[t]=YS+t;return n},constants:ZF,visitors:VS};var JS=function(t){var n=(t=t||{}).whitelist?At(t.whitelist):{},e=t.blacklist?At(t.blacklist):{},r=t.constants||ZF,a=(t.functions||QF)(d),u=t.globalvar,o=t.fieldvar,l={},c={},f=0,h=X(u)?u:function(t){return u+'["'+t+'"]'};function d(t){if(s(t))return t;var n=p[t.type];return null==n&&i("Unsupported type: "+t.type),n(t)}var p={Literal:function(t){return t.raw},Identifier:function(t){var a=t.name;return f>0?a:rt(e,a)?i("Illegal identifier: "+a):rt(r,a)?r[a]:rt(n,a)?a:(l[a]=1,h(a))},MemberExpression:function(t){var n=!t.computed,e=d(t.object);n&&(f+=1);var r=d(t.property);return e===o&&(c[function(t){var n=t&&t.length-1;return n&&('"'===t[0]&&'"'===t[n]||"'"===t[0]&&"'"===t[n])?t.slice(1,-1):t}(r)]=1),n&&(f-=1),e+(n?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&i("Illegal callee type: "+t.callee.type);var n=t.callee.name,e=t.arguments,r=rt(a,n)&&a[n];return r||i("Unrecognized function: "+n),X(r)?r(e):r+"("+e.map(d).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(d).join(",")+"]"},BinaryExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+d(t.argument)+")"},ConditionalExpression:function(t){return"("+d(t.test)+"?"+d(t.consequent)+":"+d(t.alternate)+")"},LogicalExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(d).join(",")+"}"},Property:function(t){f+=1;var n=d(t.key);return f-=1,n+":"+d(t.value)}};function g(t){var n={code:d(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},n}return g.functions=a,g.constants=r,g}(XS);function ZS(t,n,e){";"!==n[n.length-1]&&(n="return("+n+");");var r=Function.apply(null,t.concat(n));return e&&e.functions?r.bind(e.functions):r}function QS(t,n){return ZS(["event"],t,n)}function KS(t,n){return ZS(["item","_"],t,n)}function tB(t,n,e){var r,i;for(r in e=e||{},t)i=t[r],e[r]=u(i)?i.map((function(t){return nB(t,n,e)})):nB(i,n,e);return e}function nB(t,n,e){if(!t||!o(t))return t;for(var r,i=0,a=eB.length;i<a;++i)if(rt(t,(r=eB[i]).key))return r.parse(t,n,e);return t}var eB=[{key:"$ref",parse:function(t,n){return n.get(t.$ref)||i("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,n){var e="k:"+t.$key+"_"+!!t.$flat;return n.fn[e]||(n.fn[e]=dt(t.$key,t.$flat))}},{key:"$expr",parse:function(t,e,r){t.$params&&tB(t.$params,e,r);var i="e:"+t.$expr+"_"+t.$name;return e.fn[i]||(e.fn[i]=n(function(t,n){return ZS(["datum","_"],t,n)}(t.$expr,e),t.$fields,t.$name))}},{key:"$field",parse:function(t,n){if(!t.$field)return null;var e="f:"+t.$field+"_"+t.$name;return n.fn[e]||(n.fn[e]=c(t.$field,t.$name))}},{key:"$encode",parse:function(t,e){var r,i,a=t.$encode,u={};for(r in a)i=a[r],u[r]=n(KS(i.$expr,e),i.$fields),u[r].output=i.$output;return u}},{key:"$compare",parse:function(t,n){var e="c:"+t.$compare+"_"+t.$order,r=V(t.$compare).map((function(t){return t&&t.$tupleid?Bt:t}));return n.fn[e]||(n.fn[e]=J(r,t.$order))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){var e=t.$subflow;return function(t,r,i){var a=uB(e,n.fork()),u=a.get(e.operators[0].id),o=a.signals.parent;return o&&o.set(i),u}}},{key:"$tupleid",parse:function(){return Bt}}];function rB(t){return(t+"").toLowerCase()}function iB(t,n){!function(t){return"operator"===rB(t)}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?function(t,n){return ZS(["_"],t,n)}(t.update,n):null)}function aB(t,n){var e=o(e=t.source)?e.$ref:e,r=n.get(e),a=null,u=t.update,s=void 0;r||i("Source not defined: "+t.source),a=t.target&&t.target.$expr?QS(t.target.$expr,n):n.get(t.target),u&&u.$expr&&(u.$params&&(s=tB(u.$params,n)),u=function(t,n){return ZS(["_","event"],t,n)}(u.$expr,n)),n.update(t,r,a,u,s)}function uB(t,n){var e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),e.forEach((function(t){iB(t,n)})),e.forEach((function(t){!function(t,n){if(t.params){var e=n.get(t.id);e||i("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(tB(t.params,n),t.react,t.initonly))}}(t,n)})),(t.streams||[]).forEach((function(t){!function(t,n){var e,r=null!=t.filter?QS(t.filter,n):void 0,a=null!=t.stream?n.get(t.stream):void 0;t.source?a=n.events(t.source,t.type,r):t.merge&&(a=(e=t.merge.map(n.get.bind(n)))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map(n.get.bind(n)),a=a.between(e[0],e[1])),t.filter&&(a=a.filter(r)),null!=t.throttle&&(a=a.throttle(+t.throttle)),null!=t.debounce&&(a=a.debounce(+t.debounce)),null==a&&i("Invalid stream definition: "+JSON.stringify(t)),t.consume&&a.consume(!0),n.stream(t,a)}(t,n)})),(t.updates||[]).forEach((function(t){aB(t,n)})),n.resolve()}var oB={skip:!0};function sB(t,n,e){return new lB(t,n,e)}function lB(t,n,e){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function cB(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.functions=t.functions,this.events=t.events,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)}lB.prototype=cB.prototype={fork:function(){var t=new cB(this);return(this.subcontext||(this.subcontext=[])).push(t),t},get:function(t){return this.nodes[t]},set:function(t,n){return this.nodes[t]=n},add:function(t,n){var e,r=this,i=r.dataflow;if(r.set(t.id,n),function(t){return"collect"===rB(t)}(t.type)&&(e=t.value)&&(e.$ingest?i.ingest(n,e.$ingest,e.$format):e.$request?i.preload(n,e.$request,e.$format):i.pulse(n,i.changeset().insert(e))),t.root&&(r.root=n),t.parent){var a=r.get(t.parent.$ref);a?(i.connect(a,[n]),n.targets().add(a)):(r.unresolved=r.unresolved||[]).push((function(){a=r.get(t.parent.$ref),i.connect(a,[n]),n.targets().add(a)}))}if(t.signal&&(r.signals[t.signal]=n),t.scale&&(r.scales[t.scale]=n),t.data)for(var u in t.data)e=r.data[u]||(r.data[u]={}),t.data[u].forEach((function(t){e[t]=n}))},resolve:function(){return(this.unresolved||[]).forEach((function(t){t()})),delete this.unresolved,this},operator:function(t,n){this.add(t,this.dataflow.add(t.value,n))},transform:function(t,n){this.add(t,this.dataflow.add(this.transforms[rB(n)]))},stream:function(t,n){this.set(t.id,n)},update:function(t,n,e,r,i){this.dataflow.on(n,e,r,i,t.options)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach((function(e){var i=n.signals[e];t.signals(e,i)&&(r[e]=i.value)}))}if(t.data){var i=e.data={};Object.keys(n.data).forEach((function(e){var r=n.data[e];t.data(e,r)&&(i[e]=r.input.value)}))}return n.subcontext&&!1!==t.recurse&&(e.subcontext=n.subcontext.map((function(n){return n.getState(t)}))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((function(t){e.update(n.signals[t],i[t],oB)})),Object.keys(r||{}).forEach((function(t){e.pulse(n.data[t].input,e.changeset().remove(m).insert(r[t]))})),(t.subcontext||[]).forEach((function(t,e){var r=n.subcontext[e];r&&r.setState(t)}))}};var fB="width",hB="height",dB="padding",pB={skip:!0};function gB(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===dB?r.left+r.right:0)}function mB(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===dB?r.top+r.bottom:0)}function vB(t,n){return n.modified&&u(n.input.value)&&t.indexOf("_:vega:_")}function yB(t,n){return!("parent"===t||n instanceof ti.proxy)}function _B(t,n,e,r){var i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":u(t)?xB(t):o(t)&&!ct(t)?(n=t,Object.keys(n).map((function(t){var e=n[t];return t+": "+(u(e)?xB(e):bB(e))})).join("\n")):t+"";var n}(r))}function xB(t){return"["+t.map(bB).join(", ")+"]"}function bB(t){return u(t)?"[…]":o(t)&&!ct(t)?"{…}":t}function wB(t,n){n=n||{},Xr.call(this),n.loader&&this.loader(n.loader),n.logger&&this.logger(n.logger),null!=n.logLevel&&this.logLevel(n.logLevel),this._el=null,this._elBind=null,this._renderType=n.renderer||Fd.Canvas,this._scenegraph=new Fh;var e=this._scenegraph.root;this._renderer=null,this._tooltip=n.tooltip||_B,this._redraw=!0,this._handler=(new Hh).scene(e),this._preventDefault=!1,this._timers=[],this._eventListeners=[],this._resizeListeners=[],this._eventConfig=function(t){const n=K({defaults:{}},t),e=(t,n)=>{n.forEach(n=>{u(t[n])&&(t[n]=At(t[n]))})};return e(n.defaults,["prevent","allow"]),e(n,["view","window","selector"]),n}(t.eventConfig);var r=function(t,n,e){return uB(n,sB(t,ti,e||IS))}(this,t,n.functions);this._runtime=r,this._signals=r.signals,this._bind=(t.bindings||[]).map((function(t){return{state:null,param:K({},t)}})),r.root&&r.root.set(e),e.source=r.data.root.input,this.pulse(r.data.root.input,this.changeset().insert(e.items)),this._background=n.background||r.background||null,this._width=this.width(),this._height=this.height(),this._viewWidth=gB(this,this._width),this._viewHeight=mB(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(t){var n=t._signals,e=n[fB],r=n[hB],i=n[dB];function a(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(function(n){t._width=n.size,t._viewWidth=gB(t,n.size),a()}),{size:e}),t._resizeHeight=t.add(null,(function(n){t._height=n.size,t._viewHeight=mB(t,n.size),a()}),{size:r});var u=t.add(null,a,{pad:i});t._resizeWidth.rank=e.rank+1,t._resizeHeight.rank=r.rank+1,u.rank=i.rank+1}(this),TD(this),n.hover&&this.hover(),n.container&&this.initialize(n.container,n.bind)}var AB=ot(wB,Xr);function kB(t,n){return rt(t._signals,n)?t._signals[n]:i("Unrecognized signal name: "+l(n))}function MB(t,n){var e=(t._targets||[]).filter((function(t){var e=t._update;return e&&e.handler===n}));return e.length?e[0]:null}function EB(t,n,e,r){var i=MB(e,r);return i||((i=uC(this,(function(){r(n,e.value)}))).handler=r,t.on(e,null,i)),t}function DB(t,n,e){var r=MB(n,e);return r&&n._targets.remove(r),t}function CB(t){return+t||0}AB.evaluate=async function(t,n,e){if(await Xr.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var n=qD(t),e=OD(t),r=RD(t);t._renderer.background(t._background),t._renderer.resize(e,r,n),t._handler.origin(n),t._resizeListeners.forEach((function(n){try{n(e,r)}catch(n){t.error(n)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return e&&Dt(this,e),this},AB.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},AB.container=function(){return this._el},AB.scenegraph=function(){return this._scenegraph},AB.origin=function(){return this._origin.slice()},AB.signal=function(t,n,e){var r=kB(this,t);return 1===arguments.length?r.value:this.update(r,n,e)},AB.background=function(t){return arguments.length?(this._background=t,this._resize=1,this):this._background},AB.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},AB.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},AB.padding=function(t){return arguments.length?this.signal("padding",t):this.signal("padding")},AB.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},AB.renderer=function(t){return arguments.length?(Bd(t)||i("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},AB.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},AB.loader=function(t){return arguments.length?(t!==this._loader&&(Xr.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},AB.resize=function(){return this._autosize=1,this.touch(kB(this,"autosize"))},AB._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},AB._resizeView=function(t,n,e,r,i,a){this.runAfter((function(u){var o=0;u._autosize=0,u.width()!==e&&(o=1,u.signal(fB,e,pB),u._resizeWidth.skip(!0)),u.height()!==r&&(o=1,u.signal(hB,r,pB),u._resizeHeight.skip(!0)),u._viewWidth!==t&&(u._resize=1,u._viewWidth=t),u._viewHeight!==n&&(u._resize=1,u._viewHeight=n),u._origin[0]===i[0]&&u._origin[1]===i[1]||(u._resize=1,u._origin=i),o&&u.run("enter"),a&&u.runAfter(t=>t.resize())}),!1,1)},AB.addEventListener=function(t,n,e){var r=n;return e&&!1===e.trap||((r=uC(this,n)).raw=n),this._handler.on(t,r),this},AB.removeEventListener=function(t,n){for(var e,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,e=i[a].handler,t===r&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},AB.addResizeListener=function(t){var n=this._resizeListeners;return n.indexOf(t)<0&&n.push(t),this},AB.removeResizeListener=function(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},AB.addSignalListener=function(t,n){return EB(this,t,kB(this,t),n)},AB.removeSignalListener=function(t,n){return DB(this,kB(this,t),n)},AB.addDataListener=function(t,n){return EB(this,t,zD(this,t).values,n)},AB.removeDataListener=function(t,n){return DB(this,zD(this,t).values,n)},AB.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},AB.timer=function(t,n){this._timers.push(function(t,n,e){var r=new Hk,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?jk():+e,r.restart((function a(u){u+=i,r.restart(a,i+=n,e),t(u)}),n,e),r)}((function(n){t({timestamp:Date.now(),elapsed:n})}),n))},AB.events=function(t,n,e){var r,i=this,a=new Xt(e),u=function(e,r){i.runAsync(null,()=>{t===UD&&function(t,n){var e=t._eventConfig.defaults,r=e.prevent,i=e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),a.receive(LD(i,e,r))})};if(t===$D)ID(i,"timer",n)&&i.timer(u,n);else if(t===UD)ID(i,"view",n)&&i.addEventListener(n,u,jD);else if(t===PD?ID(i,"window",n)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&ID(i,"selector",n)&&(r=document.querySelectorAll(t)),r){for(var o=0,s=r.length;o<s;++o)r[o].addEventListener(n,u);i._eventListeners.push({type:n,sources:r,handler:u})}else i.warn("Can not resolve event source: "+t);return a},AB.finalize=function(){var t,n,e,r=this._tooltip,i=this._timers,a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);return r&&r.call(this,this._handler,null,null,null),this},AB.hover=function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",HD),WD,YD(t)),this.on(this.events("view","mouseout",HD),WD,YD(n)),this},AB.data=function(t,n){return arguments.length<2?zD(this,t).values.value:ND.call(this,t,Ut().remove(m).insert(n))},AB.change=ND,AB.insert=function(t,n){return ND.call(this,t,Ut().insert(n))},AB.remove=function(t,n){return ND.call(this,t,Ut().remove(n))},AB.scale=function(t){var n=this._runtime.scales;return rt(n,t)||i("Unrecognized scale or projection: "+t),n[t].value},AB.initialize=function(t,n){var e,r,i=this,a=i._renderType,u=i._eventConfig.bind,o=Bd(a);return t=i._el=t?oC(i,t):null,o||i.error("Unrecognized renderer type: "+a),e=o.handler||Hh,r=t?o.renderer:o.headless,i._renderer=r?aC(i,i._renderer,t,r):null,i._handler=function(t,n,e,r){var i=new r(t.loader(),uC(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,qD(t),t);return n&&n.handlers().forEach((function(t){i.on(t.type,t.handler)})),i}(i,i._handler,t,e),i._redraw=!0,t&&"none"!==u&&(n=n?i._elBind=oC(i,n):t.appendChild(VD("div",{class:"vega-bindings"})),i._bind.forEach((function(t){t.param.element&&"container"!==u&&(t.element=oC(i,t.param.element))})),i._bind.forEach((function(t){QD(i,t.element||n,t)}))),i},AB.toImageURL=async function(t,n){t!==Fd.Canvas&&t!==Fd.SVG&&t!==Fd.PNG&&i("Unrecognized image type: "+t);const e=await sC(this,t,n);return t===Fd.SVG?function(t,n){var e=new Blob([t],{type:n});return window.URL.createObjectURL(e)}(e.svg(),"image/svg+xml"):e.canvas().toDataURL("image/png")},AB.toCanvas=async function(t,n){return(await sC(this,Fd.Canvas,t,n)).canvas()},AB.toSVG=async function(t){return(await sC(this,Fd.SVG,t)).svg()},AB.getState=function(t){return this._runtime.getState(t||{data:vB,signals:yB,recurse:!0})},AB.setState=function(t){return this.runAsync(null,n=>{n._trigger=!1,n._runtime.setState(t)},t=>{t._trigger=!0}),this};var FB="outer",SB=["value","update","init","react","bind"];function BB(t,n){i(t+' for "outer" push: '+l(n))}function TB(t,n){var e=t.name;if(t.push===FB)n.signals[e]||BB("No prior signal definition",e),SB.forEach((function(n){void 0!==t[n]&&BB("Invalid property ",n)}));else{var r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function zB(t,n,e){var r,a,u={};try{r=function(t){fC=0,hC=(cC=t).length,dC=null,MF();var n=JF();if(dC.type!==CC)throw new Error("Unexpect token after expression.");return n}(t=s(t)?t:l(t)+"")}catch(n){i("Expression parse error: "+t)}return r.visit((function(t){if(t.type===xC){var e=t.callee.name,r=XS.visitors[e];r&&r(e,t.arguments,n,u)}})),(a=JS(r)).globals.forEach((function(t){var e=US+t;!rt(u,e)&&n.getSignal(t)&&(u[e]=n.signalRef(t))})),{$expr:e?e+"return("+a.code+");":a.code,$fields:a.fields,$params:u}}function NB(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function OB(t,n,e,r){return new NB(t,n,e,r)}function RB(t,n){return OB("operator",t,n)}function qB(t){var n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function LB(t,n){return n?{$field:t,$name:n}:{$field:t}}var UB=LB("key");function $B(t,n){return{$compare:t,$order:n}}var PB="descending";function jB(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}var IB="scope",HB="view";function WB(t){return t&&t.signal}function YB(t){if(WB(t))return!0;if(o(t))for(var n in t)if(YB(t[n]))return!0;return!1}function VB(t,n){return null!=t?t:n}function GB(t){return t&&t.signal||t}var XB="timer";function JB(t,n){return(t.merge?ZB:t.stream?QB:t.type?KB:i("Invalid stream specification: "+l(t)))(t,n)}function ZB(t,n){var e=tT({merge:t.merge.map(t=>JB(t,n))},t,n);return n.addStream(e).id}function QB(t,n){var e=tT({stream:JB(t.stream,n)},t,n);return n.addStream(e).id}function KB(t,n){var e,r;return t.type===XB?(e=n.event(XB,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(t){return t===IB?HB:t||HB}(t.source),t.type),r=tT({stream:e},t,n),1===Object.keys(r).length?e:n.addStream(r).id}function tT(t,n,e){var r=n.between;return r&&(2!==r.length&&i('Stream "between" parameter must have 2 entries: '+l(n)),t.between=[JB(r[0],e),JB(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(t,n,e){var r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(e?"&&"+r+".mark.role==='"+e+"'":"")+(n?"&&"+r+".mark.name==='"+n+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===IB&&r.push("inScope(event.item)"),r.length&&(t.filter=zB("("+r.join(")&&(")+")").$expr),null!=(r=n.throttle)&&(t.throttle=+r),null!=(r=n.debounce)&&(t.debounce=+r),n.consume&&(t.consume=!0),t}var nT,eT,rT="view",iT="[",aT="]",uT="{",oT="}",sT=":",lT=",",cT="@",fT=">",hT=/[[\]{}]/,dT={"*":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};function pT(t,n,e,r,i){for(var a,u=0,o=t.length;n<o;++n){if(a=t[n],!u&&a===e)return n;i&&i.indexOf(a)>=0?--u:r&&r.indexOf(a)>=0&&++u}return n}function gT(t){for(var n=[],e=0,r=t.length,i=0;i<r;)i=pT(t,i,lT,iT+uT,aT+oT),n.push(t.substring(e,i).trim()),e=++i;if(0===n.length)throw"Empty event selector: "+t;return n}function mT(t){return"["===t[0]?function(t){var n,e,r=t.length,i=1;if((i=pT(t,i,aT,iT,aT))===r)throw"Empty between selector: "+t;if(2!==(n=gT(t.substring(1,i))).length)throw"Between selector must have two elements: "+t;if((t=t.slice(i+1).trim())[0]!==fT)throw"Expected '>' after between selector: "+t;if(n=n.map(mT),(e=mT(t.slice(1).trim())).between)return{between:n,stream:e};e.between=n;return e}(t):function(t){var n,e,r={source:nT},i=[],a=[0,0],u=0,o=0,s=t.length,l=0;if(t[s-1]===oT){if(!((l=t.lastIndexOf(uT))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var n=t.split(lT);if(!t.length||n.length>2)throw t;return n.map((function(n){var e=+n;if(e!=e)throw t;return e}))}(t.substring(l+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;t[0]===cT&&(u=++l);(n=pT(t,l,sT))<s&&(i.push(t.substring(o,n).trim()),o=l=++n);if((l=pT(t,l,iT))===s)i.push(t.substring(o,s).trim());else if(i.push(t.substring(o,l).trim()),e=[],(o=++l)===s)throw"Unmatched left bracket: "+t;for(;l<s;){if((l=pT(t,l,aT))===s)throw"Unmatched left bracket: "+t;if(e.push(t.substring(o,l).trim()),l<s-1&&t[++l]!==iT)throw"Expected left bracket: "+t;o=++l}if(!(s=i.length)||hT.test(i[s-1]))throw"Invalid event selector: "+t;s>1?(r.type=i[1],u?r.markname=i[0].slice(1):!function(t){return eT[t]}(i[0])?r.source=i[0]:r.marktype=i[0]):r.type=i[0];"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=e&&(r.filter=e);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}var vT="var datum=event.item&&event.item.datum;";function yT(t,n,e){var r=t.events,a=t.update,u=t.encode,o=[],c={target:e};r||i("Signal update missing events specification."),s(r)&&(r=function(t,n,e){return nT=n||rT,eT=e||dT,gT(t.trim()).map(mT)}(r,n.isSubscope()?IB:HB)),r=V(r).filter(t=>t.signal||t.scale?(o.push(t),0):1),o.length>1&&(o=[_T(o)]),r.length&&o.push(r.length>1?{merge:r}:r[0]),null!=u&&(a&&i("Signal encode and update are mutually exclusive."),a="encode(item(),"+l(u)+")"),c.update=s(a)?zB(a,n,vT):null!=a.expr?zB(a.expr,n,vT):null!=a.value?a.value:null!=a.signal?{$expr:"_.value",$params:{value:n.signalRef(a.signal)}}:i("Invalid signal update specification."),t.force&&(c.options={force:!0}),o.forEach((function(t){n.addUpdate(K(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):JB(t,n)}}(t,n),c))}))}function _T(t){return{signal:"["+t.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function xT(t){return function(n,e,r){return OB(t,e,n||void 0,r)}}var bT=xT("aggregate"),wT=xT("axisticks"),AT=xT("bound"),kT=xT("collect"),MT=xT("compare"),ET=xT("datajoin"),DT=xT("encode"),CT=xT("expression"),FT=xT("facet"),ST=xT("field"),BT=xT("key"),TT=xT("legendentries"),zT=xT("load"),NT=xT("mark"),OT=xT("multiextent"),RT=xT("multivalues"),qT=xT("overlap"),LT=xT("params"),UT=xT("prefacet"),$T=xT("projection"),PT=xT("proxy"),jT=xT("relay"),IT=xT("render"),HT=xT("scale"),WT=xT("sieve"),YT=xT("sortitems"),VT=xT("viewlayout"),GT=xT("values"),XT=0,JT={min:"min",max:"max",count:"sum"};function ZT(t,n){var e,r=n.getScale(t.name).params;for(e in r.domain=nz(t.domain,t,n),null!=t.range&&(r.range=function t(n,e,r){var a=n.range,o=e.config.range;if(a.signal)return e.signalRef(a.signal);if(s(a)){if(o&&rt(o,a))return n=K({},n,{range:o[a]}),t(n,e,r);"width"===a?a=[0,{signal:"width"}]:"height"===a?a=ly(n.type)?[0,{signal:"height"}]:[{signal:"height"},0]:i("Unrecognized scale range value: "+l(a))}else{if(a.scheme)return r.scheme=u(a.scheme)?KT(a.scheme,e):QT(a.scheme,e),a.extent&&(r.schemeExtent=KT(a.extent,e)),void(a.count&&(r.schemeCount=QT(a.count,e)));if(a.step)return void(r.rangeStep=QT(a.step,e));if(ly(n.type)&&!u(a))return nz(a,n,e);u(a)||i("Unsupported range type: "+l(a))}return a.map(t=>(u(t)?KT:QT)(t,e))}(t,n,r)),null!=t.interpolate&&function(t,n){n.interpolate=QT(t.type||t),null!=t.gamma&&(n.interpolateGamma=QT(t.gamma))}(t.interpolate,r),null!=t.nice&&(r.nice=function(t){return o(t)?{interval:QT(t.interval),step:QT(t.step)}:QT(t)}(t.nice)),null!=t.bins&&(r.bins=function(t,n){return t.signal||u(t)?KT(t,n):n.objectProperty(t)}(t.bins,n)),t)rt(r,e)||"name"===e||(r[e]=QT(t[e],n))}function QT(t,n){return o(t)?t.signal?n.signalRef(t.signal):i("Unsupported object: "+l(t)):t}function KT(t,n){return t.signal?n.signalRef(t.signal):t.map(t=>QT(t,n))}function tz(t){i("Can not find data set: "+l(t))}function nz(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(u(t)?ez:t.fields?iz:rz)(t,n,e);null==n.domainMin&&null==n.domainMax||i("No scale domain defined for domainMin/domainMax to override.")}function ez(t,n,e){return t.map((function(t){return QT(t,e)}))}function rz(t,n,e){var r=e.getData(t.data);return r||tz(t.data),ly(n.type)?r.valuesRef(e,t.field,uz(t.sort,!1)):dy(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function iz(t,n,e){var r=t.data,i=t.fields.reduce((function(t,n){return n=s(n)?{data:r,field:n}:u(n)||n.signal?function(t,n){var e="_:vega:_"+XT++,r=kT({});if(u(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+l(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,WT({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t}),[]);return(ly(n.type)?az:dy(n.type)?oz:sz)(t,e,i)}function az(t,n,e){var r,i,a,u,o,s=uz(t.sort,!0);return r=e.map((function(t){var e=n.getData(t.data);return e||tz(t.data),e.countsRef(n,t.field,s)})),i={groupby:UB,pulse:r},s&&(a=s.op||"count",o=s.field?jB(a,s.field):"count",i.ops=[JT[a]],i.fields=[n.fieldRef(o)],i.as=[o]),a=n.add(bT(i)),u=n.add(kT({pulse:qB(a)})),o=n.add(GT({field:UB,sort:n.sortRef(s),pulse:qB(u)})),qB(o)}function uz(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field&&t.op&&!JT[t.op]&&i("Multiple domain scales can not be sorted using "+t.op):i("No field provided for sort aggregate op: "+t.op):o(t)?t.field="key":t={field:"key"}),t}function oz(t,n,e){var r=e.map((function(t){var e=n.getData(t.data);return e||tz(t.data),e.domainRef(n,t.field)}));return qB(n.add(RT({values:r})))}function sz(t,n,e){var r=e.map((function(t){var e=n.getData(t.data);return e||tz(t.data),e.extentRef(n,t.field)}));return qB(n.add(OT({extents:r})))}function lz(t,n,e){return u(t)?t.map((function(t){return lz(t,n,e)})):o(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:i("Unsupported parameter object: "+l(t)):t}const cz="top",fz="left",hz="right",dz="bottom",pz="vertical",gz="start",mz="end",vz="index",yz="label",_z="offset",xz="perc",bz="perc2",wz="size",Az="value",kz="guide-label",Mz="guide-title",Ez="group-title",Dz="group-subtitle",Cz="symbol",Fz="gradient",Sz="discrete",Bz=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],Tz={name:1,style:1,interactive:1},zz={value:0},Nz={value:1};var Oz=At(["rule"]),Rz=At(["group","image","rect"]);function qz(t,n,e,r){var i=zB(t,n);return i.$fields.forEach((function(t){r[t]=1})),K(e,i.$params),i.$expr}function Lz(t,n,e,r){return function t(n,e,r,u){var o,c,f;if(n.signal)o="datum",f=qz(n.signal,e,r,u);else if(n.group||n.parent){for(c=Math.max(1,n.level||1),o="item";c-- >0;)o+=".mark.group";n.parent?(f=n.parent,o+=".datum"):f=n.group}else n.datum?(o="datum",f=n.datum):i("Invalid field reference: "+l(n));n.signal||(s(f)?(u[f]=1,f=a(f).map(l).join("][")):f=t(f,e,r,u));return o+"["+f+"]"}(o(t)?t:{datum:t},n,e,r)}function Uz(t,n,e,r){return o(t)?"("+jz(null,t,n,e,r)+")":t}function $z(t,n,e,r,i){var a,u,o,l=Pz(t.scale,e,r,i);return null!=t.range?(u=l+".range()",n=0===(a=+t.range)?u+"[0]":"($="+u+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==n&&(n=l+"("+n+")"),t.band&&(o=function(t,n){if(!s(t))return-1;var e=n.scaleType(t);return"band"===e||"point"===e?1:0}(t.scale,e))&&(u=l+".bandwidth",a=t.band.signal?u+"()*"+Uz(t.band,e,r,i):u+"()"+(1===(a=+t.band)?"":"*"+a),o<0&&(a="("+u+"?"+a+":0)"),n=(n?n+"+":"")+a,t.extra&&(n="(datum.extra?"+l+"(datum.extra.value):"+n+")")),null==n&&(n="0")),n}function Pz(t,n,e,r){var i;if(s(t))rt(e,i=LS+t)||(e[i]=n.scaleRef(t)),i=l(i);else{for(i in n.scales)e[LS+i]=n.scaleRef(i);i=l(LS)+"+"+(t.signal?"("+qz(t.signal,n,e,r)+")":Lz(t,n,e,r))}return"_["+i+"]"}function jz(t,n,e,r,i){if(null!=n.gradient)return function(t,n,e,r){return"this.gradient("+Pz(t.gradient,n,e,r)+","+l(t.start)+","+l(t.stop)+","+l(t.count)+")"}(n,e,r,i);var a=n.signal?qz(n.signal,e,r,i):n.color?function(t,n,e,r){function i(t,i,a,u){return"this."+t+"("+[jz(null,i,n,e,r),jz(null,a,n,e,r),jz(null,u,n,e,r)].join(",")+").toString()"}return t.c?i("hcl",t.h,t.c,t.l):t.h||t.s?i("hsl",t.h,t.s,t.l):t.l||t.a?i("lab",t.l,t.a,t.b):t.r||t.g||t.b?i("rgb",t.r,t.g,t.b):null}(n.color,e,r,i):null!=n.field?Lz(n.field,e,r,i):void 0!==n.value?l(n.value):void 0;return null!=n.scale&&(a=$z(n,a,e,r,i)),void 0===a&&(a=null),null!=n.exponent&&(a="Math.pow("+a+","+Uz(n.exponent,e,r,i)+")"),null!=n.mult&&(a+="*"+Uz(n.mult,e,r,i)),null!=n.offset&&(a+="+"+Uz(n.offset,e,r,i)),n.round&&(a="Math.round("+a+")"),a}function Iz(t,n,e){const r=t+"["+l(n)+"]";return`$=${e};if(${r}!==$)${r}=$,m=1;`}function Hz(t,n,e,r,i){var a="";return n.forEach((function(t){var n=jz(0,t,e,r,i);a+=t.test?qz(t.test,e,r,i)+"?"+n+":":n})),":"===C(a)&&(a+="null"),Iz("o",t,a)}function Wz(t,n,e,r){var i,a,o={},s="var o=item,datum=o.datum,m=0,$;";for(i in t)a=t[i],u(a)?s+=Hz(i,a,r,e,o):s+=Iz("o",i,jz(0,a,r,e,o));return s+=function(t,n){var e="";return Oz[n]?e:(t.x2&&(t.x?(Rz[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(Rz[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;"),e)}(t,n),{$expr:s+="return m;",$fields:Object.keys(o),$output:Object.keys(t)}}var Yz="mark",Vz="frame",Gz="scope",Xz="axis",Jz="axis-domain",Zz="axis-grid",Qz="axis-label",Kz="axis-tick",tN="axis-title",nN="legend",eN="legend-band",rN="legend-entry",iN="legend-gradient",aN="legend-label",uN="legend-symbol",oN="legend-title",sN="title",lN="title-text",cN="title-subtitle";function fN(t){return o(t)&&!u(t)?K({},t):{value:t}}function hN(t,n,e,r){return null!=e?(o(e)&&!u(e)?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function dN(t,n,e){for(let e in n)hN(t,e,n[e]);for(let n in e)hN(t,n,e[n],"update")}function pN(t,n,e){for(var r in n)e&&rt(e,r)||(t[r]=K(t[r]||{},n[r]));return t}function gN(t,n,e,r,i,a){var u,o;for(o in(a=a||{}).encoders={$encode:u={}},t=function(t,n,e,r,i){var a,u,o,s={},l={};"legend"!=e&&0!==String(e).indexOf("axis")||(e=null);for(u in o=e===Vz?i.group:e===Yz?K({},i.mark,i[n]):null)vN(u,t)||("fill"===u||"stroke"===u)&&(vN("fill",t)||vN("stroke",t))||mN(s,u,o[u]);for(u in V(r).forEach((function(n){var e=i.style&&i.style[n];for(var r in e)vN(r,t)||mN(s,r,e[r])})),t=K({},t),s)(o=s[u]).signal?(a=a||{})[u]=o:l[u]=o;t.enter=K(l,t.enter),a&&(t.update=K(a,t.update));return t}(t,n,e,r,i.config))u[o]=Wz(t[o],n,a,i);return a}function mN(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}function vN(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}function yN(t,n,e,r,i,a,u){return{type:t,name:u?u.name:void 0,role:n,style:u&&u.style||e,key:r,from:i,interactive:!(!u||!u.interactive),encode:pN(a,u,Tz)}}function _N(t,n){const e=(e,r)=>VB(t[e],VB(n[e],r));return e.isVertical=e=>pz===VB(t.direction,n.direction||(e?n.symbolDirection:n.gradientDirection)),e.gradientLength=()=>VB(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>VB(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>VB(t.columns,VB(n.columns,+e.isVertical(!0))),e}function xN(t,n){var e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function bN(t,n,e){return`item.anchor === "${gz}" ? ${t} : item.anchor === "${mz}" ? ${n} : ${e}`}const wN=bN(l(fz),l(hz),l("center"));var AN="group",kN="rect",MN="rule",EN="symbol",DN="text";function CN(t,n,e,r){var i,a,u,o,s,l,c=_N(t,e),f=c.isVertical(),h=c.gradientThickness(),d=c.gradientLength();return f?(u=[0,1],o=[0,0],s=h,l=d):(u=[0,0],o=[1,0],s=d,l=h),dN(i={enter:a={opacity:zz,x:zz,y:zz,width:fN(s),height:fN(l)},update:K({},a,{opacity:Nz,fill:{gradient:n,start:u,stop:o}}),exit:{opacity:zz}},{stroke:c("gradientStrokeColor"),strokeWidth:c("gradientStrokeWidth")},{opacity:c("gradientOpacity")}),yN(kN,iN,null,void 0,void 0,i,r)}function FN(t,n,e,r,i){var a,u,o,s,l,c,f=_N(t,e),h=f.isVertical(),d=f.gradientThickness(),p=f.gradientLength(),g="";return h?(o="y",l="y2",s="x",c="width",g="1-"):(o="x",l="x2",s="y",c="height"),(u={opacity:zz,fill:{scale:n,field:Az}})[o]={signal:g+"datum."+xz,mult:p},u[s]=zz,u[l]={signal:g+"datum."+bz,mult:p},u[c]=fN(d),dN(a={enter:u,update:K({},u,{opacity:Nz}),exit:{opacity:zz}},{stroke:f("gradientStrokeColor"),strokeWidth:f("gradientStrokeWidth")},{opacity:f("gradientOpacity")}),yN(kN,eN,null,Az,i,a,r)}const SN=`datum.${xz}<=0?"${fz}":datum.${xz}>=1?"${hz}":"center"`,BN=`datum.${xz}<=0?"${dz}":datum.${xz}>=1?"${cz}":"middle"`;function TN(t,n,e,r){var i,a,u,o,s,l=_N(t,n),c=l.isVertical(),f=fN(l.gradientThickness()),h=l.gradientLength(),d=l("labelOverlap"),p=l("labelSeparation"),g="";return dN(i={enter:a={opacity:zz},update:u={opacity:Nz,text:{field:yz}},exit:{opacity:zz}},{fill:l("labelColor"),fillOpacity:l("labelOpacity"),font:l("labelFont"),fontSize:l("labelFontSize"),fontStyle:l("labelFontStyle"),fontWeight:l("labelFontWeight"),limit:VB(t.labelLimit,n.gradientLabelLimit)}),c?(a.align={value:"left"},a.baseline=u.baseline={signal:BN},o="y",s="x",g="1-"):(a.align=u.align={signal:SN},a.baseline={value:"top"},o="x",s="y"),a[o]=u[o]={signal:g+"datum."+xz,mult:h},a[s]=u[s]=f,f.offset=VB(t.labelOffset,n.gradientLabelOffset)||0,t=yN(DN,aN,kz,Az,r,i,e),d&&(t.overlap={separation:p,method:d,order:"datum."+vz}),t}function zN(t,n,e,r,i,a,u,o){return{type:AN,name:e,role:t,style:n,from:r,interactive:i||!1,encode:a,marks:u,layout:o}}function NN(t,n,e,r,i){var a,u,o,s,l,c,f,h=_N(t,n),d=e.entries,p=!(!d||!d.interactive),g=d?d.name:void 0,m=h("clipHeight"),v=h("symbolOffset"),y={data:"value"},_={},x=`${i} ? datum.${_z} : datum.${wz}`,b=m?fN(m):{field:wz},w=`datum.${vz}`,A=`max(1, ${i})`;b.mult=.5,_={enter:a={opacity:zz,x:{signal:x,mult:.5,offset:v},y:b},update:u={opacity:Nz,x:a.x,y:a.y},exit:{opacity:zz}};var k=null,M=null;return t.fill||(k=n.symbolBaseFillColor,M=n.symbolBaseStrokeColor),dN(_,{fill:h("symbolFillColor",k),shape:h("symbolType"),size:h("symbolSize"),stroke:h("symbolStrokeColor",M),strokeDash:h("symbolDash"),strokeDashOffset:h("symbolDashOffset"),strokeWidth:h("symbolStrokeWidth")},{opacity:h("symbolOpacity")}),Bz.forEach((function(n){t[n]&&(u[n]=a[n]={scale:t[n],field:Az})})),s=yN(EN,uN,null,Az,y,_,e.symbols),m&&(s.clip=!0),(o=fN(v)).offset=h("labelOffset"),dN(_={enter:a={opacity:zz,x:{signal:x,offset:o},y:b},update:u={opacity:Nz,text:{field:yz},x:a.x,y:a.y},exit:{opacity:zz}},{align:h("labelAlign"),baseline:h("labelBaseline"),fill:h("labelColor"),fillOpacity:h("labelOpacity"),font:h("labelFont"),fontSize:h("labelFontSize"),fontStyle:h("labelFontStyle"),fontWeight:h("labelFontWeight"),limit:h("labelLimit")}),l=yN(DN,aN,kz,Az,y,_,e.labels),_={enter:{noBound:{value:!m},width:zz,height:m?fN(m):zz,opacity:zz},exit:{opacity:zz},update:u={opacity:Nz,row:{signal:null},column:{signal:null}}},h.isVertical(!0)?(c=`ceil(item.mark.items.length / ${A})`,u.row.signal=`${w}%${c}`,u.column.signal=`floor(${w} / ${c})`,f={field:["row",w]}):(u.row.signal=`floor(${w} / ${A})`,u.column.signal=`${w} % ${A}`,f={field:w}),u.column.signal=`${i}?${u.column.signal}:${w}`,(t=zN(Gz,null,g,r={facet:{data:r,name:"value",groupby:vz}},p,pN(_,d,Tz),[s,l])).sort=f,t}const ON='item.orient === "left"',RN='item.orient === "right"',qN=`(${ON} || ${RN})`,LN=`datum.vgrad && ${qN}`,UN=bN('"top"','"bottom"','"middle"'),$N=`datum.vgrad && ${RN} ? (${bN('"right"','"left"','"center"')}) : (${qN} && !(datum.vgrad && ${ON})) ? "left" : ${wN}`,PN=`item._anchor || (${qN} ? "middle" : "start")`,jN=`${LN} ? (${ON} ? -90 : 90) : 0`,IN=`${qN} ? (datum.vgrad ? (${RN} ? "bottom" : "top") : ${UN}) : "top"`;function HN(t,n){var e;return o(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+WN(t.path)+")":t.sphere&&(e="geoShape("+WN(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function WN(t){return o(t)&&t.signal?t.signal:l(t)}function YN(t){var n=t.role||"";return n.indexOf("axis")&&n.indexOf("legend")&&n.indexOf("title")?t.type===AN?Gz:n||Yz:n}function VN(t){return{marktype:t.type,name:t.name||void 0,role:t.role||YN(t),zindex:+t.zindex||void 0}}function GN(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function XN(t,n){var e=ni(t.type);e||i("Unrecognized transform type: "+l(t.type));var r=OB(e.type.toLowerCase(),null,JN(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function JN(t,n,e){var r,i,a,u={};for(i=0,a=t.params.length;i<a;++i)u[(r=t.params[i]).name]=ZN(r,n,e);return u}function ZN(t,n,e){var r=t.type,a=n[t.name];return"index"===r?function(t,n,e){s(n.from)||i('Lookup "from" parameter must be a string literal.');return e.getData(n.from).lookupRef(e,n.key)}(0,n,e):void 0!==a?"param"===r?function(t,n,e){var r=n[t.name];return t.array?(u(r)||i("Expected an array of sub-parameters. Instead: "+l(r)),r.map((function(n){return KN(t,n,e)}))):KN(t,r,e)}(t,n,e):"projection"===r?e.projectionRef(n[t.name]):t.array&&!WB(a)?a.map((function(n){return QN(t,n,e)})):QN(t,a,e):void(t.required&&i("Missing required "+l(n.type)+" parameter: "+l(t.name)))}function QN(t,n,e){var r=t.type;if(WB(n))return tO(r)?i("Expression references can not be signals."):nO(r)?e.fieldRef(n):eO(r)?e.compareRef(n):e.signalRef(n.signal);var a,u=t.expr||nO(r);return u&&((a=n)&&a.expr)?e.exprRef(n.expr,n.as):u&&function(t){return t&&t.field}(n)?LB(n.field,n.as):tO(r)?zB(n,e):function(t){return"data"===t}(r)?qB(e.getData(n).values):nO(r)?LB(n):eO(r)?e.compareRef(n):n}function KN(t,n,e){var r,a,u,o,s;for(o=0,s=t.params.length;o<s;++o){for(u in(a=t.params[o]).key)if(a.key[u]!==n[u]){a=null;break}if(a)break}return a||i("Unsupported parameter: "+l(n)),r=K(JN(a,n,e),a.key),qB(e.add(LT(r)))}function tO(t){return"expr"===t}function nO(t){return"field"===t}function eO(t){return"compare"===t}function rO(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:qB(n.getData(t.data).output)}function iO(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}iO.fromEntries=function(t,n){var e=n.length,r=1,i=n[0],a=n[e-1],u=n[e-2],o=null;for(i&&"load"===i.type&&(i=n[1]),t.add(n[0]);r<e;++r)n[r].params.pulse=qB(n[r-1]),t.add(n[r]),"aggregate"===n[r].type&&(o=n[r]);return new iO(t,i,u,a,o)};var aO=iO.prototype;function uO(t){return s(t)?t:null}function oO(t,n,e){var r,i=jB(e.op,e.field);if(n.ops){for(var a=0,u=n.as.length;a<u;++a)if(n.as[a]===i)return}else n.ops=["count"],n.fields=[null],n.as=["count"];e.op&&(n.ops.push((r=e.op.signal)?t.signalRef(r):e.op),n.fields.push(t.fieldRef(e.field)),n.as.push(i))}function sO(t,n,e,r,i,a,u){var s,l,c=n[e]||(n[e]={}),f=function(t){return o(t)?(t.order===PB?"-":"+")+jB(t.op,t.field):""}(a),h=uO(i);if(null!=h&&(t=n.scope,s=c[h+=f?"|"+f:""]),!s){var d=a?{field:UB,pulse:n.countsRef(t,i,a)}:{field:t.fieldRef(i),pulse:qB(n.output)};f&&(d.sort=t.sortRef(a)),l=t.add(OB(r,void 0,d)),u&&(n.index[i]=l),s=qB(l),null!=h&&(c[h]=s)}return s}function lO(t,n,e){var r,i=t.remove,a=t.insert,u=t.toggle,o=t.modify,s=t.values,l=n.add(RB());r=zB("if("+t.trigger+',modify("'+e+'",'+[a,i,u,o,s].map((function(t){return null==t?"null":t})).join(",")+"),0)",n),l.update=r.$expr,l.params=r.$params}function cO(t,n){var e,r,a,u,o,s,c,f,h,d,p,g,m,v,y=YN(t),_=t.type===AN,x=t.from&&t.from.facet,b=t.layout||y===Gz||y===Vz,w=y===Yz||b||x,A=t.overlap;a=function(t,n,e){var r,a,u,o,s;return t?(r=t.facet)&&(n||i("Only group marks can be faceted."),null!=r.field?o=s=rO(r,e):(t.data?s=qB(e.getData(t.data).aggregate):((u=XN(K({type:"aggregate",groupby:V(r.groupby)},r.aggregate),e)).params.key=e.keyRef(r.groupby),u.params.pulse=rO(r,e),o=s=qB(e.add(u))),a=e.keyRef(r.groupby,!0))):o=qB(e.add(kT(null,[{}]))),o||(o=rO(t,e)),{key:a,pulse:o,parent:s}}(t.from,_,n),d=qB(r=n.add(ET({key:a.key||(t.key?LB(t.key):void 0),pulse:a.pulse,clean:!_}))),r=u=n.add(kT({pulse:d})),r=n.add(NT({markdef:VN(t),interactive:GN(t.interactive,n),clip:HN(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:qB(r)})),p=qB(r),(r=o=n.add(DT(gN(t.encode,t.type,y,t.style,n,{mod:!1,pulse:p})))).params.parent=n.encode(),t.transform&&t.transform.forEach((function(t){const e=XN(t,n),a=e.metadata;(a.generates||a.changes)&&i("Mark transforms should not generate new data."),a.nomod||(o.params.mod=!0),e.params.pulse=qB(r),n.add(r=e)})),t.sort&&(r=n.add(YT({sort:n.compareRef(t.sort),pulse:qB(r)}))),g=qB(r),(x||b)&&(m=qB(b=n.add(VT({layout:n.objectProperty(t.layout),legends:n.legends,mark:p,pulse:g})))),v=qB(s=n.add(AT({mark:p,pulse:m||g}))),_&&(w&&((e=n.operators).pop(),b&&e.pop()),n.pushState(g,m||v,d),x?function(t,n,e){var r,a,u,o,s=t.from.facet,c=s.name,f=rO(s,n);s.name||i("Facet must have a name: "+l(s)),s.data||i("Facet must reference a data set: "+l(s)),s.field?o=n.add(UT({field:n.fieldRef(s.field),pulse:f})):s.groupby?o=n.add(FT({key:n.keyRef(s.groupby),group:qB(n.proxy(e.parent)),pulse:f})):i("Facet must specify groupby or field: "+l(s)),a=(r=n.fork()).add(kT()),u=r.add(WT({pulse:qB(a)})),r.addData(c,new iO(r,a,a,u)),r.addSignal("parent",null),o.params.subflow={$subflow:wO(t,r).toRuntime()}}(t,n,a):w?function(t,n,e){var r=n.add(UT({pulse:e.pulse})),i=n.fork();i.add(WT()),i.addSignal("parent",null),r.params.subflow={$subflow:wO(t,i).toRuntime()}}(t,n,a):wO(t,n),n.popState(),w&&(b&&e.push(b),e.push(s))),A&&(v=function(t,n,e){var r,i=t.method,a=t.bound,u=t.separation,o={separation:WB(u)?e.signalRef(u.signal):u,method:WB(i)?e.signalRef(i.signal):i,pulse:n};t.order&&(o.sort=e.compareRef({field:t.order}));a&&(r=a.tolerance,o.boundTolerance=WB(r)?e.signalRef(r.signal):+r,o.boundScale=e.scaleRef(a.scale),o.boundOrient=a.orient);return qB(e.add(qT(o)))}(A,v,n)),c=n.add(IT({pulse:v})),f=n.add(WT({pulse:qB(c)},void 0,n.parent())),null!=t.name&&(h=t.name,n.addData(h,new iO(n,u,c,f)),t.on&&t.on.forEach((function(t){(t.insert||t.remove||t.toggle)&&i("Marks only support modify triggers."),lO(t,n,h)})))}function fO(t,n){var e,r,a,u,o,s,l,c,f,h=n.config.legend,d=t.encode||{},p=d.legend||{},g=p.name||void 0,m=p.interactive,v=p.style,y=_N(t,h),_=Bz.reduce((function(n,e){return n||t[e]}),0);return _||i("Missing valid scale for legend."),o=function(t,n){var e=t.type||Cz;t.type||1!==function(t){return Bz.reduce((function(n,e){return n+(t[e]?1:0)}),0)}(t)||!t.fill&&!t.stroke||(e=sy(n)?Fz:cy(n)?Sz:Cz);return e!==Fz?e:cy(n)?Sz:Fz}(t,n.scaleType(_)),s={title:null!=t.title,type:o,vgrad:"symbol"!==o&&y.isVertical()},l=qB(n.add(kT(null,[s]))),p=pN(function(t,n){var e={enter:{},update:{}};return dN(e,{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")}),e}(y,h),p,Tz),e={enter:{x:{value:0},y:{value:0}}},c=qB(n.add(TT(a={type:o,scale:n.scaleRef(_),count:n.objectProperty(y("tickCount")),limit:n.property(y("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),o===Fz?(u=[CN(t,_,h,d.gradient),TN(t,h,d.labels,c)],a.count=a.count||n.signalRef(`max(2,2*floor((${GB(y.gradientLength())})/100))`)):o===Sz?u=[FN(t,_,h,d.gradient,c),TN(t,h,d.labels,c)]:(r=function(t,n){const e=_N(t,n);return{align:e("gridAlign"),columns:e.entryColumns(),center:{row:!0,column:!1},padding:{row:e("rowPadding"),column:e("columnPadding")}}}(t,h),u=[NN(t,h,d,c,GB(r.columns))],a.size=function(t,n,e){var r=GB(hO("size",t,e)),i=GB(hO("strokeWidth",t,e)),a=GB(function(t,n,e){return xN("fontSize",t)||function(t,n,e){var r=n.config.style[e];return r&&r[t]}("fontSize",n,e)}(e[1].encode,n,kz));return zB(`max(ceil(sqrt(${r})+${i}),${a})`,n)}(t,n,u[0].marks)),u=[zN(rN,null,null,l,m,e,u,r)],s.title&&u.push(function(t,n,e,r){var i,a=_N(t,n);return dN(i={enter:{opacity:zz},update:{opacity:Nz,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:zz}},{orient:a("titleOrient"),_anchor:a("titleAnchor"),anchor:{signal:PN},angle:{signal:jN},align:{signal:$N},baseline:{signal:IN},text:t.title,fill:a("titleColor"),fillOpacity:a("titleOpacity"),font:a("titleFont"),fontSize:a("titleFontSize"),fontStyle:a("titleFontStyle"),fontWeight:a("titleFontWeight"),limit:a("titleLimit"),lineHeight:a("titleLineHeight")},{align:a("titleAlign"),baseline:a("titleBaseline")}),yN(DN,oN,Mz,null,r,i,e)}(t,h,d.title,l)),f=zN(nN,v,g,l,m,p,u),t.zindex&&(f.zindex=t.zindex),cO(f,n)}function hO(t,n,e){return n[t]?`scale("${n[t]}",datum)`:xN(t,e[0].encode)}aO.countsRef=function(t,n,e){var r,i,a,u=this.counts||(this.counts={}),o=uO(n);return null!=o&&(t=this.scope,r=u[o]),r?e&&e.field&&oO(t,r.agg.params,e):(a={groupby:t.fieldRef(n,"key"),pulse:qB(this.output)},e&&e.field&&oO(t,a,e),i=t.add(bT(a)),r=t.add(kT({pulse:qB(i)})),r={agg:i,ref:qB(r)},null!=o&&(u[o]=r)),r.ref},aO.tuplesRef=function(){return qB(this.values)},aO.extentRef=function(t,n){return sO(t,this,"extent","extent",n,!1)},aO.domainRef=function(t,n){return sO(t,this,"domain","values",n,!1)},aO.valuesRef=function(t,n,e){return sO(t,this,"vals","values",n,e||!0)},aO.lookupRef=function(t,n){return sO(t,this,"lookup","tupleindex",n,!1)},aO.indataRef=function(t,n){return sO(t,this,"indata","tupleindex",n,!0,!0)};const dO=`item.orient==="${fz}"?-90:item.orient==="${hz}"?90:0`;function pO(t,n){var e,r,i=_N(t=s(t)?{text:t}:t,n.config.title),a=t.encode||{},u=a.group||{},o=u.name||void 0,l=u.interactive,c=u.style,f=[];return e=qB(n.add(kT(null,[{}]))),f.push(function(t,n,e,r){var i={value:0},a=t.text,u={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return dN(u,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("color"),font:n("font"),fontSize:n("fontSize"),fontStyle:n("fontStyle"),fontWeight:n("fontWeight"),lineHeight:n("lineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),yN(DN,lN,Ez,null,r,u,e)}(t,i,function(t){const n=t.encode;return n&&n.title||K({name:t.name,interactive:t.interactive,style:t.style},n)}(t),e)),t.subtitle&&f.push(function(t,n,e,r){var i={value:0},a=t.subtitle,u={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return dN(u,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("subtitleColor"),font:n("subtitleFont"),fontSize:n("subtitleFontSize"),fontStyle:n("subtitleFontStyle"),fontWeight:n("subtitleFontWeight"),lineHeight:n("subtitleLineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),yN(DN,cN,Dz,null,r,u,e)}(t,i,a.subtitle,e)),r=zN(sN,c,o,e,l,function(t,n){var e={enter:{},update:{}};return dN(e,{orient:t("orient"),anchor:t("anchor"),align:{signal:wN},angle:{signal:dO},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),pN(e,n,Tz)}(i,u),f),t.zindex&&(r.zindex=t.zindex),cO(r,n)}function gO(t,n){var e=[];t.transform&&t.transform.forEach((function(t){e.push(XN(t,n))})),t.on&&t.on.forEach((function(e){lO(e,n,t.name)})),n.addDataPipeline(t.name,function(t,n,e){var r,i,a,u,o,s=[],l=null,c=!1,f=!1;t.values?YB(t.values)||YB(t.format)?(s.push(vO(n,t)),s.push(l=mO())):s.push(l=mO({$ingest:t.values,$format:t.format})):t.url?YB(t.url)||YB(t.format)?(s.push(vO(n,t)),s.push(l=mO())):s.push(l=mO({$request:t.url,$format:t.format})):t.source&&(l=r=V(t.source).map((function(t){return qB(n.getData(t).output)})),s.push(null));for(i=0,a=e.length;i<a;++i)u=e[i],o=u.metadata,l||o.source||s.push(l=mO()),s.push(u),o.generates&&(f=!0),o.modifies&&!f&&(c=!0),o.source?l=u:o.changes&&(l=null);r&&(a=r.length-1,s[0]=jT({derive:c,pulse:a?r:r[0]}),(c||a)&&s.splice(1,0,mO()));l||s.push(mO());return s.push(WT({})),s}(t,n,e))}function mO(t){var n=kT({},t);return n.metadata={source:!0},n}function vO(t,n){return zT({url:n.url?t.property(n.url):void 0,async:n.async?t.property(n.async):void 0,values:n.values?t.property(n.values):void 0,format:t.objectProperty(n.format)})}function yO(t,n){return{scale:t.scale,range:n}}function _O(t,n,e,r,i){var a,u,s,l,c,f,h,d,p,g=_N(t,n),m=t.orient,v=t.gridScale,y=m===fz||m===cz?1:-1,_=function(t,n){if(1===n);else if(o(t)){for(var e=t=K({},t);null!=e.mult;){if(!o(e.mult))return e.mult*=n,t;e=e.mult=K({},e.mult)}e.mult=n}else t=n*(t||0);return t}(t.offset,y);return dN(a={enter:u={opacity:zz},update:l={opacity:Nz},exit:s={opacity:zz}},{stroke:g("gridColor"),strokeDash:g("gridDash"),strokeDashOffset:g("gridDashOffset"),strokeOpacity:g("gridOpacity"),strokeWidth:g("gridWidth")}),c={scale:t.scale,field:Az,band:i.band,extra:i.extra,offset:i.offset,round:g("tickRound")},m===cz||m===dz?(f="x",h="y",p="height"):(f="y",h="x",p="width"),d=h+"2",l[f]=u[f]=s[f]=c,v?(l[h]=u[h]={scale:v,range:0,mult:y,offset:_},l[d]=u[d]={scale:v,range:1,mult:y,offset:_}):(l[h]=u[h]={value:0,offset:_},l[d]=u[d]={signal:p,mult:y,offset:_}),yN(MN,Zz,null,Az,r,a,e)}function xO(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function bO(t,n){var e,r,i,a,u,s,l=function(t,n){var e=n.config,r=t.orient,i=r===cz||r===dz?e.axisX:e.axisY,a=e["axis"+r[0].toUpperCase()+r.slice(1)],u="band"===n.scaleType(t.scale)&&e.axisBand;return i||a||u?K({},e.axis,i,a,u):e.axis}(t,n),c=t.encode||{},f=c.axis||{},h=f.name||void 0,d=f.interactive,p=f.style,g=_N(t,l),m=function(t){let n,e,r=t("tickBand"),i=t("tickOffset");return r?r.signal?(n={signal:`(${r.signal})==='extent'?1:0.5`},e={signal:`(${r.signal})==='extent'?true:false`},o(i)||(i={signal:`(${r.signal})==='extent'?0:${i}`})):"extent"===r?(n=1,e=!0,i=0):(n=.5,e=!1):(n=t("bandPosition"),e=t("tickExtra")),{extra:e,band:n,offset:i}}(g);return e={orient:t.orient,ticks:!!g("ticks"),labels:!!g("labels"),grid:!!g("grid"),domain:!!g("domain"),title:null!=t.title,translate:g("translate")},r=qB(n.add(kT({},[e]))),f=pN({update:{offset:fN(g("offset")||0),position:fN(VB(t.position,0)),titlePadding:fN(g("titlePadding")),minExtent:fN(g("minExtent")),maxExtent:fN(g("maxExtent")),range:{signal:`abs(span(range("${t.scale}")))`}}},c.axis,Tz),i=qB(n.add(wT({scale:n.scaleRef(t.scale),extra:n.property(m.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),s=[],e.grid&&s.push(_O(t,l,c.grid,i,m)),e.ticks&&(a=g("tickSize"),s.push(function(t,n,e,r,i,a){var u,o,s,l,c,f,h=_N(t,n),d=t.orient,p=d===fz||d===cz?-1:1;return dN(u={enter:o={opacity:zz},update:l={opacity:Nz},exit:s={opacity:zz}},{stroke:h("tickColor"),strokeDash:h("tickDash"),strokeDashOffset:h("tickDashOffset"),strokeOpacity:h("tickOpacity"),strokeWidth:h("tickWidth")}),(c=fN(i)).mult=p,f={scale:t.scale,field:Az,band:a.band,extra:a.extra,offset:a.offset,round:h("tickRound")},d===cz||d===dz?(l.y=o.y=zz,l.y2=o.y2=c,l.x=o.x=s.x=f):(l.x=o.x=zz,l.x2=o.x2=c,l.y=o.y=s.y=f),yN(MN,Kz,null,Az,r,u,e)}(t,l,c.ticks,i,a,m))),e.labels&&(a=e.ticks?a:0,s.push(function(t,n,e,r,i,a){var u,o,s,l,c,f,h,d,p,g,m=_N(t,n),v=t.orient,y=v===fz||v===cz?-1:1,_=v===cz||v===dz,x=t.scale,b=GB(m("labelFlush")),w=GB(m("labelFlushOffset")),A=0===b||!!b,k=m("labelAlign"),M=m("labelBaseline");return(s=fN(i)).mult=y,s.offset=fN(m("labelPadding")||0),s.offset.mult=y,l={scale:x,field:Az,band:.5,offset:a.offset},_?(c=k||(A?xO(x,b,'"left"','"right"','"center"'):"center"),f=M||(v===cz?"bottom":"top"),h=!k):(c=k||(v===hz?"left":"right"),f=M||(A?xO(x,b,'"top"','"bottom"','"middle"'):"middle"),h=!M),h=h&&A&&w?xO(x,b,"-("+w+")",w,0):null,dN(u={enter:o={opacity:zz,x:_?l:s,y:_?s:l},update:{opacity:Nz,text:{field:yz},x:o.x,y:o.y},exit:{opacity:zz,x:o.x,y:o.y}},{[_?"dx":"dy"]:h,align:c,baseline:f,angle:m("labelAngle"),fill:m("labelColor"),fillOpacity:m("labelOpacity"),font:m("labelFont"),fontSize:m("labelFontSize"),fontWeight:m("labelFontWeight"),fontStyle:m("labelFontStyle"),limit:m("labelLimit")}),d=m("labelBound"),p=m("labelOverlap"),g=m("labelSeparation"),t=yN(DN,Qz,kz,Az,r,u,e),(p||d)&&(t.overlap={separation:g,method:p,order:"datum.index",bound:d?{scale:x,orient:v,tolerance:d}:null}),t}(t,l,c.labels,i,a,m))),e.domain&&s.push(function(t,n,e,r){var i,a,u,o,s,l,c=_N(t,n),f=t.orient;return dN(i={enter:a={opacity:zz},update:u={opacity:Nz},exit:{opacity:zz}},{stroke:c("domainColor"),strokeDash:c("domainDash"),strokeDashOffset:c("domainDashOffset"),strokeWidth:c("domainWidth"),strokeOpacity:c("domainOpacity")}),f===cz||f===dz?(o="x",l="y"):(o="y",l="x"),s=o+"2",a[l]=zz,u[o]=a[o]=yO(t,0),u[s]=a[s]=yO(t,1),yN(MN,Jz,null,null,r,i,e)}(t,l,c.domain,r)),e.title&&s.push(function(t,n,e,r){var i,a,u,o,s=_N(t,n),l=t.orient,c=l===fz||l===cz?-1:1,f=l===cz||l===dz;return i={enter:a={opacity:zz,anchor:fN(s("titleAnchor")),align:{signal:wN}},update:u=K({},a,{opacity:Nz,text:fN(t.title)}),exit:{opacity:zz}},o={signal:`lerp(range("${t.scale}"), ${bN(0,1,.5)})`},f?(u.x=o,a.angle={value:0},a.baseline={value:l===cz?"bottom":"top"}):(u.y=o,a.angle={value:90*c},a.baseline={value:"bottom"}),dN(i,{angle:s("titleAngle"),baseline:s("titleBaseline"),fill:s("titleColor"),fillOpacity:s("titleOpacity"),font:s("titleFont"),fontSize:s("titleFontSize"),fontStyle:s("titleFontStyle"),fontWeight:s("titleFontWeight"),limit:s("titleLimit"),lineHeight:s("titleLineHeight")},{align:s("titleAlign")}),!hN(i,"x",s("titleX"),"update")&&!f&&!vN("x",e)&&(i.enter.auto={value:!0}),!hN(i,"y",s("titleY"),"update")&&f&&!vN("y",e)&&(i.enter.auto={value:!0}),yN(DN,tN,Mz,null,r,i,e)}(t,l,c.title,r)),u=zN(Xz,p,h,r,d,f,s),t.zindex&&(u.zindex=t.zindex),cO(u,n)}function wO(t,n,e){var r=V(t.signals),a=V(t.scales);return e||r.forEach(t=>TB(t,n)),V(t.projections).forEach(t=>(function(t,n){var e=n.config.projection||{},r={};for(var i in t)"name"!==i&&(r[i]=lz(t[i],i,n));for(i in e)null==r[i]&&(r[i]=lz(e[i],i,n));n.addProjection(t.name,r)})(t,n)),a.forEach(t=>(function(t,n){var e=t.type||"linear";uy(e)||i("Unrecognized scale type: "+l(e)),n.addScale(t.name,{type:e,domain:void 0})})(t,n)),V(t.data).forEach(t=>gO(t,n)),a.forEach(t=>ZT(t,n)),(e||r).forEach(t=>(function(t,n){var e=n.getSignal(t.name),r=t.update;t.init&&(r?i("Signals can not include both init and update expressions."):(r=t.init,e.initonly=!0)),r&&(r=zB(r,n),e.update=r.$expr,e.params=r.$params),t.on&&t.on.forEach((function(t){yT(t,n,e.id)}))})(t,n)),V(t.axes).forEach(t=>bO(t,n)),V(t.marks).forEach(t=>cO(t,n)),V(t.legends).forEach(t=>fO(t,n)),t.title&&pO(t.title,n),n.parseLambdas(),n}var AO=At(["width","height","padding","autosize"]);function kO(t,n){var e,r,i,a,u,s,l=n.config;return n.background=t.background||l.background,n.eventConfig=l.events,u=qB(n.root=n.add(RB())),n.addSignal("width",t.width||0),n.addSignal("height",t.height||0),n.addSignal("padding",function(t,n){return o(t=t||n.padding)?{top:CB(t.top),bottom:CB(t.bottom),left:CB(t.left),right:CB(t.right)}:{top:e=CB(t),bottom:e,left:e,right:e};var e}(t.padding,l)),n.addSignal("autosize",function(t,n){return o(t=t||n.autosize)?t:{type:t||"pad"}}(t.autosize,l)),n.legends=n.objectProperty(l.legend&&l.legend.layout),s=function(t,n,e){if(V(n).forEach(n=>{AO[n.name]||TB(n,t)}),!e)return n;const r=V(n).slice();return V(e).forEach(n=>{t.hasOwnSignal(n.name)||(TB(n,t),r.push(n))}),r}(n,t.signals,l.signals),r=n.add(kT()),i=pN({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t.encode),i=n.add(DT(gN(i,AN,Vz,t.style,n,{pulse:qB(r)}))),a=n.add(VT({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:u,pulse:qB(i)})),n.operators.pop(),n.pushState(qB(i),qB(a),null),wO(t,n,s),n.operators.push(a),e=n.add(AT({mark:u,pulse:qB(a)})),e=n.add(IT({pulse:qB(e)})),e=n.add(WT({pulse:qB(e)})),n.addData("root",new iO(n,r,r,e)),n}function MO(t){this.config=t,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function EO(t){this.config=t.config,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}var DO=MO.prototype=EO.prototype;function CO(t){return(u(t)?FO:SO)(t)}function FO(t){for(var n,e="[",r=0,i=t.length;r<i;++r)e+=(r>0?",":"")+(o(n=t[r])?n.signal||CO(n):l(n));return e+"]"}function SO(t){var n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+l(n)+":"+(o(e)?e.signal||CO(e):l(e));return r+"}"}DO.fork=function(){return new EO(this)},DO.isSubscope=function(){return this._subid>0},DO.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},DO.id=function(){return(this._subid?this._subid+":":0)+this._id++},DO.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((function(n){n.$ref=t.id})),t.refs=null),t},DO.proxy=function(t){var n=t instanceof NB?qB(t):t;return this.add(PT({value:n}))},DO.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},DO.addUpdate=function(t){return this.updates.push(t),t},DO.finish=function(){var t,n;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 e(t,n,e){var r;t&&((r=t.data||(t.data={}))[n]||(r[n]=[])).push(e)}for(t in this.data)for(var r in e((n=this.data[t]).input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values"),n.index)e(n.index[r],t,"index:"+r);return this},DO.pushState=function(t,n,e){this._encode.push(qB(this.add(WT({pulse:t})))),this._parent.push(n),this._lookup.push(e?qB(this.proxy(e)):null),this._markpath.push(-1)},DO.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},DO.parent=function(){return C(this._parent)},DO.encode=function(){return C(this._encode)},DO.lookup=function(){return C(this._lookup)},DO.markpath=function(){var t=this._markpath;return++t[t.length-1]},DO.fieldRef=function(t,n){if(s(t))return LB(t,n);t.signal||i("Unsupported field reference: "+l(t));var e,r=t.signal,a=this.field[r];return a||(e={name:this.signalRef(r)},n&&(e.as=n),this.field[r]=a=qB(this.add(ST(e)))),a},DO.compareRef=function(t){function n(t){return WB(t)?(r=!0,e.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(r=!0,e.exprRef(t.expr)):t}var e=this,r=!1,i=V(t.field).map(n),a=V(t.order).map(n);return r?qB(this.add(MT({fields:i,orders:a}))):$B(i,a)},DO.keyRef=function(t,n){var e=this.signals,r=!1;return t=V(t).map((function(t){return WB(t)?(r=!0,qB(e[t.signal])):t})),r?qB(this.add(BT({fields:t,flat:n}))):function(t,n){var e={$key:t};return n&&(e.$flat=!0),e}(t,n)},DO.sortRef=function(t){if(!t)return t;var n=jB(t.op,t.field),e=t.order||"ascending";return e.signal?qB(this.add(MT({fields:n,orders:this.signalRef(e.signal)}))):$B(n,e)},DO.event=function(t,n){var e=t+":"+n;if(!this.events[e]){var r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},DO.hasOwnSignal=function(t){return rt(this.signals,t)},DO.addSignal=function(t,n){this.hasOwnSignal(t)&&i("Duplicate signal name: "+l(t));var e=n instanceof NB?n:this.add(RB(n));return this.signals[t]=e},DO.getSignal=function(t){return this.signals[t]||i("Unrecognized signal name: "+l(t)),this.signals[t]},DO.signalRef=function(t){return this.signals[t]?qB(this.signals[t]):(rt(this.lambdas,t)||(this.lambdas[t]=this.add(RB(null))),qB(this.lambdas[t]))},DO.parseLambdas=function(){for(var t=Object.keys(this.lambdas),n=0,e=t.length;n<e;++n){var r=t[n],i=zB(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},DO.property=function(t){return t&&t.signal?this.signalRef(t.signal):t},DO.objectProperty=function(t){return t&&o(t)?this.signalRef(t.signal||CO(t)):t},DO.exprRef=function(t,n){var e={expr:zB(t,this)};return n&&(e.expr.$name=n),qB(this.add(CT(e)))},DO.addBinding=function(t,n){this.bindings||i("Nested signals do not support binding: "+l(t)),this.bindings.push(K({signal:t},n))},DO.addScaleProj=function(t,n){rt(this.scales,t)&&i("Duplicate scale or projection name: "+l(t)),this.scales[t]=this.add(n)},DO.addScale=function(t,n){this.addScaleProj(t,HT(n))},DO.addProjection=function(t,n){this.addScaleProj(t,$T(n))},DO.getScale=function(t){return this.scales[t]||i("Unrecognized scale name: "+l(t)),this.scales[t]},DO.projectionRef=DO.scaleRef=function(t){return qB(this.getScale(t))},DO.projectionType=DO.scaleType=function(t){return this.getScale(t).params.type},DO.addData=function(t,n){return rt(this.data,t)&&i("Duplicate data set name: "+l(t)),this.data[t]=n},DO.getData=function(t){return this.data[t]||i("Undefined data set name: "+l(t)),this.data[t]},DO.addDataPipeline=function(t,n){return rt(this.data,t)&&i("Duplicate data set name: "+l(t)),this.addData(t,iO.fromEntries(this,n))};var BO="sans-serif",TO=30,zO=2,NO="#4c78a8",OO="#000",RO="#888",qO="#ddd";K(ti,Ho,Ap,f_,ck,cM,CE,zE,aD,xD,SD),t.Bounds=Cs,t.CanvasHandler=Hh,t.CanvasRenderer=Xh,t.Dataflow=Xr,t.Debug=A,t.Error=x,t.EventStream=Xt,t.Gradient=Os,t.GroupItem=qs,t.Handler=Lh,t.Info=w,t.Item=Rs,t.Marks=wh,t.MultiPulse=Ir,t.None=_,t.Operator=Wt,t.Parameters=Pt,t.Pulse=Lr,t.RenderType=Fd,t.Renderer=Ph,t.ResourceLoader=$s,t.SVGHandler=td,t.SVGRenderer=ld,t.SVGStringRenderer=wd,t.Scenegraph=Fh,t.Transform=Qr,t.View=wB,t.Warn=b,t.accessor=n,t.accessorFields=r,t.accessorName=e,t.array=V,t.bandwidthNRD=zi,t.bin=Ni,t.bootstrapCI=Oi,t.boundClip=qd,t.boundContext=Vc,t.boundItem=Ah,t.boundMark=Mh,t.boundStroke=jc,t.changeset=Ut,t.clampRange=G,t.closeTag=id,t.compare=J,t.constant=Z,t.cumulativeLogNormal=Gi,t.cumulativeNormal=ji,t.cumulativeUniform=ta,t.debounce=Q,t.definition=ni,t.densityLogNormal=Vi,t.densityNormal=Pi,t.densityUniform=Ki,t.domChild=Nh,t.domClear=Oh,t.domCreate=Th,t.domFind=zh,t.dotbin=Ri,t.error=i,t.expressionFunction=GS,t.extend=K,t.extent=tt,t.extentIndex=nt,t.falsy=v,t.fastmap=at,t.field=c,t.flush=ut,t.font=mh,t.fontFamily=gh,t.fontSize=lh,t.format=qn,t.formatLocale=_v,t.formats=Ln,t.hasOwnProperty=rt,t.id=h,t.identity=d,t.inferType=hn,t.inferTypes=dn,t.ingest=zt,t.inherits=ot,t.inrange=st,t.interpolate=_y,t.interpolateColors=my,t.interpolateRange=gy,t.intersect=Td,t.intersectBoxLine=lf,t.intersectPath=af,t.intersectPoint=uf,t.intersectRule=sf,t.isArray=u,t.isBoolean=lt,t.isDate=ct,t.isFunction=X,t.isNumber=ft,t.isObject=o,t.isRegExp=ht,t.isString=s,t.isTuple=St,t.key=dt,t.lerp=pt,t.lineHeight=fh,t.loader=Tr,t.logger=k,t.merge=gt,t.mergeConfig=M,t.multiLineOffset=dh,t.one=g,t.openTag=rd,t.pad=vt,t.panLinear=R,t.panLog=q,t.panPow=L,t.panSymlog=U,t.parse=function(t,n){return o(t)||i("Input Vega specification must be an object."),kO(t,new MO(n=M({padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:NO},area:{fill:NO},image:null,line:{stroke:NO,strokeWidth:zO},path:{stroke:NO},rect:{fill:NO},rule:{stroke:OO},shape:{stroke:NO},symbol:{fill:NO,size:64},text:{fill:OO,font:BO,fontSize:11},style:{"guide-label":{fill:OO,font:BO,fontSize:10},"guide-title":{fill:OO,font:BO,fontSize:11,fontWeight:"bold"},"group-title":{fill:OO,font:BO,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:OO,font:BO,fontSize:12},point:{size:TO,strokeWidth:zO,shape:"circle"},circle:{size:TO,strokeWidth:zO},square:{size:TO,strokeWidth:zO,shape:"square"},cell:{fill:"transparent",stroke:qO}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:RO,grid:!1,gridWidth:1,gridColor:qO,labels:!0,labelAngle:0,labelLimit:180,labelPadding:2,ticks:!0,tickColor:RO,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:qO,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:RO,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}},n,t.config))).toRuntime()},t.pathCurves=tc,t.pathEqual=$d,t.pathParse=rc,t.pathRectangle=Dc,t.pathRender=gc,t.pathSymbols=yc,t.pathTrail=Cc,t.peek=C,t.point=qh,t.projection=QA,t.quantileLogNormal=Xi,t.quantileNormal=Ii,t.quantileUniform=na,t.quantiles=Bi,t.quantizeInterpolator=vy,t.quarter=W,t.quartiles=Ti,t.randomInteger=function(n,e){null==e&&(e=n,n=0);var r,i,a,u={};return u.min=function(t){return arguments.length?(a=i-(r=t||0),u):r},u.max=function(t){return arguments.length?(a=(i=t||0)-r,u):i},u.sample=function(){return r+Math.floor(a*t.random())},u.pdf=function(t){return t===Math.floor(t)&&t>=r&&t<i?1/a:0},u.cdf=function(t){var n=Math.floor(t);return n<r?0:n>=i?1:(n-r+1)/a},u.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},u.min(n).max(e)},t.randomKDE=Wi,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=Ji,t.randomMixture=Zi,t.randomNormal=Hi,t.randomUniform=ea,t.read=Br,t.regressionExp=la,t.regressionLinear=oa,t.regressionLoess=ma,t.regressionLog=sa,t.regressionPoly=ha,t.regressionPow=ca,t.regressionQuad=fa,t.renderModule=Bd,t.repeat=mt,t.resetSVGClipId=function(){Nf=1},t.responseType=Un,t.runtime=uB,t.runtimeContext=sB,t.sampleCurve=xa,t.sampleLogNormal=Yi,t.sampleNormal=$i,t.sampleUniform=Qi,t.scale=ay,t.sceneEqual=Ud,t.sceneFromJSON=Ch,t.scenePickVisit=yf,t.sceneToJSON=Dh,t.sceneVisit=vf,t.sceneZOrder=mf,t.scheme=Ay,t.setRandom=function(n){t.random=n},t.span=yt,t.splitAccessPath=a,t.stringValue=l,t.textMetrics=ih,t.timeBin=Fo,t.timeFloor=Qu,t.timeFormat=vo,t.timeFormatLocale=Sr,t.timeInterval=uo,t.timeOffset=lo,t.timeSequence=ho,t.timeUnitSpecifier=mo,t.timeUnits=Iu,t.toBoolean=_t,t.toDate=bt,t.toNumber=F,t.toSet=At,t.toString=wt,t.transform=ei,t.transforms=ti,t.truncate=kt,t.truthy=m,t.tupleid=Bt,t.typeParsers=ln,t.utcFloor=ro,t.utcFormat=yo,t.utcInterval=oo,t.utcOffset=co,t.utcSequence=po,t.utcquarter=Y,t.version="5.9.0",t.visitArray=Mt,t.writeConfig=E,t.zero=p,t.zoomLinear=P,t.zoomLog=j,t.zoomPow=I,t.zoomSymlog=H,Object.defineProperty(t,"__esModule",{value:!0})}));</script>
<script>!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).vegaLite={})}(this,(function(e){"use strict";var t="4.0.2";function n(e,t,n){return e.fields=t||[],e.fname=n,e}function i(e){throw Error(e)}function r(e){var t,n,r,o=[],s=null,a=0,u=e.length,c="";function l(){o.push(c+e.substring(t,n)),c="",t=n+1}for(e+="",t=n=0;n<u;++n)if("\\"===(r=e[n]))c+=e.substring(t,n),t=++n;else if(r===s)l(),s=null,a=-1;else{if(s)continue;t===a&&'"'===r?(t=n+1,s=r):t===a&&"'"===r?(t=n+1,s=r):"."!==r||a?"["===r?(n>t&&l(),a=t=n+1):"]"===r&&(a||i("Access path missing open bracket: "+e),a>0&&l(),a=0,t=n+1):n>t?l():t=n+1}return a&&i("Access path missing closing bracket: "+e),s&&i("Access path missing closing quote: "+e),n>t&&(n++,l()),o}var o=Array.isArray;function s(e){return e===Object(e)}function a(e){return"string"==typeof e}function u(e){return o(e)?"["+e.map(u)+"]":s(e)||a(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var c=[],l=(function(e,t){var i=r(e),o="return _["+i.map(u).join("][")+"];";n(Function("_",o),[e=1===i.length?i[0]:e],t||e)}("id"),n((function(e){return e}),c,"identity"));n((function(){return 0}),c,"zero"),n((function(){return 1}),c,"one"),n((function(){return!0}),c,"true"),n((function(){return!1}),c,"false");function d(e,t,n){var i=[t].concat([].slice.call(n));console[e].apply(console,i)}var f=0,p=1,g=2,h=3,m=4;function b(...e){return e.reduce((e,t)=>{for(var n in t)if("signals"===n)e.signals=y(e.signals,t.signals);else{var i="legend"===n?{layout:1}:"style"===n||null;v(e,n,t[n],i)}return e},{})}function v(e,t,n,i){var r,a;if(s(n)&&!o(n))for(r in a=s(e[t])?e[t]:e[t]={},n)i&&(!0===i||i[r])?v(a,r,n[r]):a[r]=n[r];else e[t]=n}function y(e,t){if(null==e)return t;const n={},i=[];function r(e){n[e.name]||(n[e.name]=1,i.push(e))}return t.forEach(r),e.forEach(r),i}function x(e){return null!=e?o(e)?e:[e]:[]}const A=Object.prototype.hasOwnProperty;function O(e,t){return A.call(e,t)}function w(e){return"boolean"==typeof e}function F(e){return"number"==typeof e}function C(e){for(var t={},n=0,i=e.length;n<i;++n)t[e[n]]=!0;return t}Array.prototype.flat||Object.defineProperty(Array.prototype,"flat",{configurable:!0,value:function e(){var t=isNaN(arguments[0])?1:Number(arguments[0]);return t?Array.prototype.reduce.call(this,(function(n,i){return Array.isArray(i)?n.push.apply(n,e.call(i,t-1)):n.push(i),n}),[]):Array.prototype.slice.call(this)},writable:!0}),Array.prototype.flatMap||Object.defineProperty(Array.prototype,"flatMap",{configurable:!0,value:function(e){return Array.prototype.map.apply(this,arguments).flat()},writable:!0});var j=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=function(){function e(e,t){return null!=t&&e instanceof t}var t,n,i;try{t=Map}catch(e){t=function(){}}try{n=Set}catch(e){n=function(){}}try{i=Promise}catch(e){i=function(){}}function r(o,a,u,c,l){"object"==typeof a&&(u=a.depth,c=a.prototype,l=a.includeNonEnumerable,a=a.circular);var d=[],f=[],p="undefined"!=typeof Buffer;return void 0===a&&(a=!0),void 0===u&&(u=1/0),function o(u,g){if(null===u)return null;if(0===g)return u;var h,m;if("object"!=typeof u)return u;if(e(u,t))h=new t;else if(e(u,n))h=new n;else if(e(u,i))h=new i((function(e,t){u.then((function(t){e(o(t,g-1))}),(function(e){t(o(e,g-1))}))}));else if(r.__isArray(u))h=[];else if(r.__isRegExp(u))h=new RegExp(u.source,s(u)),u.lastIndex&&(h.lastIndex=u.lastIndex);else if(r.__isDate(u))h=new Date(u.getTime());else{if(p&&Buffer.isBuffer(u))return h=Buffer.allocUnsafe?Buffer.allocUnsafe(u.length):new Buffer(u.length),u.copy(h),h;e(u,Error)?h=Object.create(u):void 0===c?(m=Object.getPrototypeOf(u),h=Object.create(m)):(h=Object.create(c),m=c)}if(a){var b=d.indexOf(u);if(-1!=b)return f[b];d.push(u),f.push(h)}for(var v in e(u,t)&&u.forEach((function(e,t){var n=o(t,g-1),i=o(e,g-1);h.set(n,i)})),e(u,n)&&u.forEach((function(e){var t=o(e,g-1);h.add(t)})),u){var y;m&&(y=Object.getOwnPropertyDescriptor(m,v)),y&&null==y.set||(h[v]=o(u[v],g-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(u);for(v=0;v<x.length;v++){var A=x[v];(!(w=Object.getOwnPropertyDescriptor(u,A))||w.enumerable||l)&&(h[A]=o(u[A],g-1),w.enumerable||Object.defineProperty(h,A,{enumerable:!1}))}}if(l){var O=Object.getOwnPropertyNames(u);for(v=0;v<O.length;v++){var w,F=O[v];(w=Object.getOwnPropertyDescriptor(u,F))&&w.enumerable||(h[F]=o(u[F],g-1),Object.defineProperty(h,F,{enumerable:!1}))}}return h}(o,u)}function o(e){return Object.prototype.toString.call(e)}function s(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return r.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},r.__objToStr=o,r.__isDate=function(e){return"object"==typeof e&&"[object Date]"===o(e)},r.__isArray=function(e){return"object"==typeof e&&"[object Array]"===o(e)},r.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===o(e)},r.__getRegExpFlags=s,r}();e.exports&&(e.exports=t)})),D=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var n,i="boolean"==typeof t.cycles&&t.cycles,r=t.cmp&&(n=t.cmp,function(e){return function(t,i){var r={key:t,value:e[t]},o={key:i,value:e[i]};return n(r,o)}}),o=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var n,s;if(Array.isArray(t)){for(s="[",n=0;n<t.length;n++)n&&(s+=","),s+=e(t[n])||"null";return s+"]"}if(null===t)return"null";if(-1!==o.indexOf(t)){if(i)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var a=o.push(t)-1,u=Object.keys(t).sort(r&&r(t));for(s="",n=0;n<u.length;n++){var c=u[n],l=e(t[c]);l&&(s&&(s+=","),s+=JSON.stringify(c)+":"+l)}return o.splice(a,1),"{"+s+"}"}}(e)};function E(e){return!!e.or}function S(e){return!!e.and}function k(e){return!!e.not}function $(e,t){return k(e)?{not:$(e.not,t)}:S(e)?{and:e.and.map(e=>$(e,t))}:E(e)?{or:e.or.map(e=>$(e,t))}:t(e)}const B=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var i,r,o;if(Array.isArray(t)){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((i=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=i;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,o[r]))return!1;for(r=i;0!=r--;){var s=o[r];if(!e(t[s],n[s]))return!1}return!0}return t!=t&&n!=n},N=j;function _(e,t){const n={};for(const i of t)O(e,i)&&(n[i]=e[i]);return n}function z(e,t){const n=Object.assign({},e);for(const e of t)delete n[e];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>D(e)).join(",")})`};const T=D;function P(e){if(F(e))return e;const t=a(e)?e:D(e);if(t.length<250)return t;let n=0;for(let e=0;e<t.length;e++){n=(n<<5)-n+t.charCodeAt(e),n&=n}return n}function M(e){return!1===e||null===e}function U(e,t){return e.indexOf(t)>-1}function R(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function L(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function W(e,t){for(const n of Object.keys(t))v(e,n,t[n],!0)}function q(e,t){const n=[],i={};let r;for(const o of e)r=t(o),r in i||(i[r]=1,n.push(o));return n}function I(e,t){for(const n of e)if(t.has(n))return!0;return!1}function H(e){const t=new Set;for(const n of e){const e=r(n).map((e,t)=>0===t?e:`[${e}]`);e.map((t,n)=>e.slice(0,n+1).join("")).forEach(e=>t.add(e))}return t}function G(e,t){return void 0===e||void 0===t||I(H(e),H(t))}const Y=Object.keys;function V(e){const t=[];for(const n in e)O(e,n)&&t.push(e[n]);return t}function J(e){return!0===e||!1===e}function Q(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function X(e,t){return k(e)?"!("+X(e.not,t)+")":S(e)?"("+e.and.map(e=>X(e,t)).join(") && (")+")":E(e)?"("+e.or.map(e=>X(e,t)).join(") || (")+")":t(e)}function Z(e,t){if(0===t.length)return!0;const n=t.shift();return Z(e[n],t)&&delete e[n],0===Y(e).length}function K(e){return e.charAt(0).toUpperCase()+e.substr(1)}function ee(e,t="datum"){const n=r(e),i=[];for(let e=1;e<=n.length;e++){const r=`[${n.slice(0,e).map(u).join("][")}]`;i.push(`${t}${r}`)}return i.join(" && ")}function te(e){return`${r(e).map(e=>ne(e,".","\\.")).join("\\.")}`}function ne(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function ie(e){return`${r(e).join(".")}`}function re(e){return e?r(e).length:0}function oe(...e){for(const t of e)if(void 0!==t)return t}let se=42;function ae(e){return(e%360+360)%360}const ue="area",ce="bar",le="image",de="line",fe="point",pe="rect",ge="rule",he="text",me="tick",be="trail",ve="circle",ye="square",xe="geoshape";function Ae(e){return U(["line","area","trail"],e)}function Oe(e){return U(["rect","bar","image"],e)}const we=Y({area:1,bar:1,image:1,line:1,point:1,text:1,tick:1,trail:1,rect:1,geoshape:1,rule:1,circle:1,square:1});function Fe(e){return e.type}C(we);const Ce=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],je=["filled","color","tooltip","invalid","timeUnitBandPosition","timeUnitBand"],De={binSpacing:1,continuousBandSize:5,timeUnitBandPosition:.5},Ee={binSpacing:0,continuousBandSize:5,timeUnitBandPosition:.5};function Se(e){return!!e.mark}class ke{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!Se(e)&&(Fe(t=e.mark)?t.type:t)===this.name;var t}}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function $e(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}const Be={argmax:1,argmin:1,average:1,count:1,distinct:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},Ne={count:1,min:1,max:1};function _e(e){return!!e&&!!e.argmin}function ze(e){return!!e&&!!e.argmax}function Te(e){return a(e)&&!!Be[e]}const Pe=["count","valid","missing","distinct"];function Me(e){return a(e)&&U(Pe,e)}const Ue=["count","sum","distinct","valid","missing"],Re=C(["mean","average","median","q1","q3","min","max"]),Le="row",We="column",qe="facet",Ie="x",He="y",Ge="x2",Ye="y2",Ve="latitude",Je="longitude",Qe="latitude2",Xe="longitude2",Ze="color",Ke="fill",et="stroke",tt="shape",nt="size",it="opacity",rt="fillOpacity",ot="strokeOpacity",st="strokeWidth",at="text",ut="order",ct="detail",lt="key",dt="tooltip",ft="href",pt="url";const gt={longitude:1,longitude2:1,latitude:1,latitude2:1};const ht=Y(gt),mt=Object.assign(Object.assign(Object.assign({},{x:1,y:1,x2:1,y2:1}),gt),{color:1,fill:1,stroke:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,size:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1});function bt(e){return"color"===e||"fill"===e||"stroke"===e}const vt={row:1,column:1,facet:1},yt=Y(vt),xt=Object.assign(Object.assign({},mt),vt),At=Y(xt),Ot=$e(xt,["order","detail","tooltip"]),wt=$e(Ot,["row","column","facet"]);function Ft(e){return!!wt[e]}function Ct(e){return!!xt[e]}const jt=["x2","y2","latitude2","longitude2"];function Dt(e){return Et(e)!==e}function Et(e){switch(e){case"x2":return"x";case"y2":return"y";case"latitude2":return"latitude";case"longitude2":return"longitude"}return e}function St(e){switch(e){case"x":return"x2";case"y":return"y2";case"latitude":return"latitude2";case"longitude":return"longitude2"}}const kt=$e(mt,["x","y","x2","y2","latitude","longitude","latitude2","longitude2"]),$t=Y(kt),Bt={x:1,y:1},Nt=Y(Bt);function _t(e){return"x"===e?"width":"height"}function zt(e){return"width"===e?"x":"y"}const Tt=$e(kt,["text","tooltip","href","url","detail","key","order"]),Pt=Y(Tt);const Mt=Object.assign(Object.assign({},Bt),Tt),Ut=Y(Mt);function Rt(e){return!!Mt[e]}function Lt(e,t){return function(e){switch(e){case Ze:case Ke:case et:case ct:case lt:case dt:case ft:case ut:case it:case rt:case ot:case st:case qe:case Le:case We:return Wt;case Ie:case He:case Ve:case Je:return qt;case Ge:case Ye:case Qe:case Xe:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case nt:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case tt:return{point:"always",geoshape:"always"};case at:return{text:"always"};case pt:return{image:"always"}}}(e)[t]}const Wt={area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},qt=$e(Wt,["geoshape"]);function It(e){switch(e){case Ie:case He:case nt:case st:case it:case rt:case ot:case Ge:case Ye:return;case qe:case Le:case We:case tt:case at:case dt:case ft:case pt:return"discrete";case Ze:case Ke:case et:return"flexible";case Ve:case Je:case Qe:case Xe:case ct:case lt:case ut:return}}const Ht=Object.freeze({__proto__:null,invalidSpec:function(e){return`Invalid specification ${JSON.stringify(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`},FIT_NON_SINGLE:'Autosize "fit" only works for single views and layered views.',containerSizeNonSingle:function(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`},containerSizeNotCompatibleWithAutosize:function(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-x".`},droppingFit:function(e){return e?`Dropping "fit-${e}" because spec has discrete ${_t(e)}.`:'Dropping "fit" because spec has discrete size.'},cannotProjectOnChannelWithoutField:function(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`},cannotProjectAggregate:function(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`},nearestNotSupportForContinuous:function(e){return`The "nearest" transform is not supported for ${e} marks.`},selectionNotSupported:function(e){return`Selection not supported for ${e} yet.`},selectionNotFound:function(e){return`Cannot find a selection named "${e}".`},SCALE_BINDINGS_CONTINUOUS:"Scale bindings are currently only supported for scales with unbinned, continuous domains.",LEGEND_BINDINGS_PROJECT_LENGTH:"Legend bindings are only supported for selections over an individual field or encoding channel.",noSameUnitLookup:function(e){return`Cannot define and lookup the "${e}" selection in the same view. `+"Try moving the lookup into a second, layered view?"},noSuchRepeatedValue:function(e){return`Unknown repeated value "${e}".`},columnsNotSupportByRowCol:function(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`},CONCAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in concatenated views yet (https://github.com/vega/vega-lite/issues/2415).",REPEAT_CANNOT_SHARE_AXIS:"Axes cannot be shared in repeated views yet (https://github.com/vega/vega-lite/issues/2415).",unrecognizedParse:function(e){return`Unrecognized parse "${e}".`},differentParse:function(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`},invalidTransformIgnored:function(e){return`Ignoring an invalid transform: ${T(e)}.`},NO_FIELDS_NEEDS_AS:'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.',encodingOverridden:function(e){return`Layer's shared ${e.join(",")} channel ${1===e.length?"is":"are"} overriden.`},projectionOverridden:function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${T(t)} is overridden by a child projection ${T(n)}.`},primitiveChannelDef:function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${T(n)}}.`},invalidFieldType:function(e){return`Invalid field type "${e}".`},nonZeroScaleUsedWithLengthMark:function(e,t,n){return`A ${n.scaleType?`${n.scaleType} scale`:n.zeroFalse?"scale with zero=false":"scale with custom domain that excludes zero"} is used to encode ${e}'s ${t}. This can be misleading as the ${"x"===t?"width":"height"} of the ${e} can be arbitrary based on the scale domain. You may want to use point mark instead.`},invalidFieldTypeForCountAggregate:function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`},invalidAggregate:function(e){return`Invalid aggregation operator "${e}".`},missingFieldType:function(e,t){return`Missing type for channel "${e}", using "${t}" instead.`},droppingColor:function(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`},emptyFieldDef:function(e,t){return`Dropping ${T(e)} from channel "${t}" since it does not contain data field or value.`},latLongDeprecated:function(e,t,n){return`${e}-encoding with type ${t} is deprecated. Replacing with ${n}-encoding.`},LINE_WITH_VARYING_SIZE:"Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.",incompatibleChannel:function(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`},invalidEncodingChannel:function(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`},facetChannelShouldBeDiscrete:function(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`},facetChannelDropped:function(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`},discreteChannelCannotEncode:function(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`},lineWithRange:function(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`},orientOverridden:function(e,t){return`Specified orient "${e}" overridden with "${t}".`},CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN:"Custom domain scale cannot be unioned with default field-based domain.",RANGE_STEP_DEPRECATED:'Scale\'s "rangeStep" is deprecated and will be removed in Vega-Lite 5.0. Please use "width"/"height": {"step": ...} instead. See https://vega.github.io/vega-lite/docs/size.html.',cannotUseScalePropertyWithNonColor:function(e){return`Cannot use the scale property "${e}" with non-color channel.`},unaggregateDomainHasNoEffectForRawField:function(e){return`Using unaggregated domain with raw field has no effect (${T(e)}).`},unaggregateDomainWithNonSharedDomainOp:function(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`},unaggregatedDomainWithLogScale:function(e){return`Unaggregated domain is currently unsupported for log scale (${T(e)}).`},cannotApplySizeToNonOrientedMark:function(e){return`Cannot apply size to non-oriented mark "${e}".`},scaleTypeNotWorkWithChannel:function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`},scaleTypeNotWorkWithFieldDef:function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`},scalePropertyNotWorkWithScaleType:function(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`},scaleTypeNotWorkWithMark:function(e,t){return`Scale type "${t}" does not work with mark "${e}".`},stepDropped:function(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`},mergeConflictingProperty:function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${T(n)} and ${T(i)}). Using ${T(n)}.`},mergeConflictingDomainProperty:function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${T(n)} and ${T(i)}). Using the union of the two domains.`},independentScaleMeansIndependentGuide:function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`},domainSortDropped:function(e){return`Dropping sort property ${T(e)} as unioned domains only support boolean or op "count", "min", and "max".`},UNABLE_TO_MERGE_DOMAINS:"Unable to merge domains.",MORE_THAN_ONE_SORT:"Domains that should be unioned has conflicting sort properties. Sort will be set to true.",INVALID_CHANNEL_FOR_AXIS:"Invalid channel for axis.",cannotStackRangedMark:function(e){return`Cannot stack "${e}" if there is already "${e}2".`},cannotStackNonLinearScale:function(e){return`Cannot stack non-linear scale (${e}).`},stackNonSummativeAggregate:function(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`},invalidTimeUnit:function(e,t){return`Invalid ${e}: ${T(t)}.`},dayReplacedWithDate:function(e){return`Time unit "${e}" is not supported. We are replacing it with ${ne(e,"day","date")}.`},droppedDay:function(e){return`Dropping day from datetime ${T(e)} as day cannot be combined with other units.`},errorBarCenterAndExtentAreNotNeeded:function(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`},errorBarCenterIsUsedWithWrongExtent:function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`},errorBarContinuousAxisHasCustomizedAggregate:function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`},errorBarCenterIsNotNeeded:function(e,t){return`Center is not needed to be specified in ${t} when extent is ${e}.`},errorBand1DNotSupport:function(e){return`1D error band does not support ${e}.`},channelRequiredForBinned:function(e){return`Channel ${e} is required for "binned" bin.`},domainRequiredForThresholdScale:function(e){return`Domain for ${e} is required for threshold scale.`}}),Gt=(Vt=g||f,{level:function(e){return arguments.length?(Vt=+e,this):Vt},error:function(){return Vt>=p&&d(Yt||"error","ERROR",arguments),this},warn:function(){return Vt>=g&&d(Yt||"warn","WARN",arguments),this},info:function(){return Vt>=h&&d(Yt||"log","INFO",arguments),this},debug:function(){return Vt>=m&&d(Yt||"log","DEBUG",arguments),this}});var Yt,Vt;let Jt=Gt;function Qt(...e){Jt.warn(...e)}const Xt=2006;function Zt(e){return!!(e&&(e.year||e.quarter||e.month||e.date||e.day||e.hours||e.minutes||e.seconds||e.milliseconds))}const Kt=["january","february","march","april","may","june","july","august","september","october","november","december"],en=Kt.map(e=>e.substr(0,3)),tn=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],nn=tn.map(e=>e.substr(0,3));function rn(e,t=!1,n=!1){const i=[];if(t&&void 0!==e.day&&Y(e).length>1&&(Qt(Ht.droppedDay(e)),delete(e=N(e)).day),void 0!==e.year?i.push(e.year):void 0!==e.day?i.push(Xt):i.push(0),void 0!==e.month){const n=t?function(e){if(F(e))return(e-1).toString();{const t=e.toLowerCase(),n=Kt.indexOf(t);if(-1!==n)return n+"";const i=t.substr(0,3),r=en.indexOf(i);if(-1!==r)return r+"";throw new Error(Ht.invalidTimeUnit("month",e))}}(e.month):e.month;i.push(n)}else if(void 0!==e.quarter){const n=t?function(e){if(F(e))return e>4&&Qt(Ht.invalidTimeUnit("quarter",e)),(e-1).toString();throw new Error(Ht.invalidTimeUnit("quarter",e))}(e.quarter):e.quarter;i.push(n+"*3")}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const n=t?function(e){if(F(e))return e%7+"";{const t=e.toLowerCase(),n=tn.indexOf(t);if(-1!==n)return n+"";const i=t.substr(0,3),r=nn.indexOf(i);if(-1!==r)return r+"";throw new Error(Ht.invalidTimeUnit("day",e))}}(e.day):e.day;i.push(n+"+1")}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}const r=i.join(", ");return n?e.utc?new Function(`return +new Date(Date.UTC(${r}))`)():new Function(`return +new Date(${r})`)():e.utc?`utc(${r})`:`datetime(${r})`}var on;!function(e){e.YEAR="year",e.MONTH="month",e.DAY="day",e.DATE="date",e.HOURS="hours",e.MINUTES="minutes",e.SECONDS="seconds",e.MILLISECONDS="milliseconds",e.YEARMONTH="yearmonth",e.YEARMONTHDATE="yearmonthdate",e.YEARMONTHDATEHOURS="yearmonthdatehours",e.YEARMONTHDATEHOURSMINUTES="yearmonthdatehoursminutes",e.YEARMONTHDATEHOURSMINUTESSECONDS="yearmonthdatehoursminutesseconds",e.MONTHDATE="monthdate",e.MONTHDATEHOURS="monthdatehours",e.HOURSMINUTES="hoursminutes",e.HOURSMINUTESSECONDS="hoursminutesseconds",e.MINUTESSECONDS="minutesseconds",e.SECONDSMILLISECONDS="secondsmilliseconds",e.QUARTER="quarter",e.YEARQUARTER="yearquarter",e.QUARTERMONTH="quartermonth",e.YEARQUARTERMONTH="yearquartermonth",e.UTCYEAR="utcyear",e.UTCMONTH="utcmonth",e.UTCDAY="utcday",e.UTCDATE="utcdate",e.UTCHOURS="utchours",e.UTCMINUTES="utcminutes",e.UTCSECONDS="utcseconds",e.UTCMILLISECONDS="utcmilliseconds",e.UTCYEARMONTH="utcyearmonth",e.UTCYEARMONTHDATE="utcyearmonthdate",e.UTCYEARMONTHDATEHOURS="utcyearmonthdatehours",e.UTCYEARMONTHDATEHOURSMINUTES="utcyearmonthdatehoursminutes",e.UTCYEARMONTHDATEHOURSMINUTESSECONDS="utcyearmonthdatehoursminutesseconds",e.UTCMONTHDATE="utcmonthdate",e.UTCMONTHDATEHOURS="utcmonthdatehours",e.UTCHOURSMINUTES="utchoursminutes",e.UTCHOURSMINUTESSECONDS="utchoursminutesseconds",e.UTCMINUTESSECONDS="utcminutesseconds",e.UTCSECONDSMILLISECONDS="utcsecondsmilliseconds",e.UTCQUARTER="utcquarter",e.UTCYEARQUARTER="utcyearquarter",e.UTCQUARTERMONTH="utcquartermonth",e.UTCYEARQUARTERMONTH="utcyearquartermonth"}(on||(on={}));const sn={year:1,quarter:1,month:1,day:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},an=Y(sn);const un={utcyear:1,utcquarter:1,utcmonth:1,utcday:1,utcdate:1,utchours:1,utcminutes:1,utcseconds:1,utcmilliseconds:1};const cn={utcyearquarter:1,utcyearquartermonth:1,utcyearmonth:1,utcyearmonthdate:1,utcyearmonthdatehours:1,utcyearmonthdatehoursminutes:1,utcyearmonthdatehoursminutesseconds:1,utcquartermonth:1,utcmonthdate:1,utcmonthdatehours:1,utchoursminutes:1,utchoursminutesseconds:1,utcminutesseconds:1,utcsecondsmilliseconds:1},ln=Object.assign(Object.assign({},un),cn);Object.assign(Object.assign(Object.assign(Object.assign({},sn),un),{yearquarter:1,yearquartermonth:1,yearmonth:1,yearmonthdate:1,yearmonthdatehours:1,yearmonthdatehoursminutes:1,yearmonthdatehoursminutesseconds:1,quartermonth:1,monthdate:1,monthdatehours:1,hoursminutes:1,hoursminutesseconds:1,minutesseconds:1,secondsmilliseconds:1}),cn);const dn={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function fn(e){return an.reduce((t,n)=>pn(e,n)?[...t,n]:t,[])}function pn(e,t){const n=e.indexOf(t);return n>-1&&(t!==on.SECONDS||0===n||"i"!==e.charAt(n-1))}function gn(e,t,{end:n}={end:!1}){const i=ee(t),r=ln[e]?"utc":"";let o;const s=an.reduce((t,n)=>(pn(e,n)&&(t[n]=function(e){return e===on.QUARTER?`(${r}quarter(${i})-1)`:`${r}${e}(${i})`}(n),o=n),t),{});return n&&(s[o]+="+1"),rn(s)}function hn(e,t,n){if(!e)return;const i=function(e){if(!e)return;const t=fn(e);return`timeUnitSpecifier(${D(t)}, ${D(dn)})`}(e);return n?`utcFormat(${t}, ${i})`:`timeFormat(${t}, ${i})`}function mn(e){return"day"!==e&&e.indexOf("day")>=0?(Qt(Ht.dayReplacedWithDate(e)),ne(e,"day","date")):e}function bn(e){return e&&!!e.field&&void 0!==e.equal}function vn(e){return e&&!!e.field&&void 0!==e.lt}function yn(e){return e&&!!e.field&&void 0!==e.lte}function xn(e){return e&&!!e.field&&void 0!==e.gt}function An(e){return e&&!!e.field&&void 0!==e.gte}function On(e){return!!(e&&e.field&&o(e.range)&&2===e.range.length)}function wn(e){return e&&!!e.field&&(o(e.oneOf)||o(e.in))}function Fn(e){return wn(e)||bn(e)||On(e)||vn(e)||xn(e)||yn(e)||An(e)}function Cn(e,t){return or(e,{timeUnit:t,time:!0})}function jn(e,t=!0){const{field:n,timeUnit:i}=e,r=i?"time("+gn(i,n)+")":Wi(e,{expr:"datum"});if(bn(e))return r+"==="+Cn(e.equal,i);if(vn(e)){return`${r}<${Cn(e.lt,i)}`}if(xn(e)){return`${r}>${Cn(e.gt,i)}`}if(yn(e)){return`${r}<=${Cn(e.lte,i)}`}if(An(e)){return`${r}>=${Cn(e.gte,i)}`}if(wn(e))return`indexof([${function(e,t){return e.map(e=>Cn(e,t))}(e.oneOf,i).join(",")}], ${r}) !== -1`;if(function(e){return e&&!!e.field&&void 0!==e.valid}(e))return Dn(r,e.valid);if(On(e)){const n=e.range[0],o=e.range[1];if(null!==n&&null!==o&&t)return"inrange("+r+", ["+Cn(n,i)+", "+Cn(o,i)+"])";const s=[];return null!==n&&s.push(`${r} >= ${Cn(n,i)}`),null!==o&&s.push(`${r} <= ${Cn(o,i)}`),s.length>0?s.join(" && "):"true"}throw new Error(`Invalid field predicate: ${JSON.stringify(e)}`)}function Dn(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function En(e){return Fn(e)&&e.timeUnit?Object.assign(Object.assign({},e),{timeUnit:mn(e.timeUnit)}):e}const Sn={quantitative:1,ordinal:1,temporal:1,nominal:1,geojson:1},kn="quantitative",$n="ordinal",Bn="temporal",Nn="nominal",_n="geojson";var zn;!function(e){e.LINEAR="linear",e.LOG="log",e.POW="pow",e.SQRT="sqrt",e.SYMLOG="symlog",e.TIME="time",e.UTC="utc",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.BIN_ORDINAL="bin-ordinal",e.ORDINAL="ordinal",e.POINT="point",e.BAND="band"}(zn||(zn={}));const Tn={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"},Pn=Y(Tn);function Mn(e,t){const n=Tn[e],i=Tn[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Un={linear:0,log:1,pow:1,sqrt:1,symlog:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function Rn(e){return Un[e]}const Ln=["linear","log","pow","sqrt","symlog","time","utc"],Wn=C(Ln),qn=C(["quantile","quantize","threshold"]),In=C(Ln.concat(["quantile","quantize","threshold"])),Hn=C(["ordinal","bin-ordinal","point","band"]);function Gn(e){return e in Hn}function Yn(e){return e in In}function Vn(e){return e in Wn}function Jn(e){return e in qn}function Qn(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}const Xn=$e({type:1,domain:1,align:1,range:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},["type","domain","range","scheme"]),Zn=Y(Xn);!function(){var e;const t={};for(const n of At)for(const i of Y(Sn))for(const r of Pn){const o=ii(n,i);ni(n,r)&&ti(r,i)&&(t[o]=null!=(e=t[o])?e:[],t[o].push(r))}}();function Kn(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!U(["point","band","identity"],e);case"bins":return!U(["point","band","identity","ordinal"],e);case"round":return Vn(e)||"band"===e||"point"===e;case"padding":return Vn(e)||U(["point","band"],e);case"paddingOuter":case"align":return U(["point","band"],e);case"paddingInner":return"band"===e;case"clamp":return Vn(e);case"nice":return Vn(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return Yn(e)&&!U(["log","time","utc","threshold","quantile"],e)}}function ei(e,t){switch(t){case"interpolate":case"scheme":return bt(e)?void 0:Ht.cannotUseScalePropertyWithNonColor(e);case"align":case"type":case"bins":case"domain":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"reverse":case"round":case"clamp":case"zero":return}}function ti(e,t){return U([$n,Nn],t)?void 0===e||Gn(e):t===Bn?U([zn.TIME,zn.UTC,void 0],e):t!==kn||U([zn.LOG,zn.POW,zn.SQRT,zn.SYMLOG,zn.QUANTILE,zn.QUANTIZE,zn.THRESHOLD,zn.LINEAR,void 0],e)}function ni(e,t){switch(e){case Ie:case He:return Vn(t)||U(["band","point"],t);case nt:case st:case it:case rt:case ot:return Vn(t)||Jn(t)||U(["band","point"],t);case Ze:case Ke:case et:return"band"!==t;case tt:return"ordinal"===t}return!1}function ii(e,t){return e+"_"+t}function ri(e){const{anchor:t,frame:n,offset:i,orient:r,color:o}=e,s=$e(e,["anchor","frame","offset","orient","color"]);return{mark:Object.assign(Object.assign({},s),o?{fill:o}:{}),nonMark:Object.assign(Object.assign(Object.assign(Object.assign({},t?{anchor:t}:{}),n?{frame:n}:{}),i?{offset:i}:{}),r?{orient:r}:{})}}function oi(e){return a(e)||o(e)&&a(e[0])}const si=" – ";function ai(e){var t;return[].concat(e.type,null!=(t=e.style)?t:[])}function ui(e,t,n){return oe(t[e],ci(e,t,n))}function ci(e,t,n,{vgChannel:i}={}){return oe(i?li(e,t,n.style):void 0,li(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function li(e,t,n){const i=ai(t);let r;for(const t of i){const i=n[t],o=e;i&&void 0!==i[o]&&(r=i[o])}return r}function di(e,t,n,i){if(rr(e)){const r=Ui(e)&&e.scale&&e.scale.type===zn.UTC;return{signal:mi(Wi(e,{expr:n}),e.timeUnit,t,i.timeFormat,r,!0)}}{const r=fi(e,t,i);if(cr(e.bin)){return{signal:hi(Wi(e,{expr:n}),Wi(e,{expr:n,binSuffix:"end"}),r,i)}}return"quantitative"===e.type||r?{signal:`${pi(Wi(e,{expr:n,binSuffix:"range"}),r)}`}:{signal:`''+${Wi(e,{expr:n})}`}}}function fi(e,t,n){return t||(e.type===kn?n.numberFormat:void 0)}function pi(e,t){return`format(${e}, "${t||""}")`}function gi(e,t,n){return pi(e,null!=t?t:n.numberFormat)}function hi(e,t,n,i){return`${Dn(e,!1)} ? "null" : ${gi(e,n,i)} + "${si}" + ${gi(t,n,i)}`}function mi(e,t,n,i,r,o=!1){return!t||n?(n=null!=n?n:i)||o?`${r?"utc":"time"}Format(${e}, '${n}')`:void 0:hn(t,e,r)}function bi(e,t){return x(e).reduce((e,n)=>{var i;return e.field.push(Wi(n,t)),e.order.push(null!=(i=n.sort)?i:"ascending"),e},{field:[],order:[]})}function vi(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if(B(t,e))return;n.push(e)}),n}function yi(e,t){return B(e,t)||!t?e:e?[...x(e),...x(t)].join(", "):t}function xi(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if(oi(n)&&oi(i))return{explicit:e.explicit,value:yi(n,i)};if(!oi(n)&&!oi(i))return{explicit:e.explicit,value:vi(n,i)};throw new Error("It should never reach here")}const Ai="mean",Oi={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function wi(e){return!!Oi[e]}function Fi(e){return!!e&&!!e.encoding}function Ci(e){return!(!e||"count"!==e.op&&!e.field)}function ji(e){return!!e&&o(e)}function Di(e){return!!e.row||!!e.column}function Ei(e){return void 0!==e.facet}function Si(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return Object.assign(Object.assign(Object.assign(Object.assign({},n?{timeUnit:n}:{}),i?{bin:i}:{}),r?{aggregate:r}:{}),{field:t})}function ki(e){return Ti(e)&&!!e.sort}function $i(e,t,n,i,r,{isMidPoint:o}={}){const{timeUnit:s,bin:a}=t;if(U(["x","y"],e)){if(Ri(t)&&void 0!==t.band)return t.band;if(s&&!n)return o?ci("timeUnitBandPosition",i,r):Oe(i.type)?ci("timeUnitBand",i,r):0;if(cr(a))return Oe(i.type)&&!o?1:.5}}function Bi(e,t,n,i,r){return!!(cr(t.bin)||t.timeUnit&&Ti(t)&&"temporal"===t.type)&&!!$i(e,t,n,i,r)}function Ni(e){return!!e&&!!e.condition}function _i(e){return!!e&&!!e.condition&&!o(e.condition)&&zi(e.condition)}function zi(e){return!(!e||!e.field&&"count"!==e.aggregate)}function Ti(e){return!!e&&(!!e.field&&!!e.type||"count"===e.aggregate)}function Pi(e){return zi(e)&&a(e.field)}function Mi(e){return e&&"value"in e&&void 0!==e.value}function Ui(e){return!(!e||!e.scale&&!e.sort)}function Ri(e){return!(!e||!e.axis&&!e.stack&&!e.impute&&void 0===e.band)}function Li(e){return!!e&&!!e.format}function Wi(e,t={}){var n,i,o;let s=e.field;const a=t.prefix;let c=t.suffix,l="";if(function(e){return"count"===e.aggregate}(e))s=function(e){return function(e){return 0===e.indexOf("__")}(e)?e:`__${e}`}("count");else{let r;if(!t.nofn)if(function(e){return!!e.op}(e))r=e.op;else{const{bin:a,aggregate:u,timeUnit:d}=e;cr(a)?(r=ur(a),c=(null!=(n=t.binSuffix)?n:"")+(null!=(i=t.suffix)?i:"")):u?ze(u)?(l=`.${s}`,s=`argmax_${u.argmax}`):_e(u)?(l=`.${s}`,s=`argmin_${u.argmin}`):r=String(u):d&&(r=String(d),c=(!U(["range","mid"],t.binSuffix)&&t.binSuffix||"")+(null!=(o=t.suffix)?o:""))}r&&(s=s?`${r}_${s}`:r)}return c&&(s=`${s}_${c}`),a&&(s=`${a}_${s}`),t.forAs?s:t.expr?function(e,t="datum"){return`${t}[${u(r(e).join("."))}]`}(s,t.expr)+l:te(s)+l}function qi(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return!!e.bin;case"temporal":return!1}throw new Error(Ht.invalidFieldType(e.type))}function Ii(e){return!qi(e)}const Hi=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(ze(t))return`${r} for argmax(${t.argmax})`;if(_e(t))return`${r} for argmin(${t.argmin})`;const o=t||i||cr(n)&&"bin";return o?o.toUpperCase()+"("+r+")":r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(cr(i))return`${n} (binned)`;if(r){return`${n} (${fn(r).join("-")})`}return o?ze(o)?`${n} for max ${o.argmax}`:_e(o)?`${n} for min ${o.argmin}`:`${K(o)} of ${n}`:n}(e,t)}};let Gi=Hi;function Yi(e){Gi=e}function Vi(e,t,{allowDisabling:n,includeDefault:i=!0}){var r,o;const s=(null!=(r=Ji(e))?r:{}).title,a=i?Qi(e,t):void 0;return n?oe(s,e.title,a):null!=(o=null!=s?s:e.title)?o:a}function Ji(e){return Ri(e)&&e.axis?e.axis:(t=e)&&t.legend&&e.legend?e.legend:function(e){return!!e&&!!e.header}(e)&&e.header?e.header:void 0;var t}function Qi(e,t){return Gi(e,t)}function Xi(e){var t;if(Li(e)&&e.format)return e.format;return(null!=(t=Ji(e))?t:{}).format}function Zi(e){return zi(e)?e:_i(e)?e.condition:void 0}function Ki(e){return zi(e)?e:_i(e)?e.condition:void 0}function er(e,t){if(a(e)||F(e)||w(e)){const n=a(e)?"string":F(e)?"number":"boolean";return Qt(Ht.primitiveChannelDef(t,n,e)),{value:e}}return zi(e)?tr(e,t):_i(e)?Object.assign(Object.assign({},e),{condition:tr(e.condition,t)}):e}function tr(e,t){const{aggregate:n,timeUnit:i,bin:r,field:o}=e,s=Object.assign({},e);if(!n||Te(n)||ze(n)||_e(n)||(Qt(Ht.invalidAggregate(n)),delete s.aggregate),i&&(s.timeUnit=mn(i)),o&&(s.field=`${o}`),cr(r)&&(s.bin=nr(r,t)),lr(r)&&!U(Nt,t)&&Qt(`Channel ${t} should not be used with "binned" bin`),Ti(s)){const{type:e}=s,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case kn:return"quantitative";case"t":case Bn:return"temporal";case"o":case $n:return"ordinal";case"n":case Nn:return"nominal";case _n:return"geojson"}}(e);e!==t&&(s.type=t),"quantitative"!==e&&Me(n)&&(Qt(Ht.invalidFieldTypeForCountAggregate(e,n)),s.type="quantitative")}else if(!Dt(t)){const e=function(e,t){if(e.timeUnit)return"temporal";if(cr(e.bin))return"quantitative";switch(It(t)){case"continuous":return"quantitative";case"discrete":case"flexible":return"nominal";default:return"quantitative"}}(s,t);Qt(Ht.missingFieldType(t,e)),s.type=e}if(Ti(s)){const{compatible:e,warning:n}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case"row":case"column":case"facet":return Ii(e)?{compatible:!1,warning:Ht.facetChannelShouldBeDiscrete(t)}:ir;case"x":case"y":case"color":case"fill":case"stroke":case"text":case"detail":case"key":case"tooltip":case"href":case"url":return ir;case"longitude":case"longitude2":case"latitude":case"latitude2":return n!==kn?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:ir;case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":case"size":case"x2":case"y2":return"nominal"!==n||e.sort?ir:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case"shape":return U(["ordinal","nominal","geojson"],e.type)?ir:{compatible:!1,warning:"Shape channel should be used with only either discrete or geojson data."};case"order":return"nominal"!==e.type||"sort"in e?ir:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}throw new Error("channelCompatability not implemented for channel "+t)}(s,t);e||Qt(n)}if(ki(s)&&a(s.sort)){const{sort:e}=s;if(wi(e))return Object.assign(Object.assign({},s),{sort:{encoding:e}});const t=e.substr(1);if("-"===e.charAt(0)&&wi(t))return Object.assign(Object.assign({},s),{sort:{encoding:t,order:"descending"}})}return s}function nr(e,t){return w(e)?{maxbins:pr(t)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:Object.assign(Object.assign({},e),{maxbins:pr(t)})}const ir={compatible:!0};function rr(e){const t=Ji(e),n=t&&t.formatType||Li(e)&&e.formatType;return"time"===n||!n&&function(e){return"temporal"===e.type||!!e.timeUnit}(e)}function or(e,{timeUnit:t,type:n,time:i,undefinedIfExprNotRequired:r}){let o;var s;return Zt(e)?o=rn(e,!0):(a(e)||F(e))&&(t||"temporal"===n)&&(o=function(e){return!!sn[e]}(t)?rn({[t]:e},!0):function(e){return!!un[e]}(t)?or(e,{timeUnit:(s=t,s.substr(3))}):`datetime(${JSON.stringify(e)})`),o?i?`time(${o})`:o:r?void 0:JSON.stringify(e)}function sr(e,t){const{timeUnit:n,type:i}=e;return t.map(e=>{const t=or(e,{timeUnit:n,type:i,undefinedIfExprNotRequired:!0});return void 0!==t?{signal:t}:e})}function ar(e,t){return cr(e.bin)?Rt(t)&&U(["ordinal","nominal"],e.type):(console.warn("Only use this method with binned field defs"),!1)}function ur(e){return w(e)&&(e=nr(e,void 0)),"bin"+Y(e).map(t=>fr(e[t])?Q(`_${t}_${Object.entries(e[t])}`):Q(`_${t}_${e[t]}`)).join("")}function cr(e){return!0===e||dr(e)&&!e.binned}function lr(e){return"binned"===e||dr(e)&&!0===e.binned}function dr(e){return s(e)}function fr(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}function pr(e){switch(e){case Le:case We:case nt:case Ze:case Ke:case et:case st:case it:case rt:case ot:case tt:return 6;default:return 10}}function gr(e,t){const n=e&&e[t];return!!n&&(o(n)?R(n,e=>!!e.field):zi(n)||_i(n))}function hr(e){return R(At,t=>{if(gr(e,t)){const n=e[t];if(o(n))return R(n,e=>!!e.aggregate);{const e=Zi(n);return e&&!!e.aggregate}}return!1})}function mr(e,t){const n=[],i=[],r=[],o=[],s={};return yr(e,(a,u)=>{if(zi(a)){const{field:c,aggregate:l,timeUnit:d,bin:f}=a,p=$e(a,["field","aggregate","timeUnit","bin"]);if(l||d||f){const e=Ji(a),g=e&&e.title;let h=Wi(a,{forAs:!0});const m=Object.assign(Object.assign(Object.assign({},g?[]:{title:Vi(a,t,{allowDisabling:!0})}),p),{field:h}),b="x"===u||"y"===u;if(l){let e;if(ze(l)?(e="argmax",h=Wi({op:"argmax",field:l.argmax},{forAs:!0}),m.field=`${h}.${c}`):_e(l)?(e="argmin",h=Wi({op:"argmin",field:l.argmin},{forAs:!0}),m.field=`${h}.${c}`):"boxplot"!==l&&"errorbar"!==l&&"errorband"!==l&&(e=l),e){const t={op:e,as:h};c&&(t.field=c),o.push(t)}}else if(n.push(h),Ti(a)&&cr(f)){if(i.push({bin:f,field:c,as:h}),n.push(Wi(a,{binSuffix:"end"})),ar(a,u)&&n.push(Wi(a,{binSuffix:"range"})),b){const e={field:h+"_end"};s[u+"2"]=e}m.bin="binned",Dt(u)||(m.type="quantitative")}else if(d){r.push({timeUnit:d,field:c,as:h});const e=Ti(a)&&a.type!==Bn&&"time";e&&("text"===u||"tooltip"===u?m.formatType=e:!function(e){return!!kt[e]}(u)?b&&(m.axis=Object.assign({formatType:e},m.axis)):m.legend=Object.assign({formatType:e},m.legend))}s[u]=m}else n.push(c),s[u]=e[u]}else s[u]=e[u]}),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:s}}function br(e,t){const n=t.type;return Y(e).reduce((i,r)=>{var s;if(!Ct(r))return Qt(Ht.invalidEncodingChannel(r)),i;if(!function(e,t,n){const i=Lt(t,n);if(!i)return!1;if("binned"===i){const n=e["x2"===t?"x":"y"];return!!(zi(n)&&zi(e[t])&&lr(n.bin))}return!0}(e,r,n))return Qt(Ht.incompatibleChannel(r,n)),i;if("size"===r&&"line"===n){if(null===(s=Ki(e[r]))||void 0===s?void 0:s.aggregate)return Qt(Ht.LINE_WITH_VARYING_SIZE),i}if("color"===r&&(t.filled?"fill"in e:"stroke"in e))return Qt(Ht.droppingColor("encoding",{fill:"fill"in e,stroke:"stroke"in e})),i;const a=e[r];if("detail"===r||"order"===r&&!o(a)&&!Mi(a)||"tooltip"===r&&o(a))a&&(i[r]=(o(a)?a:[a]).reduce((e,t)=>(zi(t)?e.push(tr(t,r)):Qt(Ht.emptyFieldDef(t,r)),e),[]));else{if("tooltip"===r&&null===a)i[r]=null;else if(!zi(a)&&!Mi(a)&&!Ni(a))return Qt(Ht.emptyFieldDef(a,r)),i;i[r]=er(a,r)}return i},{})}function vr(e){const t=[];for(const n of Y(e))if(gr(e,n)){const i=e[n],r=o(i)?i:[i];for(const e of r)zi(e)?t.push(e):_i(e)&&t.push(e.condition)}return t}function yr(e,t,n){if(e)for(const i of Y(e)){const r=e[i];o(r)?r.forEach(e=>{t.call(n,e,i)}):t.call(n,r,i)}}function xr(e,t,n,i){return e?Y(e).reduce((n,r)=>{const s=e[r];return o(s)?s.reduce((e,n)=>t.call(i,e,n,r),n):t.call(i,n,s,r)},n):n}function Ar(e,t){return Y(t).reduce((n,i)=>{switch(i){case"x":case"y":case"href":case"url":case"x2":case"y2":case"latitude":case"longitude":case"latitude2":case"longitude2":case"text":case"shape":case"tooltip":return n;case"order":if("line"===e||"trail"===e)return n;case"detail":case"key":{const e=t[i];return(o(e)||zi(e))&&(o(e)?e:[e]).forEach(e=>{e.aggregate||n.push(Wi(e,{}))}),n}case"size":if("trail"===e)return n;case"color":case"fill":case"stroke":case"opacity":case"fillOpacity":case"strokeOpacity":case"strokeWidth":{const e=Ki(t[i]);return e&&!e.aggregate&&n.push(Wi(e,{})),n}}},[])}function Or(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:n})=>({field:e+t.field,type:t.type,title:n+(i?" of "+t.field:"")})),...vr(n)]}}function wr(e){const{axis:t,title:n,field:i}=e;return t&&void 0!==t.title?void 0:oe(n,i)}function Fr(e,t,n,i,r){const{scale:o,axis:s}=n;return({partName:u,mark:c,positionPrefix:l,endPositionPrefix:d,extraEncoding:f={}})=>{const p=wr(n);return Cr(e,u,r,{mark:c,encoding:Object.assign(Object.assign(Object.assign({[t]:Object.assign(Object.assign(Object.assign({field:l+"_"+n.field,type:n.type},void 0!==p?{title:p}:{}),void 0!==o?{scale:o}:{}),void 0!==s?{axis:s}:{})},a(d)?{[t+"2"]:{field:d+"_"+n.field,type:n.type}}:{}),i),f)})}}function Cr(e,t,n,i){const{clip:r,color:o,opacity:s}=e,a=e.type;return e[t]||void 0===e[t]&&n[t]?[Object.assign(Object.assign({},i),{mark:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n[t]),r?{clip:r}:{}),o?{color:o}:{}),s?{opacity:s}:{}),Fe(i.mark)?i.mark:{type:i.mark}),{style:`${a}-${t}`}),w(e[t])?{}:e[t])})]:[]}function jr(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],s=i[r+"2"],a=i[r+"Error"],u=i[r+"Error2"];return{continuousAxisChannelDef:Dr(o,n),continuousAxisChannelDef2:Dr(s,n),continuousAxisChannelDefError:Dr(a,n),continuousAxisChannelDefError2:Dr(u,n),continuousAxis:r}}function Dr(e,t){if(e&&e.aggregate){const{aggregate:n}=e,i=$e(e,["aggregate"]);return n!==t&&Qt(Ht.errorBarContinuousAxisHasCustomizedAggregate(n,t)),i}return e}function Er(e,t){const{mark:n,encoding:i}=e;if(zi(i.x)&&Ii(i.x)){if(zi(i.y)&&Ii(i.y)){if(void 0===i.x.aggregate&&i.y.aggregate===t)return"vertical";if(void 0===i.y.aggregate&&i.x.aggregate===t)return"horizontal";if(i.x.aggregate===t&&i.y.aggregate===t)throw new Error("Both x and y cannot have aggregate");return Fe(n)&&n.orient?n.orient:"vertical"}return"horizontal"}if(zi(i.y)&&Ii(i.y))return"vertical";throw new Error("Need a valid continuous axis for "+t+"s")}const Sr="boxplot",kr=Y({box:1,median:1,outliers:1,rule:1,ticks:1}),$r=new ke(Sr,Nr);function Br(e){return F(e)?"tukey":e}function Nr(e,{config:t}){var n,i;const{mark:r,encoding:a,selection:u,projection:c}=e,l=$e(e,["mark","encoding","selection","projection"]),d=Fe(r)?r:{type:r};u&&Qt(Ht.selectionNotSupported("boxplot"));const f=null!=(n=d.extent)?n:t.boxplot.extent,p=oe(d.size,t.boxplot.size),g=Br(f),{transform:h,continuousAxisChannelDef:m,continuousAxis:b,groupby:v,aggregate:y,encodingWithoutContinuousAxis:x,ticksOrient:A,boxOrient:O,customTooltipWithoutAggregatedField:w}=function(e,t,n){const i=Er(e,Sr),{continuousAxisChannelDef:r,continuousAxis:s}=jr(e,i,Sr),a=r.field,u=Br(t),c=[..._r(a),{op:"median",field:a,as:"mid_box_"+a},{op:"min",field:a,as:("min-max"===u?"lower_whisker_":"min_")+a},{op:"max",field:a,as:("min-max"===u?"upper_whisker_":"max_")+a}],l="min-max"===u||"tukey"===u?[]:[{calculate:`datum["upper_box_${a}"] - datum["lower_box_${a}"]`,as:"iqr_"+a},{calculate:`min(datum["upper_box_${a}"] + datum["iqr_${a}"] * ${t}, datum["max_${a}"])`,as:"upper_whisker_"+a},{calculate:`max(datum["lower_box_${a}"] - datum["iqr_${a}"] * ${t}, datum["min_${a}"])`,as:"lower_whisker_"+a}],d=e.encoding,f=s,p=(d[f],$e(d,["symbol"==typeof f?f:f+""])),{customTooltipWithoutAggregatedField:g,filteredEncoding:h}=function(e){const{tooltip:t}=e,n=$e(e,["tooltip"]);if(!t)return{filteredEncoding:e};let i,r;return o(t)?(t.forEach(e=>{e.aggregate?(i||(i=[]),i.push(e)):(r||(r=[]),r.push(e))}),i&&(n.tooltip=i)):t.aggregate?n.tooltip=t:r=t,o(r)&&1===r.length&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}(p),{bins:m,timeUnits:b,aggregate:v,groupby:y,encoding:x}=mr(h,n),A="vertical"===i?"horizontal":"vertical",O=i;return{transform:[...m,...b,{aggregate:[...v,...c],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:r,continuousAxis:s,encodingWithoutContinuousAxis:x,ticksOrient:A,boxOrient:O,customTooltipWithoutAggregatedField:g}}(e,f,t),{color:F,size:C}=x,j=$e(x,["color","size"]),D=e=>Fr(d,b,m,e,t.boxplot),E=D(j),S=D(x),k=D(Object.assign(Object.assign({},j),C?{size:C}:{})),$=Or([{fieldPrefix:"min-max"===g?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===g?"lower_whisker_":"min_",titlePrefix:"Min"}],m,x),B={type:"tick",color:"black",opacity:1,orient:A,invalid:null},N="min-max"===g?$:Or([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],m,x),_=[...E({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...E({partName:"rule",mark:{type:"rule",invalid:null},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...E({partName:"ticks",mark:B,positionPrefix:"lower_whisker",extraEncoding:N}),...E({partName:"ticks",mark:B,positionPrefix:"upper_whisker",extraEncoding:N})],z=[..."tukey"!==g?_:[],...S({partName:"box",mark:Object.assign(Object.assign({type:"bar"},p?{size:p}:{}),{orient:O,invalid:null}),positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:$}),...k({partName:"median",mark:Object.assign(Object.assign(Object.assign({type:"tick",invalid:null},s(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{}),p?{size:p}:{}),{orient:A}),positionPrefix:"mid_box",extraEncoding:$})];let T;if("min-max"!==g){const e=`datum["lower_box_${m.field}"]`,n=`datum["upper_box_${m.field}"]`,i=`(${n} - ${e})`,r=`${e} - ${f} * ${i}`,o=`${n} + ${f} * ${i}`,s=`datum["${m.field}"]`,a={joinaggregate:_r(m.field),groupby:v};let u=void 0;"tukey"===g&&(u={transform:[{filter:`(${r} <= ${s}) && (${s} <= ${o})`},{aggregate:[{op:"min",field:m.field,as:"lower_whisker_"+m.field},{op:"max",field:m.field,as:"upper_whisker_"+m.field},{op:"min",field:"lower_box_"+m.field,as:"lower_box_"+m.field},{op:"max",field:"upper_box_"+m.field,as:"upper_box_"+m.field},...y],groupby:v}],layer:_});const c=$e(j,["tooltip"]),{scale:l,axis:p}=m,h=wr(m),x=Cr(d,"outliers",t.boxplot,{transform:[{filter:`(${s} < ${r}) || (${s} > ${o})`}],mark:"point",encoding:Object.assign(Object.assign({[b]:Object.assign(Object.assign(Object.assign({field:m.field,type:m.type},void 0!==h?{title:h}:{}),void 0!==l?{scale:l}:{}),void 0!==p?{axis:p}:{})},c),w?{tooltip:w}:{})})[0];x&&u?T={transform:[a],layer:[x,u]}:x?(T=x,T.transform.unshift(a)):u&&(T=u,T.transform.unshift(a))}return T?Object.assign(Object.assign({},l),{layer:[T,{transform:h,layer:z}]}):Object.assign(Object.assign({},l),{transform:(i=l.transform,null!=i?i:[]).concat(h),layer:z})}function _r(e){return[{op:"q1",field:e,as:"lower_box_"+e},{op:"q3",field:e,as:"upper_box_"+e}]}const zr="errorbar",Tr=Y({ticks:1,rule:1}),Pr=new ke(zr,Mr);function Mr(e,{config:t}){const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:s,markDef:a,outerSpec:u,tooltipEncoding:c}=Rr(e,zr,t),l=Fr(a,r,i,o,t.errorbar),d={type:"tick",orient:s};return Object.assign(Object.assign({},u),{transform:n,layer:[...l({partName:"ticks",mark:d,positionPrefix:"lower",extraEncoding:c}),...l({partName:"ticks",mark:d,positionPrefix:"upper",extraEncoding:c}),...l({partName:"rule",mark:"rule",positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})]})}function Ur(e,t){const{encoding:n}=e;if(function(e){return(zi(e.x)||zi(e.y))&&!zi(e.x2)&&!zi(e.y2)&&!zi(e.xError)&&!zi(e.xError2)&&!zi(e.yError)&&!zi(e.yError2)}(n))return{orient:Er(e,t),inputType:"raw"};const i=function(e){return zi(e.x2)||zi(e.y2)}(n),r=function(e){return zi(e.xError)||zi(e.xError2)||zi(e.yError)||zi(e.yError2)}(n),o=n.x,s=n.y;if(i){if(r)throw new Error(t+" cannot be both type aggregated-upper-lower and aggregated-error");const e=n.x2,i=n.y2;if(zi(e)&&zi(i))throw new Error(t+" cannot have both x2 and y2");if(zi(e)){if(zi(o)&&Ii(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error("Both x and x2 have to be quantitative in "+t)}if(zi(i)){if(zi(s)&&Ii(s))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error("Both y and y2 have to be quantitative in "+t)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,a=n.yError2;if(zi(i)&&!zi(e))throw new Error(t+" cannot have xError2 without xError");if(zi(a)&&!zi(r))throw new Error(t+" cannot have yError2 without yError");if(zi(e)&&zi(r))throw new Error(t+" cannot have both xError and yError with both are quantiative");if(zi(e)){if(zi(o)&&Ii(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(zi(r)){if(zi(s)&&Ii(s))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function Rr(e,t,n){var i;const{mark:r,encoding:o,selection:s,projection:a}=e,u=$e(e,["mark","encoding","selection","projection"]),c=Fe(r)?r:{type:r};s&&Qt(Ht.selectionNotSupported(t));const{orient:l,inputType:d}=Ur(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:p,continuousAxisChannelDefError:g,continuousAxisChannelDefError2:h,continuousAxis:m}=jr(e,l,t),{errorBarSpecificAggregate:b,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:x}=function(e,t,n,i,r,o,s,a){let u=[],c=[];const l=t.field;let d,f=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":a.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Qt(Ht.errorBarCenterIsUsedWithWrongExtent(t,n,s)),"stderr"===n||"stdev"===n)u=[{op:n,field:l,as:"extent_"+l},{op:t,field:l,as:"center_"+l}],c=[{calculate:`datum["center_${l}"] + datum["extent_${l}"]`,as:"upper_"+l},{calculate:`datum["center_${l}"] - datum["extent_${l}"]`,as:"lower_"+l}],d=[{fieldPrefix:"center_",titlePrefix:K(t)},{fieldPrefix:"upper_",titlePrefix:Lr(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:Lr(t,n,"-")}],f=!0;else{let t,i,r;e.center&&e.extent&&Qt(Ht.errorBarCenterIsNotNeeded(e.extent,s)),"ci"===n?(t="mean",i="ci0",r="ci1"):(t="median",i="q1",r="q3"),u=[{op:i,field:l,as:"lower_"+l},{op:r,field:l,as:"upper_"+l},{op:t,field:l,as:"center_"+l}],d=[{fieldPrefix:"upper_",titlePrefix:Vi({field:l,aggregate:r,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Vi({field:l,aggregate:i,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Vi({field:l,aggregate:t,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Qt(Ht.errorBarCenterAndExtentAreNotNeeded(e.center,e.extent)),"aggregated-upper-lower"===o?(d=[],c=[{calculate:`datum["${n.field}"]`,as:"upper_"+l},{calculate:`datum["${l}"]`,as:"lower_"+l}]):"aggregated-error"===o&&(d=[{fieldPrefix:"",titlePrefix:l}],c=[{calculate:`datum["${l}"] + datum["${i.field}"]`,as:"upper_"+l}],r?c.push({calculate:`datum["${l}"] + datum["${r.field}"]`,as:"lower_"+l}):c.push({calculate:`datum["${l}"] - datum["${i.field}"]`,as:"lower_"+l}));for(const e of c)d.push({fieldPrefix:e.as.substring(0,6),titlePrefix:ne(ne(e.calculate,'datum["',""),'"]',"")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:u,tooltipSummary:d,tooltipTitleWithFieldName:f}}(c,f,p,g,h,d,t,n),A=m,O=(o[A],"x"===m?"x2":"y2"),w=(o[O],"x"===m?"xError":"yError"),F=(o[w],"x"===m?"xError2":"yError2"),C=(o[F],$e(o,["symbol"==typeof A?A:A+"","symbol"==typeof O?O:O+"","symbol"==typeof w?w:w+"","symbol"==typeof F?F:F+""])),{bins:j,timeUnits:D,aggregate:E,groupby:S,encoding:k}=mr(C,n),$=[...E,...b],B="raw"!==d?[]:S,N=Or(y,f,k,x);return{transform:[...(i=u.transform,null!=i?i:[]),...j,...D,...0===$.length?[]:[{aggregate:$,groupby:B}],...v],groupby:B,continuousAxisChannelDef:f,continuousAxis:m,encodingWithoutContinuousAxis:k,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:c,outerSpec:u,tooltipEncoding:N}}function Lr(e,t,n){return K(e)+" "+n+" "+t}const Wr="errorband",qr=Y({band:1,borders:1}),Ir=new ke(Wr,Hr);function Hr(e,{config:t}){const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:s,outerSpec:a,tooltipEncoding:u}=Rr(e,Wr,t),c=s,l=Fr(c,r,i,o,t.errorband),d=void 0!==e.encoding.x&&void 0!==e.encoding.y;let f={type:d?"area":"rect"},p={type:d?"line":"rule"};const g=Object.assign(Object.assign({},c.interpolate?{interpolate:c.interpolate}:{}),c.tension&&c.interpolate?{interpolate:c.tension}:{});return d?(f=Object.assign(Object.assign({},f),g),p=Object.assign(Object.assign({},p),g)):c.interpolate?Qt(Ht.errorBand1DNotSupport("interpolate")):c.tension&&Qt(Ht.errorBand1DNotSupport("tension")),Object.assign(Object.assign({},a),{transform:n,layer:[...l({partName:"band",mark:f,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...l({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:u}),...l({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:u})]})}const Gr={};function Yr(e,t,n){const i=new ke(e,t);Gr[e]={normalizer:i,parts:n}}Yr(Sr,Nr,kr),Yr(zr,Mr,Tr),Yr(Wr,Hr,qr);const Vr=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Jr="_vgsid_",Qr={single:{on:"click",fields:[Jr],resolve:"global",empty:"all",clear:"dblclick"},multi:{on:"click",fields:[Jr],toggle:"event.shiftKey",resolve:"global",empty:"all",clear:"dblclick"},interval:{on:"[mousedown, window:mouseup] > window:mousemove!",encodings:["x","y"],translate:"[mousedown, window:mouseup] > window:mousemove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function Xr(e){return!(!e||"legend"!==e&&!e.legend)}function Zr(e){return Xr(e)&&s(e)}function Kr(e){return void 0!==e.concat}function eo(e){return void 0!==e.vconcat}function to(e){return void 0!==e.hconcat}function no(e){return void 0!==e.repeat}function io(e){return s(e)&&void 0!==e.step}const ro=Y({align:1,bounds:1,center:1,columns:1,spacing:1});function oo(e,t){var n;return null!=(n=e[t])?n:e["width"===t?"continuousWidth":"continuousHeight"]}function so(e,t){const n=ao(e,t);return io(n)?n.step:uo}function ao(e,t){var n;return oe(null!=(n=e[t])?n:e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const uo=20,co={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:uo},mark:{color:"#4c78a8",invalid:"filter",timeUnitBand:1},area:{},bar:De,circle:{},geoshape:{},image:{},line:{},point:{},rect:Ee,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4},projection:{},axis:{},axisX:{},axisY:{},axisLeft:{},axisRight:{},axisTop:{},axisBottom:{},axisBand:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:Qr,style:{},title:{},facet:{spacing:20},repeat:{spacing:20},concat:{spacing:20}};function lo(e){return b({},co,e)}const fo=["view",...we],po=["background","padding","facet","concat","repeat","numberFormat","timeFormat","countTitle","header","scale","selection","overlay"],go=Object.assign({view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"]},{area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize"],line:["point"],tick:["bandSize","thickness"]});function ho(e){e=N(e);for(const t of po)delete e[t];if(e.legend)for(const t of Vr)delete e.legend[t];if(e.mark)for(const t of je)delete e.mark[t];for(const t of fo){for(const n of je)delete e[t][n];const n=go[t];if(n)for(const i of n)delete e[t][i];mo(e,t)}for(const t of Y(Gr))delete e[t];mo(e,"title","group-title");for(const t in e)s(e[t])&&0===Y(e[t]).length&&delete e[t];return Y(e).length>0?e:void 0}function mo(e,t,n,i){const r="title"===t?ri(e.title).mark:i?e[t][i]:e[t];"view"===t&&(n="cell");const o=Object.assign(Object.assign({},r),e.style[t]);Y(o).length>0&&(e.style[null!=n?n:t]=o),i||delete e[t]}function bo(e){return void 0!==e.layer}class vo{map(e,t){return Ei(e)?this.mapFacet(e,t):no(e)?this.mapRepeat(e,t):to(e)?this.mapHConcat(e,t):eo(e)?this.mapVConcat(e,t):Kr(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(bo(e))return this.mapLayer(e,t);if(Se(e))return this.mapUnit(e,t);throw new Error(Ht.invalidSpec(e))}mapLayer(e,t){return Object.assign(Object.assign({},e),{layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))})}mapHConcat(e,t){return Object.assign(Object.assign({},e),{hconcat:e.hconcat.map(e=>this.map(e,t))})}mapVConcat(e,t){return Object.assign(Object.assign({},e),{vconcat:e.vconcat.map(e=>this.map(e,t))})}mapConcat(e,t){const{concat:n}=e,i=$e(e,["concat"]);return Object.assign(Object.assign({},i),{concat:n.map(e=>this.map(e,t))})}mapFacet(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapRepeat(e,t){return Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}}const yo={zero:1,center:1,normalize:1};const xo=[ce,ue,ge,fe,ve,ye,de,he,me],Ao=[ce,ue];function Oo(e,t,n={}){const i=Fe(e)?e.type:e;if(!U(xo,i))return null;const r=function(e){const t=e.x,n=e.y;if(zi(t)&&zi(n))if("quantitative"===t.type&&"quantitative"===n.type){if(t.stack)return"x";if(n.stack)return"y";if(!!t.aggregate!=!!n.aggregate)return t.aggregate?"x":"y"}else{if("quantitative"===t.type)return"x";if("quantitative"===n.type)return"y"}else{if(zi(t)&&"quantitative"===t.type)return"x";if(zi(n)&&"quantitative"===n.type)return"y"}}(t);if(!r)return null;const s=t[r],a=Pi(s)?Wi(s,{}):void 0,u="x"===r?"y":"x",c=t[u],l=Pi(c)?Wi(c,{}):void 0,d=$t.reduce((e,n)=>{if("tooltip"!==n&&gr(t,n)){const i=t[n];(o(i)?i:[i]).forEach(t=>{const i=Ki(t);if(i.aggregate)return;const r=Pi(i)?Wi(i,{}):void 0;(!r||r!==l&&r!==a)&&e.push({channel:n,fieldDef:i})})}return e},[]);let f;if(void 0!==s.stack?f=w(s.stack)?s.stack?"zero":null:s.stack:d.length>0&&U(Ao,i)&&(f="zero"),!f||!yo[f])return null;if(hr(t)&&0===d.length)return null;if(s.scale&&s.scale.type&&s.scale.type!==zn.LINEAR){if(n.disallowNonLinearStack)return null;Qt(Ht.cannotStackNonLinearScale(s.scale.type))}return gr(t,r===Ie?Ge:Ye)?(void 0!==s.stack&&Qt(Ht.cannotStackRangedMark(r)),null):(s.aggregate&&!U(Ue,s.aggregate)&&Qt(Ht.stackNonSummativeAggregate(s.aggregate)),{groupbyChannel:c?u:void 0,fieldChannel:r,impute:null!==s.impute&&Ae(i),stackBy:d,offset:f})}function wo(e){const t=$e(e,["point","line"]);return Y(t).length>1?t:t.type}function Fo(e){for(const t of["line","area","rule","trail"])e[t]&&(e=Object.assign(Object.assign({},e),{[t]:z(e[t],["point","line"])}));return e}function Co(e,t={},n){return"transparent"===e.point?{opacity:0}:e.point?s(e.point)?e.point:{}:void 0!==e.point?null:t.point||n.shape?s(t.point)?t.point:{}:void 0}function jo(e,t={}){return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class Do{constructor(){this.name="path-overlay"}hasMatchingType(e,t){if(Se(e)){const{mark:n,encoding:i}=e,r=Fe(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!Co(r,t[r.type],i);case"area":return!!Co(r,t[r.type],i)||!!jo(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{selection:r,projection:o,encoding:s,mark:a}=e,u=$e(e,["selection","projection","encoding","mark"]),c=Fe(a)?a:{type:a},l=Co(c,i[c.type],s),d="area"===c.type&&jo(c,i[c.type]),f=[Object.assign(Object.assign({},r?{selection:r}:{}),{mark:wo(Object.assign(Object.assign({},c),"area"===c.type?{opacity:.7}:{})),encoding:z(s,["shape"])})],p=Oo(c,s);let g=s;if(p){const{fieldChannel:e,offset:t}=p;g=Object.assign(Object.assign({},s),{[e]:Object.assign(Object.assign({},s[e]),t?{stack:t}:{})})}return d&&f.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"line"},_(c,["clip","interpolate","tension","tooltip"])),d),encoding:g})),l&&f.push(Object.assign(Object.assign({},o?{projection:o}:{}),{mark:Object.assign(Object.assign({type:"point",opacity:1,filled:!0},_(c,["clip","tooltip"])),l),encoding:g})),n(Object.assign(Object.assign({},u),{layer:f}),Object.assign(Object.assign({},t),{config:Fo(i)}))}}class Eo{constructor(){this.name="RangeStep"}hasMatchingType(e){var t,n;if(Se(e)&&e.encoding)for(const i of Nt){const r=e.encoding[i];if(r&&zi(r)&&(null===(n=null===(t=r)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep))return!0}return!1}run(e){var t,n;const i={};let r=Object.assign({},e.encoding);for(const e of Nt){const o=_t(e),s=r[e];if(s&&zi(s)&&(null===(n=null===(t=s)||void 0===t?void 0:t.scale)||void 0===n?void 0:n.rangeStep)){const{scale:t}=s,n=$e(s,["scale"]),a=$e(t,["rangeStep"]);i[o]={step:t.rangeStep},Qt(Ht.RANGE_STEP_DEPRECATED),r=Object.assign(Object.assign({},r),{[e]:Object.assign(Object.assign({},n),Y(a).length>0?{scale:a}:{})})}}return Object.assign(Object.assign(Object.assign({},i),e),{encoding:r})}}class So{constructor(){this.name="RuleForRangedLine"}hasMatchingType(e){if(Se(e)){const{encoding:t,mark:n}=e;if("line"===n)for(const e of jt){const n=t[Et(e)];if(t[e]&&zi(n)&&!lr(n.bin))return!0}}return!1}run(e,t,n){const{encoding:i}=e;return Qt(Ht.lineWithRange(!!i.x2,!!i.y2)),n(Object.assign(Object.assign({},e),{mark:"rule"}),t)}}function ko(e){const{parentEncoding:t,encoding:n}=e;if(t&&n){const e=Y(t).reduce((e,t)=>(n[t]&&e.push(t),e),[]);e.length>0&&Qt(Ht.encodingOverridden(e))}const i=Object.assign(Object.assign({},null!=t?t:{}),null!=n?n:{});return Y(i).length>0?i:void 0}function $o(e){const{parentProjection:t,projection:n}=e;return t&&n&&Qt(Ht.projectionOverridden({parentProjection:t,projection:n})),null!=n?n:t}function Bo(e,t){void 0===t&&(t=lo(e.config));const n=function(e,t={}){return No.map(e,{config:t})}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=Se(e)||bo(e),s={};o?"container"==i&&"container"==r?(s.type="fit",s.contains="padding"):"container"==i?(s.type="fit-x",s.contains="padding"):"container"==r&&(s.type="fit-y",s.contains="padding"):("container"==i&&(Qt(Ht.containerSizeNonSingle("width")),i=void 0),"container"==r&&(Qt(Ht.containerSizeNonSingle("height")),r=void 0));const a=Object.assign(Object.assign(Object.assign({type:"pad"},s),n?_o(n.autosize):{}),_o(e.autosize));"fit"!==a.type||o||(Qt(Ht.FIT_NON_SINGLE),a.type="pad");"container"==i&&"fit"!=a.type&&"fit-x"!=a.type&&Qt(Ht.containerSizeNotCompatibleWithAutosize("width"));"container"==r&&"fit"!=a.type&&"fit-y"!=a.type&&Qt(Ht.containerSizeNotCompatibleWithAutosize("height"));if(B(a,{type:"pad"}))return;return a}(n,{width:i,height:r,autosize:e.autosize},t);return Object.assign(Object.assign({},n),o?{autosize:o}:{})}const No=new class extends vo{constructor(){super(...arguments),this.nonFacetUnitNormalizers=[$r,Pr,Ir,new Do,new So,new Eo]}map(e,t){if(Se(e)){const n=gr(e.encoding,Le),i=gr(e.encoding,We),r=gr(e.encoding,qe);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t;if(n||i)return this.mapUnitWithParentEncodingOrProjection(e,t);const r=this.mapLayerOrUnit.bind(this);for(const n of this.nonFacetUnitNormalizers)if(n.hasMatchingType(e,t.config))return n.run(e,t,r);return e}mapRepeat(e,t){const{repeat:n}=e;return!o(n)&&e.columns&&(e=z(e,["columns"]),Qt(Ht.columnsNotSupportByRowCol("repeat"))),Object.assign(Object.assign({},e),{spec:this.map(e.spec,t)})}mapFacet(e,t){const{facet:n}=e;return Di(n)&&e.columns&&(e=z(e,["columns"]),Qt(Ht.columnsNotSupportByRowCol("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:s}=t,a=$o({parentProjection:o,projection:i}),u=ko({parentEncoding:r,encoding:n});return this.mapUnit(Object.assign(Object.assign(Object.assign({},e),a?{projection:a}:{}),u?{encoding:u}:{}),{config:s})}mapFacetedUnit(e,t){const n=e.encoding,{row:i,column:r,facet:o}=n,s=$e(n,["row","column","facet"]),{mark:a,width:u,projection:c,height:l,selection:d,encoding:f}=e,p=$e(e,["mark","width","projection","height","selection","encoding"]),{facetMapping:g,layout:h}=this.getFacetMappingAndLayout({row:i,column:r,facet:o});return this.mapFacet(Object.assign(Object.assign(Object.assign({},p),h),{facet:g,spec:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},c?{projection:c}:{}),{mark:a}),u?{width:u}:{}),l?{height:l}:{}),{encoding:s}),d?{selection:d}:{})}),t)}getFacetMappingAndLayout(e){var t;const{row:n,column:i,facet:r}=e;if(n||i){r&&Qt(Ht.facetChannelDropped([...n?[Le]:[],...i?[We]:[]]));const o={},s={};for(const n of[Le,We]){const i=e[n];if(i){const e=$e(i,["align","center","spacing","columns"]);o[n]=e;for(const e of["align","center","spacing"])void 0!==i[e]&&(s[e]=null!=(t=s[e])?t:{},s[e][n]=i[e])}}return{facetMapping:o,layout:s}}{const{align:e,center:t,spacing:n,columns:i}=r;return{facetMapping:$e(r,["align","center","spacing","columns"]),layout:Object.assign(Object.assign(Object.assign(Object.assign({},e?{align:e}:{}),t?{center:t}:{}),n?{spacing:n}:{}),i?{columns:i}:{})}}}mapLayer(e,t){var{parentEncoding:n,parentProjection:i}=t,r=$e(t,["parentEncoding","parentProjection"]);const{encoding:o,projection:s}=e,a=$e(e,["encoding","projection"]),u=Object.assign(Object.assign({},r),{parentEncoding:ko({parentEncoding:n,encoding:o}),parentProjection:$o({parentProjection:i,projection:s})});return super.mapLayer(a,u)}};function _o(e){return a(e)?{type:e}:null!=e?e:{}}const zo=["background","padding"];function To(e){return zo.reduce((t,n)=>(e&&void 0!==e[n]&&(t[n]=e[n]),t),{})}function Po(e){return!!e.url}function Mo(e){return!!e.values}function Uo(e){return!(!e.name||Po(e)||Mo(e)||Ro(e))}function Ro(e){return e&&(Lo(e)||Wo(e)||qo(e))}function Lo(e){return!!e.sequence}function Wo(e){return!!e.sphere}function qo(e){return!!e.graticule}const Io="main",Ho="raw";function Go(e){return void 0!==e.filter}function Yo(e){return void 0!==e.lookup}function Vo(e){return void 0!==e.pivot}function Jo(e){return void 0!==e.density}function Qo(e){return void 0!==e.quantile}function Xo(e){return void 0!==e.regression}function Zo(e){return void 0!==e.loess}function Ko(e){return void 0!==e.sample}function es(e){return void 0!==e.window}function ts(e){return void 0!==e.joinaggregate}function ns(e){return void 0!==e.flatten}function is(e){return void 0!==e.calculate}function rs(e){return!!e.bin}function os(e){return void 0!==e.impute}function ss(e){return void 0!==e.timeUnit}function as(e){return void 0!==e.aggregate}function us(e){return void 0!==e.stack}function cs(e){return void 0!==e.fold}function ls(e){return!!e.signal}function ds(e){return!!e.step}function fs(e){return!o(e)&&("field"in e&&"data"in e)}const ps=Y({opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeMiterLimit:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,x:1,y:1,x2:1,y2:1,width:1,height:1,aspect:1}),gs=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"],hs={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDash"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDash"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickWidth:{part:"ticks",vgProp:"strokeWidth"}};const ms=["domain","grid","labels","ticks","title"],bs={grid:"grid",gridColor:"grid",gridDash:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",domain:"main",domainColor:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontWeight:"main",labelLimit:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",maxExtent:"main",minExtent:"main",offset:"main",position:"main",tickColor:"main",tickExtra:"main",tickOffset:"both",tickOpacity:"main",tickRound:"main",ticks:"main",tickSize:"main",title:"main",titleAlign:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",tickWidth:"both",tickCount:"both",values:"both",scale:"both",zindex:"both"},vs={orient:1,bandPosition:1,domain:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,values:1,translate:1,zindex:1},ys=Object.assign(Object.assign({},vs),{labelExpr:1,encoding:1});function xs(e,t,n){return As=t||ws,Os=n||Ns,zs(e.trim()).map(Ts)}var As,Os,ws="view",Fs="[",Cs="]",js="{",Ds="}",Es=":",Ss=",",ks="@",$s=">",Bs=/[[\]{}]/,Ns={"*":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};function _s(e,t,n,i,r){for(var o,s=0,a=e.length;t<a;++t){if(o=e[t],!s&&o===n)return t;r&&r.indexOf(o)>=0?--s:i&&i.indexOf(o)>=0&&++s}return t}function zs(e){for(var t=[],n=0,i=e.length,r=0;r<i;)r=_s(e,r,Ss,Fs+js,Cs+Ds),t.push(e.substring(n,r).trim()),n=++r;if(0===t.length)throw"Empty event selector: "+e;return t}function Ts(e){return"["===e[0]?function(e){var t,n,i=e.length,r=1;if((r=_s(e,r,Cs,Fs,Cs))===i)throw"Empty between selector: "+e;if(2!==(t=zs(e.substring(1,r))).length)throw"Between selector must have two elements: "+e;if((e=e.slice(r+1).trim())[0]!==$s)throw"Expected '>' after between selector: "+e;if(t=t.map(Ts),(n=Ts(e.slice(1).trim())).between)return{between:t,stream:n};n.between=t;return n}(e):function(e){var t,n,i={source:As},r=[],o=[0,0],s=0,a=0,u=e.length,c=0;if(e[u-1]===Ds){if(!((c=e.lastIndexOf(js))>=0))throw"Unmatched right brace: "+e;try{o=function(e){var t=e.split(Ss);if(!e.length||t.length>2)throw e;return t.map((function(t){var n=+t;if(n!=n)throw e;return n}))}(e.substring(c+1,u-1))}catch(t){throw"Invalid throttle specification: "+e}e=e.slice(0,c).trim(),u=e.length,c=0}if(!u)throw e;e[0]===ks&&(s=++c);(t=_s(e,c,Es))<u&&(r.push(e.substring(a,t).trim()),a=c=++t);if((c=_s(e,c,Fs))===u)r.push(e.substring(a,u).trim());else if(r.push(e.substring(a,c).trim()),n=[],(a=++c)===u)throw"Unmatched left bracket: "+e;for(;c<u;){if((c=_s(e,c,Cs))===u)throw"Unmatched left bracket: "+e;if(n.push(e.substring(a,c).trim()),c<u-1&&e[++c]!==Fs)throw"Expected left bracket: "+e;a=++c}if(!(u=r.length)||Bs.test(r[u-1]))throw"Invalid event selector: "+e;u>1?(i.type=r[1],s?i.markname=r[0].slice(1):!function(e){return Os[e]}(r[0])?i.source=r[0]:i.marktype=r[0]):i.type=r[0];"!"===i.type.slice(-1)&&(i.consume=!0,i.type=i.type.slice(0,-1));null!=n&&(i.filter=n);o[0]&&(i.throttle=o[0]);o[1]&&(i.debounce=o[1]);return i}(e)}function Ps(e,t,n,i){const r=t&&t.condition,o=i(t);if(r){return{[n]:[...x(r).map(t=>{const n=i(t),r=function(e){return e.selection}(t)?Gc(e,t.selection):Vc(e,t.test);return Object.assign({test:r},n)}),...void 0!==o?[o]:[]]}}return void 0!==o?{[n]:o}:{}}function Ms(e){const{channel:t,channelDef:n,markDef:i,scale:r}=e,o=Is(e);return zi(n)&&!Me(n.aggregate)&&r&&Vn(r.get("type"))&&!1===r.get("zero")?Us({fieldDef:n,channel:t,markDef:i,ref:o}):o}function Us({fieldDef:e,channel:t,markDef:n,ref:i}){return Ae(n.type)?i:[Rs(e,t),i]}function Rs(e,t){const n=Ls(e,!0),i="x"===Et(t)?{value:0}:{field:{group:"height"}};return Object.assign({test:n},i)}function Ls(e,t=!0){return Dn(a(e)?e:Wi(e,{expr:"datum"}),!t)}function Ws(e,t,n,i){const r=Object.assign(Object.assign({},t?{scale:t}:{}),{field:Wi(e,n)});if(i){const{offset:e,band:t}=i;return Object.assign(Object.assign(Object.assign({},r),e?{offset:e}:{}),t?{band:t}:{})}return r}function qs({scaleName:e,fieldDef:t,fieldDef2:n,offset:i,startSuffix:r,band:o=.5}){const s=0<o&&o<1?"datum":void 0,a=Wi(t,{expr:s,suffix:r}),u=void 0!==n?Wi(n,{expr:s}):Wi(t,{suffix:"end",expr:s});if(0===o)return Object.assign({scale:e,field:a},i?{offset:i}:{});if(1===o)return Object.assign({scale:e,field:u},i?{offset:i}:{});{const t=`${o} * ${a} + ${1-o} * ${u}`;return Object.assign({signal:`scale("${e}", ${t})`},i?{offset:i}:{})}}function Is({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:c}){if(t){if(zi(t)){if(Ti(t)){const s=$i(e,t,n,i,r,{isMidPoint:!0});if(cr(t.bin)||s&&t.timeUnit)return U([Ie,He],e)&&U([kn,Bn],t.type)?a&&a.impute?Ws(t,o,{binSuffix:"mid"},{offset:u}):qs({scaleName:o,fieldDef:t,band:s,offset:u}):Ws(t,o,ar(t,e)?{binSuffix:"range"}:{},{offset:u});if(lr(t.bin)){if(zi(n))return qs({scaleName:o,fieldDef:t,fieldDef2:n,band:s,offset:u});{const t=e===Ie?Ge:Ye;Qt(Ht.channelRequiredForBinned(t))}}}if(s){const e=s.get("type");if(Gn(e)){if("band"===e){return Ws(t,o,{binSuffix:"range"},{band:oe(Ri(t)?t.band:void 0,.5),offset:u})}return Ws(t,o,{binSuffix:"range"},{offset:u})}}return Ws(t,o,{},{offset:u})}if(Mi(t)){const n=t.value,i=u?{offset:u}:{};return Object.assign(Object.assign({},Hs(e,n)),i)}}const l=function(e){return"function"==typeof e}(c)?Object.assign(Object.assign({},c()),u?{offset:u}:{}):c;return l?Object.assign(Object.assign({},l),u?{offset:u}:{}):l}function Hs(e,t){return U(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:U(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:{value:t}}function Gs(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:s=e}=n;let{defaultRef:a,defaultValue:u}=n;void 0===a&&(u=null!=u?u:s===e?i[e]:oe(i[e],i[s],ci(e,i,o,{vgChannel:s})),a=u?{value:u}:void 0);const c=r[e];return Ps(t,c,s,n=>Is({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:a}))}function Ys(e){const{markDef:t,encoding:n,config:i}=e,{filled:r,type:o}=t,s={fill:ci("fill",t,i),stroke:ci("stroke",t,i),color:ci("color",t,i)},a=U(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,u=oe(t.fill,!0===r?t.color:void 0,s.fill,!0===r?s.color:void 0,a),c=oe(t.stroke,!1===r?t.color:void 0,s.stroke,!1===r?s.color:void 0),l=r?"fill":"stroke",d=Object.assign(Object.assign({},u?{fill:{value:u}}:{}),c?{stroke:{value:c}}:{});return t.color&&(r?t.fill:t.stroke)&&Qt(Ht.droppingColor("property",{fill:"fill"in t,stroke:"stroke"in t})),Object.assign(Object.assign(Object.assign(Object.assign({},d),Gs("color",e,{vgChannel:l,defaultValue:r?u:c})),Gs("fill",e,{defaultValue:n.fill?u:void 0})),Gs("stroke",e,{defaultValue:n.stroke?c:void 0}))}function Vs(e,t="text"){const n=e.encoding[t];return Ps(e,n,t,t=>Js(t,e.config))}function Js(e,t,n="datum"){if(e){if(Mi(e))return{value:e.value};if(Ti(e))return di(e,Xi(e),n,t)}}function Qs(e,t={}){const{encoding:n,markDef:i,config:r}=e,u=n.tooltip;return o(u)?{tooltip:Xs({tooltip:u},r,t)}:Ps(e,u,"tooltip",o=>{const u=Js(o,e.config,t.reactiveGeom?"datum.datum":"datum");if(u)return u;if(null===o)return;let c=oe(i.tooltip,ci("tooltip",i,r));return!0===c&&(c={content:"encoding"}),a(c)?{value:c}:s(c)?"encoding"===c.content?Xs(n,r,t):{signal:"datum"}:void 0})}function Xs(e,t,{reactiveGeom:n}={}){const i=[],r={},o={},s=n?"datum.datum":"datum",a=[];function c(n,i){const r=Et(i),u=Ti(n)?n:Object.assign(Object.assign({},n),{type:e[r].type}),c=x(Vi(u,t,{allowDisabling:!1})).join(", ");let l=Js(u,t,s).signal;if("x"===i||"y"===i){const n="x"===i?"x2":"y2",r=Zi(e[n]);if(lr(u.bin)&&r){l=hi(Wi(u,{expr:s}),Wi(r,{expr:s}),Xi(u),t),o[n]=!0}}a.push({channel:i,key:c,value:l})}yr(e,(e,t)=>{zi(e)?c(e,t):_i(e)&&c(e.condition,t)});for(const{channel:e,key:t,value:n}of a)o[e]||r[t]||(i.push(`${u(t)}: ${n}`),r[t]=!0);return i.length>0?{signal:`{${i.join(", ")}}`}:void 0}function Zs(e,t){const n=t[e+"Offset"];if(n)return n}function Ks(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,mark:o,markDef:s,config:a,stack:u}=t,c=r[e],l=r[e===Ie?Ge:Ye],d=t.scaleName(e),f=t.getScaleComponent(e),p=Zs(e,t.markDef),g=ea({model:t,markDef:s,config:a,defaultPos:n,channel:e,scaleName:d,scale:f,mark:o,checkBarAreaWithoutZero:!l});return{[null!=i?i:e]:c||!r.latitude&&!r.longitude?function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o}=e;if(zi(n)&&r&&t===r.fieldChannel)return Ri(n)&&void 0!==n.band?qs({scaleName:i,fieldDef:n,startSuffix:"start",band:n.band,offset:0}):Ws(n,i,{suffix:"end"},{offset:o});return Ms(e)}({channel:e,channelDef:c,channel2Def:l,markDef:s,config:a,scaleName:d,scale:f,stack:u,offset:p,defaultRef:g}):{field:t.getName(e)}}}function ea({model:e,markDef:t,config:n,defaultPos:i,channel:r,scaleName:o,scale:s,mark:a,checkBarAreaWithoutZero:u}){return()=>{const c=Et(r),l=oe(t[r],ci(r,t,n));if(void 0!==l)return Hs(r,l);if("zeroOrMin"===i||"zeroOrMax"===i){if(o){const e=s.get("type");if(U([zn.LOG,zn.TIME,zn.UTC],e))!u||"bar"!==a&&"area"!==a||Qt(Ht.nonZeroScaleUsedWithLengthMark(a,c,{scaleType:e}));else{if(s.domainDefinitelyIncludesZero())return{scale:o,value:0};!u||"bar"!==a&&"area"!==a||Qt(Ht.nonZeroScaleUsedWithLengthMark(a,c,{zeroFalse:!1===s.explicit.zero}))}}return"zeroOrMin"===i?"x"===c?{value:0}:{field:{group:"height"}}:"x"===c?{field:{group:"width"}}:{value:0}}{const t=e["x"===c?"width":"height"];return Object.assign(Object.assign({},t),{mult:.5})}}}const ta={left:"x",center:"xc",right:"x2"},na={top:"y",middle:"yc",bottom:"y2"};function ia(e,t,n){const i="x"===e?"align":"baseline",r=oe(t[i],ci(i,t,n));return"x"===e?ta[null!=r?r:"center"]:na[null!=r?r:"middle"]}function ra(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?oa(e,t,{defaultPos:n,defaultPos2:i}):Ks(e,t,{defaultPos:n})}function oa(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,s="x"===e?"width":"height",a=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:s,config:a}=e,u="x2"===n?"x":"y",c="x2"===n?"width":"height",l=i[u],d=e.scaleName(u),f=e.getScaleComponent(u),p=Zs(n,e.markDef);if(!l&&(i.latitude||i.longitude))return{[n]:{field:e.getName(n)}};const g=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:c}){if(zi(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0))return Ws(t,o,{suffix:"start"},{offset:u});return Ms({channel:e,channelDef:n,scaleName:o,scale:s,stack:a,markDef:i,config:r,offset:u,defaultRef:c})}({channel:n,channelDef:l,channel2Def:i[n],markDef:o,config:a,scaleName:d,scale:f,stack:s,offset:p,defaultRef:void 0});if(void 0!==g)return{[n]:g};const h=ea({model:e,markDef:o,config:a,defaultPos:t,channel:n,scaleName:d,scale:f,mark:r,checkBarAreaWithoutZero:!i[n]})();return oe(sa(n,o),sa(n,{[n]:li(n,o,a.style),[c]:li(c,o,a.style)}),sa(n,a[r]),sa(n,a.mark),{[n]:h})}(t,i,"x"===e?"x2":"y2"),u=a[s]?ia(e,r,o):e;return Object.assign(Object.assign({},Ks(e,t,{defaultPos:n,vgChannel:u})),a)}function sa(e,t){const n="x2"===e?"width":"height";return t[e]?{[e]:Hs(e,t[e])}:t[n]?{[n]:{value:t[n]}}:void 0}function aa(e,t,n){var i,r,o,s;const{config:a,encoding:u,markDef:c}=e,l="x"===t?"x2":"y2",d="x"===t?"width":"height",f=u[t],p=u[l],g=e.getScaleComponent(t),h=g?g.get("type"):void 0,m=e.scaleName(t),b=c.orient,v=null!=(s=null!=(o=null!=(r=null!=(i=u[d])?i:u.size)?r:c[d])?o:c.size)?s:ci("size",c,a,{vgChannel:d}),y="x"===t?"vertical"===b:"horizontal"===b;if(zi(f)&&(cr(f.bin)||lr(f.bin)||f.timeUnit&&!p)&&!v&&!Gn(h)){return function({fieldDef:e,fieldDef2:t,channel:n,band:i,scaleName:r,markDef:o,spacing:s=0,reverse:a}){const u={x:a?s:0,x2:a?0:s,y:a?0:s,y2:a?s:0},c=n===Ie?Ge:Ye;return cr(e.bin)||e.timeUnit?{[c]:la({channel:n,fieldDef:e,scaleName:r,markDef:o,band:(1-i)/2,offset:u[`${n}2`]}),[n]:la({channel:n,fieldDef:e,scaleName:r,markDef:o,band:1-(1-i)/2,offset:u[n]})}:lr(e.bin)&&zi(t)?{[c]:Ws(e,r,{},{offset:u[`${n}2`]}),[n]:Ws(t,r,{},{offset:u[n]})}:void Qt(Ht.channelRequiredForBinned(c))}({fieldDef:f,fieldDef2:p,channel:t,markDef:c,scaleName:m,band:$i(t,f,void 0,c,a),spacing:oe(c.binSpacing,a[n].binSpacing),reverse:g.get("reverse")})}if((zi(f)&&Gn(h)||y)&&!p){if(zi(f)&&h===zn.BAND){return function(e,t,n,i){var r;const o=n.scaleName(t),s="x"===t?"width":"height",{markDef:a,encoding:u,config:c}=n,l={[ia(t,a,c)]:Ws(e,o,{},{band:.5})};if(u.size||null!==a.size&&void 0!==a.size){if(a.orient){if(Ki(u.size)||Mi(u.size))return Object.assign(Object.assign({},l),Gs("size",n,{vgChannel:s}));if(void 0!==a.size)return Object.assign(Object.assign({},l),{[s]:{value:a.size}})}else Qt(Ht.cannotApplySizeToNonOrientedMark(a.type))}if(void 0!==(null===(r=i)||void 0===r?void 0:r.value))return Object.assign(Object.assign({},l),{[s]:i});const{band:d=1}=e;return{[t]:Ws(e,o,{binSuffix:"range"},{band:(1-d)/2}),[s]:null!=i?i:ca(o,d)}}(f,t,e,ua(n,c,d,m,g,a,Ri(f)?f.band:void 0))}return function(e,t,n){const i="x"===e?"xc":"yc",r="x"===e?"width":"height";return Object.assign(Object.assign({},Ks(e,t,{defaultPos:"mid",vgChannel:i})),Gs("size",t,{defaultRef:n,vgChannel:r}))}(t,e,ua(n,c,d,m,g,a))}return oa(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function ua(e,t,n,i,r,o,s){const a=oe(t[n],t.size,ci("size",t,o,{vgChannel:n}));if(void 0!==a)return{value:a};if(r){const t=r.get("type");if("point"===t||"band"===t){if(void 0!==o[e].discreteBandSize)return{value:o[e].discreteBandSize};if(t===zn.POINT){const e=r.get("range");return ds(e)&&F(e.step)?{value:e.step-2}:{value:uo-2}}return ca(i,s)}return{value:o[e].continuousBandSize}}const u=so(o.view,n);return{value:oe(o[e].discreteBandSize,u-2)}}function ca(e,t=!0){return{scale:e,band:t}}function la({channel:e,fieldDef:t,scaleName:n,markDef:i,band:r,offset:o}){return Us({fieldDef:t,channel:e,markDef:i,ref:qs({scaleName:n,fieldDef:t,band:r,offset:o})})}function da(e,t){const{fill:n,stroke:i}="include"===t.color?Ys(e):{};return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},function(e,t){return ps.reduce((n,i)=>(void 0!==e[i]&&"ignore"!==t[i]&&(n[i]={value:e[i]}),n),{})}(e.markDef,t)),fa(e,"fill",n)),fa(e,"stroke",i)),Gs("opacity",e)),Gs("fillOpacity",e)),Gs("strokeOpacity",e)),Gs("strokeWidth",e)),Qs(e)),Vs(e,"href"))}function fa(e,t,n){const{config:i,mark:r,markDef:o}=e;if("hide"===ui("invalid",o,i)&&n&&!Ae(r)){const i=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&Yn(r)&&(t[o]=!0)}return t},{}),r=Y(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ls(e,t)).join(` ${e} `)}return}(e,{invalid:!0,channels:Ut});if(i)return{[t]:[{test:i,value:null},...x(n)]}}return n?{[t]:n}:{}}function pa(e){const{config:t,markDef:n}=e;if(ui("invalid",n,t)){const t=function(e,{invalid:t=!1,channels:n}){const i=n.reduce((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&Yn(r)&&(t[o]=!0)}return t},{}),r=Y(i);if(r.length>0){const e=t?"||":"&&";return r.map(e=>Ls(e,t)).join(` ${e} `)}return}(e,{channels:["x","y"]});if(t)return{defined:{signal:t}}}return{}}function ga(e,t){if(void 0!==t)return{[e]:{value:t}}}const ha={has:e=>"interval"!==e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName("voronoi")},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(Ae(o))return Qt(Ht.nearestNotSupportForContinuous(o)),n;const s={name:e.getName("voronoi"),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:Object.assign({fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0}},Qs(e,{reactiveGeom:!0}))},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,u=!1;return n.forEach((t,n)=>{var i;const r=null!=(i=t.name)?i:"";r===e.component.mark[0].name?a=n:r.indexOf("voronoi")>=0&&(u=!0)}),u||n.splice(a+1,0,s),n}};class ma{constructor(e,t){this.debugName=t,this._children=[],this._parent=null,e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.indexOf(e)>-1?console.warn("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this),e.parent.removeChild(e),this.parent=t,e.parent=this}}class ba extends ma{constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,this._source=this._name=t,!this.refCounts||this._name in this.refCounts||(this.refCounts[this._name]=0)}clone(){const e=new this.constructor;return e.debugName="clone_"+this.debugName,e._source=this._source,e._name="clone_"+this._name,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${function(e){const t=++se;return e?String(e)+t:t}()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}class va extends ma{constructor(e,t){super(e),this.formula=t}clone(){return new va(null,N(this.formula))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{const{timeUnit:r,field:o}=n,s=vf(t)?t.encoding[St(i)]:void 0,a=vf(t)&&Bi(i,n,s,t.markDef,t.config);if(r){const t=Wi(n,{forAs:!0});e[P({as:t,timeUnit:r,field:o})]=Object.assign({as:t,timeUnit:r,field:o},a?{band:!0}:{})}return e},{});return 0===Y(n).length?null:new va(e,n)}static makeFromTransform(e,t){const n=Object.assign({},t);return new va(e,{[P(n)]:n})}merge(e){this.formula=Object.assign({},this.formula);for(const t in e.formula)this.formula[t]&&!e.formula[t].band||(this.formula[t]=e.formula[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(V(this.formula).map(e=>e.as))}dependentFields(){return new Set(V(this.formula).map(e=>e.field))}hash(){return`TimeUnit ${P(this.formula)}`}assemble(){const e=[];for(const t of V(this.formula)){const{timeUnit:n,field:i,as:r}=t;e.push({field:i,type:"timeunit",units:fn(n),as:[r,`${r}_end`]})}return e}}const ya="_tuple_fields";class xa{constructor(...e){this.items=e,this.hasChannel={},this.hasField={}}}const Aa={has:e=>"single"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!Xr(e.bind),parse:(e,t,n,i)=>{i.on||delete t.events,i.clear||delete t.clear},topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,s=t.init&&t.init[0],a=ha.has(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((e,r)=>{var c,l;const d=Q(`${i}_${e.field}`);n.filter(e=>e.name===d).length||n.unshift(Object.assign(Object.assign({name:d},s?{init:Ma(s[r])}:{value:null}),{on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${u(e.field)}] : null`}]:[],bind:(c=o[e.field],l=null!=c?c:o[e.channel],null!=l?l:o)}))}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter(e=>e.name===i+Ja)[0],s=i+ya,a=r.items.map(e=>Q(`${i}_${e.field}`)),u=a.map(e=>`${e} !== null`).join(" && ");return a.length&&(o.update=`${u} ? {fields: ${s}, values: [${a.join(", ")}]} : null`),delete o.value,delete o.on,n}},Oa={has:e=>"multi"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+"_toggle",value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Ja,i=t.name+"_toggle";return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${eu(e)}}, `)+`${i} ? ${n} : null`}},wa={has:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,t,n)=>{n.clear&&(t.clear=a(n.clear)?xs(n.clear,"scope"):n.clear)},topLevelSignals:(e,t,n)=>(Aa.has(t)&&t.project.items.forEach(e=>{const i=n.findIndex(n=>n.name===Q(`${t.name}_${e.field}`));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}),n),signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)t.project.items.forEach(e=>{const t=n.findIndex(t=>t.name===e.signals.visual);if(i(t,"[0, 0]"),-1===t){i(n.findIndex(t=>t.name===e.signals.data),"null")}});else{let e=n.findIndex(e=>e.name===t.name+Ja);i(e,"null"),Oa.has(t)&&(e=n.findIndex(e=>e.name===t.name+"_toggle"),i(e,"false"))}return n}},Fa={has:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Rt(r))continue;const o=e.getScaleComponent(r),s=o?o.get("type"):void 0;if(!o||!Yn(s)){Qt(Ht.SCALE_BINDINGS_CONTINUOUS);continue}const a={selection:t.name,field:i.field};if(o.set("selectionExtent",a,!0),n.push(i),e.repeater&&e.repeater.row===e.repeater.column){e.getScaleComponent(r===Ie?He:Ie).set("selectionExtent",a,!0)}}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(e=>0===n.filter(t=>t.name===e.signals.data).length);if(!e.parent||ja(e)||0===i.length)return n;const r=n.filter(e=>e.name===t.name)[0];let o=r.update;if(o.indexOf(Xa)>=0)r.update=`{${i.map(e=>`${u(e.field)}: ${e.signals.data}`).join(", ")}}`;else{for(const e of i){const t=`${u(e.field)}: ${e.signals.data}`;o.indexOf(t)<0&&(o=`${o.substring(0,o.length-1)}, ${t}}`)}r.update=o}return n.concat(i.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!ja(e))for(const e of t.scales){const t=n.filter(t=>t.name===e.signals.data)[0];t.push="outer",delete t.value,delete t.update}return n}};function Ca(e,t){return`domain(${u(e.scaleName(t))})`}function ja(e){var t;return e.parent&&Of(e.parent)&&(null!=(t=!e.parent.parent)?t:ja(e.parent.parent))}const Da={has:e=>{const t="global"===e.resolve&&e.bind&&Xr(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==Jr;return t&&!n&&Qt(Ht.LEGEND_BINDINGS_PROJECT_LENGTH),t&&n},parse:(e,t,n,i)=>{var r;if(i.on||delete t.events,i.clear||delete t.clear,i.on||i.clear){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const n of t.events)n.filter=x(null!=(r=n.filter)?r:[]),n.filter.indexOf(e)<0&&n.filter.push(e)}const o=Zr(t.bind)?t.bind.legend:"click",s=a(o)?xs(o,"view"):x(o);t.bind={legend:{merge:s}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Zr(t.bind)&&t.bind.legend,o=e=>t=>{const n=N(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const s=`${e.field}_legend`,a=`${i}_${s}`;if(0===n.filter(e=>e.name===a).length){const e=r.merge.map(o(`${s}_symbols`)).concat(r.merge.map(o(`${s}_labels`))).concat(r.merge.map(o(`${s}_entries`)));n.unshift(Object.assign(Object.assign({name:a},t.init?{}:{value:null}),{on:[{events:e,update:"datum.value || item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${a}`,force:!0}]}))}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(e=>e.name===i+Ja),s=i+ya,a=r.items.filter(e=>e.hasLegend).map(e=>Q(`${i}_${e.field}_legend`)),u=`${a.map(e=>`${e} !== null`).join(" && ")} ? {fields: ${s}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?o.on.push({events:a.map(e=>({signal:e})),update:u}):a.length>0&&(o.update=u,delete o.value,delete o.on);const c=n.find(e=>e.name===i+"_toggle"),l=Zr(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push(Object.assign(Object.assign({},c.on[0]),{events:l})):c.on[0].events=l),n}};const Ea="_translate_anchor",Sa="_translate_delta",ka={has:e=>"interval"===e.type&&e.translate,signals:(e,t,n)=>{const i=t.name,r=Fa.has(t),o=i+Ea,{x:s,y:a}=t.project.hasChannel;let u=xs(t.translate,"scope");return r||(u=u.map(e=>(e.between[0].markname=i+La,e))),n.push({name:o,value:{},on:[{events:u.map(e=>e.between[0]),update:"{x: x(unit), y: y(unit)"+(void 0!==s?", extent_x: "+(r?Ca(e,Ie):`slice(${s.signals.visual})`):"")+(void 0!==a?", extent_y: "+(r?Ca(e,He):`slice(${a.signals.visual})`):"")+"}"}]},{name:i+Sa,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==s&&$a(e,t,s,"width",n),void 0!==a&&$a(e,t,a,"height",n),n}};function $a(e,t,n,i,r){var o;const s=t.name,a=s+Ea,u=s+Sa,c=n.channel,l=Fa.has(t),d=r.filter(e=>e.name===n.signals[l?"data":"visual"])[0],f=e.getSizeSignalRef(i).signal,p=e.getScaleComponent(c),g=p.get("type"),h=`${a}.extent_${c}`,m=`${l?"log"===g?"panLog":"pow"===g?"panPow":"panLinear":"panLinear"}(${h}, ${`${l&&c===Ie?"-":""}${u}.${c} / `+(l?`${f}`:`span(${h})`)}`+(l&&"pow"===g?`, ${o=p.get("exponent"),null!=o?o:1}`:"")+")";d.on.push({events:{signal:u},update:l?m:`clampRange(${m}, 0, ${f})`})}const Ba="_zoom_anchor",Na="_zoom_delta",_a={has:e=>"interval"===e.type&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=Fa.has(t),o=i+Na,{x:s,y:a}=t.project.hasChannel,c=u(e.scaleName(Ie)),l=u(e.scaleName(He));let d=xs(t.zoom,"scope");return r||(d=d.map(e=>(e.markname=i+La,e))),n.push({name:i+Ba,on:[{events:d,update:r?"{"+[c?`x: invert(${c}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(e=>!!e).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:d,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&za(e,t,s,"width",n),void 0!==a&&za(e,t,a,"height",n),n}};function za(e,t,n,i,r){var o;const s=t.name,a=n.channel,u=Fa.has(t),c=r.filter(e=>e.name===n.signals[u?"data":"visual"])[0],l=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(a),f=d.get("type"),p=u?Ca(e,a):c.name,g=s+Na,h=`${u?"log"===f?"zoomLog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${p}, ${`${s}${Ba}.${a}`}, ${g}`+(u&&"pow"===f?`, ${o=d.get("exponent"),null!=o?o:1}`:"")+")";c.on.push({events:{signal:g},update:u?h:`clampRange(${h}, 0, ${l})`})}const Ta=[{has:()=>!0,parse:(e,t,n)=>{var i,r,s;const a=t.name,u=null!=(i=t.project)?i:t.project=new xa,c={},l={},d=new Set,f=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=Q(`${a}_${n}`);for(let e=1;d.has(i);e++)i=Q(`${a}_${n}_${e}`);return d.add(i),{[t]:i}};if(!n.fields&&!n.encodings){const t=e.config.selection[n.type];if(n.init)for(const e of x(n.init))for(const i of Y(e))Ft(i)?(n.encodings||(n.encodings=[])).push(i):"interval"===n.type?(Qt('Interval selections should be initialized using "x" and/or "y" keys.'),n.encodings=t.encodings):(n.fields||(n.fields=[])).push(i);else n.encodings=t.encodings,n.fields=t.fields}for(const e of null!=(r=n.fields)?r:[]){const t={type:"E",field:e};t.signals=Object.assign({},f(t,"data")),u.items.push(t),u.hasField[e]=t}for(const i of null!=(s=n.encodings)?s:[]){const n=e.fieldDef(i);if(n){let r=n.field;if(n.aggregate){Qt(Ht.cannotProjectAggregate(i,n.aggregate));continue}if(!r){Qt(Ht.cannotProjectOnChannelWithoutField(i));continue}if(n.timeUnit){r=e.vgField(i);const t={as:r,field:n.field,timeUnit:n.timeUnit};l[P(t)]=t}if(!c[r]){let o="E";if("interval"===t.type){Yn(e.getScaleComponent(i).get("type"))&&(o="R")}else n.bin&&(o="R-RE");const s={field:r,channel:i,type:o};s.signals=Object.assign(Object.assign({},f(s,"data")),f(s,"visual")),u.items.push(c[r]=s),u.hasField[r]=u.hasChannel[i]=c[r]}}else Qt(Ht.cannotProjectOnChannelWithoutField(i))}if(n.init){const e=e=>u.items.map(t=>void 0!==e[t.channel]?e[t.channel]:e[t.field]);if("interval"===n.type)t.init=e(n.init);else{const i=o(n.init)?n.init:[n.init];t.init=i.map(e)}}Y(l).length>0&&(u.timeUnit=new va(null,l))},signals:(e,t,n)=>{const i=t.name+ya;return n.filter(e=>e.name===i).length>0?n:n.concat({name:i,value:t.project.items.map(e=>{const t=$e(e,["signals","hasLegend"]),n=N(t);return n.field=te(n.field),n})})}},Oa,Fa,Da,ka,_a,Aa,ha,wa];function Pa(e,t){for(const n of Ta)n.has(e)&&t(n)}function Ma(e,t=!0,n=l){if(o(e)){const i=e.map(e=>Ma(e,t,n));return t?`[${i.join(", ")}]`:i}return Zt(e)?n(rn(e,!1,!t)):t?n(JSON.stringify(e)):e}function Ua(e,t){return Ka(e,(n,i)=>{t=i.marks?i.marks(e,n,t):t,Pa(n,i=>{i.marks&&(t=i.marks(e,n,t))})}),t}function Ra(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const La="_brush",Wa="_scale_trigger",qa={signals:(e,t)=>{const n=t.name,i=n+ya,r=Fa.has(t),o=[],s=[],a=[];if(t.translate&&!r){const e=`!event.item || event.item.mark.name !== ${u(n+La)}`;Ia(t,(t,n)=>{var i;const r=x(null!=(i=n.between[0].filter)?i:n.between[0].filter=[]);return r.indexOf(e)<0&&r.push(e),t})}t.project.items.forEach((n,i)=>{const r=n.channel;if(r!==Ie&&r!==He)return void Qt("Interval selections only support x and y encoding channels.");const c=t.init?t.init[i]:null,l=function(e,t,n,i){const r=n.channel,o=n.signals.visual,s=n.signals.data,a=Fa.has(t),c=u(e.scaleName(r)),l=e.getScaleComponent(r),d=l?l.get("type"):void 0,f=e=>`scale(${c}, ${e})`,p=e.getSizeSignalRef(r===Ie?"width":"height").signal,g=`${r}(unit)`,h=Ia(t,(e,t)=>[...e,{events:t.between[0],update:`[${g}, ${g}]`},{events:t,update:`[${o}[0], clamp(${g}, 0, ${p})]`}]);return h.push({events:{signal:t.name+Wa},update:Yn(d)?`[${f(`${s}[0]`)}, ${f(`${s}[1]`)}]`:"[0, 0]"}),a?[{name:s,on:[]}]:[Object.assign(Object.assign({name:o},i?{init:Ma(i,!0,f)}:{value:[]}),{on:h}),Object.assign(Object.assign({name:s},i?{init:Ma(i)}:{}),{on:[{events:{signal:o},update:`${o}[0] === ${o}[1] ? null : invert(${c}, ${o})`}]})]}(e,t,n,c),d=n.signals.data,f=n.signals.visual,p=u(e.scaleName(r)),g=Yn(e.getScaleComponent(r).get("type"))?"+":"";o.push(...l),s.push(d),a.push({scaleName:e.scaleName(r),expr:`(!isArray(${d}) || `+`(${g}invert(${p}, ${f})[0] === ${g}${d}[0] && `+`${g}invert(${p}, ${f})[1] === ${g}${d}[1]))`})}),r||o.push({name:n+Wa,value:{},on:[{events:a.map(e=>({scale:e.scaleName})),update:a.map(e=>e.expr).join(" && ")+` ? ${n+Wa} : {}`}]});const c=t.init,l=`unit: ${eu(e)}, fields: ${i}, values`;return o.concat(Object.assign(Object.assign({name:n+Ja},c?{init:`{${l}: ${Ma(c)}}`}:{}),{on:[{events:[{signal:s.join(" || ")}],update:s.join(" && ")+` ? {${l}: [${s}]} : null`}]}))},modifyExpr:(e,t)=>{return t.name+Ja+", "+("global"===t.resolve?"true":`{unit: ${eu(e)}}`)},marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,s=r&&r.signals.visual,a=o&&o.signals.visual,c=`data(${u(t.name+Va)})`;if(Fa.has(t))return n;const l={x:void 0!==r?{signal:`${s}[0]`}:{value:0},y:void 0!==o?{signal:`${a}[0]`}:{value:0},x2:void 0!==r?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${a}[1]`}:{field:{group:"height"}}};if("global"===t.resolve)for(const t of Y(l))l[t]=[Object.assign({test:`${c}.length && ${c}[0].unit === ${eu(e)}`},l[t]),{value:0}];const d=t.mark,{fill:f,fillOpacity:p}=d,g=$e(d,["fill","fillOpacity"]),h=Y(g).reduce((e,t)=>(e[t]=[{test:[void 0!==r&&`${s}[0] !== ${s}[1]`,void 0!==o&&`${a}[0] !== ${a}[1]`].filter(e=>e).join(" && "),value:g[t]},{value:null}],e),{});return[{name:i+La+"_bg",type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:p}},update:l}},...n,{name:i+La,type:"rect",clip:!0,encode:{enter:{fill:{value:"transparent"}},update:Object.assign(Object.assign({},l),h)}}]}};function Ia(e,t){return e.events.reduce((e,n)=>n.between?t(e,n):(Qt(`${n} is not an ordered event stream for interval selections.`),e),[])}function Ha(e,t){const n=t.name,i=n+ya,r=t.project,o="(item().isVoronoi ? datum.datum : datum)",s=r.items.map(t=>{const n=e.fieldDef(t.channel);return n&&n.bin?`[${o}[${u(e.vgField(t.channel,{}))}], `+`${o}[${u(e.vgField(t.channel,{binSuffix:"end"}))}]]`:`${o}[${u(t.field)}]`}).join(", "),a=`unit: ${eu(e)}, fields: ${i}, values`,c=t.events;return[{name:n+Ja,on:c?[{events:c,update:`datum && item().mark.marktype !== 'group' ? {${a}: [${s}]} : null`,force:!0}]:[]}]}const Ga={signals:Ha,modifyExpr:(e,t)=>{return t.name+Ja+", "+("global"===t.resolve?"null":`{unit: ${eu(e)}}`)}},Ya={signals:Ha,modifyExpr:(e,t)=>{return t.name+Ja+", "+("global"===t.resolve?"true":`{unit: ${eu(e)}}`)}},Va="_store",Ja="_tuple",Qa="_modify",Xa="vlSelectionResolve",Za={single:Ya,multi:Ga,interval:qa};function Ka(e,t){const n=e.component.selection;if(n)for(const e in n)if(O(n,e)){const i=n[e];if(!0===t(i,Za[i.type]))break}}function eu(e,{escape:t}={escape:!0}){let n=t?u(e.name):e.name;const i=function(e){let t=e.parent;for(;t&&!yf(t);)t=t.parent;return t}(e);if(i){const{facet:e}=i;for(const t of yt)e[t]&&(n+=` + '__facet_${t}_' + (facet[${u(i.vgField(t))}])`)}return n}function tu(e){let t=!1;return Ka(e,e=>{t=t||e.project.items.some(e=>e.field===Jr)}),t}var nu,iu,ru,ou,su,au="RawCode",uu="Literal",cu="Property",lu="Identifier",du="ArrayExpression",fu="BinaryExpression",pu="CallExpression",gu="ConditionalExpression",hu="LogicalExpression",mu="MemberExpression",bu="ObjectExpression",vu="UnaryExpression";function yu(e){this.type=e}yu.prototype.visit=function(e){var t,n,i;if(e(this))return 1;for(n=0,i=(t=function(e){switch(e.type){case du:return e.elements;case fu:case hu:return[e.left,e.right];case pu:var t=e.arguments.slice();return t.unshift(e.callee),t;case gu:return[e.test,e.consequent,e.alternate];case mu:return[e.object,e.property];case bu:return e.properties;case cu:return[e.key,e.value];case vu:return[e.argument];case lu:case uu:case au:default:return[]}}(this)).length;n<i;++n)if(t[n].visit(e))return 1};var xu=1,Au=2,Ou=3,wu=4,Fu=5,Cu=6,ju=7,Du=8;(nu={})[xu]="Boolean",nu[Au]="<end>",nu[Ou]="Identifier",nu[wu]="Keyword",nu[Fu]="Null",nu[Cu]="Numeric",nu[ju]="Punctuator",nu[Du]="String",nu[9]="RegularExpression";var Eu="ArrayExpression",Su="BinaryExpression",ku="CallExpression",$u="ConditionalExpression",Bu="Identifier",Nu="Literal",_u="LogicalExpression",zu="MemberExpression",Tu="ObjectExpression",Pu="Property",Mu="UnaryExpression",Uu="Unexpected token %0",Ru="Unexpected number",Lu="Unexpected string",Wu="Unexpected identifier",qu="Unexpected reserved word",Iu="Unexpected end of input",Hu="Invalid regular expression",Gu="Invalid regular expression: missing /",Yu="Octal literals are not allowed in strict mode.",Vu="Duplicate data property in object literal not allowed in strict mode",Ju="ILLEGAL",Qu="Disabled.",Xu=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]"),Zu=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 Ku(e,t){if(!e)throw new Error("ASSERT: "+t)}function ec(e){return e>=48&&e<=57}function tc(e){return"0123456789abcdefABCDEF".indexOf(e)>=0}function nc(e){return"01234567".indexOf(e)>=0}function ic(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(e)>=0}function rc(e){return 10===e||13===e||8232===e||8233===e}function oc(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||92===e||e>=128&&Xu.test(String.fromCharCode(e))}function sc(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||92===e||e>=128&&Zu.test(String.fromCharCode(e))}var ac={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 uc(){for(var e;ru<ou&&(ic(e=iu.charCodeAt(ru))||rc(e));)++ru}function cc(e){var t,n,i,r=0;for(n="u"===e?4:2,t=0;t<n;++t)ru<ou&&tc(iu[ru])?(i=iu[ru++],r=16*r+"0123456789abcdef".indexOf(i.toLowerCase())):Cc({},Uu,Ju);return String.fromCharCode(r)}function lc(){var e,t,n,i;for(t=0,"}"===(e=iu[ru])&&Cc({},Uu,Ju);ru<ou&&tc(e=iu[ru++]);)t=16*t+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||"}"!==e)&&Cc({},Uu,Ju),t<=65535?String.fromCharCode(t):(n=55296+(t-65536>>10),i=56320+(t-65536&1023),String.fromCharCode(n,i))}function dc(){var e,t;for(e=iu.charCodeAt(ru++),t=String.fromCharCode(e),92===e&&(117!==iu.charCodeAt(ru)&&Cc({},Uu,Ju),++ru,(e=cc("u"))&&"\\"!==e&&oc(e.charCodeAt(0))||Cc({},Uu,Ju),t=e);ru<ou&&sc(e=iu.charCodeAt(ru));)++ru,t+=String.fromCharCode(e),92===e&&(t=t.substr(0,t.length-1),117!==iu.charCodeAt(ru)&&Cc({},Uu,Ju),++ru,(e=cc("u"))&&"\\"!==e&&sc(e.charCodeAt(0))||Cc({},Uu,Ju),t+=e);return t}function fc(){var e,t;return e=ru,{type:1===(t=92===iu.charCodeAt(ru)?dc():function(){var e,t;for(e=ru++;ru<ou;){if(92===(t=iu.charCodeAt(ru)))return ru=e,dc();if(!sc(t))break;++ru}return iu.slice(e,ru)}()).length?Ou:ac.hasOwnProperty(t)?wu:"null"===t?Fu:"true"===t||"false"===t?xu:Ou,value:t,start:e,end:ru}}function pc(){var e,t,n,i,r=ru,o=iu.charCodeAt(ru),s=iu[ru];switch(o){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++ru,{type:ju,value:String.fromCharCode(o),start:r,end:ru};default:if(61===(e=iu.charCodeAt(ru+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return ru+=2,{type:ju,value:String.fromCharCode(o)+String.fromCharCode(e),start:r,end:ru};case 33:case 61:return ru+=2,61===iu.charCodeAt(ru)&&++ru,{type:ju,value:iu.slice(r,ru),start:r,end:ru}}}return">>>="===(i=iu.substr(ru,4))?{type:ju,value:i,start:r,end:ru+=4}:">>>"===(n=i.substr(0,3))||"<<="===n||">>="===n?{type:ju,value:n,start:r,end:ru+=3}:s===(t=n.substr(0,2))[1]&&"+-<>&|".indexOf(s)>=0||"=>"===t?{type:ju,value:t,start:r,end:ru+=2}:"<>=!+-*%&|^/".indexOf(s)>=0?(++ru,{type:ju,value:s,start:r,end:ru}):void Cc({},Uu,Ju)}function gc(){var e,t,n;if(Ku(ec((n=iu[ru]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),t=ru,e="","."!==n){if(e=iu[ru++],n=iu[ru],"0"===e){if("x"===n||"X"===n)return++ru,function(e){for(var t="";ru<ou&&tc(iu[ru]);)t+=iu[ru++];return 0===t.length&&Cc({},Uu,Ju),oc(iu.charCodeAt(ru))&&Cc({},Uu,Ju),{type:Cu,value:parseInt("0x"+t,16),start:e,end:ru}}(t);if(nc(n))return function(e){for(var t="0"+iu[ru++];ru<ou&&nc(iu[ru]);)t+=iu[ru++];return(oc(iu.charCodeAt(ru))||ec(iu.charCodeAt(ru)))&&Cc({},Uu,Ju),{type:Cu,value:parseInt(t,8),octal:!0,start:e,end:ru}}(t);n&&ec(n.charCodeAt(0))&&Cc({},Uu,Ju)}for(;ec(iu.charCodeAt(ru));)e+=iu[ru++];n=iu[ru]}if("."===n){for(e+=iu[ru++];ec(iu.charCodeAt(ru));)e+=iu[ru++];n=iu[ru]}if("e"===n||"E"===n)if(e+=iu[ru++],"+"!==(n=iu[ru])&&"-"!==n||(e+=iu[ru++]),ec(iu.charCodeAt(ru)))for(;ec(iu.charCodeAt(ru));)e+=iu[ru++];else Cc({},Uu,Ju);return oc(iu.charCodeAt(ru))&&Cc({},Uu,Ju),{type:Cu,value:parseFloat(e),start:t,end:ru}}function hc(){var e,t,n,i;return su=null,uc(),e=ru,t=function(){var e,t,n,i;for(Ku("/"===(e=iu[ru]),"Regular expression literal must start with a slash"),t=iu[ru++],n=!1,i=!1;ru<ou;)if(t+=e=iu[ru++],"\\"===e)rc((e=iu[ru++]).charCodeAt(0))&&Cc({},Gu),t+=e;else if(rc(e.charCodeAt(0)))Cc({},Gu);else if(n)"]"===e&&(n=!1);else{if("/"===e){i=!0;break}"["===e&&(n=!0)}return i||Cc({},Gu),{value:t.substr(1,t.length-2),literal:t}}(),n=function(){var e,t,n;for(t="",n="";ru<ou&&sc((e=iu[ru]).charCodeAt(0));)++ru,"\\"===e&&ru<ou?Cc({},Uu,Ju):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&Cc({},Hu,n),{value:n,literal:t}}(),i=function(e,t){var n=e;t.indexOf("u")>=0&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(function(e,t){if(parseInt(t,16)<=1114111)return"x";Cc({},Hu)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(e){Cc({},Hu)}try{return new RegExp(e,t)}catch(e){return null}}(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:ru}}function mc(){var e;return uc(),ru>=ou?{type:Au,start:ru,end:ru}:oc(e=iu.charCodeAt(ru))?fc():40===e||41===e||59===e?pc():39===e||34===e?function(){var e,t,n,i,r="",o=!1;for(Ku("'"===(e=iu[ru])||'"'===e,"String literal must starts with a quote"),t=ru,++ru;ru<ou;){if((n=iu[ru++])===e){e="";break}if("\\"===n)if((n=iu[ru++])&&rc(n.charCodeAt(0)))"\r"===n&&"\n"===iu[ru]&&++ru;else switch(n){case"u":case"x":"{"===iu[ru]?(++ru,r+=lc()):r+=cc(n);break;case"n":r+="\n";break;case"r":r+="\r";break;case"t":r+="\t";break;case"b":r+="\b";break;case"f":r+="\f";break;case"v":r+="\v";break;default:nc(n)?(0!==(i="01234567".indexOf(n))&&(o=!0),ru<ou&&nc(iu[ru])&&(o=!0,i=8*i+"01234567".indexOf(iu[ru++]),"0123".indexOf(n)>=0&&ru<ou&&nc(iu[ru])&&(i=8*i+"01234567".indexOf(iu[ru++]))),r+=String.fromCharCode(i)):r+=n}else{if(rc(n.charCodeAt(0)))break;r+=n}}return""!==e&&Cc({},Uu,Ju),{type:Du,value:r,octal:o,start:t,end:ru}}():46===e?ec(iu.charCodeAt(ru+1))?gc():pc():ec(e)?gc():pc()}function bc(){var e;return ru=(e=su).end,su=mc(),ru=e.end,e}function vc(){var e;e=ru,su=mc(),ru=e}function yc(e,t,n){var i=new yu("||"===e||"&&"===e?_u:Su);return i.operator=e,i.left=t,i.right=n,i}function xc(e,t){var n=new yu(ku);return n.callee=e,n.arguments=t,n}function Ac(e){var t=new yu(Bu);return t.name=e,t}function Oc(e){var t=new yu(Nu);return t.value=e.value,t.raw=iu.slice(e.start,e.end),e.regex&&("//"===t.raw&&(t.raw="/(?:)/"),t.regex=e.regex),t}function wc(e,t,n){var i=new yu(zu);return i.computed="["===e,i.object=t,i.property=n,i.computed||(n.member=!0),i}function Fc(e,t,n){var i=new yu(Pu);return i.key=t,i.value=n,i.kind=e,i}function Cc(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(function(e,t){return Ku(t<i.length,"Message reference must be in range"),i[t]}));throw(n=new Error(r)).index=ru,n.description=r,n}function jc(e){e.type===Au&&Cc(e,Iu),e.type===Cu&&Cc(e,Ru),e.type===Du&&Cc(e,Lu),e.type===Ou&&Cc(e,Wu),e.type===wu&&Cc(e,qu),Cc(e,Uu,e.value)}function Dc(e){var t=bc();t.type===ju&&t.value===e||jc(t)}function Ec(e){return su.type===ju&&su.value===e}function Sc(e){return su.type===wu&&su.value===e}function kc(){var e=[];for(ru=su.start,Dc("[");!Ec("]");)Ec(",")?(bc(),e.push(null)):(e.push(Wc()),Ec("]")||Dc(","));return bc(),function(e){var t=new yu(Eu);return t.elements=e,t}(e)}function $c(){var e;return ru=su.start,(e=bc()).type===Du||e.type===Cu?(e.octal&&Cc(e,Yu),Oc(e)):Ac(e.value)}function Bc(){var e,t,n;return ru=su.start,(e=su).type===Ou?(n=$c(),Dc(":"),Fc("init",n,Wc())):e.type!==Au&&e.type!==ju?(t=$c(),Dc(":"),Fc("init",t,Wc())):void jc(e)}function Nc(){var e,t,n=[],i={},r=String;for(ru=su.start,Dc("{");!Ec("}");)t="$"+((e=Bc()).key.type===Bu?e.key.name:r(e.key.value)),Object.prototype.hasOwnProperty.call(i,t)?Cc({},Vu):i[t]=!0,n.push(e),Ec("}")||Dc(",");return Dc("}"),function(e){var t=new yu(Tu);return t.properties=e,t}(n)}var _c={if:1,this:1};function zc(){var e,t,n;if(Ec("("))return function(){var e;return Dc("("),e=qc(),Dc(")"),e}();if(Ec("["))return kc();if(Ec("{"))return Nc();if(e=su.type,ru=su.start,e===Ou||_c[su.value])n=Ac(bc().value);else if(e===Du||e===Cu)su.octal&&Cc(su,Yu),n=Oc(bc());else{if(e===wu)throw new Error(Qu);e===xu?((t=bc()).value="true"===t.value,n=Oc(t)):e===Fu?((t=bc()).value=null,n=Oc(t)):Ec("/")||Ec("/=")?(n=Oc(hc()),vc()):jc(bc())}return n}function Tc(){var e=[];if(Dc("("),!Ec(")"))for(;ru<ou&&(e.push(Wc()),!Ec(")"));)Dc(",");return Dc(")"),e}function Pc(){var e;return ru=su.start,function(e){return e.type===Ou||e.type===wu||e.type===xu||e.type===Fu}(e=bc())||jc(e),Ac(e.value)}function Mc(){var e;return Dc("["),e=qc(),Dc("]"),e}function Uc(){var e=function(){var e;for(e=zc();;)if(Ec("."))Dc("."),e=wc(".",e,Pc());else if(Ec("("))e=xc(e,Tc());else{if(!Ec("["))break;e=wc("[",e,Mc())}return e}();if(su.type===ju&&(Ec("++")||Ec("--")))throw new Error(Qu);return e}function Rc(){var e,t,n,i,r;if(su.type!==ju&&su.type!==wu)t=Uc();else{if(Ec("++")||Ec("--"))throw new Error(Qu);if(Ec("+")||Ec("-")||Ec("~")||Ec("!"))e=bc(),t=Rc(),n=e.value,i=t,(r=new yu(Mu)).operator=n,r.argument=i,r.prefix=!0,t=r;else{if(Sc("delete")||Sc("void")||Sc("typeof"))throw new Error(Qu);t=Uc()}}return t}function Lc(e){var t=0;if(e.type!==ju&&e.type!==wu)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11}return t}function Wc(){var e,t;return e=function(){var e,t,n,i,r,o,s,a,u,c;if(e=su,u=Rc(),0===(r=Lc(i=su)))return u;for(i.prec=r,bc(),t=[e,su],o=[u,i,s=Rc()];(r=Lc(su))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)s=o.pop(),a=o.pop().value,u=o.pop(),t.pop(),n=yc(a,u,s),o.push(n);(i=bc()).prec=r,o.push(i),t.push(su),n=Rc(),o.push(n)}for(n=o[c=o.length-1],t.pop();c>1;)t.pop(),n=yc(o[c-1].value,o[c-2],n),c-=2;return n}(),Ec("?")&&(bc(),t=Wc(),Dc(":"),e=function(e,t,n){var i=new yu($u);return i.test=e,i.consequent=t,i.alternate=n,i}(e,t,Wc())),e}function qc(){var e=Wc();if(Ec(","))throw new Error(Qu);return e}function Ic(e){const t=function(e){ru=0,ou=(iu=e).length,su=null,vc();var t=qc();if(su.type!==Au)throw new Error("Unexpect token after expression.");return t}(e),n=new Set;return t.visit(e=>{"MemberExpression"===e.type&&function e(t){return"MemberExpression"===t.object.type?e(t.object):"datum"===t.object.name}(e)&&n.add(function e(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...e(t.object)),n.push(...e(t.property))),n)}(e).slice(1).join("."))}),n}class Hc extends ma{constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Vc(this.model,this.filter,this),this._dependentFields=Ic(this.expr)}clone(){return new Hc(null,this.model,N(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Gc(e,t,n,i="datum"){const r=[];const o=X(t,(function(t){const o=Q(t),s=e.getSelectionComponent(o,t),a=u(o+Va);if(s.project.timeUnit){const t=null!=n?n:e.component.data.raw,i=s.project.timeUnit.clone();t.parent?i.insertAsParentOf(t):t.parent=i}return"none"!==s.empty&&r.push(a),`vlSelectionTest(${a}, ${i}`+("global"===s.resolve?")":`, ${u(s.resolve)})`)}));return(r.length?"!("+r.map(e=>`length(data(${e}))`).join(" || ")+") || ":"")+`(${o})`}function Yc(e,t){const n=t.encoding;let i=t.field;if(n||i){if(n&&!i){const r=e.project.items.filter(e=>e.channel===n);!r.length||r.length>1?(i=e.project.items[0].field,Qt((r.length?"Multiple ":"No ")+`matching ${u(n)} encoding found for selection ${u(t.selection)}. `+`Using "field": ${u(i)}.`)):i=r[0].field}}else i=e.project.items[0].field,e.project.items.length>1&&Qt('A "field" or "encoding" must be specified when using a selection as a scale domain. '+`Using "field": ${u(i)}.`);return`${e.name}[${u(i)}]`}function Vc(e,t,n){return X(t,t=>a(t)?t:function(e){var t;return null===(t=e)||void 0===t?void 0:t.selection}(t)?Gc(e,t.selection,n):jn(t))}function Jc(e,t,n,i){var r,o,s;e.encode=null!=(r=e.encode)?r:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(s=e.encode[t].update)?s:{},e.encode[t].update[n]=i}function Qc(e,t,n,i={header:!1}){var r,s;const a=e.combine(),{orient:u,scale:c,labelExpr:l,title:d,zindex:f}=a,p=$e(a,["orient","scale","labelExpr","title","zindex"]);if(Y(p).forEach(e=>{const n=bs[e],i=p[e];if(n&&n!==t&&"both"!==n)delete p[e];else if(function(e){return e.condition}(i)){const{vgProp:t,part:n}=hs[e],{condition:r,value:s}=i,a=[...(o(r)?r:[r]).map(e=>{const{value:t,test:n}=e;return{test:Vc(null,n),value:t}}),{value:s}];Jc(p,n,t,a),delete p[e]}}),"grid"===t){if(!p.grid)return;if(p.encode){const{grid:e}=p.encode;p.encode=Object.assign({},e?{grid:e}:{}),0===Y(p.encode).length&&delete p.encode}return Object.assign(Object.assign({scale:c,orient:u},p),{domain:!1,labels:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:oe(f,0)})}{if(!i.header&&e.mainExtracted)return;if(void 0!==l){let e=l;(null===(s=null===(r=p.encode)||void 0===r?void 0:r.labels)||void 0===s?void 0:s.update)&&ls(p.encode.labels.update.text)&&(e=ne(l,"datum.label",p.encode.labels.update.text.signal)),Jc(p,"labels","text",{signal:e})}if(p.encode){for(const t of ms)e.hasAxisPart(t)||delete p.encode[t];0===Y(p.encode).length&&delete p.encode}const t=function(e,t){if(e)return oi(e)?e:e.map(e=>Qi(e,t)).join(", ")}(d,n);return Object.assign(Object.assign(Object.assign({scale:c,orient:u,grid:!1},t?{title:t}:{}),p),{zindex:oe(f,0)})}}function Xc(e){const{axes:t}=e.component;for(const n of Nt)if(t[n])for(const i of t[n])if(!i.get("gridScale")){const t="x"===n?"height":"width";return[{name:t,update:e.getSizeSignalRef(t).signal}]}return[]}const Zc={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},Kc={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelLimit:"limit",labelOrient:"orient",labelPadding:"offset"},el=Y(Zc),tl=Y(Kc);function nl(e,t,n,i,r){var o;const s=[..."band"===r?["axisBand"]:[],"x"===n?"axisX":"axisY",...i?["axis"+i.substr(0,1).toUpperCase()+i.substr(1)]:[],"axis"];for(const n of s)if(void 0!==(null===(o=t[n])||void 0===o?void 0:o[e]))return t[n][e]}function il(e,t){if(void 0!==e)return e=ae(e),"top"===t||"bottom"===t?e<=45||315<=e?"top"===t?"bottom":"top":135<=e&&e<=225?"top"===t?"top":"bottom":"middle":e<=45||315<=e||135<=e&&e<=225?"middle":45<=e&&e<=135?"left"===t?"top":"bottom":"left"===t?"bottom":"top"}function rl(e,t){if(void 0!==e)return e=ae(e),"top"===t||"bottom"===t?e%180==0?"center":0<e&&e<180?"top"===t?"right":"left":"top"===t?"left":"right":(e+90)%180==0?"center":90<=e&&e<270?"left"===t?"left":"right":"left"===t?"right":"left"}function ol(e){switch(e){case Ie:return"bottom";case He:return"left"}throw new Error(Ht.INVALID_CHANNEL_FOR_AXIS)}class sl extends ma{constructor(e,t){super(e),this.transform=t,this._dependentFields=Ic(this.transform.calculate)}clone(){return new sl(null,N(this.transform))}static parseAllForSortIndex(e,t){return t.forEachFieldDef((t,n)=>{if(Ui(t)&&ji(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,s=o.map((e,t)=>`${jn({field:i,timeUnit:r,equal:e})} ? ${t} : `).join("")+o.length;e=new sl(e,{calculate:s,as:al(t,n,{forAs:!0})})}}),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${P(this.transform)}`}}function al(e,t,n){return Wi(e,Object.assign({prefix:t,suffix:"sort_index"},null!=n?n:{}))}function ul(e,t){return U(["top","bottom"],t)?"column":U(["left","right"],t)?"row":"row"===e?"row":"column"}function cl(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return oe(t&&t.header?t.header[e]:void 0,r[e],n.header[e])}function ll(e,t,n,i){const r={};for(const o of e){const e=cl(o,t,n,i);void 0!==e&&(r[o]=e)}return r}const dl=["row","column"],fl=["header","footer"];function pl(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:s,titleOrient:a}=ll(["titleAnchor","titleAngle","titleOrient"],r,i,t),u=ul(t,a);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:n},"row"===t?{orient:"left"}:{}),{style:"guide-title"}),hl(s,u)),gl(u,s,o)),Ol(i,r,t,el,Zc))}}function gl(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=rl(t,"row"===e?"left":"top");return i?{align:i}:{}}function hl(e,t){const n=il(e,"row"===t?"left":"top");return n?{baseline:n}:{}}function ml(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of fl)if(n[r])for(const o of n[r])i.push(yl(e,t,r,n,o));return i}function bl(e,t){var n;const{sort:i}=e;return Ci(i)?{field:Wi(i,{expr:"datum"}),order:(n=i.order,null!=n?n:"ascending")}:o(i)?{field:al(e,t,{expr:"datum"}),order:"ascending"}:{field:Wi(e,{expr:"datum"}),order:null!=i?i:"ascending"}}function vl(e,t,n){const{format:i,labelAngle:r,labelAnchor:o,labelOrient:s,labelExpr:a}=ll(["format","labelAngle","labelAnchor","labelOrient","labelExpr"],e,n,t),u=di(e,i,"parent",n).signal,c=ul(t,s);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({text:{signal:a?ne(ne(a,"datum.label",u),"datum.value",Wi(e,{expr:"parent"})):u}},"row"===t?{orient:"left"}:{}),{style:"guide-label",frame:"group"}),hl(r,c)),gl(c,r,o)),Ol(n,e,t,tl,Kc))}function yl(e,t,n,i,r){var o;if(r){let s=null;const{facetFieldDef:a}=i,u=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=ll(["labelOrient"],a,u,t);("row"===t&&!U(["top","bottom"],e)||"column"===t&&!U(["left","right"],e))&&(s=vl(a,t,u))}const c=yf(e)&&!Di(e.facet),l=r.axes,d=(null===(o=l)||void 0===o?void 0:o.length)>0;if(s||d){const o="row"===t?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`},i.facetFieldDef?{from:{data:e.getName(t+"_domain")},sort:bl(a,t)}:{}),d&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{}),s?{title:s}:{}),r.sizeSignal?{encode:{update:{[o]:r.sizeSignal}}}:{}),d?{axes:l}:{})}}return null}const xl={column:{start:0,end:1},row:{start:1,end:0}};function Al(e,t){return xl[t][e]}function Ol(e,t,n,i,r){const o={};for(const s of i){if(!r[s])continue;const i=cl(s,t,e,n);void 0!==i&&(o[r[s]]=i)}return o}function wl(e){return[...Fl(e,"width"),...Fl(e,"height")]}function Fl(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(Gn(i)&&ds(o)){const i=e.scaleName(n);if(yf(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Cl(i,o)]}return[Cl(i,o),{name:r,update:jl(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${oo(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function Cl(e,t){return{name:e+"_step",value:t.step}}function jl(e,t,n){const i=t.get("type"),r=t.get("padding"),o=oe(t.get("paddingOuter"),r);let s=t.get("paddingInner");return s="band"===i?void 0!==s?s:r:1,`bandspace(${n}, ${s}, ${o}) * ${e}_step`}function Dl(e,t){return Y(e).reduce((n,i)=>{const r=e[i];return Object.assign(Object.assign({},n),Ps(t,r,i,e=>({value:e.value})))},{})}function El(e,t){if(Of(t)||yf(t))return"shared";if(Af(t)||xf(t))return U(Nt,e)?"independent":"shared";throw new Error("invalid model type for resolve")}function Sl(e,t){const n=e.scale[t],i=U(Nt,t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Qt(Ht.independentScaleMeansIndependentGuide(t)),"independent"):e[i][t]||"shared"}class kl{constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new kl(N(this.explicit),N(this.implicit))}combine(){return Object.assign(Object.assign({},this.explicit),this.implicit)}get(e){return oe(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){void 0!==t.value&&this.set(e,t.value,t.explicit)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){void 0!==t.explicit[e]?this.set(e,t.explicit[e],!0):void 0!==t.implicit[e]&&this.set(e,t.implicit[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of Y(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function $l(e){return{explicit:!0,value:e}}function Bl(e){return{explicit:!1,value:e}}function Nl(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:_l(t,n,i,r)}}function _l(e,t,n,i){return e.explicit&&t.explicit&&Qt(Ht.mergeConflictingProperty(n,i,e.value,t.value)),e}function zl(e,t,n,i,r=_l){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:B(e.value,t.value)?e:r(e,t,n,i)}const Tl=Object.assign(Object.assign({},{clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1}),{labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1}),Pl=Y(Tl);class Ml extends kl{}function Ul(e){const{legend:t}=e;return oe(t.type,Rl(e))}function Rl({channel:e,timeUnit:t,scaleType:n,alwaysReturn:i}){if(bt(e)){if(U(["quarter","month","day"],t))return"symbol";if(Vn(n))return i?"gradient":void 0}return i?"symbol":void 0}function Ll({legend:e,legendConfig:t,timeUnit:n,channel:i,scaleType:r}){const o=oe(e.orient,t.orient,"right"),s=Ul({legend:e,channel:i,timeUnit:n,scaleType:r,alwaysReturn:!0});return oe(e.direction,t[s?"gradientDirection":"symbolDirection"],function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(o,s))}function Wl(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function ql(e,t,n){const i=t.getScaleComponent(n).get("type");return oe(e.get("type"),Rl({channel:n,scaleType:i,alwaysReturn:!0}))}function Il(e){return Gl(e,(e,t)=>Math.max(e,t.value))}function Hl(e){return Gl(e,(e,t)=>oe(e,t.value))}function Gl(e,t){return function(e){return!!e&&!!e.condition&&(o(e.condition)||Mi(e.condition))}(e)?(o(e.condition)?e.condition:[e.condition]).reduce(t,e.value):Mi(e)?e.value:void 0}function Yl(e,t,n){var i;const r=t.get("selections");if(!(null===(i=r)||void 0===i?void 0:i.length))return;const o=u(n.field);return r.map(e=>{return`(!length(data(${u(Q(e)+Va)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`}).join(" || ")}var Vl=Object.freeze({__proto__:null,symbols:function(e,t,n,i,r){var s,a,u,c,l;if("symbol"!==ql(r,n,i))return;let d=Object.assign(Object.assign({},function(e,t,n){for(const i of n){const n=ci(i,t.markDef,t.config);void 0!==n&&(e[i]={value:n})}return e}({},n,Ce)),Ys(n));const{markDef:f,encoding:p,config:g}=n,h=f.filled,m=null!=(s=Il(p.opacity))?s:f.opacity,b=Yl(n,r,e);if(d.fill)if("fill"===i||h&&i===Ze)delete d.fill;else if(d.fill.field)r.get("symbolFillColor")?delete d.fill:(d.fill={value:(a=g.legend.symbolBaseFillColor,null!=a?a:"black")},d.fillOpacity={value:null!=m?m:1});else if(o(d.fill)){const e=null!=(l=null!=(c=Hl(null!=(u=p.fill)?u:p.color))?c:f.fill)?l:h&&f.color;e&&(d.fill={value:e})}if(d.stroke)if("stroke"===i||!h&&i===Ze)delete d.stroke;else if(d.stroke.field)delete d.stroke;else if(o(d.stroke)){const e=oe(Hl(p.stroke||p.color),f.stroke,h?f.color:void 0);e&&(d.stroke={value:e})}return i!==it&&(b?d.opacity=[{test:b,value:null!=m?m:1},{value:g.legend.unselectedOpacity}]:m&&(d.opacity={value:m})),d=Object.assign(Object.assign({},d),t),Y(d).length>0?d:void 0},gradient:function(e,t,n,i,r){if("gradient"!==ql(r,n,i))return;let o={};const s=Il(n.encoding.opacity)||n.markDef.opacity;return s&&(o.opacity={value:s}),o=Object.assign(Object.assign({},o),t),Y(o).length>0?o:void 0},labels:function(e,t,n,i,r){const o=n.legend(i),s=n.config,a=Yl(n,r,e);let u={};if(rr(e)){const r=n.getScaleComponent(i).get("type")===zn.UTC,a=mi("datum.value",e.timeUnit,o.format,s.timeFormat,r);t=Object.assign(Object.assign({},a?{text:{signal:a}}:{}),t)}return a&&(t.opacity=[{test:a,value:1},{value:s.legend.unselectedOpacity}]),u=Object.assign(Object.assign({},u),t),Y(u).length>0?u:void 0},entries:function(e,t,n,i,r){var o;return(null===(o=r.get("selections"))||void 0===o?void 0:o.length)?{fill:{value:"transparent"}}:void 0},getFirstConditionValue:Hl});function Jl(e){vf(e)?e.component.legends=function(e){const{encoding:t}=e;return[Ze,Ke,et,st,nt,tt,it,rt,ot].reduce((n,i)=>{const r=t[i];return!e.legend(i)||!e.getScaleComponent(i)||zi(r)&&i===tt&&r.type===_n||(n[i]=function(e,t){var n;const i=e.fieldDef(t),r=e.legend(t),o=new Ml({},function(e,t){const n=e.scaleName(Ze);if("color"===t)return e.markDef.filled?{fill:n}:{stroke:n};return{[t]:e.scaleName(t)}}(e,t));!function(e,t,n){const i=e.fieldDef(t).field;Ka(e,e=>{var r,o;const s=null!=(r=e.project.hasField[i])?r:e.project.hasChannel[t];if(s&&Da.has(e)){const t=null!=(o=n.get("selections"))?o:[];t.push(e.name),n.set("selections",t,!1),s.hasLegend=!0}})}(e,t,o);for(const n of Pl){const s=Xl(n,r,t,e);if(void 0!==s){const t=Ql(s,n,r,i);(t||void 0===e.config.legend[n])&&o.set(n,s,t)}}const s=null!==(n=r.encoding)&&void 0!==n?n:{},a=o.get("selections"),u=["labels","legend","title","symbols","gradient","entries"].reduce((n,r)=>{var u,c,l;const d=Dl(null!=(u=s[r])?u:{},e),f=Vl[r]?Vl[r](i,d,e,t,o):d;return void 0!==f&&Y(f).length>0&&(n[r]=Object.assign(Object.assign(Object.assign({},(null===(c=a)||void 0===c?void 0:c.length)?{name:`${i.field}_legend_${r}`}:{}),(null===(l=a)||void 0===l?void 0:l.length)?{interactive:!!a}:{}),{update:f})),n},{});Y(u).length>0&&o.set("encode",u,!!r.encoding);return o}(e,i)),n},{})}(e):e.component.legends=function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children)Jl(i),Y(i.component.legends).forEach(r=>{n.legend[r]=Sl(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=Zl(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))});return Y(t).forEach(t=>{for(const i of e.children)i.component.legends[t]&&"shared"===n.legend[t]&&delete i.component.legends[t]}),t}(e)}function Ql(e,t,n,i){switch(t){case"values":return!!n.values;case"title":if("title"===t&&e===i.title)return!0}return e===n[t]}function Xl(e,t,n,i){const{encoding:r,mark:o}=i,s=Ki(r[n]),a=i.config.legend,{timeUnit:u}=s,c=i.getScaleComponent(n).get("type");switch(e){case"direction":return Ll({legend:t,legendConfig:a,timeUnit:u,channel:n,scaleType:c});case"format":if(rr(s))return;return fi(s,t.format,i.config);case"formatType":if(rr(s))return;return t.formatType;case"gradientLength":return oe(t.gradientLength,a.gradientLength,function({legend:e,legendConfig:t,model:n,channel:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:s,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=t;if("horizontal"===Ll({legend:e,legendConfig:t,channel:i,scaleType:r})){const i=oe(e.orient,t.orient);return"top"===i||"bottom"===i?Wl(n,"width",s,o):s}return Wl(n,"height",u,a)}({model:i,legend:t,legendConfig:a,channel:n,scaleType:c}));case"labelOverlap":return oe(t.labelOverlap,function(e){if(U(["quantile","threshold","log"],e))return"greedy"}(c));case"symbolType":return oe(t.symbolType,function(e,t,n,i){var r;if("shape"!==t){const e=null!=(r=Hl(n))?r:i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(o,n,r.shape,i.markDef.shape));case"title":return Vi(s,i.config,{allowDisabling:!0})||void 0;case"type":return Ul({legend:t,channel:n,timeUnit:u,scaleType:c,alwaysReturn:!1});case"values":return function(e,t){const n=e.values;if(n)return sr(t,n)}(t,s)}return t[e]}function Zl(e,t){var n,i,r,o,s,a;if(!e)return t.clone();const u=e.getWithExplicit("orient"),c=t.getWithExplicit("orient");if(u.explicit&&c.explicit&&u.value!==c.value)return;let l=!1;for(const n of Pl){const i=zl(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return Kl(e,t);case"title":return xi(e,t);case"type":return l=!0,Bl("symbol")}return _l(e,t,n,"legend")});e.setWithExplicit(n,i)}return l&&((null==(r=null===(i=null===(n=e.implicit)||void 0===n?void 0:n.encode)||void 0===i?void 0:i.gradient)||r)&&Z(e.implicit,["encode","gradient"]),(null==(a=null===(s=null===(o=e.explicit)||void 0===o?void 0:o.encode)||void 0===s?void 0:s.gradient)||a)&&Z(e.explicit,["encode","gradient"])),e}function Kl(e,t){return"circle"===t.value?t:e}function ed(e){const t=e.component.legends,n={};for(const i of Y(t)){const r=e.getScaleComponent(i),o=T(r.get("domains"));if(n[o])for(const e of n[o]){Zl(e,t[i])||n[o].push(t[i])}else n[o]=[t[i].clone()]}return V(n).flat().map(e=>{var t,n,i,r;const o=e.combine(),{labelExpr:s,selections:a}=o,u=$e(o,["labelExpr","selections"]);if(null===(t=u.encode)||void 0===t?void 0:t.symbols){const e=u.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||u.stroke||(e.stroke={value:"transparent"}),u.fill&&delete e.fill}if(void 0!==s){let e=s;(null===(r=null===(i=null===(n=u.encode)||void 0===n?void 0:n.labels)||void 0===i?void 0:i.update)||void 0===r?void 0:r.text)&&ls(u.encode.labels.update.text)&&(e=ne(s,"datum.label",u.encode.labels.update.text.signal)),function(e,t,n,i){var r,o,s;e.encode=null!=(r=e.encode)?r:{},e.encode[t]=null!=(o=e.encode[t])?o:{},e.encode[t].update=null!=(s=e.encode[t].update)?s:{},e.encode[t].update[n]=i}(u,"labels","text",{signal:e})}return u})}function td(e){return Of(e)||Af(e)||xf(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),nd(e))}(e):nd(e)}function nd(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n,r=$e(n,["name"]);if(t.data){const n={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const i=ls(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return U(t,i)||t.push(i),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[Object.assign({name:i,size:n,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]}},r)]}return[Object.assign(Object.assign({name:i},{translate:{signal:"[width / 2, height / 2]"}}),r)]}const id=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class rd extends kl{constructor(e,t,n,i){super(Object.assign({},t),{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,this.merged=!1}get isFit(){return!!this.data}}function od(e){e.component.projection=vf(e)?function(e){var t;if(e.hasProjection){const n=e.specifiedProjection,i=!(n&&(null!=n.scale||null!=n.translate)),r=i?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,o=i?function(e){const t=[];for(const n of[[Je,Ve],[Xe,Qe]])(e.channelHasField(n[0])||e.channelHasField(n[1]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(tt)&&e.fieldDef(tt).type===_n&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(Io));return t}(e):void 0;return new rd(e.projectionName(!0),Object.assign(Object.assign({},null!=(t=e.config.projection)?t:{}),null!=n?n:{}),r,o)}return}(e):function(e){if(0===e.children.length)return;let t;e.children.forEach(e=>od(e));const n=L(e.children,e=>{const n=e.component.projection;if(n){if(t){const e=function(e,t){const n=L(id,n=>!O(e.explicit,n)&&!O(t.explicit,n)||!(!O(e.explicit,n)||!O(t.explicit,n)||T(e.get(n))!==T(t.get(n))));if(T(e.size)===T(t.size)){if(n)return e;if(T(e.explicit)===T({}))return t;if(T(t.explicit)===T({}))return e}return null}(t,n);return e&&(t=e),!!e}return t=n,!0}return!0});if(t&&n){const n=e.projectionName(!0),i=new rd(n,t.specifiedProjection,t.size,N(t.data));return e.children.forEach(e=>{const t=e.component.projection;t&&(t.isFit&&i.data.push(...e.component.projection.data),e.renameProjection(t.get("name"),n),t.merged=!0)}),i}return}(e)}function sd(e,t){return`${ur(e)}_${t}`}function ad(e,t,n){var i;const r=sd(null!=(i=nr(n,void 0))?i:{},t);return e.getName(`${r}_bins`)}function ud(e,t,n){let i,r;i=function(e){return"as"in e}(e)?a(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[Wi(e,{forAs:!0}),Wi(e,{binSuffix:"end",forAs:!0})];const o=Object.assign({},nr(t,void 0)),s=sd(o,e.field),{signal:u,extentSignal:c}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(n,s);if(fr(o.extent)){const e=o.extent,t=e.selection;r=Yc(n.getSelectionComponent(Q(t),t),e),delete o.extent}return{key:s,binComponent:Object.assign(Object.assign(Object.assign({bin:o,field:e.field,as:[i]},u?{signal:u}:{}),c?{extentSignal:c}:{}),r?{span:r}:{})}}class cd extends ma{constructor(e,t){super(e),this.bins=t}clone(){return new cd(null,N(this.bins))}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{if(Ti(n)&&cr(n.bin)){const{key:r,binComponent:o}=ud(n,n.bin,t);e[r]=Object.assign(Object.assign(Object.assign({},o),e[r]),function(e,t,n,i){var r,o;if(ar(t,n)){const s=vf(e)?null!=(o=null!=(r=e.axis(n))?r:e.legend(n))?o:{}:{},a=Wi(t,{expr:"datum"}),u=Wi(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Wi(t,{binSuffix:"range",forAs:!0}),formula:hi(a,u,s.format,i)}}return{}}(t,n,i,t.config))}return e},{});return 0===Y(n).length?null:new cd(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=ud(t,t.bin,n);return new cd(e,{[i]:r})}merge(e,t){for(const n of Y(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=q([...this.bins[n].as,...e.bins[n].as],P)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(V(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(V(this.bins).map(e=>e.field))}hash(){return`Bin ${P(this.bins)}`}assemble(){return V(this.bins).flatMap(e=>{const t=[],[n,...i]=e.as,r=e.bin,{extent:o}=r,s=$e(r,["extent"]),a=Object.assign(Object.assign(Object.assign({type:"bin",field:te(e.field),as:n,signal:e.signal},fr(o)?{extent:null}:{extent:o}),e.span?{span:{signal:`span(${e.span})`}}:{}),s);!o&&e.extentSignal&&(t.push({type:"extent",field:te(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:Wi({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}class ld extends ma{constructor(e){let t;if(super(null),Ro(e=null!=e?e:{name:"source"})||(t=e.format?Object.assign({},z(e.format,["parse"])):{}),Mo(e))this._data={values:e.values};else if(Po(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];U(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else Wo(e)?this._data={values:[{type:"Sphere"}]}:(Uo(e)||Ro(e))&&(this._data={});this._generator=Ro(e),e.name&&(this._name=e.name),t&&Y(t).length>0&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return Object.assign(Object.assign({name:this._name},this._data),{transform:[]})}}function dd(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return console.error("Dataflow graph is inconsistent.",t,e),!1;if(!dd(t.children))return!1}return!0}class fd extends ma{constructor(e,t){super(e),this.params=t}clone(){return new fd(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${P(this.params)}`}assemble(){return Object.assign({type:"graticule"},!0===this.params?{}:this.params)}}class pd extends ma{constructor(e,t){super(e),this.params=t}clone(){return new pd(null,this.params)}dependentFields(){return new Set}producedFields(){var e;return new Set([(e=this.params.as,null!=e?e:"data")])}hash(){return`Hash ${P(this.params)}`}assemble(){return Object.assign({type:"sequence"},this.params)}}function gd(e){return e instanceof ld||e instanceof fd||e instanceof pd}class hd{constructor(){this._mutated=!1}setMutated(){this._mutated=!0}get mutatedFlag(){return this._mutated}}class md extends hd{constructor(){super(),this._continue=!1}setContinue(){this._continue=!0}get continueFlag(){return this._continue}get flags(){return{continueFlag:this.continueFlag,mutatedFlag:this.mutatedFlag}}set flags({continueFlag:e,mutatedFlag:t}){e&&this.setContinue(),t&&this.setMutated()}reset(){}optimizeNextFromLeaves(e){if(gd(e))return!1;const t=e.parent,{continueFlag:n}=this.run(e);return n&&this.optimizeNextFromLeaves(t),this.mutatedFlag}}class bd extends hd{}function vd(e,t,n,i){const r=vf(i)?i.encoding[St(t)]:void 0;if(Ti(n)&&vf(i)&&Bi(t,n,r,i.markDef,i.config))e.add(Wi(n,{})),e.add(Wi(n,{suffix:"end"})),ar(n,t)&&e.add(Wi(n,{binSuffix:"range"}));else if(t in gt){const n=function(e){switch(e){case Ve:return"y";case Qe:return"y2";case Je:return"x";case Xe:return"x2"}}(t);e.add(i.getName(n))}else e.add(Wi(n));return e}class yd extends ma{constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}clone(){return new yd(null,new Set(this.dimensions),N(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef(e=>{e.aggregate&&(n=!0)});const i={},r=new Set;return n?(t.forEachFieldDef((e,n)=>{var o,s,a,u;const{aggregate:c,field:l}=e;if(c)if("count"===c)i["*"]=null!=(o=i["*"])?o:{},i["*"].count=new Set([Wi(e,{forAs:!0})]);else{if(_e(c)||ze(c)){const e=_e(c)?"argmin":"argmax",t=c[e];i[t]=null!=(s=i[t])?s:{},i[t][e]=new Set([Wi({op:e,field:t},{forAs:!0})])}else i[l]=null!=(a=i[l])?a:{},i[l][c]=new Set([Wi(e,{forAs:!0})]);Rt(n)&&"unaggregated"===t.scaleDomain(n)&&(i[l]=null!=(u=i[l])?u:{},i[l].min=new Set([Wi({field:l,aggregate:"min"},{forAs:!0})]),i[l].max=new Set([Wi({field:l,aggregate:"max"},{forAs:!0})]))}else vd(r,n,e,t)}),r.size+Y(i).length===0?null:new yd(e,r,i)):null}static makeFromTransform(e,t){var n,i,r;const o=new Set,s={};for(const e of t.aggregate){const{op:t,field:r,as:o}=e;t&&("count"===t?(s["*"]=null!=(n=s["*"])?n:{},s["*"].count=new Set([o||Wi(e,{forAs:!0})])):(s[r]=null!=(i=s[r])?i:{},s[r][t]=new Set([o||Wi(e,{forAs:!0})])))}for(const e of null!=(r=t.groupby)?r:[])o.add(e);return o.size+Y(s).length===0?null:new yd(e,o,s)}merge(e){return function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}(this.dimensions,e.dimensions)?(function(e,t){var n;for(const i of Y(t)){const r=t[i];for(const t of Y(r))i in e?e[i][t]=new Set([...(n=e[i][t],null!=n?n:[]),...r[t]]):e[i]={[t]:r[t]}}}(this.measures,e.measures),!0):(function(...e){Jt.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...Y(this.measures)])}producedFields(){const e=new Set;for(const t of Y(this.measures))for(const n of Y(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${P({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of Y(this.measures))for(const r of Y(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:te(i));return{type:"aggregate",groupby:[...this.dimensions],ops:e,fields:t,as:n}}}class xd extends ma{constructor(e,t,n,i){super(e),this.model=t,this.name=n,this.data=i;for(const e of yt){const n=t.facet[e];if(n){const{bin:i,sort:r}=n;this[e]=Object.assign({name:t.getName(`${e}_domain`),fields:[Wi(n),...cr(i)?[Wi(n,{binSuffix:"end"})]:[]]},Ci(r)?{sortField:r}:o(r)?{sortIndexField:al(n,e)}:{})}}this.childModel=t.child}hash(){let e="Facet";for(const t of yt)this[t]&&(e+=` ${t.charAt(0)}:${P(this[t])}`);return e}get fields(){var e;const t=[];for(const n of yt)(null===(e=this[n])||void 0===e?void 0:e.fields)&&t.push(...this[n].fields);return t}dependentFields(){const e=new Set(this.fields);for(const t of yt)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of["x","y"]){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(Gn(i)&&ds(r)){const n=Kd(ef(this.childModel,t));n?e[t]=n:Qt(`Unknown field for ${t}. Cannot calculate view size.`)}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x"}[e],r=[],o=[],s=[];n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),s.push(`distinct_${n[i]}`));const{sortField:a,sortIndexField:u}=this[e];if(a){const{op:e=Ai,field:t}=a;r.push(t),o.push(e),s.push(Wi(a,{forAs:!0}))}else u&&(r.push(u),o.push("max"),s.push(u));return{name:this[e].name,source:null!=t?t:this.data,transform:[Object.assign({type:"aggregate",groupby:this[e].fields},r.length?{fields:r,ops:o,as:s}:{})]}}assembleFacetHeaderData(e){var t,n;const{columns:i}=this.model.layout,{layoutHeaders:r}=this.model.component,o=[],s={};for(const e of dl){for(const i of fl){const o=null!=(t=r[e]&&r[e][i])?t:[];for(const t of o)if((null===(n=t.axes)||void 0===n?void 0:n.length)>0){s[e]=!0;break}}if(s[e]){const t=`length(data("${this.facet.name}"))`,n="row"===e?i?{signal:`ceil(${t} / ${i})`}:1:i?{signal:`min(${t}, ${i})`}:{signal:t};o.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:n}]})}}const{row:a,column:u}=s;return(a||u)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,e)),o}assemble(){var e,t;const n=[];let i=null;const r=this.getChildIndependentFieldsWithStep(),{column:o,row:s,facet:a}=this;if(o&&s&&(r.x||r.y)){i=`cross_${this.column.name}_${this.row.name}`;const o=[].concat(null!=(e=r.x)?e:[],null!=(t=r.y)?t:[]),s=o.map(()=>"distinct");n.push({name:i,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:o,ops:s}]})}for(const e of[We,Le])this[e]&&n.push(this.assembleRowColumnHeaderData(e,i,r));if(a){const e=this.assembleFacetHeaderData(r);e&&n.push(...e)}return n}}function Ad(e){return"'"===e[0]&&"'"===e[e.length-1]||'"'===e[0]&&'"'===e[e.length-1]?e.slice(1,-1):e}function Od(e){const t={};return function e(t,n){if(k(t))e(t.not,n);else if(S(t))for(const i of t.and)e(i,n);else if(E(t))for(const i of t.or)e(i,n);else n(t)}(e.filter,e=>{var n;if(Fn(e)){let i=null;bn(e)?i=e.equal:On(e)?i=e.range[0]:wn(e)&&(i=(n=e.oneOf,null!=n?n:e.in)[0]),i&&(Zt(i)?t[e.field]="date":F(i)?t[e.field]="number":a(i)&&(t[e.field]="string")),e.timeUnit&&(t[e.field]="date")}}),t}function wd(e){const t={};function n(e){var n;rr(e)?t[e.field]="date":"quantitative"===e.type&&(a(n=e.aggregate)&&U(["min","max"],n))?t[e.field]="number":re(e.field)>1?e.field in t||(t[e.field]="flatten"):Ui(e)&&Ci(e.sort)&&re(e.sort.field)>1&&(e.sort.field in t||(t[e.sort.field]="flatten"))}if((vf(e)||yf(e))&&e.forEachFieldDef((t,i)=>{if(Ti(t))n(t);else{const r=Et(i),o=e.fieldDef(r);n(Object.assign(Object.assign({},t),{type:o.type}))}}),vf(e)){const{mark:n,markDef:i,encoding:r}=e;if(Ae(n)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];!zi(e)||"quantitative"!==e.type||e.field in t||(t[e.field]="number")}}return t}class Fd extends ma{constructor(e,t){super(e),this._parse=t}clone(){return new Fd(null,N(this._parse))}hash(){return`Parse ${P(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!Ro(r)&&r&&r.format&&r.format.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of Y(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:Qt(Ht.differentParse(e,n[e],t.value)))}for(const e of Y(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Qt(Ht.differentParse(e,t[e],n)))}const r=new kl(t,n);i.copyAll(r);const o={};for(const e of Y(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===Y(o).length||i.parseNothing?null:new Fd(e,o)}get parse(){return this._parse}merge(e){this._parse=Object.assign(Object.assign({},this._parse),e.parse),e.remove()}assembleFormatParse(){const e={};for(const t of Y(this._parse)){const n=this._parse[t];1===re(t)&&(e[t]=n)}return e}producedFields(){return new Set(Y(this._parse))}dependentFields(){return new Set(Y(this._parse))}assembleTransforms(e=!1){return Y(this._parse).filter(t=>!e||re(t)>1).map(e=>{const t=function(e,t){const n=ee(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(0===t.indexOf("date:")){return`timeParse(${n},'${Ad(t.slice(5,t.length))}')`}if(0===t.indexOf("utc:")){return`utcParse(${n},'${Ad(t.slice(4,t.length))}')`}return Qt(Ht.unrecognizedParse(t)),null}(e,this._parse[e]);return t?{type:"formula",expr:t,as:ie(e)}:null}).filter(e=>null!==e)}}class Cd extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Cd(null,N(this.transform))}addDimensions(e){this.transform.groupby=q(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t=>e.add(t)),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(t=>e.add(t)),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:Wi(e)}hash(){return`JoinAggregateTransform ${P(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return Object.assign({type:"joinaggregate",as:n,ops:t,fields:e},void 0!==i?{groupby:i}:{})}}class jd extends ma{constructor(e,t){super(e),this._stack=t}clone(){return new jd(null,N(this._stack))}static makeFromTransform(e,t){const{stack:n,groupby:i,as:r,offset:s="zero"}=t,u=[],c=[];if(void 0!==t.sort)for(const e of t.sort)u.push(e.field),c.push(oe(e.order,"ascending"));const l={field:u,order:c};let d;return d=function(e){return o(e)&&e.every(e=>a(e))&&e.length>1}(r)?r:a(r)?[r,r+"_end"]:[t.stack+"_start",t.stack+"_end"],new jd(e,{stackField:n,groupby:i,offset:s,sort:l,facetby:[],as:d})}static makeFromEncoding(e,t){const n=t.stack,{encoding:i}=t;if(!n)return null;let r;if(n.groupbyChannel){r=Ki(i[n.groupbyChannel])}const s=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=Wi(t.fieldDef);return n&&e.push(n),e},[])}(t),a=t.encoding.order;let u;return u=o(a)||zi(a)?bi(a):s.reduce((e,t)=>(e.field.push(t),e.order.push("descending"),e),{field:[],order:[]}),new jd(e,{dimensionFieldDef:r,stackField:t.vgField(n.fieldChannel),facetby:[],stackby:s,sort:u,offset:n.offset,impute:n.impute,as:[t.vgField(n.fieldChannel,{suffix:"start",forAs:!0}),t.vgField(n.fieldChannel,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(t=>e.add(t)),this._stack.facetby.forEach(t=>e.add(t)),this._stack.sort.field.forEach(t=>e.add(t)),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${P(this._stack)}`}getGroupbyFields(){const{dimensionFieldDef:e,impute:t,groupby:n}=this._stack;return e?e.bin?t?[Wi(e,{binSuffix:"mid"})]:[Wi(e,{}),Wi(e,{binSuffix:"end"})]:[Wi(e)]:null!=n?n:[]}assemble(){const e=[],{facetby:t,dimensionFieldDef:n,stackField:i,stackby:r,sort:o,offset:s,impute:a,as:u}=this._stack;if(a&&n){const{band:o=.5,bin:s}=n;s&&e.push({type:"formula",expr:`${o}*`+Wi(n,{expr:"datum"})+`+${1-o}*`+Wi(n,{expr:"datum",binSuffix:"end"}),as:Wi(n,{binSuffix:"mid",forAs:!0})}),e.push({type:"impute",field:i,groupby:[...r,...t],key:Wi(n,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:u,offset:s}),e}}class Dd extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Dd(null,N(this.transform))}addDimensions(e){this.transform.groupby=q(this.transform.groupby.concat(e),e=>e)}dependentFields(){var e,t;const n=new Set;return(e=this.transform.groupby,null!=e?e:[]).forEach(e=>n.add(e)),(t=this.transform.sort,null!=t?t:[]).forEach(e=>n.add(e.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(e=>n.add(e)),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){var t;return null!=(t=e.as)?t:Wi(e)}hash(){return`WindowTransform ${P(this.transform)}`}assemble(){var e;const t=[],n=[],i=[],r=[];for(const e of this.transform.window)n.push(e.op),i.push(this.getDefaultName(e)),r.push(void 0===e.param?null:e.param),t.push(void 0===e.field?null:e.field);const o=this.transform.frame,s=this.transform.groupby;if(o&&null===o[0]&&null===o[1]&&n.every(e=>Te(e)))return Object.assign({type:"joinaggregate",as:i,ops:n,fields:t},void 0!==s?{groupby:s}:{});const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(null!=(e=t.order)?e:"ascending");const c={field:a,order:u},l=this.transform.ignorePeers;return Object.assign(Object.assign(Object.assign({type:"window",params:r,as:i,ops:n,fields:t,sort:c},void 0!==l?{ignorePeers:l}:{}),void 0!==s?{groupby:s}:{}),void 0!==o?{frame:o}:{})}}class Ed extends ma{clone(){return new Ed(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([Jr])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:Jr}}}class Sd extends md{run(e){const t=e.parent;if(e instanceof Fd){if(gd(t))return this.flags;if(t.numChildren()>1)return this.setContinue(),this.flags;if(t instanceof Fd)this.setMutated(),t.merge(e);else{if(G(t.producedFields(),e.dependentFields()))return this.setContinue(),this.flags;this.setMutated(),e.swapWithParent()}}return this.setContinue(),this.flags}}class kd extends bd{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map(e=>e.hash()),n={};for(let i=0;i<t.length;i++)void 0===n[t[i]]?n[t[i]]=[e.children[i]]:n[t[i]].push(e.children[i]);for(const t of Y(n))n[t].length>1&&(this.setMutated(),this.mergeNodes(e,n[t]));for(const t of e.children)this.run(t);return this.mutatedFlag}}class $d extends md{run(e){return e instanceof ba||e.numChildren()>0||e instanceof xd?this.flags:(this.setMutated(),e.remove(),this.flags)}}class Bd extends md{constructor(){super(...arguments),this.fields=new Set,this.prev=null}run(e){if(this.setContinue(),e instanceof va){const t=e.producedFields();I(t,this.fields)?(this.setMutated(),this.prev.remove()):this.fields=new Set([...this.fields,...t]),this.prev=e}return this.flags}reset(){this.fields.clear()}}class Nd extends md{run(e){this.setContinue();const t=e.parent.children.filter(e=>e instanceof va),n=t.pop();for(const e of t)this.setMutated(),n.merge(e);return this.flags}}function _d(e){if(e instanceof xd)if(1!==e.numChildren()||e.children[0]instanceof ba){const n=e.model.component.data.main;!function e(t){if(t instanceof ba&&t.type===Io&&1===t.numChildren()){const n=t.children[0];n instanceof xd||(n.swapWithParent(),e(t))}}(n);const i=(t=e,function e(n){if(!(n instanceof xd)){const i=n.clone();if(i instanceof ba){const e=Ld+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof yd||i instanceof jd||i instanceof Dd||i instanceof Cd)&&i.addDimensions(t.fields);return n.children.flatMap(e).forEach(e=>e.parent=i),[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof yd||t instanceof jd||t instanceof Dd||t instanceof Cd)&&t.addDimensions(e.fields),t.swapWithParent(),_d(e)}else e.children.map(_d);var t}class zd extends bd{constructor(){super()}run(e){e instanceof ba&&!e.isRequired()&&(this.setMutated(),e.remove());for(const t of e.children)this.run(t);return this.mutatedFlag}}class Td extends bd{constructor(e){super(),this.requiresSelectionId=e&&tu(e)}run(e){e instanceof Ed&&(this.requiresSelectionId&&(gd(e.parent)||e.parent instanceof yd||e.parent instanceof Fd)||(this.setMutated(),e.remove()));for(const t of e.children)this.run(t);return this.mutatedFlag}}class Pd extends md{run(e){const t=e.parent,n=[...t.children],i=t.children.filter(e=>e instanceof Fd);if(t.numChildren()>1&&i.length>=1){const e={},r=new Set;for(const t of i){const n=t.parse;for(const t of Y(n))t in e?e[t]!==n[t]&&r.add(t):e[t]=n[t]}for(const t of r)delete e[t];if(0!==Y(e).length){this.setMutated();const i=new Fd(t,e);for(const r of n){if(r instanceof Fd)for(const t of Y(e))delete r.parse[t];t.removeChild(r),r.parent=i,r instanceof Fd&&0===Y(r.parse).length&&r.remove()}}}return this.setContinue(),this.flags}}class Md extends md{run(e){const t=e.parent,n=t.children.filter(e=>e instanceof yd),i={};for(const e of n){const t=P(e.groupBy);t in i||(i[t]=[]),i[t].push(e)}for(const e of Y(i)){const n=i[e];if(n.length>1){const e=n.pop();for(const i of n)e.merge(i)&&(t.removeChild(i),i.parent=e,i.remove(),this.setMutated())}}return this.setContinue(),this.flags}}class Ud extends md{constructor(e){super(),this.model=e}run(e){const t=e.parent,n=!(gd(t)||t instanceof Hc||t instanceof Fd||t instanceof Ed),i=[],r=[];for(const e of t.children)e instanceof cd&&(n&&!G(t.producedFields(),e.dependentFields())?i.push(e):r.push(e));if(i.length>0){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated(),t instanceof cd?t.merge(e,this.model.renameSignal.bind(this.model)):e.swapWithParent()}if(r.length>1){const e=r.pop();for(const t of r)e.merge(t,this.model.renameSignal.bind(this.model));this.setMutated()}return this.setContinue(),this.flags}}class Rd extends md{run(e){const t=e.parent,n=[...t.children];if(!R(n,e=>e instanceof ba)||t.numChildren()<=1)return this.setContinue(),this.flags;const i=[];let r;for(const e of n)if(e instanceof ba){let n=e;for(;1===n.numChildren();){const e=n.children[0];if(!(e instanceof ba))break;n=e}i.push(...n.children),r?(t.removeChild(e),e.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setMutated()):r=n}else i.push(e);if(i.length){this.setMutated();for(const e of i)e.parent.removeChild(e),e.parent=r}return this.setContinue(),this.flags}}const Ld="scale_",Wd=5;function qd(e){const t=[];return e.forEach((function e(n){0===n.numChildren()?t.push(n):n.children.forEach(e)})),t}function Id(e){return e}function Hd(e,t){return t.map(t=>{if(e instanceof md){const n=e.optimizeNextFromLeaves(t);return e.reset(),n}return e.run(t)}).some(Id)}function Gd(e,t){let n=e.sources;const i=new Set;return i.add(Hd(new zd,n)),i.add(Hd(new Td(t),n)),n=n.filter(e=>e.numChildren()>0),i.add(Hd(new $d,qd(n))),n=n.filter(e=>e.numChildren()>0),i.add(Hd(new Sd,qd(n))),i.add(Hd(new Ud(t),qd(n))),i.add(Hd(new Bd,qd(n))),i.add(Hd(new Pd,qd(n))),i.add(Hd(new Md,qd(n))),i.add(Hd(new Nd,qd(n))),i.add(Hd(new kd,n)),i.add(Hd(new Rd,qd(n))),e.sources=n,i.has(!0)}class Yd{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Yd(()=>e(t))}}function Vd(e){vf(e)?function(e){const t=e.component.scales;Y(t).forEach(n=>{const i=function(e,t){const n=e.getScaleComponent(t).get("type"),i=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=Xd(t,n);if(!e)return void Qt(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=Xd(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.fieldDef(t),n,e.config.scale);i!==e.scaleDomain(t)&&(e.specifiedScales[t]=Object.assign(Object.assign({},e.specifiedScales[t]),{domain:i}));if("x"===t&&e.channelHasField("x2"))return e.channelHasField("x")?zl(Jd(n,i,e,"x"),Jd(n,i,e,"x2"),"domain","scale",Zd):Jd(n,i,e,"x2");if("y"===t&&e.channelHasField("y2"))return e.channelHasField("y")?zl(Jd(n,i,e,"y"),Jd(n,i,e,"y2"),"domain","scale",Zd):Jd(n,i,e,"y2");return Jd(n,i,e,t)}(e,n);if(t[n].setWithExplicit("domains",i),function(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t).bin,o=Qn(i)&&i,s=dr(r)&&fr(r.extent)&&r.extent;(o||s)&&n.set("selectionExtent",null!=o?o:s,!0)}(e,n),e.component.data.isFaceted){let t=e;for(;!yf(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)fs(e)&&(e.data=Ld+e.data.replace(Ld,""))}})}(e):function(e){for(const t of e.children)Vd(t);const t=e.component.scales;Y(t).forEach(n=>{let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):zl(i,e.getWithExplicit("domains"),"domains","scale",Zd);const t=e.get("selectionExtent");r&&t&&r.selection!==t.selection&&Qt("The same selection must be used to override scale domains in a layered view."),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)})}(e)}function Jd(e,t,n,i){const r=n.fieldDef(i);if(t&&"unaggregated"!==t&&!Qn(t)){const{type:e,timeUnit:n}=r;return $l("temporal"===e||n?function(e,t,n){return e.map(e=>{return{signal:`{data: ${or(e,{timeUnit:n,type:t})}}`}})}(t,e,n):[t])}const o=n.stack;if(o&&i===o.fieldChannel){if("normalize"===o.offset)return Bl([[0,1]]);const e=n.requestDataName(Io);return Bl([{data:e,field:n.vgField(i,{suffix:"start"})},{data:e,field:n.vgField(i,{suffix:"end"})}])}const a=Rt(i)?function(e,t,n){if(!Gn(n))return;const i=e.fieldDef(t),r=i.sort;if(ji(r))return{op:"min",field:al(i,t),order:"ascending"};const o=null!==e.stack;if(Ci(r))return Qd(r,o);if(Fi(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:a}=i;if(_e(s)||ze(s))return Qd({field:Wi(i),order:n},o);if(Te(s)||!s)return Qd({op:s,field:a,order:n},o)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(U(["ascending",void 0],r))return!0}return}(n,i,e):void 0;if("unaggregated"===t){const e=n.requestDataName(Io),{field:t}=r;return Bl([{data:e,field:Wi({field:t,aggregate:"min"})},{data:e,field:Wi({field:t,aggregate:"max"})}])}if(cr(r.bin)){if(Gn(e))return Bl("bin-ordinal"===e?[]:[{data:J(a)?n.requestDataName(Io):n.requestDataName(Ho),field:n.vgField(i,ar(r,i)?{binSuffix:"range"}:{}),sort:!0!==a&&s(a)?a:{field:n.vgField(i,{}),op:"min"}}]);{const{bin:e}=r;if(cr(e)){const t=ad(n,r.field,e);return Bl([new Yd(()=>{const e=n.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return Bl([{data:n.requestDataName(Io),field:n.vgField(i,{})}])}}if(r.timeUnit&&U(["time","utc"],e)&&Bi(i,r,vf(n)?n.encoding[St(i)]:void 0,n.markDef,n.config)){const e=n.requestDataName(Io);return Bl([{data:e,field:n.vgField(i)},{data:e,field:n.vgField(i,{suffix:"end"})}])}return Bl(a?[{data:J(a)?n.requestDataName(Io):n.requestDataName(Ho),field:n.vgField(i),sort:a}]:[{data:n.requestDataName(Io),field:n.vgField(i)}])}function Qd(e,t){const{op:n,field:i,order:r}=e;return Object.assign(Object.assign({op:null!=n?n:t?"sum":Ai},i?{field:te(i)}:{}),r?{order:r}:{})}function Xd(e,t){const{aggregate:n,type:i}=e;return n?a(n)&&!Re[n]?{valid:!1,reason:Ht.unaggregateDomainWithNonSharedDomainOp(n)}:"quantitative"===i&&"log"===t?{valid:!1,reason:Ht.unaggregatedDomainWithLogScale(e)}:{valid:!0}:{valid:!1,reason:Ht.unaggregateDomainHasNoEffectForRawField(e)}}function Zd(e,t,n,i){return e.explicit&&t.explicit&&Qt(Ht.mergeConflictingDomainProperty(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function Kd(e){if(fs(e)&&a(e.field))return e.field;if(function(e){return!o(e)&&("fields"in e&&!("data"in e))}(e)){let t;for(const n of e.fields)if(fs(n)&&a(n.field))if(t){if(t!==n.field)return Qt("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),t}else t=n.field;return Qt("Detected faceted independent scales that union domain of identical fields from different source detected. We will assume that this is the same field from a different fork of the same data source. However, if this is not case, the result view size maybe incorrect."),t}if(function(e){return!o(e)&&("fields"in e&&"data"in e)}(e)){Qt("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const t=e.fields[0];return a(t)?t:void 0}}function ef(e,t){return function(e){const t=q(e.map(e=>{if(fs(e)){return $e(e,["sort"])}return e}),P),n=q(e.map(e=>{if(fs(e)){const t=e.sort;return void 0===t||J(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),P);if(0===t.length)return;if(1===t.length){const t=e[0];if(fs(t)&&n.length>0){let e=n[0];return n.length>1&&(Qt(Ht.MORE_THAN_ONE_SORT),e=!0),Object.assign(Object.assign({},t),{sort:e})}return t}const i=q(n.map(e=>J(e)||!("op"in e)||e.op in Ne?e:(Qt(Ht.domainSortDropped(e)),!0)),P);let r;1===i.length?r=i[0]:i.length>1&&(Qt(Ht.MORE_THAN_ONE_SORT),r=!0);const o=q(e.map(e=>fs(e)?e.data:null),e=>e);if(1===o.length&&null!==o[0]){return Object.assign({data:o[0],fields:t.map(e=>e.field)},r?{sort:r}:{})}return Object.assign({fields:t},r?{sort:r}:{})}(e.component.scales[t].get("domains").map(t=>(fs(t)&&(t.data=e.lookupDataSource(t.data)),t)))}function tf(e){return Y(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:s,selectionExtent:a,domains:u,range:c}=r,l=$e(r,["name","type","selectionExtent","domains","range"]),d=function(e,t,n){if(("x"===n||"y"===n)&&ds(e))return{step:{signal:t+"_step"}};return e}(r.range,o,n);let f;a&&(f=function(e,t){const n=t.selection;return{signal:Yc(e.getSelectionComponent(n,Q(n)),t)}}(e,a));const p=ef(e,n);return t.push(Object.assign(Object.assign(Object.assign(Object.assign({name:o,type:s},p?{domain:p}:{}),f?{domainRaw:f}:{}),{range:d}),l)),t},[])}class nf extends kl{constructor(e,t){super({},{name:e}),this.merged=!1,this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||R(this.get("domains"),e=>o(e)&&2===e.length&&e[0]<=0&&e[1]>=0)}}const rf=["range","scheme"];function of(e){return"x"===e?"width":"y"===e?"height":void 0}function sf(e){const t=e.component.scales;Ut.forEach(n=>{const i=t[n];if(!i)return;const r=function(e,t){const n=t.specifiedScales[e],{size:i}=t,r=t.getScaleComponent(e).get("type");for(const t of rf)if(void 0!==n[t]){const i=Kn(r,t),o=ei(e,t);if(i)if(o)Qt(o);else switch(t){case"range":return $l(n[t]);case"scheme":return $l(uf(n[t]))}else Qt(Ht.scalePropertyNotWorkWithScaleType(r,t,e))}if(e===Ie||e===He){const t=e===Ie?"width":"height",n=i[t];if(io(n)){if(Gn(r))return $l({step:n.step});Qt(Ht.stepDropped(t))}}return Bl(function(e,t){const{size:n,config:i,mark:r}=t,s=t.getSignalName.bind(t),{type:a}=t.fieldDef(e),u=t.getScaleComponent(e).get("type"),{domain:c}=t.specifiedScales[e];switch(e){case Ie:case He:{if(U(["point","band"],u))if(e!==Ie||n.width){if(e===He&&!n.height){const e=ao(i.view,"height");if(io(e))return e}}else{const e=ao(i.view,"width");if(io(e))return e}const r=of(e),o=t.getName(r);return e===He&&Yn(u)?[Yd.fromName(s,o),0]:[0,Yd.fromName(s,o)]}case nt:{const s=t.component.scales[e].get("zero"),a=function(e,t,n){if(t)return 0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(Ht.incompatibleChannel("size",e))}(r,s,i),l=function(e,t,n,i){const r={x:af(n,"x"),y:af(n,"y")};switch(e){case"bar":case"tick":{if(void 0!==i.scale.maxBandSize)return i.scale.maxBandSize;const e=lf(t,r,i.view);return F(e)?e-1:new Yd(()=>`${e.signal} - 1`)}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const e=lf(t,r,i.view);return F(e)?Math.pow(cf*e,2):new Yd(()=>`pow(${cf} * ${e.signal}, 2)`)}}throw new Error(Ht.incompatibleChannel("size",e))}(r,n,t,i);return Jn(u)?function(e,t,n){const i=()=>{const i=`(${ls(t)?t.signal:t} - ${e}) / (${n} - 1)`;return`sequence(${e}, ${t} + ${i}, ${i})`};return ls(t)?new Yd(i):{signal:i()}}(a,l,function(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return void 0!==n&&o(n)?n.length+1:(Qt(Ht.domainRequiredForThresholdScale(i)),3)}}(u,i,c,e)):[a,l]}case st:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case tt:return"symbol";case Ze:case Ke:case et:return"ordinal"===u?"nominal"===a?"category":"ordinal":"rect"===r||"geoshape"===r?"heatmap":"ramp";case it:case rt:case ot:return[i.scale.minOpacity,i.scale.maxOpacity]}throw new Error(`Scale range undefined for channel ${e}`)}(e,t))}(n,e);i.setWithExplicit("range",r)})}function af(e,t){const n=e.fieldDef(t);if(n&&n.bin&&cr(n.bin)){const i=ad(e,n.field,n.bin),r=of(t),o=e.getName(r);return new Yd(()=>{const t=e.getSignalName(i),n=`(${t}.stop - ${t}.start) / ${t}.step`;return`${e.getSignalName(o)} / (${n})`})}}function uf(e){return function(e){return!a(e)&&!!e.name}(e)?Object.assign({scheme:e.name},z(e,["name"])):{scheme:e}}const cf=.95;function lf(e,t,n){const i=io(e.width)?e.width.step:so(n,"width"),r=io(e.height)?e.height.step:so(n,"height");return t.x||t.y?new Yd(()=>{return`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`}):Math.min(i,r)}function df(e,t){vf(e)?function(e,t){const n=e.component.scales;Y(n).forEach(i=>{const r=e.specifiedScales[i],s=n[i],a=e.getScaleComponent(i),u=e.fieldDef(i),c=e.config,l=r[t],d=a.get("type"),f=Kn(d,t),p=ei(i,t);if(void 0!==l&&(f?p&&Qt(p):Qt(Ht.scalePropertyNotWorkWithScaleType(d,t,i))),f&&void 0===p)if(void 0!==l)s.copyKeyFromObject(t,r);else{const n=function(e,t,n,i,r,s,a,u,c,l){const d=l.scale,{type:f,sort:p}=i;switch(e){case"bins":return function(e,t){const n=t.bin;if(cr(n)){const i=ad(e,t.field,n);return new Yd(()=>e.getSignalName(i))}if(lr(n)&&dr(n)&&void 0!==n.step)return{step:n.step};return}(t,i);case"interpolate":return function(e,t){if(U([Ze,Ke,et],e)&&"nominal"!==t)return"hcl";return}(n,f);case"nice":return function(e,t,n){if(n.bin||U([zn.TIME,zn.UTC],e))return;return!!U([Ie,He],t)||void 0}(r,n,i);case"padding":return function(e,t,n,i,r,o){if(U([Ie,He],e)){if(Vn(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:s}=r;if("bar"===t&&!i.bin&&!i.timeUnit&&("vertical"===s&&"x"===e||"horizontal"===s&&"y"===e))return o.continuousBandSize}if(t===zn.POINT)return n.pointPadding}return}(n,r,d,i,c,l.bar);case"paddingInner":return function(e,t,n,i){if(void 0!==e)return;if(U([Ie,He],t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:r}=i;return oe(e,"bar"===n?t:r)}return}(s,n,c.type,d);case"paddingOuter":return function(e,t,n,i,r,o){if(void 0!==e)return;if(U([Ie,He],t)&&n===zn.BAND){const{bandPaddingOuter:e}=o;return oe(e,r/2)}return}(s,n,r,c.type,a,d);case"reverse":return function(e,t){if(Yn(e)&&"descending"===t)return!0;return}(r,p);case"zero":return function(e,t,n,i,r){if(n&&"unaggregated"!==n&&Yn(r)){if(o(n)){const e=n[0],t=n[n.length-1];if(e<=0&&t>=0)return!0}return!1}if("size"===e&&"quantitative"===t.type&&!Jn(r))return!0;if(!t.bin&&U([Ie,He],e)){const{orient:t,type:n}=i;return!U(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e)}return!1}(n,i,u,c,r)}return d[e]}(t,e,i,u,a.get("type"),a.get("padding"),a.get("paddingInner"),r.domain,e.markDef,c);void 0!==n&&s.set(t,n,!1)}})}(e,t):pf(e,t)}function ff(e){vf(e)?sf(e):pf(e,"range")}function pf(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?ff(n):df(n,t);Y(n).forEach(i=>{let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=zl(r,e.getWithExplicit(t),t,"scale",Nl((e,n)=>{switch(t){case"range":return e.step&&n.step?e.step-n.step:0}return 0}))}}n[i].setWithExplicit(t,r)})}function gf(e,t,n,i){const r=function(e,t,n){switch(t.type){case"nominal":case"ordinal":return bt(e)||"discrete"===It(e)?("shape"===e&&"ordinal"===t.type&&Qt(Ht.discreteChannelCannotEncode(e,"ordinal")),"ordinal"):U(["x","y"],e)&&U(["rect","bar","image","rule"],n)?"band":"point";case"temporal":return bt(e)?"time":"discrete"===It(e)?(Qt(Ht.discreteChannelCannotEncode(e,"temporal")),"ordinal"):"time";case"quantitative":return bt(e)?cr(t.bin)?"bin-ordinal":"linear":"discrete"===It(e)?(Qt(Ht.discreteChannelCannotEncode(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(Ht.invalidFieldType(t.type))}(t,n,i),{type:o}=e;return Rt(t)?void 0!==o?ni(t,o)?ti(o,n.type)?o:(Qt(Ht.scaleTypeNotWorkWithFieldDef(o,r)),r):(Qt(Ht.scaleTypeNotWorkWithChannel(t,o,r)),r):r:null}function hf(e){vf(e)?e.component.scales=function(e){const{encoding:t,mark:n}=e;return Ut.reduce((i,r)=>{let o,s;const a=t[r];if(zi(a)&&n===xe&&r===tt&&a.type===_n)return i;if(zi(a)?(o=a,s=a.scale):_i(a)&&(o=a.condition,s=a.condition.scale),o&&null!==s&&!1!==s){s=null!=s?s:{};const t=gf(s,r,o,n);i[r]=new nf(e.scaleName(r+"",!0),{value:t,explicit:s.type===t})}return i},{})}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children)hf(t),Y(t.component.scales).forEach(r=>{var o;if(i.scale[r]=null!=(o=i.scale[r])?o:El(r,e),"shared"===i.scale[r]){const e=n[r],o=t.component.scales[r].getWithExplicit("type");e?Mn(e.value,o.value)?n[r]=zl(e,o,"type","scale",mf):(i.scale[r]="independent",delete n[r]):n[r]=o}});for(const i of Y(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new nf(r,o);for(const t of e.children){const e=t.component.scales[i];e&&(t.renameScale(e.get("name"),r),e.merged=!0)}}return t}(e)}const mf=Nl((e,t)=>Rn(e)-Rn(t));class bf{constructor(){this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function vf(e){var t;return"unit"===(null===(t=e)||void 0===t?void 0:t.type)}function yf(e){var t;return"facet"===(null===(t=e)||void 0===t?void 0:t.type)}function xf(e){var t;return"repeat"===(null===(t=e)||void 0===t?void 0:t.type)}function Af(e){var t;return"concat"===(null===(t=e)||void 0===t?void 0:t.type)}function Of(e){var t;return"layer"===(null===(t=e)||void 0===t?void 0:t.type)}class wf{constructor(e,t,n,i,r,s,a,u){var c,l;this.type=t,this.parent=n,this.config=r,this.repeater=s,this.view=u,this.children=[],this.correctDataNames=e=>(e.from&&e.from.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from&&e.from.facet&&e.from.facet.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e),this.parent=n,this.config=r,this.repeater=s,this.name=null!=(c=e.name)?c:i,this.title=oi(e.title)?{text:e.title}:e.title,this.scaleNameMap=n?n.scaleNameMap:new bf,this.projectionNameMap=n?n.projectionNameMap:new bf,this.signalNameMap=n?n.signalNameMap:new bf,this.data=e.data,this.description=e.description,this.transforms=(l=e.transform,(null!=l?l:[]).map(e=>Go(e)?{filter:$(e.filter,En)}:e)),this.layout=Se(e)||bo(e)?{}:function(e,t,n){var i,r;const s=n[t],a={},{spacing:u,columns:c}=s;void 0!==u&&(a.spacing=u),void 0!==c&&(Ei(e)&&!Di(e.facet)||no(e)&&o(e.repeat)||Kr(e))&&(a.columns=c);for(const t of ro)if(void 0!==e[t])if("spacing"===t){const n=e[t];a[t]=F(n)?n:{row:(i=n.row,null!=i?i:u),column:(r=n.column,null!=r?r:u)}}else a[t]=e[t];return a}(e,t,r),this.component={data:{sources:n?n.component.data.sources:[],outputNodes:n?n.component.data.outputNodes:{},outputNodeRefCounts:n?n.component.data.outputNodeRefCounts:{},isFaceted:Ei(e)||n&&n.component.data.isFaceted&&void 0===e.data},layoutSize:new kl,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:Object.assign({scale:{},axis:{},legend:{}},a?N(a):{}),selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e,{ignoreRange:t}={}){hf(e),Vd(e);for(const t of Zn)df(e,t);t||ff(e)}(this)}parseProjection(){od(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Jl(this)}assembleGroupStyle(){var e,t;if("unit"===this.type||"layer"===this.type)return null!=(t=null===(e=this.view)||void 0===e?void 0:e.style)?t:"cell"}assembleEncodeFromView(e){const t=$e(e,["style"]),n={};for(const e in t)if(O(t,e)){const i=t[e];void 0!==i&&(n[e]={value:i})}return n}assembleGroupEncodeEntry(e){let t=void 0;return this.view&&(t=this.assembleEncodeFromView(this.view)),e||"unit"!==this.type&&"layer"!==this.type?t:Object.assign({width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height")},null!=t?t:{})}assembleLayout(){if(!this.layout)return;const e=this.layout,{spacing:t}=e,n=$e(e,["spacing"]),{component:i,config:r}=this,o=function(e,t){var n;const i={};for(const r of yt){const o=e[r];if(null===(n=o)||void 0===n?void 0:n.facetFieldDef){const{titleAnchor:e,titleOrient:n}=ll(["titleAnchor","titleOrient"],o.facetFieldDef,t,r),s=ul(r,n),a=Al(e,s);void 0!==a&&(i[s]=a)}}return Y(i).length>0?i:void 0}(i.layoutHeaders,r);return Object.assign(Object.assign(Object.assign({padding:t},this.assembleDefaultLayout()),n),o?{titleBand:o}:{})}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of yt)e[n].title&&t.push(pl(this,n));for(const e of dl)t=t.concat(ml(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(e=>Qc(e,"grid",t)),...i.map(e=>Qc(e,"grid",t)),...n.map(e=>Qc(e,"main",t)),...i.map(e=>Qc(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return ed(this)}assembleProjections(){return td(this)}assembleTitle(){var e,t,n;const i=null!=(e=this.title)?e:{},{encoding:r}=i,o=$e(i,["encoding"]),s=Object.assign(Object.assign(Object.assign({},ri(this.config.title).nonMark),o),r?{encode:{update:r}}:{});if(s.text)return U(["unit","layer"],this.type)?U(["middle",void 0],s.anchor)&&(s.frame=null!=(t=s.frame)?t:"group"):s.anchor=null!=(n=s.anchor)?n:"start",Y(s).length>0?s:void 0}assembleGroup(e=[]){const t={};(e=e.concat(this.assembleSignals())).length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||yf(this.parent)?function e(t){return Of(t)||Af(t)||xf(t)?t.children.reduce((t,n)=>t.concat(e(n)),tf(t)):tf(t)}(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}hasDescendantWithFieldOnChannel(e){for(const t of this.children)if(vf(t)){if(t.channelHasField(e))return!0}else if(t.hasDescendantWithFieldOnChannel(e))return!0;return!1}getName(e){return Q((this.name?this.name+"_":"")+e)}requestDataName(e){var t;const n=this.getName(e),i=this.component.data.outputNodeRefCounts;return i[n]=(null!=(t=i[n])?t:0)+1,n}getSizeSignalRef(e){if(yf(this.parent)){const t=zt(e),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(Gn(e)&&ds(i)){const e=n.get("name"),i=Kd(ef(this,t));if(i){return{signal:jl(e,n,Wi({aggregate:"distinct",field:i},{expr:"datum"}))}}return Qt(`Unknown field for ${t}. Cannot calculate view size.`),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):Ct(e)&&Rt(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(Ht.selectionNotFound(t));return n}}class Ff extends wf{vgField(e,t={}){const n=this.fieldDef(e);if(n)return Wi(n,t)}reduceFieldDef(e,t){return xr(this.getMapping(),(t,n,i)=>{const r=Zi(n);return r?e(t,r,i):t},t)}forEachFieldDef(e,t){yr(this.getMapping(),(t,n)=>{const i=Zi(t);i&&e(i,n)},t)}}class Cf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:"value"),(r=o[1],null!=r?r:"density")]}clone(){return new Cf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.density,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${P(this.transform)}`}assemble(){const e=this.transform,{density:t}=e,n=$e(e,["density"]);return Object.assign({type:"kde",field:t},n)}}class jf extends ma{constructor(e,t){super(e),this.filter=t}clone(){return new jf(null,Object.assign({},this.filter))}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==ui("invalid",r,n))return null;const o=t.reduceFieldDef((e,n,r)=>{const o=Rt(r)&&t.getScaleComponent(r);if(o){!Yn(o.get("type"))||n.aggregate||Ae(i)||(e[n.field]=n)}return e},{});return Y(o).length?new jf(e,o):null}dependentFields(){return new Set(Y(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${P(this.filter)}`}assemble(){const e=Y(this.filter).reduce((e,t)=>{const n=this.filter[t],i=Wi(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class Df extends ma{constructor(e,t){super(e),this.transform=t,this.transform=N(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map((e,t)=>{var n;return null!=(n=i[t])?n:e})}clone(){return new Df(this.parent,N(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${P(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Ef extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:"key"),(r=o[1],null!=r?r:"value")]}clone(){return new Ef(null,N(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${P(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Sf extends ma{constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}clone(){return new Sf(null,N(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[Je,Ve],[Xe,Qe]]){const r=i.map(e=>t.channelHasField(e)?t.fieldDef(e).field:Mi(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0);(r[0]||r[1])&&(e=new Sf(e,r,null,t.getName(`geojson_${n++}`)))}if(t.channelHasField(tt)){const i=t.fieldDef(tt);i.type===_n&&(e=new Sf(e,null,i.field,t.getName(`geojson_${n++}`)))}return e}dependentFields(){var e;const t=(e=this.fields,null!=e?e:[]).filter(a);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${P(this.fields)}`}assemble(){return Object.assign(Object.assign(Object.assign({type:"geojson"},this.fields?{fields:this.fields}:{}),this.geojson?{geojson:this.geojson}:{}),{signal:this.signal})}}class kf extends ma{constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}clone(){return new kf(null,this.projection,N(this.fields),N(this.as))}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[Je,Ve],[Xe,Qe]]){const i=n.map(e=>t.channelHasField(e)?t.fieldDef(e).field:Mi(t.encoding[e])?{expr:t.encoding[e].value+""}:void 0),r=n[0]===Xe?"2":"";(i[0]||i[1])&&(e=new kf(e,t.projectionName(),i,[t.getName("x"+r),t.getName("y"+r)]))}return e}dependentFields(){return new Set(this.fields.filter(a))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${P(this.fields)} ${P(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class $f extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new $f(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.impute,this.transform.key,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new $f(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(zi(i)&&zi(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const s=i.impute?r:r.impute?i:void 0,{method:a,value:u,frame:c,keyvals:l}=o.impute,d=Ar(t.mark,n);return new $f(e,Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({impute:o.field,key:s.field},a?{method:a}:{}),void 0!==u?{value:u}:{}),c?{frame:c}:{}),void 0!==l?{keyvals:l}:{}),d.length?{groupby:d}:{}))}return null}hash(){return`Impute ${P(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:s=[null,null]}=this.transform,a=Object.assign(Object.assign(Object.assign(Object.assign({type:"impute",field:e,key:t},n?{keyvals:(u=n,void 0!==(null===(c=u)||void 0===c?void 0:c.stop)?this.processSequence(n):n)}:{}),{method:"value"}),r?{groupby:r}:{}),{value:null});var u,c;let l;if(i&&"value"!==i){l=[Object.assign({type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:s,ignorePeers:!1},r?{groupby:r}:{}),{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}else{l=[{type:"formula",expr:`datum.${e} === null ? ${o} : datum.${e}`,as:e}]}return[a,...l]}}class Bf extends kl{constructor(e={},t={},n=!1){super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}class Nf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:t.on),(r=o[1],null!=r?r:t.loess)]}clone(){return new Nf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.loess,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${P(this.transform)}`}assemble(){const e=this.transform,{loess:t,on:n}=e,i=$e(e,["loess","on"]);return Object.assign({type:"loess",x:n,y:t},i)}}class _f extends ma{constructor(e,t,n){super(e),this.transform=t,this.secondary=n}clone(){return new _f(null,N(this.transform),this.secondary)}static make(e,t,n,i){var r;const o=t.component.data.sources,{from:s}=n;let a=null;if(function(e){return void 0!==e.data}(s)){let e=np(s.data,o);e||(e=new ld(s.data),o.push(e));const n=t.getName(`lookup_${i}`);a=new ba(e,n,"lookup",t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return void 0!==e.selection}(s)){const e=s.selection;if(n.as=null!=(r=n.as)?r:e,a=t.getSelectionComponent(Q(e),e).materialized,!a)throw new Error(Ht.noSameUnitLookup(e))}return new _f(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?x(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${P({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e=Object.assign({values:this.transform.from.fields},this.transform.as?{as:x(this.transform.as)}:{});else{let t=this.transform.as;a(t)||(Qt(Ht.NO_FIELDS_NEEDS_AS),t="_lookup"),e={as:[t]}}return Object.assign(Object.assign({type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup]},e),this.transform.default?{default:this.transform.default}:{})}}class zf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:"prob"),(r=o[1],null!=r?r:"value")]}clone(){return new zf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.quantile,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${P(this.transform)}`}assemble(){const e=this.transform,{quantile:t}=e,n=$e(e,["quantile"]);return Object.assign({type:"quantile",field:t},n)}}class Tf extends ma{constructor(e,t){var n,i,r;super(e),this.transform=t,this.transform=N(t);const o=null!=(n=this.transform.as)?n:[void 0,void 0];this.transform.as=[(i=o[0],null!=i?i:t.on),(r=o[1],null!=r?r:t.regression)]}clone(){return new Tf(null,N(this.transform))}dependentFields(){var e;return new Set([this.transform.regression,this.transform.on,...(e=this.transform.groupby,null!=e?e:[])])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${P(this.transform)}`}assemble(){const e=this.transform,{regression:t,on:n}=e,i=$e(e,["regression","on"]);return Object.assign({type:"regression",x:n,y:t},i)}}class Pf extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Pf(null,N(this.transform))}addDimensions(e){var t;this.transform.groupby=q((t=this.transform.groupby,null!=t?t:[]).concat(e),e=>e)}producedFields(){}dependentFields(){var e;return new Set([this.transform.pivot,this.transform.value,...(e=this.transform.groupby,null!=e?e:[])])}hash(){return`PivotTransform ${P(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return Object.assign(Object.assign(Object.assign({type:"pivot",field:e,value:t},void 0!==i?{limit:i}:{}),void 0!==r?{op:r}:{}),void 0!==n?{groupby:n}:{})}}class Mf extends ma{constructor(e,t){super(e),this.transform=t}clone(){return new Mf(null,N(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${P(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function Uf(e){let t=0;return function n(i,r){var o;if(i instanceof ld&&!i.isGenerator&&!Po(i.data)){e.push(r),r={name:null,source:r.name,transform:[]}}if(i instanceof Fd&&(i.parent instanceof ld&&!r.source?(r.format=Object.assign(Object.assign({},null!=(o=r.format)?o:{}),{parse:i.assembleFormatParse()}),r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof xd)return r.name||(r.name=`data_${t++}`),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void i.assemble().forEach(t=>e.push(t));if((i instanceof fd||i instanceof pd||i instanceof jf||i instanceof Hc||i instanceof sl||i instanceof kf||i instanceof Sf||i instanceof yd||i instanceof _f||i instanceof Dd||i instanceof Cd||i instanceof Ef||i instanceof Df||i instanceof Cf||i instanceof Nf||i instanceof zf||i instanceof Tf||i instanceof Ed||i instanceof Mf||i instanceof Pf)&&r.transform.push(i.assemble()),(i instanceof cd||i instanceof va||i instanceof $f||i instanceof jd)&&r.transform.push(...i.assemble()),i instanceof ba)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof ba)i.setSource(r.name);else if(r.name||(r.name=`data_${t++}`),i.setSource(r.name),1===i.numChildren()){e.push(r),r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof ba&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name=`data_${t++}`);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source,i.children.forEach(e=>{n(e,{name:null,source:o,transform:[]})});break}}}}function Rf(e){return"top"===e||"left"===e?"header":"footer"}function Lf(e,t){var n;if(e.channelHasField(t)){const i=e.facet[t],r=cl("title",null,e.config,t);let s=Vi(i,e.config,{allowDisabling:!0,includeDefault:void 0===r||!!r});e.child.component.layoutHeaders[t].title&&(s=o(s)?s.join(", "):s,s+=" / "+e.child.component.layoutHeaders[t].title,e.child.component.layoutHeaders[t].title=null);const a=cl("labelOrient",i,e.config,t),u=oe((null!=(n=i.header)?n:{}).labels,!0),c=U(["bottom","right"],a)?"footer":"header";e.component.layoutHeaders[t]={title:s,facetFieldDef:i,[c]:"facet"===t?[]:[Wf(e,t,u)]}}}function Wf(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function qf(e,t){var n;const{child:i}=e;if(i.component.axes[t]){const{layoutHeaders:r,resolve:o}=e.component;if(o.axis[t]=Sl(o,t),"shared"===o.axis[t]){const o="x"===t?"column":"row",s=r[o];for(const r of i.component.axes[t]){const t=Rf(r.get("orient"));s[t]=null!=(n=s[t])?n:[Wf(e,o,!1)];const i=Qc(r,"main",e.config,{header:!0});s[t][0].axes.push(i),r.mainExtracted=!0}}}}function If(e){Yf(e);const t=e.component.layoutSize;t.setWithExplicit("width",Vf(e,"width")),t.setWithExplicit("height",Vf(e,"height"))}const Hf=If,Gf={vconcat:"width",hconcat:"height"};function Yf(e){for(const t of e.children)t.parseLayoutSize()}function Vf(e,t){const n="width"===t?"x":"y",i=e.component.resolve;let r;for(const o of e.children){const e=o.component.layoutSize.getWithExplicit(t),s=i.scale[n];if("independent"===s&&"step"===e.value){r=void 0;break}if(r){if("independent"===s&&r.value!==e.value){r=void 0;break}r=zl(r,e,t,"")}else r=e}if(r){for(const n of e.children)e.renameSignal(n.getName(t),e.getName(t)),n.component.layoutSize.set(t,"merged",!1);return r}return{explicit:!1,value:void 0}}function Jf(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(Gn(e)){const e=ao(i.view,t);return ds(n)||io(e)?"step":e}return oo(i.view,t)}if(e.hasProjection)return oo(i.view,t);{const e=ao(i.view,t);return io(e)?e.step:e}}function Qf(e,t){return function(e){return e&&!a(e)&&"repeat"in e}(e.field)?e.field.repeat in t?Object.assign(Object.assign({},e),{field:t[e.field.repeat]}):void Qt(Ht.noSuchRepeatedValue(e.field.repeat)):e}function Xf(e,t){if(void 0!==(e=Qf(e,t))){if(null===e)return null;if(ki(e)&&Ci(e.sort)){const n=Qf(e.sort,t);e=Object.assign(Object.assign({},e),n?{sort:n}:{})}return e}}function Zf(e,t){if(!zi(e)){if(_i(e)){const n=Xf(e.condition,t);if(n)return Object.assign(Object.assign({},e),{condition:n});return $e(e,["condition"])}return e}{const n=Xf(e,t);if(n)return n;if(Ni(e))return{condition:e.condition}}}function Kf(e,t){const n={};for(const i in e)if(O(e,i)){const r=e[i];if(o(r))n[i]=r.map(e=>Zf(e,t)).filter(e=>e);else{const e=Zf(r,t);void 0!==e&&(n[i]=e)}}return n}function ep(e,t,n){return Wi(t,Object.assign({suffix:`by_${Wi(e)}`},null!=n?n:{}))}class tp extends Ff{constructor(e,t,n,i,r){super(e,"facet",t,n,r,i,e.resolve),this.child=jp(e.spec,this,this.getName("child"),void 0,i,r),this.children=[this.child];const o=function(e,t){return Di(e)?Kf(e,t):Xf(e,t)}(e.facet,i);this.facet=this.initFacet(o)}initFacet(e){return Di(e)?xr(e,(e,t,n)=>U([Le,We],n)?void 0===t.field?(Qt(Ht.emptyFieldDef(t,n)),e):(e[n]=er(t,n),e):(Qt(Ht.incompatibleChannel(n,"facet")),e),{}):{facet:er(e,"facet")}}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=rp(this),this.child.parseData()}parseLayoutSize(){Yf(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of yt)Lf(e,t);qf(e,"x"),qf(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){var e,t,n,i;const r={};for(const o of yt)for(const s of fl){const a=this.component.layoutHeaders[o],u=a[s],{facetFieldDef:c}=a;if(c){const t=cl("titleOrient",c,this.config,o);if(U(["right","bottom"],t)){const n=ul(o,t);r.titleAnchor=null!=(e=r.titleAnchor)?e:{},r.titleAnchor[n]="end"}}if(null===(t=u)||void 0===t?void 0:t[0]){const e="row"===o?"height":"width",t="header"===s?"headerBand":"footerBand";"facet"===o||this.child.component.layoutSize.get(e)||(r[t]=null!=(n=r[t])?n:{},r[t][o]=.5),a.title&&(r.offset=null!=(i=r.offset)?i:{},r.offset["row"===o?"rowTitle":"columnTitle"]=10)}}return r}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),Object.assign(Object.assign(Object.assign({},this.getHeaderLayoutMixins()),n?{columns:n}:{}),{bounds:"full",align:i})}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof tp)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroup(e){return this.parent&&this.parent instanceof tp?Object.assign(Object.assign({},this.channelHasField("column")?{encode:{update:{columns:{field:Wi(this.facet.column,{prefix:"distinct"})}}}}:{}),super.assembleGroup(e)):super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof tp){if(this.child.channelHasField("column")){const i=Wi(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of["x","y"]){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),s=r.get("range");if(Gn(o)&&ds(s)){const r=Kd(ef(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Qt(`Unknown field for ${i}. Cannot calculate view size.`)}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:t}=this.component.data.facetRoot,{row:n,column:i}=this.facet,{fields:r,ops:s,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const e of yt){const t=this.facet[e];if(t){u.push(Wi(t));const{bin:c,sort:l}=t;if(cr(c)&&u.push(Wi(t,{binSuffix:"end"})),Ci(l)){const{field:e,op:o=Ai}=l,u=ep(t,l);n&&i?(r.push(u),s.push("max"),a.push(u)):(r.push(e),s.push(o),a.push(u))}else if(o(l)){const n=al(t,e);r.push(n),s.push("max"),a.push(n)}}}const c=!!n&&!!i;return Object.assign({name:e,data:t,groupby:u},c||r.length>0?{aggregate:Object.assign(Object.assign({},c?{cross:c}:{}),r.length?{fields:r,ops:s,as:a}:{})}:{})}facetSortFields(e){const{facet:t}=this,n=t[e];return n?Ci(n.sort)?[ep(n,n.sort,{expr:"datum"})]:o(n.sort)?[al(n,e,{expr:"datum"})]:[Wi(n,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:t}=this,n=t[e];if(n){const{sort:e}=n;return[(Ci(e)?e.order:!o(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return vl(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of dl)if(e[i]){const r=cl("labelOrient",e[i],t,i);if(U(n[i],r))return vl(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Uf(t);return e.children.forEach(t=>n(t,{source:e.name,name:null,transform:[]})),t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:this.getName("cell"),type:"group"},i?{title:i}:{}),r?{style:r}:{}),{from:{facet:this.assembleFacet()},sort:{field:yt.map(e=>this.facetSortFields(e)).flat(),order:yt.map(e=>this.facetSortOrder(e)).flat()}}),t.length>0?{data:t}:{}),n?{encode:{update:n}}:{}),e.assembleGroup(function(e,t){if(e.component.selection&&Y(e.component.selection).length){const n=u(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:xs("mousemove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return Ra(t)}(this,[])))]}getMapping(){return this.facet}}function np(e,t){var n,i,r,o,s,a,u,c,l,d;for(const f of t){const t=f.data;if((!e.name||!f.hasName()||e.name===f.dataName)&&!((null===(n=e.format)||void 0===n?void 0:n.mesh)&&(null===(i=t.format)||void 0===i?void 0:i.feature)||((null===(r=e.format)||void 0===r?void 0:r.feature)||(null===(o=t.format)||void 0===o?void 0:o.feature))&&(null===(s=e.format)||void 0===s?void 0:s.feature)!==(null===(a=t.format)||void 0===a?void 0:a.feature)||((null===(u=e.format)||void 0===u?void 0:u.mesh)||(null===(c=t.format)||void 0===c?void 0:c.mesh))&&(null===(l=e.format)||void 0===l?void 0:l.mesh)!==(null===(d=t.format)||void 0===d?void 0:d.mesh)))if(Mo(e)&&Mo(t)){if(B(e.values,t.values))return f}else if(Po(e)&&Po(t)){if(e.url===t.url)return f}else if(Uo(e)&&e.name===f.dataName)return f}return null}function ip(e,t){if(e.data||!e.parent){if(null===e.data){const e=new ld([]);return t.push(e),e}const n=np(e.data,t);if(n)return Ro(e.data)||(n.data.format=function(e,...t){for(const n of t)W(e,null!=n?n:{});return e}({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new ld(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function rp(e){var t,n,i,r,o,s,a,u,c,l,d;let f=ip(e,e.component.data.sources);const{outputNodes:p,outputNodeRefCounts:g}=e.component.data,h=e.parent?e.parent.component.data.ancestorParse.clone():new Bf,m=e.data;Ro(m)?(Lo(m)?f=new pd(f,m.sequence):qo(m)&&(f=new fd(f,m.graticule)),h.parseNothing=!0):null===(null===(n=null===(t=m)||void 0===t?void 0:t.format)||void 0===n?void 0:n.parse)&&(h.parseNothing=!0),f=null!=(i=Fd.makeExplicit(f,e,h))?i:f,f=new Ed(f);const b=e.parent&&Of(e.parent);(vf(e)||yf(e))&&b&&(f=null!=(r=cd.makeFromEncoding(f,e))?r:f),e.transforms.length>0&&(f=function(e,t,n){var i,r;let o=0;for(const s of t.transforms){let a,u=void 0;if(is(s))a=e=new sl(e,s),u="derived";else if(Go(s)){const r=Od(s);a=e=null!=(i=Fd.makeWithAncestors(e,{},r,n))?i:e,e=new Hc(e,t,s.filter)}else if(rs(s))a=e=cd.makeFromTransform(e,s,t),u="number";else if(ss(s)){u="date",void 0===n.getWithExplicit(s.field).value&&(e=new Fd(e,{[s.field]:u}),n.set(s.field,u,!1)),a=e=va.makeFromTransform(e,s)}else if(as(s))a=e=yd.makeFromTransform(e,s),u="number",tu(t)&&(e=new Ed(e));else if(Yo(s))a=e=_f.make(e,t,s,o++),u="derived";else if(es(s))a=e=new Dd(e,s),u="number";else if(ts(s))a=e=new Cd(e,s),u="number";else if(us(s))a=e=jd.makeFromTransform(e,s),u="derived";else if(cs(s))a=e=new Ef(e,s),u="derived";else if(ns(s))a=e=new Df(e,s),u="derived";else if(Vo(s))a=e=new Pf(e,s),u="derived";else if(Ko(s))e=new Mf(e,s);else if(os(s))a=e=$f.makeFromTransform(e,s),u="derived";else if(Jo(s))a=e=new Cf(e,s),u="derived";else if(Qo(s))a=e=new zf(e,s),u="derived";else if(Xo(s))a=e=new Tf(e,s),u="derived";else{if(!Zo(s)){Qt(Ht.invalidTransformIgnored(s));continue}a=e=new Nf(e,s),u="derived"}if(a&&void 0!==u)for(const e of null!=(r=a.producedFields())?r:[])n.set(e,u,!1)}return e}(f,e,h));const v=function(e){const t={};if(vf(e)&&e.component.selection)for(const n of Y(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&re(e.field)>1&&(t[e.field]="flatten")}return t}(e),y=wd(e);f=null!=(o=Fd.makeWithAncestors(f,{},Object.assign(Object.assign({},v),y),h))?o:f,vf(e)&&(f=Sf.parseAll(f,e),f=kf.parseAll(f,e)),(vf(e)||yf(e))&&(b||(f=null!=(s=cd.makeFromEncoding(f,e))?s:f),f=null!=(a=va.makeFromEncoding(f,e))?a:f,f=sl.parseAllForSortIndex(f,e));const x=e.getName(Ho),A=new ba(f,x,Ho,g);if(p[x]=A,f=A,vf(e)){const t=yd.makeFromEncoding(f,e);t&&(f=t,tu(e)&&(f=new Ed(f))),f=null!=(u=$f.makeFromEncoding(f,e))?u:f,f=null!=(c=jd.makeFromEncoding(f,e))?c:f}vf(e)&&(f=null!=(l=jf.make(f,e))?l:f);const O=e.getName(Io),w=new ba(f,O,Io,g);p[O]=w,f=w,vf(e)&&function(e,t){Ka(e,n=>{const i=n.name,r=e.getName(`lookup_${i}`);e.component.data.outputNodes[r]=n.materialized=new ba(new Hc(t,e,{selection:i}),r,"lookup",e.component.data.outputNodeRefCounts)})}(e,w);let F=null;if(yf(e)){const t=e.getName("facet");f=sl.parseAllForSortIndex(f,e),f=null!=(d=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Ci(r.sort)){const{field:n,op:i=Ai}=r.sort;e=t=new Cd(e,{joinaggregate:[{op:i,field:n,as:ep(r,r.sort,{forAs:!0})}],groupby:[Wi(r)]})}return t}return null}(f,e.facet))?d:f,F=new xd(f,e,t,w.getSource()),p[t]=F,f=F}return Object.assign(Object.assign({},e.component.data),{outputNodes:p,outputNodeRefCounts:g,raw:A,main:w,facetRoot:F,ancestorParse:h})}class op extends wf{constructor(e,t,n,i,r,o,s){super(e,t,n,i,r,o,s)}parseData(){this.component.data=rp(this),this.children.forEach(e=>{e.parseData()})}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),Y(e.component.selection).forEach(t=>{this.component.selection[t]=e.component.selection[t]})}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){return this.children.reduce((e,t)=>[...e,...t.assembleLayoutSignals()],wl(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleMarks(){return this.children.map(e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return Object.assign(Object.assign(Object.assign(Object.assign({type:"group",name:e.getName("group")},t?{title:t}:{}),n?{style:n}:{}),i?{encode:{update:i}}:{}),e.assembleGroup())})}}class sp extends op{constructor(e,t,n,i,r){var o,s,a,u;super(e,"concat",t,n,r,i,e.resolve),"shared"!==(null===(s=null===(o=e.resolve)||void 0===o?void 0:o.axis)||void 0===s?void 0:s.x)&&"shared"!==(null===(u=null===(a=e.resolve)||void 0===a?void 0:a.axis)||void 0===u?void 0:u.y)||Qt(Ht.CONCAT_CANNOT_SHARE_AXIS),this.concatType=eo(e)?"vconcat":to(e)?"hconcat":"concat",this.children=this.getChildren(e).map((e,t)=>jp(e,this,this.getName("concat_"+t),void 0,i,r))}getChildren(e){return eo(e)?e.vconcat:to(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Yf(e);const t=e.component.layoutSize,n=Gf[e.concatType];n&&t.setWithExplicit(n,Vf(e,n))}(this)}parseAxisGroup(){return null}assembleDefaultLayout(){return Object.assign(Object.assign({},"vconcat"===this.concatType?{columns:1}:{}),{bounds:"full",align:"each"})}}const ap=Object.assign(Object.assign({gridScale:1,scale:1},vs),{labelExpr:1,encode:1}),up=Y(ap);class cp extends kl{constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new cp(N(this.explicit),N(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}}const lp={bottom:"top",top:"bottom",left:"right",right:"left"};function dp(e,t){if(!e)return t.map(e=>e.clone());{if(e.length!==t.length)return;const n=e.length;for(let i=0;i<n;i++){const n=e[i],r=t[i];if(!!n!=!!r)return;if(n&&r){const t=n.getWithExplicit("orient"),o=r.getWithExplicit("orient");if(t.explicit&&o.explicit&&t.value!==o.value)return;e[i]=fp(n,r)}}}return e}function fp(e,t){for(const n of up){const i=zl(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(e,t)=>{switch(n){case"title":return xi(e,t);case"gridScale":return{explicit:e.explicit,value:oe(e.value,t.value)}}return _l(e,t,n,"axis")});e.setWithExplicit(n,i)}return e}function pp(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,s=r?r.title:void 0;return o&&s?yi(o,s):o||(s||(void 0!==o?o:void 0!==s?s:void 0))}function gp(e,t){var n;const i=t.axis(e),r=new cp;up.forEach(n=>{const o=function(e,t,n,i){const r=i.fieldDef(n),o=function(e,t,n,i){if(void 0!==t.labelAngle)return ae(t.labelAngle);{const t=nl("labelAngle",e.config,n,ol(n),e.getScaleComponent(n).get("type"));return void 0!==t?ae(t):n===Ie&&U([Nn,$n],i.type)?270:void 0}}(i,t,n,r),s=oe(t.orient,ol(n)),{mark:a,config:u}=i;switch(e){case"scale":return i.scaleName(n);case"gridScale":return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}(i,n);case"format":if(rr(r))return;return fi(r,t.format,u);case"formatType":if(rr(r))return;return t.formatType;case"grid":if(lr(i.fieldDef(n).bin))return!1;{const e=i.getScaleComponent(n).get("type");return oe(t.grid,function(e,t){return!Gn(e)&&!cr(t.bin)}(e,r))}case"labelAlign":return oe(t.labelAlign,rl(o,s));case"labelAngle":return o;case"labelBaseline":return oe(t.labelBaseline,il(o,s));case"labelFlush":return oe(t.labelFlush,function(e,t){if("x"===t&&U(["quantitative","temporal"],e.type))return!0}(r,n));case"labelOverlap":{const e=i.getScaleComponent(n).get("type");return oe(t.labelOverlap,function(e,t){if("nominal"!==e.type)return"log"!==t||"greedy"}(r,e))}case"orient":return s;case"tickCount":{const e=i.getScaleComponent(n).get("type"),o="x"===n?"width":"y"===n?"height":void 0,s=o?i.getSizeSignalRef(o):void 0;return oe(t.tickCount,function({fieldDef:e,scaleType:t,size:n}){if(!Gn(t)&&"log"!==t&&!U(["month","hours","day","quarter"],e.timeUnit))return cr(e.bin)?{signal:`ceil(${n.signal}/10)`}:{signal:`ceil(${n.signal}/40)`}}({fieldDef:r,scaleType:e,size:s}))}case"title":{const e="x"===n?"x2":"y2",o=i.fieldDef(e);return oe(t.title,pp(i,n),vi([Si(r)],o?[Si(o)]:[]))}case"values":return function(e,t,n){const i=e.values;if(i)return sr(n,i)}(t,0,r);case"zindex":return oe(t.zindex,function(e,t){return"rect"===e&&qi(t)?1:0}(a,r))}return c=e,ys[c]?t[e]:void 0;var c}(n,i,e,t);if(void 0!==o){const s=function(e,t,n,i,r){switch(t){case"titleAngle":case"labelAngle":return e===ae(n[t]);case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===pp(i,r))return!0}return e===n[t]}(o,n,i,t,e),a=nl(n,t.config,e,r.get("orient"),t.getScaleComponent(e).get("type"));s||void 0===a?r.set(n,o,s):U(["grid","orient"],n)&&a&&r.set(n,a,!1)}});const o=null!=(n=i.encoding)?n:{},s=ms.reduce((n,i)=>{var s;if(!r.hasAxisPart(i))return n;const a=Dl(null!=(s=o[i])?s:{},t),u="labels"===i?function(e,t,n){var i;const r=null!=(i=e.fieldDef(t))?i:"x"===t?e.fieldDef("x2"):"y"===t?e.fieldDef("y2"):void 0,o=e.axis(t);let s={};if(rr(r)){const n=e.getScaleComponent(t).get("type")===zn.UTC,i=mi("datum.value",r.timeUnit,o.format,null,n);i&&(s.text={signal:i})}return s=Object.assign(Object.assign({},s),n),0===Y(s).length?void 0:s}(t,e,a):a;return void 0!==u&&Y(u).length>0&&(n[i]={update:u}),n},{});return Y(s).length>0&&r.set("encode",s,!!i.encoding||void 0!==i.labelAngle),r}function hp(e,t,n,{graticule:i}){var r,o;const s=Fe(e)?Object.assign({},e):{type:e},a=null!=(r=s.orient)?r:ci("orient",s,n);return s.orient=function(e,t,n){switch(e){case fe:case ve:case ye:case he:case pe:case le:return}const{x:i,y:r,x2:o,y2:s}=t;switch(e){case ce:if(zi(i)&&(lr(i.bin)||zi(r)&&r.aggregate&&!i.aggregate))return"vertical";if(zi(r)&&(lr(r.bin)||zi(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(s||o){if(n)return n;if(!o&&zi(i)&&i.type===kn&&!cr(i.bin))return"horizontal";if(!s&&zi(r)&&r.type===kn&&!cr(r.bin))return"vertical"}case ge:if(o&&s)return;case ue:if(s)return zi(r)&&lr(r.bin)?"horizontal":"vertical";if(o)return zi(i)&&lr(i.bin)?"vertical":"horizontal";if(e===ge){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case de:case me:{const t=zi(i)&&Ii(i),o=zi(r)&&Ii(r);if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o){const t=i,o=r,s=t.type===Bn,a=o.type===Bn;return s&&!a?"tick"!==e?"vertical":"horizontal":!s&&a?"tick"!==e?"horizontal":"vertical":!t.aggregate&&o.aggregate?"tick"!==e?"vertical":"horizontal":t.aggregate&&!o.aggregate?"tick"!==e?"horizontal":"vertical":n||"vertical"}return n||void 0}}return"vertical"}(s.type,t,a),void 0!==a&&a!==s.orient&&Qt(Ht.orientOverridden(s.orient,a)),void 0===oe(s.opacity,ci("opacity",s,n))&&(s.opacity=function(e,t){if(U([fe,me,ve,ye],e)&&!hr(t))return.7;return}(s.type,t)),void 0===s.filled&&(s.filled=!i&&function(e,t){const n=ci("filled",e,t),i=e.type;return oe(n,i!==fe&&i!==de&&i!==ge)}(s,n)),void 0===(null!=(o=s.cursor)?o:ci("cursor",s,n))&&(s.cursor=function(e,t,n){if(t.href||e.href||ci("href",e,n))return"pointer";return e.cursor}(s,t,n)),s}function mp(e,t){const{config:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Gs("size",e)),function(e,t,n){if(n)return{shape:{value:n}};return Gs("shape",e)}(e,0,t))}function bp(e){const{config:t,markDef:n}=e,{orient:i}=n,r="horizontal"===i?"width":"height",o=e.getScaleComponent("horizontal"===i?"x":"y"),s=oe(n[r],n.size,ci("size",n,t,{vgChannel:r}),t.tick.bandSize);if(void 0!==s)return s;{const e=o?o.get("range"):void 0;return e&&ds(e)&&F(e.step)?3*e.step/4:3*so(t.view,r)/4}}const vp={area:{vgMark:"area",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore"})),ra("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient})),ra("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient})),pa(e))},bar:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),aa(e,"x","bar")),aa(e,"y","bar"))},circle:{vgMark:"symbol",encodeEntry:e=>mp(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[Object.assign({type:"geoshape",projection:e.projectionName()},n&&zi(n)&&n.type===_n?{field:Wi(n,{expr:"datum"})}:{})]}},image:{vgMark:"image",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore"})),aa(e,"x","image")),aa(e,"y","image")),Vs(e,"url"))},line:{vgMark:"line",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Gs("size",e,{vgChannel:"strokeWidth"})),pa(e))},point:{vgMark:"symbol",encodeEntry:e=>mp(e)},rect:{vgMark:"rect",encodeEntry:e=>Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),aa(e,"x","rect")),aa(e,"y","rect"))},rule:{vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),ra("x",e,{defaultPos:"horizontal"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"vertical"!==n})),ra("y",e,{defaultPos:"vertical"===n?"zeroOrMin":"mid",defaultPos2:"zeroOrMax",range:"horizontal"!==n})),Gs("size",e,{vgChannel:"strokeWidth"})):{}}},square:{vgMark:"symbol",encodeEntry:e=>mp(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Vs(e)),Gs("size",e,{vgChannel:"fontSize"})),ga("align",function(e,t,n){var i;if(void 0===(null!==(i=e.align)&&void 0!==i?i:ci("align",e,n)))return"center";return}(e.markDef,0,t))),ga("baseline",function(e,t,n){var i;if(void 0===(null!==(i=e.baseline)&&void 0!==i?i:ci("baseline",e,n)))return"middle";return}(e.markDef,0,t)))}},tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore"})),Ks("x",e,{defaultPos:"mid",vgChannel:"xc"})),Ks("y",e,{defaultPos:"mid",vgChannel:"yc"})),Gs("size",e,{defaultValue:bp(e),vgChannel:r})),{[o]:{value:oe(n.thickness,t.tick.thickness)}})}},trail:{vgMark:"trail",encodeEntry:e=>Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},da(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore"})),Ks("x",e,{defaultPos:"mid"})),Ks("y",e,{defaultPos:"mid"})),Gs("size",e)),pa(e))}};function yp(e){return U([de,ue,be],e.mark)?function(e){const t=Ar(e.mark,e.encoding),n=Op(e,{fromPrefix:t.length>0?xp:""});return t.length>0?[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:xp+e.requestDataName(Io),data:e.requestDataName(Io),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:n}]:n}(e):U([ce],e.mark)?function(e){var t;const n=gs.some(t=>e.markDef[t]||ci(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&n){const[n]=Op(e,{fromPrefix:Ap}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(e,t)=>{return`${e}(${[r({prefix:"min",suffix:"start",expr:t}),r({prefix:"max",suffix:"start",expr:t}),r({prefix:"min",suffix:"end",expr:t}),r({prefix:"max",suffix:"end",expr:t})].map(e=>`scale('${i}',${e})`).join(",")})`};let s,a;"x"===e.stack.fieldChannel?(s=Object.assign(Object.assign({},_(n.encode.update,["y","yc","y2","height",...gs])),{x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}}),a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update=Object.assign(Object.assign({},z(n.encode.update,["y","yc","y2"])),{height:{field:{group:"height"}}})):(s=Object.assign(Object.assign({},_(n.encode.update,["x","xc","x2","width"])),{y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}}),a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update=Object.assign(Object.assign({},z(n.encode.update,["x","xc","x2"])),{width:{field:{group:"width"}}}));for(const t of gs){const i=ci(t,e.markDef,e.config);n.encode.update[t]?(s[t]=n.encode.update[t],delete n.encode.update[t]):i&&(s[t]={value:i}),i&&(n.encode.update[t]={value:0})}const u=e.vgField(e.stack.groupbyChannel)?[e.vgField(e.stack.groupbyChannel)]:[];return(null===(t=e.fieldDef(e.stack.groupbyChannel))||void 0===t?void 0:t.bin)&&u.push(e.vgField(e.stack.groupbyChannel,{binSuffix:"end"})),s=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((t,i)=>{if(n.encode.update[i])return Object.assign(Object.assign({},t),{[i]:n.encode.update[i]});{const n=ci(i,e.markDef,e.config);return void 0!==n?Object.assign(Object.assign({},t),{[i]:{value:n}}):t}},s),s.stroke&&(s.strokeForeground={value:!0},s.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Io),name:Ap+e.requestDataName(Io),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:s},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}return Op(e)}(e):Op(e)}const xp="faceted_path_";const Ap="stack_group_";function Op(e,t={fromPrefix:""}){const n=e.mark,i=oe(e.markDef.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!!(t&&t.get("selectionExtent")||n&&n.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),r=ai(e.markDef),s=e.encoding.key,a=function(e){const{encoding:t,stack:n,mark:i,markDef:r,config:s}=e,a=t.order;if(!(!o(a)&&Mi(a)&&M(a.value)||!a&&M(r.order)||M(ci("order",r,s)))){if((o(a)||zi(a))&&!n)return bi(a,{expr:"datum"});if(Ae(i)){const n="horizontal"===r.orient?"y":"x",i=t[n];if(zi(i)){const t=i.sort;if(o(t))return{field:Wi(i,{prefix:n,suffix:"sort_index",expr:"datum"})};if(Ci(t))return{field:Wi({aggregate:hr(e.encoding)?t.op:void 0,field:t.field},{expr:"datum"})};if(Fi(t)){return{field:Wi(e.fieldDef(t.encoding),{expr:"datum"}),order:t.order}}return{field:Wi(i,{binSuffix:e.stack&&e.stack.impute?"mid":void 0,expr:"datum"})}}}else;}}(e),u=function(e){if(!e.component.selection)return null;const t=Y(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=Y(i.component.selection).length,i=i.parent;return n?{interactive:t>0}:null}(e),c=vp[n].postEncodingTransform?vp[n].postEncodingTransform(e):null;return[Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({name:e.getName("marks"),type:vp[n].vgMark},i?{clip:!0}:{}),r?{style:r}:{}),s?{key:s.field}:{}),a?{sort:a}:{}),u||{}),{from:{data:t.fromPrefix+e.requestDataName(Io)},encode:{update:vp[n].encodeEntry(e)}}),c?{transform:c}:{})]}class wp extends Ff{constructor(e,t,n,i={},r,o){var s;super(e,"unit",t,n,o,r,void 0,e.view),this.specifiedScales={},this.specifiedAxes={},this.specifiedLegends={},this.specifiedProjection={},this.selection={},this.children=[];const a=Fe(e.mark)?e.mark.type:e.mark,u=function(e,t){return Kf(e,t)}(null!=(s=e.encoding)?s:{},r);this.markDef=hp(e.mark,u,o,{graticule:e.data&&qo(e.data)});const c=this.encoding=br(u,this.markDef);this.size=function({encoding:e,size:t}){for(const n of Nt){const i=_t(n),r=Zi(e[n]);io(t[i])&&r&&Ii(r)&&(delete t[i],Qt(Ht.stepDropped(i)))}return t}({encoding:c,size:Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{})}),this.stack=Oo(a,c),this.specifiedScales=this.initScales(a,c),this.specifiedAxes=this.initAxes(c),this.specifiedLegends=this.initLegend(c),this.specifiedProjection=e.projection,this.selection=e.selection}get hasProjection(){const{encoding:e}=this,t=this.mark===xe,n=e&&ht.some(t=>zi(e[t]));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return Ut.reduce((e,n)=>{let i,r;const o=t[n];return zi(o)?(i=o,r=o.scale):_i(o)&&(i=o.condition,r=o.condition.scale),i&&(e[n]=null!=r?r:{}),e},{})}initAxes(e){return[Ie,He].reduce((t,n)=>{const i=e[n];if(zi(i)||n===Ie&&zi(e.x2)||n===He&&zi(e.y2)){const e=zi(i)?i.axis:null;null!==e&&(t[n]=Object.assign({},e))}return t},{})}initLegend(e){return Pt.reduce((t,n)=>{const i=e[n];if(i){const e=zi(i)?i.legend:_i(i)?i.condition.legend:null;null!==e&&!1!==e&&function(e){switch(e){case Ze:case Ke:case et:case nt:case tt:case it:case st:return!0;case rt:case ot:return!1}}(n)&&(t[n]=Object.assign({},e))}return t},{})}parseData(){this.component.data=rp(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Nt){const r=_t(i);if(t[r]){const e=t[r];n.layoutSize.set(r,io(e)?"step":e,!0)}else{const t=Jf(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,t){var n;const i={},r=e.config.selection;for(const o in t){if(!O(t,o))continue;const s=N(t[o]),u=$e(r[s.type],["fields","encodings"]);for(const e in u)"encodings"===e&&s.fields||"fields"===e&&s.encodings||("mark"===e&&(s[e]=Object.assign(Object.assign({},u[e]),s[e])),void 0!==s[e]&&!0!==s[e]||(s[e]=null!=(n=u[e])?n:s[e]));const c=Q(o),l=i[c]=Object.assign(Object.assign({},s),{name:c,events:a(s.on)?xs(s.on,"scope"):N(s.on)});Pa(l,n=>{n.has(l)&&n.parse&&n.parse(e,l,s,t[o])})}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=yp(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Nt.reduce((t,n)=>(e.component.scales[n]&&e.axis(n)&&(t[n]=[gp(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,t){let n=!1;if(Ka(e,(i,r)=>{const o=i.name,s=u(o+Va);if(0===t.filter(e=>e.name===o).length){const e="global"===i.resolve?"union":i.resolve,n="multi"===i.type?", true)":")";t.push({name:i.name,update:`${Xa}(${s}, ${u(e)}${n}`})}n=!0,r.topLevelSignals&&(t=r.topLevelSignals(e,i,t)),Pa(i,n=>{n.topLevelSignals&&(t=n.topLevelSignals(e,i,t))})}),n){0===t.filter(e=>"unit"===e.name).length&&t.unshift({name:"unit",value:{},on:[{events:"mousemove",update:"isTuple(group()) ? group() : unit"}]})}return Ra(t)}(this,e)}assembleSignals(){return[...Xc(this),...(e=this,t=[],Ka(e,(n,i)=>{const r=n.name;let o=i.modifyExpr(e,n);t.push(...i.signals(e,n)),Pa(n,i=>{i.signals&&(t=i.signals(e,n,t)),i.modifyExpr&&(o=i.modifyExpr(e,n,o))}),t.push({name:r+Qa,on:[{events:{signal:n.name+Ja},update:`modify(${u(n.name+Va)}, ${o})`}]})}),Ra(t))];var e,t}assembleSelectionData(e){return function(e,t){const n=[...t];return Ka(e,t=>{const i={name:t.name+Va};if(t.init){const n=t.project.items.map(e=>{return $e(e,["signals"])}),r=t.init.map(e=>Ma(e,!1));i.values="interval"===t.type?[{unit:eu(e,{escape:!1}),fields:n,values:r}]:r.map(t=>({unit:eu(e,{escape:!1}),fields:n,values:t}))}n.filter(e=>e.name===t.name+Va).length||n.push(i)}),n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return wl(this)}assembleMarks(){var e;let t=null!=(e=this.component.mark)?e:[];return this.parent&&Of(this.parent)||(t=Ua(this,t)),t.map(this.correctDataNames)}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return gr(this.encoding,e)}fieldDef(e){return Ki(this.encoding[e])}}class Fp extends wf{constructor(e,t,n,i,r,o){super(e,"layer",t,n,o,r,e.resolve,e.view);const s=Object.assign(Object.assign(Object.assign({},i),e.width?{width:e.width}:{}),e.height?{height:e.height}:{});this.children=e.layer.map((e,t)=>{if(bo(e))return new Fp(e,this,this.getName("layer_"+t),s,r,o);if(Se(e))return new wp(e,this,this.getName("layer_"+t),s,r,o);throw new Error(Ht.invalidSpec(e))})}parseData(){this.component.data=rp(this);for(const e of this.children)e.parseData()}parseLayoutSize(){If(this)}parseSelections(){this.component.selection={};for(const e of this.children)e.parseSelections(),Y(e.component.selection).forEach(t=>{this.component.selection[t]=e.component.selection[t]})}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){var t;const{axes:n,resolve:i}=e.component,r={top:0,bottom:0,right:0,left:0};for(const t of e.children){t.parseAxesAndHeaders();for(const r of Y(t.component.axes))i.axis[r]=Sl(e.component.resolve,r),"shared"===i.axis[r]&&(n[r]=dp(n[r],t.component.axes[r]),n[r]||(i.axis[r]="independent",delete n[r]))}for(const o of[Ie,He]){for(const s of e.children)if(s.component.axes[o]){if("independent"===i.axis[o]){n[o]=(t=n[o],null!=t?t:[]).concat(s.component.axes[o]);for(const e of s.component.axes[o]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(r[t]>0&&!n){const n=lp[t];r[t]>r[n]&&e.set("orient",n,!1)}r[t]++}}delete s.component.axes[o]}if("independent"===i.axis[o]&&n[o]&&n[o].length>1)for(const e of n[o])e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleSignals()),Xc(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),wl(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)vf(n)&&(t=Ua(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),ed(this))}}class Cp extends op{constructor(e,t,n,i,r){super(e,"repeat",t,n,r,i,e.resolve),e.resolve&&e.resolve.axis&&("shared"===e.resolve.axis.x||"shared"===e.resolve.axis.y)&&Qt(Ht.REPEAT_CANNOT_SHARE_AXIS),this.repeat=e.repeat,this.children=this._initChildren(e,this.repeat,i,r)}_initChildren(e,t,n,i){const r=[],s=!o(t)&&t.row||[n?n.row:null],a=!o(t)&&t.column||[n?n.column:null],u=o(t)&&t||[n?n.repeat:null];for(const t of u)for(const n of s)for(const o of a){const s=(t?`__repeat_repeat_${t}`:"")+(n?`__repeat_row_${n}`:"")+(o?`__repeat_column_${o}`:""),a={repeat:t,row:n,column:o};r.push(jp(e.spec,this,this.getName("child"+s),void 0,a,i))}return r}parseLayoutSize(){Hf(this)}assembleDefaultLayout(){const{repeat:e}=this,t=o(e)?void 0:e.column?e.column.length:1;return Object.assign(Object.assign({},t?{columns:t}:{}),{bounds:"full",align:"all"})}}function jp(e,t,n,i,r,o){if(Ei(e))return new tp(e,t,n,r,o);if(bo(e))return new Fp(e,t,n,i,r,o);if(Se(e))return new wp(e,t,n,i,r,o);if(no(e))return new Cp(e,t,n,r,o);if(function(e){return eo(e)||to(e)||Kr(e)}(e))return new sp(e,t,n,r,o);throw new Error(Ht.invalidSpec(e))}const Dp=new class extends vo{mapUnit(e,{config:t}){if(e.encoding){const{encoding:n,transform:i}=e,{bins:r,timeUnits:o,aggregate:s,groupby:a,encoding:u}=mr(n,t),c=[...i||[],...r,...o,...0===s.length?[]:[{aggregate:s,groupby:a}]];return Object.assign(Object.assign(Object.assign({},e),c.length>0?{transform:c}:{}),{encoding:u})}return e}};const Ep=t;e.compile=function(e,t={}){var n;t.logger&&(n=t.logger,Jt=n),t.fieldTitle&&Yi(t.fieldTitle);try{const n=lo(b({},t.config,e.config)),i=Bo(e,n),r=jp(i,null,"",void 0,void 0,n);return r.parse(),function(e,t){dd(e.sources);let n=0,i=0;for(let i=0;i<Wd&&Gd(e,t);i++)n++;e.sources.map(_d);for(let n=0;n<Wd&&Gd(e,t);n++)i++;dd(e.sources),Math.max(n,i)===Wd&&Qt(`Maximum optimization runs(${Wd}) reached.`)}(r.component.data,r),{spec:function(e,t,n={},i){const r=e.config?ho(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){var n,i;const r=[],o=Uf(r);let s=0;e.sources.forEach(e=>{e.hasName()||(e.dataName=`source_${s++}`);const t=e.assemble();o(e,t)}),r.forEach(e=>{0===e.transform.length&&delete e.transform});let a=0;for(const[e,t]of r.entries())0!==(n=t.transform,null!=n?n:[]).length||t.source||r.splice(a++,0,r.splice(e,1)[0]);for(const t of r)for(const n of null!=(i=t.transform)?i:[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of r)e.name in t&&(e.values=t[e.name]);return r}(e.component.data,n)),s=e.assembleProjections(),a=e.assembleTitle(),u=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let l=e.assembleLayoutSignals();return l=l.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)),Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({$schema:"https://vega.github.io/schema/vega/v5.json"},e.description?{description:e.description}:{}),t),a?{title:a}:{}),u?{style:u}:{}),c?{encode:{update:c}}:{}),{data:o}),s.length>0?{projections:s}:{}),e.assembleGroup([...l,...e.assembleSelectionTopLevelSignals([])])),r?{config:r}:{}),i?{usermeta:i}:{})}(r,function(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");void 0===t?t={type:"pad"}:a(t)&&(t={type:t});if(r&&o&&(s=t.type,"fit"===s||"fit-x"===s||"fit-y"===s))if("step"===r&&"step"===o)Qt(Ht.droppingFit()),t.type="pad";else if("step"===r||"step"===o){const e="step"===r?"width":"height";Qt(Ht.droppingFit(zt(e)));const n="width"===e?"height":"width";t.type=function(e){return e?`fit-${zt(e)}`:"fit"}(n)}var s;return Object.assign(Object.assign(Object.assign({},1===Y(t).length&&t.type?"pad"===t.type?{}:{autosize:t.type}:{autosize:t}),To(n)),To(e))}(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&(Jt=Gt),t.fieldTitle&&Yi(Hi)}},e.extractTransforms=function(e,t){return Dp.map(e,{config:t})},e.normalize=Bo,e.version=Ep,Object.defineProperty(e,"__esModule",{value:!0})}));</script>
<script>!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vega"),require("vega-lite")):"function"==typeof define&&define.amd?define(["vega","vega-lite"],t):(e=e||self).vegaEmbed=t(e.vega,e.vegaLite)}(this,(function(e,t){"use strict";var n="6.2.1";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function r(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):new n((function(t){t(e.value)})).then(a,s)}l((r=r.apply(e,t||[])).next())}))}
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017 Joachim Wester
* MIT license
*/var o,i=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),a=Object.prototype.hasOwnProperty;function s(e,t){return a.call(e,t)}function l(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);t=[];for(var r in e)s(e,r)&&t.push(r);return t}function c(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function u(e){for(var t,n=0,r=e.length;n<r;){if(!((t=e.charCodeAt(n))>=48&&t<=57))return!1;n++}return!0}function p(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function f(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function d(e,t){var n=[e];for(var r in t){var o="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==o&&n.push(r+": "+o)}return n.join("\n")}var h=function(e){function t(t,n,r,o,i){var a=this.constructor,s=e.call(this,d(t,{name:n,index:r,operation:o,tree:i}))||this;return s.name=n,s.index=r,s.operation=o,s.tree=i,Object.setPrototypeOf(s,a.prototype),s.message=d(t,{name:n,index:r,operation:o,tree:i}),s}return i(t,e),t}(Error),E=h,v=c,g={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=b(n,this.path);r&&(r=c(r));var o=O(n,{op:"remove",path:this.from}).removed;return O(n,{op:"add",path:this.path,value:o}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=b(n,this.from);return O(n,{op:"add",path:this.path,value:c(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:w(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},m={add:function(e,t,n){return u(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:g.move,copy:g.copy,test:g.test,_get:g._get};function b(e,t){if(""==t)return e;var n={op:"_get",path:t};return O(e,n),n.value}function O(e,t,n,r,o,i){if(void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===o&&(o=!0),void 0===i&&(i=0),n&&("function"==typeof n?n(t,0,e,t.path):I(t,0)),""===t.path){var a={newDocument:e};if("add"===t.op)return a.newDocument=t.value,a;if("replace"===t.op)return a.newDocument=t.value,a.removed=e,a;if("move"===t.op||"copy"===t.op)return a.newDocument=b(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=w(e,t.value),!1===a.test)throw new E("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a.newDocument=e,a}if("remove"===t.op)return a.removed=e,a.newDocument=null,a;if("_get"===t.op)return t.value=e,a;if(n)throw new E("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,t,e);return a}r||(e=c(e));var s=(t.path||"").split("/"),l=e,p=1,d=s.length,h=void 0,v=void 0,O=void 0;for(O="function"==typeof n?n:I;;){if(v=s[p],o&&"__proto__"==v)throw new TypeError("JSON-Patch: modifying `__proto__` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===h&&(void 0===l[v]?h=s.slice(0,p).join("/"):p==d-1&&(h=t.path),void 0!==h&&O(t,0,e,h)),p++,Array.isArray(l)){if("-"===v)v=l.length;else{if(n&&!u(v))throw new E("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",i,t,e);u(v)&&(v=~~v)}if(p>=d){if(n&&"add"===t.op&&v>l.length)throw new E("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,t,e);if(!1===(a=m[t.op].call(t,l,v,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}}else if(v&&-1!=v.indexOf("~")&&(v=f(v)),p>=d){if(!1===(a=g[t.op].call(t,l,v,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",i,t,e);return a}l=l[v]}}function y(e,t,n,r,o){if(void 0===r&&(r=!0),void 0===o&&(o=!0),n&&!Array.isArray(t))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=c(e));for(var i=new Array(t.length),a=0,s=t.length;a<s;a++)i[a]=O(e,t[a],n,!0,o,a),e=i[a].newDocument;return i.newDocument=e,i}function I(e,t,n,r){if("object"!=typeof e||null===e||Array.isArray(e))throw new E("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!g[e.op])throw new E("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new E("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new E('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new E("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&function e(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var n=0,r=t.length;n<r;n++)if(e(t[n]))return!0}else if("object"==typeof t){var o=l(t),i=o.length;for(n=0;n<i;n++)if(e(t[o[n]]))return!0}return!1}(e.value))throw new E("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var o=e.path.split("/").length,i=r.split("/").length;if(o!==i+1&&o!==i)throw new E("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new E("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var a=R([{op:"_get",path:e.from,value:void 0}],n);if(a&&"OPERATION_PATH_UNRESOLVABLE"===a.name)throw new E("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function R(e,t,n){try{if(!Array.isArray(e))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)y(c(t),c(e),n||!0);else{n=n||I;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(e){if(e instanceof E)return e;throw e}}function w(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,o,i=Array.isArray(e),a=Array.isArray(t);if(i&&a){if((r=e.length)!=t.length)return!1;for(n=r;0!=n--;)if(!w(e[n],t[n]))return!1;return!0}if(i!=a)return!1;var s=Object.keys(e);if((r=s.length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=r;0!=n--;)if(!w(e[o=s[n]],t[o]))return!1;return!0}return e!=e&&t!=t}var A=Object.freeze({__proto__:null,JsonPatchError:E,deepClone:v,getValueByPointer:b,applyOperation:O,applyPatch:y,applyReducer:function(e,t,n){var r=O(e,t);if(!1===r.test)throw new E("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument},validator:I,validate:R,_areEquals:w}),N=new WeakMap,L=function(e){this.observers=new Map,this.obj=e},T=function(e,t){this.callback=e,this.observer=t};
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017 Joachim Wester
* MIT license
*/function S(e,t){void 0===t&&(t=!1);var n=N.get(e.object);C(n.value,e.object,e.patches,"",t),e.patches.length&&y(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function C(e,t,n,r,o){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=l(t),a=l(e),u=!1,f=a.length-1;f>=0;f--){var d=e[E=a[f]];if(!s(t,E)||void 0===t[E]&&void 0!==d&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(o&&n.push({op:"test",path:r+"/"+p(E),value:c(d)}),n.push({op:"remove",path:r+"/"+p(E)}),u=!0):(o&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var h=t[E];"object"==typeof d&&null!=d&&"object"==typeof h&&null!=h?C(d,h,n,r+"/"+p(E),o):d!==h&&(o&&n.push({op:"test",path:r+"/"+p(E),value:c(d)}),n.push({op:"replace",path:r+"/"+p(E),value:c(h)}))}}if(u||i.length!=a.length)for(f=0;f<i.length;f++){var E;s(e,E=i[f])||void 0===t[E]||n.push({op:"add",path:r+"/"+p(E),value:c(t[E])})}}}var x=Object.freeze({__proto__:null,unobserve:function(e,t){t.unobserve()},observe:function(e,t){var n,r=function(e){return N.get(e)}(e);if(r){var o=function(e,t){return e.observers.get(t)}(r,t);n=o&&o.observer}else r=new L(e),N.set(e,r);if(n)return n;if(n={},r.value=c(e),t){n.callback=t,n.next=null;var i=function(){S(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(i)};"undefined"!=typeof window&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=[],n.object=e,n.unobserve=function(){S(n),clearTimeout(n.next),function(e,t){e.observers.delete(t.callback)}(r,n),"undefined"!=typeof window&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},r.observers.set(t,new T(t,n)),n},generate:S,compare:function(e,t,n){void 0===n&&(n=!1);var r=[];return C(e,t,r,"",n),r}});Object.assign({},A,x,{JsonPatchError:h,deepClone:c,escapePathComponent:p,unescapePathComponent:f});var D=/("(?:[^\\"]|\\.)*")|[:,]/g,F=function(e,t){var n,r,o;return t=t||{},n=JSON.stringify([1],void 0,void 0===t.indent?2:t.indent).slice(2,-3),r=""===n?1/0:void 0===t.maxLength?80:t.maxLength,o=t.replacer,function e(t,i,a){var s,l,c,u,p,f,d,h,E,v,g,m;if(t&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0===(g=JSON.stringify(t,o)))return g;if(d=r-i.length-a,g.length<=d&&(E=g.replace(D,(function(e,t){return t||e+" "}))).length<=d)return E;if(null!=o&&(t=JSON.parse(g),o=void 0),"object"==typeof t&&null!==t){if(h=i+n,c=[],l=0,Array.isArray(t))for(v="[",s="]",d=t.length;l<d;l++)c.push(e(t[l],h,l===d-1?0:1)||"null");else for(v="{",s="}",d=(f=Object.keys(t)).length;l<d;l++)u=f[l],p=JSON.stringify(u)+": ",void 0!==(m=e(t[u],h,p.length+(l===d-1?0:1)))&&c.push(p+m);if(c.length>0)return[v,n+c.join(",\n"+h),s].join("\n"+i)}return g}(e,"",0)};function P(e,t){return e(t={exports:{}},t.exports),t.exports}var k,_=P((function(e,t){var n;t=e.exports=f,n="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var e=Array.prototype.slice.call(arguments,0);e.unshift("SEMVER"),console.log.apply(console,e)}:function(){},t.SEMVER_SPEC_VERSION="2.0.0";var r=256,o=Number.MAX_SAFE_INTEGER||9007199254740991,i=t.re=[],a=t.src=[],s=t.tokens={},l=0;function c(e){s[e]=l++}c("NUMERICIDENTIFIER"),a[s.NUMERICIDENTIFIER]="0|[1-9]\\d*",c("NUMERICIDENTIFIERLOOSE"),a[s.NUMERICIDENTIFIERLOOSE]="[0-9]+",c("NONNUMERICIDENTIFIER"),a[s.NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*",c("MAINVERSION"),a[s.MAINVERSION]="("+a[s.NUMERICIDENTIFIER]+")\\.("+a[s.NUMERICIDENTIFIER]+")\\.("+a[s.NUMERICIDENTIFIER]+")",c("MAINVERSIONLOOSE"),a[s.MAINVERSIONLOOSE]="("+a[s.NUMERICIDENTIFIERLOOSE]+")\\.("+a[s.NUMERICIDENTIFIERLOOSE]+")\\.("+a[s.NUMERICIDENTIFIERLOOSE]+")",c("PRERELEASEIDENTIFIER"),a[s.PRERELEASEIDENTIFIER]="(?:"+a[s.NUMERICIDENTIFIER]+"|"+a[s.NONNUMERICIDENTIFIER]+")",c("PRERELEASEIDENTIFIERLOOSE"),a[s.PRERELEASEIDENTIFIERLOOSE]="(?:"+a[s.NUMERICIDENTIFIERLOOSE]+"|"+a[s.NONNUMERICIDENTIFIER]+")",c("PRERELEASE"),a[s.PRERELEASE]="(?:-("+a[s.PRERELEASEIDENTIFIER]+"(?:\\."+a[s.PRERELEASEIDENTIFIER]+")*))",c("PRERELEASELOOSE"),a[s.PRERELEASELOOSE]="(?:-?("+a[s.PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+a[s.PRERELEASEIDENTIFIERLOOSE]+")*))",c("BUILDIDENTIFIER"),a[s.BUILDIDENTIFIER]="[0-9A-Za-z-]+",c("BUILD"),a[s.BUILD]="(?:\\+("+a[s.BUILDIDENTIFIER]+"(?:\\."+a[s.BUILDIDENTIFIER]+")*))",c("FULL"),c("FULLPLAIN"),a[s.FULLPLAIN]="v?"+a[s.MAINVERSION]+a[s.PRERELEASE]+"?"+a[s.BUILD]+"?",a[s.FULL]="^"+a[s.FULLPLAIN]+"$",c("LOOSEPLAIN"),a[s.LOOSEPLAIN]="[v=\\s]*"+a[s.MAINVERSIONLOOSE]+a[s.PRERELEASELOOSE]+"?"+a[s.BUILD]+"?",c("LOOSE"),a[s.LOOSE]="^"+a[s.LOOSEPLAIN]+"$",c("GTLT"),a[s.GTLT]="((?:<|>)?=?)",c("XRANGEIDENTIFIERLOOSE"),a[s.XRANGEIDENTIFIERLOOSE]=a[s.NUMERICIDENTIFIERLOOSE]+"|x|X|\\*",c("XRANGEIDENTIFIER"),a[s.XRANGEIDENTIFIER]=a[s.NUMERICIDENTIFIER]+"|x|X|\\*",c("XRANGEPLAIN"),a[s.XRANGEPLAIN]="[v=\\s]*("+a[s.XRANGEIDENTIFIER]+")(?:\\.("+a[s.XRANGEIDENTIFIER]+")(?:\\.("+a[s.XRANGEIDENTIFIER]+")(?:"+a[s.PRERELEASE]+")?"+a[s.BUILD]+"?)?)?",c("XRANGEPLAINLOOSE"),a[s.XRANGEPLAINLOOSE]="[v=\\s]*("+a[s.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+a[s.XRANGEIDENTIFIERLOOSE]+")(?:\\.("+a[s.XRANGEIDENTIFIERLOOSE]+")(?:"+a[s.PRERELEASELOOSE]+")?"+a[s.BUILD]+"?)?)?",c("XRANGE"),a[s.XRANGE]="^"+a[s.GTLT]+"\\s*"+a[s.XRANGEPLAIN]+"$",c("XRANGELOOSE"),a[s.XRANGELOOSE]="^"+a[s.GTLT]+"\\s*"+a[s.XRANGEPLAINLOOSE]+"$",c("COERCE"),a[s.COERCE]="(^|[^\\d])(\\d{1,16})(?:\\.(\\d{1,16}))?(?:\\.(\\d{1,16}))?(?:$|[^\\d])",c("COERCERTL"),i[s.COERCERTL]=new RegExp(a[s.COERCE],"g"),c("LONETILDE"),a[s.LONETILDE]="(?:~>?)",c("TILDETRIM"),a[s.TILDETRIM]="(\\s*)"+a[s.LONETILDE]+"\\s+",i[s.TILDETRIM]=new RegExp(a[s.TILDETRIM],"g");c("TILDE"),a[s.TILDE]="^"+a[s.LONETILDE]+a[s.XRANGEPLAIN]+"$",c("TILDELOOSE"),a[s.TILDELOOSE]="^"+a[s.LONETILDE]+a[s.XRANGEPLAINLOOSE]+"$",c("LONECARET"),a[s.LONECARET]="(?:\\^)",c("CARETTRIM"),a[s.CARETTRIM]="(\\s*)"+a[s.LONECARET]+"\\s+",i[s.CARETTRIM]=new RegExp(a[s.CARETTRIM],"g");c("CARET"),a[s.CARET]="^"+a[s.LONECARET]+a[s.XRANGEPLAIN]+"$",c("CARETLOOSE"),a[s.CARETLOOSE]="^"+a[s.LONECARET]+a[s.XRANGEPLAINLOOSE]+"$",c("COMPARATORLOOSE"),a[s.COMPARATORLOOSE]="^"+a[s.GTLT]+"\\s*("+a[s.LOOSEPLAIN]+")$|^$",c("COMPARATOR"),a[s.COMPARATOR]="^"+a[s.GTLT]+"\\s*("+a[s.FULLPLAIN]+")$|^$",c("COMPARATORTRIM"),a[s.COMPARATORTRIM]="(\\s*)"+a[s.GTLT]+"\\s*("+a[s.LOOSEPLAIN]+"|"+a[s.XRANGEPLAIN]+")",i[s.COMPARATORTRIM]=new RegExp(a[s.COMPARATORTRIM],"g");c("HYPHENRANGE"),a[s.HYPHENRANGE]="^\\s*("+a[s.XRANGEPLAIN]+")\\s+-\\s+("+a[s.XRANGEPLAIN]+")\\s*$",c("HYPHENRANGELOOSE"),a[s.HYPHENRANGELOOSE]="^\\s*("+a[s.XRANGEPLAINLOOSE]+")\\s+-\\s+("+a[s.XRANGEPLAINLOOSE]+")\\s*$",c("STAR"),a[s.STAR]="(<|>)?=?\\s*\\*";for(var u=0;u<l;u++)n(u,a[u]),i[u]||(i[u]=new RegExp(a[u]));function p(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof f)return e;if("string"!=typeof e)return null;if(e.length>r)return null;if(!(t.loose?i[s.LOOSE]:i[s.FULL]).test(e))return null;try{return new f(e,t)}catch(e){return null}}function f(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof f){if(e.loose===t.loose)return e;e=e.version}else if("string"!=typeof e)throw new TypeError("Invalid Version: "+e);if(e.length>r)throw new TypeError("version is longer than "+r+" characters");if(!(this instanceof f))return new f(e,t);n("SemVer",e,t),this.options=t,this.loose=!!t.loose;var a=e.trim().match(t.loose?i[s.LOOSE]:i[s.FULL]);if(!a)throw new TypeError("Invalid Version: "+e);if(this.raw=e,this.major=+a[1],this.minor=+a[2],this.patch=+a[3],this.major>o||this.major<0)throw new TypeError("Invalid major version");if(this.minor>o||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>o||this.patch<0)throw new TypeError("Invalid patch version");a[4]?this.prerelease=a[4].split(".").map((function(e){if(/^[0-9]+$/.test(e)){var t=+e;if(t>=0&&t<o)return t}return e})):this.prerelease=[],this.build=a[5]?a[5].split("."):[],this.format()}t.parse=p,t.valid=function(e,t){var n=p(e,t);return n?n.version:null},t.clean=function(e,t){var n=p(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null},t.SemVer=f,f.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},f.prototype.toString=function(){return this.version},f.prototype.compare=function(e){return n("SemVer.compare",this.version,this.options,e),e instanceof f||(e=new f(e,this.options)),this.compareMain(e)||this.comparePre(e)},f.prototype.compareMain=function(e){return e instanceof f||(e=new f(e,this.options)),h(this.major,e.major)||h(this.minor,e.minor)||h(this.patch,e.patch)},f.prototype.comparePre=function(e){if(e instanceof f||(e=new f(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;var t=0;do{var r=this.prerelease[t],o=e.prerelease[t];if(n("prerelease compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return-1;if(r!==o)return h(r,o)}while(++t)},f.prototype.compareBuild=function(e){e instanceof f||(e=new f(e,this.options));var t=0;do{var r=this.build[t],o=e.build[t];if(n("prerelease compare",t,r,o),void 0===r&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===r)return-1;if(r!==o)return h(r,o)}while(++t)},f.prototype.inc=function(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var n=this.prerelease.length;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);-1===n&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error("invalid increment argument: "+e)}return this.format(),this.raw=this.version,this},t.inc=function(e,t,n,r){"string"==typeof n&&(r=n,n=void 0);try{return new f(e,n).inc(t,r).version}catch(e){return null}},t.diff=function(e,t){if(m(e,t))return null;var n=p(e),r=p(t),o="";if(n.prerelease.length||r.prerelease.length){o="pre";var i="prerelease"}for(var a in n)if(("major"===a||"minor"===a||"patch"===a)&&n[a]!==r[a])return o+a;return i},t.compareIdentifiers=h;var d=/^[0-9]+$/;function h(e,t){var n=d.test(e),r=d.test(t);return n&&r&&(e=+e,t=+t),e===t?0:n&&!r?-1:r&&!n?1:e<t?-1:1}function E(e,t,n){return new f(e,n).compare(new f(t,n))}function v(e,t,n){return E(e,t,n)>0}function g(e,t,n){return E(e,t,n)<0}function m(e,t,n){return 0===E(e,t,n)}function b(e,t,n){return 0!==E(e,t,n)}function O(e,t,n){return E(e,t,n)>=0}function y(e,t,n){return E(e,t,n)<=0}function I(e,t,n,r){switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return m(e,n,r);case"!=":return b(e,n,r);case">":return v(e,n,r);case">=":return O(e,n,r);case"<":return g(e,n,r);case"<=":return y(e,n,r);default:throw new TypeError("Invalid operator: "+t)}}function R(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof R){if(e.loose===!!t.loose)return e;e=e.value}if(!(this instanceof R))return new R(e,t);n("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===w?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}t.rcompareIdentifiers=function(e,t){return h(t,e)},t.major=function(e,t){return new f(e,t).major},t.minor=function(e,t){return new f(e,t).minor},t.patch=function(e,t){return new f(e,t).patch},t.compare=E,t.compareLoose=function(e,t){return E(e,t,!0)},t.compareBuild=function(e,t,n){var r=new f(e,n),o=new f(t,n);return r.compare(o)||r.compareBuild(o)},t.rcompare=function(e,t,n){return E(t,e,n)},t.sort=function(e,n){return e.sort((function(e,r){return t.compareBuild(e,r,n)}))},t.rsort=function(e,n){return e.sort((function(e,r){return t.compareBuild(r,e,n)}))},t.gt=v,t.lt=g,t.eq=m,t.neq=b,t.gte=O,t.lte=y,t.cmp=I,t.Comparator=R;var w={};function A(e,t){if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),e instanceof A)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new A(e.raw,t);if(e instanceof R)return new A(e.value,t);if(!(this instanceof A))return new A(e,t);if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map((function(e){return this.parseRange(e.trim())}),this).filter((function(e){return e.length})),!this.set.length)throw new TypeError("Invalid SemVer Range: "+e);this.format()}function N(e,t){for(var n=!0,r=e.slice(),o=r.pop();n&&r.length;)n=r.every((function(e){return o.intersects(e,t)})),o=r.pop();return n}function L(e){return!e||"x"===e.toLowerCase()||"*"===e}function T(e,t,n,r,o,i,a,s,l,c,u,p,f){return((t=L(n)?"":L(r)?">="+n+".0.0":L(o)?">="+n+"."+r+".0":">="+t)+" "+(s=L(l)?"":L(c)?"<"+(+l+1)+".0.0":L(u)?"<"+l+"."+(+c+1)+".0":p?"<="+l+"."+c+"."+u+"-"+p:"<="+s)).trim()}function S(e,t,r){for(var o=0;o<e.length;o++)if(!e[o].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(o=0;o<e.length;o++)if(n(e[o].semver),e[o].semver!==w&&e[o].semver.prerelease.length>0){var i=e[o].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}function C(e,t,n){try{t=new A(t,n)}catch(e){return!1}return t.test(e)}function x(e,t,n,r){var o,i,a,s,l;switch(e=new f(e,r),t=new A(t,r),n){case">":o=v,i=y,a=g,s=">",l=">=";break;case"<":o=g,i=O,a=v,s="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(C(e,t,r))return!1;for(var c=0;c<t.set.length;++c){var u=t.set[c],p=null,d=null;if(u.forEach((function(e){e.semver===w&&(e=new R(">=0.0.0")),p=p||e,d=d||e,o(e.semver,p.semver,r)?p=e:a(e.semver,d.semver,r)&&(d=e)})),p.operator===s||p.operator===l)return!1;if((!d.operator||d.operator===s)&&i(e,d.semver))return!1;if(d.operator===l&&a(e,d.semver))return!1}return!0}R.prototype.parse=function(e){var t=this.options.loose?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],n=e.match(t);if(!n)throw new TypeError("Invalid comparator: "+e);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new f(n[2],this.options.loose):this.semver=w},R.prototype.toString=function(){return this.value},R.prototype.test=function(e){if(n("Comparator.test",e,this.options.loose),this.semver===w||e===w)return!0;if("string"==typeof e)try{e=new f(e,this.options)}catch(e){return!1}return I(e,this.operator,this.semver,this.options)},R.prototype.intersects=function(e,t){if(!(e instanceof R))throw new TypeError("a Comparator is required");var n;if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||(n=new A(e.value,t),C(this.value,n,t));if(""===e.operator)return""===e.value||(n=new A(this.value,t),C(e.semver,n,t));var r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),o=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),i=this.semver.version===e.semver.version,a=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),s=I(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),l=I(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||o||i&&a||s||l},t.Range=A,A.prototype.format=function(){return this.range=this.set.map((function(e){return e.join(" ").trim()})).join("||").trim(),this.range},A.prototype.toString=function(){return this.range},A.prototype.parseRange=function(e){var t=this.options.loose;e=e.trim();var r=t?i[s.HYPHENRANGELOOSE]:i[s.HYPHENRANGE];e=e.replace(r,T),n("hyphen replace",e),e=e.replace(i[s.COMPARATORTRIM],"$1$2$3"),n("comparator trim",e,i[s.COMPARATORTRIM]),e=(e=(e=e.replace(i[s.TILDETRIM],"$1~")).replace(i[s.CARETTRIM],"$1^")).split(/\s+/).join(" ");var o=t?i[s.COMPARATORLOOSE]:i[s.COMPARATOR],a=e.split(" ").map((function(e){return function(e,t){return n("comp",e,t),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){n("caret",e,t);var r=t.loose?i[s.CARETLOOSE]:i[s.CARET];return e.replace(r,(function(t,r,o,i,a){var s;return n("caret",e,t,r,o,i,a),L(r)?s="":L(o)?s=">="+r+".0.0 <"+(+r+1)+".0.0":L(i)?s="0"===r?">="+r+"."+o+".0 <"+r+"."+(+o+1)+".0":">="+r+"."+o+".0 <"+(+r+1)+".0.0":a?(n("replaceCaret pr",a),s="0"===r?"0"===o?">="+r+"."+o+"."+i+"-"+a+" <"+r+"."+o+"."+(+i+1):">="+r+"."+o+"."+i+"-"+a+" <"+r+"."+(+o+1)+".0":">="+r+"."+o+"."+i+"-"+a+" <"+(+r+1)+".0.0"):(n("no pr"),s="0"===r?"0"===o?">="+r+"."+o+"."+i+" <"+r+"."+o+"."+(+i+1):">="+r+"."+o+"."+i+" <"+r+"."+(+o+1)+".0":">="+r+"."+o+"."+i+" <"+(+r+1)+".0.0"),n("caret return",s),s}))}(e,t)})).join(" ")}(e,t),n("caret",e),e=function(e,t){return e.trim().split(/\s+/).map((function(e){return function(e,t){var r=t.loose?i[s.TILDELOOSE]:i[s.TILDE];return e.replace(r,(function(t,r,o,i,a){var s;return n("tilde",e,t,r,o,i,a),L(r)?s="":L(o)?s=">="+r+".0.0 <"+(+r+1)+".0.0":L(i)?s=">="+r+"."+o+".0 <"+r+"."+(+o+1)+".0":a?(n("replaceTilde pr",a),s=">="+r+"."+o+"."+i+"-"+a+" <"+r+"."+(+o+1)+".0"):s=">="+r+"."+o+"."+i+" <"+r+"."+(+o+1)+".0",n("tilde return",s),s}))}(e,t)})).join(" ")}(e,t),n("tildes",e),e=function(e,t){return n("replaceXRanges",e,t),e.split(/\s+/).map((function(e){return function(e,t){e=e.trim();var r=t.loose?i[s.XRANGELOOSE]:i[s.XRANGE];return e.replace(r,(function(r,o,i,a,s,l){n("xRange",e,r,o,i,a,s,l);var c=L(i),u=c||L(a),p=u||L(s),f=p;return"="===o&&f&&(o=""),l=t.includePrerelease?"-0":"",c?r=">"===o||"<"===o?"<0.0.0-0":"*":o&&f?(u&&(a=0),s=0,">"===o?(o=">=",u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):"<="===o&&(o="<",u?i=+i+1:a=+a+1),r=o+i+"."+a+"."+s+l):u?r=">="+i+".0.0"+l+" <"+(+i+1)+".0.0"+l:p&&(r=">="+i+"."+a+".0"+l+" <"+i+"."+(+a+1)+".0"+l),n("xRange return",r),r}))}(e,t)})).join(" ")}(e,t),n("xrange",e),e=function(e,t){return n("replaceStars",e,t),e.trim().replace(i[s.STAR],"")}(e,t),n("stars",e),e}(e,this.options)}),this).join(" ").split(/\s+/);return this.options.loose&&(a=a.filter((function(e){return!!e.match(o)}))),a=a.map((function(e){return new R(e,this.options)}),this)},A.prototype.intersects=function(e,t){if(!(e instanceof A))throw new TypeError("a Range is required");return this.set.some((function(n){return N(n,t)&&e.set.some((function(e){return N(e,t)&&n.every((function(n){return e.every((function(e){return n.intersects(e,t)}))}))}))}))},t.toComparators=function(e,t){return new A(e,t).set.map((function(e){return e.map((function(e){return e.value})).join(" ").trim().split(" ")}))},A.prototype.test=function(e){if(!e)return!1;if("string"==typeof e)try{e=new f(e,this.options)}catch(e){return!1}for(var t=0;t<this.set.length;t++)if(S(this.set[t],e,this.options))return!0;return!1},t.satisfies=C,t.maxSatisfying=function(e,t,n){var r=null,o=null;try{var i=new A(t,n)}catch(e){return null}return e.forEach((function(e){i.test(e)&&(r&&-1!==o.compare(e)||(o=new f(r=e,n)))})),r},t.minSatisfying=function(e,t,n){var r=null,o=null;try{var i=new A(t,n)}catch(e){return null}return e.forEach((function(e){i.test(e)&&(r&&1!==o.compare(e)||(o=new f(r=e,n)))})),r},t.minVersion=function(e,t){e=new A(e,t);var n=new f("0.0.0");if(e.test(n))return n;if(n=new f("0.0.0-0"),e.test(n))return n;n=null;for(var r=0;r<e.set.length;++r){e.set[r].forEach((function(e){var t=new f(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":n&&!v(n,t)||(n=t);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+e.operator)}}))}if(n&&e.test(n))return n;return null},t.validRange=function(e,t){try{return new A(e,t).range||"*"}catch(e){return null}},t.ltr=function(e,t,n){return x(e,t,"<",n)},t.gtr=function(e,t,n){return x(e,t,">",n)},t.outside=x,t.prerelease=function(e,t){var n=p(e,t);return n&&n.prerelease.length?n.prerelease:null},t.intersects=function(e,t,n){return e=new A(e,n),t=new A(t,n),e.intersects(t)},t.coerce=function(e,t){if(e instanceof f)return e;"number"==typeof e&&(e=String(e));if("string"!=typeof e)return null;var n=null;if((t=t||{}).rtl){for(var r;(r=i[s.COERCERTL].exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&r.index+r[0].length===n.index+n[0].length||(n=r),i[s.COERCERTL].lastIndex=r.index+r[1].length+r[2].length;i[s.COERCERTL].lastIndex=-1}else n=e.match(i[s.COERCE]);if(null===n)return null;return p(n[2]+"."+(n[3]||"0")+"."+(n[4]||"0"),t)}})),j=(_.SEMVER_SPEC_VERSION,_.re,_.src,_.tokens,_.parse,_.valid,_.clean,_.SemVer,_.inc,_.diff,_.compareIdentifiers,_.rcompareIdentifiers,_.major,_.minor,_.patch,_.compare,_.compareLoose,_.compareBuild,_.rcompare,_.sort,_.rsort,_.gt,_.lt,_.eq,_.neq,_.gte,_.lte,_.cmp,_.Comparator,_.Range,_.toComparators,_.satisfies),M=(_.maxSatisfying,_.minSatisfying,_.minVersion,_.validRange,_.ltr,_.gtr,_.outside,_.prerelease,_.intersects,_.coerce,P((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=/\/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t[0],version:t[1]}}}))),z=(k=M)&&k.__esModule&&Object.prototype.hasOwnProperty.call(k,"default")?k.default:k;const B={background:"#333",title:{color:"#fff"},style:{"guide-label":{fill:"#fff"},"guide-title":{fill:"#fff"}},axis:{domainColor:"#fff",gridColor:"#888",tickColor:"#fff"}},U={background:"#fff",arc:{fill:"#4572a7"},area:{fill:"#4572a7"},line:{stroke:"#4572a7",strokeWidth:2},path:{stroke:"#4572a7"},rect:{fill:"#4572a7"},shape:{stroke:"#4572a7"},symbol:{fill:"#4572a7",strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},G={arc:{fill:"#30a2da"},area:{fill:"#30a2da"},axis:{domainColor:"#cbcbcb",grid:!0,gridColor:"#cbcbcb",gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:"#cbcbcb",tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:"#f0f0f0",group:{fill:"#f0f0f0"},legend:{labelColor:"#333",labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:"#333",titleFontSize:14,titlePadding:10},line:{stroke:"#30a2da",strokeWidth:2},path:{stroke:"#30a2da",strokeWidth:.5},rect:{fill:"#30a2da"},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:"#30a2da"},style:{bar:{binSpacing:2,fill:"#30a2da",stroke:null}},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},$={group:{fill:"#e5e5e5"},arc:{fill:"#000"},area:{fill:"#000"},line:{stroke:"#000"},path:{stroke:"#000"},rect:{fill:"#000"},shape:{stroke:"#000"},symbol:{fill:"#000",size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},X="Benton Gothic Bold, sans-serif",V={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"],"ice-7":["#edefee","#dadfe2","#c4ccd2","#a6b7c6","#849eae","#607785","#47525d"]},W={background:"#ffffff",title:{anchor:"start",color:"#000000",font:X,fontSize:22,fontWeight:"normal"},arc:{fill:"#82c6df"},area:{fill:"#82c6df"},line:{stroke:"#82c6df",strokeWidth:2},path:{stroke:"#82c6df"},rect:{fill:"#82c6df"},shape:{stroke:"#82c6df"},symbol:{fill:"#82c6df",size:30},axis:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,labelFontWeight:"normal",titleFont:X,titleFontSize:13,titleFontWeight:"normal"},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:"Benton Gothic, sans-serif",labelFontSize:11.5,symbolType:"square",titleFont:X,titleFontSize:13,titleFontWeight:"normal"},range:{category:V["category-6"],diverging:V["fireandice-6"],heatmap:V["fire-7"],ordinal:V["fire-7"],ramp:V["fire-7"]}},H={background:"#f9f9f9",arc:{fill:"#ab5787"},area:{fill:"#ab5787"},line:{stroke:"#ab5787"},path:{stroke:"#ab5787"},rect:{fill:"#ab5787"},shape:{stroke:"#ab5787"},symbol:{fill:"#ab5787",size:30},axis:{domainColor:"#979797",domainWidth:.5,gridWidth:.2,labelColor:"#979797",tickColor:"#979797",tickWidth:.2,titleColor:"#979797"},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},q={background:"#fff",arc:{fill:"#3e5c69"},area:{fill:"#3e5c69"},line:{stroke:"#3e5c69"},path:{stroke:"#3e5c69"},rect:{fill:"#3e5c69"},shape:{stroke:"#3e5c69"},symbol:{fill:"#3e5c69"},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},J={"main-colors":["#1696d2","#d2d2d2","#000000","#fdbf11","#ec008b","#55b748","#5c5859","#db2b27"],"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"shades-gray":["#F5F5F5","#ECECEC","#E3E3E3","#DCDBDB","#D2D2D2","#9D9D9D","#696969","#353535"],"shades-yellow":["#FFF2CF","#FCE39E","#FDD870","#FCCB41","#FDBF11","#E88E2D","#CA5800","#843215"],"shades-magenta":["#F5CBDF","#EB99C2","#E46AA7","#E54096","#EC008B","#AF1F6B","#761548","#351123"],"shades-green":["#DCEDD9","#BCDEB4","#98CF90","#78C26D","#55B748","#408941","#2C5C2D","#1A2E19"],"shades-black":["#D5D5D4","#ADABAC","#848081","#5C5859","#332D2F","#262223","#1A1717","#0E0C0D"],"shades-red":["#F8D5D4","#F1AAA9","#E9807D","#E25552","#DB2B27","#A4201D","#6E1614","#370B0A"],"one-group":["#1696d2","#000000"],"two-groups-cat-1":["#1696d2","#000000"],"two-groups-cat-2":["#1696d2","#fdbf11"],"two-groups-cat-3":["#1696d2","#db2b27"],"two-groups-seq":["#a2d4ec","#1696d2"],"three-groups-cat":["#1696d2","#fdbf11","#000000"],"three-groups-seq":["#a2d4ec","#1696d2","#0a4c6a"],"four-groups-cat-1":["#000000","#d2d2d2","#fdbf11","#1696d2"],"four-groups-cat-2":["#1696d2","#ec0008b","#fdbf11","#5c5859"],"four-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a"],"five-groups-cat-1":["#1696d2","#fdbf11","#d2d2d2","#ec008b","#000000"],"five-groups-cat-2":["#1696d2","#0a4c6a","#d2d2d2","#fdbf11","#332d2f"],"five-groups-seq":["#cfe8f3","#73bf42","#1696d2","#0a4c6a","#000000"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-cat-2":["#1696d2","#d2d2d2","#ec008b","#fdbf11","#332d2f","#0a4c6a"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},Y={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:"Lato"},axisX:{domain:!0,domainColor:"#000000",domainWidth:1,grid:!1,labelFontSize:12,labelFont:"Lato",labelAngle:0,tickColor:"#000000",tickSize:5,titleFontSize:12,titlePadding:10,titleFont:"Lato"},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:"Lato",labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:"Lato",titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:"Lato",symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:"Lato",orient:"right",offset:10},view:{stroke:"transparent"},range:{category:J["six-groups-cat-1"],diverging:J["diverging-colors"],heatmap:J["diverging-colors"],ordinal:J["six-groups-seq"],ramp:J["shades-blue"]},area:{fill:"#1696d2"},rect:{fill:"#1696d2"},line:{color:"#1696d2",stroke:"#1696d2",strokeWidth:5},trail:{color:"#1696d2",stroke:"#1696d2",strokeWidth:0,size:1},path:{stroke:"#1696d2",strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:"#1696d2",fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:"#1696d2",stroke:!1}},arc:{fill:"#1696d2"},shape:{stroke:"#1696d2"},symbol:{fill:"#1696d2",size:30}},Q="2.5.0";var Z=Object.freeze({__proto__:null,version:Q,dark:B,excel:U,fivethirtyeight:G,ggplot2:$,latimes:W,quartz:H,vox:q,urbaninstitute:Y}),K="#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black; }\n #vg-tooltip-element.visible {\n visibility: visible; }\n #vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px; }\n #vg-tooltip-element table {\n border-spacing: 0; }\n #vg-tooltip-element table tr {\n border: none; }\n #vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px; }\n #vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px; }\n #vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left; }\n #vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white; }\n #vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf; }\n";const ee="vg-tooltip-element",te={offsetX:10,offsetY:10,id:ee,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2};function ne(e,t,n){return e.fields=t||[],e.fname=n,e}function re(e){throw Error(e)}var oe=Array.isArray;function ie(e){return e===Object(e)}function ae(e){return"string"==typeof e}function se(e){return oe(e)?"["+e.map(se)+"]":ie(e)||ae(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}var le=[];(function(e,t){var n=function(e){var t,n,r,o=[],i=null,a=0,s=e.length,l="";function c(){o.push(l+e.substring(t,n)),l="",t=n+1}for(e+="",t=n=0;n<s;++n)if("\\"===(r=e[n]))l+=e.substring(t,n),t=++n;else if(r===i)c(),i=null,a=-1;else{if(i)continue;t===a&&'"'===r?(t=n+1,i=r):t===a&&"'"===r?(t=n+1,i=r):"."!==r||a?"["===r?(n>t&&c(),a=t=n+1):"]"===r&&(a||re("Access path missing open bracket: "+e),a>0&&c(),a=0,t=n+1):n>t?c():t=n+1}return a&&re("Access path missing closing bracket: "+e),i&&re("Access path missing closing quote: "+e),n>t&&(n++,c()),o}(e),r="return _["+n.map(se).join("][")+"];";ne(Function("_",r),[e=1===n.length?n[0]:e],t||e)})("id"),ne((function(e){return e}),le,"identity"),ne((function(){return 0}),le,"zero"),ne((function(){return 1}),le,"one"),ne((function(){return!0}),le,"true"),ne((function(){return!1}),le,"false");function ce(...e){return e.reduce((e,t)=>{for(var n in t)if("signals"===n)e.signals=pe(e.signals,t.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;ue(e,n,t[n],r)}return e},{})}function ue(e,t,n,r){var o,i;if(ie(n)&&!oe(n))for(o in i=ie(e[t])?e[t]:e[t]={},n)r&&(!0===r||r[o])?ue(i,o,n[o]):i[o]=n[o];else e[t]=n}function pe(e,t){if(null==e)return t;const n={},r=[];function o(e){n[e.name]||(n[e.name]=1,r.push(e))}return t.forEach(o),e.forEach(o),r}var fe=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n};function de(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,r){if("object"!=typeof r||null===r)return r;const o=t.indexOf(this)+1;return t.length=o,t.length>e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}class he{constructor(e){this.options=Object.assign(Object.assign({},te),e);const t=this.options.id;if(this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const e=document.createElement("style");e.setAttribute("id",this.options.styleId),e.innerHTML=function(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return K.toString().replace(ee,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}this.el=document.getElementById(t),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",t),this.el.classList.add("vg-tooltip"),document.body.appendChild(this.el))}tooltipHandler(e,t,n,r){if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=function(e,t,n){if(oe(e))return`[${e.map(e=>t(ae(e)?e:de(e,n))).join(", ")}]`;if(ie(e)){let r="";const o=e,{title:i}=o,a=fe(o,["title"]);i&&(r+=`<h2>${t(i)}</h2>`);const s=Object.keys(a);if(s.length>0){r+="<table>";for(const e of s){let o=a[e];void 0!==o&&(ie(o)&&(o=de(o,n)),r+=`<tr><td class="key">${t(e)}:</td><td class="value">${t(o)}</td></tr>`)}r+="</table>"}return r||"{}"}return t(e)}(r,this.options.sanitize,this.options.maxDepth),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:o,y:i}=function(e,t,n,r){let o=e.clientX+n;o+t.width>window.innerWidth&&(o=+e.clientX-n-t.width);let i=e.clientY+r;return i+t.height>window.innerHeight&&(i=+e.clientY-r-t.height),{x:o,y:i}}(t,this.el.getBoundingClientRect(),this.options.offsetX,this.options.offsetY);this.el.setAttribute("style",`top: ${i}px; left: ${o}px`)}}var Ee='.vega-embed {\n position: relative;\n display: inline-block; }\n .vega-embed.has-actions {\n padding-right: 38px; }\n .vega-embed details:not([open]) > :not(summary) {\n display: none !important; }\n .vega-embed summary {\n list-style: none;\n position: absolute;\n top: 0;\n right: 0;\n padding: 6px;\n z-index: 1000;\n background: white;\n box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);\n color: #1b1e23;\n border: 1px solid #aaa;\n border-radius: 999px;\n opacity: 0.2;\n transition: opacity 0.4s ease-in;\n outline: none;\n cursor: pointer;\n line-height: 0px; }\n .vega-embed summary::-webkit-details-marker {\n display: none; }\n .vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset; }\n .vega-embed summary svg {\n width: 14px;\n height: 14px; }\n .vega-embed details[open] summary {\n opacity: 0.7; }\n .vega-embed:hover summary,\n .vega-embed:focus summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease; }\n .vega-embed .vega-actions {\n position: absolute;\n top: 35px;\n right: -9px;\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n padding-top: 8px;\n border-radius: 4px;\n box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);\n border: 1px solid #d9d9d9;\n background: white;\n animation-duration: 0.15s;\n animation-name: scale-in;\n animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5); }\n .vega-embed .vega-actions a {\n padding: 8px 16px;\n font-family: sans-serif;\n font-size: 14px;\n font-weight: 600;\n white-space: nowrap;\n color: #434a56;\n text-decoration: none; }\n .vega-embed .vega-actions a:hover {\n background-color: #f7f7f9;\n color: black; }\n .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute; }\n .vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid #0000;\n border-bottom-color: #d9d9d9; }\n .vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid #0000;\n border-bottom-color: #fff; }\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: scroll;\n padding-right: 14px; }\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6); }\n to {\n opacity: 1;\n transform: scale(1); } }\n';function ve(e,...t){for(const n of t)ge(e,n);return e}function ge(t,n){for(const r of Object.keys(n))e.writeConfig(t,r,n[r],!0)}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return this.substr(!t||t<0?0:+t,e.length)===e});const me=e;let be=t;const Oe=window;void 0===be&&Oe.vl&&Oe.vl.compile&&(be=Oe.vl);const ye={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},Ie={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},Re={vega:"Vega","vega-lite":"Vega-Lite"},we={vega:me.version,"vega-lite":be?be.version:"not available"},Ae={vega:e=>e,"vega-lite":(e,t)=>be.compile(e,{config:t}).spec},Ne='\n<svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">\n <circle r="2" cy="8" cx="2"></circle>\n <circle r="2" cy="8" cx="8"></circle>\n <circle r="2" cy="8" cx="14"></circle>\n</svg>';function Le(e,t,n,r){const o=`<html><head>${t}</head><body><pre><code class="json">`,i=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(o+e+i),a.document.title=`${Re[r]} JSON Source`}function Te(e,t,n={}){var o,i,a;return r(this,void 0,void 0,(function*(){const s=(l=n.loader)&&"load"in l?n.loader:me.loader(n.loader);var l;const c=ae(t)?JSON.parse(yield s.load(t)):t,u=yield Se((o=c.usermeta&&c.usermeta.embedOptions,null!=o?o:{}),s),p=yield Se(n,s),f=Object.assign(Object.assign({},ve(p,u)),{config:ce((i=p.config,null!=i?i:{}),(a=u.config,null!=a?a:{}))});return yield function(e,t,n={},o){var i,a,s,l,c,u;return r(this,void 0,void 0,(function*(){const r=n.theme?ce(Z[n.theme],null!=(i=n.config)?i:{}):n.config,p="boolean"==typeof n.actions?n.actions:ve({},ye,null!=(a=n.actions)?a:{});const f=Object.assign(Object.assign({},Ie),n.i18n),d=null!=(s=n.renderer)?s:"canvas",h=null!=(l=n.logLevel)?l:me.Warn,E=null!=(c=n.downloadFileName)?c:"visualization";if(!1!==n.defaultStyle){const e="vega-embed-style";if(!document.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerText=void 0===n.defaultStyle||!0===n.defaultStyle?Ee.toString():n.defaultStyle,document.head.appendChild(t)}}const v=function(e,t){var n;if(e.$schema){const r=z(e.$schema);t&&t!==r.library&&console.warn(`The given visualization spec is written in ${Re[r.library]}, but mode argument sets ${n=Re[t],null!=n?n:t}.`);const o=r.library;return j(we[o],`^${r.version.slice(1)}`)||console.warn(`The input spec uses ${Re[o]} ${r.version}, but the current version of ${Re[o]} is v${we[o]}.`),o}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":null!=t?t:"vega"}(t,n.mode);let g=Ae[v](t,r);if("vega-lite"===v&&g.$schema){const e=z(g.$schema);j(we.vega,`^${e.version.slice(1)}`)||console.warn(`The compiled spec uses Vega ${e.version}, but current version is v${we.vega}.`)}const m="string"==typeof e?document.querySelector(e):e;if(!m)throw Error("${el} does not exist");m.classList.add("vega-embed"),p&&m.classList.add("has-actions"),m.innerHTML="";const b=n.patch;b&&(g=b instanceof Function?b(g):y(g,b,!0,!1).newDocument),n.formatLocale&&me.formatLocale(n.formatLocale),n.timeFormatLocale&&me.timeFormatLocale(n.timeFormatLocale);const O=me.parse(g,"vega-lite"===v?{}:r),I=new me.View(O,{loader:o,logLevel:h,renderer:d});if(!1!==n.tooltip){let e;e="function"==typeof n.tooltip?n.tooltip:new he(!0===n.tooltip?{}:n.tooltip).call,I.tooltip(e)}let R,{hover:w}=n;if(void 0===w&&(w="vega"===v),w){const{hoverSet:e,updateSet:t}="boolean"==typeof w?{}:w;I.hover(e,t)}if(n&&(n.width&&I.width(n.width),n.height&&I.height(n.height),n.padding&&I.padding(n.padding)),yield I.initialize(e).runAsync(),!1!==p){let e=m;if(!1!==n.defaultStyle){const t=document.createElement("details");t.title=f.CLICK_TO_VIEW_ACTIONS,m.append(t),e=t;const n=document.createElement("summary");n.innerHTML=Ne,t.append(n),R=e=>{t.contains(e.target)||t.removeAttribute("open")},document.addEventListener("click",R)}const o=document.createElement("div");if(e.append(o),o.classList.add("vega-actions"),!0===p||!1!==p.export)for(const e of["svg","png"])if(!0===p||!0===p.export||p.export[e]){const t=f[`${e.toUpperCase()}_ACTION`],r=document.createElement("a");r.text=t,r.href="#",r.target="_blank",r.download=`${E}.${e}`,r.addEventListener("mousedown",(function(t){I.toImageURL(e,n.scaleFactor).then(e=>{this.href=e}).catch(e=>{throw e}),t.preventDefault()})),o.append(r)}if(!0===p||!1!==p.source){const e=document.createElement("a");e.text=f.SOURCE_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var r,o;Le(F(t),null!=(r=n.sourceHeader)?r:"",null!=(o=n.sourceFooter)?o:"",v),e.preventDefault()})),o.append(e)}if("vega-lite"===v&&(!0===p||!1!==p.compiled)){const e=document.createElement("a");e.text=f.COMPILED_ACTION,e.href="#",e.addEventListener("mousedown",(function(e){var t,r;Le(F(g),null!=(t=n.sourceHeader)?t:"",null!=(r=n.sourceFooter)?r:"","vega"),e.preventDefault()})),o.append(e)}if(!0===p||!1!==p.editor){const e=null!=(u=n.editorUrl)?u:"https://vega.github.io/editor/",i=document.createElement("a");i.text=f.EDITOR_ACTION,i.href="#",i.addEventListener("mousedown",(function(n){!function(e,t,n){const r=e.open(t),o=250;let i=~~(1e4/o);e.addEventListener("message",(function t(n){n.source===r&&(i=0,e.removeEventListener("message",t,!1))}),!1),setTimeout((function e(){i<=0||(r.postMessage(n,"*"),setTimeout(e,o),i-=1)}),o)}(window,e,{config:r,mode:v,renderer:d,spec:F(t)}),n.preventDefault()})),o.append(i)}}return{view:I,spec:t,vgSpec:g,finalize:function(){R&&document.removeEventListener("click",R),I.finalize()}}}))}(e,c,f,s)}))}function Se(e,t){var n;return r(this,void 0,void 0,(function*(){const r=ae(e.config)?JSON.parse(yield t.load(e.config)):null!=(n=e.config)?n:{},o=ae(e.patch)?JSON.parse(yield t.load(e.patch)):e.patch;return Object.assign(Object.assign(Object.assign({},e),o?{patch:o}:{}),r?{config:r}:{})}))}function Ce(e,t={}){var n;return r(this,void 0,void 0,(function*(){const r=document.createElement("div");r.classList.add("vega-embed-wrapper");const o=document.createElement("div");r.appendChild(o);const i=!0===t.actions||!1===t.actions?t.actions:Object.assign({export:!0,source:!1,compiled:!0,editor:!0},null!=(n=t.actions)?n:{}),a=yield Te(o,e,Object.assign({actions:i},null!=t?t:{}));return r.value=a.view,r}))}const xe=(...t)=>t.length>1&&(e.isString(t[0])&&!function(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("//")}(t[0])||function(e){return e instanceof HTMLElement}(t[0])||3===t.length)?Te(t[0],t[1],t[2]):Ce(t[0],t[1]);return xe.vegaLite=be,xe.vl=be,xe.container=Ce,xe.embed=Te,xe.vega=me,xe.default=Te,xe.version=n,xe}));
</script>
</head>
<body>
<div id="vghXa"></div>
</body>
<style media="screen">
.vega-actions a {
margin-right: 10px;
font-family: sans-serif;
font-size: x-small;
font-style: italic;
}
</style>
<script type="text/javascript">
var opt = {
mode: "vega-lite",
renderer: "svg",
actions: true
}
var spec = {"height":250,"width":"container","mark":"bar","encoding":{"x":{"field":"Origin","type":"nominal"},"y":{"aggregate":"count","type":"quantitative"}},"data":{"values":[{"Name":"chevrolet chevelle malibu","Miles_per_Gallon":18.0,"Cylinders":8,"Displacement":307.0,"Horsepower":130,"Weight_in_lbs":3504,"Acceleration":12.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"buick skylark 320","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":350.0,"Horsepower":165,"Weight_in_lbs":3693,"Acceleration":11.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"plymouth satellite","Miles_per_Gallon":18.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":3436,"Acceleration":11.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"amc rebel sst","Miles_per_Gallon":16.0,"Cylinders":8,"Displacement":304.0,"Horsepower":150,"Weight_in_lbs":3433,"Acceleration":12.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"ford torino","Miles_per_Gallon":17.0,"Cylinders":8,"Displacement":302.0,"Horsepower":140,"Weight_in_lbs":3449,"Acceleration":10.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"ford galaxie 500","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":429.0,"Horsepower":198,"Weight_in_lbs":4341,"Acceleration":10.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"chevrolet impala","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":454.0,"Horsepower":220,"Weight_in_lbs":4354,"Acceleration":9.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"plymouth fury iii","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":440.0,"Horsepower":215,"Weight_in_lbs":4312,"Acceleration":8.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"pontiac catalina","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":455.0,"Horsepower":225,"Weight_in_lbs":4425,"Acceleration":10.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"amc ambassador dpl","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":390.0,"Horsepower":190,"Weight_in_lbs":3850,"Acceleration":8.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"citroen ds-21 pallas","Miles_per_Gallon":null,"Cylinders":4,"Displacement":133.0,"Horsepower":115,"Weight_in_lbs":3090,"Acceleration":17.5,"Year":"1970-01-01","Origin":"Europe"},{"Name":"chevrolet chevelle concours (sw)","Miles_per_Gallon":null,"Cylinders":8,"Displacement":350.0,"Horsepower":165,"Weight_in_lbs":4142,"Acceleration":11.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"ford torino (sw)","Miles_per_Gallon":null,"Cylinders":8,"Displacement":351.0,"Horsepower":153,"Weight_in_lbs":4034,"Acceleration":11.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"plymouth satellite (sw)","Miles_per_Gallon":null,"Cylinders":8,"Displacement":383.0,"Horsepower":175,"Weight_in_lbs":4166,"Acceleration":10.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"amc rebel sst (sw)","Miles_per_Gallon":null,"Cylinders":8,"Displacement":360.0,"Horsepower":175,"Weight_in_lbs":3850,"Acceleration":11.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"dodge challenger se","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":383.0,"Horsepower":170,"Weight_in_lbs":3563,"Acceleration":10.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"plymouth 'cuda 340","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":340.0,"Horsepower":160,"Weight_in_lbs":3609,"Acceleration":8.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"ford mustang boss 302","Miles_per_Gallon":null,"Cylinders":8,"Displacement":302.0,"Horsepower":140,"Weight_in_lbs":3353,"Acceleration":8.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"chevrolet monte carlo","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":400.0,"Horsepower":150,"Weight_in_lbs":3761,"Acceleration":9.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"buick estate wagon (sw)","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":455.0,"Horsepower":225,"Weight_in_lbs":3086,"Acceleration":10.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"toyota corona mark ii","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":113.0,"Horsepower":95,"Weight_in_lbs":2372,"Acceleration":15.0,"Year":"1970-01-01","Origin":"Japan"},{"Name":"plymouth duster","Miles_per_Gallon":22.0,"Cylinders":6,"Displacement":198.0,"Horsepower":95,"Weight_in_lbs":2833,"Acceleration":15.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"amc hornet","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":199.0,"Horsepower":97,"Weight_in_lbs":2774,"Acceleration":15.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"ford maverick","Miles_per_Gallon":21.0,"Cylinders":6,"Displacement":200.0,"Horsepower":85,"Weight_in_lbs":2587,"Acceleration":16.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"datsun pl510","Miles_per_Gallon":27.0,"Cylinders":4,"Displacement":97.0,"Horsepower":88,"Weight_in_lbs":2130,"Acceleration":14.5,"Year":"1970-01-01","Origin":"Japan"},{"Name":"volkswagen 1131 deluxe sedan","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":97.0,"Horsepower":46,"Weight_in_lbs":1835,"Acceleration":20.5,"Year":"1970-01-01","Origin":"Europe"},{"Name":"peugeot 504","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":110.0,"Horsepower":87,"Weight_in_lbs":2672,"Acceleration":17.5,"Year":"1970-01-01","Origin":"Europe"},{"Name":"audi 100 ls","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":107.0,"Horsepower":90,"Weight_in_lbs":2430,"Acceleration":14.5,"Year":"1970-01-01","Origin":"Europe"},{"Name":"saab 99e","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":104.0,"Horsepower":95,"Weight_in_lbs":2375,"Acceleration":17.5,"Year":"1970-01-01","Origin":"Europe"},{"Name":"bmw 2002","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":121.0,"Horsepower":113,"Weight_in_lbs":2234,"Acceleration":12.5,"Year":"1970-01-01","Origin":"Europe"},{"Name":"amc gremlin","Miles_per_Gallon":21.0,"Cylinders":6,"Displacement":199.0,"Horsepower":90,"Weight_in_lbs":2648,"Acceleration":15.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"ford f250","Miles_per_Gallon":10.0,"Cylinders":8,"Displacement":360.0,"Horsepower":215,"Weight_in_lbs":4615,"Acceleration":14.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"chevy c20","Miles_per_Gallon":10.0,"Cylinders":8,"Displacement":307.0,"Horsepower":200,"Weight_in_lbs":4376,"Acceleration":15.0,"Year":"1970-01-01","Origin":"USA"},{"Name":"dodge d200","Miles_per_Gallon":11.0,"Cylinders":8,"Displacement":318.0,"Horsepower":210,"Weight_in_lbs":4382,"Acceleration":13.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"hi 1200d","Miles_per_Gallon":9.0,"Cylinders":8,"Displacement":304.0,"Horsepower":193,"Weight_in_lbs":4732,"Acceleration":18.5,"Year":"1970-01-01","Origin":"USA"},{"Name":"datsun pl510","Miles_per_Gallon":27.0,"Cylinders":4,"Displacement":97.0,"Horsepower":88,"Weight_in_lbs":2130,"Acceleration":14.5,"Year":"1971-01-01","Origin":"Japan"},{"Name":"chevrolet vega 2300","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":140.0,"Horsepower":90,"Weight_in_lbs":2264,"Acceleration":15.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"toyota corona","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":113.0,"Horsepower":95,"Weight_in_lbs":2228,"Acceleration":14.0,"Year":"1971-01-01","Origin":"Japan"},{"Name":"ford pinto","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":98.0,"Horsepower":null,"Weight_in_lbs":2046,"Acceleration":19.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"volkswagen super beetle 117","Miles_per_Gallon":null,"Cylinders":4,"Displacement":97.0,"Horsepower":48,"Weight_in_lbs":1978,"Acceleration":20.0,"Year":"1971-01-01","Origin":"Europe"},{"Name":"amc gremlin","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":232.0,"Horsepower":100,"Weight_in_lbs":2634,"Acceleration":13.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"plymouth satellite custom","Miles_per_Gallon":16.0,"Cylinders":6,"Displacement":225.0,"Horsepower":105,"Weight_in_lbs":3439,"Acceleration":15.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"chevrolet chevelle malibu","Miles_per_Gallon":17.0,"Cylinders":6,"Displacement":250.0,"Horsepower":100,"Weight_in_lbs":3329,"Acceleration":15.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"ford torino 500","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":250.0,"Horsepower":88,"Weight_in_lbs":3302,"Acceleration":15.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"amc matador","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":232.0,"Horsepower":100,"Weight_in_lbs":3288,"Acceleration":15.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"chevrolet impala","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":350.0,"Horsepower":165,"Weight_in_lbs":4209,"Acceleration":12.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"pontiac catalina brougham","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":400.0,"Horsepower":175,"Weight_in_lbs":4464,"Acceleration":11.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"ford galaxie 500","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":351.0,"Horsepower":153,"Weight_in_lbs":4154,"Acceleration":13.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"plymouth fury iii","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4096,"Acceleration":13.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"dodge monaco (sw)","Miles_per_Gallon":12.0,"Cylinders":8,"Displacement":383.0,"Horsepower":180,"Weight_in_lbs":4955,"Acceleration":11.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"ford country squire (sw)","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":400.0,"Horsepower":170,"Weight_in_lbs":4746,"Acceleration":12.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"pontiac safari (sw)","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":400.0,"Horsepower":175,"Weight_in_lbs":5140,"Acceleration":12.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"amc hornet sportabout (sw)","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":258.0,"Horsepower":110,"Weight_in_lbs":2962,"Acceleration":13.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"chevrolet vega (sw)","Miles_per_Gallon":22.0,"Cylinders":4,"Displacement":140.0,"Horsepower":72,"Weight_in_lbs":2408,"Acceleration":19.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"pontiac firebird","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":250.0,"Horsepower":100,"Weight_in_lbs":3282,"Acceleration":15.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"ford mustang","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":250.0,"Horsepower":88,"Weight_in_lbs":3139,"Acceleration":14.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"mercury capri 2000","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":122.0,"Horsepower":86,"Weight_in_lbs":2220,"Acceleration":14.0,"Year":"1971-01-01","Origin":"USA"},{"Name":"opel 1900","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":116.0,"Horsepower":90,"Weight_in_lbs":2123,"Acceleration":14.0,"Year":"1971-01-01","Origin":"Europe"},{"Name":"peugeot 304","Miles_per_Gallon":30.0,"Cylinders":4,"Displacement":79.0,"Horsepower":70,"Weight_in_lbs":2074,"Acceleration":19.5,"Year":"1971-01-01","Origin":"Europe"},{"Name":"fiat 124b","Miles_per_Gallon":30.0,"Cylinders":4,"Displacement":88.0,"Horsepower":76,"Weight_in_lbs":2065,"Acceleration":14.5,"Year":"1971-01-01","Origin":"Europe"},{"Name":"toyota corolla 1200","Miles_per_Gallon":31.0,"Cylinders":4,"Displacement":71.0,"Horsepower":65,"Weight_in_lbs":1773,"Acceleration":19.0,"Year":"1971-01-01","Origin":"Japan"},{"Name":"datsun 1200","Miles_per_Gallon":35.0,"Cylinders":4,"Displacement":72.0,"Horsepower":69,"Weight_in_lbs":1613,"Acceleration":18.0,"Year":"1971-01-01","Origin":"Japan"},{"Name":"volkswagen model 111","Miles_per_Gallon":27.0,"Cylinders":4,"Displacement":97.0,"Horsepower":60,"Weight_in_lbs":1834,"Acceleration":19.0,"Year":"1971-01-01","Origin":"Europe"},{"Name":"plymouth cricket","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":91.0,"Horsepower":70,"Weight_in_lbs":1955,"Acceleration":20.5,"Year":"1971-01-01","Origin":"USA"},{"Name":"toyota corona hardtop","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":113.0,"Horsepower":95,"Weight_in_lbs":2278,"Acceleration":15.5,"Year":"1972-01-01","Origin":"Japan"},{"Name":"dodge colt hardtop","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":97.5,"Horsepower":80,"Weight_in_lbs":2126,"Acceleration":17.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"volkswagen type 3","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":97.0,"Horsepower":54,"Weight_in_lbs":2254,"Acceleration":23.5,"Year":"1972-01-01","Origin":"Europe"},{"Name":"chevrolet vega","Miles_per_Gallon":20.0,"Cylinders":4,"Displacement":140.0,"Horsepower":90,"Weight_in_lbs":2408,"Acceleration":19.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"ford pinto runabout","Miles_per_Gallon":21.0,"Cylinders":4,"Displacement":122.0,"Horsepower":86,"Weight_in_lbs":2226,"Acceleration":16.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"chevrolet impala","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":350.0,"Horsepower":165,"Weight_in_lbs":4274,"Acceleration":12.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"pontiac catalina","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":400.0,"Horsepower":175,"Weight_in_lbs":4385,"Acceleration":12.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"plymouth fury iii","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4135,"Acceleration":13.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"ford galaxie 500","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":351.0,"Horsepower":153,"Weight_in_lbs":4129,"Acceleration":13.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"amc ambassador sst","Miles_per_Gallon":17.0,"Cylinders":8,"Displacement":304.0,"Horsepower":150,"Weight_in_lbs":3672,"Acceleration":11.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"mercury marquis","Miles_per_Gallon":11.0,"Cylinders":8,"Displacement":429.0,"Horsepower":208,"Weight_in_lbs":4633,"Acceleration":11.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"buick lesabre custom","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":350.0,"Horsepower":155,"Weight_in_lbs":4502,"Acceleration":13.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"oldsmobile delta 88 royale","Miles_per_Gallon":12.0,"Cylinders":8,"Displacement":350.0,"Horsepower":160,"Weight_in_lbs":4456,"Acceleration":13.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"chrysler newport royal","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":400.0,"Horsepower":190,"Weight_in_lbs":4422,"Acceleration":12.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"mazda rx2 coupe","Miles_per_Gallon":19.0,"Cylinders":3,"Displacement":70.0,"Horsepower":97,"Weight_in_lbs":2330,"Acceleration":13.5,"Year":"1972-01-01","Origin":"Japan"},{"Name":"amc matador (sw)","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":304.0,"Horsepower":150,"Weight_in_lbs":3892,"Acceleration":12.5,"Year":"1972-01-01","Origin":"USA"},{"Name":"chevrolet chevelle concours (sw)","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":307.0,"Horsepower":130,"Weight_in_lbs":4098,"Acceleration":14.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"ford gran torino (sw)","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":302.0,"Horsepower":140,"Weight_in_lbs":4294,"Acceleration":16.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"plymouth satellite custom (sw)","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4077,"Acceleration":14.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"volvo 145e (sw)","Miles_per_Gallon":18.0,"Cylinders":4,"Displacement":121.0,"Horsepower":112,"Weight_in_lbs":2933,"Acceleration":14.5,"Year":"1972-01-01","Origin":"Europe"},{"Name":"volkswagen 411 (sw)","Miles_per_Gallon":22.0,"Cylinders":4,"Displacement":121.0,"Horsepower":76,"Weight_in_lbs":2511,"Acceleration":18.0,"Year":"1972-01-01","Origin":"Europe"},{"Name":"peugeot 504 (sw)","Miles_per_Gallon":21.0,"Cylinders":4,"Displacement":120.0,"Horsepower":87,"Weight_in_lbs":2979,"Acceleration":19.5,"Year":"1972-01-01","Origin":"Europe"},{"Name":"renault 12 (sw)","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":96.0,"Horsepower":69,"Weight_in_lbs":2189,"Acceleration":18.0,"Year":"1972-01-01","Origin":"Europe"},{"Name":"ford pinto (sw)","Miles_per_Gallon":22.0,"Cylinders":4,"Displacement":122.0,"Horsepower":86,"Weight_in_lbs":2395,"Acceleration":16.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"datsun 510 (sw)","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":97.0,"Horsepower":92,"Weight_in_lbs":2288,"Acceleration":17.0,"Year":"1972-01-01","Origin":"Japan"},{"Name":"toyouta corona mark ii (sw)","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":120.0,"Horsepower":97,"Weight_in_lbs":2506,"Acceleration":14.5,"Year":"1972-01-01","Origin":"Japan"},{"Name":"dodge colt (sw)","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":98.0,"Horsepower":80,"Weight_in_lbs":2164,"Acceleration":15.0,"Year":"1972-01-01","Origin":"USA"},{"Name":"toyota corolla 1600 (sw)","Miles_per_Gallon":27.0,"Cylinders":4,"Displacement":97.0,"Horsepower":88,"Weight_in_lbs":2100,"Acceleration":16.5,"Year":"1972-01-01","Origin":"Japan"},{"Name":"buick century 350","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":350.0,"Horsepower":175,"Weight_in_lbs":4100,"Acceleration":13.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"amc matador","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":304.0,"Horsepower":150,"Weight_in_lbs":3672,"Acceleration":11.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"chevrolet malibu","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":350.0,"Horsepower":145,"Weight_in_lbs":3988,"Acceleration":13.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"ford gran torino","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":302.0,"Horsepower":137,"Weight_in_lbs":4042,"Acceleration":14.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"dodge coronet custom","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":3777,"Acceleration":12.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"mercury marquis brougham","Miles_per_Gallon":12.0,"Cylinders":8,"Displacement":429.0,"Horsepower":198,"Weight_in_lbs":4952,"Acceleration":11.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"chevrolet caprice classic","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":400.0,"Horsepower":150,"Weight_in_lbs":4464,"Acceleration":12.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"ford ltd","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":351.0,"Horsepower":158,"Weight_in_lbs":4363,"Acceleration":13.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"plymouth fury gran sedan","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4237,"Acceleration":14.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"chrysler new yorker brougham","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":440.0,"Horsepower":215,"Weight_in_lbs":4735,"Acceleration":11.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"buick electra 225 custom","Miles_per_Gallon":12.0,"Cylinders":8,"Displacement":455.0,"Horsepower":225,"Weight_in_lbs":4951,"Acceleration":11.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"amc ambassador brougham","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":360.0,"Horsepower":175,"Weight_in_lbs":3821,"Acceleration":11.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"plymouth valiant","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":225.0,"Horsepower":105,"Weight_in_lbs":3121,"Acceleration":16.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"chevrolet nova custom","Miles_per_Gallon":16.0,"Cylinders":6,"Displacement":250.0,"Horsepower":100,"Weight_in_lbs":3278,"Acceleration":18.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"amc hornet","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":232.0,"Horsepower":100,"Weight_in_lbs":2945,"Acceleration":16.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"ford maverick","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":250.0,"Horsepower":88,"Weight_in_lbs":3021,"Acceleration":16.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"plymouth duster","Miles_per_Gallon":23.0,"Cylinders":6,"Displacement":198.0,"Horsepower":95,"Weight_in_lbs":2904,"Acceleration":16.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"volkswagen super beetle","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":97.0,"Horsepower":46,"Weight_in_lbs":1950,"Acceleration":21.0,"Year":"1973-01-01","Origin":"Europe"},{"Name":"chevrolet impala","Miles_per_Gallon":11.0,"Cylinders":8,"Displacement":400.0,"Horsepower":150,"Weight_in_lbs":4997,"Acceleration":14.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"ford country","Miles_per_Gallon":12.0,"Cylinders":8,"Displacement":400.0,"Horsepower":167,"Weight_in_lbs":4906,"Acceleration":12.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"plymouth custom suburb","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":360.0,"Horsepower":170,"Weight_in_lbs":4654,"Acceleration":13.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"oldsmobile vista cruiser","Miles_per_Gallon":12.0,"Cylinders":8,"Displacement":350.0,"Horsepower":180,"Weight_in_lbs":4499,"Acceleration":12.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"amc gremlin","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":232.0,"Horsepower":100,"Weight_in_lbs":2789,"Acceleration":15.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"toyota carina","Miles_per_Gallon":20.0,"Cylinders":4,"Displacement":97.0,"Horsepower":88,"Weight_in_lbs":2279,"Acceleration":19.0,"Year":"1973-01-01","Origin":"Japan"},{"Name":"chevrolet vega","Miles_per_Gallon":21.0,"Cylinders":4,"Displacement":140.0,"Horsepower":72,"Weight_in_lbs":2401,"Acceleration":19.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"datsun 610","Miles_per_Gallon":22.0,"Cylinders":4,"Displacement":108.0,"Horsepower":94,"Weight_in_lbs":2379,"Acceleration":16.5,"Year":"1973-01-01","Origin":"Japan"},{"Name":"maxda rx3","Miles_per_Gallon":18.0,"Cylinders":3,"Displacement":70.0,"Horsepower":90,"Weight_in_lbs":2124,"Acceleration":13.5,"Year":"1973-01-01","Origin":"Japan"},{"Name":"ford pinto","Miles_per_Gallon":19.0,"Cylinders":4,"Displacement":122.0,"Horsepower":85,"Weight_in_lbs":2310,"Acceleration":18.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"mercury capri v6","Miles_per_Gallon":21.0,"Cylinders":6,"Displacement":155.0,"Horsepower":107,"Weight_in_lbs":2472,"Acceleration":14.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"fiat 124 sport coupe","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":98.0,"Horsepower":90,"Weight_in_lbs":2265,"Acceleration":15.5,"Year":"1973-01-01","Origin":"Europe"},{"Name":"chevrolet monte carlo s","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":350.0,"Horsepower":145,"Weight_in_lbs":4082,"Acceleration":13.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"pontiac grand prix","Miles_per_Gallon":16.0,"Cylinders":8,"Displacement":400.0,"Horsepower":230,"Weight_in_lbs":4278,"Acceleration":9.5,"Year":"1973-01-01","Origin":"USA"},{"Name":"fiat 128","Miles_per_Gallon":29.0,"Cylinders":4,"Displacement":68.0,"Horsepower":49,"Weight_in_lbs":1867,"Acceleration":19.5,"Year":"1973-01-01","Origin":"Europe"},{"Name":"opel manta","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":116.0,"Horsepower":75,"Weight_in_lbs":2158,"Acceleration":15.5,"Year":"1973-01-01","Origin":"Europe"},{"Name":"audi 100ls","Miles_per_Gallon":20.0,"Cylinders":4,"Displacement":114.0,"Horsepower":91,"Weight_in_lbs":2582,"Acceleration":14.0,"Year":"1973-01-01","Origin":"Europe"},{"Name":"volvo 144ea","Miles_per_Gallon":19.0,"Cylinders":4,"Displacement":121.0,"Horsepower":112,"Weight_in_lbs":2868,"Acceleration":15.5,"Year":"1973-01-01","Origin":"Europe"},{"Name":"dodge dart custom","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":3399,"Acceleration":11.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"saab 99le","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":121.0,"Horsepower":110,"Weight_in_lbs":2660,"Acceleration":14.0,"Year":"1973-01-01","Origin":"Europe"},{"Name":"toyota mark ii","Miles_per_Gallon":20.0,"Cylinders":6,"Displacement":156.0,"Horsepower":122,"Weight_in_lbs":2807,"Acceleration":13.5,"Year":"1973-01-01","Origin":"Japan"},{"Name":"oldsmobile omega","Miles_per_Gallon":11.0,"Cylinders":8,"Displacement":350.0,"Horsepower":180,"Weight_in_lbs":3664,"Acceleration":11.0,"Year":"1973-01-01","Origin":"USA"},{"Name":"plymouth duster","Miles_per_Gallon":20.0,"Cylinders":6,"Displacement":198.0,"Horsepower":95,"Weight_in_lbs":3102,"Acceleration":16.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"ford maverick","Miles_per_Gallon":21.0,"Cylinders":6,"Displacement":200.0,"Horsepower":null,"Weight_in_lbs":2875,"Acceleration":17.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"amc hornet","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":232.0,"Horsepower":100,"Weight_in_lbs":2901,"Acceleration":16.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"chevrolet nova","Miles_per_Gallon":15.0,"Cylinders":6,"Displacement":250.0,"Horsepower":100,"Weight_in_lbs":3336,"Acceleration":17.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"datsun b210","Miles_per_Gallon":31.0,"Cylinders":4,"Displacement":79.0,"Horsepower":67,"Weight_in_lbs":1950,"Acceleration":19.0,"Year":"1974-01-01","Origin":"Japan"},{"Name":"ford pinto","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":122.0,"Horsepower":80,"Weight_in_lbs":2451,"Acceleration":16.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"toyota corolla 1200","Miles_per_Gallon":32.0,"Cylinders":4,"Displacement":71.0,"Horsepower":65,"Weight_in_lbs":1836,"Acceleration":21.0,"Year":"1974-01-01","Origin":"Japan"},{"Name":"chevrolet vega","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":140.0,"Horsepower":75,"Weight_in_lbs":2542,"Acceleration":17.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"chevrolet chevelle malibu classic","Miles_per_Gallon":16.0,"Cylinders":6,"Displacement":250.0,"Horsepower":100,"Weight_in_lbs":3781,"Acceleration":17.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"amc matador","Miles_per_Gallon":16.0,"Cylinders":6,"Displacement":258.0,"Horsepower":110,"Weight_in_lbs":3632,"Acceleration":18.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"plymouth satellite sebring","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":225.0,"Horsepower":105,"Weight_in_lbs":3613,"Acceleration":16.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"ford gran torino","Miles_per_Gallon":16.0,"Cylinders":8,"Displacement":302.0,"Horsepower":140,"Weight_in_lbs":4141,"Acceleration":14.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"buick century luxus (sw)","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":350.0,"Horsepower":150,"Weight_in_lbs":4699,"Acceleration":14.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"dodge coronet custom (sw)","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4457,"Acceleration":13.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"ford gran torino (sw)","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":302.0,"Horsepower":140,"Weight_in_lbs":4638,"Acceleration":16.0,"Year":"1974-01-01","Origin":"USA"},{"Name":"amc matador (sw)","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":304.0,"Horsepower":150,"Weight_in_lbs":4257,"Acceleration":15.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"audi fox","Miles_per_Gallon":29.0,"Cylinders":4,"Displacement":98.0,"Horsepower":83,"Weight_in_lbs":2219,"Acceleration":16.5,"Year":"1974-01-01","Origin":"Europe"},{"Name":"volkswagen dasher","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":79.0,"Horsepower":67,"Weight_in_lbs":1963,"Acceleration":15.5,"Year":"1974-01-01","Origin":"Europe"},{"Name":"opel manta","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":97.0,"Horsepower":78,"Weight_in_lbs":2300,"Acceleration":14.5,"Year":"1974-01-01","Origin":"Europe"},{"Name":"toyota corona","Miles_per_Gallon":31.0,"Cylinders":4,"Displacement":76.0,"Horsepower":52,"Weight_in_lbs":1649,"Acceleration":16.5,"Year":"1974-01-01","Origin":"Japan"},{"Name":"datsun 710","Miles_per_Gallon":32.0,"Cylinders":4,"Displacement":83.0,"Horsepower":61,"Weight_in_lbs":2003,"Acceleration":19.0,"Year":"1974-01-01","Origin":"Japan"},{"Name":"dodge colt","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":90.0,"Horsepower":75,"Weight_in_lbs":2125,"Acceleration":14.5,"Year":"1974-01-01","Origin":"USA"},{"Name":"fiat 128","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":90.0,"Horsepower":75,"Weight_in_lbs":2108,"Acceleration":15.5,"Year":"1974-01-01","Origin":"Europe"},{"Name":"fiat 124 tc","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":116.0,"Horsepower":75,"Weight_in_lbs":2246,"Acceleration":14.0,"Year":"1974-01-01","Origin":"Europe"},{"Name":"honda civic","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":120.0,"Horsepower":97,"Weight_in_lbs":2489,"Acceleration":15.0,"Year":"1974-01-01","Origin":"Japan"},{"Name":"subaru","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":108.0,"Horsepower":93,"Weight_in_lbs":2391,"Acceleration":15.5,"Year":"1974-01-01","Origin":"Japan"},{"Name":"fiat x1.9","Miles_per_Gallon":31.0,"Cylinders":4,"Displacement":79.0,"Horsepower":67,"Weight_in_lbs":2000,"Acceleration":16.0,"Year":"1974-01-01","Origin":"Europe"},{"Name":"plymouth valiant custom","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":225.0,"Horsepower":95,"Weight_in_lbs":3264,"Acceleration":16.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"chevrolet nova","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":250.0,"Horsepower":105,"Weight_in_lbs":3459,"Acceleration":16.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"mercury monarch","Miles_per_Gallon":15.0,"Cylinders":6,"Displacement":250.0,"Horsepower":72,"Weight_in_lbs":3432,"Acceleration":21.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"ford maverick","Miles_per_Gallon":15.0,"Cylinders":6,"Displacement":250.0,"Horsepower":72,"Weight_in_lbs":3158,"Acceleration":19.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"pontiac catalina","Miles_per_Gallon":16.0,"Cylinders":8,"Displacement":400.0,"Horsepower":170,"Weight_in_lbs":4668,"Acceleration":11.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"chevrolet bel air","Miles_per_Gallon":15.0,"Cylinders":8,"Displacement":350.0,"Horsepower":145,"Weight_in_lbs":4440,"Acceleration":14.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"plymouth grand fury","Miles_per_Gallon":16.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4498,"Acceleration":14.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"ford ltd","Miles_per_Gallon":14.0,"Cylinders":8,"Displacement":351.0,"Horsepower":148,"Weight_in_lbs":4657,"Acceleration":13.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"buick century","Miles_per_Gallon":17.0,"Cylinders":6,"Displacement":231.0,"Horsepower":110,"Weight_in_lbs":3907,"Acceleration":21.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"chevroelt chevelle malibu","Miles_per_Gallon":16.0,"Cylinders":6,"Displacement":250.0,"Horsepower":105,"Weight_in_lbs":3897,"Acceleration":18.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"amc matador","Miles_per_Gallon":15.0,"Cylinders":6,"Displacement":258.0,"Horsepower":110,"Weight_in_lbs":3730,"Acceleration":19.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"plymouth fury","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":225.0,"Horsepower":95,"Weight_in_lbs":3785,"Acceleration":19.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"buick skyhawk","Miles_per_Gallon":21.0,"Cylinders":6,"Displacement":231.0,"Horsepower":110,"Weight_in_lbs":3039,"Acceleration":15.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"chevrolet monza 2+2","Miles_per_Gallon":20.0,"Cylinders":8,"Displacement":262.0,"Horsepower":110,"Weight_in_lbs":3221,"Acceleration":13.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"ford mustang ii","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":302.0,"Horsepower":129,"Weight_in_lbs":3169,"Acceleration":12.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"toyota corolla","Miles_per_Gallon":29.0,"Cylinders":4,"Displacement":97.0,"Horsepower":75,"Weight_in_lbs":2171,"Acceleration":16.0,"Year":"1975-01-01","Origin":"Japan"},{"Name":"ford pinto","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":140.0,"Horsepower":83,"Weight_in_lbs":2639,"Acceleration":17.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"amc gremlin","Miles_per_Gallon":20.0,"Cylinders":6,"Displacement":232.0,"Horsepower":100,"Weight_in_lbs":2914,"Acceleration":16.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"pontiac astro","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":140.0,"Horsepower":78,"Weight_in_lbs":2592,"Acceleration":18.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"toyota corona","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":134.0,"Horsepower":96,"Weight_in_lbs":2702,"Acceleration":13.5,"Year":"1975-01-01","Origin":"Japan"},{"Name":"volkswagen dasher","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":90.0,"Horsepower":71,"Weight_in_lbs":2223,"Acceleration":16.5,"Year":"1975-01-01","Origin":"Europe"},{"Name":"datsun 710","Miles_per_Gallon":24.0,"Cylinders":4,"Displacement":119.0,"Horsepower":97,"Weight_in_lbs":2545,"Acceleration":17.0,"Year":"1975-01-01","Origin":"Japan"},{"Name":"ford pinto","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":171.0,"Horsepower":97,"Weight_in_lbs":2984,"Acceleration":14.5,"Year":"1975-01-01","Origin":"USA"},{"Name":"volkswagen rabbit","Miles_per_Gallon":29.0,"Cylinders":4,"Displacement":90.0,"Horsepower":70,"Weight_in_lbs":1937,"Acceleration":14.0,"Year":"1975-01-01","Origin":"Europe"},{"Name":"amc pacer","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":232.0,"Horsepower":90,"Weight_in_lbs":3211,"Acceleration":17.0,"Year":"1975-01-01","Origin":"USA"},{"Name":"audi 100ls","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":115.0,"Horsepower":95,"Weight_in_lbs":2694,"Acceleration":15.0,"Year":"1975-01-01","Origin":"Europe"},{"Name":"peugeot 504","Miles_per_Gallon":23.0,"Cylinders":4,"Displacement":120.0,"Horsepower":88,"Weight_in_lbs":2957,"Acceleration":17.0,"Year":"1975-01-01","Origin":"Europe"},{"Name":"volvo 244dl","Miles_per_Gallon":22.0,"Cylinders":4,"Displacement":121.0,"Horsepower":98,"Weight_in_lbs":2945,"Acceleration":14.5,"Year":"1975-01-01","Origin":"Europe"},{"Name":"saab 99le","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":121.0,"Horsepower":115,"Weight_in_lbs":2671,"Acceleration":13.5,"Year":"1975-01-01","Origin":"Europe"},{"Name":"honda civic cvcc","Miles_per_Gallon":33.0,"Cylinders":4,"Displacement":91.0,"Horsepower":53,"Weight_in_lbs":1795,"Acceleration":17.5,"Year":"1975-01-01","Origin":"Japan"},{"Name":"fiat 131","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":107.0,"Horsepower":86,"Weight_in_lbs":2464,"Acceleration":15.5,"Year":"1976-01-01","Origin":"Europe"},{"Name":"opel 1900","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":116.0,"Horsepower":81,"Weight_in_lbs":2220,"Acceleration":16.9,"Year":"1976-01-01","Origin":"Europe"},{"Name":"capri ii","Miles_per_Gallon":25.0,"Cylinders":4,"Displacement":140.0,"Horsepower":92,"Weight_in_lbs":2572,"Acceleration":14.9,"Year":"1976-01-01","Origin":"USA"},{"Name":"dodge colt","Miles_per_Gallon":26.0,"Cylinders":4,"Displacement":98.0,"Horsepower":79,"Weight_in_lbs":2255,"Acceleration":17.7,"Year":"1976-01-01","Origin":"USA"},{"Name":"renault 12tl","Miles_per_Gallon":27.0,"Cylinders":4,"Displacement":101.0,"Horsepower":83,"Weight_in_lbs":2202,"Acceleration":15.3,"Year":"1976-01-01","Origin":"Europe"},{"Name":"chevrolet chevelle malibu classic","Miles_per_Gallon":17.5,"Cylinders":8,"Displacement":305.0,"Horsepower":140,"Weight_in_lbs":4215,"Acceleration":13.0,"Year":"1976-01-01","Origin":"USA"},{"Name":"dodge coronet brougham","Miles_per_Gallon":16.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":4190,"Acceleration":13.0,"Year":"1976-01-01","Origin":"USA"},{"Name":"amc matador","Miles_per_Gallon":15.5,"Cylinders":8,"Displacement":304.0,"Horsepower":120,"Weight_in_lbs":3962,"Acceleration":13.9,"Year":"1976-01-01","Origin":"USA"},{"Name":"ford gran torino","Miles_per_Gallon":14.5,"Cylinders":8,"Displacement":351.0,"Horsepower":152,"Weight_in_lbs":4215,"Acceleration":12.8,"Year":"1976-01-01","Origin":"USA"},{"Name":"plymouth valiant","Miles_per_Gallon":22.0,"Cylinders":6,"Displacement":225.0,"Horsepower":100,"Weight_in_lbs":3233,"Acceleration":15.4,"Year":"1976-01-01","Origin":"USA"},{"Name":"chevrolet nova","Miles_per_Gallon":22.0,"Cylinders":6,"Displacement":250.0,"Horsepower":105,"Weight_in_lbs":3353,"Acceleration":14.5,"Year":"1976-01-01","Origin":"USA"},{"Name":"ford maverick","Miles_per_Gallon":24.0,"Cylinders":6,"Displacement":200.0,"Horsepower":81,"Weight_in_lbs":3012,"Acceleration":17.6,"Year":"1976-01-01","Origin":"USA"},{"Name":"amc hornet","Miles_per_Gallon":22.5,"Cylinders":6,"Displacement":232.0,"Horsepower":90,"Weight_in_lbs":3085,"Acceleration":17.6,"Year":"1976-01-01","Origin":"USA"},{"Name":"chevrolet chevette","Miles_per_Gallon":29.0,"Cylinders":4,"Displacement":85.0,"Horsepower":52,"Weight_in_lbs":2035,"Acceleration":22.2,"Year":"1976-01-01","Origin":"USA"},{"Name":"chevrolet woody","Miles_per_Gallon":24.5,"Cylinders":4,"Displacement":98.0,"Horsepower":60,"Weight_in_lbs":2164,"Acceleration":22.1,"Year":"1976-01-01","Origin":"USA"},{"Name":"vw rabbit","Miles_per_Gallon":29.0,"Cylinders":4,"Displacement":90.0,"Horsepower":70,"Weight_in_lbs":1937,"Acceleration":14.2,"Year":"1976-01-01","Origin":"Europe"},{"Name":"honda civic","Miles_per_Gallon":33.0,"Cylinders":4,"Displacement":91.0,"Horsepower":53,"Weight_in_lbs":1795,"Acceleration":17.4,"Year":"1976-01-01","Origin":"Japan"},{"Name":"dodge aspen se","Miles_per_Gallon":20.0,"Cylinders":6,"Displacement":225.0,"Horsepower":100,"Weight_in_lbs":3651,"Acceleration":17.7,"Year":"1976-01-01","Origin":"USA"},{"Name":"ford granada ghia","Miles_per_Gallon":18.0,"Cylinders":6,"Displacement":250.0,"Horsepower":78,"Weight_in_lbs":3574,"Acceleration":21.0,"Year":"1976-01-01","Origin":"USA"},{"Name":"pontiac ventura sj","Miles_per_Gallon":18.5,"Cylinders":6,"Displacement":250.0,"Horsepower":110,"Weight_in_lbs":3645,"Acceleration":16.2,"Year":"1976-01-01","Origin":"USA"},{"Name":"amc pacer d/l","Miles_per_Gallon":17.5,"Cylinders":6,"Displacement":258.0,"Horsepower":95,"Weight_in_lbs":3193,"Acceleration":17.8,"Year":"1976-01-01","Origin":"USA"},{"Name":"volkswagen rabbit","Miles_per_Gallon":29.5,"Cylinders":4,"Displacement":97.0,"Horsepower":71,"Weight_in_lbs":1825,"Acceleration":12.2,"Year":"1976-01-01","Origin":"Europe"},{"Name":"datsun b-210","Miles_per_Gallon":32.0,"Cylinders":4,"Displacement":85.0,"Horsepower":70,"Weight_in_lbs":1990,"Acceleration":17.0,"Year":"1976-01-01","Origin":"Japan"},{"Name":"toyota corolla","Miles_per_Gallon":28.0,"Cylinders":4,"Displacement":97.0,"Horsepower":75,"Weight_in_lbs":2155,"Acceleration":16.4,"Year":"1976-01-01","Origin":"Japan"},{"Name":"ford pinto","Miles_per_Gallon":26.5,"Cylinders":4,"Displacement":140.0,"Horsepower":72,"Weight_in_lbs":2565,"Acceleration":13.6,"Year":"1976-01-01","Origin":"USA"},{"Name":"volvo 245","Miles_per_Gallon":20.0,"Cylinders":4,"Displacement":130.0,"Horsepower":102,"Weight_in_lbs":3150,"Acceleration":15.7,"Year":"1976-01-01","Origin":"Europe"},{"Name":"plymouth volare premier v8","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":3940,"Acceleration":13.2,"Year":"1976-01-01","Origin":"USA"},{"Name":"peugeot 504","Miles_per_Gallon":19.0,"Cylinders":4,"Displacement":120.0,"Horsepower":88,"Weight_in_lbs":3270,"Acceleration":21.9,"Year":"1976-01-01","Origin":"Europe"},{"Name":"toyota mark ii","Miles_per_Gallon":19.0,"Cylinders":6,"Displacement":156.0,"Horsepower":108,"Weight_in_lbs":2930,"Acceleration":15.5,"Year":"1976-01-01","Origin":"Japan"},{"Name":"mercedes-benz 280s","Miles_per_Gallon":16.5,"Cylinders":6,"Displacement":168.0,"Horsepower":120,"Weight_in_lbs":3820,"Acceleration":16.7,"Year":"1976-01-01","Origin":"Europe"},{"Name":"cadillac seville","Miles_per_Gallon":16.5,"Cylinders":8,"Displacement":350.0,"Horsepower":180,"Weight_in_lbs":4380,"Acceleration":12.1,"Year":"1976-01-01","Origin":"USA"},{"Name":"chevy c10","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":350.0,"Horsepower":145,"Weight_in_lbs":4055,"Acceleration":12.0,"Year":"1976-01-01","Origin":"USA"},{"Name":"ford f108","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":302.0,"Horsepower":130,"Weight_in_lbs":3870,"Acceleration":15.0,"Year":"1976-01-01","Origin":"USA"},{"Name":"dodge d100","Miles_per_Gallon":13.0,"Cylinders":8,"Displacement":318.0,"Horsepower":150,"Weight_in_lbs":3755,"Acceleration":14.0,"Year":"1976-01-01","Origin":"USA"},{"Name":"honda Accelerationord cvcc","