Route stops: a rendered Vega-Lite specification and source table
HTML for this example
Select the code and use your copy shortcut. Changes in this preview are temporary.
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Route stops</title><style>*{box-sizing:border-box}body{margin:24px auto;max-width:800px;padding:0 16px;font:16px/1.55 system-ui,sans-serif;color:#202834;background:#fff}h1{font-size:clamp(24px,4vw,34px);line-height:1.2}h2{font-size:20px}p{max-width:70ch}label{font-weight:600}select,button,textarea{font:inherit;padding:9px;border:1px solid #9ca7b5;border-radius:4px}button{cursor:pointer;background:#f1f4f8}button:disabled{cursor:default;color:#72777e}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:8px;border-bottom:1px solid #d7dee7}caption{text-align:left;font-weight:600}pre{white-space:pre-wrap;overflow-wrap:anywhere}a{color:#245da4}small{color:#5d6570}.reading{border-left:4px solid #3764a0;padding-left:16px}.table-wrap{overflow:auto}</style></head><body><h1>Route stops</h1><p class="reading"><strong>40 stops across three routes</strong></p><p>Fictional example · completed stops in this prepared dataset.</p><div id="chart" style="width:100%"></div><table><caption>Source counts</caption><thead><tr><th scope="col">Route</th><th scope="col">Stops</th></tr></thead><tbody><tr><th scope="row">North</th><td>14</td></tr><tr><th scope="row">East</th><td>9</td></tr><tr><th scope="row">West</th><td>17</td></tr></tbody></table><script>!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).vega={})}(this,(function(t){"use strict";function e(t,e,n){return Object.assign(t,{fields:e||[],fname:n})}function n(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){return 1===t.length?o(t[0]):a(t)}const o=t=>function(e){return e[t]},a=t=>{const e=t.length;return function(n){for(let r=0;r<e;++r)n=n[t[r]];return n}};function s(t){throw Error(t)}function u(t){const e=[],n=t.length;let r,i,o,a=null,u=0,l="";function c(){e.push(l+t.substring(r,i)),l="",r=i+1}for(t+="",r=i=0;i<n;++i)if(o=t[i],"\\"===o)l+=t.substring(r,i++),r=i;else if(o===a)c(),a=null,u=-1;else{if(a)continue;r===u&&'"'===o||r===u&&"'"===o?(r=i+1,a=o):"."!==o||u?"["===o?(i>r&&c(),u=r=i+1):"]"===o&&(u||s("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&s("Access path missing closing bracket: "+t),a&&s("Access path missing closing quote: "+t),i>r&&(i++,c()),e}function l(t,n,r){const o=u(t),a=1===o.length?o[0]:t;return e((r&&r.get||i)(o),[a],n||a)}const c=l("id"),f=e((t=>t),[],"identity"),h=e((()=>0),[],"zero"),d=e((()=>1),[],"one"),p=e((()=>!0),[],"true"),g=e((()=>!1),[],"false"),m=new Set([...Object.getOwnPropertyNames(Object.prototype).filter((t=>"function"==typeof Object.prototype[t])),"__proto__","then"]);function y(t,e,n){const r=[e,...n];console[t](...r)}function v(t,e,n=y){let r=t||0;return{level(t){return arguments.length?(r=+t,this):r},error(...t){return r>=1&&n(e||"error","ERROR",t),this},warn(...t){return r>=2&&n(e||"warn","WARN",t),this},info(...t){return r>=3&&n(e||"log","INFO",t),this},debug(...t){return r>=4&&n(e||"log","DEBUG",t),this}}}const _=Array.isArray;function x(t){return t===Object(t)}const b=t=>"__proto__"!==t&&"constructor"!==t&&"prototype"!==t;function w(...t){return t.reduce(((t,e)=>{for(const n in e)if("signals"===n)t.signals=k(t.signals,e.signals);else{const r="legend"===n?{layout:1}:"style"===n||null;M(t,n,e[n],r)}return t}),{})}function M(t,e,n,r){if(!b(e))return;const i=t;let o,a;if(x(n)&&!_(n)){const t=n;for(o in a=x(i[e])?i[e]:i[e]={},t)r&&(!0===r||r[o])?M(a,o,t[o]):b(o)&&(a[o]=t[o])}else i[e]=n}function k(t,e){if(null==t)return e;if(null==e)return t;const n={},r=[];function i(t){n[t.name]||(n[t.name]=1,r.push(t))}return e.forEach(i),t.forEach(i),r}function A(t){return t[t.length-1]}function E(t){return null==t||""===t?null:+t}function D(t){return t.length>0}const C=t=>e=>t*Math.exp(e),F=t=>e=>Math.log(t*e),S=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),T=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t,$=t=>e=>e<0?-Math.pow(-e,t):Math.pow(e,t),z=t=>E(t)??0,B=t=>t;function O(t,e,n,r){D(t)||s("Domain array must not be empty");const i=n(t[0]),o=n(A(t)),a=(o-i)*e;return[r(i-a),r(o-a)]}function N(t,e){return O(t,e,z,B)}function R(t,e){const n=Math.sign(t[0]);return O(t,e,F(n),C(n))}function U(t,e,n){return O(t,e,$(n),$(1/n))}function L(t,e,n){return O(t,e,S(n),T(n))}function q(t,e,n,r,i){D(t)||s("Domain array must not be empty");const o=r(t[0]),a=r(A(t)),u=null!=e?r(e):(o+a)/2;return[i(u+(o-u)*n),i(u+(a-u)*n)]}function P(t,e,n){return q(t,e,n,z,B)}function j(t,e,n){const r=Math.sign(t[0]);return q(t,e,n,F(r),C(r))}function I(t,e,n,r){return q(t,e,n,$(r),$(1/r))}function W(t,e,n,r){return q(t,e,n,S(r),T(r))}function H(t){return 1+~~(new Date(t).getMonth()/3)}function Y(t){return 1+~~(new Date(t).getUTCMonth()/3)}function G(t){return null!=t?_(t)?t:[t]:[]}function V(t,e,n){let r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),r=o-i,r>=n-e?[e,n]:[i=Math.min(Math.max(i,e),n-r),i+r]}function X(t){return"function"==typeof t}function J(t,n,i){const o=i||{},a=G(n)||[],s=[],u=[],c={},f=o.comparator||Q;return G(t).forEach(((t,e)=>{if(null==t)return;s.push("descending"===a[e]?-1:1);const n=X(t)?t:l(t,void 0,o);u.push(n),(r(n)||[]).forEach((t=>c[t]=1))})),0===u.length?null:e(f(u,s),Object.keys(c))}const Z=(t,e)=>{let n=t,r=e;return(n<r||null==n)&&null!=r?-1:(n>r||null==r)&&null!=n?1:(r=r instanceof Date?+r:r,(n=n instanceof Date?+n:n)!==n&&r==r?-1:r!=r&&n==n?1:0)},Q=(t,e)=>1===t.length?K(t[0],e[0]):tt(t,e,t.length),K=(t,e)=>function(n,r){return Z(t(n),t(r))*e},tt=(t,e,n)=>(e.push(0),function(r,i){let o,a=0,s=-1;for(;0===a&&++s<n;)o=t[s],a=Z(o(r),o(i));return a*e[s]});function et(t){return X(t)?t:()=>t}function nt(t,e){let n=null;return r=>{n&&clearTimeout(n),n=setTimeout((()=>(e(r),n=null)),t)}}function rt(t,...e){for(const n of e)for(const e in n)t[e]=n[e];return t}function it(t,e){let n,r,i,o,a=0;if(t&&(n=t.length))if(null==e){for(r=t[a];a<n&&(null==r||r!=r);r=t[++a]);for(i=o=r;a<n;++a)r=t[a],null!=r&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=e(t[a]);a<n&&(null==r||r!=r);r=e(t[++a]));for(i=o=r;a<n;++a)r=e(t[a]),null!=r&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]}function ot(t,e){const n=t.length;let r,i,o,a,s,u=-1;if(null==e){for(;++u<n;)if(a=t[u],null!=a&&a>=a){o=s=a;break}if(u===n)return[-1,-1];for(r=i=u;++u<n;)a=t[u],null!=a&&(o>a&&(o=a,r=u),s<a&&(s=a,i=u))}else{for(;++u<n;)if(a=e(t[u],u,t),null!=a&&a>=a){o=s=a;break}if(u===n)return[-1,-1];for(r=i=u;++u<n;)a=e(t[u],u,t),null!=a&&(o>a&&(o=a,r=u),s<a&&(s=a,i=u))}return[r,i]}function at(t,e){return Object.hasOwn(t,e)}const st={};function ut(t){let e,n={};function r(t){return at(n,t)&&n[t]!==st}const i={size:0,empty:0,object:n,has:r,get:t=>r(t)?n[t]:void 0,set(t,e){return r(t)||(++i.size,n[t]===st&&--i.empty),n[t]=e,this},delete(t){return r(t)&&(--i.size,++i.empty,n[t]=st),this},clear(){i.size=i.empty=0,i.object=n={}},test(t){return arguments.length?(e=t,i):e},clean(){const t={};let r=0;for(const i in n){const o=n[i];o===st||e&&e(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=n=t}};return t&&Object.keys(t).forEach((e=>{i.set(e,t[e])})),i}function lt(t,e,n,r,i,o){if(!n&&0!==n)return o;const a=+n;let s,u=t[0],l=A(t);if(void 0===l)return o;l<u&&(s=u,u=l,l=s),s=Math.abs(e-u);const c=Math.abs(l-e);return s<c&&s<=a?r:c<=a?i:o}function ct(t,e,n){const r=t.prototype=Object.create(e.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),rt(r,n)}function ft(t,e,n,r){let i,o=e[0],a=e[e.length-1];return o>a&&(i=o,o=a,a=i),r=void 0===r||r,((n=void 0===n||n)?o<=t:o<t)&&(r?t<=a:t<a)}function ht(t){return"boolean"==typeof t}function dt(t){return"[object Date]"===Object.prototype.toString.call(t)}function pt(t){return null!=t&&X(t[Symbol.iterator])}function gt(t){return"number"==typeof t}function mt(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function yt(t){return"string"==typeof t}function vt(t,n,r){const o=t?n?G(t).map((t=>t.replace(/\\(.)/g,"$1"))):G(t):void 0,a=o?.length,s=r&&r.get||i,l=t=>s(n?[t]:u(t));let c;if(a&&o)if(1===a){const t=l(o[0]);c=function(e){return""+t(e)}}else{const t=o.map(l);c=function(e){let n=""+t[0](e),r=0;for(;++r<a;)n+="|"+t[r](e);return n}}else c=function(){return""};return e(c,o,"key")}function _t(t,e){const n=t[0],r=A(t),i=+e;return void 0===r?n:i?1===i?r:n+i*(r-n):n}function xt(t){let e,n,r;t=+t||1e4;const i=()=>{e={},n={},r=0},o=(i,o)=>(++r>t&&(n=e,e={},r=1),e[i]=o);return i(),{clear:i,has:t=>at(e,t)||at(n,t),get:t=>at(e,t)?e[t]:at(n,t)?o(t,n[t]):void 0,set:(t,n)=>at(e,t)?e[t]=n:o(t,n)}}function bt(t,e,n,r){const i=e.length,o=n.length;if(!o)return e;if(!i)return n;const a=e.constructor,s=r||(function(t){return t===Array||"function"==typeof t&&t.prototype&&ArrayBuffer.isView(t.prototype)}(a)?new a(i+o):new Array(i+o));let u=0,l=0,c=0;for(;u<i&&l<o;++c)s[c]=t(e[u],n[l])>0?n[l++]:e[u++];for(;u<i;++u,++c)s[c]=e[u];for(;l<o;++l,++c)s[c]=n[l];return s}function wt(t,e){let n="";for(;--e>=0;)n+=t;return n}function Mt(t,e,n,r){const i=n||" ",o=t+"",a=e-o.length;return a<=0?o:"left"===r?wt(i,a)+o:"center"===r?wt(i,~~(a/2))+o+wt(i,Math.ceil(a/2)):o+wt(i,a)}function kt(t){return t&&A(t)-t[0]||0}function At(t){return _(t)?`[${t.map((t=>null===t?"null":At(t)))}]`:x(t)||yt(t)?JSON.stringify(t).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029"):t}function Et(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}const Dt=t=>gt(t)||dt(t)?t:Date.parse(t);function Ct(t,e){return e=e||Dt,null==t||""===t?null:e(t)}function Ft(t){return null==t||""===t?null:t+""}function St(t){const e={},n=t.length;for(let r=0;r<n;++r)e[t[r]+""]=!0;return e}function Tt(t,e,n,r){const i=null!=r?r:"…",o=t+"",a=o.length,s=Math.max(0,e-i.length);return a<=e?o:"left"===n?i+o.slice(a-s):"center"===n?o.slice(0,Math.ceil(s/2))+i+o.slice(a-~~(s/2)):o.slice(0,s)+i}function $t(t,e,n){if(t)if(e){const r=t.length;for(let i=0;i<r;++i){const r=e(t[i]);r&&n(r,i,t)}}else t.forEach(n)}var zt={},Bt={};function Ot(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Nt(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Rt(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Ut(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Rt(-e,6):e>9999?"+"+Rt(e,6):Rt(e,4))+"-"+Rt(t.getUTCMonth()+1,2)+"-"+Rt(t.getUTCDate(),2)+(o?"T"+Rt(n,2)+":"+Rt(r,2)+":"+Rt(i,2)+"."+Rt(o,3)+"Z":i?"T"+Rt(n,2)+":"+Rt(r,2)+":"+Rt(i,2)+"Z":r||n?"T"+Rt(n,2)+":"+Rt(r,2)+"Z":"")}function Lt(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,u=o<=0,l=!1;function c(){if(u)return Bt;if(l)return l=!1,zt;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?u=!0:10===(r=t.charCodeAt(a++))?l=!0:13===r&&(l=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))l=!0;else if(13===r)l=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return u=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Bt;){for(var f=[];r!==zt&&r!==Bt;)f.push(r),r=c();e&&null==(f=e(f,s++))||i.push(f)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Ut(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Ot(t);return function(r,i){return e(n(r),i,t)}}(t,e):Ot(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Nt(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Nt(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}function qt(t){return t}function Pt(t,e){return"string"==typeof e&&(e=t.objects[e]),"GeometryCollection"===e.type?{type:"FeatureCollection",features:e.geometries.map((function(e){return jt(t,e)}))}:jt(t,e)}function jt(t,e){var n=e.id,r=e.bbox,i=null==e.properties?{}:e.properties,o=It(t,e);return null==n&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:n,properties:i,geometry:o}:{type:"Feature",id:n,bbox:r,properties:i,geometry:o}}function It(t,e){var n=function(t){if(null==t)return qt;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=n=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+o,c[1]=(n+=t[1])*i+a;u<l;)c[u]=t[u],++u;return c}}(t.transform),r=t.arcs;function i(t,e){e.length&&e.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)e.push(n(i[o],o));t<0&&function(t,e){for(var n,r=t.length,i=r-e;i<--r;)n=t[i],t[i++]=t[r],t[r]=n}(e,a)}function o(t){return n(t)}function a(t){for(var e=[],n=0,r=t.length;n<r;++n)i(t[n],e);return e.length<2&&e.push(e[0]),e}function s(t){for(var e=a(t);e.length<4;)e.push(e[0]);return e}function u(t){return t.map(s)}return function t(e){var n,r=e.type;switch(r){case"GeometryCollection":return{type:r,geometries:e.geometries.map(t)};case"Point":n=o(e.coordinates);break;case"MultiPoint":n=e.coordinates.map(o);break;case"LineString":n=a(e.arcs);break;case"MultiLineString":n=e.arcs.map(a);break;case"Polygon":n=u(e.arcs);break;case"MultiPolygon":n=e.arcs.map(u);break;default:return null}return{type:r,coordinates:n}}(e)}function Wt(t,e){var n={},r={},i={},o=[],a=-1;function s(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach((function(t){n[t<0?~t:t]=1})),o.push(i)}}return e.forEach((function(n,r){var i,o=t.arcs[n<0?~n:n];o.length<3&&!o[1][0]&&!o[1][1]&&(i=e[++a],e[a]=n,e[r]=i)})),e.forEach((function(e){var n,o,a=function(e){var n,r=t.arcs[e<0?~e:e],i=r[0];t.transform?(n=[0,0],r.forEach((function(t){n[0]+=t[0],n[1]+=t[1]}))):n=r[r.length-1];return e<0?[n,i]:[i,n]}(e),s=a[0],u=a[1];if(n=i[s])if(delete i[n.end],n.push(e),n.end=u,o=r[u]){delete r[o.start];var l=o===n?n:n.concat(o);r[l.start=n.start]=i[l.end=o.end]=l}else r[n.start]=i[n.end]=n;else if(n=r[u])if(delete r[n.start],n.unshift(e),n.start=s,o=i[s]){delete i[o.end];var c=o===n?n:o.concat(n);r[c.start=o.start]=i[c.end=n.end]=c}else r[n.start]=i[n.end]=n;else r[(n=[e]).start=s]=i[n.end=u]=n})),s(i,r),s(r,i),e.forEach((function(t){n[t<0?~t:t]||o.push([t])})),o}function Ht(t){return It(t,Yt.apply(this,arguments))}function Yt(t,e,n){var r,i,o;if(arguments.length>1)r=function(t,e,n){var r,i=[],o=[];function a(t){var e=t<0?~t:t;(o[e]||(o[e]=[])).push({i:t,g:r})}function s(t){t.forEach(a)}function u(t){t.forEach(s)}function l(t){t.forEach(u)}function c(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"LineString":s(t.arcs);break;case"MultiLineString":case"Polygon":u(t.arcs);break;case"MultiPolygon":l(t.arcs)}}return c(e),o.forEach(null==n?function(t){i.push(t[0].i)}:function(t){n(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,n);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:Wt(t,r)}}function Gt(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Vt(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Xt(t){let e,n,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<0?i=e+1:o=e}while(i<o)}return i}return 2!==t.length?(e=Gt,n=(e,n)=>Gt(t(e),n),r=(e,n)=>t(e)-n):(e=t===Gt||t===Vt?t:Jt,n=t,r=t),{left:i,center:function(t,e,n=0,o=t.length){const a=i(t,e,n,o-1);return a>n&&r(t[a-1],e)>-r(t[a],e)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==e(r,r))return o;do{const e=i+o>>>1;n(t[e],r)<=0?i=e+1:o=e}while(i<o)}return i}}}function Jt(){return 0}function Zt(t){return null===t?NaN:+t}const Qt=Xt(Gt),Kt=Qt.right,te=Qt.left;Xt(Zt).center;class ee{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(e[n++]=a),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}class ne extends Map{constructor(t,e=se){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(ie(this,t))}has(t){return super.has(ie(this,t))}set(t,e){return super.set(oe(this,t),e)}delete(t){return super.delete(ae(this,t))}}class re extends Set{constructor(t,e=se){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(ie(this,t))}add(t){return super.add(oe(this,t))}delete(t){return super.delete(ae(this,t))}}function ie({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function oe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function ae({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function se(t){return null!==t&&"object"==typeof t?t.valueOf():t}function ue(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(t<e?-1:t>e?1:0)}const le=Math.sqrt(50),ce=Math.sqrt(10),fe=Math.sqrt(2);function he(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=le?10:o>=ce?5:o>=fe?2:1;let s,u,l;return i<0?(l=Math.pow(10,-i)/a,s=Math.round(t*l),u=Math.round(e*l),s/l<t&&++s,u/l>e&&--u,l=-l):(l=Math.pow(10,i)*a,s=Math.round(t/l),u=Math.round(e/l),s*l<t&&++s,u*l>e&&--u),u<s&&.5<=n&&n<2?he(t,e,2*n):[s,u,l]}function de(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[i,o,a]=r?he(e,t,n):he(t,e,n);if(!(o>=i))return[];const s=o-i+1,u=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)u[t]=(o-t)/-a;else for(let t=0;t<s;++t)u[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)u[t]=(i+t)/-a;else for(let t=0;t<s;++t)u[t]=(i+t)*a;return u}function pe(t,e,n){return he(t=+t,e=+e,n=+n)[2]}function ge(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?pe(e,t,n):pe(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function me(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function ye(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function ve(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?ue:function(t=Gt){if(t===Gt)return ue;if("function"!=typeof t)throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||0===r?r:(0===t(n,n))-(0===t(e,e))}}(i);r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);ve(t,e,Math.max(n,Math.floor(e-a*u/o+l)),Math.min(r,Math.floor(e+(o-a)*u/o+l)),i)}const o=t[e];let a=n,s=r;for(_e(t,n,e),i(t[r],o)>0&&_e(t,n,r);a<s;){for(_e(t,a,s),++a,--s;i(t[a],o)<0;)++a;for(;i(t[s],o)>0;)--s}0===i(t[n],o)?_e(t,n,s):(++s,_e(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function _e(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function xe(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return ye(t);if(e>=1)return me(t);var r,i=(r-1)*e,o=Math.floor(i),a=me(ve(t,o).subarray(0,o+1));return a+(ye(t.subarray(o+1))-a)*(i-o)}}function be(t,e,n=Zt){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(i-o)}}function we(t,e){return xe(t,.5,e)}function Me(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ke(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}function Ae(t,e){let n=0;for(let e of t)(e=+e)&&(n+=e);return n}function Ee(t){return t instanceof re?t:new re(t)}function De(t,e){if(!isFinite(t)||0===t)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Ce(t){return(t=De(Math.abs(t)))?t[1]:NaN}var Fe,Se=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Te(t){if(!(e=Se.exec(t)))throw new Error("invalid format: "+t);var e;return new $e({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function $e(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 ze(t,e){var n=De(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Te.prototype=$e.prototype,$e.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 Be={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ze(100*t,e),r:ze,s:function(t,e){var n=De(t,e);if(!n)return Fe=void 0,t.toPrecision(e);var r=n[0],i=n[1],o=i-(Fe=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+De(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Oe(t){return t}var Ne,Re,Ue,Le=Array.prototype.map,qe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Pe(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Oe:(e=Le.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],u=0;i>0&&s>0&&(u+s+1>r&&(s=Math.max(1,r-u)),o.push(t.substring(i-=s,i+s)),!((u+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Oe:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(Le.call(t.numerals,String)),u=void 0===t.percent?"%":t.percent+"",l=void 0===t.minus?"−":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function f(t,e){var n=(t=Te(t)).fill,f=t.align,h=t.sign,d=t.symbol,p=t.zero,g=t.width,m=t.comma,y=t.precision,v=t.trim,_=t.type;"n"===_?(m=!0,_="g"):Be[_]||(void 0===y&&(y=12),v=!0,_="g"),(p||"0"===n&&"="===f)&&(p=!0,n="0",f="=");var x=(e&&void 0!==e.prefix?e.prefix:"")+("$"===d?i:"#"===d&&/[boxX]/.test(_)?"0"+_.toLowerCase():""),b=("$"===d?o:/[%p]/.test(_)?u:"")+(e&&void 0!==e.suffix?e.suffix:""),w=Be[_],M=/[defgprs%]/.test(_);function k(t){var e,i,o,u=x,d=b;if("c"===_)d=w(t)+d,t="";else{var k=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),y),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),k&&0==+t&&"+"!==h&&(k=!1),u=(k?"("===h?h:l:"-"===h||"("===h?"":h)+u,d=("s"!==_||isNaN(t)||void 0===Fe?"":qe[8+Fe/3])+d+(k&&"("===h?")":""),M)for(e=-1,i=t.length;++e<i;)if(48>(o=t.charCodeAt(e))||o>57){d=(46===o?a+t.slice(e+1):t.slice(e))+d,t=t.slice(0,e);break}}m&&!p&&(t=r(t,1/0));var A=u.length+t.length+d.length,E=A<g?new Array(g-A+1).join(n):"";switch(m&&p&&(t=r(E+t,E.length?g-d.length:1/0),E=""),f){case"<":t=u+t+d+E;break;case"=":t=u+E+t+d;break;case"^":t=E.slice(0,A=E.length>>1)+u+t+d+E.slice(A);break;default:t=E+u+t+d}return s(t)}return y=void 0===y?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,y)):Math.max(0,Math.min(20,y)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,e){var n=3*Math.max(-8,Math.min(8,Math.floor(Ce(e)/3))),r=Math.pow(10,-n),i=f(((t=Te(t)).type="f",t),{suffix:qe[8+n/3]});return function(t){return i(r*t)}}}}function je(t){return Math.max(0,-Ce(Math.abs(t)))}function Ie(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Ce(e)/3)))-Ce(Math.abs(t)))}function We(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Ce(e)-Ce(t))+1}!function(t){Ne=Pe(t),Re=Ne.format,Ue=Ne.formatPrefix}({thousands:",",grouping:[3],currency:["$",""]});const He=new Date,Ye=new Date;function Ge(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<r);return a},i.filter=n=>Ge((e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););})),n&&(i.count=(e,r)=>(He.setTime(+e),Ye.setTime(+r),t(He),t(Ye),Math.floor(n(He,Ye))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t==0:e=>i.count(0,e)%t==0):i:null)),i}const Ve=Ge((()=>{}),((t,e)=>{t.setTime(+t+e)}),((t,e)=>e-t));Ve.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Ge((e=>{e.setTime(Math.floor(e/t)*t)}),((e,n)=>{e.setTime(+e+n*t)}),((e,n)=>(n-e)/t)):Ve:null),Ve.range;const Xe=1e3,Je=6e4,Ze=36e5,Qe=864e5,Ke=6048e5,tn=2592e6,en=31536e6,nn=Ge((t=>{t.setTime(t-t.getMilliseconds())}),((t,e)=>{t.setTime(+t+e*Xe)}),((t,e)=>(e-t)/Xe),(t=>t.getUTCSeconds()));nn.range;const rn=Ge((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Xe)}),((t,e)=>{t.setTime(+t+e*Je)}),((t,e)=>(e-t)/Je),(t=>t.getMinutes()));rn.range;const on=Ge((t=>{t.setUTCSeconds(0,0)}),((t,e)=>{t.setTime(+t+e*Je)}),((t,e)=>(e-t)/Je),(t=>t.getUTCMinutes()));on.range;const an=Ge((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Xe-t.getMinutes()*Je)}),((t,e)=>{t.setTime(+t+e*Ze)}),((t,e)=>(e-t)/Ze),(t=>t.getHours()));an.range;const sn=Ge((t=>{t.setUTCMinutes(0,0,0)}),((t,e)=>{t.setTime(+t+e*Ze)}),((t,e)=>(e-t)/Ze),(t=>t.getUTCHours()));sn.range;const un=Ge((t=>t.setHours(0,0,0,0)),((t,e)=>t.setDate(t.getDate()+e)),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Je)/Qe),(t=>t.getDate()-1));un.range;const ln=Ge((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/Qe),(t=>t.getUTCDate()-1));ln.range;const cn=Ge((t=>{t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+e)}),((t,e)=>(e-t)/Qe),(t=>Math.floor(t/Qe)));function fn(t){return Ge((e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),((t,e)=>{t.setDate(t.getDate()+7*e)}),((t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Je)/Ke))}cn.range;const hn=fn(0),dn=fn(1),pn=fn(2),gn=fn(3),mn=fn(4),yn=fn(5),vn=fn(6);function _n(t){return Ge((e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)}),((t,e)=>(e-t)/Ke))}hn.range,dn.range,pn.range,gn.range,mn.range,yn.range,vn.range;const xn=_n(0),bn=_n(1),wn=_n(2),Mn=_n(3),kn=_n(4),An=_n(5),En=_n(6);xn.range,bn.range,wn.range,Mn.range,kn.range,An.range,En.range;const Dn=Ge((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,e)=>{t.setMonth(t.getMonth()+e)}),((t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear())),(t=>t.getMonth()));Dn.range;const Cn=Ge((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)}),((t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth()));Cn.range;const Fn=Ge((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,e)=>{t.setFullYear(t.getFullYear()+e)}),((t,e)=>e.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Fn.every=t=>isFinite(t=Math.floor(t))&&t>0?Ge((e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),((e,n)=>{e.setFullYear(e.getFullYear()+n*t)})):null,Fn.range;const Sn=Ge((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)}),((t,e)=>e.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Tn(t,e,n,r,i,o){const a=[[nn,1,Xe],[nn,5,5e3],[nn,15,15e3],[nn,30,3e4],[o,1,Je],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,Ze],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,Qe],[r,2,1728e5],[n,1,Ke],[e,1,tn],[e,3,7776e6],[t,1,en]];function s(e,n,r){const i=Math.abs(n-e)/r,o=Xt((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(ge(e/en,n/en,r));if(0===o)return Ve.every(Math.max(ge(e,n,r),1));const[s,u]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return s.every(u)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:s(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},s]}Sn.every=t=>isFinite(t=Math.floor(t))&&t>0?Ge((e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),((e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null,Sn.range;const[$n,zn]=Tn(Sn,Cn,xn,cn,sn,on),[Bn,On]=Tn(Fn,Dn,hn,un,an,rn),Nn="year",Rn="quarter",Un="month",Ln="week",qn="isoweek",Pn="date",jn="day",In="dayofyear",Wn="hours",Hn="minutes",Yn="seconds",Gn="milliseconds",Vn=[Nn,Rn,Un,Ln,qn,Pn,jn,In,Wn,Hn,Yn,Gn],Xn=Vn.reduce(((t,e,n)=>(t[e]=1+n,t)),{});function Jn(t){const e=G(t).slice(),n={};e.length||s("Missing time unit."),e.forEach((t=>{at(Xn,t)?n[t]=1:s(`Invalid time unit: ${t}.`)}));return((n[Ln]||n[qn]||n[jn]?1:0)+(n[Rn]||n[Un]||n[Pn]?1:0)+(n[In]?1:0)>1||n[Ln]&&n[qn])&&s(`Incompatible time units: ${t}`),e.sort(((t,e)=>Xn[t]-Xn[e])),e}const Zn={[Nn]:"%Y ",[Rn]:"Q%q ",[Un]:"%b ",[Pn]:"%d ",[Ln]:"W%U ",[qn]:"W%V ",[jn]:"%a ",[In]:"%j ",[Wn]:"%H:00",[Hn]:"00:%M",[Yn]:":%S",[Gn]:".%L",[`${Nn}-${qn}`]:"%G W%V ",[`${Nn}-${Un}`]:"%Y-%m ",[`${Nn}-${Un}-${Pn}`]:"%Y-%m-%d ",[`${Wn}-${Hn}`]:"%H:%M"};function Qn(t,e){const n=rt({},Zn,e),r=Jn(t),i=r.length;let o,a,s="",u=0;for(u=0;u<i;)for(o=r.length;o>u;--o)if(a=r.slice(u,o).join("-"),null!=n[a]){s+=n[a],u=o;break}return s.trim()}const Kn=new Date;function tr(t){return Kn.setFullYear(t),Kn.setMonth(0),Kn.setDate(1),Kn.setHours(0,0,0,0),Kn}function er(t){return ir(new Date(t))}function nr(t){return or(new Date(t))}function rr(t){return sr(new Date(t))}function ir(t){return un.count(tr(t.getFullYear())-1,t)}function or(t){return hn.count(tr(t.getFullYear())-1,t)}function ar(t){return un.offset(dn.floor(t),3).getFullYear()}function sr(t){return 1+dn.count(ur(ar(t)),t)}function ur(t){return dn.floor(un.offset(tr(t),3))}function lr(t){const e=ur(t);return e.getMonth()?e.getDate()-31:e.getDate()}function cr(t){return tr(t).getDay()}function fr(t,e,n,r,i,o,a){if(0<=t&&t<100){const s=new Date(-1,e,n,r,i,o,a);return s.setFullYear(t),s}return new Date(t,e,n,r,i,o,a)}function hr(t){return gr(new Date(t))}function dr(t){return mr(new Date(t))}function pr(t){return vr(new Date(t))}function gr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return ln.count(e-1,t)}function mr(t){const e=Date.UTC(t.getUTCFullYear(),0,1);return xn.count(e-1,t)}function yr(t){return ln.offset(bn.floor(t),3).getUTCFullYear()}function vr(t){return 1+bn.count(_r(yr(t)),t)}function _r(t){return bn.floor(ln.offset(Date.UTC(t,0,1),3))}function xr(t){const e=_r(t);return e.getUTCMonth()?e.getUTCDate()-31:e.getUTCDate()}function br(t){return Kn.setTime(Date.UTC(t,0,1)),Kn.getUTCDay()}function wr(t,e,n,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,e,n,r,i,o,a));return t.setUTCFullYear(n.y),t}return new Date(Date.UTC(t,e,n,r,i,o,a))}function Mr(t,e,n,r,i){const o=e||1,a=A(t),s=(t,e,i)=>function(t,e,n,r){const i=n<=1?t:r?(e,i)=>r+n*Math.floor((t(e,i)-r)/n):(e,r)=>n*Math.floor(t(e,r)/n);return e?(t,n)=>e(i(t,n),n):i}(n[i=i||t],r[i],t===a&&o,e),u=new Date,l=St(t),c=l[Nn]?s(Nn,null,l[qn]?Nn+qn:Nn):et(l[qn]?2015:2012),f=l[Un]?s(Un):l[Rn]?s(Rn):h,p=l[Ln]&&l[jn]?s(jn,1,Ln+jn):l[qn]&&l[jn]?s(jn,1,qn+jn):l[Ln]?s(Ln,1):l[qn]?s(qn,1):l[jn]?s(jn,1):l[Pn]?s(Pn,1):l[In]?s(In,1):d,g=l[Wn]?s(Wn):h,m=l[Hn]?s(Hn):h,y=l[Yn]?s(Yn):h,v=l[Gn]?s(Gn):h;return function(t){u.setTime(+t);const e=c(u);return i(e,f(u),p(u,e),g(u),m(u),y(u),v(u))}}function kr(t,e,n){return e+7*t-(n+6)%7}function Ar(t){return(t+6)%7}function Er(t,e,n){return t+7*(e-1)+n}const Dr={[Nn]:t=>t.getFullYear(),[Rn]:t=>Math.floor(t.getMonth()/3),[Un]:t=>t.getMonth(),[Pn]:t=>t.getDate(),[Wn]:t=>t.getHours(),[Hn]:t=>t.getMinutes(),[Yn]:t=>t.getSeconds(),[Gn]:t=>t.getMilliseconds(),[In]:t=>ir(t),[Ln]:t=>or(t),[Ln+jn]:(t,e)=>kr(or(t),t.getDay(),cr(e)),[jn]:(t,e)=>kr(1,t.getDay(),cr(e)),[qn]:t=>sr(t),[Nn+qn]:t=>ar(t),[qn+jn]:(t,e)=>Er(lr(e),sr(t),Ar(t.getDay()))},Cr={[Rn]:t=>3*t,[Ln]:(t,e)=>kr(t,0,cr(e)),[qn]:(t,e)=>Er(lr(e),t,0)};function Fr(t,e){return Mr(t,e||1,Dr,Cr,fr)}const Sr={[Nn]:t=>t.getUTCFullYear(),[Rn]:t=>Math.floor(t.getUTCMonth()/3),[Un]:t=>t.getUTCMonth(),[Pn]:t=>t.getUTCDate(),[Wn]:t=>t.getUTCHours(),[Hn]:t=>t.getUTCMinutes(),[Yn]:t=>t.getUTCSeconds(),[Gn]:t=>t.getUTCMilliseconds(),[In]:t=>gr(t),[Ln]:t=>mr(t),[jn]:(t,e)=>kr(1,t.getUTCDay(),br(e)),[Ln+jn]:(t,e)=>kr(mr(t),t.getUTCDay(),br(e)),[qn]:t=>vr(t),[Nn+qn]:t=>yr(t),[qn+jn]:(t,e)=>Er(xr(e),vr(t),Ar(t.getUTCDay()))},Tr={[Rn]:t=>3*t,[Ln]:(t,e)=>kr(t,0,br(e)),[qn]:(t,e)=>Er(xr(e),t,0)};function $r(t,e){return Mr(t,e||1,Sr,Tr,wr)}const zr={[Nn]:Fn,[Rn]:Dn.every(3),[Un]:Dn,[Ln]:hn,[qn]:dn,[Pn]:un,[jn]:un,[In]:un,[Wn]:an,[Hn]:rn,[Yn]:nn,[Gn]:Ve},Br={[Nn]:Sn,[Rn]:Cn.every(3),[Un]:Cn,[Ln]:xn,[qn]:bn,[Pn]:ln,[jn]:ln,[In]:ln,[Wn]:sn,[Hn]:on,[Yn]:nn,[Gn]:Ve};function Or(t){return zr[t]}function Nr(t){return Br[t]}function Rr(t,e,n){return t?t.offset(e,n):void 0}function Ur(t,e,n){return Rr(Or(t),e,n)}function Lr(t,e,n){return Rr(Nr(t),e,n)}function qr(t,e,n,r){return t?t.range(e,n,r):void 0}function Pr(t,e,n,r){return qr(Or(t),e,n,r)}function jr(t,e,n,r){return qr(Nr(t),e,n,r)}const Ir=1e3,Wr=6e4,Hr=36e5,Yr=864e5,Gr=2592e6,Vr=31536e6,Xr=[Nn,Un,Pn,Wn,Hn,Yn,Gn],Jr=Xr.slice(0,-1),Zr=Jr.slice(0,-1),Qr=Zr.slice(0,-1),Kr=Qr.slice(0,-1),ti=[Nn,Un],ei=[Nn],ni=[[Jr,1,Ir],[Jr,5,5e3],[Jr,15,15e3],[Jr,30,3e4],[Zr,1,Wr],[Zr,5,3e5],[Zr,15,9e5],[Zr,30,18e5],[Qr,1,Hr],[Qr,3,108e5],[Qr,6,216e5],[Qr,12,432e5],[Kr,1,Yr],[[Nn,Ln],1,6048e5],[ti,1,Gr],[ti,3,7776e6],[ei,1,Vr]];function ri(t){const e=t.extent,n=t.maxbins||40,r=Math.abs(kt(e))/n;let i,o,a=Xt((t=>t[2])).right(ni,r);return a===ni.length?(i=ei,o=ge(e[0]/Vr,e[1]/Vr,n)):a?(a=ni[r/ni[a-1][2]<ni[a][2]/r?a-1:a],i=a[0],o=a[1]):(i=Xr,o=Math.max(ge(e[0],e[1],n),1)),{units:i,step:o}}const ii={[Nn]:t=>t.getFullYear(),[Un]:t=>t.getMonth(),[Pn]:t=>t.getDate(),[jn]:t=>t.getDay(),[Wn]:t=>t.getHours(),[Hn]:t=>t.getMinutes(),[Yn]:t=>t.getSeconds(),[Gn]:t=>t.getMilliseconds()},oi={[Nn]:t=>t.getUTCFullYear(),[Un]:t=>t.getUTCMonth(),[Pn]:t=>t.getUTCDate(),[jn]:t=>t.getUTCDay(),[Wn]:t=>t.getUTCHours(),[Hn]:t=>t.getUTCMinutes(),[Yn]:t=>t.getUTCSeconds(),[Gn]:t=>t.getUTCMilliseconds()},ai=[{units:[Nn,Un,Pn,Wn,Hn,Yn,Gn],step:1,aligned:()=>!0},{units:[Nn,Un,Pn,Wn,Hn,Yn],step:1,aligned:(t,e)=>t.every((t=>0===e[Gn](t)))},{units:[Nn,Un,Pn,Wn,Hn],step:1,aligned:(t,e)=>t.every((t=>0===e[Yn](t)))},{units:[Nn,Un,Pn,Wn,Hn],step:5,aligned:(t,e)=>t.every((t=>e[Hn](t)%5==0))},{units:[Nn,Un,Pn,Wn,Hn],step:10,aligned:(t,e)=>t.every((t=>e[Hn](t)%10==0))},{units:[Nn,Un,Pn,Wn],step:1,aligned:(t,e)=>t.every((t=>0===e[Hn](t)))},{units:[Nn,Un,Pn],step:1,aligned:(t,e)=>t.every((t=>0===e[Wn](t)))},{units:[Nn,Ln],step:1,skippable:!0,aligned:(t,e)=>1===new Set(t.map((t=>e[jn](t)))).size},{units:[Nn,Un],step:1,aligned:(t,e)=>t.every((t=>1===e[Pn](t)))},{units:[Nn,Un],step:3,aligned:(t,e)=>t.every((t=>e[Un](t)%3==0))},{units:[Nn],step:1,aligned:(t,e)=>t.every((t=>0===e[Un](t)))},{units:[Nn],step:10,aligned:(t,e)=>t.every((t=>e[Nn](t)%10==0))},{aligned:()=>!1}];function si(t,e,n){const r=n?oi:ii,i=t.map((t=>{const n=e(t),r=new Date(n);return Number.isNaN(+r)&&s(`Invalid date: ${n}`),r})),o=ai.findIndex((t=>!t.aligned(i,r))),a=ai.findIndex((t=>!t.skippable&&!t.aligned(i,r))),u=a>o+1?a:o,{units:l,step:c}=ai[u-1];return{units:l,step:c}}function ui(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function li(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ci(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function fi(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,u=t.shortMonths,l=Mi(i),c=ki(i),f=Mi(o),h=ki(o),d=Mi(a),p=ki(a),g=Mi(s),m=ki(s),y=Mi(u),v=ki(u),_={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Hi,e:Hi,f:Ji,g:so,G:lo,H:Yi,I:Gi,j:Vi,L:Xi,m:Zi,M:Qi,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:zo,s:Bo,S:Ki,u:to,U:eo,V:ro,w:io,W:oo,x:null,X:null,y:ao,Y:uo,Z:co,"%":$o},x={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return u[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:fo,e:fo,f:yo,g:Co,G:So,H:ho,I:po,j:go,L:mo,m:vo,M:_o,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:zo,s:Bo,S:xo,u:bo,U:wo,V:ko,w:Ao,W:Eo,x:null,X:null,y:Do,Y:Fo,Z:To,"%":$o},b={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=v.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return k(t,e,n,r)},d:Oi,e:Oi,f:Pi,g:Ti,G:Si,H:Ri,I:Ri,j:Ni,L:qi,m:Bi,M:Ui,p:function(t,e,n){var r=l.exec(e.slice(n));return r?(t.p=c.get(r[0].toLowerCase()),n+r[0].length):-1},q:zi,Q:Ii,s:Wi,S:Li,u:Ei,U:Di,V:Ci,w:Ai,W:Fi,x:function(t,e,r){return k(t,n,e,r)},X:function(t,e,n){return k(t,r,e,n)},y:Ti,Y:Si,Z:$i,"%":ji};function w(t,e){return function(n){var r,i,o,a=[],s=-1,u=0,l=t.length;for(n instanceof Date||(n=new Date(+n));++s<l;)37===t.charCodeAt(s)&&(a.push(t.slice(u,s)),null!=(i=yi[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),u=s+1);return a.push(t.slice(u,s)),a.join("")}}function M(t,e){return function(n){var r,i,o=ci(1900,void 0,1);if(k(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=li(ci(o.y,0,1))).getUTCDay(),r=i>4||0===i?bn.ceil(r):bn(r),r=ln.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=ui(ci(o.y,0,1))).getDay(),r=i>4||0===i?dn.ceil(r):dn(r),r=un.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?li(ci(o.y,0,1)).getUTCDay():ui(ci(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,li(o)):ui(o)}}function k(t,e,n,r){for(var i,o,a=0,s=e.length,u=n.length;a<s;){if(r>=u)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=b[i in yi?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return _.x=w(n,_),_.X=w(r,_),_.c=w(e,_),x.x=w(n,x),x.X=w(r,x),x.c=w(e,x),{format:function(t){var e=w(t+="",_);return e.toString=function(){return t},e},parse:function(t){var e=M(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",x);return e.toString=function(){return t},e},utcParse:function(t){var e=M(t+="",!0);return e.toString=function(){return t},e}}}var hi,di,pi,gi,mi,yi={"-":"",_:" ",0:"0"},vi=/^\s*\d+/,_i=/^%/,xi=/[\\^$*+?|[\]().{}]/g;function bi(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function wi(t){return t.replace(xi,"\\$&")}function Mi(t){return new RegExp("^(?:"+t.map(wi).join("|")+")","i")}function ki(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}function Ai(t,e,n){var r=vi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Ei(t,e,n){var r=vi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Di(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Ci(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Fi(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Si(t,e,n){var r=vi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Ti(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function $i(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function zi(t,e,n){var r=vi.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Bi(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Oi(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ni(t,e,n){var r=vi.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ri(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Ui(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function Li(t,e,n){var r=vi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function qi(t,e,n){var r=vi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Pi(t,e,n){var r=vi.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function ji(t,e,n){var r=_i.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ii(t,e,n){var r=vi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Wi(t,e,n){var r=vi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Hi(t,e){return bi(t.getDate(),e,2)}function Yi(t,e){return bi(t.getHours(),e,2)}function Gi(t,e){return bi(t.getHours()%12||12,e,2)}function Vi(t,e){return bi(1+un.count(Fn(t),t),e,3)}function Xi(t,e){return bi(t.getMilliseconds(),e,3)}function Ji(t,e){return Xi(t,e)+"000"}function Zi(t,e){return bi(t.getMonth()+1,e,2)}function Qi(t,e){return bi(t.getMinutes(),e,2)}function Ki(t,e){return bi(t.getSeconds(),e,2)}function to(t){var e=t.getDay();return 0===e?7:e}function eo(t,e){return bi(hn.count(Fn(t)-1,t),e,2)}function no(t){var e=t.getDay();return e>=4||0===e?mn(t):mn.ceil(t)}function ro(t,e){return t=no(t),bi(mn.count(Fn(t),t)+(4===Fn(t).getDay()),e,2)}function io(t){return t.getDay()}function oo(t,e){return bi(dn.count(Fn(t)-1,t),e,2)}function ao(t,e){return bi(t.getFullYear()%100,e,2)}function so(t,e){return bi((t=no(t)).getFullYear()%100,e,2)}function uo(t,e){return bi(t.getFullYear()%1e4,e,4)}function lo(t,e){var n=t.getDay();return bi((t=n>=4||0===n?mn(t):mn.ceil(t)).getFullYear()%1e4,e,4)}function co(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+bi(e/60|0,"0",2)+bi(e%60,"0",2)}function fo(t,e){return bi(t.getUTCDate(),e,2)}function ho(t,e){return bi(t.getUTCHours(),e,2)}function po(t,e){return bi(t.getUTCHours()%12||12,e,2)}function go(t,e){return bi(1+ln.count(Sn(t),t),e,3)}function mo(t,e){return bi(t.getUTCMilliseconds(),e,3)}function yo(t,e){return mo(t,e)+"000"}function vo(t,e){return bi(t.getUTCMonth()+1,e,2)}function _o(t,e){return bi(t.getUTCMinutes(),e,2)}function xo(t,e){return bi(t.getUTCSeconds(),e,2)}function bo(t){var e=t.getUTCDay();return 0===e?7:e}function wo(t,e){return bi(xn.count(Sn(t)-1,t),e,2)}function Mo(t){var e=t.getUTCDay();return e>=4||0===e?kn(t):kn.ceil(t)}function ko(t,e){return t=Mo(t),bi(kn.count(Sn(t),t)+(4===Sn(t).getUTCDay()),e,2)}function Ao(t){return t.getUTCDay()}function Eo(t,e){return bi(bn.count(Sn(t)-1,t),e,2)}function Do(t,e){return bi(t.getUTCFullYear()%100,e,2)}function Co(t,e){return bi((t=Mo(t)).getUTCFullYear()%100,e,2)}function Fo(t,e){return bi(t.getUTCFullYear()%1e4,e,4)}function So(t,e){var n=t.getUTCDay();return bi((t=n>=4||0===n?kn(t):kn.ceil(t)).getUTCFullYear()%1e4,e,4)}function To(){return"+0000"}function $o(){return"%"}function zo(t){return+t}function Bo(t){return Math.floor(+t/1e3)}function Oo(t){const e={};return n=>e[n]||(e[n]=t(n))}function No(t){const e=Oo(t.format),n=t.formatPrefix;return{format:e,formatPrefix:n,formatFloat(t){const n=Te(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return r=e(n),i=e(".1f")(1)[1],t=>{const e=r(t),n=e.indexOf(i);if(n<0)return e;let o=function(t,e){let n,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>e;)if(n=t.charCodeAt(r),n>=48&&n<=57)return r+1}(e,n);const a=o<e.length?e.slice(o):"";for(;--o>n;)if("0"!==e[o]){++o;break}return e.slice(0,o)+a}}return e(n);var r,i},formatSpan(t,r,i,o){o=Te(null==o?",f":o);const a=ge(t,r,i),s=Math.max(Math.abs(t),Math.abs(r));let u;if(null==o.precision)switch(o.type){case"s":return isNaN(u=Ie(a,s))||(o.precision=u),n(o,s);case"":case"e":case"g":case"p":case"r":isNaN(u=We(a,s))||(o.precision=u-("e"===o.type));break;case"f":case"%":isNaN(u=je(a))||(o.precision=u-2*("%"===o.type))}return e(o)}}}let Ro,Uo;function Lo(){return Ro=No({format:Re,formatPrefix:Ue})}function qo(t){return No(Pe(t))}function Po(t){return arguments.length?Ro=qo(t):Ro}function jo(t,e,n){x(n=n||{})||s(`Invalid time multi-format specifier: ${n}`);const r=e(Yn),i=e(Hn),o=e(Wn),a=e(Pn),u=e(Ln),l=e(Un),c=e(Rn),f=e(Nn),h=t(n[Gn]||".%L"),d=t(n[Yn]||":%S"),p=t(n[Hn]||"%I:%M"),g=t(n[Wn]||"%I %p"),m=t(n[Pn]||n[jn]||"%a %d"),y=t(n[Ln]||"%b %d"),v=t(n[Un]||"%B"),_=t(n[Rn]||"%B"),b=t(n[Nn]||"%Y");return t=>(r(t)<t?h:i(t)<t?d:o(t)<t?p:a(t)<t?g:l(t)<t?u(t)<t?m:y:f(t)<t?c(t)<t?v:_:b)(t)}function Io(t){const e=Oo(t.format),n=Oo(t.utcFormat);return{timeFormat:t=>yt(t)?e(t):jo(e,Or,t),utcFormat:t=>yt(t)?n(t):jo(n,Nr,t),timeParse:Oo(t.parse),utcParse:Oo(t.utcParse)}}function Wo(){return Uo=Io({format:di,parse:pi,utcFormat:gi,utcParse:mi})}function Ho(t){return Io(fi(t))}function Yo(t){return arguments.length?Uo=Ho(t):Uo}!function(t){hi=fi(t),di=hi.format,pi=hi.parse,gi=hi.utcFormat,mi=hi.utcParse}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Lo(),Wo();const Go=(t,e)=>rt({},t,e);function Vo(t,e){const n=t?qo(t):Po(),r=e?Ho(e):Yo();return Go(n,r)}function Xo(t,e){const n=arguments.length;return n&&2!==n&&s("defaultLocale expects either zero or two arguments."),n?Go(Po(t),Yo(e)):Go(Po(),Yo())}const Jo=/^(data:|([A-Za-z]+:)?\/\/)/,Zo=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Qo=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Ko="file://";async function ta(t,e){const n=await this.sanitize(t,e),r=n.href;return n.localFile?this.file(r):this.http(r,e?.http)}async function ea(t,e){e=rt({},this.options,e);const n=this.fileAccess,r={href:null};let i,o,a;const u=Zo.test(t.replace(Qo,""));null!=t&&"string"==typeof t&&u||s("Sanitize failure, invalid URI: "+At(t));const l=Jo.test(t);return(a=e.baseURL)&&!l&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith(Ko))||"file"===e.mode||"http"!==e.mode&&!l&&n,i?t=t.slice(7):t.startsWith("//")&&("file"===e.defaultProtocol?(t=t.slice(2),o=!0):t=(e.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,e.target&&(r.target=e.target+""),e.rel&&(r.rel=e.rel+""),"image"===e.context&&e.crossOrigin&&(r.crossOrigin=e.crossOrigin+""),r}function na(t){return t?e=>new Promise(((n,r)=>{t.readFile(e,((t,e)=>{t?r(t):n(e)}))})):ra}async function ra(){s("No file system access.")}async function ia(t,e){const n=rt({},this.options.http,e),r=e&&e.response,i=await fetch(t,n);return i.ok?X(i[r])?i[r]():i.text():s(i.status+""+i.statusText)}const oa=t=>!(Number.isNaN(+t)||t instanceof Date),aa={boolean:Et,integer:E,number:E,date:Ct,string:Ft,unknown:f},sa=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>oa(t)&&Number.isInteger(+t),oa,t=>!Number.isNaN(Date.parse(t))],ua=["boolean","integer","number","date"];function la(t,e){if(!t||!t.length)return"unknown";const n=t.length,r=sa.length,i=sa.map(((t,e)=>e+1));for(let a,s,u=0,l=0;u<n;++u)for(s=e?t[u][e]:t[u],a=0;a<r;++a)if(i[a]&&(null!=(o=s)&&o==o)&&!sa[a](s)&&(i[a]=0,++l,l===sa.length))return"string";var o;return ua[i.reduce(((t,e)=>0===t?e:t),0)-1]}function ca(t,e){return e.reduce(((e,n)=>(e[n]=la(t,n),e)),{})}function fa(t){const e=function(e,n){const r={delimiter:t};return ha(e,n?rt(n,r):r)};return e.responseType="text",e}function ha(t,e){return e.header&&(t=e.header.map(At).join(e.delimiter)+"\n"+t),Lt(e.delimiter).parse(t+"")}function da(t,e){const n=e&&e.property?l(e.property):f;return!x(t)||(r=t,"function"==typeof Buffer&&X(Buffer.isBuffer)&&Buffer.isBuffer(r))?n(JSON.parse(t)):function(t,e){!_(t)&&pt(t)&&(t=[...t]);return e&&e.copy?JSON.parse(JSON.stringify(t)):t}(n(t),e);var r}ha.responseType="text",da.responseType="json";const pa={interior:(t,e)=>t!==e,exterior:(t,e)=>t===e};function ga(t,e){let n,r,i,o;return t=da(t,e),e&&e.feature?(n=Pt,i=e.feature):e&&e.mesh?(n=Ht,i=e.mesh,o=pa[e.filter]):s("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?n(t,r,o):s("Invalid TopoJSON object: "+i),r&&r.features||[r]}ga.responseType="json";const ma={dsv:ha,csv:fa(","),tsv:fa("\t"),json:da,topojson:ga};function ya(t,e){return arguments.length>1?(ma[t]=e,this):at(ma,t)?ma[t]:null}function va(t){const e=ya(t);return e&&e.responseType||"text"}function _a(t,e,n,r){const i=ya((e=e||{}).type||"json");return i||s("Unknown data format type: "+e.type),t=i(t,e),e.parse&&function(t,e,n,r){if(!t.length)return;const i=Yo();n=n||i.timeParse,r=r||i.utcParse;let o,a,s,u,l,c,f=t.columns||Object.keys(t[0]);"auto"===e&&(e=ca(t,f));f=Object.keys(e);const h=f.map((t=>{const i=e[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:"))){o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===o[0]?r:n)(a)}if(!aa[i])throw Error("Illegal format pattern: "+t+":"+i);return aa[i]}));for(s=0,l=t.length,c=f.length;s<l;++s)for(o=t[s],u=0;u<c;++u)a=f[u],o[a]=h[u](o[a])}(t,e.parse,n,r),at(t,"columns")&&delete t.columns,t}const xa=(ba=null,t=>({options:t||{},sanitize:ea,load:ta,fileAccess:!1,file:na(ba),http:ia}));var ba;function wa(t){const e=t||f,n=[],r={};return n.add=t=>{const i=e(t);return r[i]||(r[i]=1,n.push(t)),n},n.remove=t=>{const i=e(t);if(r[i]){r[i]=0;const e=n.indexOf(t);e>=0&&n.splice(e,1)}return n},n}async function Ma(t,e){try{await e(t)}catch(e){t.error(e)}}const ka=Symbol("vega_id");let Aa=1;function Ea(t){return!(!t||!Da(t))}function Da(t){return t[ka]}function Ca(t,e){return t[ka]=e,t}function Fa(t){const e=t===Object(t)?t:{data:t};return Da(e)?e:Ca(e,Aa++)}function Sa(t){return Ta(t,Fa({}))}function Ta(t,e){for(const n in t)e[n]=t[n];return e}function $a(t,e){return Ca(e,Da(t))}function za(t,e){return t?e?(n,r)=>t(n,r)||Da(e(n))-Da(e(r)):(e,n)=>t(e,n)||Da(e)-Da(n):null}function Ba(t){return t&&t.constructor===Oa}function Oa(){const t=[],e=[],n=[],r=[],i=[];let o=null,a=!1;return{constructor:Oa,insert(e){const n=G(e),r=n.length;for(let e=0;e<r;++e)t.push(n[e]);return this},remove(t){const n=X(t)?r:e,i=G(t),o=i.length;for(let t=0;t<o;++t)n.push(i[t]);return this},modify(t,e,r){const o={field:e,value:et(r)};return X(t)?(o.filter=t,i.push(o)):(o.tuple=t,n.push(o)),this},encode(t,e){return X(t)?i.push({filter:t,field:e}):n.push({tuple:t,field:e}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(s,u){const l={},c={};let f,h,d,p,g,m;for(f=0,h=u.length;f<h;++f)l[Da(u[f])]=1;for(f=0,h=e.length;f<h;++f)g=e[f],l[Da(g)]=-1;for(f=0,h=r.length;f<h;++f)p=r[f],u.forEach((t=>{p(t)&&(l[Da(t)]=-1)}));for(f=0,h=t.length;f<h;++f)g=t[f],m=Da(g),l[m]?l[m]=1:s.add.push(Fa(t[f]));for(f=0,h=u.length;f<h;++f)g=u[f],l[Da(g)]<0&&s.rem.push(g);function y(t,e,n){n?t[e]=n(t):s.encode=e,a||(c[Da(t)]=t)}for(f=0,h=n.length;f<h;++f)d=n[f],g=d.tuple,p=d.field,m=l[Da(g)],m>0&&(y(g,p,d.value),s.modifies(p));for(f=0,h=i.length;f<h;++f)d=i[f],p=d.filter,u.forEach((t=>{p(t)&&l[Da(t)]>0&&y(t,d.field,d.value)})),s.modifies(d.field);if(a)s.mod=e.length||r.length?u.filter((t=>l[Da(t)]>0)):u.slice();else for(m in c)s.mod.push(c[m]);return(o||null==o&&(e.length||r.length))&&s.clean(!0),s}}}const Na="_:mod:_";function Ra(){Object.defineProperty(this,Na,{writable:!0,value:{}})}Ra.prototype={set(t,e,n,r){const i=this,o=i[t],a=i[Na];return null!=e&&e>=0?(o[e]!==n||r)&&(o[e]=n,a[e+":"+t]=-1,a[t]=-1):(o!==n||r)&&(i[t]=n,a[t]=_(n)?1+n.length:-1),i},modified(t,e){const n=this[Na];if(!arguments.length){for(const t in n)if(n[t])return!0;return!1}if(_(t)){for(let e=0;e<t.length;++e)if(n[t[e]])return!0;return!1}return null!=e&&e>=0?e+1<n[t]||!!n[e+":"+t]:!!n[t]},clear(){return this[Na]={},this}};let Ua=0;const La=new Ra;function qa(t,e,n,r){this.id=++Ua,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,e&&(this._update=e),n&&this.parameters(n,r)}function Pa(t){return function(e){const n=this.flags;return 0===arguments.length?!!(n&t):(this.flags=e?n|t:n&~t,this)}}qa.prototype={targets(){return this._targets||(this._targets=wa(c))},set(t){return this.value!==t?(this.value=t,1):0},skip:Pa(1),modified:Pa(2),parameters(t,e,n){e=!1!==e;const r=this._argval=this._argval||new Ra,i=this._argops=this._argops||[],o=[];let a,u,l,c;const f=(t,n,a)=>{a instanceof qa?(a!==this&&(e&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:n})):r.set(t,n,a)};for(a in t)if(u=t[a],"pulse"===a)G(u).forEach((t=>{t instanceof qa?t!==this&&(t.targets().add(this),o.push(t)):s("Pulse parameters must be operator instances.")})),this.source=u;else if(_(u))for(r.set(a,-1,Array(l=u.length)),c=0;c<l;++c)f(a,c,u[c]);else f(a,-1,u);return this.marshall().clear(),n&&(i.initonly=!0),o},marshall(t){const e=this._argval||La,n=this._argops;let r,i,o,a;if(n){const s=n.length;for(i=0;i<s;++i)r=n[i],o=r.op,a=o.modified()&&o.stamp===t,e.set(r.name,r.index,o.value,a);if(n.initonly){for(i=0;i<s;++i)r=n[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return e},detach(){const t=this._argops;let e,n,r,i;if(t)for(e=0,n=t.length;e<n;++e)r=t[e],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const e=this._update;if(e){const n=this.marshall(t.stamp),r=e.call(this,n,t);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?(this.skip(!1),e=0):e=this.evaluate(t),this.pulse=e||t}};let ja=0;function Ia(t,e,n){this.id=++ja,this.value=null,n&&(this.receive=n),t&&(this._filter=t),e&&(this._apply=e)}function Wa(t,e,n){return new Ia(t,e,n)}Ia.prototype={_filter:p,_apply:f,targets(){return this._targets||(this._targets=wa(c))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const e=this.value=this._apply(t),n=this._targets,r=n?n.length:0;for(let t=0;t<r;++t)n[t].receive(e);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const e=Wa(t);return this.targets().add(e),e},apply(t){const e=Wa(null,t);return this.targets().add(e),e},merge(){const t=Wa();this.targets().add(t);for(let e=0,n=arguments.length;e<n;++e)arguments[e].targets().add(t);return t},throttle(t){let e=-1;return this.filter((()=>{const n=Date.now();return n-e>t?(e=n,1):0}))},debounce(t){const e=Wa();return this.targets().add(Wa(null,null,nt(t,(t=>{const n=t.dataflow;e.receive(t),n&&n.run&&n.run()})))),e},between(t,e){let n=!1;return t.targets().add(Wa(null,null,(()=>n=!0))),e.targets().add(Wa(null,null,(()=>n=!1))),this.filter((()=>n))},detach(){this._filter=p,this._targets=null}};const Ha={skip:!0};function Ya(t,e,n,r,i,o){const a=rt({},o,Ha);let s,u;X(n)||(n=et(n)),void 0===r?s=e=>t.touch(n(e)):X(r)?(u=new qa(null,r,i,!1),s=e=>{u.evaluate(e);const r=n(e),i=u.value;Ba(i)?t.pulse(r,i,o):t.update(r,i,a)}):s=e=>t.update(n(e),r,a),e.apply(s)}function Ga(t,e,n,r,i,o){if(void 0===r)e.targets().add(n);else{const a=o||{},s=new qa(null,function(t,e){return e=X(e)?e:et(e),t?function(n,r){const i=e(n,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:e}(n,r),i,!1);s.modified(a.force),s.rank=e.rank,e.targets().add(s),n&&(s.skip(!0),s.value=n.value,s.targets().add(n),t.connect(n,[s]))}}const Va={};function Xa(t,e,n){this.dataflow=t,this.stamp=null==e?-1:e,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function Ja(t,e){const n=[];return $t(t,e,(t=>n.push(t))),n}function Za(t,e){const n={};return t.visit(e,(t=>{n[Da(t)]=1})),t=>n[Da(t)]?null:t}function Qa(t,e){return t?(n,r)=>t(n,r)&&e(n,r):e}function Ka(t,e,n,r){const i=this;let o=0;this.dataflow=t,this.stamp=e,this.fields=null,this.encode=r||null,this.pulses=n;for(const t of n)if(t.stamp===e){if(t.fields){const e=i.fields||(i.fields={});for(const n in t.fields)e[n]=1}t.changed(i.ADD)&&(o|=i.ADD),t.changed(i.REM)&&(o|=i.REM),t.changed(i.MOD)&&(o|=i.MOD)}this.changes=o}function ts(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Xa.prototype={StopPropagation:Va,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(t){return new Xa(this.dataflow).init(this,t)},clone(){const 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)},addAll(){let t=this;return!t.source||t.add===t.rem||!t.rem.length&&t.source.length===t.add.length||(t=new Xa(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,e){const n=this;return n.stamp=t.stamp,n.encode=t.encode,!t.fields||64&e||(n.fields=t.fields),1&e?(n.addF=t.addF,n.add=t.add):(n.addF=null,n.add=[]),2&e?(n.remF=t.remF,n.rem=t.rem):(n.remF=null,n.rem=[]),4&e?(n.modF=t.modF,n.mod=t.mod):(n.modF=null,n.mod=[]),32&e?(n.srcF=null,n.source=null):(n.srcF=t.srcF,n.source=t.source,t.cleans&&(n.cleans=t.cleans)),n},runAfter(t){this.dataflow.runAfter(t)},changed(t){const e=t||7;return 1&e&&this.add.length||2&e&&this.rem.length||4&e&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const e=this.add.length,n=this.source&&this.source.length;return n&&n!==e&&(this.mod=this.source,e&&this.filter(4,Za(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const e=this.fields||(this.fields={});return _(t)?t.forEach((t=>e[t]=!0)):e[t]=!0,this},modified(t,e){const n=this.fields;return!(!e&&!this.mod.length||!n)&&(arguments.length?_(t)?t.some((t=>n[t])):n[t]:!!n)},filter(t,e){const n=this;return 1&t&&(n.addF=Qa(n.addF,e)),2&t&&(n.remF=Qa(n.remF,e)),4&t&&(n.modF=Qa(n.modF,e)),16&t&&(n.srcF=Qa(n.srcF,e)),n},materialize(t){const e=this;return 1&(t=t||7)&&e.addF&&(e.add=Ja(e.add,e.addF),e.addF=null),2&t&&e.remF&&(e.rem=Ja(e.rem,e.remF),e.remF=null),4&t&&e.modF&&(e.mod=Ja(e.mod,e.modF),e.modF=null),16&t&&e.srcF&&(e.source=e.source.filter(e.srcF),e.srcF=null),e},visit(t,e){const n=this,r=e;if(16&t)return $t(n.source,n.srcF,r),n;1&t&&$t(n.add,n.addF,r),2&t&&$t(n.rem,n.remF,r),4&t&&$t(n.mod,n.modF,r);const i=n.source;if(8&t&&i){const t=n.add.length+n.mod.length;t===i.length||$t(i,t?Za(n,5):n.srcF,r)}return n}},ct(Ka,Xa,{fork(t){const e=new Xa(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&e.ADD&&this.visit(e.ADD,(t=>e.add.push(t))),t&e.REM&&this.visit(e.REM,(t=>e.rem.push(t))),t&e.MOD&&this.visit(e.MOD,(t=>e.mod.push(t)))),e},changed(t){return this.changes&t},modified(t){const e=this,n=e.fields;return n&&e.changes&e.MOD?_(t)?t.some((t=>n[t])):n[t]:0},filter(){s("MultiPulse does not support filtering.")},materialize(){s("MultiPulse does not support materialization.")},visit(t,e){const n=this,r=n.pulses,i=r.length;let o=0;if(t&n.SOURCE)for(;o<i;++o)r[o].visit(t,e);else for(;o<i;++o)r[o].stamp===n.stamp&&r[o].visit(t,e);return n}});const es={skip:!1,force:!1};function ns(t){let e=[];return{clear:()=>e=[],size:()=>e.length,peek:()=>e[0],push:n=>(e.push(n),rs(e,0,e.length-1,t)),pop:()=>{const n=e.pop();let r;return e.length?(r=e[0],e[0]=n,function(t,e,n){const r=e,i=t.length,o=t[e];let a,s=1+(e<<1);for(;s<i;)a=s+1,a<i&&n(t[s],t[a])>=0&&(s=a),t[e]=t[s],s=1+((e=s)<<1);t[e]=o,rs(t,r,e,n)}(e,0,t)):r=n,r}}}function rs(t,e,n,r){let i,o;const a=t[n];for(;n>e&&(o=n-1>>1,i=t[o],r(a,i)<0);)t[n]=i,n=o;return t[n]=a}function is(){this.logger(v()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Xo();try{this._loader=xa()}catch(t){}this._touched=wa(c),this._input={},this._pulse=null,this._heap=ns(((t,e)=>t.qrank-e.qrank)),this._postrun=[]}function os(t){return function(){return this._log[t].apply(this,arguments)}}function as(t,e){qa.call(this,t,null,e)}is.prototype={stamp(){return this._clock},loader(t){return arguments.length?(this._loader=t,this):this._loader},locale(t){return arguments.length?(this._locale=t,this):this._locale},logger(t){return arguments.length?(this._log=t,this):this._log},error:os("error"),warn:os("warn"),info:os("info"),debug:os("debug"),logLevel:os("level"),cleanThreshold:1e4,add:function(t,e,n,r){let i,o=1;return t instanceof qa?i=t:t&&t.prototype instanceof qa?i=new t:X(t)?i=new qa(null,t):(o=0,i=new qa(t,e)),this.rank(i),o&&(r=n,n=e),n&&this.connect(i,i.parameters(n,r)),this.touch(i),i},connect:function(t,e){const n=t.rank,r=e.length;for(let i=0;i<r;++i)if(n<e[i].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const e=[t];let n,r,i;for(;e.length;)if(this.rank(n=e.pop()),r=n._targets)for(i=r.length;--i>=0;)e.push(n=r[i]),n===t&&s("Cycle detected in dataflow graph.")},pulse:function(t,e,n){this.touch(t,n||es);const r=new Xa(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=e.pulse(r,i),this},touch:function(t,e){const n=e||es;return this._pulse?this._enqueue(t):this._touched.add(t),n.skip&&t.skip(!0),this},update:function(t,e,n){const r=n||es;return(t.set(e)||r.force)&&this.touch(t,r),this},changeset:Oa,ingest:function(t,e,n){return e=this.parse(e,n),this.pulse(t,this.changeset().insert(e))},parse:function(t,e){const n=this.locale();return _a(t,e,n.timeParse,n.utcParse)},preload:async function(t,e,n){const r=this,i=r._pending||function(t){let e;const n=new Promise((t=>e=t));return n.requests=0,n.done=()=>{0==--n.requests&&(t._pending=null,e(t))},t._pending=n}(r);i.requests+=1;const o=await r.request(e,n);return r.pulse(t,r.changeset().remove(p).insert(o.data||[])),i.done(),o},request:async function(t,e){const n=this;let r,i=0;try{r=await n.loader().load(t,{context:"dataflow",response:va(e&&e.type)});try{r=n.parse(r,e)}catch(e){i=-2,n.warn("Data ingestion failed",t,e)}}catch(e){i=-1,n.warn("Loading failed",t,e)}return{data:r,status:i}},events:function(t,e,n,r){const i=this,o=Wa(n,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let s;s="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):G(t);const u=s.length;for(let t=0;t<u;++t)s[t].addEventListener(e,a);return o},on:function(t,e,n,r,i){return(t instanceof qa?Ga:Ya)(this,t,e,n,r,i),this},evaluate:async function(t,e,n){const r=this,i=[];if(r._pulse)return ts(r);if(r._pending&&await r._pending,e&&await Ma(r,e),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const o=++r._clock;r._pulse=new Xa(r,o,t),r._touched.forEach((t=>r._enqueue(t,!0))),r._touched=wa(c);let a,s,u,l=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(s=a.run(r._getPulse(a,t)),s.then?s=await s:s.async&&(i.push(s.async),s=Va),s!==Va&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++l):r._enqueue(a,!0)}catch(t){r._heap.clear(),u=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${l} operators`),u&&(r._postrun=[],r.error(u)),r._postrun.length){const t=r._postrun.sort(((t,e)=>e.priority-t.priority));r._postrun=[];for(let e=0;e<t.length;++e)await Ma(r,t[e].callback)}return n&&await Ma(r,n),i.length&&Promise.all(i).then((t=>r.runAsync(null,(()=>{t.forEach((t=>{try{t(r)}catch(t){r.error(t)}}))})))),r},run:function(t,e,n){return this._pulse?ts(this):(this.evaluate(t,e,n),this)},runAsync:async function(t,e,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,e,n)).then(r,r),this._running},runAfter:function(t,e,n){if(this._pulse||e)this._postrun.push({priority:n||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,e){const n=t.stamp<this._clock;n&&(t.stamp=this._clock),(n||e)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,e){const n=t.source,r=this._clock;return n&&_(n)?new Ka(this,r,n.map((t=>t.pulse)),e):this._input[t.id]||function(t,e){if(e&&e.stamp===t.stamp)return e;t=t.fork(),e&&e!==Va&&(t.source=e.source);return t}(this._pulse,n&&n.pulse)}},ct(as,qa,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let e;return this.skip()?this.skip(!1):e=this.evaluate(t),e=e||t,e.then?e=e.then((t=>this.pulse=t)):e!==t.StopPropagation&&(this.pulse=e),e},evaluate(t){const e=this.marshall(t.stamp),n=this.transform(e,t);return e.clear(),n},transform(){}});const ss={};function us(t){const e=ls(t);return e&&e.Definition||null}function ls(t){return t=t&&t.toLowerCase(),at(ss,t)?ss[t]:null}function*cs(t,e){if(null==e)for(let e of t)null!=e&&""!==e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)r=e(r,++n,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function fs(t,e,n){const r=Float64Array.from(cs(t,n));return r.sort(Gt),e.map((t=>be(r,t)))}function hs(t,e){return fs(t,[.25,.5,.75],e)}function ds(t,e){const n=t.length,r=function(t,e){const n=function(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}(t,e);return n?Math.sqrt(n):n}(t,e),i=hs(t,e),o=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,o)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function ps(t){const e=t.maxbins||20,n=t.base||10,r=Math.log(n),i=t.divide||[5,2];let o,a,s,u,l,c,f=t.extent[0],h=t.extent[1];const d=t.span||h-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(u=d/e,l=0,c=t.steps.length;l<c&&t.steps[l]<u;++l);o=t.steps[Math.max(0,l-1)]}else{for(a=Math.ceil(Math.log(e)/r),s=t.minstep||0,o=Math.max(s,Math.pow(n,Math.round(Math.log(d)/r)-a));Math.ceil(d/o)>e;)o*=n;for(l=0,c=i.length;l<c;++l)u=o/i[l],u>=s&&d/u<=e&&(o=u)}u=Math.log(o);const p=u>=0?0:1+~~(-u/r),g=Math.pow(n,-p-1);return(t.nice||void 0===t.nice)&&(u=Math.floor(f/o+g)*o,f=f<u?u-o:u,h=Math.ceil(h/o)*o),{start:f,stop:h===f?f+o:h,step:o}}function gs(e,n,r,i){if(!e.length)return[void 0,void 0];const o=Float64Array.from(cs(e,i)),a=o.length,s=n;let u,l,c,f;for(c=0,f=Array(s);c<s;++c){for(u=0,l=0;l<a;++l)u+=o[~~(t.random()*a)];f[c]=u/a}return f.sort(Gt),[xe(f,r/2),xe(f,1-r/2)]}function ms(t,e,n,r){r=r||(t=>t);const i=t.length,o=new Float64Array(i);let a,s=0,u=1,l=r(t[0]),c=l,f=l+e;for(;u<i;++u){if(a=r(t[u]),a>=f){for(c=(l+c)/2;s<u;++s)o[s]=c;f=a+e,l=a}c=a}for(c=(l+c)/2;s<u;++s)o[s]=c;return n?function(t,e){const n=t.length;let r,i,o=0,a=1;for(;t[o]===t[a];)++a;for(;a<n;){for(r=a+1;t[a]===t[r];)++r;if(t[a]-t[a-1]<e){for(i=a+(o+r-a-a>>1);i<a;)t[i++]=t[a];for(;i>a;)t[i--]=t[o]}o=a,a=r}return t}(o,e+e/4):o}t.random=Math.random;const ys=Math.sqrt(2*Math.PI),vs=Math.SQRT2;let _s=NaN;function xs(e,n){e=e||0,n=null==n?1:n;let r,i,o=0,a=0;if(_s==_s)o=_s,_s=NaN;else{do{o=2*t.random()-1,a=2*t.random()-1,r=o*o+a*a}while(0===r||r>1);i=Math.sqrt(-2*Math.log(r)/r),o*=i,_s=a*i}return e+o*n}function bs(t,e,n){const r=(t-(e||0))/(n=null==n?1:n);return Math.exp(-.5*r*r)/(n*ys)}function ws(t,e,n){const r=(t-(e=e||0))/(n=null==n?1:n),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let e;i<7.07106781186547?(e=.0352624965998911*i+.700383064443688,e=e*i+6.37396220353165,e=e*i+33.912866078383,e=e*i+112.079291497871,e=e*i+221.213596169931,e=e*i+220.206867912376,o=t*e,e=.0883883476483184*i+1.75566716318264,e=e*i+16.064177579207,e=e*i+86.7807322029461,e=e*i+296.564248779674,e=e*i+637.333633378831,e=e*i+793.826512519948,e=e*i+440.413735824752,o/=e):(e=i+.65,e=i+4/e,e=i+3/e,e=i+2/e,e=i+1/e,o=t/e/2.506628274631)}return r>0?1-o:o}function Ms(t,e,n){return t<0||t>1?NaN:(e||0)+(null==n?1:n)*vs*function(t){let e,n=-Math.log((1-t)*(1+t));n<6.25?(n-=3.125,e=-364441206401782e-35,e=e*n-16850591381820166e-35,e=128584807152564e-32+e*n,e=11157877678025181e-33+e*n,e=e*n-1333171662854621e-31,e=20972767875968562e-33+e*n,e=6637638134358324e-30+e*n,e=e*n-4054566272975207e-29,e=e*n-8151934197605472e-29,e=26335093153082323e-28+e*n,e=e*n-12975133253453532e-27,e=e*n-5415412054294628e-26,e=1.0512122733215323e-9+e*n,e=e*n-4.112633980346984e-9,e=e*n-2.9070369957882005e-8,e=4.2347877827932404e-7+e*n,e=e*n-13654692000834679e-22,e=e*n-13882523362786469e-21,e=.00018673420803405714+e*n,e=e*n-.000740702534166267,e=e*n-.006033670871430149,e=.24015818242558962+e*n,e=1.6536545626831027+e*n):n<16?(n=Math.sqrt(n)-3.25,e=2.2137376921775787e-9,e=9.075656193888539e-8+e*n,e=e*n-2.7517406297064545e-7,e=1.8239629214389228e-8+e*n,e=15027403968909828e-22+e*n,e=e*n-4013867526981546e-21,e=29234449089955446e-22+e*n,e=12475304481671779e-21+e*n,e=e*n-47318229009055734e-21,e=6828485145957318e-20+e*n,e=24031110387097894e-21+e*n,e=e*n-.0003550375203628475,e=.0009532893797373805+e*n,e=e*n-.0016882755560235047,e=.002491442096107851+e*n,e=e*n-.003751208507569241,e=.005370914553590064+e*n,e=1.0052589676941592+e*n,e=3.0838856104922208+e*n):Number.isFinite(n)?(n=Math.sqrt(n)-5,e=-27109920616438573e-27,e=e*n-2.555641816996525e-10,e=1.5076572693500548e-9+e*n,e=e*n-3.789465440126737e-9,e=7.61570120807834e-9+e*n,e=e*n-1.496002662714924e-8,e=2.914795345090108e-8+e*n,e=e*n-6.771199775845234e-8,e=2.2900482228026655e-7+e*n,e=e*n-9.9298272942317e-7,e=4526062597223154e-21+e*n,e=e*n-1968177810553167e-20,e=7599527703001776e-20+e*n,e=e*n-.00021503011930044477,e=e*n-.00013871931833623122,e=1.0103004648645344+e*n,e=4.849906401408584+e*n):e=1/0;return e*t}(2*t-1)}function ks(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>xs(n,r),pdf:t=>bs(t,n,r),cdf:t=>ws(t,n,r),icdf:t=>Ms(t,n,r)};return i.mean(t).stdev(e)}function As(e,n){const r=ks();let i=0;const o={data(t){return arguments.length?(e=t,i=t?t.length:0,o.bandwidth(n)):e},bandwidth(t){return arguments.length?(!(n=t)&&e&&(n=ds(e)),o):n},sample:()=>e[~~(t.random()*i)]+n*r.sample(),pdf(t){let o=0,a=0;for(;a<i;++a)o+=r.pdf((t-e[a])/n);return o/n/i},cdf(t){let o=0,a=0;for(;a<i;++a)o+=r.cdf((t-e[a])/n);return o/i},icdf(){throw Error("KDE icdf not supported.")}};return o.data(e)}function Es(t,e){return t=t||0,e=null==e?1:e,Math.exp(t+xs()*e)}function Ds(t,e,n){if(t<=0)return 0;e=e||0,n=null==n?1:n;const r=(Math.log(t)-e)/n;return Math.exp(-.5*r*r)/(n*ys*t)}function Cs(t,e,n){return ws(Math.log(t),e,n)}function Fs(t,e,n){return Math.exp(Ms(t,e,n))}function Ss(t,e){let n,r;const i={mean(t){return arguments.length?(n=t||0,i):n},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Es(n,r),pdf:t=>Ds(t,n,r),cdf:t=>Cs(t,n,r),icdf:t=>Fs(t,n,r)};return i.mean(t).stdev(e)}function Ts(e,n){let r,i=0;const o={weights(t){return arguments.length?(r=function(t){const e=[];let n,r=0;for(n=0;n<i;++n)r+=e[n]=null==t[n]?1:+t[n];for(n=0;n<i;++n)e[n]/=r;return e}(n=t||[]),o):n},distributions(t){return arguments.length?(t?(i=t.length,e=t):(i=0,e=[]),o.weights(n)):e},sample(){const n=t.random();let o=e[i-1],a=r[0],s=0;for(;s<i-1;a+=r[++s])if(n<a){o=e[s];break}return o.sample()},pdf(t){let n=0,o=0;for(;o<i;++o)n+=r[o]*e[o].pdf(t);return n},cdf(t){let n=0,o=0;for(;o<i;++o)n+=r[o]*e[o].cdf(t);return n},icdf(){throw Error("Mixture icdf not supported.")}};return o.distributions(e).weights(n)}function $s(e,n){return null==n&&(n=null==e?1:e,e=0),e+(n-e)*t.random()}function zs(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=e&&t<=n?1/(n-e):0}function Bs(t,e,n){return null==n&&(n=null==e?1:e,e=0),t<e?0:t>n?1:(t-e)/(n-e)}function Os(t,e,n){return null==n&&(n=null==e?1:e,e=0),t>=0&&t<=1?e+t*(n-e):NaN}function Ns(t,e){let n,r;const i={min(t){return arguments.length?(n=t||0,i):n},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>$s(n,r),pdf:t=>zs(t,n,r),cdf:t=>Bs(t,n,r),icdf:t=>Os(t,n,r)};return null==e&&(e=null==t?1:t,t=0),i.min(t).max(e)}function Rs(t,e,n){let r=0,i=0;for(const o of t){const t=n(o);null==e(o)||null==t||isNaN(t)||(r+=(t-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function Us(t,e,n,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(n-t*e)/i;return[e-o*t,o]}function Ls(t,e,n,r){t=t.filter((t=>{let r=e(t),i=n(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,n)=>e(t)-e(n)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let s,u,l,c=0,f=0,h=0;for(l of t)o[c]=s=+e(l),a[c]=u=+n(l),++c,f+=(s-f)/c,h+=(u-h)/c;for(c=0;c<i;++c)o[c]-=f,a[c]-=h;return[o,a,f,h]}function qs(t,e,n,r){let i,o,a=-1;for(const s of t)i=e(s),o=n(s),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function Ps(t,e,n,r,i){let o=0,a=0;return qs(t,e,n,((t,e)=>{const n=e-i(t),s=e-r;o+=n*n,a+=s*s})),1-o/a}function js(t,e,n){let r=0,i=0,o=0,a=0,s=0;qs(t,e,n,((t,e)=>{++s,r+=(t-r)/s,i+=(e-i)/s,o+=(t*e-o)/s,a+=(t*t-a)/s}));const u=Us(r,i,o,a),l=t=>u[0]+u[1]*t;return{coef:u,predict:l,rSquared:Ps(t,e,n,i,l)}}function Is(t,e,n){let r=0,i=0,o=0,a=0,s=0;qs(t,e,n,((t,e)=>{++s,t=Math.log(t),r+=(t-r)/s,i+=(e-i)/s,o+=(t*e-o)/s,a+=(t*t-a)/s}));const u=Us(r,i,o,a),l=t=>u[0]+u[1]*Math.log(t);return{coef:u,predict:l,rSquared:Ps(t,e,n,i,l)}}function Ws(t,e,n){const[r,i,o,a]=Ls(t,e,n);let s,u,l,c=0,f=0,h=0,d=0,p=0;qs(t,e,n,((t,e)=>{s=r[p++],u=Math.log(e),l=s*e,c+=(e*u-c)/p,f+=(l-f)/p,h+=(l*u-h)/p,d+=(s*l-d)/p}));const[g,m]=Us(f/a,c/a,h/a,d/a),y=t=>Math.exp(g+m*(t-o));return{coef:[Math.exp(g-m*o),m],predict:y,rSquared:Ps(t,e,n,a,y)}}function Hs(t,e,n){let r=0,i=0,o=0,a=0,s=0,u=0;qs(t,e,n,((t,e)=>{const n=Math.log(t),l=Math.log(e);++u,r+=(n-r)/u,i+=(l-i)/u,o+=(n*l-o)/u,a+=(n*n-a)/u,s+=(e-s)/u}));const l=Us(r,i,o,a),c=t=>l[0]*Math.pow(t,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ps(t,e,n,s,c)}}function Ys(t,e,n){const[r,i,o,a]=Ls(t,e,n),s=r.length;let u,l,c,f,h=0,d=0,p=0,g=0,m=0;for(u=0;u<s;)l=r[u],c=i[u++],f=l*l,h+=(f-h)/u,d+=(f*l-d)/u,p+=(f*f-p)/u,g+=(l*c-g)/u,m+=(f*c-m)/u;const y=p-h*h,v=h*y-d*d,_=(m*h-g*d)/v,x=(g*y-m*d)/v,b=-_*h,w=t=>_*(t-=o)*t+x*t+b+a;return{coef:[b-x*o+_*o*o+a,x-2*_*o,_],predict:w,rSquared:Ps(t,e,n,a,w)}}function Gs(t,e,n,r){if(0===r)return Rs(t,e,n);if(1===r)return js(t,e,n);if(2===r)return Ys(t,e,n);const[i,o,a,s]=Ls(t,e,n),u=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<u;++p)g+=Math.pow(i[p],h)*o[p];for(l.push(g),m=new Float64Array(f),d=0;d<f;++d){for(p=0,g=0;p<u;++p)g+=Math.pow(i[p],h+d);m[d]=g}c.push(m)}c.push(l);const y=function(t){const e=t.length-1,n=[];let r,i,o,a,s;for(r=0;r<e;++r){for(a=r,i=r+1;i<e;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<e+1;++o)s=t[o][r],t[o][r]=t[o][a],t[o][a]=s;for(i=r+1;i<e;++i)for(o=e;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=e-1;i>=0;--i){for(s=0,o=i+1;o<e;++o)s+=t[o][i]*n[o];n[i]=(t[e][i]-s)/t[i][i]}return n}(c),v=t=>{t-=a;let e=s+y[0]+y[1]*t+y[2]*t*t;for(h=3;h<f;++h)e+=y[h]*Math.pow(t,h);return e};return{coef:Vs(f,y,-a,s),predict:v,rSquared:Ps(t,e,n,s,v)}}function Vs(t,e,n,r){const i=Array(t);let o,a,s,u;for(o=0;o<t;++o)i[o]=0;for(o=t-1;o>=0;--o)for(s=e[o],u=1,i[o]+=s,a=1;a<=o;++a)u*=(o+1-a)/a,i[o-a]+=s*Math.pow(n,a)*u;return i[0]+=r,i}function Xs(t,e,n,r){const[i,o,a,s]=Ls(t,e,n,!0),u=i.length,l=Math.max(2,~~(r*u)),c=new Float64Array(u),f=new Float64Array(u),h=new Float64Array(u).fill(1);for(let t=-1;++t<=2;){const e=[0,l-1];for(let t=0;t<u;++t){const n=i[t],r=e[0],a=e[1],s=n-i[r]>i[a]-n?r:a;let u=0,l=0,d=0,p=0,g=0;const m=1/Math.abs(i[s]-n||1);for(let t=r;t<=a;++t){const e=i[t],r=o[t],a=Js(Math.abs(n-e)*m)*h[t],s=e*a;u+=a,l+=s,d+=r*a,p+=r*s,g+=e*s}const[y,v]=Us(l/u,d/u,p/u,g/u);c[t]=y+v*n,f[t]=Math.abs(o[t]-c[t]),Zs(i,t+1,e)}if(2===t)break;const n=we(f);if(Math.abs(n)<1e-12)break;for(let t,e,r=0;r<u;++r)t=f[r]/(6*n),h[r]=t>=1?1e-12:(e=1-t*t)*e}return function(t,e,n,r){const i=t.length,o=[];let a,s=0,u=0,l=[];for(;s<i;++s)a=t[s]+n,l[0]===a?l[1]+=(e[s]-l[1])/++u:(u=0,l[1]+=r,l=[a,e[s]],o.push(l));return l[1]+=r,o}(i,c,a,s)}function Js(t){return(t=1-t*t*t)*t*t}function Zs(t,e,n){const r=t[e];let i=n[0],o=n[1]+1;if(!(o>=t.length))for(;e>i&&t[o]-r<=r-t[i];)n[0]=++i,n[1]=o,++o}const Qs=.5*Math.PI/180;function Ks(t,e,n,r){n=n||25,r=Math.max(n,r||200);const i=e=>[e,t(e)],o=e[0],a=e[1],s=a-o,u=s/r,l=[i(o)],c=[];if(n===r){for(let t=1;t<r;++t)l.push(i(o+t/n*s));return l.push(i(a)),l}c.push(i(a));for(let t=n;--t>0;)c.push(i(o+t/n*s));let f=l[0],h=c[c.length-1];const d=1/s,p=function(t,e){let n=t,r=t;const i=e.length;for(let t=0;t<i;++t){const i=e[t][1];i<n&&(n=i),i>r&&(r=i)}return 1/(r-n)}(f[1],c);for(;h;){const t=i((f[0]+h[0])/2);t[0]-f[0]>=u&&tu(f,t,h,d,p)>Qs?c.push(t):(f=h,l.push(h),c.pop()),h=c[c.length-1]}return l}function tu(t,e,n,r,i){const o=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0])),a=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0]));return Math.abs(o-a)}function eu(t){return t&&t.length?1===t.length?t[0]:(e=t,t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r<n;++r)i+="|"+e[r](t);return i}):function(){return""};var e}function nu(t,e,n){return n||t+(e?"_"+e:"")}const ru=()=>{},iu={init:ru,add:ru,rem:ru,idx:0},ou={values:{init:t=>t.cell.store=!0,value:t=>t.cell.data.values(),idx:-1},count:{value:t=>t.cell.num},__count__:{value:t=>t.missing+t.valid},missing:{value:t=>t.missing},valid:{value:t=>t.valid},sum:{init:t=>t.sum=0,value:t=>t.valid?t.sum:void 0,add:(t,e)=>t.sum+=+e,rem:(t,e)=>t.sum-=e},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,e)=>t.product*=e,rem:(t,e)=>t.product/=e},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,e)=>(t.mean_d=e-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,e)=>(t.mean_d=e-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?Math.max(0,t.dev)/(t.valid-1):void 0,add:(t,e)=>t.dev+=t.mean_d*(e-t.mean),rem:(t,e)=>t.dev-=t.mean_d*(e-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid?Math.max(0,t.dev)/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(Math.max(0,t.dev)/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid?Math.sqrt(Math.max(0,t.dev)/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(Math.max(0,t.dev)/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,e)=>{(e<t.min||void 0===t.min)&&(t.min=e)},rem:(t,e)=>{e<=t.min&&(t.min=NaN)},req:["values"],idx:4},max:{init:t=>t.max=void 0,value:t=>t.max=Number.isNaN(t.max)?t.cell.data.max(t.get):t.max,add:(t,e)=>{(e>t.max||void 0===t.max)&&(t.max=e)},rem:(t,e)=>{e>=t.max&&(t.max=NaN)},req:["values"],idx:4},argmin:{init:t=>t.argmin=void 0,value:t=>t.argmin||t.cell.data.argmin(t.get),add:(t,e,n)=>{e<t.min&&(t.argmin=n)},rem:(t,e)=>{e<=t.min&&(t.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:t=>t.argmax=void 0,value:t=>t.argmax||t.cell.data.argmax(t.get),add:(t,e,n)=>{e>t.max&&(t.argmax=n)},rem:(t,e)=>{e>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,e)=>{t.exp=0,t.exp_r=e},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,e)=>t.exp=t.exp_r*t.exp+e,rem:(t,e)=>t.exp=(t.exp-e/t.exp_r**(t.valid-1))/t.exp_r},exponentialb:{value:t=>t.valid?t.exp*(1-t.exp_r):void 0,req:["exponential"],idx:1}},au=Object.keys(ou).filter((t=>"__count__"!==t));function su(t,e,n){return ou[t](n,e)}function uu(t,e){return t.idx-e.idx}function lu(){this.valid=0,this.missing=0,this._ops.forEach((t=>null==t.aggregate_param?t.init(this):t.init(this,t.aggregate_param)))}function cu(t,e){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((n=>n.add(this,t,e)))):++this.missing}function fu(t,e){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((n=>n.rem(this,t,e)))):--this.missing}function hu(t){return this._out.forEach((e=>t[e.out]=e.value(this))),t}function du(t,e){const n=e||f,r=function(t){const e={};t.forEach((t=>e[t.name]=t));const n=t=>{t.req&&t.req.forEach((t=>{e[t]||n(e[t]=ou[t]())}))};return t.forEach(n),Object.values(e).sort(uu)}(t),i=t.slice().sort(uu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=lu,o.prototype.add=cu,o.prototype.rem=fu,o.prototype.set=hu,o.prototype.get=n,o.fields=t.map((t=>t.out)),o}function pu(t){this._key=t?l(t):Da,this.reset()}[...au,"__count__"].forEach((t=>{ou[t]=function(t,e){return(n,r)=>rt({name:t,aggregate_param:r,out:n||t},iu,e)}(t,ou[t])}));const gu=pu.prototype;function mu(t){as.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}gu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},gu.add=function(t){this._add.push(t)},gu.rem=function(t){this._rem.push(t)},gu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,e=this._rem,n=this._key,r=t.length,i=e.length,o=Array(r-i),a={};let s,u,l;for(s=0;s<i;++s)a[n(e[s])]=1;for(s=0,u=0;s<r;++s)a[n(l=t[s])]?a[n(l)]=0:o[u++]=l;return this._rem=[],this._add=o},gu.distinct=function(t){const e=this.values(),n={};let r,i=e.length,o=0;for(;--i>=0;)r=t(e[i])+"",at(n,r)||(n[r]=1,++o);return o},gu.extent=function(t){if(this._get!==t||!this._ext){const e=this.values(),n=ot(e,t);this._ext=[e[n[0]],e[n[1]]],this._get=t}return this._ext},gu.argmin=function(t){return this.extent(t)[0]||{}},gu.argmax=function(t){return this.extent(t)[1]||{}},gu.min=function(t){const e=this.extent(t)[0];return null!=e?t(e):void 0},gu.max=function(t){const e=this.extent(t)[1];return null!=e?t(e):void 0},gu.quartile=function(t){return this._get===t&&this._q||(this._q=hs(this.values(),t),this._get=t),this._q},gu.q1=function(t){return this.quartile(t)[0]},gu.q2=function(t){return this.quartile(t)[1]},gu.q3=function(t){return this.quartile(t)[2]},gu.ci=function(t){return this._get===t&&this._ci||(this._ci=gs(this.values(),1e3,.05,t),this._get=t),this._ci},gu.ci0=function(t){return this.ci(t)[0]},gu.ci1=function(t){return this.ci(t)[1]},mu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:au},{name:"aggregate_params",type:"number",null:!0,array:!0},{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"}]},ct(mu,as,{transform(t,e){const n=this,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.modified();return n.stamp=r.stamp,n.value&&(i||e.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(t):Object.create(null),e.visit(e.SOURCE,(t=>n.add(t)))):(n.value=n.value||n.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),r.modifies(n._outputs),n._drop=!1!==t.drop,t.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),e.clean()&&n._drop&&r.clean(!0).runAfter((()=>this.clean())),n.changes(r)},cross(){const t=this,e=t.value,n=t._dnames,r=n.map((()=>({}))),i=n.length;function o(t){let e,o,a,s;for(e in t)for(a=t[e].tuple,o=0;o<i;++o)r[o][s=a[n[o]]]=s}o(t._prev),o(e),function o(a,s,u){const l=n[u],c=r[u++];for(const n in c){const r=a?a+"|"+n:n;s[l]=c[n],u<i?o(r,s,u):e[r]||t.cell(r,s)}}("",{},0)},init(t){const e=this._inputs=[],i=this._outputs=[],o={};function a(t){const n=G(r(t)),i=n.length;let a,s=0;for(;s<i;++s)o[a=n[s]]||(o[a]=1,e.push(a))}this._dims=G(t.groupby),this._dnames=this._dims.map((t=>{const e=n(t);return a(t),i.push(e),e})),this.cellkey=t.key?t.key:eu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const u=t.fields||[null],l=t.ops||["count"],c=t.aggregate_params||[null],f=t.as||[],h=u.length,d={};let p,g,m,y,v,_,x;for(h!==l.length&&s("Unmatched number of fields and aggregate ops."),x=0;x<h;++x)p=u[x],g=l[x],m=c[x]||null,null==p&&"count"!==g&&s("Null aggregate field specified."),v=n(p),_=nu(g,v,f[x]),i.push(_),"count"!==g?(y=d[v],y||(a(p),y=d[v]=[],y.field=p,this._measures.push(y)),"count"!==g&&(this._countOnly=!1),y.push(su(g,m,_))):this._counts.push(_);return this._measures=this._measures.map((t=>du(t,t.field))),Object.create(null)},cellkey:eu(),cell(t,e){let n=this.value[t];return n?0===n.num&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[t]=this.newcell(t,e),this._adds[this._alen++]=n),n},newcell(t,e){const n={key:t,num:0,agg:null,tuple:this.newtuple(e,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){const t=this._measures,e=t.length;n.agg=Array(e);for(let r=0;r<e;++r)n.agg[r]=new t[r](n)}return n.store&&(n.data=new pu),n},newtuple(t,e){const n=this._dnames,r=this._dims,i=r.length,o={};for(let e=0;e<i;++e)o[n[e]]=r[e](t);return e?$a(e.tuple,o):Fa(o)},clean(){const t=this.value;for(const e in t)0===t[e].num&&delete t[e]},add(t){const e=this.cellkey(t),n=this.cell(e,t);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(t);const r=n.agg;for(let e=0,n=r.length;e<n;++e)r[e].add(r[e].get(t),t)},rem(t){const e=this.cellkey(t),n=this.cell(e,t);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(t);const r=n.agg;for(let e=0,n=r.length;e<n;++e)r[e].rem(r[e].get(t),t)},celltuple(t){const e=t.tuple,n=this._counts;t.store&&t.data.values();for(let r=0,i=n.length;r<i;++r)e[n[r]]=t.num;if(!this._countOnly){const n=t.agg;for(let t=0,r=n.length;t<r;++t)n[t].set(e)}return e},changes(t){const e=this._adds,n=this._mods,r=this._prev,i=this._drop,o=t.add,a=t.rem,s=t.mod;let u,l,c,f;if(r)for(l in r)u=r[l],i&&!u.num||a.push(u.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(e[c])),e[c]=null;for(c=0,f=this._mlen;c<f;++c)u=n[c],(0===u.num&&i?a:s).push(this.celltuple(u)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,t}});function yu(t){as.call(this,null,t)}function vu(t,e,n){const r=t;let i=e||[],o=n||[],a={},s=0;return{add:t=>o.push(t),remove:t=>a[r(t)]=++s,size:()=>i.length,data:(t,e)=>(s&&(i=i.filter((t=>!a[r(t)])),a={},s=0),e&&t&&i.sort(t),o.length&&(i=t?bt(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function _u(t){as.call(this,[],t)}function xu(t){qa.call(this,null,bu,t)}function bu(t){return this.value&&!t.modified()?this.value:J(t.fields,t.orders)}function wu(t){as.call(this,null,t)}function Mu(t){as.call(this,null,t)}yu.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"]}]},ct(yu,as,{transform(t,e){const n=!1!==t.interval,i=this._bins(t),o=i.start,a=i.step,s=t.as||["bin0","bin1"],u=s[0],l=s[1];let c;return c=t.modified()?(e=e.reflow(!0)).SOURCE:e.modified(r(t.field))?e.ADD_MOD:e.ADD,e.visit(c,n?t=>{const e=i(t);t[u]=e,t[l]=null==e?null:o+a*(1+(e-o)/a)}:t=>t[u]=i(t)),e.modifies(n?s:u)},_bins(t){if(this.value&&!t.modified())return this.value;const i=t.field,o=ps(t),a=o.step;let s,u,l=o.start,c=l+Math.ceil((o.stop-l)/a)*a;null!=(s=t.anchor)&&(u=s-(l+a*Math.floor((s-l)/a)),l+=u,c+=u);const f=function(t){let e=E(i(t));return null==e?null:e<l?-1/0:e>c?1/0:(e=Math.max(l,Math.min(e,c-a)),l+a*Math.floor(1e-14+(e-l)/a))};return f.start=l,f.stop=c,f.step=a,this.value=e(f,r(i),t.name||"bin_"+n(i))}}),_u.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ct(_u,as,{transform(t,e){const n=e.fork(e.ALL),r=vu(Da,this.value,n.materialize(n.ADD).add),i=t.sort,o=e.changed()||i&&(t.modified("sort")||e.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(o),this.value=n.source=r.data(za(i),o),e.source&&e.source.root&&(this.value.root=e.source.root),n}}),ct(xu,qa),wu.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"]}]},ct(wu,as,{transform(t,e){const n=e=>n=>{for(var r,i=function(t,e,n){switch(e){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(n)}(s(n),t.case,o)||[],u=0,l=i.length;u<l;++u)a.test(r=i[u])||e(r)},r=this._parameterCheck(t,e),i=this._counts,o=this._match,a=this._stop,s=t.field,u=t.as||["text","count"],l=n((t=>i[t]=1+(i[t]||0))),c=n((t=>i[t]-=1));return r?e.visit(e.SOURCE,l):(e.visit(e.ADD,l),e.visit(e.REM,c)),this._finish(e,u)},_parameterCheck(t,e){let n=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),n=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),n=!0),(t.modified("field")||e.modified(t.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(t,e){const n=this._counts,r=this._tuples||(this._tuples={}),i=e[0],o=e[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let s,u,l;for(s in n)u=r[s],l=n[s]||0,!u&&l?(r[s]=u=Fa({}),u[i]=s,u[o]=l,a.add.push(u)):0===l?(u&&a.rem.push(u),n[s]=null,r[s]=null):u[o]!==l&&(u[o]=l,a.mod.push(u));return a.modifies(e)}}),Mu.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ct(Mu,as,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||e.changed(e.ADD_REM)||t.modified("as")||t.modified("filter");let s=this.value;return a?(s&&(n.rem=s),s=e.materialize(e.SOURCE).source,n.add=this.value=function(t,e,n,r){for(var i,o,a=[],s={},u=t.length,l=0;l<u;++l)for(s[e]=o=t[l],i=0;i<u;++i)s[n]=t[i],r(s)&&(a.push(Fa(s)),(s={})[e]=o);return a}(s,i,o,t.filter||p)):n.mod=s,n.source=this.value,n.modifies(r)}});const ku={kde:As,mixture:Ts,normal:ks,lognormal:Ss,uniform:Ns},Au="function";function Eu(t,e){const n=t[Au];at(ku,n)||s("Unknown distribution function: "+n);const r=ku[n]();for(const n in t)"field"===n?r.data((t.from||e()).map(t[n])):"distributions"===n?r[n](t[n].map((t=>Eu(t,e)))):typeof r[n]===Au&&r[n](t[n]);return r}function Du(t){as.call(this,null,t)}const Cu=[{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}]}],Fu={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:Cu},{name:"weights",type:"number",array:!0}]};function Su(t,e){return t?t.map(((t,r)=>e[r]||n(t))):null}function Tu(t,e,n){const r=[],i=t=>t(u);let o,a,s,u,l,c;if(null==e)r.push(t.map(n));else for(o={},a=0,s=t.length;a<s;++a)u=t[a],l=e.map(i),c=o[l],c||(o[l]=c=[],c.dims=l,r.push(c)),c.push(n(u));return r}Du.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:Cu.concat(Fu)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ct(Du,as,{transform(t,e){const n=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const r=Eu(t.distribution,function(t){return()=>t.materialize(t.SOURCE).source}(e)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&s("Invalid density method: "+a),t.extent||r.data||s("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],l=Ks(a,t.extent||it(r.data()),i,o).map((t=>{const e={};return e[u[0]]=t[0],e[u[1]]=t[1],Fa(e)}));this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function $u(t){as.call(this,null,t)}$u.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:"bin"}]};function zu(t){qa.call(this,null,Bu,t),this.modified(!0)}function Bu(t){const i=t.expr;return this.value&&!t.modified("expr")?this.value:e((e=>i(e,t)),r(i),n(i))}function Ou(t){as.call(this,[void 0,void 0],t)}function Nu(t,e){qa.call(this,t),this.parent=e,this.count=0}function Ru(t){as.call(this,{},t),this._keys=ut();const e=this._targets=[];e.active=0,e.forEach=t=>{for(let n=0,r=e.active;n<r;++n)t(e[n],n,e)}}function Uu(t){qa.call(this,null,Lu,t)}function Lu(t){return this.value&&!t.modified()?this.value:_(t.name)?G(t.name).map((t=>l(t))):l(t.name,t.as)}function qu(t){as.call(this,ut(),t)}function Pu(t){as.call(this,[],t)}function ju(t){as.call(this,[],t)}function Iu(t){as.call(this,null,t)}function Wu(t){as.call(this,[],t)}ct($u,as,{transform(t,e){if(this.value&&!t.modified()&&!e.changed())return e;const n=e.materialize(e.SOURCE).source,r=Tu(e.source,t.groupby,f),i=t.smooth||!1,o=t.field,a=t.step||((t,e)=>kt(it(t,e))/30)(n,o),s=za(((t,e)=>o(t)-o(e))),u=t.as||"bin",l=r.length;let c,h=1/0,d=-1/0,p=0;for(;p<l;++p){const t=r[p].sort(s);c=-1;for(const e of ms(t,a,i,o))e<h&&(h=e),e>d&&(d=e),t[++c][u]=e}return this.value={start:h,stop:d,step:a},e.reflow(!0).modifies(u)}}),ct(zu,qa),Ou.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ct(Ou,as,{transform(t,e){const r=this.value,i=t.field,o=e.changed()||e.modified(i.fields)||t.modified("field");let a=r[0],s=r[1];if((o||null==a)&&(a=1/0,s=-1/0),e.visit(o?e.SOURCE:e.ADD,(t=>{const e=E(i(t));null!=e&&(e<a&&(a=e),e>s&&(s=e))})),!Number.isFinite(a)||!Number.isFinite(s)){let t=n(i);t&&(t=` for field "${t}"`),e.dataflow.warn(`Infinite extent${t}: [${a}, ${s}]`),a=s=void 0}this.value=[a,s]}}),ct(Nu,qa,{connect(t){return this.detachSubflow=t.detachSubflow,this.targets().add(t),t.source=this},add(t){this.count+=1,this.value.add.push(t)},rem(t){this.count-=1,this.value.rem.push(t)},mod(t){this.value.mod.push(t)},init(t){this.value.init(t,t.NO_SOURCE)},evaluate(){return this.value}}),ct(Ru,as,{activate(t){this._targets[this._targets.active++]=t},subflow(t,e,n,r){const i=this.value;let o,a,s=at(i,t)&&i[t];return s?s.value.stamp<n.stamp&&(s.init(n),this.activate(s)):(a=r||(a=this._group[t])&&a.tuple,o=n.dataflow,s=new Nu(n.fork(n.NO_SOURCE),this),o.add(s).connect(e(o,t,a)),i[t]=s,this.activate(s)),s},clean(){const t=this.value;let e=0;for(const n in t)if(0===t[n].count){const r=t[n].detachSubflow;r&&r(),delete t[n],++e}if(e){const t=this._targets.filter((t=>t&&t.count>0));this.initTargets(t)}},initTargets(t){const e=this._targets,n=e.length,r=t?t.length:0;let i=0;for(;i<r;++i)e[i]=t[i];for(;i<n&&null!=e[i];++i)e[i]=null;e.active=r},transform(t,e){const n=e.dataflow,r=t.key,i=t.subflow,o=this._keys,a=t.modified("key"),s=t=>this.subflow(t,i,e);return this._group=t.group||{},this.initTargets(),e.visit(e.REM,(t=>{const e=Da(t),n=o.get(e);void 0!==n&&(o.delete(e),s(n).rem(t))})),e.visit(e.ADD,(t=>{const e=r(t);o.set(Da(t),e),s(e).add(t)})),a||e.modified(r.fields)?e.visit(e.MOD,(t=>{const e=Da(t),n=o.get(e),i=r(t);n===i?s(i).mod(t):(o.set(e,i),s(n).rem(t),s(i).add(t))})):e.changed(e.MOD)&&e.visit(e.MOD,(t=>{s(o.get(Da(t))).mod(t)})),a&&e.visit(e.REFLOW,(t=>{const e=Da(t),n=o.get(e),i=r(t);n!==i&&(o.set(e,i),s(n).rem(t),s(i).add(t))})),e.clean()?n.runAfter((()=>{this.clean(),o.clean()})):o.empty>n.cleanThreshold&&n.runAfter(o.clean),e}}),ct(Uu,qa),qu.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ct(qu,as,{transform(t,e){const n=e.dataflow,r=this.value,i=e.fork(),o=i.add,a=i.rem,s=i.mod,u=t.expr;let l=!0;function c(e){const n=Da(e),i=u(e,t),c=r.get(n);i&&c?(r.delete(n),o.push(e)):i||c?l&&i&&!c&&s.push(e):(r.set(n,1),a.push(e))}return e.visit(e.REM,(t=>{const e=Da(t);r.has(e)?r.delete(e):a.push(t)})),e.visit(e.ADD,(e=>{u(e,t)?o.push(e):r.set(Da(e),1)})),e.visit(e.MOD,c),t.modified()&&(l=!1,e.visit(e.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}}),Pu.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}]},ct(Pu,as,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Su(r,t.as||[]),o=t.index||null,a=i.length;return n.rem=this.value,e.visit(e.SOURCE,(t=>{const e=r.map((e=>e(t))),s=e.reduce(((t,e)=>Math.max(t,e.length)),0);let u,l,c,f=0;for(;f<s;++f){for(l=Sa(t),u=0;u<a;++u)l[i[u]]=null==(c=e[u][f])?null:c;o&&(l[o]=f),n.add.push(l)}})),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(i)}}),ju.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"]}]},ct(ju,as,{transform(t,e){const r=e.fork(e.NO_SOURCE),i=t.fields,o=i.map(n),a=t.as||["key","value"],s=a[0],u=a[1],l=i.length;return r.rem=this.value,e.visit(e.SOURCE,(t=>{for(let e,n=0;n<l;++n)e=Sa(t),e[s]=o[n],e[u]=i[n](t),r.add.push(e)})),this.value=r.source=r.add,r.modifies(a)}}),Iu.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},ct(Iu,as,{transform(t,e){const n=t.expr,r=t.as,i=t.modified(),o=t.initonly?e.ADD:i?e.SOURCE:e.modified(n.fields)||e.modified(r)?e.ADD_MOD:e.ADD;return i&&(e=e.materialize().reflow(!0)),t.initonly||e.modifies(r),e.visit(o,(e=>e[r]=n(e,t)))}}),ct(Wu,as,{transform(t,e){const n=e.fork(e.ALL),r=t.generator;let i,o,a,s=this.value,u=t.size-s.length;if(u>0){for(i=[];--u>=0;)i.push(a=Fa(r(t))),s.push(a);n.add=n.add.length?n.materialize(n.ADD).add.concat(i):i}else o=s.slice(0,-u),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,s=s.slice(-u);return n.source=this.value=s,n}});const Hu={value:"value",median:we,mean:function(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n},min:ye,max:me},Yu=[];function Gu(t){as.call(this,[],t)}function Vu(t){mu.call(this,t)}function Xu(t){as.call(this,null,t)}function Ju(t){qa.call(this,null,Zu,t)}function Zu(t){return this.value&&!t.modified()?this.value:vt(t.fields,t.flat)}function Qu(t){as.call(this,[],t),this._pending=null}function Ku(t,e,n){n.forEach(Fa);const r=e.fork(e.NO_FIELDS&e.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=n,t._pending=null,r.rem.length&&r.clean(!0),r}function tl(t){as.call(this,{},t)}function el(t){qa.call(this,null,nl,t)}function nl(t){if(this.value&&!t.modified())return this.value;const e=t.extents,n=e.length;let r,i,o=1/0,a=-1/0;for(r=0;r<n;++r)i=e[r],i[0]<o&&(o=i[0]),i[1]>a&&(a=i[1]);return[o,a]}function rl(t){qa.call(this,null,il,t)}function il(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,e)=>t.concat(e)),[])}function ol(t){as.call(this,null,t)}function al(t){mu.call(this,t)}function sl(t){Ru.call(this,t)}function ul(t){as.call(this,null,t)}function ll(t){as.call(this,null,t)}function cl(t){as.call(this,null,t)}Gu.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}]},ct(Gu,as,{transform(t,e){var r,i,o,a,u,l,c,f,h,d,p=e.fork(e.ALL),g=function(t){var e,n=t.method||Hu.value;if(null!=Hu[n])return n===Hu.value?(e=void 0!==t.value?t.value:0,()=>e):Hu[n];s("Unrecognized imputation method: "+n)}(t),m=function(t){const e=t.field;return t=>t?e(t):NaN}(t),y=n(t.field),v=n(t.key),_=(t.groupby||[]).map(n),x=function(t,e,n,r){var i,o,a,s,u,l,c,f,h=t=>t(f),d=[],p=r?r.slice():[],g={},m={};for(p.forEach(((t,e)=>g[t]=e+1)),s=0,c=t.length;s<c;++s)l=n(f=t[s]),u=g[l]||(g[l]=p.push(l)),(a=m[o=(i=e?e.map(h):Yu)+""])||(a=m[o]=[],d.push(a),a.values=i),a[u-1]=f;return d.domain=p,d}(e.source,t.groupby,t.key,t.keyvals),b=[],w=this.value,M=x.domain.length;for(u=0,f=x.length;u<f;++u)for(o=(r=x[u]).values,i=NaN,c=0;c<M;++c)if(null==r[c]){for(a=x.domain[c],d={_impute:!0},l=0,h=o.length;l<h;++l)d[_[l]]=o[l];d[v]=a,d[y]=Number.isNaN(i)?i=g(r,m):i,b.push(Fa(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}}),Vu.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:au},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},ct(Vu,mu,{transform(t,e){const n=this,r=t.modified();let i;return n.value&&(r||e.modified(n._inputs,!0))?(i=n.value=r?n.init(t):{},e.visit(e.SOURCE,(t=>n.add(t)))):(i=n.value=n.value||this.init(t),e.visit(e.REM,(t=>n.rem(t))),e.visit(e.ADD,(t=>n.add(t)))),n.changes(),e.visit(e.SOURCE,(t=>{rt(t,i[n.cellkey(t)].tuple)})),e.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,e=this._mods;let n,r;for(n=0,r=this._alen;n<r;++n)this.celltuple(t[n]),t[n]=null;for(n=0,r=this._mlen;n<r;++n)this.celltuple(e[n]),e[n]=null;this._alen=this._mlen=0}}),Xu.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"]}]},ct(Xu,as,{transform(t,e){const r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=e.materialize(e.SOURCE).source,o=Tu(i,t.groupby,t.field),a=(t.groupby||[]).map(n),u=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&&s("Invalid density method: "+l),"shared"===t.resolve&&(h||(h=it(i,t.field)),d=p=t.steps||p),o.forEach((e=>{const n=As(e,u)[l],r=t.counts?e.length:1;Ks(n,h||it(e),d,p).forEach((t=>{const n={};for(let t=0;t<a.length;++t)n[a[t]]=e.dims[t];n[c[0]]=t[0],n[c[1]]=t[1]*r,f.push(Fa(n))}))})),this.value&&(r.rem=this.value),this.value=r.add=r.source=f}return r}}),ct(Ju,qa),ct(Qu,as,{transform(t,e){const n=e.dataflow;if(this._pending)return Ku(this,e,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return e.StopPropagation;if(t.values)return Ku(this,e,n.parse(t.values,t.format));if(t.async){const e=n.request(t.url,t.format).then((t=>(this._pending=G(t.data),t=>t.touch(this))));return{async:e}}return n.request(t.url,t.format).then((t=>Ku(this,e,G(t.data))))}}),tl.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}]},ct(tl,as,{transform(t,e){const r=t.fields,i=t.index,o=t.values,a=null==t.default?null:t.default,u=t.modified(),l=r.length;let c,f,h,d=u?e.SOURCE:e.ADD,p=e,g=t.as;return o?(f=o.length,l>1&&!g&&s('Multi-field lookup requires explicit "as" parameter.'),g&&g.length!==l*f&&s('The "as" parameter has too few output field names.'),g=g||o.map(n),c=function(t){for(var e,n,s=0,u=0;s<l;++s)if(null==(n=i.get(r[s](t))))for(e=0;e<f;++e,++u)t[g[u]]=a;else for(e=0;e<f;++e,++u)t[g[u]]=o[e](n)}):(g||s("Missing output field names."),c=function(t){for(var e,n=0;n<l;++n)e=i.get(r[n](t)),t[g[n]]=null==e?a:e}),u?p=e.reflow(!0):(h=r.some((t=>e.modified(t.fields))),d|=h?e.MOD:0),e.visit(d,c),p.modifies(g)}}),ct(el,qa),ct(rl,qa),ct(ol,as,{transform(t,e){return this.modified(t.modified()),this.value=t,e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),al.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:au,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ct(al,mu,{_transform:mu.prototype.transform,transform(t,n){return this._transform(function(t,n){const i=t.field,o=t.value,a=("count"===t.op?"__count__":t.op)||"sum",s=r(i).concat(r(o)),u=function(t,e,n){const r={},i=[];return n.visit(n.SOURCE,(e=>{const n=t(e);r[n]||(r[n]=1,i.push(n))})),i.sort(Z),e?i.slice(0,e):i}(i,t.limit||0,n);n.changed()&&t.set("__pivot__",null,null,!0);return{key:t.key,groupby:t.groupby,ops:u.map((()=>a)),fields:u.map((t=>function(t,n,r,i){return e((e=>n(e)===t?r(e):NaN),i,t+"")}(t,i,o,s))),as:u.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),ct(sl,Ru,{transform(t,e){const n=t.subflow,i=t.field,o=t=>this.subflow(Da(t),n,e,t);return(t.modified("field")||i&&e.modified(r(i)))&&s("PreFacet does not support field modification."),this.initTargets(),i?(e.visit(e.MOD,(t=>{const e=o(t);i(t).forEach((t=>e.mod(t)))})),e.visit(e.ADD,(t=>{const e=o(t);i(t).forEach((t=>e.add(Fa(t))))})),e.visit(e.REM,(t=>{const e=o(t);i(t).forEach((t=>e.rem(t)))}))):(e.visit(e.MOD,(t=>o(t).mod(t))),e.visit(e.ADD,(t=>o(t).add(t))),e.visit(e.REM,(t=>o(t).rem(t)))),e.clean()&&e.runAfter((()=>this.clean())),e}}),ul.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ct(ul,as,{transform(t,e){const n=e.fork(e.NO_SOURCE),r=t.fields,i=Su(t.fields,t.as||[]),o=r?(t,e)=>function(t,e,n,r){for(let i=0,o=n.length;i<o;++i)e[r[i]]=n[i](t);return e}(t,e,r,i):Ta;let a;return this.value?a=this.value:(e=e.addAll(),a=this.value={}),e.visit(e.REM,(t=>{const e=Da(t);n.rem.push(a[e]),a[e]=null})),e.visit(e.ADD,(t=>{const e=o(t,Fa({}));a[Da(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{n.mod.push(o(t,a[Da(t)]))})),n}}),ct(ll,as,{transform(t,e){return this.value=t.value,t.modified("value")?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}}),cl.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};function fl(t){as.call(this,null,t)}function hl(t){as.call(this,[],t),this.count=0}function dl(t){as.call(this,null,t)}function pl(t){as.call(this,null,t),this.modified(!0)}function gl(t){as.call(this,null,t)}ct(cl,as,{transform(t,e){const r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.as||["prob","value"];if(this.value&&!t.modified()&&!e.changed())return r.source=this.value,r;const o=Tu(e.materialize(e.SOURCE).source,t.groupby,t.field),a=(t.groupby||[]).map(n),s=[],u=t.step||.01,l=t.probs||ke(u/2,1-1e-14,u),c=l.length;return o.forEach((t=>{const e=fs(t,l);for(let n=0;n<c;++n){const r={};for(let e=0;e<a.length;++e)r[a[e]]=t.dims[e];r[i[0]]=l[n],r[i[1]]=e[n],s.push(Fa(r))}})),this.value&&(r.rem=this.value),this.value=r.add=r.source=s,r}}),ct(fl,as,{transform(t,e){let n,r;return this.value?r=this.value:(n=e=e.addAll(),r=this.value={}),t.derive&&(n=e.fork(e.NO_SOURCE),e.visit(e.REM,(t=>{const e=Da(t);n.rem.push(r[e]),r[e]=null})),e.visit(e.ADD,(t=>{const e=Sa(t);r[Da(t)]=e,n.add.push(e)})),e.visit(e.MOD,(t=>{const e=r[Da(t)];for(const r in t)e[r]=t[r],n.modifies(r);n.mod.push(e)}))),n}}),hl.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ct(hl,as,{transform(e,n){const r=n.fork(n.NO_SOURCE),i=e.modified("size"),o=e.size,a=this.value.reduce(((t,e)=>(t[Da(e)]=1,t)),{});let s=this.value,u=this.count,l=0;function c(e){let n,i;s.length<o?s.push(e):(i=~~((u+1)*t.random()),i<s.length&&i>=l&&(n=s[i],a[Da(n)]&&r.rem.push(n),s[i]=e)),++u}if(n.rem.length&&(n.visit(n.REM,(t=>{const e=Da(t);a[e]&&(a[e]=-1,r.rem.push(t)),--u})),s=s.filter((t=>-1!==a[Da(t)]))),(n.rem.length||i)&&s.length<o&&n.source&&(l=u=s.length,n.visit(n.SOURCE,(t=>{a[Da(t)]||c(t)})),l=-1),i&&s.length>o){const t=s.length-o;for(let e=0;e<t;++e)a[Da(s[e])]=-1,r.rem.push(s[e]);s=s.slice(t)}return n.mod.length&&n.visit(n.MOD,(t=>{a[Da(t)]&&r.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||l<0)&&(r.add=s.filter((t=>!a[Da(t)]))),this.count=u,this.value=r.source=s,r}}),dl.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"}]},ct(dl,as,{transform(t,e){if(this.value&&!t.modified())return;const n=e.materialize().fork(e.MOD),r=t.as||"data";return n.rem=this.value?e.rem.concat(this.value):e.rem,this.value=ke(t.start,t.stop,t.step||1).map((t=>{const e={};return e[r]=t,Fa(e)})),n.add=e.add.concat(this.value),n}}),ct(pl,as,{transform(t,e){return this.value=e.source,e.changed()?e.fork(e.NO_SOURCE|e.NO_FIELDS):e.StopPropagation}});const ml=["unit0","unit1"];function yl(t){as.call(this,ut(),t)}function vl(t){as.call(this,null,t)}gl.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Vn,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"inferUnits",type:"boolean",default:!1},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:ml}]},ct(gl,as,{transform(t,e){const n=t.field,i=!1!==t.interval,o="utc"===t.timezone,a=this._floor(t,e),s=(o?Nr:Or)(a.unit).offset,u=t.as||ml,l=u[0],c=u[1],f=a.step;let h=a.start||1/0,d=a.stop||-1/0,p=e.ADD;return(t.modified()||e.changed(e.REM)||e.modified(r(n)))&&(p=(e=e.reflow(!0)).SOURCE,h=1/0,d=-1/0),e.visit(p,(t=>{const e=n(t);let r,o;null==e?(t[l]=null,i&&(t[c]=null)):(t[l]=r=o=a(e),i&&(t[c]=o=s(r,f)),r<h&&(h=r),o>d&&(d=o))})),a.start=h,a.stop=d,e.modifies(i?u:l)},_floor(t,e){const n="utc"===t.timezone;t.inferUnits&&(t.units||null!=t.step||null!=t.maxbins||t.extent)&&e.dataflow.warn("TimeUnit inferUnits overrides units, step, maxbins and extent.");const{units:r,step:i}=t.inferUnits?si(e.materialize(e.SOURCE).source,t.field,n):t.units?{units:t.units,step:t.step||1}:ri({extent:t.extent||it(e.materialize(e.SOURCE).source,t.field),maxbins:t.maxbins}),o=Jn(r),a=this.value||{},s=(n?$r:Fr)(o,i);return s.unit=A(o),s.units=o,s.step=i,s.start=a.start,s.stop=a.stop,this.value=s}}),ct(yl,as,{transform(t,e){const n=e.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||e.modified(r.fields)?(i.clear(),e.visit(e.SOURCE,o)):e.changed()?(e.visit(e.REM,(t=>i.delete(r(t)))),e.visit(e.ADD,o)):a=!1,this.modified(a),i.empty>n.cleanThreshold&&n.runAfter(i.clean),e.fork()}}),ct(vl,as,{transform(t,e){(!this.value||t.modified("field")||t.modified("sort")||e.changed()||t.sort&&e.modified(t.sort.fields))&&(this.value=(t.sort?e.source.slice().sort(za(t.sort)):e.source).map(t.field))}});const _l={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?t=n+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:e=>{const n=e.index,r=e.data;return n&&e.compare(r[n-1],r[n])?++t:t}}},percent_rank:function(){const t=_l.rank(),e=t.next;return{init:t.init,next:t=>(e(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:e=>{const n=e.data,r=e.compare;let i=e.index;if(t<i){for(;i+1<n.length&&!r(n[i],n[i+1]);)++i;t=i}return(1+t)/n.length}}},ntile:function(t,e){(e=+e)>0||s("ntile num must be greater than zero.");const n=_l.cume_dist(),r=n.next;return{init:n.init,next:t=>Math.ceil(e*r(t))}},lag:function(t,e){return e=+e||1,{next:n=>{const r=n.index-e;return r>=0?t(n.data[r]):null}}},lead:function(t,e){return e=+e||1,{next:n=>{const r=n.index+e,i=n.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:e=>t(e.data[e.i0])}},last_value:function(t){return{next:e=>t(e.data[e.i1-1])}},nth_value:function(t,e){return(e=+e)>0||s("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(e-1);return r<n.i1?t(n.data[r]):null}}},prev_value:function(t){let e;return{init:()=>e=null,next:n=>{const r=t(n.data[n.index]);return null!=r?e=r:e}}},next_value:function(t){let e,n;return{init:()=>(e=null,n=-1),next:r=>{const i=r.data;return r.index<=n?e:(n=function(t,e,n){for(let r=e.length;n<r;++n){if(null!=t(e[n]))return n}return-1}(t,i,r.index))<0?(n=i.length,e=null):e=t(i[n])}}}};const xl=Object.keys(_l);function bl(t){const e=G(t.ops),i=G(t.fields),o=G(t.params),a=G(t.aggregate_params),u=G(t.as),l=this.outputs=[],c=this.windows=[],f={},d={},p=[],g=[];let m=!0;function y(t){G(r(t)).forEach((t=>f[t]=1))}y(t.sort),e.forEach(((t,e)=>{const r=i[e],f=o[e],v=a[e]||null,_=n(r),x=nu(t,_,u[e]);if(y(r),l.push(x),at(_l,t))c.push(function(t,e,n,r){const i=_l[t](e,n);return{init:i.init||h,update:function(t,e){e[r]=i.next(t)}}}(t,r,f,x));else{if(null==r&&"count"!==t&&s("Null aggregate field specified."),"count"===t)return void p.push(x);m=!1;let e=d[_];e||(e=d[_]=[],e.field=r,g.push(e)),e.push(su(t,v,x))}})),(p.length||g.length)&&(this.cell=function(t,e,n){t=t.map((t=>du(t,t.field)));const r={num:0,agg:null,store:!1,count:e};if(!n)for(var i=t.length,o=r.agg=Array(i),a=0;a<i;++a)o[a]=new t[a](r);if(r.store)var s=r.data=new pu;return r.add=function(t){if(r.num+=1,!n){s&&s.add(t);for(let e=0;e<i;++e)o[e].add(o[e].get(t),t)}},r.rem=function(t){if(r.num-=1,!n){s&&s.rem(t);for(let e=0;e<i;++e)o[e].rem(o[e].get(t),t)}},r.set=function(t){let i,a;for(s&&s.values(),i=0,a=e.length;i<a;++i)t[e[i]]=r.num;if(!n)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,s&&s.reset();for(let t=0;t<i;++t)o[t].init()},r}(g,p,m)),this.inputs=Object.keys(f)}const wl=bl.prototype;function Ml(t){as.call(this,{},t),this._mlen=0,this._mods=[]}function kl(t,e,n,r){const i=r.sort,o=i&&!r.ignorePeers,a=r.frame||[null,0],s=t.data(n),u=s.length,l=o?Xt(i):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:s,compare:i||et(-1)};e.init();for(let t=0;t<u;++t)El(c,a,t,u),o&&Dl(c,l),e.update(c,s[t])}function Al(t,e,n){return t<e?e:t>n?n:t}function El(t,e,n,r){t.p0=t.i0,t.p1=t.i1;const i=null==e[0]?0:n+e[0],o=null==e[1]?r:n+e[1]+1;t.i0=Al(i,0,r),t.i1=Al(o,0,r),t.index=n}function Dl(t,e){const n=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;n>0&&!i(o[n],o[n-1])&&(t.i0=e.left(o,o[n])),r<a&&!i(o[r],o[r+1])&&(t.i1=e.right(o,o[r]))}wl.init=function(){this.windows.forEach((t=>t.init())),this.cell&&this.cell.init()},wl.update=function(t,e){const n=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(n){for(a=t.p0;a<t.i0;++a)n.rem(i[a]);for(a=t.p1;a<t.i1;++a)n.add(i[a]);n.set(e)}for(a=0;a<o;++a)r[a].update(t,e)},Ml.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:xl.concat(au)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_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}]},ct(Ml,as,{transform(t,e){this.stamp=e.stamp;const n=t.modified(),r=za(t.sort),i=eu(t.groupby),o=t=>this.group(i(t));let a=this.state;a&&!n||(a=this.state=new bl(t)),n||e.modified(a.inputs)?(this.value={},e.visit(e.SOURCE,(t=>o(t).add(t)))):(e.visit(e.REM,(t=>o(t).remove(t))),e.visit(e.ADD,(t=>o(t).add(t))));for(let e=0,n=this._mlen;e<n;++e)kl(this._mods[e],a,r,t);return this._mlen=0,this._mods=[],e.reflow(n).modifies(a.outputs)},group(t){let e=this.value[t];return e||(e=this.value[t]=vu(Da),e.stamp=-1),e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e),e}});var Cl=Object.freeze({__proto__:null,aggregate:mu,bin:yu,collect:_u,compare:xu,countpattern:wu,cross:Mu,density:Du,dotbin:$u,expression:zu,extent:Ou,facet:Ru,field:Uu,filter:qu,flatten:Pu,fold:ju,formula:Iu,generate:Wu,impute:Gu,joinaggregate:Vu,kde:Xu,key:Ju,load:Qu,lookup:tl,multiextent:el,multivalues:rl,params:ol,pivot:al,prefacet:sl,project:ul,proxy:ll,quantile:cl,relay:fl,sample:hl,sequence:dl,sieve:pl,subflow:Nu,timeunit:gl,tupleindex:yl,values:vl,window:Ml});function Fl(t){return function(){return t}}const Sl=Math.abs,Tl=Math.atan2,$l=Math.cos,zl=Math.max,Bl=Math.min,Ol=Math.sin,Nl=Math.sqrt,Rl=1e-12,Ul=Math.PI,Ll=Ul/2,ql=2*Ul;function Pl(t){return t>=1?Ll:t<=-1?-Ll:Math.asin(t)}const jl=Math.PI,Il=2*jl,Wl=1e-6,Hl=Il-Wl;function Yl(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}let Gl=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Yl:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Yl;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,o){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,s=n-t,u=r-e,l=o-t,c=a-e,f=l*l+c*c;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(f>Wl)if(Math.abs(c*s-u*l)>Wl&&i){let h=n-o,d=r-a,p=s*s+u*u,g=h*h+d*d,m=Math.sqrt(p),y=Math.sqrt(f),v=i*Math.tan((jl-Math.acos((p+f-g)/(2*m*y)))/2),_=v/y,x=v/m;Math.abs(_-1)>Wl&&this._append`L${t+_*l},${e+_*c}`,this._append`A${i},${i},0,0,${+(c*h>l*d)},${this._x1=t+x*s},${this._y1=e+x*u}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),s=n*Math.sin(r),u=t+a,l=e+s,c=1^o,f=o?r-i:i-r;null===this._x1?this._append`M${u},${l}`:(Math.abs(this._x1-u)>Wl||Math.abs(this._y1-l)>Wl)&&this._append`L${u},${l}`,n&&(f<0&&(f=f%Il+Il),f>Hl?this._append`A${n},${n},0,1,${c},${t-a},${e-s}A${n},${n},0,1,${c},${this._x1=u},${this._y1=l}`:f>Wl&&this._append`A${n},${n},0,${+(f>=jl)},${c},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Vl(){return new Gl}function Xl(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Gl(e)}function Jl(t){return t.innerRadius}function Zl(t){return t.outerRadius}function Ql(t){return t.startAngle}function Kl(t){return t.endAngle}function tc(t){return t&&t.padAngle}function ec(t,e,n,r,i,o,a){var s=t-n,u=e-r,l=(a?o:-o)/Nl(s*s+u*u),c=l*u,f=-l*s,h=t+c,d=e+f,p=n+c,g=r+f,m=(h+p)/2,y=(d+g)/2,v=p-h,_=g-d,x=v*v+_*_,b=i-o,w=h*g-p*d,M=(_<0?-1:1)*Nl(zl(0,b*b*x-w*w)),k=(w*_-v*M)/x,A=(-w*v-_*M)/x,E=(w*_+v*M)/x,D=(-w*v+_*M)/x,C=k-m,F=A-y,S=E-m,T=D-y;return C*C+F*F>S*S+T*T&&(k=E,A=D),{cx:k,cy:A,x01:-c,y01:-f,x11:k*(i/b-1),y11:A*(i/b-1)}}function nc(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function rc(t){this._context=t}function ic(t){return new rc(t)}function oc(t){return t[0]}function ac(t){return t[1]}function sc(t,e){var n=Fl(!0),r=null,i=ic,o=null,a=Xl(s);function s(s){var u,l,c,f=(s=nc(s)).length,h=!1;for(null==r&&(o=i(c=a())),u=0;u<=f;++u)!(u<f&&n(l=s[u],u,s))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+t(l,u,s),+e(l,u,s));if(c)return o=null,c+""||null}return t="function"==typeof t?t:void 0===t?oc:Fl(t),e="function"==typeof e?e:void 0===e?ac:Fl(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:Fl(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:Fl(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:Fl(!!t),s):n},s.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),s):i},s.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),s):r},s}function uc(t,e,n){var r=null,i=Fl(!0),o=null,a=ic,s=null,u=Xl(l);function l(l){var c,f,h,d,p,g=(l=nc(l)).length,m=!1,y=new Array(g),v=new Array(g);for(null==o&&(s=a(p=u())),c=0;c<=g;++c){if(!(c<g&&i(d=l[c],c,l))===m)if(m=!m)f=c,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),h=c-1;h>=f;--h)s.point(y[h],v[h]);s.lineEnd(),s.areaEnd()}m&&(y[c]=+t(d,c,l),v[c]=+e(d,c,l),s.point(r?+r(d,c,l):y[c],n?+n(d,c,l):v[c]))}if(p)return s=null,p+""||null}function c(){return sc().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?oc:Fl(+t),e="function"==typeof e?e:Fl(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?ac:Fl(+n),l.x=function(e){return arguments.length?(t="function"==typeof e?e:Fl(+e),r=null,l):t},l.x0=function(e){return arguments.length?(t="function"==typeof e?e:Fl(+e),l):t},l.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Fl(+t),l):r},l.y=function(t){return arguments.length?(e="function"==typeof t?t:Fl(+t),n=null,l):e},l.y0=function(t){return arguments.length?(e="function"==typeof t?t:Fl(+t),l):e},l.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Fl(+t),l):n},l.lineX0=l.lineY0=function(){return c().x(t).y(e)},l.lineY1=function(){return c().x(t).y(n)},l.lineX1=function(){return c().x(r).y(e)},l.defined=function(t){return arguments.length?(i="function"==typeof t?t:Fl(!!t),l):i},l.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),l):a},l.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),l):o},l}Vl.prototype=Gl.prototype,rc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var lc={draw(t,e){const n=Nl(e/Ul);t.moveTo(n,0),t.arc(0,0,n,0,ql)}};function cc(){}function fc(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function hc(t){this._context=t}function dc(t){this._context=t}function pc(t){this._context=t}function gc(t,e){this._basis=new hc(t),this._beta=e}hc.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:fc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:fc(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},dc.prototype={areaStart:cc,areaEnd:cc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:fc(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},pc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:fc(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},gc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,u=-1;++u<=n;)r=u/n,this._basis.point(this._beta*t[u]+(1-this._beta)*(i+r*a),this._beta*e[u]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var mc=function t(e){function n(t){return 1===e?new hc(t):new gc(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function yc(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function vc(t,e){this._context=t,this._k=(1-e)/6}vc.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:yc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:yc(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var _c=function t(e){function n(t){return new vc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function xc(t,e){this._context=t,this._k=(1-e)/6}xc.prototype={areaStart:cc,areaEnd:cc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:yc(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var bc=function t(e){function n(t){return new xc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function wc(t,e){this._context=t,this._k=(1-e)/6}wc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:yc(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Mc=function t(e){function n(t){return new wc(t,e)}return n.tension=function(e){return t(+e)},n}(0);function kc(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>Rl){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}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);o=(o*l+t._x1*t._l23_2a-e*t._l12_2a)/c,a=(a*l+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Ac(t,e){this._context=t,this._alpha=e}Ac.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:kc(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Ec=function t(e){function n(t){return e?new Ac(t,e):new vc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Dc(t,e){this._context=t,this._alpha=e}Dc.prototype={areaStart:cc,areaEnd:cc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:kc(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Cc=function t(e){function n(t){return e?new Dc(t,e):new xc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Fc(t,e){this._context=t,this._alpha=e}Fc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:kc(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Sc=function t(e){function n(t){return e?new Fc(t,e):new wc(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Tc(t){this._context=t}function $c(t){return t<0?-1:1}function zc(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return($c(o)+$c(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function Bc(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Oc(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function Nc(t){this._context=t}function Rc(t){this._context=new Uc(t)}function Uc(t){this._context=t}function Lc(t){this._context=t}function qc(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function Pc(t,e){this._context=t,this._t=e}function jc(t,e){if("undefined"!=typeof document&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=t,n.height=e,n}return null}Tc.prototype={areaStart:cc,areaEnd:cc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},Nc.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:Oc(this,this._t0,Bc(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Oc(this,Bc(this,n=zc(this,t,e)),n);break;default:Oc(this,this._t0,n=zc(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(Rc.prototype=Object.create(Nc.prototype)).point=function(t,e){Nc.prototype.point.call(this,e,t)},Uc.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},Lc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=qc(t),i=qc(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},Pc.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,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};const Ic=()=>"undefined"!=typeof Image?Image:null;function Wc(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Hc(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Yc=Symbol("implicit");function Gc(){var t=new ne,e=[],n=[],r=Yc;function i(i){let o=t.get(i);if(void 0===o){if(r!==Yc)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new ne;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Gc(e,n).unknown(r)},Wc.apply(i,arguments),i}function Vc(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Xc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Jc(){}var Zc=.7,Qc=1/Zc,Kc="\\s*([+-]?\\d+)\\s*",tf="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ef="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",nf=/^#([0-9a-f]{3,8})$/,rf=new RegExp(`^rgb\\(${Kc},${Kc},${Kc}\\)$`),of=new RegExp(`^rgb\\(${ef},${ef},${ef}\\)$`),af=new RegExp(`^rgba\\(${Kc},${Kc},${Kc},${tf}\\)$`),sf=new RegExp(`^rgba\\(${ef},${ef},${ef},${tf}\\)$`),uf=new RegExp(`^hsl\\(${tf},${ef},${ef}\\)$`),lf=new RegExp(`^hsla\\(${tf},${ef},${ef},${tf}\\)$`),cf={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 ff(){return this.rgb().formatHex()}function hf(){return this.rgb().formatRgb()}function df(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=nf.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?pf(e):3===n?new vf(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?gf(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?gf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=rf.exec(t))?new vf(e[1],e[2],e[3],1):(e=of.exec(t))?new vf(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=af.exec(t))?gf(e[1],e[2],e[3],e[4]):(e=sf.exec(t))?gf(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=uf.exec(t))?kf(e[1],e[2]/100,e[3]/100,1):(e=lf.exec(t))?kf(e[1],e[2]/100,e[3]/100,e[4]):cf.hasOwnProperty(t)?pf(cf[t]):"transparent"===t?new vf(NaN,NaN,NaN,0):null}function pf(t){return new vf(t>>16&255,t>>8&255,255&t,1)}function gf(t,e,n,r){return r<=0&&(t=e=n=NaN),new vf(t,e,n,r)}function mf(t){return t instanceof Jc||(t=df(t)),t?new vf((t=t.rgb()).r,t.g,t.b,t.opacity):new vf}function yf(t,e,n,r){return 1===arguments.length?mf(t):new vf(t,e,n,null==r?1:r)}function vf(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function _f(){return`#${Mf(this.r)}${Mf(this.g)}${Mf(this.b)}`}function xf(){const t=bf(this.opacity);return`${1===t?"rgb(":"rgba("}${wf(this.r)}, ${wf(this.g)}, ${wf(this.b)}${1===t?")":`, ${t})`}`}function bf(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wf(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Mf(t){return((t=wf(t))<16?"0":"")+t.toString(16)}function kf(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Df(t,e,n,r)}function Af(t){if(t instanceof Df)return new Df(t.h,t.s,t.l,t.opacity);if(t instanceof Jc||(t=df(t)),!t)return new Df;if(t instanceof Df)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,u=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=u<.5?o+i:2-o-i,a*=60):s=u>0&&u<1?0:a,new Df(a,s,u,t.opacity)}function Ef(t,e,n,r){return 1===arguments.length?Af(t):new Df(t,e,n,null==r?1:r)}function Df(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Cf(t){return(t=(t||0)%360)<0?t+360:t}function Ff(t){return Math.max(0,Math.min(1,t||0))}function Sf(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Vc(Jc,df,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ff,formatHex:ff,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Af(this).formatHsl()},formatRgb:hf,toString:hf}),Vc(vf,yf,Xc(Jc,{brighter(t){return t=null==t?Qc:Math.pow(Qc,t),new vf(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?Zc:Math.pow(Zc,t),new vf(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new vf(wf(this.r),wf(this.g),wf(this.b),bf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:_f,formatHex:_f,formatHex8:function(){return`#${Mf(this.r)}${Mf(this.g)}${Mf(this.b)}${Mf(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:xf,toString:xf})),Vc(Df,Ef,Xc(Jc,{brighter(t){return t=null==t?Qc:Math.pow(Qc,t),new Df(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Zc:Math.pow(Zc,t),new Df(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new vf(Sf(t>=240?t-240:t+120,i,r),Sf(t,i,r),Sf(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Df(Cf(this.h),Ff(this.s),Ff(this.l),bf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=bf(this.opacity);return`${1===t?"hsl(":"hsla("}${Cf(this.h)}, ${100*Ff(this.s)}%, ${100*Ff(this.l)}%${1===t?")":`, ${t})`}`}}));const Tf=Math.PI/180,$f=180/Math.PI,zf=.96422,Bf=.82521,Of=4/29,Nf=6/29,Rf=3*Nf*Nf,Uf=Nf*Nf*Nf;function Lf(t){if(t instanceof Pf)return new Pf(t.l,t.a,t.b,t.opacity);if(t instanceof Gf)return Vf(t);t instanceof vf||(t=mf(t));var e,n,r=Hf(t.r),i=Hf(t.g),o=Hf(t.b),a=jf((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=jf((.4360747*r+.3850649*i+.1430804*o)/zf),n=jf((.0139322*r+.0971045*i+.7141733*o)/Bf)),new Pf(116*a-16,500*(e-a),200*(a-n),t.opacity)}function qf(t,e,n,r){return 1===arguments.length?Lf(t):new Pf(t,e,n,null==r?1:r)}function Pf(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function jf(t){return t>Uf?Math.pow(t,1/3):t/Rf+Of}function If(t){return t>Nf?t*t*t:Rf*(t-Of)}function Wf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Hf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Yf(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Gf)return new Gf(t.h,t.c,t.l,t.opacity);if(t instanceof Pf||(t=Lf(t)),0===t.a&&0===t.b)return new Gf(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*$f;return new Gf(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Gf(t,e,n,null==r?1:r)}function Gf(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function Vf(t){if(isNaN(t.h))return new Pf(t.l,0,0,t.opacity);var e=t.h*Tf;return new Pf(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}Vc(Pf,qf,Xc(Jc,{brighter(t){return new Pf(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new Pf(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new vf(Wf(3.1338561*(e=zf*If(e))-1.6168667*(t=1*If(t))-.4906146*(n=Bf*If(n))),Wf(-.9787684*e+1.9161415*t+.033454*n),Wf(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),Vc(Gf,Yf,Xc(Jc,{brighter(t){return new Gf(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new Gf(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return Vf(this).rgb()}}));var Xf=-.14861,Jf=1.78277,Zf=-.29227,Qf=-.90649,Kf=1.97294,th=Kf*Qf,eh=Kf*Jf,nh=Jf*Zf-Qf*Xf;function rh(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof ih)return new ih(t.h,t.s,t.l,t.opacity);t instanceof vf||(t=mf(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(nh*r+th*e-eh*n)/(nh+th-eh),o=r-i,a=(Kf*(n-i)-Zf*o)/Qf,s=Math.sqrt(a*a+o*o)/(Kf*i*(1-i)),u=s?Math.atan2(a,o)*$f-120:NaN;return new ih(u<0?u+360:u,s,i,t.opacity)}(t):new ih(t,e,n,null==r?1:r)}function ih(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function oh(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function ah(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return oh((n-r/e)*e,a,i,o,s)}}function sh(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return oh((n-r/e)*e,i,o,a,s)}}Vc(ih,rh,Xc(Jc,{brighter(t){return t=null==t?Qc:Math.pow(Qc,t),new ih(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?Zc:Math.pow(Zc,t),new ih(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Tf,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new vf(255*(e+n*(Xf*r+Jf*i)),255*(e+n*(Zf*r+Qf*i)),255*(e+n*(Kf*r)),this.opacity)}}));var uh=t=>()=>t;function lh(t,e){return function(n){return t+n*e}}function ch(t,e){var n=e-t;return n?lh(t,n>180||n<-180?n-360*Math.round(n/360):n):uh(isNaN(t)?e:t)}function fh(t){return 1==(t=+t)?hh:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):uh(isNaN(e)?n:e)}}function hh(t,e){var n=e-t;return n?lh(t,n):uh(isNaN(t)?e:t)}var dh=function t(e){var n=fh(e);function r(t,e){var r=n((t=yf(t)).r,(e=yf(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=hh(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function ph(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=yf(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}var gh=ph(ah),mh=ph(sh);function yh(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function vh(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function _h(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Eh(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function xh(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function bh(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function wh(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Eh(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var Mh=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kh=new RegExp(Mh.source,"g");function Ah(t,e){var n,r,i,o=Mh.lastIndex=kh.lastIndex=0,a=-1,s=[],u=[];for(t+="",e+="";(n=Mh.exec(t))&&(r=kh.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,u.push({i:a,x:bh(n,r)})),o=kh.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,r=0;r<e;++r)s[(n=u[r]).i]=n.x(t);return s.join("")})}function Eh(t,e){var n,r=typeof e;return null==e||"boolean"===r?uh(e):("number"===r?bh:"string"===r?(n=df(e))?(e=n,dh):Ah:e instanceof df?dh:e instanceof Date?xh:vh(e)?yh:Array.isArray(e)?_h:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?wh:bh)(t,e)}function Dh(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Ch,Fh=180/Math.PI,Sh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Th(t,e,n,r,i,o){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*r)&&(n-=t*u,r-=e*u),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,u/=s),t*r<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*Fh,skewX:Math.atan(u)*Fh,scaleX:a,scaleY:s}}function $h(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],u=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var u=a.push("translate(",null,e,null,n);s.push({i:u-4,x:bh(t,i)},{i:u-2,x:bh(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,u),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:bh(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,u),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:bh(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,u),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:bh(t,n)},{i:s-2,x:bh(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,u),o=a=null,function(t){for(var e,n=-1,r=u.length;++n<r;)s[(e=u[n]).i]=e.x(t);return s.join("")}}}var zh=$h((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Sh:Th(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),Bh=$h((function(t){return null==t?Sh:(Ch||(Ch=document.createElementNS("http://www.w3.org/2000/svg","g")),Ch.setAttribute("transform",t),(t=Ch.transform.baseVal.consolidate())?Th((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Sh)}),", ",")",")");function Oh(t){return((t=Math.exp(t))+1/t)/2}var Nh=function t(e,n,r){function i(t,i){var o,a,s=t[0],u=t[1],l=t[2],c=i[0],f=i[1],h=i[2],d=c-s,p=f-u,g=d*d+p*p;if(g<1e-12)a=Math.log(h/l)/e,o=function(t){return[s+t*d,u+t*p,l*Math.exp(e*t*a)]};else{var m=Math.sqrt(g),y=(h*h-l*l+r*g)/(2*l*n*m),v=(h*h-l*l-r*g)/(2*h*n*m),_=Math.log(Math.sqrt(y*y+1)-y),x=Math.log(Math.sqrt(v*v+1)-v);a=(x-_)/e,o=function(t){var r=t*a,i=Oh(_),o=l/(n*m)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(e*r+_)-function(t){return((t=Math.exp(t))-1/t)/2}(_));return[s+o*d,u+o*p,l*i/Oh(e*r+_)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function Rh(t){return function(e,n){var r=t((e=Ef(e)).h,(n=Ef(n)).h),i=hh(e.s,n.s),o=hh(e.l,n.l),a=hh(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var Uh=Rh(ch),Lh=Rh(hh);function qh(t){return function(e,n){var r=t((e=Yf(e)).h,(n=Yf(n)).h),i=hh(e.c,n.c),o=hh(e.l,n.l),a=hh(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var Ph=qh(ch),jh=qh(hh);function Ih(t){return function e(n){function r(e,r){var i=t((e=rh(e)).h,(r=rh(r)).h),o=hh(e.s,r.s),a=hh(e.l,r.l),s=hh(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=o(t),e.l=a(Math.pow(t,n)),e.opacity=s(t),e+""}}return n=+n,r.gamma=e,r}(1)}var Wh=Ih(ch),Hh=Ih(hh);function Yh(t,e){void 0===e&&(e=t,t=Eh);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n<r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}}var Gh=Object.freeze({__proto__:null,interpolate:Eh,interpolateArray:function(t,e){return(vh(e)?yh:_h)(t,e)},interpolateBasis:ah,interpolateBasisClosed:sh,interpolateCubehelix:Wh,interpolateCubehelixLong:Hh,interpolateDate:xh,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateHcl:Ph,interpolateHclLong:jh,interpolateHsl:Uh,interpolateHslLong:Lh,interpolateHue:function(t,e){var n=ch(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateLab:function(t,e){var n=hh((t=qf(t)).l,(e=qf(e)).l),r=hh(t.a,e.a),i=hh(t.b,e.b),o=hh(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},interpolateNumber:bh,interpolateNumberArray:yh,interpolateObject:wh,interpolateRgb:dh,interpolateRgbBasis:gh,interpolateRgbBasisClosed:mh,interpolateRound:Dh,interpolateString:Ah,interpolateTransformCss:zh,interpolateTransformSvg:Bh,interpolateZoom:Nh,piecewise:Yh,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n}});function Vh(t){return+t}var Xh=[0,1];function Jh(t){return t}function Zh(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function Qh(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=Zh(i,r),o=n(a,o)):(r=Zh(r,i),o=n(o,a)),function(t){return o(r(t))}}function Kh(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=Zh(t[a],t[a+1]),o[a]=n(e[a],e[a+1]);return function(e){var n=Kt(t,e,1,r)-1;return o[n](i[n](e))}}function td(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function ed(){var t,e,n,r,i,o,a=Xh,s=Xh,u=Eh,l=Jh;function c(){var t=Math.min(a.length,s.length);return l!==Jh&&(l=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?Kh:Qh,i=o=null,f}function f(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,u)))(t(l(e)))}return f.invert=function(n){return l(e((o||(o=r(s,a.map(t),bh)))(n)))},f.domain=function(t){return arguments.length?(a=Array.from(t,Vh),c()):a.slice()},f.range=function(t){return arguments.length?(s=Array.from(t),c()):s.slice()},f.rangeRound=function(t){return s=Array.from(t),u=Dh,c()},f.clamp=function(t){return arguments.length?(l=!!t||Jh,c()):l!==Jh},f.interpolate=function(t){return arguments.length?(u=t,c()):u},f.unknown=function(t){return arguments.length?(n=t,f):n},function(n,r){return t=n,e=r,c()}}function nd(){return ed()(Jh,Jh)}function rd(t,e,n,r){var i,o=ge(t,e,n);switch((r=Te(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Ie(o,a))||(r.precision=i),Ue(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=We(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=je(o))||(r.precision=i-2*("%"===r.type))}return Re(r)}function id(t){var e=t.domain;return t.ticks=function(t){var n=e();return de(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return rd(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,u=o[a],l=o[s],c=10;for(l<u&&(i=u,u=l,l=i,i=a,a=s,s=i);c-- >0;){if((i=pe(u,l,n))===r)return o[a]=u,o[s]=l,e(o);if(i>0)u=Math.floor(u/i)*i,l=Math.ceil(l/i)*i;else{if(!(i<0))break;u=Math.ceil(u*i)/i,l=Math.floor(l*i)/i}r=i}return t},t}function od(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function ad(t){return Math.log(t)}function sd(t){return Math.exp(t)}function ud(t){return-Math.log(-t)}function ld(t){return-Math.exp(-t)}function cd(t){return isFinite(t)?+("1e"+t):t<0?0:t}function fd(t){return(e,n)=>-t(-e,n)}function hd(t){const e=t(ad,sd),n=e.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(o),i=function(t){return 10===t?cd:t===Math.E?Math.exp:e=>Math.pow(t,e)}(o),n()[0]<0?(r=fd(r),i=fd(i),t(ud,ld)):t(ad,sd),e}return e.base=function(t){return arguments.length?(o=+t,a()):o},e.domain=function(t){return arguments.length?(n(t),a()):n()},e.ticks=t=>{const e=n();let a=e[0],s=e[e.length-1];const u=s<a;u&&([a,s]=[s,a]);let l,c,f=r(a),h=r(s);const d=null==t?10:+t;let p=[];if(!(o%1)&&h-f<d){if(f=Math.floor(f),h=Math.ceil(h),a>0){for(;f<=h;++f)for(l=1;l<o;++l)if(c=f<0?l/i(-f):l*i(f),!(c<a)){if(c>s)break;p.push(c)}}else for(;f<=h;++f)for(l=o-1;l>=1;--l)if(c=f>0?l/i(-f):l*i(f),!(c<a)){if(c>s)break;p.push(c)}2*p.length<d&&(p=de(a,s,d))}else p=de(f,h,Math.min(h-f,d)).map(i);return u?p.reverse():p},e.tickFormat=(t,n)=>{if(null==t&&(t=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=Te(n)).precision||(n.trim=!0),n=Re(n)),t===1/0)return n;const a=Math.max(1,o*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*o<o-.5&&(e*=o),e<=a?n(t):""}},e.nice=()=>n(od(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function dd(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function pd(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function gd(t){var e=1,n=t(dd(e),pd(e));return n.constant=function(n){return arguments.length?t(dd(e=+n),pd(e)):e},id(n)}function md(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function yd(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function vd(t){return t<0?-t*t:t*t}function _d(t){var e=t(Jh,Jh),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(Jh,Jh):.5===n?t(yd,vd):t(md(n),md(1/n)):n},id(e)}function xd(){var t=_d(ed());return t.copy=function(){return td(t,xd()).exponent(t.exponent())},Wc.apply(t,arguments),t}function bd(t){return new Date(t)}function wd(t){return t instanceof Date?+t:+new Date(+t)}function Md(t,e,n,r,i,o,a,s,u,l){var c=nd(),f=c.invert,h=c.domain,d=l(".%L"),p=l(":%S"),g=l("%I:%M"),m=l("%I %p"),y=l("%a %d"),v=l("%b %d"),_=l("%B"),x=l("%Y");function b(t){return(u(t)<t?d:s(t)<t?p:a(t)<t?g:o(t)<t?m:r(t)<t?i(t)<t?y:v:n(t)<t?_:x)(t)}return c.invert=function(t){return new Date(f(t))},c.domain=function(t){return arguments.length?h(Array.from(t,wd)):h().map(bd)},c.ticks=function(e){var n=h();return t(n[0],n[n.length-1],null==e?10:e)},c.tickFormat=function(t,e){return null==e?b:l(e)},c.nice=function(t){var n=h();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?h(od(n,t)):c},c.copy=function(){return td(c,Md(t,e,n,r,i,o,a,s,u,l))},c}function kd(){var t,e,n,r,i,o=0,a=1,s=Jh,u=!1;function l(e){return null==e||isNaN(e=+e)?i:s(0===n?.5:(e=(r(e)-t)*n,u?Math.max(0,Math.min(1,e)):e))}function c(t){return function(e){var n,r;return arguments.length?([n,r]=e,s=t(n,r),l):[s(0),s(1)]}}return l.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),e=r(a=+a),n=t===e?0:1/(e-t),l):[o,a]},l.clamp=function(t){return arguments.length?(u=!!t,l):u},l.interpolator=function(t){return arguments.length?(s=t,l):s},l.range=c(Eh),l.rangeRound=c(Dh),l.unknown=function(t){return arguments.length?(i=t,l):i},function(i){return r=i,t=i(o),e=i(a),n=t===e?0:1/(e-t),l}}function Ad(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Ed(){var t=id(kd()(Jh));return t.copy=function(){return Ad(t,Ed())},Hc.apply(t,arguments)}function Dd(){var t=_d(kd());return t.copy=function(){return Ad(t,Dd()).exponent(t.exponent())},Hc.apply(t,arguments)}function Cd(){var t,e,n,r,i,o,a,s=0,u=.5,l=1,c=1,f=Jh,h=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-e)*(c*t<c*e?r:i),f(h?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,f=Yh(t,[n,r,i]),d):[f(0),f(.5),f(1)]}}return d.domain=function(a){return arguments.length?([s,u,l]=a,t=o(s=+s),e=o(u=+u),n=o(l=+l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),c=e<t?-1:1,d):[s,u,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(Eh),d.rangeRound=p(Dh),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(s),e=a(u),n=a(l),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),c=e<t?-1:1,d}}function Fd(){var t=_d(Cd());return t.copy=function(){return Ad(t,Fd()).exponent(t.exponent())},Hc.apply(t,arguments)}function Sd(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Td=Sd("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),$d=Sd("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),zd=Sd("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Bd=Sd("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),Od=Sd("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Nd=Sd("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Rd=Sd("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Ud=Sd("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Ld=Sd("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),qd=Sd("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Pd(t,e,n){const r=t-e+2*n;return t?r>0?r:1:0}const jd="linear",Id="log",Wd="pow",Hd="sqrt",Yd="symlog",Gd="time",Vd="utc",Xd="sequential",Jd="diverging",Zd="quantile",Qd="quantize",Kd="threshold",tp="ordinal",ep="point",np="band",rp="bin-ordinal",ip="continuous",op="discrete",ap="discretizing",sp="interpolating",up="temporal";function lp(){const t=Gc().unknown(void 0),e=t.domain,n=t.range;let r,i,o=[0,1],a=!1,s=0,u=0,l=.5;function c(){const t=e().length,c=o[1]<o[0],f=o[1-c],h=Pd(t,s,u);let d=o[c-0];r=(f-d)/(h||1),a&&(r=Math.floor(r)),d+=(f-d-r*(t-s))*l,i=r*(1-s),a&&(d=Math.round(d),i=Math.round(i));const p=ke(t).map((t=>d+r*t));return n(c?p.reverse():p)}return delete t.unknown,t.domain=function(t){return arguments.length?(e(t),c()):e()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],c()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,c()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,c()):a},t.padding=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),s=u,c()):s},t.paddingInner=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},t.paddingOuter=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),c()):u},t.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]<o[0],a=r?n().reverse():n(),s=a.length-1;let u,l,c,f=+t[0],h=+t[1];return f!=f||h!=h||(h<f&&(c=f,f=h,h=c),h<a[0]||f>o[1-r])?void 0:(u=Math.max(0,Kt(a,f)-1),l=f===h?u:Kt(a,h)-1,f-a[u]>i+1e-10&&++u,r&&(c=u,u=s-l,l=s-c),u>l?void 0:e().slice(u,l+1))},t.invert=function(e){const n=t.invertRange([e,e]);return n?n[0]:n},t.copy=function(){return lp().domain(e()).range(o).round(a).paddingInner(s).paddingOuter(u).align(l)},c()}function cp(t){const e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return cp(e())},t}var fp=Array.prototype.map;const hp=Array.prototype.slice;const dp=new Map,pp=Symbol("vega_scale");function gp(t){return t[pp]=!0,t}function mp(t){return t&&!0===t[pp]}function yp(t,e,n){return arguments.length>1?(dp.set(t,function(t,e,n){const r=function(){const n=e();return n.invertRange||(n.invertRange=n.invert?function(t){return function(e){let n,r=e[0],i=e[1];return i<r&&(n=r,r=i,i=n),[t.invert(r),t.invert(i)]}}(n):n.invertExtent?function(t){return function(e){const n=t.range();let r,i,o,a,s=e[0],u=e[1],l=-1;for(u<s&&(i=s,s=u,u=i),o=0,a=n.length;o<a;++o)n[o]>=s&&n[o]<=u&&(l<0&&(l=o),r=o);if(!(l<0))return s=t.invertExtent(n[l]),u=t.invertExtent(n[r]),[void 0===s[0]?s[1]:s[0],void 0===u[1]?u[0]:u[1]]}}(n):void 0),n.type=t,gp(n)};return r.metadata=St(G(n)),r}(t,e,n)),this):vp(t)?dp.get(t):void 0}function vp(t){return dp.has(t)}function _p(t,e){const n=dp.get(t);return n&&n.metadata[e]}function xp(t){return _p(t,ip)}function bp(t){return _p(t,op)}function wp(t){return _p(t,ap)}function Mp(t){return _p(t,Id)}function kp(t){return _p(t,up)}function Ap(t){return _p(t,sp)}function Ep(t){return _p(t,Zd)}yp("identity",(function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,Vh),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,Vh):[0,1],id(r)})),yp(jd,(function t(){var e=nd();return e.copy=function(){return td(e,t())},Wc.apply(e,arguments),id(e)}),ip),yp(Id,(function t(){const e=hd(ed()).domain([1,10]);return e.copy=()=>td(e,t()).base(e.base()),Wc.apply(e,arguments),e}),[ip,Id]),yp(Wd,xd,ip),yp(Hd,(function(){return xd.apply(null,arguments).exponent(.5)}),ip),yp(Yd,(function t(){var e=gd(ed());return e.copy=function(){return td(e,t()).constant(e.constant())},Wc.apply(e,arguments)}),ip),yp(Gd,(function(){return Wc.apply(Md(Bn,On,Fn,Dn,hn,un,an,rn,nn,di).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[ip,up]),yp(Vd,(function(){return Wc.apply(Md($n,zn,Sn,Cn,xn,ln,sn,on,nn,gi).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[ip,up]),yp(Xd,Ed,[ip,sp]),yp(`${Xd}-${jd}`,Ed,[ip,sp]),yp(`${Xd}-${Id}`,(function t(){var e=hd(kd()).domain([1,10]);return e.copy=function(){return Ad(e,t()).base(e.base())},Hc.apply(e,arguments)}),[ip,sp,Id]),yp(`${Xd}-${Wd}`,Dd,[ip,sp]),yp(`${Xd}-${Hd}`,(function(){return Dd.apply(null,arguments).exponent(.5)}),[ip,sp]),yp(`${Xd}-${Yd}`,(function t(){var e=gd(kd());return e.copy=function(){return Ad(e,t()).constant(e.constant())},Hc.apply(e,arguments)}),[ip,sp]),yp(`${Jd}-${jd}`,(function t(){var e=id(Cd()(Jh));return e.copy=function(){return Ad(e,t())},Hc.apply(e,arguments)}),[ip,sp]),yp(`${Jd}-${Id}`,(function t(){var e=hd(Cd()).domain([.1,1,10]);return e.copy=function(){return Ad(e,t()).base(e.base())},Hc.apply(e,arguments)}),[ip,sp,Id]),yp(`${Jd}-${Wd}`,Fd,[ip,sp]),yp(`${Jd}-${Hd}`,(function(){return Fd.apply(null,arguments).exponent(.5)}),[ip,sp]),yp(`${Jd}-${Yd}`,(function t(){var e=gd(Cd());return e.copy=function(){return Ad(e,t()).constant(e.constant())},Hc.apply(e,arguments)}),[ip,sp]),yp(Zd,(function t(){var e,n=[],r=[],i=[];function o(){var t=0,e=Math.max(1,r.length);for(i=new Array(e-1);++t<e;)i[t-1]=be(n,t/e);return a}function a(t){return null==t||isNaN(t=+t)?e:r[Kt(i,t)]}return a.invertExtent=function(t){var e=r.indexOf(t);return e<0?[NaN,NaN]:[e>0?i[e-1]:n[0],e<i.length?i[e]:n[n.length-1]]},a.domain=function(t){if(!arguments.length)return n.slice();n=[];for(let e of t)null==e||isNaN(e=+e)||n.push(e);return n.sort(Gt),o()},a.range=function(t){return arguments.length?(r=Array.from(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(e=t,a):e},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(n).range(r).unknown(e)},Wc.apply(a,arguments)}),[ap,Zd]),yp(Qd,(function t(){var e,n=0,r=1,i=1,o=[.5],a=[0,1];function s(t){return null!=t&&t<=t?a[Kt(o,t,0,i)]:e}function u(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*n)/(i+1);return s}return s.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,u()):[n,r]},s.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,u()):a.slice()},s.invertExtent=function(t){var e=a.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,o[0]]:e>=i?[o[i-1],r]:[o[e-1],o[e]]},s.unknown=function(t){return arguments.length?(e=t,s):s},s.thresholds=function(){return o.slice()},s.copy=function(){return t().domain([n,r]).range(a).unknown(e)},Wc.apply(id(s),arguments)}),ap),yp(Kd,(function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[Kt(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Wc.apply(o,arguments)}),ap),yp(rp,(function t(){let e=[],n=[];function r(t){return null==t||t!=t?void 0:n[(Kt(e,t)-1)%n.length]}return r.domain=function(t){return arguments.length?(e=function(t){return fp.call(t,E)}(t),r):e.slice()},r.range=function(t){return arguments.length?(n=hp.call(t),r):n.slice()},r.tickFormat=function(t,n){return rd(e[0],A(e),null==t?10:t,n)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[op,ap]),yp(tp,Gc,op),yp(np,lp,op),yp(ep,(function(){return cp(lp().paddingInner(1))}),op);const Dp=["clamp","base","constant","exponent"];function Cp(t,e){const n=e[0],r=A(e)-n;return function(e){return t(n+e*r)}}function Fp(t,e,n){return Yh($p(e||"rgb",n),t)}function Sp(t,e){const n=new Array(e),r=e+1;for(let i=0;i<e;)n[i]=t(++i/r);return n}function Tp(t,e,n){const r=n-e;let i,o,a;return r&&Number.isFinite(r)?(i=(o=t.type).indexOf("-"),o=i<0?o:o.slice(i+1),a=yp(o)().domain([e,n]).range([0,1]),Dp.forEach((e=>t[e]?a[e](t[e]()):0)),a):et(.5)}function $p(t,e){const n=Gh[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=e&&n&&n.gamma?n.gamma(e):n}function zp(t){if(_(t))return t;const e=t.length/6|0,n=new Array(e);for(let r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}function Bp(t,e){for(const n in t)Np(n,e(t[n]))}const Op={};function Np(t,e){return t=t&&t.toLowerCase(),arguments.length>1?(Op[t]=e,this):Op[t]}Bp({accent:$d,category10:Td,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:zd,observable10:Bd,paired:Od,pastel1:Nd,pastel2:Rd,set1:Ud,set2:Ld,set3:qd,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},zp),Bp({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},(t=>Fp(zp(t))));const Rp="symbol",Up=t=>_(t)?t.map((t=>String(t))):String(t),Lp=(t,e)=>t[1]-e[1],qp=(t,e)=>e[1]-t[1];function Pp(t,e,n){let r;if(gt(e)&&(t.bins&&(e=Math.max(e,t.bins.length)),null!=n)){const r=t.domain(),i=Math.min(r[0],A(r)),o=Math.max(r[0],A(r));if(e=Math.min(e,Math.floor((o-i)/n||1)+1),!t.bins&&!Mp(t.type)&&!kp(t.type)&&i<o)for(;e>1&&ge(i,o,e)<n;)--e}return x(e)&&(r=e.step,e=e.interval),yt(e)&&(e=t.type===Gd?Or(e):t.type==Vd?Nr(e):s("Only time and utc scales accept interval strings."),r&&(e=e.every(r))),e}function jp(t,e,n){let r=t.range(),i=r[0],o=A(r),a=Lp;if(i>o&&(r=o,o=i,i=r,a=qp),i=Math.floor(i),o=Math.ceil(o),e=e.map((e=>[e,t(e)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),n>0&&e.length>1){const t=[e[0],A(e)];for(;e.length>n&&e.length>=3;)e=e.filter(((t,e)=>!(e%2)));e.length<3&&(e=t)}return e}function Ip(t,e){return t.bins?jp(t,t.bins,e):t.ticks?t.ticks(e):t.domain()}function Wp(t,e,n,r,i,o){const a=e.type;let s=Up;if(a===Gd||i===Gd)s=t.timeFormat(r);else if(a===Vd||i===Vd)s=t.utcFormat(r);else if(Mp(a)){const i=t.formatFloat(r);if(o||e.bins)s=i;else{const t=Hp(e,n,!1);s=e=>t(e)?i(e):""}}else if(e.tickFormat){const i=e.domain();s=t.formatSpan(i[0],i[i.length-1],n,r)}else r&&(s=t.format(r));return s}function Hp(t,e,n){const r=Ip(t,e),i=t.base(),o=Math.log(i),a=Math.max(1,i*e/r.length),s=t=>{let e=t/Math.pow(i,Math.round(Math.log(t)/o));return e*i<i-.5&&(e*=i),e<=a};return n?r.filter(s):s}const Yp={[Zd]:"quantiles",[Qd]:"thresholds",[Kd]:"domain"},Gp={[Zd]:"quantiles",[Qd]:"domain"};function Vp(t,e){return t.bins?function(t){const e=t.slice(0,-1);return e.max=A(t),e}(t.bins):t.type===Id?Hp(t,e,!0):Yp[t.type]?function(t){const e=[-1/0].concat(t);return e.max=1/0,e}(t[Yp[t.type]]()):Ip(t,e)}function Xp(t,e,n,r,i,o,a){const s=Gp[e.type]&&o!==Gd&&o!==Vd?function(t,e,n){const r=e[Gp[e.type]](),i=r.length;let o,a=i>1?r[1]-r[0]:r[0];for(o=1;o<i;++o)a=Math.min(a,r[o]-r[o-1]);return t.formatSpan(0,a,30,n)}(t,e,i):Wp(t,e,n,i,o,a);return r===Rp&&(t=>Yp[t.type]||t.bins)(e)?Jp(s):"discrete"===r?Qp(s):Kp(s)}const Jp=t=>(e,n,r)=>{const i=Zp(r[n+1],Zp(r.max,1/0)),o=tg(e,t),a=tg(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},Zp=(t,e)=>null!=t?t:e,Qp=t=>(e,n)=>n?t(e):null,Kp=t=>e=>t(e),tg=(t,e)=>Number.isFinite(t)?e(t):null;function eg(t,e,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=function(t,e,n,r){const i=r||e.type;return yt(n)&&kp(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),n||i!==Gd?n||i!==Vd?Xp(t,e,5,null,n,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}(t,e,n.format,n.formatType);if(wp(e.type)){const t=Vp(e).slice(1).map(i),n=t.length;return`${n} boundar${1===n?"y":"ies"}: ${t.join(", ")}`}if(bp(e.type)){const t=e.domain(),n=t.length;return`${n} value${1===n?"":"s"}: ${n>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=e.domain();return`values from ${i(t[0])} to ${i(A(t))}`}}let ng=0;const rg="p_";function ig(t){return t&&t.gradient}function og(t,e,n){const r=t.gradient;let i=t.id,o="radial"===r?rg:"";return i||(i=t.id="gradient_"+ng++,"radial"===r?(t.x1=ag(t.x1,.5),t.y1=ag(t.y1,.5),t.r1=ag(t.r1,0),t.x2=ag(t.x2,.5),t.y2=ag(t.y2,.5),t.r2=ag(t.r2,.5),o=rg):(t.x1=ag(t.x1,0),t.y1=ag(t.y1,0),t.x2=ag(t.x2,1),t.y2=ag(t.y2,0))),e[i]=t,"url("+(n||"")+"#"+o+i+")"}function ag(t,e){return null!=t?t:e}function sg(t,e){var n,r=[];return n={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:e?e[0]:1,y2:e?e[1]:0,stops:r,stop:function(t,e){return r.push({offset:t,color:e}),n}}}const ug={basis:{curve:function(t){return new hc(t)}},"basis-closed":{curve:function(t){return new dc(t)}},"basis-open":{curve:function(t){return new pc(t)}},bundle:{curve:mc,tension:"beta",value:.85},cardinal:{curve:_c,tension:"tension",value:0},"cardinal-open":{curve:Mc,tension:"tension",value:0},"cardinal-closed":{curve:bc,tension:"tension",value:0},"catmull-rom":{curve:Ec,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Cc,tension:"alpha",value:.5},"catmull-rom-open":{curve:Sc,tension:"alpha",value:.5},linear:{curve:ic},"linear-closed":{curve:function(t){return new Tc(t)}},monotone:{horizontal:function(t){return new Rc(t)},vertical:function(t){return new Nc(t)}},natural:{curve:function(t){return new Lc(t)}},step:{curve:function(t){return new Pc(t,.5)}},"step-after":{curve:function(t){return new Pc(t,1)}},"step-before":{curve:function(t){return new Pc(t,0)}}};function lg(t,e,n){var r=at(ug,t)&&ug[t],i=null;return r&&(i=r.curve||r[e||"vertical"],r.tension&&null!=n&&(i=i[r.tension](n))),i}const cg={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},fg=/[mlhvzcsqta]([^mlhvzcsqta]*)/gi,hg=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,dg=/^((\s+,?\s*)|(,\s*))/,pg=/^[01]/;function gg(t){const e=[];return(t.match(fg)||[]).forEach((t=>{let n=t[0];const r=n.toLowerCase(),i=cg[r],o=function(t,e,n){const r=[];for(let i=0;e&&i<n.length;)for(let o=0;o<e;++o){const e="a"!==t||3!==o&&4!==o?hg:pg,a=n.slice(i).match(e);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");i+=a[0].length,r.push(+a[0]);const s=n.slice(i).match(dg);null!==s&&(i+=s[0].length)}return r}(r,i,t.slice(1).trim()),a=o.length;if(a<i||a&&a%i!=0)throw Error("Invalid SVG path, incorrect parameter count");if(e.push([n,...o.slice(0,i)]),a!==i){"m"===r&&(n="M"===n?"L":"l");for(let t=i;t<a;t+=i)e.push([n,...o.slice(t,t+i)])}})),e}const mg=Math.PI/180,yg=Math.PI/2,vg=2*Math.PI,_g=Math.sqrt(3)/2;var xg={},bg={},wg=[].join;function Mg(t){const e=wg.call(t);if(bg[e])return bg[e];var n=t[0],r=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7];const c=l*a,f=-u*s,h=u*a,d=l*s,p=Math.cos(i),g=Math.sin(i),m=Math.cos(o),y=Math.sin(o),v=.5*(o-i),_=Math.sin(.5*v),x=8/3*_*_/Math.sin(v),b=n+p-x*g,w=r+g+x*p,M=n+m,k=r+y,A=M+x*y,E=k-x*m;return bg[e]=[c*b+f*w,h*b+d*w,c*A+f*E,h*A+d*E,c*M+f*k,h*M+d*k]}const kg=["l",0,0,0,0,0,0,0];function Ag(t,e,n){const r=kg[0]=t[0];if("a"===r||"A"===r)kg[1]=e*t[1],kg[2]=n*t[2],kg[3]=t[3],kg[4]=t[4],kg[5]=t[5],kg[6]=e*t[6],kg[7]=n*t[7];else if("h"===r||"H"===r)kg[1]=e*t[1];else if("v"===r||"V"===r)kg[1]=n*t[1];else for(var i=1,o=t.length;i<o;++i)kg[i]=(i%2==1?e:n)*t[i];return kg}function Eg(t,e,n,r,i,o){var a,s,u,l,c,f=null,h=0,d=0,p=0,g=0,m=0,y=0;null==n&&(n=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=i),t.beginPath&&t.beginPath();for(var v=0,_=e.length;v<_;++v){switch(a=e[v],1===i&&1===o||(a=Ag(a,i,o)),a[0]){case"l":h+=a[1],d+=a[2],t.lineTo(h+n,d+r);break;case"L":h=a[1],d=a[2],t.lineTo(h+n,d+r);break;case"h":h+=a[1],t.lineTo(h+n,d+r);break;case"H":h=a[1],t.lineTo(h+n,d+r);break;case"v":d+=a[1],t.lineTo(h+n,d+r);break;case"V":d=a[1],t.lineTo(h+n,d+r);break;case"m":m=h+=a[1],y=d+=a[2],t.moveTo(h+n,d+r);break;case"M":m=h=a[1],y=d=a[2],t.moveTo(h+n,d+r);break;case"c":s=h+a[5],u=d+a[6],p=h+a[3],g=d+a[4],t.bezierCurveTo(h+a[1]+n,d+a[2]+r,p+n,g+r,s+n,u+r),h=s,d=u;break;case"C":h=a[5],d=a[6],p=a[3],g=a[4],t.bezierCurveTo(a[1]+n,a[2]+r,p+n,g+r,h+n,d+r);break;case"s":s=h+a[3],u=d+a[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+n,g+r,h+a[1]+n,d+a[2]+r,s+n,u+r),p=h+a[1],g=d+a[2],h=s,d=u;break;case"S":s=a[3],u=a[4],p=2*h-p,g=2*d-g,t.bezierCurveTo(p+n,g+r,a[1]+n,a[2]+r,s+n,u+r),h=s,d=u,p=a[1],g=a[2];break;case"q":s=h+a[3],u=d+a[4],p=h+a[1],g=d+a[2],t.quadraticCurveTo(p+n,g+r,s+n,u+r),h=s,d=u;break;case"Q":s=a[3],u=a[4],t.quadraticCurveTo(a[1]+n,a[2]+r,s+n,u+r),h=s,d=u,p=a[1],g=a[2];break;case"t":s=h+a[1],u=d+a[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+n,g+r,s+n,u+r),d=u,p=(h=s)+a[1],g=d+a[2];break;case"T":s=a[1],u=a[2],p=2*h-p,g=2*d-g,t.quadraticCurveTo(p+n,g+r,s+n,u+r),h=s,d=u;break;case"a":Dg(t,h+n,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+h+n,a[7]+d+r]),h+=a[6],d+=a[7];break;case"A":Dg(t,h+n,d+r,[a[1],a[2],a[3],a[4],a[5],a[6]+n,a[7]+r]),h=a[6],d=a[7];break;case"z":case"Z":h=m,d=y,t.closePath()}f=a}}function Dg(t,e,n,r){const i=function(t,e,n,r,i,o,a,s,u){const l=wg.call(arguments);if(xg[l])return xg[l];const c=a*mg,f=Math.sin(c),h=Math.cos(c),d=h*(s-t)*.5+f*(u-e)*.5,p=h*(u-e)*.5-f*(s-t)*.5;let g=d*d/((n=Math.abs(n))*n)+p*p/((r=Math.abs(r))*r);g>1&&(g=Math.sqrt(g),n*=g,r*=g);const m=h/n,y=f/n,v=-f/r,_=h/r,x=m*s+y*u,b=v*s+_*u,w=m*t+y*e,M=v*t+_*e;let k=1/((w-x)*(w-x)+(M-b)*(M-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);o==i&&(A=-A);const E=.5*(x+w)-A*(M-b),D=.5*(b+M)+A*(w-x),C=Math.atan2(b-D,x-E);let F=Math.atan2(M-D,w-E)-C;F<0&&1===o?F+=vg:F>0&&0===o&&(F-=vg);const S=Math.ceil(Math.abs(F/(yg+.001))),T=[];for(let t=0;t<S;++t){const e=C+t*F/S,i=C+(t+1)*F/S;T[t]=[E,D,e,i,n,r,f,h]}return xg[l]=T}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],e,n);for(let e=0;e<i.length;++e){const n=Mg(i[e]);t.bezierCurveTo(n[0],n[1],n[2],n[3],n[4],n[5])}}const Cg=.5773502691896257,Fg={circle:{draw:function(t,e){const n=Math.sqrt(e)/2;t.moveTo(n,0),t.arc(0,0,n,0,vg)}},cross:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/2.5;t.moveTo(-n,-r),t.lineTo(-n,r),t.lineTo(-r,r),t.lineTo(-r,n),t.lineTo(r,n),t.lineTo(r,r),t.lineTo(n,r),t.lineTo(n,-r),t.lineTo(r,-r),t.lineTo(r,-n),t.lineTo(-r,-n),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,e){const n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.closePath()}},square:{draw:function(t,e){var n=Math.sqrt(e),r=-n/2;t.rect(r,r,n,n)}},arrow:{draw:function(t,e){var n=Math.sqrt(e)/2,r=n/7,i=n/2.5,o=n/8;t.moveTo(-r,n),t.lineTo(r,n),t.lineTo(r,-o),t.lineTo(i,-o),t.lineTo(0,-n),t.lineTo(-i,-o),t.lineTo(-r,-o),t.closePath()}},wedge:{draw:function(t,e){var n=Math.sqrt(e)/2,r=_g*n,i=r-n*Cg,o=n/4;t.moveTo(0,-r-i),t.lineTo(-o,r-i),t.lineTo(o,r-i),t.closePath()}},triangle:{draw:function(t,e){var n=Math.sqrt(e)/2,r=_g*n,i=r-n*Cg;t.moveTo(0,-r-i),t.lineTo(-n,r-i),t.lineTo(n,r-i),t.closePath()}},"triangle-up":{draw:function(t,e){var n=Math.sqrt(e)/2,r=_g*n;t.moveTo(0,-r),t.lineTo(-n,r),t.lineTo(n,r),t.closePath()}},"triangle-down":{draw:function(t,e){var n=Math.sqrt(e)/2,r=_g*n;t.moveTo(0,r),t.lineTo(-n,-r),t.lineTo(n,-r),t.closePath()}},"triangle-right":{draw:function(t,e){var n=Math.sqrt(e)/2,r=_g*n;t.moveTo(r,0),t.lineTo(-r,-n),t.lineTo(-r,n),t.closePath()}},"triangle-left":{draw:function(t,e){var n=Math.sqrt(e)/2,r=_g*n;t.moveTo(-r,0),t.lineTo(r,-n),t.lineTo(r,n),t.closePath()}},stroke:{draw:function(t,e){const n=Math.sqrt(e)/2;t.moveTo(-n,0),t.lineTo(n,0)}}};function Sg(t){return at(Fg,t)?Fg[t]:function(t){if(!at(Tg,t)){const e=gg(t);Tg[t]={draw:function(t,n){Eg(t,e,0,0,Math.sqrt(n)/2)}}}return Tg[t]}(t)}var Tg={};const $g=.448084975506;function zg(t){return t.x}function Bg(t){return t.y}function Og(t){return t.width}function Ng(t){return t.height}function Rg(t){return"function"==typeof t?t:()=>+t}function Ug(t,e,n){return Math.max(e,Math.min(t,n))}function Lg(){var t=zg,e=Bg,n=Og,r=Ng,i=Rg(0),o=i,a=i,s=i,u=null;function l(l,c,f){var h,d=null!=c?c:+t.call(this,l),p=null!=f?f:+e.call(this,l),g=+n.call(this,l),m=+r.call(this,l),y=Math.min(g,m)/2,v=Ug(+i.call(this,l),0,y),_=Ug(+o.call(this,l),0,y),x=Ug(+a.call(this,l),0,y),b=Ug(+s.call(this,l),0,y);if(u||(u=h=Vl()),v<=0&&_<=0&&x<=0&&b<=0)u.rect(d,p,g,m);else{var w=d+g,M=p+m;u.moveTo(d+v,p),u.lineTo(w-_,p),u.bezierCurveTo(w-$g*_,p,w,p+$g*_,w,p+_),u.lineTo(w,M-b),u.bezierCurveTo(w,M-$g*b,w-$g*b,M,w-b,M),u.lineTo(d+x,M),u.bezierCurveTo(d+$g*x,M,d,M-$g*x,d,M-x),u.lineTo(d,p+v),u.bezierCurveTo(d,p+$g*v,d+$g*v,p,d+v,p),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(e){return arguments.length?(t=Rg(e),l):t},l.y=function(t){return arguments.length?(e=Rg(t),l):e},l.width=function(t){return arguments.length?(n=Rg(t),l):n},l.height=function(t){return arguments.length?(r=Rg(t),l):r},l.cornerRadius=function(t,e,n,r){return arguments.length?(i=Rg(t),o=null!=e?Rg(e):i,s=null!=n?Rg(n):i,a=null!=r?Rg(r):o,l):i},l.context=function(t){return arguments.length?(u=null==t?null:t,l):u},l}function qg(){var t,e,n,r,i,o,a,s,u=null;function l(t,e,n){const r=n/2;if(i){var l=a-e,c=t-o;if(l||c){var f=Math.hypot(l,c),h=(l/=f)*s,d=(c/=f)*s,p=Math.atan2(c,l);u.moveTo(o-h,a-d),u.lineTo(t-l*r,e-c*r),u.arc(t,e,r,p-Math.PI,p),u.lineTo(o+h,a+d),u.arc(o,a,s,p,p+Math.PI)}else u.arc(t,e,r,0,vg);u.closePath()}else i=1;o=t,a=e,s=r}function c(o){var a,s,c,f=o.length,h=!1;for(null==u&&(u=c=Vl()),a=0;a<=f;++a)!(a<f&&r(s=o[a],a,o))===h&&(h=!h)&&(i=0),h&&l(+t(s,a,o),+e(s,a,o),+n(s,a,o));if(c)return u=null,c+""||null}return c.x=function(e){return arguments.length?(t=e,c):t},c.y=function(t){return arguments.length?(e=t,c):e},c.size=function(t){return arguments.length?(n=t,c):n},c.defined=function(t){return arguments.length?(r=t,c):r},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c}function Pg(t,e){return null!=t?t:e}const jg=t=>t.x||0,Ig=t=>t.y||0,Wg=t=>!(!1===t.defined),Hg=function(){var t=Jl,e=Zl,n=Fl(0),r=null,i=Ql,o=Kl,a=tc,s=null,u=Xl(l);function l(){var l,c,f=+t.apply(this,arguments),h=+e.apply(this,arguments),d=i.apply(this,arguments)-Ll,p=o.apply(this,arguments)-Ll,g=Sl(p-d),m=p>d;if(s||(s=l=u()),h<f&&(c=h,h=f,f=c),h>Rl)if(g>ql-Rl)s.moveTo(h*$l(d),h*Ol(d)),s.arc(0,0,h,d,p,!m),f>Rl&&(s.moveTo(f*$l(p),f*Ol(p)),s.arc(0,0,f,p,d,m));else{var y,v,_=d,x=p,b=d,w=p,M=g,k=g,A=a.apply(this,arguments)/2,E=A>Rl&&(r?+r.apply(this,arguments):Nl(f*f+h*h)),D=Bl(Sl(h-f)/2,+n.apply(this,arguments)),C=D,F=D;if(E>Rl){var S=Pl(E/f*Ol(A)),T=Pl(E/h*Ol(A));(M-=2*S)>Rl?(b+=S*=m?1:-1,w-=S):(M=0,b=w=(d+p)/2),(k-=2*T)>Rl?(_+=T*=m?1:-1,x-=T):(k=0,_=x=(d+p)/2)}var $=h*$l(_),z=h*Ol(_),B=f*$l(w),O=f*Ol(w);if(D>Rl){var N,R=h*$l(x),U=h*Ol(x),L=f*$l(b),q=f*Ol(b);if(g<Ul)if(N=function(t,e,n,r,i,o,a,s){var u=n-t,l=r-e,c=a-i,f=s-o,h=f*u-c*l;if(!(h*h<Rl))return[t+(h=(c*(e-o)-f*(t-i))/h)*u,e+h*l]}($,z,L,q,R,U,B,O)){var P=$-N[0],j=z-N[1],I=R-N[0],W=U-N[1],H=1/Ol(function(t){return t>1?0:t<-1?Ul:Math.acos(t)}((P*I+j*W)/(Nl(P*P+j*j)*Nl(I*I+W*W)))/2),Y=Nl(N[0]*N[0]+N[1]*N[1]);C=Bl(D,(f-Y)/(H-1)),F=Bl(D,(h-Y)/(H+1))}else C=F=0}k>Rl?F>Rl?(y=ec(L,q,$,z,h,F,m),v=ec(R,U,B,O,h,F,m),s.moveTo(y.cx+y.x01,y.cy+y.y01),F<D?s.arc(y.cx,y.cy,F,Tl(y.y01,y.x01),Tl(v.y01,v.x01),!m):(s.arc(y.cx,y.cy,F,Tl(y.y01,y.x01),Tl(y.y11,y.x11),!m),s.arc(0,0,h,Tl(y.cy+y.y11,y.cx+y.x11),Tl(v.cy+v.y11,v.cx+v.x11),!m),s.arc(v.cx,v.cy,F,Tl(v.y11,v.x11),Tl(v.y01,v.x01),!m))):(s.moveTo($,z),s.arc(0,0,h,_,x,!m)):s.moveTo($,z),f>Rl&&M>Rl?C>Rl?(y=ec(B,O,R,U,f,-C,m),v=ec($,z,L,q,f,-C,m),s.lineTo(y.cx+y.x01,y.cy+y.y01),C<D?s.arc(y.cx,y.cy,C,Tl(y.y01,y.x01),Tl(v.y01,v.x01),!m):(s.arc(y.cx,y.cy,C,Tl(y.y01,y.x01),Tl(y.y11,y.x11),!m),s.arc(0,0,f,Tl(y.cy+y.y11,y.cx+y.x11),Tl(v.cy+v.y11,v.cx+v.x11),m),s.arc(v.cx,v.cy,C,Tl(v.y11,v.x11),Tl(v.y01,v.x01),!m))):s.arc(0,0,f,w,b,m):s.lineTo(B,O)}else s.moveTo(0,0);if(s.closePath(),l)return s=null,l+""||null}return l.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-Ul/2;return[$l(r)*n,Ol(r)*n]},l.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:Fl(+e),l):t},l.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Fl(+t),l):e},l.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Fl(+t),l):n},l.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Fl(+t),l):r},l.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Fl(+t),l):i},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:Fl(+t),l):o},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:Fl(+t),l):a},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}().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)),Yg=uc().x(jg).y1(Ig).y0((t=>(t.y||0)+(t.height||0))).defined(Wg),Gg=uc().y(Ig).x1(jg).x0((t=>(t.x||0)+(t.width||0))).defined(Wg),Vg=sc().x(jg).y(Ig).defined(Wg),Xg=Lg().x(jg).y(Ig).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Pg(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Pg(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Pg(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Pg(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),Jg=function(t,e){let n=null,r=Xl(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:Fl(t||lc),e="function"==typeof e?e:Fl(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:Fl(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:Fl(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i}().type((t=>Sg(t.shape||"circle"))).size((t=>Pg(t.size,64))),Zg=qg().x(jg).y(Ig).defined(Wg).size((t=>t.size||1));function Qg(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Kg(t,e,n,r){return Xg.context(t)(e,n,r)}var tm=1;function em(t,e,n){var r=e.clip,i=t._defs,o=e.clip_id||(e.clip_id="clip"+tm++),a=i.clipping[o]||(i.clipping[o]={id:o});return X(r)?a.path=r(null):Qg(n)?a.path=Kg(null,n,0,0):(a.width=n.width||0,a.height=n.height||0),"url(#"+o+")"}function nm(t){this.clear(),t&&this.union(t)}function rm(t){this.mark=t,this.bounds=this.bounds||new nm}function im(t){rm.call(this,t),this.items=this.items||[]}nm.prototype={clone(){return new nm(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2},set(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},add(t,e){return t<this.x1&&(this.x1=t),e<this.y1&&(this.y1=e),t>this.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this},expand(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(t){return this.x1*=t,this.y1*=t,this.x2*=t,this.y2*=t,this},translate(t,e){return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this},rotate(t,e,n){const r=this.rotatedPoints(t,e,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,e,n){var{x1:r,y1:i,x2:o,y2:a}=this,s=Math.cos(t),u=Math.sin(t),l=e-e*s+n*u,c=n-e*u-n*s;return[s*r-u*i+l,u*r+s*i+c,s*r-u*a+l,u*r+s*a+c,s*o-u*i+l,u*o+s*i+c,s*o-u*a+l,u*o+s*a+c]},union(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},intersect(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},encloses(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},alignsWith(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},intersects(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},contains(t,e){return!(t<this.x1||t>this.x2||e<this.y1||e>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},ct(im,rm);class om{constructor(t){this._pending=0,this._loader=t||xa()}pending(){return this._pending}sanitizeURL(t){const e=this;return am(e),e._loader.sanitize(t,{context:"href"}).then((t=>(sm(e),t))).catch((()=>(sm(e),null)))}loadImage(t){const e=this,n=Ic();return am(e),e._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!n)throw{url:r};const i=new n,o=at(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>sm(e),i.onerror=()=>sm(e),i.src=r,i})).catch((t=>(sm(e),{complete:!1,width:0,height:0,src:t&&t.url||""})))}ready(){const t=this;return new Promise((e=>{!function n(r){t.pending()?setTimeout((()=>{n(!0)}),10):e(r)}(!1)}))}}function am(t){t._pending+=1}function sm(t){t._pending-=1}function um(t,e,n){if(e.stroke&&0!==e.opacity&&0!==e.strokeOpacity){const r=null!=e.strokeWidth?+e.strokeWidth:1;let i=("square"===e.strokeCap?Math.SQRT2:1)*r/2;!n||e.strokeJoin&&"miter"!==e.strokeJoin||(i=Math.max(i,(null!=e.strokeMiterLimit?+e.strokeMiterLimit:4)*r/2)),t.expand(i)}return t}const lm=vg-1e-8;let cm,fm,hm,dm,pm,gm,mm,ym;const vm=(t,e)=>cm.add(t,e),_m=(t,e)=>vm(fm=t,hm=e),xm=t=>vm(t,cm.y1),bm=t=>vm(cm.x1,t),wm=(t,e)=>pm*t+mm*e,Mm=(t,e)=>gm*t+ym*e,km=(t,e)=>vm(wm(t,e),Mm(t,e)),Am=(t,e)=>_m(wm(t,e),Mm(t,e));function Em(t,e){return cm=t,e?(dm=e*mg,pm=ym=Math.cos(dm),gm=Math.sin(dm),mm=-gm):(pm=ym=1,dm=gm=mm=0),Dm}const Dm={beginPath(){},closePath(){},moveTo:Am,lineTo:Am,rect(t,e,n,r){dm?(km(t+n,e),km(t+n,e+r),km(t,e+r),Am(t,e)):(vm(t+n,e+r),_m(t,e))},quadraticCurveTo(t,e,n,r){const i=wm(t,e),o=Mm(t,e),a=wm(n,r),s=Mm(n,r);Cm(fm,i,a,xm),Cm(hm,o,s,bm),_m(a,s)},bezierCurveTo(t,e,n,r,i,o){const a=wm(t,e),s=Mm(t,e),u=wm(n,r),l=Mm(n,r),c=wm(i,o),f=Mm(i,o);Fm(fm,a,u,c,xm),Fm(hm,s,l,f,bm),_m(c,f)},arc(t,e,n,r,i,o){if(r+=dm,i+=dm,fm=n*Math.cos(i)+t,hm=n*Math.sin(i)+e,Math.abs(i-r)>lm)vm(t-n,e-n),vm(t+n,e+n);else{const a=r=>vm(n*Math.cos(r)+t,n*Math.sin(r)+e);let s,u;if(a(r),a(i),i!==r)if((r%=vg)<0&&(r+=vg),(i%=vg)<0&&(i+=vg),i<r&&(o=!o,s=r,r=i,i=s),o)for(i-=vg,s=r-r%yg,u=0;u<4&&s>i;++u,s-=yg)a(s);else for(s=r-r%yg+yg,u=0;u<4&&s<i;++u,s+=yg)a(s)}}};function Cm(t,e,n,r){const i=(t-e)/(t+n-2*e);0<i&&i<1&&r(t+(e-t)*i)}function Fm(t,e,n,r,i){const o=r-t+3*e-3*n,a=t+n-2*e,s=t-e;let u,l=0,c=0;Math.abs(o)>1e-14?(u=a*a+s*o,u>=0&&(u=Math.sqrt(u),l=(-a+u)/o,c=(-a-u)/o)):l=.5*s/a,0<l&&l<1&&i(Sm(l,t,e,n,r)),0<c&&c<1&&i(Sm(c,t,e,n,r))}function Sm(t,e,n,r,i){const o=1-t,a=o*o,s=t*t;return a*o*e+3*a*t*n+3*o*s*r+s*t*i}var Tm=(Tm=jc(1,1))?Tm.getContext("2d"):null;const $m=new nm;function zm(t){return function(e,n){if(!Tm)return!0;t(Tm,e),$m.clear().union(e.bounds).intersect(n).round();const{x1:r,y1:i,x2:o,y2:a}=$m;for(let t=i;t<=a;++t)for(let e=r;e<=o;++e)if(Tm.isPointInPath(e,t))return!0;return!1}}function Bm(t,e){return e.contains(t.x||0,t.y||0)}function Om(t,e){const n=t.x||0,r=t.y||0,i=t.width||0,o=t.height||0;return e.intersects($m.set(n,r,n+i,r+o))}function Nm(t,e){const n=t.x||0,r=t.y||0;return Rm(e,n,r,null!=t.x2?t.x2:n,null!=t.y2?t.y2:r)}function Rm(t,e,n,r,i){const{x1:o,y1:a,x2:s,y2:u}=t,l=r-e,c=i-n;let f,h,d,p,g=0,m=1;for(p=0;p<4;++p){if(0===p&&(f=-l,h=-(o-e)),1===p&&(f=l,h=s-e),2===p&&(f=-c,h=-(a-n)),3===p&&(f=c,h=u-n),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 Um(t,e){t.globalCompositeOperation=e.blend||"source-over"}function Lm(t,e){return null==t?e:t}function qm(t,e){const n=e.length;for(let r=0;r<n;++r)t.addColorStop(e[r].offset,e[r].color);return t}function Pm(t,e,n){return ig(n)?function(t,e,n){const r=n.width(),i=n.height();let o;if("radial"===e.gradient)o=t.createRadialGradient(n.x1+Lm(e.x1,.5)*r,n.y1+Lm(e.y1,.5)*i,Math.max(r,i)*Lm(e.r1,0),n.x1+Lm(e.x2,.5)*r,n.y1+Lm(e.y2,.5)*i,Math.max(r,i)*Lm(e.r2,.5));else{const a=Lm(e.x1,0),s=Lm(e.y1,0),u=Lm(e.x2,1),l=Lm(e.y2,0);if(a!==u&&s!==l&&r!==i){const n=jc(Math.ceil(r),Math.ceil(i)),o=n.getContext("2d");return o.scale(r,i),o.fillStyle=qm(o.createLinearGradient(a,s,u,l),e.stops),o.fillRect(0,0,r,i),t.createPattern(n,"no-repeat")}o=t.createLinearGradient(n.x1+a*r,n.y1+s*i,n.x1+u*r,n.y1+l*i)}return qm(o,e.stops)}(t,n,e.bounds):n}function jm(t,e,n){return(n*=null==e.fillOpacity?1:e.fillOpacity)>0&&(t.globalAlpha=n,t.fillStyle=Pm(t,e,e.fill),!0)}var Im=[];function Wm(t,e,n){var r=null!=(r=e.strokeWidth)?r:1;return!(r<=0)&&((n*=null==e.strokeOpacity?1:e.strokeOpacity)>0&&(t.globalAlpha=n,t.strokeStyle=Pm(t,e,e.stroke),t.lineWidth=r,t.lineCap=e.strokeCap||"butt",t.lineJoin=e.strokeJoin||"miter",t.miterLimit=null!=e.strokeMiterLimit?e.strokeMiterLimit:4,t.setLineDash&&(t.setLineDash(e.strokeDash||Im),t.lineDashOffset=e.strokeDashOffset||0),!0))}function Hm(t,e){return t.zindex-e.zindex||t.index-e.index}function Ym(t){if(!t.zdirty)return t.zitems;var e,n,r,i=t.items,o=[];for(n=0,r=i.length;n<r;++n)(e=i[n]).index=n,e.zindex&&o.push(e);return t.zdirty=!1,t.zitems=o.sort(Hm)}function Gm(t,e){var n,r,i=t.items;if(!i||!i.length)return;const o=Ym(t);if(o&&o.length){for(n=0,r=i.length;n<r;++n)i[n].zindex||e(i[n]);i=o}for(n=0,r=i.length;n<r;++n)e(i[n])}function Vm(t,e){var n,r,i=t.items;if(!i||!i.length)return null;const o=Ym(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(n=e(i[r]))return n;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(n=e(i[r])))return n;return null}function Xm(t){return function(e,n,r){Gm(n,(n=>{r&&!r.intersects(n.bounds)||Zm(t,e,n,n)}))}}function Jm(t){return function(e,n,r){!n.items.length||r&&!r.intersects(n.bounds)||Zm(t,e,n.items[0],n.items)}}function Zm(t,e,n,r){var i=null==n.opacity?1:n.opacity;0!==i&&(t(e,r)||(Um(e,n),n.fill&&jm(e,n,i)&&e.fill(),n.stroke&&Wm(e,n,i)&&e.stroke()))}function Qm(t){return t=t||p,function(e,n,r,i,o,a){return r*=e.pixelRatio,i*=e.pixelRatio,Vm(n,(n=>{const s=n.bounds;if((!s||s.contains(o,a))&&s)return t(e,n,r,i,o,a)?n:void 0}))}}function Km(t,e){return function(n,r,i,o){var a,s,u=Array.isArray(r)?r[0]:r,l=null==e?u.fill:e,c=u.stroke&&n.isPointInStroke;return c&&(a=u.strokeWidth,s=u.strokeCap,n.lineWidth=null!=a?a:1,n.lineCap=null!=s?s:"butt"),!t(n,r)&&(l&&n.isPointInPath(i,o)||c&&n.isPointInStroke(i,o))}}function ty(t){return Qm(Km(t))}function ey(t,e){return"translate("+t+","+e+")"}function ny(t){return"rotate("+t+")"}function ry(t){return ey(t.x||0,t.y||0)}function iy(t,e,n){function r(t,n){var r=n.x||0,i=n.y||0,o=n.angle||0;t.translate(r,i),o&&t.rotate(o*=mg),t.beginPath(),e(t,n),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,n){t("transform",function(t){return ey(t.x||0,t.y||0)+(t.angle?" "+ny(t.angle):"")}(n)),t("d",e(null,n))},bound:function(t,n){return e(Em(t,n.angle),n),um(t,n,!0).translate(n.x||0,n.y||0)},draw:Xm(r),pick:ty(r),isect:n||zm(r)}}var oy=iy("arc",(function(t,e){return Hg.context(t)(e)}));function ay(t,e,n){function r(t,n){t.beginPath(),e(t,n)}const i=Km(r);return{type:t,tag:"path",nested:!0,attr:function(t,n){var r=n.mark.items;r.length&&t("d",e(null,r))},bound:function(t,n){var r=n.items;return 0===r.length?t:(e(Em(t),r),um(t,r[0],!0))},draw:Jm(r),pick:function(t,e,n,r,o,a){var s=e.items,u=e.bounds;return!s||!s.length||u&&!u.contains(o,a)?null:(n*=t.pixelRatio,r*=t.pixelRatio,i(t,s,n,r)?s[0]:null)},isect:Bm,tip:n}}var sy=ay("area",(function(t,e){const n=e[0],r=n.interpolate||"linear";return("horizontal"===n.orient?Gg:Yg).curve(lg(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i="horizontal"===t[0].orient?e[1]:e[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,s=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<s&&(s=r,n=t[a]);return n}));function uy(t,e){t.beginPath(),Qg(e)?Kg(t,e,0,0):t.rect(0,0,e.width||0,e.height||0),t.clip()}function ly(t){const e=Lm(t.strokeWidth,1);return null!=t.strokeOffset?t.strokeOffset:t.stroke&&e>.5&&e<1.5?.5-Math.abs(e-1):0}function cy(t,e){const n=ly(e);t("d",Kg(null,e,n,n))}function fy(t,e,n,r){const i=ly(e);t.beginPath(),Kg(t,e,(n||0)+i,(r||0)+i)}const hy=Km(fy),dy=Km(fy,!1),py=Km(fy,!0);var gy={type:"group",tag:"g",nested:!1,attr:function(t,e){t("transform",ry(e))},bound:function(t,e){if(!e.clip&&e.items){const n=e.items,r=n.length;for(let e=0;e<r;++e)t.union(n[e].bounds)}return(e.clip||e.width||e.height)&&!e.noBound&&t.add(0,0).add(e.width||0,e.height||0),um(t,e),t.translate(e.x||0,e.y||0)},draw:function(t,e,n,r){Gm(e,(e=>{const i=e.x||0,o=e.y||0,a=e.strokeForeground,s=null==e.opacity?1:e.opacity;(e.stroke||e.fill)&&s&&(fy(t,e,i,o),Um(t,e),e.fill&&jm(t,e,s)&&t.fill(),e.stroke&&!a&&Wm(t,e,s)&&t.stroke()),t.save(),t.translate(i,o),e.clip&&uy(t,e),n&&n.translate(-i,-o),Gm(e,(e=>{("group"===e.marktype||null==r||r.includes(e.marktype))&&this.draw(t,e,n,r)})),n&&n.translate(i,o),t.restore(),a&&e.stroke&&s&&(fy(t,e,i,o),Um(t,e),Wm(t,e,s)&&t.stroke())}))},pick:function(t,e,n,r,i,o){if(e.bounds&&!e.bounds.contains(i,o)||!e.items)return null;const a=n*t.pixelRatio,s=r*t.pixelRatio;return Vm(e,(u=>{let l,c,f;const h=u.bounds;if(h&&!h.contains(i,o))return;c=u.x||0,f=u.y||0;const d=c+(u.width||0),p=f+(u.height||0),g=u.clip;if(g&&(i<c||i>d||o<f||o>p))return;if(t.save(),t.translate(c,f),c=i-c,f=o-f,g&&Qg(u)&&!py(t,u,a,s))return t.restore(),null;const m=u.strokeForeground,y=!1!==e.interactive;return y&&m&&u.stroke&&dy(t,u,a,s)?(t.restore(),u):(l=Vm(u,(t=>function(t,e,n){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(e,n)}(t,c,f)?this.pick(t,n,r,c,f):null)),!l&&y&&(u.fill||!m&&u.stroke)&&hy(t,u,a,s)&&(l=u),t.restore(),l||null)}))},isect:Om,content:function(t,e,n){t("clip-path",e.clip?em(n,e,e):null)},background:function(t,e){t("class","background"),t("aria-hidden",!0),cy(t,e)},foreground:function(t,e){t("class","foreground"),t("aria-hidden",!0),e.strokeForeground?cy(t,e):t("d","")}},my={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function yy(t,e){var n=t.image;return(!n||t.url&&t.url!==n.url)&&(n={complete:!1,width:0,height:0},e.loadImage(t.url).then((e=>{t.image=e,t.image.url=t.url}))),n}function vy(t,e){return null!=t.width?t.width:e&&e.width?!1!==t.aspect&&t.height?t.height*e.width/e.height:e.width:0}function _y(t,e){return null!=t.height?t.height:e&&e.height?!1!==t.aspect&&t.width?t.width*e.height/e.width:e.height:0}function xy(t,e){return"center"===t?e/2:"right"===t?e:0}function by(t,e){return"middle"===t?e/2:"bottom"===t?e:0}var wy={type:"image",tag:"image",nested:!1,attr:function(t,e,n){const r=yy(e,n),i=vy(e,r),o=_y(e,r),a=(e.x||0)-xy(e.align,i),s=(e.y||0)-by(e.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",my["xmlns:xlink"],"xlink:href"),t("transform",ey(a,s)),t("width",i),t("height",o),t("preserveAspectRatio",!1===e.aspect?"none":"xMidYMid")},bound:function(t,e){const n=e.image,r=vy(e,n),i=_y(e,n),o=(e.x||0)-xy(e.align,r),a=(e.y||0)-by(e.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,e,n){Gm(e,(e=>{if(n&&!n.intersects(e.bounds))return;const r=yy(e,this);let i=vy(e,r),o=_y(e,r);if(0===i||0===o)return;let a,s,u,l,c=(e.x||0)-xy(e.align,i),f=(e.y||0)-by(e.baseline,o);!1!==e.aspect&&(s=r.width/r.height,u=e.width/e.height,s==s&&u==u&&s!==u&&(u<s?(l=i/s,f+=(o-l)/2,o=l):(l=o*s,c+=(i-l)/2,i=l))),(r.complete||r.toDataURL)&&(Um(t,e),t.globalAlpha=null!=(a=e.opacity)?a:1,t.imageSmoothingEnabled=!1!==e.smooth,t.drawImage(r,c,f,i,o))}))},pick:Qm(),isect:p,get:yy,xOffset:xy,yOffset:by},My=ay("line",(function(t,e){const n=e[0],r=n.interpolate||"linear";return Vg.curve(lg(r,n.orient,n.tension)).context(t)(e)}),(function(t,e){for(var n,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(n=t[o].x-e[0])*n+(r=t[o].y-e[1])*r<i)return t[o];return null}));function ky(t,e){var n=e.path;if(null==n)return!0;var r=e.x||0,i=e.y||0,o=e.scaleX||1,a=e.scaleY||1,s=(e.angle||0)*mg,u=e.pathCache;u&&u.path===n||((e.pathCache=u=gg(n)).path=n),s&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(s),Eg(t,u,0,0,o,a),t.rotate(-s),t.translate(-r,-i)):Eg(t,u,r,i,o,a)}var Ay={type:"path",tag:"path",nested:!1,attr:function(t,e){var n=e.scaleX||1,r=e.scaleY||1;1===n&&1===r||t("vector-effect","non-scaling-stroke"),t("transform",function(t){return ey(t.x||0,t.y||0)+(t.angle?" "+ny(t.angle):"")+(t.scaleX||t.scaleY?" "+function(t,e){return"scale("+t+","+e+")"}(t.scaleX||1,t.scaleY||1):"")}(e)),t("d",e.path)},bound:function(t,e){return ky(Em(t,e.angle),e)?t.set(0,0,0,0):um(t,e,!0)},draw:Xm(ky),pick:ty(ky),isect:zm(ky)};function Ey(t,e){t.beginPath(),Kg(t,e)}var Dy={type:"rect",tag:"path",nested:!1,attr:function(t,e){t("d",Kg(null,e))},bound:function(t,e){var n,r;return um(t.set(n=e.x||0,r=e.y||0,n+e.width||0,r+e.height||0),e)},draw:Xm(Ey),pick:ty(Ey),isect:Om};function Cy(t,e,n){var r,i,o,a;return!(!e.stroke||!Wm(t,e,n))&&(r=e.x||0,i=e.y||0,o=null!=e.x2?e.x2:r,a=null!=e.y2?e.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),!0)}var Fy={type:"rule",tag:"line",nested:!1,attr:function(t,e){t("transform",ry(e)),t("x2",null!=e.x2?e.x2-(e.x||0):0),t("y2",null!=e.y2?e.y2-(e.y||0):0)},bound:function(t,e){var n,r;return um(t.set(n=e.x||0,r=e.y||0,null!=e.x2?e.x2:n,null!=e.y2?e.y2:r),e)},draw:function(t,e,n){Gm(e,(e=>{if(!n||n.intersects(e.bounds)){var r=null==e.opacity?1:e.opacity;r&&Cy(t,e,r)&&(Um(t,e),t.stroke())}}))},pick:Qm((function(t,e,n,r){return!!t.isPointInStroke&&(Cy(t,e,1)&&t.isPointInStroke(n,r))})),isect:Nm},Sy=iy("shape",(function(t,e){return(e.mark.shape||e.shape).context(t)(e)})),Ty=iy("symbol",(function(t,e){return Jg.context(t)(e)}),Bm);const $y=xt();var zy={height:Ly,measureWidth:Ry,estimateWidth:Oy,width:Oy,canvas:By};function By(t){zy.width=t&&Tm?Ry:Oy}function Oy(t,e){return Ny(Iy(t,e),Ly(t))}function Ny(t,e){return~~(.8*t.length*e)}function Ry(t,e){return Ly(t)<=0||!(e=Iy(t,e))?0:Uy(e,Hy(t))}function Uy(t,e){const n=`(${e}) ${t}`;let r=$y.get(n);return void 0===r&&(Tm.font=e,r=Tm.measureText(t).width,$y.set(n,r)),r}function Ly(t){return null!=t.fontSize?+t.fontSize||0:11}function qy(t){return null!=t.lineHeight?t.lineHeight:Ly(t)+2}function Py(t){return e=t.lineBreak&&t.text&&!_(t.text)?t.text.split(t.lineBreak):t.text,_(e)?e.length>1?e:e[0]:e;var e}function jy(t){const e=Py(t);return(_(e)?e.length-1:0)*qy(t)}function Iy(t,e){const n=null==e?"":(e+"").trim();return t.limit>0&&n.length?function(t,e){var n=+t.limit,r=function(t){if(zy.width===Ry){const e=Hy(t);return t=>Uy(t,e)}if(zy.width===Oy){const e=Ly(t);return t=>Ny(t,e)}return e=>zy.width(t,e)}(t);if(r(e)<n)return e;var i,o=t.ellipsis||"…",a="rtl"===t.dir,s=0,u=e.length;if(n-=r(o),a){for(;s<u;)i=s+u>>>1,r(e.slice(i))>n?s=i+1:u=i;return o+e.slice(s)}for(;s<u;)i=1+(s+u>>>1),r(e.slice(0,i))<n?s=i:u=i-1;return e.slice(0,s)+o}(t,n):n}function Wy(t,e){var n=t.font;return(e&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function Hy(t,e){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+Ly(t)+"px "+Wy(t,e)}function Yy(t){var e=t.baseline,n=Ly(t);return Math.round("top"===e?.79*n:"middle"===e?.3*n:"bottom"===e?-.21*n:"line-top"===e?.29*n+.5*qy(t):"line-bottom"===e?.29*n-.5*qy(t):0)}By(!0);const Gy={left:"start",center:"middle",right:"end"},Vy=new nm;function Xy(t){var e,n=t.x||0,r=t.y||0,i=t.radius||0;return i&&(e=(t.theta||0)-yg,n+=i*Math.cos(e),r+=i*Math.sin(e)),Vy.x1=n,Vy.y1=r,Vy}function Jy(t,e,n){var r,i=zy.height(e),o=e.align,a=Xy(e),s=a.x1,u=a.y1,l=e.dx||0,c=(e.dy||0)+Yy(e)-Math.round(.8*i),f=Py(e);if(_(f)?(i+=qy(e)*(f.length-1),r=f.reduce(((t,n)=>Math.max(t,zy.width(e,n))),0)):r=zy.width(e,f),"center"===o?l-=r/2:"right"===o&&(l-=r),t.set(l+=s,c+=u,l+r,c+i),e.angle&&!n)t.rotate(e.angle*mg,s,u);else if(2===n)return t.rotatedPoints(e.angle*mg,s,u);return t}var Zy={type:"text",tag:"text",nested:!1,attr:function(t,e){var n,r=e.dx||0,i=(e.dy||0)+Yy(e),o=Xy(e),a=o.x1,s=o.y1,u=e.angle||0;t("text-anchor",Gy[e.align]||"start"),u?(n=ey(a,s)+" "+ny(u),(r||i)&&(n+=" "+ey(r,i))):n=ey(a+r,s+i),t("transform",n)},bound:Jy,draw:function(t,e,n){Gm(e,(e=>{var r,i,o,a,s,u,l,c=null==e.opacity?1:e.opacity;if(!(n&&!n.intersects(e.bounds)||0===c||e.fontSize<=0||null==e.text||0===e.text.length)){if(t.font=Hy(e),t.textAlign=e.align||"left",i=(r=Xy(e)).x1,o=r.y1,e.angle&&(t.save(),t.translate(i,o),t.rotate(e.angle*mg),i=o=0),i+=e.dx||0,o+=(e.dy||0)+Yy(e),u=Py(e),Um(t,e),_(u))for(s=qy(e),a=0;a<u.length;++a)l=Iy(e,u[a]),e.fill&&jm(t,e,c)&&t.fillText(l,i,o),e.stroke&&Wm(t,e,c)&&t.strokeText(l,i,o),o+=s;else l=Iy(e,u),e.fill&&jm(t,e,c)&&t.fillText(l,i,o),e.stroke&&Wm(t,e,c)&&t.strokeText(l,i,o);e.angle&&t.restore()}}))},pick:Qm((function(t,e,n,r,i,o){if(e.fontSize<=0)return!1;if(!e.angle)return!0;var a=Xy(e),s=a.x1,u=a.y1,l=Jy(Vy,e,1),c=-e.angle*mg,f=Math.cos(c),h=Math.sin(c),d=f*i-h*o+(s-f*s+h*u),p=h*i+f*o+(u-h*s-f*u);return l.contains(d,p)})),isect:function(t,e){const n=Jy(Vy,t,2);return Rm(e,n[0],n[1],n[2],n[3])||Rm(e,n[0],n[1],n[4],n[5])||Rm(e,n[4],n[5],n[6],n[7])||Rm(e,n[2],n[3],n[6],n[7])}},Qy=ay("trail",(function(t,e){return Zg.context(t)(e)}),(function(t,e){for(var n,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(n=t[i].x-e[0])*n+(r=t[i].y-e[1])*r<(n=t[i].size||1)*n)return t[i];return null})),Ky={arc:oy,area:sy,group:gy,image:wy,line:My,path:Ay,rect:Dy,rule:Fy,shape:Sy,symbol:Ty,text:Zy,trail:Qy};function tv(t,e,n){var r=Ky[t.mark.marktype],i=e||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new nm),t,n)}var ev={mark:null};function nv(t,e,n){var r,i,o,a,s=Ky[t.marktype],u=s.bound,l=t.items,c=l&&l.length;if(s.nested)return c?o=l[0]:(ev.mark=t,o=ev),a=tv(o,u,n),e=e&&e.union(a)||a;if(e=e||t.bounds&&t.bounds.clear()||new nm,c)for(r=0,i=l.length;r<i;++r)e.union(tv(l[r],u,n));return t.bounds=e}const rv=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function iv(t,e){return JSON.stringify(t,rv,e)}function ov(t){return av("string"==typeof t?JSON.parse(t):t)}function av(t){var e,n,r,i=t.marktype,o=t.items;if(o)for(n=0,r=o.length;n<r;++n)e=i?"mark":"group",o[n][e]=t,o[n].zindex&&(o[n][e].zdirty=!0),"group"===(i||e)&&av(o[n]);return i&&nv(t),t}class sv{constructor(t){arguments.length?this.root=ov(t):(this.root=uv({marktype:"group",name:"root",role:"frame"}),this.root.items=[new im(this.root)])}toJSON(t){return iv(this.root,t||0)}mark(t,e,n){const r=uv(t,e=e||this.root.items[0]);return e.items[n]=r,r.zindex&&(r.group.zdirty=!0),r}}function uv(t,e){const n={bounds:new nm,clip:!!t.clip,group:e,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0};return null!=t.aria&&(n.aria=t.aria),t.description&&(n.description=t.description),n}function lv(t,e,n){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?n?t.createElementNS(n,e):t.createElement(e):null}function cv(t,e){e=e.toLowerCase();for(var n=t.childNodes,r=0,i=n.length;r<i;++r)if(n[r].tagName.toLowerCase()===e)return n[r]}function fv(t,e,n,r){var i,o=t.childNodes[e];return o&&o.tagName.toLowerCase()===n.toLowerCase()||(i=o||null,o=lv(t.ownerDocument,n,r),t.insertBefore(o,i)),o}function hv(t,e){for(var n=t.childNodes,r=n.length;r>e;)t.removeChild(n[--r]);return t}function dv(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function pv(t,e){if(e.getScreenCTM){const n=function(t,e){if(!e)return null;const n=e.a*e.d-e.b*e.c;if(!n)return null;const r=t.clientX-e.e,i=t.clientY-e.f;return[(e.d*r-e.c*i)/n,(e.a*i-e.b*r)/n]}(t,e.getScreenCTM());if(n)return n}return function(t,e,n){const r=e.offsetWidth?n.width/e.offsetWidth:1,i=e.offsetHeight?n.height/e.offsetHeight:1;return[(t.clientX-n.left)/r-(e.clientLeft||0),(t.clientY-n.top)/i-(e.clientTop||0)]}(t,e,e.getBoundingClientRect())}class gv{constructor(t,e){this._active=null,this._handlers={},this._loader=t||xa(),this._tooltip=e||mv}initialize(t,e,n){return this._el=t,this._obj=n||null,this.origin(e)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,e,n){for(let r=t?t.length:0;--r>=0;)if(t[r].type===e&&(!n||t[r].handler===n))return r;return-1}handlers(t){const e=this._handlers,n=[];if(t)n.push(...e[this.eventName(t)]);else for(const t in e)n.push(...e[t]);return n}eventName(t){const e=t.indexOf(".");return e<0?t:t.slice(0,e)}handleHref(t,e,n){this._loader.sanitize(n,{context:"href"}).then((e=>{const n=new MouseEvent(t.type,t),r=lv(null,"a");for(const t in e)r.setAttribute(t,e[t]);r.dispatchEvent(n)})).catch((()=>{}))}handleTooltip(t,e,n){if(e&&null!=e.tooltip){e=function(t,e,n,r){var i,o,a=t&&t.mark;if(a&&(i=Ky[a.marktype]).tip){for((o=pv(e,n))[0]-=r[0],o[1]-=r[1];t=t.mark.group;)o[0]-=t.x||0,o[1]-=t.y||0;t=i.tip(a.items,o)}return t}(e,t,this.canvas(),this._origin);const r=n&&e&&e.tooltip||null;this._tooltip.call(this._obj,this,t,e,r)}}getItemBoundingClientRect(t){const e=this.canvas();if(!e)return;const n=e.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let s=i.x1+r[0]+n.left,u=i.y1+r[1]+n.top;for(;t.mark&&(t=t.mark.group);)s+=t.x||0,u+=t.y||0;return{x:s,y:u,width:o,height:a,left:s,top:u,right:s+o,bottom:u+a}}}function mv(t,e,n,r){t.element().setAttribute("title",r||"")}class yv{constructor(t){this._el=null,this._bgcolor=null,this._loader=new om(t)}initialize(t,e,n,r,i){return this._el=t,this.resize(e,n,r,i)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)}resize(t,e,n,r){return this._width=t,this._height=e,this._origin=n||[0,0],this._scale=r||1,this}dirty(){}render(t,e){const n=this;return n._call=function(){n._render(t,e)},n._call(),n._call=null,n}_render(){}renderAsync(t,e){const n=this.render(t,e);return this._ready?this._ready.then((()=>n)):Promise.resolve(n)}_load(t,e){var n=this,r=n._loader[t](e);if(!n._ready){const t=n._call;n._ready=n._loader.ready().then((e=>{e&&t(),n._ready=null}))}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const vv="dragenter",_v="dragleave",xv="dragover",bv="pointerdown",wv="pointermove",Mv="pointerout",kv="pointerover",Av="mousedown",Ev="mousemove",Dv="mouseout",Cv="mouseover",Fv="click",Sv="mousewheel",Tv="touchstart",$v="touchmove",zv="touchend",Bv=["keydown","keypress","keyup",vv,_v,xv,bv,"pointerup",wv,Mv,kv,Av,"mouseup",Ev,Dv,Cv,Fv,"dblclick","wheel",Sv,Tv,$v,zv],Ov=wv,Nv=Dv,Rv=Fv;class Uv extends gv{constructor(t,e){super(t,e),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Bv,this.pointermove=jv([wv,Ev],[kv,Cv],[Mv,Dv]),this.dragover=jv([xv],[vv],[_v]),this.pointerout=Iv([Mv,Dv]),this.dragleave=Iv([_v])}initialize(t,e,n){return this._canvas=t&&cv(t,"canvas"),[Fv,Av,bv,wv,Mv,_v].forEach((t=>qv(this,t))),super.initialize(t,e,n)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(Sv,t)}pointerdown(t){this._down=this._active,this.fire(bv,t)}mousedown(t){this._down=this._active,this.fire(Av,t)}click(t){this._down===this._active&&(this.fire(Fv,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Tv,t,!0)}touchmove(t){this.fire($v,t,!0)}touchend(t){this.fire(zv,t,!0),this._touch=null}fire(t,e,n){const r=n?this._touch:this._active,i=this._handlers[t];if(e.vegaType=t,t===Rv&&r&&r.href?this.handleHref(e,r,r.href):t!==Ov&&t!==Nv||this.handleTooltip(e,r,t!==Nv),i)for(let t=0,n=i.length;t<n;++t)i[t].handler.call(this._obj,e,r)}on(t,e){const n=this.eventName(t),r=this._handlers;return this._handlerIndex(r[n],t,e)<0&&(qv(this,t),(r[n]||(r[n]=[])).push({type:t,handler:e})),this}off(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&r.splice(i,1),this}pickEvent(t){const e=pv(t,this._canvas),n=this._origin;return this.pick(this._scene,e[0],e[1],e[0]-n[0],e[1]-n[1])}pick(t,e,n,r,i){const o=this.context();return Ky[t.marktype].pick.call(this,o,t,e,n,r,i)}}const Lv=t=>t===Tv||t===$v||t===zv?[Tv,$v,zv]:[t];function qv(t,e){Lv(e).forEach((e=>function(t,e){const n=t.canvas();n&&!t._events[e]&&(t._events[e]=1,n.addEventListener(e,t[e]?n=>t[e](n):n=>t.fire(e,n)))}(t,e)))}function Pv(t,e,n){e.forEach((e=>t.fire(e,n)))}function jv(t,e,n){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||Pv(this,n,r),this._active=o,Pv(this,e,r)),Pv(this,t,r)}}function Iv(t){return function(e){Pv(this,t,e),this._active=null}}function Wv(t,e,n,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,s=t.getContext("2d"),u=a?"undefined"!=typeof window&&window.devicePixelRatio||1:i;t.width=e*u,t.height=n*u;for(const t in o)s[t]=o[t];return a&&(t.style.width=e+"px",t.style.height=n+"px"),s.pixelRatio=u,s.setTransform(u,0,0,u,u*r[0],u*r[1]),t}class Hv extends yv{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new nm,this._tempb=new nm}initialize(t,e,n,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:jc(1,1,this._options.type),t&&this._canvas&&(hv(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks"),this._canvas.style.setProperty("vertical-align","bottom")),super.initialize(t,e,n,r,i)}resize(t,e,n,r){if(super.resize(t,e,n,r),this._canvas)Wv(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||s("CanvasRenderer is missing a valid canvas or context"),t.scale(this._scale,this._scale),t.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const e=this._tempb.clear().union(t.bounds);let n=t.mark.group;for(;n;)e.translate(n.x||0,n.y||0),n=n.mark.group;this._dirty.union(e)}_render(t,e){const n=this.context(),r=this._origin,i=this._width,o=this._height,a=this._dirty,s=Yv(r,i,o);n.save();const u=this._redraw||a.empty()?(this._redraw=!1,s.expand(1)):function(t,e,n){e.expand(1).round(),t.pixelRatio%1&&e.scale(t.pixelRatio).round().scale(1/t.pixelRatio);return e.translate(-n[0]%1,-n[1]%1),t.beginPath(),t.rect(e.x1,e.y1,e.width(),e.height()),t.clip(),e}(n,s.intersect(a),r);return this.clear(-r[0],-r[1],i,o),this.draw(n,t,u,e),n.restore(),a.clear(),this}draw(t,e,n,r){if("group"!==e.marktype&&null!=r&&!r.includes(e.marktype))return;const i=Ky[e.marktype];e.clip&&function(t,e){var n=e.clip;t.save(),X(n)?(t.beginPath(),n(t),t.clip()):uy(t,e.group)}(t,e),i.draw.call(this,t,e,n,r),e.clip&&t.restore()}clear(t,e,n,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,e,n,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,e,n,r))}}const Yv=(t,e,n)=>(new nm).set(0,0,e,n).translate(-t[0],-t[1]);class Gv extends gv{constructor(t,e){super(t,e);const n=this;n._hrefHandler=Vv(n,((t,e)=>{e&&e.href&&n.handleHref(t,e,e.href)})),n._tooltipHandler=Vv(n,((t,e)=>{n.handleTooltip(t,e,t.type!==Nv)}))}initialize(t,e,n){let r=this._svg;return r&&(r.removeEventListener(Rv,this._hrefHandler),r.removeEventListener(Ov,this._tooltipHandler),r.removeEventListener(Nv,this._tooltipHandler)),this._svg=r=t&&cv(t,"svg"),r&&(r.addEventListener(Rv,this._hrefHandler),r.addEventListener(Ov,this._tooltipHandler),r.addEventListener(Nv,this._tooltipHandler)),super.initialize(t,e,n)}canvas(){return this._svg}on(t,e){const n=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[n],t,e)<0){const i={type:t,handler:e,listener:Vv(this,e)};(r[n]||(r[n]=[])).push(i),this._svg&&this._svg.addEventListener(n,i.listener)}return this}off(t,e){const n=this.eventName(t),r=this._handlers[n],i=this._handlerIndex(r,t,e);return i>=0&&(this._svg&&this._svg.removeEventListener(n,r[i].listener),r.splice(i,1)),this}}const Vv=(t,e)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,e.call(t._obj,n,r)},Xv="aria-hidden",Jv="aria-label",Zv="role",Qv="aria-roledescription",Kv="graphics-object",t_="graphics-symbol",e_=(t,e,n)=>({[Zv]:t,[Qv]:e,[Jv]:n||void 0}),n_=St(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),r_={axis:{desc:"axis",caption:function(t){const e=t.datum,n=t.orient,r=e.title?u_(t):null,i=t.context,o=i.scales[e.scale].value,a=i.dataflow.locale(),s=o.type;return("left"===n||"right"===n?"Y":"X")+"-axis"+(r?` titled '${r}'`:"")+` for a ${bp(s)?"discrete":s} scale`+` with ${eg(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const e=t.datum,n=e.title?u_(t):null,r=`${e.type||""} legend`.trim(),i=e.scales,o=Object.keys(i),a=t.context,s=a.scales[i[o[0]]].value,u=a.dataflow.locale();return l=r,(l.length?l[0].toUpperCase()+l.slice(1):l)+(n?` titled '${n}'`:"")+` for ${function(t){return t=t.map((t=>t+("fill"===t||"stroke"===t?" color":""))),t.length<2?t[0]:t.slice(0,-1).join(", ")+" and "+A(t)}(o)}`+` with ${eg(u,s,t)}`;var l}},"title-text":{desc:"title",caption:t=>`Title text '${s_(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${s_(t)}'`}},i_={ariaRole:Zv,ariaRoleDescription:Qv,description:Jv};function o_(t,e){const n=!1===e.aria;if(t(Xv,n||void 0),n||null==e.description)for(const e in i_)t(i_[e],void 0);else{const n=e.mark.marktype;t(Jv,e.description),t(Zv,e.ariaRole||("group"===n?Kv:t_)),t(Qv,e.ariaRoleDescription||`${n} mark`)}}function a_(t){return!1===t.aria?{[Xv]:!0}:n_[t.role]?null:r_[t.role]?function(t,e){try{const n=t.items[0],r=e.caption||(()=>"");return e_(e.role||t_,e.desc,t.description||n.description||r(n))}catch(t){return null}}(t,r_[t.role]):function(t){const e=t.marktype,n="group"===e||"text"===e||t.items.some((t=>null!=t.description&&!1!==t.aria));return e_(n?Kv:t_,`${e} mark container`,t.description)}(t)}function s_(t){return G(t.text).join(" ")}function u_(t){try{return G(A(t.items).items[0].text).join(" ")}catch(t){return null}}const l_=t=>(t+"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");function c_(){let t="",e="",n="";const r=[],i=()=>e=n="",o=(t,n)=>{var r;return null!=n&&(e+=` ${t}="${r=n,l_(r).replace(/"/g,""").replace(/\t/g,"	").replace(/\n/g,"
").replace(/\r/g,"
")}"`),a},a={open(s,...u){(o=>{e&&(t+=`${e}>${n}`,i()),r.push(o)})(s),e="<"+s;for(const t of u)for(const e in t)o(e,t[e]);return a},close(){const o=r.pop();return t+=e?e+(n?`>${n}</${o}>`:"/>"):`</${o}>`,i(),a},attr:o,text:t=>(n+=l_(t),a),toString:()=>t};return a}const f_=t=>h_(c_(),t)+"";function h_(t,e){if(t.open(e.tagName),e.hasAttributes()){const n=e.attributes,r=n.length;for(let e=0;e<r;++e)t.attr(n[e].name,n[e].value)}if(e.hasChildNodes()){const n=e.childNodes;for(const e of n)3===e.nodeType?t.text(e.nodeValue):h_(t,e)}return t.close()}const d_={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"},p_={blend:"mix-blend-mode"},g_={fill:"none","stroke-miterlimit":4},m_="http://www.w3.org/2000/xmlns/",y_=my.xmlns;class v_ extends yv{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,e,n,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=fv(t,0,"svg",y_),this._svg.setAttributeNS(m_,"xmlns",y_),this._svg.setAttributeNS(m_,"xmlns:xlink",my["xmlns:xlink"]),this._svg.setAttribute("version",my.version),this._svg.setAttribute("class","marks"),this._svg.style.setProperty("vertical-align","bottom"),hv(t,1),this._root=fv(this._svg,0,"g",y_),C_(this._root,g_),hv(this._svg,1)),this.background(this._bgcolor),super.initialize(t,e,n,r,i)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,e,n,r){return super.resize(t,e,n,r),this._svg&&(C_(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const t=this._svg,e=this._bgcolor;if(!t)return null;const n=t.getAttribute("style");let r;t.removeAttribute("style"),e&&(r=fv(t,0,"rect",y_),C_(r,{width:this._width,height:this._height,fill:e}));const i=f_(t);return e&&t.removeChild(r),n&&t.setAttribute("style",n),i}_render(t,e){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,e),hv(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))}isDirty(t){return this._dirtyAll||!t._svg||!t._svg.ownerSVGElement||t.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const e=++this._dirtyID;let n,r,i,o,a,s,u;for(a=0,s=t.length;a<s;++a)n=t[a],r=n.mark,r.marktype!==i&&(i=r.marktype,o=Ky[i]),r.zdirty&&r.dirty!==e&&(this._dirtyAll=!1,__(n,e),r.items.forEach((t=>{t.dirty=e}))),r.zdirty||(n.exit?(o.nested&&r.items.length?(u=r.items[0],u._svg&&this._update(o,u._svg,u)):n._svg&&(u=n._svg.parentNode,u&&u.removeChild(n._svg)),n._svg=null):(n=o.nested?r.items[0]:n,n._update!==e&&(n._svg&&n._svg.ownerSVGElement?this._update(o,n._svg,n):(this._dirtyAll=!1,__(n,e)),n._update=e)));return!this._dirtyAll}mark(t,e,n,r){if(!this.isDirty(e))return e._svg;const i=this._svg,o=e.marktype,a=Ky[o],s=!1===e.interactive?"none":null,u="g"===a.tag,l=w_(e,t,n,"g",i);if("group"!==o&&null!=r&&!r.includes(o))return hv(l,0),e._svg;l.setAttribute("class",dv(e));const c=a_(e);for(const t in c)F_(l,t,c[t]);u||F_(l,"pointer-events",s),F_(l,"clip-path",e.clip?em(this,e,e.group):null);let f=null,h=0;const d=t=>{const e=this.isDirty(t),n=w_(t,l,f,a.tag,i);e&&(this._update(a,n,t),u&&function(t,e,n,r){e=e.lastChild.previousSibling;let i,o=0;Gm(n,(n=>{i=t.mark(e,n,i,r),++o})),hv(e,1+o)}(this,n,t,r)),f=n,++h};return a.nested?e.items.length&&d(e.items[0]):Gm(e,d),hv(l,h),l}_update(t,e,n){M_=e,k_=e.__values__,o_(E_,n),t.attr(E_,n,this);const r=A_[t.type];r&&r.call(this,t,e,n),M_&&this.style(M_,n)}style(t,e){if(null!=e){for(const n in d_){let r="font"===n?Wy(e):e[n];if(r===k_[n])continue;const i=d_[n];null==r?t.removeAttribute(i):(ig(r)&&(r=og(r,this._defs.gradient,S_())),t.setAttribute(i,r+"")),k_[n]=r}for(const n in p_)D_(t,p_[n],e[n])}}defs(){const t=this._svg,e=this._defs;let n=e.el,r=0;for(const i in e.gradient)n||(e.el=n=fv(t,1,"defs",y_)),r=x_(n,e.gradient[i],r);for(const i in e.clipping)n||(e.el=n=fv(t,1,"defs",y_)),r=b_(n,e.clipping[i],r);n&&(0===r?(t.removeChild(n),e.el=null):hv(n,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function __(t,e){for(;t&&t.dirty!==e;t=t.mark.group){if(t.dirty=e,!t.mark||t.mark.dirty===e)return;t.mark.dirty=e}}function x_(t,e,n){let r,i,o;if("radial"===e.gradient){let r=fv(t,n++,"pattern",y_);C_(r,{id:rg+e.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=fv(r,0,"rect",y_),C_(r,{width:1,height:1,fill:`url(${S_()}#${e.id})`}),C_(t=fv(t,n++,"radialGradient",y_),{id:e.id,fx:e.x1,fy:e.y1,fr:e.r1,cx:e.x2,cy:e.y2,r:e.r2})}else C_(t=fv(t,n++,"linearGradient",y_),{id:e.id,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2});for(r=0,i=e.stops.length;r<i;++r)o=fv(t,r,"stop",y_),o.setAttribute("offset",e.stops[r].offset),o.setAttribute("stop-color",e.stops[r].color);return hv(t,r),n}function b_(t,e,n){let r;return(t=fv(t,n,"clipPath",y_)).setAttribute("id",e.id),e.path?(r=fv(t,0,"path",y_),r.setAttribute("d",e.path)):(r=fv(t,0,"rect",y_),C_(r,{x:0,y:0,width:e.width,height:e.height})),hv(t,1),n+1}function w_(t,e,n,r,i){let o,a=t._svg;if(!a&&(o=e.ownerDocument,a=lv(o,r,y_),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){const e=lv(o,"path",y_);a.appendChild(e),e.__data__=t;const n=lv(o,"g",y_);a.appendChild(n),n.__data__=t;const r=lv(o,"path",y_);a.appendChild(r),r.__data__=t,r.__values__={fill:"default"}}return(a.ownerSVGElement!==i||function(t,e){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=e}(a,n))&&e.insertBefore(a,n?n.nextSibling:e.firstChild),a}let M_=null,k_=null;const A_={group(t,e,n){const r=M_=e.childNodes[2];k_=r.__values__,t.foreground(E_,n,this),k_=e.__values__,M_=e.childNodes[1],t.content(E_,n,this);const i=M_=e.childNodes[0];t.background(E_,n,this);const o=!1===n.mark.interactive?"none":null;if(o!==k_.events&&(F_(r,"pointer-events",o),F_(i,"pointer-events",o),k_.events=o),n.strokeForeground&&n.stroke){const t=n.fill;F_(r,"display",null),this.style(i,n),F_(i,"stroke",null),t&&(n.fill=null),k_=r.__values__,this.style(r,n),t&&(n.fill=t),M_=null}else F_(r,"display","none")},image(t,e,n){!1===n.smooth?(D_(e,"image-rendering","optimizeSpeed"),D_(e,"image-rendering","pixelated")):D_(e,"image-rendering",null)},text(t,e,n){const r=Py(n);let i,o,a,s;_(r)?(o=r.map((t=>Iy(n,t))),i=o.join("\n"),i!==k_.text&&(hv(e,0),a=e.ownerDocument,s=qy(n),o.forEach(((t,r)=>{const i=lv(a,"tspan",y_);i.__data__=n,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",s)),e.appendChild(i)})),k_.text=i)):(o=Iy(n,r),o!==k_.text&&(e.textContent=o,k_.text=o)),F_(e,"font-family",Wy(n)),F_(e,"font-size",Ly(n)+"px"),F_(e,"font-style",n.fontStyle),F_(e,"font-variant",n.fontVariant),F_(e,"font-weight",n.fontWeight)}};function E_(t,e,n){e!==k_[t]&&(n?function(t,e,n,r){null!=n?t.setAttributeNS(r,e,n):t.removeAttributeNS(r,e)}(M_,t,e,n):F_(M_,t,e),k_[t]=e)}function D_(t,e,n){n!==k_[e]&&(null==n?t.style.removeProperty(e):t.style.setProperty(e,n+""),k_[e]=n)}function C_(t,e){for(const n in e)F_(t,n,e[n])}function F_(t,e,n){null!=n?t.setAttribute(e,n):t.removeAttribute(e)}function S_(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class T_ extends yv{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const e=c_();e.open("svg",rt({},my,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const n=this._bgcolor;return n&&"transparent"!==n&&"none"!==n&&e.open("rect",{width:this._width,height:this._height,fill:n}).close(),e.open("g",g_,{transform:"translate("+this._origin+")"}),this.mark(e,t),e.close(),this.defs(e),this._text=e.close()+"",this}mark(t,e){const n=Ky[e.marktype],r=n.tag,i=[o_,n.attr];t.open("g",{class:dv(e),"clip-path":e.clip?em(this,e,e.group):null},a_(e),{"pointer-events":"g"!==r&&!1===e.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(e,o,i,"g"!==r?r:null)),"text"===r){const e=Py(o);if(_(e)){const n={x:0,dy:qy(o)};for(let r=0;r<e.length;++r)t.open("tspan",r?n:null).text(Iy(o,e[r])).close()}else t.text(Iy(o,e))}else if("g"===r){const r=o.strokeForeground,i=o.fill,a=o.stroke;r&&a&&(o.stroke=null),t.open("path",this.attr(e,o,n.background,"bgrect")).close(),t.open("g",this.attr(e,o,n.content)),Gm(o,(e=>this.mark(t,e))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(e,o,n.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(e,o,n.foreground,"bgfore")).close()}t.close(),a&&t.close()};return n.nested?e.items&&e.items.length&&o(e.items[0]):Gm(e,o),t.close()}href(t){const e=t.href;let n;if(e){if(n=this._hrefs&&this._hrefs[e])return n;this.sanitizeURL(e).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[e]=t}))}return null}attr(t,e,n,r){const i={},o=(t,e,n,r)=>{i[r||t]=e};return Array.isArray(n)?n.forEach((t=>t(o,e,this))):n(o,e,this),r&&function(t,e,n,r,i){let o;if(null==e)return t;"bgrect"===r&&!1===n.interactive&&(t["pointer-events"]="none");if("bgfore"===r&&(!1===n.interactive&&(t["pointer-events"]="none"),t.display="none",null!==e.fill))return t;"image"===r&&!1===e.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]);"text"===r&&(t["font-family"]=Wy(e),t["font-size"]=Ly(e)+"px",t["font-style"]=e.fontStyle,t["font-variant"]=e.fontVariant,t["font-weight"]=e.fontWeight);for(const n in d_){let r=e[n];const o=d_[n];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(ig(r)&&(r=og(r,i.gradient,"")),t[o]=r)}for(const t in p_){const n=e[t];null!=n&&(o=o||[],o.push(`${p_[t]}: ${n};`))}o&&(t.style=o.join(" "))}(i,e,t,r,this._defs),i}defs(t){const e=this._defs.gradient,n=this._defs.clipping;if(0!==Object.keys(e).length+Object.keys(n).length){t.open("defs");for(const n in e){const r=e[n],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:rg+n,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+n+")"}).close(),t.close(),t.open("radialGradient",{id:n,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:n,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let e=0;e<i.length;++e)t.open("stop",{offset:i[e].offset,"stop-color":i[e].color}).close();t.close()}for(const e in n){const r=n[e];t.open("clipPath",{id:e}),r.path?t.open("path",{d:r.path}).close():t.open("rect",{x:0,y:0,width:r.width,height:r.height}).close(),t.close()}t.close()}}}const $_={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class z_ extends yv{constructor(t){super(t),this._svgRenderer=new v_(t),this._canvasRenderer=new Hv(t)}initialize(t,e,n,r,i){this._root_el=fv(t,0,"div");const o=fv(this._root_el,0,"div"),a=fv(this._root_el,1,"div");return this._root_el.style.position="relative",$_.debug||(o.style.height="100%",a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.height="100%",a.style.width="100%"),this._svgEl=$_.svgOnTop?a:o,this._canvasEl=$_.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,e,n,r,i),this._svgRenderer.initialize(this._svgEl,e,n,r,i),super.initialize(t,e,n,r,i)}dirty(t){return $_.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,e){const n=(e??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((t=>!$_.svgMarkTypes.includes(t)));this._svgRenderer.render(t,$_.svgMarkTypes),this._canvasRenderer.render(t,n)}resize(t,e,n,r){return super.resize(t,e,n,r),this._svgRenderer.resize(t,e,n,r),this._canvasRenderer.resize(t,e,n,r),this}background(t){return $_.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class B_ extends Uv{constructor(t,e){super(t,e)}initialize(t,e,n){const r=fv(fv(t,0,"div"),$_.svgOnTop?0:1,"div");return super.initialize(r,e,n)}}const O_="canvas",N_="hybrid",R_="none",U_={Canvas:O_,PNG:"png",SVG:"svg",Hybrid:N_,None:R_},L_={};function q_(t,e){return t=String(t||"").toLowerCase(),arguments.length>1?(L_[t]=e,this):L_[t]}function P_(t,e,n){const r=[],i=(new nm).union(e),o=t.marktype;return o?j_(t,i,n,r):"group"===o?I_(t,i,n,r):s("Intersect scene must be mark node or group item.")}function j_(t,e,n,r){if(function(t,e,n){return t.bounds&&e.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!n||n(t)))}(t,e,n)){const i=t.items,o=t.marktype,a=i.length;let s=0;if("group"===o)for(;s<a;++s)I_(i[s],e,n,r);else for(const t=Ky[o].isect;s<a;++s){const n=i[s];W_(n,e,t)&&r.push(n)}}return r}function I_(t,e,n,r){n&&n(t.mark)&&W_(t,e,Ky.group.isect)&&r.push(t);const i=t.items,o=i&&i.length;if(o){const a=t.x||0,s=t.y||0;e.translate(-a,-s);for(let t=0;t<o;++t)j_(i[t],e,n,r);e.translate(a,s)}return r}function W_(t,e,n){const r=t.bounds;return e.encloses(r)||e.intersects(r)&&n(t,e)}L_[O_]=L_.png={renderer:Hv,headless:Hv,handler:Uv},L_.svg={renderer:v_,headless:T_,handler:Gv},L_[N_]={renderer:z_,headless:z_,handler:B_},L_[R_]={};const H_=new nm;function Y_(t){const e=t.clip;if(X(e))e(Em(H_.clear()));else{if(!e)return;H_.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(H_)}function G_(t,e,n){return t===e||("path"===n?V_(t,e):t instanceof Date&&e instanceof Date?+t==+e:gt(t)&>(e)?Math.abs(t-e)<=1e-9:t&&e&&(x(t)||x(e))?function(t,e){var n,r,i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(i.sort(),o.sort(),r=i.length-1;r>=0;r--)if(i[r]!=o[r])return!1;for(r=i.length-1;r>=0;r--)if(!G_(t[n=i[r]],e[n],n))return!1;return typeof t==typeof e}(t,e):t==e)}function V_(t,e){return G_(gg(t),gg(e))}const X_="top",J_="left",Z_="right",Q_="bottom",K_="start",tx="middle",ex="end",nx="group",rx="bounds",ix="axis",ox="title",ax="frame",sx="scope",ux="legend",lx="row-header",cx="row-footer",fx="row-title",hx="column-header",dx="column-footer",px="column-title",gx="padding",mx="fit",yx="fit-x",vx="fit-y",_x="none",xx="all",bx="each",wx="flush",Mx="column",kx="row";function Ax(t){as.call(this,null,t)}function Ex(t,e,n){return e(t.bounds.clear(),t,n)}ct(Ax,as,{transform(t,e){const n=e.dataflow,r=t.mark,i=r.marktype,o=Ky[i],a=o.bound;let s,u=r.bounds;if(o.nested)r.items.length&&n.dirty(r.items[0]),u=Ex(r,a),r.items.forEach((t=>{t.bounds.clear().union(u)}));else if(i===nx||t.modified())switch(e.visit(e.MOD,(t=>n.dirty(t))),u.clear(),r.items.forEach((t=>u.union(Ex(t,a)))),r.role){case ix:case ux:case ox:e.reflow()}else s=e.changed(e.REM),e.visit(e.ADD,(t=>{u.union(Ex(t,a))})),e.visit(e.MOD,(t=>{s=s||u.alignsWith(t.bounds),n.dirty(t),u.union(Ex(t,a))})),s&&(u.clear(),r.items.forEach((t=>u.union(t.bounds))));return Y_(r),e.modifies("bounds")}});const Dx=":vega_identifier:";function Cx(t){as.call(this,0,t)}function Fx(t){as.call(this,null,t)}function Sx(t){as.call(this,null,t)}Cx.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ct(Cx,as,{transform(t,e){const n=(i=e.dataflow)._signals[Dx]||(i._signals[Dx]=i.add(0)),r=t.as;var i;let o=n.value;return e.visit(e.ADD,(t=>t[r]=t[r]||++o)),n.set(this.value=o),e}}),ct(Fx,as,{transform(t,e){let n=this.value;n||(n=e.dataflow.scenegraph().mark(t.markdef,function(t){const e=t.groups,n=t.parent;return e&&1===e.size?e.get(Object.keys(e.object)[0]):e&&n?e.lookup(n):null}(t),t.index),n.group.context=t.context,t.context.group||(t.context.group=n.group),n.source=this.source,n.clip=t.clip,n.interactive=t.interactive,this.value=n);const r=n.marktype===nx?im:rm;return e.visit(e.ADD,(t=>r.call(t,n))),(t.modified("clip")||t.modified("interactive"))&&(n.clip=t.clip,n.interactive=!!t.interactive,n.zdirty=!0,e.reflow()),n.items=e.source,e}});const Tx={parity:t=>t.filter(((t,e)=>e%2?t.opacity=0:1)),greedy:(t,e)=>{let n;return t.filter(((t,r)=>r&&$x(n.bounds,t.bounds,e)?t.opacity=0:(n=t,1)))}},$x=(t,e,n)=>n>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2),zx=(t,e)=>{for(var n,r=1,i=t.length,o=t[0].bounds;r<i;o=n,++r)if($x(o,n=t[r].bounds,e))return!0},Bx=t=>{const e=t.bounds;return e.width()>1&&e.height()>1},Ox=t=>(t.forEach((t=>t.opacity=1)),t),Nx=(t,e)=>t.reflow(e.modified()).modifies("opacity");function Rx(t){as.call(this,null,t)}ct(Sx,as,{transform(t,e){const n=Tx[t.method]||Tx.parity,r=t.separation||0;let i,o,a=e.materialize(e.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(Ox(a),e=Nx(e,t)),e;if(a=a.filter(Bx),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=Ox(a),e=Nx(e,t),i.length>=3&&zx(i,r)){do{i=n(i,r)}while(i.length>=3&&zx(i,r));i.length<3&&!A(a).opacity&&(i.length>1&&(A(i).opacity=0),A(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,e,n)=>{var r=t.range(),i=new nm;return e===X_||e===Q_?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const s=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&s.union(t.bounds)})),e}}),ct(Rx,as,{transform(t,e){const n=e.dataflow;if(e.visit(e.ALL,(t=>n.dirty(t))),e.fields&&e.fields.zindex){const t=e.source&&e.source[0];t&&(t.mark.zdirty=!0)}}});const Ux=new nm;function Lx(t,e,n){return t[e]===n?0:(t[e]=n,1)}function qx(t){var e=t.items[0].orient;return e===J_||e===Z_}function Px(t,e,n,r){var i,o,a=e.items[0],s=a.datum,u=null!=a.translate?a.translate:.5,l=a.orient,c=function(t){let e=+t.grid;return[t.ticks?e++:-1,t.labels?e++:-1,e+ +t.domain]}(s),f=a.range,h=a.offset,d=a.position,p=a.minExtent,g=a.maxExtent,m=s.title&&a.items[c[2]].items[0],y=a.titlePadding,v=a.bounds,_=m&&jy(m),x=0,b=0;switch(Ux.clear().union(v),v.clear(),(i=c[0])>-1&&v.union(a.items[i].bounds),(i=c[1])>-1&&v.union(a.items[i].bounds),l){case X_:x=d||0,b=-h,o=Math.max(p,Math.min(g,-v.y1)),v.add(0,-o).add(f,0),m&&jx(t,m,o,y,_,0,-1,v);break;case J_:x=-h,b=d||0,o=Math.max(p,Math.min(g,-v.x1)),v.add(-o,0).add(0,f),m&&jx(t,m,o,y,_,1,-1,v);break;case Z_:x=n+h,b=d||0,o=Math.max(p,Math.min(g,v.x2)),v.add(0,0).add(o,f),m&&jx(t,m,o,y,_,1,1,v);break;case Q_:x=d||0,b=r+h,o=Math.max(p,Math.min(g,v.y2)),v.add(0,0).add(f,o),m&&jx(t,m,o,y,0,0,1,v);break;default:x=a.x,b=a.y}return um(v.translate(x,b),a),Lx(a,"x",x+u)|Lx(a,"y",b+u)&&(a.bounds=Ux,t.dirty(a),a.bounds=v,t.dirty(a)),a.mark.bounds.clear().union(v)}function jx(t,e,n,r,i,o,a,s){const u=e.bounds;if(e.auto){const s=a*(n+i+r);let l=0,c=0;t.dirty(e),o?l=(e.x||0)-(e.x=s):c=(e.y||0)-(e.y=s),e.mark.bounds.clear().union(u.translate(-l,-c)),t.dirty(e)}s.union(u)}const Ix=(t,e)=>Math.floor(Math.min(t,e)),Wx=(t,e)=>Math.ceil(Math.max(t,e));function Hx(t){return(new nm).set(0,0,t.width||0,t.height||0)}function Yx(t){const e=t.bounds.clone();return e.empty()?e.set(0,0,0,0):e.translate(-(t.x||0),-(t.y||0))}function Gx(t,e,n){const r=x(t)?t[e]:t;return null!=r?r:void 0!==n?n:0}function Vx(t){return t<0?Math.ceil(-t):0}function Xx(t,e,n){var r,i,o,a,s,u,l,c,f,h,d,p=!n.nodirty,g=n.bounds===wx?Hx:Yx,m=Ux.set(0,0,0,0),y=Gx(n.align,Mx),v=Gx(n.align,kx),_=Gx(n.padding,Mx),x=Gx(n.padding,kx),b=n.columns||e.length,w=b<=0?1:Math.ceil(e.length/b),M=e.length,k=Array(M),A=Array(b),E=0,D=Array(M),C=Array(w),F=0,S=Array(M),T=Array(M),$=Array(M);for(i=0;i<b;++i)A[i]=0;for(i=0;i<w;++i)C[i]=0;for(i=0;i<M;++i)u=e[i],s=$[i]=g(u),u.x=u.x||0,S[i]=0,u.y=u.y||0,T[i]=0,o=i%b,a=~~(i/b),E=Math.max(E,l=Math.ceil(s.x2)),F=Math.max(F,c=Math.ceil(s.y2)),A[o]=Math.max(A[o],l),C[a]=Math.max(C[a],c),k[i]=_+Vx(s.x1),D[i]=x+Vx(s.y1),p&&t.dirty(e[i]);for(i=0;i<M;++i)i%b==0&&(k[i]=0),i<b&&(D[i]=0);if(y===bx)for(o=1;o<b;++o){for(d=0,i=o;i<M;i+=b)d<k[i]&&(d=k[i]);for(i=o;i<M;i+=b)k[i]=d+A[o-1]}else if(y===xx){for(d=0,i=0;i<M;++i)i%b&&d<k[i]&&(d=k[i]);for(i=0;i<M;++i)i%b&&(k[i]=d+E)}else for(y=!1,o=1;o<b;++o)for(i=o;i<M;i+=b)k[i]+=A[o-1];if(v===bx)for(a=1;a<w;++a){for(d=0,r=(i=a*b)+b;i<r;++i)d<D[i]&&(d=D[i]);for(i=a*b;i<r;++i)D[i]=d+C[a-1]}else if(v===xx){for(d=0,i=b;i<M;++i)d<D[i]&&(d=D[i]);for(i=b;i<M;++i)D[i]=d+F}else for(v=!1,a=1;a<w;++a)for(r=(i=a*b)+b;i<r;++i)D[i]+=C[a-1];for(f=0,i=0;i<M;++i)f=k[i]+(i%b?f:0),S[i]+=f-e[i].x;for(o=0;o<b;++o)for(h=0,i=o;i<M;i+=b)h+=D[i],T[i]+=h-e[i].y;if(y&&Gx(n.center,Mx)&&w>1)for(i=0;i<M;++i)(f=(s=y===xx?E:A[i%b])-$[i].x2-e[i].x-S[i])>0&&(S[i]+=f/2);if(v&&Gx(n.center,kx)&&1!==b)for(i=0;i<M;++i)(h=(s=v===xx?F:C[~~(i/b)])-$[i].y2-e[i].y-T[i])>0&&(T[i]+=h/2);for(i=0;i<M;++i)m.union($[i].translate(S[i],T[i]));switch(f=Gx(n.anchor,"x"),h=Gx(n.anchor,"y"),Gx(n.anchor,Mx)){case ex:f-=m.width();break;case tx:f-=m.width()/2}switch(Gx(n.anchor,kx)){case ex:h-=m.height();break;case tx:h-=m.height()/2}for(f=Math.round(f),h=Math.round(h),m.clear(),i=0;i<M;++i)e[i].mark.bounds.clear();for(i=0;i<M;++i)(u=e[i]).x+=S[i]+=f,u.y+=T[i]+=h,m.union(u.mark.bounds.union(u.bounds.translate(S[i],T[i]))),p&&t.dirty(u);return m}function Jx(t,e,n){var r,i,o,a,s,u,l,c=function(t){var e,n,r=t.items,i=r.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<i;++o)if(n=(e=r[o]).items,e.marktype===nx)switch(e.role){case ix:case ux:case ox:break;case lx:a.rowheaders.push(...n);break;case cx:a.rowfooters.push(...n);break;case hx:a.colheaders.push(...n);break;case dx:a.colfooters.push(...n);break;case fx:a.rowtitle=n[0];break;case px:a.coltitle=n[0];break;default:a.marks.push(...n)}return a}(e),f=c.marks,h=n.bounds===wx?Zx:Qx,d=n.offset,p=n.columns||f.length,g=p<=0?1:Math.ceil(f.length/p),m=g*p;const y=Xx(t,f,n);y.empty()&&y.set(0,0,0,0),c.rowheaders&&(u=Gx(n.headerBand,kx,null),r=Kx(t,c.rowheaders,f,p,g,-Gx(d,"rowHeader"),Ix,0,h,"x1",0,p,1,u)),c.colheaders&&(u=Gx(n.headerBand,Mx,null),i=Kx(t,c.colheaders,f,p,p,-Gx(d,"columnHeader"),Ix,1,h,"y1",0,1,p,u)),c.rowfooters&&(u=Gx(n.footerBand,kx,null),o=Kx(t,c.rowfooters,f,p,g,Gx(d,"rowFooter"),Wx,0,h,"x2",p-1,p,1,u)),c.colfooters&&(u=Gx(n.footerBand,Mx,null),a=Kx(t,c.colfooters,f,p,p,Gx(d,"columnFooter"),Wx,1,h,"y2",m-p,1,p,u)),c.rowtitle&&(s=Gx(n.titleAnchor,kx),l=Gx(d,"rowTitle"),l=s===ex?o+l:r-l,u=Gx(n.titleBand,kx,.5),tb(t,c.rowtitle,l,0,y,u)),c.coltitle&&(s=Gx(n.titleAnchor,Mx),l=Gx(d,"columnTitle"),l=s===ex?a+l:i-l,u=Gx(n.titleBand,Mx,.5),tb(t,c.coltitle,l,1,y,u))}function Zx(t,e){return"x1"===e?t.x||0:"y1"===e?t.y||0:"x2"===e?(t.x||0)+(t.width||0):"y2"===e?(t.y||0)+(t.height||0):void 0}function Qx(t,e){return t.bounds[e]}function Kx(t,e,n,r,i,o,a,s,u,l,c,f,h,d){var p,g,m,y,v,_,x,b,w,M=n.length,k=0,A=0;if(!M)return k;for(p=c;p<M;p+=f)n[p]&&(k=a(k,u(n[p],l)));if(!e.length)return k;for(e.length>i&&(t.warn("Grid headers exceed limit: "+i),e=e.slice(0,i)),k+=o,g=0,y=e.length;g<y;++g)t.dirty(e[g]),e[g].mark.bounds.clear();for(p=c,g=0,y=e.length;g<y;++g,p+=f){for(v=(_=e[g]).mark.bounds,m=p;m>=0&&null==(x=n[m]);m-=h);s?(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())),v.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),A=a(A,v[l])}return A}function tb(t,e,n,r,i,o){if(e){t.dirty(e);var a=n,s=n;r?a=Math.round(i.x1+o*i.width()):s=Math.round(i.y1+o*i.height()),e.bounds.translate(a-(e.x||0),s-(e.y||0)),e.mark.bounds.clear().union(e.bounds),e.x=a,e.y=s,t.dirty(e)}}function eb(t,e,n,r,i,o,a){const s=function(t,e){const n=t[e]||{};return(e,r)=>null!=n[e]?n[e]:null!=t[e]?t[e]:r}(n,e),u=function(t,e){let n=-1/0;return t.forEach((t=>{null!=t.offset&&(n=Math.max(n,t.offset))})),n>-1/0?n:e}(t,s("offset",0)),l=s("anchor",K_),c=s("frame",nx),f=l===ex?1:l===tx?.5:0,h=c===rx?r.x1+f*r.width():f*(o||i.width()+2*i.x1),d=c===rx?i.y1+f*i.height():f*(a||r.height()+2*r.y1),p={align:bx,bounds:s("bounds",wx),columns:"vertical"===s("direction")?1:t.length,padding:s("margin",8),center:s("center"),nodirty:!0};switch(e){case J_:p.anchor={x:Math.floor(r.x1)-u,column:ex,y:d,row:l};break;case Z_:p.anchor={x:Math.ceil(r.x2)+u,y:d,row:l};break;case X_:p.anchor={y:Math.floor(i.y1)-u,row:ex,x:h,column:l};break;case Q_:p.anchor={y:Math.ceil(i.y2)+u,x:h,column:l};break;case"top-left":p.anchor={x:u,y:u};break;case"top-right":p.anchor={x:o-u,y:u,column:ex};break;case"bottom-left":p.anchor={x:u,y:a-u,row:ex};break;case"bottom-right":p.anchor={x:o-u,y:a-u,column:ex,row:ex}}return p}function nb(t,e){var n,r,i=e.items[0],o=i.datum,a=i.orient,s=i.bounds,u=i.x,l=i.y;return i._bounds?i._bounds.clear().union(s):i._bounds=s.clone(),s.clear(),function(t,e,n){var r=e.padding,i=r-n.x,o=r-n.y;if(e.datum.title){var a=e.items[1].items[0],s=a.anchor,u=e.titlePadding||0,l=r-a.x,c=r-a.y;switch(a.orient){case J_:i+=Math.ceil(a.bounds.width())+u;break;case Z_:case Q_:break;default:o+=a.bounds.height()+u}switch((i||o)&&ib(t,n,i,o),a.orient){case J_:c+=rb(e,n,a,s,1,1);break;case Z_:l+=rb(e,n,a,ex,0,0)+u,c+=rb(e,n,a,s,1,1);break;case Q_:l+=rb(e,n,a,s,0,0),c+=rb(e,n,a,ex,-1,0,1)+u;break;default:l+=rb(e,n,a,s,0,0)}(l||c)&&ib(t,a,l,c),(l=Math.round(a.bounds.x1-r))<0&&(ib(t,n,-l,0),ib(t,a,-l,0))}else(i||o)&&ib(t,n,i,o)}(t,i,i.items[0].items[0]),s=function(t,e){t.items.forEach((t=>e.union(t.bounds))),e.empty()&&(e.x2=t.padding,e.y2=t.padding);return e.x1=t.padding,e.y1=t.padding,e}(i,s),n=2*i.padding,r=2*i.padding,s.empty()||(n=Math.ceil(s.width()+n),r=Math.ceil(s.height()+r)),"symbol"===o.type&&function(t){const e=t.reduce(((t,e)=>(t[e.column]=Math.max(e.bounds.x2-e.x,t[e.column]||0),t)),{});t.forEach((t=>{t.width=e[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==_x&&(i.x=u=0,i.y=l=0),i.width=n,i.height=r,um(s.set(u,l,u+n,l+r),i),i.mark.bounds.clear().union(s),i}function rb(t,e,n,r,i,o,a){const s="symbol"!==t.datum.type,u=n.datum.vgrad,l=(!s||!o&&u||a?e:e.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&o?l:0,f=u&&o?0:l,h=i<=0?0:jy(n);return Math.round(r===K_?c:r===ex?f-h:.5*(l-h))}function ib(t,e,n,r){e.x+=n,e.y+=r,e.bounds.translate(n,r),e.mark.bounds.translate(n,r),t.dirty(e)}function ob(t){as.call(this,null,t)}ct(ob,as,{transform(t,e){const n=e.dataflow;return t.mark.items.forEach((e=>{t.layout&&Jx(n,e,t.layout),function(t,e,n){var r,i,o,a,s,u=e.items,l=Math.max(0,e.width||0),c=Math.max(0,e.height||0),f=(new nm).set(0,0,l,c),h=f.clone(),d=f.clone(),p=[];for(a=0,s=u.length;a<s;++a)switch((i=u[a]).role){case ix:(qx(i)?h:d).union(Px(t,i,l,c));break;case ox:r=i;break;case ux:p.push(nb(t,i));break;case ax:case sx:case lx:case cx:case fx:case hx:case dx:case px:h.union(i.bounds),d.union(i.bounds);break;default:f.union(i.bounds)}if(p.length){const e={};p.forEach((t=>{(o=t.orient||Z_)!==_x&&(e[o]||(e[o]=[])).push(t)}));for(const r in e){const i=e[r];Xx(t,i,eb(i,r,n.legends,h,d,l,c))}p.forEach((e=>{const r=e.bounds;if(r.equals(e._bounds)||(e.bounds=e._bounds,t.dirty(e),e.bounds=r,t.dirty(e)),!n.autosize||n.autosize.type!==mx&&n.autosize.type!==yx&&n.autosize.type!==vx)f.union(r);else switch(e.orient){case J_:case Z_:f.add(r.x1,0).add(r.x2,0);break;case X_:case Q_:f.add(0,r.y1).add(0,r.y2)}}))}f.union(h).union(d),r&&f.union(function(t,e,n,r,i){var o,a=e.items[0],s=a.frame,u=a.orient,l=a.anchor,c=a.offset,f=a.padding,h=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],p=u===J_||u===Z_?r:n,g=0,m=0,y=0,v=0,_=0;if(s!==nx?u===J_?(g=i.y2,p=i.y1):u===Z_?(g=i.y1,p=i.y2):(g=i.x1,p=i.x2):u===J_&&(g=r,p=0),o=l===K_?g:l===ex?p:(g+p)/2,d&&d.text){switch(u){case X_:case Q_:_=h.bounds.height()+f;break;case J_:v=h.bounds.width()+f;break;case Z_:v=-h.bounds.width()-f}Ux.clear().union(d.bounds),Ux.translate(v-(d.x||0),_-(d.y||0)),Lx(d,"x",v)|Lx(d,"y",_)&&(t.dirty(d),d.bounds.clear().union(Ux),d.mark.bounds.clear().union(Ux),t.dirty(d)),Ux.clear().union(d.bounds)}else Ux.clear();switch(Ux.union(h.bounds),u){case X_:m=o,y=i.y1-Ux.height()-c;break;case J_:m=i.x1-Ux.width()-c,y=o;break;case Z_:m=i.x2+Ux.width()+c,y=o;break;case Q_:m=o,y=i.y2+c;break;default:m=a.x,y=a.y}return Lx(a,"x",m)|Lx(a,"y",y)&&(Ux.translate(m,y),t.dirty(a),a.bounds.clear().union(Ux),e.bounds.clear().union(Ux),t.dirty(a)),a.bounds}(t,r,l,c,f));e.clip&&f.set(0,0,e.width||0,e.height||0);!function(t,e,n,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,s=t._height,u=Math.max(0,e.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,e.height||0),f=Math.max(0,Math.ceil(-n.y1));const h=Math.max(0,Math.ceil(n.x2-u)),d=Math.max(0,Math.ceil(n.y2-c));if(i.contains===gx){const e=t.padding();a-=e.left+e.right,s-=e.top+e.bottom}o===_x?(l=0,f=0,u=a,c=s):o===mx?(u=Math.max(0,a-l-h),c=Math.max(0,s-f-d)):o===yx?(u=Math.max(0,a-l-h),s=c+f+d):o===vx?(a=u+l+h,c=Math.max(0,s-f-d)):"pad"===o&&(a=u+l+h,s=c+f+d);t._resizeView(a,s,u,c,[l,f],i.resize)}(t,e,f,n)}(n,e,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?e.reflow():e}});var ab=Object.freeze({__proto__:null,bound:Ax,identifier:Cx,mark:Fx,overlap:Sx,render:Rx,viewlayout:ob});function sb(t){as.call(this,null,t)}function ub(t){as.call(this,null,t)}function lb(){return Fa({})}function cb(t){as.call(this,null,t)}function fb(t){as.call(this,[],t)}ct(sb,as,{transform(t,e){if(this.value&&!t.modified())return e.StopPropagation;var n=e.dataflow.locale(),r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=this.value,o=t.scale,a=Pp(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),s=t.format||Wp(n,o,a,t.formatSpecifier,t.formatType,!!t.values),u=t.values?jp(o,t.values,a):Ip(o,a);return i&&(r.rem=i),i=u.map(((t,e)=>Fa({index:e/(u.length-1||1),tickIndex:e,value:t,label:s(t)}))),t.extra&&i.length&&i.push(Fa({index:-1,tickIndex:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),ct(ub,as,{transform(t,e){var n=e.dataflow,r=e.fork(e.NO_SOURCE|e.NO_FIELDS),i=t.item||lb,o=t.key||Da,a=this.value;return _(r.encode)&&(r.encode=null),a&&(t.modified("key")||e.modified(o))&&s("DataJoin does not support modified key function or fields."),a||(e=e.addAll(),this.value=a=function(t){const e=ut().test((t=>t.exit));return e.lookup=n=>e.get(t(n)),e}(o)),e.visit(e.ADD,(t=>{const e=o(t);let n=a.get(e);n?n.exit?(a.empty--,r.add.push(n)):r.mod.push(n):(n=i(t),a.set(e,n),r.add.push(n)),n.datum=t,n.exit=!1})),e.visit(e.MOD,(t=>{const e=o(t),n=a.get(e);n&&(n.datum=t,r.mod.push(n))})),e.visit(e.REM,(t=>{const e=o(t),n=a.get(e);t!==n.datum||n.exit||(r.rem.push(n),n.exit=!0,++a.empty)})),e.changed(e.ADD_MOD)&&r.modifies("datum"),(e.clean()||t.clean&&a.empty>n.cleanThreshold)&&n.runAfter(a.clean),r}}),ct(cb,as,{transform(t,e){var n=e.fork(e.ADD_REM),r=t.mod||!1,i=t.encoders,o=e.encode;if(_(o)){if(!n.changed()&&!o.every((t=>i[t])))return e.StopPropagation;o=o[0],n.encode=null}var a="enter"===o,s=i.update||g,u=i.enter||g,l=i.exit||g,c=(o&&!a?i[o]:s)||g;if(e.changed(e.ADD)&&(e.visit(e.ADD,(e=>{u(e,t),s(e,t)})),n.modifies(u.output),n.modifies(s.output),c!==g&&c!==s&&(e.visit(e.ADD,(e=>{c(e,t)})),n.modifies(c.output))),e.changed(e.REM)&&l!==g&&(e.visit(e.REM,(e=>{l(e,t)})),n.modifies(l.output)),a||c!==g){const i=e.MOD|(t.modified()?e.REFLOW:0);a?(e.visit(i,(e=>{const i=u(e,t)||r;(c(e,t)||i)&&n.mod.push(e)})),n.mod.length&&n.modifies(u.output)):e.visit(i,(e=>{(c(e,t)||r)&&n.mod.push(e)})),n.mod.length&&n.modifies(c.output)}return n.changed()?n:e.StopPropagation}}),ct(fb,as,{transform(t,e){if(null!=this.value&&!t.modified())return e.StopPropagation;var n,r,i,o,a,s=e.dataflow.locale(),u=e.fork(e.NO_SOURCE|e.NO_FIELDS),l=this.value,c=t.type||Rp,f=t.scale,h=+t.limit,d=Pp(f,null==t.count?5:t.count,t.minstep),p=!!t.values||c===Rp,g=t.format||Xp(s,f,d,c,t.formatSpecifier,t.formatType,p),m=t.values||Vp(f,d);return l&&(u.rem=l),c===Rp?(h&&m.length>h?(e.dataflow.warn("Symbol legend count exceeds limit, filtering items."),l=m.slice(0,h-1),a=!0):l=m,X(i=t.size)?(t.values||0!==f(l[0])||(l=l.slice(1)),o=l.reduce(((e,n)=>Math.max(e,i(n,t))),0)):i=et(o=i||8),l=l.map(((e,n)=>Fa({index:n,label:g(e,n,l),value:e,offset:o,size:i(e,t)}))),a&&(a=m[l.length],l.push(Fa({index:l.length,label:`…${m.length-l.length} entries`,value:a,offset:o,size:i(a,t)})))):"gradient"===c?(n=f.domain(),r=Tp(f,n[0],A(n)),m.length<3&&!t.values&&n[0]!==A(n)&&(m=[n[0],A(n)]),l=m.map(((t,e)=>Fa({index:e,label:g(t,e,m),value:t,perc:r(t)})))):(i=m.length-1,r=function(t){const e=t.domain(),n=e.length-1;let r=+e[0],i=+A(e),o=i-r;if(t.type===Kd){const t=n?o/n:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),l=m.map(((t,e)=>Fa({index:e,label:g(t,e,m),value:t,perc:e?r(t):0,perc2:e===i?1:r(m[e+1])})))),u.source=l,u.add=l,this.value=l,u}});const hb=t=>t.source.x,db=t=>t.source.y,pb=t=>t.target.x,gb=t=>t.target.y;function mb(t){as.call(this,{},t)}mb.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"}]},ct(mb,as,{transform(t,e){var n=t.sourceX||hb,r=t.sourceY||db,i=t.targetX||pb,o=t.targetY||gb,a=t.as||"path",u=t.orient||"vertical",l=t.shape||"line",c=xb.get(l+"-"+u)||xb.get(l);return c||s("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),e.visit(e.SOURCE,(t=>{t[a]=c(n(t),r(t),i(t),o(t))})),e.reflow(t.modified()).modifies(a)}});const yb=(t,e,n,r)=>"M"+t+","+e+"L"+n+","+r,vb=(t,e,n,r)=>{var i=n-t,o=r-e,a=Math.hypot(i,o)/2;return"M"+t+","+e+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+n+","+r},_b=(t,e,n,r)=>{const i=n-t,o=r-e,a=.2*(i+o),s=.2*(o-i);return"M"+t+","+e+"C"+(t+a)+","+(e+s)+" "+(n+s)+","+(r-a)+" "+n+","+r},xb=ut({line:yb,"line-radial":(t,e,n,r)=>yb(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),arc:vb,"arc-radial":(t,e,n,r)=>vb(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),curve:_b,"curve-radial":(t,e,n,r)=>_b(e*Math.cos(t),e*Math.sin(t),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(t,e,n,r)=>"M"+t+","+e+"V"+r+"H"+n,"orthogonal-vertical":(t,e,n,r)=>"M"+t+","+e+"H"+n+"V"+r,"orthogonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),s=Math.sin(n);return"M"+e*i+","+e*o+"A"+e+","+e+" 0 0,"+((Math.abs(n-t)>Math.PI?n<=t:n>t)?1:0)+" "+e*a+","+e*s+"L"+r*a+","+r*s},"diagonal-horizontal":(t,e,n,r)=>{const i=(t+n)/2;return"M"+t+","+e+"C"+i+","+e+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(t,e,n,r)=>{const i=(e+r)/2;return"M"+t+","+e+"C"+t+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(t,e,n,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(n),s=Math.sin(n),u=(e+r)/2;return"M"+e*i+","+e*o+"C"+u*i+","+u*o+" "+u*a+","+u*s+" "+r*a+","+r*s}});function bb(t){as.call(this,null,t)}bb.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"]}]},ct(bb,as,{transform(t,e){var n,r,i,o=t.as||["startAngle","endAngle"],a=o[0],s=o[1],u=t.field||d,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=e.source,h=f.map(u),p=h.length,g=l,m=(c-l)/Ae(h),y=ke(p);for(t.sort&&y.sort(((t,e)=>h[t]-h[e])),n=0;n<p;++n)i=h[y[n]],(r=f[y[n]])[a]=g,r[s]=g+=i*m;return this.value=h,e.reflow(t.modified()).modifies(o)}});function wb(t){return xp(t)&&t!==Xd}const Mb=St(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function kb(t){as.call(this,null,t),this.modified(!0)}function Ab(t,e,n){Mp(t)&&(Math.abs(e.reduce(((t,e)=>t+(e<0?-1:e>0?1:0)),0))!==e.length&&n.warn("Log scale domain includes zero: "+At(e)));return e}function Eb(t,e,n){return X(t)&&(e||n)?Cp(t,Db(e||[0,1],n)):t}function Db(t,e){return e?t.slice().reverse():t}function Cb(t){as.call(this,null,t)}ct(kb,as,{transform(t,e){var n=e.dataflow,r=this.value,i=function(t){var e,n=t.type,r="";if(n===Xd)return Xd+"-"+jd;(function(t){const e=t.type;return xp(e)&&e!==Gd&&e!==Vd&&(t.scheme||t.range&&t.range.length&&t.range.every(yt))})(t)&&(r=2===(e=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?Xd+"-":3===e?Jd+"-":"");return(r+n||jd).toLowerCase()}(t);for(i in r&&i===r.type||(this.value=r=yp(i)()),t)if(!Mb[i]){if("padding"===i&&wb(r.type))continue;X(r[i])?r[i](t[i]):n.warn("Unsupported scale property: "+i)}return function(t,e,n){var r=t.type,i=e.round||!1,o=e.range;if(null!=e.rangeStep)o=function(t,e,n){t!==np&&t!==ep&&s("Only band and point scales support rangeStep.");var r=(null!=e.paddingOuter?e.paddingOuter:e.padding)||0,i=t===ep?1:(null!=e.paddingInner?e.paddingInner:e.padding)||0;return[0,e.rangeStep*Pd(n,i,r)]}(r,e,n);else if(e.scheme&&(o=function(t,e,n){var r,i=e.schemeExtent;_(e.scheme)?r=Fp(e.scheme,e.interpolate,e.interpolateGamma):(r=Np(e.scheme.toLowerCase()))||s(`Unrecognized scheme name: ${e.scheme}`);return n=t===Kd?n+1:t===rp?n-1:t===tp?+e.schemeCount||n||5:t===Zd||t===Qd?+e.schemeCount||5:n,Ap(t)?Eb(r,i,e.reverse):X(r)?Sp(Eb(r,i),n):t===tp?r:r.slice(0,n)}(r,e,n),X(o))){if(t.interpolator)return t.interpolator(o);s(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&Ap(r))return t.interpolator(Fp(Db(o,e.reverse),e.interpolate,e.interpolateGamma));o&&e.interpolate&&t.interpolate?t.interpolate($p(e.interpolate,e.interpolateGamma)):X(t.round)?t.round(i):X(t.rangeRound)&&t.interpolate(i?Dh:Eh);o&&t.range(Db(o,e.reverse))}(r,t,function(t,e,n){let r=e.bins;if(r&&!_(r)){const e=t.domain(),n=e[0],i=A(e),o=r.step;let a=null==r.start?n:r.start,u=null==r.stop?i:r.stop;o||s("Scale bins parameter missing step property."),a<n&&(a=o*Math.ceil(n/o)),u>i&&(u=o*Math.floor(i/o)),r=ke(a,u+o/2,o)}r?t.bins=r:t.bins&&delete t.bins;t.type===rp&&(r?e.domain||e.domainRaw||(t.domain(r),n=r.length):t.bins=t.domain());return n}(r,t,function(t,e,n){const r=function(t,e,n){return e?(t.domain(Ab(t.type,e,n)),e.length):-1}(t,e.domainRaw,n);if(r>-1)return r;var i,o,a=e.domain,s=t.type,u=e.zero||void 0===e.zero&&function(t){const e=t.type;return!t.bins&&(e===jd||e===Wd||e===Hd)}(t);if(!a)return 0;if((u||null!=e.domainMin||null!=e.domainMax||null!=e.domainMid)&&(i=(a=a.slice()).length-1||1,u&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=e.domainMin&&(a[0]=e.domainMin),null!=e.domainMax&&(a[i]=e.domainMax),null!=e.domainMid)){const t=(o=e.domainMid)>a[i]?i+1:o<a[0]?0:i;t!==i&&n.warn("Scale domainMid exceeds domain min or max.",o),a.splice(t,0,o)}wb(s)&&e.padding&&a[0]!==A(a)&&(a=function(t,e,n,r,i,o){var a=Math.abs(A(n)-n[0]),s=a/(a-2*r),u=t===Id?j(e,null,s):t===Hd?I(e,null,s,.5):t===Wd?I(e,null,s,i||1):t===Yd?W(e,null,s,o||1):P(e,null,s);return e=e.slice(),e[0]=u[0],e[e.length-1]=u[1],e}(s,a,e.range,e.padding,e.exponent,e.constant));t.domain(Ab(s,a,n)),s===tp&&t.unknown(e.domainImplicit?Yc:void 0);e.nice&&t.nice&&t.nice(!0!==e.nice&&Pp(t,e.nice)||null);return a.length}(r,t,n))),e.fork(e.NO_SOURCE|e.NO_FIELDS)}}),ct(Cb,as,{transform(t,e){const n=t.modified("sort")||e.changed(e.ADD)||e.modified(t.sort.fields)||e.modified("datum");return n&&e.source.sort(za(t.sort)),this.modified(n),e}});const Fb="zero",Sb="center",Tb="normalize",$b=["y0","y1"];function zb(t){as.call(this,null,t)}function Bb(t,e,n,r,i){for(var o,a=(e-t.sum)/2,s=t.length,u=0;u<s;++u)(o=t[u])[r]=a,o[i]=a+=Math.abs(n(o))}function Ob(t,e,n,r,i){for(var o,a=1/t.sum,s=0,u=t.length,l=0,c=0;l<u;++l)(o=t[l])[r]=s,o[i]=s=a*(c+=Math.abs(n(o)))}function Nb(t,e,n,r,i){for(var o,a,s=0,u=0,l=t.length,c=0;c<l;++c)(o=+n(a=t[c]))<0?(a[r]=u,a[i]=u+=o):(a[r]=s,a[i]=s+=o)}zb.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:Fb,values:[Fb,Sb,Tb]},{name:"as",type:"string",array:!0,length:2,default:$b}]},ct(zb,as,{transform(t,e){var n,r,i,o,a=t.as||$b,s=a[0],u=a[1],l=za(t.sort),c=t.field||d,f=t.offset===Sb?Bb:t.offset===Tb?Ob:Nb;for(n=function(t,e,n,r){var i,o,a,s,u,l,c,f,h,d=[],p=t=>t(u);if(null==e)d.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)u=t[o],(c=i[l=JSON.stringify(e.map(p))])||(i[l]=c=[],d.push(c)),c.push(u);for(l=0,h=0,s=d.length;l<s;++l){for(o=0,f=0,a=(c=d[l]).length;o<a;++o)f+=Math.abs(r(c[o]));c.sum=f,f>h&&(h=f),n&&c.sort(n)}return d.max=h,d}(e.source,t.groupby,l,c),r=0,i=n.length,o=n.max;r<i;++r)f(n[r],o,c,s,u);return e.reflow(t.modified()).modifies(a)}});var Rb=Object.freeze({__proto__:null,axisticks:sb,datajoin:ub,encode:cb,legendentries:fb,linkpath:mb,pie:bb,scale:kb,sortitems:Cb,stack:zb}),Ub=1e-6,Lb=1e-12,qb=Math.PI,Pb=qb/2,jb=qb/4,Ib=2*qb,Wb=180/qb,Hb=qb/180,Yb=Math.abs,Gb=Math.atan,Vb=Math.atan2,Xb=Math.cos,Jb=Math.ceil,Zb=Math.exp,Qb=Math.hypot,Kb=Math.log,tw=Math.pow,ew=Math.sin,nw=Math.sign||function(t){return t>0?1:t<0?-1:0},rw=Math.sqrt,iw=Math.tan;function ow(t){return t>1?0:t<-1?qb:Math.acos(t)}function aw(t){return t>1?Pb:t<-1?-Pb:Math.asin(t)}function sw(){}function uw(t,e){t&&cw.hasOwnProperty(t.type)&&cw[t.type](t,e)}var lw={Feature:function(t,e){uw(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)uw(n[r].geometry,e)}},cw={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){fw(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)fw(n[r],e,0)},Polygon:function(t,e){hw(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)hw(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)uw(n[r],e)}};function fw(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function hw(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)fw(t[n],e,1);e.polygonEnd()}function dw(t,e){t&&lw.hasOwnProperty(t.type)?lw[t.type](t,e):uw(t,e)}var pw,gw,mw,yw,vw,_w,xw,bw,ww,Mw,kw,Aw,Ew,Dw,Cw,Fw,Sw=new ee,Tw=new ee,$w={point:sw,lineStart:sw,lineEnd:sw,polygonStart:function(){Sw=new ee,$w.lineStart=zw,$w.lineEnd=Bw},polygonEnd:function(){var t=+Sw;Tw.add(t<0?Ib+t:t),this.lineStart=this.lineEnd=this.point=sw},sphere:function(){Tw.add(Ib)}};function zw(){$w.point=Ow}function Bw(){Nw(pw,gw)}function Ow(t,e){$w.point=Nw,pw=t,gw=e,mw=t*=Hb,yw=Xb(e=(e*=Hb)/2+jb),vw=ew(e)}function Nw(t,e){var n=(t*=Hb)-mw,r=n>=0?1:-1,i=r*n,o=Xb(e=(e*=Hb)/2+jb),a=ew(e),s=vw*a,u=yw*o+s*Xb(i),l=s*r*ew(i);Sw.add(Vb(l,u)),mw=t,yw=o,vw=a}function Rw(t){return[Vb(t[1],t[0]),aw(t[2])]}function Uw(t){var e=t[0],n=t[1],r=Xb(n);return[r*Xb(e),r*ew(e),ew(n)]}function Lw(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function qw(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Pw(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function jw(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Iw(t){var e=rw(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Ww,Hw,Yw,Gw,Vw,Xw,Jw,Zw,Qw,Kw,tM,eM,nM,rM,iM,oM,aM={point:sM,lineStart:lM,lineEnd:cM,polygonStart:function(){aM.point=fM,aM.lineStart=hM,aM.lineEnd=dM,Dw=new ee,$w.polygonStart()},polygonEnd:function(){$w.polygonEnd(),aM.point=sM,aM.lineStart=lM,aM.lineEnd=cM,Sw<0?(_w=-(bw=180),xw=-(ww=90)):Dw>Ub?ww=90:Dw<-1e-6&&(xw=-90),Fw[0]=_w,Fw[1]=bw},sphere:function(){_w=-(bw=180),xw=-(ww=90)}};function sM(t,e){Cw.push(Fw=[_w=t,bw=t]),e<xw&&(xw=e),e>ww&&(ww=e)}function uM(t,e){var n=Uw([t*Hb,e*Hb]);if(Ew){var r=qw(Ew,n),i=qw([r[1],-r[0],0],r);Iw(i),i=Rw(i);var o,a=t-Mw,s=a>0?1:-1,u=i[0]*Wb*s,l=Yb(a)>180;l^(s*Mw<u&&u<s*t)?(o=i[1]*Wb)>ww&&(ww=o):l^(s*Mw<(u=(u+360)%360-180)&&u<s*t)?(o=-i[1]*Wb)<xw&&(xw=o):(e<xw&&(xw=e),e>ww&&(ww=e)),l?t<Mw?pM(_w,t)>pM(_w,bw)&&(bw=t):pM(t,bw)>pM(_w,bw)&&(_w=t):bw>=_w?(t<_w&&(_w=t),t>bw&&(bw=t)):t>Mw?pM(_w,t)>pM(_w,bw)&&(bw=t):pM(t,bw)>pM(_w,bw)&&(_w=t)}else Cw.push(Fw=[_w=t,bw=t]);e<xw&&(xw=e),e>ww&&(ww=e),Ew=n,Mw=t}function lM(){aM.point=uM}function cM(){Fw[0]=_w,Fw[1]=bw,aM.point=sM,Ew=null}function fM(t,e){if(Ew){var n=t-Mw;Dw.add(Yb(n)>180?n+(n>0?360:-360):n)}else kw=t,Aw=e;$w.point(t,e),uM(t,e)}function hM(){$w.lineStart()}function dM(){fM(kw,Aw),$w.lineEnd(),Yb(Dw)>Ub&&(_w=-(bw=180)),Fw[0]=_w,Fw[1]=bw,Ew=null}function pM(t,e){return(e-=t)<0?e+360:e}function gM(t,e){return t[0]-e[0]}function mM(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var yM={sphere:sw,point:vM,lineStart:xM,lineEnd:MM,polygonStart:function(){yM.lineStart=kM,yM.lineEnd=AM},polygonEnd:function(){yM.lineStart=xM,yM.lineEnd=MM}};function vM(t,e){t*=Hb;var n=Xb(e*=Hb);_M(n*Xb(t),n*ew(t),ew(e))}function _M(t,e,n){++Ww,Yw+=(t-Yw)/Ww,Gw+=(e-Gw)/Ww,Vw+=(n-Vw)/Ww}function xM(){yM.point=bM}function bM(t,e){t*=Hb;var n=Xb(e*=Hb);rM=n*Xb(t),iM=n*ew(t),oM=ew(e),yM.point=wM,_M(rM,iM,oM)}function wM(t,e){t*=Hb;var n=Xb(e*=Hb),r=n*Xb(t),i=n*ew(t),o=ew(e),a=Vb(rw((a=iM*o-oM*i)*a+(a=oM*r-rM*o)*a+(a=rM*i-iM*r)*a),rM*r+iM*i+oM*o);Hw+=a,Xw+=a*(rM+(rM=r)),Jw+=a*(iM+(iM=i)),Zw+=a*(oM+(oM=o)),_M(rM,iM,oM)}function MM(){yM.point=vM}function kM(){yM.point=EM}function AM(){DM(eM,nM),yM.point=vM}function EM(t,e){eM=t,nM=e,t*=Hb,e*=Hb,yM.point=DM;var n=Xb(e);rM=n*Xb(t),iM=n*ew(t),oM=ew(e),_M(rM,iM,oM)}function DM(t,e){t*=Hb;var n=Xb(e*=Hb),r=n*Xb(t),i=n*ew(t),o=ew(e),a=iM*o-oM*i,s=oM*r-rM*o,u=rM*i-iM*r,l=Qb(a,s,u),c=aw(l),f=l&&-c/l;Qw.add(f*a),Kw.add(f*s),tM.add(f*u),Hw+=c,Xw+=c*(rM+(rM=r)),Jw+=c*(iM+(iM=i)),Zw+=c*(oM+(oM=o)),_M(rM,iM,oM)}function CM(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function FM(t,e){return Yb(t)>qb&&(t-=Math.round(t/Ib)*Ib),[t,e]}function SM(t,e,n){return(t%=Ib)?e||n?CM($M(t),zM(e,n)):$M(t):e||n?zM(e,n):FM}function TM(t){return function(e,n){return Yb(e+=t)>qb&&(e-=Math.round(e/Ib)*Ib),[e,n]}}function $M(t){var e=TM(t);return e.invert=TM(-t),e}function zM(t,e){var n=Xb(t),r=ew(t),i=Xb(e),o=ew(e);function a(t,e){var a=Xb(e),s=Xb(t)*a,u=ew(t)*a,l=ew(e),c=l*n+s*r;return[Vb(u*i-c*o,s*n-l*r),aw(c*i+u*o)]}return a.invert=function(t,e){var a=Xb(e),s=Xb(t)*a,u=ew(t)*a,l=ew(e),c=l*i-u*o;return[Vb(u*i+l*o,s*n+c*r),aw(c*n-s*r)]},a}function BM(t,e){(e=Uw(e))[0]-=t,Iw(e);var n=ow(-e[1]);return((-e[2]<0?-n:n)+Ib-Ub)%Ib}function OM(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:sw,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function NM(t,e){return Yb(t[0]-e[0])<Ub&&Yb(t[1]-e[1])<Ub}function RM(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function UM(t,e,n,r,i){var o,a,s=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(NM(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new RM(r,t,null,!0)),u.push(n.o=new RM(r,null,n,!1)),s.push(n=new RM(a,t,null,!1)),u.push(n.o=new RM(a,null,n,!0))}})),s.length){for(u.sort(e),LM(s),LM(u),o=0,a=u.length;o<a;++o)u[o].e=n=!n;for(var l,c,f=s[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(o=0,a=l.length;o<a;++o)i.point((c=l[o])[0],c[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(l=h.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function LM(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function qM(t){return Yb(t[0])<=qb?t[0]:nw(t[0])*((Yb(t[0])+qb)%Ib-qb)}function PM(t,e,n,r){return function(i){var o,a,s,u=e(i),l=OM(),c=e(l),f=!1,h={point:d,lineStart:g,lineEnd:m,polygonStart:function(){h.point=y,h.lineStart=v,h.lineEnd=_,a=[],o=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=m,a=Me(a);var t=function(t,e){var n=qM(e),r=e[1],i=ew(r),o=[ew(n),-Xb(n),0],a=0,s=0,u=new ee;1===i?r=Pb+Ub:-1===i&&(r=-Pb-Ub);for(var l=0,c=t.length;l<c;++l)if(h=(f=t[l]).length)for(var f,h,d=f[h-1],p=qM(d),g=d[1]/2+jb,m=ew(g),y=Xb(g),v=0;v<h;++v,p=x,m=w,y=M,d=_){var _=f[v],x=qM(_),b=_[1]/2+jb,w=ew(b),M=Xb(b),k=x-p,A=k>=0?1:-1,E=A*k,D=E>qb,C=m*w;if(u.add(Vb(C*A*ew(E),y*M+C*Xb(E))),a+=D?k+A*Ib:k,D^p>=n^x>=n){var F=qw(Uw(d),Uw(_));Iw(F);var S=qw(o,F);Iw(S);var T=(D^k>=0?-1:1)*aw(S[2]);(r>T||r===T&&(F[0]||F[1]))&&(s+=D^k>=0?1:-1)}}return(a<-1e-6||a<Ub&&u<-1e-12)^1&s}(o,r);a.length?(f||(i.polygonStart(),f=!0),UM(a,IM,t,n,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){u.point(t,e)}function g(){h.point=p,u.lineStart()}function m(){h.point=d,u.lineEnd()}function y(t,e){s.push([t,e]),c.point(t,e)}function v(){c.lineStart(),s=[]}function _(){y(s[0][0],s[0][1]),c.lineEnd();var t,e,n,r,u=c.clean(),h=l.result(),d=h.length;if(s.pop(),o.push(s),s=null,d)if(1&u){if((e=(n=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&u&&h.push(h.pop().concat(h.shift())),a.push(h.filter(jM))}return h}}function jM(t){return t.length>1}function IM(t,e){return((t=t.x)[0]<0?t[1]-Pb-Ub:Pb-t[1])-((e=e.x)[0]<0?e[1]-Pb-Ub:Pb-e[1])}FM.invert=FM;var WM=PM((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?qb:-qb,u=Yb(o-n);Yb(u-qb)<Ub?(t.point(n,r=(r+a)/2>0?Pb:-Pb),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&u>=qb&&(Yb(n-i)<Ub&&(n-=i*Ub),Yb(o-s)<Ub&&(o-=s*Ub),r=function(t,e,n,r){var i,o,a=ew(t-n);return Yb(a)>Ub?Gb((ew(e)*(o=Xb(r))*ew(n)-ew(r)*(i=Xb(e))*ew(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*Pb,r.point(-qb,i),r.point(0,i),r.point(qb,i),r.point(qb,0),r.point(qb,-i),r.point(0,-i),r.point(-qb,-i),r.point(-qb,0),r.point(-qb,i);else if(Yb(t[0]-e[0])>Ub){var o=t[0]<e[0]?qb:-qb;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-qb,-Pb]);function HM(t){var e=Xb(t),n=2*Hb,r=e>0,i=Yb(e)>Ub;function o(t,n){return Xb(t)*Xb(n)>e}function a(t,n,r){var i=[1,0,0],o=qw(Uw(t),Uw(n)),a=Lw(o,o),s=o[0],u=a-s*s;if(!u)return!r&&t;var l=e*a/u,c=-e*s/u,f=qw(i,o),h=jw(i,l);Pw(h,jw(o,c));var d=f,p=Lw(h,d),g=Lw(d,d),m=p*p-g*(Lw(h,h)-1);if(!(m<0)){var y=rw(m),v=jw(d,(-p-y)/g);if(Pw(v,h),v=Rw(v),!r)return v;var _,x=t[0],b=n[0],w=t[1],M=n[1];b<x&&(_=x,x=b,b=_);var k=b-x,A=Yb(k-qb)<Ub;if(!A&&M<w&&(_=w,w=M,M=_),A||k<Ub?A?w+M>0^v[1]<(Yb(v[0]-x)<Ub?w:M):w<=v[1]&&v[1]<=M:k>qb^(x<=v[0]&&v[0]<=b)){var E=jw(d,(-p+y)/g);return Pw(E,h),[v,Rw(E)]}}}function s(e,n){var i=r?t:qb-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return PM(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(f,h){var d,p=[f,h],g=o(f,h),m=r?g?0:s(f,h):g?s(f+(f<0?qb:-qb),h):0;if(!e&&(l=u=g)&&t.lineStart(),g!==u&&(!(d=a(e,p))||NM(e,d)||NM(p,d))&&(p[2]=1),g!==u)c=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;m&n||!(y=a(p,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&NM(e,p)||t.point(p[0],p[1]),e=p,u=g,n=m},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(e,r,i,o){!function(t,e,n,r,i,o){if(n){var a=Xb(e),s=ew(e),u=r*n;null==i?(i=e+r*Ib,o=e-u/2):(i=BM(a,i),o=BM(a,o),(r>0?i<o:i>o)&&(i+=r*Ib));for(var l,c=i;r>0?c>o:c<o;c-=u)l=Rw([a,-s*Xb(c),-s*ew(c)]),t.point(l[0],l[1])}}(o,t,n,i,e,r)}),r?[0,-t]:[-qb,t-qb])}var YM=1e9,GM=-YM;function VM(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,l){var c=0,f=0;if(null==i||(c=a(i,s))!==(f=a(o,s))||u(i,o)<0^s>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+s+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return Yb(r[0]-t)<Ub?i>0?0:3:Yb(r[0]-n)<Ub?i>0?2:1:Yb(r[1]-e)<Ub?i>0?1:0:i>0?3:2}function s(t,e){return u(t.x,e.x)}function u(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var u,l,c,f,h,d,p,g,m,y,v,_=a,x=OM(),b={point:w,lineStart:function(){b.point=M,l&&l.push(c=[]);y=!0,m=!1,p=g=NaN},lineEnd:function(){u&&(M(f,h),d&&m&&x.rejoin(),u.push(x.result()));b.point=w,m&&_.lineEnd()},polygonStart:function(){_=x,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var o,a,s=l[n],u=1,c=s.length,f=s[0],h=f[0],d=f[1];u<c;++u)o=h,a=d,h=(f=s[u])[0],d=f[1],a<=r?d>r&&(h-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(h-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=v&&e,i=(u=Me(u)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&UM(u,s,e,o,a),a.polygonEnd());_=a,u=l=c=null}};function w(t,e){i(t,e)&&_.point(t,e)}function M(o,a){var s=i(o,a);if(l&&c.push([o,a]),y)f=o,h=a,d=s,y=!1,s&&(_.lineStart(),_.point(o,a));else if(s&&m)_.point(o,a);else{var u=[p=Math.max(GM,Math.min(YM,p)),g=Math.max(GM,Math.min(YM,g))],x=[o=Math.max(GM,Math.min(YM,o)),a=Math.max(GM,Math.min(YM,a))];!function(t,e,n,r,i,o){var a,s=t[0],u=t[1],l=0,c=1,f=e[0]-s,h=e[1]-u;if(a=n-s,f||!(a>0)){if(a/=f,f<0){if(a<l)return;a<c&&(c=a)}else if(f>0){if(a>c)return;a>l&&(l=a)}if(a=i-s,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a<l)return;a<c&&(c=a)}if(a=r-u,h||!(a>0)){if(a/=h,h<0){if(a<l)return;a<c&&(c=a)}else if(h>0){if(a>c)return;a>l&&(l=a)}if(a=o-u,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a<l)return;a<c&&(c=a)}return l>0&&(t[0]=s+l*f,t[1]=u+l*h),c<1&&(e[0]=s+c*f,e[1]=u+c*h),!0}}}}}(u,x,t,e,n,r)?s&&(_.lineStart(),_.point(o,a),v=!1):(m||(_.lineStart(),_.point(u[0],u[1])),_.point(x[0],x[1]),s||_.lineEnd(),v=!1)}p=o,g=a,m=s}return b}}function XM(t,e,n){var r=ke(t,e-Ub,n).concat(e);return function(t){return r.map((function(e){return[t,e]}))}}function JM(t,e,n){var r=ke(t,e-Ub,n).concat(e);return function(t){return r.map((function(e){return[e,t]}))}}var ZM,QM,KM,tk,ek=t=>t,nk=new ee,rk=new ee,ik={point:sw,lineStart:sw,lineEnd:sw,polygonStart:function(){ik.lineStart=ok,ik.lineEnd=uk},polygonEnd:function(){ik.lineStart=ik.lineEnd=ik.point=sw,nk.add(Yb(rk)),rk=new ee},result:function(){var t=nk/2;return nk=new ee,t}};function ok(){ik.point=ak}function ak(t,e){ik.point=sk,ZM=KM=t,QM=tk=e}function sk(t,e){rk.add(tk*t-KM*e),KM=t,tk=e}function uk(){sk(ZM,QM)}var lk=1/0,ck=lk,fk=-lk,hk=fk,dk={point:function(t,e){t<lk&&(lk=t);t>fk&&(fk=t);e<ck&&(ck=e);e>hk&&(hk=e)},lineStart:sw,lineEnd:sw,polygonStart:sw,polygonEnd:sw,result:function(){var t=[[lk,ck],[fk,hk]];return fk=hk=-(ck=lk=1/0),t}};var pk,gk,mk,yk,vk=0,_k=0,xk=0,bk=0,wk=0,Mk=0,kk=0,Ak=0,Ek=0,Dk={point:Ck,lineStart:Fk,lineEnd:$k,polygonStart:function(){Dk.lineStart=zk,Dk.lineEnd=Bk},polygonEnd:function(){Dk.point=Ck,Dk.lineStart=Fk,Dk.lineEnd=$k},result:function(){var t=Ek?[kk/Ek,Ak/Ek]:Mk?[bk/Mk,wk/Mk]:xk?[vk/xk,_k/xk]:[NaN,NaN];return vk=_k=xk=bk=wk=Mk=kk=Ak=Ek=0,t}};function Ck(t,e){vk+=t,_k+=e,++xk}function Fk(){Dk.point=Sk}function Sk(t,e){Dk.point=Tk,Ck(mk=t,yk=e)}function Tk(t,e){var n=t-mk,r=e-yk,i=rw(n*n+r*r);bk+=i*(mk+t)/2,wk+=i*(yk+e)/2,Mk+=i,Ck(mk=t,yk=e)}function $k(){Dk.point=Ck}function zk(){Dk.point=Ok}function Bk(){Nk(pk,gk)}function Ok(t,e){Dk.point=Nk,Ck(pk=mk=t,gk=yk=e)}function Nk(t,e){var n=t-mk,r=e-yk,i=rw(n*n+r*r);bk+=i*(mk+t)/2,wk+=i*(yk+e)/2,Mk+=i,kk+=(i=yk*t-mk*e)*(mk+t),Ak+=i*(yk+e),Ek+=3*i,Ck(mk=t,yk=e)}function Rk(t){this._context=t}Rk.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ib)}},result:sw};var Uk,Lk,qk,Pk,jk,Ik=new ee,Wk={point:sw,lineStart:function(){Wk.point=Hk},lineEnd:function(){Uk&&Yk(Lk,qk),Wk.point=sw},polygonStart:function(){Uk=!0},polygonEnd:function(){Uk=null},result:function(){var t=+Ik;return Ik=new ee,t}};function Hk(t,e){Wk.point=Yk,Lk=Pk=t,qk=jk=e}function Yk(t,e){Pk-=t,jk-=e,Ik.add(rw(Pk*Pk+jk*jk)),Pk=t,jk=e}let Gk,Vk,Xk,Jk;class Zk{constructor(t){this._append=null==t?Qk:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Qk;if(e!==Gk){const t=10**e;Gk=e,Vk=function(e){let n=1;this._+=e[0];for(const r=e.length;n<r;++n)this._+=Math.round(arguments[n]*t)/t+e[n]}}return Vk}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Xk||this._append!==Vk){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Xk=t,Vk=this._append,Jk=this._,this._=e}this._+=Jk}}result(){const t=this._;return this._="",t.length?t:null}}function Qk(t){let e=1;this._+=t[0];for(const n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function Kk(t,e){let n,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),dw(t,n(r))),r.result()}return a.area=function(t){return dw(t,n(ik)),ik.result()},a.measure=function(t){return dw(t,n(Wk)),Wk.result()},a.bounds=function(t){return dw(t,n(dk)),dk.result()},a.centroid=function(t){return dw(t,n(Dk)),Dk.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,ek):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new Zk(i)):new Rk(e=t),"function"!=typeof o&&r.pointRadius(o),a):e},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new Zk(i)),a},a.projection(t).digits(i).context(e)}function tA(t){return function(e){var n=new eA;for(var r in t)n[r]=t[r];return n.stream=e,n}}function eA(){}function nA(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),dw(n,t.stream(dk)),e(dk.result()),null!=r&&t.clipExtent(r),t}function rA(t,e,n){return nA(t,(function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])}),n)}function iA(t,e,n){return rA(t,[[0,0],e],n)}function oA(t,e,n){return nA(t,(function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])}),n)}function aA(t,e,n){return nA(t,(function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])}),n)}eA.prototype={constructor:eA,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var sA=Xb(30*Hb);function uA(t,e){return+e?function(t,e){function n(r,i,o,a,s,u,l,c,f,h,d,p,g,m){var y=l-r,v=c-i,_=y*y+v*v;if(_>4*e&&g--){var x=a+h,b=s+d,w=u+p,M=rw(x*x+b*b+w*w),k=aw(w/=M),A=Yb(Yb(w)-1)<Ub||Yb(o-f)<Ub?(o+f)/2:Vb(b,x),E=t(A,k),D=E[0],C=E[1],F=D-r,S=C-i,T=v*F-y*S;(T*T/_>e||Yb((y*F+v*S)/_-.5)>.3||a*h+s*d+u*p<sA)&&(n(r,i,o,a,s,u,D,C,A,x/=M,b/=M,w,g,m),m.point(D,C),n(D,C,A,x,b,w,l,c,f,h,d,p,g,m))}}return function(e){var r,i,o,a,s,u,l,c,f,h,d,p,g={point:m,lineStart:y,lineEnd:_,polygonStart:function(){e.polygonStart(),g.lineStart=x},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function m(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){c=NaN,g.point=v,e.lineStart()}function v(r,i){var o=Uw([r,i]),a=t(r,i);n(c,f,l,h,d,p,c=a[0],f=a[1],l=r,h=o[0],d=o[1],p=o[2],16,e),e.point(c,f)}function _(){g.point=m,e.lineEnd()}function x(){y(),g.point=b,g.lineEnd=w}function b(t,e){v(r=t,e),i=c,o=f,a=h,s=d,u=p,g.point=v}function w(){n(c,f,l,h,d,p,i,o,r,a,s,u,16,e),g.lineEnd=_,_()}return g}}(t,e):function(t){return tA({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var lA=tA({point:function(t,e){this.stream.point(t*Hb,e*Hb)}});function cA(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,a){return[e+t*(o*=r),n-t*(a*=i)]}return o.invert=function(o,a){return[(o-e)/t*r,(n-a)/t*i]},o}(t,e,n,r,i);var a=Xb(o),s=ew(o),u=a*t,l=s*t,c=a/t,f=s/t,h=(s*n-a*e)/t,d=(s*e+a*n)/t;function p(t,o){return[u*(t*=r)-l*(o*=i)+e,n-l*t-u*o]}return p.invert=function(t,e){return[r*(c*t-f*e+h),i*(d-f*t-c*e)]},p}function fA(t){return hA((function(){return t}))()}function hA(t){var e,n,r,i,o,a,s,u,l,c,f=150,h=480,d=250,p=0,g=0,m=0,y=0,v=0,_=0,x=1,b=1,w=null,M=WM,k=null,A=ek,E=.5;function D(t){return u(t[0]*Hb,t[1]*Hb)}function C(t){return(t=u.invert(t[0],t[1]))&&[t[0]*Wb,t[1]*Wb]}function F(){var t=cA(f,0,0,x,b,_).apply(null,e(p,g)),r=cA(f,h-t[0],d-t[1],x,b,_);return n=SM(m,y,v),s=CM(e,r),u=CM(n,s),a=uA(s,E),S()}function S(){return l=c=null,D}return D.stream=function(t){return l&&c===t?l:l=lA(function(t){return tA({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(M(a(A(c=t)))))},D.preclip=function(t){return arguments.length?(M=t,w=void 0,S()):M},D.postclip=function(t){return arguments.length?(A=t,k=r=i=o=null,S()):A},D.clipAngle=function(t){return arguments.length?(M=+t?HM(w=t*Hb):(w=null,WM),S()):w*Wb},D.clipExtent=function(t){return arguments.length?(A=null==t?(k=r=i=o=null,ek):VM(k=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),S()):null==k?null:[[k,r],[i,o]]},D.scale=function(t){return arguments.length?(f=+t,F()):f},D.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],F()):[h,d]},D.center=function(t){return arguments.length?(p=t[0]%360*Hb,g=t[1]%360*Hb,F()):[p*Wb,g*Wb]},D.rotate=function(t){return arguments.length?(m=t[0]%360*Hb,y=t[1]%360*Hb,v=t.length>2?t[2]%360*Hb:0,F()):[m*Wb,y*Wb,v*Wb]},D.angle=function(t){return arguments.length?(_=t%360*Hb,F()):_*Wb},D.reflectX=function(t){return arguments.length?(x=t?-1:1,F()):x<0},D.reflectY=function(t){return arguments.length?(b=t?-1:1,F()):b<0},D.precision=function(t){return arguments.length?(a=uA(s,E=t*t),S()):rw(E)},D.fitExtent=function(t,e){return rA(D,t,e)},D.fitSize=function(t,e){return iA(D,t,e)},D.fitWidth=function(t,e){return oA(D,t,e)},D.fitHeight=function(t,e){return aA(D,t,e)},function(){return e=t.apply(this,arguments),D.invert=e.invert&&C,F()}}function dA(t){var e=0,n=qb/3,r=hA(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*Hb,n=t[1]*Hb):[e*Wb,n*Wb]},i}function pA(t,e){var n=ew(t),r=(n+ew(e))/2;if(Yb(r)<Ub)return function(t){var e=Xb(t);function n(t,n){return[t*e,ew(n)/e]}return n.invert=function(t,n){return[t/e,aw(n*e)]},n}(t);var i=1+n*(2*r-n),o=rw(i)/r;function a(t,e){var n=rw(i-2*r*ew(e))/r;return[n*ew(t*=r),o-n*Xb(t)]}return a.invert=function(t,e){var n=o-e,a=Vb(t,Yb(n))*nw(n);return n*r<0&&(a-=qb*nw(t)*nw(n)),[a/r,aw((i-(t*t+n*n)*r*r)/(2*r))]},a}function gA(){return dA(pA).scale(155.424).center([0,33.6442])}function mA(){return gA().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function yA(t){return function(e,n){var r=Xb(e),i=Xb(n),o=t(r*i);return o===1/0?[2,0]:[o*i*ew(e),o*ew(n)]}}function vA(t){return function(e,n){var r=rw(e*e+n*n),i=t(r),o=ew(i),a=Xb(i);return[Vb(e*o,r*a),aw(r&&n*o/r)]}}var _A=yA((function(t){return rw(2/(1+t))}));_A.invert=vA((function(t){return 2*aw(t/2)}));var xA=yA((function(t){return(t=ow(t))&&t/ew(t)}));function bA(t,e){return[t,Kb(iw((Pb+e)/2))]}function wA(t){var e,n,r,i=fA(t),o=i.center,a=i.scale,s=i.translate,u=i.clipExtent,l=null;function c(){var o=qb*a(),s=i(function(t){function e(e){return(e=t(e[0]*Hb,e[1]*Hb))[0]*=Wb,e[1]*=Wb,e}return t=SM(t[0]*Hb,t[1]*Hb,t.length>2?t[2]*Hb:0),e.invert=function(e){return(e=t.invert(e[0]*Hb,e[1]*Hb))[0]*=Wb,e[1]*=Wb,e},e}(i.rotate()).invert([0,0]));return u(null==l?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===bA?[[Math.max(s[0]-o,l),e],[Math.min(s[0]+o,n),r]]:[[l,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),c()):a()},i.translate=function(t){return arguments.length?(s(t),c()):s()},i.center=function(t){return arguments.length?(o(t),c()):o()},i.clipExtent=function(t){return arguments.length?(null==t?l=e=n=r=null:(l=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,e],[n,r]]},c()}function MA(t){return iw((Pb+t)/2)}function kA(t,e){var n=Xb(t),r=t===e?ew(t):Kb(n/Xb(e))/Kb(MA(e)/MA(t)),i=n*tw(MA(t),r)/r;if(!r)return bA;function o(t,e){i>0?e<-Pb+Ub&&(e=-Pb+Ub):e>Pb-Ub&&(e=Pb-Ub);var n=i/tw(MA(e),r);return[n*ew(r*t),i-n*Xb(r*t)]}return o.invert=function(t,e){var n=i-e,o=nw(r)*rw(t*t+n*n),a=Vb(t,Yb(n))*nw(n);return n*r<0&&(a-=qb*nw(t)*nw(n)),[a/r,2*Gb(tw(i/o,1/r))-Pb]},o}function AA(t,e){return[t,e]}function EA(t,e){var n=Xb(t),r=t===e?ew(t):(n-Xb(e))/(e-t),i=n/r+t;if(Yb(r)<Ub)return AA;function o(t,e){var n=i-e,o=r*t;return[n*ew(o),i-n*Xb(o)]}return o.invert=function(t,e){var n=i-e,o=Vb(t,Yb(n))*nw(n);return n*r<0&&(o-=qb*nw(t)*nw(n)),[o/r,i-nw(r)*rw(t*t+n*n)]},o}xA.invert=vA((function(t){return t})),bA.invert=function(t,e){return[t,2*Gb(Zb(e))-Pb]},AA.invert=AA;var DA=1.340264,CA=-.081106,FA=893e-6,SA=.003796,TA=rw(3)/2;function $A(t,e){var n=aw(TA*ew(e)),r=n*n,i=r*r*r;return[t*Xb(n)/(TA*(DA+3*CA*r+i*(7*FA+9*SA*r))),n*(DA+CA*r+i*(FA+SA*r))]}function zA(t,e){var n=Xb(e),r=Xb(t)*n;return[n*ew(t)/r,ew(e)/r]}function BA(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function OA(t,e){return[Xb(e)*ew(t),ew(e)]}function NA(t,e){var n=Xb(e),r=1+Xb(t)*n;return[n*ew(t)/r,ew(e)/r]}function RA(t,e){return[Kb(iw((Pb+e)/2)),-t]}$A.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(DA+CA*i+o*(FA+SA*i))-e)/(DA+3*CA*i+o*(7*FA+9*SA*i)))*r)*i*i,!(Yb(n)<Lb));++a);return[TA*t*(DA+3*CA*i+o*(7*FA+9*SA*i))/Xb(r),aw(ew(r)/TA)]},zA.invert=vA(Gb),BA.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-e)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(Yb(n)>Ub&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},OA.invert=vA(aw),NA.invert=vA((function(t){return 2*Gb(t)})),RA.invert=function(t,e){return[-e,2*Gb(Zb(t))-Pb]};var UA=Math.abs,LA=Math.cos,qA=Math.sin,PA=Math.PI,jA=PA/2,IA=function(t){return t>0?Math.sqrt(t):0}(2);function WA(t){return t>1?jA:t<-1?-jA:Math.asin(t)}function HA(t,e){var n,r=t*qA(e),i=30;do{e-=n=(e+qA(e)-r)/(1+LA(e))}while(UA(n)>1e-6&&--i>0);return e/2}var YA=function(t,e,n){function r(r,i){return[t*r*LA(i=HA(n,i)),e*qA(i)]}return r.invert=function(r,i){return i=WA(i/e),[r/(t*LA(i)),WA((2*i+qA(2*i))/n)]},r}(IA/jA,IA,PA);const GA=Kk(),VA=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function XA(t,e){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(ZA[t]=function(t,e){return function n(){const r=e();return r.type=t,r.path=Kk().projection(r),r.copy=r.copy||function(){const t=n();return VA.forEach((e=>{r[e]&&t[e](r[e]())})),t.path.pointRadius(r.path.pointRadius()),t},gp(r)}}(t,e),this):ZA[t]||null}function JA(t){return t&&t.path||GA}const ZA={albers:mA,albersusa:function(){var t,e,n,r,i,o,a=mA(),s=gA().rotate([154,0]).center([-2,58.5]).parallels([55,65]),u=gA().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,e){o=[t,e]}};function c(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function f(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?u:a).invert(t)},c.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),u.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},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?(a.precision(t),s.precision(t),u.precision(t),f()):a.precision()},c.scale=function(t){return arguments.length?(a.scale(t),s.scale(.35*t),u.scale(t),c.translate(a.translate())):a.scale()},c.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),o=+t[0],c=+t[1];return n=a.translate(t).clipExtent([[o-.455*e,c-.238*e],[o+.455*e,c+.238*e]]).stream(l),r=s.translate([o-.307*e,c+.201*e]).clipExtent([[o-.425*e+Ub,c+.12*e+Ub],[o-.214*e-Ub,c+.234*e-Ub]]).stream(l),i=u.translate([o-.205*e,c+.212*e]).clipExtent([[o-.214*e+Ub,c+.166*e+Ub],[o-.115*e-Ub,c+.234*e-Ub]]).stream(l),f()},c.fitExtent=function(t,e){return rA(c,t,e)},c.fitSize=function(t,e){return iA(c,t,e)},c.fitWidth=function(t,e){return oA(c,t,e)},c.fitHeight=function(t,e){return aA(c,t,e)},c.scale(1070)},azimuthalequalarea:function(){return fA(_A).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return fA(xA).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return dA(kA).scale(109.5).parallels([30,30])},conicequalarea:gA,conicequidistant:function(){return dA(EA).scale(131.154).center([0,13.9389])},equalEarth:function(){return fA($A).scale(177.158)},equirectangular:function(){return fA(AA).scale(152.63)},gnomonic:function(){return fA(zA).scale(144.049).clipAngle(60)},identity:function(){var t,e,n,r,i,o,a,s=1,u=0,l=0,c=1,f=1,h=0,d=null,p=1,g=1,m=tA({point:function(t,e){var n=_([t,e]);this.stream.point(n[0],n[1])}}),y=ek;function v(){return p=s*c,g=s*f,o=a=null,_}function _(n){var r=n[0]*p,i=n[1]*g;if(h){var o=i*t-r*e;r=r*t+i*e,i=o}return[r+u,i+l]}return _.invert=function(n){var r=n[0]-u,i=n[1]-l;if(h){var o=i*t+r*e;r=r*t-i*e,i=o}return[r/p,i/g]},_.stream=function(t){return o&&a===t?o:o=m(y(a=t))},_.postclip=function(t){return arguments.length?(y=t,d=n=r=i=null,v()):y},_.clipExtent=function(t){return arguments.length?(y=null==t?(d=n=r=i=null,ek):VM(d=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),v()):null==d?null:[[d,n],[r,i]]},_.scale=function(t){return arguments.length?(s=+t,v()):s},_.translate=function(t){return arguments.length?(u=+t[0],l=+t[1],v()):[u,l]},_.angle=function(n){return arguments.length?(e=ew(h=n%360*Hb),t=Xb(h),v()):h*Wb},_.reflectX=function(t){return arguments.length?(c=t?-1:1,v()):c<0},_.reflectY=function(t){return arguments.length?(f=t?-1:1,v()):f<0},_.fitExtent=function(t,e){return rA(_,t,e)},_.fitSize=function(t,e){return iA(_,t,e)},_.fitWidth=function(t,e){return oA(_,t,e)},_.fitHeight=function(t,e){return aA(_,t,e)},_},mercator:function(){return wA(bA).scale(961/Ib)},mollweide:function(){return fA(YA).scale(169.529)},naturalEarth1:function(){return fA(BA).scale(175.295)},orthographic:function(){return fA(OA).scale(249.5).clipAngle(90.000001)},stereographic:function(){return fA(NA).scale(250).clipAngle(142)},transversemercator:function(){var t=wA(RA),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)}};for(const t in ZA)XA(t,ZA[t]);function QA(){}const KA=[[],[[[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 tE(){var t=1,e=1,n=a;function r(t,e){return e.map((e=>i(t,e)))}function i(r,i){var a=[],s=[];return function(n,r,i){var a,s,u,l,c,f,h=[],d=[];a=s=-1,l=n[0]>=r,KA[l<<1].forEach(p);for(;++a<t-1;)u=l,l=n[a+1]>=r,KA[u|l<<1].forEach(p);KA[l|0].forEach(p);for(;++s<e-1;){for(a=-1,l=n[s*t+t]>=r,c=n[s*t]>=r,KA[l<<1|c<<2].forEach(p);++a<t-1;)u=l,l=n[s*t+t+a+1]>=r,f=c,c=n[s*t+a+1]>=r,KA[u|l<<1|c<<2|f<<3].forEach(p);KA[l|c<<3].forEach(p)}a=-1,c=n[s*t]>=r,KA[c<<2].forEach(p);for(;++a<t-1;)f=c,c=n[s*t+a+1]>=r,KA[c<<2|f<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+a,t[0][1]+s],u=[t[1][0]+a,t[1][1]+s],l=o(r),c=o(u);(e=d[l])?(n=h[c])?(delete d[e.end],delete h[n.start],e===n?(e.ring.push(u),i(e.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(u),d[e.end=c]=e):(e=h[c])?(n=d[l])?(delete h[e.start],delete d[n.end],e===n?(e.ring.push(u),i(e.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete h[e.start],e.ring.unshift(r),h[e.start=l]=e):h[l]=d[c]={start:l,end:c,ring:[r,u]}}KA[c<<3].forEach(p)}(r,i,(t=>{n(t,r,i),function(t){var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];for(;++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?a.push([t]):s.push(t)})),s.forEach((t=>{for(var e,n=0,r=a.length;n<r;++n)if(-1!==eE((e=a[n])[0],t))return void e.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function o(e){return 2*e[0]+e[1]*(t+1)*4}function a(n,r,i){n.forEach((n=>{var o,a=n[0],s=n[1],u=0|a,l=0|s,c=r[l*t+u];a>0&&a<t&&u===a&&(o=r[l*t+u-1],n[0]=a+(i-o)/(c-o)-.5),s>0&&s<e&&l===s&&(o=r[(l-1)*t+u],n[1]=s+(i-o)/(c-o)-.5)}))}return r.contour=i,r.size=function(n){if(!arguments.length)return[t,e];var i=Math.floor(n[0]),o=Math.floor(n[1]);return i>=0&&o>=0||s("invalid size"),t=i,e=o,r},r.smooth=function(t){return arguments.length?(n=t?a:QA,r):n===a},r}function eE(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=nE(t,e[r]))return n;return 0}function nE(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,s=a-1;o<a;s=o++){var u=t[o],l=u[0],c=u[1],f=t[s],h=f[0],d=f[1];if(rE(u,f,e))return 0;c>r!=d>r&&n<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function rE(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])==(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function iE(t,e,n){return function(r){var i=it(r),o=n?Math.min(i[0],0):i[0],a=i[1],s=a-o,u=e?ge(o,a,t):s/(t+1);return ke(o+u,a,u)}}function oE(t){as.call(this,null,t)}function aE(t,e,n,r,i){const o=t.x1||0,a=t.y1||0,s=e*n<0;function u(t){t.forEach(l)}function l(t){s&&t.reverse(),t.forEach(c)}function c(t){t[0]=(t[0]-o)*e+r,t[1]=(t[1]-a)*n+i}return function(t){return t.coordinates.forEach(u),t}}function sE(t,e,n){const r=t>=0?t:ds(e,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function uE(t){return X(t)?t:et(+t)}function lE(){var t=t=>t[0],e=t=>t[1],n=d,r=[-1,-1],i=960,o=500,a=2;function u(s,u){const l=sE(r[0],s,t)>>a,c=sE(r[1],s,e)>>a,f=l?l+2:0,h=c?c+2:0,d=2*f+(i>>a),p=2*h+(o>>a),g=new Float32Array(d*p),m=new Float32Array(d*p);let y=g;s.forEach((r=>{const i=f+(+t(r)>>a),o=h+(+e(r)>>a);i>=0&&i<d&&o>=0&&o<p&&(g[i+o*d]+=+n(r))})),l>0&&c>0?(cE(d,p,g,m,l),fE(d,p,m,g,c),cE(d,p,g,m,l),fE(d,p,m,g,c),cE(d,p,g,m,l),fE(d,p,m,g,c)):l>0?(cE(d,p,g,m,l),cE(d,p,m,g,l),cE(d,p,g,m,l),y=m):c>0&&(fE(d,p,g,m,c),fE(d,p,m,g,c),fE(d,p,g,m,c),y=m);const v=u?Math.pow(2,-2*a):1/Ae(y);for(let t=0,e=d*p;t<e;++t)y[t]*=v;return{values:y,scale:1<<a,width:d,height:p,x1:f,y1:h,x2:f+(i>>a),y2:h+(o>>a)}}return u.x=function(e){return arguments.length?(t=uE(e),u):t},u.y=function(t){return arguments.length?(e=uE(t),u):e},u.weight=function(t){return arguments.length?(n=uE(t),u):n},u.size=function(t){if(!arguments.length)return[i,o];var e=+t[0],n=+t[1];return e>=0&&n>=0||s("invalid size"),i=e,o=n,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||s("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<<a},u.bandwidth=function(t){return arguments.length?(1===(t=G(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&s("invalid bandwidth"),r=t,u):r},u}function cE(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a<e;++a)for(let e=0,s=0;e<t+i;++e)e<t&&(s+=n[e+a*t]),e>=i&&(e>=o&&(s-=n[e-o+a*t]),r[e-i+a*t]=s/Math.min(e+1,t-1+o-e,o))}function fE(t,e,n,r,i){const o=1+(i<<1);for(let a=0;a<t;++a)for(let s=0,u=0;s<e+i;++s)s<e&&(u+=n[a+s*t]),s>=i&&(s>=o&&(u-=n[a+(s-o)*t]),r[a+(s-i)*t]=u/Math.min(s+1,e-1+o-s,o))}function hE(t){as.call(this,null,t)}oE.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"}]},ct(oE,as,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n=e.fork(e.NO_SOURCE|e.NO_FIELDS),r=e.materialize(e.SOURCE).source,i=t.field||f,o=tE().smooth(!1!==t.smooth),a=t.thresholds||function(t,e,n){const r=iE(n.levels||10,n.nice,!1!==n.zero);return"shared"!==n.resolve?r:r(t.map((t=>me(e(t).values))))}(r,i,t),s=null===t.as?null:t.as||"contour",u=[];return r.forEach((e=>{const n=i(e),r=o.size([n.width,n.height])(n.values,_(a)?a:a(n.values));!function(t,e,n,r){let i=r.scale||e.scale,o=r.translate||e.translate;X(i)&&(i=i(n,r));X(o)&&(o=o(n,r));if((1===i||null==i)&&!o)return;const a=(gt(i)?i:i[0])||1,s=(gt(i)?i:i[1])||1,u=o&&o[0]||0,l=o&&o[1]||0;t.forEach(aE(e,a,s,u,l))}(r,n,e,t),r.forEach((t=>{u.push(Ta(e,Fa(null!=s?{[s]:t}:t)))}))})),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}}),hE.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const dE=["x","y","weight","size","cellSize","bandwidth"];function pE(t,e){return dE.forEach((n=>null!=e[n]?t[n](e[n]):0)),t}function gE(t){as.call(this,null,t)}ct(hE,as,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=function(t,e){var n,r,i,o,a,s,u=[],l=t=>t(o);if(null==e)u.push(t);else for(n={},r=0,i=t.length;r<i;++r)o=t[r],(s=n[a=e.map(l)])||(n[a]=s=[],s.dims=a,u.push(s)),s.push(o);return u}(e.materialize(e.SOURCE).source,t.groupby),a=(t.groupby||[]).map(n),s=pE(lE(),t),u=t.as||"grid";return r=o.map((e=>Fa(function(t,e){for(let n=0;n<a.length;++n)t[a[n]]=e[n];return t}({[u]:s(e,t.counts)},e.dims)))),this.value&&(i.rem=this.value),this.value=i.source=i.add=r,i}}),gE.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}]},ct(gE,as,{transform(t,e){if(this.value&&!e.changed()&&!t.modified())return e.StopPropagation;var n,r,i=e.fork(e.NO_SOURCE|e.NO_FIELDS),o=tE().smooth(!1!==t.smooth),a=t.values,s=t.thresholds||iE(t.count||10,t.nice,!!a),u=t.size;return a||(a=e.materialize(e.SOURCE).source,r=aE(n=pE(lE(),t)(a,!0),n.scale||1,n.scale||1,0,0),u=[n.width,n.height],a=n.values),s=_(s)?s:s(a),a=o.size(u)(a,s),r&&a.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(a||[]).map(Fa),i}});const mE="Feature",yE="FeatureCollection";function vE(t){as.call(this,null,t)}function _E(t){as.call(this,null,t)}function xE(t){as.call(this,null,t)}function bE(t){as.call(this,null,t)}function wE(t){as.call(this,[],t),this.generator=function(){var t,e,n,r,i,o,a,s,u,l,c,f,h=10,d=h,p=90,g=360,m=2.5;function y(){return{type:"MultiLineString",coordinates:v()}}function v(){return ke(Jb(r/p)*p,n,p).map(c).concat(ke(Jb(s/g)*g,a,g).map(f)).concat(ke(Jb(e/h)*h,t,h).filter((function(t){return Yb(t%p)>Ub})).map(u)).concat(ke(Jb(o/d)*d,i,d).filter((function(t){return Yb(t%g)>Ub})).map(l))}return y.lines=function(){return v().map((function(t){return{type:"LineString",coordinates:t}}))},y.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(a).slice(1),c(n).reverse().slice(1),f(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),y.precision(m)):[[r,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(m)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],y):[h,d]},y.precision=function(h){return arguments.length?(m=+h,u=XM(o,i,90),l=JM(e,t,m),c=XM(s,a,90),f=JM(r,n,m),y):m},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function ME(t){as.call(this,null,t)}function kE(t){if(!X(t))return!1;const e=St(r(t));return e.$x||e.$y||e.$value||e.$max}function AE(t){as.call(this,null,t),this.modified(!0)}function EE(t,e,n){X(t[e])&&t[e](n)}vE.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ct(vE,as,{transform(t,e){var n,i=this._features,o=this._points,a=t.fields,s=a&&a[0],u=a&&a[1],l=t.geojson||!a&&f,c=e.ADD;n=t.modified()||e.changed(e.REM)||e.modified(r(l))||s&&e.modified(r(s))||u&&e.modified(r(u)),this.value&&!n||(c=e.SOURCE,this._features=i=[],this._points=o=[]),l&&e.visit(c,(t=>i.push(l(t)))),s&&u&&(e.visit(c,(t=>{var e=s(t),n=u(t);null!=e&&null!=n&&(e=+e)===e&&(n=+n)===n&&o.push([e,n])})),i=i.concat({type:mE,geometry:{type:"MultiPoint",coordinates:o}})),this.value={type:yE,features:i}}}),_E.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"}]},ct(_E,as,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.field||f,o=t.as||"path",a=n.SOURCE;!r||t.modified()?(this.value=r=JA(t.projection),n.materialize().reflow()):a=i===f||e.modified(i.fields)?n.ADD_MOD:n.ADD;const s=function(t,e){const n=t.pointRadius();t.context(null),null!=e&&t.pointRadius(e);return n}(r,t.pointRadius);return n.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(s),n.modifies(o)}}),xE.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"]}]},ct(xE,as,{transform(t,e){var n,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],s=a[0],u=a[1];function l(t){const e=r([i(t),o(t)]);e?(t[s]=e[0],t[u]=e[1]):(t[s]=void 0,t[u]=void 0)}return t.modified()?e=e.materialize().reflow(!0).visit(e.SOURCE,l):(n=e.modified(i.fields)||e.modified(o.fields),e.visit(n?e.ADD_MOD:e.ADD,l)),e.modifies(a)}}),bE.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"}]},ct(bE,as,{transform(t,e){var n=e.fork(e.ALL),r=this.value,i=t.as||"shape",o=n.ADD;return r&&!t.modified()||(this.value=r=function(t,e,n){const r=null==n?n=>t(e(n)):r=>{var i=t.pointRadius(),o=t.pointRadius(n)(e(r));return t.pointRadius(i),o};return r.context=e=>(t.context(e),r),r}(JA(t.projection),t.field||l("datum"),t.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,(t=>t[i]=r)),n.modifies(i)}}),wE.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}]},ct(wE,as,{transform(t,e){var n,r=this.value,i=this.generator;if(!r.length||t.modified())for(const e in t)X(i[e])&&i[e](t[e]);return n=i(),r.length?e.mod.push($a(r[0],n)):e.add.push(Fa(n)),r[0]=n,e}}),ME.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"}]},ct(ME,as,{transform(t,e){if(!e.changed()&&!t.modified())return e.StopPropagation;var n=e.materialize(e.SOURCE).source,r="shared"===t.resolve,i=t.field||f,o=function(t,e){let n;X(t)?(n=n=>t(n,e),n.dep=kE(t)):t?n=et(t):(n=t=>t.$value/t.$max||0,n.dep=!0);return n}(t.opacity,t),a=function(t,e){let n;X(t)?(n=n=>yf(t(n,e)),n.dep=kE(t)):n=et(yf(t||"#888"));return n}(t.color,t),s=t.as||"image",u={$x:0,$y:0,$value:0,$max:r?me(n.map((t=>me(i(t).values)))):0};return n.forEach((t=>{const e=i(t),n=rt({},t,u);r||(n.$max=me(e.values||[])),t[s]=function(t,e,n,r){const i=t.width,o=t.height,a=t.x1||0,s=t.y1||0,u=t.x2||i,l=t.y2||o,c=t.values,f=c?t=>c[t]:h,d=jc(u-a,l-s),p=d.getContext("2d"),g=p.getImageData(0,0,u-a,l-s),m=g.data;for(let t=s,o=0;t<l;++t){e.$y=t-s;for(let s=a,l=t*i;s<u;++s,o+=4){e.$x=s-a,e.$value=f(s+l);const t=n(e);m[o+0]=t.r,m[o+1]=t.g,m[o+2]=t.b,m[o+3]=~~(255*r(e))}}return p.putImageData(g,0,0),d}(e,n,a.dep?a:et(a(n)),o.dep?o:et(o(n)))})),e.reflow(!0).modifies(s)}}),ct(AE,as,{transform(t,e){let n=this.value;return!n||t.modified("type")?(this.value=n=function(t){const e=XA((t||"mercator").toLowerCase());e||s("Unrecognized projection type: "+t);return e()}(t.type),VA.forEach((e=>{null!=t[e]&&EE(n,e,t[e])}))):VA.forEach((e=>{t.modified(e)&&EE(n,e,t[e])})),null!=t.pointRadius&&n.path.pointRadius(t.pointRadius),t.fit&&function(t,e){const n=function(t){return t=G(t),1===t.length?t[0]:{type:yE,features:t.reduce(((t,e)=>t.concat(function(t){return t.type===yE?t.features:G(t).filter((t=>null!=t)).map((t=>t.type===mE?t:{type:mE,geometry:t}))}(e))),[])}}(e.fit);e.extent?t.fitExtent(e.extent,n):e.size&&t.fitSize(e.size,n)}(n,t),e.fork(e.NO_SOURCE|e.NO_FIELDS)}});var DE=Object.freeze({__proto__:null,contour:gE,geojson:vE,geopath:_E,geopoint:xE,geoshape:bE,graticule:wE,heatmap:ME,isocontour:oE,kde2d:hE,projection:AE});function CE(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,u,l,c,f,h,d=t._root,p={data:r},g=t._x0,m=t._y0,y=t._x1,v=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(s=+t._x.call(null,d.data),u=+t._y.call(null,d.data),e===s&&n===u)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=e>=(o=(g+y)/2))?g=o:y=o,(c=n>=(a=(m+v)/2))?m=a:v=a}while((f=c<<1|l)==(h=(u>=a)<<1|s>=o));return i[h]=d,i[f]=p,t}function FE(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function SE(t){return t[0]}function TE(t){return t[1]}function $E(t,e,n){var r=new zE(null==e?SE:e,null==n?TE:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function zE(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function BE(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var OE=$E.prototype=zE.prototype;function NE(t){return function(){return t}}function RE(t){return 1e-6*(t()-.5)}function UE(t){return t.x+t.vx}function LE(t){return t.y+t.vy}function qE(t){return t.index}function PE(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}OE.copy=function(){var t,e,n=new zE(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=BE(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=BE(e));return n},OE.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return CE(this.cover(e,n),e,n,t)},OE.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<u&&(u=r),r>c&&(c=r),i<l&&(l=i),i>f&&(f=i));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;n<o;++n)CE(this,a[n],s[n],t[n]);return this},OE.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,u=i-n||1,l=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=l,l=a,u*=2,s){case 0:i=n+u,o=r+u;break;case 1:n=i-u,o=r+u;break;case 2:i=n+u,r=o-u;break;case 3:n=i-u,r=o-u}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},OE.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},OE.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]]},OE.find=function(t,e,n){var r,i,o,a,s,u,l,c=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new FE(g,c,f,h,d)),null==n?n=1/0:(c=t-n,f=e-n,h=t+n,d=e+n,n*=n);u=p.pop();)if(!(!(g=u.node)||(i=u.x0)>h||(o=u.y0)>d||(a=u.x1)<c||(s=u.y1)<f))if(g.length){var m=(i+a)/2,y=(o+s)/2;p.push(new FE(g[3],m,y,a,s),new FE(g[2],i,y,m,s),new FE(g[1],m,o,a,y),new FE(g[0],i,o,m,y)),(l=(e>=y)<<1|t>=m)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=u)}else{var v=t-+this._x.call(null,g.data),_=e-+this._y.call(null,g.data),x=v*v+_*_;if(x<n){var b=Math.sqrt(n=x);c=t-b,f=e-b,h=t+b,d=e+b,r=g.data}}return r},OE.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,u,l,c,f,h,d=this._root,p=this._x0,g=this._y0,m=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((l=o>=(s=(p+m)/2))?p=s:m=s,(c=a>=(u=(g+y)/2))?g=u:y=u,e=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},OE.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},OE.root=function(){return this._root},OE.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},OE.visit=function(t){var e,n,r,i,o,a,s=[],u=this._root;for(u&&s.push(new FE(u,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(u=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&u.length){var l=(r+o)/2,c=(i+a)/2;(n=u[3])&&s.push(new FE(n,l,c,o,a)),(n=u[2])&&s.push(new FE(n,r,c,l,a)),(n=u[1])&&s.push(new FE(n,l,i,o,c)),(n=u[0])&&s.push(new FE(n,r,i,l,c))}return this},OE.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new FE(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,u=e.x1,l=e.y1,c=(a+u)/2,f=(s+l)/2;(o=i[0])&&n.push(new FE(o,a,s,c,f)),(o=i[1])&&n.push(new FE(o,c,s,u,f)),(o=i[2])&&n.push(new FE(o,a,f,c,l)),(o=i[3])&&n.push(new FE(o,c,f,u,l))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},OE.x=function(t){return arguments.length?(this._x=t,this):this._x},OE.y=function(t){return arguments.length?(this._y=t,this):this._y};var jE={value:()=>{}};function IE(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new WE(r)}function WE(t){this._=t}function HE(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function YE(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=jE,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}WE.prototype=IE.prototype={constructor:WE,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=YE(i[n],t.name,e);else if(null==e)for(n in i)i[n]=YE(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=HE(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new WE(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var GE,VE,XE=0,JE=0,ZE=0,QE=0,KE=0,tD=0,eD="object"==typeof performance&&performance.now?performance:Date,nD="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function rD(){return KE||(nD(iD),KE=eD.now()+tD)}function iD(){KE=0}function oD(){this._call=this._time=this._next=null}function aD(t,e,n){var r=new oD;return r.restart(t,e,n),r}function sD(){KE=(QE=eD.now())+tD,XE=JE=0;try{!function(){rD(),++XE;for(var t,e=GE;e;)(t=KE-e._time)>=0&&e._call.call(void 0,t),e=e._next;--XE}()}finally{XE=0,function(){var t,e,n=GE,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:GE=e);VE=t,lD(r)}(),KE=0}}function uD(){var t=eD.now(),e=t-QE;e>1e3&&(tD-=e,QE=t)}function lD(t){XE||(JE&&(JE=clearTimeout(JE)),t-KE>24?(t<1/0&&(JE=setTimeout(sD,t-eD.now()-tD)),ZE&&(ZE=clearInterval(ZE))):(ZE||(QE=eD.now(),ZE=setInterval(uD,1e3)),XE=1,nD(sD)))}oD.prototype=aD.prototype={constructor:oD,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?rD():+n)+(null==e?0:+e),this._next||VE===this||(VE?VE._next=this:GE=this,VE=this),this._call=t,this._time=n,lD()},stop:function(){this._call&&(this._call=null,this._time=1/0,lD())}};const cD=4294967296;function fD(t){return t.x}function hD(t){return t.y}var dD=Math.PI*(3-Math.sqrt(5));function pD(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,u=aD(f),l=IE("tick","end"),c=function(){let t=1;return()=>(t=(1664525*t+1013904223)%cD)/cD}();function f(){h(),l.call("tick",e),n<r&&(u.stop(),l.call("end",e))}function h(r){var u,l,c=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(n+=(o-n)*i,s.forEach((function(t){t(n)})),u=0;u<c;++u)null==(l=t[u]).fx?l.x+=l.vx*=a:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=a:(l.y=l.fy,l.vy=0);return e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*dD;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,c),e}return null==t&&(t=[]),d(),e={tick:h,restart:function(){return u.restart(f),e},stop:function(){return u.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(c=t,s.forEach(p),e):c},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,u,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l<c;++l)(a=(i=e-(s=t[l]).x)*i+(o=n-s.y)*o)<r&&(u=s,r=a);return u},on:function(t,n){return arguments.length>1?(l.on(t,n),e):l.on(t)}}}const gD={center:function(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,u=0;for(i=0;i<a;++i)s+=(o=n[i]).x,u+=o.y;for(s=(s/a-t)*r,u=(u/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=u}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var e,n,r,i=1,o=1;function a(){for(var t,a,u,l,c,f,h,d=e.length,p=0;p<o;++p)for(a=$E(e,UE,LE).visitAfter(s),t=0;t<d;++t)u=e[t],f=n[u.index],h=f*f,l=u.x+u.vx,c=u.y+u.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,d=t.r,p=f+d;if(!s)return e>l+p||o<l-p||n>c+p||a<c-p;if(s.index>u.index){var g=l-s.x-s.vx,m=c-s.y-s.vy,y=g*g+m*m;y<p*p&&(0===g&&(y+=(g=RE(r))*g),0===m&&(y+=(m=RE(r))*m),y=(p-(y=Math.sqrt(y)))/y*i,u.vx+=(g*=y)*(p=(d*=d)/(h+d)),u.vy+=(m*=y)*p,s.vx-=g*(p=1-p),s.vy-=m*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function u(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=NE(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,u()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),u(),a):t},a},nbody:function(){var t,e,n,r,i,o=NE(-30),a=1,s=1/0,u=.81;function l(n){var i,o=t.length,a=$E(t,fD,hD).visitAfter(f);for(r=n,i=0;i<o;++i)e=t[i],a.visit(h)}function c(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function f(t){var e,n,r,o,a,s=0,u=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,u+=n,r+=n*e.x,o+=n*e.y);t.x=r/u,t.y=o/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function h(t,o,l,c){if(!t.value)return!0;var f=t.x-e.x,h=t.y-e.y,d=c-o,p=f*f+h*h;if(d*d/u<p)return p<s&&(0===f&&(p+=(f=RE(n))*f),0===h&&(p+=(h=RE(n))*h),p<a&&(p=Math.sqrt(a*p)),e.vx+=f*t.value*r/p,e.vy+=h*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===f&&(p+=(f=RE(n))*f),0===h&&(p+=(h=RE(n))*h),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(d=i[t.data.index]*r/p,e.vx+=f*d,e.vy+=h*d)}while(t=t.next)}}return l.initialize=function(e,r){t=e,n=r,c()},l.strength=function(t){return arguments.length?(o="function"==typeof t?t:NE(+t),c(),l):o},l.distanceMin=function(t){return arguments.length?(a=t*t,l):Math.sqrt(a)},l.distanceMax=function(t){return arguments.length?(s=t*t,l):Math.sqrt(s)},l.theta=function(t){return arguments.length?(u=t*t,l):Math.sqrt(u)},l},link:function(t){var e,n,r,i,o,a,s=qE,u=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},l=NE(30),c=1;function f(r){for(var i=0,s=t.length;i<c;++i)for(var u,l,f,h,d,p,g,m=0;m<s;++m)l=(u=t[m]).source,h=(f=u.target).x+f.vx-l.x-l.vx||RE(a),d=f.y+f.vy-l.y-l.vy||RE(a),h*=p=((p=Math.sqrt(h*h+d*d))-n[m])/p*r*e[m],d*=p,f.vx-=h*(g=o[m]),f.vy-=d*g,l.vx+=h*(g=1-g),l.vy+=d*g}function h(){if(r){var a,u,l=r.length,c=t.length,f=new Map(r.map(((t,e)=>[s(t,e,r),t])));for(a=0,i=new Array(l);a<c;++a)(u=t[a]).index=a,"object"!=typeof u.source&&(u.source=PE(f,u.source)),"object"!=typeof u.target&&(u.target=PE(f,u.target)),i[u.source.index]=(i[u.source.index]||0)+1,i[u.target.index]=(i[u.target.index]||0)+1;for(a=0,o=new Array(c);a<c;++a)u=t[a],o[a]=i[u.source.index]/(i[u.source.index]+i[u.target.index]);e=new Array(c),d(),n=new Array(c),p()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+u(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+l(t[e],e,t)}return null==t&&(t=[]),f.initialize=function(t,e){r=t,a=e,h()},f.links=function(e){return arguments.length?(t=e,h(),f):t},f.id=function(t){return arguments.length?(s=t,f):s},f.iterations=function(t){return arguments.length?(c=+t,f):c},f.strength=function(t){return arguments.length?(u="function"==typeof t?t:NE(+t),d(),f):u},f.distance=function(t){return arguments.length?(l="function"==typeof t?t:NE(+t),p(),f):l},f},x:function(t){var e,n,r,i=NE(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=NE(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:NE(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),a(),o):t},o},y:function(t){var e,n,r,i=NE(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=NE(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:NE(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:NE(+e),a(),o):t},o}},mD="forces",yD=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],vD=["static","iterations"],_D=["x","y","vx","vy"];function xD(t){as.call(this,null,t)}function bD(t,e,n,r){var i,o,a,s,u=G(e.forces);for(i=0,o=yD.length;i<o;++i)(a=yD[i])!==mD&&e.modified(a)&&t[a](e[a]);for(i=0,o=u.length;i<o;++i)s=mD+i,(a=n||e.modified(mD,i)?MD(u[i]):r&&wD(u[i],r)?t.force(s):null)&&t.force(s,a);for(o=t.numForces||0;i<o;++i)t.force(mD+i,null);return t.numForces=u.length,t}function wD(t,e){var n,i;for(n in t)if(X(i=t[n])&&e.modified(r(i)))return 1;return 0}function MD(t){var e,n;for(n in at(gD,t.force)||s("Unrecognized force: "+t.force),e=gD[t.force](),t)X(e[n])&&kD(e[n],t[n],t);return e}function kD(t,e,n){t(X(e)?t=>e(t,n):e)}xD.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,expr:!0},{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:_D}]},ct(xD,as,{transform(t,e){var n,r,i=this.value,o=e.changed(e.ADD_REM),a=t.modified(yD),s=t.iterations||300;if(i?(o&&(e.modifies("index"),i.nodes(e.source)),(a||e.changed(e.MOD))&&bD(i,t,0,e)):(this.value=i=function(t,e){const n=pD(t),r=n.stop,i=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,i()),n.stop=()=>(o=!0,r()),bD(n,e,!0).on("end",(()=>o=!0))}(e.source,t),i.on("tick",(n=e.dataflow,r=this,()=>n.touch(r).run())),t.static||(o=!0,i.tick()),e.modifies("index")),a||o||t.modified(vD)||e.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/s)),t.static)for(i.stop();--s>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return e.StopPropagation;return this.finish(t,e)},finish(t,e){const n=e.dataflow;for(let t,e=this._argops,s=0,u=e.length;s<u;++s)if(t=e[s],t.name===mD&&"link"===t.op._argval.force)for(var r,i=t.op._argops,o=0,a=i.length;o<a;++o)if("links"===i[o].name&&(r=i[o].op.source)){n.pulse(r,n.changeset().reflow());break}return e.reflow(t.modified()).modifies(_D)}});var AD=Object.freeze({__proto__:null,force:xD});function ED(t,e){return t.parent===e.parent?1:2}function DD(t,e){return t+e.x}function CD(t,e){return Math.max(t,e.y)}function FD(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function SD(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=$D)):void 0===e&&(e=TD);for(var n,r,i,o,a,s=new OD(t),u=[s];n=u.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)u.push(r=i[o]=new OD(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(BD)}function TD(t){return t.children}function $D(t){return Array.isArray(t)?t[1]:null}function zD(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function BD(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function OD(t){this.data=t,this.depth=this.height=0,this.parent=null}function ND(t){return null==t?null:RD(t)}function RD(t){if("function"!=typeof t)throw new Error;return t}function UD(){return 0}function LD(t){return function(){return t}}OD.prototype=SD.prototype={constructor:OD,count:function(){return this.eachAfter(FD)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],u=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r]);for(;o=s.pop();)t.call(e,o,++u,this);return this},eachBefore:function(t,e){for(var n,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(e,i,++a,this),n=i.children)for(r=n.length-1;r>=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return SD(this).eachBefore(zD)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n])}while(o.length)}};const qD=4294967296;function PD(t,e){var n,r;if(WD(e,t))return[e];for(n=0;n<t.length;++n)if(jD(e,t[n])&&WD(YD(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(jD(YD(t[n],t[r]),e)&&jD(YD(t[n],e),t[r])&&jD(YD(t[r],e),t[n])&&WD(GD(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function jD(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function ID(t,e){var n=t.r-e.r+1e-9*Math.max(t.r,e.r,1),r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function WD(t,e){for(var n=0;n<e.length;++n)if(!ID(t,e[n]))return!1;return!0}function HD(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return YD(t[0],t[1]);case 3:return GD(t[0],t[1],t[2])}}function YD(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,s=e.r,u=o-n,l=a-r,c=s-i,f=Math.sqrt(u*u+l*l);return{x:(n+o+u/f*c)/2,y:(r+a+l/f*c)/2,r:(f+i+s)/2}}function GD(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,s=e.y,u=e.r,l=n.x,c=n.y,f=n.r,h=r-a,d=r-l,p=i-s,g=i-c,m=u-o,y=f-o,v=r*r+i*i-o*o,_=v-a*a-s*s+u*u,x=v-l*l-c*c+f*f,b=d*p-h*g,w=(p*x-g*_)/(2*b)-r,M=(g*m-p*y)/b,k=(d*_-h*x)/(2*b)-i,A=(h*y-d*m)/b,E=M*M+A*A-1,D=2*(o+w*M+k*A),C=w*w+k*k-o*o,F=-(Math.abs(E)>1e-6?(D+Math.sqrt(D*D-4*E*C))/(2*E):C/D);return{x:r+w+M*F,y:i+k+A*F,r:F}}function VD(t,e,n){var r,i,o,a,s=t.x-e.x,u=t.y-e.y,l=s*s+u*u;l?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(l+a-i)/(2*l),o=Math.sqrt(Math.max(0,a/l-r*r)),n.x=t.x-r*s-o*u,n.y=t.y-r*u+o*s):(r=(l+i-a)/(2*l),o=Math.sqrt(Math.max(0,i/l-r*r)),n.x=e.x+r*s-o*u,n.y=e.y+r*u+o*s)):(n.x=e.x+n.r,n.y=e.y)}function XD(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function JD(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function ZD(t){this._=t,this.next=null,this.previous=null}function QD(t,e){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,o,a,s,u,l,c,f,h;if((n=t[0]).x=0,n.y=0,!(o>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(o>2))return n.r+r.r;VD(r,n,i=t[2]),n=new ZD(n),r=new ZD(r),i=new ZD(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(u=3;u<o;++u){VD(n._,r._,i=t[u]),i=new ZD(i),l=r.next,c=n.previous,f=r._.r,h=n._.r;do{if(f<=h){if(XD(l._,i._)){r=l,n.next=r,r.previous=n,--u;continue t}f+=l._.r,l=l.next}else{if(XD(c._,i._)){(n=c).next=r,r.previous=n,--u;continue t}h+=c._.r,c=c.previous}}while(l!==c.next);for(i.previous=n,i.next=r,n.next=r.previous=r=i,a=JD(n);(i=i.next)!==r;)(s=JD(i))<a&&(n=i,a=s);r=n.next}for(n=[r._],i=r;(i=i.next)!==r;)n.push(i._);for(i=function(t,e){for(var n,r,i=0,o=(t=function(t,e){let n,r,i=t.length;for(;i;)r=e()*i--|0,n=t[i],t[i]=t[r],t[r]=n;return t}(Array.from(t),e)).length,a=[];i<o;)n=t[i],r&&ID(r,n)?++i:(r=HD(a=PD(a,n)),i=0);return r}(n,e),u=0;u<o;++u)(n=t[u]).x-=i.x,n.y-=i.y;return i.r}function KD(t){return Math.sqrt(t.value)}function tC(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function eC(t,e,n){return function(r){if(i=r.children){var i,o,a,s=i.length,u=t(r)*e||0;if(u)for(o=0;o<s;++o)i[o].r+=u;if(a=QD(i,n),u)for(o=0;o<s;++o)i[o].r-=u;r.r=a+u}}}function nC(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function rC(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 iC(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&&(r-e)/t.value;++s<u;)(o=a[s]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*l}var oC={depth:-1},aC={},sC={};function uC(t){return t.id}function lC(t){return t.parentId}function cC(){var t,e=uC,n=lC;function r(r){var i,o,a,s,u,l,c,f,h=Array.from(r),d=e,p=n,g=new Map;if(null!=t){const e=h.map(((e,n)=>function(t){t=`${t}`;let e=t.length;hC(t,e-1)&&!hC(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r)))),n=e.map(fC),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(fC(t)),h.push(sC));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,i=h.length;a<i;++a)o=h[a],l=h[a]=new OD(o),null!=(c=d(o,a,r))&&(c+="")&&(f=l.id=c,g.set(f,g.has(f)?aC:l)),null!=(c=p(o,a,r))&&(c+="")&&(l.parent=c);for(a=0;a<i;++a)if(c=(l=h[a]).parent){if(!(u=g.get(c)))throw new Error("missing: "+c);if(u===aC)throw new Error("ambiguous: "+c);u.children?u.children.push(l):u.children=[l],l.parent=u}else{if(s)throw new Error("multiple roots");s=l}if(!s)throw new Error("no root");if(null!=t){for(;s.data===sC&&1===s.children.length;)s=s.children[0],--i;for(let t=h.length-1;t>=0&&(l=h[t]).data===sC;--t)l.data=null}if(s.parent=oC,s.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(BD),s.parent=null,i>0)throw new Error("cycle");return s}return r.id=function(t){return arguments.length?(e=ND(t),r):e},r.parentId=function(t){return arguments.length?(n=ND(t),r):n},r.path=function(e){return arguments.length?(t=ND(e),r):t},r}function fC(t){let e=t.length;if(e<2)return"";for(;--e>1&&!hC(t,e););return t.slice(0,e)}function hC(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}function dC(t,e){return t.parent===e.parent?1:2}function pC(t){var e=t.children;return e?e[0]:t.t}function gC(t){var e=t.children;return e?e[e.length-1]:t.t}function mC(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function yC(t,e,n){return t.a.parent===e.parent?t.a:n}function vC(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function _C(t,e,n,r,i){for(var o,a=t.children,s=-1,u=a.length,l=t.value&&(i-n)/t.value;++s<u;)(o=a[s]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*l}vC.prototype=Object.create(OD.prototype);var xC=(1+Math.sqrt(5))/2;function bC(t,e,n,r,i,o){for(var a,s,u,l,c,f,h,d,p,g,m,y=[],v=e.children,_=0,x=0,b=v.length,w=e.value;_<b;){u=i-n,l=o-r;do{c=v[x++].value}while(!c&&x<b);for(f=h=c,m=c*c*(g=Math.max(l/u,u/l)/(w*t)),p=Math.max(h/m,m/f);x<b;++x){if(c+=s=v[x].value,s<f&&(f=s),s>h&&(h=s),m=c*c*g,(d=Math.max(h/m,m/f))>p){c-=s;break}p=d}y.push(a={value:c,dice:u<l,children:v.slice(_,x)}),a.dice?iC(a,n,r,i,w?r+=l*c/w:o):_C(a,n,r,w?n+=u*c/w:i,o),w-=c,_=x}return y}var wC=function t(e){function n(t,n,r,i,o){bC(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(xC);var MC=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,u,l,c,f=-1,h=a.length,d=t.value;++f<h;){for(u=(s=a[f]).children,l=s.value=0,c=u.length;l<c;++l)s.value+=u[l].value;s.dice?iC(s,n,r,i,d?r+=(o-r)*s.value/d:o):_C(s,n,r,d?n+=(i-n)*s.value/d:i,o),d-=s.value}else t._squarify=a=bC(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(xC);function kC(t,e,n){const r={};return t.each((t=>{const i=t.data;n(i)&&(r[e(i)]=t)})),t.lookup=r,t}function AC(t){as.call(this,null,t)}AC.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const EC=t=>t.values;function DC(){const t=[],e={entries:t=>r(n(t,0),0),key:n=>(t.push(n),e)};function n(e,r){if(r>=t.length)return e;const i=e.length,o=t[r++],a={},s={};let u,l,c,f=-1;for(;++f<i;)u=o(l=e[f])+"",(c=a[u])?c.push(l):a[u]=[l];for(u in a)s[u]=n(a[u],r);return s}function r(e,n){if(++n>t.length)return e;const i=[];for(const t in e)i.push({key:t,values:r(e[t],n)});return i}return e}function CC(t){as.call(this,null,t)}ct(AC,as,{transform(t,e){e.source||s("Nest transform requires an upstream data source.");var n=t.generate,r=t.modified(),i=e.clone(),o=this.value;return(!o||r||e.changed())&&(o&&o.each((t=>{t.children&&Ea(t.data)&&i.rem.push(t.data)})),this.value=o=SD({values:G(t.keys).reduce(((t,e)=>(t.key(e),t)),DC()).entries(i.source)},EC),n&&o.each((t=>{t.children&&(t=Fa(t.data),i.add.push(t),i.source.push(t))})),kC(o,Da,Da)),i.source.root=o,i}});const FC=(t,e)=>t.parent===e.parent?1:2;ct(CC,as,{transform(t,e){e.source&&e.source.root||s(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(t.method),r=this.fields,i=e.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(za(t.sort,(t=>t.data))),function(t,e,n){for(let r,i=0,o=e.length;i<o;++i)r=e[i],r in n&&t[r](n[r])}(n,this.params,t),n.separation&&n.separation(!1!==t.separation?FC:d);try{this.value=n(i)}catch(t){s(t)}return i.each((t=>function(t,e,n){const r=t.data,i=e.length-1;for(let o=0;o<i;++o)r[n[o]]=t[e[o]];r[n[i]]=t.children?t.children.length:0}(t,r,o))),e.reflow(t.modified()).modifies(o).modifies("leaf")}});const SC=["x","y","r","depth","children"];function TC(t){CC.call(this,t)}TC.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:SC.length,default:SC}]},ct(TC,CC,{layout:function(){var t=null,e=1,n=1,r=UD;function i(i){const o=function(){let t=1;return()=>(t=(1664525*t+1013904223)%qD)/qD}();return i.x=e/2,i.y=n/2,t?i.eachBefore(tC(t)).eachAfter(eC(r,.5,o)).eachBefore(nC(1)):i.eachBefore(tC(KD)).eachAfter(eC(UD,1,o)).eachAfter(eC(r,i.r/Math.min(e,n),o)).eachBefore(nC(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=ND(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:LD(+t),i):r},i},params:["radius","size","padding"],fields:SC});const $C=["x0","y0","x1","y1","depth","children"];function zC(t){CC.call(this,t)}function BC(t){as.call(this,null,t)}zC.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:$C.length,default:$C}]},ct(zC,CC,{layout:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&iC(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a<i&&(i=a=(i+a)/2),s<o&&(o=s=(o+s)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=s}}(e,o)),r&&i.eachBefore(rC),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},params:["size","round","padding"],fields:$C}),BC.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},ct(BC,as,{transform(t,e){e.source||s("Stratify transform requires an upstream data source.");let n=this.value;const r=t.modified(),i=e.fork(e.ALL).materialize(e.SOURCE),o=!n||r||e.changed(e.ADD_REM)||e.modified(t.key.fields)||e.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(n=i.source.length?kC(cC().id(t.key).parentId(t.parentKey)(i.source),t.key,p):kC(cC()([{}]),t.key,t.key)),i.source.root=this.value=n,i}});const OC={tidy:function(){var t=dC,e=1,n=1,r=null;function i(i){var u=function(t){for(var e,n,r,i,o,a=new vC(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new vC(r[i],i)),n.parent=e;return(a.parent=new vC(null,0)).children=[a],a}(i);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(a),r)i.eachBefore(s);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=e/(c.x+h+d),g=n/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,u=o.parent.children[0],l=o.m,c=a.m,f=s.m,h=u.m;s=gC(s),o=pC(o),s&&o;)u=pC(u),(a=gC(a)).a=e,(i=s.z+f-o.z-l+t(s._,o._))>0&&(mC(yC(s,e,r),e,i),l+=i,c+=i),f+=s.m,l+=o.m,h+=u.m,c+=a.m;s&&!gC(a)&&(a.t=s,a.m+=f-c),o&&!pC(u)&&(u.t=o,u.m+=l-h,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i},cluster:function(){var t=ED,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(e){var n=e.children;n?(e.x=function(t){return t.reduce(DD,0)/t.length}(n),e.y=function(t){return 1+t.reduce(CD,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)}));var s=function(t){for(var e;e=t.children;)t=e[0];return t}(i),u=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),l=s.x-t(s,u)/2,c=u.x+t(u,s)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-l)/(c-l)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}},NC=["x","y","depth","children"];function RC(t){CC.call(this,t)}function UC(t){as.call(this,[],t)}RC.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:NC.length,default:NC}]},ct(RC,CC,{layout(t){const e=t||"tidy";if(at(OC,e))return OC[e]();s("Unrecognized Tree layout method: "+e)},params:["size","nodeSize"],fields:NC}),UC.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ct(UC,as,{transform(t,e){const n=this.value,r=e.source&&e.source.root,i=e.fork(e.NO_SOURCE),o={};return r||s("TreeLinks transform requires a tree data source."),e.changed(e.ADD_REM)?(i.rem=n,e.visit(e.SOURCE,(t=>o[Da(t)]=1)),r.each((t=>{const e=t.data,n=t.parent&&t.parent.data;n&&o[Da(e)]&&o[Da(n)]&&i.add.push(Fa({source:n,target:e}))})),this.value=i.add):e.changed(e.MOD)&&(e.visit(e.MOD,(t=>o[Da(t)]=1)),n.forEach((t=>{(o[Da(t.source)]||o[Da(t.target)])&&i.mod.push(t)}))),i}});const LC={binary:function(t,e,n,r,i){var o,a,s=t.children,u=s.length,l=new Array(u+1);for(l[0]=a=o=0;o<u;++o)l[o+1]=a+=s[o].value;!function t(e,n,r,i,o,a,u){if(e>=n-1){var c=s[e];return c.x0=i,c.y0=o,c.x1=a,void(c.y1=u)}var f=l[e],h=r/2+f,d=e+1,p=n-1;for(;d<p;){var g=d+p>>>1;l[g]<h?d=g+1:p=g}h-l[d-1]<l[d]-h&&e+1<d&&--d;var m=l[d]-f,y=r-m;if(a-i>u-o){var v=r?(i*y+a*m)/r:a;t(e,d,m,i,o,v,u),t(d,n,y,v,o,a,u)}else{var _=r?(o*y+u*m)/r:u;t(e,d,m,i,o,a,_),t(d,n,y,i,_,a,u)}}(0,u,t.value,e,n,r,i)},dice:iC,slice:_C,slicedice:function(t,e,n,r,i){(1&t.depth?_C:iC)(t,e,n,r,i)},squarify:wC,resquarify:MC},qC=["x0","y0","x1","y1","depth","children"];function PC(t){CC.call(this,t)}PC.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:qC.length,default:qC}]},ct(PC,CC,{layout(){const t=function(){var t=wC,e=!1,n=1,r=1,i=[0],o=UD,a=UD,s=UD,u=UD,l=UD;function c(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(f),i=[0],e&&t.eachBefore(rC),t}function f(e){var n=i[e.depth],r=e.x0+n,c=e.y0+n,f=e.x1-n,h=e.y1-n;f<r&&(r=f=(r+f)/2),h<c&&(c=h=(c+h)/2),e.x0=r,e.y0=c,e.x1=f,e.y1=h,e.children&&(n=i[e.depth+1]=o(e)/2,r+=l(e)-n,c+=a(e)-n,(f-=s(e)-n)<r&&(r=f=(r+f)/2),(h-=u(e)-n)<c&&(c=h=(c+h)/2),t(e,r,c,f,h))}return c.round=function(t){return arguments.length?(e=!!t,c):e},c.size=function(t){return arguments.length?(n=+t[0],r=+t[1],c):[n,r]},c.tile=function(e){return arguments.length?(t=RD(e),c):t},c.padding=function(t){return arguments.length?c.paddingInner(t).paddingOuter(t):c.paddingInner()},c.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:LD(+t),c):o},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?(a="function"==typeof t?t:LD(+t),c):a},c.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:LD(+t),c):s},c.paddingBottom=function(t){return arguments.length?(u="function"==typeof t?t:LD(+t),c):u},c.paddingLeft=function(t){return arguments.length?(l="function"==typeof t?t:LD(+t),c):l},c}();return t.ratio=e=>{const n=t.tile();n.ratio&&t.tile(n.ratio(e))},t.method=e=>{at(LC,e)?t.tile(LC[e]):s("Unrecognized Treemap layout method: "+e)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:qC});var jC=Object.freeze({__proto__:null,nest:AC,pack:TC,partition:zC,stratify:BC,tree:RC,treelinks:UC,treemap:PC});const IC=4278190080;function WC(t,e,n){return new Uint32Array(t.getImageData(0,0,e,n).data.buffer)}function HC(t,e,n){if(!e.length)return;const r=e[0].mark.marktype;"group"===r?e.forEach((e=>{e.items.forEach((e=>HC(t,e.items,n)))})):Ky[r].draw(t,{items:n?e.map(YC):e})}function YC(t){const e=Ta(t,{});return e.stroke&&0!==e.strokeOpacity||e.fill&&0!==e.fillOpacity?{...e,strokeOpacity:1,stroke:"#000",fillOpacity:0}:e}const GC=31,VC=new Uint32Array(33),XC=new Uint32Array(33);XC[0]=0,VC[0]=~XC[0];for(let t=1;t<=32;++t)XC[t]=XC[t-1]<<1|1,VC[t]=~XC[t];function JC(t,e,n){const r=Math.max(1,Math.sqrt(t*e/1e6)),i=~~((t+2*n+r)/r),o=~~((e+2*n+r)/r),a=t=>~~((t+n)/r);return a.invert=t=>t*r-n,a.bitmap=()=>function(t,e){const n=new Uint32Array(~~((t*e+32)/32));function r(t,e){n[t]|=e}function i(t,e){n[t]&=e}return{array:n,get:(e,r)=>{const i=r*t+e;return n[i>>>5]&1<<(i&GC)},set:(e,n)=>{const i=n*t+e;r(i>>>5,1<<(i&GC))},clear:(e,n)=>{const r=n*t+e;i(r>>>5,~(1<<(r&GC)))},getRange:(e,r,i,o)=>{let a,s,u,l,c=o;for(;c>=r;--c)if(a=c*t+e,s=c*t+i,u=a>>>5,l=s>>>5,u===l){if(n[u]&VC[a&GC]&XC[1+(s&GC)])return!0}else{if(n[u]&VC[a&GC])return!0;if(n[l]&XC[1+(s&GC)])return!0;for(let t=u+1;t<l;++t)if(n[t])return!0}return!1},setRange:(e,n,i,o)=>{let a,s,u,l,c;for(;n<=o;++n)if(a=n*t+e,s=n*t+i,u=a>>>5,l=s>>>5,u===l)r(u,VC[a&GC]&XC[1+(s&GC)]);else for(r(u,VC[a&GC]),r(l,XC[1+(s&GC)]),c=u+1;c<l;++c)r(c,4294967295)},clearRange:(e,n,r,o)=>{let a,s,u,l,c;for(;n<=o;++n)if(a=n*t+e,s=n*t+r,u=a>>>5,l=s>>>5,u===l)i(u,XC[a&GC]|VC[1+(s&GC)]);else for(i(u,XC[a&GC]),i(l,VC[1+(s&GC)]),c=u+1;c<l;++c)i(c,0)},outOfBounds:(n,r,i,o)=>n<0||r<0||o>=e||i>=t}}(i,o),a.ratio=r,a.padding=n,a.width=t,a.height=e,a}function ZC(t,e,n,r,i,o){let a=n/2;return t-a<0||t+a>i||e-(a=r/2)<0||e+a>o}function QC(t,e,n,r,i,o,a,s){const u=i*o/(2*r),l=t(e-u),c=t(e+u),f=t(n-(o/=2)),h=t(n+o);return a.outOfBounds(l,f,c,h)||a.getRange(l,f,c,h)||s&&s.getRange(l,f,c,h)}const KC=[-1,-1,1,1],tF=[-1,1,-1,1];const eF=["right","center","left"],nF=["bottom","middle","top"];function rF(t,e,n,r,i,o,a,s,u,l,c,f){return!(i.outOfBounds(t,n,e,r)||(f&&o||i).getRange(t,n,e,r))}const iF={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},oF={naive:function(t,e,n,r){const i=t.width,o=t.height;return function(t){const e=t.datum.datum.items[r].items,n=e.length,a=t.datum.fontSize,s=zy.width(t.datum,t.datum.text);let u,l,c,f,h,d,p,g=0;for(let r=0;r<n;++r)u=e[r].x,c=e[r].y,l=void 0===e[r].x2?u:e[r].x2,f=void 0===e[r].y2?c:e[r].y2,h=(u+l)/2,d=(c+f)/2,p=Math.abs(l-u+f-c),p>=g&&(g=p,t.x=h,t.y=d);return h=s/2,d=a/2,u=t.x-h,l=t.x+h,c=t.y-d,f=t.y+d,t.align="center",u<0&&l<=i?t.align="left":0<=u&&i<l&&(t.align="right"),t.baseline="middle",c<0&&f<=o?t.baseline="top":0<=c&&o<f&&(t.baseline="bottom"),!0}},"reduced-search":function(t,e,n,r){const i=t.width,o=t.height,a=e[0],s=e[1];function u(e,n,r,u,l){const c=t.invert(e),f=t.invert(n);let h,d=r,p=o;if(!ZC(c,f,u,l,i,o)&&!QC(t,c,f,l,u,d,a,s)&&!QC(t,c,f,l,u,l,a,null)){for(;p-d>=1;)h=(d+p)/2,QC(t,c,f,l,u,h,a,s)?p=h:d=h;if(d>r)return[c,f,d,!0]}}return function(e){const s=e.datum.datum.items[r].items,l=s.length,c=e.datum.fontSize,f=zy.width(e.datum,e.datum.text);let h,d,p,g,m,y,v,_,x,b,w,M,k,A,E,D,C,F=n?c:0,S=!1,T=!1,$=0;for(let r=0;r<l;++r){for(h=s[r].x,p=s[r].y,d=void 0===s[r].x2?h:s[r].x2,g=void 0===s[r].y2?p:s[r].y2,h>d&&(C=h,h=d,d=C),p>g&&(C=p,p=g,g=C),x=t(h),w=t(d),b=~~((x+w)/2),M=t(p),A=t(g),k=~~((M+A)/2),v=b;v>=x;--v)for(_=k;_>=M;--_)D=u(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);for(v=b;v<=w;++v)for(_=k;_<=A;++_)D=u(v,_,F,f,c),D&&([e.x,e.y,F,S]=D);S||n||(E=Math.abs(d-h+g-p),m=(h+d)/2,y=(p+g)/2,E>=$&&!ZC(m,y,f,c,i,o)&&!QC(t,m,y,c,f,c,a,null)&&($=E,e.x=m,e.y=y,T=!0))}return!(!S&&!T)&&(m=f/2,y=c/2,a.setRange(t(e.x-m),t(e.y-y),t(e.x+m),t(e.y+y)),e.align="center",e.baseline="middle",!0)}},floodfill:function(t,e,n,r){const i=t.width,o=t.height,a=e[0],s=e[1],u=t.bitmap();return function(e){const l=e.datum.datum.items[r].items,c=l.length,f=e.datum.fontSize,h=zy.width(e.datum,e.datum.text),d=[];let p,g,m,y,v,_,x,b,w,M,k,A,E=n?f:0,D=!1,C=!1,F=0;for(let r=0;r<c;++r){for(p=l[r].x,m=l[r].y,g=void 0===l[r].x2?p:l[r].x2,y=void 0===l[r].y2?m:l[r].y2,d.push([t((p+g)/2),t((m+y)/2)]);d.length;)if([x,b]=d.pop(),!(a.get(x,b)||s.get(x,b)||u.get(x,b))){u.set(x,b);for(let t=0;t<4;++t)v=x+KC[t],_=b+tF[t],u.outOfBounds(v,_,v,_)||d.push([v,_]);if(v=t.invert(x),_=t.invert(b),w=E,M=o,!ZC(v,_,h,f,i,o)&&!QC(t,v,_,f,h,w,a,s)&&!QC(t,v,_,f,h,f,a,null)){for(;M-w>=1;)k=(w+M)/2,QC(t,v,_,f,h,k,a,s)?M=k:w=k;w>E&&(e.x=v,e.y=_,E=w,D=!0)}}D||n||(A=Math.abs(g-p+y-m),v=(p+g)/2,_=(m+y)/2,A>=F&&!ZC(v,_,h,f,i,o)&&!QC(t,v,_,f,h,f,a,null)&&(F=A,e.x=v,e.y=_,C=!0))}return!(!D&&!C)&&(v=h/2,_=f/2,a.setRange(t(e.x-v),t(e.y-_),t(e.x+v),t(e.y+_)),e.align="center",e.baseline="middle",!0)}}};function aF(t,e,n,r,i,o,a,s,u,l,c){if(!t.length)return t;const f=Math.max(r.length,i.length),h=function(t,e){const n=new Float64Array(e),r=t.length;for(let e=0;e<r;++e)n[e]=t[e]||0;for(let t=r;t<e;++t)n[t]=n[r-1];return n}(r,f),d=function(t,e){const n=new Int8Array(e),r=t.length;for(let e=0;e<r;++e)n[e]|=iF[t[e]];for(let t=r;t<e;++t)n[t]=n[r-1];return n}(i,f),p=(x=t[0].datum)&&x.mark&&x.mark.marktype,g="group"===p&&t[0].datum.items[u].marktype,m="area"===g,y=function(t,e,n,r){const i=t=>[t.x,t.x,t.x,t.y,t.y,t.y];return t?"line"===t||"area"===t?t=>i(t.datum):"line"===e?t=>{const e=t.datum.items[r].items;return i(e.length?e["start"===n?0:e.length-1]:{x:NaN,y:NaN})}:t=>{const e=t.datum.bounds;return[e.x1,(e.x1+e.x2)/2,e.x2,e.y1,(e.y1+e.y2)/2,e.y2]}:i}(p,g,s,u),v=null===l||l===1/0,_=m&&"naive"===c;var x;let b=-1,w=-1;const M=t.map((t=>{const e=v?zy.width(t,t.text):void 0;return b=Math.max(b,e),w=Math.max(w,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(t),textWidth:e}}));l=null===l||l===1/0?Math.max(b,w)+Math.max(...r):l;const k=JC(e[0],e[1],l);let A;if(!_){n&&M.sort(((t,e)=>n(t.datum,e.datum)));let e=!1;for(let t=0;t<d.length&&!e;++t)e=5===d[t]||h[t]<0;const r=(p&&a||m)&&t.map((t=>t.datum));A=o.length||r?function(t,e,n,r,i){const o=t.width,a=t.height,s=r||i,u=jc(o,a).getContext("2d"),l=jc(o,a).getContext("2d"),c=s&&jc(o,a).getContext("2d");n.forEach((t=>HC(u,t,!1))),HC(l,e,!1),s&&HC(c,e,!0);const f=WC(u,o,a),h=WC(l,o,a),d=s&&WC(c,o,a),p=t.bitmap(),g=s&&t.bitmap();let m,y,v,_,x,b,w,M;for(y=0;y<a;++y)for(m=0;m<o;++m)x=y*o+m,b=f[x]&IC,M=h[x]&IC,w=s&&d[x]&IC,(b||w||M)&&(v=t(m),_=t(y),i||!b&&!M||p.set(v,_),s&&(b||w)&&g.set(v,_));return[p,g]}(k,r||[],o,e,m):function(t,e){const n=t.bitmap();return(e||[]).forEach((e=>n.set(t(e.boundary[0]),t(e.boundary[3])))),[n,void 0]}(k,a&&M)}const E=m?oF[c](k,A,a,u):function(t,e,n,r){const i=t.width,o=t.height,a=e[0],s=e[1],u=r.length;return function(e){const l=e.boundary,c=e.datum.fontSize;if(l[2]<0||l[5]<0||l[0]>i||l[3]>o)return!1;let f,h,d,p,g,m,y,v,_,x,b,w,M,k,A,E=e.textWidth??0;for(let i=0;i<u;++i){if(f=(3&n[i])-1,h=(n[i]>>>2&3)-1,d=0===f&&0===h||r[i]<0,p=f&&h?Math.SQRT1_2:1,g=r[i]<0?-1:1,m=l[1+f]+r[i]*f*p,b=l[4+h]+g*c*h/2+r[i]*h*p,v=b-c/2,_=b+c/2,w=t(m),k=t(v),A=t(_),!E){if(!rF(w,w,k,A,a,s,0,0,0,0,0,d))continue;E=zy.width(e.datum,e.datum.text)}if(x=m+g*E*f/2,m=x-E/2,y=x+E/2,w=t(m),M=t(y),rF(w,M,k,A,a,s,0,0,0,0,0,d))return e.x=f?f*g<0?y:m:x,e.y=h?h*g<0?_:v:b,e.align=eF[f*g+1],e.baseline=nF[h*g+1],a.setRange(w,k,M,A),!0}return!1}}(k,A,d,h);return M.forEach((t=>t.opacity=+E(t))),M}const sF=["x","y","opacity","align","baseline"],uF=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function lF(t){as.call(this,null,t)}lF.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:uF},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:sF.length,default:sF}]},ct(lF,as,{transform(t,e){const n=t.modified();if(!(n||e.changed(e.ADD_REM)||function(n){const r=t[n];return X(r)&&e.modified(r.fields)}("sort")))return;t.size&&2===t.size.length||s("Size parameter should be specified as a [width, height] array.");const r=t.as||sF;return aF(e.materialize(e.SOURCE).source||[],t.size,t.sort,G(null==t.offset?1:t.offset),G(t.anchor||uF),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const e=t.datum;e[r[0]]=t.x,e[r[1]]=t.y,e[r[2]]=t.opacity,e[r[3]]=t.align,e[r[4]]=t.baseline})),e.reflow(n).modifies(r)}});var cF=Object.freeze({__proto__:null,label:lF});function fF(t,e){var n,r,i,o,a,s,u=[],l=function(t){return t(o)};if(null==e)u.push(t);else for(n={},r=0,i=t.length;r<i;++r)o=t[r],(s=n[a=e.map(l)])||(n[a]=s=[],s.dims=a,u.push(s)),s.push(o);return u}function hF(t){as.call(this,null,t)}hF.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}]},ct(hF,as,{transform(t,e){const r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=fF(e.materialize(e.SOURCE).source,t.groupby),o=(t.groupby||[]).map(n),a=o.length,s=t.as||[n(t.x),n(t.y)],u=[];i.forEach((e=>{Xs(e,t.x,t.y,t.bandwidth||.3).forEach((t=>{const n={};for(let t=0;t<a;++t)n[o[t]]=e.dims[t];n[s[0]]=t[0],n[s[1]]=t[1],u.push(Fa(n))}))})),this.value&&(r.rem=this.value),this.value=r.add=r.source=u}return r}});const dF={constant:Rs,linear:js,log:Is,exp:Ws,pow:Hs,quad:Ys,poly:Gs};function pF(t){as.call(this,null,t)}pF.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(dF)},{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}]},ct(pF,as,{transform(t,e){const r=e.fork(e.NO_SOURCE|e.NO_FIELDS);if(!this.value||e.changed()||t.modified()){const i=fF(e.materialize(e.SOURCE).source,t.groupby),o=(t.groupby||[]).map(n),a=t.method||"linear",u=null==t.order?3:t.order,l=((t,e)=>"poly"===t?e:"quad"===t?2:1)(a,u),c=t.as||[n(t.x),n(t.y)],f=dF[a],h=[];let d=t.extent;at(dF,a)||s("Invalid regression method: "+a),null!=d&&"log"===a&&d[0]<=0&&(e.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach((n=>{if(n.length<=l)return void e.dataflow.warn("Skipping regression with more parameters than data points.");const r=f(n,t.x,t.y,u);if(t.params)return void h.push(Fa({keys:n.dims,coef:r.coef,rSquared:r.rSquared}));const i=d||it(n,t.x),s=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],h.push(Fa(e))};"linear"===a||"constant"===a?i.forEach((t=>s([t,r.predict(t)]))):Ks(r.predict,i,25,200).forEach(s)})),this.value&&(r.rem=this.value),this.value=r.add=r.source=h}return r}});var gF=Object.freeze({__proto__:null,loess:hF,regression:pF});const mF=134217729;function yF(t,e,n,r,i){let o,a,s,u,l=e[0],c=r[0],f=0,h=0;c>l==c>-l?(o=l,l=e[++f]):(o=c,c=r[++h]);let d=0;if(f<t&&h<n)for(c>l==c>-l?(a=l+o,s=o-(a-l),l=e[++f]):(a=c+o,s=o-(a-c),c=r[++h]),o=a,0!==s&&(i[d++]=s);f<t&&h<n;)c>l==c>-l?(a=o+l,u=a-o,s=o-(a-u)+(l-u),l=e[++f]):(a=o+c,u=a-o,s=o-(a-u)+(c-u),c=r[++h]),o=a,0!==s&&(i[d++]=s);for(;f<t;)a=o+l,u=a-o,s=o-(a-u)+(l-u),l=e[++f],o=a,0!==s&&(i[d++]=s);for(;h<n;)a=o+c,u=a-o,s=o-(a-u)+(c-u),c=r[++h],o=a,0!==s&&(i[d++]=s);return 0===o&&0!==d||(i[d++]=o),d}function vF(t){return new Float64Array(t)}const _F=vF(4),xF=vF(8),bF=vF(12),wF=vF(16),MF=vF(4);function kF(t,e,n,r,i,o){const a=(e-o)*(n-i),s=(t-i)*(r-o),u=a-s,l=Math.abs(a+s);return Math.abs(u)>=33306690738754716e-32*l?u:-function(t,e,n,r,i,o,a){let s,u,l,c,f,h,d,p,g,m,y,v,_,x,b,w,M,k;const A=t-i,E=n-i,D=e-o,C=r-o;x=A*C,h=mF*A,d=h-(h-A),p=A-d,h=mF*C,g=h-(h-C),m=C-g,b=p*m-(x-d*g-p*g-d*m),w=D*E,h=mF*D,d=h-(h-D),p=D-d,h=mF*E,g=h-(h-E),m=E-g,M=p*m-(w-d*g-p*g-d*m),y=b-M,f=b-y,_F[0]=b-(y+f)+(f-M),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,_F[1]=_-(y+f)+(f-w),k=v+y,f=k-v,_F[2]=v-(k-f)+(y-f),_F[3]=k;let F=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,_F),S=22204460492503146e-32*a;if(F>=S||-F>=S)return F;if(f=t-A,s=t-(A+f)+(f-i),f=n-E,l=n-(E+f)+(f-i),f=e-D,u=e-(D+f)+(f-o),f=r-C,c=r-(C+f)+(f-o),0===s&&0===u&&0===l&&0===c)return F;if(S=11093356479670487e-47*a+33306690738754706e-32*Math.abs(F),F+=A*c+C*s-(D*l+E*u),F>=S||-F>=S)return F;x=s*C,h=mF*s,d=h-(h-s),p=s-d,h=mF*C,g=h-(h-C),m=C-g,b=p*m-(x-d*g-p*g-d*m),w=u*E,h=mF*u,d=h-(h-u),p=u-d,h=mF*E,g=h-(h-E),m=E-g,M=p*m-(w-d*g-p*g-d*m),y=b-M,f=b-y,MF[0]=b-(y+f)+(f-M),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,MF[1]=_-(y+f)+(f-w),k=v+y,f=k-v,MF[2]=v-(k-f)+(y-f),MF[3]=k;const T=yF(4,_F,4,MF,xF);x=A*c,h=mF*A,d=h-(h-A),p=A-d,h=mF*c,g=h-(h-c),m=c-g,b=p*m-(x-d*g-p*g-d*m),w=D*l,h=mF*D,d=h-(h-D),p=D-d,h=mF*l,g=h-(h-l),m=l-g,M=p*m-(w-d*g-p*g-d*m),y=b-M,f=b-y,MF[0]=b-(y+f)+(f-M),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,MF[1]=_-(y+f)+(f-w),k=v+y,f=k-v,MF[2]=v-(k-f)+(y-f),MF[3]=k;const $=yF(T,xF,4,MF,bF);x=s*c,h=mF*s,d=h-(h-s),p=s-d,h=mF*c,g=h-(h-c),m=c-g,b=p*m-(x-d*g-p*g-d*m),w=u*l,h=mF*u,d=h-(h-u),p=u-d,h=mF*l,g=h-(h-l),m=l-g,M=p*m-(w-d*g-p*g-d*m),y=b-M,f=b-y,MF[0]=b-(y+f)+(f-M),v=x+y,f=v-x,_=x-(v-f)+(y-f),y=_-w,f=_-y,MF[1]=_-(y+f)+(f-w),k=v+y,f=k-v,MF[2]=v-(k-f)+(y-f),MF[3]=k;const z=yF($,bF,4,MF,wF);return wF[z-1]}(t,e,n,r,i,o,l)}const AF=Math.pow(2,-52),EF=new Uint32Array(512);class DF{static from(t,e=zF,n=BF){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=e(r),i[2*o+1]=n(r)}return new DF(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,u=-1/0,l=-1/0;for(let e=0;e<o;e++){const n=t[2*e],r=t[2*e+1];n<a&&(a=n),r<s&&(s=r),n>u&&(u=n),r>l&&(l=r),this._ids[e]=e}const c=(a+u)/2,f=(s+l)/2;let h,d,p;for(let e=0,n=1/0;e<o;e++){const r=CF(c,f,t[2*e],t[2*e+1]);r<n&&(h=e,n=r)}const g=t[2*h],m=t[2*h+1];for(let e=0,n=1/0;e<o;e++){if(e===h)continue;const r=CF(g,m,t[2*e],t[2*e+1]);r<n&&r>0&&(d=e,n=r)}let y=t[2*d],v=t[2*d+1],_=1/0;for(let e=0;e<o;e++){if(e===h||e===d)continue;const n=SF(g,m,y,v,t[2*e],t[2*e+1]);n<_&&(p=e,_=n)}let x=t[2*p],b=t[2*p+1];if(_===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];TF(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(e[n++]=i,r=o)}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(kF(g,m,y,v,x,b)<0){const t=d,e=y,n=v;d=p,y=x,v=b,p=t,x=e,b=n}const w=function(t,e,n,r,i,o){const a=n-t,s=r-e,u=i-t,l=o-e,c=a*a+s*s,f=u*u+l*l,h=.5/(a*l-s*u),d=t+(l*c-s*f)*h,p=e+(a*f-u*c)*h;return{x:d,y:p}}(g,m,y,v,x,b);this._cx=w.x,this._cy=w.y;for(let e=0;e<o;e++)this._dists[e]=CF(t[2*e],t[2*e+1],w.x,w.y);TF(this._ids,this._dists,0,o-1),this._hullStart=h;let M=3;n[h]=e[p]=d,n[d]=e[h]=p,n[p]=e[d]=h,r[h]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(g,m)]=h,i[this._hashKey(y,v)]=d,i[this._hashKey(x,b)]=p,this.trianglesLen=0,this._addTriangle(h,d,p,-1,-1,-1);for(let o,a,s=0;s<this._ids.length;s++){const u=this._ids[s],l=t[2*u],c=t[2*u+1];if(s>0&&Math.abs(l-o)<=AF&&Math.abs(c-a)<=AF)continue;if(o=l,a=c,u===h||u===d||u===p)continue;let f=0;for(let t=0,e=this._hashKey(l,c);t<this._hashSize&&(f=i[(e+t)%this._hashSize],-1===f||f===n[f]);t++);f=e[f];let g,m=f;for(;g=n[m],kF(l,c,t[2*m],t[2*m+1],t[2*g],t[2*g+1])>=0;)if(m=g,m===f){m=-1;break}if(-1===m)continue;let y=this._addTriangle(m,u,n[m],-1,-1,r[m]);r[u]=this._legalize(y+2),r[m]=y,M++;let v=n[m];for(;g=n[v],kF(l,c,t[2*v],t[2*v+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(v,u,g,r[u],-1,r[v]),r[u]=this._legalize(y+2),n[v]=v,M--,v=g;if(m===f)for(;g=e[m],kF(l,c,t[2*g],t[2*g+1],t[2*m],t[2*m+1])<0;)y=this._addTriangle(g,u,m,-1,r[m],r[g]),this._legalize(y+2),r[g]=y,n[m]=m,M--,m=g;this._hullStart=e[u]=m,n[m]=e[v]=u,n[u]=v,i[this._hashKey(l,c)]=u,i[this._hashKey(t[2*m],t[2*m+1])]=m}this.hull=new Uint32Array(M);for(let t=0,e=this._hullStart;t<M;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=EF[--i];continue}const u=a-a%3,l=s+(t+1)%3,c=u+(a+2)%3,f=e[o],h=e[t],d=e[l],p=e[c];if(FF(r[2*f],r[2*f+1],r[2*h],r[2*h+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=f;const r=n[c];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===c){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,c);const s=u+(a+1)%3;i<EF.length&&(EF[i++]=s)}else{if(0===i)break;t=EF[--i]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=e,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function CF(t,e,n,r){const i=t-n,o=e-r;return i*i+o*o}function FF(t,e,n,r,i,o,a,s){const u=t-a,l=e-s,c=n-a,f=r-s,h=i-a,d=o-s,p=c*c+f*f,g=h*h+d*d;return u*(f*g-p*d)-l*(c*g-p*h)+(u*u+l*l)*(c*d-f*h)<0}function SF(t,e,n,r,i,o){const a=n-t,s=r-e,u=i-t,l=o-e,c=a*a+s*s,f=u*u+l*l,h=.5/(a*l-s*u),d=(l*c-s*f)*h,p=(a*f-u*c)*h;return d*d+p*p}function TF(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;$F(t,n+r>>1,i),e[t[n]]>e[t[r]]&&$F(t,n,r),e[t[i]]>e[t[r]]&&$F(t,i,r),e[t[n]]>e[t[i]]&&$F(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]<s);do{o--}while(e[t[o]]>s);if(o<i)break;$F(t,i,o)}t[n+1]=t[o],t[o]=a,r-i+1>=o-n?(TF(t,e,i,r),TF(t,e,n,o-1)):(TF(t,e,n,o-1),TF(t,e,i,r))}}function $F(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function zF(t){return t[0]}function BF(t){return t[1]}const OF=1e-6;class NF{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>OF||Math.abs(this._y1-i)>OF)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}}class RF{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}}let UF=class{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,s,u=0,l=0,c=n.length;u<c;u+=3,l+=2){const c=2*n[u],f=2*n[u+1],h=2*n[u+2],d=t[c],p=t[c+1],g=t[f],m=t[f+1],y=t[h],v=t[h+1],_=g-d,x=m-p,b=y-d,w=v-p,M=2*(_*w-x*b);if(Math.abs(M)<1e-9){if(void 0===i){i=o=0;for(const n of e)i+=t[2*n],o+=t[2*n+1];i/=e.length,o/=e.length}const n=1e9*Math.sign((i-d)*w-(o-p)*b);r=(d+y)/2-n*w,s=(p+v)/2+n*b}else{const t=1/M,e=_*_+x*x,n=b*b+w*w;r=d+(w*e-x*n)*t,s=p+(_*n-b*e)*t}a[l]=r,a[l+1]=s}let s,u,l,c=e[e.length-1],f=4*c,h=t[2*c],d=t[2*c+1];r.fill(0);for(let n=0;n<e.length;++n)c=e[n],s=f,u=h,l=d,f=4*c,h=t[2*c],d=t[2*c+1],r[s+2]=r[f]=l-d,r[s+3]=r[f+1]=h-u}render(t){const e=null==t?t=new NF:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),a=2*Math.floor(r/3),s=o[i],u=o[i+1],l=o[a],c=o[a+1];this._renderSegment(s,u,l,c,t)}let s,u=i[i.length-1];for(let e=0;e<i.length;++e){s=u,u=i[e];const n=2*Math.floor(r[u]/3),l=o[n],c=o[n+1],f=4*s,h=this._project(l,c,a[f+2],a[f+3]);h&&this._renderSegment(l,c,h[0],h[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new NF:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new NF:void 0,r=this._clip(t);if(null===r||!r.length)return;e.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]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new RF;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let o;const a=this._regioncode(t,e),s=this._regioncode(n,r);0===a&&0===s?(i.moveTo(t,e),i.lineTo(n,r)):(o=this._clipSegment(t,e,n,r,a,s))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(e[r]===t[o]&&e[r+1]===t[o+1]&&e[(r+2)%i]===t[(o+a-2)%a]&&e[(r+3)%i]===t[(o+a-1)%a]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,o=n[t];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(e[2*n],e[2*n+1]),s=s%3==2?s-2:s+1,i[s]!==t)break;s=r[s]}while(s!==o&&-1!==s);return a}_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 e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return this._simplify(n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e))}_clipFinite(t,e){const n=e.length;let r,i,o,a,s=null,u=e[n-2],l=e[n-1],c=this._regioncode(u,l),f=0;for(let h=0;h<n;h+=2)if(r=u,i=l,u=e[h],l=e[h+1],o=c,c=this._regioncode(u,l),0===o&&0===c)a=f,f=0,s?s.push(u,l):s=[u,l];else{let e,n,h,d,p;if(0===o){if(null===(e=this._clipSegment(r,i,u,l,o,c)))continue;[n,h,d,p]=e}else{if(null===(e=this._clipSegment(u,l,r,i,c,o)))continue;[d,p,n,h]=e,a=f,f=this._edgecode(n,h),a&&f&&this._edge(t,a,f,s,s.length),s?s.push(n,h):s=[n,h]}a=f,f=this._edgecode(d,p),a&&f&&this._edge(t,a,f,s,s.length),s?s.push(d,p):s=[d,p]}if(s)a=f,f=this._edgecode(s[0],s[1]),a&&f&&this._edge(t,a,f,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,e,n,r,i,o){const a=i<o;for(a&&([t,e,n,r,i,o]=[n,r,t,e,o,i]);;){if(0===i&&0===o)return a?[n,r,t,e]:[t,e,n,r];if(i&o)return null;let s,u,l=i||o;8&l?(s=t+(n-t)*(this.ymax-e)/(r-e),u=this.ymax):4&l?(s=t+(n-t)*(this.ymin-e)/(r-e),u=this.ymin):2&l?(u=e+(r-e)*(this.xmax-t)/(n-t),s=this.xmax):(u=e+(r-e)*(this.xmin-t)/(n-t),s=this.xmin),i?(t=s,e=u,i=this._regioncode(t,e)):(n=s,r=u,o=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,o){let a,s=Array.from(e);if((a=this._project(s[0],s[1],n,r))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],i,o))&&s.push(a[0],a[1]),s=this._clipFinite(t,s))for(let e,n=0,r=s.length,i=this._edgecode(s[r-2],s[r-1]);n<r;n+=2)e=i,i=this._edgecode(s[n],s[n+1]),e&&i&&(n=this._edge(t,e,i,s,n),r=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,e,n,r,i){for(;e!==n;){let n,o;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,o=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,o=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,o=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,o=this.ymin}r[i]===n&&r[i+1]===o||!this.contains(t,n,o)||(r.splice(i,0,n,o),i+=2)}return i}_project(t,e,n,r){let i,o,a,s=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<s&&(a=this.ymin,o=t+(s=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<s&&(a=this.ymax,o=t+(s=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<s&&(o=this.xmax,a=e+(s=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<s&&(o=this.xmin,a=e+(s=i)*r)}return[o,a]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e<t.length;e+=2){const n=(e+2)%t.length,r=(e+4)%t.length;(t[e]===t[n]&&t[n]===t[r]||t[e+1]===t[n+1]&&t[n+1]===t[r+1])&&(t.splice(n,2),e-=2)}t.length||(t=null)}return t}};const LF=2*Math.PI,qF=Math.pow;function PF(t){return t[0]}function jF(t){return t[1]}function IF(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class WF{static from(t,e=PF,n=jF,r){return new WF("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=e.call(r,i,a,t),o[2*a+1]=n.call(r,i,a,t)}return o}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const o of t)yield e.call(r,o,i,t),yield n.call(r,o,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new DF(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,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],o=2*e[t+2];if((n[o]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[o+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},((t,e)=>e)).sort(((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]));const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=IF(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new DF(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==o[e]||(o[e]=t)}for(let t=0,e=r.length;t<e;++t)a[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],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new UF(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e<a.length-1&&(yield a[e+1]))}const s=e[t];if(-1===s)return;let u=s,l=-1;do{if(yield l=o[u],u=u%3==2?u-2:u+1,o[u]!==t)return;if(u=i[u],-1===u){const e=n[(r[t]+1)%n.length];return void(e!==l&&(yield e))}}while(u!==s)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:u}=this;if(-1===r[t]||!u.length)return(t+1)%(u.length>>1);let l=t,c=qF(e-u[2*t],2)+qF(n-u[2*t+1],2);const f=r[t];let h=f;do{let r=s[h];const f=qF(e-u[2*r],2)+qF(n-u[2*r+1],2);if(f<c&&(c=f,l=r),h=h%3==2?h-2:h+1,s[h]!==t)break;if(h=a[h],-1===h){if(h=i[(o[t]+1)%i.length],h!==r&&qF(e-u[2*h],2)+qF(n-u[2*h+1],2)<c)return h;break}}while(h!==f);return l}render(t){const e=null==t?t=new NF:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,o=r.length;e<o;++e){const o=r[e];if(o<e)continue;const a=2*i[e],s=2*i[o];t.moveTo(n[a],n[a+1]),t.lineTo(n[s],n[s+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e){void 0!==e||t&&"function"==typeof t.moveTo||(e=t,t=null),e=null==e?2:+e;const n=null==t?t=new NF:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],o=r[n+1];t.moveTo(i+e,o),t.arc(i,o,e,0,LF)}return n&&n.value()}renderHull(t){const e=null==t?t=new NF:void 0,{hull:n,points:r}=this,i=2*n[0],o=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<o;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new RF;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new NF:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],s=2*i[t+2];return e.moveTo(r[o],r[o+1]),e.lineTo(r[a],r[a+1]),e.lineTo(r[s],r[s+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new RF;return this.renderTriangle(t,e),e.value()}}function HF(t){as.call(this,null,t)}HF.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 YF=[-1e5,-1e5,1e5,1e5];function GF(t){const e=t[0][0],n=t[0][1];let r=t.length-1;for(;t[r][0]===e&&t[r][1]===n;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}ct(HF,as,{transform(t,e){const n=t.as||"path",r=e.source;if(!r||!r.length)return e;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]]:YF;const o=this.value=WF.from(r,t.x,t.y).voronoi(i);for(let t=0,e=r.length;t<e;++t){const e=o.cellPolygon(t);r[t][n]=e&&(2!==(a=e).length||a[0][0]!==a[1][0]||a[0][1]!==a[1][1])?GF(e):null}var a;return e.reflow(t.modified()).modifies(n)}});var VF=Object.freeze({__proto__:null,voronoi:HF}),XF=Math.PI/180,JF=2048;function ZF(){var t,e,n,r,i,o,a,s=[256,256],u=nS,l=[],c=Math.random,f={};function h(t,e,n){for(var r,i,o,a=e.x,l=e.y,f=Math.hypot(s[0],s[1]),h=u(s),d=c()<.5?1:-1,p=-d;(r=h(p+=d))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=f));)if(e.x=a+i,e.y=l+o,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>s[0]||e.y+e.y1>s[1])&&(!n||!KF(e,t,s[0]))&&(!n||eS(e,n))){for(var g,m=e.sprite,y=e.width>>5,v=s[0]>>5,_=e.x-(y<<4),x=127&_,b=32-x,w=e.y1-e.y0,M=(e.y+e.y0)*v+(_>>5),k=0;k<w;k++){g=0;for(var A=0;A<=y;A++)t[M+A]|=g<<b|(A<y?(g=m[k*y+A])>>>x:0);M+=v}return e.sprite=null,!0}return!1}return f.layout=function(){for(var u=function(t){t.width=t.height=1;var e=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/e,t.height=JF/e;var n=t.getContext("2d");return n.fillStyle=n.strokeStyle="red",n.textAlign="center",{context:n,ratio:e}}(jc()),f=function(t){var e=[],n=-1;for(;++n<t;)e[n]=0;return e}((s[0]>>5)*s[1]),d=null,p=l.length,g=-1,m=[],y=l.map((s=>({text:t(s),font:e(s),style:r(s),weight:i(s),rotate:o(s),size:~~(n(s)+1e-14),padding:a(s),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:s}))).sort(((t,e)=>e.size-t.size));++g<p;){var v=y[g];v.x=s[0]*(c()+.5)>>1,v.y=s[1]*(c()+.5)>>1,QF(u,v,y,g),v.hasText&&h(f,v,d)&&(m.push(v),d?tS(d,v):d=[{x:v.x+v.x0,y:v.y+v.y0},{x:v.x+v.x1,y:v.y+v.y1}],v.x-=s[0]>>1,v.y-=s[1]>>1)}return m},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(s=[+t[0],+t[1]],f):s},f.font=function(t){return arguments.length?(e=rS(t),f):e},f.fontStyle=function(t){return arguments.length?(r=rS(t),f):r},f.fontWeight=function(t){return arguments.length?(i=rS(t),f):i},f.rotate=function(t){return arguments.length?(o=rS(t),f):o},f.text=function(e){return arguments.length?(t=rS(e),f):t},f.spiral=function(t){return arguments.length?(u=iS[t]||t,f):u},f.fontSize=function(t){return arguments.length?(n=rS(t),f):n},f.padding=function(t){return arguments.length?(a=rS(t),f):a},f.random=function(t){return arguments.length?(c=t,f):c},f}function QF(t,e,n,r){if(!e.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,JF/o);var a,s,u,l,c,f=0,h=0,d=0,p=n.length;for(--r;++r<p;){if(e=n[r],i.save(),i.font=e.style+" "+e.weight+" "+~~((e.size+1)/o)+"px "+e.font,a=i.measureText(e.text+"m").width*o,u=e.size<<1,e.rotate){var g=Math.sin(e.rotate*XF),m=Math.cos(e.rotate*XF),y=a*m,v=a*g,_=u*m,x=u*g;a=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,u=~~Math.max(Math.abs(v+_),Math.abs(v-_))}else a=a+31>>5<<5;if(u>d&&(d=u),f+a>=2048&&(f=0,h+=d,d=0),h+u>=JF)break;i.translate((f+(a>>1))/o,(h+(u>>1))/o),e.rotate&&i.rotate(e.rotate*XF),i.fillText(e.text,0,0),e.padding&&(i.lineWidth=2*e.padding,i.strokeText(e.text,0,0)),i.restore(),e.width=a,e.height=u,e.xoff=f,e.yoff=h,e.x1=a>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,f+=a}for(var b=i.getImageData(0,0,2048/o,JF/o).data,w=[];--r>=0;)if((e=n[r]).hasText){for(s=(a=e.width)>>5,u=e.y1-e.y0,l=0;l<u*s;l++)w[l]=0;if(null==(f=e.xoff))return;h=e.yoff;var M=0,k=-1;for(c=0;c<u;c++){for(l=0;l<a;l++){var A=s*c+(l>>5),E=b[2048*(h+c)+(f+l)<<2]?1<<31-l%32:0;w[A]|=E,M|=E}M?k=c:(e.y0++,u--,c--,h++)}e.y1=e.y0+k,e.sprite=w.slice(0,(e.y1-e.y0)*s)}}}function KF(t,e,n){n>>=5;for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),s=127&a,u=32-s,l=t.y1-t.y0,c=(t.y+t.y0)*n+(a>>5),f=0;f<l;f++){r=0;for(var h=0;h<=o;h++)if((r<<u|(h<o?(r=i[f*o+h])>>>s:0))&e[c+h])return!0;c+=n}return!1}function tS(t,e){var n=t[0],r=t[1];e.x+e.x0<n.x&&(n.x=e.x+e.x0),e.y+e.y0<n.y&&(n.y=e.y+e.y0),e.x+e.x1>r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}function eS(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>e[0].y&&t.y+t.y0<e[1].y}function nS(t){var e=t[0]/t[1];return function(t){return[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function rS(t){return"function"==typeof t?t:function(){return t}}var iS={archimedean:nS,rectangular:function(t){var e=4*t[0]/t[1],n=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:n+=e;break;case 1:r+=4;break;case 2:n-=e;break;default:r-=4}return[n,r]}}};const oS=["x","y","font","fontSize","fontStyle","fontWeight","angle"],aS=["text","font","rotate","fontSize","fontStyle","fontWeight"];function sS(t){as.call(this,ZF(),t)}sS.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:oS}]},ct(sS,as,{transform(e,n){!e.size||e.size[0]&&e.size[1]||s("Wordcloud size dimensions must be non-zero.");const r=e.modified();if(!(r||n.changed(n.ADD_REM)||aS.some((function(t){const r=e[t];return X(r)&&n.modified(r.fields)}))))return;const i=n.materialize(n.SOURCE).source,o=this.value,a=e.as||oS;let u,l=e.fontSize||14;if(X(l)?u=e.fontSizeRange:l=et(l),u){const t=l,e=yp("sqrt")().domain(it(i,t)).range(u);l=n=>e(t(n))}i.forEach((t=>{t[a[0]]=NaN,t[a[1]]=NaN,t[a[3]]=0}));const c=o.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(l).random(t.random).layout(),f=o.size(),h=f[0]>>1,d=f[1]>>1,p=c.length;for(let t,e,n=0;n<p;++n)t=c[n],e=t.datum,e[a[0]]=t.x+h,e[a[1]]=t.y+d,e[a[2]]=t.font,e[a[3]]=t.size,e[a[4]]=t.style,e[a[5]]=t.weight,e[a[6]]=t.rotate;return n.reflow(r).modifies(a)}});var uS=Object.freeze({__proto__:null,wordcloud:sS});const lS=t=>new Uint8Array(t),cS=t=>new Uint16Array(t),fS=t=>new Uint32Array(t);function hS(t,e,n){const r=(e<257?lS:e<65537?cS:fS)(t);return n&&r.set(n),r}function dS(t,e,n){const r=1<<e;return{one:r,zero:~r,range:n.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd(t,e){const n=this,i=n.bisect(n.range,t.value),o=t.index,a=i[0],s=i[1],u=o.length;let l;for(l=0;l<a;++l)e[o[l]]|=r;for(l=s;l<u;++l)e[o[l]]|=r;return n}}}function pS(){let t=fS(0),e=[],n=0;return{insert:function(r,i,o){if(!i.length)return[];const a=n,s=i.length,u=fS(s);let l,c,f,h=Array(s);for(f=0;f<s;++f)h[f]=r(i[f]),u[f]=f;if(h=function(t,e){return t.sort.call(e,((e,n)=>{const r=t[e],i=t[n];return r<i?-1:r>i?1:0})),function(t,e){return Array.from(e,(e=>t[e]))}(t,e)}(h,u),a)l=e,c=t,e=Array(a+s),t=fS(a+s),function(t,e,n,r,i,o,a,s,u){let l,c=0,f=0;for(l=0;c<r&&f<a;++l)e[c]<i[f]?(s[l]=e[c],u[l]=n[c++]):(s[l]=i[f],u[l]=o[f++]+t);for(;c<r;++c,++l)s[l]=e[c],u[l]=n[c];for(;f<a;++f,++l)s[l]=i[f],u[l]=o[f]+t}(o,l,c,a,h,u,s,e,t);else{if(o>0)for(f=0;f<s;++f)u[f]+=o;e=h,t=u}return n=a+s,{index:u,value:h}},remove:function(r,i){const o=n;let a,s,u;for(s=0;!i[t[s]]&&s<o;++s);for(u=s;s<o;++s)i[a=t[s]]||(t[u]=a,e[u]=e[s],++u);n=o-r},bisect:function(t,r){let i;return r?i=r.length:(r=e,i=n),[te(r,t[0],0,i),te(r,t[1],0,i)]},reindex:function(e){for(let r=0,i=n;r<i;++r)t[r]=e[t[r]]},index:()=>t,size:()=>n}}function gS(t){as.call(this,function(){let t=8,e=[],n=fS(0),r=hS(0,t),i=hS(0,t);return{data:()=>e,seen:()=>n=function(t,e,n){return t.length>=e?t:((n=n||new t.constructor(e)).set(t),n)}(n,e.length),add(t){for(let n,r=0,i=e.length,o=t.length;r<o;++r)n=t[r],n._index=i++,e.push(n)},remove(t,n){const o=e.length,a=Array(o-t),s=e;let u,l,c;for(l=0;!n[l]&&l<o;++l)a[l]=e[l],s[l]=l;for(c=l;l<o;++l)u=e[l],n[l]?s[l]=-1:(s[l]=c,r[c]=r[l],i[c]=i[l],a[c]=u,u._index=c++),r[l]=0;return e=a,s},size:()=>e.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,e){r[t]|=e},clear(t,e){r[t]&=~e},resize(e,n){(e>r.length||n>t)&&(t=Math.max(n,t),r=hS(e,t,r),i=hS(e,t))}}}(),t),this._indices=null,this._dims=null}function mS(t){as.call(this,null,t)}gS.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}}]},ct(gS,as,{transform(t,e){return this._dims?t.modified("fields")||t.fields.some((t=>e.modified(t.fields)))?this.reinit(t,e):this.eval(t,e):this.init(t,e)},init(t,e){const n=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let s,u,l=0;for(;l<a;++l)s=n[l].fname,u=i[s]||(i[s]=pS()),o.push(dS(u,l,r[l]));return this.eval(t,e)},reinit(t,e){const n=e.materialize().fork(),r=t.fields,i=t.query,o=this._indices,a=this._dims,s=this.value,u=s.curr(),l=s.prev(),c=s.all(),f=n.rem=n.add,h=n.mod,d=i.length,p={};let g,m,y,v,_,x,b,w,M;if(l.set(u),e.rem.length&&(_=this.remove(t,e,n)),e.add.length&&s.add(e.add),e.mod.length)for(x={},v=e.mod,b=0,w=v.length;b<w;++b)x[v[b]._index]=1;for(b=0;b<d;++b)M=r[b],(!a[b]||t.modified("fields",b)||e.modified(M.fields))&&(y=M.fname,(g=p[y])||(o[y]=m=pS(),p[y]=g=m.insert(M,e.source,0)),a[b]=dS(m,b,i[b]).onAdd(g,u));for(b=0,w=s.data().length;b<w;++b)_[b]||(l[b]!==u[b]?f.push(b):x[b]&&u[b]!==c&&h.push(b));return s.mask=(1<<d)-1,n},eval(t,e){const n=e.materialize().fork(),r=this._dims.length;let i=0;return e.rem.length&&(this.remove(t,e,n),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,e,n)),e.add.length&&(this.insert(t,e,n),i|=(1<<r)-1),e.mod.length&&(this.modify(e,n),i|=(1<<r)-1),this.value.mask=i,n},insert(t,e,n){const r=e.add,i=this.value,o=this._dims,a=this._indices,s=t.fields,u={},l=n.add,c=i.size()+r.length,f=o.length;let h,d,p,g=i.size();i.resize(c,f),i.add(r);const m=i.curr(),y=i.prev(),v=i.all();for(h=0;h<f;++h)d=s[h].fname,p=u[d]||(u[d]=a[d].insert(s[h],r,g)),o[h].onAdd(p,m);for(;g<c;++g)y[g]=v,m[g]!==v&&l.push(g)},modify(t,e){const n=e.mod,r=this.value,i=r.curr(),o=r.all(),a=t.mod;let s,u,l;for(s=0,u=a.length;s<u;++s)l=a[s]._index,i[l]!==o&&n.push(l)},remove(t,e,n){const r=this._indices,i=this.value,o=i.curr(),a=i.prev(),s=i.all(),u={},l=n.rem,c=e.rem;let f,h,d,p;for(f=0,h=c.length;f<h;++f)d=c[f]._index,u[d]=1,a[d]=p=o[d],o[d]=s,p!==s&&l.push(d);for(d in r)r[d].remove(h,u);return this.reindex(e,h,u),u},reindex(t,e,n){const r=this._indices,i=this.value;t.runAfter((()=>{const t=i.remove(e,n);for(const e in r)r[e].reindex(t)}))},update(t,e,n){const r=this._dims,i=t.query,o=e.stamp,a=r.length;let s,u,l=0;for(n.filters=0,u=0;u<a;++u)t.modified("query",u)&&(s=u,++l);if(1===l)l=r[s].one,this.incrementOne(r[s],i[s],n.add,n.rem);else for(u=0,l=0;u<a;++u)t.modified("query",u)&&(l|=r[u].one,this.incrementAll(r[u],i[u],o,n.add),n.rem=n.add);return l},incrementAll(t,e,n,r){const i=this.value,o=i.seen(),a=i.curr(),s=i.prev(),u=t.index(),l=t.bisect(t.range),c=t.bisect(e),f=c[0],h=c[1],d=l[0],p=l[1],g=t.one;let m,y,v;if(f<d)for(m=f,y=Math.min(d,h);m<y;++m)v=u[m],o[v]!==n&&(s[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;else if(f>d)for(m=d,y=Math.min(f,p);m<y;++m)v=u[m],o[v]!==n&&(s[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;if(h>p)for(m=Math.max(f,p),y=h;m<y;++m)v=u[m],o[v]!==n&&(s[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;else if(h<p)for(m=Math.max(d,h),y=p;m<y;++m)v=u[m],o[v]!==n&&(s[v]=a[v],o[v]=n,r.push(v)),a[v]^=g;t.range=e.slice()},incrementOne(t,e,n,r){const i=this.value.curr(),o=t.index(),a=t.bisect(t.range),s=t.bisect(e),u=s[0],l=s[1],c=a[0],f=a[1],h=t.one;let d,p,g;if(u<c)for(d=u,p=Math.min(c,l);d<p;++d)g=o[d],i[g]^=h,n.push(g);else if(u>c)for(d=c,p=Math.min(u,f);d<p;++d)g=o[d],i[g]^=h,r.push(g);if(l>f)for(d=Math.max(u,f),p=l;d<p;++d)g=o[d],i[g]^=h,n.push(g);else if(l<f)for(d=Math.max(c,l),p=f;d<p;++d)g=o[d],i[g]^=h,r.push(g);t.range=e.slice()}}),mS.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."}]},ct(mS,as,{transform(t,e){const n=~(t.ignore||0),r=t.filter,i=r.mask;if(!(i&n))return e.StopPropagation;const o=e.fork(e.ALL),a=r.data(),s=r.curr(),u=r.prev(),l=t=>s[t]&n?null:a[t];return o.filter(o.MOD,l),i&i-1?(o.filter(o.ADD,(t=>{const e=s[t]&n;return!e&&e^u[t]&n?a[t]:null})),o.filter(o.REM,(t=>{const e=s[t]&n;return e&&!(0^u[t]&n)?a[t]:null}))):(o.filter(o.ADD,l),o.filter(o.REM,(t=>(s[t]&n)===i?a[t]:null))),o.filter(o.SOURCE,(t=>l(t._index)))}});var yS=Object.freeze({__proto__:null,crossfilter:gS,resolvefilter:mS});function vS(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function _S(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var xS=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),bS=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),wS=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),MS=Math.PI,kS=MS/2;function AS(t){return(1-Math.cos(MS*t))/2}function ES(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function DS(t){return((t*=2)<=1?ES(1-t):2-ES(t-1))/2}function CS(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var FS=4/11,SS=6/11,TS=8/11,$S=9/11,zS=10/11,BS=21/22,OS=7.5625;function NS(t){return(t=+t)<FS?OS*t*t:t<TS?OS*(t-=SS)*t+.75:t<zS?OS*(t-=$S)*t+.9375:OS*(t-=BS)*t+.984375}var RS=1.70158,US=function t(e){function n(t){return(t=+t)*t*(e*(t-1)+t)}return e=+e,n.overshoot=t,n}(RS),LS=function t(e){function n(t){return--t*t*((t+1)*e+t)+1}return e=+e,n.overshoot=t,n}(RS),qS=function t(e){function n(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(RS),PS=2*Math.PI,jS=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=PS);function i(t){return e*ES(- --t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*PS)},i.period=function(n){return t(e,n)},i}(1,.3),IS=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=PS);function i(t){return 1-e*ES(t=+t)*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*PS)},i.period=function(n){return t(e,n)},i}(1,.3),WS=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=PS);function i(t){return((t=2*t-1)<0?e*ES(-t)*Math.sin((r-t)/n):2-e*ES(t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*PS)},i.period=function(n){return t(e,n)},i}(1,.3);const HS="Literal",YS="Property",GS="ArrayExpression",VS="BinaryExpression",XS="CallExpression",JS="ConditionalExpression",ZS="LogicalExpression",QS="MemberExpression",KS="ObjectExpression",tT="UnaryExpression";function eT(t){this.type=t}var nT,rT,iT,oT,aT;eT.prototype.visit=function(t){let e,n,r;if(t(this))return 1;for(e=function(t){switch(t.type){case GS:return t.elements;case VS:case ZS:return[t.left,t.right];case XS:return[t.callee].concat(t.arguments);case JS:return[t.test,t.consequent,t.alternate];case QS:return[t.object,t.property];case KS:return t.properties;case YS:return[t.key,t.value];case tT:return[t.argument];default:return[]}}(this),n=0,r=e.length;n<r;++n)if(e[n].visit(t))return 1};(nT={})[1]="Boolean",nT[2]="<end>",nT[3]="Identifier",nT[4]="Keyword",nT[5]="Null",nT[6]="Numeric",nT[7]="Punctuator",nT[8]="String",nT[9]="RegularExpression";var sT="Identifier",uT="Unexpected token %0",lT="Invalid regular expression",cT="Invalid regular expression: missing /",fT="Octal literals are not allowed in strict mode.",hT="ILLEGAL",dT="Disabled.",pT=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]"),gT=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 mT(t,e){if(!t)throw new Error("ASSERT: "+e)}function yT(t){return t>=48&&t<=57}function vT(t){return"0123456789abcdefABCDEF".includes(t)}function _T(t){return"01234567".includes(t)}function xT(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].includes(t)}function bT(t){return 10===t||13===t||8232===t||8233===t}function wT(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&pT.test(String.fromCharCode(t))}function MT(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&gT.test(String.fromCharCode(t))}const kT={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 AT(){for(;iT<oT;){const t=rT.charCodeAt(iT);if(!xT(t)&&!bT(t))break;++iT}}function ET(t){var e,n,r,i=0;for(n="u"===t?4:2,e=0;e<n;++e)iT<oT&&vT(rT[iT])?(r=rT[iT++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):jT({},uT,hT);return String.fromCharCode(i)}function DT(){var t,e,n,r;for(e=0,"}"===(t=rT[iT])&&jT({},uT,hT);iT<oT&&vT(t=rT[iT++]);)e=16*e+"0123456789abcdef".indexOf(t.toLowerCase());return(e>1114111||"}"!==t)&&jT({},uT,hT),e<=65535?String.fromCharCode(e):(n=55296+(e-65536>>10),r=56320+(e-65536&1023),String.fromCharCode(n,r))}function CT(){var t,e;for(t=rT.charCodeAt(iT++),e=String.fromCharCode(t),92===t&&(117!==rT.charCodeAt(iT)&&jT({},uT,hT),++iT,(t=ET("u"))&&"\\"!==t&&wT(t.charCodeAt(0))||jT({},uT,hT),e=t);iT<oT&&MT(t=rT.charCodeAt(iT));)++iT,e+=String.fromCharCode(t),92===t&&(e=e.substr(0,e.length-1),117!==rT.charCodeAt(iT)&&jT({},uT,hT),++iT,(t=ET("u"))&&"\\"!==t&&MT(t.charCodeAt(0))||jT({},uT,hT),e+=t);return e}function FT(){var t,e;return t=iT,e=92===rT.charCodeAt(iT)?CT():function(){var t,e;for(t=iT++;iT<oT;){if(92===(e=rT.charCodeAt(iT)))return iT=t,CT();if(!MT(e))break;++iT}return rT.slice(t,iT)}(),{type:1===e.length?3:kT.hasOwnProperty(e)?4:"null"===e?5:"true"===e||"false"===e?1:3,value:e,start:t,end:iT}}function ST(){var t,e,n,r,i=iT,o=rT.charCodeAt(iT),a=rT[iT];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++iT,{type:7,value:String.fromCharCode(o),start:i,end:iT};default:if(61===(t=rT.charCodeAt(iT+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return iT+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:iT};case 33:case 61:return iT+=2,61===rT.charCodeAt(iT)&&++iT,{type:7,value:rT.slice(i,iT),start:i,end:iT}}}return">>>="===(r=rT.substr(iT,4))?{type:7,value:r,start:i,end:iT+=4}:">>>"===(n=r.substr(0,3))||"<<="===n||">>="===n?{type:7,value:n,start:i,end:iT+=3}:a===(e=n.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===e?{type:7,value:e,start:i,end:iT+=2}:("//"===e&&jT({},uT,hT),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:i,end:++iT}:void jT({},uT,hT))}function TT(){var t,e,n;if(mT(yT((n=rT[iT]).charCodeAt(0))||"."===n,"Numeric literal must start with a decimal digit or a decimal point"),e=iT,t="","."!==n){if(t=rT[iT++],n=rT[iT],"0"===t){if("x"===n||"X"===n)return++iT,function(t){let e="";for(;iT<oT&&vT(rT[iT]);)e+=rT[iT++];return 0===e.length&&jT({},uT,hT),wT(rT.charCodeAt(iT))&&jT({},uT,hT),{type:6,value:parseInt("0x"+e,16),start:t,end:iT}}(e);if(_T(n))return function(t){let e="0"+rT[iT++];for(;iT<oT&&_T(rT[iT]);)e+=rT[iT++];return(wT(rT.charCodeAt(iT))||yT(rT.charCodeAt(iT)))&&jT({},uT,hT),{type:6,value:parseInt(e,8),octal:!0,start:t,end:iT}}(e);n&&yT(n.charCodeAt(0))&&jT({},uT,hT)}for(;yT(rT.charCodeAt(iT));)t+=rT[iT++];n=rT[iT]}if("."===n){for(t+=rT[iT++];yT(rT.charCodeAt(iT));)t+=rT[iT++];n=rT[iT]}if("e"===n||"E"===n)if(t+=rT[iT++],"+"!==(n=rT[iT])&&"-"!==n||(t+=rT[iT++]),yT(rT.charCodeAt(iT)))for(;yT(rT.charCodeAt(iT));)t+=rT[iT++];else jT({},uT,hT);return wT(rT.charCodeAt(iT))&&jT({},uT,hT),{type:6,value:parseFloat(t),start:e,end:iT}}function $T(){var t,e,n,r;return aT=null,AT(),t=iT,e=function(){var t,e,n,r;for(mT("/"===(t=rT[iT]),"Regular expression literal must start with a slash"),e=rT[iT++],n=!1,r=!1;iT<oT;)if(e+=t=rT[iT++],"\\"===t)bT((t=rT[iT++]).charCodeAt(0))&&jT({},cT),e+=t;else if(bT(t.charCodeAt(0)))jT({},cT);else if(n)"]"===t&&(n=!1);else{if("/"===t){r=!0;break}"["===t&&(n=!0)}return r||jT({},cT),{value:e.substr(1,e.length-2),literal:e}}(),n=function(){var t,e,n;for(e="",n="";iT<oT&&MT((t=rT[iT]).charCodeAt(0));)++iT,"\\"===t&&iT<oT?jT({},uT,hT):(n+=t,e+=t);return n.search(/[^gimuy]/g)>=0&&jT({},lT,n),{value:n,literal:e}}(),r=function(t,e){let n=t;e.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,e)=>{if(parseInt(e,16)<=1114111)return"x";jT({},lT)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch(t){jT({},lT)}try{return new RegExp(t,e)}catch(t){return null}}(e.value,n.value),{literal:e.literal+n.literal,value:r,regex:{pattern:e.value,flags:n.value},start:t,end:iT}}function zT(){if(AT(),iT>=oT)return{type:2,start:iT,end:iT};const t=rT.charCodeAt(iT);return wT(t)?FT():40===t||41===t||59===t?ST():39===t||34===t?function(){var t,e,n,r,i="",o=!1;for(mT("'"===(t=rT[iT])||'"'===t,"String literal must starts with a quote"),e=iT,++iT;iT<oT;){if((n=rT[iT++])===t){t="";break}if("\\"===n)if((n=rT[iT++])&&bT(n.charCodeAt(0)))"\r"===n&&"\n"===rT[iT]&&++iT;else switch(n){case"u":case"x":"{"===rT[iT]?(++iT,i+=DT()):i+=ET(n);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:_T(n)?(0!==(r="01234567".indexOf(n))&&(o=!0),iT<oT&&_T(rT[iT])&&(o=!0,r=8*r+"01234567".indexOf(rT[iT++]),"0123".includes(n)&&iT<oT&&_T(rT[iT])&&(r=8*r+"01234567".indexOf(rT[iT++]))),i+=String.fromCharCode(r)):i+=n}else{if(bT(n.charCodeAt(0)))break;i+=n}}return""!==t&&jT({},uT,hT),{type:8,value:i,octal:o,start:e,end:iT}}():46===t?yT(rT.charCodeAt(iT+1))?TT():ST():yT(t)?TT():ST()}function BT(){const t=aT;return iT=t.end,aT=zT(),iT=t.end,t}function OT(){const t=iT;aT=zT(),iT=t}function NT(t,e,n){const r=new eT("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=e,r.right=n,r}function RT(t,e){const n=new eT("CallExpression");return n.callee=t,n.arguments=e,n}function UT(t){const e=new eT(sT);return e.name=t,e}function LT(t){const e=new eT("Literal");return e.value=t.value,e.raw=rT.slice(t.start,t.end),t.regex&&("//"===e.raw&&(e.raw="/(?:)/"),e.regex=t.regex),e}function qT(t,e,n){const r=new eT("MemberExpression");return r.computed="["===t,r.object=e,r.property=n,r.computed||(n.member=!0),r}function PT(t,e,n){const r=new eT("Property");return r.key=e,r.value=n,r.kind=t,r}function jT(t,e){var n,r=Array.prototype.slice.call(arguments,2),i=e.replace(/%(\d)/g,((t,e)=>(mT(e<r.length,"Message reference must be in range"),r[e])));throw(n=new Error(i)).index=iT,n.description=i,n}function IT(t){2===t.type&&jT(t,"Unexpected end of input"),6===t.type&&jT(t,"Unexpected number"),8===t.type&&jT(t,"Unexpected string"),3===t.type&&jT(t,"Unexpected identifier"),4===t.type&&jT(t,"Unexpected reserved word"),jT(t,uT,t.value)}function WT(t){const e=BT();7===e.type&&e.value===t||IT(e)}function HT(t){return 7===aT.type&&aT.value===t}function YT(t){return 4===aT.type&&aT.value===t}function GT(){const t=[];for(iT=aT.start,WT("[");!HT("]");)HT(",")?(BT(),t.push(null)):(t.push(o$()),HT("]")||WT(","));return BT(),function(t){const e=new eT("ArrayExpression");return e.elements=t,e}(t)}function VT(){iT=aT.start;const t=BT();return 8===t.type||6===t.type?(t.octal&&jT(t,fT),LT(t)):UT(t.value)}function XT(){var t,e,n;return iT=aT.start,3===(t=aT).type?(n=VT(),WT(":"),PT("init",n,o$())):2!==t.type&&7!==t.type?(e=VT(),WT(":"),PT("init",e,o$())):void IT(t)}function JT(){var t,e,n=[],r={},i=String;for(iT=aT.start,WT("{");!HT("}");)e="$"+((t=XT()).key.type===sT?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,e)?jT({},"Duplicate data property in object literal not allowed in strict mode"):r[e]=!0,n.push(t),HT("}")||WT(",");return WT("}"),function(t){const e=new eT("ObjectExpression");return e.properties=t,e}(n)}const ZT={if:1};function QT(){var t,e,n;if(HT("("))return function(){WT("(");const t=a$();return WT(")"),t}();if(HT("["))return GT();if(HT("{"))return JT();if(t=aT.type,iT=aT.start,3===t||ZT[aT.value])n=UT(BT().value);else if(8===t||6===t)aT.octal&&jT(aT,fT),n=LT(BT());else{if(4===t)throw new Error(dT);1===t?((e=BT()).value="true"===e.value,n=LT(e)):5===t?((e=BT()).value=null,n=LT(e)):HT("/")||HT("/=")?(n=LT($T()),OT()):IT(BT())}return n}function KT(){const t=[];if(WT("("),!HT(")"))for(;iT<oT&&(t.push(o$()),!HT(")"));)WT(",");return WT(")"),t}function t$(){return WT("."),function(){iT=aT.start;const t=BT();return function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t)||IT(t),UT(t.value)}()}function e$(){WT("[");const t=a$();return WT("]"),t}function n$(){const t=function(){var t;for(t=QT();;)if(HT("."))t=qT(".",t,t$());else if(HT("("))t=RT(t,KT());else{if(!HT("["))break;t=qT("[",t,e$())}return t}();if(7===aT.type&&(HT("++")||HT("--")))throw new Error(dT);return t}function r$(){var t,e;if(7!==aT.type&&4!==aT.type)e=n$();else{if(HT("++")||HT("--"))throw new Error(dT);if(HT("+")||HT("-")||HT("~")||HT("!"))t=BT(),e=r$(),e=function(t,e){const n=new eT("UnaryExpression");return n.operator=t,n.argument=e,n.prefix=!0,n}(t.value,e);else{if(YT("delete")||YT("void")||YT("typeof"))throw new Error(dT);e=n$()}}return e}function i$(t){let e=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":e=1;break;case"&&":e=2;break;case"|":e=3;break;case"^":e=4;break;case"&":e=5;break;case"==":case"!=":case"===":case"!==":e=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":e=7;break;case"<<":case">>":case">>>":e=8;break;case"+":case"-":e=9;break;case"*":case"/":case"%":e=11}return e}function o$(){var t,e;return t=function(){var t,e,n,r,i,o,a,s,u,l;if(t=aT,u=r$(),0===(i=i$(r=aT)))return u;for(r.prec=i,BT(),e=[t,aT],o=[u,r,a=r$()];(i=i$(aT))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),s=o.pop().value,u=o.pop(),e.pop(),n=NT(s,u,a),o.push(n);(r=BT()).prec=i,o.push(r),e.push(aT),n=r$(),o.push(n)}for(n=o[l=o.length-1],e.pop();l>1;)e.pop(),n=NT(o[l-1].value,o[l-2],n),l-=2;return n}(),HT("?")&&(BT(),e=o$(),WT(":"),t=function(t,e,n){const r=new eT("ConditionalExpression");return r.test=t,r.consequent=e,r.alternate=n,r}(t,e,o$())),t}function a$(){const t=o$();if(HT(","))throw new Error(dT);return t}function s$(t){iT=0,oT=(rT=t).length,aT=null,OT();const e=a$();if(2!==aT.type)throw new Error("Unexpect token after expression.");return e}var u$={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 l$(t){function e(e,n,r){return i=>function(e,n,r,i){let o=t(n[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+e+(i<0?"":0===i?"()":"("+n.slice(1).map(t).join(",")+")")}(e,i,n,r)}const n="new Date",r="String",i="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(e){e.length<3&&s("Missing arguments to clamp function."),e.length>3&&s("Too many arguments to clamp function.");const n=e.map(t);return"Math.max("+n[1]+", Math.min("+n[2]+","+n[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:n,date:e("getDate",n,0),day:e("getDay",n,0),year:e("getFullYear",n,0),month:e("getMonth",n,0),hours:e("getHours",n,0),minutes:e("getMinutes",n,0),seconds:e("getSeconds",n,0),milliseconds:e("getMilliseconds",n,0),time:e("getTime",n,0),timezoneoffset:e("getTimezoneOffset",n,0),utcdate:e("getUTCDate",n,0),utcday:e("getUTCDay",n,0),utcyear:e("getUTCFullYear",n,0),utcmonth:e("getUTCMonth",n,0),utchours:e("getUTCHours",n,0),utcminutes:e("getUTCMinutes",n,0),utcseconds:e("getUTCSeconds",n,0),utcmilliseconds:e("getUTCMilliseconds",n,0),length:e("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:e("toUpperCase",r,0),lower:e("toLowerCase",r,0),substring:e("substring",r),split:e("split",r),trim:e("trim",r,0),btoa:"btoa",atob:"atob",encodeURIComponent:"encodeURIComponent",regexp:i,test:e("test",i),if:function(e){e.length<3&&s("Missing arguments to if function."),e.length>3&&s("Too many arguments to if function.");const n=e.map(t);return"("+n[0]+"?"+n[1]+":"+n[2]+")"}}}function c$(t){const e=(t=t||{}).allowed?St(t.allowed):{},n=t.forbidden?St(t.forbidden):{},r=t.constants||u$,i=(t.functions||l$)(h),o=t.globalvar,a=t.fieldvar,u=X(o)?o:t=>`${o}["${t}"]`;let l={},c={},f=0;function h(t){if(yt(t))return t;const e=d[t.type];return null==e&&s("Unsupported type: "+t.type),e(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return f>0?i:at(n,i)?s("Illegal identifier: "+i):at(r,i)?r[i]:at(e,i)?i:(l[i]=1,u(i))},MemberExpression:t=>{const e=!t.computed,n=h(t.object);e&&(f+=1);const r=h(t.property);return n===a&&(c[function(t){const e=t&&t.length-1;return e&&('"'===t[0]&&'"'===t[e]||"'"===t[0]&&"'"===t[e])?t.slice(1,-1):t}(r)]=1),e&&(f-=1),n+(e?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&s("Illegal callee type: "+t.callee.type);const e=t.callee.name,n=t.arguments,r=at(i,e)&&i[e];return r||s("Unrecognized function: "+e),X(r)?r(n):r+"("+n.map(h).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(h).join(",")+"]",BinaryExpression:t=>"("+h(t.left)+" "+t.operator+" "+h(t.right)+")",UnaryExpression:t=>"("+t.operator+h(t.argument)+")",ConditionalExpression:t=>"("+h(t.test)+"?"+h(t.consequent)+":"+h(t.alternate)+")",LogicalExpression:t=>"("+h(t.left)+t.operator+h(t.right)+")",ObjectExpression:t=>{for(const e of t.properties){const t="Literal"===e.key.type?String(e.key.value):e.key.name;m.has(t)&&s("Illegal property: "+t)}return"{"+t.properties.map(h).join(",")+"}"},Property:t=>{f+=1;const e=h(t.key);return f-=1,e+":"+h(t.value)}};function p(t){const e={code:h(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},e}return p.functions=i,p.constants=r,p}const f$=Symbol("vega_selection_getter");function h$(t){return t.getter&&t.getter[f$]||(t.getter=l(t.field),t.getter[f$]=!0),t.getter}const d$="intersect",p$="union",g$="or",m$="and",y$="_vgsid_",v$=l(y$),_$="index:unit";function x$(t,e){for(var n,r,i=e.fields,o=e.values,a=i.length,s=0;s<a;++s)if(dt(n=h$(r=i[s])(t))&&(n=E(n)),dt(o[s])&&(o[s]=E(o[s])),_(o[s])&&dt(o[s][0])&&(o[s]=o[s].map(E)),"E"===r.type){if(_(o[s])?!o[s].includes(n):n!==o[s])return!1}else if("R"===r.type){if(!ft(n,o[s]))return!1}else if("R-RE"===r.type){if(!ft(n,o[s],!0,!1))return!1}else if("R-E"===r.type){if(!ft(n,o[s],!1,!1))return!1}else if("R-LE"===r.type){if(!ft(n,o[s],!1,!0))return!1}else if("E-LT"===r.type){if(n>=o[s])return!1}else if("E-LTE"===r.type){if(n>o[s])return!1}else if("E-GT"===r.type){if(n<=o[s])return!1}else if("E-GTE"===r.type){if(n<o[s])return!1}else if("E-VALID"===r.type){if(null===n||isNaN(n))return!1}else if("E-ONE"===r.type&&-1===o[s].indexOf(n))return!1;return!0}const b$=Xt(v$),w$=b$.left,M$=b$.right;var k$={[`${y$}_union`]:function(...t){const e=new re;for(const n of t)for(const t of n)e.add(t);return e},[`${y$}_intersect`]:function(t,...e){t=new re(t),e=e.map(Ee);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},E_union:function(t,e){if(!t.length)return e;for(var n=0,r=e.length;n<r;++n)t.includes(e[n])||t.push(e[n]);return t},E_intersect:function(t,e){return t.length?t.filter((t=>e.includes(t))):e},R_union:function(t,e){var n=E(e[0]),r=E(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?(t[0]>n&&(t[0]=n),t[1]<r&&(t[1]=r),t):[n,r]},R_intersect:function(t,e){var n=E(e[0]),r=E(e[1]);return n>r&&(n=e[1],r=e[0]),t.length?r<t[0]||t[1]<n?[]:(t[0]<n&&(t[0]=n),t[1]>r&&(t[1]=r),t):[n,r]}};function A$(t,e,n,r){e[0].type!==HS&&s("First argument to selection functions must be a string literal.");const i=e[0].value,o="unit",a="@"+o,u=":"+i;(e.length>=2&&A(e).value)!==d$||at(r,a)||(r[a]=n.getData(i).indataRef(n,o)),at(r,u)||(r[u]=n.getData(i).tuplesRef())}function E$(t){const e=this.context.data[t];return e?e.values.value:[]}const D$={easeLinear:t=>+t,easeQuad:vS,easeQuadIn:function(t){return t*t},easeQuadOut:function(t){return t*(2-t)},easeQuadInOut:vS,easeCubic:_S,easeCubicIn:function(t){return t*t*t},easeCubicOut:function(t){return--t*t*t+1},easeCubicInOut:_S,easePoly:wS,easePolyIn:xS,easePolyOut:bS,easePolyInOut:wS,easeSin:AS,easeSinIn:function(t){return 1==+t?1:1-Math.cos(t*kS)},easeSinOut:function(t){return Math.sin(t*kS)},easeSinInOut:AS,easeExp:DS,easeExpIn:function(t){return ES(1-+t)},easeExpOut:function(t){return 1-ES(t)},easeExpInOut:DS,easeCircle:CS,easeCircleIn:function(t){return 1-Math.sqrt(1-t*t)},easeCircleOut:function(t){return Math.sqrt(1- --t*t)},easeCircleInOut:CS,easeBounce:NS,easeBounceIn:function(t){return 1-NS(1-t)},easeBounceOut:NS,easeBounceInOut:function(t){return((t*=2)<=1?1-NS(1-t):NS(t-1)+1)/2},easeBack:qS,easeBackIn:US,easeBackOut:LS,easeBackInOut:qS,easeElastic:IS,easeElasticIn:jS,easeElasticOut:IS,easeElasticInOut:WS};const C$=t=>function(e,n){const r=this.context.dataflow.locale();return null===e?"null":r[t](n)(e)},F$=C$("format"),S$=C$("timeFormat"),T$=C$("utcFormat"),$$=C$("timeParse"),z$=C$("utcParse"),B$=new Date(2e3,0,1);function O$(t,e,n){return Number.isInteger(t)&&Number.isInteger(e)?(B$.setYear(2e3),B$.setMonth(t),B$.setDate(e),S$.call(this,B$,n)):""}function N$(t,e,n,r){e[0].type!==HS&&s("First argument to data functions must be a string literal.");const i=e[0].value,o=":"+i;if(!at(o,r))try{r[o]=n.getData(i).tuplesRef()}catch(t){}}function R$(t,e,n,r){if(e[0].type===HS)U$(n,r,e[0].value);else for(t in n.scales)U$(n,r,t)}function U$(t,e,n){const r="%"+n;if(!at(e,r))try{e[r]=t.scaleRef(n)}catch(t){}}function L$(t,e){if(yt(t)){const n=e.scales[t];return n&&mp(n.value)?n.value:void 0}if(X(t))return mp(t)?t:void 0}function q$(t,e,n){e.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,n._bandwidth=R$,n._range=R$,n._scale=R$;const r=e=>"_["+(e.type===HS?At("%"+e.value):At("%")+"+"+t(e))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:e=>`${r(e[0])}(${t(e[1])})`}}function P$(t,e){return function(n,r,i){if(n){const e=L$(n,(i||this).context);return e&&e.path[t](r)}return e(r)}}const j$=P$("area",(function(t){return Tw=new ee,dw(t,$w),2*Tw})),I$=P$("bounds",(function(t){var e,n,r,i,o,a,s;if(ww=bw=-(_w=xw=1/0),Cw=[],dw(t,aM),n=Cw.length){for(Cw.sort(gM),e=1,o=[r=Cw[0]];e<n;++e)mM(r,(i=Cw[e])[0])||mM(r,i[1])?(pM(r[0],i[1])>pM(r[0],r[1])&&(r[1]=i[1]),pM(i[0],r[1])>pM(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=pM(r[1],i[0]))>a&&(a=s,_w=i[0],bw=r[1])}return Cw=Fw=null,_w===1/0||xw===1/0?[[NaN,NaN],[NaN,NaN]]:[[_w,xw],[bw,ww]]})),W$=P$("centroid",(function(t){Ww=Hw=Yw=Gw=Vw=Xw=Jw=Zw=0,Qw=new ee,Kw=new ee,tM=new ee,dw(t,yM);var e=+Qw,n=+Kw,r=+tM,i=Qb(e,n,r);return i<Lb&&(e=Xw,n=Jw,r=Zw,Hw<Ub&&(e=Yw,n=Gw,r=Vw),(i=Qb(e,n,r))<Lb)?[NaN,NaN]:[Vb(n,e)*Wb,aw(r/i)*Wb]}));function H$(t,e,n){try{t[e].apply(t,["EXPRESSION"].concat([].slice.call(n)))}catch(e){t.warn(e)}return n[n.length-1]}function Y$(t){const e=t/255;return e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}function G$(t){const e=yf(t);return.2126*Y$(e.r)+.7152*Y$(e.g)+.0722*Y$(e.b)}function V$(t,e){return t===e||t!=t&&e!=e||(_(t)?!(!_(e)||t.length!==e.length)&&function(t,e){for(let n=0,r=t.length;n<r;++n)if(!V$(t[n],e[n]))return!1;return!0}(t,e):!(!x(t)||!x(e))&&X$(t,e))}function X$(t,e){for(const n in t)if(!V$(t[n],e[n]))return!1;return!0}function J$(t){return e=>X$(t,e)}const Z$={};function Q$(t){return _(t)||ArrayBuffer.isView(t)?t:null}function K$(t){return Q$(t)||(yt(t)?t:null)}const tz=t=>t.data;function ez(t,e){const n=E$.call(e,t);return n.root&&n.root.lookup||{}}const nz=()=>"undefined"!=typeof window&&window||null;function rz(t,e,n){if(!t)return[];const[r,i]=t,o=(new nm).set(r[0],r[1],i[0],i[1]);return P_(n||this.context.dataflow.scenegraph().root,o,function(t){let e=null;if(t){const n=G(t.marktype),r=G(t.markname);e=t=>(!n.length||n.some((e=>t.marktype===e)))&&(!r.length||r.some((e=>t.name===e)))}return e}(e))}const iz={random:()=>t.random(),cumulativeNormal:ws,cumulativeLogNormal:Cs,cumulativeUniform:Bs,densityNormal:bs,densityLogNormal:Ds,densityUniform:zs,quantileNormal:Ms,quantileLogNormal:Fs,quantileUniform:Os,sampleNormal:xs,sampleLogNormal:Es,sampleUniform:$s,isArray:_,isBoolean:ht,isDate:dt,isDefined:t=>void 0!==t,isNumber:gt,isObject:x,isRegExp:mt,isString:yt,isTuple:Ea,isValid:t=>null!=t&&t==t,toBoolean:Et,toDate:t=>Ct(t),toNumber:E,toString:Ft,indexof:function(t,...e){return K$(t).indexOf(...e)},join:function(t,...e){return Q$(t).join(...e)},lastindexof:function(t,...e){return K$(t).lastIndexOf(...e)},replace:function(t,e,n){return X(n)&&s("Function argument passed to replace."),yt(e)||mt(e)||s("Please pass a string or RegExp argument to replace."),String(t).replace(e,n)},reverse:function(t){return Q$(t).slice().reverse()},sort:function(t){return Q$(t).slice().sort(Z)},slice:function(t,...e){return K$(t).slice(...e)},flush:lt,lerp:_t,interpolateLinear:function(t,e){if(!_(t)||!t.length)return;const n=t.length,r=t[0],i=+e;if(1===n||!(i>0))return r;if(i>=1)return A(t);const o=i*(n-1),a=Math.floor(o),s=o-a;return s?t[a]+s*(t[a+1]-t[a]):t[a]},merge:function(){const t=[].slice.call(arguments);return t.unshift({}),rt(...t)},pad:Mt,peek:A,pluck:function(t,e){const n=Z$[e]||(Z$[e]=l(e));return _(t)?t.map(n):n(t)},span:kt,inrange:ft,truncate:Tt,rgb:yf,lab:qf,hcl:Yf,hsl:Ef,luminance:G$,contrast:function(t,e){const n=G$(t),r=G$(e);return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)},sequence:ke,format:F$,utcFormat:T$,utcParse:z$,utcOffset:Lr,utcSequence:jr,timeFormat:S$,timeParse:$$,timeOffset:Ur,timeSequence:Pr,timeUnitSpecifier:Qn,monthFormat:function(t){return O$.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return O$.call(this,t,1,"%b")},dayFormat:function(t){return O$.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return O$.call(this,0,2+t,"%a")},quarter:H,utcquarter:Y,week:nr,utcweek:dr,isoweek:rr,utcisoweek:pr,dayofyear:er,utcdayofyear:hr,warn:function(){return H$(this.context.dataflow,"warn",arguments)},info:function(){return H$(this.context.dataflow,"info",arguments)},debug:function(){return H$(this.context.dataflow,"debug",arguments)},extent:t=>it(t),inScope:function(t){const e=this.context.group;let n=!1;if(e)for(;t;){if(t===e){n=!0;break}t=t.mark.group}return n},intersect:rz,clampRange:V,pinchDistance:function(t){const e=t.touches,n=e[0].clientX-e[1].clientX,r=e[0].clientY-e[1].clientY;return Math.hypot(n,r)},pinchAngle:function(t){const e=t.touches;return Math.atan2(e[0].clientY-e[1].clientY,e[0].clientX-e[1].clientX)},screen:function(){const t=nz();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,e=t.container&&t.container();return e?[e.clientWidth,e.clientHeight]:[void 0,void 0]},windowSize:function(){const t=nz();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,e,n){return Pd(t||0,e||0,n||0)},setdata:function(t,e){const n=this.context.dataflow,r=this.context.data[t].input;return n.pulse(r,n.changeset().remove(p).insert(e)),1},pathShape:function(t){let e=null;return function(n){return n?Eg(n,e=e||gg(t)):t}},panLinear:N,panLog:R,panPow:U,panSymlog:L,zoomLinear:P,zoomLog:j,zoomPow:I,zoomSymlog:W,encode:function(t,e,n){if(t){const n=this.context.dataflow,r=t.mark.source;n.pulse(r,n.changeset().encode(t,e))}return void 0!==n?n:t},modify:function(t,e,n,r,i,o){const a=this.context.dataflow,s=this.context.data[t],u=s.input,l=a.stamp();let c,f,h=s.changes;if(!1===a._trigger||!(u.value.length||e||r))return 0;if((!h||h.stamp<l)&&(s.changes=h=a.changeset(),h.stamp=l,a.runAfter((()=>{s.modified=!0,a.pulse(u,h).run()}),!0,1)),n&&(c=!0===n?p:_(n)||Ea(n)?n:J$(n),h.remove(c)),e&&h.insert(e),r&&(c=J$(r),u.value.some(c)?h.remove(c):h.insert(r)),i){if(X(i))throw Error("modify parameter must be a data tuple, not a function");for(f in o)h.modify(i,f,o[f])}return 1},lassoAppend:function(t,e,n,r=5){const i=(t=G(t))[t.length-1];return void 0===i||Math.hypot(i[0]-e,i[1]-n)>r?[...t,[e,n]]:t},lassoPath:function(t){return G(t).reduce(((e,[n,r],i)=>e+(0==i?`M ${n},${r} `:i===t.length-1?" Z":`L ${n},${r} `)),"")},intersectLasso:function(t,e,n){const{x:r,y:i,mark:o}=n,a=(new nm).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,n]of e)t<a.x1&&(a.x1=t),t>a.x2&&(a.x2=t),n<a.y1&&(a.y1=n),n>a.y2&&(a.y2=n);return a.translate(r,i),rz([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,e,n){let r=0;for(let i=0,o=n.length-1;i<n.length;o=i++){const[a,s]=n[o],[u,l]=n[i];l>e!=s>e&&t<(a-u)*(e-l)/(s-l)+u&&r++}return 1&r}(t.x,t.y,e)))},...D$},oz=["view","item","group","xy","x","y"],az="this.",sz={},uz={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${At("$"+t)}]`,functions:function(t){const e=l$(t);oz.forEach((t=>e[t]="event.vega."+t));for(const t in iz)e[t]=az+t;return rt(e,q$(t,iz,sz)),e},constants:u$,visitors:sz},lz=c$(uz);function cz(t,e,n){return 1===arguments.length?iz[t]:(iz[t]=e,n&&(sz[t]=n),lz&&(lz.functions[t]=az+t),this)}function fz(t,e){const n={};let r;try{r=s$(t=yt(t)?t:At(t)+"")}catch(e){s("Expression parse error: "+t)}r.visit((t=>{if(t.type!==XS)return;const r=t.callee.name,i=uz.visitors[r];i&&i(r,t.arguments,e,n)}));const i=lz(r);return i.globals.forEach((t=>{const r="$"+t;!at(n,r)&&e.getSignal(t)&&(n[r]=e.signalRef(t))})),{$expr:rt({code:i.code},e.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}cz("bandwidth",(function(t,e){const n=L$(t,(e||this).context);return n&&n.bandwidth?n.bandwidth():0}),R$),cz("copy",(function(t,e){const n=L$(t,(e||this).context);return n?n.copy():void 0}),R$),cz("domain",(function(t,e){const n=L$(t,(e||this).context);return n?n.domain():[]}),R$),cz("range",(function(t,e){const n=L$(t,(e||this).context);return n&&n.range?n.range():[]}),R$),cz("invert",(function(t,e,n){const r=L$(t,(n||this).context);return r?_(e)?(r.invertRange||r.invert)(e):(r.invert||r.invertExtent)(e):void 0}),R$),cz("scale",(function(t,e,n){const r=L$(t,(n||this).context);return r?r(e):void 0}),R$),cz("gradient",(function(t,e,n,r,i){t=L$(t,(i||this).context);const o=sg(e,n);let a=t.domain(),s=a[0],u=A(a),l=f;return u-s?l=Tp(t,s,u):t=(t.interpolator?yp("sequential")().interpolator(t.interpolator()):yp("linear")().interpolate(t.interpolate()).range(t.range())).domain([s=0,u=1]),t.ticks&&(a=t.ticks(+r||15),s!==a[0]&&a.unshift(s),u!==A(a)&&a.push(u)),a.forEach((e=>o.stop(l(e),t(e)))),o}),R$),cz("geoArea",j$,R$),cz("geoBounds",I$,R$),cz("geoCentroid",W$,R$),cz("geoShape",(function(t,e,n){const r=L$(t,(n||this).context);return function(t){return r?r.path.context(t)(e):""}}),R$),cz("geoScale",(function(t,e){const n=L$(t,(e||this).context);return n&&n.scale()}),R$),cz("geoTranslate",(function(t,e){const n=L$(t,(e||this).context);return n&&n.translate()}),R$),cz("indata",(function(t,e,n){const r=this.context.data[t]["index:"+e],i=r?r.value.get(n):void 0;return i?i.count:i}),(function(t,e,n,r){e[0].type!==HS&&s("First argument to indata must be a string literal."),e[1].type!==HS&&s("Second argument to indata must be a string literal.");const i=e[0].value,o=e[1].value,a="@"+o;at(a,r)||(r[a]=n.getData(i).indataRef(n,o))})),cz("data",E$,N$),cz("treePath",(function(t,e,n){const r=ez(t,this),i=r[e],o=r[n];return i&&o?i.path(o).map(tz):void 0}),N$),cz("treeAncestors",(function(t,e){const n=ez(t,this)[e];return n?n.ancestors().map(tz):void 0}),N$),cz("vlSelectionTest",(function(t,e,n){for(var r,i,o,a,s,u=this.context.data[t],l=u?u.values.value:[],c=u?u[_$]&&u[_$].value:void 0,f=n===d$,h=l.length,d=0;d<h;++d)if(r=l[d],c&&f){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(s=x$(e,r),i[a]=s?-1:++o,s&&1===c.size)return!0;if(!s&&o===c.get(a).count)return!1}else if(f^(s=x$(e,r)))return s;return h&&f}),A$),cz("vlSelectionIdTest",(function(t,e,n){const r=this.context.data[t],i=r?r.values.value:[],o=r?r[_$]&&r[_$].value:void 0,a=n===d$,s=v$(e),u=w$(i,s);if(u===i.length)return!1;if(v$(i[u])!==s)return!1;if(o&&a){if(1===o.size)return!0;if(M$(i,s)-u<o.size)return!1}return!0}),A$),cz("vlSelectionResolve",(function(t,e,n,r){for(var i,o,a,s,u,l,c,f,h,d,p,g,m=this.context.data[t],y=m?m.values.value:[],v={},_={},x={},b=y.length,w=0;w<b;++w)if(s=(i=y[w]).unit,o=i.fields,a=i.values,o&&a){for(p=0,g=o.length;p<g;++p)u=o[p],f=(c=v[u.field]||(v[u.field]={}))[s]||(c[s]=[]),x[u.field]=h=u.type.charAt(0),d=k$[`${h}_union`],c[s]=d(f,G(a[p]));n&&(f=_[s]||(_[s]=[])).push(G(a).reduce(((t,e,n)=>(t[o[n].field]=e,t)),{}))}else u=y$,l=v$(i),(f=(c=v[u]||(v[u]={}))[s]||(c[s]=[])).push(l),n&&(f=_[s]||(_[s]=[])).push({[y$]:l});if(e=e||p$,v[y$]?v[y$]=k$[`${y$}_${e}`](...Object.values(v[y$])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((e=>v[t][e])).reduce(((n,r)=>void 0===n?r:k$[`${x[t]}_${e}`](n,r)))})),y=Object.keys(_),n&&y.length){v[r?"vlPoint":"vlMulti"]=e===p$?{[g$]:y.reduce(((t,e)=>(t.push(..._[e]),t)),[])}:{[m$]:y.map((t=>({[g$]:_[t]})))}}return v}),A$),cz("vlSelectionTuples",(function(t,e){return _(t)||s("First argument to selectionTuples must be an array."),x(e)||s("Second argument to selectionTuples must be an object."),t.map((t=>rt(e.fields?{values:e.fields.map((e=>h$(e)(t.datum)))}:{[y$]:v$(t.datum)},e)))}));const hz=St(["rule"]),dz=St(["group","image","rect"]);function pz(t){return(t+"").toLowerCase()}function gz(t,e,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...e.concat(n));return t&&t.functions?r.bind(t.functions):r}var mz={operator:(t,e)=>gz(t,["_"],e.code),parameter:(t,e)=>gz(t,["datum","_"],e.code),event:(t,e)=>gz(t,["event"],e.code),handler:(t,e)=>gz(t,["_","event"],`var datum=event.item&&event.item.datum;return ${e.code};`),encode:(t,e)=>{const{marktype:n,channels:r}=e;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const e="o["+At(t)+"]";i+=`$=${r[t].code};if(${e}!==$)${e}=$,m=1;`}return i+=function(t,e){let n="";return hz[e]||(t.x2&&(t.x?(dz[e]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),t.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(dz[e]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),t.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}(r,n),i+="return m;",gz(t,["item","_"],i)},codegen:{get(t){const e=`[${t.map(At).join("][")}]`,n=Function("_",`return _${e};`);return n.path=e,n},comparator(t,e){let n;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=e[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((n=n||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,e,n,r){return`((u = ${t}) < (v = ${e}) || u == null) && v != null ? ${n}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}\n : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return n?r.bind(n):r}}};function yz(t,e,n){if(!t||!x(t))return t;for(let r,i=0,o=vz.length;i<o;++i)if(r=vz[i],at(t,r.key))return r.parse(t,e,n);return t}var vz=[{key:"$ref",parse:function(t,e){return e.get(t.$ref)||s("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,e){const n="k:"+t.$key+"_"+!!t.$flat;return e.fn[n]||(e.fn[n]=vt(t.$key,t.$flat,e.expr.codegen))}},{key:"$expr",parse:function(t,n,r){t.$params&&n.parseParameters(t.$params,r);const i="e:"+t.$expr.code;return n.fn[i]||(n.fn[i]=e(n.parameterExpression(t.$expr),t.$fields))}},{key:"$field",parse:function(t,e){if(!t.$field)return null;const n="f:"+t.$field+"_"+t.$name;return e.fn[n]||(e.fn[n]=l(t.$field,t.$name,e.expr.codegen))}},{key:"$encode",parse:function(t,n){const r=t.$encode,i={};for(const t in r){const o=r[t];i[t]=e(n.encodeExpression(o.$expr),o.$fields),i[t].output=o.$output}return i}},{key:"$compare",parse:function(t,e){const n="c:"+t.$compare+"_"+t.$order,r=G(t.$compare).map((t=>t&&t.$tupleid?Da:t));return e.fn[n]||(e.fn[n]=J(r,t.$order,e.expr.codegen))}},{key:"$context",parse:function(t,e){return e}},{key:"$subflow",parse:function(t,e){const n=t.$subflow;return function(t,r,i){const o=e.fork().parse(n),a=o.get(n.operators[0].id),s=o.signals.parent;return s&&s.set(i),a.detachSubflow=()=>e.detach(o),a}}},{key:"$tupleid",parse:function(){return Da}}];const _z={skip:!0};function xz(t,e,n,r){return new bz(t,e,n,r)}function bz(t,e,n,r){this.dataflow=t,this.transforms=e,this.events=t.events.bind(t),this.expr=r||mz,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function wz(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.events=t.events,this.expr=t.expr,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}function Mz(t,e){t&&(null==e?t.removeAttribute("aria-label"):t.setAttribute("aria-label",e))}bz.prototype=wz.prototype={fork(){const t=new wz(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((e=>e!==t));const e=Object.keys(t.nodes);for(const n of e)t.nodes[n]._targets=null;for(const n of e)t.nodes[n].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,e){return this.nodes[t]=e},add(t,e){const n=this,r=n.dataflow,i=t.value;if(n.set(t.id,e),function(t){return"collect"===pz(t)}(t.type)&&i&&(i.$ingest?r.ingest(e,i.$ingest,i.$format):i.$request?r.preload(e,i.$request,i.$format):r.pulse(e,r.changeset().insert(i))),t.root&&(n.root=e),t.parent){let i=n.get(t.parent.$ref);i?(r.connect(i,[e]),e.targets().add(i)):(n.unresolved=n.unresolved||[]).push((()=>{i=n.get(t.parent.$ref),r.connect(i,[e]),e.targets().add(i)}))}if(t.signal&&(n.signals[t.signal]=e),t.scale&&(n.scales[t.scale]=e),t.data)for(const r in t.data){const i=n.data[r]||(n.data[r]={});t.data[r].forEach((t=>i[t]=e))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,e){this.add(t,this.dataflow.add(t.value,e))},transform(t,e){this.add(t,this.dataflow.add(this.transforms[pz(e)]))},stream(t,e){this.set(t.id,e)},update(t,e,n,r,i){this.dataflow.on(e,n,r,i,t.options)},operatorExpression(t){return this.expr.operator(this,t)},parameterExpression(t){return this.expr.parameter(this,t)},eventExpression(t){return this.expr.event(this,t)},handlerExpression(t){return this.expr.handler(this,t)},encodeExpression(t){return this.expr.encode(this,t)},parse:function(t){const e=this,n=t.operators||[];return t.background&&(e.background=t.background),t.eventConfig&&(e.eventConfig=t.eventConfig),t.locale&&(e.locale=t.locale),n.forEach((t=>e.parseOperator(t))),n.forEach((t=>e.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>e.parseStream(t))),(t.updates||[]).forEach((t=>e.parseUpdate(t))),e.resolve()},parseOperator:function(t){const e=this;!function(t){return"operator"===pz(t)}(t.type)&&t.type?e.transform(t,t.type):e.operator(t,t.update?e.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const e=this;if(t.params){const n=e.get(t.id);n||s("Invalid operator id: "+t.id),e.dataflow.connect(n,n.parameters(e.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,e){e=e||{};const n=this;for(const r in t){const i=t[r];e[r]=_(i)?i.map((t=>yz(t,n,e))):yz(i,n,e)}return e},parseStream:function(t){var e,n=this,r=null!=t.filter?n.eventExpression(t.filter):void 0,i=null!=t.stream?n.get(t.stream):void 0;t.source?i=n.events(t.source,t.type,r):t.merge&&(i=(e=t.merge.map((t=>n.get(t))))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map((t=>n.get(t))),i=i.between(e[0],e[1])),t.filter&&(i=i.filter(r)),null!=t.throttle&&(i=i.throttle(+t.throttle)),null!=t.debounce&&(i=i.debounce(+t.debounce)),null==i&&s("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),n.stream(t,i)},parseUpdate:function(t){var e,n=this,r=x(r=t.source)?r.$ref:r,i=n.get(r),o=t.update,a=void 0;i||s("Source not defined: "+t.source),e=t.target&&t.target.$expr?n.eventExpression(t.target.$expr):n.get(t.target),o&&o.$expr&&(o.$params&&(a=n.parseParameters(o.$params)),o=n.handlerExpression(o.$expr)),n.update(t,i,e,o,a)},getState:function(t){var e=this,n={};if(t.signals){var r=n.signals={};Object.keys(e.signals).forEach((n=>{const i=e.signals[n];t.signals(n,i)&&(r[n]=i.value)}))}if(t.data){var i=n.data={};Object.keys(e.data).forEach((n=>{const r=e.data[n];t.data(n,r)&&(i[n]=r.input.value)}))}return e.subcontext&&!1!==t.recurse&&(n.subcontext=e.subcontext.map((e=>e.getState(t)))),n},setState:function(t){var e=this,n=e.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{n.update(e.signals[t],i[t],_z)})),Object.keys(r||{}).forEach((t=>{n.pulse(e.data[t].input,n.changeset().remove(p).insert(r[t]))})),(t.subcontext||[]).forEach(((t,n)=>{const r=e.subcontext[n];r&&r.setState(t)}))}};const kz="default";function Az(t,e){const n=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(n)return null==e?n.style.removeProperty("cursor"):n.style.cursor=e}function Ez(t,e){var n=t._runtime.data;return at(n,e)||s("Unrecognized data set: "+e),n[e]}function Dz(t,e){Ba(e)||s("Second argument to changes must be a changeset.");const n=Ez(this,t);return n.modified=!0,this.pulse(n.input,e)}function Cz(t){var e=t.padding();return Math.max(0,t._viewWidth+e.left+e.right)}function Fz(t){var e=t.padding();return Math.max(0,t._viewHeight+e.top+e.bottom)}function Sz(t){var e=t.padding(),n=t._origin;return[e.left+n[0],e.top+n[1]]}function Tz(t,e,n){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=Sz(t),(r=pv(e.changedTouches?e.changedTouches[0]:e,a))[0]-=i[0],r[1]-=i[1]),e.dataflow=t,e.item=n,e.vega=function(t,e,n){const r=e?"group"===e.mark.marktype?e:e.mark.group:null;function i(t){var n,i=r;if(t)for(n=e;n;n=n.mark.group)if(n.mark.name===t){i=n;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return n;yt(t)&&(t=i(t));const e=n.slice();for(;t;)e[0]-=t.x||0,e[1]-=t.y||0,t=t.mark&&t.mark.group;return e}return{view:et(t),item:et(e||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,n,r),e}function $z(t){t._resizeObserver&&(t._resizeObserver.disconnect(),t._resizeObserver=null);const e=t.container(),n=t._containerListeners;if("undefined"==typeof ResizeObserver||!e||!n.length)return;let r=e.clientWidth,i=e.clientHeight;t._resizeObserver=new ResizeObserver((()=>{(e.clientWidth||e.clientHeight)&&(e.clientWidth===r&&e.clientHeight===i||(r=e.clientWidth,i=e.clientHeight,n.forEach((t=>t({type:"resize",target:e})))))})),t._resizeObserver.observe(e)}const zz="view",Bz={trap:!1};function Oz(t,e,n,r){t._eventListeners.push({type:n,sources:G(e),handler:r})}function Nz(t,e,n){const r=t._eventConfig&&t._eventConfig[e];return!(!1===r||x(r)&&!r[n])||(t.warn(`Blocked ${e} ${n} event listener.`),!1)}function Rz(t){return t.item}function Uz(t){return t.item.mark.source}function Lz(t){return function(e,n){return n.vega.view().changeset().encode(n.item,t)}}function qz(t,e,n){const r=document.createElement(t);for(const t in e)r.setAttribute(t,e[t]);return null!=n&&(r.textContent=n),r}const Pz=/^on/i;function jz(t,e,n,r){const i=n.event||"input",o=()=>t.update(e.value);r.signal(n.signal,e.value),e.addEventListener(i,o),Oz(r,e,i,o),t.set=t=>{e.value=t,e.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function Iz(t,e,n,r){const i=r.signal(n.signal),o=qz("div",{class:"vega-bind"}),a="radio"===n.input?o:o.appendChild(qz("label"));a.appendChild(qz("span",{class:"vega-bind-name"},n.name||n.signal)),e.appendChild(o);let s=Wz;switch(n.input){case"checkbox":s=Hz;break;case"select":s=Yz;break;case"radio":s=Gz;break;case"range":s=Vz}s===Wz?s(t,a,n,i,r):s(t,a,n,i)}function Wz(t,e,n,r,i){const o=qz("input");for(const t in n)Pz.test(t)?i.warn(`Ignoring unsupported signal binding property "${t}" for signal "${n.signal}".`):"signal"!==t&&"element"!==t&&o.setAttribute("input"===t?"type":t,n[t]);o.setAttribute("name",n.signal),o.value=r,e.appendChild(o),o.addEventListener("input",(()=>t.update(o.value))),t.elements=[o],t.set=t=>o.value=t}function Hz(t,e,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const o=qz("input",i);e.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function Yz(t,e,n,r){const i=qz("select",{name:n.signal}),o=n.labels||[];n.options.forEach(((t,e)=>{const n={value:t};Xz(t,r)&&(n.selected=!0),i.appendChild(qz("option",n,(o[e]||t)+""))})),e.appendChild(i),i.addEventListener("change",(()=>{t.update(n.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let e=0,r=n.options.length;e<r;++e)if(Xz(n.options[e],t))return void(i.selectedIndex=e)}}function Gz(t,e,n,r){const i=qz("span",{class:"vega-bind-radio"}),o=n.labels||[];e.appendChild(i),t.elements=n.options.map(((e,a)=>{const s={type:"radio",name:n.signal,value:e};Xz(e,r)&&(s.checked=!0);const u=qz("input",s);u.addEventListener("change",(()=>t.update(e)));const l=qz("label",{},(o[a]||e)+"");return l.prepend(u),i.appendChild(l),u})),t.set=e=>{const n=t.elements,r=n.length;for(let t=0;t<r;++t)Xz(n[t].value,e)&&(n[t].checked=!0)}}function Vz(t,e,n,r){r=void 0!==r?r:(+n.max+ +n.min)/2;const i=null!=n.max?n.max:Math.max(100,+r)||100,o=n.min||Math.min(0,i,+r)||0,a=n.step||ge(o,i,100),s=qz("input",{type:"range",name:n.signal,min:o,max:i,step:a});s.value=r;const u=qz("span",{},+r);e.appendChild(s),e.appendChild(u);const l=()=>{u.textContent=s.value,t.update(+s.value)};s.addEventListener("input",l),s.addEventListener("change",l),t.elements=[s],t.set=t=>{s.value=t,u.textContent=t}}function Xz(t,e){return t===e||t+""==e+""}function Jz(t,e,n,r,i,o){return(e=e||new r(t.loader())).initialize(n,Cz(t),Fz(t),Sz(t),i,o).background(t.background())}function Zz(t,e){return e?function(){try{e.apply(this,arguments)}catch(e){t.error(e)}}:null}function Qz(t,e,n){if("string"==typeof e){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(e=document.querySelector(e)))return t.error("Signal bind element not found: "+e),null}if(e&&n)try{e.textContent=""}catch(n){e=null,t.error(n)}return e}const Kz=t=>+t||0;function tB(t){return x(t)?{top:Kz(t.top),bottom:Kz(t.bottom),left:Kz(t.left),right:Kz(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(Kz(t))}async function eB(t,e,n,r){const i=q_(e),o=i&&i.headless;return o||s("Unrecognized renderer type: "+e),await t.runAsync(),Jz(t,null,null,o,n,r).renderAsync(t._scenegraph.root)}var nB="width",rB="height",iB="padding",oB={skip:!0};function aB(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===iB?r.left+r.right:0)}function sB(t,e){var n=t.autosize(),r=t.padding();return e-(n&&n.contains===iB?r.top+r.bottom:0)}function uB(t,e){return e.modified&&_(e.input.value)&&!t.startsWith("_:vega:_")}function lB(t,e){return!("parent"===t||e instanceof ss.proxy)}function cB(t,e,n,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":_(t)?fB(t):x(t)&&!dt(t)?(e=t,Object.keys(e).map((t=>{const n=e[t];return t+": "+(_(n)?fB(n):hB(n))})).join("\n")):t+"";var e}(r))}function fB(t){return"["+t.map(hB).join(", ")+"]"}function hB(t){return _(t)?"[…]":x(t)&&!dt(t)?"{…}":t}function dB(t,e){const n=this;if(e=e||{},is.call(n),e.loader&&n.loader(e.loader),e.logger&&n.logger(e.logger),null!=e.logLevel&&n.logLevel(e.logLevel),e.locale||t.locale){const r=rt({},t.locale,e.locale);n.locale(Vo(r.number,r.time))}n._el=null,n._elBind=null,n._renderType=e.renderer||U_.Canvas,n._scenegraph=new sv;const r=n._scenegraph.root;n._renderer=null,n._tooltip=e.tooltip||cB,n._redraw=!0,n._handler=(new Uv).scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._containerListeners=[],n._resizeObserver=null,n._eventConfig=function(t){const e=rt({defaults:{}},t),n=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=St(t[e]))}))};return n(e.defaults,["prevent","allow"]),n(e,["view","window","selector","container"]),e}(t.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=function(t,e,n){return xz(t,ss,iz,n).parse(e)}(n,t,e.expr);n._runtime=i,n._signals=i.signals,n._bind=(t.bindings||[]).map((t=>({state:null,param:rt({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=aB(n,n._width),n._viewHeight=sB(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,function(t){var e=t._signals,n=e[nB],r=e[rB],i=e[iB];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(e=>{t._width=e.size,t._viewWidth=aB(t,e.size),o()}),{size:n}),t._resizeHeight=t.add(null,(e=>{t._height=e.size,t._viewHeight=sB(t,e.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=n.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(n),function(t){t.add(null,(e=>(t._background=e.bg,t._resize=1,e.bg)),{bg:t._signals.background})}(n),function(t){const e=t._signals.cursor||(t._signals.cursor=t.add({user:kz,item:null}));t.on(t.events("view","pointermove"),e,((t,n)=>{const r=e.value,i=r?yt(r)?r:r.user:kz,o=n.item&&n.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(e){let n=e.cursor,r=this.value;return yt(n)||(r=n.item,n=n.user),Az(t,n&&n!==kz?n:r||n),r}),{cursor:e})}(n),n.description(t.description),e.hover&&n.hover(),e.container&&n.initialize(e.container,e.bind),e.watchPixelRatio&&n._watchPixelRatio()}function pB(t,e){return at(t._signals,e)?t._signals[e]:s("Unrecognized signal name: "+At(e))}function gB(t,e){const n=(t._targets||[]).filter((t=>t._update&&t._update.handler===e));return n.length?n[0]:null}function mB(t,e,n,r){let i=gB(n,r);return i||(i=Zz(t,(()=>r(e,n.value))),i.handler=r,t.on(n,null,i)),t}function yB(t,e,n){const r=gB(e,n);return r&&e._targets.remove(r),t}ct(dB,is,{async evaluate(t,e,n){if(await is.prototype.evaluate.call(this,t,e),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var e=Sz(t),n=Cz(t),r=Fz(t);t._renderer.background(t.background()),t._renderer.resize(n,r,e),t._handler.origin(e),t._resizeListeners.forEach((e=>{try{e(n,r)}catch(e){t.error(e)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return n&&Ma(this,n),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const e=null!=t?t+"":null;return e!==this._desc&&Mz(this._el,this._desc=e),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,e,n){const r=pB(this,t);return 1===arguments.length?r.value:this.update(r,e,n)},width(t){return arguments.length?this.signal("width",t):this.signal("width")},height(t){return arguments.length?this.signal("height",t):this.signal("height")},padding(t){return arguments.length?this.signal("padding",tB(t)):tB(this.signal("padding"))},autosize(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},background(t){return arguments.length?this.signal("background",t):this.signal("background")},renderer(t){return arguments.length?(q_(t)||s("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},tooltip(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},loader(t){return arguments.length?(t!==this._loader&&(is.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(pB(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,e,n,r,i,o){this.runAfter((a=>{let s=0;a._autosize=0,a.width()!==n&&(s=1,a.signal(nB,n,oB),a._resizeWidth.skip(!0)),a.height()!==r&&(s=1,a.signal(rB,r,oB),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==e&&(a._resize=1,a._viewHeight=e),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),s&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,e,n){let r=e;return n&&!1===n.trap||(r=Zz(this,e),r.raw=e),this._handler.on(t,r),this},removeEventListener(t,e){for(var n,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(r=i[o].type,n=i[o].handler,t===r&&(e===n||e===n.raw)){this._handler.off(r,n);break}return this},addResizeListener(t){const e=this._resizeListeners;return e.includes(t)||e.push(t),this},removeResizeListener(t){var e=this._resizeListeners,n=e.indexOf(t);return n>=0&&e.splice(n,1),this},addSignalListener(t,e){return mB(this,t,pB(this,t),e)},removeSignalListener(t,e){return yB(this,pB(this,t),e)},addDataListener(t,e){return mB(this,t,Ez(this,t).values,e)},removeDataListener(t,e){return yB(this,Ez(this,t).values,e)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const e=Az(this,null);this._globalCursor=!!t,e&&Az(this,e)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,e){this._timers.push(function(t,e,n){var r=new oD,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?rD():+n,r._restart((function o(a){a+=i,r._restart(o,i+=e,n),t(a)}),e,n)},r.restart(t,e,n),r)}((function(e){t({timestamp:Date.now(),elapsed:e})}),e))},events:function(t,e,n){var r,i=this,o=new Ia(n),a=function(n,r){i.runAsync(null,(()=>{t===zz&&function(t,e){var n=t._eventConfig.defaults,r=n.prevent,i=n.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[e]:i?!i[e]:t.preventDefault()))}(i,e)&&n.preventDefault(),o.receive(Tz(i,n,r))}))};if("timer"===t)Nz(i,"timer",e)&&i.timer(a,e);else if(t===zz)Nz(i,"view",e)&&i.addEventListener(e,a,Bz);else if("container"===t)"resize"!==e?i.warn("Unsupported container event type: "+e):Nz(i,"container",e)&&(i._containerListeners.push(a),i.container()&&$z(i));else if("window"===t?Nz(i,"window",e)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&Nz(i,"selector",e)&&(r=Array.from(document.querySelectorAll(t))),r){for(var s=0,u=r.length;s<u;++s)r[s].addEventListener(e,a);Oz(i,r,e,a)}else i.warn("Can not resolve event source: "+t);return o},finalize:function(){var t,e,n,r,i,o=this._tooltip,a=this._timers,s=this._handler.handlers(),u=this._eventListeners;for(t=a.length;--t>=0;)a[t].stop();for(this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),t=u.length;--t>=0;)for(e=(n=u[t]).sources.length;--e>=0;)n.sources[e].removeEventListener(n.type,n.handler);for(o&&o.call(this,this._handler,null,null,null),t=s.length;--t>=0;)i=s[t].type,r=s[t].handler,this._handler.off(i,r);return this},hover:function(t,e){return e=[e||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",Rz),Uz,Lz(t)),this.on(this.events("view","pointerout",Rz),Uz,Lz(e)),this},data:function(t,e){return arguments.length<2?Ez(this,t).values.value:Dz.call(this,t,Oa().remove(p).insert(e))},change:Dz,insert:function(t,e){return Dz.call(this,t,Oa().insert(e))},remove:function(t,e){return Dz.call(this,t,Oa().remove(e))},scale:function(t){var e=this._runtime.scales;return at(e,t)||s("Unrecognized scale or projection: "+t),e[t].value},initialize:function(t,e){const n=this,r=n._renderType,i=n._eventConfig.bind,o=q_(r);t=n._el=t?Qz(n,t,!0):null,function(t){const e=t.container();e&&(e.setAttribute("role","graphics-document"),e.setAttribute("aria-roleDescription","visualization"),Mz(e,t.description()))}(n),o||n.error("Unrecognized renderer type: "+r);const a=o.handler||Uv,s=t?o.renderer:o.headless;return n._renderer=s?Jz(n,n._renderer,t,s):null,n._handler=function(t,e,n,r){const i=new r(t.loader(),Zz(t,t.tooltip())).scene(t.scenegraph().root).initialize(n,Sz(t),t);return e&&e.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(n,n._handler,t,a),n._redraw=!0,t&&"none"!==i&&(e=e?n._elBind=Qz(n,e,!0):t.appendChild(qz("form",{class:"vega-bindings"})),n._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=Qz(n,t.param.element,!!t.param.input))})),n._bind.forEach((t=>{!function(t,e,n){if(!e)return;const r=n.param;let i=n.state;i||(i=n.state={elements:null,active:!1,set:null,update:e=>{e!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,e)}))}},r.debounce&&(i.update=nt(r.debounce,i.update))),(null==r.input&&r.element?jz:Iz)(i,e,r,t),i.active||(t.on(t._signals[r.signal],null,(()=>{i.source?i.source=!1:i.set(t.signal(r.signal))})),i.active=!0)}(n,t.element||e,t)}))),$z(n),n},toImageURL:async function(t,e){t!==U_.Canvas&&t!==U_.SVG&&t!==U_.PNG&&s("Unrecognized image type: "+t);const n=await eB(this,t,e);return t===U_.SVG?function(t,e){const n=new Blob([t],{type:e});return window.URL.createObjectURL(n)}(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")},toCanvas:async function(t,e){return(await eB(this,U_.Canvas,t,e)).canvas()},toSVG:async function(t){return(await eB(this,U_.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:uB,signals:lB,recurse:!0})},setState:function(t){return this.runAsync(null,(e=>{e._trigger=!1,e._runtime.setState(t)}),(t=>{t._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let t=null;const e=()=>{null!=t&&t();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",e),t=()=>{n.removeEventListener("change",e)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};e()}}});const vB="[",_B="]",xB=/[[\]{}]/,bB={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let wB,MB;function kB(t,e,n){return wB=e||"view",MB=n||bB,EB(t.trim()).map(DB)}function AB(t,e,n,r,i){const o=t.length;let a,s=0;for(;e<o;++e){if(a=t[e],!s&&a===n)return e;i&&i.includes(a)?--s:r&&r.includes(a)&&++s}return e}function EB(t){const e=[],n=t.length;let r=0,i=0;for(;i<n;)i=AB(t,i,",","[{","]}"),e.push(t.substring(r,i).trim()),r=++i;if(0===e.length)throw"Empty event selector: "+t;return e}function DB(t){return"["===t[0]?function(t){const e=t.length;let n,r=1;if(r=AB(t,r,_B,vB,_B),r===e)throw"Empty between selector: "+t;if(n=EB(t.substring(1,r)),2!==n.length)throw"Between selector must have two elements: "+t;if(t=t.slice(r+1).trim(),">"!==t[0])throw"Expected '>' after between selector: "+t;n=n.map(DB);const i=DB(t.slice(1).trim());if(i.between)return{between:n,stream:i};i.between=n;return i}(t):function(t){const e={source:wB},n=[];let r,i,o=[0,0],a=0,s=0,u=t.length,l=0;if("}"===t[u-1]){if(l=t.lastIndexOf("{"),!(l>=0))throw"Unmatched right brace: "+t;try{o=function(t){const e=t.split(",");if(!t.length||e.length>2)throw t;return e.map((e=>{const n=+e;if(n!=n)throw t;return n}))}(t.substring(l+1,u-1))}catch(e){throw"Invalid throttle specification: "+t}u=(t=t.slice(0,l).trim()).length,l=0}if(!u)throw t;"@"===t[0]&&(a=++l);r=AB(t,l,":"),r<u&&(n.push(t.substring(s,r).trim()),s=l=++r);if(l=AB(t,l,vB),l===u)n.push(t.substring(s,u).trim());else if(n.push(t.substring(s,l).trim()),i=[],s=++l,s===u)throw"Unmatched left bracket: "+t;for(;l<u;){if(l=AB(t,l,_B),l===u)throw"Unmatched left bracket: "+t;if(i.push(t.substring(s,l).trim()),l<u-1&&t[++l]!==vB)throw"Expected left bracket: "+t;s=++l}if(!(u=n.length)||xB.test(n[u-1]))throw"Invalid event selector: "+t;u>1?(e.type=n[1],a?e.markname=n[0].slice(1):!function(t){return MB[t]}(n[0])?e.source=n[0]:e.marktype=n[0]):e.type=n[0];"!"===e.type.slice(-1)&&(e.consume=!0,e.type=e.type.slice(0,-1));null!=i&&(e.filter=i);o[0]&&(e.throttle=o[0]);o[1]&&(e.debounce=o[1]);return e}(t)}function CB(t){return x(t)?t:{type:t||"pad"}}const FB=t=>+t||0;function SB(t){return x(t)?t.signal?t:{top:FB(t.top),bottom:FB(t.bottom),left:FB(t.left),right:FB(t.right)}:{top:e=FB(t),bottom:e,left:e,right:e};var e}const TB=t=>x(t)&&!_(t)?rt({},t):{value:t};function $B(t,e,n,r){if(null!=n){return x(n)&&!_(n)||_(n)&&n.length&&x(n[0])?t.update[e]=n:t[r||"enter"][e]={value:n},1}return 0}function zB(t,e,n){for(const n in e)$B(t,n,e[n]);for(const e in n)$B(t,e,n[e],"update")}function BB(t,e,n){for(const r in e)n&&at(n,r)||(t[r]=rt(t[r]||{},e[r]));return t}function OB(t,e){return e&&(e.enter&&e.enter[t]||e.update&&e.update[t])}const NB="mark",RB="frame",UB="scope",LB="legend-label",qB="title-text",PB="title-subtitle";function jB(t,e,n){t[e]=n&&n.signal?{signal:n.signal}:{value:n}}const IB=t=>yt(t)?At(t):t.signal?`(${t.signal})`:GB(t);function WB(t){if(null!=t.gradient)return function(t){const e=[t.start,t.stop,t.count].map((t=>null==t?null:At(t)));for(;e.length&&null==A(e);)e.pop();return e.unshift(IB(t.gradient)),`gradient(${e.join(",")})`}(t);let e=t.signal?`(${t.signal})`:t.color?function(t){return t.c?HB("hcl",t.h,t.c,t.l):t.h||t.s?HB("hsl",t.h,t.s,t.l):t.l||t.a?HB("lab",t.l,t.a,t.b):t.r||t.g||t.b?HB("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?GB(t.field):void 0!==t.value?At(t.value):void 0;return null!=t.scale&&(e=function(t,e){const n=IB(t.scale);null!=t.range?e=`lerp(_range(${n}), ${+t.range})`:(void 0!==e&&(e=`_scale(${n}, ${e})`),t.band&&(e=(e?e+"+":"")+`_bandwidth(${n})`+(1==+t.band?"":"*"+YB(t.band)),t.extra&&(e=`(datum.extra ? _scale(${n}, datum.extra.value) : ${e})`)),null==e&&(e="0"));return e}(t,e)),void 0===e&&(e=null),null!=t.exponent&&(e=`pow(${e},${YB(t.exponent)})`),null!=t.mult&&(e+=`*${YB(t.mult)}`),null!=t.offset&&(e+=`+${YB(t.offset)}`),t.round&&(e=`round(${e})`),e}const HB=(t,e,n,r)=>`(${t}(${[e,n,r].map(WB).join(",")})+'')`;function YB(t){return x(t)?"("+WB(t)+")":t}function GB(t){return VB(x(t)?t:{datum:t})}function VB(t){let e,n,r;if(t.signal)e="datum",r=t.signal;else if(t.group||t.parent){for(n=Math.max(1,t.level||1),e="item";n-- >0;)e+=".mark.group";t.parent?(r=t.parent,e+=".datum"):r=t.group}else t.datum?(e="datum",r=t.datum):s("Invalid field reference: "+At(t));return t.signal||(r=yt(r)?u(r).map(At).join("]["):VB(r)),e+"["+r+"]"}function XB(t,e,n,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,e,n,r,i){const o={},a={};let s,u,l,c;for(u in u="lineBreak","text"!==e||null==i[u]||OB(u,t)||jB(o,u,i[u]),("legend"==n||String(n).startsWith("axis"))&&(n=null),c=n===RB?i.group:n===NB?rt({},i.mark,i[e]):null,c)l=OB(u,t)||("fill"===u||"stroke"===u)&&(OB("fill",t)||OB("stroke",t)),l||jB(o,u,c[u]);for(u in G(r).forEach((e=>{const n=i.style&&i.style[e];for(const e in n)OB(e,t)||jB(o,e,n[e])})),t=rt({},t),o)c=o[u],c.signal?(s=s||{})[u]=c:a[u]=c;return t.enter=rt(a,t.enter),s&&(t.update=rt(s,t.update)),t}(t,e,n,r,i.config);for(const n in t)a[n]=JB(t[n],e,o,i);return o}function JB(t,e,n,r){const i={},o={};for(const e in t)null!=t[e]&&(i[e]=ZB((a=t[e],_(a)?function(t){let e="";return t.forEach((t=>{const n=WB(t);e+=t.test?`(${t.test})?${n}:`:n})),":"===A(e)&&(e+="null"),e}(a):WB(a)),r,n,o));var a;return{$expr:{marktype:e,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function ZB(t,e,n,r){const i=fz(t,e);return i.$fields.forEach((t=>r[t]=1)),rt(n,i.$params),i.$expr}const QB=["value","update","init","react","bind"];function KB(t,e){s(t+' for "outer" push: '+At(e))}function tO(t,e){const n=t.name;if("outer"===t.push)e.signals[n]||KB("No prior signal definition",n),QB.forEach((e=>{void 0!==t[e]&&KB("Invalid property ",e)}));else{const r=e.addSignal(n,t.value);!1===t.react&&(r.react=!1),t.bind&&e.addBinding(n,t.bind)}}function eO(t,e,n,r){this.id=-1,this.type=t,this.value=e,this.params=n,r&&(this.parent=r)}function nO(t,e,n,r){return new eO(t,e,n,r)}function rO(t,e){return nO("operator",t,e)}function iO(t){const e={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(e),e}function oO(t,e){return e?{$field:t,$name:e}:{$field:t}}const aO=oO("key");function sO(t,e){return{$compare:t,$order:e}}function uO(t,e){return(t&&t.signal?"$"+t.signal:t||"")+(t&&e?"_":"")+(e&&e.signal?"$"+e.signal:e?.replace(/\W+/g,"_").replace(/^_+|_+$/g,"")||"")}const lO="scope",cO="view";function fO(t){return t&&t.signal}function hO(t){if(fO(t))return!0;if(x(t))for(const e in t)if(hO(t[e]))return!0;return!1}function dO(t,e){return null!=t?t:e}function pO(t){return t&&t.signal||t}const gO="timer";function mO(t,e){return(t.merge?yO:t.stream?vO:t.type?_O:s("Invalid stream specification: "+At(t)))(t,e)}function yO(t,e){const n=xO({merge:t.merge.map((t=>mO(t,e)))},t,e);return e.addStream(n).id}function vO(t,e){const n=xO({stream:mO(t.stream,e)},t,e);return e.addStream(n).id}function _O(t,e){let n;t.type===gO?(n=e.event(gO,t.throttle),t={between:t.between,filter:t.filter}):n=e.event(function(t){return t===lO?cO:t||cO}(t.source),t.type);const r=xO({stream:n},t,e);return 1===Object.keys(r).length?n:e.addStream(r).id}function xO(t,e,n){let r=e.between;return r&&(2!==r.length&&s('Stream "between" parameter must have 2 entries: '+At(e)),t.between=[mO(r[0],n),mO(r[1],n)]),r=e.filter?[].concat(e.filter):[],(e.marktype||e.markname||e.markrole)&&r.push(function(t,e,n){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(e?"&&"+r+".mark.name==='"+e+"'":"")}(e.marktype,e.markname,e.markrole)),e.source===lO&&r.push("inScope(event.item)"),r.length&&(t.filter=fz("("+r.join(")&&(")+")",n).$expr),null!=(r=e.throttle)&&(t.throttle=+r),null!=(r=e.debounce)&&(t.debounce=+r),e.consume&&(t.consume=!0),t}const bO={code:"_.$value",ast:{type:"Identifier",value:"value"}};function wO(t,e,n){const r=t.encode,i={target:n};let o=t.events,a=t.update,u=[];o||s("Signal update missing events specification."),yt(o)&&(o=kB(o,e.isSubscope()?lO:cO)),o=G(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[MO(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&s("Signal encode and update are mutually exclusive."),a="encode(item(),"+At(r)+")"),i.update=yt(a)?fz(a,e):null!=a.expr?fz(a.expr,e):null!=a.value?a.value:null!=a.signal?{$expr:bO,$params:{$value:e.signalRef(a.signal)}}:s("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>e.addUpdate(rt(function(t,e){return{source:t.signal?e.signalRef(t.signal):t.scale?e.scaleRef(t.scale):mO(t,e)}}(t,e),i))))}function MO(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const kO=t=>(e,n,r)=>nO(t,n,e||void 0,r),AO=kO("aggregate"),EO=kO("axisticks"),DO=kO("bound"),CO=kO("collect"),FO=kO("compare"),SO=kO("datajoin"),TO=kO("encode"),$O=kO("expression"),zO=kO("facet"),BO=kO("field"),OO=kO("key"),NO=kO("legendentries"),RO=kO("load"),UO=kO("mark"),LO=kO("multiextent"),qO=kO("multivalues"),PO=kO("overlap"),jO=kO("params"),IO=kO("prefacet"),WO=kO("projection"),HO=kO("proxy"),YO=kO("relay"),GO=kO("render"),VO=kO("scale"),XO=kO("sieve"),JO=kO("sortitems"),ZO=kO("viewlayout"),QO=kO("values");let KO=0;const tN={min:"min",max:"max",count:"sum"};function eN(t,e){const n=e.getScale(t.name).params;let r;for(r in n.domain=oN(t.domain,t,e),null!=t.range&&(n.range=dN(t,e,n)),null!=t.interpolate&&function(t,e){e.interpolate=nN(t.type||t),null!=t.gamma&&(e.interpolateGamma=nN(t.gamma))}(t.interpolate,n),null!=t.nice&&(n.nice=function(t,e){return t.signal?e.signalRef(t.signal):x(t)?{interval:nN(t.interval),step:nN(t.step)}:nN(t)}(t.nice,e)),null!=t.bins&&(n.bins=function(t,e){return t.signal||_(t)?rN(t,e):e.objectProperty(t)}(t.bins,e)),t)at(n,r)||"name"===r||(n[r]=nN(t[r],e))}function nN(t,e){return x(t)?t.signal?e.signalRef(t.signal):s("Unsupported object: "+At(t)):t}function rN(t,e){return t.signal?e.signalRef(t.signal):t.map((t=>nN(t,e)))}function iN(t){s("Can not find data set: "+At(t))}function oN(t,e,n){if(t)return t.signal?n.signalRef(t.signal):(_(t)?aN:t.fields?uN:sN)(t,e,n);null==e.domainMin&&null==e.domainMax||s("No scale domain defined for domainMin/domainMax to override.")}function aN(t,e,n){return t.map((t=>nN(t,n)))}function sN(t,e,n){const r=n.getData(t.data);return r||iN(t.data),bp(e.type)?r.valuesRef(n,t.field,cN(t.sort,!1)):Ep(e.type)?r.domainRef(n,t.field):r.extentRef(n,t.field)}function uN(t,e,n){const r=t.data,i=t.fields.reduce(((t,e)=>(e=yt(e)?{data:r,field:e}:_(e)||e.signal?function(t,e){const n="_:vega:_"+KO++,r=CO({});if(_(t)&&!t.some(fO))r.value={$ingest:t};else{const i=_(t)?"["+t.map((t=>fO(t)?t.signal:At(t))).join(",")+"]":t.signal,o="setdata("+At(n)+","+i+")";r.params.input=e.signalRef(o)}return e.addDataPipeline(n,[r,XO({})]),{data:n,field:"data"}}(e,n):e,t.push(e),t)),[]);return(bp(e.type)?lN:Ep(e.type)?fN:hN)(t,n,i)}function lN(t,e,n){const r=cN(t.sort,!0);let i,o;const a=n.map((t=>{const n=e.getData(t.data);return n||iN(t.data),n.countsRef(e,t.field,r)})),s={groupby:aO,pulse:a};r&&(i=r.op||"count",o=r.field?uO(i,r.field):"count",s.ops=[tN[i]],s.fields=[e.fieldRef(o)],s.as=[o]),i=e.add(AO(s));const u=e.add(CO({pulse:iO(i)}));return o=e.add(QO({field:aO,sort:e.sortRef(r),pulse:iO(u)})),iO(o)}function cN(t,e){return t&&(t.field||t.op?t.field||"count"===t.op?e&&t.field&&t.op&&!tN[t.op]&&s("Multiple domain scales can not be sorted using "+t.op):s("No field provided for sort aggregate op: "+t.op):x(t)?t.field="key":t={field:"key"}),t}function fN(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||iN(t.data),n.domainRef(e,t.field)}));return iO(e.add(qO({values:r})))}function hN(t,e,n){const r=n.map((t=>{const n=e.getData(t.data);return n||iN(t.data),n.extentRef(e,t.field)}));return iO(e.add(LO({extents:r})))}function dN(t,e,n){const r=e.config.range;let i=t.range;if(i.signal)return e.signalRef(i.signal);if(yt(i)){if(r&&at(r,i))return dN(t=rt({},t,{range:r[i]}),e,n);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=bp(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:s("Unrecognized scale range value: "+At(i))}else{if(i.scheme)return n.scheme=_(i.scheme)?rN(i.scheme,e):nN(i.scheme,e),i.extent&&(n.schemeExtent=rN(i.extent,e)),void(i.count&&(n.schemeCount=nN(i.count,e)));if(i.step)return void(n.rangeStep=nN(i.step,e));if(bp(t.type)&&!_(i))return oN(i,t,e);_(i)||s("Unsupported range type: "+At(i))}return i.map((t=>(_(t)?rN:nN)(t,e)))}function pN(t,e,n){return _(t)?t.map((t=>pN(t,e,n))):x(t)?t.signal?n.signalRef(t.signal):"fit"===e?t:s("Unsupported parameter object: "+At(t)):t}const gN="top",mN="left",yN="right",vN="bottom",_N="center",xN="index",bN="label",wN="perc",MN="value",kN="guide-label",AN="guide-title",EN="group-title",DN="group-subtitle",CN="symbol",FN="gradient",SN="discrete",TN="size",$N=[TN,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],zN={name:1,style:1,interactive:1},BN={value:0},ON={value:1},NN="group",RN="rect",UN="rule",LN="text";function qN(t){return t.type=NN,t.interactive=t.interactive||!1,t}function PN(t,e){const n=(n,r)=>dO(t[n],dO(e[n],r));return n.isVertical=n=>"vertical"===dO(t.direction,e.direction||(n?e.symbolDirection:e.gradientDirection)),n.gradientLength=()=>dO(t.gradientLength,e.gradientLength||e.gradientWidth),n.gradientThickness=()=>dO(t.gradientThickness,e.gradientThickness||e.gradientHeight),n.entryColumns=()=>dO(t.columns,dO(e.columns,+n.isVertical(!0))),n}function jN(t,e){const n=e&&(e.update&&e.update[t]||e.enter&&e.enter[t]);return n&&n.signal?n:n?n.value:null}function IN(t,e,n){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${e} : ${n}`}const WN=IN(At(mN),At(yN),At(_N));function HN(t,e){return e?t?x(t)?Object.assign({},t,{offset:HN(t.offset,e)}):{value:t,offset:e}:e:t}function YN(t,e){return e?(t.name=e.name,t.style=e.style||t.style,t.interactive=!!e.interactive,t.encode=BB(t.encode,e,zN)):t.interactive=!1,t}function GN(t,e,n,r){const i=PN(t,n),o=i.isVertical(),a=i.gradientThickness(),s=i.gradientLength();let u,l,c,f,h;o?(l=[0,1],c=[0,0],f=a,h=s):(l=[0,0],c=[1,0],f=s,h=a);const d={enter:u={opacity:BN,x:BN,y:BN,width:TB(f),height:TB(h)},update:rt({},u,{opacity:ON,fill:{gradient:e,start:l,stop:c}}),exit:{opacity:BN}};return zB(d,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),YN({type:RN,role:"legend-gradient",encode:d},r)}function VN(t,e,n,r,i){const o=PN(t,n),a=o.isVertical(),s=o.gradientThickness(),u=o.gradientLength();let l,c,f,h,d="";a?(l="y",f="y2",c="x",h="width",d="1-"):(l="x",f="x2",c="y",h="height");const p={opacity:BN,fill:{scale:e,field:MN}};p[l]={signal:d+"datum."+wN,mult:u},p[c]=BN,p[f]={signal:d+"datum.perc2",mult:u},p[h]=TB(s);const g={enter:p,update:rt({},p,{opacity:ON}),exit:{opacity:BN}};return zB(g,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),YN({type:RN,role:"legend-band",key:MN,from:i,encode:g},r)}const XN=`datum.${wN}<=0?"${mN}":datum.${wN}>=1?"${yN}":"${_N}"`,JN=`datum.${wN}<=0?"${vN}":datum.${wN}>=1?"${gN}":"middle"`;function ZN(t,e,n,r){const i=PN(t,e),o=i.isVertical(),a=TB(i.gradientThickness()),s=i.gradientLength();let u,l,c,f,h=i("labelOverlap"),d="";const p={enter:u={opacity:BN},update:l={opacity:ON,text:{field:bN}},exit:{opacity:BN}};return zB(p,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:dO(t.labelLimit,e.gradientLabelLimit)}),o?(u.align={value:"left"},u.baseline=l.baseline={signal:JN},c="y",f="x",d="1-"):(u.align=l.align={signal:XN},u.baseline={value:"top"},c="x",f="y"),u[c]=l[c]={signal:d+"datum."+wN,mult:s},u[f]=l[f]=a,a.offset=dO(t.labelOffset,e.gradientLabelOffset)||0,h=h?{separation:i("labelSeparation"),method:h,order:"datum."+xN}:void 0,YN({type:LN,role:LB,style:kN,key:MN,from:r,encode:p,overlap:h},n)}function QN(t,e,n,r,i){const o=PN(t,e),a=n.entries,s=!(!a||!a.interactive),u=a?a.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},h=`(${i}) ? datum.offset : datum.${TN}`,d=l?TB(l):{field:TN},p=`datum.${xN}`,g=`max(1, ${i})`;let m,y,v,_,x;d.mult=.5,m={enter:y={opacity:BN,x:{signal:h,mult:.5,offset:c},y:d},update:v={opacity:ON,x:y.x,y:y.y},exit:{opacity:BN}};let b=null,w=null;t.fill||(b=e.symbolBaseFillColor,w=e.symbolBaseStrokeColor),zB(m,{fill:o("symbolFillColor",b),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",w),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),$N.forEach((e=>{t[e]&&(v[e]=y[e]={scale:t[e],field:MN})}));const M=YN({type:"symbol",role:"legend-symbol",key:MN,from:f,clip:!!l||void 0,encode:m},n.symbols),k=TB(c);k.offset=o("labelOffset"),m={enter:y={opacity:BN,x:{signal:h,offset:k},y:d},update:v={opacity:ON,text:{field:bN},x:y.x,y:y.y},exit:{opacity:BN}},zB(m,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=YN({type:LN,role:LB,style:kN,key:MN,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:BN,height:l?TB(l):BN,opacity:BN},exit:{opacity:BN},update:v={opacity:ON,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(_=`ceil(item.mark.items.length / ${g})`,v.row.signal=`${p}%${_}`,v.column.signal=`floor(${p} / ${_})`,x={field:["row",p]}):(v.row.signal=`floor(${p} / ${g})`,v.column.signal=`${p} % ${g}`,x={field:p}),v.column.signal=`(${i})?${v.column.signal}:${p}`,qN({role:UB,from:r={facet:{data:r,name:"value",groupby:xN}},encode:BB(m,a,zN),marks:[M,A],name:u,interactive:s,sort:x})}const KN='item.orient === "left"',tR='item.orient === "right"',eR=`(${KN} || ${tR})`,nR=`datum.vgrad && ${eR}`,rR=IN('"top"','"bottom"','"middle"'),iR=`datum.vgrad && ${tR} ? (${IN('"right"','"left"','"center"')}) : (${eR} && !(datum.vgrad && ${KN})) ? "left" : ${WN}`,oR=`item._anchor || (${eR} ? "middle" : "start")`,aR=`${nR} ? (${KN} ? -90 : 90) : 0`,sR=`${eR} ? (datum.vgrad ? (${tR} ? "bottom" : "top") : ${rR}) : "top"`;function uR(t,e){let n;return x(t)&&(t.signal?n=t.signal:t.path?n="pathShape("+lR(t.path)+")":t.sphere&&(n="geoShape("+lR(t.sphere)+', {type: "Sphere"})')),n?e.signalRef(n):!!t}function lR(t){return x(t)&&t.signal?t.signal:At(t)}function cR(t){const e=t.role||"";return e.startsWith("axis")||e.startsWith("legend")||e.startsWith("title")?e:t.type===NN?UB:e||NB}function fR(t){return{marktype:t.type,name:t.name||void 0,role:t.role||cR(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function hR(t,e){return t&&t.signal?e.signalRef(t.signal):!1!==t}function dR(t,e){const n=us(t.type);n||s("Unrecognized transform type: "+At(t.type));const r=nO(n.type.toLowerCase(),null,pR(n,t,e));return t.signal&&e.addSignal(t.signal,e.proxy(r)),r.metadata=n.metadata||{},r}function pR(t,e,n){const r={},i=t.params.length;for(let o=0;o<i;++o){const i=t.params[o];r[i.name]=gR(i,e,n)}return r}function gR(t,e,n){const r=t.type,i=e[t.name];return"index"===r?function(t,e,n){yt(e.from)||s('Lookup "from" parameter must be a string literal.');return n.getData(e.from).lookupRef(n,e.key)}(0,e,n):void 0!==i?"param"===r?function(t,e,n){const r=e[t.name];return t.array?(_(r)||s("Expected an array of sub-parameters. Instead: "+At(r)),r.map((e=>yR(t,e,n)))):yR(t,r,n)}(t,e,n):"projection"===r?n.projectionRef(e[t.name]):t.array&&!fO(i)?i.map((e=>mR(t,e,n))):mR(t,i,n):void(t.required&&s("Missing required "+At(e.type)+" parameter: "+At(t.name)))}function mR(t,e,n){const r=t.type;if(fO(e))return bR(r)?s("Expression references can not be signals."):wR(r)?n.fieldRef(e):MR(r)?n.compareRef(e):n.signalRef(e.signal);{const i=t.expr||wR(r);return i&&vR(e)?n.exprRef(e.expr,e.as):i&&_R(e)?oO(e.field,e.as):bR(r)?fz(e,n):xR(r)?iO(n.getData(e).values):wR(r)?oO(e):MR(r)?n.compareRef(e):e}}function yR(t,e,n){const r=t.params.length;let i;for(let n=0;n<r;++n){i=t.params[n];for(const t in i.key)if(i.key[t]!==e[t]){i=null;break}if(i)break}i||s("Unsupported parameter: "+At(e));const o=rt(pR(i,e,n),i.key);return iO(n.add(jO(o)))}const vR=t=>t&&t.expr,_R=t=>t&&t.field,xR=t=>"data"===t,bR=t=>"expr"===t,wR=t=>"field"===t,MR=t=>"compare"===t;function kR(t,e){return t.$ref?t:t.data&&t.data.$ref?t.data:iO(e.getData(t.data).output)}function AR(t,e,n,r,i){this.scope=t,this.input=e,this.output=n,this.values=r,this.aggregate=i,this.index={}}function ER(t){return yt(t)?t:null}function DR(t,e,n){const r=uO(n.op,n.field);let i;if(e.ops){for(let t=0,n=e.as.length;t<n;++t)if(e.as[t]===r)return}else e.ops=["count"],e.fields=[null],e.as=["count"];n.op&&(e.ops.push((i=n.op.signal)?t.signalRef(i):n.op),e.fields.push(t.fieldRef(n.field)),e.as.push(r))}function CR(t,e,n,r,i,o,a){const s=e[n]||(e[n]={}),u=function(t){return x(t)?("descending"===t.order?"-":"+")+uO(t.op,t.field):""}(o);let l,c,f=ER(i);if(null!=f&&(t=e.scope,f+=u?"|"+u:"",l=s[f]),!l){const n=o?{field:aO,pulse:e.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:iO(e.output)};u&&(n.sort=t.sortRef(o)),c=t.add(nO(r,void 0,n)),a&&(e.index[i]=c),l=iO(c),null!=f&&(s[f]=l)}return l}function FR(t,e,n){const r=t.remove,i=t.insert,o=t.toggle,a=t.modify,s=t.values,u=e.add(rO()),l=fz("if("+t.trigger+',modify("'+n+'",'+[i,r,o,a,s].map((t=>null==t?"null":t)).join(",")+"),0)",e);u.update=l.$expr,u.params=l.$params}function SR(t,e){const n=cR(t),r=t.type===NN,i=t.from&&t.from.facet,o=t.overlap;let a,u,l,c,f,h,d,p=t.layout||n===UB||n===RB;const g=n===NB||p||i,m=function(t,e,n){let r,i,o,a,u;return t?(r=t.facet)&&(e||s("Only group marks can be faceted."),null!=r.field?a=u=kR(r,n):(t.data?u=iO(n.getData(t.data).aggregate):(o=dR(rt({type:"aggregate",groupby:G(r.groupby)},r.aggregate),n),o.params.key=n.keyRef(r.groupby),o.params.pulse=kR(r,n),a=u=iO(n.add(o))),i=n.keyRef(r.groupby,!0))):a=iO(n.add(CO(null,[{}]))),a||(a=kR(t,n)),{key:i,pulse:a,parent:u}}(t.from,r,e);u=e.add(SO({key:m.key||(t.key?oO(t.key):void 0),pulse:m.pulse,clean:!r}));const y=iO(u);u=l=e.add(CO({pulse:y})),u=e.add(UO({markdef:fR(t),interactive:hR(t.interactive,e),clip:uR(t.clip,e),context:{$context:!0},groups:e.lookup(),parent:e.signals.parent?e.signalRef("parent"):null,index:e.markpath(),pulse:iO(u)}));const v=iO(u);u=c=e.add(TO(XB(t.encode,t.type,n,t.style,e,{mod:!1,pulse:v}))),u.params.parent=e.encode(),t.transform&&t.transform.forEach((t=>{const n=dR(t,e),r=n.metadata;(r.generates||r.changes)&&s("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),n.params.pulse=iO(u),e.add(u=n)})),t.sort&&(u=e.add(JO({sort:e.compareRef(t.sort),pulse:iO(u)})));const _=iO(u);(i||p)&&(p=e.add(ZO({layout:e.objectProperty(t.layout),legends:e.legends,mark:v,pulse:_})),h=iO(p));const x=e.add(DO({mark:v,pulse:h||_}));d=iO(x),r&&(g&&(a=e.operators,a.pop(),p&&a.pop()),e.pushState(_,h||d,y),i?function(t,e,n){const r=t.from.facet,i=r.name,o=kR(r,e);let a;r.name||s("Facet must have a name: "+At(r)),r.data||s("Facet must reference a data set: "+At(r)),r.field?a=e.add(IO({field:e.fieldRef(r.field),pulse:o})):r.groupby?a=e.add(zO({key:e.keyRef(r.groupby),group:iO(e.proxy(n.parent)),pulse:o})):s("Facet must specify groupby or field: "+At(r));const u=e.fork(),l=u.add(CO()),c=u.add(XO({pulse:iO(l)}));u.addData(i,new AR(u,l,l,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,e,m):g?function(t,e,n){const r=e.add(IO({pulse:n.pulse})),i=e.fork();i.add(XO()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,e,m):e.parse(t),e.popState(),g&&(p&&a.push(p),a.push(x))),o&&(d=function(t,e,n){const r=t.method,i=t.bound,o=t.separation,a={separation:fO(o)?n.signalRef(o.signal):o,method:fO(r)?n.signalRef(r.signal):r,pulse:e};t.order&&(a.sort=n.compareRef({field:t.order}));if(i){const t=i.tolerance;a.boundTolerance=fO(t)?n.signalRef(t.signal):+t,a.boundScale=n.scaleRef(i.scale),a.boundOrient=i.orient}return iO(n.add(PO(a)))}(o,d,e));const b=e.add(GO({pulse:d})),w=e.add(XO({pulse:iO(b)},void 0,e.parent()));null!=t.name&&(f=t.name,e.addData(f,new AR(e,l,b,w)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&s("Marks only support modify triggers."),FR(t,e,f)})))}function TR(t,e){const n=e.config.legend,r=t.encode||{},i=PN(t,n),o=r.legend||{},a=o.name||void 0,u=o.interactive,l=o.style,c={};let f,h,d,p=0;$N.forEach((e=>t[e]?(c[e]=t[e],p=p||t[e]):0)),p||s("Missing valid scale for legend.");const g=function(t,e){let n=t.type||CN;t.type||1!==function(t){return $N.reduce(((e,n)=>e+(t[n]?1:0)),0)}(t)||!t.fill&&!t.stroke||(n=xp(e)?FN:wp(e)?SN:CN);return n!==FN?n:wp(e)?SN:FN}(t,e.scaleType(p)),m={title:null!=t.title,scales:c,type:g,vgrad:"symbol"!==g&&i.isVertical()},y=iO(e.add(CO(null,[m]))),v=iO(e.add(NO(h={type:g,scale:e.scaleRef(p),count:e.objectProperty(i("tickCount")),limit:e.property(i("symbolLimit")),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)})));return g===FN?(d=[GN(t,p,n,r.gradient),ZN(t,n,r.labels,v)],h.count=h.count||e.signalRef(`max(2,2*floor((${pO(i.gradientLength())})/100))`)):g===SN?d=[VN(t,p,n,r.gradient,v),ZN(t,n,r.labels,v)]:(f=function(t,e){const n=PN(t,e);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}(t,n),d=[QN(t,n,r,v,pO(f.columns))],h.size=function(t,e,n){const r=pO(zR("size",t,n)),i=pO(zR("strokeWidth",t,n)),o=pO(function(t,e,n){return jN("fontSize",t)||function(t,e,n){const r=e.config.style[n];return r&&r[t]}("fontSize",e,n)}(n[1].encode,e,kN));return fz(`max(ceil(sqrt(${r})+${i}),${o})`,e)}(t,e,d[0].marks)),d=[qN({role:"legend-entry",from:y,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:f,interactive:u})],m.title&&d.push(function(t,e,n,r){const i=PN(t,e),o={enter:{opacity:BN},update:{opacity:ON,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:BN}};return zB(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:oR},angle:{signal:aR},align:{signal:iR},baseline:{signal:sR},text:t.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),YN({type:LN,role:"legend-title",style:AN,from:r,encode:o},n)}(t,n,r.title,y)),SR(qN({role:"legend",from:y,encode:BB($R(i,t,n),o,zN),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:l}),e)}function $R(t,e,n){const r={enter:{},update:{}};return zB(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:t("legendX"),y:t("legendY"),format:e.format,formatType:e.formatType}),r}function zR(t,e,n){return e[t]?`scale("${e[t]}",datum)`:jN(t,n[0].encode)}AR.fromEntries=function(t,e){const n=e.length,r=e[n-1],i=e[n-2];let o=e[0],a=null,s=1;for(o&&"load"===o.type&&(o=e[1]),t.add(e[0]);s<n;++s)e[s].params.pulse=iO(e[s-1]),t.add(e[s]),"aggregate"===e[s].type&&(a=e[s]);return new AR(t,o,i,r,a)},AR.prototype={countsRef(t,e,n){const r=this,i=r.counts||(r.counts={}),o=ER(e);let a,s,u;return null!=o&&(t=r.scope,a=i[o]),a?n&&n.field&&DR(t,a.agg.params,n):(u={groupby:t.fieldRef(e,"key"),pulse:iO(r.output)},n&&n.field&&DR(t,u,n),s=t.add(AO(u)),a=t.add(CO({pulse:iO(s)})),a={agg:s,ref:iO(a)},null!=o&&(i[o]=a)),a.ref},tuplesRef(){return iO(this.values)},extentRef(t,e){return CR(t,this,"extent","extent",e,!1)},domainRef(t,e){return CR(t,this,"domain","values",e,!1)},valuesRef(t,e,n){return CR(t,this,"vals","values",e,n||!0)},lookupRef(t,e){return CR(t,this,"lookup","tupleindex",e,!1)},indataRef(t,e){return CR(t,this,"indata","tupleindex",e,!0,!0)}};const BR=`item.orient==="${mN}"?-90:item.orient==="${yN}"?90:0`;function OR(t,e){const n=PN(t=yt(t)?{text:t}:t,e.config.title),r=t.encode||{},i=r.group||{},o=i.name||void 0,a=i.interactive,s=i.style,u=[],l=iO(e.add(CO(null,[{}])));return u.push(function(t,e,n,r){const i={value:0},o=t.text,a={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return zB(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("color"),font:e("font"),fontSize:e("fontSize"),fontStyle:e("fontStyle"),fontWeight:e("fontWeight"),lineHeight:e("lineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),YN({type:LN,role:qB,style:EN,from:r,encode:a},n)}(t,n,function(t){const e=t.encode;return e&&e.title||rt({name:t.name,interactive:t.interactive,style:t.style},e)}(t),l)),t.subtitle&&u.push(function(t,e,n,r){const i={value:0},o=t.subtitle,a={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return zB(a,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:e("dx"),dy:e("dy"),fill:e("subtitleColor"),font:e("subtitleFont"),fontSize:e("subtitleFontSize"),fontStyle:e("subtitleFontStyle"),fontWeight:e("subtitleFontWeight"),lineHeight:e("subtitleLineHeight")},{align:e("align"),angle:e("angle"),baseline:e("baseline")}),YN({type:LN,role:PB,style:DN,from:r,encode:a},n)}(t,n,r.subtitle,l)),SR(qN({role:"title",from:l,encode:NR(n,i),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:a,style:s}),e)}function NR(t,e){const n={enter:{},update:{}};return zB(n,{orient:t("orient"),anchor:t("anchor"),align:{signal:WN},angle:{signal:BR},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),BB(n,e,zN)}function RR(t,e){const n=[];t.transform&&t.transform.forEach((t=>{n.push(dR(t,e))})),t.on&&t.on.forEach((n=>{FR(n,e,t.name)})),e.addDataPipeline(t.name,function(t,e,n){const r=[];let i,o,a,s,u,l=null,c=!1,f=!1;t.values?fO(t.values)||hO(t.format)?(r.push(LR(e,t)),r.push(l=UR())):r.push(l=UR({$ingest:t.values,$format:t.format})):t.url?hO(t.url)||hO(t.format)?(r.push(LR(e,t)),r.push(l=UR())):r.push(l=UR({$request:t.url,$format:t.format})):t.source&&(l=i=G(t.source).map((t=>iO(e.getData(t).output))),r.push(null));for(o=0,a=n.length;o<a;++o)s=n[o],u=s.metadata,l||u.source||r.push(l=UR()),r.push(s),u.generates&&(f=!0),u.modifies&&!f&&(c=!0),u.source?l=s:u.changes&&(l=null);i&&(a=i.length-1,r[0]=YO({derive:c,pulse:a?i:i[0]}),(c||a)&&r.splice(1,0,UR()));l||r.push(UR());return r.push(XO({})),r}(t,e,n))}function UR(t){const e=CO({},t);return e.metadata={source:!0},e}function LR(t,e){return RO({url:e.url?t.property(e.url):void 0,async:e.async?t.property(e.async):void 0,values:e.values?t.property(e.values):void 0,format:t.objectProperty(e.format)})}const qR=t=>t===vN||t===gN,PR=(t,e,n)=>fO(t)?GR(t.signal,e,n):t===mN||t===gN?e:n,jR=(t,e,n)=>fO(t)?HR(t.signal,e,n):qR(t)?e:n,IR=(t,e,n)=>fO(t)?YR(t.signal,e,n):qR(t)?n:e,WR=(t,e,n)=>fO(t)?VR(t.signal,e,n):t===gN?{value:e}:{value:n},HR=(t,e,n)=>JR(`${t} === '${gN}' || ${t} === '${vN}'`,e,n),YR=(t,e,n)=>JR(`${t} !== '${gN}' && ${t} !== '${vN}'`,e,n),GR=(t,e,n)=>QR(`${t} === '${mN}' || ${t} === '${gN}'`,e,n),VR=(t,e,n)=>QR(`${t} === '${gN}'`,e,n),XR=(t,e,n)=>QR(`${t} === '${yN}'`,e,n),JR=(t,e,n)=>(e=null!=e?TB(e):e,n=null!=n?TB(n):n,ZR(e)&&ZR(n)?{signal:`${t} ? (${e=e?e.signal||At(e.value):null}) : (${n=n?n.signal||At(n.value):null})`}:[rt({test:t},e)].concat(n||[])),ZR=t=>null==t||1===Object.keys(t).length,QR=(t,e,n)=>({signal:`${t} ? (${tU(e)}) : (${tU(n)})`}),KR=(t,e,n,r,i)=>({signal:(null!=r?`${t} === '${mN}' ? (${tU(r)}) : `:"")+(null!=n?`${t} === '${vN}' ? (${tU(n)}) : `:"")+(null!=i?`${t} === '${yN}' ? (${tU(i)}) : `:"")+(null!=e?`${t} === '${gN}' ? (${tU(e)}) : `:"")+"(null)"}),tU=t=>fO(t)?t.signal:null==t?null:At(t),eU=(t,e)=>{const n=t.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+e.signal}:t};function nU(t,e,n,r){let i;if(e&&at(e,t))return e[t];if(at(n,t))return n[t];if(t.startsWith("title")){switch(t){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=t[5].toLowerCase()+t.slice(6)}return r[AN][i]}if(t.startsWith("label")){switch(t){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=t[5].toLowerCase()+t.slice(6)}return r[kN][i]}return null}function rU(t){const e={};for(const n of t)if(n)for(const t in n)e[t]=1;return Object.keys(e)}function iU(t,e){return{scale:t.scale,range:e}}function oU(t,e,n,r,i){const o=PN(t,e),a=t.orient,s=t.gridScale,u=PR(a,1,-1),l=function(t,e){if(1===e);else if(x(t)){let n=t=rt({},t);for(;null!=n.mult;){if(!x(n.mult))return n.mult=fO(e)?{signal:`(${n.mult}) * (${e.signal})`}:n.mult*e,t;n=n.mult=rt({},n.mult)}n.mult=e}else t=fO(e)?{signal:`(${e.signal}) * (${t||0})`}:e*(t||0);return t}(t.offset,u);let c,f,h;const d={enter:c={opacity:BN},update:h={opacity:ON},exit:f={opacity:BN}};zB(d,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const p={scale:t.scale,field:MN,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},g=jR(a,{signal:"height"},{signal:"width"}),m=s?{scale:s,range:0,mult:u,offset:l}:{value:0,offset:l},y=s?{scale:s,range:1,mult:u,offset:l}:rt(g,{mult:u,offset:l});return c.x=h.x=jR(a,p,m),c.y=h.y=IR(a,p,m),c.x2=h.x2=IR(a,y),c.y2=h.y2=jR(a,y),f.x=jR(a,p),f.y=IR(a,p),YN({type:UN,role:"axis-grid",key:MN,from:r,encode:d},n)}function aU(t,e,n,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+e+","+n+","+r+","+i+")"}}function sU(t,e,n,r,i,o){const a=PN(t,e),s=t.orient,u=t.scale,l=PR(s,-1,1),c=pO(a("labelFlush")),f=pO(a("labelFlushOffset")),h=a("labelAlign"),d=a("labelBaseline");let p,g=0===c||!!c;const m=TB(i);m.mult=l,m.offset=TB(a("labelPadding")||0),m.offset.mult=l;const y={scale:u,field:MN,band:.5,offset:HN(o.offset,a("labelOffset"))},v=jR(s,g?aU(u,c,'"left"','"right"','"center"'):{value:"center"},((t,e,n)=>fO(t)?XR(t.signal,e,n):t===yN?{value:e}:{value:n})(s,"left","right")),_=jR(s,WR(s,"bottom","top"),g?aU(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=aU(u,c,`-(${f})`,f,0);g=g&&f;const b={opacity:BN,x:jR(s,y,m),y:IR(s,y,m)},w={enter:b,update:p={opacity:ON,text:{field:bN},x:b.x,y:b.y,align:v,baseline:_},exit:{opacity:BN,x:b.x,y:b.y}};zB(w,{dx:!h&&g?jR(s,x):null,dy:!d&&g?IR(s,x):null}),zB(w,{angle:a("labelAngle"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontWeight:a("labelFontWeight"),fontStyle:a("labelFontStyle"),limit:a("labelLimit"),lineHeight:a("labelLineHeight")},{align:h,baseline:d});const M=a("labelBound");let k=a("labelOverlap");return k=k||M?{separation:a("labelSeparation"),method:k,order:"datum.index",bound:M?{scale:u,orient:s,tolerance:M}:null}:void 0,p.align!==v&&(p.align=eU(p.align,v)),p.baseline!==_&&(p.baseline=eU(p.baseline,_)),YN({type:LN,role:"axis-label",style:kN,key:MN,from:r,encode:w,overlap:k},n)}function uU(t,e,n,r){const i=PN(t,e),o=t.orient,a=PR(o,-1,1);let s,u;const l={enter:s={opacity:BN,anchor:TB(i("titleAnchor",null)),align:{signal:WN}},update:u=rt({},s,{opacity:ON,text:TB(t.title)}),exit:{opacity:BN}},c={signal:`lerp(range("${t.scale}"), ${IN(0,1,.5)})`};return u.x=jR(o,c),u.y=IR(o,c),s.angle=jR(o,BN,((t,e)=>0===e?0:fO(t)?{signal:`(${t.signal}) * ${e}`}:{value:t*e})(a,90)),s.baseline=jR(o,WR(o,vN,gN),{value:vN}),u.angle=s.angle,u.baseline=s.baseline,zB(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),function(t,e,n,r){const i=(t,e)=>null!=t?(n.update[e]=eU(TB(t),n.update[e]),!1):!OB(e,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");n.enter.auto=a===o?TB(a):jR(e,TB(a),TB(o))}(i,o,l,n),l.update.align=eU(l.update.align,s.align),l.update.angle=eU(l.update.angle,s.angle),l.update.baseline=eU(l.update.baseline,s.baseline),YN({type:LN,role:"axis-title",style:AN,from:r,encode:l},n)}function lU(t,e){const n=function(t,e){var n,r,i,o=e.config,a=o.style,s=o.axis,u="band"===e.scaleType(t.scale)&&o.axisBand,l=t.orient;if(fO(l)){const t=rU([o.axisX,o.axisY]),e=rU([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(n={},t))n[i]=jR(l,nU(i,o.axisX,s,a),nU(i,o.axisY,s,a));for(i of(r={},e))r[i]=KR(l.signal,nU(i,o.axisTop,s,a),nU(i,o.axisBottom,s,a),nU(i,o.axisLeft,s,a),nU(i,o.axisRight,s,a))}else n=l===gN||l===vN?o.axisX:o.axisY,r=o["axis"+l[0].toUpperCase()+l.slice(1)];return n||r||u?rt({},s,n,r,u):s}(t,e),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,s=i.style,u=PN(t,n),l=function(t){const e=t("tickBand");let n,r,i=t("tickOffset");return e?e.signal?(n={signal:`(${e.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${e.signal}) === 'extent'`},x(i)||(i={signal:`(${e.signal}) === 'extent' ? 0 : ${i}`})):"extent"===e?(n=1,r=!0,i=0):(n=.5,r=!1):(n=t("bandPosition"),r=t("tickExtra")),{extra:r,band:n,offset:i}}(u),c={scale:t.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:null!=t.title},f=iO(e.add(CO({},[c]))),h=iO(e.add(EO({scale:e.scaleRef(t.scale),extra:e.property(l.extra),count:e.objectProperty(t.tickCount),values:e.objectProperty(t.values),minstep:e.property(t.tickMinStep),formatType:e.property(t.formatType),formatSpecifier:e.property(t.format)}))),d=[];let p;return c.grid&&d.push(oU(t,n,r.grid,h,l)),c.ticks&&(p=u("tickSize"),d.push(function(t,e,n,r,i,o){const a=PN(t,e),s=t.orient,u=PR(s,-1,1);let l,c,f;const h={enter:l={opacity:BN},update:f={opacity:ON},exit:c={opacity:BN}};zB(h,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const d=TB(i);d.mult=u;const p={scale:t.scale,field:MN,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=l.y=jR(s,BN,p),f.y2=l.y2=jR(s,d),c.x=jR(s,p),f.x=l.x=IR(s,BN,p),f.x2=l.x2=IR(s,d),c.y=IR(s,p),YN({type:UN,role:"axis-tick",key:MN,from:r,encode:h},n)}(t,n,r.ticks,h,p,l))),c.labels&&(p=c.ticks?p:0,d.push(sU(t,n,r.labels,h,p,l))),c.domain&&d.push(function(t,e,n,r){const i=PN(t,e),o=t.orient;let a,s;const u={enter:a={opacity:BN},update:s={opacity:ON},exit:{opacity:BN}};zB(u,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=iU(t,0),c=iU(t,1);return a.x=s.x=jR(o,l,BN),a.x2=s.x2=jR(o,c),a.y=s.y=IR(o,l,BN),a.y2=s.y2=IR(o,c),YN({type:UN,role:"axis-domain",from:r,encode:u},n)}(t,n,r.domain,f)),c.title&&d.push(uU(t,n,r.title,f)),SR(qN({role:"axis",from:f,encode:BB(cU(u,t),i,zN),marks:d,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:o,interactive:a,style:s}),e)}function cU(t,e){const n={enter:{},update:{}};return zB(n,{orient:t("orient"),offset:t("offset")||0,position:dO(e.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${e.scale}")))`},translate:t("translate"),format:e.format,formatType:e.formatType}),n}function fU(t,e,n){const r=G(t.signals),i=G(t.scales);return n||r.forEach((t=>tO(t,e))),G(t.projections).forEach((t=>function(t,e){const n=e.config.projection||{},r={};for(const n in t)"name"!==n&&(r[n]=pN(t[n],n,e));for(const t in n)null==r[t]&&(r[t]=pN(n[t],t,e));e.addProjection(t.name,r)}(t,e))),i.forEach((t=>function(t,e){const n=t.type||"linear";vp(n)||s("Unrecognized scale type: "+At(n)),e.addScale(t.name,{type:n,domain:void 0})}(t,e))),G(t.data).forEach((t=>RR(t,e))),i.forEach((t=>eN(t,e))),(n||r).forEach((t=>function(t,e){const n=e.getSignal(t.name);let r=t.update;t.init&&(r?s("Signals can not include both init and update expressions."):(r=t.init,n.initonly=!0)),r&&(r=fz(r,e),n.update=r.$expr,n.params=r.$params),t.on&&t.on.forEach((t=>wO(t,e,n.id)))}(t,e))),G(t.axes).forEach((t=>lU(t,e))),G(t.marks).forEach((t=>SR(t,e))),G(t.legends).forEach((t=>TR(t,e))),t.title&&OR(t.title,e),e.parseLambdas(),e}function hU(t,e){const n=e.config,r=iO(e.root=e.add(rO())),i=function(t,e){const n=n=>dO(t[n],e[n]),r=[dU("background",n("background")),dU("autosize",CB(n("autosize"))),dU("padding",SB(n("padding"))),dU("width",n("width")||0),dU("height",n("height")||0)],i=r.reduce(((t,e)=>(t[e.name]=e,t)),{}),o={};return G(t.signals).forEach((t=>{at(i,t.name)?t=rt(i[t.name],t):r.push(t),o[t.name]=t})),G(e.signals).forEach((t=>{at(o,t.name)||at(i,t.name)||r.push(t)})),r}(t,n);i.forEach((t=>tO(t,e))),e.description=t.description||n.description,e.eventConfig=n.events,e.legends=e.objectProperty(n.legend&&n.legend.layout),e.locale=n.locale;const o=e.add(CO()),a=e.add(TO(XB((t=>BB({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),NN,RB,t.style,e,{pulse:iO(o)}))),s=e.add(ZO({layout:e.objectProperty(t.layout),legends:e.legends,autosize:e.signalRef("autosize"),mark:r,pulse:iO(a)}));e.operators.pop(),e.pushState(iO(a),iO(s),null),fU(t,e,i),e.operators.push(s);let u=e.add(DO({mark:r,pulse:iO(s)}));return u=e.add(GO({pulse:iO(u)})),u=e.add(XO({pulse:iO(u)})),e.addData("root",new AR(e,o,o,u)),e}function dU(t,e){return e&&e.signal?{name:t,update:e.signal}:{name:t,value:e}}function pU(t,e){this.config=t||{},this.options=e||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function gU(t){this.config=t.config,this.options=t.options,this.legends=t.legends,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}function mU(t){return(_(t)?yU:vU)(t)}function yU(t){const e=t.length;let n="[";for(let r=0;r<e;++r){const e=t[r];n+=(r>0?",":"")+(x(e)?e.signal||mU(e):At(e))}return n+"]"}function vU(t){let e,n,r="{",i=0;for(e in t)n=t[e],r+=(++i>1?",":"")+At(e)+":"+(x(n)?n.signal||mU(n):At(n));return r+"}"}pU.prototype=gU.prototype={parse(t){return fU(t,this)},fork(){return new gU(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach((e=>{e.$ref=t.id})),t.refs=null),t},proxy(t){const e=t instanceof eO?iO(t):t;return this.add(HO({value:e}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,e;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function n(t,e,n){let r,i;t&&(r=t.data||(t.data={}),i=r[e]||(r[e]=[]),i.push(n))}for(t in this.data){e=this.data[t],n(e.input,t,"input"),n(e.output,t,"output"),n(e.values,t,"values");for(const r in e.index)n(e.index[r],t,"index:"+r)}return this},pushState(t,e,n){this._encode.push(iO(this.add(XO({pulse:t})))),this._parent.push(e),this._lookup.push(n?iO(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return A(this._parent)},encode(){return A(this._encode)},lookup(){return A(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,e){if(yt(t))return oO(t,e);t.signal||s("Unsupported field reference: "+At(t));const n=t.signal;let r=this.field[n];if(!r){const t={name:this.signalRef(n)};e&&(t.as=e),this.field[n]=r=iO(this.add(BO(t)))}return r},compareRef(t){let e=!1;const n=t=>fO(t)?(e=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(e=!0,this.exprRef(t.expr)):t,r=G(t.field).map(n),i=G(t.order).map(n);return e?iO(this.add(FO({fields:r,orders:i}))):sO(r,i)},keyRef(t,e){let n=!1;const r=this.signals;return t=G(t).map((t=>fO(t)?(n=!0,iO(r[t.signal])):t)),n?iO(this.add(OO({fields:t,flat:e}))):function(t,e){const n={$key:t};return e&&(n.$flat=!0),n}(t,e)},sortRef(t){if(!t)return t;const e=uO(t.op,t.field),n=t.order||"ascending";return n.signal?iO(this.add(FO({fields:e,orders:this.signalRef(n.signal)}))):sO(e,n)},event(t,e){const n=t+":"+e;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:t,type:e}),this.events[n]=r}return this.events[n]},hasOwnSignal(t){return at(this.signals,t)},addSignal(t,e){this.hasOwnSignal(t)&&s("Duplicate signal name: "+At(t));const n=e instanceof eO?e:this.add(rO(e));return this.signals[t]=n},getSignal(t){return this.signals[t]||s("Unrecognized signal name: "+At(t)),this.signals[t]},signalRef(t){return this.signals[t]?iO(this.signals[t]):(at(this.lambdas,t)||(this.lambdas[t]=this.add(rO(null))),iO(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let e=0,n=t.length;e<n;++e){const n=t[e],r=fz(n,this),i=this.lambdas[n];i.params=r.$params,i.update=r.$expr}},property(t){return t&&t.signal?this.signalRef(t.signal):t},objectProperty(t){return t&&x(t)?this.signalRef(t.signal||mU(t)):t},exprRef(t,e){const n={expr:fz(t,this)};return e&&(n.expr.$name=e),iO(this.add($O(n)))},addBinding(t,e){this.bindings||s("Nested signals do not support binding: "+At(t)),this.bindings.push(rt({signal:t},e))},addScaleProj(t,e){at(this.scales,t)&&s("Duplicate scale or projection name: "+At(t)),this.scales[t]=this.add(e)},addScale(t,e){this.addScaleProj(t,VO(e))},addProjection(t,e){this.addScaleProj(t,WO(e))},getScale(t){return this.scales[t]||s("Unrecognized scale name: "+At(t)),this.scales[t]},scaleRef(t){return iO(this.getScale(t))},scaleType(t){return this.getScale(t).params.type},projectionRef(t){return this.scaleRef(t)},projectionType(t){return this.scaleType(t)},addData(t,e){return at(this.data,t)&&s("Duplicate data set name: "+At(t)),this.data[t]=e},getData(t){return this.data[t]||s("Undefined data set name: "+At(t)),this.data[t]},addDataPipeline(t,e){return at(this.data,t)&&s("Duplicate data set name: "+At(t)),this.addData(t,AR.fromEntries(this,e))}},rt(ss,Cl,ab,Rb,DE,AD,cF,jC,gF,VF,uS,yS);t.Bounds=nm,t.CanvasHandler=Uv,t.CanvasRenderer=Hv,t.DATE=Pn,t.DAY=jn,t.DAYOFYEAR=In,t.Dataflow=is,t.Debug=4,t.DisallowedObjectProperties=m,t.Error=1,t.EventStream=Ia,t.Gradient=sg,t.GroupItem=im,t.HOURS=Wn,t.Handler=gv,t.HybridHandler=B_,t.HybridRenderer=z_,t.ISOWEEK=qn,t.Info=3,t.Item=rm,t.MILLISECONDS=Gn,t.MINUTES=Hn,t.MONTH=Un,t.Marks=Ky,t.MultiPulse=Ka,t.None=0,t.Operator=qa,t.Parameters=Ra,t.Pulse=Xa,t.QUARTER=Rn,t.RenderType=U_,t.Renderer=yv,t.ResourceLoader=om,t.SECONDS=Yn,t.SVGHandler=Gv,t.SVGRenderer=v_,t.SVGStringRenderer=T_,t.Scenegraph=sv,t.TIME_UNITS=Vn,t.Transform=as,t.View=dB,t.WEEK=Ln,t.Warn=2,t.YEAR=Nn,t.accessor=e,t.accessorFields=r,t.accessorName=n,t.array=G,t.ascending=Z,t.bandwidthNRD=ds,t.bin=ps,t.bootstrapCI=gs,t.boundClip=Y_,t.boundContext=Em,t.boundItem=tv,t.boundMark=nv,t.boundStroke=um,t.changeset=Oa,t.clampRange=V,t.codegenExpression=c$,t.compare=J,t.constant=et,t.cumulativeLogNormal=Cs,t.cumulativeNormal=ws,t.cumulativeUniform=Bs,t.dayofyear=er,t.debounce=nt,t.defaultLocale=Xo,t.definition=us,t.densityLogNormal=Ds,t.densityNormal=bs,t.densityUniform=zs,t.detectTimeUnits=si,t.domChild=fv,t.domClear=hv,t.domCreate=lv,t.domFind=cv,t.dotbin=ms,t.error=s,t.expressionFunction=cz,t.extend=rt,t.extent=it,t.extentIndex=ot,t.falsy=g,t.fastmap=ut,t.field=l,t.flush=lt,t.font=Hy,t.fontFamily=Wy,t.fontSize=Ly,t.format=ma,t.formatLocale=Po,t.formats=ya,t.hasOwnProperty=at,t.id=c,t.identity=f,t.inferType=la,t.inferTypes=ca,t.ingest=Fa,t.inherits=ct,t.inrange=ft,t.interpolate=$p,t.interpolateColors=Fp,t.interpolateRange=Cp,t.intersect=P_,t.intersectBoxLine=Rm,t.intersectPath=zm,t.intersectPoint=Bm,t.intersectRule=Nm,t.isArray=_,t.isBoolean=ht,t.isDate=dt,t.isFunction=X,t.isIterable=pt,t.isNumber=gt,t.isObject=x,t.isRegExp=mt,t.isString=yt,t.isTuple=Ea,t.isoweek=rr,t.key=vt,t.lerp=_t,t.lineHeight=qy,t.loader=xa,t.locale=Vo,t.logger=v,t.lruCache=xt,t.markup=c_,t.merge=bt,t.mergeConfig=w,t.multiLineOffset=jy,t.one=d,t.pad=Mt,t.panLinear=N,t.panLog=R,t.panPow=U,t.panSymlog=L,t.parse=function(t,e,n){return x(t)||s("Input Vega specification must be an object."),hU(t,new pU(e=w(function(){const t="sans-serif",e="#4c78a8",n="#000",r="#888",i="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:e},area:{fill:e},image:null,line:{stroke:e,strokeWidth:2},path:{stroke:e},rect:{fill:e},rule:{stroke:n},shape:{stroke:e},symbol:{fill:e,size:64},text:{fill:n,font:t,fontSize:11},trail:{fill:e,size:2},style:{"guide-label":{fill:n,font:t,fontSize:10},"guide-title":{fill:n,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:n,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:n,font:t,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:i},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:r,grid:!1,gridWidth:1,gridColor:i,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:r,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:i,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:r,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"]}}}(),e,t.config),n)).toRuntime()},t.parseExpression=s$,t.parseSelector=kB,t.path=Vl,t.pathCurves=lg,t.pathEqual=V_,t.pathParse=gg,t.pathRectangle=Lg,t.pathRender=Eg,t.pathSymbols=Sg,t.pathTrail=qg,t.peek=A,t.point=pv,t.projection=XA,t.quantileLogNormal=Fs,t.quantileNormal=Ms,t.quantileUniform=Os,t.quantiles=fs,t.quantizeInterpolator=Sp,t.quarter=H,t.quartiles=hs,t.randomInteger=function(e,n){let r,i,o;null==n&&(n=e,e=0);const a={min(t){return arguments.length?(r=t||0,o=i-r,a):r},max(t){return arguments.length?(i=t||0,o=i-r,a):i},sample:()=>r+Math.floor(o*t.random()),pdf:t=>t===Math.floor(t)&&t>=r&&t<i?1/o:0,cdf(t){const e=Math.floor(t);return e<r?0:e>=i?1:(e-r+1)/o},icdf:t=>t>=0&&t<=1?r-1+Math.floor(t*o):NaN};return a.min(e).max(n)},t.randomKDE=As,t.randomLCG=function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},t.randomLogNormal=Ss,t.randomMixture=Ts,t.randomNormal=ks,t.randomUniform=Ns,t.read=_a,t.regressionConstant=Rs,t.regressionExp=Ws,t.regressionLinear=js,t.regressionLoess=Xs,t.regressionLog=Is,t.regressionPoly=Gs,t.regressionPow=Hs,t.regressionQuad=Ys,t.renderModule=q_,t.repeat=wt,t.resetDefaultLocale=function(){return Lo(),Wo(),Xo()},t.resetSVGDefIds=function(){tm=1,ng=0},t.responseType=va,t.runtimeContext=xz,t.sampleCurve=Ks,t.sampleLogNormal=Es,t.sampleNormal=xs,t.sampleUniform=$s,t.scale=yp,t.sceneEqual=G_,t.sceneFromJSON=ov,t.scenePickVisit=Vm,t.sceneToJSON=iv,t.sceneVisit=Gm,t.sceneZOrder=Ym,t.scheme=Np,t.serializeXML=f_,t.setHybridRendererOptions=function(t){$_.svgMarkTypes=t.svgMarkTypes??["text"],$_.svgOnTop=t.svgOnTop??!0,$_.debug=t.debug??!1},t.setRandom=function(e){t.random=e},t.span=kt,t.splitAccessPath=u,t.stringValue=At,t.textMetrics=zy,t.timeBin=ri,t.timeFloor=Fr,t.timeFormatLocale=Yo,t.timeInterval=Or,t.timeOffset=Ur,t.timeSequence=Pr,t.timeUnitSpecifier=Qn,t.timeUnits=Jn,t.toBoolean=Et,t.toDate=Ct,t.toNumber=E,t.toSet=St,t.toString=Ft,t.transform=ls,t.transforms=ss,t.truncate=Tt,t.truthy=p,t.tupleid=Da,t.typeParsers=aa,t.utcFloor=$r,t.utcInterval=Nr,t.utcOffset=Lr,t.utcSequence=jr,t.utcdayofyear=hr,t.utcisoweek=pr,t.utcquarter=Y,t.utcweek=dr,t.version="6.4.0",t.visitArray=$t,t.week=nr,t.writeConfig=M,t.zero=h,t.zoomLinear=P,t.zoomLog=j,t.zoomPow=I,t.zoomSymlog=W}));
</script><script>!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega")):"function"==typeof define&&define.amd?define(["exports","vega"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vegaLite={},e.vega)}(this,function(e,t){"use strict";var n="6.5.0";function i(e){return Z(e,"or")}function r(e){return Z(e,"and")}function o(e){return Z(e,"not")}function a(e,t){if(o(e))a(e.not,t);else if(r(e))for(const n of e.and)a(n,t);else if(i(e))for(const n of e.or)a(n,t);else t(e)}function s(e,t){return o(e)?{not:s(e.not,t)}:r(e)?{and:e.and.map(e=>s(e,t))}:i(e)?{or:e.or.map(e=>s(e,t))}:t(e)}const c=structuredClone;function l(e){throw new Error(e)}function u(e,n){const i={};for(const r of n)t.hasOwnProperty(e,r)&&(i[r]=e[r]);return i}function f(e,t){const n={...e};for(const e of t)delete n[e];return n}function d(e){if(t.isNumber(e))return e;const n=t.isString(e)?e:K(e);if(n.length<250)return n;let i=0;for(let e=0;e<n.length;e++){i=(i<<5)-i+n.charCodeAt(e),i&=i}return i}function m(e){return!1===e||null===e}function p(e,t){return e.includes(t)}function g(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function h(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function y(e,...t){for(const n of t)v(e,n??{});return e}function v(e,n){for(const i of D(n))t.writeConfig(e,i,n[i],!0)}function b(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 x(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function $(e,t){for(const n of e)if(t.has(n))return!0;return!1}function w(e){const n=new Set;for(const i of e){const e=t.splitAccessPath(i).map((e,t)=>0===t?e:`[${e}]`),r=e.map((t,n)=>e.slice(0,n+1).join(""));for(const e of r)n.add(e)}return n}function k(e,t){return void 0===e||void 0===t||$(w(e),w(t))}function S(e){return 0===D(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>K(e)).join(",")})`};const D=Object.keys,F=Object.values,O=Object.entries;function z(e){return!0===e||!1===e}function _(e){return t.isString(e)||t.isNumber(e)||z(e)}function P(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function C(e,t){return o(e)?`!(${C(e.not,t)})`:r(e)?`(${e.and.map(e=>C(e,t)).join(") && (")})`:i(e)?`(${e.or.map(e=>C(e,t)).join(") || (")})`:t(e)}function N(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&N(e[n],t)&&delete e[n],S(e)}function A(e){return e.charAt(0).toUpperCase()+e.substr(1)}function j(e,n="datum"){const i=t.splitAccessPath(e),r=[];for(let e=1;e<=i.length;e++){const o=`[${i.slice(0,e).map(t.stringValue).join("][")}]`;r.push(`${n}${o}`)}return r.join(" && ")}function T(e,n="datum"){return`${n}[${t.stringValue(t.splitAccessPath(e).join("."))}]`}function E(e){return`datum['${e.replaceAll("'","\\'")}']`}function M(e){return e.replaceAll("\\'","'").replaceAll("\\.",".")}function R(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function L(e){return`${t.splitAccessPath(e).map(R).join("\\.")}`}function q(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function U(e){return`${t.splitAccessPath(e).join(".")}`}function W(e){return e?t.splitAccessPath(e).length:0}function I(...e){return e.find(e=>void 0!==e)}let B=42;function V(e){const t=++B;return e?String(e)+t:t}function H(e){return G(e)?e:`__${e}`}function G(e){return e.startsWith("__")}function Y(e){if(void 0!==e)return(e%360+360)%360}function X(e){return!!t.isNumber(e)||!isNaN(e)&&!isNaN(parseFloat(e))}const J=Object.getPrototypeOf(structuredClone({}));function Q(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;0!==i--;)if(!Q(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;for(const n of e.entries())if(!Q(n[1],t.get(n[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e.entries())if(!t.has(n[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;0!==i--;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==J.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==J.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;0!==i--;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;0!==i--;){const n=r[i];if(!Q(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function K(e){const t=[];return function e(n){if(n?.toJSON&&"function"==typeof n.toJSON&&(n=n.toJSON()),void 0===n)return;if("number"==typeof n)return isFinite(n)?`${n}`:"null";if("object"!=typeof n)return JSON.stringify(n);let i,r;if(Array.isArray(n)){for(r="[",i=0;i<n.length;i++)i&&(r+=","),r+=e(n[i])||"null";return`${r}]`}if(null===n)return"null";if(t.includes(n))throw new TypeError("Converting circular structure to JSON");const o=t.push(n)-1,a=Object.keys(n).sort();for(r="",i=0;i<a.length;i++){const t=a[i],o=e(n[t]);o&&(r&&(r+=","),r+=`${JSON.stringify(t)}:${o}`)}return t.splice(o,1),`{${r}}`}(e)}function Z(e,n){return t.isObject(e)&&t.hasOwnProperty(e,n)&&void 0!==e[n]}const ee="row",te="column",ne="facet",ie="x",re="y",oe="x2",ae="y2",se="xOffset",ce="yOffset",le="radius",ue="radius2",fe="theta",de="theta2",me="latitude",pe="longitude",ge="latitude2",he="longitude2",ye="time",ve="color",be="fill",xe="stroke",$e="shape",we="size",ke="angle",Se="opacity",De="fillOpacity",Fe="strokeOpacity",Oe="strokeWidth",ze="strokeDash",_e="text",Pe="order",Ce="detail",Ne="key",Ae="tooltip",je="href",Te="url",Ee="description",Me={theta:1,theta2:1,radius:1,radius2:1};function Re(e){return t.hasOwnProperty(Me,e)}const Le={longitude:1,longitude2:1,latitude:1,latitude2:1};function qe(e){switch(e){case me:return"y";case ge:return"y2";case pe:return"x";case he:return"x2"}}function Ue(e){return t.hasOwnProperty(Le,e)}const We=D(Le),Ie={x:1,y:1,x2:1,y2:1,...Me,...Le,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function Be(e){return e===ve||e===be||e===xe}const Ve={row:1,column:1,facet:1},He=D(Ve),Ge={...Ie,...Ve},Ye=D(Ge),{order:Xe,detail:Je,tooltip:Qe,...Ke}=Ge,{row:Ze,column:et,facet:tt,...nt}=Ke;function it(e){return t.hasOwnProperty(nt,e)}function rt(e){return t.hasOwnProperty(Ge,e)}const ot=[oe,ae,ge,he,de,ue];function at(e){return st(e)!==e}function st(e){switch(e){case oe:return ie;case ae:return re;case ge:return me;case he:return pe;case de:return fe;case ue:return le}return e}function ct(e){if(Re(e))switch(e){case fe:return"startAngle";case de:return"endAngle";case le:return"outerRadius";case ue:return"innerRadius"}return e}function lt(e){switch(e){case ie:return oe;case re:return ae;case me:return ge;case pe:return he;case fe:return de;case le:return ue}}function ut(e){switch(e){case ie:case oe:return"width";case re:case ae:return"height"}}function ft(e){switch(e){case ie:return"xOffset";case re:return"yOffset";case oe:return"x2Offset";case ae:return"y2Offset";case fe:return"thetaOffset";case le:return"radiusOffset";case de:return"theta2Offset";case ue:return"radius2Offset"}}function dt(e){switch(e){case ie:return"xOffset";case re:return"yOffset"}}function mt(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const pt=D(Ie),{x:gt,y:ht,x2:yt,y2:vt,xOffset:bt,yOffset:xt,latitude:$t,longitude:wt,latitude2:kt,longitude2:St,theta:Dt,theta2:Ft,radius:Ot,radius2:zt,..._t}=Ie,Pt=D(_t),Ct={x:1,y:1},Nt=D(Ct);function At(e){return t.hasOwnProperty(Ct,e)}const jt={theta:1,radius:1},Tt=D(jt);function Et(e){return"width"===e?ie:re}const Mt={xOffset:1,yOffset:1};function Rt(e){return t.hasOwnProperty(Mt,e)}const Lt={time:1};function qt(e){return e in Lt}const{text:Ut,tooltip:Wt,href:It,url:Bt,description:Vt,detail:Ht,key:Gt,order:Yt,...Xt}=_t,Jt=D(Xt);const Qt={...Ct,...jt,...Mt,...Xt},Kt=D(Qt);function Zt(e){return t.hasOwnProperty(Qt,e)}function en(e,t){return function(e){switch(e){case ve:case be:case xe:case Ee:case Ce:case Ne:case Ae:case je:case Pe:case Se:case De:case Fe:case Oe:case ne:case ee:case te:return tn;case ie:case re:case se:case ce:case me:case pe:case ye:return rn;case oe:case ae:case ge:case he:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case we:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case ze:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case $e:return{point:"always",geoshape:"always"};case _e:return{text:"always"};case ke:return{point:"always",square:"always",text:"always"};case Te:return{image:"always"};case fe:case le:return{text:"always",arc:"always"};case de:case ue:return{arc:"always"}}}(e)[t]}const tn={arc:"always",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"},{geoshape:nn,...rn}=tn;function on(e){switch(e){case ie:case re:case fe:case le:case se:case ce:case we:case ke:case Oe:case Se:case De:case Fe:case ye:case oe:case ae:case de:case ue:return;case ne:case ee:case te:case $e:case ze:case _e:case Ae:case je:case Te:case Ee:return"discrete";case ve:case be:case xe:return"flexible";case me:case pe:case ge:case he:case Ce:case Ne:case Pe:return}}const an={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product: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},sn={count:1,min:1,max:1};function cn(e){return Z(e,"argmin")}function ln(e){return Z(e,"argmax")}function un(e){return Z(e,"exponential")}function fn(e){return Z(e,"exponentialb")}function dn(e){return un(e)||fn(e)}function mn(e){return un(e)?"exponential":fn(e)?"exponentialb":e}function pn(e){return un(e)?e.exponential:fn(e)?e.exponentialb:void 0}function gn(e){return t.isString(e)&&t.hasOwnProperty(an,e)}const hn=new Set(["count","valid","missing","distinct"]);function yn(e){return t.isString(e)&&hn.has(e)}const vn=new Set(["count","sum","distinct","valid","missing"]),bn=new Set(["mean","average","median","q1","q3","min","max"]);function xn(e){return t.isBoolean(e)&&(e=Ka(e,void 0)),`bin${D(e).map(t=>Sn(e[t])?P(`_${t}_${O(e[t])}`):P(`_${t}_${e[t]}`)).join("")}`}function $n(e){return!0===e||kn(e)&&!e.binned}function wn(e){return"binned"===e||kn(e)&&!0===e.binned}function kn(e){return t.isObject(e)}function Sn(e){return Z(e,"param")}function Dn(e){switch(e){case ee:case te:case we:case ve:case be:case xe:case Oe:case Se:case De:case Fe:case $e:return 6;case ze:return 4;default:return 10}}function Fn(e){return Z(e,"expr")}function On(e,{level:t}={level:0}){const n=D(e||{}),i={};for(const r of n)i[r]=0===t?Rn(e[r]):On(e[r],{level:t-1});return i}function zn(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:c,subtitleFont:l,subtitleFontSize:f,subtitleFontStyle:d,subtitleFontWeight:m,subtitleLineHeight:p,subtitlePadding:g,...h}=e,y={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...c?{subtitleColor:c}:{},...l?{subtitleFont:l}:{},...f?{subtitleFontSize:f}:{},...d?{subtitleFontStyle:d}:{},...m?{subtitleFontWeight:m}:{},...p?{subtitleLineHeight:p}:{},...g?{subtitlePadding:g}:{}};return{titleMarkConfig:{...h,...s?{fill:s}:{}},subtitleMarkConfig:u(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:y,subtitle:v}}function _n(e){return t.isString(e)||t.isArray(e)&&t.isString(e[0])}function Pn(e){return Z(e,"signal")}function Cn(e){return Z(e,"step")}function Nn(e){return!t.isArray(e)&&(Z(e,"fields")&&!Z(e,"data"))}function An(e){return!t.isArray(e)&&(Z(e,"field")&&Z(e,"data"))}const jn=D({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius: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,aspect:1,width:1,height:1,url:1,smooth:1}),Tn={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},En=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function Mn(e){const n=t.isArray(e.condition)?e.condition.map(Ln):Ln(e.condition);return{...Rn(e),condition:n}}function Rn(e){if(Fn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Ln(e){if(Fn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function qn(e){if(Fn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return Pn(e)?e:void 0!==e?{value:e}:void 0}function Un(e){return Pn(e)?e.signal:t.stringValue(e.value)}function Wn(e){return Pn(e)?e.signal:null==e?null:t.stringValue(e)}function In(e,t,n){for(const i of n){const n=Hn(i,t.markDef,t.config);void 0!==n&&(e[i]=qn(n))}return e}function Bn(e){return[].concat(e.type,e.style??[])}function Vn(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&Z(t,r)?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?Hn(e,t,n,i):void 0}function Hn(e,t,n,{vgChannel:i}={}){const r=Gn(e,t,n.style);return I(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function Gn(e,t,n){return Yn(e,Bn(t),n)}function Yn(e,n,i){let r;for(const o of t.array(n)){const t=i[o];Z(t,e)&&(r=t[e])}return r}function Xn(e,n){return t.array(e).reduce((e,t)=>(e.field.push(Ma(t,n)),e.order.push(t.sort??"ascending"),e),{field:[],order:[]})}function Jn(e,t){const n=[...e];return t.forEach(e=>{for(const t of n)if(Q(t,e))return;n.push(e)}),n}function Qn(e,n){return Q(e,n)||!n?e:e?[...t.array(e),...t.array(n)].join(", "):n}function Kn(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((_n(n)||Pn(n))&&(_n(i)||Pn(i)))return{explicit:e.explicit,value:Qn(n,i)};if(_n(n)||Pn(n))return{explicit:e.explicit,value:n};if(_n(i)||Pn(i))return{explicit:e.explicit,value:i};if(!(_n(n)||Pn(n)||_n(i)||Pn(i)))return{explicit:e.explicit,value:Jn(n,i)};throw new Error("It should never reach here")}function Zn(e){return`Invalid specification ${K(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const ei='Autosize "fit" only works for single views and layered views.';function ti(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function ni(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function ii(e){return e?`Dropping "fit-${e}" because spec has discrete ${ut(e)}.`:'Dropping "fit" because spec has discrete size.'}function ri(e){return`Unknown field for ${e}. Cannot calculate view size.`}function oi(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function ai(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function si(e){return`Selection not supported for ${e} yet.`}const ci="The same selection must be used to override scale domains in a layered view.";function li(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const ui="Animation involving facet, layer, or concat is currently unsupported.";function fi(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function di(e){return`Ignoring an invalid transform: ${K(e)}.`}function mi(e,t,n,i){return`The "${e}" aggregate of the field "${t}" is used with different parameters (${n} and ${i}). Using ${i}.`}function pi(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}const gi="Ignoring tooltip filter because it requires a field (argmin and argmax fields are not supported).";function hi(e){return`${e}Offset dropped because ${e} is continuous`}function yi(e){return`Invalid field type "${e}".`}function vi(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"}.`}function bi(e,t){return`Dropping ${K(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function xi(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function $i(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function wi(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function ki(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Si(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function Di(e){return`Using unaggregated domain with raw field has no effect (${K(e)}).`}function Fi(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Oi(e){return`Unaggregated domain is currently unsupported for log scale (${K(e)}).`}function zi(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function _i(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const Pi="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function Ci(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function Ni(e,t){return`Invalid ${e}: ${K(t)}.`}function Ai(e){return`1D error band does not support ${e}.`}function ji(e){return`Channel ${e} is required for "binned" bin.`}const Ti=t.logger(t.Warn);let Ei=Ti;function Mi(...e){Ei.error(...e)}function Ri(...e){Ei.warn(...e)}function Li(e){if(e&&t.isObject(e))for(const t of Gi)if(Z(e,t))return!0;return!1}const qi=["january","february","march","april","may","june","july","august","september","october","november","december"],Ui=qi.map(e=>e.substr(0,3)),Wi=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Ii=Wi.map(e=>e.substr(0,3));function Bi(e,n){const i=[];if(n&&void 0!==e.day&&D(e).length>1&&(Ri(function(e){return`Dropping day from datetime ${K(e)} as day cannot be combined with other units.`}(e)),delete(e=c(e)).day),void 0!==e.year?i.push(e.year):i.push(2012),void 0!==e.month){const r=n?function(e){if(X(e)&&(e=+e),t.isNumber(e))return e-1;{const t=e.toLowerCase(),n=qi.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Ui.indexOf(i);if(-1!==r)return r;throw new Error(Ni("month",e))}}(e.month):e.month;i.push(r)}else if(void 0!==e.quarter){const r=n?function(e){if(X(e)&&(e=+e),t.isNumber(e))return e>4&&Ri(Ni("quarter",e)),e-1;throw new Error(Ni("quarter",e))}(e.quarter):e.quarter;i.push(t.isNumber(r)?3*r:`${r}*3`)}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const r=n?function(e){if(X(e)&&(e=+e),t.isNumber(e))return e%7;{const t=e.toLowerCase(),n=Wi.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Ii.indexOf(i);if(-1!==r)return r;throw new Error(Ni("day",e))}}(e.day):e.day;i.push(t.isNumber(r)?r+1:`${r}+1`)}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}return i}function Vi(e){const t=Bi(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const Hi={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Gi=D(Hi);function Yi(e){return t.isObject(e)?e.binned:Xi(e)}function Xi(e){return e?.startsWith("binned")}function Ji(e){return e.startsWith("utc")}const Qi={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Ki(e){return Gi.filter(t=>er(e,t))}function Zi(e){const t=Ki(e);return t[t.length-1]}function er(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function tr(e,t,{end:n=!1,expr:i="datum"}={}){const r=j(t,i),o=Ji(e)?"utc":"";function a(e){return"quarter"===e?`(${o}quarter(${r})-1)`:`${o}${e}(${r})`}let s;const c={};for(const t of Gi)er(e,t)&&(c[t]=a(t),s=t);return n&&(c[s]+="+1"),function(e){const t=Bi(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(c)}function nr(e){if(!e)return;return`timeUnitSpecifier(${K(Ki(e))}, ${K(Qi)})`}function ir(e){if(!e)return;let n;return t.isString(e)?n=Xi(e)?{unit:e.substring(6),binned:!0}:{unit:e}:t.isObject(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),Ji(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function rr(e,t=e=>e){const n=ir(e),i=Zi(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=ar(i,n.step);return`${t(Vi({...e,[o]:+e[o]+r}))} - ${t(Vi(e))}`}}const or={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function ar(e,n=1){if(function(e){return t.hasOwnProperty(or,e)}(e))return{part:e,step:n};switch(e){case"day":case"dayofyear":return{part:"date",step:n};case"quarter":return{part:"month",step:3*n};case"week":return{part:"date",step:7*n}}}function sr(e){return!!e?.field&&void 0!==e.equal}function cr(e){return!!e?.field&&void 0!==e.lt}function lr(e){return!!e?.field&&void 0!==e.lte}function ur(e){return!!e?.field&&void 0!==e.gt}function fr(e){return!!e?.field&&void 0!==e.gte}function dr(e){if(e?.field){if(t.isArray(e.range)&&2===e.range.length)return!0;if(Pn(e.range))return!0}return!1}function mr(e){return!!e?.field&&(t.isArray(e.oneOf)||t.isArray(e.in))}function pr(e){return!!e?.field&&void 0!==e.valid}function gr(e){return mr(e)||sr(e)||dr(e)||cr(e)||ur(e)||lr(e)||fr(e)}function hr(e,t){return ts(e,{timeUnit:t,wrapTime:!0})}function yr(e,t=!0,n="datum"){const{field:i}=e,r=ir(e.timeUnit),{unit:o,binned:a}=r||{},s=Ma(e,{expr:n}),c=o?`time(${a?s:tr(o,i,{expr:n})})`:s;if(sr(e))return`${c}===${hr(e.equal,o)}`;if(cr(e)){return`${c}<${hr(e.lt,o)}`}if(ur(e)){return`${c}>${hr(e.gt,o)}`}if(lr(e)){return`${c}<=${hr(e.lte,o)}`}if(fr(e)){return`${c}>=${hr(e.gte,o)}`}if(mr(e))return`indexof([${function(e,t){return e.map(e=>hr(e,t))}(e.oneOf,o).join(",")}], ${c}) !== -1`;if(pr(e))return vr(c,e.valid);if(dr(e)){const{range:n}=On(e),i=Pn(n)?{signal:`${n.signal}[0]`}:n[0],r=Pn(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==r&&t)return`inrange(${c}, [${hr(i,o)}, ${hr(r,o)}])`;const a=[];return null!==i&&a.push(`${c} >= ${hr(i,o)}`),null!==r&&a.push(`${c} <= ${hr(r,o)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${K(e)}`)}function vr(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function br(e){return gr(e)&&e.timeUnit?{...e,timeUnit:ir(e.timeUnit)}:e}function xr(e){return"quantitative"===e||"temporal"===e}function $r(e){return"ordinal"===e||"nominal"===e}const wr="quantitative",kr="ordinal",Sr="temporal",Dr="nominal",Fr="geojson";const Or="linear",zr="log",_r="pow",Pr="sqrt",Cr="time",Nr="utc",Ar="point",jr="band",Tr={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function Er(e,t){const n=Tr[e],i=Tr[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const Mr={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function Rr(e){return Mr[e]}const Lr=new Set(["linear","log","pow","sqrt","symlog"]),qr=new Set([...Lr,"time","utc"]);function Ur(e){return Lr.has(e)}const Wr=new Set(["quantile","quantize","threshold"]),Ir=new Set([...qr,...Wr,"sequential","identity"]),Br=new Set(["ordinal","bin-ordinal","point","band"]);function Vr(e){return Br.has(e)}function Hr(e){return Ir.has(e)}function Gr(e){return qr.has(e)}function Yr(e){return Wr.has(e)}function Xr(e){return Z(e,"param")}const{type:Jr,domain:Qr,range:Kr,rangeMax:Zr,rangeMin:eo,scheme:to,...no}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin: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},io=D(no);function ro(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return Gr(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return Gr(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Gr(e);case"nice":return Gr(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return Hr(e)&&!p(["log","time","utc","threshold","quantile"],e)}}function oo(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return Be(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const ao={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},so=ao.arc,co=ao.area,lo=ao.bar,uo=ao.image,fo=ao.line,mo=ao.point,po=ao.rect,go=ao.rule,ho=ao.text,yo=ao.tick,vo=ao.trail,bo=ao.circle,xo=ao.square,$o=ao.geoshape,wo=new Set(["line","area","trail"]);function ko(e){return wo.has(e)}const So=new Set(["rect","bar","image","arc","tick"]);function Do(e){return So.has(e)}const Fo=new Set(["bar","area"]);function Oo(e){return Fo.has(e)}const zo=new Set(D(ao));function _o(e){return Z(e,"type")}const Po=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],Co=D({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),No=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],Ao={area:["line","point"],bar:No,rect:No,line:["point"],tick:["bandSize","thickness",...No]},jo=D({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function To(e){return Z(e,"band")}const Eo={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},Mo={...Eo,binSpacing:1},Ro={...Eo,thickness:1};function Lo(e,{isPath:t}){return void 0===e||"break-paths-show-path-domains"===e?t?"break-paths-show-domains":"filter":null===e?"show":e}function qo({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){if(!i||!Hr(i)||r)return"always-valid";const o=Lo(Vn("invalid",e,t),{isPath:ko(e.type)}),a=t.scale?.invalid?.[n];return void 0!==a?"show":o}function Uo({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,o=`peek(${i})`,a=t.domainHasZero();if("definitely"===a)return{scale:e,value:0};if("maybe"===a){return{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${"zeroOrMin"===n?r:o})`}}return{signal:`scale('${e}', ${"zeroOrMin"===n?r:o})`}}function Wo({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:o}){const a=n?.get("type"),s=Ga(t),c=qo({scaleChannel:e,markDef:r,config:o,scaleType:a,isCountAggregate:yn(s?.aggregate)});if(s&&"show"===c){const t=o.scale.invalid?.[e]??"zero-or-min";return{test:vr(Ma(s,{expr:"datum"}),!1),...Io(t,n,i)}}}function Io(e,n,i){if(r=e,t.isObject(r)&&"value"in r){const{value:t}=e;return Pn(t)?{signal:t.signal}:{value:t}}var r;return Uo({scale:n,scaleName:i,mode:"zeroOrMin"})}function Bo(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:o,config:a}=e,s=st(t),c=Go(e),l=Wo({scaleChannel:s,channelDef:n,scale:r,scaleName:o,markDef:i,config:a});return void 0!==l?[l,c]:c}function Vo(e,t,n,i){const r={};if(t&&(r.scale=t),Da(e)){const{datum:t}=e;Li(t)?r.signal=Vi(t):Pn(t)?r.signal=t.signal:Fn(t)?r.signal=t.expr:r.value=t}else r.field=Ma(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function Ho({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:a=.5}){const s=!Pn(a)&&0<a&&a<1?"datum":void 0,c=Ma(t,{expr:s,suffix:r}),l=void 0!==n?Ma(n,{expr:s}):Ma(t,{suffix:o,expr:s}),u={};if(0===a||1===a){u.scale=e;const t=0===a?c:l;u.field=t}else{const t=Pn(a)?`(1-${a.signal}) * ${c} + ${a.signal} * ${l}`:`${1-a} * ${c} + ${a} * ${l}`;u.signal=`scale("${e}", ${t})`}return i&&(u.offset=i),u}function Go({channel:e,channelDef:n,channel2Def:i,markDef:r,config:o,scaleName:a,scale:s,stack:c,offset:l,defaultRef:u,bandPosition:f}){if(n){if(_a(n)){const t=s?.get("type");if(Pa(n)){f??=ha({fieldDef:n,fieldDef2:i,markDef:r,config:o});const{bin:s,timeUnit:u,type:d}=n;if($n(s)||f&&u&&d===Sr)return c?.impute?Vo(n,a,{binSuffix:"mid"},{offset:l}):f&&!Vr(t)?Ho({scaleName:a,fieldOrDatumDef:n,bandPosition:f,offset:l}):Vo(n,a,is(n,e)?{binSuffix:"range"}:{},{offset:l});if(wn(s)){if(ka(i))return Ho({scaleName:a,fieldOrDatumDef:n,fieldOrDatumDef2:i,bandPosition:f,offset:l});Ri(ji(e===ie?oe:ae))}}return Vo(n,a,Vr(t)?{binSuffix:"range"}:{},{offset:l,band:"band"===t?f??n.bandPosition??.5:void 0})}if(Ca(n)){const t=l?{offset:l}:{};return{...Yo(e,n.value),...t}}}return t.isFunction(u)&&(u=u()),u?{...u,...l?{offset:l}:{}}:u}function Yo(e,t){return p(["x","x2"],e)&&"width"===t?{field:{group:"width"}}:p(["y","y2"],e)&&"height"===t?{field:{group:"height"}}:qn(t)}function Xo(e){return e&&"number"!==e&&"time"!==e}function Jo(e,t,n){return`${e}(${t}${n?`, ${K(n)}`:""})`}function Qo({fieldOrDatumDef:e,format:n,formatType:i,expr:r,normalizeStack:o,config:a}){if(Xo(i))return Zo({fieldOrDatumDef:e,format:n,formatType:i,expr:r,config:a});const s=Ko(e,r,o),c=Sa(e);if(void 0===n&&void 0===i&&a.customFormatTypes){if("quantitative"===c){if(o&&a.normalizedNumberFormatType)return Zo({fieldOrDatumDef:e,format:a.normalizedNumberFormat,formatType:a.normalizedNumberFormatType,expr:r,config:a});if(a.numberFormatType)return Zo({fieldOrDatumDef:e,format:a.numberFormat,formatType:a.numberFormatType,expr:r,config:a})}if("temporal"===c&&a.timeFormatType&&ka(e)&&void 0===e.timeUnit)return Zo({fieldOrDatumDef:e,format:a.timeFormat,formatType:a.timeFormatType,expr:r,config:a})}if(es(e)){const{unit:i,utc:r}=ka(l=e)?ir(l.timeUnit)||{}:{unit:void 0,utc:void 0},o=function({field:e,timeUnit:n,format:i,formatType:r,rawTimeFormat:o,isUTCScale:a}){return!n||i?!n&&r?`${r}(${e}, ${K(i)})`:`${a?"utc":"time"}Format(${e}, ${K(i=t.isString(i)?i:o)})`:function(e,t,n){if(!e)return;const i=nr(e);return`${n||Ji(e)?"utc":"time"}Format(${t}, ${i})`}(n,e,a)}({field:s,timeUnit:i,format:n,formatType:a.timeFormatType,rawTimeFormat:a.timeFormat,isUTCScale:r||Na(e)&&e.scale?.type===Nr});return o?{signal:o}:void 0}var l;if(n=na({type:c,specifiedFormat:n,config:a,normalizeStack:o}),ka(e)&&$n(e.bin)){return{signal:oa(s,Ma(e,{expr:r,binSuffix:"end"}),n,i,a)}}return n||"quantitative"===Sa(e)?{signal:`${ia(s,n)}`}:{signal:`isValid(${s}) ? ${s} : ""+${s}`}}function Ko(e,t,n){return ka(e)?n?`${Ma(e,{expr:t,suffix:"end"})}-${Ma(e,{expr:t,suffix:"start"})}`:Ma(e,{expr:t}):function(e){const{datum:t}=e;return Li(t)?Vi(t):`${K(t)}`}(e)}function Zo({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:a}){if(a??=Ko(e,i,r),"datum.value"!==a&&ka(e)&&$n(e.bin)){return{signal:oa(a,Ma(e,{expr:i,binSuffix:"end"}),t,n,o)}}return{signal:Jo(n,a,t)}}function ea(e,n,i,r,o,a){if(!t.isString(r)||!Xo(r)){if(void 0===i&&void 0===r&&o.customFormatTypes&&"quantitative"===Sa(e)){if(o.normalizedNumberFormatType&&Aa(e)&&"normalize"===e.stack)return;if(o.numberFormatType)return}if(Aa(e)&&"normalize"===e.stack&&o.normalizedNumberFormat)return na({type:"quantitative",specifiedFormat:i,config:o,normalizeStack:!0});if(es(e)){const t=ka(e)?ir(e.timeUnit)?.unit:void 0;if(void 0===t&&o.customFormatTypes&&o.timeFormatType)return;return function({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){if(e)return e;if(t)return{signal:nr(t)};return i?void 0:n.timeFormat}({specifiedFormat:i,timeUnit:t,config:o,omitTimeFormatConfig:a})}return na({type:n,specifiedFormat:i,config:o})}}function ta(e,t,n){return e&&(Pn(e)||"number"===e||"time"===e)?e:es(t)&&"time"!==n&&"utc"!==n?ka(t)&&ir(t?.timeUnit)?.utc?"utc":"time":void 0}function na({type:e,specifiedFormat:n,config:i,normalizeStack:r}){return t.isString(n)?n:e===wr?r?i.normalizedNumberFormat:i.numberFormat:void 0}function ia(e,t){return`format(${e}, "${t||""}")`}function ra(e,n,i,r){return Xo(i)?Jo(i,e,n):ia(e,(t.isString(n)?n:void 0)??r.numberFormat)}function oa(e,t,n,i,r){if(void 0===n&&void 0===i&&r.customFormatTypes&&r.numberFormatType)return oa(e,t,r.numberFormat,r.numberFormatType,r);const o=ra(e,n,i,r),a=ra(t,n,i,r);return`${vr(e,!1)} ? "null" : ${o} + " – " + ${a}`}const aa="min",sa={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 ca(e){return t.hasOwnProperty(sa,e)}function la(e){return e&&("count"===e.op||Z(e,"field"))}function ua(e){return e&&t.isArray(e)}function fa(e){return Z(e,"row")||Z(e,"column")}function da(e){return Z(e,"header")}function ma(e){return Z(e,"facet")}function pa(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function ga(e){return Z(e,"sort")}function ha({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(_a(e)&&void 0!==e.bandPosition)return e.bandPosition;if(ka(e)){const{timeUnit:r,bin:o}=e;if(r&&!t)return Hn("timeUnitBandPosition",n,i);if($n(o))return.5}}function ya({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:o,useVlSizeChannel:a}){const s=ut(e),c=Vn(a?"size":s,i,r,{vgChannel:s});if(void 0!==c)return c;if(ka(t)){const{timeUnit:e,bin:a}=t;if(e&&!n)return{band:Hn("timeUnitBandSize",i,r)};if($n(a)&&!Vr(o))return{band:1}}return Do(i.type)?o?Vr(o)?r[i.type]?.discreteBandSize||{band:1}:r[i.type]?.continuousBandSize:r[i.type]?.discreteBandSize:void 0}function va(e,t,n,i){return!!($n(e.bin)||e.timeUnit&&Pa(e)&&"temporal"===e.type)&&void 0!==ha({fieldDef:e,fieldDef2:t,markDef:n,config:i})}function ba(e){return Z(e,"sort")&&!Z(e,"field")}function xa(e){return Z(e,"condition")}function $a(e){const n=e?.condition;return!!n&&!t.isArray(n)&&ka(n)}function wa(e){const n=e?.condition;return!!n&&!t.isArray(n)&&_a(n)}function ka(e){return Z(e,"field")||"count"===e?.aggregate}function Sa(e){return e?.type}function Da(e){return Z(e,"datum")}function Fa(e){return Pa(e)&&!Ra(e)||za(e)}function Oa(e){return Pa(e)&&"quantitative"===e.type&&!e.bin||za(e)}function za(e){return Da(e)&&t.isNumber(e.datum)}function _a(e){return ka(e)||Da(e)}function Pa(e){return e&&(Z(e,"field")||"count"===e.aggregate)&&Z(e,"type")}function Ca(e){return Z(e,"value")}function Na(e){return Z(e,"scale")||Z(e,"sort")}function Aa(e){return Z(e,"axis")||Z(e,"stack")||Z(e,"impute")}function ja(e){return Z(e,"legend")}function Ta(e){return Z(e,"format")||Z(e,"formatType")}function Ea(e){return f(e,["legend","axis","header","scale"])}function Ma(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,o="";if(La(e))n=H("count");else{let i;if(!t.nofn)if(function(e){return Z(e,"op")}(e))i=mn(e.op);else{const{bin:a,aggregate:s,timeUnit:c}=e;$n(a)?(i=xn(a),r=(t.binSuffix??"")+(t.suffix??"")):s?ln(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):cn(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=mn(s):c&&!Yi(c)&&(i=function(e){const{utc:t,...n}=ir(e);return n.unit?(t?"utc":"")+D(n).map(e=>P(`${"unit"===e?"":`_${e}_`}${n[e]}`)).join(""):`${t?"utc":""}timeunit${D(n).map(e=>P(`_${e}_${n[e]}`)).join("")}`}(c),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?U(n):t.expr?T(n,t.expr)+o:L(n)+o}function Ra(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return ka(e)&&!!e.bin;case"temporal":return!1}throw new Error(yi(e.type))}function La(e){return"count"===e.aggregate}const qa=(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(ln(t))return`${r} for argmax(${t.argmax})`;if(cn(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Yi(i)?ir(i):void 0,a=mn(t)||o?.unit||o?.maxbins&&"timeunit"||$n(n)&&"bin";return a?`${a.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($n(i))return`${n} (binned)`;if(r&&!Yi(r)){const e=ir(r)?.unit;if(e)return`${n} (${Ki(e).join("-")})`}else if(o)return ln(o)?`${n} for max ${o.argmax}`:cn(o)?`${n} for min ${o.argmin}`:`${A(mn(o))} of ${n}`;return n}(e,t)}};let Ua=qa;function Wa(e){Ua=e}function Ia(e,t,{allowDisabling:n,includeDefault:i=!0}){const r=Ba(e)?.title;if(!ka(e))return r??e.title;const o=e,a=i?Va(o,t):void 0;return n?I(r,o.title,a):r??o.title??a}function Ba(e){return Aa(e)&&e.axis?e.axis:ja(e)&&e.legend?e.legend:da(e)&&e.header?e.header:void 0}function Va(e,t){return Ua(e,t)}function Ha(e){if(Ta(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=Ba(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function Ga(e){return ka(e)?e:$a(e)?e.condition:void 0}function Ya(e){return _a(e)?e:wa(e)?e.condition:void 0}function Xa(e,n,i,r={}){if(_(e)){return Ri(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${K(n)}}.`}(n,t.isString(e)?"string":t.isNumber(e)?"number":"boolean",e)),{value:e}}return _a(e)?Ja(e,n,i,r):wa(e)?{...e,condition:Ja(e.condition,n,i,r)}:e}function Ja(e,n,i,r){if(Ta(e)){const{format:t,formatType:o,...a}=e;if(Xo(o)&&!i.customFormatTypes)return Ri(pi(n)),Ja(a,n,i,r)}else{const t=Aa(e)?"axis":ja(e)?"legend":da(e)?"header":null;if(t&&e[t]){const{format:o,formatType:a,...s}=e[t];if(Xo(a)&&!i.customFormatTypes)return Ri(pi(n)),Ja({...e,[t]:s},n,i,r)}}return ka(e)?Qa(e,n,r):function(e){let n=e.type;if(n)return e;const{datum:i}=e;return n=t.isNumber(i)?"quantitative":t.isString(i)?"nominal":Li(i)?"temporal":void 0,{...e,type:n}}(e)}function Qa(e,n,{compositeMark:i=!1}={}){const{aggregate:r,timeUnit:o,bin:a,field:s}=e,c={...e};if(i||!r||gn(r)||ln(r)||cn(r)||dn(r)||(Ri(function(e){return`Invalid aggregation operator "${e}".`}(r)),delete c.aggregate),o&&(c.timeUnit=ir(o)),s&&(c.field=`${s}`),$n(a)&&(c.bin=Ka(a,n)),wn(a)&&!At(n)&&Ri(function(e){return`Channel ${e} should not be used with "binned" bin.`}(n)),Pa(c)){const{type:e}=c,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case wr:return"quantitative";case"t":case Sr:return"temporal";case"o":case kr:return"ordinal";case"n":case Dr:return"nominal";case Fr:return"geojson"}}(e);e!==t&&(c.type=t),"quantitative"!==e&&yn(r)&&(Ri(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,r)),c.type="quantitative")}else if(!at(n)){const e=function(e,n){switch(n){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(ga(e)&&t.isArray(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!ln(i)&&!cn(i))return"quantitative";if(Na(e)&&e.scale?.type)switch(Tr[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(c,n);c.type=e}if(Pa(c)){const{compatible:e,warning:t}=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 ee:case te:case ne:return Ra(e)?Za:{compatible:!1,warning:wi(t)};case ie:case re:case se:case ce:case ve:case be:case xe:case _e:case Ce:case Ne:case Ae:case je:case Te:case ke:case fe:case le:case Ee:return Za;case pe:case he:case me:case ge:return n!==wr?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Za;case Se:case De:case Fe:case Oe:case we:case de:case ue:case oe:case ae:case ye:return"nominal"!==n||e.sort?Za:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case $e:case ze:return Ra(e)||Na(i=e)&&Yr(i.scale?.type)?Za:{compatible:!1,warning:ki(t)};case Pe:return"nominal"!==e.type||"sort"in e?Za:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i}(c,n)||{};!1===e&&Ri(t)}if(ga(c)&&t.isString(c.sort)){const{sort:e}=c;if(ca(e))return{...c,sort:{encoding:e}};const t=e.substring(1);if("-"===e.charAt(0)&&ca(t))return{...c,sort:{encoding:t,order:"descending"}}}if(da(c)){const{header:e}=c;if(e){const{orient:t,...n}=e;if(t)return{...c,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return c}function Ka(e,n){return t.isBoolean(e)?{maxbins:Dn(n)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:Dn(n)}}const Za={compatible:!0};function es(e){const{formatType:t}=Ha(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||ka(n)&&!!n.timeUnit));var n}function ts(e,{timeUnit:n,type:i,wrapTime:r,undefinedIfExprNotRequired:o}){const a=n&&ir(n)?.unit;let s,c=a||"temporal"===i;return Fn(e)?s=e.expr:Pn(e)?s=e.signal:Li(e)?(c=!0,s=Vi(e)):(t.isString(e)||t.isNumber(e))&&c&&(s=`datetime(${K(e)})`,function(e){return t.hasOwnProperty(Hi,e)}(a)&&(t.isNumber(e)&&e<1e4||t.isString(e)&&isNaN(Date.parse(e)))&&(s=Vi({[a]:e}))),s?r&&c?`time(${s})`:s:o?void 0:K(e)}function ns(e,t){const{type:n}=e;return t.map(t=>{const i=ts(t,{timeUnit:ka(e)&&!Yi(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t})}function is(e,t){return $n(e.bin)?Zt(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const rs={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"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function os(e){return e?.condition}const as=["domain","grid","labels","ticks","title"],ss={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"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",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},cs={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap: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,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap: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,translate:1,values:1,zindex:1},ls={...cs,style:1,labelExpr:1,encoding:1};function us(e){return t.hasOwnProperty(ls,e)}const fs=D({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function ds(e){return Z(e,"mark")}class ms{name;run;constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!ds(e)&&(_o(t=e.mark)?t.type:t)===this.name;var t}}function ps(e,n){const i=e?.[n];return!!i&&(t.isArray(i)?g(i,e=>!!e.field):ka(i)||$a(i))}function gs(e,n){const i=e?.[n];return!!i&&(t.isArray(i)?g(i,e=>!!e.field):ka(i)||Da(i)||wa(i))}function hs(e,t){if(At(t)){const n=e[t];if((ka(n)||Da(n))&&($r(n.type)||ka(n)&&n.timeUnit)){return gs(e,dt(t))}}return!1}function ys(e,t){const n=dt(t);return!!n&&Oa(e[n])}function vs(e){return g(Ye,n=>{if(ps(e,n)){const i=e[n];if(t.isArray(i))return g(i,e=>!!e.aggregate);{const e=Ga(i);return e&&!!e.aggregate}}return!1})}function bs(e,n){const i=[],r=[],o=[],a=[],s={};return ws(e,(c,l)=>{if(ka(c)){const{field:u,aggregate:f,bin:d,timeUnit:m,...p}=c;if(f||m||d){const e=Ba(c),g=e?.title;let h=Ma(c,{forAs:!0});const y={...g?[]:{title:Ia(c,n,{allowDisabling:!0})},...p,field:h};if(f){let e;if(ln(f)?(e="argmax",h=Ma({op:"argmax",field:f.argmax},{forAs:!0}),y.field=`${h}.${u}`):cn(f)?(e="argmin",h=Ma({op:"argmin",field:f.argmin},{forAs:!0}),y.field=`${h}.${u}`):(dn(f)||"boxplot"!==f&&"errorbar"!==f&&"errorband"!==f)&&(e=f),e){const t={op:e,as:h};u&&(t.field=u),a.push(t)}}else if(i.push(h),Pa(c)&&$n(d)){if(r.push({bin:d,field:u,as:h}),i.push(Ma(c,{binSuffix:"end"})),is(c,l)&&i.push(Ma(c,{binSuffix:"range"})),At(l)){const e={field:`${h}_end`};s[`${l}2`]=e}y.bin="binned",at(l)||(y.type=wr)}else if(m&&!Yi(m)){o.push({timeUnit:m,field:u,as:h});const e=Pa(c)&&c.type!==Sr&&"time";e&&(l===_e||l===Ae?y.formatType=e:!function(e){return t.hasOwnProperty(_t,e)}(l)?At(l)&&(y.axis={formatType:e,...y.axis}):y.legend={formatType:e,...y.legend})}s[l]=y}else i.push(u),s[l]=e[l]}else s[l]=e[l]}),{bins:r,timeUnits:o,aggregate:a,groupby:i,encoding:s}}function xs(e,t,n){const i=en(t,n);if(!i)return!1;if("binned"===i){const n=e[t===oe?ie:re];return!!(ka(n)&&ka(e[t])&&wn(n.bin))}return!0}function $s(e,t){const n={};for(const i of D(e)){const r=Xa(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function ws(e,n,i){if(e)for(const r of D(e)){const o=e[r];if(t.isArray(o))for(const e of o)n.call(i,e,r);else n.call(i,o,r)}}function ks(e,n){return D(n).reduce((i,r)=>{switch(r){case ie:case re:case je:case Ee:case Te:case oe:case ae:case se:case ce:case fe:case de:case le:case ue:case ye:case me:case pe:case ge:case he:case _e:case $e:case ke:case Ae:return i;case Pe:if("line"===e||"trail"===e)return i;case Ce:case Ne:{const e=n[r];if(t.isArray(e)||ka(e))for(const n of t.array(e))n.aggregate||i.push(Ma(n,{}));return i}case we:if("trail"===e)return i;case ve:case be:case xe:case Se:case De:case Fe:case ze:case Oe:{const e=Ga(n[r]);return e&&!e.aggregate&&i.push(Ma(e,{})),i}}},[])}function Ss(e,n,i,r=!0){if("tooltip"in i)return{tooltip:i.tooltip};return{tooltip:[...e.map(({fieldPrefix:e,titlePrefix:t})=>{const i=r?` of ${Ds(n)}`:"";return{field:e+n.field,type:n.type,title:Pn(t)?{signal:`${t}"${escape(i)}"`}:t+i}}),...b(function(e){const n=[];for(const i of D(e))if(ps(e,i)){const r=e[i],o=t.array(r);for(const e of o)ka(e)?n.push(e):$a(e)&&n.push(e.condition)}return n}(i).map(Ea),d)]}}function Ds(e){const{title:t,field:n}=e;return I(t,n)}function Fs(e,n,i,r,o){const{scale:a,axis:s}=i;return({partName:c,mark:l,positionPrefix:u,endPositionPrefix:f,extraEncoding:d={}})=>{const m=Ds(i);return Os(e,c,o,{mark:l,encoding:{[n]:{field:`${u}_${i.field}`,type:i.type,...void 0!==m?{title:m}:{},...void 0!==a?{scale:a}:{},...void 0!==s?{axis:s}:{}},...t.isString(f)?{[`${n}2`]:{field:`${f}_${i.field}`}}:{},...r,...d}})}}function Os(e,n,i,r){const{clip:o,color:a,opacity:s}=e,c=e.type;return e[n]||void 0===e[n]&&i[n]?[{...r,mark:{...i[n],...o?{clip:o}:{},...a?{color:a}:{},...s?{opacity:s}:{},..._o(r.mark)?r.mark:{type:r.mark},style:`${c}-${String(n)}`,...t.isBoolean(e[n])?{}:e[n]}}]:[]}function zs(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],c=i[`${r}Error2`];return{continuousAxisChannelDef:_s(o,n),continuousAxisChannelDef2:_s(a,n),continuousAxisChannelDefError:_s(s,n),continuousAxisChannelDefError2:_s(c,n),continuousAxis:r}}function _s(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&Ri(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function Ps(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(_o(n)&&n.orient)return n.orient;if(Fa(r)){if(Fa(o)){const e=ka(r)&&r.aggregate,n=ka(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return es(o)&&!es(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(Fa(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const Cs="boxplot",Ns=new ms(Cs,js);function As(e){return t.isNumber(e)?"tukey":e}function js(e,{config:n}){e={...e,encoding:$s(e.encoding,n)};const{mark:i,encoding:r,params:o,projection:a,...s}=e,c=_o(i)?i:{type:i};o&&Ri(si("boxplot"));const l=c.extent??n.boxplot.extent,u=Vn("size",c,n),f=c.invalid,d=As(l),{bins:m,timeUnits:p,transform:g,continuousAxisChannelDef:h,continuousAxis:y,groupby:v,aggregate:b,encodingWithoutContinuousAxis:x,ticksOrient:$,boxOrient:w,customTooltipWithoutAggregatedField:k}=function(e,n,i){const r=Ps(e,Cs),{continuousAxisChannelDef:o,continuousAxis:a}=zs(e,r,Cs),s=o.field,c=U(s),l=As(n),u=[...Ts(s),{op:"median",field:s,as:`mid_box_${c}`},{op:"min",field:s,as:("min-max"===l?"lower_whisker_":"min_")+c},{op:"max",field:s,as:("min-max"===l?"upper_whisker_":"max_")+c}],f="min-max"===l||"tukey"===l?[]:[{calculate:`${E(`upper_box_${c}`)} - ${E(`lower_box_${c}`)}`,as:`iqr_${c}`},{calculate:`min(${E(`upper_box_${c}`)} + ${E(`iqr_${c}`)} * ${n}, ${E(`max_${c}`)})`,as:`upper_whisker_${c}`},{calculate:`max(${E(`lower_box_${c}`)} - ${E(`iqr_${c}`)} * ${n}, ${E(`min_${c}`)})`,as:`lower_whisker_${c}`}],{[a]:d,...m}=e.encoding,{customTooltipWithoutAggregatedField:p,filteredEncoding:g}=function(e){const{tooltip:n,...i}=e;if(!n)return{filteredEncoding:i};let r,o;if(t.isArray(n)){for(const e of n)e.aggregate?(r||(r=[]),r.push(e)):(o||(o=[]),o.push(e));r&&(i.tooltip=r)}else n.aggregate?i.tooltip=n:o=n;return t.isArray(o)&&1===o.length&&(o=o[0]),{customTooltipWithoutAggregatedField:o,filteredEncoding:i}}(m),{bins:h,timeUnits:y,aggregate:v,groupby:b,encoding:x}=bs(g,i),$="vertical"===r?"horizontal":"vertical",w=r,k=[...h,...y,{aggregate:[...v,...u],groupby:b},...f];return{bins:h,timeUnits:y,transform:k,groupby:b,aggregate:v,continuousAxisChannelDef:o,continuousAxis:a,encodingWithoutContinuousAxis:x,ticksOrient:$,boxOrient:w,customTooltipWithoutAggregatedField:p}}(e,l,n),S=U(h.field),{color:D,size:F,...O}=x,z=e=>Fs(c,y,h,e,n.boxplot),_=z(O),P=z(x),C=(t.isObject(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",N=z({...O,...F?{size:F}:{},color:{condition:{test:`${E(`lower_box_${h.field}`)} >= ${E(`upper_box_${h.field}`)}`,...D||{value:C}}}}),A=Ss([{fieldPrefix:"min-max"===d?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===d?"lower_whisker_":"min_",titlePrefix:"Min"}],h,x),j={type:"tick",color:"black",opacity:1,orient:$,invalid:f,aria:!1},T="min-max"===d?A:Ss([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],h,x),M=[..._({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:T}),..._({partName:"rule",mark:{type:"rule",invalid:f,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:T}),..._({partName:"ticks",mark:j,positionPrefix:"lower_whisker",extraEncoding:T}),..._({partName:"ticks",mark:j,positionPrefix:"upper_whisker",extraEncoding:T})],R=[..."tukey"!==d?M:[],...P({partName:"box",mark:{type:"bar",...u?{size:u}:{},orient:w,invalid:f,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:A}),...N({partName:"median",mark:{type:"tick",invalid:f,...t.isObject(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...u?{size:u}:{},orient:$,aria:!1},positionPrefix:"mid_box",extraEncoding:A})];if("min-max"===d)return{...s,transform:(s.transform??[]).concat(g),layer:R};const L=E(`lower_box_${h.field}`),q=E(`upper_box_${h.field}`),W=`(${q} - ${L})`,I=`${L} - ${l} * ${W}`,B=`${q} + ${l} * ${W}`,V=E(h.field),H={joinaggregate:Ts(h.field),groupby:v},G={transform:[{filter:`(${I} <= ${V}) && (${V} <= ${B})`},{aggregate:[{op:"min",field:h.field,as:`lower_whisker_${S}`},{op:"max",field:h.field,as:`upper_whisker_${S}`},{op:"min",field:`lower_box_${h.field}`,as:`lower_box_${S}`},{op:"max",field:`upper_box_${h.field}`,as:`upper_box_${S}`},...b],groupby:v}],layer:M},{tooltip:Y,...X}=O,{scale:J,axis:Q}=h,K=Ds(h),Z=Os(c,"outliers",n.boxplot,{transform:[{filter:`(${V} < ${I}) || (${V} > ${B})`}],mark:"point",encoding:{[y]:{field:h.field,type:h.type,...void 0!==K?{title:K}:{},...void 0!==J?{scale:J}:{},...void 0!==Q?{axis:Q}:{}},...X,...D?{color:D}:{},...k?{tooltip:k}:{}}})[0];let ee;const te=[...m,...p,H];return Z?ee={transform:te,layer:[Z,G]}:(ee=G,ee.transform.unshift(...te)),{...s,layer:[ee,{transform:g,layer:R}]}}function Ts(e){const t=U(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}const Es="errorbar",Ms=new ms(Es,Rs);function Rs(e,{config:t}){e={...e,encoding:$s(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:s,outerSpec:c,tooltipEncoding:l}=qs(e,Es,t);delete o.size;const u=Fs(s,r,i,o,t.errorbar),f=s.thickness,d=s.size,m={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},p=[...u({partName:"ticks",mark:m,positionPrefix:"lower",extraEncoding:l}),...u({partName:"ticks",mark:m,positionPrefix:"upper",extraEncoding:l}),...u({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...c,transform:n,...p.length>1?{layer:p}:{...p[0]}}}function Ls(e,t){const{encoding:n}=e;if(function(e){return(_a(e.x)||_a(e.y))&&!_a(e.x2)&&!_a(e.y2)&&!_a(e.xError)&&!_a(e.xError2)&&!_a(e.yError)&&!_a(e.yError2)}(n))return{orient:Ps(e,t),inputType:"raw"};const i=function(e){return _a(e.x2)||_a(e.y2)}(n),r=function(e){return _a(e.xError)||_a(e.xError2)||_a(e.yError)||_a(e.yError2)}(n),o=n.x,a=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(_a(e)&&_a(i))throw new Error(`${t} cannot have both x2 and y2`);if(_a(e)){if(Fa(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(_a(i)){if(Fa(a))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,s=n.yError2;if(_a(i)&&!_a(e))throw new Error(`${t} cannot have xError2 without xError`);if(_a(s)&&!_a(r))throw new Error(`${t} cannot have yError2 without yError`);if(_a(e)&&_a(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(_a(e)){if(Fa(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(_a(r)){if(Fa(a))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 qs(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,c=_o(i)?i:{type:i};o&&Ri(si(t));const{orient:l,inputType:u}=Ls(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:m,continuousAxisChannelDefError2:p,continuousAxis:g}=zs(e,l,t),{errorBarSpecificAggregate:h,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let c=[],l=[];const u=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&Ri(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)c=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],l=[{calculate:`${E(`center_${u}`)} + ${E(`extent_${u}`)}`,as:`upper_${u}`},{calculate:`${E(`center_${u}`)} - ${E(`extent_${u}`)}`,as:`lower_${u}`}],f=[{fieldPrefix:"center_",titlePrefix:A(t)},{fieldPrefix:"upper_",titlePrefix:Us(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:Us(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),c=[{op:t,field:u,as:`lower_${u}`},{op:i,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],f=[{fieldPrefix:"upper_",titlePrefix:Ia({field:u,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Ia({field:u,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Ia({field:u,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&Ri((m=e.center,`${(p=e.extent)?"extent ":""}${p&&m?"and ":""}${m?"center ":""}${p&&m?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],l=[{calculate:E(n.field),as:`upper_${u}`},{calculate:E(u),as:`lower_${u}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:u}],l=[{calculate:`${E(u)} + ${E(i.field)}`,as:`upper_${u}`}],r?l.push({calculate:`${E(u)} + ${E(r.field)}`,as:`lower_${u}`}):l.push({calculate:`${E(u)} - ${E(i.field)}`,as:`lower_${u}`}));for(const e of l)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:q(q(e.calculate,"datum['",""),"']","")})}var m,p;return{postAggregateCalculates:l,errorBarSpecificAggregate:c,tooltipSummary:f,tooltipTitleWithFieldName:d}}(c,f,d,m,p,u,t,n),{[g]:x,["x"===g?"x2":"y2"]:$,["x"===g?"xError":"yError"]:w,["x"===g?"xError2":"yError2"]:k,...S}=r,{bins:D,timeUnits:F,aggregate:O,groupby:z,encoding:_}=bs(S,n),P=[...O,...h],C="raw"!==u?[]:z,N=Ss(v,f,_,b);return{transform:[...s.transform??[],...D,...F,...0===P.length?[]:[{aggregate:P,groupby:C}],...y],groupby:C,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:_,ticksOrient:"vertical"===l?"horizontal":"vertical",markDef:c,outerSpec:s,tooltipEncoding:N}}function Us(e,t,n){return`${A(e)} ${n} ${t}`}const Ws="errorband",Is=new ms(Ws,Bs);function Bs(e,{config:t}){e={...e,encoding:$s(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:s,tooltipEncoding:c}=qs(e,Ws,t),l=a,u=Fs(l,r,i,o,t.errorband),f=void 0!==e.encoding.x&&void 0!==e.encoding.y;let d={type:f?"area":"rect"},m={type:f?"line":"rule"};const p={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...p,ariaRoleDescription:"errorband"},m={...m,...p,aria:!1}):l.interpolate?Ri(Ai("interpolate")):l.tension&&Ri(Ai("tension")),{...s,transform:n,layer:[...u({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c}),...u({partName:"borders",mark:m,positionPrefix:"lower",extraEncoding:c}),...u({partName:"borders",mark:m,positionPrefix:"upper",extraEncoding:c})]}}const Vs={};function Hs(e,t,n){const i=new ms(e,t);Vs[e]={normalizer:i,parts:n}}Hs(Cs,js,["box","median","outliers","rule","ticks"]),Hs(Es,Rs,["ticks","rule"]),Hs(Ws,Bs,["band","borders"]);const Gs=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],Ys={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"},Xs={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},Js=D(Ys),Qs=D(Xs),Ks=D({header:1,headerRow:1,headerColumn:1,headerFacet:1}),Zs=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],ec="_vgsid_",tc={point:{on:"click",fields:[ec],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function nc(e){return"legend"===e||!!e?.legend}function ic(e){return nc(e)&&t.isObject(e)}function rc(e){return!!e?.select}function oc(e){const t=[];for(const n of e||[]){if(rc(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function ac(e){return Z(e,"concat")}function sc(e){return Z(e,"vconcat")}function cc(e){return Z(e,"hconcat")}function lc({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function uc(e){return Z(e,"step")}function fc(e){return Z(e,"view")||Z(e,"width")||Z(e,"height")}const dc=D({align:1,bounds:1,center:1,columns:1,spacing:1});function mc(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function pc(e,t){const n=gc(e,t);return uc(n)?n.step:hc}function gc(e,t){return I(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const hc=20,yc={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:300,continuousHeight:300,step:hc},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:Mo,circle:{},geoshape:{},image:{},line:{},point:{},rect:Eo,rule:{color:"black"},square:{},text:{color:"black"},tick:Ro,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,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:tc,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},vc=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],bc={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},xc={blue:vc[0],orange:vc[1],red:vc[2],teal:vc[3],green:vc[4],yellow:vc[5],purple:vc[6],pink:vc[7],brown:vc[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function $c(e){const t=D(e||{}),n={};for(const i of t){const t=e[i];n[i]=os(t)?Mn(t):Rn(t)}return n}const wc=[...jo,...fs,...Ks,"background","padding","legend","lineBreak","scale","style","title","view"];function kc(e={}){const{color:n,font:i,fontSize:r,selection:o,...a}=e,s=t.mergeConfig({},c(yc),i?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(i):{},n?function(e={}){return{signals:[{name:"color",value:t.isObject(e)?{...xc,...e}:xc}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(n):{},r?function(e){return{signals:[{name:"fontSize",value:t.isObject(e)?{...bc,...e}:bc}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(r):{},a||{});o&&t.writeConfig(s,"selection",o,!0);const l=f(s,wc);for(const e of["background","lineBreak","padding"])s[e]&&(l[e]=Rn(s[e]));for(const e of jo)s[e]&&(l[e]=On(s[e]));for(const e of fs)s[e]&&(l[e]=$c(s[e]));for(const e of Ks)s[e]&&(l[e]=On(s[e]));if(s.legend&&(l.legend=On(s.legend)),s.scale){const{invalid:e,...t}=s.scale,n=On(e,{level:1});l.scale={...On(t),...D(n).length>0?{invalid:n}:{}}}return s.style&&(l.style=function(e){const t=D(e),n={};for(const i of t)n[i]=$c(e[i]);return n}(s.style)),s.title&&(l.title=On(s.title)),s.view&&(l.view=On(s.view)),l}const Sc=new Set(["view",...zo]),Dc=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Fc={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...Ao};function Oc(e){e=c(e);for(const t of Dc)delete e[t];if(e.axis)for(const t in e.axis)os(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of Gs)delete e.legend[t];if(e.mark){for(const t of Co)delete e.mark[t];e.mark.tooltip&&t.isObject(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(oc(e.params)),delete e.params);for(const t of Sc){for(const n of Co)delete e[t][n];const n=Fc[t];if(n)for(const i of n)delete e[t][i];zc(e,t)}for(const t of D(Vs))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=zn(e.title);S(t)||(e.style["group-title"]={...e.style["group-title"],...t});S(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});S(i)?delete e.title:e.title=i}(e);for(const n in e)t.isObject(e[n])&&S(e[n])&&delete e[n];return S(e)?void 0:e}function zc(e,t,n,i){"view"===t&&(n="cell");const r={...e[t],...e.style[n??t]};S(r)||(e.style[n??t]=r),delete e[t]}function _c(e){return Z(e,"layer")}class Pc{map(e,t){return ma(e)?this.mapFacet(e,t):function(e){return Z(e,"repeat")}(e)?this.mapRepeat(e,t):cc(e)?this.mapHConcat(e,t):sc(e)?this.mapVConcat(e,t):ac(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(_c(e))return this.mapLayer(e,t);if(ds(e))return this.mapUnit(e,t);throw new Error(Zn(e))}mapLayer(e,t){return{...e,layer:e.layer.map(e=>this.mapLayerOrUnit(e,t))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map(e=>this.map(e,t))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map(e=>this.map(e,t))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map(e=>this.map(e,t))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const Cc={zero:1,center:1,normalize:1};const Nc=new Set([so,lo,co,go,mo,bo,xo,fo,ho,yo]),Ac=new Set([lo,co,so]);function jc(e){return ka(e)&&"quantitative"===Sa(e)&&!e.bin}function Tc(e,t,{orient:n,type:i}){const r="x"===t?"y":"radius",o="x"===t&&Oo(i),a=e[t],s=e[r];if(ka(a)&&ka(s))if(jc(a)&&jc(s)){if(a.stack)return t;if(s.stack)return r;const e=ka(a)&&!!a.aggregate;if(e!==(ka(s)&&!!s.aggregate))return e?t:r;if(o){if("vertical"===n)return r;if("horizontal"===n)return t}}else{if(jc(a))return t;if(jc(s))return r}else{if(jc(a)){if(o&&"vertical"===n)return;return t}if(jc(s)){if(o&&"horizontal"===n)return;return r}}}function Ec(e,n){const i=_o(e)?e:{type:e},r=i.type;if(!Nc.has(r))return null;const o=Tc(n,"x",i)||Tc(n,"theta",i);if(!o)return null;const a=n[o],s=ka(a)?Ma(a,{}):void 0;if(void 0===a.stack&&("x"===o&&!n.y&&ys(n,"y")||"y"===o&&!n.x&&ys(n,"x")))return null;const c=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(o),l=[],u=new Set;if(n[c]){const e=n[c],t=ka(e)?Ma(e,{}):void 0;t&&t!==s&&(l.push(c),u.add(t))}const f="x"===c?"xOffset":"yOffset",d=n[f],m=ka(d)?Ma(d,{}):void 0;m&&m!==s&&(l.push(f),u.add(m));const p=Pt.reduce((e,i)=>{if("tooltip"!==i&&ps(n,i)){const r=n[i];for(const n of t.array(r)){const t=Ga(n);if(t.aggregate)continue;const r=Ma(t,{});r&&u.has(r)||e.push({channel:i,fieldDef:t})}}return e},[]);let g;return void 0!==a.stack?g=t.isBoolean(a.stack)?a.stack?"zero":null:a.stack:Ac.has(r)&&(g="zero"),g&&(h=g,t.hasOwnProperty(Cc,h))?vs(n)&&0===p.length?null:(a?.scale?.type&&a?.scale?.type!==Or&&a?.stack&&Ri(function(e){return`Stack is applied to a non-linear scale (${e}).`}(a.scale.type)),_a(n[lt(o)])?(void 0!==a.stack&&Ri(`Cannot stack "${y=o}" if there is already "${y}2".`),null):(ka(a)&&a.aggregate&&!vn.has(a.aggregate)&&Ri(`Stacking is applied even though the aggregate function is non-summative ("${a.aggregate}").`),{groupbyChannels:l,groupbyFields:u,fieldChannel:o,impute:null!==a.impute&&ko(r),stackBy:p,offset:g})):null;var h,y}function Mc(e,t,n){const i=On(e),r=Vn("orient",i,n);i.orient=function(e,t,n){switch(e){case mo:case bo:case xo:case po:case uo:return}const{x:i,y:r,x2:o,y2:a}=t,s=ys(t,"x"),c=ys(t,"y");switch(e){case ho:case lo:if(!r&&c)return n??"vertical";if(!i&&s)return n??"horizontal";if(ka(i)&&(wn(i.bin)||ka(r)&&r.aggregate&&!i.aggregate))return"vertical";if(ka(r)&&(wn(r.bin)||ka(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(ka(i)&&i.type===wr&&!$n(i.bin)||za(i))&&ka(r)&&wn(r.bin)?"horizontal":"vertical";if(!a)return(ka(r)&&r.type===wr&&!$n(r.bin)||za(r))&&ka(i)&&wn(i.bin)?"vertical":"horizontal"}case go:if(o&&(!ka(i)||!wn(i.bin))&&a&&(!ka(r)||!wn(r.bin)))return;case co:if(!r&&c)return n??"vertical";if(!i&&s)return n??"horizontal";if(a)return ka(r)&&wn(r.bin)?"horizontal":"vertical";if(o)return ka(i)&&wn(i.bin)?"vertical":"horizontal";if(e===go){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case fo:case yo:{const t=Oa(i),o=Oa(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=Pa(i)&&i.type===Sr,t=Pa(r)&&r.type===Sr;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&Ri(`Specified orient "${i.orient}" overridden with "${r}".`);const o=Vn("opacity",i,n),a=Vn("fillOpacity",i,n);void 0===o&&void 0===a&&(i.opacity=function(e,t){if(p([mo,yo,bo,xo],e)&&!vs(t))return Rc;return}(i.type,t));return void 0===Vn("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||Vn("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}const Rc=.7;function Lc(e){const{point:t,line:n,...i}=e;return D(i).length>1?i:i.type}function qc(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:f(e[t],["point","line"])});return e}function Uc(e,n={},i){return"transparent"===e.point?{opacity:0}:e.point?t.isObject(e.point)?e.point:{}:void 0!==e.point?null:n.point||i.shape?t.isObject(n.point)?n.point:{}:void 0}function Wc(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 Ic{name="path-overlay";hasMatchingType(e,t){if(ds(e)){const{mark:n,encoding:i}=e,r=_o(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!Uc(r,t[r.type],i);case"area":return!!Uc(r,t[r.type],i)||!!Wc(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:c,...l}=e,d=$s(c,i),m=_o(a)?a:{type:a},p=Uc(m,i[m.type],d),g="area"===m.type&&Wc(m,i[m.type]),h=[{name:s,...r?{params:r}:{},mark:Lc({..."area"===m.type&&null==Vn("opacity",m,i)&&null==Vn("fillOpacity",m,i)?{opacity:Rc}:{},...m}),encoding:f(d,["shape"])}],y=Ec(Mc(m,d,i),d);let v=d;if(y){const{fieldChannel:e,offset:t}=y;v={...d,[e]:{...d[e],...t?{stack:t}:{}}}}return v=f(v,["y2","x2"]),g&&h.push({...o?{projection:o}:{},mark:{type:"line",...u(m,["clip","interpolate","tension","tooltip"]),...g},encoding:v}),p&&h.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...u(m,["clip","tooltip"]),...p},encoding:v}),n({...l,layer:h},{...t,config:qc(i)})}}function Bc(e,t){return t?fa(e)?Jc(e,t):Gc(e,t):e}function Vc(e,t){return t?Jc(e,t):e}function Hc(e,n,i){const r=n[e];return o=r,!t.isString(o)&&Z(o,"repeat")?r.repeat in i?{...n,[e]:i[r.repeat]}:void Ri(function(e){return`Unknown repeated value "${e}".`}(r.repeat)):n;var o}function Gc(e,t){if(void 0!==(e=Hc("field",e,t))){if(null===e)return null;if(ga(e)&&la(e.sort)){const n=Hc("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function Yc(e,t){if(ka(e))return Gc(e,t);{const n=Hc("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function Xc(e,t){if(!_a(e)){if(wa(e)){const n=Yc(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=Yc(e,t);if(n)return n;if(xa(e))return{condition:e.condition}}}function Jc(e,n){const i={};for(const r in e)if(Z(e,r)){const o=e[r];if(t.isArray(o))i[r]=o.map(e=>Xc(e,n)).filter(e=>e);else{const e=Xc(o,n);void 0!==e&&(i[r]=e)}}return i}class Qc{name="RuleForRangedLine";hasMatchingType(e){if(ds(e)){const{encoding:t,mark:n}=e;if("line"===n||_o(n)&&"line"===n.type)for(const e of ot){const n=t[st(e)];if(t[e]&&(ka(n)&&!wn(n.bin)||Da(n)))return!0}}return!1}run(e,n,i){const{encoding:r,mark:o}=e;var a,s;return Ri((a=!!r.x2,s=!!r.y2,`Line mark is for continuous lines and thus cannot be used with ${a&&s?"x2 and y2":a?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),i({...e,mark:t.isObject(o)?{...o,type:"rule"}:"rule"},n)}}function Kc({parentEncoding:e,encoding:n={},layer:i}){let r={};if(e){const o=new Set([...D(e),...D(n)]);for(const a of o){const o=n[a],s=e[a];if(_a(o)){const e={...s,...o};r[a]=e}else wa(o)?r[a]={...o,condition:{...s,...o.condition}}:o||null===o?r[a]=o:(i||Ca(s)||Pn(s)||_a(s)||t.isArray(s))&&(r[a]=s)}}else r=n;return!r||S(r)?void 0:r}function Zc(e){const{parentProjection:t,projection:n}=e;return t&&n&&Ri(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${K(t)} is overridden by a child projection ${K(n)}.`}({parentProjection:t,projection:n})),n??t}function el(e){return Z(e,"filter")}function tl(e){return Z(e,"lookup")}function nl(e){return Z(e,"pivot")}function il(e){return Z(e,"density")}function rl(e){return Z(e,"quantile")}function ol(e){return Z(e,"regression")}function al(e){return Z(e,"loess")}function sl(e){return Z(e,"sample")}function cl(e){return Z(e,"window")}function ll(e){return Z(e,"joinaggregate")}function ul(e){return Z(e,"flatten")}function fl(e){return Z(e,"calculate")}function dl(e){return Z(e,"bin")}function ml(e){return Z(e,"impute")}function pl(e){return Z(e,"timeUnit")}function gl(e){return Z(e,"aggregate")}function hl(e){return Z(e,"stack")}function yl(e){return Z(e,"fold")}function vl(e){return Z(e,"extent")&&!Z(e,"density")&&!Z(e,"regression")}function bl(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map(e=>{if(el(e))return{filter:wl(e,t)};if(dl(e)&&kn(e.bin))return{...e,bin:$l(e.bin)};if(tl(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e})}}return e}function xl(e,n){const i=c(e);if(ka(i)&&kn(i.bin)&&(i.bin=$l(i.bin)),Na(i)&&i.scale?.domain?.selection){const{selection:e,...t}=i.scale.domain;i.scale.domain={...t,...e?{param:e}:{}}}if(xa(i))if(t.isArray(i.condition))i.condition=i.condition.map(e=>{const{selection:t,param:i,test:r,...o}=e;return i?e:{...o,test:wl(e,n)}});else{const{selection:e,param:t,test:r,...o}=xl(i.condition,n);i.condition=t?i.condition:{...o,test:wl(i.condition,n)}}return i}function $l(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function wl(e,t){const n=e=>s(e,e=>{const n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n});return e.selection?n(e.selection):s(e.test||e.filter,e=>e.selection?n(e.selection):e)}class kl extends Pc{map(e,t){const n=t.selections??[];if(e.params&&!ds(e)){const t=[];for(const i of e.params)rc(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,n){const i=n.selections;if(!i||!i.length)return e;const r=(n.path??[]).concat(e.name),o=[];for(const n of i)if(n.views&&n.views.length)for(const i of n.views)(t.isString(i)&&(i===e.name||r.includes(i))||t.isArray(i)&&i.map(e=>r.indexOf(e)).every((e,t,n)=>-1!==e&&(0===t||e>n[t-1])))&&o.push(n);else o.push(n);return o.length&&(e.params=o),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=kl.prototype[e];kl.prototype[e]=function(e,n){return Reflect.apply(t,this,[e,Sl(e,n)])}}function Sl(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function Dl(e,t){void 0===t&&(t=kc(e.config));const n=function(e,t={}){const n={config:t};return zl.map(Fl.map(Ol.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=ds(e)||_c(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&(Ri(ti("width")),i=void 0),"container"==r&&(Ri(ti("height")),r=void 0));const s={type:"pad",...a,...n?_l(n.autosize):{},..._l(e.autosize)};"fit"!==s.type||o||(Ri(ei),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&Ri(ni("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&Ri(ni("height"));if(Q(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const Fl=new class extends Pc{nonFacetUnitNormalizers=[Ns,Ms,Is,new Ic,new Qc];map(e,t){if(ds(e)){const n=ps(e.encoding,ee),i=ps(e.encoding,te),r=ps(e.encoding,ne);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=Vc(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter(e=>e).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,n){return function(e){return!t.isArray(e.repeat)&&Z(e.repeat,"layer")}(e)?this.mapLayerRepeat(e,n):this.mapNonLayerRepeat(e,n)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:c={},repeaterPrefix:l=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map(e=>{const n={...c,layer:e},r=`${(i.name?`${i.name}_`:"")+l}child__layer_${P(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o})}}mapNonLayerRepeat(e,n){const{repeat:i,spec:r,data:o,...a}=e;!t.isArray(i)&&e.columns&&(e=f(e,["columns"]),Ri(li("repeat")));const s=[],{repeater:c={},repeaterPrefix:l=""}=n,u=!t.isArray(i)&&i.row||[c?c.row:null],d=!t.isArray(i)&&i.column||[c?c.column:null],m=t.isArray(i)&&i||[c?c.repeat:null];for(const e of m)for(const o of u)for(const a of d){const u={repeat:e,row:o,column:a,layer:c.layer},d=`${(r.name?`${r.name}_`:"")+l}child__${t.isArray(i)?`${P(e)}`:(i.row?`row_${P(o)}`:"")+(i.column?`column_${P(a)}`:"")}`,m=this.map(r,{...n,repeater:u,repeaterPrefix:d});m.name=d,s.push(f(m,["data"]))}const p=t.isArray(i)?e.columns:i.column?i.column.length:1;return{data:r.data??o,align:"all",...a,columns:p,concat:s}}mapFacet(e,t){const{facet:n}=e;return fa(n)&&e.columns&&(e=f(e,["columns"]),Ri(li("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=Zc({parentProjection:o,projection:i}),c=Kc({parentEncoding:r,encoding:Vc(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...c?{encoding:c}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:c,height:l,view:u,params:f,encoding:d,...m}=e,{facetMapping:p,layout:g}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),h=Vc(o,t.repeater);return this.mapFacet({...m,...g,facet:p,spec:{...s?{width:s}:{},...l?{height:l}:{},...u?{view:u}:{},...c?{projection:c}:{},mark:a,encoding:h,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&Ri(`Facet encoding dropped as ${(o=[...n?[ee]:[],...i?[te]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[ee,te]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...c}=i;t[n]=c;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??={},a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:Bc(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,{parentEncoding:t,parentProjection:n,...i}){const{encoding:r,projection:o,...a}=e,s={...i,parentEncoding:Kc({parentEncoding:t,encoding:r,layer:!0}),parentProjection:Zc({parentProjection:n,projection:o})};return super.mapLayer({...a,...e.name?{name:[s.repeaterPrefix,e.name].filter(e=>e).join("_")}:{}},s)}},Ol=new class extends Pc{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=bl(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=bl(e,t)).encoding){const n={};for(const[i,r]of O(e.encoding))n[i]=xl(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:O(n).map(([e,n])=>{const{init:i,bind:r,empty:o,...a}=n;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),t.emptySelections[e]="none"!==o;for(const n of F(t.selectionPredicates[e]??{}))n.empty="none"!==o;return{name:e,value:i,select:a,bind:r}})}:e}},zl=new kl;function _l(e){return t.isString(e)?{type:e}:e??{}}const Pl=["background","padding"];function Cl(e,t){const n={};for(const t of Pl)e&&void 0!==e[t]&&(n[t]=Rn(e[t]));return t&&(n.params=e.params),n}class Nl{explicit;implicit;constructor(e={},t={}){this.explicit=e,this.implicit=t}clone(){return new Nl(c(this.explicit),c(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return I(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,{value:t,explicit:n}){void 0!==t&&this.set(e,t,n)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,{explicit:t,implicit:n}){void 0!==t[e]?this.set(e,t[e],!0):void 0!==n[e]&&this.set(e,n[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of D(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Al(e){return{explicit:!0,value:e}}function jl(e){return{explicit:!1,value:e}}function Tl(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:El(t,n,i,r)}}function El(e,t,n,i){return e.explicit&&t.explicit&&Ri(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${K(n)} and ${K(i)}). Using ${K(n)}.`}(n,i,e.value,t.value)),e}function Ml(e,t,n,i,r=El){return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:Q(e.value,t.value)?e:r(e,t,n,i)}class Rl extends Nl{explicit;implicit;parseNothing;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}}function Ll(e){return Z(e,"url")}function ql(e){return Z(e,"values")}function Ul(e){return Z(e,"name")&&!Ll(e)&&!ql(e)&&!Wl(e)}function Wl(e){return e&&(Il(e)||Bl(e)||Vl(e))}function Il(e){return Z(e,"sequence")}function Bl(e){return Z(e,"sphere")}function Vl(e){return Z(e,"graticule")}var Hl;function Gl({invalid:e,isPath:t}){switch(Lo(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}!function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid"}(Hl||(Hl={}));class Yl{debugName;_children=[];_parent=null;_hash;constructor(e,t){this.debugName=t,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.includes(e)?Ri("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);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class Xl extends Yl{type;refCounts;_source;_name;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}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)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${V()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function Jl(e){return void 0!==e.as}function Ql(e){return`${e}_end`}class Kl extends Yl{timeUnits;clone(){return new Kl(null,c(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(Yi(o)){if(Mp(t)){const{mark:e,markDef:i,config:s}=t,c=ha({fieldDef:n,markDef:i,config:s});(Do(e)||c)&&(a={timeUnit:ir(o),field:r})}}else a={as:Ma(n,{forAs:!0}),field:r,timeUnit:o};if(Mp(t)){const{mark:e,markDef:r,config:o}=t,s=ha({fieldDef:n,markDef:r,config:o});Do(e)&&At(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[d(a)]=a)}return e},{});return S(n)?null:new Kl(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:ir(n)};return new Kl(e,{[d(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of O(this.timeUnits)){const r=Jl(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(F(this.timeUnits).map(e=>Jl(e)?e.as:Ql(e.field)))}dependentFields(){return new Set(F(this.timeUnits).map(e=>e.field))}hash(){return`TimeUnit ${d(this.timeUnits)}`}assemble(){const e=[];for(const t of F(this.timeUnits)){const{rectBandPosition:n}=t,i=ir(t.timeUnit);if(Jl(t)){const{field:r,as:o}=t,{unit:a,utc:s,...c}=i,l=[o,`${o}_end`];e.push({field:L(r),type:"timeunit",...a?{units:Ki(a)}:{},...s?{timezone:"utc"}:{},...c,as:l}),e.push(...nu(l,n,i))}else if(t){const{field:r}=t,o=M(r),a=tu({timeUnit:i,field:o}),s=Ql(o);e.push({type:"formula",expr:a,as:s}),e.push(...nu([o,s],n,i))}}return e}}const Zl="offsetted_rect_start",eu="offsetted_rect_end";function tu({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=Zi(i),{part:a,step:s}=ar(o,e.step);return`${r?"utcOffset":"timeOffset"}('${a}', ${E(t)}, ${n?-s:s})`}function nu([e,t],n,i){if(void 0!==n&&.5!==n){const r=E(e),o=E(t);return[{type:"formula",expr:iu([tu({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${Zl}`},{type:"formula",expr:iu([r,o],n+.5),as:`${e}_${eu}`}]}return[]}function iu([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const ru="_tuple_fields";class ou{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...e){this.items=e,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const au={defined:()=>!0,parse:(e,n,i)=>{const r=n.name,o=n.project??=new ou,a={},s={},c=new Set,l=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=P(`${r}_${n}`);for(let e=1;c.has(i);e++)i=P(`${r}_${n}_${e}`);return c.add(i),{[t]:i}},u=n.type,f=e.config.selection[u],m=void 0!==i.value?t.array(i.value):null;let{fields:p,encodings:g}=t.isObject(i.select)?i.select:{};if(!p&&!g&&m)for(const e of m)if(t.isObject(e))for(const t of D(e))it(t)?(g||(g=[])).push(t):"interval"===u?(Ri('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),g=f.encodings):(p??=[]).push(t);p||g||(g=f.encodings,"fields"in f&&(p=f.fields));for(const t of g??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){Ri(ai(t,n.aggregate));continue}if(!i){Ri(oi(t));continue}if(n.timeUnit&&!Yi(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};s[d(r)]=r}if(!a[i]){const r={field:i,channel:t,type:"interval"===u&&Zt(t)&&Hr(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:o.items.length};r.signals={...l(r,"data"),...l(r,"visual")},o.items.push(a[i]=r),o.hasField[i]=a[i],o.hasSelectionId=o.hasSelectionId||i===ec,Ue(t)?(r.geoChannel=t,r.channel=qe(t),o.hasChannel[r.channel]=a[i]):o.hasChannel[t]=a[i]}}else Ri(oi(t))}for(const e of p??[]){if(o.hasField[e])continue;const t={type:"E",field:e,index:o.items.length};t.signals={...l(t,"data")},o.items.push(t),o.hasField[e]=t,o.hasSelectionId=o.hasSelectionId||e===ec}m&&(n.init=m.map(e=>o.items.map(n=>t.isObject(e)?void 0!==e[n.geoChannel||n.channel]?e[n.geoChannel||n.channel]:e[n.field]:e))),S(s)||(o.timeUnit=new Kl(null,s))},signals:(e,t,n)=>{const i=t.name+ru;return n.filter(e=>e.name===i).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(yu)})}},su="_curr",cu="anim_value",lu="anim_clock",uu="eased_anim_clock",fu="min_extent",du="max_range_extent",mu="last_tick_at",pu="is_playing",gu=1/60*1e3,hu={defined:e=>"point"===e.type,topLevelSignals:(e,t,n)=>(Bf(t)&&(n=n.concat([{name:lu,init:"0",on:[{events:{type:"timer",throttle:gu},update:`${pu} ? (${lu} + (now() - ${mu}) > ${du} ? 0 : ${lu} + (now() - ${mu})) : ${lu}`}]},{name:mu,init:"now()",on:[{events:[{signal:lu},{signal:pu}],update:"now()"}]},{name:pu,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+ru,o=t.project,a="(item().isVoronoi ? datum.datum : datum)",s=F(e.component.selection??{}).reduce((e,t)=>"interval"===t.type?e.concat(t.name+Fu):e,[]).map(e=>`indexof(item().mark.name, '${e}') < 0`).join(" && "),c="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(s?` && ${s}`:"");let l=`unit: ${Uf(e)}, `;if(t.project.hasSelectionId)l+=`${ec}: ${T(ec,a)}`;else if(Bf(t))l+=`fields: ${r}, values: [${cu} ? ${cu} : ${fu}]`;else{l+=`fields: ${r}, values: [${o.items.map(t=>{const n=e.fieldDef(t.channel);return n?.bin?`[${T(e.vgField(t.channel,{}),a)}, ${T(e.vgField(t.channel,{binSuffix:"end"}),a)}]`:T(t.field,a)}).join(", ")}]`}if(Bf(t))return n.concat((u=t.name,f=e.scaleName(ye),[{name:uu,update:lu},{name:`${u}_domain`,init:`domain('${f}')`},{name:fu,init:`extent(${u}_domain)[0]`},{name:du,init:`extent(range('${f}'))[1]`},{name:cu,update:`invert('${f}', ${uu})`}]),[{name:i+Mf,update:`{${l}}`}]);{const e=t.events;return n.concat([{name:i+Mf,on:e?[{events:e,update:`${c} ? {${l}} : null`,force:!0}]:[]}])}var u,f}};function yu(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=L(r.field),r}function vu(e,n=!0,i=e=>e){if(t.isArray(e)){const t=e.map(e=>vu(e,n,i));return n?`[${t.join(", ")}]`:t}return Li(e)?i(n?Vi(e):function(e){const t=Bi(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):n?i(K(e)):e}function bu(e,n){for(const i of F(e.component.selection??{})){const r=i.name;let o=`${r}${Mf}, ${"global"===i.resolve?"true":`{unit: ${Uf(e)}}`}`;for(const t of qf)t.defined(i)&&(t.signals&&(n=t.signals(e,i,n)),t.modifyExpr&&(o=t.modifyExpr(e,i,o)));const a=`modify(${t.stringValue(i.name+Ef)}, ${o})`;n.push(Bf(i)?{name:r+Rf,update:a}:{name:r+Rf,on:[{events:{signal:i.name+Mf},update:a}]})}return wu(n)}function xu(e,n){if(e.component.selection&&D(e.component.selection).length){const i=t.stringValue(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:t.parseSelector("pointermove","scope"),update:`isTuple(facet) ? facet : group(${i}).datum`}]})}return wu(n)}function $u(e,t){for(const n of F(e.component.selection??{}))for(const i of qf)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function wu(e){return e.map(e=>(e.on&&!e.on.length&&delete e.on,e))}const ku={defined: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(!Zt(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;"sequential"==a&&Ri("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&Hr(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):Ri("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,n,i)=>{const r=n.scales.filter(e=>0===i.filter(t=>t.name===e.signals.data).length);if(!e.parent||Du(e)||0===r.length)return i;const o=i.find(e=>e.name===n.name);let a=o.update;if(a.includes(Lf))o.update=`{${r.map(e=>`${t.stringValue(L(e.field))}: ${e.signals.data}`).join(", ")}}`;else{for(const e of r){const n=`${t.stringValue(L(e.field))}: ${e.signals.data}`;a.includes(n)||(a=`${a.substring(0,a.length-1)}, ${n}}`)}o.update=a}return i.concat(r.map(e=>({name:e.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!Du(e))for(const e of t.scales){const t=n.find(t=>t.name===e.signals.data);t.push="outer",delete t.value,delete t.update}return n}};function Su(e,n){return`domain(${t.stringValue(e.scaleName(n))})`}function Du(e){return e.parent&&qp(e.parent)&&(!e.parent.parent||Du(e.parent.parent))}const Fu="_brush",Ou="_scale_trigger",zu="geo_interval_init_tick",_u="_init",Pu={defined:e=>"interval"===e.type,parse:(e,n,i)=>{if(e.hasProjection){const e={...t.isObject(i.select)?i.select:{}};e.fields=[ec],e.encodings||(e.encodings=i.value?D(i.value):[pe,me]),i.select={type:"interval",...e}}if(n.translate&&!ku.defined(n)){const e=`!event.item || event.item.mark.name !== ${t.stringValue(n.name+Fu)}`;for(const i of n.events){if(!i.between){Ri(`${i} is not an ordered event stream for interval selections.`);continue}const n=i.between[0],r=t.array(n.filter??[]);r.includes(e)||(n.filter=[...r,e])}}},signals:(e,n,i)=>{const r=n.name,o=r+Mf,a=F(n.project.hasChannel).filter(e=>e.channel===ie||e.channel===re),s=n.init?n.init[0]:null;if(i.push(...a.reduce((i,r)=>i.concat(function(e,n,i,r){const o=!e.hasProjection,a=i.channel,s=i.signals.visual,c=t.stringValue(o?e.scaleName(a):e.projectionName()),l=e=>`scale(${c}, ${e})`,u=e.getSizeSignalRef(a===ie?"width":"height").signal,f=`${a}(unit)`,d=n.events.reduce((e,t)=>[...e,{events:t.between[0],update:`[${f}, ${f}]`},{events:t,update:`[${s}[0], clamp(${f}, 0, ${u})]`}],[]);if(o){const t=i.signals.data,o=ku.defined(n),u=e.getScaleComponent(a),f=u?u.get("type"):void 0,m=r?{init:vu(r,!0,l)}:{value:[]};return d.push({events:{signal:n.name+Ou},update:Hr(f)?`[${l(`${t}[0]`)}, ${l(`${t}[1]`)}]`:"[0, 0]"}),o?[{name:t,on:[]}]:[{name:s,...m,on:d},{name:t,...r?{init:vu(r)}:{},on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${c}, ${s})`}]}]}{const e=a===ie?0:1,t=n.name+_u;return[{name:s,...r?{init:`[${t}[0][${e}], ${t}[1][${e}]]`}:{value:[]},on:d}]}}(e,n,r,s?.[r.index])),[])),e.hasProjection){const c=t.stringValue(e.projectionName()),l=e.projectionName()+"_center",{x:u,y:f}=n.project.hasChannel,d=u?.signals.visual,m=f?.signals.visual,p=u?s?.[u.index]:`${l}[0]`,g=f?s?.[f.index]:`${l}[1]`,h=t=>e.getSizeSignalRef(t).signal,y=`[[${d?`${d}[0]`:"0"}, ${m?`${m}[0]`:"0"}],[${d?`${d}[1]`:h("width")}, ${m?`${m}[1]`:h("height")}]]`;if(s&&(i.unshift({name:r+_u,init:`[scale(${c}, [${u?p[0]:p}, ${f?g[0]:g}]), scale(${c}, [${u?p[1]:p}, ${f?g[1]:g}])]`}),!u||!f)){i.find(e=>e.name===l)||i.unshift({name:l,update:`invert(${c}, [${h("width")}/2, ${h("height")}/2])`})}const v=`vlSelectionTuples(${`intersect(${y}, {markname: ${t.stringValue(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${Uf(e)}}`})`,b=a.map(e=>e.signals.visual);return i.concat({name:o,on:[{events:[...b.length?[{signal:b.join(" || ")}]:[],...s?[{signal:zu}]:[]],update:v}]})}{if(!ku.defined(n)){const n=r+Ou,o=a.map(n=>{const i=n.channel,{data:r,visual:o}=n.signals,a=t.stringValue(e.scaleName(i)),s=Hr(e.getScaleComponent(i).get("type"))?"+":"";return`(!isArray(${r}) || (${s}invert(${a}, ${o})[0] === ${s}${r}[0] && ${s}invert(${a}, ${o})[1] === ${s}${r}[1]))`});o.length&&i.push({name:n,value:{},on:[{events:a.map(t=>({scale:e.scaleName(t.channel)})),update:`${o.join(" && ")} ? ${n} : {}`}]})}const c=a.map(e=>e.signals.data),l=`unit: ${Uf(e)}, fields: ${r+ru}, values`;return i.concat({name:o,...s?{init:`{${l}: ${vu(s)}}`}:{},...c.length?{on:[{events:[{signal:c.join(" || ")}],update:`${c.join(" && ")} ? {${l}: [${c}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(Mp(e)&&e.hasProjection&&t.init){n.filter(e=>e.name===zu).length||n.unshift({name:zu,value:null,on:[{events:"timer{1}",update:`${zu} === null ? {} : ${zu}`}]})}return n},marks:(e,n,i)=>{const r=n.name,{x:o,y:a}=n.project.hasChannel,s=o?.signals.visual,c=a?.signals.visual,l=`data(${t.stringValue(n.name+Ef)})`;if(ku.defined(n)||!o&&!a)return i;const u={x:void 0!==o?{signal:`${s}[0]`}:{value:0},y:void 0!==a?{signal:`${c}[0]`}:{value:0},x2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==a?{signal:`${c}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const t of D(u))u[t]=[{test:`${l}.length && ${l}[0].unit === ${Uf(e)}`,...u[t]},{value:0}];const{fill:f,fillOpacity:d,cursor:m,...p}=n.mark,g=D(p).reduce((e,t)=>(e[t]=[{test:[void 0!==o&&`${s}[0] !== ${s}[1]`,void 0!==a&&`${c}[0] !== ${c}[1]`].filter(e=>e).join(" && "),value:p[t]},{value:null}],e),{}),h=m??(n.translate?"move":null);return[{name:`${r+Fu}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:u}},...i,{name:r+Fu,type:"rect",clip:!0,encode:{enter:{...h?{cursor:{value:h}}:{},fill:{value:"transparent"}},update:{...u,...g}}}]}};function Cu({model:e,channelDef:n,vgChannel:i,invalidValueRef:r,mainRefFn:o}){const a=xa(n)&&n.condition;let s=[];if(a){s=t.array(a).map(t=>{const n=o(t);if(function(e){return Z(e,"param")}(t)){const{param:i,empty:r}=t;return{test:Xf(e,{param:i,empty:r}),...n}}return{test:Qf(e,t.test),...n}})}void 0!==r&&s.push(r);const c=o(n);return void 0!==c&&s.push(c),s.length>1||1===s.length&&Boolean(s[0].test)?{[i]:s}:1===s.length?{[i]:s[0]}:{}}function Nu(e,t="text"){const n=e.encoding[t];return Cu({model:e,channelDef:n,vgChannel:t,mainRefFn:t=>Au(t,e.config),invalidValueRef:void 0})}function Au(e,t,n="datum"){if(e){if(Ca(e))return qn(e.value);if(_a(e)){const{format:i,formatType:r}=Ha(e);return Qo({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function ju(e,n={}){const{encoding:i,markDef:r,config:o,stack:a}=e,s=i.tooltip;if(t.isArray(s))return{tooltip:Eu({tooltip:s},a,o,n)};{const c=n.reactiveGeom?"datum.datum":"datum";return Cu({model:e,channelDef:s,vgChannel:"tooltip",mainRefFn:e=>{const s=Mu(e,o,c);if(s)return s;if(null===e)return;let l=Vn("tooltip",r,o);return!0===l&&(l={content:"encoding"}),t.isString(l)?{value:l}:t.isObject(l)?Pn(l)?l:"encoding"===l.content?Eu(i,a,o,n):{signal:c}:void 0},invalidValueRef:void 0})}}function Tu(e,n,i,{reactiveGeom:r}={}){const o={...i,...i.tooltipFormat},a=new Set,s=r?"datum.datum":"datum",c=[];function l(i,r){const l=st(r),u=Pa(i)?i:{...i,type:e[l].type},f=u.title||Va(u,o),d=t.array(f).join(", ").replaceAll(/"/g,'\\"');let m;if(At(r)){const t="x"===r?"x2":"y2",n=Ga(e[t]);if(wn(u.bin)&&n){const e=Ma(u,{expr:s}),i=Ma(n,{expr:s}),{format:r,formatType:c}=Ha(u);m=oa(e,i,r,c,o),a.add(t)}}if(!1===u.tooltip)return;const p=function(e,n,i){if(n!==Ae||!Z(e,"filter"))return;const{filter:r}=e;if(cn(e.aggregate)||ln(e.aggregate)||!e.field&&!La(e))return void Ri(gi);const o=ir(e.timeUnit),a={field:Ma(e),...o?{timeUnit:{...o,binned:!0}}:{}};let s=!0,c=0;const l=C(r,e=>{if(c++,t.isObject(e)){const t={...e,...a};if(gr(t)||pr(t))return yr(t,!0,i)}return s=!1,""});if(s&&c>0)return l;return void Ri(function(e){return`Ignoring an invalid tooltip filter: ${K(e)}.`}(r))}(u,r,s);if((At(r)||r===fe||r===le)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:e,formatType:t}=Ha(u);m=Qo({fieldOrDatumDef:u,format:e,formatType:t,expr:s,config:o,normalizeStack:!0}).signal}m??=Mu(u,o,s).signal,c.push({channel:r,key:d,value:m,test:p})}ws(e,(e,t)=>{ka(e)?l(e,t):$a(e)&&l(e.condition,t)});const u=[],f=new Set;for(const{channel:e,key:t,value:n,test:i}of c)a.has(e)||f.has(t)||(u.push({channel:e,key:t,value:n,test:i}),f.add(t));return u}function Eu(e,t,n,{reactiveGeom:i}={}){const r=Tu(e,t,n,{reactiveGeom:i});if(0===r.length)return;const o=({key:e,value:t})=>`{"${e}": ${t}}`;if(r.some(({test:e})=>!!e)){if(1===r.length)return{signal:`(${r[0].test}) ? ${o(r[0])} : null`};const e=`merge(${r.map(e=>e.test?`(${e.test}) ? ${o(e)} : {}`:o(e)).join(", ")})`;if(r.every(({test:e})=>!!e)){return{signal:`(${r.map(({test:e})=>`(${e})`).join(" || ")}) ? ${e} : null`}}return{signal:e}}return{signal:`{${r.map(({key:e,value:t})=>`"${e}": ${t}`).join(", ")}}`}}function Mu(e,t,n="datum"){if(ka(e)&&$r(e.type)&&!e.timeUnit&&!Ha(e).format&&!Ha(e).formatType){const t=`${n}["${e.field}"]`;return{signal:`isValid(${t}) ? isArray(${t}) ? join(${t}, '\\n') : ${t} : ""+${t}`}}return Au(e,t,n)}function Ru(e){const{markDef:t,config:n}=e,i=Vn("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...Lu(e),...qu(e)}}function Lu(e){const{mark:n,markDef:i,config:r}=e;if(!1===r.aria)return{};const o=Vn("ariaRoleDescription",i,r);return null!=o?{ariaRoleDescription:{value:o}}:t.hasOwnProperty(Tn,n)?{}:{ariaRoleDescription:{value:n}}}function qu(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return Cu({model:e,channelDef:o,vgChannel:"description",mainRefFn:t=>Au(t,e.config),invalidValueRef:void 0});const a=Vn("description",n,i);if(null!=a)return{description:qn(a)};if(!1===i.aria)return{};const s=Tu(t,r,i).filter(({key:e})=>!e.startsWith("_"));return 0!==s.length?{description:{signal:Uu(s)}}:void 0}function Uu(e){const t=e.map(({key:e,value:t,test:n})=>({key:e,value:t.replaceAll("\\n"," "),test:n}));if(t.every(({test:e})=>!e))return t.map(({key:e,value:t},n)=>`"${n>0?"; ":""}${e}: " + (${t})`).join(" + ");return`slice(${t.map(({key:e,value:t,test:n})=>{const i=`"; ${e}: " + (${t})`;return n?`((${n}) ? ${i} : "")`:i}).join(" + ")}, 2)`}function Wu(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:c}=n;const l=r[e];void 0===s&&(c??=Vn(e,i,o,{vgChannel:a,ignoreVgConfig:!xa(l)}),void 0!==c&&(s=qn(c)));const u={markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=Wo({...u,scaleChannel:e,channelDef:l});return Cu({model:t,channelDef:l,vgChannel:a??e,invalidValueRef:f,mainRefFn:t=>Go({...u,channel:e,channelDef:t,stack:null,defaultRef:s})})}function Iu(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??Vn("filled",n,r),s=p(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,c=Vn(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,l=Vn(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],u=a?"fill":"stroke",f={...c?{fill:qn(c)}:{},...l?{stroke:qn(l)}:{}};return n.color&&(a?n.fill:n.stroke)&&Ri(vi("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...Wu("color",e,{vgChannel:u,defaultValue:a?c:l}),...Wu("fill",e,{defaultValue:i.fill?c:void 0}),...Wu("stroke",e,{defaultValue:i.stroke?l:void 0})}}function Bu(e){const{encoding:t,mark:n}=e,i=t.order;return!ko(n)&&Ca(i)?Cu({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:e=>qn(e.value),invalidValueRef:void 0}):{}}function Vu({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,a=t[o],s=n[o];if(("xOffset"===o||"yOffset"===o)&&s){return{offsetType:"encoding",offset:Go({channel:o,channelDef:s,markDef:t,config:i?.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:qn(a),bandPosition:r})}}const c=t[o];return c?{offsetType:"visual",offset:c}:{}}function Hu(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:a,stack:s}=t,c=r[e],l=r[lt(e)],u=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:m}=Vu({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),p=Gu({model:t,defaultPos:n,channel:e,scaleName:u,scale:f}),g=!c&&At(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(_a(n)&&r&&t===r.fieldChannel){if(ka(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return Ho({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return Vo(n,i,{suffix:"end"},{offset:o})}return Bo(e)}({channel:e,channelDef:c,channel2Def:l,markDef:o,config:a,scaleName:u,scale:f,stack:s,offset:d,defaultRef:p,bandPosition:"encoding"===m?0:void 0});return g?{[i||e]:g}:void 0}function Gu({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:a}=e;return()=>{const s=st(n),c=ct(n),l=Vn(n,o,a,{vgChannel:c});if(void 0!==l)return Yo(n,l);switch(t){case"zeroOrMin":return Yu({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:s,config:a});case"zeroOrMax":return Yu({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:s,config:a});case"mid":return{...e[ut(n)],mult:.5}}}}function Yu({mainChannel:e,config:t,...n}){const i=Uo(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if("zeroOrMin"===r)return{value:0};const{widthSignal:e,heightSignal:t}=r.zeroOrMax;return{signal:`min(${e},${t})/2`}}case"theta":return"zeroOrMin"===r?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===r?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===r?{field:{group:"height"}}:{value:0}}}const Xu={left:"x",center:"xc",right:"x2"},Ju={top:"y",middle:"yc",bottom:"y2"};function Qu(e,t,n,i="middle"){if("radius"===e||"theta"===e)return ct(e);const r="x"===e?"align":"baseline",o=Vn(r,t,n);let a;return Pn(o)?(Ri(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?Xu[a||("top"===i?"left":"center")]:Ju[a||i]}function Ku(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?Zu(e,t,{defaultPos:n,defaultPos2:i}):Hu(e,t,{defaultPos:n})}function Zu(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,a=lt(e),s=ut(e),c=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,c=st(n),l=ut(n),u=ct(n),f=i[c],d=e.scaleName(c),m=e.getScaleComponent(c),{offset:p}=Vu(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:c,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=ut(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[u]:{field:e.getName(n)}}}const g=function({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:a,stack:s,offset:c,defaultRef:l}){if(_a(t)&&s&&e.charAt(0)===s.fieldChannel.charAt(0))return Vo(t,o,{suffix:"start"},{offset:c});return Bo({channel:e,channelDef:n,scaleName:o,scale:a,stack:s,markDef:i,config:r,offset:c,defaultRef:l})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:m,stack:a,offset:p,defaultRef:void 0});if(void 0!==g)return{[u]:g};return ef(n,o)||ef(n,{[n]:Gn(n,o,s.style),[l]:Gn(l,o,s.style)})||ef(n,s[r])||ef(n,s.mark)||(_a(f)&&e.isRangedOffset(c)?{[u]:Vo(f,d,{},{offset:Vo({datum:0},e.scaleName(dt(c)),{},{})})}:{[u]:Gu({model:e,defaultPos:t,channel:n,scaleName:d,scale:m})()})}(t,i,a);return{...Hu(e,t,{defaultPos:n,vgChannel:c[s]?Qu(e,r,o):ct(e)}),...c}}function ef(e,t){const n=ut(e),i=ct(e);if(void 0!==t[i])return{[i]:Yo(e,t[i])};if(void 0!==t[e])return{[i]:Yo(e,t[e])};if(t[n]){const i=t[n];if(!To(i))return{[n]:Yo(e,i)};Ri(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function tf(e,n){const{config:i,encoding:r,markDef:o}=e,a=o.type,s=lt(n),c=ut(n),l=r[n],u=r[s],f=e.getScaleComponent(n),d=f?f.get("type"):void 0,m=o.orient,p=r[c]??r.size??Vn("size",o,i,{vgChannel:c}),g=ft(n),h="bar"===a&&("x"===n?"vertical"===m:"horizontal"===m)||"tick"===a&&("y"===n?"vertical"===m:"horizontal"===m),y="image"===a;if(!ka(l)||!($n(l.bin)||wn(l.bin)||l.timeUnit&&!u)||p&&!To(p)||r[g]||Vr(d)){if(_a(l)&&e.isRangedOffset(n))return Zu(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"});if(y&&l&&!p&&!u){const t="x"===n?"align":"baseline",r=Vn(t,o,i)??("x"===n?"center":"middle");return{...Hu(n,e,{defaultPos:"mid"}),[t]:qn(r)}}return(_a(l)&&Vr(d)||h)&&!u?function(e,n,i){const{markDef:r,encoding:o,config:a,stack:s}=i,c=r.orient,l=i.scaleName(n),u=i.getScaleComponent(n),f=ut(n),d=lt(n),m=ft(n),p=i.scaleName(m),g=i.getScaleComponent(dt(n)),h="tick"===r.type||"horizontal"===c&&"y"===n||"vertical"===c&&"x"===n;let y;(o.size||r.size)&&(h?y=Wu("size",i,{vgChannel:f,defaultRef:qn(r.size)}):Ri(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(r.type)));const v=!!y,b=ya({channel:n,fieldDef:e,markDef:r,config:a,scaleType:(u||g)?.get("type"),useVlSizeChannel:h});y=y||{[f]:nf(f,p||l,g||u,a,b,!!e,r.type)};const x="band"===(u||g)?.get("type")&&To(b)&&!v?"top":"middle",$=Qu(n,r,a,x),w="xc"===$||"yc"===$,{offset:k,offsetType:S}=Vu({channel:n,markDef:r,encoding:o,model:i,bandPosition:w?.5:0}),D=w&&"encoding"!==S&&ka(e)&&e.timeUnit&&!o[d]?ha({fieldDef:e,markDef:r,config:a}):void 0,F=D??(w?"encoding"===S?0:.5:Pn(b)?{signal:`(1-${b})/2`}:To(b)?(1-b.band)/2:0),O=Bo({channel:n,channelDef:e,markDef:r,config:a,scaleName:l,scale:u,stack:s,offset:k,defaultRef:Gu({model:i,defaultPos:"mid",channel:n,scaleName:l,scale:u}),bandPosition:F});if(f)return{[$]:O,...y};{const e=ct(d),n=y[f],i=k?{...n,offset:k}:n;return{[$]:O,[e]:t.isArray(O)?[O[0],{...O[1],offset:i}]:{...O,offset:i}}}}(l,n,e):Zu(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}return function({fieldDef:e,fieldDef2:t,channel:n,model:i}){const{config:r,markDef:o,encoding:a}=i,s=i.getScaleComponent(n),c=i.scaleName(n),l=s?s.get("type"):void 0,u=s.get("reverse"),f=ya({channel:n,fieldDef:e,markDef:o,config:r,scaleType:l}),d=i.component.axes[n]?.[0],m=d?.get("translate")??.5,p=At(n)?Vn("binSpacing",o,r)??0:0,g=lt(n),h=ct(n),y=ct(g),v=Hn("minBandSize",o,r),{offset:b}=Vu({channel:n,markDef:o,encoding:a,model:i,bandPosition:0}),{offset:x}=Vu({channel:g,markDef:o,encoding:a,model:i,bandPosition:0}),$=function({scaleName:e,fieldDef:t}){const n=Ma(t,{expr:"datum"});return`abs(scale("${e}", ${Ma(t,{expr:"datum",suffix:"end"})}) - scale("${e}", ${n}))`}({fieldDef:e,scaleName:c}),w=rf(n,p,u,m,b,v,$),k=rf(g,p,u,m,x??b,v,$),S=Pn(f)?{signal:`(1-${f.signal})/2`}:To(f)?(1-f.band)/2:.5,D=ha({fieldDef:e,fieldDef2:t,markDef:o,config:r});if($n(e.bin)||e.timeUnit){const t=e.timeUnit&&.5!==D;return{[y]:of({fieldDef:e,scaleName:c,bandPosition:S,offset:k,useRectOffsetField:t}),[h]:of({fieldDef:e,scaleName:c,bandPosition:Pn(S)?{signal:`1-${S.signal}`}:1-S,offset:w,useRectOffsetField:t})}}if(wn(e.bin)){const n=Vo(e,c,{},{offset:k});if(ka(t))return{[y]:n,[h]:Vo(t,c,{},{offset:w})};if(kn(e.bin)&&e.bin.step)return{[y]:n,[h]:{signal:`scale("${c}", ${Ma(e,{expr:"datum"})} + ${e.bin.step})`,offset:w}}}return void Ri(ji(g))}({fieldDef:l,fieldDef2:u,channel:n,model:e})}function nf(e,n,i,r,o,a,s){if(To(o)){if(!i)return{mult:o.band,field:{group:e}};{const e=i.get("type");if("band"===e){let e=`bandwidth('${n}')`;1!==o.band&&(e=`${o.band} * ${e}`);const t=Hn("minBandSize",{type:s},r);return{signal:t?`max(${Wn(t)}, ${e})`:e}}1!==o.band&&Ri(function(e){return`Cannot use the relative band size with ${e} scale.`}(e))}}else{if(Pn(o))return o;if(o)return{value:o}}if(i){const e=i.get("range");if(Cn(e)&&t.isNumber(e.step))return{value:e.step-2}}if(!a){const{bandPaddingInner:n,barBandPaddingInner:i,rectBandPaddingInner:o,tickBandPaddingInner:a}=r.scale,c=I(n,"tick"===s?a:"bar"===s?i:o);if(Pn(c))return{signal:`(1 - (${c.signal})) * ${e}`};if(t.isNumber(c))return{signal:`${1-c} * ${e}`}}return{value:pc(r.view,e)-2}}function rf(e,t,n,i,r,o,a){if(Re(e))return 0;const s="x"===e||"y2"===e,c=s?-t/2:t/2;if(Pn(n)||Pn(r)||Pn(i)||o){const e=Wn(n),t=Wn(r),l=Wn(i),u=Wn(o),f=o?`(${a} < ${u} ? ${s?"":"-"}0.5 * (${u} - (${a})) : ${c})`:c;return{signal:(l?`${l} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-c:+r+c)}function of({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return Ho({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:Zl,endSuffix:eu}:{}})}const af=new Set(["aria","width","height"]);function sf(e,t){const{fill:n,stroke:i}="include"===t.color?Iu(e):{};return{...lf(e.markDef,t),...cf("fill",n),...cf("stroke",i),...Wu("opacity",e),...Wu("fillOpacity",e),...Wu("strokeOpacity",e),...Wu("strokeWidth",e),...Wu("strokeDash",e),...Bu(e),...ju(e),...Nu(e,"href"),...Ru(e)}}function cf(e,t){return t?{[e]:t}:{}}function lf(e,t){return jn.reduce((n,i)=>(af.has(i)||!Z(e,i)||"ignore"===t[i]||"tooltip"===i&&(!0===e.tooltip||Z(e.tooltip,"content"))||(n[i]=qn(e[i])),n),{})}function uf(e,t){const{markDef:n,config:i,encoding:r}=e,o=Vn("cornerRadiusEnd",n,i);if("bar"!==n.type||void 0===o||!n.orient)return{};if("horizontal"===n.orient?r.x2:r.y2)return void 0===n.cornerRadiusEnd&&void 0!==n.cornerRadius?{}:{cornerRadius:qn(o)};if("horizontal"===n.orient){const n=gf(t.x),i=gf(t.x2);return n&&i?df(e,o,`${n} > ${i}`,`${n} < ${i}`):{}}{const n=gf(t.y),i=gf(t.y2);return n&&i?mf(e,o,`${n} < ${i}`,`${n} > ${i}`):{}}}function ff(e,t,n,i){if(void 0===t)return{};const r=vf(n,i.minStart),o=vf(n,i.maxStart),a=vf(n,i.minEnd),s=vf(n,i.maxEnd);return"x"===e.stack.fieldChannel?df(e,t,`${s} > ${o}`,`${a} < ${r}`):mf(e,t,`${s} < ${o}`,`${a} > ${r}`)}function df(e,t,n,i){return{...pf(e,["cornerRadiusTopRight","cornerRadiusBottomRight"],n,t),...pf(e,["cornerRadiusTopLeft","cornerRadiusBottomLeft"],i,t)}}function mf(e,t,n,i){return{...pf(e,["cornerRadiusTopLeft","cornerRadiusTopRight"],n,t),...pf(e,["cornerRadiusBottomLeft","cornerRadiusBottomRight"],i,t)}}function pf(e,t,n,i){const{markDef:r,config:o}=e,a=qn(i),s=void 0!==r.cornerRadiusEnd;return t.reduce((e,t)=>{if(!s&&(void 0!==r[t]||void 0!==r.cornerRadius))return e;const i=Vn(t,r,o)??Vn("cornerRadius",r,o)??0;return e[t]=[{test:n,...a},qn(i)],e},{})}function gf(e){return Array.isArray(e)&&(e=e[e.length-1]),e?hf(e):void 0}function hf(e){let n;if(e.scale){const i=function(e){if(e.signal)return e.signal;if(void 0!==e.field)return yf(e.field);if(void 0!==e.value)return t.stringValue(e.value);return}(e);if(void 0===i)return;n=`scale(${t.stringValue(e.scale)}, ${i})`}else e.signal?n=`(${e.signal})`:void 0!==e.field?n=yf(e.field):void 0!==e.value&&(n=t.stringValue(e.value));if(void 0!==n){if(void 0!==e.mult&&(n=`${e.mult} * (${n})`),void 0!==e.offset){const i="number"==typeof e.offset?t.stringValue(e.offset):hf(e.offset);i&&(n=`${n} + ${i}`)}return n}}function yf(e){return"string"==typeof e?T(e):e.datum?T(e.datum,"datum"):e.parent?T(e.parent,"parent"):void 0}function vf(e,n){return`scale(${t.stringValue(e)}, ${T(n)})`}function bf(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef((r,o)=>{let a;if(!Zt(o)||!(a=e.getScaleType(o)))return;const s=yn(r.aggregate),c=qo({scaleChannel:o,markDef:n,config:t,scaleType:a,isCountAggregate:s});if("break-paths-filter-domains"===(l=c)||"break-paths-show-domains"===l){const t=e.vgField(o,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});t&&i.add(t)}var l}),i.size>0){return{defined:{signal:[...i].map(e=>vr(e,!0)).join(" && ")}}}}function xf(e,t){if(void 0!==t)return{[e]:qn(t)}}const $f="voronoi",wf={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName($f)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(ko(o))return Ri(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName($f),type:"path",interactive:!0,aria:!1,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...ju(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 s=0,c=!1;return n.forEach((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.includes($f)&&(c=!0)}),c||n.splice(s+1,0,a),n}},kf={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!nc(e.bind),parse:(e,t,n)=>If(t,n),topLevelSignals:(e,t,n)=>{const i=t.name,r=t.project,o=t.bind,a=t.init?.[0],s=wf.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((e,r)=>{const c=P(`${i}_${e.field}`);n.filter(e=>e.name===c).length||n.unshift({name:c,...a?{init:vu(a[r])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${T(e.field,s)} : null`}]:[],bind:o[e.field]??o[e.channel]??o})}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(e=>e.name===i+Mf),a=i+ru,s=r.items.map(e=>P(`${i}_${e.field}`)),c=s.map(e=>`${e} !== null`).join(" && ");return s.length&&(o.update=`${c} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},Sf="_toggle",Df={defined:e=>"point"===e.type&&!Bf(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Sf,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Mf,i=t.name+Sf;return`${i} ? null : ${n}, ${"global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${Uf(e)}}, `}${i} ? ${n} : null`}},Ff={defined:e=>void 0!==e.clear&&!1!==e.clear&&!Bf(e),parse:(e,n)=>{n.clear&&(n.clear=t.isString(n.clear)?t.parseSelector(n.clear,"view"):n.clear)},topLevelSignals:(e,t,n)=>{if(kf.defined(t))for(const e of t.project.items){const i=n.findIndex(n=>n.name===P(`${t.name}_${e.field}`));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return 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)for(const e of t.project.items){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+Mf);i(e,"null"),Df.defined(t)&&(e=n.findIndex(e=>e.name===t.name+Sf),i(e,"false"))}return n}},Of={defined:e=>{const t="global"===e.resolve&&e.bind&&nc(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==ec;return t&&!n&&Ri("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,n,i)=>{const r=c(i);if(r.select=t.isString(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},If(n,r),t.isObject(i.select)&&(i.select.on||i.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const i of n.events){const n=t.array(i.filter??[]);n.includes(e)||(i.filter=[...n,e])}}const o=ic(n.bind)?n.bind.legend:"click",a=t.isString(o)?t.parseSelector(o,"view"):[...t.array(o)];n.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=ic(t.bind)&&t.bind.legend,o=e=>t=>{const n=c(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${P(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter(e=>e.name===s).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(e=>e.name===i+Mf),a=i+ru,s=r.items.filter(e=>e.hasLegend).map(e=>P(`${i}_${P(e.field)}_legend`)),c=`${s.map(e=>`${e} !== null`).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map(e=>({signal:e})),update:c}):s.length>0&&(o.update=c,delete o.value,delete o.on);const l=n.find(e=>e.name===i+Sf),u=ic(t.bind)&&t.bind.legend;return l&&(t.events?l.on.push({...l.on[0],events:u}):l.on[0].events=u),n}};const zf="_translate_anchor",_f="_translate_delta",Pf={defined:e=>"interval"===e.type&&e.translate,signals:(e,n,i)=>{const r=n.name,o=ku.defined(n),a=r+zf,{x:s,y:c}=n.project.hasChannel;let l=t.parseSelector(n.translate,"scope");return o||(l=l.map(e=>(e.between[0].markname=r+Fu,e))),i.push({name:a,value:{},on:[{events:l.map(e=>e.between[0]),update:`{x: x(unit), y: y(unit)${void 0!==s?`, extent_x: ${o?Su(e,ie):`slice(${s.signals.visual})`}`:""}${void 0!==c?`, extent_y: ${o?Su(e,re):`slice(${c.signals.visual})`}`:""}}`}]},{name:r+_f,value:{},on:[{events:l,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),void 0!==s&&Cf(e,n,s,"width",i),void 0!==c&&Cf(e,n,c,"height",i),i}};function Cf(e,t,n,i,r){const o=t.name,a=o+zf,s=o+_f,c=n.channel,l=ku.defined(t),u=r.find(e=>e.name===n.signals[l?"data":"visual"]),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(c),m=d?.get("type"),p=d?.get("reverse"),g=`${a}.extent_${c}`,h=`${l&&d?"log"===m?"panLog":"symlog"===m?"panSymlog":"pow"===m?"panPow":"panLinear":"panLinear"}(${g}, ${`${l?c===ie?p?"":"-":p?"-":"":""}${s}.${c} / ${l?`${f}`:`span(${g})`}`}${l?"pow"===m?`, ${d.get("exponent")??1}`:"symlog"===m?`, ${d.get("constant")??1}`:"":""})`;u.on.push({events:{signal:s},update:l?h:`clampRange(${h}, 0, ${f})`})}const Nf="_zoom_anchor",Af="_zoom_delta",jf={defined:e=>"interval"===e.type&&e.zoom,signals:(e,n,i)=>{const r=n.name,o=ku.defined(n),a=r+Af,{x:s,y:c}=n.project.hasChannel,l=t.stringValue(e.scaleName(ie)),u=t.stringValue(e.scaleName(re));let f=t.parseSelector(n.zoom,"scope");return o||(f=f.map(e=>(e.markname=r+Fu,e))),i.push({name:r+Nf,on:[{events:f,update:o?`{${[l?`x: invert(${l}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter(e=>e).join(", ")}}`:"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&Tf(e,n,s,"width",i),void 0!==c&&Tf(e,n,c,"height",i),i}};function Tf(e,t,n,i,r){const o=t.name,a=n.channel,s=ku.defined(t),c=r.find(e=>e.name===n.signals[s?"data":"visual"]),l=e.getSizeSignalRef(i).signal,u=e.getScaleComponent(a),f=u?.get("type"),d=s?Su(e,a):c.name,m=o+Af,p=`${s&&u?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${o}${Nf}.${a}`}, ${m}${s?"pow"===f?`, ${u.get("exponent")??1}`:"symlog"===f?`, ${u.get("constant")??1}`:"":""})`;c.on.push({events:{signal:m},update:s?p:`clampRange(${p}, 0, ${l})`})}const Ef="_store",Mf="_tuple",Rf="_modify",Lf="vlSelectionResolve",qf=[hu,Pu,au,Df,kf,ku,Of,Ff,Pf,jf,wf];function Uf(e,{escape:n}={escape:!0}){let i=n?t.stringValue(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!Rp(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const n of He)e[n]&&(i+=` + '__facet_${n}_' + (facet[${t.stringValue(r.vgField(n))}])`)}return i}function Wf(e){return F(e.component.selection??{}).reduce((e,t)=>e||t.project.hasSelectionId,!1)}function If(e,n){!t.isString(n.select)&&n.select.on||delete e.events,!t.isString(n.select)&&n.select.clear||delete e.clear,!t.isString(n.select)&&n.select.toggle||delete e.toggle}function Bf(e){return e.events?.find(e=>"type"in e&&"timer"===e.type)}function Vf(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...Vf(e.object)),t.push(...Vf(e.property))),t)}function Hf(e){return"MemberExpression"===e.object.type?Hf(e.object):"datum"===e.object.name}function Gf(e){const n=t.parseExpression(e),i=new Set;return n.visit(e=>{"MemberExpression"===e.type&&Hf(e)&&i.add(Vf(e).slice(1).join("."))}),i}class Yf extends Yl{model;filter;expr;_dependentFields;clone(){return new Yf(null,this.model,c(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,this.expr=Qf(this.model,this.filter,this),this._dependentFields=Gf(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Xf(e,n,i,r="datum"){const o=t.isString(n)?n:n.param,a=P(o),s=t.stringValue(a+Ef);let c;try{c=e.getSelectionComponent(a,o)}catch{return`!!${a}`}if(c.project.timeUnit){const t=i??e.component.data.raw,n=c.project.timeUnit.clone();t.parent?n.insertAsParentOf(t):t.parent=n}const l=`${c.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${s}, ${r}${"global"===c.resolve?")":`, ${t.stringValue(c.resolve)})`}`,u=`length(data(${s}))`;return!1===n.empty?`${u} && ${l}`:`!${u} || ${l}`}function Jf(e,n,i){const r=P(n),o=i.encoding;let a,s=i.field;try{a=e.getSelectionComponent(r,n)}catch{return r}if(o||s){if(o&&!s){const e=a.project.items.filter(e=>e.channel===o);!e.length||e.length>1?(s=a.project.items[0].field,Ri(function(e,n,i,r){return`${e.length?"Multiple ":"No "}matching ${t.stringValue(n)} encoding found for selection ${t.stringValue(i.param)}. Using "field": ${t.stringValue(r)}.`}(e,o,i,s))):s=e[0].field}}else s=a.project.items[0].field,a.project.items.length>1&&Ri(function(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${t.stringValue(e)}.`}(s));return`${a.name}[${t.stringValue(L(s))}]`}function Qf(e,n,i){return C(n,n=>t.isString(n)?n:function(e){return Z(e,"param")}(n)?Xf(e,n,i):yr(n))}function Kf(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}function Zf(e,n,i,r={header:!1}){const{disable:o,orient:a,scale:s,labelExpr:c,title:l,zindex:u,...f}=e.combine();if(!o){for(const e in f){const i=e,r=ss[i],o=f[i];if(r&&r!==n&&"both"!==r)delete f[i];else if(os(o)){const{condition:e,...n}=o,r=t.array(e),a=rs[i];if(a){const{vgProp:e,part:t}=a;Kf(f,t,e,[...r.map(e=>{const{test:t,...n}=e;return{test:Qf(null,t),...n}}),n]),delete f[i]}else if(null===a){const e={signal:r.map(e=>{const{test:t,...n}=e;return`${Qf(null,t)} ? ${Un(n)} : `}).join("")+Un(n)};f[i]=e}}else if(Pn(o)){const e=rs[i];if(e){const{vgProp:t,part:n}=e;Kf(f,n,t,o),delete f[i]}}p(["labelAlign","labelBaseline"],i)&&null===f[i]&&delete f[i]}if("grid"===n){if(!f.grid)return;if(f.encode){const{grid:e}=f.encode;f.encode={...e?{grid:e}:{}},S(f.encode)&&delete f.encode}return{scale:s,orient:a,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:I(u,0)}}{if(!r.header&&e.mainExtracted)return;if(void 0!==c){let e=c;f.encode?.labels?.update&&Pn(f.encode.labels.update.text)&&(e=q(c,"datum.label",f.encode.labels.update.text.signal)),Kf(f,"labels","text",{signal:e})}if(null===f.labelAlign&&delete f.labelAlign,f.encode){for(const t of as)e.hasAxisPart(t)||delete f.encode[t];S(f.encode)&&delete f.encode}const n=function(e,n){if(e)return t.isArray(e)&&!_n(e)?e.map(e=>Va(e,n)).join(", "):e}(l,i);return{scale:s,orient:a,grid:!1,...n?{title:n}:{},...f,...!1===i.aria?{aria:!1}:{},zindex:I(u,0)}}}}function ed(e){const{axes:t}=e.component,n=[];for(const i of Nt)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function td(e,t,n,i){return Object.assign.apply(null,[{},...e.map(e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...D(r),...D(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${Wn(r[t])} : ${Wn(o[t])}`};return s}return t[e]})])}function nd(e,n){const i=[];for(const r of e){let e=n[r]?.style;if(e){e=t.array(e);for(const t of e)i.push(n.style[t])}}return Object.assign({},...i)}function id(e,t,n,i={}){const r=Yn(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const rd={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??function(e,t){return!Vr(e)&&ka(t)&&!$n(t?.bin)&&!wn(t?.bin)}(n,e),gridScale:({model:e,channel:t})=>function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||cd(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||sd(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??function(e,t){if("x"===t&&p(["quantitative","temporal"],e))return!0;return}(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:n,scaleType:i})=>e.labelOverlap??function(e,n,i,r){if(i&&!t.isObject(r)||"nominal"!==e&&"ordinal"!==e)return"log"!==n&&"symlog"!==n||"greedy";return}(n.type,i,ka(n)&&!!n.timeUnit,ka(n)?n.sort:void 0),bandPosition:({axis:e,model:t,channel:n})=>e.bandPosition??od(t,n),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o="x"===e?"width":"y"===e?"height":void 0,a=o?t.getSizeSignalRef(o):void 0;return n.tickCount??function({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){if(!i&&!Vr(t)&&"log"!==t){if(ka(e)){if($n(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&p(["month","hours","day","quarter"],ir(e.timeUnit)?.unit))return}return{signal:`ceil(${n.signal}/40)`}}return}({fieldOrDatumDef:i,scaleType:r,size:a,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??function({format:e,fieldOrDatumDef:t}){if("d"===e)return 1;if(ka(t)){const{timeUnit:e}=t;if(e){const t=rr(e);if(t)return{signal:t}}}return}({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(void 0!==e.title)return e.title;const i=ld(t,n);if(void 0!==i)return i;const r=t.typedFieldDef(n),o="x"===n?"x2":"y2",a=t.fieldDef(o);return Jn(r?[pa(r)]:[],ka(a)?[pa(a)]:[])},values:({axis:e,fieldOrDatumDef:n})=>function(e,n){const i=e.values;if(t.isArray(i))return ns(n,i);if(Pn(i))return i;return}(e,n),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??function(e,t){if("rect"===e&&Ra(t))return 1;return 0}(n,t)};function od(e,t){if(e.isRangedOffset(t))return"x"===t?0:1}function ad(e){return`(((${e.signal} % 360) + 360) % 360)`}function sd(e,t,n,i){if(void 0!==e){if("x"===n){if(Pn(e)){const n=ad(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${Pn(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(Pn(t)){const n=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${n} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==("top"===t)?"bottom":"top"}if(Pn(e)){const n=ad(e);return{signal:`${n} <= 45 || 315 <= ${n} || (135 <= ${n} && ${n} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${n} && ${n} <= 135) === ${Pn(t)?`(${t.signal} === "left")`:"left"===t} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(Pn(t)){const n=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${n} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==("left"===t)?"top":"bottom"}}function cd(e,t,n){if(void 0===e)return;const i="x"===n,r=i?0:90,o=i?"bottom":"left";if(Pn(e)){const n=ad(e);return{signal:`(${r?`(${n} + 90)`:n} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${n} && ${n} < ${180+r}) === ${Pn(t)?`(${t.signal} === "${o}")`:t===o} ? "left" : "right"`}}if((e+r)%180==0)return i?null:"center";if(Pn(t)){const n=r<e&&e<180+r?"===":"!==";return{signal:`${`${t.signal} ${n} "${o}"`} ? "left" : "right"`}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function ld(e,t){const n="x"===t?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,a=r?r.title:void 0;return o&&a?Qn(o,a):o||(a||(void 0!==o?o:void 0!==a?a:void 0))}class ud extends Yl{transform;_dependentFields;clone(){return new ud(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this._dependentFields=Gf(this.transform.calculate)}static parseAllForSortIndex(e,t){return t.forEachFieldDef((t,n)=>{if(Na(t)&&ua(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map((e,t)=>`${yr({field:i,timeUnit:r,equal:e})} ? ${t} : `).join("")+o.length;e=new ud(e,{calculate:a,as:fd(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 ${d(this.transform)}`}}function fd(e,t,n){return Ma(e,{prefix:t,suffix:"sort_index",...n})}function dd(e,t){return p(["top","bottom"],t)?"column":p(["left","right"],t)||"row"===e?"row":"column"}function md(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return I((t||{})[e],r[e],n.header[e])}function pd(e,t,n,i){const r={};for(const o of e){const e=md(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const gd=["row","column"],hd=["header","footer"];function yd(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:a,titleOrient:s}=pd(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),c=dd(t,s),l=Y(a);return{name:`${t}-title`,type:"group",role:`${c}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...bd(l,c),...vd(c,l,o),...Fd(i,r,t,Js,Ys)}}}function vd(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=cd(t,"row"===e?"left":"top","row"===e?"y":"x");return i?{align:i}:{}}function bd(e,t){const n=sd(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function xd(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of hd)if(n[r])for(const o of n[r]){const a=kd(e,t,r,n,o);null!=a&&i.push(a)}return i}function $d(e,n){const{sort:i}=e;return la(i)?{field:Ma(i,{expr:"datum"}),order:i.order??"ascending"}:t.isArray(i)?{field:fd(e,n,{expr:"datum"}),order:"ascending"}:{field:Ma(e,{expr:"datum"}),order:i??"ascending"}}function wd(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:c}=pd(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=Qo({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,u=dd(t,s);return{text:{signal:c?q(q(c,"datum.label",l),"datum.value",Ma(e,{expr:"parent"})):l},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...bd(o,u),...vd(u,o,a),...Fd(n,e,t,Qs,Xs)}}function kd(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=pd(["labelOrient"],a.header,s,t);("row"===t&&!p(["top","bottom"],e)||"column"===t&&!p(["left","right"],e))&&(o=wd(a,t,s))}const c=Rp(e)&&!fa(e.facet),l=r.axes,u=l?.length>0;if(o||u){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:$d(a,t)}:{},...u&&c?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...u?{axes:l}:{}}}}return null}const Sd={column:{start:0,end:1},row:{start:1,end:0}};function Dd(e,t){return Sd[t][e]}function Fd(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=md(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function Od(e){return[...zd(e,"width"),...zd(e,"height"),...zd(e,"childWidth"),...zd(e,"childHeight")]}function zd(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(null==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(Vr(i)&&Cn(o)){const i=e.scaleName(n);if(Rp(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[_d(i,o)]}return[_d(i,o),{name:r,update:Pd(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} : ${mc(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"},{update:i,events:"container:resize"}]}]}return[{name:r,value:i}]}function _d(e,t){const n=`${e}_step`;return Pn(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function Pd(e,t,n){const i=t.get("type"),r=t.get("padding"),o=I(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${Wn(a)}, ${Wn(o)}) * ${e}_step`}function Cd(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function Nd(e,t){return D(e).reduce((n,i)=>({...n,...Cu({model:t,channelDef:e[i],vgChannel:i,mainRefFn:e=>qn(e.value),invalidValueRef:void 0})}),{})}function Ad(e,t){if(Rp(t))return"theta"===e?"independent":"shared";if(qp(t))return"shared";if(Lp(t))return At(e)||Rt(e)||Re(e)?"independent":"shared";throw new Error("invalid model type for resolve")}function jd(e,t){const n=e.scale[t],i=At(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&Ri(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.`}(t)),"independent"):e[i][t]||"shared"}const Td=D({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description: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,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class Ed extends Nl{}const Md={symbols:function(e,{fieldOrDatumDef:n,model:i,channel:r,legendCmpt:o,legendType:a}){if("symbol"!==a)return;const{markDef:s,encoding:c,config:l,mark:u}=i,f=s.filled&&"trail"!==u;let d={...In({},i,Po),...Iu(i,{filled:f})};const m=o.get("symbolOpacity")??l.legend.symbolOpacity,p=o.get("symbolFillColor")??l.legend.symbolFillColor,g=o.get("symbolStrokeColor")??l.legend.symbolStrokeColor,h=void 0===m?Rd(c.opacity)??s.opacity:void 0;if(d.fill)if("fill"===r||f&&r===ve)delete d.fill;else if(Z(d.fill,"field"))p?delete d.fill:(d.fill=qn(l.legend.symbolBaseFillColor??"black"),d.fillOpacity=qn(h??1));else if(t.isArray(d.fill)){const e=Ld(c.fill??c.color)??s.fill??(f&&s.color);e&&(d.fill=qn(e))}if(d.stroke)if("stroke"===r||!f&&r===ve)delete d.stroke;else if(Z(d.stroke,"field")||g)delete d.stroke;else if(t.isArray(d.stroke)){const e=I(Ld(c.stroke||c.color),s.stroke,f?s.color:void 0);e&&(d.stroke={value:e})}if(r!==Se){const e=ka(n)&&Ud(i,o,n);e?d.opacity=[{test:e,...qn(h??1)},qn(l.legend.unselectedOpacity)]:h&&(d.opacity=qn(h))}return d={...d,...e},S(d)?void 0:d},gradient:function(e,{model:t,legendType:n,legendCmpt:i}){if("gradient"!==n)return;const{config:r,markDef:o,encoding:a}=t;let s={};const c=void 0===(i.get("gradientOpacity")??r.legend.gradientOpacity)?Rd(a.opacity)||o.opacity:void 0;c&&(s.opacity=qn(c));return s={...s,...e},S(s)?void 0:s},labels:function(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},a=n.config,s=ka(t)?Ud(n,r,t):void 0,c=s?[{test:s,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:l,formatType:u}=o;let f;Xo(u)?f=Zo({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:u,config:a}):void 0===l&&void 0===u&&a.customFormatTypes&&("quantitative"===t.type&&a.numberFormatType?f=Zo({fieldOrDatumDef:t,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===t.type&&a.timeFormatType&&ka(t)&&void 0===t.timeUnit&&(f=Zo({fieldOrDatumDef:t,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...c?{opacity:c}:{},...f?{text:f}:{},...e};return S(d)?void 0:d},entries:function(e,{legendCmpt:t}){const n=t.get("selections");return n?.length?{...e,fill:{value:"transparent"}}:e}};function Rd(e){return qd(e,(e,t)=>Math.max(e,t.value))}function Ld(e){return qd(e,(e,t)=>I(e,t.value))}function qd(e,n){return function(e){const n=e?.condition;return!!n&&(t.isArray(n)||Ca(n))}(e)?t.array(e.condition).reduce(n,e.value):Ca(e)?e.value:void 0}function Ud(e,n,i){const r=n.get("selections");if(!r?.length)return;const o=t.stringValue(i.field);return r.map(e=>`(!length(data(${t.stringValue(P(e)+Ef)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`).join(" || ")}const Wd={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return ea(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return ta(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:s,gradientVerticalMinLength:c}=e;if(Gr(r))return"horizontal"===n?"top"===i||"bottom"===i?Vd(t,"width",a,o):a:Vd(t,"height",c,s);return}(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??function(e){if(p(["quantile","threshold","log","symlog"],e))return"greedy";return}(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??function(e,t,n,i){if("shape"!==t){const e=Ld(n)??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"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>Ia(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(Be(n)&&Gr(t)){if("gradient"===e)return}else if("symbol"===e)return;return e},values:({fieldOrDatumDef:e,legend:n})=>function(e,n){const i=e.values;if(t.isArray(i))return ns(n,i);if(Pn(i))return i;return}(n,e)};function Id(e){const{legend:t}=e;return I(t.type,function({channel:e,timeUnit:t,scaleType:n}){if(Be(e)){if(p(["quarter","month","day"],t))return"symbol";if(Gr(n))return"gradient"}return"symbol"}(e))}function Bd({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"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}}(n,t)}function Vd(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function Hd(e){const t=Mp(e)?function(e){const{encoding:t}=e,n={};for(const i of[ve,...Zs]){const r=Ya(t[i]);r&&e.getScaleComponent(i)&&(i===$e&&ka(r)&&r.type===Fr||(n[i]=Yd(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){Hd(i);for(const r of D(i.component.legends))n.legend[r]=jd(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=Xd(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of D(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function Gd(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function Yd(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new Ed({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){const i=e.fieldDef(t)?.field;for(const r of F(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&Of.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const c=void 0!==n?!n:a.disable;if(s.set("disable",c,void 0!==n),c)return s;n=n||{};const l=e.getScaleComponent(t).get("type"),u=Ya(r[t]),f=ka(u)?ir(u.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",m=Id({legend:n,channel:t,timeUnit:f,scaleType:l}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:u,legendConfig:a,config:o,scaleType:l,orient:d,legendType:m,direction:Bd({legend:n,legendType:m,orient:d,legendConfig:a})};for(const i of Td){if("gradient"===m&&i.startsWith("symbol")||"symbol"===m&&i.startsWith("gradient"))continue;const r=i in Wd?Wd[i](p):n[i];if(void 0!==r){const a=Gd(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const g=n?.encoding??{},h=s.get("selections"),y={},v={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:m};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=Nd(g[t]??{},e),i=t in Md?Md[t](n,v):n;void 0===i||S(i)||(y[t]={...h?.length&&ka(u)?{name:`${P(u.field)}_legend_${t}`}:{},...h?.length?{interactive:!0}:{},update:h?.length?{...i,cursor:{value:"pointer"}}:i})}return S(y)||s.set("encode",y,!!n?.encoding),s}function Xd(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of Td){const i=Ml(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",(e,t)=>{switch(n){case"symbolType":return Jd(e,t);case"title":return Kn(e,t);case"type":return r=!0,jl("symbol")}return El(e,t,n,"legend")});e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&N(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&N(e.explicit,["encode","gradient"])),e}function Jd(e,t){return"circle"===t.value?t:e}function Qd(e,t,n,i){if(is(t,n)){const r=Mp(e)?e.axis(n)??e.legend(n)??{}:{},o=Ma(t,{expr:"datum"}),a=Ma(t,{expr:"datum",binSuffix:"end"});return{formulaAs:Ma(t,{binSuffix:"range",forAs:!0}),formula:oa(o,a,r.format,r.formatType,i)}}return{}}function Kd(e,t){return`${xn(e)}_${t}`}function Zd(e,t,n){const i=Kd(Ka(n,void 0)??{},t);return e.getName(`${i}_bins`)}function em(e,n,i){let r,o;r=function(e){return"as"in e}(e)?t.isString(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[Ma(e,{forAs:!0}),Ma(e,{binSuffix:"end",forAs:!0})];const a={...Ka(n,void 0)},s=Kd(a,e.field),{signal:c,extentSignal:l}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(i,s);if(Sn(a.extent)){const e=a.extent;o=Jf(i,e.param,e),delete a.extent}return{key:s,binComponent:{bin:a,field:e.field,as:[r],...c?{signal:c}:{},...l?{extentSignal:l}:{},...o?{span:o}:{}}}}class tm extends Yl{bins;clone(){return new tm(null,c(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef((e,n,i)=>{if(Pa(n)&&$n(n.bin)){const{key:r,binComponent:o}=em(n,n.bin,t);e[r]={...o,...e[r],...Qd(t,n,i,t.config)}}return e},{});return S(n)?null:new tm(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=em(t,t.bin,n);return new tm(e,{[i]:r})}merge(e,t){for(const n of D(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=b([...this.bins[n].as,...e.bins[n].as],d)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(F(this.bins).map(e=>e.as).flat(2))}dependentFields(){return new Set(F(this.bins).map(e=>e.field))}hash(){return`Bin ${d(this.bins)}`}assemble(){return F(this.bins).flatMap(e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:L(e.field),as:n,signal:e.signal,...Sn(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:L(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:Ma({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t})}}function nm(e,n,i,r){const o=Mp(r)?r.encoding[lt(n)]:void 0;if(Pa(i)&&Mp(r)&&va(i,o,r.markDef,r.config)){e.add(Ma(i,{})),e.add(Ma(i,{suffix:"end"}));const{mark:t,markDef:o,config:a}=r,s=ha({fieldDef:i,markDef:o,config:a});Do(t)&&.5!==s&&At(n)&&(e.add(Ma(i,{suffix:Zl})),e.add(Ma(i,{suffix:eu}))),i.bin&&is(i,n)&&e.add(Ma(i,{binSuffix:"range"}))}else if(Ue(n)){const t=qe(n);e.add(r.getName(t))}else e.add(Ma(i));return Na(i)&&function(e){return t.isObject(e)&&"field"in e}(i.scale?.range)&&e.add(i.scale.range.field),e}class im extends Yl{dimensions;measures;clone(){return new im(null,new Set(this.dimensions),c(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}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)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??={},i["*"].count={aliases:new Set([Ma(e,{forAs:!0})])};else{if(cn(o)||ln(o)){const e=cn(o)?"argmin":"argmax",t=o[e];i[t]??={},i[t][e]={aliases:new Set([Ma({op:e,field:t},{forAs:!0})])}}else dn(o)?(i[a]??={},i[a][mn(o)]={aliases:new Set([Ma(e,{forAs:!0})]),aggregateParam:pn(o)}):(i[a]??={},i[a][o]={aliases:new Set([Ma(e,{forAs:!0})])});Zt(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??={},i[a].min={aliases:new Set([Ma({field:a,aggregate:"min"},{forAs:!0})])},i[a].max={aliases:new Set([Ma({field:a,aggregate:"max"},{forAs:!0})])})}else nm(r,n,e,t)}),r.size+D(i).length===0?null:new im(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;if(t){const o=r||Ma(e,{forAs:!0});if("count"===t)i["*"]??={},i["*"].count={aliases:new Set([o])};else{const e=mn(t);i[n]??={},i[n][e]??={aliases:new Set,aggregateParam:pn(t)},i[n][e].aliases.add(o)}}}for(const e of t.groupby??[])n.add(e);return n.size+D(i).length===0?null:new im(e,n,i)}merge(e){return x(this.dimensions,e.dimensions)?(function(e,t){for(const n of D(t)){const i=t[n];for(const t of D(i))if(n in e){const r=e[n][t]?.aggregateParam,o=i[t].aggregateParam;void 0!==r&&void 0!==o&&r!==o&&Ri(mi(t,n,r,o)),e[n][t]={aliases:new Set([...e[n][t]?.aliases??[],...i[t].aliases]),aggregateParam:o??r}}else e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(...e){Ei.debug(...e)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...D(this.measures)])}producedFields(){const e=new Set;for(const t of D(this.measures))for(const n of D(this.measures[t])){const i=this.measures[t][n].aliases;0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${d({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of D(this.measures))for(const o of D(this.measures[r]))for(const a of this.measures[r][o].aliases)n.push(a),e.push(o),t.push("*"===r?null:L(r)),i.push(this.measures[r][o].aggregateParam??null);const r={type:"aggregate",groupby:[...this.dimensions].map(L),ops:e,fields:t,as:n};return i.some(e=>"number"==typeof e)&&(r.aggregate_params=i),r}}function rm(e){const{row:t,column:n}=e;return!(!t||!n||!om(t)&&!om(n))}function om(e){return!!e&&(la(e.sort)||t.isArray(e.sort))}function am(e,t){return e.getName(`${t}_facet_key`)}function sm(e,t){const n=[Ma(e,{expr:t})];return $n(e.bin)&&n.push(Ma(e,{expr:t,binSuffix:"end"})),`join([${n.map(e=>`isValid(${e}) ? length(toString(${e})) + ':' + toString(${e}) : '-1:'`).join(", ")}], '|')`}class cm extends Yl{model;name;data;column;row;facet;childModel;constructor(e,n,i,r){super(e),this.model=n,this.name=i,this.data=r;for(const e of He){const i=n.facet[e];if(i){const{bin:r,sort:o}=i;this[e]={name:n.getName(`${e}_domain`),fields:[Ma(i),...$n(r)?[Ma(i,{binSuffix:"end"})]:[]],...la(o)?{sortField:o}:t.isArray(o)?{sortIndexField:fd(i,e)}:{}}}}this.childModel=n.child}hash(){let e="Facet";for(const t of He)this[t]&&(e+=` ${t.charAt(0)}:${d(this[t])}`);return e}get fields(){const e=[];for(const t of He)this[t]?.fields&&e.push(...this[t].fields);return e}get sortIndexFields(){const e=[];for(const t of He){const n=this[t]?.sortIndexField;n&&e.push(n)}return e}get canMoveBelowAggregate(){for(const e of He){const t=this[e];if(t&&(t.sortField||t.sortIndexField&&$n(this.model.facet[e].bin)))return!1}return!0}dependentFields(){const e=new Set(this.fields);for(const t of He)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 Nt){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(Vr(i)&&Cn(r)){const n=tp(np(this.childModel,t));n?e[t]=n:Ri(ri(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:c}=this[e];if(s){const{op:e=aa,field:t}=s;r.push(t),o.push(e),a.push(Ma(s,{forAs:!0}))}else c&&(r.push(c),o.push("max"),a.push(c));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of gd){for(const t of hd){const i=n[e]?.[t]??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assembleFacetLookupDomainData(e){const t=this[e];return t&&(t.sortField||t.sortIndexField)?{name:this.model.getName(`${e}_lookup_domain`),source:t.name,transform:[{type:"formula",expr:sm(this.model.facet[e],"datum"),as:am(this.model,e)}]}:null}assembleFacetSortLookupData(){return[ee,te].map(e=>this.assembleFacetLookupDomainData(e)).filter(e=>null!==e)}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map(()=>"distinct");e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[te,ee])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(rm(this.model.facet)&&e.push(...this.assembleFacetSortLookupData()),o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function lm(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function um(e){const n={};return a(e.filter,e=>{if(gr(e)){let i=null;sr(e)?i=Rn(e.equal):lr(e)?i=Rn(e.lte):cr(e)?i=Rn(e.lt):ur(e)?i=Rn(e.gt):fr(e)?i=Rn(e.gte):dr(e)?i=e.range[0]:mr(e)&&(i=(e.oneOf??e.in)[0]),i&&(Li(i)?n[e.field]="date":t.isNumber(i)?n[e.field]="number":t.isString(i)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}}),n}function fm(e){const n={};function i(e){var i;es(e)?n[e.field]="date":"quantitative"===e.type&&(i=e.aggregate,t.isString(i)&&p(["min","max"],i))?n[e.field]="number":W(e.field)>1?e.field in n||(n[e.field]="flatten"):Na(e)&&la(e.sort)&&W(e.sort.field)>1&&(e.sort.field in n||(n[e.sort.field]="flatten"))}if((Mp(e)||Rp(e))&&e.forEachFieldDef((t,n)=>{if(Pa(t))i(t);else{const r=st(n),o=e.fieldDef(r);i({...t,type:o.type})}}),Mp(e)){const{mark:t,markDef:i,encoding:r}=e;if(ko(t)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];ka(e)&&"quantitative"===e.type&&!(e.field in n)&&(n[e.field]="number")}}return n}class dm extends Yl{_parse;clone(){return new dm(null,c(this._parse))}constructor(e,t){super(e),this._parse=t}hash(){return`Parse ${d(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!Wl(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of D(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]:Ri(fi(e,n[e],t.value)))}for(const e of D(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:Ri(fi(e,t[e],n)))}const r=new Nl(t,n);i.copyAll(r);const o={};for(const e of D(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===D(o).length||i.parseNothing?null:new dm(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of D(this._parse)){const n=this._parse[t];1===W(t)&&(e[t]=n)}return e}producedFields(){return new Set(D(this._parse))}dependentFields(){return new Set(D(this._parse))}assembleTransforms(e=!1){return D(this._parse).filter(t=>!e||W(t)>1).map(e=>{const t=function(e,t){const n=j(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(t.startsWith("date:"))return`timeParse(${n},'${lm(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${lm(t.slice(4,t.length))}')`;return Ri(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:U(e)}}).filter(e=>null!==e)}}class mm extends Yl{clone(){return new mm(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([ec])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:ec}}}class pm extends Yl{params;clone(){return new pm(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${d(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class gm extends Yl{params;clone(){return new gm(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${d(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class hm extends Yl{_data;_name;_generator;constructor(e){let t;if(super(null),e??={name:"source"},Wl(e)||(t=e.format?{...f(e.format,["parse"])}:{}),ql(e))this._data={values:e.values};else if(Ll(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];p(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else Bl(e)?this._data={values:[{type:"Sphere"}]}:(Ul(e)||Wl(e))&&(this._data={});this._generator=Wl(e),e.name&&(this._name=e.name),t&&!S(t)&&(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{name:this._name,...this._data,transform:[]}}}function ym(e){return e instanceof hm||e instanceof pm||e instanceof gm}class vm{#e;constructor(){this.#e=!1}setModified(){this.#e=!0}get modifiedFlag(){return this.#e}}class bm extends vm{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort((e,t)=>t[1]-e[1]);for(const e of t)this.run(e[0]);return this.modifiedFlag}}class xm extends vm{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class $m extends xm{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 D(n))n[t].length>1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class wm extends xm{requiresSelectionId;constructor(e){super(),this.requiresSelectionId=e&&Wf(e)}run(e){e instanceof mm&&(this.requiresSelectionId&&(ym(e.parent)||e.parent instanceof im||e.parent instanceof dm)||(this.setModified(),e.remove()))}}class km extends vm{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof Kl&&(n=e.producedFields(),$(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class Sm extends xm{constructor(){super()}run(e){e instanceof Xl&&!e.isRequired()&&(this.setModified(),e.remove())}}class Dm extends bm{run(e){if(!(ym(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof dm)if(e instanceof dm)this.setModified(),e.merge(t);else{if(k(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class Fm extends bm{run(e){const t=[...e.children],n=e.children.filter(e=>e instanceof dm);if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of D(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!S(i)){this.setModified();const n=new dm(e,i);for(const r of t){if(r instanceof dm)for(const e of D(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof dm&&0===D(r.parse).length&&r.remove()}}}}}class Om extends bm{run(e){e instanceof Xl||e.numChildren()>0||e instanceof cm||e instanceof hm||(this.setModified(),e.remove())}}class zm extends bm{run(e){const t=e.children.filter(e=>e instanceof Kl),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class _m extends bm{run(e){const t=e.children.filter(e=>e instanceof im),n={};for(const e of t){const t=d(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of D(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class Pm extends bm{model;constructor(e){super(),this.model=e}run(e){const t=!(ym(e)||e instanceof Yf||e instanceof dm||e instanceof mm),n=[],i=[];for(const r of e.children)r instanceof tm&&(t&&!k(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof tm?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class Cm extends bm{run(e){const t=[...e.children];if(!g(t,e=>e instanceof Xl)||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof Xl){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof Xl))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class Nm extends Yl{transform;clone(){return new Nm(null,c(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map(e=>e.field).filter(e=>void 0!==e).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??Ma(e)}hash(){return`JoinAggregateTransform ${d(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{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class Am extends Yl{filter;clone(){return new Am(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t,n){const{config:i,markDef:r}=t,{marks:o,scales:a}=n;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const s=t.reduceFieldDef((e,n,o)=>{const a=Zt(o)&&t.getScaleComponent(o);if(a){const t=a.get("type"),{aggregate:s}=n,c=qo({scaleChannel:o,markDef:r,config:i,scaleType:t,isCountAggregate:yn(s)});"show"!==c&&"always-valid"!==c&&(e[n.field]=n)}return e},{});return D(s).length?new Am(e,s):null}dependentFields(){return new Set(D(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${d(this.filter)}`}assemble(){const e=D(this.filter).reduce((e,t)=>{const n=this.filter[t],i=Ma(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (${jm(i)}))`):"quantitative"===n.type&&e.push(jm(i))),e},[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}function jm(e){return`isValid(${e}) && isFinite(+${e})`}class Tm extends Yl{_stack;clone(){return new Tm(null,c(this._stack))}constructor(e,t){super(e),this._stack=t}static makeFromTransform(e,n){const{stack:i,groupby:r,as:o,offset:a="zero"}=n,s=[],c=[];if(void 0!==n.sort)for(const e of n.sort)s.push(e.field),c.push(I(e.order,"ascending"));const l={field:s,order:c};let u;return u=function(e){return t.isArray(e)&&e.every(e=>t.isString(e))&&e.length>1}(o)?o:t.isString(o)?[o,`${o}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new Tm(e,{dimensionFieldDefs:[],stackField:i,groupby:r,offset:a,sort:l,facetby:[],as:u})}static makeFromEncoding(e,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannels:o,fieldChannel:a,offset:s,impute:c}=i,l=o.map(e=>Ga(r[e])).filter(e=>!!e),u=function(e){return e.stack.stackBy.reduce((e,t)=>{const n=Ma(t.fieldDef);return n&&e.push(n),e},[])}(n),f=n.encoding.order;let d;if(t.isArray(f)||ka(f))d=Xn(f);else{const e=ba(f)?f.sort:"y"===a?"descending":"ascending";d=u.reduce((t,n)=>(t.field.includes(n)||(t.field.push(n),t.order.push(e)),t),{field:[],order:[]})}return new Tm(e,{dimensionFieldDefs:l,stackField:n.vgField(a),facetby:[],stackby:u,sort:d,offset:s,impute:c,as:[n.vgField(a,{suffix:"start",forAs:!0}),n.vgField(a,{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(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${d(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map(e=>e.bin?t?[Ma(e,{binSuffix:"mid"})]:[Ma(e,{}),Ma(e,{binSuffix:"end"})]:[Ma(e)]).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:c}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=Ma(o,{expr:"datum"}),i=Ma(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${jm(t)} ? ${n}*${t}+${1-n}*${i} : ${t}`,as:Ma(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:Ma(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:c,offset:a}),e}}class Em extends Yl{transform;clone(){return new Em(null,c(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b(this.transform.groupby.concat(e),e=>e)}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach(t=>e.add(t.field)),this.transform.window.map(e=>e.field).filter(e=>void 0!==e).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??Ma(e)}hash(){return`WindowTransform ${d(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every(e=>gn(e)))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const c={field:a,order:s},l=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:c,...void 0!==l?{ignorePeers:l}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function Mm(e){if(e instanceof cm)if(1!==e.numChildren()||(t=e,(n=e.children[0])instanceof Xl||n instanceof im&&!t.canMoveBelowAggregate)){const t=e.model.component.data.main;Rm(t);const n=function(e){return function t(n){if(!(n instanceof cm)){const i=n.clone();if(i instanceof Xl){const t=Lm+i.getSource();i.setSource(t),e.model.component.data.outputNodes[t]=i}else(i instanceof im||i instanceof Tm||i instanceof Em||i instanceof Nm)&&i.addDimensions(e.fields);for(const e of n.children.flatMap(t))e.parent=i;return[i]}return n.children.flatMap(t)}}(e),i=e.children.map(n).flat();for(const e of i)e.parent=t}else{const t=e.children[0];(t instanceof im||t instanceof Tm||t instanceof Em||t instanceof Nm)&&(t.addDimensions(e.fields),t instanceof im&&t.addDimensions(e.sortIndexFields)),t.swapWithParent(),Mm(e)}else e.children.map(Mm);var t,n}function Rm(e){if(e instanceof Xl&&e.type===Hl.Main&&1===e.numChildren()){const t=e.children[0];t instanceof cm||(t.swapWithParent(),Rm(e))}}const Lm="scale_";function qm(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!qm(t.children))return!1}return!0}function Um(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function Wm(e,t,n){let i=e.sources,r=!1;return r=Um(new Sm,i)||r,r=Um(new wm(t),i)||r,i=i.filter(e=>e.numChildren()>0),r=Um(new Om,i)||r,i=i.filter(e=>e.numChildren()>0),n||(r=Um(new Dm,i)||r,r=Um(new Pm(t),i)||r,r=Um(new km,i)||r,r=Um(new Fm,i)||r,r=Um(new _m,i)||r,r=Um(new zm,i)||r,r=Um(new $m,i)||r,r=Um(new Cm,i)||r),e.sources=i,r}class Im{constructor(e){Object.defineProperty(this,"signal",{enumerable:!0,get:e})}signal;static fromName(e,t){return new Im(()=>e(t))}}function Bm(e){Mp(e)?function(e){const t=e.component.scales;for(const n of D(t)){const i=Vm(e,n);if(t[n].setWithExplicit("domains",i),Jm(e,n),e.component.data.isFaceted){let t=e;for(;!Rp(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)An(e)&&(e.data=Lm+e.data.replace(Lm,""))}}}(e):function(e){for(const t of e.children)Bm(t);const t=e.component.scales;for(const n of D(t)){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"):Ml(i,e.getWithExplicit("domains"),"domains","scale",Km);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&Ri(ci),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function Vm(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=Qm(t,n);if(!e)return void Ri(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=Qm(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&Ya(i.x2)?Ya(i.x)?Ml(Ym(n,r,e,"x"),Ym(n,r,e,"x2"),"domain","scale",Km):Ym(n,r,e,"x2"):"y"===t&&Ya(i.y2)?Ya(i.y)?Ml(Ym(n,r,e,"y"),Ym(n,r,e,"y2"),"domain","scale",Km):Ym(n,r,e,"y2"):Ym(n,r,e,t)}function Hm(e,t,n){return e.map(e=>({signal:ts(e,{timeUnit:n,type:t})}))}function Gm(e,t,n){const i=ir(n)?.unit;return"temporal"===t||i?[Hm(e,t,i)]:[e]}function Ym(e,n,i,r){const{encoding:o,markDef:a,mark:s,config:c,stack:l}=i,u=Ya(o[r]),{type:f}=u,d=u.timeUnit,m=function(e){const{marks:t,scales:n}=Gl(e);return t===n?Hl.Main:"include-invalid-values"===n?Hl.PreFilterInvalid:Hl.PostFilterInvalid}({invalid:Hn("invalid",a,c),isPath:ko(s)});if(function(e){return Z(e,"unionWith")}(n)){const t=Ym(e,void 0,i,r);return Al([...Gm(n.unionWith,f,d),...t.value])}if(Pn(n))return Al([n]);if(n&&"unaggregated"!==n&&!Xr(n))return Al(Gm(n,f,d));if(l&&r===l.fieldChannel){if("normalize"===l.offset)return jl([[0,1]]);const e=i.requestDataName(m);return jl([{data:e,field:i.vgField(r,{suffix:"start"})},{data:e,field:i.vgField(r,{suffix:"end"})}])}const g=Zt(r)&&ka(u)?function(e,t,n){if(!Vr(n))return;const i=e.fieldDef(t),r=i.sort;if(ua(r))return{op:"min",field:fd(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map(e=>e.fieldDef.field)]):void 0;if(la(r)){return Xm(r,o&&!a.has(r.field))}if(function(e){return Z(e,"encoding")}(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:c}=i,l=o&&!a.has(c);if(cn(s)||ln(s))return Xm({field:Ma(i),order:n},l);if(gn(s)||!s)return Xm({op:s,field:c,order:n},l)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(p(["ascending",void 0],r))return!0}return}(i,r,e):void 0;if(Da(u)){return jl(Gm([u.datum],f,d))}const h=u;if("unaggregated"===n){const{field:e}=u;return jl([{data:i.requestDataName(m),field:Ma({field:e,aggregate:"min"})},{data:i.requestDataName(m),field:Ma({field:e,aggregate:"max"})}])}if($n(h.bin)){if(Vr(e))return jl("bin-ordinal"===e?[]:[{data:z(g)?i.requestDataName(m):i.requestDataName(Hl.Raw),field:i.vgField(r,is(h,r)?{binSuffix:"range"}:{}),sort:!0!==g&&t.isObject(g)?g:{field:i.vgField(r,{}),op:"min"}}]);{const{bin:e}=h;if($n(e)){const t=Zd(i,h.field,e);return jl([new Im(()=>{const e=i.getSignalName(t);return`[${e}.start, ${e}.stop]`})])}return jl([{data:i.requestDataName(m),field:i.vgField(r,{})}])}}if(h.timeUnit&&p(["time","utc"],e)){const e=o[lt(r)];if(va(h,e,a,c)){const t=i.requestDataName(m),n=ha({fieldDef:h,fieldDef2:e,markDef:a,config:c}),o=Do(s)&&.5!==n&&At(r);return jl([{data:t,field:i.vgField(r,o?{suffix:Zl}:{})},{data:t,field:i.vgField(r,{suffix:o?eu:"end"})}])}}return jl(g?[{data:z(g)?i.requestDataName(m):i.requestDataName(Hl.Raw),field:i.vgField(r),sort:g}]:[{data:i.requestDataName(m),field:i.vgField(r)}])}function Xm(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":aa),...i?{field:L(i)}:{},...r?{order:r}:{}}}function Jm(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=Xr(i)?i:void 0,a=kn(r)&&Sn(r.extent)?r.extent:void 0;(o||a)&&n.set("selectionExtent",o??a,!0)}function Qm(e,n){const{aggregate:i,type:r}=e;return i?t.isString(i)&&!bn.has(i)?{valid:!1,reason:Fi(i)}:"quantitative"===r&&"log"===n?{valid:!1,reason:Oi(e)}:{valid:!0}:{valid:!1,reason:Di(e)}}function Km(e,t,n,i){return e.explicit&&t.explicit&&Ri(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${K(n)} and ${K(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function Zm(e){const n=b(e.map(e=>{if(An(e)){const{sort:t,...n}=e;return n}return e}),d),i=b(e.map(e=>{if(An(e)){const t=e.sort;return void 0===t||z(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}}).filter(e=>void 0!==e),d);if(0===n.length)return;if(1===n.length){const n=e[0];if(An(n)&&i.length>0){let e=i[0];if(i.length>1){Ri(Pi);const n=i.filter(e=>t.isObject(e)&&"op"in e&&"min"!==e.op);e=!i.every(e=>t.isObject(e)&&"op"in e)||1!==n.length||n[0]}else if(t.isObject(e)&&"field"in e){const t=e.field;n.field===t&&(e=!e.order||{order:e.order})}return{...n,sort:e}}return n}const r=b(i.map(e=>z(e)||!("op"in e)||t.isString(e.op)&&t.hasOwnProperty(sn,e.op)?e:(Ri(function(e){return`Dropping sort property ${K(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0)),d);let o;1===r.length?o=r[0]:r.length>1&&(Ri(Pi),o=!0);const a=b(e.map(e=>An(e)?e.data:null),e=>e);if(1===a.length&&null!==a[0]){return{data:a[0],fields:n.map(e=>e.field),...o?{sort:o}:{}}}return{fields:n.map(ep),...o?{sort:o}:{}}}function ep(e){return t.isArray(e)&&e.some(Pn)?{signal:`[${e.map(e=>`{data: ${Pn(e)?e.signal:K(e)}}`).join(", ")}]`}:e}function tp(e){if(An(e)&&t.isString(e.field))return e.field;if(Nn(e)){let n;for(const i of e.fields)if(An(i)&&t.isString(i.field))if(n){if(n!==i.field)return Ri("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."),n}else n=i.field;return Ri("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),n}if(function(e){return!t.isArray(e)&&Z(e,"fields")&&Z(e,"data")}(e)){Ri("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 n=e.fields[0];return t.isString(n)?n:void 0}}function np(e,t){const n=e.component.scales[t].get("domains").map(t=>(An(t)&&(t.data=e.lookupDataSource(t.data)),t));return Zm(n)}function ip(e,t){if(Mp(e)){const n=e.fieldDef(t);if(n?.field)return n.field}const n=(e.children??[]).map(e=>ip(e,t)).filter(e=>!!e);if(n.length>0){const e=b(n,d);return 1===e.length?e[0]:void 0}}function rp(e,t,n){if(t===n)return!0;const i=e.getScaleType(t),r=e.getScaleType(n);if(!i||!r)return!1;return Vr(i)===Vr(r)}function op(e,t){return e?`field:${e}`:`channel:${String(t)}`}function ap(e,n){try{return function(e){if(t.isArray(e)){const t=e.filter(_);return t.length>0?t:null}if(Nn(e)){const n=[];if(n.push(...e.fields.flatMap(e=>t.isArray(e)?e.filter(_):[])),n.length>0)return b(n,d)}return null}(np(e,n))}catch{return null}}function sp(e,t,n){const i=ap(e,t),r=ap(e,n);return i&&r?b([...i,...r],d):null}function cp(e,t,n){if(t&&t.length>0){const i=e.getWithExplicit("values");i?.explicit||(n&&Ri(n),e.set("values",t,!1))}}function lp(e,t,n){const i=e.getScaleComponent(t),r=e.getScaleComponent(n);if(!i||!r)return!1;const o=i.getWithExplicit("domains"),a=r.getWithExplicit("domains");if(!o?.explicit||!a?.explicit)return!1;const s=np(e,t),c=np(e,n);return d(s)===d(c)}function up(e){const t=e.component.legends,n={};for(const i of D(t)){const r=op(ip(e,i),i);if(!n[r]){n[r]=[{channel:i,cmpt:t[i].clone()}];continue}let o=!1;for(const a of n[r]){if(!rp(e,a.channel,i))continue;if(Xd(a.cmpt,t[i])){const t=e.getScaleType(a.channel),n=e.getScaleType(i);t&&n&&Vr(t)&&Vr(n)&&(lp(e,a.channel,i)?cp(a.cmpt,ap(e,a.channel)):cp(a.cmpt,sp(e,a.channel,i),Ci(a.channel,i))),o=!0;break}}o||n[r].push({channel:i,cmpt:t[i].clone()})}return F(n).flat().map(t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(n)return;!1===t.aria&&null==o.aria&&(o.aria=!1);if(o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of Zs)o[t]&&delete e[t]}o.title||delete o.title;if(void 0!==i){let e=i;o.encode?.labels?.update&&Pn(o.encode.labels.update.text)&&(e=q(i,"datum.label",o.encode.labels.update.text.signal)),function(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}(o,"labels","text",{signal:e})}return o}(t.cmpt,e.config)).filter(e=>void 0!==e)}function fp(e){return qp(e)||Lp(e)?function(e){return e.children.reduce((e,t)=>e.concat(t.assembleProjections()),dp(e))}(e):dp(e)}function dp(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(e=>e.signal).join(", ")}]`},o=t.data.reduce((t,n)=>{const i=Pn(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return p(t,i)||t.push(i),t},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const mp=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class pp extends Nl{specifiedProjection;size;data;merged=!1;constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i}get isFit(){return!!this.data}}function gp(e){e.component.projection=Mp(e)?function(e){if(e.hasProjection){const t=On(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[pe,me],[he,ge]])(Ya(n[i[0]])||Ya(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField($e)&&e.typedFieldDef($e).type===Fr&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(Hl.Main));return t}(e):void 0,o=new pp(e.projectionName(!0),{...On(e.config.projection),...t},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}return}(e):function(e){if(0===e.children.length)return;let n;for(const t of e.children)gp(t);const i=h(e.children,e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=h(mp,i=>!t.hasOwnProperty(e.explicit,i)&&!t.hasOwnProperty(n.explicit,i)||!!(t.hasOwnProperty(e.explicit,i)&&t.hasOwnProperty(n.explicit,i)&&Q(e.get(i),n.get(i))));if(Q(e.size,n.size)){if(i)return e;if(Q(e.explicit,{}))return n;if(Q(n.explicit,{}))return e}return null}(n,i);return e&&(n=e),!!e}return n=i,!0}return!0});if(n&&i){const t=e.projectionName(!0),i=new pp(t,n.specifiedProjection,n.size,c(n.data));for(const n of e.children){const e=n.component.projection;e&&(e.isFit&&i.data.push(...n.component.projection.data),n.renameProjection(e.get("name"),t),e.merged=!0)}return i}return}(e)}function hp(e){return qp(e)||Lp(e)?e.children.reduce((e,t)=>e.concat(hp(t)),yp(e)):yp(e)}function yp(e){return D(e.component.scales).reduce((n,i)=>{const r=e.component.scales[i];if(r.merged)return n;const o=r.combine(),{name:a,type:s,selectionExtent:c,domains:l,range:u,reverse:f,...d}=o,m=function(e,n,i,r){if(At(i)){if(Cn(e))return{step:{signal:`${n}_step`}}}else if(t.isObject(e)&&An(e))return{...e,data:r.lookupDataSource(e.data)};return e}(o.range,a,i,e),p=np(e,i),g=c?function(e,n,i,r){const o=Jf(e,n.param,n);return{signal:Hr(i.get("type"))&&t.isArray(r)&&r[0]>r[1]?`isValid(${o}) && reverse(${o})`:o}}(e,c,r,p):null;return n.push({name:a,type:s,...p?{domain:p}:{},...g?{domainRaw:g}:{},range:m,...void 0!==f?{reverse:f}:{},...d}),n},[])}class vp extends Nl{merged=!1;constructor(e,t){super({},{name:e}),this.setWithExplicit("type",t)}domainHasZero(){const e=this.get("type");if(p([zr,Cr,Nr],e))return"definitely-not";const n=this.get("zero");if(!0===n||void 0===n&&p([Or,Pr,_r],e))return"definitely";const i=this.get("domains");if(i.length>0){let e=!1,n=!1,r=!1;for(const o of i){if(t.isArray(o)){const i=o[0],r=o[o.length-1];if(t.isNumber(i)&&t.isNumber(r)){if(i<=0&&r>=0){e=!0;continue}n=!0;continue}}r=!0}if(e)return"definitely";if(n&&!r)return"definitely-not"}return"maybe"}}const bp=["range","scheme"];function xp(e,n){const i=e.fieldDef(n);if(i?.bin){const{bin:r,field:o}=i,a=ut(n),s=e.getName(a);if(t.isObject(r)&&r.binned&&void 0!==r.step)return new Im(()=>{const t=e.scaleName(n),i=`(domain("${t}")[1] - domain("${t}")[0]) / ${r.step}`;return`${e.getSignalName(s)} / (${i})`});if($n(r)){const t=Zd(e,o,r);return new Im(()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(s)} / (${i})`})}}}function $p(e,n){const i=n.specifiedScales[e],{size:r}=n,o=n.getScaleComponent(e).get("type");for(const r of bp)if(void 0!==i[r]){const a=ro(o,r),s=oo(e,r);if(a)if(s)Ri(s);else switch(r){case"range":{const r=i.range;if(t.isArray(r)){if(At(e))return Al(r.map(e=>{if("width"===e||"height"===e){const t=n.getName(e),i=n.getSignalName.bind(n);return Im.fromName(i,t)}return e}))}else if(t.isObject(r))return Al({data:n.requestDataName(Hl.Main),field:r.field,sort:{op:"min",field:n.vgField(e)}});return Al(r)}case"scheme":return Al(wp(i[r]))}else Ri(zi(o,r,e))}const a=e===ie||"xOffset"===e?"width":"height",s=r[a];if(uc(s))if(At(e))if(Vr(o)){const t=Sp(s,n,e);if(t)return Al({step:t})}else Ri(_i(a));else if(Rt(e)){const t=e===se?"x":"y";if("band"===n.getScaleComponent(t).get("type")){const e=Dp(s,o);if(e)return Al(e)}}const{rangeMin:c,rangeMax:u}=i,f=function(e,n){const{size:i,config:r,mark:o,encoding:a}=n,{type:s}=Ya(a[e]),c=n.getScaleComponent(e),u=c.get("type"),{domain:f,domainMid:d}=n.specifiedScales[e];switch(e){case ie:case re:if(p(["point","band"],u)){const t=Fp(e,i,r.view);if(uc(t)){return{step:Sp(t,n,e)}}}return kp(e,n,u);case se:case ce:return function(e,t,n){const i=e===se?"x":"y",r=t.getScaleComponent(i);if(!r)return kp(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:c}=t;if("band"===o){const r=Fp(i,t.size,t.config.view);if(uc(r)){const e=Dp(r,n);if(e)return e}return e===ce&&Hr(n)?[{signal:`bandwidth('${a}')`},0]:[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(ka(n)&&n.timeUnit){const e=rr(n.timeUnit,e=>`scale('${a}', ${e})`),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=ha({fieldDef:n,markDef:s,config:c})-.5,o=0!==r?` + ${r}`:"";if(i){return[{signal:`${Pn(i)?`${i.signal}/2${o}`:`${i/2+r}`} * (${e})`},{signal:`${Pn(i)?`(1 - ${i.signal}/2)${o}`:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return l(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,n,u);case we:{const a=function(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(xi("size",e))}(o,r),s=function(e,n,i,r){const o={x:xp(i,"x"),y:xp(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=zp(n,o,r.view);return t.isNumber(e)?e-1:new Im(()=>`${e.signal} - 1`)}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=zp(n,o,r.view);return t.isNumber(e)?Math.pow(Op*e,2):new Im(()=>`pow(${Op} * ${e.signal}, 2)`)}}throw new Error(xi("size",e))}(o,i,n,r);return Yr(u)?function(e,t,n){const i=()=>{const i=Wn(t),r=Wn(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return Pn(t)?new Im(i):{signal:i()}}(a,s,function(e,n,i,r){switch(e){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==i&&t.isArray(i)?i.length+1:(Ri(function(e){return`Domain for ${e} is required for threshold scale.`}(r)),3)}}(u,r,f,e)):[a,s]}case fe:return[0,2*Math.PI];case ke:return[0,360];case le:return[0,new Im(()=>`min(${n.getSignalName(Rp(n.parent)?"child_width":"width")},${n.getSignalName(Rp(n.parent)?"child_height":"height")})/2`)];case ye:return{step:1e3/r.scale.framesPerSecond};case Oe:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case ze:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case $e:return"symbol";case ve:case be:case xe:return"ordinal"===u?"nominal"===s?"category":"ordinal":void 0!==d?"diverging":"rect"===o||"geoshape"===o?"heatmap":"ramp";case Se:case De:case Fe:return[r.scale.minOpacity,r.scale.maxOpacity]}}(e,n);return(void 0!==c||void 0!==u)&&ro(o,"rangeMin")&&t.isArray(f)&&2===f.length?Al([c??f[0],u??f[1]]):jl(f)}function wp(e){return function(e){return!t.isString(e)&&Z(e,"name")}(e)?{scheme:e.name,...f(e,["name"])}:{scheme:e}}function kp(e,t,n,{center:i}={}){const r=ut(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===re&&Hr(n)?i?[Im.fromName(e=>`${a(e)}/2`,o),Im.fromName(e=>`-${a(e)}/2`,o)]:[Im.fromName(a,o),0]:i?[Im.fromName(e=>`-${a(e)}/2`,o),Im.fromName(e=>`${a(e)}/2`,o)]:[0,Im.fromName(a,o)]}function Sp(e,n,i){const{encoding:r}=n,o=n.getScaleComponent(i),a=dt(i),s=r[a];if("offset"===lc({step:e,offsetIsDiscrete:_a(s)&&$r(s.type)})&&gs(r,a)){const i=n.getScaleComponent(a);let r=`domain('${n.scaleName(a)}').length`;if("band"===i.get("type")){r=`bandspace(${r}, ${i.get("paddingInner")??i.get("padding")??0}, ${i.get("paddingOuter")??i.get("padding")??0})`}const s=o.get("paddingInner")??o.get("padding");return{signal:`${e.step} * ${r} / (1-${c=s,Pn(c)?c.signal:t.stringValue(c)})`}}return e.step;var c}function Dp(e,t){if("offset"===lc({step:e,offsetIsDiscrete:Vr(t)}))return{step:e.step}}function Fp(e,t,n){const i=e===ie?"width":"height",r=t[i];return void 0!==r?r:gc(n,i)}const Op=.95;function zp(e,t,n){const i=uc(e.width)?e.width.step:pc(n,"width"),r=uc(e.height)?e.height.step:pc(n,"height");return t.x||t.y?new Im(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function _p(e,t){Mp(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of D(n)){const c=a[s],l=n[s],u=e.getScaleComponent(s),f=Ya(r[s]),d=c[t],m=u.get("type"),p=u.get("padding"),g=u.get("paddingInner"),h=ro(m,t),y=oo(s,t);if(void 0!==d&&(h?y&&Ri(y):Ri(zi(m,t,s))),h&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":Li(c[t])||"temporal"===n||e?l.set(t,{signal:ts(c[t],{type:n,timeUnit:e})},!0):l.set(t,c[t],!0);break;default:l.copyKeyFromObject(t,c)}}else{const n=Z(Pp,t)?Pp[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:m,scalePadding:p,scalePaddingInner:g,domain:c.domain,domainMin:c.domainMin,domainMax:c.domainMax,markDef:o,config:i,hasNestedOffsetScale:hs(r,s),hasSecondaryRangeChannel:!!r[lt(s)]}):i.scale[t];void 0!==n&&l.set(t,n,!1)}}}(e,t):Np(e,t)}const Pp={bins:({model:e,fieldOrDatumDef:t})=>ka(t)?function(e,t){const n=t.bin;if($n(n)){const i=Zd(e,t.field,n);return new Im(()=>e.getSignalName(i))}if(wn(n)&&kn(n)&&void 0!==n.step)return{step:n.step};return}(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>function(e,t){if(p([ve,be,xe],e)&&"nominal"!==t)return"hcl";return}(e,t.type),nice:({scaleType:e,channel:n,domain:i,domainMin:r,domainMax:o,fieldOrDatumDef:a})=>function(e,n,i,r,o,a){if(Ga(a)?.bin||t.isArray(i)||null!=o||null!=r||p([Cr,Nr],e))return;return!!At(n)||void 0}(e,n,i,r,o,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>function(e,t,n,i,r,o){if(At(e)){if(Gr(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!ka(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===Ar)return n.pointPadding}return}(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(At(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:s}=r;return o?s:I(e,"bar"===n?t:"tick"===n?a:i)}if(Rt(t)&&i===jr)return r.offsetBandPaddingInner;return}(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>function(e,t,n,i,r,o=!1){if(void 0!==e)return;if(At(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===jr)return I(e,Pn(i)?{signal:`${i.signal}/2`}:i/2)}else if(Rt(t)){if(n===Ar)return.5;if(n===jr)return r.offsetBandPaddingOuter}return}(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return Hr(e)&&"descending"===t?Pn(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(Hr(e)&&"descending"===t)return!0;return}(t,ka(e)?e.sort:void 0,n,i.scale),zero:({model:e,channel:n,fieldOrDatumDef:i,domain:r,markDef:o,scaleType:a,config:s,hasSecondaryRangeChannel:c})=>function(e,n,i,r,o,a,s,c=!1){if(i&&"unaggregated"!==i&&Hr(o)){if(t.isArray(i)){const e=i[0],n=i[i.length-1];if(t.isNumber(e)&&e<=0&&t.isNumber(n)&&n>=0)return!0}return!1}if("size"===e&&"quantitative"===n.type&&!Yr(o))return!0;if(Rt(e))return c;if((!ka(n)||!n.bin)&&p([...Nt,...Tt],e)){const{orient:t,type:n}=r;return(!p(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!Oo(n)||s)||a?.zero)}return!1}(n,i,r,o,a,s.scale,c,Rt(n)&&e.isRangedOffset(mt(n)))};function Cp(e){Mp(e)?function(e){const t=e.component.scales;for(const n of Kt){const i=t[n];if(!i)continue;const r=$p(n,e);i.setWithExplicit("range",r)}}(e):Np(e,"range")}function Np(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?Cp(n):_p(n,t);for(const i of D(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=Ml(r,e.getWithExplicit(t),t,"scale",Tl((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0))}}n[i].setWithExplicit(t,r)}}function Ap(e,t,n,i,r=!1){const o=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(Be(e)||"discrete"===on(e))return"shape"===e&&"ordinal"===t.type&&Ri(Si(e,"ordinal")),"ordinal";if(qt(e))return"band";if(At(e)||Rt(e)){if(p(["rect","bar","image","rule","tick"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in jt)return"band";return To(n[ut(e)])||Aa(t)&&t.axis?.tickBand?"band":"point";case"temporal":return Be(e)?"time":"discrete"===on(e)?(Ri(Si(e,"temporal")),"ordinal"):ka(t)&&t.timeUnit&&ir(t.timeUnit).utc?"utc":qt(e)?"band":"time";case"quantitative":return Be(e)?ka(t)&&$n(t.bin)?"bin-ordinal":"linear":"discrete"===on(e)?(Ri(Si(e,"quantitative")),"ordinal"):qt(e)?"band":"linear";case"geojson":return}throw new Error(yi(t.type))}(t,n,i,r),{type:a}=e;return Zt(t)?void 0!==a?function(e,t,n=!1){if(!Zt(e))return!1;switch(e){case ie:case re:case se:case ce:case fe:case le:return!!Gr(t)||"band"===t||"point"===t&&!n;case ye:return p(["linear","band"],t);case we:case Oe:case Se:case De:case Fe:case ke:return Gr(t)||Yr(t)||p(["band","point","ordinal"],t);case ve:case be:case xe:return"band"!==t;case ze:case $e:return"ordinal"===t||Yr(t)}}(t,a)?ka(n)&&(s=a,c=n.type,!(p([kr,Dr],c)?void 0===s||Vr(s):c===Sr?p([Cr,Nr,void 0],s):c!==wr||Ur(s)||Yr(s)||void 0===s))?(Ri(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(a,o)),o):a:(Ri(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,a,o)),o):o:null;var s,c}function jp(e){Mp(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of Kt){const a=Ya(t[o]);if(a&&n===$o&&o===$e&&a.type===Fr)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??={};const n=Ap(s,o,a,i,hs(t,o));r[o]=new vp(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children){jp(t);for(const r of D(t.component.scales))if(i.scale[r]??=Ad(r,e),"shared"===i.scale[r]){const e=n[r],o=t.component.scales[r].getWithExplicit("type");e?Er(e.value,o.value)?n[r]=Ml(e,o,"type","scale",Tp):(i.scale[r]="independent",delete n[r]):n[r]=o}}for(const i of D(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new vp(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 Tp=Tl((e,t)=>Rr(e)-Rr(t));class Ep{nameMap;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 Mp(e){return"unit"===e?.type}function Rp(e){return"facet"===e?.type}function Lp(e){return"concat"===e?.type}function qp(e){return"layer"===e?.type}class Up{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(e,n,i,r,o,a,l){this.type=n,this.parent=i,this.config=o,this.parent=i,this.config=o,this.view=On(l),this.name=e.name??r,this.title=_n(e.title)?{text:e.title}:e.title?On(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new Ep,this.projectionNameMap=i?i.projectionNameMap:new Ep,this.signalNameMap=i?i.signalNameMap:new Ep,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map(e=>el(e)?{filter:s(e.filter,br)}:e),this.layout="layer"===n||"unit"===n?{}:function(e,n,i){const r=i[n],o={},{spacing:a,columns:s}=r;void 0!==a&&(o.spacing=a),void 0!==s&&(ma(e)&&!fa(e.facet)||ac(e))&&(o.columns=s),sc(e)&&(o.columns=1);for(const n of dc)if(void 0!==e[n])if("spacing"===n){const i=e[n];o[n]=t.isNumber(i)?i:{row:i.row??a,column:i.column??a}}else o[n]=e[n];return o}(e,n,o),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:ma(e)||i?.component.data.isFaceted&&void 0===e.data},layoutSize:new Nl,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?c(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}={}){jp(e),Bm(e);for(const t of io)_p(e,t);t||Cp(e)}(this)}parseProjection(){gp(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Hd(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of D(n)){const t=n[e];void 0!==t&&(i[e]=qn(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=qn(this.description)),"unit"!==this.type&&"layer"!==this.type)?S(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of He){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=pd(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=dd(i,o),s=Dd(e,a);void 0!==s&&(n[a]=s)}}return S(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of He)e[n].title&&t.push(yd(this,n));for(const e of gd)t=t.concat(xd(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(e=>Zf(e,"grid",t)),...i.map(e=>Zf(e,"grid",t)),...n.map(e=>Zf(e,"main",t)),...i.map(e=>Zf(e,"main",t))].filter(e=>e)}(this.component.axes,this.config)}assembleLegends(){return up(this)}assembleProjections(){return fp(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...zn(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return p(["unit","layer"],this.type)?p(["middle",void 0],n.anchor)&&(n.frame??="group"):n.anchor??="start",S(n)?void 0:n}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||Rp(this.parent)?hp(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}getName(e){return P((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(Hl[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if(Rp(this.parent)){const t=Et(Cd(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(Vr(e)&&Cn(i)){const e=n.get("name"),i=tp(np(this,t));if(i){return{signal:Pd(e,n,Ma({aggregate:"distinct",field:i},{expr:"datum"}))}}return Ri(ri(t)),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):rt(e)&&Zt(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}getScaleType(e){const t=this.getScaleComponent(e);return t?t.get("type"):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(`Cannot find a selection named "${t}".`);return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some(e=>e.hasOrientSignalRef())||this.component.axes.y?.some(e=>e.hasOrientSignalRef())}}class Wp extends Up{vgField(e,t={}){const n=this.fieldDef(e);if(n)return Ma(n,t)}reduceFieldDef(e,n){return function(e,n,i,r){return e?D(e).reduce((i,o)=>{const a=e[o];return t.isArray(a)?a.reduce((e,t)=>n.call(r,e,t,o),i):n.call(r,i,a,o)},i):i}(this.getMapping(),(t,n,i)=>{const r=Ga(n);return r?e(t,r,i):t},n)}forEachFieldDef(e,t){ws(this.getMapping(),(t,n)=>{const i=Ga(t);i&&e(i,n)},t)}}class Ip extends Yl{transform;clone(){return new Ip(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"];const i=this.transform.resolve??"shared";this.transform.resolve=i}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${d(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return n.resolve=this.transform.resolve,n}}class Bp extends Yl{transform;clone(){return new Bp(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${d(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class Vp extends Yl{transform;clone(){return new Vp(this.parent,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map((e,t)=>i[t]??e)}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${d(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Hp extends Yl{transform;clone(){return new Hp(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${d(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Gp extends Yl{fields;geojson;signal;clone(){return new Gp(null,c(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[[pe,me],[he,ge]]){const r=i.map(e=>{const n=Ya(t.encoding[e]);return ka(n)?n.field:Da(n)?{expr:`${n.datum}`}:Ca(n)?{expr:`${n.value}`}:void 0});(r[0]||r[1])&&(e=new Gp(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField($e)){const i=t.typedFieldDef($e);i.type===Fr&&(e=new Gp(e,null,i.field,t.getName(`geojson_${n}`)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(t.isString);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${d(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Yp extends Yl{projection;fields;as;clone(){return new Yp(null,this.projection,c(this.fields),c(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[pe,me],[he,ge]]){const i=n.map(e=>{const n=Ya(t.encoding[e]);return ka(n)?n.field:Da(n)?{expr:`${n.datum}`}:Ca(n)?{expr:`${n.value}`}:void 0}),r=n[0]===he?"2":"";(i[0]||i[1])&&(e=new Yp(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(t.isString))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${d(this.fields)} ${d(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Xp extends Yl{transform;clone(){return new Xp(null,c(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}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 Xp(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(ka(i)&&ka(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:c,frame:l,keyvals:u}=o.impute,f=ks(t.mark,n);return new Xp(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==c?{value:c}:{},...l?{frame:l}:{},...void 0!==u?{keyvals:u}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${d(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(c=n,Z(c,"stop")?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var c;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class Jp extends Yl{transform;clone(){return new Jp(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${d(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class Qp extends Yl{transform;secondary;clone(){return new Qp(null,c(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return Z(e,"data")}(o)){let e=ng(o.data,r);e||(e=new hm(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new Xl(e,n,Hl.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return Z(e,"param")}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(P(e),e)}catch{throw new Error(`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`)}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new Qp(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?t.array(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${d({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:[...t.array(this.transform.as)]}:{}};else{let n=this.transform.as;t.isString(n)||(Ri('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.'),n="_lookup"),e={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class Kp extends Yl{transform;clone(){return new Kp(null,c(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b((this.transform.groupby??[]).concat(e),e=>e)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${d(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class Zp extends Yl{transform;clone(){return new Zp(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${d(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class eg extends Yl{transform;clone(){return new eg(null,c(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=c(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${d(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class tg extends Yl{transform;clone(){return new tg(null,c(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${d(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function ng(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(ql(e)&&ql(t)){if(Q(e.values,t.values))return n}else if(Ll(e)&&Ll(t)){if(e.url===t.url)return n}else if(Ul(e)&&e.name===n.dataName)return n}return null}function ig(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new hm({values:[]});return t.push(e),e}const n=ng(e.data,t);if(n)return Wl(e.data)||(n.data.format=y({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new hm(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=!(r&&(Wl(r)||Ll(r)||ql(r)))&&e.parent?e.parent.component.data.ancestorParse.clone():new Rl;Wl(r)?(Il(r)?t=new gm(t,r.sequence):Vl(r)&&(t=new pm(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=dm.makeExplicit(t,e,o)??t,t=new mm(t);const a=e.parent&&qp(e.parent);(Mp(e)||Rp(e))&&a&&(t=tm.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(fl(r))a=e=new ud(e,r),o="derived";else if(el(r)){const i=um(r);a=e=dm.makeWithAncestors(e,{},i,n)??e,e=new Yf(e,t,r.filter)}else if(dl(r))a=e=tm.makeFromTransform(e,r,t),o="number";else if(pl(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new dm(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=Kl.makeFromTransform(e,r);else if(gl(r))a=e=im.makeFromTransform(e,r),o="number",Wf(t)&&(e=new mm(e));else if(tl(r))a=e=Qp.make(e,t,r,i++),o="derived";else if(cl(r))a=e=new Em(e,r),o="number";else if(ll(r))a=e=new Nm(e,r),o="number";else if(hl(r))a=e=Tm.makeFromTransform(e,r),o="derived";else if(yl(r))a=e=new Hp(e,r),o="derived";else if(vl(r))a=e=new Bp(e,r),o="derived";else if(ul(r))a=e=new Vp(e,r),o="derived";else if(nl(r))a=e=new Kp(e,r),o="derived";else if(sl(r))e=new tg(e,r);else if(ml(r))a=e=Xp.makeFromTransform(e,r),o="derived";else if(il(r))a=e=new Ip(e,r),o="derived";else if(rl(r))a=e=new Zp(e,r),o="derived";else if(ol(r))a=e=new eg(e,r),o="derived";else{if(!al(r)){Ri(di(r));continue}a=e=new Jp(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(Mp(e)&&e.component.selection)for(const n of D(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&W(e.field)>1&&(t[e.field]="flatten")}return t}(e),c=fm(e);t=dm.makeWithAncestors(t,{},{...s,...c},o)??t,Mp(e)&&(t=Gp.parseAll(t,e),t=Yp.parseAll(t,e)),(Mp(e)||Rp(e))&&(a||(t=tm.makeFromEncoding(t,e)??t),t=Kl.makeFromEncoding(t,e)??t,t=ud.parseAllForSortIndex(t,e));const l=t=rg(Hl.Raw,e,t);if(Mp(e)){const n=im.makeFromEncoding(t,e);n&&(t=n,Wf(e)&&(t=new mm(t))),t=Xp.makeFromEncoding(t,e)??t,t=Tm.makeFromEncoding(t,e)??t}let u,f;if(Mp(e)){const{markDef:n,mark:i,config:r}=e,o=Vn("invalid",n,r),{marks:a,scales:s}=f=Gl({invalid:o,isPath:ko(i)});a!==s&&"include-invalid-values"===s&&(u=t=rg(Hl.PreFilterInvalid,e,t)),"exclude-invalid-values"===a&&(t=Am.make(t,e,f)??t)}const d=t=rg(Hl.Main,e,t);let m;if(Mp(e)&&f){const{marks:n,scales:i}=f;"include-invalid-values"===n&&"exclude-invalid-values"===i&&(t=Am.make(t,e,f)??t,m=t=rg(Hl.PostFilterInvalid,e,t))}Mp(e)&&function(e,t){for(const[n,i]of O(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new Xl(new Yf(t,e,{param:n}),r,Hl.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let p=null;if(Rp(e)){const i=e.getName("facet");p=new cm(t,e,i,d.getSource()),n[i]=p}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:l,main:d,facetRoot:p,ancestorParse:o,preFilterInvalid:u,postFilterInvalid:m}}function rg(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,o=t.getDataName(e),a=new Xl(n,o,e,r);return i[o]=a,a}function og(e){for(const t of e.children)t.parseLayoutSize()}function ag(e,t){const n=Cd(t),i=Et(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??Ad(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=Ml(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function sg(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(Vr(e)){const e=gc(i.view,t);return Cn(n)||uc(e)?"step":e}return mc(i.view,t)}if(e.hasProjection||"arc"===e.mark)return mc(i.view,t);{const e=gc(i.view,t);return uc(e)?e.step:e}}class cg extends Up{children;constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||Ri("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map((e,t)=>qg(e,this,this.getName(`concat_${t}`),void 0,i))}parseData(){this.component.data=ig(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of D(e.component.selection))this.component.selection[t]=e.component.selection[t]}F(this.component.selection).some(e=>Bf(e))&&Mi(ui)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return sc(e)?e.vconcat:cc(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){og(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";ag(e,t),ag(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce((e,t)=>t.assembleSelectionTopLevelSignals(e),e)}assembleSignals(){return this.children.forEach(e=>e.assembleSignals()),[]}assembleLayoutSignals(){const e=Od(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}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{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}function lg(e){let t=0;return function n(i,r){if(i instanceof hm&&!i.isGenerator&&!Ll(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof dm&&(i.parent instanceof hm&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof cm)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 e.push(...i.assemble());if((i instanceof pm||i instanceof gm||i instanceof Am||i instanceof Yf||i instanceof ud||i instanceof Yp||i instanceof im||i instanceof Qp||i instanceof Em||i instanceof Nm||i instanceof Hp||i instanceof Vp||i instanceof Ip||i instanceof Jp||i instanceof Zp||i instanceof eg||i instanceof mm||i instanceof tg||i instanceof Kp||i instanceof Bp)&&r.transform.push(i.assemble()),(i instanceof tm||i instanceof Kl||i instanceof Xp||i instanceof Tm||i instanceof Gp)&&r.transform.push(...i.assemble()),i instanceof Xl)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof Xl)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 Xl&&(!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;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}function ug(e){return"top"===e||"left"===e||Pn(e)?"header":"footer"}function fg(e,n){const{facet:i,config:r,child:o,component:a}=e;if(e.channelHasField(n)){const s=i[n],c=md("title",null,r,n);let l=Ia(s,r,{allowDisabling:!0,includeDefault:void 0===c||!!c});o.component.layoutHeaders[n].title&&(l=t.isArray(l)?l.join(", "):l,l+=` / ${o.component.layoutHeaders[n].title}`,o.component.layoutHeaders[n].title=null);const u=md("labelOrient",s.header,r,n),f=null!==s.header&&I(s.header?.labels,r.header.labels,!0),d=p(["bottom","right"],u)?"footer":"header";a.layoutHeaders[n]={title:null!==s.header?l:null,facetFieldDef:s,[d]:"facet"===n?[]:[dg(e,n,f)]}}}function dg(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 mg(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:i,resolve:r}=e.component;if(r.axis[t]=jd(r,t),"shared"===r.axis[t]){const r="x"===t?"column":"row",o=i[r];for(const i of n.component.axes[t]){const t=ug(i.get("orient"));o[t]??=[dg(e,r,!1)];const n=Zf(i,"main",e.config,{header:!0});n&&o[t][0].axes.push(n),i.mainExtracted=!0}}}}function pg(e,t,n){return Ma(t,{suffix:`by_${Ma(e)}`,...n})}class gg extends Wp{facet;child;children;constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),this.child=qg(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!fa(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=D(e),n={};for(const i of t){if(![ee,te].includes(i)){Ri(xi(i,"facet"));break}const t=e[i];if(void 0===t.field){Ri(bi(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=Qa(e,t);return n.header?n.header=On(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return Z(this.facet,e)}fieldDef(e){return this.facet[e]}parseData(){this.component.data=ig(this),this.child.parseData()}parseLayoutSize(){og(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,F(this.component.selection).some(e=>Bf(e))&&Mi(ui)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of He)fg(e,t);mg(e,"x"),mg(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of He)for(const n of hd){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=md("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=dd(t,n);e.titleAnchor??={},e.titleAnchor[i]="end"}}if(r?.[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??={},e[o][t]=.5),i.title&&(e.offset??={},e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}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"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof gg)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof gg?{...this.channelHasField("column")?{encode:{update:{columns:{field:Ma(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof gg){if(this.child.channelHasField("column")){const i=Ma(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of Nt){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(Vr(o)&&Cn(a)){const r=tp(np(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):Ri(ri(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:n}=this.component.data.facetRoot,{row:i,column:r}=this.facet,o=!!i&&!!r,{fields:a,ops:s,as:c}=this.getCardinalityAggregateForChild(),l=[];for(const e of He){const n=this.facet[e];if(n){l.push(Ma(n));const{bin:i,sort:r}=n;if($n(i)&&l.push(Ma(n,{binSuffix:"end"})),la(r)){const{field:e,op:t=aa}=r,i=pg(n,r);o||(a.push(e),s.push(t),c.push(i))}else if(t.isArray(r)){const t=fd(n,e);o||(a.push(t),s.push("max"),c.push(t))}}}return{name:e,data:n,groupby:l,...o||a.length>0?{aggregate:{...o?{cross:o}:{},...a.length?{fields:a,ops:s,as:c}:{}}}:{}}}crossedFacetLookupSortExpr(e){const n=this.facet[e];if(!n||!la(n.sort)&&!t.isArray(n.sort))return;const i=this.getName(`${e}_lookup_domain`),r=`data(${t.stringValue(i)})`,o=am(this,e),a=`indexof(pluck(${r}, ${t.stringValue(o)}), ${sm(n,"datum.datum")})`,s=la(n.sort)?Ma(n.sort,{forAs:!0}):fd(n,e);return`${a} >= 0 ? ${r}[${a}][${t.stringValue(s)}] : null`}facetSortFields(e){const{facet:n}=this,i=n[e];if(i){if(rm(n)){const t=this.crossedFacetLookupSortExpr(e);if(t)return[{expr:t}]}return la(i.sort)?[pg(i,i.sort,{expr:"datum"})]:t.isArray(i.sort)?[fd(i,e,{expr:"datum"})]:[Ma(i,{expr:"datum"})]}return[]}facetSortOrder(e){const{facet:n}=this,i=n[e];if(i){const{sort:e}=i;return[(la(e)?e.order:!t.isArray(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return wd(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of gd)if(e[i]){const r=md("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return wd(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=lg(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:He.map(e=>this.facetSortFields(e)).flat(),order:He.map(e=>this.facetSortOrder(e)).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(xu(this,[]))}]}getMapping(){return this.facet}}const hg={disable:1,gridScale:1,scale:1,...cs,labelExpr:1,encode:1},yg=D(hg);class vg extends Nl{explicit;implicit;mainExtracted;constructor(e={},t={},n=!1){super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new vg(c(this.explicit),c(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}hasOrientSignalRef(){return Pn(this.explicit.orient)}}function bg(e,t,n){return function(e,t,n){if("x"in n||"y"in n)return n;const i=od(e,t);if(void 0===i)return n;const r=e.axis(t)?.bandPosition??i;if(.5===r)return n;const o={scale:e.scaleName(t),signal:"datum.value",band:r};return{..."x"===t?{x:o}:{y:o},...n}}(e,t,function(e,t,n){const{encoding:i,config:r}=e,o=Ya(i[t])??Ya(i[lt(t)]),a=e.axis(t)||{},{format:s,formatType:c}=a;if(Xo(c))return{text:Zo({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:c,config:r}),...n};if(void 0===s&&void 0===c&&r.customFormatTypes){if("quantitative"===Sa(o)){if(Aa(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:Zo({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:Zo({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===Sa(o)&&r.timeFormatType&&ka(o)&&!o.timeUnit)return{text:Zo({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(e,t,n))}const xg={bottom:"top",top:"bottom",left:"right",right:"left"};function $g(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]=wg(n,r)}}}return e}function wg(e,t){for(const n of yg){const i=Ml(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(e,t)=>{switch(n){case"title":return Kn(e,t);case"gridScale":return{explicit:e.explicit,value:I(e.value,t.value)}}return El(e,t,n,"axis")});e.setWithExplicit(n,i)}return e}function kg(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Pn(n.labelAngle)?n.labelAngle:Y(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===ld(i,r))return!0}return e===n[t]}const Sg=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function Dg(e,t){let n=t.axis(e);const i=new vg,r=Ya(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),c=t.getScaleComponent(e).get("type"),l=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:Ur(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=Pn(n)?"axisOrient":`axis${A(n)}`,s=[...r,...r.map(e=>o+e.substr(4))],c=["axis",a,o];return{vlOnlyAxisConfig:td(s,i,e,n),vgAxisConfig:td(c,i,e,n),axisConfigStyle:nd([...c,...s],i)}}(e,c,s,t.config),u=void 0!==n?!n:id("disable",a.style,n?.style,l).configValue;if(i.set("disable",u,void 0!==n),u)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return Pn(o)?o:Y(o);{const{configValue:o}=id("labelAngle",i,t?.style,r);return void 0!==o?Y(o):n!==ie||!p([Dr,kr],e.type)||ka(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,l),d=ta(n.formatType,r,c),m=ea(r,r.type,n.format,n.formatType,a,!0),g={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:c,orient:s,labelAngle:f,format:m,formatType:d,mark:o,config:a};for(const r of yg){const o=r in rd?rd[r](g):us(r)?n[r]:void 0,s=void 0!==o,c=kg(o,r,n,t,e);if(s&&c)i.set(r,o,c);else{const{configValue:e,configFrom:t}=us(r)&&"values"!==r?id(r,a.style,n.style,l):{},u=void 0!==e;s&&!u?i.set(r,o,c):("vgAxisConfig"!==t||Sg.has(r)&&u||os(e)||Pn(e))&&i.set(r,e,!1)}}const h=n.encoding??{},y=as.reduce((n,r)=>{if(!i.hasAxisPart(r))return n;const o=Nd(h[r]??{},t),a="labels"===r?bg(t,e,o):o;return void 0===a||S(a)||(n[r]={update:a}),n},{});return S(y)||i.set("encode",y,!!n.encoding||void 0!==n.labelAngle),i}const Fg={vgMark:"rect",encodeEntry:e=>{const t={...sf(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...tf(e,"x"),...tf(e,"y")};return{...t,...uf(e,t)}}};function Og(e,t){const{config:n}=e;return{...sf(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Hu("x",e,{defaultPos:"mid"}),...Hu("y",e,{defaultPos:"mid"}),...Wu("size",e),...Wu("angle",e),...zg(e,n,t)}}function zg(e,t,n){return n?{shape:{value:n}}:Wu("shape",e)}const _g={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...sf(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Ku("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...Ku("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...Wu("size",e,{vgChannel:"strokeWidth"})}:{}}};function Pg(e,t,n){if(void 0===Vn("align",e,n))return"center"}function Cg(e,t,n){if(void 0===Vn("baseline",e,n))return"middle"}const Ng={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"x":"y",o="horizontal"===i?"y":"x",a="horizontal"===i?"height":"width";return{...sf(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...tf(e,r),...Hu(o,e,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:qn(Vn("thickness",n,t))}}},Ag={arc:{vgMark:"arc",encodeEntry:e=>({...sf(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Hu("x",e,{defaultPos:"mid"}),...Hu("y",e,{defaultPos:"mid"}),...tf(e,"radius"),...tf(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>{const t=e.isRangedOffset("x"),n=e.isRangedOffset("y"),i=t||n,r=t||!i&&"horizontal"===e.markDef.orient,o=n||!i&&"vertical"===e.markDef.orient,a=n&&!e.encoding.y?"zeroOrMax":"zeroOrMin";return{...sf(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Ku("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:r}),...Ku("y",e,{defaultPos:a,defaultPos2:"zeroOrMin",range:o}),...bf(e)}}},bar:Fg,circle:{vgMark:"symbol",encodeEntry:e=>Og(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...sf(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&ka(n)&&n.type===Fr?{field:Ma(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...sf(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...tf(e,"x"),...tf(e,"y"),...Nu(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...sf(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Hu("x",e,{defaultPos:"mid"}),...Hu("y",e,{defaultPos:"mid"}),...Wu("size",e,{vgChannel:"strokeWidth"}),...bf(e)})},point:{vgMark:"symbol",encodeEntry:e=>Og(e)},rect:{vgMark:"rect",encodeEntry:e=>({...sf(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...tf(e,"x"),...tf(e,"y")})},rule:_g,square:{vgMark:"symbol",encodeEntry:e=>Og(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...sf(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Hu("x",e,{defaultPos:"mid"}),...Hu("y",e,{defaultPos:"mid"}),...Nu(e),...Wu("size",e,{vgChannel:"fontSize"}),...Wu("angle",e),...xf("align",Pg(e.markDef,n,t)),...xf("baseline",Cg(e.markDef,n,t)),...Hu("radius",e,{defaultPos:null}),...Hu("theta",e,{defaultPos:null})}}},tick:Ng,trail:{vgMark:"trail",encodeEntry:e=>({...sf(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Hu("x",e,{defaultPos:"mid"}),...Hu("y",e,{defaultPos:"mid"}),...Wu("size",e),...bf(e)})}};function jg(e){if(p([fo,co,vo],e.mark)){const t=ks(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:Tg+e.requestDataName(Hl.Main),data:e.requestDataName(Hl.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:Mg(e,{fromPrefix:Tg})}]}(e,t)}else if(e.mark===lo){const t=Vn("cornerRadiusEnd",e.markDef,e.config),n=t||En.some(t=>Vn(t,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&n)return function(e,t){const[n]=Mg(e,{fromPrefix:Eg}),i=e.scaleName(e.stack.fieldChannel),r=(t={})=>e.vgField(e.stack.fieldChannel,t),o=(e,t)=>`${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 a,s;"x"===e.stack.fieldChannel?(a={...u(n.encode.update,["y","yc","y2","height",...En]),x:{signal:o("min","datum")},x2:{signal:o("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...f(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(a={...u(n.encode.update,["x","xc","x2","width"]),y:{signal:o("min","datum")},y2:{signal:o("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...f(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const t of En){const i=Hn(t,e.markDef,e.config);n.encode.update[t]?(a[t]=n.encode.update[t],delete n.encode.update[t]):i&&(a[t]=qn(i)),i&&(n.encode.update[t]={value:0})}a={...a,...ff(e,t,i,{minStart:r({prefix:"min",suffix:"start"}),maxStart:r({prefix:"max",suffix:"start"}),minEnd:r({prefix:"min",suffix:"end"}),maxEnd:r({prefix:"max",suffix:"end"})})};const c=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=Ma(n);i&&c.push(i),(n?.bin||n?.timeUnit)&&c.push(Ma(n,{binSuffix:"end"}))}a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((t,i)=>{if(n.encode.update[i])return{...t,[i]:n.encode.update[i]};{const n=Hn(i,e.markDef,e.config);return void 0!==n?{...t,[i]:qn(n)}:t}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(Hl.Main),name:Eg+e.requestDataName(Hl.Main),groupby:c,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:s},marks:[n]}]}]}(e,t)}return Mg(e)}const Tg="faceted_path_";const Eg="stack_group_";function Mg(e,n={fromPrefix:""}){const{mark:i,markDef:r,encoding:o,config:a}=e,s=I(r.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),c=Bn(r),l=o.key,u=function(e){const{encoding:n,stack:i,mark:r,markDef:o,config:a}=e,s=n.order;if(!(!t.isArray(s)&&Ca(s)&&m(s.value)||!s&&m(Vn("order",o,a)))){if((t.isArray(s)||ka(s))&&!i)return Xn(s,{expr:"datum"});if(ko(r)){const e="horizontal"===o.orient?"y":"x";if(ka(n[e]))return{field:e}}}}(e),f=function(e){if(!e.component.selection)return null;const t=D(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=D(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}(e);f&&Object.values(e.component.selection).some(e=>"point"===e.type&&!e.bind&&"pointerover"!==e.on)&&(e.markDef.cursor??="pointer");const d=Vn("aria",r,a),p=Ag[i].postEncodingTransform?Ag[i].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:Ag[i].vgMark,...s?{clip:s}:{},...c?{style:c}:{},...l?{key:l.field}:{},...u?{sort:u}:{},...f||{},...!1===d?{aria:d}:{},from:{data:n.fromPrefix+e.requestDataName(Hl.Main)},encode:{update:Ag[i].encodeEntry(e)},...p?{transform:p}:{}}]}class Rg extends Wp{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(e,n,i,r={},o){super(e,"unit",n,i,o,void 0,fc(e)?e.view:void 0);const a=_o(e.mark)?{...e.mark}:{type:e.mark},s=a.type;void 0===a.filled&&(a.filled=function(e,t,{graticule:n}){if(n)return!1;const i=Hn("filled",e,t),r=e.type;return I(i,r!==mo&&r!==fo&&r!==go)}(a,o,{graticule:e.data&&Vl(e.data)}));const c=this.encoding=function(e,n,i,r){const o={};for(const t of D(e))rt(t)||Ri($i(t));for(let a of pt){if(!e[a])continue;const s=e[a];if(Rt(a)){const e=mt(a),t=o[e];if(ka(t)&&xr(t.type)&&ka(s)&&!t.timeUnit){Ri(hi(e));continue}}if("angle"!==a||"arc"!==n||e.theta||(Ri("Arc marks uses theta channel rather than angle, replacing angle with theta."),a=fe),xs(e,a,n)){if(a===we&&"line"===n){const t=Ga(e[a]);if(t?.aggregate){Ri("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(a===ve&&(i?"fill"in e:"stroke"in e))Ri(vi("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(a===Ce||a===Pe&&!t.isArray(s)&&!Ca(s)||a===Ae&&t.isArray(s)){if(s){if(a===Pe){const t=e[a];if(ba(t)){o[a]=t;continue}}o[a]=t.array(s).reduce((e,t)=>(ka(t)?e.push(Qa(t,a)):Ri(bi(t,a)),e),[])}}else{if(a===Ae&&null===s)o[a]=null;else if(!(ka(s)||Da(s)||Ca(s)||xa(s)||Pn(s))){Ri(bi(s,a));continue}o[a]=Xa(s,a,r)}}else Ri(xi(a,n))}return o}(e.encoding||{},s,a.filled,o);this.markDef=Mc(a,c,o),this.size=function({encoding:e,size:t}){for(const n of Nt){const i=ut(n);uc(t[i])&&Fa(e[n])&&(delete t[i],Ri(_i(i)))}return t}({encoding:c,size:fc(e)?{...r,...void 0!==e.width?{width:e.width}:{},...void 0!==e.height?{height:e.height}:{}}:r}),this.stack=Ec(this.markDef,c),this.specifiedScales=this.initScales(s,c),this.specifiedAxes=this.initAxes(c),this.specifiedLegends=this.initLegends(c),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter(e=>rc(e)),this.alignStackOrderWithColorDomain()}get hasProjection(){const{encoding:e}=this,t=this.mark===$o,n=e&&We.some(t=>_a(e[t]));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}isRangedOffset(e){const{encoding:t,markDef:n}=this;if(!Oo(n.type))return!1;if(t[lt(e)]||!ys(t,e))return!1;const i=t[e];return void 0===i||_a(i)&&Vr(this.getScaleComponent(e)?.get("type"))}legend(e){return this.specifiedLegends[e]}initScales(e,t){return Kt.reduce((e,n)=>{const i=Ya(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e},{})}initScale(e){const{domain:n,range:i}=e,r=On(e);return t.isArray(n)&&(r.domain=n.map(Rn)),t.isArray(i)&&(r.range=i.map(Rn)),r}initAxes(e){return Nt.reduce((t,n)=>{const i=e[n];if(_a(i)||n===ie&&_a(e.x2)||n===re&&_a(e.y2)){const e=_a(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t},{})}initAxis(e){const t=D(e),n={};for(const i of t){const t=e[i];n[i]=os(t)?Mn(t):Rn(t)}return n}initLegends(e){return Jt.reduce((t,n)=>{const i=Ya(e[n]);if(i&&function(e){switch(e){case ve:case be:case xe:case we:case $e:case Se:case Oe:case ze:return!0;case De:case Fe:case ke:case ye:return!1}}(n)){const e=i.legend;t[n]=e?On(e):e}return t},{})}alignStackOrderWithColorDomain(){const{color:e,fill:n,order:i,xOffset:r,yOffset:o}=this.encoding,a=n||e,s=ka(a)?a:void 0,c=s?.field,l=s?.scale,u=s?.type,f=l?.domain,d=r||o,m=ka(d)?d:void 0,p=`_${c}_sort_index`;if(!i&&Array.isArray(f)&&"string"==typeof c&&"nominal"===u)if(m&&!m.sort)m.sort=f;else{if(!this.stack)return;const e=`indexof(${t.stringValue(f)}, datum['${c}'])`,n="horizontal"===this.markDef?.orient?"ascending":"descending";this.transforms.push({calculate:e,as:p}),this.encoding.order={field:p,type:"quantitative",sort:n}}}parseData(){this.component.data=ig(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Nt){const r=ut(i);if(null!=t[r]&&null!=t[r]){const e=t[r];n.layoutSize.set(r,uc(e)?"step":e,!0)}else{const t=sg(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,n){const i={},r=e.config.selection;if(!n||!n.length)return i;let o=0;for(const a of n){const n=P(a.name),s=a.select,l=t.isString(s)?s:s.type,u=t.isObject(s)?c(s):{type:l},f=r[l];for(const e in f)"fields"!==e&&"encodings"!==e&&("mark"===e&&(u.mark={...f.mark,...u.mark}),void 0!==u[e]&&!0!==u[e]||(u[e]=c(f[e]??u[e])));const d=i[n]={...u,name:n,type:l,init:a.value,bind:a.bind,events:t.isString(u.on)?t.parseSelector(u.on,"scope"):t.array(c(u.on))};if(Bf(d)&&(o++,o>1)){delete i[n];continue}const m=c(a);for(const t of qf)t.defined(d)&&t.parse&&t.parse(e,d,m)}return o>1&&Ri("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),i}(this,this.selection)}parseMarkGroup(){this.component.mark=jg(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Nt.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[Dg(n,e)]),t),{}))}assembleSelectionTopLevelSignals(e){return function(e,n){let i=!1;for(const r of F(e.component.selection??{})){const o=r.name,a=t.stringValue(o+Ef);if(0===n.filter(e=>e.name===o).length){const e="global"===r.resolve?"union":r.resolve,i="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${Lf}(${a}, ${t.stringValue(e)}${i}`})}i=!0;for(const t of qf)t.defined(r)&&t.topLevelSignals&&(n=t.topLevelSignals(e,r,n))}i&&0===n.filter(e=>"unit"===e.name).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]});return wu(n)}(this,e)}assembleSignals(){return[...ed(this),...bu(this,[])]}assembleSelectionData(e){return function(e,t){const n=[],i=[],r=Uf(e,{escape:!1});for(const o of F(e.component.selection??{})){const a={name:o.name+Ef};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:ec}}]),o.init){const e=o.project.items.map(yu);a.values=o.project.hasSelectionId?o.init.map(e=>({unit:r,[ec]:vu(e,!1)[0]})):o.init.map(t=>({unit:r,fields:e,values:vu(t,!1)}))}if([...n,...t].filter(e=>e.name===o.name+Ef).length||n.push(a),Bf(o)&&t.length){const n=e.lookupDataSource(e.getDataName(Hl.Main)),r=t.find(e=>e.name===n),o=r.transform.find(e=>"filter"===e.type&&e.expr.includes("vlSelectionTest"));if(o){r.transform=r.transform.filter(e=>e!==o);const e={name:r.name+su,source:r.name,transform:[o]};i.push(e)}}}return n.concat(t,i)}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return Od(this)}correctDataNames=e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data),"time"in this.encoding&&(e.from.data=e.from.data+su)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e);assembleMarks(){let e=this.component.mark??[];return this.parent&&qp(this.parent)||(e=$u(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return ps(this.encoding,e)}fieldDef(e){return Ga(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return Pa(t)?t:null}}class Lg extends Up{children;constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map((e,t)=>{if(_c(e))return new Lg(e,this,this.getName(`layer_${t}`),o,r);if(ds(e))return new Rg(e,this,this.getName(`layer_${t}`),o,r);throw new Error(Zn(e))})}parseData(){this.component.data=ig(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;og(e=this),ag(e,"width"),ag(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of D(e.component.selection))this.component.selection[t]=e.component.selection[t]}F(this.component.selection).some(e=>Bf(e))&&Mi(ui)}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of D(i.component.axes))n.axis[r]=jd(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=$g(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of Nt){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!Pn(t)){if(i[t]>0&&!n){const n=xg[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.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()),ed(this))}assembleLayoutSignals(){return this.children.reduce((e,t)=>e.concat(t.assembleLayoutSignals()),Od(this))}assembleSelectionData(e){return this.children.reduce((e,t)=>t.assembleSelectionData(e),e)}assembleGroupStyle(){const e=new Set;for(const n of this.children)for(const i of t.array(n.assembleGroupStyle()))e.add(i);const n=Array.from(e);return n.length>1?n:1===n.length?n[0]:void 0}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)Mp(n)&&(t=$u(n,t));return t}(this,this.children.flatMap(e=>e.assembleMarks()))}assembleLegends(){return this.children.reduce((e,t)=>e.concat(t.assembleLegends()),up(this))}}function qg(e,t,n,i,r){if(ma(e))return new gg(e,t,n,r);if(_c(e))return new Lg(e,t,n,i,r);if(ds(e))return new Rg(e,t,n,i,r);if(function(e){return sc(e)||cc(e)||ac(e)}(e))return new cg(e,t,n,r);throw new Error(Zn(e))}const Ug=n;Object.defineProperty(e,"mergeConfig",{enumerable:!0,get:function(){return t.mergeConfig}}),Object.defineProperty(e,"writeConfig",{enumerable:!0,get:function(){return t.writeConfig}}),e.accessPathDepth=W,e.accessPathWithDatum=j,e.accessWithDatumToUnescapedPath=E,e.compile=function(e,n={}){var i;n.logger&&(i=n.logger,Ei=i),n.fieldTitle&&Wa(n.fieldTitle);try{const i=kc(t.mergeConfig(n.config,e.config)),r=Dl(e,i),o=qg(r,null,"",void 0,i);o.parse(),function(e,t){qm(e.sources);let n=0,i=0;for(let i=0;i<5&&Wm(e,t,!0);i++)n++;e.sources.map(Mm);for(let n=0;n<5&&Wm(e,t,!1);n++)i++;qm(e.sources),5===Math.max(n,i)&&Ri("Maximum optimization runs(5) reached.")}(o.component.data,o);const a=function(e,t,n={},i){const r=e.config?Oc(e.config):void 0,o=function(e,t){const n=[],i=lg(n);let r=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+r++);const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let o=0;for(const[e,t]of n.entries())0!==(t.transform??[]).length||t.source||n.splice(o++,0,n.splice(e,1)[0]);for(const t of n)for(const n of t.transform??[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of n)e.name in t&&(e.values=t[e.name]);return n}(e.component.data,n),a=e.assembleSelectionData(o),s=e.assembleProjections(),c=e.assembleTitle(),l=e.assembleGroupStyle(),u=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter(e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1));const{params:d,...m}=t;return{$schema:"https://vega.github.io/schema/vega/v6.json",...e.description?{description:e.description}:{},...m,...c?{title:c}:{},...l?{style:l}:{},...u?{encode:{update:u}}:{},data:a,...s.length>0?{projections:s}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...oc(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(o,function(e,n,i,r){const o=r.component.layoutSize.get("width"),a=r.component.layoutSize.get("height");void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):t.isString(n)&&(n={type:n});if(o&&a&&(s=n.type,["fit","fit-x","fit-y"].includes(s)))if("step"===o&&"step"===a)Ri(ii()),n.type="pad";else if("step"===o||"step"===a){const e="step"===o?"width":"height";Ri(ii(Et(e)));const t="width"===e?"height":"width";n.type=function(e){return e?`fit-${Et(e)}`:"fit"}(t)}var s;return{...1===D(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...Cl(i,!1),...Cl(e,!0)}}(e,r.autosize,i,o),e.datasets,e.usermeta);return{spec:a,normalized:r}}finally{n.logger&&(Ei=Ti),n.fieldTitle&&Wa(qa)}},e.contains=p,e.deepEqual=Q,e.deleteNestedProperty=N,e.duplicate=c,e.entries=O,e.every=h,e.fieldIntersection=k,e.flatAccessWithDatum=T,e.getFirstDefined=I,e.hasIntersection=$,e.hasProperty=Z,e.hash=d,e.internalField=H,e.isBoolean=z,e.isEmpty=S,e.isEqual=function(e,t){const n=D(e),i=D(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0},e.isInternalField=G,e.isNullOrFalse=m,e.isNumeric=X,e.isPrimitive=_,e.keys=D,e.logicalExpr=C,e.mergeDeep=y,e.never=l,e.normalize=Dl,e.normalizeAngle=Y,e.omit=f,e.pick=u,e.prefixGenerator=w,e.removePathFromField=U,e.replaceAll=q,e.replacePathInField=L,e.resetIdCounter=function(){B=42},e.setEqual=x,e.some=g,e.stringify=K,e.titleCase=A,e.unescapeSingleQuoteAndPathDot=M,e.unique=b,e.uniqueId=V,e.vals=F,e.varName=P,e.version=Ug});
//# sourceMappingURL=vega-lite.min.js.map
</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="undefined"!=typeof globalThis?globalThis:e||self).vegaEmbed=t(e.vega,e.vegaLite)}(this,function(e,t){"use strict";function n(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 r,i=n(e),o=n(t),a=(r=function(e,t){return r=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])},r(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=Object.prototype.hasOwnProperty;function l(e,t){return s.call(e,t)}function c(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);var r=[];for(var i in e)l(e,i)&&r.push(i);return r}function f(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function p(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 d(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function h(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function u(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(u(e[t]))return!0}else if("object"==typeof e)for(var r=c(e),i=r.length,o=0;o<i;o++)if(u(e[r[o]]))return!0;return!1}function g(e,t){var n=[e];for(var r in t){var i="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==i&&n.push(r+": "+i)}return n.join("\n")}var m=function(e){function t(t,n,r,i,o){var a=this.constructor,s=e.call(this,g(t,{name:n,index:r,operation:i,tree:o}))||this;return s.name=n,s.index=r,s.operation=i,s.tree=o,Object.setPrototypeOf(s,a.prototype),s.message=g(t,{name:n,index:r,operation:i,tree:o}),s}return a(t,e),t}(Error),E=m,v=f,b={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=w(n,this.path);r&&(r=f(r));var i=O(n,{op:"remove",path:this.from}).removed;return O(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=w(n,this.from);return O(n,{op:"add",path:this.path,value:f(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:x(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},y={add:function(e,t,n){return p(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:b.move,copy:b.copy,test:b.test,_get:b._get};function w(e,t){if(""==t)return e;var n={op:"_get",path:t};return O(e,n),n.value}function O(e,t,n,r,i,o){if(void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===i&&(i=!0),void 0===o&&(o=0),n&&("function"==typeof n?n(t,0,e,t.path):A(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=w(e,t.from),"move"===t.op&&(a.removed=e),a;if("test"===t.op){if(a.test=x(e,t.value),!1===a.test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,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",o,t,e);return a}r||(e=f(e));var s=(t.path||"").split("/"),l=e,c=1,d=s.length,u=void 0,g=void 0,m=void 0;for(m="function"==typeof n?n:A;;){if((g=s[c])&&-1!=g.indexOf("~")&&(g=h(g)),i&&("__proto__"==g||"prototype"==g&&c>0&&"constructor"==s[c-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` 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===u&&(void 0===l[g]?u=s.slice(0,c).join("/"):c==d-1&&(u=t.path),void 0!==u&&m(t,0,e,u)),c++,Array.isArray(l)){if("-"===g)g=l.length;else{if(n&&!p(g))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",o,t,e);p(g)&&(g=~~g)}if(c>=d){if(n&&"add"===t.op&&g>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",o,t,e);if(!1===(a=y[t.op].call(t,l,g,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}}else if(c>=d){if(!1===(a=b[t.op].call(t,l,g,e)).test)throw new E("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return a}if(l=l[g],n&&c<d&&(!l||"object"!=typeof l))throw new E("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}function I(e,t,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),n&&!Array.isArray(t))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=f(e));for(var o=new Array(t.length),a=0,s=t.length;a<s;a++)o[a]=O(e,t[a],n,!0,i,a),e=o[a].newDocument;return o.newDocument=e,o}function A(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(!b[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)&&u(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 i=e.path.split("/").length,o=r.split("/").length;if(i!==o+1&&i!==o)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=L([{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 L(e,t,n){try{if(!Array.isArray(e))throw new E("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)I(f(t),f(e),n||!0);else{n=n||A;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 x(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,i,o=Array.isArray(e),a=Array.isArray(t);if(o&&a){if((r=e.length)!=t.length)return!1;for(n=r;0!==n--;)if(!x(e[n],t[n]))return!1;return!0}if(o!=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(!x(e[i=s[n]],t[i]))return!1;return!0}return e!=e&&t!=t}var $=Object.freeze({__proto__:null,JsonPatchError:E,_areEquals:x,applyOperation:O,applyPatch:I,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},deepClone:v,getValueByPointer:w,validate:L,validator:A}),N=new WeakMap,R=function(e){this.observers=new Map,this.obj=e},S=function(e,t){this.callback=e,this.observer=t};
/*!
* https://github.com/Starcounter-Jack/JSON-Patch
* (c) 2017-2021 Joachim Wester
* MIT license
*/function T(e,t){void 0===t&&(t=!1);var n=N.get(e.object);C(n.value,e.object,e.patches,"",t),e.patches.length&&I(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,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var o=c(t),a=c(e),s=!1,p=a.length-1;p>=0;p--){var h=e[g=a[p]];if(!l(t,g)||void 0===t[g]&&void 0!==h&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+d(g),value:f(h)}),n.push({op:"remove",path:r+"/"+d(g)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var u=t[g];"object"==typeof h&&null!=h&&"object"==typeof u&&null!=u&&Array.isArray(h)===Array.isArray(u)?C(h,u,n,r+"/"+d(g),i):h!==u&&(i&&n.push({op:"test",path:r+"/"+d(g),value:f(h)}),n.push({op:"replace",path:r+"/"+d(g),value:f(u)}))}}if(s||o.length!=a.length)for(p=0;p<o.length;p++){var g;l(e,g=o[p])||void 0===t[g]||n.push({op:"add",path:r+"/"+d(g),value:f(t[g])})}}}var F=Object.freeze({__proto__:null,compare:function(e,t,n){void 0===n&&(n=!1);var r=[];return C(e,t,r,"",n),r},generate:T,observe:function(e,t){var n,r=function(e){return N.get(e)}(e);if(r){var i=function(e,t){return e.observers.get(t)}(r,t);n=i&&i.observer}else r=new R(e),N.set(e,r);if(n)return n;if(n={},r.value=f(e),t){n.callback=t,n.next=null;var o=function(){T(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};"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(){T(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 S(t,n)),n},unobserve:function(e,t){t.unobserve()}});Object.assign({},$,F,{JsonPatchError:m,deepClone:f,escapePathComponent:d,unescapePathComponent:h});const D=/("(?:[^\\"]|\\.)*")|[:,]/g;function k(e,t={}){const 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;let{replacer:i}=t;return function e(t,o,a){t&&"function"==typeof t.toJSON&&(t=t.toJSON());const s=JSON.stringify(t,i);if(void 0===s)return s;const l=r-o.length-a;if(s.length<=l){const e=s.replace(D,(e,t)=>t||`${e} `);if(e.length<=l)return e}if(null!=i&&(t=JSON.parse(s),i=void 0),"object"==typeof t&&null!==t){const r=o+n,i=[];let a,s,l=0;if(Array.isArray(t)){a="[",s="]";const{length:n}=t;for(;l<n;l++)i.push(e(t[l],r,l===n-1?0:1)||"null")}else{a="{",s="}";const n=Object.keys(t),{length:o}=n;for(;l<o;l++){const a=n[l],s=`${JSON.stringify(a)}: `,c=e(t[a],r,s.length+(l===o-1?0:1));void 0!==c&&i.push(s+c)}}if(i.length>0)return[a,n+i.join(`,\n${r}`),s].join(`\n${o}`)}return s}(e,"",0)}function _(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P,M,j,z;function U(){if(z)return j;z=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return j=n=>n?"object"!=typeof n?e:n:t}var G,B,W,X,V,H,Y,J,q,Q,Z,K,ee,te,ne,re,ie,oe,ae,se,le,ce,fe,pe,de,he,ue,ge,me,Ee,ve,be={exports:{}};function ye(){if(B)return G;B=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return G={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}function we(){if(X)return W;X=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return W=e}function Oe(){return V||(V=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=ye(),o=we(),a=(t=e.exports={}).re=[],s=t.safeRe=[],l=t.src=[],c=t.safeSrc=[],f=t.t={};let p=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",i],[d,r]],u=(e,t,n)=>{const r=(e=>{for(const[t,n]of h)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),i=p++;o(e,i,t),f[e]=i,l[i]=t,c[i]=r,a[i]=new RegExp(t,n?"g":void 0),s[i]=new RegExp(r,n?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","\\d+"),u("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),u("MAINVERSION",`(${l[f.NUMERICIDENTIFIER]})\\.(${l[f.NUMERICIDENTIFIER]})\\.(${l[f.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${l[f.NUMERICIDENTIFIERLOOSE]})\\.(${l[f.NUMERICIDENTIFIERLOOSE]})\\.(${l[f.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${l[f.NONNUMERICIDENTIFIER]}|${l[f.NUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${l[f.NONNUMERICIDENTIFIER]}|${l[f.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASE",`(?:-(${l[f.PRERELEASEIDENTIFIER]}(?:\\.${l[f.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${l[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[f.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER",`${d}+`),u("BUILD",`(?:\\+(${l[f.BUILDIDENTIFIER]}(?:\\.${l[f.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${l[f.MAINVERSION]}${l[f.PRERELEASE]}?${l[f.BUILD]}?`),u("FULL",`^${l[f.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${l[f.MAINVERSIONLOOSE]}${l[f.PRERELEASELOOSE]}?${l[f.BUILD]}?`),u("LOOSE",`^${l[f.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${l[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${l[f.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${l[f.XRANGEIDENTIFIER]})(?:\\.(${l[f.XRANGEIDENTIFIER]})(?:\\.(${l[f.XRANGEIDENTIFIER]})(?:${l[f.PRERELEASE]})?${l[f.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${l[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[f.XRANGEIDENTIFIERLOOSE]})(?:${l[f.PRERELEASELOOSE]})?${l[f.BUILD]}?)?)?`),u("XRANGE",`^${l[f.GTLT]}\\s*${l[f.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${l[f.GTLT]}\\s*${l[f.XRANGEPLAINLOOSE]}$`),u("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),u("COERCE",`${l[f.COERCEPLAIN]}(?:$|[^\\d])`),u("COERCEFULL",l[f.COERCEPLAIN]+`(?:${l[f.PRERELEASE]})?`+`(?:${l[f.BUILD]})?(?:$|[^\\d])`),u("COERCERTL",l[f.COERCE],!0),u("COERCERTLFULL",l[f.COERCEFULL],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${l[f.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${l[f.LONETILDE]}${l[f.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${l[f.LONETILDE]}${l[f.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${l[f.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${l[f.LONECARET]}${l[f.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${l[f.LONECARET]}${l[f.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${l[f.GTLT]}\\s*(${l[f.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${l[f.GTLT]}\\s*(${l[f.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${l[f.GTLT]}\\s*(${l[f.LOOSEPLAIN]}|${l[f.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${l[f.XRANGEPLAIN]})\\s+-\\s+(${l[f.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${l[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[f.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(be,be.exports)),be.exports}function Ie(){if(q)return J;q=1;const e=we(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=ye(),{safeRe:r,t:i}=Oe(),o=U(),{compareIdentifiers:a}=function(){if(Y)return H;Y=1;const e=/^[0-9]+$/,t=(t,n)=>{if("number"==typeof t&&"number"==typeof n)return t===n?0:t<n?-1:1;const r=e.test(t),i=e.test(n);return r&&i&&(t=+t,n=+n),t===n?0:r&&!i?-1:i&&!r?1:t<n?-1:1};return H={compareIdentifiers:t,rcompareIdentifiers:(e,n)=>t(n,e)}}();class s{constructor(a,l){if(l=o(l),a instanceof s){if(a.loose===!!l.loose&&a.includePrerelease===!!l.includePrerelease)return a;a=a.version}else if("string"!=typeof a)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);if(a.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",a,l),this.options=l,this.loose=!!l.loose,this.includePrerelease=!!l.includePrerelease;const c=a.trim().match(l.loose?r[i.LOOSE]:r[i.FULL]);if(!c)throw new TypeError(`Invalid Version: ${a}`);if(this.raw=a,this.major=+c[1],this.minor=+c[2],this.patch=+c[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");c[4]?this.prerelease=c[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<n)return t}return e}):this.prerelease=[],this.build=c[5]?c[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof s)){if("string"==typeof t&&t===this.version)return 0;t=new s(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof s||(e=new s(e,this.options)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}comparePre(t){if(t instanceof s||(t=new s(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let n=0;do{const r=this.prerelease[n],i=t.prerelease[n];if(e("prerelease compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return a(r,i)}while(++n)}compareBuild(t){t instanceof s||(t=new s(t,this.options));let n=0;do{const r=this.build[n],i=t.build[n];if(e("build compare",n,r,i),void 0===r&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===r)return-1;if(r!==i)return a(r,i)}while(++n)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?r[i.PRERELEASELOOSE]:r[i.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;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":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===a(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return J=s}function Ae(){if(Z)return Q;Z=1;const e=Ie();return Q=(t,n,r)=>new e(t,r).compare(new e(n,r))}function Le(){if(de)return pe;de=1;const e=function(){if(ee)return K;ee=1;const e=Ae();return K=(t,n,r)=>0===e(t,n,r)}(),t=function(){if(ne)return te;ne=1;const e=Ae();return te=(t,n,r)=>0!==e(t,n,r)}(),n=function(){if(ie)return re;ie=1;const e=Ae();return re=(t,n,r)=>e(t,n,r)>0}(),r=function(){if(ae)return oe;ae=1;const e=Ae();return oe=(t,n,r)=>e(t,n,r)>=0}(),i=function(){if(le)return se;le=1;const e=Ae();return se=(t,n,r)=>e(t,n,r)<0}(),o=function(){if(fe)return ce;fe=1;const e=Ae();return ce=(t,n,r)=>e(t,n,r)<=0}();return pe=(a,s,l,c)=>{switch(s){case"===":return"object"==typeof a&&(a=a.version),"object"==typeof l&&(l=l.version),a===l;case"!==":return"object"==typeof a&&(a=a.version),"object"==typeof l&&(l=l.version),a!==l;case"":case"=":case"==":return e(a,l,c);case"!=":return t(a,l,c);case">":return n(a,l,c);case">=":return r(a,l,c);case"<":return i(a,l,c);case"<=":return o(a,l,c);default:throw new TypeError(`Invalid operator: ${s}`)}}}function xe(){if(me)return ge;me=1;const e=/\s+/g;class t{constructor(n,o){if(o=r(o),n instanceof t)return n.loose===!!o.loose&&n.includePrerelease===!!o.includePrerelease?n:new t(n.raw,o);if(n instanceof i)return this.raw=n.value,this.set=[[n]],this.formatted=void 0,this;if(this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease,this.raw=n.trim().replace(e," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!u(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&d)|(this.options.loose&&h))+":"+e,r=n.get(t);if(r)return r;const a=this.options.loose,g=a?s[l.HYPHENRANGELOOSE]:s[l.HYPHENRANGE];e=e.replace(g,$(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(s[l.COMPARATORTRIM],c),o("comparator trim",e),e=e.replace(s[l.TILDETRIM],f),o("tilde trim",e),e=e.replace(s[l.CARETTRIM],p),o("caret trim",e);let m=e.split(" ").map(e=>E(e,this.options)).join(" ").split(/\s+/).map(e=>x(e,this.options));a&&(m=m.filter(e=>(o("loose invalid filter",e,this.options),!!e.match(s[l.COMPARATORLOOSE])))),o("range list",m);const v=new Map,b=m.map(e=>new i(e,this.options));for(const e of b){if(u(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const y=[...v.values()];return n.set(t,y),y}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(t=>m(t,n)&&e.set.some(e=>m(e,n)&&t.every(t=>e.every(e=>t.intersects(e,n)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new a(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(N(this.set[t],e,this.options))return!0;return!1}}ge=t;const n=new(M?P:(M=1,P=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}})),r=U(),i=function(){if(ue)return he;ue=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(r,i){if(i=n(i),r instanceof t){if(r.loose===!!i.loose)return r;r=r.value}r=r.trim().split(/\s+/).join(" "),a("comparator",r,i),this.options=i,this.loose=!!i.loose,this.parse(r),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(t){const n=this.options.loose?r[i.COMPARATORLOOSE]:r[i.COMPARATOR],o=t.match(n);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new s(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(a("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new s(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new l(e.value,r).test(this.value):""===e.operator?""===e.value||new l(this.value,r).test(e.semver):!((r=n(r)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(o(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(o(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}he=t;const n=U(),{safeRe:r,t:i}=Oe(),o=Le(),a=we(),s=Ie(),l=xe();return he}(),o=we(),a=Ie(),{safeRe:s,t:l,comparatorTrimReplace:c,tildeTrimReplace:f,caretTrimReplace:p}=Oe(),{FLAG_INCLUDE_PRERELEASE:d,FLAG_LOOSE:h}=ye(),u=e=>"<0.0.0-0"===e.value,g=e=>""===e.value,m=(e,t)=>{let n=!0;const r=e.slice();let i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},E=(e,t)=>(e=e.replace(s[l.BUILD],""),o("comp",e,t),e=w(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=I(e,t),o("xrange",e),e=L(e,t),o("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map(e=>y(e,t)).join(" "),y=(e,t)=>{const n=t.loose?s[l.TILDELOOSE]:s[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{let s;return o("tilde",e,t,n,r,i,a),v(n)?s="":v(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:v(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o("replaceTilde pr",a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o("tilde return",s),s})},w=(e,t)=>e.trim().split(/\s+/).map(e=>O(e,t)).join(" "),O=(e,t)=>{o("caret",e,t);const n=t.loose?s[l.CARETLOOSE]:s[l.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,(t,n,i,a,s)=>{let l;return o("caret",e,t,n,i,a,s),v(n)?l="":v(i)?l=`>=${n}.0.0${r} <${+n+1}.0.0-0`:v(a)?l="0"===n?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o("replaceCaret pr",s),l="0"===n?"0"===i?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o("no pr"),l="0"===n?"0"===i?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o("caret return",l),l})},I=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map(e=>A(e,t)).join(" ")),A=(e,t)=>{e=e.trim();const n=t.loose?s[l.XRANGELOOSE]:s[l.XRANGE];return e.replace(n,(n,r,i,a,s,l)=>{o("xRange",e,n,r,i,a,s,l);const c=v(i),f=c||v(a),p=f||v(s),d=p;return"="===r&&d&&(r=""),l=t.includePrerelease?"-0":"",c?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(f&&(a=0),s=0,">"===r?(r=">=",f?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):"<="===r&&(r="<",f?i=+i+1:a=+a+1),"<"===r&&(l="-0"),n=`${r+i}.${a}.${s}${l}`):f?n=`>=${i}.0.0${l} <${+i+1}.0.0-0`:p&&(n=`>=${i}.${a}.0${l} <${i}.${+a+1}.0-0`),o("xRange return",n),n})},L=(e,t)=>(o("replaceStars",e,t),e.trim().replace(s[l.STAR],"")),x=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(s[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),$=e=>(t,n,r,i,o,a,s,l,c,f,p,d)=>`${n=v(r)?"":v(i)?`>=${r}.0.0${e?"-0":""}`:v(o)?`>=${r}.${i}.0${e?"-0":""}`:a?`>=${n}`:`>=${n}${e?"-0":""}`} ${l=v(c)?"":v(f)?`<${+c+1}.0.0-0`:v(p)?`<${c}.${+f+1}.0-0`:d?`<=${c}.${f}.${p}-${d}`:e?`<${c}.${f}.${+p+1}-0`:`<=${l}`}`.trim(),N=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==i.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0};return ge}var $e=function(){if(ve)return Ee;ve=1;const e=xe();return Ee=(t,n,r)=>{try{n=new e(n,r)}catch(e){return!1}return n.test(t)},Ee}(),Ne=_($e);function Re(e,t,n){return e.fields=t||[],e.fname=n,e}const Se=e=>function(t){return t[e]},Te=e=>{const t=e.length;return function(n){for(let r=0;r<t;++r)n=n[e[r]];return n}};function Ce(e){throw Error(e)}!function(e){const t=function(e){const t=[],n=e.length;let r,i,o,a=null,s=0,l="";function c(){t.push(l+e.substring(r,i)),l="",r=i+1}for(e+="",r=i=0;i<n;++i)if(o=e[i],"\\"===o)l+=e.substring(r,i++),r=i;else if(o===a)c(),a=null,s=-1;else{if(a)continue;r===s&&'"'===o||r===s&&"'"===o?(r=i+1,a=o):"."!==o||s?"["===o?(i>r&&c(),s=r=i+1):"]"===o&&(s||Ce("Access path missing open bracket: "+e),s>0&&c(),s=0,r=i+1):i>r?c():r=i+1}return s&&Ce("Access path missing closing bracket: "+e),a&&Ce("Access path missing closing quote: "+e),i>r&&(i++,c()),t}(e);e=1===t.length?t[0]:e,Re(function(e){return 1===e.length?Se(e[0]):Te(e)}(t),[e],e)}("id"),Re(e=>e,[],"identity"),Re(()=>0,[],"zero"),Re(()=>1,[],"one"),Re(()=>!0,[],"true"),Re(()=>!1,[],"false");const Fe=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>"function"==typeof Object.prototype[e]),"__proto__"]);var De=Array.isArray;function ke(e){return e===Object(e)}const _e=(e,t)=>(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);function Pe(e){return"string"==typeof e}var Me={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},je={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},ze={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const Ue=Array.prototype.slice,Ge=(e,t,n)=>{const r=n?n(t[0]):t[0];return r[e].apply(r,Ue.call(t,1))};var Be={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:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:(e,t=0,n=1,r=0,i=0,o=0,a=0)=>Pe(e)?new Date(e):new Date(e,t,n,r,i,o,a),date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return Ge("join",arguments)},indexof:function(){return Ge("indexOf",arguments)},lastindexof:function(){return Ge("lastIndexOf",arguments)},slice:function(){return Ge("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(_e),parseFloat:parseFloat,parseInt:parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return Ge("substring",arguments,String)},split:function(){return Ge("split",arguments,String)},replace:function(){return Ge("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const We=["view","item","group","xy","x","y"],Xe=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&Xe.add(setImmediate);const Ve={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:"datum"===n?e.datum:"event"===n?e.event:"item"===n?e.item:Me[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,r=e(t.object);n&&(e.memberDepth+=1);const i=e(t.property);if(n&&(e.memberDepth-=1),!Xe.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(e,t)=>{const n=t.arguments;let r=t.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?e(n[0])?e(n[1]):e(n[2]):(e.fn[r]||Be[r]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>je[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>ze[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>"&&"===t.operator?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((t,n)=>{e.memberDepth+=1;const r=e(n.key);e.memberDepth-=1;const i=e(n.value);return Fe.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):Xe.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):t[r]=i,t},{})};function He(e,t,n,r,i,o){const a=e=>Ve[e.type](a,e);return a.memberDepth=0,a.fn=Object.create(t),a.params=n,a.datum=r,a.event=i,a.item=o,We.forEach(e=>a.fn[e]=(...t)=>i.vega[e](...t)),a(e)}var Ye={operator(e,t){const n=t.ast,r=e.functions;return e=>He(n,r,e)},parameter(e,t){const n=t.ast,r=e.functions;return(e,t)=>He(n,r,t,e)},event(e,t){const n=t.ast,r=e.functions;return e=>He(n,r,void 0,void 0,e)},handler(e,t){const n=t.ast,r=e.functions;return(e,t)=>{const i=t.item&&t.item.datum;return He(n,r,e,i,t)}},encode(e,t){const{marktype:n,channels:r}=t,i=e.functions,o="group"===n||"image"===n||"rect"===n;return(e,t)=>{const a=e.datum;let s,l=0;for(const n in r)s=He(r[n].ast,i,t,a,void 0,e),e[n]!==s&&(e[n]=s,l=1);return"rule"!==n&&function(e,t,n){let r;t.x2&&(t.x?(n&&e.x>e.x2&&(r=e.x,e.x=e.x2,e.x2=r),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(r=e.y,e.y=e.y2,e.y2=r),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}(e,r,o),l}}};function Je(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var qe="3.0.0";const Qe="#fff",Ze="#888",Ke={background:"#333",view:{stroke:Ze},title:{color:Qe,subtitleColor:Qe},style:{"guide-label":{fill:Qe},"guide-title":{fill:Qe}},axis:{domainColor:Qe,gridColor:Ze,tickColor:Qe}},et="#4572a7",tt={background:"#fff",arc:{fill:et},area:{fill:et},line:{stroke:et,strokeWidth:2},path:{stroke:et},rect:{fill:et},shape:{stroke:et},symbol:{fill:et,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"]}},nt="#30a2da",rt="#cbcbcb",it="#f0f0f0",ot="#333",at={arc:{fill:nt},area:{fill:nt},axis:{domainColor:rt,grid:!0,gridColor:rt,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:rt,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:it,group:{fill:it},legend:{labelColor:ot,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:ot,titleFontSize:14,titlePadding:10},line:{stroke:nt,strokeWidth:2},path:{stroke:nt,strokeWidth:.5},rect:{fill:nt},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:nt},bar:{binSpacing:2,fill:nt,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},st="#000",lt={group:{fill:"#e5e5e5"},arc:{fill:st},area:{fill:st},line:{stroke:st},path:{stroke:st},rect:{fill:st},shape:{stroke:st},symbol:{fill:st,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"]}},ct="Benton Gothic, sans-serif",ft="#82c6df",pt="Benton Gothic Bold, sans-serif",dt="normal",ht={"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"]},ut={background:"#ffffff",title:{anchor:"start",color:"#000000",font:pt,fontSize:22,fontWeight:"normal"},arc:{fill:ft},area:{fill:ft},line:{stroke:ft,strokeWidth:2},path:{stroke:ft},rect:{fill:ft},shape:{stroke:ft},symbol:{fill:ft,size:30},axis:{labelFont:ct,labelFontSize:11.5,labelFontWeight:"normal",titleFont:pt,titleFontSize:13,titleFontWeight:dt},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:ct,labelFontSize:11.5,symbolType:"square",titleFont:pt,titleFontSize:13,titleFontWeight:dt},range:{category:ht["category-6"],diverging:ht["fireandice-6"],heatmap:ht["fire-7"],ordinal:ht["fire-7"],ramp:ht["fire-7"]}},gt="#ab5787",mt="#979797",Et={background:"#f9f9f9",arc:{fill:gt},area:{fill:gt},line:{stroke:gt},path:{stroke:gt},rect:{fill:gt},shape:{stroke:gt},symbol:{fill:gt,size:30},axis:{domainColor:mt,domainWidth:.5,gridWidth:.2,labelColor:mt,tickColor:mt,tickWidth:.2,titleColor:mt},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"]}},vt="#3e5c69",bt={background:"#fff",arc:{fill:vt},area:{fill:vt},line:{stroke:vt},path:{stroke:vt},rect:{fill:vt},shape:{stroke:vt},symbol:{fill:vt},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"]}},yt="#1696d2",wt="#000000",Ot="Lato",It="Lato",At={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},Lt={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:Ot},axisX:{domain:!0,domainColor:wt,domainWidth:1,grid:!1,labelFontSize:12,labelFont:It,labelAngle:0,tickColor:wt,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:Ot},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:It,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:Ot,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:It,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:Ot,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:At["six-groups-cat-1"],diverging:At["diverging-colors"],heatmap:At["diverging-colors"],ordinal:At["six-groups-seq"],ramp:At["shades-blue"]},area:{fill:yt},rect:{fill:yt},line:{color:yt,stroke:yt,strokeWidth:5},trail:{color:yt,stroke:yt,strokeWidth:0,size:1},path:{stroke:yt,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:yt,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:yt,stroke:null}},arc:{fill:yt},shape:{stroke:yt},symbol:{fill:yt,size:30}},xt="#3366CC",$t="#ccc",Nt="Arial, sans-serif",Rt={arc:{fill:xt},area:{fill:xt},path:{stroke:xt},rect:{fill:xt},shape:{stroke:xt},symbol:{stroke:xt},circle:{fill:xt},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:Nt,fontSize:12},"guide-title":{font:Nt,fontSize:12},"group-title":{font:Nt,fontSize:12}},title:{font:Nt,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:$t,tickColor:$t,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},St=e=>e*(1/3+1),Tt=St(9),Ct=St(10),Ft=St(12),Dt="Segoe UI",kt="wf_standard-font, helvetica, arial, sans-serif",_t="#252423",Pt="#605E5C",Mt="transparent",jt="#118DFF",zt="#DEEFFF",Ut=[zt,jt],Gt={view:{stroke:Mt},background:Mt,font:Dt,header:{titleFont:kt,titleFontSize:Ft,titleColor:_t,labelFont:Dt,labelFontSize:Ct,labelColor:Pt},axis:{ticks:!1,grid:!1,domain:!1,labelColor:Pt,labelFontSize:Tt,titleFont:kt,titleColor:_t,titleFontSize:Ft,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:"#C8C6C4",gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:jt},line:{stroke:jt,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Dt,fontSize:Tt,fill:Pt},arc:{fill:jt},area:{fill:jt,line:!0,opacity:.6},path:{stroke:jt},rect:{fill:jt},point:{fill:jt,filled:!0,size:75},shape:{stroke:jt},symbol:{fill:jt,strokeWidth:1.5,size:50},legend:{titleFont:Dt,titleFontWeight:"bold",titleColor:Pt,labelFont:Dt,labelFontSize:Ct,labelColor:Pt,symbolType:"circle",symbolSize:75},range:{category:[jt,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:Ut,heatmap:Ut,ordinal:[zt,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",jt]}},Bt='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',Wt={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},Xt=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Vt=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Ht({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",r=Wt.gridBg[e],i=Wt.textPrimary[e],o=Wt.textSecondary[e],a="dark"===n?Xt:Vt,s="dark"===n?"#d4bbff":"#6929c4";return{background:t,arc:{fill:s},area:{fill:s},path:{stroke:s},rect:{fill:s},shape:{stroke:s},symbol:{stroke:s},circle:{fill:s},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:Bt,fontWeight:600},axis:{labelColor:o,labelFontSize:12,labelFont:'IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',labelFontWeight:400,titleColor:i,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:Wt.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:Bt,fill:o,fontWeight:400},"guide-title":{font:Bt,fill:o,fontWeight:400}},range:{category:a,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const Yt=Ht({theme:"white",background:"#ffffff"}),Jt=Ht({theme:"g10",background:"#f4f4f4"}),qt=Ht({theme:"g90",background:"#262626"}),Qt=Ht({theme:"g100",background:"#161616"}),Zt=qe;var Kt=Object.freeze({__proto__:null,carbong10:Jt,carbong100:Qt,carbong90:qt,carbonwhite:Yt,dark:Ke,excel:tt,fivethirtyeight:at,ggplot2:lt,googlecharts:Rt,latimes:ut,powerbi:Gt,quartz:Et,urbaninstitute:Lt,version:Zt,vox:bt});function en(e,t){return JSON.stringify(e,function(e){const t=[];return function(n,r){if("object"!=typeof r||null===r)return r;const i=t.indexOf(this)+1;return t.length=i,t.length>e?"[Object]":t.indexOf(r)>=0?"[Circular]":(t.push(r),r)}}(t))}var tn="#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 white-space: pre-line;\n}\n#vg-tooltip-element.visible {\n visibility: visible;\n}\n#vg-tooltip-element h2 {\n margin-top: 0;\n margin-bottom: 10px;\n font-size: 13px;\n}\n#vg-tooltip-element table {\n border-spacing: 0;\n}\n#vg-tooltip-element table tr {\n border: none;\n}\n#vg-tooltip-element table tr td {\n overflow: hidden;\n text-overflow: ellipsis;\n padding-top: 2px;\n padding-bottom: 2px;\n vertical-align: text-top;\n}\n#vg-tooltip-element table tr td.key {\n color: #808080;\n max-width: 150px;\n text-align: right;\n padding-right: 4px;\n}\n#vg-tooltip-element table tr td.value {\n display: block;\n max-width: 300px;\n max-height: 7em;\n text-align: left;\n}\n#vg-tooltip-element {\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}\n#vg-tooltip-element.dark-theme {\n background-color: rgba(32, 32, 32, 0.9);\n border: 1px solid #f5f5f5;\n color: white;\n}\n#vg-tooltip-element.dark-theme td.key {\n color: #bfbfbf;\n}\n";const nn="vg-tooltip-element",rn={offsetX:10,offsetY:10,id:nn,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(e){return String(e).replace(/&/g,"&").replace(/</g,"<")},maxDepth:2,formatTooltip:function(e,t,n,r){if(De(e))return`[${e.map(e=>t(Pe(e)?e:en(e,n))).join(", ")}]`;if(ke(e)){let i="";const{title:o,image:a,...s}=e;o&&(i+=`<h2>${t(o)}</h2>`),a&&(i+=`<img src="${new URL(t(a),r||location.href).href}">`);const l=Object.keys(s);if(l.length>0){i+="<table>";for(const e of l){let r=s[e];void 0!==r&&(ke(r)&&(r=en(r,n)),i+=`<tr><td class="key">${t(e)}</td><td class="value">${t(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return t(e)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function on(e,t,{offsetX:n,offsetY:r}){const i=an({x1:e.clientX,x2:e.clientX,y1:e.clientY,y2:e.clientY},t,n,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const e of o)if(sn(i[e],t))return i[e];return i["top-left"]}function an(e,t,n,r){const i=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,a=e.x1-t.width-n,s=i-t.width/2,l=e.x2+n,c=e.y1-t.height-r,f=o-t.height/2,p=e.y2+r;return{top:{x:s,y:c},bottom:{x:s,y:p},left:{x:a,y:f},right:{x:l,y:f},"top-left":{x:a,y:c},"top-right":{x:l,y:c},"bottom-left":{x:a,y:p},"bottom-right":{x:l,y:p}}}function sn(e,t){return e.x>=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function ln(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class cn{call;options;el;constructor(e){this.options={...rn,...e};const t=this.options.id;if(this.el=null,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 tn.toString().replaceAll(nn,e)}(t);const n=document.head;n.childNodes.length>0?n.insertBefore(e,n.childNodes[0]):n.appendChild(e)}}tooltipHandler(e,t,n,r){if(this.el=document.getElementById(this.options.id),!this.el){this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip");(document.fullscreenElement??document.body).appendChild(this.el)}if(null==r||""===r)return void this.el.classList.remove("visible",`${this.options.theme}-theme`);this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:i,y:o}="mark"===this.options.anchor?function(e,t,n,r,i){const{position:o,offsetX:a,offsetY:s}=i,l=function(e,t,n){const r=n.isVoronoi?n.datum.bounds:n.bounds;let i=e.left+t[0]+r.x1,o=e.top+t[1]+r.y1,a=n;for(;a.mark.group;)a=a.mark.group,i+=a.x??0,o+=a.y??0;return{x1:i,x2:i+(r.x2-r.x1),y1:o,y2:o+(r.y2-r.y1)}}(e._el.getBoundingClientRect(),e._origin,n),c=an(l,r,a,s),f=Array.isArray(o)?o:[o];for(const e of f)if(sn(c[e],r)&&!ln(t,c[e],r))return c[e];return on(t,r,i)}(e,t,n,this.el.getBoundingClientRect(),this.options):on(t,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}var fn='.vega-embed {\n position: relative;\n display: inline-block;\n box-sizing: border-box;\n}\n.vega-embed.fit-x {\n display: block;\n width: 100%;\n}\n.vega-embed.has-actions {\n padding-right: 38px;\n}\n.vega-embed details:not([open]) > :not(summary) {\n display: none !important;\n}\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 cursor: pointer;\n line-height: 0px;\n}\n.vega-embed summary::-webkit-details-marker {\n display: none;\n}\n.vega-embed summary:active {\n box-shadow: #aaa 0px 0px 0px 1px inset;\n}\n.vega-embed summary svg {\n width: 14px;\n height: 14px;\n}\n.vega-embed details[open] summary {\n opacity: 0.7;\n}\n.vega-embed:hover summary, .vega-embed:focus-within summary {\n opacity: 1 !important;\n transition: opacity 0.2s ease;\n}\n.vega-embed .vega-actions {\n position: absolute;\n z-index: 1001;\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 text-align: left;\n}\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}\n.vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {\n background-color: #f7f7f9;\n color: black;\n}\n.vega-embed .vega-actions::before, .vega-embed .vega-actions::after {\n content: "";\n display: inline-block;\n position: absolute;\n}\n.vega-embed .vega-actions::before {\n left: auto;\n right: 14px;\n top: -16px;\n border: 8px solid rgba(0, 0, 0, 0);\n border-bottom-color: #d9d9d9;\n}\n.vega-embed .vega-actions::after {\n left: auto;\n right: 15px;\n top: -14px;\n border: 7px solid rgba(0, 0, 0, 0);\n border-bottom-color: #fff;\n}\n.vega-embed .chart-wrapper.fit-x {\n width: 100%;\n}\n.vega-embed .chart-wrapper.fit-y {\n height: 100%;\n}\n\n.vega-embed-wrapper {\n max-width: 100%;\n overflow: auto;\n padding-right: 14px;\n}\n\n@keyframes scale-in {\n from {\n opacity: 0;\n transform: scale(0.6);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n';function pn(e,...t){for(const n of t)dn(e,n);return e}function dn(t,n){for(const r of Object.keys(n))e.writeConfig(t,r,n[r],!0)}const hn="7.3.0",un=i;let gn=o;const mn="undefined"!=typeof window?window:void 0;void 0===gn&&mn?.vl?.compile&&(gn=mn.vl);const En={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},vn={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"},bn={vega:"Vega","vega-lite":"Vega-Lite"},yn={vega:un.version,"vega-lite":gn?gn.version:"not available"},wn={vega:e=>e,"vega-lite":(e,t,n)=>gn.compile(e,{config:n,logger:t}).spec},On='\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>',In="chart-wrapper";function An(e,t,n,r){const i=`<html><head>${t}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,a=window.open("");a.document.write(i+e+o),a.document.title=`${bn[r]} JSON Source`}function Ln(e){return!(!e||!("load"in e))}function xn(e){return Ln(e)?e:un.loader(e)}async function $n(t,n,r={}){let i,o;e.isString(n)?(o=xn(r.loader),i=JSON.parse(await o.load(n))):i=n;const a=function(t){const n=t.usermeta?.embedOptions??{};return e.isString(n.defaultStyle)&&(n.defaultStyle=!1),n}(i),s=a.loader;o&&!s||(o=xn(r.loader??s));const l=await Nn(a,o),c=await Nn(r,o),f={...pn(c,l),config:e.mergeConfig(c.config??{},l.config??{})};return await async function(t,n,r={},i){const o=r.theme?e.mergeConfig(Kt[r.theme],r.config??{}):r.config,a=e.isBoolean(r.actions)?r.actions:pn({},En,r.actions??{}),s={...vn,...r.i18n},l=r.renderer??"svg",c=r.logger??e.logger(un.Warn);void 0!==r.logLevel&&c.level(r.logLevel);const f=r.downloadFileName??"visualization",p="string"==typeof t?document.querySelector(t):t;if(!p)throw new Error(`${t} does not exist`);if(!1!==r.defaultStyle){const e="vega-embed-style",{root:t,rootContainer:n}=function(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}(p);if(!t.getElementById(e)){const t=document.createElement("style");t.id=e,t.innerHTML=void 0===r.defaultStyle||!0===r.defaultStyle?fn.toString():r.defaultStyle,n.appendChild(t)}}const d=function(e,t,n){const r=void 0!==n&&n in bn;if(e.$schema){const i=Je(e.$schema);if(n&&n!==i.library&&(t.warn(`The given visualization spec is written in ${bn[i.library]}, but mode argument sets ${bn[n]??n}.`),r))return n;const o=i.library;return Ne(yn[o],`^${i.version.slice(1)}`)||t.warn(`The input spec uses ${bn[o]} ${i.version}, but the current version of ${bn[o]} is v${yn[o]}.`),o}return r?n:"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"vega"}(n,c,r.mode);let h=wn[d](n,c,o);if("vega-lite"===d&&h.$schema){const e=Je(h.$schema);Ne(yn.vega,`^${e.version.slice(1)}`)||c.warn(`The compiled spec uses Vega ${e.version}, but current version is v${yn.vega}.`)}p.classList.add("vega-embed"),a&&p.classList.add("has-actions");p.innerHTML="";let u=p;if(a){const e=document.createElement("div");e.classList.add(In),p.appendChild(e),u=e}const g=r.patch;g&&(h=g instanceof Function?g(h):I(h,g,!0,!1).newDocument);r.formatLocale&&un.formatLocale(r.formatLocale);r.timeFormatLocale&&un.timeFormatLocale(r.timeFormatLocale);if(r.expressionFunctions)for(const e in r.expressionFunctions){const t=r.expressionFunctions[e];"fn"in t?un.expressionFunction(e,t.fn,t.visitor):t instanceof Function&&un.expressionFunction(e,t)}const{ast:m}=r,E=un.parse(h,"vega-lite"===d?{}:o,{ast:m}),v=new(r.viewClass||un.View)(E,{loader:i,logger:c,renderer:l,...m?{expr:un.expressionInterpreter??r.expr??Ye}:{}});if(v.addSignalListener("autosize",(e,t)=>{const{type:n}=t,r="fit-x"==n||"fit"==n,i="fit-y"==n||"fit"==n;for(const e of new Set([u,p]))e.classList.toggle("fit-x",r),e.classList.toggle("fit-y",i)}),!1!==r.tooltip){const{loader:e,tooltip:t}=r,n=e&&!Ln(e)?e?.baseURL:void 0,i="function"==typeof t?t:new cn({baseURL:n,...!0===t?{}:t}).call;v.tooltip(i)}let b,{hover:y}=r;void 0===y&&(y="vega"===d);if(y){const{hoverSet:e,updateSet:t}="boolean"==typeof y?{}:y;v.hover(e,t)}r&&(null!=r.width&&v.width(r.width),null!=r.height&&v.height(r.height),null!=r.padding&&v.padding(r.padding));if(await v.initialize(u,r.bind).runAsync(),!1!==a){let t=p;if(!1!==r.defaultStyle||r.forceActionsMenu){const e=document.createElement("details");e.title=s.CLICK_TO_VIEW_ACTIONS,p.append(e),t=e;const n=document.createElement("summary");n.innerHTML=On,e.append(n),b=t=>{e.contains(t.target)||e.removeAttribute("open")},document.addEventListener("click",b)}const i=document.createElement("div");if(t.append(i),i.classList.add("vega-actions"),!0===a||!1!==a.export)for(const t of["svg","png"])if(!0===a||!0===a.export||a.export[t]){const n=s[`${t.toUpperCase()}_ACTION`],o=document.createElement("a"),a=e.isObject(r.scaleFactor)?r.scaleFactor[t]:r.scaleFactor;o.text=n,o.href="#",o.target="_blank",o.download=`${f}.${t}`,o.addEventListener("mousedown",async function(e){e.preventDefault();const n=await v.toImageURL(t,a);this.href=n}),i.append(o)}if(!0===a||!1!==a.source){const e=document.createElement("a");e.text=s.SOURCE_ACTION,e.href="#",e.addEventListener("click",function(e){An(k(n),r.sourceHeader??"",r.sourceFooter??"",d),e.preventDefault()}),i.append(e)}if("vega-lite"===d&&(!0===a||!1!==a.compiled)){const e=document.createElement("a");e.text=s.COMPILED_ACTION,e.href="#",e.addEventListener("click",function(e){An(k(h),r.sourceHeader??"",r.sourceFooter??"","vega"),e.preventDefault()}),i.append(e)}const u=r.editorUrl??"https://vega.github.io/editor/",m=!0===a||!1!==a.editor;if(m&&!function(e){let t;try{({protocol:t}=new URL(e))}catch{return!1}return"http:"===t||"https:"===t}(u))c.warn(`Ignoring the editor action since editorUrl is not an http or https url: ${u}`);else if(m){const e=document.createElement("a");e.text=s.EDITOR_ACTION,e.href="#",e.addEventListener("click",function(e){!function(e,t,n){const r=e.open(t),{origin:i}=new URL(t);let o=40;e.addEventListener("message",function t(n){n.source===r&&(o=0,e.removeEventListener("message",t,!1))},!1),setTimeout(function e(){o<=0||(r.postMessage(n,i),setTimeout(e,250),o-=1)},250)}(window,u,{config:o,mode:g?"vega":d,renderer:l,spec:k(g?h:n)}),e.preventDefault()}),i.append(e)}}function w(){b&&document.removeEventListener("click",b),v.finalize()}return{view:v,spec:n,vgSpec:h,finalize:w,embedOptions:r}}(t,i,f,o)}async function Nn(t,n){const r=e.isString(t.config)?JSON.parse(await n.load(t.config)):t.config??{},i=e.isString(t.patch)?JSON.parse(await n.load(t.patch)):t.patch;return{...t,...i?{patch:i}:{},...r?{config:r}:{}}}async function Rn(e,t={}){const n=document.createElement("div");n.classList.add("vega-embed-wrapper");const r=document.createElement("div");n.appendChild(r);const i=!0===t.actions||!1===t.actions?t.actions:{export:!0,source:!1,compiled:!0,editor:!0,...t.actions},o=await $n(r,e,{actions:i,...t});return n.value=o.view,n}const Sn=(...t)=>{return t.length>1&&(e.isString(t[0])&&!((n=t[0]).startsWith("http://")||n.startsWith("https://")||n.startsWith("//"))||t[0]instanceof HTMLElement||3===t.length)?$n(t[0],t[1],t[2]):Rn(t[0],t[1]);var n};return Sn.vegaLite=gn,Sn.vl=gn,Sn.container=Rn,Sn.embed=$n,Sn.vega=un,Sn.default=$n,Sn.version=hn,Sn});
//# sourceMappingURL=vega-embed.min.js.map
</script><script>const spec={$schema:'https://vega.github.io/schema/vega-lite/v6.json',description:'Fictional route stops: North 14, East 9, West 17.',width:'container',height:220,data:{values:[{route:'North',stops:14},{route:'East',stops:9},{route:'West',stops:17}]},mark:{type:'bar',tooltip:true},encoding:{x:{field:'route',type:'nominal',title:'Route'},y:{field:'stops',type:'quantitative',title:'Stops'}}};window.chartReady=vegaEmbed('#chart',spec,{renderer:'svg',actions:false}).then(r=>{window.chartResult=r;return r;});</script></body></html>