genesys-spark-chart-components 4.188.5 → 4.189.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/cjs/{color-palette-D6fGbrKt.js → color-palette-Cvcn-ivx.js} +1 -1
  2. package/dist/cjs/gux-chart-column-beta.cjs.entry.js +1 -1
  3. package/dist/cjs/gux-chart-donut-beta.cjs.entry.js +1 -1
  4. package/dist/cjs/gux-chart-line-beta.cjs.entry.js +1 -1
  5. package/dist/cjs/gux-chart-pie-beta.cjs.entry.js +1 -1
  6. package/dist/cjs/gux-chart-scatter-plot-beta.cjs.entry.js +1 -1
  7. package/dist/cjs/gux-visualization-beta.cjs.entry.js +1 -1
  8. package/dist/esm/{color-palette-NNvQg9RF.js → color-palette-C-o-YsN6.js} +1 -1
  9. package/dist/esm/gux-chart-column-beta.entry.js +1 -1
  10. package/dist/esm/gux-chart-donut-beta.entry.js +1 -1
  11. package/dist/esm/gux-chart-line-beta.entry.js +1 -1
  12. package/dist/esm/gux-chart-pie-beta.entry.js +1 -1
  13. package/dist/esm/gux-chart-scatter-plot-beta.entry.js +1 -1
  14. package/dist/esm/gux-visualization-beta.entry.js +1 -1
  15. package/dist/genesys-chart-webcomponents/genesys-chart-webcomponents.esm.js +1 -1
  16. package/dist/genesys-chart-webcomponents/{p-a564c16a.entry.js → p-2b2a3570.entry.js} +1 -1
  17. package/dist/genesys-chart-webcomponents/{p-40b98814.entry.js → p-51f0f5a6.entry.js} +1 -1
  18. package/dist/genesys-chart-webcomponents/{p-7f352c7c.entry.js → p-67466b9b.entry.js} +1 -1
  19. package/dist/genesys-chart-webcomponents/{p-e7e4aa13.entry.js → p-88d344b2.entry.js} +1 -1
  20. package/dist/genesys-chart-webcomponents/{p-f603bac6.entry.js → p-8987b474.entry.js} +1 -1
  21. package/dist/genesys-chart-webcomponents/{p-NNvQg9RF.js → p-C-o-YsN6.js} +1 -1
  22. package/dist/genesys-chart-webcomponents/{p-764983ed.entry.js → p-c157c2fb.entry.js} +1 -1
  23. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import{r as t,c as n,h as e,g as r}from"./p-WPqt-wWR.js";import{a as i,D as o,t as a}from"./p-NNvQg9RF.js";const u=/("(?:[^\\"]|\\.)*")|[:,]/g;function s(t,n={}){const e=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===e?1/0:void 0===n.maxLength?80:n.maxLength;let{replacer:i}=n;return function t(n,o,a){n&&"function"==typeof n.toJSON&&(n=n.toJSON());const s=JSON.stringify(n,i);if(void 0===s)return s;const c=r-o.length-a;if(s.length<=c){const t=s.replace(u,((t,n)=>n||`${t} `));if(t.length<=c)return t}if(null!=i&&(n=JSON.parse(s),i=void 0),"object"==typeof n&&null!==n){const r=o+e,i=[];let a,u,s=0;if(Array.isArray(n)){a="[",u="]";const{length:e}=n;for(;s<e;s++)i.push(t(n[s],r,s===e-1?0:1)||"null")}else{a="{",u="}";const e=Object.keys(n),{length:o}=e;for(;s<o;s++){const a=e[s],u=`${JSON.stringify(a)}: `,c=t(n[a],r,u.length+(s===o-1?0:1));void 0!==c&&i.push(u+c)}}if(i.length>0)return[a,e+i.join(`,\n${r}`),u].join(`\n${o}`)}return s}(t,"",0)}function c(t,n,e){return t.fields=n||[],t.fname=e,t}function l(t){return null==t?null:t.fname}function f(t){return null==t?null:t.fields}function d(t){return 1===t.length?h(t[0]):m(t)}const h=t=>function(n){return n[t]},m=t=>{const n=t.length;return function(e){for(let r=0;r<n;++r)e=e[t[r]];return e}};function p(t){throw Error(t)}function g(t){const n=[],e=t.length;let r,i,o,a=null,u=0,s="";function c(){n.push(s+t.substring(r,i)),s="",r=i+1}for(t+="",r=i=0;i<e;++i)if(o=t[i],"\\"===o)s+=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||p("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&p("Access path missing closing bracket: "+t),a&&p("Access path missing closing quote: "+t),i>r&&(i++,c()),n}function v(t,n,e){const r=g(t);return t=1===r.length?r[0]:t,c((e&&e.get||d)(r),[t],n||t)}const y=v("id"),b=c((t=>t),[],"identity"),w=c((()=>0),[],"zero"),x=c((()=>1),[],"one"),$=c((()=>!0),[],"true"),k=c((()=>!1),[],"false"),M=new Set([...Object.getOwnPropertyNames(Object.prototype).filter((t=>"function"==typeof Object.prototype[t])),"__proto__"]);function A(t,n,e){const r=[n].concat([].slice.call(e));console[t].apply(console,r)}function D(t,n,e=A){let r=t||0;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=1&&e(n||"error","ERROR",arguments),this},warn(){return r>=2&&e(n||"warn","WARN",arguments),this},info(){return r>=3&&e(n||"log","INFO",arguments),this},debug(){return r>=4&&e(n||"log","DEBUG",arguments),this}}}var S=Array.isArray;function F(t){return t===Object(t)}const E=t=>"__proto__"!==t;function N(...t){return t.reduce(((t,n)=>{for(const e in n)"signals"===e?t.signals=O(t.signals,n.signals):C(t,e,n[e],"legend"===e?{layout:1}:"style"===e||null);return t}),{})}function C(t,n,e,r){if(!E(n))return;let i,o;if(F(e)&&!S(e))for(i in o=F(t[n])?t[n]:t[n]={},e)r&&(!0===r||r[i])?C(o,i,e[i]):E(i)&&(o[i]=e[i]);else t[n]=e}function O(t,n){if(null==t)return n;const e={},r=[];function i(t){e[t.name]||(e[t.name]=1,r.push(t))}return n.forEach(i),t.forEach(i),r}function _(t){return t[t.length-1]}function z(t){return null==t||""===t?null:+t}const B=t=>n=>t*Math.exp(n),T=t=>n=>Math.log(t*n),P=t=>n=>Math.sign(n)*Math.log1p(Math.abs(n/t)),j=t=>n=>Math.sign(n)*Math.expm1(Math.abs(n))*t,R=t=>n=>n<0?-Math.pow(-n,t):Math.pow(n,t);function L(t,n,e,r){const i=e(t[0]),o=e(_(t)),a=(o-i)*n;return[r(i-a),r(o-a)]}function I(t,n){return L(t,n,z,b)}function q(t,n){var e=Math.sign(t[0]);return L(t,n,T(e),B(e))}function U(t,n,e){return L(t,n,R(e),R(1/e))}function W(t,n,e){return L(t,n,P(e),j(e))}function H(t,n,e,r,i){const o=r(t[0]),a=r(_(t)),u=null!=n?r(n):(o+a)/2;return[i(u+(o-u)*e),i(u+(a-u)*e)]}function G(t,n,e){return H(t,n,e,z,b)}function Y(t,n,e){const r=Math.sign(t[0]);return H(t,n,e,T(r),B(r))}function V(t,n,e,r){return H(t,n,e,R(r),R(1/r))}function X(t,n,e,r){return H(t,n,e,P(r),j(r))}function J(t){return 1+~~(new Date(t).getMonth()/3)}function K(t){return 1+~~(new Date(t).getUTCMonth()/3)}function Q(t){return null!=t?S(t)?t:[t]:[]}function Z(t,n,e){let r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),r=o-i,r>=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function tt(t){return"function"==typeof t}function nt(t,n,e){e=e||{},n=Q(n)||[];const r=[],i=[],o={},a=e.comparator||rt;return Q(t).forEach(((t,a)=>{null!=t&&(r.push("descending"===n[a]?-1:1),i.push(t=tt(t)?t:v(t,null,e)),(f(t)||[]).forEach((t=>o[t]=1)))})),0===i.length?null:c(a(i,r),Object.keys(o))}const et=(t,n)=>(t<n||null==t)&&null!=n?-1:(t>n||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0),rt=(t,n)=>1===t.length?it(t[0],n[0]):ot(t,n,t.length),it=(t,n)=>function(e,r){return et(t(e),t(r))*n},ot=(t,n,e)=>(n.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++u<e;)o=t[u],a=et(o(r),o(i));return a*n[u]});function at(t){return tt(t)?t:()=>t}function ut(t,n){let e;return r=>{e&&clearTimeout(e),e=setTimeout((()=>(n(r),e=null)),t)}}function st(t){for(let n,e,r=1,i=arguments.length;r<i;++r)for(e in n=arguments[r],n)t[e]=n[e];return t}function ct(t,n){let e,r,i,o,a=0;if(t&&(e=t.length))if(null==n){for(r=t[a];a<e&&(null==r||r!=r);r=t[++a]);for(i=o=r;a<e;++a)r=t[a],null!=r&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=n(t[a]);a<e&&(null==r||r!=r);r=n(t[++a]));for(i=o=r;a<e;++a)r=n(t[a]),null!=r&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]}function lt(t,n){const e=t.length;let r,i,o,a,u,s=-1;if(null==n){for(;++s<e;)if(i=t[s],null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=t[s],null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}else{for(;++s<e;)if(i=n(t[s],s,t),null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=n(t[s],s,t),null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}return[a,u]}function ft(t,n){return Object.hasOwn(t,n)}const dt={};function ht(t){let n,e={};function r(t){return ft(e,t)&&e[t]!==dt}const i={size:0,empty:0,object:e,has:r,get:t=>r(t)?e[t]:void 0,set(t,n){return r(t)||(++i.size,e[t]===dt&&--i.empty),e[t]=n,this},delete(t){return r(t)&&(--i.size,++i.empty,e[t]=dt),this},clear(){i.size=i.empty=0,i.object=e={}},test(t){return arguments.length?(n=t,i):n},clean(){const t={};let r=0;for(const i in e){const o=e[i];o===dt||n&&n(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=e=t}};return t&&Object.keys(t).forEach((n=>{i.set(n,t[n])})),i}function mt(t,n,e,r,i,o){if(!e&&0!==e)return o;const a=+e;let u,s=t[0],c=_(t);c<s&&(u=s,s=c,c=u),u=Math.abs(n-s);const l=Math.abs(c-n);return u<l&&u<=a?r:l<=a?i:o}function pt(t,n,e){const r=t.prototype=Object.create(n.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),st(r,e)}function gt(t,n,e,r){let i,o=n[0],a=n[n.length-1];return o>a&&(i=o,o=a,a=i),r=void 0===r||r,((e=void 0===e||e)?o<=t:o<t)&&(r?t<=a:t<a)}function vt(t){return"boolean"==typeof t}function yt(t){return"[object Date]"===Object.prototype.toString.call(t)}function bt(t){return t&&tt(t[Symbol.iterator])}function wt(t){return"number"==typeof t}function xt(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function $t(t){return"string"==typeof t}function kt(t,n,e){t&&(t=n?Q(t).map((t=>t.replace(/\\(.)/g,"$1"))):Q(t));const r=t&&t.length,i=e&&e.get||d,o=t=>i(n?[t]:g(t));let a;if(r)if(1===r){const n=o(t[0]);a=function(t){return""+n(t)}}else{const n=t.map(o);a=function(t){let e=""+n[0](t),i=0;for(;++i<r;)e+="|"+n[i](t);return e}}else a=function(){return""};return c(a,t,"key")}function Mt(t,n){const e=t[0],r=_(t),i=+n;return i?1===i?r:e+i*(r-e):e}function At(t){let n,e,r;t=+t||1e4;const i=()=>{n={},e={},r=0},o=(i,o)=>(++r>t&&(e=n,n={},r=1),n[i]=o);return i(),{clear:i,has:t=>ft(n,t)||ft(e,t),get:t=>ft(n,t)?n[t]:ft(e,t)?o(t,e[t]):void 0,set:(t,e)=>ft(n,t)?n[t]=e:o(t,e)}}function Dt(t,n,e,r){const i=n.length,o=e.length;if(!o)return n;if(!i)return e;const a=r||new n.constructor(i+o);let u=0,s=0,c=0;for(;u<i&&s<o;++c)a[c]=t(n[u],e[s])>0?e[s++]:n[u++];for(;u<i;++u,++c)a[c]=n[u];for(;s<o;++s,++c)a[c]=e[s];return a}function St(t,n){let e="";for(;--n>=0;)e+=t;return e}function Ft(t,n,e,r){const i=e||" ",o=t+"",a=n-o.length;return a<=0?o:"left"===r?St(i,a)+o:"center"===r?St(i,~~(a/2))+o+St(i,Math.ceil(a/2)):o+St(i,a)}function Et(t){return t&&_(t)-t[0]||0}function Nt(t){return S(t)?`[${t.map((t=>null===t?"null":Nt(t)))}]`:F(t)||$t(t)?JSON.stringify(t).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029"):t}function Ct(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t||!t)}const Ot=t=>wt(t)||yt(t)?t:Date.parse(t);function _t(t,n){return n=n||Ot,null==t||""===t?null:n(t)}function zt(t){return null==t||""===t?null:t+""}function Bt(t){const n={},e=t.length;for(let r=0;r<e;++r)n[t[r]]=!0;return n}function Tt(t,n,e,r){const i=null!=r?r:"…",o=t+"",a=o.length,u=Math.max(0,n-i.length);return a<=n?o:"left"===e?i+o.slice(a-u):"center"===e?o.slice(0,Math.ceil(u/2))+i+o.slice(a-~~(u/2)):o.slice(0,u)+i}function Pt(t,n,e){if(t)if(n){const r=t.length;for(let i=0;i<r;++i){const r=n(t[i]);r&&e(r,i,t)}}else t.forEach(e)}var jt={},Rt={};function Lt(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function It(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}function qt(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function Ut(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,s=o<=0,c=!1;function l(){if(s)return Rt;if(c)return c=!1,jt;var n,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(n=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(n=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==e)continue;return t.slice(i,n)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=l())!==Rt;){for(var f=[];r!==jt&&r!==Rt;)f.push(r),r=l();n&&null==(f=n(f,u++))||i.push(f)}return i}function i(n,e){return n.map((function(n){return e.map((function(t){return a(n[t])})).join(t)}))}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?function(t){var n=t.getUTCHours(),e=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+qt(-t,6):t>9999?"+"+qt(t,6):qt(t,4)}(t.getUTCFullYear())+"-"+qt(t.getUTCMonth()+1,2)+"-"+qt(t.getUTCDate(),2)+(i?"T"+qt(n,2)+":"+qt(e,2)+":"+qt(r,2)+"."+qt(i,3)+"Z":r?"T"+qt(n,2)+":"+qt(e,2)+":"+qt(r,2)+"Z":e||n?"T"+qt(n,2)+":"+qt(e,2)+"Z":"")}(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,(function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=Lt(t);return function(r,i){return n(e(r),i,t)}}(t,n):Lt(t)}));return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=It(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=It(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}function Wt(t){return t}function Ht(t,n){return"string"==typeof n&&(n=t.objects[n]),"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map((function(n){return Gt(t,n)}))}:Gt(t,n)}function Gt(t,n){var e=n.id,r=n.bbox,i=null==n.properties?{}:n.properties,o=Yt(t,n);return null==e&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:e,properties:i,geometry:o}:{type:"Feature",id:e,bbox:r,properties:i,geometry:o}}function Yt(t,n){var e=function(t){if(null==t)return Wt;var n,e,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,u){u||(n=e=0);var s=2,c=t.length,l=new Array(c);for(l[0]=(n+=t[0])*r+o,l[1]=(e+=t[1])*i+a;s<c;)l[s]=t[s],++s;return l}}(t.transform),r=t.arcs;function i(t,n){n.length&&n.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)n.push(e(i[o],o));t<0&&function(t,n){for(var e,r=t.length,i=r-n;i<--r;)e=t[i],t[i++]=t[r],t[r]=e}(n,a)}function o(t){return e(t)}function a(t){for(var n=[],e=0,r=t.length;e<r;++e)i(t[e],n);return n.length<2&&n.push(n[0]),n}function u(t){for(var n=a(t);n.length<4;)n.push(n[0]);return n}function s(t){return t.map(u)}return function t(n){var e,r=n.type;switch(r){case"GeometryCollection":return{type:r,geometries:n.geometries.map(t)};case"Point":e=o(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(o);break;case"LineString":e=a(n.arcs);break;case"MultiLineString":e=n.arcs.map(a);break;case"Polygon":e=s(n.arcs);break;case"MultiPolygon":e=n.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}(n)}function Vt(t,n){var e={},r={},i={},o=[],a=-1;function u(t,n){for(var r in t){var i=t[r];delete n[i.start],delete i.start,delete i.end,i.forEach((function(t){e[t<0?~t:t]=1})),o.push(i)}}return n.forEach((function(e,r){var i,o=t.arcs[e<0?~e:e];o.length<3&&!o[1][0]&&!o[1][1]&&(i=n[++a],n[a]=e,n[r]=i)})),n.forEach((function(n){var e,o,a=function(n){var e,r=t.arcs[n<0?~n:n],i=r[0];return t.transform?(e=[0,0],r.forEach((function(t){e[0]+=t[0],e[1]+=t[1]}))):e=r[r.length-1],n<0?[e,i]:[i,e]}(n),u=a[0],s=a[1];if(e=i[u])if(delete i[e.end],e.push(n),e.end=s,o=r[s]){delete r[o.start];var c=o===e?e:e.concat(o);r[c.start=e.start]=i[c.end=o.end]=c}else r[e.start]=i[e.end]=e;else if(e=r[s])if(delete r[e.start],e.unshift(n),e.start=u,o=i[u]){delete i[o.end];var l=o===e?e:o.concat(e);r[l.start=o.start]=i[l.end=e.end]=l}else r[e.start]=i[e.end]=e;else r[(e=[n]).start=u]=i[e.end=s]=e})),u(i,r),u(r,i),n.forEach((function(t){e[t<0?~t:t]||o.push([t])})),o}function Xt(t){return Yt(t,Jt.apply(this,arguments))}function Jt(t,n,e){var r,i,o;if(arguments.length>1)r=function(t,n,e){var r,i=[],o=[];function a(t){var n=t<0?~t:t;(o[n]||(o[n]=[])).push({i:t,g:r})}function u(t){t.forEach(a)}function s(t){t.forEach(u)}return function t(n){switch(r=n,n.type){case"GeometryCollection":n.geometries.forEach(t);break;case"LineString":u(n.arcs);break;case"MultiLineString":case"Polygon":s(n.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(n.arcs)}}(n),o.forEach(null==e?function(t){i.push(t[0].i)}:function(t){e(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,n,e);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:Vt(t,r)}}function Kt(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Qt(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function Zt(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<0?i=n+1:o=n}while(i<o)}return i}return 2!==t.length?(n=Kt,e=(n,e)=>Kt(t(n),e),r=(n,e)=>t(n)-e):(n=t===Kt||t===Qt?t:tn,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<=0?i=n+1:o=n}while(i<o)}return i}}}function tn(){return 0}function nn(t){return null===t?NaN:+t}const en=Zt(Kt),rn=en.right,on=en.left;Zt(nn);class an{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class un extends Map{constructor(t,n=dn){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(cn(this,t))}has(t){return super.has(cn(this,t))}set(t,n){return super.set(ln(this,t),n)}delete(t){return super.delete(fn(this,t))}}class sn extends Set{constructor(t,n=dn){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(cn(this,t))}add(t){return super.add(ln(this,t))}delete(t){return super.delete(fn(this,t))}}function cn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function ln({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function fn({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function dn(t){return null!==t&&"object"==typeof t?t.valueOf():t}function hn(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(t<n?-1:t>n?1:0)}const mn=Math.sqrt(50),pn=Math.sqrt(10),gn=Math.sqrt(2);function vn(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=mn?10:o>=pn?5:o>=gn?2:1;let u,s,c;return i<0?(c=Math.pow(10,-i)/a,u=Math.round(t*c),s=Math.round(n*c),u/c<t&&++u,s/c>n&&--s,c=-c):(c=Math.pow(10,i)*a,u=Math.round(t/c),s=Math.round(n/c),u*c<t&&++u,s*c>n&&--s),s<u&&.5<=e&&e<2?vn(t,n,2*e):[u,s,c]}function yn(t,n,e){if(!((e=+e)>0))return[];if((t=+t)==(n=+n))return[t];const r=n<t,[i,o,a]=r?vn(n,t,e):vn(t,n,e);if(!(o>=i))return[];const u=o-i+1,s=new Array(u);if(r)if(a<0)for(let t=0;t<u;++t)s[t]=(o-t)/-a;else for(let t=0;t<u;++t)s[t]=(o-t)*a;else if(a<0)for(let t=0;t<u;++t)s[t]=(i+t)/-a;else for(let t=0;t<u;++t)s[t]=(i+t)*a;return s}function bn(t,n,e){return vn(t=+t,n=+n,e=+e)[2]}function wn(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?bn(n,t,e):bn(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}function xn(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function $n(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function kn(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?hn:function(t=Kt){if(t===Kt)return hn;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),s=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);kn(t,n,Math.max(e,Math.floor(n-a*s/o+c)),Math.min(r,Math.floor(n+(o-a)*s/o+c)),i)}const o=t[n];let a=e,u=r;for(Mn(t,e,n),i(t[r],o)>0&&Mn(t,e,r);a<u;){for(Mn(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[e],o)?Mn(t,e,u):(++u,Mn(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function Mn(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function An(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return $n(t);if(n>=1)return xn(t);var r,i=(r-1)*n,o=Math.floor(i),a=xn(kn(t,o).subarray(0,o+1));return a+($n(t.subarray(o+1))-a)*(i-o)}}function Dn(t,n,e=nn){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function Sn(t,n){return An(t,.5,n)}function Fn(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function En(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function Nn(t){let n=0;for(let e of t)(e=+e)&&(n+=e);return n}function Cn(t){return t instanceof sn?t:new sn(t)}function On(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function _n(t){return(t=On(Math.abs(t)))?t[1]:NaN}var zn,Bn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Tn(t){if(!(n=Bn.exec(t)))throw new Error("invalid format: "+t);var n;return new Pn({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Pn(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 jn(t,n){var e=On(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Tn.prototype=Pn.prototype,Pn.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 Rn={"%":(t,n)=>(100*t).toFixed(n),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,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>jn(100*t,n),r:jn,s:function(t,n){var e=On(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(zn=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")+On(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ln(t){return t}var In,qn,Un,Wn=Array.prototype.map,Hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Gn(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Ln:(n=Wn.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ln:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Wn.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=Tn(t)).fill,e=t.align,f=t.sign,d=t.symbol,h=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):Rn[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===n&&"="===e)&&(h=!0,n="0",e="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?s:"",x=Rn[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,d=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==f&&(M=!1),d=(M?"("===f?f:c:"-"===f||"("===f?"":f)+d,k=("s"===y?Hn[8+zn/3]:"")+k+(M&&"("===f?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!h&&(t=r(t,1/0));var A=d.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&h&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=d+t+k+D;break;case"=":t=d+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+k+D.slice(A);break;default:t=D+d+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var e=f(((t=Tn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(_n(n)/3))),i=Math.pow(10,-r),o=Hn[8+r/3];return function(t){return e(i*t)+o}}}}In=Gn({thousands:",",grouping:[3],currency:["$",""]}),qn=In.format,Un=In.formatPrefix;const Yn=new Date,Vn=new Date;function Xn(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>Xn((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Yn.setTime(+n),Vn.setTime(+r),t(Yn),t(Vn),Math.floor(e(Yn,Vn))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Jn=Xn((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Jn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Xn((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Jn:null);const Kn=1e3,Qn=6e4,Zn=36e5,te=864e5,ne=6048e5,ee=Xn((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*Kn)}),((t,n)=>(n-t)/Kn),(t=>t.getUTCSeconds())),re=Xn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kn)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getMinutes())),ie=Xn((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getUTCMinutes())),oe=Xn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kn-t.getMinutes()*Qn)}),((t,n)=>{t.setTime(+t+n*Zn)}),((t,n)=>(n-t)/Zn),(t=>t.getHours())),ae=Xn((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*Zn)}),((t,n)=>(n-t)/Zn),(t=>t.getUTCHours())),ue=Xn((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qn)/te),(t=>t.getDate()-1)),se=Xn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/te),(t=>t.getUTCDate()-1));function ce(t){return Xn((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qn)/ne))}Xn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/te),(t=>Math.floor(t/te)));const le=ce(0);function fe(t){return Xn((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/ne))}ce(1),ce(2),ce(3),ce(4),ce(5),ce(6);const de=fe(0);fe(1),fe(2),fe(3),fe(4),fe(5),fe(6);const he=Xn((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),me=Xn((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),pe=Xn((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));pe.every=t=>isFinite(t=Math.floor(t))&&t>0?Xn((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const ge=Xn((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));ge.every=t=>isFinite(t=Math.floor(t))&&t>0?Xn((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const ve="year",ye="quarter",be="month",we="week",xe="date",$e="day",ke="dayofyear",Me="hours",Ae="minutes",De="seconds",Se="milliseconds",Fe=[ve,ye,be,we,xe,$e,ke,Me,Ae,De,Se],Ee=Fe.reduce(((t,n,e)=>(t[n]=1+e,t)),{});function Ne(t){const n=Q(t).slice(),e={};return n.length||p("Missing time unit."),n.forEach((t=>{ft(Ee,t)?e[t]=1:p(`Invalid time unit: ${t}.`)})),(e[we]||e[$e]?1:0)+(e[ye]||e[be]||e[xe]?1:0)+(e[ke]?1:0)>1&&p(`Incompatible time units: ${t}`),n.sort(((t,n)=>Ee[t]-Ee[n])),n}const Ce={[ve]:"%Y ",[ye]:"Q%q ",[be]:"%b ",[xe]:"%d ",[we]:"W%U ",[$e]:"%a ",[ke]:"%j ",[Me]:"%H:00",[Ae]:"00:%M",[De]:":%S",[Se]:".%L",[`${ve}-${be}`]:"%Y-%m ",[`${ve}-${be}-${xe}`]:"%Y-%m-%d ",[`${Me}-${Ae}`]:"%H:%M"};function Oe(t,n){const e=st({},Ce,n),r=Ne(t),i=r.length;let o,a,u="",s=0;for(s=0;s<i;)for(o=r.length;o>s;--o)if(a=r.slice(s,o).join("-"),null!=e[a]){u+=e[a],s=o;break}return u.trim()}const _e=new Date;function ze(t){return _e.setFullYear(t),_e.setMonth(0),_e.setDate(1),_e.setHours(0,0,0,0),_e}function Be(t){return Pe(new Date(t))}function Te(t){return je(new Date(t))}function Pe(t){return ue.count(ze(t.getFullYear())-1,t)}function je(t){return le.count(ze(t.getFullYear())-1,t)}function Re(t){return ze(t).getDay()}function Le(t,n,e,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,n,e,r,i,o,a);return u.setFullYear(t),u}return new Date(t,n,e,r,i,o,a)}function Ie(t){return Ue(new Date(t))}function qe(t){return We(new Date(t))}function Ue(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return se.count(n-1,t)}function We(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return de.count(n-1,t)}function He(t){return _e.setTime(Date.UTC(t,0,1)),_e.getUTCDay()}function Ge(t,n,e,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,n,e,r,i,o,a));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(t,n,e,r,i,o,a))}function Ye(t,n,e,r,i){const o=n||1,a=_(t),u=(t,n,i)=>function(t,n,e,r){const i=e<=1?t:r?(n,i)=>r+e*Math.floor((t(n,i)-r)/e):(n,r)=>e*Math.floor(t(n,r)/e);return n?(t,e)=>n(i(t,e),e):i}(e[i=i||t],r[i],t===a&&o,n),s=new Date,c=Bt(t),l=c[ve]?u(ve):at(2012),f=c[be]?u(be):c[ye]?u(ye):w,d=c[we]&&c[$e]?u($e,1,we+$e):c[we]?u(we,1):c[$e]?u($e,1):c[xe]?u(xe,1):c[ke]?u(ke,1):x,h=c[Me]?u(Me):w,m=c[Ae]?u(Ae):w,p=c[De]?u(De):w,g=c[Se]?u(Se):w;return function(t){s.setTime(+t);const n=l(s);return i(n,f(s),d(s,n),h(s),m(s),p(s),g(s))}}function Ve(t,n,e){return n+7*t-(e+6)%7}const Xe={[ve]:t=>t.getFullYear(),[ye]:t=>Math.floor(t.getMonth()/3),[be]:t=>t.getMonth(),[xe]:t=>t.getDate(),[Me]:t=>t.getHours(),[Ae]:t=>t.getMinutes(),[De]:t=>t.getSeconds(),[Se]:t=>t.getMilliseconds(),[ke]:t=>Pe(t),[we]:t=>je(t),[we+$e]:(t,n)=>Ve(je(t),t.getDay(),Re(n)),[$e]:(t,n)=>Ve(1,t.getDay(),Re(n))},Je={[ye]:t=>3*t,[we]:(t,n)=>Ve(t,0,Re(n))};function Ke(t,n){return Ye(t,n||1,Xe,Je,Le)}const Qe={[ve]:t=>t.getUTCFullYear(),[ye]:t=>Math.floor(t.getUTCMonth()/3),[be]:t=>t.getUTCMonth(),[xe]:t=>t.getUTCDate(),[Me]:t=>t.getUTCHours(),[Ae]:t=>t.getUTCMinutes(),[De]:t=>t.getUTCSeconds(),[Se]:t=>t.getUTCMilliseconds(),[ke]:t=>Ue(t),[we]:t=>We(t),[$e]:(t,n)=>Ve(1,t.getUTCDay(),He(n)),[we+$e]:(t,n)=>Ve(We(t),t.getUTCDay(),He(n))},Ze={[ye]:t=>3*t,[we]:(t,n)=>Ve(t,0,He(n))};function tr(t,n){return Ye(t,n||1,Qe,Ze,Ge)}const nr={[ve]:pe,[ye]:he.every(3),[be]:he,[we]:le,[xe]:ue,[$e]:ue,[ke]:ue,[Me]:oe,[Ae]:re,[De]:ee,[Se]:Jn},er={[ve]:ge,[ye]:me.every(3),[be]:me,[we]:de,[xe]:se,[$e]:se,[ke]:se,[Me]:ae,[Ae]:ie,[De]:ee,[Se]:Jn};function rr(t){return nr[t]}function ir(t){return er[t]}function or(t,n,e){return t?t.offset(n,e):void 0}function ar(t,n,e){return or(rr(t),n,e)}function ur(t,n,e){return or(ir(t),n,e)}function sr(t,n,e,r){return t?t.range(n,e,r):void 0}function cr(t,n,e,r){return sr(rr(t),n,e,r)}function lr(t,n,e,r){return sr(ir(t),n,e,r)}const fr=31536e6,dr=[ve,be,xe,Me,Ae,De,Se],hr=dr.slice(0,-1),mr=hr.slice(0,-1),pr=mr.slice(0,-1),gr=pr.slice(0,-1),vr=[ve,be],yr=[ve],br=[[hr,1,1e3],[hr,5,5e3],[hr,15,15e3],[hr,30,3e4],[mr,1,6e4],[mr,5,3e5],[mr,15,9e5],[mr,30,18e5],[pr,1,36e5],[pr,3,108e5],[pr,6,216e5],[pr,12,432e5],[gr,1,864e5],[[ve,we],1,6048e5],[vr,1,2592e6],[vr,3,7776e6],[yr,1,fr]];function wr(t){const n=t.extent,e=t.maxbins||40,r=Math.abs(Et(n))/e;let i,o,a=Zt((t=>t[2])).right(br,r);return a===br.length?(i=yr,o=wn(n[0]/fr,n[1]/fr,e)):a?(a=br[r/br[a-1][2]<br[a][2]/r?a-1:a],i=a[0],o=a[1]):(i=dr,o=Math.max(wn(n[0],n[1],e),1)),{units:i,step:o}}var xr=new Date,$r=new Date;function kr(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return kr((function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return xr.setTime(+n),$r.setTime(+r),t(xr),t($r),Math.floor(e(xr,$r))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Mr=864e5,Ar=6048e5,Dr=kr((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/Mr}),(function(t){return t.getDate()-1}));function Sr(t){return kr((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/Ar}))}var Fr=Sr(0),Er=Sr(1);Sr(2),Sr(3);var Nr=Sr(4);Sr(5),Sr(6);var Cr=kr((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Cr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?kr((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var Or=kr((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/Mr}),(function(t){return t.getUTCDate()-1}));function _r(t){return kr((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/Ar}))}var zr=_r(0),Br=_r(1);_r(2),_r(3);var Tr=_r(4);_r(5),_r(6);var Pr=kr((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function jr(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Rr(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Lr(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function Ir(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Zr(i),l=ti(i),f=Zr(o),d=ti(o),h=Zr(a),m=ti(a),p=Zr(u),g=ti(u),v=Zr(s),y=ti(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:xi,e:xi,f:Di,g:Pi,G:Ri,H:$i,I:ki,j:Mi,L:Ai,m:Si,M:Fi,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:so,s:co,S:Ei,u:Ni,U:Ci,V:_i,w:zi,W:Bi,x:null,X:null,y:Ti,Y:ji,Z:Li,"%":uo},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Ii,e:Ii,f:Gi,g:ro,G:oo,H:qi,I:Ui,j:Wi,L:Hi,m:Yi,M:Vi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:so,s:co,S:Xi,u:Ji,U:Ki,V:Zi,w:to,W:no,x:null,X:null,y:eo,Y:io,Z:ao,"%":uo},x={a:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=m.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:fi,e:fi,f:vi,g:ui,G:ai,H:hi,I:hi,j:di,L:gi,m:li,M:mi,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=l.get(r[0].toLowerCase()),e+r[0].length):-1},q:ci,Q:bi,s:wi,S:pi,u:ei,U:ri,V:ii,w:ni,W:oi,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:ui,Y:ai,Z:si,"%":yi};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Yr[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=Lr(1900,void 0,1);if(M(o,t,e+="",0)!=e.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(n&&!("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=Rr(Lr(o.y,0,1))).getUTCDay(),r=i>4||0===i?Br.ceil(r):Br(r),r=Or.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=jr(Lr(o.y,0,1))).getDay(),r=i>4||0===i?Er.ceil(r):Er(r),r=Dr.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?Rr(Lr(o.y,0,1)).getUTCDay():jr(Lr(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,Rr(o)):jr(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Yr?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}Pr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?kr((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var qr,Ur,Wr,Hr,Gr,Yr={"-":"",_:" ",0:"0"},Vr=/^\s*\d+/,Xr=/^%/,Jr=/[\\^$*+?|[\]().{}]/g;function Kr(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Qr(t){return t.replace(Jr,"\\$&")}function Zr(t){return new RegExp("^(?:"+t.map(Qr).join("|")+")","i")}function ti(t){return new Map(t.map(((t,n)=>[t.toLowerCase(),n])))}function ni(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function ei(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function ri(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function ii(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function oi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function ai(t,n,e){var r=Vr.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function ui(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function si(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function ci(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function li(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function fi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function di(t,n,e){var r=Vr.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function hi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function mi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function pi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function gi(t,n,e){var r=Vr.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function vi(t,n,e){var r=Vr.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function yi(t,n,e){var r=Xr.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function bi(t,n,e){var r=Vr.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function wi(t,n,e){var r=Vr.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function xi(t,n){return Kr(t.getDate(),n,2)}function $i(t,n){return Kr(t.getHours(),n,2)}function ki(t,n){return Kr(t.getHours()%12||12,n,2)}function Mi(t,n){return Kr(1+Dr.count(Cr(t),t),n,3)}function Ai(t,n){return Kr(t.getMilliseconds(),n,3)}function Di(t,n){return Ai(t,n)+"000"}function Si(t,n){return Kr(t.getMonth()+1,n,2)}function Fi(t,n){return Kr(t.getMinutes(),n,2)}function Ei(t,n){return Kr(t.getSeconds(),n,2)}function Ni(t){var n=t.getDay();return 0===n?7:n}function Ci(t,n){return Kr(Fr.count(Cr(t)-1,t),n,2)}function Oi(t){var n=t.getDay();return n>=4||0===n?Nr(t):Nr.ceil(t)}function _i(t,n){return t=Oi(t),Kr(Nr.count(Cr(t),t)+(4===Cr(t).getDay()),n,2)}function zi(t){return t.getDay()}function Bi(t,n){return Kr(Er.count(Cr(t)-1,t),n,2)}function Ti(t,n){return Kr(t.getFullYear()%100,n,2)}function Pi(t,n){return Kr((t=Oi(t)).getFullYear()%100,n,2)}function ji(t,n){return Kr(t.getFullYear()%1e4,n,4)}function Ri(t,n){var e=t.getDay();return Kr((t=e>=4||0===e?Nr(t):Nr.ceil(t)).getFullYear()%1e4,n,4)}function Li(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Kr(n/60|0,"0",2)+Kr(n%60,"0",2)}function Ii(t,n){return Kr(t.getUTCDate(),n,2)}function qi(t,n){return Kr(t.getUTCHours(),n,2)}function Ui(t,n){return Kr(t.getUTCHours()%12||12,n,2)}function Wi(t,n){return Kr(1+Or.count(Pr(t),t),n,3)}function Hi(t,n){return Kr(t.getUTCMilliseconds(),n,3)}function Gi(t,n){return Hi(t,n)+"000"}function Yi(t,n){return Kr(t.getUTCMonth()+1,n,2)}function Vi(t,n){return Kr(t.getUTCMinutes(),n,2)}function Xi(t,n){return Kr(t.getUTCSeconds(),n,2)}function Ji(t){var n=t.getUTCDay();return 0===n?7:n}function Ki(t,n){return Kr(zr.count(Pr(t)-1,t),n,2)}function Qi(t){var n=t.getUTCDay();return n>=4||0===n?Tr(t):Tr.ceil(t)}function Zi(t,n){return t=Qi(t),Kr(Tr.count(Pr(t),t)+(4===Pr(t).getUTCDay()),n,2)}function to(t){return t.getUTCDay()}function no(t,n){return Kr(Br.count(Pr(t)-1,t),n,2)}function eo(t,n){return Kr(t.getUTCFullYear()%100,n,2)}function ro(t,n){return Kr((t=Qi(t)).getUTCFullYear()%100,n,2)}function io(t,n){return Kr(t.getUTCFullYear()%1e4,n,4)}function oo(t,n){var e=t.getUTCDay();return Kr((t=e>=4||0===e?Tr(t):Tr.ceil(t)).getUTCFullYear()%1e4,n,4)}function ao(){return"+0000"}function uo(){return"%"}function so(t){return+t}function co(t){return Math.floor(+t/1e3)}function lo(t){const n={};return e=>n[e]||(n[e]=t(e))}function fo(t){const n=lo(t.format),e=t.formatPrefix;return{format:n,formatPrefix:e,formatFloat(t){const e=Tn(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,n){return e=>{const r=t(e),i=r.indexOf(n);if(i<0)return r;let o=function(t,n){let e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if(e=t.charCodeAt(r),e>=48&&e<=57)return r+1}(r,i);const a=o<r.length?r.slice(o):"";for(;--o>i;)if("0"!==r[o]){++o;break}return r.slice(0,o)+a}}(n(e),n(".1f")(1)[1])}return n(e)},formatSpan(t,r,i,o){o=Tn(null==o?",f":o);const a=wn(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(_n(n)/3)))-_n(Math.abs(t)))}(a,u))||(o.precision=s),e(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,_n(n)-_n(t))+1}(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=function(t){return Math.max(0,-_n(Math.abs(t)))}(a))||(o.precision=s-2*("%"===o.type))}return n(o)}}}let ho,mo;function po(){return ho=fo({format:qn,formatPrefix:Un})}function go(t){return fo(Gn(t))}function vo(t){return arguments.length?ho=go(t):ho}function yo(t,n,e){F(e=e||{})||p(`Invalid time multi-format specifier: ${e}`);const r=n(De),i=n(Ae),o=n(Me),a=n(xe),u=n(we),s=n(be),c=n(ye),l=n(ve),f=t(e[Se]||".%L"),d=t(e[De]||":%S"),h=t(e[Ae]||"%I:%M"),m=t(e[Me]||"%I %p"),g=t(e[xe]||e[$e]||"%a %d"),v=t(e[we]||"%b %d"),y=t(e[be]||"%B"),b=t(e[ye]||"%B"),w=t(e[ve]||"%Y");return t=>(r(t)<t?f:i(t)<t?d:o(t)<t?h:a(t)<t?m:s(t)<t?u(t)<t?g:v:l(t)<t?c(t)<t?y:b:w)(t)}function bo(t){const n=lo(t.format),e=lo(t.utcFormat);return{timeFormat:t=>$t(t)?n(t):yo(n,rr,t),utcFormat:t=>$t(t)?e(t):yo(e,ir,t),timeParse:lo(t.parse),utcParse:lo(t.utcParse)}}function wo(){return mo=bo({format:Ur,parse:Wr,utcFormat:Hr,utcParse:Gr})}function xo(t){return bo(Ir(t))}function $o(t){return arguments.length?mo=xo(t):mo}qr=Ir({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"]}),Ur=qr.format,Wr=qr.parse,Hr=qr.utcFormat,Gr=qr.utcParse,po(),wo();const ko=(t,n)=>st({},t,n);function Mo(t,n){const e=t?go(t):vo(),r=n?xo(n):$o();return ko(e,r)}function Ao(t,n){const e=arguments.length;return e&&2!==e&&p("defaultLocale expects either zero or two arguments."),e?ko(vo(t),$o(n)):ko(vo(),$o())}const Do=/^(data:|([A-Za-z]+:)?\/\/)/,So=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Fo=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Eo(t,n){const e=await this.sanitize(t,n),r=e.href;return e.localFile?this.file(r):this.http(r,n?.http)}async function No(t,n){n=st({},this.options,n);const e=this.fileAccess,r={href:null};let i,o,a;const u=So.test(t.replace(Fo,""));null!=t&&"string"==typeof t&&u||p("Sanitize failure, invalid URI: "+Nt(t));const s=Do.test(t);return(a=n.baseURL)&&!s&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!s&&e,i?t=t.slice(7):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),o=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,n.target&&(r.target=n.target+""),n.rel&&(r.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(r.crossOrigin=n.crossOrigin+""),r}async function Co(){p("No file system access.")}async function Oo(t,n){const e=st({},this.options.http,n),r=n&&n.response,i=await fetch(t,e);return i.ok?tt(i[r])?i[r]():i.text():p(i.status+""+i.statusText)}const _o=t=>!(Number.isNaN(+t)||t instanceof Date),zo={boolean:Ct,integer:z,number:z,date:_t,string:zt,unknown:b},Bo=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>_o(t)&&Number.isInteger(+t),_o,t=>!Number.isNaN(Date.parse(t))],To=["boolean","integer","number","date"];function Po(t,n){if(!t||!t.length)return"unknown";const e=t.length,r=Bo.length,i=Bo.map(((t,n)=>n+1));for(let a,u,s=0,c=0;s<e;++s)for(u=n?t[s][n]:t[s],a=0;a<r;++a)if(i[a]&&null!=(o=u)&&o==o&&!Bo[a](u)&&(i[a]=0,++c,c===Bo.length))return"string";var o;return To[i.reduce(((t,n)=>0===t?n:t),0)-1]}function jo(t,n){return n.reduce(((n,e)=>(n[e]=Po(t,e),n)),{})}function Ro(t){const n=function(n,e){const r={delimiter:t};return Lo(n,e?st(e,r):r)};return n.responseType="text",n}function Lo(t,n){return n.header&&(t=n.header.map(Nt).join(n.delimiter)+"\n"+t),Ut(n.delimiter).parse(t+"")}function Io(t,n){const e=n&&n.property?v(n.property):b;return!F(t)||(r=t,"function"==typeof Buffer&&tt(Buffer.isBuffer)&&Buffer.isBuffer(r))?e(JSON.parse(t)):function(t,n){return!S(t)&&bt(t)&&(t=[...t]),n&&n.copy?JSON.parse(JSON.stringify(t)):t}(e(t),n);var r}Lo.responseType="text",Io.responseType="json";const qo={interior:(t,n)=>t!==n,exterior:(t,n)=>t===n};function Uo(t,n){let e,r,i,o;return t=Io(t,n),n&&n.feature?(e=Ht,i=n.feature):n&&n.mesh?(e=Xt,i=n.mesh,o=qo[n.filter]):p("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?e(t,r,o):p("Invalid TopoJSON object: "+i),r&&r.features||[r]}Uo.responseType="json";const Wo={dsv:Lo,csv:Ro(","),tsv:Ro("\t"),json:Io,topojson:Uo};function Ho(t,n){return arguments.length>1?(Wo[t]=n,this):ft(Wo,t)?Wo[t]:null}function Go(t){const n=Ho(t);return n&&n.responseType||"text"}function Yo(t,n,e,r){const i=Ho((n=n||{}).type||"json");return i||p("Unknown data format type: "+n.type),t=i(t,n),n.parse&&function(t,n,e,r){if(!t.length)return;const i=$o();e=e||i.timeParse,r=r||i.utcParse;let o,a,u,s,c,l,f=t.columns||Object.keys(t[0]);"auto"===n&&(n=jo(t,f)),f=Object.keys(n);const d=f.map((t=>{const i=n[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:")))return o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?r:e)(a);if(!zo[i])throw Error("Illegal format pattern: "+t+":"+i);return zo[i]}));for(u=0,c=t.length,l=f.length;u<c;++u)for(o=t[u],s=0;s<l;++s)a=f[s],o[a]=d[s](o[a])}(t,n.parse,e,r),ft(t,"columns")&&delete t.columns,t}const Vo=t=>({options:t||{},sanitize:No,load:Eo,fileAccess:!1,file:Co,http:Oo});function Xo(t){const n=t||b,e=[],r={};return e.add=t=>{const i=n(t);return r[i]||(r[i]=1,e.push(t)),e},e.remove=t=>{const i=n(t);if(r[i]){r[i]=0;const n=e.indexOf(t);n>=0&&e.splice(n,1)}return e},e}async function Jo(t,n){try{await n(t)}catch(n){t.error(n)}}const Ko=Symbol("vega_id");let Qo=1;function Zo(t){return!(!t||!ta(t))}function ta(t){return t[Ko]}function na(t,n){return t[Ko]=n,t}function ea(t){const n=t===Object(t)?t:{data:t};return ta(n)?n:na(n,Qo++)}function ra(t){return ia(t,ea({}))}function ia(t,n){for(const e in t)n[e]=t[e];return n}function oa(t,n){return na(n,ta(t))}function aa(t,n){return t?n?(e,r)=>t(e,r)||ta(n(e))-ta(n(r)):(n,e)=>t(n,e)||ta(n)-ta(e):null}function ua(t){return t&&t.constructor===sa}function sa(){const t=[],n=[],e=[],r=[],i=[];let o=null,a=!1;return{constructor:sa,insert(n){const e=Q(n),r=e.length;for(let n=0;n<r;++n)t.push(e[n]);return this},remove(t){const e=tt(t)?r:n,i=Q(t),o=i.length;for(let t=0;t<o;++t)e.push(i[t]);return this},modify(t,n,r){const o={field:n,value:at(r)};return tt(t)?(o.filter=t,i.push(o)):(o.tuple=t,e.push(o)),this},encode(t,n){return tt(t)?i.push({filter:t,field:n}):e.push({tuple:t,field:n}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(u,s){const c={},l={};let f,d,h,m,p,g;for(f=0,d=s.length;f<d;++f)c[ta(s[f])]=1;for(f=0,d=n.length;f<d;++f)p=n[f],c[ta(p)]=-1;for(f=0,d=r.length;f<d;++f)m=r[f],s.forEach((t=>{m(t)&&(c[ta(t)]=-1)}));for(f=0,d=t.length;f<d;++f)p=t[f],g=ta(p),c[g]?c[g]=1:u.add.push(ea(t[f]));for(f=0,d=s.length;f<d;++f)p=s[f],c[ta(p)]<0&&u.rem.push(p);function v(t,n,e){e?t[n]=e(t):u.encode=n,a||(l[ta(t)]=t)}for(f=0,d=e.length;f<d;++f)h=e[f],p=h.tuple,m=h.field,g=c[ta(p)],g>0&&(v(p,m,h.value),u.modifies(m));for(f=0,d=i.length;f<d;++f)h=i[f],m=h.filter,s.forEach((t=>{m(t)&&c[ta(t)]>0&&v(t,h.field,h.value)})),u.modifies(h.field);if(a)u.mod=n.length||r.length?s.filter((t=>c[ta(t)]>0)):s.slice();else for(g in l)u.mod.push(l[g]);return(o||null==o&&(n.length||r.length))&&u.clean(!0),u}}}const ca="_:mod:_";function la(){Object.defineProperty(this,ca,{writable:!0,value:{}})}la.prototype={set(t,n,e,r){const i=this,o=i[t],a=i[ca];return null!=n&&n>=0?(o[n]!==e||r)&&(o[n]=e,a[n+":"+t]=-1,a[t]=-1):(o!==e||r)&&(i[t]=e,a[t]=S(e)?1+e.length:-1),i},modified(t,n){const e=this[ca];if(!arguments.length){for(const t in e)if(e[t])return!0;return!1}if(S(t)){for(let n=0;n<t.length;++n)if(e[t[n]])return!0;return!1}return null!=n&&n>=0?n+1<e[t]||!!e[n+":"+t]:!!e[t]},clear(){return this[ca]={},this}};let fa=0;const da=new la;function ha(t,n,e,r){this.id=++fa,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,n&&(this._update=n),e&&this.parameters(e,r)}function ma(t){return function(n){const e=this.flags;return 0===arguments.length?!!(e&t):(this.flags=n?e|t:e&~t,this)}}ha.prototype={targets(){return this._targets||(this._targets=Xo(y))},set(t){return this.value!==t?(this.value=t,1):0},skip:ma(1),modified:ma(2),parameters(t,n,e){n=!1!==n;const r=this._argval=this._argval||new la,i=this._argops=this._argops||[],o=[];let a,u,s,c;const l=(t,e,a)=>{a instanceof ha?(a!==this&&(n&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:e})):r.set(t,e,a)};for(a in t)if(u=t[a],"pulse"===a)Q(u).forEach((t=>{t instanceof ha?t!==this&&(t.targets().add(this),o.push(t)):p("Pulse parameters must be operator instances.")})),this.source=u;else if(S(u))for(r.set(a,-1,Array(s=u.length)),c=0;c<s;++c)l(a,c,u[c]);else l(a,-1,u);return this.marshall().clear(),e&&(i.initonly=!0),o},marshall(t){const n=this._argval||da,e=this._argops;let r,i,o,a;if(e){const u=e.length;for(i=0;i<u;++i)r=e[i],o=r.op,a=o.modified()&&o.stamp===t,n.set(r.name,r.index,o.value,a);if(e.initonly){for(i=0;i<u;++i)r=e[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return n},detach(){const t=this._argops;let n,e,r,i;if(t)for(n=0,e=t.length;n<e;++n)r=t[n],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const n=this._update;if(n){const e=this.marshall(t.stamp),r=n.call(this,e,t);if(e.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?(this.skip(!1),n=0):n=this.evaluate(t),this.pulse=n||t}};let pa=0;function ga(t,n,e){this.id=++pa,this.value=null,e&&(this.receive=e),t&&(this._filter=t),n&&(this._apply=n)}function va(t,n,e){return new ga(t,n,e)}ga.prototype={_filter:$,_apply:b,targets(){return this._targets||(this._targets=Xo(y))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const n=this.value=this._apply(t),e=this._targets,r=e?e.length:0;for(let t=0;t<r;++t)e[t].receive(n);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const n=va(t);return this.targets().add(n),n},apply(t){const n=va(null,t);return this.targets().add(n),n},merge(){const t=va();this.targets().add(t);for(let n=0,e=arguments.length;n<e;++n)arguments[n].targets().add(t);return t},throttle(t){let n=-1;return this.filter((()=>{const e=Date.now();return e-n>t?(n=e,1):0}))},debounce(t){const n=va();return this.targets().add(va(null,null,ut(t,(t=>{const e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},between(t,n){let e=!1;return t.targets().add(va(null,null,(()=>e=!0))),n.targets().add(va(null,null,(()=>e=!1))),this.filter((()=>e))},detach(){this._filter=$,this._targets=null}};const ya={skip:!0};function ba(t,n,e,r,i,o){const a=st({},o,ya);let u,s;tt(e)||(e=at(e)),void 0===r?u=n=>t.touch(e(n)):tt(r)?(s=new ha(null,r,i,!1),u=n=>{s.evaluate(n);const r=e(n),i=s.value;ua(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=n=>t.update(e(n),r,a),n.apply(u)}function wa(t,n,e,r,i,o){if(void 0===r)n.targets().add(e);else{const a=o||{},u=new ha(null,function(t,n){return n=tt(n)?n:at(n),t?function(e,r){const i=n(e,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:n}(e,r),i,!1);u.modified(a.force),u.rank=n.rank,n.targets().add(u),e&&(u.skip(!0),u.value=e.value,u.targets().add(e),t.connect(e,[u]))}}const xa={};function $a(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}function ka(t,n){const e=[];return Pt(t,n,(t=>e.push(t))),e}function Ma(t,n){const e={};return t.visit(n,(t=>{e[ta(t)]=1})),t=>e[ta(t)]?null:t}function Aa(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function Da(t,n,e,r){const i=this;let o=0;this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e;for(const t of e)if(t.stamp===n){if(t.fields){const n=i.fields||(i.fields={});for(const e in t.fields)n[e]=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 Sa(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}$a.prototype={StopPropagation:xa,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 $a(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 $a(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,n){const e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source,t.cleans&&(e.cleans=t.cleans)),e},runAfter(t){this.dataflow.runAfter(t)},changed(t){const n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,Ma(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return S(t)?t.forEach((t=>n[t]=!0)):n[t]=!0,this},modified(t,n){const e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?S(t)?t.some((t=>e[t])):e[t]:!!e)},filter(t,n){const e=this;return 1&t&&(e.addF=Aa(e.addF,n)),2&t&&(e.remF=Aa(e.remF,n)),4&t&&(e.modF=Aa(e.modF,n)),16&t&&(e.srcF=Aa(e.srcF,n)),e},materialize(t){const n=this;return 1&(t=t||7)&&n.addF&&(n.add=ka(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=ka(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=ka(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(t,n){const e=this,r=n;if(16&t)return Pt(e.source,e.srcF,r),e;1&t&&Pt(e.add,e.addF,r),2&t&&Pt(e.rem,e.remF,r),4&t&&Pt(e.mod,e.modF,r);const i=e.source;if(8&t&&i){const t=e.add.length+e.mod.length;t===i.length||Pt(i,t?Ma(e,5):e.srcF,r)}return e}},pt(Da,$a,{fork(t){const n=new $a(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,(t=>n.add.push(t))),t&n.REM&&this.visit(n.REM,(t=>n.rem.push(t))),t&n.MOD&&this.visit(n.MOD,(t=>n.mod.push(t)))),n},changed(t){return this.changes&t},modified(t){const n=this,e=n.fields;return e&&n.changes&n.MOD?S(t)?t.some((t=>e[t])):e[t]:0},filter(){p("MultiPulse does not support filtering.")},materialize(){p("MultiPulse does not support materialization.")},visit(t,n){const e=this,r=e.pulses,i=r.length;let o=0;if(t&e.SOURCE)for(;o<i;++o)r[o].visit(t,n);else for(;o<i;++o)r[o].stamp===e.stamp&&r[o].visit(t,n);return e}});const Fa={skip:!1,force:!1};function Ea(t,n,e,r){let i,o;const a=t[e];for(;e>n&&(o=e-1>>1,i=t[o],r(a,i)<0);)t[e]=i,e=o;return t[e]=a}function Na(){this.logger(D()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Ao();try{this._loader=Vo()}catch(t){}this._touched=Xo(y),this._input={},this._pulse=null,this._heap=function(t){let n=[];return{clear:()=>n=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),Ea(n,0,n.length-1,t)),pop:()=>{const e=n.pop();let r;return n.length?(r=n[0],n[0]=e,function(t,n,e){const r=n,i=t.length,o=t[n];let a,u=1+(n<<1);for(;u<i;)a=u+1,a<i&&e(t[u],t[a])>=0&&(u=a),t[n]=t[u],u=1+((n=u)<<1);t[n]=o,Ea(t,r,n,e)}(n,0,t)):r=e,r}}}(((t,n)=>t.qrank-n.qrank)),this._postrun=[]}function Ca(t){return function(){return this._log[t].apply(this,arguments)}}function Oa(t,n){ha.call(this,t,null,n)}Na.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:Ca("error"),warn:Ca("warn"),info:Ca("info"),debug:Ca("debug"),logLevel:Ca("level"),cleanThreshold:1e4,add:function(t,n,e,r){let i,o=1;return t instanceof ha?i=t:t&&t.prototype instanceof ha?i=new t:tt(t)?i=new ha(null,t):(o=0,i=new ha(t,n)),this.rank(i),o&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},connect:function(t,n){const e=t.rank,r=n.length;for(let i=0;i<r;++i)if(e<n[i].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const n=[t];let e,r,i;for(;n.length;)if(this.rank(e=n.pop()),r=e._targets)for(i=r.length;--i>=0;)n.push(e=r[i]),e===t&&p("Cycle detected in dataflow graph.")},pulse:function(t,n,e){this.touch(t,e||Fa);const r=new $a(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},touch:function(t,n){const e=n||Fa;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},update:function(t,n,e){const r=e||Fa;return(t.set(n)||r.force)&&this.touch(t,r),this},changeset:sa,ingest:function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},parse:function(t,n){const e=this.locale();return Yo(t,n,e.timeParse,e.utcParse)},preload:async function(t,n,e){const r=this,i=r._pending||function(t){let n;const e=new Promise((t=>n=t));return e.requests=0,e.done=()=>{0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(r);i.requests+=1;const o=await r.request(n,e);return r.pulse(t,r.changeset().remove($).insert(o.data||[])),i.done(),o},request:async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Go(n&&n.type)});try{r=e.parse(r,n)}catch(n){i=-2,e.warn("Data ingestion failed",t,n)}}catch(n){i=-1,e.warn("Loading failed",t,n)}return{data:r,status:i}},events:function(t,n,e,r){const i=this,o=va(e,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):Q(t);const s=u.length;for(let t=0;t<s;++t)u[t].addEventListener(n,a);return o},on:function(t,n,e,r,i){return(t instanceof ha?wa:ba)(this,t,n,e,r,i),this},evaluate:async function(t,n,e){const r=this,i=[];if(r._pulse)return Sa(r);if(r._pending&&await r._pending,n&&await Jo(r,n),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const o=++r._clock;r._pulse=new $a(r,o,t),r._touched.forEach((t=>r._enqueue(t,!0))),r._touched=Xo(y);let a,u,s,c=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=xa),u!==xa&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++c):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${c} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,n)=>n.priority-t.priority));r._postrun=[];for(let n=0;n<t.length;++n)await Jo(r,t[n].callback)}return e&&await Jo(r,e),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,n,e){return this._pulse?Sa(this):(this.evaluate(t,n,e),this)},runAsync:async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},runAfter:function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,n){const e=t.stamp<this._clock;e&&(t.stamp=this._clock),(e||n)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,n){const e=t.source,r=this._clock;return e&&S(e)?new Da(this,r,e.map((t=>t.pulse)),n):this._input[t.id]||function(t,n){return n&&n.stamp===t.stamp?n:(t=t.fork(),n&&n!==xa&&(t.source=n.source),t)}(this._pulse,e&&e.pulse)}},pt(Oa,ha,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?this.skip(!1):n=this.evaluate(t),n=n||t,n.then?n=n.then((t=>this.pulse=t)):n!==t.StopPropagation&&(this.pulse=n),n},evaluate(t){const n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},transform(){}});const _a={};function za(t){const n=Ba(t);return n&&n.Definition||null}function Ba(t){return t=t&&t.toLowerCase(),ft(_a,t)?_a[t]:null}function*Ta(t,n){if(null==n)for(let n of t)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)r=n(r,++e,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function Pa(t,n,e){const r=Float64Array.from(Ta(t,e));return r.sort(Kt),n.map((t=>Dn(r,t)))}function ja(t,n){return Pa(t,[.25,.5,.75],n)}function Ra(t,n){const e=t.length,r=function(t,n){const e=function(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}(t,n);return e?Math.sqrt(e):e}(t,n),i=ja(t,n);return 1.06*(Math.min(r,(i[2]-i[0])/1.34)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function La(t){const n=t.maxbins||20,e=t.base||10,r=Math.log(e),i=t.divide||[5,2];let o,a,u,s,c,l,f=t.extent[0],d=t.extent[1];const h=t.span||d-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(s=h/n,c=0,l=t.steps.length;c<l&&t.steps[c]<s;++c);o=t.steps[Math.max(0,c-1)]}else{for(a=Math.ceil(Math.log(n)/r),u=t.minstep||0,o=Math.max(u,Math.pow(e,Math.round(Math.log(h)/r)-a));Math.ceil(h/o)>n;)o*=e;for(c=0,l=i.length;c<l;++c)s=o/i[c],s>=u&&h/s<=n&&(o=s)}s=Math.log(o);const m=Math.pow(e,-(s>=0?0:1+~~(-s/r))-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(f/o+m)*o,f=f<s?s-o:s,d=Math.ceil(d/o)*o),{start:f,stop:d===f?f+o:d,step:o}}var Ia=Math.random;function qa(t,n,e,r){if(!t.length)return[void 0,void 0];const i=Float64Array.from(Ta(t,r)),o=i.length,a=n;let u,s,c,l;for(c=0,l=Array(a);c<a;++c){for(u=0,s=0;s<o;++s)u+=i[~~(Ia()*o)];l[c]=u/o}return l.sort(Kt),[An(l,e/2),An(l,1-e/2)]}function Ua(t,n,e,r){r=r||(t=>t);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,c=r(t[0]),l=c,f=c+n;for(;s<i;++s){if(a=r(t[s]),a>=f){for(l=(c+l)/2;u<s;++u)o[u]=l;f=a+n,c=a}l=a}for(l=(c+l)/2;u<s;++u)o[u]=l;return e?function(t,n){const e=t.length;let r,i,o=0,a=1;for(;t[o]===t[a];)++a;for(;a<e;){for(r=a+1;t[a]===t[r];)++r;if(t[a]-t[a-1]<n){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,n+n/4):o}const Wa=Math.sqrt(2*Math.PI),Ha=Math.SQRT2;let Ga=NaN;function Ya(t,n){t=t||0,n=null==n?1:n;let e,r,i=0,o=0;if(Ga==Ga)i=Ga,Ga=NaN;else{do{i=2*Ia()-1,o=2*Ia()-1,e=i*i+o*o}while(0===e||e>1);r=Math.sqrt(-2*Math.log(e)/e),i*=r,Ga=o*r}return t+i*n}function Va(t,n,e){const r=(t-(n||0))/(e=null==e?1:e);return Math.exp(-.5*r*r)/(e*Wa)}function Xa(t,n,e){const r=(t-(n=n||0))/(e=null==e?1:e),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let n;i<7.07106781186547?(n=.0352624965998911*i+.700383064443688,n=n*i+6.37396220353165,n=n*i+33.912866078383,n=n*i+112.079291497871,n=n*i+221.213596169931,n=n*i+220.206867912376,o=t*n,n=.0883883476483184*i+1.75566716318264,n=n*i+16.064177579207,n=n*i+86.7807322029461,n=n*i+296.564248779674,n=n*i+637.333633378831,n=n*i+793.826512519948,n=n*i+440.413735824752,o/=n):(n=i+.65,n=i+4/n,n=i+3/n,n=i+2/n,n=i+1/n,o=t/n/2.506628274631)}return r>0?1-o:o}function Ja(t,n,e){return t<0||t>1?NaN:(n||0)+(null==e?1:e)*Ha*function(t){let n,e=-Math.log((1-t)*(1+t));return e<6.25?(e-=3.125,n=-364441206401782e-35,n=n*e-16850591381820166e-35,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=n*e-1333171662854621e-31,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=n*e-4054566272975207e-29,n=n*e-8151934197605472e-29,n=26335093153082323e-28+n*e,n=n*e-12975133253453532e-27,n=n*e-5415412054294628e-26,n=1.0512122733215323e-9+n*e,n=n*e-4.112633980346984e-9,n=n*e-2.9070369957882005e-8,n=4.2347877827932404e-7+n*e,n=n*e-13654692000834679e-22,n=n*e-13882523362786469e-21,n=.00018673420803405714+n*e,n=n*e-.000740702534166267,n=n*e-.006033670871430149,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*e,n=n*e-2.7517406297064545e-7,n=1.8239629214389228e-8+n*e,n=15027403968909828e-22+n*e,n=n*e-4013867526981546e-21,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=n*e-47318229009055734e-21,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=n*e-.0003550375203628475,n=.0009532893797373805+n*e,n=n*e-.0016882755560235047,n=.002491442096107851+n*e,n=n*e-.003751208507569241,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=n*e-2.555641816996525e-10,n=1.5076572693500548e-9+n*e,n=n*e-3.789465440126737e-9,n=7.61570120807834e-9+n*e,n=n*e-1.496002662714924e-8,n=2.914795345090108e-8+n*e,n=n*e-6.771199775845234e-8,n=2.2900482228026655e-7+n*e,n=n*e-9.9298272942317e-7,n=4526062597223154e-21+n*e,n=n*e-1968177810553167e-20,n=7599527703001776e-20+n*e,n=n*e-.00021503011930044477,n=n*e-.00013871931833623122,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}(2*t-1)}function Ka(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Ya(e,r),pdf:t=>Va(t,e,r),cdf:t=>Xa(t,e,r),icdf:t=>Ja(t,e,r)};return i.mean(t).stdev(n)}function Qa(t,n){const e=Ka();let r=0;const i={data(e){return arguments.length?(t=e,r=e?e.length:0,i.bandwidth(n)):t},bandwidth(e){return arguments.length?(!(n=e)&&t&&(n=Ra(t)),i):n},sample:()=>t[~~(Ia()*r)]+n*e.sample(),pdf(i){let o=0,a=0;for(;a<r;++a)o+=e.pdf((i-t[a])/n);return o/n/r},cdf(i){let o=0,a=0;for(;a<r;++a)o+=e.cdf((i-t[a])/n);return o/r},icdf(){throw Error("KDE icdf not supported.")}};return i.data(t)}function Za(t,n){return t=t||0,n=null==n?1:n,Math.exp(t+Ya()*n)}function tu(t,n,e){if(t<=0)return 0;n=n||0,e=null==e?1:e;const r=(Math.log(t)-n)/e;return Math.exp(-.5*r*r)/(e*Wa*t)}function nu(t,n,e){return Xa(Math.log(t),n,e)}function eu(t,n,e){return Math.exp(Ja(t,n,e))}function ru(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Za(e,r),pdf:t=>tu(t,e,r),cdf:t=>nu(t,e,r),icdf:t=>eu(t,e,r)};return i.mean(t).stdev(n)}function iu(t,n){let e,r=0;const i={weights(t){return arguments.length?(e=function(t){const n=[];let e,i=0;for(e=0;e<r;++e)i+=n[e]=null==t[e]?1:+t[e];for(e=0;e<r;++e)n[e]/=i;return n}(n=t||[]),i):n},distributions(e){return arguments.length?(e?(r=e.length,t=e):(r=0,t=[]),i.weights(n)):t},sample(){const n=Ia();let i=t[r-1],o=e[0],a=0;for(;a<r-1;o+=e[++a])if(n<o){i=t[a];break}return i.sample()},pdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].pdf(n);return i},cdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].cdf(n);return i},icdf(){throw Error("Mixture icdf not supported.")}};return i.distributions(t).weights(n)}function ou(t,n){return null==n&&(n=null==t?1:t,t=0),t+(n-t)*Ia()}function au(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=n&&t<=e?1/(e-n):0}function uu(t,n,e){return null==e&&(e=null==n?1:n,n=0),t<n?0:t>e?1:(t-n)/(e-n)}function su(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function cu(t,n){let e,r;const i={min(t){return arguments.length?(e=t||0,i):e},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>ou(e,r),pdf:t=>au(t,e,r),cdf:t=>uu(t,e,r),icdf:t=>su(t,e,r)};return null==n&&(n=null==t?1:t,t=0),i.min(t).max(n)}function lu(t,n,e){let r=0,i=0;for(const o of t){const t=e(o);null==n(o)||null==t||isNaN(t)||(r+=(t-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function fu(t,n,e,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-o*t,o]}function du(t,n,e,r){t=t.filter((t=>{let r=n(t),i=e(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,e)=>n(t)-n(e)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,c,l=0,f=0,d=0;for(c of t)o[l]=u=+n(c),a[l]=s=+e(c),++l,f+=(u-f)/l,d+=(s-d)/l;for(l=0;l<i;++l)o[l]-=f,a[l]-=d;return[o,a,f,d]}function hu(t,n,e,r){let i,o,a=-1;for(const u of t)i=n(u),o=e(u),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function mu(t,n,e,r,i){let o=0,a=0;return hu(t,n,e,((t,n)=>{const e=n-i(t),u=n-r;o+=e*e,a+=u*u})),1-o/a}function pu(t,n,e){let r=0,i=0,o=0,a=0,u=0;hu(t,n,e,((t,n)=>{++u,r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=fu(r,i,o,a),c=t=>s[0]+s[1]*t;return{coef:s,predict:c,rSquared:mu(t,n,e,i,c)}}function gu(t,n,e){let r=0,i=0,o=0,a=0,u=0;hu(t,n,e,((t,n)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=fu(r,i,o,a),c=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:c,rSquared:mu(t,n,e,i,c)}}function vu(t,n,e){const[r,i,o,a]=du(t,n,e);let u,s,c,l=0,f=0,d=0,h=0,m=0;hu(t,n,e,((t,n)=>{u=r[m++],s=Math.log(n),c=u*n,l+=(n*s-l)/m,f+=(c-f)/m,d+=(c*s-d)/m,h+=(u*c-h)/m}));const[p,g]=fu(f/a,l/a,d/a,h/a),v=t=>Math.exp(p+g*(t-o));return{coef:[Math.exp(p-g*o),g],predict:v,rSquared:mu(t,n,e,a,v)}}function yu(t,n,e){let r=0,i=0,o=0,a=0,u=0,s=0;hu(t,n,e,((t,n)=>{const e=Math.log(t),c=Math.log(n);++s,r+=(e-r)/s,i+=(c-i)/s,o+=(e*c-o)/s,a+=(e*e-a)/s,u+=(n-u)/s}));const c=fu(r,i,o,a),l=t=>c[0]*Math.pow(t,c[1]);return c[0]=Math.exp(c[0]),{coef:c,predict:l,rSquared:mu(t,n,e,u,l)}}function bu(t,n,e){const[r,i,o,a]=du(t,n,e),u=r.length;let s,c,l,f,d=0,h=0,m=0,p=0,g=0;for(s=0;s<u;)c=r[s],l=i[s++],f=c*c,d+=(f-d)/s,h+=(f*c-h)/s,m+=(f*f-m)/s,p+=(c*l-p)/s,g+=(f*l-g)/s;const v=m-d*d,y=d*v-h*h,b=(g*d-p*h)/y,w=(p*v-g*h)/y,x=-b*d,$=t=>b*(t-=o)*t+w*t+x+a;return{coef:[x-w*o+b*o*o+a,w-2*b*o,b],predict:$,rSquared:mu(t,n,e,a,$)}}function wu(t,n,e,r){if(0===r)return lu(t,n,e);if(1===r)return pu(t,n,e);if(2===r)return bu(t,n,e);const[i,o,a,u]=du(t,n,e),s=i.length,c=[],l=[],f=r+1;let d,h,m,p,g;for(d=0;d<f;++d){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],d)*o[m];for(c.push(p),g=new Float64Array(f),h=0;h<f;++h){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],d+h);g[h]=p}l.push(g)}l.push(c);const v=function(t){const n=t.length-1,e=[];let r,i,o,a,u;for(r=0;r<n;++r){for(a=r,i=r+1;i<n;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<n+1;++o)u=t[o][r],t[o][r]=t[o][a],t[o][a]=u;for(i=r+1;i<n;++i)for(o=n;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=n-1;i>=0;--i){for(u=0,o=i+1;o<n;++o)u+=t[o][i]*e[o];e[i]=(t[n][i]-u)/t[i][i]}return e}(l),y=t=>{let n=u+v[0]+v[1]*(t-=a)+v[2]*t*t;for(d=3;d<f;++d)n+=v[d]*Math.pow(t,d);return n};return{coef:xu(f,v,-a,u),predict:y,rSquared:mu(t,n,e,u,y)}}function xu(t,n,e,r){const i=Array(t);let o,a,u,s;for(o=0;o<t;++o)i[o]=0;for(o=t-1;o>=0;--o)for(u=n[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(e,a)*s;return i[0]+=r,i}function $u(t,n,e,r){const[i,o,a,u]=du(t,n,e,!0),s=i.length,c=Math.max(2,~~(r*s)),l=new Float64Array(s),f=new Float64Array(s),d=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const n=[0,c-1];for(let t=0;t<s;++t){const e=i[t],r=n[0],a=n[1];let u=0,s=0,c=0,h=0,m=0;const p=1/Math.abs(i[e-i[r]>i[a]-e?r:a]-e||1);for(let t=r;t<=a;++t){const n=i[t],r=o[t],a=ku(Math.abs(e-n)*p)*d[t],l=n*a;u+=a,s+=l,c+=r*a,h+=r*l,m+=n*l}const[g,v]=fu(s/u,c/u,h/u,m/u);l[t]=g+v*e,f[t]=Math.abs(o[t]-l[t]),Mu(i,t+1,n)}if(2===t)break;const e=Sn(f);if(Math.abs(e)<1e-12)break;for(let t,n,r=0;r<s;++r)t=f[r]/(6*e),d[r]=t>=1?1e-12:(n=1-t*t)*n}return function(t,n,e,r){const i=t.length,o=[];let a,u=0,s=0,c=[];for(;u<i;++u)a=t[u]+e,c[0]===a?c[1]+=(n[u]-c[1])/++s:(s=0,c[1]+=r,c=[a,n[u]],o.push(c));return c[1]+=r,o}(i,l,a,u)}function ku(t){return(t=1-t*t*t)*t*t}function Mu(t,n,e){const r=t[n];let i=e[0],o=e[1]+1;if(!(o>=t.length))for(;n>i&&t[o]-r<=r-t[i];)e[0]=++i,e[1]=o,++o}const Au=.5*Math.PI/180;function Du(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=n=>[n,t(n)],o=n[0],a=n[1],u=a-o,s=u/r,c=[i(o)],l=[];if(e===r){for(let t=1;t<r;++t)c.push(i(o+t/e*u));return c.push(i(a)),c}l.push(i(a));for(let t=e;--t>0;)l.push(i(o+t/e*u));let f=c[0],d=l[l.length-1];const h=1/u,m=function(t,n){let e=t,r=t;const i=n.length;for(let t=0;t<i;++t){const i=n[t][1];i<e&&(e=i),i>r&&(r=i)}return 1/(r-e)}(f[1],l);for(;d;){const t=i((f[0]+d[0])/2);t[0]-f[0]>=s&&Su(f,t,d,h,m)>Au?l.push(t):(f=d,c.push(d),l.pop()),d=l[l.length-1]}return c}function Su(t,n,e,r,i){const o=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0])),a=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0]));return Math.abs(o-a)}function Fu(t){return t&&t.length?1===t.length?t[0]:(n=t,t=>{const e=n.length;let r=1,i=String(n[0](t));for(;r<e;++r)i+="|"+n[r](t);return i}):function(){return""};var n}function Eu(t,n,e){return e||t+(n?"_"+n:"")}const Nu=()=>{},Cu={init:Nu,add:Nu,rem:Nu,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,n)=>t.sum+=+n,rem:(t,n)=>t.sum-=n},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,n)=>t.product*=n,rem:(t,n)=>t.product/=n},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,n)=>(t.mean_d=n-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,n)=>(t.mean_d=n-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,n)=>t.dev+=t.mean_d*(n-t.mean),rem:(t,n)=>t.dev-=t.mean_d*(n-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,n)=>{(n<t.min||void 0===t.min)&&(t.min=n)},rem:(t,n)=>{n<=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,n)=>{(n>t.max||void 0===t.max)&&(t.max=n)},rem:(t,n)=>{n>=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,n,e)=>{n<t.min&&(t.argmin=e)},rem:(t,n)=>{n<=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,n,e)=>{n>t.max&&(t.argmax=e)},rem:(t,n)=>{n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,n)=>{t.exp=0,t.exp_r=n},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,n)=>t.exp=t.exp_r*t.exp+n,rem:(t,n)=>t.exp=(t.exp-n/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}},_u=Object.keys(Ou).filter((t=>"__count__"!==t));function zu(t,n,e){return Ou[t](e,n)}function Bu(t,n){return t.idx-n.idx}function Tu(){this.valid=0,this.missing=0,this._ops.forEach((t=>null==t.aggregate_param?t.init(this):t.init(this,t.aggregate_param)))}function Pu(t,n){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((e=>e.add(this,t,n)))):++this.missing}function ju(t,n){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((e=>e.rem(this,t,n)))):--this.missing}function Ru(t){return this._out.forEach((n=>t[n.out]=n.value(this))),t}function Lu(t,n){const e=n||b,r=function(t){const n={};t.forEach((t=>n[t.name]=t));const e=t=>{t.req&&t.req.forEach((t=>{n[t]||e(n[t]=Ou[t]())}))};return t.forEach(e),Object.values(n).sort(Bu)}(t),i=t.slice().sort(Bu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=Tu,o.prototype.add=Pu,o.prototype.rem=ju,o.prototype.set=Ru,o.prototype.get=e,o.fields=t.map((t=>t.out)),o}function Iu(t){this._key=t?v(t):ta,this.reset()}[..._u,"__count__"].forEach((t=>{Ou[t]=function(t,n){return(e,r)=>st({name:t,aggregate_param:r,out:e||t},Cu,n)}(t,Ou[t])}));const qu=Iu.prototype;function Uu(t){Oa.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}function Wu(t){Oa.call(this,null,t)}function Hu(t,n,e){const r=t;let i=n||[],o=e||[],a={},u=0;return{add:t=>o.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,n)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),n&&t&&i.sort(t),o.length&&(i=t?Dt(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Gu(t){Oa.call(this,[],t)}function Yu(t){ha.call(this,null,Vu,t)}function Vu(t){return this.value&&!t.modified()?this.value:nt(t.fields,t.orders)}function Xu(t){Oa.call(this,null,t)}function Ju(t){Oa.call(this,null,t)}qu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},qu.add=function(t){this._add.push(t)},qu.rem=function(t){this._rem.push(t)},qu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,n=this._rem,e=this._key,r=t.length,i=n.length,o=Array(r-i),a={};let u,s,c;for(u=0;u<i;++u)a[e(n[u])]=1;for(u=0,s=0;u<r;++u)a[e(c=t[u])]?a[e(c)]=0:o[s++]=c;return this._rem=[],this._add=o},qu.distinct=function(t){const n=this.values(),e={};let r,i=n.length,o=0;for(;--i>=0;)r=t(n[i])+"",ft(e,r)||(e[r]=1,++o);return o},qu.extent=function(t){if(this._get!==t||!this._ext){const n=this.values(),e=lt(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},qu.argmin=function(t){return this.extent(t)[0]||{}},qu.argmax=function(t){return this.extent(t)[1]||{}},qu.min=function(t){const n=this.extent(t)[0];return null!=n?t(n):void 0},qu.max=function(t){const n=this.extent(t)[1];return null!=n?t(n):void 0},qu.quartile=function(t){return this._get===t&&this._q||(this._q=ja(this.values(),t),this._get=t),this._q},qu.q1=function(t){return this.quartile(t)[0]},qu.q2=function(t){return this.quartile(t)[1]},qu.q3=function(t){return this.quartile(t)[2]},qu.ci=function(t){return this._get===t&&this._ci||(this._ci=qa(this.values(),1e3,.05,t),this._get=t),this._ci},qu.ci0=function(t){return this.ci(t)[0]},qu.ci1=function(t){return this.ci(t)[1]},Uu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:_u},{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"}]},pt(Uu,Oa,{transform(t,n){const e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):Object.create(null),n.visit(n.SOURCE,(t=>e.add(t)))):(e.value=e.value||e.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),r.modifies(e._outputs),e._drop=!1!==t.drop,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),n.clean()&&e._drop&&r.clean(!0).runAfter((()=>this.clean())),e.changes(r)},cross(){const t=this,n=t.value,e=t._dnames,r=e.map((()=>({}))),i=e.length;function o(t){let n,o,a,u;for(n in t)for(a=t[n].tuple,o=0;o<i;++o)r[o][u=a[e[o]]]=u}o(t._prev),o(n),function o(a,u,s){const c=e[s],l=r[s++];for(const e in l){const r=a?a+"|"+e:e;u[c]=l[e],s<i?o(r,u,s):n[r]||t.cell(r,u)}}("",{},0)},init(t){const n=this._inputs=[],e=this._outputs=[],r={};function i(t){const e=Q(f(t)),i=e.length;let o,a=0;for(;a<i;++a)r[o=e[a]]||(r[o]=1,n.push(o))}this._dims=Q(t.groupby),this._dnames=this._dims.map((t=>{const n=l(t);return i(t),e.push(n),n})),this.cellkey=t.key?t.key:Fu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=t.fields||[null],a=t.ops||["count"],u=t.aggregate_params||[null],s=t.as||[],c=o.length,d={};let h,m,g,v,y,b,w;for(c!==a.length&&p("Unmatched number of fields and aggregate ops."),w=0;w<c;++w)h=o[w],m=a[w],g=u[w]||null,null==h&&"count"!==m&&p("Null aggregate field specified."),y=l(h),b=Eu(m,y,s[w]),e.push(b),"count"!==m?(v=d[y],v||(i(h),v=d[y]=[],v.field=h,this._measures.push(v)),"count"!==m&&(this._countOnly=!1),v.push(zu(m,g,b))):this._counts.push(b);return this._measures=this._measures.map((t=>Lu(t,t.field))),Object.create(null)},cellkey:Fu(),cell(t,n){let e=this.value[t];return e?0===e.num&&this._drop&&e.stamp<this.stamp?(e.stamp=this.stamp,this._adds[this._alen++]=e):e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e):(e=this.value[t]=this.newcell(t,n),this._adds[this._alen++]=e),e},newcell(t,n){const e={key:t,num:0,agg:null,tuple:this.newtuple(n,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){const t=this._measures,n=t.length;e.agg=Array(n);for(let r=0;r<n;++r)e.agg[r]=new t[r](e)}return e.store&&(e.data=new Iu),e},newtuple(t,n){const e=this._dnames,r=this._dims,i=r.length,o={};for(let n=0;n<i;++n)o[e[n]]=r[n](t);return n?oa(n.tuple,o):ea(o)},clean(){const t=this.value;for(const n in t)0===t[n].num&&delete t[n]},add(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num+=1,this._countOnly)return;e.store&&e.data.add(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].add(r[n].get(t),t)},rem(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num-=1,this._countOnly)return;e.store&&e.data.rem(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].rem(r[n].get(t),t)},celltuple(t){const n=t.tuple,e=this._counts;t.store&&t.data.values();for(let r=0,i=e.length;r<i;++r)n[e[r]]=t.num;if(!this._countOnly){const e=t.agg;for(let t=0,r=e.length;t<r;++t)e[t].set(n)}return n},changes(t){const n=this._adds,e=this._mods,r=this._prev,i=this._drop,o=t.add,a=t.rem,u=t.mod;let s,c,l,f;if(r)for(c in r)s=r[c],i&&!s.num||a.push(s.tuple);for(l=0,f=this._alen;l<f;++l)o.push(this.celltuple(n[l])),n[l]=null;for(l=0,f=this._mlen;l<f;++l)s=e[l],(0===s.num&&i?a:u).push(this.celltuple(s)),e[l]=null;return this._alen=this._mlen=0,this._prev=null,t}}),Wu.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"]}]},pt(Wu,Oa,{transform(t,n){const e=!1!==t.interval,r=this._bins(t),i=r.start,o=r.step,a=t.as||["bin0","bin1"],u=a[0],s=a[1];let c;return c=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(f(t.field))?n.ADD_MOD:n.ADD,n.visit(c,e?t=>{const n=r(t);t[u]=n,t[s]=null==n?null:i+o*(1+(n-i)/o)}:t=>t[u]=r(t)),n.modifies(e?a:u)},_bins(t){if(this.value&&!t.modified())return this.value;const n=t.field,e=La(t),r=e.step;let i,o,a=e.start,u=a+Math.ceil((e.stop-a)/r)*r;null!=(i=t.anchor)&&(o=i-(a+r*Math.floor((i-a)/r)),a+=o,u+=o);const s=function(t){let e=z(n(t));return null==e?null:e<a?-1/0:e>u?1/0:(e=Math.max(a,Math.min(e,u-r)),a+r*Math.floor(1e-14+(e-a)/r))};return s.start=a,s.stop=e.stop,s.step=r,this.value=c(s,f(n),t.name||"bin_"+l(n))}}),Gu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},pt(Gu,Oa,{transform(t,n){const e=n.fork(n.ALL),r=Hu(ta,this.value,e.materialize(e.ADD).add),i=t.sort,o=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(o),this.value=e.source=r.data(aa(i),o),n.source&&n.source.root&&(this.value.root=n.source.root),e}}),pt(Yu,ha),Xu.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"]}]},pt(Xu,Oa,{transform(t,n){const e=n=>e=>{for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(u(e),t.case,o)||[],s=0,c=i.length;s<c;++s)a.test(r=i[s])||n(r)},r=this._parameterCheck(t,n),i=this._counts,o=this._match,a=this._stop,u=t.field,s=t.as||["text","count"],c=e((t=>i[t]=1+(i[t]||0))),l=e((t=>i[t]-=1));return r?n.visit(n.SOURCE,c):(n.visit(n.ADD,c),n.visit(n.REM,l)),this._finish(n,s)},_parameterCheck(t,n){let e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},_finish(t,n){const e=this._counts,r=this._tuples||(this._tuples={}),i=n[0],o=n[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,c;for(u in e)s=r[u],c=e[u]||0,!s&&c?(r[u]=s=ea({}),s[i]=u,s[o]=c,a.add.push(s)):0===c?(s&&a.rem.push(s),e[u]=null,r[u]=null):s[o]!==c&&(s[o]=c,a.mod.push(s));return a.modifies(n)}}),Ju.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},pt(Ju,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(e.rem=u),u=n.materialize(n.SOURCE).source,e.add=this.value=function(t,n,e,r){for(var i,o,a=[],u={},s=t.length,c=0;c<s;++c)for(u[n]=o=t[c],i=0;i<s;++i)u[e]=t[i],r(u)&&(a.push(ea(u)),(u={})[n]=o);return a}(u,i,o,t.filter||$)):e.mod=u,e.source=this.value,e.modifies(r)}});const Ku={kde:Qa,mixture:iu,normal:Ka,lognormal:ru,uniform:cu},Qu="function";function Zu(t,n){const e=t[Qu];ft(Ku,e)||p("Unknown distribution function: "+e);const r=Ku[e]();for(const e in t)"field"===e?r.data((t.from||n()).map(t[e])):"distributions"===e?r[e](t[e].map((t=>Zu(t,n)))):typeof r[e]===Qu&&r[e](t[e]);return r}function ts(t){Oa.call(this,null,t)}const ns=[{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}]}];function es(t,n){return t?t.map(((t,e)=>n[e]||l(t))):null}function rs(t,n,e){const r=[],i=t=>t(s);let o,a,u,s,c,l;if(null==n)r.push(t.map(e));else for(o={},a=0,u=t.length;a<u;++a)s=t[a],c=n.map(i),l=o[c],l||(o[c]=l=[],l.dims=c,r.push(l)),l.push(e(s));return r}function is(t){Oa.call(this,null,t)}function os(t){ha.call(this,null,as,t),this.modified(!0)}function as(t){const n=t.expr;return this.value&&!t.modified("expr")?this.value:c((e=>n(e,t)),f(n),l(n))}function us(t){Oa.call(this,[void 0,void 0],t)}function ss(t,n){ha.call(this,t),this.parent=n,this.count=0}function cs(t){Oa.call(this,{},t),this._keys=ht();const n=this._targets=[];n.active=0,n.forEach=t=>{for(let e=0,r=n.active;e<r;++e)t(n[e],e,n)}}function ls(t){ha.call(this,null,fs,t)}function fs(t){return this.value&&!t.modified()?this.value:S(t.name)?Q(t.name).map((t=>v(t))):v(t.name,t.as)}function ds(t){Oa.call(this,ht(),t)}function hs(t){Oa.call(this,[],t)}function ms(t){Oa.call(this,[],t)}function ps(t){Oa.call(this,null,t)}function gs(t){Oa.call(this,[],t)}ts.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:ns.concat({key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ns},{name:"weights",type:"number",array:!0}]})},{name:"as",type:"string",array:!0,default:["value","density"]}]},pt(ts,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=Zu(t.distribution,function(t){return()=>t.materialize(t.SOURCE).source}(n)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&p("Invalid density method: "+a),t.extent||r.data||p("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],s=Du(a,t.extent||ct(r.data()),i,o).map((t=>{const n={};return n[u[0]]=t[0],n[u[1]]=t[1],ea(n)}));this.value&&(e.rem=this.value),this.value=e.add=e.source=s}return e}}),is.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"}]},pt(is,Oa,{transform(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=rs(n.source,t.groupby,b),i=t.smooth||!1,o=t.field,a=t.step||((t,n)=>Et(ct(t,n))/30)(e,o),u=aa(((t,n)=>o(t)-o(n))),s=t.as||"bin",c=r.length;let l,f=1/0,d=-1/0,h=0;for(;h<c;++h){const t=r[h].sort(u);l=-1;for(const n of Ua(t,a,i,o))n<f&&(f=n),n>d&&(d=n),t[++l][s]=n}return this.value={start:f,stop:d,step:a},n.reflow(!0).modifies(s)}}),pt(os,ha),us.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},pt(us,Oa,{transform(t,n){const e=this.value,r=t.field,i=n.changed()||n.modified(r.fields)||t.modified("field");let o=e[0],a=e[1];if((i||null==o)&&(o=1/0,a=-1/0),n.visit(i?n.SOURCE:n.ADD,(t=>{const n=z(r(t));null!=n&&(n<o&&(o=n),n>a&&(a=n))})),!Number.isFinite(o)||!Number.isFinite(a)){let t=l(r);t&&(t=` for field "${t}"`),n.dataflow.warn(`Infinite extent${t}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),pt(ss,ha,{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}}),pt(cs,Oa,{activate(t){this._targets[this._targets.active++]=t},subflow(t,n,e,r){const i=this.value;let o,a,u=ft(i,t)&&i[t];return u?u.value.stamp<e.stamp&&(u.init(e),this.activate(u)):(a=r||(a=this._group[t])&&a.tuple,o=e.dataflow,u=new ss(e.fork(e.NO_SOURCE),this),o.add(u).connect(n(o,t,a)),i[t]=u,this.activate(u)),u},clean(){const t=this.value;let n=0;for(const e in t)if(0===t[e].count){const r=t[e].detachSubflow;r&&r(),delete t[e],++n}if(n){const t=this._targets.filter((t=>t&&t.count>0));this.initTargets(t)}},initTargets(t){const n=this._targets,e=n.length,r=t?t.length:0;let i=0;for(;i<r;++i)n[i]=t[i];for(;i<e&&null!=n[i];++i)n[i]=null;n.active=r},transform(t,n){const e=n.dataflow,r=t.key,i=t.subflow,o=this._keys,a=t.modified("key"),u=t=>this.subflow(t,i,n);return this._group=t.group||{},this.initTargets(),n.visit(n.REM,(t=>{const n=ta(t),e=o.get(n);void 0!==e&&(o.delete(n),u(e).rem(t))})),n.visit(n.ADD,(t=>{const n=r(t);o.set(ta(t),n),u(n).add(t)})),a||n.modified(r.fields)?n.visit(n.MOD,(t=>{const n=ta(t),e=o.get(n),i=r(t);e===i?u(i).mod(t):(o.set(n,i),u(e).rem(t),u(i).add(t))})):n.changed(n.MOD)&&n.visit(n.MOD,(t=>{u(o.get(ta(t))).mod(t)})),a&&n.visit(n.REFLOW,(t=>{const n=ta(t),e=o.get(n),i=r(t);e!==i&&(o.set(n,i),u(e).rem(t),u(i).add(t))})),n.clean()?e.runAfter((()=>{this.clean(),o.clean()})):o.empty>e.cleanThreshold&&e.runAfter(o.clean),n}}),pt(ls,ha),ds.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},pt(ds,Oa,{transform(t,n){const e=n.dataflow,r=this.value,i=n.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let c=!0;function l(n){const e=ta(n),i=s(n,t),l=r.get(e);i&&l?(r.delete(e),o.push(n)):i||l?c&&i&&!l&&u.push(n):(r.set(e,1),a.push(n))}return n.visit(n.REM,(t=>{const n=ta(t);r.has(n)?r.delete(n):a.push(t)})),n.visit(n.ADD,(n=>{s(n,t)?o.push(n):r.set(ta(n),1)})),n.visit(n.MOD,l),t.modified()&&(c=!1,n.visit(n.REFLOW,l)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i}}),hs.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}]},pt(hs,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=es(r,t.as||[]),o=t.index||null,a=i.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{const n=r.map((n=>n(t))),u=n.reduce(((t,n)=>Math.max(t,n.length)),0);let s,c,l,f=0;for(;f<u;++f){for(c=ra(t),s=0;s<a;++s)c[i[s]]=null==(l=n[s][f])?null:l;o&&(c[o]=f),e.add.push(c)}})),this.value=e.source=e.add,o&&e.modifies(o),e.modifies(i)}}),ms.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"]}]},pt(ms,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=r.map(l),o=t.as||["key","value"],a=o[0],u=o[1],s=r.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{for(let n,o=0;o<s;++o)n=ra(t),n[a]=i[o],n[u]=r[o](t),e.add.push(n)})),this.value=e.source=e.add,e.modifies(o)}}),ps.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},pt(ps,Oa,{transform(t,n){const e=t.expr,r=t.as,i=t.modified(),o=t.initonly?n.ADD:i?n.SOURCE:n.modified(e.fields)||n.modified(r)?n.ADD_MOD:n.ADD;return i&&(n=n.materialize().reflow(!0)),t.initonly||n.modifies(r),n.visit(o,(n=>n[r]=e(n,t)))}}),pt(gs,Oa,{transform(t,n){const e=n.fork(n.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=ea(r(t))),u.push(a);e.add=e.add.length?e.materialize(e.ADD).add.concat(i):i}else o=u.slice(0,-s),e.rem=e.rem.length?e.materialize(e.REM).rem.concat(o):o,u=u.slice(-s);return e.source=this.value=u,e}});const vs={value:"value",median:Sn,mean:function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(o=+o)>=o&&(++e,r+=o)}if(e)return r/e},min:$n,max:xn},ys=[];function bs(t){Oa.call(this,[],t)}function ws(t){Uu.call(this,t)}function xs(t){Oa.call(this,null,t)}function $s(t){ha.call(this,null,ks,t)}function ks(t){return this.value&&!t.modified()?this.value:kt(t.fields,t.flat)}function Ms(t){Oa.call(this,[],t),this._pending=null}function As(t,n,e){e.forEach(ea);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r.rem.length&&r.clean(!0),r}function Ds(t){Oa.call(this,{},t)}function Ss(t){ha.call(this,null,Fs,t)}function Fs(t){if(this.value&&!t.modified())return this.value;const n=t.extents,e=n.length;let r,i,o=1/0,a=-1/0;for(r=0;r<e;++r)i=n[r],i[0]<o&&(o=i[0]),i[1]>a&&(a=i[1]);return[o,a]}function Es(t){ha.call(this,null,Ns,t)}function Ns(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,n)=>t.concat(n)),[])}function Cs(t){Oa.call(this,null,t)}function Os(t){Uu.call(this,t)}function _s(t){cs.call(this,t)}function zs(t){Oa.call(this,null,t)}function Bs(t){Oa.call(this,null,t)}function Ts(t){Oa.call(this,null,t)}function Ps(t){Oa.call(this,null,t)}function js(t){Oa.call(this,[],t),this.count=0}function Rs(t){Oa.call(this,null,t)}function Ls(t){Oa.call(this,null,t),this.modified(!0)}function Is(t){Oa.call(this,null,t)}bs.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}]},pt(bs,Oa,{transform(t,n){var e,r,i,o,a,u,s,c,f,d,h=n.fork(n.ALL),m=function(t){var n,e=t.method||vs.value;if(null!=vs[e])return e===vs.value?(n=void 0!==t.value?t.value:0,()=>n):vs[e];p("Unrecognized imputation method: "+e)}(t),g=function(t){const n=t.field;return t=>t?n(t):NaN}(t),v=l(t.field),y=l(t.key),b=(t.groupby||[]).map(l),w=function(t,n,e,r){var i,o,a,u,s,c,l,f,d=t=>t(f),h=[],m=r?r.slice():[],p={},g={};for(m.forEach(((t,n)=>p[t]=n+1)),u=0,l=t.length;u<l;++u)c=e(f=t[u]),s=p[c]||(p[c]=m.push(c)),(a=g[o=(i=n?n.map(d):ys)+""])||(a=g[o]=[],h.push(a),a.values=i),a[s-1]=f;return h.domain=m,h}(n.source,t.groupby,t.key,t.keyvals),x=[],$=this.value,k=w.domain.length;for(a=0,c=w.length;a<c;++a)for(i=(e=w[a]).values,r=NaN,s=0;s<k;++s)if(null==e[s]){for(o=w.domain[s],d={_impute:!0},u=0,f=i.length;u<f;++u)d[b[u]]=i[u];d[y]=o,d[v]=Number.isNaN(r)?r=m(e,g):r,x.push(ea(d))}return x.length&&(h.add=h.materialize(h.ADD).add.concat(x)),$.length&&(h.rem=h.materialize(h.REM).rem.concat($)),this.value=x,h}}),ws.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:_u},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},pt(ws,Uu,{transform(t,n){const e=this,r=t.modified();let i;return e.value&&(r||n.modified(e._inputs,!0))?(i=e.value=r?e.init(t):{},n.visit(n.SOURCE,(t=>e.add(t)))):(i=e.value=e.value||this.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),e.changes(),n.visit(n.SOURCE,(t=>{st(t,i[e.cellkey(t)].tuple)})),n.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,n=this._mods;let e,r;for(e=0,r=this._alen;e<r;++e)this.celltuple(t[e]),t[e]=null;for(e=0,r=this._mlen;e<r;++e)this.celltuple(n[e]),n[e]=null;this._alen=this._mlen=0}}),xs.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"]}]},pt(xs,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=n.materialize(n.SOURCE).source,i=rs(r,t.groupby,t.field),o=(t.groupby||[]).map(l),a=t.bandwidth,u=t.cumulative?"cdf":"pdf",s=t.as||["value","density"],c=[];let f=t.extent,d=t.steps||t.minsteps||25,h=t.steps||t.maxsteps||200;"pdf"!==u&&"cdf"!==u&&p("Invalid density method: "+u),"shared"===t.resolve&&(f||(f=ct(r,t.field)),d=h=t.steps||h),i.forEach((n=>{const e=Qa(n,a)[u],r=t.counts?n.length:1;Du(e,f||ct(n),d,h).forEach((t=>{const e={};for(let t=0;t<o.length;++t)e[o[t]]=n.dims[t];e[s[0]]=t[0],e[s[1]]=t[1]*r,c.push(ea(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=c}return e}}),pt($s,ha),pt(Ms,Oa,{transform(t,n){const e=n.dataflow;if(this._pending)return As(this,n,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return n.StopPropagation;if(t.values)return As(this,n,e.parse(t.values,t.format));if(t.async){const n=e.request(t.url,t.format).then((t=>(this._pending=Q(t.data),t=>t.touch(this))));return{async:n}}return e.request(t.url,t.format).then((t=>As(this,n,Q(t.data))))}}),Ds.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}]},pt(Ds,Oa,{transform(t,n){const e=t.fields,r=t.index,i=t.values,o=null==t.default?null:t.default,a=t.modified(),u=e.length;let s,c,f,d=a?n.SOURCE:n.ADD,h=n,m=t.as;return i?(c=i.length,u>1&&!m&&p('Multi-field lookup requires explicit "as" parameter.'),m&&m.length!==u*c&&p('The "as" parameter has too few output field names.'),m=m||i.map(l),s=function(t){for(var n,a,s=0,l=0;s<u;++s)if(null==(a=r.get(e[s](t))))for(n=0;n<c;++n,++l)t[m[l]]=o;else for(n=0;n<c;++n,++l)t[m[l]]=i[n](a)}):(m||p("Missing output field names."),s=function(t){for(var n,i=0;i<u;++i)n=r.get(e[i](t)),t[m[i]]=null==n?o:n}),a?h=n.reflow(!0):(f=e.some((t=>n.modified(t.fields))),d|=f?n.MOD:0),n.visit(d,s),h.modifies(m)}}),pt(Ss,ha),pt(Es,ha),pt(Cs,Oa,{transform(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),Os.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:_u,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},pt(Os,Uu,{_transform:Uu.prototype.transform,transform(t,n){return this._transform(function(t,n){const e=t.field,r=t.value,i=("count"===t.op?"__count__":t.op)||"sum",o=f(e).concat(f(r)),a=function(t,n,e){const r={},i=[];return e.visit(e.SOURCE,(n=>{const e=t(n);r[e]||(r[e]=1,i.push(e))})),i.sort(et),n?i.slice(0,n):i}(e,t.limit||0,n);return n.changed()&&t.set("__pivot__",null,null,!0),{key:t.key,groupby:t.groupby,ops:a.map((()=>i)),fields:a.map((t=>function(t,n,e,r){return c((r=>n(r)===t?e(r):NaN),r,t+"")}(t,e,r,o))),as:a.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),pt(_s,cs,{transform(t,n){const e=t.subflow,r=t.field,i=t=>this.subflow(ta(t),e,n,t);return(t.modified("field")||r&&n.modified(f(r)))&&p("PreFacet does not support field modification."),this.initTargets(),r?(n.visit(n.MOD,(t=>{const n=i(t);r(t).forEach((t=>n.mod(t)))})),n.visit(n.ADD,(t=>{const n=i(t);r(t).forEach((t=>n.add(ea(t))))})),n.visit(n.REM,(t=>{const n=i(t);r(t).forEach((t=>n.rem(t)))}))):(n.visit(n.MOD,(t=>i(t).mod(t))),n.visit(n.ADD,(t=>i(t).add(t))),n.visit(n.REM,(t=>i(t).rem(t)))),n.clean()&&n.runAfter((()=>this.clean())),n}}),zs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},pt(zs,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=es(t.fields,t.as||[]),o=r?(t,n)=>function(t,n,e,r){for(let i=0,o=e.length;i<o;++i)n[r[i]]=e[i](t);return n}(t,n,r,i):ia;let a;return this.value?a=this.value:(n=n.addAll(),a=this.value={}),n.visit(n.REM,(t=>{const n=ta(t);e.rem.push(a[n]),a[n]=null})),n.visit(n.ADD,(t=>{const n=o(t,ea({}));a[ta(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{e.mod.push(o(t,a[ta(t)]))})),e}}),pt(Bs,Oa,{transform(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}}),Ts.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"]}]},pt(Ts,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return e.source=this.value,e;const i=rs(n.materialize(n.SOURCE).source,t.groupby,t.field),o=(t.groupby||[]).map(l),a=[],u=t.step||.01,s=t.probs||En(u/2,1-1e-14,u),c=s.length;return i.forEach((t=>{const n=Pa(t,s);for(let e=0;e<c;++e){const i={};for(let n=0;n<o.length;++n)i[o[n]]=t.dims[n];i[r[0]]=s[e],i[r[1]]=n[e],a.push(ea(i))}})),this.value&&(e.rem=this.value),this.value=e.add=e.source=a,e}}),pt(Ps,Oa,{transform(t,n){let e,r;return this.value?r=this.value:(e=n=n.addAll(),r=this.value={}),t.derive&&(e=n.fork(n.NO_SOURCE),n.visit(n.REM,(t=>{const n=ta(t);e.rem.push(r[n]),r[n]=null})),n.visit(n.ADD,(t=>{const n=ra(t);r[ta(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{const n=r[ta(t)];for(const r in t)n[r]=t[r],e.modifies(r);e.mod.push(n)}))),e}}),js.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},pt(js,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.modified("size"),i=t.size,o=this.value.reduce(((t,n)=>(t[ta(n)]=1,t)),{});let a=this.value,u=this.count,s=0;function c(t){let n,r;a.length<i?a.push(t):(r=~~((u+1)*Ia()),r<a.length&&r>=s&&(n=a[r],o[ta(n)]&&e.rem.push(n),a[r]=t)),++u}if(n.rem.length&&(n.visit(n.REM,(t=>{const n=ta(t);o[n]&&(o[n]=-1,e.rem.push(t)),--u})),a=a.filter((t=>-1!==o[ta(t)]))),(n.rem.length||r)&&a.length<i&&n.source&&(s=u=a.length,n.visit(n.SOURCE,(t=>{o[ta(t)]||c(t)})),s=-1),r&&a.length>i){const t=a.length-i;for(let n=0;n<t;++n)o[ta(a[n])]=-1,e.rem.push(a[n]);a=a.slice(t)}return n.mod.length&&n.visit(n.MOD,(t=>{o[ta(t)]&&e.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||s<0)&&(e.add=a.filter((t=>!o[ta(t)]))),this.count=u,this.value=e.source=a,e}}),Rs.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"}]},pt(Rs,Oa,{transform(t,n){if(this.value&&!t.modified())return;const e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=En(t.start,t.stop,t.step||1).map((t=>{const n={};return n[r]=t,ea(n)})),e.add=n.add.concat(this.value),e}}),pt(Ls,Oa,{transform(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});const qs=["unit0","unit1"];function Us(t){Oa.call(this,ht(),t)}function Ws(t){Oa.call(this,null,t)}Is.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Fe,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:qs}]},pt(Is,Oa,{transform(t,n){const e=t.field,r=!1!==t.interval,i="utc"===t.timezone,o=this._floor(t,n),a=(i?ir:rr)(o.unit).offset,u=t.as||qs,s=u[0],c=u[1],l=o.step;let d=o.start||1/0,h=o.stop||-1/0,m=n.ADD;return(t.modified()||n.changed(n.REM)||n.modified(f(e)))&&(m=(n=n.reflow(!0)).SOURCE,d=1/0,h=-1/0),n.visit(m,(t=>{const n=e(t);let i,u;null==n?(t[s]=null,r&&(t[c]=null)):(t[s]=i=u=o(n),r&&(t[c]=u=a(i,l)),i<d&&(d=i),u>h&&(h=u))})),o.start=d,o.stop=h,n.modifies(r?u:s)},_floor(t,n){const e="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:wr({extent:t.extent||ct(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),o=Ne(r),a=this.value||{},u=(e?tr:Ke)(o,i);return u.unit=_(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),pt(Us,Oa,{transform(t,n){const e=n.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,o)):n.changed()?(n.visit(n.REM,(t=>i.delete(r(t)))),n.visit(n.ADD,o)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()}}),pt(Ws,Oa,{transform(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(aa(t.sort)):n.source).map(t.field))}});const Hs={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){const t=Hs.rank(),n=t.next;return{init:t.init,next:t=>(n(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{const e=n.data,r=n.compare;let i=n.index;if(t<i){for(;i+1<e.length&&!r(e[i],e[i+1]);)++i;t=i}return(1+t)/e.length}}},ntile:function(t,n){(n=+n)>0||p("ntile num must be greater than zero.");const e=Hs.cume_dist(),r=e.next;return{init:e.init,next:t=>Math.ceil(n*r(t))}},lag:function(t,n){return n=+n||1,{next:e=>{const r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{const r=e.index+n,i=e.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:n=>t(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||p("nth_value nth must be greater than zero."),{next:e=>{const r=e.i0+(n-1);return r<e.i1?t(e.data[r]):null}}},prev_value:function(t){let n;return{init:()=>n=null,next:e=>{const r=t(e.data[e.index]);return null!=r?n=r:n}}},next_value:function(t){let n,e;return{init:()=>(n=null,e=-1),next:r=>{const i=r.data;return r.index<=e?n:(e=function(t,n,e){for(let r=n.length;e<r;++e)if(null!=t(n[e]))return e;return-1}(t,i,r.index))<0?(e=i.length,n=null):n=t(i[e])}}}},Gs=Object.keys(Hs);function Ys(t){const n=Q(t.ops),e=Q(t.fields),r=Q(t.params),i=Q(t.aggregate_params),o=Q(t.as),a=this.outputs=[],u=this.windows=[],s={},c={},d=[],h=[];let m=!0;function g(t){Q(f(t)).forEach((t=>s[t]=1))}g(t.sort),n.forEach(((t,n)=>{const s=e[n],f=r[n],v=i[n]||null,y=l(s),b=Eu(t,y,o[n]);if(g(s),a.push(b),ft(Hs,t))u.push(function(t,n,e,r){const i=Hs[t](n,e);return{init:i.init||w,update:function(t,n){n[r]=i.next(t)}}}(t,s,f,b));else{if(null==s&&"count"!==t&&p("Null aggregate field specified."),"count"===t)return void d.push(b);m=!1;let n=c[y];n||(n=c[y]=[],n.field=s,h.push(n)),n.push(zu(t,v,b))}})),(d.length||h.length)&&(this.cell=function(t,n,e){t=t.map((t=>Lu(t,t.field)));const r={num:0,agg:null,store:!1,count:n};if(!e)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 u=r.data=new Iu;return r.add=function(t){if(r.num+=1,!e){u&&u.add(t);for(let n=0;n<i;++n)o[n].add(o[n].get(t),t)}},r.rem=function(t){if(r.num-=1,!e){u&&u.rem(t);for(let n=0;n<i;++n)o[n].rem(o[n].get(t),t)}},r.set=function(t){let i,a;for(u&&u.values(),i=0,a=n.length;i<a;++i)t[n[i]]=r.num;if(!e)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,u&&u.reset();for(let t=0;t<i;++t)o[t].init()},r}(h,d,m)),this.inputs=Object.keys(s)}const Vs=Ys.prototype;function Xs(t){Oa.call(this,{},t),this._mlen=0,this._mods=[]}function Js(t,n,e,r){const i=r.sort,o=i&&!r.ignorePeers,a=r.frame||[null,0],u=t.data(e),s=u.length,c=o?Zt(i):null,l={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:i||at(-1)};n.init();for(let t=0;t<s;++t)Ks(l,a,t,s),o&&Qs(l,c),n.update(l,u[t])}function Ks(t,n,e,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==n[0]?0:Math.max(0,e-Math.abs(n[0])),t.i1=null==n[1]?r:Math.min(r,e+Math.abs(n[1])+1),t.index=e}function Qs(t,n){const e=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;e>0&&!i(o[e],o[e-1])&&(t.i0=n.left(o,o[e])),r<a&&!i(o[r],o[r+1])&&(t.i1=n.right(o,o[r]))}Vs.init=function(){this.windows.forEach((t=>t.init())),this.cell&&this.cell.init()},Vs.update=function(t,n){const e=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(e){for(a=t.p0;a<t.i0;++a)e.rem(i[a]);for(a=t.p1;a<t.i1;++a)e.add(i[a]);e.set(n)}for(a=0;a<o;++a)r[a].update(t,n)},Xs.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Gs.concat(_u)},{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}]},pt(Xs,Oa,{transform(t,n){this.stamp=n.stamp;const e=t.modified(),r=aa(t.sort),i=Fu(t.groupby),o=t=>this.group(i(t));let a=this.state;a&&!e||(a=this.state=new Ys(t)),e||n.modified(a.inputs)?(this.value={},n.visit(n.SOURCE,(t=>o(t).add(t)))):(n.visit(n.REM,(t=>o(t).remove(t))),n.visit(n.ADD,(t=>o(t).add(t))));for(let n=0,e=this._mlen;n<e;++n)Js(this._mods[n],a,r,t);return this._mlen=0,this._mods=[],n.reflow(e).modifies(a.outputs)},group(t){let n=this.value[t];return n||(n=this.value[t]=Hu(ta),n.stamp=-1),n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n),n}});var Zs=Object.freeze({__proto__:null,aggregate:Uu,bin:Wu,collect:Gu,compare:Yu,countpattern:Xu,cross:Ju,density:ts,dotbin:is,expression:os,extent:us,facet:cs,field:ls,filter:ds,flatten:hs,fold:ms,formula:ps,generate:gs,impute:bs,joinaggregate:ws,kde:xs,key:$s,load:Ms,lookup:Ds,multiextent:Ss,multivalues:Es,params:Cs,pivot:Os,prefacet:_s,project:zs,proxy:Bs,quantile:Ts,relay:Ps,sample:js,sequence:Rs,sieve:Ls,subflow:ss,timeunit:Is,tupleindex:Us,values:Ws,window:Xs});function tc(t){return function(){return t}}const nc=Math.abs,ec=Math.atan2,rc=Math.cos,ic=Math.max,oc=Math.min,ac=Math.sin,uc=Math.sqrt,sc=1e-12,cc=Math.PI,lc=cc/2,fc=2*cc;function dc(t){return t>=1?lc:t<=-1?-lc:Math.asin(t)}const hc=Math.PI,mc=2*hc,pc=1e-6,gc=mc-pc;function vc(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}let yc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?vc:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return vc;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,r){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+r}`}bezierCurveTo(t,n,e,r,i,o){this._append`C${+t},${+n},${+e},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,e,r,i){if(t=+t,n=+n,e=+e,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,u=e-t,s=r-n,c=o-t,l=a-n,f=c*c+l*l;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(f>pc)if(Math.abs(l*u-s*c)>pc&&i){let d=e-o,h=r-a,m=u*u+s*s,p=d*d+h*h,g=Math.sqrt(m),v=Math.sqrt(f),y=i*Math.tan((hc-Math.acos((m+f-p)/(2*g*v)))/2),b=y/v,w=y/g;Math.abs(b-1)>pc&&this._append`L${t+b*c},${n+b*l}`,this._append`A${i},${i},0,0,${+(l*d>c*h)},${this._x1=t+w*u},${this._y1=n+w*s}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,c=n+u,l=1^o,f=o?r-i:i-r;null===this._x1?this._append`M${s},${c}`:(Math.abs(this._x1-s)>pc||Math.abs(this._y1-c)>pc)&&this._append`L${s},${c}`,e&&(f<0&&(f=f%mc+mc),f>gc?this._append`A${e},${e},0,1,${l},${t-a},${n-u}A${e},${e},0,1,${l},${this._x1=s},${this._y1=c}`:f>pc&&this._append`A${e},${e},0,${+(f>=hc)},${l},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}};function bc(){return new yc}function wc(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new yc(n)}function xc(t){return t.innerRadius}function $c(t){return t.outerRadius}function kc(t){return t.startAngle}function Mc(t){return t.endAngle}function Ac(t){return t&&t.padAngle}function Dc(t,n,e,r,i,o,a){var u=t-e,s=n-r,c=(a?o:-o)/uc(u*u+s*s),l=c*s,f=-c*u,d=t+l,h=n+f,m=e+l,p=r+f,g=(d+m)/2,v=(h+p)/2,y=m-d,b=p-h,w=y*y+b*b,x=i-o,$=d*p-m*h,k=(b<0?-1:1)*uc(ic(0,x*x*w-$*$)),M=($*b-y*k)/w,A=(-$*y-b*k)/w,D=($*b+y*k)/w,S=(-$*y+b*k)/w,F=M-g,E=A-v,N=D-g,C=S-v;return F*F+E*E>N*N+C*C&&(M=D,A=S),{cx:M,cy:A,x01:-l,y01:-f,x11:M*(i/x-1),y11:A*(i/x-1)}}function Sc(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Fc(t){this._context=t}function Ec(t){return new Fc(t)}function Nc(t){return t[0]}function Cc(t){return t[1]}function Oc(t,n){var e=tc(!0),r=null,i=Ec,o=null,a=wc(u);function u(u){var s,c,l,f=(u=Sc(u)).length,d=!1;for(null==r&&(o=i(l=a())),s=0;s<=f;++s)!(s<f&&e(c=u[s],s,u))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+t(c,s,u),+n(c,s,u));if(l)return o=null,l+""||null}return t="function"==typeof t?t:void 0===t?Nc:tc(t),n="function"==typeof n?n:void 0===n?Cc:tc(n),u.x=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:tc(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),u):r},u}function _c(t,n,e){var r=null,i=tc(!0),o=null,a=Ec,u=null,s=wc(c);function c(c){var l,f,d,h,m,p=(c=Sc(c)).length,g=!1,v=new Array(p),y=new Array(p);for(null==o&&(u=a(m=s())),l=0;l<=p;++l){if(!(l<p&&i(h=c[l],l,c))===g)if(g=!g)f=l,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),d=l-1;d>=f;--d)u.point(v[d],y[d]);u.lineEnd(),u.areaEnd()}g&&(v[l]=+t(h,l,c),y[l]=+n(h,l,c),u.point(r?+r(h,l,c):v[l],e?+e(h,l,c):y[l]))}if(m)return u=null,m+""||null}function l(){return Oc().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Nc:tc(+t),n="function"==typeof n?n:tc(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?Cc:tc(+e),c.x=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),r=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:tc(+t),c):r},c.y=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),e=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),c):n},c.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:tc(+t),c):e},c.lineX0=c.lineY0=function(){return l().x(t).y(n)},c.lineY1=function(){return l().x(t).y(e)},c.lineX1=function(){return l().x(r).y(n)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:tc(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c}bc.prototype=yc.prototype,Fc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var zc={draw(t,n){const e=uc(n/cc);t.moveTo(e,0),t.arc(0,0,e,0,fc)}};function Bc(){}function Tc(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Pc(t){this._context=t}function jc(t){this._context=t}function Rc(t){this._context=t}function Lc(t,n){this._basis=new Pc(t),this._beta=n}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(){switch(this._point){case 3:Tc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Tc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},jc.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Tc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Rc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Tc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Lc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,s=-1;++s<=e;)this._basis.point(this._beta*t[s]+(1-this._beta)*(i+(r=s/e)*a),this._beta*n[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Ic=function t(n){function e(t){return 1===n?new Pc(t):new Lc(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function qc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Uc(t,n){this._context=t,this._k=(1-n)/6}Uc.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:qc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:qc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Wc=function t(n){function e(t){return new Uc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Hc(t,n){this._context=t,this._k=(1-n)/6}Hc.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:qc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Gc=function t(n){function e(t){return new Hc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Yc(t,n){this._context=t,this._k=(1-n)/6}Yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:qc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Vc=function t(n){function e(t){return new Yc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Xc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>sc){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>sc){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/l,a=(a*c+t._y1*t._l23_2a-e*t._l12_2a)/l}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Jc(t,n){this._context=t,this._alpha=n}Jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Xc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Kc=function t(n){function e(t){return n?new Jc(t,n):new Uc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Qc(t,n){this._context=t,this._alpha=n}Qc.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Xc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Zc=function t(n){function e(t){return n?new Qc(t,n):new Hc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function tl(t,n){this._context=t,this._alpha=n}tl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Xc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var nl=function t(n){function e(t){return n?new tl(t,n):new Yc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function el(t){this._context=t}function rl(t){return t<0?-1:1}function il(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(rl(o)+rl(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function ol(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function al(t,n,e){var r=t._x0,i=t._x1,o=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,t._y0+a*n,i-a,o-a*e,i,o)}function ul(t){this._context=t}function sl(t){this._context=new cl(t)}function cl(t){this._context=t}function ll(t){this._context=t}function fl(t){var n,e,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],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)o[n]-=e=i[n]/o[n-1],a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function dl(t,n){this._context=t,this._t=n}function hl(t,n){if("undefined"!=typeof document&&document.createElement){const e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}el.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},ul.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:al(this,this._t0,ol(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,al(this,ol(this,e=il(this,t,n)),e);break;default:al(this,this._t0,e=il(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(sl.prototype=Object.create(ul.prototype)).point=function(t,n){ul.prototype.point.call(this,n,t)},cl.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},ll.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=fl(t),i=fl(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},dl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};const ml=()=>"undefined"!=typeof Image?Image:null;function pl(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function gl(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const vl=Symbol("implicit");function yl(){var t=new un,n=[],e=[],r=vl;function i(i){let o=t.get(i);if(void 0===o){if(r!==vl)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new un;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return yl(n,e).unknown(r)},pl.apply(i,arguments),i}function bl(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function wl(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function xl(){}var $l=.7,kl=1/$l,Ml="\\s*([+-]?\\d+)\\s*",Al="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sl=/^#([0-9a-f]{3,8})$/,Fl=new RegExp(`^rgb\\(${Ml},${Ml},${Ml}\\)$`),El=new RegExp(`^rgb\\(${Dl},${Dl},${Dl}\\)$`),Nl=new RegExp(`^rgba\\(${Ml},${Ml},${Ml},${Al}\\)$`),Cl=new RegExp(`^rgba\\(${Dl},${Dl},${Dl},${Al}\\)$`),Ol=new RegExp(`^hsl\\(${Al},${Dl},${Dl}\\)$`),_l=new RegExp(`^hsla\\(${Al},${Dl},${Dl},${Al}\\)$`),zl={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 Bl(){return this.rgb().formatHex()}function Tl(){return this.rgb().formatRgb()}function Pl(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Sl.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?jl(n):3===e?new ql(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Rl(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Rl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Fl.exec(t))?new ql(n[1],n[2],n[3],1):(n=El.exec(t))?new ql(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Nl.exec(t))?Rl(n[1],n[2],n[3],n[4]):(n=Cl.exec(t))?Rl(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Ol.exec(t))?Vl(n[1],n[2]/100,n[3]/100,1):(n=_l.exec(t))?Vl(n[1],n[2]/100,n[3]/100,n[4]):zl.hasOwnProperty(t)?jl(zl[t]):"transparent"===t?new ql(NaN,NaN,NaN,0):null}function jl(t){return new ql(t>>16&255,t>>8&255,255&t,1)}function Rl(t,n,e,r){return r<=0&&(t=n=e=NaN),new ql(t,n,e,r)}function Ll(t){return t instanceof xl||(t=Pl(t)),t?new ql((t=t.rgb()).r,t.g,t.b,t.opacity):new ql}function Il(t,n,e,r){return 1===arguments.length?Ll(t):new ql(t,n,e,null==r?1:r)}function ql(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ul(){return`#${Yl(this.r)}${Yl(this.g)}${Yl(this.b)}`}function Wl(){const t=Hl(this.opacity);return`${1===t?"rgb(":"rgba("}${Gl(this.r)}, ${Gl(this.g)}, ${Gl(this.b)}${1===t?")":`, ${t})`}`}function Hl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Gl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Yl(t){return((t=Gl(t))<16?"0":"")+t.toString(16)}function Vl(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Kl(t,n,e,r)}function Xl(t){if(t instanceof Kl)return new Kl(t.h,t.s,t.l,t.opacity);if(t instanceof xl||(t=Pl(t)),!t)return new Kl;if(t instanceof Kl)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new Kl(a,u,s,t.opacity)}function Jl(t,n,e,r){return 1===arguments.length?Xl(t):new Kl(t,n,e,null==r?1:r)}function Kl(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ql(t){return(t=(t||0)%360)<0?t+360:t}function Zl(t){return Math.max(0,Math.min(1,t||0))}function tf(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}bl(xl,Pl,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Bl,formatHex:Bl,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xl(this).formatHsl()},formatRgb:Tl,toString:Tl}),bl(ql,Il,wl(xl,{brighter(t){return t=null==t?kl:Math.pow(kl,t),new ql(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?$l:Math.pow($l,t),new ql(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ql(Gl(this.r),Gl(this.g),Gl(this.b),Hl(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:Ul,formatHex:Ul,formatHex8:function(){return`#${Yl(this.r)}${Yl(this.g)}${Yl(this.b)}${Yl(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Wl,toString:Wl})),bl(Kl,Jl,wl(xl,{brighter(t){return t=null==t?kl:Math.pow(kl,t),new Kl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?$l:Math.pow($l,t),new Kl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new ql(tf(t>=240?t-240:t+120,i,r),tf(t,i,r),tf(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Kl(Ql(this.h),Zl(this.s),Zl(this.l),Hl(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=Hl(this.opacity);return`${1===t?"hsl(":"hsla("}${Ql(this.h)}, ${100*Zl(this.s)}%, ${100*Zl(this.l)}%${1===t?")":`, ${t})`}`}}));const nf=Math.PI/180,ef=180/Math.PI,rf=.96422,of=.82521,af=4/29,uf=6/29,sf=3*uf*uf,cf=uf*uf*uf;function lf(t){if(t instanceof df)return new df(t.l,t.a,t.b,t.opacity);if(t instanceof yf)return bf(t);t instanceof ql||(t=Ll(t));var n,e,r=gf(t.r),i=gf(t.g),o=gf(t.b),a=hf((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=hf((.4360747*r+.3850649*i+.1430804*o)/rf),e=hf((.0139322*r+.0971045*i+.7141733*o)/of)),new df(116*a-16,500*(n-a),200*(a-e),t.opacity)}function ff(t,n,e,r){return 1===arguments.length?lf(t):new df(t,n,e,null==r?1:r)}function df(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function hf(t){return t>cf?Math.pow(t,1/3):t/sf+af}function mf(t){return t>uf?t*t*t:sf*(t-af)}function pf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function gf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vf(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof yf)return new yf(t.h,t.c,t.l,t.opacity);if(t instanceof df||(t=lf(t)),0===t.a&&0===t.b)return new yf(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*ef;return new yf(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new yf(t,n,e,null==r?1:r)}function yf(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function bf(t){if(isNaN(t.h))return new df(t.l,0,0,t.opacity);var n=t.h*nf;return new df(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}bl(df,ff,wl(xl,{brighter(t){return new df(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new df(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new ql(pf(3.1338561*(n=rf*mf(n))-1.6168667*(t=1*mf(t))-.4906146*(e=of*mf(e))),pf(-.9787684*n+1.9161415*t+.033454*e),pf(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),bl(yf,vf,wl(xl,{brighter(t){return new yf(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new yf(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return bf(this).rgb()}}));var wf=-.14861,xf=1.78277,$f=-.29227,kf=-.90649,Mf=1.97294,Af=Mf*kf,Df=Mf*xf,Sf=xf*$f-kf*wf;function Ff(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Ef)return new Ef(t.h,t.s,t.l,t.opacity);t instanceof ql||(t=Ll(t));var n=t.g/255,e=t.b/255,r=(Sf*e+Af*(t.r/255)-Df*n)/(Sf+Af-Df),i=e-r,o=(Mf*(n-r)-$f*i)/kf,a=Math.sqrt(o*o+i*i)/(Mf*r*(1-r)),u=a?Math.atan2(o,i)*ef-120:NaN;return new Ef(u<0?u+360:u,a,r,t.opacity)}(t):new Ef(t,n,e,null==r?1:r)}function Ef(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Nf(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Cf(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1];return Nf((e-r/n)*n,r>0?t[r-1]:2*i-o,i,o,r<n-1?t[r+2]:2*o-i)}}function Of(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n);return Nf((e-r/n)*n,t[(r+n-1)%n],t[r%n],t[(r+1)%n],t[(r+2)%n])}}bl(Ef,Ff,wl(xl,{brighter(t){return t=null==t?kl:Math.pow(kl,t),new Ef(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?$l:Math.pow($l,t),new Ef(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*nf,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new ql(255*(n+e*(wf*r+xf*i)),255*(n+e*($f*r+kf*i)),255*(n+e*(Mf*r)),this.opacity)}}));var _f=t=>()=>t;function zf(t,n){return function(e){return t+e*n}}function Bf(t,n){var e=n-t;return e?zf(t,e>180||e<-180?e-360*Math.round(e/360):e):_f(isNaN(t)?n:t)}function Tf(t,n){var e=n-t;return e?zf(t,e):_f(isNaN(t)?n:t)}var Pf=function t(n){var e=function(t){return 1==(t=+t)?Tf:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):_f(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=Il(t)).r,(n=Il(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Tf(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function jf(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=Il(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var Rf=jf(Cf),Lf=jf(Of);function If(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function qf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Uf(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=Jf(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Wf(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Hf(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Gf(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Jf(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Yf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Vf=new RegExp(Yf.source,"g");function Xf(t,n){var e,r,i,o=Yf.lastIndex=Vf.lastIndex=0,a=-1,u=[],s=[];for(t+="",n+="";(e=Yf.exec(t))&&(r=Vf.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Hf(e,r)})),o=Vf.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}function Jf(t,n){var e,r=typeof n;return null==n||"boolean"===r?_f(n):("number"===r?Hf:"string"===r?(e=Pl(n))?(n=e,Pf):Xf:n instanceof Pl?Pf:n instanceof Date?Wf:qf(n)?If:Array.isArray(n)?Uf:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Gf:Hf)(t,n)}function Kf(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Qf,Zf=180/Math.PI,td={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function nd(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r<n*e&&(t=-t,n=-n,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Zf,skewX:Math.atan(s)*Zf,scaleX:a,scaleY:u}}function ed(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:Hf(t,i)},{i:s-2,x:Hf(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Hf(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Hf(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Hf(t,e)},{i:u-2,x:Hf(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e<r;)u[(n=s[e]).i]=n.x(t);return u.join("")}}}var rd=ed((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?td:nd(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),id=ed((function(t){return null==t?td:(Qf||(Qf=document.createElementNS("http://www.w3.org/2000/svg","g")),Qf.setAttribute("transform",t),(t=Qf.transform.baseVal.consolidate())?nd((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):td)}),", ",")",")");function od(t){return((t=Math.exp(t))+1/t)/2}var ad=function t(n,e,r){function i(t,i){var o,a,u=t[0],s=t[1],c=t[2],l=i[2],f=i[0]-u,d=i[1]-s,h=f*f+d*d;if(h<1e-12)a=Math.log(l/c)/n,o=function(t){return[u+t*f,s+t*d,c*Math.exp(n*t*a)]};else{var m=Math.sqrt(h),p=(l*l-c*c+r*h)/(2*c*e*m),g=(l*l-c*c-r*h)/(2*l*e*m),v=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(g*g+1)-g);a=(y-v)/n,o=function(t){var r=t*a,i=od(v),o=c/(e*m)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+v)-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[u+o*f,s+o*d,c*i/od(n*r+v)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function ud(t){return function(n,e){var r=t((n=Jl(n)).h,(e=Jl(e)).h),i=Tf(n.s,e.s),o=Tf(n.l,e.l),a=Tf(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var sd=ud(Bf),cd=ud(Tf);function ld(t){return function(n,e){var r=t((n=vf(n)).h,(e=vf(e)).h),i=Tf(n.c,e.c),o=Tf(n.l,e.l),a=Tf(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var fd=ld(Bf),dd=ld(Tf);function hd(t){return function n(e){function r(n,r){var i=t((n=Ff(n)).h,(r=Ff(r)).h),o=Tf(n.s,r.s),a=Tf(n.l,r.l),u=Tf(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var md=hd(Bf),pd=hd(Tf);function gd(t,n){void 0===n&&(n=t,t=Jf);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var vd=Object.freeze({__proto__:null,interpolate:Jf,interpolateArray:function(t,n){return(qf(n)?If:Uf)(t,n)},interpolateBasis:Cf,interpolateBasisClosed:Of,interpolateCubehelix:md,interpolateCubehelixLong:pd,interpolateDate:Wf,interpolateDiscrete:function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},interpolateHcl:fd,interpolateHclLong:dd,interpolateHsl:sd,interpolateHslLong:cd,interpolateHue:function(t,n){var e=Bf(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},interpolateLab:function(t,n){var e=Tf((t=ff(t)).l,(n=ff(n)).l),r=Tf(t.a,n.a),i=Tf(t.b,n.b),o=Tf(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},interpolateNumber:Hf,interpolateNumberArray:If,interpolateObject:Gf,interpolateRgb:Pf,interpolateRgbBasis:Rf,interpolateRgbBasisClosed:Lf,interpolateRound:Kf,interpolateString:Xf,interpolateTransformCss:rd,interpolateTransformSvg:id,interpolateZoom:ad,piecewise:gd,quantize:function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e}});function yd(t){return+t}var bd=[0,1];function wd(t){return t}function xd(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function $d(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=xd(i,r),o=e(a,o)):(r=xd(r,i),o=e(o,a)),function(t){return o(r(t))}}function kd(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=xd(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=rn(t,n,1,r)-1;return o[e](i[e](n))}}function Md(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ad(){var t,n,e,r,i,o,a=bd,u=bd,s=Jf,c=wd;function l(){var t=Math.min(a.length,u.length);return c!==wd&&(c=function(t,n){var e;return t>n&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(a[0],a[t-1])),r=t>2?kd:$d,i=o=null,f}function f(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(c(n)))}return f.invert=function(e){return c(n((o||(o=r(u,a.map(t),Hf)))(e)))},f.domain=function(t){return arguments.length?(a=Array.from(t,yd),l()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),l()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),s=Kf,l()},f.clamp=function(t){return arguments.length?(c=!!t||wd,l()):c!==wd},f.interpolate=function(t){return arguments.length?(s=t,l()):s},f.unknown=function(t){return arguments.length?(e=t,f):e},function(e,r){return t=e,n=r,l()}}function Dd(){return Ad()(wd,wd)}function Sd(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Fd(t){return(t=Sd(Math.abs(t)))?t[1]:NaN}var Ed,Nd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Cd(t){if(!(n=Nd.exec(t)))throw new Error("invalid format: "+t);var n;return new Od({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Od(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 _d(t,n){var e=Sd(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Cd.prototype=Od.prototype,Od.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 zd={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return _d(100*t,n)},r:_d,s:function(t,n){var e=Sd(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Ed=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")+Sd(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Bd(t){return t}var Td,Pd,jd,Rd=Array.prototype.map,Ld=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Id(t,n,e,r){var i,o=wn(t,n,e);switch((r=Cd(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Fd(n)/3)))-Fd(Math.abs(t)))}(o,a))||(r.precision=i),jd(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Fd(n)-Fd(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Fd(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return Pd(r)}function qd(t){var n=t.domain;return t.ticks=function(t){var e=n();return yn(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return Id(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,s=o[a],c=o[u],l=10;for(c<s&&(i=s,s=c,c=i,i=a,a=u,u=i);l-- >0;){if((i=bn(s,c,e))===r)return o[a]=s,o[u]=c,n(o);if(i>0)s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Ud(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Wd(t){return Math.log(t)}function Hd(t){return Math.exp(t)}function Gd(t){return-Math.log(-t)}function Yd(t){return-Math.exp(-t)}function Vd(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Xd(t){return(n,e)=>-t(-n,e)}function Jd(t){const n=t(Wd,Hd),e=n.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),n=>Math.log(n)/t)}(o),i=function(t){return 10===t?Vd:t===Math.E?Math.exp:n=>Math.pow(t,n)}(o),e()[0]<0?(r=Xd(r),i=Xd(i),t(Gd,Yd)):t(Wd,Hd),n}return n.base=function(t){return arguments.length?(o=+t,a()):o},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=t=>{const n=e();let a=n[0],u=n[n.length-1];const s=u<a;s&&([a,u]=[u,a]);let c,l,f=r(a),d=r(u);const h=null==t?10:+t;let m=[];if(!(o%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),a>0){for(;f<=d;++f)for(c=1;c<o;++c)if(l=f<0?c/i(-f):c*i(f),!(l<a)){if(l>u)break;m.push(l)}}else for(;f<=d;++f)for(c=o-1;c>=1;--c)if(l=f>0?c/i(-f):c*i(f),!(l<a)){if(l>u)break;m.push(l)}2*m.length<h&&(m=yn(a,u,h))}else m=yn(f,d,Math.min(d-f,h)).map(i);return s?m.reverse():m},n.tickFormat=(t,e)=>{if(null==t&&(t=10),null==e&&(e=10===o?"s":","),"function"!=typeof e&&(o%1||null!=(e=Cd(e)).precision||(e.trim=!0),e=Pd(e)),t===1/0)return e;const a=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*o<o-.5&&(n*=o),n<=a?e(t):""}},n.nice=()=>e(Ud(e(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function Kd(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Qd(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function Zd(t){var n=1,e=t(Kd(n),Qd(n));return e.constant=function(e){return arguments.length?t(Kd(n=+e),Qd(n)):n},qd(e)}function th(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function nh(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function eh(t){return t<0?-t*t:t*t}function rh(t){var n=t(wd,wd),e=1;return n.exponent=function(n){return arguments.length?1==(e=+n)?t(wd,wd):.5===e?t(nh,eh):t(th(e),th(1/e)):e},qd(n)}function ih(){var t=rh(Ad());return t.copy=function(){return Md(t,ih()).exponent(t.exponent())},pl.apply(t,arguments),t}Td=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Bd:(n=Rd.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=t.decimal+"",u=void 0===t.numerals?Bd:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Rd.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=Cd(t)).fill,e=t.align,f=t.sign,d=t.symbol,h=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):zd[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===n&&"="===e)&&(h=!0,n="0",e="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?s:"",x=zd[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,d=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==f&&(M=!1),d=(M?"("===f?f:c:"-"===f||"("===f?"":f)+d,k=("s"===y?Ld[8+Ed/3]:"")+k+(M&&"("===f?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!h&&(t=r(t,1/0));var A=d.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&h&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=d+t+k+D;break;case"=":t=d+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+k+D.slice(A);break;default:t=D+d+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var e=f(((t=Cd(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Fd(n)/3))),i=Math.pow(10,-r),o=Ld[8+r/3];return function(t){return e(i*t)+o}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),Pd=Td.format,jd=Td.formatPrefix;const oh=new Date,ah=new Date;function uh(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>uh((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(oh.setTime(+n),ah.setTime(+r),t(oh),t(ah),Math.floor(e(oh,ah))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const sh=uh((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));sh.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?uh((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):sh:null);const ch=1e3,lh=6e4,fh=36e5,dh=864e5,hh=6048e5,mh=31536e6,ph=uh((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*ch)}),((t,n)=>(n-t)/ch),(t=>t.getUTCSeconds())),gh=uh((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ch)}),((t,n)=>{t.setTime(+t+n*lh)}),((t,n)=>(n-t)/lh),(t=>t.getMinutes())),vh=uh((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*lh)}),((t,n)=>(n-t)/lh),(t=>t.getUTCMinutes())),yh=uh((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ch-t.getMinutes()*lh)}),((t,n)=>{t.setTime(+t+n*fh)}),((t,n)=>(n-t)/fh),(t=>t.getHours())),bh=uh((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*fh)}),((t,n)=>(n-t)/fh),(t=>t.getUTCHours())),wh=uh((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*lh)/dh),(t=>t.getDate()-1)),xh=uh((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dh),(t=>t.getUTCDate()-1)),$h=uh((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dh),(t=>Math.floor(t/dh)));function kh(t){return uh((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*lh)/hh))}const Mh=kh(0);function Ah(t){return uh((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/hh))}kh(1),kh(2),kh(3),kh(4),kh(5),kh(6);const Dh=Ah(0);Ah(1),Ah(2),Ah(3),Ah(4),Ah(5),Ah(6);const Sh=uh((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),Fh=uh((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),Eh=uh((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Eh.every=t=>isFinite(t=Math.floor(t))&&t>0?uh((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const Nh=uh((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Ch(t,n,e,r,i,o){const a=[[ph,1,ch],[ph,5,5e3],[ph,15,15e3],[ph,30,3e4],[o,1,lh],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,fh],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,dh],[r,2,1728e5],[e,1,hh],[n,1,2592e6],[n,3,7776e6],[t,1,mh]];function u(n,e,r){const i=Math.abs(e-n)/r,o=Zt((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(wn(n/mh,e/mh,r));if(0===o)return sh.every(Math.max(wn(n,e,r),1));const[u,s]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return u.every(s)}return[function(t,n,e){const r=n<t;r&&([t,n]=[n,t]);const i=e&&"function"==typeof e.range?e:u(t,n,e),o=i?i.range(t,+n+1):[];return r?o.reverse():o},u]}Nh.every=t=>isFinite(t=Math.floor(t))&&t>0?uh((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const[Oh,_h]=Ch(Nh,Fh,Dh,$h,bh,vh),[zh,Bh]=Ch(Eh,Sh,Mh,wh,yh,gh);function Th(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ph(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function jh(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}var Rh,Lh,Ih,qh={"-":"",_:" ",0:"0"},Uh=/^\s*\d+/,Wh=/^%/,Hh=/[\\^$*+?|[\]().{}]/g;function Gh(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Yh(t){return t.replace(Hh,"\\$&")}function Vh(t){return new RegExp("^(?:"+t.map(Yh).join("|")+")","i")}function Xh(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Jh(t,n,e){var r=Uh.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Kh(t,n,e){var r=Uh.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Qh(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Zh(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function tm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function nm(t,n,e){var r=Uh.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function em(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function rm(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function im(t,n,e){var r=Uh.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function om(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function am(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function um(t,n,e){var r=Uh.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function sm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function cm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function lm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function fm(t,n,e){var r=Uh.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function dm(t,n,e){var r=Uh.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function hm(t,n,e){var r=Wh.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function mm(t,n,e){var r=Uh.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function pm(t,n,e){var r=Uh.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function gm(t,n){return Gh(t.getDate(),n,2)}function vm(t,n){return Gh(t.getHours(),n,2)}function ym(t,n){return Gh(t.getHours()%12||12,n,2)}function bm(t,n){return Gh(1+Dr.count(Cr(t),t),n,3)}function wm(t,n){return Gh(t.getMilliseconds(),n,3)}function xm(t,n){return wm(t,n)+"000"}function $m(t,n){return Gh(t.getMonth()+1,n,2)}function km(t,n){return Gh(t.getMinutes(),n,2)}function Mm(t,n){return Gh(t.getSeconds(),n,2)}function Am(t){var n=t.getDay();return 0===n?7:n}function Dm(t,n){return Gh(Fr.count(Cr(t)-1,t),n,2)}function Sm(t){var n=t.getDay();return n>=4||0===n?Nr(t):Nr.ceil(t)}function Fm(t,n){return t=Sm(t),Gh(Nr.count(Cr(t),t)+(4===Cr(t).getDay()),n,2)}function Em(t){return t.getDay()}function Nm(t,n){return Gh(Er.count(Cr(t)-1,t),n,2)}function Cm(t,n){return Gh(t.getFullYear()%100,n,2)}function Om(t,n){return Gh((t=Sm(t)).getFullYear()%100,n,2)}function _m(t,n){return Gh(t.getFullYear()%1e4,n,4)}function zm(t,n){var e=t.getDay();return Gh((t=e>=4||0===e?Nr(t):Nr.ceil(t)).getFullYear()%1e4,n,4)}function Bm(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Gh(n/60|0,"0",2)+Gh(n%60,"0",2)}function Tm(t,n){return Gh(t.getUTCDate(),n,2)}function Pm(t,n){return Gh(t.getUTCHours(),n,2)}function jm(t,n){return Gh(t.getUTCHours()%12||12,n,2)}function Rm(t,n){return Gh(1+Or.count(Pr(t),t),n,3)}function Lm(t,n){return Gh(t.getUTCMilliseconds(),n,3)}function Im(t,n){return Lm(t,n)+"000"}function qm(t,n){return Gh(t.getUTCMonth()+1,n,2)}function Um(t,n){return Gh(t.getUTCMinutes(),n,2)}function Wm(t,n){return Gh(t.getUTCSeconds(),n,2)}function Hm(t){var n=t.getUTCDay();return 0===n?7:n}function Gm(t,n){return Gh(zr.count(Pr(t)-1,t),n,2)}function Ym(t){var n=t.getUTCDay();return n>=4||0===n?Tr(t):Tr.ceil(t)}function Vm(t,n){return t=Ym(t),Gh(Tr.count(Pr(t),t)+(4===Pr(t).getUTCDay()),n,2)}function Xm(t){return t.getUTCDay()}function Jm(t,n){return Gh(Br.count(Pr(t)-1,t),n,2)}function Km(t,n){return Gh(t.getUTCFullYear()%100,n,2)}function Qm(t,n){return Gh((t=Ym(t)).getUTCFullYear()%100,n,2)}function Zm(t,n){return Gh(t.getUTCFullYear()%1e4,n,4)}function tp(t,n){var e=t.getUTCDay();return Gh((t=e>=4||0===e?Tr(t):Tr.ceil(t)).getUTCFullYear()%1e4,n,4)}function np(){return"+0000"}function ep(){return"%"}function rp(t){return+t}function ip(t){return Math.floor(+t/1e3)}function op(t){return new Date(t)}function ap(t){return t instanceof Date?+t:+new Date(+t)}function up(t,n,e,r,i,o,a,u,s,c){var l=Dd(),f=l.invert,d=l.domain,h=c(".%L"),m=c(":%S"),p=c("%I:%M"),g=c("%I %p"),v=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function x(t){return(s(t)<t?h:u(t)<t?m:a(t)<t?p:o(t)<t?g:r(t)<t?i(t)<t?v:y:e(t)<t?b:w)(t)}return l.invert=function(t){return new Date(f(t))},l.domain=function(t){return arguments.length?d(Array.from(t,ap)):d().map(op)},l.ticks=function(n){var e=d();return t(e[0],e[e.length-1],null==n?10:n)},l.tickFormat=function(t,n){return null==n?x:c(n)},l.nice=function(t){var e=d();return t&&"function"==typeof t.range||(t=n(e[0],e[e.length-1],null==t?10:t)),t?d(Ud(e,t)):l},l.copy=function(){return Md(l,up(t,n,e,r,i,o,a,u,s,c))},l}function sp(){var t,n,e,r,i,o=0,a=1,u=wd,s=!1;function c(n){return null==n||isNaN(n=+n)?i:u(0===e?.5:(n=(r(n)-t)*e,s?Math.max(0,Math.min(1,n)):n))}function l(t){return function(n){var e,r;return arguments.length?([e,r]=n,u=t(e,r),c):[u(0),u(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),n=r(a=+a),e=t===n?0:1/(n-t),c):[o,a]},c.clamp=function(t){return arguments.length?(s=!!t,c):s},c.interpolator=function(t){return arguments.length?(u=t,c):u},c.range=l(Jf),c.rangeRound=l(Kf),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),n=i(a),e=t===n?0:1/(n-t),c}}function cp(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function lp(){var t=qd(sp()(wd));return t.copy=function(){return cp(t,lp())},gl.apply(t,arguments)}function fp(){var t=rh(sp());return t.copy=function(){return cp(t,fp()).exponent(t.exponent())},gl.apply(t,arguments)}function dp(){var t,n,e,r,i,o,a,u=0,s=.5,c=1,l=1,f=wd,d=!1;function h(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(l*t<l*n?r:i),f(d?Math.max(0,Math.min(1,t)):t))}function m(t){return function(n){var e,r,i;return arguments.length?([e,r,i]=n,f=gd(t,[e,r,i]),h):[f(0),f(.5),f(1)]}}return h.domain=function(a){return arguments.length?([u,s,c]=a,t=o(u=+u),n=o(s=+s),e=o(c=+c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),l=n<t?-1:1,h):[u,s,c]},h.clamp=function(t){return arguments.length?(d=!!t,h):d},h.interpolator=function(t){return arguments.length?(f=t,h):f},h.range=m(Jf),h.rangeRound=m(Kf),h.unknown=function(t){return arguments.length?(a=t,h):a},function(a){return o=a,t=a(u),n=a(s),e=a(c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),l=n<t?-1:1,h}}function hp(){var t=rh(dp());return t.copy=function(){return cp(t,hp()).exponent(t.exponent())},gl.apply(t,arguments)}function mp(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}Rh=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Vh(i),l=Xh(i),f=Vh(o),d=Xh(o),h=Vh(a),m=Xh(a),p=Vh(u),g=Xh(u),v=Vh(s),y=Xh(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:gm,e:gm,f:xm,g:Om,G:zm,H:vm,I:ym,j:bm,L:wm,m:$m,M:km,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:rp,s:ip,S:Mm,u:Am,U:Dm,V:Fm,w:Em,W:Nm,x:null,X:null,y:Cm,Y:_m,Z:Bm,"%":ep},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Tm,e:Tm,f:Im,g:Qm,G:tp,H:Pm,I:jm,j:Rm,L:Lm,m:qm,M:Um,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:rp,s:ip,S:Wm,u:Hm,U:Gm,V:Vm,w:Xm,W:Jm,x:null,X:null,y:Km,Y:Zm,Z:np,"%":ep},x={a:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=m[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=d[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:am,e:am,f:dm,g:em,G:nm,H:sm,I:sm,j:um,L:fm,m:om,M:cm,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1},q:im,Q:mm,s:pm,S:lm,u:Kh,U:Qh,V:Zh,w:Jh,W:tm,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:em,Y:nm,Z:rm,"%":hm};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=qh[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=jh(1900,void 0,1);if(M(o,t,e+="",0)!=e.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(n&&!("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=Ph(jh(o.y,0,1))).getUTCDay(),r=i>4||0===i?Br.ceil(r):Br(r),r=Or.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Th(jh(o.y,0,1))).getDay(),r=i>4||0===i?Er.ceil(r):Er(r),r=Dr.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?Ph(jh(o.y,0,1)).getUTCDay():Th(jh(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,Ph(o)):Th(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in qh?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}({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"]}),Lh=Rh.format,Ih=Rh.utcFormat;var pp=mp("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),gp=mp("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),vp=mp("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),yp=mp("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),bp=mp("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),wp=mp("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),xp=mp("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),$p=mp("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),kp=mp("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Mp=mp("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Ap(t,n,e){const r=t-n+2*e;return t?r>0?r:1:0}const Dp="linear",Sp="log",Fp="pow",Ep="sqrt",Np="symlog",Cp="time",Op="utc",_p="sequential",zp="diverging",Bp="quantile",Tp="quantize",Pp="threshold",jp="ordinal",Rp="point",Lp="band",Ip="bin-ordinal",qp="continuous",Up="discrete",Wp="discretizing",Hp="interpolating",Gp="temporal";function Yp(){const t=yl().unknown(void 0),n=t.domain,e=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,c=.5;function l(){const t=n().length,l=o[1]<o[0],f=o[1-l],d=Ap(t,u,s);let h=o[l-0];r=(f-h)/(d||1),a&&(r=Math.floor(r)),h+=(f-h-r*(t-u))*c,i=r*(1-u),a&&(h=Math.round(h),i=Math.round(i));const m=En(t).map((t=>h+r*t));return e(l?m.reverse():m)}return delete t.unknown,t.domain=function(t){return arguments.length?(n(t),l()):n()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],l()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,l()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,l()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,l()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),l()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),l()):s},t.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),l()):c},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]<o[0],a=r?e().reverse():e(),u=a.length-1;let s,c,l,f=+t[0],d=+t[1];return f!=f||d!=d||(d<f&&(l=f,f=d,d=l),d<a[0]||f>o[1-r])?void 0:(s=Math.max(0,rn(a,f)-1),c=f===d?s:rn(a,d)-1,f-a[s]>i+1e-10&&++s,r&&(l=s,s=u-c,c=u-l),s>c?void 0:n().slice(s,c+1))},t.invert=function(n){const e=t.invertRange([n,n]);return e?e[0]:e},t.copy=function(){return Yp().domain(n()).range(o).round(a).paddingInner(u).paddingOuter(s).align(c)},l()}function Vp(t){const n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return Vp(n())},t}var Xp=Array.prototype.map;const Jp=Array.prototype.slice,Kp=new Map,Qp=Symbol("vega_scale");function Zp(t){return t[Qp]=!0,t}function tg(t){return t&&!0===t[Qp]}function ng(t,n,e){return arguments.length>1?(Kp.set(t,function(t,n,e){const r=function(){const e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){let e,r=n[0],i=n[1];return i<r&&(e=r,r=i,i=e),[t.invert(r),t.invert(i)]}}(e):e.invertExtent?function(t){return function(n){const e=t.range();let r,i,o,a,u=n[0],s=n[1],c=-1;for(s<u&&(i=u,u=s,s=i),o=0,a=e.length;o<a;++o)e[o]>=u&&e[o]<=s&&(c<0&&(c=o),r=o);if(!(c<0))return u=t.invertExtent(e[c]),s=t.invertExtent(e[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,Zp(e)};return r.metadata=Bt(Q(e)),r}(t,n,e)),this):eg(t)?Kp.get(t):void 0}function eg(t){return Kp.has(t)}function rg(t,n){const e=Kp.get(t);return e&&e.metadata[n]}function ig(t){return rg(t,qp)}function og(t){return rg(t,Up)}function ag(t){return rg(t,Wp)}function ug(t){return rg(t,Sp)}function sg(t){return rg(t,Hp)}function cg(t){return rg(t,Bp)}ng("identity",(function t(n){var e;function r(t){return null==t||isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,yd),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,yd):[0,1],qd(r)})),ng(Dp,(function t(){var n=Dd();return n.copy=function(){return Md(n,t())},pl.apply(n,arguments),qd(n)}),qp),ng(Sp,(function t(){const n=Jd(Ad()).domain([1,10]);return n.copy=()=>Md(n,t()).base(n.base()),pl.apply(n,arguments),n}),[qp,Sp]),ng(Fp,ih,qp),ng(Ep,(function(){return ih.apply(null,arguments).exponent(.5)}),qp),ng(Np,(function t(){var n=Zd(Ad());return n.copy=function(){return Md(n,t()).constant(n.constant())},pl.apply(n,arguments)}),qp),ng(Cp,(function(){return pl.apply(up(zh,Bh,Eh,Sh,Mh,wh,yh,gh,ph,Lh).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[qp,Gp]),ng(Op,(function(){return pl.apply(up(Oh,_h,Nh,Fh,Dh,xh,bh,vh,ph,Ih).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[qp,Gp]),ng(_p,lp,[qp,Hp]),ng(`${_p}-${Dp}`,lp,[qp,Hp]),ng(`${_p}-${Sp}`,(function t(){var n=Jd(sp()).domain([1,10]);return n.copy=function(){return cp(n,t()).base(n.base())},gl.apply(n,arguments)}),[qp,Hp,Sp]),ng(`${_p}-${Fp}`,fp,[qp,Hp]),ng(`${_p}-${Ep}`,(function(){return fp.apply(null,arguments).exponent(.5)}),[qp,Hp]),ng(`${_p}-${Np}`,(function t(){var n=Zd(sp());return n.copy=function(){return cp(n,t()).constant(n.constant())},gl.apply(n,arguments)}),[qp,Hp]),ng(`${zp}-${Dp}`,(function t(){var n=qd(dp()(wd));return n.copy=function(){return cp(n,t())},gl.apply(n,arguments)}),[qp,Hp]),ng(`${zp}-${Sp}`,(function t(){var n=Jd(dp()).domain([.1,1,10]);return n.copy=function(){return cp(n,t()).base(n.base())},gl.apply(n,arguments)}),[qp,Hp,Sp]),ng(`${zp}-${Fp}`,hp,[qp,Hp]),ng(`${zp}-${Ep}`,(function(){return hp.apply(null,arguments).exponent(.5)}),[qp,Hp]),ng(`${zp}-${Np}`,(function t(){var n=Zd(dp());return n.copy=function(){return cp(n,t()).constant(n.constant())},gl.apply(n,arguments)}),[qp,Hp]),ng(Bp,(function t(){var n,e=[],r=[],i=[];function o(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t<n;)i[t-1]=Dn(e,t/n);return a}function a(t){return null==t||isNaN(t=+t)?n:r[rn(i,t)]}return a.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?i[n-1]:e[0],n<i.length?i[n]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(Kt),o()},a.range=function(t){return arguments.length?(r=Array.from(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(n=t,a):n},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(e).range(r).unknown(n)},pl.apply(a,arguments)}),[Wp,Bp]),ng(Tp,(function t(){var n,e=0,r=1,i=1,o=[.5],a=[0,1];function u(t){return null!=t&&t<=t?a[rn(o,t,0,i)]:n}function s(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*e)/(i+1);return u}return u.domain=function(t){return arguments.length?([e,r]=t,e=+e,r=+r,s()):[e,r]},u.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,s()):a.slice()},u.invertExtent=function(t){var n=a.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,o[0]]:n>=i?[o[i-1],r]:[o[n-1],o[n]]},u.unknown=function(t){return arguments.length?(n=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([e,r]).range(a).unknown(n)},pl.apply(qd(u),arguments)}),Wp),ng(Pp,(function t(){var n,e=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[rn(e,t,0,i)]:n}return o.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),o):e.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return t().domain(e).range(r).unknown(n)},pl.apply(o,arguments)}),Wp),ng(Ip,(function t(){let n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(rn(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=function(t){return Xp.call(t,z)}(t),r):n.slice()},r.range=function(t){return arguments.length?(e=Jp.call(t),r):e.slice()},r.tickFormat=function(t,e){return Id(n[0],_(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[Up,Wp]),ng(jp,yl,Up),ng(Lp,Yp,Up),ng(Rp,(function(){return Vp(Yp().paddingInner(1))}),Up);const lg=["clamp","base","constant","exponent"];function fg(t,n){const e=n[0],r=_(n)-e;return function(n){return t(e+n*r)}}function dg(t,n,e){return gd(pg(n||"rgb",e),t)}function hg(t,n){const e=new Array(n),r=n+1;for(let i=0;i<n;)e[i]=t(++i/r);return e}function mg(t,n,e){const r=e-n;let i,o,a;return r&&Number.isFinite(r)?(i=(o=t.type).indexOf("-"),o=i<0?o:o.slice(i+1),a=ng(o)().domain([n,e]).range([0,1]),lg.forEach((n=>t[n]?a[n](t[n]()):0)),a):at(.5)}function pg(t,n){const e=vd[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=n&&e&&e.gamma?e.gamma(n):e}function gg(t){if(S(t))return t;const n=t.length/6|0,e=new Array(n);for(let r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}function vg(t,n){for(const e in t)bg(e,n(t[e]))}const yg={};function bg(t,n){return t=t&&t.toLowerCase(),arguments.length>1?(yg[t]=n,this):yg[t]}vg({accent:gp,category10:pp,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:vp,observable10:yp,paired:bp,pastel1:wp,pastel2:xp,set1:$p,set2:kp,set3:Mp,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},gg),vg({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=>dg(gg(t))));const wg="symbol",xg=t=>S(t)?t.map((t=>String(t))):String(t),$g=(t,n)=>t[1]-n[1],kg=(t,n)=>n[1]-t[1];function Mg(t,n,e){let r;return wt(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),null!=e&&(n=Math.min(n,Math.floor(Et(t.domain())/e||1)+1))),F(n)&&(r=n.step,n=n.interval),$t(n)&&(n=t.type===Cp?rr(n):t.type==Op?ir(n):p("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Ag(t,n,e){let r=t.range(),i=r[0],o=_(r),a=$g;if(i>o&&(r=o,o=i,i=r,a=kg),i=Math.floor(i),o=Math.ceil(o),n=n.map((n=>[n,t(n)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),e>0&&n.length>1){const t=[n[0],_(n)];for(;n.length>e&&n.length>=3;)n=n.filter(((t,n)=>!(n%2)));n.length<3&&(n=t)}return n}function Dg(t,n){return t.bins?Ag(t,t.bins,n):t.ticks?t.ticks(n):t.domain()}function Sg(t,n,e,r,i,o){const a=n.type;let u=xg;if(a===Cp||i===Cp)u=t.timeFormat(r);else if(a===Op||i===Op)u=t.utcFormat(r);else if(ug(a)){const i=t.formatFloat(r);if(o||n.bins)u=i;else{const t=Fg(n,e,!1);u=n=>t(n)?i(n):""}}else if(n.tickFormat){const i=n.domain();u=t.formatSpan(i[0],i[i.length-1],e,r)}else r&&(u=t.format(r));return u}function Fg(t,n,e){const r=Dg(t,n),i=t.base(),o=Math.log(i),a=Math.max(1,i*n/r.length),u=t=>{let n=t/Math.pow(i,Math.round(Math.log(t)/o));return n*i<i-.5&&(n*=i),n<=a};return e?r.filter(u):u}const Eg={[Bp]:"quantiles",[Tp]:"thresholds",[Pp]:"domain"},Ng={[Bp]:"quantiles",[Tp]:"domain"};function Cg(t,n){return t.bins?function(t){const n=t.slice(0,-1);return n.max=_(t),n}(t.bins):t.type===Sp?Fg(t,n,!0):Eg[t.type]?function(t){const n=[-1/0].concat(t);return n.max=1/0,n}(t[Eg[t.type]]()):Dg(t,n)}function Og(t,n,e,r,i,o,a){const u=Ng[n.type]&&o!==Cp&&o!==Op?function(t,n,e){const r=n[Ng[n.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,e)}(t,n,i):Sg(t,n,e,i,o,a);return r===wg&&(t=>Eg[t.type]||t.bins)(n)?_g(u):"discrete"===r?Bg(u):Tg(u)}const _g=t=>(n,e,r)=>{const i=zg(r[e+1],zg(r.max,1/0)),o=Pg(n,t),a=Pg(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},zg=(t,n)=>null!=t?t:n,Bg=t=>(n,e)=>e?t(n):null,Tg=t=>n=>t(n),Pg=(t,n)=>Number.isFinite(t)?n(t):null;function jg(t,n,e){e=e||{};const r=Math.max(3,e.maxlen||7),i=function(t,n,e,r){const i=r||n.type;return $t(e)&&function(t){return rg(t,Gp)}(i)&&(e=e.replace(/%a/g,"%A").replace(/%b/g,"%B")),e||i!==Cp?e||i!==Op?Og(t,n,5,null,e,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}(t,n,e.format,e.formatType);if(ag(n.type)){const t=Cg(n).slice(1).map(i),e=t.length;return`${e} boundar${1===e?"y":"ies"}: ${t.join(", ")}`}if(og(n.type)){const t=n.domain(),e=t.length;return`${e} value${1===e?"":"s"}: ${e>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=n.domain();return`values from ${i(t[0])} to ${i(_(t))}`}}let Rg=0;const Lg="p_";function Ig(t){return t&&t.gradient}function qg(t,n,e){const r=t.gradient;let i=t.id,o="radial"===r?Lg:"";return i||(i=t.id="gradient_"+Rg++,"radial"===r?(t.x1=Ug(t.x1,.5),t.y1=Ug(t.y1,.5),t.r1=Ug(t.r1,0),t.x2=Ug(t.x2,.5),t.y2=Ug(t.y2,.5),t.r2=Ug(t.r2,.5),o=Lg):(t.x1=Ug(t.x1,0),t.y1=Ug(t.y1,0),t.x2=Ug(t.x2,1),t.y2=Ug(t.y2,0))),n[i]=t,"url("+(e||"")+"#"+o+i+")"}function Ug(t,n){return null!=t?t:n}function Wg(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(t,n){return r.push({offset:t,color:n}),e}}}const Hg={basis:{curve:function(t){return new Pc(t)}},"basis-closed":{curve:function(t){return new jc(t)}},"basis-open":{curve:function(t){return new Rc(t)}},bundle:{curve:Ic,tension:"beta",value:.85},cardinal:{curve:Wc,tension:"tension",value:0},"cardinal-open":{curve:Vc,tension:"tension",value:0},"cardinal-closed":{curve:Gc,tension:"tension",value:0},"catmull-rom":{curve:Kc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Zc,tension:"alpha",value:.5},"catmull-rom-open":{curve:nl,tension:"alpha",value:.5},linear:{curve:Ec},"linear-closed":{curve:function(t){return new el(t)}},monotone:{horizontal:function(t){return new sl(t)},vertical:function(t){return new ul(t)}},natural:{curve:function(t){return new ll(t)}},step:{curve:function(t){return new dl(t,.5)}},"step-after":{curve:function(t){return new dl(t,1)}},"step-before":{curve:function(t){return new dl(t,0)}}};function Gg(t,n,e){var r=ft(Hg,t)&&Hg[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}const Yg={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Vg=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Xg=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Jg=/^((\s+,?\s*)|(,\s*))/,Kg=/^[01]/;function Qg(t){const n=[];return(t.match(Vg)||[]).forEach((t=>{let e=t[0];const r=e.toLowerCase(),i=Yg[r],o=function(t,n,e){const r=[];for(let i=0;n&&i<e.length;)for(let o=0;o<n;++o){const n="a"!==t||3!==o&&4!==o?Xg:Kg,a=e.slice(i).match(n);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");i+=a[0].length,r.push(+a[0]);const u=e.slice(i).match(Jg);null!==u&&(i+=u[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(n.push([e,...o.slice(0,i)]),a!==i){"m"===r&&(e="M"===e?"L":"l");for(let t=i;t<a;t+=i)n.push([e,...o.slice(t,t+i)])}})),n}const Zg=Math.PI/180,tv=Math.PI/2,nv=2*Math.PI,ev=Math.sqrt(3)/2;var rv={},iv={},ov=[].join;function av(t){const n=ov.call(t);if(iv[n])return iv[n];var e=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],c=t[7];const l=c*a,f=-s*u,d=s*a,h=c*u,m=Math.cos(i),p=Math.sin(i),g=Math.cos(o),v=Math.sin(o),y=.5*(o-i),b=Math.sin(.5*y),w=8/3*b*b/Math.sin(y),x=e+m-w*p,$=r+p+w*m,k=e+g,M=r+v,A=k+w*v,D=M-w*g;return iv[n]=[l*x+f*$,d*x+h*$,l*A+f*D,d*A+h*D,l*k+f*M,d*k+h*M]}const uv=["l",0,0,0,0,0,0,0];function sv(t,n,e){const r=uv[0]=t[0];if("a"===r||"A"===r)uv[1]=n*t[1],uv[2]=e*t[2],uv[3]=t[3],uv[4]=t[4],uv[5]=t[5],uv[6]=n*t[6],uv[7]=e*t[7];else if("h"===r||"H"===r)uv[1]=n*t[1];else if("v"===r||"V"===r)uv[1]=e*t[1];else for(var i=1,o=t.length;i<o;++i)uv[i]=(i%2==1?n:e)*t[i];return uv}function cv(t,n,e,r,i,o){var a,u,s,c,l,f=null,d=0,h=0,m=0,p=0,g=0,v=0;null==e&&(e=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=i),t.beginPath&&t.beginPath();for(var y=0,b=n.length;y<b;++y){switch(a=n[y],1===i&&1===o||(a=sv(a,i,o)),a[0]){case"l":t.lineTo((d+=a[1])+e,(h+=a[2])+r);break;case"L":t.lineTo((d=a[1])+e,(h=a[2])+r);break;case"h":t.lineTo((d+=a[1])+e,h+r);break;case"H":t.lineTo((d=a[1])+e,h+r);break;case"v":t.lineTo(d+e,(h+=a[1])+r);break;case"V":t.lineTo(d+e,(h=a[1])+r);break;case"m":g=d+=a[1],v=h+=a[2],t.moveTo(d+e,h+r);break;case"M":g=d=a[1],v=h=a[2],t.moveTo(d+e,h+r);break;case"c":t.bezierCurveTo(d+a[1]+e,h+a[2]+r,(m=d+a[3])+e,(p=h+a[4])+r,(u=d+a[5])+e,(s=h+a[6])+r),d=u,h=s;break;case"C":t.bezierCurveTo(a[1]+e,a[2]+r,(m=a[3])+e,(p=a[4])+r,(d=a[5])+e,(h=a[6])+r);break;case"s":t.bezierCurveTo((m=2*d-m)+e,(p=2*h-p)+r,d+a[1]+e,h+a[2]+r,(u=d+a[3])+e,(s=h+a[4])+r),m=d+a[1],p=h+a[2],d=u,h=s;break;case"S":t.bezierCurveTo((m=2*d-m)+e,(p=2*h-p)+r,a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),d=u,h=s,m=a[1],p=a[2];break;case"q":t.quadraticCurveTo((m=d+a[1])+e,(p=h+a[2])+r,(u=d+a[3])+e,(s=h+a[4])+r),d=u,h=s;break;case"Q":t.quadraticCurveTo(a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),d=u,h=s,m=a[1],p=a[2];break;case"t":u=d+a[1],s=h+a[2],null===f[0].match(/[QqTt]/)?(m=d,p=h):"t"===f[0]?(m=2*d-c,p=2*h-l):"q"===f[0]&&(m=2*d-m,p=2*h-p),c=m,l=p,t.quadraticCurveTo(m+e,p+r,u+e,s+r),m=(d=u)+a[1],p=(h=s)+a[2];break;case"T":t.quadraticCurveTo((m=2*d-m)+e,(p=2*h-p)+r,(u=a[1])+e,(s=a[2])+r),d=u,h=s;break;case"a":lv(t,d+e,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+d+e,a[7]+h+r]),d+=a[6],h+=a[7];break;case"A":lv(t,d+e,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+r]),d=a[6],h=a[7];break;case"z":case"Z":d=g,h=v,t.closePath()}f=a}}function lv(t,n,e,r){const i=function(t,n,e,r,i,o,a,u,s){const c=ov.call(arguments);if(rv[c])return rv[c];const l=a*Zg,f=Math.sin(l),d=Math.cos(l),h=d*(u-t)*.5+f*(s-n)*.5,m=d*(s-n)*.5-f*(u-t)*.5;let p=h*h/((e=Math.abs(e))*e)+m*m/((r=Math.abs(r))*r);p>1&&(p=Math.sqrt(p),e*=p,r*=p);const g=d/e,v=f/e,y=-f/r,b=d/r,w=g*u+v*s,x=y*u+b*s,$=g*t+v*n,k=y*t+b*n;let M=1/(($-w)*($-w)+(k-x)*(k-x))-.25;M<0&&(M=0);let A=Math.sqrt(M);o==i&&(A=-A);const D=.5*(w+$)-A*(k-x),S=.5*(x+k)+A*($-w),F=Math.atan2(x-S,w-D);let E=Math.atan2(k-S,$-D)-F;E<0&&1===o?E+=nv:E>0&&0===o&&(E-=nv);const N=Math.ceil(Math.abs(E/(tv+.001))),C=[];for(let t=0;t<N;++t)C[t]=[D,S,F+t*E/N,F+(t+1)*E/N,e,r,f,d];return rv[c]=C}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],n,e);for(let n=0;n<i.length;++n){const e=av(i[n]);t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])}}const fv=.5773502691896257,dv={circle:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(e,0),t.arc(0,0,e,0,nv)}},cross:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/2.5;t.moveTo(-e,-r),t.lineTo(-e,r),t.lineTo(-r,r),t.lineTo(-r,e),t.lineTo(r,e),t.lineTo(r,r),t.lineTo(e,r),t.lineTo(e,-r),t.lineTo(r,-r),t.lineTo(r,-e),t.lineTo(-r,-e),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.closePath()}},square:{draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},arrow:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/7,i=e/2.5,o=e/8;t.moveTo(-r,e),t.lineTo(r,e),t.lineTo(r,-o),t.lineTo(i,-o),t.lineTo(0,-e),t.lineTo(-i,-o),t.lineTo(-r,-o),t.closePath()}},wedge:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*fv,o=e/4;t.moveTo(0,-r-i),t.lineTo(-o,r-i),t.lineTo(o,r-i),t.closePath()}},triangle:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*fv;t.moveTo(0,-r-i),t.lineTo(-e,r-i),t.lineTo(e,r-i),t.closePath()}},"triangle-up":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,-r),t.lineTo(-e,r),t.lineTo(e,r),t.closePath()}},"triangle-down":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,r),t.lineTo(-e,-r),t.lineTo(e,-r),t.closePath()}},"triangle-right":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(r,0),t.lineTo(-r,-e),t.lineTo(-r,e),t.closePath()}},"triangle-left":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(-r,0),t.lineTo(r,-e),t.lineTo(r,e),t.closePath()}},stroke:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(e,0)}}};function hv(t){return ft(dv,t)?dv[t]:function(t){if(!ft(mv,t)){const n=Qg(t);mv[t]={draw:function(t,e){cv(t,n,0,0,Math.sqrt(e)/2)}}}return mv[t]}(t)}var mv={};const pv=.448084975506;function gv(t){return t.x}function vv(t){return t.y}function yv(t){return t.width}function bv(t){return t.height}function wv(t){return"function"==typeof t?t:()=>+t}function xv(t,n,e){return Math.max(n,Math.min(t,e))}function $v(){var t=gv,n=vv,e=yv,r=bv,i=wv(0),o=i,a=i,u=i,s=null;function c(c,l,f){var d,h=null!=l?l:+t.call(this,c),m=null!=f?f:+n.call(this,c),p=+e.call(this,c),g=+r.call(this,c),v=Math.min(p,g)/2,y=xv(+i.call(this,c),0,v),b=xv(+o.call(this,c),0,v),w=xv(+a.call(this,c),0,v),x=xv(+u.call(this,c),0,v);if(s||(s=d=bc()),y<=0&&b<=0&&w<=0&&x<=0)s.rect(h,m,p,g);else{var $=h+p,k=m+g;s.moveTo(h+y,m),s.lineTo($-b,m),s.bezierCurveTo($-pv*b,m,$,m+pv*b,$,m+b),s.lineTo($,k-x),s.bezierCurveTo($,k-pv*x,$-pv*x,k,$-x,k),s.lineTo(h+w,k),s.bezierCurveTo(h+pv*w,k,h,k-pv*w,h,k-w),s.lineTo(h,m+y),s.bezierCurveTo(h,m+pv*y,h+pv*y,m,h+y,m),s.closePath()}if(d)return s=null,d+""||null}return c.x=function(n){return arguments.length?(t=wv(n),c):t},c.y=function(t){return arguments.length?(n=wv(t),c):n},c.width=function(t){return arguments.length?(e=wv(t),c):e},c.height=function(t){return arguments.length?(r=wv(t),c):r},c.cornerRadius=function(t,n,e,r){return arguments.length?(i=wv(t),o=null!=n?wv(n):i,u=null!=e?wv(e):i,a=null!=r?wv(r):o,c):i},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function kv(){var t,n,e,r,i,o,a,u,s=null;function c(t,n,e){const r=e/2;if(i){var c=a-n,l=t-o;if(c||l){var f=Math.hypot(c,l),d=(c/=f)*u,h=(l/=f)*u,m=Math.atan2(l,c);s.moveTo(o-d,a-h),s.lineTo(t-c*r,n-l*r),s.arc(t,n,r,m-Math.PI,m),s.lineTo(o+d,a+h),s.arc(o,a,u,m,m+Math.PI)}else s.arc(t,n,r,0,nv);s.closePath()}else i=1;o=t,a=n,u=r}function l(o){var a,u,l,f=o.length,d=!1;for(null==s&&(s=l=bc()),a=0;a<=f;++a)!(a<f&&r(u=o[a],a,o))===d&&(d=!d)&&(i=0),d&&c(+t(u,a,o),+n(u,a,o),+e(u,a,o));if(l)return s=null,l+""||null}return l.x=function(n){return arguments.length?(t=n,l):t},l.y=function(t){return arguments.length?(n=t,l):n},l.size=function(t){return arguments.length?(e=t,l):e},l.defined=function(t){return arguments.length?(r=t,l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Mv(t,n){return null!=t?t:n}const Av=t=>t.x||0,Dv=t=>t.y||0,Sv=t=>!(!1===t.defined),Fv=function(){var t=xc,n=$c,e=tc(0),r=null,i=kc,o=Mc,a=Ac,u=null,s=wc(c);function c(){var c,l,f=+t.apply(this,arguments),d=+n.apply(this,arguments),h=i.apply(this,arguments)-lc,m=o.apply(this,arguments)-lc,p=nc(m-h),g=m>h;if(u||(u=c=s()),d<f&&(l=d,d=f,f=l),d>sc)if(p>fc-sc)u.moveTo(d*rc(h),d*ac(h)),u.arc(0,0,d,h,m,!g),f>sc&&(u.moveTo(f*rc(m),f*ac(m)),u.arc(0,0,f,m,h,g));else{var v,y,b=h,w=m,x=h,$=m,k=p,M=p,A=a.apply(this,arguments)/2,D=A>sc&&(r?+r.apply(this,arguments):uc(f*f+d*d)),S=oc(nc(d-f)/2,+e.apply(this,arguments)),F=S,E=S;if(D>sc){var N=dc(D/f*ac(A)),C=dc(D/d*ac(A));(k-=2*N)>sc?(x+=N*=g?1:-1,$-=N):(k=0,x=$=(h+m)/2),(M-=2*C)>sc?(b+=C*=g?1:-1,w-=C):(M=0,b=w=(h+m)/2)}var O=d*rc(b),_=d*ac(b),z=f*rc($),B=f*ac($);if(S>sc){var T,P=d*rc(w),j=d*ac(w),R=f*rc(x),L=f*ac(x);if(p<cc)if(T=function(t,n,e,r,i,o,a,u){var s=e-t,c=r-n,l=a-i,f=u-o,d=f*s-l*c;if(!(d*d<sc))return[t+(d=(l*(n-o)-f*(t-i))/d)*s,n+d*c]}(O,_,R,L,P,j,z,B)){var I=O-T[0],q=_-T[1],U=P-T[0],W=j-T[1],H=1/ac(function(t){return t>1?0:t<-1?cc:Math.acos(t)}((I*U+q*W)/(uc(I*I+q*q)*uc(U*U+W*W)))/2),G=uc(T[0]*T[0]+T[1]*T[1]);F=oc(S,(f-G)/(H-1)),E=oc(S,(d-G)/(H+1))}else F=E=0}M>sc?E>sc?(v=Dc(R,L,O,_,d,E,g),y=Dc(P,j,z,B,d,E,g),u.moveTo(v.cx+v.x01,v.cy+v.y01),E<S?u.arc(v.cx,v.cy,E,ec(v.y01,v.x01),ec(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,E,ec(v.y01,v.x01),ec(v.y11,v.x11),!g),u.arc(0,0,d,ec(v.cy+v.y11,v.cx+v.x11),ec(y.cy+y.y11,y.cx+y.x11),!g),u.arc(y.cx,y.cy,E,ec(y.y11,y.x11),ec(y.y01,y.x01),!g))):(u.moveTo(O,_),u.arc(0,0,d,b,w,!g)):u.moveTo(O,_),f>sc&&k>sc?F>sc?(v=Dc(z,B,P,j,f,-F,g),y=Dc(O,_,R,L,f,-F,g),u.lineTo(v.cx+v.x01,v.cy+v.y01),F<S?u.arc(v.cx,v.cy,F,ec(v.y01,v.x01),ec(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,F,ec(v.y01,v.x01),ec(v.y11,v.x11),!g),u.arc(0,0,f,ec(v.cy+v.y11,v.cx+v.x11),ec(y.cy+y.y11,y.cx+y.x11),g),u.arc(y.cx,y.cy,F,ec(y.y11,y.x11),ec(y.y01,y.x01),!g))):u.arc(0,0,f,$,x,g):u.lineTo(z,B)}else u.moveTo(0,0);if(u.closePath(),c)return u=null,c+""||null}return c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-cc/2;return[rc(r)*e,ac(r)*e]},c.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),c):t},c.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),c):n},c.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:tc(+t),c):e},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:tc(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:tc(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:tc(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:tc(+t),c):a},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c}().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)),Ev=_c().x(Av).y1(Dv).y0((t=>(t.y||0)+(t.height||0))).defined(Sv),Nv=_c().y(Dv).x1(Av).x0((t=>(t.x||0)+(t.width||0))).defined(Sv),Cv=Oc().x(Av).y(Dv).defined(Sv),Ov=$v().x(Av).y(Dv).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Mv(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),_v=function(t,n){let e=null,r=wc(i);function i(){let i;if(e||(e=i=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),i)return e=null,i+""||null}return t="function"==typeof t?t:tc(t||zc),n="function"==typeof n?n:tc(void 0===n?64:+n),i.type=function(n){return arguments.length?(t="function"==typeof n?n:tc(n),i):t},i.size=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),i):n},i.context=function(t){return arguments.length?(e=null==t?null:t,i):e},i}().type((t=>hv(t.shape||"circle"))).size((t=>Mv(t.size,64))),zv=kv().x(Av).y(Dv).defined(Sv).size((t=>t.size||1));function Bv(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Tv(t,n,e,r){return Ov.context(t)(n,e,r)}var Pv=1;function jv(t,n,e){var r=n.clip,i=t._defs,o=n.clip_id||(n.clip_id="clip"+Pv++),a=i.clipping[o]||(i.clipping[o]={id:o});return tt(r)?a.path=r(null):Bv(e)?a.path=Tv(null,e,0,0):(a.width=e.width||0,a.height=e.height||0),"url(#"+o+")"}function Rv(t){this.clear(),t&&this.union(t)}function Lv(t){this.mark=t,this.bounds=this.bounds||new Rv}function Iv(t){Lv.call(this,t),this.items=this.items||[]}Rv.prototype={clone(){return new Rv(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,n,e,r){return e<t?(this.x2=t,this.x1=e):(this.x1=t,this.x2=e),r<n?(this.y2=n,this.y1=r):(this.y1=n,this.y2=r),this},add(t,n){return t<this.x1&&(this.x1=t),n<this.y1&&(this.y1=n),t>this.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},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,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},rotate(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,n,e){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),c=n-n*u+e*s,l=e-n*s-e*u;return[u*r-s*i+c,s*r+u*i+l,u*r-s*a+c,s*r+u*a+l,u*o-s*i+c,s*o+u*i+l,u*o-s*a+c,s*o+u*a+l]},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,n){return!(t<this.x1||t>this.x2||n<this.y1||n>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},pt(Iv,Lv);class qv{constructor(t){this._pending=0,this._loader=t||Vo()}pending(){return this._pending}sanitizeURL(t){const n=this;return Uv(n),n._loader.sanitize(t,{context:"href"}).then((t=>(Wv(n),t))).catch((()=>(Wv(n),null)))}loadImage(t){const n=this,e=ml();return Uv(n),n._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!e)throw{url:r};const i=new e,o=ft(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>Wv(n),i.onerror=()=>Wv(n),i.src=r,i})).catch((t=>(Wv(n),{complete:!1,width:0,height:0,src:t&&t.url||""})))}ready(){const t=this;return new Promise((n=>{!function e(r){t.pending()?setTimeout((()=>{e(!0)}),10):n(r)}(!1)}))}}function Uv(t){t._pending+=1}function Wv(t){t._pending-=1}function Hv(t,n,e){if(n.stroke&&0!==n.opacity&&0!==n.strokeOpacity){const r=null!=n.strokeWidth?+n.strokeWidth:1;t.expand(r+(e?function(t,n){return t.strokeJoin&&"miter"!==t.strokeJoin?0:n}(n,r):0))}return t}const Gv=nv-1e-8;let Yv,Vv,Xv,Jv,Kv,Qv,Zv,ty;const ny=(t,n)=>Yv.add(t,n),ey=(t,n)=>ny(Vv=t,Xv=n),ry=t=>ny(t,Yv.y1),iy=t=>ny(Yv.x1,t),oy=(t,n)=>Kv*t+Zv*n,ay=(t,n)=>Qv*t+ty*n,uy=(t,n)=>ny(oy(t,n),ay(t,n)),sy=(t,n)=>ey(oy(t,n),ay(t,n));function cy(t,n){return Yv=t,n?(Jv=n*Zg,Kv=ty=Math.cos(Jv),Qv=Math.sin(Jv),Zv=-Qv):(Kv=ty=1,Jv=Qv=Zv=0),ly}const ly={beginPath(){},closePath(){},moveTo:sy,lineTo:sy,rect(t,n,e,r){Jv?(uy(t+e,n),uy(t+e,n+r),uy(t,n+r),sy(t,n)):(ny(t+e,n+r),ey(t,n))},quadraticCurveTo(t,n,e,r){const i=oy(t,n),o=ay(t,n),a=oy(e,r),u=ay(e,r);fy(Vv,i,a,ry),fy(Xv,o,u,iy),ey(a,u)},bezierCurveTo(t,n,e,r,i,o){const a=oy(t,n),u=ay(t,n),s=oy(e,r),c=ay(e,r),l=oy(i,o),f=ay(i,o);dy(Vv,a,s,l,ry),dy(Xv,u,c,f,iy),ey(l,f)},arc(t,n,e,r,i,o){if(r+=Jv,i+=Jv,Vv=e*Math.cos(i)+t,Xv=e*Math.sin(i)+n,Math.abs(i-r)>Gv)ny(t-e,n-e),ny(t+e,n+e);else{const a=r=>ny(e*Math.cos(r)+t,e*Math.sin(r)+n);let u,s;if(a(r),a(i),i!==r)if((r%=nv)<0&&(r+=nv),(i%=nv)<0&&(i+=nv),i<r&&(o=!o,u=r,r=i,i=u),o)for(i-=nv,u=r-r%tv,s=0;s<4&&u>i;++s,u-=tv)a(u);else for(u=r-r%tv+tv,s=0;s<4&&u<i;++s,u+=tv)a(u)}}};function fy(t,n,e,r){const i=(t-n)/(t+e-2*n);0<i&&i<1&&r(t+(n-t)*i)}function dy(t,n,e,r,i){const o=r-t+3*n-3*e,a=t+e-2*n,u=t-n;let s,c=0,l=0;Math.abs(o)>1e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),c=(-a+s)/o,l=(-a-s)/o)):c=.5*u/a,0<c&&c<1&&i(hy(c,t,n,e,r)),0<l&&l<1&&i(hy(l,t,n,e,r))}function hy(t,n,e,r,i){const o=1-t,a=o*o,u=t*t;return a*o*n+3*a*t*e+3*o*u*r+u*t*i}var my=(my=hl(1,1))?my.getContext("2d"):null;const py=new Rv;function gy(t){return function(n,e){if(!my)return!0;t(my,n),py.clear().union(n.bounds).intersect(e).round();const{x1:r,y1:i,x2:o,y2:a}=py;for(let t=i;t<=a;++t)for(let n=r;n<=o;++n)if(my.isPointInPath(n,t))return!0;return!1}}function vy(t,n){return n.contains(t.x||0,t.y||0)}function yy(t,n){const e=t.x||0,r=t.y||0;return n.intersects(py.set(e,r,e+(t.width||0),r+(t.height||0)))}function by(t,n){const e=t.x||0,r=t.y||0;return wy(n,e,r,null!=t.x2?t.x2:e,null!=t.y2?t.y2:r)}function wy(t,n,e,r,i){const{x1:o,y1:a,x2:u,y2:s}=t,c=r-n,l=i-e;let f,d,h,m,p=0,g=1;for(m=0;m<4;++m){if(0===m&&(f=-c,d=-(o-n)),1===m&&(f=c,d=u-n),2===m&&(f=-l,d=-(a-e)),3===m&&(f=l,d=s-e),Math.abs(f)<1e-10&&d<0)return!1;if(h=d/f,f<0){if(h>g)return!1;h>p&&(p=h)}else if(f>0){if(h<p)return!1;h<g&&(g=h)}}return!0}function xy(t,n){t.globalCompositeOperation=n.blend||"source-over"}function $y(t,n){return null==t?n:t}function ky(t,n){const e=n.length;for(let r=0;r<e;++r)t.addColorStop(n[r].offset,n[r].color);return t}function My(t,n,e){return Ig(e)?function(t,n,e){const r=e.width(),i=e.height();let o;if("radial"===n.gradient)o=t.createRadialGradient(e.x1+$y(n.x1,.5)*r,e.y1+$y(n.y1,.5)*i,Math.max(r,i)*$y(n.r1,0),e.x1+$y(n.x2,.5)*r,e.y1+$y(n.y2,.5)*i,Math.max(r,i)*$y(n.r2,.5));else{const a=$y(n.x1,0),u=$y(n.y1,0),s=$y(n.x2,1),c=$y(n.y2,0);if(a!==s&&u!==c&&r!==i){const e=hl(Math.ceil(r),Math.ceil(i)),o=e.getContext("2d");return o.scale(r,i),o.fillStyle=ky(o.createLinearGradient(a,u,s,c),n.stops),o.fillRect(0,0,r,i),t.createPattern(e,"no-repeat")}o=t.createLinearGradient(e.x1+a*r,e.y1+u*i,e.x1+s*r,e.y1+c*i)}return ky(o,n.stops)}(t,e,n.bounds):e}function Ay(t,n,e){return(e*=null==n.fillOpacity?1:n.fillOpacity)>0&&(t.globalAlpha=e,t.fillStyle=My(t,n,n.fill),!0)}var Dy=[];function Sy(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&(e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=My(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||Dy),t.lineDashOffset=n.strokeDashOffset||0),!0)}function Fy(t,n){return t.zindex-n.zindex||t.index-n.index}function Ey(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,o=[];for(e=0,r=i.length;e<r;++e)(n=i[e]).index=e,n.zindex&&o.push(n);return t.zdirty=!1,t.zitems=o.sort(Fy)}function Ny(t,n){var e,r,i=t.items;if(!i||!i.length)return;const o=Ey(t);if(o&&o.length){for(e=0,r=i.length;e<r;++e)i[e].zindex||n(i[e]);i=o}for(e=0,r=i.length;e<r;++e)n(i[e])}function Cy(t,n){var e,r,i=t.items;if(!i||!i.length)return null;const o=Ey(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(e=n(i[r]))return e;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function Oy(t){return function(n,e,r){Ny(e,(e=>{r&&!r.intersects(e.bounds)||zy(t,n,e,e)}))}}function _y(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||zy(t,n,e.items[0],e.items)}}function zy(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||(xy(n,e),e.fill&&Ay(n,e,i)&&n.fill(),e.stroke&&Sy(n,e,i)&&n.stroke()))}function By(t){return t=t||$,function(n,e,r,i,o,a){return r*=n.pixelRatio,i*=n.pixelRatio,Cy(e,(e=>{const u=e.bounds;if((!u||u.contains(o,a))&&u)return t(n,e,r,i,o,a)?e:void 0}))}}function Ty(t,n){return function(e,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,c=null==n?s.fill:n,l=s.stroke&&e.isPointInStroke;return l&&(u=s.strokeCap,e.lineWidth=null!=(a=s.strokeWidth)?a:1,e.lineCap=null!=u?u:"butt"),!t(e,r)&&(c&&e.isPointInPath(i,o)||l&&e.isPointInStroke(i,o))}}function Py(t){return By(Ty(t))}function jy(t,n){return"translate("+t+","+n+")"}function Ry(t){return"rotate("+t+")"}function Ly(t){return jy(t.x||0,t.y||0)}function Iy(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,o=e.angle||0;t.translate(r,i),o&&t.rotate(o*=Zg),t.beginPath(),n(t,e),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",function(t){return jy(t.x||0,t.y||0)+(t.angle?" "+Ry(t.angle):"")}(e)),t("d",n(null,e))},bound:function(t,e){return n(cy(t,e.angle),e),Hv(t,e).translate(e.x||0,e.y||0)},draw:Oy(r),pick:Py(r),isect:e||gy(r)}}var qy=Iy("arc",(function(t,n){return Fv.context(t)(n)}));function Uy(t,n,e){function r(t,e){t.beginPath(),n(t,e)}const i=Ty(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(cy(t),r),Hv(t,r[0]))},draw:_y(r),pick:function(t,n,e,r,o,a){var u=n.items,s=n.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:i(t,u,e*=t.pixelRatio,r*=t.pixelRatio)?u[0]:null},isect:vy,tip:e}}var Wy=Uy("area",(function(t,n){const e=n[0];return("horizontal"===e.orient?Nv:Ev).curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<u&&(u=r,e=t[a]);return e}));function Hy(t,n){t.beginPath(),Bv(n)?Tv(t,n,0,0):t.rect(0,0,n.width||0,n.height||0),t.clip()}function Gy(t){const n=$y(t.strokeWidth,1);return null!=t.strokeOffset?t.strokeOffset:t.stroke&&n>.5&&n<1.5?.5-Math.abs(n-1):0}function Yy(t,n){const e=Gy(n);t("d",Tv(null,n,e,e))}function Vy(t,n,e,r){const i=Gy(n);t.beginPath(),Tv(t,n,(e||0)+i,(r||0)+i)}const Xy=Ty(Vy),Jy=Ty(Vy,!1),Ky=Ty(Vy,!0);var Qy={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",Ly(n))},bound:function(t,n){if(!n.clip&&n.items){const e=n.items,r=e.length;for(let n=0;n<r;++n)t.union(e[n].bounds)}return(n.clip||n.width||n.height)&&!n.noBound&&t.add(0,0).add(n.width||0,n.height||0),Hv(t,n),t.translate(n.x||0,n.y||0)},draw:function(t,n,e,r){Ny(n,(n=>{const i=n.x||0,o=n.y||0,a=n.strokeForeground,u=null==n.opacity?1:n.opacity;(n.stroke||n.fill)&&u&&(Vy(t,n,i,o),xy(t,n),n.fill&&Ay(t,n,u)&&t.fill(),n.stroke&&!a&&Sy(t,n,u)&&t.stroke()),t.save(),t.translate(i,o),n.clip&&Hy(t,n),e&&e.translate(-i,-o),Ny(n,(n=>{("group"===n.marktype||null==r||r.includes(n.marktype))&&this.draw(t,n,e,r)})),e&&e.translate(i,o),t.restore(),a&&n.stroke&&u&&(Vy(t,n,i,o),xy(t,n),Sy(t,n,u)&&t.stroke())}))},pick:function(t,n,e,r,i,o){if(n.bounds&&!n.bounds.contains(i,o)||!n.items)return null;const a=e*t.pixelRatio,u=r*t.pixelRatio;return Cy(n,(s=>{let c,l,f;const d=s.bounds;if(d&&!d.contains(i,o))return;l=s.x||0,f=s.y||0;const h=s.clip;if(h&&(i<l||i>l+(s.width||0)||o<f||o>f+(s.height||0)))return;if(t.save(),t.translate(l,f),l=i-l,f=o-f,h&&Bv(s)&&!Ky(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,p=!1!==n.interactive;return p&&m&&s.stroke&&Jy(t,s,a,u)?(t.restore(),s):(c=Cy(s,(t=>function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,l,f)?this.pick(t,e,r,l,f):null)),!c&&p&&(s.fill||!m&&s.stroke)&&Xy(t,s,a,u)&&(c=s),t.restore(),c||null)}))},isect:yy,content:function(t,n,e){t("clip-path",n.clip?jv(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),Yy(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?Yy(t,n):t("d","")}},Zy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function tb(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then((n=>{t.image=n,t.image.url=t.url}))),e}function nb(t,n){return null!=t.width?t.width:n&&n.width?!1!==t.aspect&&t.height?t.height*n.width/n.height:n.width:0}function eb(t,n){return null!=t.height?t.height:n&&n.height?!1!==t.aspect&&t.width?t.width*n.height/n.width:n.height:0}function rb(t,n){return"center"===t?n/2:"right"===t?n:0}function ib(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var ob={type:"image",tag:"image",nested:!1,attr:function(t,n,e){const r=tb(n,e),i=nb(n,r),o=eb(n,r),a=(n.x||0)-rb(n.align,i),u=(n.y||0)-ib(n.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",Zy["xmlns:xlink"],"xlink:href"),t("transform",jy(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===n.aspect?"none":"xMidYMid")},bound:function(t,n){const e=n.image,r=nb(n,e),i=eb(n,e),o=(n.x||0)-rb(n.align,r),a=(n.y||0)-ib(n.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,n,e){Ny(n,(n=>{if(e&&!e.intersects(n.bounds))return;const r=tb(n,this);let i=nb(n,r),o=eb(n,r);if(0===i||0===o)return;let a,u,s,c,l=(n.x||0)-rb(n.align,i),f=(n.y||0)-ib(n.baseline,o);!1!==n.aspect&&(u=r.width/r.height,s=n.width/n.height,u==u&&s==s&&u!==s&&(s<u?(c=i/u,f+=(o-c)/2,o=c):(c=o*u,l+=(i-c)/2,i=c))),(r.complete||r.toDataURL)&&(xy(t,n),t.globalAlpha=null!=(a=n.opacity)?a:1,t.imageSmoothingEnabled=!1!==n.smooth,t.drawImage(r,l,f,i,o))}))},pick:By(),isect:$,get:tb,xOffset:rb,yOffset:ib},ab=Uy("line",(function(t,n){const e=n[0];return Cv.curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(e=t[o].x-n[0])*e+(r=t[o].y-n[1])*r<i)return t[o];return null}));function ub(t,n){var e=n.path;if(null==e)return!0;var r=n.x||0,i=n.y||0,o=n.scaleX||1,a=n.scaleY||1,u=(n.angle||0)*Zg,s=n.pathCache;s&&s.path===e||((n.pathCache=s=Qg(e)).path=e),u&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(u),cv(t,s,0,0,o,a),t.rotate(-u),t.translate(-r,-i)):cv(t,s,r,i,o,a)}var sb={type:"path",tag:"path",nested:!1,attr:function(t,n){1===(n.scaleX||1)&&1===(n.scaleY||1)||t("vector-effect","non-scaling-stroke"),t("transform",function(t){return jy(t.x||0,t.y||0)+(t.angle?" "+Ry(t.angle):"")+(t.scaleX||t.scaleY?" "+("scale("+(t.scaleX||1)+","+(t.scaleY||1)+")"):"")}(n)),t("d",n.path)},bound:function(t,n){return ub(cy(t,n.angle),n)?t.set(0,0,0,0):Hv(t,n,!0)},draw:Oy(ub),pick:Py(ub),isect:gy(ub)};function cb(t,n){t.beginPath(),Tv(t,n)}var lb={type:"rect",tag:"path",nested:!1,attr:function(t,n){t("d",Tv(null,n))},bound:function(t,n){var e,r;return Hv(t.set(e=n.x||0,r=n.y||0,e+n.width||0,r+n.height||0),n)},draw:Oy(cb),pick:Py(cb),isect:yy};function fb(t,n,e){var r,i,o,a;return!(!n.stroke||!Sy(t,n,e)||(r=n.x||0,i=n.y||0,o=null!=n.x2?n.x2:r,a=null!=n.y2?n.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),0))}var db={type:"rule",tag:"line",nested:!1,attr:function(t,n){t("transform",Ly(n)),t("x2",null!=n.x2?n.x2-(n.x||0):0),t("y2",null!=n.y2?n.y2-(n.y||0):0)},bound:function(t,n){var e,r;return Hv(t.set(e=n.x||0,r=n.y||0,null!=n.x2?n.x2:e,null!=n.y2?n.y2:r),n)},draw:function(t,n,e){Ny(n,(n=>{if(!e||e.intersects(n.bounds)){var r=null==n.opacity?1:n.opacity;r&&fb(t,n,r)&&(xy(t,n),t.stroke())}}))},pick:By((function(t,n,e,r){return!!t.isPointInStroke&&fb(t,n,1)&&t.isPointInStroke(e,r)})),isect:by},hb=Iy("shape",(function(t,n){return(n.mark.shape||n.shape).context(t)(n)})),mb=Iy("symbol",(function(t,n){return _v.context(t)(n)}),vy);const pb=At();var gb={height:$b,measureWidth:wb,estimateWidth:yb,width:yb,canvas:vb};function vb(t){gb.width=t&&my?wb:yb}function yb(t,n){return bb(Db(t,n),$b(t))}function bb(t,n){return~~(.8*t.length*n)}function wb(t,n){return $b(t)<=0||!(n=Db(t,n))?0:xb(n,Fb(t))}function xb(t,n){const e=`(${n}) ${t}`;let r=pb.get(e);return void 0===r&&(my.font=n,r=my.measureText(t).width,pb.set(e,r)),r}function $b(t){return null!=t.fontSize?+t.fontSize||0:11}function kb(t){return null!=t.lineHeight?t.lineHeight:$b(t)+2}function Mb(t){return n=t.lineBreak&&t.text&&!S(t.text)?t.text.split(t.lineBreak):t.text,S(n)?n.length>1?n:n[0]:n;var n}function Ab(t){const n=Mb(t);return(S(n)?n.length-1:0)*kb(t)}function Db(t,n){const e=null==n?"":(n+"").trim();return t.limit>0&&e.length?function(t,n){var e=+t.limit,r=function(t){if(gb.width===wb){const n=Fb(t);return t=>xb(t,n)}if(gb.width===yb){const n=$b(t);return t=>bb(t,n)}return n=>gb.width(t,n)}(t);if(r(n)<e)return n;var i,o=t.ellipsis||"…",a="rtl"===t.dir,u=0,s=n.length;if(e-=r(o),a){for(;u<s;)r(n.slice(i=u+s>>>1))>e?u=i+1:s=i;return o+n.slice(u)}for(;u<s;)r(n.slice(0,i=1+(u+s>>>1)))<e?u=i:s=i-1;return n.slice(0,u)+o}(t,e):e}function Sb(t,n){var e=t.font;return(n&&e?String(e).replace(/"/g,"'"):e)||"sans-serif"}function Fb(t,n){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+$b(t)+"px "+Sb(t,n)}function Eb(t){var n=t.baseline,e=$b(t);return Math.round("top"===n?.79*e:"middle"===n?.3*e:"bottom"===n?-.21*e:"line-top"===n?.29*e+.5*kb(t):"line-bottom"===n?.29*e-.5*kb(t):0)}vb(!0);const Nb={left:"start",center:"middle",right:"end"},Cb=new Rv;function Ob(t){var n,e=t.x||0,r=t.y||0,i=t.radius||0;return i&&(n=(t.theta||0)-tv,e+=i*Math.cos(n),r+=i*Math.sin(n)),Cb.x1=e,Cb.y1=r,Cb}function _b(t,n,e){var r,i=gb.height(n),o=n.align,a=Ob(n),u=a.x1,s=a.y1,c=n.dx||0,l=(n.dy||0)+Eb(n)-Math.round(.8*i),f=Mb(n);if(S(f)?(i+=kb(n)*(f.length-1),r=f.reduce(((t,e)=>Math.max(t,gb.width(n,e))),0)):r=gb.width(n,f),"center"===o?c-=r/2:"right"===o&&(c-=r),t.set(c+=u,l+=s,c+r,l+i),n.angle&&!e)t.rotate(n.angle*Zg,u,s);else if(2===e)return t.rotatedPoints(n.angle*Zg,u,s);return t}var zb={type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+Eb(n),o=Ob(n),a=o.x1,u=o.y1,s=n.angle||0;t("text-anchor",Nb[n.align]||"start"),s?(e=jy(a,u)+" "+Ry(s),(r||i)&&(e+=" "+jy(r,i))):e=jy(a+r,u+i),t("transform",e)},bound:_b,draw:function(t,n,e){Ny(n,(n=>{var r,i,o,a,u,s,c,l=null==n.opacity?1:n.opacity;if(!(e&&!e.intersects(n.bounds)||0===l||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=Fb(n),t.textAlign=n.align||"left",i=(r=Ob(n)).x1,o=r.y1,n.angle&&(t.save(),t.translate(i,o),t.rotate(n.angle*Zg),i=o=0),i+=n.dx||0,o+=(n.dy||0)+Eb(n),s=Mb(n),xy(t,n),S(s))for(u=kb(n),a=0;a<s.length;++a)c=Db(n,s[a]),n.fill&&Ay(t,n,l)&&t.fillText(c,i,o),n.stroke&&Sy(t,n,l)&&t.strokeText(c,i,o),o+=u;else c=Db(n,s),n.fill&&Ay(t,n,l)&&t.fillText(c,i,o),n.stroke&&Sy(t,n,l)&&t.strokeText(c,i,o);n.angle&&t.restore()}}))},pick:By((function(t,n,e,r,i,o){if(n.fontSize<=0)return!1;if(!n.angle)return!0;var a=Ob(n),u=a.x1,s=a.y1,c=_b(Cb,n,1),l=-n.angle*Zg,f=Math.cos(l),d=Math.sin(l);return c.contains(f*i-d*o+(u-f*u+d*s),d*i+f*o+(s-d*u-f*s))})),isect:function(t,n){const e=_b(Cb,t,2);return wy(n,e[0],e[1],e[2],e[3])||wy(n,e[0],e[1],e[4],e[5])||wy(n,e[4],e[5],e[6],e[7])||wy(n,e[2],e[3],e[6],e[7])}},Bb=Uy("trail",(function(t,n){return zv.context(t)(n)}),(function(t,n){for(var e,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null})),Tb={arc:qy,area:Wy,group:Qy,image:ob,line:ab,path:sb,rect:lb,rule:db,shape:hb,symbol:mb,text:zb,trail:Bb};function Pb(t,n,e){var r=Tb[t.mark.marktype];return r.nested&&(t=t.mark),(n||r.bound)(t.bounds||(t.bounds=new Rv),t,e)}var jb={mark:null};function Rb(t,n,e){var r,i,o,a,u=Tb[t.marktype],s=u.bound,c=t.items,l=c&&c.length;if(u.nested)return l?o=c[0]:(jb.mark=t,o=jb),a=Pb(o,s,e),n&&n.union(a)||a;if(n=n||t.bounds&&t.bounds.clear()||new Rv,l)for(r=0,i=c.length;r<i;++r)n.union(Pb(c[r],s,e));return t.bounds=n}const Lb=["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 Ib(t,n){return JSON.stringify(t,Lb,n)}function qb(t){return Ub("string"==typeof t?JSON.parse(t):t)}function Ub(t){var n,e,r,i=t.marktype,o=t.items;if(o)for(e=0,r=o.length;e<r;++e)o[e][n=i?"mark":"group"]=t,o[e].zindex&&(o[e][n].zdirty=!0),"group"===(i||n)&&Ub(o[e]);return i&&Rb(t),t}class Wb{constructor(t){arguments.length?this.root=qb(t):(this.root=Hb({marktype:"group",name:"root",role:"frame"}),this.root.items=[new Iv(this.root)])}toJSON(t){return Ib(this.root,t||0)}mark(t,n,e){const r=Hb(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r}}function Hb(t,n){const e={bounds:new Rv,clip:!!t.clip,group:n,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0};return null!=t.aria&&(e.aria=t.aria),t.description&&(e.description=t.description),e}function Gb(t,n,e){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?e?t.createElementNS(e,n):t.createElement(n):null}function Yb(t,n){n=n.toLowerCase();for(var e=t.childNodes,r=0,i=e.length;r<i;++r)if(e[r].tagName.toLowerCase()===n)return e[r]}function Vb(t,n,e,r){var i,o=t.childNodes[n];return o&&o.tagName.toLowerCase()===e.toLowerCase()||(i=o||null,o=Gb(t.ownerDocument,e,r),t.insertBefore(o,i)),o}function Xb(t,n){for(var e=t.childNodes,r=e.length;r>n;)t.removeChild(e[--r]);return t}function Jb(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Kb(t,n){const e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}let Qb=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||Vo(),this._tooltip=n||Zb}initialize(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)}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,n,e){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1}handlers(t){const n=this._handlers,e=[];if(t)e.push(...n[this.eventName(t)]);else for(const t in n)e.push(...n[t]);return e}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,e){this._loader.sanitize(e,{context:"href"}).then((n=>{const e=new MouseEvent(t.type,t),r=Gb(null,"a");for(const t in n)r.setAttribute(t,n[t]);r.dispatchEvent(e)})).catch((()=>{}))}handleTooltip(t,n,e){n&&null!=n.tooltip&&(n=function(t,n,e,r){var i,o,a=t&&t.mark;if(a&&(i=Tb[a.marktype]).tip){for((o=Kb(n,e))[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}(n,t,this.canvas(),this._origin),this._tooltip.call(this._obj,this,t,n,e&&n&&n.tooltip||null))}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+e.left,s=i.y1+r[1]+e.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}};function Zb(t,n,e,r){t.element().setAttribute("title",r||"")}class tw{constructor(t){this._el=null,this._bgcolor=null,this._loader=new qv(t)}initialize(t,n,e,r,i){return this._el=t,this.resize(n,e,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,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const e=this;return e._call=function(){e._render(t,n)},e._call(),e._call=null,e}_render(){}renderAsync(t,n){const e=this.render(t,n);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)}_load(t,n){var e=this,r=e._loader[t](n);if(!e._ready){const t=e._call;e._ready=e._loader.ready().then((n=>{n&&t(),e._ready=null}))}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const nw="dragenter",ew="dragleave",rw="dragover",iw="pointerdown",ow="pointermove",aw="pointerout",uw="pointerover",sw="mousedown",cw="mousemove",lw="mouseout",fw="mouseover",dw="click",hw="mousewheel",mw="touchstart",pw="touchmove",gw="touchend",vw=["keydown","keypress","keyup",nw,ew,rw,iw,"pointerup",ow,aw,uw,sw,"mouseup",cw,lw,fw,dw,"dblclick","wheel",hw,mw,pw,gw],yw=ow,bw=lw,ww=dw;class xw extends Qb{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=vw,this.pointermove=Aw([ow,cw],[uw,fw],[aw,lw]),this.dragover=Aw([rw],[nw],[ew]),this.pointerout=Dw([aw,lw]),this.dragleave=Dw([ew])}initialize(t,n,e){return this._canvas=t&&Yb(t,"canvas"),[dw,sw,iw,ow,aw,ew].forEach((t=>kw(this,t))),super.initialize(t,n,e)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(hw,t)}pointerdown(t){this._down=this._active,this.fire(iw,t)}mousedown(t){this._down=this._active,this.fire(sw,t)}click(t){this._down===this._active&&(this.fire(dw,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(mw,t,!0)}touchmove(t){this.fire(pw,t,!0)}touchend(t){this.fire(gw,t,!0),this._touch=null}fire(t,n,e){const r=e?this._touch:this._active,i=this._handlers[t];if(n.vegaType=t,t===ww&&r&&r.href?this.handleHref(n,r,r.href):t!==yw&&t!==bw||this.handleTooltip(n,r,t!==bw),i)for(let t=0,e=i.length;t<e;++t)i[t].handler.call(this._obj,n,r)}on(t,n){const e=this.eventName(t),r=this._handlers;return this._handlerIndex(r[e],t,n)<0&&(kw(this,t),(r[e]||(r[e]=[])).push({type:t,handler:n})),this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&r.splice(i,1),this}pickEvent(t){const n=Kb(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])}pick(t,n,e,r,i){const o=this.context();return Tb[t.marktype].pick.call(this,o,t,n,e,r,i)}}const $w=t=>t===mw||t===pw||t===gw?[mw,pw,gw]:[t];function kw(t,n){$w(n).forEach((n=>function(t,n){const e=t.canvas();e&&!t._events[n]&&(t._events[n]=1,e.addEventListener(n,t[n]?e=>t[n](e):e=>t.fire(n,e)))}(t,n)))}function Mw(t,n,e){n.forEach((n=>t.fire(n,e)))}function Aw(t,n,e){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||Mw(this,e,r),this._active=o,Mw(this,n,r)),Mw(this,t,r)}}function Dw(t){return function(n){Mw(this,t,n),this._active=null}}class Sw extends tw{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Rv,this._tempb=new Rv}initialize(t,n,e,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:hl(1,1),t&&this._canvas&&(Xb(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,e,r,i)}resize(t,n,e,r){if(super.resize(t,n,e,r),this._canvas)!function(t,n,e,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?"undefined"!=typeof window&&window.devicePixelRatio||1:i;t.width=n*s,t.height=e*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=n+"px",t.style.height=e+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||p("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 n=this._tempb.clear().union(t.bounds);let e=t.mark.group;for(;e;)n.translate(e.x||0,e.y||0),e=e.mark.group;this._dirty.union(n)}_render(t,n){const e=this.context(),r=this._origin,i=this._width,o=this._height,a=this._dirty,u=Fw(r,i,o);e.save();const s=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):function(t,n,e){return n.expand(1).round(),t.pixelRatio%1&&n.scale(t.pixelRatio).round().scale(1/t.pixelRatio),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(e,u.intersect(a),r);return this.clear(-r[0],-r[1],i,o),this.draw(e,t,s,n),e.restore(),a.clear(),this}draw(t,n,e,r){if("group"!==n.marktype&&null!=r&&!r.includes(n.marktype))return;const i=Tb[n.marktype];n.clip&&function(t,n){var e=n.clip;t.save(),tt(e)?(t.beginPath(),e(t),t.clip()):Hy(t,n.group)}(t,n),i.draw.call(this,t,n,e,r),n.clip&&t.restore()}clear(t,n,e,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,n,e,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,n,e,r))}}const Fw=(t,n,e)=>(new Rv).set(0,0,n,e).translate(-t[0],-t[1]);class Ew extends Qb{constructor(t,n){super(t,n);const e=this;e._hrefHandler=Nw(e,((t,n)=>{n&&n.href&&e.handleHref(t,n,n.href)})),e._tooltipHandler=Nw(e,((t,n)=>{e.handleTooltip(t,n,t.type!==bw)}))}initialize(t,n,e){let r=this._svg;return r&&(r.removeEventListener(ww,this._hrefHandler),r.removeEventListener(yw,this._tooltipHandler),r.removeEventListener(bw,this._tooltipHandler)),this._svg=r=t&&Yb(t,"svg"),r&&(r.addEventListener(ww,this._hrefHandler),r.addEventListener(yw,this._tooltipHandler),r.addEventListener(bw,this._tooltipHandler)),super.initialize(t,n,e)}canvas(){return this._svg}on(t,n){const e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){const i={type:t,handler:n,listener:Nw(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this}}const Nw=(t,n)=>e=>{let r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)},Cw="aria-hidden",Ow="aria-label",_w="role",zw="aria-roledescription",Bw="graphics-object",Tw="graphics-symbol",Pw=(t,n,e)=>({[_w]:t,[zw]:n,[Ow]:e||void 0}),jw=Bt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Rw={axis:{desc:"axis",caption:function(t){const n=t.datum,e=t.orient,r=n.title?Ww(t):null,i=t.context,o=i.scales[n.scale].value,a=i.dataflow.locale(),u=o.type;return`${"left"===e||"right"===e?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${og(u)?"discrete":u} scale`+` with ${jg(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const n=t.datum,e=n.title?Ww(t):null,r=`${n.type||""} legend`.trim(),i=n.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return((c=r).length?c[0].toUpperCase()+c.slice(1):c)+(e?` titled '${e}'`:"")+` for ${function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+_(t)}(o)}`+` with ${jg(s,u,t)}`;var c}},"title-text":{desc:"title",caption:t=>`Title text '${Uw(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Uw(t)}'`}},Lw={ariaRole:_w,ariaRoleDescription:zw,description:Ow};function Iw(t,n){const e=!1===n.aria;if(t(Cw,e||void 0),e||null==n.description)for(const n in Lw)t(Lw[n],void 0);else{const e=n.mark.marktype;t(Ow,n.description),t(_w,n.ariaRole||("group"===e?Bw:Tw)),t(zw,n.ariaRoleDescription||`${e} mark`)}}function qw(t){return!1===t.aria?{[Cw]:!0}:jw[t.role]?null:Rw[t.role]?function(t,n){try{const e=t.items[0];return Pw(n.role||Tw,n.desc,e.description||(n.caption||(()=>""))(e))}catch(t){return null}}(t,Rw[t.role]):function(t){const n=t.marktype,e="group"===n||"text"===n||t.items.some((t=>null!=t.description&&!1!==t.aria));return Pw(e?Bw:Tw,`${n} mark container`,t.description)}(t)}function Uw(t){return Q(t.text).join(" ")}function Ww(t){try{return Q(_(t.items).items[0].text).join(" ")}catch(t){return null}}const Hw=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function Gw(){let t="",n="",e="";const r=[],i=()=>n=e="",o=(t,e)=>{var r;return null!=e&&(n+=` ${t}="${r=e,Hw(r).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),a},a={open(u,...s){(o=>{n&&(t+=`${n}>${e}`,i()),r.push(o)})(u),n="<"+u;for(const t of s)for(const n in t)o(n,t[n]);return a},close(){const o=r.pop();return t+=n?n+(e?`>${e}</${o}>`:"/>"):`</${o}>`,i(),a},attr:o,text:t=>(e+=Hw(t),a),toString:()=>t};return a}const Yw=t=>Vw(Gw(),t)+"";function Vw(t,n){if(t.open(n.tagName),n.hasAttributes()){const e=n.attributes,r=e.length;for(let n=0;n<r;++n)t.attr(e[n].name,e[n].value)}if(n.hasChildNodes()){const e=n.childNodes;for(const n of e)3===n.nodeType?t.text(n.nodeValue):Vw(t,n)}return t.close()}const Xw={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"},Jw={blend:"mix-blend-mode"},Kw={fill:"none","stroke-miterlimit":10},Qw="http://www.w3.org/2000/xmlns/",Zw=Zy.xmlns;class tx extends tw{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,n,e,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=Vb(t,0,"svg",Zw),this._svg.setAttributeNS(Qw,"xmlns",Zw),this._svg.setAttributeNS(Qw,"xmlns:xlink",Zy["xmlns:xlink"]),this._svg.setAttribute("version",Zy.version),this._svg.setAttribute("class","marks"),Xb(t,1),this._root=Vb(this._svg,0,"g",Zw),lx(this._root,Kw),Xb(this._svg,1)),this.background(this._bgcolor),super.initialize(t,n,e,r,i)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svg&&(lx(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,n=this._bgcolor;if(!t)return null;let e;n&&(t.removeAttribute("style"),e=Vb(t,0,"rect",Zw),lx(e,{width:this._width,height:this._height,fill:n}));const r=Yw(t);return n&&(t.removeChild(e),this._svg.style.setProperty("background-color",n)),r}_render(t,n){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,n),Xb(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 n=++this._dirtyID;let e,r,i,o,a,u,s;for(a=0,u=t.length;a<u;++a)e=t[a],r=e.mark,r.marktype!==i&&(i=r.marktype,o=Tb[i]),r.zdirty&&r.dirty!==n&&(this._dirtyAll=!1,nx(e,n),r.items.forEach((t=>{t.dirty=n}))),r.zdirty||(e.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):e._svg&&(s=e._svg.parentNode,s&&s.removeChild(e._svg)),e._svg=null):(e=o.nested?r.items[0]:e,e._update!==n&&(e._svg&&e._svg.ownerSVGElement?this._update(o,e._svg,e):(this._dirtyAll=!1,nx(e,n)),e._update=n)));return!this._dirtyAll}mark(t,n,e,r){if(!this.isDirty(n))return n._svg;const i=this._svg,o=n.marktype,a=Tb[o],u=!1===n.interactive?"none":null,s="g"===a.tag,c=ix(n,t,e,"g",i);if("group"!==o&&null!=r&&!r.includes(o))return Xb(c,0),n._svg;c.setAttribute("class",Jb(n));const l=qw(n);for(const t in l)fx(c,t,l[t]);s||fx(c,"pointer-events",u),fx(c,"clip-path",n.clip?jv(this,n,n.group):null);let f=null,d=0;const h=t=>{const n=this.isDirty(t),e=ix(t,c,f,a.tag,i);n&&(this._update(a,e,t),s&&function(t,n,e,r){n=n.lastChild.previousSibling;let i,o=0;Ny(e,(e=>{i=t.mark(n,e,i,r),++o})),Xb(n,1+o)}(this,e,t,r)),f=e,++d};return a.nested?n.items.length&&h(n.items[0]):Ny(n,h),Xb(c,d),c}_update(t,n,e){ox=n,ax=n.__values__,Iw(sx,e),t.attr(sx,e,this);const r=ux[t.type];r&&r.call(this,t,n,e),ox&&this.style(ox,e)}style(t,n){if(null!=n){for(const e in Xw){let r="font"===e?Sb(n):n[e];if(r===ax[e])continue;const i=Xw[e];null==r?t.removeAttribute(i):(Ig(r)&&(r=qg(r,this._defs.gradient,dx())),t.setAttribute(i,r+"")),ax[e]=r}for(const e in Jw)cx(t,Jw[e],n[e])}}defs(){const t=this._svg,n=this._defs;let e=n.el,r=0;for(const i in n.gradient)e||(n.el=e=Vb(t,1,"defs",Zw)),r=ex(e,n.gradient[i],r);for(const i in n.clipping)e||(n.el=e=Vb(t,1,"defs",Zw)),r=rx(e,n.clipping[i],r);e&&(0===r?(t.removeChild(e),n.el=null):Xb(e,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function nx(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function ex(t,n,e){let r,i,o;if("radial"===n.gradient){let r=Vb(t,e++,"pattern",Zw);lx(r,{id:Lg+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=Vb(r,0,"rect",Zw),lx(r,{width:1,height:1,fill:`url(${dx()}#${n.id})`}),lx(t=Vb(t,e++,"radialGradient",Zw),{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else lx(t=Vb(t,e++,"linearGradient",Zw),{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(r=0,i=n.stops.length;r<i;++r)o=Vb(t,r,"stop",Zw),o.setAttribute("offset",n.stops[r].offset),o.setAttribute("stop-color",n.stops[r].color);return Xb(t,r),e}function rx(t,n,e){let r;return(t=Vb(t,e,"clipPath",Zw)).setAttribute("id",n.id),n.path?(r=Vb(t,0,"path",Zw),r.setAttribute("d",n.path)):(r=Vb(t,0,"rect",Zw),lx(r,{x:0,y:0,width:n.width,height:n.height})),Xb(t,1),e+1}function ix(t,n,e,r,i){let o,a=t._svg;if(!a&&(o=n.ownerDocument,a=Gb(o,r,Zw),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){const n=Gb(o,"path",Zw);a.appendChild(n),n.__data__=t;const e=Gb(o,"g",Zw);a.appendChild(e),e.__data__=t;const r=Gb(o,"path",Zw);a.appendChild(r),r.__data__=t,r.__values__={fill:"default"}}return(a.ownerSVGElement!==i||function(t,n){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=n}(a,e))&&n.insertBefore(a,e?e.nextSibling:n.firstChild),a}let ox=null,ax=null;const ux={group(t,n,e){const r=ox=n.childNodes[2];ax=r.__values__,t.foreground(sx,e,this),ax=n.__values__,ox=n.childNodes[1],t.content(sx,e,this);const i=ox=n.childNodes[0];t.background(sx,e,this);const o=!1===e.mark.interactive?"none":null;if(o!==ax.events&&(fx(r,"pointer-events",o),fx(i,"pointer-events",o),ax.events=o),e.strokeForeground&&e.stroke){const t=e.fill;fx(r,"display",null),this.style(i,e),fx(i,"stroke",null),t&&(e.fill=null),ax=r.__values__,this.style(r,e),t&&(e.fill=t),ox=null}else fx(r,"display","none")},image(t,n,e){!1===e.smooth?(cx(n,"image-rendering","optimizeSpeed"),cx(n,"image-rendering","pixelated")):cx(n,"image-rendering",null)},text(t,n,e){const r=Mb(e);let i,o,a,u;S(r)?(o=r.map((t=>Db(e,t))),i=o.join("\n"),i!==ax.text&&(Xb(n,0),a=n.ownerDocument,u=kb(e),o.forEach(((t,r)=>{const i=Gb(a,"tspan",Zw);i.__data__=e,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),n.appendChild(i)})),ax.text=i)):(o=Db(e,r),o!==ax.text&&(n.textContent=o,ax.text=o)),fx(n,"font-family",Sb(e)),fx(n,"font-size",$b(e)+"px"),fx(n,"font-style",e.fontStyle),fx(n,"font-variant",e.fontVariant),fx(n,"font-weight",e.fontWeight)}};function sx(t,n,e){n!==ax[t]&&(e?function(t,n,e,r){null!=e?t.setAttributeNS(r,n,e):t.removeAttributeNS(r,n)}(ox,t,n,e):fx(ox,t,n),ax[t]=n)}function cx(t,n,e){e!==ax[n]&&(null==e?t.style.removeProperty(n):t.style.setProperty(n,e+""),ax[n]=e)}function lx(t,n){for(const e in n)fx(t,e,n[e])}function fx(t,n,e){null!=e?t.setAttribute(n,e):t.removeAttribute(n)}function dx(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class hx extends tw{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=Gw();n.open("svg",st({},Zy,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const e=this._bgcolor;return e&&"transparent"!==e&&"none"!==e&&n.open("rect",{width:this._width,height:this._height,fill:e}).close(),n.open("g",Kw,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const e=Tb[n.marktype],r=e.tag,i=[Iw,e.attr];t.open("g",{class:Jb(n),"clip-path":n.clip?jv(this,n,n.group):null},qw(n),{"pointer-events":"g"!==r&&!1===n.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(n,o,i,"g"!==r?r:null)),"text"===r){const n=Mb(o);if(S(n)){const e={x:0,dy:kb(o)};for(let r=0;r<n.length;++r)t.open("tspan",r?e:null).text(Db(o,n[r])).close()}else t.text(Db(o,n))}else if("g"===r){const r=o.strokeForeground,i=o.fill,a=o.stroke;r&&a&&(o.stroke=null),t.open("path",this.attr(n,o,e.background,"bgrect")).close(),t.open("g",this.attr(n,o,e.content)),Ny(o,(n=>this.mark(t,n))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(n,o,e.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(n,o,e.foreground,"bgfore")).close()}t.close(),a&&t.close()};return e.nested?n.items&&n.items.length&&o(n.items[0]):Ny(n,o),t.close()}href(t){const n=t.href;let e;if(n){if(e=this._hrefs&&this._hrefs[n])return e;this.sanitizeURL(n).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[n]=t}))}return null}attr(t,n,e,r){const i={},o=(t,n,e,r)=>{i[r||t]=n};return Array.isArray(e)?e.forEach((t=>t(o,n,this))):e(o,n,this),r&&function(t,n,e,r,i){let o;if(null==n)return t;if("bgrect"===r&&!1===e.interactive&&(t["pointer-events"]="none"),"bgfore"===r&&(!1===e.interactive&&(t["pointer-events"]="none"),t.display="none",null!==n.fill))return t;"image"===r&&!1===n.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===r&&(t["font-family"]=Sb(n),t["font-size"]=$b(n)+"px",t["font-style"]=n.fontStyle,t["font-variant"]=n.fontVariant,t["font-weight"]=n.fontWeight);for(const e in Xw){let r=n[e];const o=Xw[e];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(Ig(r)&&(r=qg(r,i.gradient,"")),t[o]=r)}for(const t in Jw){const e=n[t];null!=e&&(o=o||[],o.push(`${Jw[t]}: ${e};`))}o&&(t.style=o.join(" "))}(i,n,t,r,this._defs),i}defs(t){const n=this._defs.gradient,e=this._defs.clipping;if(0!==Object.keys(n).length+Object.keys(e).length){t.open("defs");for(const e in n){const r=n[e],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:Lg+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+e+")"}).close(),t.close(),t.open("radialGradient",{id:e,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:e,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let n=0;n<i.length;++n)t.open("stop",{offset:i[n].offset,"stop-color":i[n].color}).close();t.close()}for(const n in e){const r=e[n];t.open("clipPath",{id:n}),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 mx={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class px extends tw{constructor(t){super(t),this._svgRenderer=new tx(t),this._canvasRenderer=new Sw(t)}initialize(t,n,e,r,i){this._root_el=Vb(t,0,"div");const o=Vb(this._root_el,0,"div"),a=Vb(this._root_el,1,"div");return this._root_el.style.position="relative",mx.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=mx.svgOnTop?a:o,this._canvasEl=mx.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,n,e,r,i),this._svgRenderer.initialize(this._svgEl,n,e,r,i),super.initialize(t,n,e,r,i)}dirty(t){return mx.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,n){const e=(n??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((t=>!mx.svgMarkTypes.includes(t)));this._svgRenderer.render(t,mx.svgMarkTypes),this._canvasRenderer.render(t,e)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svgRenderer.resize(t,n,e,r),this._canvasRenderer.resize(t,n,e,r),this}background(t){return mx.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class gx extends xw{constructor(t,n){super(t,n)}initialize(t,n,e){const r=Vb(Vb(t,0,"div"),mx.svgOnTop?0:1,"div");return super.initialize(r,n,e)}}const vx="canvas",yx="hybrid",bx="none",wx={Canvas:vx,PNG:"png",SVG:"svg",Hybrid:yx,None:bx},xx={};function $x(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?(xx[t]=n,this):xx[t]}function kx(t,n,e){const r=[],i=(new Rv).union(n),o=t.marktype;return o?Mx(t,i,e,r):"group"===o?Ax(t,i,e,r):p("Intersect scene must be mark node or group item.")}function Mx(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){const i=t.items,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u<a;++u)Ax(i[u],n,e,r);else for(const t=Tb[o].isect;u<a;++u){const e=i[u];Dx(e,n,t)&&r.push(e)}}return r}function Ax(t,n,e,r){e&&e(t.mark)&&Dx(t,n,Tb.group.isect)&&r.push(t);const i=t.items,o=i&&i.length;if(o){const a=t.x||0,u=t.y||0;n.translate(-a,-u);for(let t=0;t<o;++t)Mx(i[t],n,e,r);n.translate(a,u)}return r}function Dx(t,n,e){const r=t.bounds;return n.encloses(r)||n.intersects(r)&&e(t,n)}xx[vx]=xx.png={renderer:Sw,headless:Sw,handler:xw},xx.svg={renderer:tx,headless:hx,handler:Ew},xx[yx]={renderer:px,headless:px,handler:gx},xx[bx]={};const Sx=new Rv;function Fx(t){const n=t.clip;if(tt(n))n(cy(Sx.clear()));else{if(!n)return;Sx.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Sx)}function Ex(t,n,e){return t===n||("path"===e?Nx(t,n):t instanceof Date&&n instanceof Date?+t==+n:wt(t)&&wt(n)?Math.abs(t-n)<=1e-9:t&&n&&(F(t)||F(n))?function(t,n){var e,r,i=Object.keys(t),o=Object.keys(n);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(!Ex(t[e=i[r]],n[e],e))return!1;return typeof t==typeof n}(t,n):t==n)}function Nx(t,n){return Ex(Qg(t),Qg(n))}const Cx="top",Ox="left",_x="right",zx="bottom",Bx="start",Tx="middle",Px="end",jx="group",Rx="axis",Lx="title",Ix="legend",qx="row-header",Ux="row-footer",Wx="row-title",Hx="column-header",Gx="column-footer",Yx="column-title",Vx="fit-x",Xx="fit-y",Jx="none",Kx="all",Qx="each",Zx="flush",t$="column",n$="row";function e$(t){Oa.call(this,null,t)}function r$(t,n,e){return n(t.bounds.clear(),t,e)}pt(e$,Oa,{transform(t,n){const e=n.dataflow,r=t.mark,i=r.marktype,o=Tb[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&e.dirty(r.items[0]),s=r$(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===jx||t.modified())switch(n.visit(n.MOD,(t=>e.dirty(t))),s.clear(),r.items.forEach((t=>s.union(r$(t,a)))),r.role){case Rx:case Ix:case Lx:n.reflow()}else u=n.changed(n.REM),n.visit(n.ADD,(t=>{s.union(r$(t,a))})),n.visit(n.MOD,(t=>{u=u||s.alignsWith(t.bounds),e.dirty(t),s.union(r$(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Fx(r),n.modifies("bounds")}});const i$=":vega_identifier:";function o$(t){Oa.call(this,0,t)}function a$(t){Oa.call(this,null,t)}function u$(t){Oa.call(this,null,t)}o$.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},pt(o$,Oa,{transform(t,n){const e=(i=n.dataflow)._signals[i$]||(i._signals[i$]=i.add(0)),r=t.as;var i;let o=e.value;return n.visit(n.ADD,(t=>t[r]=t[r]||++o)),e.set(this.value=o),n}}),pt(a$,Oa,{transform(t,n){let e=this.value;e||(e=n.dataflow.scenegraph().mark(t.markdef,function(t){const n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index),e.group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);const r=e.marktype===jx?Iv:Lv;return n.visit(n.ADD,(t=>r.call(t,e))),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n}});const s$={parity:t=>t.filter(((t,n)=>n%2?t.opacity=0:1)),greedy:(t,n)=>{let e;return t.filter(((t,r)=>r&&c$(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)))}},c$=(t,n,e)=>e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2),l$=(t,n)=>{for(var e,r=1,i=t.length,o=t[0].bounds;r<i;o=e,++r)if(c$(o,e=t[r].bounds,n))return!0},f$=t=>{const n=t.bounds;return n.width()>1&&n.height()>1},d$=t=>(t.forEach((t=>t.opacity=1)),t),h$=(t,n)=>t.reflow(n.modified()).modifies("opacity");function m$(t){Oa.call(this,null,t)}pt(u$,Oa,{transform(t,n){const e=s$[t.method]||s$.parity,r=t.separation||0;let i,o,a=n.materialize(n.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(d$(a),n=h$(n,t)),n;if(a=a.filter(f$),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=d$(a),n=h$(n,t),i.length>=3&&l$(i,r)){do{i=e(i,r)}while(i.length>=3&&l$(i,r));i.length<3&&!_(a).opacity&&(i.length>1&&(_(i).opacity=0),_(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,n,e)=>{var r=t.range(),i=new Rv;return n===Cx||n===zx?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(e||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),n}}),pt(m$,Oa,{transform(t,n){const e=n.dataflow;if(n.visit(n.ALL,(t=>e.dirty(t))),n.fields&&n.fields.zindex){const t=n.source&&n.source[0];t&&(t.mark.zdirty=!0)}}});const p$=new Rv;function g$(t,n,e){return t[n]===e?0:(t[n]=e,1)}function v$(t){var n=t.items[0].orient;return n===Ox||n===_x}function y$(t,n,e,r){var i,o,a=n.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,c=a.orient,l=function(t){let n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(u),f=a.range,d=a.offset,h=a.position,m=a.minExtent,p=a.maxExtent,g=u.title&&a.items[l[2]].items[0],v=a.titlePadding,y=a.bounds,b=g&&Ab(g),w=0,x=0;switch(p$.clear().union(y),y.clear(),(i=l[0])>-1&&y.union(a.items[i].bounds),(i=l[1])>-1&&y.union(a.items[i].bounds),c){case Cx:w=h||0,x=-d,o=Math.max(m,Math.min(p,-y.y1)),y.add(0,-o).add(f,0),g&&b$(t,g,o,v,b,0,-1,y);break;case Ox:w=-d,x=h||0,o=Math.max(m,Math.min(p,-y.x1)),y.add(-o,0).add(0,f),g&&b$(t,g,o,v,b,1,-1,y);break;case _x:w=e+d,x=h||0,o=Math.max(m,Math.min(p,y.x2)),y.add(0,0).add(o,f),g&&b$(t,g,o,v,b,1,1,y);break;case zx:w=h||0,x=r+d,o=Math.max(m,Math.min(p,y.y2)),y.add(0,0).add(f,o),g&&b$(t,g,o,v,0,0,1,y);break;default:w=a.x,x=a.y}return Hv(y.translate(w,x),a),g$(a,"x",w+s)|g$(a,"y",x+s)&&(a.bounds=p$,t.dirty(a),a.bounds=y,t.dirty(a)),a.mark.bounds.clear().union(y)}function b$(t,n,e,r,i,o,a,u){const s=n.bounds;if(n.auto){const u=a*(e+i+r);let c=0,l=0;t.dirty(n),o?c=(n.x||0)-(n.x=u):l=(n.y||0)-(n.y=u),n.mark.bounds.clear().union(s.translate(-c,-l)),t.dirty(n)}u.union(s)}const w$=(t,n)=>Math.floor(Math.min(t,n)),x$=(t,n)=>Math.ceil(Math.max(t,n));function $$(t){return(new Rv).set(0,0,t.width||0,t.height||0)}function k$(t){const n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function M$(t,n,e){const r=F(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function A$(t){return t<0?Math.ceil(-t):0}function D$(t,n,e){var r,i,o,a,u,s,c,l,f,d,h,m=!e.nodirty,p=e.bounds===Zx?$$:k$,g=p$.set(0,0,0,0),v=M$(e.align,t$),y=M$(e.align,n$),b=M$(e.padding,t$),w=M$(e.padding,n$),x=e.columns||n.length,$=x<=0?1:Math.ceil(n.length/x),k=n.length,M=Array(k),A=Array(x),D=0,S=Array(k),F=Array($),E=0,N=Array(k),C=Array(k),O=Array(k);for(i=0;i<x;++i)A[i]=0;for(i=0;i<$;++i)F[i]=0;for(i=0;i<k;++i)u=O[i]=p(s=n[i]),s.x=s.x||0,N[i]=0,s.y=s.y||0,C[i]=0,o=i%x,a=~~(i/x),D=Math.max(D,c=Math.ceil(u.x2)),E=Math.max(E,l=Math.ceil(u.y2)),A[o]=Math.max(A[o],c),F[a]=Math.max(F[a],l),M[i]=b+A$(u.x1),S[i]=w+A$(u.y1),m&&t.dirty(n[i]);for(i=0;i<k;++i)i%x==0&&(M[i]=0),i<x&&(S[i]=0);if(v===Qx)for(o=1;o<x;++o){for(h=0,i=o;i<k;i+=x)h<M[i]&&(h=M[i]);for(i=o;i<k;i+=x)M[i]=h+A[o-1]}else if(v===Kx){for(h=0,i=0;i<k;++i)i%x&&h<M[i]&&(h=M[i]);for(i=0;i<k;++i)i%x&&(M[i]=h+D)}else for(v=!1,o=1;o<x;++o)for(i=o;i<k;i+=x)M[i]+=A[o-1];if(y===Qx)for(a=1;a<$;++a){for(h=0,r=(i=a*x)+x;i<r;++i)h<S[i]&&(h=S[i]);for(i=a*x;i<r;++i)S[i]=h+F[a-1]}else if(y===Kx){for(h=0,i=x;i<k;++i)h<S[i]&&(h=S[i]);for(i=x;i<k;++i)S[i]=h+E}else for(y=!1,a=1;a<$;++a)for(r=(i=a*x)+x;i<r;++i)S[i]+=F[a-1];for(f=0,i=0;i<k;++i)N[i]+=(f=M[i]+(i%x?f:0))-n[i].x;for(o=0;o<x;++o)for(d=0,i=o;i<k;i+=x)C[i]+=(d+=S[i])-n[i].y;if(v&&M$(e.center,t$)&&$>1)for(i=0;i<k;++i)(f=(u=v===Kx?D:A[i%x])-O[i].x2-n[i].x-N[i])>0&&(N[i]+=f/2);if(y&&M$(e.center,n$)&&1!==x)for(i=0;i<k;++i)(d=(u=y===Kx?E:F[~~(i/x)])-O[i].y2-n[i].y-C[i])>0&&(C[i]+=d/2);for(i=0;i<k;++i)g.union(O[i].translate(N[i],C[i]));switch(f=M$(e.anchor,"x"),d=M$(e.anchor,"y"),M$(e.anchor,t$)){case Px:f-=g.width();break;case Tx:f-=g.width()/2}switch(M$(e.anchor,n$)){case Px:d-=g.height();break;case Tx:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),i=0;i<k;++i)n[i].mark.bounds.clear();for(i=0;i<k;++i)(s=n[i]).x+=N[i]+=f,s.y+=C[i]+=d,g.union(s.mark.bounds.union(s.bounds.translate(N[i],C[i]))),m&&t.dirty(s);return g}function S$(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function F$(t,n){return t.bounds[n]}function E$(t,n,e,r,i,o,a,u,s,c,l,f,d,h){var m,p,g,v,y,b,w,x,$,k=e.length,M=0,A=0;if(!k)return M;for(m=l;m<k;m+=f)e[m]&&(M=a(M,s(e[m],c)));if(!n.length)return M;for(n.length>i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),M+=o,p=0,v=n.length;p<v;++p)t.dirty(n[p]),n[p].mark.bounds.clear();for(m=l,p=0,v=n.length;p<v;++p,m+=f){for(y=(b=n[p]).mark.bounds,g=m;g>=0&&null==(w=e[g]);g-=d);u?(x=null==h?w.x:Math.round(w.bounds.x1+h*w.bounds.width()),$=M):(x=M,$=null==h?w.y:Math.round(w.bounds.y1+h*w.bounds.height())),y.union(b.bounds.translate(x-(b.x||0),$-(b.y||0))),b.x=x,b.y=$,t.dirty(b),A=a(A,y[c])}return A}function N$(t,n,e,r,i,o){if(n){t.dirty(n);var a=e,u=e;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),n.bounds.translate(a-(n.x||0),u-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=a,n.y=u,t.dirty(n)}}function C$(t,n,e,r,i,o,a){const u=function(t,n){const e=t[n]||{};return(n,r)=>null!=e[n]?e[n]:null!=t[n]?t[n]:r}(e,n),s=function(t,n){let e=-1/0;return t.forEach((t=>{null!=t.offset&&(e=Math.max(e,t.offset))})),e>-1/0?e:n}(t,u("offset",0)),c=u("anchor",Bx),l=c===Px?1:c===Tx?.5:0,f={align:Qx,bounds:u("bounds",Zx),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(n){case Ox:f.anchor={x:Math.floor(r.x1)-s,column:Px,y:l*(a||r.height()+2*r.y1),row:c};break;case _x:f.anchor={x:Math.ceil(r.x2)+s,y:l*(a||r.height()+2*r.y1),row:c};break;case Cx:f.anchor={y:Math.floor(i.y1)-s,row:Px,x:l*(o||i.width()+2*i.x1),column:c};break;case zx:f.anchor={y:Math.ceil(i.y2)+s,x:l*(o||i.width()+2*i.x1),column:c};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:o-s,y:s,column:Px};break;case"bottom-left":f.anchor={x:s,y:a-s,row:Px};break;case"bottom-right":f.anchor={x:o-s,y:a-s,column:Px,row:Px}}return f}function O$(t,n){var e,r,i=n.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,c=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,n,e){var r=n.padding,i=r-e.x,o=r-e.y;if(n.datum.title){var a=n.items[1].items[0],u=a.anchor,s=n.titlePadding||0,c=r-a.x,l=r-a.y;switch(a.orient){case Ox:i+=Math.ceil(a.bounds.width())+s;break;case _x:case zx:break;default:o+=a.bounds.height()+s}switch((i||o)&&z$(t,e,i,o),a.orient){case Ox:l+=_$(n,e,a,u,1,1);break;case _x:c+=_$(n,e,a,Px,0,0)+s,l+=_$(n,e,a,u,1,1);break;case zx:c+=_$(n,e,a,u,0,0),l+=_$(n,e,a,Px,-1,0,1)+s;break;default:c+=_$(n,e,a,u,0,0)}(c||l)&&z$(t,a,c,l),(c=Math.round(a.bounds.x1-r))<0&&(z$(t,e,-c,0),z$(t,a,-c,0))}else(i||o)&&z$(t,e,i,o)}(t,i,i.items[0].items[0]),u=function(t,n){return t.items.forEach((t=>n.union(t.bounds))),n.x1=t.padding,n.y1=t.padding,n}(i,u),e=2*i.padding,r=2*i.padding,u.empty()||(e=Math.ceil(u.width()+e),r=Math.ceil(u.height()+r)),"symbol"===o.type&&function(t){const n=t.reduce(((t,n)=>(t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t)),{});t.forEach((t=>{t.width=n[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==Jx&&(i.x=s=0,i.y=c=0),i.width=e,i.height=r,Hv(u.set(s,c,s+e,c+r),i),i.mark.bounds.clear().union(u),i}function _$(t,n,e,r,i,o,a){const u=e.datum.vgrad,s=("symbol"===t.datum.type||!o&&u||a?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&o?s:0,l=u&&o?0:s,f=i<=0?0:Ab(e);return Math.round(r===Bx?c:r===Px?l-f:.5*(s-f))}function z$(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function B$(t){Oa.call(this,null,t)}pt(B$,Oa,{transform(t,n){const e=n.dataflow;return t.mark.items.forEach((n=>{t.layout&&function(t,n,e){var r,i,o,a,u,s,c,l=function(t){var n,e,r=t.items,i=r.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<i;++o)if(e=(n=r[o]).items,n.marktype===jx)switch(n.role){case Rx:case Ix:case Lx:break;case qx:a.rowheaders.push(...e);break;case Ux:a.rowfooters.push(...e);break;case Hx:a.colheaders.push(...e);break;case Gx:a.colfooters.push(...e);break;case Wx:a.rowtitle=e[0];break;case Yx:a.coltitle=e[0];break;default:a.marks.push(...e)}return a}(n),f=l.marks,d=e.bounds===Zx?S$:F$,h=e.offset,m=e.columns||f.length,p=m<=0?1:Math.ceil(f.length/m),g=p*m;const v=D$(t,f,e);v.empty()&&v.set(0,0,0,0),l.rowheaders&&(s=M$(e.headerBand,n$,null),r=E$(t,l.rowheaders,f,0,p,-M$(h,"rowHeader"),w$,0,d,"x1",0,m,1,s)),l.colheaders&&(s=M$(e.headerBand,t$,null),i=E$(t,l.colheaders,f,0,m,-M$(h,"columnHeader"),w$,1,d,"y1",0,1,m,s)),l.rowfooters&&(s=M$(e.footerBand,n$,null),o=E$(t,l.rowfooters,f,0,p,M$(h,"rowFooter"),x$,0,d,"x2",m-1,m,1,s)),l.colfooters&&(s=M$(e.footerBand,t$,null),a=E$(t,l.colfooters,f,0,m,M$(h,"columnFooter"),x$,1,d,"y2",g-m,1,m,s)),l.rowtitle&&(u=M$(e.titleAnchor,n$),c=M$(h,"rowTitle"),c=u===Px?o+c:r-c,s=M$(e.titleBand,n$,.5),N$(t,l.rowtitle,c,0,v,s)),l.coltitle&&(u=M$(e.titleAnchor,t$),c=M$(h,"columnTitle"),c=u===Px?a+c:i-c,s=M$(e.titleBand,t$,.5),N$(t,l.coltitle,c,1,v,s))}(e,n,t.layout),function(t,n,e){var r,i,o,a,u,s=n.items,c=Math.max(0,n.width||0),l=Math.max(0,n.height||0),f=(new Rv).set(0,0,c,l),d=f.clone(),h=f.clone(),m=[];for(a=0,u=s.length;a<u;++a)switch((i=s[a]).role){case Rx:(v$(i)?d:h).union(y$(t,i,c,l));break;case Lx:r=i;break;case Ix:m.push(O$(t,i));break;case"frame":case"scope":case qx:case Ux:case Wx:case Hx:case Gx:case Yx:d.union(i.bounds),h.union(i.bounds);break;default:f.union(i.bounds)}if(m.length){const n={};m.forEach((t=>{(o=t.orient||_x)!==Jx&&(n[o]||(n[o]=[])).push(t)}));for(const r in n){const i=n[r];D$(t,i,C$(i,r,e.legends,d,h,c,l))}m.forEach((n=>{const r=n.bounds;if(r.equals(n._bounds)||(n.bounds=n._bounds,t.dirty(n),n.bounds=r,t.dirty(n)),!e.autosize||"fit"!==e.autosize.type&&e.autosize.type!==Vx&&e.autosize.type!==Xx)f.union(r);else switch(n.orient){case Ox:case _x:f.add(r.x1,0).add(r.x2,0);break;case Cx:case zx:f.add(0,r.y1).add(0,r.y2)}}))}f.union(d).union(h),r&&f.union(function(t,n,e,r,i){var o,a=n.items[0],u=a.orient,s=a.anchor,c=a.offset,l=a.padding,f=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],h=u===Ox||u===_x?r:e,m=0,p=0,g=0,v=0,y=0;if(a.frame!==jx?u===Ox?(m=i.y2,h=i.y1):u===_x?(m=i.y1,h=i.y2):(m=i.x1,h=i.x2):u===Ox&&(m=r,h=0),o=s===Bx?m:s===Px?h:(m+h)/2,d&&d.text){switch(u){case Cx:case zx:y=f.bounds.height()+l;break;case Ox:v=f.bounds.width()+l;break;case _x:v=-f.bounds.width()-l}p$.clear().union(d.bounds),p$.translate(v-(d.x||0),y-(d.y||0)),g$(d,"x",v)|g$(d,"y",y)&&(t.dirty(d),d.bounds.clear().union(p$),d.mark.bounds.clear().union(p$),t.dirty(d)),p$.clear().union(d.bounds)}else p$.clear();switch(p$.union(f.bounds),u){case Cx:p=o,g=i.y1-p$.height()-c;break;case Ox:p=i.x1-p$.width()-c,g=o;break;case _x:p=i.x2+p$.width()+c,g=o;break;case zx:p=o,g=i.y2+c;break;default:p=a.x,g=a.y}return g$(a,"x",p)|g$(a,"y",g)&&(p$.translate(p,g),t.dirty(a),a.bounds.clear().union(p$),n.bounds.clear().union(p$),t.dirty(a)),a.bounds}(t,r,c,l,f)),n.clip&&f.set(0,0,n.width||0,n.height||0),function(t,n,e,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,n.width||0),c=Math.max(0,Math.ceil(-e.x1)),l=Math.max(0,n.height||0),f=Math.max(0,Math.ceil(-e.y1));const d=Math.max(0,Math.ceil(e.x2-s)),h=Math.max(0,Math.ceil(e.y2-l));if("padding"===i.contains){const n=t.padding();a-=n.left+n.right,u-=n.top+n.bottom}o===Jx?(c=0,f=0,s=a,l=u):"fit"===o?(s=Math.max(0,a-c-d),l=Math.max(0,u-f-h)):o===Vx?(s=Math.max(0,a-c-d),u=l+f+h):o===Xx?(a=s+c+d,l=Math.max(0,u-f-h)):"pad"===o&&(a=s+c+d,u=l+f+h),t._resizeView(a,u,s,l,[c,f],i.resize)}(t,n,f,e)}(e,n,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?n.reflow():n}});var T$=Object.freeze({__proto__:null,bound:e$,identifier:o$,mark:a$,overlap:u$,render:m$,viewlayout:B$});function P$(t){Oa.call(this,null,t)}function j$(t){Oa.call(this,null,t)}function R$(){return ea({})}function L$(t){Oa.call(this,null,t)}function I$(t){Oa.call(this,[],t)}pt(P$,Oa,{transform(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.dataflow.locale(),r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=this.value,o=t.scale,a=Mg(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Sg(e,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Ag(o,t.values,a):Dg(o,a);return i&&(r.rem=i),i=s.map(((t,n)=>ea({index:n/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(ea({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),pt(j$,Oa,{transform(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.item||R$,o=t.key||ta,a=this.value;return S(r.encode)&&(r.encode=null),a&&(t.modified("key")||n.modified(o))&&p("DataJoin does not support modified key function or fields."),a||(n=n.addAll(),this.value=a=function(t){const n=ht().test((t=>t.exit));return n.lookup=e=>n.get(t(e)),n}(o)),n.visit(n.ADD,(t=>{const n=o(t);let e=a.get(n);e?e.exit?(a.empty--,r.add.push(e)):r.mod.push(e):(e=i(t),a.set(n,e),r.add.push(e)),e.datum=t,e.exit=!1})),n.visit(n.MOD,(t=>{const n=o(t),e=a.get(n);e&&(e.datum=t,r.mod.push(e))})),n.visit(n.REM,(t=>{const n=o(t),e=a.get(n);t!==e.datum||e.exit||(r.rem.push(e),e.exit=!0,++a.empty)})),n.changed(n.ADD_MOD)&&r.modifies("datum"),(n.clean()||t.clean&&a.empty>e.cleanThreshold)&&e.runAfter(a.clean),r}}),pt(L$,Oa,{transform(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,o=n.encode;if(S(o)){if(!e.changed()&&!o.every((t=>i[t])))return n.StopPropagation;o=o[0],e.encode=null}var a="enter"===o,u=i.update||k,s=i.enter||k,c=i.exit||k,l=(o&&!a?i[o]:u)||k;if(n.changed(n.ADD)&&(n.visit(n.ADD,(n=>{s(n,t),u(n,t)})),e.modifies(s.output),e.modifies(u.output),l!==k&&l!==u&&(n.visit(n.ADD,(n=>{l(n,t)})),e.modifies(l.output))),n.changed(n.REM)&&c!==k&&(n.visit(n.REM,(n=>{c(n,t)})),e.modifies(c.output)),a||l!==k){const i=n.MOD|(t.modified()?n.REFLOW:0);a?(n.visit(i,(n=>{const i=s(n,t)||r;(l(n,t)||i)&&e.mod.push(n)})),e.mod.length&&e.modifies(s.output)):n.visit(i,(n=>{(l(n,t)||r)&&e.mod.push(n)})),e.mod.length&&e.modifies(l.output)}return e.changed()?e:n.StopPropagation}}),pt(I$,Oa,{transform(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,o,a,u=n.dataflow.locale(),s=n.fork(n.NO_SOURCE|n.NO_FIELDS),c=this.value,l=t.type||wg,f=t.scale,d=+t.limit,h=Mg(f,null==t.count?5:t.count,t.minstep),m=t.format||Og(u,f,h,l,t.formatSpecifier,t.formatType,!!t.values||l===wg),p=t.values||Cg(f,h);return c&&(s.rem=c),l===wg?(d&&p.length>d?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),c=p.slice(0,d-1),a=!0):c=p,tt(i=t.size)?(t.values||0!==f(c[0])||(c=c.slice(1)),o=c.reduce(((n,e)=>Math.max(n,i(e,t))),0)):i=at(o=i||8),c=c.map(((n,e)=>ea({index:e,label:m(n,e,c),value:n,offset:o,size:i(n,t)}))),a&&c.push(ea({index:c.length,label:`…${p.length-c.length} entries`,value:a=p[c.length],offset:o,size:i(a,t)}))):"gradient"===l?(e=f.domain(),r=mg(f,e[0],_(e)),p.length<3&&!t.values&&e[0]!==_(e)&&(p=[e[0],_(e)]),c=p.map(((t,n)=>ea({index:n,label:m(t,n,p),value:t,perc:r(t)})))):(i=p.length-1,r=function(t){const n=t.domain(),e=n.length-1;let r=+n[0],i=+_(n),o=i-r;if(t.type===Pp){const t=e?o/e:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),c=p.map(((t,n)=>ea({index:n,label:m(t,n,p),value:t,perc:n?r(t):0,perc2:n===i?1:r(p[n+1])})))),s.source=c,s.add=c,this.value=c,s}});const q$=t=>t.source.x,U$=t=>t.source.y,W$=t=>t.target.x,H$=t=>t.target.y;function G$(t){Oa.call(this,{},t)}G$.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"}]},pt(G$,Oa,{transform(t,n){var e=t.sourceX||q$,r=t.sourceY||U$,i=t.targetX||W$,o=t.targetY||H$,a=t.as||"path",u=t.shape||"line",s=J$.get(u+"-"+(t.orient||"vertical"))||J$.get(u);return s||p("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,(t=>{t[a]=s(e(t),r(t),i(t),o(t))})),n.reflow(t.modified()).modifies(a)}});const Y$=(t,n,e,r)=>"M"+t+","+n+"L"+e+","+r,V$=(t,n,e,r)=>{var i=e-t,o=r-n,a=Math.hypot(i,o)/2;return"M"+t+","+n+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+e+","+r},X$=(t,n,e,r)=>{const i=e-t,o=r-n,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+n+"C"+(t+a)+","+(n+u)+" "+(e+u)+","+(r-a)+" "+e+","+r},J$=ht({line:Y$,"line-radial":(t,n,e,r)=>Y$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),arc:V$,"arc-radial":(t,n,e,r)=>V$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),curve:X$,"curve-radial":(t,n,e,r)=>X$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),"orthogonal-horizontal":(t,n,e,r)=>"M"+t+","+n+"V"+r+"H"+e,"orthogonal-vertical":(t,n,e,r)=>"M"+t+","+n+"H"+e+"V"+r,"orthogonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e);return"M"+n*i+","+n*o+"A"+n+","+n+" 0 0,"+((Math.abs(e-t)>Math.PI?e<=t:e>t)?1:0)+" "+n*a+","+n*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,n,e,r)=>{const i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":(t,n,e,r)=>{const i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function K$(t){Oa.call(this,null,t)}function Q$(t){return ig(t)&&t!==_p}K$.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"]}]},pt(K$,Oa,{transform(t,n){var e,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,l=n.source,f=l.map(t.field||x),d=f.length,h=s,m=(c-s)/Nn(f),p=En(d);for(t.sort&&p.sort(((t,n)=>f[t]-f[n])),e=0;e<d;++e)i=f[p[e]],(r=l[p[e]])[a]=h,r[u]=h+=i*m;return this.value=f,n.reflow(t.modified()).modifies(o)}});const Z$=Bt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function tk(t){Oa.call(this,null,t),this.modified(!0)}function nk(t,n,e){return ug(t)&&Math.abs(n.reduce(((t,n)=>t+(n<0?-1:n>0?1:0)),0))!==n.length&&e.warn("Log scale domain includes zero: "+Nt(n)),n}function ek(t,n,e){return tt(t)&&(n||e)?fg(t,rk(n||[0,1],e)):t}function rk(t,n){return n?t.slice().reverse():t}function ik(t){Oa.call(this,null,t)}pt(tk,Oa,{transform(t,n){var e=n.dataflow,r=this.value,i=function(t){var n,e=t.type,r="";return e===_p?_p+"-"+Dp:(function(t){const n=t.type;return ig(n)&&n!==Cp&&n!==Op&&(t.scheme||t.range&&t.range.length&&t.range.every($t))}(t)&&(r=2===(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?_p+"-":3===n?zp+"-":""),(r+e||Dp).toLowerCase())}(t);for(i in r&&i===r.type||(this.value=r=ng(i)()),t)if(!Z$[i]){if("padding"===i&&Q$(r.type))continue;tt(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(t,n,e){var r=t.type,i=n.round||!1,o=n.range;if(null!=n.rangeStep)o=function(t,n,e){return t!==Lp&&t!==Rp&&p("Only band and point scales support rangeStep."),[0,n.rangeStep*Ap(e,t===Rp?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0,(null!=n.paddingOuter?n.paddingOuter:n.padding)||0)]}(r,n,e);else if(n.scheme&&(o=function(t,n,e){var r,i=n.schemeExtent;return S(n.scheme)?r=dg(n.scheme,n.interpolate,n.interpolateGamma):(r=bg(n.scheme.toLowerCase()))||p(`Unrecognized scheme name: ${n.scheme}`),e=t===Pp?e+1:t===Ip?e-1:t===Bp||t===Tp?+n.schemeCount||5:e,sg(t)?ek(r,i,n.reverse):tt(r)?hg(ek(r,i),e):t===jp?r:r.slice(0,e)}(r,n,e),tt(o))){if(t.interpolator)return t.interpolator(o);p(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&sg(r))return t.interpolator(dg(rk(o,n.reverse),n.interpolate,n.interpolateGamma));o&&n.interpolate&&t.interpolate?t.interpolate(pg(n.interpolate,n.interpolateGamma)):tt(t.round)?t.round(i):tt(t.rangeRound)&&t.interpolate(i?Kf:Jf),o&&t.range(rk(o,n.reverse))}(r,t,function(t,n,e){let r=n.bins;if(r&&!S(r)){const n=t.domain(),e=n[0],i=_(n),o=r.step;let a=null==r.start?e:r.start,u=null==r.stop?i:r.stop;o||p("Scale bins parameter missing step property."),a<e&&(a=o*Math.ceil(e/o)),u>i&&(u=o*Math.floor(i/o)),r=En(a,u+o/2,o)}return r?t.bins=r:t.bins&&delete t.bins,t.type===Ip&&(r?n.domain||n.domainRaw||(t.domain(r),e=r.length):t.bins=t.domain()),e}(r,t,function(t,n,e){const r=function(t,n,e){return n?(t.domain(nk(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,o,a=n.domain,u=t.type,s=n.zero||void 0===n.zero&&function(t){const n=t.type;return!t.bins&&(n===Dp||n===Fp||n===Ep)}(t);if(!a)return 0;if((s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=n.domainMin&&(a[0]=n.domainMin),null!=n.domainMax&&(a[i]=n.domainMax),null!=n.domainMid)){const t=(o=n.domainMid)>a[i]?i+1:o<a[0]?0:i;t!==i&&e.warn("Scale domainMid exceeds domain min or max.",o),a.splice(t,0,o)}return Q$(u)&&n.padding&&a[0]!==_(a)&&(a=function(t,n,e,r,i,o){var a=Math.abs(_(e)-e[0]),u=a/(a-2*r),s=t===Sp?Y(n,null,u):t===Ep?V(n,null,u,.5):t===Fp?V(n,null,u,i||1):t===Np?X(n,null,u,o||1):G(n,null,u);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(u,a,n.range,n.padding,n.exponent,n.constant)),t.domain(nk(u,a,e)),u===jp&&t.unknown(n.domainImplicit?vl:void 0),n.nice&&t.nice&&t.nice(!0!==n.nice&&Mg(t,n.nice)||null),a.length}(r,t,e))),n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),pt(ik,Oa,{transform(t,n){const e=t.modified("sort")||n.changed(n.ADD)||n.modified(t.sort.fields)||n.modified("datum");return e&&n.source.sort(aa(t.sort)),this.modified(e),n}});const ok="zero",ak="center",uk="normalize",sk=["y0","y1"];function ck(t){Oa.call(this,null,t)}function lk(t,n,e,r,i){for(var o,a=(n-t.sum)/2,u=t.length,s=0;s<u;++s)(o=t[s])[r]=a,o[i]=a+=Math.abs(e(o))}function fk(t,n,e,r,i){for(var o,a=1/t.sum,u=0,s=t.length,c=0,l=0;c<s;++c)(o=t[c])[r]=u,o[i]=u=a*(l+=Math.abs(e(o)))}function dk(t,n,e,r,i){for(var o,a,u=0,s=0,c=t.length,l=0;l<c;++l)(o=+e(a=t[l]))<0?(a[r]=s,a[i]=s+=o):(a[r]=u,a[i]=u+=o)}ck.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:ok,values:[ok,ak,uk]},{name:"as",type:"string",array:!0,length:2,default:sk}]},pt(ck,Oa,{transform(t,n){var e,r,i,o,a=t.as||sk,u=a[0],s=a[1],c=aa(t.sort),l=t.field||x,f=t.offset===ak?lk:t.offset===uk?fk:dk;for(e=function(t,n,e,r){var i,o,a,u,s,c,l,f,d,h=[],m=t=>t(s);if(null==n)h.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)s=t[o],(l=i[c=n.map(m)])||(i[c]=l=[],h.push(l)),l.push(s);for(c=0,d=0,u=h.length;c<u;++c){for(o=0,f=0,a=(l=h[c]).length;o<a;++o)f+=Math.abs(r(l[o]));l.sum=f,f>d&&(d=f),e&&l.sort(e)}return h.max=d,h}(n.source,t.groupby,c,l),r=0,i=e.length,o=e.max;r<i;++r)f(e[r],o,l,u,s);return n.reflow(t.modified()).modifies(a)}});var hk=Object.freeze({__proto__:null,axisticks:P$,datajoin:j$,encode:L$,legendentries:I$,linkpath:G$,pie:K$,scale:tk,sortitems:ik,stack:ck}),mk=1e-6,pk=1e-12,gk=Math.PI,vk=gk/2,yk=gk/4,bk=2*gk,wk=180/gk,xk=gk/180,$k=Math.abs,kk=Math.atan,Mk=Math.atan2,Ak=Math.cos,Dk=Math.ceil,Sk=Math.exp,Fk=Math.hypot,Ek=Math.log,Nk=Math.pow,Ck=Math.sin,Ok=Math.sign||function(t){return t>0?1:t<0?-1:0},_k=Math.sqrt,zk=Math.tan;function Bk(t){return t>1?0:t<-1?gk:Math.acos(t)}function Tk(t){return t>1?vk:t<-1?-vk:Math.asin(t)}function Pk(){}function jk(t,n){t&&Lk.hasOwnProperty(t.type)&&Lk[t.type](t,n)}var Rk={Feature:function(t,n){jk(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)jk(e[r].geometry,n)}},Lk={Sphere:function(t,n){n.sphere()},Point:function(t,n){n.point((t=t.coordinates)[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)n.point((t=e[r])[0],t[1],t[2])},LineString:function(t,n){Ik(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Ik(e[r],n,0)},Polygon:function(t,n){qk(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)qk(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)jk(e[r],n)}};function Ik(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)n.point((r=t[i])[0],r[1],r[2]);n.lineEnd()}function qk(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)Ik(t[e],n,1);n.polygonEnd()}function Uk(t,n){t&&Rk.hasOwnProperty(t.type)?Rk[t.type](t,n):jk(t,n)}var Wk,Hk,Gk,Yk,Vk,Xk,Jk,Kk,Qk,Zk,tM,nM,eM,rM,iM,oM,aM=new an,uM=new an,sM={point:Pk,lineStart:Pk,lineEnd:Pk,polygonStart:function(){aM=new an,sM.lineStart=cM,sM.lineEnd=lM},polygonEnd:function(){var t=+aM;uM.add(t<0?bk+t:t),this.lineStart=this.lineEnd=this.point=Pk},sphere:function(){uM.add(bk)}};function cM(){sM.point=fM}function lM(){dM(Wk,Hk)}function fM(t,n){sM.point=dM,Wk=t,Hk=n,Gk=t*=xk,Yk=Ak(n=(n*=xk)/2+yk),Vk=Ck(n)}function dM(t,n){var e=(t*=xk)-Gk,r=e>=0?1:-1,i=r*e,o=Ak(n=(n*=xk)/2+yk),a=Ck(n),u=Vk*a,s=Yk*o+u*Ak(i),c=u*r*Ck(i);aM.add(Mk(c,s)),Gk=t,Yk=o,Vk=a}function hM(t){return[Mk(t[1],t[0]),Tk(t[2])]}function mM(t){var n=t[0],e=t[1],r=Ak(e);return[r*Ak(n),r*Ck(n),Ck(e)]}function pM(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function gM(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function vM(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function yM(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function bM(t){var n=_k(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var wM,xM,$M,kM,MM,AM,DM,SM,FM,EM,NM,CM,OM,_M,zM,BM,TM={point:PM,lineStart:RM,lineEnd:LM,polygonStart:function(){TM.point=IM,TM.lineStart=qM,TM.lineEnd=UM,rM=new an,sM.polygonStart()},polygonEnd:function(){sM.polygonEnd(),TM.point=PM,TM.lineStart=RM,TM.lineEnd=LM,aM<0?(Xk=-(Kk=180),Jk=-(Qk=90)):rM>mk?Qk=90:rM<-1e-6&&(Jk=-90),oM[0]=Xk,oM[1]=Kk},sphere:function(){Xk=-(Kk=180),Jk=-(Qk=90)}};function PM(t,n){iM.push(oM=[Xk=t,Kk=t]),n<Jk&&(Jk=n),n>Qk&&(Qk=n)}function jM(t,n){var e=mM([t*xk,n*xk]);if(eM){var r=gM(eM,e),i=gM([r[1],-r[0],0],r);bM(i),i=hM(i);var o,a=t-Zk,u=a>0?1:-1,s=i[0]*wk*u,c=$k(a)>180;c^(u*Zk<s&&s<u*t)?(o=i[1]*wk)>Qk&&(Qk=o):c^(u*Zk<(s=(s+360)%360-180)&&s<u*t)?(o=-i[1]*wk)<Jk&&(Jk=o):(n<Jk&&(Jk=n),n>Qk&&(Qk=n)),c?t<Zk?WM(Xk,t)>WM(Xk,Kk)&&(Kk=t):WM(t,Kk)>WM(Xk,Kk)&&(Xk=t):Kk>=Xk?(t<Xk&&(Xk=t),t>Kk&&(Kk=t)):t>Zk?WM(Xk,t)>WM(Xk,Kk)&&(Kk=t):WM(t,Kk)>WM(Xk,Kk)&&(Xk=t)}else iM.push(oM=[Xk=t,Kk=t]);n<Jk&&(Jk=n),n>Qk&&(Qk=n),eM=e,Zk=t}function RM(){TM.point=jM}function LM(){oM[0]=Xk,oM[1]=Kk,TM.point=PM,eM=null}function IM(t,n){if(eM){var e=t-Zk;rM.add($k(e)>180?e+(e>0?360:-360):e)}else tM=t,nM=n;sM.point(t,n),jM(t,n)}function qM(){sM.lineStart()}function UM(){IM(tM,nM),sM.lineEnd(),$k(rM)>mk&&(Xk=-(Kk=180)),oM[0]=Xk,oM[1]=Kk,eM=null}function WM(t,n){return(n-=t)<0?n+360:n}function HM(t,n){return t[0]-n[0]}function GM(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var YM={sphere:Pk,point:VM,lineStart:JM,lineEnd:ZM,polygonStart:function(){YM.lineStart=tA,YM.lineEnd=nA},polygonEnd:function(){YM.lineStart=JM,YM.lineEnd=ZM}};function VM(t,n){t*=xk;var e=Ak(n*=xk);XM(e*Ak(t),e*Ck(t),Ck(n))}function XM(t,n,e){++wM,$M+=(t-$M)/wM,kM+=(n-kM)/wM,MM+=(e-MM)/wM}function JM(){YM.point=KM}function KM(t,n){t*=xk;var e=Ak(n*=xk);_M=e*Ak(t),zM=e*Ck(t),BM=Ck(n),YM.point=QM,XM(_M,zM,BM)}function QM(t,n){t*=xk;var e=Ak(n*=xk),r=e*Ak(t),i=e*Ck(t),o=Ck(n),a=Mk(_k((a=zM*o-BM*i)*a+(a=BM*r-_M*o)*a+(a=_M*i-zM*r)*a),_M*r+zM*i+BM*o);xM+=a,AM+=a*(_M+(_M=r)),DM+=a*(zM+(zM=i)),SM+=a*(BM+(BM=o)),XM(_M,zM,BM)}function ZM(){YM.point=VM}function tA(){YM.point=eA}function nA(){rA(CM,OM),YM.point=VM}function eA(t,n){CM=t,OM=n,t*=xk,n*=xk,YM.point=rA;var e=Ak(n);_M=e*Ak(t),zM=e*Ck(t),BM=Ck(n),XM(_M,zM,BM)}function rA(t,n){t*=xk;var e=Ak(n*=xk),r=e*Ak(t),i=e*Ck(t),o=Ck(n),a=zM*o-BM*i,u=BM*r-_M*o,s=_M*i-zM*r,c=Fk(a,u,s),l=Tk(c),f=c&&-l/c;FM.add(f*a),EM.add(f*u),NM.add(f*s),xM+=l,AM+=l*(_M+(_M=r)),DM+=l*(zM+(zM=i)),SM+=l*(BM+(BM=o)),XM(_M,zM,BM)}function iA(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function oA(t,n){return $k(t)>gk&&(t-=Math.round(t/bk)*bk),[t,n]}function aA(t,n,e){return(t%=bk)?n||e?iA(sA(t),cA(n,e)):sA(t):n||e?cA(n,e):oA}function uA(t){return function(n,e){return $k(n+=t)>gk&&(n-=Math.round(n/bk)*bk),[n,e]}}function sA(t){var n=uA(t);return n.invert=uA(-t),n}function cA(t,n){var e=Ak(t),r=Ck(t),i=Ak(n),o=Ck(n);function a(t,n){var a=Ak(n),u=Ak(t)*a,s=Ck(t)*a,c=Ck(n),l=c*e+u*r;return[Mk(s*i-l*o,u*e-c*r),Tk(l*i+s*o)]}return a.invert=function(t,n){var a=Ak(n),u=Ak(t)*a,s=Ck(t)*a,c=Ck(n),l=c*i-s*o;return[Mk(s*i+c*o,u*e+l*r),Tk(l*e-u*r)]},a}function lA(t,n){(n=mM(n))[0]-=t,bM(n);var e=Bk(-n[1]);return((-n[2]<0?-e:e)+bk-mk)%bk}function fA(){var t,n=[];return{point:function(n,e,r){t.push([n,e,r])},lineStart:function(){n.push(t=[])},lineEnd:Pk,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function dA(t,n){return $k(t[0]-n[0])<mk&&$k(t[1]-n[1])<mk}function hA(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function mA(t,n,e,r,i){var o,a,u=[],s=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(dA(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}u.push(e=new hA(r,t,null,!0)),s.push(e.o=new hA(r,null,e,!1)),u.push(e=new hA(a,t,null,!1)),s.push(e.o=new hA(a,null,e,!0))}})),u.length){for(s.sort(n),pA(u),pA(s),o=0,a=s.length;o<a;++o)s[o].e=e=!e;for(var c,l,f=u[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=c.length;o<a;++o)i.point((l=c[o])[0],l[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(o=(c=d.p.z).length-1;o>=0;--o)i.point((l=c[o])[0],l[1]);else r(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}}function pA(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function gA(t){return $k(t[0])<=gk?t[0]:Ok(t[0])*(($k(t[0])+gk)%bk-gk)}function vA(t,n,e,r){return function(i){var o,a,u,s=n(i),c=fA(),l=n(c),f=!1,d={point:h,lineStart:p,lineEnd:g,polygonStart:function(){d.point=v,d.lineStart=y,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=p,d.lineEnd=g,a=Fn(a);var t=function(t,n){var e=gA(n),r=n[1],i=Ck(r),o=[Ck(e),-Ak(e),0],a=0,u=0,s=new an;1===i?r=vk+mk:-1===i&&(r=-vk-mk);for(var c=0,l=t.length;c<l;++c)if(d=(f=t[c]).length)for(var f,d,h=f[d-1],m=gA(h),p=h[1]/2+yk,g=Ck(p),v=Ak(p),y=0;y<d;++y,m=w,g=$,v=k,h=b){var b=f[y],w=gA(b),x=b[1]/2+yk,$=Ck(x),k=Ak(x),M=w-m,A=M>=0?1:-1,D=A*M,S=D>gk,F=g*$;if(s.add(Mk(F*A*Ck(D),v*k+F*Ak(D))),a+=S?M+A*bk:M,S^m>=e^w>=e){var E=gM(mM(h),mM(b));bM(E);var N=gM(o,E);bM(N);var C=(S^M>=0?-1:1)*Tk(N[2]);(r>C||r===C&&(E[0]||E[1]))&&(u+=S^M>=0?1:-1)}}return(a<-1e-6||a<mk&&s<-1e-12)^1&u}(o,r);a.length?(f||(i.polygonStart(),f=!0),mA(a,bA,t,e,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(n,e){t(n,e)&&i.point(n,e)}function m(t,n){s.point(t,n)}function p(){d.point=m,s.lineStart()}function g(){d.point=h,s.lineEnd()}function v(t,n){u.push([t,n]),l.point(t,n)}function y(){l.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),l.lineEnd();var t,n,e,r,s=l.clean(),d=c.result(),h=d.length;if(u.pop(),o.push(u),u=null,h)if(1&s){if((n=(e=d[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else h>1&&2&s&&d.push(d.pop().concat(d.shift())),a.push(d.filter(yA))}return d}}function yA(t){return t.length>1}function bA(t,n){return((t=t.x)[0]<0?t[1]-vk-mk:vk-t[1])-((n=n.x)[0]<0?n[1]-vk-mk:vk-n[1])}oA.invert=oA;var wA=vA((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?gk:-gk,s=$k(o-e);$k(s-gk)<mk?(t.point(e,r=(r+a)/2>0?vk:-vk),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&s>=gk&&($k(e-i)<mk&&(e-=i*mk),$k(o-u)<mk&&(o-=u*mk),r=function(t,n,e,r){var i,o,a=Ck(t-e);return $k(a)>mk?kk((Ck(n)*(o=Ak(r))*Ck(e)-Ck(r)*(i=Ak(n))*Ck(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)r.point(-gk,i=e*vk),r.point(0,i),r.point(gk,i),r.point(gk,0),r.point(gk,-i),r.point(0,-i),r.point(-gk,-i),r.point(-gk,0),r.point(-gk,i);else if($k(t[0]-n[0])>mk){var o=t[0]<n[0]?gk:-gk;r.point(-o,i=e*o/2),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}),[-gk,-vk]);var xA=1e9,$A=-1e9;function kA(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,c){var l=0,f=0;if(null==i||(l=a(i,u))!==(f=a(o,u))||s(i,o)<0^u>0)do{c.point(0===l||3===l?t:e,l>1?r:n)}while((l=(l+u+4)%4)!==f);else c.point(o[0],o[1])}function a(r,i){return $k(r[0]-t)<mk?i>0?0:3:$k(r[0]-e)<mk?i>0?2:1:$k(r[1]-n)<mk?i>0?1:0:i>0?3:2}function u(t,n){return s(t.x,n.x)}function s(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var s,c,l,f,d,h,m,p,g,v,y,b=a,w=fA(),x={point:$,lineStart:function(){x.point=k,c&&c.push(l=[]),v=!0,g=!1,m=p=NaN},lineEnd:function(){s&&(k(f,d),h&&g&&w.rejoin(),s.push(w.result())),x.point=$,g&&b.lineEnd()},polygonStart:function(){b=w,s=[],c=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=c.length;e<i;++e)for(var o,a,u=c[e],s=1,l=u.length,f=u[0],d=f[0],h=f[1];s<l;++s)o=d,a=h,d=(f=u[s])[0],h=f[1],a<=r?h>r&&(d-o)*(r-a)>(h-a)*(t-o)&&++n:h<=r&&(d-o)*(r-a)<(h-a)*(t-o)&&--n;return n}(),e=y&&n,i=(s=Fn(s)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&mA(s,u,n,o,a),a.polygonEnd()),b=a,s=c=l=null}};function $(t,n){i(t,n)&&b.point(t,n)}function k(o,a){var u=i(o,a);if(c&&l.push([o,a]),v)f=o,d=a,h=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var s=[m=Math.max($A,Math.min(xA,m)),p=Math.max($A,Math.min(xA,p))],w=[o=Math.max($A,Math.min(xA,o)),a=Math.max($A,Math.min(xA,a))];!function(t,n,e,r,i,o){var a,u=t[0],s=t[1],c=0,l=1,f=n[0]-u,d=n[1]-s;if(a=e-u,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=i-u,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=r-s,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<l&&(l=a)}else if(d>0){if(a>l)return;a>c&&(c=a)}if(a=o-s,d||!(a<0)){if(a/=d,d<0){if(a>l)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<l&&(l=a)}return c>0&&(t[0]=u+c*f,t[1]=s+c*d),l<1&&(n[0]=u+l*f,n[1]=s+l*d),!0}}}}}(s,w,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),y=!1):(g||(b.lineStart(),b.point(s[0],s[1])),b.point(w[0],w[1]),u||b.lineEnd(),y=!1)}m=o,p=a,g=u}return x}}function MA(t,n,e){var r=En(t,n-mk,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function AA(t,n,e){var r=En(t,n-mk,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}var DA,SA,FA,EA,NA=t=>t,CA=new an,OA=new an,_A={point:Pk,lineStart:Pk,lineEnd:Pk,polygonStart:function(){_A.lineStart=zA,_A.lineEnd=PA},polygonEnd:function(){_A.lineStart=_A.lineEnd=_A.point=Pk,CA.add($k(OA)),OA=new an},result:function(){var t=CA/2;return CA=new an,t}};function zA(){_A.point=BA}function BA(t,n){_A.point=TA,DA=FA=t,SA=EA=n}function TA(t,n){OA.add(EA*t-FA*n),FA=t,EA=n}function PA(){TA(DA,SA)}var jA,RA,LA,IA,qA=1/0,UA=qA,WA=-qA,HA=WA,GA={point:function(t,n){t<qA&&(qA=t),t>WA&&(WA=t),n<UA&&(UA=n),n>HA&&(HA=n)},lineStart:Pk,lineEnd:Pk,polygonStart:Pk,polygonEnd:Pk,result:function(){var t=[[qA,UA],[WA,HA]];return WA=HA=-(UA=qA=1/0),t}},YA=0,VA=0,XA=0,JA=0,KA=0,QA=0,ZA=0,tD=0,nD=0,eD={point:rD,lineStart:iD,lineEnd:uD,polygonStart:function(){eD.lineStart=sD,eD.lineEnd=cD},polygonEnd:function(){eD.point=rD,eD.lineStart=iD,eD.lineEnd=uD},result:function(){var t=nD?[ZA/nD,tD/nD]:QA?[JA/QA,KA/QA]:XA?[YA/XA,VA/XA]:[NaN,NaN];return YA=VA=XA=JA=KA=QA=ZA=tD=nD=0,t}};function rD(t,n){YA+=t,VA+=n,++XA}function iD(){eD.point=oD}function oD(t,n){eD.point=aD,rD(LA=t,IA=n)}function aD(t,n){var e=t-LA,r=n-IA,i=_k(e*e+r*r);JA+=i*(LA+t)/2,KA+=i*(IA+n)/2,QA+=i,rD(LA=t,IA=n)}function uD(){eD.point=rD}function sD(){eD.point=lD}function cD(){fD(jA,RA)}function lD(t,n){eD.point=fD,rD(jA=LA=t,RA=IA=n)}function fD(t,n){var e=t-LA,r=n-IA,i=_k(e*e+r*r);JA+=i*(LA+t)/2,KA+=i*(IA+n)/2,QA+=i,ZA+=(i=IA*t-LA*n)*(LA+t),tD+=i*(IA+n),nD+=3*i,rD(LA=t,IA=n)}function dD(t){this._context=t}dD.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,bk)}},result:Pk};var hD,mD,pD,gD,vD,yD=new an,bD={point:Pk,lineStart:function(){bD.point=wD},lineEnd:function(){hD&&xD(mD,pD),bD.point=Pk},polygonStart:function(){hD=!0},polygonEnd:function(){hD=null},result:function(){var t=+yD;return yD=new an,t}};function wD(t,n){bD.point=xD,mD=gD=t,pD=vD=n}function xD(t,n){yD.add(_k((gD-=t)*gD+(vD-=n)*vD)),gD=t,vD=n}let $D,kD,MD,AD;class DD{constructor(t){this._append=null==t?SD:function(t){const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);if(n>15)return SD;if(n!==$D){const t=10**n;$D=n,kD=function(n){let e=1;this._+=n[0];for(const r=n.length;e<r;++e)this._+=Math.round(arguments[e]*t)/t+n[e]}}return kD}(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,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==MD||this._append!==kD){const t=this._radius,n=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`,MD=t,kD=this._append,AD=this._,this._=n}this._+=AD}}result(){const t=this._;return this._="",t.length?t:null}}function SD(t){let n=1;this._+=t[0];for(const e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function FD(t,n){let e,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Uk(t,e(r))),r.result()}return a.area=function(t){return Uk(t,e(_A)),_A.result()},a.measure=function(t){return Uk(t,e(bD)),bD.result()},a.bounds=function(t){return Uk(t,e(GA)),GA.result()},a.centroid=function(t){return Uk(t,e(eD)),eD.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,NA):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new DD(i)):new dD(n=t),"function"!=typeof o&&r.pointRadius(o),a):n},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 n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return null===n&&(r=new DD(i)),a},a.projection(t).digits(i).context(n)}function ED(t){return function(n){var e=new ND;for(var r in t)e[r]=t[r];return e.stream=n,e}}function ND(){}function CD(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Uk(e,t.stream(GA)),n(GA.result()),null!=r&&t.clipExtent(r),t}function OD(t,n,e){return CD(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])}),e)}function _D(t,n,e){return OD(t,[[0,0],n],e)}function zD(t,n,e){return CD(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])}),e)}function BD(t,n,e){return CD(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])}),e)}ND.prototype={constructor:ND,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var TD=Ak(30*xk);function PD(t,n){return+n?function(t,n){function e(r,i,o,a,u,s,c,l,f,d,h,m,p,g){var v=c-r,y=l-i,b=v*v+y*y;if(b>4*n&&p--){var w=a+d,x=u+h,$=s+m,k=_k(w*w+x*x+$*$),M=Tk($/=k),A=$k($k($)-1)<mk||$k(o-f)<mk?(o+f)/2:Mk(x,w),D=t(A,M),S=D[0],F=D[1],E=S-r,N=F-i,C=y*E-v*N;(C*C/b>n||$k((v*E+y*N)/b-.5)>.3||a*d+u*h+s*m<TD)&&(e(r,i,o,a,u,s,S,F,A,w/=k,x/=k,$,p,g),g.point(S,F),e(S,F,A,w,x,$,c,l,f,d,h,m,p,g))}}return function(n){var r,i,o,a,u,s,c,l,f,d,h,m,p={point:g,lineStart:v,lineEnd:b,polygonStart:function(){n.polygonStart(),p.lineStart=w},polygonEnd:function(){n.polygonEnd(),p.lineStart=v}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function v(){l=NaN,p.point=y,n.lineStart()}function y(r,i){var o=mM([r,i]),a=t(r,i);e(l,f,c,d,h,m,l=a[0],f=a[1],c=r,d=o[0],h=o[1],m=o[2],16,n),n.point(l,f)}function b(){p.point=g,n.lineEnd()}function w(){v(),p.point=x,p.lineEnd=$}function x(t,n){y(r=t,n),i=l,o=f,a=d,u=h,s=m,p.point=y}function $(){e(l,f,c,d,h,m,i,o,r,a,u,s,16,n),p.lineEnd=b,b()}return p}}(t,n):function(t){return ED({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var jD=ED({point:function(t,n){this.stream.point(t*xk,n*xk)}});function RD(t,n,e,r,i,o){if(!o)return function(t,n,e,r,i){function o(o,a){return[n+t*(o*=r),e-t*(a*=i)]}return o.invert=function(o,a){return[(o-n)/t*r,(e-a)/t*i]},o}(t,n,e,r,i);var a=Ak(o),u=Ck(o),s=a*t,c=u*t,l=a/t,f=u/t,d=(u*e-a*n)/t,h=(u*n+a*e)/t;function m(t,o){return[s*(t*=r)-c*(o*=i)+n,e-c*t-s*o]}return m.invert=function(t,n){return[r*(l*t-f*n+d),i*(h-f*t-l*n)]},m}function LD(t){return ID((function(){return t}))()}function ID(t){var n,e,r,i,o,a,u,s,c,l,f=150,d=480,h=250,m=0,p=0,g=0,v=0,y=0,b=0,w=1,x=1,$=null,k=wA,M=null,A=NA,D=.5;function S(t){return s(t[0]*xk,t[1]*xk)}function F(t){return(t=s.invert(t[0],t[1]))&&[t[0]*wk,t[1]*wk]}function E(){var t=RD(f,0,0,w,x,b).apply(null,n(m,p)),r=RD(f,d-t[0],h-t[1],w,x,b);return e=aA(g,v,y),u=iA(n,r),s=iA(e,u),a=PD(u,D),N()}function N(){return c=l=null,S}return S.stream=function(t){return c&&l===t?c:c=jD(function(t){return ED({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(k(a(A(l=t)))))},S.preclip=function(t){return arguments.length?(k=t,$=void 0,N()):k},S.postclip=function(t){return arguments.length?(A=t,M=r=i=o=null,N()):A},S.clipAngle=function(t){return arguments.length?(k=+t?function(t){var n=Ak(t),e=2*xk,r=n>0,i=$k(n)>mk;function o(t,e){return Ak(t)*Ak(e)>n}function a(t,e,r){var i=[1,0,0],o=gM(mM(t),mM(e)),a=pM(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var c=n*a/s,l=-n*u/s,f=gM(i,o),d=yM(i,c);vM(d,yM(o,l));var h=f,m=pM(d,h),p=pM(h,h),g=m*m-p*(pM(d,d)-1);if(!(g<0)){var v=_k(g),y=yM(h,(-m-v)/p);if(vM(y,d),y=hM(y),!r)return y;var b,w=t[0],x=e[0],$=t[1],k=e[1];x<w&&(b=w,w=x,x=b);var M=x-w,A=$k(M-gk)<mk;if(!A&&k<$&&(b=$,$=k,k=b),A||M<mk?A?$+k>0^y[1]<($k(y[0]-w)<mk?$:k):$<=y[1]&&y[1]<=k:M>gk^(w<=y[0]&&y[0]<=x)){var D=yM(h,(-m+v)/p);return vM(D,d),[y,hM(D)]}}}function u(n,e){var i=r?t:gk-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return vA(o,(function(t){var n,e,s,c,l;return{lineStart:function(){c=s=!1,l=1},point:function(f,d){var h,m=[f,d],p=o(f,d),g=r?p?0:u(f,d):p?u(f+(f<0?gk:-gk),d):0;if(!n&&(c=s=p)&&t.lineStart(),p!==s&&(!(h=a(n,m))||dA(n,h)||dA(m,h))&&(m[2]=1),p!==s)l=0,p?(t.lineStart(),h=a(m,n),t.point(h[0],h[1])):(h=a(n,m),t.point(h[0],h[1],2),t.lineEnd()),n=h;else if(i&&n&&r^p){var v;g&e||!(v=a(m,n,!0))||(l=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!p||n&&dA(n,m)||t.point(m[0],m[1]),n=m,s=p,e=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return l|(c&&s)<<1}}}),(function(n,r,i,o){!function(t,n,e,r,i,o){if(e){var a=Ak(n),u=Ck(n),s=r*e;null==i?(i=n+r*bk,o=n-s/2):(i=lA(a,i),o=lA(a,o),(r>0?i<o:i>o)&&(i+=r*bk));for(var c,l=i;r>0?l>o:l<o;l-=s)c=hM([a,-u*Ak(l),-u*Ck(l)]),t.point(c[0],c[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-gk,t-gk])}($=t*xk):($=null,wA),N()):$*wk},S.clipExtent=function(t){return arguments.length?(A=null==t?(M=r=i=o=null,NA):kA(M=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),N()):null==M?null:[[M,r],[i,o]]},S.scale=function(t){return arguments.length?(f=+t,E()):f},S.translate=function(t){return arguments.length?(d=+t[0],h=+t[1],E()):[d,h]},S.center=function(t){return arguments.length?(m=t[0]%360*xk,p=t[1]%360*xk,E()):[m*wk,p*wk]},S.rotate=function(t){return arguments.length?(g=t[0]%360*xk,v=t[1]%360*xk,y=t.length>2?t[2]%360*xk:0,E()):[g*wk,v*wk,y*wk]},S.angle=function(t){return arguments.length?(b=t%360*xk,E()):b*wk},S.reflectX=function(t){return arguments.length?(w=t?-1:1,E()):w<0},S.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},S.precision=function(t){return arguments.length?(a=PD(u,D=t*t),N()):_k(D)},S.fitExtent=function(t,n){return OD(S,t,n)},S.fitSize=function(t,n){return _D(S,t,n)},S.fitWidth=function(t,n){return zD(S,t,n)},S.fitHeight=function(t,n){return BD(S,t,n)},function(){return n=t.apply(this,arguments),S.invert=n.invert&&F,E()}}function qD(t){var n=0,e=gk/3,r=ID(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*xk,e=t[1]*xk):[n*wk,e*wk]},i}function UD(t,n){var e=Ck(t),r=(e+Ck(n))/2;if($k(r)<mk)return function(t){var n=Ak(t);function e(t,e){return[t*n,Ck(e)/n]}return e.invert=function(t,e){return[t/n,Tk(e*n)]},e}(t);var i=1+e*(2*r-e),o=_k(i)/r;function a(t,n){var e=_k(i-2*r*Ck(n))/r;return[e*Ck(t*=r),o-e*Ak(t)]}return a.invert=function(t,n){var e=o-n,a=Mk(t,$k(e))*Ok(e);return e*r<0&&(a-=gk*Ok(t)*Ok(e)),[a/r,Tk((i-(t*t+e*e)*r*r)/(2*r))]},a}function WD(){return qD(UD).scale(155.424).center([0,33.6442])}function HD(){return WD().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function GD(t){return function(n,e){var r=Ak(n),i=Ak(e),o=t(r*i);return o===1/0?[2,0]:[o*i*Ck(n),o*Ck(e)]}}function YD(t){return function(n,e){var r=_k(n*n+e*e),i=t(r),o=Ck(i),a=Ak(i);return[Mk(n*o,r*a),Tk(r&&e*o/r)]}}var VD=GD((function(t){return _k(2/(1+t))}));VD.invert=YD((function(t){return 2*Tk(t/2)}));var XD=GD((function(t){return(t=Bk(t))&&t/Ck(t)}));function JD(t,n){return[t,Ek(zk((vk+n)/2))]}function KD(t){var n,e,r,i=LD(t),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,c=null;function l(){var o=gk*a(),u=i(function(t){function n(n){return(n=t(n[0]*xk,n[1]*xk))[0]*=wk,n[1]*=wk,n}return t=aA(t[0]*xk,t[1]*xk,t.length>2?t[2]*xk:0),n.invert=function(n){return(n=t.invert(n[0]*xk,n[1]*xk))[0]*=wk,n[1]*=wk,n},n}(i.rotate()).invert([0,0]));return s(null==c?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===JD?[[Math.max(u[0]-o,c),n],[Math.min(u[0]+o,e),r]]:[[c,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),l()):a()},i.translate=function(t){return arguments.length?(u(t),l()):u()},i.center=function(t){return arguments.length?(o(t),l()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=n=e=r=null:(c=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),l()):null==c?null:[[c,n],[e,r]]},l()}function QD(t){return zk((vk+t)/2)}function ZD(t,n){var e=Ak(t),r=t===n?Ck(t):Ek(e/Ak(n))/Ek(QD(n)/QD(t)),i=e*Nk(QD(t),r)/r;if(!r)return JD;function o(t,n){i>0?n<-vk+mk&&(n=-vk+mk):n>vk-mk&&(n=vk-mk);var e=i/Nk(QD(n),r);return[e*Ck(r*t),i-e*Ak(r*t)]}return o.invert=function(t,n){var e=i-n,o=Ok(r)*_k(t*t+e*e),a=Mk(t,$k(e))*Ok(e);return e*r<0&&(a-=gk*Ok(t)*Ok(e)),[a/r,2*kk(Nk(i/o,1/r))-vk]},o}function tS(t,n){return[t,n]}function nS(t,n){var e=Ak(t),r=t===n?Ck(t):(e-Ak(n))/(n-t),i=e/r+t;if($k(r)<mk)return tS;function o(t,n){var e=i-n,o=r*t;return[e*Ck(o),i-e*Ak(o)]}return o.invert=function(t,n){var e=i-n,o=Mk(t,$k(e))*Ok(e);return e*r<0&&(o-=gk*Ok(t)*Ok(e)),[o/r,i-Ok(r)*_k(t*t+e*e)]},o}XD.invert=YD((function(t){return t})),JD.invert=function(t,n){return[t,2*kk(Sk(n))-vk]},tS.invert=tS;var eS=1.340264,rS=-.081106,iS=893e-6,oS=.003796,aS=_k(3)/2;function uS(t,n){var e=Tk(aS*Ck(n)),r=e*e,i=r*r*r;return[t*Ak(e)/(aS*(eS+3*rS*r+i*(7*iS+9*oS*r))),e*(eS+rS*r+i*(iS+oS*r))]}function sS(t,n){var e=Ak(n),r=Ak(t)*e;return[e*Ck(t)/r,Ck(n)/r]}function cS(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function lS(t,n){return[Ak(n)*Ck(t),Ck(n)]}function fS(t,n){var e=Ak(n),r=1+Ak(t)*e;return[e*Ck(t)/r,Ck(n)/r]}function dS(t,n){return[Ek(zk((vk+n)/2)),-t]}uS.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(eS+rS*i+o*(iS+oS*i))-n)/(eS+3*rS*i+o*(7*iS+9*oS*i)))*r)*i*i,!($k(e)<pk));++a);return[aS*t*(eS+3*rS*i+o*(7*iS+9*oS*i))/Ak(r),Tk(Ck(r)/aS)]},sS.invert=YD(kk),cS.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while($k(e)>mk&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},lS.invert=YD(Tk),fS.invert=YD((function(t){return 2*kk(t)})),dS.invert=function(t,n){return[-n,2*kk(Sk(t))-vk]};var hS=Math.abs,mS=Math.cos,pS=Math.sin,gS=Math.PI,vS=gS/2,yS=Math.sqrt(2);function bS(t){return t>1?vS:t<-1?-vS:Math.asin(t)}function wS(t,n){var e,r=t*pS(n),i=30;do{n-=e=(n+pS(n)-r)/(1+mS(n))}while(hS(e)>1e-6&&--i>0);return n/2}var xS=function(t,n,e){function r(r,i){return[t*r*mS(i=wS(e,i)),n*pS(i)]}return r.invert=function(r,i){return i=bS(i/n),[r/(t*mS(i)),bS((2*i+pS(2*i))/e)]},r}(yS/vS,yS,gS);const $S=FD(),kS=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function MS(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(DS[t]=function(t,n){return function e(){const r=n();return r.type=t,r.path=FD().projection(r),r.copy=r.copy||function(){const t=e();return kS.forEach((n=>{r[n]&&t[n](r[n]())})),t.path.pointRadius(r.path.pointRadius()),t},Zp(r)}}(t,n),this):DS[t]||null}function AS(t){return t&&t.path||$S}const DS={albers:HD,albersusa:function(){var t,n,e,r,i,o,a=HD(),u=WD().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=WD().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){o=[t,n]}};function l(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function f(){return t=n=null,l}return l.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},l.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},l.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),s.precision(t),f()):a.precision()},l.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),s.scale(t),l.translate(a.translate())):a.scale()},l.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],l=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,l-.238*n],[o+.455*n,l+.238*n]]).stream(c),r=u.translate([o-.307*n,l+.201*n]).clipExtent([[o-.425*n+mk,l+.12*n+mk],[o-.214*n-mk,l+.234*n-mk]]).stream(c),i=s.translate([o-.205*n,l+.212*n]).clipExtent([[o-.214*n+mk,l+.166*n+mk],[o-.115*n-mk,l+.234*n-mk]]).stream(c),f()},l.fitExtent=function(t,n){return OD(l,t,n)},l.fitSize=function(t,n){return _D(l,t,n)},l.fitWidth=function(t,n){return zD(l,t,n)},l.fitHeight=function(t,n){return BD(l,t,n)},l.scale(1070)},azimuthalequalarea:function(){return LD(VD).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return LD(XD).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return qD(ZD).scale(109.5).parallels([30,30])},conicequalarea:WD,conicequidistant:function(){return qD(nS).scale(131.154).center([0,13.9389])},equalEarth:function(){return LD(uS).scale(177.158)},equirectangular:function(){return LD(tS).scale(152.63)},gnomonic:function(){return LD(sS).scale(144.049).clipAngle(60)},identity:function(){var t,n,e,r,i,o,a,u=1,s=0,c=0,l=1,f=1,d=0,h=null,m=1,p=1,g=ED({point:function(t,n){var e=b([t,n]);this.stream.point(e[0],e[1])}}),v=NA;function y(){return m=u*l,p=u*f,o=a=null,b}function b(e){var r=e[0]*m,i=e[1]*p;if(d){var o=i*t-r*n;r=r*t+i*n,i=o}return[r+s,i+c]}return b.invert=function(e){var r=e[0]-s,i=e[1]-c;if(d){var o=i*t+r*n;r=r*t-i*n,i=o}return[r/m,i/p]},b.stream=function(t){return o&&a===t?o:o=g(v(a=t))},b.postclip=function(t){return arguments.length?(v=t,h=e=r=i=null,y()):v},b.clipExtent=function(t){return arguments.length?(v=null==t?(h=e=r=i=null,NA):kA(h=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),y()):null==h?null:[[h,e],[r,i]]},b.scale=function(t){return arguments.length?(u=+t,y()):u},b.translate=function(t){return arguments.length?(s=+t[0],c=+t[1],y()):[s,c]},b.angle=function(e){return arguments.length?(n=Ck(d=e%360*xk),t=Ak(d),y()):d*wk},b.reflectX=function(t){return arguments.length?(l=t?-1:1,y()):l<0},b.reflectY=function(t){return arguments.length?(f=t?-1:1,y()):f<0},b.fitExtent=function(t,n){return OD(b,t,n)},b.fitSize=function(t,n){return _D(b,t,n)},b.fitWidth=function(t,n){return zD(b,t,n)},b.fitHeight=function(t,n){return BD(b,t,n)},b},mercator:function(){return KD(JD).scale(961/bk)},mollweide:function(){return LD(xS).scale(169.529)},naturalEarth1:function(){return LD(cS).scale(175.295)},orthographic:function(){return LD(lS).scale(249.5).clipAngle(90.000001)},stereographic:function(){return LD(fS).scale(250).clipAngle(142)},transversemercator:function(){var t=KD(dS),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(const t in DS)MS(t,DS[t]);function SS(){}const FS=[[],[[[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 ES(){var t=1,n=1,e=a;function r(t,n){return n.map((n=>i(t,n)))}function i(r,i){var a=[],u=[];return function(e,r,i){var a,u,s,c,l,f=[],d=[];for(a=u=-1,FS[(s=e[0]>=r)<<1].forEach(h);++a<t-1;)FS[s|(s=e[a+1]>=r)<<1].forEach(h);for(FS[0|s].forEach(h);++u<n-1;){for(a=-1,FS[(s=e[u*t+t]>=r)<<1|(c=e[u*t]>=r)<<2].forEach(h);++a<t-1;)l=c,FS[s|(s=e[u*t+t+a+1]>=r)<<1|(c=e[u*t+a+1]>=r)<<2|l<<3].forEach(h);FS[s|c<<3].forEach(h)}for(a=-1,FS[(c=e[u*t]>=r)<<2].forEach(h);++a<t-1;)l=c,FS[(c=e[u*t+a+1]>=r)<<2|l<<3].forEach(h);function h(t){var n,e,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],c=o(r),l=o(s);(n=d[c])?(e=f[l])?(delete d[n.end],delete f[e.start],n===e?(n.ring.push(s),i(n.ring)):f[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(s),d[n.end=l]=n):(n=f[l])?(e=d[c])?(delete f[n.start],delete d[e.end],n===e?(n.ring.push(s),i(n.ring)):f[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete f[n.start],n.ring.unshift(r),f[n.start=c]=n):f[c]=d[l]={start:c,end:l,ring:[r,s]}}FS[c<<3].forEach(h)}(r,i,(t=>{e(t,r,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var n,e=0,r=a.length;e<r;++e)if(-1!==NS((n=a[e])[0],t))return void n.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function o(n){return 2*n[0]+n[1]*(t+1)*4}function a(e,r,i){e.forEach((e=>{var o,a=e[0],u=e[1],s=0|a,c=0|u,l=r[c*t+s];a>0&&a<t&&s===a&&(e[0]=a+(i-(o=r[c*t+s-1]))/(l-o)-.5),u>0&&u<n&&c===u&&(e[1]=u+(i-(o=r[(c-1)*t+s]))/(l-o)-.5)}))}return r.contour=i,r.size=function(e){if(!arguments.length)return[t,n];var i=Math.floor(e[0]),o=Math.floor(e[1]);return i>=0&&o>=0||p("invalid size"),t=i,n=o,r},r.smooth=function(t){return arguments.length?(e=t?a:SS,r):e===a},r}function NS(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=CS(t,n[r]))return e;return 0}function CS(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var s=t[o],c=s[0],l=s[1],f=t[u],d=f[0],h=f[1];if(OS(s,f,n))return 0;l>r!=h>r&&e<(d-c)*(r-l)/(h-l)+c&&(i=-i)}return i}function OS(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=n[r],i<=(o=e[r])&&o<=a||a<=o&&o<=i)}function _S(t,n,e){return function(r){var i=ct(r),o=e?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=n?wn(o,a,t):u/(t+1);return En(o+s,a,s)}}function zS(t){Oa.call(this,null,t)}function BS(t,n,e,r,i){const o=t.x1||0,a=t.y1||0,u=n*e<0;function s(t){t.forEach(c)}function c(t){u&&t.reverse(),t.forEach(l)}function l(t){t[0]=(t[0]-o)*n+r,t[1]=(t[1]-a)*e+i}return function(t){return t.coordinates.forEach(s),t}}function TS(t,n,e){const r=t>=0?t:Ra(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function PS(t){return tt(t)?t:at(+t)}function jS(){var t=t=>t[0],n=t=>t[1],e=x,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const c=TS(r[0],u,t)>>a,l=TS(r[1],u,n)>>a,f=c?c+2:0,d=l?l+2:0,h=2*f+(i>>a),m=2*d+(o>>a),p=new Float32Array(h*m),g=new Float32Array(h*m);let v=p;u.forEach((r=>{const i=f+(+t(r)>>a),o=d+(+n(r)>>a);i>=0&&i<h&&o>=0&&o<m&&(p[i+o*h]+=+e(r))})),c>0&&l>0?(RS(h,m,p,g,c),LS(h,m,g,p,l),RS(h,m,p,g,c),LS(h,m,g,p,l),RS(h,m,p,g,c),LS(h,m,g,p,l)):c>0?(RS(h,m,p,g,c),RS(h,m,g,p,c),RS(h,m,p,g,c),v=g):l>0&&(LS(h,m,p,g,l),LS(h,m,g,p,l),LS(h,m,p,g,l),v=g);const y=s?Math.pow(2,-2*a):1/Nn(v);for(let t=0,n=h*m;t<n;++t)v[t]*=y;return{values:v,scale:1<<a,width:h,height:m,x1:f,y1:d,x2:f+(i>>a),y2:d+(o>>a)}}return u.x=function(n){return arguments.length?(t=PS(n),u):t},u.y=function(t){return arguments.length?(n=PS(t),u):n},u.weight=function(t){return arguments.length?(e=PS(t),u):e},u.size=function(t){if(!arguments.length)return[i,o];var n=+t[0],e=+t[1];return n>=0&&e>=0||p("invalid size"),i=n,o=e,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||p("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<<a},u.bandwidth=function(t){return arguments.length?(1===(t=Q(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&p("invalid bandwidth"),r=t,u):r},u}function RS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<n;++a)for(let n=0,u=0;n<t+i;++n)n<t&&(u+=e[n+a*t]),n>=i&&(n>=o&&(u-=e[n-o+a*t]),r[n-i+a*t]=u/Math.min(n+1,t-1+o-n,o))}function LS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<t;++a)for(let u=0,s=0;u<n+i;++u)u<n&&(s+=e[a+u*t]),u>=i&&(u>=o&&(s-=e[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,n-1+o-u,o))}function IS(t){Oa.call(this,null,t)}zS.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"}]},pt(zS,Oa,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||b,o=ES().smooth(!1!==t.smooth),a=t.thresholds||function(t,n,e){const r=_S(e.levels||10,e.nice,!1!==e.zero);return"shared"!==e.resolve?r:r(t.map((t=>xn(n(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((n=>{const e=i(n),r=o.size([e.width,e.height])(e.values,S(a)?a:a(e.values));!function(t,n,e,r){let i=r.scale||n.scale,o=r.translate||n.translate;if(tt(i)&&(i=i(e,r)),tt(o)&&(o=o(e,r)),(1===i||null==i)&&!o)return;const a=(wt(i)?i:i[0])||1,u=(wt(i)?i:i[1])||1;t.forEach(BS(n,a,u,o&&o[0]||0,o&&o[1]||0))}(r,e,n,t),r.forEach((t=>{s.push(ia(n,ea(null!=u?{[u]:t}:t)))}))})),this.value&&(e.rem=this.value),this.value=e.source=e.add=s,e}}),IS.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 qS=["x","y","weight","size","cellSize","bandwidth"];function US(t,n){return qS.forEach((e=>null!=n[e]?t[e](n[e]):0)),t}function WS(t){Oa.call(this,null,t)}pt(IS,Oa,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(t,n){var e,r,i,o,a,u,s=[],c=t=>t(o);if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}(n.materialize(n.SOURCE).source,t.groupby),o=(t.groupby||[]).map(l),a=US(jS(),t),u=t.as||"grid";return e=i.map((n=>ea(function(t,n){for(let e=0;e<o.length;++e)t[o[e]]=n[e];return t}({[u]:a(n,t.counts)},n.dims)))),this.value&&(r.rem=this.value),this.value=r.source=r.add=e,r}}),WS.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}]},pt(WS,Oa,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=ES().smooth(!1!==t.smooth),a=t.values,u=t.thresholds||_S(t.count||10,t.nice,!!a),s=t.size;return a||(a=n.materialize(n.SOURCE).source,r=BS(e=US(jS(),t)(a,!0),e.scale||1,e.scale||1,0,0),s=[e.width,e.height],a=e.values),u=S(u)?u:u(a),a=o.size(s)(a,u),r&&a.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(a||[]).map(ea),i}});const HS="Feature",GS="FeatureCollection";function YS(t){Oa.call(this,null,t)}function VS(t){Oa.call(this,null,t)}function XS(t){Oa.call(this,null,t)}function JS(t){Oa.call(this,null,t)}function KS(t){Oa.call(this,[],t),this.generator=function(){var t,n,e,r,i,o,a,u,s,c,l,f,d=10,h=d,m=90,p=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return En(Dk(r/m)*m,e,m).map(l).concat(En(Dk(u/p)*p,a,p).map(f)).concat(En(Dk(n/d)*d,t,d).filter((function(t){return $k(t%m)>mk})).map(s)).concat(En(Dk(o/h)*h,i,h).filter((function(t){return $k(t%p)>mk})).map(c))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[l(r).concat(f(a).slice(1),l(e).reverse().slice(1),f(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(u=+t[0][1],a=+t[1][1],(r=+t[0][0])>(e=+t[1][0])&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),v.precision(g)):[[r,u],[e,a]]},v.extentMinor=function(e){return arguments.length?(o=+e[0][1],i=+e[1][1],(n=+e[0][0])>(t=+e[1][0])&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),v.precision(g)):[[n,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(m=+t[0],p=+t[1],v):[m,p]},v.stepMinor=function(t){return arguments.length?(d=+t[0],h=+t[1],v):[d,h]},v.precision=function(d){return arguments.length?(g=+d,s=MA(o,i,90),c=AA(n,t,g),l=MA(u,a,90),f=AA(r,e,g),v):g},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function QS(t){Oa.call(this,null,t)}function ZS(t){if(!tt(t))return!1;const n=Bt(f(t));return n.$x||n.$y||n.$value||n.$max}function tF(t){Oa.call(this,null,t),this.modified(!0)}function nF(t,n,e){tt(t[n])&&t[n](e)}YS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},pt(YS,Oa,{transform(t,n){var e,r=this._features,i=this._points,o=t.fields,a=o&&o[0],u=o&&o[1],s=t.geojson||!o&&b,c=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(f(s))||a&&n.modified(f(a))||u&&n.modified(f(u)),this.value&&!e||(c=n.SOURCE,this._features=r=[],this._points=i=[]),s&&n.visit(c,(t=>r.push(s(t)))),a&&u&&(n.visit(c,(t=>{var n=a(t),e=u(t);null!=n&&null!=e&&(n=+n)===n&&(e=+e)===e&&i.push([n,e])})),r=r.concat({type:HS,geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:GS,features:r}}}),VS.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"}]},pt(VS,Oa,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||b,o=t.as||"path",a=e.SOURCE;!r||t.modified()?(this.value=r=AS(t.projection),e.materialize().reflow()):a=i===b||n.modified(i.fields)?e.ADD_MOD:e.ADD;const u=function(t,n){const e=t.pointRadius();return t.context(null),null!=n&&t.pointRadius(n),e}(r,t.pointRadius);return e.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),e.modifies(o)}}),XS.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"]}]},pt(XS,Oa,{transform(t,n){var e,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function c(t){const n=r([i(t),o(t)]);n?(t[u]=n[0],t[s]=n[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,c):(e=n.modified(i.fields)||n.modified(o.fields),n.visit(e?n.ADD_MOD:n.ADD,c)),n.modifies(a)}}),JS.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"}]},pt(JS,Oa,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",o=e.ADD;return r&&!t.modified()||(this.value=r=function(t,n,e){const r=null==e?e=>t(n(e)):r=>{var i=t.pointRadius(),o=t.pointRadius(e)(n(r));return t.pointRadius(i),o};return r.context=n=>(t.context(n),r),r}(AS(t.projection),t.field||v("datum"),t.pointRadius),e.materialize().reflow(),o=e.SOURCE),e.visit(o,(t=>t[i]=r)),e.modifies(i)}}),KS.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}]},pt(KS,Oa,{transform(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(const n in t)tt(i[n])&&i[n](t[n]);return e=i(),r.length?n.mod.push(oa(r[0],e)):n.add.push(ea(e)),r[0]=e,n}}),QS.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"}]},pt(QS,Oa,{transform(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r="shared"===t.resolve,i=t.field||b,o=function(t,n){let e;return tt(t)?(e=e=>t(e,n),e.dep=ZS(t)):t?e=at(t):(e=t=>t.$value/t.$max||0,e.dep=!0),e}(t.opacity,t),a=function(t,n){let e;return tt(t)?(e=e=>Il(t(e,n)),e.dep=ZS(t)):e=at(Il(t||"#888")),e}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?xn(e.map((t=>xn(i(t).values)))):0};return e.forEach((t=>{const n=i(t),e=st({},t,s);r||(e.$max=xn(n.values||[])),t[u]=function(t,n,e,r){const i=t.width,o=t.x1||0,a=t.y1||0,u=t.x2||i,s=t.y2||t.height,c=t.values,l=c?t=>c[t]:w,f=hl(u-o,s-a),d=f.getContext("2d"),h=d.getImageData(0,0,u-o,s-a),m=h.data;for(let t=a,c=0;t<s;++t){n.$y=t-a;for(let a=o,s=t*i;a<u;++a,c+=4){n.$x=a-o,n.$value=l(a+s);const t=e(n);m[c+0]=t.r,m[c+1]=t.g,m[c+2]=t.b,m[c+3]=~~(255*r(n))}}return d.putImageData(h,0,0),f}(n,e,a.dep?a:at(a(e)),o.dep?o:at(o(e)))})),n.reflow(!0).modifies(u)}}),pt(tF,Oa,{transform(t,n){let e=this.value;return!e||t.modified("type")?(this.value=e=function(t){const n=MS((t||"mercator").toLowerCase());return n||p("Unrecognized projection type: "+t),n()}(t.type),kS.forEach((n=>{null!=t[n]&&nF(e,n,t[n])}))):kS.forEach((n=>{t.modified(n)&&nF(e,n,t[n])})),null!=t.pointRadius&&e.path.pointRadius(t.pointRadius),t.fit&&function(t,n){const e=function(t){return 1===(t=Q(t)).length?t[0]:{type:GS,features:t.reduce(((t,n)=>t.concat(function(t){return t.type===GS?t.features:Q(t).filter((t=>null!=t)).map((t=>t.type===HS?t:{type:HS,geometry:t}))}(n))),[])}}(n.fit);n.extent?t.fitExtent(n.extent,e):n.size&&t.fitSize(n.size,e)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});var eF=Object.freeze({__proto__:null,contour:WS,geojson:YS,geopath:VS,geopoint:XS,geoshape:JS,graticule:KS,heatmap:QS,isocontour:zS,kde2d:IS,projection:tF});function rF(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,s,c,l,f,d,h=t._root,m={data:r},p=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!h)return t._root=m,t;for(;h.length;)if((c=n>=(o=(p+v)/2))?p=o:v=o,(l=e>=(a=(g+y)/2))?g=a:y=a,i=h,!(h=h[f=l<<1|c]))return i[f]=m,t;if(u=+t._x.call(null,h.data),s=+t._y.call(null,h.data),n===u&&e===s)return m.next=h,i?i[f]=m:t._root=m,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+v)/2))?p=o:v=o,(l=e>=(a=(g+y)/2))?g=a:y=a}while((f=l<<1|c)==(d=(s>=a)<<1|u>=o));return i[d]=h,i[f]=m,t}function iF(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function oF(t){return t[0]}function aF(t){return t[1]}function uF(t,n,e){var r=new sF(null==n?oF:n,null==e?aF:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function sF(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function cF(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var lF=uF.prototype=sF.prototype;function fF(t){return function(){return t}}function dF(t){return 1e-6*(t()-.5)}function hF(t){return t.x+t.vx}function mF(t){return t.y+t.vy}function pF(t){return t.index}function gF(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}lF.copy=function(){var t,n,e=new sF(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=cF(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=cF(n));return e},lF.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return rF(this.cover(n,e),n,e,t)},lF.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,l=-1/0,f=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<s&&(s=r),r>l&&(l=r),i<c&&(c=i),i>f&&(f=i));if(s>l||c>f)return this;for(this.cover(s,c).cover(l,f),e=0;e<o;++e)rF(this,a[e],u[e],t[e]);return this},lF.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,s=i-e||1,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=e+s,o=r+s;break;case 1:e=i-s,o=r+s;break;case 2:i=e+s,r=o-s;break;case 3:e=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},lF.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},lF.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]]},lF.find=function(t,n,e){var r,i,o,a,u,s,c,l=this._x0,f=this._y0,d=this._x1,h=this._y1,m=[],p=this._root;for(p&&m.push(new iF(p,l,f,d,h)),null==e?e=1/0:(l=t-e,f=n-e,d=t+e,h=n+e,e*=e);s=m.pop();)if(!(!(p=s.node)||(i=s.x0)>d||(o=s.y0)>h||(a=s.x1)<l||(u=s.y1)<f))if(p.length){var g=(i+a)/2,v=(o+u)/2;m.push(new iF(p[3],g,v,a,u),new iF(p[2],i,v,g,u),new iF(p[1],g,o,a,v),new iF(p[0],i,o,g,v)),(c=(n>=v)<<1|t>=g)&&(s=m[m.length-1],m[m.length-1]=m[m.length-1-c],m[m.length-1-c]=s)}else{var y=t-+this._x.call(null,p.data),b=n-+this._y.call(null,p.data),w=y*y+b*b;if(w<e){var x=Math.sqrt(e=w);l=t-x,f=n-x,d=t+x,h=n+x,r=p.data}}return r},lF.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,s,c,l,f,d,h=this._root,m=this._x0,p=this._y0,g=this._x1,v=this._y1;if(!h)return this;if(h.length)for(;;){if((c=o>=(u=(m+g)/2))?m=u:g=u,(l=a>=(s=(p+v)/2))?p=s:v=s,n=h,!(h=h[f=l<<1|c]))return this;if(!h.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,d=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(h=n[0]||n[1]||n[2]||n[3])&&h===(n[3]||n[2]||n[1]||n[0])&&!h.length&&(e?e[d]=h:this._root=h),this):(this._root=i,this)},lF.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},lF.root=function(){return this._root},lF.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},lF.visit=function(t){var n,e,r,i,o,a,u=[],s=this._root;for(s&&u.push(new iF(s,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&s.length){var c=(r+o)/2,l=(i+a)/2;(e=s[3])&&u.push(new iF(e,c,l,o,a)),(e=s[2])&&u.push(new iF(e,r,l,c,a)),(e=s[1])&&u.push(new iF(e,c,i,o,l)),(e=s[0])&&u.push(new iF(e,r,i,c,l))}return this},lF.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new iF(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,s=n.x1,c=n.y1,l=(a+s)/2,f=(u+c)/2;(o=i[0])&&e.push(new iF(o,a,u,l,f)),(o=i[1])&&e.push(new iF(o,l,u,s,f)),(o=i[2])&&e.push(new iF(o,a,f,l,c)),(o=i[3])&&e.push(new iF(o,l,f,s,c))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},lF.x=function(t){return arguments.length?(this._x=t,this):this._x},lF.y=function(t){return arguments.length?(this._y=t,this):this._y};var vF={value:()=>{}};function yF(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new bF(r)}function bF(t){this._=t}function wF(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function xF(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=vF,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}bF.prototype=yF.prototype={constructor:bF,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=xF(i[e],t.name,n);else if(null==n)for(e in i)i[e]=xF(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=wF(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new bF(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var $F,kF,MF=0,AF=0,DF=0,SF=0,FF=0,EF=0,NF="object"==typeof performance&&performance.now?performance:Date,CF="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function OF(){return FF||(CF(_F),FF=NF.now()+EF)}function _F(){FF=0}function zF(){this._call=this._time=this._next=null}function BF(t,n,e){var r=new zF;return r.restart(t,n,e),r}function TF(){FF=(SF=NF.now())+EF,MF=AF=0;try{!function(){OF(),++MF;for(var t,n=$F;n;)(t=FF-n._time)>=0&&n._call.call(void 0,t),n=n._next;--MF}()}finally{MF=0,function(){for(var t,n,e=$F,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:$F=n);kF=t,jF(r)}(),FF=0}}function PF(){var t=NF.now(),n=t-SF;n>1e3&&(EF-=n,SF=t)}function jF(t){MF||(AF&&(AF=clearTimeout(AF)),t-FF>24?(t<1/0&&(AF=setTimeout(TF,t-NF.now()-EF)),DF&&(DF=clearInterval(DF))):(DF||(SF=NF.now(),DF=setInterval(PF,1e3)),MF=1,CF(TF)))}zF.prototype=BF.prototype={constructor:zF,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?OF():+e)+(null==n?0:+n),this._next||kF===this||(kF?kF._next=this:$F=this,kF=this),this._call=t,this._time=e,jF()},stop:function(){this._call&&(this._call=null,this._time=1/0,jF())}};const RF=4294967296;function LF(t){return t.x}function IF(t){return t.y}var qF=Math.PI*(3-Math.sqrt(5));const UF={center:function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=e[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=s}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,s,c,l,f,d,h=n.length,m=0;m<o;++m)for(a=uF(n,hF,mF).visitAfter(u),t=0;t<h;++t)d=(f=e[(s=n[t]).index])*f,c=s.x+s.vx,l=s.y+s.vy,a.visit(p);function p(t,n,e,o,a){var u=t.data,h=t.r,m=f+h;if(!u)return n>c+m||o<c-m||e>l+m||a<l-m;if(u.index>s.index){var p=c-u.x-u.vx,g=l-u.y-u.vy,v=p*p+g*g;v<m*m&&(0===p&&(v+=(p=dF(r))*p),0===g&&(v+=(g=dF(r))*g),v=(m-(v=Math.sqrt(v)))/v*i,s.vx+=(p*=v)*(m=(h*=h)/(d+h)),s.vy+=(g*=v)*m,u.vx-=p*(m=1-m),u.vy-=g*m)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function s(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)e[(i=n[r]).index]=+t(i,r,n)}}return"function"!=typeof t&&(t=fF(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,s()},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(n){return arguments.length?(t="function"==typeof n?n:fF(+n),s(),a):t},a},nbody:function(){var t,n,e,r,i,o=fF(-30),a=1,u=1/0,s=.81;function c(e){var i,o=t.length,a=uF(t,LF,IF).visitAfter(f);for(r=e,i=0;i<o;++i)n=t[i],a.visit(d)}function l(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)i[(e=t[n]).index]=+o(e,n,t)}}function f(t){var n,e,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,s+=e,r+=e*n.x,o+=e*n.y);t.x=r/s,t.y=o/s}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function d(t,o,c,l){if(!t.value)return!0;var f=t.x-n.x,d=t.y-n.y,h=l-o,m=f*f+d*d;if(h*h/s<m)return m<u&&(0===f&&(m+=(f=dF(e))*f),0===d&&(m+=(d=dF(e))*d),m<a&&(m=Math.sqrt(a*m)),n.vx+=f*t.value*r/m,n.vy+=d*t.value*r/m),!0;if(!(t.length||m>=u)){(t.data!==n||t.next)&&(0===f&&(m+=(f=dF(e))*f),0===d&&(m+=(d=dF(e))*d),m<a&&(m=Math.sqrt(a*m)));do{t.data!==n&&(n.vx+=f*(h=i[t.data.index]*r/m),n.vy+=d*h)}while(t=t.next)}}return c.initialize=function(n,r){t=n,e=r,l()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:fF(+t),l(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c.theta=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c},link:function(t){var n,e,r,i,o,a,u=pF,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=fF(30),l=1;function f(r){for(var i=0,u=t.length;i<l;++i)for(var s,c,f,d,h,m,p,g=0;g<u;++g)d=(f=(s=t[g]).target).x+f.vx-(c=s.source).x-c.vx||dF(a),h=f.y+f.vy-c.y-c.vy||dF(a),h*=m=((m=Math.sqrt(d*d+h*h))-e[g])/m*r*n[g],f.vx-=(d*=m)*(p=o[g]),f.vy-=h*p,c.vx+=d*(p=1-p),c.vy+=h*p}function d(){if(r){var a,s,c=r.length,l=t.length,f=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(c);a<l;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=gF(f,s.source)),"object"!=typeof s.target&&(s.target=gF(f,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(l);a<l;++a)o[a]=i[(s=t[a]).source.index]/(i[s.source.index]+i[s.target.index]);n=new Array(l),h(),e=new Array(l),m()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+s(t[e],e,t)}function m(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}return null==t&&(t=[]),f.initialize=function(t,n){r=t,a=n,d()},f.links=function(n){return arguments.length?(t=n,d(),f):t},f.id=function(t){return arguments.length?(u=t,f):u},f.iterations=function(t){return arguments.length?(l=+t,f):l},f.strength=function(t){return arguments.length?(s="function"==typeof t?t:fF(+t),h(),f):s},f.distance=function(t){return arguments.length?(c="function"==typeof t?t:fF(+t),m(),f):c},f},x:function(t){var n,e,r,i=fF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=fF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:fF(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:fF(+n),a(),o):t},o},y:function(t){var n,e,r,i=fF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=fF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:fF(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:fF(+n),a(),o):t},o}},WF="forces",HF=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],GF=["static","iterations"],YF=["x","y","vx","vy"];function VF(t){Oa.call(this,null,t)}function XF(t,n,e,r){var i,o,a,u,s=Q(n.forces);for(i=0,o=HF.length;i<o;++i)(a=HF[i])!==WF&&n.modified(a)&&t[a](n[a]);for(i=0,o=s.length;i<o;++i)u=WF+i,(a=e||n.modified(WF,i)?KF(s[i]):r&&JF(s[i],r)?t.force(u):null)&&t.force(u,a);for(o=t.numForces||0;i<o;++i)t.force(WF+i,null);return t.numForces=s.length,t}function JF(t,n){var e,r;for(e in t)if(tt(r=t[e])&&n.modified(f(r)))return 1;return 0}function KF(t){var n,e;for(e in ft(UF,t.force)||p("Unrecognized force: "+t.force),n=UF[t.force](),t)tt(n[e])&&QF(n[e],t[e],t);return n}function QF(t,n,e){t(tt(n)?t=>n(t,e):n)}VF.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:YF}]},pt(VF,Oa,{transform(t,n){var e,r,i=this.value,o=n.changed(n.ADD_REM),a=t.modified(HF),u=t.iterations||300;if(i?(o&&(n.modifies("index"),i.nodes(n.source)),(a||n.changed(n.MOD))&&XF(i,t,0,n)):(this.value=i=function(t,n){const e=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=BF(f),c=yF("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%RF)/RF}();function f(){d(),c.call("tick",n),e<r&&(s.stop(),c.call("end",n))}function d(r){var s,c,l=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),s=0;s<l;++s)null==(c=t[s]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(.5+e),o=e*qF;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function m(n){return n.initialize&&n.initialize(t,l),n}return null==t&&(t=[]),h(),n={tick:d,restart:function(){return s.restart(f),n},stop:function(){return s.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.forEach(m),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(l=t,u.forEach(m),n):l},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,m(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,s,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(a=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(t),r=e.stop,i=e.restart;let o=!1;return e.stopped=()=>o,e.restart=()=>(o=!1,i()),e.stop=()=>(o=!0,r()),XF(e,n,!0).on("end",(()=>o=!0))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(o=!0,i.tick()),n.modifies("index")),a||o||t.modified(GF)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return n.StopPropagation;return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let t,n=this._argops,u=0,s=n.length;u<s;++u)if(t=n[u],t.name===WF&&"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)){e.pulse(r,e.changeset().reflow());break}return n.reflow(t.modified()).modifies(YF)}});var ZF=Object.freeze({__proto__:null,force:VF});function tE(t,n){return t.parent===n.parent?1:2}function nE(t,n){return t+n.x}function eE(t,n){return Math.max(t,n.y)}function rE(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function iE(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=aE)):void 0===n&&(n=oE);for(var e,r,i,o,a,u=new cE(t),s=[u];e=s.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new cE(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(sE)}function oE(t){return t.children}function aE(t){return Array.isArray(t)?t[1]:null}function uE(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function sE(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function cE(t){this.data=t,this.depth=this.height=0,this.parent=null}function lE(t){return null==t?null:fE(t)}function fE(t){if("function"!=typeof t)throw new Error;return t}function dE(){return 0}function hE(t){return function(){return t}}cE.prototype=iE.prototype={constructor:cE,count:function(){return this.eachAfter(rE)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],s=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=u.pop();)t.call(n,o,++s,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)r.push(n=n.parent);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return iE(this).eachBefore(uE)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};const mE=4294967296;function pE(t,n){var e,r;if(yE(n,t))return[n];for(e=0;e<t.length;++e)if(gE(n,t[e])&&yE(wE(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(gE(wE(t[e],t[r]),n)&&gE(wE(t[e],n),t[r])&&gE(wE(t[r],n),t[e])&&yE(xE(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function gE(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function vE(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function yE(t,n){for(var e=0;e<n.length;++e)if(!vE(t,n[e]))return!1;return!0}function bE(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return wE(t[0],t[1]);case 3:return xE(t[0],t[1],t[2])}var n}function wE(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,s=o-e,c=a-r,l=u-i,f=Math.sqrt(s*s+c*c);return{x:(e+o+s/f*l)/2,y:(r+a+c/f*l)/2,r:(f+i+u)/2}}function xE(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,s=n.r,c=e.x,l=e.y,f=e.r,d=r-a,h=r-c,m=i-u,p=i-l,g=s-o,v=f-o,y=r*r+i*i-o*o,b=y-a*a-u*u+s*s,w=y-c*c-l*l+f*f,x=h*m-d*p,$=(m*w-p*b)/(2*x)-r,k=(p*g-m*v)/x,M=(h*b-d*w)/(2*x)-i,A=(d*v-h*g)/x,D=k*k+A*A-1,S=2*(o+$*k+M*A),F=$*$+M*M-o*o,E=-(Math.abs(D)>1e-6?(S+Math.sqrt(S*S-4*D*F))/(2*D):F/S);return{x:r+$+k*E,y:i+M+A*E,r:E}}function $E(t,n,e){var r,i,o,a,u=t.x-n.x,s=t.y-n.y,c=u*u+s*s;c?(i=n.r+e.r,a=t.r+e.r,(i*=i)>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),e.x=t.x-r*u-o*s,e.y=t.y-r*s+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),e.x=n.x+r*u-o*s,e.y=n.y+r*s+o*u)):(e.x=n.x+e.r,e.y=n.y)}function kE(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function ME(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function AE(t){this._=t,this.next=null,this.previous=null}function DE(t){return Math.sqrt(t.value)}function SE(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function FE(t,n,e){return function(r){if(i=r.children){var i,o,a,u=i.length,s=t(r)*n||0;if(s)for(o=0;o<u;++o)i[o].r+=s;if(a=function(t,n){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,r,i,o,a,u,s,c,l,f,d;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(e.x=-(r=t[1]).r,r.x=e.r,r.y=0,!(o>2))return e.r+r.r;$E(r,e,i=t[2]),e=new AE(e),r=new AE(r),i=new AE(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(s=3;s<o;++s){$E(e._,r._,i=t[s]),i=new AE(i),c=r.next,l=e.previous,f=r._.r,d=e._.r;do{if(f<=d){if(kE(c._,i._)){e.next=r=c,r.previous=e,--s;continue t}f+=c._.r,c=c.next}else{if(kE(l._,i._)){(e=l).next=r,r.previous=e,--s;continue t}d+=l._.r,l=l.previous}}while(c!==l.next);for(i.previous=e,i.next=r,e.next=r.previous=r=i,a=ME(e);(i=i.next)!==r;)(u=ME(i))<a&&(e=i,a=u);r=e.next}for(e=[r._],i=r;(i=i.next)!==r;)e.push(i._);for(i=function(t,n){for(var e,r,i=0,o=(t=function(t,n){let e,r,i=t.length;for(;i;)r=n()*i--|0,e=t[i],t[i]=t[r],t[r]=e;return t}(Array.from(t),n)).length,a=[];i<o;)e=t[i],r&&vE(r,e)?++i:(r=bE(a=pE(a,e)),i=0);return r}(e,n),s=0;s<o;++s)(e=t[s]).x-=i.x,e.y-=i.y;return i.r}(i,e),s)for(o=0;o<u;++o)i[o].r-=s;r.r=a+s}}}function EE(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function NE(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 CE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(r-n)/t.value;++u<s;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c}var OE={depth:-1},_E={},zE={};function BE(t){return t.id}function TE(t){return t.parentId}function PE(){var t,n=BE,e=TE;function r(r){var i,o,a,u,s,c,l,f,d=Array.from(r),h=n,m=e,p=new Map;if(null!=t){const n=d.map(((n,e)=>function(t){let n=(t=`${t}`).length;return RE(t,n-1)&&!RE(t,n-2)&&(t=t.slice(0,-1)),"/"===t[0]?t:`/${t}`}(t(n,e,r)))),e=n.map(jE),i=new Set(n).add("");for(const t of e)i.has(t)||(i.add(t),n.push(t),e.push(jE(t)),d.push(zE));h=(t,e)=>n[e],m=(t,n)=>e[n]}for(a=0,i=d.length;a<i;++a)c=d[a]=new cE(o=d[a]),null!=(l=h(o,a,r))&&(l+="")&&(f=c.id=l,p.set(f,p.has(f)?_E:c)),null!=(l=m(o,a,r))&&(l+="")&&(c.parent=l);for(a=0;a<i;++a)if(l=(c=d[a]).parent){if(!(s=p.get(l)))throw new Error("missing: "+l);if(s===_E)throw new Error("ambiguous: "+l);s.children?s.children.push(c):s.children=[c],c.parent=s}else{if(u)throw new Error("multiple roots");u=c}if(!u)throw new Error("no root");if(null!=t){for(;u.data===zE&&1===u.children.length;)u=u.children[0],--i;for(let t=d.length-1;t>=0&&(c=d[t]).data===zE;--t)c.data=null}if(u.parent=OE,u.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(sE),u.parent=null,i>0)throw new Error("cycle");return u}return r.id=function(t){return arguments.length?(n=lE(t),r):n},r.parentId=function(t){return arguments.length?(e=lE(t),r):e},r.path=function(n){return arguments.length?(t=lE(n),r):t},r}function jE(t){let n=t.length;if(n<2)return"";for(;--n>1&&!RE(t,n););return t.slice(0,n)}function RE(t,n){if("/"===t[n]){let e=0;for(;n>0&&"\\"===t[--n];)++e;if(!(1&e))return!0}return!1}function LE(t,n){return t.parent===n.parent?1:2}function IE(t){var n=t.children;return n?n[0]:t.t}function qE(t){var n=t.children;return n?n[n.length-1]:t.t}function UE(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function WE(t,n,e){return t.a.parent===n.parent?t.a:e}function HE(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function GE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(i-e)/t.value;++u<s;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*c}HE.prototype=Object.create(cE.prototype);var YE=(1+Math.sqrt(5))/2;function VE(t,n,e,r,i,o){for(var a,u,s,c,l,f,d,h,m,p,g,v=[],y=n.children,b=0,w=0,x=y.length,$=n.value;b<x;){s=i-e,c=o-r;do{l=y[w++].value}while(!l&&w<x);for(f=d=l,g=l*l*(p=Math.max(c/s,s/c)/($*t)),m=Math.max(d/g,g/f);w<x;++w){if(l+=u=y[w].value,u<f&&(f=u),u>d&&(d=u),g=l*l*p,(h=Math.max(d/g,g/f))>m){l-=u;break}m=h}v.push(a={value:l,dice:s<c,children:y.slice(b,w)}),a.dice?CE(a,e,r,i,$?r+=c*l/$:o):GE(a,e,r,$?e+=s*l/$:i,o),$-=l,b=w}return v}var XE=function t(n){function e(t,e,r,i,o){VE(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(YE),JE=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,s,c,l,f=-1,d=a.length,h=t.value;++f<d;){for(s=(u=a[f]).children,c=u.value=0,l=s.length;c<l;++c)u.value+=s[c].value;u.dice?CE(u,e,r,i,h?r+=(o-r)*u.value/h:o):GE(u,e,r,h?e+=(i-e)*u.value/h:i,o),h-=u.value}else t._squarify=a=VE(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(YE);function KE(t,n,e){const r={};return t.each((t=>{const i=t.data;e(i)&&(r[n(i)]=t)})),t.lookup=r,t}function QE(t){Oa.call(this,null,t)}QE.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const ZE=t=>t.values;function tN(){const t=[],n={entries:t=>r(e(t,0),0),key:e=>(t.push(e),n)};function e(n,r){if(r>=t.length)return n;const i=n.length,o=t[r++],a={},u={};let s,c,l,f=-1;for(;++f<i;)s=o(c=n[f])+"",(l=a[s])?l.push(c):a[s]=[c];for(s in a)u[s]=e(a[s],r);return u}function r(n,e){if(++e>t.length)return n;const i=[];for(const t in n)i.push({key:t,values:r(n[t],e)});return i}return n}function nN(t){Oa.call(this,null,t)}pt(QE,Oa,{transform(t,n){n.source||p("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),i=n.clone(),o=this.value;return(!o||r||n.changed())&&(o&&o.each((t=>{t.children&&Zo(t.data)&&i.rem.push(t.data)})),this.value=o=iE({values:Q(t.keys).reduce(((t,n)=>(t.key(n),t)),tN()).entries(i.source)},ZE),e&&o.each((t=>{t.children&&(t=ea(t.data),i.add.push(t),i.source.push(t))})),KE(o,ta,ta)),i.source.root=o,i}});const eN=(t,n)=>t.parent===n.parent?1:2;pt(nN,Oa,{transform(t,n){n.source&&n.source.root||p(this.constructor.name+" transform requires a backing tree data source.");const e=this.layout(t.method),r=this.fields,i=n.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(aa(t.sort,(t=>t.data))),function(t,n,e){for(let r,i=0,o=n.length;i<o;++i)r=n[i],r in e&&t[r](e[r])}(e,this.params,t),e.separation&&e.separation(!1!==t.separation?eN:x);try{this.value=e(i)}catch(t){p(t)}return i.each((t=>function(t,n,e){const r=t.data,i=n.length-1;for(let o=0;o<i;++o)r[e[o]]=t[n[o]];r[e[i]]=t.children?t.children.length:0}(t,r,o))),n.reflow(t.modified()).modifies(o).modifies("leaf")}});const rN=["x","y","r","depth","children"];function iN(t){nN.call(this,t)}iN.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:rN.length,default:rN}]},pt(iN,nN,{layout:function(){var t=null,n=1,e=1,r=dE;function i(i){const o=function(){let t=1;return()=>(t=(1664525*t+1013904223)%mE)/mE}();return i.x=n/2,i.y=e/2,t?i.eachBefore(SE(t)).eachAfter(FE(r,.5,o)).eachBefore(EE(1)):i.eachBefore(SE(DE)).eachAfter(FE(dE,1,o)).eachAfter(FE(r,i.r/Math.min(n,e),o)).eachBefore(EE(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=lE(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:hE(+t),i):r},i},params:["radius","size","padding"],fields:rN});const oN=["x0","y0","x1","y1","depth","children"];function aN(t){nN.call(this,t)}function uN(t){Oa.call(this,null,t)}aN.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:oN.length,default:oN}]},pt(aN,nN,{layout:function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&CE(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(NE),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},params:["size","round","padding"],fields:oN}),uN.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},pt(uN,Oa,{transform(t,n){n.source||p("Stratify transform requires an upstream data source.");let e=this.value;const r=t.modified(),i=n.fork(n.ALL).materialize(n.SOURCE),o=!e||r||n.changed(n.ADD_REM)||n.modified(t.key.fields)||n.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(e=i.source.length?KE(PE().id(t.key).parentId(t.parentKey)(i.source),t.key,$):KE(PE()([{}]),t.key,t.key)),i.source.root=this.value=e,i}});const sN={tidy:function(){var t=LE,n=1,e=1,r=null;function i(i){var s=function(t){for(var n,e,r,i,o,a=new HE(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new HE(r[i],i)),e.parent=n;return(a.parent=new HE(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var c=i,l=i,f=i;i.eachBefore((function(t){t.x<c.x&&(c=t),t.x>l.x&&(l=t),t.depth>f.depth&&(f=t)}));var d=c===l?1:t(c,l)/2,h=d-c.x,m=n/(l.x+d+h),p=e/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+h)*m,t.y=t.depth*p}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,s=o.parent.children[0],c=o.m,l=a.m,f=u.m,d=s.m;u=qE(u),o=IE(o),u&&o;)s=IE(s),(a=qE(a)).a=n,(i=u.z+f-o.z-c+t(u._,o._))>0&&(UE(WE(u,n,r),n,i),c+=i,l+=i),f+=u.m,c+=o.m,d+=s.m,l+=a.m;u&&!qE(a)&&(a.t=u,a.m+=f-l),o&&!IE(s)&&(s.t=o,s.m+=c-d,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=tE,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(nE,0)/t.length}(e),n.y=function(t){return 1+t.reduce(eE,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),c=u.x-t(u,s)/2,l=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-c)/(l-c)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},cN=["x","y","depth","children"];function lN(t){nN.call(this,t)}function fN(t){Oa.call(this,[],t)}lN.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:cN.length,default:cN}]},pt(lN,nN,{layout(t){const n=t||"tidy";if(ft(sN,n))return sN[n]();p("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:cN}),fN.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},pt(fN,Oa,{transform(t,n){const e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),o={};return r||p("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,(t=>o[ta(t)]=1)),r.each((t=>{const n=t.data,e=t.parent&&t.parent.data;e&&o[ta(n)]&&o[ta(e)]&&i.add.push(ea({source:e,target:n}))})),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,(t=>o[ta(t)]=1)),e.forEach((t=>{(o[ta(t.source)]||o[ta(t.target)])&&i.mod.push(t)}))),i}});const dN={binary:function(t,n,e,r,i){var o,a,u=t.children,s=u.length,c=new Array(s+1);for(c[0]=a=o=0;o<s;++o)c[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,s){if(n>=e-1){var l=u[n];return l.x0=i,l.y0=o,l.x1=a,void(l.y1=s)}for(var f=c[n],d=r/2+f,h=n+1,m=e-1;h<m;){var p=h+m>>>1;c[p]<d?h=p+1:m=p}d-c[h-1]<c[h]-d&&n+1<h&&--h;var g=c[h]-f,v=r-g;if(a-i>s-o){var y=r?(i*v+a*g)/r:a;t(n,h,g,i,o,y,s),t(h,e,v,y,o,a,s)}else{var b=r?(o*v+s*g)/r:s;t(n,h,g,i,o,a,b),t(h,e,v,i,b,a,s)}}(0,s,t.value,n,e,r,i)},dice:CE,slice:GE,slicedice:function(t,n,e,r,i){(1&t.depth?GE:CE)(t,n,e,r,i)},squarify:XE,resquarify:JE},hN=["x0","y0","x1","y1","depth","children"];function mN(t){nN.call(this,t)}mN.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:hN.length,default:hN}]},pt(mN,nN,{layout(){const t=function(){var t=XE,n=!1,e=1,r=1,i=[0],o=dE,a=dE,u=dE,s=dE,c=dE;function l(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(NE),t}function f(n){var e=i[n.depth],r=n.x0+e,l=n.y0+e,f=n.x1-e,d=n.y1-e;f<r&&(r=f=(r+f)/2),d<l&&(l=d=(l+d)/2),n.x0=r,n.y0=l,n.x1=f,n.y1=d,n.children&&(e=i[n.depth+1]=o(n)/2,r+=c(n)-e,l+=a(n)-e,(f-=u(n)-e)<r&&(r=f=(r+f)/2),(d-=s(n)-e)<l&&(l=d=(l+d)/2),t(n,r,l,f,d))}return l.round=function(t){return arguments.length?(n=!!t,l):n},l.size=function(t){return arguments.length?(e=+t[0],r=+t[1],l):[e,r]},l.tile=function(n){return arguments.length?(t=fE(n),l):t},l.padding=function(t){return arguments.length?l.paddingInner(t).paddingOuter(t):l.paddingInner()},l.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:hE(+t),l):o},l.paddingOuter=function(t){return arguments.length?l.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):l.paddingTop()},l.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:hE(+t),l):a},l.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:hE(+t),l):u},l.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:hE(+t),l):s},l.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:hE(+t),l):c},l}();return t.ratio=n=>{const e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=n=>{ft(dN,n)?t.tile(dN[n]):p("Unrecognized Treemap layout method: "+n)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:hN});var pN=Object.freeze({__proto__:null,nest:QE,pack:iN,partition:aN,stratify:uN,tree:lN,treelinks:fN,treemap:mN});const gN=4278190080;function vN(t,n,e){return new Uint32Array(t.getImageData(0,0,n,e).data.buffer)}function yN(t,n,e){if(!n.length)return;const r=n[0].mark.marktype;"group"===r?n.forEach((n=>{n.items.forEach((n=>yN(t,n.items,e)))})):Tb[r].draw(t,{items:e?n.map(bN):n})}function bN(t){const n=ia(t,{});return n.stroke&&0!==n.strokeOpacity||n.fill&&0!==n.fillOpacity?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const wN=31,xN=new Uint32Array(33),$N=new Uint32Array(33);$N[0]=0,xN[0]=~$N[0];for(let t=1;t<=32;++t)$N[t]=$N[t-1]<<1|1,xN[t]=~$N[t];function kN(t,n,e,r,i,o){let a=e/2;return t-a<0||t+a>i||n-(a=r/2)<0||n+a>o}function MN(t,n,e,r,i,o,a,u){const s=i*o/(2*r),c=t(n-s),l=t(n+s),f=t(e-(o/=2)),d=t(e+o);return a.outOfBounds(c,f,l,d)||a.getRange(c,f,l,d)||u&&u.getRange(c,f,l,d)}const AN=[-1,-1,1,1],DN=[-1,1,-1,1],SN=["right","center","left"],FN=["bottom","middle","top"];function EN(t,n,e,r,i,o,a,u,s,c,l,f){return!(i.outOfBounds(t,e,n,r)||(f&&o||i).getRange(t,e,n,r))}const NN={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},CN={naive:function(t,n,e,r){const i=t.width,o=t.height;return function(t){const n=t.datum.datum.items[r].items,e=n.length,a=t.datum.fontSize,u=gb.width(t.datum,t.datum.text);let s,c,l,f,d,h,m,p=0;for(let r=0;r<e;++r)s=n[r].x,l=n[r].y,c=void 0===n[r].x2?s:n[r].x2,f=void 0===n[r].y2?l:n[r].y2,d=(s+c)/2,h=(l+f)/2,m=Math.abs(c-s+f-l),m>=p&&(p=m,t.x=d,t.y=h);return d=u/2,h=a/2,s=t.x-d,c=t.x+d,l=t.y-h,f=t.y+h,t.align="center",s<0&&c<=i?t.align="left":0<=s&&i<c&&(t.align="right"),t.baseline="middle",l<0&&f<=o?t.baseline="top":0<=l&&o<f&&(t.baseline="bottom"),!0}},"reduced-search":function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1];function s(n,e,r,s,c){const l=t.invert(n),f=t.invert(e);let d,h=r,m=o;if(!kN(l,f,s,c,i,o)&&!MN(t,l,f,c,s,h,a,u)&&!MN(t,l,f,c,s,c,a,null)){for(;m-h>=1;)d=(h+m)/2,MN(t,l,f,c,s,d,a,u)?m=d:h=d;if(h>r)return[l,f,h,!0]}}return function(n){const u=n.datum.datum.items[r].items,c=u.length,l=n.datum.fontSize,f=gb.width(n.datum,n.datum.text);let d,h,m,p,g,v,y,b,w,x,$,k,M,A,D,S,F,E=e?l:0,N=!1,C=!1,O=0;for(let r=0;r<c;++r){for(d=u[r].x,m=u[r].y,h=void 0===u[r].x2?d:u[r].x2,p=void 0===u[r].y2?m:u[r].y2,d>h&&(F=d,d=h,h=F),m>p&&(F=m,m=p,p=F),w=t(d),$=t(h),x=~~((w+$)/2),k=t(m),A=t(p),M=~~((k+A)/2),y=x;y>=w;--y)for(b=M;b>=k;--b)S=s(y,b,E,f,l),S&&([n.x,n.y,E,N]=S);for(y=x;y<=$;++y)for(b=M;b<=A;++b)S=s(y,b,E,f,l),S&&([n.x,n.y,E,N]=S);N||e||(D=Math.abs(h-d+p-m),g=(d+h)/2,v=(m+p)/2,D>=O&&!kN(g,v,f,l,i,o)&&!MN(t,g,v,l,f,l,a,null)&&(O=D,n.x=g,n.y=v,C=!0))}return!(!N&&!C||(g=f/2,v=l/2,a.setRange(t(n.x-g),t(n.y-v),t(n.x+g),t(n.y+v)),n.align="center",n.baseline="middle",0))}},floodfill:function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=t.bitmap();return function(n){const c=n.datum.datum.items[r].items,l=c.length,f=n.datum.fontSize,d=gb.width(n.datum,n.datum.text),h=[];let m,p,g,v,y,b,w,x,$,k,M,A,D=e?f:0,S=!1,F=!1,E=0;for(let r=0;r<l;++r){for(m=c[r].x,g=c[r].y,p=void 0===c[r].x2?m:c[r].x2,v=void 0===c[r].y2?g:c[r].y2,h.push([t((m+p)/2),t((g+v)/2)]);h.length;)if([w,x]=h.pop(),!(a.get(w,x)||u.get(w,x)||s.get(w,x))){s.set(w,x);for(let t=0;t<4;++t)y=w+AN[t],b=x+DN[t],s.outOfBounds(y,b,y,b)||h.push([y,b]);if(y=t.invert(w),b=t.invert(x),$=D,k=o,!kN(y,b,d,f,i,o)&&!MN(t,y,b,f,d,$,a,u)&&!MN(t,y,b,f,d,f,a,null)){for(;k-$>=1;)M=($+k)/2,MN(t,y,b,f,d,M,a,u)?k=M:$=M;$>D&&(n.x=y,n.y=b,D=$,S=!0)}}S||e||(A=Math.abs(p-m+v-g),y=(m+p)/2,b=(g+v)/2,A>=E&&!kN(y,b,d,f,i,o)&&!MN(t,y,b,f,d,f,a,null)&&(E=A,n.x=y,n.y=b,F=!0))}return!(!S&&!F||(y=d/2,b=f/2,a.setRange(t(n.x-y),t(n.y-b),t(n.x+y),t(n.y+b)),n.align="center",n.baseline="middle",0))}}};function ON(t,n,e,r,i,o,a,u,s,c,l){if(!t.length)return t;const f=Math.max(r.length,i.length),d=function(t,n){const e=new Float64Array(n),r=t.length;for(let n=0;n<r;++n)e[n]=t[n]||0;for(let t=r;t<n;++t)e[t]=e[r-1];return e}(r,f),h=function(t,n){const e=new Int8Array(n),r=t.length;for(let n=0;n<r;++n)e[n]|=NN[t[n]];for(let t=r;t<n;++t)e[t]=e[r-1];return e}(i,f),m=(w=t[0].datum)&&w.mark&&w.mark.marktype,p="group"===m&&t[0].datum.items[s].marktype,g="area"===p,v=function(t,n,e,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"===n?t=>{const n=t.datum.items[r].items;return i(n.length?n["start"===e?0:n.length-1]:{x:NaN,y:NaN})}:t=>{const n=t.datum.bounds;return[n.x1,(n.x1+n.x2)/2,n.x2,n.y1,(n.y1+n.y2)/2,n.y2]}:i}(m,p,u,s),y=null===c||c===1/0,b=g&&"naive"===l;var w;let x=-1,$=-1;const k=t.map((t=>{const n=y?gb.width(t,t.text):void 0;return x=Math.max(x,n),$=Math.max($,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:v(t),textWidth:n}}));c=null===c||c===1/0?Math.max(x,$)+Math.max(...r):c;const M=function(t,n,e){const r=Math.max(1,Math.sqrt(t*n/1e6)),i=~~((t+2*e+r)/r),o=~~((n+2*e+r)/r),a=t=>~~((t+e)/r);return a.invert=t=>t*r-e,a.bitmap=()=>function(t,n){const e=new Uint32Array(~~((t*n+32)/32));function r(t,n){e[t]|=n}function i(t,n){e[t]&=n}return{array:e,get:(n,r)=>{const i=r*t+n;return e[i>>>5]&1<<(i&wN)},set:(n,e)=>{const i=e*t+n;r(i>>>5,1<<(i&wN))},clear:(n,e)=>{const r=e*t+n;i(r>>>5,~(1<<(r&wN)))},getRange:(n,r,i,o)=>{let a,u,s,c,l=o;for(;l>=r;--l)if(a=l*t+n,u=l*t+i,s=a>>>5,c=u>>>5,s===c){if(e[s]&xN[a&wN]&$N[1+(u&wN)])return!0}else{if(e[s]&xN[a&wN])return!0;if(e[c]&$N[1+(u&wN)])return!0;for(let t=s+1;t<c;++t)if(e[t])return!0}return!1},setRange:(n,e,i,o)=>{let a,u,s,c,l;for(;e<=o;++e)if(a=e*t+n,u=e*t+i,s=a>>>5,c=u>>>5,s===c)r(s,xN[a&wN]&$N[1+(u&wN)]);else for(r(s,xN[a&wN]),r(c,$N[1+(u&wN)]),l=s+1;l<c;++l)r(l,4294967295)},clearRange:(n,e,r,o)=>{let a,u,s,c,l;for(;e<=o;++e)if(a=e*t+n,u=e*t+r,s=a>>>5,c=u>>>5,s===c)i(s,$N[a&wN]|xN[1+(u&wN)]);else for(i(s,$N[a&wN]),i(c,xN[1+(u&wN)]),l=s+1;l<c;++l)i(l,0)},outOfBounds:(e,r,i,o)=>e<0||r<0||o>=n||i>=t}}(i,o),a.ratio=r,a.padding=e,a.width=t,a.height=n,a}(n[0],n[1],c);let A;if(!b){e&&k.sort(((t,n)=>e(t.datum,n.datum)));let n=!1;for(let t=0;t<h.length&&!n;++t)n=5===h[t]||d[t]<0;const r=(m&&a||g)&&t.map((t=>t.datum));A=o.length||r?function(t,n,e,r,i){const o=t.width,a=t.height,u=r||i,s=hl(o,a).getContext("2d"),c=hl(o,a).getContext("2d"),l=u&&hl(o,a).getContext("2d");e.forEach((t=>yN(s,t,!1))),yN(c,n,!1),u&&yN(l,n,!0);const f=vN(s,o,a),d=vN(c,o,a),h=u&&vN(l,o,a),m=t.bitmap(),p=u&&t.bitmap();let g,v,y,b,w,x,$,k;for(v=0;v<a;++v)for(g=0;g<o;++g)w=v*o+g,x=f[w]&gN,k=d[w]&gN,$=u&&h[w]&gN,(x||$||k)&&(y=t(g),b=t(v),i||!x&&!k||m.set(y,b),u&&(x||$)&&p.set(y,b));return[m,p]}(M,r||[],o,n,g):function(t,n){const e=t.bitmap();return(n||[]).forEach((n=>e.set(t(n.boundary[0]),t(n.boundary[3])))),[e,void 0]}(M,a&&k)}const D=g?CN[l](M,A,a,s):function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=r.length;return function(n){const c=n.boundary,l=n.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>i||c[3]>o)return!1;let f,d,h,m,p,g,v,y,b,w,x,$,k,M,A,D=n.textWidth??0;for(let i=0;i<s;++i){if(f=(3&e[i])-1,d=(e[i]>>>2&3)-1,h=0===f&&0===d||r[i]<0,m=f&&d?Math.SQRT1_2:1,p=r[i]<0?-1:1,g=c[1+f]+r[i]*f*m,x=c[4+d]+p*l*d/2+r[i]*d*m,y=x-l/2,b=x+l/2,$=t(g),M=t(y),A=t(b),!D){if(!EN($,$,M,A,a,u,0,0,0,0,0,h))continue;D=gb.width(n.datum,n.datum.text)}if(w=g+p*D*f/2,g=w-D/2,v=w+D/2,$=t(g),k=t(v),EN($,k,M,A,a,u,0,0,0,0,0,h))return n.x=f?f*p<0?v:g:w,n.y=d?d*p<0?b:y:x,n.align=SN[f*p+1],n.baseline=FN[d*p+1],a.setRange($,M,k,A),!0}return!1}}(M,A,h,d);return k.forEach((t=>t.opacity=+D(t))),k}const _N=["x","y","opacity","align","baseline"],zN=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function BN(t){Oa.call(this,null,t)}BN.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:zN},{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:_N.length,default:_N}]},pt(BN,Oa,{transform(t,n){const e=t.modified();if(!(e||n.changed(n.ADD_REM)||function(){const e=t.sort;return tt(e)&&n.modified(e.fields)}()))return;t.size&&2===t.size.length||p("Size parameter should be specified as a [width, height] array.");const r=t.as||_N;return ON(n.materialize(n.SOURCE).source||[],t.size,t.sort,Q(null==t.offset?1:t.offset),Q(t.anchor||zN),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const n=t.datum;n[r[0]]=t.x,n[r[1]]=t.y,n[r[2]]=t.opacity,n[r[3]]=t.align,n[r[4]]=t.baseline})),n.reflow(e).modifies(r)}});var TN=Object.freeze({__proto__:null,label:BN});function PN(t,n){var e,r,i,o,a,u,s=[],c=function(t){return t(o)};if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}function jN(t){Oa.call(this,null,t)}jN.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}]},pt(jN,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=PN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(l),o=i.length,a=t.as||[l(t.x),l(t.y)],u=[];r.forEach((n=>{$u(n,t.x,t.y,t.bandwidth||.3).forEach((t=>{const e={};for(let t=0;t<o;++t)e[i[t]]=n.dims[t];e[a[0]]=t[0],e[a[1]]=t[1],u.push(ea(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=u}return e}});const RN={constant:lu,linear:pu,log:gu,exp:vu,pow:yu,quad:bu,poly:wu};function LN(t){Oa.call(this,null,t)}LN.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(RN)},{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}]},pt(LN,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=PN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(l),o=t.method||"linear",a=null==t.order?3:t.order,u=((t,n)=>"poly"===t?n:"quad"===t?2:1)(o,a),s=t.as||[l(t.x),l(t.y)],c=RN[o],f=[];let d=t.extent;ft(RN,o)||p("Invalid regression method: "+o),null!=d&&"log"===o&&d[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),r.forEach((e=>{if(e.length<=u)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const r=c(e,t.x,t.y,a);if(t.params)return void f.push(ea({keys:e.dims,coef:r.coef,rSquared:r.rSquared}));const l=d||ct(e,t.x),h=t=>{const n={};for(let t=0;t<i.length;++t)n[i[t]]=e.dims[t];n[s[0]]=t[0],n[s[1]]=t[1],f.push(ea(n))};"linear"===o||"constant"===o?l.forEach((t=>h([t,r.predict(t)]))):Du(r.predict,l,25,200).forEach(h)})),this.value&&(e.rem=this.value),this.value=e.add=e.source=f}return e}});var IN=Object.freeze({__proto__:null,loess:jN,regression:LN});const qN=134217729;function UN(t,n,e,r,i){let o,a,u,s,c=n[0],l=r[0],f=0,d=0;l>c==l>-c?(o=c,c=n[++f]):(o=l,l=r[++d]);let h=0;if(f<t&&d<e)for(l>c==l>-c?(a=c+o,u=o-(a-c),c=n[++f]):(a=l+o,u=o-(a-l),l=r[++d]),o=a,0!==u&&(i[h++]=u);f<t&&d<e;)l>c==l>-c?(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++f]):(a=o+l,s=a-o,u=o-(a-s)+(l-s),l=r[++d]),o=a,0!==u&&(i[h++]=u);for(;f<t;)a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++f],o=a,0!==u&&(i[h++]=u);for(;d<e;)a=o+l,s=a-o,u=o-(a-s)+(l-s),l=r[++d],o=a,0!==u&&(i[h++]=u);return 0===o&&0!==h||(i[h++]=o),h}function WN(t){return new Float64Array(t)}const HN=WN(4),GN=WN(8),YN=WN(12),VN=WN(16),XN=WN(4);function JN(t,n,e,r,i,o){const a=(n-o)*(e-i),u=(t-i)*(r-o),s=a-u,c=Math.abs(a+u);return Math.abs(s)>=33306690738754716e-32*c?s:-function(t,n,e,r,i,o,a){let u,s,c,l,f,d,h,m,p,g,v,y,b,w,x,$,k,M;const A=t-i,D=e-i,S=n-o,F=r-o;w=A*F,d=qN*A,h=d-(d-A),m=A-h,d=qN*F,p=d-(d-F),g=F-p,x=m*g-(w-h*p-m*p-h*g),$=S*D,d=qN*S,h=d-(d-S),m=S-h,d=qN*D,p=d-(d-D),g=D-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,HN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,HN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,HN[2]=y-(M-f)+(v-f),HN[3]=M;let E=function(t,n){let e=n[0];for(let t=1;t<4;t++)e+=n[t];return e}(0,HN),N=22204460492503146e-32*a;if(E>=N||-E>=N)return E;if(f=t-A,u=t-(A+f)+(f-i),f=e-D,c=e-(D+f)+(f-i),f=n-S,s=n-(S+f)+(f-o),f=r-F,l=r-(F+f)+(f-o),0===u&&0===s&&0===c&&0===l)return E;if(N=11093356479670487e-47*a+33306690738754706e-32*Math.abs(E),E+=A*l+F*u-(S*c+D*s),E>=N||-E>=N)return E;w=u*F,d=qN*u,h=d-(d-u),m=u-h,d=qN*F,p=d-(d-F),g=F-p,x=m*g-(w-h*p-m*p-h*g),$=s*D,d=qN*s,h=d-(d-s),m=s-h,d=qN*D,p=d-(d-D),g=D-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,XN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,XN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,XN[2]=y-(M-f)+(v-f),XN[3]=M;const C=UN(4,HN,4,XN,GN);w=A*l,d=qN*A,h=d-(d-A),m=A-h,d=qN*l,p=d-(d-l),g=l-p,x=m*g-(w-h*p-m*p-h*g),$=S*c,d=qN*S,h=d-(d-S),m=S-h,d=qN*c,p=d-(d-c),g=c-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,XN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,XN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,XN[2]=y-(M-f)+(v-f),XN[3]=M;const O=UN(C,GN,4,XN,YN);w=u*l,d=qN*u,h=d-(d-u),m=u-h,d=qN*l,p=d-(d-l),g=l-p,x=m*g-(w-h*p-m*p-h*g),$=s*c,d=qN*s,h=d-(d-s),m=s-h,d=qN*c,p=d-(d-c),g=c-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,XN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,XN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,XN[2]=y-(M-f)+(v-f),XN[3]=M;const _=UN(O,YN,4,XN,VN);return VN[_-1]}(t,n,e,r,i,o,c)}const KN=Math.pow(2,-52),QN=new Uint32Array(512);class ZN{static from(t,n=oC,e=aC){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=n(r),i[2*o+1]=e(r)}return new ZN(i)}constructor(t){const n=t.length>>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,c=-1/0;for(let n=0;n<o;n++){const e=t[2*n],r=t[2*n+1];e<a&&(a=e),r<u&&(u=r),e>s&&(s=e),r>c&&(c=r),this._ids[n]=n}const l=(a+s)/2,f=(u+c)/2;let d,h,m;for(let n=0,e=1/0;n<o;n++){const r=tC(l,f,t[2*n],t[2*n+1]);r<e&&(d=n,e=r)}const p=t[2*d],g=t[2*d+1];for(let n=0,e=1/0;n<o;n++){if(n===d)continue;const r=tC(p,g,t[2*n],t[2*n+1]);r<e&&r>0&&(h=n,e=r)}let v=t[2*h],y=t[2*h+1],b=1/0;for(let n=0;n<o;n++){if(n===d||n===h)continue;const e=eC(p,g,v,y,t[2*n],t[2*n+1]);e<b&&(m=n,b=e)}let w=t[2*m],x=t[2*m+1];if(b===1/0){for(let n=0;n<o;n++)this._dists[n]=t[2*n]-t[0]||t[2*n+1]-t[1];rC(this._ids,this._dists,0,o-1);const n=new Uint32Array(o);let e=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(n[e++]=i,r=o)}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(JN(p,g,v,y,w,x)<0){const t=h,n=v,e=y;h=m,v=w,y=x,m=t,w=n,x=e}const $=function(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,l=a*a+u*u,f=s*s+c*c,d=.5/(a*c-u*s);return{x:t+(c*l-u*f)*d,y:n+(a*f-s*l)*d}}(p,g,v,y,w,x);this._cx=$.x,this._cy=$.y;for(let n=0;n<o;n++)this._dists[n]=tC(t[2*n],t[2*n+1],$.x,$.y);rC(this._ids,this._dists,0,o-1),this._hullStart=d;let k=3;e[d]=n[m]=h,e[h]=n[d]=m,e[m]=n[h]=d,r[d]=0,r[h]=1,r[m]=2,i.fill(-1),i[this._hashKey(p,g)]=d,i[this._hashKey(v,y)]=h,i[this._hashKey(w,x)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let o,a,u=0;u<this._ids.length;u++){const s=this._ids[u],c=t[2*s],l=t[2*s+1];if(u>0&&Math.abs(c-o)<=KN&&Math.abs(l-a)<=KN)continue;if(o=c,a=l,s===d||s===h||s===m)continue;let f=0;for(let t=0,n=this._hashKey(c,l);t<this._hashSize&&(f=i[(n+t)%this._hashSize],-1===f||f===e[f]);t++);f=n[f];let p,g=f;for(;p=e[g],JN(c,l,t[2*g],t[2*g+1],t[2*p],t[2*p+1])>=0;)if(g=p,g===f){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,s,e[g],-1,-1,r[g]);r[s]=this._legalize(v+2),r[g]=v,k++;let y=e[g];for(;p=e[y],JN(c,l,t[2*y],t[2*y+1],t[2*p],t[2*p+1])<0;)v=this._addTriangle(y,s,p,r[s],-1,r[y]),r[s]=this._legalize(v+2),e[y]=y,k--,y=p;if(g===f)for(;p=n[g],JN(c,l,t[2*p],t[2*p+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(p,s,g,-1,r[g],r[p]),this._legalize(v+2),r[p]=v,e[g]=g,k--,g=p;this._hullStart=n[s]=g,e[g]=n[y]=s,e[s]=y,i[this._hashKey(c,l)]=s,i[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(k);for(let t=0,n=this._hullStart;t<k;t++)this.hull[t]=n,n=e[n];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(function(t,n){const e=t/(Math.abs(t)+Math.abs(n));return(n>0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=QN[--i];continue}const s=a-a%3,c=s+(a+2)%3,l=n[o],f=n[t],d=n[u+(t+1)%3],h=n[c];if(nC(r[2*l],r[2*l+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*h],r[2*h+1])){n[t]=h,n[a]=l;const r=e[c];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===c){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,c),i<QN.length&&(QN[i++]=s+(a+1)%3)}else{if(0===i)break;t=QN[--i]}}return o}_link(t,n){this._halfedges[t]=n,-1!==n&&(this._halfedges[n]=t)}_addTriangle(t,n,e,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=e,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function tC(t,n,e,r){const i=t-e,o=n-r;return i*i+o*o}function nC(t,n,e,r,i,o,a,u){const s=t-a,c=n-u,l=e-a,f=r-u,d=i-a,h=o-u,m=l*l+f*f,p=d*d+h*h;return s*(f*p-m*h)-c*(l*p-m*d)+(s*s+c*c)*(l*h-f*d)<0}function eC(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,l=a*a+u*u,f=s*s+c*c,d=.5/(a*c-u*s),h=(c*l-u*f)*d,m=(a*f-s*l)*d;return h*h+m*m}function rC(t,n,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const r=t[i],o=n[r];let a=i-1;for(;a>=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;iC(t,e+r>>1,i),n[t[e]]>n[t[r]]&&iC(t,e,r),n[t[i]]>n[t[r]]&&iC(t,i,r),n[t[e]]>n[t[i]]&&iC(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]<u);do{o--}while(n[t[o]]>u);if(o<i)break;iC(t,i,o)}t[e+1]=t[o],t[o]=a,r-i+1>=o-e?(rC(t,n,i,r),rC(t,n,e,o-1)):(rC(t,n,e,o-1),rC(t,n,i,r))}}function iC(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function oC(t){return t[0]}function aC(t){return t[1]}const uC=1e-6;class sC{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>uC||Math.abs(this._y1-i)>uC)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class cC{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let lC=class{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let r,u,s=0,c=0,l=e.length;s<l;s+=3,c+=2){const l=2*e[s],f=2*e[s+1],d=2*e[s+2],h=t[l],m=t[l+1],p=t[d],g=t[d+1],v=t[f]-h,y=t[f+1]-m,b=p-h,w=g-m,x=2*(v*w-y*b);if(Math.abs(x)<1e-9){if(void 0===i){i=o=0;for(const e of n)i+=t[2*e],o+=t[2*e+1];i/=n.length,o/=n.length}const e=1e9*Math.sign((i-h)*w-(o-m)*b);r=(h+p)/2-e*w,u=(m+g)/2+e*b}else{const t=1/x,n=v*v+y*y,e=b*b+w*w;r=h+(w*n-y*e)*t,u=m+(v*e-b*n)*t}a[c]=r,a[c+1]=u}let u,s,c,l=n[n.length-1],f=4*l,d=t[2*l],h=t[2*l+1];r.fill(0);for(let e=0;e<n.length;++e)l=n[e],u=f,s=d,c=h,f=4*l,d=t[2*l],h=t[2*l+1],r[u+2]=r[f]=c-h,r[u+3]=r[f+1]=d-s}render(t){const n=null==t?t=new sC:void 0,{delaunay:{halfedges:e,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let n=0,r=e.length;n<r;++n){const r=e[n];if(r<n)continue;const i=2*Math.floor(n/3),a=2*Math.floor(r/3);this._renderSegment(o[i],o[i+1],o[a],o[a+1],t)}let u,s=i[i.length-1];for(let n=0;n<i.length;++n){u=s,s=i[n];const e=2*Math.floor(r[s]/3),c=o[e],l=o[e+1],f=4*u,d=this._project(c,l,a[f+2],a[f+3]);d&&this._renderSegment(c,l,d[0],d[1],t)}return n&&n.value()}renderBounds(t){const n=null==t?t=new sC:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const e=null==n?n=new sC:void 0,r=this._clip(t);if(null===r||!r.length)return;n.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||n.lineTo(r[t],r[t+1]);return n.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,e=t.length/2;n<e;++n){const t=this.cellPolygon(n);t&&(t.index=n,yield t)}}cellPolygon(t){const n=new cC;return this.renderCell(t,n),n.value()}_renderSegment(t,n,e,r,i){let o;const a=this._regioncode(t,n),u=this._regioncode(e,r);0===a&&0===u?(i.moveTo(t,n),i.lineTo(e,r)):(o=this._clipSegment(t,n,e,r,a,u))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,n,e){return(n=+n)==n&&(e=+e)==e&&this.delaunay._step(t,n,e)===t}*neighbors(t){const n=this._clip(t);if(n)for(const e of this.delaunay.neighbors(t)){const t=this._clip(e);if(t)t:for(let r=0,i=n.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(n[r]===t[o]&&n[r+1]===t[o+1]&&n[(r+2)%i]===t[(o+a-2)%a]&&n[(r+3)%i]===t[(o+a-1)%a]){yield e;break t}}}_cell(t){const{circumcenters:n,delaunay:{inedges:e,halfedges:r,triangles:i}}=this,o=e[t];if(-1===o)return null;const a=[];let u=o;do{const e=Math.floor(u/3);if(a.push(n[2*e],n[2*e+1]),u=u%3==2?u-2:u+1,i[u]!==t)break;u=r[u]}while(u!==o&&-1!==u);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 n=this._cell(t);if(null===n)return null;const{vectors:e}=this,r=4*t;return this._simplify(e[r]||e[r+1]?this._clipInfinite(t,n,e[r],e[r+1],e[r+2],e[r+3]):this._clipFinite(t,n))}_clipFinite(t,n){const e=n.length;let r,i,o,a,u=null,s=n[e-2],c=n[e-1],l=this._regioncode(s,c),f=0;for(let d=0;d<e;d+=2)if(r=s,i=c,s=n[d],c=n[d+1],o=l,l=this._regioncode(s,c),0===o&&0===l)a=f,f=0,u?u.push(s,c):u=[s,c];else{let n,e,d,h,m;if(0===o){if(null===(n=this._clipSegment(r,i,s,c,o,l)))continue;[e,d,h,m]=n}else{if(null===(n=this._clipSegment(s,c,r,i,l,o)))continue;[h,m,e,d]=n,a=f,f=this._edgecode(e,d),a&&f&&this._edge(t,a,f,u,u.length),u?u.push(e,d):u=[e,d]}a=f,f=this._edgecode(h,m),a&&f&&this._edge(t,a,f,u,u.length),u?u.push(h,m):u=[h,m]}if(u)a=f,f=this._edgecode(u[0],u[1]),a&&f&&this._edge(t,a,f,u,u.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 u}_clipSegment(t,n,e,r,i,o){const a=i<o;for(a&&([t,n,e,r,i,o]=[e,r,t,n,o,i]);;){if(0===i&&0===o)return a?[e,r,t,n]:[t,n,e,r];if(i&o)return null;let u,s,c=i||o;8&c?(u=t+(e-t)*(this.ymax-n)/(r-n),s=this.ymax):4&c?(u=t+(e-t)*(this.ymin-n)/(r-n),s=this.ymin):2&c?(s=n+(r-n)*(this.xmax-t)/(e-t),u=this.xmax):(s=n+(r-n)*(this.xmin-t)/(e-t),u=this.xmin),i?i=this._regioncode(t=u,n=s):o=this._regioncode(e=u,r=s)}}_clipInfinite(t,n,e,r,i,o){let a,u=Array.from(n);if((a=this._project(u[0],u[1],e,r))&&u.unshift(a[0],a[1]),(a=this._project(u[u.length-2],u[u.length-1],i,o))&&u.push(a[0],a[1]),u=this._clipFinite(t,u))for(let n,e=0,r=u.length,i=this._edgecode(u[r-2],u[r-1]);e<r;e+=2)n=i,i=this._edgecode(u[e],u[e+1]),n&&i&&(e=this._edge(t,n,i,u,e),r=u.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(u=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return u}_edge(t,n,e,r,i){for(;n!==e;){let e,o;switch(n){case 5:n=4;continue;case 4:n=6,e=this.xmax,o=this.ymin;break;case 6:n=2;continue;case 2:n=10,e=this.xmax,o=this.ymax;break;case 10:n=8;continue;case 8:n=9,e=this.xmin,o=this.ymax;break;case 9:n=1;continue;case 1:n=5,e=this.xmin,o=this.ymin}r[i]===e&&r[i+1]===o||!this.contains(t,e,o)||(r.splice(i,0,e,o),i+=2)}return i}_project(t,n,e,r){let i,o,a,u=1/0;if(r<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/r)<u&&(a=this.ymin,o=t+(u=i)*e)}else if(r>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)<u&&(a=this.ymax,o=t+(u=i)*e)}if(e>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)<u&&(o=this.xmax,a=n+(u=i)*r)}else if(e<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/e)<u&&(o=this.xmin,a=n+(u=i)*r)}return[o,a]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const e=(n+2)%t.length,r=(n+4)%t.length;(t[n]===t[e]&&t[e]===t[r]||t[n+1]===t[e+1]&&t[e+1]===t[r+1])&&(t.splice(e,2),n-=2)}t.length||(t=null)}return t}};const fC=2*Math.PI,dC=Math.pow;function hC(t){return t[0]}function mC(t){return t[1]}function pC(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class gC{static from(t,n=hC,e=mC,r){return new gC("length"in t?function(t,n,e,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=n.call(r,i,a,t),o[2*a+1]=e.call(r,i,a,t)}return o}(t,n,e,r):Float64Array.from(function*(t,n,e,r){let i=0;for(const o of t)yield n.call(r,o,i,t),yield e.call(r,o,i,t),++i}(t,n,e,r)))}constructor(t){this._delaunator=new ZN(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t<n.length;t+=3){const r=2*n[t],i=2*n[t+1],o=2*n[t+2];if((e[o]-e[r])*(e[i+1]-e[r+1])-(e[i]-e[r])*(e[o+1]-e[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},((t,n)=>n)).sort(((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,e=n.length/2;t<e;++t){const e=pC(n[2*t],n[2*t+1],i);n[2*t]=e[0],n[2*t+1]=e[1]}this._delaunator=new ZN(n)}else delete this.collinear;const e=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,n=e.length;t<n;++t){const n=i[t%3==2?t-2:t+1];-1!==e[t]&&-1!==o[n]||(o[n]=t)}for(let t=0,n=r.length;t<n;++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 lC(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const n=a.indexOf(t);return n>0&&(yield a[n-1]),void(n<a.length-1&&(yield a[n+1]))}const u=n[t];if(-1===u)return;let s=u,c=-1;do{if(yield c=o[s],s=s%3==2?s-2:s+1,o[s]!==t)return;if(s=i[s],-1===s){const n=e[(r[t]+1)%e.length];return void(n!==c&&(yield n))}}while(s!==u)}find(t,n,e=0){if((t=+t)!=t||(n=+n)!=n)return-1;const r=e;let i;for(;(i=this._step(e,t,n))>=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let c=t,l=dC(n-s[2*t],2)+dC(e-s[2*t+1],2);const f=r[t];let d=f;do{let r=u[d];const f=dC(n-s[2*r],2)+dC(e-s[2*r+1],2);if(f<l&&(l=f,c=r),d=d%3==2?d-2:d+1,u[d]!==t)break;if(d=a[d],-1===d){if(d=i[(o[t]+1)%i.length],d!==r&&dC(n-s[2*d],2)+dC(e-s[2*d+1],2)<l)return d;break}}while(d!==f);return c}render(t){const n=null==t?t=new sC:void 0,{points:e,halfedges:r,triangles:i}=this;for(let n=0,o=r.length;n<o;++n){const o=r[n];if(o<n)continue;const a=2*i[n],u=2*i[o];t.moveTo(e[a],e[a+1]),t.lineTo(e[u],e[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){void 0!==n||t&&"function"==typeof t.moveTo||(n=t,t=null),n=null==n?2:+n;const e=null==t?t=new sC:void 0,{points:r}=this;for(let e=0,i=r.length;e<i;e+=2){const i=r[e],o=r[e+1];t.moveTo(i+n,o),t.arc(i,o,n,0,fC)}return e&&e.value()}renderHull(t){const n=null==t?t=new sC:void 0,{hull:e,points:r}=this,i=2*e[0],o=e.length;t.moveTo(r[i],r[i+1]);for(let n=1;n<o;++n){const i=2*e[n];t.lineTo(r[i],r[i+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new cC;return this.renderHull(t),t.value()}renderTriangle(t,n){const e=null==n?n=new sC:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],u=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,e=t.length/3;n<e;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new cC;return this.renderTriangle(t,n),n.value()}}function vC(t){Oa.call(this,null,t)}vC.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 yC=[-1e5,-1e5,1e5,1e5];function bC(t){const n=t[0][0],e=t[0][1];let r=t.length-1;for(;t[r][0]===n&&t[r][1]===e;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}pt(vC,Oa,{transform(t,n){const e=t.as||"path",r=n.source;if(!r||!r.length)return n;let i=t.size;i=i?[0,0,i[0],i[1]]:(i=t.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:yC;const o=this.value=gC.from(r,t.x,t.y).voronoi(i);for(let t=0,n=r.length;t<n;++t){const n=o.cellPolygon(t);r[t][e]=!n||2===(a=n).length&&a[0][0]===a[1][0]&&a[0][1]===a[1][1]?null:bC(n)}var a;return n.reflow(t.modified()).modifies(e)}});var wC=Object.freeze({__proto__:null,voronoi:vC}),xC=Math.PI/180,$C=2048;function kC(t,n,e,r){if(!n.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,$C/o);var a,u,s,c,l,f=0,d=0,h=0,m=e.length;for(--r;++r<m;){if(n=e[r],i.save(),i.font=n.style+" "+n.weight+" "+~~((n.size+1)/o)+"px "+n.font,a=i.measureText(n.text+"m").width*o,s=n.size<<1,n.rotate){var p=Math.sin(n.rotate*xC),g=Math.cos(n.rotate*xC),v=a*g,y=a*p,b=s*g,w=s*p;a=Math.max(Math.abs(v+w),Math.abs(v-w))+31>>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else a=a+31>>5<<5;if(s>h&&(h=s),f+a>=2048&&(f=0,d+=h,h=0),d+s>=$C)break;i.translate((f+(a>>1))/o,(d+(s>>1))/o),n.rotate&&i.rotate(n.rotate*xC),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=a,n.height=s,n.xoff=f,n.yoff=d,n.x1=a>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=a}for(var x=i.getImageData(0,0,2048/o,$C/o).data,$=[];--r>=0;)if((n=e[r]).hasText){for(u=(a=n.width)>>5,s=n.y1-n.y0,c=0;c<s*u;c++)$[c]=0;if(null==(f=n.xoff))return;d=n.yoff;var k=0,M=-1;for(l=0;l<s;l++){for(c=0;c<a;c++){var A=x[2048*(d+l)+(f+c)<<2]?1<<31-c%32:0;$[u*l+(c>>5)]|=A,k|=A}k?M=l:(n.y0++,s--,l--,d++)}n.y1=n.y0+M,n.sprite=$.slice(0,(n.y1-n.y0)*u)}}}function MC(t,n,e){for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,c=t.y1-t.y0,l=(t.y+t.y0)*(e>>=5)+(a>>5),f=0;f<c;f++){r=0;for(var d=0;d<=o;d++)if((r<<s|(d<o?(r=i[f*o+d])>>>u:0))&n[l+d])return!0;l+=e}return!1}function AC(t,n){var e=t[0],r=t[1];n.x+n.x0<e.x&&(e.x=n.x+n.x0),n.y+n.y0<e.y&&(e.y=n.y+n.y0),n.x+n.x1>r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function DC(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0<n[1].x&&t.y+t.y1>n[0].y&&t.y+t.y0<n[1].y}function SC(t){var n=t[0]/t[1];return function(t){return[n*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function FC(t){return"function"==typeof t?t:function(){return t}}var EC={archimedean:SC,rectangular:function(t){var n=4*t[0]/t[1],e=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:e+=n;break;case 1:r+=4;break;case 2:e-=n;break;default:r-=4}return[e,r]}}};const NC=["x","y","font","fontSize","fontStyle","fontWeight","angle"],CC=["text","font","rotate","fontSize","fontStyle","fontWeight"];function OC(t){Oa.call(this,function(){var t,n,e,r,i,o,a,u=[256,256],s=SC,c=[],l=Math.random,f={};function d(t,n,e){for(var r,i,o,a=n.x,c=n.y,f=Math.hypot(u[0],u[1]),d=s(u),h=l()<.5?1:-1,m=-h;(r=d(m+=h))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=f));)if(n.x=a+i,n.y=c+o,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>u[0]||n.y+n.y1>u[1])&&(!e||!MC(n,t,u[0]))&&(!e||DC(n,e))){for(var p,g=n.sprite,v=n.width>>5,y=u[0]>>5,b=n.x-(v<<4),w=127&b,x=32-w,$=n.y1-n.y0,k=(n.y+n.y0)*y+(b>>5),M=0;M<$;M++){p=0;for(var A=0;A<=v;A++)t[k+A]|=p<<x|(A<v?(p=g[M*v+A])>>>w:0);k+=y}return n.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/n,t.height=$C/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(hl()),f=function(t){for(var n=[],e=-1;++e<t;)n[e]=0;return n}((u[0]>>5)*u[1]),h=null,m=c.length,p=-1,g=[],v=c.map((u=>({text:t(u),font:n(u),style:r(u),weight:i(u),rotate:o(u),size:~~(e(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,n)=>n.size-t.size));++p<m;){var y=v[p];y.x=u[0]*(l()+.5)>>1,y.y=u[1]*(l()+.5)>>1,kC(s,y,v,p),y.hasText&&d(f,y,h)&&(g.push(y),h?AC(h,y):h=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},f.words=function(t){return arguments.length?(c=t,f):c},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(n=FC(t),f):n},f.fontStyle=function(t){return arguments.length?(r=FC(t),f):r},f.fontWeight=function(t){return arguments.length?(i=FC(t),f):i},f.rotate=function(t){return arguments.length?(o=FC(t),f):o},f.text=function(n){return arguments.length?(t=FC(n),f):t},f.spiral=function(t){return arguments.length?(s=EC[t]||t,f):s},f.fontSize=function(t){return arguments.length?(e=FC(t),f):e},f.padding=function(t){return arguments.length?(a=FC(t),f):a},f.random=function(t){return arguments.length?(l=t,f):l},f}(),t)}OC.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:NC}]},pt(OC,Oa,{transform(t,n){!t.size||t.size[0]&&t.size[1]||p("Wordcloud size dimensions must be non-zero.");const e=t.modified();if(!(e||n.changed(n.ADD_REM)||CC.some((function(e){const r=t[e];return tt(r)&&n.modified(r.fields)}))))return;const r=n.materialize(n.SOURCE).source,i=this.value,o=t.as||NC;let a,u=t.fontSize||14;if(tt(u)?a=t.fontSizeRange:u=at(u),a){const t=u,n=ng("sqrt")().domain(ct(r,t)).range(a);u=e=>n(t(e))}r.forEach((t=>{t[o[0]]=NaN,t[o[1]]=NaN,t[o[3]]=0}));const s=i.words(r).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(u).random(Ia).layout(),c=i.size(),l=c[0]>>1,f=c[1]>>1,d=s.length;for(let t,n,e=0;e<d;++e)t=s[e],n=t.datum,n[o[0]]=t.x+l,n[o[1]]=t.y+f,n[o[2]]=t.font,n[o[3]]=t.size,n[o[4]]=t.style,n[o[5]]=t.weight,n[o[6]]=t.rotate;return n.reflow(e).modifies(o)}});var _C=Object.freeze({__proto__:null,wordcloud:OC});const zC=t=>new Uint8Array(t),BC=t=>new Uint16Array(t),TC=t=>new Uint32Array(t);function PC(t,n,e){const r=(n<257?zC:n<65537?BC:TC)(t);return e&&r.set(e),r}function jC(t,n,e){const r=1<<n;return{one:r,zero:~r,range:e.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd(t,n){const e=this,i=e.bisect(e.range,t.value),o=t.index,a=i[0],u=i[1],s=o.length;let c;for(c=0;c<a;++c)n[o[c]]|=r;for(c=u;c<s;++c)n[o[c]]|=r;return e}}}function RC(){let t=TC(0),n=[],e=0;return{insert:function(r,i,o){if(!i.length)return[];const a=e,u=i.length,s=TC(u);let c,l,f,d=Array(u);for(f=0;f<u;++f)d[f]=r(i[f]),s[f]=f;if(d=function(t,n){return t.sort.call(n,((n,e)=>{const r=t[n],i=t[e];return r<i?-1:r>i?1:0})),function(t,n){return Array.from(n,(n=>t[n]))}(t,n)}(d,s),a)c=n,l=t,n=Array(a+u),t=TC(a+u),function(t,n,e,r,i,o,a,u,s){let c,l=0,f=0;for(c=0;l<r&&f<a;++c)n[l]<i[f]?(u[c]=n[l],s[c]=e[l++]):(u[c]=i[f],s[c]=o[f++]+t);for(;l<r;++l,++c)u[c]=n[l],s[c]=e[l];for(;f<a;++f,++c)u[c]=i[f],s[c]=o[f]+t}(o,c,l,a,d,s,u,n,t);else{if(o>0)for(f=0;f<u;++f)s[f]+=o;n=d,t=s}return e=a+u,{index:s,value:d}},remove:function(r,i){const o=e;let a,u,s;for(u=0;!i[t[u]]&&u<o;++u);for(s=u;u<o;++u)i[a=t[u]]||(t[s]=a,n[s]=n[u],++s);e=o-r},bisect:function(t,r){let i;return r?i=r.length:(r=n,i=e),[on(r,t[0],0,i),rn(r,t[1],0,i)]},reindex:function(n){for(let r=0,i=e;r<i;++r)t[r]=n[t[r]]},index:()=>t,size:()=>e}}function LC(t){Oa.call(this,function(){let t=8,n=[],e=TC(0),r=PC(0,t),i=PC(0,t);return{data:()=>n,seen:()=>e=function(t,n,e){return t.length>=n?t:((e=e||new t.constructor(n)).set(t),e)}(e,n.length),add(t){for(let e,r=0,i=n.length,o=t.length;r<o;++r)e=t[r],e._index=i++,n.push(e)},remove(t,e){const o=n.length,a=Array(o-t),u=n;let s,c,l;for(c=0;!e[c]&&c<o;++c)a[c]=n[c],u[c]=c;for(l=c;c<o;++c)s=n[c],e[c]?u[c]=-1:(u[c]=l,r[l]=r[c],i[l]=i[c],a[l]=s,s._index=l++),r[c]=0;return n=a,u},size:()=>n.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,n){r[t]|=n},clear(t,n){r[t]&=~n},resize(n,e){(n>r.length||e>t)&&(t=Math.max(e,t),r=PC(n,t,r),i=PC(n,t))}}}(),t),this._indices=null,this._dims=null}function IC(t){Oa.call(this,null,t)}LC.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}}]},pt(LC,Oa,{transform(t,n){return this._dims?t.modified("fields")||t.fields.some((t=>n.modified(t.fields)))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},init(t,n){const e=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,c=0;for(;c<a;++c)u=e[c].fname,s=i[u]||(i[u]=RC()),o.push(jC(s,c,r[c]));return this.eval(t,n)},reinit(t,n){const e=n.materialize().fork(),r=t.fields,i=t.query,o=this._indices,a=this._dims,u=this.value,s=u.curr(),c=u.prev(),l=u.all(),f=e.rem=e.add,d=e.mod,h=i.length,m={};let p,g,v,y,b,w,x,$,k;if(c.set(s),n.rem.length&&(b=this.remove(t,n,e)),n.add.length&&u.add(n.add),n.mod.length)for(w={},y=n.mod,x=0,$=y.length;x<$;++x)w[y[x]._index]=1;for(x=0;x<h;++x)k=r[x],(!a[x]||t.modified("fields",x)||n.modified(k.fields))&&(v=k.fname,(p=m[v])||(o[v]=g=RC(),m[v]=p=g.insert(k,n.source,0)),a[x]=jC(g,x,i[x]).onAdd(p,s));for(x=0,$=u.data().length;x<$;++x)b[x]||(c[x]!==s[x]?f.push(x):w[x]&&s[x]!==l&&d.push(x));return u.mask=(1<<h)-1,e},eval(t,n){const e=n.materialize().fork(),r=this._dims.length;let i=0;return n.rem.length&&(this.remove(t,n,e),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,n,e)),n.add.length&&(this.insert(t,n,e),i|=(1<<r)-1),n.mod.length&&(this.modify(n,e),i|=(1<<r)-1),this.value.mask=i,e},insert(t,n,e){const r=n.add,i=this.value,o=this._dims,a=this._indices,u=t.fields,s={},c=e.add,l=i.size()+r.length,f=o.length;let d,h,m,p=i.size();i.resize(l,f),i.add(r);const g=i.curr(),v=i.prev(),y=i.all();for(d=0;d<f;++d)h=u[d].fname,m=s[h]||(s[h]=a[h].insert(u[d],r,p)),o[d].onAdd(m,g);for(;p<l;++p)v[p]=y,g[p]!==y&&c.push(p)},modify(t,n){const e=n.mod,r=this.value,i=r.curr(),o=r.all(),a=t.mod;let u,s,c;for(u=0,s=a.length;u<s;++u)c=a[u]._index,i[c]!==o&&e.push(c)},remove(t,n,e){const r=this._indices,i=this.value,o=i.curr(),a=i.prev(),u=i.all(),s={},c=e.rem,l=n.rem;let f,d,h,m;for(f=0,d=l.length;f<d;++f)h=l[f]._index,s[h]=1,a[h]=m=o[h],o[h]=u,m!==u&&c.push(h);for(h in r)r[h].remove(d,s);return this.reindex(n,d,s),s},reindex(t,n,e){const r=this._indices,i=this.value;t.runAfter((()=>{const t=i.remove(n,e);for(const n in r)r[n].reindex(t)}))},update(t,n,e){const r=this._dims,i=t.query,o=n.stamp,a=r.length;let u,s,c=0;for(e.filters=0,s=0;s<a;++s)t.modified("query",s)&&(u=s,++c);if(1===c)c=r[u].one,this.incrementOne(r[u],i[u],e.add,e.rem);else for(s=0,c=0;s<a;++s)t.modified("query",s)&&(c|=r[s].one,this.incrementAll(r[s],i[s],o,e.add),e.rem=e.add);return c},incrementAll(t,n,e,r){const i=this.value,o=i.seen(),a=i.curr(),u=i.prev(),s=t.index(),c=t.bisect(t.range),l=t.bisect(n),f=l[0],d=l[1],h=c[0],m=c[1],p=t.one;let g,v,y;if(f<h)for(g=f,v=Math.min(h,d);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(f>h)for(g=h,v=Math.min(f,m);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;if(d>m)for(g=Math.max(f,m),v=d;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(d<m)for(g=Math.max(h,d),v=m;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;t.range=n.slice()},incrementOne(t,n,e,r){const i=this.value.curr(),o=t.index(),a=t.bisect(t.range),u=t.bisect(n),s=u[0],c=u[1],l=a[0],f=a[1],d=t.one;let h,m,p;if(s<l)for(h=s,m=Math.min(l,c);h<m;++h)p=o[h],i[p]^=d,e.push(p);else if(s>l)for(h=l,m=Math.min(s,f);h<m;++h)p=o[h],i[p]^=d,r.push(p);if(c>f)for(h=Math.max(s,f),m=c;h<m;++h)p=o[h],i[p]^=d,e.push(p);else if(c<f)for(h=Math.max(l,c),m=f;h<m;++h)p=o[h],i[p]^=d,r.push(p);t.range=n.slice()}}),IC.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."}]},pt(IC,Oa,{transform(t,n){const e=~(t.ignore||0),r=t.filter,i=r.mask;if(!(i&e))return n.StopPropagation;const o=n.fork(n.ALL),a=r.data(),u=r.curr(),s=r.prev(),c=t=>u[t]&e?null:a[t];return o.filter(o.MOD,c),i&i-1?(o.filter(o.ADD,(t=>{const n=u[t]&e;return!n&&n^s[t]&e?a[t]:null})),o.filter(o.REM,(t=>!(u[t]&e)||s[t]&e?null:a[t]))):(o.filter(o.ADD,c),o.filter(o.REM,(t=>(u[t]&e)===i?a[t]:null))),o.filter(o.SOURCE,(t=>c(t._index)))}});var qC=Object.freeze({__proto__:null,crossfilter:LC,resolvefilter:IC});const UC="Literal",WC="CallExpression";function HC(t){this.type=t}var GC,YC,VC,XC,JC;HC.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case WC:return[t.callee].concat(t.arguments);case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];default:return[]}}(this),e=0,r=n.length;e<r;++e)if(n[e].visit(t))return 1},(GC={})[1]="Boolean",GC[2]="<end>",GC[3]="Identifier",GC[4]="Keyword",GC[5]="Null",GC[6]="Numeric",GC[7]="Punctuator",GC[8]="String",GC[9]="RegularExpression";var KC="Identifier",QC="Unexpected token %0",ZC="Invalid regular expression",tO="Invalid regular expression: missing /",nO="Octal literals are not allowed in strict mode.",eO="ILLEGAL",rO="Disabled.",iO=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]"),oO=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 aO(t,n){if(!t)throw new Error("ASSERT: "+n)}function uO(t){return t>=48&&t<=57}function sO(t){return"0123456789abcdefABCDEF".includes(t)}function cO(t){return"01234567".includes(t)}function lO(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 fO(t){return 10===t||13===t||8232===t||8233===t}function dO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&iO.test(String.fromCharCode(t))}function hO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&oO.test(String.fromCharCode(t))}const mO={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 pO(){for(;VC<XC;){const t=YC.charCodeAt(VC);if(!lO(t)&&!fO(t))break;++VC}}function gO(t){var n,e,r,i=0;for(e="u"===t?4:2,n=0;n<e;++n)VC<XC&&sO(YC[VC])?(r=YC[VC++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):NO({},QC,eO);return String.fromCharCode(i)}function vO(){var t,n;for(n=0,"}"===(t=YC[VC])&&NO({},QC,eO);VC<XC&&sO(t=YC[VC++]);)n=16*n+"0123456789abcdef".indexOf(t.toLowerCase());return(n>1114111||"}"!==t)&&NO({},QC,eO),n<=65535?String.fromCharCode(n):String.fromCharCode(55296+(n-65536>>10),56320+(n-65536&1023))}function yO(){var t,n;for(t=YC.charCodeAt(VC++),n=String.fromCharCode(t),92===t&&(117!==YC.charCodeAt(VC)&&NO({},QC,eO),++VC,(t=gO("u"))&&"\\"!==t&&dO(t.charCodeAt(0))||NO({},QC,eO),n=t);VC<XC&&hO(t=YC.charCodeAt(VC));)++VC,n+=String.fromCharCode(t),92===t&&(n=n.substr(0,n.length-1),117!==YC.charCodeAt(VC)&&NO({},QC,eO),++VC,(t=gO("u"))&&"\\"!==t&&hO(t.charCodeAt(0))||NO({},QC,eO),n+=t);return n}function bO(){var t,n,e,r,i=VC,o=YC.charCodeAt(VC),a=YC[VC];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++VC,{type:7,value:String.fromCharCode(o),start:i,end:VC};default:if(61===(t=YC.charCodeAt(VC+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return VC+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:VC};case 33:case 61:return 61===YC.charCodeAt(VC+=2)&&++VC,{type:7,value:YC.slice(i,VC),start:i,end:VC}}}return">>>="===(r=YC.substr(VC,4))?{type:7,value:r,start:i,end:VC+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:7,value:e,start:i,end:VC+=3}:a===(n=e.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===n?{type:7,value:n,start:i,end:VC+=2}:("//"===n&&NO({},QC,eO),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:i,end:++VC}:void NO({},QC,eO))}function wO(){var t,n,e;if(aO(uO((e=YC[VC]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=VC,t="","."!==e){if(t=YC[VC++],e=YC[VC],"0"===t){if("x"===e||"X"===e)return++VC,function(t){let n="";for(;VC<XC&&sO(YC[VC]);)n+=YC[VC++];return 0===n.length&&NO({},QC,eO),dO(YC.charCodeAt(VC))&&NO({},QC,eO),{type:6,value:parseInt("0x"+n,16),start:t,end:VC}}(n);if(cO(e))return function(t){let n="0"+YC[VC++];for(;VC<XC&&cO(YC[VC]);)n+=YC[VC++];return(dO(YC.charCodeAt(VC))||uO(YC.charCodeAt(VC)))&&NO({},QC,eO),{type:6,value:parseInt(n,8),octal:!0,start:t,end:VC}}(n);e&&uO(e.charCodeAt(0))&&NO({},QC,eO)}for(;uO(YC.charCodeAt(VC));)t+=YC[VC++];e=YC[VC]}if("."===e){for(t+=YC[VC++];uO(YC.charCodeAt(VC));)t+=YC[VC++];e=YC[VC]}if("e"===e||"E"===e)if(t+=YC[VC++],"+"!==(e=YC[VC])&&"-"!==e||(t+=YC[VC++]),uO(YC.charCodeAt(VC)))for(;uO(YC.charCodeAt(VC));)t+=YC[VC++];else NO({},QC,eO);return dO(YC.charCodeAt(VC))&&NO({},QC,eO),{type:6,value:parseFloat(t),start:n,end:VC}}function xO(){if(pO(),VC>=XC)return{type:2,start:VC,end:VC};const t=YC.charCodeAt(VC);return dO(t)?function(){var t,n;return t=VC,n=92===YC.charCodeAt(VC)?yO():function(){var t,n;for(t=VC++;VC<XC;){if(92===(n=YC.charCodeAt(VC)))return VC=t,yO();if(!hO(n))break;++VC}return YC.slice(t,VC)}(),{type:1===n.length?3:mO.hasOwnProperty(n)?4:"null"===n?5:"true"===n||"false"===n?1:3,value:n,start:t,end:VC}}():40===t||41===t||59===t?bO():39===t||34===t?function(){var t,n,e,r,i="",o=!1;for(aO("'"===(t=YC[VC])||'"'===t,"String literal must starts with a quote"),n=VC,++VC;VC<XC;){if((e=YC[VC++])===t){t="";break}if("\\"===e)if((e=YC[VC++])&&fO(e.charCodeAt(0)))"\r"===e&&"\n"===YC[VC]&&++VC;else switch(e){case"u":case"x":"{"===YC[VC]?(++VC,i+=vO()):i+=gO(e);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:cO(e)?(0!==(r="01234567".indexOf(e))&&(o=!0),VC<XC&&cO(YC[VC])&&(o=!0,r=8*r+"01234567".indexOf(YC[VC++]),"0123".includes(e)&&VC<XC&&cO(YC[VC])&&(r=8*r+"01234567".indexOf(YC[VC++]))),i+=String.fromCharCode(r)):i+=e}else{if(fO(e.charCodeAt(0)))break;i+=e}}return""!==t&&NO({},QC,eO),{type:8,value:i,octal:o,start:n,end:VC}}():46===t?uO(YC.charCodeAt(VC+1))?wO():bO():uO(t)?wO():bO()}function $O(){const t=JC;return VC=t.end,JC=xO(),VC=t.end,t}function kO(){const t=VC;JC=xO(),VC=t}function MO(t,n,e){const r=new HC("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=n,r.right=e,r}function AO(t,n){const e=new HC("CallExpression");return e.callee=t,e.arguments=n,e}function DO(t){const n=new HC(KC);return n.name=t,n}function SO(t){const n=new HC("Literal");return n.value=t.value,n.raw=YC.slice(t.start,t.end),t.regex&&("//"===n.raw&&(n.raw="/(?:)/"),n.regex=t.regex),n}function FO(t,n,e){const r=new HC("MemberExpression");return r.computed="["===t,r.object=n,r.property=e,r.computed||(e.member=!0),r}function EO(t,n,e){const r=new HC("Property");return r.key=n,r.value=e,r.kind=t,r}function NO(t,n){var e,r=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,((t,n)=>(aO(n<r.length,"Message reference must be in range"),r[n])));throw(e=new Error(i)).index=VC,e.description=i,e}function CO(t){2===t.type&&NO(t,"Unexpected end of input"),6===t.type&&NO(t,"Unexpected number"),8===t.type&&NO(t,"Unexpected string"),3===t.type&&NO(t,"Unexpected identifier"),4===t.type&&NO(t,"Unexpected reserved word"),NO(t,QC,t.value)}function OO(t){const n=$O();7===n.type&&n.value===t||CO(n)}function _O(t){return 7===JC.type&&JC.value===t}function zO(t){return 4===JC.type&&JC.value===t}function BO(){VC=JC.start;const t=$O();return 8===t.type||6===t.type?(t.octal&&NO(t,nO),SO(t)):DO(t.value)}function TO(){var t,n,e;return VC=JC.start,3===(t=JC).type?(e=BO(),OO(":"),EO("init",e,WO())):2!==t.type&&7!==t.type?(n=BO(),OO(":"),EO("init",n,WO())):void CO(t)}const PO={if:1};function jO(){var t,n,e;if(_O("("))return function(){OO("(");const t=HO();return OO(")"),t}();if(_O("["))return function(){const t=[];for(VC=JC.start,OO("[");!_O("]");)_O(",")?($O(),t.push(null)):(t.push(WO()),_O("]")||OO(","));return $O(),function(t){const n=new HC("ArrayExpression");return n.elements=t,n}(t)}();if(_O("{"))return function(){var t,n,e=[],r={},i=String;for(VC=JC.start,OO("{");!_O("}");)n="$"+((t=TO()).key.type===KC?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,n)?NO({},"Duplicate data property in object literal not allowed in strict mode"):r[n]=!0,e.push(t),_O("}")||OO(",");return OO("}"),function(t){const n=new HC("ObjectExpression");return n.properties=t,n}(e)}();if(VC=JC.start,3===(t=JC.type)||PO[JC.value])e=DO($O().value);else if(8===t||6===t)JC.octal&&NO(JC,nO),e=SO($O());else{if(4===t)throw new Error(rO);1===t?((n=$O()).value="true"===n.value,e=SO(n)):5===t?((n=$O()).value=null,e=SO(n)):_O("/")||_O("/=")?(e=SO(function(){var t,n,e,r;return JC=null,pO(),t=VC,n=function(){var t,n,e,r;for(aO("/"===(t=YC[VC]),"Regular expression literal must start with a slash"),n=YC[VC++],e=!1,r=!1;VC<XC;)if(n+=t=YC[VC++],"\\"===t)fO((t=YC[VC++]).charCodeAt(0))&&NO({},tO),n+=t;else if(fO(t.charCodeAt(0)))NO({},tO);else if(e)"]"===t&&(e=!1);else{if("/"===t){r=!0;break}"["===t&&(e=!0)}return r||NO({},tO),{value:n.substr(1,n.length-2),literal:n}}(),e=function(){var t,n,e;for(n="",e="";VC<XC&&hO((t=YC[VC]).charCodeAt(0));)++VC,"\\"===t&&VC<XC?NO({},QC,eO):(e+=t,n+=t);return e.search(/[^gimuy]/g)>=0&&NO({},ZC,e),{value:e,literal:n}}(),r=function(t,n){let e=t;n.includes("u")&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,n)=>{if(parseInt(n,16)<=1114111)return"x";NO({},ZC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:VC}}()),kO()):CO($O())}return e}function RO(){const t=[];if(OO("("),!_O(")"))for(;VC<XC&&(t.push(WO()),!_O(")"));)OO(",");return OO(")"),t}function LO(){OO("[");const t=HO();return OO("]"),t}function IO(){const t=function(){var t;for(t=jO();;)if(_O("."))t=FO(".",t,(OO("."),function(){VC=JC.start;const t=$O();return function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t)||CO(t),DO(t.value)}()));else if(_O("("))t=AO(t,RO());else{if(!_O("["))break;t=FO("[",t,LO())}return t}();if(7===JC.type&&(_O("++")||_O("--")))throw new Error(rO);return t}function qO(){var t,n;if(7!==JC.type&&4!==JC.type)n=IO();else{if(_O("++")||_O("--"))throw new Error(rO);if(_O("+")||_O("-")||_O("~")||_O("!"))t=$O(),n=qO(),n=function(t,n){const e=new HC("UnaryExpression");return e.operator=t,e.argument=n,e.prefix=!0,e}(t.value,n);else{if(zO("delete")||zO("void")||zO("typeof"))throw new Error(rO);n=IO()}}return n}function UO(t){let n=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function WO(){var t,n;return t=function(){var t,n,e,r,i,o,a,u,s,c;if(t=JC,s=qO(),0===(i=UO(r=JC)))return s;for(r.prec=i,$O(),n=[t,JC],o=[s,r,a=qO()];(i=UO(JC))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),n.pop(),e=MO(u,s,a),o.push(e);(r=$O()).prec=i,o.push(r),n.push(JC),e=qO(),o.push(e)}for(e=o[c=o.length-1],n.pop();c>1;)n.pop(),e=MO(o[c-1].value,o[c-2],e),c-=2;return e}(),_O("?")&&($O(),n=WO(),OO(":"),t=function(t,n,e){const r=new HC("ConditionalExpression");return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,WO())),t}function HO(){const t=WO();if(_O(","))throw new Error(rO);return t}function GO(t){VC=0,XC=(YC=t).length,JC=null,kO();const n=HO();if(2!==JC.type)throw new Error("Unexpect token after expression.");return n}var YO={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 VO(t){function n(n,e,r){return i=>function(n,e,r,i){let o=t(e[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}const e="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(n){n.length<3&&p("Missing arguments to clamp function."),n.length>3&&p("Too many arguments to clamp function.");const e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:i,test:n("test",i),if:function(n){n.length<3&&p("Missing arguments to if function."),n.length>3&&p("Too many arguments to if function.");const e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}function XO(t){const n=(t=t||{}).allowed?Bt(t.allowed):{},e=t.forbidden?Bt(t.forbidden):{},r=t.constants||YO,i=(t.functions||VO)(f),o=t.globalvar,a=t.fieldvar,u=tt(o)?o:t=>`${o}["${t}"]`;new Set([...Object.getOwnPropertyNames(Object.prototype).filter((t=>"function"==typeof Object.prototype[t])),"__proto__"]);let s={},c={},l=0;function f(t){if($t(t))return t;const n=d[t.type];return null==n&&p("Unsupported type: "+t.type),n(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return l>0?i:ft(e,i)?p("Illegal identifier: "+i):ft(r,i)?r[i]:ft(n,i)?i:(s[i]=1,u(i))},MemberExpression:t=>{const n=!t.computed,e=f(t.object);n&&(l+=1);const r=f(t.property);return e===a&&(c[function(t){const n=t&&t.length-1;return n&&('"'===t[0]&&'"'===t[n]||"'"===t[0]&&"'"===t[n])?t.slice(1,-1):t}(r)]=1),n&&(l-=1),e+(n?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&p("Illegal callee type: "+t.callee.type);const n=t.callee.name,e=t.arguments,r=ft(i,n)&&i[n];return r||p("Unrecognized function: "+n),tt(r)?r(e):r+"("+e.map(f).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(f).join(",")+"]",BinaryExpression:t=>"("+f(t.left)+" "+t.operator+" "+f(t.right)+")",UnaryExpression:t=>"("+t.operator+f(t.argument)+")",ConditionalExpression:t=>"("+f(t.test)+"?"+f(t.consequent)+":"+f(t.alternate)+")",LogicalExpression:t=>"("+f(t.left)+t.operator+f(t.right)+")",ObjectExpression:t=>{for(const n of t.properties){const t=n.key.name;M.has(t)&&p("Illegal property: "+t)}return"{"+t.properties.map(f).join(",")+"}"},Property:t=>{l+=1;const n=f(t.key);return l-=1,n+":"+f(t.value)}};function h(t){const n={code:f(t),globals:Object.keys(s),fields:Object.keys(c)};return s={},c={},n}return h.functions=i,h.constants=r,h}const JO=Symbol("vega_selection_getter");function KO(t){return t.getter&&t.getter[JO]||(t.getter=v(t.field),t.getter[JO]=!0),t.getter}const QO="intersect",ZO="union",t_="or",n_="and",e_="_vgsid_",r_=v(e_),i_="index:unit";function o_(t,n){for(var e,r,i=n.fields,o=n.values,a=i.length,u=0;u<a;++u)if(yt(e=KO(r=i[u])(t))&&(e=z(e)),yt(o[u])&&(o[u]=z(o[u])),S(o[u])&&yt(o[u][0])&&(o[u]=o[u].map(z)),"E"===r.type){if(S(o[u])?!o[u].includes(e):e!==o[u])return!1}else if("R"===r.type){if(!gt(e,o[u]))return!1}else if("R-RE"===r.type){if(!gt(e,o[u],!0,!1))return!1}else if("R-E"===r.type){if(!gt(e,o[u],!1,!1))return!1}else if("R-LE"===r.type){if(!gt(e,o[u],!1,!0))return!1}else if("E-LT"===r.type){if(e>=o[u])return!1}else if("E-LTE"===r.type){if(e>o[u])return!1}else if("E-GT"===r.type){if(e<=o[u])return!1}else if("E-GTE"===r.type){if(e<o[u])return!1}else if("E-VALID"===r.type){if(null===e||isNaN(e))return!1}else if("E-ONE"===r.type&&-1===o[u].indexOf(e))return!1;return!0}const a_=Zt(r_),u_=a_.left,s_=a_.right;var c_={[`${e_}_union`]:function(...t){const n=new sn;for(const e of t)for(const t of e)n.add(t);return n},[`${e_}_intersect`]:function(t,...n){t=new sn(t),n=n.map(Cn);t:for(const e of t)for(const r of n)if(!r.has(e)){t.delete(e);continue t}return t},E_union:function(t,n){if(!t.length)return n;for(var e=0,r=n.length;e<r;++e)t.includes(n[e])||t.push(n[e]);return t},E_intersect:function(t,n){return t.length?t.filter((t=>n.includes(t))):n},R_union:function(t,n){var e=z(n[0]),r=z(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]<r&&(t[1]=r),t):[e,r]},R_intersect:function(t,n){var e=z(n[0]),r=z(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?r<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>r&&(t[1]=r),t):[e,r]}};function l_(t,n,e,r){n[0].type!==UC&&p("First argument to selection functions must be a string literal.");const i=n[0].value,o="unit",a="@"+o,u=":"+i;(n.length>=2&&_(n).value)!==QO||ft(r,a)||(r[a]=e.getData(i).indataRef(e,o)),ft(r,u)||(r[u]=e.getData(i).tuplesRef())}function f_(t){const n=this.context.data[t];return n?n.values.value:[]}const d_=t=>function(n,e){const r=this.context.dataflow.locale();return null===n?"null":r[t](e)(n)},h_=d_("format"),m_=d_("timeFormat"),p_=d_("utcFormat"),g_=d_("timeParse"),v_=d_("utcParse"),y_=new Date(2e3,0,1);function b_(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(y_.setYear(2e3),y_.setMonth(t),y_.setDate(n),m_.call(this,y_,e)):""}function w_(t,n,e,r){n[0].type!==UC&&p("First argument to data functions must be a string literal.");const i=n[0].value,o=":"+i;if(!ft(o,r))try{r[o]=e.getData(i).tuplesRef()}catch(t){}}function x_(t,n,e,r){if(n[0].type===UC)$_(e,r,n[0].value);else for(t in e.scales)$_(e,r,t)}function $_(t,n,e){const r="%"+e;if(!ft(n,r))try{n[r]=t.scaleRef(e)}catch(t){}}function k_(t,n){if($t(t)){const e=n.scales[t];return e&&tg(e.value)?e.value:void 0}if(tt(t))return tg(t)?t:void 0}function M_(t,n){return function(e,r,i){if(e){const n=k_(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const A_=M_("area",(function(t){return uM=new an,Uk(t,sM),2*uM})),D_=M_("bounds",(function(t){var n,e,r,i,o,a,u;if(Qk=Kk=-(Xk=Jk=1/0),iM=[],Uk(t,TM),e=iM.length){for(iM.sort(HM),n=1,o=[r=iM[0]];n<e;++n)GM(r,(i=iM[n])[0])||GM(r,i[1])?(WM(r[0],i[1])>WM(r[0],r[1])&&(r[1]=i[1]),WM(i[0],r[1])>WM(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)(u=WM(r[1],(i=o[n])[0]))>a&&(a=u,Xk=i[0],Kk=r[1])}return iM=oM=null,Xk===1/0||Jk===1/0?[[NaN,NaN],[NaN,NaN]]:[[Xk,Jk],[Kk,Qk]]})),S_=M_("centroid",(function(t){wM=xM=$M=kM=MM=AM=DM=SM=0,FM=new an,EM=new an,NM=new an,Uk(t,YM);var n=+FM,e=+EM,r=+NM,i=Fk(n,e,r);return i<pk&&(n=AM,e=DM,r=SM,xM<mk&&(n=$M,e=kM,r=MM),(i=Fk(n,e,r))<pk)?[NaN,NaN]:[Mk(e,n)*wk,Tk(r/i)*wk]}));function F_(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function E_(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function N_(t){const n=Il(t);return.2126*E_(n.r)+.7152*E_(n.g)+.0722*E_(n.b)}function C_(t,n){return t===n||t!=t&&n!=n||(S(t)?!(!S(n)||t.length!==n.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!C_(t[e],n[e]))return!1;return!0}(t,n):!(!F(t)||!F(n))&&O_(t,n))}function O_(t,n){for(const e in t)if(!C_(t[e],n[e]))return!1;return!0}function __(t){return n=>O_(t,n)}const z_={};function B_(t){return S(t)||ArrayBuffer.isView(t)?t:null}function T_(t){return B_(t)||($t(t)?t:null)}const P_=t=>t.data;function j_(t,n){const e=f_.call(n,t);return e.root&&e.root.lookup||{}}const R_=()=>"undefined"!=typeof window&&window||null;function L_(t,n,e){if(!t)return[];const[r,i]=t,o=(new Rv).set(r[0],r[1],i[0],i[1]);return kx(e||this.context.dataflow.scenegraph().root,o,function(t){let n=null;if(t){const e=Q(t.marktype),r=Q(t.markname);n=t=>(!e.length||e.some((n=>t.marktype===n)))&&(!r.length||r.some((n=>t.name===n)))}return n}(n))}const I_={random:()=>Ia(),cumulativeNormal:Xa,cumulativeLogNormal:nu,cumulativeUniform:uu,densityNormal:Va,densityLogNormal:tu,densityUniform:au,quantileNormal:Ja,quantileLogNormal:eu,quantileUniform:su,sampleNormal:Ya,sampleLogNormal:Za,sampleUniform:ou,isArray:S,isBoolean:vt,isDate:yt,isDefined:t=>void 0!==t,isNumber:wt,isObject:F,isRegExp:xt,isString:$t,isTuple:Zo,isValid:t=>null!=t&&t==t,toBoolean:Ct,toDate:t=>_t(t),toNumber:z,toString:zt,indexof:function(t,...n){return T_(t).indexOf(...n)},join:function(t,...n){return B_(t).join(...n)},lastindexof:function(t,...n){return T_(t).lastIndexOf(...n)},replace:function(t,n,e){return tt(e)&&p("Function argument passed to replace."),$t(n)||xt(n)||p("Please pass a string or RegExp argument to replace."),String(t).replace(n,e)},reverse:function(t){return B_(t).slice().reverse()},sort:function(t){return B_(t).slice().sort(et)},slice:function(t,...n){return T_(t).slice(...n)},flush:mt,lerp:Mt,merge:function(){const t=[].slice.call(arguments);return t.unshift({}),st(...t)},pad:Ft,peek:_,pluck:function(t,n){const e=z_[n]||(z_[n]=v(n));return S(t)?t.map(e):e(t)},span:Et,inrange:gt,truncate:Tt,rgb:Il,lab:ff,hcl:vf,hsl:Jl,luminance:N_,contrast:function(t,n){const e=N_(t),r=N_(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)},sequence:En,format:h_,utcFormat:p_,utcParse:v_,utcOffset:ur,utcSequence:lr,timeFormat:m_,timeParse:g_,timeOffset:ar,timeSequence:cr,timeUnitSpecifier:Oe,monthFormat:function(t){return b_.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return b_.call(this,t,1,"%b")},dayFormat:function(t){return b_.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return b_.call(this,0,2+t,"%a")},quarter:J,utcquarter:K,week:Te,utcweek:qe,dayofyear:Be,utcdayofyear:Ie,warn:function(){return F_(this.context.dataflow,"warn",arguments)},info:function(){return F_(this.context.dataflow,"info",arguments)},debug:function(){return F_(this.context.dataflow,"debug",arguments)},extent:t=>ct(t),inScope:function(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:L_,clampRange:Z,pinchDistance:function(t){const n=t.touches;return Math.hypot(n[0].clientX-n[1].clientX,n[0].clientY-n[1].clientY)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){const t=R_();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){const t=R_();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return Ap(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow;return e.pulse(this.context.data[t].input,e.changeset().remove($).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?cv(e,n=n||Qg(t)):t}},panLinear:I,panLog:q,panPow:U,panSymlog:W,zoomLinear:G,zoomLog:Y,zoomPow:V,zoomSymlog:X,encode:function(t,n,e){if(t){const e=this.context.dataflow;e.pulse(t.mark.source,e.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,c=a.stamp();let l,f,d=u.changes;if(!1===a._trigger||!(s.value.length||n||r))return 0;if((!d||d.stamp<c)&&(u.changes=d=a.changeset(),d.stamp=c,a.runAfter((()=>{u.modified=!0,a.pulse(s,d).run()}),!0,1)),e&&(l=!0===e?$:S(e)||Zo(e)?e:__(e),d.remove(l)),n&&d.insert(n),r&&(l=__(r),s.value.some(l)?d.remove(l):d.insert(r)),i)for(f in o)d.modify(i,f,o[f]);return 1},lassoAppend:function(t,n,e,r=5){const i=(t=Q(t))[t.length-1];return void 0===i||Math.hypot(i[0]-n,i[1]-e)>r?[...t,[n,e]]:t},lassoPath:function(t){return Q(t).reduce(((n,[e,r],i)=>n+(0==i?`M ${e},${r} `:i===t.length-1?" Z":`L ${e},${r} `)),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:o}=e,a=(new Rv).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<a.x1&&(a.x1=t),t>a.x2&&(a.x2=t),e<a.y1&&(a.y1=e),e>a.y2&&(a.y2=e);return a.translate(r,i),L_([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,u]=e[o],[s,c]=e[i];c>n!=u>n&&t<(a-s)*(n-c)/(u-c)+s&&r++}return 1&r}(t.x,t.y,n)))}},q_=["view","item","group","xy","x","y"],U_="this.",W_={},H_={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${Nt("$"+t)}]`,functions:function(t){const n=VO(t);q_.forEach((t=>n[t]="event.vega."+t));for(const t in I_)n[t]=U_+t;return st(n,function(t,n,e){n.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,e._bandwidth=x_,e._range=x_,e._scale=x_;const r=n=>"_["+(n.type===UC?Nt("%"+n.value):Nt("%")+"+"+t(n))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:n=>`${r(n[0])}(${t(n[1])})`}}(t,I_,W_)),n},constants:YO,visitors:W_},G_=XO(H_);function Y_(t,n,e){return 1===arguments.length?I_[t]:(I_[t]=n,e&&(W_[t]=e),G_&&(G_.functions[t]=U_+t),this)}function V_(t,n){const e={};let r;try{r=GO(t=$t(t)?t:Nt(t)+"")}catch(n){p("Expression parse error: "+t)}r.visit((t=>{if(t.type!==WC)return;const r=t.callee.name,i=H_.visitors[r];i&&i(r,t.arguments,n,e)}));const i=G_(r);return i.globals.forEach((t=>{const r="$"+t;!ft(e,r)&&n.getSignal(t)&&(e[r]=n.signalRef(t))})),{$expr:st({code:i.code},n.options.ast?{ast:r}:null),$fields:i.fields,$params:e}}Y_("bandwidth",(function(t,n){const e=k_(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}),x_),Y_("copy",(function(t,n){const e=k_(t,(n||this).context);return e?e.copy():void 0}),x_),Y_("domain",(function(t,n){const e=k_(t,(n||this).context);return e?e.domain():[]}),x_),Y_("range",(function(t,n){const e=k_(t,(n||this).context);return e&&e.range?e.range():[]}),x_),Y_("invert",(function(t,n,e){const r=k_(t,(e||this).context);return r?S(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}),x_),Y_("scale",(function(t,n,e){const r=k_(t,(e||this).context);return r?r(n):void 0}),x_),Y_("gradient",(function(t,n,e,r,i){t=k_(t,(i||this).context);const o=Wg(n,e);let a=t.domain(),u=a[0],s=_(a),c=b;return s-u?c=mg(t,u,s):t=(t.interpolator?ng("sequential")().interpolator(t.interpolator()):ng("linear")().interpolate(t.interpolate()).range(t.range())).domain([u=0,s=1]),t.ticks&&(a=t.ticks(+r||15),u!==a[0]&&a.unshift(u),s!==_(a)&&a.push(s)),a.forEach((n=>o.stop(c(n),t(n)))),o}),x_),Y_("geoArea",A_,x_),Y_("geoBounds",D_,x_),Y_("geoCentroid",S_,x_),Y_("geoShape",(function(t,n,e){const r=k_(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}),x_),Y_("geoScale",(function(t,n){const e=k_(t,(n||this).context);return e&&e.scale()}),x_),Y_("indata",(function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}),(function(t,n,e,r){n[0].type!==UC&&p("First argument to indata must be a string literal."),n[1].type!==UC&&p("Second argument to indata must be a string literal.");const i=n[0].value,o=n[1].value,a="@"+o;ft(a,r)||(r[a]=e.getData(i).indataRef(e,o))})),Y_("data",f_,w_),Y_("treePath",(function(t,n,e){const r=j_(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(P_):void 0}),w_),Y_("treeAncestors",(function(t,n){const e=j_(t,this)[n];return e?e.ancestors().map(P_):void 0}),w_),Y_("vlSelectionTest",(function(t,n,e){for(var r,i,o,a,u,s=this.context.data[t],c=s?s.values.value:[],l=s?s[i_]&&s[i_].value:void 0,f=e===QO,d=c.length,h=0;h<d;++h)if(r=c[h],l&&f){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(u=o_(n,r),i[a]=u?-1:++o,u&&1===l.size)return!0;if(!u&&o===l.get(a).count)return!1}else if(f^(u=o_(n,r)))return u;return d&&f}),l_),Y_("vlSelectionIdTest",(function(t,n,e){const r=this.context.data[t],i=r?r.values.value:[],o=r?r[i_]&&r[i_].value:void 0,a=e===QO,u=r_(n),s=u_(i,u);if(s===i.length)return!1;if(r_(i[s])!==u)return!1;if(o&&a){if(1===o.size)return!0;if(s_(i,u)-s<o.size)return!1}return!0}),l_),Y_("vlSelectionResolve",(function(t,n,e,r){for(var i,o,a,u,s,c,l,f,d,h,m,p=this.context.data[t],g=p?p.values.value:[],v={},y={},b={},w=g.length,x=0;x<w;++x)if(u=(i=g[x]).unit,a=i.values,(o=i.fields)&&a){for(h=0,m=o.length;h<m;++h)f=(l=v[(s=o[h]).field]||(v[s.field]={}))[u]||(l[u]=[]),b[s.field]=d=s.type.charAt(0),l[u]=(0,c_[`${d}_union`])(f,Q(a[h]));e&&(f=y[u]||(y[u]=[])).push(Q(a).reduce(((t,n,e)=>(t[o[e].field]=n,t)),{}))}else s=e_,c=r_(i),(f=(l=v[s]||(v[s]={}))[u]||(l[u]=[])).push(c),e&&(f=y[u]||(y[u]=[])).push({[e_]:c});return n=n||ZO,v[e_]?v[e_]=c_[`${e_}_${n}`](...Object.values(v[e_])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((n=>v[t][n])).reduce(((e,r)=>void 0===e?r:c_[`${b[t]}_${n}`](e,r)))})),g=Object.keys(y),e&&g.length&&(v[r?"vlPoint":"vlMulti"]=n===ZO?{[t_]:g.reduce(((t,n)=>(t.push(...y[n]),t)),[])}:{[n_]:g.map((t=>({[t_]:y[t]})))}),v}),l_),Y_("vlSelectionTuples",(function(t,n){return S(t)||p("First argument to selectionTuples must be an array."),$t(n)||p("Second argument to selectionTuples must be a string."),t.map((t=>st(n.fields?{values:n.fields.map((n=>KO(n)(t.datum)))}:{[e_]:r_(t.datum)},n)))}));const X_=Bt(["rule"]),J_=Bt(["group","image","rect"]);function K_(t){return(t+"").toLowerCase()}function Q_(t,n,e){e.endsWith(";")||(e="return("+e+");");const r=Function(...n.concat(e));return t&&t.functions?r.bind(t.functions):r}var Z_={operator:(t,n)=>Q_(t,["_"],n.code),parameter:(t,n)=>Q_(t,["datum","_"],n.code),event:(t,n)=>Q_(t,["event"],n.code),handler:(t,n)=>Q_(t,["_","event"],`var datum=event.item&&event.item.datum;return ${n.code};`),encode:(t,n)=>{const{marktype:e,channels:r}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const n="o["+Nt(t)+"]";i+=`$=${r[t].code};if(${n}!==$)${n}=$,m=1;`}return i+=function(t,n){let e="";return X_[n]||(t.x2&&(t.x?(J_[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(J_[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;")),e}(r,e),i+="return m;",Q_(t,["item","_"],i)},codegen:{get(t){const n=`[${t.map(Nt).join("][")}]`,e=Function("_",`return _${n};`);return e.path=n,e},comparator(t,n){let e;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=n[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((e=e||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,n,e,r){return`((u = ${t}) < (v = ${n}) || u == null) && v != null ? ${e}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${e}\n : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return e?r.bind(e):r}}};function tz(t,n,e){if(!t||!F(t))return t;for(let r,i=0,o=nz.length;i<o;++i)if(r=nz[i],ft(t,r.key))return r.parse(t,n,e);return t}var nz=[{key:"$ref",parse:function(t,n){return n.get(t.$ref)||p("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,n){const e="k:"+t.$key+"_"+!!t.$flat;return n.fn[e]||(n.fn[e]=kt(t.$key,t.$flat,n.expr.codegen))}},{key:"$expr",parse:function(t,n,e){t.$params&&n.parseParameters(t.$params,e);const r="e:"+t.$expr.code;return n.fn[r]||(n.fn[r]=c(n.parameterExpression(t.$expr),t.$fields))}},{key:"$field",parse:function(t,n){if(!t.$field)return null;const e="f:"+t.$field+"_"+t.$name;return n.fn[e]||(n.fn[e]=v(t.$field,t.$name,n.expr.codegen))}},{key:"$encode",parse:function(t,n){const e=t.$encode,r={};for(const t in e){const i=e[t];r[t]=c(n.encodeExpression(i.$expr),i.$fields),r[t].output=i.$output}return r}},{key:"$compare",parse:function(t,n){const e="c:"+t.$compare+"_"+t.$order,r=Q(t.$compare).map((t=>t&&t.$tupleid?ta:t));return n.fn[e]||(n.fn[e]=nt(r,t.$order,n.expr.codegen))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){const e=t.$subflow;return function(t,r,i){const o=n.fork().parse(e),a=o.get(e.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>n.detach(o),a}}},{key:"$tupleid",parse:function(){return ta}}];const ez={skip:!0};function rz(t,n,e,r){return new iz(t,n,e,r)}function iz(t,n,e,r){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.expr=r||Z_,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function oz(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 az(t,n){t&&(null==n?t.removeAttribute("aria-label"):t.setAttribute("aria-label",n))}iz.prototype=oz.prototype={fork(){const t=new oz(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((n=>n!==t));const n=Object.keys(t.nodes);for(const e of n)t.nodes[e]._targets=null;for(const e of n)t.nodes[e].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,n){return this.nodes[t]=n},add(t,n){const e=this,r=e.dataflow,i=t.value;if(e.set(t.id,n),function(t){return"collect"===K_(t)}(t.type)&&i&&(i.$ingest?r.ingest(n,i.$ingest,i.$format):i.$request?r.preload(n,i.$request,i.$format):r.pulse(n,r.changeset().insert(i))),t.root&&(e.root=n),t.parent){let i=e.get(t.parent.$ref);i?(r.connect(i,[n]),n.targets().add(i)):(e.unresolved=e.unresolved||[]).push((()=>{i=e.get(t.parent.$ref),r.connect(i,[n]),n.targets().add(i)}))}if(t.signal&&(e.signals[t.signal]=n),t.scale&&(e.scales[t.scale]=n),t.data)for(const r in t.data){const i=e.data[r]||(e.data[r]={});t.data[r].forEach((t=>i[t]=n))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,n){this.add(t,this.dataflow.add(t.value,n))},transform(t,n){this.add(t,this.dataflow.add(this.transforms[K_(n)]))},stream(t,n){this.set(t.id,n)},update(t,n,e,r,i){this.dataflow.on(n,e,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 n=this,e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),t.locale&&(n.locale=t.locale),e.forEach((t=>n.parseOperator(t))),e.forEach((t=>n.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>n.parseStream(t))),(t.updates||[]).forEach((t=>n.parseUpdate(t))),n.resolve()},parseOperator:function(t){const n=this;!function(t){return"operator"===K_(t)}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?n.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const n=this;if(t.params){const e=n.get(t.id);e||p("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(n.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,n){n=n||{};const e=this;for(const r in t){const i=t[r];n[r]=S(i)?i.map((t=>tz(t,e,n))):tz(i,e,n)}return n},parseStream:function(t){var n,e=this,r=null!=t.filter?e.eventExpression(t.filter):void 0,i=null!=t.stream?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map((t=>e.get(t))))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map((t=>e.get(t))),i=i.between(n[0],n[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&&p("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)},parseUpdate:function(t){var n,e=this,r=F(r=t.source)?r.$ref:r,i=e.get(r),o=t.update,a=void 0;i||p("Source not defined: "+t.source),n=t.target&&t.target.$expr?e.eventExpression(t.target.$expr):e.get(t.target),o&&o.$expr&&(o.$params&&(a=e.parseParameters(o.$params)),o=e.handlerExpression(o.$expr)),e.update(t,i,n,o,a)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach((e=>{const i=n.signals[e];t.signals(e,i)&&(r[e]=i.value)}))}if(t.data){var i=e.data={};Object.keys(n.data).forEach((e=>{const r=n.data[e];t.data(e,r)&&(i[e]=r.input.value)}))}return n.subcontext&&!1!==t.recurse&&(e.subcontext=n.subcontext.map((n=>n.getState(t)))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{e.update(n.signals[t],i[t],ez)})),Object.keys(r||{}).forEach((t=>{e.pulse(n.data[t].input,e.changeset().remove($).insert(r[t]))})),(t.subcontext||[]).forEach(((t,e)=>{const r=n.subcontext[e];r&&r.setState(t)}))}};const uz="default";function sz(t,n){const e=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(e)return null==n?e.style.removeProperty("cursor"):e.style.cursor=n}function cz(t,n){var e=t._runtime.data;return ft(e,n)||p("Unrecognized data set: "+n),e[n]}function lz(t,n){ua(n)||p("Second argument to changes must be a changeset.");const e=cz(this,t);return e.modified=!0,this.pulse(e.input,n)}function fz(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function dz(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function hz(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}const mz="view",pz={trap:!1};function gz(t,n,e,r){t._eventListeners.push({type:e,sources:Q(n),handler:r})}function vz(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(!1===r||F(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function yz(t){return t.item}function bz(t){return t.item.mark.source}function wz(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function xz(t,n,e){const r=document.createElement(t);for(const t in n)r.setAttribute(t,n[t]);return null!=e&&(r.textContent=e),r}function $z(t,n,e,r){const i=e.event||"input",o=()=>t.update(n.value);r.signal(e.signal,n.value),n.addEventListener(i,o),gz(r,n,i,o),t.set=t=>{n.value=t,n.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function kz(t,n,e,r){const i=r.signal(e.signal),o=xz("div",{class:"vega-bind"}),a="radio"===e.input?o:o.appendChild(xz("label"));a.appendChild(xz("span",{class:"vega-bind-name"},e.name||e.signal)),n.appendChild(o);let u=Mz;switch(e.input){case"checkbox":u=Az;break;case"select":u=Dz;break;case"radio":u=Sz;break;case"range":u=Fz}u(t,a,e,i)}function Mz(t,n,e,r){const i=xz("input");for(const t in e)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,e[t]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function Az(t,n,e,r){const i={type:"checkbox",name:e.signal};r&&(i.checked=!0);const o=xz("input",i);n.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function Dz(t,n,e,r){const i=xz("select",{name:e.signal}),o=e.labels||[];e.options.forEach(((t,n)=>{const e={value:t};Ez(t,r)&&(e.selected=!0),i.appendChild(xz("option",e,(o[n]||t)+""))})),n.appendChild(i),i.addEventListener("change",(()=>{t.update(e.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let n=0,r=e.options.length;n<r;++n)if(Ez(e.options[n],t))return void(i.selectedIndex=n)}}function Sz(t,n,e,r){const i=xz("span",{class:"vega-bind-radio"}),o=e.labels||[];n.appendChild(i),t.elements=e.options.map(((n,a)=>{const u={type:"radio",name:e.signal,value:n};Ez(n,r)&&(u.checked=!0);const s=xz("input",u);s.addEventListener("change",(()=>t.update(n)));const c=xz("label",{},(o[a]||n)+"");return c.prepend(s),i.appendChild(c),s})),t.set=n=>{const e=t.elements,r=e.length;for(let t=0;t<r;++t)Ez(e[t].value,n)&&(e[t].checked=!0)}}function Fz(t,n,e,r){r=void 0!==r?r:(+e.max+ +e.min)/2;const i=null!=e.max?e.max:Math.max(100,+r)||100,o=e.min||Math.min(0,i,+r)||0,a=e.step||wn(o,i,100),u=xz("input",{type:"range",name:e.signal,min:o,max:i,step:a});u.value=r;const s=xz("span",{},+r);n.appendChild(u),n.appendChild(s);const c=()=>{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",c),u.addEventListener("change",c),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function Ez(t,n){return t===n||t+""==n+""}function Nz(t,n,e,r,i,o){return(n=n||new r(t.loader())).initialize(e,fz(t),dz(t),hz(t),i,o).background(t.background())}function Cz(t,n){return n?function(){try{n.apply(this,arguments)}catch(n){t.error(n)}}:null}function Oz(t,n,e){if("string"==typeof n){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n&&e)try{n.textContent=""}catch(e){n=null,t.error(e)}return n}const _z=t=>+t||0;function zz(t){return F(t)?{top:_z(t.top),bottom:_z(t.bottom),left:_z(t.left),right:_z(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(_z(t))}async function Bz(t,n,e,r){const i=$x(n),o=i&&i.headless;return o||p("Unrecognized renderer type: "+n),await t.runAsync(),Nz(t,null,null,o,e,r).renderAsync(t._scenegraph.root)}var Tz="width",Pz="height",jz="padding",Rz={skip:!0};function Lz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===jz?r.left+r.right:0)}function Iz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===jz?r.top+r.bottom:0)}function qz(t,n){return n.modified&&S(n.input.value)&&!t.startsWith("_:vega:_")}function Uz(t,n){return!("parent"===t||n instanceof _a.proxy)}function Wz(t,n,e,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":S(t)?Hz(t):F(t)&&!yt(t)?(n=t,Object.keys(n).map((t=>{const e=n[t];return t+": "+(S(e)?Hz(e):Gz(e))})).join("\n")):t+"";var n}(r))}function Hz(t){return"["+t.map(Gz).join(", ")+"]"}function Gz(t){return S(t)?"[…]":F(t)&&!yt(t)?"{…}":t}function Yz(t,n){const e=this;if(n=n||{},Na.call(e),n.loader&&e.loader(n.loader),n.logger&&e.logger(n.logger),null!=n.logLevel&&e.logLevel(n.logLevel),n.locale||t.locale){const r=st({},t.locale,n.locale);e.locale(Mo(r.number,r.time))}e._el=null,e._elBind=null,e._renderType=n.renderer||wx.Canvas,e._scenegraph=new Wb;const r=e._scenegraph.root;e._renderer=null,e._tooltip=n.tooltip||Wz,e._redraw=!0,e._handler=(new xw).scene(r),e._globalCursor=!1,e._preventDefault=!1,e._timers=[],e._eventListeners=[],e._resizeListeners=[],e._eventConfig=function(t){const n=st({defaults:{}},t),e=(t,n)=>{n.forEach((n=>{S(t[n])&&(t[n]=Bt(t[n]))}))};return e(n.defaults,["prevent","allow"]),e(n,["view","window","selector"]),n}(t.eventConfig),e.globalCursor(e._eventConfig.globalCursor);const i=function(t,n,e){return rz(t,_a,I_,e).parse(n)}(e,t,n.expr);e._runtime=i,e._signals=i.signals,e._bind=(t.bindings||[]).map((t=>({state:null,param:st({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,e.pulse(i.data.root.input,e.changeset().insert(r.items)),e._width=e.width(),e._height=e.height(),e._viewWidth=Lz(e,e._width),e._viewHeight=Iz(e,e._height),e._origin=[0,0],e._resize=0,e._autosize=1,function(t){var n=t._signals,e=n[Tz],r=n[Pz],i=n[jz];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(n=>{t._width=n.size,t._viewWidth=Lz(t,n.size),o()}),{size:e}),t._resizeHeight=t.add(null,(n=>{t._height=n.size,t._viewHeight=Iz(t,n.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=e.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(e),function(t){t.add(null,(n=>(t._background=n.bg,t._resize=1,n.bg)),{bg:t._signals.background})}(e),function(t){const n=t._signals.cursor||(t._signals.cursor=t.add({user:uz,item:null}));t.on(t.events("view","pointermove"),n,((t,e)=>{const r=n.value,i=r?$t(r)?r:r.user:uz,o=e.item&&e.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(n){let e=n.cursor,r=this.value;return $t(e)||(r=e.item,e=e.user),sz(t,e&&e!==uz?e:r||e),r}),{cursor:n})}(e),e.description(t.description),n.hover&&e.hover(),n.container&&e.initialize(n.container,n.bind),n.watchPixelRatio&&e._watchPixelRatio()}function Vz(t,n){return ft(t._signals,n)?t._signals[n]:p("Unrecognized signal name: "+Nt(n))}function Xz(t,n){const e=(t._targets||[]).filter((t=>t._update&&t._update.handler===n));return e.length?e[0]:null}function Jz(t,n,e,r){let i=Xz(e,r);return i||(i=Cz(t,(()=>r(n,e.value))),i.handler=r,t.on(e,null,i)),t}function Kz(t,n,e){const r=Xz(n,e);return r&&n._targets.remove(r),t}pt(Yz,Na,{async evaluate(t,n,e){if(await Na.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var n=hz(t),e=fz(t),r=dz(t);t._renderer.background(t.background()),t._renderer.resize(e,r,n),t._handler.origin(n),t._resizeListeners.forEach((n=>{try{n(e,r)}catch(n){t.error(n)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return e&&Jo(this,e),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const n=null!=t?t+"":null;return n!==this._desc&&az(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,n,e){const r=Vz(this,t);return 1===arguments.length?r.value:this.update(r,n,e)},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",zz(t)):zz(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?($x(t)||p("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&&(Na.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Vz(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,n,e,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==e&&(u=1,a.signal(Tz,e,Rz),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(Pz,r,Rz),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==n&&(a._resize=1,a._viewHeight=n),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,n,e){let r=n;return e&&!1===e.trap||(r=Cz(this,n),r.raw=n),this._handler.on(t,r),this},removeEventListener(t,n){for(var e,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(e=i[o].handler,t===(r=i[o].type)&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},addResizeListener(t){const n=this._resizeListeners;return n.includes(t)||n.push(t),this},removeResizeListener(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},addSignalListener(t,n){return Jz(this,t,Vz(this,t),n)},removeSignalListener(t,n){return Kz(this,Vz(this,t),n)},addDataListener(t,n){return Jz(this,t,cz(this,t).values,n)},removeDataListener(t,n){return Kz(this,cz(this,t).values,n)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const n=sz(this,null);this._globalCursor=!!t,n&&sz(this,n)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,n){this._timers.push(function(t,n,e){var r=new zF,i=n;return null==n?(r.restart(t,n,e),r):(r._restart=r.restart,r.restart=function(t,n,e){n=+n,e=null==e?OF():+e,r._restart((function o(a){a+=i,r._restart(o,i+=n,e),t(a)}),n,e)},r.restart(t,n,e),r)}((function(n){t({timestamp:Date.now(),elapsed:n})}),n))},events:function(t,n,e){var r,i=this,o=new ga(e),a=function(e,r){i.runAsync(null,(()=>{t===mz&&function(t,n){var e=t._eventConfig.defaults,r=e.prevent,i=e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),o.receive(function(t,n,e){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=hz(t),(r=Kb(n.changedTouches?n.changedTouches[0]:n,a))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(t,n,e){const r=n?"group"===n.mark.marktype?n:n.mark.group:null;function i(t){var e,i=r;if(t)for(e=n;e;e=e.mark.group)if(e.mark.name===t){i=e;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return e;$t(t)&&(t=i(t));const n=e.slice();for(;t;)n[0]-=t.x||0,n[1]-=t.y||0,t=t.mark&&t.mark.group;return n}return{view:at(t),item:at(n||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,e,r),n}(i,e,r))}))};if("timer"===t)vz(i,"timer",n)&&i.timer(a,n);else if(t===mz)vz(i,"view",n)&&i.addEventListener(n,a,pz);else if("window"===t?vz(i,"window",n)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&vz(i,"selector",n)&&(r=Array.from(document.querySelectorAll(t))),r){for(var u=0,s=r.length;u<s;++u)r[u].addEventListener(n,a);gz(i,r,n,a)}else i.warn("Can not resolve event source: "+t);return o},finalize:function(){var t,n,e,r=this._tooltip,i=this._timers,o=this._handler.handlers(),a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);for(r&&r.call(this,this._handler,null,null,null),t=o.length;--t>=0;)this._handler.off(o[t].type,o[t].handler);return this},hover:function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",yz),bz,wz(t)),this.on(this.events("view","pointerout",yz),bz,wz(n)),this},data:function(t,n){return arguments.length<2?cz(this,t).values.value:lz.call(this,t,sa().remove($).insert(n))},change:lz,insert:function(t,n){return lz.call(this,t,sa().insert(n))},remove:function(t,n){return lz.call(this,t,sa().remove(n))},scale:function(t){var n=this._runtime.scales;return ft(n,t)||p("Unrecognized scale or projection: "+t),n[t].value},initialize:function(t,n){const e=this,r=e._renderType,i=e._eventConfig.bind,o=$x(r);t=e._el=t?Oz(e,t,!0):null,function(t){const n=t.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),az(n,t.description()))}(e),o||e.error("Unrecognized renderer type: "+r);const a=o.handler||xw,u=t?o.renderer:o.headless;return e._renderer=u?Nz(e,e._renderer,t,u):null,e._handler=function(t,n,e,r){const i=new r(t.loader(),Cz(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,hz(t),t);return n&&n.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(e,e._handler,t,a),e._redraw=!0,t&&"none"!==i&&(n=n?e._elBind=Oz(e,n,!0):t.appendChild(xz("form",{class:"vega-bindings"})),e._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=Oz(e,t.param.element,!!t.param.input))})),e._bind.forEach((t=>{!function(t,n,e){if(!n)return;const r=e.param;let i=e.state;i||(i=e.state={elements:null,active:!1,set:null,update:n=>{n!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,n)}))}},r.debounce&&(i.update=ut(r.debounce,i.update))),(null==r.input&&r.element?$z:kz)(i,n,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)}(e,t.element||n,t)}))),e},toImageURL:async function(t,n){t!==wx.Canvas&&t!==wx.SVG&&t!==wx.PNG&&p("Unrecognized image type: "+t);const e=await Bz(this,t,n);return t===wx.SVG?function(t){const n=new Blob([t],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(e.svg()):e.canvas().toDataURL("image/png")},toCanvas:async function(t,n){return(await Bz(this,wx.Canvas,t,n)).canvas()},toSVG:async function(t){return(await Bz(this,wx.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:qz,signals:Uz,recurse:!0})},setState:function(t){return this.runAsync(null,(n=>{n._trigger=!1,n._runtime.setState(t)}),(t=>{t._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let t=null;const n=()=>{null!=t&&t();const e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",n),t=()=>{e.removeEventListener("change",n)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};n()}}});const Qz=/[[\]{}]/,Zz={"*":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 tB,nB;function eB(t,n,e){return tB=n||"view",nB=e||Zz,iB(t.trim()).map(oB)}function rB(t,n,e,r,i){const o=t.length;let a,u=0;for(;n<o;++n){if(a=t[n],!u&&a===e)return n;i&&i.includes(a)?--u:r&&r.includes(a)&&++u}return n}function iB(t){const n=[],e=t.length;let r=0,i=0;for(;i<e;)i=rB(t,i,",","[{","]}"),n.push(t.substring(r,i).trim()),r=++i;if(0===n.length)throw"Empty event selector: "+t;return n}function oB(t){return"["===t[0]?function(t){const n=t.length;let e,r=1;if(r=rB(t,r,"]","[","]"),r===n)throw"Empty between selector: "+t;if(e=iB(t.substring(1,r)),2!==e.length)throw"Between selector must have two elements: "+t;if(">"!==(t=t.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+t;e=e.map(oB);const i=oB(t.slice(1).trim());return i.between?{between:e,stream:i}:(i.between=e,i)}(t):function(t){const n={source:tB},e=[];let r,i,o=[0,0],a=0,u=0,s=t.length,c=0;if("}"===t[s-1]){if(c=t.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+t;try{o=function(t){const n=t.split(",");if(!t.length||n.length>2)throw t;return n.map((n=>{const e=+n;if(e!=e)throw t;return e}))}(t.substring(c+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,c).trim()).length,c=0}if(!s)throw t;if("@"===t[0]&&(a=++c),r=rB(t,c,":"),r<s&&(e.push(t.substring(u,r).trim()),u=c=++r),c=rB(t,c,"["),c===s)e.push(t.substring(u,s).trim());else if(e.push(t.substring(u,c).trim()),i=[],u=++c,u===s)throw"Unmatched left bracket: "+t;for(;c<s;){if(c=rB(t,c,"]"),c===s)throw"Unmatched left bracket: "+t;if(i.push(t.substring(u,c).trim()),c<s-1&&"["!==t[++c])throw"Expected left bracket: "+t;u=++c}if(!(s=e.length)||Qz.test(e[s-1]))throw"Invalid event selector: "+t;return s>1?(n.type=e[1],a?n.markname=e[0].slice(1):function(t){return nB[t]}(e[0])?n.marktype=e[0]:n.source=e[0]):n.type=e[0],"!"===n.type.slice(-1)&&(n.consume=!0,n.type=n.type.slice(0,-1)),null!=i&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n}(t)}function aB(t){return F(t)?t:{type:t||"pad"}}const uB=t=>+t||0;function sB(t){return F(t)?t.signal?t:{top:uB(t.top),bottom:uB(t.bottom),left:uB(t.left),right:uB(t.right)}:{top:n=uB(t),bottom:n,left:n,right:n};var n}const cB=t=>F(t)&&!S(t)?st({},t):{value:t};function lB(t,n,e,r){return null!=e?(F(e)&&!S(e)||S(e)&&e.length&&F(e[0])?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function fB(t,n,e){for(const e in n)lB(t,e,n[e]);for(const n in e)lB(t,n,e[n],"update")}function dB(t,n,e){for(const r in n)e&&ft(e,r)||(t[r]=st(t[r]||{},n[r]));return t}function hB(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}const mB="mark",pB="frame",gB="scope",vB="legend-label";function yB(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}const bB=t=>$t(t)?Nt(t):t.signal?`(${t.signal})`:kB(t);function wB(t){if(null!=t.gradient)return function(t){const n=[t.start,t.stop,t.count].map((t=>null==t?null:Nt(t)));for(;n.length&&null==_(n);)n.pop();return n.unshift(bB(t.gradient)),`gradient(${n.join(",")})`}(t);let n=t.signal?`(${t.signal})`:t.color?function(t){return t.c?xB("hcl",t.h,t.c,t.l):t.h||t.s?xB("hsl",t.h,t.s,t.l):t.l||t.a?xB("lab",t.l,t.a,t.b):t.r||t.g||t.b?xB("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?kB(t.field):void 0!==t.value?Nt(t.value):void 0;return null!=t.scale&&(n=function(t,n){const e=bB(t.scale);return null!=t.range?n=`lerp(_range(${e}), ${+t.range})`:(void 0!==n&&(n=`_scale(${e}, ${n})`),t.band&&(n=(n?n+"+":"")+`_bandwidth(${e})`+(1==+t.band?"":"*"+$B(t.band)),t.extra&&(n=`(datum.extra ? _scale(${e}, datum.extra.value) : ${n})`)),null==n&&(n="0")),n}(t,n)),void 0===n&&(n=null),null!=t.exponent&&(n=`pow(${n},${$B(t.exponent)})`),null!=t.mult&&(n+=`*${$B(t.mult)}`),null!=t.offset&&(n+=`+${$B(t.offset)}`),t.round&&(n=`round(${n})`),n}const xB=(t,n,e,r)=>`(${t}(${[n,e,r].map(wB).join(",")})+'')`;function $B(t){return F(t)?"("+wB(t)+")":t}function kB(t){return MB(F(t)?t:{datum:t})}function MB(t){let n,e,r;if(t.signal)n="datum",r=t.signal;else if(t.group||t.parent){for(e=Math.max(1,t.level||1),n="item";e-- >0;)n+=".mark.group";t.parent?(r=t.parent,n+=".datum"):r=t.group}else t.datum?(n="datum",r=t.datum):p("Invalid field reference: "+Nt(t));return t.signal||(r=$t(r)?g(r).map(Nt).join("]["):MB(r)),n+"["+r+"]"}function AB(t,n,e,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,n,e,r,i){const o={},a={};let u,s,c,l;for(s in s="lineBreak","text"!==n||null==i[s]||hB(s,t)||yB(o,s,i[s]),("legend"==e||String(e).startsWith("axis"))&&(e=null),l=e===pB?i.group:e===mB?st({},i.mark,i[n]):null,l)c=hB(s,t)||("fill"===s||"stroke"===s)&&(hB("fill",t)||hB("stroke",t)),c||yB(o,s,l[s]);for(s in Q(r).forEach((n=>{const e=i.style&&i.style[n];for(const n in e)hB(n,t)||yB(o,n,e[n])})),t=st({},t),o)l=o[s],l.signal?(u=u||{})[s]=l:a[s]=l;return t.enter=st(a,t.enter),u&&(t.update=st(u,t.update)),t}(t,n,e,r,i.config);for(const e in t)a[e]=DB(t[e],n,o,i);return o}function DB(t,n,e,r){const i={},o={};for(const n in t)null!=t[n]&&(i[n]=SB(S(a=t[n])?function(t){let n="";return t.forEach((t=>{const e=wB(t);n+=t.test?`(${t.test})?${e}:`:e})),":"===_(n)&&(n+="null"),n}(a):wB(a),r,e,o));var a;return{$expr:{marktype:n,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function SB(t,n,e,r){const i=V_(t,n);return i.$fields.forEach((t=>r[t]=1)),st(e,i.$params),i.$expr}const FB=["value","update","init","react","bind"];function EB(t,n){p(t+' for "outer" push: '+Nt(n))}function NB(t,n){const e=t.name;if("outer"===t.push)n.signals[e]||EB("No prior signal definition",e),FB.forEach((n=>{void 0!==t[n]&&EB("Invalid property ",n)}));else{const r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function CB(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function OB(t,n,e,r){return new CB(t,n,e,r)}function _B(t,n){return OB("operator",t,n)}function zB(t){const n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function BB(t,n){return n?{$field:t,$name:n}:{$field:t}}const TB=BB("key");function PB(t,n){return{$compare:t,$order:n}}function jB(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const RB="scope",LB="view";function IB(t){return t&&t.signal}function qB(t){if(IB(t))return!0;if(F(t))for(const n in t)if(qB(t[n]))return!0;return!1}function UB(t,n){return null!=t?t:n}function WB(t){return t&&t.signal||t}const HB="timer";function GB(t,n){return(t.merge?YB:t.stream?VB:t.type?XB:p("Invalid stream specification: "+Nt(t)))(t,n)}function YB(t,n){const e=JB({merge:t.merge.map((t=>GB(t,n)))},t,n);return n.addStream(e).id}function VB(t,n){const e=JB({stream:GB(t.stream,n)},t,n);return n.addStream(e).id}function XB(t,n){let e;t.type===HB?(e=n.event(HB,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(t){return t===RB?LB:t||LB}(t.source),t.type);const r=JB({stream:e},t,n);return 1===Object.keys(r).length?e:n.addStream(r).id}function JB(t,n,e){let r=n.between;return r&&(2!==r.length&&p('Stream "between" parameter must have 2 entries: '+Nt(n)),t.between=[GB(r[0],e),GB(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(t,n,e){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(e?"&&"+r+".mark.role==='"+e+"'":"")+(n?"&&"+r+".mark.name==='"+n+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===RB&&r.push("inScope(event.item)"),r.length&&(t.filter=V_("("+r.join(")&&(")+")",e).$expr),null!=(r=n.throttle)&&(t.throttle=+r),null!=(r=n.debounce)&&(t.debounce=+r),n.consume&&(t.consume=!0),t}const KB={code:"_.$value",ast:{type:"Identifier",value:"value"}};function QB(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const ZB=t=>(n,e,r)=>OB(t,e,n||void 0,r),tT=ZB("aggregate"),nT=ZB("axisticks"),eT=ZB("bound"),rT=ZB("collect"),iT=ZB("compare"),oT=ZB("datajoin"),aT=ZB("encode"),uT=ZB("expression"),sT=ZB("facet"),cT=ZB("field"),lT=ZB("key"),fT=ZB("legendentries"),dT=ZB("load"),hT=ZB("mark"),mT=ZB("multiextent"),pT=ZB("multivalues"),gT=ZB("overlap"),vT=ZB("params"),yT=ZB("prefacet"),bT=ZB("projection"),wT=ZB("proxy"),xT=ZB("relay"),$T=ZB("render"),kT=ZB("scale"),MT=ZB("sieve"),AT=ZB("sortitems"),DT=ZB("viewlayout"),ST=ZB("values");let FT=0;const ET={min:"min",max:"max",count:"sum"};function NT(t,n){const e=n.getScale(t.name).params;let r;for(r in e.domain=zT(t.domain,t,n),null!=t.range&&(e.range=qT(t,n,e)),null!=t.interpolate&&function(t,n){n.interpolate=CT(t.type||t),null!=t.gamma&&(n.interpolateGamma=CT(t.gamma))}(t.interpolate,e),null!=t.nice&&(e.nice=function(t,n){return t.signal?n.signalRef(t.signal):F(t)?{interval:CT(t.interval),step:CT(t.step)}:CT(t)}(t.nice,n)),null!=t.bins&&(e.bins=function(t,n){return t.signal||S(t)?OT(t,n):n.objectProperty(t)}(t.bins,n)),t)ft(e,r)||"name"===r||(e[r]=CT(t[r],n))}function CT(t,n){return F(t)?t.signal?n.signalRef(t.signal):p("Unsupported object: "+Nt(t)):t}function OT(t,n){return t.signal?n.signalRef(t.signal):t.map((t=>CT(t,n)))}function _T(t){p("Can not find data set: "+Nt(t))}function zT(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(S(t)?BT:t.fields?PT:TT)(t,n,e);null==n.domainMin&&null==n.domainMax||p("No scale domain defined for domainMin/domainMax to override.")}function BT(t,n,e){return t.map((t=>CT(t,e)))}function TT(t,n,e){const r=e.getData(t.data);return r||_T(t.data),og(n.type)?r.valuesRef(e,t.field,RT(t.sort,!1)):cg(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function PT(t,n,e){const r=t.data,i=t.fields.reduce(((t,n)=>(n=$t(n)?{data:r,field:n}:S(n)||n.signal?function(t,n){const e="_:vega:_"+FT++,r=rT({});if(S(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+Nt(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,MT({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t)),[]);return(og(n.type)?jT:cg(n.type)?LT:IT)(t,e,i)}function jT(t,n,e){const r=RT(t.sort,!0);let i,o;const a=e.map((t=>{const e=n.getData(t.data);return e||_T(t.data),e.countsRef(n,t.field,r)})),u={groupby:TB,pulse:a};r&&(i=r.op||"count",o=r.field?jB(i,r.field):"count",u.ops=[ET[i]],u.fields=[n.fieldRef(o)],u.as=[o]),i=n.add(tT(u));const s=n.add(rT({pulse:zB(i)}));return o=n.add(ST({field:TB,sort:n.sortRef(r),pulse:zB(s)})),zB(o)}function RT(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field&&t.op&&!ET[t.op]&&p("Multiple domain scales can not be sorted using "+t.op):p("No field provided for sort aggregate op: "+t.op):F(t)?t.field="key":t={field:"key"}),t}function LT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||_T(t.data),e.domainRef(n,t.field)}));return zB(n.add(pT({values:r})))}function IT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||_T(t.data),e.extentRef(n,t.field)}));return zB(n.add(mT({extents:r})))}function qT(t,n,e){const r=n.config.range;let i=t.range;if(i.signal)return n.signalRef(i.signal);if($t(i)){if(r&&ft(r,i))return qT(t=st({},t,{range:r[i]}),n,e);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=og(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:p("Unrecognized scale range value: "+Nt(i))}else{if(i.scheme)return e.scheme=S(i.scheme)?OT(i.scheme,n):CT(i.scheme,n),i.extent&&(e.schemeExtent=OT(i.extent,n)),void(i.count&&(e.schemeCount=CT(i.count,n)));if(i.step)return void(e.rangeStep=CT(i.step,n));if(og(t.type)&&!S(i))return zT(i,t,n);S(i)||p("Unsupported range type: "+Nt(i))}return i.map((t=>(S(t)?OT:CT)(t,n)))}function UT(t,n,e){return S(t)?t.map((t=>UT(t,n,e))):F(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:p("Unsupported parameter object: "+Nt(t)):t}const WT="top",HT="left",GT="right",YT="bottom",VT="center",XT="index",JT="label",KT="perc",QT="value",ZT="guide-label",tP="guide-title",nP="symbol",eP="gradient",rP="discrete",iP="size",oP=[iP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],aP={name:1,style:1,interactive:1},uP={value:0},sP={value:1},cP="group",lP="rect",fP="rule",dP="text";function hP(t){return t.type=cP,t.interactive=t.interactive||!1,t}function mP(t,n){const e=(e,r)=>UB(t[e],UB(n[e],r));return e.isVertical=e=>"vertical"===UB(t.direction,n.direction||(e?n.symbolDirection:n.gradientDirection)),e.gradientLength=()=>UB(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>UB(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>UB(t.columns,UB(n.columns,+e.isVertical(!0))),e}function pP(t,n){const e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function gP(t,n,e){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${n} : ${e}`}const vP=gP(Nt(HT),Nt(GT),Nt(VT));function yP(t,n){return n?t?F(t)?Object.assign({},t,{offset:yP(t.offset,n)}):{value:t,offset:n}:n:t}function bP(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=dB(t.encode,n,aP)):t.interactive=!1,t}function wP(t,n,e,r){const i=mP(t,e),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,c,l,f,d;o?(c=[0,1],l=[0,0],f=a,d=u):(c=[0,0],l=[1,0],f=u,d=a);const h={enter:s={opacity:uP,x:uP,y:uP,width:cB(f),height:cB(d)},update:st({},s,{opacity:sP,fill:{gradient:n,start:c,stop:l}}),exit:{opacity:uP}};return fB(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),bP({type:lP,role:"legend-gradient",encode:h},r)}function xP(t,n,e,r,i){const o=mP(t,e),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let c,l,f,d,h="";a?(c="y",f="y2",l="x",d="width",h="1-"):(c="x",f="x2",l="y",d="height");const m={opacity:uP,fill:{scale:n,field:QT}};m[c]={signal:h+"datum."+KT,mult:s},m[l]=uP,m[f]={signal:h+"datum.perc2",mult:s},m[d]=cB(u);const p={enter:m,update:st({},m,{opacity:sP}),exit:{opacity:uP}};return fB(p,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),bP({type:lP,role:"legend-band",key:QT,from:i,encode:p},r)}const $P=`datum.${KT}<=0?"${HT}":datum.${KT}>=1?"${GT}":"${VT}"`,kP=`datum.${KT}<=0?"${YT}":datum.${KT}>=1?"${WT}":"middle"`;function MP(t,n,e,r){const i=mP(t,n),o=i.isVertical(),a=cB(i.gradientThickness()),u=i.gradientLength();let s,c,l,f,d=i("labelOverlap"),h="";const m={enter:s={opacity:uP},update:c={opacity:sP,text:{field:JT}},exit:{opacity:uP}};return fB(m,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:UB(t.labelLimit,n.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=c.baseline={signal:kP},l="y",f="x",h="1-"):(s.align=c.align={signal:$P},s.baseline={value:"top"},l="x",f="y"),s[l]=c[l]={signal:h+"datum."+KT,mult:u},s[f]=c[f]=a,a.offset=UB(t.labelOffset,n.gradientLabelOffset)||0,d=d?{separation:i("labelSeparation"),method:d,order:"datum."+XT}:void 0,bP({type:dP,role:vB,style:ZT,key:QT,from:r,encode:m,overlap:d},e)}function AP(t,n,e,r,i){const o=mP(t,n),a=e.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,c=o("clipHeight"),l=o("symbolOffset"),f={data:"value"},d=`(${i}) ? datum.offset : datum.${iP}`,h=c?cB(c):{field:iP},m=`datum.${XT}`,p=`max(1, ${i})`;let g,v,y,b,w;h.mult=.5,g={enter:v={opacity:uP,x:{signal:d,mult:.5,offset:l},y:h},update:y={opacity:sP,x:v.x,y:v.y},exit:{opacity:uP}};let x=null,$=null;t.fill||(x=n.symbolBaseFillColor,$=n.symbolBaseStrokeColor),fB(g,{fill:o("symbolFillColor",x),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",$),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),oP.forEach((n=>{t[n]&&(y[n]=v[n]={scale:t[n],field:QT})}));const k=bP({type:"symbol",role:"legend-symbol",key:QT,from:f,clip:!!c||void 0,encode:g},e.symbols),M=cB(l);M.offset=o("labelOffset"),g={enter:v={opacity:uP,x:{signal:d,offset:M},y:h},update:y={opacity:sP,text:{field:JT},x:v.x,y:v.y},exit:{opacity:uP}},fB(g,{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=bP({type:dP,role:vB,style:ZT,key:QT,from:f,encode:g},e.labels);return g={enter:{noBound:{value:!c},width:uP,height:c?cB(c):uP,opacity:uP},exit:{opacity:uP},update:y={opacity:sP,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${p})`,y.row.signal=`${m}%${b}`,y.column.signal=`floor(${m} / ${b})`,w={field:["row",m]}):(y.row.signal=`floor(${m} / ${p})`,y.column.signal=`${m} % ${p}`,w={field:m}),y.column.signal=`(${i})?${y.column.signal}:${m}`,hP({role:gB,from:r={facet:{data:r,name:"value",groupby:XT}},encode:dB(g,a,aP),marks:[k,A],name:s,interactive:u,sort:w})}const DP='item.orient === "left"',SP='item.orient === "right"',FP=`(${DP} || ${SP})`,EP=`datum.vgrad && ${FP}`,NP=gP('"top"','"bottom"','"middle"'),CP=`datum.vgrad && ${SP} ? (${gP('"right"','"left"','"center"')}) : (${FP} && !(datum.vgrad && ${DP})) ? "left" : ${vP}`,OP=`item._anchor || (${FP} ? "middle" : "start")`,_P=`${EP} ? (${DP} ? -90 : 90) : 0`,zP=`${FP} ? (datum.vgrad ? (${SP} ? "bottom" : "top") : ${NP}) : "top"`;function BP(t,n){let e;return F(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+TP(t.path)+")":t.sphere&&(e="geoShape("+TP(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function TP(t){return F(t)&&t.signal?t.signal:Nt(t)}function PP(t){const n=t.role||"";return n.startsWith("axis")||n.startsWith("legend")||n.startsWith("title")?n:t.type===cP?gB:n||mB}function jP(t){return{marktype:t.type,name:t.name||void 0,role:t.role||PP(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function RP(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function LP(t,n){const e=za(t.type);e||p("Unrecognized transform type: "+Nt(t.type));const r=OB(e.type.toLowerCase(),null,IP(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function IP(t,n,e){const r={},i=t.params.length;for(let o=0;o<i;++o){const i=t.params[o];r[i.name]=qP(i,n,e)}return r}function qP(t,n,e){const r=t.type,i=n[t.name];return"index"===r?function(t,n,e){return $t(n.from)||p('Lookup "from" parameter must be a string literal.'),e.getData(n.from).lookupRef(e,n.key)}(0,n,e):void 0!==i?"param"===r?function(t,n,e){const r=n[t.name];return t.array?(S(r)||p("Expected an array of sub-parameters. Instead: "+Nt(r)),r.map((n=>WP(t,n,e)))):WP(t,r,e)}(t,n,e):"projection"===r?e.projectionRef(n[t.name]):t.array&&!IB(i)?i.map((n=>UP(t,n,e))):UP(t,i,e):void(t.required&&p("Missing required "+Nt(n.type)+" parameter: "+Nt(t.name)))}function UP(t,n,e){const r=t.type;if(IB(n))return VP(r)?p("Expression references can not be signals."):XP(r)?e.fieldRef(n):JP(r)?e.compareRef(n):e.signalRef(n.signal);{const i=t.expr||XP(r);return i&&HP(n)?e.exprRef(n.expr,n.as):i&&GP(n)?BB(n.field,n.as):VP(r)?V_(n,e):YP(r)?zB(e.getData(n).values):XP(r)?BB(n):JP(r)?e.compareRef(n):n}}function WP(t,n,e){const r=t.params.length;let i;for(let e=0;e<r;++e){i=t.params[e];for(const t in i.key)if(i.key[t]!==n[t]){i=null;break}if(i)break}i||p("Unsupported parameter: "+Nt(n));const o=st(IP(i,n,e),i.key);return zB(e.add(vT(o)))}const HP=t=>t&&t.expr,GP=t=>t&&t.field,YP=t=>"data"===t,VP=t=>"expr"===t,XP=t=>"field"===t,JP=t=>"compare"===t;function KP(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:zB(n.getData(t.data).output)}function QP(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}function ZP(t){return $t(t)?t:null}function tj(t,n,e){const r=jB(e.op,e.field);let i;if(n.ops){for(let t=0,e=n.as.length;t<e;++t)if(n.as[t]===r)return}else n.ops=["count"],n.fields=[null],n.as=["count"];e.op&&(n.ops.push((i=e.op.signal)?t.signalRef(i):e.op),n.fields.push(t.fieldRef(e.field)),n.as.push(r))}function nj(t,n,e,r,i,o,a){const u=n[e]||(n[e]={}),s=function(t){return F(t)?("descending"===t.order?"-":"+")+jB(t.op,t.field):""}(o);let c,l,f=ZP(i);if(null!=f&&(t=n.scope,f+=s?"|"+s:"",c=u[f]),!c){const e=o?{field:TB,pulse:n.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:zB(n.output)};s&&(e.sort=t.sortRef(o)),l=t.add(OB(r,void 0,e)),a&&(n.index[i]=l),c=zB(l),null!=f&&(u[f]=c)}return c}function ej(t,n,e){const r=t.remove,i=t.insert,o=t.toggle,a=t.modify,u=t.values,s=n.add(_B()),c=V_("if("+t.trigger+',modify("'+e+'",'+[i,r,o,a,u].map((t=>null==t?"null":t)).join(",")+"),0)",n);s.update=c.$expr,s.params=c.$params}function rj(t,n){const e=PP(t),r=t.type===cP,i=t.from&&t.from.facet,o=t.overlap;let a,u,s,c,l,f,d,h=t.layout||e===gB||e===pB;const m=e===mB||h||i,g=function(t,n,e){let r,i,o,a,u;return t?(r=t.facet)&&(n||p("Only group marks can be faceted."),null!=r.field?a=u=KP(r,e):(t.data?u=zB(e.getData(t.data).aggregate):(o=LP(st({type:"aggregate",groupby:Q(r.groupby)},r.aggregate),e),o.params.key=e.keyRef(r.groupby),o.params.pulse=KP(r,e),a=u=zB(e.add(o))),i=e.keyRef(r.groupby,!0))):a=zB(e.add(rT(null,[{}]))),a||(a=KP(t,e)),{key:i,pulse:a,parent:u}}(t.from,r,n);u=n.add(oT({key:g.key||(t.key?BB(t.key):void 0),pulse:g.pulse,clean:!r}));const v=zB(u);u=s=n.add(rT({pulse:v})),u=n.add(hT({markdef:jP(t),interactive:RP(t.interactive,n),clip:BP(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:zB(u)}));const y=zB(u);u=c=n.add(aT(AB(t.encode,t.type,e,t.style,n,{mod:!1,pulse:y}))),u.params.parent=n.encode(),t.transform&&t.transform.forEach((t=>{const e=LP(t,n),r=e.metadata;(r.generates||r.changes)&&p("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),e.params.pulse=zB(u),n.add(u=e)})),t.sort&&(u=n.add(AT({sort:n.compareRef(t.sort),pulse:zB(u)})));const b=zB(u);(i||h)&&(h=n.add(DT({layout:n.objectProperty(t.layout),legends:n.legends,mark:y,pulse:b})),f=zB(h));const w=n.add(eT({mark:y,pulse:f||b}));d=zB(w),r&&(m&&(a=n.operators,a.pop(),h&&a.pop()),n.pushState(b,f||d,v),i?function(t,n,e){const r=t.from.facet,i=r.name,o=KP(r,n);let a;r.name||p("Facet must have a name: "+Nt(r)),r.data||p("Facet must reference a data set: "+Nt(r)),r.field?a=n.add(yT({field:n.fieldRef(r.field),pulse:o})):r.groupby?a=n.add(sT({key:n.keyRef(r.groupby),group:zB(n.proxy(e.parent)),pulse:o})):p("Facet must specify groupby or field: "+Nt(r));const u=n.fork(),s=u.add(rT()),c=u.add(MT({pulse:zB(s)}));u.addData(i,new QP(u,s,s,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,n,g):m?function(t,n,e){const r=n.add(yT({pulse:e.pulse})),i=n.fork();i.add(MT()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,n,g):n.parse(t),n.popState(),m&&(h&&a.push(h),a.push(w))),o&&(d=function(t,n,e){const r=t.method,i=t.bound,o=t.separation,a={separation:IB(o)?e.signalRef(o.signal):o,method:IB(r)?e.signalRef(r.signal):r,pulse:n};if(t.order&&(a.sort=e.compareRef({field:t.order})),i){const t=i.tolerance;a.boundTolerance=IB(t)?e.signalRef(t.signal):+t,a.boundScale=e.scaleRef(i.scale),a.boundOrient=i.orient}return zB(e.add(gT(a)))}(o,d,n));const x=n.add($T({pulse:d})),$=n.add(MT({pulse:zB(x)},void 0,n.parent()));null!=t.name&&(l=t.name,n.addData(l,new QP(n,s,x,$)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&p("Marks only support modify triggers."),ej(t,n,l)})))}function ij(t,n,e){const r={enter:{},update:{}};return fB(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:e.strokeWidth,strokeDash:e.strokeDash,x:t("legendX"),y:t("legendY"),format:n.format,formatType:n.formatType}),r}function oj(t,n,e){return n[t]?`scale("${n[t]}",datum)`:pP(t,e[0].encode)}QP.fromEntries=function(t,n){const e=n.length,r=n[e-1],i=n[e-2];let o=n[0],a=null,u=1;for(o&&"load"===o.type&&(o=n[1]),t.add(n[0]);u<e;++u)n[u].params.pulse=zB(n[u-1]),t.add(n[u]),"aggregate"===n[u].type&&(a=n[u]);return new QP(t,o,i,r,a)},QP.prototype={countsRef(t,n,e){const r=this,i=r.counts||(r.counts={}),o=ZP(n);let a,u,s;return null!=o&&(t=r.scope,a=i[o]),a?e&&e.field&&tj(t,a.agg.params,e):(s={groupby:t.fieldRef(n,"key"),pulse:zB(r.output)},e&&e.field&&tj(t,s,e),u=t.add(tT(s)),a=t.add(rT({pulse:zB(u)})),a={agg:u,ref:zB(a)},null!=o&&(i[o]=a)),a.ref},tuplesRef(){return zB(this.values)},extentRef(t,n){return nj(t,this,"extent","extent",n,!1)},domainRef(t,n){return nj(t,this,"domain","values",n,!1)},valuesRef(t,n,e){return nj(t,this,"vals","values",n,e||!0)},lookupRef(t,n){return nj(t,this,"lookup","tupleindex",n,!1)},indataRef(t,n){return nj(t,this,"indata","tupleindex",n,!0,!0)}};const aj=`item.orient==="${HT}"?-90:item.orient==="${GT}"?90:0`;function uj(t,n){const e={enter:{},update:{}};return fB(e,{orient:t("orient"),anchor:t("anchor"),align:{signal:vP},angle:{signal:aj},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),dB(e,n,aP)}function sj(t){const n=rT({},t);return n.metadata={source:!0},n}function cj(t,n){return dT({url:n.url?t.property(n.url):void 0,async:n.async?t.property(n.async):void 0,values:n.values?t.property(n.values):void 0,format:t.objectProperty(n.format)})}const lj=t=>t===YT||t===WT,fj=(t,n,e)=>IB(t)?vj(t.signal,n,e):t===HT||t===WT?n:e,dj=(t,n,e)=>IB(t)?pj(t.signal,n,e):lj(t)?n:e,hj=(t,n,e)=>IB(t)?gj(t.signal,n,e):lj(t)?e:n,mj=(t,n,e)=>IB(t)?yj(t.signal,n,e):t===WT?{value:n}:{value:e},pj=(t,n,e)=>bj(`${t} === '${WT}' || ${t} === '${YT}'`,n,e),gj=(t,n,e)=>bj(`${t} !== '${WT}' && ${t} !== '${YT}'`,n,e),vj=(t,n,e)=>xj(`${t} === '${HT}' || ${t} === '${WT}'`,n,e),yj=(t,n,e)=>xj(`${t} === '${WT}'`,n,e),bj=(t,n,e)=>(n=null!=n?cB(n):n,e=null!=e?cB(e):e,wj(n)&&wj(e)?{signal:`${t} ? (${n=n?n.signal||Nt(n.value):null}) : (${e=e?e.signal||Nt(e.value):null})`}:[st({test:t},n)].concat(e||[])),wj=t=>null==t||1===Object.keys(t).length,xj=(t,n,e)=>({signal:`${t} ? (${kj(n)}) : (${kj(e)})`}),$j=(t,n,e,r,i)=>({signal:(null!=r?`${t} === '${HT}' ? (${kj(r)}) : `:"")+(null!=e?`${t} === '${YT}' ? (${kj(e)}) : `:"")+(null!=i?`${t} === '${GT}' ? (${kj(i)}) : `:"")+(null!=n?`${t} === '${WT}' ? (${kj(n)}) : `:"")+"(null)"}),kj=t=>IB(t)?t.signal:null==t?null:Nt(t),Mj=(t,n)=>{const e=t.signal;return e&&e.endsWith("(null)")?{signal:e.slice(0,-6)+n.signal}:t};function Aj(t,n,e,r){let i;if(n&&ft(n,t))return n[t];if(ft(e,t))return e[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[tP][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[ZT][i]}return null}function Dj(t){const n={};for(const e of t)if(e)for(const t in e)n[t]=1;return Object.keys(n)}function Sj(t,n){return{scale:t.scale,range:n}}function Fj(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function Ej(t,n,e,r,i,o){const a=mP(t,n),u=t.orient,s=t.scale,c=fj(u,-1,1),l=WB(a("labelFlush")),f=WB(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let m,p=0===l||!!l;const g=cB(i);g.mult=c,g.offset=cB(a("labelPadding")||0),g.offset.mult=c;const v={scale:s,field:QT,band:.5,offset:yP(o.offset,a("labelOffset"))},y=dj(u,p?Fj(s,l,'"left"','"right"','"center"'):{value:"center"},((t,n,e)=>IB(t)?((t,n,e)=>xj(`${t} === '${GT}'`,n,e))(t.signal,n,e):t===GT?{value:n}:{value:e})(u,"left","right")),b=dj(u,mj(u,"bottom","top"),p?Fj(s,l,'"top"','"bottom"','"middle"'):{value:"middle"}),w=Fj(s,l,`-(${f})`,f,0);p=p&&f;const x={opacity:uP,x:dj(u,v,g),y:hj(u,v,g)},$={enter:x,update:m={opacity:sP,text:{field:JT},x:x.x,y:x.y,align:y,baseline:b},exit:{opacity:uP,x:x.x,y:x.y}};fB($,{dx:!d&&p?dj(u,w):null,dy:!h&&p?hj(u,w):null}),fB($,{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:d,baseline:h});const k=a("labelBound");let M=a("labelOverlap");return M=M||k?{separation:a("labelSeparation"),method:M,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,m.align!==y&&(m.align=Mj(m.align,y)),m.baseline!==b&&(m.baseline=Mj(m.baseline,b)),bP({type:dP,role:"axis-label",style:ZT,key:QT,from:r,encode:$,overlap:M},e)}function Nj(t,n){const e=function(t,n){var e,r,i,o=n.config,a=o.style,u=o.axis,s="band"===n.scaleType(t.scale)&&o.axisBand,c=t.orient;if(IB(c)){const t=Dj([o.axisX,o.axisY]),n=Dj([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(e={},t))e[i]=dj(c,Aj(i,o.axisX,u,a),Aj(i,o.axisY,u,a));for(i of(r={},n))r[i]=$j(c.signal,Aj(i,o.axisTop,u,a),Aj(i,o.axisBottom,u,a),Aj(i,o.axisLeft,u,a),Aj(i,o.axisRight,u,a))}else e=c===WT||c===YT?o.axisX:o.axisY,r=o["axis"+c[0].toUpperCase()+c.slice(1)];return e||r||s?st({},u,e,r,s):u}(t,n),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=mP(t,e),c=function(t){const n=t("tickBand");let e,r,i=t("tickOffset");return n?n.signal?(e={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${n.signal}) === 'extent'`},F(i)||(i={signal:`(${n.signal}) === 'extent' ? 0 : ${i}`})):"extent"===n?(e=1,r=!0,i=0):(e=.5,r=!1):(e=t("bandPosition"),r=t("tickExtra")),{extra:r,band:e,offset:i}}(s),l={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},f=zB(n.add(rT({},[l]))),d=zB(n.add(nT({scale:n.scaleRef(t.scale),extra:n.property(c.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),h=[];let m;return l.grid&&h.push(function(t,n,e,r,i){const o=mP(t,n),a=t.orient,u=t.gridScale,s=fj(a,1,-1),c=function(t,n){if(1===n);else if(F(t)){let e=t=st({},t);for(;null!=e.mult;){if(!F(e.mult))return e.mult=IB(n)?{signal:`(${e.mult}) * (${n.signal})`}:e.mult*n,t;e=e.mult=st({},e.mult)}e.mult=n}else t=IB(n)?{signal:`(${n.signal}) * (${t||0})`}:n*(t||0);return t}(t.offset,s);let l,f,d;const h={enter:l={opacity:uP},update:d={opacity:sP},exit:f={opacity:uP}};fB(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const m={scale:t.scale,field:QT,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},p=dj(a,{signal:"height"},{signal:"width"}),g=u?{scale:u,range:0,mult:s,offset:c}:{value:0,offset:c},v=u?{scale:u,range:1,mult:s,offset:c}:st(p,{mult:s,offset:c});return l.x=d.x=dj(a,m,g),l.y=d.y=hj(a,m,g),l.x2=d.x2=hj(a,v),l.y2=d.y2=dj(a,v),f.x=dj(a,m),f.y=hj(a,m),bP({type:fP,role:"axis-grid",key:QT,from:r,encode:h},e)}(t,e,r.grid,d,c)),l.ticks&&(m=s("tickSize"),h.push(function(t,n,e,r,i,o){const a=mP(t,n),u=t.orient,s=fj(u,-1,1);let c,l,f;const d={enter:c={opacity:uP},update:f={opacity:sP},exit:l={opacity:uP}};fB(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=cB(i);h.mult=s;const m={scale:t.scale,field:QT,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=c.y=dj(u,uP,m),f.y2=c.y2=dj(u,h),l.x=dj(u,m),f.x=c.x=hj(u,uP,m),f.x2=c.x2=hj(u,h),l.y=hj(u,m),bP({type:fP,role:"axis-tick",key:QT,from:r,encode:d},e)}(t,e,r.ticks,d,m,c))),l.labels&&(m=l.ticks?m:0,h.push(Ej(t,e,r.labels,d,m,c))),l.domain&&h.push(function(t,n,e,r){const i=mP(t,n),o=t.orient;let a,u;const s={enter:a={opacity:uP},update:u={opacity:sP},exit:{opacity:uP}};fB(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const c=Sj(t,0),l=Sj(t,1);return a.x=u.x=dj(o,c,uP),a.x2=u.x2=dj(o,l),a.y=u.y=hj(o,c,uP),a.y2=u.y2=hj(o,l),bP({type:fP,role:"axis-domain",from:r,encode:s},e)}(t,e,r.domain,f)),l.title&&h.push(function(t,n,e,r){const i=mP(t,n),o=t.orient,a=fj(o,-1,1);let u,s;const c={enter:u={opacity:uP,anchor:cB(i("titleAnchor",null)),align:{signal:vP}},update:s=st({},u,{opacity:sP,text:cB(t.title)}),exit:{opacity:uP}},l={signal:`lerp(range("${t.scale}"), ${gP(0,1,.5)})`};return s.x=dj(o,l),s.y=hj(o,l),u.angle=dj(o,uP,(t=>IB(t)?{signal:`(${t.signal}) * 90`}:{value:90*t})(a)),u.baseline=dj(o,mj(o,YT,WT),{value:YT}),s.angle=u.angle,s.baseline=u.baseline,fB(c,{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,n,e,r){const i=(t,n)=>null!=t?(e.update[n]=Mj(cB(t),e.update[n]),!1):!hB(n,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");e.enter.auto=a===o?cB(a):dj(n,cB(a),cB(o))}(i,o,c,e),c.update.align=Mj(c.update.align,u.align),c.update.angle=Mj(c.update.angle,u.angle),c.update.baseline=Mj(c.update.baseline,u.baseline),bP({type:dP,role:"axis-title",style:tP,from:r,encode:c},e)}(t,e,r.title,f)),rj(hP({role:"axis",from:f,encode:dB(Cj(s,t),i,aP),marks:h,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),n)}function Cj(t,n){const e={enter:{},update:{}};return fB(e,{orient:t("orient"),offset:t("offset")||0,position:UB(n.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:t("translate"),format:n.format,formatType:n.formatType}),e}function Oj(t,n,e){const r=Q(t.signals),i=Q(t.scales);return e||r.forEach((t=>NB(t,n))),Q(t.projections).forEach((t=>function(t,n){const e=n.config.projection||{},r={};for(const e in t)"name"!==e&&(r[e]=UT(t[e],e,n));for(const t in e)null==r[t]&&(r[t]=UT(e[t],t,n));n.addProjection(t.name,r)}(t,n))),i.forEach((t=>function(t,n){const e=t.type||"linear";eg(e)||p("Unrecognized scale type: "+Nt(e)),n.addScale(t.name,{type:e,domain:void 0})}(t,n))),Q(t.data).forEach((t=>function(t,n){const e=[];t.transform&&t.transform.forEach((t=>{e.push(LP(t,n))})),t.on&&t.on.forEach((e=>{ej(e,n,t.name)})),n.addDataPipeline(t.name,function(t,n,e){const r=[];let i,o,a,u,s,c=null,l=!1,f=!1;for(t.values?IB(t.values)||qB(t.format)?(r.push(cj(n,t)),r.push(c=sj())):r.push(c=sj({$ingest:t.values,$format:t.format})):t.url?qB(t.url)||qB(t.format)?(r.push(cj(n,t)),r.push(c=sj())):r.push(c=sj({$request:t.url,$format:t.format})):t.source&&(c=i=Q(t.source).map((t=>zB(n.getData(t).output))),r.push(null)),o=0,a=e.length;o<a;++o)u=e[o],s=u.metadata,c||s.source||r.push(c=sj()),r.push(u),s.generates&&(f=!0),s.modifies&&!f&&(l=!0),s.source?c=u:s.changes&&(c=null);return i&&(a=i.length-1,r[0]=xT({derive:l,pulse:a?i:i[0]}),(l||a)&&r.splice(1,0,sj())),c||r.push(sj()),r.push(MT({})),r}(t,n,e))}(t,n))),i.forEach((t=>NT(t,n))),(e||r).forEach((t=>function(t,n){const e=n.getSignal(t.name);let r=t.update;t.init&&(r?p("Signals can not include both init and update expressions."):(r=t.init,e.initonly=!0)),r&&(r=V_(r,n),e.update=r.$expr,e.params=r.$params),t.on&&t.on.forEach((t=>function(t,n,e){const r=t.encode,i={target:e};let o=t.events,a=t.update,u=[];o||p("Signal update missing events specification."),$t(o)&&(o=eB(o,n.isSubscope()?RB:LB)),o=Q(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[QB(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&p("Signal encode and update are mutually exclusive."),a="encode(item(),"+Nt(r)+")"),i.update=$t(a)?V_(a,n):null!=a.expr?V_(a.expr,n):null!=a.value?a.value:null!=a.signal?{$expr:KB,$params:{$value:n.signalRef(a.signal)}}:p("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>n.addUpdate(st(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):GB(t,n)}}(t,n),i))))}(t,n,e.id)))}(t,n))),Q(t.axes).forEach((t=>Nj(t,n))),Q(t.marks).forEach((t=>rj(t,n))),Q(t.legends).forEach((t=>function(t,n){const e=n.config.legend,r=t.encode||{},i=mP(t,e),o=r.legend||{},a=o.name||void 0,u=o.interactive,s=o.style,c={};let l,f,d,h=0;oP.forEach((n=>t[n]?(c[n]=t[n],h=h||t[n]):0)),h||p("Missing valid scale for legend.");const m=function(t,n){let e=t.type||nP;return t.type||1!==function(t){return oP.reduce(((n,e)=>n+(t[e]?1:0)),0)}(t)||!t.fill&&!t.stroke||(e=ig(n)?eP:ag(n)?rP:nP),e!==eP?e:ag(n)?rP:eP}(t,n.scaleType(h)),g={title:null!=t.title,scales:c,type:m,vgrad:"symbol"!==m&&i.isVertical()},v=zB(n.add(rT(null,[g]))),y=zB(n.add(fT(f={type:m,scale:n.scaleRef(h),count:n.objectProperty(i("tickCount")),limit:n.property(i("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)})));return m===eP?(d=[wP(t,h,e,r.gradient),MP(t,e,r.labels,y)],f.count=f.count||n.signalRef(`max(2,2*floor((${WB(i.gradientLength())})/100))`)):m===rP?d=[xP(t,h,e,r.gradient,y),MP(t,e,r.labels,y)]:(l=function(t,n){const e=mP(t,n);return{align:e("gridAlign"),columns:e.entryColumns(),center:{row:!0,column:!1},padding:{row:e("rowPadding"),column:e("columnPadding")}}}(t,e),d=[AP(t,e,r,y,WB(l.columns))],f.size=function(t,n,e){const r=WB(oj("size",t,e)),i=WB(oj("strokeWidth",t,e)),o=WB(function(t,n,e){return pP("fontSize",t)||function(t,n,e){const r=n.config.style[e];return r&&r.fontSize}(0,n,e)}(e[1].encode,n,ZT));return V_(`max(ceil(sqrt(${r})+${i}),${o})`,n)}(t,n,d[0].marks)),d=[hP({role:"legend-entry",from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:l,interactive:u})],g.title&&d.push(function(t,n,e,r){const i=mP(t,n),o={enter:{opacity:uP},update:{opacity:sP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:uP}};return fB(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:OP},angle:{signal:_P},align:{signal:CP},baseline:{signal:zP},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")}),bP({type:dP,role:"legend-title",style:tP,from:r,encode:o},e)}(t,e,r.title,v)),rj(hP({role:"legend",from:v,encode:dB(ij(i,t,e),o,aP),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:s}),n)}(t,n))),t.title&&function(t,n){const e=mP(t=$t(t)?{text:t}:t,n.config.title),r=t.encode||{},i=r.group||{},o=i.name||void 0,a=i.interactive,u=i.style,s=[],c=zB(n.add(rT(null,[{}])));s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return fB(o,{text:t.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("color"),font:n("font"),fontSize:n("fontSize"),fontStyle:n("fontStyle"),fontWeight:n("fontWeight"),lineHeight:n("lineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),bP({type:dP,role:"title-text",style:"group-title",from:r,encode:o},e)}(t,e,function(t){const n=t.encode;return n&&n.title||st({name:t.name,interactive:t.interactive,style:t.style},n)}(t),c)),t.subtitle&&s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return fB(o,{text:t.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("subtitleColor"),font:n("subtitleFont"),fontSize:n("subtitleFontSize"),fontStyle:n("subtitleFontStyle"),fontWeight:n("subtitleFontWeight"),lineHeight:n("subtitleLineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),bP({type:dP,role:"title-subtitle",style:"group-subtitle",from:r,encode:o},e)}(t,e,r.subtitle,c)),rj(hP({role:"title",from:c,encode:uj(e,i),marks:s,aria:e("aria"),description:e("description"),zindex:e("zindex"),name:o,interactive:a,style:u}),n)}(t.title,n),n.parseLambdas(),n}function _j(t,n){return n&&n.signal?{name:t,update:n.signal}:{name:t,value:n}}function zj(t,n){this.config=t||{},this.options=n||{},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 Bj(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 Tj(t){return(S(t)?Pj:jj)(t)}function Pj(t){const n=t.length;let e="[";for(let r=0;r<n;++r){const n=t[r];e+=(r>0?",":"")+(F(n)?n.signal||Tj(n):Nt(n))}return e+"]"}function jj(t){let n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+Nt(n)+":"+(F(e)?e.signal||Tj(e):Nt(e));return r+"}"}zj.prototype=Bj.prototype={parse(t){return Oj(t,this)},fork(){return new Bj(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((n=>{n.$ref=t.id})),t.refs=null),t},proxy(t){const n=t instanceof CB?zB(t):t;return this.add(wT({value:n}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(t,n,e){let r,i;t&&(r=t.data||(t.data={}),i=r[n]||(r[n]=[]),i.push(e))}for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(const r in n.index)e(n.index[r],t,"index:"+r)}return this},pushState(t,n,e){this._encode.push(zB(this.add(MT({pulse:t})))),this._parent.push(n),this._lookup.push(e?zB(this.proxy(e)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return _(this._parent)},encode(){return _(this._encode)},lookup(){return _(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,n){if($t(t))return BB(t,n);t.signal||p("Unsupported field reference: "+Nt(t));const e=t.signal;let r=this.field[e];if(!r){const t={name:this.signalRef(e)};n&&(t.as=n),this.field[e]=r=zB(this.add(cT(t)))}return r},compareRef(t){let n=!1;const e=t=>IB(t)?(n=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(n=!0,this.exprRef(t.expr)):t,r=Q(t.field).map(e),i=Q(t.order).map(e);return n?zB(this.add(iT({fields:r,orders:i}))):PB(r,i)},keyRef(t,n){let e=!1;const r=this.signals;return t=Q(t).map((t=>IB(t)?(e=!0,zB(r[t.signal])):t)),e?zB(this.add(lT({fields:t,flat:n}))):function(t,n){const e={$key:t};return n&&(e.$flat=!0),e}(t,n)},sortRef(t){if(!t)return t;const n=jB(t.op,t.field),e=t.order||"ascending";return e.signal?zB(this.add(iT({fields:n,orders:this.signalRef(e.signal)}))):PB(n,e)},event(t,n){const e=t+":"+n;if(!this.events[e]){const r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},hasOwnSignal(t){return ft(this.signals,t)},addSignal(t,n){this.hasOwnSignal(t)&&p("Duplicate signal name: "+Nt(t));const e=n instanceof CB?n:this.add(_B(n));return this.signals[t]=e},getSignal(t){return this.signals[t]||p("Unrecognized signal name: "+Nt(t)),this.signals[t]},signalRef(t){return this.signals[t]?zB(this.signals[t]):(ft(this.lambdas,t)||(this.lambdas[t]=this.add(_B(null))),zB(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let n=0,e=t.length;n<e;++n){const e=t[n],r=V_(e,this),i=this.lambdas[e];i.params=r.$params,i.update=r.$expr}},property(t){return t&&t.signal?this.signalRef(t.signal):t},objectProperty(t){return t&&F(t)?this.signalRef(t.signal||Tj(t)):t},exprRef(t,n){const e={expr:V_(t,this)};return n&&(e.expr.$name=n),zB(this.add(uT(e)))},addBinding(t,n){this.bindings||p("Nested signals do not support binding: "+Nt(t)),this.bindings.push(st({signal:t},n))},addScaleProj(t,n){ft(this.scales,t)&&p("Duplicate scale or projection name: "+Nt(t)),this.scales[t]=this.add(n)},addScale(t,n){this.addScaleProj(t,kT(n))},addProjection(t,n){this.addScaleProj(t,bT(n))},getScale(t){return this.scales[t]||p("Unrecognized scale name: "+Nt(t)),this.scales[t]},scaleRef(t){return zB(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,n){return ft(this.data,t)&&p("Duplicate data set name: "+Nt(t)),this.data[t]=n},getData(t){return this.data[t]||p("Undefined data set name: "+Nt(t)),this.data[t]},addDataPipeline(t,n){return ft(this.data,t)&&p("Duplicate data set name: "+Nt(t)),this.addData(t,QP.fromEntries(this,n))}},st(_a,Zs,T$,hk,eF,ZF,TN,pN,IN,wC,_C,qC);var Rj=Object.freeze({__proto__:null,Bounds:Rv,CanvasHandler:xw,CanvasRenderer:Sw,DATE:xe,DAY:$e,DAYOFYEAR:ke,Dataflow:Na,Debug:4,DisallowedObjectProperties:M,Error:1,EventStream:ga,Gradient:Wg,GroupItem:Iv,HOURS:Me,Handler:Qb,HybridHandler:gx,HybridRenderer:px,Info:3,Item:Lv,MILLISECONDS:Se,MINUTES:Ae,MONTH:be,Marks:Tb,MultiPulse:Da,None:0,Operator:ha,Parameters:la,Pulse:$a,QUARTER:ye,RenderType:wx,Renderer:tw,ResourceLoader:qv,SECONDS:De,SVGHandler:Ew,SVGRenderer:tx,SVGStringRenderer:hx,Scenegraph:Wb,TIME_UNITS:Fe,Transform:Oa,View:Yz,WEEK:we,Warn:2,YEAR:ve,accessor:c,accessorFields:f,accessorName:l,array:Q,ascending:et,bandwidthNRD:Ra,bin:La,bootstrapCI:qa,boundClip:Fx,boundContext:cy,boundItem:Pb,boundMark:Rb,boundStroke:Hv,changeset:sa,clampRange:Z,codegenExpression:XO,compare:nt,constant:at,cumulativeLogNormal:nu,cumulativeNormal:Xa,cumulativeUniform:uu,dayofyear:Be,debounce:ut,defaultLocale:Ao,definition:za,densityLogNormal:tu,densityNormal:Va,densityUniform:au,domChild:Vb,domClear:Xb,domCreate:Gb,domFind:Yb,dotbin:Ua,error:p,expressionFunction:Y_,extend:st,extent:ct,extentIndex:lt,falsy:k,fastmap:ht,field:v,flush:mt,font:Fb,fontFamily:Sb,fontSize:$b,format:Wo,formatLocale:vo,formats:Ho,hasOwnProperty:ft,id:y,identity:b,inferType:Po,inferTypes:jo,ingest:ea,inherits:pt,inrange:gt,interpolate:pg,interpolateColors:dg,interpolateRange:fg,intersect:kx,intersectBoxLine:wy,intersectPath:gy,intersectPoint:vy,intersectRule:by,isArray:S,isBoolean:vt,isDate:yt,isFunction:tt,isIterable:bt,isNumber:wt,isObject:F,isRegExp:xt,isString:$t,isTuple:Zo,key:kt,lerp:Mt,lineHeight:kb,loader:Vo,locale:Mo,logger:D,lruCache:At,markup:Gw,merge:Dt,mergeConfig:N,multiLineOffset:Ab,one:x,pad:Ft,panLinear:I,panLog:q,panPow:U,panSymlog:W,parse:function(t,n,e){return F(t)||p("Input Vega specification must be an object."),n=N(function(){const t="sans-serif",n="#4c78a8",e="#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:n},area:{fill:n},image:null,line:{stroke:n,strokeWidth:2},path:{stroke:n},rect:{fill:n},rule:{stroke:e},shape:{stroke:n},symbol:{fill:n,size:64},text:{fill:e,font:t,fontSize:11},trail:{fill:n,size:2},style:{"guide-label":{fill:e,font:t,fontSize:10},"guide-title":{fill:e,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:e,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:e,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"]}}}(),n,t.config),function(t,n){const e=n.config,r=zB(n.root=n.add(_B())),i=function(t,n){const e=e=>UB(t[e],n[e]),r=[_j("background",e("background")),_j("autosize",aB(e("autosize"))),_j("padding",sB(e("padding"))),_j("width",e("width")||0),_j("height",e("height")||0)],i=r.reduce(((t,n)=>(t[n.name]=n,t)),{}),o={};return Q(t.signals).forEach((t=>{ft(i,t.name)?t=st(i[t.name],t):r.push(t),o[t.name]=t})),Q(n.signals).forEach((t=>{ft(o,t.name)||ft(i,t.name)||r.push(t)})),r}(t,e);i.forEach((t=>NB(t,n))),n.description=t.description||e.description,n.eventConfig=e.events,n.legends=n.objectProperty(e.legend&&e.legend.layout),n.locale=e.locale;const o=n.add(rT()),a=n.add(aT(AB((t=>dB({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),cP,pB,t.style,n,{pulse:zB(o)}))),u=n.add(DT({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:zB(a)}));n.operators.pop(),n.pushState(zB(a),zB(u),null),Oj(t,n,i),n.operators.push(u);let s=n.add(eT({mark:r,pulse:zB(u)}));return s=n.add($T({pulse:zB(s)})),s=n.add(MT({pulse:zB(s)})),n.addData("root",new QP(n,o,o,s)),n}(t,new zj(n,e)).toRuntime()},parseExpression:GO,parseSelector:eB,path:bc,pathCurves:Gg,pathEqual:Nx,pathParse:Qg,pathRectangle:$v,pathRender:cv,pathSymbols:hv,pathTrail:kv,peek:_,point:Kb,projection:MS,quantileLogNormal:eu,quantileNormal:Ja,quantileUniform:su,quantiles:Pa,quantizeInterpolator:hg,quarter:J,quartiles:ja,get random(){return Ia},randomInteger:function(t,n){let e,r,i;null==n&&(n=t,t=0);const o={min(t){return arguments.length?(e=t||0,i=r-e,o):e},max(t){return arguments.length?(r=t||0,i=r-e,o):r},sample:()=>e+Math.floor(i*Ia()),pdf:t=>t===Math.floor(t)&&t>=e&&t<r?1/i:0,cdf(t){const n=Math.floor(t);return n<e?0:n>=r?1:(n-e+1)/i},icdf:t=>t>=0&&t<=1?e-1+Math.floor(t*i):NaN};return o.min(t).max(n)},randomKDE:Qa,randomLCG:function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},randomLogNormal:ru,randomMixture:iu,randomNormal:Ka,randomUniform:cu,read:Yo,regressionConstant:lu,regressionExp:vu,regressionLinear:pu,regressionLoess:$u,regressionLog:gu,regressionPoly:wu,regressionPow:yu,regressionQuad:bu,renderModule:$x,repeat:St,resetDefaultLocale:function(){return po(),wo(),Ao()},resetSVGDefIds:function(){Pv=1,Rg=0},responseType:Go,runtimeContext:rz,sampleCurve:Du,sampleLogNormal:Za,sampleNormal:Ya,sampleUniform:ou,scale:ng,sceneEqual:Ex,sceneFromJSON:qb,scenePickVisit:Cy,sceneToJSON:Ib,sceneVisit:Ny,sceneZOrder:Ey,scheme:bg,serializeXML:Yw,setHybridRendererOptions:function(t){mx.svgMarkTypes=t.svgMarkTypes??["text"],mx.svgOnTop=t.svgOnTop??!0,mx.debug=t.debug??!1},setRandom:function(t){Ia=t},span:Et,splitAccessPath:g,stringValue:Nt,textMetrics:gb,timeBin:wr,timeFloor:Ke,timeFormatLocale:$o,timeInterval:rr,timeOffset:ar,timeSequence:cr,timeUnitSpecifier:Oe,timeUnits:Ne,toBoolean:Ct,toDate:_t,toNumber:z,toSet:Bt,toString:zt,transform:Ba,transforms:_a,truncate:Tt,truthy:$,tupleid:ta,typeParsers:zo,utcFloor:tr,utcInterval:ir,utcOffset:ur,utcSequence:lr,utcdayofyear:Ie,utcquarter:K,utcweek:qe,version:"6.2.0",visitArray:Pt,week:Te,writeConfig:C,zero:w,zoomLinear:G,zoomLog:Y,zoomPow:V,zoomSymlog:X}),Lj={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},Ij={"*":(t,n)=>t*n,"+":(t,n)=>t+n,"-":(t,n)=>t-n,"/":(t,n)=>t/n,"%":(t,n)=>t%n,">":(t,n)=>t>n,"<":(t,n)=>t<n,"<=":(t,n)=>t<=n,">=":(t,n)=>t>=n,"==":(t,n)=>t==n,"!=":(t,n)=>t!=n,"===":(t,n)=>t===n,"!==":(t,n)=>t!==n,"&":(t,n)=>t&n,"|":(t,n)=>t|n,"^":(t,n)=>t^n,"<<":(t,n)=>t<<n,">>":(t,n)=>t>>n,">>>":(t,n)=>t>>>n},qj={"+":t=>+t,"-":t=>-t,"~":t=>~t,"!":t=>!t};const Uj=Array.prototype.slice,Wj=(t,n,e)=>{const r=e?e(n[0]):n[0];return r[t].apply(r,Uj.call(n,1))};var Hj={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:(t,n,e)=>Math.max(n,Math.min(e,t)),now:Date.now,utc:Date.UTC,datetime:(t,n=0,e=1,r=0,i=0,o=0,a=0)=>$t(t)?new Date(t):new Date(t,n,e,r,i,o,a),date:t=>new Date(t).getDate(),day:t=>new Date(t).getDay(),year:t=>new Date(t).getFullYear(),month:t=>new Date(t).getMonth(),hours:t=>new Date(t).getHours(),minutes:t=>new Date(t).getMinutes(),seconds:t=>new Date(t).getSeconds(),milliseconds:t=>new Date(t).getMilliseconds(),time:t=>new Date(t).getTime(),timezoneoffset:t=>new Date(t).getTimezoneOffset(),utcdate:t=>new Date(t).getUTCDate(),utcday:t=>new Date(t).getUTCDay(),utcyear:t=>new Date(t).getUTCFullYear(),utcmonth:t=>new Date(t).getUTCMonth(),utchours:t=>new Date(t).getUTCHours(),utcminutes:t=>new Date(t).getUTCMinutes(),utcseconds:t=>new Date(t).getUTCSeconds(),utcmilliseconds:t=>new Date(t).getUTCMilliseconds(),length:t=>t.length,join:function(){return Wj("join",arguments)},indexof:function(){return Wj("indexOf",arguments)},lastindexof:function(){return Wj("lastIndexOf",arguments)},slice:function(){return Wj("slice",arguments)},reverse:t=>t.slice().reverse(),sort:t=>t.slice().sort(et),parseFloat,parseInt,upper:t=>String(t).toUpperCase(),lower:t=>String(t).toLowerCase(),substring:function(){return Wj("substring",arguments,String)},split:function(){return Wj("split",arguments,String)},replace:function(){return Wj("replace",arguments,String)},trim:t=>String(t).trim(),btoa:t=>btoa(t),atob:t=>atob(t),regexp:RegExp,test:(t,n)=>RegExp(t).test(n)};const Gj=["view","item","group","xy","x","y"],Yj=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&Yj.add(setImmediate);const Vj={Literal:(t,n)=>n.value,Identifier:(t,n)=>{const e=n.name;return t.memberDepth>0?e:"datum"===e?t.datum:"event"===e?t.event:"item"===e?t.item:Lj[e]||t.params["$"+e]},MemberExpression:(t,n)=>{const e=!n.computed,r=t(n.object);e&&(t.memberDepth+=1);const i=t(n.property);if(e&&(t.memberDepth-=1),!Yj.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(t,n)=>{const e=n.arguments;let r=n.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?t(e[0])?t(e[1]):t(e[2]):(t.fn[r]||Hj[r]).apply(t.fn,e.map(t))},ArrayExpression:(t,n)=>n.elements.map(t),BinaryExpression:(t,n)=>Ij[n.operator](t(n.left),t(n.right)),UnaryExpression:(t,n)=>qj[n.operator](t(n.argument)),ConditionalExpression:(t,n)=>t(n.test)?t(n.consequent):t(n.alternate),LogicalExpression:(t,n)=>"&&"===n.operator?t(n.left)&&t(n.right):t(n.left)||t(n.right),ObjectExpression:(t,n)=>n.properties.reduce(((n,e)=>{t.memberDepth+=1;const r=t(e.key);t.memberDepth-=1;const i=t(e.value);return M.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):Yj.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):n[r]=i,n}),{})};function Xj(t,n,e,r,i,o){const a=t=>Vj[t.type](a,t);return a.memberDepth=0,a.fn=Object.create(n),a.params=e,a.datum=r,a.event=i,a.item=o,Gj.forEach((t=>a.fn[t]=(...n)=>i.vega[t](...n))),a(t)}var Jj={operator(t,n){const e=n.ast,r=t.functions;return t=>Xj(e,r,t)},parameter(t,n){const e=n.ast,r=t.functions;return(t,n)=>Xj(e,r,n,t)},event(t,n){const e=n.ast,r=t.functions;return t=>Xj(e,r,void 0,void 0,t)},handler(t,n){const e=n.ast,r=t.functions;return(t,n)=>Xj(e,r,t,n.item&&n.item.datum,n)},encode(t,n){const{marktype:e,channels:r}=n,i=t.functions,o="group"===e||"image"===e||"rect"===e;return(t,n)=>{const a=t.datum;let u,s=0;for(const e in r)u=Xj(r[e].ast,i,n,a,void 0,t),t[e]!==u&&(t[e]=u,s=1);return"rule"!==e&&function(t,n,e){let r;n.x2&&(n.x?(e&&t.x>t.x2&&(r=t.x,t.x=t.x2,t.x2=r),t.width=t.x2-t.x):t.x=t.x2-(t.width||0)),n.xc&&(t.x=t.xc-(t.width||0)/2),n.y2&&(n.y?(e&&t.y>t.y2&&(r=t.y,t.y=t.y2,t.y2=r),t.height=t.y2-t.y):t.y=t.y2-(t.height||0)),n.yc&&(t.y=t.yc-(t.height||0)/2)}(t,r,o),s}}};function Kj(t){return GR(t,"or")}function Qj(t){return GR(t,"and")}function Zj(t){return GR(t,"not")}function tR(t,n){if(Zj(t))tR(t.not,n);else if(Qj(t))for(const e of t.and)tR(e,n);else if(Kj(t))for(const e of t.or)tR(e,n);else n(t)}function nR(t,n){return Zj(t)?{not:nR(t.not,n)}:Qj(t)?{and:t.and.map((t=>nR(t,n)))}:Kj(t)?{or:t.or.map((t=>nR(t,n)))}:n(t)}const eR=structuredClone;function rR(t){throw new Error(t)}function iR(t,n){const e={};for(const r of n)ft(t,r)&&(e[r]=t[r]);return e}function oR(t,n){const e={...t};for(const t of n)delete e[t];return e}function aR(t){if(wt(t))return t;const n=$t(t)?t:HR(t);if(n.length<250)return n;let e=0;for(let t=0;t<n.length;t++)e=(e<<5)-e+n.charCodeAt(t),e|=0;return e}function uR(t){return!1===t||null===t}function sR(t,n){return t.includes(n)}function cR(t,n){let e=0;for(const[r,i]of t.entries())if(n(i,r,e++))return!0;return!1}function lR(t,n){let e=0;for(const[r,i]of t.entries())if(!n(i,r,e++))return!1;return!0}function fR(t,...n){for(const e of n)dR(t,e??{});return t}function dR(t,n){for(const e of bR(n))C(t,e,n[e],!0)}function hR(t,n){const e=[],r={};let i;for(const o of t)i=n(o),i in r||(r[i]=1,e.push(o));return e}function mR(t,n){if(t.size!==n.size)return!1;for(const e of t)if(!n.has(e))return!1;return!0}function pR(t,n){for(const e of t)if(n.has(e))return!0;return!1}function gR(t){const n=new Set;for(const e of t){const t=g(e).map(((t,n)=>0===n?t:`[${t}]`)),r=t.map(((n,e)=>t.slice(0,e+1).join("")));for(const t of r)n.add(t)}return n}function vR(t,n){return void 0===t||void 0===n||pR(gR(t),gR(n))}function yR(t){return 0===bR(t).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((t=>HR(t))).join(",")})`};const bR=Object.keys,wR=Object.values,xR=Object.entries;function $R(t){return!0===t||!1===t}function kR(t){const n=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+n}function MR(t,n){return Zj(t)?`!(${MR(t.not,n)})`:Qj(t)?`(${t.and.map((t=>MR(t,n))).join(") && (")})`:Kj(t)?`(${t.or.map((t=>MR(t,n))).join(") || (")})`:n(t)}function AR(t,n){if(0===n.length)return!0;const e=n.shift();return e in t&&AR(t[e],n)&&delete t[e],yR(t)}function DR(t){return t.charAt(0).toUpperCase()+t.substr(1)}function SR(t,n="datum"){const e=g(t),r=[];for(let t=1;t<=e.length;t++){const i=`[${e.slice(0,t).map(Nt).join("][")}]`;r.push(`${n}${i}`)}return r.join(" && ")}function FR(t,n="datum"){return`${n}[${Nt(g(t).join("."))}]`}function ER(t){return`datum['${t.replaceAll("'","\\'")}']`}function NR(t){return t.replaceAll("\\'","'").replaceAll("\\.",".")}function CR(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function OR(t){return`${g(t).map(CR).join("\\.")}`}function _R(t,n,e){return t.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),e)}function zR(t){return`${g(t).join(".")}`}function BR(t){return t?g(t).length:0}function TR(...t){return t.find((t=>void 0!==t))}let PR=42;function jR(t){const n=++PR;return t?String(t)+n:n}function RR(t){return LR(t)?t:`__${t}`}function LR(t){return t.startsWith("__")}function IR(t){if(void 0!==t)return(t%360+360)%360}function qR(t){return!!wt(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const UR=Object.getPrototypeOf(structuredClone({}));function WR(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor.name!==n.constructor.name)return!1;let e,r;if(Array.isArray(t)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(!WR(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;for(const e of t.entries())if(!WR(e[1],n.get(e[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf&&t.valueOf!==UR.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString&&t.toString!==UR.toString)return t.toString()===n.toString();const i=Object.keys(t);if(e=i.length,e!==Object.keys(n).length)return!1;for(r=e;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=e;0!=r--;){const e=i[r];if(!WR(t[e],n[e]))return!1}return!0}return t!=t&&n!=n}function HR(t){const n=[];return function t(e){if(e?.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0===e)return;if("number"==typeof e)return isFinite(e)?`${e}`:"null";if("object"!=typeof e)return JSON.stringify(e);let r,i;if(Array.isArray(e)){for(i="[",r=0;r<e.length;r++)r&&(i+=","),i+=t(e[r])||"null";return`${i}]`}if(null===e)return"null";if(n.includes(e))throw new TypeError("Converting circular structure to JSON");const o=n.push(e)-1,a=Object.keys(e).sort();for(i="",r=0;r<a.length;r++){const n=a[r],o=t(e[n]);o&&(i&&(i+=","),i+=`${JSON.stringify(n)}:${o}`)}return n.splice(o,1),`{${i}}`}(t)}function GR(t,n){return F(t)&&ft(t,n)&&void 0!==t[n]}const YR="row",VR="column",XR="facet",JR="x",KR="y",QR="x2",ZR="y2",tL="xOffset",nL="yOffset",eL="radius",rL="radius2",iL="theta",oL="theta2",aL="latitude",uL="longitude",sL="latitude2",cL="longitude2",lL="time",fL="color",dL="fill",hL="stroke",mL="shape",pL="size",gL="angle",vL="opacity",yL="fillOpacity",bL="strokeOpacity",wL="strokeWidth",xL="strokeDash",$L="text",kL="order",ML="detail",AL="key",DL="tooltip",SL="href",FL="url",EL="description",NL={theta:1,theta2:1,radius:1,radius2:1};function CL(t){return ft(NL,t)}const OL={longitude:1,longitude2:1,latitude:1,latitude2:1};function _L(t){switch(t){case aL:return"y";case sL:return"y2";case uL:return"x";case cL:return"x2"}}function zL(t){return ft(OL,t)}const BL=bR(OL),TL={x:1,y:1,x2:1,y2:1,...NL,...OL,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 PL(t){return t===fL||t===dL||t===hL}const jL={row:1,column:1,facet:1},RL=bR(jL),LL={...TL,...jL},IL=bR(LL),{order:qL,detail:UL,tooltip:WL,...HL}=LL,{row:GL,column:YL,facet:VL,...XL}=HL;function JL(t){return ft(LL,t)}const KL=[QR,ZR,sL,cL,oL,rL];function QL(t){return ZL(t)!==t}function ZL(t){switch(t){case QR:return JR;case ZR:return KR;case sL:return aL;case cL:return uL;case oL:return iL;case rL:return eL}return t}function tI(t){if(CL(t))switch(t){case iL:return"startAngle";case oL:return"endAngle";case eL:return"outerRadius";case rL:return"innerRadius"}return t}function nI(t){switch(t){case JR:return QR;case KR:return ZR;case aL:return sL;case uL:return cL;case iL:return oL;case eL:return rL}}function eI(t){switch(t){case JR:case QR:return"width";case KR:case ZR:return"height"}}function rI(t){switch(t){case JR:return"xOffset";case KR:return"yOffset";case QR:return"x2Offset";case ZR:return"y2Offset";case iL:return"thetaOffset";case eL:return"radiusOffset";case oL:return"theta2Offset";case rL:return"radius2Offset"}}function iI(t){switch(t){case JR:return"xOffset";case KR:return"yOffset"}}function oI(t){switch(t){case"xOffset":return"x";case"yOffset":return"y"}}const aI=bR(TL),{x:uI,y:sI,x2:cI,y2:lI,xOffset:fI,yOffset:dI,latitude:hI,longitude:mI,latitude2:pI,longitude2:gI,theta:vI,theta2:yI,radius:bI,radius2:wI,...xI}=TL,$I=bR(xI),kI={x:1,y:1},MI=bR(kI);function AI(t){return ft(kI,t)}const DI={theta:1,radius:1},SI=bR(DI);function FI(t){return"width"===t?JR:KR}const EI={xOffset:1,yOffset:1};function NI(t){return ft(EI,t)}const CI={time:1};function OI(t){return t in CI}const{text:_I,tooltip:zI,href:BI,url:TI,description:PI,detail:jI,key:RI,order:LI,...II}=xI,qI=bR(II),UI={...kI,...DI,...EI,...II},WI=bR(UI);function HI(t){return ft(UI,t)}const GI={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:YI,...VI}=GI;function XI(t){switch(t){case JR:case KR:case iL:case eL:case tL:case nL:case pL:case gL:case wL:case vL:case yL:case bL:case lL:case QR:case ZR:case oL:case rL:return;case XR:case YR:case VR:case mL:case xL:case $L:case DL:case SL:case FL:case EL:return"discrete";case fL:case dL:case hL:return"flexible";case aL:case uL:case sL:case cL:case ML:case AL:case kL:return}}const JI={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},KI={count:1,min:1,max:1};function QI(t){return GR(t,"argmin")}function ZI(t){return GR(t,"argmax")}function tq(t){return $t(t)&&ft(JI,t)}const nq=new Set(["count","valid","missing","distinct"]);function eq(t){return $t(t)&&nq.has(t)}const rq=new Set(["count","sum","distinct","valid","missing"]),iq=new Set(["mean","average","median","q1","q3","min","max"]);function oq(t){return vt(t)&&(t=xG(t,void 0)),`bin${bR(t).map((n=>cq(t[n])?kR(`_${n}_${xR(t[n])}`):kR(`_${n}_${t[n]}`))).join("")}`}function aq(t){return!0===t||sq(t)&&!t.binned}function uq(t){return"binned"===t||sq(t)&&!0===t.binned}function sq(t){return F(t)}function cq(t){return GR(t,"param")}function lq(t){switch(t){case YR:case VR:case pL:case fL:case dL:case hL:case wL:case vL:case yL:case bL:case mL:return 6;case xL:return 4;default:return 10}}function fq(t){return GR(t,"expr")}function dq(t,{level:n}={level:0}){const e=bR(t||{}),r={};for(const i of e)r[i]=0===n?$q(t[i]):dq(t[i],{level:n-1});return r}function hq(t){const{anchor:n,frame:e,offset:r,orient:i,angle:o,limit:a,color:u,subtitleColor:s,subtitleFont:c,subtitleFontSize:l,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:m,...p}=t,g={...n?{anchor:n}:{},...e?{frame:e}:{},...r?{offset:r}:{},...i?{orient:i}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...s?{subtitleColor:s}:{},...c?{subtitleFont:c}:{},...l?{subtitleFontSize:l}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:{...p,...u?{fill:u}:{}},subtitleMarkConfig:iR(t,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:v}}function mq(t){return $t(t)||S(t)&&$t(t[0])}function pq(t){return GR(t,"signal")}function gq(t){return GR(t,"step")}function vq(t){return!S(t)&&GR(t,"field")&&GR(t,"data")}const yq=bR({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}),bq={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},wq=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function xq(t){const n=S(t.condition)?t.condition.map(kq):kq(t.condition);return{...$q(t),condition:n}}function $q(t){if(fq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function kq(t){if(fq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Mq(t){if(fq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return pq(t)?t:void 0!==t?{value:t}:void 0}function Aq(t){return pq(t)?t.signal:Nt(t)}function Dq(t){return pq(t)?t.signal:Nt(t.value)}function Sq(t){return pq(t)?t.signal:null==t?null:Nt(t)}function Fq(t,n,e){for(const r of e){const e=Cq(r,n.markDef,n.config);void 0!==e&&(t[r]=Mq(e))}return t}function Eq(t){return[].concat(t.type,t.style??[])}function Nq(t,n,e,r={}){const{vgChannel:i,ignoreVgConfig:o}=r;return i&&GR(n,i)?n[i]:void 0!==n[t]?n[t]:!o||i&&i!==t?Cq(t,n,e,r):void 0}function Cq(t,n,e,{vgChannel:r}={}){const i=Oq(t,n,e.style);return TR(r?i:void 0,i,r?e[n.type][r]:void 0,e[n.type][t],r?e.mark[r]:e.mark[t])}function Oq(t,n,e){return _q(t,Eq(n),e)}function _q(t,n,e){let r;n=Q(n);for(const i of n){const n=e[i];GR(n,t)&&(r=n[t])}return r}function zq(t,n){return Q(t).reduce(((t,e)=>(t.field.push(uG(e,n)),t.order.push(e.sort??"ascending"),t)),{field:[],order:[]})}function Bq(t,n){const e=[...t];return n.forEach((t=>{for(const n of e)if(WR(n,t))return;e.push(t)})),e}function Tq(t,n){return WR(t,n)||!n?t:t?[...Q(t),...Q(n)].join(", "):n}function Pq(t,n){const e=t.value,r=n.value;if(null==e||null===r)return{explicit:t.explicit,value:null};if((mq(e)||pq(e))&&(mq(r)||pq(r)))return{explicit:t.explicit,value:Tq(e,r)};if(mq(e)||pq(e))return{explicit:t.explicit,value:e};if(mq(r)||pq(r))return{explicit:t.explicit,value:r};if(!(mq(e)||pq(e)||mq(r)||pq(r)))return{explicit:t.explicit,value:Bq(e,r)};throw new Error("It should never reach here")}function jq(t){return`Invalid specification ${HR(t)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function Rq(t){return("width"==t?"Width":"Height")+' "container" only works for single views and layered views.'}function Lq(t){return`${"width"==t?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==t?"x":"y"}".`}function Iq(t){return t?`Dropping "fit-${t}" because spec has discrete ${eI(t)}.`:'Dropping "fit" because spec has discrete size.'}function qq(t){return`Unknown field for ${t}. Cannot calculate view size.`}function Uq(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`}function Wq(t,n){return`Cannot project a selection on encoding channel "${t}" as it uses an aggregate function ("${n}").`}function Hq(t){return`Selection not supported for ${t} yet.`}function Gq(t){return`The "columns" property cannot be used when "${t}" has nested row/column.`}const Yq="Animation involving facet, layer, or concat is currently unsupported.";function Vq(t,n,e){return`An ancestor parsed field "${t}" as ${e} but a child wants to parse the field as ${n}.`}function Xq(t){return`Ignoring an invalid transform: ${HR(t)}.`}function Jq(t){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${t} are dropped.`}function Kq(t){return`${t}Offset dropped because ${t} is continuous`}function Qq(t){return`Invalid field type "${t}".`}function Zq(t,n){const{fill:e,stroke:r}=n;return`Dropping color ${t} as the plot also has ${e&&r?"fill and stroke":e?"fill":"stroke"}.`}function tU(t,n){return`Dropping ${HR(t)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}function nU(t,n){return`${t} dropped as it is incompatible with "${n}".`}function eU(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`}function rU(t){return`${t} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function iU(t,n){return`Using discrete channel "${t}" to encode "${n}" field can be misleading as it does not encode ${"ordinal"===n?"order":"magnitude"}.`}function oU(t){return`Using unaggregated domain with raw field has no effect (${HR(t)}).`}function aU(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`}function uU(t){return`Unaggregated domain is currently unsupported for log scale (${HR(t)}).`}function sU(t,n,e){return`${e}-scale's "${n}" is dropped as it does not work with ${t} scale.`}function cU(t){return`The step for "${t}" is dropped because the ${"width"===t?"x":"y"} is continuous.`}const lU="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function fU(t,n){return`Invalid ${t}: ${HR(n)}.`}function dU(t){return`1D error band does not support ${t}.`}function hU(t){return`Channel ${t} is required for "binned" bin.`}const mU=D(2);let pU=mU;function gU(...t){pU.error(...t)}function vU(...t){pU.warn(...t)}function yU(t){if(t&&F(t))for(const n of DU)if(GR(t,n))return!0;return!1}const bU=["january","february","march","april","may","june","july","august","september","october","november","december"],wU=bU.map((t=>t.substr(0,3))),xU=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],$U=xU.map((t=>t.substr(0,3)));function kU(t,n){const e=[];if(n&&void 0!==t.day&&bR(t).length>1&&(vU(function(t){return`Dropping day from datetime ${HR(t)} as day cannot be combined with other units.`}(t)),delete(t=eR(t)).day),e.push(void 0!==t.year?t.year:2012),void 0!==t.month){const r=n?function(t){if(qR(t)&&(t=+t),wt(t))return t-1;{const n=t.toLowerCase(),e=bU.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=wU.indexOf(r);if(-1!==i)return i;throw new Error(fU("month",t))}}(t.month):t.month;e.push(r)}else if(void 0!==t.quarter){const r=n?function(t){if(qR(t)&&(t=+t),wt(t))return t>4&&vU(fU("quarter",t)),t-1;throw new Error(fU("quarter",t))}(t.quarter):t.quarter;e.push(wt(r)?3*r:`${r}*3`)}else e.push(0);if(void 0!==t.date)e.push(t.date);else if(void 0!==t.day){const r=n?function(t){if(qR(t)&&(t=+t),wt(t))return t%7;{const n=t.toLowerCase(),e=xU.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=$U.indexOf(r);if(-1!==i)return i;throw new Error(fU("day",t))}}(t.day):t.day;e.push(wt(r)?r+1:`${r}+1`)}else e.push(1);for(const n of["hours","minutes","seconds","milliseconds"]){const r=t[n];e.push(void 0===r?0:r)}return e}function MU(t){const n=kU(t,!0).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}const AU={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},DU=bR(AU);function SU(t){return F(t)?t.binned:FU(t)}function FU(t){return t?.startsWith("binned")}function EU(t){return t.startsWith("utc")}const NU={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function CU(t){return DU.filter((n=>_U(t,n)))}function OU(t){const n=CU(t);return n[n.length-1]}function _U(t,n){const e=t.indexOf(n);return!(e<0||e>0&&"seconds"===n&&"i"===t.charAt(e-1)||t.length>e+3&&"day"===n&&"o"===t.charAt(e+3)||e>0&&"year"===n&&"f"===t.charAt(e-1))}function zU(t){if(t)return`timeUnitSpecifier(${HR(CU(t))}, ${HR(NU)})`}function BU(t){if(!t)return;let n;return $t(t)?n=FU(t)?{unit:t.substring(6),binned:!0}:{unit:t}:F(t)&&(n={...t,...t.unit?{unit:t.unit}:{}}),EU(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function TU(t,n=t=>t){const e=BU(t),r=OU(e.unit);if(r&&"day"!==r){const t={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:o}=jU(r,e.step);return`${n(MU({...t,[o]:+t[o]+i}))} - ${n(MU(t))}`}}const PU={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function jU(t,n=1){if(function(t){return ft(PU,t)}(t))return{part:t,step:n};switch(t){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 RU(t){return!!t?.field&&void 0!==t.equal}function LU(t){return!!t?.field&&void 0!==t.lt}function IU(t){return!!t?.field&&void 0!==t.lte}function qU(t){return!!t?.field&&void 0!==t.gt}function UU(t){return!!t?.field&&void 0!==t.gte}function WU(t){if(t?.field){if(S(t.range)&&2===t.range.length)return!0;if(pq(t.range))return!0}return!1}function HU(t){return!!t?.field&&(S(t.oneOf)||S(t.in))}function GU(t){return HU(t)||RU(t)||WU(t)||LU(t)||qU(t)||IU(t)||UU(t)}function YU(t,n){return MG(t,{timeUnit:n,wrapTime:!0})}function VU(t,n=!0){const{field:e}=t,r=BU(t.timeUnit),{unit:i,binned:o}=r||{},a=uG(t,{expr:"datum"}),u=i?`time(${o?a:function(t,n,{end:e}={end:!1}){const r=SR(n),i=EU(t)?"utc":"";let o;const a={};for(const n of DU)_U(t,n)&&(a[n]="quarter"===(u=n)?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`,o=n);var u;return e&&(a[o]+="+1"),function(t){const n=kU(t,!1).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}(a)}(i,e)})`:a;if(RU(t))return`${u}===${YU(t.equal,i)}`;if(LU(t))return`${u}<${YU(t.lt,i)}`;if(qU(t))return`${u}>${YU(t.gt,i)}`;if(IU(t))return`${u}<=${YU(t.lte,i)}`;if(UU(t))return`${u}>=${YU(t.gte,i)}`;if(HU(t))return`indexof([${function(t,n){return t.map((t=>YU(t,n)))}(t.oneOf,i).join(",")}], ${u}) !== -1`;if(function(t){return!!t?.field&&void 0!==t.valid}(t))return XU(u,t.valid);if(WU(t)){const{range:e}=dq(t),r=pq(e)?{signal:`${e.signal}[0]`}:e[0],o=pq(e)?{signal:`${e.signal}[1]`}:e[1];if(null!==r&&null!==o&&n)return`inrange(${u}, [${YU(r,i)}, ${YU(o,i)}])`;const a=[];return null!==r&&a.push(`${u} >= ${YU(r,i)}`),null!==o&&a.push(`${u} <= ${YU(o,i)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${HR(t)}`)}function XU(t,n=!0){return n?`isValid(${t}) && isFinite(+${t})`:`!isValid(${t}) || !isFinite(+${t})`}function JU(t){return GU(t)&&t.timeUnit?{...t,timeUnit:BU(t.timeUnit)}:t}function KU(t){return"quantitative"===t||"temporal"===t}function QU(t){return"ordinal"===t||"nominal"===t}const ZU="quantitative",tW="ordinal",nW="temporal",eW="nominal",rW="geojson",iW="linear",oW="time",aW="utc",uW="point",sW="band",cW={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 lW(t,n){const e=cW[t],r=cW[n];return e===r||"ordinal-position"===e&&"time"===r||"ordinal-position"===r&&"time"===e}const fW={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 dW(t){return fW[t]}const hW=new Set(["linear","log","pow","sqrt","symlog"]),mW=new Set([...hW,"time","utc"]);function pW(t){return hW.has(t)}const gW=new Set(["quantile","quantize","threshold"]),vW=new Set([...mW,...gW,"sequential","identity"]),yW=new Set(["ordinal","bin-ordinal","point","band"]);function bW(t){return yW.has(t)}function wW(t){return vW.has(t)}function xW(t){return mW.has(t)}function $W(t){return gW.has(t)}function kW(t){return GR(t,"param")}const{type:MW,domain:AW,range:DW,rangeMax:SW,rangeMin:FW,scheme:EW,...NW}={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},CW=bR(NW);function OW(t,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(t);case"bins":return!["point","band","identity","ordinal"].includes(t);case"round":return xW(t)||"band"===t||"point"===t;case"padding":case"rangeMin":case"rangeMax":return xW(t)||["point","band"].includes(t);case"paddingOuter":case"align":return["point","band"].includes(t);case"paddingInner":return"band"===t;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return xW(t);case"nice":return xW(t)||"quantize"===t||"threshold"===t;case"exponent":return"pow"===t;case"base":return"log"===t;case"constant":return"symlog"===t;case"zero":return wW(t)&&!sR(["log","time","utc","threshold","quantile"],t)}}function _W(t,n){switch(n){case"interpolate":case"scheme":case"domainMid":return PL(t)?void 0:`Cannot use the scale property "${n}" 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 zW={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"},BW=zW.arc,TW=zW.area,PW=zW.bar,jW=zW.image,RW=zW.line,LW=zW.point,IW=zW.rect,qW=zW.rule,UW=zW.text,WW=zW.tick,HW=zW.trail,GW=zW.circle,YW=zW.square,VW=zW.geoshape;function XW(t){return["line","area","trail"].includes(t)}function JW(t){return["rect","bar","image","arc","tick"].includes(t)}const KW=new Set(bR(zW));function QW(t){return GR(t,"type")}const ZW=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],tH=bR({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),nH=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],eH={area:["line","point"],bar:nH,rect:nH,line:["point"],tick:["bandSize","thickness",...nH]},rH=bR({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 iH(t){return GR(t,"band")}const oH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},aH={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},uH={...aH,binSpacing:1},sH={...aH,thickness:1};function cH(t,{isPath:n}){return void 0===t||"break-paths-show-path-domains"===t?n?"break-paths-show-domains":"filter":null===t?"show":t}function lH({markDef:t,config:n,scaleChannel:e,scaleType:r,isCountAggregate:i}){if(!r||!wW(r)||i)return"always-valid";const o=cH(Nq("invalid",t,n),{isPath:XW(t.type)}),a=n.scale?.invalid?.[e];return void 0!==a?"show":o}function fH({scaleName:t,scale:n,mode:e}){const r=`domain('${t}')`;if(!n||!t)return;const i=`${r}[0]`,o=`peek(${r})`,a=n.domainHasZero();return"definitely"===a?{scale:t,value:0}:"maybe"===a?{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${"zeroOrMin"===e?i:o})`}:{signal:`scale('${t}', ${"zeroOrMin"===e?i:o})`}}function dH({scaleChannel:t,channelDef:n,scale:e,scaleName:r,markDef:i,config:o}){const a=e?.get("type"),u=gG(n),s=lH({scaleChannel:t,markDef:i,config:o,scaleType:a,isCountAggregate:eq(u?.aggregate)});if(u&&"show"===s){const n=o.scale.invalid?.[t]??"zero-or-min";return{test:XU(uG(u,{expr:"datum"}),!1),...hH(n,e,r)}}}function hH(t,n,e){if(F(r=t)&&"value"in r){const{value:n}=t;return pq(n)?{signal:n.signal}:{value:n}}var r;return fH({scale:n,scaleName:e,mode:"zeroOrMin"})}function mH(t){const{channel:n,channelDef:e,markDef:r,scale:i,scaleName:o,config:a}=t,u=ZL(n),s=vH(t),c=dH({scaleChannel:u,channelDef:e,scale:i,scaleName:o,markDef:r,config:a});return void 0!==c?[c,s]:s}function pH(t,n,e,r){const i={};if(n&&(i.scale=n),XH(t)){const{datum:n}=t;yU(n)?i.signal=MU(n):pq(n)?i.signal=n.signal:fq(n)?i.signal=n.expr:i.value=n}else i.field=uG(t,e);if(r){const{offset:t,band:n}=r;t&&(i.offset=t),n&&(i.band=n)}return i}function gH({scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:e,offset:r,startSuffix:i,endSuffix:o="end",bandPosition:a=.5}){const u=!pq(a)&&0<a&&a<1?"datum":void 0,s=uG(n,{expr:u,suffix:i}),c=void 0!==e?uG(e,{expr:u}):uG(n,{suffix:o,expr:u}),l={};if(0===a||1===a)l.scale=t,l.field=0===a?s:c;else{const n=pq(a)?`(1-${a.signal}) * ${s} + ${a.signal} * ${c}`:`${1-a} * ${s} + ${a} * ${c}`;l.signal=`scale("${t}", ${n})`}return r&&(l.offset=r),l}function vH({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c,bandPosition:l}){if(n){if(ZH(n)){const c=a?.get("type");if(tG(n)){l??=LH({fieldDef:n,fieldDef2:e,markDef:r,config:i});const{bin:a,timeUnit:f,type:d}=n;if(aq(a)||l&&f&&d===nW)return u?.impute?pH(n,o,{binSuffix:"mid"},{offset:s}):l&&!bW(c)?gH({scaleName:o,fieldOrDatumDef:n,bandPosition:l,offset:s}):pH(n,o,DG(n,t)?{binSuffix:"range"}:{},{offset:s});if(uq(a)){if(YH(e))return gH({scaleName:o,fieldOrDatumDef:n,fieldOrDatumDef2:e,bandPosition:l,offset:s});vU(hU(t===JR?QR:ZR))}}return pH(n,o,bW(c)?{binSuffix:"range"}:{},{offset:s,band:"band"===c?l??n.bandPosition??.5:void 0})}if(nG(n)){const e=s?{offset:s}:{};return{...yH(t,n.value),...e}}}return tt(c)&&(c=c()),c?{...c,...s?{offset:s}:{}}:c}function yH(t,n){return sR(["x","x2"],t)&&"width"===n?{field:{group:"width"}}:sR(["y","y2"],t)&&"height"===n?{field:{group:"height"}}:Mq(n)}function bH(t){return t&&"number"!==t&&"time"!==t}function wH(t,n,e){return`${t}(${n}${e?`, ${HR(e)}`:""})`}function xH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o}){if(bH(e))return kH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,config:o});const a=$H(t,r,i),u=VH(t);if(void 0===n&&void 0===e&&o.customFormatTypes){if("quantitative"===u){if(i&&o.normalizedNumberFormatType)return kH({fieldOrDatumDef:t,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:r,config:o});if(o.numberFormatType)return kH({fieldOrDatumDef:t,format:o.numberFormat,formatType:o.numberFormatType,expr:r,config:o})}if("temporal"===u&&o.timeFormatType&&YH(t)&&void 0===t.timeUnit)return kH({fieldOrDatumDef:t,format:o.timeFormat,formatType:o.timeFormatType,expr:r,config:o})}if(kG(t)){const{unit:e,utc:r}=function(t){return YH(t)?BU(t.timeUnit)||{}:{unit:void 0,utc:void 0}}(t),i=function({field:t,timeUnit:n,format:e,formatType:r,rawTimeFormat:i,isUTCScale:o}){return!n||e?!n&&r?`${r}(${t}, ${HR(e)})`:`${o?"utc":"time"}Format(${t}, ${HR(e=$t(e)?e:i)})`:function(t,n,e){if(!t)return;const r=zU(t);return`${e||EU(t)?"utc":"time"}Format(${n}, ${r})`}(n,t,o)}({field:a,timeUnit:e,format:n,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:r||eG(t)&&t.scale?.type===aW});return i?{signal:i}:void 0}return n=DH({type:u,specifiedFormat:n,config:o,normalizeStack:i}),YH(t)&&aq(t.bin)?{signal:EH(a,uG(t,{expr:r,binSuffix:"end"}),n,e,o)}:n||"quantitative"===VH(t)?{signal:`${SH(a,n)}`}:{signal:`isValid(${a}) ? ${a} : ""+${a}`}}function $H(t,n,e){return YH(t)?e?`${uG(t,{expr:n,suffix:"end"})}-${uG(t,{expr:n,suffix:"start"})}`:uG(t,{expr:n}):function(t){const{datum:n}=t;return yU(n)?MU(n):`${HR(n)}`}(t)}function kH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o,field:a}){return a??=$H(t,r,i),"datum.value"!==a&&YH(t)&&aq(t.bin)?{signal:EH(a,uG(t,{expr:r,binSuffix:"end"}),n,e,o)}:{signal:wH(e,a,n)}}function MH(t,n,e,r,i,o){if(!$t(r)||!bH(r)){if(void 0===e&&void 0===r&&i.customFormatTypes&&"quantitative"===VH(t)){if(i.normalizedNumberFormatType&&rG(t)&&"normalize"===t.stack)return;if(i.numberFormatType)return}if(rG(t)&&"normalize"===t.stack&&i.normalizedNumberFormat)return DH({type:"quantitative",config:i,normalizeStack:!0});if(kG(t)){const n=YH(t)?BU(t.timeUnit)?.unit:void 0;if(void 0===n&&i.customFormatTypes&&i.timeFormatType)return;return function({specifiedFormat:t,timeUnit:n,config:e,omitTimeFormatConfig:r}){return t||(n?{signal:zU(n)}:r?void 0:e.timeFormat)}({specifiedFormat:e,timeUnit:n,config:i,omitTimeFormatConfig:o})}return DH({type:n,specifiedFormat:e,config:i})}}function AH(t,n,e){return t&&(pq(t)||"number"===t||"time"===t)?t:kG(n)&&"time"!==e&&"utc"!==e?YH(n)&&BU(n?.timeUnit)?.utc?"utc":"time":void 0}function DH({type:t,specifiedFormat:n,config:e,normalizeStack:r}){return $t(n)?n:t===ZU?r?e.normalizedNumberFormat:e.numberFormat:void 0}function SH(t,n){return`format(${t}, "${n||""}")`}function FH(t,n,e,r){return bH(e)?wH(e,t,n):SH(t,($t(n)?n:void 0)??r.numberFormat)}function EH(t,n,e,r,i){if(void 0===e&&void 0===r&&i.customFormatTypes&&i.numberFormatType)return EH(t,n,i.numberFormat,i.numberFormatType,i);const o=FH(t,e,r,i),a=FH(n,e,r,i);return`${XU(t,!1)} ? "null" : ${o} + " – " + ${a}`}const NH="min",CH={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 OH(t){return ft(CH,t)}function _H(t){return t&&("count"===t.op||GR(t,"field"))}function zH(t){return t&&S(t)}function BH(t){return GR(t,"row")||GR(t,"column")}function TH(t){return GR(t,"header")}function PH(t){return GR(t,"facet")}function jH(t){const{field:n,timeUnit:e,bin:r,aggregate:i}=t;return{...e?{timeUnit:e}:{},...r?{bin:r}:{},...i?{aggregate:i}:{},field:n}}function RH(t){return GR(t,"sort")}function LH({fieldDef:t,fieldDef2:n,markDef:e,config:r}){if(ZH(t)&&void 0!==t.bandPosition)return t.bandPosition;if(YH(t)){const{timeUnit:i,bin:o}=t;if(i&&!n)return Cq("timeUnitBandPosition",e,r);if(aq(o))return.5}}function IH({channel:t,fieldDef:n,fieldDef2:e,markDef:r,config:i,scaleType:o,useVlSizeChannel:a}){const u=eI(t),s=Nq(a?"size":u,r,i,{vgChannel:u});if(void 0!==s)return s;if(YH(n)){const{timeUnit:t,bin:a}=n;if(t&&!e)return{band:Cq("timeUnitBandSize",r,i)};if(aq(a)&&!bW(o))return{band:1}}return JW(r.type)?o?bW(o)?i[r.type]?.discreteBandSize||{band:1}:i[r.type]?.continuousBandSize:i[r.type]?.discreteBandSize:void 0}function qH(t,n,e,r){return!!(aq(t.bin)||t.timeUnit&&tG(t)&&"temporal"===t.type)&&void 0!==LH({fieldDef:t,fieldDef2:n,markDef:e,config:r})}function UH(t){return GR(t,"sort")&&!GR(t,"field")}function WH(t){return GR(t,"condition")}function HH(t){const n=t?.condition;return!!n&&!S(n)&&YH(n)}function GH(t){const n=t?.condition;return!!n&&!S(n)&&ZH(n)}function YH(t){return GR(t,"field")||"count"===t?.aggregate}function VH(t){return t?.type}function XH(t){return GR(t,"datum")}function JH(t){return tG(t)&&!sG(t)||QH(t)}function KH(t){return tG(t)&&"quantitative"===t.type&&!t.bin||QH(t)}function QH(t){return XH(t)&&wt(t.datum)}function ZH(t){return YH(t)||XH(t)}function tG(t){return t&&(GR(t,"field")||"count"===t.aggregate)&&GR(t,"type")}function nG(t){return GR(t,"value")}function eG(t){return GR(t,"scale")||GR(t,"sort")}function rG(t){return GR(t,"axis")||GR(t,"stack")||GR(t,"impute")}function iG(t){return GR(t,"legend")}function oG(t){return GR(t,"format")||GR(t,"formatType")}function aG(t){return oR(t,["legend","axis","header","scale"])}function uG(t,n={}){let e=t.field;const r=n.prefix;let i=n.suffix,o="";if(function(t){return"count"===t.aggregate}(t))e=RR("count");else{let r;if(!n.nofn)if(function(t){return GR(t,"op")}(t))r=t.op;else{const{bin:a,aggregate:u,timeUnit:s}=t;aq(a)?(r=oq(a),i=(n.binSuffix??"")+(n.suffix??"")):u?ZI(u)?(o=`["${e}"]`,e=`argmax_${u.argmax}`):QI(u)?(o=`["${e}"]`,e=`argmin_${u.argmin}`):r=String(u):s&&!SU(s)&&(r=function(t){const{utc:n,...e}=BU(t);return e.unit?(n?"utc":"")+bR(e).map((t=>kR(`${"unit"===t?"":`_${t}_`}${e[t]}`))).join(""):`${n?"utc":""}timeunit${bR(e).map((t=>kR(`_${t}_${e[t]}`))).join("")}`}(s),i=(!["range","mid"].includes(n.binSuffix)&&n.binSuffix||"")+(n.suffix??""))}r&&(e=e?`${r}_${e}`:r)}return i&&(e=`${e}_${i}`),r&&(e=`${r}_${e}`),n.forAs?zR(e):n.expr?FR(e,n.expr)+o:OR(e)+o}function sG(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return YH(t)&&!!t.bin;case"temporal":return!1}throw new Error(Qq(t.type))}const cG=(t,n)=>{switch(n.fieldTitle){case"plain":return t.field;case"functional":return function(t){const{aggregate:n,bin:e,timeUnit:r,field:i}=t;if(ZI(n))return`${i} for argmax(${n.argmax})`;if(QI(n))return`${i} for argmin(${n.argmin})`;const o=r&&!SU(r)?BU(r):void 0,a=n||o?.unit||o?.maxbins&&"timeunit"||aq(e)&&"bin";return a?`${a.toUpperCase()}(${i})`:i}(t);default:return function(t,n){const{field:e,bin:r,timeUnit:i,aggregate:o}=t;if("count"===o)return n.countTitle;if(aq(r))return`${e} (binned)`;if(i&&!SU(i)){const t=BU(i)?.unit;if(t)return`${e} (${CU(t).join("-")})`}else if(o)return ZI(o)?`${e} for max ${o.argmax}`:QI(o)?`${e} for min ${o.argmin}`:`${DR(o)} of ${e}`;return e}(t,n)}};let lG=cG;function fG(t){lG=t}function dG(t,n,{allowDisabling:e,includeDefault:r=!0}){const i=hG(t)?.title;if(!YH(t))return i??t.title;const o=t,a=r?mG(o,n):void 0;return e?TR(i,o.title,a):i??o.title??a}function hG(t){return rG(t)&&t.axis?t.axis:iG(t)&&t.legend?t.legend:TH(t)&&t.header?t.header:void 0}function mG(t,n){return lG(t,n)}function pG(t){if(oG(t)){const{format:n,formatType:e}=t;return{format:n,formatType:e}}{const n=hG(t)??{},{format:e,formatType:r}=n;return{format:e,formatType:r}}}function gG(t){return YH(t)?t:HH(t)?t.condition:void 0}function vG(t){return ZH(t)?t:GH(t)?t.condition:void 0}function yG(t,n,e,r={}){return $t(t)||wt(t)||vt(t)?(vU(function(t,n,e){return`Channel ${t} is a ${n}. Converted to {value: ${HR(e)}}.`}(n,$t(t)?"string":wt(t)?"number":"boolean",t)),{value:t}):ZH(t)?bG(t,n,e,r):GH(t)?{...t,condition:bG(t.condition,n,e,r)}:t}function bG(t,n,e,r){if(oG(t)){const{format:i,formatType:o,...a}=t;if(bH(o)&&!e.customFormatTypes)return vU(Jq(n)),bG(a,n,e,r)}else{const i=rG(t)?"axis":iG(t)?"legend":TH(t)?"header":null;if(i&&t[i]){const{format:o,formatType:a,...u}=t[i];if(bH(a)&&!e.customFormatTypes)return vU(Jq(n)),bG({...t,[i]:u},n,e,r)}}return YH(t)?wG(t,n,r):function(t){let n=t.type;if(n)return t;const{datum:e}=t;return n=wt(e)?"quantitative":$t(e)?"nominal":yU(e)?"temporal":void 0,{...t,type:n}}(t)}function wG(t,n,{compositeMark:e=!1}={}){const{aggregate:r,timeUnit:i,bin:o,field:a}=t,u={...t};if(e||!r||tq(r)||ZI(r)||QI(r)||(vU(function(t){return`Invalid aggregation operator "${t}".`}(r)),delete u.aggregate),i&&(u.timeUnit=BU(i)),a&&(u.field=`${a}`),aq(o)&&(u.bin=xG(o,n)),uq(o)&&!AI(n)&&vU(function(t){return`Channel ${t} should not be used with "binned" bin.`}(n)),tG(u)){const{type:t}=u,n=function(t){if(t)switch(t=t.toLowerCase()){case"q":case ZU:return"quantitative";case"t":case nW:return"temporal";case"o":case tW:return"ordinal";case"n":case eW:return"nominal";case rW:return"geojson"}}(t);t!==n&&(u.type=n),"quantitative"!==t&&eq(r)&&(vU(function(t,n){return`Invalid field type "${t}" for aggregate: "${n}", using "quantitative" instead.`}(t,r)),u.type="quantitative")}else if(!QL(n)){const t=function(t,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(RH(t)&&S(t.sort))return"ordinal";const{aggregate:e,bin:r,timeUnit:i}=t;if(i)return"temporal";if(r||e&&!ZI(e)&&!QI(e))return"quantitative";if(eG(t)&&t.scale?.type)switch(cW[t.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(u,n);u.type=t}if(tG(u)){const{compatible:t,warning:e}=function(t,n){const e=t.type;if("geojson"===e&&"shape"!==n)return{compatible:!1,warning:`Channel ${n} should not be used with a geojson data.`};switch(n){case YR:case VR:case XR:return sG(t)?$G:{compatible:!1,warning:eU(n)};case JR:case KR:case tL:case nL:case fL:case dL:case hL:case $L:case ML:case AL:case DL:case SL:case FL:case gL:case iL:case eL:case EL:return $G;case uL:case cL:case aL:case sL:return e!==ZU?{compatible:!1,warning:`Channel ${n} should be used with a quantitative field only, not ${t.type} field.`}:$G;case vL:case yL:case bL:case wL:case pL:case oL:case rL:case QR:case ZR:case lL:return"nominal"!==e||t.sort?$G:{compatible:!1,warning:`Channel ${n} should not be used with an unsorted discrete field.`};case mL:case xL:return sG(t)||function(t){return eG(t)&&$W(t.scale?.type)}(t)?$G:{compatible:!1,warning:rU(n)};case kL:return"nominal"!==t.type||"sort"in t?$G:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(u,n)||{};!1===t&&vU(e)}if(RH(u)&&$t(u.sort)){const{sort:t}=u;if(OH(t))return{...u,sort:{encoding:t}};const n=t.substring(1);if("-"===t.charAt(0)&&OH(n))return{...u,sort:{encoding:n,order:"descending"}}}if(TH(u)){const{header:t}=u;if(t){const{orient:n,...e}=t;if(n)return{...u,header:{...e,labelOrient:t.labelOrient||n,titleOrient:t.titleOrient||n}}}}return u}function xG(t,n){return vt(t)?{maxbins:lq(n)}:"binned"===t?{binned:!0}:t.maxbins||t.step?t:{...t,maxbins:lq(n)}}const $G={compatible:!0};function kG(t){const{formatType:n}=pG(t);return"time"===n||!n&&function(t){return t&&("temporal"===t.type||YH(t)&&!!t.timeUnit)}(t)}function MG(t,{timeUnit:n,type:e,wrapTime:r,undefinedIfExprNotRequired:i}){const o=n&&BU(n)?.unit;let a,u=o||"temporal"===e;return fq(t)?a=t.expr:pq(t)?a=t.signal:yU(t)?(u=!0,a=MU(t)):($t(t)||wt(t))&&u&&(a=`datetime(${HR(t)})`,function(t){return ft(AU,t)}(o)&&(wt(t)&&t<1e4||$t(t)&&isNaN(Date.parse(t)))&&(a=MU({[o]:t}))),a?r&&u?`time(${a})`:a:i?void 0:HR(t)}function AG(t,n){const{type:e}=t;return n.map((n=>{const r=MG(n,{timeUnit:YH(t)&&!SU(t.timeUnit)?t.timeUnit:void 0,type:e,undefinedIfExprNotRequired:!0});return void 0!==r?{signal:r}:n}))}function DG(t,n){return aq(t.bin)?HI(n)&&["ordinal","nominal"].includes(t.type):(console.warn("Only call this method for binned field defs."),!1)}const SG={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 FG(t){return t?.condition}const EG=["domain","grid","labels","ticks","title"],NG={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"},CG={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},OG={...CG,style:1,labelExpr:1,encoding:1};function _G(t){return ft(OG,t)}const zG=bR({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 BG(t){return GR(t,"mark")}class TG{name;run;constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return!!BG(t)&&function(t){return QW(t)?t.type:t}(t.mark)===this.name}}function PG(t,n){const e=t?.[n];return!!e&&(S(e)?cR(e,(t=>!!t.field)):YH(e)||HH(e))}function jG(t,n){const e=t?.[n];return!!e&&(S(e)?cR(e,(t=>!!t.field)):YH(e)||XH(e)||GH(e))}function RG(t,n){if(AI(n)){const e=t[n];if((YH(e)||XH(e))&&(QU(e.type)||YH(e)&&e.timeUnit))return jG(t,iI(n))}return!1}function LG(t){return cR(IL,(n=>{if(PG(t,n)){const e=t[n];if(S(e))return cR(e,(t=>!!t.aggregate));{const t=gG(e);return t&&!!t.aggregate}}return!1}))}function IG(t,n){const e=[],r=[],i=[],o=[],a={};return WG(t,((u,s)=>{if(YH(u)){const{field:c,aggregate:l,bin:f,timeUnit:d,...h}=u;if(l||d||f){const t=hG(u),m=t?.title;let p=uG(u,{forAs:!0});const g={...m?[]:{title:dG(u,n,{allowDisabling:!0})},...h,field:p};if(l){let t;if(ZI(l)?(t="argmax",p=uG({op:"argmax",field:l.argmax},{forAs:!0}),g.field=`${p}.${c}`):QI(l)?(t="argmin",p=uG({op:"argmin",field:l.argmin},{forAs:!0}),g.field=`${p}.${c}`):"boxplot"!==l&&"errorbar"!==l&&"errorband"!==l&&(t=l),t){const n={op:t,as:p};c&&(n.field=c),o.push(n)}}else if(e.push(p),tG(u)&&aq(f))r.push({bin:f,field:c,as:p}),e.push(uG(u,{binSuffix:"end"})),DG(u,s)&&e.push(uG(u,{binSuffix:"range"})),AI(s)&&(a[`${s}2`]={field:`${p}_end`}),g.bin="binned",QL(s)||(g.type=ZU);else if(d&&!SU(d)){i.push({timeUnit:d,field:c,as:p});const t=tG(u)&&u.type!==nW&&"time";t&&(s===$L||s===DL?g.formatType=t:function(t){return ft(xI,t)}(s)?g.legend={formatType:t,...g.legend}:AI(s)&&(g.axis={formatType:t,...g.axis}))}a[s]=g}else e.push(c),a[s]=t[s]}else a[s]=t[s]})),{bins:r,timeUnits:i,aggregate:o,groupby:e,encoding:a}}function qG(t,n,e){const r=function(t,n){return function(t){switch(t){case fL:case dL:case hL:case EL:case ML:case AL:case DL:case SL:case kL:case vL:case yL:case bL:case wL:case XR:case YR:case VR:return GI;case JR:case KR:case tL:case nL:case aL:case uL:case lL:return VI;case QR:case ZR:case sL:case cL:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case pL:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case xL:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case mL:return{point:"always",geoshape:"always"};case $L:return{text:"always"};case gL:return{point:"always",square:"always",text:"always"};case FL:return{image:"always"};case iL:case eL:return{text:"always",arc:"always"};case oL:case rL:return{arc:"always"}}}(t)[n]}(n,e);if(!r)return!1;if("binned"===r){const e=t[n===QR?JR:KR];return!!(YH(e)&&YH(t[n])&&uq(e.bin))}return!0}function UG(t,n){const e={};for(const r of bR(t)){const i=yG(t[r],r,n,{compositeMark:!0});e[r]=i}return e}function WG(t,n,e){if(t)for(const r of bR(t)){const i=t[r];if(S(i))for(const t of i)n.call(e,t,r);else n.call(e,i,r)}}function HG(t,n){return bR(n).reduce(((e,r)=>{switch(r){case JR:case KR:case SL:case EL:case FL:case QR:case ZR:case tL:case nL:case iL:case oL:case eL:case rL:case lL:case aL:case uL:case sL:case cL:case $L:case mL:case gL:case DL:return e;case kL:if("line"===t||"trail"===t)return e;case ML:case AL:{const t=n[r];if(S(t)||YH(t))for(const n of Q(t))n.aggregate||e.push(uG(n,{}));return e}case pL:if("trail"===t)return e;case fL:case dL:case hL:case vL:case yL:case bL:case xL:case wL:{const t=gG(n[r]);return t&&!t.aggregate&&e.push(uG(t,{})),e}}}),[])}function GG(t,n,e,r=!0){if("tooltip"in e)return{tooltip:e.tooltip};const i=t.map((({fieldPrefix:t,titlePrefix:e})=>{const i=r?` of ${YG(n)}`:"";return{field:t+n.field,type:n.type,title:pq(e)?{signal:`${e}"${escape(i)}"`}:e+i}})),o=function(t){const n=[];for(const e of bR(t))if(PG(t,e)){const r=Q(t[e]);for(const t of r)YH(t)?n.push(t):HH(t)&&n.push(t.condition)}return n}(e).map(aG);return{tooltip:[...i,...hR(o,aR)]}}function YG(t){const{title:n,field:e}=t;return TR(n,e)}function VG(t,n,e,r,i){const{scale:o,axis:a}=e;return({partName:u,mark:s,positionPrefix:c,endPositionPrefix:l,extraEncoding:f={}})=>{const d=YG(e);return XG(t,u,i,{mark:s,encoding:{[n]:{field:`${c}_${e.field}`,type:e.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...$t(l)?{[`${n}2`]:{field:`${l}_${e.field}`}}:{},...r,...f}})}}function XG(t,n,e,r){const{clip:i,color:o,opacity:a}=t,u=t.type;return t[n]||void 0===t[n]&&e[n]?[{...r,mark:{...e[n],...i?{clip:i}:{},...o?{color:o}:{},...a?{opacity:a}:{},...QW(r.mark)?r.mark:{type:r.mark},style:`${u}-${String(n)}`,...vt(t[n])?{}:t[n]}}]:[]}function JG(t,n,e){const{encoding:r}=t,i="vertical"===n?"y":"x",o=r[`${i}2`],a=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:KG(r[i],e),continuousAxisChannelDef2:KG(o,e),continuousAxisChannelDefError:KG(a,e),continuousAxisChannelDefError2:KG(u,e),continuousAxis:i}}function KG(t,n){if(t?.aggregate){const{aggregate:e,...r}=t;return e!==n&&vU(function(t,n){return`Continuous axis should not have customized aggregation function ${t}; ${n} already agregates the axis.`}(e,n)),r}return t}function QG(t,n){const{mark:e,encoding:r}=t,{x:i,y:o}=r;if(QW(e)&&e.orient)return e.orient;if(JH(i)){if(JH(o)){const t=YH(i)&&i.aggregate,e=YH(o)&&o.aggregate;if(t||e!==n){if(e||t!==n){if(t===n&&e===n)throw new Error("Both x and y cannot have aggregate");return kG(o)&&!kG(i)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(JH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}const ZG="boxplot",tY=new TG(ZG,eY);function nY(t){return wt(t)?"tukey":t}function eY(t,{config:n}){t={...t,encoding:UG(t.encoding,n)};const{mark:e,encoding:r,params:i,projection:o,...a}=t,u=QW(e)?e:{type:e};i&&vU(Hq("boxplot"));const s=u.extent??n.boxplot.extent,c=Nq("size",u,n),l=u.invalid,f=nY(s),{bins:d,timeUnits:h,transform:m,continuousAxisChannelDef:p,continuousAxis:g,groupby:v,aggregate:y,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:$}=function(t,n,e){const r=QG(t,ZG),{continuousAxisChannelDef:i,continuousAxis:o}=JG(t,r,ZG),a=i.field,u=zR(a),s=nY(n),c=[...rY(a),{op:"median",field:a,as:`mid_box_${u}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+u},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+u}],l="min-max"===s||"tukey"===s?[]:[{calculate:`${ER(`upper_box_${u}`)} - ${ER(`lower_box_${u}`)}`,as:`iqr_${u}`},{calculate:`min(${ER(`upper_box_${u}`)} + ${ER(`iqr_${u}`)} * ${n}, ${ER(`max_${u}`)})`,as:`upper_whisker_${u}`},{calculate:`max(${ER(`lower_box_${u}`)} - ${ER(`iqr_${u}`)} * ${n}, ${ER(`min_${u}`)})`,as:`lower_whisker_${u}`}],{[o]:f,...d}=t.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:m}=function(t){const{tooltip:n,...e}=t;if(!n)return{filteredEncoding:e};let r,i;if(S(n)){for(const t of n)t.aggregate?(r||(r=[]),r.push(t)):(i||(i=[]),i.push(t));r&&(e.tooltip=r)}else n.aggregate?e.tooltip=n:i=n;return S(i)&&1===i.length&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:e}}(d),{bins:p,timeUnits:g,aggregate:v,groupby:y,encoding:b}=IG(m,e),w="vertical"===r?"horizontal":"vertical",x=r;return{bins:p,timeUnits:g,transform:[...p,...g,{aggregate:[...v,...c],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:h}}(t,s,n),k=zR(p.field),{color:M,size:A,...D}=b,E=t=>VG(u,g,p,t,n.boxplot),N=E(D),C=E(b),O=(F(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",_=E({...D,...A?{size:A}:{},color:{condition:{test:`${ER(`lower_box_${p.field}`)} >= ${ER(`upper_box_${p.field}`)}`,...M||{value:O}}}}),z=GG([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],p,b),B={type:"tick",color:"black",opacity:1,orient:w,invalid:l,aria:!1},T="min-max"===f?z:GG([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,b),P=[...N({partName:"rule",mark:{type:"rule",invalid:l,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:T}),...N({partName:"rule",mark:{type:"rule",invalid:l,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"lower_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"upper_whisker",extraEncoding:T})],j=[..."tukey"!==f?P:[],...C({partName:"box",mark:{type:"bar",...c?{size:c}:{},orient:x,invalid:l,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),..._({partName:"median",mark:{type:"tick",invalid:l,...F(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...c?{size:c}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(m),layer:j};const R=ER(`lower_box_${p.field}`),L=ER(`upper_box_${p.field}`),I=`(${L} - ${R})`,q=`${R} - ${s} * ${I}`,U=`${L} + ${s} * ${I}`,W=ER(p.field),H={joinaggregate:rY(p.field),groupby:v},G={transform:[{filter:`(${q} <= ${W}) && (${W} <= ${U})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${k}`},{op:"max",field:p.field,as:`upper_whisker_${k}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${k}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${k}`},...y],groupby:v}],layer:P},{tooltip:Y,...V}=D,{scale:X,axis:J}=p,K=YG(p),Q=XG(u,"outliers",n.boxplot,{transform:[{filter:`(${W} < ${q}) || (${W} > ${U})`}],mark:"point",encoding:{[g]:{field:p.field,type:p.type,...void 0!==K?{title:K}:{},...void 0!==X?{scale:X}:{},...void 0!==J?{axis:J}:{}},...V,...M?{color:M}:{},...$?{tooltip:$}:{}}})[0];let Z;const tt=[...d,...h,H];return Q?Z={transform:tt,layer:[Q,G]}:(Z=G,Z.transform.unshift(...tt)),{...a,layer:[Z,{transform:m,layer:j}]}}function rY(t){const n=zR(t);return[{op:"q1",field:t,as:`lower_box_${n}`},{op:"q3",field:t,as:`upper_box_${n}`}]}const iY="errorbar",oY=new TG(iY,aY);function aY(t,{config:n}){t={...t,encoding:UG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:u,outerSpec:s,tooltipEncoding:c}=uY(t,iY,n);delete o.size;const l=VG(u,i,r,o,n.errorbar),f=u.thickness,d=u.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},m=[...l({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:c}),...l({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:c}),...l({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})];return{...s,transform:e,...m.length>1?{layer:m}:{...m[0]}}}function uY(t,n,e){const{mark:r,encoding:i,params:o,projection:a,...u}=t,s=QW(r)?r:{type:r};o&&vU(Hq(n));const{orient:c,inputType:l}=function(t,n){const{encoding:e}=t;if(function(t){return(ZH(t.x)||ZH(t.y))&&!ZH(t.x2)&&!ZH(t.y2)&&!ZH(t.xError)&&!ZH(t.xError2)&&!ZH(t.yError)&&!ZH(t.yError2)}(e))return{orient:QG(t,n),inputType:"raw"};const r=function(t){return ZH(t.x2)||ZH(t.y2)}(e),i=function(t){return ZH(t.xError)||ZH(t.xError2)||ZH(t.yError)||ZH(t.yError2)}(e),o=e.x,a=e.y;if(r){if(i)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const t=e.x2,r=e.y2;if(ZH(t)&&ZH(r))throw new Error(`${n} cannot have both x2 and y2`);if(ZH(t)){if(JH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}if(ZH(r)){if(JH(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}{const t=e.xError,r=e.yError,i=e.yError2;if(ZH(e.xError2)&&!ZH(t))throw new Error(`${n} cannot have xError2 without xError`);if(ZH(i)&&!ZH(r))throw new Error(`${n} cannot have yError2 without yError`);if(ZH(t)&&ZH(r))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(ZH(t)){if(JH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(ZH(r)){if(JH(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")}}(t,n),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:m,continuousAxis:p}=JG(t,c,n),{errorBarSpecificAggregate:g,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:b}=function(t,n,e,r,i,o,a,u){let s=[],c=[];const l=n.field;let f,d=!1;if("raw"===o){const n=t.center?t.center:t.extent?"iqr"===t.extent?"median":"mean":u.errorbar.center,e=t.extent?t.extent:"mean"===n?"stderr":"iqr";if("median"===n!=("iqr"===e)&&vU(function(t,n,e){return`${t} is not usually used with ${n} for ${e}.`}(n,e,a)),"stderr"===e||"stdev"===e)s=[{op:e,field:l,as:`extent_${l}`},{op:n,field:l,as:`center_${l}`}],c=[{calculate:`${ER(`center_${l}`)} + ${ER(`extent_${l}`)}`,as:`upper_${l}`},{calculate:`${ER(`center_${l}`)} - ${ER(`extent_${l}`)}`,as:`lower_${l}`}],f=[{fieldPrefix:"center_",titlePrefix:DR(n)},{fieldPrefix:"upper_",titlePrefix:sY(n,e,"+")},{fieldPrefix:"lower_",titlePrefix:sY(n,e,"-")}],d=!0;else{let t,n,r;"ci"===e?(t="mean",n="ci0",r="ci1"):(t="median",n="q1",r="q3"),s=[{op:n,field:l,as:`lower_${l}`},{op:r,field:l,as:`upper_${l}`},{op:t,field:l,as:`center_${l}`}],f=[{fieldPrefix:"upper_",titlePrefix:dG({field:l,aggregate:r,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:dG({field:l,aggregate:n,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:dG({field:l,aggregate:t,type:"quantitative"},u,{allowDisabling:!1})}]}}else{(t.center||t.extent)&&vU(function(t,n){return`${n?"extent ":""}${n&&t?"and ":""}${t?"center ":""}${n&&t?"are ":"is "}not needed when data are aggregated.`}(t.center,t.extent)),"aggregated-upper-lower"===o?(f=[],c=[{calculate:ER(e.field),as:`upper_${l}`},{calculate:ER(l),as:`lower_${l}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:l}],c=[{calculate:`${ER(l)} + ${ER(r.field)}`,as:`upper_${l}`}],c.push(i?{calculate:`${ER(l)} + ${ER(i.field)}`,as:`lower_${l}`}:{calculate:`${ER(l)} - ${ER(r.field)}`,as:`lower_${l}`}));for(const t of c)f.push({fieldPrefix:t.as.substring(0,6),titlePrefix:_R(_R(t.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:s,tooltipSummary:f,tooltipTitleWithFieldName:d}}(s,f,d,h,m,l,n,e),{[p]:w,["x"===p?"x2":"y2"]:x,["x"===p?"xError":"yError"]:$,["x"===p?"xError2":"yError2"]:k,...M}=i,{bins:A,timeUnits:D,aggregate:S,groupby:F,encoding:E}=IG(M,e),N=[...S,...g],C="raw"!==l?[]:F,O=GG(y,f,E,b);return{transform:[...u.transform??[],...A,...D,...0===N.length?[]:[{aggregate:N,groupby:C}],...v],groupby:C,continuousAxisChannelDef:f,continuousAxis:p,encodingWithoutContinuousAxis:E,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:s,outerSpec:u,tooltipEncoding:O}}function sY(t,n,e){return`${DR(t)} ${e} ${n}`}const cY="errorband",lY=new TG(cY,fY);function fY(t,{config:n}){t={...t,encoding:UG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:u,tooltipEncoding:s}=uY(t,cY,n),c=a,l=VG(c,i,r,o,n.errorband),f=void 0!==t.encoding.x&&void 0!==t.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const m={...c.interpolate?{interpolate:c.interpolate}:{},...c.tension&&c.interpolate?{tension:c.tension}:{}};return f?(d={...d,...m,ariaRoleDescription:"errorband"},h={...h,...m,aria:!1}):c.interpolate?vU(dU("interpolate")):c.tension&&vU(dU("tension")),{...u,transform:e,layer:[...l({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:s}),...l({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:s}),...l({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:s})]}}const dY={};function hY(t,n,e){const r=new TG(t,n);dY[t]={normalizer:r,parts:e}}hY(ZG,eY,["box","median","outliers","rule","ticks"]),hY(iY,aY,["ticks","rule"]),hY(cY,fY,["band","borders"]);const mY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],pY={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"},gY={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"},vY=bR(pY),yY=bR(gY),bY=bR({header:1,headerRow:1,headerColumn:1,headerFacet:1}),wY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],xY="_vgsid_",$Y={point:{on:"click",fields:[xY],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 kY(t){return"legend"===t||!!t?.legend}function MY(t){return kY(t)&&F(t)}function AY(t){return!!t?.select}function DY(t){const n=[];for(const e of t||[]){if(AY(e))continue;const{expr:t,bind:r,...i}=e;if(r&&t){const e={...i,bind:r,init:t};n.push(e)}else{const e={...i,...t?{update:t}:{},...r?{bind:r}:{}};n.push(e)}}return n}function SY(t){return GR(t,"concat")}function FY(t){return GR(t,"vconcat")}function EY(t){return GR(t,"hconcat")}function NY({step:t,offsetIsDiscrete:n}){return n?t.for??"offset":"position"}function CY(t){return GR(t,"step")}function OY(t){return GR(t,"view")||GR(t,"width")||GR(t,"height")}const _Y=bR({align:1,bounds:1,center:1,columns:1,spacing:1});function zY(t,n){return t[n]??t["width"===n?"continuousWidth":"continuousHeight"]}function BY(t,n){const e=TY(t,n);return CY(e)?e.step:PY}function TY(t,n){return TR(t[n]??t["width"===n?"discreteWidth":"discreteHeight"],{step:t.step})}const PY=20,jY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:300,continuousHeight:300,step:PY},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:uH,circle:{},geoshape:{},image:{},line:{},point:{},rect:aH,rule:{color:"black"},square:{},text:{color:"black"},tick:sH,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:$Y,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},RY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],LY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},IY={blue:RY[0],orange:RY[1],red:RY[2],teal:RY[3],green:RY[4],yellow:RY[5],purple:RY[6],pink:RY[7],brown:RY[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 qY(t){const n=bR(t||{}),e={};for(const r of n){const n=t[r];e[r]=FG(n)?xq(n):$q(n)}return e}const UY=[...rH,...zG,...bY,"background","padding","legend","lineBreak","scale","style","title","view"];function WY(t={}){const{color:n,font:e,fontSize:r,selection:i,...o}=t,a=N({},eR(jY),e?function(t){return{text:{font:t},style:{"guide-label":{font:t},"guide-title":{font:t},"group-title":{font:t},"group-subtitle":{font:t}}}}(e):{},n?function(t={}){return{signals:[{name:"color",value:F(t)?{...IY,...t}:IY}],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(t){return{signals:[{name:"fontSize",value:F(t)?{...LY,...t}:LY}],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):{},o||{});i&&C(a,"selection",i,!0);const u=oR(a,UY);for(const t of["background","lineBreak","padding"])a[t]&&(u[t]=$q(a[t]));for(const t of rH)a[t]&&(u[t]=dq(a[t]));for(const t of zG)a[t]&&(u[t]=qY(a[t]));for(const t of bY)a[t]&&(u[t]=dq(a[t]));if(a.legend&&(u.legend=dq(a.legend)),a.scale){const{invalid:t,...n}=a.scale,e=dq(t,{level:1});u.scale={...dq(n),...bR(e).length>0?{invalid:e}:{}}}return a.style&&(u.style=function(t){const n=bR(t),e={};for(const r of n)e[r]=qY(t[r]);return e}(a.style)),a.title&&(u.title=dq(a.title)),a.view&&(u.view=dq(a.view)),u}const HY=new Set(["view",...KW]),GY=["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"],YY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...eH};function VY(t,n,e){"view"===n&&(e="cell");const r={...t[n],...t.style[e??n]};yR(r)||(t.style[e??n]=r),delete t[n]}function XY(t){return GR(t,"layer")}class JY{map(t,n){return PH(t)?this.mapFacet(t,n):function(t){return GR(t,"repeat")}(t)?this.mapRepeat(t,n):EY(t)?this.mapHConcat(t,n):FY(t)?this.mapVConcat(t,n):SY(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(XY(t))return this.mapLayer(t,n);if(BG(t))return this.mapUnit(t,n);throw new Error(jq(t))}mapLayer(t,n){return{...t,layer:t.layer.map((t=>this.mapLayerOrUnit(t,n)))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map((t=>this.map(t,n)))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map((t=>this.map(t,n)))}}mapConcat(t,n){const{concat:e,...r}=t;return{...r,concat:e.map((t=>this.map(t,n)))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const KY={zero:1,center:1,normalize:1},QY=new Set([BW,PW,TW,qW,LW,GW,YW,RW,UW,WW]),ZY=new Set([PW,TW,BW]);function tV(t){return YH(t)&&"quantitative"===VH(t)&&!t.bin}function nV(t,n,{orient:e,type:r}){const i="x"===n?"y":"radius",o="x"===n&&["bar","area"].includes(r),a=t[n],u=t[i];if(YH(a)&&YH(u))if(tV(a)&&tV(u)){if(a.stack)return n;if(u.stack)return i;const t=YH(a)&&!!a.aggregate;if(t!==(YH(u)&&!!u.aggregate))return t?n:i;if(o){if("vertical"===e)return i;if("horizontal"===e)return n}}else{if(tV(a))return n;if(tV(u))return i}else{if(tV(a)){if(o&&"vertical"===e)return;return n}if(tV(u)){if(o&&"horizontal"===e)return;return i}}}function eV(t,n){const e=QW(t)?t:{type:t},r=e.type;if(!QY.has(r))return null;const i=nV(n,"x",e)||nV(n,"theta",e);if(!i)return null;const o=n[i],a=YH(o)?uG(o,{}):void 0,u=function(t){switch(t){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(i),s=[],c=new Set;if(n[u]){const t=n[u],e=YH(t)?uG(t,{}):void 0;e&&e!==a&&(s.push(u),c.add(e))}const l="x"===u?"xOffset":"yOffset",f=n[l],d=YH(f)?uG(f,{}):void 0;d&&d!==a&&(s.push(l),c.add(d));const h=$I.reduce(((t,e)=>{if("tooltip"!==e&&PG(n,e)){const r=n[e];for(const n of Q(r)){const r=gG(n);if(r.aggregate)continue;const i=uG(r,{});i&&c.has(i)||t.push({channel:e,fieldDef:r})}}return t}),[]);let m;return void 0!==o.stack?m=vt(o.stack)?o.stack?"zero":null:o.stack:ZY.has(r)&&(m="zero"),m&&ft(KY,m)?LG(n)&&0===h.length?null:(o?.scale?.type&&o?.scale?.type!==iW&&o?.stack&&vU(function(t){return`Stack is applied to a non-linear scale (${t}).`}(o.scale.type)),ZH(n[nI(i)])?(void 0!==o.stack&&vU(`Cannot stack "${p=i}" if there is already "${p}2".`),null):(YH(o)&&o.aggregate&&!rq.has(o.aggregate)&&vU(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:s,groupbyFields:c,fieldChannel:i,impute:null!==o.impute&&XW(r),stackBy:h,offset:m})):null;var p}function rV(t,n,e){const r=dq(t),i=Nq("orient",r,e);if(r.orient=function(t,n,e){switch(t){case LW:case GW:case YW:case IW:case jW:return}const{x:r,y:i,x2:o,y2:a}=n;switch(t){case UW:case PW:if(YH(r)&&(uq(r.bin)||YH(i)&&i.aggregate&&!r.aggregate))return"vertical";if(YH(i)&&(uq(i.bin)||YH(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(a||o){if(e)return e;if(!o)return(YH(r)&&r.type===ZU&&!aq(r.bin)||QH(r))&&YH(i)&&uq(i.bin)?"horizontal":"vertical";if(!a)return(YH(i)&&i.type===ZU&&!aq(i.bin)||QH(i))&&YH(r)&&uq(r.bin)?"vertical":"horizontal"}case qW:if(o&&(!YH(r)||!uq(r.bin))&&a&&(!YH(i)||!uq(i.bin)))return;case TW:if(a)return YH(i)&&uq(i.bin)?"horizontal":"vertical";if(o)return YH(r)&&uq(r.bin)?"vertical":"horizontal";if(t===qW){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case RW:case WW:{const n=KH(r),o=KH(i);if(e)return e;if(n&&!o)return"tick"!==t?"horizontal":"vertical";if(!n&&o)return"tick"!==t?"vertical":"horizontal";if(n&&o)return"vertical";{const t=tG(r)&&r.type===nW,n=tG(i)&&i.type===nW;if(t&&!n)return"vertical";if(!t&&n)return"horizontal"}return}}return"vertical"}(r.type,n,i),void 0!==i&&i!==r.orient&&vU(`Specified orient "${r.orient}" overridden with "${i}".`),"bar"===r.type&&r.orient){const t=Nq("cornerRadiusEnd",r,e);if(void 0!==t){const e="horizontal"===r.orient&&n.x2||"vertical"===r.orient&&n.y2?["cornerRadius"]:oH[r.orient];for(const n of e)r[n]=t;void 0!==r.cornerRadiusEnd&&delete r.cornerRadiusEnd}}const o=Nq("opacity",r,e),a=Nq("fillOpacity",r,e);return void 0===o&&void 0===a&&(r.opacity=function(t,n){if(sR([LW,WW,GW,YW],t)&&!LG(n))return iV}(r.type,n)),void 0===Nq("cursor",r,e)&&(r.cursor=function(t,n,e){return n.href||t.href||Nq("href",t,e)?"pointer":t.cursor}(r,n,e)),r}const iV=.7;function oV(t){const{point:n,line:e,...r}=t;return bR(r).length>1?r:r.type}function aV(t){for(const n of["line","area","rule","trail"])t[n]&&(t={...t,[n]:oR(t[n],["point","line"])});return t}function uV(t,n={},e){return"transparent"===t.point?{opacity:0}:t.point?F(t.point)?t.point:{}:void 0!==t.point?null:n.point||e.shape?F(n.point)?n.point:{}:void 0}function sV(t,n={}){return t.line?!0===t.line?{}:t.line:void 0!==t.line?null:n.line?!0===n.line?{}:n.line:void 0}class cV{name="path-overlay";hasMatchingType(t,n){if(BG(t)){const{mark:e,encoding:r}=t,i=QW(e)?e:{type:e};switch(i.type){case"line":case"rule":case"trail":return!!uV(i,n[i.type],r);case"area":return!!uV(i,n[i.type],r)||!!sV(i,n[i.type])}}return!1}run(t,n,e){const{config:r}=n,{params:i,projection:o,mark:a,name:u,encoding:s,...c}=t,l=UG(s,r),f=QW(a)?a:{type:a},d=uV(f,r[f.type],l),h="area"===f.type&&sV(f,r[f.type]),m=[{name:u,...i?{params:i}:{},mark:oV({..."area"===f.type&&null==Nq("opacity",f,r)&&null==Nq("fillOpacity",f,r)?{opacity:iV}:{},...f}),encoding:oR(l,["shape"])}],p=eV(rV(f,l,r),l);let g=l;if(p){const{fieldChannel:t,offset:n}=p;g={...l,[t]:{...l[t],...n?{stack:n}:{}}}}return g=oR(g,["y2","x2"]),h&&m.push({...o?{projection:o}:{},mark:{type:"line",...iR(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&m.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...iR(f,["clip","tooltip"]),...d},encoding:g}),e({...c,layer:m},{...n,config:aV(r)})}}function lV(t,n){return n?BH(t)?gV(t,n):hV(t,n):t}function fV(t,n){return n?gV(t,n):t}function dV(t,n,e){const r=n[t];return function(t){return!$t(t)&&GR(t,"repeat")}(r)?r.repeat in e?{...n,[t]:e[r.repeat]}:void vU(function(t){return`Unknown repeated value "${t}".`}(r.repeat)):n}function hV(t,n){if(void 0!==(t=dV("field",t,n))){if(null===t)return null;if(RH(t)&&_H(t.sort)){const e=dV("field",t.sort,n);t={...t,...e?{sort:e}:{}}}return t}}function mV(t,n){if(YH(t))return hV(t,n);{const e=dV("datum",t,n);return e===t||e.type||(e.type="nominal"),e}}function pV(t,n){if(!ZH(t)){if(GH(t)){const e=mV(t.condition,n);if(e)return{...t,condition:e};{const{condition:n,...e}=t;return e}}return t}{const e=mV(t,n);if(e)return e;if(WH(t))return{condition:t.condition}}}function gV(t,n){const e={};for(const r in t)if(GR(t,r)){const i=t[r];if(S(i))e[r]=i.map((t=>pV(t,n))).filter((t=>t));else{const t=pV(i,n);void 0!==t&&(e[r]=t)}}return e}class vV{name="RuleForRangedLine";hasMatchingType(t){if(BG(t)){const{encoding:n,mark:e}=t;if("line"===e||QW(e)&&"line"===e.type)for(const t of KL){const e=n[ZL(t)];if(n[t]&&(YH(e)&&!uq(e.bin)||XH(e)))return!0}}return!1}run(t,n,e){const{encoding:r,mark:i}=t;var o;return vU(`Line mark is for continuous lines and thus cannot be used with ${(o=!!r.x2)&&!!r.y2?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`),e({...t,mark:F(i)?{...i,type:"rule"}:"rule"},n)}}function yV({parentEncoding:t,encoding:n={},layer:e}){let r={};if(t){const i=new Set([...bR(t),...bR(n)]);for(const o of i){const i=n[o],a=t[o];if(ZH(i)){const t={...a,...i};r[o]=t}else GH(i)?r[o]={...i,condition:{...a,...i.condition}}:i||null===i?r[o]=i:(e||nG(a)||pq(a)||ZH(a)||S(a))&&(r[o]=a)}}else r=n;return!r||yR(r)?void 0:r}function bV(t){const{parentProjection:n,projection:e}=t;return n&&e&&vU(function(t){const{parentProjection:n,projection:e}=t;return`Layer's shared projection ${HR(n)} is overridden by a child projection ${HR(e)}.`}({parentProjection:n,projection:e})),e??n}function wV(t){return GR(t,"filter")}function xV(t){return GR(t,"lookup")}function $V(t){return GR(t,"pivot")}function kV(t){return GR(t,"density")}function MV(t){return GR(t,"quantile")}function AV(t){return GR(t,"regression")}function DV(t){return GR(t,"loess")}function SV(t){return GR(t,"sample")}function FV(t){return GR(t,"window")}function EV(t){return GR(t,"joinaggregate")}function NV(t){return GR(t,"flatten")}function CV(t){return GR(t,"calculate")}function OV(t){return GR(t,"bin")}function _V(t){return GR(t,"impute")}function zV(t){return GR(t,"timeUnit")}function BV(t){return GR(t,"aggregate")}function TV(t){return GR(t,"stack")}function PV(t){return GR(t,"fold")}function jV(t){return GR(t,"extent")&&!GR(t,"density")&&!GR(t,"regression")}function RV(t,n){const{transform:e,...r}=t;if(e){const t=e.map((t=>{if(wV(t))return{filter:qV(t,n)};if(OV(t)&&sq(t.bin))return{...t,bin:IV(t.bin)};if(xV(t)){const{selection:n,...e}=t.from;return n?{...t,from:{param:n,...e}}:t}return t}));return{...r,transform:t}}return t}function LV(t,n){const e=eR(t);if(YH(e)&&sq(e.bin)&&(e.bin=IV(e.bin)),eG(e)&&e.scale?.domain?.selection){const{selection:t,...n}=e.scale.domain;e.scale.domain={...n,...t?{param:t}:{}}}if(WH(e))if(S(e.condition))e.condition=e.condition.map((t=>{const{selection:e,param:r,test:i,...o}=t;return r?t:{...o,test:qV(t,n)}}));else{const{selection:t,param:r,test:i,...o}=LV(e.condition,n);e.condition=r?e.condition:{...o,test:qV(e.condition,n)}}return e}function IV(t){const n=t.extent;if(n?.selection){const{selection:e,...r}=n;return{...t,extent:{...r,param:e}}}return t}function qV(t,n){const e=t=>nR(t,(t=>{const e={param:t,empty:n.emptySelections[t]??!0};return n.selectionPredicates[t]??=[],n.selectionPredicates[t].push(e),e}));return t.selection?e(t.selection):nR(t.test||t.filter,(t=>t.selection?e(t.selection):t))}class UV extends JY{map(t,n){const e=n.selections??[];if(t.params&&!BG(t)){const n=[];for(const r of t.params)AY(r)?e.push(r):n.push(r);t.params=n}return n.selections=e,super.map(t,n)}mapUnit(t,n){const e=n.selections;if(!e||!e.length)return t;const r=(n.path??[]).concat(t.name),i=[];for(const n of e)if(n.views&&n.views.length)for(const e of n.views)($t(e)&&(e===t.name||r.includes(e))||S(e)&&e.map((t=>r.indexOf(t))).every(((t,n,e)=>-1!==t&&(0===n||t>e[n-1]))))&&i.push(n);else i.push(n);return i.length&&(t.params=i),t}}for(const t of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=UV.prototype[t];UV.prototype[t]=function(t,e){return n.call(this,t,WV(t,e))}}function WV(t,n){return t.name?{...n,path:(n.path??[]).concat(t.name)}:n}function HV(t,n){void 0===n&&(n=WY(t.config));const e=function(t,n={}){const e={config:n};return VV.map(GV.map(YV.map(t,e),e),e)}(t,n),{width:r,height:i}=t,o=function(t,n,e){let{width:r,height:i}=n;const o=BG(t)||XY(t),a={};o?"container"==r&&"container"==i?(a.type="fit",a.contains="padding"):"container"==r?(a.type="fit-x",a.contains="padding"):"container"==i&&(a.type="fit-y",a.contains="padding"):("container"==r&&(vU(Rq("width")),r=void 0),"container"==i&&(vU(Rq("height")),i=void 0));const u={type:"pad",...a,...e?XV(e.autosize):{},...XV(t.autosize)};if("fit"!==u.type||o||(vU('Autosize "fit" only works for single views and layered views.'),u.type="pad"),"container"==r&&"fit"!=u.type&&"fit-x"!=u.type&&vU(Lq("width")),"container"==i&&"fit"!=u.type&&"fit-y"!=u.type&&vU(Lq("height")),!WR(u,{type:"pad"}))return u}(e,{width:r,height:i},n);return{...e,...o?{autosize:o}:{}}}const GV=new class extends JY{nonFacetUnitNormalizers=[tY,oY,lY,new cV,new vV];map(t,n){if(BG(t)){const e=PG(t.encoding,YR),r=PG(t.encoding,VR),i=PG(t.encoding,XR);if(e||r||i)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:e,parentProjection:r}=n,i=fV(t.encoding,n.repeater),o={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{},...i?{encoding:i}:{}};if(e||r)return this.mapUnitWithParentEncodingOrProjection(o,n);const a=this.mapLayerOrUnit.bind(this);for(const t of this.nonFacetUnitNormalizers)if(t.hasMatchingType(o,n.config))return t.run(o,n,a);return o}mapRepeat(t,n){return function(t){return!S(t.repeat)&&GR(t.repeat,"layer")}(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:e,spec:r,...i}=t,{row:o,column:a,layer:u}=e,{repeater:s={},repeaterPrefix:c=""}=n;return o||a?this.mapRepeat({...t,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:u},spec:r}},n):{...i,layer:u.map((t=>{const e={...s,layer:t},i=`${(r.name?`${r.name}_`:"")+c}child__layer_${kR(t)}`,o=this.mapLayerOrUnit(r,{...n,repeater:e,repeaterPrefix:i});return o.name=i,o}))}}mapNonLayerRepeat(t,n){const{repeat:e,spec:r,data:i,...o}=t;!S(e)&&t.columns&&(t=oR(t,["columns"]),vU(Gq("repeat")));const a=[],{repeater:u={},repeaterPrefix:s=""}=n,c=!S(e)&&e.row||[u?u.row:null],l=!S(e)&&e.column||[u?u.column:null],f=S(e)&&e||[u?u.repeat:null];for(const t of f)for(const i of c)for(const o of l){const c={repeat:t,row:i,column:o,layer:u.layer},l=`${(r.name?`${r.name}_`:"")+s}child__${S(e)?`${kR(t)}`:(e.row?`row_${kR(i)}`:"")+(e.column?`column_${kR(o)}`:"")}`,f=this.map(r,{...n,repeater:c,repeaterPrefix:l});f.name=l,a.push(oR(f,["data"]))}const d=S(e)?t.columns:e.column?e.column.length:1;return{data:r.data??i,align:"all",...o,columns:d,concat:a}}mapFacet(t,n){const{facet:e}=t;return BH(e)&&t.columns&&(t=oR(t,["columns"]),vU(Gq("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:e,projection:r}=t,{parentEncoding:i,parentProjection:o,config:a}=n,u=bV({parentProjection:o,projection:r}),s=yV({parentEncoding:i,encoding:fV(e,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...s?{encoding:s}:{}},{config:a})}mapFacetedUnit(t,n){const{row:e,column:r,facet:i,...o}=t.encoding,{mark:a,width:u,projection:s,height:c,view:l,params:f,encoding:d,...h}=t,{facetMapping:m,layout:p}=this.getFacetMappingAndLayout({row:e,column:r,facet:i},n),g=fV(o,n.repeater);return this.mapFacet({...h,...p,facet:m,spec:{...u?{width:u}:{},...c?{height:c}:{},...l?{view:l}:{},...s?{projection:s}:{},mark:a,encoding:g,...f?{params:f}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:e,column:r,facet:i}=t;if(e||r){i&&vU(`Facet encoding dropped as ${(o=[...e?[YR]:[],...r?[VR]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const n={},a={};for(const e of[YR,VR]){const r=t[e];if(r){const{align:t,center:i,spacing:o,columns:u,...s}=r;n[e]=s;for(const t of["align","center","spacing"])void 0!==r[t]&&(a[t]??={},a[t][e]=r[t])}}return{facetMapping:n,layout:a}}{const{align:t,center:e,spacing:r,columns:o,...a}=i;return{facetMapping:lV(a,n.repeater),layout:{...t?{align:t}:{},...e?{center:e}:{},...r?{spacing:r}:{},...o?{columns:o}:{}}}}var o}mapLayer(t,{parentEncoding:n,parentProjection:e,...r}){const{encoding:i,projection:o,...a}=t,u={...r,parentEncoding:yV({parentEncoding:n,encoding:i,layer:!0}),parentProjection:bV({parentProjection:e,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{}},u)}},YV=new class extends JY{map(t,n){return n.emptySelections??={},n.selectionPredicates??={},t=RV(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if((t=RV(t,n)).encoding){const e={};for(const[r,i]of xR(t.encoding))e[r]=LV(i,n);t={...t,encoding:e}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:e,...r}=t;return e?{...r,params:xR(e).map((([t,e])=>{const{init:r,bind:i,empty:o,...a}=e;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),n.emptySelections[t]="none"!==o;for(const e of wR(n.selectionPredicates[t]??{}))e.empty="none"!==o;return{name:t,value:r,select:a,bind:i}}))}:t}},VV=new UV;function XV(t){return $t(t)?{type:t}:t??{}}const JV=["background","padding"];function KV(t,n){const e={};for(const n of JV)t&&void 0!==t[n]&&(e[n]=$q(t[n]));return n&&(e.params=t.params),e}class QV{explicit;implicit;constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new QV(eR(this.explicit),eR(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return TR(this.explicit[t],this.implicit[t])}getWithExplicit(t){return void 0!==this.explicit[t]?{explicit:!0,value:this.explicit[t]}:void 0!==this.implicit[t]?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:e}){void 0!==n&&this.set(t,n,e)}set(t,n,e){return delete this[e?"implicit":"explicit"][t],this[e?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:e}){void 0!==n[t]?this.set(t,n[t],!0):void 0!==e[t]&&this.set(t,e[t],!1)}copyKeyFromObject(t,n){void 0!==n[t]&&this.set(t,n[t],!0)}copyAll(t){for(const n of bR(t.combine())){const e=t.getWithExplicit(n);this.setWithExplicit(n,e)}}}function ZV(t){return{explicit:!0,value:t}}function tX(t){return{explicit:!1,value:t}}function nX(t){return(n,e,r,i)=>{const o=t(n.value,e.value);return o>0?n:o<0?e:eX(n,e,r,i)}}function eX(t,n,e,r){return t.explicit&&n.explicit&&vU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${HR(e)} and ${HR(r)}). Using ${HR(e)}.`}(e,r,t.value,n.value)),t}function rX(t,n,e,r,i=eX){return void 0===t||void 0===t.value?n:t.explicit&&!n.explicit?t:n.explicit&&!t.explicit?n:WR(t.value,n.value)?t:i(t,n,e,r)}class iX extends QV{explicit;implicit;parseNothing;constructor(t={},n={},e=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=e}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function oX(t){return GR(t,"url")}function aX(t){return GR(t,"values")}function uX(t){return GR(t,"name")&&!oX(t)&&!aX(t)&&!sX(t)}function sX(t){return t&&(cX(t)||lX(t)||fX(t))}function cX(t){return GR(t,"sequence")}function lX(t){return GR(t,"sphere")}function fX(t){return GR(t,"graticule")}var dX;function hX({invalid:t,isPath:n}){switch(cH(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}!function(t){t[t.Raw=0]="Raw",t[t.Main=1]="Main",t[t.Row=2]="Row",t[t.Column=3]="Column",t[t.Lookup=4]="Lookup",t[t.PreFilterInvalid=5]="PreFilterInvalid",t[t.PostFilterInvalid=6]="PostFilterInvalid"}(dX||(dX={}));class mX{debugName;_children=[];_parent=null;_hash;constructor(t,n){this.debugName=n,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){this._children.includes(t)?vU("Attempt to add the same child twice."):void 0!==n?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const n of this._children)n.parent=t;this._children=[],t.removeChild(this);const e=t.parent.removeChild(t);this._parent=n,n.addChild(this,e),t.parent=this}}class pX extends mX{type;refCounts;_source;_name;clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,e,r){super(t,n),this.type=e,this.refCounts=r,this._source=this._name=n,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 ${jR()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function gX(t){return void 0!==t.as}function vX(t){return`${t}_end`}class yX extends mX{timeUnits;clone(){return new yX(null,eR(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{const{field:i,timeUnit:o}=e;if(o){let a;if(SU(o)){if(DZ(n)){const{mark:t,markDef:r,config:u}=n,s=LH({fieldDef:e,markDef:r,config:u});(JW(t)||s)&&(a={timeUnit:BU(o),field:i})}}else a={as:uG(e,{forAs:!0}),field:i,timeUnit:o};if(DZ(n)){const{mark:t,markDef:i,config:o}=n,u=LH({fieldDef:e,markDef:i,config:o});JW(t)&&AI(r)&&.5!==u&&(a.rectBandPosition=u)}a&&(t[aR(a)]=a)}return t}),{});return yR(e)?null:new yX(t,e)}static makeFromTransform(t,n){const{timeUnit:e,...r}={...n},i={...r,timeUnit:BU(e)};return new yX(t,{[aR(i)]:i})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[e,r]of xR(this.timeUnits)){const i=gX(r)?r.as:`${r.field}_end`;t.has(i)||(n[e]=r)}this.timeUnits=n}producedFields(){return new Set(wR(this.timeUnits).map((t=>gX(t)?t.as:vX(t.field))))}dependentFields(){return new Set(wR(this.timeUnits).map((t=>t.field)))}hash(){return`TimeUnit ${aR(this.timeUnits)}`}assemble(){const t=[];for(const n of wR(this.timeUnits)){const{rectBandPosition:e}=n,r=BU(n.timeUnit);if(gX(n)){const{field:i,as:o}=n,{unit:a,utc:u,...s}=r,c=[o,`${o}_end`];t.push({field:OR(i),type:"timeunit",...a?{units:CU(a)}:{},...u?{timezone:"utc"}:{},...s,as:c}),t.push(...$X(c,e,r))}else if(n){const{field:i}=n,o=NR(i),a=xX({timeUnit:r,field:o}),u=vX(o);t.push({type:"formula",expr:a,as:u}),t.push(...$X([o,u],e,r))}}return t}}const bX="offsetted_rect_start",wX="offsetted_rect_end";function xX({timeUnit:t,field:n,reverse:e}){const{unit:r,utc:i}=t,o=OU(r),{part:a,step:u}=jU(o,t.step);return`${i?"utcOffset":"timeOffset"}('${a}', ${ER(n)}, ${e?-u:u})`}function $X([t,n],e,r){if(void 0!==e&&.5!==e){const i=ER(t),o=ER(n);return[{type:"formula",expr:kX([xX({timeUnit:r,field:t,reverse:!0}),i],e+.5),as:`${t}_${bX}`},{type:"formula",expr:kX([i,o],e+.5),as:`${t}_${wX}`}]}return[]}function kX([t,n],e){return`${1-e} * ${t} + ${e} * ${n}`}const MX="_tuple_fields";class AX{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const DX={defined:()=>!0,parse:(t,n,e)=>{const r=n.name,i=n.project??=new AX,o={},a={},u=new Set,s=(t,n)=>{const e="visual"===n?t.channel:t.field;let i=kR(`${r}_${e}`);for(let t=1;u.has(i);t++)i=kR(`${r}_${e}_${t}`);return u.add(i),{[n]:i}},c=n.type,l=t.config.selection[c],f=void 0!==e.value?Q(e.value):null;let{fields:d,encodings:h}=F(e.select)?e.select:{};if(!d&&!h&&f)for(const t of f)if(F(t))for(const n of bR(t))ft(XL,n)?(h||(h=[])).push(n):"interval"===c?(vU('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=l.encodings):(d??=[]).push(n);d||h||(h=l.encodings,"fields"in l&&(d=l.fields));for(const n of h??[]){const e=t.fieldDef(n);if(e){let r=e.field;if(e.aggregate){vU(Wq(n,e.aggregate));continue}if(!r){vU(Uq(n));continue}if(e.timeUnit&&!SU(e.timeUnit)){r=t.vgField(n);const i={timeUnit:e.timeUnit,as:r,field:e.field};a[aR(i)]=i}if(!o[r]){const a={field:r,channel:n,type:"interval"===c&&HI(n)&&wW(t.getScaleComponent(n).get("type"))?"R":e.bin?"R-RE":"E",index:i.items.length};a.signals={...s(a,"data"),...s(a,"visual")},i.items.push(o[r]=a),i.hasField[r]=o[r],i.hasSelectionId=i.hasSelectionId||r===xY,zL(n)?(a.geoChannel=n,a.channel=_L(n),i.hasChannel[a.channel]=o[r]):i.hasChannel[n]=o[r]}}else vU(Uq(n))}for(const t of d??[]){if(i.hasField[t])continue;const n={type:"E",field:t,index:i.items.length};n.signals={...s(n,"data")},i.items.push(n),i.hasField[t]=n,i.hasSelectionId=i.hasSelectionId||t===xY}f&&(n.init=f.map((t=>i.items.map((n=>F(t)?void 0!==t[n.geoChannel||n.channel]?t[n.geoChannel||n.channel]:t[n.field]:t))))),yR(a)||(i.timeUnit=new yX(null,a))},signals:(t,n,e)=>{const r=n.name+MX;return e.filter((t=>t.name===r)).length>0||n.project.hasSelectionId?e:e.concat({name:r,value:n.project.items.map(PX)})}},SX="_curr",FX="anim_value",EX="anim_clock",NX="eased_anim_clock",CX="min_extent",OX="max_range_extent",_X="last_tick_at",zX="is_playing",BX=1/60*1e3,TX={defined:t=>"point"===t.type,topLevelSignals:(t,n,e)=>(ZJ(n)&&(e=e.concat([{name:EX,init:"0",on:[{events:{type:"timer",throttle:BX},update:`${zX} ? (${EX} + (now() - ${_X}) > ${OX} ? 0 : ${EX} + (now() - ${_X})) : ${EX}`}]},{name:_X,init:"now()",on:[{events:[{signal:EX},{signal:zX}],update:"now()"}]},{name:zX,init:"true"}])),e),signals:(t,n,e)=>{const r=n.name,i=r+MX,o=n.project,a="(item().isVoronoi ? datum.datum : datum)",u=wR(t.component.selection??{}).reduce(((t,n)=>"interval"===n.type?t.concat(n.name+GX):t),[]).map((t=>`indexof(item().mark.name, '${t}') < 0`)).join(" && "),s="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(u?` && ${u}`:"");let c=`unit: ${JJ(t)}, `;if(n.project.hasSelectionId?c+=`${xY}: ${a}[${Nt(xY)}]`:ZJ(n)?c+=`fields: ${i}, values: [${FX} ? ${FX} : ${CX}]`:c+=`fields: ${i}, values: [${o.items.map((n=>{const e=t.fieldDef(n.channel);return e?.bin?`[${a}[${Nt(t.vgField(n.channel,{}))}], ${a}[${Nt(t.vgField(n.channel,{binSuffix:"end"}))}]]`:`${a}[${Nt(n.field)}]`})).join(", ")}]`,ZJ(n))return e.concat((l=n.name,f=t.scaleName(lL),[{name:NX,update:EX},{name:`${l}_domain`,init:`domain('${f}')`},{name:CX,init:`extent(${l}_domain)[0]`},{name:OX,init:`extent(range('${f}'))[1]`},{name:FX,update:`invert('${f}', ${NX})`}]),[{name:r+GJ,on:[{events:[{signal:NX},{signal:FX}],update:`{${c}}`,force:!0}]}]);{const t=n.events;return e.concat([{name:r+GJ,on:t?[{events:t,update:`${s} ? {${c}} : null`,force:!0}]:[]}])}var l,f}};function PX(t){const{signals:n,hasLegend:e,index:r,...i}=t;return i.field=OR(i.field),i}function jX(t,n=!0,e=b){if(S(t)){const r=t.map((t=>jX(t,n,e)));return n?`[${r.join(", ")}]`:r}return yU(t)?e(n?MU(t):function(t){const n=kU(t,!0);return t.utc?+new Date(Date.UTC(...n)):+new Date(...n)}(t)):n?e(HR(t)):t}function RX(t,n){for(const e of wR(t.component.selection??{})){const r=e.name;let i=`${r}${GJ}, ${"global"===e.resolve?"true":`{unit: ${JJ(t)}}`}`;for(const r of XJ)r.defined(e)&&(r.signals&&(n=r.signals(t,e,n)),r.modifyExpr&&(i=r.modifyExpr(t,e,i)));n.push({name:r+YJ,on:[{events:{signal:e.name+GJ},update:`modify(${Nt(e.name+HJ)}, ${i})`}]})}return qX(n)}function LX(t,n){if(t.component.selection&&bR(t.component.selection).length){const e=Nt(t.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:eB("pointermove","scope"),update:`isTuple(facet) ? facet : group(${e}).datum`}]})}return qX(n)}function IX(t,n){for(const e of wR(t.component.selection??{}))for(const r of XJ)r.defined(e)&&r.marks&&(n=r.marks(t,e,n));return n}function qX(t){return t.map((t=>(t.on&&!t.on.length&&delete t.on,t)))}const UX={defined:t=>"interval"===t.type&&"global"===t.resolve&&t.bind&&"scales"===t.bind,parse:(t,n)=>{const e=n.scales=[];for(const r of n.project.items){const i=r.channel;if(!HI(i))continue;const o=t.getScaleComponent(i),a=o?o.get("type"):void 0;"sequential"==a&&vU("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&wW(a)?(o.set("selectionExtent",{param:n.name,field:r.field},!0),e.push(r)):vU("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(t,n,e)=>{const r=n.scales.filter((t=>0===e.filter((n=>n.name===t.signals.data)).length));if(!t.parent||HX(t)||0===r.length)return e;const i=e.find((t=>t.name===n.name));let o=i.update;if(o.includes(VJ))i.update=`{${r.map((t=>`${Nt(OR(t.field))}: ${t.signals.data}`)).join(", ")}}`;else{for(const t of r){const n=`${Nt(OR(t.field))}: ${t.signals.data}`;o.includes(n)||(o=`${o.substring(0,o.length-1)}, ${n}}`)}i.update=o}return e.concat(r.map((t=>({name:t.signals.data}))))},signals:(t,n,e)=>{if(t.parent&&!HX(t))for(const t of n.scales){const n=e.find((n=>n.name===t.signals.data));n.push="outer",delete n.value,delete n.update}return e}};function WX(t,n){return`domain(${Nt(t.scaleName(n))})`}function HX(t){return t.parent&&EZ(t.parent)&&(!t.parent.parent||HX(t.parent.parent))}const GX="_brush",YX="_scale_trigger",VX="geo_interval_init_tick",XX="_init",JX={defined:t=>"interval"===t.type,parse:(t,n,e)=>{if(t.hasProjection){const t={...F(e.select)?e.select:{}};t.fields=[xY],t.encodings||(t.encodings=e.value?bR(e.value):[uL,aL]),e.select={type:"interval",...t}}if(n.translate&&!UX.defined(n)){const t=`!event.item || event.item.mark.name !== ${Nt(n.name+GX)}`;for(const e of n.events){if(!e.between){vU(`${e} is not an ordered event stream for interval selections.`);continue}const n=Q(e.between[0].filter??=[]);n.includes(t)||n.push(t)}}},signals:(t,n,e)=>{const r=n.name,i=r+GJ,o=wR(n.project.hasChannel).filter((t=>t.channel===JR||t.channel===KR)),a=n.init?n.init[0]:null;if(e.push(...o.reduce(((e,r)=>e.concat(function(t,n,e,r){const i=!t.hasProjection,o=e.channel,a=e.signals.visual,u=Nt(i?t.scaleName(o):t.projectionName()),s=t=>`scale(${u}, ${t})`,c=t.getSizeSignalRef(o===JR?"width":"height").signal,l=`${o}(unit)`,f=n.events.reduce(((t,n)=>[...t,{events:n.between[0],update:`[${l}, ${l}]`},{events:n,update:`[${a}[0], clamp(${l}, 0, ${c})]`}]),[]);if(i){const i=e.signals.data,c=UX.defined(n),l=t.getScaleComponent(o),d=l?l.get("type"):void 0,h=r?{init:jX(r,!0,s)}:{value:[]};return f.push({events:{signal:n.name+YX},update:wW(d)?`[${s(`${i}[0]`)}, ${s(`${i}[1]`)}]`:"[0, 0]"}),c?[{name:i,on:[]}]:[{name:a,...h,on:f},{name:i,...r?{init:jX(r)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${u}, ${a})`}]}]}{const t=o===JR?0:1,e=n.name+XX;return[{name:a,...r?{init:`[${e}[0][${t}], ${e}[1][${t}]]`}:{value:[]},on:f}]}}(t,n,r,a?.[r.index]))),[])),t.hasProjection){const u=Nt(t.projectionName()),s=t.projectionName()+"_center",{x:c,y:l}=n.project.hasChannel,f=c?.signals.visual,d=l?.signals.visual,h=c?a?.[c.index]:`${s}[0]`,m=l?a?.[l.index]:`${s}[1]`,p=n=>t.getSizeSignalRef(n).signal,g=`[[${f?`${f}[0]`:"0"}, ${d?`${d}[0]`:"0"}],[${f?`${f}[1]`:p("width")}, ${d?`${d}[1]`:p("height")}]]`;!a||(e.unshift({name:r+XX,init:`[scale(${u}, [${c?h[0]:h}, ${l?m[0]:m}]), scale(${u}, [${c?h[1]:h}, ${l?m[1]:m}])]`}),c&&l)||e.find((t=>t.name===s))||e.unshift({name:s,update:`invert(${u}, [${p("width")}/2, ${p("height")}/2])`});const v=`vlSelectionTuples(intersect(${g}, {markname: ${Nt(t.getName("marks"))}}, unit.mark), {unit: ${JJ(t)}})`,y=o.map((t=>t.signals.visual));return e.concat({name:i,on:[{events:[...y.length?[{signal:y.join(" || ")}]:[],...a?[{signal:VX}]:[]],update:v}]})}{if(!UX.defined(n)){const n=r+YX,i=o.map((n=>{const e=n.channel,{data:r,visual:i}=n.signals,o=Nt(t.scaleName(e)),a=wW(t.getScaleComponent(e).get("type"))?"+":"";return`(!isArray(${r}) || (${a}invert(${o}, ${i})[0] === ${a}${r}[0] && ${a}invert(${o}, ${i})[1] === ${a}${r}[1]))`}));i.length&&e.push({name:n,value:{},on:[{events:o.map((n=>({scale:t.scaleName(n.channel)}))),update:`${i.join(" && ")} ? ${n} : {}`}]})}const u=o.map((t=>t.signals.data)),s=`unit: ${JJ(t)}, fields: ${r+MX}, values`;return e.concat({name:i,...a?{init:`{${s}: ${jX(a)}}`}:{},...u.length?{on:[{events:[{signal:u.join(" || ")}],update:`${u.join(" && ")} ? {${s}: [${u}]} : null`}]}:{}})}},topLevelSignals:(t,n,e)=>(DZ(t)&&t.hasProjection&&n.init&&(e.filter((t=>t.name===VX)).length||e.unshift({name:VX,value:null,on:[{events:"timer{1}",update:`${VX} === null ? {} : ${VX}`}]})),e),marks:(t,n,e)=>{const r=n.name,{x:i,y:o}=n.project.hasChannel,a=i?.signals.visual,u=o?.signals.visual,s=`data(${Nt(n.name+HJ)})`;if(UX.defined(n)||!i&&!o)return e;const c={x:void 0!==i?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==i?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const n of bR(c))c[n]=[{test:`${s}.length && ${s}[0].unit === ${JJ(t)}`,...c[n]},{value:0}];const{fill:l,fillOpacity:f,cursor:d,...h}=n.mark,m=bR(h).reduce(((t,n)=>(t[n]=[{test:[void 0!==i&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter((t=>t)).join(" && "),value:h[n]},{value:null}],t)),{}),p=d??(n.translate?"move":null);return[{name:`${r+GX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:l},fillOpacity:{value:f}},update:c}},...e,{name:r+GX,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...c,...m}}}]}};function KX({model:t,channelDef:n,vgChannel:e,invalidValueRef:r,mainRefFn:i}){const o=WH(n)&&n.condition;let a=[];o&&(a=Q(o).map((n=>{const e=i(n);if(function(t){return GR(t,"param")}(n)){const{param:r,empty:i}=n;return{test:iK(t,{param:r,empty:i}),...e}}return{test:aK(t,n.test),...e}}))),void 0!==r&&a.push(r);const u=i(n);return void 0!==u&&a.push(u),a.length>1||1===a.length&&Boolean(a[0].test)?{[e]:a}:1===a.length?{[e]:a[0]}:{}}function QX(t,n="text"){return KX({model:t,channelDef:t.encoding[n],vgChannel:n,mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0})}function ZX(t,n,e="datum"){if(t){if(nG(t))return Mq(t.value);if(ZH(t)){const{format:r,formatType:i}=pG(t);return xH({fieldOrDatumDef:t,format:r,formatType:i,expr:e,config:n})}}}function tJ(t,n={}){const{encoding:e,markDef:r,config:i,stack:o}=t,a=e.tooltip;if(S(a))return{tooltip:eJ({tooltip:a},o,i,n)};{const u=n.reactiveGeom?"datum.datum":"datum";return KX({model:t,channelDef:a,vgChannel:"tooltip",mainRefFn:t=>{const a=rJ(t,i,u);if(a)return a;if(null===t)return;let s=Nq("tooltip",r,i);return!0===s&&(s={content:"encoding"}),$t(s)?{value:s}:F(s)?pq(s)?s:"encoding"===s.content?eJ(e,o,i,n):{signal:u}:void 0},invalidValueRef:void 0})}}function nJ(t,n,e,{reactiveGeom:r}={}){const i={...e,...e.tooltipFormat},o=new Set,a=r?"datum.datum":"datum",u=[];function s(e,r){const s=ZL(r),c=tG(e)?e:{...e,type:t[s].type},l=Q(c.title||mG(c,i)).join(", ").replaceAll(/"/g,'\\"');let f;if(AI(r)){const n="x"===r?"x2":"y2",e=gG(t[n]);if(uq(c.bin)&&e){const t=uG(c,{expr:a}),r=uG(e,{expr:a}),{format:u,formatType:s}=pG(c);f=EH(t,r,u,s,i),o.add(n)}}if((AI(r)||r===iL||r===eL)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:t,formatType:n}=pG(c);f=xH({fieldOrDatumDef:c,format:t,formatType:n,expr:a,config:i,normalizeStack:!0}).signal}f??=rJ(c,i,a).signal,u.push({channel:r,key:l,value:f})}WG(t,((t,n)=>{YH(t)?s(t,n):HH(t)&&s(t.condition,n)}));const c={};for(const{channel:t,key:n,value:e}of u)o.has(t)||c[n]||(c[n]=e);return c}function eJ(t,n,e,{reactiveGeom:r}={}){const i=nJ(t,n,e,{reactiveGeom:r}),o=xR(i).map((([t,n])=>`"${t}": ${n}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function rJ(t,n,e="datum"){if(YH(t)&&QU(t.type)&&!GR(t,"format")){const n=`datum["${t.field}"]`;return{signal:`isValid(${n}) ? isArray(${n}) ? join(${n}, '\\n') : ${n} : ""+${n}`}}return ZX(t,n,e)}function iJ(t){const{markDef:n,config:e}=t,r=Nq("aria",n,e);return!1===r?{}:{...r?{aria:r}:{},...oJ(t),...aJ(t)}}function oJ(t){const{mark:n,markDef:e,config:r}=t;if(!1===r.aria)return{};const i=Nq("ariaRoleDescription",e,r);return null!=i?{ariaRoleDescription:{value:i}}:ft(bq,n)?{}:{ariaRoleDescription:{value:n}}}function aJ(t){const{encoding:n,markDef:e,config:r,stack:i}=t,o=n.description;if(o)return KX({model:t,channelDef:o,vgChannel:"description",mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0});const a=Nq("description",e,r);if(null!=a)return{description:Mq(a)};if(!1===r.aria)return{};const u=nJ(n,i,r);return yR(u)?void 0:{description:{signal:xR(u).filter((([t])=>!t.startsWith("_"))).map((([t,n])=>[t,n.replaceAll("\\n"," ")])).map((([t,n],e)=>`"${e>0?"; ":""}${t}: " + (${n})`)).join(" + ")}}}function uJ(t,n,e={}){const{markDef:r,encoding:i,config:o}=n,{vgChannel:a}=e;let{defaultRef:u,defaultValue:s}=e;const c=i[t];void 0===u&&(s??=Nq(t,r,o,{vgChannel:a,ignoreVgConfig:!WH(c)}),void 0!==s&&(u=Mq(s)));const l={markDef:r,config:o,scaleName:n.scaleName(t),scale:n.getScaleComponent(t)},f=dH({...l,scaleChannel:t,channelDef:c});return KX({model:n,channelDef:c,vgChannel:a??t,invalidValueRef:f,mainRefFn:n=>vH({...l,channel:t,channelDef:n,stack:null,defaultRef:u})})}function sJ(t,n={filled:void 0}){const{markDef:e,encoding:r,config:i}=t,{type:o}=e,a=n.filled??Nq("filled",e,i),u=sR(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,s=Nq(!0===a?"color":void 0,e,i,{vgChannel:"fill"})??i.mark[!0===a&&"color"]??u,c=Nq(!1===a?"color":void 0,e,i,{vgChannel:"stroke"})??i.mark[!1===a&&"color"],l=a?"fill":"stroke",f={...s?{fill:Mq(s)}:{},...c?{stroke:Mq(c)}:{}};return e.color&&(a?e.fill:e.stroke)&&vU(Zq("property",{fill:"fill"in e,stroke:"stroke"in e})),{...f,...uJ("color",t,{vgChannel:l,defaultValue:a?s:c}),...uJ("fill",t,{defaultValue:r.fill?s:void 0}),...uJ("stroke",t,{defaultValue:r.stroke?c:void 0})}}function cJ(t){const{encoding:n,mark:e}=t,r=n.order;return!XW(e)&&nG(r)?KX({model:t,channelDef:r,vgChannel:"zindex",mainRefFn:t=>Mq(t.value),invalidValueRef:void 0}):{}}function lJ({channel:t,markDef:n,encoding:e={},model:r,bandPosition:i}){const o=`${t}Offset`,a=n[o],u=e[o];if(("xOffset"===o||"yOffset"===o)&&u)return{offsetType:"encoding",offset:vH({channel:o,channelDef:u,markDef:n,config:r?.config,scaleName:r.scaleName(o),scale:r.getScaleComponent(o),stack:null,defaultRef:Mq(a),bandPosition:i})};const s=n[o];return s?{offsetType:"visual",offset:s}:{}}function fJ(t,n,{defaultPos:e,vgChannel:r}){const{encoding:i,markDef:o,config:a,stack:u}=n,s=i[t],c=i[nI(t)],l=n.scaleName(t),f=n.getScaleComponent(t),{offset:d,offsetType:h}=lJ({channel:t,markDef:o,encoding:i,model:n,bandPosition:.5}),m=dJ({model:n,defaultPos:e,channel:t,scaleName:l,scale:f}),p=!s&&AI(t)&&(i.latitude||i.longitude)?{field:n.getName(t)}:function(t){const{channel:n,channelDef:e,scaleName:r,stack:i,offset:o,markDef:a}=t;if(ZH(e)&&i&&n===i.fieldChannel){if(YH(e)){let t=e.bandPosition;if(void 0!==t||"text"!==a.type||"radius"!==n&&"theta"!==n||(t=.5),void 0!==t)return gH({scaleName:r,fieldOrDatumDef:e,startSuffix:"start",bandPosition:t,offset:o})}return pH(e,r,{suffix:"end"},{offset:o})}return mH(t)}({channel:t,channelDef:s,channel2Def:c,markDef:o,config:a,scaleName:l,scale:f,stack:u,offset:d,defaultRef:m,bandPosition:"encoding"===h?0:void 0});return p?{[r||t]:p}:void 0}function dJ({model:t,defaultPos:n,channel:e,scaleName:r,scale:i}){const{markDef:o,config:a}=t;return()=>{const u=ZL(e),s=tI(e),c=Nq(e,o,a,{vgChannel:s});if(void 0!==c)return yH(e,c);switch(n){case"zeroOrMin":return hJ({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:u,config:a});case"zeroOrMax":return hJ({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:u,config:a});case"mid":return{...t[eI(e)],mult:.5}}}}function hJ({mainChannel:t,config:n,...e}){const r=fH(e),{mode:i}=e;if(r)return r;switch(t){case"radius":{if("zeroOrMin"===i)return{value:0};const{widthSignal:t,heightSignal:n}=i.zeroOrMax;return{signal:`min(${t},${n})/2`}}case"theta":return"zeroOrMin"===i?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===i?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===i?{field:{group:"height"}}:{value:0}}}const mJ={left:"x",center:"xc",right:"x2"},pJ={top:"y",middle:"yc",bottom:"y2"};function gJ(t,n,e,r="middle"){if("radius"===t||"theta"===t)return tI(t);const i="x"===t?"align":"baseline",o=Nq(i,n,e);let a;return pq(o)?(vU(function(t){return`The ${t} for range marks cannot be an expression`}(i)),a=void 0):a=o,"x"===t?mJ[a||("top"===r?"left":"center")]:pJ[a||r]}function vJ(t,n,{defaultPos:e,defaultPos2:r,range:i}){return i?yJ(t,n,{defaultPos:e,defaultPos2:r}):fJ(t,n,{defaultPos:e})}function yJ(t,n,{defaultPos:e,defaultPos2:r}){const{markDef:i,config:o}=n,a=nI(t),u=eI(t),s=function(t,n,e){const{encoding:r,mark:i,markDef:o,stack:a,config:u}=t,s=ZL(e),c=eI(e),l=tI(e),f=r[s],d=t.scaleName(s),h=t.getScaleComponent(s),{offset:m}=lJ(e in r||e in o?{channel:e,markDef:o,encoding:r,model:t}:{channel:s,markDef:o,encoding:r,model:t});if(!f&&("x2"===e||"y2"===e)&&(r.latitude||r.longitude)){const n=eI(e),r=t.markDef[n];return null!=r?{[n]:{value:r}}:{[l]:{field:t.getName(e)}}}const p=function({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c}){return ZH(n)&&u&&t.charAt(0)===u.fieldChannel.charAt(0)?pH(n,o,{suffix:"start"},{offset:s}):mH({channel:t,channelDef:e,scaleName:o,scale:a,stack:u,markDef:r,config:i,offset:s,defaultRef:c})}({channel:e,channelDef:f,channel2Def:r[e],markDef:o,config:u,scaleName:d,scale:h,stack:a,offset:m,defaultRef:void 0});return void 0!==p?{[l]:p}:bJ(e,o)||bJ(e,{[e]:Oq(e,o,u.style),[c]:Oq(c,o,u.style)})||bJ(e,u[i])||bJ(e,u.mark)||{[l]:dJ({model:t,defaultPos:n,channel:e,scaleName:d,scale:h})()}}(n,r,a);return{...fJ(t,n,{defaultPos:e,vgChannel:s[u]?gJ(t,i,o):tI(t)}),...s}}function bJ(t,n){const e=eI(t),r=tI(t);if(void 0!==n[r])return{[r]:yH(t,n[r])};if(void 0!==n[t])return{[r]:yH(t,n[t])};if(n[e]){const r=n[e];if(!iH(r))return{[e]:yH(t,r)};vU(function(t){return`Position range does not support relative band size for ${t}.`}(e))}}function wJ(t,n){const{config:e,encoding:r,markDef:i}=t,o=i.type,a=nI(n),u=eI(n),s=r[n],c=r[a],l=t.getScaleComponent(n),f=l?l.get("type"):void 0,d=i.orient,h=r[u]??r.size??Nq("size",i,e,{vgChannel:u}),m=rI(n),p="bar"===o&&("x"===n?"vertical"===d:"horizontal"===d)||"tick"===o&&("y"===n?"vertical"===d:"horizontal"===d);return!YH(s)||!(aq(s.bin)||uq(s.bin)||s.timeUnit&&!c)||h&&!iH(h)||r[m]||bW(f)?(ZH(s)&&bW(f)||p)&&!c?function(t,n,e){const{markDef:r,encoding:i,config:o,stack:a}=e,u=r.orient,s=e.scaleName(n),c=e.getScaleComponent(n),l=eI(n),f=nI(n),d=rI(n),h=e.scaleName(d),m=e.getScaleComponent(iI(n)),p="tick"===r.type||"horizontal"===u&&"y"===n||"vertical"===u&&"x"===n;let g;(i.size||r.size)&&(p?g=uJ("size",e,{vgChannel:l,defaultRef:Mq(r.size)}):vU(function(t){return`Cannot apply size to non-oriented mark "${t}".`}(r.type)));const v=!!g,y=IH({channel:n,fieldDef:t,markDef:r,config:o,scaleType:(c||m)?.get("type"),useVlSizeChannel:p});g=g||{[l]:xJ(l,h||s,m||c,o,y,!!t,r.type)};const b=gJ(n,r,o,"band"===(c||m)?.get("type")&&iH(y)&&!v?"top":"middle"),w="xc"===b||"yc"===b,{offset:x,offsetType:$}=lJ({channel:n,markDef:r,encoding:i,model:e,bandPosition:w?.5:0}),k=mH({channel:n,channelDef:t,markDef:r,config:o,scaleName:s,scale:c,stack:a,offset:x,defaultRef:dJ({model:e,defaultPos:"mid",channel:n,scaleName:s,scale:c}),bandPosition:w?"encoding"===$?0:.5:pq(y)?{signal:`(1-${y})/2`}:iH(y)?(1-y.band)/2:0});if(l)return{[b]:k,...g};{const t=tI(f),n=g[l],e=x?{...n,offset:x}:n;return{[b]:k,[t]:S(k)?[k[0],{...k[1],offset:e}]:{...k,offset:e}}}}(s,n,t):yJ(n,t,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:t,fieldDef2:n,channel:e,model:r}){const{config:i,markDef:o,encoding:a}=r,u=r.getScaleComponent(e),s=r.scaleName(e),c=u?u.get("type"):void 0,l=u.get("reverse"),f=IH({channel:e,fieldDef:t,markDef:o,config:i,scaleType:c}),d=r.component.axes[e]?.[0],h=d?.get("translate")??.5,m=AI(e)?Nq("binSpacing",o,i)??0:0,p=nI(e),g=tI(e),v=tI(p),y=Cq("minBandSize",o,i),{offset:b}=lJ({channel:e,markDef:o,encoding:a,model:r,bandPosition:0}),{offset:w}=lJ({channel:p,markDef:o,encoding:a,model:r,bandPosition:0}),x=function({scaleName:t,fieldDef:n}){const e=uG(n,{expr:"datum"});return`abs(scale("${t}", ${uG(n,{expr:"datum",suffix:"end"})}) - scale("${t}", ${e}))`}({fieldDef:t,scaleName:s}),$=$J(e,m,l,h,b,y,x),k=$J(p,m,l,h,w??b,y,x),M=pq(f)?{signal:`(1-${f.signal})/2`}:iH(f)?(1-f.band)/2:.5,A=LH({fieldDef:t,fieldDef2:n,markDef:o,config:i});if(aq(t.bin)||t.timeUnit){const n=t.timeUnit&&.5!==A;return{[v]:kJ({fieldDef:t,scaleName:s,bandPosition:M,offset:k,useRectOffsetField:n}),[g]:kJ({fieldDef:t,scaleName:s,bandPosition:pq(M)?{signal:`1-${M.signal}`}:1-M,offset:$,useRectOffsetField:n})}}if(uq(t.bin)){const e=pH(t,s,{},{offset:k});if(YH(n))return{[v]:e,[g]:pH(n,s,{},{offset:$})};if(sq(t.bin)&&t.bin.step)return{[v]:e,[g]:{signal:`scale("${s}", ${uG(t,{expr:"datum"})} + ${t.bin.step})`,offset:$}}}vU(hU(p))}({fieldDef:s,fieldDef2:c,channel:n,model:t})}function xJ(t,n,e,r,i,o,a){if(iH(i)){if(!e)return{mult:i.band,field:{group:t}};{const t=e.get("type");if("band"===t){let t=`bandwidth('${n}')`;1!==i.band&&(t=`${i.band} * ${t}`);const e=Cq("minBandSize",{type:a},r);return{signal:e?`max(${Sq(e)}, ${t})`:t}}1!==i.band&&(vU(function(t){return`Cannot use the relative band size with ${t} scale.`}(t)),i=void 0)}}else{if(pq(i))return i;if(i)return{value:i}}if(e){const t=e.get("range");if(gq(t)&&wt(t.step))return{value:t.step-2}}if(!o){const{bandPaddingInner:n,barBandPaddingInner:e,rectBandPaddingInner:i,tickBandPaddingInner:o}=r.scale,u=TR(n,"tick"===a?o:"bar"===a?e:i);if(pq(u))return{signal:`(1 - (${u.signal})) * ${t}`};if(wt(u))return{signal:`${1-u} * ${t}`}}return{value:BY(r.view,t)-2}}function $J(t,n,e,r,i,o,a){if(CL(t))return 0;const u="x"===t||"y2"===t,s=u?-n/2:n/2;if(pq(e)||pq(i)||pq(r)||o){const t=Sq(e),n=Sq(i),c=Sq(r),l=Sq(o),f=o?`(${a} < ${l} ? ${u?"":"-"}0.5 * (${l} - (${a})) : ${s})`:s;return{signal:(c?`${c} + `:"")+(t?`(${t} ? -1 : 1) * `:"")+(n?`(${n} + ${f})`:f)}}return i=i||0,r+(e?-i-s:+i+s)}function kJ({fieldDef:t,scaleName:n,bandPosition:e,offset:r,useRectOffsetField:i}){return gH({scaleName:n,fieldOrDatumDef:t,bandPosition:e,offset:r,...i?{startSuffix:bX,endSuffix:wX}:{}})}const MJ=new Set(["aria","width","height"]);function AJ(t,n){const{fill:e,stroke:r}="include"===n.color?sJ(t):{};return{...SJ(t.markDef,n),...DJ("fill",e),...DJ("stroke",r),...uJ("opacity",t),...uJ("fillOpacity",t),...uJ("strokeOpacity",t),...uJ("strokeWidth",t),...uJ("strokeDash",t),...cJ(t),...tJ(t),...QX(t,"href"),...iJ(t)}}function DJ(t,n){return n?{[t]:n}:{}}function SJ(t,n){return yq.reduce(((e,r)=>(!MJ.has(r)&&GR(t,r)&&"ignore"!==n[r]&&(e[r]=Mq(t[r])),e)),{})}function FJ(t){const{config:n,markDef:e}=t,r=new Set;if(t.forEachFieldDef(((i,o)=>{let a;if(!HI(o)||!(a=t.getScaleType(o)))return;const u=eq(i.aggregate);if("break-paths-filter-domains"===(s=lH({scaleChannel:o,markDef:e,config:n,scaleType:a,isCountAggregate:u}))||"break-paths-show-domains"===s){const n=t.vgField(o,{expr:"datum",binSuffix:t.stack?.impute?"mid":void 0});n&&r.add(n)}var s})),r.size>0){const t=[...r].map((t=>XU(t,!0))).join(" && ");return{defined:{signal:t}}}}function EJ(t,n){if(void 0!==n)return{[t]:Mq(n)}}const NJ="voronoi",CJ={defined:t=>"point"===t.type&&t.nearest,parse:(t,n)=>{if(n.events)for(const e of n.events)e.markname=t.getName(NJ)},marks:(t,n,e)=>{const{x:r,y:i}=n.project.hasChannel,o=t.mark;if(XW(o))return vU(`The "nearest" transform is not supported for ${o} marks.`),e;const a={name:t.getName(NJ),type:"path",interactive:!0,aria:!1,from:{data:t.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...tJ(t,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let u=0,s=!1;return e.forEach(((n,e)=>{const r=n.name??"";r===t.component.mark[0].name?u=e:r.includes(NJ)&&(s=!0)})),s||e.splice(u+1,0,a),e}},OJ={defined:t=>"point"===t.type&&"global"===t.resolve&&t.bind&&"scales"!==t.bind&&!kY(t.bind),parse:(t,n,e)=>QJ(n,e),topLevelSignals:(t,n,e)=>{const r=n.name,i=n.project,o=n.bind,a=n.init?.[0],u=CJ.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach(((t,i)=>{const s=kR(`${r}_${t.field}`);e.filter((t=>t.name===s)).length||e.unshift({name:s,...a?{init:jX(a[i])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${Nt(t.field)}] : null`}]:[],bind:o[t.field]??o[t.channel]??o})})),e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+GJ)),a=r+MX,u=i.items.map((t=>kR(`${r}_${t.field}`))),s=u.map((t=>`${t} !== null`)).join(" && ");return u.length&&(o.update=`${s} ? {fields: ${a}, values: [${u.join(", ")}]} : null`),delete o.value,delete o.on,e}},_J="_toggle",zJ={defined:t=>"point"===t.type&&!ZJ(t)&&!!t.toggle,signals:(t,n,e)=>e.concat({name:n.name+_J,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(t,n)=>{const e=n.name+GJ,r=n.name+_J;return`${r} ? null : ${e}, ${"global"===n.resolve?`${r} ? null : true, `:`${r} ? null : {unit: ${JJ(t)}}, `}${r} ? ${e} : null`}},BJ={defined:t=>void 0!==t.clear&&!1!==t.clear&&!ZJ(t),parse:(t,n)=>{n.clear&&(n.clear=$t(n.clear)?eB(n.clear,"view"):n.clear)},topLevelSignals:(t,n,e)=>{if(OJ.defined(n))for(const t of n.project.items){const r=e.findIndex((e=>e.name===kR(`${n.name}_${t.field}`)));-1!==r&&e[r].on.push({events:n.clear,update:"null"})}return e},signals:(t,n,e)=>{function r(t,r){-1!==t&&e[t].on&&e[t].on.push({events:n.clear,update:r})}if("interval"===n.type)for(const t of n.project.items){const n=e.findIndex((n=>n.name===t.signals.visual));r(n,"[0, 0]"),-1===n&&r(e.findIndex((n=>n.name===t.signals.data)),"null")}else{let t=e.findIndex((t=>t.name===n.name+GJ));r(t,"null"),zJ.defined(n)&&(t=e.findIndex((t=>t.name===n.name+_J)),r(t,"false"))}return e}},TJ={defined:t=>{const n="global"===t.resolve&&t.bind&&kY(t.bind),e=1===t.project.items.length&&t.project.items[0].field!==xY;return n&&!e&&vU("Legend bindings are only supported for selections over an individual field or encoding channel."),n&&e},parse:(t,n,e)=>{const r=eR(e);if(r.select=$t(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},QJ(n,r),F(e.select)&&(e.select.on||e.select.clear)){const t='event.item && indexof(event.item.mark.role, "legend") < 0';for(const e of n.events)e.filter=Q(e.filter??[]),e.filter.includes(t)||e.filter.push(t)}const i=MY(n.bind)?n.bind.legend:"click",o=$t(i)?eB(i,"view"):Q(i);n.bind={legend:{merge:o}}},topLevelSignals:(t,n,e)=>{const r=n.name,i=MY(n.bind)&&n.bind.legend,o=t=>n=>{const e=eR(n);return e.markname=t,e};for(const t of n.project.items){if(!t.hasLegend)continue;const a=`${kR(t.field)}_legend`,u=`${r}_${a}`;if(0===e.filter((t=>t.name===u)).length){const t=i.merge.map(o(`${a}_symbols`)).concat(i.merge.map(o(`${a}_labels`))).concat(i.merge.map(o(`${a}_entries`)));e.unshift({name:u,...n.init?{}:{value:null},on:[{events:t,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+GJ)),a=r+MX,u=i.items.filter((t=>t.hasLegend)).map((t=>kR(`${r}_${kR(t.field)}_legend`))),s=`${u.map((t=>`${t} !== null`)).join(" && ")} ? {fields: ${a}, values: [${u.join(", ")}]} : null`;n.events&&u.length>0?o.on.push({events:u.map((t=>({signal:t}))),update:s}):u.length>0&&(o.update=s,delete o.value,delete o.on);const c=e.find((t=>t.name===r+_J)),l=MY(n.bind)&&n.bind.legend;return c&&(n.events?c.on.push({...c.on[0],events:l}):c.on[0].events=l),e}},PJ="_translate_anchor",jJ="_translate_delta",RJ={defined:t=>"interval"===t.type&&t.translate,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+PJ,{x:a,y:u}=n.project.hasChannel;let s=eB(n.translate,"scope");return i||(s=s.map((t=>(t.between[0].markname=r+GX,t)))),e.push({name:o,value:{},on:[{events:s.map((t=>t.between[0])),update:`{x: x(unit), y: y(unit)${void 0!==a?`, extent_x: ${i?WX(t,JR):`slice(${a.signals.visual})`}`:""}${void 0!==u?`, extent_y: ${i?WX(t,KR):`slice(${u.signals.visual})`}`:""}}`}]},{name:r+jJ,value:{},on:[{events:s,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&LJ(t,n,a,"width",e),void 0!==u&&LJ(t,n,u,"height",e),e}};function LJ(t,n,e,r,i){const o=n.name,a=o+PJ,u=o+jJ,s=e.channel,c=UX.defined(n),l=i.find((t=>t.name===e.signals[c?"data":"visual"])),f=t.getSizeSignalRef(r).signal,d=t.getScaleComponent(s),h=d?.get("type"),m=d?.get("reverse"),p=`${a}.extent_${s}`,g=`${c&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${p}, ${c?s===JR?m?"":"-":m?"-":"":""}${u}.${s} / ${c?`${f}`:`span(${p})`}${c?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;l.on.push({events:{signal:u},update:c?g:`clampRange(${g}, 0, ${f})`})}const IJ="_zoom_anchor",qJ="_zoom_delta",UJ={defined:t=>"interval"===t.type&&t.zoom,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+qJ,{x:a,y:u}=n.project.hasChannel,s=Nt(t.scaleName(JR)),c=Nt(t.scaleName(KR));let l=eB(n.zoom,"scope");return i||(l=l.map((t=>(t.markname=r+GX,t)))),e.push({name:r+IJ,on:[{events:l,update:i?`{${[s?`x: invert(${s}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter((t=>t)).join(", ")}}`:"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:l,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&WJ(t,n,a,"width",e),void 0!==u&&WJ(t,n,u,"height",e),e}};function WJ(t,n,e,r,i){const o=n.name,a=e.channel,u=UX.defined(n),s=i.find((t=>t.name===e.signals[u?"data":"visual"])),c=t.getSizeSignalRef(r).signal,l=t.getScaleComponent(a),f=l?.get("type"),d=u?WX(t,a):s.name,h=o+qJ,m=`${u&&l?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${IJ}.${a}, ${h}${u?"pow"===f?`, ${l.get("exponent")??1}`:"symlog"===f?`, ${l.get("constant")??1}`:"":""})`;s.on.push({events:{signal:h},update:u?m:`clampRange(${m}, 0, ${c})`})}const HJ="_store",GJ="_tuple",YJ="_modify",VJ="vlSelectionResolve",XJ=[TX,JX,DX,zJ,OJ,UX,TJ,BJ,RJ,UJ,CJ];function JJ(t,{escape:n}={escape:!0}){let e=n?Nt(t.name):t.name;const r=function(t){let n=t.parent;for(;n&&!SZ(n);)n=n.parent;return n}(t);if(r){const{facet:t}=r;for(const n of RL)t[n]&&(e+=` + '__facet_${n}_' + (facet[${Nt(r.vgField(n))}])`)}return e}function KJ(t){return wR(t.component.selection??{}).reduce(((t,n)=>t||n.project.hasSelectionId),!1)}function QJ(t,n){!$t(n.select)&&n.select.on||delete t.events,!$t(n.select)&&n.select.clear||delete t.clear,!$t(n.select)&&n.select.toggle||delete t.toggle}function ZJ(t){return t.events?.find((t=>"type"in t&&"timer"===t.type))}function tK(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...tK(t.object)),n.push(...tK(t.property))),n)}function nK(t){return"MemberExpression"===t.object.type?nK(t.object):"datum"===t.object.name}function eK(t){const n=GO(t),e=new Set;return n.visit((t=>{"MemberExpression"===t.type&&nK(t)&&e.add(tK(t).slice(1).join("."))})),e}class rK extends mX{model;filter;expr;_dependentFields;clone(){return new rK(null,this.model,eR(this.filter))}constructor(t,n,e){super(t),this.model=n,this.filter=e,this.expr=aK(this.model,this.filter,this),this._dependentFields=eK(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function iK(t,n,e,r="datum"){const i=$t(n)?n:n.param,o=kR(i),a=Nt(o+HJ);let u;try{u=t.getSelectionComponent(o,i)}catch{return`!!${o}`}if(u.project.timeUnit){const n=e??t.component.data.raw,r=u.project.timeUnit.clone();n.parent?r.insertAsParentOf(n):n.parent=r}const s=`${u.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${r}${"global"===u.resolve?")":`, ${Nt(u.resolve)})`}`,c=`length(data(${a}))`;return!1===n.empty?`${c} && ${s}`:`!${c} || ${s}`}function oK(t,n,e){const r=kR(n),i=e.encoding;let o,a=e.field;try{o=t.getSelectionComponent(r,n)}catch{return r}if(i||a){if(i&&!a){const t=o.project.items.filter((t=>t.channel===i));!t.length||t.length>1?(a=o.project.items[0].field,vU(function(t,n,e,r){return`${t.length?"Multiple ":"No "}matching ${Nt(n)} encoding found for selection ${Nt(e.param)}. Using "field": ${Nt(r)}.`}(t,i,e,a))):a=t[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&vU(function(t){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Nt(t)}.`}(a));return`${o.name}[${Nt(OR(a))}]`}function aK(t,n,e){return MR(n,(n=>$t(n)?n:function(t){return GR(t,"param")}(n)?iK(t,n,e):VU(n)))}function uK(t,n,e,r){t.encode??={},t.encode[n]??={},t.encode[n].update??={},t.encode[n].update[e]=r}function sK(t,n,e,r={header:!1}){const{disable:i,orient:o,scale:a,labelExpr:u,title:s,zindex:c,...l}=t.combine();if(!i){for(const t in l){const e=t,r=NG[e],i=l[e];if(r&&r!==n&&"both"!==r)delete l[e];else if(FG(i)){const{condition:t,...n}=i,r=Q(t),o=SG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((t=>{const{test:n,...e}=t;return{test:aK(null,n),...e}})),n];uK(l,i,t,a),delete l[e]}else if(null===o){const t={signal:r.map((t=>{const{test:n,...e}=t;return`${aK(null,n)} ? ${Dq(e)} : `})).join("")+Dq(n)};l[e]=t}}else if(pq(i)){const t=SG[e];if(t){const{vgProp:n,part:r}=t;uK(l,r,n,i),delete l[e]}}sR(["labelAlign","labelBaseline"],e)&&null===l[e]&&delete l[e]}if("grid"===n){if(!l.grid)return;if(l.encode){const{grid:t}=l.encode;l.encode={...t?{grid:t}:{}},yR(l.encode)&&delete l.encode}return{scale:a,orient:o,...l,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:TR(c,0)}}{if(!r.header&&t.mainExtracted)return;if(void 0!==u){let t=u;l.encode?.labels?.update&&pq(l.encode.labels.update.text)&&(t=_R(u,"datum.label",l.encode.labels.update.text.signal)),uK(l,"labels","text",{signal:t})}if(null===l.labelAlign&&delete l.labelAlign,l.encode){for(const n of EG)t.hasAxisPart(n)||delete l.encode[n];yR(l.encode)&&delete l.encode}const n=function(t,n){if(t)return S(t)&&!mq(t)?t.map((t=>mG(t,n))).join(", "):t}(s,e);return{scale:a,orient:o,grid:!1,...n?{title:n}:{},...l,...!1===e.aria?{aria:!1}:{},zindex:TR(c,0)}}}}function cK(t){const{axes:n}=t.component,e=[];for(const r of MI)if(n[r])for(const i of n[r])if(!i.get("disable")&&!i.get("gridScale")){const n="x"===r?"height":"width",i=t.getSizeSignalRef(n).signal;n!==i&&e.push({name:n,update:i})}return e}function lK(t,n,e,r){return Object.assign.apply(null,[{},...t.map((t=>{if("axisOrient"===t){const t="x"===e?"bottom":"left",i=n["x"===e?"axisBottom":"axisLeft"]||{},o=n["x"===e?"axisTop":"axisRight"]||{},a=new Set([...bR(i),...bR(o)]),u={};for(const n of a.values())u[n]={signal:`${r.signal} === "${t}" ? ${Sq(i[n])} : ${Sq(o[n])}`};return u}return n[t]}))])}function fK(t,n){const e=[{}];for(const r of t){let t=n[r]?.style;if(t){t=Q(t);for(const r of t)e.push(n.style[r])}}return Object.assign.apply(null,e)}function dK(t,n,e,r={}){const i=_q(t,e,n);if(void 0!==i)return{configFrom:"style",configValue:i};for(const n of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==r[n]?.[t])return{configFrom:n,configValue:r[n][t]};return{}}const hK={scale:({model:t,channel:n})=>t.scaleName(n),format:({format:t})=>t,formatType:({formatType:t})=>t,grid:({fieldOrDatumDef:t,axis:n,scaleType:e})=>n.grid??function(t,n){return!bW(t)&&YH(n)&&!aq(n?.bin)&&!uq(n?.bin)}(e,t),gridScale:({model:t,channel:n})=>function(t,n){const e="x"===n?"y":"x";if(t.getScaleComponent(e))return t.scaleName(e)}(t,n),labelAlign:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelAlign||gK(n,e,r),labelAngle:({labelAngle:t})=>t,labelBaseline:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelBaseline||pK(n,e,r),labelFlush:({axis:t,fieldOrDatumDef:n,channel:e})=>t.labelFlush??function(t,n){if("x"===n&&sR(["quantitative","temporal"],t))return!0}(n.type,e),labelOverlap:({axis:t,fieldOrDatumDef:n,scaleType:e})=>t.labelOverlap??function(t,n,e,r){if(e&&!F(r)||"nominal"!==t&&"ordinal"!==t)return"log"!==n&&"symlog"!==n||"greedy"}(n.type,e,YH(n)&&!!n.timeUnit,YH(n)?n.sort:void 0),orient:({orient:t})=>t,tickCount:({channel:t,model:n,axis:e,fieldOrDatumDef:r,scaleType:i})=>{const o="x"===t?"width":"y"===t?"height":void 0,a=o?n.getSizeSignalRef(o):void 0;return e.tickCount??function({fieldOrDatumDef:t,scaleType:n,size:e,values:r}){if(!r&&!bW(n)&&"log"!==n){if(YH(t)){if(aq(t.bin))return{signal:`ceil(${e.signal}/10)`};if(t.timeUnit&&sR(["month","hours","day","quarter"],BU(t.timeUnit)?.unit))return}return{signal:`ceil(${e.signal}/40)`}}}({fieldOrDatumDef:r,scaleType:i,size:a,values:e.values})},tickMinStep:({axis:t,format:n,fieldOrDatumDef:e})=>t.tickMinStep??function({format:t,fieldOrDatumDef:n}){if("d"===t)return 1;if(YH(n)){const{timeUnit:t}=n;if(t){const n=TU(t);if(n)return{signal:n}}}}({format:n,fieldOrDatumDef:e}),title:({axis:t,model:n,channel:e})=>{if(void 0!==t.title)return t.title;const r=vK(n,e);if(void 0!==r)return r;const i=n.typedFieldDef(e),o=n.fieldDef("x"===e?"x2":"y2");return Bq(i?[jH(i)]:[],YH(o)?[jH(o)]:[])},values:({axis:t,fieldOrDatumDef:n})=>function(t,n){const e=t.values;return S(e)?AG(n,e):pq(e)?e:void 0}(t,n),zindex:({axis:t,fieldOrDatumDef:n,mark:e})=>t.zindex??function(t,n){return"rect"===t&&sG(n)?1:0}(e,n)};function mK(t){return`(((${t.signal} % 360) + 360) % 360)`}function pK(t,n,e,r){if(void 0!==t){if("x"===e){if(pq(t)){const e=mK(t);return{signal:`(45 < ${e} && ${e} < 135) || (225 < ${e} && ${e} < 315) ? "middle" :(${e} <= 45 || 315 <= ${e}) === ${pq(n)?`(${n.signal} === "top")`:"top"===n} ? "bottom" : "top"`}}return 45<t&&t<135||225<t&&t<315?"middle":pq(n)?{signal:`${n.signal} ${t<=45||315<=t?"===":"!=="} "top" ? "bottom" : "top"`}:(t<=45||315<=t)==("top"===n)?"bottom":"top"}if(pq(t)){const e=mK(t);return{signal:`${e} <= 45 || 315 <= ${e} || (135 <= ${e} && ${e} <= 225) ? ${r?'"middle"':"null"} : (45 <= ${e} && ${e} <= 135) === ${pq(n)?`(${n.signal} === "left")`:"left"===n} ? "top" : "bottom"`}}return t<=45||315<=t||135<=t&&t<=225?r?"middle":null:pq(n)?{signal:`${n.signal} ${45<=t&&t<=135?"===":"!=="} "left" ? "top" : "bottom"`}:(45<=t&&t<=135)==("left"===n)?"top":"bottom"}}function gK(t,n,e){if(void 0===t)return;const r="x"===e,i=r?0:90,o=r?"bottom":"left";if(pq(t)){const e=mK(t);return{signal:`(${i?`(${e} + 90)`:e} % 180 === 0) ? ${r?null:'"center"'} :(${i} < ${e} && ${e} < ${180+i}) === ${pq(n)?`(${n.signal} === "${o}")`:n===o} ? "left" : "right"`}}return(t+i)%180==0?r?null:"center":pq(n)?{signal:`${n.signal} ${i<t&&t<180+i?"===":"!=="} "${o}" ? "left" : "right"`}:(i<t&&t<180+i)==(n===o)?"left":"right"}function vK(t,n){const e="x"===n?"x2":"y2",r=t.fieldDef(n),i=t.fieldDef(e),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?Tq(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class yK extends mX{transform;_dependentFields;clone(){return new yK(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this._dependentFields=eK(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef(((n,e)=>{if(eG(n)&&zH(n.sort)){const{field:r,timeUnit:i}=n,o=n.sort,a=o.map(((t,n)=>`${VU({field:r,timeUnit:i,equal:t})} ? ${n} : `)).join("")+o.length;t=new yK(t,{calculate:a,as:bK(n,e,{forAs:!0})})}})),t}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 ${aR(this.transform)}`}}function bK(t,n,e){return uG(t,{prefix:n,suffix:"sort_index",...e})}function wK(t,n){return sR(["top","bottom"],n)?"column":sR(["left","right"],n)||"row"===t?"row":"column"}function xK(t,n,e,r){return TR((n||{})[t],("row"===r?e.headerRow:"column"===r?e.headerColumn:e.headerFacet)[t],e.header[t])}function $K(t,n,e,r){const i={};for(const o of t){const t=xK(o,n||{},e,r);void 0!==t&&(i[o]=t)}return i}const kK=["row","column"],MK=["header","footer"];function AK(t,n){const e=t.component.layoutHeaders[n].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[n].facetFieldDef?t.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:u}=$K(["titleAnchor","titleAngle","titleOrient"],i.header,r,n),s=wK(n,u),c=IR(a);return{name:`${n}-title`,type:"group",role:`${s}-title`,title:{text:e,..."row"===n?{orient:"left"}:{},style:"guide-title",...SK(c,s),...DK(s,c,o),...zK(r,i,n,vY,pY)}}}function DK(t,n,e="middle"){switch(e){case"start":return{align:"left"};case"end":return{align:"right"}}const r=gK(n,"row"===t?"left":"top","row"===t?"y":"x");return r?{align:r}:{}}function SK(t,n){const e=pK(t,"row"===n?"left":"top","row"===n?"y":"x",!0);return e?{baseline:e}:{}}function FK(t,n){const e=t.component.layoutHeaders[n],r=[];for(const i of MK)if(e[i])for(const o of e[i]){const a=CK(t,n,i,e,o);null!=a&&r.push(a)}return r}function EK(t,n){const{sort:e}=t;return _H(e)?{field:uG(e,{expr:"datum"}),order:e.order??"ascending"}:S(e)?{field:bK(t,n,{expr:"datum"}),order:"ascending"}:{field:uG(t,{expr:"datum"}),order:e??"ascending"}}function NK(t,n,e){const{format:r,formatType:i,labelAngle:o,labelAnchor:a,labelOrient:u,labelExpr:s}=$K(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],t.header,e,n),c=xH({fieldOrDatumDef:t,format:r,formatType:i,expr:"parent",config:e}).signal,l=wK(n,u);return{text:{signal:s?_R(_R(s,"datum.label",c),"datum.value",uG(t,{expr:"parent"})):c},..."row"===n?{orient:"left"}:{},style:"guide-label",frame:"group",...SK(o,l),...DK(l,o,a),...zK(e,t,n,yY,gY)}}function CK(t,n,e,r,i){if(i){let o=null;const{facetFieldDef:a}=r,u=t.config?t.config:void 0;if(a&&i.labels){const{labelOrient:t}=$K(["labelOrient"],a.header,u,n);("row"===n&&!sR(["top","bottom"],t)||"column"===n&&!sR(["left","right"],t))&&(o=NK(a,n,u))}const s=SZ(t)&&!BH(t.facet),c=i.axes,l=c?.length>0;if(o||l){const u="row"===n?"height":"width";return{name:t.getName(`${n}_${e}`),type:"group",role:`${n}-${e}`,...r.facetFieldDef?{from:{data:t.getName(`${n}_domain`)},sort:EK(a,n)}:{},...l&&s?{from:{data:t.getName(`facet_domain_${n}`)}}:{},...o?{title:o}:{},...i.sizeSignal?{encode:{update:{[u]:i.sizeSignal}}}:{},...l?{axes:c}:{}}}}return null}const OK={column:{start:0,end:1},row:{start:1,end:0}};function _K(t,n){return OK[n][t]}function zK(t,n,e,r,i){const o={};for(const a of r){if(!i[a])continue;const r=xK(a,n?.header,t,e);void 0!==r&&(o[i[a]]=r)}return o}function BK(t){return[...TK(t,"width"),...TK(t,"height"),...TK(t,"childWidth"),...TK(t,"childHeight")]}function TK(t,n){const e="width"===n?"x":"y",r=t.component.layoutSize.get(n);if(null==r||"merged"===r)return[];const i=t.getSizeSignalRef(n).signal;if("step"===r){const n=t.getScaleComponent(e);if(n){const r=n.get("type"),o=n.get("range");if(bW(r)&&gq(o)){const r=t.scaleName(e);return SZ(t.parent)&&"independent"===t.parent.component.resolve.scale[e]?[PK(r,o)]:[PK(r,o),{name:i,update:jK(r,n,`domain('${r}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==r){const n=i.endsWith("width"),e=n?"containerSize()[0]":"containerSize()[1]",r=`isFinite(${e}) ? ${e} : ${zY(t.config.view,n?"width":"height")}`;return[{name:i,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:i,value:r}]}function PK(t,n){const e=`${t}_step`;return pq(n.step)?{name:e,update:n.step.signal}:{name:e,value:n.step}}function jK(t,n,e){const r=n.get("type"),i=n.get("padding"),o=TR(n.get("paddingOuter"),i);let a=n.get("paddingInner");return a="band"===r?void 0!==a?a:i:1,`bandspace(${e}, ${Sq(a)}, ${Sq(o)}) * ${t}_step`}function RK(t){return"childWidth"===t?"width":"childHeight"===t?"height":t}function LK(t,n){return bR(t).reduce(((e,r)=>({...e,...KX({model:n,channelDef:t[r],vgChannel:r,mainRefFn:t=>Mq(t.value),invalidValueRef:void 0})})),{})}function IK(t,n){if(SZ(n))return"theta"===t?"independent":"shared";if(EZ(n))return"shared";if(FZ(n))return AI(t)||"theta"===t||"radius"===t?"independent":"shared";throw new Error("invalid model type for resolve")}function qK(t,n){const e=t.scale[n],r=AI(n)?"axis":"legend";return"independent"===e?("shared"===t[r][n]&&vU(function(t){return`Setting the scale to be independent for "${t}" means we also have to set the guide (axis or legend) to be independent.`}(n)),"independent"):t[r][n]||"shared"}const UK=bR({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 WK extends QV{}const HK={symbols:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:u,config:s,mark:c}=e,l=a.filled&&"trail"!==c;let f={...Fq({},e,ZW),...sJ(e,{filled:l})};const d=i.get("symbolOpacity")??s.legend.symbolOpacity,h=i.get("symbolFillColor")??s.legend.symbolFillColor,m=i.get("symbolStrokeColor")??s.legend.symbolStrokeColor,p=void 0===d?GK(u.opacity)??a.opacity:void 0;if(f.fill)if("fill"===r||l&&r===fL)delete f.fill;else if(GR(f.fill,"field"))h?delete f.fill:(f.fill=Mq(s.legend.symbolBaseFillColor??"black"),f.fillOpacity=Mq(p??1));else if(S(f.fill)){const t=YK(u.fill??u.color)??a.fill??(l&&a.color);t&&(f.fill=Mq(t))}if(f.stroke)if("stroke"===r||!l&&r===fL)delete f.stroke;else if(GR(f.stroke,"field")||m)delete f.stroke;else if(S(f.stroke)){const t=TR(YK(u.stroke||u.color),a.stroke,l?a.color:void 0);t&&(f.stroke={value:t})}if(r!==vL){const t=YH(n)&&XK(0,i,n);t?f.opacity=[{test:t,...Mq(p??1)},Mq(s.legend.unselectedOpacity)]:p&&(f.opacity=Mq(p))}return f={...f,...t},yR(f)?void 0:f},gradient:function(t,{model:n,legendType:e,legendCmpt:r}){if("gradient"!==e)return;const{config:i,markDef:o,encoding:a}=n;let u={};const s=void 0===(r.get("gradientOpacity")??i.legend.gradientOpacity)?GK(a.opacity)||o.opacity:void 0;return s&&(u.opacity=Mq(s)),u={...u,...t},yR(u)?void 0:u},labels:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i}){const o=e.legend(r)||{},a=e.config,u=YH(n)?XK(0,i,n):void 0,s=u?[{test:u,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:c,formatType:l}=o;let f;bH(l)?f=kH({fieldOrDatumDef:n,field:"datum.value",format:c,formatType:l,config:a}):void 0===c&&void 0===l&&a.customFormatTypes&&("quantitative"===n.type&&a.numberFormatType?f=kH({fieldOrDatumDef:n,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===n.type&&a.timeFormatType&&YH(n)&&void 0===n.timeUnit&&(f=kH({fieldOrDatumDef:n,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...s?{opacity:s}:{},...f?{text:f}:{},...t};return yR(d)?void 0:d},entries:function(t,{legendCmpt:n}){const e=n.get("selections");return e?.length?{...t,fill:{value:"transparent"}}:t}};function GK(t){return VK(t,((t,n)=>Math.max(t,n.value)))}function YK(t){return VK(t,((t,n)=>TR(t,n.value)))}function VK(t,n){return function(t){const n=t?.condition;return!!n&&(S(n)||nG(n))}(t)?Q(t.condition).reduce(n,t.value):nG(t)?t.value:void 0}function XK(t,n,e){const r=n.get("selections");if(!r?.length)return;const i=Nt(e.field);return r.map((t=>`(!length(data(${Nt(kR(t)+HJ)})) || (${t}[${i}] && indexof(${t}[${i}], datum.value) >= 0))`)).join(" || ")}const JK={direction:({direction:t})=>t,format:({fieldOrDatumDef:t,legend:n,config:e})=>{const{format:r,formatType:i}=n;return MH(t,t.type,r,i,e,!1)},formatType:({legend:t,fieldOrDatumDef:n,scaleType:e})=>{const{formatType:r}=t;return AH(r,n,e)},gradientLength:t=>{const{legend:n,legendConfig:e}=t;return n.gradientLength??e.gradientLength??function({legendConfig:t,model:n,direction:e,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:u,gradientVerticalMinLength:s}=t;if(xW(i))return"horizontal"===e?"top"===r||"bottom"===r?QK(n,"width",a,o):a:QK(n,"height",s,u)}(t)},labelOverlap:({legend:t,legendConfig:n,scaleType:e})=>t.labelOverlap??n.labelOverlap??function(t){if(sR(["quantile","threshold","log","symlog"],t))return"greedy"}(e),symbolType:({legend:t,markDef:n,channel:e,encoding:r})=>t.symbolType??function(t,n,e,r){if("shape"!==n){const t=YK(e)??r;if(t)return t}switch(t){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"}}(n.type,e,r.shape,n.shape),title:({fieldOrDatumDef:t,config:n})=>dG(t,n,{allowDisabling:!0}),type:({legendType:t,scaleType:n,channel:e})=>{if(PL(e)&&xW(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:({fieldOrDatumDef:t,legend:n})=>function(t,n){const e=t.values;return S(e)?AG(n,e):pq(e)?e:void 0}(n,t)};function KK({legendConfig:t,legendType:n,orient:e,legend:r}){return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(t,n){switch(t){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===n?"horizontal":void 0}}(e,n)}function QK(t,n,e,r){return{signal:`clamp(${t.getSizeSignalRef(n).signal}, ${e}, ${r})`}}function ZK(t){const n=DZ(t)?function(t){const{encoding:n}=t,e={};for(const r of[fL,...wY]){const i=vG(n[r]);i&&t.getScaleComponent(r)&&(r===mL&&YH(i)&&i.type===rW||(e[r]=nQ(t,r)))}return e}(t):function(t){const{legends:n,resolve:e}=t.component;for(const r of t.children){ZK(r);for(const i of bR(r.component.legends))e.legend[i]=qK(t.component.resolve,i),"shared"===e.legend[i]&&(n[i]=eQ(n[i],r.component.legends[i]),n[i]||(e.legend[i]="independent",delete n[i]))}for(const r of bR(n))for(const n of t.children)n.component.legends[r]&&"shared"===e.legend[r]&&delete n.component.legends[r];return n}(t);return t.component.legends=n,n}function tQ(t,n,e,r){switch(n){case"disable":return void 0!==e;case"values":return!!e?.values;case"title":if("title"===n&&t===r?.title)return!0}return t===(e||{})[n]}function nQ(t,n){let e=t.legend(n);const{markDef:r,encoding:i,config:o}=t,a=o.legend,u=new WK({},function(t,n){const e=t.scaleName(n);if("trail"===t.mark){if("color"===n)return{stroke:e};if("size"===n)return{strokeWidth:e}}return"color"===n?t.markDef.filled?{fill:e}:{stroke:e}:{[n]:e}}(t,n));!function(t,n,e){const r=t.fieldDef(n)?.field;for(const i of wR(t.component.selection??{})){const t=i.project.hasField[r]??i.project.hasChannel[n];if(t&&TJ.defined(i)){const n=e.get("selections")??[];n.push(i.name),e.set("selections",n,!1),t.hasLegend=!0}}}(t,n,u);const s=void 0!==e?!e:a.disable;if(u.set("disable",s,void 0!==e),s)return u;e=e||{};const c=t.getScaleComponent(n).get("type"),l=vG(i[n]),f=YH(l)?BU(l.timeUnit)?.unit:void 0,d=e.orient||o.legend.orient||"right",h=function(t){const{legend:n}=t;return TR(n.type,function({channel:t,timeUnit:n,scaleType:e}){if(PL(t)){if(sR(["quarter","month","day"],n))return"symbol";if(xW(e))return"gradient"}return"symbol"}(t))}({legend:e,channel:n,timeUnit:f,scaleType:c}),m={legend:e,channel:n,model:t,markDef:r,encoding:i,fieldOrDatumDef:l,legendConfig:a,config:o,scaleType:c,orient:d,legendType:h,direction:KK({legend:e,legendType:h,orient:d,legendConfig:a})};for(const r of UK){if("gradient"===h&&r.startsWith("symbol")||"symbol"===h&&r.startsWith("gradient"))continue;const i=r in JK?JK[r](m):e[r];if(void 0!==i){const a=tQ(i,r,e,t.fieldDef(n));(a||void 0===o.legend[r])&&u.set(r,i,a)}}const p=e?.encoding??{},g=u.get("selections"),v={},y={fieldOrDatumDef:l,model:t,channel:n,legendCmpt:u,legendType:h};for(const n of["labels","legend","title","symbols","gradient","entries"]){const e=LK(p[n]??{},t),r=n in HK?HK[n](e,y):e;void 0===r||yR(r)||(v[n]={...g?.length&&YH(l)?{name:`${kR(l.field)}_legend_${n}`}:{},...g?.length?{interactive:!0}:{},update:g?.length?{...r,cursor:{value:"pointer"}}:r})}return yR(v)||u.set("encode",v,!!e?.encoding),u}function eQ(t,n){if(!t)return n.clone();const e=t.getWithExplicit("orient"),r=n.getWithExplicit("orient");if(e.explicit&&r.explicit&&e.value!==r.value)return;let i=!1;for(const e of UK){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"legend",((t,n)=>{switch(e){case"symbolType":return r=t,"circle"===(o=n).value?o:r;case"title":return Pq(t,n);case"type":return i=!0,tX("symbol")}var r,o;return eX(t,n,e,"legend")}));t.setWithExplicit(e,r)}return i&&(t.implicit?.encode?.gradient&&AR(t.implicit,["encode","gradient"]),t.explicit?.encode?.gradient&&AR(t.explicit,["encode","gradient"])),t}function rQ(t){const n=t.component.legends,e={};for(const r of bR(n)){const i=HR(t.getScaleComponent(r).get("domains"));if(e[i])for(const t of e[i])eQ(t,n[r])||e[i].push(n[r]);else e[i]=[n[r].clone()]}const r=wR(e).flat().map((n=>function(t,n){const{disable:e,labelExpr:r,selections:i,...o}=t.combine();if(!e){if(!1===n.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const t=o.encode.symbols.update;!t.fill||"transparent"===t.fill.value||t.stroke||o.stroke||(t.stroke={value:"transparent"});for(const n of wY)o[n]&&delete t[n]}if(o.title||delete o.title,void 0!==r){let t=r;o.encode?.labels?.update&&pq(o.encode.labels.update.text)&&(t=_R(r,"datum.label",o.encode.labels.update.text.signal)),function(t,n,e,r){t.encode??={},t.encode[n]??={},t.encode[n].update??={},t.encode[n].update.text=r}(o,"labels",0,{signal:t})}return o}}(n,t.config))).filter((t=>void 0!==t));return r}function iQ(t){const n=t.component.projection;if(!n||n.merged)return[];const e=n.combine(),{name:r}=e;if(n.data){const i={signal:`[${n.size.map((t=>t.signal)).join(", ")}]`},o=n.data.reduce(((n,e)=>{const r=pq(e)?e.signal:`data('${t.lookupDataSource(e)}')`;return sR(n,r)||n.push(r),n}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...e}]}return[{name:r,translate:{signal:"[width / 2, height / 2]"},...e}]}const oQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class aQ extends QV{specifiedProjection;size;data;merged=!1;constructor(t,n,e,r){super({...n},{name:t}),this.specifiedProjection=n,this.size=e,this.data=r}get isFit(){return!!this.data}}function uQ(t){t.component.projection=DZ(t)?function(t){if(t.hasProjection){const n=dq(t.specifiedProjection),e=!(n&&(null!=n.scale||null!=n.translate)),r=e?[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]:void 0,i=e?function(t){const n=[],{encoding:e}=t;for(const r of[[uL,aL],[cL,sL]])(vG(e[r[0]])||vG(e[r[1]]))&&n.push({signal:t.getName(`geojson_${n.length}`)});return t.channelHasField(mL)&&t.typedFieldDef(mL).type===rW&&n.push({signal:t.getName(`geojson_${n.length}`)}),0===n.length&&n.push(t.requestDataName(dX.Main)),n}(t):void 0,o=new aQ(t.projectionName(!0),{...dq(t.config.projection),...n},r,i);return o.get("type")||o.set("type","equalEarth",!1),o}}(t):function(t){if(0===t.children.length)return;let n;for(const n of t.children)uQ(n);const e=lR(t.children,(t=>{const e=t.component.projection;if(e){if(n){const t=function(t,n){const e=lR(oQ,(e=>!ft(t.explicit,e)&&!ft(n.explicit,e)||!!(ft(t.explicit,e)&&ft(n.explicit,e)&&WR(t.get(e),n.get(e)))));if(WR(t.size,n.size)){if(e)return t;if(WR(t.explicit,{}))return n;if(WR(n.explicit,{}))return t}return null}(n,e);return t&&(n=t),!!t}return n=e,!0}return!0}));if(n&&e){const e=t.projectionName(!0),r=new aQ(e,n.specifiedProjection,n.size,eR(n.data));for(const n of t.children){const t=n.component.projection;t&&(t.isFit&&r.data.push(...n.component.projection.data),n.renameProjection(t.get("name"),e),t.merged=!0)}return r}}(t)}function sQ(t,n,e,r){if(DG(n,e)){const i=DZ(t)?t.axis(e)??t.legend(e)??{}:{},o=uG(n,{expr:"datum"}),a=uG(n,{expr:"datum",binSuffix:"end"});return{formulaAs:uG(n,{binSuffix:"range",forAs:!0}),formula:EH(o,a,i.format,i.formatType,r)}}return{}}function cQ(t,n){return`${oq(t)}_${n}`}function lQ(t,n,e){const r=cQ(xG(e,void 0)??{},n);return t.getName(`${r}_bins`)}function fQ(t,n,e){let r,i;r=function(t){return"as"in t}(t)?$t(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[uG(t,{forAs:!0}),uG(t,{binSuffix:"end",forAs:!0})];const o={...xG(n,void 0)},a=cQ(o,t.field),{signal:u,extentSignal:s}=function(t,n){return{signal:t.getName(`${n}_bins`),extentSignal:t.getName(`${n}_extent`)}}(e,a);if(cq(o.extent)){const t=o.extent;i=oK(e,t.param,t),delete o.extent}return{key:a,binComponent:{bin:o,field:t.field,as:[r],...u?{signal:u}:{},...s?{extentSignal:s}:{},...i?{span:i}:{}}}}class dQ extends mX{bins;clone(){return new dQ(null,eR(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{if(tG(e)&&aq(e.bin)){const{key:i,binComponent:o}=fQ(e,e.bin,n);t[i]={...o,...t[i],...sQ(n,e,r,n.config)}}return t}),{});return yR(e)?null:new dQ(t,e)}static makeFromTransform(t,n,e){const{key:r,binComponent:i}=fQ(n,n.bin,e);return new dQ(t,{[r]:i})}merge(t,n){for(const e of bR(t.bins))e in this.bins?(n(t.bins[e].signal,this.bins[e].signal),this.bins[e].as=hR([...this.bins[e].as,...t.bins[e].as],aR)):this.bins[e]=t.bins[e];for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}producedFields(){return new Set(wR(this.bins).map((t=>t.as)).flat(2))}dependentFields(){return new Set(wR(this.bins).map((t=>t.field)))}hash(){return`Bin ${aR(this.bins)}`}assemble(){return wR(this.bins).flatMap((t=>{const n=[],[e,...r]=t.as,{extent:i,...o}=t.bin,a={type:"bin",field:OR(t.field),as:e,signal:t.signal,...cq(i)?{extent:null}:{extent:i},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!i&&t.extentSignal&&(n.push({type:"extent",field:OR(t.field),signal:t.extentSignal}),a.extent={signal:t.extentSignal}),n.push(a);for(const t of r)for(let r=0;r<2;r++)n.push({type:"formula",expr:uG({field:e[r]},{expr:"datum"}),as:t[r]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n}))}}class hQ extends mX{dimensions;measures;clone(){return new hQ(null,new Set(this.dimensions),eR(this.measures))}constructor(t,n,e){super(t),this.dimensions=n,this.measures=e}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let e=!1;n.forEachFieldDef((t=>{t.aggregate&&(e=!0)}));const r={},i=new Set;return e?(n.forEachFieldDef(((t,e)=>{const{aggregate:o,field:a}=t;if(o)if("count"===o)r["*"]??={},r["*"].count=new Set([uG(t,{forAs:!0})]);else{if(QI(o)||ZI(o)){const t=QI(o)?"argmin":"argmax",n=o[t];r[n]??={},r[n][t]=new Set([uG({op:t,field:n},{forAs:!0})])}else r[a]??={},r[a][o]=new Set([uG(t,{forAs:!0})]);HI(e)&&"unaggregated"===n.scaleDomain(e)&&(r[a]??={},r[a].min=new Set([uG({field:a,aggregate:"min"},{forAs:!0})]),r[a].max=new Set([uG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(t,n,e,r){const i=DZ(r)?r.encoding[nI(n)]:void 0;if(tG(e)&&DZ(r)&&qH(e,i,r.markDef,r.config)){t.add(uG(e,{})),t.add(uG(e,{suffix:"end"}));const{mark:i,markDef:o,config:a}=r,u=LH({fieldDef:e,markDef:o,config:a});JW(i)&&.5!==u&&AI(n)&&(t.add(uG(e,{suffix:bX})),t.add(uG(e,{suffix:wX}))),e.bin&&DG(e,n)&&t.add(uG(e,{binSuffix:"range"}))}else if(zL(n)){const e=_L(n);t.add(r.getName(e))}else t.add(uG(e));eG(e)&&function(t){return F(t)&&"field"in t}(e.scale?.range)&&t.add(e.scale.range.field)}(i,e,t,n)})),i.size+bR(r).length===0?null:new hQ(t,i,r)):null}static makeFromTransform(t,n){const e=new Set,r={};for(const t of n.aggregate){const{op:n,field:e,as:i}=t;n&&("count"===n?(r["*"]??={},r["*"].count=new Set([i||uG(t,{forAs:!0})])):(r[e]??={},r[e][n]??=new Set,r[e][n].add(i||uG(t,{forAs:!0}))))}for(const t of n.groupby??[])e.add(t);return e.size+bR(r).length===0?null:new hQ(t,e,r)}merge(t){return mR(this.dimensions,t.dimensions)?(function(t,n){for(const e of bR(n)){const r=n[e];for(const n of bR(r))e in t?t[e][n]=new Set([...t[e][n]??[],...r[n]]):t[e]={[n]:r[n]}}}(this.measures,t.measures),!0):(pU.debug("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...bR(this.measures)])}producedFields(){const t=new Set;for(const n of bR(this.measures))for(const e of bR(this.measures[n])){const r=this.measures[n][e];0===r.size?t.add(`${e}_${n}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${aR({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],e=[];for(const r of bR(this.measures))for(const i of bR(this.measures[r]))for(const o of this.measures[r][i])e.push(o),t.push(i),n.push("*"===r?null:OR(r));return{type:"aggregate",groupby:[...this.dimensions].map(OR),ops:t,fields:n,as:e}}}class mQ extends mX{model;name;data;column;row;facet;childModel;constructor(t,n,e,r){super(t),this.model=n,this.name=e,this.data=r;for(const t of RL){const e=n.facet[t];if(e){const{bin:r,sort:i}=e;this[t]={name:n.getName(`${t}_domain`),fields:[uG(e),...aq(r)?[uG(e,{binSuffix:"end"})]:[]],..._H(i)?{sortField:i}:S(i)?{sortIndexField:bK(e,t)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of RL)this[n]&&(t+=` ${n.charAt(0)}:${aR(this[n])}`);return t}get fields(){const t=[];for(const n of RL)this[n]?.fields&&t.push(...this[n].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of RL)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of MI){const e=this.childModel.component.scales[n];if(e&&!e.merged){const r=e.get("type"),i=e.get("range");if(bW(r)&&gq(i)){const e=rZ(iZ(this.childModel,n));e?t[n]=e:vU(qq(n))}}}return t}assembleRowColumnHeaderData(t,n,e){const r={row:"y",column:"x",facet:void 0}[t],i=[],o=[],a=[];r&&e&&e[r]&&(n?(i.push(`distinct_${e[r]}`),o.push("max")):(i.push(e[r]),o.push("distinct")),a.push(`distinct_${e[r]}`));const{sortField:u,sortIndexField:s}=this[t];if(u){const{op:t=NH,field:n}=u;i.push(n),o.push(t),a.push(uG(u,{forAs:!0}))}else s&&(i.push(s),o.push("max"),a.push(s));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...i.length?{fields:i,ops:o,as:a}:{}}]}}assembleFacetHeaderData(t){const{columns:n}=this.model.layout,{layoutHeaders:e}=this.model.component,r=[],i={};for(const t of kK){for(const n of MK){const r=e[t]?.[n]??[];for(const n of r)if(n.axes?.length>0){i[t]=!0;break}}if(i[t]){const e=`length(data("${this.facet.name}"))`;r.push({name:`${this.facet.name}_${t}`,transform:[{type:"sequence",start:0,stop:"row"===t?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e}}]})}}const{row:o,column:a}=i;return(o||a)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,t)),r}assemble(){const t=[];let n=null;const e=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:o}=this;if(r&&i&&(e.x||e.y)){n=`cross_${this.column.name}_${this.row.name}`;const r=[].concat(e.x??[],e.y??[]),i=r.map((()=>"distinct"));t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:r,ops:i}]})}for(const r of[VR,YR])this[r]&&t.push(this.assembleRowColumnHeaderData(r,n,e));if(o){const n=this.assembleFacetHeaderData(e);n&&t.push(...n)}return t}}function pQ(t){return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function gQ(t){const n={};return tR(t.filter,(t=>{if(GU(t)){let e=null;RU(t)?e=$q(t.equal):IU(t)?e=$q(t.lte):LU(t)?e=$q(t.lt):qU(t)?e=$q(t.gt):UU(t)?e=$q(t.gte):WU(t)?e=t.range[0]:HU(t)&&(e=(t.oneOf??t.in)[0]),e&&(yU(e)?n[t.field]="date":wt(e)?n[t.field]="number":$t(e)&&(n[t.field]="string")),t.timeUnit&&(n[t.field]="date")}})),n}class vQ extends mX{_parse;clone(){return new vQ(null,eR(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${aR(this._parse)}`}static makeExplicit(t,n,e){let r={};const i=n.data;return!sX(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(t,r,{},e)}static makeWithAncestors(t,n,e,r){for(const t of bR(e)){const n=r.getWithExplicit(t);void 0!==n.value&&(n.explicit||n.value===e[t]||"derived"===n.value||"flatten"===e[t]?delete e[t]:vU(Vq(t,e[t],n.value)))}for(const t of bR(n)){const e=r.get(t);void 0!==e&&(e===n[t]?delete n[t]:vU(Vq(t,n[t],e)))}const i=new QV(n,e);r.copyAll(i);const o={};for(const t of bR(i.combine())){const n=i.get(t);null!==n&&(o[t]=n)}return 0===bR(o).length||r.parseNothing?null:new vQ(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of bR(this._parse)){const e=this._parse[n];1===BR(n)&&(t[n]=e)}return t}producedFields(){return new Set(bR(this._parse))}dependentFields(){return new Set(bR(this._parse))}assembleTransforms(t=!1){return bR(this._parse).filter((n=>!t||BR(n)>1)).map((t=>{const n=function(t,n){const e=SR(t);return"number"===n?`toNumber(${e})`:"boolean"===n?`toBoolean(${e})`:"string"===n?`toString(${e})`:"date"===n?`toDate(${e})`:"flatten"===n?e:n.startsWith("date:")?`timeParse(${e},'${pQ(n.slice(5,n.length))}')`:n.startsWith("utc:")?`utcParse(${e},'${pQ(n.slice(4,n.length))}')`:(vU(`Unrecognized parse "${n}".`),null)}(t,this._parse[t]);return n?{type:"formula",expr:n,as:zR(t)}:null})).filter((t=>null!==t))}}class yQ extends mX{clone(){return new yQ(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([xY])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:xY}}}class bQ extends mX{params;clone(){return new bQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${aR(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class wQ extends mX{params;clone(){return new wQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${aR(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class xQ extends mX{_data;_name;_generator;constructor(t){let n;if(super(null),t??={name:"source"},sX(t)||(n=t.format?{...oR(t.format,["parse"])}:{}),aX(t))this._data={values:t.values};else if(oX(t)){if(this._data={url:t.url},!n.type){let e=/(?:\.([^.]+))?$/.exec(t.url)[1];sR(["json","csv","tsv","dsv","topojson"],e)||(e="json"),n.type=e}}else lX(t)?this._data={values:[{type:"Sphere"}]}:(uX(t)||sX(t))&&(this._data={});this._generator=sX(t),t.name&&(this._name=t.name),n&&!yR(n)&&(this._data.format=n)}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(t){this._name=t}set parent(t){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 $Q(t){return t instanceof xQ||t instanceof bQ||t instanceof wQ}class kQ{#t;constructor(){this.#t=!1}setModified(){this.#t=!0}get modifiedFlag(){return this.#t}}class MQ extends kQ{getNodeDepths(t,n,e){e.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,e);return e}optimize(t){const n=[...this.getNodeDepths(t,0,new Map).entries()].sort(((t,n)=>n[1]-t[1]));for(const t of n)this.run(t[0]);return this.modifiedFlag}}class AQ extends kQ{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class DQ extends AQ{mergeNodes(t,n){const e=n.shift();for(const r of n)t.removeChild(r),r.parent=e,r.remove()}run(t){const n=t.children.map((t=>t.hash())),e={};for(let r=0;r<n.length;r++)void 0===e[n[r]]?e[n[r]]=[t.children[r]]:e[n[r]].push(t.children[r]);for(const n of bR(e))e[n].length>1&&(this.setModified(),this.mergeNodes(t,e[n]))}}class SQ extends AQ{requiresSelectionId;constructor(t){super(),this.requiresSelectionId=t&&KJ(t)}run(t){t instanceof yQ&&(this.requiresSelectionId&&($Q(t.parent)||t.parent instanceof hQ||t.parent instanceof vQ)||(this.setModified(),t.remove()))}}class FQ extends kQ{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let e=new Set;t instanceof yX&&(e=t.producedFields(),pR(e,n)&&(this.setModified(),t.removeFormulas(n),0===t.producedFields.length&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...e]))}}class EQ extends AQ{constructor(){super()}run(t){t instanceof pX&&!t.isRequired()&&(this.setModified(),t.remove())}}class NQ extends MQ{run(t){if(!($Q(t)||t.numChildren()>1))for(const n of t.children)if(n instanceof vQ)if(t instanceof vQ)this.setModified(),t.merge(n);else{if(vR(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}class CQ extends MQ{run(t){const n=[...t.children],e=t.children.filter((t=>t instanceof vQ));if(t.numChildren()>1&&e.length>=1){const r={},i=new Set;for(const t of e){const n=t.parse;for(const t of bR(n))t in r?r[t]!==n[t]&&i.add(t):r[t]=n[t]}for(const t of i)delete r[t];if(!yR(r)){this.setModified();const e=new vQ(t,r);for(const i of n){if(i instanceof vQ)for(const t of bR(r))delete i.parse[t];t.removeChild(i),i.parent=e,i instanceof vQ&&0===bR(i.parse).length&&i.remove()}}}}}class OQ extends MQ{run(t){t instanceof pX||t.numChildren()>0||t instanceof mQ||t instanceof xQ||(this.setModified(),t.remove())}}class _Q extends MQ{run(t){const n=t.children.filter((t=>t instanceof yX)),e=n.pop();for(const t of n)this.setModified(),e.merge(t)}}class zQ extends MQ{run(t){const n=t.children.filter((t=>t instanceof hQ)),e={};for(const t of n){const n=aR(t.groupBy);n in e||(e[n]=[]),e[n].push(t)}for(const n of bR(e)){const r=e[n];if(r.length>1){const n=r.pop();for(const e of r)n.merge(e)&&(t.removeChild(e),e.parent=n,e.remove(),this.setModified())}}}}class BQ extends MQ{model;constructor(t){super(),this.model=t}run(t){const n=!($Q(t)||t instanceof rK||t instanceof vQ||t instanceof yQ),e=[],r=[];for(const i of t.children)i instanceof dQ&&(n&&!vR(t.producedFields(),i.dependentFields())?e.push(i):r.push(i));if(e.length>0){const n=e.pop();for(const t of e)n.merge(t,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof dQ?t.merge(n,this.model.renameSignal.bind(this.model)):n.swapWithParent()}if(r.length>1){const t=r.pop();for(const n of r)t.merge(n,this.model.renameSignal.bind(this.model));this.setModified()}}}class TQ extends MQ{run(t){const n=[...t.children];if(!cR(n,(t=>t instanceof pX))||t.numChildren()<=1)return;const e=[];let r;for(const i of n)if(i instanceof pX){let n=i;for(;1===n.numChildren();){const[t]=n.children;if(!(t instanceof pX))break;n=t}e.push(...n.children),r?(t.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setModified()):r=n}else e.push(i);if(e.length){this.setModified();for(const t of e)t.parent.removeChild(t),t.parent=r}}}class PQ extends mX{transform;clone(){return new PQ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=hR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??uG(t)}hash(){return`JoinAggregateTransform ${aR(this.transform)}`}assemble(){const t=[],n=[],e=[];for(const r of this.transform.joinaggregate)n.push(r.op),e.push(this.getDefaultName(r)),t.push(void 0===r.field?null:r.field);const r=this.transform.groupby;return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==r?{groupby:r}:{}}}}class jQ extends mX{filter;clone(){return new jQ(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,e){const{config:r,markDef:i}=n,{marks:o,scales:a}=e;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const u=n.reduceFieldDef(((t,e,o)=>{const a=HI(o)&&n.getScaleComponent(o);if(a){const n=a.get("type"),{aggregate:u}=e,s=lH({scaleChannel:o,markDef:i,config:r,scaleType:n,isCountAggregate:eq(u)});"show"!==s&&"always-valid"!==s&&(t[e.field]=e)}return t}),{});return bR(u).length?new jQ(t,u):null}dependentFields(){return new Set(bR(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${aR(this.filter)}`}assemble(){const t=bR(this.filter).reduce(((t,n)=>{const e=this.filter[n],r=uG(e,{expr:"datum"});return null!==e&&("temporal"===e.type?t.push(`(isDate(${r}) || (${RQ(r)}))`):"quantitative"===e.type&&t.push(RQ(r))),t}),[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function RQ(t){return`isValid(${t}) && isFinite(+${t})`}class LQ extends mX{_stack;clone(){return new LQ(null,eR(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:e,groupby:r,as:i,offset:o="zero"}=n,a=[],u=[];if(void 0!==n.sort)for(const t of n.sort)a.push(t.field),u.push(TR(t.order,"ascending"));const s={field:a,order:u};let c;return c=function(t){return S(t)&&t.every((t=>$t(t)))&&t.length>1}(i)?i:$t(i)?[i,`${i}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new LQ(t,{dimensionFieldDefs:[],stackField:e,groupby:r,offset:o,sort:s,facetby:[],as:c})}static makeFromEncoding(t,n){const e=n.stack,{encoding:r}=n;if(!e)return null;const{groupbyChannels:i,fieldChannel:o,offset:a,impute:u}=e,s=i.map((t=>gG(r[t]))).filter((t=>!!t)),c=function(t){return t.stack.stackBy.reduce(((t,n)=>{const e=uG(n.fieldDef);return e&&t.push(e),t}),[])}(n),l=n.encoding.order;let f;if(S(l)||YH(l))f=zq(l);else{const t=UH(l)?l.sort:"y"===o?"descending":"ascending";f=c.reduce(((n,e)=>(n.field.includes(e)||(n.field.push(e),n.order.push(t)),n)),{field:[],order:[]})}return new LQ(t,{dimensionFieldDefs:s,stackField:n.vgField(o),facetby:[],stackby:c,sort:f,offset:a,impute:u,as:[n.vgField(o,{suffix:"start",forAs:!0}),n.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${aR(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:e}=this._stack;return t.length>0?t.map((t=>t.bin?n?[uG(t,{binSuffix:"mid"})]:[uG(t,{}),uG(t,{binSuffix:"end"})]:[uG(t)])).flat():e??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:e,stackField:r,stackby:i,sort:o,offset:a,impute:u,as:s}=this._stack;if(u)for(const o of e){const{bandPosition:e=.5,bin:a}=o;if(a){const n=uG(o,{expr:"datum"}),r=uG(o,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${RQ(n)} ? ${e}*${n}+${1-e}*${r} : ${n}`,as:uG(o,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:r,groupby:[...i,...n],key:uG(o,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:r,sort:o,as:s,offset:a}),t}}class IQ extends mX{transform;clone(){return new IQ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=hR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach((n=>t.add(n.field))),this.transform.window.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??uG(t)}hash(){return`WindowTransform ${aR(this.transform)}`}assemble(){const t=[],n=[],e=[],r=[];for(const i of this.transform.window)n.push(i.op),e.push(this.getDefaultName(i)),r.push(void 0===i.param?null:i.param),t.push(void 0===i.field?null:i.field);const i=this.transform.frame,o=this.transform.groupby;if(i&&null===i[0]&&null===i[1]&&n.every((t=>tq(t))))return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==o?{groupby:o}:{}};const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(t.order??"ascending");const s=this.transform.ignorePeers;return{type:"window",params:r,as:e,ops:n,fields:t,sort:{field:a,order:u},...void 0!==s?{ignorePeers:s}:{},...void 0!==o?{groupby:o}:{},...void 0!==i?{frame:i}:{}}}}function qQ(t){if(t instanceof mQ)if(1!==t.numChildren()||t.children[0]instanceof pX){const e=t.model.component.data.main;UQ(e);const r=(n=t,function t(e){if(!(e instanceof mQ)){const r=e.clone();if(r instanceof pX){const t=WQ+r.getSource();r.setSource(t),n.model.component.data.outputNodes[t]=r}else(r instanceof hQ||r instanceof LQ||r instanceof IQ||r instanceof PQ)&&r.addDimensions(n.fields);for(const n of e.children.flatMap(t))n.parent=r;return[r]}return e.children.flatMap(t)}),i=t.children.map(r).flat();for(const t of i)t.parent=e}else{const n=t.children[0];(n instanceof hQ||n instanceof LQ||n instanceof IQ||n instanceof PQ)&&n.addDimensions(t.fields),n.swapWithParent(),qQ(t)}else t.children.map(qQ);var n}function UQ(t){if(t instanceof pX&&t.type===dX.Main&&1===t.numChildren()){const n=t.children[0];n instanceof mQ||(n.swapWithParent(),UQ(t))}}const WQ="scale_";function HQ(t){for(const n of t){for(const t of n.children)if(t.parent!==n)return!1;if(!HQ(n.children))return!1}return!0}function GQ(t,n){let e=!1;for(const r of n)e=t.optimize(r)||e;return e}function YQ(t,n,e){let r=t.sources,i=!1;return i=GQ(new EQ,r)||i,i=GQ(new SQ(n),r)||i,r=r.filter((t=>t.numChildren()>0)),i=GQ(new OQ,r)||i,r=r.filter((t=>t.numChildren()>0)),e||(i=GQ(new NQ,r)||i,i=GQ(new BQ(n),r)||i,i=GQ(new FQ,r)||i,i=GQ(new CQ,r)||i,i=GQ(new zQ,r)||i,i=GQ(new _Q,r)||i,i=GQ(new DQ,r)||i,i=GQ(new TQ,r)||i),t.sources=r,i}class VQ{constructor(t){Object.defineProperty(this,"signal",{enumerable:!0,get:t})}signal;static fromName(t,n){return new VQ((()=>t(n)))}}function XQ(t){DZ(t)?function(t){const n=t.component.scales;for(const e of bR(n)){const r=JQ(t,e);if(n[e].setWithExplicit("domains",r),tZ(t,e),t.component.data.isFaceted){let n=t;for(;!SZ(n)&&n.parent;)n=n.parent;if("shared"===n.component.resolve.scale[e])for(const t of r.value)vq(t)&&(t.data=WQ+t.data.replace(WQ,""))}}}(t):function(t){for(const n of t.children)XQ(n);const n=t.component.scales;for(const e of bR(n)){let r,i=null;for(const n of t.children){const t=n.component.scales[e];if(t){r=void 0===r?t.getWithExplicit("domains"):rX(r,t.getWithExplicit("domains"),"domains","scale",eZ);const n=t.get("selectionExtent");i&&n&&i.param!==n.param&&vU("The same selection must be used to override scale domains in a layered view."),i=n}}n[e].setWithExplicit("domains",r),i&&n[e].set("selectionExtent",i,!0)}}(t)}function JQ(t,n){const e=t.getScaleComponent(n).get("type"),{encoding:r}=t,i=function(t,n,e,r){if("unaggregated"===t){const{valid:t,reason:r}=nZ(n,e);if(!t)return void vU(r)}else if(void 0===t&&r.useUnaggregatedDomain){const{valid:t}=nZ(n,e);if(t)return"unaggregated"}return t}(t.scaleDomain(n),t.typedFieldDef(n),e,t.config.scale);return i!==t.scaleDomain(n)&&(t.specifiedScales[n]={...t.specifiedScales[n],domain:i}),"x"===n&&vG(r.x2)?vG(r.x)?rX(QQ(e,i,t,"x"),QQ(e,i,t,"x2"),"domain","scale",eZ):QQ(e,i,t,"x2"):"y"===n&&vG(r.y2)?vG(r.y)?rX(QQ(e,i,t,"y"),QQ(e,i,t,"y2"),"domain","scale",eZ):QQ(e,i,t,"y2"):QQ(e,i,t,n)}function KQ(t,n,e){const r=BU(e)?.unit;return"temporal"===n||r?function(t,n,e){return t.map((t=>({signal:`{data: ${MG(t,{timeUnit:e,type:n})}}`})))}(t,n,r):[t]}function QQ(t,n,e,r){const{encoding:i,markDef:o,mark:a,config:u,stack:s}=e,c=vG(i[r]),{type:l}=c,f=c.timeUnit,d=function(t){const{marks:n,scales:e}=hX(t);return n===e?dX.Main:"include-invalid-values"===e?dX.PreFilterInvalid:dX.PostFilterInvalid}({invalid:Cq("invalid",o,u),isPath:XW(a)});if(function(t){return GR(t,"unionWith")}(n)){const i=QQ(t,void 0,e,r);return ZV([...KQ(n.unionWith,l,f),...i.value])}if(pq(n))return ZV([n]);if(n&&"unaggregated"!==n&&!kW(n))return ZV(KQ(n,l,f));if(s&&r===s.fieldChannel){if("normalize"===s.offset)return tX([[0,1]]);const t=e.requestDataName(d);return tX([{data:t,field:e.vgField(r,{suffix:"start"})},{data:t,field:e.vgField(r,{suffix:"end"})}])}const h=HI(r)&&YH(c)?function(t,n,e){if(!bW(e))return;const r=t.fieldDef(n),i=r.sort;if(zH(i))return{op:"min",field:bK(r,n),order:"ascending"};const{stack:o}=t,a=o?new Set([...o.groupbyFields,...o.stackBy.map((t=>t.fieldDef.field))]):void 0;if(_H(i))return ZQ(i,o&&!a.has(i.field));if(function(t){return GR(t,"encoding")}(i)){const{encoding:n,order:e}=i,r=t.fieldDef(n),{aggregate:u,field:s}=r,c=o&&!a.has(s);if(QI(u)||ZI(u))return ZQ({field:uG(r),order:e},c);if(tq(u)||!u)return ZQ({op:u,field:s,order:e},c)}else{if("descending"===i)return{op:"min",field:t.vgField(n),order:"descending"};if(sR(["ascending",void 0],i))return!0}}(e,r,t):void 0;if(XH(c))return tX(KQ([c.datum],l,f));const m=c;if("unaggregated"===n){const{field:t}=c;return tX([{data:e.requestDataName(d),field:uG({field:t,aggregate:"min"})},{data:e.requestDataName(d),field:uG({field:t,aggregate:"max"})}])}if(aq(m.bin)){if(bW(t))return tX("bin-ordinal"===t?[]:[{data:$R(h)?e.requestDataName(d):e.requestDataName(dX.Raw),field:e.vgField(r,DG(m,r)?{binSuffix:"range"}:{}),sort:!0!==h&&F(h)?h:{field:e.vgField(r,{}),op:"min"}}]);{const{bin:t}=m;if(aq(t)){const n=lQ(e,m.field,t);return tX([new VQ((()=>{const t=e.getSignalName(n);return`[${t}.start, ${t}.stop]`}))])}return tX([{data:e.requestDataName(d),field:e.vgField(r,{})}])}}if(m.timeUnit&&sR(["time","utc"],t)){const t=i[nI(r)];if(qH(m,t,o,u)){const n=e.requestDataName(d),i=LH({fieldDef:m,fieldDef2:t,markDef:o,config:u}),s=JW(a)&&.5!==i&&AI(r);return tX([{data:n,field:e.vgField(r,s?{suffix:bX}:{})},{data:n,field:e.vgField(r,{suffix:s?wX:"end"})}])}}return tX(h?[{data:$R(h)?e.requestDataName(d):e.requestDataName(dX.Raw),field:e.vgField(r),sort:h}]:[{data:e.requestDataName(d),field:e.vgField(r)}])}function ZQ(t,n){const{op:e,field:r,order:i}=t;return{op:e??(n?"sum":NH),...r?{field:OR(r)}:{},...i?{order:i}:{}}}function tZ(t,n){const e=t.component.scales[n],r=t.specifiedScales[n].domain,i=t.fieldDef(n)?.bin,o=kW(r)?r:void 0,a=sq(i)&&cq(i.extent)?i.extent:void 0;(o||a)&&e.set("selectionExtent",o??a,!0)}function nZ(t,n){const{aggregate:e,type:r}=t;return e?$t(e)&&!iq.has(e)?{valid:!1,reason:aU(e)}:"quantitative"===r&&"log"===n?{valid:!1,reason:uU(t)}:{valid:!0}:{valid:!1,reason:oU(t)}}function eZ(t,n,e,r){return t.explicit&&n.explicit&&vU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${HR(e)} and ${HR(r)}). Using the union of the two domains.`}(e,r,t.value,n.value)),{explicit:t.explicit,value:[...t.value,...n.value]}}function rZ(t){if(vq(t)&&$t(t.field))return t.field;if(function(t){return!S(t)&&GR(t,"fields")&&!GR(t,"data")}(t)){let n;for(const e of t.fields)if(vq(e)&&$t(e.field))if(n){if(n!==e.field)return vU("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=e.field;return vU("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(t){return!S(t)&&GR(t,"fields")&&GR(t,"data")}(t)){vU("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=t.fields[0];return $t(n)?n:void 0}}function iZ(t,n){const e=t.component.scales[n].get("domains").map((n=>(vq(n)&&(n.data=t.lookupDataSource(n.data)),n)));return function(t){const n=hR(t.map((t=>{if(vq(t)){const{sort:n,...e}=t;return e}return t})),aR),e=hR(t.map((t=>{if(vq(t)){const n=t.sort;return void 0===n||$R(n)||("op"in n&&"count"===n.op&&delete n.field,"ascending"===n.order&&delete n.order),n}})).filter((t=>void 0!==t)),aR);if(0===n.length)return;if(1===n.length){const n=t[0];if(vq(n)&&e.length>0){let t=e[0];if(e.length>1){vU(lU);const n=e.filter((t=>F(t)&&"op"in t&&"min"!==t.op));t=!e.every((t=>F(t)&&"op"in t))||1!==n.length||n[0]}else F(t)&&"field"in t&&n.field===t.field&&(t=!t.order||{order:t.order});return{...n,sort:t}}return n}const r=hR(e.map((t=>$R(t)||!("op"in t)||$t(t.op)&&ft(KI,t.op)?t:(vU(function(t){return`Dropping sort property ${HR(t)} as unioned domains only support boolean or op "count", "min", and "max".`}(t)),!0))),aR);let i;1===r.length?i=r[0]:r.length>1&&(vU(lU),i=!0);const o=hR(t.map((t=>vq(t)?t.data:null)),(t=>t));return 1===o.length&&null!==o[0]?{data:o[0],fields:n.map((t=>t.field)),...i?{sort:i}:{}}:{fields:n,...i?{sort:i}:{}}}(e)}function oZ(t){return EZ(t)||FZ(t)?t.children.reduce(((t,n)=>t.concat(oZ(n))),aZ(t)):aZ(t)}function aZ(t){return bR(t.component.scales).reduce(((n,e)=>{const r=t.component.scales[e];if(r.merged)return n;const i=r.combine(),{name:o,type:a,selectionExtent:u,domains:s,range:c,reverse:l,...f}=i,d=function(t,n,e,r){if(AI(e)){if(gq(t))return{step:{signal:`${n}_step`}}}else if(F(t)&&vq(t))return{...t,data:r.lookupDataSource(t.data)};return t}(i.range,o,e,t),h=iZ(t,e),m=u?function(t,n,e,r){const i=oK(t,n.param,n);return{signal:wW(e.get("type"))&&S(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}(t,u,r,h):null;return n.push({name:o,type:a,...h?{domain:h}:{},...m?{domainRaw:m}:{},range:d,...void 0!==l?{reverse:l}:{},...f}),n}),[])}class uZ extends QV{merged=!1;constructor(t,n){super({},{name:t}),this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(sR(["log",oW,aW],t))return"definitely-not";const n=this.get("zero");if(!0===n||void 0===n&&sR([iW,"sqrt","pow"],t))return"definitely";const e=this.get("domains");if(e.length>0){let t=!1,n=!1,r=!1;for(const i of e){if(S(i)){const e=i[0],r=i[i.length-1];if(wt(e)&&wt(r)){if(e<=0&&r>=0){t=!0;continue}n=!0;continue}}r=!0}if(t)return"definitely";if(n&&!r)return"definitely-not"}return"maybe"}}const sZ=["range","scheme"];function cZ(t,n){const e=t.fieldDef(n);if(e?.bin){const{bin:r,field:i}=e,o=eI(n),a=t.getName(o);if(F(r)&&r.binned&&void 0!==r.step)return new VQ((()=>{const e=t.scaleName(n),i=`(domain("${e}")[1] - domain("${e}")[0]) / ${r.step}`;return`${t.getSignalName(a)} / (${i})`}));if(aq(r)){const n=lQ(t,i,r);return new VQ((()=>{const e=t.getSignalName(n),r=`(${e}.stop - ${e}.start) / ${e}.step`;return`${t.getSignalName(a)} / (${r})`}))}}}function lZ(t,n){const e=n.specifiedScales[t],{size:r}=n,i=n.getScaleComponent(t).get("type");for(const r of sZ)if(void 0!==e[r]){const o=OW(i,r),a=_W(t,r);if(o)if(a)vU(a);else switch(r){case"range":{const r=e.range;if(S(r)){if(AI(t))return ZV(r.map((t=>{if("width"===t||"height"===t){const e=n.getName(t),r=n.getSignalName.bind(n);return VQ.fromName(r,e)}return t})))}else if(F(r))return ZV({data:n.requestDataName(dX.Main),field:r.field,sort:{op:"min",field:n.vgField(t)}});return ZV(r)}case"scheme":return ZV(fZ(e[r]))}else vU(sU(i,r,t))}const o=t===JR||"xOffset"===t?"width":"height",a=r[o];if(CY(a))if(AI(t))if(bW(i)){const e=hZ(a,n,t);if(e)return ZV({step:e})}else vU(cU(o));else if(NI(t)&&"band"===n.getScaleComponent(t===tL?"x":"y").get("type")){const t=mZ(a,i);if(t)return ZV(t)}const{rangeMin:u,rangeMax:s}=e,c=function(t,n){const{size:e,config:r,mark:i,encoding:o}=n,{type:a}=vG(o[t]),u=n.getScaleComponent(t).get("type"),{domain:s,domainMid:c}=n.specifiedScales[t];switch(t){case JR:case KR:if(sR(["point","band"],u)){const i=pZ(t,e,r.view);if(CY(i))return{step:hZ(i,n,t)}}return dZ(t,n,u);case tL:case nL:return function(t,n,e){const r=t===tL?"x":"y",i=n.getScaleComponent(r);if(!i)return dZ(r,n,e,{center:!0});const o=i.get("type"),a=n.scaleName(r),{markDef:u,config:s}=n;if("band"===o){const t=pZ(r,n.size,n.config.view);if(CY(t)){const n=mZ(t,e);if(n)return n}return[0,{signal:`bandwidth('${a}')`}]}{const e=n.encoding[r];if(YH(e)&&e.timeUnit){const t=TU(e.timeUnit,(t=>`scale('${a}', ${t})`)),r=n.config.scale.bandWithNestedOffsetPaddingInner,i=LH({fieldDef:e,markDef:u,config:s})-.5,o=0!==i?` + ${i}`:"";return r?[{signal:`${pq(r)?`${r.signal}/2${o}`:`${r/2+i}`} * (${t})`},{signal:`${pq(r)?`(1 - ${r.signal}/2)${o}`:`${1-r/2+i}`} * (${t})`}]:[0,{signal:t}]}return rR(`Cannot use ${t} scale if ${r} scale is not discrete.`)}}(t,n,u);case pL:{const o=function(t,n){switch(t){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(nU("size",t))}(i,r),a=function(t,n,e,r){const i={x:cZ(e,"x"),y:cZ(e,"y")};switch(t){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const t=vZ(n,i,r.view);return wt(t)?t-1:new VQ((()=>`${t.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 t=vZ(n,i,r.view);return wt(t)?Math.pow(gZ*t,2):new VQ((()=>`pow(${gZ} * ${t.signal}, 2)`))}}throw new Error(nU("size",t))}(i,e,n,r);return $W(u)?function(t,n,e){const r=()=>{const r=Sq(n),i=Sq(t),o=`(${r} - ${i}) / (${e} - 1)`;return`sequence(${i}, ${r} + ${o}, ${o})`};return pq(n)?new VQ(r):{signal:r()}}(o,a,function(t,n,e,r){switch(t){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==e&&S(e)?e.length+1:(vU(function(t){return`Domain for ${t} is required for threshold scale.`}(r)),3)}}(u,r,s,t)):[o,a]}case iL:return[0,2*Math.PI];case gL:return[0,360];case eL:return[0,new VQ((()=>`min(${n.getSignalName(SZ(n.parent)?"child_width":"width")},${n.getSignalName(SZ(n.parent)?"child_height":"height")})/2`))];case lL:return{step:1e3/r.scale.framesPerSecond};case wL:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case xL:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case mL:return"symbol";case fL:case dL:case hL:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==c?"diverging":"rect"===i||"geoshape"===i?"heatmap":"ramp";case vL:case yL:case bL:return[r.scale.minOpacity,r.scale.maxOpacity]}}(t,n);return(void 0!==u||void 0!==s)&&OW(i,"rangeMin")&&S(c)&&2===c.length?ZV([u??c[0],s??c[1]]):tX(c)}function fZ(t){return function(t){return!$t(t)&&GR(t,"name")}(t)?{scheme:t.name,...oR(t,["name"])}:{scheme:t}}function dZ(t,n,e,{center:r}={}){const i=eI(t),o=n.getName(i),a=n.getSignalName.bind(n);return t===KR&&wW(e)?r?[VQ.fromName((t=>`${a(t)}/2`),o),VQ.fromName((t=>`-${a(t)}/2`),o)]:[VQ.fromName(a,o),0]:r?[VQ.fromName((t=>`-${a(t)}/2`),o),VQ.fromName((t=>`${a(t)}/2`),o)]:[0,VQ.fromName(a,o)]}function hZ(t,n,e){const{encoding:r}=n,i=n.getScaleComponent(e),o=iI(e),a=r[o];if("offset"===NY({step:t,offsetIsDiscrete:ZH(a)&&QU(a.type)})&&jG(r,o)){const e=n.getScaleComponent(o);let r=`domain('${n.scaleName(o)}').length`;"band"===e.get("type")&&(r=`bandspace(${r}, ${e.get("paddingInner")??e.get("padding")??0}, ${e.get("paddingOuter")??e.get("padding")??0})`);const a=i.get("paddingInner")??i.get("padding");return{signal:`${t.step} * ${r} / (1-${Aq(a)})`}}return t.step}function mZ(t,n){if("offset"===NY({step:t,offsetIsDiscrete:bW(n)}))return{step:t.step}}function pZ(t,n,e){const r=t===JR?"width":"height",i=n[r];return void 0!==i?i:TY(e,r)}const gZ=.95;function vZ(t,n,e){const r=CY(t.width)?t.width.step:BY(e,"width"),i=CY(t.height)?t.height.step:BY(e,"height");return n.x||n.y?new VQ((()=>`min(${[n.x?n.x.signal:r,n.y?n.y.signal:i].join(", ")})`)):Math.min(r,i)}function yZ(t,n){DZ(t)?function(t,n){const e=t.component.scales,{config:r,encoding:i,markDef:o,specifiedScales:a}=t;for(const u of bR(e)){const s=a[u],c=e[u],l=t.getScaleComponent(u),f=vG(i[u]),d=s[n],h=l.get("type"),m=l.get("padding"),p=l.get("paddingInner"),g=OW(h,n),v=_W(u,n);if(void 0!==d&&(g?v&&vU(v):vU(sU(h,n,u))),g&&void 0===v)if(void 0!==d){const t=f.timeUnit,e=f.type;switch(n){case"domainMax":case"domainMin":yU(s[n])||"temporal"===e||t?c.set(n,{signal:MG(s[n],{type:e,timeUnit:t})},!0):c.set(n,s[n],!0);break;default:c.copyKeyFromObject(n,s)}}else{const e=GR(bZ,n)?bZ[n]({model:t,channel:u,fieldOrDatumDef:f,scaleType:h,scalePadding:m,scalePaddingInner:p,domain:s.domain,domainMin:s.domainMin,domainMax:s.domainMax,markDef:o,config:r,hasNestedOffsetScale:RG(i,u),hasSecondaryRangeChannel:!!i[nI(u)]}):r.scale[n];void 0!==e&&c.set(n,e,!1)}}}(t,n):xZ(t,n)}const bZ={bins:({model:t,fieldOrDatumDef:n})=>YH(n)?function(t,n){const e=n.bin;if(aq(e)){const r=lQ(t,n.field,e);return new VQ((()=>t.getSignalName(r)))}if(uq(e)&&sq(e)&&void 0!==e.step)return{step:e.step}}(t,n):void 0,interpolate:({channel:t,fieldOrDatumDef:n})=>function(t,n){if(sR([fL,dL,hL],t)&&"nominal"!==n)return"hcl"}(t,n.type),nice:({scaleType:t,channel:n,domain:e,domainMin:r,domainMax:i,fieldOrDatumDef:o})=>function(t,n,e,r,i,o){if(!(gG(o)?.bin||S(e)||null!=i||null!=r||sR([oW,aW],t)))return!!AI(n)||void 0}(t,n,e,r,i,o),padding:({channel:t,scaleType:n,fieldOrDatumDef:e,markDef:r,config:i})=>function(t,n,e,r,i,o){if(AI(t)){if(xW(n)){if(void 0!==e.continuousPadding)return e.continuousPadding;const{type:n,orient:a}=i;if("bar"===n&&(!YH(r)||!r.bin&&!r.timeUnit)&&("vertical"===a&&"x"===t||"horizontal"===a&&"y"===t))return o.continuousBandSize}if(n===uW)return e.pointPadding}}(t,n,i.scale,e,r,i.bar),paddingInner:({scalePadding:t,channel:n,markDef:e,scaleType:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t){if(AI(n)){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:u}=i;return o?u:TR(t,"bar"===e?n:"tick"===e?a:r)}return NI(n)&&r===sW?i.offsetBandPaddingInner:void 0}}(t,n,e.type,r,i.scale,o),paddingOuter:({scalePadding:t,channel:n,scaleType:e,scalePaddingInner:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t)if(AI(n)){const{bandPaddingOuter:t,bandWithNestedOffsetPaddingOuter:n}=i;if(o)return n;if(e===sW)return TR(t,pq(r)?{signal:`${r.signal}/2`}:r/2)}else if(NI(n)){if(e===uW)return.5;if(e===sW)return i.offsetBandPaddingOuter}}(t,n,e,r,i.scale,o),reverse:({fieldOrDatumDef:t,scaleType:n,channel:e,config:r})=>function(t,n,e,r){return"x"===e&&void 0!==r.xReverse?wW(t)&&"descending"===n?pq(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse:!(!wW(t)||"descending"!==n)||void 0}(n,YH(t)?t.sort:void 0,e,r.scale),zero:({channel:t,fieldOrDatumDef:n,domain:e,markDef:r,scaleType:i,config:o,hasSecondaryRangeChannel:a})=>function(t,n,e,r,i,o,a){if(e&&"unaggregated"!==e&&wW(i)){if(S(e)){const t=e[0],n=e[e.length-1];if(wt(t)&&t<=0&&wt(n)&&n>=0)return!0}return!1}if("size"===t&&"quantitative"===n.type&&!$W(i))return!0;if((!YH(n)||!n.bin)&&sR([...MI,...SI],t)){const{orient:n,type:e}=r;return(!sR(["bar","area","line","trail"],e)||!("horizontal"===n&&"y"===t||"vertical"===n&&"x"===t))&&(!(!sR(["bar","area"],e)||a)||o?.zero)}return!1}(t,n,e,r,i,o.scale,a)};function wZ(t){DZ(t)?function(t){const n=t.component.scales;for(const e of WI){const r=n[e];if(!r)continue;const i=lZ(e,t);r.setWithExplicit("range",i)}}(t):xZ(t,"range")}function xZ(t,n){const e=t.component.scales;for(const e of t.children)"range"===n?wZ(e):yZ(e,n);for(const r of bR(e)){let i;for(const e of t.children){const t=e.component.scales[r];t&&(i=rX(i,t.getWithExplicit(n),n,"scale",nX(((t,e)=>"range"===n&&t.step&&e.step?t.step-e.step:0))))}e[r].setWithExplicit(n,i)}}function $Z(t,n,e,r,i=!1){const o=function(t,n,e,r){switch(n.type){case"nominal":case"ordinal":if(PL(t)||"discrete"===XI(t))return"shape"===t&&"ordinal"===n.type&&vU(iU(t,"ordinal")),"ordinal";if(OI(t))return"band";if(AI(t)||NI(t)){if(sR(["rect","bar","image","rule","tick"],e.type))return"band";if(r)return"band"}else if("arc"===e.type&&t in DI)return"band";return iH(e[eI(t)])||rG(n)&&n.axis?.tickBand?"band":"point";case"temporal":return PL(t)?"time":"discrete"===XI(t)?(vU(iU(t,"temporal")),"ordinal"):YH(n)&&n.timeUnit&&BU(n.timeUnit).utc?"utc":OI(t)?"band":"time";case"quantitative":return PL(t)?YH(n)&&aq(n.bin)?"bin-ordinal":"linear":"discrete"===XI(t)?(vU(iU(t,"quantitative")),"ordinal"):OI(t)?"band":"linear";case"geojson":return}throw new Error(Qq(n.type))}(n,e,r,i),{type:a}=t;return HI(n)?void 0!==a?function(t,n,e=!1){if(!HI(t))return!1;switch(t){case JR:case KR:case tL:case nL:case iL:case eL:return!!xW(n)||"band"===n||"point"===n&&!e;case lL:return sR(["linear","band"],n);case pL:case wL:case vL:case yL:case bL:case gL:return xW(n)||$W(n)||sR(["band","point","ordinal"],n);case fL:case dL:case hL:return"band"!==n;case xL:case mL:return"ordinal"===n||$W(n)}}(n,a)?YH(e)&&(u=a,!(sR([tW,eW],s=e.type)?void 0===u||bW(u):s===nW?sR([oW,aW,void 0],u):s!==ZU||pW(u)||$W(u)||void 0===u))?(vU(function(t,n){return`FieldDef does not work with "${t}" scale. We are using "${n}" scale instead.`}(a,o)),o):a:(vU(function(t,n,e){return`Channel "${t}" does not work with "${n}" scale. We are using "${e}" scale instead.`}(n,a,o)),o):o:null;var u,s}function kZ(t){t.component.scales=DZ(t)?function(t){const{encoding:n,mark:e,markDef:r}=t,i={};for(const o of WI){const a=vG(n[o]);if(a&&e===VW&&o===mL&&a.type===rW)continue;let u=a&&a.scale;if(a&&null!==u&&!1!==u){u??={};const e=$Z(u,o,a,r,RG(n,o));i[o]=new uZ(t.scaleName(`${o}`,!0),{value:e,explicit:u.type===e})}}return i}(t):function(t){const n=t.component.scales={},e={},r=t.component.resolve;for(const n of t.children){kZ(n);for(const i of bR(n.component.scales))if(r.scale[i]??=IK(i,t),"shared"===r.scale[i]){const t=e[i],o=n.component.scales[i].getWithExplicit("type");t?lW(t.value,o.value)?e[i]=rX(t,o,"type","scale",MZ):(r.scale[i]="independent",delete e[i]):e[i]=o}}for(const r of bR(e)){const i=t.scaleName(r,!0);n[r]=new uZ(i,e[r]);for(const n of t.children){const t=n.component.scales[r];t&&(n.renameScale(t.get("name"),i),t.merged=!0)}}return n}(t)}const MZ=nX(((t,n)=>dW(t)-dW(n)));class AZ{nameMap;constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return void 0!==this.nameMap[t]}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function DZ(t){return"unit"===t?.type}function SZ(t){return"facet"===t?.type}function FZ(t){return"concat"===t?.type}function EZ(t){return"layer"===t?.type}class NZ{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(t,n,e,r,i,o,a){this.type=n,this.parent=e,this.config=i,this.parent=e,this.config=i,this.view=dq(a),this.name=t.name??r,this.title=mq(t.title)?{text:t.title}:t.title?dq(t.title):void 0,this.scaleNameMap=e?e.scaleNameMap:new AZ,this.projectionNameMap=e?e.projectionNameMap:new AZ,this.signalNameMap=e?e.signalNameMap:new AZ,this.data=t.data,this.description=t.description,this.transforms=function(t){return t.map((t=>wV(t)?{filter:nR(t.filter,JU)}:t))}(t.transform??[]),this.layout="layer"===n||"unit"===n?{}:function(t,n,e){const r=e[n],i={},{spacing:o,columns:a}=r;void 0!==o&&(i.spacing=o),void 0!==a&&(PH(t)&&!BH(t.facet)||SY(t))&&(i.columns=a),FY(t)&&(i.columns=1);for(const n of _Y)if(void 0!==t[n])if("spacing"===n){const e=t[n];i[n]=wt(e)?e:{row:e.row??o,column:e.column??o}}else i[n]=t[n];return i}(t,n,i),this.component={data:{sources:e?e.component.data.sources:[],outputNodes:e?e.component.data.outputNodes:{},outputNodeRefCounts:e?e.component.data.outputNodeRefCounts:{},isFaceted:PH(t)||e?.component.data.isFaceted&&void 0===t.data},layoutSize:new QV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?eR(o):{}},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(t,{ignoreRange:n}={}){kZ(t),XQ(t);for(const n of CW)yZ(t,n);n||wZ(t)}(this)}parseProjection(){uQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){ZK(this)}assembleEncodeFromView(t){const{style:n,...e}=t,r={};for(const t of bR(e)){const n=e[t];void 0!==n&&(r[t]=Mq(n))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),t||(this.description&&(n.description=Mq(this.description)),"unit"!==this.type&&"layer"!==this.type)?yR(n)?void 0:n:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:e,config:r}=this,i=function(t,n){const e={};for(const r of RL){const i=t[r];if(i?.facetFieldDef){const{titleAnchor:t,titleOrient:o}=$K(["titleAnchor","titleOrient"],i.facetFieldDef.header,n,r),a=wK(r,o),u=_K(t,a);void 0!==u&&(e[a]=u)}}return yR(e)?void 0:e}(e.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const e of RL)t[e].title&&n.push(AK(this,e));for(const t of kK)n=n.concat(FK(this,t));return n}assembleAxes(){return function(t,n){const{x:e=[],y:r=[]}=t;return[...e.map((t=>sK(t,"grid",n))),...r.map((t=>sK(t,"grid",n))),...e.map((t=>sK(t,"main",n))),...r.map((t=>sK(t,"main",n)))].filter((t=>t))}(this.component.axes,this.config)}assembleLegends(){return rQ(this)}assembleProjections(){return EZ(t=this)||FZ(t)?function(t){return t.children.reduce(((t,n)=>t.concat(n.assembleProjections())),iQ(t))}(t):iQ(t);var t}assembleTitle(){const{encoding:t,...n}=this.title??{},e={...hq(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(e.text)return sR(["unit","layer"],this.type)?sR(["middle",void 0],e.anchor)&&(e.frame??="group"):e.anchor??="start",yR(e)?void 0:e}assembleGroup(t=[]){const n={};(t=t.concat(this.assembleSignals())).length>0&&(n.signals=t);const e=this.assembleLayout();e&&(n.layout=e),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||SZ(this.parent)?oZ(this):[];r.length>0&&(n.scales=r);const i=this.assembleAxes();i.length>0&&(n.axes=i);const o=this.assembleLegends();return o.length>0&&(n.legends=o),n}getName(t){return kR((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(dX[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),e=this.component.data.outputNodeRefCounts;return e[n]=(e[n]||0)+1,n}getSizeSignalRef(t){if(SZ(this.parent)){const n=FI(RK(t)),e=this.component.scales[n];if(e&&!e.merged){const t=e.get("type"),r=e.get("range");if(bW(t)&&gq(r)){const t=e.get("name"),r=rZ(iZ(this,n));return r?{signal:jK(t,e,uG({aggregate:"distinct",field:r},{expr:"datum"}))}:(vU(qq(n)),null)}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){return n?this.getName(t):JL(t)&&HI(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t))?this.scaleNameMap.get(this.getName(t)):void 0}projectionName(t){return t?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(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let e=this.component.selection[t];if(!e&&this.parent&&(e=this.parent.getSelectionComponent(t,n)),!e)throw new Error(`Cannot find a selection named "${n}".`);return e}hasAxisOrientSignalRef(){return this.component.axes.x?.some((t=>t.hasOrientSignalRef()))||this.component.axes.y?.some((t=>t.hasOrientSignalRef()))}}class CZ extends NZ{vgField(t,n={}){const e=this.fieldDef(t);if(e)return uG(e,n)}reduceFieldDef(t,n){return function(t,n,e,r){return t?bR(t).reduce(((e,i)=>{const o=t[i];return S(o)?o.reduce(((t,e)=>n.call(r,t,e,i)),e):n.call(r,e,o,i)}),e):e}(this.getMapping(),((n,e,r)=>{const i=gG(e);return i?t(n,i,r):n}),n)}forEachFieldDef(t,n){WG(this.getMapping(),((n,e)=>{const r=gG(n);r&&t(r,e)}),n)}}class OZ extends mX{transform;clone(){return new OZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"value",e[1]??"density"],this.transform.resolve=this.transform.resolve??"shared"}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${aR(this.transform)}`}assemble(){const{density:t,...n}=this.transform,e={type:"kde",field:t,...n};return e.resolve=this.transform.resolve,e}}class _Z extends mX{transform;clone(){return new _Z(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${aR(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class zZ extends mX{transform;clone(){return new zZ(this.parent,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const{flatten:e,as:r=[]}=this.transform;this.transform.as=e.map(((t,n)=>r[n]??t))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${aR(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class BZ extends mX{transform;clone(){return new BZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"key",e[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${aR(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class TZ extends mX{fields;geojson;signal;clone(){return new TZ(null,eR(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let e=0;for(const r of[[uL,aL],[cL,sL]]){const i=r.map((t=>{const e=vG(n.encoding[t]);return YH(e)?e.field:XH(e)?{expr:`${e.datum}`}:nG(e)?{expr:`${e.value}`}:void 0}));(i[0]||i[1])&&(t=new TZ(t,i,null,n.getName("geojson_"+e++)))}if(n.channelHasField(mL)){const r=n.typedFieldDef(mL);r.type===rW&&(t=new TZ(t,null,r.field,n.getName("geojson_"+e++)))}return t}constructor(t,n,e,r){super(t),this.fields=n,this.geojson=e,this.signal=r}dependentFields(){const t=(this.fields??[]).filter($t);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${aR(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 PZ extends mX{projection;fields;as;clone(){return new PZ(null,this.projection,eR(this.fields),eR(this.as))}constructor(t,n,e,r){super(t),this.projection=n,this.fields=e,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(const e of[[uL,aL],[cL,sL]]){const r=e.map((t=>{const e=vG(n.encoding[t]);return YH(e)?e.field:XH(e)?{expr:`${e.datum}`}:nG(e)?{expr:`${e.value}`}:void 0})),i=e[0]===cL?"2":"";(r[0]||r[1])&&(t=new PZ(t,n.projectionName(),r,[n.getName(`x${i}`),n.getName(`y${i}`)]))}return t}dependentFields(){return new Set(this.fields.filter($t))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${aR(this.fields)} ${aR(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class jZ extends mX{transform;clone(){return new jZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:e,step:r}=t;return{signal:`sequence(${[n,e,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,n){return new jZ(t,n)}static makeFromEncoding(t,n){const e=n.encoding,r=e.x,i=e.y;if(YH(r)&&YH(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:u,value:s,frame:c,keyvals:l}=o.impute,f=HG(n.mark,e);return new jZ(t,{impute:o.field,key:a.field,...u?{method:u}:{},...void 0!==s?{value:s}:{},...c?{frame:c}:{},...void 0!==l?{keyvals:l}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${aR(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:e,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...e?{keyvals:(s=e,GR(s,"stop")?this.processSequence(e):e)}:{},method:"value",...i?{groupby:i}:{},value:r&&"value"!==r?null:o};var s;return r&&"value"!==r?[u,{type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:a,ignorePeers:!1,...i?{groupby:i}:{}},{type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t}]:[u]}}class RZ extends mX{transform;clone(){return new RZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${aR(this.transform)}`}assemble(){const{loess:t,on:n,...e}=this.transform;return{type:"loess",x:n,y:t,...e}}}class LZ extends mX{transform;secondary;clone(){return new LZ(null,eR(this.transform),this.secondary)}constructor(t,n,e){super(t),this.transform=n,this.secondary=e}static make(t,n,e,r){const i=n.component.data.sources,{from:o}=e;let a=null;if(function(t){return GR(t,"data")}(o)){let t=t0(o.data,i);t||(t=new xQ(o.data),i.push(t));const e=n.getName(`lookup_${r}`);a=new pX(t,e,dX.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[e]=a}else if(function(t){return GR(t,"param")}(o)){const t=o.param;let r;e={as:t,...e};try{r=n.getSelectionComponent(kR(t),t)}catch{throw new Error(`Lookups can only be performed on selection parameters. "${t}" is a variable parameter.`)}if(a=r.materialized,!a)throw new Error(`Cannot define and lookup the "${t}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new LZ(t,e,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Q(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${aR({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:Q(this.transform.as)}:{}};else{let n=this.transform.as;$t(n)||(vU('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"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class IZ extends mX{transform;clone(){return new IZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"prob",e[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${aR(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class qZ extends mX{transform;clone(){return new qZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${aR(this.transform)}`}assemble(){const{regression:t,on:n,...e}=this.transform;return{type:"regression",x:n,y:t,...e}}}class UZ extends mX{transform;clone(){return new UZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=hR((this.transform.groupby??[]).concat(t),(t=>t))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${aR(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:e,limit:r,op:i}=this.transform;return{type:"pivot",field:t,value:n,...void 0!==r?{limit:r}:{},...void 0!==i?{op:i}:{},...void 0!==e?{groupby:e}:{}}}}class WZ extends mX{transform;clone(){return new WZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${aR(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function HZ(t){let n=0;return function e(r,i){if(r instanceof xQ&&!r.isGenerator&&!oX(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof vQ&&(r.parent instanceof xQ&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof mQ)return i.name||(i.name="data_"+n++),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void t.push(...r.assemble());switch((r instanceof bQ||r instanceof wQ||r instanceof jQ||r instanceof rK||r instanceof yK||r instanceof PZ||r instanceof hQ||r instanceof LZ||r instanceof IQ||r instanceof PQ||r instanceof BZ||r instanceof zZ||r instanceof OZ||r instanceof RZ||r instanceof IZ||r instanceof qZ||r instanceof yQ||r instanceof WZ||r instanceof UZ||r instanceof _Z)&&i.transform.push(r.assemble()),(r instanceof dQ||r instanceof yX||r instanceof jZ||r instanceof LQ||r instanceof TZ)&&i.transform.push(...r.assemble()),r instanceof pX&&(i.source&&0===i.transform.length?r.setSource(i.source):r.parent instanceof pX?r.setSource(i.name):(i.name||(i.name="data_"+n++),r.setSource(i.name),1===r.numChildren()&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof pX&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:e(r.children[0],i);break;default:{i.name||(i.name="data_"+n++);let o=i.name;!i.source||i.transform.length>0?t.push(i):o=i.source;for(const t of r.children)e(t,{name:null,source:o,transform:[]});break}}}}function GZ(t,n){const{facet:e,config:r,child:i,component:o}=t;if(t.channelHasField(n)){const a=e[n],u=xK("title",null,r,n);let s=dG(a,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});i.component.layoutHeaders[n].title&&(s=S(s)?s.join(", "):s,s+=` / ${i.component.layoutHeaders[n].title}`,i.component.layoutHeaders[n].title=null);const c=xK("labelOrient",a.header,r,n),l=null!==a.header&&TR(a.header?.labels,r.header.labels,!0),f=sR(["bottom","right"],c)?"footer":"header";o.layoutHeaders[n]={title:null!==a.header?s:null,facetFieldDef:a,[f]:"facet"===n?[]:[YZ(t,n,l)]}}}function YZ(t,n,e){const r="row"===n?"height":"width";return{labels:e,sizeSignal:t.child.component.layoutSize.get(r)?t.child.getSizeSignalRef(r):void 0,axes:[]}}function VZ(t,n){const{child:e}=t;if(e.component.axes[n]){const{layoutHeaders:i,resolve:o}=t.component;if(o.axis[n]=qK(o,n),"shared"===o.axis[n]){const o="x"===n?"column":"row",a=i[o];for(const i of e.component.axes[n]){const n="top"===(r=i.get("orient"))||"left"===r||pq(r)?"header":"footer";a[n]??=[YZ(t,o,!1)];const e=sK(i,"main",t.config,{header:!0});e&&a[n][0].axes.push(e),i.mainExtracted=!0}}}var r}function XZ(t){for(const n of t.children)n.parseLayoutSize()}function JZ(t,n){const e=RK(n),r=FI(e),i=t.component.resolve,o=t.component.layoutSize;let a;for(const n of t.children){const o=n.component.layoutSize.getWithExplicit(e),u=i.scale[r]??IK(r,t);if("independent"===u&&"step"===o.value){a=void 0;break}if(a){if("independent"===u&&a.value!==o.value){a=void 0;break}a=rX(a,o,e,"")}else a=o}if(a){for(const r of t.children)t.renameSignal(r.getName(e),t.getName(n)),r.component.layoutSize.set(e,"merged",!1);o.setWithExplicit(n,a)}else o.setWithExplicit(n,{explicit:!1,value:void 0})}function KZ(t,n){const e=t.config,r=t.getScaleComponent("width"===n?"x":"y");if(r){const t=r.get("type"),i=r.get("range");if(bW(t)){const t=TY(e.view,n);return gq(i)||CY(t)?"step":t}return zY(e.view,n)}if(t.hasProjection||"arc"===t.mark)return zY(e.view,n);{const t=TY(e.view,n);return CY(t)?t.step:t}}function QZ(t,n,e){return uG(n,{suffix:`by_${uG(t)}`,...e})}class ZZ extends CZ{facet;child;children;constructor(t,n,e,r){super(t,"facet",n,e,r,t.resolve),this.child=k0(t.spec,this,this.getName("child"),void 0,r),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!BH(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=bR(t),e={};for(const r of n){if(![YR,VR].includes(r)){vU(nU(r,"facet"));break}const n=t[r];if(void 0===n.field){vU(tU(n,r));break}e[r]=this.initFacetFieldDef(n,r)}return e}initFacetFieldDef(t,n){const e=wG(t,n);return e.header?e.header=dq(e.header):null===e.header&&(e.header=null),e}channelHasField(t){return GR(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=n0(this),this.child.parseData()}parseLayoutSize(){XZ(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,wR(this.component.selection).some((t=>ZJ(t)))&&gU(Yq)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(t){for(const n of RL)GZ(t,n);VZ(t,"x"),VZ(t,"y")}(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of RL)for(const e of MK){const r=this.component.layoutHeaders[n],i=r[e],{facetFieldDef:o}=r;if(o){const e=xK("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(e)){const r=wK(n,e);t.titleAnchor??={},t.titleAnchor[r]="end"}}if(i?.[0]){const i="header"===e?"headerBand":"footerBand";"facet"===n||this.child.component.layoutSize.get("row"===n?"height":"width")||(t[i]??={},t[i][n]=.5),r.title&&(t.offset??={},t.offset["row"===n?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,e=t?this.columnDistinctSignal():n?1:void 0;let r="all";return(n||"independent"!==this.component.resolve.scale.x)&&(t||"independent"!==this.component.resolve.scale.y)||(r="none"),{...this.getHeaderLayoutMixins(),...e?{columns:e}:{},bounds:"full",align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof ZZ))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof ZZ?{...this.channelHasField("column")?{encode:{update:{columns:{field:uG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],e=[];if(this.child instanceof ZZ){if(this.child.channelHasField("column")){const r=uG(this.child.facet.column);t.push(r),n.push("distinct"),e.push(`distinct_${r}`)}}else for(const r of MI){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(bW(o)&&gq(a)){const i=rZ(iZ(this.child,r));i?(t.push(i),n.push("distinct"),e.push(`distinct_${i}`)):vU(qq(r))}}}return{fields:t,ops:n,as:e}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:e,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const t of RL){const n=this.facet[t];if(n){u.push(uG(n));const{bin:s,sort:c}=n;if(aq(s)&&u.push(uG(n,{binSuffix:"end"})),_H(c)){const{field:t,op:u=NH}=c,s=QZ(n,c);e&&r?(i.push(s),o.push("max"),a.push(s)):(i.push(t),o.push(u),a.push(s))}else if(S(c)){const e=bK(n,t);i.push(e),o.push("max"),a.push(e)}}}const s=!!e&&!!r;return{name:t,data:n,groupby:u,...s||i.length>0?{aggregate:{...s?{cross:s}:{},...i.length?{fields:i,ops:o,as:a}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,e=n[t];return e?_H(e.sort)?[QZ(e,e.sort,{expr:"datum"})]:S(e.sort)?[bK(e,t,{expr:"datum"})]:[uG(e,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,e=n[t];if(e){const{sort:t}=e;return[(_H(t)?t.order:!S(t)&&t)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:n}=this;if(t.facet)return NK(t.facet,"facet",n);const e={row:["top","bottom"],column:["left","right"]};for(const r of kK)if(t[r]){const i=xK("labelOrient",t[r]?.header,n,r);if(e[r].includes(i))return NK(t[r],r,n)}}assembleMarks(){const{child:t}=this,n=function(t){const n=[],e=HZ(n);for(const n of t.children)e(n,{source:t.name,name:null,transform:[]});return n}(this.component.data.facetRoot),e=t.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||t.assembleTitle(),i=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...r?{title:r}:{},...i?{style:i}:{},from:{facet:this.assembleFacet()},sort:{field:RL.map((t=>this.facetSortFields(t))).flat(),order:RL.map((t=>this.facetSortOrder(t))).flat()},...n.length>0?{data:n}:{},...e?{encode:{update:e}}:{},...t.assembleGroup(LX(this,[]))}]}getMapping(){return this.facet}}function t0(t,n){for(const e of n){const n=e.data;if(t.name&&e.hasName()&&t.name!==e.dataName)continue;const r=t.format?.mesh,i=n.format?.feature;if(r&&i)continue;const o=t.format?.feature;if((o||i)&&o!==i)continue;const a=n.format?.mesh;if(!r&&!a||r===a)if(aX(t)&&aX(n)){if(WR(t.values,n.values))return e}else if(oX(t)&&oX(n)){if(t.url===n.url)return e}else if(uX(t)&&t.name===e.dataName)return e}return null}function n0(t){let n=function(t,n){if(t.data||!t.parent){if(null===t.data){const t=new xQ({values:[]});return n.push(t),t}const e=t0(t.data,n);if(e)return sX(t.data)||(e.data.format=fR({},t.data.format,e.data.format)),!e.hasName()&&t.data.name&&(e.dataName=t.data.name),e;{const e=new xQ(t.data);return n.push(e),e}}return t.parent.component.data.facetRoot?t.parent.component.data.facetRoot:t.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:e,outputNodeRefCounts:r}=t.component.data,i=t.data,o=i&&(sX(i)||oX(i)||aX(i))||!t.parent?new iX:t.parent.component.data.ancestorParse.clone();sX(i)?(cX(i)?n=new wQ(n,i.sequence):fX(i)&&(n=new bQ(n,i.graticule)),o.parseNothing=!0):null===i?.format?.parse&&(o.parseNothing=!0),n=vQ.makeExplicit(n,t,o)??n,n=new yQ(n);const a=t.parent&&EZ(t.parent);(DZ(t)||SZ(t))&&a&&(n=dQ.makeFromEncoding(n,t)??n),t.transforms.length>0&&(n=function(t,n,e){let r=0;for(const i of n.transforms){let o,a;if(CV(i))a=t=new yK(t,i),o="derived";else if(wV(i)){const r=gQ(i);a=t=vQ.makeWithAncestors(t,{},r,e)??t,t=new rK(t,n,i.filter)}else if(OV(i))a=t=dQ.makeFromTransform(t,i,n),o="number";else if(zV(i))o="date",void 0===e.getWithExplicit(i.field).value&&(t=new vQ(t,{[i.field]:o}),e.set(i.field,o,!1)),a=t=yX.makeFromTransform(t,i);else if(BV(i))a=t=hQ.makeFromTransform(t,i),o="number",KJ(n)&&(t=new yQ(t));else if(xV(i))a=t=LZ.make(t,n,i,r++),o="derived";else if(FV(i))a=t=new IQ(t,i),o="number";else if(EV(i))a=t=new PQ(t,i),o="number";else if(TV(i))a=t=LQ.makeFromTransform(t,i),o="derived";else if(PV(i))a=t=new BZ(t,i),o="derived";else if(jV(i))a=t=new _Z(t,i),o="derived";else if(NV(i))a=t=new zZ(t,i),o="derived";else if($V(i))a=t=new UZ(t,i),o="derived";else if(SV(i))t=new WZ(t,i);else if(_V(i))a=t=jZ.makeFromTransform(t,i),o="derived";else if(kV(i))a=t=new OZ(t,i),o="derived";else if(MV(i))a=t=new IZ(t,i),o="derived";else if(AV(i))a=t=new qZ(t,i),o="derived";else{if(!DV(i)){vU(Xq(i));continue}a=t=new RZ(t,i),o="derived"}if(a&&void 0!==o)for(const t of a.producedFields()??[])e.set(t,o,!1)}return t}(n,t,o));const u=function(t){const n={};if(DZ(t)&&t.component.selection)for(const e of bR(t.component.selection)){const r=t.component.selection[e];for(const t of r.project.items)!t.channel&&BR(t.field)>1&&(n[t.field]="flatten")}return n}(t),s=function(t){const n={};function e(t){var e;kG(t)?n[t.field]="date":"quantitative"===t.type&&$t(e=t.aggregate)&&sR(["min","max"],e)?n[t.field]="number":BR(t.field)>1?t.field in n||(n[t.field]="flatten"):eG(t)&&_H(t.sort)&&BR(t.sort.field)>1&&(t.sort.field in n||(n[t.sort.field]="flatten"))}if((DZ(t)||SZ(t))&&t.forEachFieldDef(((n,r)=>{if(tG(n))e(n);else{const i=ZL(r),o=t.fieldDef(i);e({...n,type:o.type})}})),DZ(t)){const{mark:e,markDef:r,encoding:i}=t;if(XW(e)&&!t.encoding.order){const t=i["horizontal"===r.orient?"y":"x"];YH(t)&&"quantitative"===t.type&&!(t.field in n)&&(n[t.field]="number")}}return n}(t);n=vQ.makeWithAncestors(n,{},{...u,...s},o)??n,DZ(t)&&(n=TZ.parseAll(n,t),n=PZ.parseAll(n,t)),(DZ(t)||SZ(t))&&(a||(n=dQ.makeFromEncoding(n,t)??n),n=yX.makeFromEncoding(n,t)??n,n=yK.parseAllForSortIndex(n,t));const c=n=e0(dX.Raw,t,n);if(DZ(t)){const e=hQ.makeFromEncoding(n,t);e&&(n=e,KJ(t)&&(n=new yQ(n))),n=jZ.makeFromEncoding(n,t)??n,n=LQ.makeFromEncoding(n,t)??n}let l,f;if(DZ(t)){const{markDef:e,mark:r,config:i}=t,o=Nq("invalid",e,i),{marks:a,scales:u}=f=hX({invalid:o,isPath:XW(r)});a!==u&&"include-invalid-values"===u&&(l=n=e0(dX.PreFilterInvalid,t,n)),"exclude-invalid-values"===a&&(n=jQ.make(n,t,f)??n)}const d=n=e0(dX.Main,t,n);let h;if(DZ(t)&&f){const{marks:e,scales:r}=f;"include-invalid-values"===e&&"exclude-invalid-values"===r&&(n=jQ.make(n,t,f)??n,h=n=e0(dX.PostFilterInvalid,t,n))}DZ(t)&&function(t,n){for(const[e,r]of xR(t.component.selection??{})){const i=t.getName(`lookup_${e}`);t.component.data.outputNodes[i]=r.materialized=new pX(new rK(n,t,{param:e}),i,dX.Lookup,t.component.data.outputNodeRefCounts)}}(t,d);let m=null;if(SZ(t)){const r=t.getName("facet");n=function(t,n){const{row:e,column:r}=n;if(e&&r){let n=null;for(const i of[e,r])if(_H(i.sort)){const{field:e,op:r=NH}=i.sort;t=n=new PQ(t,{joinaggregate:[{op:r,field:e,as:QZ(i,i.sort,{forAs:!0})}],groupby:[uG(i)]})}return n}return null}(n,t.facet)??n,m=new mQ(n,t,r,d.getSource()),e[r]=m}return{...t.component.data,outputNodes:e,outputNodeRefCounts:r,raw:c,main:d,facetRoot:m,ancestorParse:o,preFilterInvalid:l,postFilterInvalid:h}}function e0(t,n,e){const{outputNodes:r,outputNodeRefCounts:i}=n.component.data,o=n.getDataName(t),a=new pX(e,o,t,i);return r[o]=a,a}class r0 extends NZ{children;constructor(t,n,e,r){super(t,"concat",n,e,r,t.resolve),"shared"!==t.resolve?.axis?.x&&"shared"!==t.resolve?.axis?.y||vU("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(t).map(((t,n)=>k0(t,this,this.getName(`concat_${n}`),void 0,r)))}parseData(){this.component.data=n0(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of bR(t.component.selection))this.component.selection[n]=t.component.selection[n]}wR(this.component.selection).some((t=>ZJ(t)))&&gU(Yq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return FY(t)?t.vconcat:EY(t)?t.hconcat:t.concat}parseLayoutSize(){!function(t){XZ(t);const n=void 0===t.layout.columns?"height":"childHeight";JZ(t,1===t.layout.columns?"width":"childWidth"),JZ(t,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.forEach((t=>t.assembleSignals())),[]}assembleLayoutSignals(){const t=BK(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleMarks(){return this.children.map((t=>{const n=t.assembleTitle(),e=t.assembleGroupStyle(),r=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...e?{style:e}:{},...r?{encode:{update:r}}:{},...t.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...null!=t?{columns:t}:{},bounds:"full",align:"each"}}}const i0={disable:1,gridScale:1,scale:1,...CG,labelExpr:1,encode:1},o0=bR(i0);class a0 extends QV{explicit;implicit;mainExtracted;constructor(t={},n={},e=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=e}clone(){return new a0(eR(this.explicit),eR(this.implicit),this.mainExtracted)}hasAxisPart(t){return!("axis"!==t&&("grid"===t||"title"===t?!this.get(t):!1===(n=this.get(t))||null===n));var n}hasOrientSignalRef(){return pq(this.explicit.orient)}}const u0={bottom:"top",top:"bottom",left:"right",right:"left"};function s0(t,n){if(!t)return n.map((t=>t.clone()));{if(t.length!==n.length)return;const e=t.length;for(let r=0;r<e;r++){const e=t[r],i=n[r];if(!!e!=!!i)return;if(e&&i){const n=e.getWithExplicit("orient"),o=i.getWithExplicit("orient");if(n.explicit&&o.explicit&&n.value!==o.value)return;t[r]=c0(e,i)}}}return t}function c0(t,n){for(const e of o0){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"axis",((t,n)=>{switch(e){case"title":return Pq(t,n);case"gridScale":return{explicit:t.explicit,value:TR(t.value,n.value)}}return eX(t,n,e,"axis")}));t.setWithExplicit(e,r)}return t}function l0(t,n,e,r,i){if("disable"===n)return void 0!==e;switch(e=e||{},n){case"titleAngle":case"labelAngle":return t===(pq(e.labelAngle)?e.labelAngle:IR(e.labelAngle));case"values":return!!e.values;case"encode":return!!e.encoding||!!e.labelAngle;case"title":if(t===vK(r,i))return!0}return t===e[n]}const f0=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function d0(t,n){let e=n.axis(t);const r=new a0,i=vG(n.encoding[t]),{mark:o,config:a}=n,u=e?.orient||a["x"===t?"axisX":"axisY"]?.orient||a.axis?.orient||function(t){return"x"===t?"bottom":"left"}(t),s=n.getScaleComponent(t).get("type"),c=function(t,n,e,r){const i="band"===n?["axisDiscrete","axisBand"]:"point"===n?["axisDiscrete","axisPoint"]:pW(n)?["axisQuantitative"]:"time"===n||"utc"===n?["axisTemporal"]:[],o="x"===t?"axisX":"axisY",a=pq(e)?"axisOrient":`axis${DR(e)}`,u=[...i,...i.map((t=>o+t.substr(4)))],s=["axis",a,o];return{vlOnlyAxisConfig:lK(u,r,t,e),vgAxisConfig:lK(s,r,t,e),axisConfigStyle:fK([...s,...u],r)}}(t,s,u,n.config),l=void 0!==e?!e:dK("disable",a.style,e?.style,c).configValue;if(r.set("disable",l,void 0!==e),l)return r;e=e||{};const f=function(t,n,e,r,i){const o=n?.labelAngle;if(void 0!==o)return pq(o)?o:IR(o);{const{configValue:o}=dK("labelAngle",r,n?.style,i);return void 0!==o?IR(o):e!==JR||!sR([eW,tW],t.type)||YH(t)&&t.timeUnit?void 0:270}}(i,e,t,a.style,c),d=AH(e.formatType,i,s),h=MH(i,i.type,e.format,e.formatType,a,!0),m={fieldOrDatumDef:i,axis:e,channel:t,model:n,scaleType:s,orient:u,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const i of o0){const o=i in hK?hK[i](m):_G(i)?e[i]:void 0,u=void 0!==o,s=l0(o,i,e,n,t);if(u&&s)r.set(i,o,s);else{const{configValue:t,configFrom:n}=_G(i)&&"values"!==i?dK(i,a.style,e.style,c):{},l=void 0!==t;u&&!l?r.set(i,o,s):("vgAxisConfig"!==n||f0.has(i)&&l||FG(t)||pq(t))&&r.set(i,t,!1)}}const p=e.encoding??{},g=EG.reduce(((e,i)=>{if(!r.hasAxisPart(i))return e;const o=LK(p[i]??{},n),a="labels"===i?function(t,n,e){const{encoding:r,config:i}=t,o=vG(r[n])??vG(r[nI(n)]),a=t.axis(n)||{},{format:u,formatType:s}=a;if(bH(s))return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:u,formatType:s,config:i}),...e};if(void 0===u&&void 0===s&&i.customFormatTypes){if("quantitative"===VH(o)){if(rG(o)&&"normalize"===o.stack&&i.normalizedNumberFormatType)return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...e};if(i.numberFormatType)return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...e}}if("temporal"===VH(o)&&i.timeFormatType&&YH(o)&&!o.timeUnit)return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...e}}return e}(n,t,o):o;return void 0===a||yR(a)||(e[i]={update:a}),e}),{});return yR(g)||r.set("encode",g,!!e.encoding||void 0!==e.labelAngle),r}function h0(t,n){const{config:e}=t;return{...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...uJ("size",t),...uJ("angle",t),...m0(t,0,n)}}function m0(t,n,e){return e?{shape:{value:e}}:uJ("shape",t)}function p0(t,n,e){if(void 0===Nq("align",t,e))return"center"}function g0(t,n,e){if(void 0===Nq("baseline",t,e))return"middle"}const v0={arc:{vgMark:"arc",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...wJ(t,"radius"),...wJ(t,"theta")})},area:{vgMark:"area",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...vJ("x",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===t.markDef.orient}),...vJ("y",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===t.markDef.orient}),...FJ(t)})},bar:{vgMark:"rect",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,"x"),...wJ(t,"y")})},circle:{vgMark:"symbol",encodeEntry:t=>h0(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:t=>{const{encoding:n}=t,e=n.shape;return[{type:"geoshape",projection:t.projectionName(),...e&&YH(e)&&e.type===rW?{field:uG(e,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,"x"),...wJ(t,"y"),...QX(t,"url")})},line:{vgMark:"line",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...uJ("size",t,{vgChannel:"strokeWidth"}),...FJ(t)})},point:{vgMark:"symbol",encodeEntry:t=>h0(t)},rect:{vgMark:"rect",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,"x"),...wJ(t,"y")})},rule:{vgMark:"rule",encodeEntry:t=>{const{markDef:n}=t,e=n.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?{...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...vJ("x",t,{defaultPos:"horizontal"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==e}),...vJ("y",t,{defaultPos:"vertical"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==e}),...uJ("size",t,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:t=>h0(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:n,encoding:e}=t;return{...AJ(t,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...QX(t),...uJ("size",t,{vgChannel:"fontSize"}),...uJ("angle",t),...EJ("align",p0(t.markDef,0,n)),...EJ("baseline",g0(t.markDef,0,n)),...fJ("radius",t,{defaultPos:null}),...fJ("theta",t,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:t=>{const{config:n,markDef:e}=t,r=e.orient,i="horizontal"===r?"x":"y",o="horizontal"===r?"y":"x",a="horizontal"===r?"height":"width";return{...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,i),...fJ(o,t,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:Mq(Nq("thickness",e,n))}}},trail:{vgMark:"trail",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...uJ("size",t),...FJ(t)})}};const y0="faceted_path_",b0="stack_group_";function w0(t,n={fromPrefix:""}){const{mark:e,markDef:r,encoding:i,config:o}=t,a=TR(r.clip,function(t){const n=t.getScaleComponent("x"),e=t.getScaleComponent("y");return!(!n?.get("selectionExtent")&&!e?.get("selectionExtent"))||void 0}(t),function(t){const n=t.component.projection;return!(!n||n.isFit)||void 0}(t)),u=Eq(r),s=i.key,c=function(t){const{encoding:n,stack:e,mark:r,markDef:i,config:o}=t,a=n.order;if(!(!S(a)&&nG(a)&&uR(a.value)||!a&&uR(Nq("order",i,o)))){if((S(a)||YH(a))&&!e)return zq(a,{expr:"datum"});if(XW(r)){const t="horizontal"===i.orient?"y":"x";if(YH(n[t]))return{field:t}}}}(t),l=function(t){if(!t.component.selection)return null;const n=bR(t.component.selection).length;let e=n,r=t.parent;for(;r&&0===e;)e=bR(r.component.selection).length,r=r.parent;return e?{interactive:n>0||"geoshape"===t.mark||!!t.encoding.tooltip||!!t.markDef.tooltip}:null}(t);l&&Object.values(t.component.selection).some((t=>"point"===t.type&&!t.bind&&"pointerover"!==t.on))&&(t.markDef.cursor??="pointer");const f=Nq("aria",r,o),d=v0[e].postEncodingTransform?v0[e].postEncodingTransform(t):null;return[{name:t.getName("marks"),type:v0[e].vgMark,...a?{clip:a}:{},...u?{style:u}:{},...s?{key:s.field}:{},...c?{sort:c}:{},...l||{},...!1===f?{aria:f}:{},from:{data:n.fromPrefix+t.requestDataName(dX.Main)},encode:{update:v0[e].encodeEntry(t)},...d?{transform:d}:{}}]}class x0 extends CZ{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(t,n,e,r={},i){super(t,"unit",n,e,i,void 0,OY(t)?t.view:void 0);const o=QW(t.mark)?{...t.mark}:{type:t.mark},a=o.type;void 0===o.filled&&(o.filled=function(t,n,{graticule:e}){if(e)return!1;const r=Cq("filled",t,n),i=t.type;return TR(r,i!==LW&&i!==RW&&i!==qW)}(o,i,{graticule:t.data&&fX(t.data)}));const u=this.encoding=function(t,n,e,r){const i={};for(const n of bR(t))JL(n)||vU(`${o=n}-encoding is dropped as ${o} is not a valid encoding channel.`);var o;for(let o of aI){if(!t[o])continue;const a=t[o];if(NI(o)){const t=oI(o),n=i[t];if(YH(n)&&KU(n.type)&&YH(a)&&!n.timeUnit){vU(Kq(t));continue}}if("angle"!==o||"arc"!==n||t.theta||(vU("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=iL),qG(t,o,n)){if(o===pL&&"line"===n){const n=gG(t[o]);if(n?.aggregate){vU("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===fL&&(e?"fill"in t:"stroke"in t))vU(Zq("encoding",{fill:"fill"in t,stroke:"stroke"in t}));else if(o===ML||o===kL&&!S(a)&&!nG(a)||o===DL&&S(a)){if(a){if(o===kL){const n=t[o];if(UH(n)){i[o]=n;continue}}i[o]=Q(a).reduce(((t,n)=>(YH(n)?t.push(wG(n,o)):vU(tU(n,o)),t)),[])}}else{if(o===DL&&null===a)i[o]=null;else if(!(YH(a)||XH(a)||nG(a)||WH(a)||pq(a))){vU(tU(a,o));continue}i[o]=yG(a,o,r)}}else vU(nU(o,n))}return i}(t.encoding||{},a,o.filled,i);this.markDef=rV(o,u,i),this.size=function({encoding:t,size:n}){for(const e of MI){const r=eI(e);CY(n[r])&&JH(t[e])&&(delete n[r],vU(cU(r)))}return n}({encoding:u,size:OY(t)?{...r,...void 0!==t.width?{width:t.width}:{},...void 0!==t.height?{height:t.height}:{}}:r}),this.stack=eV(this.markDef,u),this.specifiedScales=this.initScales(a,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter((t=>AY(t))),this.alignStackOrderWithColorDomain()}get hasProjection(){const{encoding:t}=this,n=this.mark===VW,e=t&&BL.some((n=>ZH(t[n])));return n||e}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return WI.reduce(((t,e)=>{const r=vG(n[e]);return r&&(t[e]=this.initScale(r.scale??{})),t}),{})}initScale(t){const{domain:n,range:e}=t,r=dq(t);return S(n)&&(r.domain=n.map($q)),S(e)&&(r.range=e.map($q)),r}initAxes(t){return MI.reduce(((n,e)=>{const r=t[e];if(ZH(r)||e===JR&&ZH(t.x2)||e===KR&&ZH(t.y2)){const t=ZH(r)?r.axis:void 0;n[e]=t?this.initAxis({...t}):t}return n}),{})}initAxis(t){const n=bR(t),e={};for(const r of n){const n=t[r];e[r]=FG(n)?xq(n):$q(n)}return e}initLegends(t){return qI.reduce(((n,e)=>{const r=vG(t[e]);if(r&&function(t){switch(t){case fL:case dL:case hL:case pL:case mL:case vL:case wL:case xL:return!0;case yL:case bL:case gL:case lL:return!1}}(e)){const t=r.legend;n[e]=t?dq(t):t}return n}),{})}alignStackOrderWithColorDomain(){const{color:t,fill:n,order:e,xOffset:r,yOffset:i}=this.encoding,o=n||t,a=YH(o)?o:void 0,u=a?.field,s=a?.scale,c=a?.type,l=s?.domain,f=r||i,d=YH(f)?f:void 0,h=`_${u}_sort_index`;if(!e&&Array.isArray(l)&&"string"==typeof u&&"nominal"===c)if(d&&!d.sort)d.sort=l;else{if(!this.stack)return;const t=`indexof(${Nt(l)}, datum['${u}'])`,n="horizontal"===this.markDef?.orient?"ascending":"descending";this.transforms.push({calculate:t,as:h}),this.encoding.order={field:h,type:"quantitative",sort:n}}}parseData(){this.component.data=n0(this)}parseLayoutSize(){!function(t){const{size:n,component:e}=t;for(const r of MI){const i=eI(r);if(null!=n[i]&&null!=n[i]){const t=n[i];e.layoutSize.set(i,CY(t)?"step":t,!0)}else{const n=KZ(t,i);e.layoutSize.set(i,n,!1)}}}(this)}parseSelections(){this.component.selection=function(t,n){const e={},r=t.config.selection;if(!n||!n.length)return e;let i=0;for(const o of n){const n=kR(o.name),a=o.select,u=$t(a)?a:a.type,s=F(a)?eR(a):{type:u},c=r[u];for(const t in c)"fields"!==t&&"encodings"!==t&&("mark"===t&&(s.mark={...c.mark,...s.mark}),void 0!==s[t]&&!0!==s[t]||(s[t]=eR(c[t]??s[t])));const l=e[n]={...s,name:n,type:u,init:o.value,bind:o.bind,events:$t(s.on)?eB(s.on,"scope"):Q(eR(s.on))};if(ZJ(l)&&(i++,i>1)){delete e[n];continue}const f=eR(o);for(const n of XJ)n.defined(l)&&n.parse&&n.parse(t,l,f)}return i>1&&vU("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),e}(this,this.selection)}parseMarkGroup(){this.component.mark=function(t){if(sR([RW,TW,HW],t.mark)){const n=HG(t.mark,t.encoding);if(n.length>0)return function(t,n){return[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:y0+t.requestDataName(dX.Main),data:t.requestDataName(dX.Main),groupby:n}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:w0(t,{fromPrefix:y0})}]}(t,n)}else if(t.mark===PW){const n=wq.some((n=>Nq(n,t.markDef,t.config)));if(t.stack&&!t.fieldDef("size")&&n)return function(t){const[n]=w0(t,{fromPrefix:b0}),e=t.scaleName(t.stack.fieldChannel),r=(n={})=>t.vgField(t.stack.fieldChannel,n),i=(t,n)=>`${t}(${[r({prefix:"min",suffix:"start",expr:n}),r({prefix:"max",suffix:"start",expr:n}),r({prefix:"min",suffix:"end",expr:n}),r({prefix:"max",suffix:"end",expr:n})].map((t=>`scale('${e}',${t})`)).join(",")})`;let o,a;"x"===t.stack.fieldChannel?(o={...iR(n.encode.update,["y","yc","y2","height",...wq]),x:{signal:i("min","datum")},x2:{signal:i("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...oR(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...iR(n.encode.update,["x","xc","x2","width"]),y:{signal:i("min","datum")},y2:{signal:i("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...oR(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const e of wq){const r=Cq(e,t.markDef,t.config);n.encode.update[e]?(o[e]=n.encode.update[e],delete n.encode.update[e]):r&&(o[e]=Mq(r)),r&&(n.encode.update[e]={value:0})}const u=[];if(t.stack.groupbyChannels?.length>0)for(const n of t.stack.groupbyChannels){const e=t.fieldDef(n),r=uG(e);r&&u.push(r),(e?.bin||e?.timeUnit)&&u.push(uG(e,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((e,r)=>{if(n.encode.update[r])return{...e,[r]:n.encode.update[r]};{const n=Cq(r,t.markDef,t.config);return void 0!==n?{...e,[r]:Mq(n)}:e}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:t.requestDataName(dX.Main),name:b0+t.requestDataName(dX.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}(t)}return w0(t)}(this)}parseAxesAndHeaders(){var t;this.component.axes=(t=this,MI.reduce(((n,e)=>(t.component.scales[e]&&(n[e]=[d0(e,t)]),n)),{}))}assembleSelectionTopLevelSignals(t){return function(t,n){let e=!1;for(const r of wR(t.component.selection??{})){const i=r.name,o=Nt(i+HJ);if(0===n.filter((t=>t.name===i)).length){const t="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${VJ}(${o}, ${Nt("global"===r.resolve?"union":r.resolve)}${t}`})}e=!0;for(const e of XJ)e.defined(r)&&e.topLevelSignals&&(n=e.topLevelSignals(t,r,n))}return e&&0===n.filter((t=>"unit"===t.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),qX(n)}(this,t)}assembleSignals(){return[...cK(this),...RX(this,[])]}assembleSelectionData(t){return function(t,n){const e=[],r=[],i=JJ(t,{escape:!1});for(const o of wR(t.component.selection??{})){const a={name:o.name+HJ};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:xY}}]),o.init){const t=o.project.items.map(PX);a.values=o.init.map(o.project.hasSelectionId?t=>({unit:i,[xY]:jX(t,!1)[0]}):n=>({unit:i,fields:t,values:jX(n,!1)}))}if([...e,...n].filter((t=>t.name===o.name+HJ)).length||e.push(a),ZJ(o)&&n.length){const e=t.lookupDataSource(t.getDataName(dX.Main)),i=n.find((t=>t.name===e)),o=i.transform.find((t=>"filter"===t.type&&t.expr.includes("vlSelectionTest")));o&&(i.transform=i.transform.filter((t=>t!==o)),r.push({name:i.name+SX,source:i.name,transform:[o]}))}}return e.concat(n,r)}(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return BK(this)}correctDataNames=t=>(t.from?.data&&(t.from.data=this.lookupDataSource(t.from.data),"time"in this.encoding&&(t.from.data=t.from.data+SX)),t.from?.facet?.data&&(t.from.facet.data=this.lookupDataSource(t.from.facet.data)),t);assembleMarks(){let t=this.component.mark??[];return this.parent&&EZ(this.parent)||(t=IX(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return void 0!==t?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return PG(this.encoding,t)}fieldDef(t){return gG(this.encoding[t])}typedFieldDef(t){const n=this.fieldDef(t);return tG(n)?n:null}}class $0 extends NZ{children;constructor(t,n,e,r,i){super(t,"layer",n,e,i,t.resolve,t.view);const o={...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map(((t,n)=>{if(XY(t))return new $0(t,this,this.getName(`layer_${n}`),o,i);if(BG(t))return new x0(t,this,this.getName(`layer_${n}`),o,i);throw new Error(jq(t))}))}parseData(){this.component.data=n0(this);for(const t of this.children)t.parseData()}parseLayoutSize(){XZ(this),JZ(this,"width"),JZ(this,"height")}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of bR(t.component.selection))this.component.selection[n]=t.component.selection[n]}wR(this.component.selection).some((t=>ZJ(t)))&&gU(Yq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){!function(t){const{axes:n,resolve:e}=t.component,r={top:0,bottom:0,right:0,left:0};for(const r of t.children){r.parseAxesAndHeaders();for(const i of bR(r.component.axes))e.axis[i]=qK(t.component.resolve,i),"shared"===e.axis[i]&&(n[i]=s0(n[i],r.component.axes[i]),n[i]||(e.axis[i]="independent",delete n[i]))}for(const i of MI){for(const o of t.children)if(o.component.axes[i]){if("independent"===e.axis[i]){n[i]=(n[i]??[]).concat(o.component.axes[i]);for(const t of o.component.axes[i]){const{value:n,explicit:e}=t.getWithExplicit("orient");if(!pq(n)){if(r[n]>0&&!e){const e=u0[n];r[n]>r[e]&&t.set("orient",e,!1)}r[n]++}}}delete o.component.axes[i]}if("independent"===e.axis[i]&&n[i]&&n[i].length>1)for(const[t,e]of(n[i]||[]).entries())t>0&&e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleSignals())),cK(this))}assembleLayoutSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleLayoutSignals())),BK(this))}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleGroupStyle(){const t=new Set;for(const n of this.children)for(const e of Q(n.assembleGroupStyle()))t.add(e);const n=Array.from(t);return n.length>1?n:1===n.length?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return function(t,n){for(const e of t.children)DZ(e)&&(n=IX(e,n));return n}(this,this.children.flatMap((t=>t.assembleMarks())))}assembleLegends(){return this.children.reduce(((t,n)=>t.concat(n.assembleLegends())),rQ(this))}}function k0(t,n,e,r,i){if(PH(t))return new ZZ(t,n,e,i);if(XY(t))return new $0(t,n,e,r,i);if(BG(t))return new x0(t,n,e,r,i);if(function(t){return FY(t)||EY(t)||SY(t)}(t))return new r0(t,n,e,i);throw new Error(jq(t))}var M0,A0,D0=Object.freeze({__proto__:null,accessPathDepth:BR,accessPathWithDatum:SR,accessWithDatumToUnescapedPath:ER,compile:function(t,n={}){n.logger&&(pU=n.logger),n.fieldTitle&&fG(n.fieldTitle);try{const e=WY(N(n.config,t.config)),r=HV(t,e),i=k0(r,null,"",void 0,e);i.parse(),function(t,n){HQ(t.sources);let e=0,r=0;for(let r=0;r<5&&YQ(t,n,!0);r++)e++;t.sources.map(qQ);for(let e=0;e<5&&YQ(t,n,!1);e++)r++;HQ(t.sources),5===Math.max(e,r)&&vU("Maximum optimization runs(5) reached.")}(i.component.data,i);const o=function(t,n,e={},r){const i=t.config?function(t){t=eR(t);for(const n of GY)delete t[n];if(t.axis)for(const n in t.axis)FG(t.axis[n])&&delete t.axis[n];if(t.legend)for(const n of mY)delete t.legend[n];if(t.mark){for(const n of tH)delete t.mark[n];t.mark.tooltip&&F(t.mark.tooltip)&&delete t.mark.tooltip}t.params&&(t.signals=(t.signals||[]).concat(DY(t.params)),delete t.params);for(const n of HY){for(const e of tH)delete t[n][e];const e=YY[n];if(e)for(const r of e)delete t[n][r];VY(t,n)}for(const n of bR(dY))delete t[n];!function(t){const{titleMarkConfig:n,subtitleMarkConfig:e,subtitle:r}=hq(t.title);yR(n)||(t.style["group-title"]={...t.style["group-title"],...n}),yR(e)||(t.style["group-subtitle"]={...t.style["group-subtitle"],...e}),yR(r)?delete t.title:t.title=r}(t);for(const n in t)F(t[n])&&yR(t[n])&&delete t[n];return yR(t)?void 0:t}(t.config):void 0,o=function(t,n){const e=[],r=HZ(e);let i=0;for(const n of t.sources){n.hasName()||(n.dataName="source_"+i++);const t=n.assemble();r(n,t)}for(const t of e)0===t.transform.length&&delete t.transform;let o=0;for(const[t,n]of e.entries())0!==(n.transform??[]).length||n.source||e.splice(o++,0,e.splice(t,1)[0]);for(const n of e)for(const e of n.transform??[])"lookup"===e.type&&(e.from=t.outputNodes[e.from].getSource());for(const t of e)t.name in n&&(t.values=n[t.name]);return e}(t.component.data,e),a=t.assembleSelectionData(o),u=t.assembleProjections(),s=t.assembleTitle(),c=t.assembleGroupStyle(),l=t.assembleGroupEncodeEntry(!0);let f=t.assembleLayoutSignals();f=f.filter((t=>"width"!==t.name&&"height"!==t.name||void 0===t.value||(n[t.name]=+t.value,!1)));const{params:d,...h}=n;return{$schema:"https://vega.github.io/schema/vega/v6.json",...t.description?{description:t.description}:{},...h,...s?{title:s}:{},...c?{style:c}:{},...l?{encode:{update:l}}:{},data:a,...u.length>0?{projections:u}:{},...t.assembleGroup([...f,...t.assembleSelectionTopLevelSignals([]),...DY(d)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}(i,function(t,n,e,r){const i=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");if(void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):$t(n)&&(n={type:n}),i&&o&&["fit","fit-x","fit-y"].includes(n.type))if("step"===i&&"step"===o)vU(Iq()),n.type="pad";else if("step"===i||"step"===o){const t="step"===i?"width":"height";vU(Iq(FI(t))),n.type=function(t){return t?`fit-${FI(t)}`:"fit"}("width"===t?"height":"width")}return{...1===bR(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...KV(e,!1),...KV(t,!0)}}(t,r.autosize,e,i),t.datasets,t.usermeta);return{spec:o,normalized:r}}finally{n.logger&&(pU=mU),n.fieldTitle&&fG(cG)}},contains:sR,deepEqual:WR,deleteNestedProperty:AR,duplicate:eR,entries:xR,every:lR,fieldIntersection:vR,flatAccessWithDatum:FR,getFirstDefined:TR,hasIntersection:pR,hasProperty:GR,hash:aR,internalField:RR,isBoolean:$R,isEmpty:yR,isEqual:function(t,n){const e=bR(t),r=bR(n);if(e.length!==r.length)return!1;for(const r of e)if(t[r]!==n[r])return!1;return!0},isInternalField:LR,isNullOrFalse:uR,isNumeric:qR,keys:bR,logicalExpr:MR,mergeDeep:fR,never:rR,normalize:HV,normalizeAngle:IR,omit:oR,pick:iR,prefixGenerator:gR,removePathFromField:zR,replaceAll:_R,replacePathInField:OR,resetIdCounter:function(){PR=42},setEqual:mR,some:cR,stringify:HR,titleCase:DR,unescapeSingleQuoteAndPathDot:NR,unique:hR,uniqueId:jR,vals:wR,varName:kR,version:"6.4.1"});function S0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F0=S0(A0?M0:(A0=1,M0=function(t){var n=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(t).slice(1,3);return{library:n[0],version:n[1]}}));const E0="#fff",N0="#888",C0={background:"#333",view:{stroke:N0},title:{color:E0,subtitleColor:E0},style:{"guide-label":{fill:E0},"guide-title":{fill:E0}},axis:{domainColor:E0,gridColor:N0,tickColor:E0}},O0="#4572a7",_0={background:"#fff",arc:{fill:O0},area:{fill:O0},line:{stroke:O0,strokeWidth:2},path:{stroke:O0},rect:{fill:O0},shape:{stroke:O0},symbol:{fill:O0,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"]}},z0="#30a2da",B0="#cbcbcb",T0="#f0f0f0",P0="#333",j0={arc:{fill:z0},area:{fill:z0},axis:{domainColor:B0,grid:!0,gridColor:B0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:B0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:T0,group:{fill:T0},legend:{labelColor:P0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:P0,titleFontSize:14,titlePadding:10},line:{stroke:z0,strokeWidth:2},path:{stroke:z0,strokeWidth:.5},rect:{fill:z0},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:z0},bar:{binSpacing:2,fill:z0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},R0="#000",L0={group:{fill:"#e5e5e5"},arc:{fill:R0},area:{fill:R0},line:{stroke:R0},path:{stroke:R0},rect:{fill:R0},shape:{stroke:R0},symbol:{fill:R0,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"]}},I0="Benton Gothic, sans-serif",q0="#82c6df",U0="Benton Gothic Bold, sans-serif",W0="normal",H0={"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"]},G0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:U0,fontSize:22,fontWeight:"normal"},arc:{fill:q0},area:{fill:q0},line:{stroke:q0,strokeWidth:2},path:{stroke:q0},rect:{fill:q0},shape:{stroke:q0},symbol:{fill:q0,size:30},axis:{labelFont:I0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:U0,titleFontSize:13,titleFontWeight:W0},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:I0,labelFontSize:11.5,symbolType:"square",titleFont:U0,titleFontSize:13,titleFontWeight:W0},range:{category:H0["category-6"],diverging:H0["fireandice-6"],heatmap:H0["fire-7"],ordinal:H0["fire-7"],ramp:H0["fire-7"]}},Y0="#ab5787",V0="#979797",X0={background:"#f9f9f9",arc:{fill:Y0},area:{fill:Y0},line:{stroke:Y0},path:{stroke:Y0},rect:{fill:Y0},shape:{stroke:Y0},symbol:{fill:Y0,size:30},axis:{domainColor:V0,domainWidth:.5,gridWidth:.2,labelColor:V0,tickColor:V0,tickWidth:.2,titleColor:V0},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"]}},J0="#3e5c69",K0={background:"#fff",arc:{fill:J0},area:{fill:J0},line:{stroke:J0},path:{stroke:J0},rect:{fill:J0},shape:{stroke:J0},symbol:{fill:J0},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"]}},Q0="#1696d2",Z0="#000000",t1="Lato",n1="Lato",e1={"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"]},r1={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:t1},axisX:{domain:!0,domainColor:Z0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:n1,labelAngle:0,tickColor:Z0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:t1},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:n1,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:t1,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:n1,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:t1,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:e1["six-groups-cat-1"],diverging:e1["diverging-colors"],heatmap:e1["diverging-colors"],ordinal:e1["six-groups-seq"],ramp:e1["shades-blue"]},area:{fill:Q0},rect:{fill:Q0},line:{color:Q0,stroke:Q0,strokeWidth:5},trail:{color:Q0,stroke:Q0,strokeWidth:0,size:1},path:{stroke:Q0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:Q0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:Q0,stroke:null}},arc:{fill:Q0},shape:{stroke:Q0},symbol:{fill:Q0,size:30}},i1="#3366CC",o1="#ccc",a1="Arial, sans-serif",u1={arc:{fill:i1},area:{fill:i1},path:{stroke:i1},rect:{fill:i1},shape:{stroke:i1},symbol:{stroke:i1},circle:{fill:i1},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:a1,fontSize:12},"guide-title":{font:a1,fontSize:12},"group-title":{font:a1,fontSize:12}},title:{font:a1,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:o1,tickColor:o1,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},s1=t=>t*(1/3+1),c1=s1(9),l1=s1(10),f1=s1(12),d1="Segoe UI",h1="wf_standard-font, helvetica, arial, sans-serif",m1="#252423",p1="#605E5C",g1="transparent",v1="#118DFF",y1="#DEEFFF",b1=[y1,v1],w1={view:{stroke:g1},background:g1,font:d1,header:{titleFont:h1,titleFontSize:f1,titleColor:m1,labelFont:d1,labelFontSize:l1,labelColor:p1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:p1,labelFontSize:c1,titleFont:h1,titleColor:m1,titleFontSize:f1,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:v1},line:{stroke:v1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:d1,fontSize:c1,fill:p1},arc:{fill:v1},area:{fill:v1,line:!0,opacity:.6},path:{stroke:v1},rect:{fill:v1},point:{fill:v1,filled:!0,size:75},shape:{stroke:v1},symbol:{fill:v1,strokeWidth:1.5,size:50},legend:{titleFont:d1,titleFontWeight:"bold",titleColor:p1,labelFont:d1,labelFontSize:l1,labelColor:p1,symbolType:"circle",symbolSize:75},range:{category:[v1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:b1,heatmap:b1,ordinal:[y1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",v1]}},x1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',$1={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"}},k1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],M1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function A1({theme:t,background:n}){const e=["white","g10"].includes(t)?"light":"dark",r=$1.gridBg[t],i=$1.textPrimary[t],o=$1.textSecondary[t],a="dark"===e?"#d4bbff":"#6929c4";return{background:n,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:x1,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:$1.layerAccent01[t],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:x1,fill:o,fontWeight:400},"guide-title":{font:x1,fill:o,fontWeight:400}},range:{category:"dark"===e?k1:M1,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 D1=A1({theme:"white",background:"#ffffff"}),S1=A1({theme:"g10",background:"#f4f4f4"}),F1=A1({theme:"g90",background:"#262626"}),E1=A1({theme:"g100",background:"#161616"});var N1=Object.freeze({__proto__:null,carbong10:S1,carbong100:E1,carbong90:F1,carbonwhite:D1,dark:C0,excel:_0,fivethirtyeight:j0,ggplot2:L0,googlecharts:u1,latimes:G0,powerbi:w1,quartz:X0,urbaninstitute:r1,version:"3.0.0",vox:K0});function C1(t,n){return JSON.stringify(t,function(t){const n=[];return function(e,r){if("object"!=typeof r||null===r)return r;const i=n.indexOf(this)+1;return n.length=i,n.length>t?"[Object]":n.indexOf(r)>=0?"[Circular]":(n.push(r),r)}}(n))}const O1="vg-tooltip-element",_1={offsetX:10,offsetY:10,id:O1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(t,n,e,r){if(S(t))return`[${t.map((t=>n($t(t)?t:C1(t,e)))).join(", ")}]`;if(F(t)){let i="";const{title:o,image:a,...u}=t;o&&(i+=`<h2>${n(o)}</h2>`),a&&(i+=`<img src="${new URL(n(a),r||location.href).href}">`);const s=Object.keys(u);if(s.length>0){i+="<table>";for(const t of s){let r=u[t];void 0!==r&&(F(r)&&(r=C1(r,e)),i+=`<tr><td class="key">${n(t)}</td><td class="value">${n(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return n(t)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function z1(t,n,{offsetX:e,offsetY:r}){const i=B1({x1:t.clientX,x2:t.clientX,y1:t.clientY,y2:t.clientY},n,e,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const t of o)if(T1(i[t],n))return i[t];return i["top-left"]}function B1(t,n,e,r){const i=t.x1-n.width-e,o=(t.x1+t.x2)/2-n.width/2,a=t.x2+e,u=t.y1-n.height-r,s=(t.y1+t.y2)/2-n.height/2,c=t.y2+r;return{top:{x:o,y:u},bottom:{x:o,y:c},left:{x:i,y:s},right:{x:a,y:s},"top-left":{x:i,y:u},"top-right":{x:a,y:u},"bottom-left":{x:i,y:c},"bottom-right":{x:a,y:c}}}function T1(t,n){return t.x>=0&&t.y>=0&&t.x+n.width<=window.innerWidth&&t.y+n.height<=window.innerHeight}function P1(t,n,e){return t.clientX>=n.x&&t.clientX<=n.x+e.width&&t.clientY>=n.y&&t.clientY<=n.y+e.height}class j1{call;options;el;constructor(t){this.options={..._1,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=function(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\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}\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.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".toString().replaceAll(O1,t)}(n);const e=document.head;e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}}tooltipHandler(t,n,e,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)),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(t,n,e,r,i){const{position:o,offsetX:a,offsetY:u}=i,s=function(t,n,e){const r=e.isVoronoi?e.datum.bounds:e.bounds;let i=t.left+n[0]+r.x1,o=t.top+n[1]+r.y1,a=e;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)}}(t._el.getBoundingClientRect(),t._origin,e),c=B1(s,r,a,u),l=Array.isArray(o)?o:[o];for(const t of l)if(T1(c[t],r)&&!P1(n,c[t],r))return c[t];return z1(n,r,i)}(t,n,e,this.el.getBoundingClientRect(),this.options):z1(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}
1
+ import{r as t,c as n,h as e,g as r}from"./p-WPqt-wWR.js";import{a as i,D as o,t as a}from"./p-C-o-YsN6.js";const u=/("(?:[^\\"]|\\.)*")|[:,]/g;function s(t,n={}){const e=JSON.stringify([1],void 0,void 0===n.indent?2:n.indent).slice(2,-3),r=""===e?1/0:void 0===n.maxLength?80:n.maxLength;let{replacer:i}=n;return function t(n,o,a){n&&"function"==typeof n.toJSON&&(n=n.toJSON());const s=JSON.stringify(n,i);if(void 0===s)return s;const c=r-o.length-a;if(s.length<=c){const t=s.replace(u,((t,n)=>n||`${t} `));if(t.length<=c)return t}if(null!=i&&(n=JSON.parse(s),i=void 0),"object"==typeof n&&null!==n){const r=o+e,i=[];let a,u,s=0;if(Array.isArray(n)){a="[",u="]";const{length:e}=n;for(;s<e;s++)i.push(t(n[s],r,s===e-1?0:1)||"null")}else{a="{",u="}";const e=Object.keys(n),{length:o}=e;for(;s<o;s++){const a=e[s],u=`${JSON.stringify(a)}: `,c=t(n[a],r,u.length+(s===o-1?0:1));void 0!==c&&i.push(u+c)}}if(i.length>0)return[a,e+i.join(`,\n${r}`),u].join(`\n${o}`)}return s}(t,"",0)}function c(t,n,e){return t.fields=n||[],t.fname=e,t}function l(t){return null==t?null:t.fname}function f(t){return null==t?null:t.fields}function d(t){return 1===t.length?h(t[0]):m(t)}const h=t=>function(n){return n[t]},m=t=>{const n=t.length;return function(e){for(let r=0;r<n;++r)e=e[t[r]];return e}};function p(t){throw Error(t)}function g(t){const n=[],e=t.length;let r,i,o,a=null,u=0,s="";function c(){n.push(s+t.substring(r,i)),s="",r=i+1}for(t+="",r=i=0;i<e;++i)if(o=t[i],"\\"===o)s+=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||p("Access path missing open bracket: "+t),u>0&&c(),u=0,r=i+1):i>r?c():r=i+1}return u&&p("Access path missing closing bracket: "+t),a&&p("Access path missing closing quote: "+t),i>r&&(i++,c()),n}function v(t,n,e){const r=g(t);return t=1===r.length?r[0]:t,c((e&&e.get||d)(r),[t],n||t)}const y=v("id"),b=c((t=>t),[],"identity"),w=c((()=>0),[],"zero"),x=c((()=>1),[],"one"),$=c((()=>!0),[],"true"),k=c((()=>!1),[],"false"),M=new Set([...Object.getOwnPropertyNames(Object.prototype).filter((t=>"function"==typeof Object.prototype[t])),"__proto__"]);function A(t,n,e){const r=[n].concat([].slice.call(e));console[t].apply(console,r)}function D(t,n,e=A){let r=t||0;return{level(t){return arguments.length?(r=+t,this):r},error(){return r>=1&&e(n||"error","ERROR",arguments),this},warn(){return r>=2&&e(n||"warn","WARN",arguments),this},info(){return r>=3&&e(n||"log","INFO",arguments),this},debug(){return r>=4&&e(n||"log","DEBUG",arguments),this}}}var S=Array.isArray;function F(t){return t===Object(t)}const E=t=>"__proto__"!==t;function N(...t){return t.reduce(((t,n)=>{for(const e in n)"signals"===e?t.signals=O(t.signals,n.signals):C(t,e,n[e],"legend"===e?{layout:1}:"style"===e||null);return t}),{})}function C(t,n,e,r){if(!E(n))return;let i,o;if(F(e)&&!S(e))for(i in o=F(t[n])?t[n]:t[n]={},e)r&&(!0===r||r[i])?C(o,i,e[i]):E(i)&&(o[i]=e[i]);else t[n]=e}function O(t,n){if(null==t)return n;const e={},r=[];function i(t){e[t.name]||(e[t.name]=1,r.push(t))}return n.forEach(i),t.forEach(i),r}function _(t){return t[t.length-1]}function z(t){return null==t||""===t?null:+t}const B=t=>n=>t*Math.exp(n),T=t=>n=>Math.log(t*n),P=t=>n=>Math.sign(n)*Math.log1p(Math.abs(n/t)),j=t=>n=>Math.sign(n)*Math.expm1(Math.abs(n))*t,R=t=>n=>n<0?-Math.pow(-n,t):Math.pow(n,t);function L(t,n,e,r){const i=e(t[0]),o=e(_(t)),a=(o-i)*n;return[r(i-a),r(o-a)]}function I(t,n){return L(t,n,z,b)}function q(t,n){var e=Math.sign(t[0]);return L(t,n,T(e),B(e))}function U(t,n,e){return L(t,n,R(e),R(1/e))}function W(t,n,e){return L(t,n,P(e),j(e))}function H(t,n,e,r,i){const o=r(t[0]),a=r(_(t)),u=null!=n?r(n):(o+a)/2;return[i(u+(o-u)*e),i(u+(a-u)*e)]}function G(t,n,e){return H(t,n,e,z,b)}function Y(t,n,e){const r=Math.sign(t[0]);return H(t,n,e,T(r),B(r))}function V(t,n,e,r){return H(t,n,e,R(r),R(1/r))}function X(t,n,e,r){return H(t,n,e,P(r),j(r))}function J(t){return 1+~~(new Date(t).getMonth()/3)}function K(t){return 1+~~(new Date(t).getUTCMonth()/3)}function Q(t){return null!=t?S(t)?t:[t]:[]}function Z(t,n,e){let r,i=t[0],o=t[1];return o<i&&(r=o,o=i,i=r),r=o-i,r>=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function tt(t){return"function"==typeof t}function nt(t,n,e){e=e||{},n=Q(n)||[];const r=[],i=[],o={},a=e.comparator||rt;return Q(t).forEach(((t,a)=>{null!=t&&(r.push("descending"===n[a]?-1:1),i.push(t=tt(t)?t:v(t,null,e)),(f(t)||[]).forEach((t=>o[t]=1)))})),0===i.length?null:c(a(i,r),Object.keys(o))}const et=(t,n)=>(t<n||null==t)&&null!=n?-1:(t>n||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0),rt=(t,n)=>1===t.length?it(t[0],n[0]):ot(t,n,t.length),it=(t,n)=>function(e,r){return et(t(e),t(r))*n},ot=(t,n,e)=>(n.push(0),function(r,i){let o,a=0,u=-1;for(;0===a&&++u<e;)o=t[u],a=et(o(r),o(i));return a*n[u]});function at(t){return tt(t)?t:()=>t}function ut(t,n){let e;return r=>{e&&clearTimeout(e),e=setTimeout((()=>(n(r),e=null)),t)}}function st(t){for(let n,e,r=1,i=arguments.length;r<i;++r)for(e in n=arguments[r],n)t[e]=n[e];return t}function ct(t,n){let e,r,i,o,a=0;if(t&&(e=t.length))if(null==n){for(r=t[a];a<e&&(null==r||r!=r);r=t[++a]);for(i=o=r;a<e;++a)r=t[a],null!=r&&(r<i&&(i=r),r>o&&(o=r))}else{for(r=n(t[a]);a<e&&(null==r||r!=r);r=n(t[++a]));for(i=o=r;a<e;++a)r=n(t[a]),null!=r&&(r<i&&(i=r),r>o&&(o=r))}return[i,o]}function lt(t,n){const e=t.length;let r,i,o,a,u,s=-1;if(null==n){for(;++s<e;)if(i=t[s],null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=t[s],null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}else{for(;++s<e;)if(i=n(t[s],s,t),null!=i&&i>=i){r=o=i;break}if(s===e)return[-1,-1];for(a=u=s;++s<e;)i=n(t[s],s,t),null!=i&&(r>i&&(r=i,a=s),o<i&&(o=i,u=s))}return[a,u]}function ft(t,n){return Object.hasOwn(t,n)}const dt={};function ht(t){let n,e={};function r(t){return ft(e,t)&&e[t]!==dt}const i={size:0,empty:0,object:e,has:r,get:t=>r(t)?e[t]:void 0,set(t,n){return r(t)||(++i.size,e[t]===dt&&--i.empty),e[t]=n,this},delete(t){return r(t)&&(--i.size,++i.empty,e[t]=dt),this},clear(){i.size=i.empty=0,i.object=e={}},test(t){return arguments.length?(n=t,i):n},clean(){const t={};let r=0;for(const i in e){const o=e[i];o===dt||n&&n(o)||(t[i]=o,++r)}i.size=r,i.empty=0,i.object=e=t}};return t&&Object.keys(t).forEach((n=>{i.set(n,t[n])})),i}function mt(t,n,e,r,i,o){if(!e&&0!==e)return o;const a=+e;let u,s=t[0],c=_(t);c<s&&(u=s,s=c,c=u),u=Math.abs(n-s);const l=Math.abs(c-n);return u<l&&u<=a?r:l<=a?i:o}function pt(t,n,e){const r=t.prototype=Object.create(n.prototype);return Object.defineProperty(r,"constructor",{value:t,writable:!0,enumerable:!0,configurable:!0}),st(r,e)}function gt(t,n,e,r){let i,o=n[0],a=n[n.length-1];return o>a&&(i=o,o=a,a=i),r=void 0===r||r,((e=void 0===e||e)?o<=t:o<t)&&(r?t<=a:t<a)}function vt(t){return"boolean"==typeof t}function yt(t){return"[object Date]"===Object.prototype.toString.call(t)}function bt(t){return t&&tt(t[Symbol.iterator])}function wt(t){return"number"==typeof t}function xt(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function $t(t){return"string"==typeof t}function kt(t,n,e){t&&(t=n?Q(t).map((t=>t.replace(/\\(.)/g,"$1"))):Q(t));const r=t&&t.length,i=e&&e.get||d,o=t=>i(n?[t]:g(t));let a;if(r)if(1===r){const n=o(t[0]);a=function(t){return""+n(t)}}else{const n=t.map(o);a=function(t){let e=""+n[0](t),i=0;for(;++i<r;)e+="|"+n[i](t);return e}}else a=function(){return""};return c(a,t,"key")}function Mt(t,n){const e=t[0],r=_(t),i=+n;return i?1===i?r:e+i*(r-e):e}function At(t){let n,e,r;t=+t||1e4;const i=()=>{n={},e={},r=0},o=(i,o)=>(++r>t&&(e=n,n={},r=1),n[i]=o);return i(),{clear:i,has:t=>ft(n,t)||ft(e,t),get:t=>ft(n,t)?n[t]:ft(e,t)?o(t,e[t]):void 0,set:(t,e)=>ft(n,t)?n[t]=e:o(t,e)}}function Dt(t,n,e,r){const i=n.length,o=e.length;if(!o)return n;if(!i)return e;const a=r||new n.constructor(i+o);let u=0,s=0,c=0;for(;u<i&&s<o;++c)a[c]=t(n[u],e[s])>0?e[s++]:n[u++];for(;u<i;++u,++c)a[c]=n[u];for(;s<o;++s,++c)a[c]=e[s];return a}function St(t,n){let e="";for(;--n>=0;)e+=t;return e}function Ft(t,n,e,r){const i=e||" ",o=t+"",a=n-o.length;return a<=0?o:"left"===r?St(i,a)+o:"center"===r?St(i,~~(a/2))+o+St(i,Math.ceil(a/2)):o+St(i,a)}function Et(t){return t&&_(t)-t[0]||0}function Nt(t){return S(t)?`[${t.map((t=>null===t?"null":Nt(t)))}]`:F(t)||$t(t)?JSON.stringify(t).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029"):t}function Ct(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t||!t)}const Ot=t=>wt(t)||yt(t)?t:Date.parse(t);function _t(t,n){return n=n||Ot,null==t||""===t?null:n(t)}function zt(t){return null==t||""===t?null:t+""}function Bt(t){const n={},e=t.length;for(let r=0;r<e;++r)n[t[r]]=!0;return n}function Tt(t,n,e,r){const i=null!=r?r:"…",o=t+"",a=o.length,u=Math.max(0,n-i.length);return a<=n?o:"left"===e?i+o.slice(a-u):"center"===e?o.slice(0,Math.ceil(u/2))+i+o.slice(a-~~(u/2)):o.slice(0,u)+i}function Pt(t,n,e){if(t)if(n){const r=t.length;for(let i=0;i<r;++i){const r=n(t[i]);r&&e(r,i,t)}}else t.forEach(e)}var jt={},Rt={};function Lt(t){return new Function("d","return {"+t.map((function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'})).join(",")+"}")}function It(t){var n=Object.create(null),e=[];return t.forEach((function(t){for(var r in t)r in n||e.push(n[r]=r)})),e}function qt(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function Ut(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],o=t.length,a=0,u=0,s=o<=0,c=!1;function l(){if(s)return Rt;if(c)return c=!1,jt;var n,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(n=a)>=o?s=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,n-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(n=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==e)continue;return t.slice(i,n)}return s=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=l())!==Rt;){for(var f=[];r!==jt&&r!==Rt;)f.push(r),r=l();n&&null==(f=n(f,u++))||i.push(f)}return i}function i(n,e){return n.map((function(n){return e.map((function(t){return a(n[t])})).join(t)}))}function o(n){return n.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?function(t){var n=t.getUTCHours(),e=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+qt(-t,6):t>9999?"+"+qt(t,6):qt(t,4)}(t.getUTCFullYear())+"-"+qt(t.getUTCMonth()+1,2)+"-"+qt(t.getUTCDate(),2)+(i?"T"+qt(n,2)+":"+qt(e,2)+":"+qt(r,2)+"."+qt(i,3)+"Z":r?"T"+qt(n,2)+":"+qt(e,2)+":"+qt(r,2)+"Z":e||n?"T"+qt(n,2)+":"+qt(e,2)+"Z":"")}(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,o=r(t,(function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=Lt(t);return function(r,i){return n(e(r),i,t)}}(t,n):Lt(t)}));return o.columns=i||[],o},parseRows:r,format:function(n,e){return null==e&&(e=It(n)),[e.map(a).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=It(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}function Wt(t){return t}function Ht(t,n){return"string"==typeof n&&(n=t.objects[n]),"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map((function(n){return Gt(t,n)}))}:Gt(t,n)}function Gt(t,n){var e=n.id,r=n.bbox,i=null==n.properties?{}:n.properties,o=Yt(t,n);return null==e&&null==r?{type:"Feature",properties:i,geometry:o}:null==r?{type:"Feature",id:e,properties:i,geometry:o}:{type:"Feature",id:e,bbox:r,properties:i,geometry:o}}function Yt(t,n){var e=function(t){if(null==t)return Wt;var n,e,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,u){u||(n=e=0);var s=2,c=t.length,l=new Array(c);for(l[0]=(n+=t[0])*r+o,l[1]=(e+=t[1])*i+a;s<c;)l[s]=t[s],++s;return l}}(t.transform),r=t.arcs;function i(t,n){n.length&&n.pop();for(var i=r[t<0?~t:t],o=0,a=i.length;o<a;++o)n.push(e(i[o],o));t<0&&function(t,n){for(var e,r=t.length,i=r-n;i<--r;)e=t[i],t[i++]=t[r],t[r]=e}(n,a)}function o(t){return e(t)}function a(t){for(var n=[],e=0,r=t.length;e<r;++e)i(t[e],n);return n.length<2&&n.push(n[0]),n}function u(t){for(var n=a(t);n.length<4;)n.push(n[0]);return n}function s(t){return t.map(u)}return function t(n){var e,r=n.type;switch(r){case"GeometryCollection":return{type:r,geometries:n.geometries.map(t)};case"Point":e=o(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(o);break;case"LineString":e=a(n.arcs);break;case"MultiLineString":e=n.arcs.map(a);break;case"Polygon":e=s(n.arcs);break;case"MultiPolygon":e=n.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}(n)}function Vt(t,n){var e={},r={},i={},o=[],a=-1;function u(t,n){for(var r in t){var i=t[r];delete n[i.start],delete i.start,delete i.end,i.forEach((function(t){e[t<0?~t:t]=1})),o.push(i)}}return n.forEach((function(e,r){var i,o=t.arcs[e<0?~e:e];o.length<3&&!o[1][0]&&!o[1][1]&&(i=n[++a],n[a]=e,n[r]=i)})),n.forEach((function(n){var e,o,a=function(n){var e,r=t.arcs[n<0?~n:n],i=r[0];return t.transform?(e=[0,0],r.forEach((function(t){e[0]+=t[0],e[1]+=t[1]}))):e=r[r.length-1],n<0?[e,i]:[i,e]}(n),u=a[0],s=a[1];if(e=i[u])if(delete i[e.end],e.push(n),e.end=s,o=r[s]){delete r[o.start];var c=o===e?e:e.concat(o);r[c.start=e.start]=i[c.end=o.end]=c}else r[e.start]=i[e.end]=e;else if(e=r[s])if(delete r[e.start],e.unshift(n),e.start=u,o=i[u]){delete i[o.end];var l=o===e?e:o.concat(e);r[l.start=o.start]=i[l.end=e.end]=l}else r[e.start]=i[e.end]=e;else r[(e=[n]).start=u]=i[e.end=s]=e})),u(i,r),u(r,i),n.forEach((function(t){e[t<0?~t:t]||o.push([t])})),o}function Xt(t){return Yt(t,Jt.apply(this,arguments))}function Jt(t,n,e){var r,i,o;if(arguments.length>1)r=function(t,n,e){var r,i=[],o=[];function a(t){var n=t<0?~t:t;(o[n]||(o[n]=[])).push({i:t,g:r})}function u(t){t.forEach(a)}function s(t){t.forEach(u)}return function t(n){switch(r=n,n.type){case"GeometryCollection":n.geometries.forEach(t);break;case"LineString":u(n.arcs);break;case"MultiLineString":case"Polygon":s(n.arcs);break;case"MultiPolygon":!function(t){t.forEach(s)}(n.arcs)}}(n),o.forEach(null==e?function(t){i.push(t[0].i)}:function(t){e(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,n,e);else for(i=0,r=new Array(o=t.arcs.length);i<o;++i)r[i]=i;return{type:"MultiLineString",arcs:Vt(t,r)}}function Kt(t,n){return null==t||null==n?NaN:t<n?-1:t>n?1:t>=n?0:NaN}function Qt(t,n){return null==t||null==n?NaN:n<t?-1:n>t?1:n>=t?0:NaN}function Zt(t){let n,e,r;function i(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<0?i=n+1:o=n}while(i<o)}return i}return 2!==t.length?(n=Kt,e=(n,e)=>Kt(t(n),e),r=(n,e)=>t(n)-e):(n=t===Kt||t===Qt?t:tn,e=t,r=t),{left:i,center:function(t,n,e=0,o=t.length){const a=i(t,n,e,o-1);return a>e&&r(t[a-1],n)>-r(t[a],n)?a-1:a},right:function(t,r,i=0,o=t.length){if(i<o){if(0!==n(r,r))return o;do{const n=i+o>>>1;e(t[n],r)<=0?i=n+1:o=n}while(i<o)}return i}}}function tn(){return 0}function nn(t){return null===t?NaN:+t}const en=Zt(Kt),rn=en.right,on=en.left;Zt(nn);class an{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let e=0;for(let r=0;r<this._n&&r<32;r++){const i=n[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(n[e++]=a),t=o}return n[e]=t,this._n=e+1,this}valueOf(){const t=this._partials;let n,e,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(n=o,e=t[--i],o=n+e,r=e-(o-n),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(e=2*r,n=o+e,e==n-o&&(o=n))}return o}}class un extends Map{constructor(t,n=dn){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const[n,e]of t)this.set(n,e)}get(t){return super.get(cn(this,t))}has(t){return super.has(cn(this,t))}set(t,n){return super.set(ln(this,t),n)}delete(t){return super.delete(fn(this,t))}}class sn extends Set{constructor(t,n=dn){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),null!=t)for(const n of t)this.add(n)}has(t){return super.has(cn(this,t))}add(t){return super.add(ln(this,t))}delete(t){return super.delete(fn(this,t))}}function cn({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):e}function ln({_intern:t,_key:n},e){const r=n(e);return t.has(r)?t.get(r):(t.set(r,e),e)}function fn({_intern:t,_key:n},e){const r=n(e);return t.has(r)&&(e=t.get(r),t.delete(r)),e}function dn(t){return null!==t&&"object"==typeof t?t.valueOf():t}function hn(t,n){return(null==t||!(t>=t))-(null==n||!(n>=n))||(t<n?-1:t>n?1:0)}const mn=Math.sqrt(50),pn=Math.sqrt(10),gn=Math.sqrt(2);function vn(t,n,e){const r=(n-t)/Math.max(0,e),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=mn?10:o>=pn?5:o>=gn?2:1;let u,s,c;return i<0?(c=Math.pow(10,-i)/a,u=Math.round(t*c),s=Math.round(n*c),u/c<t&&++u,s/c>n&&--s,c=-c):(c=Math.pow(10,i)*a,u=Math.round(t/c),s=Math.round(n/c),u*c<t&&++u,s*c>n&&--s),s<u&&.5<=e&&e<2?vn(t,n,2*e):[u,s,c]}function yn(t,n,e){if(!((e=+e)>0))return[];if((t=+t)==(n=+n))return[t];const r=n<t,[i,o,a]=r?vn(n,t,e):vn(t,n,e);if(!(o>=i))return[];const u=o-i+1,s=new Array(u);if(r)if(a<0)for(let t=0;t<u;++t)s[t]=(o-t)/-a;else for(let t=0;t<u;++t)s[t]=(o-t)*a;else if(a<0)for(let t=0;t<u;++t)s[t]=(i+t)/-a;else for(let t=0;t<u;++t)s[t]=(i+t)*a;return s}function bn(t,n,e){return vn(t=+t,n=+n,e=+e)[2]}function wn(t,n,e){e=+e;const r=(n=+n)<(t=+t),i=r?bn(n,t,e):bn(t,n,e);return(r?-1:1)*(i<0?1/-i:i)}function xn(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e<n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e<i||void 0===e&&i>=i)&&(e=i)}return e}function $n(t,n){let e;if(void 0===n)for(const n of t)null!=n&&(e>n||void 0===e&&n>=n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&(e>i||void 0===e&&i>=i)&&(e=i)}return e}function kn(t,n,e=0,r=1/0,i){if(n=Math.floor(n),e=Math.floor(Math.max(0,e)),r=Math.floor(Math.min(t.length-1,r)),!(e<=n&&n<=r))return t;for(i=void 0===i?hn:function(t=Kt){if(t===Kt)return hn;if("function"!=typeof t)throw new TypeError("compare is not a function");return(n,e)=>{const r=t(n,e);return r||0===r?r:(0===t(e,e))-(0===t(n,n))}}(i);r>e;){if(r-e>600){const o=r-e+1,a=n-e+1,u=Math.log(o),s=.5*Math.exp(2*u/3),c=.5*Math.sqrt(u*s*(o-s)/o)*(a-o/2<0?-1:1);kn(t,n,Math.max(e,Math.floor(n-a*s/o+c)),Math.min(r,Math.floor(n+(o-a)*s/o+c)),i)}const o=t[n];let a=e,u=r;for(Mn(t,e,n),i(t[r],o)>0&&Mn(t,e,r);a<u;){for(Mn(t,a,u),++a,--u;i(t[a],o)<0;)++a;for(;i(t[u],o)>0;)--u}0===i(t[e],o)?Mn(t,e,u):(++u,Mn(t,u,r)),u<=n&&(e=u+1),n<=u&&(r=u-1)}return t}function Mn(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function An(t,n,e){if(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,e)),(r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return $n(t);if(n>=1)return xn(t);var r,i=(r-1)*n,o=Math.floor(i),a=xn(kn(t,o).subarray(0,o+1));return a+($n(t.subarray(o+1))-a)*(i-o)}}function Dn(t,n,e=nn){if((r=t.length)&&!isNaN(n=+n)){if(n<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,o=Math.floor(i),a=+e(t[o],o,t);return a+(+e(t[o+1],o+1,t)-a)*(i-o)}}function Sn(t,n){return An(t,.5,n)}function Fn(t){return Array.from(function*(t){for(const n of t)yield*n}(t))}function En(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),o=new Array(i);++r<i;)o[r]=t+r*e;return o}function Nn(t){let n=0;for(let e of t)(e=+e)&&(n+=e);return n}function Cn(t){return t instanceof sn?t:new sn(t)}function On(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function _n(t){return(t=On(Math.abs(t)))?t[1]:NaN}var zn,Bn=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Tn(t){if(!(n=Bn.exec(t)))throw new Error("invalid format: "+t);var n;return new Pn({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Pn(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 jn(t,n){var e=On(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Tn.prototype=Pn.prototype,Pn.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 Rn={"%":(t,n)=>(100*t).toFixed(n),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,n)=>t.toExponential(n),f:(t,n)=>t.toFixed(n),g:(t,n)=>t.toPrecision(n),o:t=>Math.round(t).toString(8),p:(t,n)=>jn(100*t,n),r:jn,s:function(t,n){var e=On(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(zn=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")+On(t,Math.max(0,n+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ln(t){return t}var In,qn,Un,Wn=Array.prototype.map,Hn=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Gn(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Ln:(n=Wn.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",u=void 0===t.numerals?Ln:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Wn.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=Tn(t)).fill,e=t.align,f=t.sign,d=t.symbol,h=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):Rn[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===n&&"="===e)&&(h=!0,n="0",e="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?s:"",x=Rn[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,d=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==f&&(M=!1),d=(M?"("===f?f:c:"-"===f||"("===f?"":f)+d,k=("s"===y?Hn[8+zn/3]:"")+k+(M&&"("===f?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!h&&(t=r(t,1/0));var A=d.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&h&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=d+t+k+D;break;case"=":t=d+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+k+D.slice(A);break;default:t=D+d+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var e=f(((t=Tn(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(_n(n)/3))),i=Math.pow(10,-r),o=Hn[8+r/3];return function(t){return e(i*t)+o}}}}In=Gn({thousands:",",grouping:[3],currency:["$",""]}),qn=In.format,Un=In.formatPrefix;const Yn=new Date,Vn=new Date;function Xn(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>Xn((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(Yn.setTime(+n),Vn.setTime(+r),t(Yn),t(Vn),Math.floor(e(Yn,Vn))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const Jn=Xn((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));Jn.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Xn((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):Jn:null);const Kn=1e3,Qn=6e4,Zn=36e5,te=864e5,ne=6048e5,ee=Xn((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*Kn)}),((t,n)=>(n-t)/Kn),(t=>t.getUTCSeconds())),re=Xn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kn)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getMinutes())),ie=Xn((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*Qn)}),((t,n)=>(n-t)/Qn),(t=>t.getUTCMinutes())),oe=Xn((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Kn-t.getMinutes()*Qn)}),((t,n)=>{t.setTime(+t+n*Zn)}),((t,n)=>(n-t)/Zn),(t=>t.getHours())),ae=Xn((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*Zn)}),((t,n)=>(n-t)/Zn),(t=>t.getUTCHours())),ue=Xn((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qn)/te),(t=>t.getDate()-1)),se=Xn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/te),(t=>t.getUTCDate()-1));function ce(t){return Xn((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Qn)/ne))}Xn((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/te),(t=>Math.floor(t/te)));const le=ce(0);function fe(t){return Xn((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/ne))}ce(1),ce(2),ce(3),ce(4),ce(5),ce(6);const de=fe(0);fe(1),fe(2),fe(3),fe(4),fe(5),fe(6);const he=Xn((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),me=Xn((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),pe=Xn((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));pe.every=t=>isFinite(t=Math.floor(t))&&t>0?Xn((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const ge=Xn((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));ge.every=t=>isFinite(t=Math.floor(t))&&t>0?Xn((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const ve="year",ye="quarter",be="month",we="week",xe="date",$e="day",ke="dayofyear",Me="hours",Ae="minutes",De="seconds",Se="milliseconds",Fe=[ve,ye,be,we,xe,$e,ke,Me,Ae,De,Se],Ee=Fe.reduce(((t,n,e)=>(t[n]=1+e,t)),{});function Ne(t){const n=Q(t).slice(),e={};return n.length||p("Missing time unit."),n.forEach((t=>{ft(Ee,t)?e[t]=1:p(`Invalid time unit: ${t}.`)})),(e[we]||e[$e]?1:0)+(e[ye]||e[be]||e[xe]?1:0)+(e[ke]?1:0)>1&&p(`Incompatible time units: ${t}`),n.sort(((t,n)=>Ee[t]-Ee[n])),n}const Ce={[ve]:"%Y ",[ye]:"Q%q ",[be]:"%b ",[xe]:"%d ",[we]:"W%U ",[$e]:"%a ",[ke]:"%j ",[Me]:"%H:00",[Ae]:"00:%M",[De]:":%S",[Se]:".%L",[`${ve}-${be}`]:"%Y-%m ",[`${ve}-${be}-${xe}`]:"%Y-%m-%d ",[`${Me}-${Ae}`]:"%H:%M"};function Oe(t,n){const e=st({},Ce,n),r=Ne(t),i=r.length;let o,a,u="",s=0;for(s=0;s<i;)for(o=r.length;o>s;--o)if(a=r.slice(s,o).join("-"),null!=e[a]){u+=e[a],s=o;break}return u.trim()}const _e=new Date;function ze(t){return _e.setFullYear(t),_e.setMonth(0),_e.setDate(1),_e.setHours(0,0,0,0),_e}function Be(t){return Pe(new Date(t))}function Te(t){return je(new Date(t))}function Pe(t){return ue.count(ze(t.getFullYear())-1,t)}function je(t){return le.count(ze(t.getFullYear())-1,t)}function Re(t){return ze(t).getDay()}function Le(t,n,e,r,i,o,a){if(0<=t&&t<100){const u=new Date(-1,n,e,r,i,o,a);return u.setFullYear(t),u}return new Date(t,n,e,r,i,o,a)}function Ie(t){return Ue(new Date(t))}function qe(t){return We(new Date(t))}function Ue(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return se.count(n-1,t)}function We(t){const n=Date.UTC(t.getUTCFullYear(),0,1);return de.count(n-1,t)}function He(t){return _e.setTime(Date.UTC(t,0,1)),_e.getUTCDay()}function Ge(t,n,e,r,i,o,a){if(0<=t&&t<100){const t=new Date(Date.UTC(-1,n,e,r,i,o,a));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(t,n,e,r,i,o,a))}function Ye(t,n,e,r,i){const o=n||1,a=_(t),u=(t,n,i)=>function(t,n,e,r){const i=e<=1?t:r?(n,i)=>r+e*Math.floor((t(n,i)-r)/e):(n,r)=>e*Math.floor(t(n,r)/e);return n?(t,e)=>n(i(t,e),e):i}(e[i=i||t],r[i],t===a&&o,n),s=new Date,c=Bt(t),l=c[ve]?u(ve):at(2012),f=c[be]?u(be):c[ye]?u(ye):w,d=c[we]&&c[$e]?u($e,1,we+$e):c[we]?u(we,1):c[$e]?u($e,1):c[xe]?u(xe,1):c[ke]?u(ke,1):x,h=c[Me]?u(Me):w,m=c[Ae]?u(Ae):w,p=c[De]?u(De):w,g=c[Se]?u(Se):w;return function(t){s.setTime(+t);const n=l(s);return i(n,f(s),d(s,n),h(s),m(s),p(s),g(s))}}function Ve(t,n,e){return n+7*t-(e+6)%7}const Xe={[ve]:t=>t.getFullYear(),[ye]:t=>Math.floor(t.getMonth()/3),[be]:t=>t.getMonth(),[xe]:t=>t.getDate(),[Me]:t=>t.getHours(),[Ae]:t=>t.getMinutes(),[De]:t=>t.getSeconds(),[Se]:t=>t.getMilliseconds(),[ke]:t=>Pe(t),[we]:t=>je(t),[we+$e]:(t,n)=>Ve(je(t),t.getDay(),Re(n)),[$e]:(t,n)=>Ve(1,t.getDay(),Re(n))},Je={[ye]:t=>3*t,[we]:(t,n)=>Ve(t,0,Re(n))};function Ke(t,n){return Ye(t,n||1,Xe,Je,Le)}const Qe={[ve]:t=>t.getUTCFullYear(),[ye]:t=>Math.floor(t.getUTCMonth()/3),[be]:t=>t.getUTCMonth(),[xe]:t=>t.getUTCDate(),[Me]:t=>t.getUTCHours(),[Ae]:t=>t.getUTCMinutes(),[De]:t=>t.getUTCSeconds(),[Se]:t=>t.getUTCMilliseconds(),[ke]:t=>Ue(t),[we]:t=>We(t),[$e]:(t,n)=>Ve(1,t.getUTCDay(),He(n)),[we+$e]:(t,n)=>Ve(We(t),t.getUTCDay(),He(n))},Ze={[ye]:t=>3*t,[we]:(t,n)=>Ve(t,0,He(n))};function tr(t,n){return Ye(t,n||1,Qe,Ze,Ge)}const nr={[ve]:pe,[ye]:he.every(3),[be]:he,[we]:le,[xe]:ue,[$e]:ue,[ke]:ue,[Me]:oe,[Ae]:re,[De]:ee,[Se]:Jn},er={[ve]:ge,[ye]:me.every(3),[be]:me,[we]:de,[xe]:se,[$e]:se,[ke]:se,[Me]:ae,[Ae]:ie,[De]:ee,[Se]:Jn};function rr(t){return nr[t]}function ir(t){return er[t]}function or(t,n,e){return t?t.offset(n,e):void 0}function ar(t,n,e){return or(rr(t),n,e)}function ur(t,n,e){return or(ir(t),n,e)}function sr(t,n,e,r){return t?t.range(n,e,r):void 0}function cr(t,n,e,r){return sr(rr(t),n,e,r)}function lr(t,n,e,r){return sr(ir(t),n,e,r)}const fr=31536e6,dr=[ve,be,xe,Me,Ae,De,Se],hr=dr.slice(0,-1),mr=hr.slice(0,-1),pr=mr.slice(0,-1),gr=pr.slice(0,-1),vr=[ve,be],yr=[ve],br=[[hr,1,1e3],[hr,5,5e3],[hr,15,15e3],[hr,30,3e4],[mr,1,6e4],[mr,5,3e5],[mr,15,9e5],[mr,30,18e5],[pr,1,36e5],[pr,3,108e5],[pr,6,216e5],[pr,12,432e5],[gr,1,864e5],[[ve,we],1,6048e5],[vr,1,2592e6],[vr,3,7776e6],[yr,1,fr]];function wr(t){const n=t.extent,e=t.maxbins||40,r=Math.abs(Et(n))/e;let i,o,a=Zt((t=>t[2])).right(br,r);return a===br.length?(i=yr,o=wn(n[0]/fr,n[1]/fr,e)):a?(a=br[r/br[a-1][2]<br[a][2]/r?a-1:a],i=a[0],o=a[1]):(i=dr,o=Math.max(wn(n[0],n[1],e),1)),{units:i,step:o}}var xr=new Date,$r=new Date;function kr(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=function(n){return t(n=new Date(+n)),n},i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,o){var a,u=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return u;do{u.push(a=new Date(+e)),n(e,o),t(e)}while(a<e&&e<r);return u},i.filter=function(e){return kr((function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););}))},e&&(i.count=function(n,r){return xr.setTime(+n),$r.setTime(+r),t(xr),t($r),Math.floor(e(xr,$r))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Mr=864e5,Ar=6048e5,Dr=kr((function(t){t.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/Mr}),(function(t){return t.getDate()-1}));function Sr(t){return kr((function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),(function(t,n){t.setDate(t.getDate()+7*n)}),(function(t,n){return(n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/Ar}))}var Fr=Sr(0),Er=Sr(1);Sr(2),Sr(3);var Nr=Sr(4);Sr(5),Sr(6);var Cr=kr((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n)}),(function(t,n){return n.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));Cr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?kr((function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),(function(n,e){n.setFullYear(n.getFullYear()+e*t)})):null};var Or=kr((function(t){t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+n)}),(function(t,n){return(n-t)/Mr}),(function(t){return t.getUTCDate()-1}));function _r(t){return kr((function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCDate(t.getUTCDate()+7*n)}),(function(t,n){return(n-t)/Ar}))}var zr=_r(0),Br=_r(1);_r(2),_r(3);var Tr=_r(4);_r(5),_r(6);var Pr=kr((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)}),(function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));function jr(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Rr(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Lr(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}function Ir(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Zr(i),l=ti(i),f=Zr(o),d=ti(o),h=Zr(a),m=ti(a),p=Zr(u),g=ti(u),v=Zr(s),y=ti(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:xi,e:xi,f:Di,g:Pi,G:Ri,H:$i,I:ki,j:Mi,L:Ai,m:Si,M:Fi,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:so,s:co,S:Ei,u:Ni,U:Ci,V:_i,w:zi,W:Bi,x:null,X:null,y:Ti,Y:ji,Z:Li,"%":uo},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Ii,e:Ii,f:Gi,g:ro,G:oo,H:qi,I:Ui,j:Wi,L:Hi,m:Yi,M:Vi,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:so,s:co,S:Xi,u:Ji,U:Ki,V:Zi,w:to,W:no,x:null,X:null,y:eo,Y:io,Z:ao,"%":uo},x={a:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=m.get(r[0].toLowerCase()),e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=d.get(r[0].toLowerCase()),e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y.get(r[0].toLowerCase()),e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g.get(r[0].toLowerCase()),e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:fi,e:fi,f:vi,g:ui,G:ai,H:hi,I:hi,j:di,L:gi,m:li,M:mi,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=l.get(r[0].toLowerCase()),e+r[0].length):-1},q:ci,Q:bi,s:wi,S:pi,u:ei,U:ri,V:ii,w:ni,W:oi,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:ui,Y:ai,Z:si,"%":yi};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=Yr[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=Lr(1900,void 0,1);if(M(o,t,e+="",0)!=e.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(n&&!("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=Rr(Lr(o.y,0,1))).getUTCDay(),r=i>4||0===i?Br.ceil(r):Br(r),r=Or.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=jr(Lr(o.y,0,1))).getDay(),r=i>4||0===i?Er.ceil(r):Er(r),r=Dr.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?Rr(Lr(o.y,0,1)).getUTCDay():jr(Lr(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,Rr(o)):jr(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in Yr?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}Pr.every=function(t){return isFinite(t=Math.floor(t))&&t>0?kr((function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),(function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null};var qr,Ur,Wr,Hr,Gr,Yr={"-":"",_:" ",0:"0"},Vr=/^\s*\d+/,Xr=/^%/,Jr=/[\\^$*+?|[\]().{}]/g;function Kr(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Qr(t){return t.replace(Jr,"\\$&")}function Zr(t){return new RegExp("^(?:"+t.map(Qr).join("|")+")","i")}function ti(t){return new Map(t.map(((t,n)=>[t.toLowerCase(),n])))}function ni(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function ei(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function ri(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function ii(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function oi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function ai(t,n,e){var r=Vr.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function ui(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function si(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function ci(t,n,e){var r=Vr.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function li(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function fi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function di(t,n,e){var r=Vr.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function hi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function mi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function pi(t,n,e){var r=Vr.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function gi(t,n,e){var r=Vr.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function vi(t,n,e){var r=Vr.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function yi(t,n,e){var r=Xr.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function bi(t,n,e){var r=Vr.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function wi(t,n,e){var r=Vr.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function xi(t,n){return Kr(t.getDate(),n,2)}function $i(t,n){return Kr(t.getHours(),n,2)}function ki(t,n){return Kr(t.getHours()%12||12,n,2)}function Mi(t,n){return Kr(1+Dr.count(Cr(t),t),n,3)}function Ai(t,n){return Kr(t.getMilliseconds(),n,3)}function Di(t,n){return Ai(t,n)+"000"}function Si(t,n){return Kr(t.getMonth()+1,n,2)}function Fi(t,n){return Kr(t.getMinutes(),n,2)}function Ei(t,n){return Kr(t.getSeconds(),n,2)}function Ni(t){var n=t.getDay();return 0===n?7:n}function Ci(t,n){return Kr(Fr.count(Cr(t)-1,t),n,2)}function Oi(t){var n=t.getDay();return n>=4||0===n?Nr(t):Nr.ceil(t)}function _i(t,n){return t=Oi(t),Kr(Nr.count(Cr(t),t)+(4===Cr(t).getDay()),n,2)}function zi(t){return t.getDay()}function Bi(t,n){return Kr(Er.count(Cr(t)-1,t),n,2)}function Ti(t,n){return Kr(t.getFullYear()%100,n,2)}function Pi(t,n){return Kr((t=Oi(t)).getFullYear()%100,n,2)}function ji(t,n){return Kr(t.getFullYear()%1e4,n,4)}function Ri(t,n){var e=t.getDay();return Kr((t=e>=4||0===e?Nr(t):Nr.ceil(t)).getFullYear()%1e4,n,4)}function Li(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Kr(n/60|0,"0",2)+Kr(n%60,"0",2)}function Ii(t,n){return Kr(t.getUTCDate(),n,2)}function qi(t,n){return Kr(t.getUTCHours(),n,2)}function Ui(t,n){return Kr(t.getUTCHours()%12||12,n,2)}function Wi(t,n){return Kr(1+Or.count(Pr(t),t),n,3)}function Hi(t,n){return Kr(t.getUTCMilliseconds(),n,3)}function Gi(t,n){return Hi(t,n)+"000"}function Yi(t,n){return Kr(t.getUTCMonth()+1,n,2)}function Vi(t,n){return Kr(t.getUTCMinutes(),n,2)}function Xi(t,n){return Kr(t.getUTCSeconds(),n,2)}function Ji(t){var n=t.getUTCDay();return 0===n?7:n}function Ki(t,n){return Kr(zr.count(Pr(t)-1,t),n,2)}function Qi(t){var n=t.getUTCDay();return n>=4||0===n?Tr(t):Tr.ceil(t)}function Zi(t,n){return t=Qi(t),Kr(Tr.count(Pr(t),t)+(4===Pr(t).getUTCDay()),n,2)}function to(t){return t.getUTCDay()}function no(t,n){return Kr(Br.count(Pr(t)-1,t),n,2)}function eo(t,n){return Kr(t.getUTCFullYear()%100,n,2)}function ro(t,n){return Kr((t=Qi(t)).getUTCFullYear()%100,n,2)}function io(t,n){return Kr(t.getUTCFullYear()%1e4,n,4)}function oo(t,n){var e=t.getUTCDay();return Kr((t=e>=4||0===e?Tr(t):Tr.ceil(t)).getUTCFullYear()%1e4,n,4)}function ao(){return"+0000"}function uo(){return"%"}function so(t){return+t}function co(t){return Math.floor(+t/1e3)}function lo(t){const n={};return e=>n[e]||(n[e]=t(e))}function fo(t){const n=lo(t.format),e=t.formatPrefix;return{format:n,formatPrefix:e,formatFloat(t){const e=Tn(t||",");if(null==e.precision){switch(e.precision=12,e.type){case"%":e.precision-=2;break;case"e":e.precision-=1}return function(t,n){return e=>{const r=t(e),i=r.indexOf(n);if(i<0)return r;let o=function(t,n){let e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if(e=t.charCodeAt(r),e>=48&&e<=57)return r+1}(r,i);const a=o<r.length?r.slice(o):"";for(;--o>i;)if("0"!==r[o]){++o;break}return r.slice(0,o)+a}}(n(e),n(".1f")(1)[1])}return n(e)},formatSpan(t,r,i,o){o=Tn(null==o?",f":o);const a=wn(t,r,i),u=Math.max(Math.abs(t),Math.abs(r));let s;if(null==o.precision)switch(o.type){case"s":return isNaN(s=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(_n(n)/3)))-_n(Math.abs(t)))}(a,u))||(o.precision=s),e(o,u);case"":case"e":case"g":case"p":case"r":isNaN(s=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,_n(n)-_n(t))+1}(a,u))||(o.precision=s-("e"===o.type));break;case"f":case"%":isNaN(s=function(t){return Math.max(0,-_n(Math.abs(t)))}(a))||(o.precision=s-2*("%"===o.type))}return n(o)}}}let ho,mo;function po(){return ho=fo({format:qn,formatPrefix:Un})}function go(t){return fo(Gn(t))}function vo(t){return arguments.length?ho=go(t):ho}function yo(t,n,e){F(e=e||{})||p(`Invalid time multi-format specifier: ${e}`);const r=n(De),i=n(Ae),o=n(Me),a=n(xe),u=n(we),s=n(be),c=n(ye),l=n(ve),f=t(e[Se]||".%L"),d=t(e[De]||":%S"),h=t(e[Ae]||"%I:%M"),m=t(e[Me]||"%I %p"),g=t(e[xe]||e[$e]||"%a %d"),v=t(e[we]||"%b %d"),y=t(e[be]||"%B"),b=t(e[ye]||"%B"),w=t(e[ve]||"%Y");return t=>(r(t)<t?f:i(t)<t?d:o(t)<t?h:a(t)<t?m:s(t)<t?u(t)<t?g:v:l(t)<t?c(t)<t?y:b:w)(t)}function bo(t){const n=lo(t.format),e=lo(t.utcFormat);return{timeFormat:t=>$t(t)?n(t):yo(n,rr,t),utcFormat:t=>$t(t)?e(t):yo(e,ir,t),timeParse:lo(t.parse),utcParse:lo(t.utcParse)}}function wo(){return mo=bo({format:Ur,parse:Wr,utcFormat:Hr,utcParse:Gr})}function xo(t){return bo(Ir(t))}function $o(t){return arguments.length?mo=xo(t):mo}qr=Ir({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"]}),Ur=qr.format,Wr=qr.parse,Hr=qr.utcFormat,Gr=qr.utcParse,po(),wo();const ko=(t,n)=>st({},t,n);function Mo(t,n){const e=t?go(t):vo(),r=n?xo(n):$o();return ko(e,r)}function Ao(t,n){const e=arguments.length;return e&&2!==e&&p("defaultLocale expects either zero or two arguments."),e?ko(vo(t),$o(n)):ko(vo(),$o())}const Do=/^(data:|([A-Za-z]+:)?\/\/)/,So=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,Fo=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function Eo(t,n){const e=await this.sanitize(t,n),r=e.href;return e.localFile?this.file(r):this.http(r,n?.http)}async function No(t,n){n=st({},this.options,n);const e=this.fileAccess,r={href:null};let i,o,a;const u=So.test(t.replace(Fo,""));null!=t&&"string"==typeof t&&u||p("Sanitize failure, invalid URI: "+Nt(t));const s=Do.test(t);return(a=n.baseURL)&&!s&&(t.startsWith("/")||a.endsWith("/")||(t="/"+t),t=a+t),o=(i=t.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!s&&e,i?t=t.slice(7):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),o=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,n.target&&(r.target=n.target+""),n.rel&&(r.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(r.crossOrigin=n.crossOrigin+""),r}async function Co(){p("No file system access.")}async function Oo(t,n){const e=st({},this.options.http,n),r=n&&n.response,i=await fetch(t,e);return i.ok?tt(i[r])?i[r]():i.text():p(i.status+""+i.statusText)}const _o=t=>!(Number.isNaN(+t)||t instanceof Date),zo={boolean:Ct,integer:z,number:z,date:_t,string:zt,unknown:b},Bo=[t=>"true"===t||"false"===t||!0===t||!1===t,t=>_o(t)&&Number.isInteger(+t),_o,t=>!Number.isNaN(Date.parse(t))],To=["boolean","integer","number","date"];function Po(t,n){if(!t||!t.length)return"unknown";const e=t.length,r=Bo.length,i=Bo.map(((t,n)=>n+1));for(let a,u,s=0,c=0;s<e;++s)for(u=n?t[s][n]:t[s],a=0;a<r;++a)if(i[a]&&null!=(o=u)&&o==o&&!Bo[a](u)&&(i[a]=0,++c,c===Bo.length))return"string";var o;return To[i.reduce(((t,n)=>0===t?n:t),0)-1]}function jo(t,n){return n.reduce(((n,e)=>(n[e]=Po(t,e),n)),{})}function Ro(t){const n=function(n,e){const r={delimiter:t};return Lo(n,e?st(e,r):r)};return n.responseType="text",n}function Lo(t,n){return n.header&&(t=n.header.map(Nt).join(n.delimiter)+"\n"+t),Ut(n.delimiter).parse(t+"")}function Io(t,n){const e=n&&n.property?v(n.property):b;return!F(t)||(r=t,"function"==typeof Buffer&&tt(Buffer.isBuffer)&&Buffer.isBuffer(r))?e(JSON.parse(t)):function(t,n){return!S(t)&&bt(t)&&(t=[...t]),n&&n.copy?JSON.parse(JSON.stringify(t)):t}(e(t),n);var r}Lo.responseType="text",Io.responseType="json";const qo={interior:(t,n)=>t!==n,exterior:(t,n)=>t===n};function Uo(t,n){let e,r,i,o;return t=Io(t,n),n&&n.feature?(e=Ht,i=n.feature):n&&n.mesh?(e=Xt,i=n.mesh,o=qo[n.filter]):p("Missing TopoJSON feature or mesh parameter."),r=(r=t.objects[i])?e(t,r,o):p("Invalid TopoJSON object: "+i),r&&r.features||[r]}Uo.responseType="json";const Wo={dsv:Lo,csv:Ro(","),tsv:Ro("\t"),json:Io,topojson:Uo};function Ho(t,n){return arguments.length>1?(Wo[t]=n,this):ft(Wo,t)?Wo[t]:null}function Go(t){const n=Ho(t);return n&&n.responseType||"text"}function Yo(t,n,e,r){const i=Ho((n=n||{}).type||"json");return i||p("Unknown data format type: "+n.type),t=i(t,n),n.parse&&function(t,n,e,r){if(!t.length)return;const i=$o();e=e||i.timeParse,r=r||i.utcParse;let o,a,u,s,c,l,f=t.columns||Object.keys(t[0]);"auto"===n&&(n=jo(t,f)),f=Object.keys(n);const d=f.map((t=>{const i=n[t];let o,a;if(i&&(i.startsWith("date:")||i.startsWith("utc:")))return o=i.split(/:(.+)?/,2),a=o[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1)),("utc"===o[0]?r:e)(a);if(!zo[i])throw Error("Illegal format pattern: "+t+":"+i);return zo[i]}));for(u=0,c=t.length,l=f.length;u<c;++u)for(o=t[u],s=0;s<l;++s)a=f[s],o[a]=d[s](o[a])}(t,n.parse,e,r),ft(t,"columns")&&delete t.columns,t}const Vo=t=>({options:t||{},sanitize:No,load:Eo,fileAccess:!1,file:Co,http:Oo});function Xo(t){const n=t||b,e=[],r={};return e.add=t=>{const i=n(t);return r[i]||(r[i]=1,e.push(t)),e},e.remove=t=>{const i=n(t);if(r[i]){r[i]=0;const n=e.indexOf(t);n>=0&&e.splice(n,1)}return e},e}async function Jo(t,n){try{await n(t)}catch(n){t.error(n)}}const Ko=Symbol("vega_id");let Qo=1;function Zo(t){return!(!t||!ta(t))}function ta(t){return t[Ko]}function na(t,n){return t[Ko]=n,t}function ea(t){const n=t===Object(t)?t:{data:t};return ta(n)?n:na(n,Qo++)}function ra(t){return ia(t,ea({}))}function ia(t,n){for(const e in t)n[e]=t[e];return n}function oa(t,n){return na(n,ta(t))}function aa(t,n){return t?n?(e,r)=>t(e,r)||ta(n(e))-ta(n(r)):(n,e)=>t(n,e)||ta(n)-ta(e):null}function ua(t){return t&&t.constructor===sa}function sa(){const t=[],n=[],e=[],r=[],i=[];let o=null,a=!1;return{constructor:sa,insert(n){const e=Q(n),r=e.length;for(let n=0;n<r;++n)t.push(e[n]);return this},remove(t){const e=tt(t)?r:n,i=Q(t),o=i.length;for(let t=0;t<o;++t)e.push(i[t]);return this},modify(t,n,r){const o={field:n,value:at(r)};return tt(t)?(o.filter=t,i.push(o)):(o.tuple=t,e.push(o)),this},encode(t,n){return tt(t)?i.push({filter:t,field:n}):e.push({tuple:t,field:n}),this},clean(t){return o=t,this},reflow(){return a=!0,this},pulse(u,s){const c={},l={};let f,d,h,m,p,g;for(f=0,d=s.length;f<d;++f)c[ta(s[f])]=1;for(f=0,d=n.length;f<d;++f)p=n[f],c[ta(p)]=-1;for(f=0,d=r.length;f<d;++f)m=r[f],s.forEach((t=>{m(t)&&(c[ta(t)]=-1)}));for(f=0,d=t.length;f<d;++f)p=t[f],g=ta(p),c[g]?c[g]=1:u.add.push(ea(t[f]));for(f=0,d=s.length;f<d;++f)p=s[f],c[ta(p)]<0&&u.rem.push(p);function v(t,n,e){e?t[n]=e(t):u.encode=n,a||(l[ta(t)]=t)}for(f=0,d=e.length;f<d;++f)h=e[f],p=h.tuple,m=h.field,g=c[ta(p)],g>0&&(v(p,m,h.value),u.modifies(m));for(f=0,d=i.length;f<d;++f)h=i[f],m=h.filter,s.forEach((t=>{m(t)&&c[ta(t)]>0&&v(t,h.field,h.value)})),u.modifies(h.field);if(a)u.mod=n.length||r.length?s.filter((t=>c[ta(t)]>0)):s.slice();else for(g in l)u.mod.push(l[g]);return(o||null==o&&(n.length||r.length))&&u.clean(!0),u}}}const ca="_:mod:_";function la(){Object.defineProperty(this,ca,{writable:!0,value:{}})}la.prototype={set(t,n,e,r){const i=this,o=i[t],a=i[ca];return null!=n&&n>=0?(o[n]!==e||r)&&(o[n]=e,a[n+":"+t]=-1,a[t]=-1):(o!==e||r)&&(i[t]=e,a[t]=S(e)?1+e.length:-1),i},modified(t,n){const e=this[ca];if(!arguments.length){for(const t in e)if(e[t])return!0;return!1}if(S(t)){for(let n=0;n<t.length;++n)if(e[t[n]])return!0;return!1}return null!=n&&n>=0?n+1<e[t]||!!e[n+":"+t]:!!e[t]},clear(){return this[ca]={},this}};let fa=0;const da=new la;function ha(t,n,e,r){this.id=++fa,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,n&&(this._update=n),e&&this.parameters(e,r)}function ma(t){return function(n){const e=this.flags;return 0===arguments.length?!!(e&t):(this.flags=n?e|t:e&~t,this)}}ha.prototype={targets(){return this._targets||(this._targets=Xo(y))},set(t){return this.value!==t?(this.value=t,1):0},skip:ma(1),modified:ma(2),parameters(t,n,e){n=!1!==n;const r=this._argval=this._argval||new la,i=this._argops=this._argops||[],o=[];let a,u,s,c;const l=(t,e,a)=>{a instanceof ha?(a!==this&&(n&&a.targets().add(this),o.push(a)),i.push({op:a,name:t,index:e})):r.set(t,e,a)};for(a in t)if(u=t[a],"pulse"===a)Q(u).forEach((t=>{t instanceof ha?t!==this&&(t.targets().add(this),o.push(t)):p("Pulse parameters must be operator instances.")})),this.source=u;else if(S(u))for(r.set(a,-1,Array(s=u.length)),c=0;c<s;++c)l(a,c,u[c]);else l(a,-1,u);return this.marshall().clear(),e&&(i.initonly=!0),o},marshall(t){const n=this._argval||da,e=this._argops;let r,i,o,a;if(e){const u=e.length;for(i=0;i<u;++i)r=e[i],o=r.op,a=o.modified()&&o.stamp===t,n.set(r.name,r.index,o.value,a);if(e.initonly){for(i=0;i<u;++i)r=e[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return n},detach(){const t=this._argops;let n,e,r,i;if(t)for(n=0,e=t.length;n<e;++n)r=t[n],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(t){const n=this._update;if(n){const e=this.marshall(t.stamp),r=n.call(this,e,t);if(e.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?(this.skip(!1),n=0):n=this.evaluate(t),this.pulse=n||t}};let pa=0;function ga(t,n,e){this.id=++pa,this.value=null,e&&(this.receive=e),t&&(this._filter=t),n&&(this._apply=n)}function va(t,n,e){return new ga(t,n,e)}ga.prototype={_filter:$,_apply:b,targets(){return this._targets||(this._targets=Xo(y))},consume(t){return arguments.length?(this._consume=!!t,this):!!this._consume},receive(t){if(this._filter(t)){const n=this.value=this._apply(t),e=this._targets,r=e?e.length:0;for(let t=0;t<r;++t)e[t].receive(n);this._consume&&(t.preventDefault(),t.stopPropagation())}},filter(t){const n=va(t);return this.targets().add(n),n},apply(t){const n=va(null,t);return this.targets().add(n),n},merge(){const t=va();this.targets().add(t);for(let n=0,e=arguments.length;n<e;++n)arguments[n].targets().add(t);return t},throttle(t){let n=-1;return this.filter((()=>{const e=Date.now();return e-n>t?(n=e,1):0}))},debounce(t){const n=va();return this.targets().add(va(null,null,ut(t,(t=>{const e=t.dataflow;n.receive(t),e&&e.run&&e.run()})))),n},between(t,n){let e=!1;return t.targets().add(va(null,null,(()=>e=!0))),n.targets().add(va(null,null,(()=>e=!1))),this.filter((()=>e))},detach(){this._filter=$,this._targets=null}};const ya={skip:!0};function ba(t,n,e,r,i,o){const a=st({},o,ya);let u,s;tt(e)||(e=at(e)),void 0===r?u=n=>t.touch(e(n)):tt(r)?(s=new ha(null,r,i,!1),u=n=>{s.evaluate(n);const r=e(n),i=s.value;ua(i)?t.pulse(r,i,o):t.update(r,i,a)}):u=n=>t.update(e(n),r,a),n.apply(u)}function wa(t,n,e,r,i,o){if(void 0===r)n.targets().add(e);else{const a=o||{},u=new ha(null,function(t,n){return n=tt(n)?n:at(n),t?function(e,r){const i=n(e,r);return t.skip()||(t.skip(i!==this.value).value=i),i}:n}(e,r),i,!1);u.modified(a.force),u.rank=n.rank,n.targets().add(u),e&&(u.skip(!0),u.value=e.value,u.targets().add(e),t.connect(e,[u]))}}const xa={};function $a(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}function ka(t,n){const e=[];return Pt(t,n,(t=>e.push(t))),e}function Ma(t,n){const e={};return t.visit(n,(t=>{e[ta(t)]=1})),t=>e[ta(t)]?null:t}function Aa(t,n){return t?(e,r)=>t(e,r)&&n(e,r):n}function Da(t,n,e,r){const i=this;let o=0;this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e;for(const t of e)if(t.stamp===n){if(t.fields){const n=i.fields||(i.fields={});for(const e in t.fields)n[e]=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 Sa(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}$a.prototype={StopPropagation:xa,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 $a(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 $a(this.dataflow).init(this),t.add=t.source,t.rem=[]),t},init(t,n){const e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source,t.cleans&&(e.cleans=t.cleans)),e},runAfter(t){this.dataflow.runAfter(t)},changed(t){const n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},reflow(t){if(t)return this.fork(7).reflow();const n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,Ma(this,1))),this},clean(t){return arguments.length?(this.cleans=!!t,this):this.cleans},modifies(t){const n=this.fields||(this.fields={});return S(t)?t.forEach((t=>n[t]=!0)):n[t]=!0,this},modified(t,n){const e=this.fields;return!(!n&&!this.mod.length||!e)&&(arguments.length?S(t)?t.some((t=>e[t])):e[t]:!!e)},filter(t,n){const e=this;return 1&t&&(e.addF=Aa(e.addF,n)),2&t&&(e.remF=Aa(e.remF,n)),4&t&&(e.modF=Aa(e.modF,n)),16&t&&(e.srcF=Aa(e.srcF,n)),e},materialize(t){const n=this;return 1&(t=t||7)&&n.addF&&(n.add=ka(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=ka(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=ka(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},visit(t,n){const e=this,r=n;if(16&t)return Pt(e.source,e.srcF,r),e;1&t&&Pt(e.add,e.addF,r),2&t&&Pt(e.rem,e.remF,r),4&t&&Pt(e.mod,e.modF,r);const i=e.source;if(8&t&&i){const t=e.add.length+e.mod.length;t===i.length||Pt(i,t?Ma(e,5):e.srcF,r)}return e}},pt(Da,$a,{fork(t){const n=new $a(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,(t=>n.add.push(t))),t&n.REM&&this.visit(n.REM,(t=>n.rem.push(t))),t&n.MOD&&this.visit(n.MOD,(t=>n.mod.push(t)))),n},changed(t){return this.changes&t},modified(t){const n=this,e=n.fields;return e&&n.changes&n.MOD?S(t)?t.some((t=>e[t])):e[t]:0},filter(){p("MultiPulse does not support filtering.")},materialize(){p("MultiPulse does not support materialization.")},visit(t,n){const e=this,r=e.pulses,i=r.length;let o=0;if(t&e.SOURCE)for(;o<i;++o)r[o].visit(t,n);else for(;o<i;++o)r[o].stamp===e.stamp&&r[o].visit(t,n);return e}});const Fa={skip:!1,force:!1};function Ea(t,n,e,r){let i,o;const a=t[e];for(;e>n&&(o=e-1>>1,i=t[o],r(a,i)<0);)t[e]=i,e=o;return t[e]=a}function Na(){this.logger(D()),this.logLevel(1),this._clock=0,this._rank=0,this._locale=Ao();try{this._loader=Vo()}catch(t){}this._touched=Xo(y),this._input={},this._pulse=null,this._heap=function(t){let n=[];return{clear:()=>n=[],size:()=>n.length,peek:()=>n[0],push:e=>(n.push(e),Ea(n,0,n.length-1,t)),pop:()=>{const e=n.pop();let r;return n.length?(r=n[0],n[0]=e,function(t,n,e){const r=n,i=t.length,o=t[n];let a,u=1+(n<<1);for(;u<i;)a=u+1,a<i&&e(t[u],t[a])>=0&&(u=a),t[n]=t[u],u=1+((n=u)<<1);t[n]=o,Ea(t,r,n,e)}(n,0,t)):r=e,r}}}(((t,n)=>t.qrank-n.qrank)),this._postrun=[]}function Ca(t){return function(){return this._log[t].apply(this,arguments)}}function Oa(t,n){ha.call(this,t,null,n)}Na.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:Ca("error"),warn:Ca("warn"),info:Ca("info"),debug:Ca("debug"),logLevel:Ca("level"),cleanThreshold:1e4,add:function(t,n,e,r){let i,o=1;return t instanceof ha?i=t:t&&t.prototype instanceof ha?i=new t:tt(t)?i=new ha(null,t):(o=0,i=new ha(t,n)),this.rank(i),o&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},connect:function(t,n){const e=t.rank,r=n.length;for(let i=0;i<r;++i)if(e<n[i].rank)return void this.rerank(t)},rank:function(t){t.rank=++this._rank},rerank:function(t){const n=[t];let e,r,i;for(;n.length;)if(this.rank(e=n.pop()),r=e._targets)for(i=r.length;--i>=0;)n.push(e=r[i]),e===t&&p("Cycle detected in dataflow graph.")},pulse:function(t,n,e){this.touch(t,e||Fa);const r=new $a(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._input[t.id]=n.pulse(r,i),this},touch:function(t,n){const e=n||Fa;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},update:function(t,n,e){const r=e||Fa;return(t.set(n)||r.force)&&this.touch(t,r),this},changeset:sa,ingest:function(t,n,e){return n=this.parse(n,e),this.pulse(t,this.changeset().insert(n))},parse:function(t,n){const e=this.locale();return Yo(t,n,e.timeParse,e.utcParse)},preload:async function(t,n,e){const r=this,i=r._pending||function(t){let n;const e=new Promise((t=>n=t));return e.requests=0,e.done=()=>{0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(r);i.requests+=1;const o=await r.request(n,e);return r.pulse(t,r.changeset().remove($).insert(o.data||[])),i.done(),o},request:async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Go(n&&n.type)});try{r=e.parse(r,n)}catch(n){i=-2,e.warn("Data ingestion failed",t,n)}}catch(n){i=-1,e.warn("Loading failed",t,n)}return{data:r,status:i}},events:function(t,n,e,r){const i=this,o=va(e,r),a=function(t){t.dataflow=i;try{o.receive(t)}catch(t){i.error(t)}finally{i.run()}};let u;u="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):Q(t);const s=u.length;for(let t=0;t<s;++t)u[t].addEventListener(n,a);return o},on:function(t,n,e,r,i){return(t instanceof ha?wa:ba)(this,t,n,e,r,i),this},evaluate:async function(t,n,e){const r=this,i=[];if(r._pulse)return Sa(r);if(r._pending&&await r._pending,n&&await Jo(r,n),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const o=++r._clock;r._pulse=new $a(r,o,t),r._touched.forEach((t=>r._enqueue(t,!0))),r._touched=Xo(y);let a,u,s,c=0;try{for(;r._heap.size()>0;)a=r._heap.pop(),a.rank===a.qrank?(u=a.run(r._getPulse(a,t)),u.then?u=await u:u.async&&(i.push(u.async),u=xa),u!==xa&&a._targets&&a._targets.forEach((t=>r._enqueue(t))),++c):r._enqueue(a,!0)}catch(t){r._heap.clear(),s=t}if(r._input={},r._pulse=null,r.debug(`Pulse ${o}: ${c} operators`),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun.sort(((t,n)=>n.priority-t.priority));r._postrun=[];for(let n=0;n<t.length;++n)await Jo(r,t[n].callback)}return e&&await Jo(r,e),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,n,e){return this._pulse?Sa(this):(this.evaluate(t,n,e),this)},runAsync:async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},runAfter:function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},_enqueue:function(t,n){const e=t.stamp<this._clock;e&&(t.stamp=this._clock),(e||n)&&(t.qrank=t.rank,this._heap.push(t))},_getPulse:function(t,n){const e=t.source,r=this._clock;return e&&S(e)?new Da(this,r,e.map((t=>t.pulse)),n):this._input[t.id]||function(t,n){return n&&n.stamp===t.stamp?n:(t=t.fork(),n&&n!==xa&&(t.source=n.source),t)}(this._pulse,e&&e.pulse)}},pt(Oa,ha,{run(t){if(t.stamp<this.stamp)return t.StopPropagation;let n;return this.skip()?this.skip(!1):n=this.evaluate(t),n=n||t,n.then?n=n.then((t=>this.pulse=t)):n!==t.StopPropagation&&(this.pulse=n),n},evaluate(t){const n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},transform(){}});const _a={};function za(t){const n=Ba(t);return n&&n.Definition||null}function Ba(t){return t=t&&t.toLowerCase(),ft(_a,t)?_a[t]:null}function*Ta(t,n){if(null==n)for(let n of t)null!=n&&""!==n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)r=n(r,++e,t),null!=r&&""!==r&&(r=+r)>=r&&(yield r)}}function Pa(t,n,e){const r=Float64Array.from(Ta(t,e));return r.sort(Kt),n.map((t=>Dn(r,t)))}function ja(t,n){return Pa(t,[.25,.5,.75],n)}function Ra(t,n){const e=t.length,r=function(t,n){const e=function(t,n){let e,r=0,i=0,o=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(e=n-i,i+=e/++r,o+=e*(n-i));else{let a=-1;for(let u of t)null!=(u=n(u,++a,t))&&(u=+u)>=u&&(e=u-i,i+=e/++r,o+=e*(u-i))}if(r>1)return o/(r-1)}(t,n);return e?Math.sqrt(e):e}(t,n),i=ja(t,n);return 1.06*(Math.min(r,(i[2]-i[0])/1.34)||r||Math.abs(i[0])||1)*Math.pow(e,-.2)}function La(t){const n=t.maxbins||20,e=t.base||10,r=Math.log(e),i=t.divide||[5,2];let o,a,u,s,c,l,f=t.extent[0],d=t.extent[1];const h=t.span||d-f||Math.abs(f)||1;if(t.step)o=t.step;else if(t.steps){for(s=h/n,c=0,l=t.steps.length;c<l&&t.steps[c]<s;++c);o=t.steps[Math.max(0,c-1)]}else{for(a=Math.ceil(Math.log(n)/r),u=t.minstep||0,o=Math.max(u,Math.pow(e,Math.round(Math.log(h)/r)-a));Math.ceil(h/o)>n;)o*=e;for(c=0,l=i.length;c<l;++c)s=o/i[c],s>=u&&h/s<=n&&(o=s)}s=Math.log(o);const m=Math.pow(e,-(s>=0?0:1+~~(-s/r))-1);return(t.nice||void 0===t.nice)&&(s=Math.floor(f/o+m)*o,f=f<s?s-o:s,d=Math.ceil(d/o)*o),{start:f,stop:d===f?f+o:d,step:o}}var Ia=Math.random;function qa(t,n,e,r){if(!t.length)return[void 0,void 0];const i=Float64Array.from(Ta(t,r)),o=i.length,a=n;let u,s,c,l;for(c=0,l=Array(a);c<a;++c){for(u=0,s=0;s<o;++s)u+=i[~~(Ia()*o)];l[c]=u/o}return l.sort(Kt),[An(l,e/2),An(l,1-e/2)]}function Ua(t,n,e,r){r=r||(t=>t);const i=t.length,o=new Float64Array(i);let a,u=0,s=1,c=r(t[0]),l=c,f=c+n;for(;s<i;++s){if(a=r(t[s]),a>=f){for(l=(c+l)/2;u<s;++u)o[u]=l;f=a+n,c=a}l=a}for(l=(c+l)/2;u<s;++u)o[u]=l;return e?function(t,n){const e=t.length;let r,i,o=0,a=1;for(;t[o]===t[a];)++a;for(;a<e;){for(r=a+1;t[a]===t[r];)++r;if(t[a]-t[a-1]<n){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,n+n/4):o}const Wa=Math.sqrt(2*Math.PI),Ha=Math.SQRT2;let Ga=NaN;function Ya(t,n){t=t||0,n=null==n?1:n;let e,r,i=0,o=0;if(Ga==Ga)i=Ga,Ga=NaN;else{do{i=2*Ia()-1,o=2*Ia()-1,e=i*i+o*o}while(0===e||e>1);r=Math.sqrt(-2*Math.log(e)/e),i*=r,Ga=o*r}return t+i*n}function Va(t,n,e){const r=(t-(n||0))/(e=null==e?1:e);return Math.exp(-.5*r*r)/(e*Wa)}function Xa(t,n,e){const r=(t-(n=n||0))/(e=null==e?1:e),i=Math.abs(r);let o;if(i>37)o=0;else{const t=Math.exp(-i*i/2);let n;i<7.07106781186547?(n=.0352624965998911*i+.700383064443688,n=n*i+6.37396220353165,n=n*i+33.912866078383,n=n*i+112.079291497871,n=n*i+221.213596169931,n=n*i+220.206867912376,o=t*n,n=.0883883476483184*i+1.75566716318264,n=n*i+16.064177579207,n=n*i+86.7807322029461,n=n*i+296.564248779674,n=n*i+637.333633378831,n=n*i+793.826512519948,n=n*i+440.413735824752,o/=n):(n=i+.65,n=i+4/n,n=i+3/n,n=i+2/n,n=i+1/n,o=t/n/2.506628274631)}return r>0?1-o:o}function Ja(t,n,e){return t<0||t>1?NaN:(n||0)+(null==e?1:e)*Ha*function(t){let n,e=-Math.log((1-t)*(1+t));return e<6.25?(e-=3.125,n=-364441206401782e-35,n=n*e-16850591381820166e-35,n=128584807152564e-32+n*e,n=11157877678025181e-33+n*e,n=n*e-1333171662854621e-31,n=20972767875968562e-33+n*e,n=6637638134358324e-30+n*e,n=n*e-4054566272975207e-29,n=n*e-8151934197605472e-29,n=26335093153082323e-28+n*e,n=n*e-12975133253453532e-27,n=n*e-5415412054294628e-26,n=1.0512122733215323e-9+n*e,n=n*e-4.112633980346984e-9,n=n*e-2.9070369957882005e-8,n=4.2347877827932404e-7+n*e,n=n*e-13654692000834679e-22,n=n*e-13882523362786469e-21,n=.00018673420803405714+n*e,n=n*e-.000740702534166267,n=n*e-.006033670871430149,n=.24015818242558962+n*e,n=1.6536545626831027+n*e):e<16?(e=Math.sqrt(e)-3.25,n=2.2137376921775787e-9,n=9.075656193888539e-8+n*e,n=n*e-2.7517406297064545e-7,n=1.8239629214389228e-8+n*e,n=15027403968909828e-22+n*e,n=n*e-4013867526981546e-21,n=29234449089955446e-22+n*e,n=12475304481671779e-21+n*e,n=n*e-47318229009055734e-21,n=6828485145957318e-20+n*e,n=24031110387097894e-21+n*e,n=n*e-.0003550375203628475,n=.0009532893797373805+n*e,n=n*e-.0016882755560235047,n=.002491442096107851+n*e,n=n*e-.003751208507569241,n=.005370914553590064+n*e,n=1.0052589676941592+n*e,n=3.0838856104922208+n*e):Number.isFinite(e)?(e=Math.sqrt(e)-5,n=-27109920616438573e-27,n=n*e-2.555641816996525e-10,n=1.5076572693500548e-9+n*e,n=n*e-3.789465440126737e-9,n=7.61570120807834e-9+n*e,n=n*e-1.496002662714924e-8,n=2.914795345090108e-8+n*e,n=n*e-6.771199775845234e-8,n=2.2900482228026655e-7+n*e,n=n*e-9.9298272942317e-7,n=4526062597223154e-21+n*e,n=n*e-1968177810553167e-20,n=7599527703001776e-20+n*e,n=n*e-.00021503011930044477,n=n*e-.00013871931833623122,n=1.0103004648645344+n*e,n=4.849906401408584+n*e):n=1/0,n*t}(2*t-1)}function Ka(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Ya(e,r),pdf:t=>Va(t,e,r),cdf:t=>Xa(t,e,r),icdf:t=>Ja(t,e,r)};return i.mean(t).stdev(n)}function Qa(t,n){const e=Ka();let r=0;const i={data(e){return arguments.length?(t=e,r=e?e.length:0,i.bandwidth(n)):t},bandwidth(e){return arguments.length?(!(n=e)&&t&&(n=Ra(t)),i):n},sample:()=>t[~~(Ia()*r)]+n*e.sample(),pdf(i){let o=0,a=0;for(;a<r;++a)o+=e.pdf((i-t[a])/n);return o/n/r},cdf(i){let o=0,a=0;for(;a<r;++a)o+=e.cdf((i-t[a])/n);return o/r},icdf(){throw Error("KDE icdf not supported.")}};return i.data(t)}function Za(t,n){return t=t||0,n=null==n?1:n,Math.exp(t+Ya()*n)}function tu(t,n,e){if(t<=0)return 0;n=n||0,e=null==e?1:e;const r=(Math.log(t)-n)/e;return Math.exp(-.5*r*r)/(e*Wa*t)}function nu(t,n,e){return Xa(Math.log(t),n,e)}function eu(t,n,e){return Math.exp(Ja(t,n,e))}function ru(t,n){let e,r;const i={mean(t){return arguments.length?(e=t||0,i):e},stdev(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>Za(e,r),pdf:t=>tu(t,e,r),cdf:t=>nu(t,e,r),icdf:t=>eu(t,e,r)};return i.mean(t).stdev(n)}function iu(t,n){let e,r=0;const i={weights(t){return arguments.length?(e=function(t){const n=[];let e,i=0;for(e=0;e<r;++e)i+=n[e]=null==t[e]?1:+t[e];for(e=0;e<r;++e)n[e]/=i;return n}(n=t||[]),i):n},distributions(e){return arguments.length?(e?(r=e.length,t=e):(r=0,t=[]),i.weights(n)):t},sample(){const n=Ia();let i=t[r-1],o=e[0],a=0;for(;a<r-1;o+=e[++a])if(n<o){i=t[a];break}return i.sample()},pdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].pdf(n);return i},cdf(n){let i=0,o=0;for(;o<r;++o)i+=e[o]*t[o].cdf(n);return i},icdf(){throw Error("Mixture icdf not supported.")}};return i.distributions(t).weights(n)}function ou(t,n){return null==n&&(n=null==t?1:t,t=0),t+(n-t)*Ia()}function au(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=n&&t<=e?1/(e-n):0}function uu(t,n,e){return null==e&&(e=null==n?1:n,n=0),t<n?0:t>e?1:(t-n)/(e-n)}function su(t,n,e){return null==e&&(e=null==n?1:n,n=0),t>=0&&t<=1?n+t*(e-n):NaN}function cu(t,n){let e,r;const i={min(t){return arguments.length?(e=t||0,i):e},max(t){return arguments.length?(r=null==t?1:t,i):r},sample:()=>ou(e,r),pdf:t=>au(t,e,r),cdf:t=>uu(t,e,r),icdf:t=>su(t,e,r)};return null==n&&(n=null==t?1:t,t=0),i.min(t).max(n)}function lu(t,n,e){let r=0,i=0;for(const o of t){const t=e(o);null==n(o)||null==t||isNaN(t)||(r+=(t-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function fu(t,n,e,r){const i=r-t*t,o=Math.abs(i)<1e-24?0:(e-t*n)/i;return[n-o*t,o]}function du(t,n,e,r){t=t.filter((t=>{let r=n(t),i=e(t);return null!=r&&(r=+r)>=r&&null!=i&&(i=+i)>=i})),r&&t.sort(((t,e)=>n(t)-n(e)));const i=t.length,o=new Float64Array(i),a=new Float64Array(i);let u,s,c,l=0,f=0,d=0;for(c of t)o[l]=u=+n(c),a[l]=s=+e(c),++l,f+=(u-f)/l,d+=(s-d)/l;for(l=0;l<i;++l)o[l]-=f,a[l]-=d;return[o,a,f,d]}function hu(t,n,e,r){let i,o,a=-1;for(const u of t)i=n(u),o=e(u),null!=i&&(i=+i)>=i&&null!=o&&(o=+o)>=o&&r(i,o,++a)}function mu(t,n,e,r,i){let o=0,a=0;return hu(t,n,e,((t,n)=>{const e=n-i(t),u=n-r;o+=e*e,a+=u*u})),1-o/a}function pu(t,n,e){let r=0,i=0,o=0,a=0,u=0;hu(t,n,e,((t,n)=>{++u,r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=fu(r,i,o,a),c=t=>s[0]+s[1]*t;return{coef:s,predict:c,rSquared:mu(t,n,e,i,c)}}function gu(t,n,e){let r=0,i=0,o=0,a=0,u=0;hu(t,n,e,((t,n)=>{++u,t=Math.log(t),r+=(t-r)/u,i+=(n-i)/u,o+=(t*n-o)/u,a+=(t*t-a)/u}));const s=fu(r,i,o,a),c=t=>s[0]+s[1]*Math.log(t);return{coef:s,predict:c,rSquared:mu(t,n,e,i,c)}}function vu(t,n,e){const[r,i,o,a]=du(t,n,e);let u,s,c,l=0,f=0,d=0,h=0,m=0;hu(t,n,e,((t,n)=>{u=r[m++],s=Math.log(n),c=u*n,l+=(n*s-l)/m,f+=(c-f)/m,d+=(c*s-d)/m,h+=(u*c-h)/m}));const[p,g]=fu(f/a,l/a,d/a,h/a),v=t=>Math.exp(p+g*(t-o));return{coef:[Math.exp(p-g*o),g],predict:v,rSquared:mu(t,n,e,a,v)}}function yu(t,n,e){let r=0,i=0,o=0,a=0,u=0,s=0;hu(t,n,e,((t,n)=>{const e=Math.log(t),c=Math.log(n);++s,r+=(e-r)/s,i+=(c-i)/s,o+=(e*c-o)/s,a+=(e*e-a)/s,u+=(n-u)/s}));const c=fu(r,i,o,a),l=t=>c[0]*Math.pow(t,c[1]);return c[0]=Math.exp(c[0]),{coef:c,predict:l,rSquared:mu(t,n,e,u,l)}}function bu(t,n,e){const[r,i,o,a]=du(t,n,e),u=r.length;let s,c,l,f,d=0,h=0,m=0,p=0,g=0;for(s=0;s<u;)c=r[s],l=i[s++],f=c*c,d+=(f-d)/s,h+=(f*c-h)/s,m+=(f*f-m)/s,p+=(c*l-p)/s,g+=(f*l-g)/s;const v=m-d*d,y=d*v-h*h,b=(g*d-p*h)/y,w=(p*v-g*h)/y,x=-b*d,$=t=>b*(t-=o)*t+w*t+x+a;return{coef:[x-w*o+b*o*o+a,w-2*b*o,b],predict:$,rSquared:mu(t,n,e,a,$)}}function wu(t,n,e,r){if(0===r)return lu(t,n,e);if(1===r)return pu(t,n,e);if(2===r)return bu(t,n,e);const[i,o,a,u]=du(t,n,e),s=i.length,c=[],l=[],f=r+1;let d,h,m,p,g;for(d=0;d<f;++d){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],d)*o[m];for(c.push(p),g=new Float64Array(f),h=0;h<f;++h){for(m=0,p=0;m<s;++m)p+=Math.pow(i[m],d+h);g[h]=p}l.push(g)}l.push(c);const v=function(t){const n=t.length-1,e=[];let r,i,o,a,u;for(r=0;r<n;++r){for(a=r,i=r+1;i<n;++i)Math.abs(t[r][i])>Math.abs(t[r][a])&&(a=i);for(o=r;o<n+1;++o)u=t[o][r],t[o][r]=t[o][a],t[o][a]=u;for(i=r+1;i<n;++i)for(o=n;o>=r;o--)t[o][i]-=t[o][r]*t[r][i]/t[r][r]}for(i=n-1;i>=0;--i){for(u=0,o=i+1;o<n;++o)u+=t[o][i]*e[o];e[i]=(t[n][i]-u)/t[i][i]}return e}(l),y=t=>{let n=u+v[0]+v[1]*(t-=a)+v[2]*t*t;for(d=3;d<f;++d)n+=v[d]*Math.pow(t,d);return n};return{coef:xu(f,v,-a,u),predict:y,rSquared:mu(t,n,e,u,y)}}function xu(t,n,e,r){const i=Array(t);let o,a,u,s;for(o=0;o<t;++o)i[o]=0;for(o=t-1;o>=0;--o)for(u=n[o],s=1,i[o]+=u,a=1;a<=o;++a)s*=(o+1-a)/a,i[o-a]+=u*Math.pow(e,a)*s;return i[0]+=r,i}function $u(t,n,e,r){const[i,o,a,u]=du(t,n,e,!0),s=i.length,c=Math.max(2,~~(r*s)),l=new Float64Array(s),f=new Float64Array(s),d=new Float64Array(s).fill(1);for(let t=-1;++t<=2;){const n=[0,c-1];for(let t=0;t<s;++t){const e=i[t],r=n[0],a=n[1];let u=0,s=0,c=0,h=0,m=0;const p=1/Math.abs(i[e-i[r]>i[a]-e?r:a]-e||1);for(let t=r;t<=a;++t){const n=i[t],r=o[t],a=ku(Math.abs(e-n)*p)*d[t],l=n*a;u+=a,s+=l,c+=r*a,h+=r*l,m+=n*l}const[g,v]=fu(s/u,c/u,h/u,m/u);l[t]=g+v*e,f[t]=Math.abs(o[t]-l[t]),Mu(i,t+1,n)}if(2===t)break;const e=Sn(f);if(Math.abs(e)<1e-12)break;for(let t,n,r=0;r<s;++r)t=f[r]/(6*e),d[r]=t>=1?1e-12:(n=1-t*t)*n}return function(t,n,e,r){const i=t.length,o=[];let a,u=0,s=0,c=[];for(;u<i;++u)a=t[u]+e,c[0]===a?c[1]+=(n[u]-c[1])/++s:(s=0,c[1]+=r,c=[a,n[u]],o.push(c));return c[1]+=r,o}(i,l,a,u)}function ku(t){return(t=1-t*t*t)*t*t}function Mu(t,n,e){const r=t[n];let i=e[0],o=e[1]+1;if(!(o>=t.length))for(;n>i&&t[o]-r<=r-t[i];)e[0]=++i,e[1]=o,++o}const Au=.5*Math.PI/180;function Du(t,n,e,r){e=e||25,r=Math.max(e,r||200);const i=n=>[n,t(n)],o=n[0],a=n[1],u=a-o,s=u/r,c=[i(o)],l=[];if(e===r){for(let t=1;t<r;++t)c.push(i(o+t/e*u));return c.push(i(a)),c}l.push(i(a));for(let t=e;--t>0;)l.push(i(o+t/e*u));let f=c[0],d=l[l.length-1];const h=1/u,m=function(t,n){let e=t,r=t;const i=n.length;for(let t=0;t<i;++t){const i=n[t][1];i<e&&(e=i),i>r&&(r=i)}return 1/(r-e)}(f[1],l);for(;d;){const t=i((f[0]+d[0])/2);t[0]-f[0]>=s&&Su(f,t,d,h,m)>Au?l.push(t):(f=d,c.push(d),l.pop()),d=l[l.length-1]}return c}function Su(t,n,e,r,i){const o=Math.atan2(i*(e[1]-t[1]),r*(e[0]-t[0])),a=Math.atan2(i*(n[1]-t[1]),r*(n[0]-t[0]));return Math.abs(o-a)}function Fu(t){return t&&t.length?1===t.length?t[0]:(n=t,t=>{const e=n.length;let r=1,i=String(n[0](t));for(;r<e;++r)i+="|"+n[r](t);return i}):function(){return""};var n}function Eu(t,n,e){return e||t+(n?"_"+n:"")}const Nu=()=>{},Cu={init:Nu,add:Nu,rem:Nu,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,n)=>t.sum+=+n,rem:(t,n)=>t.sum-=n},product:{init:t=>t.product=1,value:t=>t.valid?t.product:void 0,add:(t,n)=>t.product*=n,rem:(t,n)=>t.product/=n},mean:{init:t=>t.mean=0,value:t=>t.valid?t.mean:void 0,add:(t,n)=>(t.mean_d=n-t.mean,t.mean+=t.mean_d/t.valid),rem:(t,n)=>(t.mean_d=n-t.mean,t.mean-=t.valid?t.mean_d/t.valid:t.mean)},average:{value:t=>t.valid?t.mean:void 0,req:["mean"],idx:1},variance:{init:t=>t.dev=0,value:t=>t.valid>1?t.dev/(t.valid-1):void 0,add:(t,n)=>t.dev+=t.mean_d*(n-t.mean),rem:(t,n)=>t.dev-=t.mean_d*(n-t.mean),req:["mean"],idx:1},variancep:{value:t=>t.valid>1?t.dev/t.valid:void 0,req:["variance"],idx:2},stdev:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:t=>t.valid>1?Math.sqrt(t.dev/t.valid):void 0,req:["variance"],idx:2},stderr:{value:t=>t.valid>1?Math.sqrt(t.dev/(t.valid*(t.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:t=>t.cell.data.distinct(t.get),req:["values"],idx:3},ci0:{value:t=>t.cell.data.ci0(t.get),req:["values"],idx:3},ci1:{value:t=>t.cell.data.ci1(t.get),req:["values"],idx:3},median:{value:t=>t.cell.data.q2(t.get),req:["values"],idx:3},q1:{value:t=>t.cell.data.q1(t.get),req:["values"],idx:3},q3:{value:t=>t.cell.data.q3(t.get),req:["values"],idx:3},min:{init:t=>t.min=void 0,value:t=>t.min=Number.isNaN(t.min)?t.cell.data.min(t.get):t.min,add:(t,n)=>{(n<t.min||void 0===t.min)&&(t.min=n)},rem:(t,n)=>{n<=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,n)=>{(n>t.max||void 0===t.max)&&(t.max=n)},rem:(t,n)=>{n>=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,n,e)=>{n<t.min&&(t.argmin=e)},rem:(t,n)=>{n<=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,n,e)=>{n>t.max&&(t.argmax=e)},rem:(t,n)=>{n>=t.max&&(t.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(t,n)=>{t.exp=0,t.exp_r=n},value:t=>t.valid?t.exp*(1-t.exp_r)/(1-t.exp_r**t.valid):void 0,add:(t,n)=>t.exp=t.exp_r*t.exp+n,rem:(t,n)=>t.exp=(t.exp-n/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}},_u=Object.keys(Ou).filter((t=>"__count__"!==t));function zu(t,n,e){return Ou[t](e,n)}function Bu(t,n){return t.idx-n.idx}function Tu(){this.valid=0,this.missing=0,this._ops.forEach((t=>null==t.aggregate_param?t.init(this):t.init(this,t.aggregate_param)))}function Pu(t,n){null!=t&&""!==t?t==t&&(++this.valid,this._ops.forEach((e=>e.add(this,t,n)))):++this.missing}function ju(t,n){null!=t&&""!==t?t==t&&(--this.valid,this._ops.forEach((e=>e.rem(this,t,n)))):--this.missing}function Ru(t){return this._out.forEach((n=>t[n.out]=n.value(this))),t}function Lu(t,n){const e=n||b,r=function(t){const n={};t.forEach((t=>n[t.name]=t));const e=t=>{t.req&&t.req.forEach((t=>{n[t]||e(n[t]=Ou[t]())}))};return t.forEach(e),Object.values(n).sort(Bu)}(t),i=t.slice().sort(Bu);function o(t){this._ops=r,this._out=i,this.cell=t,this.init()}return o.prototype.init=Tu,o.prototype.add=Pu,o.prototype.rem=ju,o.prototype.set=Ru,o.prototype.get=e,o.fields=t.map((t=>t.out)),o}function Iu(t){this._key=t?v(t):ta,this.reset()}[..._u,"__count__"].forEach((t=>{Ou[t]=function(t,n){return(e,r)=>st({name:t,aggregate_param:r,out:e||t},Cu,n)}(t,Ou[t])}));const qu=Iu.prototype;function Uu(t){Oa.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}function Wu(t){Oa.call(this,null,t)}function Hu(t,n,e){const r=t;let i=n||[],o=e||[],a={},u=0;return{add:t=>o.push(t),remove:t=>a[r(t)]=++u,size:()=>i.length,data:(t,n)=>(u&&(i=i.filter((t=>!a[r(t)])),a={},u=0),n&&t&&i.sort(t),o.length&&(i=t?Dt(t,i,o.sort(t)):i.concat(o),o=[]),i)}}function Gu(t){Oa.call(this,[],t)}function Yu(t){ha.call(this,null,Vu,t)}function Vu(t){return this.value&&!t.modified()?this.value:nt(t.fields,t.orders)}function Xu(t){Oa.call(this,null,t)}function Ju(t){Oa.call(this,null,t)}qu.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},qu.add=function(t){this._add.push(t)},qu.rem=function(t){this._rem.push(t)},qu.values=function(){if(this._get=null,0===this._rem.length)return this._add;const t=this._add,n=this._rem,e=this._key,r=t.length,i=n.length,o=Array(r-i),a={};let u,s,c;for(u=0;u<i;++u)a[e(n[u])]=1;for(u=0,s=0;u<r;++u)a[e(c=t[u])]?a[e(c)]=0:o[s++]=c;return this._rem=[],this._add=o},qu.distinct=function(t){const n=this.values(),e={};let r,i=n.length,o=0;for(;--i>=0;)r=t(n[i])+"",ft(e,r)||(e[r]=1,++o);return o},qu.extent=function(t){if(this._get!==t||!this._ext){const n=this.values(),e=lt(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},qu.argmin=function(t){return this.extent(t)[0]||{}},qu.argmax=function(t){return this.extent(t)[1]||{}},qu.min=function(t){const n=this.extent(t)[0];return null!=n?t(n):void 0},qu.max=function(t){const n=this.extent(t)[1];return null!=n?t(n):void 0},qu.quartile=function(t){return this._get===t&&this._q||(this._q=ja(this.values(),t),this._get=t),this._q},qu.q1=function(t){return this.quartile(t)[0]},qu.q2=function(t){return this.quartile(t)[1]},qu.q3=function(t){return this.quartile(t)[2]},qu.ci=function(t){return this._get===t&&this._ci||(this._ci=qa(this.values(),1e3,.05,t),this._get=t),this._ci},qu.ci0=function(t){return this.ci(t)[0]},qu.ci1=function(t){return this.ci(t)[1]},Uu.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:_u},{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"}]},pt(Uu,Oa,{transform(t,n){const e=this,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.modified();return e.stamp=r.stamp,e.value&&(i||n.modified(e._inputs,!0))?(e._prev=e.value,e.value=i?e.init(t):Object.create(null),n.visit(n.SOURCE,(t=>e.add(t)))):(e.value=e.value||e.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),r.modifies(e._outputs),e._drop=!1!==t.drop,t.cross&&e._dims.length>1&&(e._drop=!1,e.cross()),n.clean()&&e._drop&&r.clean(!0).runAfter((()=>this.clean())),e.changes(r)},cross(){const t=this,n=t.value,e=t._dnames,r=e.map((()=>({}))),i=e.length;function o(t){let n,o,a,u;for(n in t)for(a=t[n].tuple,o=0;o<i;++o)r[o][u=a[e[o]]]=u}o(t._prev),o(n),function o(a,u,s){const c=e[s],l=r[s++];for(const e in l){const r=a?a+"|"+e:e;u[c]=l[e],s<i?o(r,u,s):n[r]||t.cell(r,u)}}("",{},0)},init(t){const n=this._inputs=[],e=this._outputs=[],r={};function i(t){const e=Q(f(t)),i=e.length;let o,a=0;for(;a<i;++a)r[o=e[a]]||(r[o]=1,n.push(o))}this._dims=Q(t.groupby),this._dnames=this._dims.map((t=>{const n=l(t);return i(t),e.push(n),n})),this.cellkey=t.key?t.key:Fu(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=t.fields||[null],a=t.ops||["count"],u=t.aggregate_params||[null],s=t.as||[],c=o.length,d={};let h,m,g,v,y,b,w;for(c!==a.length&&p("Unmatched number of fields and aggregate ops."),w=0;w<c;++w)h=o[w],m=a[w],g=u[w]||null,null==h&&"count"!==m&&p("Null aggregate field specified."),y=l(h),b=Eu(m,y,s[w]),e.push(b),"count"!==m?(v=d[y],v||(i(h),v=d[y]=[],v.field=h,this._measures.push(v)),"count"!==m&&(this._countOnly=!1),v.push(zu(m,g,b))):this._counts.push(b);return this._measures=this._measures.map((t=>Lu(t,t.field))),Object.create(null)},cellkey:Fu(),cell(t,n){let e=this.value[t];return e?0===e.num&&this._drop&&e.stamp<this.stamp?(e.stamp=this.stamp,this._adds[this._alen++]=e):e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e):(e=this.value[t]=this.newcell(t,n),this._adds[this._alen++]=e),e},newcell(t,n){const e={key:t,num:0,agg:null,tuple:this.newtuple(n,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){const t=this._measures,n=t.length;e.agg=Array(n);for(let r=0;r<n;++r)e.agg[r]=new t[r](e)}return e.store&&(e.data=new Iu),e},newtuple(t,n){const e=this._dnames,r=this._dims,i=r.length,o={};for(let n=0;n<i;++n)o[e[n]]=r[n](t);return n?oa(n.tuple,o):ea(o)},clean(){const t=this.value;for(const n in t)0===t[n].num&&delete t[n]},add(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num+=1,this._countOnly)return;e.store&&e.data.add(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].add(r[n].get(t),t)},rem(t){const n=this.cellkey(t),e=this.cell(n,t);if(e.num-=1,this._countOnly)return;e.store&&e.data.rem(t);const r=e.agg;for(let n=0,e=r.length;n<e;++n)r[n].rem(r[n].get(t),t)},celltuple(t){const n=t.tuple,e=this._counts;t.store&&t.data.values();for(let r=0,i=e.length;r<i;++r)n[e[r]]=t.num;if(!this._countOnly){const e=t.agg;for(let t=0,r=e.length;t<r;++t)e[t].set(n)}return n},changes(t){const n=this._adds,e=this._mods,r=this._prev,i=this._drop,o=t.add,a=t.rem,u=t.mod;let s,c,l,f;if(r)for(c in r)s=r[c],i&&!s.num||a.push(s.tuple);for(l=0,f=this._alen;l<f;++l)o.push(this.celltuple(n[l])),n[l]=null;for(l=0,f=this._mlen;l<f;++l)s=e[l],(0===s.num&&i?a:u).push(this.celltuple(s)),e[l]=null;return this._alen=this._mlen=0,this._prev=null,t}}),Wu.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"]}]},pt(Wu,Oa,{transform(t,n){const e=!1!==t.interval,r=this._bins(t),i=r.start,o=r.step,a=t.as||["bin0","bin1"],u=a[0],s=a[1];let c;return c=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(f(t.field))?n.ADD_MOD:n.ADD,n.visit(c,e?t=>{const n=r(t);t[u]=n,t[s]=null==n?null:i+o*(1+(n-i)/o)}:t=>t[u]=r(t)),n.modifies(e?a:u)},_bins(t){if(this.value&&!t.modified())return this.value;const n=t.field,e=La(t),r=e.step;let i,o,a=e.start,u=a+Math.ceil((e.stop-a)/r)*r;null!=(i=t.anchor)&&(o=i-(a+r*Math.floor((i-a)/r)),a+=o,u+=o);const s=function(t){let e=z(n(t));return null==e?null:e<a?-1/0:e>u?1/0:(e=Math.max(a,Math.min(e,u-r)),a+r*Math.floor(1e-14+(e-a)/r))};return s.start=a,s.stop=e.stop,s.step=r,this.value=c(s,f(n),t.name||"bin_"+l(n))}}),Gu.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},pt(Gu,Oa,{transform(t,n){const e=n.fork(n.ALL),r=Hu(ta,this.value,e.materialize(e.ADD).add),i=t.sort,o=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(o),this.value=e.source=r.data(aa(i),o),n.source&&n.source.root&&(this.value.root=n.source.root),e}}),pt(Yu,ha),Xu.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"]}]},pt(Xu,Oa,{transform(t,n){const e=n=>e=>{for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(u(e),t.case,o)||[],s=0,c=i.length;s<c;++s)a.test(r=i[s])||n(r)},r=this._parameterCheck(t,n),i=this._counts,o=this._match,a=this._stop,u=t.field,s=t.as||["text","count"],c=e((t=>i[t]=1+(i[t]||0))),l=e((t=>i[t]-=1));return r?n.visit(n.SOURCE,c):(n.visit(n.ADD,c),n.visit(n.REM,l)),this._finish(n,s)},_parameterCheck(t,n){let e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},_finish(t,n){const e=this._counts,r=this._tuples||(this._tuples={}),i=n[0],o=n[1],a=t.fork(t.NO_SOURCE|t.NO_FIELDS);let u,s,c;for(u in e)s=r[u],c=e[u]||0,!s&&c?(r[u]=s=ea({}),s[i]=u,s[o]=c,a.add.push(s)):0===c?(s&&a.rem.push(s),e[u]=null,r[u]=null):s[o]!==c&&(s[o]=c,a.mod.push(s));return a.modifies(n)}}),Ju.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},pt(Ju,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.as||["a","b"],i=r[0],o=r[1],a=!this.value||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter");let u=this.value;return a?(u&&(e.rem=u),u=n.materialize(n.SOURCE).source,e.add=this.value=function(t,n,e,r){for(var i,o,a=[],u={},s=t.length,c=0;c<s;++c)for(u[n]=o=t[c],i=0;i<s;++i)u[e]=t[i],r(u)&&(a.push(ea(u)),(u={})[n]=o);return a}(u,i,o,t.filter||$)):e.mod=u,e.source=this.value,e.modifies(r)}});const Ku={kde:Qa,mixture:iu,normal:Ka,lognormal:ru,uniform:cu},Qu="function";function Zu(t,n){const e=t[Qu];ft(Ku,e)||p("Unknown distribution function: "+e);const r=Ku[e]();for(const e in t)"field"===e?r.data((t.from||n()).map(t[e])):"distributions"===e?r[e](t[e].map((t=>Zu(t,n)))):typeof r[e]===Qu&&r[e](t[e]);return r}function ts(t){Oa.call(this,null,t)}const ns=[{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}]}];function es(t,n){return t?t.map(((t,e)=>n[e]||l(t))):null}function rs(t,n,e){const r=[],i=t=>t(s);let o,a,u,s,c,l;if(null==n)r.push(t.map(e));else for(o={},a=0,u=t.length;a<u;++a)s=t[a],c=n.map(i),l=o[c],l||(o[c]=l=[],l.dims=c,r.push(l)),l.push(e(s));return r}function is(t){Oa.call(this,null,t)}function os(t){ha.call(this,null,as,t),this.modified(!0)}function as(t){const n=t.expr;return this.value&&!t.modified("expr")?this.value:c((e=>n(e,t)),f(n),l(n))}function us(t){Oa.call(this,[void 0,void 0],t)}function ss(t,n){ha.call(this,t),this.parent=n,this.count=0}function cs(t){Oa.call(this,{},t),this._keys=ht();const n=this._targets=[];n.active=0,n.forEach=t=>{for(let e=0,r=n.active;e<r;++e)t(n[e],e,n)}}function ls(t){ha.call(this,null,fs,t)}function fs(t){return this.value&&!t.modified()?this.value:S(t.name)?Q(t.name).map((t=>v(t))):v(t.name,t.as)}function ds(t){Oa.call(this,ht(),t)}function hs(t){Oa.call(this,[],t)}function ms(t){Oa.call(this,[],t)}function ps(t){Oa.call(this,null,t)}function gs(t){Oa.call(this,[],t)}ts.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:ns.concat({key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ns},{name:"weights",type:"number",array:!0}]})},{name:"as",type:"string",array:!0,default:["value","density"]}]},pt(ts,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=Zu(t.distribution,function(t){return()=>t.materialize(t.SOURCE).source}(n)),i=t.steps||t.minsteps||25,o=t.steps||t.maxsteps||200;let a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&p("Invalid density method: "+a),t.extent||r.data||p("Missing density extent parameter."),a=r[a];const u=t.as||["value","density"],s=Du(a,t.extent||ct(r.data()),i,o).map((t=>{const n={};return n[u[0]]=t[0],n[u[1]]=t[1],ea(n)}));this.value&&(e.rem=this.value),this.value=e.add=e.source=s}return e}}),is.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"}]},pt(is,Oa,{transform(t,n){if(this.value&&!t.modified()&&!n.changed())return n;const e=n.materialize(n.SOURCE).source,r=rs(n.source,t.groupby,b),i=t.smooth||!1,o=t.field,a=t.step||((t,n)=>Et(ct(t,n))/30)(e,o),u=aa(((t,n)=>o(t)-o(n))),s=t.as||"bin",c=r.length;let l,f=1/0,d=-1/0,h=0;for(;h<c;++h){const t=r[h].sort(u);l=-1;for(const n of Ua(t,a,i,o))n<f&&(f=n),n>d&&(d=n),t[++l][s]=n}return this.value={start:f,stop:d,step:a},n.reflow(!0).modifies(s)}}),pt(os,ha),us.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},pt(us,Oa,{transform(t,n){const e=this.value,r=t.field,i=n.changed()||n.modified(r.fields)||t.modified("field");let o=e[0],a=e[1];if((i||null==o)&&(o=1/0,a=-1/0),n.visit(i?n.SOURCE:n.ADD,(t=>{const n=z(r(t));null!=n&&(n<o&&(o=n),n>a&&(a=n))})),!Number.isFinite(o)||!Number.isFinite(a)){let t=l(r);t&&(t=` for field "${t}"`),n.dataflow.warn(`Infinite extent${t}: [${o}, ${a}]`),o=a=void 0}this.value=[o,a]}}),pt(ss,ha,{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}}),pt(cs,Oa,{activate(t){this._targets[this._targets.active++]=t},subflow(t,n,e,r){const i=this.value;let o,a,u=ft(i,t)&&i[t];return u?u.value.stamp<e.stamp&&(u.init(e),this.activate(u)):(a=r||(a=this._group[t])&&a.tuple,o=e.dataflow,u=new ss(e.fork(e.NO_SOURCE),this),o.add(u).connect(n(o,t,a)),i[t]=u,this.activate(u)),u},clean(){const t=this.value;let n=0;for(const e in t)if(0===t[e].count){const r=t[e].detachSubflow;r&&r(),delete t[e],++n}if(n){const t=this._targets.filter((t=>t&&t.count>0));this.initTargets(t)}},initTargets(t){const n=this._targets,e=n.length,r=t?t.length:0;let i=0;for(;i<r;++i)n[i]=t[i];for(;i<e&&null!=n[i];++i)n[i]=null;n.active=r},transform(t,n){const e=n.dataflow,r=t.key,i=t.subflow,o=this._keys,a=t.modified("key"),u=t=>this.subflow(t,i,n);return this._group=t.group||{},this.initTargets(),n.visit(n.REM,(t=>{const n=ta(t),e=o.get(n);void 0!==e&&(o.delete(n),u(e).rem(t))})),n.visit(n.ADD,(t=>{const n=r(t);o.set(ta(t),n),u(n).add(t)})),a||n.modified(r.fields)?n.visit(n.MOD,(t=>{const n=ta(t),e=o.get(n),i=r(t);e===i?u(i).mod(t):(o.set(n,i),u(e).rem(t),u(i).add(t))})):n.changed(n.MOD)&&n.visit(n.MOD,(t=>{u(o.get(ta(t))).mod(t)})),a&&n.visit(n.REFLOW,(t=>{const n=ta(t),e=o.get(n),i=r(t);e!==i&&(o.set(n,i),u(e).rem(t),u(i).add(t))})),n.clean()?e.runAfter((()=>{this.clean(),o.clean()})):o.empty>e.cleanThreshold&&e.runAfter(o.clean),n}}),pt(ls,ha),ds.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},pt(ds,Oa,{transform(t,n){const e=n.dataflow,r=this.value,i=n.fork(),o=i.add,a=i.rem,u=i.mod,s=t.expr;let c=!0;function l(n){const e=ta(n),i=s(n,t),l=r.get(e);i&&l?(r.delete(e),o.push(n)):i||l?c&&i&&!l&&u.push(n):(r.set(e,1),a.push(n))}return n.visit(n.REM,(t=>{const n=ta(t);r.has(n)?r.delete(n):a.push(t)})),n.visit(n.ADD,(n=>{s(n,t)?o.push(n):r.set(ta(n),1)})),n.visit(n.MOD,l),t.modified()&&(c=!1,n.visit(n.REFLOW,l)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i}}),hs.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}]},pt(hs,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=es(r,t.as||[]),o=t.index||null,a=i.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{const n=r.map((n=>n(t))),u=n.reduce(((t,n)=>Math.max(t,n.length)),0);let s,c,l,f=0;for(;f<u;++f){for(c=ra(t),s=0;s<a;++s)c[i[s]]=null==(l=n[s][f])?null:l;o&&(c[o]=f),e.add.push(c)}})),this.value=e.source=e.add,o&&e.modifies(o),e.modifies(i)}}),ms.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"]}]},pt(ms,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=r.map(l),o=t.as||["key","value"],a=o[0],u=o[1],s=r.length;return e.rem=this.value,n.visit(n.SOURCE,(t=>{for(let n,o=0;o<s;++o)n=ra(t),n[a]=i[o],n[u]=r[o](t),e.add.push(n)})),this.value=e.source=e.add,e.modifies(o)}}),ps.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},pt(ps,Oa,{transform(t,n){const e=t.expr,r=t.as,i=t.modified(),o=t.initonly?n.ADD:i?n.SOURCE:n.modified(e.fields)||n.modified(r)?n.ADD_MOD:n.ADD;return i&&(n=n.materialize().reflow(!0)),t.initonly||n.modifies(r),n.visit(o,(n=>n[r]=e(n,t)))}}),pt(gs,Oa,{transform(t,n){const e=n.fork(n.ALL),r=t.generator;let i,o,a,u=this.value,s=t.size-u.length;if(s>0){for(i=[];--s>=0;)i.push(a=ea(r(t))),u.push(a);e.add=e.add.length?e.materialize(e.ADD).add.concat(i):i}else o=u.slice(0,-s),e.rem=e.rem.length?e.materialize(e.REM).rem.concat(o):o,u=u.slice(-s);return e.source=this.value=u,e}});const vs={value:"value",median:Sn,mean:function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let o of t)null!=(o=n(o,++i,t))&&(o=+o)>=o&&(++e,r+=o)}if(e)return r/e},min:$n,max:xn},ys=[];function bs(t){Oa.call(this,[],t)}function ws(t){Uu.call(this,t)}function xs(t){Oa.call(this,null,t)}function $s(t){ha.call(this,null,ks,t)}function ks(t){return this.value&&!t.modified()?this.value:kt(t.fields,t.flat)}function Ms(t){Oa.call(this,[],t),this._pending=null}function As(t,n,e){e.forEach(ea);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.source=r.add=e,t._pending=null,r.rem.length&&r.clean(!0),r}function Ds(t){Oa.call(this,{},t)}function Ss(t){ha.call(this,null,Fs,t)}function Fs(t){if(this.value&&!t.modified())return this.value;const n=t.extents,e=n.length;let r,i,o=1/0,a=-1/0;for(r=0;r<e;++r)i=n[r],i[0]<o&&(o=i[0]),i[1]>a&&(a=i[1]);return[o,a]}function Es(t){ha.call(this,null,Ns,t)}function Ns(t){return this.value&&!t.modified()?this.value:t.values.reduce(((t,n)=>t.concat(n)),[])}function Cs(t){Oa.call(this,null,t)}function Os(t){Uu.call(this,t)}function _s(t){cs.call(this,t)}function zs(t){Oa.call(this,null,t)}function Bs(t){Oa.call(this,null,t)}function Ts(t){Oa.call(this,null,t)}function Ps(t){Oa.call(this,null,t)}function js(t){Oa.call(this,[],t),this.count=0}function Rs(t){Oa.call(this,null,t)}function Ls(t){Oa.call(this,null,t),this.modified(!0)}function Is(t){Oa.call(this,null,t)}bs.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}]},pt(bs,Oa,{transform(t,n){var e,r,i,o,a,u,s,c,f,d,h=n.fork(n.ALL),m=function(t){var n,e=t.method||vs.value;if(null!=vs[e])return e===vs.value?(n=void 0!==t.value?t.value:0,()=>n):vs[e];p("Unrecognized imputation method: "+e)}(t),g=function(t){const n=t.field;return t=>t?n(t):NaN}(t),v=l(t.field),y=l(t.key),b=(t.groupby||[]).map(l),w=function(t,n,e,r){var i,o,a,u,s,c,l,f,d=t=>t(f),h=[],m=r?r.slice():[],p={},g={};for(m.forEach(((t,n)=>p[t]=n+1)),u=0,l=t.length;u<l;++u)c=e(f=t[u]),s=p[c]||(p[c]=m.push(c)),(a=g[o=(i=n?n.map(d):ys)+""])||(a=g[o]=[],h.push(a),a.values=i),a[s-1]=f;return h.domain=m,h}(n.source,t.groupby,t.key,t.keyvals),x=[],$=this.value,k=w.domain.length;for(a=0,c=w.length;a<c;++a)for(i=(e=w[a]).values,r=NaN,s=0;s<k;++s)if(null==e[s]){for(o=w.domain[s],d={_impute:!0},u=0,f=i.length;u<f;++u)d[b[u]]=i[u];d[y]=o,d[v]=Number.isNaN(r)?r=m(e,g):r,x.push(ea(d))}return x.length&&(h.add=h.materialize(h.ADD).add.concat(x)),$.length&&(h.rem=h.materialize(h.REM).rem.concat($)),this.value=x,h}}),ws.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:_u},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},pt(ws,Uu,{transform(t,n){const e=this,r=t.modified();let i;return e.value&&(r||n.modified(e._inputs,!0))?(i=e.value=r?e.init(t):{},n.visit(n.SOURCE,(t=>e.add(t)))):(i=e.value=e.value||this.init(t),n.visit(n.REM,(t=>e.rem(t))),n.visit(n.ADD,(t=>e.add(t)))),e.changes(),n.visit(n.SOURCE,(t=>{st(t,i[e.cellkey(t)].tuple)})),n.reflow(r).modifies(this._outputs)},changes(){const t=this._adds,n=this._mods;let e,r;for(e=0,r=this._alen;e<r;++e)this.celltuple(t[e]),t[e]=null;for(e=0,r=this._mlen;e<r;++e)this.celltuple(n[e]),n[e]=null;this._alen=this._mlen=0}}),xs.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"]}]},pt(xs,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=n.materialize(n.SOURCE).source,i=rs(r,t.groupby,t.field),o=(t.groupby||[]).map(l),a=t.bandwidth,u=t.cumulative?"cdf":"pdf",s=t.as||["value","density"],c=[];let f=t.extent,d=t.steps||t.minsteps||25,h=t.steps||t.maxsteps||200;"pdf"!==u&&"cdf"!==u&&p("Invalid density method: "+u),"shared"===t.resolve&&(f||(f=ct(r,t.field)),d=h=t.steps||h),i.forEach((n=>{const e=Qa(n,a)[u],r=t.counts?n.length:1;Du(e,f||ct(n),d,h).forEach((t=>{const e={};for(let t=0;t<o.length;++t)e[o[t]]=n.dims[t];e[s[0]]=t[0],e[s[1]]=t[1]*r,c.push(ea(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=c}return e}}),pt($s,ha),pt(Ms,Oa,{transform(t,n){const e=n.dataflow;if(this._pending)return As(this,n,this._pending);if(function(t){return t.modified("async")&&!(t.modified("values")||t.modified("url")||t.modified("format"))}(t))return n.StopPropagation;if(t.values)return As(this,n,e.parse(t.values,t.format));if(t.async){const n=e.request(t.url,t.format).then((t=>(this._pending=Q(t.data),t=>t.touch(this))));return{async:n}}return e.request(t.url,t.format).then((t=>As(this,n,Q(t.data))))}}),Ds.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}]},pt(Ds,Oa,{transform(t,n){const e=t.fields,r=t.index,i=t.values,o=null==t.default?null:t.default,a=t.modified(),u=e.length;let s,c,f,d=a?n.SOURCE:n.ADD,h=n,m=t.as;return i?(c=i.length,u>1&&!m&&p('Multi-field lookup requires explicit "as" parameter.'),m&&m.length!==u*c&&p('The "as" parameter has too few output field names.'),m=m||i.map(l),s=function(t){for(var n,a,s=0,l=0;s<u;++s)if(null==(a=r.get(e[s](t))))for(n=0;n<c;++n,++l)t[m[l]]=o;else for(n=0;n<c;++n,++l)t[m[l]]=i[n](a)}):(m||p("Missing output field names."),s=function(t){for(var n,i=0;i<u;++i)n=r.get(e[i](t)),t[m[i]]=null==n?o:n}),a?h=n.reflow(!0):(f=e.some((t=>n.modified(t.fields))),d|=f?n.MOD:0),n.visit(d,s),h.modifies(m)}}),pt(Ss,ha),pt(Es,ha),pt(Cs,Oa,{transform(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),Os.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:_u,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},pt(Os,Uu,{_transform:Uu.prototype.transform,transform(t,n){return this._transform(function(t,n){const e=t.field,r=t.value,i=("count"===t.op?"__count__":t.op)||"sum",o=f(e).concat(f(r)),a=function(t,n,e){const r={},i=[];return e.visit(e.SOURCE,(n=>{const e=t(n);r[e]||(r[e]=1,i.push(e))})),i.sort(et),n?i.slice(0,n):i}(e,t.limit||0,n);return n.changed()&&t.set("__pivot__",null,null,!0),{key:t.key,groupby:t.groupby,ops:a.map((()=>i)),fields:a.map((t=>function(t,n,e,r){return c((r=>n(r)===t?e(r):NaN),r,t+"")}(t,e,r,o))),as:a.map((t=>t+"")),modified:t.modified.bind(t)}}(t,n),n)}}),pt(_s,cs,{transform(t,n){const e=t.subflow,r=t.field,i=t=>this.subflow(ta(t),e,n,t);return(t.modified("field")||r&&n.modified(f(r)))&&p("PreFacet does not support field modification."),this.initTargets(),r?(n.visit(n.MOD,(t=>{const n=i(t);r(t).forEach((t=>n.mod(t)))})),n.visit(n.ADD,(t=>{const n=i(t);r(t).forEach((t=>n.add(ea(t))))})),n.visit(n.REM,(t=>{const n=i(t);r(t).forEach((t=>n.rem(t)))}))):(n.visit(n.MOD,(t=>i(t).mod(t))),n.visit(n.ADD,(t=>i(t).add(t))),n.visit(n.REM,(t=>i(t).rem(t)))),n.clean()&&n.runAfter((()=>this.clean())),n}}),zs.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},pt(zs,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.fields,i=es(t.fields,t.as||[]),o=r?(t,n)=>function(t,n,e,r){for(let i=0,o=e.length;i<o;++i)n[r[i]]=e[i](t);return n}(t,n,r,i):ia;let a;return this.value?a=this.value:(n=n.addAll(),a=this.value={}),n.visit(n.REM,(t=>{const n=ta(t);e.rem.push(a[n]),a[n]=null})),n.visit(n.ADD,(t=>{const n=o(t,ea({}));a[ta(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{e.mod.push(o(t,a[ta(t)]))})),e}}),pt(Bs,Oa,{transform(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}}),Ts.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"]}]},pt(Ts,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=t.as||["prob","value"];if(this.value&&!t.modified()&&!n.changed())return e.source=this.value,e;const i=rs(n.materialize(n.SOURCE).source,t.groupby,t.field),o=(t.groupby||[]).map(l),a=[],u=t.step||.01,s=t.probs||En(u/2,1-1e-14,u),c=s.length;return i.forEach((t=>{const n=Pa(t,s);for(let e=0;e<c;++e){const i={};for(let n=0;n<o.length;++n)i[o[n]]=t.dims[n];i[r[0]]=s[e],i[r[1]]=n[e],a.push(ea(i))}})),this.value&&(e.rem=this.value),this.value=e.add=e.source=a,e}}),pt(Ps,Oa,{transform(t,n){let e,r;return this.value?r=this.value:(e=n=n.addAll(),r=this.value={}),t.derive&&(e=n.fork(n.NO_SOURCE),n.visit(n.REM,(t=>{const n=ta(t);e.rem.push(r[n]),r[n]=null})),n.visit(n.ADD,(t=>{const n=ra(t);r[ta(t)]=n,e.add.push(n)})),n.visit(n.MOD,(t=>{const n=r[ta(t)];for(const r in t)n[r]=t[r],e.modifies(r);e.mod.push(n)}))),e}}),js.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},pt(js,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE),r=t.modified("size"),i=t.size,o=this.value.reduce(((t,n)=>(t[ta(n)]=1,t)),{});let a=this.value,u=this.count,s=0;function c(t){let n,r;a.length<i?a.push(t):(r=~~((u+1)*Ia()),r<a.length&&r>=s&&(n=a[r],o[ta(n)]&&e.rem.push(n),a[r]=t)),++u}if(n.rem.length&&(n.visit(n.REM,(t=>{const n=ta(t);o[n]&&(o[n]=-1,e.rem.push(t)),--u})),a=a.filter((t=>-1!==o[ta(t)]))),(n.rem.length||r)&&a.length<i&&n.source&&(s=u=a.length,n.visit(n.SOURCE,(t=>{o[ta(t)]||c(t)})),s=-1),r&&a.length>i){const t=a.length-i;for(let n=0;n<t;++n)o[ta(a[n])]=-1,e.rem.push(a[n]);a=a.slice(t)}return n.mod.length&&n.visit(n.MOD,(t=>{o[ta(t)]&&e.mod.push(t)})),n.add.length&&n.visit(n.ADD,c),(n.add.length||s<0)&&(e.add=a.filter((t=>!o[ta(t)]))),this.count=u,this.value=e.source=a,e}}),Rs.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"}]},pt(Rs,Oa,{transform(t,n){if(this.value&&!t.modified())return;const e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=En(t.start,t.stop,t.step||1).map((t=>{const n={};return n[r]=t,ea(n)})),e.add=n.add.concat(this.value),e}}),pt(Ls,Oa,{transform(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation}});const qs=["unit0","unit1"];function Us(t){Oa.call(this,ht(),t)}function Ws(t){Oa.call(this,null,t)}Is.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Fe,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:qs}]},pt(Is,Oa,{transform(t,n){const e=t.field,r=!1!==t.interval,i="utc"===t.timezone,o=this._floor(t,n),a=(i?ir:rr)(o.unit).offset,u=t.as||qs,s=u[0],c=u[1],l=o.step;let d=o.start||1/0,h=o.stop||-1/0,m=n.ADD;return(t.modified()||n.changed(n.REM)||n.modified(f(e)))&&(m=(n=n.reflow(!0)).SOURCE,d=1/0,h=-1/0),n.visit(m,(t=>{const n=e(t);let i,u;null==n?(t[s]=null,r&&(t[c]=null)):(t[s]=i=u=o(n),r&&(t[c]=u=a(i,l)),i<d&&(d=i),u>h&&(h=u))})),o.start=d,o.stop=h,n.modifies(r?u:s)},_floor(t,n){const e="utc"===t.timezone,{units:r,step:i}=t.units?{units:t.units,step:t.step||1}:wr({extent:t.extent||ct(n.materialize(n.SOURCE).source,t.field),maxbins:t.maxbins}),o=Ne(r),a=this.value||{},u=(e?tr:Ke)(o,i);return u.unit=_(o),u.units=o,u.step=i,u.start=a.start,u.stop=a.stop,this.value=u}}),pt(Us,Oa,{transform(t,n){const e=n.dataflow,r=t.field,i=this.value,o=t=>i.set(r(t),t);let a=!0;return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,o)):n.changed()?(n.visit(n.REM,(t=>i.delete(r(t)))),n.visit(n.ADD,o)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()}}),pt(Ws,Oa,{transform(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(aa(t.sort)):n.source).map(t.field))}});const Hs={row_number:function(){return{next:t=>t.index+1}},rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){let t;return{init:()=>t=1,next:n=>{const e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){const t=Hs.rank(),n=t.next;return{init:t.init,next:t=>(n(t)-1)/(t.data.length-1)}},cume_dist:function(){let t;return{init:()=>t=0,next:n=>{const e=n.data,r=n.compare;let i=n.index;if(t<i){for(;i+1<e.length&&!r(e[i],e[i+1]);)++i;t=i}return(1+t)/e.length}}},ntile:function(t,n){(n=+n)>0||p("ntile num must be greater than zero.");const e=Hs.cume_dist(),r=e.next;return{init:e.init,next:t=>Math.ceil(n*r(t))}},lag:function(t,n){return n=+n||1,{next:e=>{const r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:e=>{const r=e.index+n,i=e.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:n=>t(n.data[n.i0])}},last_value:function(t){return{next:n=>t(n.data[n.i1-1])}},nth_value:function(t,n){return(n=+n)>0||p("nth_value nth must be greater than zero."),{next:e=>{const r=e.i0+(n-1);return r<e.i1?t(e.data[r]):null}}},prev_value:function(t){let n;return{init:()=>n=null,next:e=>{const r=t(e.data[e.index]);return null!=r?n=r:n}}},next_value:function(t){let n,e;return{init:()=>(n=null,e=-1),next:r=>{const i=r.data;return r.index<=e?n:(e=function(t,n,e){for(let r=n.length;e<r;++e)if(null!=t(n[e]))return e;return-1}(t,i,r.index))<0?(e=i.length,n=null):n=t(i[e])}}}},Gs=Object.keys(Hs);function Ys(t){const n=Q(t.ops),e=Q(t.fields),r=Q(t.params),i=Q(t.aggregate_params),o=Q(t.as),a=this.outputs=[],u=this.windows=[],s={},c={},d=[],h=[];let m=!0;function g(t){Q(f(t)).forEach((t=>s[t]=1))}g(t.sort),n.forEach(((t,n)=>{const s=e[n],f=r[n],v=i[n]||null,y=l(s),b=Eu(t,y,o[n]);if(g(s),a.push(b),ft(Hs,t))u.push(function(t,n,e,r){const i=Hs[t](n,e);return{init:i.init||w,update:function(t,n){n[r]=i.next(t)}}}(t,s,f,b));else{if(null==s&&"count"!==t&&p("Null aggregate field specified."),"count"===t)return void d.push(b);m=!1;let n=c[y];n||(n=c[y]=[],n.field=s,h.push(n)),n.push(zu(t,v,b))}})),(d.length||h.length)&&(this.cell=function(t,n,e){t=t.map((t=>Lu(t,t.field)));const r={num:0,agg:null,store:!1,count:n};if(!e)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 u=r.data=new Iu;return r.add=function(t){if(r.num+=1,!e){u&&u.add(t);for(let n=0;n<i;++n)o[n].add(o[n].get(t),t)}},r.rem=function(t){if(r.num-=1,!e){u&&u.rem(t);for(let n=0;n<i;++n)o[n].rem(o[n].get(t),t)}},r.set=function(t){let i,a;for(u&&u.values(),i=0,a=n.length;i<a;++i)t[n[i]]=r.num;if(!e)for(i=0,a=o.length;i<a;++i)o[i].set(t)},r.init=function(){r.num=0,u&&u.reset();for(let t=0;t<i;++t)o[t].init()},r}(h,d,m)),this.inputs=Object.keys(s)}const Vs=Ys.prototype;function Xs(t){Oa.call(this,{},t),this._mlen=0,this._mods=[]}function Js(t,n,e,r){const i=r.sort,o=i&&!r.ignorePeers,a=r.frame||[null,0],u=t.data(e),s=u.length,c=o?Zt(i):null,l={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:i||at(-1)};n.init();for(let t=0;t<s;++t)Ks(l,a,t,s),o&&Qs(l,c),n.update(l,u[t])}function Ks(t,n,e,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==n[0]?0:Math.max(0,e-Math.abs(n[0])),t.i1=null==n[1]?r:Math.min(r,e+Math.abs(n[1])+1),t.index=e}function Qs(t,n){const e=t.i0,r=t.i1-1,i=t.compare,o=t.data,a=o.length-1;e>0&&!i(o[e],o[e-1])&&(t.i0=n.left(o,o[e])),r<a&&!i(o[r],o[r+1])&&(t.i1=n.right(o,o[r]))}Vs.init=function(){this.windows.forEach((t=>t.init())),this.cell&&this.cell.init()},Vs.update=function(t,n){const e=this.cell,r=this.windows,i=t.data,o=r&&r.length;let a;if(e){for(a=t.p0;a<t.i0;++a)e.rem(i[a]);for(a=t.p1;a<t.i1;++a)e.add(i[a]);e.set(n)}for(a=0;a<o;++a)r[a].update(t,n)},Xs.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Gs.concat(_u)},{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}]},pt(Xs,Oa,{transform(t,n){this.stamp=n.stamp;const e=t.modified(),r=aa(t.sort),i=Fu(t.groupby),o=t=>this.group(i(t));let a=this.state;a&&!e||(a=this.state=new Ys(t)),e||n.modified(a.inputs)?(this.value={},n.visit(n.SOURCE,(t=>o(t).add(t)))):(n.visit(n.REM,(t=>o(t).remove(t))),n.visit(n.ADD,(t=>o(t).add(t))));for(let n=0,e=this._mlen;n<e;++n)Js(this._mods[n],a,r,t);return this._mlen=0,this._mods=[],n.reflow(e).modifies(a.outputs)},group(t){let n=this.value[t];return n||(n=this.value[t]=Hu(ta),n.stamp=-1),n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n),n}});var Zs=Object.freeze({__proto__:null,aggregate:Uu,bin:Wu,collect:Gu,compare:Yu,countpattern:Xu,cross:Ju,density:ts,dotbin:is,expression:os,extent:us,facet:cs,field:ls,filter:ds,flatten:hs,fold:ms,formula:ps,generate:gs,impute:bs,joinaggregate:ws,kde:xs,key:$s,load:Ms,lookup:Ds,multiextent:Ss,multivalues:Es,params:Cs,pivot:Os,prefacet:_s,project:zs,proxy:Bs,quantile:Ts,relay:Ps,sample:js,sequence:Rs,sieve:Ls,subflow:ss,timeunit:Is,tupleindex:Us,values:Ws,window:Xs});function tc(t){return function(){return t}}const nc=Math.abs,ec=Math.atan2,rc=Math.cos,ic=Math.max,oc=Math.min,ac=Math.sin,uc=Math.sqrt,sc=1e-12,cc=Math.PI,lc=cc/2,fc=2*cc;function dc(t){return t>=1?lc:t<=-1?-lc:Math.asin(t)}const hc=Math.PI,mc=2*hc,pc=1e-6,gc=mc-pc;function vc(t){this._+=t[0];for(let n=1,e=t.length;n<e;++n)this._+=arguments[n]+t[n]}let yc=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?vc:function(t){let n=Math.floor(t);if(!(n>=0))throw new Error(`invalid digits: ${t}`);if(n>15)return vc;const e=10**n;return function(t){this._+=t[0];for(let n=1,r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,e,r){this._append`Q${+t},${+n},${this._x1=+e},${this._y1=+r}`}bezierCurveTo(t,n,e,r,i,o){this._append`C${+t},${+n},${+e},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,n,e,r,i){if(t=+t,n=+n,e=+e,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,u=e-t,s=r-n,c=o-t,l=a-n,f=c*c+l*l;if(null===this._x1)this._append`M${this._x1=t},${this._y1=n}`;else if(f>pc)if(Math.abs(l*u-s*c)>pc&&i){let d=e-o,h=r-a,m=u*u+s*s,p=d*d+h*h,g=Math.sqrt(m),v=Math.sqrt(f),y=i*Math.tan((hc-Math.acos((m+f-p)/(2*g*v)))/2),b=y/v,w=y/g;Math.abs(b-1)>pc&&this._append`L${t+b*c},${n+b*l}`,this._append`A${i},${i},0,0,${+(l*d>c*h)},${this._x1=t+w*u},${this._y1=n+w*s}`}else this._append`L${this._x1=t},${this._y1=n}`}arc(t,n,e,r,i,o){if(t=+t,n=+n,o=!!o,(e=+e)<0)throw new Error(`negative radius: ${e}`);let a=e*Math.cos(r),u=e*Math.sin(r),s=t+a,c=n+u,l=1^o,f=o?r-i:i-r;null===this._x1?this._append`M${s},${c}`:(Math.abs(this._x1-s)>pc||Math.abs(this._y1-c)>pc)&&this._append`L${s},${c}`,e&&(f<0&&(f=f%mc+mc),f>gc?this._append`A${e},${e},0,1,${l},${t-a},${n-u}A${e},${e},0,1,${l},${this._x1=s},${this._y1=c}`:f>pc&&this._append`A${e},${e},0,${+(f>=hc)},${l},${this._x1=t+e*Math.cos(i)},${this._y1=n+e*Math.sin(i)}`)}rect(t,n,e,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${e=+e}v${+r}h${-e}Z`}toString(){return this._}};function bc(){return new yc}function wc(t){let n=3;return t.digits=function(e){if(!arguments.length)return n;if(null==e)n=null;else{const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);n=t}return t},()=>new yc(n)}function xc(t){return t.innerRadius}function $c(t){return t.outerRadius}function kc(t){return t.startAngle}function Mc(t){return t.endAngle}function Ac(t){return t&&t.padAngle}function Dc(t,n,e,r,i,o,a){var u=t-e,s=n-r,c=(a?o:-o)/uc(u*u+s*s),l=c*s,f=-c*u,d=t+l,h=n+f,m=e+l,p=r+f,g=(d+m)/2,v=(h+p)/2,y=m-d,b=p-h,w=y*y+b*b,x=i-o,$=d*p-m*h,k=(b<0?-1:1)*uc(ic(0,x*x*w-$*$)),M=($*b-y*k)/w,A=(-$*y-b*k)/w,D=($*b+y*k)/w,S=(-$*y+b*k)/w,F=M-g,E=A-v,N=D-g,C=S-v;return F*F+E*E>N*N+C*C&&(M=D,A=S),{cx:M,cy:A,x01:-l,y01:-f,x11:M*(i/x-1),y11:A*(i/x-1)}}function Sc(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Fc(t){this._context=t}function Ec(t){return new Fc(t)}function Nc(t){return t[0]}function Cc(t){return t[1]}function Oc(t,n){var e=tc(!0),r=null,i=Ec,o=null,a=wc(u);function u(u){var s,c,l,f=(u=Sc(u)).length,d=!1;for(null==r&&(o=i(l=a())),s=0;s<=f;++s)!(s<f&&e(c=u[s],s,u))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+t(c,s,u),+n(c,s,u));if(l)return o=null,l+""||null}return t="function"==typeof t?t:void 0===t?Nc:tc(t),n="function"==typeof n?n:void 0===n?Cc:tc(n),u.x=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:tc(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),u):r},u}function _c(t,n,e){var r=null,i=tc(!0),o=null,a=Ec,u=null,s=wc(c);function c(c){var l,f,d,h,m,p=(c=Sc(c)).length,g=!1,v=new Array(p),y=new Array(p);for(null==o&&(u=a(m=s())),l=0;l<=p;++l){if(!(l<p&&i(h=c[l],l,c))===g)if(g=!g)f=l,u.areaStart(),u.lineStart();else{for(u.lineEnd(),u.lineStart(),d=l-1;d>=f;--d)u.point(v[d],y[d]);u.lineEnd(),u.areaEnd()}g&&(v[l]=+t(h,l,c),y[l]=+n(h,l,c),u.point(r?+r(h,l,c):v[l],e?+e(h,l,c):y[l]))}if(m)return u=null,m+""||null}function l(){return Oc().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Nc:tc(+t),n="function"==typeof n?n:tc(void 0===n?0:+n),e="function"==typeof e?e:void 0===e?Cc:tc(+e),c.x=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),r=null,c):t},c.x0=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:tc(+t),c):r},c.y=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),e=null,c):n},c.y0=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),c):n},c.y1=function(t){return arguments.length?(e=null==t?null:"function"==typeof t?t:tc(+t),c):e},c.lineX0=c.lineY0=function(){return l().x(t).y(n)},c.lineY1=function(){return l().x(t).y(e)},c.lineX1=function(){return l().x(r).y(n)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:tc(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(u=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=u=null:u=a(o=t),c):o},c}bc.prototype=yc.prototype,Fc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var zc={draw(t,n){const e=uc(n/cc);t.moveTo(e,0),t.arc(0,0,e,0,fc)}};function Bc(){}function Tc(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function Pc(t){this._context=t}function jc(t){this._context=t}function Rc(t){this._context=t}function Lc(t,n){this._basis=new Pc(t),this._beta=n}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(){switch(this._point){case 3:Tc(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Tc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},jc.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:Tc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Rc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:Tc(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},Lc.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],o=n[0],a=t[e]-i,u=n[e]-o,s=-1;++s<=e;)this._basis.point(this._beta*t[s]+(1-this._beta)*(i+(r=s/e)*a),this._beta*n[s]+(1-this._beta)*(o+r*u));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var Ic=function t(n){function e(t){return 1===n?new Pc(t):new Lc(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function qc(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function Uc(t,n){this._context=t,this._k=(1-n)/6}Uc.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:qc(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:qc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Wc=function t(n){function e(t){return new Uc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Hc(t,n){this._context=t,this._k=(1-n)/6}Hc.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:qc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Gc=function t(n){function e(t){return new Hc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Yc(t,n){this._context=t,this._k=(1-n)/6}Yc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:qc(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Vc=function t(n){function e(t){return new Yc(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Xc(t,n,e){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>sc){var u=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*u-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*u-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>sc){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,l=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-n*t._l12_2a)/l,a=(a*c+t._y1*t._l23_2a-e*t._l12_2a)/l}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function Jc(t,n){this._context=t,this._alpha=n}Jc.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Xc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Kc=function t(n){function e(t){return n?new Jc(t,n):new Uc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Qc(t,n){this._context=t,this._alpha=n}Qc.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Xc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Zc=function t(n){function e(t){return n?new Qc(t,n):new Hc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function tl(t,n){this._context=t,this._alpha=n}tl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Xc(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var nl=function t(n){function e(t){return n?new tl(t,n):new Yc(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function el(t){this._context=t}function rl(t){return t<0?-1:1}function il(t,n,e){var r=t._x1-t._x0,i=n-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(e-t._y1)/(i||r<0&&-0),u=(o*i+a*r)/(r+i);return(rl(o)+rl(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(u))||0}function ol(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function al(t,n,e){var r=t._x0,i=t._x1,o=t._y1,a=(i-r)/3;t._context.bezierCurveTo(r+a,t._y0+a*n,i-a,o-a*e,i,o)}function ul(t){this._context=t}function sl(t){this._context=new cl(t)}function cl(t){this._context=t}function ll(t){this._context=t}function fl(t){var n,e,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],n=1;n<r-1;++n)i[n]=1,o[n]=4,a[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)o[n]-=e=i[n]/o[n-1],a[n]-=e*a[n-1];for(i[r-1]=a[r-1]/o[r-1],n=r-2;n>=0;--n)i[n]=(a[n]-i[n+1])/o[n];for(o[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)o[n]=2*t[n+1]-i[n+1];return[i,o]}function dl(t,n){this._context=t,this._t=n}function hl(t,n){if("undefined"!=typeof document&&document.createElement){const e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}el.prototype={areaStart:Bc,areaEnd:Bc,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},ul.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:al(this,this._t0,ol(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,al(this,ol(this,e=il(this,t,n)),e);break;default:al(this,this._t0,e=il(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(sl.prototype=Object.create(ul.prototype)).point=function(t,n){ul.prototype.point.call(this,n,t)},cl.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,o){this._context.bezierCurveTo(n,t,r,e,o,i)}},ll.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=fl(t),i=fl(n),o=0,a=1;a<e;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],n[a]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},dl.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};const ml=()=>"undefined"!=typeof Image?Image:null;function pl(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function gl(t,n){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof n?this.interpolator(n):this.range(n)}return this}const vl=Symbol("implicit");function yl(){var t=new un,n=[],e=[],r=vl;function i(i){let o=t.get(i);if(void 0===o){if(r!==vl)return r;t.set(i,o=n.push(i)-1)}return e[o%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=new un;for(const r of e)t.has(r)||t.set(r,n.push(r)-1);return i},i.range=function(t){return arguments.length?(e=Array.from(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return yl(n,e).unknown(r)},pl.apply(i,arguments),i}function bl(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function wl(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function xl(){}var $l=.7,kl=1/$l,Ml="\\s*([+-]?\\d+)\\s*",Al="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Sl=/^#([0-9a-f]{3,8})$/,Fl=new RegExp(`^rgb\\(${Ml},${Ml},${Ml}\\)$`),El=new RegExp(`^rgb\\(${Dl},${Dl},${Dl}\\)$`),Nl=new RegExp(`^rgba\\(${Ml},${Ml},${Ml},${Al}\\)$`),Cl=new RegExp(`^rgba\\(${Dl},${Dl},${Dl},${Al}\\)$`),Ol=new RegExp(`^hsl\\(${Al},${Dl},${Dl}\\)$`),_l=new RegExp(`^hsla\\(${Al},${Dl},${Dl},${Al}\\)$`),zl={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 Bl(){return this.rgb().formatHex()}function Tl(){return this.rgb().formatRgb()}function Pl(t){var n,e;return t=(t+"").trim().toLowerCase(),(n=Sl.exec(t))?(e=n[1].length,n=parseInt(n[1],16),6===e?jl(n):3===e?new ql(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===e?Rl(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===e?Rl(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Fl.exec(t))?new ql(n[1],n[2],n[3],1):(n=El.exec(t))?new ql(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Nl.exec(t))?Rl(n[1],n[2],n[3],n[4]):(n=Cl.exec(t))?Rl(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Ol.exec(t))?Vl(n[1],n[2]/100,n[3]/100,1):(n=_l.exec(t))?Vl(n[1],n[2]/100,n[3]/100,n[4]):zl.hasOwnProperty(t)?jl(zl[t]):"transparent"===t?new ql(NaN,NaN,NaN,0):null}function jl(t){return new ql(t>>16&255,t>>8&255,255&t,1)}function Rl(t,n,e,r){return r<=0&&(t=n=e=NaN),new ql(t,n,e,r)}function Ll(t){return t instanceof xl||(t=Pl(t)),t?new ql((t=t.rgb()).r,t.g,t.b,t.opacity):new ql}function Il(t,n,e,r){return 1===arguments.length?Ll(t):new ql(t,n,e,null==r?1:r)}function ql(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function Ul(){return`#${Yl(this.r)}${Yl(this.g)}${Yl(this.b)}`}function Wl(){const t=Hl(this.opacity);return`${1===t?"rgb(":"rgba("}${Gl(this.r)}, ${Gl(this.g)}, ${Gl(this.b)}${1===t?")":`, ${t})`}`}function Hl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Gl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Yl(t){return((t=Gl(t))<16?"0":"")+t.toString(16)}function Vl(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new Kl(t,n,e,r)}function Xl(t){if(t instanceof Kl)return new Kl(t.h,t.s,t.l,t.opacity);if(t instanceof xl||(t=Pl(t)),!t)return new Kl;if(t instanceof Kl)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),o=Math.max(n,e,r),a=NaN,u=o-i,s=(o+i)/2;return u?(a=n===o?(e-r)/u+6*(e<r):e===o?(r-n)/u+2:(n-e)/u+4,u/=s<.5?o+i:2-o-i,a*=60):u=s>0&&s<1?0:a,new Kl(a,u,s,t.opacity)}function Jl(t,n,e,r){return 1===arguments.length?Xl(t):new Kl(t,n,e,null==r?1:r)}function Kl(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Ql(t){return(t=(t||0)%360)<0?t+360:t}function Zl(t){return Math.max(0,Math.min(1,t||0))}function tf(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}bl(xl,Pl,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Bl,formatHex:Bl,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Xl(this).formatHsl()},formatRgb:Tl,toString:Tl}),bl(ql,Il,wl(xl,{brighter(t){return t=null==t?kl:Math.pow(kl,t),new ql(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?$l:Math.pow($l,t),new ql(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ql(Gl(this.r),Gl(this.g),Gl(this.b),Hl(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:Ul,formatHex:Ul,formatHex8:function(){return`#${Yl(this.r)}${Yl(this.g)}${Yl(this.b)}${Yl(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Wl,toString:Wl})),bl(Kl,Jl,wl(xl,{brighter(t){return t=null==t?kl:Math.pow(kl,t),new Kl(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?$l:Math.pow($l,t),new Kl(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new ql(tf(t>=240?t-240:t+120,i,r),tf(t,i,r),tf(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Kl(Ql(this.h),Zl(this.s),Zl(this.l),Hl(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=Hl(this.opacity);return`${1===t?"hsl(":"hsla("}${Ql(this.h)}, ${100*Zl(this.s)}%, ${100*Zl(this.l)}%${1===t?")":`, ${t})`}`}}));const nf=Math.PI/180,ef=180/Math.PI,rf=.96422,of=.82521,af=4/29,uf=6/29,sf=3*uf*uf,cf=uf*uf*uf;function lf(t){if(t instanceof df)return new df(t.l,t.a,t.b,t.opacity);if(t instanceof yf)return bf(t);t instanceof ql||(t=Ll(t));var n,e,r=gf(t.r),i=gf(t.g),o=gf(t.b),a=hf((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?n=e=a:(n=hf((.4360747*r+.3850649*i+.1430804*o)/rf),e=hf((.0139322*r+.0971045*i+.7141733*o)/of)),new df(116*a-16,500*(n-a),200*(a-e),t.opacity)}function ff(t,n,e,r){return 1===arguments.length?lf(t):new df(t,n,e,null==r?1:r)}function df(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function hf(t){return t>cf?Math.pow(t,1/3):t/sf+af}function mf(t){return t>uf?t*t*t:sf*(t-af)}function pf(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function gf(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function vf(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof yf)return new yf(t.h,t.c,t.l,t.opacity);if(t instanceof df||(t=lf(t)),0===t.a&&0===t.b)return new yf(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*ef;return new yf(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new yf(t,n,e,null==r?1:r)}function yf(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}function bf(t){if(isNaN(t.h))return new df(t.l,0,0,t.opacity);var n=t.h*nf;return new df(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}bl(df,ff,wl(xl,{brighter(t){return new df(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new df(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new ql(pf(3.1338561*(n=rf*mf(n))-1.6168667*(t=1*mf(t))-.4906146*(e=of*mf(e))),pf(-.9787684*n+1.9161415*t+.033454*e),pf(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),bl(yf,vf,wl(xl,{brighter(t){return new yf(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new yf(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return bf(this).rgb()}}));var wf=-.14861,xf=1.78277,$f=-.29227,kf=-.90649,Mf=1.97294,Af=Mf*kf,Df=Mf*xf,Sf=xf*$f-kf*wf;function Ff(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Ef)return new Ef(t.h,t.s,t.l,t.opacity);t instanceof ql||(t=Ll(t));var n=t.g/255,e=t.b/255,r=(Sf*e+Af*(t.r/255)-Df*n)/(Sf+Af-Df),i=e-r,o=(Mf*(n-r)-$f*i)/kf,a=Math.sqrt(o*o+i*i)/(Mf*r*(1-r)),u=a?Math.atan2(o,i)*ef-120:NaN;return new Ef(u<0?u+360:u,a,r,t.opacity)}(t):new Ef(t,n,e,null==r?1:r)}function Ef(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function Nf(t,n,e,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*n+(4-6*o+3*a)*e+(1+3*t+3*o-3*a)*r+a*i)/6}function Cf(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],o=t[r+1];return Nf((e-r/n)*n,r>0?t[r-1]:2*i-o,i,o,r<n-1?t[r+2]:2*o-i)}}function Of(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n);return Nf((e-r/n)*n,t[(r+n-1)%n],t[r%n],t[(r+1)%n],t[(r+2)%n])}}bl(Ef,Ff,wl(xl,{brighter(t){return t=null==t?kl:Math.pow(kl,t),new Ef(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?$l:Math.pow($l,t),new Ef(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*nf,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new ql(255*(n+e*(wf*r+xf*i)),255*(n+e*($f*r+kf*i)),255*(n+e*(Mf*r)),this.opacity)}}));var _f=t=>()=>t;function zf(t,n){return function(e){return t+e*n}}function Bf(t,n){var e=n-t;return e?zf(t,e>180||e<-180?e-360*Math.round(e/360):e):_f(isNaN(t)?n:t)}function Tf(t,n){var e=n-t;return e?zf(t,e):_f(isNaN(t)?n:t)}var Pf=function t(n){var e=function(t){return 1==(t=+t)?Tf:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):_f(isNaN(n)?e:n)}}(n);function r(t,n){var r=e((t=Il(t)).r,(n=Il(n)).r),i=e(t.g,n.g),o=e(t.b,n.b),a=Tf(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=o(n),t.opacity=a(n),t+""}}return r.gamma=t,r}(1);function jf(t){return function(n){var e,r,i=n.length,o=new Array(i),a=new Array(i),u=new Array(i);for(e=0;e<i;++e)r=Il(n[e]),o[e]=r.r||0,a[e]=r.g||0,u[e]=r.b||0;return o=t(o),a=t(a),u=t(u),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=u(t),r+""}}}var Rf=jf(Cf),Lf=jf(Of);function If(t,n){n||(n=[]);var e,r=t?Math.min(n.length,t.length):0,i=n.slice();return function(o){for(e=0;e<r;++e)i[e]=t[e]*(1-o)+n[e]*o;return i}}function qf(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Uf(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(e=0;e<i;++e)o[e]=Jf(t[e],n[e]);for(;e<r;++e)a[e]=n[e];return function(t){for(e=0;e<i;++e)a[e]=o[e](t);return a}}function Wf(t,n){var e=new Date;return t=+t,n=+n,function(r){return e.setTime(t*(1-r)+n*r),e}}function Hf(t,n){return t=+t,n=+n,function(e){return t*(1-e)+n*e}}function Gf(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Jf(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Yf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Vf=new RegExp(Yf.source,"g");function Xf(t,n){var e,r,i,o=Yf.lastIndex=Vf.lastIndex=0,a=-1,u=[],s=[];for(t+="",n+="";(e=Yf.exec(t))&&(r=Vf.exec(n));)(i=r.index)>o&&(i=n.slice(o,i),u[a]?u[a]+=i:u[++a]=i),(e=e[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,s.push({i:a,x:Hf(e,r)})),o=Vf.lastIndex;return o<n.length&&(i=n.slice(o),u[a]?u[a]+=i:u[++a]=i),u.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)u[(e=s[r]).i]=e.x(t);return u.join("")})}function Jf(t,n){var e,r=typeof n;return null==n||"boolean"===r?_f(n):("number"===r?Hf:"string"===r?(e=Pl(n))?(n=e,Pf):Xf:n instanceof Pl?Pf:n instanceof Date?Wf:qf(n)?If:Array.isArray(n)?Uf:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Gf:Hf)(t,n)}function Kf(t,n){return t=+t,n=+n,function(e){return Math.round(t*(1-e)+n*e)}}var Qf,Zf=180/Math.PI,td={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function nd(t,n,e,r,i,o){var a,u,s;return(a=Math.sqrt(t*t+n*n))&&(t/=a,n/=a),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(u=Math.sqrt(e*e+r*r))&&(e/=u,r/=u,s/=u),t*r<n*e&&(t=-t,n=-n,s=-s,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(n,t)*Zf,skewX:Math.atan(s)*Zf,scaleX:a,scaleY:u}}function ed(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var u=[],s=[];return o=t(o),a=t(a),function(t,r,i,o,a,u){if(t!==i||r!==o){var s=a.push("translate(",null,n,null,e);u.push({i:s-4,x:Hf(t,i)},{i:s-2,x:Hf(r,o)})}else(i||o)&&a.push("translate("+i+n+o+e)}(o.translateX,o.translateY,a.translateX,a.translateY,u,s),function(t,n,e,o){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),o.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Hf(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(o.rotate,a.rotate,u,s),function(t,n,e,o){t!==n?o.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Hf(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(o.skewX,a.skewX,u,s),function(t,n,e,r,o,a){if(t!==e||n!==r){var u=o.push(i(o)+"scale(",null,",",null,")");a.push({i:u-4,x:Hf(t,e)},{i:u-2,x:Hf(n,r)})}else 1===e&&1===r||o.push(i(o)+"scale("+e+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,u,s),o=a=null,function(t){for(var n,e=-1,r=s.length;++e<r;)u[(n=s[e]).i]=n.x(t);return u.join("")}}}var rd=ed((function(t){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return n.isIdentity?td:nd(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),id=ed((function(t){return null==t?td:(Qf||(Qf=document.createElementNS("http://www.w3.org/2000/svg","g")),Qf.setAttribute("transform",t),(t=Qf.transform.baseVal.consolidate())?nd((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):td)}),", ",")",")");function od(t){return((t=Math.exp(t))+1/t)/2}var ad=function t(n,e,r){function i(t,i){var o,a,u=t[0],s=t[1],c=t[2],l=i[2],f=i[0]-u,d=i[1]-s,h=f*f+d*d;if(h<1e-12)a=Math.log(l/c)/n,o=function(t){return[u+t*f,s+t*d,c*Math.exp(n*t*a)]};else{var m=Math.sqrt(h),p=(l*l-c*c+r*h)/(2*c*e*m),g=(l*l-c*c-r*h)/(2*l*e*m),v=Math.log(Math.sqrt(p*p+1)-p),y=Math.log(Math.sqrt(g*g+1)-g);a=(y-v)/n,o=function(t){var r=t*a,i=od(v),o=c/(e*m)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(n*r+v)-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[u+o*f,s+o*d,c*i/od(n*r+v)]}}return o.duration=1e3*a*n/Math.SQRT2,o}return i.rho=function(n){var e=Math.max(.001,+n),r=e*e;return t(e,r,r*r)},i}(Math.SQRT2,2,4);function ud(t){return function(n,e){var r=t((n=Jl(n)).h,(e=Jl(e)).h),i=Tf(n.s,e.s),o=Tf(n.l,e.l),a=Tf(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var sd=ud(Bf),cd=ud(Tf);function ld(t){return function(n,e){var r=t((n=vf(n)).h,(e=vf(e)).h),i=Tf(n.c,e.c),o=Tf(n.l,e.l),a=Tf(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=o(t),n.opacity=a(t),n+""}}}var fd=ld(Bf),dd=ld(Tf);function hd(t){return function n(e){function r(n,r){var i=t((n=Ff(n)).h,(r=Ff(r)).h),o=Tf(n.s,r.s),a=Tf(n.l,r.l),u=Tf(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=o(t),n.l=a(Math.pow(t,e)),n.opacity=u(t),n+""}}return e=+e,r.gamma=n,r}(1)}var md=hd(Bf),pd=hd(Tf);function gd(t,n){void 0===n&&(n=t,t=Jf);for(var e=0,r=n.length-1,i=n[0],o=new Array(r<0?0:r);e<r;)o[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[n](t-n)}}var vd=Object.freeze({__proto__:null,interpolate:Jf,interpolateArray:function(t,n){return(qf(n)?If:Uf)(t,n)},interpolateBasis:Cf,interpolateBasisClosed:Of,interpolateCubehelix:md,interpolateCubehelixLong:pd,interpolateDate:Wf,interpolateDiscrete:function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},interpolateHcl:fd,interpolateHclLong:dd,interpolateHsl:sd,interpolateHslLong:cd,interpolateHue:function(t,n){var e=Bf(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},interpolateLab:function(t,n){var e=Tf((t=ff(t)).l,(n=ff(n)).l),r=Tf(t.a,n.a),i=Tf(t.b,n.b),o=Tf(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=o(n),t+""}},interpolateNumber:Hf,interpolateNumberArray:If,interpolateObject:Gf,interpolateRgb:Pf,interpolateRgbBasis:Rf,interpolateRgbBasisClosed:Lf,interpolateRound:Kf,interpolateString:Xf,interpolateTransformCss:rd,interpolateTransformSvg:id,interpolateZoom:ad,piecewise:gd,quantize:function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e}});function yd(t){return+t}var bd=[0,1];function wd(t){return t}function xd(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:function(t){return function(){return t}}(isNaN(n)?NaN:.5)}function $d(t,n,e){var r=t[0],i=t[1],o=n[0],a=n[1];return i<r?(r=xd(i,r),o=e(a,o)):(r=xd(r,i),o=e(o,a)),function(t){return o(r(t))}}function kd(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),o=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++a<r;)i[a]=xd(t[a],t[a+1]),o[a]=e(n[a],n[a+1]);return function(n){var e=rn(t,n,1,r)-1;return o[e](i[e](n))}}function Md(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Ad(){var t,n,e,r,i,o,a=bd,u=bd,s=Jf,c=wd;function l(){var t=Math.min(a.length,u.length);return c!==wd&&(c=function(t,n){var e;return t>n&&(e=t,t=n,n=e),function(e){return Math.max(t,Math.min(n,e))}}(a[0],a[t-1])),r=t>2?kd:$d,i=o=null,f}function f(n){return null==n||isNaN(n=+n)?e:(i||(i=r(a.map(t),u,s)))(t(c(n)))}return f.invert=function(e){return c(n((o||(o=r(u,a.map(t),Hf)))(e)))},f.domain=function(t){return arguments.length?(a=Array.from(t,yd),l()):a.slice()},f.range=function(t){return arguments.length?(u=Array.from(t),l()):u.slice()},f.rangeRound=function(t){return u=Array.from(t),s=Kf,l()},f.clamp=function(t){return arguments.length?(c=!!t||wd,l()):c!==wd},f.interpolate=function(t){return arguments.length?(s=t,l()):s},f.unknown=function(t){return arguments.length?(e=t,f):e},function(e,r){return t=e,n=r,l()}}function Dd(){return Ad()(wd,wd)}function Sd(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Fd(t){return(t=Sd(Math.abs(t)))?t[1]:NaN}var Ed,Nd=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Cd(t){if(!(n=Nd.exec(t)))throw new Error("invalid format: "+t);var n;return new Od({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}function Od(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 _d(t,n){var e=Sd(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}Cd.prototype=Od.prototype,Od.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 zd={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return _d(100*t,n)},r:_d,s:function(t,n){var e=Sd(t,n);if(!e)return t+"";var r=e[0],i=e[1],o=i-(Ed=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")+Sd(t,Math.max(0,n+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Bd(t){return t}var Td,Pd,jd,Rd=Array.prototype.map,Ld=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Id(t,n,e,r){var i,o=wn(t,n,e);switch((r=Cd(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Fd(n)/3)))-Fd(Math.abs(t)))}(o,a))||(r.precision=i),jd(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Fd(n)-Fd(t))+1}(o,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Fd(Math.abs(t)))}(o))||(r.precision=i-2*("%"===r.type))}return Pd(r)}function qd(t){var n=t.domain;return t.ticks=function(t){var e=n();return yn(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return Id(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i,o=n(),a=0,u=o.length-1,s=o[a],c=o[u],l=10;for(c<s&&(i=s,s=c,c=i,i=a,a=u,u=i);l-- >0;){if((i=bn(s,c,e))===r)return o[a]=s,o[u]=c,n(o);if(i>0)s=Math.floor(s/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;s=Math.ceil(s*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function Ud(t,n){var e,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(e=r,r=i,i=e,e=o,o=a,a=e),t[r]=n.floor(o),t[i]=n.ceil(a),t}function Wd(t){return Math.log(t)}function Hd(t){return Math.exp(t)}function Gd(t){return-Math.log(-t)}function Yd(t){return-Math.exp(-t)}function Vd(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Xd(t){return(n,e)=>-t(-n,e)}function Jd(t){const n=t(Wd,Hd),e=n.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),n=>Math.log(n)/t)}(o),i=function(t){return 10===t?Vd:t===Math.E?Math.exp:n=>Math.pow(t,n)}(o),e()[0]<0?(r=Xd(r),i=Xd(i),t(Gd,Yd)):t(Wd,Hd),n}return n.base=function(t){return arguments.length?(o=+t,a()):o},n.domain=function(t){return arguments.length?(e(t),a()):e()},n.ticks=t=>{const n=e();let a=n[0],u=n[n.length-1];const s=u<a;s&&([a,u]=[u,a]);let c,l,f=r(a),d=r(u);const h=null==t?10:+t;let m=[];if(!(o%1)&&d-f<h){if(f=Math.floor(f),d=Math.ceil(d),a>0){for(;f<=d;++f)for(c=1;c<o;++c)if(l=f<0?c/i(-f):c*i(f),!(l<a)){if(l>u)break;m.push(l)}}else for(;f<=d;++f)for(c=o-1;c>=1;--c)if(l=f>0?c/i(-f):c*i(f),!(l<a)){if(l>u)break;m.push(l)}2*m.length<h&&(m=yn(a,u,h))}else m=yn(f,d,Math.min(d-f,h)).map(i);return s?m.reverse():m},n.tickFormat=(t,e)=>{if(null==t&&(t=10),null==e&&(e=10===o?"s":","),"function"!=typeof e&&(o%1||null!=(e=Cd(e)).precision||(e.trim=!0),e=Pd(e)),t===1/0)return e;const a=Math.max(1,o*t/n.ticks().length);return t=>{let n=t/i(Math.round(r(t)));return n*o<o-.5&&(n*=o),n<=a?e(t):""}},n.nice=()=>e(Ud(e(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),n}function Kd(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function Qd(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function Zd(t){var n=1,e=t(Kd(n),Qd(n));return e.constant=function(e){return arguments.length?t(Kd(n=+e),Qd(n)):n},qd(e)}function th(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function nh(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function eh(t){return t<0?-t*t:t*t}function rh(t){var n=t(wd,wd),e=1;return n.exponent=function(n){return arguments.length?1==(e=+n)?t(wd,wd):.5===e?t(nh,eh):t(th(e),th(1/e)):e},qd(n)}function ih(){var t=rh(Ad());return t.copy=function(){return Md(t,ih()).exponent(t.exponent())},pl.apply(t,arguments),t}Td=function(t){var n,e,r=void 0===t.grouping||void 0===t.thousands?Bd:(n=Rd.call(t.grouping,Number),e=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,u=n[0],s=0;i>0&&u>0&&(s+u+1>r&&(u=Math.max(1,r-s)),o.push(t.substring(i-=u,i+u)),!((s+=u+1)>r));)u=n[a=(a+1)%n.length];return o.reverse().join(e)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=t.decimal+"",u=void 0===t.numerals?Bd:function(t){return function(n){return n.replace(/[0-9]/g,(function(n){return t[+n]}))}}(Rd.call(t.numerals,String)),s=void 0===t.percent?"%":t.percent+"",c=t.minus+"",l=void 0===t.nan?"NaN":t.nan+"";function f(t){var n=(t=Cd(t)).fill,e=t.align,f=t.sign,d=t.symbol,h=t.zero,m=t.width,p=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(p=!0,y="g"):zd[y]||(void 0===g&&(g=12),v=!0,y="g"),(h||"0"===n&&"="===e)&&(h=!0,n="0",e="=");var b="$"===d?i:"#"===d&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",w="$"===d?o:/[%p]/.test(y)?s:"",x=zd[y],$=/[defgprs%]/.test(y);function k(t){var i,o,s,d=b,k=w;if("c"===y)k=x(t)+k,t="";else{var M=(t=+t)<0||1/t<0;if(t=isNaN(t)?l:x(Math.abs(t),g),v&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),M&&0==+t&&"+"!==f&&(M=!1),d=(M?"("===f?f:c:"-"===f||"("===f?"":f)+d,k=("s"===y?Ld[8+Ed/3]:"")+k+(M&&"("===f?")":""),$)for(i=-1,o=t.length;++i<o;)if(48>(s=t.charCodeAt(i))||s>57){k=(46===s?a+t.slice(i+1):t.slice(i))+k,t=t.slice(0,i);break}}p&&!h&&(t=r(t,1/0));var A=d.length+t.length+k.length,D=A<m?new Array(m-A+1).join(n):"";switch(p&&h&&(t=r(D+t,D.length?m-k.length:1/0),D=""),e){case"<":t=d+t+k+D;break;case"=":t=d+D+t+k;break;case"^":t=D.slice(0,A=D.length>>1)+d+t+k+D.slice(A);break;default:t=D+d+t+k}return u(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),k.toString=function(){return t+""},k}return{format:f,formatPrefix:function(t,n){var e=f(((t=Cd(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Fd(n)/3))),i=Math.pow(10,-r),o=Ld[8+r/3];return function(t){return e(i*t)+o}}}}({decimal:".",thousands:",",grouping:[3],currency:["$",""],minus:"-"}),Pd=Td.format,jd=Td.formatPrefix;const oh=new Date,ah=new Date;function uh(t,n,e,r){function i(n){return t(n=0===arguments.length?new Date:new Date(+n)),n}return i.floor=n=>(t(n=new Date(+n)),n),i.ceil=e=>(t(e=new Date(e-1)),n(e,1),t(e),e),i.round=t=>{const n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=(t,e)=>(n(t=new Date(+t),null==e?1:Math.floor(e)),t),i.range=(e,r,o)=>{const a=[];if(e=i.ceil(e),o=null==o?1:Math.floor(o),!(e<r&&o>0))return a;let u;do{a.push(u=new Date(+e)),n(e,o),t(e)}while(u<e&&e<r);return a},i.filter=e=>uh((n=>{if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)}),((t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})),e&&(i.count=(n,r)=>(oh.setTime(+n),ah.setTime(+r),t(oh),t(ah),Math.floor(e(oh,ah))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?n=>r(n)%t==0:n=>i.count(0,n)%t==0):i:null)),i}const sh=uh((()=>{}),((t,n)=>{t.setTime(+t+n)}),((t,n)=>n-t));sh.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?uh((n=>{n.setTime(Math.floor(n/t)*t)}),((n,e)=>{n.setTime(+n+e*t)}),((n,e)=>(e-n)/t)):sh:null);const ch=1e3,lh=6e4,fh=36e5,dh=864e5,hh=6048e5,mh=31536e6,ph=uh((t=>{t.setTime(t-t.getMilliseconds())}),((t,n)=>{t.setTime(+t+n*ch)}),((t,n)=>(n-t)/ch),(t=>t.getUTCSeconds())),gh=uh((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ch)}),((t,n)=>{t.setTime(+t+n*lh)}),((t,n)=>(n-t)/lh),(t=>t.getMinutes())),vh=uh((t=>{t.setUTCSeconds(0,0)}),((t,n)=>{t.setTime(+t+n*lh)}),((t,n)=>(n-t)/lh),(t=>t.getUTCMinutes())),yh=uh((t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ch-t.getMinutes()*lh)}),((t,n)=>{t.setTime(+t+n*fh)}),((t,n)=>(n-t)/fh),(t=>t.getHours())),bh=uh((t=>{t.setUTCMinutes(0,0,0)}),((t,n)=>{t.setTime(+t+n*fh)}),((t,n)=>(n-t)/fh),(t=>t.getUTCHours())),wh=uh((t=>t.setHours(0,0,0,0)),((t,n)=>t.setDate(t.getDate()+n)),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*lh)/dh),(t=>t.getDate()-1)),xh=uh((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dh),(t=>t.getUTCDate()-1)),$h=uh((t=>{t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+n)}),((t,n)=>(n-t)/dh),(t=>Math.floor(t/dh)));function kh(t){return uh((n=>{n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)}),((t,n)=>{t.setDate(t.getDate()+7*n)}),((t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*lh)/hh))}const Mh=kh(0);function Ah(t){return uh((n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCDate(t.getUTCDate()+7*n)}),((t,n)=>(n-t)/hh))}kh(1),kh(2),kh(3),kh(4),kh(5),kh(6);const Dh=Ah(0);Ah(1),Ah(2),Ah(3),Ah(4),Ah(5),Ah(6);const Sh=uh((t=>{t.setDate(1),t.setHours(0,0,0,0)}),((t,n)=>{t.setMonth(t.getMonth()+n)}),((t,n)=>n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())),(t=>t.getMonth())),Fh=uh((t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCMonth(t.getUTCMonth()+n)}),((t,n)=>n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())),(t=>t.getUTCMonth())),Eh=uh((t=>{t.setMonth(0,1),t.setHours(0,0,0,0)}),((t,n)=>{t.setFullYear(t.getFullYear()+n)}),((t,n)=>n.getFullYear()-t.getFullYear()),(t=>t.getFullYear()));Eh.every=t=>isFinite(t=Math.floor(t))&&t>0?uh((n=>{n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)}),((n,e)=>{n.setFullYear(n.getFullYear()+e*t)})):null;const Nh=uh((t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),((t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n)}),((t,n)=>n.getUTCFullYear()-t.getUTCFullYear()),(t=>t.getUTCFullYear()));function Ch(t,n,e,r,i,o){const a=[[ph,1,ch],[ph,5,5e3],[ph,15,15e3],[ph,30,3e4],[o,1,lh],[o,5,3e5],[o,15,9e5],[o,30,18e5],[i,1,fh],[i,3,108e5],[i,6,216e5],[i,12,432e5],[r,1,dh],[r,2,1728e5],[e,1,hh],[n,1,2592e6],[n,3,7776e6],[t,1,mh]];function u(n,e,r){const i=Math.abs(e-n)/r,o=Zt((([,,t])=>t)).right(a,i);if(o===a.length)return t.every(wn(n/mh,e/mh,r));if(0===o)return sh.every(Math.max(wn(n,e,r),1));const[u,s]=a[i/a[o-1][2]<a[o][2]/i?o-1:o];return u.every(s)}return[function(t,n,e){const r=n<t;r&&([t,n]=[n,t]);const i=e&&"function"==typeof e.range?e:u(t,n,e),o=i?i.range(t,+n+1):[];return r?o.reverse():o},u]}Nh.every=t=>isFinite(t=Math.floor(t))&&t>0?uh((n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)}),((n,e)=>{n.setUTCFullYear(n.getUTCFullYear()+e*t)})):null;const[Oh,_h]=Ch(Nh,Fh,Dh,$h,bh,vh),[zh,Bh]=Ch(Eh,Sh,Mh,wh,yh,gh);function Th(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Ph(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function jh(t,n,e){return{y:t,m:n,d:e,H:0,M:0,S:0,L:0}}var Rh,Lh,Ih,qh={"-":"",_:" ",0:"0"},Uh=/^\s*\d+/,Wh=/^%/,Hh=/[\\^$*+?|[\]().{}]/g;function Gh(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<e?new Array(e-o+1).join(n)+i:i)}function Yh(t){return t.replace(Hh,"\\$&")}function Vh(t){return new RegExp("^(?:"+t.map(Yh).join("|")+")","i")}function Xh(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function Jh(t,n,e){var r=Uh.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function Kh(t,n,e){var r=Uh.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function Qh(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function Zh(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function tm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function nm(t,n,e){var r=Uh.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function em(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function rm(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function im(t,n,e){var r=Uh.exec(n.slice(e,e+1));return r?(t.q=3*r[0]-3,e+r[0].length):-1}function om(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function am(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function um(t,n,e){var r=Uh.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function sm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function cm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function lm(t,n,e){var r=Uh.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function fm(t,n,e){var r=Uh.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function dm(t,n,e){var r=Uh.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function hm(t,n,e){var r=Wh.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function mm(t,n,e){var r=Uh.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function pm(t,n,e){var r=Uh.exec(n.slice(e));return r?(t.s=+r[0],e+r[0].length):-1}function gm(t,n){return Gh(t.getDate(),n,2)}function vm(t,n){return Gh(t.getHours(),n,2)}function ym(t,n){return Gh(t.getHours()%12||12,n,2)}function bm(t,n){return Gh(1+Dr.count(Cr(t),t),n,3)}function wm(t,n){return Gh(t.getMilliseconds(),n,3)}function xm(t,n){return wm(t,n)+"000"}function $m(t,n){return Gh(t.getMonth()+1,n,2)}function km(t,n){return Gh(t.getMinutes(),n,2)}function Mm(t,n){return Gh(t.getSeconds(),n,2)}function Am(t){var n=t.getDay();return 0===n?7:n}function Dm(t,n){return Gh(Fr.count(Cr(t)-1,t),n,2)}function Sm(t){var n=t.getDay();return n>=4||0===n?Nr(t):Nr.ceil(t)}function Fm(t,n){return t=Sm(t),Gh(Nr.count(Cr(t),t)+(4===Cr(t).getDay()),n,2)}function Em(t){return t.getDay()}function Nm(t,n){return Gh(Er.count(Cr(t)-1,t),n,2)}function Cm(t,n){return Gh(t.getFullYear()%100,n,2)}function Om(t,n){return Gh((t=Sm(t)).getFullYear()%100,n,2)}function _m(t,n){return Gh(t.getFullYear()%1e4,n,4)}function zm(t,n){var e=t.getDay();return Gh((t=e>=4||0===e?Nr(t):Nr.ceil(t)).getFullYear()%1e4,n,4)}function Bm(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Gh(n/60|0,"0",2)+Gh(n%60,"0",2)}function Tm(t,n){return Gh(t.getUTCDate(),n,2)}function Pm(t,n){return Gh(t.getUTCHours(),n,2)}function jm(t,n){return Gh(t.getUTCHours()%12||12,n,2)}function Rm(t,n){return Gh(1+Or.count(Pr(t),t),n,3)}function Lm(t,n){return Gh(t.getUTCMilliseconds(),n,3)}function Im(t,n){return Lm(t,n)+"000"}function qm(t,n){return Gh(t.getUTCMonth()+1,n,2)}function Um(t,n){return Gh(t.getUTCMinutes(),n,2)}function Wm(t,n){return Gh(t.getUTCSeconds(),n,2)}function Hm(t){var n=t.getUTCDay();return 0===n?7:n}function Gm(t,n){return Gh(zr.count(Pr(t)-1,t),n,2)}function Ym(t){var n=t.getUTCDay();return n>=4||0===n?Tr(t):Tr.ceil(t)}function Vm(t,n){return t=Ym(t),Gh(Tr.count(Pr(t),t)+(4===Pr(t).getUTCDay()),n,2)}function Xm(t){return t.getUTCDay()}function Jm(t,n){return Gh(Br.count(Pr(t)-1,t),n,2)}function Km(t,n){return Gh(t.getUTCFullYear()%100,n,2)}function Qm(t,n){return Gh((t=Ym(t)).getUTCFullYear()%100,n,2)}function Zm(t,n){return Gh(t.getUTCFullYear()%1e4,n,4)}function tp(t,n){var e=t.getUTCDay();return Gh((t=e>=4||0===e?Tr(t):Tr.ceil(t)).getUTCFullYear()%1e4,n,4)}function np(){return"+0000"}function ep(){return"%"}function rp(t){return+t}function ip(t){return Math.floor(+t/1e3)}function op(t){return new Date(t)}function ap(t){return t instanceof Date?+t:+new Date(+t)}function up(t,n,e,r,i,o,a,u,s,c){var l=Dd(),f=l.invert,d=l.domain,h=c(".%L"),m=c(":%S"),p=c("%I:%M"),g=c("%I %p"),v=c("%a %d"),y=c("%b %d"),b=c("%B"),w=c("%Y");function x(t){return(s(t)<t?h:u(t)<t?m:a(t)<t?p:o(t)<t?g:r(t)<t?i(t)<t?v:y:e(t)<t?b:w)(t)}return l.invert=function(t){return new Date(f(t))},l.domain=function(t){return arguments.length?d(Array.from(t,ap)):d().map(op)},l.ticks=function(n){var e=d();return t(e[0],e[e.length-1],null==n?10:n)},l.tickFormat=function(t,n){return null==n?x:c(n)},l.nice=function(t){var e=d();return t&&"function"==typeof t.range||(t=n(e[0],e[e.length-1],null==t?10:t)),t?d(Ud(e,t)):l},l.copy=function(){return Md(l,up(t,n,e,r,i,o,a,u,s,c))},l}function sp(){var t,n,e,r,i,o=0,a=1,u=wd,s=!1;function c(n){return null==n||isNaN(n=+n)?i:u(0===e?.5:(n=(r(n)-t)*e,s?Math.max(0,Math.min(1,n)):n))}function l(t){return function(n){var e,r;return arguments.length?([e,r]=n,u=t(e,r),c):[u(0),u(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),n=r(a=+a),e=t===n?0:1/(n-t),c):[o,a]},c.clamp=function(t){return arguments.length?(s=!!t,c):s},c.interpolator=function(t){return arguments.length?(u=t,c):u},c.range=l(Jf),c.rangeRound=l(Kf),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),n=i(a),e=t===n?0:1/(n-t),c}}function cp(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function lp(){var t=qd(sp()(wd));return t.copy=function(){return cp(t,lp())},gl.apply(t,arguments)}function fp(){var t=rh(sp());return t.copy=function(){return cp(t,fp()).exponent(t.exponent())},gl.apply(t,arguments)}function dp(){var t,n,e,r,i,o,a,u=0,s=.5,c=1,l=1,f=wd,d=!1;function h(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-n)*(l*t<l*n?r:i),f(d?Math.max(0,Math.min(1,t)):t))}function m(t){return function(n){var e,r,i;return arguments.length?([e,r,i]=n,f=gd(t,[e,r,i]),h):[f(0),f(.5),f(1)]}}return h.domain=function(a){return arguments.length?([u,s,c]=a,t=o(u=+u),n=o(s=+s),e=o(c=+c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),l=n<t?-1:1,h):[u,s,c]},h.clamp=function(t){return arguments.length?(d=!!t,h):d},h.interpolator=function(t){return arguments.length?(f=t,h):f},h.range=m(Jf),h.rangeRound=m(Kf),h.unknown=function(t){return arguments.length?(a=t,h):a},function(a){return o=a,t=a(u),n=a(s),e=a(c),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),l=n<t?-1:1,h}}function hp(){var t=rh(dp());return t.copy=function(){return cp(t,hp()).exponent(t.exponent())},gl.apply(t,arguments)}function mp(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}Rh=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,u=t.months,s=t.shortMonths,c=Vh(i),l=Xh(i),f=Vh(o),d=Xh(o),h=Vh(a),m=Xh(a),p=Vh(u),g=Xh(u),v=Vh(s),y=Xh(s),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return u[t.getMonth()]},c:null,d:gm,e:gm,f:xm,g:Om,G:zm,H:vm,I:ym,j:bm,L:wm,m:$m,M:km,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:rp,s:ip,S:Mm,u:Am,U:Dm,V:Fm,w:Em,W:Nm,x:null,X:null,y:Cm,Y:_m,Z:Bm,"%":ep},w={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return u[t.getUTCMonth()]},c:null,d:Tm,e:Tm,f:Im,g:Qm,G:tp,H:Pm,I:jm,j:Rm,L:Lm,m:qm,M:Um,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:rp,s:ip,S:Wm,u:Hm,U:Gm,V:Vm,w:Xm,W:Jm,x:null,X:null,y:Km,Y:Zm,Z:np,"%":ep},x={a:function(t,n,e){var r=h.exec(n.slice(e));return r?(t.w=m[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=d[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=v.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=p.exec(n.slice(e));return r?(t.m=g[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:am,e:am,f:dm,g:em,G:nm,H:sm,I:sm,j:um,L:fm,m:om,M:cm,p:function(t,n,e){var r=c.exec(n.slice(e));return r?(t.p=l[r[0].toLowerCase()],e+r[0].length):-1},q:im,Q:mm,s:pm,S:lm,u:Kh,U:Qh,V:Zh,w:Jh,W:tm,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:em,Y:nm,Z:rm,"%":hm};function $(t,n){return function(e){var r,i,o,a=[],u=-1,s=0,c=t.length;for(e instanceof Date||(e=new Date(+e));++u<c;)37===t.charCodeAt(u)&&(a.push(t.slice(s,u)),null!=(i=qh[r=t.charAt(++u)])?r=t.charAt(++u):i="e"===r?" ":"0",(o=n[r])&&(r=o(e,i)),a.push(r),s=u+1);return a.push(t.slice(s,u)),a.join("")}}function k(t,n){return function(e){var r,i,o=jh(1900,void 0,1);if(M(o,t,e+="",0)!=e.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(n&&!("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=Ph(jh(o.y,0,1))).getUTCDay(),r=i>4||0===i?Br.ceil(r):Br(r),r=Or.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Th(jh(o.y,0,1))).getDay(),r=i>4||0===i?Er.ceil(r):Er(r),r=Dr.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?Ph(jh(o.y,0,1)).getUTCDay():Th(jh(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,Ph(o)):Th(o)}}function M(t,n,e,r){for(var i,o,a=0,u=n.length,s=e.length;a<u;){if(r>=s)return-1;if(37===(i=n.charCodeAt(a++))){if(i=n.charAt(a++),!(o=x[i in qh?n.charAt(a++):i])||(r=o(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return b.x=$(e,b),b.X=$(r,b),b.c=$(n,b),w.x=$(e,w),w.X=$(r,w),w.c=$(n,w),{format:function(t){var n=$(t+="",b);return n.toString=function(){return t},n},parse:function(t){var n=k(t+="",!1);return n.toString=function(){return t},n},utcFormat:function(t){var n=$(t+="",w);return n.toString=function(){return t},n},utcParse:function(t){var n=k(t+="",!0);return n.toString=function(){return t},n}}}({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"]}),Lh=Rh.format,Ih=Rh.utcFormat;var pp=mp("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),gp=mp("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),vp=mp("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),yp=mp("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),bp=mp("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),wp=mp("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),xp=mp("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),$p=mp("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),kp=mp("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Mp=mp("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function Ap(t,n,e){const r=t-n+2*e;return t?r>0?r:1:0}const Dp="linear",Sp="log",Fp="pow",Ep="sqrt",Np="symlog",Cp="time",Op="utc",_p="sequential",zp="diverging",Bp="quantile",Tp="quantize",Pp="threshold",jp="ordinal",Rp="point",Lp="band",Ip="bin-ordinal",qp="continuous",Up="discrete",Wp="discretizing",Hp="interpolating",Gp="temporal";function Yp(){const t=yl().unknown(void 0),n=t.domain,e=t.range;let r,i,o=[0,1],a=!1,u=0,s=0,c=.5;function l(){const t=n().length,l=o[1]<o[0],f=o[1-l],d=Ap(t,u,s);let h=o[l-0];r=(f-h)/(d||1),a&&(r=Math.floor(r)),h+=(f-h-r*(t-u))*c,i=r*(1-u),a&&(h=Math.round(h),i=Math.round(i));const m=En(t).map((t=>h+r*t));return e(l?m.reverse():m)}return delete t.unknown,t.domain=function(t){return arguments.length?(n(t),l()):n()},t.range=function(t){return arguments.length?(o=[+t[0],+t[1]],l()):o.slice()},t.rangeRound=function(t){return o=[+t[0],+t[1]],a=!0,l()},t.bandwidth=function(){return i},t.step=function(){return r},t.round=function(t){return arguments.length?(a=!!t,l()):a},t.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),u=s,l()):u},t.paddingInner=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),l()):u},t.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),l()):s},t.align=function(t){return arguments.length?(c=Math.max(0,Math.min(1,t)),l()):c},t.invertRange=function(t){if(null==t[0]||null==t[1])return;const r=o[1]<o[0],a=r?e().reverse():e(),u=a.length-1;let s,c,l,f=+t[0],d=+t[1];return f!=f||d!=d||(d<f&&(l=f,f=d,d=l),d<a[0]||f>o[1-r])?void 0:(s=Math.max(0,rn(a,f)-1),c=f===d?s:rn(a,d)-1,f-a[s]>i+1e-10&&++s,r&&(l=s,s=u-c,c=u-l),s>c?void 0:n().slice(s,c+1))},t.invert=function(n){const e=t.invertRange([n,n]);return e?e[0]:e},t.copy=function(){return Yp().domain(n()).range(o).round(a).paddingInner(u).paddingOuter(s).align(c)},l()}function Vp(t){const n=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,t.copy=function(){return Vp(n())},t}var Xp=Array.prototype.map;const Jp=Array.prototype.slice,Kp=new Map,Qp=Symbol("vega_scale");function Zp(t){return t[Qp]=!0,t}function tg(t){return t&&!0===t[Qp]}function ng(t,n,e){return arguments.length>1?(Kp.set(t,function(t,n,e){const r=function(){const e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){let e,r=n[0],i=n[1];return i<r&&(e=r,r=i,i=e),[t.invert(r),t.invert(i)]}}(e):e.invertExtent?function(t){return function(n){const e=t.range();let r,i,o,a,u=n[0],s=n[1],c=-1;for(s<u&&(i=u,u=s,s=i),o=0,a=e.length;o<a;++o)e[o]>=u&&e[o]<=s&&(c<0&&(c=o),r=o);if(!(c<0))return u=t.invertExtent(e[c]),s=t.invertExtent(e[r]),[void 0===u[0]?u[1]:u[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,Zp(e)};return r.metadata=Bt(Q(e)),r}(t,n,e)),this):eg(t)?Kp.get(t):void 0}function eg(t){return Kp.has(t)}function rg(t,n){const e=Kp.get(t);return e&&e.metadata[n]}function ig(t){return rg(t,qp)}function og(t){return rg(t,Up)}function ag(t){return rg(t,Wp)}function ug(t){return rg(t,Sp)}function sg(t){return rg(t,Hp)}function cg(t){return rg(t,Bp)}ng("identity",(function t(n){var e;function r(t){return null==t||isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Array.from(t,yd),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Array.from(n,yd):[0,1],qd(r)})),ng(Dp,(function t(){var n=Dd();return n.copy=function(){return Md(n,t())},pl.apply(n,arguments),qd(n)}),qp),ng(Sp,(function t(){const n=Jd(Ad()).domain([1,10]);return n.copy=()=>Md(n,t()).base(n.base()),pl.apply(n,arguments),n}),[qp,Sp]),ng(Fp,ih,qp),ng(Ep,(function(){return ih.apply(null,arguments).exponent(.5)}),qp),ng(Np,(function t(){var n=Zd(Ad());return n.copy=function(){return Md(n,t()).constant(n.constant())},pl.apply(n,arguments)}),qp),ng(Cp,(function(){return pl.apply(up(zh,Bh,Eh,Sh,Mh,wh,yh,gh,ph,Lh).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}),[qp,Gp]),ng(Op,(function(){return pl.apply(up(Oh,_h,Nh,Fh,Dh,xh,bh,vh,ph,Ih).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}),[qp,Gp]),ng(_p,lp,[qp,Hp]),ng(`${_p}-${Dp}`,lp,[qp,Hp]),ng(`${_p}-${Sp}`,(function t(){var n=Jd(sp()).domain([1,10]);return n.copy=function(){return cp(n,t()).base(n.base())},gl.apply(n,arguments)}),[qp,Hp,Sp]),ng(`${_p}-${Fp}`,fp,[qp,Hp]),ng(`${_p}-${Ep}`,(function(){return fp.apply(null,arguments).exponent(.5)}),[qp,Hp]),ng(`${_p}-${Np}`,(function t(){var n=Zd(sp());return n.copy=function(){return cp(n,t()).constant(n.constant())},gl.apply(n,arguments)}),[qp,Hp]),ng(`${zp}-${Dp}`,(function t(){var n=qd(dp()(wd));return n.copy=function(){return cp(n,t())},gl.apply(n,arguments)}),[qp,Hp]),ng(`${zp}-${Sp}`,(function t(){var n=Jd(dp()).domain([.1,1,10]);return n.copy=function(){return cp(n,t()).base(n.base())},gl.apply(n,arguments)}),[qp,Hp,Sp]),ng(`${zp}-${Fp}`,hp,[qp,Hp]),ng(`${zp}-${Ep}`,(function(){return hp.apply(null,arguments).exponent(.5)}),[qp,Hp]),ng(`${zp}-${Np}`,(function t(){var n=Zd(dp());return n.copy=function(){return cp(n,t()).constant(n.constant())},gl.apply(n,arguments)}),[qp,Hp]),ng(Bp,(function t(){var n,e=[],r=[],i=[];function o(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t<n;)i[t-1]=Dn(e,t/n);return a}function a(t){return null==t||isNaN(t=+t)?n:r[rn(i,t)]}return a.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?i[n-1]:e[0],n<i.length?i[n]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)null==n||isNaN(n=+n)||e.push(n);return e.sort(Kt),o()},a.range=function(t){return arguments.length?(r=Array.from(t),o()):r.slice()},a.unknown=function(t){return arguments.length?(n=t,a):n},a.quantiles=function(){return i.slice()},a.copy=function(){return t().domain(e).range(r).unknown(n)},pl.apply(a,arguments)}),[Wp,Bp]),ng(Tp,(function t(){var n,e=0,r=1,i=1,o=[.5],a=[0,1];function u(t){return null!=t&&t<=t?a[rn(o,t,0,i)]:n}function s(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*e)/(i+1);return u}return u.domain=function(t){return arguments.length?([e,r]=t,e=+e,r=+r,s()):[e,r]},u.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,s()):a.slice()},u.invertExtent=function(t){var n=a.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,o[0]]:n>=i?[o[i-1],r]:[o[n-1],o[n]]},u.unknown=function(t){return arguments.length?(n=t,u):u},u.thresholds=function(){return o.slice()},u.copy=function(){return t().domain([e,r]).range(a).unknown(n)},pl.apply(qd(u),arguments)}),Wp),ng(Pp,(function t(){var n,e=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[rn(e,t,0,i)]:n}return o.domain=function(t){return arguments.length?(e=Array.from(t),i=Math.min(e.length,r.length-1),o):e.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(e.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},o.unknown=function(t){return arguments.length?(n=t,o):n},o.copy=function(){return t().domain(e).range(r).unknown(n)},pl.apply(o,arguments)}),Wp),ng(Ip,(function t(){let n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(rn(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=function(t){return Xp.call(t,z)}(t),r):n.slice()},r.range=function(t){return arguments.length?(e=Jp.call(t),r):e.slice()},r.tickFormat=function(t,e){return Id(n[0],_(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r}),[Up,Wp]),ng(jp,yl,Up),ng(Lp,Yp,Up),ng(Rp,(function(){return Vp(Yp().paddingInner(1))}),Up);const lg=["clamp","base","constant","exponent"];function fg(t,n){const e=n[0],r=_(n)-e;return function(n){return t(e+n*r)}}function dg(t,n,e){return gd(pg(n||"rgb",e),t)}function hg(t,n){const e=new Array(n),r=n+1;for(let i=0;i<n;)e[i]=t(++i/r);return e}function mg(t,n,e){const r=e-n;let i,o,a;return r&&Number.isFinite(r)?(i=(o=t.type).indexOf("-"),o=i<0?o:o.slice(i+1),a=ng(o)().domain([n,e]).range([0,1]),lg.forEach((n=>t[n]?a[n](t[n]()):0)),a):at(.5)}function pg(t,n){const e=vd[function(t){return"interpolate"+t.toLowerCase().split("-").map((t=>t[0].toUpperCase()+t.slice(1))).join("")}(t)];return null!=n&&e&&e.gamma?e.gamma(n):e}function gg(t){if(S(t))return t;const n=t.length/6|0,e=new Array(n);for(let r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}function vg(t,n){for(const e in t)bg(e,n(t[e]))}const yg={};function bg(t,n){return t=t&&t.toLowerCase(),arguments.length>1?(yg[t]=n,this):yg[t]}vg({accent:gp,category10:pp,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:vp,observable10:yp,paired:bp,pastel1:wp,pastel2:xp,set1:$p,set2:kp,set3:Mp,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"},gg),vg({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=>dg(gg(t))));const wg="symbol",xg=t=>S(t)?t.map((t=>String(t))):String(t),$g=(t,n)=>t[1]-n[1],kg=(t,n)=>n[1]-t[1];function Mg(t,n,e){let r;return wt(n)&&(t.bins&&(n=Math.max(n,t.bins.length)),null!=e&&(n=Math.min(n,Math.floor(Et(t.domain())/e||1)+1))),F(n)&&(r=n.step,n=n.interval),$t(n)&&(n=t.type===Cp?rr(n):t.type==Op?ir(n):p("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Ag(t,n,e){let r=t.range(),i=r[0],o=_(r),a=$g;if(i>o&&(r=o,o=i,i=r,a=kg),i=Math.floor(i),o=Math.ceil(o),n=n.map((n=>[n,t(n)])).filter((t=>i<=t[1]&&t[1]<=o)).sort(a).map((t=>t[0])),e>0&&n.length>1){const t=[n[0],_(n)];for(;n.length>e&&n.length>=3;)n=n.filter(((t,n)=>!(n%2)));n.length<3&&(n=t)}return n}function Dg(t,n){return t.bins?Ag(t,t.bins,n):t.ticks?t.ticks(n):t.domain()}function Sg(t,n,e,r,i,o){const a=n.type;let u=xg;if(a===Cp||i===Cp)u=t.timeFormat(r);else if(a===Op||i===Op)u=t.utcFormat(r);else if(ug(a)){const i=t.formatFloat(r);if(o||n.bins)u=i;else{const t=Fg(n,e,!1);u=n=>t(n)?i(n):""}}else if(n.tickFormat){const i=n.domain();u=t.formatSpan(i[0],i[i.length-1],e,r)}else r&&(u=t.format(r));return u}function Fg(t,n,e){const r=Dg(t,n),i=t.base(),o=Math.log(i),a=Math.max(1,i*n/r.length),u=t=>{let n=t/Math.pow(i,Math.round(Math.log(t)/o));return n*i<i-.5&&(n*=i),n<=a};return e?r.filter(u):u}const Eg={[Bp]:"quantiles",[Tp]:"thresholds",[Pp]:"domain"},Ng={[Bp]:"quantiles",[Tp]:"domain"};function Cg(t,n){return t.bins?function(t){const n=t.slice(0,-1);return n.max=_(t),n}(t.bins):t.type===Sp?Fg(t,n,!0):Eg[t.type]?function(t){const n=[-1/0].concat(t);return n.max=1/0,n}(t[Eg[t.type]]()):Dg(t,n)}function Og(t,n,e,r,i,o,a){const u=Ng[n.type]&&o!==Cp&&o!==Op?function(t,n,e){const r=n[Ng[n.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,e)}(t,n,i):Sg(t,n,e,i,o,a);return r===wg&&(t=>Eg[t.type]||t.bins)(n)?_g(u):"discrete"===r?Bg(u):Tg(u)}const _g=t=>(n,e,r)=>{const i=zg(r[e+1],zg(r.max,1/0)),o=Pg(n,t),a=Pg(i,t);return o&&a?o+" – "+a:a?"< "+a:"≥ "+o},zg=(t,n)=>null!=t?t:n,Bg=t=>(n,e)=>e?t(n):null,Tg=t=>n=>t(n),Pg=(t,n)=>Number.isFinite(t)?n(t):null;function jg(t,n,e){e=e||{};const r=Math.max(3,e.maxlen||7),i=function(t,n,e,r){const i=r||n.type;return $t(e)&&function(t){return rg(t,Gp)}(i)&&(e=e.replace(/%a/g,"%A").replace(/%b/g,"%B")),e||i!==Cp?e||i!==Op?Og(t,n,5,null,e,r,!0):t.utcFormat("%A, %d %B %Y, %X UTC"):t.timeFormat("%A, %d %B %Y, %X")}(t,n,e.format,e.formatType);if(ag(n.type)){const t=Cg(n).slice(1).map(i),e=t.length;return`${e} boundar${1===e?"y":"ies"}: ${t.join(", ")}`}if(og(n.type)){const t=n.domain(),e=t.length;return`${e} value${1===e?"":"s"}: ${e>r?t.slice(0,r-2).map(i).join(", ")+", ending with "+t.slice(-1).map(i):t.map(i).join(", ")}`}{const t=n.domain();return`values from ${i(t[0])} to ${i(_(t))}`}}let Rg=0;const Lg="p_";function Ig(t){return t&&t.gradient}function qg(t,n,e){const r=t.gradient;let i=t.id,o="radial"===r?Lg:"";return i||(i=t.id="gradient_"+Rg++,"radial"===r?(t.x1=Ug(t.x1,.5),t.y1=Ug(t.y1,.5),t.r1=Ug(t.r1,0),t.x2=Ug(t.x2,.5),t.y2=Ug(t.y2,.5),t.r2=Ug(t.r2,.5),o=Lg):(t.x1=Ug(t.x1,0),t.y1=Ug(t.y1,0),t.x2=Ug(t.x2,1),t.y2=Ug(t.y2,0))),n[i]=t,"url("+(e||"")+"#"+o+i+")"}function Ug(t,n){return null!=t?t:n}function Wg(t,n){var e,r=[];return e={gradient:"linear",x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(t,n){return r.push({offset:t,color:n}),e}}}const Hg={basis:{curve:function(t){return new Pc(t)}},"basis-closed":{curve:function(t){return new jc(t)}},"basis-open":{curve:function(t){return new Rc(t)}},bundle:{curve:Ic,tension:"beta",value:.85},cardinal:{curve:Wc,tension:"tension",value:0},"cardinal-open":{curve:Vc,tension:"tension",value:0},"cardinal-closed":{curve:Gc,tension:"tension",value:0},"catmull-rom":{curve:Kc,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Zc,tension:"alpha",value:.5},"catmull-rom-open":{curve:nl,tension:"alpha",value:.5},linear:{curve:Ec},"linear-closed":{curve:function(t){return new el(t)}},monotone:{horizontal:function(t){return new sl(t)},vertical:function(t){return new ul(t)}},natural:{curve:function(t){return new ll(t)}},step:{curve:function(t){return new dl(t,.5)}},"step-after":{curve:function(t){return new dl(t,1)}},"step-before":{curve:function(t){return new dl(t,0)}}};function Gg(t,n,e){var r=ft(Hg,t)&&Hg[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}const Yg={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Vg=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Xg=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Jg=/^((\s+,?\s*)|(,\s*))/,Kg=/^[01]/;function Qg(t){const n=[];return(t.match(Vg)||[]).forEach((t=>{let e=t[0];const r=e.toLowerCase(),i=Yg[r],o=function(t,n,e){const r=[];for(let i=0;n&&i<e.length;)for(let o=0;o<n;++o){const n="a"!==t||3!==o&&4!==o?Xg:Kg,a=e.slice(i).match(n);if(null===a)throw Error("Invalid SVG path, incorrect parameter type");i+=a[0].length,r.push(+a[0]);const u=e.slice(i).match(Jg);null!==u&&(i+=u[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(n.push([e,...o.slice(0,i)]),a!==i){"m"===r&&(e="M"===e?"L":"l");for(let t=i;t<a;t+=i)n.push([e,...o.slice(t,t+i)])}})),n}const Zg=Math.PI/180,tv=Math.PI/2,nv=2*Math.PI,ev=Math.sqrt(3)/2;var rv={},iv={},ov=[].join;function av(t){const n=ov.call(t);if(iv[n])return iv[n];var e=t[0],r=t[1],i=t[2],o=t[3],a=t[4],u=t[5],s=t[6],c=t[7];const l=c*a,f=-s*u,d=s*a,h=c*u,m=Math.cos(i),p=Math.sin(i),g=Math.cos(o),v=Math.sin(o),y=.5*(o-i),b=Math.sin(.5*y),w=8/3*b*b/Math.sin(y),x=e+m-w*p,$=r+p+w*m,k=e+g,M=r+v,A=k+w*v,D=M-w*g;return iv[n]=[l*x+f*$,d*x+h*$,l*A+f*D,d*A+h*D,l*k+f*M,d*k+h*M]}const uv=["l",0,0,0,0,0,0,0];function sv(t,n,e){const r=uv[0]=t[0];if("a"===r||"A"===r)uv[1]=n*t[1],uv[2]=e*t[2],uv[3]=t[3],uv[4]=t[4],uv[5]=t[5],uv[6]=n*t[6],uv[7]=e*t[7];else if("h"===r||"H"===r)uv[1]=n*t[1];else if("v"===r||"V"===r)uv[1]=e*t[1];else for(var i=1,o=t.length;i<o;++i)uv[i]=(i%2==1?n:e)*t[i];return uv}function cv(t,n,e,r,i,o){var a,u,s,c,l,f=null,d=0,h=0,m=0,p=0,g=0,v=0;null==e&&(e=0),null==r&&(r=0),null==i&&(i=1),null==o&&(o=i),t.beginPath&&t.beginPath();for(var y=0,b=n.length;y<b;++y){switch(a=n[y],1===i&&1===o||(a=sv(a,i,o)),a[0]){case"l":t.lineTo((d+=a[1])+e,(h+=a[2])+r);break;case"L":t.lineTo((d=a[1])+e,(h=a[2])+r);break;case"h":t.lineTo((d+=a[1])+e,h+r);break;case"H":t.lineTo((d=a[1])+e,h+r);break;case"v":t.lineTo(d+e,(h+=a[1])+r);break;case"V":t.lineTo(d+e,(h=a[1])+r);break;case"m":g=d+=a[1],v=h+=a[2],t.moveTo(d+e,h+r);break;case"M":g=d=a[1],v=h=a[2],t.moveTo(d+e,h+r);break;case"c":t.bezierCurveTo(d+a[1]+e,h+a[2]+r,(m=d+a[3])+e,(p=h+a[4])+r,(u=d+a[5])+e,(s=h+a[6])+r),d=u,h=s;break;case"C":t.bezierCurveTo(a[1]+e,a[2]+r,(m=a[3])+e,(p=a[4])+r,(d=a[5])+e,(h=a[6])+r);break;case"s":t.bezierCurveTo((m=2*d-m)+e,(p=2*h-p)+r,d+a[1]+e,h+a[2]+r,(u=d+a[3])+e,(s=h+a[4])+r),m=d+a[1],p=h+a[2],d=u,h=s;break;case"S":t.bezierCurveTo((m=2*d-m)+e,(p=2*h-p)+r,a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),d=u,h=s,m=a[1],p=a[2];break;case"q":t.quadraticCurveTo((m=d+a[1])+e,(p=h+a[2])+r,(u=d+a[3])+e,(s=h+a[4])+r),d=u,h=s;break;case"Q":t.quadraticCurveTo(a[1]+e,a[2]+r,(u=a[3])+e,(s=a[4])+r),d=u,h=s,m=a[1],p=a[2];break;case"t":u=d+a[1],s=h+a[2],null===f[0].match(/[QqTt]/)?(m=d,p=h):"t"===f[0]?(m=2*d-c,p=2*h-l):"q"===f[0]&&(m=2*d-m,p=2*h-p),c=m,l=p,t.quadraticCurveTo(m+e,p+r,u+e,s+r),m=(d=u)+a[1],p=(h=s)+a[2];break;case"T":t.quadraticCurveTo((m=2*d-m)+e,(p=2*h-p)+r,(u=a[1])+e,(s=a[2])+r),d=u,h=s;break;case"a":lv(t,d+e,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+d+e,a[7]+h+r]),d+=a[6],h+=a[7];break;case"A":lv(t,d+e,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+r]),d=a[6],h=a[7];break;case"z":case"Z":d=g,h=v,t.closePath()}f=a}}function lv(t,n,e,r){const i=function(t,n,e,r,i,o,a,u,s){const c=ov.call(arguments);if(rv[c])return rv[c];const l=a*Zg,f=Math.sin(l),d=Math.cos(l),h=d*(u-t)*.5+f*(s-n)*.5,m=d*(s-n)*.5-f*(u-t)*.5;let p=h*h/((e=Math.abs(e))*e)+m*m/((r=Math.abs(r))*r);p>1&&(p=Math.sqrt(p),e*=p,r*=p);const g=d/e,v=f/e,y=-f/r,b=d/r,w=g*u+v*s,x=y*u+b*s,$=g*t+v*n,k=y*t+b*n;let M=1/(($-w)*($-w)+(k-x)*(k-x))-.25;M<0&&(M=0);let A=Math.sqrt(M);o==i&&(A=-A);const D=.5*(w+$)-A*(k-x),S=.5*(x+k)+A*($-w),F=Math.atan2(x-S,w-D);let E=Math.atan2(k-S,$-D)-F;E<0&&1===o?E+=nv:E>0&&0===o&&(E-=nv);const N=Math.ceil(Math.abs(E/(tv+.001))),C=[];for(let t=0;t<N;++t)C[t]=[D,S,F+t*E/N,F+(t+1)*E/N,e,r,f,d];return rv[c]=C}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],n,e);for(let n=0;n<i.length;++n){const e=av(i[n]);t.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5])}}const fv=.5773502691896257,dv={circle:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(e,0),t.arc(0,0,e,0,nv)}},cross:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/2.5;t.moveTo(-e,-r),t.lineTo(-e,r),t.lineTo(-r,r),t.lineTo(-r,e),t.lineTo(r,e),t.lineTo(r,r),t.lineTo(e,r),t.lineTo(e,-r),t.lineTo(r,-r),t.lineTo(r,-e),t.lineTo(-r,-e),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.closePath()}},square:{draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},arrow:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/7,i=e/2.5,o=e/8;t.moveTo(-r,e),t.lineTo(r,e),t.lineTo(r,-o),t.lineTo(i,-o),t.lineTo(0,-e),t.lineTo(-i,-o),t.lineTo(-r,-o),t.closePath()}},wedge:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*fv,o=e/4;t.moveTo(0,-r-i),t.lineTo(-o,r-i),t.lineTo(o,r-i),t.closePath()}},triangle:{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e,i=r-e*fv;t.moveTo(0,-r-i),t.lineTo(-e,r-i),t.lineTo(e,r-i),t.closePath()}},"triangle-up":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,-r),t.lineTo(-e,r),t.lineTo(e,r),t.closePath()}},"triangle-down":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(0,r),t.lineTo(-e,-r),t.lineTo(e,-r),t.closePath()}},"triangle-right":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(r,0),t.lineTo(-r,-e),t.lineTo(-r,e),t.closePath()}},"triangle-left":{draw:function(t,n){var e=Math.sqrt(n)/2,r=ev*e;t.moveTo(-r,0),t.lineTo(r,-e),t.lineTo(r,e),t.closePath()}},stroke:{draw:function(t,n){const e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(e,0)}}};function hv(t){return ft(dv,t)?dv[t]:function(t){if(!ft(mv,t)){const n=Qg(t);mv[t]={draw:function(t,e){cv(t,n,0,0,Math.sqrt(e)/2)}}}return mv[t]}(t)}var mv={};const pv=.448084975506;function gv(t){return t.x}function vv(t){return t.y}function yv(t){return t.width}function bv(t){return t.height}function wv(t){return"function"==typeof t?t:()=>+t}function xv(t,n,e){return Math.max(n,Math.min(t,e))}function $v(){var t=gv,n=vv,e=yv,r=bv,i=wv(0),o=i,a=i,u=i,s=null;function c(c,l,f){var d,h=null!=l?l:+t.call(this,c),m=null!=f?f:+n.call(this,c),p=+e.call(this,c),g=+r.call(this,c),v=Math.min(p,g)/2,y=xv(+i.call(this,c),0,v),b=xv(+o.call(this,c),0,v),w=xv(+a.call(this,c),0,v),x=xv(+u.call(this,c),0,v);if(s||(s=d=bc()),y<=0&&b<=0&&w<=0&&x<=0)s.rect(h,m,p,g);else{var $=h+p,k=m+g;s.moveTo(h+y,m),s.lineTo($-b,m),s.bezierCurveTo($-pv*b,m,$,m+pv*b,$,m+b),s.lineTo($,k-x),s.bezierCurveTo($,k-pv*x,$-pv*x,k,$-x,k),s.lineTo(h+w,k),s.bezierCurveTo(h+pv*w,k,h,k-pv*w,h,k-w),s.lineTo(h,m+y),s.bezierCurveTo(h,m+pv*y,h+pv*y,m,h+y,m),s.closePath()}if(d)return s=null,d+""||null}return c.x=function(n){return arguments.length?(t=wv(n),c):t},c.y=function(t){return arguments.length?(n=wv(t),c):n},c.width=function(t){return arguments.length?(e=wv(t),c):e},c.height=function(t){return arguments.length?(r=wv(t),c):r},c.cornerRadius=function(t,n,e,r){return arguments.length?(i=wv(t),o=null!=n?wv(n):i,u=null!=e?wv(e):i,a=null!=r?wv(r):o,c):i},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function kv(){var t,n,e,r,i,o,a,u,s=null;function c(t,n,e){const r=e/2;if(i){var c=a-n,l=t-o;if(c||l){var f=Math.hypot(c,l),d=(c/=f)*u,h=(l/=f)*u,m=Math.atan2(l,c);s.moveTo(o-d,a-h),s.lineTo(t-c*r,n-l*r),s.arc(t,n,r,m-Math.PI,m),s.lineTo(o+d,a+h),s.arc(o,a,u,m,m+Math.PI)}else s.arc(t,n,r,0,nv);s.closePath()}else i=1;o=t,a=n,u=r}function l(o){var a,u,l,f=o.length,d=!1;for(null==s&&(s=l=bc()),a=0;a<=f;++a)!(a<f&&r(u=o[a],a,o))===d&&(d=!d)&&(i=0),d&&c(+t(u,a,o),+n(u,a,o),+e(u,a,o));if(l)return s=null,l+""||null}return l.x=function(n){return arguments.length?(t=n,l):t},l.y=function(t){return arguments.length?(n=t,l):n},l.size=function(t){return arguments.length?(e=t,l):e},l.defined=function(t){return arguments.length?(r=t,l):r},l.context=function(t){return arguments.length?(s=null==t?null:t,l):s},l}function Mv(t,n){return null!=t?t:n}const Av=t=>t.x||0,Dv=t=>t.y||0,Sv=t=>!(!1===t.defined),Fv=function(){var t=xc,n=$c,e=tc(0),r=null,i=kc,o=Mc,a=Ac,u=null,s=wc(c);function c(){var c,l,f=+t.apply(this,arguments),d=+n.apply(this,arguments),h=i.apply(this,arguments)-lc,m=o.apply(this,arguments)-lc,p=nc(m-h),g=m>h;if(u||(u=c=s()),d<f&&(l=d,d=f,f=l),d>sc)if(p>fc-sc)u.moveTo(d*rc(h),d*ac(h)),u.arc(0,0,d,h,m,!g),f>sc&&(u.moveTo(f*rc(m),f*ac(m)),u.arc(0,0,f,m,h,g));else{var v,y,b=h,w=m,x=h,$=m,k=p,M=p,A=a.apply(this,arguments)/2,D=A>sc&&(r?+r.apply(this,arguments):uc(f*f+d*d)),S=oc(nc(d-f)/2,+e.apply(this,arguments)),F=S,E=S;if(D>sc){var N=dc(D/f*ac(A)),C=dc(D/d*ac(A));(k-=2*N)>sc?(x+=N*=g?1:-1,$-=N):(k=0,x=$=(h+m)/2),(M-=2*C)>sc?(b+=C*=g?1:-1,w-=C):(M=0,b=w=(h+m)/2)}var O=d*rc(b),_=d*ac(b),z=f*rc($),B=f*ac($);if(S>sc){var T,P=d*rc(w),j=d*ac(w),R=f*rc(x),L=f*ac(x);if(p<cc)if(T=function(t,n,e,r,i,o,a,u){var s=e-t,c=r-n,l=a-i,f=u-o,d=f*s-l*c;if(!(d*d<sc))return[t+(d=(l*(n-o)-f*(t-i))/d)*s,n+d*c]}(O,_,R,L,P,j,z,B)){var I=O-T[0],q=_-T[1],U=P-T[0],W=j-T[1],H=1/ac(function(t){return t>1?0:t<-1?cc:Math.acos(t)}((I*U+q*W)/(uc(I*I+q*q)*uc(U*U+W*W)))/2),G=uc(T[0]*T[0]+T[1]*T[1]);F=oc(S,(f-G)/(H-1)),E=oc(S,(d-G)/(H+1))}else F=E=0}M>sc?E>sc?(v=Dc(R,L,O,_,d,E,g),y=Dc(P,j,z,B,d,E,g),u.moveTo(v.cx+v.x01,v.cy+v.y01),E<S?u.arc(v.cx,v.cy,E,ec(v.y01,v.x01),ec(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,E,ec(v.y01,v.x01),ec(v.y11,v.x11),!g),u.arc(0,0,d,ec(v.cy+v.y11,v.cx+v.x11),ec(y.cy+y.y11,y.cx+y.x11),!g),u.arc(y.cx,y.cy,E,ec(y.y11,y.x11),ec(y.y01,y.x01),!g))):(u.moveTo(O,_),u.arc(0,0,d,b,w,!g)):u.moveTo(O,_),f>sc&&k>sc?F>sc?(v=Dc(z,B,P,j,f,-F,g),y=Dc(O,_,R,L,f,-F,g),u.lineTo(v.cx+v.x01,v.cy+v.y01),F<S?u.arc(v.cx,v.cy,F,ec(v.y01,v.x01),ec(y.y01,y.x01),!g):(u.arc(v.cx,v.cy,F,ec(v.y01,v.x01),ec(v.y11,v.x11),!g),u.arc(0,0,f,ec(v.cy+v.y11,v.cx+v.x11),ec(y.cy+y.y11,y.cx+y.x11),g),u.arc(y.cx,y.cy,F,ec(y.y11,y.x11),ec(y.y01,y.x01),!g))):u.arc(0,0,f,$,x,g):u.lineTo(z,B)}else u.moveTo(0,0);if(u.closePath(),c)return u=null,c+""||null}return c.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-cc/2;return[rc(r)*e,ac(r)*e]},c.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:tc(+n),c):t},c.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),c):n},c.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:tc(+t),c):e},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:tc(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:tc(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:tc(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:tc(+t),c):a},c.context=function(t){return arguments.length?(u=null==t?null:t,c):u},c}().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)),Ev=_c().x(Av).y1(Dv).y0((t=>(t.y||0)+(t.height||0))).defined(Sv),Nv=_c().y(Dv).x1(Av).x0((t=>(t.x||0)+(t.width||0))).defined(Sv),Cv=Oc().x(Av).y(Dv).defined(Sv),Ov=$v().x(Av).y(Dv).width((t=>t.width||0)).height((t=>t.height||0)).cornerRadius((t=>Mv(t.cornerRadiusTopLeft,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusTopRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomRight,t.cornerRadius)||0),(t=>Mv(t.cornerRadiusBottomLeft,t.cornerRadius)||0)),_v=function(t,n){let e=null,r=wc(i);function i(){let i;if(e||(e=i=r()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),i)return e=null,i+""||null}return t="function"==typeof t?t:tc(t||zc),n="function"==typeof n?n:tc(void 0===n?64:+n),i.type=function(n){return arguments.length?(t="function"==typeof n?n:tc(n),i):t},i.size=function(t){return arguments.length?(n="function"==typeof t?t:tc(+t),i):n},i.context=function(t){return arguments.length?(e=null==t?null:t,i):e},i}().type((t=>hv(t.shape||"circle"))).size((t=>Mv(t.size,64))),zv=kv().x(Av).y(Dv).defined(Sv).size((t=>t.size||1));function Bv(t){return t.cornerRadius||t.cornerRadiusTopLeft||t.cornerRadiusTopRight||t.cornerRadiusBottomRight||t.cornerRadiusBottomLeft}function Tv(t,n,e,r){return Ov.context(t)(n,e,r)}var Pv=1;function jv(t,n,e){var r=n.clip,i=t._defs,o=n.clip_id||(n.clip_id="clip"+Pv++),a=i.clipping[o]||(i.clipping[o]={id:o});return tt(r)?a.path=r(null):Bv(e)?a.path=Tv(null,e,0,0):(a.width=e.width||0,a.height=e.height||0),"url(#"+o+")"}function Rv(t){this.clear(),t&&this.union(t)}function Lv(t){this.mark=t,this.bounds=this.bounds||new Rv}function Iv(t){Lv.call(this,t),this.items=this.items||[]}Rv.prototype={clone(){return new Rv(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,n,e,r){return e<t?(this.x2=t,this.x1=e):(this.x1=t,this.x2=e),r<n?(this.y2=n,this.y1=r):(this.y1=n,this.y2=r),this},add(t,n){return t<this.x1&&(this.x1=t),n<this.y1&&(this.y1=n),t>this.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},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,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},rotate(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(t,n,e){var{x1:r,y1:i,x2:o,y2:a}=this,u=Math.cos(t),s=Math.sin(t),c=n-n*u+e*s,l=e-n*s-e*u;return[u*r-s*i+c,s*r+u*i+l,u*r-s*a+c,s*r+u*a+l,u*o-s*i+c,s*o+u*i+l,u*o-s*a+c,s*o+u*a+l]},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,n){return!(t<this.x1||t>this.x2||n<this.y1||n>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}},pt(Iv,Lv);class qv{constructor(t){this._pending=0,this._loader=t||Vo()}pending(){return this._pending}sanitizeURL(t){const n=this;return Uv(n),n._loader.sanitize(t,{context:"href"}).then((t=>(Wv(n),t))).catch((()=>(Wv(n),null)))}loadImage(t){const n=this,e=ml();return Uv(n),n._loader.sanitize(t,{context:"image"}).then((t=>{const r=t.href;if(!r||!e)throw{url:r};const i=new e,o=ft(t,"crossOrigin")?t.crossOrigin:"anonymous";return null!=o&&(i.crossOrigin=o),i.onload=()=>Wv(n),i.onerror=()=>Wv(n),i.src=r,i})).catch((t=>(Wv(n),{complete:!1,width:0,height:0,src:t&&t.url||""})))}ready(){const t=this;return new Promise((n=>{!function e(r){t.pending()?setTimeout((()=>{e(!0)}),10):n(r)}(!1)}))}}function Uv(t){t._pending+=1}function Wv(t){t._pending-=1}function Hv(t,n,e){if(n.stroke&&0!==n.opacity&&0!==n.strokeOpacity){const r=null!=n.strokeWidth?+n.strokeWidth:1;t.expand(r+(e?function(t,n){return t.strokeJoin&&"miter"!==t.strokeJoin?0:n}(n,r):0))}return t}const Gv=nv-1e-8;let Yv,Vv,Xv,Jv,Kv,Qv,Zv,ty;const ny=(t,n)=>Yv.add(t,n),ey=(t,n)=>ny(Vv=t,Xv=n),ry=t=>ny(t,Yv.y1),iy=t=>ny(Yv.x1,t),oy=(t,n)=>Kv*t+Zv*n,ay=(t,n)=>Qv*t+ty*n,uy=(t,n)=>ny(oy(t,n),ay(t,n)),sy=(t,n)=>ey(oy(t,n),ay(t,n));function cy(t,n){return Yv=t,n?(Jv=n*Zg,Kv=ty=Math.cos(Jv),Qv=Math.sin(Jv),Zv=-Qv):(Kv=ty=1,Jv=Qv=Zv=0),ly}const ly={beginPath(){},closePath(){},moveTo:sy,lineTo:sy,rect(t,n,e,r){Jv?(uy(t+e,n),uy(t+e,n+r),uy(t,n+r),sy(t,n)):(ny(t+e,n+r),ey(t,n))},quadraticCurveTo(t,n,e,r){const i=oy(t,n),o=ay(t,n),a=oy(e,r),u=ay(e,r);fy(Vv,i,a,ry),fy(Xv,o,u,iy),ey(a,u)},bezierCurveTo(t,n,e,r,i,o){const a=oy(t,n),u=ay(t,n),s=oy(e,r),c=ay(e,r),l=oy(i,o),f=ay(i,o);dy(Vv,a,s,l,ry),dy(Xv,u,c,f,iy),ey(l,f)},arc(t,n,e,r,i,o){if(r+=Jv,i+=Jv,Vv=e*Math.cos(i)+t,Xv=e*Math.sin(i)+n,Math.abs(i-r)>Gv)ny(t-e,n-e),ny(t+e,n+e);else{const a=r=>ny(e*Math.cos(r)+t,e*Math.sin(r)+n);let u,s;if(a(r),a(i),i!==r)if((r%=nv)<0&&(r+=nv),(i%=nv)<0&&(i+=nv),i<r&&(o=!o,u=r,r=i,i=u),o)for(i-=nv,u=r-r%tv,s=0;s<4&&u>i;++s,u-=tv)a(u);else for(u=r-r%tv+tv,s=0;s<4&&u<i;++s,u+=tv)a(u)}}};function fy(t,n,e,r){const i=(t-n)/(t+e-2*n);0<i&&i<1&&r(t+(n-t)*i)}function dy(t,n,e,r,i){const o=r-t+3*n-3*e,a=t+e-2*n,u=t-n;let s,c=0,l=0;Math.abs(o)>1e-14?(s=a*a+u*o,s>=0&&(s=Math.sqrt(s),c=(-a+s)/o,l=(-a-s)/o)):c=.5*u/a,0<c&&c<1&&i(hy(c,t,n,e,r)),0<l&&l<1&&i(hy(l,t,n,e,r))}function hy(t,n,e,r,i){const o=1-t,a=o*o,u=t*t;return a*o*n+3*a*t*e+3*o*u*r+u*t*i}var my=(my=hl(1,1))?my.getContext("2d"):null;const py=new Rv;function gy(t){return function(n,e){if(!my)return!0;t(my,n),py.clear().union(n.bounds).intersect(e).round();const{x1:r,y1:i,x2:o,y2:a}=py;for(let t=i;t<=a;++t)for(let n=r;n<=o;++n)if(my.isPointInPath(n,t))return!0;return!1}}function vy(t,n){return n.contains(t.x||0,t.y||0)}function yy(t,n){const e=t.x||0,r=t.y||0;return n.intersects(py.set(e,r,e+(t.width||0),r+(t.height||0)))}function by(t,n){const e=t.x||0,r=t.y||0;return wy(n,e,r,null!=t.x2?t.x2:e,null!=t.y2?t.y2:r)}function wy(t,n,e,r,i){const{x1:o,y1:a,x2:u,y2:s}=t,c=r-n,l=i-e;let f,d,h,m,p=0,g=1;for(m=0;m<4;++m){if(0===m&&(f=-c,d=-(o-n)),1===m&&(f=c,d=u-n),2===m&&(f=-l,d=-(a-e)),3===m&&(f=l,d=s-e),Math.abs(f)<1e-10&&d<0)return!1;if(h=d/f,f<0){if(h>g)return!1;h>p&&(p=h)}else if(f>0){if(h<p)return!1;h<g&&(g=h)}}return!0}function xy(t,n){t.globalCompositeOperation=n.blend||"source-over"}function $y(t,n){return null==t?n:t}function ky(t,n){const e=n.length;for(let r=0;r<e;++r)t.addColorStop(n[r].offset,n[r].color);return t}function My(t,n,e){return Ig(e)?function(t,n,e){const r=e.width(),i=e.height();let o;if("radial"===n.gradient)o=t.createRadialGradient(e.x1+$y(n.x1,.5)*r,e.y1+$y(n.y1,.5)*i,Math.max(r,i)*$y(n.r1,0),e.x1+$y(n.x2,.5)*r,e.y1+$y(n.y2,.5)*i,Math.max(r,i)*$y(n.r2,.5));else{const a=$y(n.x1,0),u=$y(n.y1,0),s=$y(n.x2,1),c=$y(n.y2,0);if(a!==s&&u!==c&&r!==i){const e=hl(Math.ceil(r),Math.ceil(i)),o=e.getContext("2d");return o.scale(r,i),o.fillStyle=ky(o.createLinearGradient(a,u,s,c),n.stops),o.fillRect(0,0,r,i),t.createPattern(e,"no-repeat")}o=t.createLinearGradient(e.x1+a*r,e.y1+u*i,e.x1+s*r,e.y1+c*i)}return ky(o,n.stops)}(t,e,n.bounds):e}function Ay(t,n,e){return(e*=null==n.fillOpacity?1:n.fillOpacity)>0&&(t.globalAlpha=e,t.fillStyle=My(t,n,n.fill),!0)}var Dy=[];function Sy(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&(e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=My(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||Dy),t.lineDashOffset=n.strokeDashOffset||0),!0)}function Fy(t,n){return t.zindex-n.zindex||t.index-n.index}function Ey(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,o=[];for(e=0,r=i.length;e<r;++e)(n=i[e]).index=e,n.zindex&&o.push(n);return t.zdirty=!1,t.zitems=o.sort(Fy)}function Ny(t,n){var e,r,i=t.items;if(!i||!i.length)return;const o=Ey(t);if(o&&o.length){for(e=0,r=i.length;e<r;++e)i[e].zindex||n(i[e]);i=o}for(e=0,r=i.length;e<r;++e)n(i[e])}function Cy(t,n){var e,r,i=t.items;if(!i||!i.length)return null;const o=Ey(t);for(o&&o.length&&(i=o),r=i.length;--r>=0;)if(e=n(i[r]))return e;if(i===o)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function Oy(t){return function(n,e,r){Ny(e,(e=>{r&&!r.intersects(e.bounds)||zy(t,n,e,e)}))}}function _y(t){return function(n,e,r){!e.items.length||r&&!r.intersects(e.bounds)||zy(t,n,e.items[0],e.items)}}function zy(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||(xy(n,e),e.fill&&Ay(n,e,i)&&n.fill(),e.stroke&&Sy(n,e,i)&&n.stroke()))}function By(t){return t=t||$,function(n,e,r,i,o,a){return r*=n.pixelRatio,i*=n.pixelRatio,Cy(e,(e=>{const u=e.bounds;if((!u||u.contains(o,a))&&u)return t(n,e,r,i,o,a)?e:void 0}))}}function Ty(t,n){return function(e,r,i,o){var a,u,s=Array.isArray(r)?r[0]:r,c=null==n?s.fill:n,l=s.stroke&&e.isPointInStroke;return l&&(u=s.strokeCap,e.lineWidth=null!=(a=s.strokeWidth)?a:1,e.lineCap=null!=u?u:"butt"),!t(e,r)&&(c&&e.isPointInPath(i,o)||l&&e.isPointInStroke(i,o))}}function Py(t){return By(Ty(t))}function jy(t,n){return"translate("+t+","+n+")"}function Ry(t){return"rotate("+t+")"}function Ly(t){return jy(t.x||0,t.y||0)}function Iy(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,o=e.angle||0;t.translate(r,i),o&&t.rotate(o*=Zg),t.beginPath(),n(t,e),o&&t.rotate(-o),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",function(t){return jy(t.x||0,t.y||0)+(t.angle?" "+Ry(t.angle):"")}(e)),t("d",n(null,e))},bound:function(t,e){return n(cy(t,e.angle),e),Hv(t,e).translate(e.x||0,e.y||0)},draw:Oy(r),pick:Py(r),isect:e||gy(r)}}var qy=Iy("arc",(function(t,n){return Fv.context(t)(n)}));function Uy(t,n,e){function r(t,e){t.beginPath(),n(t,e)}const i=Ty(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(cy(t),r),Hv(t,r[0]))},draw:_y(r),pick:function(t,n,e,r,o,a){var u=n.items,s=n.bounds;return!u||!u.length||s&&!s.contains(o,a)?null:i(t,u,e*=t.pixelRatio,r*=t.pixelRatio)?u[0]:null},isect:vy,tip:e}}var Wy=Uy("area",(function(t,n){const e=n[0];return("horizontal"===e.orient?Nv:Ev).curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],o="horizontal"===t[0].orient?"y":"x",a=t.length,u=1/0;--a>=0;)!1!==t[a].defined&&(r=Math.abs(t[a][o]-i))<u&&(u=r,e=t[a]);return e}));function Hy(t,n){t.beginPath(),Bv(n)?Tv(t,n,0,0):t.rect(0,0,n.width||0,n.height||0),t.clip()}function Gy(t){const n=$y(t.strokeWidth,1);return null!=t.strokeOffset?t.strokeOffset:t.stroke&&n>.5&&n<1.5?.5-Math.abs(n-1):0}function Yy(t,n){const e=Gy(n);t("d",Tv(null,n,e,e))}function Vy(t,n,e,r){const i=Gy(n);t.beginPath(),Tv(t,n,(e||0)+i,(r||0)+i)}const Xy=Ty(Vy),Jy=Ty(Vy,!1),Ky=Ty(Vy,!0);var Qy={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",Ly(n))},bound:function(t,n){if(!n.clip&&n.items){const e=n.items,r=e.length;for(let n=0;n<r;++n)t.union(e[n].bounds)}return(n.clip||n.width||n.height)&&!n.noBound&&t.add(0,0).add(n.width||0,n.height||0),Hv(t,n),t.translate(n.x||0,n.y||0)},draw:function(t,n,e,r){Ny(n,(n=>{const i=n.x||0,o=n.y||0,a=n.strokeForeground,u=null==n.opacity?1:n.opacity;(n.stroke||n.fill)&&u&&(Vy(t,n,i,o),xy(t,n),n.fill&&Ay(t,n,u)&&t.fill(),n.stroke&&!a&&Sy(t,n,u)&&t.stroke()),t.save(),t.translate(i,o),n.clip&&Hy(t,n),e&&e.translate(-i,-o),Ny(n,(n=>{("group"===n.marktype||null==r||r.includes(n.marktype))&&this.draw(t,n,e,r)})),e&&e.translate(i,o),t.restore(),a&&n.stroke&&u&&(Vy(t,n,i,o),xy(t,n),Sy(t,n,u)&&t.stroke())}))},pick:function(t,n,e,r,i,o){if(n.bounds&&!n.bounds.contains(i,o)||!n.items)return null;const a=e*t.pixelRatio,u=r*t.pixelRatio;return Cy(n,(s=>{let c,l,f;const d=s.bounds;if(d&&!d.contains(i,o))return;l=s.x||0,f=s.y||0;const h=s.clip;if(h&&(i<l||i>l+(s.width||0)||o<f||o>f+(s.height||0)))return;if(t.save(),t.translate(l,f),l=i-l,f=o-f,h&&Bv(s)&&!Ky(t,s,a,u))return t.restore(),null;const m=s.strokeForeground,p=!1!==n.interactive;return p&&m&&s.stroke&&Jy(t,s,a,u)?(t.restore(),s):(c=Cy(s,(t=>function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,l,f)?this.pick(t,e,r,l,f):null)),!c&&p&&(s.fill||!m&&s.stroke)&&Xy(t,s,a,u)&&(c=s),t.restore(),c||null)}))},isect:yy,content:function(t,n,e){t("clip-path",n.clip?jv(e,n,n):null)},background:function(t,n){t("class","background"),t("aria-hidden",!0),Yy(t,n)},foreground:function(t,n){t("class","foreground"),t("aria-hidden",!0),n.strokeForeground?Yy(t,n):t("d","")}},Zy={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function tb(t,n){var e=t.image;return(!e||t.url&&t.url!==e.url)&&(e={complete:!1,width:0,height:0},n.loadImage(t.url).then((n=>{t.image=n,t.image.url=t.url}))),e}function nb(t,n){return null!=t.width?t.width:n&&n.width?!1!==t.aspect&&t.height?t.height*n.width/n.height:n.width:0}function eb(t,n){return null!=t.height?t.height:n&&n.height?!1!==t.aspect&&t.width?t.width*n.height/n.width:n.height:0}function rb(t,n){return"center"===t?n/2:"right"===t?n:0}function ib(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var ob={type:"image",tag:"image",nested:!1,attr:function(t,n,e){const r=tb(n,e),i=nb(n,r),o=eb(n,r),a=(n.x||0)-rb(n.align,i),u=(n.y||0)-ib(n.baseline,o);t("href",!r.src&&r.toDataURL?r.toDataURL():r.src||"",Zy["xmlns:xlink"],"xlink:href"),t("transform",jy(a,u)),t("width",i),t("height",o),t("preserveAspectRatio",!1===n.aspect?"none":"xMidYMid")},bound:function(t,n){const e=n.image,r=nb(n,e),i=eb(n,e),o=(n.x||0)-rb(n.align,r),a=(n.y||0)-ib(n.baseline,i);return t.set(o,a,o+r,a+i)},draw:function(t,n,e){Ny(n,(n=>{if(e&&!e.intersects(n.bounds))return;const r=tb(n,this);let i=nb(n,r),o=eb(n,r);if(0===i||0===o)return;let a,u,s,c,l=(n.x||0)-rb(n.align,i),f=(n.y||0)-ib(n.baseline,o);!1!==n.aspect&&(u=r.width/r.height,s=n.width/n.height,u==u&&s==s&&u!==s&&(s<u?(c=i/u,f+=(o-c)/2,o=c):(c=o*u,l+=(i-c)/2,i=c))),(r.complete||r.toDataURL)&&(xy(t,n),t.globalAlpha=null!=(a=n.opacity)?a:1,t.imageSmoothingEnabled=!1!==n.smooth,t.drawImage(r,l,f,i,o))}))},pick:By(),isect:$,get:tb,xOffset:rb,yOffset:ib},ab=Uy("line",(function(t,n){const e=n[0];return Cv.curve(Gg(e.interpolate||"linear",e.orient,e.tension)).context(t)(n)}),(function(t,n){for(var e,r,i=Math.pow(t[0].strokeWidth||1,2),o=t.length;--o>=0;)if(!1!==t[o].defined&&(e=t[o].x-n[0])*e+(r=t[o].y-n[1])*r<i)return t[o];return null}));function ub(t,n){var e=n.path;if(null==e)return!0;var r=n.x||0,i=n.y||0,o=n.scaleX||1,a=n.scaleY||1,u=(n.angle||0)*Zg,s=n.pathCache;s&&s.path===e||((n.pathCache=s=Qg(e)).path=e),u&&t.rotate&&t.translate?(t.translate(r,i),t.rotate(u),cv(t,s,0,0,o,a),t.rotate(-u),t.translate(-r,-i)):cv(t,s,r,i,o,a)}var sb={type:"path",tag:"path",nested:!1,attr:function(t,n){1===(n.scaleX||1)&&1===(n.scaleY||1)||t("vector-effect","non-scaling-stroke"),t("transform",function(t){return jy(t.x||0,t.y||0)+(t.angle?" "+Ry(t.angle):"")+(t.scaleX||t.scaleY?" "+("scale("+(t.scaleX||1)+","+(t.scaleY||1)+")"):"")}(n)),t("d",n.path)},bound:function(t,n){return ub(cy(t,n.angle),n)?t.set(0,0,0,0):Hv(t,n,!0)},draw:Oy(ub),pick:Py(ub),isect:gy(ub)};function cb(t,n){t.beginPath(),Tv(t,n)}var lb={type:"rect",tag:"path",nested:!1,attr:function(t,n){t("d",Tv(null,n))},bound:function(t,n){var e,r;return Hv(t.set(e=n.x||0,r=n.y||0,e+n.width||0,r+n.height||0),n)},draw:Oy(cb),pick:Py(cb),isect:yy};function fb(t,n,e){var r,i,o,a;return!(!n.stroke||!Sy(t,n,e)||(r=n.x||0,i=n.y||0,o=null!=n.x2?n.x2:r,a=null!=n.y2?n.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(o,a),0))}var db={type:"rule",tag:"line",nested:!1,attr:function(t,n){t("transform",Ly(n)),t("x2",null!=n.x2?n.x2-(n.x||0):0),t("y2",null!=n.y2?n.y2-(n.y||0):0)},bound:function(t,n){var e,r;return Hv(t.set(e=n.x||0,r=n.y||0,null!=n.x2?n.x2:e,null!=n.y2?n.y2:r),n)},draw:function(t,n,e){Ny(n,(n=>{if(!e||e.intersects(n.bounds)){var r=null==n.opacity?1:n.opacity;r&&fb(t,n,r)&&(xy(t,n),t.stroke())}}))},pick:By((function(t,n,e,r){return!!t.isPointInStroke&&fb(t,n,1)&&t.isPointInStroke(e,r)})),isect:by},hb=Iy("shape",(function(t,n){return(n.mark.shape||n.shape).context(t)(n)})),mb=Iy("symbol",(function(t,n){return _v.context(t)(n)}),vy);const pb=At();var gb={height:$b,measureWidth:wb,estimateWidth:yb,width:yb,canvas:vb};function vb(t){gb.width=t&&my?wb:yb}function yb(t,n){return bb(Db(t,n),$b(t))}function bb(t,n){return~~(.8*t.length*n)}function wb(t,n){return $b(t)<=0||!(n=Db(t,n))?0:xb(n,Fb(t))}function xb(t,n){const e=`(${n}) ${t}`;let r=pb.get(e);return void 0===r&&(my.font=n,r=my.measureText(t).width,pb.set(e,r)),r}function $b(t){return null!=t.fontSize?+t.fontSize||0:11}function kb(t){return null!=t.lineHeight?t.lineHeight:$b(t)+2}function Mb(t){return n=t.lineBreak&&t.text&&!S(t.text)?t.text.split(t.lineBreak):t.text,S(n)?n.length>1?n:n[0]:n;var n}function Ab(t){const n=Mb(t);return(S(n)?n.length-1:0)*kb(t)}function Db(t,n){const e=null==n?"":(n+"").trim();return t.limit>0&&e.length?function(t,n){var e=+t.limit,r=function(t){if(gb.width===wb){const n=Fb(t);return t=>xb(t,n)}if(gb.width===yb){const n=$b(t);return t=>bb(t,n)}return n=>gb.width(t,n)}(t);if(r(n)<e)return n;var i,o=t.ellipsis||"…",a="rtl"===t.dir,u=0,s=n.length;if(e-=r(o),a){for(;u<s;)r(n.slice(i=u+s>>>1))>e?u=i+1:s=i;return o+n.slice(u)}for(;u<s;)r(n.slice(0,i=1+(u+s>>>1)))<e?u=i:s=i-1;return n.slice(0,u)+o}(t,e):e}function Sb(t,n){var e=t.font;return(n&&e?String(e).replace(/"/g,"'"):e)||"sans-serif"}function Fb(t,n){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+$b(t)+"px "+Sb(t,n)}function Eb(t){var n=t.baseline,e=$b(t);return Math.round("top"===n?.79*e:"middle"===n?.3*e:"bottom"===n?-.21*e:"line-top"===n?.29*e+.5*kb(t):"line-bottom"===n?.29*e-.5*kb(t):0)}vb(!0);const Nb={left:"start",center:"middle",right:"end"},Cb=new Rv;function Ob(t){var n,e=t.x||0,r=t.y||0,i=t.radius||0;return i&&(n=(t.theta||0)-tv,e+=i*Math.cos(n),r+=i*Math.sin(n)),Cb.x1=e,Cb.y1=r,Cb}function _b(t,n,e){var r,i=gb.height(n),o=n.align,a=Ob(n),u=a.x1,s=a.y1,c=n.dx||0,l=(n.dy||0)+Eb(n)-Math.round(.8*i),f=Mb(n);if(S(f)?(i+=kb(n)*(f.length-1),r=f.reduce(((t,e)=>Math.max(t,gb.width(n,e))),0)):r=gb.width(n,f),"center"===o?c-=r/2:"right"===o&&(c-=r),t.set(c+=u,l+=s,c+r,l+i),n.angle&&!e)t.rotate(n.angle*Zg,u,s);else if(2===e)return t.rotatedPoints(n.angle*Zg,u,s);return t}var zb={type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+Eb(n),o=Ob(n),a=o.x1,u=o.y1,s=n.angle||0;t("text-anchor",Nb[n.align]||"start"),s?(e=jy(a,u)+" "+Ry(s),(r||i)&&(e+=" "+jy(r,i))):e=jy(a+r,u+i),t("transform",e)},bound:_b,draw:function(t,n,e){Ny(n,(n=>{var r,i,o,a,u,s,c,l=null==n.opacity?1:n.opacity;if(!(e&&!e.intersects(n.bounds)||0===l||n.fontSize<=0||null==n.text||0===n.text.length)){if(t.font=Fb(n),t.textAlign=n.align||"left",i=(r=Ob(n)).x1,o=r.y1,n.angle&&(t.save(),t.translate(i,o),t.rotate(n.angle*Zg),i=o=0),i+=n.dx||0,o+=(n.dy||0)+Eb(n),s=Mb(n),xy(t,n),S(s))for(u=kb(n),a=0;a<s.length;++a)c=Db(n,s[a]),n.fill&&Ay(t,n,l)&&t.fillText(c,i,o),n.stroke&&Sy(t,n,l)&&t.strokeText(c,i,o),o+=u;else c=Db(n,s),n.fill&&Ay(t,n,l)&&t.fillText(c,i,o),n.stroke&&Sy(t,n,l)&&t.strokeText(c,i,o);n.angle&&t.restore()}}))},pick:By((function(t,n,e,r,i,o){if(n.fontSize<=0)return!1;if(!n.angle)return!0;var a=Ob(n),u=a.x1,s=a.y1,c=_b(Cb,n,1),l=-n.angle*Zg,f=Math.cos(l),d=Math.sin(l);return c.contains(f*i-d*o+(u-f*u+d*s),d*i+f*o+(s-d*u-f*s))})),isect:function(t,n){const e=_b(Cb,t,2);return wy(n,e[0],e[1],e[2],e[3])||wy(n,e[0],e[1],e[4],e[5])||wy(n,e[4],e[5],e[6],e[7])||wy(n,e[2],e[3],e[6],e[7])}},Bb=Uy("trail",(function(t,n){return zv.context(t)(n)}),(function(t,n){for(var e,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null})),Tb={arc:qy,area:Wy,group:Qy,image:ob,line:ab,path:sb,rect:lb,rule:db,shape:hb,symbol:mb,text:zb,trail:Bb};function Pb(t,n,e){var r=Tb[t.mark.marktype];return r.nested&&(t=t.mark),(n||r.bound)(t.bounds||(t.bounds=new Rv),t,e)}var jb={mark:null};function Rb(t,n,e){var r,i,o,a,u=Tb[t.marktype],s=u.bound,c=t.items,l=c&&c.length;if(u.nested)return l?o=c[0]:(jb.mark=t,o=jb),a=Pb(o,s,e),n&&n.union(a)||a;if(n=n||t.bounds&&t.bounds.clear()||new Rv,l)for(r=0,i=c.length;r<i;++r)n.union(Pb(c[r],s,e));return t.bounds=n}const Lb=["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 Ib(t,n){return JSON.stringify(t,Lb,n)}function qb(t){return Ub("string"==typeof t?JSON.parse(t):t)}function Ub(t){var n,e,r,i=t.marktype,o=t.items;if(o)for(e=0,r=o.length;e<r;++e)o[e][n=i?"mark":"group"]=t,o[e].zindex&&(o[e][n].zdirty=!0),"group"===(i||n)&&Ub(o[e]);return i&&Rb(t),t}class Wb{constructor(t){arguments.length?this.root=qb(t):(this.root=Hb({marktype:"group",name:"root",role:"frame"}),this.root.items=[new Iv(this.root)])}toJSON(t){return Ib(this.root,t||0)}mark(t,n,e){const r=Hb(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r}}function Hb(t,n){const e={bounds:new Rv,clip:!!t.clip,group:n,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0};return null!=t.aria&&(e.aria=t.aria),t.description&&(e.description=t.description),e}function Gb(t,n,e){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?e?t.createElementNS(e,n):t.createElement(n):null}function Yb(t,n){n=n.toLowerCase();for(var e=t.childNodes,r=0,i=e.length;r<i;++r)if(e[r].tagName.toLowerCase()===n)return e[r]}function Vb(t,n,e,r){var i,o=t.childNodes[n];return o&&o.tagName.toLowerCase()===e.toLowerCase()||(i=o||null,o=Gb(t.ownerDocument,e,r),t.insertBefore(o,i)),o}function Xb(t,n){for(var e=t.childNodes,r=e.length;r>n;)t.removeChild(e[--r]);return t}function Jb(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function Kb(t,n){const e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}let Qb=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||Vo(),this._tooltip=n||Zb}initialize(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)}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,n,e){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1}handlers(t){const n=this._handlers,e=[];if(t)e.push(...n[this.eventName(t)]);else for(const t in n)e.push(...n[t]);return e}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,e){this._loader.sanitize(e,{context:"href"}).then((n=>{const e=new MouseEvent(t.type,t),r=Gb(null,"a");for(const t in n)r.setAttribute(t,n[t]);r.dispatchEvent(e)})).catch((()=>{}))}handleTooltip(t,n,e){n&&null!=n.tooltip&&(n=function(t,n,e,r){var i,o,a=t&&t.mark;if(a&&(i=Tb[a.marktype]).tip){for((o=Kb(n,e))[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}(n,t,this.canvas(),this._origin),this._tooltip.call(this._obj,this,t,n,e&&n&&n.tooltip||null))}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,o=i.width(),a=i.height();let u=i.x1+r[0]+e.left,s=i.y1+r[1]+e.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,s+=t.y||0;return{x:u,y:s,width:o,height:a,left:u,top:s,right:u+o,bottom:s+a}}};function Zb(t,n,e,r){t.element().setAttribute("title",r||"")}class tw{constructor(t){this._el=null,this._bgcolor=null,this._loader=new qv(t)}initialize(t,n,e,r,i){return this._el=t,this.resize(n,e,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,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const e=this;return e._call=function(){e._render(t,n)},e._call(),e._call=null,e}_render(){}renderAsync(t,n){const e=this.render(t,n);return this._ready?this._ready.then((()=>e)):Promise.resolve(e)}_load(t,n){var e=this,r=e._loader[t](n);if(!e._ready){const t=e._call;e._ready=e._loader.ready().then((n=>{n&&t(),e._ready=null}))}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const nw="dragenter",ew="dragleave",rw="dragover",iw="pointerdown",ow="pointermove",aw="pointerout",uw="pointerover",sw="mousedown",cw="mousemove",lw="mouseout",fw="mouseover",dw="click",hw="mousewheel",mw="touchstart",pw="touchmove",gw="touchend",vw=["keydown","keypress","keyup",nw,ew,rw,iw,"pointerup",ow,aw,uw,sw,"mouseup",cw,lw,fw,dw,"dblclick","wheel",hw,mw,pw,gw],yw=ow,bw=lw,ww=dw;class xw extends Qb{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=vw,this.pointermove=Aw([ow,cw],[uw,fw],[aw,lw]),this.dragover=Aw([rw],[nw],[ew]),this.pointerout=Dw([aw,lw]),this.dragleave=Dw([ew])}initialize(t,n,e){return this._canvas=t&&Yb(t,"canvas"),[dw,sw,iw,ow,aw,ew].forEach((t=>kw(this,t))),super.initialize(t,n,e)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(hw,t)}pointerdown(t){this._down=this._active,this.fire(iw,t)}mousedown(t){this._down=this._active,this.fire(sw,t)}click(t){this._down===this._active&&(this.fire(dw,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(mw,t,!0)}touchmove(t){this.fire(pw,t,!0)}touchend(t){this.fire(gw,t,!0),this._touch=null}fire(t,n,e){const r=e?this._touch:this._active,i=this._handlers[t];if(n.vegaType=t,t===ww&&r&&r.href?this.handleHref(n,r,r.href):t!==yw&&t!==bw||this.handleTooltip(n,r,t!==bw),i)for(let t=0,e=i.length;t<e;++t)i[t].handler.call(this._obj,n,r)}on(t,n){const e=this.eventName(t),r=this._handlers;return this._handlerIndex(r[e],t,n)<0&&(kw(this,t),(r[e]||(r[e]=[])).push({type:t,handler:n})),this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&r.splice(i,1),this}pickEvent(t){const n=Kb(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])}pick(t,n,e,r,i){const o=this.context();return Tb[t.marktype].pick.call(this,o,t,n,e,r,i)}}const $w=t=>t===mw||t===pw||t===gw?[mw,pw,gw]:[t];function kw(t,n){$w(n).forEach((n=>function(t,n){const e=t.canvas();e&&!t._events[n]&&(t._events[n]=1,e.addEventListener(n,t[n]?e=>t[n](e):e=>t.fire(n,e)))}(t,n)))}function Mw(t,n,e){n.forEach((n=>t.fire(n,e)))}function Aw(t,n,e){return function(r){const i=this._active,o=this.pickEvent(r);o===i||(i&&i.exit||Mw(this,e,r),this._active=o,Mw(this,n,r)),Mw(this,t,r)}}function Dw(t){return function(n){Mw(this,t,n),this._active=null}}class Sw extends tw{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Rv,this._tempb=new Rv}initialize(t,n,e,r,i,o){return this._options=o||{},this._canvas=this._options.externalContext?null:hl(1,1),t&&this._canvas&&(Xb(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,e,r,i)}resize(t,n,e,r){if(super.resize(t,n,e,r),this._canvas)!function(t,n,e,r,i,o){const a="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,u=t.getContext("2d"),s=a?"undefined"!=typeof window&&window.devicePixelRatio||1:i;t.width=n*s,t.height=e*s;for(const t in o)u[t]=o[t];a&&1!==s&&(t.style.width=n+"px",t.style.height=e+"px"),u.pixelRatio=s,u.setTransform(s,0,0,s,s*r[0],s*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const t=this._options.externalContext;t||p("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 n=this._tempb.clear().union(t.bounds);let e=t.mark.group;for(;e;)n.translate(e.x||0,e.y||0),e=e.mark.group;this._dirty.union(n)}_render(t,n){const e=this.context(),r=this._origin,i=this._width,o=this._height,a=this._dirty,u=Fw(r,i,o);e.save();const s=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):function(t,n,e){return n.expand(1).round(),t.pixelRatio%1&&n.scale(t.pixelRatio).round().scale(1/t.pixelRatio),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(e,u.intersect(a),r);return this.clear(-r[0],-r[1],i,o),this.draw(e,t,s,n),e.restore(),a.clear(),this}draw(t,n,e,r){if("group"!==n.marktype&&null!=r&&!r.includes(n.marktype))return;const i=Tb[n.marktype];n.clip&&function(t,n){var e=n.clip;t.save(),tt(e)?(t.beginPath(),e(t),t.clip()):Hy(t,n.group)}(t,n),i.draw.call(this,t,n,e,r),n.clip&&t.restore()}clear(t,n,e,r){const i=this._options,o=this.context();"pdf"===i.type||i.externalContext||o.clearRect(t,n,e,r),null!=this._bgcolor&&(o.fillStyle=this._bgcolor,o.fillRect(t,n,e,r))}}const Fw=(t,n,e)=>(new Rv).set(0,0,n,e).translate(-t[0],-t[1]);class Ew extends Qb{constructor(t,n){super(t,n);const e=this;e._hrefHandler=Nw(e,((t,n)=>{n&&n.href&&e.handleHref(t,n,n.href)})),e._tooltipHandler=Nw(e,((t,n)=>{e.handleTooltip(t,n,t.type!==bw)}))}initialize(t,n,e){let r=this._svg;return r&&(r.removeEventListener(ww,this._hrefHandler),r.removeEventListener(yw,this._tooltipHandler),r.removeEventListener(bw,this._tooltipHandler)),this._svg=r=t&&Yb(t,"svg"),r&&(r.addEventListener(ww,this._hrefHandler),r.addEventListener(yw,this._tooltipHandler),r.addEventListener(bw,this._tooltipHandler)),super.initialize(t,n,e)}canvas(){return this._svg}on(t,n){const e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){const i={type:t,handler:n,listener:Nw(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this}off(t,n){const e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this}}const Nw=(t,n)=>e=>{let r=e.target.__data__;r=Array.isArray(r)?r[0]:r,e.vegaType=e.type,n.call(t._obj,e,r)},Cw="aria-hidden",Ow="aria-label",_w="role",zw="aria-roledescription",Bw="graphics-object",Tw="graphics-symbol",Pw=(t,n,e)=>({[_w]:t,[zw]:n,[Ow]:e||void 0}),jw=Bt(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),Rw={axis:{desc:"axis",caption:function(t){const n=t.datum,e=t.orient,r=n.title?Ww(t):null,i=t.context,o=i.scales[n.scale].value,a=i.dataflow.locale(),u=o.type;return`${"left"===e||"right"===e?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${og(u)?"discrete":u} scale`+` with ${jg(a,o,t)}`}},legend:{desc:"legend",caption:function(t){const n=t.datum,e=n.title?Ww(t):null,r=`${n.type||""} legend`.trim(),i=n.scales,o=Object.keys(i),a=t.context,u=a.scales[i[o[0]]].value,s=a.dataflow.locale();return((c=r).length?c[0].toUpperCase()+c.slice(1):c)+(e?` titled '${e}'`:"")+` for ${function(t){return(t=t.map((t=>t+("fill"===t||"stroke"===t?" color":"")))).length<2?t[0]:t.slice(0,-1).join(", ")+" and "+_(t)}(o)}`+` with ${jg(s,u,t)}`;var c}},"title-text":{desc:"title",caption:t=>`Title text '${Uw(t)}'`},"title-subtitle":{desc:"subtitle",caption:t=>`Subtitle text '${Uw(t)}'`}},Lw={ariaRole:_w,ariaRoleDescription:zw,description:Ow};function Iw(t,n){const e=!1===n.aria;if(t(Cw,e||void 0),e||null==n.description)for(const n in Lw)t(Lw[n],void 0);else{const e=n.mark.marktype;t(Ow,n.description),t(_w,n.ariaRole||("group"===e?Bw:Tw)),t(zw,n.ariaRoleDescription||`${e} mark`)}}function qw(t){return!1===t.aria?{[Cw]:!0}:jw[t.role]?null:Rw[t.role]?function(t,n){try{const e=t.items[0];return Pw(n.role||Tw,n.desc,e.description||(n.caption||(()=>""))(e))}catch(t){return null}}(t,Rw[t.role]):function(t){const n=t.marktype,e="group"===n||"text"===n||t.items.some((t=>null!=t.description&&!1!==t.aria));return Pw(e?Bw:Tw,`${n} mark container`,t.description)}(t)}function Uw(t){return Q(t.text).join(" ")}function Ww(t){try{return Q(_(t.items).items[0].text).join(" ")}catch(t){return null}}const Hw=t=>(t+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");function Gw(){let t="",n="",e="";const r=[],i=()=>n=e="",o=(t,e)=>{var r;return null!=e&&(n+=` ${t}="${r=e,Hw(r).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;")}"`),a},a={open(u,...s){(o=>{n&&(t+=`${n}>${e}`,i()),r.push(o)})(u),n="<"+u;for(const t of s)for(const n in t)o(n,t[n]);return a},close(){const o=r.pop();return t+=n?n+(e?`>${e}</${o}>`:"/>"):`</${o}>`,i(),a},attr:o,text:t=>(e+=Hw(t),a),toString:()=>t};return a}const Yw=t=>Vw(Gw(),t)+"";function Vw(t,n){if(t.open(n.tagName),n.hasAttributes()){const e=n.attributes,r=e.length;for(let n=0;n<r;++n)t.attr(e[n].name,e[n].value)}if(n.hasChildNodes()){const e=n.childNodes;for(const n of e)3===n.nodeType?t.text(n.nodeValue):Vw(t,n)}return t.close()}const Xw={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"},Jw={blend:"mix-blend-mode"},Kw={fill:"none","stroke-miterlimit":10},Qw="http://www.w3.org/2000/xmlns/",Zw=Zy.xmlns;class tx extends tw{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,n,e,r,i){return this._defs={},this._clearDefs(),t&&(this._svg=Vb(t,0,"svg",Zw),this._svg.setAttributeNS(Qw,"xmlns",Zw),this._svg.setAttributeNS(Qw,"xmlns:xlink",Zy["xmlns:xlink"]),this._svg.setAttribute("version",Zy.version),this._svg.setAttribute("class","marks"),Xb(t,1),this._root=Vb(this._svg,0,"g",Zw),lx(this._root,Kw),Xb(this._svg,1)),this.background(this._bgcolor),super.initialize(t,n,e,r,i)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svg&&(lx(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,n=this._bgcolor;if(!t)return null;let e;n&&(t.removeAttribute("style"),e=Vb(t,0,"rect",Zw),lx(e,{width:this._width,height:this._height,fill:n}));const r=Yw(t);return n&&(t.removeChild(e),this._svg.style.setProperty("background-color",n)),r}_render(t,n){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,n),Xb(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 n=++this._dirtyID;let e,r,i,o,a,u,s;for(a=0,u=t.length;a<u;++a)e=t[a],r=e.mark,r.marktype!==i&&(i=r.marktype,o=Tb[i]),r.zdirty&&r.dirty!==n&&(this._dirtyAll=!1,nx(e,n),r.items.forEach((t=>{t.dirty=n}))),r.zdirty||(e.exit?(o.nested&&r.items.length?(s=r.items[0],s._svg&&this._update(o,s._svg,s)):e._svg&&(s=e._svg.parentNode,s&&s.removeChild(e._svg)),e._svg=null):(e=o.nested?r.items[0]:e,e._update!==n&&(e._svg&&e._svg.ownerSVGElement?this._update(o,e._svg,e):(this._dirtyAll=!1,nx(e,n)),e._update=n)));return!this._dirtyAll}mark(t,n,e,r){if(!this.isDirty(n))return n._svg;const i=this._svg,o=n.marktype,a=Tb[o],u=!1===n.interactive?"none":null,s="g"===a.tag,c=ix(n,t,e,"g",i);if("group"!==o&&null!=r&&!r.includes(o))return Xb(c,0),n._svg;c.setAttribute("class",Jb(n));const l=qw(n);for(const t in l)fx(c,t,l[t]);s||fx(c,"pointer-events",u),fx(c,"clip-path",n.clip?jv(this,n,n.group):null);let f=null,d=0;const h=t=>{const n=this.isDirty(t),e=ix(t,c,f,a.tag,i);n&&(this._update(a,e,t),s&&function(t,n,e,r){n=n.lastChild.previousSibling;let i,o=0;Ny(e,(e=>{i=t.mark(n,e,i,r),++o})),Xb(n,1+o)}(this,e,t,r)),f=e,++d};return a.nested?n.items.length&&h(n.items[0]):Ny(n,h),Xb(c,d),c}_update(t,n,e){ox=n,ax=n.__values__,Iw(sx,e),t.attr(sx,e,this);const r=ux[t.type];r&&r.call(this,t,n,e),ox&&this.style(ox,e)}style(t,n){if(null!=n){for(const e in Xw){let r="font"===e?Sb(n):n[e];if(r===ax[e])continue;const i=Xw[e];null==r?t.removeAttribute(i):(Ig(r)&&(r=qg(r,this._defs.gradient,dx())),t.setAttribute(i,r+"")),ax[e]=r}for(const e in Jw)cx(t,Jw[e],n[e])}}defs(){const t=this._svg,n=this._defs;let e=n.el,r=0;for(const i in n.gradient)e||(n.el=e=Vb(t,1,"defs",Zw)),r=ex(e,n.gradient[i],r);for(const i in n.clipping)e||(n.el=e=Vb(t,1,"defs",Zw)),r=rx(e,n.clipping[i],r);e&&(0===r?(t.removeChild(e),n.el=null):Xb(e,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function nx(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function ex(t,n,e){let r,i,o;if("radial"===n.gradient){let r=Vb(t,e++,"pattern",Zw);lx(r,{id:Lg+n.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),r=Vb(r,0,"rect",Zw),lx(r,{width:1,height:1,fill:`url(${dx()}#${n.id})`}),lx(t=Vb(t,e++,"radialGradient",Zw),{id:n.id,fx:n.x1,fy:n.y1,fr:n.r1,cx:n.x2,cy:n.y2,r:n.r2})}else lx(t=Vb(t,e++,"linearGradient",Zw),{id:n.id,x1:n.x1,x2:n.x2,y1:n.y1,y2:n.y2});for(r=0,i=n.stops.length;r<i;++r)o=Vb(t,r,"stop",Zw),o.setAttribute("offset",n.stops[r].offset),o.setAttribute("stop-color",n.stops[r].color);return Xb(t,r),e}function rx(t,n,e){let r;return(t=Vb(t,e,"clipPath",Zw)).setAttribute("id",n.id),n.path?(r=Vb(t,0,"path",Zw),r.setAttribute("d",n.path)):(r=Vb(t,0,"rect",Zw),lx(r,{x:0,y:0,width:n.width,height:n.height})),Xb(t,1),e+1}function ix(t,n,e,r,i){let o,a=t._svg;if(!a&&(o=n.ownerDocument,a=Gb(o,r,Zw),t._svg=a,t.mark&&(a.__data__=t,a.__values__={fill:"default"},"g"===r))){const n=Gb(o,"path",Zw);a.appendChild(n),n.__data__=t;const e=Gb(o,"g",Zw);a.appendChild(e),e.__data__=t;const r=Gb(o,"path",Zw);a.appendChild(r),r.__data__=t,r.__values__={fill:"default"}}return(a.ownerSVGElement!==i||function(t,n){return t.parentNode&&t.parentNode.childNodes.length>1&&t.previousSibling!=n}(a,e))&&n.insertBefore(a,e?e.nextSibling:n.firstChild),a}let ox=null,ax=null;const ux={group(t,n,e){const r=ox=n.childNodes[2];ax=r.__values__,t.foreground(sx,e,this),ax=n.__values__,ox=n.childNodes[1],t.content(sx,e,this);const i=ox=n.childNodes[0];t.background(sx,e,this);const o=!1===e.mark.interactive?"none":null;if(o!==ax.events&&(fx(r,"pointer-events",o),fx(i,"pointer-events",o),ax.events=o),e.strokeForeground&&e.stroke){const t=e.fill;fx(r,"display",null),this.style(i,e),fx(i,"stroke",null),t&&(e.fill=null),ax=r.__values__,this.style(r,e),t&&(e.fill=t),ox=null}else fx(r,"display","none")},image(t,n,e){!1===e.smooth?(cx(n,"image-rendering","optimizeSpeed"),cx(n,"image-rendering","pixelated")):cx(n,"image-rendering",null)},text(t,n,e){const r=Mb(e);let i,o,a,u;S(r)?(o=r.map((t=>Db(e,t))),i=o.join("\n"),i!==ax.text&&(Xb(n,0),a=n.ownerDocument,u=kb(e),o.forEach(((t,r)=>{const i=Gb(a,"tspan",Zw);i.__data__=e,i.textContent=t,r&&(i.setAttribute("x",0),i.setAttribute("dy",u)),n.appendChild(i)})),ax.text=i)):(o=Db(e,r),o!==ax.text&&(n.textContent=o,ax.text=o)),fx(n,"font-family",Sb(e)),fx(n,"font-size",$b(e)+"px"),fx(n,"font-style",e.fontStyle),fx(n,"font-variant",e.fontVariant),fx(n,"font-weight",e.fontWeight)}};function sx(t,n,e){n!==ax[t]&&(e?function(t,n,e,r){null!=e?t.setAttributeNS(r,n,e):t.removeAttributeNS(r,n)}(ox,t,n,e):fx(ox,t,n),ax[t]=n)}function cx(t,n,e){e!==ax[n]&&(null==e?t.style.removeProperty(n):t.style.setProperty(n,e+""),ax[n]=e)}function lx(t,n){for(const e in n)fx(t,e,n[e])}function fx(t,n,e){null!=e?t.setAttribute(n,e):t.removeAttribute(n)}function dx(){let t;return"undefined"==typeof window?"":(t=window.location).hash?t.href.slice(0,-t.hash.length):t.href}class hx extends tw{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=Gw();n.open("svg",st({},Zy,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const e=this._bgcolor;return e&&"transparent"!==e&&"none"!==e&&n.open("rect",{width:this._width,height:this._height,fill:e}).close(),n.open("g",Kw,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const e=Tb[n.marktype],r=e.tag,i=[Iw,e.attr];t.open("g",{class:Jb(n),"clip-path":n.clip?jv(this,n,n.group):null},qw(n),{"pointer-events":"g"!==r&&!1===n.interactive?"none":null});const o=o=>{const a=this.href(o);if(a&&t.open("a",a),t.open(r,this.attr(n,o,i,"g"!==r?r:null)),"text"===r){const n=Mb(o);if(S(n)){const e={x:0,dy:kb(o)};for(let r=0;r<n.length;++r)t.open("tspan",r?e:null).text(Db(o,n[r])).close()}else t.text(Db(o,n))}else if("g"===r){const r=o.strokeForeground,i=o.fill,a=o.stroke;r&&a&&(o.stroke=null),t.open("path",this.attr(n,o,e.background,"bgrect")).close(),t.open("g",this.attr(n,o,e.content)),Ny(o,(n=>this.mark(t,n))),t.close(),r&&a?(i&&(o.fill=null),o.stroke=a,t.open("path",this.attr(n,o,e.foreground,"bgrect")).close(),i&&(o.fill=i)):t.open("path",this.attr(n,o,e.foreground,"bgfore")).close()}t.close(),a&&t.close()};return e.nested?n.items&&n.items.length&&o(n.items[0]):Ny(n,o),t.close()}href(t){const n=t.href;let e;if(n){if(e=this._hrefs&&this._hrefs[n])return e;this.sanitizeURL(n).then((t=>{t["xlink:href"]=t.href,t.href=null,(this._hrefs||(this._hrefs={}))[n]=t}))}return null}attr(t,n,e,r){const i={},o=(t,n,e,r)=>{i[r||t]=n};return Array.isArray(e)?e.forEach((t=>t(o,n,this))):e(o,n,this),r&&function(t,n,e,r,i){let o;if(null==n)return t;if("bgrect"===r&&!1===e.interactive&&(t["pointer-events"]="none"),"bgfore"===r&&(!1===e.interactive&&(t["pointer-events"]="none"),t.display="none",null!==n.fill))return t;"image"===r&&!1===n.smooth&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),"text"===r&&(t["font-family"]=Sb(n),t["font-size"]=$b(n)+"px",t["font-style"]=n.fontStyle,t["font-variant"]=n.fontVariant,t["font-weight"]=n.fontWeight);for(const e in Xw){let r=n[e];const o=Xw[e];("transparent"!==r||"fill"!==o&&"stroke"!==o)&&null!=r&&(Ig(r)&&(r=qg(r,i.gradient,"")),t[o]=r)}for(const t in Jw){const e=n[t];null!=e&&(o=o||[],o.push(`${Jw[t]}: ${e};`))}o&&(t.style=o.join(" "))}(i,n,t,r,this._defs),i}defs(t){const n=this._defs.gradient,e=this._defs.clipping;if(0!==Object.keys(n).length+Object.keys(e).length){t.open("defs");for(const e in n){const r=n[e],i=r.stops;"radial"===r.gradient?(t.open("pattern",{id:Lg+e,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+e+")"}).close(),t.close(),t.open("radialGradient",{id:e,fx:r.x1,fy:r.y1,fr:r.r1,cx:r.x2,cy:r.y2,r:r.r2})):t.open("linearGradient",{id:e,x1:r.x1,x2:r.x2,y1:r.y1,y2:r.y2});for(let n=0;n<i.length;++n)t.open("stop",{offset:i[n].offset,"stop-color":i[n].color}).close();t.close()}for(const n in e){const r=e[n];t.open("clipPath",{id:n}),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 mx={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class px extends tw{constructor(t){super(t),this._svgRenderer=new tx(t),this._canvasRenderer=new Sw(t)}initialize(t,n,e,r,i){this._root_el=Vb(t,0,"div");const o=Vb(this._root_el,0,"div"),a=Vb(this._root_el,1,"div");return this._root_el.style.position="relative",mx.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=mx.svgOnTop?a:o,this._canvasEl=mx.svgOnTop?o:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,n,e,r,i),this._svgRenderer.initialize(this._svgEl,n,e,r,i),super.initialize(t,n,e,r,i)}dirty(t){return mx.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,n){const e=(n??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter((t=>!mx.svgMarkTypes.includes(t)));this._svgRenderer.render(t,mx.svgMarkTypes),this._canvasRenderer.render(t,e)}resize(t,n,e,r){return super.resize(t,n,e,r),this._svgRenderer.resize(t,n,e,r),this._canvasRenderer.resize(t,n,e,r),this}background(t){return mx.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class gx extends xw{constructor(t,n){super(t,n)}initialize(t,n,e){const r=Vb(Vb(t,0,"div"),mx.svgOnTop?0:1,"div");return super.initialize(r,n,e)}}const vx="canvas",yx="hybrid",bx="none",wx={Canvas:vx,PNG:"png",SVG:"svg",Hybrid:yx,None:bx},xx={};function $x(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?(xx[t]=n,this):xx[t]}function kx(t,n,e){const r=[],i=(new Rv).union(n),o=t.marktype;return o?Mx(t,i,e,r):"group"===o?Ax(t,i,e,r):p("Intersect scene must be mark node or group item.")}function Mx(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){const i=t.items,o=t.marktype,a=i.length;let u=0;if("group"===o)for(;u<a;++u)Ax(i[u],n,e,r);else for(const t=Tb[o].isect;u<a;++u){const e=i[u];Dx(e,n,t)&&r.push(e)}}return r}function Ax(t,n,e,r){e&&e(t.mark)&&Dx(t,n,Tb.group.isect)&&r.push(t);const i=t.items,o=i&&i.length;if(o){const a=t.x||0,u=t.y||0;n.translate(-a,-u);for(let t=0;t<o;++t)Mx(i[t],n,e,r);n.translate(a,u)}return r}function Dx(t,n,e){const r=t.bounds;return n.encloses(r)||n.intersects(r)&&e(t,n)}xx[vx]=xx.png={renderer:Sw,headless:Sw,handler:xw},xx.svg={renderer:tx,headless:hx,handler:Ew},xx[yx]={renderer:px,headless:px,handler:gx},xx[bx]={};const Sx=new Rv;function Fx(t){const n=t.clip;if(tt(n))n(cy(Sx.clear()));else{if(!n)return;Sx.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Sx)}function Ex(t,n,e){return t===n||("path"===e?Nx(t,n):t instanceof Date&&n instanceof Date?+t==+n:wt(t)&&wt(n)?Math.abs(t-n)<=1e-9:t&&n&&(F(t)||F(n))?function(t,n){var e,r,i=Object.keys(t),o=Object.keys(n);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(!Ex(t[e=i[r]],n[e],e))return!1;return typeof t==typeof n}(t,n):t==n)}function Nx(t,n){return Ex(Qg(t),Qg(n))}const Cx="top",Ox="left",_x="right",zx="bottom",Bx="start",Tx="middle",Px="end",jx="group",Rx="axis",Lx="title",Ix="legend",qx="row-header",Ux="row-footer",Wx="row-title",Hx="column-header",Gx="column-footer",Yx="column-title",Vx="fit-x",Xx="fit-y",Jx="none",Kx="all",Qx="each",Zx="flush",t$="column",n$="row";function e$(t){Oa.call(this,null,t)}function r$(t,n,e){return n(t.bounds.clear(),t,e)}pt(e$,Oa,{transform(t,n){const e=n.dataflow,r=t.mark,i=r.marktype,o=Tb[i],a=o.bound;let u,s=r.bounds;if(o.nested)r.items.length&&e.dirty(r.items[0]),s=r$(r,a),r.items.forEach((t=>{t.bounds.clear().union(s)}));else if(i===jx||t.modified())switch(n.visit(n.MOD,(t=>e.dirty(t))),s.clear(),r.items.forEach((t=>s.union(r$(t,a)))),r.role){case Rx:case Ix:case Lx:n.reflow()}else u=n.changed(n.REM),n.visit(n.ADD,(t=>{s.union(r$(t,a))})),n.visit(n.MOD,(t=>{u=u||s.alignsWith(t.bounds),e.dirty(t),s.union(r$(t,a))})),u&&(s.clear(),r.items.forEach((t=>s.union(t.bounds))));return Fx(r),n.modifies("bounds")}});const i$=":vega_identifier:";function o$(t){Oa.call(this,0,t)}function a$(t){Oa.call(this,null,t)}function u$(t){Oa.call(this,null,t)}o$.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},pt(o$,Oa,{transform(t,n){const e=(i=n.dataflow)._signals[i$]||(i._signals[i$]=i.add(0)),r=t.as;var i;let o=e.value;return n.visit(n.ADD,(t=>t[r]=t[r]||++o)),e.set(this.value=o),n}}),pt(a$,Oa,{transform(t,n){let e=this.value;e||(e=n.dataflow.scenegraph().mark(t.markdef,function(t){const n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index),e.group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this.source,e.clip=t.clip,e.interactive=t.interactive,this.value=e);const r=e.marktype===jx?Iv:Lv;return n.visit(n.ADD,(t=>r.call(t,e))),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n}});const s$={parity:t=>t.filter(((t,n)=>n%2?t.opacity=0:1)),greedy:(t,n)=>{let e;return t.filter(((t,r)=>r&&c$(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)))}},c$=(t,n,e)=>e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2),l$=(t,n)=>{for(var e,r=1,i=t.length,o=t[0].bounds;r<i;o=e,++r)if(c$(o,e=t[r].bounds,n))return!0},f$=t=>{const n=t.bounds;return n.width()>1&&n.height()>1},d$=t=>(t.forEach((t=>t.opacity=1)),t),h$=(t,n)=>t.reflow(n.modified()).modifies("opacity");function m$(t){Oa.call(this,null,t)}pt(u$,Oa,{transform(t,n){const e=s$[t.method]||s$.parity,r=t.separation||0;let i,o,a=n.materialize(n.SOURCE).source;if(!a||!a.length)return;if(!t.method)return t.modified("method")&&(d$(a),n=h$(n,t)),n;if(a=a.filter(f$),!a.length)return;if(t.sort&&(a=a.slice().sort(t.sort)),i=d$(a),n=h$(n,t),i.length>=3&&l$(i,r)){do{i=e(i,r)}while(i.length>=3&&l$(i,r));i.length<3&&!_(a).opacity&&(i.length>1&&(_(i).opacity=0),_(a).opacity=1)}t.boundScale&&t.boundTolerance>=0&&(o=((t,n,e)=>{var r=t.range(),i=new Rv;return n===Cx||n===zx?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(e||1),t=>i.encloses(t.bounds)})(t.boundScale,t.boundOrient,+t.boundTolerance),a.forEach((t=>{o(t)||(t.opacity=0)})));const u=i[0].mark.bounds.clear();return a.forEach((t=>{t.opacity&&u.union(t.bounds)})),n}}),pt(m$,Oa,{transform(t,n){const e=n.dataflow;if(n.visit(n.ALL,(t=>e.dirty(t))),n.fields&&n.fields.zindex){const t=n.source&&n.source[0];t&&(t.mark.zdirty=!0)}}});const p$=new Rv;function g$(t,n,e){return t[n]===e?0:(t[n]=e,1)}function v$(t){var n=t.items[0].orient;return n===Ox||n===_x}function y$(t,n,e,r){var i,o,a=n.items[0],u=a.datum,s=null!=a.translate?a.translate:.5,c=a.orient,l=function(t){let n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(u),f=a.range,d=a.offset,h=a.position,m=a.minExtent,p=a.maxExtent,g=u.title&&a.items[l[2]].items[0],v=a.titlePadding,y=a.bounds,b=g&&Ab(g),w=0,x=0;switch(p$.clear().union(y),y.clear(),(i=l[0])>-1&&y.union(a.items[i].bounds),(i=l[1])>-1&&y.union(a.items[i].bounds),c){case Cx:w=h||0,x=-d,o=Math.max(m,Math.min(p,-y.y1)),y.add(0,-o).add(f,0),g&&b$(t,g,o,v,b,0,-1,y);break;case Ox:w=-d,x=h||0,o=Math.max(m,Math.min(p,-y.x1)),y.add(-o,0).add(0,f),g&&b$(t,g,o,v,b,1,-1,y);break;case _x:w=e+d,x=h||0,o=Math.max(m,Math.min(p,y.x2)),y.add(0,0).add(o,f),g&&b$(t,g,o,v,b,1,1,y);break;case zx:w=h||0,x=r+d,o=Math.max(m,Math.min(p,y.y2)),y.add(0,0).add(f,o),g&&b$(t,g,o,v,0,0,1,y);break;default:w=a.x,x=a.y}return Hv(y.translate(w,x),a),g$(a,"x",w+s)|g$(a,"y",x+s)&&(a.bounds=p$,t.dirty(a),a.bounds=y,t.dirty(a)),a.mark.bounds.clear().union(y)}function b$(t,n,e,r,i,o,a,u){const s=n.bounds;if(n.auto){const u=a*(e+i+r);let c=0,l=0;t.dirty(n),o?c=(n.x||0)-(n.x=u):l=(n.y||0)-(n.y=u),n.mark.bounds.clear().union(s.translate(-c,-l)),t.dirty(n)}u.union(s)}const w$=(t,n)=>Math.floor(Math.min(t,n)),x$=(t,n)=>Math.ceil(Math.max(t,n));function $$(t){return(new Rv).set(0,0,t.width||0,t.height||0)}function k$(t){const n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function M$(t,n,e){const r=F(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function A$(t){return t<0?Math.ceil(-t):0}function D$(t,n,e){var r,i,o,a,u,s,c,l,f,d,h,m=!e.nodirty,p=e.bounds===Zx?$$:k$,g=p$.set(0,0,0,0),v=M$(e.align,t$),y=M$(e.align,n$),b=M$(e.padding,t$),w=M$(e.padding,n$),x=e.columns||n.length,$=x<=0?1:Math.ceil(n.length/x),k=n.length,M=Array(k),A=Array(x),D=0,S=Array(k),F=Array($),E=0,N=Array(k),C=Array(k),O=Array(k);for(i=0;i<x;++i)A[i]=0;for(i=0;i<$;++i)F[i]=0;for(i=0;i<k;++i)u=O[i]=p(s=n[i]),s.x=s.x||0,N[i]=0,s.y=s.y||0,C[i]=0,o=i%x,a=~~(i/x),D=Math.max(D,c=Math.ceil(u.x2)),E=Math.max(E,l=Math.ceil(u.y2)),A[o]=Math.max(A[o],c),F[a]=Math.max(F[a],l),M[i]=b+A$(u.x1),S[i]=w+A$(u.y1),m&&t.dirty(n[i]);for(i=0;i<k;++i)i%x==0&&(M[i]=0),i<x&&(S[i]=0);if(v===Qx)for(o=1;o<x;++o){for(h=0,i=o;i<k;i+=x)h<M[i]&&(h=M[i]);for(i=o;i<k;i+=x)M[i]=h+A[o-1]}else if(v===Kx){for(h=0,i=0;i<k;++i)i%x&&h<M[i]&&(h=M[i]);for(i=0;i<k;++i)i%x&&(M[i]=h+D)}else for(v=!1,o=1;o<x;++o)for(i=o;i<k;i+=x)M[i]+=A[o-1];if(y===Qx)for(a=1;a<$;++a){for(h=0,r=(i=a*x)+x;i<r;++i)h<S[i]&&(h=S[i]);for(i=a*x;i<r;++i)S[i]=h+F[a-1]}else if(y===Kx){for(h=0,i=x;i<k;++i)h<S[i]&&(h=S[i]);for(i=x;i<k;++i)S[i]=h+E}else for(y=!1,a=1;a<$;++a)for(r=(i=a*x)+x;i<r;++i)S[i]+=F[a-1];for(f=0,i=0;i<k;++i)N[i]+=(f=M[i]+(i%x?f:0))-n[i].x;for(o=0;o<x;++o)for(d=0,i=o;i<k;i+=x)C[i]+=(d+=S[i])-n[i].y;if(v&&M$(e.center,t$)&&$>1)for(i=0;i<k;++i)(f=(u=v===Kx?D:A[i%x])-O[i].x2-n[i].x-N[i])>0&&(N[i]+=f/2);if(y&&M$(e.center,n$)&&1!==x)for(i=0;i<k;++i)(d=(u=y===Kx?E:F[~~(i/x)])-O[i].y2-n[i].y-C[i])>0&&(C[i]+=d/2);for(i=0;i<k;++i)g.union(O[i].translate(N[i],C[i]));switch(f=M$(e.anchor,"x"),d=M$(e.anchor,"y"),M$(e.anchor,t$)){case Px:f-=g.width();break;case Tx:f-=g.width()/2}switch(M$(e.anchor,n$)){case Px:d-=g.height();break;case Tx:d-=g.height()/2}for(f=Math.round(f),d=Math.round(d),g.clear(),i=0;i<k;++i)n[i].mark.bounds.clear();for(i=0;i<k;++i)(s=n[i]).x+=N[i]+=f,s.y+=C[i]+=d,g.union(s.mark.bounds.union(s.bounds.translate(N[i],C[i]))),m&&t.dirty(s);return g}function S$(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function F$(t,n){return t.bounds[n]}function E$(t,n,e,r,i,o,a,u,s,c,l,f,d,h){var m,p,g,v,y,b,w,x,$,k=e.length,M=0,A=0;if(!k)return M;for(m=l;m<k;m+=f)e[m]&&(M=a(M,s(e[m],c)));if(!n.length)return M;for(n.length>i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),M+=o,p=0,v=n.length;p<v;++p)t.dirty(n[p]),n[p].mark.bounds.clear();for(m=l,p=0,v=n.length;p<v;++p,m+=f){for(y=(b=n[p]).mark.bounds,g=m;g>=0&&null==(w=e[g]);g-=d);u?(x=null==h?w.x:Math.round(w.bounds.x1+h*w.bounds.width()),$=M):(x=M,$=null==h?w.y:Math.round(w.bounds.y1+h*w.bounds.height())),y.union(b.bounds.translate(x-(b.x||0),$-(b.y||0))),b.x=x,b.y=$,t.dirty(b),A=a(A,y[c])}return A}function N$(t,n,e,r,i,o){if(n){t.dirty(n);var a=e,u=e;r?a=Math.round(i.x1+o*i.width()):u=Math.round(i.y1+o*i.height()),n.bounds.translate(a-(n.x||0),u-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=a,n.y=u,t.dirty(n)}}function C$(t,n,e,r,i,o,a){const u=function(t,n){const e=t[n]||{};return(n,r)=>null!=e[n]?e[n]:null!=t[n]?t[n]:r}(e,n),s=function(t,n){let e=-1/0;return t.forEach((t=>{null!=t.offset&&(e=Math.max(e,t.offset))})),e>-1/0?e:n}(t,u("offset",0)),c=u("anchor",Bx),l=c===Px?1:c===Tx?.5:0,f={align:Qx,bounds:u("bounds",Zx),columns:"vertical"===u("direction")?1:t.length,padding:u("margin",8),center:u("center"),nodirty:!0};switch(n){case Ox:f.anchor={x:Math.floor(r.x1)-s,column:Px,y:l*(a||r.height()+2*r.y1),row:c};break;case _x:f.anchor={x:Math.ceil(r.x2)+s,y:l*(a||r.height()+2*r.y1),row:c};break;case Cx:f.anchor={y:Math.floor(i.y1)-s,row:Px,x:l*(o||i.width()+2*i.x1),column:c};break;case zx:f.anchor={y:Math.ceil(i.y2)+s,x:l*(o||i.width()+2*i.x1),column:c};break;case"top-left":f.anchor={x:s,y:s};break;case"top-right":f.anchor={x:o-s,y:s,column:Px};break;case"bottom-left":f.anchor={x:s,y:a-s,row:Px};break;case"bottom-right":f.anchor={x:o-s,y:a-s,column:Px,row:Px}}return f}function O$(t,n){var e,r,i=n.items[0],o=i.datum,a=i.orient,u=i.bounds,s=i.x,c=i.y;return i._bounds?i._bounds.clear().union(u):i._bounds=u.clone(),u.clear(),function(t,n,e){var r=n.padding,i=r-e.x,o=r-e.y;if(n.datum.title){var a=n.items[1].items[0],u=a.anchor,s=n.titlePadding||0,c=r-a.x,l=r-a.y;switch(a.orient){case Ox:i+=Math.ceil(a.bounds.width())+s;break;case _x:case zx:break;default:o+=a.bounds.height()+s}switch((i||o)&&z$(t,e,i,o),a.orient){case Ox:l+=_$(n,e,a,u,1,1);break;case _x:c+=_$(n,e,a,Px,0,0)+s,l+=_$(n,e,a,u,1,1);break;case zx:c+=_$(n,e,a,u,0,0),l+=_$(n,e,a,Px,-1,0,1)+s;break;default:c+=_$(n,e,a,u,0,0)}(c||l)&&z$(t,a,c,l),(c=Math.round(a.bounds.x1-r))<0&&(z$(t,e,-c,0),z$(t,a,-c,0))}else(i||o)&&z$(t,e,i,o)}(t,i,i.items[0].items[0]),u=function(t,n){return t.items.forEach((t=>n.union(t.bounds))),n.x1=t.padding,n.y1=t.padding,n}(i,u),e=2*i.padding,r=2*i.padding,u.empty()||(e=Math.ceil(u.width()+e),r=Math.ceil(u.height()+r)),"symbol"===o.type&&function(t){const n=t.reduce(((t,n)=>(t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t)),{});t.forEach((t=>{t.width=n[t.column],t.height=t.bounds.y2-t.y}))}(i.items[0].items[0].items[0].items),a!==Jx&&(i.x=s=0,i.y=c=0),i.width=e,i.height=r,Hv(u.set(s,c,s+e,c+r),i),i.mark.bounds.clear().union(u),i}function _$(t,n,e,r,i,o,a){const u=e.datum.vgrad,s=("symbol"===t.datum.type||!o&&u||a?n:n.items[0]).bounds[i?"y2":"x2"]-t.padding,c=u&&o?s:0,l=u&&o?0:s,f=i<=0?0:Ab(e);return Math.round(r===Bx?c:r===Px?l-f:.5*(s-f))}function z$(t,n,e,r){n.x+=e,n.y+=r,n.bounds.translate(e,r),n.mark.bounds.translate(e,r),t.dirty(n)}function B$(t){Oa.call(this,null,t)}pt(B$,Oa,{transform(t,n){const e=n.dataflow;return t.mark.items.forEach((n=>{t.layout&&function(t,n,e){var r,i,o,a,u,s,c,l=function(t){var n,e,r=t.items,i=r.length,o=0;const a={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;o<i;++o)if(e=(n=r[o]).items,n.marktype===jx)switch(n.role){case Rx:case Ix:case Lx:break;case qx:a.rowheaders.push(...e);break;case Ux:a.rowfooters.push(...e);break;case Hx:a.colheaders.push(...e);break;case Gx:a.colfooters.push(...e);break;case Wx:a.rowtitle=e[0];break;case Yx:a.coltitle=e[0];break;default:a.marks.push(...e)}return a}(n),f=l.marks,d=e.bounds===Zx?S$:F$,h=e.offset,m=e.columns||f.length,p=m<=0?1:Math.ceil(f.length/m),g=p*m;const v=D$(t,f,e);v.empty()&&v.set(0,0,0,0),l.rowheaders&&(s=M$(e.headerBand,n$,null),r=E$(t,l.rowheaders,f,0,p,-M$(h,"rowHeader"),w$,0,d,"x1",0,m,1,s)),l.colheaders&&(s=M$(e.headerBand,t$,null),i=E$(t,l.colheaders,f,0,m,-M$(h,"columnHeader"),w$,1,d,"y1",0,1,m,s)),l.rowfooters&&(s=M$(e.footerBand,n$,null),o=E$(t,l.rowfooters,f,0,p,M$(h,"rowFooter"),x$,0,d,"x2",m-1,m,1,s)),l.colfooters&&(s=M$(e.footerBand,t$,null),a=E$(t,l.colfooters,f,0,m,M$(h,"columnFooter"),x$,1,d,"y2",g-m,1,m,s)),l.rowtitle&&(u=M$(e.titleAnchor,n$),c=M$(h,"rowTitle"),c=u===Px?o+c:r-c,s=M$(e.titleBand,n$,.5),N$(t,l.rowtitle,c,0,v,s)),l.coltitle&&(u=M$(e.titleAnchor,t$),c=M$(h,"columnTitle"),c=u===Px?a+c:i-c,s=M$(e.titleBand,t$,.5),N$(t,l.coltitle,c,1,v,s))}(e,n,t.layout),function(t,n,e){var r,i,o,a,u,s=n.items,c=Math.max(0,n.width||0),l=Math.max(0,n.height||0),f=(new Rv).set(0,0,c,l),d=f.clone(),h=f.clone(),m=[];for(a=0,u=s.length;a<u;++a)switch((i=s[a]).role){case Rx:(v$(i)?d:h).union(y$(t,i,c,l));break;case Lx:r=i;break;case Ix:m.push(O$(t,i));break;case"frame":case"scope":case qx:case Ux:case Wx:case Hx:case Gx:case Yx:d.union(i.bounds),h.union(i.bounds);break;default:f.union(i.bounds)}if(m.length){const n={};m.forEach((t=>{(o=t.orient||_x)!==Jx&&(n[o]||(n[o]=[])).push(t)}));for(const r in n){const i=n[r];D$(t,i,C$(i,r,e.legends,d,h,c,l))}m.forEach((n=>{const r=n.bounds;if(r.equals(n._bounds)||(n.bounds=n._bounds,t.dirty(n),n.bounds=r,t.dirty(n)),!e.autosize||"fit"!==e.autosize.type&&e.autosize.type!==Vx&&e.autosize.type!==Xx)f.union(r);else switch(n.orient){case Ox:case _x:f.add(r.x1,0).add(r.x2,0);break;case Cx:case zx:f.add(0,r.y1).add(0,r.y2)}}))}f.union(d).union(h),r&&f.union(function(t,n,e,r,i){var o,a=n.items[0],u=a.orient,s=a.anchor,c=a.offset,l=a.padding,f=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],h=u===Ox||u===_x?r:e,m=0,p=0,g=0,v=0,y=0;if(a.frame!==jx?u===Ox?(m=i.y2,h=i.y1):u===_x?(m=i.y1,h=i.y2):(m=i.x1,h=i.x2):u===Ox&&(m=r,h=0),o=s===Bx?m:s===Px?h:(m+h)/2,d&&d.text){switch(u){case Cx:case zx:y=f.bounds.height()+l;break;case Ox:v=f.bounds.width()+l;break;case _x:v=-f.bounds.width()-l}p$.clear().union(d.bounds),p$.translate(v-(d.x||0),y-(d.y||0)),g$(d,"x",v)|g$(d,"y",y)&&(t.dirty(d),d.bounds.clear().union(p$),d.mark.bounds.clear().union(p$),t.dirty(d)),p$.clear().union(d.bounds)}else p$.clear();switch(p$.union(f.bounds),u){case Cx:p=o,g=i.y1-p$.height()-c;break;case Ox:p=i.x1-p$.width()-c,g=o;break;case _x:p=i.x2+p$.width()+c,g=o;break;case zx:p=o,g=i.y2+c;break;default:p=a.x,g=a.y}return g$(a,"x",p)|g$(a,"y",g)&&(p$.translate(p,g),t.dirty(a),a.bounds.clear().union(p$),n.bounds.clear().union(p$),t.dirty(a)),a.bounds}(t,r,c,l,f)),n.clip&&f.set(0,0,n.width||0,n.height||0),function(t,n,e,r){const i=r.autosize||{},o=i.type;if(t._autosize<1||!o)return;let a=t._width,u=t._height,s=Math.max(0,n.width||0),c=Math.max(0,Math.ceil(-e.x1)),l=Math.max(0,n.height||0),f=Math.max(0,Math.ceil(-e.y1));const d=Math.max(0,Math.ceil(e.x2-s)),h=Math.max(0,Math.ceil(e.y2-l));if("padding"===i.contains){const n=t.padding();a-=n.left+n.right,u-=n.top+n.bottom}o===Jx?(c=0,f=0,s=a,l=u):"fit"===o?(s=Math.max(0,a-c-d),l=Math.max(0,u-f-h)):o===Vx?(s=Math.max(0,a-c-d),u=l+f+h):o===Xx?(a=s+c+d,l=Math.max(0,u-f-h)):"pad"===o&&(a=s+c+d,u=l+f+h),t._resizeView(a,u,s,l,[c,f],i.resize)}(t,n,f,e)}(e,n,t)})),function(t){return t&&"legend-entry"!==t.mark.role}(t.mark.group)?n.reflow():n}});var T$=Object.freeze({__proto__:null,bound:e$,identifier:o$,mark:a$,overlap:u$,render:m$,viewlayout:B$});function P$(t){Oa.call(this,null,t)}function j$(t){Oa.call(this,null,t)}function R$(){return ea({})}function L$(t){Oa.call(this,null,t)}function I$(t){Oa.call(this,[],t)}pt(P$,Oa,{transform(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.dataflow.locale(),r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=this.value,o=t.scale,a=Mg(o,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Sg(e,o,a,t.formatSpecifier,t.formatType,!!t.values),s=t.values?Ag(o,t.values,a):Dg(o,a);return i&&(r.rem=i),i=s.map(((t,n)=>ea({index:n/(s.length-1||1),value:t,label:u(t)}))),t.extra&&i.length&&i.push(ea({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}}),pt(j$,Oa,{transform(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=t.item||R$,o=t.key||ta,a=this.value;return S(r.encode)&&(r.encode=null),a&&(t.modified("key")||n.modified(o))&&p("DataJoin does not support modified key function or fields."),a||(n=n.addAll(),this.value=a=function(t){const n=ht().test((t=>t.exit));return n.lookup=e=>n.get(t(e)),n}(o)),n.visit(n.ADD,(t=>{const n=o(t);let e=a.get(n);e?e.exit?(a.empty--,r.add.push(e)):r.mod.push(e):(e=i(t),a.set(n,e),r.add.push(e)),e.datum=t,e.exit=!1})),n.visit(n.MOD,(t=>{const n=o(t),e=a.get(n);e&&(e.datum=t,r.mod.push(e))})),n.visit(n.REM,(t=>{const n=o(t),e=a.get(n);t!==e.datum||e.exit||(r.rem.push(e),e.exit=!0,++a.empty)})),n.changed(n.ADD_MOD)&&r.modifies("datum"),(n.clean()||t.clean&&a.empty>e.cleanThreshold)&&e.runAfter(a.clean),r}}),pt(L$,Oa,{transform(t,n){var e=n.fork(n.ADD_REM),r=t.mod||!1,i=t.encoders,o=n.encode;if(S(o)){if(!e.changed()&&!o.every((t=>i[t])))return n.StopPropagation;o=o[0],e.encode=null}var a="enter"===o,u=i.update||k,s=i.enter||k,c=i.exit||k,l=(o&&!a?i[o]:u)||k;if(n.changed(n.ADD)&&(n.visit(n.ADD,(n=>{s(n,t),u(n,t)})),e.modifies(s.output),e.modifies(u.output),l!==k&&l!==u&&(n.visit(n.ADD,(n=>{l(n,t)})),e.modifies(l.output))),n.changed(n.REM)&&c!==k&&(n.visit(n.REM,(n=>{c(n,t)})),e.modifies(c.output)),a||l!==k){const i=n.MOD|(t.modified()?n.REFLOW:0);a?(n.visit(i,(n=>{const i=s(n,t)||r;(l(n,t)||i)&&e.mod.push(n)})),e.mod.length&&e.modifies(s.output)):n.visit(i,(n=>{(l(n,t)||r)&&e.mod.push(n)})),e.mod.length&&e.modifies(l.output)}return e.changed()?e:n.StopPropagation}}),pt(I$,Oa,{transform(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,o,a,u=n.dataflow.locale(),s=n.fork(n.NO_SOURCE|n.NO_FIELDS),c=this.value,l=t.type||wg,f=t.scale,d=+t.limit,h=Mg(f,null==t.count?5:t.count,t.minstep),m=t.format||Og(u,f,h,l,t.formatSpecifier,t.formatType,!!t.values||l===wg),p=t.values||Cg(f,h);return c&&(s.rem=c),l===wg?(d&&p.length>d?(n.dataflow.warn("Symbol legend count exceeds limit, filtering items."),c=p.slice(0,d-1),a=!0):c=p,tt(i=t.size)?(t.values||0!==f(c[0])||(c=c.slice(1)),o=c.reduce(((n,e)=>Math.max(n,i(e,t))),0)):i=at(o=i||8),c=c.map(((n,e)=>ea({index:e,label:m(n,e,c),value:n,offset:o,size:i(n,t)}))),a&&c.push(ea({index:c.length,label:`…${p.length-c.length} entries`,value:a=p[c.length],offset:o,size:i(a,t)}))):"gradient"===l?(e=f.domain(),r=mg(f,e[0],_(e)),p.length<3&&!t.values&&e[0]!==_(e)&&(p=[e[0],_(e)]),c=p.map(((t,n)=>ea({index:n,label:m(t,n,p),value:t,perc:r(t)})))):(i=p.length-1,r=function(t){const n=t.domain(),e=n.length-1;let r=+n[0],i=+_(n),o=i-r;if(t.type===Pp){const t=e?o/e:.1;r-=t,i+=t,o=i-r}return t=>(t-r)/o}(f),c=p.map(((t,n)=>ea({index:n,label:m(t,n,p),value:t,perc:n?r(t):0,perc2:n===i?1:r(p[n+1])})))),s.source=c,s.add=c,this.value=c,s}});const q$=t=>t.source.x,U$=t=>t.source.y,W$=t=>t.target.x,H$=t=>t.target.y;function G$(t){Oa.call(this,{},t)}G$.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"}]},pt(G$,Oa,{transform(t,n){var e=t.sourceX||q$,r=t.sourceY||U$,i=t.targetX||W$,o=t.targetY||H$,a=t.as||"path",u=t.shape||"line",s=J$.get(u+"-"+(t.orient||"vertical"))||J$.get(u);return s||p("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,(t=>{t[a]=s(e(t),r(t),i(t),o(t))})),n.reflow(t.modified()).modifies(a)}});const Y$=(t,n,e,r)=>"M"+t+","+n+"L"+e+","+r,V$=(t,n,e,r)=>{var i=e-t,o=r-n,a=Math.hypot(i,o)/2;return"M"+t+","+n+"A"+a+","+a+" "+180*Math.atan2(o,i)/Math.PI+" 0 1 "+e+","+r},X$=(t,n,e,r)=>{const i=e-t,o=r-n,a=.2*(i+o),u=.2*(o-i);return"M"+t+","+n+"C"+(t+a)+","+(n+u)+" "+(e+u)+","+(r-a)+" "+e+","+r},J$=ht({line:Y$,"line-radial":(t,n,e,r)=>Y$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),arc:V$,"arc-radial":(t,n,e,r)=>V$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),curve:X$,"curve-radial":(t,n,e,r)=>X$(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e)),"orthogonal-horizontal":(t,n,e,r)=>"M"+t+","+n+"V"+r+"H"+e,"orthogonal-vertical":(t,n,e,r)=>"M"+t+","+n+"H"+e+"V"+r,"orthogonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e);return"M"+n*i+","+n*o+"A"+n+","+n+" 0 0,"+((Math.abs(e-t)>Math.PI?e<=t:e>t)?1:0)+" "+n*a+","+n*u+"L"+r*a+","+r*u},"diagonal-horizontal":(t,n,e,r)=>{const i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":(t,n,e,r)=>{const i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":(t,n,e,r)=>{const i=Math.cos(t),o=Math.sin(t),a=Math.cos(e),u=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*o+"C"+s*i+","+s*o+" "+s*a+","+s*u+" "+r*a+","+r*u}});function K$(t){Oa.call(this,null,t)}function Q$(t){return ig(t)&&t!==_p}K$.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"]}]},pt(K$,Oa,{transform(t,n){var e,r,i,o=t.as||["startAngle","endAngle"],a=o[0],u=o[1],s=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,l=n.source,f=l.map(t.field||x),d=f.length,h=s,m=(c-s)/Nn(f),p=En(d);for(t.sort&&p.sort(((t,n)=>f[t]-f[n])),e=0;e<d;++e)i=f[p[e]],(r=l[p[e]])[a]=h,r[u]=h+=i*m;return this.value=f,n.reflow(t.modified()).modifies(o)}});const Z$=Bt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function tk(t){Oa.call(this,null,t),this.modified(!0)}function nk(t,n,e){return ug(t)&&Math.abs(n.reduce(((t,n)=>t+(n<0?-1:n>0?1:0)),0))!==n.length&&e.warn("Log scale domain includes zero: "+Nt(n)),n}function ek(t,n,e){return tt(t)&&(n||e)?fg(t,rk(n||[0,1],e)):t}function rk(t,n){return n?t.slice().reverse():t}function ik(t){Oa.call(this,null,t)}pt(tk,Oa,{transform(t,n){var e=n.dataflow,r=this.value,i=function(t){var n,e=t.type,r="";return e===_p?_p+"-"+Dp:(function(t){const n=t.type;return ig(n)&&n!==Cp&&n!==Op&&(t.scheme||t.range&&t.range.length&&t.range.every($t))}(t)&&(r=2===(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0)?_p+"-":3===n?zp+"-":""),(r+e||Dp).toLowerCase())}(t);for(i in r&&i===r.type||(this.value=r=ng(i)()),t)if(!Z$[i]){if("padding"===i&&Q$(r.type))continue;tt(r[i])?r[i](t[i]):e.warn("Unsupported scale property: "+i)}return function(t,n,e){var r=t.type,i=n.round||!1,o=n.range;if(null!=n.rangeStep)o=function(t,n,e){return t!==Lp&&t!==Rp&&p("Only band and point scales support rangeStep."),[0,n.rangeStep*Ap(e,t===Rp?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0,(null!=n.paddingOuter?n.paddingOuter:n.padding)||0)]}(r,n,e);else if(n.scheme&&(o=function(t,n,e){var r,i=n.schemeExtent;return S(n.scheme)?r=dg(n.scheme,n.interpolate,n.interpolateGamma):(r=bg(n.scheme.toLowerCase()))||p(`Unrecognized scheme name: ${n.scheme}`),e=t===Pp?e+1:t===Ip?e-1:t===Bp||t===Tp?+n.schemeCount||5:e,sg(t)?ek(r,i,n.reverse):tt(r)?hg(ek(r,i),e):t===jp?r:r.slice(0,e)}(r,n,e),tt(o))){if(t.interpolator)return t.interpolator(o);p(`Scale type ${r} does not support interpolating color schemes.`)}if(o&&sg(r))return t.interpolator(dg(rk(o,n.reverse),n.interpolate,n.interpolateGamma));o&&n.interpolate&&t.interpolate?t.interpolate(pg(n.interpolate,n.interpolateGamma)):tt(t.round)?t.round(i):tt(t.rangeRound)&&t.interpolate(i?Kf:Jf),o&&t.range(rk(o,n.reverse))}(r,t,function(t,n,e){let r=n.bins;if(r&&!S(r)){const n=t.domain(),e=n[0],i=_(n),o=r.step;let a=null==r.start?e:r.start,u=null==r.stop?i:r.stop;o||p("Scale bins parameter missing step property."),a<e&&(a=o*Math.ceil(e/o)),u>i&&(u=o*Math.floor(i/o)),r=En(a,u+o/2,o)}return r?t.bins=r:t.bins&&delete t.bins,t.type===Ip&&(r?n.domain||n.domainRaw||(t.domain(r),e=r.length):t.bins=t.domain()),e}(r,t,function(t,n,e){const r=function(t,n,e){return n?(t.domain(nk(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,o,a=n.domain,u=t.type,s=n.zero||void 0===n.zero&&function(t){const n=t.type;return!t.bins&&(n===Dp||n===Fp||n===Ep)}(t);if(!a)return 0;if((s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(a=a.slice()).length-1||1,s&&(a[0]>0&&(a[0]=0),a[i]<0&&(a[i]=0)),null!=n.domainMin&&(a[0]=n.domainMin),null!=n.domainMax&&(a[i]=n.domainMax),null!=n.domainMid)){const t=(o=n.domainMid)>a[i]?i+1:o<a[0]?0:i;t!==i&&e.warn("Scale domainMid exceeds domain min or max.",o),a.splice(t,0,o)}return Q$(u)&&n.padding&&a[0]!==_(a)&&(a=function(t,n,e,r,i,o){var a=Math.abs(_(e)-e[0]),u=a/(a-2*r),s=t===Sp?Y(n,null,u):t===Ep?V(n,null,u,.5):t===Fp?V(n,null,u,i||1):t===Np?X(n,null,u,o||1):G(n,null,u);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(u,a,n.range,n.padding,n.exponent,n.constant)),t.domain(nk(u,a,e)),u===jp&&t.unknown(n.domainImplicit?vl:void 0),n.nice&&t.nice&&t.nice(!0!==n.nice&&Mg(t,n.nice)||null),a.length}(r,t,e))),n.fork(n.NO_SOURCE|n.NO_FIELDS)}}),pt(ik,Oa,{transform(t,n){const e=t.modified("sort")||n.changed(n.ADD)||n.modified(t.sort.fields)||n.modified("datum");return e&&n.source.sort(aa(t.sort)),this.modified(e),n}});const ok="zero",ak="center",uk="normalize",sk=["y0","y1"];function ck(t){Oa.call(this,null,t)}function lk(t,n,e,r,i){for(var o,a=(n-t.sum)/2,u=t.length,s=0;s<u;++s)(o=t[s])[r]=a,o[i]=a+=Math.abs(e(o))}function fk(t,n,e,r,i){for(var o,a=1/t.sum,u=0,s=t.length,c=0,l=0;c<s;++c)(o=t[c])[r]=u,o[i]=u=a*(l+=Math.abs(e(o)))}function dk(t,n,e,r,i){for(var o,a,u=0,s=0,c=t.length,l=0;l<c;++l)(o=+e(a=t[l]))<0?(a[r]=s,a[i]=s+=o):(a[r]=u,a[i]=u+=o)}ck.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:ok,values:[ok,ak,uk]},{name:"as",type:"string",array:!0,length:2,default:sk}]},pt(ck,Oa,{transform(t,n){var e,r,i,o,a=t.as||sk,u=a[0],s=a[1],c=aa(t.sort),l=t.field||x,f=t.offset===ak?lk:t.offset===uk?fk:dk;for(e=function(t,n,e,r){var i,o,a,u,s,c,l,f,d,h=[],m=t=>t(s);if(null==n)h.push(t.slice());else for(i={},o=0,a=t.length;o<a;++o)s=t[o],(l=i[c=n.map(m)])||(i[c]=l=[],h.push(l)),l.push(s);for(c=0,d=0,u=h.length;c<u;++c){for(o=0,f=0,a=(l=h[c]).length;o<a;++o)f+=Math.abs(r(l[o]));l.sum=f,f>d&&(d=f),e&&l.sort(e)}return h.max=d,h}(n.source,t.groupby,c,l),r=0,i=e.length,o=e.max;r<i;++r)f(e[r],o,l,u,s);return n.reflow(t.modified()).modifies(a)}});var hk=Object.freeze({__proto__:null,axisticks:P$,datajoin:j$,encode:L$,legendentries:I$,linkpath:G$,pie:K$,scale:tk,sortitems:ik,stack:ck}),mk=1e-6,pk=1e-12,gk=Math.PI,vk=gk/2,yk=gk/4,bk=2*gk,wk=180/gk,xk=gk/180,$k=Math.abs,kk=Math.atan,Mk=Math.atan2,Ak=Math.cos,Dk=Math.ceil,Sk=Math.exp,Fk=Math.hypot,Ek=Math.log,Nk=Math.pow,Ck=Math.sin,Ok=Math.sign||function(t){return t>0?1:t<0?-1:0},_k=Math.sqrt,zk=Math.tan;function Bk(t){return t>1?0:t<-1?gk:Math.acos(t)}function Tk(t){return t>1?vk:t<-1?-vk:Math.asin(t)}function Pk(){}function jk(t,n){t&&Lk.hasOwnProperty(t.type)&&Lk[t.type](t,n)}var Rk={Feature:function(t,n){jk(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)jk(e[r].geometry,n)}},Lk={Sphere:function(t,n){n.sphere()},Point:function(t,n){n.point((t=t.coordinates)[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)n.point((t=e[r])[0],t[1],t[2])},LineString:function(t,n){Ik(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Ik(e[r],n,0)},Polygon:function(t,n){qk(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)qk(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)jk(e[r],n)}};function Ik(t,n,e){var r,i=-1,o=t.length-e;for(n.lineStart();++i<o;)n.point((r=t[i])[0],r[1],r[2]);n.lineEnd()}function qk(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)Ik(t[e],n,1);n.polygonEnd()}function Uk(t,n){t&&Rk.hasOwnProperty(t.type)?Rk[t.type](t,n):jk(t,n)}var Wk,Hk,Gk,Yk,Vk,Xk,Jk,Kk,Qk,Zk,tM,nM,eM,rM,iM,oM,aM=new an,uM=new an,sM={point:Pk,lineStart:Pk,lineEnd:Pk,polygonStart:function(){aM=new an,sM.lineStart=cM,sM.lineEnd=lM},polygonEnd:function(){var t=+aM;uM.add(t<0?bk+t:t),this.lineStart=this.lineEnd=this.point=Pk},sphere:function(){uM.add(bk)}};function cM(){sM.point=fM}function lM(){dM(Wk,Hk)}function fM(t,n){sM.point=dM,Wk=t,Hk=n,Gk=t*=xk,Yk=Ak(n=(n*=xk)/2+yk),Vk=Ck(n)}function dM(t,n){var e=(t*=xk)-Gk,r=e>=0?1:-1,i=r*e,o=Ak(n=(n*=xk)/2+yk),a=Ck(n),u=Vk*a,s=Yk*o+u*Ak(i),c=u*r*Ck(i);aM.add(Mk(c,s)),Gk=t,Yk=o,Vk=a}function hM(t){return[Mk(t[1],t[0]),Tk(t[2])]}function mM(t){var n=t[0],e=t[1],r=Ak(e);return[r*Ak(n),r*Ck(n),Ck(e)]}function pM(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function gM(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function vM(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function yM(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function bM(t){var n=_k(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var wM,xM,$M,kM,MM,AM,DM,SM,FM,EM,NM,CM,OM,_M,zM,BM,TM={point:PM,lineStart:RM,lineEnd:LM,polygonStart:function(){TM.point=IM,TM.lineStart=qM,TM.lineEnd=UM,rM=new an,sM.polygonStart()},polygonEnd:function(){sM.polygonEnd(),TM.point=PM,TM.lineStart=RM,TM.lineEnd=LM,aM<0?(Xk=-(Kk=180),Jk=-(Qk=90)):rM>mk?Qk=90:rM<-1e-6&&(Jk=-90),oM[0]=Xk,oM[1]=Kk},sphere:function(){Xk=-(Kk=180),Jk=-(Qk=90)}};function PM(t,n){iM.push(oM=[Xk=t,Kk=t]),n<Jk&&(Jk=n),n>Qk&&(Qk=n)}function jM(t,n){var e=mM([t*xk,n*xk]);if(eM){var r=gM(eM,e),i=gM([r[1],-r[0],0],r);bM(i),i=hM(i);var o,a=t-Zk,u=a>0?1:-1,s=i[0]*wk*u,c=$k(a)>180;c^(u*Zk<s&&s<u*t)?(o=i[1]*wk)>Qk&&(Qk=o):c^(u*Zk<(s=(s+360)%360-180)&&s<u*t)?(o=-i[1]*wk)<Jk&&(Jk=o):(n<Jk&&(Jk=n),n>Qk&&(Qk=n)),c?t<Zk?WM(Xk,t)>WM(Xk,Kk)&&(Kk=t):WM(t,Kk)>WM(Xk,Kk)&&(Xk=t):Kk>=Xk?(t<Xk&&(Xk=t),t>Kk&&(Kk=t)):t>Zk?WM(Xk,t)>WM(Xk,Kk)&&(Kk=t):WM(t,Kk)>WM(Xk,Kk)&&(Xk=t)}else iM.push(oM=[Xk=t,Kk=t]);n<Jk&&(Jk=n),n>Qk&&(Qk=n),eM=e,Zk=t}function RM(){TM.point=jM}function LM(){oM[0]=Xk,oM[1]=Kk,TM.point=PM,eM=null}function IM(t,n){if(eM){var e=t-Zk;rM.add($k(e)>180?e+(e>0?360:-360):e)}else tM=t,nM=n;sM.point(t,n),jM(t,n)}function qM(){sM.lineStart()}function UM(){IM(tM,nM),sM.lineEnd(),$k(rM)>mk&&(Xk=-(Kk=180)),oM[0]=Xk,oM[1]=Kk,eM=null}function WM(t,n){return(n-=t)<0?n+360:n}function HM(t,n){return t[0]-n[0]}function GM(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var YM={sphere:Pk,point:VM,lineStart:JM,lineEnd:ZM,polygonStart:function(){YM.lineStart=tA,YM.lineEnd=nA},polygonEnd:function(){YM.lineStart=JM,YM.lineEnd=ZM}};function VM(t,n){t*=xk;var e=Ak(n*=xk);XM(e*Ak(t),e*Ck(t),Ck(n))}function XM(t,n,e){++wM,$M+=(t-$M)/wM,kM+=(n-kM)/wM,MM+=(e-MM)/wM}function JM(){YM.point=KM}function KM(t,n){t*=xk;var e=Ak(n*=xk);_M=e*Ak(t),zM=e*Ck(t),BM=Ck(n),YM.point=QM,XM(_M,zM,BM)}function QM(t,n){t*=xk;var e=Ak(n*=xk),r=e*Ak(t),i=e*Ck(t),o=Ck(n),a=Mk(_k((a=zM*o-BM*i)*a+(a=BM*r-_M*o)*a+(a=_M*i-zM*r)*a),_M*r+zM*i+BM*o);xM+=a,AM+=a*(_M+(_M=r)),DM+=a*(zM+(zM=i)),SM+=a*(BM+(BM=o)),XM(_M,zM,BM)}function ZM(){YM.point=VM}function tA(){YM.point=eA}function nA(){rA(CM,OM),YM.point=VM}function eA(t,n){CM=t,OM=n,t*=xk,n*=xk,YM.point=rA;var e=Ak(n);_M=e*Ak(t),zM=e*Ck(t),BM=Ck(n),XM(_M,zM,BM)}function rA(t,n){t*=xk;var e=Ak(n*=xk),r=e*Ak(t),i=e*Ck(t),o=Ck(n),a=zM*o-BM*i,u=BM*r-_M*o,s=_M*i-zM*r,c=Fk(a,u,s),l=Tk(c),f=c&&-l/c;FM.add(f*a),EM.add(f*u),NM.add(f*s),xM+=l,AM+=l*(_M+(_M=r)),DM+=l*(zM+(zM=i)),SM+=l*(BM+(BM=o)),XM(_M,zM,BM)}function iA(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function oA(t,n){return $k(t)>gk&&(t-=Math.round(t/bk)*bk),[t,n]}function aA(t,n,e){return(t%=bk)?n||e?iA(sA(t),cA(n,e)):sA(t):n||e?cA(n,e):oA}function uA(t){return function(n,e){return $k(n+=t)>gk&&(n-=Math.round(n/bk)*bk),[n,e]}}function sA(t){var n=uA(t);return n.invert=uA(-t),n}function cA(t,n){var e=Ak(t),r=Ck(t),i=Ak(n),o=Ck(n);function a(t,n){var a=Ak(n),u=Ak(t)*a,s=Ck(t)*a,c=Ck(n),l=c*e+u*r;return[Mk(s*i-l*o,u*e-c*r),Tk(l*i+s*o)]}return a.invert=function(t,n){var a=Ak(n),u=Ak(t)*a,s=Ck(t)*a,c=Ck(n),l=c*i-s*o;return[Mk(s*i+c*o,u*e+l*r),Tk(l*e-u*r)]},a}function lA(t,n){(n=mM(n))[0]-=t,bM(n);var e=Bk(-n[1]);return((-n[2]<0?-e:e)+bk-mk)%bk}function fA(){var t,n=[];return{point:function(n,e,r){t.push([n,e,r])},lineStart:function(){n.push(t=[])},lineEnd:Pk,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function dA(t,n){return $k(t[0]-n[0])<mk&&$k(t[1]-n[1])<mk}function hA(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function mA(t,n,e,r,i){var o,a,u=[],s=[];if(t.forEach((function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],a=t[n];if(dA(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<n;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}u.push(e=new hA(r,t,null,!0)),s.push(e.o=new hA(r,null,e,!1)),u.push(e=new hA(a,t,null,!1)),s.push(e.o=new hA(a,null,e,!0))}})),u.length){for(s.sort(n),pA(u),pA(s),o=0,a=s.length;o<a;++o)s[o].e=e=!e;for(var c,l,f=u[0];;){for(var d=f,h=!0;d.v;)if((d=d.n)===f)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,a=c.length;o<a;++o)i.point((l=c[o])[0],l[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(o=(c=d.p.z).length-1;o>=0;--o)i.point((l=c[o])[0],l[1]);else r(d.x,d.p.x,-1,i);d=d.p}c=(d=d.o).z,h=!h}while(!d.v);i.lineEnd()}}}function pA(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}function gA(t){return $k(t[0])<=gk?t[0]:Ok(t[0])*(($k(t[0])+gk)%bk-gk)}function vA(t,n,e,r){return function(i){var o,a,u,s=n(i),c=fA(),l=n(c),f=!1,d={point:h,lineStart:p,lineEnd:g,polygonStart:function(){d.point=v,d.lineStart=y,d.lineEnd=b,a=[],o=[]},polygonEnd:function(){d.point=h,d.lineStart=p,d.lineEnd=g,a=Fn(a);var t=function(t,n){var e=gA(n),r=n[1],i=Ck(r),o=[Ck(e),-Ak(e),0],a=0,u=0,s=new an;1===i?r=vk+mk:-1===i&&(r=-vk-mk);for(var c=0,l=t.length;c<l;++c)if(d=(f=t[c]).length)for(var f,d,h=f[d-1],m=gA(h),p=h[1]/2+yk,g=Ck(p),v=Ak(p),y=0;y<d;++y,m=w,g=$,v=k,h=b){var b=f[y],w=gA(b),x=b[1]/2+yk,$=Ck(x),k=Ak(x),M=w-m,A=M>=0?1:-1,D=A*M,S=D>gk,F=g*$;if(s.add(Mk(F*A*Ck(D),v*k+F*Ak(D))),a+=S?M+A*bk:M,S^m>=e^w>=e){var E=gM(mM(h),mM(b));bM(E);var N=gM(o,E);bM(N);var C=(S^M>=0?-1:1)*Tk(N[2]);(r>C||r===C&&(E[0]||E[1]))&&(u+=S^M>=0?1:-1)}}return(a<-1e-6||a<mk&&s<-1e-12)^1&u}(o,r);a.length?(f||(i.polygonStart(),f=!0),mA(a,bA,t,e,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(n,e){t(n,e)&&i.point(n,e)}function m(t,n){s.point(t,n)}function p(){d.point=m,s.lineStart()}function g(){d.point=h,s.lineEnd()}function v(t,n){u.push([t,n]),l.point(t,n)}function y(){l.lineStart(),u=[]}function b(){v(u[0][0],u[0][1]),l.lineEnd();var t,n,e,r,s=l.clean(),d=c.result(),h=d.length;if(u.pop(),o.push(u),u=null,h)if(1&s){if((n=(e=d[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else h>1&&2&s&&d.push(d.pop().concat(d.shift())),a.push(d.filter(yA))}return d}}function yA(t){return t.length>1}function bA(t,n){return((t=t.x)[0]<0?t[1]-vk-mk:vk-t[1])-((n=n.x)[0]<0?n[1]-vk-mk:vk-n[1])}oA.invert=oA;var wA=vA((function(){return!0}),(function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(o,a){var u=o>0?gk:-gk,s=$k(o-e);$k(s-gk)<mk?(t.point(e,r=(r+a)/2>0?vk:-vk),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),t.point(o,r),n=0):i!==u&&s>=gk&&($k(e-i)<mk&&(e-=i*mk),$k(o-u)<mk&&(o-=u*mk),r=function(t,n,e,r){var i,o,a=Ck(t-e);return $k(a)>mk?kk((Ck(n)*(o=Ak(r))*Ck(e)-Ck(r)*(i=Ak(n))*Ck(t))/(i*o*a)):(n+r)/2}(e,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(u,r),n=0),t.point(e=o,r=a),i=u},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}}),(function(t,n,e,r){var i;if(null==t)r.point(-gk,i=e*vk),r.point(0,i),r.point(gk,i),r.point(gk,0),r.point(gk,-i),r.point(0,-i),r.point(-gk,-i),r.point(-gk,0),r.point(-gk,i);else if($k(t[0]-n[0])>mk){var o=t[0]<n[0]?gk:-gk;r.point(-o,i=e*o/2),r.point(0,i),r.point(o,i)}else r.point(n[0],n[1])}),[-gk,-vk]);var xA=1e9,$A=-1e9;function kA(t,n,e,r){function i(i,o){return t<=i&&i<=e&&n<=o&&o<=r}function o(i,o,u,c){var l=0,f=0;if(null==i||(l=a(i,u))!==(f=a(o,u))||s(i,o)<0^u>0)do{c.point(0===l||3===l?t:e,l>1?r:n)}while((l=(l+u+4)%4)!==f);else c.point(o[0],o[1])}function a(r,i){return $k(r[0]-t)<mk?i>0?0:3:$k(r[0]-e)<mk?i>0?2:1:$k(r[1]-n)<mk?i>0?1:0:i>0?3:2}function u(t,n){return s(t.x,n.x)}function s(t,n){var e=a(t,1),r=a(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(a){var s,c,l,f,d,h,m,p,g,v,y,b=a,w=fA(),x={point:$,lineStart:function(){x.point=k,c&&c.push(l=[]),v=!0,g=!1,m=p=NaN},lineEnd:function(){s&&(k(f,d),h&&g&&w.rejoin(),s.push(w.result())),x.point=$,g&&b.lineEnd()},polygonStart:function(){b=w,s=[],c=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=c.length;e<i;++e)for(var o,a,u=c[e],s=1,l=u.length,f=u[0],d=f[0],h=f[1];s<l;++s)o=d,a=h,d=(f=u[s])[0],h=f[1],a<=r?h>r&&(d-o)*(r-a)>(h-a)*(t-o)&&++n:h<=r&&(d-o)*(r-a)<(h-a)*(t-o)&&--n;return n}(),e=y&&n,i=(s=Fn(s)).length;(e||i)&&(a.polygonStart(),e&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&mA(s,u,n,o,a),a.polygonEnd()),b=a,s=c=l=null}};function $(t,n){i(t,n)&&b.point(t,n)}function k(o,a){var u=i(o,a);if(c&&l.push([o,a]),v)f=o,d=a,h=u,v=!1,u&&(b.lineStart(),b.point(o,a));else if(u&&g)b.point(o,a);else{var s=[m=Math.max($A,Math.min(xA,m)),p=Math.max($A,Math.min(xA,p))],w=[o=Math.max($A,Math.min(xA,o)),a=Math.max($A,Math.min(xA,a))];!function(t,n,e,r,i,o){var a,u=t[0],s=t[1],c=0,l=1,f=n[0]-u,d=n[1]-s;if(a=e-u,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=i-u,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=r-s,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<l&&(l=a)}else if(d>0){if(a>l)return;a>c&&(c=a)}if(a=o-s,d||!(a<0)){if(a/=d,d<0){if(a>l)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<l&&(l=a)}return c>0&&(t[0]=u+c*f,t[1]=s+c*d),l<1&&(n[0]=u+l*f,n[1]=s+l*d),!0}}}}}(s,w,t,n,e,r)?u&&(b.lineStart(),b.point(o,a),y=!1):(g||(b.lineStart(),b.point(s[0],s[1])),b.point(w[0],w[1]),u||b.lineEnd(),y=!1)}m=o,p=a,g=u}return x}}function MA(t,n,e){var r=En(t,n-mk,e).concat(n);return function(t){return r.map((function(n){return[t,n]}))}}function AA(t,n,e){var r=En(t,n-mk,e).concat(n);return function(t){return r.map((function(n){return[n,t]}))}}var DA,SA,FA,EA,NA=t=>t,CA=new an,OA=new an,_A={point:Pk,lineStart:Pk,lineEnd:Pk,polygonStart:function(){_A.lineStart=zA,_A.lineEnd=PA},polygonEnd:function(){_A.lineStart=_A.lineEnd=_A.point=Pk,CA.add($k(OA)),OA=new an},result:function(){var t=CA/2;return CA=new an,t}};function zA(){_A.point=BA}function BA(t,n){_A.point=TA,DA=FA=t,SA=EA=n}function TA(t,n){OA.add(EA*t-FA*n),FA=t,EA=n}function PA(){TA(DA,SA)}var jA,RA,LA,IA,qA=1/0,UA=qA,WA=-qA,HA=WA,GA={point:function(t,n){t<qA&&(qA=t),t>WA&&(WA=t),n<UA&&(UA=n),n>HA&&(HA=n)},lineStart:Pk,lineEnd:Pk,polygonStart:Pk,polygonEnd:Pk,result:function(){var t=[[qA,UA],[WA,HA]];return WA=HA=-(UA=qA=1/0),t}},YA=0,VA=0,XA=0,JA=0,KA=0,QA=0,ZA=0,tD=0,nD=0,eD={point:rD,lineStart:iD,lineEnd:uD,polygonStart:function(){eD.lineStart=sD,eD.lineEnd=cD},polygonEnd:function(){eD.point=rD,eD.lineStart=iD,eD.lineEnd=uD},result:function(){var t=nD?[ZA/nD,tD/nD]:QA?[JA/QA,KA/QA]:XA?[YA/XA,VA/XA]:[NaN,NaN];return YA=VA=XA=JA=KA=QA=ZA=tD=nD=0,t}};function rD(t,n){YA+=t,VA+=n,++XA}function iD(){eD.point=oD}function oD(t,n){eD.point=aD,rD(LA=t,IA=n)}function aD(t,n){var e=t-LA,r=n-IA,i=_k(e*e+r*r);JA+=i*(LA+t)/2,KA+=i*(IA+n)/2,QA+=i,rD(LA=t,IA=n)}function uD(){eD.point=rD}function sD(){eD.point=lD}function cD(){fD(jA,RA)}function lD(t,n){eD.point=fD,rD(jA=LA=t,RA=IA=n)}function fD(t,n){var e=t-LA,r=n-IA,i=_k(e*e+r*r);JA+=i*(LA+t)/2,KA+=i*(IA+n)/2,QA+=i,ZA+=(i=IA*t-LA*n)*(LA+t),tD+=i*(IA+n),nD+=3*i,rD(LA=t,IA=n)}function dD(t){this._context=t}dD.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,bk)}},result:Pk};var hD,mD,pD,gD,vD,yD=new an,bD={point:Pk,lineStart:function(){bD.point=wD},lineEnd:function(){hD&&xD(mD,pD),bD.point=Pk},polygonStart:function(){hD=!0},polygonEnd:function(){hD=null},result:function(){var t=+yD;return yD=new an,t}};function wD(t,n){bD.point=xD,mD=gD=t,pD=vD=n}function xD(t,n){yD.add(_k((gD-=t)*gD+(vD-=n)*vD)),gD=t,vD=n}let $D,kD,MD,AD;class DD{constructor(t){this._append=null==t?SD:function(t){const n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);if(n>15)return SD;if(n!==$D){const t=10**n;$D=n,kD=function(n){let e=1;this._+=n[0];for(const r=n.length;e<r;++e)this._+=Math.round(arguments[e]*t)/t+n[e]}}return kD}(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,n){switch(this._point){case 0:this._append`M${t},${n}`,this._point=1;break;case 1:this._append`L${t},${n}`;break;default:if(this._append`M${t},${n}`,this._radius!==MD||this._append!==kD){const t=this._radius,n=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`,MD=t,kD=this._append,AD=this._,this._=n}this._+=AD}}result(){const t=this._;return this._="",t.length?t:null}}function SD(t){let n=1;this._+=t[0];for(const e=t.length;n<e;++n)this._+=arguments[n]+t[n]}function FD(t,n){let e,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Uk(t,e(r))),r.result()}return a.area=function(t){return Uk(t,e(_A)),_A.result()},a.measure=function(t){return Uk(t,e(bD)),bD.result()},a.bounds=function(t){return Uk(t,e(GA)),GA.result()},a.centroid=function(t){return Uk(t,e(eD)),eD.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,NA):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new DD(i)):new dD(n=t),"function"!=typeof o&&r.pointRadius(o),a):n},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 n=Math.floor(t);if(!(n>=0))throw new RangeError(`invalid digits: ${t}`);i=n}return null===n&&(r=new DD(i)),a},a.projection(t).digits(i).context(n)}function ED(t){return function(n){var e=new ND;for(var r in t)e[r]=t[r];return e.stream=n,e}}function ND(){}function CD(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Uk(e,t.stream(GA)),n(GA.result()),null!=r&&t.clipExtent(r),t}function OD(t,n,e){return CD(t,(function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],o=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),a=+n[0][0]+(r-o*(e[1][0]+e[0][0]))/2,u=+n[0][1]+(i-o*(e[1][1]+e[0][1]))/2;t.scale(150*o).translate([a,u])}),e)}function _D(t,n,e){return OD(t,[[0,0],n],e)}function zD(t,n,e){return CD(t,(function(e){var r=+n,i=r/(e[1][0]-e[0][0]),o=(r-i*(e[1][0]+e[0][0]))/2,a=-i*e[0][1];t.scale(150*i).translate([o,a])}),e)}function BD(t,n,e){return CD(t,(function(e){var r=+n,i=r/(e[1][1]-e[0][1]),o=-i*e[0][0],a=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([o,a])}),e)}ND.prototype={constructor:ND,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var TD=Ak(30*xk);function PD(t,n){return+n?function(t,n){function e(r,i,o,a,u,s,c,l,f,d,h,m,p,g){var v=c-r,y=l-i,b=v*v+y*y;if(b>4*n&&p--){var w=a+d,x=u+h,$=s+m,k=_k(w*w+x*x+$*$),M=Tk($/=k),A=$k($k($)-1)<mk||$k(o-f)<mk?(o+f)/2:Mk(x,w),D=t(A,M),S=D[0],F=D[1],E=S-r,N=F-i,C=y*E-v*N;(C*C/b>n||$k((v*E+y*N)/b-.5)>.3||a*d+u*h+s*m<TD)&&(e(r,i,o,a,u,s,S,F,A,w/=k,x/=k,$,p,g),g.point(S,F),e(S,F,A,w,x,$,c,l,f,d,h,m,p,g))}}return function(n){var r,i,o,a,u,s,c,l,f,d,h,m,p={point:g,lineStart:v,lineEnd:b,polygonStart:function(){n.polygonStart(),p.lineStart=w},polygonEnd:function(){n.polygonEnd(),p.lineStart=v}};function g(e,r){e=t(e,r),n.point(e[0],e[1])}function v(){l=NaN,p.point=y,n.lineStart()}function y(r,i){var o=mM([r,i]),a=t(r,i);e(l,f,c,d,h,m,l=a[0],f=a[1],c=r,d=o[0],h=o[1],m=o[2],16,n),n.point(l,f)}function b(){p.point=g,n.lineEnd()}function w(){v(),p.point=x,p.lineEnd=$}function x(t,n){y(r=t,n),i=l,o=f,a=d,u=h,s=m,p.point=y}function $(){e(l,f,c,d,h,m,i,o,r,a,u,s,16,n),p.lineEnd=b,b()}return p}}(t,n):function(t){return ED({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var jD=ED({point:function(t,n){this.stream.point(t*xk,n*xk)}});function RD(t,n,e,r,i,o){if(!o)return function(t,n,e,r,i){function o(o,a){return[n+t*(o*=r),e-t*(a*=i)]}return o.invert=function(o,a){return[(o-n)/t*r,(e-a)/t*i]},o}(t,n,e,r,i);var a=Ak(o),u=Ck(o),s=a*t,c=u*t,l=a/t,f=u/t,d=(u*e-a*n)/t,h=(u*n+a*e)/t;function m(t,o){return[s*(t*=r)-c*(o*=i)+n,e-c*t-s*o]}return m.invert=function(t,n){return[r*(l*t-f*n+d),i*(h-f*t-l*n)]},m}function LD(t){return ID((function(){return t}))()}function ID(t){var n,e,r,i,o,a,u,s,c,l,f=150,d=480,h=250,m=0,p=0,g=0,v=0,y=0,b=0,w=1,x=1,$=null,k=wA,M=null,A=NA,D=.5;function S(t){return s(t[0]*xk,t[1]*xk)}function F(t){return(t=s.invert(t[0],t[1]))&&[t[0]*wk,t[1]*wk]}function E(){var t=RD(f,0,0,w,x,b).apply(null,n(m,p)),r=RD(f,d-t[0],h-t[1],w,x,b);return e=aA(g,v,y),u=iA(n,r),s=iA(e,u),a=PD(u,D),N()}function N(){return c=l=null,S}return S.stream=function(t){return c&&l===t?c:c=jD(function(t){return ED({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(k(a(A(l=t)))))},S.preclip=function(t){return arguments.length?(k=t,$=void 0,N()):k},S.postclip=function(t){return arguments.length?(A=t,M=r=i=o=null,N()):A},S.clipAngle=function(t){return arguments.length?(k=+t?function(t){var n=Ak(t),e=2*xk,r=n>0,i=$k(n)>mk;function o(t,e){return Ak(t)*Ak(e)>n}function a(t,e,r){var i=[1,0,0],o=gM(mM(t),mM(e)),a=pM(o,o),u=o[0],s=a-u*u;if(!s)return!r&&t;var c=n*a/s,l=-n*u/s,f=gM(i,o),d=yM(i,c);vM(d,yM(o,l));var h=f,m=pM(d,h),p=pM(h,h),g=m*m-p*(pM(d,d)-1);if(!(g<0)){var v=_k(g),y=yM(h,(-m-v)/p);if(vM(y,d),y=hM(y),!r)return y;var b,w=t[0],x=e[0],$=t[1],k=e[1];x<w&&(b=w,w=x,x=b);var M=x-w,A=$k(M-gk)<mk;if(!A&&k<$&&(b=$,$=k,k=b),A||M<mk?A?$+k>0^y[1]<($k(y[0]-w)<mk?$:k):$<=y[1]&&y[1]<=k:M>gk^(w<=y[0]&&y[0]<=x)){var D=yM(h,(-m+v)/p);return vM(D,d),[y,hM(D)]}}}function u(n,e){var i=r?t:gk-t,o=0;return n<-i?o|=1:n>i&&(o|=2),e<-i?o|=4:e>i&&(o|=8),o}return vA(o,(function(t){var n,e,s,c,l;return{lineStart:function(){c=s=!1,l=1},point:function(f,d){var h,m=[f,d],p=o(f,d),g=r?p?0:u(f,d):p?u(f+(f<0?gk:-gk),d):0;if(!n&&(c=s=p)&&t.lineStart(),p!==s&&(!(h=a(n,m))||dA(n,h)||dA(m,h))&&(m[2]=1),p!==s)l=0,p?(t.lineStart(),h=a(m,n),t.point(h[0],h[1])):(h=a(n,m),t.point(h[0],h[1],2),t.lineEnd()),n=h;else if(i&&n&&r^p){var v;g&e||!(v=a(m,n,!0))||(l=0,r?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!p||n&&dA(n,m)||t.point(m[0],m[1]),n=m,s=p,e=g},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return l|(c&&s)<<1}}}),(function(n,r,i,o){!function(t,n,e,r,i,o){if(e){var a=Ak(n),u=Ck(n),s=r*e;null==i?(i=n+r*bk,o=n-s/2):(i=lA(a,i),o=lA(a,o),(r>0?i<o:i>o)&&(i+=r*bk));for(var c,l=i;r>0?l>o:l<o;l-=s)c=hM([a,-u*Ak(l),-u*Ck(l)]),t.point(c[0],c[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-gk,t-gk])}($=t*xk):($=null,wA),N()):$*wk},S.clipExtent=function(t){return arguments.length?(A=null==t?(M=r=i=o=null,NA):kA(M=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),N()):null==M?null:[[M,r],[i,o]]},S.scale=function(t){return arguments.length?(f=+t,E()):f},S.translate=function(t){return arguments.length?(d=+t[0],h=+t[1],E()):[d,h]},S.center=function(t){return arguments.length?(m=t[0]%360*xk,p=t[1]%360*xk,E()):[m*wk,p*wk]},S.rotate=function(t){return arguments.length?(g=t[0]%360*xk,v=t[1]%360*xk,y=t.length>2?t[2]%360*xk:0,E()):[g*wk,v*wk,y*wk]},S.angle=function(t){return arguments.length?(b=t%360*xk,E()):b*wk},S.reflectX=function(t){return arguments.length?(w=t?-1:1,E()):w<0},S.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},S.precision=function(t){return arguments.length?(a=PD(u,D=t*t),N()):_k(D)},S.fitExtent=function(t,n){return OD(S,t,n)},S.fitSize=function(t,n){return _D(S,t,n)},S.fitWidth=function(t,n){return zD(S,t,n)},S.fitHeight=function(t,n){return BD(S,t,n)},function(){return n=t.apply(this,arguments),S.invert=n.invert&&F,E()}}function qD(t){var n=0,e=gk/3,r=ID(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*xk,e=t[1]*xk):[n*wk,e*wk]},i}function UD(t,n){var e=Ck(t),r=(e+Ck(n))/2;if($k(r)<mk)return function(t){var n=Ak(t);function e(t,e){return[t*n,Ck(e)/n]}return e.invert=function(t,e){return[t/n,Tk(e*n)]},e}(t);var i=1+e*(2*r-e),o=_k(i)/r;function a(t,n){var e=_k(i-2*r*Ck(n))/r;return[e*Ck(t*=r),o-e*Ak(t)]}return a.invert=function(t,n){var e=o-n,a=Mk(t,$k(e))*Ok(e);return e*r<0&&(a-=gk*Ok(t)*Ok(e)),[a/r,Tk((i-(t*t+e*e)*r*r)/(2*r))]},a}function WD(){return qD(UD).scale(155.424).center([0,33.6442])}function HD(){return WD().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function GD(t){return function(n,e){var r=Ak(n),i=Ak(e),o=t(r*i);return o===1/0?[2,0]:[o*i*Ck(n),o*Ck(e)]}}function YD(t){return function(n,e){var r=_k(n*n+e*e),i=t(r),o=Ck(i),a=Ak(i);return[Mk(n*o,r*a),Tk(r&&e*o/r)]}}var VD=GD((function(t){return _k(2/(1+t))}));VD.invert=YD((function(t){return 2*Tk(t/2)}));var XD=GD((function(t){return(t=Bk(t))&&t/Ck(t)}));function JD(t,n){return[t,Ek(zk((vk+n)/2))]}function KD(t){var n,e,r,i=LD(t),o=i.center,a=i.scale,u=i.translate,s=i.clipExtent,c=null;function l(){var o=gk*a(),u=i(function(t){function n(n){return(n=t(n[0]*xk,n[1]*xk))[0]*=wk,n[1]*=wk,n}return t=aA(t[0]*xk,t[1]*xk,t.length>2?t[2]*xk:0),n.invert=function(n){return(n=t.invert(n[0]*xk,n[1]*xk))[0]*=wk,n[1]*=wk,n},n}(i.rotate()).invert([0,0]));return s(null==c?[[u[0]-o,u[1]-o],[u[0]+o,u[1]+o]]:t===JD?[[Math.max(u[0]-o,c),n],[Math.min(u[0]+o,e),r]]:[[c,Math.max(u[1]-o,n)],[e,Math.min(u[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),l()):a()},i.translate=function(t){return arguments.length?(u(t),l()):u()},i.center=function(t){return arguments.length?(o(t),l()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=n=e=r=null:(c=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),l()):null==c?null:[[c,n],[e,r]]},l()}function QD(t){return zk((vk+t)/2)}function ZD(t,n){var e=Ak(t),r=t===n?Ck(t):Ek(e/Ak(n))/Ek(QD(n)/QD(t)),i=e*Nk(QD(t),r)/r;if(!r)return JD;function o(t,n){i>0?n<-vk+mk&&(n=-vk+mk):n>vk-mk&&(n=vk-mk);var e=i/Nk(QD(n),r);return[e*Ck(r*t),i-e*Ak(r*t)]}return o.invert=function(t,n){var e=i-n,o=Ok(r)*_k(t*t+e*e),a=Mk(t,$k(e))*Ok(e);return e*r<0&&(a-=gk*Ok(t)*Ok(e)),[a/r,2*kk(Nk(i/o,1/r))-vk]},o}function tS(t,n){return[t,n]}function nS(t,n){var e=Ak(t),r=t===n?Ck(t):(e-Ak(n))/(n-t),i=e/r+t;if($k(r)<mk)return tS;function o(t,n){var e=i-n,o=r*t;return[e*Ck(o),i-e*Ak(o)]}return o.invert=function(t,n){var e=i-n,o=Mk(t,$k(e))*Ok(e);return e*r<0&&(o-=gk*Ok(t)*Ok(e)),[o/r,i-Ok(r)*_k(t*t+e*e)]},o}XD.invert=YD((function(t){return t})),JD.invert=function(t,n){return[t,2*kk(Sk(n))-vk]},tS.invert=tS;var eS=1.340264,rS=-.081106,iS=893e-6,oS=.003796,aS=_k(3)/2;function uS(t,n){var e=Tk(aS*Ck(n)),r=e*e,i=r*r*r;return[t*Ak(e)/(aS*(eS+3*rS*r+i*(7*iS+9*oS*r))),e*(eS+rS*r+i*(iS+oS*r))]}function sS(t,n){var e=Ak(n),r=Ak(t)*e;return[e*Ck(t)/r,Ck(n)/r]}function cS(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function lS(t,n){return[Ak(n)*Ck(t),Ck(n)]}function fS(t,n){var e=Ak(n),r=1+Ak(t)*e;return[e*Ck(t)/r,Ck(n)/r]}function dS(t,n){return[Ek(zk((vk+n)/2)),-t]}uS.invert=function(t,n){for(var e,r=n,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=e=(r*(eS+rS*i+o*(iS+oS*i))-n)/(eS+3*rS*i+o*(7*iS+9*oS*i)))*r)*i*i,!($k(e)<pk));++a);return[aS*t*(eS+3*rS*i+o*(7*iS+9*oS*i))/Ak(r),Tk(Ck(r)/aS)]},sS.invert=YD(kk),cS.invert=function(t,n){var e,r=n,i=25;do{var o=r*r,a=o*o;r-=e=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-n)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while($k(e)>mk&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},lS.invert=YD(Tk),fS.invert=YD((function(t){return 2*kk(t)})),dS.invert=function(t,n){return[-n,2*kk(Sk(t))-vk]};var hS=Math.abs,mS=Math.cos,pS=Math.sin,gS=Math.PI,vS=gS/2,yS=Math.sqrt(2);function bS(t){return t>1?vS:t<-1?-vS:Math.asin(t)}function wS(t,n){var e,r=t*pS(n),i=30;do{n-=e=(n+pS(n)-r)/(1+mS(n))}while(hS(e)>1e-6&&--i>0);return n/2}var xS=function(t,n,e){function r(r,i){return[t*r*mS(i=wS(e,i)),n*pS(i)]}return r.invert=function(r,i){return i=bS(i/n),[r/(t*mS(i)),bS((2*i+pS(2*i))/e)]},r}(yS/vS,yS,gS);const $S=FD(),kS=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function MS(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(DS[t]=function(t,n){return function e(){const r=n();return r.type=t,r.path=FD().projection(r),r.copy=r.copy||function(){const t=e();return kS.forEach((n=>{r[n]&&t[n](r[n]())})),t.path.pointRadius(r.path.pointRadius()),t},Zp(r)}}(t,n),this):DS[t]||null}function AS(t){return t&&t.path||$S}const DS={albers:HD,albersusa:function(){var t,n,e,r,i,o,a=HD(),u=WD().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=WD().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,n){o=[t,n]}};function l(t){var n=t[0],a=t[1];return o=null,e.point(n,a),o||(r.point(n,a),o)||(i.point(n,a),o)}function f(){return t=n=null,l}return l.invert=function(t){var n=a.scale(),e=a.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?u:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(t)},l.stream=function(e){return t&&n===e?t:(r=[a.stream(n=e),u.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},l.precision=function(t){return arguments.length?(a.precision(t),u.precision(t),s.precision(t),f()):a.precision()},l.scale=function(t){return arguments.length?(a.scale(t),u.scale(.35*t),s.scale(t),l.translate(a.translate())):a.scale()},l.translate=function(t){if(!arguments.length)return a.translate();var n=a.scale(),o=+t[0],l=+t[1];return e=a.translate(t).clipExtent([[o-.455*n,l-.238*n],[o+.455*n,l+.238*n]]).stream(c),r=u.translate([o-.307*n,l+.201*n]).clipExtent([[o-.425*n+mk,l+.12*n+mk],[o-.214*n-mk,l+.234*n-mk]]).stream(c),i=s.translate([o-.205*n,l+.212*n]).clipExtent([[o-.214*n+mk,l+.166*n+mk],[o-.115*n-mk,l+.234*n-mk]]).stream(c),f()},l.fitExtent=function(t,n){return OD(l,t,n)},l.fitSize=function(t,n){return _D(l,t,n)},l.fitWidth=function(t,n){return zD(l,t,n)},l.fitHeight=function(t,n){return BD(l,t,n)},l.scale(1070)},azimuthalequalarea:function(){return LD(VD).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return LD(XD).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return qD(ZD).scale(109.5).parallels([30,30])},conicequalarea:WD,conicequidistant:function(){return qD(nS).scale(131.154).center([0,13.9389])},equalEarth:function(){return LD(uS).scale(177.158)},equirectangular:function(){return LD(tS).scale(152.63)},gnomonic:function(){return LD(sS).scale(144.049).clipAngle(60)},identity:function(){var t,n,e,r,i,o,a,u=1,s=0,c=0,l=1,f=1,d=0,h=null,m=1,p=1,g=ED({point:function(t,n){var e=b([t,n]);this.stream.point(e[0],e[1])}}),v=NA;function y(){return m=u*l,p=u*f,o=a=null,b}function b(e){var r=e[0]*m,i=e[1]*p;if(d){var o=i*t-r*n;r=r*t+i*n,i=o}return[r+s,i+c]}return b.invert=function(e){var r=e[0]-s,i=e[1]-c;if(d){var o=i*t+r*n;r=r*t-i*n,i=o}return[r/m,i/p]},b.stream=function(t){return o&&a===t?o:o=g(v(a=t))},b.postclip=function(t){return arguments.length?(v=t,h=e=r=i=null,y()):v},b.clipExtent=function(t){return arguments.length?(v=null==t?(h=e=r=i=null,NA):kA(h=+t[0][0],e=+t[0][1],r=+t[1][0],i=+t[1][1]),y()):null==h?null:[[h,e],[r,i]]},b.scale=function(t){return arguments.length?(u=+t,y()):u},b.translate=function(t){return arguments.length?(s=+t[0],c=+t[1],y()):[s,c]},b.angle=function(e){return arguments.length?(n=Ck(d=e%360*xk),t=Ak(d),y()):d*wk},b.reflectX=function(t){return arguments.length?(l=t?-1:1,y()):l<0},b.reflectY=function(t){return arguments.length?(f=t?-1:1,y()):f<0},b.fitExtent=function(t,n){return OD(b,t,n)},b.fitSize=function(t,n){return _D(b,t,n)},b.fitWidth=function(t,n){return zD(b,t,n)},b.fitHeight=function(t,n){return BD(b,t,n)},b},mercator:function(){return KD(JD).scale(961/bk)},mollweide:function(){return LD(xS).scale(169.529)},naturalEarth1:function(){return LD(cS).scale(175.295)},orthographic:function(){return LD(lS).scale(249.5).clipAngle(90.000001)},stereographic:function(){return LD(fS).scale(250).clipAngle(142)},transversemercator:function(){var t=KD(dS),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(const t in DS)MS(t,DS[t]);function SS(){}const FS=[[],[[[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 ES(){var t=1,n=1,e=a;function r(t,n){return n.map((n=>i(t,n)))}function i(r,i){var a=[],u=[];return function(e,r,i){var a,u,s,c,l,f=[],d=[];for(a=u=-1,FS[(s=e[0]>=r)<<1].forEach(h);++a<t-1;)FS[s|(s=e[a+1]>=r)<<1].forEach(h);for(FS[0|s].forEach(h);++u<n-1;){for(a=-1,FS[(s=e[u*t+t]>=r)<<1|(c=e[u*t]>=r)<<2].forEach(h);++a<t-1;)l=c,FS[s|(s=e[u*t+t+a+1]>=r)<<1|(c=e[u*t+a+1]>=r)<<2|l<<3].forEach(h);FS[s|c<<3].forEach(h)}for(a=-1,FS[(c=e[u*t]>=r)<<2].forEach(h);++a<t-1;)l=c,FS[(c=e[u*t+a+1]>=r)<<2|l<<3].forEach(h);function h(t){var n,e,r=[t[0][0]+a,t[0][1]+u],s=[t[1][0]+a,t[1][1]+u],c=o(r),l=o(s);(n=d[c])?(e=f[l])?(delete d[n.end],delete f[e.start],n===e?(n.ring.push(s),i(n.ring)):f[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(s),d[n.end=l]=n):(n=f[l])?(e=d[c])?(delete f[n.start],delete d[e.end],n===e?(n.ring.push(s),i(n.ring)):f[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete f[n.start],n.ring.unshift(r),f[n.start=c]=n):f[c]=d[l]={start:c,end:l,ring:[r,s]}}FS[c<<3].forEach(h)}(r,i,(t=>{e(t,r,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?a.push([t]):u.push(t)})),u.forEach((t=>{for(var n,e=0,r=a.length;e<r;++e)if(-1!==NS((n=a[e])[0],t))return void n.push(t)})),{type:"MultiPolygon",value:i,coordinates:a}}function o(n){return 2*n[0]+n[1]*(t+1)*4}function a(e,r,i){e.forEach((e=>{var o,a=e[0],u=e[1],s=0|a,c=0|u,l=r[c*t+s];a>0&&a<t&&s===a&&(e[0]=a+(i-(o=r[c*t+s-1]))/(l-o)-.5),u>0&&u<n&&c===u&&(e[1]=u+(i-(o=r[(c-1)*t+s]))/(l-o)-.5)}))}return r.contour=i,r.size=function(e){if(!arguments.length)return[t,n];var i=Math.floor(e[0]),o=Math.floor(e[1]);return i>=0&&o>=0||p("invalid size"),t=i,n=o,r},r.smooth=function(t){return arguments.length?(e=t?a:SS,r):e===a},r}function NS(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=CS(t,n[r]))return e;return 0}function CS(t,n){for(var e=n[0],r=n[1],i=-1,o=0,a=t.length,u=a-1;o<a;u=o++){var s=t[o],c=s[0],l=s[1],f=t[u],d=f[0],h=f[1];if(OS(s,f,n))return 0;l>r!=h>r&&e<(d-c)*(r-l)/(h-l)+c&&(i=-i)}return i}function OS(t,n,e){var r,i,o,a;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=n[r],i<=(o=e[r])&&o<=a||a<=o&&o<=i)}function _S(t,n,e){return function(r){var i=ct(r),o=e?Math.min(i[0],0):i[0],a=i[1],u=a-o,s=n?wn(o,a,t):u/(t+1);return En(o+s,a,s)}}function zS(t){Oa.call(this,null,t)}function BS(t,n,e,r,i){const o=t.x1||0,a=t.y1||0,u=n*e<0;function s(t){t.forEach(c)}function c(t){u&&t.reverse(),t.forEach(l)}function l(t){t[0]=(t[0]-o)*n+r,t[1]=(t[1]-a)*e+i}return function(t){return t.coordinates.forEach(s),t}}function TS(t,n,e){const r=t>=0?t:Ra(n,e);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function PS(t){return tt(t)?t:at(+t)}function jS(){var t=t=>t[0],n=t=>t[1],e=x,r=[-1,-1],i=960,o=500,a=2;function u(u,s){const c=TS(r[0],u,t)>>a,l=TS(r[1],u,n)>>a,f=c?c+2:0,d=l?l+2:0,h=2*f+(i>>a),m=2*d+(o>>a),p=new Float32Array(h*m),g=new Float32Array(h*m);let v=p;u.forEach((r=>{const i=f+(+t(r)>>a),o=d+(+n(r)>>a);i>=0&&i<h&&o>=0&&o<m&&(p[i+o*h]+=+e(r))})),c>0&&l>0?(RS(h,m,p,g,c),LS(h,m,g,p,l),RS(h,m,p,g,c),LS(h,m,g,p,l),RS(h,m,p,g,c),LS(h,m,g,p,l)):c>0?(RS(h,m,p,g,c),RS(h,m,g,p,c),RS(h,m,p,g,c),v=g):l>0&&(LS(h,m,p,g,l),LS(h,m,g,p,l),LS(h,m,p,g,l),v=g);const y=s?Math.pow(2,-2*a):1/Nn(v);for(let t=0,n=h*m;t<n;++t)v[t]*=y;return{values:v,scale:1<<a,width:h,height:m,x1:f,y1:d,x2:f+(i>>a),y2:d+(o>>a)}}return u.x=function(n){return arguments.length?(t=PS(n),u):t},u.y=function(t){return arguments.length?(n=PS(t),u):n},u.weight=function(t){return arguments.length?(e=PS(t),u):e},u.size=function(t){if(!arguments.length)return[i,o];var n=+t[0],e=+t[1];return n>=0&&e>=0||p("invalid size"),i=n,o=e,u},u.cellSize=function(t){return arguments.length?((t=+t)>=1||p("invalid cell size"),a=Math.floor(Math.log(t)/Math.LN2),u):1<<a},u.bandwidth=function(t){return arguments.length?(1===(t=Q(t)).length&&(t=[+t[0],+t[0]]),2!==t.length&&p("invalid bandwidth"),r=t,u):r},u}function RS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<n;++a)for(let n=0,u=0;n<t+i;++n)n<t&&(u+=e[n+a*t]),n>=i&&(n>=o&&(u-=e[n-o+a*t]),r[n-i+a*t]=u/Math.min(n+1,t-1+o-n,o))}function LS(t,n,e,r,i){const o=1+(i<<1);for(let a=0;a<t;++a)for(let u=0,s=0;u<n+i;++u)u<n&&(s+=e[a+u*t]),u>=i&&(u>=o&&(s-=e[a+(u-o)*t]),r[a+(u-i)*t]=s/Math.min(u+1,n-1+o-u,o))}function IS(t){Oa.call(this,null,t)}zS.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"}]},pt(zS,Oa,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=n.materialize(n.SOURCE).source,i=t.field||b,o=ES().smooth(!1!==t.smooth),a=t.thresholds||function(t,n,e){const r=_S(e.levels||10,e.nice,!1!==e.zero);return"shared"!==e.resolve?r:r(t.map((t=>xn(n(t).values))))}(r,i,t),u=null===t.as?null:t.as||"contour",s=[];return r.forEach((n=>{const e=i(n),r=o.size([e.width,e.height])(e.values,S(a)?a:a(e.values));!function(t,n,e,r){let i=r.scale||n.scale,o=r.translate||n.translate;if(tt(i)&&(i=i(e,r)),tt(o)&&(o=o(e,r)),(1===i||null==i)&&!o)return;const a=(wt(i)?i:i[0])||1,u=(wt(i)?i:i[1])||1;t.forEach(BS(n,a,u,o&&o[0]||0,o&&o[1]||0))}(r,e,n,t),r.forEach((t=>{s.push(ia(n,ea(null!=u?{[u]:t}:t)))}))})),this.value&&(e.rem=this.value),this.value=e.source=e.add=s,e}}),IS.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 qS=["x","y","weight","size","cellSize","bandwidth"];function US(t,n){return qS.forEach((e=>null!=n[e]?t[e](n[e]):0)),t}function WS(t){Oa.call(this,null,t)}pt(IS,Oa,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),i=function(t,n){var e,r,i,o,a,u,s=[],c=t=>t(o);if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}(n.materialize(n.SOURCE).source,t.groupby),o=(t.groupby||[]).map(l),a=US(jS(),t),u=t.as||"grid";return e=i.map((n=>ea(function(t,n){for(let e=0;e<o.length;++e)t[o[e]]=n[e];return t}({[u]:a(n,t.counts)},n.dims)))),this.value&&(r.rem=this.value),this.value=r.source=r.add=e,r}}),WS.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}]},pt(WS,Oa,{transform(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r,i=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=ES().smooth(!1!==t.smooth),a=t.values,u=t.thresholds||_S(t.count||10,t.nice,!!a),s=t.size;return a||(a=n.materialize(n.SOURCE).source,r=BS(e=US(jS(),t)(a,!0),e.scale||1,e.scale||1,0,0),s=[e.width,e.height],a=e.values),u=S(u)?u:u(a),a=o.size(s)(a,u),r&&a.forEach(r),this.value&&(i.rem=this.value),this.value=i.source=i.add=(a||[]).map(ea),i}});const HS="Feature",GS="FeatureCollection";function YS(t){Oa.call(this,null,t)}function VS(t){Oa.call(this,null,t)}function XS(t){Oa.call(this,null,t)}function JS(t){Oa.call(this,null,t)}function KS(t){Oa.call(this,[],t),this.generator=function(){var t,n,e,r,i,o,a,u,s,c,l,f,d=10,h=d,m=90,p=360,g=2.5;function v(){return{type:"MultiLineString",coordinates:y()}}function y(){return En(Dk(r/m)*m,e,m).map(l).concat(En(Dk(u/p)*p,a,p).map(f)).concat(En(Dk(n/d)*d,t,d).filter((function(t){return $k(t%m)>mk})).map(s)).concat(En(Dk(o/h)*h,i,h).filter((function(t){return $k(t%p)>mk})).map(c))}return v.lines=function(){return y().map((function(t){return{type:"LineString",coordinates:t}}))},v.outline=function(){return{type:"Polygon",coordinates:[l(r).concat(f(a).slice(1),l(e).reverse().slice(1),f(u).reverse().slice(1))]}},v.extent=function(t){return arguments.length?v.extentMajor(t).extentMinor(t):v.extentMinor()},v.extentMajor=function(t){return arguments.length?(u=+t[0][1],a=+t[1][1],(r=+t[0][0])>(e=+t[1][0])&&(t=r,r=e,e=t),u>a&&(t=u,u=a,a=t),v.precision(g)):[[r,u],[e,a]]},v.extentMinor=function(e){return arguments.length?(o=+e[0][1],i=+e[1][1],(n=+e[0][0])>(t=+e[1][0])&&(e=n,n=t,t=e),o>i&&(e=o,o=i,i=e),v.precision(g)):[[n,o],[t,i]]},v.step=function(t){return arguments.length?v.stepMajor(t).stepMinor(t):v.stepMinor()},v.stepMajor=function(t){return arguments.length?(m=+t[0],p=+t[1],v):[m,p]},v.stepMinor=function(t){return arguments.length?(d=+t[0],h=+t[1],v):[d,h]},v.precision=function(d){return arguments.length?(g=+d,s=MA(o,i,90),c=AA(n,t,g),l=MA(u,a,90),f=AA(r,e,g),v):g},v.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}()}function QS(t){Oa.call(this,null,t)}function ZS(t){if(!tt(t))return!1;const n=Bt(f(t));return n.$x||n.$y||n.$value||n.$max}function tF(t){Oa.call(this,null,t),this.modified(!0)}function nF(t,n,e){tt(t[n])&&t[n](e)}YS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},pt(YS,Oa,{transform(t,n){var e,r=this._features,i=this._points,o=t.fields,a=o&&o[0],u=o&&o[1],s=t.geojson||!o&&b,c=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(f(s))||a&&n.modified(f(a))||u&&n.modified(f(u)),this.value&&!e||(c=n.SOURCE,this._features=r=[],this._points=i=[]),s&&n.visit(c,(t=>r.push(s(t)))),a&&u&&(n.visit(c,(t=>{var n=a(t),e=u(t);null!=n&&null!=e&&(n=+n)===n&&(e=+e)===e&&i.push([n,e])})),r=r.concat({type:HS,geometry:{type:"MultiPoint",coordinates:i}})),this.value={type:GS,features:r}}}),VS.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"}]},pt(VS,Oa,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||b,o=t.as||"path",a=e.SOURCE;!r||t.modified()?(this.value=r=AS(t.projection),e.materialize().reflow()):a=i===b||n.modified(i.fields)?e.ADD_MOD:e.ADD;const u=function(t,n){const e=t.pointRadius();return t.context(null),null!=n&&t.pointRadius(n),e}(r,t.pointRadius);return e.visit(a,(t=>t[o]=r(i(t)))),r.pointRadius(u),e.modifies(o)}}),XS.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"]}]},pt(XS,Oa,{transform(t,n){var e,r=t.projection,i=t.fields[0],o=t.fields[1],a=t.as||["x","y"],u=a[0],s=a[1];function c(t){const n=r([i(t),o(t)]);n?(t[u]=n[0],t[s]=n[1]):(t[u]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,c):(e=n.modified(i.fields)||n.modified(o.fields),n.visit(e?n.ADD_MOD:n.ADD,c)),n.modifies(a)}}),JS.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"}]},pt(JS,Oa,{transform(t,n){var e=n.fork(n.ALL),r=this.value,i=t.as||"shape",o=e.ADD;return r&&!t.modified()||(this.value=r=function(t,n,e){const r=null==e?e=>t(n(e)):r=>{var i=t.pointRadius(),o=t.pointRadius(e)(n(r));return t.pointRadius(i),o};return r.context=n=>(t.context(n),r),r}(AS(t.projection),t.field||v("datum"),t.pointRadius),e.materialize().reflow(),o=e.SOURCE),e.visit(o,(t=>t[i]=r)),e.modifies(i)}}),KS.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}]},pt(KS,Oa,{transform(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(const n in t)tt(i[n])&&i[n](t[n]);return e=i(),r.length?n.mod.push(oa(r[0],e)):n.add.push(ea(e)),r[0]=e,n}}),QS.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"}]},pt(QS,Oa,{transform(t,n){if(!n.changed()&&!t.modified())return n.StopPropagation;var e=n.materialize(n.SOURCE).source,r="shared"===t.resolve,i=t.field||b,o=function(t,n){let e;return tt(t)?(e=e=>t(e,n),e.dep=ZS(t)):t?e=at(t):(e=t=>t.$value/t.$max||0,e.dep=!0),e}(t.opacity,t),a=function(t,n){let e;return tt(t)?(e=e=>Il(t(e,n)),e.dep=ZS(t)):e=at(Il(t||"#888")),e}(t.color,t),u=t.as||"image",s={$x:0,$y:0,$value:0,$max:r?xn(e.map((t=>xn(i(t).values)))):0};return e.forEach((t=>{const n=i(t),e=st({},t,s);r||(e.$max=xn(n.values||[])),t[u]=function(t,n,e,r){const i=t.width,o=t.x1||0,a=t.y1||0,u=t.x2||i,s=t.y2||t.height,c=t.values,l=c?t=>c[t]:w,f=hl(u-o,s-a),d=f.getContext("2d"),h=d.getImageData(0,0,u-o,s-a),m=h.data;for(let t=a,c=0;t<s;++t){n.$y=t-a;for(let a=o,s=t*i;a<u;++a,c+=4){n.$x=a-o,n.$value=l(a+s);const t=e(n);m[c+0]=t.r,m[c+1]=t.g,m[c+2]=t.b,m[c+3]=~~(255*r(n))}}return d.putImageData(h,0,0),f}(n,e,a.dep?a:at(a(e)),o.dep?o:at(o(e)))})),n.reflow(!0).modifies(u)}}),pt(tF,Oa,{transform(t,n){let e=this.value;return!e||t.modified("type")?(this.value=e=function(t){const n=MS((t||"mercator").toLowerCase());return n||p("Unrecognized projection type: "+t),n()}(t.type),kS.forEach((n=>{null!=t[n]&&nF(e,n,t[n])}))):kS.forEach((n=>{t.modified(n)&&nF(e,n,t[n])})),null!=t.pointRadius&&e.path.pointRadius(t.pointRadius),t.fit&&function(t,n){const e=function(t){return 1===(t=Q(t)).length?t[0]:{type:GS,features:t.reduce(((t,n)=>t.concat(function(t){return t.type===GS?t.features:Q(t).filter((t=>null!=t)).map((t=>t.type===HS?t:{type:HS,geometry:t}))}(n))),[])}}(n.fit);n.extent?t.fitExtent(n.extent,e):n.size&&t.fitSize(n.size,e)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)}});var eF=Object.freeze({__proto__:null,contour:WS,geojson:YS,geopath:VS,geopoint:XS,geoshape:JS,graticule:KS,heatmap:QS,isocontour:zS,kde2d:IS,projection:tF});function rF(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,o,a,u,s,c,l,f,d,h=t._root,m={data:r},p=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!h)return t._root=m,t;for(;h.length;)if((c=n>=(o=(p+v)/2))?p=o:v=o,(l=e>=(a=(g+y)/2))?g=a:y=a,i=h,!(h=h[f=l<<1|c]))return i[f]=m,t;if(u=+t._x.call(null,h.data),s=+t._y.call(null,h.data),n===u&&e===s)return m.next=h,i?i[f]=m:t._root=m,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(c=n>=(o=(p+v)/2))?p=o:v=o,(l=e>=(a=(g+y)/2))?g=a:y=a}while((f=l<<1|c)==(d=(s>=a)<<1|u>=o));return i[d]=h,i[f]=m,t}function iF(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function oF(t){return t[0]}function aF(t){return t[1]}function uF(t,n,e){var r=new sF(null==n?oF:n,null==e?aF:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function sF(t,n,e,r,i,o){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function cF(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var lF=uF.prototype=sF.prototype;function fF(t){return function(){return t}}function dF(t){return 1e-6*(t()-.5)}function hF(t){return t.x+t.vx}function mF(t){return t.y+t.vy}function pF(t){return t.index}function gF(t,n){var e=t.get(n);if(!e)throw new Error("node not found: "+n);return e}lF.copy=function(){var t,n,e=new sF(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=cF(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=cF(n));return e},lF.add=function(t){const n=+this._x.call(null,t),e=+this._y.call(null,t);return rF(this.cover(n,e),n,e,t)},lF.addAll=function(t){var n,e,r,i,o=t.length,a=new Array(o),u=new Array(o),s=1/0,c=1/0,l=-1/0,f=-1/0;for(e=0;e<o;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(a[e]=r,u[e]=i,r<s&&(s=r),r>l&&(l=r),i<c&&(c=i),i>f&&(f=i));if(s>l||c>f)return this;for(this.cover(s,c).cover(l,f),e=0;e<o;++e)rF(this,a[e],u[e],t[e]);return this},lF.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,o=(r=Math.floor(n))+1;else{for(var a,u,s=i-e||1,c=this._root;e>t||t>=i||r>n||n>=o;)switch(u=(n<r)<<1|t<e,(a=new Array(4))[u]=c,c=a,s*=2,u){case 0:i=e+s,o=r+s;break;case 1:e=i-s,o=r+s;break;case 2:i=e+s,r=o-s;break;case 3:e=i-s,r=o-s}this._root&&this._root.length&&(this._root=c)}return this._x0=e,this._y0=r,this._x1=i,this._y1=o,this},lF.data=function(){var t=[];return this.visit((function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)})),t},lF.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]]},lF.find=function(t,n,e){var r,i,o,a,u,s,c,l=this._x0,f=this._y0,d=this._x1,h=this._y1,m=[],p=this._root;for(p&&m.push(new iF(p,l,f,d,h)),null==e?e=1/0:(l=t-e,f=n-e,d=t+e,h=n+e,e*=e);s=m.pop();)if(!(!(p=s.node)||(i=s.x0)>d||(o=s.y0)>h||(a=s.x1)<l||(u=s.y1)<f))if(p.length){var g=(i+a)/2,v=(o+u)/2;m.push(new iF(p[3],g,v,a,u),new iF(p[2],i,v,g,u),new iF(p[1],g,o,a,v),new iF(p[0],i,o,g,v)),(c=(n>=v)<<1|t>=g)&&(s=m[m.length-1],m[m.length-1]=m[m.length-1-c],m[m.length-1-c]=s)}else{var y=t-+this._x.call(null,p.data),b=n-+this._y.call(null,p.data),w=y*y+b*b;if(w<e){var x=Math.sqrt(e=w);l=t-x,f=n-x,d=t+x,h=n+x,r=p.data}}return r},lF.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var n,e,r,i,o,a,u,s,c,l,f,d,h=this._root,m=this._x0,p=this._y0,g=this._x1,v=this._y1;if(!h)return this;if(h.length)for(;;){if((c=o>=(u=(m+g)/2))?m=u:g=u,(l=a>=(s=(p+v)/2))?p=s:v=s,n=h,!(h=h[f=l<<1|c]))return this;if(!h.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,d=f)}for(;h.data!==t;)if(r=h,!(h=h.next))return this;return(i=h.next)&&delete h.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(h=n[0]||n[1]||n[2]||n[3])&&h===(n[3]||n[2]||n[1]||n[0])&&!h.length&&(e?e[d]=h:this._root=h),this):(this._root=i,this)},lF.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},lF.root=function(){return this._root},lF.size=function(){var t=0;return this.visit((function(n){if(!n.length)do{++t}while(n=n.next)})),t},lF.visit=function(t){var n,e,r,i,o,a,u=[],s=this._root;for(s&&u.push(new iF(s,this._x0,this._y0,this._x1,this._y1));n=u.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,o=n.x1,a=n.y1)&&s.length){var c=(r+o)/2,l=(i+a)/2;(e=s[3])&&u.push(new iF(e,c,l,o,a)),(e=s[2])&&u.push(new iF(e,r,l,c,a)),(e=s[1])&&u.push(new iF(e,c,i,o,l)),(e=s[0])&&u.push(new iF(e,r,i,c,l))}return this},lF.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new iF(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var o,a=n.x0,u=n.y0,s=n.x1,c=n.y1,l=(a+s)/2,f=(u+c)/2;(o=i[0])&&e.push(new iF(o,a,u,l,f)),(o=i[1])&&e.push(new iF(o,l,u,s,f)),(o=i[2])&&e.push(new iF(o,a,f,l,c)),(o=i[3])&&e.push(new iF(o,l,f,s,c))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},lF.x=function(t){return arguments.length?(this._x=t,this):this._x},lF.y=function(t){return arguments.length?(this._y=t,this):this._y};var vF={value:()=>{}};function yF(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new bF(r)}function bF(t){this._=t}function wF(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function xF(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=vF,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}bF.prototype=yF.prototype={constructor:bF,on:function(t,n){var e,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map((function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))),a=-1,u=o.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(e=(t=o[a]).type)i[e]=xF(i[e],t.name,n);else if(null==n)for(e in i)i[e]=xF(i[e],t.name,null);return this}for(;++a<u;)if((e=(t=o[a]).type)&&(e=wF(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new bF(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),o=0;o<e;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,e=(r=this._[t]).length;o<e;++o)r[o].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(n,e)}};var $F,kF,MF=0,AF=0,DF=0,SF=0,FF=0,EF=0,NF="object"==typeof performance&&performance.now?performance:Date,CF="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function OF(){return FF||(CF(_F),FF=NF.now()+EF)}function _F(){FF=0}function zF(){this._call=this._time=this._next=null}function BF(t,n,e){var r=new zF;return r.restart(t,n,e),r}function TF(){FF=(SF=NF.now())+EF,MF=AF=0;try{!function(){OF(),++MF;for(var t,n=$F;n;)(t=FF-n._time)>=0&&n._call.call(void 0,t),n=n._next;--MF}()}finally{MF=0,function(){for(var t,n,e=$F,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:$F=n);kF=t,jF(r)}(),FF=0}}function PF(){var t=NF.now(),n=t-SF;n>1e3&&(EF-=n,SF=t)}function jF(t){MF||(AF&&(AF=clearTimeout(AF)),t-FF>24?(t<1/0&&(AF=setTimeout(TF,t-NF.now()-EF)),DF&&(DF=clearInterval(DF))):(DF||(SF=NF.now(),DF=setInterval(PF,1e3)),MF=1,CF(TF)))}zF.prototype=BF.prototype={constructor:zF,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?OF():+e)+(null==n?0:+n),this._next||kF===this||(kF?kF._next=this:$F=this,kF=this),this._call=t,this._time=e,jF()},stop:function(){this._call&&(this._call=null,this._time=1/0,jF())}};const RF=4294967296;function LF(t){return t.x}function IF(t){return t.y}var qF=Math.PI*(3-Math.sqrt(5));const UF={center:function(t,n){var e,r=1;function i(){var i,o,a=e.length,u=0,s=0;for(i=0;i<a;++i)u+=(o=e[i]).x,s+=o.y;for(u=(u/a-t)*r,s=(s/a-n)*r,i=0;i<a;++i)(o=e[i]).x-=u,o.y-=s}return null==t&&(t=0),null==n&&(n=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.strength=function(t){return arguments.length?(r=+t,i):r},i},collide:function(t){var n,e,r,i=1,o=1;function a(){for(var t,a,s,c,l,f,d,h=n.length,m=0;m<o;++m)for(a=uF(n,hF,mF).visitAfter(u),t=0;t<h;++t)d=(f=e[(s=n[t]).index])*f,c=s.x+s.vx,l=s.y+s.vy,a.visit(p);function p(t,n,e,o,a){var u=t.data,h=t.r,m=f+h;if(!u)return n>c+m||o<c-m||e>l+m||a<l-m;if(u.index>s.index){var p=c-u.x-u.vx,g=l-u.y-u.vy,v=p*p+g*g;v<m*m&&(0===p&&(v+=(p=dF(r))*p),0===g&&(v+=(g=dF(r))*g),v=(m-(v=Math.sqrt(v)))/v*i,s.vx+=(p*=v)*(m=(h*=h)/(d+h)),s.vy+=(g*=v)*m,u.vx-=p*(m=1-m),u.vy-=g*m)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function s(){if(n){var r,i,o=n.length;for(e=new Array(o),r=0;r<o;++r)e[(i=n[r]).index]=+t(i,r,n)}}return"function"!=typeof t&&(t=fF(null==t?1:+t)),a.initialize=function(t,e){n=t,r=e,s()},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(n){return arguments.length?(t="function"==typeof n?n:fF(+n),s(),a):t},a},nbody:function(){var t,n,e,r,i,o=fF(-30),a=1,u=1/0,s=.81;function c(e){var i,o=t.length,a=uF(t,LF,IF).visitAfter(f);for(r=e,i=0;i<o;++i)n=t[i],a.visit(d)}function l(){if(t){var n,e,r=t.length;for(i=new Array(r),n=0;n<r;++n)i[(e=t[n]).index]=+o(e,n,t)}}function f(t){var n,e,r,o,a,u=0,s=0;if(t.length){for(r=o=a=0;a<4;++a)(n=t[a])&&(e=Math.abs(n.value))&&(u+=n.value,s+=e,r+=e*n.x,o+=e*n.y);t.x=r/s,t.y=o/s}else{(n=t).x=n.data.x,n.y=n.data.y;do{u+=i[n.data.index]}while(n=n.next)}t.value=u}function d(t,o,c,l){if(!t.value)return!0;var f=t.x-n.x,d=t.y-n.y,h=l-o,m=f*f+d*d;if(h*h/s<m)return m<u&&(0===f&&(m+=(f=dF(e))*f),0===d&&(m+=(d=dF(e))*d),m<a&&(m=Math.sqrt(a*m)),n.vx+=f*t.value*r/m,n.vy+=d*t.value*r/m),!0;if(!(t.length||m>=u)){(t.data!==n||t.next)&&(0===f&&(m+=(f=dF(e))*f),0===d&&(m+=(d=dF(e))*d),m<a&&(m=Math.sqrt(a*m)));do{t.data!==n&&(n.vx+=f*(h=i[t.data.index]*r/m),n.vy+=d*h)}while(t=t.next)}}return c.initialize=function(n,r){t=n,e=r,l()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:fF(+t),l(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(u=t*t,c):Math.sqrt(u)},c.theta=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c},link:function(t){var n,e,r,i,o,a,u=pF,s=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=fF(30),l=1;function f(r){for(var i=0,u=t.length;i<l;++i)for(var s,c,f,d,h,m,p,g=0;g<u;++g)d=(f=(s=t[g]).target).x+f.vx-(c=s.source).x-c.vx||dF(a),h=f.y+f.vy-c.y-c.vy||dF(a),h*=m=((m=Math.sqrt(d*d+h*h))-e[g])/m*r*n[g],f.vx-=(d*=m)*(p=o[g]),f.vy-=h*p,c.vx+=d*(p=1-p),c.vy+=h*p}function d(){if(r){var a,s,c=r.length,l=t.length,f=new Map(r.map(((t,n)=>[u(t,n,r),t])));for(a=0,i=new Array(c);a<l;++a)(s=t[a]).index=a,"object"!=typeof s.source&&(s.source=gF(f,s.source)),"object"!=typeof s.target&&(s.target=gF(f,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(a=0,o=new Array(l);a<l;++a)o[a]=i[(s=t[a]).source.index]/(i[s.source.index]+i[s.target.index]);n=new Array(l),h(),e=new Array(l),m()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+s(t[e],e,t)}function m(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}return null==t&&(t=[]),f.initialize=function(t,n){r=t,a=n,d()},f.links=function(n){return arguments.length?(t=n,d(),f):t},f.id=function(t){return arguments.length?(u=t,f):u},f.iterations=function(t){return arguments.length?(l=+t,f):l},f.strength=function(t){return arguments.length?(s="function"==typeof t?t:fF(+t),h(),f):s},f.distance=function(t){return arguments.length?(c="function"==typeof t?t:fF(+t),m(),f):c},f},x:function(t){var n,e,r,i=fF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vx+=(r[o]-i.x)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=fF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:fF(+t),a(),o):i},o.x=function(n){return arguments.length?(t="function"==typeof n?n:fF(+n),a(),o):t},o},y:function(t){var n,e,r,i=fF(.1);function o(t){for(var i,o=0,a=n.length;o<a;++o)(i=n[o]).vy+=(r[o]-i.y)*e[o]*t}function a(){if(n){var o,a=n.length;for(e=new Array(a),r=new Array(a),o=0;o<a;++o)e[o]=isNaN(r[o]=+t(n[o],o,n))?0:+i(n[o],o,n)}}return"function"!=typeof t&&(t=fF(null==t?0:+t)),o.initialize=function(t){n=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:fF(+t),a(),o):i},o.y=function(n){return arguments.length?(t="function"==typeof n?n:fF(+n),a(),o):t},o}},WF="forces",HF=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],GF=["static","iterations"],YF=["x","y","vx","vy"];function VF(t){Oa.call(this,null,t)}function XF(t,n,e,r){var i,o,a,u,s=Q(n.forces);for(i=0,o=HF.length;i<o;++i)(a=HF[i])!==WF&&n.modified(a)&&t[a](n[a]);for(i=0,o=s.length;i<o;++i)u=WF+i,(a=e||n.modified(WF,i)?KF(s[i]):r&&JF(s[i],r)?t.force(u):null)&&t.force(u,a);for(o=t.numForces||0;i<o;++i)t.force(WF+i,null);return t.numForces=s.length,t}function JF(t,n){var e,r;for(e in t)if(tt(r=t[e])&&n.modified(f(r)))return 1;return 0}function KF(t){var n,e;for(e in ft(UF,t.force)||p("Unrecognized force: "+t.force),n=UF[t.force](),t)tt(n[e])&&QF(n[e],t[e],t);return n}function QF(t,n,e){t(tt(n)?t=>n(t,e):n)}VF.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:YF}]},pt(VF,Oa,{transform(t,n){var e,r,i=this.value,o=n.changed(n.ADD_REM),a=t.modified(HF),u=t.iterations||300;if(i?(o&&(n.modifies("index"),i.nodes(n.source)),(a||n.changed(n.MOD))&&XF(i,t,0,n)):(this.value=i=function(t,n){const e=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,u=new Map,s=BF(f),c=yF("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%RF)/RF}();function f(){d(),c.call("tick",n),e<r&&(s.stop(),c.call("end",n))}function d(r){var s,c,l=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(e+=(o-e)*i,u.forEach((function(t){t(e)})),s=0;s<l;++s)null==(c=t[s]).fx?c.x+=c.vx*=a:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=a:(c.y=c.fy,c.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,null!=n.fx&&(n.x=n.fx),null!=n.fy&&(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=10*Math.sqrt(.5+e),o=e*qF;n.x=i*Math.cos(o),n.y=i*Math.sin(o)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function m(n){return n.initialize&&n.initialize(t,l),n}return null==t&&(t=[]),h(),n={tick:d,restart:function(){return s.restart(f),n},stop:function(){return s.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),u.forEach(m),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(o=+t,n):o},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(l=t,u.forEach(m),n):l},force:function(t,e){return arguments.length>1?(null==e?u.delete(t):u.set(t,m(e)),n):u.get(t)},find:function(n,e,r){var i,o,a,u,s,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(a=(i=n-(u=t[c]).x)*i+(o=e-u.y)*o)<r&&(s=u,r=a);return s},on:function(t,e){return arguments.length>1?(c.on(t,e),n):c.on(t)}}}(t),r=e.stop,i=e.restart;let o=!1;return e.stopped=()=>o,e.restart=()=>(o=!1,i()),e.stop=()=>(o=!0,r()),XF(e,n,!0).on("end",(()=>o=!0))}(n.source,t),i.on("tick",(e=n.dataflow,r=this,()=>e.touch(r).run())),t.static||(o=!0,i.tick()),n.modifies("index")),a||o||t.modified(GF)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/u)),t.static)for(i.stop();--u>=0;)i.tick();else if(i.stopped()&&i.restart(),!o)return n.StopPropagation;return this.finish(t,n)},finish(t,n){const e=n.dataflow;for(let t,n=this._argops,u=0,s=n.length;u<s;++u)if(t=n[u],t.name===WF&&"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)){e.pulse(r,e.changeset().reflow());break}return n.reflow(t.modified()).modifies(YF)}});var ZF=Object.freeze({__proto__:null,force:VF});function tE(t,n){return t.parent===n.parent?1:2}function nE(t,n){return t+n.x}function eE(t,n){return Math.max(t,n.y)}function rE(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function iE(t,n){t instanceof Map?(t=[void 0,t],void 0===n&&(n=aE)):void 0===n&&(n=oE);for(var e,r,i,o,a,u=new cE(t),s=[u];e=s.pop();)if((i=n(e.data))&&(a=(i=Array.from(i)).length))for(e.children=i,o=a-1;o>=0;--o)s.push(r=i[o]=new cE(i[o])),r.parent=e,r.depth=e.depth+1;return u.eachBefore(sE)}function oE(t){return t.children}function aE(t){return Array.isArray(t)?t[1]:null}function uE(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function sE(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function cE(t){this.data=t,this.depth=this.height=0,this.parent=null}function lE(t){return null==t?null:fE(t)}function fE(t){if("function"!=typeof t)throw new Error;return t}function dE(){return 0}function hE(t){return function(){return t}}cE.prototype=iE.prototype={constructor:cE,count:function(){return this.eachAfter(rE)},each:function(t,n){let e=-1;for(const r of this)t.call(n,r,++e,this);return this},eachAfter:function(t,n){for(var e,r,i,o=this,a=[o],u=[],s=-1;o=a.pop();)if(u.push(o),e=o.children)for(r=0,i=e.length;r<i;++r)a.push(e[r]);for(;o=u.pop();)t.call(n,o,++s,this);return this},eachBefore:function(t,n){for(var e,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(n,i,++a,this),e=i.children)for(r=e.length-1;r>=0;--r)o.push(e[r]);return this},find:function(t,n){let e=-1;for(const r of this)if(t.call(n,r,++e,this))return r},sum:function(t){return this.eachAfter((function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e}))},sort:function(t){return this.eachBefore((function(n){n.children&&n.children.sort(t)}))},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)r.push(n=n.parent);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(n){n.children||t.push(n)})),t},links:function(){var t=this,n=[];return t.each((function(e){e!==t&&n.push({source:e.parent,target:e})})),n},copy:function(){return iE(this).eachBefore(uE)},[Symbol.iterator]:function*(){var t,n,e,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,n=i.children)for(e=0,r=n.length;e<r;++e)o.push(n[e])}while(o.length)}};const mE=4294967296;function pE(t,n){var e,r;if(yE(n,t))return[n];for(e=0;e<t.length;++e)if(gE(n,t[e])&&yE(wE(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(gE(wE(t[e],t[r]),n)&&gE(wE(t[e],n),t[r])&&gE(wE(t[r],n),t[e])&&yE(xE(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function gE(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function vE(t,n){var e=t.r-n.r+1e-9*Math.max(t.r,n.r,1),r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function yE(t,n){for(var e=0;e<n.length;++e)if(!vE(t,n[e]))return!1;return!0}function bE(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return wE(t[0],t[1]);case 3:return xE(t[0],t[1],t[2])}var n}function wE(t,n){var e=t.x,r=t.y,i=t.r,o=n.x,a=n.y,u=n.r,s=o-e,c=a-r,l=u-i,f=Math.sqrt(s*s+c*c);return{x:(e+o+s/f*l)/2,y:(r+a+c/f*l)/2,r:(f+i+u)/2}}function xE(t,n,e){var r=t.x,i=t.y,o=t.r,a=n.x,u=n.y,s=n.r,c=e.x,l=e.y,f=e.r,d=r-a,h=r-c,m=i-u,p=i-l,g=s-o,v=f-o,y=r*r+i*i-o*o,b=y-a*a-u*u+s*s,w=y-c*c-l*l+f*f,x=h*m-d*p,$=(m*w-p*b)/(2*x)-r,k=(p*g-m*v)/x,M=(h*b-d*w)/(2*x)-i,A=(d*v-h*g)/x,D=k*k+A*A-1,S=2*(o+$*k+M*A),F=$*$+M*M-o*o,E=-(Math.abs(D)>1e-6?(S+Math.sqrt(S*S-4*D*F))/(2*D):F/S);return{x:r+$+k*E,y:i+M+A*E,r:E}}function $E(t,n,e){var r,i,o,a,u=t.x-n.x,s=t.y-n.y,c=u*u+s*s;c?(i=n.r+e.r,a=t.r+e.r,(i*=i)>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),e.x=t.x-r*u-o*s,e.y=t.y-r*s+o*u):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),e.x=n.x+r*u-o*s,e.y=n.y+r*s+o*u)):(e.x=n.x+e.r,e.y=n.y)}function kE(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function ME(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,o=(n.y*e.r+e.y*n.r)/r;return i*i+o*o}function AE(t){this._=t,this.next=null,this.previous=null}function DE(t){return Math.sqrt(t.value)}function SE(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function FE(t,n,e){return function(r){if(i=r.children){var i,o,a,u=i.length,s=t(r)*n||0;if(s)for(o=0;o<u;++o)i[o].r+=s;if(a=function(t,n){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var e,r,i,o,a,u,s,c,l,f,d;if((e=t[0]).x=0,e.y=0,!(o>1))return e.r;if(e.x=-(r=t[1]).r,r.x=e.r,r.y=0,!(o>2))return e.r+r.r;$E(r,e,i=t[2]),e=new AE(e),r=new AE(r),i=new AE(i),e.next=i.previous=r,r.next=e.previous=i,i.next=r.previous=e;t:for(s=3;s<o;++s){$E(e._,r._,i=t[s]),i=new AE(i),c=r.next,l=e.previous,f=r._.r,d=e._.r;do{if(f<=d){if(kE(c._,i._)){e.next=r=c,r.previous=e,--s;continue t}f+=c._.r,c=c.next}else{if(kE(l._,i._)){(e=l).next=r,r.previous=e,--s;continue t}d+=l._.r,l=l.previous}}while(c!==l.next);for(i.previous=e,i.next=r,e.next=r.previous=r=i,a=ME(e);(i=i.next)!==r;)(u=ME(i))<a&&(e=i,a=u);r=e.next}for(e=[r._],i=r;(i=i.next)!==r;)e.push(i._);for(i=function(t,n){for(var e,r,i=0,o=(t=function(t,n){let e,r,i=t.length;for(;i;)r=n()*i--|0,e=t[i],t[i]=t[r],t[r]=e;return t}(Array.from(t),n)).length,a=[];i<o;)e=t[i],r&&vE(r,e)?++i:(r=bE(a=pE(a,e)),i=0);return r}(e,n),s=0;s<o;++s)(e=t[s]).x-=i.x,e.y-=i.y;return i.r}(i,e),s)for(o=0;o<u;++o)i[o].r-=s;r.r=a+s}}}function EE(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function NE(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 CE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(r-n)/t.value;++u<s;)(o=a[u]).y0=e,o.y1=i,o.x0=n,o.x1=n+=o.value*c}var OE={depth:-1},_E={},zE={};function BE(t){return t.id}function TE(t){return t.parentId}function PE(){var t,n=BE,e=TE;function r(r){var i,o,a,u,s,c,l,f,d=Array.from(r),h=n,m=e,p=new Map;if(null!=t){const n=d.map(((n,e)=>function(t){let n=(t=`${t}`).length;return RE(t,n-1)&&!RE(t,n-2)&&(t=t.slice(0,-1)),"/"===t[0]?t:`/${t}`}(t(n,e,r)))),e=n.map(jE),i=new Set(n).add("");for(const t of e)i.has(t)||(i.add(t),n.push(t),e.push(jE(t)),d.push(zE));h=(t,e)=>n[e],m=(t,n)=>e[n]}for(a=0,i=d.length;a<i;++a)c=d[a]=new cE(o=d[a]),null!=(l=h(o,a,r))&&(l+="")&&(f=c.id=l,p.set(f,p.has(f)?_E:c)),null!=(l=m(o,a,r))&&(l+="")&&(c.parent=l);for(a=0;a<i;++a)if(l=(c=d[a]).parent){if(!(s=p.get(l)))throw new Error("missing: "+l);if(s===_E)throw new Error("ambiguous: "+l);s.children?s.children.push(c):s.children=[c],c.parent=s}else{if(u)throw new Error("multiple roots");u=c}if(!u)throw new Error("no root");if(null!=t){for(;u.data===zE&&1===u.children.length;)u=u.children[0],--i;for(let t=d.length-1;t>=0&&(c=d[t]).data===zE;--t)c.data=null}if(u.parent=OE,u.eachBefore((function(t){t.depth=t.parent.depth+1,--i})).eachBefore(sE),u.parent=null,i>0)throw new Error("cycle");return u}return r.id=function(t){return arguments.length?(n=lE(t),r):n},r.parentId=function(t){return arguments.length?(e=lE(t),r):e},r.path=function(n){return arguments.length?(t=lE(n),r):t},r}function jE(t){let n=t.length;if(n<2)return"";for(;--n>1&&!RE(t,n););return t.slice(0,n)}function RE(t,n){if("/"===t[n]){let e=0;for(;n>0&&"\\"===t[--n];)++e;if(!(1&e))return!0}return!1}function LE(t,n){return t.parent===n.parent?1:2}function IE(t){var n=t.children;return n?n[0]:t.t}function qE(t){var n=t.children;return n?n[n.length-1]:t.t}function UE(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function WE(t,n,e){return t.a.parent===n.parent?t.a:e}function HE(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function GE(t,n,e,r,i){for(var o,a=t.children,u=-1,s=a.length,c=t.value&&(i-e)/t.value;++u<s;)(o=a[u]).x0=n,o.x1=r,o.y0=e,o.y1=e+=o.value*c}HE.prototype=Object.create(cE.prototype);var YE=(1+Math.sqrt(5))/2;function VE(t,n,e,r,i,o){for(var a,u,s,c,l,f,d,h,m,p,g,v=[],y=n.children,b=0,w=0,x=y.length,$=n.value;b<x;){s=i-e,c=o-r;do{l=y[w++].value}while(!l&&w<x);for(f=d=l,g=l*l*(p=Math.max(c/s,s/c)/($*t)),m=Math.max(d/g,g/f);w<x;++w){if(l+=u=y[w].value,u<f&&(f=u),u>d&&(d=u),g=l*l*p,(h=Math.max(d/g,g/f))>m){l-=u;break}m=h}v.push(a={value:l,dice:s<c,children:y.slice(b,w)}),a.dice?CE(a,e,r,i,$?r+=c*l/$:o):GE(a,e,r,$?e+=s*l/$:i,o),$-=l,b=w}return v}var XE=function t(n){function e(t,e,r,i,o){VE(n,t,e,r,i,o)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(YE),JE=function t(n){function e(t,e,r,i,o){if((a=t._squarify)&&a.ratio===n)for(var a,u,s,c,l,f=-1,d=a.length,h=t.value;++f<d;){for(s=(u=a[f]).children,c=u.value=0,l=s.length;c<l;++c)u.value+=s[c].value;u.dice?CE(u,e,r,i,h?r+=(o-r)*u.value/h:o):GE(u,e,r,h?e+=(i-e)*u.value/h:i,o),h-=u.value}else t._squarify=a=VE(n,t,e,r,i,o),a.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(YE);function KE(t,n,e){const r={};return t.each((t=>{const i=t.data;e(i)&&(r[n(i)]=t)})),t.lookup=r,t}function QE(t){Oa.call(this,null,t)}QE.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const ZE=t=>t.values;function tN(){const t=[],n={entries:t=>r(e(t,0),0),key:e=>(t.push(e),n)};function e(n,r){if(r>=t.length)return n;const i=n.length,o=t[r++],a={},u={};let s,c,l,f=-1;for(;++f<i;)s=o(c=n[f])+"",(l=a[s])?l.push(c):a[s]=[c];for(s in a)u[s]=e(a[s],r);return u}function r(n,e){if(++e>t.length)return n;const i=[];for(const t in n)i.push({key:t,values:r(n[t],e)});return i}return n}function nN(t){Oa.call(this,null,t)}pt(QE,Oa,{transform(t,n){n.source||p("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),i=n.clone(),o=this.value;return(!o||r||n.changed())&&(o&&o.each((t=>{t.children&&Zo(t.data)&&i.rem.push(t.data)})),this.value=o=iE({values:Q(t.keys).reduce(((t,n)=>(t.key(n),t)),tN()).entries(i.source)},ZE),e&&o.each((t=>{t.children&&(t=ea(t.data),i.add.push(t),i.source.push(t))})),KE(o,ta,ta)),i.source.root=o,i}});const eN=(t,n)=>t.parent===n.parent?1:2;pt(nN,Oa,{transform(t,n){n.source&&n.source.root||p(this.constructor.name+" transform requires a backing tree data source.");const e=this.layout(t.method),r=this.fields,i=n.source.root,o=t.as||r;t.field?i.sum(t.field):i.count(),t.sort&&i.sort(aa(t.sort,(t=>t.data))),function(t,n,e){for(let r,i=0,o=n.length;i<o;++i)r=n[i],r in e&&t[r](e[r])}(e,this.params,t),e.separation&&e.separation(!1!==t.separation?eN:x);try{this.value=e(i)}catch(t){p(t)}return i.each((t=>function(t,n,e){const r=t.data,i=n.length-1;for(let o=0;o<i;++o)r[e[o]]=t[n[o]];r[e[i]]=t.children?t.children.length:0}(t,r,o))),n.reflow(t.modified()).modifies(o).modifies("leaf")}});const rN=["x","y","r","depth","children"];function iN(t){nN.call(this,t)}iN.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:rN.length,default:rN}]},pt(iN,nN,{layout:function(){var t=null,n=1,e=1,r=dE;function i(i){const o=function(){let t=1;return()=>(t=(1664525*t+1013904223)%mE)/mE}();return i.x=n/2,i.y=e/2,t?i.eachBefore(SE(t)).eachAfter(FE(r,.5,o)).eachBefore(EE(1)):i.eachBefore(SE(DE)).eachAfter(FE(dE,1,o)).eachAfter(FE(r,i.r/Math.min(n,e),o)).eachBefore(EE(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=lE(n),i):t},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:hE(+t),i):r},i},params:["radius","size","padding"],fields:rN});const oN=["x0","y0","x1","y1","depth","children"];function aN(t){nN.call(this,t)}function uN(t){Oa.call(this,null,t)}aN.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:oN.length,default:oN}]},pt(aN,nN,{layout:function(){var t=1,n=1,e=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/o,i.eachBefore(function(t,n){return function(r){r.children&&CE(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,o=r.y0,a=r.x1-e,u=r.y1-e;a<i&&(i=a=(i+a)/2),u<o&&(o=u=(o+u)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=u}}(n,o)),r&&i.eachBefore(NE),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},params:["size","round","padding"],fields:oN}),uN.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},pt(uN,Oa,{transform(t,n){n.source||p("Stratify transform requires an upstream data source.");let e=this.value;const r=t.modified(),i=n.fork(n.ALL).materialize(n.SOURCE),o=!e||r||n.changed(n.ADD_REM)||n.modified(t.key.fields)||n.modified(t.parentKey.fields);return i.source=i.source.slice(),o&&(e=i.source.length?KE(PE().id(t.key).parentId(t.parentKey)(i.source),t.key,$):KE(PE()([{}]),t.key,t.key)),i.source.root=this.value=e,i}});const sN={tidy:function(){var t=LE,n=1,e=1,r=null;function i(i){var s=function(t){for(var n,e,r,i,o,a=new HE(t,0),u=[a];n=u.pop();)if(r=n._.children)for(n.children=new Array(o=r.length),i=o-1;i>=0;--i)u.push(e=n.children[i]=new HE(r[i],i)),e.parent=n;return(a.parent=new HE(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(u);else{var c=i,l=i,f=i;i.eachBefore((function(t){t.x<c.x&&(c=t),t.x>l.x&&(l=t),t.depth>f.depth&&(f=t)}));var d=c===l?1:t(c,l)/2,h=d-c.x,m=n/(l.x+d+h),p=e/(f.depth||1);i.eachBefore((function(t){t.x=(t.x+h)*m,t.y=t.depth*p}))}return i}function o(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,o=i.length;--o>=0;)(n=i[o]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var o=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-o):n.z=o}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,o=n,a=n,u=e,s=o.parent.children[0],c=o.m,l=a.m,f=u.m,d=s.m;u=qE(u),o=IE(o),u&&o;)s=IE(s),(a=qE(a)).a=n,(i=u.z+f-o.z-c+t(u._,o._))>0&&(UE(WE(u,n,r),n,i),c+=i,l+=i),f+=u.m,c+=o.m,d+=s.m,l+=a.m;u&&!qE(a)&&(a.t=u,a.m+=f-l),o&&!IE(s)&&(s.t=o,s.m+=c-d,r=n)}return r}(n,i,n.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function u(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=tE,n=1,e=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(n){var e=n.children;e?(n.x=function(t){return t.reduce(nE,0)/t.length}(e),n.y=function(t){return 1+t.reduce(eE,0)}(e)):(n.x=o?a+=t(n,o):0,n.y=0,o=n)}));var u=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),c=u.x-t(u,s)/2,l=s.x+t(s,u)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-c)/(l-c)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},cN=["x","y","depth","children"];function lN(t){nN.call(this,t)}function fN(t){Oa.call(this,[],t)}lN.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:cN.length,default:cN}]},pt(lN,nN,{layout(t){const n=t||"tidy";if(ft(sN,n))return sN[n]();p("Unrecognized Tree layout method: "+n)},params:["size","nodeSize"],fields:cN}),fN.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},pt(fN,Oa,{transform(t,n){const e=this.value,r=n.source&&n.source.root,i=n.fork(n.NO_SOURCE),o={};return r||p("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(i.rem=e,n.visit(n.SOURCE,(t=>o[ta(t)]=1)),r.each((t=>{const n=t.data,e=t.parent&&t.parent.data;e&&o[ta(n)]&&o[ta(e)]&&i.add.push(ea({source:e,target:n}))})),this.value=i.add):n.changed(n.MOD)&&(n.visit(n.MOD,(t=>o[ta(t)]=1)),e.forEach((t=>{(o[ta(t.source)]||o[ta(t.target)])&&i.mod.push(t)}))),i}});const dN={binary:function(t,n,e,r,i){var o,a,u=t.children,s=u.length,c=new Array(s+1);for(c[0]=a=o=0;o<s;++o)c[o+1]=a+=u[o].value;!function t(n,e,r,i,o,a,s){if(n>=e-1){var l=u[n];return l.x0=i,l.y0=o,l.x1=a,void(l.y1=s)}for(var f=c[n],d=r/2+f,h=n+1,m=e-1;h<m;){var p=h+m>>>1;c[p]<d?h=p+1:m=p}d-c[h-1]<c[h]-d&&n+1<h&&--h;var g=c[h]-f,v=r-g;if(a-i>s-o){var y=r?(i*v+a*g)/r:a;t(n,h,g,i,o,y,s),t(h,e,v,y,o,a,s)}else{var b=r?(o*v+s*g)/r:s;t(n,h,g,i,o,a,b),t(h,e,v,i,b,a,s)}}(0,s,t.value,n,e,r,i)},dice:CE,slice:GE,slicedice:function(t,n,e,r,i){(1&t.depth?GE:CE)(t,n,e,r,i)},squarify:XE,resquarify:JE},hN=["x0","y0","x1","y1","depth","children"];function mN(t){nN.call(this,t)}mN.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:hN.length,default:hN}]},pt(mN,nN,{layout(){const t=function(){var t=XE,n=!1,e=1,r=1,i=[0],o=dE,a=dE,u=dE,s=dE,c=dE;function l(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(NE),t}function f(n){var e=i[n.depth],r=n.x0+e,l=n.y0+e,f=n.x1-e,d=n.y1-e;f<r&&(r=f=(r+f)/2),d<l&&(l=d=(l+d)/2),n.x0=r,n.y0=l,n.x1=f,n.y1=d,n.children&&(e=i[n.depth+1]=o(n)/2,r+=c(n)-e,l+=a(n)-e,(f-=u(n)-e)<r&&(r=f=(r+f)/2),(d-=s(n)-e)<l&&(l=d=(l+d)/2),t(n,r,l,f,d))}return l.round=function(t){return arguments.length?(n=!!t,l):n},l.size=function(t){return arguments.length?(e=+t[0],r=+t[1],l):[e,r]},l.tile=function(n){return arguments.length?(t=fE(n),l):t},l.padding=function(t){return arguments.length?l.paddingInner(t).paddingOuter(t):l.paddingInner()},l.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:hE(+t),l):o},l.paddingOuter=function(t){return arguments.length?l.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):l.paddingTop()},l.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:hE(+t),l):a},l.paddingRight=function(t){return arguments.length?(u="function"==typeof t?t:hE(+t),l):u},l.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:hE(+t),l):s},l.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:hE(+t),l):c},l}();return t.ratio=n=>{const e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=n=>{ft(dN,n)?t.tile(dN[n]):p("Unrecognized Treemap layout method: "+n)},t},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:hN});var pN=Object.freeze({__proto__:null,nest:QE,pack:iN,partition:aN,stratify:uN,tree:lN,treelinks:fN,treemap:mN});const gN=4278190080;function vN(t,n,e){return new Uint32Array(t.getImageData(0,0,n,e).data.buffer)}function yN(t,n,e){if(!n.length)return;const r=n[0].mark.marktype;"group"===r?n.forEach((n=>{n.items.forEach((n=>yN(t,n.items,e)))})):Tb[r].draw(t,{items:e?n.map(bN):n})}function bN(t){const n=ia(t,{});return n.stroke&&0!==n.strokeOpacity||n.fill&&0!==n.fillOpacity?{...n,strokeOpacity:1,stroke:"#000",fillOpacity:0}:n}const wN=31,xN=new Uint32Array(33),$N=new Uint32Array(33);$N[0]=0,xN[0]=~$N[0];for(let t=1;t<=32;++t)$N[t]=$N[t-1]<<1|1,xN[t]=~$N[t];function kN(t,n,e,r,i,o){let a=e/2;return t-a<0||t+a>i||n-(a=r/2)<0||n+a>o}function MN(t,n,e,r,i,o,a,u){const s=i*o/(2*r),c=t(n-s),l=t(n+s),f=t(e-(o/=2)),d=t(e+o);return a.outOfBounds(c,f,l,d)||a.getRange(c,f,l,d)||u&&u.getRange(c,f,l,d)}const AN=[-1,-1,1,1],DN=[-1,1,-1,1],SN=["right","center","left"],FN=["bottom","middle","top"];function EN(t,n,e,r,i,o,a,u,s,c,l,f){return!(i.outOfBounds(t,e,n,r)||(f&&o||i).getRange(t,e,n,r))}const NN={"top-left":0,top:1,"top-right":2,left:4,middle:5,right:6,"bottom-left":8,bottom:9,"bottom-right":10},CN={naive:function(t,n,e,r){const i=t.width,o=t.height;return function(t){const n=t.datum.datum.items[r].items,e=n.length,a=t.datum.fontSize,u=gb.width(t.datum,t.datum.text);let s,c,l,f,d,h,m,p=0;for(let r=0;r<e;++r)s=n[r].x,l=n[r].y,c=void 0===n[r].x2?s:n[r].x2,f=void 0===n[r].y2?l:n[r].y2,d=(s+c)/2,h=(l+f)/2,m=Math.abs(c-s+f-l),m>=p&&(p=m,t.x=d,t.y=h);return d=u/2,h=a/2,s=t.x-d,c=t.x+d,l=t.y-h,f=t.y+h,t.align="center",s<0&&c<=i?t.align="left":0<=s&&i<c&&(t.align="right"),t.baseline="middle",l<0&&f<=o?t.baseline="top":0<=l&&o<f&&(t.baseline="bottom"),!0}},"reduced-search":function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1];function s(n,e,r,s,c){const l=t.invert(n),f=t.invert(e);let d,h=r,m=o;if(!kN(l,f,s,c,i,o)&&!MN(t,l,f,c,s,h,a,u)&&!MN(t,l,f,c,s,c,a,null)){for(;m-h>=1;)d=(h+m)/2,MN(t,l,f,c,s,d,a,u)?m=d:h=d;if(h>r)return[l,f,h,!0]}}return function(n){const u=n.datum.datum.items[r].items,c=u.length,l=n.datum.fontSize,f=gb.width(n.datum,n.datum.text);let d,h,m,p,g,v,y,b,w,x,$,k,M,A,D,S,F,E=e?l:0,N=!1,C=!1,O=0;for(let r=0;r<c;++r){for(d=u[r].x,m=u[r].y,h=void 0===u[r].x2?d:u[r].x2,p=void 0===u[r].y2?m:u[r].y2,d>h&&(F=d,d=h,h=F),m>p&&(F=m,m=p,p=F),w=t(d),$=t(h),x=~~((w+$)/2),k=t(m),A=t(p),M=~~((k+A)/2),y=x;y>=w;--y)for(b=M;b>=k;--b)S=s(y,b,E,f,l),S&&([n.x,n.y,E,N]=S);for(y=x;y<=$;++y)for(b=M;b<=A;++b)S=s(y,b,E,f,l),S&&([n.x,n.y,E,N]=S);N||e||(D=Math.abs(h-d+p-m),g=(d+h)/2,v=(m+p)/2,D>=O&&!kN(g,v,f,l,i,o)&&!MN(t,g,v,l,f,l,a,null)&&(O=D,n.x=g,n.y=v,C=!0))}return!(!N&&!C||(g=f/2,v=l/2,a.setRange(t(n.x-g),t(n.y-v),t(n.x+g),t(n.y+v)),n.align="center",n.baseline="middle",0))}},floodfill:function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=t.bitmap();return function(n){const c=n.datum.datum.items[r].items,l=c.length,f=n.datum.fontSize,d=gb.width(n.datum,n.datum.text),h=[];let m,p,g,v,y,b,w,x,$,k,M,A,D=e?f:0,S=!1,F=!1,E=0;for(let r=0;r<l;++r){for(m=c[r].x,g=c[r].y,p=void 0===c[r].x2?m:c[r].x2,v=void 0===c[r].y2?g:c[r].y2,h.push([t((m+p)/2),t((g+v)/2)]);h.length;)if([w,x]=h.pop(),!(a.get(w,x)||u.get(w,x)||s.get(w,x))){s.set(w,x);for(let t=0;t<4;++t)y=w+AN[t],b=x+DN[t],s.outOfBounds(y,b,y,b)||h.push([y,b]);if(y=t.invert(w),b=t.invert(x),$=D,k=o,!kN(y,b,d,f,i,o)&&!MN(t,y,b,f,d,$,a,u)&&!MN(t,y,b,f,d,f,a,null)){for(;k-$>=1;)M=($+k)/2,MN(t,y,b,f,d,M,a,u)?k=M:$=M;$>D&&(n.x=y,n.y=b,D=$,S=!0)}}S||e||(A=Math.abs(p-m+v-g),y=(m+p)/2,b=(g+v)/2,A>=E&&!kN(y,b,d,f,i,o)&&!MN(t,y,b,f,d,f,a,null)&&(E=A,n.x=y,n.y=b,F=!0))}return!(!S&&!F||(y=d/2,b=f/2,a.setRange(t(n.x-y),t(n.y-b),t(n.x+y),t(n.y+b)),n.align="center",n.baseline="middle",0))}}};function ON(t,n,e,r,i,o,a,u,s,c,l){if(!t.length)return t;const f=Math.max(r.length,i.length),d=function(t,n){const e=new Float64Array(n),r=t.length;for(let n=0;n<r;++n)e[n]=t[n]||0;for(let t=r;t<n;++t)e[t]=e[r-1];return e}(r,f),h=function(t,n){const e=new Int8Array(n),r=t.length;for(let n=0;n<r;++n)e[n]|=NN[t[n]];for(let t=r;t<n;++t)e[t]=e[r-1];return e}(i,f),m=(w=t[0].datum)&&w.mark&&w.mark.marktype,p="group"===m&&t[0].datum.items[s].marktype,g="area"===p,v=function(t,n,e,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"===n?t=>{const n=t.datum.items[r].items;return i(n.length?n["start"===e?0:n.length-1]:{x:NaN,y:NaN})}:t=>{const n=t.datum.bounds;return[n.x1,(n.x1+n.x2)/2,n.x2,n.y1,(n.y1+n.y2)/2,n.y2]}:i}(m,p,u,s),y=null===c||c===1/0,b=g&&"naive"===l;var w;let x=-1,$=-1;const k=t.map((t=>{const n=y?gb.width(t,t.text):void 0;return x=Math.max(x,n),$=Math.max($,t.fontSize),{datum:t,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:v(t),textWidth:n}}));c=null===c||c===1/0?Math.max(x,$)+Math.max(...r):c;const M=function(t,n,e){const r=Math.max(1,Math.sqrt(t*n/1e6)),i=~~((t+2*e+r)/r),o=~~((n+2*e+r)/r),a=t=>~~((t+e)/r);return a.invert=t=>t*r-e,a.bitmap=()=>function(t,n){const e=new Uint32Array(~~((t*n+32)/32));function r(t,n){e[t]|=n}function i(t,n){e[t]&=n}return{array:e,get:(n,r)=>{const i=r*t+n;return e[i>>>5]&1<<(i&wN)},set:(n,e)=>{const i=e*t+n;r(i>>>5,1<<(i&wN))},clear:(n,e)=>{const r=e*t+n;i(r>>>5,~(1<<(r&wN)))},getRange:(n,r,i,o)=>{let a,u,s,c,l=o;for(;l>=r;--l)if(a=l*t+n,u=l*t+i,s=a>>>5,c=u>>>5,s===c){if(e[s]&xN[a&wN]&$N[1+(u&wN)])return!0}else{if(e[s]&xN[a&wN])return!0;if(e[c]&$N[1+(u&wN)])return!0;for(let t=s+1;t<c;++t)if(e[t])return!0}return!1},setRange:(n,e,i,o)=>{let a,u,s,c,l;for(;e<=o;++e)if(a=e*t+n,u=e*t+i,s=a>>>5,c=u>>>5,s===c)r(s,xN[a&wN]&$N[1+(u&wN)]);else for(r(s,xN[a&wN]),r(c,$N[1+(u&wN)]),l=s+1;l<c;++l)r(l,4294967295)},clearRange:(n,e,r,o)=>{let a,u,s,c,l;for(;e<=o;++e)if(a=e*t+n,u=e*t+r,s=a>>>5,c=u>>>5,s===c)i(s,$N[a&wN]|xN[1+(u&wN)]);else for(i(s,$N[a&wN]),i(c,xN[1+(u&wN)]),l=s+1;l<c;++l)i(l,0)},outOfBounds:(e,r,i,o)=>e<0||r<0||o>=n||i>=t}}(i,o),a.ratio=r,a.padding=e,a.width=t,a.height=n,a}(n[0],n[1],c);let A;if(!b){e&&k.sort(((t,n)=>e(t.datum,n.datum)));let n=!1;for(let t=0;t<h.length&&!n;++t)n=5===h[t]||d[t]<0;const r=(m&&a||g)&&t.map((t=>t.datum));A=o.length||r?function(t,n,e,r,i){const o=t.width,a=t.height,u=r||i,s=hl(o,a).getContext("2d"),c=hl(o,a).getContext("2d"),l=u&&hl(o,a).getContext("2d");e.forEach((t=>yN(s,t,!1))),yN(c,n,!1),u&&yN(l,n,!0);const f=vN(s,o,a),d=vN(c,o,a),h=u&&vN(l,o,a),m=t.bitmap(),p=u&&t.bitmap();let g,v,y,b,w,x,$,k;for(v=0;v<a;++v)for(g=0;g<o;++g)w=v*o+g,x=f[w]&gN,k=d[w]&gN,$=u&&h[w]&gN,(x||$||k)&&(y=t(g),b=t(v),i||!x&&!k||m.set(y,b),u&&(x||$)&&p.set(y,b));return[m,p]}(M,r||[],o,n,g):function(t,n){const e=t.bitmap();return(n||[]).forEach((n=>e.set(t(n.boundary[0]),t(n.boundary[3])))),[e,void 0]}(M,a&&k)}const D=g?CN[l](M,A,a,s):function(t,n,e,r){const i=t.width,o=t.height,a=n[0],u=n[1],s=r.length;return function(n){const c=n.boundary,l=n.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>i||c[3]>o)return!1;let f,d,h,m,p,g,v,y,b,w,x,$,k,M,A,D=n.textWidth??0;for(let i=0;i<s;++i){if(f=(3&e[i])-1,d=(e[i]>>>2&3)-1,h=0===f&&0===d||r[i]<0,m=f&&d?Math.SQRT1_2:1,p=r[i]<0?-1:1,g=c[1+f]+r[i]*f*m,x=c[4+d]+p*l*d/2+r[i]*d*m,y=x-l/2,b=x+l/2,$=t(g),M=t(y),A=t(b),!D){if(!EN($,$,M,A,a,u,0,0,0,0,0,h))continue;D=gb.width(n.datum,n.datum.text)}if(w=g+p*D*f/2,g=w-D/2,v=w+D/2,$=t(g),k=t(v),EN($,k,M,A,a,u,0,0,0,0,0,h))return n.x=f?f*p<0?v:g:w,n.y=d?d*p<0?b:y:x,n.align=SN[f*p+1],n.baseline=FN[d*p+1],a.setRange($,M,k,A),!0}return!1}}(M,A,h,d);return k.forEach((t=>t.opacity=+D(t))),k}const _N=["x","y","opacity","align","baseline"],zN=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function BN(t){Oa.call(this,null,t)}BN.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:zN},{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:_N.length,default:_N}]},pt(BN,Oa,{transform(t,n){const e=t.modified();if(!(e||n.changed(n.ADD_REM)||function(){const e=t.sort;return tt(e)&&n.modified(e.fields)}()))return;t.size&&2===t.size.length||p("Size parameter should be specified as a [width, height] array.");const r=t.as||_N;return ON(n.materialize(n.SOURCE).source||[],t.size,t.sort,Q(null==t.offset?1:t.offset),Q(t.anchor||zN),t.avoidMarks||[],!1!==t.avoidBaseMark,t.lineAnchor||"end",t.markIndex||0,void 0===t.padding?0:t.padding,t.method||"naive").forEach((t=>{const n=t.datum;n[r[0]]=t.x,n[r[1]]=t.y,n[r[2]]=t.opacity,n[r[3]]=t.align,n[r[4]]=t.baseline})),n.reflow(e).modifies(r)}});var TN=Object.freeze({__proto__:null,label:BN});function PN(t,n){var e,r,i,o,a,u,s=[],c=function(t){return t(o)};if(null==n)s.push(t);else for(e={},r=0,i=t.length;r<i;++r)o=t[r],(u=e[a=n.map(c)])||(e[a]=u=[],u.dims=a,s.push(u)),u.push(o);return s}function jN(t){Oa.call(this,null,t)}jN.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}]},pt(jN,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=PN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(l),o=i.length,a=t.as||[l(t.x),l(t.y)],u=[];r.forEach((n=>{$u(n,t.x,t.y,t.bandwidth||.3).forEach((t=>{const e={};for(let t=0;t<o;++t)e[i[t]]=n.dims[t];e[a[0]]=t[0],e[a[1]]=t[1],u.push(ea(e))}))})),this.value&&(e.rem=this.value),this.value=e.add=e.source=u}return e}});const RN={constant:lu,linear:pu,log:gu,exp:vu,pow:yu,quad:bu,poly:wu};function LN(t){Oa.call(this,null,t)}LN.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(RN)},{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}]},pt(LN,Oa,{transform(t,n){const e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){const r=PN(n.materialize(n.SOURCE).source,t.groupby),i=(t.groupby||[]).map(l),o=t.method||"linear",a=null==t.order?3:t.order,u=((t,n)=>"poly"===t?n:"quad"===t?2:1)(o,a),s=t.as||[l(t.x),l(t.y)],c=RN[o],f=[];let d=t.extent;ft(RN,o)||p("Invalid regression method: "+o),null!=d&&"log"===o&&d[0]<=0&&(n.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),r.forEach((e=>{if(e.length<=u)return void n.dataflow.warn("Skipping regression with more parameters than data points.");const r=c(e,t.x,t.y,a);if(t.params)return void f.push(ea({keys:e.dims,coef:r.coef,rSquared:r.rSquared}));const l=d||ct(e,t.x),h=t=>{const n={};for(let t=0;t<i.length;++t)n[i[t]]=e.dims[t];n[s[0]]=t[0],n[s[1]]=t[1],f.push(ea(n))};"linear"===o||"constant"===o?l.forEach((t=>h([t,r.predict(t)]))):Du(r.predict,l,25,200).forEach(h)})),this.value&&(e.rem=this.value),this.value=e.add=e.source=f}return e}});var IN=Object.freeze({__proto__:null,loess:jN,regression:LN});const qN=134217729;function UN(t,n,e,r,i){let o,a,u,s,c=n[0],l=r[0],f=0,d=0;l>c==l>-c?(o=c,c=n[++f]):(o=l,l=r[++d]);let h=0;if(f<t&&d<e)for(l>c==l>-c?(a=c+o,u=o-(a-c),c=n[++f]):(a=l+o,u=o-(a-l),l=r[++d]),o=a,0!==u&&(i[h++]=u);f<t&&d<e;)l>c==l>-c?(a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++f]):(a=o+l,s=a-o,u=o-(a-s)+(l-s),l=r[++d]),o=a,0!==u&&(i[h++]=u);for(;f<t;)a=o+c,s=a-o,u=o-(a-s)+(c-s),c=n[++f],o=a,0!==u&&(i[h++]=u);for(;d<e;)a=o+l,s=a-o,u=o-(a-s)+(l-s),l=r[++d],o=a,0!==u&&(i[h++]=u);return 0===o&&0!==h||(i[h++]=o),h}function WN(t){return new Float64Array(t)}const HN=WN(4),GN=WN(8),YN=WN(12),VN=WN(16),XN=WN(4);function JN(t,n,e,r,i,o){const a=(n-o)*(e-i),u=(t-i)*(r-o),s=a-u,c=Math.abs(a+u);return Math.abs(s)>=33306690738754716e-32*c?s:-function(t,n,e,r,i,o,a){let u,s,c,l,f,d,h,m,p,g,v,y,b,w,x,$,k,M;const A=t-i,D=e-i,S=n-o,F=r-o;w=A*F,d=qN*A,h=d-(d-A),m=A-h,d=qN*F,p=d-(d-F),g=F-p,x=m*g-(w-h*p-m*p-h*g),$=S*D,d=qN*S,h=d-(d-S),m=S-h,d=qN*D,p=d-(d-D),g=D-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,HN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,HN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,HN[2]=y-(M-f)+(v-f),HN[3]=M;let E=function(t,n){let e=n[0];for(let t=1;t<4;t++)e+=n[t];return e}(0,HN),N=22204460492503146e-32*a;if(E>=N||-E>=N)return E;if(f=t-A,u=t-(A+f)+(f-i),f=e-D,c=e-(D+f)+(f-i),f=n-S,s=n-(S+f)+(f-o),f=r-F,l=r-(F+f)+(f-o),0===u&&0===s&&0===c&&0===l)return E;if(N=11093356479670487e-47*a+33306690738754706e-32*Math.abs(E),E+=A*l+F*u-(S*c+D*s),E>=N||-E>=N)return E;w=u*F,d=qN*u,h=d-(d-u),m=u-h,d=qN*F,p=d-(d-F),g=F-p,x=m*g-(w-h*p-m*p-h*g),$=s*D,d=qN*s,h=d-(d-s),m=s-h,d=qN*D,p=d-(d-D),g=D-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,XN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,XN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,XN[2]=y-(M-f)+(v-f),XN[3]=M;const C=UN(4,HN,4,XN,GN);w=A*l,d=qN*A,h=d-(d-A),m=A-h,d=qN*l,p=d-(d-l),g=l-p,x=m*g-(w-h*p-m*p-h*g),$=S*c,d=qN*S,h=d-(d-S),m=S-h,d=qN*c,p=d-(d-c),g=c-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,XN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,XN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,XN[2]=y-(M-f)+(v-f),XN[3]=M;const O=UN(C,GN,4,XN,YN);w=u*l,d=qN*u,h=d-(d-u),m=u-h,d=qN*l,p=d-(d-l),g=l-p,x=m*g-(w-h*p-m*p-h*g),$=s*c,d=qN*s,h=d-(d-s),m=s-h,d=qN*c,p=d-(d-c),g=c-p,k=m*g-($-h*p-m*p-h*g),v=x-k,f=x-v,XN[0]=x-(v+f)+(f-k),y=w+v,f=y-w,b=w-(y-f)+(v-f),v=b-$,f=b-v,XN[1]=b-(v+f)+(f-$),M=y+v,f=M-y,XN[2]=y-(M-f)+(v-f),XN[3]=M;const _=UN(O,YN,4,XN,VN);return VN[_-1]}(t,n,e,r,i,o,c)}const KN=Math.pow(2,-52),QN=new Uint32Array(512);class ZN{static from(t,n=oC,e=aC){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=n(r),i[2*o+1]=e(r)}return new ZN(i)}constructor(t){const n=t.length>>1;if(n>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const e=Math.max(2*n-5,0);this._triangles=new Uint32Array(3*e),this._halfedges=new Int32Array(3*e),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:e,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,u=1/0,s=-1/0,c=-1/0;for(let n=0;n<o;n++){const e=t[2*n],r=t[2*n+1];e<a&&(a=e),r<u&&(u=r),e>s&&(s=e),r>c&&(c=r),this._ids[n]=n}const l=(a+s)/2,f=(u+c)/2;let d,h,m;for(let n=0,e=1/0;n<o;n++){const r=tC(l,f,t[2*n],t[2*n+1]);r<e&&(d=n,e=r)}const p=t[2*d],g=t[2*d+1];for(let n=0,e=1/0;n<o;n++){if(n===d)continue;const r=tC(p,g,t[2*n],t[2*n+1]);r<e&&r>0&&(h=n,e=r)}let v=t[2*h],y=t[2*h+1],b=1/0;for(let n=0;n<o;n++){if(n===d||n===h)continue;const e=eC(p,g,v,y,t[2*n],t[2*n+1]);e<b&&(m=n,b=e)}let w=t[2*m],x=t[2*m+1];if(b===1/0){for(let n=0;n<o;n++)this._dists[n]=t[2*n]-t[0]||t[2*n+1]-t[1];rC(this._ids,this._dists,0,o-1);const n=new Uint32Array(o);let e=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(n[e++]=i,r=o)}return this.hull=n.subarray(0,e),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(JN(p,g,v,y,w,x)<0){const t=h,n=v,e=y;h=m,v=w,y=x,m=t,w=n,x=e}const $=function(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,l=a*a+u*u,f=s*s+c*c,d=.5/(a*c-u*s);return{x:t+(c*l-u*f)*d,y:n+(a*f-s*l)*d}}(p,g,v,y,w,x);this._cx=$.x,this._cy=$.y;for(let n=0;n<o;n++)this._dists[n]=tC(t[2*n],t[2*n+1],$.x,$.y);rC(this._ids,this._dists,0,o-1),this._hullStart=d;let k=3;e[d]=n[m]=h,e[h]=n[d]=m,e[m]=n[h]=d,r[d]=0,r[h]=1,r[m]=2,i.fill(-1),i[this._hashKey(p,g)]=d,i[this._hashKey(v,y)]=h,i[this._hashKey(w,x)]=m,this.trianglesLen=0,this._addTriangle(d,h,m,-1,-1,-1);for(let o,a,u=0;u<this._ids.length;u++){const s=this._ids[u],c=t[2*s],l=t[2*s+1];if(u>0&&Math.abs(c-o)<=KN&&Math.abs(l-a)<=KN)continue;if(o=c,a=l,s===d||s===h||s===m)continue;let f=0;for(let t=0,n=this._hashKey(c,l);t<this._hashSize&&(f=i[(n+t)%this._hashSize],-1===f||f===e[f]);t++);f=n[f];let p,g=f;for(;p=e[g],JN(c,l,t[2*g],t[2*g+1],t[2*p],t[2*p+1])>=0;)if(g=p,g===f){g=-1;break}if(-1===g)continue;let v=this._addTriangle(g,s,e[g],-1,-1,r[g]);r[s]=this._legalize(v+2),r[g]=v,k++;let y=e[g];for(;p=e[y],JN(c,l,t[2*y],t[2*y+1],t[2*p],t[2*p+1])<0;)v=this._addTriangle(y,s,p,r[s],-1,r[y]),r[s]=this._legalize(v+2),e[y]=y,k--,y=p;if(g===f)for(;p=n[g],JN(c,l,t[2*p],t[2*p+1],t[2*g],t[2*g+1])<0;)v=this._addTriangle(p,s,g,-1,r[g],r[p]),this._legalize(v+2),r[p]=v,e[g]=g,k--,g=p;this._hullStart=n[s]=g,e[g]=n[y]=s,e[s]=y,i[this._hashKey(c,l)]=s,i[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(k);for(let t=0,n=this._hullStart;t<k;t++)this.hull[t]=n,n=e[n];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(function(t,n){const e=t/(Math.abs(t)+Math.abs(n));return(n>0?3-e:1+e)/4}(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:e,coords:r}=this;let i=0,o=0;for(;;){const a=e[t],u=t-t%3;if(o=u+(t+2)%3,-1===a){if(0===i)break;t=QN[--i];continue}const s=a-a%3,c=s+(a+2)%3,l=n[o],f=n[t],d=n[u+(t+1)%3],h=n[c];if(nC(r[2*l],r[2*l+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*h],r[2*h+1])){n[t]=h,n[a]=l;const r=e[c];if(-1===r){let n=this._hullStart;do{if(this._hullTri[n]===c){this._hullTri[n]=t;break}n=this._hullPrev[n]}while(n!==this._hullStart)}this._link(t,r),this._link(a,e[o]),this._link(o,c),i<QN.length&&(QN[i++]=s+(a+1)%3)}else{if(0===i)break;t=QN[--i]}}return o}_link(t,n){this._halfedges[t]=n,-1!==n&&(this._halfedges[n]=t)}_addTriangle(t,n,e,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=e,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function tC(t,n,e,r){const i=t-e,o=n-r;return i*i+o*o}function nC(t,n,e,r,i,o,a,u){const s=t-a,c=n-u,l=e-a,f=r-u,d=i-a,h=o-u,m=l*l+f*f,p=d*d+h*h;return s*(f*p-m*h)-c*(l*p-m*d)+(s*s+c*c)*(l*h-f*d)<0}function eC(t,n,e,r,i,o){const a=e-t,u=r-n,s=i-t,c=o-n,l=a*a+u*u,f=s*s+c*c,d=.5/(a*c-u*s),h=(c*l-u*f)*d,m=(a*f-s*l)*d;return h*h+m*m}function rC(t,n,e,r){if(r-e<=20)for(let i=e+1;i<=r;i++){const r=t[i],o=n[r];let a=i-1;for(;a>=e&&n[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=e+1,o=r;iC(t,e+r>>1,i),n[t[e]]>n[t[r]]&&iC(t,e,r),n[t[i]]>n[t[r]]&&iC(t,i,r),n[t[e]]>n[t[i]]&&iC(t,e,i);const a=t[i],u=n[a];for(;;){do{i++}while(n[t[i]]<u);do{o--}while(n[t[o]]>u);if(o<i)break;iC(t,i,o)}t[e+1]=t[o],t[o]=a,r-i+1>=o-e?(rC(t,n,i,r),rC(t,n,e,o-1)):(rC(t,n,e,o-1),rC(t,n,i,r))}}function iC(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function oC(t){return t[0]}function aC(t){return t[1]}const uC=1e-6;class sC{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,e){const r=(t=+t)+(e=+e),i=n=+n;if(e<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>uC||Math.abs(this._y1-i)>uC)&&(this._+="L"+r+","+i),e&&(this._+=`A${e},${e},0,1,1,${t-e},${n}A${e},${e},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,n,e,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+e}v${+r}h${-e}Z`}value(){return this._||null}}class cC{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let lC=class{constructor(t,[n,e,r,i]=[0,0,960,500]){if(!((r=+r)>=(n=+n)&&(i=+i)>=(e=+e)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=n,this.ymax=i,this.ymin=e,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:e},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,e.length/3*2);for(let r,u,s=0,c=0,l=e.length;s<l;s+=3,c+=2){const l=2*e[s],f=2*e[s+1],d=2*e[s+2],h=t[l],m=t[l+1],p=t[d],g=t[d+1],v=t[f]-h,y=t[f+1]-m,b=p-h,w=g-m,x=2*(v*w-y*b);if(Math.abs(x)<1e-9){if(void 0===i){i=o=0;for(const e of n)i+=t[2*e],o+=t[2*e+1];i/=n.length,o/=n.length}const e=1e9*Math.sign((i-h)*w-(o-m)*b);r=(h+p)/2-e*w,u=(m+g)/2+e*b}else{const t=1/x,n=v*v+y*y,e=b*b+w*w;r=h+(w*n-y*e)*t,u=m+(v*e-b*n)*t}a[c]=r,a[c+1]=u}let u,s,c,l=n[n.length-1],f=4*l,d=t[2*l],h=t[2*l+1];r.fill(0);for(let e=0;e<n.length;++e)l=n[e],u=f,s=d,c=h,f=4*l,d=t[2*l],h=t[2*l+1],r[u+2]=r[f]=c-h,r[u+3]=r[f+1]=d-s}render(t){const n=null==t?t=new sC:void 0,{delaunay:{halfedges:e,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let n=0,r=e.length;n<r;++n){const r=e[n];if(r<n)continue;const i=2*Math.floor(n/3),a=2*Math.floor(r/3);this._renderSegment(o[i],o[i+1],o[a],o[a+1],t)}let u,s=i[i.length-1];for(let n=0;n<i.length;++n){u=s,s=i[n];const e=2*Math.floor(r[s]/3),c=o[e],l=o[e+1],f=4*u,d=this._project(c,l,a[f+2],a[f+3]);d&&this._renderSegment(c,l,d[0],d[1],t)}return n&&n.value()}renderBounds(t){const n=null==t?t=new sC:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const e=null==n?n=new sC:void 0,r=this._clip(t);if(null===r||!r.length)return;n.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||n.lineTo(r[t],r[t+1]);return n.closePath(),e&&e.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,e=t.length/2;n<e;++n){const t=this.cellPolygon(n);t&&(t.index=n,yield t)}}cellPolygon(t){const n=new cC;return this.renderCell(t,n),n.value()}_renderSegment(t,n,e,r,i){let o;const a=this._regioncode(t,n),u=this._regioncode(e,r);0===a&&0===u?(i.moveTo(t,n),i.lineTo(e,r)):(o=this._clipSegment(t,n,e,r,a,u))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,n,e){return(n=+n)==n&&(e=+e)==e&&this.delaunay._step(t,n,e)===t}*neighbors(t){const n=this._clip(t);if(n)for(const e of this.delaunay.neighbors(t)){const t=this._clip(e);if(t)t:for(let r=0,i=n.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(n[r]===t[o]&&n[r+1]===t[o+1]&&n[(r+2)%i]===t[(o+a-2)%a]&&n[(r+3)%i]===t[(o+a-1)%a]){yield e;break t}}}_cell(t){const{circumcenters:n,delaunay:{inedges:e,halfedges:r,triangles:i}}=this,o=e[t];if(-1===o)return null;const a=[];let u=o;do{const e=Math.floor(u/3);if(a.push(n[2*e],n[2*e+1]),u=u%3==2?u-2:u+1,i[u]!==t)break;u=r[u]}while(u!==o&&-1!==u);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 n=this._cell(t);if(null===n)return null;const{vectors:e}=this,r=4*t;return this._simplify(e[r]||e[r+1]?this._clipInfinite(t,n,e[r],e[r+1],e[r+2],e[r+3]):this._clipFinite(t,n))}_clipFinite(t,n){const e=n.length;let r,i,o,a,u=null,s=n[e-2],c=n[e-1],l=this._regioncode(s,c),f=0;for(let d=0;d<e;d+=2)if(r=s,i=c,s=n[d],c=n[d+1],o=l,l=this._regioncode(s,c),0===o&&0===l)a=f,f=0,u?u.push(s,c):u=[s,c];else{let n,e,d,h,m;if(0===o){if(null===(n=this._clipSegment(r,i,s,c,o,l)))continue;[e,d,h,m]=n}else{if(null===(n=this._clipSegment(s,c,r,i,l,o)))continue;[h,m,e,d]=n,a=f,f=this._edgecode(e,d),a&&f&&this._edge(t,a,f,u,u.length),u?u.push(e,d):u=[e,d]}a=f,f=this._edgecode(h,m),a&&f&&this._edge(t,a,f,u,u.length),u?u.push(h,m):u=[h,m]}if(u)a=f,f=this._edgecode(u[0],u[1]),a&&f&&this._edge(t,a,f,u,u.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 u}_clipSegment(t,n,e,r,i,o){const a=i<o;for(a&&([t,n,e,r,i,o]=[e,r,t,n,o,i]);;){if(0===i&&0===o)return a?[e,r,t,n]:[t,n,e,r];if(i&o)return null;let u,s,c=i||o;8&c?(u=t+(e-t)*(this.ymax-n)/(r-n),s=this.ymax):4&c?(u=t+(e-t)*(this.ymin-n)/(r-n),s=this.ymin):2&c?(s=n+(r-n)*(this.xmax-t)/(e-t),u=this.xmax):(s=n+(r-n)*(this.xmin-t)/(e-t),u=this.xmin),i?i=this._regioncode(t=u,n=s):o=this._regioncode(e=u,r=s)}}_clipInfinite(t,n,e,r,i,o){let a,u=Array.from(n);if((a=this._project(u[0],u[1],e,r))&&u.unshift(a[0],a[1]),(a=this._project(u[u.length-2],u[u.length-1],i,o))&&u.push(a[0],a[1]),u=this._clipFinite(t,u))for(let n,e=0,r=u.length,i=this._edgecode(u[r-2],u[r-1]);e<r;e+=2)n=i,i=this._edgecode(u[e],u[e+1]),n&&i&&(e=this._edge(t,n,i,u,e),r=u.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(u=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return u}_edge(t,n,e,r,i){for(;n!==e;){let e,o;switch(n){case 5:n=4;continue;case 4:n=6,e=this.xmax,o=this.ymin;break;case 6:n=2;continue;case 2:n=10,e=this.xmax,o=this.ymax;break;case 10:n=8;continue;case 8:n=9,e=this.xmin,o=this.ymax;break;case 9:n=1;continue;case 1:n=5,e=this.xmin,o=this.ymin}r[i]===e&&r[i+1]===o||!this.contains(t,e,o)||(r.splice(i,0,e,o),i+=2)}return i}_project(t,n,e,r){let i,o,a,u=1/0;if(r<0){if(n<=this.ymin)return null;(i=(this.ymin-n)/r)<u&&(a=this.ymin,o=t+(u=i)*e)}else if(r>0){if(n>=this.ymax)return null;(i=(this.ymax-n)/r)<u&&(a=this.ymax,o=t+(u=i)*e)}if(e>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/e)<u&&(o=this.xmax,a=n+(u=i)*r)}else if(e<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/e)<u&&(o=this.xmin,a=n+(u=i)*r)}return[o,a]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const e=(n+2)%t.length,r=(n+4)%t.length;(t[n]===t[e]&&t[e]===t[r]||t[n+1]===t[e+1]&&t[e+1]===t[r+1])&&(t.splice(e,2),n-=2)}t.length||(t=null)}return t}};const fC=2*Math.PI,dC=Math.pow;function hC(t){return t[0]}function mC(t){return t[1]}function pC(t,n,e){return[t+Math.sin(t+n)*e,n+Math.cos(t-n)*e]}class gC{static from(t,n=hC,e=mC,r){return new gC("length"in t?function(t,n,e,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=n.call(r,i,a,t),o[2*a+1]=e.call(r,i,a,t)}return o}(t,n,e,r):Float64Array.from(function*(t,n,e,r){let i=0;for(const o of t)yield n.call(r,o,i,t),yield e.call(r,o,i,t),++i}(t,n,e,r)))}constructor(t){this._delaunator=new ZN(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:n,coords:e}=t;for(let t=0;t<n.length;t+=3){const r=2*n[t],i=2*n[t+1],o=2*n[t+2];if((e[o]-e[r])*(e[i+1]-e[r+1])-(e[i]-e[r])*(e[o+1]-e[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:n.length/2},((t,n)=>n)).sort(((t,e)=>n[2*t]-n[2*e]||n[2*t+1]-n[2*e+1]));const t=this.collinear[0],e=this.collinear[this.collinear.length-1],r=[n[2*t],n[2*t+1],n[2*e],n[2*e+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,e=n.length/2;t<e;++t){const e=pC(n[2*t],n[2*t+1],i);n[2*t]=e[0],n[2*t+1]=e[1]}this._delaunator=new ZN(n)}else delete this.collinear;const e=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,n=e.length;t<n;++t){const n=i[t%3==2?t-2:t+1];-1!==e[t]&&-1!==o[n]||(o[n]=t)}for(let t=0,n=r.length;t<n;++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 lC(this,t)}*neighbors(t){const{inedges:n,hull:e,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const n=a.indexOf(t);return n>0&&(yield a[n-1]),void(n<a.length-1&&(yield a[n+1]))}const u=n[t];if(-1===u)return;let s=u,c=-1;do{if(yield c=o[s],s=s%3==2?s-2:s+1,o[s]!==t)return;if(s=i[s],-1===s){const n=e[(r[t]+1)%e.length];return void(n!==c&&(yield n))}}while(s!==u)}find(t,n,e=0){if((t=+t)!=t||(n=+n)!=n)return-1;const r=e;let i;for(;(i=this._step(e,t,n))>=0&&i!==e&&i!==r;)e=i;return i}_step(t,n,e){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:u,points:s}=this;if(-1===r[t]||!s.length)return(t+1)%(s.length>>1);let c=t,l=dC(n-s[2*t],2)+dC(e-s[2*t+1],2);const f=r[t];let d=f;do{let r=u[d];const f=dC(n-s[2*r],2)+dC(e-s[2*r+1],2);if(f<l&&(l=f,c=r),d=d%3==2?d-2:d+1,u[d]!==t)break;if(d=a[d],-1===d){if(d=i[(o[t]+1)%i.length],d!==r&&dC(n-s[2*d],2)+dC(e-s[2*d+1],2)<l)return d;break}}while(d!==f);return c}render(t){const n=null==t?t=new sC:void 0,{points:e,halfedges:r,triangles:i}=this;for(let n=0,o=r.length;n<o;++n){const o=r[n];if(o<n)continue;const a=2*i[n],u=2*i[o];t.moveTo(e[a],e[a+1]),t.lineTo(e[u],e[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){void 0!==n||t&&"function"==typeof t.moveTo||(n=t,t=null),n=null==n?2:+n;const e=null==t?t=new sC:void 0,{points:r}=this;for(let e=0,i=r.length;e<i;e+=2){const i=r[e],o=r[e+1];t.moveTo(i+n,o),t.arc(i,o,n,0,fC)}return e&&e.value()}renderHull(t){const n=null==t?t=new sC:void 0,{hull:e,points:r}=this,i=2*e[0],o=e.length;t.moveTo(r[i],r[i+1]);for(let n=1;n<o;++n){const i=2*e[n];t.lineTo(r[i],r[i+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new cC;return this.renderHull(t),t.value()}renderTriangle(t,n){const e=null==n?n=new sC:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],u=2*i[t+2];return n.moveTo(r[o],r[o+1]),n.lineTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.closePath(),e&&e.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,e=t.length/3;n<e;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new cC;return this.renderTriangle(t,n),n.value()}}function vC(t){Oa.call(this,null,t)}vC.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 yC=[-1e5,-1e5,1e5,1e5];function bC(t){const n=t[0][0],e=t[0][1];let r=t.length-1;for(;t[r][0]===n&&t[r][1]===e;--r);return"M"+t.slice(0,r+1).join("L")+"Z"}pt(vC,Oa,{transform(t,n){const e=t.as||"path",r=n.source;if(!r||!r.length)return n;let i=t.size;i=i?[0,0,i[0],i[1]]:(i=t.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:yC;const o=this.value=gC.from(r,t.x,t.y).voronoi(i);for(let t=0,n=r.length;t<n;++t){const n=o.cellPolygon(t);r[t][e]=!n||2===(a=n).length&&a[0][0]===a[1][0]&&a[0][1]===a[1][1]?null:bC(n)}var a;return n.reflow(t.modified()).modifies(e)}});var wC=Object.freeze({__proto__:null,voronoi:vC}),xC=Math.PI/180,$C=2048;function kC(t,n,e,r){if(!n.sprite){var i=t.context,o=t.ratio;i.clearRect(0,0,2048/o,$C/o);var a,u,s,c,l,f=0,d=0,h=0,m=e.length;for(--r;++r<m;){if(n=e[r],i.save(),i.font=n.style+" "+n.weight+" "+~~((n.size+1)/o)+"px "+n.font,a=i.measureText(n.text+"m").width*o,s=n.size<<1,n.rotate){var p=Math.sin(n.rotate*xC),g=Math.cos(n.rotate*xC),v=a*g,y=a*p,b=s*g,w=s*p;a=Math.max(Math.abs(v+w),Math.abs(v-w))+31>>5<<5,s=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else a=a+31>>5<<5;if(s>h&&(h=s),f+a>=2048&&(f=0,d+=h,h=0),d+s>=$C)break;i.translate((f+(a>>1))/o,(d+(s>>1))/o),n.rotate&&i.rotate(n.rotate*xC),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=a,n.height=s,n.xoff=f,n.yoff=d,n.x1=a>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=a}for(var x=i.getImageData(0,0,2048/o,$C/o).data,$=[];--r>=0;)if((n=e[r]).hasText){for(u=(a=n.width)>>5,s=n.y1-n.y0,c=0;c<s*u;c++)$[c]=0;if(null==(f=n.xoff))return;d=n.yoff;var k=0,M=-1;for(l=0;l<s;l++){for(c=0;c<a;c++){var A=x[2048*(d+l)+(f+c)<<2]?1<<31-c%32:0;$[u*l+(c>>5)]|=A,k|=A}k?M=l:(n.y0++,s--,l--,d++)}n.y1=n.y0+M,n.sprite=$.slice(0,(n.y1-n.y0)*u)}}}function MC(t,n,e){for(var r,i=t.sprite,o=t.width>>5,a=t.x-(o<<4),u=127&a,s=32-u,c=t.y1-t.y0,l=(t.y+t.y0)*(e>>=5)+(a>>5),f=0;f<c;f++){r=0;for(var d=0;d<=o;d++)if((r<<s|(d<o?(r=i[f*o+d])>>>u:0))&n[l+d])return!0;l+=e}return!1}function AC(t,n){var e=t[0],r=t[1];n.x+n.x0<e.x&&(e.x=n.x+n.x0),n.y+n.y0<e.y&&(e.y=n.y+n.y0),n.x+n.x1>r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function DC(t,n){return t.x+t.x1>n[0].x&&t.x+t.x0<n[1].x&&t.y+t.y1>n[0].y&&t.y+t.y0<n[1].y}function SC(t){var n=t[0]/t[1];return function(t){return[n*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function FC(t){return"function"==typeof t?t:function(){return t}}var EC={archimedean:SC,rectangular:function(t){var n=4*t[0]/t[1],e=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:e+=n;break;case 1:r+=4;break;case 2:e-=n;break;default:r-=4}return[e,r]}}};const NC=["x","y","font","fontSize","fontStyle","fontWeight","angle"],CC=["text","font","rotate","fontSize","fontStyle","fontWeight"];function OC(t){Oa.call(this,function(){var t,n,e,r,i,o,a,u=[256,256],s=SC,c=[],l=Math.random,f={};function d(t,n,e){for(var r,i,o,a=n.x,c=n.y,f=Math.hypot(u[0],u[1]),d=s(u),h=l()<.5?1:-1,m=-h;(r=d(m+=h))&&(i=~~r[0],o=~~r[1],!(Math.min(Math.abs(i),Math.abs(o))>=f));)if(n.x=a+i,n.y=c+o,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>u[0]||n.y+n.y1>u[1])&&(!e||!MC(n,t,u[0]))&&(!e||DC(n,e))){for(var p,g=n.sprite,v=n.width>>5,y=u[0]>>5,b=n.x-(v<<4),w=127&b,x=32-w,$=n.y1-n.y0,k=(n.y+n.y0)*y+(b>>5),M=0;M<$;M++){p=0;for(var A=0;A<=v;A++)t[k+A]|=p<<x|(A<v?(p=g[M*v+A])>>>w:0);k+=y}return n.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=2048/n,t.height=$C/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(hl()),f=function(t){for(var n=[],e=-1;++e<t;)n[e]=0;return n}((u[0]>>5)*u[1]),h=null,m=c.length,p=-1,g=[],v=c.map((u=>({text:t(u),font:n(u),style:r(u),weight:i(u),rotate:o(u),size:~~(e(u)+1e-14),padding:a(u),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:u}))).sort(((t,n)=>n.size-t.size));++p<m;){var y=v[p];y.x=u[0]*(l()+.5)>>1,y.y=u[1]*(l()+.5)>>1,kC(s,y,v,p),y.hasText&&d(f,y,h)&&(g.push(y),h?AC(h,y):h=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=u[0]>>1,y.y-=u[1]>>1)}return g},f.words=function(t){return arguments.length?(c=t,f):c},f.size=function(t){return arguments.length?(u=[+t[0],+t[1]],f):u},f.font=function(t){return arguments.length?(n=FC(t),f):n},f.fontStyle=function(t){return arguments.length?(r=FC(t),f):r},f.fontWeight=function(t){return arguments.length?(i=FC(t),f):i},f.rotate=function(t){return arguments.length?(o=FC(t),f):o},f.text=function(n){return arguments.length?(t=FC(n),f):t},f.spiral=function(t){return arguments.length?(s=EC[t]||t,f):s},f.fontSize=function(t){return arguments.length?(e=FC(t),f):e},f.padding=function(t){return arguments.length?(a=FC(t),f):a},f.random=function(t){return arguments.length?(l=t,f):l},f}(),t)}OC.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:NC}]},pt(OC,Oa,{transform(t,n){!t.size||t.size[0]&&t.size[1]||p("Wordcloud size dimensions must be non-zero.");const e=t.modified();if(!(e||n.changed(n.ADD_REM)||CC.some((function(e){const r=t[e];return tt(r)&&n.modified(r.fields)}))))return;const r=n.materialize(n.SOURCE).source,i=this.value,o=t.as||NC;let a,u=t.fontSize||14;if(tt(u)?a=t.fontSizeRange:u=at(u),a){const t=u,n=ng("sqrt")().domain(ct(r,t)).range(a);u=e=>n(t(e))}r.forEach((t=>{t[o[0]]=NaN,t[o[1]]=NaN,t[o[3]]=0}));const s=i.words(r).text(t.text).size(t.size||[500,500]).padding(t.padding||1).spiral(t.spiral||"archimedean").rotate(t.rotate||0).font(t.font||"sans-serif").fontStyle(t.fontStyle||"normal").fontWeight(t.fontWeight||"normal").fontSize(u).random(Ia).layout(),c=i.size(),l=c[0]>>1,f=c[1]>>1,d=s.length;for(let t,n,e=0;e<d;++e)t=s[e],n=t.datum,n[o[0]]=t.x+l,n[o[1]]=t.y+f,n[o[2]]=t.font,n[o[3]]=t.size,n[o[4]]=t.style,n[o[5]]=t.weight,n[o[6]]=t.rotate;return n.reflow(e).modifies(o)}});var _C=Object.freeze({__proto__:null,wordcloud:OC});const zC=t=>new Uint8Array(t),BC=t=>new Uint16Array(t),TC=t=>new Uint32Array(t);function PC(t,n,e){const r=(n<257?zC:n<65537?BC:TC)(t);return e&&r.set(e),r}function jC(t,n,e){const r=1<<n;return{one:r,zero:~r,range:e.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd(t,n){const e=this,i=e.bisect(e.range,t.value),o=t.index,a=i[0],u=i[1],s=o.length;let c;for(c=0;c<a;++c)n[o[c]]|=r;for(c=u;c<s;++c)n[o[c]]|=r;return e}}}function RC(){let t=TC(0),n=[],e=0;return{insert:function(r,i,o){if(!i.length)return[];const a=e,u=i.length,s=TC(u);let c,l,f,d=Array(u);for(f=0;f<u;++f)d[f]=r(i[f]),s[f]=f;if(d=function(t,n){return t.sort.call(n,((n,e)=>{const r=t[n],i=t[e];return r<i?-1:r>i?1:0})),function(t,n){return Array.from(n,(n=>t[n]))}(t,n)}(d,s),a)c=n,l=t,n=Array(a+u),t=TC(a+u),function(t,n,e,r,i,o,a,u,s){let c,l=0,f=0;for(c=0;l<r&&f<a;++c)n[l]<i[f]?(u[c]=n[l],s[c]=e[l++]):(u[c]=i[f],s[c]=o[f++]+t);for(;l<r;++l,++c)u[c]=n[l],s[c]=e[l];for(;f<a;++f,++c)u[c]=i[f],s[c]=o[f]+t}(o,c,l,a,d,s,u,n,t);else{if(o>0)for(f=0;f<u;++f)s[f]+=o;n=d,t=s}return e=a+u,{index:s,value:d}},remove:function(r,i){const o=e;let a,u,s;for(u=0;!i[t[u]]&&u<o;++u);for(s=u;u<o;++u)i[a=t[u]]||(t[s]=a,n[s]=n[u],++s);e=o-r},bisect:function(t,r){let i;return r?i=r.length:(r=n,i=e),[on(r,t[0],0,i),rn(r,t[1],0,i)]},reindex:function(n){for(let r=0,i=e;r<i;++r)t[r]=n[t[r]]},index:()=>t,size:()=>e}}function LC(t){Oa.call(this,function(){let t=8,n=[],e=TC(0),r=PC(0,t),i=PC(0,t);return{data:()=>n,seen:()=>e=function(t,n,e){return t.length>=n?t:((e=e||new t.constructor(n)).set(t),e)}(e,n.length),add(t){for(let e,r=0,i=n.length,o=t.length;r<o;++r)e=t[r],e._index=i++,n.push(e)},remove(t,e){const o=n.length,a=Array(o-t),u=n;let s,c,l;for(c=0;!e[c]&&c<o;++c)a[c]=n[c],u[c]=c;for(l=c;c<o;++c)s=n[c],e[c]?u[c]=-1:(u[c]=l,r[l]=r[c],i[l]=i[c],a[l]=s,s._index=l++),r[c]=0;return n=a,u},size:()=>n.length,curr:()=>r,prev:()=>i,reset:t=>i[t]=r[t],all:()=>t<257?255:t<65537?65535:4294967295,set(t,n){r[t]|=n},clear(t,n){r[t]&=~n},resize(n,e){(n>r.length||e>t)&&(t=Math.max(e,t),r=PC(n,t,r),i=PC(n,t))}}}(),t),this._indices=null,this._dims=null}function IC(t){Oa.call(this,null,t)}LC.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}}]},pt(LC,Oa,{transform(t,n){return this._dims?t.modified("fields")||t.fields.some((t=>n.modified(t.fields)))?this.reinit(t,n):this.eval(t,n):this.init(t,n)},init(t,n){const e=t.fields,r=t.query,i=this._indices={},o=this._dims=[],a=r.length;let u,s,c=0;for(;c<a;++c)u=e[c].fname,s=i[u]||(i[u]=RC()),o.push(jC(s,c,r[c]));return this.eval(t,n)},reinit(t,n){const e=n.materialize().fork(),r=t.fields,i=t.query,o=this._indices,a=this._dims,u=this.value,s=u.curr(),c=u.prev(),l=u.all(),f=e.rem=e.add,d=e.mod,h=i.length,m={};let p,g,v,y,b,w,x,$,k;if(c.set(s),n.rem.length&&(b=this.remove(t,n,e)),n.add.length&&u.add(n.add),n.mod.length)for(w={},y=n.mod,x=0,$=y.length;x<$;++x)w[y[x]._index]=1;for(x=0;x<h;++x)k=r[x],(!a[x]||t.modified("fields",x)||n.modified(k.fields))&&(v=k.fname,(p=m[v])||(o[v]=g=RC(),m[v]=p=g.insert(k,n.source,0)),a[x]=jC(g,x,i[x]).onAdd(p,s));for(x=0,$=u.data().length;x<$;++x)b[x]||(c[x]!==s[x]?f.push(x):w[x]&&s[x]!==l&&d.push(x));return u.mask=(1<<h)-1,e},eval(t,n){const e=n.materialize().fork(),r=this._dims.length;let i=0;return n.rem.length&&(this.remove(t,n,e),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,n,e)),n.add.length&&(this.insert(t,n,e),i|=(1<<r)-1),n.mod.length&&(this.modify(n,e),i|=(1<<r)-1),this.value.mask=i,e},insert(t,n,e){const r=n.add,i=this.value,o=this._dims,a=this._indices,u=t.fields,s={},c=e.add,l=i.size()+r.length,f=o.length;let d,h,m,p=i.size();i.resize(l,f),i.add(r);const g=i.curr(),v=i.prev(),y=i.all();for(d=0;d<f;++d)h=u[d].fname,m=s[h]||(s[h]=a[h].insert(u[d],r,p)),o[d].onAdd(m,g);for(;p<l;++p)v[p]=y,g[p]!==y&&c.push(p)},modify(t,n){const e=n.mod,r=this.value,i=r.curr(),o=r.all(),a=t.mod;let u,s,c;for(u=0,s=a.length;u<s;++u)c=a[u]._index,i[c]!==o&&e.push(c)},remove(t,n,e){const r=this._indices,i=this.value,o=i.curr(),a=i.prev(),u=i.all(),s={},c=e.rem,l=n.rem;let f,d,h,m;for(f=0,d=l.length;f<d;++f)h=l[f]._index,s[h]=1,a[h]=m=o[h],o[h]=u,m!==u&&c.push(h);for(h in r)r[h].remove(d,s);return this.reindex(n,d,s),s},reindex(t,n,e){const r=this._indices,i=this.value;t.runAfter((()=>{const t=i.remove(n,e);for(const n in r)r[n].reindex(t)}))},update(t,n,e){const r=this._dims,i=t.query,o=n.stamp,a=r.length;let u,s,c=0;for(e.filters=0,s=0;s<a;++s)t.modified("query",s)&&(u=s,++c);if(1===c)c=r[u].one,this.incrementOne(r[u],i[u],e.add,e.rem);else for(s=0,c=0;s<a;++s)t.modified("query",s)&&(c|=r[s].one,this.incrementAll(r[s],i[s],o,e.add),e.rem=e.add);return c},incrementAll(t,n,e,r){const i=this.value,o=i.seen(),a=i.curr(),u=i.prev(),s=t.index(),c=t.bisect(t.range),l=t.bisect(n),f=l[0],d=l[1],h=c[0],m=c[1],p=t.one;let g,v,y;if(f<h)for(g=f,v=Math.min(h,d);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(f>h)for(g=h,v=Math.min(f,m);g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;if(d>m)for(g=Math.max(f,m),v=d;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;else if(d<m)for(g=Math.max(h,d),v=m;g<v;++g)y=s[g],o[y]!==e&&(u[y]=a[y],o[y]=e,r.push(y)),a[y]^=p;t.range=n.slice()},incrementOne(t,n,e,r){const i=this.value.curr(),o=t.index(),a=t.bisect(t.range),u=t.bisect(n),s=u[0],c=u[1],l=a[0],f=a[1],d=t.one;let h,m,p;if(s<l)for(h=s,m=Math.min(l,c);h<m;++h)p=o[h],i[p]^=d,e.push(p);else if(s>l)for(h=l,m=Math.min(s,f);h<m;++h)p=o[h],i[p]^=d,r.push(p);if(c>f)for(h=Math.max(s,f),m=c;h<m;++h)p=o[h],i[p]^=d,e.push(p);else if(c<f)for(h=Math.max(l,c),m=f;h<m;++h)p=o[h],i[p]^=d,r.push(p);t.range=n.slice()}}),IC.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."}]},pt(IC,Oa,{transform(t,n){const e=~(t.ignore||0),r=t.filter,i=r.mask;if(!(i&e))return n.StopPropagation;const o=n.fork(n.ALL),a=r.data(),u=r.curr(),s=r.prev(),c=t=>u[t]&e?null:a[t];return o.filter(o.MOD,c),i&i-1?(o.filter(o.ADD,(t=>{const n=u[t]&e;return!n&&n^s[t]&e?a[t]:null})),o.filter(o.REM,(t=>!(u[t]&e)||s[t]&e?null:a[t]))):(o.filter(o.ADD,c),o.filter(o.REM,(t=>(u[t]&e)===i?a[t]:null))),o.filter(o.SOURCE,(t=>c(t._index)))}});var qC=Object.freeze({__proto__:null,crossfilter:LC,resolvefilter:IC});const UC="Literal",WC="CallExpression";function HC(t){this.type=t}var GC,YC,VC,XC,JC;HC.prototype.visit=function(t){let n,e,r;if(t(this))return 1;for(n=function(t){switch(t.type){case"ArrayExpression":return t.elements;case"BinaryExpression":case"LogicalExpression":return[t.left,t.right];case WC:return[t.callee].concat(t.arguments);case"ConditionalExpression":return[t.test,t.consequent,t.alternate];case"MemberExpression":return[t.object,t.property];case"ObjectExpression":return t.properties;case"Property":return[t.key,t.value];case"UnaryExpression":return[t.argument];default:return[]}}(this),e=0,r=n.length;e<r;++e)if(n[e].visit(t))return 1},(GC={})[1]="Boolean",GC[2]="<end>",GC[3]="Identifier",GC[4]="Keyword",GC[5]="Null",GC[6]="Numeric",GC[7]="Punctuator",GC[8]="String",GC[9]="RegularExpression";var KC="Identifier",QC="Unexpected token %0",ZC="Invalid regular expression",tO="Invalid regular expression: missing /",nO="Octal literals are not allowed in strict mode.",eO="ILLEGAL",rO="Disabled.",iO=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]"),oO=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 aO(t,n){if(!t)throw new Error("ASSERT: "+n)}function uO(t){return t>=48&&t<=57}function sO(t){return"0123456789abcdefABCDEF".includes(t)}function cO(t){return"01234567".includes(t)}function lO(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 fO(t){return 10===t||13===t||8232===t||8233===t}function dO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&iO.test(String.fromCharCode(t))}function hO(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&oO.test(String.fromCharCode(t))}const mO={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 pO(){for(;VC<XC;){const t=YC.charCodeAt(VC);if(!lO(t)&&!fO(t))break;++VC}}function gO(t){var n,e,r,i=0;for(e="u"===t?4:2,n=0;n<e;++n)VC<XC&&sO(YC[VC])?(r=YC[VC++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):NO({},QC,eO);return String.fromCharCode(i)}function vO(){var t,n;for(n=0,"}"===(t=YC[VC])&&NO({},QC,eO);VC<XC&&sO(t=YC[VC++]);)n=16*n+"0123456789abcdef".indexOf(t.toLowerCase());return(n>1114111||"}"!==t)&&NO({},QC,eO),n<=65535?String.fromCharCode(n):String.fromCharCode(55296+(n-65536>>10),56320+(n-65536&1023))}function yO(){var t,n;for(t=YC.charCodeAt(VC++),n=String.fromCharCode(t),92===t&&(117!==YC.charCodeAt(VC)&&NO({},QC,eO),++VC,(t=gO("u"))&&"\\"!==t&&dO(t.charCodeAt(0))||NO({},QC,eO),n=t);VC<XC&&hO(t=YC.charCodeAt(VC));)++VC,n+=String.fromCharCode(t),92===t&&(n=n.substr(0,n.length-1),117!==YC.charCodeAt(VC)&&NO({},QC,eO),++VC,(t=gO("u"))&&"\\"!==t&&hO(t.charCodeAt(0))||NO({},QC,eO),n+=t);return n}function bO(){var t,n,e,r,i=VC,o=YC.charCodeAt(VC),a=YC[VC];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++VC,{type:7,value:String.fromCharCode(o),start:i,end:VC};default:if(61===(t=YC.charCodeAt(VC+1)))switch(o){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return VC+=2,{type:7,value:String.fromCharCode(o)+String.fromCharCode(t),start:i,end:VC};case 33:case 61:return 61===YC.charCodeAt(VC+=2)&&++VC,{type:7,value:YC.slice(i,VC),start:i,end:VC}}}return">>>="===(r=YC.substr(VC,4))?{type:7,value:r,start:i,end:VC+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:7,value:e,start:i,end:VC+=3}:a===(n=e.substr(0,2))[1]&&"+-<>&|".includes(a)||"=>"===n?{type:7,value:n,start:i,end:VC+=2}:("//"===n&&NO({},QC,eO),"<>=!+-*%&|^/".includes(a)?{type:7,value:a,start:i,end:++VC}:void NO({},QC,eO))}function wO(){var t,n,e;if(aO(uO((e=YC[VC]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=VC,t="","."!==e){if(t=YC[VC++],e=YC[VC],"0"===t){if("x"===e||"X"===e)return++VC,function(t){let n="";for(;VC<XC&&sO(YC[VC]);)n+=YC[VC++];return 0===n.length&&NO({},QC,eO),dO(YC.charCodeAt(VC))&&NO({},QC,eO),{type:6,value:parseInt("0x"+n,16),start:t,end:VC}}(n);if(cO(e))return function(t){let n="0"+YC[VC++];for(;VC<XC&&cO(YC[VC]);)n+=YC[VC++];return(dO(YC.charCodeAt(VC))||uO(YC.charCodeAt(VC)))&&NO({},QC,eO),{type:6,value:parseInt(n,8),octal:!0,start:t,end:VC}}(n);e&&uO(e.charCodeAt(0))&&NO({},QC,eO)}for(;uO(YC.charCodeAt(VC));)t+=YC[VC++];e=YC[VC]}if("."===e){for(t+=YC[VC++];uO(YC.charCodeAt(VC));)t+=YC[VC++];e=YC[VC]}if("e"===e||"E"===e)if(t+=YC[VC++],"+"!==(e=YC[VC])&&"-"!==e||(t+=YC[VC++]),uO(YC.charCodeAt(VC)))for(;uO(YC.charCodeAt(VC));)t+=YC[VC++];else NO({},QC,eO);return dO(YC.charCodeAt(VC))&&NO({},QC,eO),{type:6,value:parseFloat(t),start:n,end:VC}}function xO(){if(pO(),VC>=XC)return{type:2,start:VC,end:VC};const t=YC.charCodeAt(VC);return dO(t)?function(){var t,n;return t=VC,n=92===YC.charCodeAt(VC)?yO():function(){var t,n;for(t=VC++;VC<XC;){if(92===(n=YC.charCodeAt(VC)))return VC=t,yO();if(!hO(n))break;++VC}return YC.slice(t,VC)}(),{type:1===n.length?3:mO.hasOwnProperty(n)?4:"null"===n?5:"true"===n||"false"===n?1:3,value:n,start:t,end:VC}}():40===t||41===t||59===t?bO():39===t||34===t?function(){var t,n,e,r,i="",o=!1;for(aO("'"===(t=YC[VC])||'"'===t,"String literal must starts with a quote"),n=VC,++VC;VC<XC;){if((e=YC[VC++])===t){t="";break}if("\\"===e)if((e=YC[VC++])&&fO(e.charCodeAt(0)))"\r"===e&&"\n"===YC[VC]&&++VC;else switch(e){case"u":case"x":"{"===YC[VC]?(++VC,i+=vO()):i+=gO(e);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:cO(e)?(0!==(r="01234567".indexOf(e))&&(o=!0),VC<XC&&cO(YC[VC])&&(o=!0,r=8*r+"01234567".indexOf(YC[VC++]),"0123".includes(e)&&VC<XC&&cO(YC[VC])&&(r=8*r+"01234567".indexOf(YC[VC++]))),i+=String.fromCharCode(r)):i+=e}else{if(fO(e.charCodeAt(0)))break;i+=e}}return""!==t&&NO({},QC,eO),{type:8,value:i,octal:o,start:n,end:VC}}():46===t?uO(YC.charCodeAt(VC+1))?wO():bO():uO(t)?wO():bO()}function $O(){const t=JC;return VC=t.end,JC=xO(),VC=t.end,t}function kO(){const t=VC;JC=xO(),VC=t}function MO(t,n,e){const r=new HC("||"===t||"&&"===t?"LogicalExpression":"BinaryExpression");return r.operator=t,r.left=n,r.right=e,r}function AO(t,n){const e=new HC("CallExpression");return e.callee=t,e.arguments=n,e}function DO(t){const n=new HC(KC);return n.name=t,n}function SO(t){const n=new HC("Literal");return n.value=t.value,n.raw=YC.slice(t.start,t.end),t.regex&&("//"===n.raw&&(n.raw="/(?:)/"),n.regex=t.regex),n}function FO(t,n,e){const r=new HC("MemberExpression");return r.computed="["===t,r.object=n,r.property=e,r.computed||(e.member=!0),r}function EO(t,n,e){const r=new HC("Property");return r.key=n,r.value=e,r.kind=t,r}function NO(t,n){var e,r=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,((t,n)=>(aO(n<r.length,"Message reference must be in range"),r[n])));throw(e=new Error(i)).index=VC,e.description=i,e}function CO(t){2===t.type&&NO(t,"Unexpected end of input"),6===t.type&&NO(t,"Unexpected number"),8===t.type&&NO(t,"Unexpected string"),3===t.type&&NO(t,"Unexpected identifier"),4===t.type&&NO(t,"Unexpected reserved word"),NO(t,QC,t.value)}function OO(t){const n=$O();7===n.type&&n.value===t||CO(n)}function _O(t){return 7===JC.type&&JC.value===t}function zO(t){return 4===JC.type&&JC.value===t}function BO(){VC=JC.start;const t=$O();return 8===t.type||6===t.type?(t.octal&&NO(t,nO),SO(t)):DO(t.value)}function TO(){var t,n,e;return VC=JC.start,3===(t=JC).type?(e=BO(),OO(":"),EO("init",e,WO())):2!==t.type&&7!==t.type?(n=BO(),OO(":"),EO("init",n,WO())):void CO(t)}const PO={if:1};function jO(){var t,n,e;if(_O("("))return function(){OO("(");const t=HO();return OO(")"),t}();if(_O("["))return function(){const t=[];for(VC=JC.start,OO("[");!_O("]");)_O(",")?($O(),t.push(null)):(t.push(WO()),_O("]")||OO(","));return $O(),function(t){const n=new HC("ArrayExpression");return n.elements=t,n}(t)}();if(_O("{"))return function(){var t,n,e=[],r={},i=String;for(VC=JC.start,OO("{");!_O("}");)n="$"+((t=TO()).key.type===KC?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,n)?NO({},"Duplicate data property in object literal not allowed in strict mode"):r[n]=!0,e.push(t),_O("}")||OO(",");return OO("}"),function(t){const n=new HC("ObjectExpression");return n.properties=t,n}(e)}();if(VC=JC.start,3===(t=JC.type)||PO[JC.value])e=DO($O().value);else if(8===t||6===t)JC.octal&&NO(JC,nO),e=SO($O());else{if(4===t)throw new Error(rO);1===t?((n=$O()).value="true"===n.value,e=SO(n)):5===t?((n=$O()).value=null,e=SO(n)):_O("/")||_O("/=")?(e=SO(function(){var t,n,e,r;return JC=null,pO(),t=VC,n=function(){var t,n,e,r;for(aO("/"===(t=YC[VC]),"Regular expression literal must start with a slash"),n=YC[VC++],e=!1,r=!1;VC<XC;)if(n+=t=YC[VC++],"\\"===t)fO((t=YC[VC++]).charCodeAt(0))&&NO({},tO),n+=t;else if(fO(t.charCodeAt(0)))NO({},tO);else if(e)"]"===t&&(e=!1);else{if("/"===t){r=!0;break}"["===t&&(e=!0)}return r||NO({},tO),{value:n.substr(1,n.length-2),literal:n}}(),e=function(){var t,n,e;for(n="",e="";VC<XC&&hO((t=YC[VC]).charCodeAt(0));)++VC,"\\"===t&&VC<XC?NO({},QC,eO):(e+=t,n+=t);return e.search(/[^gimuy]/g)>=0&&NO({},ZC,e),{value:e,literal:n}}(),r=function(t,n){let e=t;n.includes("u")&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,((t,n)=>{if(parseInt(n,16)<=1114111)return"x";NO({},ZC)})).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:VC}}()),kO()):CO($O())}return e}function RO(){const t=[];if(OO("("),!_O(")"))for(;VC<XC&&(t.push(WO()),!_O(")"));)OO(",");return OO(")"),t}function LO(){OO("[");const t=HO();return OO("]"),t}function IO(){const t=function(){var t;for(t=jO();;)if(_O("."))t=FO(".",t,(OO("."),function(){VC=JC.start;const t=$O();return function(t){return 3===t.type||4===t.type||1===t.type||5===t.type}(t)||CO(t),DO(t.value)}()));else if(_O("("))t=AO(t,RO());else{if(!_O("["))break;t=FO("[",t,LO())}return t}();if(7===JC.type&&(_O("++")||_O("--")))throw new Error(rO);return t}function qO(){var t,n;if(7!==JC.type&&4!==JC.type)n=IO();else{if(_O("++")||_O("--"))throw new Error(rO);if(_O("+")||_O("-")||_O("~")||_O("!"))t=$O(),n=qO(),n=function(t,n){const e=new HC("UnaryExpression");return e.operator=t,e.argument=n,e.prefix=!0,e}(t.value,n);else{if(zO("delete")||zO("void")||zO("typeof"))throw new Error(rO);n=IO()}}return n}function UO(t){let n=0;if(7!==t.type&&4!==t.type)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function WO(){var t,n;return t=function(){var t,n,e,r,i,o,a,u,s,c;if(t=JC,s=qO(),0===(i=UO(r=JC)))return s;for(r.prec=i,$O(),n=[t,JC],o=[s,r,a=qO()];(i=UO(JC))>0;){for(;o.length>2&&i<=o[o.length-2].prec;)a=o.pop(),u=o.pop().value,s=o.pop(),n.pop(),e=MO(u,s,a),o.push(e);(r=$O()).prec=i,o.push(r),n.push(JC),e=qO(),o.push(e)}for(e=o[c=o.length-1],n.pop();c>1;)n.pop(),e=MO(o[c-1].value,o[c-2],e),c-=2;return e}(),_O("?")&&($O(),n=WO(),OO(":"),t=function(t,n,e){const r=new HC("ConditionalExpression");return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,WO())),t}function HO(){const t=WO();if(_O(","))throw new Error(rO);return t}function GO(t){VC=0,XC=(YC=t).length,JC=null,kO();const n=HO();if(2!==JC.type)throw new Error("Unexpect token after expression.");return n}var YO={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 VO(t){function n(n,e,r){return i=>function(n,e,r,i){let o=t(e[0]);return r&&(o=r+"("+o+")",0===r.lastIndexOf("new ",0)&&(o="("+o+")")),o+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}const e="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(n){n.length<3&&p("Missing arguments to clamp function."),n.length>3&&p("Too many arguments to clamp function.");const e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:i,test:n("test",i),if:function(n){n.length<3&&p("Missing arguments to if function."),n.length>3&&p("Too many arguments to if function.");const e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}function XO(t){const n=(t=t||{}).allowed?Bt(t.allowed):{},e=t.forbidden?Bt(t.forbidden):{},r=t.constants||YO,i=(t.functions||VO)(f),o=t.globalvar,a=t.fieldvar,u=tt(o)?o:t=>`${o}["${t}"]`;new Set([...Object.getOwnPropertyNames(Object.prototype).filter((t=>"function"==typeof Object.prototype[t])),"__proto__"]);let s={},c={},l=0;function f(t){if($t(t))return t;const n=d[t.type];return null==n&&p("Unsupported type: "+t.type),n(t)}const d={Literal:t=>t.raw,Identifier:t=>{const i=t.name;return l>0?i:ft(e,i)?p("Illegal identifier: "+i):ft(r,i)?r[i]:ft(n,i)?i:(s[i]=1,u(i))},MemberExpression:t=>{const n=!t.computed,e=f(t.object);n&&(l+=1);const r=f(t.property);return e===a&&(c[function(t){const n=t&&t.length-1;return n&&('"'===t[0]&&'"'===t[n]||"'"===t[0]&&"'"===t[n])?t.slice(1,-1):t}(r)]=1),n&&(l-=1),e+(n?"."+r:"["+r+"]")},CallExpression:t=>{"Identifier"!==t.callee.type&&p("Illegal callee type: "+t.callee.type);const n=t.callee.name,e=t.arguments,r=ft(i,n)&&i[n];return r||p("Unrecognized function: "+n),tt(r)?r(e):r+"("+e.map(f).join(",")+")"},ArrayExpression:t=>"["+t.elements.map(f).join(",")+"]",BinaryExpression:t=>"("+f(t.left)+" "+t.operator+" "+f(t.right)+")",UnaryExpression:t=>"("+t.operator+f(t.argument)+")",ConditionalExpression:t=>"("+f(t.test)+"?"+f(t.consequent)+":"+f(t.alternate)+")",LogicalExpression:t=>"("+f(t.left)+t.operator+f(t.right)+")",ObjectExpression:t=>{for(const n of t.properties){const t=n.key.name;M.has(t)&&p("Illegal property: "+t)}return"{"+t.properties.map(f).join(",")+"}"},Property:t=>{l+=1;const n=f(t.key);return l-=1,n+":"+f(t.value)}};function h(t){const n={code:f(t),globals:Object.keys(s),fields:Object.keys(c)};return s={},c={},n}return h.functions=i,h.constants=r,h}const JO=Symbol("vega_selection_getter");function KO(t){return t.getter&&t.getter[JO]||(t.getter=v(t.field),t.getter[JO]=!0),t.getter}const QO="intersect",ZO="union",t_="or",n_="and",e_="_vgsid_",r_=v(e_),i_="index:unit";function o_(t,n){for(var e,r,i=n.fields,o=n.values,a=i.length,u=0;u<a;++u)if(yt(e=KO(r=i[u])(t))&&(e=z(e)),yt(o[u])&&(o[u]=z(o[u])),S(o[u])&&yt(o[u][0])&&(o[u]=o[u].map(z)),"E"===r.type){if(S(o[u])?!o[u].includes(e):e!==o[u])return!1}else if("R"===r.type){if(!gt(e,o[u]))return!1}else if("R-RE"===r.type){if(!gt(e,o[u],!0,!1))return!1}else if("R-E"===r.type){if(!gt(e,o[u],!1,!1))return!1}else if("R-LE"===r.type){if(!gt(e,o[u],!1,!0))return!1}else if("E-LT"===r.type){if(e>=o[u])return!1}else if("E-LTE"===r.type){if(e>o[u])return!1}else if("E-GT"===r.type){if(e<=o[u])return!1}else if("E-GTE"===r.type){if(e<o[u])return!1}else if("E-VALID"===r.type){if(null===e||isNaN(e))return!1}else if("E-ONE"===r.type&&-1===o[u].indexOf(e))return!1;return!0}const a_=Zt(r_),u_=a_.left,s_=a_.right;var c_={[`${e_}_union`]:function(...t){const n=new sn;for(const e of t)for(const t of e)n.add(t);return n},[`${e_}_intersect`]:function(t,...n){t=new sn(t),n=n.map(Cn);t:for(const e of t)for(const r of n)if(!r.has(e)){t.delete(e);continue t}return t},E_union:function(t,n){if(!t.length)return n;for(var e=0,r=n.length;e<r;++e)t.includes(n[e])||t.push(n[e]);return t},E_intersect:function(t,n){return t.length?t.filter((t=>n.includes(t))):n},R_union:function(t,n){var e=z(n[0]),r=z(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]<r&&(t[1]=r),t):[e,r]},R_intersect:function(t,n){var e=z(n[0]),r=z(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?r<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>r&&(t[1]=r),t):[e,r]}};function l_(t,n,e,r){n[0].type!==UC&&p("First argument to selection functions must be a string literal.");const i=n[0].value,o="unit",a="@"+o,u=":"+i;(n.length>=2&&_(n).value)!==QO||ft(r,a)||(r[a]=e.getData(i).indataRef(e,o)),ft(r,u)||(r[u]=e.getData(i).tuplesRef())}function f_(t){const n=this.context.data[t];return n?n.values.value:[]}const d_=t=>function(n,e){const r=this.context.dataflow.locale();return null===n?"null":r[t](e)(n)},h_=d_("format"),m_=d_("timeFormat"),p_=d_("utcFormat"),g_=d_("timeParse"),v_=d_("utcParse"),y_=new Date(2e3,0,1);function b_(t,n,e){return Number.isInteger(t)&&Number.isInteger(n)?(y_.setYear(2e3),y_.setMonth(t),y_.setDate(n),m_.call(this,y_,e)):""}function w_(t,n,e,r){n[0].type!==UC&&p("First argument to data functions must be a string literal.");const i=n[0].value,o=":"+i;if(!ft(o,r))try{r[o]=e.getData(i).tuplesRef()}catch(t){}}function x_(t,n,e,r){if(n[0].type===UC)$_(e,r,n[0].value);else for(t in e.scales)$_(e,r,t)}function $_(t,n,e){const r="%"+e;if(!ft(n,r))try{n[r]=t.scaleRef(e)}catch(t){}}function k_(t,n){if($t(t)){const e=n.scales[t];return e&&tg(e.value)?e.value:void 0}if(tt(t))return tg(t)?t:void 0}function M_(t,n){return function(e,r,i){if(e){const n=k_(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const A_=M_("area",(function(t){return uM=new an,Uk(t,sM),2*uM})),D_=M_("bounds",(function(t){var n,e,r,i,o,a,u;if(Qk=Kk=-(Xk=Jk=1/0),iM=[],Uk(t,TM),e=iM.length){for(iM.sort(HM),n=1,o=[r=iM[0]];n<e;++n)GM(r,(i=iM[n])[0])||GM(r,i[1])?(WM(r[0],i[1])>WM(r[0],r[1])&&(r[1]=i[1]),WM(i[0],r[1])>WM(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,n=0,r=o[e=o.length-1];n<=e;r=i,++n)(u=WM(r[1],(i=o[n])[0]))>a&&(a=u,Xk=i[0],Kk=r[1])}return iM=oM=null,Xk===1/0||Jk===1/0?[[NaN,NaN],[NaN,NaN]]:[[Xk,Jk],[Kk,Qk]]})),S_=M_("centroid",(function(t){wM=xM=$M=kM=MM=AM=DM=SM=0,FM=new an,EM=new an,NM=new an,Uk(t,YM);var n=+FM,e=+EM,r=+NM,i=Fk(n,e,r);return i<pk&&(n=AM,e=DM,r=SM,xM<mk&&(n=$M,e=kM,r=MM),(i=Fk(n,e,r))<pk)?[NaN,NaN]:[Mk(e,n)*wk,Tk(r/i)*wk]}));function F_(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function E_(t){const n=t/255;return n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4)}function N_(t){const n=Il(t);return.2126*E_(n.r)+.7152*E_(n.g)+.0722*E_(n.b)}function C_(t,n){return t===n||t!=t&&n!=n||(S(t)?!(!S(n)||t.length!==n.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!C_(t[e],n[e]))return!1;return!0}(t,n):!(!F(t)||!F(n))&&O_(t,n))}function O_(t,n){for(const e in t)if(!C_(t[e],n[e]))return!1;return!0}function __(t){return n=>O_(t,n)}const z_={};function B_(t){return S(t)||ArrayBuffer.isView(t)?t:null}function T_(t){return B_(t)||($t(t)?t:null)}const P_=t=>t.data;function j_(t,n){const e=f_.call(n,t);return e.root&&e.root.lookup||{}}const R_=()=>"undefined"!=typeof window&&window||null;function L_(t,n,e){if(!t)return[];const[r,i]=t,o=(new Rv).set(r[0],r[1],i[0],i[1]);return kx(e||this.context.dataflow.scenegraph().root,o,function(t){let n=null;if(t){const e=Q(t.marktype),r=Q(t.markname);n=t=>(!e.length||e.some((n=>t.marktype===n)))&&(!r.length||r.some((n=>t.name===n)))}return n}(n))}const I_={random:()=>Ia(),cumulativeNormal:Xa,cumulativeLogNormal:nu,cumulativeUniform:uu,densityNormal:Va,densityLogNormal:tu,densityUniform:au,quantileNormal:Ja,quantileLogNormal:eu,quantileUniform:su,sampleNormal:Ya,sampleLogNormal:Za,sampleUniform:ou,isArray:S,isBoolean:vt,isDate:yt,isDefined:t=>void 0!==t,isNumber:wt,isObject:F,isRegExp:xt,isString:$t,isTuple:Zo,isValid:t=>null!=t&&t==t,toBoolean:Ct,toDate:t=>_t(t),toNumber:z,toString:zt,indexof:function(t,...n){return T_(t).indexOf(...n)},join:function(t,...n){return B_(t).join(...n)},lastindexof:function(t,...n){return T_(t).lastIndexOf(...n)},replace:function(t,n,e){return tt(e)&&p("Function argument passed to replace."),$t(n)||xt(n)||p("Please pass a string or RegExp argument to replace."),String(t).replace(n,e)},reverse:function(t){return B_(t).slice().reverse()},sort:function(t){return B_(t).slice().sort(et)},slice:function(t,...n){return T_(t).slice(...n)},flush:mt,lerp:Mt,merge:function(){const t=[].slice.call(arguments);return t.unshift({}),st(...t)},pad:Ft,peek:_,pluck:function(t,n){const e=z_[n]||(z_[n]=v(n));return S(t)?t.map(e):e(t)},span:Et,inrange:gt,truncate:Tt,rgb:Il,lab:ff,hcl:vf,hsl:Jl,luminance:N_,contrast:function(t,n){const e=N_(t),r=N_(n);return(Math.max(e,r)+.05)/(Math.min(e,r)+.05)},sequence:En,format:h_,utcFormat:p_,utcParse:v_,utcOffset:ur,utcSequence:lr,timeFormat:m_,timeParse:g_,timeOffset:ar,timeSequence:cr,timeUnitSpecifier:Oe,monthFormat:function(t){return b_.call(this,t,1,"%B")},monthAbbrevFormat:function(t){return b_.call(this,t,1,"%b")},dayFormat:function(t){return b_.call(this,0,2+t,"%A")},dayAbbrevFormat:function(t){return b_.call(this,0,2+t,"%a")},quarter:J,utcquarter:K,week:Te,utcweek:qe,dayofyear:Be,utcdayofyear:Ie,warn:function(){return F_(this.context.dataflow,"warn",arguments)},info:function(){return F_(this.context.dataflow,"info",arguments)},debug:function(){return F_(this.context.dataflow,"debug",arguments)},extent:t=>ct(t),inScope:function(t){const n=this.context.group;let e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:L_,clampRange:Z,pinchDistance:function(t){const n=t.touches;return Math.hypot(n[0].clientX-n[1].clientX,n[0].clientY-n[1].clientY)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){const t=R_();return t?t.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){const t=R_();return t?[t.innerWidth,t.innerHeight]:[void 0,void 0]},bandspace:function(t,n,e){return Ap(t||0,n||0,e||0)},setdata:function(t,n){const e=this.context.dataflow;return e.pulse(this.context.data[t].input,e.changeset().remove($).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?cv(e,n=n||Qg(t)):t}},panLinear:I,panLog:q,panPow:U,panSymlog:W,zoomLinear:G,zoomLog:Y,zoomPow:V,zoomSymlog:X,encode:function(t,n,e){if(t){const e=this.context.dataflow;e.pulse(t.mark.source,e.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,o){const a=this.context.dataflow,u=this.context.data[t],s=u.input,c=a.stamp();let l,f,d=u.changes;if(!1===a._trigger||!(s.value.length||n||r))return 0;if((!d||d.stamp<c)&&(u.changes=d=a.changeset(),d.stamp=c,a.runAfter((()=>{u.modified=!0,a.pulse(s,d).run()}),!0,1)),e&&(l=!0===e?$:S(e)||Zo(e)?e:__(e),d.remove(l)),n&&d.insert(n),r&&(l=__(r),s.value.some(l)?d.remove(l):d.insert(r)),i)for(f in o)d.modify(i,f,o[f]);return 1},lassoAppend:function(t,n,e,r=5){const i=(t=Q(t))[t.length-1];return void 0===i||Math.hypot(i[0]-n,i[1]-e)>r?[...t,[n,e]]:t},lassoPath:function(t){return Q(t).reduce(((n,[e,r],i)=>n+(0==i?`M ${e},${r} `:i===t.length-1?" Z":`L ${e},${r} `)),"")},intersectLasso:function(t,n,e){const{x:r,y:i,mark:o}=e,a=(new Rv).set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[t,e]of n)t<a.x1&&(a.x1=t),t>a.x2&&(a.x2=t),e<a.y1&&(a.y1=e),e>a.y2&&(a.y2=e);return a.translate(r,i),L_([[a.x1,a.y1],[a.x2,a.y2]],t,o).filter((t=>function(t,n,e){let r=0;for(let i=0,o=e.length-1;i<e.length;o=i++){const[a,u]=e[o],[s,c]=e[i];c>n!=u>n&&t<(a-s)*(n-c)/(u-c)+s&&r++}return 1&r}(t.x,t.y,n)))}},q_=["view","item","group","xy","x","y"],U_="this.",W_={},H_={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:t=>`_[${Nt("$"+t)}]`,functions:function(t){const n=VO(t);q_.forEach((t=>n[t]="event.vega."+t));for(const t in I_)n[t]=U_+t;return st(n,function(t,n,e){n.__bandwidth=t=>t&&t.bandwidth?t.bandwidth():0,e._bandwidth=x_,e._range=x_,e._scale=x_;const r=n=>"_["+(n.type===UC?Nt("%"+n.value):Nt("%")+"+"+t(n))+"]";return{_bandwidth:t=>`this.__bandwidth(${r(t[0])})`,_range:t=>`${r(t[0])}.range()`,_scale:n=>`${r(n[0])}(${t(n[1])})`}}(t,I_,W_)),n},constants:YO,visitors:W_},G_=XO(H_);function Y_(t,n,e){return 1===arguments.length?I_[t]:(I_[t]=n,e&&(W_[t]=e),G_&&(G_.functions[t]=U_+t),this)}function V_(t,n){const e={};let r;try{r=GO(t=$t(t)?t:Nt(t)+"")}catch(n){p("Expression parse error: "+t)}r.visit((t=>{if(t.type!==WC)return;const r=t.callee.name,i=H_.visitors[r];i&&i(r,t.arguments,n,e)}));const i=G_(r);return i.globals.forEach((t=>{const r="$"+t;!ft(e,r)&&n.getSignal(t)&&(e[r]=n.signalRef(t))})),{$expr:st({code:i.code},n.options.ast?{ast:r}:null),$fields:i.fields,$params:e}}Y_("bandwidth",(function(t,n){const e=k_(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0}),x_),Y_("copy",(function(t,n){const e=k_(t,(n||this).context);return e?e.copy():void 0}),x_),Y_("domain",(function(t,n){const e=k_(t,(n||this).context);return e?e.domain():[]}),x_),Y_("range",(function(t,n){const e=k_(t,(n||this).context);return e&&e.range?e.range():[]}),x_),Y_("invert",(function(t,n,e){const r=k_(t,(e||this).context);return r?S(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0}),x_),Y_("scale",(function(t,n,e){const r=k_(t,(e||this).context);return r?r(n):void 0}),x_),Y_("gradient",(function(t,n,e,r,i){t=k_(t,(i||this).context);const o=Wg(n,e);let a=t.domain(),u=a[0],s=_(a),c=b;return s-u?c=mg(t,u,s):t=(t.interpolator?ng("sequential")().interpolator(t.interpolator()):ng("linear")().interpolate(t.interpolate()).range(t.range())).domain([u=0,s=1]),t.ticks&&(a=t.ticks(+r||15),u!==a[0]&&a.unshift(u),s!==_(a)&&a.push(s)),a.forEach((n=>o.stop(c(n),t(n)))),o}),x_),Y_("geoArea",A_,x_),Y_("geoBounds",D_,x_),Y_("geoCentroid",S_,x_),Y_("geoShape",(function(t,n,e){const r=k_(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}}),x_),Y_("geoScale",(function(t,n){const e=k_(t,(n||this).context);return e&&e.scale()}),x_),Y_("indata",(function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i}),(function(t,n,e,r){n[0].type!==UC&&p("First argument to indata must be a string literal."),n[1].type!==UC&&p("Second argument to indata must be a string literal.");const i=n[0].value,o=n[1].value,a="@"+o;ft(a,r)||(r[a]=e.getData(i).indataRef(e,o))})),Y_("data",f_,w_),Y_("treePath",(function(t,n,e){const r=j_(t,this),i=r[n],o=r[e];return i&&o?i.path(o).map(P_):void 0}),w_),Y_("treeAncestors",(function(t,n){const e=j_(t,this)[n];return e?e.ancestors().map(P_):void 0}),w_),Y_("vlSelectionTest",(function(t,n,e){for(var r,i,o,a,u,s=this.context.data[t],c=s?s.values.value:[],l=s?s[i_]&&s[i_].value:void 0,f=e===QO,d=c.length,h=0;h<d;++h)if(r=c[h],l&&f){if(-1===(o=(i=i||{})[a=r.unit]||0))continue;if(u=o_(n,r),i[a]=u?-1:++o,u&&1===l.size)return!0;if(!u&&o===l.get(a).count)return!1}else if(f^(u=o_(n,r)))return u;return d&&f}),l_),Y_("vlSelectionIdTest",(function(t,n,e){const r=this.context.data[t],i=r?r.values.value:[],o=r?r[i_]&&r[i_].value:void 0,a=e===QO,u=r_(n),s=u_(i,u);if(s===i.length)return!1;if(r_(i[s])!==u)return!1;if(o&&a){if(1===o.size)return!0;if(s_(i,u)-s<o.size)return!1}return!0}),l_),Y_("vlSelectionResolve",(function(t,n,e,r){for(var i,o,a,u,s,c,l,f,d,h,m,p=this.context.data[t],g=p?p.values.value:[],v={},y={},b={},w=g.length,x=0;x<w;++x)if(u=(i=g[x]).unit,a=i.values,(o=i.fields)&&a){for(h=0,m=o.length;h<m;++h)f=(l=v[(s=o[h]).field]||(v[s.field]={}))[u]||(l[u]=[]),b[s.field]=d=s.type.charAt(0),l[u]=(0,c_[`${d}_union`])(f,Q(a[h]));e&&(f=y[u]||(y[u]=[])).push(Q(a).reduce(((t,n,e)=>(t[o[e].field]=n,t)),{}))}else s=e_,c=r_(i),(f=(l=v[s]||(v[s]={}))[u]||(l[u]=[])).push(c),e&&(f=y[u]||(y[u]=[])).push({[e_]:c});return n=n||ZO,v[e_]?v[e_]=c_[`${e_}_${n}`](...Object.values(v[e_])):Object.keys(v).forEach((t=>{v[t]=Object.keys(v[t]).map((n=>v[t][n])).reduce(((e,r)=>void 0===e?r:c_[`${b[t]}_${n}`](e,r)))})),g=Object.keys(y),e&&g.length&&(v[r?"vlPoint":"vlMulti"]=n===ZO?{[t_]:g.reduce(((t,n)=>(t.push(...y[n]),t)),[])}:{[n_]:g.map((t=>({[t_]:y[t]})))}),v}),l_),Y_("vlSelectionTuples",(function(t,n){return S(t)||p("First argument to selectionTuples must be an array."),$t(n)||p("Second argument to selectionTuples must be a string."),t.map((t=>st(n.fields?{values:n.fields.map((n=>KO(n)(t.datum)))}:{[e_]:r_(t.datum)},n)))}));const X_=Bt(["rule"]),J_=Bt(["group","image","rect"]);function K_(t){return(t+"").toLowerCase()}function Q_(t,n,e){e.endsWith(";")||(e="return("+e+");");const r=Function(...n.concat(e));return t&&t.functions?r.bind(t.functions):r}var Z_={operator:(t,n)=>Q_(t,["_"],n.code),parameter:(t,n)=>Q_(t,["datum","_"],n.code),event:(t,n)=>Q_(t,["event"],n.code),handler:(t,n)=>Q_(t,["_","event"],`var datum=event.item&&event.item.datum;return ${n.code};`),encode:(t,n)=>{const{marktype:e,channels:r}=n;let i="var o=item,datum=o.datum,m=0,$;";for(const t in r){const n="o["+Nt(t)+"]";i+=`$=${r[t].code};if(${n}!==$)${n}=$,m=1;`}return i+=function(t,n){let e="";return X_[n]||(t.x2&&(t.x?(J_[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(J_[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;")),e}(r,e),i+="return m;",Q_(t,["item","_"],i)},codegen:{get(t){const n=`[${t.map(Nt).join("][")}]`,e=Function("_",`return _${n};`);return e.path=n,e},comparator(t,n){let e;const r=Function("a","b","var u, v; return "+t.map(((t,r)=>{const i=n[r];let o,a;return t.path?(o=`a${t.path}`,a=`b${t.path}`):((e=e||{})["f"+r]=t,o=`this.f${r}(a)`,a=`this.f${r}(b)`),function(t,n,e,r){return`((u = ${t}) < (v = ${n}) || u == null) && v != null ? ${e}\n : (u > v || v == null) && u != null ? ${r}\n : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${e}\n : v !== v && u === u ? ${r} : `}(o,a,-i,i)})).join("")+"0;");return e?r.bind(e):r}}};function tz(t,n,e){if(!t||!F(t))return t;for(let r,i=0,o=nz.length;i<o;++i)if(r=nz[i],ft(t,r.key))return r.parse(t,n,e);return t}var nz=[{key:"$ref",parse:function(t,n){return n.get(t.$ref)||p("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,n){const e="k:"+t.$key+"_"+!!t.$flat;return n.fn[e]||(n.fn[e]=kt(t.$key,t.$flat,n.expr.codegen))}},{key:"$expr",parse:function(t,n,e){t.$params&&n.parseParameters(t.$params,e);const r="e:"+t.$expr.code;return n.fn[r]||(n.fn[r]=c(n.parameterExpression(t.$expr),t.$fields))}},{key:"$field",parse:function(t,n){if(!t.$field)return null;const e="f:"+t.$field+"_"+t.$name;return n.fn[e]||(n.fn[e]=v(t.$field,t.$name,n.expr.codegen))}},{key:"$encode",parse:function(t,n){const e=t.$encode,r={};for(const t in e){const i=e[t];r[t]=c(n.encodeExpression(i.$expr),i.$fields),r[t].output=i.$output}return r}},{key:"$compare",parse:function(t,n){const e="c:"+t.$compare+"_"+t.$order,r=Q(t.$compare).map((t=>t&&t.$tupleid?ta:t));return n.fn[e]||(n.fn[e]=nt(r,t.$order,n.expr.codegen))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){const e=t.$subflow;return function(t,r,i){const o=n.fork().parse(e),a=o.get(e.operators[0].id),u=o.signals.parent;return u&&u.set(i),a.detachSubflow=()=>n.detach(o),a}}},{key:"$tupleid",parse:function(){return ta}}];const ez={skip:!0};function rz(t,n,e,r){return new iz(t,n,e,r)}function iz(t,n,e,r){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.expr=r||Z_,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function oz(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 az(t,n){t&&(null==n?t.removeAttribute("aria-label"):t.setAttribute("aria-label",n))}iz.prototype=oz.prototype={fork(){const t=new oz(this);return(this.subcontext||(this.subcontext=[])).push(t),t},detach(t){this.subcontext=this.subcontext.filter((n=>n!==t));const n=Object.keys(t.nodes);for(const e of n)t.nodes[e]._targets=null;for(const e of n)t.nodes[e].detach();t.nodes=null},get(t){return this.nodes[t]},set(t,n){return this.nodes[t]=n},add(t,n){const e=this,r=e.dataflow,i=t.value;if(e.set(t.id,n),function(t){return"collect"===K_(t)}(t.type)&&i&&(i.$ingest?r.ingest(n,i.$ingest,i.$format):i.$request?r.preload(n,i.$request,i.$format):r.pulse(n,r.changeset().insert(i))),t.root&&(e.root=n),t.parent){let i=e.get(t.parent.$ref);i?(r.connect(i,[n]),n.targets().add(i)):(e.unresolved=e.unresolved||[]).push((()=>{i=e.get(t.parent.$ref),r.connect(i,[n]),n.targets().add(i)}))}if(t.signal&&(e.signals[t.signal]=n),t.scale&&(e.scales[t.scale]=n),t.data)for(const r in t.data){const i=e.data[r]||(e.data[r]={});t.data[r].forEach((t=>i[t]=n))}},resolve(){return(this.unresolved||[]).forEach((t=>t())),delete this.unresolved,this},operator(t,n){this.add(t,this.dataflow.add(t.value,n))},transform(t,n){this.add(t,this.dataflow.add(this.transforms[K_(n)]))},stream(t,n){this.set(t.id,n)},update(t,n,e,r,i){this.dataflow.on(n,e,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 n=this,e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),t.locale&&(n.locale=t.locale),e.forEach((t=>n.parseOperator(t))),e.forEach((t=>n.parseOperatorParameters(t))),(t.streams||[]).forEach((t=>n.parseStream(t))),(t.updates||[]).forEach((t=>n.parseUpdate(t))),n.resolve()},parseOperator:function(t){const n=this;!function(t){return"operator"===K_(t)}(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?n.operatorExpression(t.update):null)},parseOperatorParameters:function(t){const n=this;if(t.params){const e=n.get(t.id);e||p("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(n.parseParameters(t.params),t.react,t.initonly))}},parseParameters:function(t,n){n=n||{};const e=this;for(const r in t){const i=t[r];n[r]=S(i)?i.map((t=>tz(t,e,n))):tz(i,e,n)}return n},parseStream:function(t){var n,e=this,r=null!=t.filter?e.eventExpression(t.filter):void 0,i=null!=t.stream?e.get(t.stream):void 0;t.source?i=e.events(t.source,t.type,r):t.merge&&(i=(n=t.merge.map((t=>e.get(t))))[0].merge.apply(n[0],n.slice(1))),t.between&&(n=t.between.map((t=>e.get(t))),i=i.between(n[0],n[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&&p("Invalid stream definition: "+JSON.stringify(t)),t.consume&&i.consume(!0),e.stream(t,i)},parseUpdate:function(t){var n,e=this,r=F(r=t.source)?r.$ref:r,i=e.get(r),o=t.update,a=void 0;i||p("Source not defined: "+t.source),n=t.target&&t.target.$expr?e.eventExpression(t.target.$expr):e.get(t.target),o&&o.$expr&&(o.$params&&(a=e.parseParameters(o.$params)),o=e.handlerExpression(o.$expr)),e.update(t,i,n,o,a)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach((e=>{const i=n.signals[e];t.signals(e,i)&&(r[e]=i.value)}))}if(t.data){var i=e.data={};Object.keys(n.data).forEach((e=>{const r=n.data[e];t.data(e,r)&&(i[e]=r.input.value)}))}return n.subcontext&&!1!==t.recurse&&(e.subcontext=n.subcontext.map((n=>n.getState(t)))),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach((t=>{e.update(n.signals[t],i[t],ez)})),Object.keys(r||{}).forEach((t=>{e.pulse(n.data[t].input,e.changeset().remove($).insert(r[t]))})),(t.subcontext||[]).forEach(((t,e)=>{const r=n.subcontext[e];r&&r.setState(t)}))}};const uz="default";function sz(t,n){const e=t.globalCursor()?"undefined"!=typeof document&&document.body:t.container();if(e)return null==n?e.style.removeProperty("cursor"):e.style.cursor=n}function cz(t,n){var e=t._runtime.data;return ft(e,n)||p("Unrecognized data set: "+n),e[n]}function lz(t,n){ua(n)||p("Second argument to changes must be a changeset.");const e=cz(this,t);return e.modified=!0,this.pulse(e.input,n)}function fz(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function dz(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function hz(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}const mz="view",pz={trap:!1};function gz(t,n,e,r){t._eventListeners.push({type:e,sources:Q(n),handler:r})}function vz(t,n,e){const r=t._eventConfig&&t._eventConfig[n];return!(!1===r||F(r)&&!r[e])||(t.warn(`Blocked ${n} ${e} event listener.`),!1)}function yz(t){return t.item}function bz(t){return t.item.mark.source}function wz(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function xz(t,n,e){const r=document.createElement(t);for(const t in n)r.setAttribute(t,n[t]);return null!=e&&(r.textContent=e),r}function $z(t,n,e,r){const i=e.event||"input",o=()=>t.update(n.value);r.signal(e.signal,n.value),n.addEventListener(i,o),gz(r,n,i,o),t.set=t=>{n.value=t,n.dispatchEvent(function(t){return"undefined"!=typeof Event?new Event(t):{type:t}}(i))}}function kz(t,n,e,r){const i=r.signal(e.signal),o=xz("div",{class:"vega-bind"}),a="radio"===e.input?o:o.appendChild(xz("label"));a.appendChild(xz("span",{class:"vega-bind-name"},e.name||e.signal)),n.appendChild(o);let u=Mz;switch(e.input){case"checkbox":u=Az;break;case"select":u=Dz;break;case"radio":u=Sz;break;case"range":u=Fz}u(t,a,e,i)}function Mz(t,n,e,r){const i=xz("input");for(const t in e)"signal"!==t&&"element"!==t&&i.setAttribute("input"===t?"type":t,e[t]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",(()=>t.update(i.value))),t.elements=[i],t.set=t=>i.value=t}function Az(t,n,e,r){const i={type:"checkbox",name:e.signal};r&&(i.checked=!0);const o=xz("input",i);n.appendChild(o),o.addEventListener("change",(()=>t.update(o.checked))),t.elements=[o],t.set=t=>o.checked=!!t||null}function Dz(t,n,e,r){const i=xz("select",{name:e.signal}),o=e.labels||[];e.options.forEach(((t,n)=>{const e={value:t};Ez(t,r)&&(e.selected=!0),i.appendChild(xz("option",e,(o[n]||t)+""))})),n.appendChild(i),i.addEventListener("change",(()=>{t.update(e.options[i.selectedIndex])})),t.elements=[i],t.set=t=>{for(let n=0,r=e.options.length;n<r;++n)if(Ez(e.options[n],t))return void(i.selectedIndex=n)}}function Sz(t,n,e,r){const i=xz("span",{class:"vega-bind-radio"}),o=e.labels||[];n.appendChild(i),t.elements=e.options.map(((n,a)=>{const u={type:"radio",name:e.signal,value:n};Ez(n,r)&&(u.checked=!0);const s=xz("input",u);s.addEventListener("change",(()=>t.update(n)));const c=xz("label",{},(o[a]||n)+"");return c.prepend(s),i.appendChild(c),s})),t.set=n=>{const e=t.elements,r=e.length;for(let t=0;t<r;++t)Ez(e[t].value,n)&&(e[t].checked=!0)}}function Fz(t,n,e,r){r=void 0!==r?r:(+e.max+ +e.min)/2;const i=null!=e.max?e.max:Math.max(100,+r)||100,o=e.min||Math.min(0,i,+r)||0,a=e.step||wn(o,i,100),u=xz("input",{type:"range",name:e.signal,min:o,max:i,step:a});u.value=r;const s=xz("span",{},+r);n.appendChild(u),n.appendChild(s);const c=()=>{s.textContent=u.value,t.update(+u.value)};u.addEventListener("input",c),u.addEventListener("change",c),t.elements=[u],t.set=t=>{u.value=t,s.textContent=t}}function Ez(t,n){return t===n||t+""==n+""}function Nz(t,n,e,r,i,o){return(n=n||new r(t.loader())).initialize(e,fz(t),dz(t),hz(t),i,o).background(t.background())}function Cz(t,n){return n?function(){try{n.apply(this,arguments)}catch(n){t.error(n)}}:null}function Oz(t,n,e){if("string"==typeof n){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n&&e)try{n.textContent=""}catch(e){n=null,t.error(e)}return n}const _z=t=>+t||0;function zz(t){return F(t)?{top:_z(t.top),bottom:_z(t.bottom),left:_z(t.left),right:_z(t.right)}:(t=>({top:t,bottom:t,left:t,right:t}))(_z(t))}async function Bz(t,n,e,r){const i=$x(n),o=i&&i.headless;return o||p("Unrecognized renderer type: "+n),await t.runAsync(),Nz(t,null,null,o,e,r).renderAsync(t._scenegraph.root)}var Tz="width",Pz="height",jz="padding",Rz={skip:!0};function Lz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===jz?r.left+r.right:0)}function Iz(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===jz?r.top+r.bottom:0)}function qz(t,n){return n.modified&&S(n.input.value)&&!t.startsWith("_:vega:_")}function Uz(t,n){return!("parent"===t||n instanceof _a.proxy)}function Wz(t,n,e,r){const i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":S(t)?Hz(t):F(t)&&!yt(t)?(n=t,Object.keys(n).map((t=>{const e=n[t];return t+": "+(S(e)?Hz(e):Gz(e))})).join("\n")):t+"";var n}(r))}function Hz(t){return"["+t.map(Gz).join(", ")+"]"}function Gz(t){return S(t)?"[…]":F(t)&&!yt(t)?"{…}":t}function Yz(t,n){const e=this;if(n=n||{},Na.call(e),n.loader&&e.loader(n.loader),n.logger&&e.logger(n.logger),null!=n.logLevel&&e.logLevel(n.logLevel),n.locale||t.locale){const r=st({},t.locale,n.locale);e.locale(Mo(r.number,r.time))}e._el=null,e._elBind=null,e._renderType=n.renderer||wx.Canvas,e._scenegraph=new Wb;const r=e._scenegraph.root;e._renderer=null,e._tooltip=n.tooltip||Wz,e._redraw=!0,e._handler=(new xw).scene(r),e._globalCursor=!1,e._preventDefault=!1,e._timers=[],e._eventListeners=[],e._resizeListeners=[],e._eventConfig=function(t){const n=st({defaults:{}},t),e=(t,n)=>{n.forEach((n=>{S(t[n])&&(t[n]=Bt(t[n]))}))};return e(n.defaults,["prevent","allow"]),e(n,["view","window","selector"]),n}(t.eventConfig),e.globalCursor(e._eventConfig.globalCursor);const i=function(t,n,e){return rz(t,_a,I_,e).parse(n)}(e,t,n.expr);e._runtime=i,e._signals=i.signals,e._bind=(t.bindings||[]).map((t=>({state:null,param:st({},t)}))),i.root&&i.root.set(r),r.source=i.data.root.input,e.pulse(i.data.root.input,e.changeset().insert(r.items)),e._width=e.width(),e._height=e.height(),e._viewWidth=Lz(e,e._width),e._viewHeight=Iz(e,e._height),e._origin=[0,0],e._resize=0,e._autosize=1,function(t){var n=t._signals,e=n[Tz],r=n[Pz],i=n[jz];function o(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,(n=>{t._width=n.size,t._viewWidth=Lz(t,n.size),o()}),{size:e}),t._resizeHeight=t.add(null,(n=>{t._height=n.size,t._viewHeight=Iz(t,n.size),o()}),{size:r});const a=t.add(null,o,{pad:i});t._resizeWidth.rank=e.rank+1,t._resizeHeight.rank=r.rank+1,a.rank=i.rank+1}(e),function(t){t.add(null,(n=>(t._background=n.bg,t._resize=1,n.bg)),{bg:t._signals.background})}(e),function(t){const n=t._signals.cursor||(t._signals.cursor=t.add({user:uz,item:null}));t.on(t.events("view","pointermove"),n,((t,e)=>{const r=n.value,i=r?$t(r)?r:r.user:uz,o=e.item&&e.item.cursor||null;return r&&i===r.user&&o==r.item?r:{user:i,item:o}})),t.add(null,(function(n){let e=n.cursor,r=this.value;return $t(e)||(r=e.item,e=e.user),sz(t,e&&e!==uz?e:r||e),r}),{cursor:n})}(e),e.description(t.description),n.hover&&e.hover(),n.container&&e.initialize(n.container,n.bind),n.watchPixelRatio&&e._watchPixelRatio()}function Vz(t,n){return ft(t._signals,n)?t._signals[n]:p("Unrecognized signal name: "+Nt(n))}function Xz(t,n){const e=(t._targets||[]).filter((t=>t._update&&t._update.handler===n));return e.length?e[0]:null}function Jz(t,n,e,r){let i=Xz(e,r);return i||(i=Cz(t,(()=>r(n,e.value))),i.handler=r,t.on(e,null,i)),t}function Kz(t,n,e){const r=Xz(n,e);return r&&n._targets.remove(r),t}pt(Yz,Na,{async evaluate(t,n,e){if(await Na.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,function(t){var n=hz(t),e=fz(t),r=dz(t);t._renderer.background(t.background()),t._renderer.resize(e,r,n),t._handler.origin(n),t._resizeListeners.forEach((n=>{try{n(e,r)}catch(n){t.error(n)}}))}(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}return e&&Jo(this,e),this},dirty(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},description(t){if(arguments.length){const n=null!=t?t+"":null;return n!==this._desc&&az(this._el,this._desc=n),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(t,n,e){const r=Vz(this,t);return 1===arguments.length?r.value:this.update(r,n,e)},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",zz(t)):zz(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?($x(t)||p("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&&(Na.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Vz(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:function(t,n,e,r,i,o){this.runAfter((a=>{let u=0;a._autosize=0,a.width()!==e&&(u=1,a.signal(Tz,e,Rz),a._resizeWidth.skip(!0)),a.height()!==r&&(u=1,a.signal(Pz,r,Rz),a._resizeHeight.skip(!0)),a._viewWidth!==t&&(a._resize=1,a._viewWidth=t),a._viewHeight!==n&&(a._resize=1,a._viewHeight=n),a._origin[0]===i[0]&&a._origin[1]===i[1]||(a._resize=1,a._origin=i),u&&a.run("enter"),o&&a.runAfter((t=>t.resize()))}),!1,1)},addEventListener(t,n,e){let r=n;return e&&!1===e.trap||(r=Cz(this,n),r.raw=n),this._handler.on(t,r),this},removeEventListener(t,n){for(var e,r,i=this._handler.handlers(t),o=i.length;--o>=0;)if(e=i[o].handler,t===(r=i[o].type)&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},addResizeListener(t){const n=this._resizeListeners;return n.includes(t)||n.push(t),this},removeResizeListener(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},addSignalListener(t,n){return Jz(this,t,Vz(this,t),n)},removeSignalListener(t,n){return Kz(this,Vz(this,t),n)},addDataListener(t,n){return Jz(this,t,cz(this,t).values,n)},removeDataListener(t,n){return Kz(this,cz(this,t).values,n)},globalCursor(t){if(arguments.length){if(this._globalCursor!==!!t){const n=sz(this,null);this._globalCursor=!!t,n&&sz(this,n)}return this}return this._globalCursor},preventDefault(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},timer:function(t,n){this._timers.push(function(t,n,e){var r=new zF,i=n;return null==n?(r.restart(t,n,e),r):(r._restart=r.restart,r.restart=function(t,n,e){n=+n,e=null==e?OF():+e,r._restart((function o(a){a+=i,r._restart(o,i+=n,e),t(a)}),n,e)},r.restart(t,n,e),r)}((function(n){t({timestamp:Date.now(),elapsed:n})}),n))},events:function(t,n,e){var r,i=this,o=new ga(e),a=function(e,r){i.runAsync(null,(()=>{t===mz&&function(t,n){var e=t._eventConfig.defaults,r=e.prevent,i=e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),o.receive(function(t,n,e){var r,i,o=t._renderer,a=o&&o.canvas();return a&&(i=hz(t),(r=Kb(n.changedTouches?n.changedTouches[0]:n,a))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.item=e,n.vega=function(t,n,e){const r=n?"group"===n.mark.marktype?n:n.mark.group:null;function i(t){var e,i=r;if(t)for(e=n;e;e=e.mark.group)if(e.mark.name===t){i=e;break}return i&&i.mark&&i.mark.interactive?i:{}}function o(t){if(!t)return e;$t(t)&&(t=i(t));const n=e.slice();for(;t;)n[0]-=t.x||0,n[1]-=t.y||0,t=t.mark&&t.mark.group;return n}return{view:at(t),item:at(n||{}),group:i,xy:o,x:t=>o(t)[0],y:t=>o(t)[1]}}(t,e,r),n}(i,e,r))}))};if("timer"===t)vz(i,"timer",n)&&i.timer(a,n);else if(t===mz)vz(i,"view",n)&&i.addEventListener(n,a,pz);else if("window"===t?vz(i,"window",n)&&"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&vz(i,"selector",n)&&(r=Array.from(document.querySelectorAll(t))),r){for(var u=0,s=r.length;u<s;++u)r[u].addEventListener(n,a);gz(i,r,n,a)}else i.warn("Can not resolve event source: "+t);return o},finalize:function(){var t,n,e,r=this._tooltip,i=this._timers,o=this._handler.handlers(),a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);for(r&&r.call(this,this._handler,null,null,null),t=o.length;--t>=0;)this._handler.off(o[t].type,o[t].handler);return this},hover:function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","pointerover",yz),bz,wz(t)),this.on(this.events("view","pointerout",yz),bz,wz(n)),this},data:function(t,n){return arguments.length<2?cz(this,t).values.value:lz.call(this,t,sa().remove($).insert(n))},change:lz,insert:function(t,n){return lz.call(this,t,sa().insert(n))},remove:function(t,n){return lz.call(this,t,sa().remove(n))},scale:function(t){var n=this._runtime.scales;return ft(n,t)||p("Unrecognized scale or projection: "+t),n[t].value},initialize:function(t,n){const e=this,r=e._renderType,i=e._eventConfig.bind,o=$x(r);t=e._el=t?Oz(e,t,!0):null,function(t){const n=t.container();n&&(n.setAttribute("role","graphics-document"),n.setAttribute("aria-roleDescription","visualization"),az(n,t.description()))}(e),o||e.error("Unrecognized renderer type: "+r);const a=o.handler||xw,u=t?o.renderer:o.headless;return e._renderer=u?Nz(e,e._renderer,t,u):null,e._handler=function(t,n,e,r){const i=new r(t.loader(),Cz(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,hz(t),t);return n&&n.handlers().forEach((t=>{i.on(t.type,t.handler)})),i}(e,e._handler,t,a),e._redraw=!0,t&&"none"!==i&&(n=n?e._elBind=Oz(e,n,!0):t.appendChild(xz("form",{class:"vega-bindings"})),e._bind.forEach((t=>{t.param.element&&"container"!==i&&(t.element=Oz(e,t.param.element,!!t.param.input))})),e._bind.forEach((t=>{!function(t,n,e){if(!n)return;const r=e.param;let i=e.state;i||(i=e.state={elements:null,active:!1,set:null,update:n=>{n!=t.signal(r.signal)&&t.runAsync(null,(()=>{i.source=!0,t.signal(r.signal,n)}))}},r.debounce&&(i.update=ut(r.debounce,i.update))),(null==r.input&&r.element?$z:kz)(i,n,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)}(e,t.element||n,t)}))),e},toImageURL:async function(t,n){t!==wx.Canvas&&t!==wx.SVG&&t!==wx.PNG&&p("Unrecognized image type: "+t);const e=await Bz(this,t,n);return t===wx.SVG?function(t){const n=new Blob([t],{type:"image/svg+xml"});return window.URL.createObjectURL(n)}(e.svg()):e.canvas().toDataURL("image/png")},toCanvas:async function(t,n){return(await Bz(this,wx.Canvas,t,n)).canvas()},toSVG:async function(t){return(await Bz(this,wx.SVG,t)).svg()},getState:function(t){return this._runtime.getState(t||{data:qz,signals:Uz,recurse:!0})},setState:function(t){return this.runAsync(null,(n=>{n._trigger=!1,n._runtime.setState(t)}),(t=>{t._trigger=!0})),this},_watchPixelRatio:function(){if("canvas"===this.renderer()&&this._renderer._canvas){let t=null;const n=()=>{null!=t&&t();const e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);e.addEventListener("change",n),t=()=>{e.removeEventListener("change",n)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};n()}}});const Qz=/[[\]{}]/,Zz={"*":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 tB,nB;function eB(t,n,e){return tB=n||"view",nB=e||Zz,iB(t.trim()).map(oB)}function rB(t,n,e,r,i){const o=t.length;let a,u=0;for(;n<o;++n){if(a=t[n],!u&&a===e)return n;i&&i.includes(a)?--u:r&&r.includes(a)&&++u}return n}function iB(t){const n=[],e=t.length;let r=0,i=0;for(;i<e;)i=rB(t,i,",","[{","]}"),n.push(t.substring(r,i).trim()),r=++i;if(0===n.length)throw"Empty event selector: "+t;return n}function oB(t){return"["===t[0]?function(t){const n=t.length;let e,r=1;if(r=rB(t,r,"]","[","]"),r===n)throw"Empty between selector: "+t;if(e=iB(t.substring(1,r)),2!==e.length)throw"Between selector must have two elements: "+t;if(">"!==(t=t.slice(r+1).trim())[0])throw"Expected '>' after between selector: "+t;e=e.map(oB);const i=oB(t.slice(1).trim());return i.between?{between:e,stream:i}:(i.between=e,i)}(t):function(t){const n={source:tB},e=[];let r,i,o=[0,0],a=0,u=0,s=t.length,c=0;if("}"===t[s-1]){if(c=t.lastIndexOf("{"),!(c>=0))throw"Unmatched right brace: "+t;try{o=function(t){const n=t.split(",");if(!t.length||n.length>2)throw t;return n.map((n=>{const e=+n;if(e!=e)throw t;return e}))}(t.substring(c+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}s=(t=t.slice(0,c).trim()).length,c=0}if(!s)throw t;if("@"===t[0]&&(a=++c),r=rB(t,c,":"),r<s&&(e.push(t.substring(u,r).trim()),u=c=++r),c=rB(t,c,"["),c===s)e.push(t.substring(u,s).trim());else if(e.push(t.substring(u,c).trim()),i=[],u=++c,u===s)throw"Unmatched left bracket: "+t;for(;c<s;){if(c=rB(t,c,"]"),c===s)throw"Unmatched left bracket: "+t;if(i.push(t.substring(u,c).trim()),c<s-1&&"["!==t[++c])throw"Expected left bracket: "+t;u=++c}if(!(s=e.length)||Qz.test(e[s-1]))throw"Invalid event selector: "+t;return s>1?(n.type=e[1],a?n.markname=e[0].slice(1):function(t){return nB[t]}(e[0])?n.marktype=e[0]:n.source=e[0]):n.type=e[0],"!"===n.type.slice(-1)&&(n.consume=!0,n.type=n.type.slice(0,-1)),null!=i&&(n.filter=i),o[0]&&(n.throttle=o[0]),o[1]&&(n.debounce=o[1]),n}(t)}function aB(t){return F(t)?t:{type:t||"pad"}}const uB=t=>+t||0;function sB(t){return F(t)?t.signal?t:{top:uB(t.top),bottom:uB(t.bottom),left:uB(t.left),right:uB(t.right)}:{top:n=uB(t),bottom:n,left:n,right:n};var n}const cB=t=>F(t)&&!S(t)?st({},t):{value:t};function lB(t,n,e,r){return null!=e?(F(e)&&!S(e)||S(e)&&e.length&&F(e[0])?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function fB(t,n,e){for(const e in n)lB(t,e,n[e]);for(const n in e)lB(t,n,e[n],"update")}function dB(t,n,e){for(const r in n)e&&ft(e,r)||(t[r]=st(t[r]||{},n[r]));return t}function hB(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}const mB="mark",pB="frame",gB="scope",vB="legend-label";function yB(t,n,e){t[n]=e&&e.signal?{signal:e.signal}:{value:e}}const bB=t=>$t(t)?Nt(t):t.signal?`(${t.signal})`:kB(t);function wB(t){if(null!=t.gradient)return function(t){const n=[t.start,t.stop,t.count].map((t=>null==t?null:Nt(t)));for(;n.length&&null==_(n);)n.pop();return n.unshift(bB(t.gradient)),`gradient(${n.join(",")})`}(t);let n=t.signal?`(${t.signal})`:t.color?function(t){return t.c?xB("hcl",t.h,t.c,t.l):t.h||t.s?xB("hsl",t.h,t.s,t.l):t.l||t.a?xB("lab",t.l,t.a,t.b):t.r||t.g||t.b?xB("rgb",t.r,t.g,t.b):null}(t.color):null!=t.field?kB(t.field):void 0!==t.value?Nt(t.value):void 0;return null!=t.scale&&(n=function(t,n){const e=bB(t.scale);return null!=t.range?n=`lerp(_range(${e}), ${+t.range})`:(void 0!==n&&(n=`_scale(${e}, ${n})`),t.band&&(n=(n?n+"+":"")+`_bandwidth(${e})`+(1==+t.band?"":"*"+$B(t.band)),t.extra&&(n=`(datum.extra ? _scale(${e}, datum.extra.value) : ${n})`)),null==n&&(n="0")),n}(t,n)),void 0===n&&(n=null),null!=t.exponent&&(n=`pow(${n},${$B(t.exponent)})`),null!=t.mult&&(n+=`*${$B(t.mult)}`),null!=t.offset&&(n+=`+${$B(t.offset)}`),t.round&&(n=`round(${n})`),n}const xB=(t,n,e,r)=>`(${t}(${[n,e,r].map(wB).join(",")})+'')`;function $B(t){return F(t)?"("+wB(t)+")":t}function kB(t){return MB(F(t)?t:{datum:t})}function MB(t){let n,e,r;if(t.signal)n="datum",r=t.signal;else if(t.group||t.parent){for(e=Math.max(1,t.level||1),n="item";e-- >0;)n+=".mark.group";t.parent?(r=t.parent,n+=".datum"):r=t.group}else t.datum?(n="datum",r=t.datum):p("Invalid field reference: "+Nt(t));return t.signal||(r=$t(r)?g(r).map(Nt).join("]["):MB(r)),n+"["+r+"]"}function AB(t,n,e,r,i,o){const a={};(o=o||{}).encoders={$encode:a},t=function(t,n,e,r,i){const o={},a={};let u,s,c,l;for(s in s="lineBreak","text"!==n||null==i[s]||hB(s,t)||yB(o,s,i[s]),("legend"==e||String(e).startsWith("axis"))&&(e=null),l=e===pB?i.group:e===mB?st({},i.mark,i[n]):null,l)c=hB(s,t)||("fill"===s||"stroke"===s)&&(hB("fill",t)||hB("stroke",t)),c||yB(o,s,l[s]);for(s in Q(r).forEach((n=>{const e=i.style&&i.style[n];for(const n in e)hB(n,t)||yB(o,n,e[n])})),t=st({},t),o)l=o[s],l.signal?(u=u||{})[s]=l:a[s]=l;return t.enter=st(a,t.enter),u&&(t.update=st(u,t.update)),t}(t,n,e,r,i.config);for(const e in t)a[e]=DB(t[e],n,o,i);return o}function DB(t,n,e,r){const i={},o={};for(const n in t)null!=t[n]&&(i[n]=SB(S(a=t[n])?function(t){let n="";return t.forEach((t=>{const e=wB(t);n+=t.test?`(${t.test})?${e}:`:e})),":"===_(n)&&(n+="null"),n}(a):wB(a),r,e,o));var a;return{$expr:{marktype:n,channels:i},$fields:Object.keys(o),$output:Object.keys(t)}}function SB(t,n,e,r){const i=V_(t,n);return i.$fields.forEach((t=>r[t]=1)),st(e,i.$params),i.$expr}const FB=["value","update","init","react","bind"];function EB(t,n){p(t+' for "outer" push: '+Nt(n))}function NB(t,n){const e=t.name;if("outer"===t.push)n.signals[e]||EB("No prior signal definition",e),FB.forEach((n=>{void 0!==t[n]&&EB("Invalid property ",n)}));else{const r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function CB(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function OB(t,n,e,r){return new CB(t,n,e,r)}function _B(t,n){return OB("operator",t,n)}function zB(t){const n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}function BB(t,n){return n?{$field:t,$name:n}:{$field:t}}const TB=BB("key");function PB(t,n){return{$compare:t,$order:n}}function jB(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}const RB="scope",LB="view";function IB(t){return t&&t.signal}function qB(t){if(IB(t))return!0;if(F(t))for(const n in t)if(qB(t[n]))return!0;return!1}function UB(t,n){return null!=t?t:n}function WB(t){return t&&t.signal||t}const HB="timer";function GB(t,n){return(t.merge?YB:t.stream?VB:t.type?XB:p("Invalid stream specification: "+Nt(t)))(t,n)}function YB(t,n){const e=JB({merge:t.merge.map((t=>GB(t,n)))},t,n);return n.addStream(e).id}function VB(t,n){const e=JB({stream:GB(t.stream,n)},t,n);return n.addStream(e).id}function XB(t,n){let e;t.type===HB?(e=n.event(HB,t.throttle),t={between:t.between,filter:t.filter}):e=n.event(function(t){return t===RB?LB:t||LB}(t.source),t.type);const r=JB({stream:e},t,n);return 1===Object.keys(r).length?e:n.addStream(r).id}function JB(t,n,e){let r=n.between;return r&&(2!==r.length&&p('Stream "between" parameter must have 2 entries: '+Nt(n)),t.between=[GB(r[0],e),GB(r[1],e)]),r=n.filter?[].concat(n.filter):[],(n.marktype||n.markname||n.markrole)&&r.push(function(t,n,e){const r="event.item";return r+(t&&"*"!==t?"&&"+r+".mark.marktype==='"+t+"'":"")+(e?"&&"+r+".mark.role==='"+e+"'":"")+(n?"&&"+r+".mark.name==='"+n+"'":"")}(n.marktype,n.markname,n.markrole)),n.source===RB&&r.push("inScope(event.item)"),r.length&&(t.filter=V_("("+r.join(")&&(")+")",e).$expr),null!=(r=n.throttle)&&(t.throttle=+r),null!=(r=n.debounce)&&(t.debounce=+r),n.consume&&(t.consume=!0),t}const KB={code:"_.$value",ast:{type:"Identifier",value:"value"}};function QB(t){return{signal:"["+t.map((t=>t.scale?'scale("'+t.scale+'")':t.signal))+"]"}}const ZB=t=>(n,e,r)=>OB(t,e,n||void 0,r),tT=ZB("aggregate"),nT=ZB("axisticks"),eT=ZB("bound"),rT=ZB("collect"),iT=ZB("compare"),oT=ZB("datajoin"),aT=ZB("encode"),uT=ZB("expression"),sT=ZB("facet"),cT=ZB("field"),lT=ZB("key"),fT=ZB("legendentries"),dT=ZB("load"),hT=ZB("mark"),mT=ZB("multiextent"),pT=ZB("multivalues"),gT=ZB("overlap"),vT=ZB("params"),yT=ZB("prefacet"),bT=ZB("projection"),wT=ZB("proxy"),xT=ZB("relay"),$T=ZB("render"),kT=ZB("scale"),MT=ZB("sieve"),AT=ZB("sortitems"),DT=ZB("viewlayout"),ST=ZB("values");let FT=0;const ET={min:"min",max:"max",count:"sum"};function NT(t,n){const e=n.getScale(t.name).params;let r;for(r in e.domain=zT(t.domain,t,n),null!=t.range&&(e.range=qT(t,n,e)),null!=t.interpolate&&function(t,n){n.interpolate=CT(t.type||t),null!=t.gamma&&(n.interpolateGamma=CT(t.gamma))}(t.interpolate,e),null!=t.nice&&(e.nice=function(t,n){return t.signal?n.signalRef(t.signal):F(t)?{interval:CT(t.interval),step:CT(t.step)}:CT(t)}(t.nice,n)),null!=t.bins&&(e.bins=function(t,n){return t.signal||S(t)?OT(t,n):n.objectProperty(t)}(t.bins,n)),t)ft(e,r)||"name"===r||(e[r]=CT(t[r],n))}function CT(t,n){return F(t)?t.signal?n.signalRef(t.signal):p("Unsupported object: "+Nt(t)):t}function OT(t,n){return t.signal?n.signalRef(t.signal):t.map((t=>CT(t,n)))}function _T(t){p("Can not find data set: "+Nt(t))}function zT(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(S(t)?BT:t.fields?PT:TT)(t,n,e);null==n.domainMin&&null==n.domainMax||p("No scale domain defined for domainMin/domainMax to override.")}function BT(t,n,e){return t.map((t=>CT(t,e)))}function TT(t,n,e){const r=e.getData(t.data);return r||_T(t.data),og(n.type)?r.valuesRef(e,t.field,RT(t.sort,!1)):cg(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)}function PT(t,n,e){const r=t.data,i=t.fields.reduce(((t,n)=>(n=$t(n)?{data:r,field:n}:S(n)||n.signal?function(t,n){const e="_:vega:_"+FT++,r=rT({});if(S(t))r.value={$ingest:t};else if(t.signal){const i="setdata("+Nt(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,MT({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t)),[]);return(og(n.type)?jT:cg(n.type)?LT:IT)(t,e,i)}function jT(t,n,e){const r=RT(t.sort,!0);let i,o;const a=e.map((t=>{const e=n.getData(t.data);return e||_T(t.data),e.countsRef(n,t.field,r)})),u={groupby:TB,pulse:a};r&&(i=r.op||"count",o=r.field?jB(i,r.field):"count",u.ops=[ET[i]],u.fields=[n.fieldRef(o)],u.as=[o]),i=n.add(tT(u));const s=n.add(rT({pulse:zB(i)}));return o=n.add(ST({field:TB,sort:n.sortRef(r),pulse:zB(s)})),zB(o)}function RT(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field&&t.op&&!ET[t.op]&&p("Multiple domain scales can not be sorted using "+t.op):p("No field provided for sort aggregate op: "+t.op):F(t)?t.field="key":t={field:"key"}),t}function LT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||_T(t.data),e.domainRef(n,t.field)}));return zB(n.add(pT({values:r})))}function IT(t,n,e){const r=e.map((t=>{const e=n.getData(t.data);return e||_T(t.data),e.extentRef(n,t.field)}));return zB(n.add(mT({extents:r})))}function qT(t,n,e){const r=n.config.range;let i=t.range;if(i.signal)return n.signalRef(i.signal);if($t(i)){if(r&&ft(r,i))return qT(t=st({},t,{range:r[i]}),n,e);"width"===i?i=[0,{signal:"width"}]:"height"===i?i=og(t.type)?[0,{signal:"height"}]:[{signal:"height"},0]:p("Unrecognized scale range value: "+Nt(i))}else{if(i.scheme)return e.scheme=S(i.scheme)?OT(i.scheme,n):CT(i.scheme,n),i.extent&&(e.schemeExtent=OT(i.extent,n)),void(i.count&&(e.schemeCount=CT(i.count,n)));if(i.step)return void(e.rangeStep=CT(i.step,n));if(og(t.type)&&!S(i))return zT(i,t,n);S(i)||p("Unsupported range type: "+Nt(i))}return i.map((t=>(S(t)?OT:CT)(t,n)))}function UT(t,n,e){return S(t)?t.map((t=>UT(t,n,e))):F(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:p("Unsupported parameter object: "+Nt(t)):t}const WT="top",HT="left",GT="right",YT="bottom",VT="center",XT="index",JT="label",KT="perc",QT="value",ZT="guide-label",tP="guide-title",nP="symbol",eP="gradient",rP="discrete",iP="size",oP=[iP,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],aP={name:1,style:1,interactive:1},uP={value:0},sP={value:1},cP="group",lP="rect",fP="rule",dP="text";function hP(t){return t.type=cP,t.interactive=t.interactive||!1,t}function mP(t,n){const e=(e,r)=>UB(t[e],UB(n[e],r));return e.isVertical=e=>"vertical"===UB(t.direction,n.direction||(e?n.symbolDirection:n.gradientDirection)),e.gradientLength=()=>UB(t.gradientLength,n.gradientLength||n.gradientWidth),e.gradientThickness=()=>UB(t.gradientThickness,n.gradientThickness||n.gradientHeight),e.entryColumns=()=>UB(t.columns,UB(n.columns,+e.isVertical(!0))),e}function pP(t,n){const e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}function gP(t,n,e){return`item.anchor === 'start' ? ${t} : item.anchor === 'end' ? ${n} : ${e}`}const vP=gP(Nt(HT),Nt(GT),Nt(VT));function yP(t,n){return n?t?F(t)?Object.assign({},t,{offset:yP(t.offset,n)}):{value:t,offset:n}:n:t}function bP(t,n){return n?(t.name=n.name,t.style=n.style||t.style,t.interactive=!!n.interactive,t.encode=dB(t.encode,n,aP)):t.interactive=!1,t}function wP(t,n,e,r){const i=mP(t,e),o=i.isVertical(),a=i.gradientThickness(),u=i.gradientLength();let s,c,l,f,d;o?(c=[0,1],l=[0,0],f=a,d=u):(c=[0,0],l=[1,0],f=u,d=a);const h={enter:s={opacity:uP,x:uP,y:uP,width:cB(f),height:cB(d)},update:st({},s,{opacity:sP,fill:{gradient:n,start:c,stop:l}}),exit:{opacity:uP}};return fB(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),bP({type:lP,role:"legend-gradient",encode:h},r)}function xP(t,n,e,r,i){const o=mP(t,e),a=o.isVertical(),u=o.gradientThickness(),s=o.gradientLength();let c,l,f,d,h="";a?(c="y",f="y2",l="x",d="width",h="1-"):(c="x",f="x2",l="y",d="height");const m={opacity:uP,fill:{scale:n,field:QT}};m[c]={signal:h+"datum."+KT,mult:s},m[l]=uP,m[f]={signal:h+"datum.perc2",mult:s},m[d]=cB(u);const p={enter:m,update:st({},m,{opacity:sP}),exit:{opacity:uP}};return fB(p,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),bP({type:lP,role:"legend-band",key:QT,from:i,encode:p},r)}const $P=`datum.${KT}<=0?"${HT}":datum.${KT}>=1?"${GT}":"${VT}"`,kP=`datum.${KT}<=0?"${YT}":datum.${KT}>=1?"${WT}":"middle"`;function MP(t,n,e,r){const i=mP(t,n),o=i.isVertical(),a=cB(i.gradientThickness()),u=i.gradientLength();let s,c,l,f,d=i("labelOverlap"),h="";const m={enter:s={opacity:uP},update:c={opacity:sP,text:{field:JT}},exit:{opacity:uP}};return fB(m,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:UB(t.labelLimit,n.gradientLabelLimit)}),o?(s.align={value:"left"},s.baseline=c.baseline={signal:kP},l="y",f="x",h="1-"):(s.align=c.align={signal:$P},s.baseline={value:"top"},l="x",f="y"),s[l]=c[l]={signal:h+"datum."+KT,mult:u},s[f]=c[f]=a,a.offset=UB(t.labelOffset,n.gradientLabelOffset)||0,d=d?{separation:i("labelSeparation"),method:d,order:"datum."+XT}:void 0,bP({type:dP,role:vB,style:ZT,key:QT,from:r,encode:m,overlap:d},e)}function AP(t,n,e,r,i){const o=mP(t,n),a=e.entries,u=!(!a||!a.interactive),s=a?a.name:void 0,c=o("clipHeight"),l=o("symbolOffset"),f={data:"value"},d=`(${i}) ? datum.offset : datum.${iP}`,h=c?cB(c):{field:iP},m=`datum.${XT}`,p=`max(1, ${i})`;let g,v,y,b,w;h.mult=.5,g={enter:v={opacity:uP,x:{signal:d,mult:.5,offset:l},y:h},update:y={opacity:sP,x:v.x,y:v.y},exit:{opacity:uP}};let x=null,$=null;t.fill||(x=n.symbolBaseFillColor,$=n.symbolBaseStrokeColor),fB(g,{fill:o("symbolFillColor",x),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",$),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),oP.forEach((n=>{t[n]&&(y[n]=v[n]={scale:t[n],field:QT})}));const k=bP({type:"symbol",role:"legend-symbol",key:QT,from:f,clip:!!c||void 0,encode:g},e.symbols),M=cB(l);M.offset=o("labelOffset"),g={enter:v={opacity:uP,x:{signal:d,offset:M},y:h},update:y={opacity:sP,text:{field:JT},x:v.x,y:v.y},exit:{opacity:uP}},fB(g,{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=bP({type:dP,role:vB,style:ZT,key:QT,from:f,encode:g},e.labels);return g={enter:{noBound:{value:!c},width:uP,height:c?cB(c):uP,opacity:uP},exit:{opacity:uP},update:y={opacity:sP,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(b=`ceil(item.mark.items.length / ${p})`,y.row.signal=`${m}%${b}`,y.column.signal=`floor(${m} / ${b})`,w={field:["row",m]}):(y.row.signal=`floor(${m} / ${p})`,y.column.signal=`${m} % ${p}`,w={field:m}),y.column.signal=`(${i})?${y.column.signal}:${m}`,hP({role:gB,from:r={facet:{data:r,name:"value",groupby:XT}},encode:dB(g,a,aP),marks:[k,A],name:s,interactive:u,sort:w})}const DP='item.orient === "left"',SP='item.orient === "right"',FP=`(${DP} || ${SP})`,EP=`datum.vgrad && ${FP}`,NP=gP('"top"','"bottom"','"middle"'),CP=`datum.vgrad && ${SP} ? (${gP('"right"','"left"','"center"')}) : (${FP} && !(datum.vgrad && ${DP})) ? "left" : ${vP}`,OP=`item._anchor || (${FP} ? "middle" : "start")`,_P=`${EP} ? (${DP} ? -90 : 90) : 0`,zP=`${FP} ? (datum.vgrad ? (${SP} ? "bottom" : "top") : ${NP}) : "top"`;function BP(t,n){let e;return F(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+TP(t.path)+")":t.sphere&&(e="geoShape("+TP(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function TP(t){return F(t)&&t.signal?t.signal:Nt(t)}function PP(t){const n=t.role||"";return n.startsWith("axis")||n.startsWith("legend")||n.startsWith("title")?n:t.type===cP?gB:n||mB}function jP(t){return{marktype:t.type,name:t.name||void 0,role:t.role||PP(t),zindex:+t.zindex||void 0,aria:t.aria,description:t.description}}function RP(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function LP(t,n){const e=za(t.type);e||p("Unrecognized transform type: "+Nt(t.type));const r=OB(e.type.toLowerCase(),null,IP(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function IP(t,n,e){const r={},i=t.params.length;for(let o=0;o<i;++o){const i=t.params[o];r[i.name]=qP(i,n,e)}return r}function qP(t,n,e){const r=t.type,i=n[t.name];return"index"===r?function(t,n,e){return $t(n.from)||p('Lookup "from" parameter must be a string literal.'),e.getData(n.from).lookupRef(e,n.key)}(0,n,e):void 0!==i?"param"===r?function(t,n,e){const r=n[t.name];return t.array?(S(r)||p("Expected an array of sub-parameters. Instead: "+Nt(r)),r.map((n=>WP(t,n,e)))):WP(t,r,e)}(t,n,e):"projection"===r?e.projectionRef(n[t.name]):t.array&&!IB(i)?i.map((n=>UP(t,n,e))):UP(t,i,e):void(t.required&&p("Missing required "+Nt(n.type)+" parameter: "+Nt(t.name)))}function UP(t,n,e){const r=t.type;if(IB(n))return VP(r)?p("Expression references can not be signals."):XP(r)?e.fieldRef(n):JP(r)?e.compareRef(n):e.signalRef(n.signal);{const i=t.expr||XP(r);return i&&HP(n)?e.exprRef(n.expr,n.as):i&&GP(n)?BB(n.field,n.as):VP(r)?V_(n,e):YP(r)?zB(e.getData(n).values):XP(r)?BB(n):JP(r)?e.compareRef(n):n}}function WP(t,n,e){const r=t.params.length;let i;for(let e=0;e<r;++e){i=t.params[e];for(const t in i.key)if(i.key[t]!==n[t]){i=null;break}if(i)break}i||p("Unsupported parameter: "+Nt(n));const o=st(IP(i,n,e),i.key);return zB(e.add(vT(o)))}const HP=t=>t&&t.expr,GP=t=>t&&t.field,YP=t=>"data"===t,VP=t=>"expr"===t,XP=t=>"field"===t,JP=t=>"compare"===t;function KP(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:zB(n.getData(t.data).output)}function QP(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}function ZP(t){return $t(t)?t:null}function tj(t,n,e){const r=jB(e.op,e.field);let i;if(n.ops){for(let t=0,e=n.as.length;t<e;++t)if(n.as[t]===r)return}else n.ops=["count"],n.fields=[null],n.as=["count"];e.op&&(n.ops.push((i=e.op.signal)?t.signalRef(i):e.op),n.fields.push(t.fieldRef(e.field)),n.as.push(r))}function nj(t,n,e,r,i,o,a){const u=n[e]||(n[e]={}),s=function(t){return F(t)?("descending"===t.order?"-":"+")+jB(t.op,t.field):""}(o);let c,l,f=ZP(i);if(null!=f&&(t=n.scope,f+=s?"|"+s:"",c=u[f]),!c){const e=o?{field:TB,pulse:n.countsRef(t,i,o)}:{field:t.fieldRef(i),pulse:zB(n.output)};s&&(e.sort=t.sortRef(o)),l=t.add(OB(r,void 0,e)),a&&(n.index[i]=l),c=zB(l),null!=f&&(u[f]=c)}return c}function ej(t,n,e){const r=t.remove,i=t.insert,o=t.toggle,a=t.modify,u=t.values,s=n.add(_B()),c=V_("if("+t.trigger+',modify("'+e+'",'+[i,r,o,a,u].map((t=>null==t?"null":t)).join(",")+"),0)",n);s.update=c.$expr,s.params=c.$params}function rj(t,n){const e=PP(t),r=t.type===cP,i=t.from&&t.from.facet,o=t.overlap;let a,u,s,c,l,f,d,h=t.layout||e===gB||e===pB;const m=e===mB||h||i,g=function(t,n,e){let r,i,o,a,u;return t?(r=t.facet)&&(n||p("Only group marks can be faceted."),null!=r.field?a=u=KP(r,e):(t.data?u=zB(e.getData(t.data).aggregate):(o=LP(st({type:"aggregate",groupby:Q(r.groupby)},r.aggregate),e),o.params.key=e.keyRef(r.groupby),o.params.pulse=KP(r,e),a=u=zB(e.add(o))),i=e.keyRef(r.groupby,!0))):a=zB(e.add(rT(null,[{}]))),a||(a=KP(t,e)),{key:i,pulse:a,parent:u}}(t.from,r,n);u=n.add(oT({key:g.key||(t.key?BB(t.key):void 0),pulse:g.pulse,clean:!r}));const v=zB(u);u=s=n.add(rT({pulse:v})),u=n.add(hT({markdef:jP(t),interactive:RP(t.interactive,n),clip:BP(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:zB(u)}));const y=zB(u);u=c=n.add(aT(AB(t.encode,t.type,e,t.style,n,{mod:!1,pulse:y}))),u.params.parent=n.encode(),t.transform&&t.transform.forEach((t=>{const e=LP(t,n),r=e.metadata;(r.generates||r.changes)&&p("Mark transforms should not generate new data."),r.nomod||(c.params.mod=!0),e.params.pulse=zB(u),n.add(u=e)})),t.sort&&(u=n.add(AT({sort:n.compareRef(t.sort),pulse:zB(u)})));const b=zB(u);(i||h)&&(h=n.add(DT({layout:n.objectProperty(t.layout),legends:n.legends,mark:y,pulse:b})),f=zB(h));const w=n.add(eT({mark:y,pulse:f||b}));d=zB(w),r&&(m&&(a=n.operators,a.pop(),h&&a.pop()),n.pushState(b,f||d,v),i?function(t,n,e){const r=t.from.facet,i=r.name,o=KP(r,n);let a;r.name||p("Facet must have a name: "+Nt(r)),r.data||p("Facet must reference a data set: "+Nt(r)),r.field?a=n.add(yT({field:n.fieldRef(r.field),pulse:o})):r.groupby?a=n.add(sT({key:n.keyRef(r.groupby),group:zB(n.proxy(e.parent)),pulse:o})):p("Facet must specify groupby or field: "+Nt(r));const u=n.fork(),s=u.add(rT()),c=u.add(MT({pulse:zB(s)}));u.addData(i,new QP(u,s,s,c)),u.addSignal("parent",null),a.params.subflow={$subflow:u.parse(t).toRuntime()}}(t,n,g):m?function(t,n,e){const r=n.add(yT({pulse:e.pulse})),i=n.fork();i.add(MT()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(t).toRuntime()}}(t,n,g):n.parse(t),n.popState(),m&&(h&&a.push(h),a.push(w))),o&&(d=function(t,n,e){const r=t.method,i=t.bound,o=t.separation,a={separation:IB(o)?e.signalRef(o.signal):o,method:IB(r)?e.signalRef(r.signal):r,pulse:n};if(t.order&&(a.sort=e.compareRef({field:t.order})),i){const t=i.tolerance;a.boundTolerance=IB(t)?e.signalRef(t.signal):+t,a.boundScale=e.scaleRef(i.scale),a.boundOrient=i.orient}return zB(e.add(gT(a)))}(o,d,n));const x=n.add($T({pulse:d})),$=n.add(MT({pulse:zB(x)},void 0,n.parent()));null!=t.name&&(l=t.name,n.addData(l,new QP(n,s,x,$)),t.on&&t.on.forEach((t=>{(t.insert||t.remove||t.toggle)&&p("Marks only support modify triggers."),ej(t,n,l)})))}function ij(t,n,e){const r={enter:{},update:{}};return fB(r,{orient:t("orient"),offset:t("offset"),padding:t("padding"),titlePadding:t("titlePadding"),cornerRadius:t("cornerRadius"),fill:t("fillColor"),stroke:t("strokeColor"),strokeWidth:e.strokeWidth,strokeDash:e.strokeDash,x:t("legendX"),y:t("legendY"),format:n.format,formatType:n.formatType}),r}function oj(t,n,e){return n[t]?`scale("${n[t]}",datum)`:pP(t,e[0].encode)}QP.fromEntries=function(t,n){const e=n.length,r=n[e-1],i=n[e-2];let o=n[0],a=null,u=1;for(o&&"load"===o.type&&(o=n[1]),t.add(n[0]);u<e;++u)n[u].params.pulse=zB(n[u-1]),t.add(n[u]),"aggregate"===n[u].type&&(a=n[u]);return new QP(t,o,i,r,a)},QP.prototype={countsRef(t,n,e){const r=this,i=r.counts||(r.counts={}),o=ZP(n);let a,u,s;return null!=o&&(t=r.scope,a=i[o]),a?e&&e.field&&tj(t,a.agg.params,e):(s={groupby:t.fieldRef(n,"key"),pulse:zB(r.output)},e&&e.field&&tj(t,s,e),u=t.add(tT(s)),a=t.add(rT({pulse:zB(u)})),a={agg:u,ref:zB(a)},null!=o&&(i[o]=a)),a.ref},tuplesRef(){return zB(this.values)},extentRef(t,n){return nj(t,this,"extent","extent",n,!1)},domainRef(t,n){return nj(t,this,"domain","values",n,!1)},valuesRef(t,n,e){return nj(t,this,"vals","values",n,e||!0)},lookupRef(t,n){return nj(t,this,"lookup","tupleindex",n,!1)},indataRef(t,n){return nj(t,this,"indata","tupleindex",n,!0,!0)}};const aj=`item.orient==="${HT}"?-90:item.orient==="${GT}"?90:0`;function uj(t,n){const e={enter:{},update:{}};return fB(e,{orient:t("orient"),anchor:t("anchor"),align:{signal:vP},angle:{signal:aj},limit:t("limit"),frame:t("frame"),offset:t("offset")||0,padding:t("subtitlePadding")}),dB(e,n,aP)}function sj(t){const n=rT({},t);return n.metadata={source:!0},n}function cj(t,n){return dT({url:n.url?t.property(n.url):void 0,async:n.async?t.property(n.async):void 0,values:n.values?t.property(n.values):void 0,format:t.objectProperty(n.format)})}const lj=t=>t===YT||t===WT,fj=(t,n,e)=>IB(t)?vj(t.signal,n,e):t===HT||t===WT?n:e,dj=(t,n,e)=>IB(t)?pj(t.signal,n,e):lj(t)?n:e,hj=(t,n,e)=>IB(t)?gj(t.signal,n,e):lj(t)?e:n,mj=(t,n,e)=>IB(t)?yj(t.signal,n,e):t===WT?{value:n}:{value:e},pj=(t,n,e)=>bj(`${t} === '${WT}' || ${t} === '${YT}'`,n,e),gj=(t,n,e)=>bj(`${t} !== '${WT}' && ${t} !== '${YT}'`,n,e),vj=(t,n,e)=>xj(`${t} === '${HT}' || ${t} === '${WT}'`,n,e),yj=(t,n,e)=>xj(`${t} === '${WT}'`,n,e),bj=(t,n,e)=>(n=null!=n?cB(n):n,e=null!=e?cB(e):e,wj(n)&&wj(e)?{signal:`${t} ? (${n=n?n.signal||Nt(n.value):null}) : (${e=e?e.signal||Nt(e.value):null})`}:[st({test:t},n)].concat(e||[])),wj=t=>null==t||1===Object.keys(t).length,xj=(t,n,e)=>({signal:`${t} ? (${kj(n)}) : (${kj(e)})`}),$j=(t,n,e,r,i)=>({signal:(null!=r?`${t} === '${HT}' ? (${kj(r)}) : `:"")+(null!=e?`${t} === '${YT}' ? (${kj(e)}) : `:"")+(null!=i?`${t} === '${GT}' ? (${kj(i)}) : `:"")+(null!=n?`${t} === '${WT}' ? (${kj(n)}) : `:"")+"(null)"}),kj=t=>IB(t)?t.signal:null==t?null:Nt(t),Mj=(t,n)=>{const e=t.signal;return e&&e.endsWith("(null)")?{signal:e.slice(0,-6)+n.signal}:t};function Aj(t,n,e,r){let i;if(n&&ft(n,t))return n[t];if(ft(e,t))return e[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[tP][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[ZT][i]}return null}function Dj(t){const n={};for(const e of t)if(e)for(const t in e)n[t]=1;return Object.keys(n)}function Sj(t,n){return{scale:t.scale,range:n}}function Fj(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function Ej(t,n,e,r,i,o){const a=mP(t,n),u=t.orient,s=t.scale,c=fj(u,-1,1),l=WB(a("labelFlush")),f=WB(a("labelFlushOffset")),d=a("labelAlign"),h=a("labelBaseline");let m,p=0===l||!!l;const g=cB(i);g.mult=c,g.offset=cB(a("labelPadding")||0),g.offset.mult=c;const v={scale:s,field:QT,band:.5,offset:yP(o.offset,a("labelOffset"))},y=dj(u,p?Fj(s,l,'"left"','"right"','"center"'):{value:"center"},((t,n,e)=>IB(t)?((t,n,e)=>xj(`${t} === '${GT}'`,n,e))(t.signal,n,e):t===GT?{value:n}:{value:e})(u,"left","right")),b=dj(u,mj(u,"bottom","top"),p?Fj(s,l,'"top"','"bottom"','"middle"'):{value:"middle"}),w=Fj(s,l,`-(${f})`,f,0);p=p&&f;const x={opacity:uP,x:dj(u,v,g),y:hj(u,v,g)},$={enter:x,update:m={opacity:sP,text:{field:JT},x:x.x,y:x.y,align:y,baseline:b},exit:{opacity:uP,x:x.x,y:x.y}};fB($,{dx:!d&&p?dj(u,w):null,dy:!h&&p?hj(u,w):null}),fB($,{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:d,baseline:h});const k=a("labelBound");let M=a("labelOverlap");return M=M||k?{separation:a("labelSeparation"),method:M,order:"datum.index",bound:k?{scale:s,orient:u,tolerance:k}:null}:void 0,m.align!==y&&(m.align=Mj(m.align,y)),m.baseline!==b&&(m.baseline=Mj(m.baseline,b)),bP({type:dP,role:"axis-label",style:ZT,key:QT,from:r,encode:$,overlap:M},e)}function Nj(t,n){const e=function(t,n){var e,r,i,o=n.config,a=o.style,u=o.axis,s="band"===n.scaleType(t.scale)&&o.axisBand,c=t.orient;if(IB(c)){const t=Dj([o.axisX,o.axisY]),n=Dj([o.axisTop,o.axisBottom,o.axisLeft,o.axisRight]);for(i of(e={},t))e[i]=dj(c,Aj(i,o.axisX,u,a),Aj(i,o.axisY,u,a));for(i of(r={},n))r[i]=$j(c.signal,Aj(i,o.axisTop,u,a),Aj(i,o.axisBottom,u,a),Aj(i,o.axisLeft,u,a),Aj(i,o.axisRight,u,a))}else e=c===WT||c===YT?o.axisX:o.axisY,r=o["axis"+c[0].toUpperCase()+c.slice(1)];return e||r||s?st({},u,e,r,s):u}(t,n),r=t.encode||{},i=r.axis||{},o=i.name||void 0,a=i.interactive,u=i.style,s=mP(t,e),c=function(t){const n=t("tickBand");let e,r,i=t("tickOffset");return n?n.signal?(e={signal:`(${n.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${n.signal}) === 'extent'`},F(i)||(i={signal:`(${n.signal}) === 'extent' ? 0 : ${i}`})):"extent"===n?(e=1,r=!0,i=0):(e=.5,r=!1):(e=t("bandPosition"),r=t("tickExtra")),{extra:r,band:e,offset:i}}(s),l={scale:t.scale,ticks:!!s("ticks"),labels:!!s("labels"),grid:!!s("grid"),domain:!!s("domain"),title:null!=t.title},f=zB(n.add(rT({},[l]))),d=zB(n.add(nT({scale:n.scaleRef(t.scale),extra:n.property(c.extra),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)}))),h=[];let m;return l.grid&&h.push(function(t,n,e,r,i){const o=mP(t,n),a=t.orient,u=t.gridScale,s=fj(a,1,-1),c=function(t,n){if(1===n);else if(F(t)){let e=t=st({},t);for(;null!=e.mult;){if(!F(e.mult))return e.mult=IB(n)?{signal:`(${e.mult}) * (${n.signal})`}:e.mult*n,t;e=e.mult=st({},e.mult)}e.mult=n}else t=IB(n)?{signal:`(${n.signal}) * (${t||0})`}:n*(t||0);return t}(t.offset,s);let l,f,d;const h={enter:l={opacity:uP},update:d={opacity:sP},exit:f={opacity:uP}};fB(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const m={scale:t.scale,field:QT,band:i.band,extra:i.extra,offset:i.offset,round:o("tickRound")},p=dj(a,{signal:"height"},{signal:"width"}),g=u?{scale:u,range:0,mult:s,offset:c}:{value:0,offset:c},v=u?{scale:u,range:1,mult:s,offset:c}:st(p,{mult:s,offset:c});return l.x=d.x=dj(a,m,g),l.y=d.y=hj(a,m,g),l.x2=d.x2=hj(a,v),l.y2=d.y2=dj(a,v),f.x=dj(a,m),f.y=hj(a,m),bP({type:fP,role:"axis-grid",key:QT,from:r,encode:h},e)}(t,e,r.grid,d,c)),l.ticks&&(m=s("tickSize"),h.push(function(t,n,e,r,i,o){const a=mP(t,n),u=t.orient,s=fj(u,-1,1);let c,l,f;const d={enter:c={opacity:uP},update:f={opacity:sP},exit:l={opacity:uP}};fB(d,{stroke:a("tickColor"),strokeCap:a("tickCap"),strokeDash:a("tickDash"),strokeDashOffset:a("tickDashOffset"),strokeOpacity:a("tickOpacity"),strokeWidth:a("tickWidth")});const h=cB(i);h.mult=s;const m={scale:t.scale,field:QT,band:o.band,extra:o.extra,offset:o.offset,round:a("tickRound")};return f.y=c.y=dj(u,uP,m),f.y2=c.y2=dj(u,h),l.x=dj(u,m),f.x=c.x=hj(u,uP,m),f.x2=c.x2=hj(u,h),l.y=hj(u,m),bP({type:fP,role:"axis-tick",key:QT,from:r,encode:d},e)}(t,e,r.ticks,d,m,c))),l.labels&&(m=l.ticks?m:0,h.push(Ej(t,e,r.labels,d,m,c))),l.domain&&h.push(function(t,n,e,r){const i=mP(t,n),o=t.orient;let a,u;const s={enter:a={opacity:uP},update:u={opacity:sP},exit:{opacity:uP}};fB(s,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const c=Sj(t,0),l=Sj(t,1);return a.x=u.x=dj(o,c,uP),a.x2=u.x2=dj(o,l),a.y=u.y=hj(o,c,uP),a.y2=u.y2=hj(o,l),bP({type:fP,role:"axis-domain",from:r,encode:s},e)}(t,e,r.domain,f)),l.title&&h.push(function(t,n,e,r){const i=mP(t,n),o=t.orient,a=fj(o,-1,1);let u,s;const c={enter:u={opacity:uP,anchor:cB(i("titleAnchor",null)),align:{signal:vP}},update:s=st({},u,{opacity:sP,text:cB(t.title)}),exit:{opacity:uP}},l={signal:`lerp(range("${t.scale}"), ${gP(0,1,.5)})`};return s.x=dj(o,l),s.y=hj(o,l),u.angle=dj(o,uP,(t=>IB(t)?{signal:`(${t.signal}) * 90`}:{value:90*t})(a)),u.baseline=dj(o,mj(o,YT,WT),{value:YT}),s.angle=u.angle,s.baseline=u.baseline,fB(c,{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,n,e,r){const i=(t,n)=>null!=t?(e.update[n]=Mj(cB(t),e.update[n]),!1):!hB(n,r),o=i(t("titleX"),"x"),a=i(t("titleY"),"y");e.enter.auto=a===o?cB(a):dj(n,cB(a),cB(o))}(i,o,c,e),c.update.align=Mj(c.update.align,u.align),c.update.angle=Mj(c.update.angle,u.angle),c.update.baseline=Mj(c.update.baseline,u.baseline),bP({type:dP,role:"axis-title",style:tP,from:r,encode:c},e)}(t,e,r.title,f)),rj(hP({role:"axis",from:f,encode:dB(Cj(s,t),i,aP),marks:h,aria:s("aria"),description:s("description"),zindex:s("zindex"),name:o,interactive:a,style:u}),n)}function Cj(t,n){const e={enter:{},update:{}};return fB(e,{orient:t("orient"),offset:t("offset")||0,position:UB(n.position,0),titlePadding:t("titlePadding"),minExtent:t("minExtent"),maxExtent:t("maxExtent"),range:{signal:`abs(span(range("${n.scale}")))`},translate:t("translate"),format:n.format,formatType:n.formatType}),e}function Oj(t,n,e){const r=Q(t.signals),i=Q(t.scales);return e||r.forEach((t=>NB(t,n))),Q(t.projections).forEach((t=>function(t,n){const e=n.config.projection||{},r={};for(const e in t)"name"!==e&&(r[e]=UT(t[e],e,n));for(const t in e)null==r[t]&&(r[t]=UT(e[t],t,n));n.addProjection(t.name,r)}(t,n))),i.forEach((t=>function(t,n){const e=t.type||"linear";eg(e)||p("Unrecognized scale type: "+Nt(e)),n.addScale(t.name,{type:e,domain:void 0})}(t,n))),Q(t.data).forEach((t=>function(t,n){const e=[];t.transform&&t.transform.forEach((t=>{e.push(LP(t,n))})),t.on&&t.on.forEach((e=>{ej(e,n,t.name)})),n.addDataPipeline(t.name,function(t,n,e){const r=[];let i,o,a,u,s,c=null,l=!1,f=!1;for(t.values?IB(t.values)||qB(t.format)?(r.push(cj(n,t)),r.push(c=sj())):r.push(c=sj({$ingest:t.values,$format:t.format})):t.url?qB(t.url)||qB(t.format)?(r.push(cj(n,t)),r.push(c=sj())):r.push(c=sj({$request:t.url,$format:t.format})):t.source&&(c=i=Q(t.source).map((t=>zB(n.getData(t).output))),r.push(null)),o=0,a=e.length;o<a;++o)u=e[o],s=u.metadata,c||s.source||r.push(c=sj()),r.push(u),s.generates&&(f=!0),s.modifies&&!f&&(l=!0),s.source?c=u:s.changes&&(c=null);return i&&(a=i.length-1,r[0]=xT({derive:l,pulse:a?i:i[0]}),(l||a)&&r.splice(1,0,sj())),c||r.push(sj()),r.push(MT({})),r}(t,n,e))}(t,n))),i.forEach((t=>NT(t,n))),(e||r).forEach((t=>function(t,n){const e=n.getSignal(t.name);let r=t.update;t.init&&(r?p("Signals can not include both init and update expressions."):(r=t.init,e.initonly=!0)),r&&(r=V_(r,n),e.update=r.$expr,e.params=r.$params),t.on&&t.on.forEach((t=>function(t,n,e){const r=t.encode,i={target:e};let o=t.events,a=t.update,u=[];o||p("Signal update missing events specification."),$t(o)&&(o=eB(o,n.isSubscope()?RB:LB)),o=Q(o).filter((t=>t.signal||t.scale?(u.push(t),0):1)),u.length>1&&(u=[QB(u)]),o.length&&u.push(o.length>1?{merge:o}:o[0]),null!=r&&(a&&p("Signal encode and update are mutually exclusive."),a="encode(item(),"+Nt(r)+")"),i.update=$t(a)?V_(a,n):null!=a.expr?V_(a.expr,n):null!=a.value?a.value:null!=a.signal?{$expr:KB,$params:{$value:n.signalRef(a.signal)}}:p("Invalid signal update specification."),t.force&&(i.options={force:!0}),u.forEach((t=>n.addUpdate(st(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):GB(t,n)}}(t,n),i))))}(t,n,e.id)))}(t,n))),Q(t.axes).forEach((t=>Nj(t,n))),Q(t.marks).forEach((t=>rj(t,n))),Q(t.legends).forEach((t=>function(t,n){const e=n.config.legend,r=t.encode||{},i=mP(t,e),o=r.legend||{},a=o.name||void 0,u=o.interactive,s=o.style,c={};let l,f,d,h=0;oP.forEach((n=>t[n]?(c[n]=t[n],h=h||t[n]):0)),h||p("Missing valid scale for legend.");const m=function(t,n){let e=t.type||nP;return t.type||1!==function(t){return oP.reduce(((n,e)=>n+(t[e]?1:0)),0)}(t)||!t.fill&&!t.stroke||(e=ig(n)?eP:ag(n)?rP:nP),e!==eP?e:ag(n)?rP:eP}(t,n.scaleType(h)),g={title:null!=t.title,scales:c,type:m,vgrad:"symbol"!==m&&i.isVertical()},v=zB(n.add(rT(null,[g]))),y=zB(n.add(fT(f={type:m,scale:n.scaleRef(h),count:n.objectProperty(i("tickCount")),limit:n.property(i("symbolLimit")),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatType:n.property(t.formatType),formatSpecifier:n.property(t.format)})));return m===eP?(d=[wP(t,h,e,r.gradient),MP(t,e,r.labels,y)],f.count=f.count||n.signalRef(`max(2,2*floor((${WB(i.gradientLength())})/100))`)):m===rP?d=[xP(t,h,e,r.gradient,y),MP(t,e,r.labels,y)]:(l=function(t,n){const e=mP(t,n);return{align:e("gridAlign"),columns:e.entryColumns(),center:{row:!0,column:!1},padding:{row:e("rowPadding"),column:e("columnPadding")}}}(t,e),d=[AP(t,e,r,y,WB(l.columns))],f.size=function(t,n,e){const r=WB(oj("size",t,e)),i=WB(oj("strokeWidth",t,e)),o=WB(function(t,n,e){return pP("fontSize",t)||function(t,n,e){const r=n.config.style[e];return r&&r.fontSize}(0,n,e)}(e[1].encode,n,ZT));return V_(`max(ceil(sqrt(${r})+${i}),${o})`,n)}(t,n,d[0].marks)),d=[hP({role:"legend-entry",from:v,encode:{enter:{x:{value:0},y:{value:0}}},marks:d,layout:l,interactive:u})],g.title&&d.push(function(t,n,e,r){const i=mP(t,n),o={enter:{opacity:uP},update:{opacity:sP,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:uP}};return fB(o,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:OP},angle:{signal:_P},align:{signal:CP},baseline:{signal:zP},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")}),bP({type:dP,role:"legend-title",style:tP,from:r,encode:o},e)}(t,e,r.title,v)),rj(hP({role:"legend",from:v,encode:dB(ij(i,t,e),o,aP),marks:d,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:a,interactive:u,style:s}),n)}(t,n))),t.title&&function(t,n){const e=mP(t=$t(t)?{text:t}:t,n.config.title),r=t.encode||{},i=r.group||{},o=i.name||void 0,a=i.interactive,u=i.style,s=[],c=zB(n.add(rT(null,[{}])));s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return fB(o,{text:t.text,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("color"),font:n("font"),fontSize:n("fontSize"),fontStyle:n("fontStyle"),fontWeight:n("fontWeight"),lineHeight:n("lineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),bP({type:dP,role:"title-text",style:"group-title",from:r,encode:o},e)}(t,e,function(t){const n=t.encode;return n&&n.title||st({name:t.name,interactive:t.interactive,style:t.style},n)}(t),c)),t.subtitle&&s.push(function(t,n,e,r){const i={value:0},o={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return fB(o,{text:t.subtitle,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:n("dx"),dy:n("dy"),fill:n("subtitleColor"),font:n("subtitleFont"),fontSize:n("subtitleFontSize"),fontStyle:n("subtitleFontStyle"),fontWeight:n("subtitleFontWeight"),lineHeight:n("subtitleLineHeight")},{align:n("align"),angle:n("angle"),baseline:n("baseline")}),bP({type:dP,role:"title-subtitle",style:"group-subtitle",from:r,encode:o},e)}(t,e,r.subtitle,c)),rj(hP({role:"title",from:c,encode:uj(e,i),marks:s,aria:e("aria"),description:e("description"),zindex:e("zindex"),name:o,interactive:a,style:u}),n)}(t.title,n),n.parseLambdas(),n}function _j(t,n){return n&&n.signal?{name:t,update:n.signal}:{name:t,value:n}}function zj(t,n){this.config=t||{},this.options=n||{},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 Bj(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 Tj(t){return(S(t)?Pj:jj)(t)}function Pj(t){const n=t.length;let e="[";for(let r=0;r<n;++r){const n=t[r];e+=(r>0?",":"")+(F(n)?n.signal||Tj(n):Nt(n))}return e+"]"}function jj(t){let n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+Nt(n)+":"+(F(e)?e.signal||Tj(e):Nt(e));return r+"}"}zj.prototype=Bj.prototype={parse(t){return Oj(t,this)},fork(){return new Bj(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((n=>{n.$ref=t.id})),t.refs=null),t},proxy(t){const n=t instanceof CB?zB(t):t;return this.add(wT({value:n}))},addStream(t){return this.streams.push(t),t.id=this.id(),t},addUpdate(t){return this.updates.push(t),t},finish(){let t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(t,n,e){let r,i;t&&(r=t.data||(t.data={}),i=r[n]||(r[n]=[]),i.push(e))}for(t in this.data){n=this.data[t],e(n.input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values");for(const r in n.index)e(n.index[r],t,"index:"+r)}return this},pushState(t,n,e){this._encode.push(zB(this.add(MT({pulse:t})))),this._parent.push(n),this._lookup.push(e?zB(this.proxy(e)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return _(this._parent)},encode(){return _(this._encode)},lookup(){return _(this._lookup)},markpath(){const t=this._markpath;return++t[t.length-1]},fieldRef(t,n){if($t(t))return BB(t,n);t.signal||p("Unsupported field reference: "+Nt(t));const e=t.signal;let r=this.field[e];if(!r){const t={name:this.signalRef(e)};n&&(t.as=n),this.field[e]=r=zB(this.add(cT(t)))}return r},compareRef(t){let n=!1;const e=t=>IB(t)?(n=!0,this.signalRef(t.signal)):function(t){return t&&t.expr}(t)?(n=!0,this.exprRef(t.expr)):t,r=Q(t.field).map(e),i=Q(t.order).map(e);return n?zB(this.add(iT({fields:r,orders:i}))):PB(r,i)},keyRef(t,n){let e=!1;const r=this.signals;return t=Q(t).map((t=>IB(t)?(e=!0,zB(r[t.signal])):t)),e?zB(this.add(lT({fields:t,flat:n}))):function(t,n){const e={$key:t};return n&&(e.$flat=!0),e}(t,n)},sortRef(t){if(!t)return t;const n=jB(t.op,t.field),e=t.order||"ascending";return e.signal?zB(this.add(iT({fields:n,orders:this.signalRef(e.signal)}))):PB(n,e)},event(t,n){const e=t+":"+n;if(!this.events[e]){const r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},hasOwnSignal(t){return ft(this.signals,t)},addSignal(t,n){this.hasOwnSignal(t)&&p("Duplicate signal name: "+Nt(t));const e=n instanceof CB?n:this.add(_B(n));return this.signals[t]=e},getSignal(t){return this.signals[t]||p("Unrecognized signal name: "+Nt(t)),this.signals[t]},signalRef(t){return this.signals[t]?zB(this.signals[t]):(ft(this.lambdas,t)||(this.lambdas[t]=this.add(_B(null))),zB(this.lambdas[t]))},parseLambdas(){const t=Object.keys(this.lambdas);for(let n=0,e=t.length;n<e;++n){const e=t[n],r=V_(e,this),i=this.lambdas[e];i.params=r.$params,i.update=r.$expr}},property(t){return t&&t.signal?this.signalRef(t.signal):t},objectProperty(t){return t&&F(t)?this.signalRef(t.signal||Tj(t)):t},exprRef(t,n){const e={expr:V_(t,this)};return n&&(e.expr.$name=n),zB(this.add(uT(e)))},addBinding(t,n){this.bindings||p("Nested signals do not support binding: "+Nt(t)),this.bindings.push(st({signal:t},n))},addScaleProj(t,n){ft(this.scales,t)&&p("Duplicate scale or projection name: "+Nt(t)),this.scales[t]=this.add(n)},addScale(t,n){this.addScaleProj(t,kT(n))},addProjection(t,n){this.addScaleProj(t,bT(n))},getScale(t){return this.scales[t]||p("Unrecognized scale name: "+Nt(t)),this.scales[t]},scaleRef(t){return zB(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,n){return ft(this.data,t)&&p("Duplicate data set name: "+Nt(t)),this.data[t]=n},getData(t){return this.data[t]||p("Undefined data set name: "+Nt(t)),this.data[t]},addDataPipeline(t,n){return ft(this.data,t)&&p("Duplicate data set name: "+Nt(t)),this.addData(t,QP.fromEntries(this,n))}},st(_a,Zs,T$,hk,eF,ZF,TN,pN,IN,wC,_C,qC);var Rj=Object.freeze({__proto__:null,Bounds:Rv,CanvasHandler:xw,CanvasRenderer:Sw,DATE:xe,DAY:$e,DAYOFYEAR:ke,Dataflow:Na,Debug:4,DisallowedObjectProperties:M,Error:1,EventStream:ga,Gradient:Wg,GroupItem:Iv,HOURS:Me,Handler:Qb,HybridHandler:gx,HybridRenderer:px,Info:3,Item:Lv,MILLISECONDS:Se,MINUTES:Ae,MONTH:be,Marks:Tb,MultiPulse:Da,None:0,Operator:ha,Parameters:la,Pulse:$a,QUARTER:ye,RenderType:wx,Renderer:tw,ResourceLoader:qv,SECONDS:De,SVGHandler:Ew,SVGRenderer:tx,SVGStringRenderer:hx,Scenegraph:Wb,TIME_UNITS:Fe,Transform:Oa,View:Yz,WEEK:we,Warn:2,YEAR:ve,accessor:c,accessorFields:f,accessorName:l,array:Q,ascending:et,bandwidthNRD:Ra,bin:La,bootstrapCI:qa,boundClip:Fx,boundContext:cy,boundItem:Pb,boundMark:Rb,boundStroke:Hv,changeset:sa,clampRange:Z,codegenExpression:XO,compare:nt,constant:at,cumulativeLogNormal:nu,cumulativeNormal:Xa,cumulativeUniform:uu,dayofyear:Be,debounce:ut,defaultLocale:Ao,definition:za,densityLogNormal:tu,densityNormal:Va,densityUniform:au,domChild:Vb,domClear:Xb,domCreate:Gb,domFind:Yb,dotbin:Ua,error:p,expressionFunction:Y_,extend:st,extent:ct,extentIndex:lt,falsy:k,fastmap:ht,field:v,flush:mt,font:Fb,fontFamily:Sb,fontSize:$b,format:Wo,formatLocale:vo,formats:Ho,hasOwnProperty:ft,id:y,identity:b,inferType:Po,inferTypes:jo,ingest:ea,inherits:pt,inrange:gt,interpolate:pg,interpolateColors:dg,interpolateRange:fg,intersect:kx,intersectBoxLine:wy,intersectPath:gy,intersectPoint:vy,intersectRule:by,isArray:S,isBoolean:vt,isDate:yt,isFunction:tt,isIterable:bt,isNumber:wt,isObject:F,isRegExp:xt,isString:$t,isTuple:Zo,key:kt,lerp:Mt,lineHeight:kb,loader:Vo,locale:Mo,logger:D,lruCache:At,markup:Gw,merge:Dt,mergeConfig:N,multiLineOffset:Ab,one:x,pad:Ft,panLinear:I,panLog:q,panPow:U,panSymlog:W,parse:function(t,n,e){return F(t)||p("Input Vega specification must be an object."),n=N(function(){const t="sans-serif",n="#4c78a8",e="#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:n},area:{fill:n},image:null,line:{stroke:n,strokeWidth:2},path:{stroke:n},rect:{fill:n},rule:{stroke:e},shape:{stroke:n},symbol:{fill:n,size:64},text:{fill:e,font:t,fontSize:11},trail:{fill:n,size:2},style:{"guide-label":{fill:e,font:t,fontSize:10},"guide-title":{fill:e,font:t,fontSize:11,fontWeight:"bold"},"group-title":{fill:e,font:t,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:e,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"]}}}(),n,t.config),function(t,n){const e=n.config,r=zB(n.root=n.add(_B())),i=function(t,n){const e=e=>UB(t[e],n[e]),r=[_j("background",e("background")),_j("autosize",aB(e("autosize"))),_j("padding",sB(e("padding"))),_j("width",e("width")||0),_j("height",e("height")||0)],i=r.reduce(((t,n)=>(t[n.name]=n,t)),{}),o={};return Q(t.signals).forEach((t=>{ft(i,t.name)?t=st(i[t.name],t):r.push(t),o[t.name]=t})),Q(n.signals).forEach((t=>{ft(o,t.name)||ft(i,t.name)||r.push(t)})),r}(t,e);i.forEach((t=>NB(t,n))),n.description=t.description||e.description,n.eventConfig=e.events,n.legends=n.objectProperty(e.legend&&e.legend.layout),n.locale=e.locale;const o=n.add(rT()),a=n.add(aT(AB((t=>dB({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t))(t.encode),cP,pB,t.style,n,{pulse:zB(o)}))),u=n.add(DT({layout:n.objectProperty(t.layout),legends:n.legends,autosize:n.signalRef("autosize"),mark:r,pulse:zB(a)}));n.operators.pop(),n.pushState(zB(a),zB(u),null),Oj(t,n,i),n.operators.push(u);let s=n.add(eT({mark:r,pulse:zB(u)}));return s=n.add($T({pulse:zB(s)})),s=n.add(MT({pulse:zB(s)})),n.addData("root",new QP(n,o,o,s)),n}(t,new zj(n,e)).toRuntime()},parseExpression:GO,parseSelector:eB,path:bc,pathCurves:Gg,pathEqual:Nx,pathParse:Qg,pathRectangle:$v,pathRender:cv,pathSymbols:hv,pathTrail:kv,peek:_,point:Kb,projection:MS,quantileLogNormal:eu,quantileNormal:Ja,quantileUniform:su,quantiles:Pa,quantizeInterpolator:hg,quarter:J,quartiles:ja,get random(){return Ia},randomInteger:function(t,n){let e,r,i;null==n&&(n=t,t=0);const o={min(t){return arguments.length?(e=t||0,i=r-e,o):e},max(t){return arguments.length?(r=t||0,i=r-e,o):r},sample:()=>e+Math.floor(i*Ia()),pdf:t=>t===Math.floor(t)&&t>=e&&t<r?1/i:0,cdf(t){const n=Math.floor(t);return n<e?0:n>=r?1:(n-e+1)/i},icdf:t=>t>=0&&t<=1?e-1+Math.floor(t*i):NaN};return o.min(t).max(n)},randomKDE:Qa,randomLCG:function(t){return function(){return(t=(1103515245*t+12345)%2147483647)/2147483647}},randomLogNormal:ru,randomMixture:iu,randomNormal:Ka,randomUniform:cu,read:Yo,regressionConstant:lu,regressionExp:vu,regressionLinear:pu,regressionLoess:$u,regressionLog:gu,regressionPoly:wu,regressionPow:yu,regressionQuad:bu,renderModule:$x,repeat:St,resetDefaultLocale:function(){return po(),wo(),Ao()},resetSVGDefIds:function(){Pv=1,Rg=0},responseType:Go,runtimeContext:rz,sampleCurve:Du,sampleLogNormal:Za,sampleNormal:Ya,sampleUniform:ou,scale:ng,sceneEqual:Ex,sceneFromJSON:qb,scenePickVisit:Cy,sceneToJSON:Ib,sceneVisit:Ny,sceneZOrder:Ey,scheme:bg,serializeXML:Yw,setHybridRendererOptions:function(t){mx.svgMarkTypes=t.svgMarkTypes??["text"],mx.svgOnTop=t.svgOnTop??!0,mx.debug=t.debug??!1},setRandom:function(t){Ia=t},span:Et,splitAccessPath:g,stringValue:Nt,textMetrics:gb,timeBin:wr,timeFloor:Ke,timeFormatLocale:$o,timeInterval:rr,timeOffset:ar,timeSequence:cr,timeUnitSpecifier:Oe,timeUnits:Ne,toBoolean:Ct,toDate:_t,toNumber:z,toSet:Bt,toString:zt,transform:Ba,transforms:_a,truncate:Tt,truthy:$,tupleid:ta,typeParsers:zo,utcFloor:tr,utcInterval:ir,utcOffset:ur,utcSequence:lr,utcdayofyear:Ie,utcquarter:K,utcweek:qe,version:"6.2.0",visitArray:Pt,week:Te,writeConfig:C,zero:w,zoomLinear:G,zoomLog:Y,zoomPow:V,zoomSymlog:X}),Lj={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},Ij={"*":(t,n)=>t*n,"+":(t,n)=>t+n,"-":(t,n)=>t-n,"/":(t,n)=>t/n,"%":(t,n)=>t%n,">":(t,n)=>t>n,"<":(t,n)=>t<n,"<=":(t,n)=>t<=n,">=":(t,n)=>t>=n,"==":(t,n)=>t==n,"!=":(t,n)=>t!=n,"===":(t,n)=>t===n,"!==":(t,n)=>t!==n,"&":(t,n)=>t&n,"|":(t,n)=>t|n,"^":(t,n)=>t^n,"<<":(t,n)=>t<<n,">>":(t,n)=>t>>n,">>>":(t,n)=>t>>>n},qj={"+":t=>+t,"-":t=>-t,"~":t=>~t,"!":t=>!t};const Uj=Array.prototype.slice,Wj=(t,n,e)=>{const r=e?e(n[0]):n[0];return r[t].apply(r,Uj.call(n,1))};var Hj={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:(t,n,e)=>Math.max(n,Math.min(e,t)),now:Date.now,utc:Date.UTC,datetime:(t,n=0,e=1,r=0,i=0,o=0,a=0)=>$t(t)?new Date(t):new Date(t,n,e,r,i,o,a),date:t=>new Date(t).getDate(),day:t=>new Date(t).getDay(),year:t=>new Date(t).getFullYear(),month:t=>new Date(t).getMonth(),hours:t=>new Date(t).getHours(),minutes:t=>new Date(t).getMinutes(),seconds:t=>new Date(t).getSeconds(),milliseconds:t=>new Date(t).getMilliseconds(),time:t=>new Date(t).getTime(),timezoneoffset:t=>new Date(t).getTimezoneOffset(),utcdate:t=>new Date(t).getUTCDate(),utcday:t=>new Date(t).getUTCDay(),utcyear:t=>new Date(t).getUTCFullYear(),utcmonth:t=>new Date(t).getUTCMonth(),utchours:t=>new Date(t).getUTCHours(),utcminutes:t=>new Date(t).getUTCMinutes(),utcseconds:t=>new Date(t).getUTCSeconds(),utcmilliseconds:t=>new Date(t).getUTCMilliseconds(),length:t=>t.length,join:function(){return Wj("join",arguments)},indexof:function(){return Wj("indexOf",arguments)},lastindexof:function(){return Wj("lastIndexOf",arguments)},slice:function(){return Wj("slice",arguments)},reverse:t=>t.slice().reverse(),sort:t=>t.slice().sort(et),parseFloat,parseInt,upper:t=>String(t).toUpperCase(),lower:t=>String(t).toLowerCase(),substring:function(){return Wj("substring",arguments,String)},split:function(){return Wj("split",arguments,String)},replace:function(){return Wj("replace",arguments,String)},trim:t=>String(t).trim(),btoa:t=>btoa(t),atob:t=>atob(t),regexp:RegExp,test:(t,n)=>RegExp(t).test(n)};const Gj=["view","item","group","xy","x","y"],Yj=new Set([Function,eval,setTimeout,setInterval]);"function"==typeof setImmediate&&Yj.add(setImmediate);const Vj={Literal:(t,n)=>n.value,Identifier:(t,n)=>{const e=n.name;return t.memberDepth>0?e:"datum"===e?t.datum:"event"===e?t.event:"item"===e?t.item:Lj[e]||t.params["$"+e]},MemberExpression:(t,n)=>{const e=!n.computed,r=t(n.object);e&&(t.memberDepth+=1);const i=t(n.property);if(e&&(t.memberDepth-=1),!Yj.has(r[i]))return r[i];console.error(`Prevented interpretation of member "${i}" which could lead to insecure code execution`)},CallExpression:(t,n)=>{const e=n.arguments;let r=n.callee.name;return r.startsWith("_")&&(r=r.slice(1)),"if"===r?t(e[0])?t(e[1]):t(e[2]):(t.fn[r]||Hj[r]).apply(t.fn,e.map(t))},ArrayExpression:(t,n)=>n.elements.map(t),BinaryExpression:(t,n)=>Ij[n.operator](t(n.left),t(n.right)),UnaryExpression:(t,n)=>qj[n.operator](t(n.argument)),ConditionalExpression:(t,n)=>t(n.test)?t(n.consequent):t(n.alternate),LogicalExpression:(t,n)=>"&&"===n.operator?t(n.left)&&t(n.right):t(n.left)||t(n.right),ObjectExpression:(t,n)=>n.properties.reduce(((n,e)=>{t.memberDepth+=1;const r=t(e.key);t.memberDepth-=1;const i=t(e.value);return M.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):Yj.has(i)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):n[r]=i,n}),{})};function Xj(t,n,e,r,i,o){const a=t=>Vj[t.type](a,t);return a.memberDepth=0,a.fn=Object.create(n),a.params=e,a.datum=r,a.event=i,a.item=o,Gj.forEach((t=>a.fn[t]=(...n)=>i.vega[t](...n))),a(t)}var Jj={operator(t,n){const e=n.ast,r=t.functions;return t=>Xj(e,r,t)},parameter(t,n){const e=n.ast,r=t.functions;return(t,n)=>Xj(e,r,n,t)},event(t,n){const e=n.ast,r=t.functions;return t=>Xj(e,r,void 0,void 0,t)},handler(t,n){const e=n.ast,r=t.functions;return(t,n)=>Xj(e,r,t,n.item&&n.item.datum,n)},encode(t,n){const{marktype:e,channels:r}=n,i=t.functions,o="group"===e||"image"===e||"rect"===e;return(t,n)=>{const a=t.datum;let u,s=0;for(const e in r)u=Xj(r[e].ast,i,n,a,void 0,t),t[e]!==u&&(t[e]=u,s=1);return"rule"!==e&&function(t,n,e){let r;n.x2&&(n.x?(e&&t.x>t.x2&&(r=t.x,t.x=t.x2,t.x2=r),t.width=t.x2-t.x):t.x=t.x2-(t.width||0)),n.xc&&(t.x=t.xc-(t.width||0)/2),n.y2&&(n.y?(e&&t.y>t.y2&&(r=t.y,t.y=t.y2,t.y2=r),t.height=t.y2-t.y):t.y=t.y2-(t.height||0)),n.yc&&(t.y=t.yc-(t.height||0)/2)}(t,r,o),s}}};function Kj(t){return GR(t,"or")}function Qj(t){return GR(t,"and")}function Zj(t){return GR(t,"not")}function tR(t,n){if(Zj(t))tR(t.not,n);else if(Qj(t))for(const e of t.and)tR(e,n);else if(Kj(t))for(const e of t.or)tR(e,n);else n(t)}function nR(t,n){return Zj(t)?{not:nR(t.not,n)}:Qj(t)?{and:t.and.map((t=>nR(t,n)))}:Kj(t)?{or:t.or.map((t=>nR(t,n)))}:n(t)}const eR=structuredClone;function rR(t){throw new Error(t)}function iR(t,n){const e={};for(const r of n)ft(t,r)&&(e[r]=t[r]);return e}function oR(t,n){const e={...t};for(const t of n)delete e[t];return e}function aR(t){if(wt(t))return t;const n=$t(t)?t:HR(t);if(n.length<250)return n;let e=0;for(let t=0;t<n.length;t++)e=(e<<5)-e+n.charCodeAt(t),e|=0;return e}function uR(t){return!1===t||null===t}function sR(t,n){return t.includes(n)}function cR(t,n){let e=0;for(const[r,i]of t.entries())if(n(i,r,e++))return!0;return!1}function lR(t,n){let e=0;for(const[r,i]of t.entries())if(!n(i,r,e++))return!1;return!0}function fR(t,...n){for(const e of n)dR(t,e??{});return t}function dR(t,n){for(const e of bR(n))C(t,e,n[e],!0)}function hR(t,n){const e=[],r={};let i;for(const o of t)i=n(o),i in r||(r[i]=1,e.push(o));return e}function mR(t,n){if(t.size!==n.size)return!1;for(const e of t)if(!n.has(e))return!1;return!0}function pR(t,n){for(const e of t)if(n.has(e))return!0;return!1}function gR(t){const n=new Set;for(const e of t){const t=g(e).map(((t,n)=>0===n?t:`[${t}]`)),r=t.map(((n,e)=>t.slice(0,e+1).join("")));for(const t of r)n.add(t)}return n}function vR(t,n){return void 0===t||void 0===n||pR(gR(t),gR(n))}function yR(t){return 0===bR(t).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((t=>HR(t))).join(",")})`};const bR=Object.keys,wR=Object.values,xR=Object.entries;function $R(t){return!0===t||!1===t}function kR(t){const n=t.replace(/\W/g,"_");return(t.match(/^\d+/)?"_":"")+n}function MR(t,n){return Zj(t)?`!(${MR(t.not,n)})`:Qj(t)?`(${t.and.map((t=>MR(t,n))).join(") && (")})`:Kj(t)?`(${t.or.map((t=>MR(t,n))).join(") || (")})`:n(t)}function AR(t,n){if(0===n.length)return!0;const e=n.shift();return e in t&&AR(t[e],n)&&delete t[e],yR(t)}function DR(t){return t.charAt(0).toUpperCase()+t.substr(1)}function SR(t,n="datum"){const e=g(t),r=[];for(let t=1;t<=e.length;t++){const i=`[${e.slice(0,t).map(Nt).join("][")}]`;r.push(`${n}${i}`)}return r.join(" && ")}function FR(t,n="datum"){return`${n}[${Nt(g(t).join("."))}]`}function ER(t){return`datum['${t.replaceAll("'","\\'")}']`}function NR(t){return t.replaceAll("\\'","'").replaceAll("\\.",".")}function CR(t){return t.replace(/(\[|\]|\.|'|")/g,"\\$1")}function OR(t){return`${g(t).map(CR).join("\\.")}`}function _R(t,n,e){return t.replace(new RegExp(n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),e)}function zR(t){return`${g(t).join(".")}`}function BR(t){return t?g(t).length:0}function TR(...t){return t.find((t=>void 0!==t))}let PR=42;function jR(t){const n=++PR;return t?String(t)+n:n}function RR(t){return LR(t)?t:`__${t}`}function LR(t){return t.startsWith("__")}function IR(t){if(void 0!==t)return(t%360+360)%360}function qR(t){return!!wt(t)||!isNaN(t)&&!isNaN(parseFloat(t))}const UR=Object.getPrototypeOf(structuredClone({}));function WR(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor.name!==n.constructor.name)return!1;let e,r;if(Array.isArray(t)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(!WR(t[r],n[r]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;for(const e of t.entries())if(!WR(e[1],n.get(e[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(const e of t.entries())if(!n.has(e[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(e=t.length,e!=n.length)return!1;for(r=e;0!=r--;)if(t[r]!==n[r])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf&&t.valueOf!==UR.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString&&t.toString!==UR.toString)return t.toString()===n.toString();const i=Object.keys(t);if(e=i.length,e!==Object.keys(n).length)return!1;for(r=e;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,i[r]))return!1;for(r=e;0!=r--;){const e=i[r];if(!WR(t[e],n[e]))return!1}return!0}return t!=t&&n!=n}function HR(t){const n=[];return function t(e){if(e?.toJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),void 0===e)return;if("number"==typeof e)return isFinite(e)?`${e}`:"null";if("object"!=typeof e)return JSON.stringify(e);let r,i;if(Array.isArray(e)){for(i="[",r=0;r<e.length;r++)r&&(i+=","),i+=t(e[r])||"null";return`${i}]`}if(null===e)return"null";if(n.includes(e))throw new TypeError("Converting circular structure to JSON");const o=n.push(e)-1,a=Object.keys(e).sort();for(i="",r=0;r<a.length;r++){const n=a[r],o=t(e[n]);o&&(i&&(i+=","),i+=`${JSON.stringify(n)}:${o}`)}return n.splice(o,1),`{${i}}`}(t)}function GR(t,n){return F(t)&&ft(t,n)&&void 0!==t[n]}const YR="row",VR="column",XR="facet",JR="x",KR="y",QR="x2",ZR="y2",tL="xOffset",nL="yOffset",eL="radius",rL="radius2",iL="theta",oL="theta2",aL="latitude",uL="longitude",sL="latitude2",cL="longitude2",lL="time",fL="color",dL="fill",hL="stroke",mL="shape",pL="size",gL="angle",vL="opacity",yL="fillOpacity",bL="strokeOpacity",wL="strokeWidth",xL="strokeDash",$L="text",kL="order",ML="detail",AL="key",DL="tooltip",SL="href",FL="url",EL="description",NL={theta:1,theta2:1,radius:1,radius2:1};function CL(t){return ft(NL,t)}const OL={longitude:1,longitude2:1,latitude:1,latitude2:1};function _L(t){switch(t){case aL:return"y";case sL:return"y2";case uL:return"x";case cL:return"x2"}}function zL(t){return ft(OL,t)}const BL=bR(OL),TL={x:1,y:1,x2:1,y2:1,...NL,...OL,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 PL(t){return t===fL||t===dL||t===hL}const jL={row:1,column:1,facet:1},RL=bR(jL),LL={...TL,...jL},IL=bR(LL),{order:qL,detail:UL,tooltip:WL,...HL}=LL,{row:GL,column:YL,facet:VL,...XL}=HL;function JL(t){return ft(LL,t)}const KL=[QR,ZR,sL,cL,oL,rL];function QL(t){return ZL(t)!==t}function ZL(t){switch(t){case QR:return JR;case ZR:return KR;case sL:return aL;case cL:return uL;case oL:return iL;case rL:return eL}return t}function tI(t){if(CL(t))switch(t){case iL:return"startAngle";case oL:return"endAngle";case eL:return"outerRadius";case rL:return"innerRadius"}return t}function nI(t){switch(t){case JR:return QR;case KR:return ZR;case aL:return sL;case uL:return cL;case iL:return oL;case eL:return rL}}function eI(t){switch(t){case JR:case QR:return"width";case KR:case ZR:return"height"}}function rI(t){switch(t){case JR:return"xOffset";case KR:return"yOffset";case QR:return"x2Offset";case ZR:return"y2Offset";case iL:return"thetaOffset";case eL:return"radiusOffset";case oL:return"theta2Offset";case rL:return"radius2Offset"}}function iI(t){switch(t){case JR:return"xOffset";case KR:return"yOffset"}}function oI(t){switch(t){case"xOffset":return"x";case"yOffset":return"y"}}const aI=bR(TL),{x:uI,y:sI,x2:cI,y2:lI,xOffset:fI,yOffset:dI,latitude:hI,longitude:mI,latitude2:pI,longitude2:gI,theta:vI,theta2:yI,radius:bI,radius2:wI,...xI}=TL,$I=bR(xI),kI={x:1,y:1},MI=bR(kI);function AI(t){return ft(kI,t)}const DI={theta:1,radius:1},SI=bR(DI);function FI(t){return"width"===t?JR:KR}const EI={xOffset:1,yOffset:1};function NI(t){return ft(EI,t)}const CI={time:1};function OI(t){return t in CI}const{text:_I,tooltip:zI,href:BI,url:TI,description:PI,detail:jI,key:RI,order:LI,...II}=xI,qI=bR(II),UI={...kI,...DI,...EI,...II},WI=bR(UI);function HI(t){return ft(UI,t)}const GI={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:YI,...VI}=GI;function XI(t){switch(t){case JR:case KR:case iL:case eL:case tL:case nL:case pL:case gL:case wL:case vL:case yL:case bL:case lL:case QR:case ZR:case oL:case rL:return;case XR:case YR:case VR:case mL:case xL:case $L:case DL:case SL:case FL:case EL:return"discrete";case fL:case dL:case hL:return"flexible";case aL:case uL:case sL:case cL:case ML:case AL:case kL:return}}const JI={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},KI={count:1,min:1,max:1};function QI(t){return GR(t,"argmin")}function ZI(t){return GR(t,"argmax")}function tq(t){return $t(t)&&ft(JI,t)}const nq=new Set(["count","valid","missing","distinct"]);function eq(t){return $t(t)&&nq.has(t)}const rq=new Set(["count","sum","distinct","valid","missing"]),iq=new Set(["mean","average","median","q1","q3","min","max"]);function oq(t){return vt(t)&&(t=xG(t,void 0)),`bin${bR(t).map((n=>cq(t[n])?kR(`_${n}_${xR(t[n])}`):kR(`_${n}_${t[n]}`))).join("")}`}function aq(t){return!0===t||sq(t)&&!t.binned}function uq(t){return"binned"===t||sq(t)&&!0===t.binned}function sq(t){return F(t)}function cq(t){return GR(t,"param")}function lq(t){switch(t){case YR:case VR:case pL:case fL:case dL:case hL:case wL:case vL:case yL:case bL:case mL:return 6;case xL:return 4;default:return 10}}function fq(t){return GR(t,"expr")}function dq(t,{level:n}={level:0}){const e=bR(t||{}),r={};for(const i of e)r[i]=0===n?$q(t[i]):dq(t[i],{level:n-1});return r}function hq(t){const{anchor:n,frame:e,offset:r,orient:i,angle:o,limit:a,color:u,subtitleColor:s,subtitleFont:c,subtitleFontSize:l,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:m,...p}=t,g={...n?{anchor:n}:{},...e?{frame:e}:{},...r?{offset:r}:{},...i?{orient:i}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...s?{subtitleColor:s}:{},...c?{subtitleFont:c}:{},...l?{subtitleFontSize:l}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...m?{subtitlePadding:m}:{}};return{titleMarkConfig:{...p,...u?{fill:u}:{}},subtitleMarkConfig:iR(t,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:g,subtitle:v}}function mq(t){return $t(t)||S(t)&&$t(t[0])}function pq(t){return GR(t,"signal")}function gq(t){return GR(t,"step")}function vq(t){return!S(t)&&GR(t,"field")&&GR(t,"data")}const yq=bR({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}),bq={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},wq=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function xq(t){const n=S(t.condition)?t.condition.map(kq):kq(t.condition);return{...$q(t),condition:n}}function $q(t){if(fq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function kq(t){if(fq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return t}function Mq(t){if(fq(t)){const{expr:n,...e}=t;return{signal:n,...e}}return pq(t)?t:void 0!==t?{value:t}:void 0}function Aq(t){return pq(t)?t.signal:Nt(t)}function Dq(t){return pq(t)?t.signal:Nt(t.value)}function Sq(t){return pq(t)?t.signal:null==t?null:Nt(t)}function Fq(t,n,e){for(const r of e){const e=Cq(r,n.markDef,n.config);void 0!==e&&(t[r]=Mq(e))}return t}function Eq(t){return[].concat(t.type,t.style??[])}function Nq(t,n,e,r={}){const{vgChannel:i,ignoreVgConfig:o}=r;return i&&GR(n,i)?n[i]:void 0!==n[t]?n[t]:!o||i&&i!==t?Cq(t,n,e,r):void 0}function Cq(t,n,e,{vgChannel:r}={}){const i=Oq(t,n,e.style);return TR(r?i:void 0,i,r?e[n.type][r]:void 0,e[n.type][t],r?e.mark[r]:e.mark[t])}function Oq(t,n,e){return _q(t,Eq(n),e)}function _q(t,n,e){let r;n=Q(n);for(const i of n){const n=e[i];GR(n,t)&&(r=n[t])}return r}function zq(t,n){return Q(t).reduce(((t,e)=>(t.field.push(uG(e,n)),t.order.push(e.sort??"ascending"),t)),{field:[],order:[]})}function Bq(t,n){const e=[...t];return n.forEach((t=>{for(const n of e)if(WR(n,t))return;e.push(t)})),e}function Tq(t,n){return WR(t,n)||!n?t:t?[...Q(t),...Q(n)].join(", "):n}function Pq(t,n){const e=t.value,r=n.value;if(null==e||null===r)return{explicit:t.explicit,value:null};if((mq(e)||pq(e))&&(mq(r)||pq(r)))return{explicit:t.explicit,value:Tq(e,r)};if(mq(e)||pq(e))return{explicit:t.explicit,value:e};if(mq(r)||pq(r))return{explicit:t.explicit,value:r};if(!(mq(e)||pq(e)||mq(r)||pq(r)))return{explicit:t.explicit,value:Bq(e,r)};throw new Error("It should never reach here")}function jq(t){return`Invalid specification ${HR(t)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}function Rq(t){return("width"==t?"Width":"Height")+' "container" only works for single views and layered views.'}function Lq(t){return`${"width"==t?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==t?"x":"y"}".`}function Iq(t){return t?`Dropping "fit-${t}" because spec has discrete ${eI(t)}.`:'Dropping "fit" because spec has discrete size.'}function qq(t){return`Unknown field for ${t}. Cannot calculate view size.`}function Uq(t){return`Cannot project a selection on encoding channel "${t}", which has no field.`}function Wq(t,n){return`Cannot project a selection on encoding channel "${t}" as it uses an aggregate function ("${n}").`}function Hq(t){return`Selection not supported for ${t} yet.`}function Gq(t){return`The "columns" property cannot be used when "${t}" has nested row/column.`}const Yq="Animation involving facet, layer, or concat is currently unsupported.";function Vq(t,n,e){return`An ancestor parsed field "${t}" as ${e} but a child wants to parse the field as ${n}.`}function Xq(t){return`Ignoring an invalid transform: ${HR(t)}.`}function Jq(t){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${t} are dropped.`}function Kq(t){return`${t}Offset dropped because ${t} is continuous`}function Qq(t){return`Invalid field type "${t}".`}function Zq(t,n){const{fill:e,stroke:r}=n;return`Dropping color ${t} as the plot also has ${e&&r?"fill and stroke":e?"fill":"stroke"}.`}function tU(t,n){return`Dropping ${HR(t)} from channel "${n}" since it does not contain any data field, datum, value, or signal.`}function nU(t,n){return`${t} dropped as it is incompatible with "${n}".`}function eU(t){return`${t} encoding should be discrete (ordinal / nominal / binned).`}function rU(t){return`${t} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function iU(t,n){return`Using discrete channel "${t}" to encode "${n}" field can be misleading as it does not encode ${"ordinal"===n?"order":"magnitude"}.`}function oU(t){return`Using unaggregated domain with raw field has no effect (${HR(t)}).`}function aU(t){return`Unaggregated domain not applicable for "${t}" since it produces values outside the origin domain of the source data.`}function uU(t){return`Unaggregated domain is currently unsupported for log scale (${HR(t)}).`}function sU(t,n,e){return`${e}-scale's "${n}" is dropped as it does not work with ${t} scale.`}function cU(t){return`The step for "${t}" is dropped because the ${"width"===t?"x":"y"} is continuous.`}const lU="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function fU(t,n){return`Invalid ${t}: ${HR(n)}.`}function dU(t){return`1D error band does not support ${t}.`}function hU(t){return`Channel ${t} is required for "binned" bin.`}const mU=D(2);let pU=mU;function gU(...t){pU.error(...t)}function vU(...t){pU.warn(...t)}function yU(t){if(t&&F(t))for(const n of DU)if(GR(t,n))return!0;return!1}const bU=["january","february","march","april","may","june","july","august","september","october","november","december"],wU=bU.map((t=>t.substr(0,3))),xU=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],$U=xU.map((t=>t.substr(0,3)));function kU(t,n){const e=[];if(n&&void 0!==t.day&&bR(t).length>1&&(vU(function(t){return`Dropping day from datetime ${HR(t)} as day cannot be combined with other units.`}(t)),delete(t=eR(t)).day),e.push(void 0!==t.year?t.year:2012),void 0!==t.month){const r=n?function(t){if(qR(t)&&(t=+t),wt(t))return t-1;{const n=t.toLowerCase(),e=bU.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=wU.indexOf(r);if(-1!==i)return i;throw new Error(fU("month",t))}}(t.month):t.month;e.push(r)}else if(void 0!==t.quarter){const r=n?function(t){if(qR(t)&&(t=+t),wt(t))return t>4&&vU(fU("quarter",t)),t-1;throw new Error(fU("quarter",t))}(t.quarter):t.quarter;e.push(wt(r)?3*r:`${r}*3`)}else e.push(0);if(void 0!==t.date)e.push(t.date);else if(void 0!==t.day){const r=n?function(t){if(qR(t)&&(t=+t),wt(t))return t%7;{const n=t.toLowerCase(),e=xU.indexOf(n);if(-1!==e)return e;const r=n.substr(0,3),i=$U.indexOf(r);if(-1!==i)return i;throw new Error(fU("day",t))}}(t.day):t.day;e.push(wt(r)?r+1:`${r}+1`)}else e.push(1);for(const n of["hours","minutes","seconds","milliseconds"]){const r=t[n];e.push(void 0===r?0:r)}return e}function MU(t){const n=kU(t,!0).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}const AU={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},DU=bR(AU);function SU(t){return F(t)?t.binned:FU(t)}function FU(t){return t?.startsWith("binned")}function EU(t){return t.startsWith("utc")}const NU={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function CU(t){return DU.filter((n=>_U(t,n)))}function OU(t){const n=CU(t);return n[n.length-1]}function _U(t,n){const e=t.indexOf(n);return!(e<0||e>0&&"seconds"===n&&"i"===t.charAt(e-1)||t.length>e+3&&"day"===n&&"o"===t.charAt(e+3)||e>0&&"year"===n&&"f"===t.charAt(e-1))}function zU(t){if(t)return`timeUnitSpecifier(${HR(CU(t))}, ${HR(NU)})`}function BU(t){if(!t)return;let n;return $t(t)?n=FU(t)?{unit:t.substring(6),binned:!0}:{unit:t}:F(t)&&(n={...t,...t.unit?{unit:t.unit}:{}}),EU(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function TU(t,n=t=>t){const e=BU(t),r=OU(e.unit);if(r&&"day"!==r){const t={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:i,part:o}=jU(r,e.step);return`${n(MU({...t,[o]:+t[o]+i}))} - ${n(MU(t))}`}}const PU={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function jU(t,n=1){if(function(t){return ft(PU,t)}(t))return{part:t,step:n};switch(t){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 RU(t){return!!t?.field&&void 0!==t.equal}function LU(t){return!!t?.field&&void 0!==t.lt}function IU(t){return!!t?.field&&void 0!==t.lte}function qU(t){return!!t?.field&&void 0!==t.gt}function UU(t){return!!t?.field&&void 0!==t.gte}function WU(t){if(t?.field){if(S(t.range)&&2===t.range.length)return!0;if(pq(t.range))return!0}return!1}function HU(t){return!!t?.field&&(S(t.oneOf)||S(t.in))}function GU(t){return HU(t)||RU(t)||WU(t)||LU(t)||qU(t)||IU(t)||UU(t)}function YU(t,n){return MG(t,{timeUnit:n,wrapTime:!0})}function VU(t,n=!0){const{field:e}=t,r=BU(t.timeUnit),{unit:i,binned:o}=r||{},a=uG(t,{expr:"datum"}),u=i?`time(${o?a:function(t,n,{end:e}={end:!1}){const r=SR(n),i=EU(t)?"utc":"";let o;const a={};for(const n of DU)_U(t,n)&&(a[n]="quarter"===(u=n)?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`,o=n);var u;return e&&(a[o]+="+1"),function(t){const n=kU(t,!1).join(", ");return t.utc?`utc(${n})`:`datetime(${n})`}(a)}(i,e)})`:a;if(RU(t))return`${u}===${YU(t.equal,i)}`;if(LU(t))return`${u}<${YU(t.lt,i)}`;if(qU(t))return`${u}>${YU(t.gt,i)}`;if(IU(t))return`${u}<=${YU(t.lte,i)}`;if(UU(t))return`${u}>=${YU(t.gte,i)}`;if(HU(t))return`indexof([${function(t,n){return t.map((t=>YU(t,n)))}(t.oneOf,i).join(",")}], ${u}) !== -1`;if(function(t){return!!t?.field&&void 0!==t.valid}(t))return XU(u,t.valid);if(WU(t)){const{range:e}=dq(t),r=pq(e)?{signal:`${e.signal}[0]`}:e[0],o=pq(e)?{signal:`${e.signal}[1]`}:e[1];if(null!==r&&null!==o&&n)return`inrange(${u}, [${YU(r,i)}, ${YU(o,i)}])`;const a=[];return null!==r&&a.push(`${u} >= ${YU(r,i)}`),null!==o&&a.push(`${u} <= ${YU(o,i)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${HR(t)}`)}function XU(t,n=!0){return n?`isValid(${t}) && isFinite(+${t})`:`!isValid(${t}) || !isFinite(+${t})`}function JU(t){return GU(t)&&t.timeUnit?{...t,timeUnit:BU(t.timeUnit)}:t}function KU(t){return"quantitative"===t||"temporal"===t}function QU(t){return"ordinal"===t||"nominal"===t}const ZU="quantitative",tW="ordinal",nW="temporal",eW="nominal",rW="geojson",iW="linear",oW="time",aW="utc",uW="point",sW="band",cW={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 lW(t,n){const e=cW[t],r=cW[n];return e===r||"ordinal-position"===e&&"time"===r||"ordinal-position"===r&&"time"===e}const fW={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 dW(t){return fW[t]}const hW=new Set(["linear","log","pow","sqrt","symlog"]),mW=new Set([...hW,"time","utc"]);function pW(t){return hW.has(t)}const gW=new Set(["quantile","quantize","threshold"]),vW=new Set([...mW,...gW,"sequential","identity"]),yW=new Set(["ordinal","bin-ordinal","point","band"]);function bW(t){return yW.has(t)}function wW(t){return vW.has(t)}function xW(t){return mW.has(t)}function $W(t){return gW.has(t)}function kW(t){return GR(t,"param")}const{type:MW,domain:AW,range:DW,rangeMax:SW,rangeMin:FW,scheme:EW,...NW}={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},CW=bR(NW);function OW(t,n){switch(n){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(t);case"bins":return!["point","band","identity","ordinal"].includes(t);case"round":return xW(t)||"band"===t||"point"===t;case"padding":case"rangeMin":case"rangeMax":return xW(t)||["point","band"].includes(t);case"paddingOuter":case"align":return["point","band"].includes(t);case"paddingInner":return"band"===t;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return xW(t);case"nice":return xW(t)||"quantize"===t||"threshold"===t;case"exponent":return"pow"===t;case"base":return"log"===t;case"constant":return"symlog"===t;case"zero":return wW(t)&&!sR(["log","time","utc","threshold","quantile"],t)}}function _W(t,n){switch(n){case"interpolate":case"scheme":case"domainMid":return PL(t)?void 0:`Cannot use the scale property "${n}" 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 zW={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"},BW=zW.arc,TW=zW.area,PW=zW.bar,jW=zW.image,RW=zW.line,LW=zW.point,IW=zW.rect,qW=zW.rule,UW=zW.text,WW=zW.tick,HW=zW.trail,GW=zW.circle,YW=zW.square,VW=zW.geoshape;function XW(t){return["line","area","trail"].includes(t)}function JW(t){return["rect","bar","image","arc","tick"].includes(t)}const KW=new Set(bR(zW));function QW(t){return GR(t,"type")}const ZW=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],tH=bR({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),nH=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],eH={area:["line","point"],bar:nH,rect:nH,line:["point"],tick:["bandSize","thickness",...nH]},rH=bR({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 iH(t){return GR(t,"band")}const oH={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},aH={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},uH={...aH,binSpacing:1},sH={...aH,thickness:1};function cH(t,{isPath:n}){return void 0===t||"break-paths-show-path-domains"===t?n?"break-paths-show-domains":"filter":null===t?"show":t}function lH({markDef:t,config:n,scaleChannel:e,scaleType:r,isCountAggregate:i}){if(!r||!wW(r)||i)return"always-valid";const o=cH(Nq("invalid",t,n),{isPath:XW(t.type)}),a=n.scale?.invalid?.[e];return void 0!==a?"show":o}function fH({scaleName:t,scale:n,mode:e}){const r=`domain('${t}')`;if(!n||!t)return;const i=`${r}[0]`,o=`peek(${r})`,a=n.domainHasZero();return"definitely"===a?{scale:t,value:0}:"maybe"===a?{signal:`scale('${t}', inrange(0, ${r}) ? 0 : ${"zeroOrMin"===e?i:o})`}:{signal:`scale('${t}', ${"zeroOrMin"===e?i:o})`}}function dH({scaleChannel:t,channelDef:n,scale:e,scaleName:r,markDef:i,config:o}){const a=e?.get("type"),u=gG(n),s=lH({scaleChannel:t,markDef:i,config:o,scaleType:a,isCountAggregate:eq(u?.aggregate)});if(u&&"show"===s){const n=o.scale.invalid?.[t]??"zero-or-min";return{test:XU(uG(u,{expr:"datum"}),!1),...hH(n,e,r)}}}function hH(t,n,e){if(F(r=t)&&"value"in r){const{value:n}=t;return pq(n)?{signal:n.signal}:{value:n}}var r;return fH({scale:n,scaleName:e,mode:"zeroOrMin"})}function mH(t){const{channel:n,channelDef:e,markDef:r,scale:i,scaleName:o,config:a}=t,u=ZL(n),s=vH(t),c=dH({scaleChannel:u,channelDef:e,scale:i,scaleName:o,markDef:r,config:a});return void 0!==c?[c,s]:s}function pH(t,n,e,r){const i={};if(n&&(i.scale=n),XH(t)){const{datum:n}=t;yU(n)?i.signal=MU(n):pq(n)?i.signal=n.signal:fq(n)?i.signal=n.expr:i.value=n}else i.field=uG(t,e);if(r){const{offset:t,band:n}=r;t&&(i.offset=t),n&&(i.band=n)}return i}function gH({scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:e,offset:r,startSuffix:i,endSuffix:o="end",bandPosition:a=.5}){const u=!pq(a)&&0<a&&a<1?"datum":void 0,s=uG(n,{expr:u,suffix:i}),c=void 0!==e?uG(e,{expr:u}):uG(n,{suffix:o,expr:u}),l={};if(0===a||1===a)l.scale=t,l.field=0===a?s:c;else{const n=pq(a)?`(1-${a.signal}) * ${s} + ${a.signal} * ${c}`:`${1-a} * ${s} + ${a} * ${c}`;l.signal=`scale("${t}", ${n})`}return r&&(l.offset=r),l}function vH({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c,bandPosition:l}){if(n){if(ZH(n)){const c=a?.get("type");if(tG(n)){l??=LH({fieldDef:n,fieldDef2:e,markDef:r,config:i});const{bin:a,timeUnit:f,type:d}=n;if(aq(a)||l&&f&&d===nW)return u?.impute?pH(n,o,{binSuffix:"mid"},{offset:s}):l&&!bW(c)?gH({scaleName:o,fieldOrDatumDef:n,bandPosition:l,offset:s}):pH(n,o,DG(n,t)?{binSuffix:"range"}:{},{offset:s});if(uq(a)){if(YH(e))return gH({scaleName:o,fieldOrDatumDef:n,fieldOrDatumDef2:e,bandPosition:l,offset:s});vU(hU(t===JR?QR:ZR))}}return pH(n,o,bW(c)?{binSuffix:"range"}:{},{offset:s,band:"band"===c?l??n.bandPosition??.5:void 0})}if(nG(n)){const e=s?{offset:s}:{};return{...yH(t,n.value),...e}}}return tt(c)&&(c=c()),c?{...c,...s?{offset:s}:{}}:c}function yH(t,n){return sR(["x","x2"],t)&&"width"===n?{field:{group:"width"}}:sR(["y","y2"],t)&&"height"===n?{field:{group:"height"}}:Mq(n)}function bH(t){return t&&"number"!==t&&"time"!==t}function wH(t,n,e){return`${t}(${n}${e?`, ${HR(e)}`:""})`}function xH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o}){if(bH(e))return kH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,config:o});const a=$H(t,r,i),u=VH(t);if(void 0===n&&void 0===e&&o.customFormatTypes){if("quantitative"===u){if(i&&o.normalizedNumberFormatType)return kH({fieldOrDatumDef:t,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:r,config:o});if(o.numberFormatType)return kH({fieldOrDatumDef:t,format:o.numberFormat,formatType:o.numberFormatType,expr:r,config:o})}if("temporal"===u&&o.timeFormatType&&YH(t)&&void 0===t.timeUnit)return kH({fieldOrDatumDef:t,format:o.timeFormat,formatType:o.timeFormatType,expr:r,config:o})}if(kG(t)){const{unit:e,utc:r}=function(t){return YH(t)?BU(t.timeUnit)||{}:{unit:void 0,utc:void 0}}(t),i=function({field:t,timeUnit:n,format:e,formatType:r,rawTimeFormat:i,isUTCScale:o}){return!n||e?!n&&r?`${r}(${t}, ${HR(e)})`:`${o?"utc":"time"}Format(${t}, ${HR(e=$t(e)?e:i)})`:function(t,n,e){if(!t)return;const r=zU(t);return`${e||EU(t)?"utc":"time"}Format(${n}, ${r})`}(n,t,o)}({field:a,timeUnit:e,format:n,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:r||eG(t)&&t.scale?.type===aW});return i?{signal:i}:void 0}return n=DH({type:u,specifiedFormat:n,config:o,normalizeStack:i}),YH(t)&&aq(t.bin)?{signal:EH(a,uG(t,{expr:r,binSuffix:"end"}),n,e,o)}:n||"quantitative"===VH(t)?{signal:`${SH(a,n)}`}:{signal:`isValid(${a}) ? ${a} : ""+${a}`}}function $H(t,n,e){return YH(t)?e?`${uG(t,{expr:n,suffix:"end"})}-${uG(t,{expr:n,suffix:"start"})}`:uG(t,{expr:n}):function(t){const{datum:n}=t;return yU(n)?MU(n):`${HR(n)}`}(t)}function kH({fieldOrDatumDef:t,format:n,formatType:e,expr:r,normalizeStack:i,config:o,field:a}){return a??=$H(t,r,i),"datum.value"!==a&&YH(t)&&aq(t.bin)?{signal:EH(a,uG(t,{expr:r,binSuffix:"end"}),n,e,o)}:{signal:wH(e,a,n)}}function MH(t,n,e,r,i,o){if(!$t(r)||!bH(r)){if(void 0===e&&void 0===r&&i.customFormatTypes&&"quantitative"===VH(t)){if(i.normalizedNumberFormatType&&rG(t)&&"normalize"===t.stack)return;if(i.numberFormatType)return}if(rG(t)&&"normalize"===t.stack&&i.normalizedNumberFormat)return DH({type:"quantitative",config:i,normalizeStack:!0});if(kG(t)){const n=YH(t)?BU(t.timeUnit)?.unit:void 0;if(void 0===n&&i.customFormatTypes&&i.timeFormatType)return;return function({specifiedFormat:t,timeUnit:n,config:e,omitTimeFormatConfig:r}){return t||(n?{signal:zU(n)}:r?void 0:e.timeFormat)}({specifiedFormat:e,timeUnit:n,config:i,omitTimeFormatConfig:o})}return DH({type:n,specifiedFormat:e,config:i})}}function AH(t,n,e){return t&&(pq(t)||"number"===t||"time"===t)?t:kG(n)&&"time"!==e&&"utc"!==e?YH(n)&&BU(n?.timeUnit)?.utc?"utc":"time":void 0}function DH({type:t,specifiedFormat:n,config:e,normalizeStack:r}){return $t(n)?n:t===ZU?r?e.normalizedNumberFormat:e.numberFormat:void 0}function SH(t,n){return`format(${t}, "${n||""}")`}function FH(t,n,e,r){return bH(e)?wH(e,t,n):SH(t,($t(n)?n:void 0)??r.numberFormat)}function EH(t,n,e,r,i){if(void 0===e&&void 0===r&&i.customFormatTypes&&i.numberFormatType)return EH(t,n,i.numberFormat,i.numberFormatType,i);const o=FH(t,e,r,i),a=FH(n,e,r,i);return`${XU(t,!1)} ? "null" : ${o} + " – " + ${a}`}const NH="min",CH={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 OH(t){return ft(CH,t)}function _H(t){return t&&("count"===t.op||GR(t,"field"))}function zH(t){return t&&S(t)}function BH(t){return GR(t,"row")||GR(t,"column")}function TH(t){return GR(t,"header")}function PH(t){return GR(t,"facet")}function jH(t){const{field:n,timeUnit:e,bin:r,aggregate:i}=t;return{...e?{timeUnit:e}:{},...r?{bin:r}:{},...i?{aggregate:i}:{},field:n}}function RH(t){return GR(t,"sort")}function LH({fieldDef:t,fieldDef2:n,markDef:e,config:r}){if(ZH(t)&&void 0!==t.bandPosition)return t.bandPosition;if(YH(t)){const{timeUnit:i,bin:o}=t;if(i&&!n)return Cq("timeUnitBandPosition",e,r);if(aq(o))return.5}}function IH({channel:t,fieldDef:n,fieldDef2:e,markDef:r,config:i,scaleType:o,useVlSizeChannel:a}){const u=eI(t),s=Nq(a?"size":u,r,i,{vgChannel:u});if(void 0!==s)return s;if(YH(n)){const{timeUnit:t,bin:a}=n;if(t&&!e)return{band:Cq("timeUnitBandSize",r,i)};if(aq(a)&&!bW(o))return{band:1}}return JW(r.type)?o?bW(o)?i[r.type]?.discreteBandSize||{band:1}:i[r.type]?.continuousBandSize:i[r.type]?.discreteBandSize:void 0}function qH(t,n,e,r){return!!(aq(t.bin)||t.timeUnit&&tG(t)&&"temporal"===t.type)&&void 0!==LH({fieldDef:t,fieldDef2:n,markDef:e,config:r})}function UH(t){return GR(t,"sort")&&!GR(t,"field")}function WH(t){return GR(t,"condition")}function HH(t){const n=t?.condition;return!!n&&!S(n)&&YH(n)}function GH(t){const n=t?.condition;return!!n&&!S(n)&&ZH(n)}function YH(t){return GR(t,"field")||"count"===t?.aggregate}function VH(t){return t?.type}function XH(t){return GR(t,"datum")}function JH(t){return tG(t)&&!sG(t)||QH(t)}function KH(t){return tG(t)&&"quantitative"===t.type&&!t.bin||QH(t)}function QH(t){return XH(t)&&wt(t.datum)}function ZH(t){return YH(t)||XH(t)}function tG(t){return t&&(GR(t,"field")||"count"===t.aggregate)&&GR(t,"type")}function nG(t){return GR(t,"value")}function eG(t){return GR(t,"scale")||GR(t,"sort")}function rG(t){return GR(t,"axis")||GR(t,"stack")||GR(t,"impute")}function iG(t){return GR(t,"legend")}function oG(t){return GR(t,"format")||GR(t,"formatType")}function aG(t){return oR(t,["legend","axis","header","scale"])}function uG(t,n={}){let e=t.field;const r=n.prefix;let i=n.suffix,o="";if(function(t){return"count"===t.aggregate}(t))e=RR("count");else{let r;if(!n.nofn)if(function(t){return GR(t,"op")}(t))r=t.op;else{const{bin:a,aggregate:u,timeUnit:s}=t;aq(a)?(r=oq(a),i=(n.binSuffix??"")+(n.suffix??"")):u?ZI(u)?(o=`["${e}"]`,e=`argmax_${u.argmax}`):QI(u)?(o=`["${e}"]`,e=`argmin_${u.argmin}`):r=String(u):s&&!SU(s)&&(r=function(t){const{utc:n,...e}=BU(t);return e.unit?(n?"utc":"")+bR(e).map((t=>kR(`${"unit"===t?"":`_${t}_`}${e[t]}`))).join(""):`${n?"utc":""}timeunit${bR(e).map((t=>kR(`_${t}_${e[t]}`))).join("")}`}(s),i=(!["range","mid"].includes(n.binSuffix)&&n.binSuffix||"")+(n.suffix??""))}r&&(e=e?`${r}_${e}`:r)}return i&&(e=`${e}_${i}`),r&&(e=`${r}_${e}`),n.forAs?zR(e):n.expr?FR(e,n.expr)+o:OR(e)+o}function sG(t){switch(t.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return YH(t)&&!!t.bin;case"temporal":return!1}throw new Error(Qq(t.type))}const cG=(t,n)=>{switch(n.fieldTitle){case"plain":return t.field;case"functional":return function(t){const{aggregate:n,bin:e,timeUnit:r,field:i}=t;if(ZI(n))return`${i} for argmax(${n.argmax})`;if(QI(n))return`${i} for argmin(${n.argmin})`;const o=r&&!SU(r)?BU(r):void 0,a=n||o?.unit||o?.maxbins&&"timeunit"||aq(e)&&"bin";return a?`${a.toUpperCase()}(${i})`:i}(t);default:return function(t,n){const{field:e,bin:r,timeUnit:i,aggregate:o}=t;if("count"===o)return n.countTitle;if(aq(r))return`${e} (binned)`;if(i&&!SU(i)){const t=BU(i)?.unit;if(t)return`${e} (${CU(t).join("-")})`}else if(o)return ZI(o)?`${e} for max ${o.argmax}`:QI(o)?`${e} for min ${o.argmin}`:`${DR(o)} of ${e}`;return e}(t,n)}};let lG=cG;function fG(t){lG=t}function dG(t,n,{allowDisabling:e,includeDefault:r=!0}){const i=hG(t)?.title;if(!YH(t))return i??t.title;const o=t,a=r?mG(o,n):void 0;return e?TR(i,o.title,a):i??o.title??a}function hG(t){return rG(t)&&t.axis?t.axis:iG(t)&&t.legend?t.legend:TH(t)&&t.header?t.header:void 0}function mG(t,n){return lG(t,n)}function pG(t){if(oG(t)){const{format:n,formatType:e}=t;return{format:n,formatType:e}}{const n=hG(t)??{},{format:e,formatType:r}=n;return{format:e,formatType:r}}}function gG(t){return YH(t)?t:HH(t)?t.condition:void 0}function vG(t){return ZH(t)?t:GH(t)?t.condition:void 0}function yG(t,n,e,r={}){return $t(t)||wt(t)||vt(t)?(vU(function(t,n,e){return`Channel ${t} is a ${n}. Converted to {value: ${HR(e)}}.`}(n,$t(t)?"string":wt(t)?"number":"boolean",t)),{value:t}):ZH(t)?bG(t,n,e,r):GH(t)?{...t,condition:bG(t.condition,n,e,r)}:t}function bG(t,n,e,r){if(oG(t)){const{format:i,formatType:o,...a}=t;if(bH(o)&&!e.customFormatTypes)return vU(Jq(n)),bG(a,n,e,r)}else{const i=rG(t)?"axis":iG(t)?"legend":TH(t)?"header":null;if(i&&t[i]){const{format:o,formatType:a,...u}=t[i];if(bH(a)&&!e.customFormatTypes)return vU(Jq(n)),bG({...t,[i]:u},n,e,r)}}return YH(t)?wG(t,n,r):function(t){let n=t.type;if(n)return t;const{datum:e}=t;return n=wt(e)?"quantitative":$t(e)?"nominal":yU(e)?"temporal":void 0,{...t,type:n}}(t)}function wG(t,n,{compositeMark:e=!1}={}){const{aggregate:r,timeUnit:i,bin:o,field:a}=t,u={...t};if(e||!r||tq(r)||ZI(r)||QI(r)||(vU(function(t){return`Invalid aggregation operator "${t}".`}(r)),delete u.aggregate),i&&(u.timeUnit=BU(i)),a&&(u.field=`${a}`),aq(o)&&(u.bin=xG(o,n)),uq(o)&&!AI(n)&&vU(function(t){return`Channel ${t} should not be used with "binned" bin.`}(n)),tG(u)){const{type:t}=u,n=function(t){if(t)switch(t=t.toLowerCase()){case"q":case ZU:return"quantitative";case"t":case nW:return"temporal";case"o":case tW:return"ordinal";case"n":case eW:return"nominal";case rW:return"geojson"}}(t);t!==n&&(u.type=n),"quantitative"!==t&&eq(r)&&(vU(function(t,n){return`Invalid field type "${t}" for aggregate: "${n}", using "quantitative" instead.`}(t,r)),u.type="quantitative")}else if(!QL(n)){const t=function(t,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(RH(t)&&S(t.sort))return"ordinal";const{aggregate:e,bin:r,timeUnit:i}=t;if(i)return"temporal";if(r||e&&!ZI(e)&&!QI(e))return"quantitative";if(eG(t)&&t.scale?.type)switch(cW[t.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(u,n);u.type=t}if(tG(u)){const{compatible:t,warning:e}=function(t,n){const e=t.type;if("geojson"===e&&"shape"!==n)return{compatible:!1,warning:`Channel ${n} should not be used with a geojson data.`};switch(n){case YR:case VR:case XR:return sG(t)?$G:{compatible:!1,warning:eU(n)};case JR:case KR:case tL:case nL:case fL:case dL:case hL:case $L:case ML:case AL:case DL:case SL:case FL:case gL:case iL:case eL:case EL:return $G;case uL:case cL:case aL:case sL:return e!==ZU?{compatible:!1,warning:`Channel ${n} should be used with a quantitative field only, not ${t.type} field.`}:$G;case vL:case yL:case bL:case wL:case pL:case oL:case rL:case QR:case ZR:case lL:return"nominal"!==e||t.sort?$G:{compatible:!1,warning:`Channel ${n} should not be used with an unsorted discrete field.`};case mL:case xL:return sG(t)||function(t){return eG(t)&&$W(t.scale?.type)}(t)?$G:{compatible:!1,warning:rU(n)};case kL:return"nominal"!==t.type||"sort"in t?$G:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}}(u,n)||{};!1===t&&vU(e)}if(RH(u)&&$t(u.sort)){const{sort:t}=u;if(OH(t))return{...u,sort:{encoding:t}};const n=t.substring(1);if("-"===t.charAt(0)&&OH(n))return{...u,sort:{encoding:n,order:"descending"}}}if(TH(u)){const{header:t}=u;if(t){const{orient:n,...e}=t;if(n)return{...u,header:{...e,labelOrient:t.labelOrient||n,titleOrient:t.titleOrient||n}}}}return u}function xG(t,n){return vt(t)?{maxbins:lq(n)}:"binned"===t?{binned:!0}:t.maxbins||t.step?t:{...t,maxbins:lq(n)}}const $G={compatible:!0};function kG(t){const{formatType:n}=pG(t);return"time"===n||!n&&function(t){return t&&("temporal"===t.type||YH(t)&&!!t.timeUnit)}(t)}function MG(t,{timeUnit:n,type:e,wrapTime:r,undefinedIfExprNotRequired:i}){const o=n&&BU(n)?.unit;let a,u=o||"temporal"===e;return fq(t)?a=t.expr:pq(t)?a=t.signal:yU(t)?(u=!0,a=MU(t)):($t(t)||wt(t))&&u&&(a=`datetime(${HR(t)})`,function(t){return ft(AU,t)}(o)&&(wt(t)&&t<1e4||$t(t)&&isNaN(Date.parse(t)))&&(a=MU({[o]:t}))),a?r&&u?`time(${a})`:a:i?void 0:HR(t)}function AG(t,n){const{type:e}=t;return n.map((n=>{const r=MG(n,{timeUnit:YH(t)&&!SU(t.timeUnit)?t.timeUnit:void 0,type:e,undefinedIfExprNotRequired:!0});return void 0!==r?{signal:r}:n}))}function DG(t,n){return aq(t.bin)?HI(n)&&["ordinal","nominal"].includes(t.type):(console.warn("Only call this method for binned field defs."),!1)}const SG={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 FG(t){return t?.condition}const EG=["domain","grid","labels","ticks","title"],NG={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"},CG={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},OG={...CG,style:1,labelExpr:1,encoding:1};function _G(t){return ft(OG,t)}const zG=bR({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 BG(t){return GR(t,"mark")}class TG{name;run;constructor(t,n){this.name=t,this.run=n}hasMatchingType(t){return!!BG(t)&&function(t){return QW(t)?t.type:t}(t.mark)===this.name}}function PG(t,n){const e=t?.[n];return!!e&&(S(e)?cR(e,(t=>!!t.field)):YH(e)||HH(e))}function jG(t,n){const e=t?.[n];return!!e&&(S(e)?cR(e,(t=>!!t.field)):YH(e)||XH(e)||GH(e))}function RG(t,n){if(AI(n)){const e=t[n];if((YH(e)||XH(e))&&(QU(e.type)||YH(e)&&e.timeUnit))return jG(t,iI(n))}return!1}function LG(t){return cR(IL,(n=>{if(PG(t,n)){const e=t[n];if(S(e))return cR(e,(t=>!!t.aggregate));{const t=gG(e);return t&&!!t.aggregate}}return!1}))}function IG(t,n){const e=[],r=[],i=[],o=[],a={};return WG(t,((u,s)=>{if(YH(u)){const{field:c,aggregate:l,bin:f,timeUnit:d,...h}=u;if(l||d||f){const t=hG(u),m=t?.title;let p=uG(u,{forAs:!0});const g={...m?[]:{title:dG(u,n,{allowDisabling:!0})},...h,field:p};if(l){let t;if(ZI(l)?(t="argmax",p=uG({op:"argmax",field:l.argmax},{forAs:!0}),g.field=`${p}.${c}`):QI(l)?(t="argmin",p=uG({op:"argmin",field:l.argmin},{forAs:!0}),g.field=`${p}.${c}`):"boxplot"!==l&&"errorbar"!==l&&"errorband"!==l&&(t=l),t){const n={op:t,as:p};c&&(n.field=c),o.push(n)}}else if(e.push(p),tG(u)&&aq(f))r.push({bin:f,field:c,as:p}),e.push(uG(u,{binSuffix:"end"})),DG(u,s)&&e.push(uG(u,{binSuffix:"range"})),AI(s)&&(a[`${s}2`]={field:`${p}_end`}),g.bin="binned",QL(s)||(g.type=ZU);else if(d&&!SU(d)){i.push({timeUnit:d,field:c,as:p});const t=tG(u)&&u.type!==nW&&"time";t&&(s===$L||s===DL?g.formatType=t:function(t){return ft(xI,t)}(s)?g.legend={formatType:t,...g.legend}:AI(s)&&(g.axis={formatType:t,...g.axis}))}a[s]=g}else e.push(c),a[s]=t[s]}else a[s]=t[s]})),{bins:r,timeUnits:i,aggregate:o,groupby:e,encoding:a}}function qG(t,n,e){const r=function(t,n){return function(t){switch(t){case fL:case dL:case hL:case EL:case ML:case AL:case DL:case SL:case kL:case vL:case yL:case bL:case wL:case XR:case YR:case VR:return GI;case JR:case KR:case tL:case nL:case aL:case uL:case lL:return VI;case QR:case ZR:case sL:case cL:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case pL:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case xL:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case mL:return{point:"always",geoshape:"always"};case $L:return{text:"always"};case gL:return{point:"always",square:"always",text:"always"};case FL:return{image:"always"};case iL:case eL:return{text:"always",arc:"always"};case oL:case rL:return{arc:"always"}}}(t)[n]}(n,e);if(!r)return!1;if("binned"===r){const e=t[n===QR?JR:KR];return!!(YH(e)&&YH(t[n])&&uq(e.bin))}return!0}function UG(t,n){const e={};for(const r of bR(t)){const i=yG(t[r],r,n,{compositeMark:!0});e[r]=i}return e}function WG(t,n,e){if(t)for(const r of bR(t)){const i=t[r];if(S(i))for(const t of i)n.call(e,t,r);else n.call(e,i,r)}}function HG(t,n){return bR(n).reduce(((e,r)=>{switch(r){case JR:case KR:case SL:case EL:case FL:case QR:case ZR:case tL:case nL:case iL:case oL:case eL:case rL:case lL:case aL:case uL:case sL:case cL:case $L:case mL:case gL:case DL:return e;case kL:if("line"===t||"trail"===t)return e;case ML:case AL:{const t=n[r];if(S(t)||YH(t))for(const n of Q(t))n.aggregate||e.push(uG(n,{}));return e}case pL:if("trail"===t)return e;case fL:case dL:case hL:case vL:case yL:case bL:case xL:case wL:{const t=gG(n[r]);return t&&!t.aggregate&&e.push(uG(t,{})),e}}}),[])}function GG(t,n,e,r=!0){if("tooltip"in e)return{tooltip:e.tooltip};const i=t.map((({fieldPrefix:t,titlePrefix:e})=>{const i=r?` of ${YG(n)}`:"";return{field:t+n.field,type:n.type,title:pq(e)?{signal:`${e}"${escape(i)}"`}:e+i}})),o=function(t){const n=[];for(const e of bR(t))if(PG(t,e)){const r=Q(t[e]);for(const t of r)YH(t)?n.push(t):HH(t)&&n.push(t.condition)}return n}(e).map(aG);return{tooltip:[...i,...hR(o,aR)]}}function YG(t){const{title:n,field:e}=t;return TR(n,e)}function VG(t,n,e,r,i){const{scale:o,axis:a}=e;return({partName:u,mark:s,positionPrefix:c,endPositionPrefix:l,extraEncoding:f={}})=>{const d=YG(e);return XG(t,u,i,{mark:s,encoding:{[n]:{field:`${c}_${e.field}`,type:e.type,...void 0!==d?{title:d}:{},...void 0!==o?{scale:o}:{},...void 0!==a?{axis:a}:{}},...$t(l)?{[`${n}2`]:{field:`${l}_${e.field}`}}:{},...r,...f}})}}function XG(t,n,e,r){const{clip:i,color:o,opacity:a}=t,u=t.type;return t[n]||void 0===t[n]&&e[n]?[{...r,mark:{...e[n],...i?{clip:i}:{},...o?{color:o}:{},...a?{opacity:a}:{},...QW(r.mark)?r.mark:{type:r.mark},style:`${u}-${String(n)}`,...vt(t[n])?{}:t[n]}}]:[]}function JG(t,n,e){const{encoding:r}=t,i="vertical"===n?"y":"x",o=r[`${i}2`],a=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:KG(r[i],e),continuousAxisChannelDef2:KG(o,e),continuousAxisChannelDefError:KG(a,e),continuousAxisChannelDefError2:KG(u,e),continuousAxis:i}}function KG(t,n){if(t?.aggregate){const{aggregate:e,...r}=t;return e!==n&&vU(function(t,n){return`Continuous axis should not have customized aggregation function ${t}; ${n} already agregates the axis.`}(e,n)),r}return t}function QG(t,n){const{mark:e,encoding:r}=t,{x:i,y:o}=r;if(QW(e)&&e.orient)return e.orient;if(JH(i)){if(JH(o)){const t=YH(i)&&i.aggregate,e=YH(o)&&o.aggregate;if(t||e!==n){if(e||t!==n){if(t===n&&e===n)throw new Error("Both x and y cannot have aggregate");return kG(o)&&!kG(i)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(JH(o))return"vertical";throw new Error(`Need a valid continuous axis for ${n}s`)}const ZG="boxplot",tY=new TG(ZG,eY);function nY(t){return wt(t)?"tukey":t}function eY(t,{config:n}){t={...t,encoding:UG(t.encoding,n)};const{mark:e,encoding:r,params:i,projection:o,...a}=t,u=QW(e)?e:{type:e};i&&vU(Hq("boxplot"));const s=u.extent??n.boxplot.extent,c=Nq("size",u,n),l=u.invalid,f=nY(s),{bins:d,timeUnits:h,transform:m,continuousAxisChannelDef:p,continuousAxis:g,groupby:v,aggregate:y,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:$}=function(t,n,e){const r=QG(t,ZG),{continuousAxisChannelDef:i,continuousAxis:o}=JG(t,r,ZG),a=i.field,u=zR(a),s=nY(n),c=[...rY(a),{op:"median",field:a,as:`mid_box_${u}`},{op:"min",field:a,as:("min-max"===s?"lower_whisker_":"min_")+u},{op:"max",field:a,as:("min-max"===s?"upper_whisker_":"max_")+u}],l="min-max"===s||"tukey"===s?[]:[{calculate:`${ER(`upper_box_${u}`)} - ${ER(`lower_box_${u}`)}`,as:`iqr_${u}`},{calculate:`min(${ER(`upper_box_${u}`)} + ${ER(`iqr_${u}`)} * ${n}, ${ER(`max_${u}`)})`,as:`upper_whisker_${u}`},{calculate:`max(${ER(`lower_box_${u}`)} - ${ER(`iqr_${u}`)} * ${n}, ${ER(`min_${u}`)})`,as:`lower_whisker_${u}`}],{[o]:f,...d}=t.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:m}=function(t){const{tooltip:n,...e}=t;if(!n)return{filteredEncoding:e};let r,i;if(S(n)){for(const t of n)t.aggregate?(r||(r=[]),r.push(t)):(i||(i=[]),i.push(t));r&&(e.tooltip=r)}else n.aggregate?e.tooltip=n:i=n;return S(i)&&1===i.length&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:e}}(d),{bins:p,timeUnits:g,aggregate:v,groupby:y,encoding:b}=IG(m,e),w="vertical"===r?"horizontal":"vertical",x=r;return{bins:p,timeUnits:g,transform:[...p,...g,{aggregate:[...v,...c],groupby:y},...l],groupby:y,aggregate:v,continuousAxisChannelDef:i,continuousAxis:o,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:x,customTooltipWithoutAggregatedField:h}}(t,s,n),k=zR(p.field),{color:M,size:A,...D}=b,E=t=>VG(u,g,p,t,n.boxplot),N=E(D),C=E(b),O=(F(n.boxplot.box)?n.boxplot.box.color:n.mark.color)||"#4c78a8",_=E({...D,...A?{size:A}:{},color:{condition:{test:`${ER(`lower_box_${p.field}`)} >= ${ER(`upper_box_${p.field}`)}`,...M||{value:O}}}}),z=GG([{fieldPrefix:"min-max"===f?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===f?"lower_whisker_":"min_",titlePrefix:"Min"}],p,b),B={type:"tick",color:"black",opacity:1,orient:w,invalid:l,aria:!1},T="min-max"===f?z:GG([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,b),P=[...N({partName:"rule",mark:{type:"rule",invalid:l,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:T}),...N({partName:"rule",mark:{type:"rule",invalid:l,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"lower_whisker",extraEncoding:T}),...N({partName:"ticks",mark:B,positionPrefix:"upper_whisker",extraEncoding:T})],j=[..."tukey"!==f?P:[],...C({partName:"box",mark:{type:"bar",...c?{size:c}:{},orient:x,invalid:l,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:z}),..._({partName:"median",mark:{type:"tick",invalid:l,...F(n.boxplot.median)&&n.boxplot.median.color?{color:n.boxplot.median.color}:{},...c?{size:c}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:z})];if("min-max"===f)return{...a,transform:(a.transform??[]).concat(m),layer:j};const R=ER(`lower_box_${p.field}`),L=ER(`upper_box_${p.field}`),I=`(${L} - ${R})`,q=`${R} - ${s} * ${I}`,U=`${L} + ${s} * ${I}`,W=ER(p.field),H={joinaggregate:rY(p.field),groupby:v},G={transform:[{filter:`(${q} <= ${W}) && (${W} <= ${U})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${k}`},{op:"max",field:p.field,as:`upper_whisker_${k}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${k}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${k}`},...y],groupby:v}],layer:P},{tooltip:Y,...V}=D,{scale:X,axis:J}=p,K=YG(p),Q=XG(u,"outliers",n.boxplot,{transform:[{filter:`(${W} < ${q}) || (${W} > ${U})`}],mark:"point",encoding:{[g]:{field:p.field,type:p.type,...void 0!==K?{title:K}:{},...void 0!==X?{scale:X}:{},...void 0!==J?{axis:J}:{}},...V,...M?{color:M}:{},...$?{tooltip:$}:{}}})[0];let Z;const tt=[...d,...h,H];return Q?Z={transform:tt,layer:[Q,G]}:(Z=G,Z.transform.unshift(...tt)),{...a,layer:[Z,{transform:m,layer:j}]}}function rY(t){const n=zR(t);return[{op:"q1",field:t,as:`lower_box_${n}`},{op:"q3",field:t,as:`upper_box_${n}`}]}const iY="errorbar",oY=new TG(iY,aY);function aY(t,{config:n}){t={...t,encoding:UG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,ticksOrient:a,markDef:u,outerSpec:s,tooltipEncoding:c}=uY(t,iY,n);delete o.size;const l=VG(u,i,r,o,n.errorbar),f=u.thickness,d=u.size,h={type:"tick",orient:a,aria:!1,...void 0!==f?{thickness:f}:{},...void 0!==d?{size:d}:{}},m=[...l({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:c}),...l({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:c}),...l({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==f?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c})];return{...s,transform:e,...m.length>1?{layer:m}:{...m[0]}}}function uY(t,n,e){const{mark:r,encoding:i,params:o,projection:a,...u}=t,s=QW(r)?r:{type:r};o&&vU(Hq(n));const{orient:c,inputType:l}=function(t,n){const{encoding:e}=t;if(function(t){return(ZH(t.x)||ZH(t.y))&&!ZH(t.x2)&&!ZH(t.y2)&&!ZH(t.xError)&&!ZH(t.xError2)&&!ZH(t.yError)&&!ZH(t.yError2)}(e))return{orient:QG(t,n),inputType:"raw"};const r=function(t){return ZH(t.x2)||ZH(t.y2)}(e),i=function(t){return ZH(t.xError)||ZH(t.xError2)||ZH(t.yError)||ZH(t.yError2)}(e),o=e.x,a=e.y;if(r){if(i)throw new Error(`${n} cannot be both type aggregated-upper-lower and aggregated-error`);const t=e.x2,r=e.y2;if(ZH(t)&&ZH(r))throw new Error(`${n} cannot have both x2 and y2`);if(ZH(t)){if(JH(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${n}`)}if(ZH(r)){if(JH(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${n}`)}throw new Error("No ranged axis")}{const t=e.xError,r=e.yError,i=e.yError2;if(ZH(e.xError2)&&!ZH(t))throw new Error(`${n} cannot have xError2 without xError`);if(ZH(i)&&!ZH(r))throw new Error(`${n} cannot have yError2 without yError`);if(ZH(t)&&ZH(r))throw new Error(`${n} cannot have both xError and yError with both are quantiative`);if(ZH(t)){if(JH(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(ZH(r)){if(JH(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")}}(t,n),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:m,continuousAxis:p}=JG(t,c,n),{errorBarSpecificAggregate:g,postAggregateCalculates:v,tooltipSummary:y,tooltipTitleWithFieldName:b}=function(t,n,e,r,i,o,a,u){let s=[],c=[];const l=n.field;let f,d=!1;if("raw"===o){const n=t.center?t.center:t.extent?"iqr"===t.extent?"median":"mean":u.errorbar.center,e=t.extent?t.extent:"mean"===n?"stderr":"iqr";if("median"===n!=("iqr"===e)&&vU(function(t,n,e){return`${t} is not usually used with ${n} for ${e}.`}(n,e,a)),"stderr"===e||"stdev"===e)s=[{op:e,field:l,as:`extent_${l}`},{op:n,field:l,as:`center_${l}`}],c=[{calculate:`${ER(`center_${l}`)} + ${ER(`extent_${l}`)}`,as:`upper_${l}`},{calculate:`${ER(`center_${l}`)} - ${ER(`extent_${l}`)}`,as:`lower_${l}`}],f=[{fieldPrefix:"center_",titlePrefix:DR(n)},{fieldPrefix:"upper_",titlePrefix:sY(n,e,"+")},{fieldPrefix:"lower_",titlePrefix:sY(n,e,"-")}],d=!0;else{let t,n,r;"ci"===e?(t="mean",n="ci0",r="ci1"):(t="median",n="q1",r="q3"),s=[{op:n,field:l,as:`lower_${l}`},{op:r,field:l,as:`upper_${l}`},{op:t,field:l,as:`center_${l}`}],f=[{fieldPrefix:"upper_",titlePrefix:dG({field:l,aggregate:r,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:dG({field:l,aggregate:n,type:"quantitative"},u,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:dG({field:l,aggregate:t,type:"quantitative"},u,{allowDisabling:!1})}]}}else{(t.center||t.extent)&&vU(function(t,n){return`${n?"extent ":""}${n&&t?"and ":""}${t?"center ":""}${n&&t?"are ":"is "}not needed when data are aggregated.`}(t.center,t.extent)),"aggregated-upper-lower"===o?(f=[],c=[{calculate:ER(e.field),as:`upper_${l}`},{calculate:ER(l),as:`lower_${l}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:l}],c=[{calculate:`${ER(l)} + ${ER(r.field)}`,as:`upper_${l}`}],c.push(i?{calculate:`${ER(l)} + ${ER(i.field)}`,as:`lower_${l}`}:{calculate:`${ER(l)} - ${ER(r.field)}`,as:`lower_${l}`}));for(const t of c)f.push({fieldPrefix:t.as.substring(0,6),titlePrefix:_R(_R(t.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:c,errorBarSpecificAggregate:s,tooltipSummary:f,tooltipTitleWithFieldName:d}}(s,f,d,h,m,l,n,e),{[p]:w,["x"===p?"x2":"y2"]:x,["x"===p?"xError":"yError"]:$,["x"===p?"xError2":"yError2"]:k,...M}=i,{bins:A,timeUnits:D,aggregate:S,groupby:F,encoding:E}=IG(M,e),N=[...S,...g],C="raw"!==l?[]:F,O=GG(y,f,E,b);return{transform:[...u.transform??[],...A,...D,...0===N.length?[]:[{aggregate:N,groupby:C}],...v],groupby:C,continuousAxisChannelDef:f,continuousAxis:p,encodingWithoutContinuousAxis:E,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:s,outerSpec:u,tooltipEncoding:O}}function sY(t,n,e){return`${DR(t)} ${e} ${n}`}const cY="errorband",lY=new TG(cY,fY);function fY(t,{config:n}){t={...t,encoding:UG(t.encoding,n)};const{transform:e,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:o,markDef:a,outerSpec:u,tooltipEncoding:s}=uY(t,cY,n),c=a,l=VG(c,i,r,o,n.errorband),f=void 0!==t.encoding.x&&void 0!==t.encoding.y;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const m={...c.interpolate?{interpolate:c.interpolate}:{},...c.tension&&c.interpolate?{tension:c.tension}:{}};return f?(d={...d,...m,ariaRoleDescription:"errorband"},h={...h,...m,aria:!1}):c.interpolate?vU(dU("interpolate")):c.tension&&vU(dU("tension")),{...u,transform:e,layer:[...l({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:s}),...l({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:s}),...l({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:s})]}}const dY={};function hY(t,n,e){const r=new TG(t,n);dY[t]={normalizer:r,parts:e}}hY(ZG,eY,["box","median","outliers","rule","ticks"]),hY(iY,aY,["ticks","rule"]),hY(cY,fY,["band","borders"]);const mY=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],pY={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"},gY={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"},vY=bR(pY),yY=bR(gY),bY=bR({header:1,headerRow:1,headerColumn:1,headerFacet:1}),wY=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],xY="_vgsid_",$Y={point:{on:"click",fields:[xY],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 kY(t){return"legend"===t||!!t?.legend}function MY(t){return kY(t)&&F(t)}function AY(t){return!!t?.select}function DY(t){const n=[];for(const e of t||[]){if(AY(e))continue;const{expr:t,bind:r,...i}=e;if(r&&t){const e={...i,bind:r,init:t};n.push(e)}else{const e={...i,...t?{update:t}:{},...r?{bind:r}:{}};n.push(e)}}return n}function SY(t){return GR(t,"concat")}function FY(t){return GR(t,"vconcat")}function EY(t){return GR(t,"hconcat")}function NY({step:t,offsetIsDiscrete:n}){return n?t.for??"offset":"position"}function CY(t){return GR(t,"step")}function OY(t){return GR(t,"view")||GR(t,"width")||GR(t,"height")}const _Y=bR({align:1,bounds:1,center:1,columns:1,spacing:1});function zY(t,n){return t[n]??t["width"===n?"continuousWidth":"continuousHeight"]}function BY(t,n){const e=TY(t,n);return CY(e)?e.step:PY}function TY(t,n){return TR(t[n]??t["width"===n?"discreteWidth":"discreteHeight"],{step:t.step})}const PY=20,jY={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:300,continuousHeight:300,step:PY},mark:{color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},arc:{},area:{},bar:uH,circle:{},geoshape:{},image:{},line:{},point:{},rect:aH,rule:{color:"black"},square:{},text:{color:"black"},tick:sH,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:$Y,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},RY=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],LY={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},IY={blue:RY[0],orange:RY[1],red:RY[2],teal:RY[3],green:RY[4],yellow:RY[5],purple:RY[6],pink:RY[7],brown:RY[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 qY(t){const n=bR(t||{}),e={};for(const r of n){const n=t[r];e[r]=FG(n)?xq(n):$q(n)}return e}const UY=[...rH,...zG,...bY,"background","padding","legend","lineBreak","scale","style","title","view"];function WY(t={}){const{color:n,font:e,fontSize:r,selection:i,...o}=t,a=N({},eR(jY),e?function(t){return{text:{font:t},style:{"guide-label":{font:t},"guide-title":{font:t},"group-title":{font:t},"group-subtitle":{font:t}}}}(e):{},n?function(t={}){return{signals:[{name:"color",value:F(t)?{...IY,...t}:IY}],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(t){return{signals:[{name:"fontSize",value:F(t)?{...LY,...t}:LY}],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):{},o||{});i&&C(a,"selection",i,!0);const u=oR(a,UY);for(const t of["background","lineBreak","padding"])a[t]&&(u[t]=$q(a[t]));for(const t of rH)a[t]&&(u[t]=dq(a[t]));for(const t of zG)a[t]&&(u[t]=qY(a[t]));for(const t of bY)a[t]&&(u[t]=dq(a[t]));if(a.legend&&(u.legend=dq(a.legend)),a.scale){const{invalid:t,...n}=a.scale,e=dq(t,{level:1});u.scale={...dq(n),...bR(e).length>0?{invalid:e}:{}}}return a.style&&(u.style=function(t){const n=bR(t),e={};for(const r of n)e[r]=qY(t[r]);return e}(a.style)),a.title&&(u.title=dq(a.title)),a.view&&(u.view=dq(a.view)),u}const HY=new Set(["view",...KW]),GY=["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"],YY={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...eH};function VY(t,n,e){"view"===n&&(e="cell");const r={...t[n],...t.style[e??n]};yR(r)||(t.style[e??n]=r),delete t[n]}function XY(t){return GR(t,"layer")}class JY{map(t,n){return PH(t)?this.mapFacet(t,n):function(t){return GR(t,"repeat")}(t)?this.mapRepeat(t,n):EY(t)?this.mapHConcat(t,n):FY(t)?this.mapVConcat(t,n):SY(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(XY(t))return this.mapLayer(t,n);if(BG(t))return this.mapUnit(t,n);throw new Error(jq(t))}mapLayer(t,n){return{...t,layer:t.layer.map((t=>this.mapLayerOrUnit(t,n)))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map((t=>this.map(t,n)))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map((t=>this.map(t,n)))}}mapConcat(t,n){const{concat:e,...r}=t;return{...r,concat:e.map((t=>this.map(t,n)))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const KY={zero:1,center:1,normalize:1},QY=new Set([BW,PW,TW,qW,LW,GW,YW,RW,UW,WW]),ZY=new Set([PW,TW,BW]);function tV(t){return YH(t)&&"quantitative"===VH(t)&&!t.bin}function nV(t,n,{orient:e,type:r}){const i="x"===n?"y":"radius",o="x"===n&&["bar","area"].includes(r),a=t[n],u=t[i];if(YH(a)&&YH(u))if(tV(a)&&tV(u)){if(a.stack)return n;if(u.stack)return i;const t=YH(a)&&!!a.aggregate;if(t!==(YH(u)&&!!u.aggregate))return t?n:i;if(o){if("vertical"===e)return i;if("horizontal"===e)return n}}else{if(tV(a))return n;if(tV(u))return i}else{if(tV(a)){if(o&&"vertical"===e)return;return n}if(tV(u)){if(o&&"horizontal"===e)return;return i}}}function eV(t,n){const e=QW(t)?t:{type:t},r=e.type;if(!QY.has(r))return null;const i=nV(n,"x",e)||nV(n,"theta",e);if(!i)return null;const o=n[i],a=YH(o)?uG(o,{}):void 0,u=function(t){switch(t){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(i),s=[],c=new Set;if(n[u]){const t=n[u],e=YH(t)?uG(t,{}):void 0;e&&e!==a&&(s.push(u),c.add(e))}const l="x"===u?"xOffset":"yOffset",f=n[l],d=YH(f)?uG(f,{}):void 0;d&&d!==a&&(s.push(l),c.add(d));const h=$I.reduce(((t,e)=>{if("tooltip"!==e&&PG(n,e)){const r=n[e];for(const n of Q(r)){const r=gG(n);if(r.aggregate)continue;const i=uG(r,{});i&&c.has(i)||t.push({channel:e,fieldDef:r})}}return t}),[]);let m;return void 0!==o.stack?m=vt(o.stack)?o.stack?"zero":null:o.stack:ZY.has(r)&&(m="zero"),m&&ft(KY,m)?LG(n)&&0===h.length?null:(o?.scale?.type&&o?.scale?.type!==iW&&o?.stack&&vU(function(t){return`Stack is applied to a non-linear scale (${t}).`}(o.scale.type)),ZH(n[nI(i)])?(void 0!==o.stack&&vU(`Cannot stack "${p=i}" if there is already "${p}2".`),null):(YH(o)&&o.aggregate&&!rq.has(o.aggregate)&&vU(`Stacking is applied even though the aggregate function is non-summative ("${o.aggregate}").`),{groupbyChannels:s,groupbyFields:c,fieldChannel:i,impute:null!==o.impute&&XW(r),stackBy:h,offset:m})):null;var p}function rV(t,n,e){const r=dq(t),i=Nq("orient",r,e);if(r.orient=function(t,n,e){switch(t){case LW:case GW:case YW:case IW:case jW:return}const{x:r,y:i,x2:o,y2:a}=n;switch(t){case UW:case PW:if(YH(r)&&(uq(r.bin)||YH(i)&&i.aggregate&&!r.aggregate))return"vertical";if(YH(i)&&(uq(i.bin)||YH(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(a||o){if(e)return e;if(!o)return(YH(r)&&r.type===ZU&&!aq(r.bin)||QH(r))&&YH(i)&&uq(i.bin)?"horizontal":"vertical";if(!a)return(YH(i)&&i.type===ZU&&!aq(i.bin)||QH(i))&&YH(r)&&uq(r.bin)?"vertical":"horizontal"}case qW:if(o&&(!YH(r)||!uq(r.bin))&&a&&(!YH(i)||!uq(i.bin)))return;case TW:if(a)return YH(i)&&uq(i.bin)?"horizontal":"vertical";if(o)return YH(r)&&uq(r.bin)?"vertical":"horizontal";if(t===qW){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case RW:case WW:{const n=KH(r),o=KH(i);if(e)return e;if(n&&!o)return"tick"!==t?"horizontal":"vertical";if(!n&&o)return"tick"!==t?"vertical":"horizontal";if(n&&o)return"vertical";{const t=tG(r)&&r.type===nW,n=tG(i)&&i.type===nW;if(t&&!n)return"vertical";if(!t&&n)return"horizontal"}return}}return"vertical"}(r.type,n,i),void 0!==i&&i!==r.orient&&vU(`Specified orient "${r.orient}" overridden with "${i}".`),"bar"===r.type&&r.orient){const t=Nq("cornerRadiusEnd",r,e);if(void 0!==t){const e="horizontal"===r.orient&&n.x2||"vertical"===r.orient&&n.y2?["cornerRadius"]:oH[r.orient];for(const n of e)r[n]=t;void 0!==r.cornerRadiusEnd&&delete r.cornerRadiusEnd}}const o=Nq("opacity",r,e),a=Nq("fillOpacity",r,e);return void 0===o&&void 0===a&&(r.opacity=function(t,n){if(sR([LW,WW,GW,YW],t)&&!LG(n))return iV}(r.type,n)),void 0===Nq("cursor",r,e)&&(r.cursor=function(t,n,e){return n.href||t.href||Nq("href",t,e)?"pointer":t.cursor}(r,n,e)),r}const iV=.7;function oV(t){const{point:n,line:e,...r}=t;return bR(r).length>1?r:r.type}function aV(t){for(const n of["line","area","rule","trail"])t[n]&&(t={...t,[n]:oR(t[n],["point","line"])});return t}function uV(t,n={},e){return"transparent"===t.point?{opacity:0}:t.point?F(t.point)?t.point:{}:void 0!==t.point?null:n.point||e.shape?F(n.point)?n.point:{}:void 0}function sV(t,n={}){return t.line?!0===t.line?{}:t.line:void 0!==t.line?null:n.line?!0===n.line?{}:n.line:void 0}class cV{name="path-overlay";hasMatchingType(t,n){if(BG(t)){const{mark:e,encoding:r}=t,i=QW(e)?e:{type:e};switch(i.type){case"line":case"rule":case"trail":return!!uV(i,n[i.type],r);case"area":return!!uV(i,n[i.type],r)||!!sV(i,n[i.type])}}return!1}run(t,n,e){const{config:r}=n,{params:i,projection:o,mark:a,name:u,encoding:s,...c}=t,l=UG(s,r),f=QW(a)?a:{type:a},d=uV(f,r[f.type],l),h="area"===f.type&&sV(f,r[f.type]),m=[{name:u,...i?{params:i}:{},mark:oV({..."area"===f.type&&null==Nq("opacity",f,r)&&null==Nq("fillOpacity",f,r)?{opacity:iV}:{},...f}),encoding:oR(l,["shape"])}],p=eV(rV(f,l,r),l);let g=l;if(p){const{fieldChannel:t,offset:n}=p;g={...l,[t]:{...l[t],...n?{stack:n}:{}}}}return g=oR(g,["y2","x2"]),h&&m.push({...o?{projection:o}:{},mark:{type:"line",...iR(f,["clip","interpolate","tension","tooltip"]),...h},encoding:g}),d&&m.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...iR(f,["clip","tooltip"]),...d},encoding:g}),e({...c,layer:m},{...n,config:aV(r)})}}function lV(t,n){return n?BH(t)?gV(t,n):hV(t,n):t}function fV(t,n){return n?gV(t,n):t}function dV(t,n,e){const r=n[t];return function(t){return!$t(t)&&GR(t,"repeat")}(r)?r.repeat in e?{...n,[t]:e[r.repeat]}:void vU(function(t){return`Unknown repeated value "${t}".`}(r.repeat)):n}function hV(t,n){if(void 0!==(t=dV("field",t,n))){if(null===t)return null;if(RH(t)&&_H(t.sort)){const e=dV("field",t.sort,n);t={...t,...e?{sort:e}:{}}}return t}}function mV(t,n){if(YH(t))return hV(t,n);{const e=dV("datum",t,n);return e===t||e.type||(e.type="nominal"),e}}function pV(t,n){if(!ZH(t)){if(GH(t)){const e=mV(t.condition,n);if(e)return{...t,condition:e};{const{condition:n,...e}=t;return e}}return t}{const e=mV(t,n);if(e)return e;if(WH(t))return{condition:t.condition}}}function gV(t,n){const e={};for(const r in t)if(GR(t,r)){const i=t[r];if(S(i))e[r]=i.map((t=>pV(t,n))).filter((t=>t));else{const t=pV(i,n);void 0!==t&&(e[r]=t)}}return e}class vV{name="RuleForRangedLine";hasMatchingType(t){if(BG(t)){const{encoding:n,mark:e}=t;if("line"===e||QW(e)&&"line"===e.type)for(const t of KL){const e=n[ZL(t)];if(n[t]&&(YH(e)&&!uq(e.bin)||XH(e)))return!0}}return!1}run(t,n,e){const{encoding:r,mark:i}=t;var o;return vU(`Line mark is for continuous lines and thus cannot be used with ${(o=!!r.x2)&&!!r.y2?"x2 and y2":o?"x2":"y2"}. We will use the rule mark (line segments) instead.`),e({...t,mark:F(i)?{...i,type:"rule"}:"rule"},n)}}function yV({parentEncoding:t,encoding:n={},layer:e}){let r={};if(t){const i=new Set([...bR(t),...bR(n)]);for(const o of i){const i=n[o],a=t[o];if(ZH(i)){const t={...a,...i};r[o]=t}else GH(i)?r[o]={...i,condition:{...a,...i.condition}}:i||null===i?r[o]=i:(e||nG(a)||pq(a)||ZH(a)||S(a))&&(r[o]=a)}}else r=n;return!r||yR(r)?void 0:r}function bV(t){const{parentProjection:n,projection:e}=t;return n&&e&&vU(function(t){const{parentProjection:n,projection:e}=t;return`Layer's shared projection ${HR(n)} is overridden by a child projection ${HR(e)}.`}({parentProjection:n,projection:e})),e??n}function wV(t){return GR(t,"filter")}function xV(t){return GR(t,"lookup")}function $V(t){return GR(t,"pivot")}function kV(t){return GR(t,"density")}function MV(t){return GR(t,"quantile")}function AV(t){return GR(t,"regression")}function DV(t){return GR(t,"loess")}function SV(t){return GR(t,"sample")}function FV(t){return GR(t,"window")}function EV(t){return GR(t,"joinaggregate")}function NV(t){return GR(t,"flatten")}function CV(t){return GR(t,"calculate")}function OV(t){return GR(t,"bin")}function _V(t){return GR(t,"impute")}function zV(t){return GR(t,"timeUnit")}function BV(t){return GR(t,"aggregate")}function TV(t){return GR(t,"stack")}function PV(t){return GR(t,"fold")}function jV(t){return GR(t,"extent")&&!GR(t,"density")&&!GR(t,"regression")}function RV(t,n){const{transform:e,...r}=t;if(e){const t=e.map((t=>{if(wV(t))return{filter:qV(t,n)};if(OV(t)&&sq(t.bin))return{...t,bin:IV(t.bin)};if(xV(t)){const{selection:n,...e}=t.from;return n?{...t,from:{param:n,...e}}:t}return t}));return{...r,transform:t}}return t}function LV(t,n){const e=eR(t);if(YH(e)&&sq(e.bin)&&(e.bin=IV(e.bin)),eG(e)&&e.scale?.domain?.selection){const{selection:t,...n}=e.scale.domain;e.scale.domain={...n,...t?{param:t}:{}}}if(WH(e))if(S(e.condition))e.condition=e.condition.map((t=>{const{selection:e,param:r,test:i,...o}=t;return r?t:{...o,test:qV(t,n)}}));else{const{selection:t,param:r,test:i,...o}=LV(e.condition,n);e.condition=r?e.condition:{...o,test:qV(e.condition,n)}}return e}function IV(t){const n=t.extent;if(n?.selection){const{selection:e,...r}=n;return{...t,extent:{...r,param:e}}}return t}function qV(t,n){const e=t=>nR(t,(t=>{const e={param:t,empty:n.emptySelections[t]??!0};return n.selectionPredicates[t]??=[],n.selectionPredicates[t].push(e),e}));return t.selection?e(t.selection):nR(t.test||t.filter,(t=>t.selection?e(t.selection):t))}class UV extends JY{map(t,n){const e=n.selections??[];if(t.params&&!BG(t)){const n=[];for(const r of t.params)AY(r)?e.push(r):n.push(r);t.params=n}return n.selections=e,super.map(t,n)}mapUnit(t,n){const e=n.selections;if(!e||!e.length)return t;const r=(n.path??[]).concat(t.name),i=[];for(const n of e)if(n.views&&n.views.length)for(const e of n.views)($t(e)&&(e===t.name||r.includes(e))||S(e)&&e.map((t=>r.indexOf(t))).every(((t,n,e)=>-1!==t&&(0===n||t>e[n-1]))))&&i.push(n);else i.push(n);return i.length&&(t.params=i),t}}for(const t of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const n=UV.prototype[t];UV.prototype[t]=function(t,e){return n.call(this,t,WV(t,e))}}function WV(t,n){return t.name?{...n,path:(n.path??[]).concat(t.name)}:n}function HV(t,n){void 0===n&&(n=WY(t.config));const e=function(t,n={}){const e={config:n};return VV.map(GV.map(YV.map(t,e),e),e)}(t,n),{width:r,height:i}=t,o=function(t,n,e){let{width:r,height:i}=n;const o=BG(t)||XY(t),a={};o?"container"==r&&"container"==i?(a.type="fit",a.contains="padding"):"container"==r?(a.type="fit-x",a.contains="padding"):"container"==i&&(a.type="fit-y",a.contains="padding"):("container"==r&&(vU(Rq("width")),r=void 0),"container"==i&&(vU(Rq("height")),i=void 0));const u={type:"pad",...a,...e?XV(e.autosize):{},...XV(t.autosize)};if("fit"!==u.type||o||(vU('Autosize "fit" only works for single views and layered views.'),u.type="pad"),"container"==r&&"fit"!=u.type&&"fit-x"!=u.type&&vU(Lq("width")),"container"==i&&"fit"!=u.type&&"fit-y"!=u.type&&vU(Lq("height")),!WR(u,{type:"pad"}))return u}(e,{width:r,height:i},n);return{...e,...o?{autosize:o}:{}}}const GV=new class extends JY{nonFacetUnitNormalizers=[tY,oY,lY,new cV,new vV];map(t,n){if(BG(t)){const e=PG(t.encoding,YR),r=PG(t.encoding,VR),i=PG(t.encoding,XR);if(e||r||i)return this.mapFacetedUnit(t,n)}return super.map(t,n)}mapUnit(t,n){const{parentEncoding:e,parentProjection:r}=n,i=fV(t.encoding,n.repeater),o={...t,...t.name?{name:[n.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{},...i?{encoding:i}:{}};if(e||r)return this.mapUnitWithParentEncodingOrProjection(o,n);const a=this.mapLayerOrUnit.bind(this);for(const t of this.nonFacetUnitNormalizers)if(t.hasMatchingType(o,n.config))return t.run(o,n,a);return o}mapRepeat(t,n){return function(t){return!S(t.repeat)&&GR(t.repeat,"layer")}(t)?this.mapLayerRepeat(t,n):this.mapNonLayerRepeat(t,n)}mapLayerRepeat(t,n){const{repeat:e,spec:r,...i}=t,{row:o,column:a,layer:u}=e,{repeater:s={},repeaterPrefix:c=""}=n;return o||a?this.mapRepeat({...t,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:u},spec:r}},n):{...i,layer:u.map((t=>{const e={...s,layer:t},i=`${(r.name?`${r.name}_`:"")+c}child__layer_${kR(t)}`,o=this.mapLayerOrUnit(r,{...n,repeater:e,repeaterPrefix:i});return o.name=i,o}))}}mapNonLayerRepeat(t,n){const{repeat:e,spec:r,data:i,...o}=t;!S(e)&&t.columns&&(t=oR(t,["columns"]),vU(Gq("repeat")));const a=[],{repeater:u={},repeaterPrefix:s=""}=n,c=!S(e)&&e.row||[u?u.row:null],l=!S(e)&&e.column||[u?u.column:null],f=S(e)&&e||[u?u.repeat:null];for(const t of f)for(const i of c)for(const o of l){const c={repeat:t,row:i,column:o,layer:u.layer},l=`${(r.name?`${r.name}_`:"")+s}child__${S(e)?`${kR(t)}`:(e.row?`row_${kR(i)}`:"")+(e.column?`column_${kR(o)}`:"")}`,f=this.map(r,{...n,repeater:c,repeaterPrefix:l});f.name=l,a.push(oR(f,["data"]))}const d=S(e)?t.columns:e.column?e.column.length:1;return{data:r.data??i,align:"all",...o,columns:d,concat:a}}mapFacet(t,n){const{facet:e}=t;return BH(e)&&t.columns&&(t=oR(t,["columns"]),vU(Gq("facet"))),super.mapFacet(t,n)}mapUnitWithParentEncodingOrProjection(t,n){const{encoding:e,projection:r}=t,{parentEncoding:i,parentProjection:o,config:a}=n,u=bV({parentProjection:o,projection:r}),s=yV({parentEncoding:i,encoding:fV(e,n.repeater)});return this.mapUnit({...t,...u?{projection:u}:{},...s?{encoding:s}:{}},{config:a})}mapFacetedUnit(t,n){const{row:e,column:r,facet:i,...o}=t.encoding,{mark:a,width:u,projection:s,height:c,view:l,params:f,encoding:d,...h}=t,{facetMapping:m,layout:p}=this.getFacetMappingAndLayout({row:e,column:r,facet:i},n),g=fV(o,n.repeater);return this.mapFacet({...h,...p,facet:m,spec:{...u?{width:u}:{},...c?{height:c}:{},...l?{view:l}:{},...s?{projection:s}:{},mark:a,encoding:g,...f?{params:f}:{}}},n)}getFacetMappingAndLayout(t,n){const{row:e,column:r,facet:i}=t;if(e||r){i&&vU(`Facet encoding dropped as ${(o=[...e?[YR]:[],...r?[VR]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const n={},a={};for(const e of[YR,VR]){const r=t[e];if(r){const{align:t,center:i,spacing:o,columns:u,...s}=r;n[e]=s;for(const t of["align","center","spacing"])void 0!==r[t]&&(a[t]??={},a[t][e]=r[t])}}return{facetMapping:n,layout:a}}{const{align:t,center:e,spacing:r,columns:o,...a}=i;return{facetMapping:lV(a,n.repeater),layout:{...t?{align:t}:{},...e?{center:e}:{},...r?{spacing:r}:{},...o?{columns:o}:{}}}}var o}mapLayer(t,{parentEncoding:n,parentProjection:e,...r}){const{encoding:i,projection:o,...a}=t,u={...r,parentEncoding:yV({parentEncoding:n,encoding:i,layer:!0}),parentProjection:bV({parentProjection:e,projection:o})};return super.mapLayer({...a,...t.name?{name:[u.repeaterPrefix,t.name].filter((t=>t)).join("_")}:{}},u)}},YV=new class extends JY{map(t,n){return n.emptySelections??={},n.selectionPredicates??={},t=RV(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if((t=RV(t,n)).encoding){const e={};for(const[r,i]of xR(t.encoding))e[r]=LV(i,n);t={...t,encoding:e}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:e,...r}=t;return e?{...r,params:xR(e).map((([t,e])=>{const{init:r,bind:i,empty:o,...a}=e;"single"===a.type?(a.type="point",a.toggle=!1):"multi"===a.type&&(a.type="point"),n.emptySelections[t]="none"!==o;for(const e of wR(n.selectionPredicates[t]??{}))e.empty="none"!==o;return{name:t,value:r,select:a,bind:i}}))}:t}},VV=new UV;function XV(t){return $t(t)?{type:t}:t??{}}const JV=["background","padding"];function KV(t,n){const e={};for(const n of JV)t&&void 0!==t[n]&&(e[n]=$q(t[n]));return n&&(e.params=t.params),e}class QV{explicit;implicit;constructor(t={},n={}){this.explicit=t,this.implicit=n}clone(){return new QV(eR(this.explicit),eR(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return TR(this.explicit[t],this.implicit[t])}getWithExplicit(t){return void 0!==this.explicit[t]?{explicit:!0,value:this.explicit[t]}:void 0!==this.implicit[t]?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:e}){void 0!==n&&this.set(t,n,e)}set(t,n,e){return delete this[e?"implicit":"explicit"][t],this[e?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:e}){void 0!==n[t]?this.set(t,n[t],!0):void 0!==e[t]&&this.set(t,e[t],!1)}copyKeyFromObject(t,n){void 0!==n[t]&&this.set(t,n[t],!0)}copyAll(t){for(const n of bR(t.combine())){const e=t.getWithExplicit(n);this.setWithExplicit(n,e)}}}function ZV(t){return{explicit:!0,value:t}}function tX(t){return{explicit:!1,value:t}}function nX(t){return(n,e,r,i)=>{const o=t(n.value,e.value);return o>0?n:o<0?e:eX(n,e,r,i)}}function eX(t,n,e,r){return t.explicit&&n.explicit&&vU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${HR(e)} and ${HR(r)}). Using ${HR(e)}.`}(e,r,t.value,n.value)),t}function rX(t,n,e,r,i=eX){return void 0===t||void 0===t.value?n:t.explicit&&!n.explicit?t:n.explicit&&!t.explicit?n:WR(t.value,n.value)?t:i(t,n,e,r)}class iX extends QV{explicit;implicit;parseNothing;constructor(t={},n={},e=!1){super(t,n),this.explicit=t,this.implicit=n,this.parseNothing=e}clone(){const t=super.clone();return t.parseNothing=this.parseNothing,t}}function oX(t){return GR(t,"url")}function aX(t){return GR(t,"values")}function uX(t){return GR(t,"name")&&!oX(t)&&!aX(t)&&!sX(t)}function sX(t){return t&&(cX(t)||lX(t)||fX(t))}function cX(t){return GR(t,"sequence")}function lX(t){return GR(t,"sphere")}function fX(t){return GR(t,"graticule")}var dX;function hX({invalid:t,isPath:n}){switch(cH(t,{isPath:n})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:n?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}!function(t){t[t.Raw=0]="Raw",t[t.Main=1]="Main",t[t.Row=2]="Row",t[t.Column=3]="Column",t[t.Lookup=4]="Lookup",t[t.PreFilterInvalid=5]="PreFilterInvalid",t[t.PostFilterInvalid=6]="PostFilterInvalid"}(dX||(dX={}));class mX{debugName;_children=[];_parent=null;_hash;constructor(t,n){this.debugName=n,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){this._children.includes(t)?vU("Attempt to add the same child twice."):void 0!==n?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const n of this._children)n.parent=t;this._children=[],t.removeChild(this);const e=t.parent.removeChild(t);this._parent=n,n.addChild(this,e),t.parent=this}}class pX extends mX{type;refCounts;_source;_name;clone(){const t=new this.constructor;return t.debugName=`clone_${this.debugName}`,t._source=this._source,t._name=`clone_${this._name}`,t.type=this.type,t.refCounts=this.refCounts,t.refCounts[t._name]=0,t}constructor(t,n,e,r){super(t,n),this.type=e,this.refCounts=r,this._source=this._name=n,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 ${jR()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(t){this._source=t}}function gX(t){return void 0!==t.as}function vX(t){return`${t}_end`}class yX extends mX{timeUnits;clone(){return new yX(null,eR(this.timeUnits))}constructor(t,n){super(t),this.timeUnits=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{const{field:i,timeUnit:o}=e;if(o){let a;if(SU(o)){if(DZ(n)){const{mark:t,markDef:r,config:u}=n,s=LH({fieldDef:e,markDef:r,config:u});(JW(t)||s)&&(a={timeUnit:BU(o),field:i})}}else a={as:uG(e,{forAs:!0}),field:i,timeUnit:o};if(DZ(n)){const{mark:t,markDef:i,config:o}=n,u=LH({fieldDef:e,markDef:i,config:o});JW(t)&&AI(r)&&.5!==u&&(a.rectBandPosition=u)}a&&(t[aR(a)]=a)}return t}),{});return yR(e)?null:new yX(t,e)}static makeFromTransform(t,n){const{timeUnit:e,...r}={...n},i={...r,timeUnit:BU(e)};return new yX(t,{[aR(i)]:i})}merge(t){this.timeUnits={...this.timeUnits};for(const n in t.timeUnits)this.timeUnits[n]||(this.timeUnits[n]=t.timeUnits[n]);for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}removeFormulas(t){const n={};for(const[e,r]of xR(this.timeUnits)){const i=gX(r)?r.as:`${r.field}_end`;t.has(i)||(n[e]=r)}this.timeUnits=n}producedFields(){return new Set(wR(this.timeUnits).map((t=>gX(t)?t.as:vX(t.field))))}dependentFields(){return new Set(wR(this.timeUnits).map((t=>t.field)))}hash(){return`TimeUnit ${aR(this.timeUnits)}`}assemble(){const t=[];for(const n of wR(this.timeUnits)){const{rectBandPosition:e}=n,r=BU(n.timeUnit);if(gX(n)){const{field:i,as:o}=n,{unit:a,utc:u,...s}=r,c=[o,`${o}_end`];t.push({field:OR(i),type:"timeunit",...a?{units:CU(a)}:{},...u?{timezone:"utc"}:{},...s,as:c}),t.push(...$X(c,e,r))}else if(n){const{field:i}=n,o=NR(i),a=xX({timeUnit:r,field:o}),u=vX(o);t.push({type:"formula",expr:a,as:u}),t.push(...$X([o,u],e,r))}}return t}}const bX="offsetted_rect_start",wX="offsetted_rect_end";function xX({timeUnit:t,field:n,reverse:e}){const{unit:r,utc:i}=t,o=OU(r),{part:a,step:u}=jU(o,t.step);return`${i?"utcOffset":"timeOffset"}('${a}', ${ER(n)}, ${e?-u:u})`}function $X([t,n],e,r){if(void 0!==e&&.5!==e){const i=ER(t),o=ER(n);return[{type:"formula",expr:kX([xX({timeUnit:r,field:t,reverse:!0}),i],e+.5),as:`${t}_${bX}`},{type:"formula",expr:kX([i,o],e+.5),as:`${t}_${wX}`}]}return[]}function kX([t,n],e){return`${1-e} * ${t} + ${e} * ${n}`}const MX="_tuple_fields";class AX{hasChannel;hasField;hasSelectionId;timeUnit;items;constructor(...t){this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const DX={defined:()=>!0,parse:(t,n,e)=>{const r=n.name,i=n.project??=new AX,o={},a={},u=new Set,s=(t,n)=>{const e="visual"===n?t.channel:t.field;let i=kR(`${r}_${e}`);for(let t=1;u.has(i);t++)i=kR(`${r}_${e}_${t}`);return u.add(i),{[n]:i}},c=n.type,l=t.config.selection[c],f=void 0!==e.value?Q(e.value):null;let{fields:d,encodings:h}=F(e.select)?e.select:{};if(!d&&!h&&f)for(const t of f)if(F(t))for(const n of bR(t))ft(XL,n)?(h||(h=[])).push(n):"interval"===c?(vU('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),h=l.encodings):(d??=[]).push(n);d||h||(h=l.encodings,"fields"in l&&(d=l.fields));for(const n of h??[]){const e=t.fieldDef(n);if(e){let r=e.field;if(e.aggregate){vU(Wq(n,e.aggregate));continue}if(!r){vU(Uq(n));continue}if(e.timeUnit&&!SU(e.timeUnit)){r=t.vgField(n);const i={timeUnit:e.timeUnit,as:r,field:e.field};a[aR(i)]=i}if(!o[r]){const a={field:r,channel:n,type:"interval"===c&&HI(n)&&wW(t.getScaleComponent(n).get("type"))?"R":e.bin?"R-RE":"E",index:i.items.length};a.signals={...s(a,"data"),...s(a,"visual")},i.items.push(o[r]=a),i.hasField[r]=o[r],i.hasSelectionId=i.hasSelectionId||r===xY,zL(n)?(a.geoChannel=n,a.channel=_L(n),i.hasChannel[a.channel]=o[r]):i.hasChannel[n]=o[r]}}else vU(Uq(n))}for(const t of d??[]){if(i.hasField[t])continue;const n={type:"E",field:t,index:i.items.length};n.signals={...s(n,"data")},i.items.push(n),i.hasField[t]=n,i.hasSelectionId=i.hasSelectionId||t===xY}f&&(n.init=f.map((t=>i.items.map((n=>F(t)?void 0!==t[n.geoChannel||n.channel]?t[n.geoChannel||n.channel]:t[n.field]:t))))),yR(a)||(i.timeUnit=new yX(null,a))},signals:(t,n,e)=>{const r=n.name+MX;return e.filter((t=>t.name===r)).length>0||n.project.hasSelectionId?e:e.concat({name:r,value:n.project.items.map(PX)})}},SX="_curr",FX="anim_value",EX="anim_clock",NX="eased_anim_clock",CX="min_extent",OX="max_range_extent",_X="last_tick_at",zX="is_playing",BX=1/60*1e3,TX={defined:t=>"point"===t.type,topLevelSignals:(t,n,e)=>(ZJ(n)&&(e=e.concat([{name:EX,init:"0",on:[{events:{type:"timer",throttle:BX},update:`${zX} ? (${EX} + (now() - ${_X}) > ${OX} ? 0 : ${EX} + (now() - ${_X})) : ${EX}`}]},{name:_X,init:"now()",on:[{events:[{signal:EX},{signal:zX}],update:"now()"}]},{name:zX,init:"true"}])),e),signals:(t,n,e)=>{const r=n.name,i=r+MX,o=n.project,a="(item().isVoronoi ? datum.datum : datum)",u=wR(t.component.selection??{}).reduce(((t,n)=>"interval"===n.type?t.concat(n.name+GX):t),[]).map((t=>`indexof(item().mark.name, '${t}') < 0`)).join(" && "),s="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(u?` && ${u}`:"");let c=`unit: ${JJ(t)}, `;if(n.project.hasSelectionId?c+=`${xY}: ${a}[${Nt(xY)}]`:ZJ(n)?c+=`fields: ${i}, values: [${FX} ? ${FX} : ${CX}]`:c+=`fields: ${i}, values: [${o.items.map((n=>{const e=t.fieldDef(n.channel);return e?.bin?`[${a}[${Nt(t.vgField(n.channel,{}))}], ${a}[${Nt(t.vgField(n.channel,{binSuffix:"end"}))}]]`:`${a}[${Nt(n.field)}]`})).join(", ")}]`,ZJ(n))return e.concat((l=n.name,f=t.scaleName(lL),[{name:NX,update:EX},{name:`${l}_domain`,init:`domain('${f}')`},{name:CX,init:`extent(${l}_domain)[0]`},{name:OX,init:`extent(range('${f}'))[1]`},{name:FX,update:`invert('${f}', ${NX})`}]),[{name:r+GJ,on:[{events:[{signal:NX},{signal:FX}],update:`{${c}}`,force:!0}]}]);{const t=n.events;return e.concat([{name:r+GJ,on:t?[{events:t,update:`${s} ? {${c}} : null`,force:!0}]:[]}])}var l,f}};function PX(t){const{signals:n,hasLegend:e,index:r,...i}=t;return i.field=OR(i.field),i}function jX(t,n=!0,e=b){if(S(t)){const r=t.map((t=>jX(t,n,e)));return n?`[${r.join(", ")}]`:r}return yU(t)?e(n?MU(t):function(t){const n=kU(t,!0);return t.utc?+new Date(Date.UTC(...n)):+new Date(...n)}(t)):n?e(HR(t)):t}function RX(t,n){for(const e of wR(t.component.selection??{})){const r=e.name;let i=`${r}${GJ}, ${"global"===e.resolve?"true":`{unit: ${JJ(t)}}`}`;for(const r of XJ)r.defined(e)&&(r.signals&&(n=r.signals(t,e,n)),r.modifyExpr&&(i=r.modifyExpr(t,e,i)));n.push({name:r+YJ,on:[{events:{signal:e.name+GJ},update:`modify(${Nt(e.name+HJ)}, ${i})`}]})}return qX(n)}function LX(t,n){if(t.component.selection&&bR(t.component.selection).length){const e=Nt(t.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:eB("pointermove","scope"),update:`isTuple(facet) ? facet : group(${e}).datum`}]})}return qX(n)}function IX(t,n){for(const e of wR(t.component.selection??{}))for(const r of XJ)r.defined(e)&&r.marks&&(n=r.marks(t,e,n));return n}function qX(t){return t.map((t=>(t.on&&!t.on.length&&delete t.on,t)))}const UX={defined:t=>"interval"===t.type&&"global"===t.resolve&&t.bind&&"scales"===t.bind,parse:(t,n)=>{const e=n.scales=[];for(const r of n.project.items){const i=r.channel;if(!HI(i))continue;const o=t.getScaleComponent(i),a=o?o.get("type"):void 0;"sequential"==a&&vU("Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc"),o&&wW(a)?(o.set("selectionExtent",{param:n.name,field:r.field},!0),e.push(r)):vU("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(t,n,e)=>{const r=n.scales.filter((t=>0===e.filter((n=>n.name===t.signals.data)).length));if(!t.parent||HX(t)||0===r.length)return e;const i=e.find((t=>t.name===n.name));let o=i.update;if(o.includes(VJ))i.update=`{${r.map((t=>`${Nt(OR(t.field))}: ${t.signals.data}`)).join(", ")}}`;else{for(const t of r){const n=`${Nt(OR(t.field))}: ${t.signals.data}`;o.includes(n)||(o=`${o.substring(0,o.length-1)}, ${n}}`)}i.update=o}return e.concat(r.map((t=>({name:t.signals.data}))))},signals:(t,n,e)=>{if(t.parent&&!HX(t))for(const t of n.scales){const n=e.find((n=>n.name===t.signals.data));n.push="outer",delete n.value,delete n.update}return e}};function WX(t,n){return`domain(${Nt(t.scaleName(n))})`}function HX(t){return t.parent&&EZ(t.parent)&&(!t.parent.parent||HX(t.parent.parent))}const GX="_brush",YX="_scale_trigger",VX="geo_interval_init_tick",XX="_init",JX={defined:t=>"interval"===t.type,parse:(t,n,e)=>{if(t.hasProjection){const t={...F(e.select)?e.select:{}};t.fields=[xY],t.encodings||(t.encodings=e.value?bR(e.value):[uL,aL]),e.select={type:"interval",...t}}if(n.translate&&!UX.defined(n)){const t=`!event.item || event.item.mark.name !== ${Nt(n.name+GX)}`;for(const e of n.events){if(!e.between){vU(`${e} is not an ordered event stream for interval selections.`);continue}const n=Q(e.between[0].filter??=[]);n.includes(t)||n.push(t)}}},signals:(t,n,e)=>{const r=n.name,i=r+GJ,o=wR(n.project.hasChannel).filter((t=>t.channel===JR||t.channel===KR)),a=n.init?n.init[0]:null;if(e.push(...o.reduce(((e,r)=>e.concat(function(t,n,e,r){const i=!t.hasProjection,o=e.channel,a=e.signals.visual,u=Nt(i?t.scaleName(o):t.projectionName()),s=t=>`scale(${u}, ${t})`,c=t.getSizeSignalRef(o===JR?"width":"height").signal,l=`${o}(unit)`,f=n.events.reduce(((t,n)=>[...t,{events:n.between[0],update:`[${l}, ${l}]`},{events:n,update:`[${a}[0], clamp(${l}, 0, ${c})]`}]),[]);if(i){const i=e.signals.data,c=UX.defined(n),l=t.getScaleComponent(o),d=l?l.get("type"):void 0,h=r?{init:jX(r,!0,s)}:{value:[]};return f.push({events:{signal:n.name+YX},update:wW(d)?`[${s(`${i}[0]`)}, ${s(`${i}[1]`)}]`:"[0, 0]"}),c?[{name:i,on:[]}]:[{name:a,...h,on:f},{name:i,...r?{init:jX(r)}:{},on:[{events:{signal:a},update:`${a}[0] === ${a}[1] ? null : invert(${u}, ${a})`}]}]}{const t=o===JR?0:1,e=n.name+XX;return[{name:a,...r?{init:`[${e}[0][${t}], ${e}[1][${t}]]`}:{value:[]},on:f}]}}(t,n,r,a?.[r.index]))),[])),t.hasProjection){const u=Nt(t.projectionName()),s=t.projectionName()+"_center",{x:c,y:l}=n.project.hasChannel,f=c?.signals.visual,d=l?.signals.visual,h=c?a?.[c.index]:`${s}[0]`,m=l?a?.[l.index]:`${s}[1]`,p=n=>t.getSizeSignalRef(n).signal,g=`[[${f?`${f}[0]`:"0"}, ${d?`${d}[0]`:"0"}],[${f?`${f}[1]`:p("width")}, ${d?`${d}[1]`:p("height")}]]`;!a||(e.unshift({name:r+XX,init:`[scale(${u}, [${c?h[0]:h}, ${l?m[0]:m}]), scale(${u}, [${c?h[1]:h}, ${l?m[1]:m}])]`}),c&&l)||e.find((t=>t.name===s))||e.unshift({name:s,update:`invert(${u}, [${p("width")}/2, ${p("height")}/2])`});const v=`vlSelectionTuples(intersect(${g}, {markname: ${Nt(t.getName("marks"))}}, unit.mark), {unit: ${JJ(t)}})`,y=o.map((t=>t.signals.visual));return e.concat({name:i,on:[{events:[...y.length?[{signal:y.join(" || ")}]:[],...a?[{signal:VX}]:[]],update:v}]})}{if(!UX.defined(n)){const n=r+YX,i=o.map((n=>{const e=n.channel,{data:r,visual:i}=n.signals,o=Nt(t.scaleName(e)),a=wW(t.getScaleComponent(e).get("type"))?"+":"";return`(!isArray(${r}) || (${a}invert(${o}, ${i})[0] === ${a}${r}[0] && ${a}invert(${o}, ${i})[1] === ${a}${r}[1]))`}));i.length&&e.push({name:n,value:{},on:[{events:o.map((n=>({scale:t.scaleName(n.channel)}))),update:`${i.join(" && ")} ? ${n} : {}`}]})}const u=o.map((t=>t.signals.data)),s=`unit: ${JJ(t)}, fields: ${r+MX}, values`;return e.concat({name:i,...a?{init:`{${s}: ${jX(a)}}`}:{},...u.length?{on:[{events:[{signal:u.join(" || ")}],update:`${u.join(" && ")} ? {${s}: [${u}]} : null`}]}:{}})}},topLevelSignals:(t,n,e)=>(DZ(t)&&t.hasProjection&&n.init&&(e.filter((t=>t.name===VX)).length||e.unshift({name:VX,value:null,on:[{events:"timer{1}",update:`${VX} === null ? {} : ${VX}`}]})),e),marks:(t,n,e)=>{const r=n.name,{x:i,y:o}=n.project.hasChannel,a=i?.signals.visual,u=o?.signals.visual,s=`data(${Nt(n.name+HJ)})`;if(UX.defined(n)||!i&&!o)return e;const c={x:void 0!==i?{signal:`${a}[0]`}:{value:0},y:void 0!==o?{signal:`${u}[0]`}:{value:0},x2:void 0!==i?{signal:`${a}[1]`}:{field:{group:"width"}},y2:void 0!==o?{signal:`${u}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const n of bR(c))c[n]=[{test:`${s}.length && ${s}[0].unit === ${JJ(t)}`,...c[n]},{value:0}];const{fill:l,fillOpacity:f,cursor:d,...h}=n.mark,m=bR(h).reduce(((t,n)=>(t[n]=[{test:[void 0!==i&&`${a}[0] !== ${a}[1]`,void 0!==o&&`${u}[0] !== ${u}[1]`].filter((t=>t)).join(" && "),value:h[n]},{value:null}],t)),{}),p=d??(n.translate?"move":null);return[{name:`${r+GX}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:l},fillOpacity:{value:f}},update:c}},...e,{name:r+GX,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...c,...m}}}]}};function KX({model:t,channelDef:n,vgChannel:e,invalidValueRef:r,mainRefFn:i}){const o=WH(n)&&n.condition;let a=[];o&&(a=Q(o).map((n=>{const e=i(n);if(function(t){return GR(t,"param")}(n)){const{param:r,empty:i}=n;return{test:iK(t,{param:r,empty:i}),...e}}return{test:aK(t,n.test),...e}}))),void 0!==r&&a.push(r);const u=i(n);return void 0!==u&&a.push(u),a.length>1||1===a.length&&Boolean(a[0].test)?{[e]:a}:1===a.length?{[e]:a[0]}:{}}function QX(t,n="text"){return KX({model:t,channelDef:t.encoding[n],vgChannel:n,mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0})}function ZX(t,n,e="datum"){if(t){if(nG(t))return Mq(t.value);if(ZH(t)){const{format:r,formatType:i}=pG(t);return xH({fieldOrDatumDef:t,format:r,formatType:i,expr:e,config:n})}}}function tJ(t,n={}){const{encoding:e,markDef:r,config:i,stack:o}=t,a=e.tooltip;if(S(a))return{tooltip:eJ({tooltip:a},o,i,n)};{const u=n.reactiveGeom?"datum.datum":"datum";return KX({model:t,channelDef:a,vgChannel:"tooltip",mainRefFn:t=>{const a=rJ(t,i,u);if(a)return a;if(null===t)return;let s=Nq("tooltip",r,i);return!0===s&&(s={content:"encoding"}),$t(s)?{value:s}:F(s)?pq(s)?s:"encoding"===s.content?eJ(e,o,i,n):{signal:u}:void 0},invalidValueRef:void 0})}}function nJ(t,n,e,{reactiveGeom:r}={}){const i={...e,...e.tooltipFormat},o=new Set,a=r?"datum.datum":"datum",u=[];function s(e,r){const s=ZL(r),c=tG(e)?e:{...e,type:t[s].type},l=Q(c.title||mG(c,i)).join(", ").replaceAll(/"/g,'\\"');let f;if(AI(r)){const n="x"===r?"x2":"y2",e=gG(t[n]);if(uq(c.bin)&&e){const t=uG(c,{expr:a}),r=uG(e,{expr:a}),{format:u,formatType:s}=pG(c);f=EH(t,r,u,s,i),o.add(n)}}if((AI(r)||r===iL||r===eL)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:t,formatType:n}=pG(c);f=xH({fieldOrDatumDef:c,format:t,formatType:n,expr:a,config:i,normalizeStack:!0}).signal}f??=rJ(c,i,a).signal,u.push({channel:r,key:l,value:f})}WG(t,((t,n)=>{YH(t)?s(t,n):HH(t)&&s(t.condition,n)}));const c={};for(const{channel:t,key:n,value:e}of u)o.has(t)||c[n]||(c[n]=e);return c}function eJ(t,n,e,{reactiveGeom:r}={}){const i=nJ(t,n,e,{reactiveGeom:r}),o=xR(i).map((([t,n])=>`"${t}": ${n}`));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function rJ(t,n,e="datum"){if(YH(t)&&QU(t.type)&&!GR(t,"format")){const n=`datum["${t.field}"]`;return{signal:`isValid(${n}) ? isArray(${n}) ? join(${n}, '\\n') : ${n} : ""+${n}`}}return ZX(t,n,e)}function iJ(t){const{markDef:n,config:e}=t,r=Nq("aria",n,e);return!1===r?{}:{...r?{aria:r}:{},...oJ(t),...aJ(t)}}function oJ(t){const{mark:n,markDef:e,config:r}=t;if(!1===r.aria)return{};const i=Nq("ariaRoleDescription",e,r);return null!=i?{ariaRoleDescription:{value:i}}:ft(bq,n)?{}:{ariaRoleDescription:{value:n}}}function aJ(t){const{encoding:n,markDef:e,config:r,stack:i}=t,o=n.description;if(o)return KX({model:t,channelDef:o,vgChannel:"description",mainRefFn:n=>ZX(n,t.config),invalidValueRef:void 0});const a=Nq("description",e,r);if(null!=a)return{description:Mq(a)};if(!1===r.aria)return{};const u=nJ(n,i,r);return yR(u)?void 0:{description:{signal:xR(u).filter((([t])=>!t.startsWith("_"))).map((([t,n])=>[t,n.replaceAll("\\n"," ")])).map((([t,n],e)=>`"${e>0?"; ":""}${t}: " + (${n})`)).join(" + ")}}}function uJ(t,n,e={}){const{markDef:r,encoding:i,config:o}=n,{vgChannel:a}=e;let{defaultRef:u,defaultValue:s}=e;const c=i[t];void 0===u&&(s??=Nq(t,r,o,{vgChannel:a,ignoreVgConfig:!WH(c)}),void 0!==s&&(u=Mq(s)));const l={markDef:r,config:o,scaleName:n.scaleName(t),scale:n.getScaleComponent(t)},f=dH({...l,scaleChannel:t,channelDef:c});return KX({model:n,channelDef:c,vgChannel:a??t,invalidValueRef:f,mainRefFn:n=>vH({...l,channel:t,channelDef:n,stack:null,defaultRef:u})})}function sJ(t,n={filled:void 0}){const{markDef:e,encoding:r,config:i}=t,{type:o}=e,a=n.filled??Nq("filled",e,i),u=sR(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,s=Nq(!0===a?"color":void 0,e,i,{vgChannel:"fill"})??i.mark[!0===a&&"color"]??u,c=Nq(!1===a?"color":void 0,e,i,{vgChannel:"stroke"})??i.mark[!1===a&&"color"],l=a?"fill":"stroke",f={...s?{fill:Mq(s)}:{},...c?{stroke:Mq(c)}:{}};return e.color&&(a?e.fill:e.stroke)&&vU(Zq("property",{fill:"fill"in e,stroke:"stroke"in e})),{...f,...uJ("color",t,{vgChannel:l,defaultValue:a?s:c}),...uJ("fill",t,{defaultValue:r.fill?s:void 0}),...uJ("stroke",t,{defaultValue:r.stroke?c:void 0})}}function cJ(t){const{encoding:n,mark:e}=t,r=n.order;return!XW(e)&&nG(r)?KX({model:t,channelDef:r,vgChannel:"zindex",mainRefFn:t=>Mq(t.value),invalidValueRef:void 0}):{}}function lJ({channel:t,markDef:n,encoding:e={},model:r,bandPosition:i}){const o=`${t}Offset`,a=n[o],u=e[o];if(("xOffset"===o||"yOffset"===o)&&u)return{offsetType:"encoding",offset:vH({channel:o,channelDef:u,markDef:n,config:r?.config,scaleName:r.scaleName(o),scale:r.getScaleComponent(o),stack:null,defaultRef:Mq(a),bandPosition:i})};const s=n[o];return s?{offsetType:"visual",offset:s}:{}}function fJ(t,n,{defaultPos:e,vgChannel:r}){const{encoding:i,markDef:o,config:a,stack:u}=n,s=i[t],c=i[nI(t)],l=n.scaleName(t),f=n.getScaleComponent(t),{offset:d,offsetType:h}=lJ({channel:t,markDef:o,encoding:i,model:n,bandPosition:.5}),m=dJ({model:n,defaultPos:e,channel:t,scaleName:l,scale:f}),p=!s&&AI(t)&&(i.latitude||i.longitude)?{field:n.getName(t)}:function(t){const{channel:n,channelDef:e,scaleName:r,stack:i,offset:o,markDef:a}=t;if(ZH(e)&&i&&n===i.fieldChannel){if(YH(e)){let t=e.bandPosition;if(void 0!==t||"text"!==a.type||"radius"!==n&&"theta"!==n||(t=.5),void 0!==t)return gH({scaleName:r,fieldOrDatumDef:e,startSuffix:"start",bandPosition:t,offset:o})}return pH(e,r,{suffix:"end"},{offset:o})}return mH(t)}({channel:t,channelDef:s,channel2Def:c,markDef:o,config:a,scaleName:l,scale:f,stack:u,offset:d,defaultRef:m,bandPosition:"encoding"===h?0:void 0});return p?{[r||t]:p}:void 0}function dJ({model:t,defaultPos:n,channel:e,scaleName:r,scale:i}){const{markDef:o,config:a}=t;return()=>{const u=ZL(e),s=tI(e),c=Nq(e,o,a,{vgChannel:s});if(void 0!==c)return yH(e,c);switch(n){case"zeroOrMin":return hJ({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:u,config:a});case"zeroOrMax":return hJ({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:t.width.signal,heightSignal:t.height.signal}},mainChannel:u,config:a});case"mid":return{...t[eI(e)],mult:.5}}}}function hJ({mainChannel:t,config:n,...e}){const r=fH(e),{mode:i}=e;if(r)return r;switch(t){case"radius":{if("zeroOrMin"===i)return{value:0};const{widthSignal:t,heightSignal:n}=i.zeroOrMax;return{signal:`min(${t},${n})/2`}}case"theta":return"zeroOrMin"===i?{value:0}:{signal:"2*PI"};case"x":return"zeroOrMin"===i?{value:0}:{field:{group:"width"}};case"y":return"zeroOrMin"===i?{field:{group:"height"}}:{value:0}}}const mJ={left:"x",center:"xc",right:"x2"},pJ={top:"y",middle:"yc",bottom:"y2"};function gJ(t,n,e,r="middle"){if("radius"===t||"theta"===t)return tI(t);const i="x"===t?"align":"baseline",o=Nq(i,n,e);let a;return pq(o)?(vU(function(t){return`The ${t} for range marks cannot be an expression`}(i)),a=void 0):a=o,"x"===t?mJ[a||("top"===r?"left":"center")]:pJ[a||r]}function vJ(t,n,{defaultPos:e,defaultPos2:r,range:i}){return i?yJ(t,n,{defaultPos:e,defaultPos2:r}):fJ(t,n,{defaultPos:e})}function yJ(t,n,{defaultPos:e,defaultPos2:r}){const{markDef:i,config:o}=n,a=nI(t),u=eI(t),s=function(t,n,e){const{encoding:r,mark:i,markDef:o,stack:a,config:u}=t,s=ZL(e),c=eI(e),l=tI(e),f=r[s],d=t.scaleName(s),h=t.getScaleComponent(s),{offset:m}=lJ(e in r||e in o?{channel:e,markDef:o,encoding:r,model:t}:{channel:s,markDef:o,encoding:r,model:t});if(!f&&("x2"===e||"y2"===e)&&(r.latitude||r.longitude)){const n=eI(e),r=t.markDef[n];return null!=r?{[n]:{value:r}}:{[l]:{field:t.getName(e)}}}const p=function({channel:t,channelDef:n,channel2Def:e,markDef:r,config:i,scaleName:o,scale:a,stack:u,offset:s,defaultRef:c}){return ZH(n)&&u&&t.charAt(0)===u.fieldChannel.charAt(0)?pH(n,o,{suffix:"start"},{offset:s}):mH({channel:t,channelDef:e,scaleName:o,scale:a,stack:u,markDef:r,config:i,offset:s,defaultRef:c})}({channel:e,channelDef:f,channel2Def:r[e],markDef:o,config:u,scaleName:d,scale:h,stack:a,offset:m,defaultRef:void 0});return void 0!==p?{[l]:p}:bJ(e,o)||bJ(e,{[e]:Oq(e,o,u.style),[c]:Oq(c,o,u.style)})||bJ(e,u[i])||bJ(e,u.mark)||{[l]:dJ({model:t,defaultPos:n,channel:e,scaleName:d,scale:h})()}}(n,r,a);return{...fJ(t,n,{defaultPos:e,vgChannel:s[u]?gJ(t,i,o):tI(t)}),...s}}function bJ(t,n){const e=eI(t),r=tI(t);if(void 0!==n[r])return{[r]:yH(t,n[r])};if(void 0!==n[t])return{[r]:yH(t,n[t])};if(n[e]){const r=n[e];if(!iH(r))return{[e]:yH(t,r)};vU(function(t){return`Position range does not support relative band size for ${t}.`}(e))}}function wJ(t,n){const{config:e,encoding:r,markDef:i}=t,o=i.type,a=nI(n),u=eI(n),s=r[n],c=r[a],l=t.getScaleComponent(n),f=l?l.get("type"):void 0,d=i.orient,h=r[u]??r.size??Nq("size",i,e,{vgChannel:u}),m=rI(n),p="bar"===o&&("x"===n?"vertical"===d:"horizontal"===d)||"tick"===o&&("y"===n?"vertical"===d:"horizontal"===d);return!YH(s)||!(aq(s.bin)||uq(s.bin)||s.timeUnit&&!c)||h&&!iH(h)||r[m]||bW(f)?(ZH(s)&&bW(f)||p)&&!c?function(t,n,e){const{markDef:r,encoding:i,config:o,stack:a}=e,u=r.orient,s=e.scaleName(n),c=e.getScaleComponent(n),l=eI(n),f=nI(n),d=rI(n),h=e.scaleName(d),m=e.getScaleComponent(iI(n)),p="tick"===r.type||"horizontal"===u&&"y"===n||"vertical"===u&&"x"===n;let g;(i.size||r.size)&&(p?g=uJ("size",e,{vgChannel:l,defaultRef:Mq(r.size)}):vU(function(t){return`Cannot apply size to non-oriented mark "${t}".`}(r.type)));const v=!!g,y=IH({channel:n,fieldDef:t,markDef:r,config:o,scaleType:(c||m)?.get("type"),useVlSizeChannel:p});g=g||{[l]:xJ(l,h||s,m||c,o,y,!!t,r.type)};const b=gJ(n,r,o,"band"===(c||m)?.get("type")&&iH(y)&&!v?"top":"middle"),w="xc"===b||"yc"===b,{offset:x,offsetType:$}=lJ({channel:n,markDef:r,encoding:i,model:e,bandPosition:w?.5:0}),k=mH({channel:n,channelDef:t,markDef:r,config:o,scaleName:s,scale:c,stack:a,offset:x,defaultRef:dJ({model:e,defaultPos:"mid",channel:n,scaleName:s,scale:c}),bandPosition:w?"encoding"===$?0:.5:pq(y)?{signal:`(1-${y})/2`}:iH(y)?(1-y.band)/2:0});if(l)return{[b]:k,...g};{const t=tI(f),n=g[l],e=x?{...n,offset:x}:n;return{[b]:k,[t]:S(k)?[k[0],{...k[1],offset:e}]:{...k,offset:e}}}}(s,n,t):yJ(n,t,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function({fieldDef:t,fieldDef2:n,channel:e,model:r}){const{config:i,markDef:o,encoding:a}=r,u=r.getScaleComponent(e),s=r.scaleName(e),c=u?u.get("type"):void 0,l=u.get("reverse"),f=IH({channel:e,fieldDef:t,markDef:o,config:i,scaleType:c}),d=r.component.axes[e]?.[0],h=d?.get("translate")??.5,m=AI(e)?Nq("binSpacing",o,i)??0:0,p=nI(e),g=tI(e),v=tI(p),y=Cq("minBandSize",o,i),{offset:b}=lJ({channel:e,markDef:o,encoding:a,model:r,bandPosition:0}),{offset:w}=lJ({channel:p,markDef:o,encoding:a,model:r,bandPosition:0}),x=function({scaleName:t,fieldDef:n}){const e=uG(n,{expr:"datum"});return`abs(scale("${t}", ${uG(n,{expr:"datum",suffix:"end"})}) - scale("${t}", ${e}))`}({fieldDef:t,scaleName:s}),$=$J(e,m,l,h,b,y,x),k=$J(p,m,l,h,w??b,y,x),M=pq(f)?{signal:`(1-${f.signal})/2`}:iH(f)?(1-f.band)/2:.5,A=LH({fieldDef:t,fieldDef2:n,markDef:o,config:i});if(aq(t.bin)||t.timeUnit){const n=t.timeUnit&&.5!==A;return{[v]:kJ({fieldDef:t,scaleName:s,bandPosition:M,offset:k,useRectOffsetField:n}),[g]:kJ({fieldDef:t,scaleName:s,bandPosition:pq(M)?{signal:`1-${M.signal}`}:1-M,offset:$,useRectOffsetField:n})}}if(uq(t.bin)){const e=pH(t,s,{},{offset:k});if(YH(n))return{[v]:e,[g]:pH(n,s,{},{offset:$})};if(sq(t.bin)&&t.bin.step)return{[v]:e,[g]:{signal:`scale("${s}", ${uG(t,{expr:"datum"})} + ${t.bin.step})`,offset:$}}}vU(hU(p))}({fieldDef:s,fieldDef2:c,channel:n,model:t})}function xJ(t,n,e,r,i,o,a){if(iH(i)){if(!e)return{mult:i.band,field:{group:t}};{const t=e.get("type");if("band"===t){let t=`bandwidth('${n}')`;1!==i.band&&(t=`${i.band} * ${t}`);const e=Cq("minBandSize",{type:a},r);return{signal:e?`max(${Sq(e)}, ${t})`:t}}1!==i.band&&(vU(function(t){return`Cannot use the relative band size with ${t} scale.`}(t)),i=void 0)}}else{if(pq(i))return i;if(i)return{value:i}}if(e){const t=e.get("range");if(gq(t)&&wt(t.step))return{value:t.step-2}}if(!o){const{bandPaddingInner:n,barBandPaddingInner:e,rectBandPaddingInner:i,tickBandPaddingInner:o}=r.scale,u=TR(n,"tick"===a?o:"bar"===a?e:i);if(pq(u))return{signal:`(1 - (${u.signal})) * ${t}`};if(wt(u))return{signal:`${1-u} * ${t}`}}return{value:BY(r.view,t)-2}}function $J(t,n,e,r,i,o,a){if(CL(t))return 0;const u="x"===t||"y2"===t,s=u?-n/2:n/2;if(pq(e)||pq(i)||pq(r)||o){const t=Sq(e),n=Sq(i),c=Sq(r),l=Sq(o),f=o?`(${a} < ${l} ? ${u?"":"-"}0.5 * (${l} - (${a})) : ${s})`:s;return{signal:(c?`${c} + `:"")+(t?`(${t} ? -1 : 1) * `:"")+(n?`(${n} + ${f})`:f)}}return i=i||0,r+(e?-i-s:+i+s)}function kJ({fieldDef:t,scaleName:n,bandPosition:e,offset:r,useRectOffsetField:i}){return gH({scaleName:n,fieldOrDatumDef:t,bandPosition:e,offset:r,...i?{startSuffix:bX,endSuffix:wX}:{}})}const MJ=new Set(["aria","width","height"]);function AJ(t,n){const{fill:e,stroke:r}="include"===n.color?sJ(t):{};return{...SJ(t.markDef,n),...DJ("fill",e),...DJ("stroke",r),...uJ("opacity",t),...uJ("fillOpacity",t),...uJ("strokeOpacity",t),...uJ("strokeWidth",t),...uJ("strokeDash",t),...cJ(t),...tJ(t),...QX(t,"href"),...iJ(t)}}function DJ(t,n){return n?{[t]:n}:{}}function SJ(t,n){return yq.reduce(((e,r)=>(!MJ.has(r)&&GR(t,r)&&"ignore"!==n[r]&&(e[r]=Mq(t[r])),e)),{})}function FJ(t){const{config:n,markDef:e}=t,r=new Set;if(t.forEachFieldDef(((i,o)=>{let a;if(!HI(o)||!(a=t.getScaleType(o)))return;const u=eq(i.aggregate);if("break-paths-filter-domains"===(s=lH({scaleChannel:o,markDef:e,config:n,scaleType:a,isCountAggregate:u}))||"break-paths-show-domains"===s){const n=t.vgField(o,{expr:"datum",binSuffix:t.stack?.impute?"mid":void 0});n&&r.add(n)}var s})),r.size>0){const t=[...r].map((t=>XU(t,!0))).join(" && ");return{defined:{signal:t}}}}function EJ(t,n){if(void 0!==n)return{[t]:Mq(n)}}const NJ="voronoi",CJ={defined:t=>"point"===t.type&&t.nearest,parse:(t,n)=>{if(n.events)for(const e of n.events)e.markname=t.getName(NJ)},marks:(t,n,e)=>{const{x:r,y:i}=n.project.hasChannel,o=t.mark;if(XW(o))return vU(`The "nearest" transform is not supported for ${o} marks.`),e;const a={name:t.getName(NJ),type:"path",interactive:!0,aria:!1,from:{data:t.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...tJ(t,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]}]};let u=0,s=!1;return e.forEach(((n,e)=>{const r=n.name??"";r===t.component.mark[0].name?u=e:r.includes(NJ)&&(s=!0)})),s||e.splice(u+1,0,a),e}},OJ={defined:t=>"point"===t.type&&"global"===t.resolve&&t.bind&&"scales"!==t.bind&&!kY(t.bind),parse:(t,n,e)=>QJ(n,e),topLevelSignals:(t,n,e)=>{const r=n.name,i=n.project,o=n.bind,a=n.init?.[0],u=CJ.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach(((t,i)=>{const s=kR(`${r}_${t.field}`);e.filter((t=>t.name===s)).length||e.unshift({name:s,...a?{init:jX(a[i])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${u}[${Nt(t.field)}] : null`}]:[],bind:o[t.field]??o[t.channel]??o})})),e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+GJ)),a=r+MX,u=i.items.map((t=>kR(`${r}_${t.field}`))),s=u.map((t=>`${t} !== null`)).join(" && ");return u.length&&(o.update=`${s} ? {fields: ${a}, values: [${u.join(", ")}]} : null`),delete o.value,delete o.on,e}},_J="_toggle",zJ={defined:t=>"point"===t.type&&!ZJ(t)&&!!t.toggle,signals:(t,n,e)=>e.concat({name:n.name+_J,value:!1,on:[{events:n.events,update:n.toggle}]}),modifyExpr:(t,n)=>{const e=n.name+GJ,r=n.name+_J;return`${r} ? null : ${e}, ${"global"===n.resolve?`${r} ? null : true, `:`${r} ? null : {unit: ${JJ(t)}}, `}${r} ? ${e} : null`}},BJ={defined:t=>void 0!==t.clear&&!1!==t.clear&&!ZJ(t),parse:(t,n)=>{n.clear&&(n.clear=$t(n.clear)?eB(n.clear,"view"):n.clear)},topLevelSignals:(t,n,e)=>{if(OJ.defined(n))for(const t of n.project.items){const r=e.findIndex((e=>e.name===kR(`${n.name}_${t.field}`)));-1!==r&&e[r].on.push({events:n.clear,update:"null"})}return e},signals:(t,n,e)=>{function r(t,r){-1!==t&&e[t].on&&e[t].on.push({events:n.clear,update:r})}if("interval"===n.type)for(const t of n.project.items){const n=e.findIndex((n=>n.name===t.signals.visual));r(n,"[0, 0]"),-1===n&&r(e.findIndex((n=>n.name===t.signals.data)),"null")}else{let t=e.findIndex((t=>t.name===n.name+GJ));r(t,"null"),zJ.defined(n)&&(t=e.findIndex((t=>t.name===n.name+_J)),r(t,"false"))}return e}},TJ={defined:t=>{const n="global"===t.resolve&&t.bind&&kY(t.bind),e=1===t.project.items.length&&t.project.items[0].field!==xY;return n&&!e&&vU("Legend bindings are only supported for selections over an individual field or encoding channel."),n&&e},parse:(t,n,e)=>{const r=eR(e);if(r.select=$t(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},QJ(n,r),F(e.select)&&(e.select.on||e.select.clear)){const t='event.item && indexof(event.item.mark.role, "legend") < 0';for(const e of n.events)e.filter=Q(e.filter??[]),e.filter.includes(t)||e.filter.push(t)}const i=MY(n.bind)?n.bind.legend:"click",o=$t(i)?eB(i,"view"):Q(i);n.bind={legend:{merge:o}}},topLevelSignals:(t,n,e)=>{const r=n.name,i=MY(n.bind)&&n.bind.legend,o=t=>n=>{const e=eR(n);return e.markname=t,e};for(const t of n.project.items){if(!t.hasLegend)continue;const a=`${kR(t.field)}_legend`,u=`${r}_${a}`;if(0===e.filter((t=>t.name===u)).length){const t=i.merge.map(o(`${a}_symbols`)).concat(i.merge.map(o(`${a}_labels`))).concat(i.merge.map(o(`${a}_entries`)));e.unshift({name:u,...n.init?{}:{value:null},on:[{events:t,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return e},signals:(t,n,e)=>{const r=n.name,i=n.project,o=e.find((t=>t.name===r+GJ)),a=r+MX,u=i.items.filter((t=>t.hasLegend)).map((t=>kR(`${r}_${kR(t.field)}_legend`))),s=`${u.map((t=>`${t} !== null`)).join(" && ")} ? {fields: ${a}, values: [${u.join(", ")}]} : null`;n.events&&u.length>0?o.on.push({events:u.map((t=>({signal:t}))),update:s}):u.length>0&&(o.update=s,delete o.value,delete o.on);const c=e.find((t=>t.name===r+_J)),l=MY(n.bind)&&n.bind.legend;return c&&(n.events?c.on.push({...c.on[0],events:l}):c.on[0].events=l),e}},PJ="_translate_anchor",jJ="_translate_delta",RJ={defined:t=>"interval"===t.type&&t.translate,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+PJ,{x:a,y:u}=n.project.hasChannel;let s=eB(n.translate,"scope");return i||(s=s.map((t=>(t.between[0].markname=r+GX,t)))),e.push({name:o,value:{},on:[{events:s.map((t=>t.between[0])),update:`{x: x(unit), y: y(unit)${void 0!==a?`, extent_x: ${i?WX(t,JR):`slice(${a.signals.visual})`}`:""}${void 0!==u?`, extent_y: ${i?WX(t,KR):`slice(${u.signals.visual})`}`:""}}`}]},{name:r+jJ,value:{},on:[{events:s,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),void 0!==a&&LJ(t,n,a,"width",e),void 0!==u&&LJ(t,n,u,"height",e),e}};function LJ(t,n,e,r,i){const o=n.name,a=o+PJ,u=o+jJ,s=e.channel,c=UX.defined(n),l=i.find((t=>t.name===e.signals[c?"data":"visual"])),f=t.getSizeSignalRef(r).signal,d=t.getScaleComponent(s),h=d?.get("type"),m=d?.get("reverse"),p=`${a}.extent_${s}`,g=`${c&&d?"log"===h?"panLog":"symlog"===h?"panSymlog":"pow"===h?"panPow":"panLinear":"panLinear"}(${p}, ${c?s===JR?m?"":"-":m?"-":"":""}${u}.${s} / ${c?`${f}`:`span(${p})`}${c?"pow"===h?`, ${d.get("exponent")??1}`:"symlog"===h?`, ${d.get("constant")??1}`:"":""})`;l.on.push({events:{signal:u},update:c?g:`clampRange(${g}, 0, ${f})`})}const IJ="_zoom_anchor",qJ="_zoom_delta",UJ={defined:t=>"interval"===t.type&&t.zoom,signals:(t,n,e)=>{const r=n.name,i=UX.defined(n),o=r+qJ,{x:a,y:u}=n.project.hasChannel,s=Nt(t.scaleName(JR)),c=Nt(t.scaleName(KR));let l=eB(n.zoom,"scope");return i||(l=l.map((t=>(t.markname=r+GX,t)))),e.push({name:r+IJ,on:[{events:l,update:i?`{${[s?`x: invert(${s}, x(unit))`:"",c?`y: invert(${c}, y(unit))`:""].filter((t=>t)).join(", ")}}`:"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:l,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==a&&WJ(t,n,a,"width",e),void 0!==u&&WJ(t,n,u,"height",e),e}};function WJ(t,n,e,r,i){const o=n.name,a=e.channel,u=UX.defined(n),s=i.find((t=>t.name===e.signals[u?"data":"visual"])),c=t.getSizeSignalRef(r).signal,l=t.getScaleComponent(a),f=l?.get("type"),d=u?WX(t,a):s.name,h=o+qJ,m=`${u&&l?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${o}${IJ}.${a}, ${h}${u?"pow"===f?`, ${l.get("exponent")??1}`:"symlog"===f?`, ${l.get("constant")??1}`:"":""})`;s.on.push({events:{signal:h},update:u?m:`clampRange(${m}, 0, ${c})`})}const HJ="_store",GJ="_tuple",YJ="_modify",VJ="vlSelectionResolve",XJ=[TX,JX,DX,zJ,OJ,UX,TJ,BJ,RJ,UJ,CJ];function JJ(t,{escape:n}={escape:!0}){let e=n?Nt(t.name):t.name;const r=function(t){let n=t.parent;for(;n&&!SZ(n);)n=n.parent;return n}(t);if(r){const{facet:t}=r;for(const n of RL)t[n]&&(e+=` + '__facet_${n}_' + (facet[${Nt(r.vgField(n))}])`)}return e}function KJ(t){return wR(t.component.selection??{}).reduce(((t,n)=>t||n.project.hasSelectionId),!1)}function QJ(t,n){!$t(n.select)&&n.select.on||delete t.events,!$t(n.select)&&n.select.clear||delete t.clear,!$t(n.select)&&n.select.toggle||delete t.toggle}function ZJ(t){return t.events?.find((t=>"type"in t&&"timer"===t.type))}function tK(t){const n=[];return"Identifier"===t.type?[t.name]:"Literal"===t.type?[t.value]:("MemberExpression"===t.type&&(n.push(...tK(t.object)),n.push(...tK(t.property))),n)}function nK(t){return"MemberExpression"===t.object.type?nK(t.object):"datum"===t.object.name}function eK(t){const n=GO(t),e=new Set;return n.visit((t=>{"MemberExpression"===t.type&&nK(t)&&e.add(tK(t).slice(1).join("."))})),e}class rK extends mX{model;filter;expr;_dependentFields;clone(){return new rK(null,this.model,eR(this.filter))}constructor(t,n,e){super(t),this.model=n,this.filter=e,this.expr=aK(this.model,this.filter,this),this._dependentFields=eK(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function iK(t,n,e,r="datum"){const i=$t(n)?n:n.param,o=kR(i),a=Nt(o+HJ);let u;try{u=t.getSelectionComponent(o,i)}catch{return`!!${o}`}if(u.project.timeUnit){const n=e??t.component.data.raw,r=u.project.timeUnit.clone();n.parent?r.insertAsParentOf(n):n.parent=r}const s=`${u.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${a}, ${r}${"global"===u.resolve?")":`, ${Nt(u.resolve)})`}`,c=`length(data(${a}))`;return!1===n.empty?`${c} && ${s}`:`!${c} || ${s}`}function oK(t,n,e){const r=kR(n),i=e.encoding;let o,a=e.field;try{o=t.getSelectionComponent(r,n)}catch{return r}if(i||a){if(i&&!a){const t=o.project.items.filter((t=>t.channel===i));!t.length||t.length>1?(a=o.project.items[0].field,vU(function(t,n,e,r){return`${t.length?"Multiple ":"No "}matching ${Nt(n)} encoding found for selection ${Nt(e.param)}. Using "field": ${Nt(r)}.`}(t,i,e,a))):a=t[0].field}}else a=o.project.items[0].field,o.project.items.length>1&&vU(function(t){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${Nt(t)}.`}(a));return`${o.name}[${Nt(OR(a))}]`}function aK(t,n,e){return MR(n,(n=>$t(n)?n:function(t){return GR(t,"param")}(n)?iK(t,n,e):VU(n)))}function uK(t,n,e,r){t.encode??={},t.encode[n]??={},t.encode[n].update??={},t.encode[n].update[e]=r}function sK(t,n,e,r={header:!1}){const{disable:i,orient:o,scale:a,labelExpr:u,title:s,zindex:c,...l}=t.combine();if(!i){for(const t in l){const e=t,r=NG[e],i=l[e];if(r&&r!==n&&"both"!==r)delete l[e];else if(FG(i)){const{condition:t,...n}=i,r=Q(t),o=SG[e];if(o){const{vgProp:t,part:i}=o,a=[...r.map((t=>{const{test:n,...e}=t;return{test:aK(null,n),...e}})),n];uK(l,i,t,a),delete l[e]}else if(null===o){const t={signal:r.map((t=>{const{test:n,...e}=t;return`${aK(null,n)} ? ${Dq(e)} : `})).join("")+Dq(n)};l[e]=t}}else if(pq(i)){const t=SG[e];if(t){const{vgProp:n,part:r}=t;uK(l,r,n,i),delete l[e]}}sR(["labelAlign","labelBaseline"],e)&&null===l[e]&&delete l[e]}if("grid"===n){if(!l.grid)return;if(l.encode){const{grid:t}=l.encode;l.encode={...t?{grid:t}:{}},yR(l.encode)&&delete l.encode}return{scale:a,orient:o,...l,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:TR(c,0)}}{if(!r.header&&t.mainExtracted)return;if(void 0!==u){let t=u;l.encode?.labels?.update&&pq(l.encode.labels.update.text)&&(t=_R(u,"datum.label",l.encode.labels.update.text.signal)),uK(l,"labels","text",{signal:t})}if(null===l.labelAlign&&delete l.labelAlign,l.encode){for(const n of EG)t.hasAxisPart(n)||delete l.encode[n];yR(l.encode)&&delete l.encode}const n=function(t,n){if(t)return S(t)&&!mq(t)?t.map((t=>mG(t,n))).join(", "):t}(s,e);return{scale:a,orient:o,grid:!1,...n?{title:n}:{},...l,...!1===e.aria?{aria:!1}:{},zindex:TR(c,0)}}}}function cK(t){const{axes:n}=t.component,e=[];for(const r of MI)if(n[r])for(const i of n[r])if(!i.get("disable")&&!i.get("gridScale")){const n="x"===r?"height":"width",i=t.getSizeSignalRef(n).signal;n!==i&&e.push({name:n,update:i})}return e}function lK(t,n,e,r){return Object.assign.apply(null,[{},...t.map((t=>{if("axisOrient"===t){const t="x"===e?"bottom":"left",i=n["x"===e?"axisBottom":"axisLeft"]||{},o=n["x"===e?"axisTop":"axisRight"]||{},a=new Set([...bR(i),...bR(o)]),u={};for(const n of a.values())u[n]={signal:`${r.signal} === "${t}" ? ${Sq(i[n])} : ${Sq(o[n])}`};return u}return n[t]}))])}function fK(t,n){const e=[{}];for(const r of t){let t=n[r]?.style;if(t){t=Q(t);for(const r of t)e.push(n.style[r])}}return Object.assign.apply(null,e)}function dK(t,n,e,r={}){const i=_q(t,e,n);if(void 0!==i)return{configFrom:"style",configValue:i};for(const n of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==r[n]?.[t])return{configFrom:n,configValue:r[n][t]};return{}}const hK={scale:({model:t,channel:n})=>t.scaleName(n),format:({format:t})=>t,formatType:({formatType:t})=>t,grid:({fieldOrDatumDef:t,axis:n,scaleType:e})=>n.grid??function(t,n){return!bW(t)&&YH(n)&&!aq(n?.bin)&&!uq(n?.bin)}(e,t),gridScale:({model:t,channel:n})=>function(t,n){const e="x"===n?"y":"x";if(t.getScaleComponent(e))return t.scaleName(e)}(t,n),labelAlign:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelAlign||gK(n,e,r),labelAngle:({labelAngle:t})=>t,labelBaseline:({axis:t,labelAngle:n,orient:e,channel:r})=>t.labelBaseline||pK(n,e,r),labelFlush:({axis:t,fieldOrDatumDef:n,channel:e})=>t.labelFlush??function(t,n){if("x"===n&&sR(["quantitative","temporal"],t))return!0}(n.type,e),labelOverlap:({axis:t,fieldOrDatumDef:n,scaleType:e})=>t.labelOverlap??function(t,n,e,r){if(e&&!F(r)||"nominal"!==t&&"ordinal"!==t)return"log"!==n&&"symlog"!==n||"greedy"}(n.type,e,YH(n)&&!!n.timeUnit,YH(n)?n.sort:void 0),orient:({orient:t})=>t,tickCount:({channel:t,model:n,axis:e,fieldOrDatumDef:r,scaleType:i})=>{const o="x"===t?"width":"y"===t?"height":void 0,a=o?n.getSizeSignalRef(o):void 0;return e.tickCount??function({fieldOrDatumDef:t,scaleType:n,size:e,values:r}){if(!r&&!bW(n)&&"log"!==n){if(YH(t)){if(aq(t.bin))return{signal:`ceil(${e.signal}/10)`};if(t.timeUnit&&sR(["month","hours","day","quarter"],BU(t.timeUnit)?.unit))return}return{signal:`ceil(${e.signal}/40)`}}}({fieldOrDatumDef:r,scaleType:i,size:a,values:e.values})},tickMinStep:({axis:t,format:n,fieldOrDatumDef:e})=>t.tickMinStep??function({format:t,fieldOrDatumDef:n}){if("d"===t)return 1;if(YH(n)){const{timeUnit:t}=n;if(t){const n=TU(t);if(n)return{signal:n}}}}({format:n,fieldOrDatumDef:e}),title:({axis:t,model:n,channel:e})=>{if(void 0!==t.title)return t.title;const r=vK(n,e);if(void 0!==r)return r;const i=n.typedFieldDef(e),o=n.fieldDef("x"===e?"x2":"y2");return Bq(i?[jH(i)]:[],YH(o)?[jH(o)]:[])},values:({axis:t,fieldOrDatumDef:n})=>function(t,n){const e=t.values;return S(e)?AG(n,e):pq(e)?e:void 0}(t,n),zindex:({axis:t,fieldOrDatumDef:n,mark:e})=>t.zindex??function(t,n){return"rect"===t&&sG(n)?1:0}(e,n)};function mK(t){return`(((${t.signal} % 360) + 360) % 360)`}function pK(t,n,e,r){if(void 0!==t){if("x"===e){if(pq(t)){const e=mK(t);return{signal:`(45 < ${e} && ${e} < 135) || (225 < ${e} && ${e} < 315) ? "middle" :(${e} <= 45 || 315 <= ${e}) === ${pq(n)?`(${n.signal} === "top")`:"top"===n} ? "bottom" : "top"`}}return 45<t&&t<135||225<t&&t<315?"middle":pq(n)?{signal:`${n.signal} ${t<=45||315<=t?"===":"!=="} "top" ? "bottom" : "top"`}:(t<=45||315<=t)==("top"===n)?"bottom":"top"}if(pq(t)){const e=mK(t);return{signal:`${e} <= 45 || 315 <= ${e} || (135 <= ${e} && ${e} <= 225) ? ${r?'"middle"':"null"} : (45 <= ${e} && ${e} <= 135) === ${pq(n)?`(${n.signal} === "left")`:"left"===n} ? "top" : "bottom"`}}return t<=45||315<=t||135<=t&&t<=225?r?"middle":null:pq(n)?{signal:`${n.signal} ${45<=t&&t<=135?"===":"!=="} "left" ? "top" : "bottom"`}:(45<=t&&t<=135)==("left"===n)?"top":"bottom"}}function gK(t,n,e){if(void 0===t)return;const r="x"===e,i=r?0:90,o=r?"bottom":"left";if(pq(t)){const e=mK(t);return{signal:`(${i?`(${e} + 90)`:e} % 180 === 0) ? ${r?null:'"center"'} :(${i} < ${e} && ${e} < ${180+i}) === ${pq(n)?`(${n.signal} === "${o}")`:n===o} ? "left" : "right"`}}return(t+i)%180==0?r?null:"center":pq(n)?{signal:`${n.signal} ${i<t&&t<180+i?"===":"!=="} "${o}" ? "left" : "right"`}:(i<t&&t<180+i)==(n===o)?"left":"right"}function vK(t,n){const e="x"===n?"x2":"y2",r=t.fieldDef(n),i=t.fieldDef(e),o=r?r.title:void 0,a=i?i.title:void 0;return o&&a?Tq(o,a):o||a||(void 0!==o?o:void 0!==a?a:void 0)}class yK extends mX{transform;_dependentFields;clone(){return new yK(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this._dependentFields=eK(this.transform.calculate)}static parseAllForSortIndex(t,n){return n.forEachFieldDef(((n,e)=>{if(eG(n)&&zH(n.sort)){const{field:r,timeUnit:i}=n,o=n.sort,a=o.map(((t,n)=>`${VU({field:r,timeUnit:i,equal:t})} ? ${n} : `)).join("")+o.length;t=new yK(t,{calculate:a,as:bK(n,e,{forAs:!0})})}})),t}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 ${aR(this.transform)}`}}function bK(t,n,e){return uG(t,{prefix:n,suffix:"sort_index",...e})}function wK(t,n){return sR(["top","bottom"],n)?"column":sR(["left","right"],n)||"row"===t?"row":"column"}function xK(t,n,e,r){return TR((n||{})[t],("row"===r?e.headerRow:"column"===r?e.headerColumn:e.headerFacet)[t],e.header[t])}function $K(t,n,e,r){const i={};for(const o of t){const t=xK(o,n||{},e,r);void 0!==t&&(i[o]=t)}return i}const kK=["row","column"],MK=["header","footer"];function AK(t,n){const e=t.component.layoutHeaders[n].title,r=t.config?t.config:void 0,i=t.component.layoutHeaders[n].facetFieldDef?t.component.layoutHeaders[n].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:u}=$K(["titleAnchor","titleAngle","titleOrient"],i.header,r,n),s=wK(n,u),c=IR(a);return{name:`${n}-title`,type:"group",role:`${s}-title`,title:{text:e,..."row"===n?{orient:"left"}:{},style:"guide-title",...SK(c,s),...DK(s,c,o),...zK(r,i,n,vY,pY)}}}function DK(t,n,e="middle"){switch(e){case"start":return{align:"left"};case"end":return{align:"right"}}const r=gK(n,"row"===t?"left":"top","row"===t?"y":"x");return r?{align:r}:{}}function SK(t,n){const e=pK(t,"row"===n?"left":"top","row"===n?"y":"x",!0);return e?{baseline:e}:{}}function FK(t,n){const e=t.component.layoutHeaders[n],r=[];for(const i of MK)if(e[i])for(const o of e[i]){const a=CK(t,n,i,e,o);null!=a&&r.push(a)}return r}function EK(t,n){const{sort:e}=t;return _H(e)?{field:uG(e,{expr:"datum"}),order:e.order??"ascending"}:S(e)?{field:bK(t,n,{expr:"datum"}),order:"ascending"}:{field:uG(t,{expr:"datum"}),order:e??"ascending"}}function NK(t,n,e){const{format:r,formatType:i,labelAngle:o,labelAnchor:a,labelOrient:u,labelExpr:s}=$K(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],t.header,e,n),c=xH({fieldOrDatumDef:t,format:r,formatType:i,expr:"parent",config:e}).signal,l=wK(n,u);return{text:{signal:s?_R(_R(s,"datum.label",c),"datum.value",uG(t,{expr:"parent"})):c},..."row"===n?{orient:"left"}:{},style:"guide-label",frame:"group",...SK(o,l),...DK(l,o,a),...zK(e,t,n,yY,gY)}}function CK(t,n,e,r,i){if(i){let o=null;const{facetFieldDef:a}=r,u=t.config?t.config:void 0;if(a&&i.labels){const{labelOrient:t}=$K(["labelOrient"],a.header,u,n);("row"===n&&!sR(["top","bottom"],t)||"column"===n&&!sR(["left","right"],t))&&(o=NK(a,n,u))}const s=SZ(t)&&!BH(t.facet),c=i.axes,l=c?.length>0;if(o||l){const u="row"===n?"height":"width";return{name:t.getName(`${n}_${e}`),type:"group",role:`${n}-${e}`,...r.facetFieldDef?{from:{data:t.getName(`${n}_domain`)},sort:EK(a,n)}:{},...l&&s?{from:{data:t.getName(`facet_domain_${n}`)}}:{},...o?{title:o}:{},...i.sizeSignal?{encode:{update:{[u]:i.sizeSignal}}}:{},...l?{axes:c}:{}}}}return null}const OK={column:{start:0,end:1},row:{start:1,end:0}};function _K(t,n){return OK[n][t]}function zK(t,n,e,r,i){const o={};for(const a of r){if(!i[a])continue;const r=xK(a,n?.header,t,e);void 0!==r&&(o[i[a]]=r)}return o}function BK(t){return[...TK(t,"width"),...TK(t,"height"),...TK(t,"childWidth"),...TK(t,"childHeight")]}function TK(t,n){const e="width"===n?"x":"y",r=t.component.layoutSize.get(n);if(null==r||"merged"===r)return[];const i=t.getSizeSignalRef(n).signal;if("step"===r){const n=t.getScaleComponent(e);if(n){const r=n.get("type"),o=n.get("range");if(bW(r)&&gq(o)){const r=t.scaleName(e);return SZ(t.parent)&&"independent"===t.parent.component.resolve.scale[e]?[PK(r,o)]:[PK(r,o),{name:i,update:jK(r,n,`domain('${r}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==r){const n=i.endsWith("width"),e=n?"containerSize()[0]":"containerSize()[1]",r=`isFinite(${e}) ? ${e} : ${zY(t.config.view,n?"width":"height")}`;return[{name:i,init:r,on:[{update:r,events:"window:resize"}]}]}return[{name:i,value:r}]}function PK(t,n){const e=`${t}_step`;return pq(n.step)?{name:e,update:n.step.signal}:{name:e,value:n.step}}function jK(t,n,e){const r=n.get("type"),i=n.get("padding"),o=TR(n.get("paddingOuter"),i);let a=n.get("paddingInner");return a="band"===r?void 0!==a?a:i:1,`bandspace(${e}, ${Sq(a)}, ${Sq(o)}) * ${t}_step`}function RK(t){return"childWidth"===t?"width":"childHeight"===t?"height":t}function LK(t,n){return bR(t).reduce(((e,r)=>({...e,...KX({model:n,channelDef:t[r],vgChannel:r,mainRefFn:t=>Mq(t.value),invalidValueRef:void 0})})),{})}function IK(t,n){if(SZ(n))return"theta"===t?"independent":"shared";if(EZ(n))return"shared";if(FZ(n))return AI(t)||"theta"===t||"radius"===t?"independent":"shared";throw new Error("invalid model type for resolve")}function qK(t,n){const e=t.scale[n],r=AI(n)?"axis":"legend";return"independent"===e?("shared"===t[r][n]&&vU(function(t){return`Setting the scale to be independent for "${t}" means we also have to set the guide (axis or legend) to be independent.`}(n)),"independent"):t[r][n]||"shared"}const UK=bR({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 WK extends QV{}const HK={symbols:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i,legendType:o}){if("symbol"!==o)return;const{markDef:a,encoding:u,config:s,mark:c}=e,l=a.filled&&"trail"!==c;let f={...Fq({},e,ZW),...sJ(e,{filled:l})};const d=i.get("symbolOpacity")??s.legend.symbolOpacity,h=i.get("symbolFillColor")??s.legend.symbolFillColor,m=i.get("symbolStrokeColor")??s.legend.symbolStrokeColor,p=void 0===d?GK(u.opacity)??a.opacity:void 0;if(f.fill)if("fill"===r||l&&r===fL)delete f.fill;else if(GR(f.fill,"field"))h?delete f.fill:(f.fill=Mq(s.legend.symbolBaseFillColor??"black"),f.fillOpacity=Mq(p??1));else if(S(f.fill)){const t=YK(u.fill??u.color)??a.fill??(l&&a.color);t&&(f.fill=Mq(t))}if(f.stroke)if("stroke"===r||!l&&r===fL)delete f.stroke;else if(GR(f.stroke,"field")||m)delete f.stroke;else if(S(f.stroke)){const t=TR(YK(u.stroke||u.color),a.stroke,l?a.color:void 0);t&&(f.stroke={value:t})}if(r!==vL){const t=YH(n)&&XK(0,i,n);t?f.opacity=[{test:t,...Mq(p??1)},Mq(s.legend.unselectedOpacity)]:p&&(f.opacity=Mq(p))}return f={...f,...t},yR(f)?void 0:f},gradient:function(t,{model:n,legendType:e,legendCmpt:r}){if("gradient"!==e)return;const{config:i,markDef:o,encoding:a}=n;let u={};const s=void 0===(r.get("gradientOpacity")??i.legend.gradientOpacity)?GK(a.opacity)||o.opacity:void 0;return s&&(u.opacity=Mq(s)),u={...u,...t},yR(u)?void 0:u},labels:function(t,{fieldOrDatumDef:n,model:e,channel:r,legendCmpt:i}){const o=e.legend(r)||{},a=e.config,u=YH(n)?XK(0,i,n):void 0,s=u?[{test:u,value:1},{value:a.legend.unselectedOpacity}]:void 0,{format:c,formatType:l}=o;let f;bH(l)?f=kH({fieldOrDatumDef:n,field:"datum.value",format:c,formatType:l,config:a}):void 0===c&&void 0===l&&a.customFormatTypes&&("quantitative"===n.type&&a.numberFormatType?f=kH({fieldOrDatumDef:n,field:"datum.value",format:a.numberFormat,formatType:a.numberFormatType,config:a}):"temporal"===n.type&&a.timeFormatType&&YH(n)&&void 0===n.timeUnit&&(f=kH({fieldOrDatumDef:n,field:"datum.value",format:a.timeFormat,formatType:a.timeFormatType,config:a})));const d={...s?{opacity:s}:{},...f?{text:f}:{},...t};return yR(d)?void 0:d},entries:function(t,{legendCmpt:n}){const e=n.get("selections");return e?.length?{...t,fill:{value:"transparent"}}:t}};function GK(t){return VK(t,((t,n)=>Math.max(t,n.value)))}function YK(t){return VK(t,((t,n)=>TR(t,n.value)))}function VK(t,n){return function(t){const n=t?.condition;return!!n&&(S(n)||nG(n))}(t)?Q(t.condition).reduce(n,t.value):nG(t)?t.value:void 0}function XK(t,n,e){const r=n.get("selections");if(!r?.length)return;const i=Nt(e.field);return r.map((t=>`(!length(data(${Nt(kR(t)+HJ)})) || (${t}[${i}] && indexof(${t}[${i}], datum.value) >= 0))`)).join(" || ")}const JK={direction:({direction:t})=>t,format:({fieldOrDatumDef:t,legend:n,config:e})=>{const{format:r,formatType:i}=n;return MH(t,t.type,r,i,e,!1)},formatType:({legend:t,fieldOrDatumDef:n,scaleType:e})=>{const{formatType:r}=t;return AH(r,n,e)},gradientLength:t=>{const{legend:n,legendConfig:e}=t;return n.gradientLength??e.gradientLength??function({legendConfig:t,model:n,direction:e,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:a,gradientVerticalMaxLength:u,gradientVerticalMinLength:s}=t;if(xW(i))return"horizontal"===e?"top"===r||"bottom"===r?QK(n,"width",a,o):a:QK(n,"height",s,u)}(t)},labelOverlap:({legend:t,legendConfig:n,scaleType:e})=>t.labelOverlap??n.labelOverlap??function(t){if(sR(["quantile","threshold","log","symlog"],t))return"greedy"}(e),symbolType:({legend:t,markDef:n,channel:e,encoding:r})=>t.symbolType??function(t,n,e,r){if("shape"!==n){const t=YK(e)??r;if(t)return t}switch(t){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"}}(n.type,e,r.shape,n.shape),title:({fieldOrDatumDef:t,config:n})=>dG(t,n,{allowDisabling:!0}),type:({legendType:t,scaleType:n,channel:e})=>{if(PL(e)&&xW(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:({fieldOrDatumDef:t,legend:n})=>function(t,n){const e=t.values;return S(e)?AG(n,e):pq(e)?e:void 0}(n,t)};function KK({legendConfig:t,legendType:n,orient:e,legend:r}){return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(t,n){switch(t){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===n?"horizontal":void 0}}(e,n)}function QK(t,n,e,r){return{signal:`clamp(${t.getSizeSignalRef(n).signal}, ${e}, ${r})`}}function ZK(t){const n=DZ(t)?function(t){const{encoding:n}=t,e={};for(const r of[fL,...wY]){const i=vG(n[r]);i&&t.getScaleComponent(r)&&(r===mL&&YH(i)&&i.type===rW||(e[r]=nQ(t,r)))}return e}(t):function(t){const{legends:n,resolve:e}=t.component;for(const r of t.children){ZK(r);for(const i of bR(r.component.legends))e.legend[i]=qK(t.component.resolve,i),"shared"===e.legend[i]&&(n[i]=eQ(n[i],r.component.legends[i]),n[i]||(e.legend[i]="independent",delete n[i]))}for(const r of bR(n))for(const n of t.children)n.component.legends[r]&&"shared"===e.legend[r]&&delete n.component.legends[r];return n}(t);return t.component.legends=n,n}function tQ(t,n,e,r){switch(n){case"disable":return void 0!==e;case"values":return!!e?.values;case"title":if("title"===n&&t===r?.title)return!0}return t===(e||{})[n]}function nQ(t,n){let e=t.legend(n);const{markDef:r,encoding:i,config:o}=t,a=o.legend,u=new WK({},function(t,n){const e=t.scaleName(n);if("trail"===t.mark){if("color"===n)return{stroke:e};if("size"===n)return{strokeWidth:e}}return"color"===n?t.markDef.filled?{fill:e}:{stroke:e}:{[n]:e}}(t,n));!function(t,n,e){const r=t.fieldDef(n)?.field;for(const i of wR(t.component.selection??{})){const t=i.project.hasField[r]??i.project.hasChannel[n];if(t&&TJ.defined(i)){const n=e.get("selections")??[];n.push(i.name),e.set("selections",n,!1),t.hasLegend=!0}}}(t,n,u);const s=void 0!==e?!e:a.disable;if(u.set("disable",s,void 0!==e),s)return u;e=e||{};const c=t.getScaleComponent(n).get("type"),l=vG(i[n]),f=YH(l)?BU(l.timeUnit)?.unit:void 0,d=e.orient||o.legend.orient||"right",h=function(t){const{legend:n}=t;return TR(n.type,function({channel:t,timeUnit:n,scaleType:e}){if(PL(t)){if(sR(["quarter","month","day"],n))return"symbol";if(xW(e))return"gradient"}return"symbol"}(t))}({legend:e,channel:n,timeUnit:f,scaleType:c}),m={legend:e,channel:n,model:t,markDef:r,encoding:i,fieldOrDatumDef:l,legendConfig:a,config:o,scaleType:c,orient:d,legendType:h,direction:KK({legend:e,legendType:h,orient:d,legendConfig:a})};for(const r of UK){if("gradient"===h&&r.startsWith("symbol")||"symbol"===h&&r.startsWith("gradient"))continue;const i=r in JK?JK[r](m):e[r];if(void 0!==i){const a=tQ(i,r,e,t.fieldDef(n));(a||void 0===o.legend[r])&&u.set(r,i,a)}}const p=e?.encoding??{},g=u.get("selections"),v={},y={fieldOrDatumDef:l,model:t,channel:n,legendCmpt:u,legendType:h};for(const n of["labels","legend","title","symbols","gradient","entries"]){const e=LK(p[n]??{},t),r=n in HK?HK[n](e,y):e;void 0===r||yR(r)||(v[n]={...g?.length&&YH(l)?{name:`${kR(l.field)}_legend_${n}`}:{},...g?.length?{interactive:!0}:{},update:g?.length?{...r,cursor:{value:"pointer"}}:r})}return yR(v)||u.set("encode",v,!!e?.encoding),u}function eQ(t,n){if(!t)return n.clone();const e=t.getWithExplicit("orient"),r=n.getWithExplicit("orient");if(e.explicit&&r.explicit&&e.value!==r.value)return;let i=!1;for(const e of UK){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"legend",((t,n)=>{switch(e){case"symbolType":return r=t,"circle"===(o=n).value?o:r;case"title":return Pq(t,n);case"type":return i=!0,tX("symbol")}var r,o;return eX(t,n,e,"legend")}));t.setWithExplicit(e,r)}return i&&(t.implicit?.encode?.gradient&&AR(t.implicit,["encode","gradient"]),t.explicit?.encode?.gradient&&AR(t.explicit,["encode","gradient"])),t}function rQ(t){const n=t.component.legends,e={};for(const r of bR(n)){const i=HR(t.getScaleComponent(r).get("domains"));if(e[i])for(const t of e[i])eQ(t,n[r])||e[i].push(n[r]);else e[i]=[n[r].clone()]}const r=wR(e).flat().map((n=>function(t,n){const{disable:e,labelExpr:r,selections:i,...o}=t.combine();if(!e){if(!1===n.aria&&null==o.aria&&(o.aria=!1),o.encode?.symbols){const t=o.encode.symbols.update;!t.fill||"transparent"===t.fill.value||t.stroke||o.stroke||(t.stroke={value:"transparent"});for(const n of wY)o[n]&&delete t[n]}if(o.title||delete o.title,void 0!==r){let t=r;o.encode?.labels?.update&&pq(o.encode.labels.update.text)&&(t=_R(r,"datum.label",o.encode.labels.update.text.signal)),function(t,n,e,r){t.encode??={},t.encode[n]??={},t.encode[n].update??={},t.encode[n].update.text=r}(o,"labels",0,{signal:t})}return o}}(n,t.config))).filter((t=>void 0!==t));return r}function iQ(t){const n=t.component.projection;if(!n||n.merged)return[];const e=n.combine(),{name:r}=e;if(n.data){const i={signal:`[${n.size.map((t=>t.signal)).join(", ")}]`},o=n.data.reduce(((n,e)=>{const r=pq(e)?e.signal:`data('${t.lookupDataSource(e)}')`;return sR(n,r)||n.push(r),n}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...e}]}return[{name:r,translate:{signal:"[width / 2, height / 2]"},...e}]}const oQ=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class aQ extends QV{specifiedProjection;size;data;merged=!1;constructor(t,n,e,r){super({...n},{name:t}),this.specifiedProjection=n,this.size=e,this.data=r}get isFit(){return!!this.data}}function uQ(t){t.component.projection=DZ(t)?function(t){if(t.hasProjection){const n=dq(t.specifiedProjection),e=!(n&&(null!=n.scale||null!=n.translate)),r=e?[t.getSizeSignalRef("width"),t.getSizeSignalRef("height")]:void 0,i=e?function(t){const n=[],{encoding:e}=t;for(const r of[[uL,aL],[cL,sL]])(vG(e[r[0]])||vG(e[r[1]]))&&n.push({signal:t.getName(`geojson_${n.length}`)});return t.channelHasField(mL)&&t.typedFieldDef(mL).type===rW&&n.push({signal:t.getName(`geojson_${n.length}`)}),0===n.length&&n.push(t.requestDataName(dX.Main)),n}(t):void 0,o=new aQ(t.projectionName(!0),{...dq(t.config.projection),...n},r,i);return o.get("type")||o.set("type","equalEarth",!1),o}}(t):function(t){if(0===t.children.length)return;let n;for(const n of t.children)uQ(n);const e=lR(t.children,(t=>{const e=t.component.projection;if(e){if(n){const t=function(t,n){const e=lR(oQ,(e=>!ft(t.explicit,e)&&!ft(n.explicit,e)||!!(ft(t.explicit,e)&&ft(n.explicit,e)&&WR(t.get(e),n.get(e)))));if(WR(t.size,n.size)){if(e)return t;if(WR(t.explicit,{}))return n;if(WR(n.explicit,{}))return t}return null}(n,e);return t&&(n=t),!!t}return n=e,!0}return!0}));if(n&&e){const e=t.projectionName(!0),r=new aQ(e,n.specifiedProjection,n.size,eR(n.data));for(const n of t.children){const t=n.component.projection;t&&(t.isFit&&r.data.push(...n.component.projection.data),n.renameProjection(t.get("name"),e),t.merged=!0)}return r}}(t)}function sQ(t,n,e,r){if(DG(n,e)){const i=DZ(t)?t.axis(e)??t.legend(e)??{}:{},o=uG(n,{expr:"datum"}),a=uG(n,{expr:"datum",binSuffix:"end"});return{formulaAs:uG(n,{binSuffix:"range",forAs:!0}),formula:EH(o,a,i.format,i.formatType,r)}}return{}}function cQ(t,n){return`${oq(t)}_${n}`}function lQ(t,n,e){const r=cQ(xG(e,void 0)??{},n);return t.getName(`${r}_bins`)}function fQ(t,n,e){let r,i;r=function(t){return"as"in t}(t)?$t(t.as)?[t.as,`${t.as}_end`]:[t.as[0],t.as[1]]:[uG(t,{forAs:!0}),uG(t,{binSuffix:"end",forAs:!0})];const o={...xG(n,void 0)},a=cQ(o,t.field),{signal:u,extentSignal:s}=function(t,n){return{signal:t.getName(`${n}_bins`),extentSignal:t.getName(`${n}_extent`)}}(e,a);if(cq(o.extent)){const t=o.extent;i=oK(e,t.param,t),delete o.extent}return{key:a,binComponent:{bin:o,field:t.field,as:[r],...u?{signal:u}:{},...s?{extentSignal:s}:{},...i?{span:i}:{}}}}class dQ extends mX{bins;clone(){return new dQ(null,eR(this.bins))}constructor(t,n){super(t),this.bins=n}static makeFromEncoding(t,n){const e=n.reduceFieldDef(((t,e,r)=>{if(tG(e)&&aq(e.bin)){const{key:i,binComponent:o}=fQ(e,e.bin,n);t[i]={...o,...t[i],...sQ(n,e,r,n.config)}}return t}),{});return yR(e)?null:new dQ(t,e)}static makeFromTransform(t,n,e){const{key:r,binComponent:i}=fQ(n,n.bin,e);return new dQ(t,{[r]:i})}merge(t,n){for(const e of bR(t.bins))e in this.bins?(n(t.bins[e].signal,this.bins[e].signal),this.bins[e].as=hR([...this.bins[e].as,...t.bins[e].as],aR)):this.bins[e]=t.bins[e];for(const n of t.children)t.removeChild(n),n.parent=this;t.remove()}producedFields(){return new Set(wR(this.bins).map((t=>t.as)).flat(2))}dependentFields(){return new Set(wR(this.bins).map((t=>t.field)))}hash(){return`Bin ${aR(this.bins)}`}assemble(){return wR(this.bins).flatMap((t=>{const n=[],[e,...r]=t.as,{extent:i,...o}=t.bin,a={type:"bin",field:OR(t.field),as:e,signal:t.signal,...cq(i)?{extent:null}:{extent:i},...t.span?{span:{signal:`span(${t.span})`}}:{},...o};!i&&t.extentSignal&&(n.push({type:"extent",field:OR(t.field),signal:t.extentSignal}),a.extent={signal:t.extentSignal}),n.push(a);for(const t of r)for(let r=0;r<2;r++)n.push({type:"formula",expr:uG({field:e[r]},{expr:"datum"}),as:t[r]});return t.formula&&n.push({type:"formula",expr:t.formula,as:t.formulaAs}),n}))}}class hQ extends mX{dimensions;measures;clone(){return new hQ(null,new Set(this.dimensions),eR(this.measures))}constructor(t,n,e){super(t),this.dimensions=n,this.measures=e}get groupBy(){return this.dimensions}static makeFromEncoding(t,n){let e=!1;n.forEachFieldDef((t=>{t.aggregate&&(e=!0)}));const r={},i=new Set;return e?(n.forEachFieldDef(((t,e)=>{const{aggregate:o,field:a}=t;if(o)if("count"===o)r["*"]??={},r["*"].count=new Set([uG(t,{forAs:!0})]);else{if(QI(o)||ZI(o)){const t=QI(o)?"argmin":"argmax",n=o[t];r[n]??={},r[n][t]=new Set([uG({op:t,field:n},{forAs:!0})])}else r[a]??={},r[a][o]=new Set([uG(t,{forAs:!0})]);HI(e)&&"unaggregated"===n.scaleDomain(e)&&(r[a]??={},r[a].min=new Set([uG({field:a,aggregate:"min"},{forAs:!0})]),r[a].max=new Set([uG({field:a,aggregate:"max"},{forAs:!0})]))}else!function(t,n,e,r){const i=DZ(r)?r.encoding[nI(n)]:void 0;if(tG(e)&&DZ(r)&&qH(e,i,r.markDef,r.config)){t.add(uG(e,{})),t.add(uG(e,{suffix:"end"}));const{mark:i,markDef:o,config:a}=r,u=LH({fieldDef:e,markDef:o,config:a});JW(i)&&.5!==u&&AI(n)&&(t.add(uG(e,{suffix:bX})),t.add(uG(e,{suffix:wX}))),e.bin&&DG(e,n)&&t.add(uG(e,{binSuffix:"range"}))}else if(zL(n)){const e=_L(n);t.add(r.getName(e))}else t.add(uG(e));eG(e)&&function(t){return F(t)&&"field"in t}(e.scale?.range)&&t.add(e.scale.range.field)}(i,e,t,n)})),i.size+bR(r).length===0?null:new hQ(t,i,r)):null}static makeFromTransform(t,n){const e=new Set,r={};for(const t of n.aggregate){const{op:n,field:e,as:i}=t;n&&("count"===n?(r["*"]??={},r["*"].count=new Set([i||uG(t,{forAs:!0})])):(r[e]??={},r[e][n]??=new Set,r[e][n].add(i||uG(t,{forAs:!0}))))}for(const t of n.groupby??[])e.add(t);return e.size+bR(r).length===0?null:new hQ(t,e,r)}merge(t){return mR(this.dimensions,t.dimensions)?(function(t,n){for(const e of bR(n)){const r=n[e];for(const n of bR(r))e in t?t[e][n]=new Set([...t[e][n]??[],...r[n]]):t[e]={[n]:r[n]}}}(this.measures,t.measures),!0):(pU.debug("different dimensions, cannot merge"),!1)}addDimensions(t){t.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...bR(this.measures)])}producedFields(){const t=new Set;for(const n of bR(this.measures))for(const e of bR(this.measures[n])){const r=this.measures[n][e];0===r.size?t.add(`${e}_${n}`):r.forEach(t.add,t)}return t}hash(){return`Aggregate ${aR({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const t=[],n=[],e=[];for(const r of bR(this.measures))for(const i of bR(this.measures[r]))for(const o of this.measures[r][i])e.push(o),t.push(i),n.push("*"===r?null:OR(r));return{type:"aggregate",groupby:[...this.dimensions].map(OR),ops:t,fields:n,as:e}}}class mQ extends mX{model;name;data;column;row;facet;childModel;constructor(t,n,e,r){super(t),this.model=n,this.name=e,this.data=r;for(const t of RL){const e=n.facet[t];if(e){const{bin:r,sort:i}=e;this[t]={name:n.getName(`${t}_domain`),fields:[uG(e),...aq(r)?[uG(e,{binSuffix:"end"})]:[]],..._H(i)?{sortField:i}:S(i)?{sortIndexField:bK(e,t)}:{}}}}this.childModel=n.child}hash(){let t="Facet";for(const n of RL)this[n]&&(t+=` ${n.charAt(0)}:${aR(this[n])}`);return t}get fields(){const t=[];for(const n of RL)this[n]?.fields&&t.push(...this[n].fields);return t}dependentFields(){const t=new Set(this.fields);for(const n of RL)this[n]&&(this[n].sortField&&t.add(this[n].sortField.field),this[n].sortIndexField&&t.add(this[n].sortIndexField));return t}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const t={};for(const n of MI){const e=this.childModel.component.scales[n];if(e&&!e.merged){const r=e.get("type"),i=e.get("range");if(bW(r)&&gq(i)){const e=rZ(iZ(this.childModel,n));e?t[n]=e:vU(qq(n))}}}return t}assembleRowColumnHeaderData(t,n,e){const r={row:"y",column:"x",facet:void 0}[t],i=[],o=[],a=[];r&&e&&e[r]&&(n?(i.push(`distinct_${e[r]}`),o.push("max")):(i.push(e[r]),o.push("distinct")),a.push(`distinct_${e[r]}`));const{sortField:u,sortIndexField:s}=this[t];if(u){const{op:t=NH,field:n}=u;i.push(n),o.push(t),a.push(uG(u,{forAs:!0}))}else s&&(i.push(s),o.push("max"),a.push(s));return{name:this[t].name,source:n??this.data,transform:[{type:"aggregate",groupby:this[t].fields,...i.length?{fields:i,ops:o,as:a}:{}}]}}assembleFacetHeaderData(t){const{columns:n}=this.model.layout,{layoutHeaders:e}=this.model.component,r=[],i={};for(const t of kK){for(const n of MK){const r=e[t]?.[n]??[];for(const n of r)if(n.axes?.length>0){i[t]=!0;break}}if(i[t]){const e=`length(data("${this.facet.name}"))`;r.push({name:`${this.facet.name}_${t}`,transform:[{type:"sequence",start:0,stop:"row"===t?n?{signal:`ceil(${e} / ${n})`}:1:n?{signal:`min(${e}, ${n})`}:{signal:e}}]})}}const{row:o,column:a}=i;return(o||a)&&r.unshift(this.assembleRowColumnHeaderData("facet",null,t)),r}assemble(){const t=[];let n=null;const e=this.getChildIndependentFieldsWithStep(),{column:r,row:i,facet:o}=this;if(r&&i&&(e.x||e.y)){n=`cross_${this.column.name}_${this.row.name}`;const r=[].concat(e.x??[],e.y??[]),i=r.map((()=>"distinct"));t.push({name:n,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:r,ops:i}]})}for(const r of[VR,YR])this[r]&&t.push(this.assembleRowColumnHeaderData(r,n,e));if(o){const n=this.assembleFacetHeaderData(e);n&&t.push(...n)}return t}}function pQ(t){return t.startsWith("'")&&t.endsWith("'")||t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function gQ(t){const n={};return tR(t.filter,(t=>{if(GU(t)){let e=null;RU(t)?e=$q(t.equal):IU(t)?e=$q(t.lte):LU(t)?e=$q(t.lt):qU(t)?e=$q(t.gt):UU(t)?e=$q(t.gte):WU(t)?e=t.range[0]:HU(t)&&(e=(t.oneOf??t.in)[0]),e&&(yU(e)?n[t.field]="date":wt(e)?n[t.field]="number":$t(e)&&(n[t.field]="string")),t.timeUnit&&(n[t.field]="date")}})),n}class vQ extends mX{_parse;clone(){return new vQ(null,eR(this._parse))}constructor(t,n){super(t),this._parse=n}hash(){return`Parse ${aR(this._parse)}`}static makeExplicit(t,n,e){let r={};const i=n.data;return!sX(i)&&i?.format?.parse&&(r=i.format.parse),this.makeWithAncestors(t,r,{},e)}static makeWithAncestors(t,n,e,r){for(const t of bR(e)){const n=r.getWithExplicit(t);void 0!==n.value&&(n.explicit||n.value===e[t]||"derived"===n.value||"flatten"===e[t]?delete e[t]:vU(Vq(t,e[t],n.value)))}for(const t of bR(n)){const e=r.get(t);void 0!==e&&(e===n[t]?delete n[t]:vU(Vq(t,n[t],e)))}const i=new QV(n,e);r.copyAll(i);const o={};for(const t of bR(i.combine())){const n=i.get(t);null!==n&&(o[t]=n)}return 0===bR(o).length||r.parseNothing?null:new vQ(t,o)}get parse(){return this._parse}merge(t){this._parse={...this._parse,...t.parse},t.remove()}assembleFormatParse(){const t={};for(const n of bR(this._parse)){const e=this._parse[n];1===BR(n)&&(t[n]=e)}return t}producedFields(){return new Set(bR(this._parse))}dependentFields(){return new Set(bR(this._parse))}assembleTransforms(t=!1){return bR(this._parse).filter((n=>!t||BR(n)>1)).map((t=>{const n=function(t,n){const e=SR(t);return"number"===n?`toNumber(${e})`:"boolean"===n?`toBoolean(${e})`:"string"===n?`toString(${e})`:"date"===n?`toDate(${e})`:"flatten"===n?e:n.startsWith("date:")?`timeParse(${e},'${pQ(n.slice(5,n.length))}')`:n.startsWith("utc:")?`utcParse(${e},'${pQ(n.slice(4,n.length))}')`:(vU(`Unrecognized parse "${n}".`),null)}(t,this._parse[t]);return n?{type:"formula",expr:n,as:zR(t)}:null})).filter((t=>null!==t))}}class yQ extends mX{clone(){return new yQ(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([xY])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:xY}}}class bQ extends mX{params;clone(){return new bQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${aR(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class wQ extends mX{params;clone(){return new wQ(null,this.params)}constructor(t,n){super(t),this.params=n}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${aR(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class xQ extends mX{_data;_name;_generator;constructor(t){let n;if(super(null),t??={name:"source"},sX(t)||(n=t.format?{...oR(t.format,["parse"])}:{}),aX(t))this._data={values:t.values};else if(oX(t)){if(this._data={url:t.url},!n.type){let e=/(?:\.([^.]+))?$/.exec(t.url)[1];sR(["json","csv","tsv","dsv","topojson"],e)||(e="json"),n.type=e}}else lX(t)?this._data={values:[{type:"Sphere"}]}:(uX(t)||sX(t))&&(this._data={});this._generator=sX(t),t.name&&(this._name=t.name),n&&!yR(n)&&(this._data.format=n)}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(t){this._name=t}set parent(t){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 $Q(t){return t instanceof xQ||t instanceof bQ||t instanceof wQ}class kQ{#t;constructor(){this.#t=!1}setModified(){this.#t=!0}get modifiedFlag(){return this.#t}}class MQ extends kQ{getNodeDepths(t,n,e){e.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,e);return e}optimize(t){const n=[...this.getNodeDepths(t,0,new Map).entries()].sort(((t,n)=>n[1]-t[1]));for(const t of n)this.run(t[0]);return this.modifiedFlag}}class AQ extends kQ{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class DQ extends AQ{mergeNodes(t,n){const e=n.shift();for(const r of n)t.removeChild(r),r.parent=e,r.remove()}run(t){const n=t.children.map((t=>t.hash())),e={};for(let r=0;r<n.length;r++)void 0===e[n[r]]?e[n[r]]=[t.children[r]]:e[n[r]].push(t.children[r]);for(const n of bR(e))e[n].length>1&&(this.setModified(),this.mergeNodes(t,e[n]))}}class SQ extends AQ{requiresSelectionId;constructor(t){super(),this.requiresSelectionId=t&&KJ(t)}run(t){t instanceof yQ&&(this.requiresSelectionId&&($Q(t.parent)||t.parent instanceof hQ||t.parent instanceof vQ)||(this.setModified(),t.remove()))}}class FQ extends kQ{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let e=new Set;t instanceof yX&&(e=t.producedFields(),pR(e,n)&&(this.setModified(),t.removeFormulas(n),0===t.producedFields.length&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...e]))}}class EQ extends AQ{constructor(){super()}run(t){t instanceof pX&&!t.isRequired()&&(this.setModified(),t.remove())}}class NQ extends MQ{run(t){if(!($Q(t)||t.numChildren()>1))for(const n of t.children)if(n instanceof vQ)if(t instanceof vQ)this.setModified(),t.merge(n);else{if(vR(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}class CQ extends MQ{run(t){const n=[...t.children],e=t.children.filter((t=>t instanceof vQ));if(t.numChildren()>1&&e.length>=1){const r={},i=new Set;for(const t of e){const n=t.parse;for(const t of bR(n))t in r?r[t]!==n[t]&&i.add(t):r[t]=n[t]}for(const t of i)delete r[t];if(!yR(r)){this.setModified();const e=new vQ(t,r);for(const i of n){if(i instanceof vQ)for(const t of bR(r))delete i.parse[t];t.removeChild(i),i.parent=e,i instanceof vQ&&0===bR(i.parse).length&&i.remove()}}}}}class OQ extends MQ{run(t){t instanceof pX||t.numChildren()>0||t instanceof mQ||t instanceof xQ||(this.setModified(),t.remove())}}class _Q extends MQ{run(t){const n=t.children.filter((t=>t instanceof yX)),e=n.pop();for(const t of n)this.setModified(),e.merge(t)}}class zQ extends MQ{run(t){const n=t.children.filter((t=>t instanceof hQ)),e={};for(const t of n){const n=aR(t.groupBy);n in e||(e[n]=[]),e[n].push(t)}for(const n of bR(e)){const r=e[n];if(r.length>1){const n=r.pop();for(const e of r)n.merge(e)&&(t.removeChild(e),e.parent=n,e.remove(),this.setModified())}}}}class BQ extends MQ{model;constructor(t){super(),this.model=t}run(t){const n=!($Q(t)||t instanceof rK||t instanceof vQ||t instanceof yQ),e=[],r=[];for(const i of t.children)i instanceof dQ&&(n&&!vR(t.producedFields(),i.dependentFields())?e.push(i):r.push(i));if(e.length>0){const n=e.pop();for(const t of e)n.merge(t,this.model.renameSignal.bind(this.model));this.setModified(),t instanceof dQ?t.merge(n,this.model.renameSignal.bind(this.model)):n.swapWithParent()}if(r.length>1){const t=r.pop();for(const n of r)t.merge(n,this.model.renameSignal.bind(this.model));this.setModified()}}}class TQ extends MQ{run(t){const n=[...t.children];if(!cR(n,(t=>t instanceof pX))||t.numChildren()<=1)return;const e=[];let r;for(const i of n)if(i instanceof pX){let n=i;for(;1===n.numChildren();){const[t]=n.children;if(!(t instanceof pX))break;n=t}e.push(...n.children),r?(t.removeChild(i),i.parent=r.parent,r.parent.removeChild(r),r.parent=n,this.setModified()):r=n}else e.push(i);if(e.length){this.setModified();for(const t of e)t.parent.removeChild(t),t.parent=r}}}class PQ extends mX{transform;clone(){return new PQ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=hR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return this.transform.groupby&&this.transform.groupby.forEach(t.add,t),this.transform.joinaggregate.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(t){return t.as??uG(t)}hash(){return`JoinAggregateTransform ${aR(this.transform)}`}assemble(){const t=[],n=[],e=[];for(const r of this.transform.joinaggregate)n.push(r.op),e.push(this.getDefaultName(r)),t.push(void 0===r.field?null:r.field);const r=this.transform.groupby;return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==r?{groupby:r}:{}}}}class jQ extends mX{filter;clone(){return new jQ(null,{...this.filter})}constructor(t,n){super(t),this.filter=n}static make(t,n,e){const{config:r,markDef:i}=n,{marks:o,scales:a}=e;if("include-invalid-values"===o&&"include-invalid-values"===a)return null;const u=n.reduceFieldDef(((t,e,o)=>{const a=HI(o)&&n.getScaleComponent(o);if(a){const n=a.get("type"),{aggregate:u}=e,s=lH({scaleChannel:o,markDef:i,config:r,scaleType:n,isCountAggregate:eq(u)});"show"!==s&&"always-valid"!==s&&(t[e.field]=e)}return t}),{});return bR(u).length?new jQ(t,u):null}dependentFields(){return new Set(bR(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${aR(this.filter)}`}assemble(){const t=bR(this.filter).reduce(((t,n)=>{const e=this.filter[n],r=uG(e,{expr:"datum"});return null!==e&&("temporal"===e.type?t.push(`(isDate(${r}) || (${RQ(r)}))`):"quantitative"===e.type&&t.push(RQ(r))),t}),[]);return t.length>0?{type:"filter",expr:t.join(" && ")}:null}}function RQ(t){return`isValid(${t}) && isFinite(+${t})`}class LQ extends mX{_stack;clone(){return new LQ(null,eR(this._stack))}constructor(t,n){super(t),this._stack=n}static makeFromTransform(t,n){const{stack:e,groupby:r,as:i,offset:o="zero"}=n,a=[],u=[];if(void 0!==n.sort)for(const t of n.sort)a.push(t.field),u.push(TR(t.order,"ascending"));const s={field:a,order:u};let c;return c=function(t){return S(t)&&t.every((t=>$t(t)))&&t.length>1}(i)?i:$t(i)?[i,`${i}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new LQ(t,{dimensionFieldDefs:[],stackField:e,groupby:r,offset:o,sort:s,facetby:[],as:c})}static makeFromEncoding(t,n){const e=n.stack,{encoding:r}=n;if(!e)return null;const{groupbyChannels:i,fieldChannel:o,offset:a,impute:u}=e,s=i.map((t=>gG(r[t]))).filter((t=>!!t)),c=function(t){return t.stack.stackBy.reduce(((t,n)=>{const e=uG(n.fieldDef);return e&&t.push(e),t}),[])}(n),l=n.encoding.order;let f;if(S(l)||YH(l))f=zq(l);else{const t=UH(l)?l.sort:"y"===o?"descending":"ascending";f=c.reduce(((n,e)=>(n.field.includes(e)||(n.field.push(e),n.order.push(t)),n)),{field:[],order:[]})}return new LQ(t,{dimensionFieldDefs:s,stackField:n.vgField(o),facetby:[],stackby:c,sort:f,offset:a,impute:u,as:[n.vgField(o,{suffix:"start",forAs:!0}),n.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(t){this._stack.facetby.push(...t)}dependentFields(){const t=new Set;return t.add(this._stack.stackField),this.getGroupbyFields().forEach(t.add,t),this._stack.facetby.forEach(t.add,t),this._stack.sort.field.forEach(t.add,t),t}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${aR(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:t,impute:n,groupby:e}=this._stack;return t.length>0?t.map((t=>t.bin?n?[uG(t,{binSuffix:"mid"})]:[uG(t,{}),uG(t,{binSuffix:"end"})]:[uG(t)])).flat():e??[]}assemble(){const t=[],{facetby:n,dimensionFieldDefs:e,stackField:r,stackby:i,sort:o,offset:a,impute:u,as:s}=this._stack;if(u)for(const o of e){const{bandPosition:e=.5,bin:a}=o;if(a){const n=uG(o,{expr:"datum"}),r=uG(o,{expr:"datum",binSuffix:"end"});t.push({type:"formula",expr:`${RQ(n)} ? ${e}*${n}+${1-e}*${r} : ${n}`,as:uG(o,{binSuffix:"mid",forAs:!0})})}t.push({type:"impute",field:r,groupby:[...i,...n],key:uG(o,{binSuffix:"mid"}),method:"value",value:0})}return t.push({type:"stack",groupby:[...this.getGroupbyFields(),...n],field:r,sort:o,as:s,offset:a}),t}}class IQ extends mX{transform;clone(){return new IQ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=hR(this.transform.groupby.concat(t),(t=>t))}dependentFields(){const t=new Set;return(this.transform.groupby??[]).forEach(t.add,t),(this.transform.sort??[]).forEach((n=>t.add(n.field))),this.transform.window.map((t=>t.field)).filter((t=>void 0!==t)).forEach(t.add,t),t}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(t){return t.as??uG(t)}hash(){return`WindowTransform ${aR(this.transform)}`}assemble(){const t=[],n=[],e=[],r=[];for(const i of this.transform.window)n.push(i.op),e.push(this.getDefaultName(i)),r.push(void 0===i.param?null:i.param),t.push(void 0===i.field?null:i.field);const i=this.transform.frame,o=this.transform.groupby;if(i&&null===i[0]&&null===i[1]&&n.every((t=>tq(t))))return{type:"joinaggregate",as:e,ops:n,fields:t,...void 0!==o?{groupby:o}:{}};const a=[],u=[];if(void 0!==this.transform.sort)for(const t of this.transform.sort)a.push(t.field),u.push(t.order??"ascending");const s=this.transform.ignorePeers;return{type:"window",params:r,as:e,ops:n,fields:t,sort:{field:a,order:u},...void 0!==s?{ignorePeers:s}:{},...void 0!==o?{groupby:o}:{},...void 0!==i?{frame:i}:{}}}}function qQ(t){if(t instanceof mQ)if(1!==t.numChildren()||t.children[0]instanceof pX){const e=t.model.component.data.main;UQ(e);const r=(n=t,function t(e){if(!(e instanceof mQ)){const r=e.clone();if(r instanceof pX){const t=WQ+r.getSource();r.setSource(t),n.model.component.data.outputNodes[t]=r}else(r instanceof hQ||r instanceof LQ||r instanceof IQ||r instanceof PQ)&&r.addDimensions(n.fields);for(const n of e.children.flatMap(t))n.parent=r;return[r]}return e.children.flatMap(t)}),i=t.children.map(r).flat();for(const t of i)t.parent=e}else{const n=t.children[0];(n instanceof hQ||n instanceof LQ||n instanceof IQ||n instanceof PQ)&&n.addDimensions(t.fields),n.swapWithParent(),qQ(t)}else t.children.map(qQ);var n}function UQ(t){if(t instanceof pX&&t.type===dX.Main&&1===t.numChildren()){const n=t.children[0];n instanceof mQ||(n.swapWithParent(),UQ(t))}}const WQ="scale_";function HQ(t){for(const n of t){for(const t of n.children)if(t.parent!==n)return!1;if(!HQ(n.children))return!1}return!0}function GQ(t,n){let e=!1;for(const r of n)e=t.optimize(r)||e;return e}function YQ(t,n,e){let r=t.sources,i=!1;return i=GQ(new EQ,r)||i,i=GQ(new SQ(n),r)||i,r=r.filter((t=>t.numChildren()>0)),i=GQ(new OQ,r)||i,r=r.filter((t=>t.numChildren()>0)),e||(i=GQ(new NQ,r)||i,i=GQ(new BQ(n),r)||i,i=GQ(new FQ,r)||i,i=GQ(new CQ,r)||i,i=GQ(new zQ,r)||i,i=GQ(new _Q,r)||i,i=GQ(new DQ,r)||i,i=GQ(new TQ,r)||i),t.sources=r,i}class VQ{constructor(t){Object.defineProperty(this,"signal",{enumerable:!0,get:t})}signal;static fromName(t,n){return new VQ((()=>t(n)))}}function XQ(t){DZ(t)?function(t){const n=t.component.scales;for(const e of bR(n)){const r=JQ(t,e);if(n[e].setWithExplicit("domains",r),tZ(t,e),t.component.data.isFaceted){let n=t;for(;!SZ(n)&&n.parent;)n=n.parent;if("shared"===n.component.resolve.scale[e])for(const t of r.value)vq(t)&&(t.data=WQ+t.data.replace(WQ,""))}}}(t):function(t){for(const n of t.children)XQ(n);const n=t.component.scales;for(const e of bR(n)){let r,i=null;for(const n of t.children){const t=n.component.scales[e];if(t){r=void 0===r?t.getWithExplicit("domains"):rX(r,t.getWithExplicit("domains"),"domains","scale",eZ);const n=t.get("selectionExtent");i&&n&&i.param!==n.param&&vU("The same selection must be used to override scale domains in a layered view."),i=n}}n[e].setWithExplicit("domains",r),i&&n[e].set("selectionExtent",i,!0)}}(t)}function JQ(t,n){const e=t.getScaleComponent(n).get("type"),{encoding:r}=t,i=function(t,n,e,r){if("unaggregated"===t){const{valid:t,reason:r}=nZ(n,e);if(!t)return void vU(r)}else if(void 0===t&&r.useUnaggregatedDomain){const{valid:t}=nZ(n,e);if(t)return"unaggregated"}return t}(t.scaleDomain(n),t.typedFieldDef(n),e,t.config.scale);return i!==t.scaleDomain(n)&&(t.specifiedScales[n]={...t.specifiedScales[n],domain:i}),"x"===n&&vG(r.x2)?vG(r.x)?rX(QQ(e,i,t,"x"),QQ(e,i,t,"x2"),"domain","scale",eZ):QQ(e,i,t,"x2"):"y"===n&&vG(r.y2)?vG(r.y)?rX(QQ(e,i,t,"y"),QQ(e,i,t,"y2"),"domain","scale",eZ):QQ(e,i,t,"y2"):QQ(e,i,t,n)}function KQ(t,n,e){const r=BU(e)?.unit;return"temporal"===n||r?function(t,n,e){return t.map((t=>({signal:`{data: ${MG(t,{timeUnit:e,type:n})}}`})))}(t,n,r):[t]}function QQ(t,n,e,r){const{encoding:i,markDef:o,mark:a,config:u,stack:s}=e,c=vG(i[r]),{type:l}=c,f=c.timeUnit,d=function(t){const{marks:n,scales:e}=hX(t);return n===e?dX.Main:"include-invalid-values"===e?dX.PreFilterInvalid:dX.PostFilterInvalid}({invalid:Cq("invalid",o,u),isPath:XW(a)});if(function(t){return GR(t,"unionWith")}(n)){const i=QQ(t,void 0,e,r);return ZV([...KQ(n.unionWith,l,f),...i.value])}if(pq(n))return ZV([n]);if(n&&"unaggregated"!==n&&!kW(n))return ZV(KQ(n,l,f));if(s&&r===s.fieldChannel){if("normalize"===s.offset)return tX([[0,1]]);const t=e.requestDataName(d);return tX([{data:t,field:e.vgField(r,{suffix:"start"})},{data:t,field:e.vgField(r,{suffix:"end"})}])}const h=HI(r)&&YH(c)?function(t,n,e){if(!bW(e))return;const r=t.fieldDef(n),i=r.sort;if(zH(i))return{op:"min",field:bK(r,n),order:"ascending"};const{stack:o}=t,a=o?new Set([...o.groupbyFields,...o.stackBy.map((t=>t.fieldDef.field))]):void 0;if(_H(i))return ZQ(i,o&&!a.has(i.field));if(function(t){return GR(t,"encoding")}(i)){const{encoding:n,order:e}=i,r=t.fieldDef(n),{aggregate:u,field:s}=r,c=o&&!a.has(s);if(QI(u)||ZI(u))return ZQ({field:uG(r),order:e},c);if(tq(u)||!u)return ZQ({op:u,field:s,order:e},c)}else{if("descending"===i)return{op:"min",field:t.vgField(n),order:"descending"};if(sR(["ascending",void 0],i))return!0}}(e,r,t):void 0;if(XH(c))return tX(KQ([c.datum],l,f));const m=c;if("unaggregated"===n){const{field:t}=c;return tX([{data:e.requestDataName(d),field:uG({field:t,aggregate:"min"})},{data:e.requestDataName(d),field:uG({field:t,aggregate:"max"})}])}if(aq(m.bin)){if(bW(t))return tX("bin-ordinal"===t?[]:[{data:$R(h)?e.requestDataName(d):e.requestDataName(dX.Raw),field:e.vgField(r,DG(m,r)?{binSuffix:"range"}:{}),sort:!0!==h&&F(h)?h:{field:e.vgField(r,{}),op:"min"}}]);{const{bin:t}=m;if(aq(t)){const n=lQ(e,m.field,t);return tX([new VQ((()=>{const t=e.getSignalName(n);return`[${t}.start, ${t}.stop]`}))])}return tX([{data:e.requestDataName(d),field:e.vgField(r,{})}])}}if(m.timeUnit&&sR(["time","utc"],t)){const t=i[nI(r)];if(qH(m,t,o,u)){const n=e.requestDataName(d),i=LH({fieldDef:m,fieldDef2:t,markDef:o,config:u}),s=JW(a)&&.5!==i&&AI(r);return tX([{data:n,field:e.vgField(r,s?{suffix:bX}:{})},{data:n,field:e.vgField(r,{suffix:s?wX:"end"})}])}}return tX(h?[{data:$R(h)?e.requestDataName(d):e.requestDataName(dX.Raw),field:e.vgField(r),sort:h}]:[{data:e.requestDataName(d),field:e.vgField(r)}])}function ZQ(t,n){const{op:e,field:r,order:i}=t;return{op:e??(n?"sum":NH),...r?{field:OR(r)}:{},...i?{order:i}:{}}}function tZ(t,n){const e=t.component.scales[n],r=t.specifiedScales[n].domain,i=t.fieldDef(n)?.bin,o=kW(r)?r:void 0,a=sq(i)&&cq(i.extent)?i.extent:void 0;(o||a)&&e.set("selectionExtent",o??a,!0)}function nZ(t,n){const{aggregate:e,type:r}=t;return e?$t(e)&&!iq.has(e)?{valid:!1,reason:aU(e)}:"quantitative"===r&&"log"===n?{valid:!1,reason:uU(t)}:{valid:!0}:{valid:!1,reason:oU(t)}}function eZ(t,n,e,r){return t.explicit&&n.explicit&&vU(function(t,n,e,r){return`Conflicting ${n.toString()} property "${t.toString()}" (${HR(e)} and ${HR(r)}). Using the union of the two domains.`}(e,r,t.value,n.value)),{explicit:t.explicit,value:[...t.value,...n.value]}}function rZ(t){if(vq(t)&&$t(t.field))return t.field;if(function(t){return!S(t)&&GR(t,"fields")&&!GR(t,"data")}(t)){let n;for(const e of t.fields)if(vq(e)&&$t(e.field))if(n){if(n!==e.field)return vU("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=e.field;return vU("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(t){return!S(t)&&GR(t,"fields")&&GR(t,"data")}(t)){vU("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=t.fields[0];return $t(n)?n:void 0}}function iZ(t,n){const e=t.component.scales[n].get("domains").map((n=>(vq(n)&&(n.data=t.lookupDataSource(n.data)),n)));return function(t){const n=hR(t.map((t=>{if(vq(t)){const{sort:n,...e}=t;return e}return t})),aR),e=hR(t.map((t=>{if(vq(t)){const n=t.sort;return void 0===n||$R(n)||("op"in n&&"count"===n.op&&delete n.field,"ascending"===n.order&&delete n.order),n}})).filter((t=>void 0!==t)),aR);if(0===n.length)return;if(1===n.length){const n=t[0];if(vq(n)&&e.length>0){let t=e[0];if(e.length>1){vU(lU);const n=e.filter((t=>F(t)&&"op"in t&&"min"!==t.op));t=!e.every((t=>F(t)&&"op"in t))||1!==n.length||n[0]}else F(t)&&"field"in t&&n.field===t.field&&(t=!t.order||{order:t.order});return{...n,sort:t}}return n}const r=hR(e.map((t=>$R(t)||!("op"in t)||$t(t.op)&&ft(KI,t.op)?t:(vU(function(t){return`Dropping sort property ${HR(t)} as unioned domains only support boolean or op "count", "min", and "max".`}(t)),!0))),aR);let i;1===r.length?i=r[0]:r.length>1&&(vU(lU),i=!0);const o=hR(t.map((t=>vq(t)?t.data:null)),(t=>t));return 1===o.length&&null!==o[0]?{data:o[0],fields:n.map((t=>t.field)),...i?{sort:i}:{}}:{fields:n,...i?{sort:i}:{}}}(e)}function oZ(t){return EZ(t)||FZ(t)?t.children.reduce(((t,n)=>t.concat(oZ(n))),aZ(t)):aZ(t)}function aZ(t){return bR(t.component.scales).reduce(((n,e)=>{const r=t.component.scales[e];if(r.merged)return n;const i=r.combine(),{name:o,type:a,selectionExtent:u,domains:s,range:c,reverse:l,...f}=i,d=function(t,n,e,r){if(AI(e)){if(gq(t))return{step:{signal:`${n}_step`}}}else if(F(t)&&vq(t))return{...t,data:r.lookupDataSource(t.data)};return t}(i.range,o,e,t),h=iZ(t,e),m=u?function(t,n,e,r){const i=oK(t,n.param,n);return{signal:wW(e.get("type"))&&S(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}(t,u,r,h):null;return n.push({name:o,type:a,...h?{domain:h}:{},...m?{domainRaw:m}:{},range:d,...void 0!==l?{reverse:l}:{},...f}),n}),[])}class uZ extends QV{merged=!1;constructor(t,n){super({},{name:t}),this.setWithExplicit("type",n)}domainHasZero(){const t=this.get("type");if(sR(["log",oW,aW],t))return"definitely-not";const n=this.get("zero");if(!0===n||void 0===n&&sR([iW,"sqrt","pow"],t))return"definitely";const e=this.get("domains");if(e.length>0){let t=!1,n=!1,r=!1;for(const i of e){if(S(i)){const e=i[0],r=i[i.length-1];if(wt(e)&&wt(r)){if(e<=0&&r>=0){t=!0;continue}n=!0;continue}}r=!0}if(t)return"definitely";if(n&&!r)return"definitely-not"}return"maybe"}}const sZ=["range","scheme"];function cZ(t,n){const e=t.fieldDef(n);if(e?.bin){const{bin:r,field:i}=e,o=eI(n),a=t.getName(o);if(F(r)&&r.binned&&void 0!==r.step)return new VQ((()=>{const e=t.scaleName(n),i=`(domain("${e}")[1] - domain("${e}")[0]) / ${r.step}`;return`${t.getSignalName(a)} / (${i})`}));if(aq(r)){const n=lQ(t,i,r);return new VQ((()=>{const e=t.getSignalName(n),r=`(${e}.stop - ${e}.start) / ${e}.step`;return`${t.getSignalName(a)} / (${r})`}))}}}function lZ(t,n){const e=n.specifiedScales[t],{size:r}=n,i=n.getScaleComponent(t).get("type");for(const r of sZ)if(void 0!==e[r]){const o=OW(i,r),a=_W(t,r);if(o)if(a)vU(a);else switch(r){case"range":{const r=e.range;if(S(r)){if(AI(t))return ZV(r.map((t=>{if("width"===t||"height"===t){const e=n.getName(t),r=n.getSignalName.bind(n);return VQ.fromName(r,e)}return t})))}else if(F(r))return ZV({data:n.requestDataName(dX.Main),field:r.field,sort:{op:"min",field:n.vgField(t)}});return ZV(r)}case"scheme":return ZV(fZ(e[r]))}else vU(sU(i,r,t))}const o=t===JR||"xOffset"===t?"width":"height",a=r[o];if(CY(a))if(AI(t))if(bW(i)){const e=hZ(a,n,t);if(e)return ZV({step:e})}else vU(cU(o));else if(NI(t)&&"band"===n.getScaleComponent(t===tL?"x":"y").get("type")){const t=mZ(a,i);if(t)return ZV(t)}const{rangeMin:u,rangeMax:s}=e,c=function(t,n){const{size:e,config:r,mark:i,encoding:o}=n,{type:a}=vG(o[t]),u=n.getScaleComponent(t).get("type"),{domain:s,domainMid:c}=n.specifiedScales[t];switch(t){case JR:case KR:if(sR(["point","band"],u)){const i=pZ(t,e,r.view);if(CY(i))return{step:hZ(i,n,t)}}return dZ(t,n,u);case tL:case nL:return function(t,n,e){const r=t===tL?"x":"y",i=n.getScaleComponent(r);if(!i)return dZ(r,n,e,{center:!0});const o=i.get("type"),a=n.scaleName(r),{markDef:u,config:s}=n;if("band"===o){const t=pZ(r,n.size,n.config.view);if(CY(t)){const n=mZ(t,e);if(n)return n}return[0,{signal:`bandwidth('${a}')`}]}{const e=n.encoding[r];if(YH(e)&&e.timeUnit){const t=TU(e.timeUnit,(t=>`scale('${a}', ${t})`)),r=n.config.scale.bandWithNestedOffsetPaddingInner,i=LH({fieldDef:e,markDef:u,config:s})-.5,o=0!==i?` + ${i}`:"";return r?[{signal:`${pq(r)?`${r.signal}/2${o}`:`${r/2+i}`} * (${t})`},{signal:`${pq(r)?`(1 - ${r.signal}/2)${o}`:`${1-r/2+i}`} * (${t})`}]:[0,{signal:t}]}return rR(`Cannot use ${t} scale if ${r} scale is not discrete.`)}}(t,n,u);case pL:{const o=function(t,n){switch(t){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(nU("size",t))}(i,r),a=function(t,n,e,r){const i={x:cZ(e,"x"),y:cZ(e,"y")};switch(t){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const t=vZ(n,i,r.view);return wt(t)?t-1:new VQ((()=>`${t.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 t=vZ(n,i,r.view);return wt(t)?Math.pow(gZ*t,2):new VQ((()=>`pow(${gZ} * ${t.signal}, 2)`))}}throw new Error(nU("size",t))}(i,e,n,r);return $W(u)?function(t,n,e){const r=()=>{const r=Sq(n),i=Sq(t),o=`(${r} - ${i}) / (${e} - 1)`;return`sequence(${i}, ${r} + ${o}, ${o})`};return pq(n)?new VQ(r):{signal:r()}}(o,a,function(t,n,e,r){switch(t){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==e&&S(e)?e.length+1:(vU(function(t){return`Domain for ${t} is required for threshold scale.`}(r)),3)}}(u,r,s,t)):[o,a]}case iL:return[0,2*Math.PI];case gL:return[0,360];case eL:return[0,new VQ((()=>`min(${n.getSignalName(SZ(n.parent)?"child_width":"width")},${n.getSignalName(SZ(n.parent)?"child_height":"height")})/2`))];case lL:return{step:1e3/r.scale.framesPerSecond};case wL:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case xL:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case mL:return"symbol";case fL:case dL:case hL:return"ordinal"===u?"nominal"===a?"category":"ordinal":void 0!==c?"diverging":"rect"===i||"geoshape"===i?"heatmap":"ramp";case vL:case yL:case bL:return[r.scale.minOpacity,r.scale.maxOpacity]}}(t,n);return(void 0!==u||void 0!==s)&&OW(i,"rangeMin")&&S(c)&&2===c.length?ZV([u??c[0],s??c[1]]):tX(c)}function fZ(t){return function(t){return!$t(t)&&GR(t,"name")}(t)?{scheme:t.name,...oR(t,["name"])}:{scheme:t}}function dZ(t,n,e,{center:r}={}){const i=eI(t),o=n.getName(i),a=n.getSignalName.bind(n);return t===KR&&wW(e)?r?[VQ.fromName((t=>`${a(t)}/2`),o),VQ.fromName((t=>`-${a(t)}/2`),o)]:[VQ.fromName(a,o),0]:r?[VQ.fromName((t=>`-${a(t)}/2`),o),VQ.fromName((t=>`${a(t)}/2`),o)]:[0,VQ.fromName(a,o)]}function hZ(t,n,e){const{encoding:r}=n,i=n.getScaleComponent(e),o=iI(e),a=r[o];if("offset"===NY({step:t,offsetIsDiscrete:ZH(a)&&QU(a.type)})&&jG(r,o)){const e=n.getScaleComponent(o);let r=`domain('${n.scaleName(o)}').length`;"band"===e.get("type")&&(r=`bandspace(${r}, ${e.get("paddingInner")??e.get("padding")??0}, ${e.get("paddingOuter")??e.get("padding")??0})`);const a=i.get("paddingInner")??i.get("padding");return{signal:`${t.step} * ${r} / (1-${Aq(a)})`}}return t.step}function mZ(t,n){if("offset"===NY({step:t,offsetIsDiscrete:bW(n)}))return{step:t.step}}function pZ(t,n,e){const r=t===JR?"width":"height",i=n[r];return void 0!==i?i:TY(e,r)}const gZ=.95;function vZ(t,n,e){const r=CY(t.width)?t.width.step:BY(e,"width"),i=CY(t.height)?t.height.step:BY(e,"height");return n.x||n.y?new VQ((()=>`min(${[n.x?n.x.signal:r,n.y?n.y.signal:i].join(", ")})`)):Math.min(r,i)}function yZ(t,n){DZ(t)?function(t,n){const e=t.component.scales,{config:r,encoding:i,markDef:o,specifiedScales:a}=t;for(const u of bR(e)){const s=a[u],c=e[u],l=t.getScaleComponent(u),f=vG(i[u]),d=s[n],h=l.get("type"),m=l.get("padding"),p=l.get("paddingInner"),g=OW(h,n),v=_W(u,n);if(void 0!==d&&(g?v&&vU(v):vU(sU(h,n,u))),g&&void 0===v)if(void 0!==d){const t=f.timeUnit,e=f.type;switch(n){case"domainMax":case"domainMin":yU(s[n])||"temporal"===e||t?c.set(n,{signal:MG(s[n],{type:e,timeUnit:t})},!0):c.set(n,s[n],!0);break;default:c.copyKeyFromObject(n,s)}}else{const e=GR(bZ,n)?bZ[n]({model:t,channel:u,fieldOrDatumDef:f,scaleType:h,scalePadding:m,scalePaddingInner:p,domain:s.domain,domainMin:s.domainMin,domainMax:s.domainMax,markDef:o,config:r,hasNestedOffsetScale:RG(i,u),hasSecondaryRangeChannel:!!i[nI(u)]}):r.scale[n];void 0!==e&&c.set(n,e,!1)}}}(t,n):xZ(t,n)}const bZ={bins:({model:t,fieldOrDatumDef:n})=>YH(n)?function(t,n){const e=n.bin;if(aq(e)){const r=lQ(t,n.field,e);return new VQ((()=>t.getSignalName(r)))}if(uq(e)&&sq(e)&&void 0!==e.step)return{step:e.step}}(t,n):void 0,interpolate:({channel:t,fieldOrDatumDef:n})=>function(t,n){if(sR([fL,dL,hL],t)&&"nominal"!==n)return"hcl"}(t,n.type),nice:({scaleType:t,channel:n,domain:e,domainMin:r,domainMax:i,fieldOrDatumDef:o})=>function(t,n,e,r,i,o){if(!(gG(o)?.bin||S(e)||null!=i||null!=r||sR([oW,aW],t)))return!!AI(n)||void 0}(t,n,e,r,i,o),padding:({channel:t,scaleType:n,fieldOrDatumDef:e,markDef:r,config:i})=>function(t,n,e,r,i,o){if(AI(t)){if(xW(n)){if(void 0!==e.continuousPadding)return e.continuousPadding;const{type:n,orient:a}=i;if("bar"===n&&(!YH(r)||!r.bin&&!r.timeUnit)&&("vertical"===a&&"x"===t||"horizontal"===a&&"y"===t))return o.continuousBandSize}if(n===uW)return e.pointPadding}}(t,n,i.scale,e,r,i.bar),paddingInner:({scalePadding:t,channel:n,markDef:e,scaleType:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t){if(AI(n)){const{bandPaddingInner:t,barBandPaddingInner:n,rectBandPaddingInner:r,tickBandPaddingInner:a,bandWithNestedOffsetPaddingInner:u}=i;return o?u:TR(t,"bar"===e?n:"tick"===e?a:r)}return NI(n)&&r===sW?i.offsetBandPaddingInner:void 0}}(t,n,e.type,r,i.scale,o),paddingOuter:({scalePadding:t,channel:n,scaleType:e,scalePaddingInner:r,config:i,hasNestedOffsetScale:o})=>function(t,n,e,r,i,o=!1){if(void 0===t)if(AI(n)){const{bandPaddingOuter:t,bandWithNestedOffsetPaddingOuter:n}=i;if(o)return n;if(e===sW)return TR(t,pq(r)?{signal:`${r.signal}/2`}:r/2)}else if(NI(n)){if(e===uW)return.5;if(e===sW)return i.offsetBandPaddingOuter}}(t,n,e,r,i.scale,o),reverse:({fieldOrDatumDef:t,scaleType:n,channel:e,config:r})=>function(t,n,e,r){return"x"===e&&void 0!==r.xReverse?wW(t)&&"descending"===n?pq(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse:!(!wW(t)||"descending"!==n)||void 0}(n,YH(t)?t.sort:void 0,e,r.scale),zero:({channel:t,fieldOrDatumDef:n,domain:e,markDef:r,scaleType:i,config:o,hasSecondaryRangeChannel:a})=>function(t,n,e,r,i,o,a){if(e&&"unaggregated"!==e&&wW(i)){if(S(e)){const t=e[0],n=e[e.length-1];if(wt(t)&&t<=0&&wt(n)&&n>=0)return!0}return!1}if("size"===t&&"quantitative"===n.type&&!$W(i))return!0;if((!YH(n)||!n.bin)&&sR([...MI,...SI],t)){const{orient:n,type:e}=r;return(!sR(["bar","area","line","trail"],e)||!("horizontal"===n&&"y"===t||"vertical"===n&&"x"===t))&&(!(!sR(["bar","area"],e)||a)||o?.zero)}return!1}(t,n,e,r,i,o.scale,a)};function wZ(t){DZ(t)?function(t){const n=t.component.scales;for(const e of WI){const r=n[e];if(!r)continue;const i=lZ(e,t);r.setWithExplicit("range",i)}}(t):xZ(t,"range")}function xZ(t,n){const e=t.component.scales;for(const e of t.children)"range"===n?wZ(e):yZ(e,n);for(const r of bR(e)){let i;for(const e of t.children){const t=e.component.scales[r];t&&(i=rX(i,t.getWithExplicit(n),n,"scale",nX(((t,e)=>"range"===n&&t.step&&e.step?t.step-e.step:0))))}e[r].setWithExplicit(n,i)}}function $Z(t,n,e,r,i=!1){const o=function(t,n,e,r){switch(n.type){case"nominal":case"ordinal":if(PL(t)||"discrete"===XI(t))return"shape"===t&&"ordinal"===n.type&&vU(iU(t,"ordinal")),"ordinal";if(OI(t))return"band";if(AI(t)||NI(t)){if(sR(["rect","bar","image","rule","tick"],e.type))return"band";if(r)return"band"}else if("arc"===e.type&&t in DI)return"band";return iH(e[eI(t)])||rG(n)&&n.axis?.tickBand?"band":"point";case"temporal":return PL(t)?"time":"discrete"===XI(t)?(vU(iU(t,"temporal")),"ordinal"):YH(n)&&n.timeUnit&&BU(n.timeUnit).utc?"utc":OI(t)?"band":"time";case"quantitative":return PL(t)?YH(n)&&aq(n.bin)?"bin-ordinal":"linear":"discrete"===XI(t)?(vU(iU(t,"quantitative")),"ordinal"):OI(t)?"band":"linear";case"geojson":return}throw new Error(Qq(n.type))}(n,e,r,i),{type:a}=t;return HI(n)?void 0!==a?function(t,n,e=!1){if(!HI(t))return!1;switch(t){case JR:case KR:case tL:case nL:case iL:case eL:return!!xW(n)||"band"===n||"point"===n&&!e;case lL:return sR(["linear","band"],n);case pL:case wL:case vL:case yL:case bL:case gL:return xW(n)||$W(n)||sR(["band","point","ordinal"],n);case fL:case dL:case hL:return"band"!==n;case xL:case mL:return"ordinal"===n||$W(n)}}(n,a)?YH(e)&&(u=a,!(sR([tW,eW],s=e.type)?void 0===u||bW(u):s===nW?sR([oW,aW,void 0],u):s!==ZU||pW(u)||$W(u)||void 0===u))?(vU(function(t,n){return`FieldDef does not work with "${t}" scale. We are using "${n}" scale instead.`}(a,o)),o):a:(vU(function(t,n,e){return`Channel "${t}" does not work with "${n}" scale. We are using "${e}" scale instead.`}(n,a,o)),o):o:null;var u,s}function kZ(t){t.component.scales=DZ(t)?function(t){const{encoding:n,mark:e,markDef:r}=t,i={};for(const o of WI){const a=vG(n[o]);if(a&&e===VW&&o===mL&&a.type===rW)continue;let u=a&&a.scale;if(a&&null!==u&&!1!==u){u??={};const e=$Z(u,o,a,r,RG(n,o));i[o]=new uZ(t.scaleName(`${o}`,!0),{value:e,explicit:u.type===e})}}return i}(t):function(t){const n=t.component.scales={},e={},r=t.component.resolve;for(const n of t.children){kZ(n);for(const i of bR(n.component.scales))if(r.scale[i]??=IK(i,t),"shared"===r.scale[i]){const t=e[i],o=n.component.scales[i].getWithExplicit("type");t?lW(t.value,o.value)?e[i]=rX(t,o,"type","scale",MZ):(r.scale[i]="independent",delete e[i]):e[i]=o}}for(const r of bR(e)){const i=t.scaleName(r,!0);n[r]=new uZ(i,e[r]);for(const n of t.children){const t=n.component.scales[r];t&&(n.renameScale(t.get("name"),i),t.merged=!0)}}return n}(t)}const MZ=nX(((t,n)=>dW(t)-dW(n)));class AZ{nameMap;constructor(){this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return void 0!==this.nameMap[t]}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function DZ(t){return"unit"===t?.type}function SZ(t){return"facet"===t?.type}function FZ(t){return"concat"===t?.type}function EZ(t){return"layer"===t?.type}class NZ{type;parent;config;name;size;title;description;data;transforms;layout;scaleNameMap;projectionNameMap;signalNameMap;component;view;constructor(t,n,e,r,i,o,a){this.type=n,this.parent=e,this.config=i,this.parent=e,this.config=i,this.view=dq(a),this.name=t.name??r,this.title=mq(t.title)?{text:t.title}:t.title?dq(t.title):void 0,this.scaleNameMap=e?e.scaleNameMap:new AZ,this.projectionNameMap=e?e.projectionNameMap:new AZ,this.signalNameMap=e?e.signalNameMap:new AZ,this.data=t.data,this.description=t.description,this.transforms=function(t){return t.map((t=>wV(t)?{filter:nR(t.filter,JU)}:t))}(t.transform??[]),this.layout="layer"===n||"unit"===n?{}:function(t,n,e){const r=e[n],i={},{spacing:o,columns:a}=r;void 0!==o&&(i.spacing=o),void 0!==a&&(PH(t)&&!BH(t.facet)||SY(t))&&(i.columns=a),FY(t)&&(i.columns=1);for(const n of _Y)if(void 0!==t[n])if("spacing"===n){const e=t[n];i[n]=wt(e)?e:{row:e.row??o,column:e.column??o}}else i[n]=t[n];return i}(t,n,i),this.component={data:{sources:e?e.component.data.sources:[],outputNodes:e?e.component.data.outputNodes:{},outputNodeRefCounts:e?e.component.data.outputNodeRefCounts:{},isFaceted:PH(t)||e?.component.data.isFaceted&&void 0===t.data},layoutSize:new QV,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...o?eR(o):{}},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(t,{ignoreRange:n}={}){kZ(t),XQ(t);for(const n of CW)yZ(t,n);n||wZ(t)}(this)}parseProjection(){uQ(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){ZK(this)}assembleEncodeFromView(t){const{style:n,...e}=t,r={};for(const t of bR(e)){const n=e[t];void 0!==n&&(r[t]=Mq(n))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),t||(this.description&&(n.description=Mq(this.description)),"unit"!==this.type&&"layer"!==this.type)?yR(n)?void 0:n:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:e,config:r}=this,i=function(t,n){const e={};for(const r of RL){const i=t[r];if(i?.facetFieldDef){const{titleAnchor:t,titleOrient:o}=$K(["titleAnchor","titleOrient"],i.facetFieldDef.header,n,r),a=wK(r,o),u=_K(t,a);void 0!==u&&(e[a]=u)}}return yR(e)?void 0:e}(e.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...i?{titleBand:i}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const e of RL)t[e].title&&n.push(AK(this,e));for(const t of kK)n=n.concat(FK(this,t));return n}assembleAxes(){return function(t,n){const{x:e=[],y:r=[]}=t;return[...e.map((t=>sK(t,"grid",n))),...r.map((t=>sK(t,"grid",n))),...e.map((t=>sK(t,"main",n))),...r.map((t=>sK(t,"main",n)))].filter((t=>t))}(this.component.axes,this.config)}assembleLegends(){return rQ(this)}assembleProjections(){return EZ(t=this)||FZ(t)?function(t){return t.children.reduce(((t,n)=>t.concat(n.assembleProjections())),iQ(t))}(t):iQ(t);var t}assembleTitle(){const{encoding:t,...n}=this.title??{},e={...hq(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(e.text)return sR(["unit","layer"],this.type)?sR(["middle",void 0],e.anchor)&&(e.frame??="group"):e.anchor??="start",yR(e)?void 0:e}assembleGroup(t=[]){const n={};(t=t.concat(this.assembleSignals())).length>0&&(n.signals=t);const e=this.assembleLayout();e&&(n.layout=e),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||SZ(this.parent)?oZ(this):[];r.length>0&&(n.scales=r);const i=this.assembleAxes();i.length>0&&(n.axes=i);const o=this.assembleLegends();return o.length>0&&(n.legends=o),n}getName(t){return kR((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(dX[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),e=this.component.data.outputNodeRefCounts;return e[n]=(e[n]||0)+1,n}getSizeSignalRef(t){if(SZ(this.parent)){const n=FI(RK(t)),e=this.component.scales[n];if(e&&!e.merged){const t=e.get("type"),r=e.get("range");if(bW(t)&&gq(r)){const t=e.get("name"),r=rZ(iZ(this,n));return r?{signal:jK(t,e,uG({aggregate:"distinct",field:r},{expr:"datum"}))}:(vU(qq(n)),null)}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){return n?this.getName(t):JL(t)&&HI(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t))?this.scaleNameMap.get(this.getName(t)):void 0}projectionName(t){return t?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(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let e=this.component.selection[t];if(!e&&this.parent&&(e=this.parent.getSelectionComponent(t,n)),!e)throw new Error(`Cannot find a selection named "${n}".`);return e}hasAxisOrientSignalRef(){return this.component.axes.x?.some((t=>t.hasOrientSignalRef()))||this.component.axes.y?.some((t=>t.hasOrientSignalRef()))}}class CZ extends NZ{vgField(t,n={}){const e=this.fieldDef(t);if(e)return uG(e,n)}reduceFieldDef(t,n){return function(t,n,e,r){return t?bR(t).reduce(((e,i)=>{const o=t[i];return S(o)?o.reduce(((t,e)=>n.call(r,t,e,i)),e):n.call(r,e,o,i)}),e):e}(this.getMapping(),((n,e,r)=>{const i=gG(e);return i?t(n,i,r):n}),n)}forEachFieldDef(t,n){WG(this.getMapping(),((n,e)=>{const r=gG(n);r&&t(r,e)}),n)}}class OZ extends mX{transform;clone(){return new OZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"value",e[1]??"density"],this.transform.resolve=this.transform.resolve??"shared"}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${aR(this.transform)}`}assemble(){const{density:t,...n}=this.transform,e={type:"kde",field:t,...n};return e.resolve=this.transform.resolve,e}}class _Z extends mX{transform;clone(){return new _Z(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${aR(this.transform)}`}assemble(){const{extent:t,param:n}=this.transform;return{type:"extent",field:t,signal:n}}}class zZ extends mX{transform;clone(){return new zZ(this.parent,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const{flatten:e,as:r=[]}=this.transform;this.transform.as=e.map(((t,n)=>r[n]??t))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${aR(this.transform)}`}assemble(){const{flatten:t,as:n}=this.transform;return{type:"flatten",fields:t,as:n}}}class BZ extends mX{transform;clone(){return new BZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"key",e[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${aR(this.transform)}`}assemble(){const{fold:t,as:n}=this.transform;return{type:"fold",fields:t,as:n}}}class TZ extends mX{fields;geojson;signal;clone(){return new TZ(null,eR(this.fields),this.geojson,this.signal)}static parseAll(t,n){if(n.component.projection&&!n.component.projection.isFit)return t;let e=0;for(const r of[[uL,aL],[cL,sL]]){const i=r.map((t=>{const e=vG(n.encoding[t]);return YH(e)?e.field:XH(e)?{expr:`${e.datum}`}:nG(e)?{expr:`${e.value}`}:void 0}));(i[0]||i[1])&&(t=new TZ(t,i,null,n.getName("geojson_"+e++)))}if(n.channelHasField(mL)){const r=n.typedFieldDef(mL);r.type===rW&&(t=new TZ(t,null,r.field,n.getName("geojson_"+e++)))}return t}constructor(t,n,e,r){super(t),this.fields=n,this.geojson=e,this.signal=r}dependentFields(){const t=(this.fields??[]).filter($t);return new Set([...this.geojson?[this.geojson]:[],...t])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${aR(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 PZ extends mX{projection;fields;as;clone(){return new PZ(null,this.projection,eR(this.fields),eR(this.as))}constructor(t,n,e,r){super(t),this.projection=n,this.fields=e,this.as=r}static parseAll(t,n){if(!n.projectionName())return t;for(const e of[[uL,aL],[cL,sL]]){const r=e.map((t=>{const e=vG(n.encoding[t]);return YH(e)?e.field:XH(e)?{expr:`${e.datum}`}:nG(e)?{expr:`${e.value}`}:void 0})),i=e[0]===cL?"2":"";(r[0]||r[1])&&(t=new PZ(t,n.projectionName(),r,[n.getName(`x${i}`),n.getName(`y${i}`)]))}return t}dependentFields(){return new Set(this.fields.filter($t))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${aR(this.fields)} ${aR(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class jZ extends mX{transform;clone(){return new jZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(t){const{start:n=0,stop:e,step:r}=t;return{signal:`sequence(${[n,e,...r?[r]:[]].join(",")})`}}static makeFromTransform(t,n){return new jZ(t,n)}static makeFromEncoding(t,n){const e=n.encoding,r=e.x,i=e.y;if(YH(r)&&YH(i)){const o=r.impute?r:i.impute?i:void 0;if(void 0===o)return;const a=r.impute?i:i.impute?r:void 0,{method:u,value:s,frame:c,keyvals:l}=o.impute,f=HG(n.mark,e);return new jZ(t,{impute:o.field,key:a.field,...u?{method:u}:{},...void 0!==s?{value:s}:{},...c?{frame:c}:{},...void 0!==l?{keyvals:l}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${aR(this.transform)}`}assemble(){const{impute:t,key:n,keyvals:e,method:r,groupby:i,value:o,frame:a=[null,null]}=this.transform,u={type:"impute",field:t,key:n,...e?{keyvals:(s=e,GR(s,"stop")?this.processSequence(e):e)}:{},method:"value",...i?{groupby:i}:{},value:r&&"value"!==r?null:o};var s;return r&&"value"!==r?[u,{type:"window",as:[`imputed_${t}_value`],ops:[r],fields:[t],frame:a,ignorePeers:!1,...i?{groupby:i}:{}},{type:"formula",expr:`datum.${t} === null ? datum.imputed_${t}_value : datum.${t}`,as:t}]:[u]}}class RZ extends mX{transform;clone(){return new RZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${aR(this.transform)}`}assemble(){const{loess:t,on:n,...e}=this.transform;return{type:"loess",x:n,y:t,...e}}}class LZ extends mX{transform;secondary;clone(){return new LZ(null,eR(this.transform),this.secondary)}constructor(t,n,e){super(t),this.transform=n,this.secondary=e}static make(t,n,e,r){const i=n.component.data.sources,{from:o}=e;let a=null;if(function(t){return GR(t,"data")}(o)){let t=t0(o.data,i);t||(t=new xQ(o.data),i.push(t));const e=n.getName(`lookup_${r}`);a=new pX(t,e,dX.Lookup,n.component.data.outputNodeRefCounts),n.component.data.outputNodes[e]=a}else if(function(t){return GR(t,"param")}(o)){const t=o.param;let r;e={as:t,...e};try{r=n.getSelectionComponent(kR(t),t)}catch{throw new Error(`Lookups can only be performed on selection parameters. "${t}" is a variable parameter.`)}if(a=r.materialized,!a)throw new Error(`Cannot define and lookup the "${t}" selection in the same view. Try moving the lookup into a second, layered view?`)}return new LZ(t,e,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?Q(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${aR({transform:this.transform,secondary:this.secondary})}`}assemble(){let t;if(this.transform.from.fields)t={values:this.transform.from.fields,...this.transform.as?{as:Q(this.transform.as)}:{}};else{let n=this.transform.as;$t(n)||(vU('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"),t={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...t,...this.transform.default?{default:this.transform.default}:{}}}}class IZ extends mX{transform;clone(){return new IZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??"prob",e[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${aR(this.transform)}`}assemble(){const{quantile:t,...n}=this.transform;return{type:"quantile",field:t,...n}}}class qZ extends mX{transform;clone(){return new qZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n,this.transform=eR(n);const e=this.transform.as??[void 0,void 0];this.transform.as=[e[0]??n.on,e[1]??n.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${aR(this.transform)}`}assemble(){const{regression:t,on:n,...e}=this.transform;return{type:"regression",x:n,y:t,...e}}}class UZ extends mX{transform;clone(){return new UZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}addDimensions(t){this.transform.groupby=hR((this.transform.groupby??[]).concat(t),(t=>t))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${aR(this.transform)}`}assemble(){const{pivot:t,value:n,groupby:e,limit:r,op:i}=this.transform;return{type:"pivot",field:t,value:n,...void 0!==r?{limit:r}:{},...void 0!==i?{op:i}:{},...void 0!==e?{groupby:e}:{}}}}class WZ extends mX{transform;clone(){return new WZ(null,eR(this.transform))}constructor(t,n){super(t),this.transform=n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${aR(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function HZ(t){let n=0;return function e(r,i){if(r instanceof xQ&&!r.isGenerator&&!oX(r.data)&&(t.push(i),i={name:null,source:i.name,transform:[]}),r instanceof vQ&&(r.parent instanceof xQ&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof mQ)return i.name||(i.name="data_"+n++),!i.source||i.transform.length>0?(t.push(i),r.data=i.name):r.data=i.source,void t.push(...r.assemble());switch((r instanceof bQ||r instanceof wQ||r instanceof jQ||r instanceof rK||r instanceof yK||r instanceof PZ||r instanceof hQ||r instanceof LZ||r instanceof IQ||r instanceof PQ||r instanceof BZ||r instanceof zZ||r instanceof OZ||r instanceof RZ||r instanceof IZ||r instanceof qZ||r instanceof yQ||r instanceof WZ||r instanceof UZ||r instanceof _Z)&&i.transform.push(r.assemble()),(r instanceof dQ||r instanceof yX||r instanceof jZ||r instanceof LQ||r instanceof TZ)&&i.transform.push(...r.assemble()),r instanceof pX&&(i.source&&0===i.transform.length?r.setSource(i.source):r.parent instanceof pX?r.setSource(i.name):(i.name||(i.name="data_"+n++),r.setSource(i.name),1===r.numChildren()&&(t.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof pX&&(!i.source||i.transform.length>0)&&t.push(i);break;case 1:e(r.children[0],i);break;default:{i.name||(i.name="data_"+n++);let o=i.name;!i.source||i.transform.length>0?t.push(i):o=i.source;for(const t of r.children)e(t,{name:null,source:o,transform:[]});break}}}}function GZ(t,n){const{facet:e,config:r,child:i,component:o}=t;if(t.channelHasField(n)){const a=e[n],u=xK("title",null,r,n);let s=dG(a,r,{allowDisabling:!0,includeDefault:void 0===u||!!u});i.component.layoutHeaders[n].title&&(s=S(s)?s.join(", "):s,s+=` / ${i.component.layoutHeaders[n].title}`,i.component.layoutHeaders[n].title=null);const c=xK("labelOrient",a.header,r,n),l=null!==a.header&&TR(a.header?.labels,r.header.labels,!0),f=sR(["bottom","right"],c)?"footer":"header";o.layoutHeaders[n]={title:null!==a.header?s:null,facetFieldDef:a,[f]:"facet"===n?[]:[YZ(t,n,l)]}}}function YZ(t,n,e){const r="row"===n?"height":"width";return{labels:e,sizeSignal:t.child.component.layoutSize.get(r)?t.child.getSizeSignalRef(r):void 0,axes:[]}}function VZ(t,n){const{child:e}=t;if(e.component.axes[n]){const{layoutHeaders:i,resolve:o}=t.component;if(o.axis[n]=qK(o,n),"shared"===o.axis[n]){const o="x"===n?"column":"row",a=i[o];for(const i of e.component.axes[n]){const n="top"===(r=i.get("orient"))||"left"===r||pq(r)?"header":"footer";a[n]??=[YZ(t,o,!1)];const e=sK(i,"main",t.config,{header:!0});e&&a[n][0].axes.push(e),i.mainExtracted=!0}}}var r}function XZ(t){for(const n of t.children)n.parseLayoutSize()}function JZ(t,n){const e=RK(n),r=FI(e),i=t.component.resolve,o=t.component.layoutSize;let a;for(const n of t.children){const o=n.component.layoutSize.getWithExplicit(e),u=i.scale[r]??IK(r,t);if("independent"===u&&"step"===o.value){a=void 0;break}if(a){if("independent"===u&&a.value!==o.value){a=void 0;break}a=rX(a,o,e,"")}else a=o}if(a){for(const r of t.children)t.renameSignal(r.getName(e),t.getName(n)),r.component.layoutSize.set(e,"merged",!1);o.setWithExplicit(n,a)}else o.setWithExplicit(n,{explicit:!1,value:void 0})}function KZ(t,n){const e=t.config,r=t.getScaleComponent("width"===n?"x":"y");if(r){const t=r.get("type"),i=r.get("range");if(bW(t)){const t=TY(e.view,n);return gq(i)||CY(t)?"step":t}return zY(e.view,n)}if(t.hasProjection||"arc"===t.mark)return zY(e.view,n);{const t=TY(e.view,n);return CY(t)?t.step:t}}function QZ(t,n,e){return uG(n,{suffix:`by_${uG(t)}`,...e})}class ZZ extends CZ{facet;child;children;constructor(t,n,e,r){super(t,"facet",n,e,r,t.resolve),this.child=k0(t.spec,this,this.getName("child"),void 0,r),this.children=[this.child],this.facet=this.initFacet(t.facet)}initFacet(t){if(!BH(t))return{facet:this.initFacetFieldDef(t,"facet")};const n=bR(t),e={};for(const r of n){if(![YR,VR].includes(r)){vU(nU(r,"facet"));break}const n=t[r];if(void 0===n.field){vU(tU(n,r));break}e[r]=this.initFacetFieldDef(n,r)}return e}initFacetFieldDef(t,n){const e=wG(t,n);return e.header?e.header=dq(e.header):null===e.header&&(e.header=null),e}channelHasField(t){return GR(this.facet,t)}fieldDef(t){return this.facet[t]}parseData(){this.component.data=n0(this),this.child.parseData()}parseLayoutSize(){XZ(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,wR(this.component.selection).some((t=>ZJ(t)))&&gU(Yq)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(t){for(const n of RL)GZ(t,n);VZ(t,"x"),VZ(t,"y")}(this)}assembleSelectionTopLevelSignals(t){return this.child.assembleSelectionTopLevelSignals(t)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(t){return this.child.assembleSelectionData(t)}getHeaderLayoutMixins(){const t={};for(const n of RL)for(const e of MK){const r=this.component.layoutHeaders[n],i=r[e],{facetFieldDef:o}=r;if(o){const e=xK("titleOrient",o.header,this.config,n);if(["right","bottom"].includes(e)){const r=wK(n,e);t.titleAnchor??={},t.titleAnchor[r]="end"}}if(i?.[0]){const i="header"===e?"headerBand":"footerBand";"facet"===n||this.child.component.layoutSize.get("row"===n?"height":"width")||(t[i]??={},t[i][n]=.5),r.title&&(t.offset??={},t.offset["row"===n?"rowTitle":"columnTitle"]=10)}}return t}assembleDefaultLayout(){const{column:t,row:n}=this.facet,e=t?this.columnDistinctSignal():n?1:void 0;let r="all";return(n||"independent"!==this.component.resolve.scale.x)&&(t||"independent"!==this.component.resolve.scale.y)||(r="none"),{...this.getHeaderLayoutMixins(),...e?{columns:e}:{},bounds:"full",align:r}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof ZZ))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(t){return this.parent&&this.parent instanceof ZZ?{...this.channelHasField("column")?{encode:{update:{columns:{field:uG(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(t)}:super.assembleGroup(t)}getCardinalityAggregateForChild(){const t=[],n=[],e=[];if(this.child instanceof ZZ){if(this.child.channelHasField("column")){const r=uG(this.child.facet.column);t.push(r),n.push("distinct"),e.push(`distinct_${r}`)}}else for(const r of MI){const i=this.child.component.scales[r];if(i&&!i.merged){const o=i.get("type"),a=i.get("range");if(bW(o)&&gq(a)){const i=rZ(iZ(this.child,r));i?(t.push(i),n.push("distinct"),e.push(`distinct_${i}`)):vU(qq(r))}}}return{fields:t,ops:n,as:e}}assembleFacet(){const{name:t,data:n}=this.component.data.facetRoot,{row:e,column:r}=this.facet,{fields:i,ops:o,as:a}=this.getCardinalityAggregateForChild(),u=[];for(const t of RL){const n=this.facet[t];if(n){u.push(uG(n));const{bin:s,sort:c}=n;if(aq(s)&&u.push(uG(n,{binSuffix:"end"})),_H(c)){const{field:t,op:u=NH}=c,s=QZ(n,c);e&&r?(i.push(s),o.push("max"),a.push(s)):(i.push(t),o.push(u),a.push(s))}else if(S(c)){const e=bK(n,t);i.push(e),o.push("max"),a.push(e)}}}const s=!!e&&!!r;return{name:t,data:n,groupby:u,...s||i.length>0?{aggregate:{...s?{cross:s}:{},...i.length?{fields:i,ops:o,as:a}:{}}}:{}}}facetSortFields(t){const{facet:n}=this,e=n[t];return e?_H(e.sort)?[QZ(e,e.sort,{expr:"datum"})]:S(e.sort)?[bK(e,t,{expr:"datum"})]:[uG(e,{expr:"datum"})]:[]}facetSortOrder(t){const{facet:n}=this,e=n[t];if(e){const{sort:t}=e;return[(_H(t)?t.order:!S(t)&&t)||"ascending"]}return[]}assembleLabelTitle(){const{facet:t,config:n}=this;if(t.facet)return NK(t.facet,"facet",n);const e={row:["top","bottom"],column:["left","right"]};for(const r of kK)if(t[r]){const i=xK("labelOrient",t[r]?.header,n,r);if(e[r].includes(i))return NK(t[r],r,n)}}assembleMarks(){const{child:t}=this,n=function(t){const n=[],e=HZ(n);for(const n of t.children)e(n,{source:t.name,name:null,transform:[]});return n}(this.component.data.facetRoot),e=t.assembleGroupEncodeEntry(!1),r=this.assembleLabelTitle()||t.assembleTitle(),i=t.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...r?{title:r}:{},...i?{style:i}:{},from:{facet:this.assembleFacet()},sort:{field:RL.map((t=>this.facetSortFields(t))).flat(),order:RL.map((t=>this.facetSortOrder(t))).flat()},...n.length>0?{data:n}:{},...e?{encode:{update:e}}:{},...t.assembleGroup(LX(this,[]))}]}getMapping(){return this.facet}}function t0(t,n){for(const e of n){const n=e.data;if(t.name&&e.hasName()&&t.name!==e.dataName)continue;const r=t.format?.mesh,i=n.format?.feature;if(r&&i)continue;const o=t.format?.feature;if((o||i)&&o!==i)continue;const a=n.format?.mesh;if(!r&&!a||r===a)if(aX(t)&&aX(n)){if(WR(t.values,n.values))return e}else if(oX(t)&&oX(n)){if(t.url===n.url)return e}else if(uX(t)&&t.name===e.dataName)return e}return null}function n0(t){let n=function(t,n){if(t.data||!t.parent){if(null===t.data){const t=new xQ({values:[]});return n.push(t),t}const e=t0(t.data,n);if(e)return sX(t.data)||(e.data.format=fR({},t.data.format,e.data.format)),!e.hasName()&&t.data.name&&(e.dataName=t.data.name),e;{const e=new xQ(t.data);return n.push(e),e}}return t.parent.component.data.facetRoot?t.parent.component.data.facetRoot:t.parent.component.data.main}(t,t.component.data.sources);const{outputNodes:e,outputNodeRefCounts:r}=t.component.data,i=t.data,o=i&&(sX(i)||oX(i)||aX(i))||!t.parent?new iX:t.parent.component.data.ancestorParse.clone();sX(i)?(cX(i)?n=new wQ(n,i.sequence):fX(i)&&(n=new bQ(n,i.graticule)),o.parseNothing=!0):null===i?.format?.parse&&(o.parseNothing=!0),n=vQ.makeExplicit(n,t,o)??n,n=new yQ(n);const a=t.parent&&EZ(t.parent);(DZ(t)||SZ(t))&&a&&(n=dQ.makeFromEncoding(n,t)??n),t.transforms.length>0&&(n=function(t,n,e){let r=0;for(const i of n.transforms){let o,a;if(CV(i))a=t=new yK(t,i),o="derived";else if(wV(i)){const r=gQ(i);a=t=vQ.makeWithAncestors(t,{},r,e)??t,t=new rK(t,n,i.filter)}else if(OV(i))a=t=dQ.makeFromTransform(t,i,n),o="number";else if(zV(i))o="date",void 0===e.getWithExplicit(i.field).value&&(t=new vQ(t,{[i.field]:o}),e.set(i.field,o,!1)),a=t=yX.makeFromTransform(t,i);else if(BV(i))a=t=hQ.makeFromTransform(t,i),o="number",KJ(n)&&(t=new yQ(t));else if(xV(i))a=t=LZ.make(t,n,i,r++),o="derived";else if(FV(i))a=t=new IQ(t,i),o="number";else if(EV(i))a=t=new PQ(t,i),o="number";else if(TV(i))a=t=LQ.makeFromTransform(t,i),o="derived";else if(PV(i))a=t=new BZ(t,i),o="derived";else if(jV(i))a=t=new _Z(t,i),o="derived";else if(NV(i))a=t=new zZ(t,i),o="derived";else if($V(i))a=t=new UZ(t,i),o="derived";else if(SV(i))t=new WZ(t,i);else if(_V(i))a=t=jZ.makeFromTransform(t,i),o="derived";else if(kV(i))a=t=new OZ(t,i),o="derived";else if(MV(i))a=t=new IZ(t,i),o="derived";else if(AV(i))a=t=new qZ(t,i),o="derived";else{if(!DV(i)){vU(Xq(i));continue}a=t=new RZ(t,i),o="derived"}if(a&&void 0!==o)for(const t of a.producedFields()??[])e.set(t,o,!1)}return t}(n,t,o));const u=function(t){const n={};if(DZ(t)&&t.component.selection)for(const e of bR(t.component.selection)){const r=t.component.selection[e];for(const t of r.project.items)!t.channel&&BR(t.field)>1&&(n[t.field]="flatten")}return n}(t),s=function(t){const n={};function e(t){var e;kG(t)?n[t.field]="date":"quantitative"===t.type&&$t(e=t.aggregate)&&sR(["min","max"],e)?n[t.field]="number":BR(t.field)>1?t.field in n||(n[t.field]="flatten"):eG(t)&&_H(t.sort)&&BR(t.sort.field)>1&&(t.sort.field in n||(n[t.sort.field]="flatten"))}if((DZ(t)||SZ(t))&&t.forEachFieldDef(((n,r)=>{if(tG(n))e(n);else{const i=ZL(r),o=t.fieldDef(i);e({...n,type:o.type})}})),DZ(t)){const{mark:e,markDef:r,encoding:i}=t;if(XW(e)&&!t.encoding.order){const t=i["horizontal"===r.orient?"y":"x"];YH(t)&&"quantitative"===t.type&&!(t.field in n)&&(n[t.field]="number")}}return n}(t);n=vQ.makeWithAncestors(n,{},{...u,...s},o)??n,DZ(t)&&(n=TZ.parseAll(n,t),n=PZ.parseAll(n,t)),(DZ(t)||SZ(t))&&(a||(n=dQ.makeFromEncoding(n,t)??n),n=yX.makeFromEncoding(n,t)??n,n=yK.parseAllForSortIndex(n,t));const c=n=e0(dX.Raw,t,n);if(DZ(t)){const e=hQ.makeFromEncoding(n,t);e&&(n=e,KJ(t)&&(n=new yQ(n))),n=jZ.makeFromEncoding(n,t)??n,n=LQ.makeFromEncoding(n,t)??n}let l,f;if(DZ(t)){const{markDef:e,mark:r,config:i}=t,o=Nq("invalid",e,i),{marks:a,scales:u}=f=hX({invalid:o,isPath:XW(r)});a!==u&&"include-invalid-values"===u&&(l=n=e0(dX.PreFilterInvalid,t,n)),"exclude-invalid-values"===a&&(n=jQ.make(n,t,f)??n)}const d=n=e0(dX.Main,t,n);let h;if(DZ(t)&&f){const{marks:e,scales:r}=f;"include-invalid-values"===e&&"exclude-invalid-values"===r&&(n=jQ.make(n,t,f)??n,h=n=e0(dX.PostFilterInvalid,t,n))}DZ(t)&&function(t,n){for(const[e,r]of xR(t.component.selection??{})){const i=t.getName(`lookup_${e}`);t.component.data.outputNodes[i]=r.materialized=new pX(new rK(n,t,{param:e}),i,dX.Lookup,t.component.data.outputNodeRefCounts)}}(t,d);let m=null;if(SZ(t)){const r=t.getName("facet");n=function(t,n){const{row:e,column:r}=n;if(e&&r){let n=null;for(const i of[e,r])if(_H(i.sort)){const{field:e,op:r=NH}=i.sort;t=n=new PQ(t,{joinaggregate:[{op:r,field:e,as:QZ(i,i.sort,{forAs:!0})}],groupby:[uG(i)]})}return n}return null}(n,t.facet)??n,m=new mQ(n,t,r,d.getSource()),e[r]=m}return{...t.component.data,outputNodes:e,outputNodeRefCounts:r,raw:c,main:d,facetRoot:m,ancestorParse:o,preFilterInvalid:l,postFilterInvalid:h}}function e0(t,n,e){const{outputNodes:r,outputNodeRefCounts:i}=n.component.data,o=n.getDataName(t),a=new pX(e,o,t,i);return r[o]=a,a}class r0 extends NZ{children;constructor(t,n,e,r){super(t,"concat",n,e,r,t.resolve),"shared"!==t.resolve?.axis?.x&&"shared"!==t.resolve?.axis?.y||vU("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(t).map(((t,n)=>k0(t,this,this.getName(`concat_${n}`),void 0,r)))}parseData(){this.component.data=n0(this);for(const t of this.children)t.parseData()}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of bR(t.component.selection))this.component.selection[n]=t.component.selection[n]}wR(this.component.selection).some((t=>ZJ(t)))&&gU(Yq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){for(const t of this.children)t.parseAxesAndHeaders()}getChildren(t){return FY(t)?t.vconcat:EY(t)?t.hconcat:t.concat}parseLayoutSize(){!function(t){XZ(t);const n=void 0===t.layout.columns?"height":"childHeight";JZ(t,1===t.layout.columns?"width":"childWidth"),JZ(t,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.forEach((t=>t.assembleSignals())),[]}assembleLayoutSignals(){const t=BK(this);for(const n of this.children)t.push(...n.assembleLayoutSignals());return t}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleMarks(){return this.children.map((t=>{const n=t.assembleTitle(),e=t.assembleGroupStyle(),r=t.assembleGroupEncodeEntry(!1);return{type:"group",name:t.getName("group"),...n?{title:n}:{},...e?{style:e}:{},...r?{encode:{update:r}}:{},...t.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const t=this.layout.columns;return{...null!=t?{columns:t}:{},bounds:"full",align:"each"}}}const i0={disable:1,gridScale:1,scale:1,...CG,labelExpr:1,encode:1},o0=bR(i0);class a0 extends QV{explicit;implicit;mainExtracted;constructor(t={},n={},e=!1){super(),this.explicit=t,this.implicit=n,this.mainExtracted=e}clone(){return new a0(eR(this.explicit),eR(this.implicit),this.mainExtracted)}hasAxisPart(t){return!("axis"!==t&&("grid"===t||"title"===t?!this.get(t):!1===(n=this.get(t))||null===n));var n}hasOrientSignalRef(){return pq(this.explicit.orient)}}const u0={bottom:"top",top:"bottom",left:"right",right:"left"};function s0(t,n){if(!t)return n.map((t=>t.clone()));{if(t.length!==n.length)return;const e=t.length;for(let r=0;r<e;r++){const e=t[r],i=n[r];if(!!e!=!!i)return;if(e&&i){const n=e.getWithExplicit("orient"),o=i.getWithExplicit("orient");if(n.explicit&&o.explicit&&n.value!==o.value)return;t[r]=c0(e,i)}}}return t}function c0(t,n){for(const e of o0){const r=rX(t.getWithExplicit(e),n.getWithExplicit(e),e,"axis",((t,n)=>{switch(e){case"title":return Pq(t,n);case"gridScale":return{explicit:t.explicit,value:TR(t.value,n.value)}}return eX(t,n,e,"axis")}));t.setWithExplicit(e,r)}return t}function l0(t,n,e,r,i){if("disable"===n)return void 0!==e;switch(e=e||{},n){case"titleAngle":case"labelAngle":return t===(pq(e.labelAngle)?e.labelAngle:IR(e.labelAngle));case"values":return!!e.values;case"encode":return!!e.encoding||!!e.labelAngle;case"title":if(t===vK(r,i))return!0}return t===e[n]}const f0=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function d0(t,n){let e=n.axis(t);const r=new a0,i=vG(n.encoding[t]),{mark:o,config:a}=n,u=e?.orient||a["x"===t?"axisX":"axisY"]?.orient||a.axis?.orient||function(t){return"x"===t?"bottom":"left"}(t),s=n.getScaleComponent(t).get("type"),c=function(t,n,e,r){const i="band"===n?["axisDiscrete","axisBand"]:"point"===n?["axisDiscrete","axisPoint"]:pW(n)?["axisQuantitative"]:"time"===n||"utc"===n?["axisTemporal"]:[],o="x"===t?"axisX":"axisY",a=pq(e)?"axisOrient":`axis${DR(e)}`,u=[...i,...i.map((t=>o+t.substr(4)))],s=["axis",a,o];return{vlOnlyAxisConfig:lK(u,r,t,e),vgAxisConfig:lK(s,r,t,e),axisConfigStyle:fK([...s,...u],r)}}(t,s,u,n.config),l=void 0!==e?!e:dK("disable",a.style,e?.style,c).configValue;if(r.set("disable",l,void 0!==e),l)return r;e=e||{};const f=function(t,n,e,r,i){const o=n?.labelAngle;if(void 0!==o)return pq(o)?o:IR(o);{const{configValue:o}=dK("labelAngle",r,n?.style,i);return void 0!==o?IR(o):e!==JR||!sR([eW,tW],t.type)||YH(t)&&t.timeUnit?void 0:270}}(i,e,t,a.style,c),d=AH(e.formatType,i,s),h=MH(i,i.type,e.format,e.formatType,a,!0),m={fieldOrDatumDef:i,axis:e,channel:t,model:n,scaleType:s,orient:u,labelAngle:f,format:h,formatType:d,mark:o,config:a};for(const i of o0){const o=i in hK?hK[i](m):_G(i)?e[i]:void 0,u=void 0!==o,s=l0(o,i,e,n,t);if(u&&s)r.set(i,o,s);else{const{configValue:t,configFrom:n}=_G(i)&&"values"!==i?dK(i,a.style,e.style,c):{},l=void 0!==t;u&&!l?r.set(i,o,s):("vgAxisConfig"!==n||f0.has(i)&&l||FG(t)||pq(t))&&r.set(i,t,!1)}}const p=e.encoding??{},g=EG.reduce(((e,i)=>{if(!r.hasAxisPart(i))return e;const o=LK(p[i]??{},n),a="labels"===i?function(t,n,e){const{encoding:r,config:i}=t,o=vG(r[n])??vG(r[nI(n)]),a=t.axis(n)||{},{format:u,formatType:s}=a;if(bH(s))return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:u,formatType:s,config:i}),...e};if(void 0===u&&void 0===s&&i.customFormatTypes){if("quantitative"===VH(o)){if(rG(o)&&"normalize"===o.stack&&i.normalizedNumberFormatType)return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...e};if(i.numberFormatType)return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...e}}if("temporal"===VH(o)&&i.timeFormatType&&YH(o)&&!o.timeUnit)return{text:kH({fieldOrDatumDef:o,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...e}}return e}(n,t,o):o;return void 0===a||yR(a)||(e[i]={update:a}),e}),{});return yR(g)||r.set("encode",g,!!e.encoding||void 0!==e.labelAngle),r}function h0(t,n){const{config:e}=t;return{...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...uJ("size",t),...uJ("angle",t),...m0(t,0,n)}}function m0(t,n,e){return e?{shape:{value:e}}:uJ("shape",t)}function p0(t,n,e){if(void 0===Nq("align",t,e))return"center"}function g0(t,n,e){if(void 0===Nq("baseline",t,e))return"middle"}const v0={arc:{vgMark:"arc",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...wJ(t,"radius"),...wJ(t,"theta")})},area:{vgMark:"area",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...vJ("x",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===t.markDef.orient}),...vJ("y",t,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===t.markDef.orient}),...FJ(t)})},bar:{vgMark:"rect",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,"x"),...wJ(t,"y")})},circle:{vgMark:"symbol",encodeEntry:t=>h0(t,"circle")},geoshape:{vgMark:"shape",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:t=>{const{encoding:n}=t,e=n.shape;return[{type:"geoshape",projection:t.projectionName(),...e&&YH(e)&&e.type===rW?{field:uG(e,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,"x"),...wJ(t,"y"),...QX(t,"url")})},line:{vgMark:"line",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...uJ("size",t,{vgChannel:"strokeWidth"}),...FJ(t)})},point:{vgMark:"symbol",encodeEntry:t=>h0(t)},rect:{vgMark:"rect",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,"x"),...wJ(t,"y")})},rule:{vgMark:"rule",encodeEntry:t=>{const{markDef:n}=t,e=n.orient;return t.encoding.x||t.encoding.y||t.encoding.latitude||t.encoding.longitude?{...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...vJ("x",t,{defaultPos:"horizontal"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==e}),...vJ("y",t,{defaultPos:"vertical"===e?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==e}),...uJ("size",t,{vgChannel:"strokeWidth"})}:{}}},square:{vgMark:"symbol",encodeEntry:t=>h0(t,"square")},text:{vgMark:"text",encodeEntry:t=>{const{config:n,encoding:e}=t;return{...AJ(t,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...QX(t),...uJ("size",t,{vgChannel:"fontSize"}),...uJ("angle",t),...EJ("align",p0(t.markDef,0,n)),...EJ("baseline",g0(t.markDef,0,n)),...fJ("radius",t,{defaultPos:null}),...fJ("theta",t,{defaultPos:null})}}},tick:{vgMark:"rect",encodeEntry:t=>{const{config:n,markDef:e}=t,r=e.orient,i="horizontal"===r?"x":"y",o="horizontal"===r?"y":"x",a="horizontal"===r?"height":"width";return{...AJ(t,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wJ(t,i),...fJ(o,t,{defaultPos:"mid",vgChannel:"y"===o?"yc":"xc"}),[a]:Mq(Nq("thickness",e,n))}}},trail:{vgMark:"trail",encodeEntry:t=>({...AJ(t,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...fJ("x",t,{defaultPos:"mid"}),...fJ("y",t,{defaultPos:"mid"}),...uJ("size",t),...FJ(t)})}};const y0="faceted_path_",b0="stack_group_";function w0(t,n={fromPrefix:""}){const{mark:e,markDef:r,encoding:i,config:o}=t,a=TR(r.clip,function(t){const n=t.getScaleComponent("x"),e=t.getScaleComponent("y");return!(!n?.get("selectionExtent")&&!e?.get("selectionExtent"))||void 0}(t),function(t){const n=t.component.projection;return!(!n||n.isFit)||void 0}(t)),u=Eq(r),s=i.key,c=function(t){const{encoding:n,stack:e,mark:r,markDef:i,config:o}=t,a=n.order;if(!(!S(a)&&nG(a)&&uR(a.value)||!a&&uR(Nq("order",i,o)))){if((S(a)||YH(a))&&!e)return zq(a,{expr:"datum"});if(XW(r)){const t="horizontal"===i.orient?"y":"x";if(YH(n[t]))return{field:t}}}}(t),l=function(t){if(!t.component.selection)return null;const n=bR(t.component.selection).length;let e=n,r=t.parent;for(;r&&0===e;)e=bR(r.component.selection).length,r=r.parent;return e?{interactive:n>0||"geoshape"===t.mark||!!t.encoding.tooltip||!!t.markDef.tooltip}:null}(t);l&&Object.values(t.component.selection).some((t=>"point"===t.type&&!t.bind&&"pointerover"!==t.on))&&(t.markDef.cursor??="pointer");const f=Nq("aria",r,o),d=v0[e].postEncodingTransform?v0[e].postEncodingTransform(t):null;return[{name:t.getName("marks"),type:v0[e].vgMark,...a?{clip:a}:{},...u?{style:u}:{},...s?{key:s.field}:{},...c?{sort:c}:{},...l||{},...!1===f?{aria:f}:{},from:{data:n.fromPrefix+t.requestDataName(dX.Main)},encode:{update:v0[e].encodeEntry(t)},...d?{transform:d}:{}}]}class x0 extends CZ{markDef;encoding;specifiedScales={};stack;specifiedAxes={};specifiedLegends={};specifiedProjection={};selection=[];children=[];constructor(t,n,e,r={},i){super(t,"unit",n,e,i,void 0,OY(t)?t.view:void 0);const o=QW(t.mark)?{...t.mark}:{type:t.mark},a=o.type;void 0===o.filled&&(o.filled=function(t,n,{graticule:e}){if(e)return!1;const r=Cq("filled",t,n),i=t.type;return TR(r,i!==LW&&i!==RW&&i!==qW)}(o,i,{graticule:t.data&&fX(t.data)}));const u=this.encoding=function(t,n,e,r){const i={};for(const n of bR(t))JL(n)||vU(`${o=n}-encoding is dropped as ${o} is not a valid encoding channel.`);var o;for(let o of aI){if(!t[o])continue;const a=t[o];if(NI(o)){const t=oI(o),n=i[t];if(YH(n)&&KU(n.type)&&YH(a)&&!n.timeUnit){vU(Kq(t));continue}}if("angle"!==o||"arc"!==n||t.theta||(vU("Arc marks uses theta channel rather than angle, replacing angle with theta."),o=iL),qG(t,o,n)){if(o===pL&&"line"===n){const n=gG(t[o]);if(n?.aggregate){vU("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(o===fL&&(e?"fill"in t:"stroke"in t))vU(Zq("encoding",{fill:"fill"in t,stroke:"stroke"in t}));else if(o===ML||o===kL&&!S(a)&&!nG(a)||o===DL&&S(a)){if(a){if(o===kL){const n=t[o];if(UH(n)){i[o]=n;continue}}i[o]=Q(a).reduce(((t,n)=>(YH(n)?t.push(wG(n,o)):vU(tU(n,o)),t)),[])}}else{if(o===DL&&null===a)i[o]=null;else if(!(YH(a)||XH(a)||nG(a)||WH(a)||pq(a))){vU(tU(a,o));continue}i[o]=yG(a,o,r)}}else vU(nU(o,n))}return i}(t.encoding||{},a,o.filled,i);this.markDef=rV(o,u,i),this.size=function({encoding:t,size:n}){for(const e of MI){const r=eI(e);CY(n[r])&&JH(t[e])&&(delete n[r],vU(cU(r)))}return n}({encoding:u,size:OY(t)?{...r,...void 0!==t.width?{width:t.width}:{},...void 0!==t.height?{height:t.height}:{}}:r}),this.stack=eV(this.markDef,u),this.specifiedScales=this.initScales(a,u),this.specifiedAxes=this.initAxes(u),this.specifiedLegends=this.initLegends(u),this.specifiedProjection=t.projection,this.selection=(t.params??[]).filter((t=>AY(t))),this.alignStackOrderWithColorDomain()}get hasProjection(){const{encoding:t}=this,n=this.mark===VW,e=t&&BL.some((n=>ZH(t[n])));return n||e}scaleDomain(t){const n=this.specifiedScales[t];return n?n.domain:void 0}axis(t){return this.specifiedAxes[t]}legend(t){return this.specifiedLegends[t]}initScales(t,n){return WI.reduce(((t,e)=>{const r=vG(n[e]);return r&&(t[e]=this.initScale(r.scale??{})),t}),{})}initScale(t){const{domain:n,range:e}=t,r=dq(t);return S(n)&&(r.domain=n.map($q)),S(e)&&(r.range=e.map($q)),r}initAxes(t){return MI.reduce(((n,e)=>{const r=t[e];if(ZH(r)||e===JR&&ZH(t.x2)||e===KR&&ZH(t.y2)){const t=ZH(r)?r.axis:void 0;n[e]=t?this.initAxis({...t}):t}return n}),{})}initAxis(t){const n=bR(t),e={};for(const r of n){const n=t[r];e[r]=FG(n)?xq(n):$q(n)}return e}initLegends(t){return qI.reduce(((n,e)=>{const r=vG(t[e]);if(r&&function(t){switch(t){case fL:case dL:case hL:case pL:case mL:case vL:case wL:case xL:return!0;case yL:case bL:case gL:case lL:return!1}}(e)){const t=r.legend;n[e]=t?dq(t):t}return n}),{})}alignStackOrderWithColorDomain(){const{color:t,fill:n,order:e,xOffset:r,yOffset:i}=this.encoding,o=n||t,a=YH(o)?o:void 0,u=a?.field,s=a?.scale,c=a?.type,l=s?.domain,f=r||i,d=YH(f)?f:void 0,h=`_${u}_sort_index`;if(!e&&Array.isArray(l)&&"string"==typeof u&&"nominal"===c)if(d&&!d.sort)d.sort=l;else{if(!this.stack)return;const t=`indexof(${Nt(l)}, datum['${u}'])`,n="horizontal"===this.markDef?.orient?"ascending":"descending";this.transforms.push({calculate:t,as:h}),this.encoding.order={field:h,type:"quantitative",sort:n}}}parseData(){this.component.data=n0(this)}parseLayoutSize(){!function(t){const{size:n,component:e}=t;for(const r of MI){const i=eI(r);if(null!=n[i]&&null!=n[i]){const t=n[i];e.layoutSize.set(i,CY(t)?"step":t,!0)}else{const n=KZ(t,i);e.layoutSize.set(i,n,!1)}}}(this)}parseSelections(){this.component.selection=function(t,n){const e={},r=t.config.selection;if(!n||!n.length)return e;let i=0;for(const o of n){const n=kR(o.name),a=o.select,u=$t(a)?a:a.type,s=F(a)?eR(a):{type:u},c=r[u];for(const t in c)"fields"!==t&&"encodings"!==t&&("mark"===t&&(s.mark={...c.mark,...s.mark}),void 0!==s[t]&&!0!==s[t]||(s[t]=eR(c[t]??s[t])));const l=e[n]={...s,name:n,type:u,init:o.value,bind:o.bind,events:$t(s.on)?eB(s.on,"scope"):Q(eR(s.on))};if(ZJ(l)&&(i++,i>1)){delete e[n];continue}const f=eR(o);for(const n of XJ)n.defined(l)&&n.parse&&n.parse(t,l,f)}return i>1&&vU("Multiple timer selections in one unit spec are not supported. Ignoring all but the first."),e}(this,this.selection)}parseMarkGroup(){this.component.mark=function(t){if(sR([RW,TW,HW],t.mark)){const n=HG(t.mark,t.encoding);if(n.length>0)return function(t,n){return[{name:t.getName("pathgroup"),type:"group",from:{facet:{name:y0+t.requestDataName(dX.Main),data:t.requestDataName(dX.Main),groupby:n}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:w0(t,{fromPrefix:y0})}]}(t,n)}else if(t.mark===PW){const n=wq.some((n=>Nq(n,t.markDef,t.config)));if(t.stack&&!t.fieldDef("size")&&n)return function(t){const[n]=w0(t,{fromPrefix:b0}),e=t.scaleName(t.stack.fieldChannel),r=(n={})=>t.vgField(t.stack.fieldChannel,n),i=(t,n)=>`${t}(${[r({prefix:"min",suffix:"start",expr:n}),r({prefix:"max",suffix:"start",expr:n}),r({prefix:"min",suffix:"end",expr:n}),r({prefix:"max",suffix:"end",expr:n})].map((t=>`scale('${e}',${t})`)).join(",")})`;let o,a;"x"===t.stack.fieldChannel?(o={...iR(n.encode.update,["y","yc","y2","height",...wq]),x:{signal:i("min","datum")},x2:{signal:i("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},n.encode.update={...oR(n.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...iR(n.encode.update,["x","xc","x2","width"]),y:{signal:i("min","datum")},y2:{signal:i("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},n.encode.update={...oR(n.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const e of wq){const r=Cq(e,t.markDef,t.config);n.encode.update[e]?(o[e]=n.encode.update[e],delete n.encode.update[e]):r&&(o[e]=Mq(r)),r&&(n.encode.update[e]={value:0})}const u=[];if(t.stack.groupbyChannels?.length>0)for(const n of t.stack.groupbyChannels){const e=t.fieldDef(n),r=uG(e);r&&u.push(r),(e?.bin||e?.timeUnit)&&u.push(uG(e,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((e,r)=>{if(n.encode.update[r])return{...e,[r]:n.encode.update[r]};{const n=Cq(r,t.markDef,t.config);return void 0!==n?{...e,[r]:Mq(n)}:e}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:t.requestDataName(dX.Main),name:b0+t.requestDataName(dX.Main),groupby:u,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[n]}]}]}(t)}return w0(t)}(this)}parseAxesAndHeaders(){var t;this.component.axes=(t=this,MI.reduce(((n,e)=>(t.component.scales[e]&&(n[e]=[d0(e,t)]),n)),{}))}assembleSelectionTopLevelSignals(t){return function(t,n){let e=!1;for(const r of wR(t.component.selection??{})){const i=r.name,o=Nt(i+HJ);if(0===n.filter((t=>t.name===i)).length){const t="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${VJ}(${o}, ${Nt("global"===r.resolve?"union":r.resolve)}${t}`})}e=!0;for(const e of XJ)e.defined(r)&&e.topLevelSignals&&(n=e.topLevelSignals(t,r,n))}return e&&0===n.filter((t=>"unit"===t.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),qX(n)}(this,t)}assembleSignals(){return[...cK(this),...RX(this,[])]}assembleSelectionData(t){return function(t,n){const e=[],r=[],i=JJ(t,{escape:!1});for(const o of wR(t.component.selection??{})){const a={name:o.name+HJ};if(o.project.hasSelectionId&&(a.transform=[{type:"collect",sort:{field:xY}}]),o.init){const t=o.project.items.map(PX);a.values=o.init.map(o.project.hasSelectionId?t=>({unit:i,[xY]:jX(t,!1)[0]}):n=>({unit:i,fields:t,values:jX(n,!1)}))}if([...e,...n].filter((t=>t.name===o.name+HJ)).length||e.push(a),ZJ(o)&&n.length){const e=t.lookupDataSource(t.getDataName(dX.Main)),i=n.find((t=>t.name===e)),o=i.transform.find((t=>"filter"===t.type&&t.expr.includes("vlSelectionTest")));o&&(i.transform=i.transform.filter((t=>t!==o)),r.push({name:i.name+SX,source:i.name,transform:[o]}))}}return e.concat(n,r)}(this,t)}assembleLayout(){return null}assembleLayoutSignals(){return BK(this)}correctDataNames=t=>(t.from?.data&&(t.from.data=this.lookupDataSource(t.from.data),"time"in this.encoding&&(t.from.data=t.from.data+SX)),t.from?.facet?.data&&(t.from.facet.data=this.lookupDataSource(t.from.facet.data)),t);assembleMarks(){let t=this.component.mark??[];return this.parent&&EZ(this.parent)||(t=IX(this,t)),t.map(this.correctDataNames)}assembleGroupStyle(){const{style:t}=this.view||{};return void 0!==t?t:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(t){return PG(this.encoding,t)}fieldDef(t){return gG(this.encoding[t])}typedFieldDef(t){const n=this.fieldDef(t);return tG(n)?n:null}}class $0 extends NZ{children;constructor(t,n,e,r,i){super(t,"layer",n,e,i,t.resolve,t.view);const o={...r,...t.width?{width:t.width}:{},...t.height?{height:t.height}:{}};this.children=t.layer.map(((t,n)=>{if(XY(t))return new $0(t,this,this.getName(`layer_${n}`),o,i);if(BG(t))return new x0(t,this,this.getName(`layer_${n}`),o,i);throw new Error(jq(t))}))}parseData(){this.component.data=n0(this);for(const t of this.children)t.parseData()}parseLayoutSize(){XZ(this),JZ(this,"width"),JZ(this,"height")}parseSelections(){this.component.selection={};for(const t of this.children){t.parseSelections();for(const n of bR(t.component.selection))this.component.selection[n]=t.component.selection[n]}wR(this.component.selection).some((t=>ZJ(t)))&&gU(Yq)}parseMarkGroup(){for(const t of this.children)t.parseMarkGroup()}parseAxesAndHeaders(){!function(t){const{axes:n,resolve:e}=t.component,r={top:0,bottom:0,right:0,left:0};for(const r of t.children){r.parseAxesAndHeaders();for(const i of bR(r.component.axes))e.axis[i]=qK(t.component.resolve,i),"shared"===e.axis[i]&&(n[i]=s0(n[i],r.component.axes[i]),n[i]||(e.axis[i]="independent",delete n[i]))}for(const i of MI){for(const o of t.children)if(o.component.axes[i]){if("independent"===e.axis[i]){n[i]=(n[i]??[]).concat(o.component.axes[i]);for(const t of o.component.axes[i]){const{value:n,explicit:e}=t.getWithExplicit("orient");if(!pq(n)){if(r[n]>0&&!e){const e=u0[n];r[n]>r[e]&&t.set("orient",e,!1)}r[n]++}}}delete o.component.axes[i]}if("independent"===e.axis[i]&&n[i]&&n[i].length>1)for(const[t,e]of(n[i]||[]).entries())t>0&&e.get("grid")&&!e.explicit.grid&&(e.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(t){return this.children.reduce(((t,n)=>n.assembleSelectionTopLevelSignals(t)),t)}assembleSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleSignals())),cK(this))}assembleLayoutSignals(){return this.children.reduce(((t,n)=>t.concat(n.assembleLayoutSignals())),BK(this))}assembleSelectionData(t){return this.children.reduce(((t,n)=>n.assembleSelectionData(t)),t)}assembleGroupStyle(){const t=new Set;for(const n of this.children)for(const e of Q(n.assembleGroupStyle()))t.add(e);const n=Array.from(t);return n.length>1?n:1===n.length?n[0]:void 0}assembleTitle(){let t=super.assembleTitle();if(t)return t;for(const n of this.children)if(t=n.assembleTitle(),t)return t}assembleLayout(){return null}assembleMarks(){return function(t,n){for(const e of t.children)DZ(e)&&(n=IX(e,n));return n}(this,this.children.flatMap((t=>t.assembleMarks())))}assembleLegends(){return this.children.reduce(((t,n)=>t.concat(n.assembleLegends())),rQ(this))}}function k0(t,n,e,r,i){if(PH(t))return new ZZ(t,n,e,i);if(XY(t))return new $0(t,n,e,r,i);if(BG(t))return new x0(t,n,e,r,i);if(function(t){return FY(t)||EY(t)||SY(t)}(t))return new r0(t,n,e,i);throw new Error(jq(t))}var M0,A0,D0=Object.freeze({__proto__:null,accessPathDepth:BR,accessPathWithDatum:SR,accessWithDatumToUnescapedPath:ER,compile:function(t,n={}){n.logger&&(pU=n.logger),n.fieldTitle&&fG(n.fieldTitle);try{const e=WY(N(n.config,t.config)),r=HV(t,e),i=k0(r,null,"",void 0,e);i.parse(),function(t,n){HQ(t.sources);let e=0,r=0;for(let r=0;r<5&&YQ(t,n,!0);r++)e++;t.sources.map(qQ);for(let e=0;e<5&&YQ(t,n,!1);e++)r++;HQ(t.sources),5===Math.max(e,r)&&vU("Maximum optimization runs(5) reached.")}(i.component.data,i);const o=function(t,n,e={},r){const i=t.config?function(t){t=eR(t);for(const n of GY)delete t[n];if(t.axis)for(const n in t.axis)FG(t.axis[n])&&delete t.axis[n];if(t.legend)for(const n of mY)delete t.legend[n];if(t.mark){for(const n of tH)delete t.mark[n];t.mark.tooltip&&F(t.mark.tooltip)&&delete t.mark.tooltip}t.params&&(t.signals=(t.signals||[]).concat(DY(t.params)),delete t.params);for(const n of HY){for(const e of tH)delete t[n][e];const e=YY[n];if(e)for(const r of e)delete t[n][r];VY(t,n)}for(const n of bR(dY))delete t[n];!function(t){const{titleMarkConfig:n,subtitleMarkConfig:e,subtitle:r}=hq(t.title);yR(n)||(t.style["group-title"]={...t.style["group-title"],...n}),yR(e)||(t.style["group-subtitle"]={...t.style["group-subtitle"],...e}),yR(r)?delete t.title:t.title=r}(t);for(const n in t)F(t[n])&&yR(t[n])&&delete t[n];return yR(t)?void 0:t}(t.config):void 0,o=function(t,n){const e=[],r=HZ(e);let i=0;for(const n of t.sources){n.hasName()||(n.dataName="source_"+i++);const t=n.assemble();r(n,t)}for(const t of e)0===t.transform.length&&delete t.transform;let o=0;for(const[t,n]of e.entries())0!==(n.transform??[]).length||n.source||e.splice(o++,0,e.splice(t,1)[0]);for(const n of e)for(const e of n.transform??[])"lookup"===e.type&&(e.from=t.outputNodes[e.from].getSource());for(const t of e)t.name in n&&(t.values=n[t.name]);return e}(t.component.data,e),a=t.assembleSelectionData(o),u=t.assembleProjections(),s=t.assembleTitle(),c=t.assembleGroupStyle(),l=t.assembleGroupEncodeEntry(!0);let f=t.assembleLayoutSignals();f=f.filter((t=>"width"!==t.name&&"height"!==t.name||void 0===t.value||(n[t.name]=+t.value,!1)));const{params:d,...h}=n;return{$schema:"https://vega.github.io/schema/vega/v6.json",...t.description?{description:t.description}:{},...h,...s?{title:s}:{},...c?{style:c}:{},...l?{encode:{update:l}}:{},data:a,...u.length>0?{projections:u}:{},...t.assembleGroup([...f,...t.assembleSelectionTopLevelSignals([]),...DY(d)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}(i,function(t,n,e,r){const i=r.component.layoutSize.get("width"),o=r.component.layoutSize.get("height");if(void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):$t(n)&&(n={type:n}),i&&o&&["fit","fit-x","fit-y"].includes(n.type))if("step"===i&&"step"===o)vU(Iq()),n.type="pad";else if("step"===i||"step"===o){const t="step"===i?"width":"height";vU(Iq(FI(t))),n.type=function(t){return t?`fit-${FI(t)}`:"fit"}("width"===t?"height":"width")}return{...1===bR(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...KV(e,!1),...KV(t,!0)}}(t,r.autosize,e,i),t.datasets,t.usermeta);return{spec:o,normalized:r}}finally{n.logger&&(pU=mU),n.fieldTitle&&fG(cG)}},contains:sR,deepEqual:WR,deleteNestedProperty:AR,duplicate:eR,entries:xR,every:lR,fieldIntersection:vR,flatAccessWithDatum:FR,getFirstDefined:TR,hasIntersection:pR,hasProperty:GR,hash:aR,internalField:RR,isBoolean:$R,isEmpty:yR,isEqual:function(t,n){const e=bR(t),r=bR(n);if(e.length!==r.length)return!1;for(const r of e)if(t[r]!==n[r])return!1;return!0},isInternalField:LR,isNullOrFalse:uR,isNumeric:qR,keys:bR,logicalExpr:MR,mergeDeep:fR,never:rR,normalize:HV,normalizeAngle:IR,omit:oR,pick:iR,prefixGenerator:gR,removePathFromField:zR,replaceAll:_R,replacePathInField:OR,resetIdCounter:function(){PR=42},setEqual:mR,some:cR,stringify:HR,titleCase:DR,unescapeSingleQuoteAndPathDot:NR,unique:hR,uniqueId:jR,vals:wR,varName:kR,version:"6.4.1"});function S0(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var F0=S0(A0?M0:(A0=1,M0=function(t){var n=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(t).slice(1,3);return{library:n[0],version:n[1]}}));const E0="#fff",N0="#888",C0={background:"#333",view:{stroke:N0},title:{color:E0,subtitleColor:E0},style:{"guide-label":{fill:E0},"guide-title":{fill:E0}},axis:{domainColor:E0,gridColor:N0,tickColor:E0}},O0="#4572a7",_0={background:"#fff",arc:{fill:O0},area:{fill:O0},line:{stroke:O0,strokeWidth:2},path:{stroke:O0},rect:{fill:O0},shape:{stroke:O0},symbol:{fill:O0,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"]}},z0="#30a2da",B0="#cbcbcb",T0="#f0f0f0",P0="#333",j0={arc:{fill:z0},area:{fill:z0},axis:{domainColor:B0,grid:!0,gridColor:B0,gridWidth:1,labelColor:"#999",labelFontSize:10,titleColor:"#333",tickColor:B0,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:T0,group:{fill:T0},legend:{labelColor:P0,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:P0,titleFontSize:14,titlePadding:10},line:{stroke:z0,strokeWidth:2},path:{stroke:z0,strokeWidth:.5},rect:{fill:z0},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:z0},bar:{binSpacing:2,fill:z0,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},R0="#000",L0={group:{fill:"#e5e5e5"},arc:{fill:R0},area:{fill:R0},line:{stroke:R0},path:{stroke:R0},rect:{fill:R0},shape:{stroke:R0},symbol:{fill:R0,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"]}},I0="Benton Gothic, sans-serif",q0="#82c6df",U0="Benton Gothic Bold, sans-serif",W0="normal",H0={"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"]},G0={background:"#ffffff",title:{anchor:"start",color:"#000000",font:U0,fontSize:22,fontWeight:"normal"},arc:{fill:q0},area:{fill:q0},line:{stroke:q0,strokeWidth:2},path:{stroke:q0},rect:{fill:q0},shape:{stroke:q0},symbol:{fill:q0,size:30},axis:{labelFont:I0,labelFontSize:11.5,labelFontWeight:"normal",titleFont:U0,titleFontSize:13,titleFontWeight:W0},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:I0,labelFontSize:11.5,symbolType:"square",titleFont:U0,titleFontSize:13,titleFontWeight:W0},range:{category:H0["category-6"],diverging:H0["fireandice-6"],heatmap:H0["fire-7"],ordinal:H0["fire-7"],ramp:H0["fire-7"]}},Y0="#ab5787",V0="#979797",X0={background:"#f9f9f9",arc:{fill:Y0},area:{fill:Y0},line:{stroke:Y0},path:{stroke:Y0},rect:{fill:Y0},shape:{stroke:Y0},symbol:{fill:Y0,size:30},axis:{domainColor:V0,domainWidth:.5,gridWidth:.2,labelColor:V0,tickColor:V0,tickWidth:.2,titleColor:V0},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"]}},J0="#3e5c69",K0={background:"#fff",arc:{fill:J0},area:{fill:J0},line:{stroke:J0},path:{stroke:J0},rect:{fill:J0},shape:{stroke:J0},symbol:{fill:J0},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"]}},Q0="#1696d2",Z0="#000000",t1="Lato",n1="Lato",e1={"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"]},r1={background:"#FFFFFF",title:{anchor:"start",fontSize:18,font:t1},axisX:{domain:!0,domainColor:Z0,domainWidth:1,grid:!1,labelFontSize:12,labelFont:n1,labelAngle:0,tickColor:Z0,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:t1},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:"#DEDDDD",gridWidth:1,labelFontSize:12,labelFont:n1,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:t1,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:n1,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:t1,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:e1["six-groups-cat-1"],diverging:e1["diverging-colors"],heatmap:e1["diverging-colors"],ordinal:e1["six-groups-seq"],ramp:e1["shades-blue"]},area:{fill:Q0},rect:{fill:Q0},line:{color:Q0,stroke:Q0,strokeWidth:5},trail:{color:Q0,stroke:Q0,strokeWidth:0,size:1},path:{stroke:Q0,strokeWidth:.5},point:{filled:!0},text:{font:"Lato",color:Q0,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:Q0,stroke:null}},arc:{fill:Q0},shape:{stroke:Q0},symbol:{fill:Q0,size:30}},i1="#3366CC",o1="#ccc",a1="Arial, sans-serif",u1={arc:{fill:i1},area:{fill:i1},path:{stroke:i1},rect:{fill:i1},shape:{stroke:i1},symbol:{stroke:i1},circle:{fill:i1},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:a1,fontSize:12},"guide-title":{font:a1,fontSize:12},"group-title":{font:a1,fontSize:12}},title:{font:a1,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:o1,tickColor:o1,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},s1=t=>t*(1/3+1),c1=s1(9),l1=s1(10),f1=s1(12),d1="Segoe UI",h1="wf_standard-font, helvetica, arial, sans-serif",m1="#252423",p1="#605E5C",g1="transparent",v1="#118DFF",y1="#DEEFFF",b1=[y1,v1],w1={view:{stroke:g1},background:g1,font:d1,header:{titleFont:h1,titleFontSize:f1,titleColor:m1,labelFont:d1,labelFontSize:l1,labelColor:p1},axis:{ticks:!1,grid:!1,domain:!1,labelColor:p1,labelFontSize:c1,titleFont:h1,titleColor:m1,titleFontSize:f1,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:v1},line:{stroke:v1,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:d1,fontSize:c1,fill:p1},arc:{fill:v1},area:{fill:v1,line:!0,opacity:.6},path:{stroke:v1},rect:{fill:v1},point:{fill:v1,filled:!0,size:75},shape:{stroke:v1},symbol:{fill:v1,strokeWidth:1.5,size:50},legend:{titleFont:d1,titleFontWeight:"bold",titleColor:p1,labelFont:d1,labelFontSize:l1,labelColor:p1,symbolType:"circle",symbolSize:75},range:{category:[v1,"#12239E","#E66C37","#6B007B","#E044A7","#744EC2","#D9B300","#D64550"],diverging:b1,heatmap:b1,ordinal:[y1,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",v1]}},x1='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',$1={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"}},k1=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],M1=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function A1({theme:t,background:n}){const e=["white","g10"].includes(t)?"light":"dark",r=$1.gridBg[t],i=$1.textPrimary[t],o=$1.textSecondary[t],a="dark"===e?"#d4bbff":"#6929c4";return{background:n,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:r,stroke:r},group:{fill:r},title:{color:i,anchor:"start",dy:-15,fontSize:16,font:x1,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:$1.layerAccent01[t],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:x1,fill:o,fontWeight:400},"guide-title":{font:x1,fill:o,fontWeight:400}},range:{category:"dark"===e?k1:M1,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 D1=A1({theme:"white",background:"#ffffff"}),S1=A1({theme:"g10",background:"#f4f4f4"}),F1=A1({theme:"g90",background:"#262626"}),E1=A1({theme:"g100",background:"#161616"});var N1=Object.freeze({__proto__:null,carbong10:S1,carbong100:E1,carbong90:F1,carbonwhite:D1,dark:C0,excel:_0,fivethirtyeight:j0,ggplot2:L0,googlecharts:u1,latimes:G0,powerbi:w1,quartz:X0,urbaninstitute:r1,version:"3.0.0",vox:K0});function C1(t,n){return JSON.stringify(t,function(t){const n=[];return function(e,r){if("object"!=typeof r||null===r)return r;const i=n.indexOf(this)+1;return n.length=i,n.length>t?"[Object]":n.indexOf(r)>=0?"[Circular]":(n.push(r),r)}}(n))}const O1="vg-tooltip-element",_1={offsetX:10,offsetY:10,id:O1,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:function(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;")},maxDepth:2,formatTooltip:function(t,n,e,r){if(S(t))return`[${t.map((t=>n($t(t)?t:C1(t,e)))).join(", ")}]`;if(F(t)){let i="";const{title:o,image:a,...u}=t;o&&(i+=`<h2>${n(o)}</h2>`),a&&(i+=`<img src="${new URL(n(a),r||location.href).href}">`);const s=Object.keys(u);if(s.length>0){i+="<table>";for(const t of s){let r=u[t];void 0!==r&&(F(r)&&(r=C1(r,e)),i+=`<tr><td class="key">${n(t)}</td><td class="value">${n(r)}</td></tr>`)}i+="</table>"}return i||"{}"}return n(t)},baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function z1(t,n,{offsetX:e,offsetY:r}){const i=B1({x1:t.clientX,x2:t.clientX,y1:t.clientY,y2:t.clientY},n,e,r),o=["bottom-right","bottom-left","top-right","top-left"];for(const t of o)if(T1(i[t],n))return i[t];return i["top-left"]}function B1(t,n,e,r){const i=t.x1-n.width-e,o=(t.x1+t.x2)/2-n.width/2,a=t.x2+e,u=t.y1-n.height-r,s=(t.y1+t.y2)/2-n.height/2,c=t.y2+r;return{top:{x:o,y:u},bottom:{x:o,y:c},left:{x:i,y:s},right:{x:a,y:s},"top-left":{x:i,y:u},"top-right":{x:a,y:u},"bottom-left":{x:i,y:c},"bottom-right":{x:a,y:c}}}function T1(t,n){return t.x>=0&&t.y>=0&&t.x+n.width<=window.innerWidth&&t.y+n.height<=window.innerHeight}function P1(t,n,e){return t.clientX>=n.x&&t.clientX<=n.x+e.width&&t.clientY>=n.y&&t.clientY<=n.y+e.height}class j1{call;options;el;constructor(t){this.options={..._1,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const t=document.createElement("style");t.setAttribute("id",this.options.styleId),t.innerHTML=function(t){if(!/^[A-Za-z]+[-:.\w]*$/.test(t))throw new Error("Invalid HTML ID");return"#vg-tooltip-element {\n visibility: hidden;\n padding: 8px;\n position: fixed;\n z-index: 1000;\n font-family: sans-serif;\n font-size: 11px;\n border-radius: 3px;\n box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);\n /* The default theme is the light theme. */\n background-color: rgba(255, 255, 255, 0.95);\n border: 1px solid #d9d9d9;\n color: black;\n}\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}\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.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".toString().replaceAll(O1,t)}(n);const e=document.head;e.childNodes.length>0?e.insertBefore(t,e.childNodes[0]):e.appendChild(t)}}tooltipHandler(t,n,e,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)),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(t,n,e,r,i){const{position:o,offsetX:a,offsetY:u}=i,s=function(t,n,e){const r=e.isVoronoi?e.datum.bounds:e.bounds;let i=t.left+n[0]+r.x1,o=t.top+n[1]+r.y1,a=e;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)}}(t._el.getBoundingClientRect(),t._origin,e),c=B1(s,r,a,u),l=Array.isArray(o)?o:[o];for(const t of l)if(T1(c[t],r)&&!P1(n,c[t],r))return c[t];return z1(n,r,i)}(t,n,e,this.el.getBoundingClientRect(),this.options):z1(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${o}px`,this.el.style.left=`${i}px`}}
2
2
  /*!
3
3
  * https://github.com/Starcounter-Jack/JSON-Patch
4
4
  * (c) 2017-2022 Joachim Wester