UNPKG

vega

Version:

The Vega visualization grammar.

1 lines 388 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-dsv"),require("topojson-client"),require("d3-array"),require("d3-format"),require("d3-time"),require("d3-time-format"),require("d3-shape"),require("d3-path"),require("d3-scale"),require("d3-interpolate"),require("d3-geo"),require("d3-color"),require("d3-force"),require("d3-hierarchy"),require("d3-delaunay"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-dsv","topojson-client","d3-array","d3-format","d3-time","d3-time-format","d3-shape","d3-path","d3-scale","d3-interpolate","d3-geo","d3-color","d3-force","d3-hierarchy","d3-delaunay","d3-timer"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.d3,e.topojson,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3,e.d3)}(this,(function(e,t,n,r,i,a,u,o,s,l,c,f,d,h,p,m,v){"use strict";function g(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var y=g(l),b=g(c);function x(e,t,n){return e.fields=t||[],e.fname=n,e}function _(e){return null==e?null:e.fname}function k(e){return null==e?null:e.fields}function w(e){return 1===e.length?A(e[0]):E(e)}var A=function(e){return function(t){return t[e]}},E=function(e){var t=e.length;return function(n){for(var r=0;r<t;++r)n=n[e[r]];return n}};function D(e){throw Error(e)}function C(e){var t,n,r,i=[],a=e.length,u=null,o=0,s="";function l(){i.push(s+e.substring(t,n)),s="",t=n+1}for(e+="",t=n=0;n<a;++n)if("\\"===(r=e[n]))s+=e.substring(t,n++),t=n;else if(r===u)l(),u=null,o=-1;else{if(u)continue;t===o&&'"'===r||t===o&&"'"===r?(t=n+1,u=r):"."!==r||o?"["===r?(n>t&&l(),o=t=n+1):"]"===r&&(o||D("Access path missing open bracket: "+e),o>0&&l(),o=0,t=n+1):n>t?l():t=n+1}return o&&D("Access path missing closing bracket: "+e),u&&D("Access path missing closing quote: "+e),n>t&&(n++,l()),i}function F(e,t,n){var r=C(e);return e=1===r.length?r[0]:e,x((n&&n.get||w)(r),[e],t||e)}var M=F("id"),S=x((function(e){return e}),[],"identity"),O=x((function(){return 0}),[],"zero"),B=x((function(){return 1}),[],"one"),R=x((function(){return!0}),[],"true"),z=x((function(){return!1}),[],"false");function L(e,t,n){var r=[t].concat([].slice.call(n));console[e].apply(console,r)}var T=0,q=1,N=2,P=3,j=4;function U(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:L,r=e||T;return{level:function(e){return arguments.length?(r=+e,this):r},error:function(){return r>=q&&n(t||"error","ERROR",arguments),this},warn:function(){return r>=N&&n(t||"warn","WARN",arguments),this},info:function(){return r>=P&&n(t||"log","INFO",arguments),this},debug:function(){return r>=j&&n(t||"log","DEBUG",arguments),this}}}var I=Array.isArray;function $(e){return e===Object(e)}var W=function(e){return"__proto__"!==e};function G(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((function(e,t){for(var n in t)if("signals"===n)e.signals=V(e.signals,t.signals);else{var r="legend"===n?{layout:1}:"style"===n||null;H(e,n,t[n],r)}return e}),{})}function H(e,t,n,r){var i,a;if(W(t))if($(n)&&!I(n))for(i in a=$(e[t])?e[t]:e[t]={},n)r&&(!0===r||r[i])?H(a,i,n[i]):W(i)&&(a[i]=n[i]);else e[t]=n}function V(e,t){if(null==e)return t;var n={},r=[];function i(e){n[e.name]||(n[e.name]=1,r.push(e))}return t.forEach(i),e.forEach(i),r}function Y(e){return e[e.length-1]}function X(e){return null==e||""===e?null:+e}var J=function(e){return function(t){return e*Math.exp(t)}},Q=function(e){return function(t){return Math.log(e*t)}},K=function(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}},Z=function(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}},ee=function(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}};function te(e,t,n,r){var i=n(e[0]),a=n(Y(e)),u=(a-i)*t;return[r(i-u),r(a-u)]}function ne(e,t){return te(e,t,X,S)}function re(e,t){var n=Math.sign(e[0]);return te(e,t,Q(n),J(n))}function ie(e,t,n){return te(e,t,ee(n),ee(1/n))}function ae(e,t,n){return te(e,t,K(n),Z(n))}function ue(e,t,n,r,i){var a=r(e[0]),u=r(Y(e)),o=null!=t?r(t):(a+u)/2;return[i(o+(a-o)*n),i(o+(u-o)*n)]}function oe(e,t,n){return ue(e,t,n,X,S)}function se(e,t,n){var r=Math.sign(e[0]);return ue(e,t,n,Q(r),J(r))}function le(e,t,n,r){return ue(e,t,n,ee(r),ee(1/r))}function ce(e,t,n,r){return ue(e,t,n,K(r),Z(r))}function fe(e){return 1+~~(new Date(e).getMonth()/3)}function de(e){return 1+~~(new Date(e).getUTCMonth()/3)}function he(e){return null!=e?I(e)?e:[e]:[]}function pe(e,t,n){var r,i=e[0],a=e[1];return a<i&&(r=a,a=i,i=r),(r=a-i)>=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-r),i+r]}function me(e){return"function"==typeof e}var ve="descending";function ge(e,t,n){n=n||{},t=he(t)||[];var r=[],i=[],a={},u=n.comparator||be;return he(e).forEach((function(e,u){null!=e&&(r.push(t[u]===ve?-1:1),i.push(e=me(e)?e:F(e,null,n)),(k(e)||[]).forEach((function(e){return a[e]=1})))})),0===i.length?null:x(u(i,r),Object.keys(a))}var ye=function(e,t){return(e<t||null==e)&&null!=t?-1:(e>t||null==t)&&null!=e?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t==t?-1:t!=t&&e==e?1:0)},be=function(e,t){return 1===e.length?xe(e[0],t[0]):_e(e,t,e.length)},xe=function(e,t){return function(n,r){return ye(e(n),e(r))*t}},_e=function(e,t,n){return t.push(0),function(r,i){for(var a,u=0,o=-1;0===u&&++o<n;)a=e[o],u=ye(a(r),a(i));return u*t[o]}};function ke(e){return me(e)?e:function(){return e}}function we(e,t){var n;return function(r){n&&clearTimeout(n),n=setTimeout((function(){return t(r),n=null}),e)}}function Ae(e){for(var t,n,r=1,i=arguments.length;r<i;++r)for(n in t=arguments[r])e[n]=t[n];return e}function Ee(e,t){var n,r,i,a,u=0;if(e&&(n=e.length))if(null==t){for(r=e[u];u<n&&(null==r||r!=r);r=e[++u]);for(i=a=r;u<n;++u)null!=(r=e[u])&&(r<i&&(i=r),r>a&&(a=r))}else{for(r=t(e[u]);u<n&&(null==r||r!=r);r=t(e[++u]));for(i=a=r;u<n;++u)null!=(r=t(e[u]))&&(r<i&&(i=r),r>a&&(a=r))}return[i,a]}function De(e,t){var n,r,i,a,u,o=e.length,s=-1;if(null==t){for(;++s<o;)if(null!=(r=e[s])&&r>=r){n=i=r;break}if(s===o)return[-1,-1];for(a=u=s;++s<o;)null!=(r=e[s])&&(n>r&&(n=r,a=s),i<r&&(i=r,u=s))}else{for(;++s<o;)if(null!=(r=t(e[s],s,e))&&r>=r){n=i=r;break}if(s===o)return[-1,-1];for(a=u=s;++s<o;)null!=(r=t(e[s],s,e))&&(n>r&&(n=r,a=s),i<r&&(i=r,u=s))}return[a,u]}function Ce(e,t){return Object.hasOwn(e,t)}var Fe={};function Me(e){var t,n={};function r(e){return Ce(n,e)&&n[e]!==Fe}var i={size:0,empty:0,object:n,has:r,get:function(e){return r(e)?n[e]:void 0},set:function(e,t){return r(e)||(++i.size,n[e]===Fe&&--i.empty),n[e]=t,this},delete:function(e){return r(e)&&(--i.size,++i.empty,n[e]=Fe),this},clear:function(){i.size=i.empty=0,i.object=n={}},test:function(e){return arguments.length?(t=e,i):t},clean:function(){var e={},r=0;for(var a in n){var u=n[a];u===Fe||t&&t(u)||(e[a]=u,++r)}i.size=r,i.empty=0,i.object=n=e}};return e&&Object.keys(e).forEach((function(t){i.set(t,e[t])})),i}function Se(e,t,n,r,i,a){if(!n&&0!==n)return a;var u,o=+n,s=e[0],l=Y(e);l<s&&(u=s,s=l,l=u),u=Math.abs(t-s);var c=Math.abs(l-t);return u<c&&u<=o?r:c<=o?i:a}function Oe(e,t,n){var r=e.prototype=Object.create(t.prototype);return Object.defineProperty(r,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),Ae(r,n)}function Be(e,t,n,r){var i,a=t[0],u=t[t.length-1];return a>u&&(i=a,a=u,u=i),r=void 0===r||r,((n=void 0===n||n)?a<=e:a<e)&&(r?e<=u:e<u)}function Re(e){return"boolean"==typeof e}function ze(e){return"[object Date]"===Object.prototype.toString.call(e)}function Le(e){return e&&me(e[Symbol.iterator])}function Te(e){return"number"==typeof e}function qe(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Ne(e){return"string"==typeof e}function Pe(e,t,n){e&&(e=t?he(e).map((function(e){return e.replace(/\\(.)/g,"$1")})):he(e));var r,i=e&&e.length,a=n&&n.get||w,u=function(e){return a(t?[e]:C(e))};if(i)if(1===i){var o=u(e[0]);r=function(e){return""+o(e)}}else{var s=e.map(u);r=function(e){for(var t=""+s[0](e),n=0;++n<i;)t+="|"+s[n](e);return t}}else r=function(){return""};return x(r,e,"key")}function je(e,t){var n=e[0],r=Y(e),i=+t;return i?1===i?r:n+i*(r-n):n}function Ue(e){var t,n,r;e=+e||1e4;var i=function(){t={},n={},r=0},a=function(i,a){return++r>e&&(n=t,t={},r=1),t[i]=a};return i(),{clear:i,has:function(e){return Ce(t,e)||Ce(n,e)},get:function(e){return Ce(t,e)?t[e]:Ce(n,e)?a(e,n[e]):void 0},set:function(e,n){return Ce(t,e)?t[e]=n:a(e,n)}}}function Ie(e,t,n,r){var i=t.length,a=n.length;if(!a)return t;if(!i)return n;for(var u=r||new t.constructor(i+a),o=0,s=0,l=0;o<i&&s<a;++l)u[l]=e(t[o],n[s])>0?n[s++]:t[o++];for(;o<i;++o,++l)u[l]=t[o];for(;s<a;++s,++l)u[l]=n[s];return u}function $e(e,t){for(var n="";--t>=0;)n+=e;return n}function We(e,t,n,r){var i=n||" ",a=e+"",u=t-a.length;return u<=0?a:"left"===r?$e(i,u)+a:"center"===r?$e(i,~~(u/2))+a+$e(i,Math.ceil(u/2)):a+$e(i,u)}function Ge(e){return e&&Y(e)-e[0]||0}function He(e){return I(e)?"["+e.map(He)+"]":$(e)||Ne(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function Ve(e){return null==e||""===e?null:!(!e||"false"===e||"0"===e)&&!!e}var Ye,Xe,Je,Qe,Ke,Ze=function(e){return Te(e)||ze(e)?e:Date.parse(e)};function et(e,t){return t=t||Ze,null==e||""===e?null:t(e)}function tt(e){return null==e||""===e?null:e+""}function nt(e){for(var t={},n=e.length,r=0;r<n;++r)t[e[r]]=!0;return t}function rt(e,t,n,r){var i=null!=r?r:"…",a=e+"",u=a.length,o=Math.max(0,t-i.length);return u<=t?a:"left"===n?i+a.slice(u-o):"center"===n?a.slice(0,Math.ceil(o/2))+i+a.slice(u-~~(o/2)):a.slice(0,o)+i}function it(e,t,n){if(e)if(t)for(var r=e.length,i=0;i<r;++i){var a=t(e[i]);a&&n(a,i,e)}else e.forEach(n)}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ut(e,t,n,r,i,a,u){try{var o=e[a](u),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,i)}function ot(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var a=e.apply(t,n);function u(e){ut(a,r,i,u,o,"next",e)}function o(e){ut(a,r,i,u,o,"throw",e)}u(void 0)}))}}function st(e,t,n){return t=pt(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,vt()?Reflect.construct(t,n||[],pt(e).constructor):t.apply(e,n))}function lt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ct(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,At(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ft(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Dt(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){o=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(o)throw a}}}}function dt(e,t,n){return(t=At(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(){return ht="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=pt(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},ht.apply(null,arguments)}function pt(e){return pt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},pt(e)}function mt(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&xt(e,t)}function vt(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(vt=function(){return!!e})()}function gt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gt(Object(n),!0).forEach((function(t){dt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function bt(){bt=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},a="function"==typeof Symbol?Symbol:{},u=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function c(e,t,n,r){var a=t&&t.prototype instanceof g?t:g,u=Object.create(a.prototype),o=new S(r||[]);return i(u,"_invoke",{value:D(e,n,o)}),u}function f(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=c;var d="suspendedStart",h="suspendedYield",p="executing",m="completed",v={};function g(){}function y(){}function b(){}var x={};l(x,u,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(O([])));k&&k!==n&&r.call(k,u)&&(x=k);var w=b.prototype=g.prototype=Object.create(x);function A(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,a,u,o){var s=f(e[i],e,a);if("throw"!==s.type){var l=s.arg,c=l.value;return c&&"object"==typeof c&&r.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,u,o)}),(function(e){n("throw",e,u,o)})):t.resolve(c).then((function(e){l.value=e,u(l)}),(function(e){return n("throw",e,u,o)}))}o(s.arg)}var a;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return a=a?a.then(i,i):i()}})}function D(t,n,r){var i=d;return function(a,u){if(i===p)throw Error("Generator is already running");if(i===m){if("throw"===a)throw u;return{value:e,done:!0}}for(r.method=a,r.arg=u;;){var o=r.delegate;if(o){var s=C(o,r);if(s){if(s===v)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var l=f(t,n,r);if("normal"===l.type){if(i=r.done?m:h,l.arg===v)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=m,r.method="throw",r.arg=l.arg)}}}function C(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,C(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var a=f(i,t.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,v;var u=a.arg;return u?u.done?(n[t.resultName]=u.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):u:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function F(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(F,this),this.reset(!0)}function O(t){if(t||""===t){var n=t[u];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return a.next=a}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=b,i(w,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},A(E.prototype),l(E.prototype,o,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,i,a){void 0===a&&(a=Promise);var u=new E(c(e,n,r,i),a);return t.isGeneratorFunction(n)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},A(w),l(w,s,"Generator"),l(w,u,(function(){return this})),l(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=O,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(M),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return o.type="throw",o.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var u=this.tryEntries[a],o=u.completion;if("root"===u.tryLoc)return i("end");if(u.tryLoc<=this.prev){var s=r.call(u,"catchLoc"),l=r.call(u,"finallyLoc");if(s&&l){if(this.prev<u.catchLoc)return i(u.catchLoc,!0);if(this.prev<u.finallyLoc)return i(u.finallyLoc)}else if(s){if(this.prev<u.catchLoc)return i(u.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return i(u.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var u=a?a.completion:{};return u.type=e,u.arg=t,a?(this.method="next",this.next=a.finallyLoc,v):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),v},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),M(n),v}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;M(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:O(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}},t}function xt(e,t){return xt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},xt(e,t)}function _t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,u,o=[],s=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(l)throw i}}return o}}(e,t)||Dt(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function kt(e,t,n,r){var i=ht(pt(e.prototype),t,n);return"function"==typeof i?function(e){return i.apply(n,e)}:i}function wt(e){return function(e){if(Array.isArray(e))return at(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Dt(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function At(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function Et(e){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Et(e)}function Dt(e,t){if(e){if("string"==typeof e)return at(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?at(e,t):void 0}}var Ct="year",Ft="quarter",Mt="month",St="week",Ot="date",Bt="day",Rt="dayofyear",zt="hours",Lt="minutes",Tt="seconds",qt="milliseconds",Nt=[Ct,Ft,Mt,St,Ot,Bt,Rt,zt,Lt,Tt,qt],Pt=Nt.reduce((function(e,t,n){return e[t]=1+n,e}),{});function jt(e){var t=he(e).slice(),n={};return t.length||D("Missing time unit."),t.forEach((function(e){Ce(Pt,e)?n[e]=1:D("Invalid time unit: ".concat(e,"."))})),(n[St]||n[Bt]?1:0)+(n[Ft]||n[Mt]||n[Ot]?1:0)+(n[Rt]?1:0)>1&&D("Incompatible time units: ".concat(e)),t.sort((function(e,t){return Pt[e]-Pt[t]})),t}var Ut=(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(Ye={},Ct,"%Y "),Ft,"Q%q "),Mt,"%b "),Ot,"%d "),St,"W%U "),Bt,"%a "),Rt,"%j "),zt,"%H:00"),Lt,"00:%M"),Tt,":%S"),dt(dt(dt(dt(Ye,qt,".%L"),"".concat(Ct,"-").concat(Mt),"%Y-%m "),"".concat(Ct,"-").concat(Mt,"-").concat(Ot),"%Y-%m-%d "),"".concat(zt,"-").concat(Lt),"%H:%M"));function It(e,t){var n,r,i=Ae({},Ut,t),a=jt(e),u=a.length,o="",s=0;for(s=0;s<u;)for(n=a.length;n>s;--n)if(null!=i[r=a.slice(s,n).join("-")]){o+=i[r],s=n;break}return o.trim()}var $t=new Date;function Wt(e){return $t.setFullYear(e),$t.setMonth(0),$t.setDate(1),$t.setHours(0,0,0,0),$t}function Gt(e){return Vt(new Date(e))}function Ht(e){return Yt(new Date(e))}function Vt(e){return a.timeDay.count(Wt(e.getFullYear())-1,e)}function Yt(e){return a.timeWeek.count(Wt(e.getFullYear())-1,e)}function Xt(e){return Wt(e).getDay()}function Jt(e,t,n,r,i,a,u){if(0<=e&&e<100){var o=new Date(-1,t,n,r,i,a,u);return o.setFullYear(e),o}return new Date(e,t,n,r,i,a,u)}function Qt(e){return Zt(new Date(e))}function Kt(e){return en(new Date(e))}function Zt(e){var t=Date.UTC(e.getUTCFullYear(),0,1);return a.utcDay.count(t-1,e)}function en(e){var t=Date.UTC(e.getUTCFullYear(),0,1);return a.utcWeek.count(t-1,e)}function tn(e){return $t.setTime(Date.UTC(e,0,1)),$t.getUTCDay()}function nn(e,t,n,r,i,a,u){if(0<=e&&e<100){var o=new Date(Date.UTC(-1,t,n,r,i,a,u));return o.setUTCFullYear(n.y),o}return new Date(Date.UTC(e,t,n,r,i,a,u))}function rn(e,t,n,r,i){var a=t||1,u=Y(e),o=function(e,t,i){return function(e,t,n,r){var i=n<=1?e:r?function(t,i){return r+n*Math.floor((e(t,i)-r)/n)}:function(t,r){return n*Math.floor(e(t,r)/n)};return t?function(e,n){return t(i(e,n),n)}:i}(n[i=i||e],r[i],e===u&&a,t)},s=new Date,l=nt(e),c=l[Ct]?o(Ct):ke(2012),f=l[Mt]?o(Mt):l[Ft]?o(Ft):O,d=l[St]&&l[Bt]?o(Bt,1,St+Bt):l[St]?o(St,1):l[Bt]?o(Bt,1):l[Ot]?o(Ot,1):l[Rt]?o(Rt,1):B,h=l[zt]?o(zt):O,p=l[Lt]?o(Lt):O,m=l[Tt]?o(Tt):O,v=l[qt]?o(qt):O;return function(e){s.setTime(+e);var t=c(s);return i(t,f(s),d(s,t),h(s),p(s),m(s),v(s))}}function an(e,t,n){return t+7*e-(n+6)%7}var un=(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(Xe={},Ct,(function(e){return e.getFullYear()})),Ft,(function(e){return Math.floor(e.getMonth()/3)})),Mt,(function(e){return e.getMonth()})),Ot,(function(e){return e.getDate()})),zt,(function(e){return e.getHours()})),Lt,(function(e){return e.getMinutes()})),Tt,(function(e){return e.getSeconds()})),qt,(function(e){return e.getMilliseconds()})),Rt,(function(e){return Vt(e)})),St,(function(e){return Yt(e)})),dt(dt(Xe,St+Bt,(function(e,t){return an(Yt(e),e.getDay(),Xt(t))})),Bt,(function(e,t){return an(1,e.getDay(),Xt(t))}))),on=dt(dt({},Ft,(function(e){return 3*e})),St,(function(e,t){return an(e,0,Xt(t))}));function sn(e,t){return rn(e,t||1,un,on,Jt)}var ln=(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(Je={},Ct,(function(e){return e.getUTCFullYear()})),Ft,(function(e){return Math.floor(e.getUTCMonth()/3)})),Mt,(function(e){return e.getUTCMonth()})),Ot,(function(e){return e.getUTCDate()})),zt,(function(e){return e.getUTCHours()})),Lt,(function(e){return e.getUTCMinutes()})),Tt,(function(e){return e.getUTCSeconds()})),qt,(function(e){return e.getUTCMilliseconds()})),Rt,(function(e){return Zt(e)})),St,(function(e){return en(e)})),dt(dt(Je,Bt,(function(e,t){return an(1,e.getUTCDay(),tn(t))})),St+Bt,(function(e,t){return an(en(e),e.getUTCDay(),tn(t))}))),cn=dt(dt({},Ft,(function(e){return 3*e})),St,(function(e,t){return an(e,0,tn(t))}));function fn(e,t){return rn(e,t||1,ln,cn,nn)}var dn=(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(Qe={},Ct,a.timeYear),Ft,a.timeMonth.every(3)),Mt,a.timeMonth),St,a.timeWeek),Ot,a.timeDay),Bt,a.timeDay),Rt,a.timeDay),zt,a.timeHour),Lt,a.timeMinute),Tt,a.timeSecond),dt(Qe,qt,a.timeMillisecond)),hn=(dt(dt(dt(dt(dt(dt(dt(dt(dt(dt(Ke={},Ct,a.utcYear),Ft,a.utcMonth.every(3)),Mt,a.utcMonth),St,a.utcWeek),Ot,a.utcDay),Bt,a.utcDay),Rt,a.utcDay),zt,a.utcHour),Lt,a.utcMinute),Tt,a.utcSecond),dt(Ke,qt,a.utcMillisecond));function pn(e){return dn[e]}function mn(e){return hn[e]}function vn(e,t,n){return e?e.offset(t,n):void 0}function gn(e,t,n){return vn(pn(e),t,n)}function yn(e,t,n){return vn(mn(e),t,n)}function bn(e,t,n,r){return e?e.range(t,n,r):void 0}function xn(e,t,n,r){return bn(pn(e),t,n,r)}function _n(e,t,n,r){return bn(mn(e),t,n,r)}var kn,wn,An=1e3,En=6e4,Dn=36e5,Cn=864e5,Fn=2592e6,Mn=31536e6,Sn=[Ct,Mt,Ot,zt,Lt,Tt,qt],On=Sn.slice(0,-1),Bn=On.slice(0,-1),Rn=Bn.slice(0,-1),zn=Rn.slice(0,-1),Ln=[Ct,Mt],Tn=[Ct],qn=[[On,1,An],[On,5,5e3],[On,15,15e3],[On,30,3e4],[Bn,1,En],[Bn,5,3e5],[Bn,15,9e5],[Bn,30,18e5],[Rn,1,Dn],[Rn,3,108e5],[Rn,6,216e5],[Rn,12,432e5],[zn,1,Cn],[[Ct,St],1,6048e5],[Ln,1,Fn],[Ln,3,7776e6],[Tn,1,Mn]];function Nn(e){var t,n,i=e.extent,a=e.maxbins||40,u=Math.abs(Ge(i))/a,o=r.bisector((function(e){return e[2]})).right(qn,u);return o===qn.length?(t=Tn,n=r.tickStep(i[0]/Mn,i[1]/Mn,a)):o?(t=(o=qn[u/qn[o-1][2]<qn[o][2]/u?o-1:o])[0],n=o[1]):(t=Sn,n=Math.max(r.tickStep(i[0],i[1],a),1)),{units:t,step:n}}function Pn(e){var t={};return function(n){return t[n]||(t[n]=e(n))}}function jn(e){var t=Pn(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat:function(e){var n,r,a=i.formatSpecifier(e||",");if(null==a.precision){switch(a.precision=12,a.type){case"%":a.precision-=2;break;case"e":a.precision-=1}return n=t(a),r=t(".1f")(1)[1],function(e){var t=n(e),i=t.indexOf(r);if(i<0)return t;for(var a=function(e,t){var n,r=e.lastIndexOf("e");if(r>0)return r;for(r=e.length;--r>t;)if((n=e.charCodeAt(r))>=48&&n<=57)return r+1}(t,i),u=a<t.length?t.slice(a):"";--a>i;)if("0"!==t[a]){++a;break}return t.slice(0,a)+u}}return t(a)},formatSpan:function(e,a,u,o){o=i.formatSpecifier(null==o?",f":o);var s,l=r.tickStep(e,a,u),c=Math.max(Math.abs(e),Math.abs(a));if(null==o.precision)switch(o.type){case"s":return isNaN(s=i.precisionPrefix(l,c))||(o.precision=s),n(o,c);case"":case"e":case"g":case"p":case"r":isNaN(s=i.precisionRound(l,c))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=i.precisionFixed(l))||(o.precision=s-2*("%"===o.type))}return t(o)}}}function Un(){return kn=jn({format:i.format,formatPrefix:i.formatPrefix})}function In(e){return jn(i.formatLocale(e))}function $n(e){return arguments.length?kn=In(e):kn}function Wn(e,t,n){$(n=n||{})||D("Invalid time multi-format specifier: ".concat(n));var r=t(Tt),i=t(Lt),a=t(zt),u=t(Ot),o=t(St),s=t(Mt),l=t(Ft),c=t(Ct),f=e(n[qt]||".%L"),d=e(n[Tt]||":%S"),h=e(n[Lt]||"%I:%M"),p=e(n[zt]||"%I %p"),m=e(n[Ot]||n[Bt]||"%a %d"),v=e(n[St]||"%b %d"),g=e(n[Mt]||"%B"),y=e(n[Ft]||"%B"),b=e(n[Ct]||"%Y");return function(e){return(r(e)<e?f:i(e)<e?d:a(e)<e?h:u(e)<e?p:s(e)<e?o(e)<e?m:v:c(e)<e?l(e)<e?g:y:b)(e)}}function Gn(e){var t=Pn(e.format),n=Pn(e.utcFormat);return{timeFormat:function(e){return Ne(e)?t(e):Wn(t,pn,e)},utcFormat:function(e){return Ne(e)?n(e):Wn(n,mn,e)},timeParse:Pn(e.parse),utcParse:Pn(e.utcParse)}}function Hn(){return wn=Gn({format:u.timeFormat,parse:u.timeParse,utcFormat:u.utcFormat,utcParse:u.utcParse})}function Vn(e){return Gn(u.timeFormatLocale(e))}function Yn(e){return arguments.length?wn=Vn(e):wn}Un(),Hn();var Xn=function(e,t){return Ae({},e,t)};function Jn(e,t){var n=e?In(e):$n(),r=t?Vn(t):Yn();return Xn(n,r)}function Qn(e,t){var n=arguments.length;return n&&2!==n&&D("defaultLocale expects either zero or two arguments."),n?Xn($n(e),Yn(t)):Xn($n(),Yn())}var Kn=/^(data:|([A-Za-z]+:)?\/\/)/,Zn=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,er=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,tr="file://";function nr(e,t){return rr.apply(this,arguments)}function rr(){return(rr=ot(bt().mark((function e(t,n){var r,i;return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sanitize(t,n);case 2:return r=e.sent,i=r.href,e.abrupt("return",r.localFile?this.file(i):this.http(i,n));case 5:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function ir(e,t){return ar.apply(this,arguments)}function ar(){return(ar=ot(bt().mark((function e(t,n){var r,i,a,u,o,s,l;return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Ae({},this.options,n),r=this.fileAccess,i={href:null},s=Zn.test(t.replace(er,"")),null!=t&&"string"==typeof t&&s||D("Sanitize failure, invalid URI: "+He(t)),l=Kn.test(t),(o=n.baseURL)&&!l&&(t.startsWith("/")||o.endsWith("/")||(t="/"+t),t=o+t),u=(a=t.startsWith(tr))||"file"===n.mode||"http"!==n.mode&&!l&&r,a?t=t.slice(tr.length):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),u=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(i,"localFile",{value:!!u}),i.href=t,n.target&&(i.target=n.target+""),n.rel&&(i.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(i.crossOrigin=n.crossOrigin+""),e.abrupt("return",i);case 14:case"end":return e.stop()}}),e,this)})))).apply(this,arguments)}function ur(e){return e?function(t){return new Promise((function(n,r){e.readFile(t,(function(e,t){e?r(e):n(t)}))}))}:or}function or(){return sr.apply(this,arguments)}function sr(){return(sr=ot(bt().mark((function e(){return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:D("No file system access.");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function lr(e){return e?function(){var t=ot(bt().mark((function t(n,r){var i,a,u;return bt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=Ae({},this.options.http,r),a=r&&r.response,t.next=4,e(n,i);case 4:return u=t.sent,t.abrupt("return",u.ok?me(u[a])?u[a]():u.text():D(u.status+""+u.statusText));case 6:case"end":return t.stop()}}),t,this)})));return function(e,n){return t.apply(this,arguments)}}():cr}function cr(){return fr.apply(this,arguments)}function fr(){return(fr=ot(bt().mark((function e(){return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:D("No HTTP fetch method available.");case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var dr=function(e){return null!=e&&e==e},hr=function(e){return!(Number.isNaN(+e)||e instanceof Date)},pr={boolean:Ve,integer:X,number:X,date:et,string:tt,unknown:S},mr=[function(e){return"true"===e||"false"===e||!0===e||!1===e},function(e){return hr(e)&&Number.isInteger(+e)},hr,function(e){return!Number.isNaN(Date.parse(e))}],vr=["boolean","integer","number","date"];function gr(e,t){if(!e||!e.length)return"unknown";for(var n,r,i=e.length,a=mr.length,u=mr.map((function(e,t){return t+1})),o=0,s=0;o<i;++o)for(r=t?e[o][t]:e[o],n=0;n<a;++n)if(u[n]&&dr(r)&&!mr[n](r)&&(u[n]=0,++s===mr.length))return"string";return vr[u.reduce((function(e,t){return 0===e?t:e}),0)-1]}function yr(e,t){return t.reduce((function(t,n){return t[n]=gr(e,n),t}),{})}function br(e){var t=function(t,n){var r={delimiter:e};return xr(t,n?Ae(n,r):r)};return t.responseType="text",t}function xr(e,n){return n.header&&(e=n.header.map(He).join(n.delimiter)+"\n"+e),t.dsvFormat(n.delimiter).parse(e+"")}function _r(e,t){var n,r=t&&t.property?F(t.property):S;return!$(e)||(n=e,"function"==typeof Buffer&&me(Buffer.isBuffer)&&Buffer.isBuffer(n))?r(JSON.parse(e)):function(e,t){!I(e)&&Le(e)&&(e=wt(e));return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(r(e),t)}xr.responseType="text",_r.responseType="json";var kr={interior:function(e,t){return e!==t},exterior:function(e,t){return e===t}};function wr(e,t){var r,i,a,u;return e=_r(e,t),t&&t.feature?(r=n.feature,a=t.feature):t&&t.mesh?(r=n.mesh,a=t.mesh,u=kr[t.filter]):D("Missing TopoJSON feature or mesh parameter."),(i=(i=e.objects[a])?r(e,i,u):D("Invalid TopoJSON object: "+a))&&i.features||[i]}wr.responseType="json";var Ar={dsv:xr,csv:br(","),tsv:br("\t"),json:_r,topojson:wr};function Er(e,t){return arguments.length>1?(Ar[e]=t,this):Ce(Ar,e)?Ar[e]:null}function Dr(e){var t=Er(e);return t&&t.responseType||"text"}function Cr(e,t,n,r){var i=Er((t=t||{}).type||"json");return i||D("Unknown data format type: "+t.type),e=i(e,t),t.parse&&function(e,t,n,r){if(!e.length)return;var i=Yn();n=n||i.timeParse,r=r||i.utcParse;var a,u,o,s,l,c,f=e.columns||Object.keys(e[0]);"auto"===t&&(t=yr(e,f));var d=(f=Object.keys(t)).map((function(e){var i,a,u=t[e];if(u&&(u.startsWith("date:")||u.startsWith("utc:")))return("'"===(a=(i=u.split(/:(.+)?/,2))[1])[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===i[0]?r:n)(a);if(!pr[u])throw Error("Illegal format pattern: "+e+":"+u);return pr[u]}));for(o=0,l=e.length,c=f.length;o<l;++o)for(a=e[o],s=0;s<c;++s)a[u=f[s]]=d[s](a[u])}(e,t.parse,n,r),Ce(e,"columns")&&delete e.columns,e}var Fr=function(e,t){return function(n){return{options:n||{},sanitize:ir,load:nr,fileAccess:!1,file:ur(t),http:lr(e)}}}("undefined"!=typeof fetch&&fetch,null);function Mr(e){var t=e||S,n=[],r={};return n.add=function(e){var i=t(e);return r[i]||(r[i]=1,n.push(e)),n},n.remove=function(e){var i=t(e);if(r[i]){r[i]=0;var a=n.indexOf(e);a>=0&&n.splice(a,1)}return n},n}function Sr(e,t){return Or.apply(this,arguments)}function Or(){return(Or=ot(bt().mark((function e(t,n){return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n(t);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),t.error(e.t0);case 8:case"end":return e.stop()}}),e,null,[[0,5]])})))).apply(this,arguments)}var Br=Symbol("vega_id"),Rr=1;function zr(e){return!(!e||!Lr(e))}function Lr(e){return e[Br]}function Tr(e,t){return e[Br]=t,e}function qr(e){var t=e===Object(e)?e:{data:e};return Lr(t)?t:Tr(t,Rr++)}function Nr(e){return Pr(e,qr({}))}function Pr(e,t){for(var n in e)t[n]=e[n];return t}function jr(e,t){return Tr(t,Lr(e))}function Ur(e,t){return e?t?function(n,r){return e(n,r)||Lr(t(n))-Lr(t(r))}:function(t,n){return e(t,n)||Lr(t)-Lr(n)}:null}function Ir(e){return e&&e.constructor===$r}function $r(){var e=[],t=[],n=[],r=[],i=[],a=null,u=!1;return{constructor:$r,insert:function(t){for(var n=he(t),r=n.length,i=0;i<r;++i)e.push(n[i]);return this},remove:function(e){for(var n=me(e)?r:t,i=he(e),a=i.length,u=0;u<a;++u)n.push(i[u]);return this},modify:function(e,t,r){var a={field:t,value:ke(r)};return me(e)?(a.filter=e,i.push(a)):(a.tuple=e,n.push(a)),this},encode:function(e,t){return me(e)?i.push({filter:e,field:t}):n.push({tuple:e,field:t}),this},clean:function(e){return a=e,this},reflow:function(){return u=!0,this},pulse:function(o,s){var l,c,f,d,h,p,m={},v={};for(l=0,c=s.length;l<c;++l)m[Lr(s[l])]=1;for(l=0,c=t.length;l<c;++l)m[Lr(h=t[l])]=-1;for(l=0,c=r.length;l<c;++l)d=r[l],s.forEach((function(e){d(e)&&(m[Lr(e)]=-1)}));for(l=0,c=e.length;l<c;++l)p=Lr(h=e[l]),m[p]?m[p]=1:o.add.push(qr(e[l]));for(l=0,c=s.length;l<c;++l)h=s[l],m[Lr(h)]<0&&o.rem.push(h);function g(e,t,n){n?e[t]=n(e):o.encode=t,u||(v[Lr(e)]=e)}for(l=0,c=n.length;l<c;++l)h=(f=n[l]).tuple,d=f.field,(p=m[Lr(h)])>0&&(g(h,d,f.value),o.modifies(d));for(l=0,c=i.length;l<c;++l)f=i[l],d=f.filter,s.forEach((function(e){d(e)&&m[Lr(e)]>0&&g(e,f.field,f.value)})),o.modifies(f.field);if(u)o.mod=t.length||r.length?s.filter((function(e){return m[Lr(e)]>0})):s.slice();else for(p in v)o.mod.push(v[p]);return(a||null==a&&(t.length||r.length))&&o.clean(!0),o}}}var Wr="_:mod:_";function Gr(){Object.defineProperty(this,Wr,{writable:!0,value:{}})}Gr.prototype={set:function(e,t,n,r){var i=this,a=i[e],u=i[Wr];return null!=t&&t>=0?(a[t]!==n||r)&&(a[t]=n,u[t+":"+e]=-1,u[e]=-1):(a!==n||r)&&(i[e]=n,u[e]=I(n)?1+n.length:-1),i},modified:function(e,t){var n=this[Wr];if(!arguments.length){for(var r in n)if(n[r])return!0;return!1}if(I(e)){for(var i=0;i<e.length;++i)if(n[e[i]])return!0;return!1}return null!=t&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear:function(){return this[Wr]={},this}};var Hr=0,Vr=new Gr;function Yr(e,t,n,r){this.id=++Hr,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,r)}function Xr(e){return function(t){var n=this.flags;return 0===arguments.length?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Yr.prototype={targets:function(){return this._targets||(this._targets=Mr(M))},set:function(e){return this.value!==e?(this.value=e,1):0},skip:Xr(1),modified:Xr(2),parameters:function(e,t,n){var r=this;t=!1!==t;var i,a,u,o,s=this._argval=this._argval||new Gr,l=this._argops=this._argops||[],c=[],f=function(e,n,i){i instanceof Yr?(i!==r&&(t&&i.targets().add(r),c.push(i)),l.push({op:i,name:e,index:n})):s.set(e,n,i)};for(i in e)if(a=e[i],"pulse"===i)he(a).forEach((function(e){e instanceof Yr?e!==r&&(e.targets().add(r),c.push(e)):D("Pulse parameters must be operator instances.")})),this.source=a;else if(I(a))for(s.set(i,-1,Array(u=a.length)),o=0;o<u;++o)f(i,o,a[o]);else f(i,-1,a);return this.marshall().clear(),n&&(l.initonly=!0),c},marshall:function(e){var t,n,r,i,a=this._argval||Vr,u=this._argops;if(u){var o=u.length;for(n=0;n<o;++n)i=(r=(t=u[n]).op).modified()&&r.stamp===e,a.set(t.name,t.index,r.value,i);if(u.initonly){for(n=0;n<o;++n)(t=u[n]).op.targets().remove(this);this._argops=null,this._update=null}}return a},detach:function(){var e,t,n,r=this._argops;if(r)for(e=0,t=r.length;e<t;++e)(n=r[e].op)._targets&&n._targets.remove(this);this.pulse=null,this.source=null},evaluate:function(e){var t=this._update;if(t){var n=this.marshall(e.stamp),r=t.call(this,n,e);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return e.StopPropagation}},run:function(e){return e.stamp<this.stamp?e.StopPropagation:(this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e);var t}};var Jr=0;function Qr(e,t,n){this.id=++Jr,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Kr(e,t,n){return new Qr(e,t,n)}function Zr(){return Zr=ot(bt().mark((function e(t,n){var r,i,a;return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this,i=0,e.prev=2,e.next=5,r.loader().load(t,{context:"dataflow",response:Dr(n&&n.type)});case 5:a=e.sent;try{a=r.parse(a,n)}catch(e){i=-2,r.warn("Data ingestion failed",t,e)}e.next=13;break;case 9:e.prev=9,e.t0=e.catch(2),i=-1,r.warn("Loading failed",t,e.t0);case 13:return e.abrupt("return",{data:a,status:i});case 14:case"end":return e.stop()}}),e,this,[[2,9]])}))),Zr.apply(this,arguments)}function ei(){return ei=ot(bt().mark((function e(t,n,r){var i,a,u;return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(a=(i=this)._pending||ti(i)).requests+=1,e.next=4,i.request(n,r);case 4:return u=e.sent,i.pulse(t,i.changeset().remove(R).insert(u.data||[])),a.done(),e.abrupt("return",u);case 8:case"end":return e.stop()}}),e,this)}))),ei.apply(this,arguments)}function ti(e){var t,n=new Promise((function(e){return t=e}));return n.requests=0,n.done=function(){0==--n.requests&&(e._pending=null,t(e))},e._pending=n}Qr.prototype={_filter:R,_apply:S,targets:function(){return this._targets||(this._targets=Mr(M))},consume:function(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive:function(e){if(this._filter(e)){for(var t=this.value=this._apply(e),n=this._targets,r=n?n.length:0,i=0;i<r;++i)n[i].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter:function(e){var t=Kr(e);return this.targets().add(t),t},apply:function(e){var t=Kr(null,e);return this.targets().add(t),t},merge:function(){var e=Kr();this.targets().add(e);for(var t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle:function(e){var t=-1;return this.filter((function(){var n=Date.now();return n-t>e?(t=n,1):0}))},debounce:function(e){var t=Kr();return this.targets().add(Kr(null,null,we(e,(function(e){var n=e.dataflow;t.receive(e),n&&n.run&&n.run()})))),t},between:function(e,t){var n=!1;return e.targets().add(Kr(null,null,(function(){return n=!0}))),t.targets().add(Kr(null,null,(function(){return n=!1}))),this.filter((function(){return n}))},detach:function(){this._filter=R,this._targets=null}};var ni={skip:!0};function ri(e,t,n,r,i,a){var u,o,s=Ae({},a,ni);me(n)||(n=ke(n)),void 0===r?u=function(t){return e.touch(n(t))}:me(r)?(o=new Yr(null,r,i,!1),u=function(t){o.evaluate(t);var r=n(t),i=o.value;Ir(i)?e.pulse(r,i,a):e.update(r,i,s)}):u=function(t){return e.update(n(t),r,s)},t.apply(u)}function ii(e,t,n,r,i,a){if(void 0===r)t.targets().add(n);else{var u=a||{},o=new Yr(null,function(e,t){return t=me(t)?t:ke(t),e?function(n,r){var i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}(n,r),i,!1);o.modified(u.force),o.rank=t.rank,t.targets().add(o),n&&(o.skip(!0),o.value=n.value,o.targets().add(n),e.connect(n,[o]))}}var ai={};function ui(e,t,n){this.dataflow=e,this.stamp=null==t?-1:t,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function oi(e,t){var n=[];return it(e,t,(function(e){return n.push(e)})),n}function si(e,t){var n={};return e.visit(t,(function(e){n[Lr(e)]=1})),function(e){return n[Lr(e)]?null:e}}function li(e,t){return e?function(n,r){return e(n,r)&&t(n,r)}:t}function ci(e,t,n,r){var i=this,a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;var u,o=ft(n);try{for(o.s();!(u=o.n()).done;){var s=u.value;if(s.stamp===t){if(s.fields){var l=i.fields||(i.fields={});for(var c in s.fields)l[c]=1}s.changed(i.ADD)&&(a|=i.ADD),s.changed(i.REM)&&(a|=i.REM),s.changed(i.MOD)&&(a|=i.MOD)}}}catch(e){o.e(e)}finally{o.f()}this.changes=a}function fi(){return fi=ot(bt().mark((function e(t,n,r){var i,a,u,o,s,l,c,f,d;return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=[],!(i=this)._pulse){e.next=3;break}return e.abrupt("return",hi(i));case 3:if(!i._pending){e.next=6;break}return e.next=6,i._pending;case 6:if(!n){e.next=9;break}return e.next=9,Sr(i,n);case 9:if(i._touched.length){e.next=12;break}return i.debug("Dataflow invoked, but nothing to do."),e.abrupt("return",i);case 12:u=++i._clock,i._pulse=new ui(i,u,t),i._touched.forEach((function(e){return i._enqueue(e,!0)})),i._touched=Mr(M),o=0,e.prev=17;case 18:if(!(i._heap.size()>0)){e.next=35;break}if((s=i._heap.pop()).rank===s.qrank){e.next=23;break}return i._enqueue(s,!0),e.abrupt("continue",18);case 23:if(!(l=s.run(i._getPulse(s,t))).then){e.next=30;break}return e.next=27,l;case 27:l=e.sent,e.next=31;break;case 30:l.async&&(a.push(l.async),l=ai);case 31:l!==ai&&s._targets&&s._targets.forEach((function(e){return i._enqueue(e)})),++o,e.next=18;break;case 35:e.next=41;break;case 37:e.prev=37,e.t0=e.catch(17),i._heap.clear(),c=e.t0;case 41:if(i._input={},i._pulse=null,i.debug("Pulse ".concat(u,": ").concat(o," operators")),c&&(i._postrun=[],i.error(c)),!i._postrun.length){e.next=55;break}f=i._postrun.sort((function(e,t){return t.priority-e.priority})),i._postrun=[],d=0;case 49:if(!(d<f.length)){e.next=55;break}return e.next=52,Sr(i,f[d].callback);case 52:++d,e.next=49;break;case 55:if(!r){e.next=58;break}return e.next=58,Sr(i,r);case 58:return a.length&&Promise.all(a).then((function(e){return i.runAsync(null,(function(){e.forEach((function(e){try{e(i)}catch(e){i.error(e)}}))}))})),e.abrupt("return",i);case 60:case"end":return e.stop()}}),e,this,[[17,37]])}))),fi.apply(this,arguments)}function di(){return di=ot(bt().mark((function e(t,n,r){var i,a=this;return bt().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._running){e.next=5;break}return e.next=3,this._running;case 3:e.next=0;break;case 5:return i=function(){return a._running=null},(this._running=this.evaluate(t,n,r)).then(i,i),e.abrupt("return",this._running);case 8:case"end":return e.stop()}}),e,this)}))),di.apply(this,arguments)}function hi(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}ui.prototype={StopPropagation:ai,ADD:1,REM:2,MOD:4,ADD_REM:3,ADD_MOD:5,ALL:7,REFLOW:8,SOURCE:16,NO_SOURCE:32,NO_FIELDS:64,fork:function(e){return new ui(this.dataflow).init(this,e)},clone:function(){var e=this.fork(7);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(23)},addAll:function(){var e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||((e=new ui(this.dataflow).init(this)).add=e.source,e.rem=[]),e},init:function(e,t){var n=this;return n.stamp=e.stamp,n.encode=e.encode,!e.fields||64&t||(n.fields=e.fields),1&t?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),2&t?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),4&t?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),32&t?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter:function(e){this.dataflow.runAfter(e)},changed:function(e){var t=e||7;return 1&t&&this.add.length||2&t&&this.rem.length||4&t&&this.mod.length},reflow:function(e){if(e)return this.fork(7).reflow();var t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(4,si(this,1))),this},clean:function(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies:function(e){var t=this.fields||(this.fields={});return I(e)?e.forEach((function(e){return t[e]=!0})):t[e]=!0,this},modified:function(e,t){var n=this.fields;return!(!t&&!this.mod.length||!n)&&(arguments.length?I(e)?e.some((function(e){return n[e]})):n[e]:!!n)},filter:function(e,t){var n=this;return 1&e&&(n.addF=li(n.addF,t)),2&e&&(n.remF=li(n.remF,t)),4&e&&(n.modF=li(n.modF,t)),16&e&&(n.srcF=li(n.srcF,t)),n},materialize:function(e){var t=this;return 1&(e=e||7)&&t.addF&&(t.add=oi(t.add,t.addF),t.addF=null),2&e&&t.remF&&(t.rem=oi(t.rem,t.remF),t.remF=null),4&e&&t.modF&&(t.mod=oi(t.mod,t.modF),t.modF=null),16&e&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit:function(e,t){var n=this,r=t;if(16&e)return it(n.source,n.srcF,r),n;1&e&&it(n.add,n.addF,r),2&e&&it(n.rem,n.remF,r),4&e&&it(n.mod,n.modF,r);var i=n.source;if(8&e&&i){var a=n.add.length+n.mod.length;a===i.length||it(i,a?si(n,5):n.srcF,r)}return n}},Oe(ci,ui,{fork:function(e){var t=new ui(this.dataflow).init(this,e&this.NO_FIELDS);return void 0!==e&&(e&t.ADD&&this.visit(t.ADD,(function(e){return t.add.push(e)})),e&t.REM&&this.visit(t.REM,(function(e){return t.rem.push(e)})),e&t.MOD&&this.visit(t.MOD,(function(e){return t.mod.push(e)}))),t},changed:function(e){return this.changes&e},modified:function(e){var t=this,n=t.fields;return n&&t.changes&t.MOD?I(e)?e.some((function(e){return n[e]})):n[e]:0},filter:function(){D("MultiPulse does not support filtering.")},materialize:function(){D("MultiPulse does not support materialization.")},visit:function(e,t){var n=this,r=n.pulses,i=r.length,a=0;if(e&n.SOURCE)for(;a<i;++a)r[a].visit(e,t);else for(;a<i;++a)r[a].stamp===n.stamp&&r[a].visit(e,t);return n}});var pi={skip:!1,force:!1};function mi(e){var t=[];return{clear:function(){return t=[]},size:function(){return t.length},peek:function(){return t[0]},push:function(n){return t.push(n),vi(t,0,t.length-1,e)},pop:function(){var n,r=t.pop();return t.length?(n=t[0],t[0]=r,function(e,t,n){var r,i=t,a=e.length,u=e[t],o=1+(t<<1);for(;o<a;)(r=o+1)<a&&n(e[o],e[r])>=0&&(o=r),e[t]=e[o],o=1+((t=o)<<1);e[t]=u,vi(e,i,t,n)}(t,0,e)):n=r,n}}}function vi(e,t,n,r){for(var i,a,u=e[n];n>t&&r(u,i=e[a=n-1>>1])<0;)e[n]=i,n=a;return e[n]=u}function gi(){this.logger(U()),this.logLevel(q),this._clock=0,this._rank=0,this._locale=Qn();try{this._loader=Fr()}catch(e){}this._touched=Mr(M),this._input={},this._pulse=null,this._heap=mi((function(e,t){return e.qrank-t.qrank})),this._postrun=[]}function yi(e){return function(){return this._log[e].apply(this,arguments)}}function bi(e,t){Yr.call(this,e,null,t)}gi.prototype={stamp:function(){return this._clock},loader:function(e){return arguments.length?(this._loader=e,this):this._loader},locale:function(e){return arguments.length?(this._locale=e,this):this._locale},logger:function(e){return arguments.length?(this._log=e,this):this._log},error:yi("error"),warn:yi("warn"),info:yi("info"),debug:yi("debug"),logLevel:yi("level"),cleanThreshold:1e4,add:function(e,t,n,r){var i,a=1;return e instanceof Yr?i=e:e&&e.prototype instanceo